From fd87e8af2a391ae8b4a40f1c30f3f1ce20c65162 Mon Sep 17 00:00:00 2001 From: Laurens Van Houtven <_@lvh.cc> Date: Thu, 20 Jun 2013 22:36:16 +0200 Subject: [PATCH] Refactor the way module_path, module_file and is_package are computed to be a bit more legible --- jedi/_compatibility.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index cccc78b4..fd33a60c 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -25,18 +25,18 @@ def find_module_py33(string, path=None): raise ImportError("Couldn't find a loader for {0}".format(string)) try: - if (loader.is_package(string)): - mod_info = (None, os.path.dirname(loader.path), True) + is_package = loader.is_package(string) + if is_package: + module_path = os.path.dirname(loader.path) + module_file = None else: - filename = loader.get_filename(string) - if filename and os.path.exists(filename): - mod_info = (open(filename, 'U'), filename, False) - else: - mod_info = (None, filename, False) + module_path = loader.get_filename(string) + module_file = open(module_path) except AttributeError: - mod_info = (None, loader.load_module(string).__name__, False) + module_path = loader.load_module(string).__name__ + module_file = None - return mod_info + return module_file, module_path, is_package def find_module_pre_py33(string, path=None):