generated from jCloud/repository-template
Add feature to get the signature representation of a Python function argument
This commit is contained in:
4 files changed
+86
-8
No files matched your search
@@ -60,4 +60,20 @@ class PythonAnnotationError(ValueError):
|
||||
else:
|
||||
return f'{self.args[0]}{": " if self.annotation and self.args[0] else ""}{self.annotation if self.args[0] else ""}'
|
||||
|
||||
class InvalidPythonAnnotationError(PythonAnnotationError): ...
|
||||
class InvalidPythonAnnotationError(PythonAnnotationError): ...
|
||||
|
||||
class PythonDefinitionError(ValueError):
|
||||
'''
|
||||
Base class for Python definition errors.
|
||||
'''
|
||||
def __init__(self, *args: object, definition: str = '') -> None:
|
||||
super().__init__(*args)
|
||||
self.definition = definition
|
||||
|
||||
def __str__(self):
|
||||
if not self.args:
|
||||
return ''
|
||||
else:
|
||||
return f'{self.args[0]}{": " if self.definition and self.args[0] else ""}{self.definition if self.args[0] else ""}'
|
||||
|
||||
class PythonArgumentStructureError(PythonDefinitionError): ...
|
||||
Reference in new issue
Block a user