Browse Source

Add hand-written type stubs

Getty Ritter 4 years ago
parent
commit
cf7b9036e8

+ 38 - 0
stubs/peewee.py

@@ -0,0 +1,38 @@
+from typing import Any, Optional, TypeVar, Type, List
+
+class Expression:
+    pass
+
+T = TypeVar('T', bound='Model')
+
+class Model:
+    id: int
+
+    @classmethod
+    def create(cls: Type[T], **kwargs) -> T:
+        pass
+
+    @classmethod
+    def get(cls: Type[T], expr: Optional[Expression] = None, **kwargs) -> T:
+        pass
+
+    @classmethod
+    def get_or_none(cls: Type[T], expr: Optional[Expression] = None, **kwargs) -> T:
+        pass
+
+    @classmethod
+    def select(self, expr: Optional[Expression] = None):
+        pass
+
+# These all do things that MyPy chokes on
+def TextField() -> Any:
+    pass
+
+def DateTimeField() -> Any:
+    pass
+
+def BooleanField() -> Any:
+    pass
+
+def ForeignKeyField(key: object, null: bool = None, backref: str = "") -> Any:
+    pass

+ 0 - 0
stubs/playhouse.py


+ 0 - 0
stubs/playhouse/__init__.py


+ 5 - 0
stubs/playhouse/sqlite_ext.py

@@ -0,0 +1,5 @@
+import typing
+
+class SqliteExtDatabase:
+    def __init__(self, path: typing.Optional[str]):
+        pass

+ 1 - 0
stubs/pystache/__init__.py

@@ -0,0 +1 @@
+import pystache.loader

+ 4 - 0
stubs/pystache/loader.py

@@ -0,0 +1,4 @@
+from typing import List
+
+class Loader:
+    def __init__(self, extension: str, search_dirs: List[str]): pass