diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2016-05-10 12:05:21 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2016-05-10 12:05:21 +0300 |
commit | 002cdf2311d6d5e481a70cc7e5ba3f800e753877 (patch) | |
tree | 5a68c36c337f8d82fb841fd30519886703af8af7 /pylint/utils.py | |
parent | 6ffaba08ee5720df9e93e4026d190ecaca300f26 (diff) | |
download | pylint-git-002cdf2311d6d5e481a70cc7e5ba3f800e753877.tar.gz |
Look for namespace packages explicitly using modpath_from_file_with_callback.
Diffstat (limited to 'pylint/utils.py')
-rw-r--r-- | pylint/utils.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pylint/utils.py b/pylint/utils.py index 2a26086e9..d11990f8b 100644 --- a/pylint/utils.py +++ b/pylint/utils.py @@ -802,6 +802,13 @@ def _basename_in_blacklist_re(base_name, black_list_re): return True return False +def _modpath_from_file(filename, is_namespace): + def _is_package_cb(path, parts): + return modutils.check_modpath_has_init(path, parts) or is_namespace + + return modutils.modpath_from_file_with_callback(filename, is_package_cb=_is_package_cb) + + def expand_modules(files_or_modules, black_list, black_list_re): """take a list of files/modules/packages and return the list of tuple (file, module name) which have to be actually checked @@ -859,7 +866,9 @@ def expand_modules(files_or_modules, black_list, black_list_re): continue if _basename_in_blacklist_re(basename(subfilepath), black_list_re): continue - submodname = '.'.join(modutils.modpath_from_file(subfilepath)) + + modpath = _modpath_from_file(subfilepath, is_namespace) + submodname = '.'.join(modpath) result.append({'path': subfilepath, 'name': submodname, 'isarg': False, 'basepath': filepath, 'basename': modname}) |