[Python-modules-commits] [astroid] 01/04: Import astroid_1.4.6.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Sat Jun 11 17:56:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository astroid.

commit cedbcb48decc959c25625cdf4af31634be082bdc
Author: Sandro Tosi <morph at debian.org>
Date:   Sat Jun 11 18:42:26 2016 +0100

    Import astroid_1.4.6.orig.tar.gz
---
 ChangeLog                          |  8 +++++
 PKG-INFO                           |  2 +-
 astroid.egg-info/PKG-INFO          |  2 +-
 astroid.egg-info/SOURCES.txt       |  1 +
 astroid/__pkginfo__.py             |  2 +-
 astroid/brain/brain_ssl.py         | 65 ++++++++++++++++++++++++++++++++++++++
 astroid/brain/brain_stdlib.py      | 17 ++++++++--
 astroid/tests/unittest_brain.py    |  6 ++--
 astroid/tests/unittest_regrtest.py | 15 +++++++++
 setup.cfg                          |  2 +-
 10 files changed, 112 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1db8185..2fd0a96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
 Change log for the astroid package (used to be astng)
 =====================================================
 
+2016-06-06 -- 1.4.6
+
+    * Fix a crash which occurred when the class of a namedtuple could not be inferred.
+
+    * Functional form of enums support accessing values through __call__.
+
+    * Brain tips for the ssl library.
+
 2016-03-21 -- 1.4.5
 
     * decoratornames() does not leak InferenceError anymore.
diff --git a/PKG-INFO b/PKG-INFO
index 8462eeb..6ff1833 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: astroid
-Version: 1.4.5
+Version: 1.4.6
 Summary: A abstract syntax tree for Python with inference support.
 Home-page: http://bitbucket.org/logilab/astroid
 Author: Logilab
diff --git a/astroid.egg-info/PKG-INFO b/astroid.egg-info/PKG-INFO
index 8462eeb..6ff1833 100644
--- a/astroid.egg-info/PKG-INFO
+++ b/astroid.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: astroid
-Version: 1.4.5
+Version: 1.4.6
 Summary: A abstract syntax tree for Python with inference support.
 Home-page: http://bitbucket.org/logilab/astroid
 Author: Logilab
diff --git a/astroid.egg-info/SOURCES.txt b/astroid.egg-info/SOURCES.txt
index 19e02b4..93cdf6d 100644
--- a/astroid.egg-info/SOURCES.txt
+++ b/astroid.egg-info/SOURCES.txt
@@ -44,6 +44,7 @@ astroid/brain/brain_numpy.py
 astroid/brain/brain_pytest.py
 astroid/brain/brain_qt.py
 astroid/brain/brain_six.py
+astroid/brain/brain_ssl.py
 astroid/brain/brain_stdlib.py
 astroid/tests/__init__.py
 astroid/tests/resources.py
diff --git a/astroid/__pkginfo__.py b/astroid/__pkginfo__.py
index 2753060..d197cda 100644
--- a/astroid/__pkginfo__.py
+++ b/astroid/__pkginfo__.py
@@ -20,7 +20,7 @@ distname = 'astroid'
 
 modname = 'astroid'
 
-numversion = (1, 4, 5)
+numversion = (1, 4, 6)
 version = '.'.join([str(num) for num in numversion])
 
 install_requires = ['six', 'lazy_object_proxy', 'wrapt']
diff --git a/astroid/brain/brain_ssl.py b/astroid/brain/brain_ssl.py
new file mode 100644
index 0000000..1cf8d1b
--- /dev/null
+++ b/astroid/brain/brain_ssl.py
@@ -0,0 +1,65 @@
+"""Astroid hooks for the ssl library."""
+
+from astroid import MANAGER, register_module_extender
+from astroid.builder import AstroidBuilder
+from astroid import nodes
+from astroid import parse
+
+
+def ssl_transform():
+    return parse('''
+    from _ssl import OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_INFO, OPENSSL_VERSION
+    from _ssl import _SSLContext, MemoryBIO
+    from _ssl import (
+        SSLError, SSLZeroReturnError, SSLWantReadError, SSLWantWriteError,
+        SSLSyscallError, SSLEOFError,
+        )
+    from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
+    from _ssl import txt2obj as _txt2obj, nid2obj as _nid2obj
+    from _ssl import RAND_status, RAND_add, RAND_bytes, RAND_pseudo_bytes
+    try:
+        from _ssl import RAND_egd
+    except ImportError:
+        # LibreSSL does not provide RAND_egd
+        pass
+    from _ssl import (OP_ALL, OP_CIPHER_SERVER_PREFERENCE,
+                      OP_NO_COMPRESSION, OP_NO_SSLv2, OP_NO_SSLv3,
+                      OP_NO_TLSv1, OP_NO_TLSv1_1, OP_NO_TLSv1_2,
+                      OP_SINGLE_DH_USE, OP_SINGLE_ECDH_USE)
+
+    from _ssl import (ALERT_DESCRIPTION_ACCESS_DENIED, ALERT_DESCRIPTION_BAD_CERTIFICATE,
+                      ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE,
+                      ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE,
+                      ALERT_DESCRIPTION_BAD_RECORD_MAC,
+                      ALERT_DESCRIPTION_CERTIFICATE_EXPIRED,
+                      ALERT_DESCRIPTION_CERTIFICATE_REVOKED,
+                      ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN,
+                      ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE,
+                      ALERT_DESCRIPTION_CLOSE_NOTIFY, ALERT_DESCRIPTION_DECODE_ERROR,
+                      ALERT_DESCRIPTION_DECOMPRESSION_FAILURE,
+                      ALERT_DESCRIPTION_DECRYPT_ERROR,
+                      ALERT_DESCRIPTION_HANDSHAKE_FAILURE,
+                      ALERT_DESCRIPTION_ILLEGAL_PARAMETER,
+                      ALERT_DESCRIPTION_INSUFFICIENT_SECURITY,
+                      ALERT_DESCRIPTION_INTERNAL_ERROR,
+                      ALERT_DESCRIPTION_NO_RENEGOTIATION,
+                      ALERT_DESCRIPTION_PROTOCOL_VERSION,
+                      ALERT_DESCRIPTION_RECORD_OVERFLOW,
+                      ALERT_DESCRIPTION_UNEXPECTED_MESSAGE,
+                      ALERT_DESCRIPTION_UNKNOWN_CA,
+                      ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY,
+                      ALERT_DESCRIPTION_UNRECOGNIZED_NAME,
+                      ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE,
+                      ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION,
+                      ALERT_DESCRIPTION_USER_CANCELLED)
+    from _ssl import (SSL_ERROR_EOF, SSL_ERROR_INVALID_ERROR_CODE, SSL_ERROR_SSL,
+                      SSL_ERROR_SYSCALL, SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_READ,
+                      SSL_ERROR_WANT_WRITE, SSL_ERROR_WANT_X509_LOOKUP, SSL_ERROR_ZERO_RETURN)
+    from _ssl import VERIFY_CRL_CHECK_CHAIN, VERIFY_CRL_CHECK_LEAF, VERIFY_DEFAULT, VERIFY_X509_STRICT
+    from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN
+    from _ssl import _OPENSSL_API_VERSION
+    from _ssl import PROTOCOL_SSLv23, PROTOCOL_TLSv1, PROTOCOL_TLSv1_1, PROTOCOL_TLSv1_2
+    ''')
+
+
+register_module_extender(MANAGER, 'ssl', ssl_transform)
diff --git a/astroid/brain/brain_stdlib.py b/astroid/brain/brain_stdlib.py
index ac73188..ad395a2 100644
--- a/astroid/brain/brain_stdlib.py
+++ b/astroid/brain/brain_stdlib.py
@@ -17,6 +17,7 @@ from astroid import exceptions
 from astroid import nodes
 from astroid.builder import AstroidBuilder
 from astroid import util
+from astroid import test_utils
 
 PY3K = sys.version_info > (3, 0)
 PY33 = sys.version_info >= (3, 3)
@@ -79,6 +80,10 @@ def infer_func_form(node, base_type, context=None, enum=False):
                     raise AttributeError
     except (AttributeError, exceptions.InferenceError):
         raise UseInferenceDefault()
+
+    # If we can't iner the name of the class, don't crash, up to this point
+    # we know it is a namedtuple anyway.
+    name = name or 'Uninferable'
     # we want to return a Class node instance with proper attributes set
     class_node = nodes.ClassDef(name, 'docstring')
     class_node.parent = node.parent
@@ -311,10 +316,18 @@ class %(name)s(tuple):
 
 def infer_enum(node, context=None):
     """ Specific inference function for enum Call node. """
-    enum_meta = nodes.ClassDef("EnumMeta", 'docstring')
+    enum_meta = test_utils.extract_node('''
+    class EnumMeta(object):
+        'docstring'
+        def __call__(self, node):
+            class EnumAttribute(object):
+                name = ''
+                value = 0
+            return EnumAttribute()
+    ''')
     class_node = infer_func_form(node, enum_meta,
                                  context=context, enum=True)[0]
-    return iter([class_node])
+    return iter([class_node.instantiate_class()])
 
 
 def infer_enum_class(node):
diff --git a/astroid/tests/unittest_brain.py b/astroid/tests/unittest_brain.py
index 57d77ba..8710238 100644
--- a/astroid/tests/unittest_brain.py
+++ b/astroid/tests/unittest_brain.py
@@ -450,12 +450,14 @@ class EnumBrainTest(unittest.TestCase):
         from enum import Enum
         f = Enum('Audience', ['a', 'b', 'c'])
         f #@
-        f() #@
+        f(1) #@
         ''')
         inferred_cls = next(cls.infer())
-        self.assertIsInstance(inferred_cls, nodes.ClassDef)
+        self.assertIsInstance(inferred_cls, bases.Instance)
         inferred_instance = next(instance.infer())
         self.assertIsInstance(inferred_instance, bases.Instance)
+        self.assertIsInstance(next(inferred_instance.igetattr('name')), nodes.Const)
+        self.assertIsInstance(next(inferred_instance.igetattr('value')), nodes.Const)
 
 
 @unittest.skipUnless(HAS_DATEUTIL, "This test requires the dateutil library.")
diff --git a/astroid/tests/unittest_regrtest.py b/astroid/tests/unittest_regrtest.py
index 608426b..6a0f762 100644
--- a/astroid/tests/unittest_regrtest.py
+++ b/astroid/tests/unittest_regrtest.py
@@ -328,6 +328,21 @@ def test():
         inferred = next(node.infer())
         self.assertEqual(inferred.decoratornames(), set())
 
+    def test_ssl_protocol(self):
+        node = extract_node('''
+        import ssl
+        ssl.PROTOCOL_TLSv1
+        ''')
+        inferred = next(node.infer())
+        self.assertIsInstance(inferred, nodes.Const)
+
+    def test_uninferable_string_argument_of_namedtuple(self):
+        node = extract_node('''
+        import collections
+        collections.namedtuple('{}'.format("a"), '')()
+        ''')
+        next(node.infer())
+
 
 class Whatever(object):
     a = property(lambda x: x, lambda x: x)
diff --git a/setup.cfg b/setup.cfg
index caf8563..57e1352 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,7 +2,7 @@
 universal = 1
 
 [egg_info]
+tag_build = 
 tag_date = 0
 tag_svn_revision = 0
-tag_build = 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/astroid.git



More information about the Python-modules-commits mailing list