diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-11-07 13:05:08 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-11-15 14:27:21 -0500 |
commit | cfe87f59d1bbe0eaa49ae183ba29bc6721c66581 (patch) | |
tree | 1e603b5e17c69e8f105d1c23090c740caef36082 /tools | |
parent | c76fd4bbf13a51c41429b7e14cba387d36536006 (diff) | |
download | alembic-cfe87f59d1bbe0eaa49ae183ba29bc6721c66581.tar.gz |
add typing parameters
Fixed typing issue where :paramref:`.revision.process_revision_directives`
was not fully typed; additionally ensured all ``Callable`` and ``Dict``
arguments to :meth:`.EnvironmentContext.configure` include parameters in
the typing declaration.
Change-Id: I3ac389992f357359439be5659af33525fc290f96
Fixes: #1110
Diffstat (limited to 'tools')
-rw-r--r-- | tools/write_pyi.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/write_pyi.py b/tools/write_pyi.py index 52fac3c..e5112fd 100644 --- a/tools/write_pyi.py +++ b/tools/write_pyi.py @@ -125,7 +125,7 @@ def generate_pyi_for_proxy( def _generate_stub_for_attr(cls, name, printer, env): try: annotations = typing.get_type_hints(cls, env) - except NameError as e: + except NameError: annotations = cls.__annotations__ type_ = annotations.get(name, "Any") if isinstance(type_, str) and type_[0] in "'\"": @@ -155,10 +155,7 @@ def _generate_stub_for_meth(cls, name, printer, env, is_context_manager): if getattr(annotation, "__module__", None) == "typing": retval = repr(annotation).replace("typing.", "") elif isinstance(annotation, type): - if annotation.__module__ in ("builtins", base_module): - retval = annotation.__qualname__ - else: - retval = annotation.__module__ + "." + annotation.__qualname__ + retval = annotation.__qualname__ else: retval = annotation @@ -184,6 +181,7 @@ def _generate_stub_for_meth(cls, name, printer, env, is_context_manager): '''{fn.__doc__}''' """ ) + printer.write_indented_block(func_text) |