summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-03-17 16:18:55 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-19 23:15:15 -0400
commit6c3d738757d7be32dc9f99d8e1c6b5c81c596d5f (patch)
treeae142d45de71d1ebd43df1a38e54e1d3cf1063ec /lib/sqlalchemy/util
parentc2fe4a264003933ff895c51f5d07a8456ac86382 (diff)
downloadsqlalchemy-6c3d738757d7be32dc9f99d8e1c6b5c81c596d5f.tar.gz
pep 484 for types
strict types type_api.py, including TypeDecorator, NativeForEmulated, etc. Change-Id: Ib2eba26de0981324a83733954cb7044a29bbd7db
Diffstat (limited to 'lib/sqlalchemy/util')
-rw-r--r--lib/sqlalchemy/util/deprecations.py2
-rw-r--r--lib/sqlalchemy/util/langhelpers.py10
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/sqlalchemy/util/deprecations.py b/lib/sqlalchemy/util/deprecations.py
index a8e58a8bf..5c536b675 100644
--- a/lib/sqlalchemy/util/deprecations.py
+++ b/lib/sqlalchemy/util/deprecations.py
@@ -36,7 +36,7 @@ _T = TypeVar("_T", bound=Any)
# https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators
-_F = TypeVar("_F", bound=Callable[..., Any])
+_F = TypeVar("_F", bound="Callable[..., Any]")
def _warn_with_version(
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py
index ef8520c4f..35294715c 100644
--- a/lib/sqlalchemy/util/langhelpers.py
+++ b/lib/sqlalchemy/util/langhelpers.py
@@ -178,7 +178,8 @@ def clsname_as_plain_name(cls: Type[Any]) -> str:
def method_is_overridden(
- instance_or_cls: Union[Type[Any], object], against_method: types.MethodType
+ instance_or_cls: Union[Type[Any], object],
+ against_method: Callable[..., Any],
) -> bool:
"""Return True if the two class methods don't match."""
@@ -815,7 +816,12 @@ def unbound_method_to_callable(func_or_cls):
return func_or_cls
-def generic_repr(obj, additional_kw=(), to_inspect=None, omit_kwarg=()):
+def generic_repr(
+ obj: Any,
+ additional_kw: Sequence[Tuple[str, Any]] = (),
+ to_inspect: Optional[Union[object, List[object]]] = None,
+ omit_kwarg: Sequence[str] = (),
+) -> str:
"""Produce a __repr__() based on direct association of the __init__()
specification vs. same-named attributes present.