Hello community,

here is the log from the commit of package python-flake8-quotes for 
openSUSE:Factory checked in at 2019-05-22 11:17:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flake8-quotes (Old)
 and      /work/SRC/openSUSE:Factory/.python-flake8-quotes.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-flake8-quotes"

Wed May 22 11:17:38 2019 rev:3 rq:704521 version:2.0.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-flake8-quotes/python-flake8-quotes.changes    
    2018-12-13 19:44:45.816987656 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-flake8-quotes.new.5148/python-flake8-quotes.changes
      2019-05-22 11:17:43.946461882 +0200
@@ -1,0 +2,9 @@
+Tue May 21 11:52:58 UTC 2019 - Marketa Calabkova <[email protected]>
+
+- Update to version 2.0.1
+  * We automatically encourage avoiding escaping quotes as per 
+    PEP 8. To disable this, use --no-avoid-escape (can be used 
+    in configuration file via avoid-escape).
+  * Add note about warning.
+
+-------------------------------------------------------------------

Old:
----
  flake8-quotes-1.0.0.tar.gz

New:
----
  flake8-quotes-2.0.1.tar.gz

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

Other differences:
------------------
++++++ python-flake8-quotes.spec ++++++
--- /var/tmp/diff_new_pack.PeZIsr/_old  2019-05-22 11:17:44.778461626 +0200
+++ /var/tmp/diff_new_pack.PeZIsr/_new  2019-05-22 11:17:44.778461626 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-flake8-quotes
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 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,25 +17,24 @@
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
-# Tests require access to stdin
-%bcond_with     test
+%bcond_without  test
 Name:           python-flake8-quotes
-Version:        1.0.0
+Version:        2.0.1
 Release:        0
 Summary:        Flake8 lint for quotes
 License:        MIT
 Group:          Development/Languages/Python
-Url:            http://github.com/zheller/flake8-quotes/
+URL:            http://github.com/zheller/flake8-quotes/
 Source:         
https://files.pythonhosted.org/packages/source/f/flake8-quotes/flake8-quotes-%{version}.tar.gz
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
+Requires:       python-flake8 >= 3.3.0
+BuildArch:      noarch
 %if %{with test}
-BuildRequires:  %{python_module flake8}
+BuildRequires:  %{python_module flake8 >= 3.3.0}
+BuildRequires:  %{python_module pytest}
 %endif
-Requires:       python-flake8
-BuildArch:      noarch
-
 %python_subpackages
 
 %description
@@ -53,11 +52,11 @@
 
 %if %{with test}
 %check
-%python_exec setup.py test
+# Tests require access to stdin
+%pytest -s -k "not test_stdin" test
 %endif
 
 %files %{python_files}
-%defattr(-,root,root,-)
 %doc README.rst
 %license LICENSE
 %{python_sitelib}/*

++++++ flake8-quotes-1.0.0.tar.gz -> flake8-quotes-2.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/PKG-INFO 
new/flake8-quotes-2.0.1/PKG-INFO
--- old/flake8-quotes-1.0.0/PKG-INFO    2018-04-08 22:31:39.000000000 +0200
+++ new/flake8-quotes-2.0.1/PKG-INFO    2019-04-24 09:49:37.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: flake8-quotes
-Version: 1.0.0
+Version: 2.0.1
 Summary: Flake8 lint for quotes.
 Home-page: http://github.com/zheller/flake8-quotes/
 Author: Zachary Wright Heller
@@ -13,6 +13,10 @@
            :target: https://travis-ci.org/zheller/flake8-quotes
            :alt: Build Status
         
+        Major update in 2.0.0
+        ---------------------
+        We automatically encourage avoiding escaping quotes as per `PEP 8 
<https://www.python.org/dev/peps/pep-0008/#string-quotes>`_. To disable this, 
use ``--no-avoid-escape`` (can be used in configuration file via 
``avoid-escape``).
+        
         Deprecation notice in 0.3.0
         ---------------------------
         To anticipate multiline support, we are renaming ``--quotes`` to 
``--inline-quotes``. Please adjust your configurations appropriately.
@@ -29,6 +33,17 @@
         Now you don't need to worry about people like @sectioneight constantly
         complaining that you are using double-quotes and not single-quotes.
         
+        Warnings
+        --------
+        
+        This package adds one flake8 warning ```Q0```.
+        You might want to enable this warning inside `flake8` configuration 
file.
+        Typically that will be `.flake8` inside the root folder of your 
project.
+        
+        .. code:: ini
+        
+            select = Q0
+        
         Configuration
         -------------
         
@@ -49,6 +64,8 @@
             # flake8 --inline-quotes '"' --docstring-quotes "'"
             # flake8 --inline-quotes '"' --docstring-quotes "'''"
         
+            # We also support disabling escaping quotes
+            # flake8 --no-avoid-escape
         
         or configuration option in `tox.ini`/`setup.cfg`.
         
@@ -66,6 +83,9 @@
             # We also support docstring quotes similarly
             # docstring-quotes = '
             # docstring-quotes = '''
+            #
+            # We also support disabling escaping quotes
+            # avoid-escape = False
         
         Caveats
         -------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/README.rst 
new/flake8-quotes-2.0.1/README.rst
--- old/flake8-quotes-1.0.0/README.rst  2018-04-08 22:29:39.000000000 +0200
+++ new/flake8-quotes-2.0.1/README.rst  2019-04-17 01:48:28.000000000 +0200
@@ -5,6 +5,10 @@
    :target: https://travis-ci.org/zheller/flake8-quotes
    :alt: Build Status
 
+Major update in 2.0.0
+---------------------
+We automatically encourage avoiding escaping quotes as per `PEP 8 
<https://www.python.org/dev/peps/pep-0008/#string-quotes>`_. To disable this, 
use ``--no-avoid-escape`` (can be used in configuration file via 
``avoid-escape``).
+
 Deprecation notice in 0.3.0
 ---------------------------
 To anticipate multiline support, we are renaming ``--quotes`` to 
``--inline-quotes``. Please adjust your configurations appropriately.
@@ -21,6 +25,17 @@
 Now you don't need to worry about people like @sectioneight constantly
 complaining that you are using double-quotes and not single-quotes.
 
+Warnings
+--------
+
+This package adds one flake8 warning ```Q0```.
+You might want to enable this warning inside `flake8` configuration file.
+Typically that will be `.flake8` inside the root folder of your project.
+
+.. code:: ini
+
+    select = Q0
+
 Configuration
 -------------
 
@@ -41,6 +56,8 @@
     # flake8 --inline-quotes '"' --docstring-quotes "'"
     # flake8 --inline-quotes '"' --docstring-quotes "'''"
 
+    # We also support disabling escaping quotes
+    # flake8 --no-avoid-escape
 
 or configuration option in `tox.ini`/`setup.cfg`.
 
@@ -58,6 +75,9 @@
     # We also support docstring quotes similarly
     # docstring-quotes = '
     # docstring-quotes = '''
+    #
+    # We also support disabling escaping quotes
+    # avoid-escape = False
 
 Caveats
 -------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/flake8_quotes/__about__.py 
new/flake8-quotes-2.0.1/flake8_quotes/__about__.py
--- old/flake8-quotes-1.0.0/flake8_quotes/__about__.py  2018-04-08 
22:31:22.000000000 +0200
+++ new/flake8-quotes-2.0.1/flake8_quotes/__about__.py  2019-04-24 
09:49:26.000000000 +0200
@@ -1 +1 @@
-__version__ = '1.0.0'
+__version__ = '2.0.1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/flake8_quotes/__init__.py 
new/flake8-quotes-2.0.1/flake8_quotes/__init__.py
--- old/flake8-quotes-1.0.0/flake8_quotes/__init__.py   2018-04-08 
22:30:48.000000000 +0200
+++ new/flake8-quotes-2.0.1/flake8_quotes/__init__.py   2019-04-24 
09:48:43.000000000 +0200
@@ -113,6 +113,12 @@
                           parse_from_config=True, type='choice',
                           choices=sorted(cls.DOCSTRING_QUOTES.keys()),
                           help='Quote to expect in all files (default: """)')
+        cls._register_opt(parser, '--avoid-escape', default=None, 
action='store_true',
+                          parse_from_config=True,
+                          help='Avoiding escaping same quotes in inline 
strings (enabled by default)')
+        cls._register_opt(parser, '--no-avoid-escape', dest='avoid_escape', 
default=None, action='store_false',
+                          parse_from_config=False,
+                          help='Disable avoiding escaping same quotes in 
inline strings')
 
     @classmethod
     def parse_options(cls, options):
@@ -145,6 +151,12 @@
         if hasattr(options, 'docstring_quotes') and options.docstring_quotes 
is not None:
             cls.config.update(cls.DOCSTRING_QUOTES[options.docstring_quotes])
 
+        # If avoid escaped specified, add to config
+        if hasattr(options, 'avoid_escape') and options.avoid_escape is not 
None:
+            cls.config.update({'avoid_escape': options.avoid_escape})
+        else:
+            cls.config.update({'avoid_escape': True})
+
     def get_file_contents(self):
         if self.filename in ('stdin', '-', None):
             return stdin_get_value().splitlines(True)
@@ -185,6 +197,7 @@
             #   `b"""foo"""` -> `"""foo"""`
             last_quote_char = token.string[-1]
             first_quote_index = token.string.index(last_quote_char)
+            prefix = token.string[:first_quote_index].lower()
             unprefixed_string = token.string[first_quote_index:]
 
             # Determine if our string is multiline-based
@@ -223,19 +236,38 @@
                 }
             # Otherwise (string is inline quote)
             else:
-                # If our string is a known good string, then ignore it
-                #   (')foo' -> good (continue)
-                #   "it(')s" -> good (continue)
-                #   (")foo" -> possibly bad
-                if self.config['good_single'] in unprefixed_string:
+                #   'This is a string'       -> Good
+                #   'This is a "string"'     -> Good
+                #   'This is a \"string\"'   -> Good
+                #   'This is a \'string\''   -> Bad (Q003)  Escaped inner 
quotes
+                #   '"This" is a \'string\'' -> Good        Changing outer 
quotes would not avoid escaping
+                #   "This is a string"       -> Bad (Q000)
+                #   "This is a 'string'"     -> Good        Avoids escaped 
inner quotes
+                #   "This is a \"string\""   -> Bad (Q000)
+                #   "\"This\" is a 'string'" -> Good
+                
+                string_contents = unprefixed_string[1:-1]
+                
+                # If string preferred type, check for escapes
+                if last_quote_char == self.config['good_single']:
+                    if not self.config['avoid_escape'] or 'r' in prefix:
+                        continue
+                    if self.config['good_single'] in string_contents and not 
self.config['bad_single'] in string_contents:
+                        yield {
+                            'message': 'Q003 Change outer quotes to avoid 
escaping inner quotes',
+                            'line': start_row,
+                            'col': start_col,
+                        }
                     continue
-
-                # Output our error
-                yield {
-                    'message': 'Q000 Remove bad quotes',
-                    'line': start_row,
-                    'col': start_col,
-                }
+                
+                # If not preferred type, only allow use to avoid escapes.
+                if not self.config['good_single'] in string_contents:
+                    yield {
+                        'message': 'Q000 Remove bad quotes',
+                        'line': start_row,
+                        'col': start_col,
+                    }
+        
 
 
 class Token:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/flake8_quotes.egg-info/PKG-INFO 
new/flake8-quotes-2.0.1/flake8_quotes.egg-info/PKG-INFO
--- old/flake8-quotes-1.0.0/flake8_quotes.egg-info/PKG-INFO     2018-04-08 
22:31:39.000000000 +0200
+++ new/flake8-quotes-2.0.1/flake8_quotes.egg-info/PKG-INFO     2019-04-24 
09:49:37.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: flake8-quotes
-Version: 1.0.0
+Version: 2.0.1
 Summary: Flake8 lint for quotes.
 Home-page: http://github.com/zheller/flake8-quotes/
 Author: Zachary Wright Heller
@@ -13,6 +13,10 @@
            :target: https://travis-ci.org/zheller/flake8-quotes
            :alt: Build Status
         
+        Major update in 2.0.0
+        ---------------------
+        We automatically encourage avoiding escaping quotes as per `PEP 8 
<https://www.python.org/dev/peps/pep-0008/#string-quotes>`_. To disable this, 
use ``--no-avoid-escape`` (can be used in configuration file via 
``avoid-escape``).
+        
         Deprecation notice in 0.3.0
         ---------------------------
         To anticipate multiline support, we are renaming ``--quotes`` to 
``--inline-quotes``. Please adjust your configurations appropriately.
@@ -29,6 +33,17 @@
         Now you don't need to worry about people like @sectioneight constantly
         complaining that you are using double-quotes and not single-quotes.
         
+        Warnings
+        --------
+        
+        This package adds one flake8 warning ```Q0```.
+        You might want to enable this warning inside `flake8` configuration 
file.
+        Typically that will be `.flake8` inside the root folder of your 
project.
+        
+        .. code:: ini
+        
+            select = Q0
+        
         Configuration
         -------------
         
@@ -49,6 +64,8 @@
             # flake8 --inline-quotes '"' --docstring-quotes "'"
             # flake8 --inline-quotes '"' --docstring-quotes "'''"
         
+            # We also support disabling escaping quotes
+            # flake8 --no-avoid-escape
         
         or configuration option in `tox.ini`/`setup.cfg`.
         
@@ -66,6 +83,9 @@
             # We also support docstring quotes similarly
             # docstring-quotes = '
             # docstring-quotes = '''
+            #
+            # We also support disabling escaping quotes
+            # avoid-escape = False
         
         Caveats
         -------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/flake8-quotes-1.0.0/flake8_quotes.egg-info/SOURCES.txt 
new/flake8-quotes-2.0.1/flake8_quotes.egg-info/SOURCES.txt
--- old/flake8-quotes-1.0.0/flake8_quotes.egg-info/SOURCES.txt  2018-04-08 
22:31:39.000000000 +0200
+++ new/flake8-quotes-2.0.1/flake8_quotes.egg-info/SOURCES.txt  2019-04-24 
09:49:37.000000000 +0200
@@ -10,7 +10,6 @@
 flake8_quotes.egg-info/SOURCES.txt
 flake8_quotes.egg-info/dependency_links.txt
 flake8_quotes.egg-info/entry_points.txt
-flake8_quotes.egg-info/pbr.json
 flake8_quotes.egg-info/requires.txt
 flake8_quotes.egg-info/top_level.txt
 flake8_quotes.egg-info/zip-safe
@@ -30,12 +29,14 @@
 test/data/docstring_singles_module_multiline.py
 test/data/docstring_singles_module_singleline.py
 test/data/doubles.py
+test/data/doubles_escaped.py
 test/data/doubles_multiline_string.py
 test/data/doubles_noqa.py
 test/data/doubles_wrapped.py
 test/data/multiline_string.py
 test/data/no_qa.py
 test/data/singles.py
+test/data/singles_escaped.py
 test/data/singles_multiline_string.py
 test/data/singles_noqa.py
 test/data/singles_wrapped.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/flake8_quotes.egg-info/pbr.json 
new/flake8-quotes-2.0.1/flake8_quotes.egg-info/pbr.json
--- old/flake8-quotes-1.0.0/flake8_quotes.egg-info/pbr.json     2018-04-08 
22:31:39.000000000 +0200
+++ new/flake8-quotes-2.0.1/flake8_quotes.egg-info/pbr.json     1970-01-01 
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-{"is_release": false, "git_version": "34b98e9"}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/setup.cfg 
new/flake8-quotes-2.0.1/setup.cfg
--- old/flake8-quotes-1.0.0/setup.cfg   2018-04-08 22:31:39.000000000 +0200
+++ new/flake8-quotes-2.0.1/setup.cfg   2019-04-24 09:49:37.000000000 +0200
@@ -5,5 +5,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/test/data/doubles_escaped.py 
new/flake8-quotes-2.0.1/test/data/doubles_escaped.py
--- old/flake8-quotes-1.0.0/test/data/doubles_escaped.py        1970-01-01 
01:00:00.000000000 +0100
+++ new/flake8-quotes-2.0.1/test/data/doubles_escaped.py        2019-04-24 
09:48:43.000000000 +0200
@@ -0,0 +1,6 @@
+this_should_raise_Q003 = 'This is a \'string\''
+this_is_fine = '"This" is a \'string\''
+this_is_fine = "This is a 'string'"
+this_is_fine = "\"This\" is a 'string'"
+this_is_fine = r'This is a \'string\''
+this_is_fine = br'This is a \'string\''
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/test/data/singles_escaped.py 
new/flake8-quotes-2.0.1/test/data/singles_escaped.py
--- old/flake8-quotes-1.0.0/test/data/singles_escaped.py        1970-01-01 
01:00:00.000000000 +0100
+++ new/flake8-quotes-2.0.1/test/data/singles_escaped.py        2019-04-24 
09:48:43.000000000 +0200
@@ -0,0 +1,6 @@
+this_should_raise_Q003 = "This is a \"string\""
+this_is_fine = "'This' is a \"string\""
+this_is_fine = 'This is a "string"'
+this_is_fine = '\'This\' is a "string"'
+this_is_fine = r"This is a \"string\""
+this_is_fine = br"This is a \"string\""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-quotes-1.0.0/test/test_checks.py 
new/flake8-quotes-2.0.1/test/test_checks.py
--- old/flake8-quotes-1.0.0/test/test_checks.py 2018-04-08 22:28:05.000000000 
+0200
+++ new/flake8-quotes-2.0.1/test/test_checks.py 2019-04-17 01:41:34.000000000 
+0200
@@ -30,8 +30,8 @@
 class DoublesTestChecks(TestCase):
     def setUp(self):
         class DoublesOptions():
-            inline_quotes = '\''
-            multiline_quotes = '\''
+            inline_quotes = "'"
+            multiline_quotes = "'"
         QuoteChecker.parse_options(DoublesOptions)
 
     def test_multiline_string(self):
@@ -56,6 +56,21 @@
         checker = QuoteChecker(None, get_absolute_path('data/doubles_noqa.py'))
         self.assertEqual(list(checker.run()), [])
 
+    def test_escapes(self):
+        doubles_checker = QuoteChecker(None, 
filename=get_absolute_path('data/doubles_escaped.py'))
+        
self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())),
 [
+            {'col': 25, 'line': 1, 'message': 'Q003 Change outer quotes to 
avoid escaping inner quotes'},
+        ])
+
+    def test_escapes_allowed(self):
+        class Options():
+            inline_quotes = "'"
+            avoid_escape = False
+        QuoteChecker.parse_options(Options)
+
+        doubles_checker = QuoteChecker(None, 
filename=get_absolute_path('data/doubles_escaped.py'))
+        
self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())),
 [])
+
 
 class DoublesAliasTestChecks(TestCase):
     def setUp(self):
@@ -105,6 +120,21 @@
         checker = QuoteChecker(None, get_absolute_path('data/singles_noqa.py'))
         self.assertEqual(list(checker.run()), [])
 
+    def test_escapes(self):
+        singles_checker = QuoteChecker(None, 
filename=get_absolute_path('data/singles_escaped.py'))
+        
self.assertEqual(list(singles_checker.get_quotes_errors(singles_checker.get_file_contents())),
 [
+            {'col': 25, 'line': 1, 'message': 'Q003 Change outer quotes to 
avoid escaping inner quotes'},
+        ])
+
+    def test_escapes_allowed(self):
+        class Options():
+            inline_quotes = '"'
+            avoid_escape = False
+        QuoteChecker.parse_options(Options)
+
+        singles_checker = QuoteChecker(None, 
filename=get_absolute_path('data/singles_escaped.py'))
+        
self.assertEqual(list(singles_checker.get_quotes_errors(singles_checker.get_file_contents())),
 [])
+
 
 class SinglesAliasTestChecks(TestCase):
     def setUp(self):
@@ -128,7 +158,7 @@
 class MultilineTestChecks(TestCase):
     def test_singles(self):
         class Options():
-            inline_quotes = '\''
+            inline_quotes = "'"
             multiline_quotes = '"'
         QuoteChecker.parse_options(Options)
 
@@ -151,7 +181,7 @@
     def test_doubles(self):
         class Options():
             inline_quotes = '"'
-            multiline_quotes = '\''
+            multiline_quotes = "'"
         QuoteChecker.parse_options(Options)
 
         multiline_checker = QuoteChecker(None, 
filename=get_absolute_path('data/multiline_string.py'))


Reply via email to