generated from jCloud/repository-template
style: ensure trailing commas in multi-line statements
This commit is contained in:
30 files changed
+1778
-1774
No files matched your search
@@ -26,7 +26,7 @@ __all__ = [
|
||||
'PythonDefinition',
|
||||
'PythonFunctionDefinition',
|
||||
'PythonAsyncFunctionDefinition',
|
||||
'PythonClassDefinition'
|
||||
'PythonClassDefinition',
|
||||
]
|
||||
|
||||
def _python_docstring(doc: Union[str, None]) -> Union[PythonDocstring, None]:
|
||||
@@ -63,12 +63,12 @@ class PythonDefinition:
|
||||
self,
|
||||
name: str,
|
||||
doc: Union[PythonDocstring, None],
|
||||
decorators: list[str]
|
||||
decorators: list[str],
|
||||
) -> None:
|
||||
if keyword.iskeyword(name) or not name.isidentifier() or not name:
|
||||
raise InvalidPythonIdentifierError(
|
||||
'invalid identifier',
|
||||
identifier = name
|
||||
identifier = name,
|
||||
)
|
||||
|
||||
assert_that_is_instance(doc, (PythonDocstring, types.NoneType))
|
||||
@@ -81,7 +81,7 @@ class PythonDefinition:
|
||||
return (
|
||||
self.name,
|
||||
self.doc,
|
||||
self.decorators
|
||||
self.decorators,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
@@ -99,7 +99,7 @@ class PythonDefinition:
|
||||
return cls(
|
||||
node.name,
|
||||
_python_docstring(ast.get_docstring(node)),
|
||||
[ast.unparse(d) for d in node.decorator_list]
|
||||
[ast.unparse(d) for d in node.decorator_list],
|
||||
)
|
||||
|
||||
def __eq__(self, value: object) -> bool:
|
||||
@@ -133,7 +133,7 @@ class PythonFunctionDefinition(PythonDefinition):
|
||||
args: list[PythonFunctionArgument],
|
||||
returns: Union[str, None],
|
||||
doc: Union[PythonDocstring, None],
|
||||
decorators: list[str]
|
||||
decorators: list[str],
|
||||
) -> None:
|
||||
super().__init__(name, doc, decorators)
|
||||
self.args = args
|
||||
@@ -145,7 +145,7 @@ class PythonFunctionDefinition(PythonDefinition):
|
||||
self.args,
|
||||
self.returns,
|
||||
self.doc,
|
||||
self.decorators
|
||||
self.decorators,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@@ -162,7 +162,7 @@ class PythonFunctionDefinition(PythonDefinition):
|
||||
PythonASTArgumentsListParser(node.args).to_argument_list(),
|
||||
ast.unparse(node.returns) if node.returns is not None else None,
|
||||
_python_docstring(ast.get_docstring(node)),
|
||||
[ast.unparse(d) for d in node.decorator_list]
|
||||
[ast.unparse(d) for d in node.decorator_list],
|
||||
)
|
||||
|
||||
class PythonAsyncFunctionDefinition(PythonFunctionDefinition):
|
||||
@@ -210,7 +210,7 @@ class PythonClassDefinition(PythonDefinition):
|
||||
bases: list[str],
|
||||
doc: Union[PythonDocstring, None],
|
||||
decorators: list[str],
|
||||
body: list[PythonDefinition]
|
||||
body: list[PythonDefinition],
|
||||
) -> None:
|
||||
super().__init__(name, doc, decorators)
|
||||
self.bases = bases
|
||||
@@ -222,7 +222,7 @@ class PythonClassDefinition(PythonDefinition):
|
||||
self.bases,
|
||||
self.doc,
|
||||
self.decorators,
|
||||
self.body
|
||||
self.body,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@@ -253,5 +253,5 @@ class PythonClassDefinition(PythonDefinition):
|
||||
expr,
|
||||
(ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)
|
||||
)
|
||||
]
|
||||
],
|
||||
)
|
||||
Reference in new issue
Block a user