Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a7bb0b2

Browse files
committed
Implement suggestions from code-review.
1 parent 61f0408 commit a7bb0b2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

‎pyt/cfg/alias_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ def fully_qualify_alias_labels(label, aliases):
8989
for alias, full_name in aliases.items():
9090
if label == alias:
9191
return full_name
92-
if label.startswith(alias+'.'):
92+
elif label.startswith(alias+'.'):
9393
return full_name + label[len(alias):]
9494
return label

‎pyt/cfg/stmt_visitor.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
from .alias_helper import (
88
as_alias_handler,
9+
fully_qualify_alias_labels,
910
handle_aliases_in_init_files,
1011
handle_fdid_aliases,
1112
not_as_alias_handler,
12-
retrieve_import_alias_mapping,
13-
fully_qualify_alias_labels
13+
retrieve_import_alias_mapping
1414
)
1515
from ..core.ast_helper import (
1616
generate_ast,
@@ -816,6 +816,7 @@ def add_module( # noqa: C901
816816
module_path = module[1]
817817

818818
parent_definitions = self.module_definitions_stack[-1]
819+
# Here, in `visit_Import` and in `visit_ImportFrom` are the only places the `import_alias_mapping` is updated
819820
parent_definitions.import_alias_mapping.update(import_alias_mapping)
820821
parent_definitions.import_names = local_names
821822

@@ -1106,7 +1107,7 @@ def visit_ImportFrom(self, node):
11061107
from_from=True
11071108
)
11081109

1109-
# Remember aliases for uninspecatble modules such that we can label them fully qualified
1110+
# Remember aliases for uninspectable modules such that we can label them fully qualified
11101111
# e.g. we want a call to "os.system" be recognised, even if we do "from os import system"
11111112
# from os import system as mysystem -> module=os, name=system, asname=mysystem
11121113
for name in node.names:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /