mirror of
https://github.com/davidhalter/parso.git
synced 2026-05-19 23:10:16 +08:00
PEP 8
This commit is contained in:
@@ -6,7 +6,6 @@ from contextlib import contextmanager
|
|||||||
|
|
||||||
from parso.normalizer import Normalizer, NormalizerConfig, Issue, Rule
|
from parso.normalizer import Normalizer, NormalizerConfig, Issue, Rule
|
||||||
from parso.python.tree import search_ancestor
|
from parso.python.tree import search_ancestor
|
||||||
from parso.parser import ParserSyntaxError
|
|
||||||
|
|
||||||
_BLOCK_STMTS = ('if_stmt', 'while_stmt', 'for_stmt', 'try_stmt', 'with_stmt')
|
_BLOCK_STMTS = ('if_stmt', 'while_stmt', 'for_stmt', 'try_stmt', 'with_stmt')
|
||||||
_STAR_EXPR_PARENTS = ('testlist_star_expr', 'testlist_comp', 'exprlist')
|
_STAR_EXPR_PARENTS = ('testlist_star_expr', 'testlist_comp', 'exprlist')
|
||||||
@@ -107,6 +106,7 @@ def _iter_definition_exprs_from_lists(exprlist):
|
|||||||
|
|
||||||
yield child
|
yield child
|
||||||
|
|
||||||
|
|
||||||
def _get_expr_stmt_definition_exprs(expr_stmt):
|
def _get_expr_stmt_definition_exprs(expr_stmt):
|
||||||
exprs = []
|
exprs = []
|
||||||
for list_ in expr_stmt.children[:-2:2]:
|
for list_ in expr_stmt.children[:-2:2]:
|
||||||
@@ -279,7 +279,6 @@ class ErrorFinder(Normalizer):
|
|||||||
return ''
|
return ''
|
||||||
return super(ErrorFinder, self).visit(node)
|
return super(ErrorFinder, self).visit(node)
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def visit_node(self, node):
|
def visit_node(self, node):
|
||||||
self._check_type_rules(node)
|
self._check_type_rules(node)
|
||||||
@@ -787,7 +786,8 @@ class _ArglistRule(SyntaxRule):
|
|||||||
if first == '*':
|
if first == '*':
|
||||||
if kw_unpacking_only:
|
if kw_unpacking_only:
|
||||||
# foo(**kwargs, *args)
|
# foo(**kwargs, *args)
|
||||||
message = "iterable argument unpacking follows keyword argument unpacking"
|
message = "iterable argument unpacking " \
|
||||||
|
"follows keyword argument unpacking"
|
||||||
self.add_issue(argument, message=message)
|
self.add_issue(argument, message=message)
|
||||||
else:
|
else:
|
||||||
kw_unpacking_only = True
|
kw_unpacking_only = True
|
||||||
@@ -809,6 +809,7 @@ class _ArglistRule(SyntaxRule):
|
|||||||
message = "positional argument follows keyword argument"
|
message = "positional argument follows keyword argument"
|
||||||
self.add_issue(argument, message=message)
|
self.add_issue(argument, message=message)
|
||||||
|
|
||||||
|
|
||||||
@ErrorFinder.register_rule(type='parameters')
|
@ErrorFinder.register_rule(type='parameters')
|
||||||
@ErrorFinder.register_rule(type='lambdef')
|
@ErrorFinder.register_rule(type='lambdef')
|
||||||
class _ParameterRule(SyntaxRule):
|
class _ParameterRule(SyntaxRule):
|
||||||
|
|||||||
Reference in New Issue
Block a user