mirror of
https://github.com/davidhalter/parso.git
synced 2026-08-12 19:11:34 +08:00
Fix another small decorator issues.
This commit is contained in:
@@ -299,8 +299,14 @@ class PEP8Normalizer(Normalizer):
|
|||||||
) and actual_leaf.parent.parent.type != 'decorated'
|
) and actual_leaf.parent.parent.type != 'decorated'
|
||||||
)
|
)
|
||||||
if needs_lines and actual < wanted:
|
if needs_lines and actual < wanted:
|
||||||
# The first leaf should not be added.
|
func_or_cls = actual_leaf.parent
|
||||||
if self._actual_previous_leaf is not None:
|
suite = func_or_cls.parent
|
||||||
|
if suite.type == 'decorated':
|
||||||
|
suite = suite.parent
|
||||||
|
|
||||||
|
# The first leaf of a file or a suite should not need blank
|
||||||
|
# lines.
|
||||||
|
if suite.children[int(suite.type == 'suite')] != func_or_cls:
|
||||||
code = 302 if wanted == 2 else 301
|
code = 302 if wanted == 2 else 301
|
||||||
message = "expected %s blank line, found %s" \
|
message = "expected %s blank line, found %s" \
|
||||||
% (wanted, actual)
|
% (wanted, actual)
|
||||||
|
|||||||
Reference in New Issue
Block a user