Hello community, here is the log from the commit of package python3-mccabe for openSUSE:Factory checked in at 2016-08-09 22:15:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-mccabe (Old) and /work/SRC/openSUSE:Factory/.python3-mccabe.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-mccabe" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-mccabe/python3-mccabe.changes 2016-07-01 10:01:14.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python3-mccabe.new/python3-mccabe.changes 2016-08-09 22:15:12.000000000 +0200 @@ -1,0 +2,10 @@ +Sat Aug 6 15:52:23 UTC 2016 - [email protected] + +- update to version 0.5.2: + * When opening files ourselves, make sure we always name the file + variable + +- changes from version 0.5.1: + * Set default maximum complexity to -1 on the class itself + +------------------------------------------------------------------- Old: ---- mccabe-0.5.0.tar.gz New: ---- mccabe-0.5.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-mccabe.spec ++++++ --- /var/tmp/diff_new_pack.Odyga7/_old 2016-08-09 22:15:13.000000000 +0200 +++ /var/tmp/diff_new_pack.Odyga7/_new 2016-08-09 22:15:13.000000000 +0200 @@ -17,7 +17,7 @@ Name: python3-mccabe -Version: 0.5.0 +Version: 0.5.2 Release: 0 Summary: McCabe checker, plugin for flake8 License: MIT ++++++ mccabe-0.5.0.tar.gz -> mccabe-0.5.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.5.0/PKG-INFO new/mccabe-0.5.2/PKG-INFO --- old/mccabe-0.5.0/PKG-INFO 2016-05-30 22:56:05.000000000 +0200 +++ new/mccabe-0.5.2/PKG-INFO 2016-07-31 21:05:53.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: mccabe -Version: 0.5.0 +Version: 0.5.2 Summary: McCabe checker, plugin for flake8 Home-page: https://github.com/pycqa/mccabe Author: Ian Cordasco @@ -73,6 +73,16 @@ Changes ------- + 0.5.2 - 2016-07-31 + `````````````````` + + * When opening files ourselves, make sure we always name the file variable + + 0.5.1 - 2016-07-28 + `````````````````` + + * Set default maximum complexity to -1 on the class itself + 0.5.0 - 2016-05-30 `````````````````` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.5.0/README.rst new/mccabe-0.5.2/README.rst --- old/mccabe-0.5.0/README.rst 2016-05-30 20:40:30.000000000 +0200 +++ new/mccabe-0.5.2/README.rst 2016-07-31 21:04:39.000000000 +0200 @@ -65,6 +65,16 @@ Changes ------- +0.5.2 - 2016-07-31 +`````````````````` + +* When opening files ourselves, make sure we always name the file variable + +0.5.1 - 2016-07-28 +`````````````````` + +* Set default maximum complexity to -1 on the class itself + 0.5.0 - 2016-05-30 `````````````````` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.5.0/mccabe.egg-info/PKG-INFO new/mccabe-0.5.2/mccabe.egg-info/PKG-INFO --- old/mccabe-0.5.0/mccabe.egg-info/PKG-INFO 2016-05-30 22:56:05.000000000 +0200 +++ new/mccabe-0.5.2/mccabe.egg-info/PKG-INFO 2016-07-31 21:05:53.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: mccabe -Version: 0.5.0 +Version: 0.5.2 Summary: McCabe checker, plugin for flake8 Home-page: https://github.com/pycqa/mccabe Author: Ian Cordasco @@ -73,6 +73,16 @@ Changes ------- + 0.5.2 - 2016-07-31 + `````````````````` + + * When opening files ourselves, make sure we always name the file variable + + 0.5.1 - 2016-07-28 + `````````````````` + + * Set default maximum complexity to -1 on the class itself + 0.5.0 - 2016-05-30 `````````````````` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.5.0/mccabe.py new/mccabe-0.5.2/mccabe.py --- old/mccabe-0.5.0/mccabe.py 2016-05-30 22:54:49.000000000 +0200 +++ new/mccabe-0.5.2/mccabe.py 2016-07-31 21:04:50.000000000 +0200 @@ -7,6 +7,8 @@ import optparse import sys +import tokenize + from collections import defaultdict try: import ast @@ -14,7 +16,7 @@ except ImportError: # Python 2.5 from flake8.util import ast, iter_child_nodes -__version__ = '0.5.0' +__version__ = '0.5.2' class ASTVisitor(object): @@ -227,7 +229,7 @@ version = __version__ _code = 'C901' _error_tmpl = "C901 %r is too complex (%d)" - max_complexity = 0 + max_complexity = -1 def __init__(self, tree, filename): self.tree = tree @@ -292,6 +294,23 @@ return get_code_complexity(code, threshold, filename=module_path) +def _read(filename): + if (2, 5) < sys.version_info < (3, 0): + with open(filename, 'rU') as f: + return f.read() + elif (3, 0) <= sys.version_info < (4, 0): + """Read the source code.""" + try: + with open(filename, 'rb') as f: + (encoding, _) = tokenize.detect_encoding(f.readline) + except (LookupError, SyntaxError, UnicodeError): + # Fall back if file encoding is improperly declared + with open(filename, encoding='latin-1') as f: + return f.read() + with open(filename, 'r', encoding=encoding) as f: + return f.read() + + def main(argv=None): if argv is None: argv = sys.argv[1:] @@ -304,8 +323,7 @@ options, args = opar.parse_args(argv) - with open(args[0], "rU") as mod: - code = mod.read() + code = _read(args[0]) tree = compile(code, args[0], "exec", ast.PyCF_ONLY_AST) visitor = PathGraphingAstVisitor() visitor.preorder(tree, visitor)
