diff options
author | ptmcg <ptmcg@austin.rr.com> | 2021-09-08 17:35:16 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2021-09-08 17:35:16 -0500 |
commit | 6b51ff7faf0cb32170b415341725ddfc8d7b10c7 (patch) | |
tree | 26ca619ab9d098d30668cd784abfb258e526d44c | |
parent | d714f45d927a9712bbb93c8eb4f63b2fff7ad89a (diff) | |
download | pyparsing-git-6b51ff7faf0cb32170b415341725ddfc8d7b10c7.tar.gz |
The blackening
-rw-r--r-- | pyparsing/core.py | 4 | ||||
-rw-r--r-- | pyparsing/diagram/__init__.py | 4 | ||||
-rw-r--r-- | pyparsing/helpers.py | 9 | ||||
-rw-r--r-- | pyparsing/util.py | 8 |
4 files changed, 13 insertions, 12 deletions
diff --git a/pyparsing/core.py b/pyparsing/core.py index b9e63af..95fa18f 100644 --- a/pyparsing/core.py +++ b/pyparsing/core.py @@ -2606,9 +2606,7 @@ class Word(Token): self.mayIndexError = False self.asKeyword = asKeyword - if " " not in self.initChars | self.bodyChars and ( - min == 1 and exact == 0 - ): + if " " not in self.initChars | self.bodyChars and (min == 1 and exact == 0): if self.bodyChars == self.initChars: if max == 0: repeat = "+" diff --git a/pyparsing/diagram/__init__.py b/pyparsing/diagram/__init__.py index ce84e8e..7d1c2ef 100644 --- a/pyparsing/diagram/__init__.py +++ b/pyparsing/diagram/__init__.py @@ -466,7 +466,9 @@ def _to_diagram_element( # detect And's created with ``expr*N`` notation - for these use a OneOrMore with a repeat # (all will have the same name, and resultsName) if len(set((e.name, e.resultsName) for e in exprs)) == 1: - ret = EditablePartial.from_call(railroad.OneOrMore, item="", repeat=str(len(exprs))) + ret = EditablePartial.from_call( + railroad.OneOrMore, item="", repeat=str(len(exprs)) + ) elif _should_vertical(vertical, len(exprs)): ret = EditablePartial.from_call(railroad.Stack, items=[]) else: diff --git a/pyparsing/helpers.py b/pyparsing/helpers.py index 5988f3e..f203111 100644 --- a/pyparsing/helpers.py +++ b/pyparsing/helpers.py @@ -763,6 +763,7 @@ def infix_notation( def parseImpl(self, instring, loc, doActions=True): self.expr.try_parse(instring, loc) return loc, [] + _FB.__name__ = "FollowedBy>" ret = Forward() @@ -792,18 +793,14 @@ def infix_notation( thisExpr = Forward().set_name(term_name) if rightLeftAssoc is OpAssoc.LEFT: if arity == 1: - matchExpr = _FB(lastExpr + opExpr) + Group( - lastExpr + opExpr[1, ...] - ) + matchExpr = _FB(lastExpr + opExpr) + Group(lastExpr + opExpr[1, ...]) elif arity == 2: if opExpr is not None: matchExpr = _FB(lastExpr + opExpr + lastExpr) + Group( lastExpr + (opExpr + lastExpr)[1, ...] ) else: - matchExpr = _FB(lastExpr + lastExpr) + Group( - lastExpr[2, ...] - ) + matchExpr = _FB(lastExpr + lastExpr) + Group(lastExpr[2, ...]) elif arity == 3: matchExpr = _FB( lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr diff --git a/pyparsing/util.py b/pyparsing/util.py index 009c479..07d8dc7 100644 --- a/pyparsing/util.py +++ b/pyparsing/util.py @@ -206,12 +206,16 @@ def _collapseStringToRanges(s, re_escape=True): if len(s) > 3: for _, chars in itertools.groupby(s, key=is_consecutive): first = last = next(chars) - last = collections.deque(itertools.chain(iter([last]), chars), maxlen=1).pop() + last = collections.deque( + itertools.chain(iter([last]), chars), maxlen=1 + ).pop() if first == last: ret.append(escape_re_range_char(first)) else: ret.append( - "{}-{}".format(escape_re_range_char(first), escape_re_range_char(last)) + "{}-{}".format( + escape_re_range_char(first), escape_re_range_char(last) + ) ) else: ret = [escape_re_range_char(c) for c in s] |