summaryrefslogtreecommitdiff
path: root/python/helpers/pycharm_generator_utils/clr_tools.py
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-09-18 13:38:58 -0700
committerTor Norbye <tnorbye@google.com>2014-09-18 13:38:58 -0700
commitb5fb31ef6a38f19404859755dbd2e345215b97bf (patch)
treee8787c45e494dfcc558faf0f75956f8785c39b94 /python/helpers/pycharm_generator_utils/clr_tools.py
parente222a9e1e66670a56e926a6b0f3e10231eeeb1fb (diff)
parente782c57d74000722f9db4c9426317410520670c6 (diff)
downloadidea-b5fb31ef6a38f19404859755dbd2e345215b97bf.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into merge
Conflicts: .idea/libraries/asm_tools.xml .idea/libraries/bouncy_castle.xml .idea/libraries/builder_model.xml .idea/libraries/commons_compress.xml .idea/libraries/easymock_tools.xml .idea/libraries/freemarker_2_3_20.xml .idea/libraries/guava_tools.xml .idea/libraries/kxml2.xml .idea/libraries/lombok_ast.xml .idea/libraries/mockito.xml .idea/modules.xml .idea/vcs.xml build/scripts/layouts.gant updater/src/com/intellij/updater/Runner.java Change-Id: I8e1c173e00cd76c855b8a98543b0a0edfdd99d12
Diffstat (limited to 'python/helpers/pycharm_generator_utils/clr_tools.py')
-rw-r--r--python/helpers/pycharm_generator_utils/clr_tools.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/python/helpers/pycharm_generator_utils/clr_tools.py b/python/helpers/pycharm_generator_utils/clr_tools.py
index 4c273ae7d4d5..f4c3cfbf90f0 100644
--- a/python/helpers/pycharm_generator_utils/clr_tools.py
+++ b/python/helpers/pycharm_generator_utils/clr_tools.py
@@ -18,10 +18,14 @@ def get_namespace_by_name(object_name):
first_part = parts[0]
remain_part = parts[2]
- while remain_part and type(_get_attr_by_name(imported_object, remain_part)) is type: # While we are in class
+ while remain_part and type(_get_attr_by_name(imported_object, remain_part)) is type: # While we are in class
remain_part = remain_part.rpartition(".")[0]
- return first_part + "." + remain_part if remain_part else first_part
+ if remain_part:
+ return first_part + "." + remain_part
+ else:
+ return first_part
+
def _import_first(object_name):
"""
@@ -33,13 +37,12 @@ def _import_first(object_name):
"""
while object_name:
try:
- return (__import__(object_name), object_name)
+ return (__import__(object_name, globals=[], locals=[], fromlist=[]), object_name)
except ImportError:
- object_name = object_name.rpartition(".")[0] # Remove rightest part
+ object_name = object_name.rpartition(".")[0] # Remove rightest part
raise Exception("No module name found in name " + object_name)
-
def _get_attr_by_name(obj, name):
"""
Accepts chain of attributes in dot notation like "some.property.name" and gets them on object