From 547117638d99bf3cbc8a2e070ac139a0b6422158 Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek Date: Thu, 14 Jan 2016 19:47:11 +0900 Subject: added 3 pkg_resources functions to brain [Those 3 are] methods of WorkingSet objects [that] are also available as module- level functions in pkg_resources that apply to the default working_set instance. Thus, you can use e.g. pkg_resources.require() as an abbreviation for pkg_resources.working_set.require() above taken from: https://pythonhosted.org/setuptools/pkg_resources.html#basic-workingset-methods this fixes https://github.com/PyCQA/pylint/issues/780 Signed-off-by: Mateusz Bysiek --- astroid/brain/brain_stdlib.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/astroid/brain/brain_stdlib.py b/astroid/brain/brain_stdlib.py index cbc9736f..ac731887 100644 --- a/astroid/brain/brain_stdlib.py +++ b/astroid/brain/brain_stdlib.py @@ -156,6 +156,15 @@ class deque(object): def pkg_resources_transform(): return AstroidBuilder(MANAGER).string_build(''' +def require(*requirements): + return pkg_resources.working_set.require(*requirements) + +def run_script(requires, script_name): + return pkg_resources.working_set.run_script(requires, script_name) + +def iter_entry_points(group, name=None): + return pkg_resources.working_set.iter_entry_points(group, name) + def resource_exists(package_or_requirement, resource_name): return get_provider(package_or_requirement).has_resource(resource_name) -- cgit v1.2.1