Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Unified Diff: third_party/logilab/astroid/__init__.py

Issue 776883002: pylint: upgrade to 1.4.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/logilab/astroid/README.chromium ('k') | third_party/logilab/astroid/__pkginfo__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/logilab/astroid/__init__.py
===================================================================
--- third_party/logilab/astroid/__init__.py (revision 293207)
+++ third_party/logilab/astroid/__init__.py (working copy)
@@ -79,6 +79,9 @@
If specified, the second argument is an `attrgetter` expression that will be
applied on the node first to get the actual node on which `as_string` should
be called.
+
+ WARNING: This can be fairly slow, as it has to convert every AST node back
+ to Python code; you should consider examining the AST directly instead.
"""
def __init__(self, regexp, expression=None):
self.regexp = re.compile(regexp)
@@ -98,7 +101,7 @@
.. sourcecode:: python
MANAGER.register_transform(CallFunc, inference_tip(infer_named_tuple),
- AsStringRegexpPredicate('namedtuple', 'func'))
+ predicate)
"""
def transform(node, infer_function=infer_function):
node._explicit_inference = infer_function
@@ -105,6 +108,16 @@
return node
return transform
+
+def register_module_extender(manager, module_name, get_extension_mod):
+ def transform(node):
+ extension_module = get_extension_mod()
+ for name, obj in extension_module.locals.items():
+ node.locals[name] = obj
+
+ manager.register_transform(Module, transform, lambda n: n.name == module_name)
+
+
# load brain plugins
from os import listdir
from os.path import join, dirname
« no previous file with comments | « third_party/logilab/astroid/README.chromium ('k') | third_party/logilab/astroid/__pkginfo__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698