peewee.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. @classmethod
  8. def create(cls: Type[T], **kwargs) -> T:
  9. pass
  10. @classmethod
  11. def get(cls: Type[T], expr: Optional[Expression] = None, **kwargs) -> T:
  12. pass
  13. @classmethod
  14. def get_or_none(cls: Type[T], expr: Optional[Expression] = None, **kwargs) -> T:
  15. pass
  16. @classmethod
  17. def select(self, expr: Optional[Expression] = None):
  18. pass
  19. def save(self):
  20. pass
  21. # These all do things that MyPy chokes on, so we're going to treat
  22. # them like methods instead of naming classes
  23. def TextField(default: str = "", unique: bool = False, null: bool = None) -> Any:
  24. pass
  25. def DateTimeField(unique: bool = False, null: bool = None) -> Any:
  26. pass
  27. def BooleanField(default: bool = False, unique: bool = False, null: bool = None) -> Any:
  28. pass
  29. def ForeignKeyField(key: object, null: bool = None, backref: str = "") -> Any:
  30. pass
  31. class IntegrityError(Exception):
  32. pass