Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
511e3ea
Add type annotations for `peewee`
Nov 18, 2020
7bbba59
Merge branch 'master' into peewee
Dec 1, 2020
b7eebcd
More work on annotations
Dec 1, 2020
1f7af9f
Commit final parts of first draft of the PR.
Jan 16, 2021
92dff01
Incremental fixes
Jan 26, 2021
0d047c4
Merge branch 'master' into peewee
dargueta Apr 14, 2021
2fa7292
Add stuff, reformat according to Black
Nov 17, 2021
41eedc7
Merge branch 'master' into peewee
Nov 17, 2021
fa81e48
A few more tweaks to int/float confusion
Nov 17, 2021
04ed2a9
Merge branch 'master' into peewee
Feb 20, 2022
9175536
Hopefully the last of the linter fixes, thanks to @pylipp
Feb 20, 2022
e3acec8
Merge branch 'master' into peewee
AlexWaygood Apr 18, 2022
3153594
Fix location of new stub file
AlexWaygood Apr 18, 2022
30d6289
Fix many lint errors
AlexWaygood Apr 18, 2022
d2a9556
Add to stricter-pyright ignorelist
AlexWaygood Apr 18, 2022
8adc6b0
Fix a few obvious-ish things
Akuli Apr 25, 2022
12f0e6f
use _typeshed.Self when appropriate
Akuli Apr 25, 2022
18795ac
Merge branch 'master' into peewee
AlexWaygood May 18, 2022
e8e4b80
Merge branch 'master' into peewee
AlexWaygood May 19, 2022
9d44ac6
More lint fixes
AlexWaygood May 19, 2022
0504beb
Merge branch 'master' into peewee
AlexWaygood May 19, 2022
9a7c5f9
Swap a few 'incomplete' comments for `_typeshed.Incomplete`
AlexWaygood Jun 15, 2022
5011f56
Fix `TFunc`-related issues
AlexWaygood Jun 15, 2022
719dd62
Nit: Rename several `TypeVar`s to use suffixes instead of prefixes
AlexWaygood Jun 15, 2022
fda102c
Add some missing type parameters, use some more `Incomplete` where I'…
AlexWaygood Jun 15, 2022
45fb0c2
Fix a few mypy complaints, falling back to `Incomplete` when I'm unsure
AlexWaygood Jun 15, 2022
3e31653
Mark more things as incomplete
AlexWaygood Jun 19, 2022
589ad8d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 19, 2022
a63e648
More fixes
AlexWaygood Jun 19, 2022
e86cbd2
Merge
AlexWaygood Jun 19, 2022
0e80802
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 19, 2022
503a71a
Merge branch 'master' into peewee
AlexWaygood Oct 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix a few mypy complaints, falling back to Incomplete when I'm unsure
  • Loading branch information
AlexWaygood committed Jun 15, 2022
commit 45fb0c2f4f2eda3a1eee40b27c9d29f68a4908d6
19 changes: 9 additions & 10 deletions stubs/peewee/peewee.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ class Ordering(WrappedNode):
def __sql__(self, ctx: Context) -> Context: ...

class _SupportsSQLOrdering(Protocol):
def __call__(node: Node, collation: str | None = ..., nulls: str | None = ...) -> Ordering: ...
def __call__(self, node: Node, collation: str | None = ..., nulls: str | None = ...) -> Ordering: ...

def Asc(node: Node, collation: str | None = ..., nulls: str | None = ...) -> Ordering: ...
def Desc(node: Node, collation: str | None = ..., nulls: str | None = ...) -> Ordering: ...
Expand Down Expand Up @@ -984,7 +984,7 @@ class ConnectionContext(_callable_context_manager):
def __exit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: object) -> None: ...

class Database(_callable_context_manager):
context_class: ClassVar[type[_ContextClassT]]
context_class: ClassVar[type[Incomplete]]
field_types: ClassVar[Mapping[str, str]]
operations: ClassVar[Mapping[str, Any]] # TODO (dargueta) Verify k/v types
param: ClassVar[str]
Expand Down Expand Up @@ -1502,6 +1502,8 @@ class BinaryUUIDField(BlobField):

def format_date_time(value: str, formats: Iterable[str], post_process: _ConvFunc | None = ...) -> str: ...
@overload
def simple_date_time(value: str) -> datetime.datetime: ...
@overload
def simple_date_time(value: _T) -> _T: ...

class _BaseFormattedField(Field):
Expand Down Expand Up @@ -1723,8 +1725,8 @@ class CompositeKey(MetaField):
@overload
def __get__(self, instance: _T, instance_type: type[_T]) -> tuple: ...
def __set__(self, instance: Model, value: list | tuple) -> None: ...
def __eq__(self, other: Expression) -> Expression: ...
def __ne__(self, other: Expression) -> Expression: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __hash__(self) -> int: ...
def __sql__(self, ctx: Context) -> Context: ...
def bind(self, model: type[Model], name: str, set_attribute: bool = ...) -> None: ...
Expand Down Expand Up @@ -1790,7 +1792,7 @@ class Metadata:
table_name: str | None = ...,
indexes: Iterable[str | Sequence[str]] | None = ...,
primary_key: Literal[False] | Field | CompositeKey | None = ...,
constraints: Iterable[Check | SQL] | None = ...,
constraints: Iterable[Callable[[str], SQL] | SQL] | None = ...,
schema: str | None = ...,
only_save_dirty: bool = ...,
depends_on: Sequence[type[Model]] | None = ...,
Expand Down Expand Up @@ -1950,7 +1952,7 @@ class ModelAlias(Node, Generic[_ModelT]):
def __call__(self, **kwargs) -> _ModelT: ...
def __sql__(self, ctx: Context) -> Context: ...

_TModelOrTable: TypeAlias = type[Model] | ModelAlias | Table
_TModelOrTable: TypeAlias = Union[type[Model], ModelAlias, Table]
_TSubquery: TypeAlias = Union[tuple[Query, type[Model]], type[Model], ModelAlias]
_TFieldOrModel: TypeAlias = _TModelOrTable | Field

Expand All @@ -1966,10 +1968,7 @@ class FieldAlias(Field):
def adapt(self, value: object) -> Any: ...
def python_value(self, value: object) -> Any: ...
def db_value(self, value: object) -> Any: ...
@overload
def __getattr__(self, attr: Literal["model"]) -> Node: ...
@overload
def __getattr__(self, attr: str) -> Any: ...
def __getattr__(self, attr: str) -> Incomplete: ...
def __sql__(self, ctx: Context) -> Context: ...

def sort_models(models: Iterable[type[Model]]) -> list[type[Model]]: ...
Expand Down