Repository navigation
Further annotate sqlalchemy.engine and collections #6680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
c2072b7
Annotate immutabledict
srittau a3dfffe
Further annotate sqlalchemy.engine
srittau 2006dec
Remove unused import
srittau 4849970
Stubtest fixes and overrides
srittau 778b880
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ddf3daa
Use Self
srittau 9c20df9
Mark methods with @abstractmethod
srittau d80be6b
MarkerTransaction.is_active is a property
srittau a020f64
Fix decorator order
srittau 0c3450e
Remove None from return type of begin()
srittau 02de73a
Remove None from return type of transaction()
srittau a0b38c8
Use _EchoFlag for echo argument/field
srittau 75d9f1a
Use echo_property
srittau 0c65973
Address review feedback
srittau d0dcb0e
Merge branch 'master' into sqlalchemy-engine
srittau d79ca77
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8989e54
Remove unused imports
srittau 2f75957
Remove @abstractmethod markers
srittau c956a55
Remove unnecessary type ignores
srittau 107002b
Use plain property
srittau 825989e
Merge remote-tracking branch 'upstream/master' into sqlalchemy-engine
srittau 6236f77
Fixes for pyright
srittau 6b3ee69
Add a missing type ignore
srittau 9a11559
Add URL.normalized_query to allowlist
srittau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,17 @@ | ||
| class immutabledict: | ||
| def __len__(self) -> int: ... | ||
| def __getitem__(self, __item): ... | ||
| def __iter__(self): ... | ||
| def union(self, **kwargs): ... | ||
| def merge_with(self, *args): ... | ||
| def keys(self): ... | ||
| def __contains__(self, __item): ... | ||
| def items(self): ... | ||
| def values(self): ... | ||
| def get(self, __key, __default=...): ... | ||
| def __reduce__(self): ... | ||
| from _typeshed import SupportsKeysAndGetItem | ||
| from collections.abc import Iterable | ||
| from typing import Generic, TypeVar, overload | ||
|
|
||
| _KT = TypeVar("_KT") | ||
| _KT2 = TypeVar("_KT2") | ||
| _VT = TypeVar("_VT") | ||
| _VT2 = TypeVar("_VT2") | ||
|
|
||
| class immutabledict(dict[_KT, _VT], Generic[_KT, _VT]): | ||
| @overload | ||
| def union(self, __dict: dict[_KT2, _VT2]) -> immutabledict[_KT | _KT2, _VT | _VT2]: ... | ||
| @overload | ||
| def union(self, __dict: None = ..., **kw: SupportsKeysAndGetItem[_KT2, _VT2]) -> immutabledict[_KT | _KT2, _VT | _VT2]: ... | ||
| def merge_with( | ||
| self, *args: SupportsKeysAndGetItem[_KT | _KT2, _VT2] | Iterable[tuple[_KT2, _VT2]] | None | ||
| ) -> immutabledict[_KT | _KT2, _VT | _VT2]: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # TODO: Tempory copy of _typeshed.dbapi, until that file is available in all typecheckers. | ||
| # Does not exist at runtime. | ||
|
|
||
| from collections.abc import Mapping, Sequence | ||
| from typing import Any, Protocol | ||
|
|
||
| DBAPITypeCode = Any | None | ||
| # Strictly speaking, this should be a Sequence, but the type system does | ||
| # not support fixed-length sequences. | ||
| DBAPIColumnDescription = tuple[str, DBAPITypeCode, int | None, int | None, int | None, int | None, bool | None] | ||
|
|
||
| class DBAPIConnection(Protocol): | ||
| def close(self) -> object: ... | ||
| def commit(self) -> object: ... | ||
| # optional: | ||
| # def rollback(self) -> Any: ... | ||
| def cursor(self) -> DBAPICursor: ... | ||
|
|
||
| class DBAPICursor(Protocol): | ||
| @property | ||
| def description(self) -> Sequence[DBAPIColumnDescription] | None: ... | ||
| @property | ||
| def rowcount(self) -> int: ... | ||
| # optional: | ||
| # def callproc(self, __procname: str, __parameters: Sequence[Any] = ...) -> Sequence[Any]: ... | ||
| def close(self) -> object: ... | ||
| def execute(self, __operation: str, __parameters: Sequence[Any] | Mapping[str, Any] = ...) -> object: ... | ||
| def executemany(self, __operation: str, __seq_of_parameters: Sequence[Sequence[Any]]) -> object: ... | ||
| def fetchone(self) -> Sequence[Any] | None: ... | ||
| def fetchmany(self, __size: int = ...) -> Sequence[Sequence[Any]]: ... | ||
| def fetchall(self) -> Sequence[Sequence[Any]]: ... | ||
| # optional: | ||
| # def nextset(self) -> None | Literal[True]: ... | ||
| arraysize: int | ||
| def setinputsizes(self, __sizes: Sequence[DBAPITypeCode | int | None]) -> object: ... | ||
| def setoutputsize(self, __size: int, __column: int = ...) -> object: ... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.