# HG changeset patch # User Sylvain Thénault # Date 1320659799 -3600 # Node ID 88ca47ceb9f201e6880062241419b36881c38537 # Parent 8acfd23578a8146f10894ab15fd873deed40743a [pylint] enhance plugin: define 'data' function in uiprops module diff -r 8acfd23578a8 -r 88ca47ceb9f2 pylintext.py --- a/pylintext.py Mon Nov 07 10:55:15 2011 +0100 +++ b/pylintext.py Mon Nov 07 10:56:39 2011 +0100 @@ -1,6 +1,7 @@ """https://pastebin.logilab.fr/show/860/""" from logilab.astng import MANAGER, nodes, scoped_nodes +from logilab.astng.builder import ASTNGBuilder def turn_function_to_class(node): """turn a Function node into a Class node (in-place)""" @@ -33,9 +34,15 @@ from yams import BASE_TYPES for etype in BASE_TYPES: module.locals[etype] = [scoped_nodes.Class(etype, None)] - -MANAGER.register_transformer(cubicweb_transform) + # add data() to uiprops module + if module.name.endswith('.uiprops'): + fake = ASTNGBuilder(MANAGER).string_build(''' +def data(string): + return u'' +''') + module.locals['data'] = fake.locals['data'] def register(linter): """called when loaded by pylint --load-plugins, nothing to do here""" + MANAGER.register_transformer(cubicweb_transform)