peewee.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. from typing import Any, Optional, TypeVar, Type
  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, recursive: bool = False) -> 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. def IntegerField(default: int = 0, unique: bool = False, null: bool = None) -> Any:
  42. pass
  43. class IntegrityError(Exception):
  44. pass
  45. JOIN: Any = None
  46. fn: Any = None