summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/mypy/plugin.py
diff options
context:
space:
mode:
authorBryan Forbes <bryan@reigndropsfall.net>2021-04-09 14:27:16 -0500
committerBryan Forbes <bryan@reigndropsfall.net>2021-04-09 14:27:16 -0500
commitfb11e2e2e99c16263228df2d814b3bc8305e8e5e (patch)
tree7c7d26b37a0a690226a0bd4f78e10094ccb71586 /lib/sqlalchemy/ext/mypy/plugin.py
parent0277eef8dccf34b9a715b45cc89964a8e1b46ce1 (diff)
downloadsqlalchemy-fb11e2e2e99c16263228df2d814b3bc8305e8e5e.tar.gz
Update mypy plugin to only use public plugin API
Change-Id: Id7f4e4a39e17c1b6ec3c754e2fc5c6ba4b437c38
Diffstat (limited to 'lib/sqlalchemy/ext/mypy/plugin.py')
-rw-r--r--lib/sqlalchemy/ext/mypy/plugin.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/ext/mypy/plugin.py b/lib/sqlalchemy/ext/mypy/plugin.py
index a0aa5bf04..23585be49 100644
--- a/lib/sqlalchemy/ext/mypy/plugin.py
+++ b/lib/sqlalchemy/ext/mypy/plugin.py
@@ -143,7 +143,9 @@ def _fill_in_decorators(ctx: ClassDefContext) -> None:
else:
continue
- sym = ctx.api.lookup(target.expr.name, target, suppress_errors=True)
+ sym = ctx.api.lookup_qualified(
+ target.expr.name, target, suppress_errors=True
+ )
if sym:
if sym.node.type and hasattr(sym.node.type, "type"):
target.fullname = (
@@ -242,7 +244,7 @@ def _dynamic_class_hook(ctx: DynamicClassDefContext) -> None:
)
info.bases = [Instance(cls_arg.node, [])]
else:
- obj = ctx.api.builtin_type("builtins.object")
+ obj = ctx.api.named_type("__builtins__.object")
info.bases = [obj]
@@ -252,7 +254,7 @@ def _dynamic_class_hook(ctx: DynamicClassDefContext) -> None:
util.fail(
ctx.api, "Not able to calculate MRO for declarative base", ctx.call
)
- obj = ctx.api.builtin_type("builtins.object")
+ obj = ctx.api.named_type("__builtins__.object")
info.bases = [obj]
info.fallback_to_any = True
@@ -268,7 +270,7 @@ def _make_declarative_meta(
declarative_meta_name.fullname = "sqlalchemy.orm.decl_api.DeclarativeMeta"
# installed by _add_globals
- sym = api.lookup("__sa_DeclarativeMeta", target_cls)
+ sym = api.lookup_qualified("__sa_DeclarativeMeta", target_cls)
declarative_meta_typeinfo = sym.node
declarative_meta_name.node = declarative_meta_typeinfo