| Index: third_party/logilab/astroid/__init__.py
|
| diff --git a/third_party/logilab/astroid/__init__.py b/third_party/logilab/astroid/__init__.py
|
| index 19c809028a51c6acb5b881f1047adf7a92cc343f..d4fd12c577a57f5674bbe7324be7e80722959bba 100644
|
| --- a/third_party/logilab/astroid/__init__.py
|
| +++ b/third_party/logilab/astroid/__init__.py
|
| @@ -79,6 +79,9 @@ class AsStringRegexpPredicate(object):
|
| 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,13 +101,23 @@ def inference_tip(infer_function):
|
| .. 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
|
| 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
|
|
|