1
"""Fixer that changes 'a ,b' into 'a, b'.
3
This also changes '{a :b}' into '{a: b}', but does not touch other
4
uses of colons. It does not touch other uses of whitespace.
9
from ..pgen2 import token
10
from .. import fixer_base
12
class FixWsComma(fixer_base.BaseFix):
14
explicit = True # The user must ask for this fixers
17
any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]>
20
COMMA = pytree.Leaf(token.COMMA, u",")
21
COLON = pytree.Leaf(token.COLON, u":")
24
def transform(self, node, results):
27
for child in new.children:
28
if child in self.SEPS:
30
if prefix.isspace() and u"\n" not in prefix:
1
"""Fixer that changes 'a ,b' into 'a, b'.
3
This also changes '{a :b}' into '{a: b}', but does not touch other
4
uses of colons. It does not touch other uses of whitespace.
9
from ..pgen2 import token
10
from .. import fixer_base
12
class FixWsComma(fixer_base.BaseFix):
14
explicit = True # The user must ask for this fixers
17
any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]>
20
COMMA = pytree.Leaf(token.COMMA, u",")
21
COLON = pytree.Leaf(token.COLON, u":")
24
def transform(self, node, results):
27
for child in new.children:
28
if child in self.SEPS:
30
if prefix.isspace() and u"\n" not in prefix: