Hello community, here is the log from the commit of package python-logilab-astng for openSUSE:Factory checked in at 2012-02-24 06:53:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-logilab-astng (Old) and /work/SRC/openSUSE:Factory/.python-logilab-astng.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-logilab-astng", Maintainer is "DMueller@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/python-logilab-astng/python-logilab-astng.changes 2011-11-25 10:13:46.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-logilab-astng.new/python-logilab-astng.changes 2012-02-24 06:53:43.000000000 +0100 @@ -1,0 +2,11 @@ +Sat Feb 18 16:21:22 UTC 2012 - toganm@opensuse.org + +- update to version 0.23.1 + * #62295: avoid "OSError: Too many open files" by moving + .file_stream as a Module property opening the file only when + needed + * Lambda nodes should have a `name` attribute + * only call transformers if modname specified + + +------------------------------------------------------------------- Old: ---- logilab-astng-0.22.0.tar.gz New: ---- logilab-astng-0.23.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-logilab-astng.spec ++++++ --- /var/tmp/diff_new_pack.RYPd6Y/_old 2012-02-24 06:53:45.000000000 +0100 +++ /var/tmp/diff_new_pack.RYPd6Y/_new 2012-02-24 06:53:45.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-logilab-astng # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,9 +16,8 @@ # - Name: python-logilab-astng -Version: 0.22.0 +Version: 0.23.1 Release: 0 Url: http://www.logilab.org/projects/astng Summary: Python Python Abstract Syntax Tree (New Generation) ++++++ logilab-astng-0.22.0.tar.gz -> logilab-astng-0.23.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/ChangeLog new/logilab-astng-0.23.1/ChangeLog --- old/logilab-astng-0.22.0/ChangeLog 2011-07-18 16:02:38.000000000 +0200 +++ new/logilab-astng-0.23.1/ChangeLog 2011-12-08 15:26:42.000000000 +0100 @@ -1,6 +1,38 @@ Change log for the astng package ================================ +2011-12-08 -- 0.23.1 + * #62295: avoid "OSError: Too many open files" by moving + .file_stream as a Module property opening the file only when needed + + * Lambda nodes should have a `name` attribute + + * only call transformers if modname specified + + + +2011-10-07 -- 0.23.0 + * #77187: ancestor() only returns the first class when inheriting + from two classes coming from the same module + + * #76159: putting module's parent directory on the path causes problems + linting when file names clash + + * #74746: should return empty module when __main__ is imported (patch by + google) + + * #74748: getitem protocal return constant value instead of a Const node + (patch by google) + + * #77188: support lgc.decorators.classproperty + + * #77253: provide a way for user code to register astng "transformers" + using manager.register_transformer(callable) where callable will be + called after an astng has been built and given the related module node + as argument + + + 2011-07-18 -- 0.22.0 * added column offset information on nodes (patch by fawce) @@ -41,7 +73,7 @@ * fix #37105: Crash on AttributeError: 'NoneType' object has no attribute '_infer_name' - * python2.4: drop python < 2.4 support + * python2.4: drop python < 2.5 support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/MANIFEST.in new/logilab-astng-0.23.1/MANIFEST.in --- old/logilab-astng-0.22.0/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/logilab-astng-0.23.1/MANIFEST.in 2011-01-13 21:36:37.000000000 +0100 @@ -0,0 +1,8 @@ +include ChangeLog +include README* +include COPYING +include COPYING.LESSER +include test/fulltest.sh +recursive-include test/data *.py *.zip *.egg +recursive-include test/data2 *.py +recursive-include test/regrtest_data *.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/PKG-INFO new/logilab-astng-0.23.1/PKG-INFO --- old/logilab-astng-0.22.0/PKG-INFO 2011-07-20 18:14:05.000000000 +0200 +++ new/logilab-astng-0.23.1/PKG-INFO 2011-12-08 15:26:51.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: logilab-astng -Version: 0.22.0 +Version: 0.23.1 Summary: rebuild a new abstract syntax tree from Python's ast Home-page: http://www.logilab.org/project/logilab-astng Author: Logilab @@ -51,5 +51,14 @@ http://lists.logilab.org/mailman/listinfo/python-projects for subscription information and archives. + Test + ---- + + Tests are in the 'test' subdirectory. To launch the whole tests suite + at once, you may use the 'pytest' utility from logilab-common (simply + type 'pytest' from within this directory) or if you're running python + >= 2.7, using discover, for instance:: + + python -m unittest discover -p "unittest*.py" Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/README new/logilab-astng-0.23.1/README --- old/logilab-astng-0.22.0/README 2011-01-13 21:36:37.000000000 +0100 +++ new/logilab-astng-0.23.1/README 2011-12-08 15:26:42.000000000 +0100 @@ -43,3 +43,12 @@ http://lists.logilab.org/mailman/listinfo/python-projects for subscription information and archives. +Test +---- + +Tests are in the 'test' subdirectory. To launch the whole tests suite +at once, you may use the 'pytest' utility from logilab-common (simply +type 'pytest' from within this directory) or if you're running python +>= 2.7, using discover, for instance:: + + python -m unittest discover -p "unittest*.py" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/README.Python3 new/logilab-astng-0.23.1/README.Python3 --- old/logilab-astng-0.22.0/README.Python3 2011-01-13 21:36:37.000000000 +0100 +++ new/logilab-astng-0.23.1/README.Python3 2011-12-08 15:26:42.000000000 +0100 @@ -1,19 +1,15 @@ Python3 ======= -Source ------- - -Python3 portage is made by running the 2to3 script on all modules:: +Approach +-------- - find . ! -path "*/test/*py" -name "*py" -exec 2to3-3.1 -wn {} \; +We maintain a Python 2 base and use 2to3 to generate Python 3 code. +2to3 is integrated into the distutils installation process and will be run as a +build step when invoked by the python3 interpreter:: -Dev ---- - -If you want to run the tests, simply remove the "! -path ..." option, hence -also refactoring the test files, including all data files. + python3 setup.py install --no-compile Debian @@ -24,3 +20,7 @@ cp debian.py3k/* debian/ + +Resources +--------- +http://wiki.python.org/moin/PortingPythonToPy3k diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/__init__.py new/logilab-astng-0.23.1/__init__.py --- old/logilab-astng-0.22.0/__init__.py 2011-07-18 16:02:38.000000000 +0200 +++ new/logilab-astng-0.23.1/__init__.py 2011-10-07 16:49:28.000000000 +0200 @@ -24,7 +24,7 @@ pylint... Well, actually the development of this library is essentially governed by pylint's needs. -It extends class defined in the compiler.ast [1] module with some +It extends class defined in the python's _ast module with some additional methods and attributes. Instance attributes are added by a builder object, which can either generate extended ast (let's call them astng ;) by visiting an existent ast tree or by inspecting living diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/__pkginfo__.py new/logilab-astng-0.23.1/__pkginfo__.py --- old/logilab-astng-0.22.0/__pkginfo__.py 2011-07-18 16:02:38.000000000 +0200 +++ new/logilab-astng-0.23.1/__pkginfo__.py 2011-12-08 15:26:42.000000000 +0100 @@ -24,7 +24,7 @@ modname = 'astng' subpackage_of = 'logilab' -numversion = (0, 22, 0) +numversion = (0, 23, 1) version = '.'.join([str(num) for num in numversion]) install_requires = ['logilab-common >= 0.53.0'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/as_string.py new/logilab-astng-0.23.1/as_string.py --- old/logilab-astng-0.22.0/as_string.py 2011-01-13 21:36:37.000000000 +0100 +++ new/logilab-astng-0.23.1/as_string.py 2011-10-07 16:49:28.000000000 +0200 @@ -1,16 +1,4 @@ -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. # contact mailto:thenault@gmail.com @@ -30,7 +18,8 @@ # You should have received a copy of the GNU Lesser General Public License along # with logilab-astng. If not, see http://www.gnu.org/licenses/. """This module renders ASTNG nodes to string representation. -It will probably not work on compiler.ast or _ast trees. + +It will probably not work on bare _ast trees. """ import sys @@ -55,13 +44,13 @@ def __call__(self, node): """Makes this visitor behave as a simple function""" return node.accept(self) - + def _stmt_list(self, stmts): """return a list of nodes to string""" stmts = '\n'.join([nstr for nstr in [n.accept(self) for n in stmts] if nstr]) return INDENT + stmts.replace('\n', '\n'+INDENT) - + ## visit_<node> methods ########################################### def visit_arguments(self, node): @@ -87,15 +76,15 @@ """return an astng.Assign node as string""" lhs = ' = '.join([n.accept(self) for n in node.targets]) return '%s = %s' % (lhs, node.value.accept(self)) - + def visit_augassign(self, node): """return an astng.AugAssign node as string""" return '%s %s %s' % (node.target.accept(self), node.op, node.value.accept(self)) - + def visit_backquote(self, node): """return an astng.Backquote node as string""" return '`%s`' % node.value.accept(self) - + def visit_binop(self, node): """return an astng.BinOp node as string""" return '(%s) %s (%s)' % (node.left.accept(self), node.op, node.right.accept(self)) @@ -104,11 +93,11 @@ """return an astng.BoolOp node as string""" return (' %s ' % node.op).join(['(%s)' % n.accept(self) for n in node.values]) - + def visit_break(self, node): """return an astng.Break node as string""" return 'break' - + def visit_callfunc(self, node): """return an astng.CallFunc node as string""" expr_str = node.func.accept(self) @@ -118,7 +107,7 @@ if node.kwargs: args.append( '**' + node.kwargs.accept(self)) return '%s(%s)' % (expr_str, ', '.join(args)) - + def visit_class(self, node): """return an astng.Class node as string""" decorate = node.decorators and node.decorators.accept(self) or '' @@ -127,7 +116,7 @@ docs = node.doc and '\n%s"""%s"""' % (INDENT, node.doc) or '' return '\n\n%sclass %s%s:%s\n%s\n' % (decorate, node.name, bases, docs, self._stmt_list( node.body)) - + def visit_compare(self, node): """return an astng.Compare node as string""" rhs_str = ' '.join(['%s %s' % (op, expr.accept(self)) @@ -143,14 +132,14 @@ def visit_const(self, node): """return an astng.Const node as string""" return repr(node.value) - + def visit_continue(self, node): """return an astng.Continue node as string""" return 'continue' - + def visit_delete(self, node): # XXX check if correct """return an astng.Delete node as string""" - return 'del %s' % ', '.join([child.accept(self) + return 'del %s' % ', '.join([child.accept(self) for child in node.targets]) def visit_delattr(self, node): @@ -167,7 +156,7 @@ def visit_dict(self, node): """return an astng.Dict node as string""" - return '{%s}' % ', '.join(['%s: %s' % (key.accept(self), + return '{%s}' % ', '.join(['%s: %s' % (key.accept(self), value.accept(self)) for key, value in node.items]) def visit_dictcomp(self, node): @@ -193,15 +182,15 @@ else: excs = 'except' return '%s:\n%s' % (excs, self._stmt_list(node.body)) - + def visit_ellipsis(self, node): """return an astng.Ellipsis node as string""" return '...' - + def visit_empty(self, node): """return an Empty node as string""" return '' - + def visit_exec(self, node): """return an astng.Exec node as string""" if node.locals: @@ -225,24 +214,24 @@ if node.orelse: fors = '%s\nelse:\n%s' % (fors, self._stmt_list(node.orelse)) return fors - + def visit_from(self, node): """return an astng.From node as string""" return 'from %s import %s' % ('.' * (node.level or 0) + node.modname, _import_string(node.names)) - + def visit_function(self, node): """return an astng.Function node as string""" decorate = node.decorators and node.decorators.accept(self) or '' docs = node.doc and '\n%s"""%s"""' % (INDENT, node.doc) or '' return '\n%sdef %s(%s):%s\n%s' % (decorate, node.name, node.args.accept(self), docs, self._stmt_list(node.body)) - + def visit_genexpr(self, node): """return an astng.GenExpr node as string""" return '(%s %s)' % (node.elt.accept(self), ' '.join([n.accept(self) for n in node.generators])) - + def visit_getattr(self, node): """return an astng.Getattr node as string""" return '%s.%s' % (node.expr.accept(self), node.attrname) @@ -250,14 +239,14 @@ def visit_global(self, node): """return an astng.Global node as string""" return 'global %s' % ', '.join(node.names) - + def visit_if(self, node): """return an astng.If node as string""" ifs = ['if %s:\n%s' % (node.test.accept(self), self._stmt_list(node.body))] if node.orelse:# XXX use elif ??? ifs.append('else:\n%s' % self._stmt_list(node.orelse)) return '\n'.join(ifs) - + def visit_ifexp(self, node): """return an astng.IfExp node as string""" return '%s if %s else %s' % (node.body.accept(self), @@ -266,19 +255,19 @@ def visit_import(self, node): """return an astng.Import node as string""" return 'import %s' % _import_string(node.names) - + def visit_keyword(self, node): """return an astng.Keyword node as string""" return '%s=%s' % (node.arg, node.value.accept(self)) - + def visit_lambda(self, node): """return an astng.Lambda node as string""" return 'lambda %s: %s' % (node.args.accept(self), node.body.accept(self)) - + def visit_list(self, node): """return an astng.List node as string""" return '[%s]' % ', '.join([child.accept(self) for child in node.elts]) - + def visit_listcomp(self, node): """return an astng.ListComp node as string""" return '[%s %s]' % (node.elt.accept(self), ' '.join([n.accept(self) @@ -288,15 +277,15 @@ """return an astng.Module node as string""" docs = node.doc and '"""%s"""\n\n' % node.doc or '' return docs + '\n'.join([n.accept(self) for n in node.body]) + '\n\n' - + def visit_name(self, node): """return an astng.Name node as string""" return node.name - + def visit_pass(self, node): """return an astng.Pass node as string""" return 'pass' - + def visit_print(self, node): """return an astng.Print node as string""" nodes = ', '.join([n.accept(self) for n in node.values]) @@ -351,7 +340,7 @@ def visit_subscript(self, node): """return an astng.Subscript node as string""" return '%s[%s]' % (node.value.accept(self), node.slice.accept(self)) - + def visit_tryexcept(self, node): """return an astng.TryExcept node as string""" trys = ['try:\n%s' % self._stmt_list( node.body)] @@ -360,16 +349,16 @@ if node.orelse: trys.append('else:\n%s' % self._stmt_list(node.orelse)) return '\n'.join(trys) - + def visit_tryfinally(self, node): """return an astng.TryFinally node as string""" return 'try:\n%s\nfinally:\n%s' % (self._stmt_list( node.body), self._stmt_list(node.finalbody)) - + def visit_tuple(self, node): """return an astng.Tuple node as string""" return '(%s)' % ', '.join([child.accept(self) for child in node.elts]) - + def visit_unaryop(self, node): """return an astng.UnaryOp node as string""" if node.op == 'not': @@ -377,7 +366,7 @@ else: operator = node.op return '%s%s' % (operator, node.operand.accept(self)) - + def visit_while(self, node): """return an astng.While node as string""" whiles = 'while %s:\n%s' % (node.test.accept(self), @@ -385,14 +374,14 @@ if node.orelse: whiles = '%s\nelse:\n%s' % (whiles, self._stmt_list(node.orelse)) return whiles - + def visit_with(self, node): # 'with' without 'as' is possible """return an astng.With node as string""" as_var = node.vars and " as (%s)" % (node.vars.accept(self)) or "" withs = 'with (%s)%s:\n%s' % (node.expr.accept(self), as_var, self._stmt_list( node.body)) return withs - + def visit_yield(self, node): """yield an ast.Yield node as string""" yi_val = node.value and (" " + node.value.accept(self)) or "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/bases.py new/logilab-astng-0.23.1/bases.py --- old/logilab-astng-0.22.0/bases.py 2011-07-18 16:02:38.000000000 +0200 +++ new/logilab-astng-0.23.1/bases.py 2011-10-07 16:49:28.000000000 +0200 @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. # contact mailto:thenault@gmail.com @@ -24,6 +24,7 @@ __docformat__ = "restructuredtext en" +from contextlib import contextmanager from logilab.common.compat import builtins @@ -80,6 +81,12 @@ clone.boundnode = self.boundnode return clone + @contextmanager + def restore_path(self): + path = set(self.path) + yield + self.path = path + def copy_context(context): if context is not None: return context.clone() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/builder.py new/logilab-astng-0.23.1/builder.py --- old/logilab-astng-0.22.0/builder.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/builder.py 2011-12-08 15:26:42.000000000 +0100 @@ -1,4 +1,4 @@ -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. # contact mailto:thenault@gmail.com @@ -17,9 +17,7 @@ # # You should have received a copy of the GNU Lesser General Public License along # with logilab-astng. If not, see http://www.gnu.org/licenses/. -"""The ASTNGBuilder makes astng from living object and / or from compiler.ast - -With python >= 2.5, the internal _ast module is used instead +"""The ASTNGBuilder makes astng from living object and / or from _ast The builder is not thread safe and can't be used to parse different sources at the same time. @@ -121,33 +119,30 @@ raise ASTNGBuildingException(exc) except LookupError, exc: # unknown encoding raise ASTNGBuildingException(exc) - # get module name if necessary, *before modifying sys.path* + # get module name if necessary if modname is None: try: modname = '.'.join(modpath_from_file(path)) except ImportError: modname = splitext(basename(path))[0] # build astng representation - try: - sys.path.insert(0, dirname(path)) # XXX (syt) iirk - node = self.string_build(data, modname, path) - finally: - sys.path.pop(0) + node = self.string_build(data, modname, path) node.file_encoding = encoding - node.file_stream = stream return node def string_build(self, data, modname='', path=None): """build astng from source code string and return rebuilded astng""" module = self._data_build(data, modname, path) - if self._manager is not None: - self._manager.astng_cache[module.name] = module + self._manager.astng_cache[module.name] = module # post tree building steps after we stored the module in the cache: for from_node in module._from_nodes: self.add_from_names_to_locals(from_node) # handle delayed assattr nodes for delayed in module._delayed_assattr: self.delayed_assattr(delayed) + if modname: + for transformer in self._manager.transformers: + transformer(module) return module def _data_build(self, data, modname, path): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/inference.py new/logilab-astng-0.23.1/inference.py --- old/logilab-astng-0.22.0/inference.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/inference.py 2011-10-07 16:49:28.000000000 +0200 @@ -1,4 +1,4 @@ -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. # contact mailto:thenault@gmail.com diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/logilab_astng.egg-info/PKG-INFO new/logilab-astng-0.23.1/logilab_astng.egg-info/PKG-INFO --- old/logilab-astng-0.22.0/logilab_astng.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/logilab-astng-0.23.1/logilab_astng.egg-info/PKG-INFO 2011-12-08 15:26:51.000000000 +0100 @@ -0,0 +1,64 @@ +Metadata-Version: 1.0 +Name: logilab-astng +Version: 0.23.1 +Summary: rebuild a new abstract syntax tree from Python's ast +Home-page: http://www.logilab.org/project/logilab-astng +Author: Logilab +Author-email: python-projects@lists.logilab.org +License: LGPL +Description: ASTNG + ===== + + What's this ? + ------------- + + The aim of this module is to provide a common base representation of + python source code for projects such as pychecker, pyreverse, + pylint... Well, actually the development of this library is essentially + governed by pylint's needs. + + 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. + + Main modules are: + + * `bases`, `node_classses` and `scoped_nodes` contain the classes for the + different type of nodes of the tree. + + * the `manager` contains a high level object to get astng trees from + source files and living objects. It maintains a cache of previously + constructed tree for quick access + + + Installation + ------------ + + Extract the tarball, jump into the created directory and run :: + + python setup.py install + + For installation options, see :: + + python setup.py install --help + + + If you have any questions, please mail the + python-project@lists.logilab.org mailing list for support. See + http://lists.logilab.org/mailman/listinfo/python-projects for + subscription information and archives. + + Test + ---- + + Tests are in the 'test' subdirectory. To launch the whole tests suite + at once, you may use the 'pytest' utility from logilab-common (simply + type 'pytest' from within this directory) or if you're running python + >= 2.7, using discover, for instance:: + + python -m unittest discover -p "unittest*.py" + +Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/logilab_astng.egg-info/SOURCES.txt new/logilab-astng-0.23.1/logilab_astng.egg-info/SOURCES.txt --- old/logilab-astng-0.22.0/logilab_astng.egg-info/SOURCES.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/logilab-astng-0.23.1/logilab_astng.egg-info/SOURCES.txt 2011-12-08 15:26:51.000000000 +0100 @@ -0,0 +1,82 @@ +COPYING +COPYING.LESSER +ChangeLog +MANIFEST.in +README +README.Python3 +setup.py +./__init__.py +./__pkginfo__.py +./as_string.py +./bases.py +./builder.py +./exceptions.py +./inference.py +./inspector.py +./manager.py +./mixins.py +./node_classes.py +./nodes.py +./protocols.py +./raw_building.py +./rebuilder.py +./scoped_nodes.py +./utils.py +./test/unittest_builder.py +./test/unittest_inference.py +./test/unittest_inspector.py +./test/unittest_lookup.py +./test/unittest_manager.py +./test/unittest_nodes.py +./test/unittest_regrtest.py +./test/unittest_scoped_nodes.py +./test/unittest_utils.py +./test/data/__init__.py +./test/data/all.py +./test/data/format.py +./test/data/module.py +./test/data/module2.py +./test/data/noendingnewline.py +./test/data/nonregr.py +./test/data/notall.py +./test/data/SSL1/Connection1.py +./test/data/SSL1/__init__.py +./test/data/appl/__init__.py +./test/data/appl/myConnection.py +./test/data2/__init__.py +./test/data2/clientmodule_test.py +./test/data2/suppliermodule_test.py +logilab_astng.egg-info/PKG-INFO +logilab_astng.egg-info/SOURCES.txt +logilab_astng.egg-info/dependency_links.txt +logilab_astng.egg-info/namespace_packages.txt +logilab_astng.egg-info/requires.txt +logilab_astng.egg-info/top_level.txt +test/fulltest.sh +test/data/MyPyPa-0.1.0-py2.5.egg +test/data/MyPyPa-0.1.0-py2.5.zip +test/data/__init__.py +test/data/all.py +test/data/format.py +test/data/module.py +test/data/module2.py +test/data/noendingnewline.py +test/data/nonregr.py +test/data/notall.py +test/data/SSL1/Connection1.py +test/data/SSL1/__init__.py +test/data/appl/__init__.py +test/data/appl/myConnection.py +test/data2/__init__.py +test/data2/clientmodule_test.py +test/data2/suppliermodule_test.py +test/regrtest_data/descriptor_crash.py +test/regrtest_data/absimp/__init__.py +test/regrtest_data/absimp/string.py +test/regrtest_data/absimp/sidepackage/__init__.py +test/regrtest_data/package/__init__.py +test/regrtest_data/package/absimport.py +test/regrtest_data/package/hello.py +test/regrtest_data/package/import_package_subpackage_module.py +test/regrtest_data/package/subpackage/__init__.py +test/regrtest_data/package/subpackage/module.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/logilab_astng.egg-info/dependency_links.txt new/logilab-astng-0.23.1/logilab_astng.egg-info/dependency_links.txt --- old/logilab-astng-0.22.0/logilab_astng.egg-info/dependency_links.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/logilab-astng-0.23.1/logilab_astng.egg-info/dependency_links.txt 2011-12-08 15:26:51.000000000 +0100 @@ -0,0 +1 @@ + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/logilab_astng.egg-info/namespace_packages.txt new/logilab-astng-0.23.1/logilab_astng.egg-info/namespace_packages.txt --- old/logilab-astng-0.22.0/logilab_astng.egg-info/namespace_packages.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/logilab-astng-0.23.1/logilab_astng.egg-info/namespace_packages.txt 2011-12-08 15:26:51.000000000 +0100 @@ -0,0 +1 @@ +logilab diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/logilab_astng.egg-info/requires.txt new/logilab-astng-0.23.1/logilab_astng.egg-info/requires.txt --- old/logilab-astng-0.22.0/logilab_astng.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/logilab-astng-0.23.1/logilab_astng.egg-info/requires.txt 2011-12-08 15:26:51.000000000 +0100 @@ -0,0 +1 @@ +logilab-common >= 0.53.0 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/logilab_astng.egg-info/top_level.txt new/logilab-astng-0.23.1/logilab_astng.egg-info/top_level.txt --- old/logilab-astng-0.22.0/logilab_astng.egg-info/top_level.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/logilab-astng-0.23.1/logilab_astng.egg-info/top_level.txt 2011-12-08 15:26:51.000000000 +0100 @@ -0,0 +1 @@ +logilab diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/manager.py new/logilab-astng-0.23.1/manager.py --- old/logilab-astng-0.22.0/manager.py 2011-01-13 21:36:38.000000000 +0100 +++ new/logilab-astng-0.23.1/manager.py 2011-10-07 16:49:28.000000000 +0200 @@ -1,16 +1,4 @@ -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. # contact mailto:thenault@gmail.com @@ -32,7 +20,6 @@ """astng manager: avoid multiple astng build of a same module when possible by providing a class responsible to get astng representation from various source and using a cache of built modules) - """ __docformat__ = "restructuredtext en" @@ -99,7 +86,7 @@ # NOTE: cache entries are added by the [re]builder self.astng_cache = {} self._mod_file_cache = {} - + self.transformers = [] def astng_from_file(self, filepath, modname=None, fallback=True, source=False): """given a module name, return the astng object""" @@ -127,6 +114,9 @@ """given a module name, return the astng object""" if modname in self.astng_cache: return self.astng_cache[modname] + if modname == '__main__': + from logilab.astng.builder import ASTNGBuilder + return ASTNGBuilder(self).string_build('', modname) old_cwd = os.getcwd() if context_file: os.chdir(dirname(context_file)) @@ -276,6 +266,8 @@ project.add_module(astng) return project + def register_transformer(self, transformer): + self.transformers.append(transformer) class Project: """a project handle a set of modules / packages""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/node_classes.py new/logilab-astng-0.23.1/node_classes.py --- old/logilab-astng-0.22.0/node_classes.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/node_classes.py 2011-10-07 16:49:28.000000000 +0200 @@ -435,7 +435,7 @@ def getitem(self, index, context=None): if isinstance(self.value, basestring): - return self.value[index] + return Const(self.value[index]) raise TypeError('%r (value=%s)' % (self, self.value)) def has_dynamic_getattr(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/nodes.py new/logilab-astng-0.23.1/nodes.py --- old/logilab-astng-0.22.0/nodes.py 2011-01-13 21:36:38.000000000 +0100 +++ new/logilab-astng-0.23.1/nodes.py 2011-10-07 16:49:28.000000000 +0200 @@ -1,16 +1,4 @@ -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. # contact mailto:thenault@gmail.com diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/raw_building.py new/logilab-astng-0.23.1/raw_building.py --- old/logilab-astng-0.22.0/raw_building.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/raw_building.py 2011-10-07 16:49:28.000000000 +0200 @@ -246,8 +246,8 @@ object_build_function(node, member, name) elif isbuiltin(member): if self.imported_member(node, member, name): - if obj is object: - print 'skippp', obj, name, member + #if obj is object: + # print 'skippp', obj, name, member continue object_build_methoddescriptor(node, member, name) elif isclass(member): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/rebuilder.py new/logilab-astng-0.23.1/rebuilder.py --- old/logilab-astng-0.22.0/rebuilder.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/rebuilder.py 2011-10-07 16:49:28.000000000 +0200 @@ -1,15 +1,3 @@ -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. @@ -223,6 +211,8 @@ if isinstance(meth, new.Function): if func_name in ('classmethod', 'staticmethod'): meth.type = func_name + elif func_name == 'classproperty': # see lgc.decorators + meth.type = 'classmethod' meth.extra_decorators.append(newnode.value) except (AttributeError, KeyError): continue @@ -498,9 +488,11 @@ newnode.type = 'method' if newnode.decorators is not None: for decorator_expr in newnode.decorators.nodes: - if isinstance(decorator_expr, new.Name) and \ - decorator_expr.name in ('classmethod', 'staticmethod'): - newnode.type = decorator_expr.name + if isinstance(decorator_expr, new.Name): + if decorator_expr.name in ('classmethod', 'staticmethod'): + newnode.type = decorator_expr.name + elif decorator_expr.name == 'classproperty': + newnode.type = 'classmethod' frame.set_local(newnode.name, newnode) return newnode diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/scoped_nodes.py new/logilab-astng-0.23.1/scoped_nodes.py --- old/logilab-astng-0.22.0/scoped_nodes.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/scoped_nodes.py 2011-12-08 15:26:42.000000000 +0100 @@ -21,6 +21,7 @@ new local scope in the language definition : Module, Class, Function (and Lambda, GenExpr, DictComp and SetComp to some extent). """ +from __future__ import with_statement __doctype__ = "restructuredtext en" @@ -242,6 +243,12 @@ self.locals = self.globals = {} self.body = [] + @property + def file_stream(self): + if self.file is not None: + return file(self.file) + return None + def block_range(self, lineno): """return block line numbers. @@ -459,6 +466,7 @@ class Lambda(LocalsDictNodeNG, FilterStmtsMixin): _astng_fields = ('args', 'body',) + name = '<lambda>' # function's type, 'function' | 'method' | 'staticmethod' | 'classmethod' type = 'function' @@ -508,6 +516,7 @@ frame = self return frame._scope_lookup(node, name, offset) + class Function(Statement, Lambda): _astng_fields = ('decorators', 'args', 'body') @@ -766,29 +775,30 @@ """ # FIXME: should be possible to choose the resolution order # XXX inference make infinite loops possible here (see BaseTransformer - # manipulation in the builder module for instance !) + # manipulation in the builder module for instance) yielded = set([self]) if context is None: context = InferenceContext() for stmt in self.bases: - try: - for baseobj in stmt.infer(context): - if not isinstance(baseobj, Class): - # duh ? - continue - if baseobj in yielded: - continue # cf xxx above - yielded.add(baseobj) - yield baseobj - if recurs: - for grandpa in baseobj.ancestors(True, context): - if grandpa in yielded: - continue # cf xxx above - yielded.add(grandpa) - yield grandpa - except InferenceError: - # XXX log error ? - continue + with context.restore_path(): + try: + for baseobj in stmt.infer(context): + if not isinstance(baseobj, Class): + # duh ? + continue + if baseobj in yielded: + continue # cf xxx above + yielded.add(baseobj) + yield baseobj + if recurs: + for grandpa in baseobj.ancestors(True, context): + if grandpa in yielded: + continue # cf xxx above + yielded.add(grandpa) + yield grandpa + except InferenceError: + # XXX log error ? + continue def local_attr_ancestors(self, name, context=None): """return an iterator on astng representation of parent classes @@ -835,7 +845,7 @@ its parent classes """ values = self.instance_attrs.get(name, []) - # get if from the first parent implementing it if any + # get all values from parents for class_node in self.instance_attr_ancestors(name, context): values += class_node.instance_attrs[name] if not values: @@ -965,5 +975,3 @@ yield iface if missing: raise InferenceError() - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/setup.cfg new/logilab-astng-0.23.1/setup.cfg --- old/logilab-astng-0.22.0/setup.cfg 1970-01-01 01:00:00.000000000 +0100 +++ new/logilab-astng-0.23.1/setup.cfg 2011-12-08 15:26:51.000000000 +0100 @@ -0,0 +1,5 @@ +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/setup.py new/logilab-astng-0.23.1/setup.py --- old/logilab-astng-0.22.0/setup.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/setup.py 2011-12-08 15:26:42.000000000 +0100 @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=W0404,W0622,W0704,W0613 -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of logilab-astng. @@ -51,7 +51,6 @@ # import required features from __pkginfo__ import modname, version, license, description, \ web, author, author_email -# import optional features distname = getattr(__pkginfo__, 'distname', modname) scripts = getattr(__pkginfo__, 'scripts', []) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/test/unittest_builder.py new/logilab-astng-0.23.1/test/unittest_builder.py --- old/logilab-astng-0.22.0/test/unittest_builder.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/test/unittest_builder.py 2011-10-07 16:49:28.000000000 +0200 @@ -1,8 +1,4 @@ -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. # contact mailto:thenault@gmail.com @@ -21,14 +17,6 @@ # # You should have received a copy of the GNU Lesser General Public License along # with logilab-astng. If not, see http://www.gnu.org/licenses/. - -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """tests for the astng builder and rebuilder module""" import unittest @@ -592,6 +580,7 @@ self.assertEqual(len(_locals), 3) self.assertEqual(keys, ['autre', 'local', 'self']) + class ModuleBuildTC(FileBuildTC): def setUp(self): @@ -619,17 +608,6 @@ self.assert_('ass_type' in lclass.locals, lclass.locals.keys()) self.assert_('type' in lclass.locals.keys()) -# def test_1(self): -# from logilab import astng -# import compiler -# sn = astng.MANAGER.astng_from_file(join(astng.__path__[0], 'inference.py')) -# astastng = astng.MANAGER.astng_from_file(join(compiler.__path__[0], 'ast.py')) -# # check monkey patching of the compiler module has been inferred -# lclass = list(astastng.igetattr('Function')) -# self.assertEqual(len(lclass), 1) -# lclass = lclass[0] -# self.assert_('ass_type' in lclass.locals, lclass.locals.keys()) - def test_augassign_attr(self): astng = self.builder.string_build("""class Counter: v = 0 @@ -685,6 +663,20 @@ self.assertEqual(chain.value, 'None') + def test_lgc_classproperty(self): + '''test expected values of constants after rebuilding''' + code = ''' +from logilab.common.decorators import classproperty + +class A(object): + @classproperty + def hop(cls): + return None +''' + astng = self.builder.string_build(code) + self.assertEqual(astng['A']['hop'].type, 'classmethod') + + if sys.version_info < (3, 0): guess_encoding = builder._guess_encoding diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/test/unittest_inference.py new/logilab-astng-0.23.1/test/unittest_inference.py --- old/logilab-astng-0.22.0/test/unittest_inference.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/test/unittest_inference.py 2011-10-07 16:49:28.000000000 +0200 @@ -397,6 +397,7 @@ t = (2,) d = {} s = '' +s2 = '_' ''' astng = builder.string_build(code, __name__, __file__) n = astng['l'] @@ -427,6 +428,9 @@ self.assertIsInstance(infered, Instance) self.failUnlessEqual(infered.name, 'str') self.failUnless('lower' in infered._proxied.locals) + n = astng['s2'] + infered = n.infer().next() + self.failUnlessEqual(infered.getitem(0).value, '_') def test_unicode_type(self): if sys.version_info >= (3, 0): @@ -1126,5 +1130,16 @@ infered = list(n.igetattr('arg')) self.assertEqual(len(infered), 1, infered) + + def test_two_parents_from_same_module(self): + code = ''' +from data import nonregr +class Xxx(nonregr.Aaa, nonregr.Ccc): + "doc" + ''' + astng = builder.string_build(code, __name__, __file__) + parents = list(astng['Xxx'].ancestors()) + self.assertEqual(len(parents), 3, parents) # Aaa, Ccc, object + if __name__ == '__main__': unittest_main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/test/unittest_manager.py new/logilab-astng-0.23.1/test/unittest_manager.py --- old/logilab-astng-0.22.0/test/unittest_manager.py 2011-01-13 21:36:38.000000000 +0100 +++ new/logilab-astng-0.23.1/test/unittest_manager.py 2011-10-07 16:49:28.000000000 +0200 @@ -89,6 +89,11 @@ 'data.nonregr', 'data.notall'] self.assertListEqual(sorted(k for k in obj.keys()), expected) + def test_do_not_expose_main(self): + obj = self.manager.astng_from_module_name('__main__') + self.assertEqual(obj.name, '__main__') + self.assertEqual(obj.items(), []) + class BorgASTNGManagerTC(TestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/test/unittest_regrtest.py new/logilab-astng-0.23.1/test/unittest_regrtest.py --- old/logilab-astng-0.22.0/test/unittest_regrtest.py 2011-01-13 21:36:38.000000000 +0100 +++ new/logilab-astng-0.23.1/test/unittest_regrtest.py 2011-10-07 16:49:28.000000000 +0200 @@ -1,4 +1,4 @@ -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. # contact mailto:thenault@gmail.com @@ -43,6 +43,7 @@ manager.__dict__ = {} manager.astng_cache = {} manager._mod_file_cache = {} + manager.transformers = {} return manager def test_module_path(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/test/unittest_scoped_nodes.py new/logilab-astng-0.23.1/test/unittest_scoped_nodes.py --- old/logilab-astng-0.22.0/test/unittest_scoped_nodes.py 2011-07-18 16:02:39.000000000 +0200 +++ new/logilab-astng-0.23.1/test/unittest_scoped_nodes.py 2011-12-08 15:26:42.000000000 +0100 @@ -265,6 +265,12 @@ g = list(astng['f'].ilookup('g'))[0] self.failUnlessEqual(g.pytype(), '%s.function' % BUILTINS_MODULE) + def test_lambda_qname(self): + astng = abuilder.string_build(''' +lmbd = lambda: None +''', __name__, __file__) + self.assertEqual('unittest_scoped_nodes.<lambda>', astng['lmbd'].parent.value.qname()) + def test_is_method(self): data = ''' class A: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-astng-0.22.0/utils.py new/logilab-astng-0.23.1/utils.py --- old/logilab-astng-0.22.0/utils.py 2011-01-13 21:36:38.000000000 +0100 +++ new/logilab-astng-0.23.1/utils.py 2011-10-07 16:49:28.000000000 +0200 @@ -1,16 +1,4 @@ -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # copyright 2003-2010 Sylvain Thenault, all rights reserved. # contact mailto:thenault@gmail.com @@ -31,7 +19,6 @@ # with logilab-astng. If not, see http://www.gnu.org/licenses/. """this module contains some utilities to navigate in the tree or to extract information from it - """ __docformat__ = "restructuredtext en" -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org