mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-17 18:06:02 +08:00
Fix an issue with brackets on weird lines.
This commit is contained in:
@@ -481,7 +481,10 @@ class PEP8Normalizer(Normalizer):
|
|||||||
# we can basically use the previous indentation.
|
# we can basically use the previous indentation.
|
||||||
previous_leaf = leaf
|
previous_leaf = leaf
|
||||||
n = self._indentation_tos
|
n = self._indentation_tos
|
||||||
while True:#not info.newline_count:
|
while True:
|
||||||
|
if hasattr(n, 'leaf') and previous_leaf.line != n.leaf.line:
|
||||||
|
break
|
||||||
|
|
||||||
previous_leaf = previous_leaf.get_previous_leaf()
|
previous_leaf = previous_leaf.get_previous_leaf()
|
||||||
if not isinstance(n, BracketNode) or previous_leaf != n.leaf:
|
if not isinstance(n, BracketNode) or previous_leaf != n.leaf:
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -196,7 +196,8 @@ d = { # comment
|
|||||||
1: 2
|
1: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
# issue 138
|
# issue 138 (we won't allow this in parso)
|
||||||
|
#: E126+2:9
|
||||||
[
|
[
|
||||||
12, # this is a multi-line inline
|
12, # this is a multi-line inline
|
||||||
# comment
|
# comment
|
||||||
@@ -253,15 +254,15 @@ if True:
|
|||||||
|
|
||||||
def example_issue254():
|
def example_issue254():
|
||||||
return [node.copy(
|
return [node.copy(
|
||||||
(
|
(
|
||||||
replacement
|
replacement
|
||||||
# First, look at all the node's current children.
|
# First, look at all the node's current children.
|
||||||
for child in node.children
|
for child in node.children
|
||||||
# Replace them.
|
# Replace them.
|
||||||
for replacement in replace(child)
|
for replacement in replace(child)
|
||||||
),
|
),
|
||||||
dict(name=token.undefined)
|
dict(name=token.undefined)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|
||||||
def valid_example():
|
def valid_example():
|
||||||
|
|||||||
Reference in New Issue
Block a user