diff options
author | Emile Anclin <emile.anclin@logilab.fr> | 2010-11-15 10:58:48 +0100 |
---|---|---|
committer | Emile Anclin <emile.anclin@logilab.fr> | 2010-11-15 10:58:48 +0100 |
commit | 616a5be4d2dee8f16683306ac5bcc62c65c638fd (patch) | |
tree | da09f532fd993637d6c3e5ee02c2c14465caa322 | |
parent | 0b95c6d89a5eb2d3855b2353bb9817cc7cae3ded (diff) | |
download | astroid-git-616a5be4d2dee8f16683306ac5bcc62c65c638fd.tar.gz |
remove more py2.4 relative stuff and fix readme
-rw-r--r-- | MANIFEST.in | 1 | ||||
-rw-r--r-- | README | 12 | ||||
-rw-r--r-- | README._ast_compatibility | 42 | ||||
-rw-r--r-- | bases.py | 2 | ||||
-rw-r--r-- | debian/control | 3 | ||||
-rw-r--r-- | scoped_nodes.py | 2 | ||||
-rw-r--r-- | test/unittest_scoped_nodes.py | 1 | ||||
-rw-r--r-- | utils.py | 1 |
8 files changed, 7 insertions, 57 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index 09f84cdb..60dba3b4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,5 @@ include ChangeLog include README -include README._ast_compatibility include COPYING include COPYING.LESSER include test/fulltest.sh @@ -9,14 +9,10 @@ python source code for projects such as pychecker, pyreverse, pylint... Well, actually the development of this library is essentially governed by pylint's needs. -Since 0.18, it provides a compatible representation which may come -from the `compiler` module (for python <= 2.4) pr the `_ast` module -(for python >= 2.5). - -It rebuilds the tree generated by the compiler.ast [1] module or by -the builtin _ast module by recursively walking down the AST and -building an extended ast (let's call it astng ;). The new node classes -have additional methods and attributes for different usages. +It provides a compatible representation which comes from the `_ast` module. +It rebuilds the tree generated by the builtin _ast module by recursively +walking down the AST and building an extended ast (let's call it astng ;). The +new node classes have additional methods and attributes for different usages. They include some support for static inference and local name scopes. Furthermore, astng builds partial trees by inspecting living objects. diff --git a/README._ast_compatibility b/README._ast_compatibility deleted file mode 100644 index f7079ffa..00000000 --- a/README._ast_compatibility +++ /dev/null @@ -1,42 +0,0 @@ -XXX deprecated, update by describing the unified tree structure, how we achieve this and remaining differences... - -this branch aims to provide compatibility between the `compiler` module and the -new `_ast` module provided by python >= 2.5. - -The problem is that there are several differences between both representations: -* class names -* attributes of those classes -* structure of the tree - -So whatever the backend used, astng will return a somewhat compatible tree -which is a mix of compiler and _ast tree. Hopefully it will -evolve to stick to the _ast representation, though at this time I want to -minimize backward incompatibilities, so pylint for instance can work with this -new representation without too much modifications. - -Nodes' class names will still differ, though the provided visitor will map _ast -class names to compiler class names (e.g. for instance when a `_ast.ClassDef` node -is visited, the `visit_class` method will be called). This is done to ease -compatibility with code using earlier astng version. - -Attribute names are made compatible, and I've chosen _ast or compiler's name -by using the most relevant, imo. Those can be found using the `_astng_fields` -attribute on each node class. - -In the same way tree structure is made compatible, using the simplest or the -more expressive alternative. - -The work is not yet finished: XXX insert what's missing here. -The primary goal is to have test working with python >= 2.5, and then to have -pylint tests green as well when using the _ast backend. - - - -Of course all of this is discussable, and I've made choices to have something -working with the minimal amount of work, both in astng or in client code, even -if as I said above I would like at some point to be as close as possible to -the _ast representation. - - -Note: this may be interesting at some point: -http://lucumr.pocoo.org/cogitations/2008/03/30/high-level-ast-module-for-python @@ -50,7 +50,7 @@ except ImportError: class BaseClass: pass -from logilab.common.compat import set, builtins +from logilab.common.compat import builtins from logilab.astng._exceptions import InferenceError, ASTNGError, \ NotFoundError, UnresolvableName from logilab.astng.as_string import as_string diff --git a/debian/control b/debian/control index 13a635b9..2c0bfedc 100644 --- a/debian/control +++ b/debian/control @@ -19,8 +19,7 @@ Description: rebuild a new abstract syntax tree from Python's ast The aim of this module is to provide a common base representation of Python source code for projects such as pyreverse or pylint. . - It rebuilds the tree generated by the compiler.ast [1] module (python <= 2.4) - or by the builtin _ast module (python >= 2.5) by recursively walking down the + It rebuilds the tree generated by the _ast module by recursively walking down the AST and building an extended ast (let's call it astng ;). The new node classes have additional methods and attributes for different usages. Furthermore, astng builds partial trees by inspecting living objects. diff --git a/scoped_nodes.py b/scoped_nodes.py index 3542eaa5..9d249f62 100644 --- a/scoped_nodes.py +++ b/scoped_nodes.py @@ -29,7 +29,7 @@ __doctype__ = "restructuredtext en" import sys from itertools import chain -from logilab.common.compat import set, builtins +from logilab.common.compat import builtins from logilab.common.decorators import cached from logilab.astng import NotFoundError, NoDefault, \ diff --git a/test/unittest_scoped_nodes.py b/test/unittest_scoped_nodes.py index e83b89fc..9235d651 100644 --- a/test/unittest_scoped_nodes.py +++ b/test/unittest_scoped_nodes.py @@ -25,7 +25,6 @@ import sys from os.path import join, abspath, dirname from logilab.common.testlib import TestCase, unittest_main -from logilab.common.compat import sorted from logilab.astng import builder, nodes, scoped_nodes, \ InferenceError, NotFoundError @@ -37,7 +37,6 @@ extract information from it __docformat__ = "restructuredtext en" from logilab.astng._exceptions import IgnoreChild, ASTNGBuildingException -from logilab.common.compat import set class ASTVisitor(object): """Abstract Base Class for Python AST Visitors. |