forked from loafle/openapi-generator-original
python: several typing and style improvements (#16378)
* python: several typing and style improvements The generated (python) code fails with several standard validation tools, including `flake8`, `mypy`, and `autoflake`. While fixing every possible violation -- especially wrto typing -- woudl be a project, some of the changes are fairly easy. - The `autoflake` tool picks up on unused imports. These can just be removed. - The `mypy` tool picks up on numerious typing violations, especially if set to its strictest mode. As a starting point, all functions ought to annotate a return type, including constructors, even if the return type is `None` because otherwise the functions are omitted from type checking and it's impossible to make incremental progress towards adding types. - The `flake8` tool mostly finds whitespace and line-length issues; while line-length standards very, the source already includes several flake8 ignores, so it seems safe to add a few more. * Add generated files * Restore imports used by `AbstractPythonCodegen.java` * Update generated files
This commit is contained in:
committed by
GitHub
parent
c0abeceb85
commit
40731ed52d
@@ -20,7 +20,6 @@ import sys
|
||||
import urllib3
|
||||
|
||||
import http.client as httplib
|
||||
from openapi_client.exceptions import ApiValueError
|
||||
|
||||
JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
||||
'multipleOf', 'maximum', 'exclusiveMaximum',
|
||||
@@ -28,7 +27,7 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
||||
'minLength', 'pattern', 'maxItems', 'minItems'
|
||||
}
|
||||
|
||||
class Configuration(object):
|
||||
class Configuration:
|
||||
"""This class contains various settings of the API client.
|
||||
|
||||
:param host: Base url.
|
||||
@@ -50,7 +49,8 @@ class Configuration(object):
|
||||
configuration.
|
||||
:param server_operation_variables: Mapping from operation ID to a mapping with
|
||||
string values to replace variables in templated server configuration.
|
||||
The validation of enums is performed for variables with defined enum values before.
|
||||
The validation of enums is performed for variables with defined enum
|
||||
values before.
|
||||
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
||||
in PEM format.
|
||||
|
||||
@@ -65,7 +65,7 @@ class Configuration(object):
|
||||
server_index=None, server_variables=None,
|
||||
server_operation_index=None, server_operation_variables=None,
|
||||
ssl_ca_cert=None,
|
||||
):
|
||||
) -> None:
|
||||
"""Constructor
|
||||
"""
|
||||
self._base_path = "http://localhost:3000" if host is None else host
|
||||
|
||||
Reference in New Issue
Block a user