Patchwork [1,of,2] byteify-strings: add space in special comments to silence flake8 error

login
register
mail settings
Submitter Raphaël Gomès
Date Aug. 6, 2019, 12:56 p.m.
Message ID <a6acc71d557b3606a048.1565096173@alphare-carbon.lan>
Download mbox | patch
Permalink /patch/41168/
State Accepted
Headers show

Comments

Raphaël Gomès - Aug. 6, 2019, 12:56 p.m.
# HG changeset patch
# User Raphaël Gomès <rgomes@octobus.net>
# Date 1565095770 -7200
#      Tue Aug 06 14:49:30 2019 +0200
# Node ID a6acc71d557b3606a048dd95f26e0b6988682a9c
# Parent  2c32f0d1ae622cdbe10c92a763f6fbec711d7668
# EXP-Topic byteify-strings
byteify-strings: add space in special comments to silence flake8 error

This is done soon enough that nobody has had the time to use this feature yet.
Pulkit Goyal - Aug. 6, 2019, 1:27 p.m.
On Tue, Aug 6, 2019 at 3:59 PM Raphaël Gomès <raphael.gomes@octobus.net> wrote:
>
> # HG changeset patch
> # User Raphaël Gomès <rgomes@octobus.net>
> # Date 1565095770 -7200
> #      Tue Aug 06 14:49:30 2019 +0200
> # Node ID a6acc71d557b3606a048dd95f26e0b6988682a9c
> # Parent  2c32f0d1ae622cdbe10c92a763f6fbec711d7668
> # EXP-Topic byteify-strings
> byteify-strings: add space in special comments to silence flake8 error
>
> This is done soon enough that nobody has had the time to use this feature yet.

Queued the series, many thanks!

Patch

diff -r 2c32f0d1ae62 -r a6acc71d557b contrib/byteify-strings.py
--- a/contrib/byteify-strings.py	Thu Aug 01 03:15:58 2019 +0200
+++ b/contrib/byteify-strings.py	Tue Aug 06 14:49:30 2019 +0200
@@ -152,14 +152,14 @@ 
             if not insideignoreblock:
                 ignorenextline = (
                     tokens[i - 1].type == token.COMMENT
-                    and tokens[i - 1].string == "#no-py3-transform"
+                    and tokens[i - 1].string == "# no-py3-transform"
                 )
             continue
 
         if t.type == token.COMMENT:
-            if t.string == "#py3-transform: off":
+            if t.string == "# py3-transform: off":
                 insideignoreblock = True
-            if t.string == "#py3-transform: on":
+            if t.string == "# py3-transform: on":
                 insideignoreblock = False
 
         if ignorenextline or insideignoreblock:
diff -r 2c32f0d1ae62 -r a6acc71d557b tests/test-byteify-strings.t
--- a/tests/test-byteify-strings.t	Thu Aug 01 03:15:58 2019 +0200
+++ b/tests/test-byteify-strings.t	Tue Aug 06 14:49:30 2019 +0200
@@ -152,33 +152,33 @@ 
 Test ignore comments
 
   $ cat > testfile.py <<EOF
-  > #py3-transform: off
+  > # py3-transform: off
   > "none"
   > "of"
   > 'these'
   > s = """should"""
   > d = '''be'''
-  > #py3-transform: on
+  > # py3-transform: on
   > "this should"
   > 'and this also'
   > 
-  > #no-py3-transform
+  > # no-py3-transform
   > l = "this should be ignored"
   > l2 = "this shouldn't"
   > 
   > EOF
   $ byteify_strings testfile.py
-  #py3-transform: off
+  # py3-transform: off
   "none"
   "of"
   'these'
   s = """should"""
   d = '''be'''
-  #py3-transform: on
+  # py3-transform: on
   b"this should"
   b'and this also'
   
-  #no-py3-transform
+  # no-py3-transform
   l = "this should be ignored"
   l2 = b"this shouldn't"