-
Notifications
You must be signed in to change notification settings - Fork 64
Conversation
|
||
|
||
tests_inputs_directory = os.path.join(os.path.dirname(os.path.dirname(__file__)), "inputs") | ||
method_to_function = undebt.examples.method_to_function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just import the module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from undebt.examples import method_to_function
instead of
import undebt.examples.method_to_function
method_to_function = undebt.examples.method_to_function
is what paiwei is going for here, I think, and if so I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah got it. Yes I wasn't sure if that would work, but __name__
returns the full module name regardless of how it was imported, so this change is fine. Fixing.
@paiweilai bump :) |
lg2m |
return '.'.join(name_parts) | ||
def load_module(module): | ||
"""Loads a module from its name.""" | ||
return __import__(module, fromlist=['']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the more proper implementation of this is to use importlib.import_module
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asottile advised against this, in favor of not importing the importlib module
@ajm188 LGTM once you address my issue above. Edit: Looks like you just merged it, so interpret the above as a minor issue instead? |
Address #46