Hello community,
here is the log from the commit of package python3-astroid for openSUSE:Factory checked in at 2016-01-21 23:42:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-astroid (Old)
and /work/SRC/openSUSE:Factory/.python3-astroid.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-astroid"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-astroid/python3-astroid.changes 2015-12-03 13:32:19.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.python3-astroid.new/python3-astroid.changes 2016-01-22 01:07:02.000000000 +0100
@@ -1,0 +2,23 @@
+Wed Jan 13 10:03:16 UTC 2016 - toddrme2178@gmail.com
+
+- Update to version 1.4.3
+ * pkg_resources brain tips are a bit more specific,
+ by specifiying proper returns.
+ * Standard library modules are properly detected by is_standard_module.
+ This should fix issues such as https://github.com/PyCQA/pylint/issues/725.
+- Update to version 1.4.2
+ * The slots() method conflates all the slots from the ancestors
+ into a list of current and parent slots.
+ We're doing this because this is the right semantics of slots,
+ they get inherited, as long as each parent defines a __slots__
+ entry.
+ * Revert to using printf-style formatting in as_string, in order
+ to avoid a potential problem with encodings when using .format.
+ Closes issue #273.
+ * assigned_stmts methods have the same signature from now on.
+ They used to have different signatures and each one made
+ assumptions about what could be passed to other implementations,
+ leading to various possible crashes when one or more arguments
+ weren't given. Closes issue #277.
+
+-------------------------------------------------------------------
Old:
----
astroid-1.4.1.tar.gz
New:
----
astroid-1.4.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-astroid.spec ++++++
--- /var/tmp/diff_new_pack.Tt6SPH/_old 2016-01-22 01:07:04.000000000 +0100
+++ /var/tmp/diff_new_pack.Tt6SPH/_new 2016-01-22 01:07:04.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python3-astroid
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,17 +17,18 @@
Name: python3-astroid
-Version: 1.4.1
+Version: 1.4.3
Release: 0
-Url: http://bitbucket.org/logilab/astroid
+Url: https://github.com/pycqa/astroid
Summary: Rebuild a new abstract syntax tree from Python's ast
License: LGPL-2.1+
Group: Development/Libraries/Python
Source: https://pypi.python.org/packages/source/a/astroid/astroid-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: python3-2to3
BuildRequires: python3-devel
BuildRequires: python3-setuptools
+BuildRequires: python3-six
+Requires: python3-six
BuildArch: noarch
%description
@@ -56,7 +57,7 @@
%files
%defattr(-,root,root,-)
-%doc COPYING COPYING.LESSER ChangeLog README
+%doc COPYING COPYING.LESSER ChangeLog README.rst
%{python3_sitelib}/astroid/
%{python3_sitelib}/astroid-%{version}-py*.egg-info
++++++ astroid-1.4.1.tar.gz -> astroid-1.4.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/ChangeLog new/astroid-1.4.3/ChangeLog
--- old/astroid-1.4.1/ChangeLog 2015-11-29 21:44:44.000000000 +0100
+++ new/astroid-1.4.3/ChangeLog 2015-12-24 16:03:30.000000000 +0100
@@ -1,6 +1,36 @@
Change log for the astroid package (used to be astng)
=====================================================
+2015-12-24 -- 1.4.3
+
+ * pkg_resources brain tips are a bit more specific,
+ by specifiying proper returns.
+
+ * Standard library modules are properly detected by is_standard_module.
+
+ This should fix issues such as https://github.com/PyCQA/pylint/issues/725.
+
+2015-12-21 -- 1.4.2
+
+ * The slots() method conflates all the slots from the ancestors
+ into a list of current and parent slots.
+
+ We're doing this because this is the right semantics of slots,
+ they get inherited, as long as each parent defines a __slots__
+ entry.
+
+ * Revert to using printf-style formatting in as_string, in order
+ to avoid a potential problem with encodings when using .format.
+ Closes issue #273.
+
+ * assigned_stmts methods have the same signature from now on.
+
+ They used to have different signatures and each one made
+ assumptions about what could be passed to other implementations,
+ leading to various possible crashes when one or more arguments
+ weren't given. Closes issue #277.
+
+
2015-11-29 -- 1.4.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/PKG-INFO new/astroid-1.4.3/PKG-INFO
--- old/astroid-1.4.1/PKG-INFO 2015-11-29 22:19:52.000000000 +0100
+++ new/astroid-1.4.3/PKG-INFO 2015-12-24 16:13:30.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: astroid
-Version: 1.4.1
+Version: 1.4.3
Summary: A abstract syntax tree for Python with inference support.
Home-page: http://bitbucket.org/logilab/astroid
Author: Logilab
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/README new/astroid-1.4.3/README
--- old/astroid-1.4.1/README 2015-11-29 15:57:24.000000000 +0100
+++ new/astroid-1.4.3/README 1970-01-01 01:00:00.000000000 +0100
@@ -1,64 +0,0 @@
-.. image:: https://drone.io/bitbucket.org/logilab/astroid/status.png
- :alt: drone.io Build Status
- :target: https://drone.io/bitbucket.org/logilab/astroid
-
-Astroid
-=======
-
-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 used to be called logilab-astng.
-
-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. The new
-node classes have additional methods and attributes for different
-usages. They include some support for static inference and local name
-scopes. Furthermore, astroid 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 astroid 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 code-quality@python.org
-mailing list for support. See
-http://mail.python.org/mailman/listinfo/code-quality for subscription
-information and archives. You may find older archives at
-http://lists.logilab.org/mailman/listinfo/python-projects .
-
-Python Versions
----------------
-
-astroid is compatible with Python 2.7 as well as 3.3 and later. astroid uses
-the same code base for both Python versions, using six.
-
-Test
-----
-
-Tests are in the 'test' subdirectory. To launch the whole tests suite
-at once, you can use unittest discover::
-
- python -m unittest discover -p "unittest*.py"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/README.rst new/astroid-1.4.3/README.rst
--- old/astroid-1.4.1/README.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/astroid-1.4.3/README.rst 2015-12-24 16:02:22.000000000 +0100
@@ -0,0 +1,64 @@
+.. image:: https://drone.io/bitbucket.org/logilab/astroid/status.png
+ :alt: drone.io Build Status
+ :target: https://drone.io/bitbucket.org/logilab/astroid
+
+Astroid
+=======
+
+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 used to be called logilab-astng.
+
+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. The new
+node classes have additional methods and attributes for different
+usages. They include some support for static inference and local name
+scopes. Furthermore, astroid 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 astroid 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 code-quality@python.org
+mailing list for support. See
+http://mail.python.org/mailman/listinfo/code-quality for subscription
+information and archives. You may find older archives at
+http://lists.logilab.org/mailman/listinfo/python-projects .
+
+Python Versions
+---------------
+
+astroid is compatible with Python 2.7 as well as 3.3 and later. astroid uses
+the same code base for both Python versions, using six.
+
+Test
+----
+
+Tests are in the 'test' subdirectory. To launch the whole tests suite
+at once, you can use unittest discover::
+
+ python -m unittest discover -p "unittest*.py"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/__init__.py new/astroid-1.4.3/astroid/__init__.py
--- old/astroid-1.4.1/astroid/__init__.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/__init__.py 2015-12-24 16:02:22.000000000 +0100
@@ -114,8 +114,11 @@
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
+ for name, objs in extension_module._locals.items():
+ node._locals[name] = objs
+ for obj in objs:
+ if obj.parent is extension_module:
+ obj.parent = node
manager.register_transform(Module, transform, lambda n: n.name == module_name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/__pkginfo__.py new/astroid-1.4.3/astroid/__pkginfo__.py
--- old/astroid-1.4.1/astroid/__pkginfo__.py 2015-11-29 21:44:53.000000000 +0100
+++ new/astroid-1.4.3/astroid/__pkginfo__.py 2015-12-24 16:03:37.000000000 +0100
@@ -20,7 +20,7 @@
modname = 'astroid'
-numversion = (1, 4, 1)
+numversion = (1, 4, 3)
version = '.'.join([str(num) for num in numversion])
install_requires = ['six', 'lazy_object_proxy', 'wrapt']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/as_string.py new/astroid-1.4.3/astroid/as_string.py
--- old/astroid-1.4.1/astroid/as_string.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/as_string.py 2015-12-24 16:02:22.000000000 +0100
@@ -287,13 +287,11 @@
trailer = return_annotation + ":"
else:
trailer = ":"
- def_format = "\n{decorators}def {name}({args}){trailer}{docs}\n{body}"
- return def_format.format(decorators=decorate,
- name=node.name,
- args=node.args.accept(self),
- trailer=trailer,
- docs=docs,
- body=self._stmt_list(node.body))
+ def_format = "\n%sdef %s(%s)%s%s\n%s"
+ return def_format % (decorate, node.name,
+ node.args.accept(self),
+ trailer, docs,
+ self._stmt_list(node.body))
def visit_generatorexp(self, node):
"""return an astroid.GeneratorExp node as string"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/bases.py new/astroid-1.4.3/astroid/bases.py
--- old/astroid-1.4.1/astroid/bases.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/bases.py 2015-12-24 16:02:22.000000000 +0100
@@ -47,7 +47,7 @@
POSSIBLE_PROPERTIES = {"cached_property", "cachedproperty",
"lazyproperty", "lazy_property", "reify",
"lazyattribute", "lazy_attribute",
- "LazyProperty"}
+ "LazyProperty", "lazy"}
def _is_property(meth):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/brain/brain_gi.py new/astroid-1.4.3/astroid/brain/brain_gi.py
--- old/astroid-1.4.1/astroid/brain/brain_gi.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/brain/brain_gi.py 2015-12-24 16:02:22.000000000 +0100
@@ -47,13 +47,13 @@
elif (inspect.ismethod(obj) or
inspect.ismethoddescriptor(obj)):
methods[name] = obj
- elif isinstance(obj, (int, str)):
- constants[name] = obj
elif (str(obj).startswith("http://bugs.python.org/issue1294959`_
-# :see: `FHS http://www.pathname.com/fhs/pub/fhs-2.3.html#LIBLTQUALGTALTERNATEFORMATESSEN...`_
+
try:
# The explicit sys.prefix is to work around a patch in virtualenv that
# replaces the 'real' sys.prefix (i.e. the location of the binary)
@@ -67,18 +62,50 @@
# Take care of installations where exec_prefix != prefix.
get_python_lib(standard_lib=True, prefix=sys.exec_prefix),
get_python_lib(standard_lib=True)])
- if os.name == 'nt':
- STD_LIB_DIRS.add(os.path.join(sys.prefix, 'dlls'))
- try:
- # real_prefix is defined when running inside virtualenv.
- STD_LIB_DIRS.add(os.path.join(sys.real_prefix, 'dlls'))
- except AttributeError:
- pass
# get_python_lib(standard_lib=1) is not available on pypy, set STD_LIB_DIR to
# non-valid path, see https://bugs.pypy.org/issue1164
except DistutilsPlatformError:
STD_LIB_DIRS = set()
+if os.name == 'nt':
+ STD_LIB_DIRS.add(os.path.join(sys.prefix, 'dlls'))
+ try:
+ # real_prefix is defined when running inside virtualenv.
+ STD_LIB_DIRS.add(os.path.join(sys.real_prefix, 'dlls'))
+ except AttributeError:
+ pass
+if platform.python_implementation() == 'PyPy':
+ _root = os.path.join(sys.prefix, 'lib_pypy')
+ STD_LIB_DIRS.add(_root)
+ try:
+ # real_prefix is defined when running inside virtualenv.
+ STD_LIB_DIRS.add(os.path.join(sys.real_prefix, 'lib_pypy'))
+ except AttributeError:
+ pass
+ del _root
+if os.name == 'posix':
+ # Need the real prefix is we're under a virtualenv, otherwise
+ # the usual one will do.
+ try:
+ prefix = sys.real_prefix
+ except AttributeError:
+ prefix = sys.prefix
+
+ def _posix_path(path):
+ base_python = 'python%d.%d' % sys.version_info[:2]
+ return os.path.join(prefix, path, base_python)
+
+ STD_LIB_DIRS.add(_posix_path('lib'))
+ if sys.maxsize > 2**32:
+ # This tries to fix a problem with /usr/lib64 builds,
+ # where systems are running both 32-bit and 64-bit code
+ # on the same machine, which reflects into the places where
+ # standard library could be found. More details can be found
+ # here http://bugs.python.org/issue1294959.
+ # An easy reproducing case would be
+ # https://github.com/PyCQA/pylint/issues/712#issuecomment-163178753
+ STD_LIB_DIRS.add(_posix_path('lib64'))
+
EXT_LIB_DIR = get_python_lib()
IS_JYTHON = platform.python_implementation() == 'Jython'
BUILTIN_MODULES = dict.fromkeys(sys.builtin_module_names, True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/protocols.py new/astroid-1.4.3/astroid/protocols.py
--- old/astroid-1.4.1/astroid/protocols.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/protocols.py 2015-12-24 16:02:22.000000000 +0100
@@ -250,7 +250,7 @@
@bases.raise_if_nothing_inferred
-def for_assigned_stmts(self, node, context=None, asspath=None):
+def for_assigned_stmts(self, node=None, context=None, asspath=None):
if asspath is None:
for lst in self.iter.infer(context):
if isinstance(lst, (nodes.Tuple, nodes.List)):
@@ -265,18 +265,25 @@
nodes.Comprehension.assigned_stmts = for_assigned_stmts
-def mulass_assigned_stmts(self, node, context=None, asspath=None):
+def sequence_assigned_stmts(self, node=None, context=None, asspath=None):
if asspath is None:
asspath = []
- asspath.insert(0, self.elts.index(node))
- return self.parent.assigned_stmts(self, context, asspath)
+ try:
+ index = self.elts.index(node)
+ except ValueError:
+ util.reraise(exceptions.InferenceError(
+ 'Tried to retrieve a node {node!r} which does not exist',
+ node=self, assign_path=asspath, context=context))
+
+ asspath.insert(0, index)
+ return self.parent.assigned_stmts(node=self, context=context, asspath=asspath)
-nodes.Tuple.assigned_stmts = mulass_assigned_stmts
-nodes.List.assigned_stmts = mulass_assigned_stmts
+nodes.Tuple.assigned_stmts = sequence_assigned_stmts
+nodes.List.assigned_stmts = sequence_assigned_stmts
-def assend_assigned_stmts(self, context=None):
- return self.parent.assigned_stmts(self, context=context)
+def assend_assigned_stmts(self, node=None, context=None, asspath=None):
+ return self.parent.assigned_stmts(node=self, context=context)
nodes.AssignName.assigned_stmts = assend_assigned_stmts
nodes.AssignAttr.assigned_stmts = assend_assigned_stmts
@@ -325,7 +332,7 @@
yield util.YES
-def arguments_assigned_stmts(self, node, context, asspath=None):
+def arguments_assigned_stmts(self, node=None, context=None, asspath=None):
if context.callcontext:
# reset call context/name
callcontext = context.callcontext
@@ -339,7 +346,7 @@
@bases.raise_if_nothing_inferred
-def assign_assigned_stmts(self, node, context=None, asspath=None):
+def assign_assigned_stmts(self, node=None, context=None, asspath=None):
if not asspath:
yield self.value
return
@@ -380,7 +387,7 @@
@bases.raise_if_nothing_inferred
-def excepthandler_assigned_stmts(self, node, context=None, asspath=None):
+def excepthandler_assigned_stmts(self, node=None, context=None, asspath=None):
for assigned in node_classes.unpack_infer(self.type):
if isinstance(assigned, nodes.ClassDef):
assigned = bases.Instance(assigned)
@@ -389,7 +396,7 @@
@bases.raise_if_nothing_inferred
-def with_assigned_stmts(self, node, context=None, asspath=None):
+def with_assigned_stmts(self, node=None, context=None, asspath=None):
if asspath is None:
for _, vars in self.items:
if vars is None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/scoped_nodes.py new/astroid-1.4.3/astroid/scoped_nodes.py
--- old/astroid-1.4.1/astroid/scoped_nodes.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/scoped_nodes.py 2015-12-24 16:02:22.000000000 +0100
@@ -535,6 +535,7 @@
all = self['__all__']
except KeyError:
return default
+
try:
explicit = next(all.assigned_stmts())
except exceptions.InferenceError:
@@ -1578,6 +1579,22 @@
except exceptions.InferenceError:
continue
+ def _slots(self):
+ if not self.newstyle:
+ raise NotImplementedError(
+ "The concept of slots is undefined for old-style classes.")
+
+ slots = self._islots()
+ try:
+ first = next(slots)
+ except StopIteration as exc:
+ # The class doesn't have a __slots__ definition or empty slots.
+ if exc.args and exc.args[0] not in ('', None):
+ return exc.args[0]
+ return None
+ # pylint: disable=unsupported-binary-operation; false positive
+ return [first] + list(slots)
+
# Cached, because inferring them all the time is expensive
@decorators_mod.cached
def slots(self):
@@ -1588,20 +1605,28 @@
Also, it will return None in the case the slots weren't inferred.
Otherwise, it will return a list of slot names.
"""
+ def grouped_slots():
+ # Not interested in object, since it can't have slots.
+ for cls in self.mro()[:-1]:
+ try:
+ cls_slots = cls._slots()
+ except NotImplementedError:
+ continue
+ if cls_slots is not None:
+ for slot in cls_slots:
+ yield slot
+ else:
+ yield None
+
if not self.newstyle:
raise NotImplementedError(
"The concept of slots is undefined for old-style classes.")
- slots = self._islots()
- try:
- first = next(slots)
- except StopIteration as exc:
- # The class doesn't have a __slots__ definition or empty slots.
- if exc.args and exc.args[0] not in ('', None):
- return exc.args[0]
+ slots = list(grouped_slots())
+ if not all(slot is not None for slot in slots):
return None
- # pylint: disable=unsupported-binary-operation; false positive
- return [first] + list(slots)
+
+ return sorted(slots, key=lambda item: item.value)
def _inferred_bases(self, context=None):
# TODO(cpopa): really similar with .ancestors,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/tests/unittest_brain.py new/astroid-1.4.3/astroid/tests/unittest_brain.py
--- old/astroid-1.4.1/astroid/tests/unittest_brain.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/tests/unittest_brain.py 2015-12-24 16:02:22.000000000 +0100
@@ -301,6 +301,15 @@
else:
self.assertIsInstance(cpu_count, astroid.BoundMethod)
+ def test_module_name(self):
+ module = test_utils.extract_node("""
+ import multiprocessing
+ multiprocessing.SyncManager()
+ """)
+ inferred_sync_mgr = next(module.infer())
+ module = inferred_sync_mgr.root()
+ self.assertEqual(module.name, 'multiprocessing.managers')
+
def test_multiprocessing_manager(self):
# Test that we have the proper attributes
# for a multiprocessing.managers.SyncManager
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/tests/unittest_manager.py new/astroid-1.4.3/astroid/tests/unittest_manager.py
--- old/astroid-1.4.1/astroid/tests/unittest_manager.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/tests/unittest_manager.py 2015-12-24 16:02:22.000000000 +0100
@@ -35,8 +35,9 @@
return obj.__file__.split("$py.class")[0] + ".py"
if sys.version_info > (3, 0):
return obj.__file__
- else:
+ if not obj.__file__.endswith(".py"):
return obj.__file__[:-1]
+ return obj.__file__
class AstroidManagerTest(resources.SysPathSetup,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/tests/unittest_modutils.py new/astroid-1.4.3/astroid/tests/unittest_modutils.py
--- old/astroid-1.4.1/astroid/tests/unittest_modutils.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/tests/unittest_modutils.py 2015-12-24 16:02:22.000000000 +0100
@@ -176,6 +176,11 @@
library
"""
+ def test_datetime(self):
+ # This is an interesting example, since datetime, on pypy,
+ # is under lib_pypy, rather than the usual Lib directory.
+ self.assertTrue(modutils.is_standard_module('datetime'))
+
def test_builtins(self):
if sys.version_info < (3, 0):
self.assertEqual(modutils.is_standard_module('__builtin__'), True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/tests/unittest_nodes.py new/astroid-1.4.3/astroid/tests/unittest_nodes.py
--- old/astroid-1.4.1/astroid/tests/unittest_nodes.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/tests/unittest_nodes.py 2015-12-24 16:02:22.000000000 +0100
@@ -534,6 +534,7 @@
pass
def lazyproperty():
pass
+ def lazy(): pass
class A(object):
@property
def builtin_property(self):
@@ -550,6 +551,8 @@
@lazyproperty
def lazyprop(self): return 42
def not_prop(self): pass
+ @lazy
+ def decorated_with_lazy(self): return 42
cls = A()
builtin_property = cls.builtin_property
@@ -559,9 +562,10 @@
not_prop = cls.not_prop
lazy_prop = cls.lazy_prop
lazyprop = cls.lazyprop
+ decorated_with_lazy = cls.decorated_with_lazy
''')
for prop in ('builtin_property', 'abc_property', 'cached_p', 'reified',
- 'lazy_prop', 'lazyprop'):
+ 'lazy_prop', 'lazyprop', 'decorated_with_lazy'):
inferred = next(ast[prop].infer())
self.assertIsInstance(inferred, nodes.Const, prop)
self.assertEqual(inferred.value, 42, prop)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/tests/unittest_protocols.py new/astroid-1.4.3/astroid/tests/unittest_protocols.py
--- old/astroid-1.4.1/astroid/tests/unittest_protocols.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/tests/unittest_protocols.py 2015-12-24 16:02:22.000000000 +0100
@@ -16,8 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License along
# with astroid. If not, see http://www.gnu.org/licenses/.
+import contextlib
import unittest
+import astroid
from astroid.test_utils import extract_node, require_version
from astroid import InferenceError
from astroid import nodes
@@ -25,6 +27,15 @@
from astroid.node_classes import AssignName, Const, Name, Starred
+@contextlib.contextmanager
+def _add_transform(manager, node, transform, predicate=None):
+ manager.register_transform(node, transform, predicate)
+ try:
+ yield
+ finally:
+ manager.unregister_transform(node, transform, predicate)
+
+
class ProtocolTests(unittest.TestCase):
def assertConstNodesEqual(self, nodes_list_expected, nodes_list_got):
@@ -149,6 +160,17 @@
assigned = list(simple_mul_assnode_2.assigned_stmts())
self.assertNameNodesEqual(['c'], assigned)
+ def test_sequence_assigned_stmts_not_accepting_empty_node(self):
+ def transform(node):
+ node.root().locals['__all__'] = [node.value]
+
+ manager = astroid.MANAGER
+ with _add_transform(manager, astroid.Assign, transform):
+ module = astroid.parse('''
+ __all__ = ['a']
+ ''')
+ module.wildcard_import_names()
+
if __name__ == '__main__':
unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/tests/unittest_regrtest.py new/astroid-1.4.3/astroid/tests/unittest_regrtest.py
--- old/astroid-1.4.1/astroid/tests/unittest_regrtest.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/tests/unittest_regrtest.py 2015-12-24 16:02:22.000000000 +0100
@@ -282,6 +282,23 @@
''')
self.assertRaises(exceptions.InferenceError, next, node.infer())
+ def test_unicode_in_docstring(self):
+ # Crashed for astroid==1.4.1
+ # Test for https://bitbucket.org/logilab/astroid/issues/273/
+
+ # In a regular file, "coding: utf-8" would have been used.
+ node = extract_node(u'''
+ from __future__ import unicode_literals
+
+ class MyClass(object):
+ def method(self):
+ "With unicode : %s "
+
+ instance = MyClass()
+ ''' % u"\u2019")
+
+ next(node.value.infer()).as_string()
+
class Whatever(object):
a = property(lambda x: x, lambda x: x)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid/tests/unittest_scoped_nodes.py new/astroid-1.4.3/astroid/tests/unittest_scoped_nodes.py
--- old/astroid-1.4.1/astroid/tests/unittest_scoped_nodes.py 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/astroid/tests/unittest_scoped_nodes.py 2015-12-24 16:02:22.000000000 +0100
@@ -1203,6 +1203,41 @@
module['OldStyle'].slots()
self.assertEqual(str(cm.exception), msg)
+ def test_slots_empty_list_of_slots(self):
+ module = builder.parse("""
+ class Klass(object):
+ __slots__ = ()
+ """)
+ cls = module['Klass']
+ self.assertEqual(cls.slots(), [])
+
+ def test_slots_taken_from_parents(self):
+ module = builder.parse('''
+ class FirstParent(object):
+ __slots__ = ('a', 'b', 'c')
+ class SecondParent(FirstParent):
+ __slots__ = ('d', 'e')
+ class Third(SecondParent):
+ __slots__ = ('d', )
+ ''')
+ cls = module['Third']
+ slots = cls.slots()
+ self.assertEqual(sorted(set(slot.value for slot in slots)),
+ ['a', 'b', 'c', 'd', 'e'])
+
+ def test_all_ancestors_need_slots(self):
+ module = builder.parse('''
+ class A(object):
+ __slots__ = ('a', )
+ class B(A): pass
+ class C(B):
+ __slots__ = ('a', )
+ ''')
+ cls = module['C']
+ self.assertIsNone(cls.slots())
+ cls = module['B']
+ self.assertIsNone(cls.slots())
+
def assertEqualMro(self, klass, expected_mro):
self.assertEqual(
[member.name for member in klass.mro()],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid.egg-info/PKG-INFO new/astroid-1.4.3/astroid.egg-info/PKG-INFO
--- old/astroid-1.4.1/astroid.egg-info/PKG-INFO 2015-11-29 22:19:16.000000000 +0100
+++ new/astroid-1.4.3/astroid.egg-info/PKG-INFO 2015-12-24 16:13:17.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: astroid
-Version: 1.4.1
+Version: 1.4.3
Summary: A abstract syntax tree for Python with inference support.
Home-page: http://bitbucket.org/logilab/astroid
Author: Logilab
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/astroid.egg-info/SOURCES.txt new/astroid-1.4.3/astroid.egg-info/SOURCES.txt
--- old/astroid-1.4.1/astroid.egg-info/SOURCES.txt 2015-11-29 22:19:16.000000000 +0100
+++ new/astroid-1.4.3/astroid.egg-info/SOURCES.txt 2015-12-24 16:13:17.000000000 +0100
@@ -2,7 +2,7 @@
COPYING.LESSER
ChangeLog
MANIFEST.in
-README
+README.rst
setup.cfg
setup.py
tox.ini
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/setup.cfg new/astroid-1.4.3/setup.cfg
--- old/astroid-1.4.1/setup.cfg 2015-11-29 22:19:52.000000000 +0100
+++ new/astroid-1.4.3/setup.cfg 2015-12-24 16:13:30.000000000 +0100
@@ -2,7 +2,7 @@
universal = 1
[egg_info]
+tag_date = 0
tag_svn_revision = 0
tag_build =
-tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/setup.py new/astroid-1.4.3/setup.py
--- old/astroid-1.4.1/setup.py 2015-11-29 15:57:24.000000000 +0100
+++ new/astroid-1.4.3/setup.py 2015-12-21 10:32:11.000000000 +0100
@@ -20,14 +20,18 @@
"""Setup script for astroid."""
import os
from setuptools import setup, find_packages
+from setuptools.command import easy_install
from setuptools.command import install_lib
-pkginfo = 'astroid/__pkginfo__.py'
+
+real_path = os.path.realpath(__file__)
+astroid_dir = os.path.dirname(real_path)
+pkginfo = os.path.join(astroid_dir, 'astroid', '__pkginfo__.py')
with open(pkginfo, 'rb') as fobj:
exec(compile(fobj.read(), pkginfo, 'exec'), locals())
-with open('README') as fobj:
+with open(os.path.join(astroid_dir, 'README.rst')) as fobj:
long_description = fobj.read()
class AstroidInstallLib(install_lib.install_lib):
@@ -37,6 +41,15 @@
install_lib.install_lib.byte_compile(self, files)
+class AstroidEasyInstallLib(easy_install.easy_install):
+ # override this since pip/easy_install attempt to byte compile
+ # test data files, some of them being syntactically wrong by design,
+ # and this scares the end-user
+ def byte_compile(self, files):
+ test_datadir = os.path.join('astroid', 'tests', 'testdata')
+ files = [f for f in files if test_datadir not in f]
+ easy_install.easy_install.byte_compile(self, files)
+
def install():
return setup(name = distname,
@@ -51,7 +64,8 @@
include_package_data = True,
install_requires = install_requires,
packages = find_packages(),
- cmdclass={'install_lib': AstroidInstallLib}
+ cmdclass={'install_lib': AstroidInstallLib,
+ 'easy_install': AstroidEasyInstallLib}
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-1.4.1/tox.ini new/astroid-1.4.3/tox.ini
--- old/astroid-1.4.1/tox.ini 2015-11-29 21:37:16.000000000 +0100
+++ new/astroid-1.4.3/tox.ini 2015-12-24 16:02:22.000000000 +0100
@@ -3,9 +3,6 @@
skip_missing_interpreters = true
[testenv:pylint]
-deps =
- hg+https://bitbucket.org/logilab/astroid@1.4.0
- hg+https://bitbucket.org/logilab/pylint@1.5.0
commands = pylint -rn --rcfile={toxinidir}/pylintrc {envsitepackagesdir}/astroid
[testenv]
@@ -19,5 +16,5 @@
py27,py33,pypy,jython: singledispatch
six
wrapt
- pylint: hg+https://bitbucket.org/logilab/pylint
+ pylint: git+https://github.com/pycqa/pylint@1.5.0
commands = python -m unittest discover -s {envsitepackagesdir}/astroid/tests -p "unittest*.py"