[Python-modules-commits] [python-mccabe] 01/04: Import python-mccabe_0.6.1.orig.tar.gz

Ondřej Nový onovy at moszumanska.debian.org
Tue Jun 20 08:39:44 UTC 2017


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

onovy pushed a commit to branch master
in repository python-mccabe.

commit 493d6ba542d1fe9b1174bf0df0cabc749b1c307b
Author: Ondřej Nový <onovy at debian.org>
Date:   Tue Feb 21 10:49:53 2017 +0100

    Import python-mccabe_0.6.1.orig.tar.gz
---
 PKG-INFO                 | 16 +++++++++++++++-
 README.rst               | 13 +++++++++++++
 mccabe.egg-info/PKG-INFO | 16 +++++++++++++++-
 mccabe.py                | 11 ++++++-----
 setup.cfg                |  1 -
 setup.py                 |  1 +
 test_mccabe.py           | 23 +++++++++++++++++++++++
 7 files changed, 73 insertions(+), 8 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index cfdfbaa..5845133 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: mccabe
-Version: 0.5.3
+Version: 0.6.1
 Summary: McCabe checker, plugin for flake8
 Home-page: https://github.com/pycqa/mccabe
 Author: Ian Cordasco
@@ -73,6 +73,19 @@ Description: McCabe complexity checker
         Changes
         -------
         
+        0.6.1 - 2017-01-26
+        ``````````````````
+        
+        * Fix signature for ``PathGraphingAstVisitor.default`` to match the signature
+          for ``ASTVisitor``
+        
+        0.6.0 - 2017-01-23
+        ``````````````````
+        
+        * Add support for Python 3.6
+        
+        * Fix handling for missing statement types
+        
         0.5.3 - 2016-12-14
         ``````````````````
         
@@ -158,5 +171,6 @@ Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Software Development :: Quality Assurance
diff --git a/README.rst b/README.rst
index 874b0eb..889f750 100644
--- a/README.rst
+++ b/README.rst
@@ -65,6 +65,19 @@ Links
 Changes
 -------
 
+0.6.1 - 2017-01-26
+``````````````````
+
+* Fix signature for ``PathGraphingAstVisitor.default`` to match the signature
+  for ``ASTVisitor``
+
+0.6.0 - 2017-01-23
+``````````````````
+
+* Add support for Python 3.6
+
+* Fix handling for missing statement types
+
 0.5.3 - 2016-12-14
 ``````````````````
 
diff --git a/mccabe.egg-info/PKG-INFO b/mccabe.egg-info/PKG-INFO
index cfdfbaa..5845133 100644
--- a/mccabe.egg-info/PKG-INFO
+++ b/mccabe.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: mccabe
-Version: 0.5.3
+Version: 0.6.1
 Summary: McCabe checker, plugin for flake8
 Home-page: https://github.com/pycqa/mccabe
 Author: Ian Cordasco
@@ -73,6 +73,19 @@ Description: McCabe complexity checker
         Changes
         -------
         
+        0.6.1 - 2017-01-26
+        ``````````````````
+        
+        * Fix signature for ``PathGraphingAstVisitor.default`` to match the signature
+          for ``ASTVisitor``
+        
+        0.6.0 - 2017-01-23
+        ``````````````````
+        
+        * Add support for Python 3.6
+        
+        * Fix handling for missing statement types
+        
         0.5.3 - 2016-12-14
         ``````````````````
         
@@ -158,5 +171,6 @@ Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Software Development :: Quality Assurance
diff --git a/mccabe.py b/mccabe.py
index 305fb94..c0cda75 100644
--- a/mccabe.py
+++ b/mccabe.py
@@ -16,7 +16,7 @@ try:
 except ImportError:   # Python 2.5
     from flake8.util import ast, iter_child_nodes
 
-__version__ = '0.5.3'
+__version__ = '0.6.1'
 
 
 class ASTVisitor(object):
@@ -160,10 +160,11 @@ class PathGraphingAstVisitor(ASTVisitor):
         name = "Stmt %d" % lineno
         self.appendPathNode(name)
 
-    visitAssert = visitAssign = visitAugAssign = visitDelete = visitPrint = \
-        visitRaise = visitYield = visitImport = visitCall = visitSubscript = \
-        visitPass = visitContinue = visitBreak = visitGlobal = visitReturn = \
-        visitAwait = visitSimpleStatement
+    def default(self, node, *args):
+        if isinstance(node, ast.stmt):
+            self.visitSimpleStatement(node)
+        else:
+            super(PathGraphingAstVisitor, self).default(node, *args)
 
     def visitLoop(self, node):
         name = "Loop %d" % node.lineno
diff --git a/setup.cfg b/setup.cfg
index 878645d..33b2a32 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -7,5 +7,4 @@ test = pytest
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff --git a/setup.py b/setup.py
index e59903d..c17065c 100644
--- a/setup.py
+++ b/setup.py
@@ -53,6 +53,7 @@ setup(
         'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
         'Topic :: Software Development :: Libraries :: Python Modules',
         'Topic :: Software Development :: Quality Assurance',
     ],
diff --git a/test_mccabe.py b/test_mccabe.py
index 44fb565..4cb6285 100644
--- a/test_mccabe.py
+++ b/test_mccabe.py
@@ -16,6 +16,12 @@ from mccabe import get_code_complexity
 trivial = 'def f(): pass'
 
 
+expr_as_statement = '''\
+def f():
+    """docstring"""
+'''
+
+
 sequential = """\
 def f(n):
     k = n + 4
@@ -99,6 +105,11 @@ async def foobar(a, b, c):
         pass
 """
 
+annotated_assign = """\
+def f():
+    x: Any = None
+"""
+
 
 def get_complexity_number(snippet, strio, max=0):
     """Get the complexity number from the printed string."""
@@ -176,6 +187,10 @@ class McCabeTestCase(unittest.TestCase):
         printed_message = self.strio.getvalue()
         self.assertEqual(printed_message, "")
 
+    def test_expr_as_statement(self):
+        complexity = get_complexity_number(expr_as_statement, self.strio)
+        self.assertEqual(complexity, 1)
+
     def test_try_else(self):
         self.assert_complexity(try_else, 4)
 
@@ -186,6 +201,14 @@ class McCabeTestCase(unittest.TestCase):
         complexity = get_complexity_number(async_keywords, self.strio)
         self.assertEqual(complexity, 3)
 
+    @pytest.mark.skipif(
+        sys.version_info < (3, 6),
+        reason="Annotated assignments are only valid on Python 3.6+",
+    )
+    def test_annotated_assignment(self):
+        complexity = get_complexity_number(annotated_assign, self.strio)
+        self.assertEqual(complexity, 1)
+
 
 class RegressionTests(unittest.TestCase):
     def setUp(self):

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



More information about the Python-modules-commits mailing list