Browse Source

Fix type errors

Getty Ritter 3 years ago
parent
commit
70621770d6
2 changed files with 10 additions and 2 deletions
  1. 2 2
      lc/model.py
  2. 8 0
      stubs/peewee.py

+ 2 - 2
lc/model.py

@@ -338,12 +338,12 @@ class Tag(Model):
     @staticmethod
     def clean():
         unused = (
-            Tag.select(Tag.id)
+            Tag.select(Tag.id)  # type: ignore
             .join(HasTag, peewee.JOIN.LEFT_OUTER)
             .group_by(Tag.name)
             .having(peewee.fn.COUNT(HasTag.id) == 0)
         )
-        Tag.delete().where(Tag.id.in_(unused)).execute()
+        Tag.delete().where(Tag.id.in_(unused)).execute()  # type: ignore
 
 
 class HasTag(Model):

+ 8 - 0
stubs/peewee.py

@@ -40,6 +40,10 @@ class Model:
     def alias(cls: Type[T]) -> Type[T]:
         pass
 
+    @classmethod
+    def delete(self) -> Any:
+        pass
+
 
 # These all do things that MyPy chokes on, so we're going to treat
 # them like methods instead of naming classes
@@ -61,3 +65,7 @@ def ForeignKeyField(key: object, null: bool = None, backref: str = "") -> Any:
 
 class IntegrityError(Exception):
     pass
+
+
+JOIN: Any = None
+fn: Any = None