peewee.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. from typing import Any, Optional, TypeVar, Type, List
  2. class Expression:
  3. pass
  4. T = TypeVar("T", bound="Model")
  5. class Model:
  6. id: int
  7. class DoesNotExist(Exception):
  8. pass
  9. @classmethod
  10. def create(cls: Type[T], **kwargs) -> T:
  11. pass
  12. @classmethod
  13. def get(cls: Type[T], expr: Optional[Expression] = None, **kwargs) -> T:
  14. pass
  15. @classmethod
  16. def get_or_none(cls: Type[T], expr: Optional[Expression] = None, **kwargs) -> T:
  17. pass
  18. @classmethod
  19. def select(self, expr: Optional[Expression] = None):
  20. pass
  21. def save(self):
  22. pass
  23. def delete_instance(self) -> Any:
  24. pass
  25. @classmethod
  26. def alias(cls: Type[T]) -> Type[T]:
  27. pass
  28. @classmethod
  29. def delete(self) -> Any:
  30. pass
  31. # These all do things that MyPy chokes on, so we're going to treat
  32. # them like methods instead of naming classes
  33. def TextField(default: str = "", unique: bool = False, null: bool = None) -> Any:
  34. pass
  35. def DateTimeField(unique: bool = False, null: bool = None) -> Any:
  36. pass
  37. def BooleanField(default: bool = False, unique: bool = False, null: bool = None) -> Any:
  38. pass
  39. def ForeignKeyField(key: object, null: bool = None, backref: str = "") -> Any:
  40. pass
  41. class IntegrityError(Exception):
  42. pass
  43. JOIN: Any = None
  44. fn: Any = None