Skip to content

Commit

Permalink
refactor: upgrade black version to 20.8b1
Browse files Browse the repository at this point in the history
update docstrings to be compatible with PEP-257 and black's new
conventions
  • Loading branch information
jnoortheen committed Nov 25, 2020
1 parent 7fe7242 commit b2f8dd4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
20 changes: 11 additions & 9 deletions xonsh/parsers/v36.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def __init__(
yacc_debug=False,
outputdir=None,
):
"""Parameters
"""
Parameters
----------
lexer_optimize : bool, optional
Set to false when unstable and true when lexer is stable.
Expand Down Expand Up @@ -45,9 +46,10 @@ def __init__(
)

def p_classdef_or_funcdef(self, p):
"""classdef_or_funcdef : classdef
| funcdef
| async_funcdef
"""
classdef_or_funcdef : classdef
| funcdef
| async_funcdef
"""
p[0] = p[1]

Expand Down Expand Up @@ -79,9 +81,10 @@ def p_atom_expr_await(self, p):
p[0] = p0

def p_async_stmt(self, p):
"""async_stmt : async_funcdef
| async_with_stmt
| async_for_stmt
"""
async_stmt : async_funcdef
| async_with_stmt
| async_for_stmt
"""
p[0] = p[1]

Expand All @@ -108,8 +111,7 @@ def p_arglist_single(self, p):
p[0] = p0

def p_arglist_many(self, p):
"""arglist : argument comma_argument_list comma_opt
"""
"""arglist : argument comma_argument_list comma_opt"""
p0 = {"args": [], "keywords": []}
self._set_arg(p0, p[1])
for arg in p[2]:
Expand Down
40 changes: 24 additions & 16 deletions xonsh/parsers/v38.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,9 @@ def p_typedargslist_t11(self, p):
p[0] = p0

def p_typedargslist_t12(self, p):
"""typedargslist : posonlyargslist comma_opt
| posonlyargslist COMMA typedargslist
"""
typedargslist : posonlyargslist comma_opt
| posonlyargslist COMMA typedargslist
"""
if len(p) == 4:
p0 = p[3]
Expand All @@ -256,8 +257,9 @@ def p_typedargslist_t12(self, p):
p[0] = p0

def p_posonlyargslist(self, p):
"""posonlyargslist : tfpdef equals_test_opt COMMA DIVIDE
| tfpdef equals_test_opt comma_tfpdef_list COMMA DIVIDE"""
"""
posonlyargslist : tfpdef equals_test_opt COMMA DIVIDE
| tfpdef equals_test_opt comma_tfpdef_list COMMA DIVIDE"""
p0 = ast.arguments(
posonlyargs=[],
args=[],
Expand Down Expand Up @@ -392,8 +394,9 @@ def p_varargslist_v11(self, p):
p[0] = p0

def p_varargslist_t12(self, p):
"""varargslist : posonlyvarargslist comma_opt
| posonlyvarargslist COMMA varargslist
"""
varargslist : posonlyvarargslist comma_opt
| posonlyvarargslist COMMA varargslist
"""
if len(p) == 4:
p0 = p[3]
Expand All @@ -406,8 +409,9 @@ def p_varargslist_t12(self, p):
p[0] = p0

def p_posonlyvarargslist(self, p):
"""posonlyvarargslist : vfpdef equals_test_opt COMMA DIVIDE
| vfpdef equals_test_opt comma_vfpdef_list COMMA DIVIDE"""
"""
posonlyvarargslist : vfpdef equals_test_opt COMMA DIVIDE
| vfpdef equals_test_opt comma_vfpdef_list COMMA DIVIDE"""
p0 = ast.arguments(
posonlyargs=[],
args=[],
Expand Down Expand Up @@ -462,8 +466,9 @@ def p_argument_colonequal(self, p):
)

def p_namedexpr_test(self, p):
"""namedexpr_test : test
| test COLONEQUAL test
"""
namedexpr_test : test
| test COLONEQUAL test
"""
if len(p) == 2:
p[0] = p[1]
Expand All @@ -475,8 +480,9 @@ def p_namedexpr_test(self, p):
)

def p_namedexpr_test_or_star_expr(self, p):
"""namedexpr_test_or_star_expr : namedexpr_test
| star_expr
"""
namedexpr_test_or_star_expr : namedexpr_test
| star_expr
"""
p[0] = p[1]

Expand All @@ -501,14 +507,16 @@ def p_elif_part(self, p):
super().p_elif_part(p)

def p_if_stmt(self, p):
"""if_stmt : if_tok namedexpr_test COLON suite elif_part_list_opt
| if_tok namedexpr_test COLON suite elif_part_list_opt else_part
"""
if_stmt : if_tok namedexpr_test COLON suite elif_part_list_opt
| if_tok namedexpr_test COLON suite elif_part_list_opt else_part
"""
super().p_if_stmt(p)

def p_while_stmt(self, p):
"""while_stmt : WHILE namedexpr_test COLON suite
| WHILE namedexpr_test COLON suite else_part
"""
while_stmt : WHILE namedexpr_test COLON suite
| WHILE namedexpr_test COLON suite else_part
"""
super().p_while_stmt(p)

Expand Down

0 comments on commit b2f8dd4

Please sign in to comment.