Hello community,

here is the log from the commit of package python-flake8-pep3101 for 
openSUSE:Leap:15.2 checked in at 2020-04-20 12:55:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-flake8-pep3101 (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.python-flake8-pep3101.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-flake8-pep3101"

Mon Apr 20 12:55:23 2020 rev:2 rq:795482 version:1.3.0

Changes:
--------
--- 
/work/SRC/openSUSE:Leap:15.2/python-flake8-pep3101/python-flake8-pep3101.changes
    2020-02-22 18:49:29.208366626 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2/.python-flake8-pep3101.new.2738/python-flake8-pep3101.changes
  2020-04-20 12:55:41.660747846 +0200
@@ -1,0 +2,6 @@
+Thu Apr 16 10:40:00 UTC 2020 - Tomáš Chvátal <[email protected]>
+
+- Update to 1.3.0:
+  * Warn about "string %i" % 33 which was previously ignored.
+
+-------------------------------------------------------------------

Old:
----
  flake8-pep3101-1.2.1.tar.gz

New:
----
  flake8-pep3101-1.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-flake8-pep3101.spec ++++++
--- /var/tmp/diff_new_pack.ro7t7i/_old  2020-04-20 12:55:41.972748335 +0200
+++ /var/tmp/diff_new_pack.ro7t7i/_new  2020-04-20 12:55:41.972748335 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-flake8-pep3101
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-flake8-pep3101
-Version:        1.2.1
+Version:        1.3.0
 Release:        0
 Summary:        Checks for old string formatting
 License:        GPL-2.0-only
@@ -51,7 +51,7 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
-%python_exec setup.py test
+%pytest run_tests.py
 
 %files %{python_files}
 %doc CHANGES.rst README.rst

++++++ flake8-pep3101-1.2.1.tar.gz -> flake8-pep3101-1.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-pep3101-1.2.1/CHANGES.rst 
new/flake8-pep3101-1.3.0/CHANGES.rst
--- old/flake8-pep3101-1.2.1/CHANGES.rst        2018-04-05 15:11:33.000000000 
+0200
+++ new/flake8-pep3101-1.3.0/CHANGES.rst        2019-12-15 00:32:11.000000000 
+0100
@@ -3,6 +3,14 @@
 Changelog
 =========
 
+1.3.0 (2019-12-15)
+------------------
+
+- Warn about `"string %i" % 33` which was previously ignored.
+  Reported by @unformatt.
+  [gforcada]
+
+
 1.2.1 (2018-04-05)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-pep3101-1.2.1/PKG-INFO 
new/flake8-pep3101-1.3.0/PKG-INFO
--- old/flake8-pep3101-1.2.1/PKG-INFO   2018-04-05 15:11:34.000000000 +0200
+++ new/flake8-pep3101-1.3.0/PKG-INFO   2019-12-15 00:32:11.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: flake8-pep3101
-Version: 1.2.1
+Version: 1.3.0
 Summary: Checks for old string formatting.
 Home-page: https://github.com/gforcada/flake8-pep3101
 Author: Gil Forcada
@@ -58,6 +58,14 @@
         Changelog
         =========
         
+        1.3.0 (2019-12-15)
+        ------------------
+        
+        - Warn about `"string %i" % 33` which was previously ignored.
+          Reported by @unformatt.
+          [gforcada]
+        
+        
         1.2.1 (2018-04-05)
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/flake8-pep3101-1.2.1/flake8_pep3101.egg-info/PKG-INFO 
new/flake8-pep3101-1.3.0/flake8_pep3101.egg-info/PKG-INFO
--- old/flake8-pep3101-1.2.1/flake8_pep3101.egg-info/PKG-INFO   2018-04-05 
15:11:34.000000000 +0200
+++ new/flake8-pep3101-1.3.0/flake8_pep3101.egg-info/PKG-INFO   2019-12-15 
00:32:11.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: flake8-pep3101
-Version: 1.2.1
+Version: 1.3.0
 Summary: Checks for old string formatting.
 Home-page: https://github.com/gforcada/flake8-pep3101
 Author: Gil Forcada
@@ -58,6 +58,14 @@
         Changelog
         =========
         
+        1.3.0 (2019-12-15)
+        ------------------
+        
+        - Warn about `"string %i" % 33` which was previously ignored.
+          Reported by @unformatt.
+          [gforcada]
+        
+        
         1.2.1 (2018-04-05)
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-pep3101-1.2.1/flake8_pep3101.py 
new/flake8-pep3101-1.3.0/flake8_pep3101.py
--- old/flake8-pep3101-1.2.1/flake8_pep3101.py  2018-04-05 15:11:33.000000000 
+0200
+++ new/flake8-pep3101-1.3.0/flake8_pep3101.py  2019-12-15 00:32:11.000000000 
+0100
@@ -24,10 +24,10 @@
                 tree = ast.parse(f.read())
 
         for stmt in ast.walk(tree):
-            if isinstance(stmt, ast.BinOp) and \
-                    isinstance(stmt.op, ast.Mod):
-                if isinstance(stmt.left, ast.Num) or \
-                        isinstance(stmt.right, ast.Num):
+            if self._is_module_operation(stmt):
+                if self._is_left_hand_number(stmt):
+                    continue
+                if self._is_modulo_variable_and_number(stmt):
                     continue
 
                 if isinstance(stmt.left, (ast.Str, ast.Name)):
@@ -37,3 +37,18 @@
                         self.message,
                         type(self),
                     )
+
+    @staticmethod
+    def _is_module_operation(stmt):
+        return isinstance(stmt, ast.BinOp) and isinstance(stmt.op, ast.Mod)
+
+    @staticmethod
+    def _is_left_hand_number(stmt):
+        """Check if it is a case of `44 % SOMETHING`."""
+        return isinstance(stmt.left, ast.Num)
+
+    @staticmethod
+    def _is_modulo_variable_and_number(stmt):
+        """Check if it is a case of `var % 44`."""
+        return isinstance(stmt.right, ast.Num) and \
+            isinstance(stmt.left, ast.Name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-pep3101-1.2.1/run_tests.py 
new/flake8-pep3101-1.3.0/run_tests.py
--- old/flake8-pep3101-1.2.1/run_tests.py       2018-04-05 15:11:33.000000000 
+0200
+++ new/flake8-pep3101-1.3.0/run_tests.py       2019-12-15 00:32:11.000000000 
+0100
@@ -185,6 +185,19 @@
         ret = list(checker.run())
         self.assertEqual(len(ret), 0)
 
+    def test_right_hand_string_left_hand_number(self):
+        file_path = self._given_a_file_in_test_dir('\n'.join([
+            'print("asd %s" % 1)',
+        ]))
+        checker = Flake8Pep3101(None, file_path)
+        ret = list(checker.run())
+        self.assertEqual(len(ret), 1)
 
-if __name__ == '__main__':
-    unittest.main()
+    def test_right_hand_string_left_hand_variable(self):
+        file_path = self._given_a_file_in_test_dir('\n'.join([
+            'a = 44',
+            'print("asd %s" % a)',
+        ]))
+        checker = Flake8Pep3101(None, file_path)
+        ret = list(checker.run())
+        self.assertEqual(len(ret), 1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-pep3101-1.2.1/setup.py 
new/flake8-pep3101-1.3.0/setup.py
--- old/flake8-pep3101-1.2.1/setup.py   2018-04-05 15:11:33.000000000 +0200
+++ new/flake8-pep3101-1.3.0/setup.py   2019-12-15 00:32:11.000000000 +0100
@@ -11,7 +11,7 @@
 
 setup(
     name='flake8-pep3101',
-    version='1.2.1',
+    version='1.3.0',
     description=short_description,
     long_description=long_description,
     # Get more from http://pypi.python.org/pypi?%3Aaction=list_classifiers


Reply via email to