Hi all,

I'm trying to extend pylint to recognize Werkzeug's import trickery.

Werkzeug uses a variable called `all_by_module` in
https://github.com/mitsuhiko/werkzeug/blob/master/werkzeug/__init__.py to
lazily load modules.  Pylint doesn't recognize this scheme and flags
statements like:

    from werkzeug import secure_filename

My attempt to fix the problem is at
https://github.com/jschaf/pylint-werkzeug/blob/master/pylint_werkzeug/__init__.py

I don't think I'm following an optimal path to success.  Basically, I'm
trying to recreate Python's import logic and then generate an AST with
astroid.  It's not going well.  The current solution recurses endlessly,
since creating the AST seems to trigger the pylint transform plugin.  I'm
looking for simpler or more robust alternatives to my current approach with
imports.

My problem seems somewhat related to the issue about changing flask.ext
imports at https://bitbucket.org/logilab/astroid/issue/10/

Do you have any suggestions?

Thanks,
Joe Schafer
_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to