peewee.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. # These all do things that MyPy chokes on, so we're going to treat
  26. # them like methods instead of naming classes
  27. def TextField(default: str = "", unique: bool = False, null: bool = None) -> Any:
  28. pass
  29. def DateTimeField(unique: bool = False, null: bool = None) -> Any:
  30. pass
  31. def BooleanField(default: bool = False, unique: bool = False, null: bool = None) -> Any:
  32. pass
  33. def ForeignKeyField(key: object, null: bool = None, backref: str = "") -> Any:
  34. pass
  35. class IntegrityError(Exception):
  36. pass