Browse Source

Fix types on master

Getty Ritter 3 years ago
parent
commit
97a4b2073d
3 changed files with 13 additions and 1 deletions
  1. 4 1
      lc/migration.py
  2. 4 0
      stubs/peewee.py
  3. 5 0
      stubs/playhouse/migrate.py

+ 4 - 1
lc/migration.py

@@ -14,5 +14,8 @@ class Migration:
         self.method(db)
 
 def migration(method):
-    version, name = module_name_regex.match(method.__module__).groups()
+    match = module_name_regex.match(method.__module__)
+    if not match:
+        raise Exception(f"Unable to find migration version in #{method.__module__}")
+    version, name = match.groups()
     registered.append(Migration(version, name, method))

+ 4 - 0
stubs/peewee.py

@@ -63,6 +63,10 @@ def ForeignKeyField(key: object, null: bool = None, backref: str = "") -> Any:
     pass
 
 
+def IntegerField(default: int = 0, unique: bool = False, null: bool = None) -> Any:
+    pass
+
+
 class IntegrityError(Exception):
     pass
 

+ 5 - 0
stubs/playhouse/migrate.py

@@ -0,0 +1,5 @@
+import typing
+
+class SqliteMigrator:
+    def __init__(self, db: typing.Any):
+        pass