Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

Commit

Permalink
Handle external module imports as package imports (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdrosos committed May 29, 2023
1 parent a44940e commit 373751b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pycg/processing/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ def create_def(scope, name, imported_def):
)

def add_external_def(name, target):
# In case we encounter an external import in the form of:
# "import package.module.module...
# we want to treat it as: "import package"
# and save it as such in the definition manager,
# so that we will be able to later map it
# with its corresponding calls
if (name == target) & (len(name.split(".")) > 1):
name = name.split(".")[0]
target = target.split(".")[0]
# add an external def for the name
defi = self.def_manager.get(name)
if not defi:
Expand Down

0 comments on commit 373751b

Please sign in to comment.