generator update

This commit is contained in:
Adam Uhlíř 2024-12-18 14:41:54 +01:00
parent 5961f6a7e1
commit 72dca69356
No known key found for this signature in database
GPG Key ID: 1D17A9E81F76155B
15 changed files with 283 additions and 103 deletions

View File

@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -24,15 +24,8 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install flake8 pytest pip install -r requirements.txt
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install -r test-requirements.txt
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest - name: Test with pytest
run: | run: |
pytest pytest --cov={{packageName}}

View File

@ -1 +1 @@
7.8.0 7.10.0

View File

@ -5,12 +5,12 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
- API version: 0.0.1 - API version: 0.0.1
- Package version: 0.0.1 - Package version: 0.0.1
- Generator version: 7.8.0 - Generator version: 7.10.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen - Build package: org.openapitools.codegen.languages.PythonClientCodegen
## Requirements. ## Requirements.
Python 3.7+ Python 3.8+
## Installation ## Installation

View File

@ -17,7 +17,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated from typing_extensions import Annotated
from pydantic import Field, StrictBytes, StrictStr from pydantic import Field, StrictBytes, StrictStr
from typing import Optional, Union from typing import Optional, Tuple, Union
from typing_extensions import Annotated from typing_extensions import Annotated
from codex_api_client.models.data_item import DataItem from codex_api_client.models.data_item import DataItem
from codex_api_client.models.data_list import DataList from codex_api_client.models.data_list import DataList
@ -262,7 +262,9 @@ class DataApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -526,7 +528,9 @@ class DataApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -790,7 +794,9 @@ class DataApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1054,7 +1060,9 @@ class DataApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1308,7 +1316,9 @@ class DataApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1551,7 +1561,9 @@ class DataApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1597,7 +1609,7 @@ class DataApi:
self, self,
content_type: Annotated[Optional[StrictStr], Field(description="The content type of the file. Must be valid.")] = None, content_type: Annotated[Optional[StrictStr], Field(description="The content type of the file. Must be valid.")] = None,
content_disposition: Annotated[Optional[StrictStr], Field(description="The content disposition used to send the filename.")] = None, content_disposition: Annotated[Optional[StrictStr], Field(description="The content disposition used to send the filename.")] = None,
body: Optional[Union[StrictBytes, StrictStr]] = None, body: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
_request_timeout: Union[ _request_timeout: Union[
None, None,
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)],
@ -1672,7 +1684,7 @@ class DataApi:
self, self,
content_type: Annotated[Optional[StrictStr], Field(description="The content type of the file. Must be valid.")] = None, content_type: Annotated[Optional[StrictStr], Field(description="The content type of the file. Must be valid.")] = None,
content_disposition: Annotated[Optional[StrictStr], Field(description="The content disposition used to send the filename.")] = None, content_disposition: Annotated[Optional[StrictStr], Field(description="The content disposition used to send the filename.")] = None,
body: Optional[Union[StrictBytes, StrictStr]] = None, body: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
_request_timeout: Union[ _request_timeout: Union[
None, None,
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)],
@ -1747,7 +1759,7 @@ class DataApi:
self, self,
content_type: Annotated[Optional[StrictStr], Field(description="The content type of the file. Must be valid.")] = None, content_type: Annotated[Optional[StrictStr], Field(description="The content type of the file. Must be valid.")] = None,
content_disposition: Annotated[Optional[StrictStr], Field(description="The content disposition used to send the filename.")] = None, content_disposition: Annotated[Optional[StrictStr], Field(description="The content disposition used to send the filename.")] = None,
body: Optional[Union[StrictBytes, StrictStr]] = None, body: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
_request_timeout: Union[ _request_timeout: Union[
None, None,
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)],
@ -1833,7 +1845,9 @@ class DataApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1850,6 +1864,9 @@ class DataApi:
if isinstance(body, str): if isinstance(body, str):
with open(body, "rb") as _fp: with open(body, "rb") as _fp:
_body_params = _fp.read() _body_params = _fp.read()
elif isinstance(body, tuple):
# drop the filename from the tuple
_body_params = body[1]
else: else:
_body_params = body _body_params = body

View File

@ -236,7 +236,9 @@ class DebugApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -495,7 +497,9 @@ class DebugApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters

View File

@ -280,7 +280,9 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -559,7 +561,9 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -804,7 +808,9 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1050,7 +1056,9 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1312,7 +1320,9 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1557,7 +1567,9 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1825,7 +1837,9 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -2092,7 +2106,9 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -2391,7 +2407,9 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters

View File

@ -270,7 +270,9 @@ class NodeApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -509,7 +511,9 @@ class NodeApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -753,7 +757,9 @@ class NodeApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {} _files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters

View File

@ -404,12 +404,12 @@ class ApiClient:
data = json.loads(response_text) data = json.loads(response_text)
except ValueError: except ValueError:
data = response_text data = response_text
elif content_type.startswith("application/json"): elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
if response_text == "": if response_text == "":
data = "" data = ""
else: else:
data = json.loads(response_text) data = json.loads(response_text)
elif content_type.startswith("text/plain"): elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
data = response_text data = response_text
else: else:
raise ApiException( raise ApiException(
@ -535,7 +535,10 @@ class ApiClient:
return "&".join(["=".join(map(str, item)) for item in new_params]) return "&".join(["=".join(map(str, item)) for item in new_params])
def files_parameters(self, files: Dict[str, Union[str, bytes]]): def files_parameters(
self,
files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
):
"""Builds form parameters. """Builds form parameters.
:param files: File parameters. :param files: File parameters.
@ -550,6 +553,12 @@ class ApiClient:
elif isinstance(v, bytes): elif isinstance(v, bytes):
filename = k filename = k
filedata = v filedata = v
elif isinstance(v, tuple):
filename, filedata = v
elif isinstance(v, list):
for file_param in v:
params.extend(self.files_parameters({k: file_param}))
continue
else: else:
raise ValueError("Unsupported file value") raise ValueError("Unsupported file value")
mimetype = ( mimetype = (

View File

@ -13,14 +13,16 @@
import copy import copy
import http.client as httplib
import logging import logging
from logging import FileHandler from logging import FileHandler
import multiprocessing import multiprocessing
import sys import sys
from typing import Optional from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict
from typing_extensions import NotRequired, Self
import urllib3 import urllib3
import http.client as httplib
JSON_SCHEMA_VALIDATION_KEYWORDS = { JSON_SCHEMA_VALIDATION_KEYWORDS = {
'multipleOf', 'maximum', 'exclusiveMaximum', 'multipleOf', 'maximum', 'exclusiveMaximum',
@ -28,6 +30,106 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {
'minLength', 'pattern', 'maxItems', 'minItems' 'minLength', 'pattern', 'maxItems', 'minItems'
} }
ServerVariablesT = Dict[str, str]
GenericAuthSetting = TypedDict(
"GenericAuthSetting",
{
"type": str,
"in": str,
"key": str,
"value": str,
},
)
OAuth2AuthSetting = TypedDict(
"OAuth2AuthSetting",
{
"type": Literal["oauth2"],
"in": Literal["header"],
"key": Literal["Authorization"],
"value": str,
},
)
APIKeyAuthSetting = TypedDict(
"APIKeyAuthSetting",
{
"type": Literal["api_key"],
"in": str,
"key": str,
"value": Optional[str],
},
)
BasicAuthSetting = TypedDict(
"BasicAuthSetting",
{
"type": Literal["basic"],
"in": Literal["header"],
"key": Literal["Authorization"],
"value": Optional[str],
},
)
BearerFormatAuthSetting = TypedDict(
"BearerFormatAuthSetting",
{
"type": Literal["bearer"],
"in": Literal["header"],
"format": Literal["JWT"],
"key": Literal["Authorization"],
"value": str,
},
)
BearerAuthSetting = TypedDict(
"BearerAuthSetting",
{
"type": Literal["bearer"],
"in": Literal["header"],
"key": Literal["Authorization"],
"value": str,
},
)
HTTPSignatureAuthSetting = TypedDict(
"HTTPSignatureAuthSetting",
{
"type": Literal["http-signature"],
"in": Literal["header"],
"key": Literal["Authorization"],
"value": None,
},
)
AuthSettings = TypedDict(
"AuthSettings",
{
},
total=False,
)
class HostSettingVariable(TypedDict):
description: str
default_value: str
enum_values: List[str]
class HostSetting(TypedDict):
url: str
description: str
variables: NotRequired[Dict[str, HostSettingVariable]]
class Configuration: class Configuration:
"""This class contains various settings of the API client. """This class contains various settings of the API client.
@ -61,20 +163,26 @@ class Configuration:
""" """
_default = None _default: ClassVar[Optional[Self]] = None
def __init__(self, host=None, def __init__(
api_key=None, api_key_prefix=None, self,
username=None, password=None, host: Optional[str]=None,
access_token=None, api_key: Optional[Dict[str, str]]=None,
server_index=None, server_variables=None, api_key_prefix: Optional[Dict[str, str]]=None,
server_operation_index=None, server_operation_variables=None, username: Optional[str]=None,
ignore_operation_servers=False, password: Optional[str]=None,
ssl_ca_cert=None, access_token: Optional[str]=None,
retries=None, server_index: Optional[int]=None,
*, server_variables: Optional[ServerVariablesT]=None,
debug: Optional[bool] = None server_operation_index: Optional[Dict[int, int]]=None,
) -> None: server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
*,
debug: Optional[bool] = None,
) -> None:
"""Constructor """Constructor
""" """
self._base_path = "http://localhost:8080/api/codex/v1" if host is None else host self._base_path = "http://localhost:8080/api/codex/v1" if host is None else host
@ -198,7 +306,7 @@ class Configuration:
"""date format """date format
""" """
def __deepcopy__(self, memo): def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
cls = self.__class__ cls = self.__class__
result = cls.__new__(cls) result = cls.__new__(cls)
memo[id(self)] = result memo[id(self)] = result
@ -212,11 +320,11 @@ class Configuration:
result.debug = self.debug result.debug = self.debug
return result return result
def __setattr__(self, name, value): def __setattr__(self, name: str, value: Any) -> None:
object.__setattr__(self, name, value) object.__setattr__(self, name, value)
@classmethod @classmethod
def set_default(cls, default): def set_default(cls, default: Optional[Self]) -> None:
"""Set default instance of configuration. """Set default instance of configuration.
It stores default configuration, which can be It stores default configuration, which can be
@ -227,7 +335,7 @@ class Configuration:
cls._default = default cls._default = default
@classmethod @classmethod
def get_default_copy(cls): def get_default_copy(cls) -> Self:
"""Deprecated. Please use `get_default` instead. """Deprecated. Please use `get_default` instead.
Deprecated. Please use `get_default` instead. Deprecated. Please use `get_default` instead.
@ -237,7 +345,7 @@ class Configuration:
return cls.get_default() return cls.get_default()
@classmethod @classmethod
def get_default(cls): def get_default(cls) -> Self:
"""Return the default configuration. """Return the default configuration.
This method returns newly created, based on default constructor, This method returns newly created, based on default constructor,
@ -247,11 +355,11 @@ class Configuration:
:return: The configuration object. :return: The configuration object.
""" """
if cls._default is None: if cls._default is None:
cls._default = Configuration() cls._default = cls()
return cls._default return cls._default
@property @property
def logger_file(self): def logger_file(self) -> Optional[str]:
"""The logger file. """The logger file.
If the logger_file is None, then add stream handler and remove file If the logger_file is None, then add stream handler and remove file
@ -263,7 +371,7 @@ class Configuration:
return self.__logger_file return self.__logger_file
@logger_file.setter @logger_file.setter
def logger_file(self, value): def logger_file(self, value: Optional[str]) -> None:
"""The logger file. """The logger file.
If the logger_file is None, then add stream handler and remove file If the logger_file is None, then add stream handler and remove file
@ -282,7 +390,7 @@ class Configuration:
logger.addHandler(self.logger_file_handler) logger.addHandler(self.logger_file_handler)
@property @property
def debug(self): def debug(self) -> bool:
"""Debug status """Debug status
:param value: The debug status, True or False. :param value: The debug status, True or False.
@ -291,7 +399,7 @@ class Configuration:
return self.__debug return self.__debug
@debug.setter @debug.setter
def debug(self, value): def debug(self, value: bool) -> None:
"""Debug status """Debug status
:param value: The debug status, True or False. :param value: The debug status, True or False.
@ -313,7 +421,7 @@ class Configuration:
httplib.HTTPConnection.debuglevel = 0 httplib.HTTPConnection.debuglevel = 0
@property @property
def logger_format(self): def logger_format(self) -> str:
"""The logger format. """The logger format.
The logger_formatter will be updated when sets logger_format. The logger_formatter will be updated when sets logger_format.
@ -324,7 +432,7 @@ class Configuration:
return self.__logger_format return self.__logger_format
@logger_format.setter @logger_format.setter
def logger_format(self, value): def logger_format(self, value: str) -> None:
"""The logger format. """The logger format.
The logger_formatter will be updated when sets logger_format. The logger_formatter will be updated when sets logger_format.
@ -335,7 +443,7 @@ class Configuration:
self.__logger_format = value self.__logger_format = value
self.logger_formatter = logging.Formatter(self.__logger_format) self.logger_formatter = logging.Formatter(self.__logger_format)
def get_api_key_with_prefix(self, identifier, alias=None): def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
"""Gets API key (with prefix if set). """Gets API key (with prefix if set).
:param identifier: The identifier of apiKey. :param identifier: The identifier of apiKey.
@ -352,7 +460,9 @@ class Configuration:
else: else:
return key return key
def get_basic_auth_token(self): return None
def get_basic_auth_token(self) -> Optional[str]:
"""Gets HTTP basic authentication header (string). """Gets HTTP basic authentication header (string).
:return: The token for basic HTTP authentication. :return: The token for basic HTTP authentication.
@ -367,15 +477,15 @@ class Configuration:
basic_auth=username + ':' + password basic_auth=username + ':' + password
).get('authorization') ).get('authorization')
def auth_settings(self): def auth_settings(self)-> AuthSettings:
"""Gets Auth Settings dict for api client. """Gets Auth Settings dict for api client.
:return: The Auth Settings information dict. :return: The Auth Settings information dict.
""" """
auth = {} auth: AuthSettings = {}
return auth return auth
def to_debug_report(self): def to_debug_report(self) -> str:
"""Gets the essential information for debugging. """Gets the essential information for debugging.
:return: The report for debugging. :return: The report for debugging.
@ -387,7 +497,7 @@ class Configuration:
"SDK Package Version: 0.0.1".\ "SDK Package Version: 0.0.1".\
format(env=sys.platform, pyversion=sys.version) format(env=sys.platform, pyversion=sys.version)
def get_host_settings(self): def get_host_settings(self) -> List[HostSetting]:
"""Gets an array of host settings """Gets an array of host settings
:return: An array of host settings :return: An array of host settings
@ -399,7 +509,12 @@ class Configuration:
} }
] ]
def get_host_from_settings(self, index, variables=None, servers=None): def get_host_from_settings(
self,
index: Optional[int],
variables: Optional[ServerVariablesT]=None,
servers: Optional[List[HostSetting]]=None,
) -> str:
"""Gets host URL based on the index and variables """Gets host URL based on the index and variables
:param index: array index of the host settings :param index: array index of the host settings
:param variables: hash of variable and the corresponding value :param variables: hash of variable and the corresponding value
@ -439,12 +554,12 @@ class Configuration:
return url return url
@property @property
def host(self): def host(self) -> str:
"""Return generated host.""" """Return generated host."""
return self.get_host_from_settings(self.server_index, variables=self.server_variables) return self.get_host_from_settings(self.server_index, variables=self.server_variables)
@host.setter @host.setter
def host(self, value): def host(self, value: str) -> None:
"""Fix base path.""" """Fix base path."""
self._base_path = value self._base_path = value
self.server_index = None self.server_index = None

View File

@ -225,7 +225,7 @@ class RESTClientObject:
headers=headers, headers=headers,
preload_content=False preload_content=False
) )
elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
request_body = "true" if body else "false" request_body = "true" if body else "false"
r = self.pool_manager.request( r = self.pool_manager.request(
method, method,

View File

@ -2,6 +2,6 @@
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2, "spaces": 2,
"generator-cli": { "generator-cli": {
"version": "7.8.0" "version": "7.10.0"
} }
} }

View File

@ -10,19 +10,20 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "Codex API"]
include = ["codex_api_client/py.typed"] include = ["codex_api_client/py.typed"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.7" python = "^3.8"
urllib3 = ">= 1.25.3" urllib3 = ">= 1.25.3 < 3.0.0"
python-dateutil = ">=2.8.2" python-dateutil = ">= 2.8.2"
pydantic = ">=2" pydantic = ">= 2"
typing-extensions = ">=4.7.1" typing-extensions = ">= 4.7.1"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
pytest = ">=7.2.1" pytest = ">= 7.2.1"
tox = ">=3.9.0" pytest-cov = ">= 2.8.1"
flake8 = ">=4.0.0" tox = ">= 3.9.0"
types-python-dateutil = ">=2.8.19.14" flake8 = ">= 4.0.0"
mypy = "1.4.1" types-python-dateutil = ">= 2.8.19.14"
mypy = ">= 1.5"
[build-system] [build-system]
@ -48,7 +49,7 @@ warn_unused_ignores = true
## Getting these passing should be easy ## Getting these passing should be easy
strict_equality = true strict_equality = true
strict_concatenate = true extra_checks = true
## Strongly recommend enabling this one as soon as you can ## Strongly recommend enabling this one as soon as you can
check_untyped_defs = true check_untyped_defs = true
@ -69,3 +70,20 @@ disallow_any_generics = true
# #
### This one can be tricky to get passing if you use a lot of untyped libraries ### This one can be tricky to get passing if you use a lot of untyped libraries
#warn_return_any = true #warn_return_any = true
[[tool.mypy.overrides]]
module = [
"codex_api_client.configuration",
]
warn_unused_ignores = true
strict_equality = true
extra_checks = true
check_untyped_defs = true
disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_any_generics = true
disallow_untyped_calls = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_reexport = true
warn_return_any = true

View File

@ -1,5 +1,4 @@
python_dateutil >= 2.5.3 urllib3 >= 1.25.3, < 3.0.0
setuptools >= 21.0.0 python_dateutil >= 2.8.2
urllib3 >= 1.25.3, < 2.1.0
pydantic >= 2 pydantic >= 2
typing-extensions >= 4.7.1 typing-extensions >= 4.7.1

View File

@ -22,10 +22,10 @@ from setuptools import setup, find_packages # noqa: H301
# http://pypi.python.org/pypi/setuptools # http://pypi.python.org/pypi/setuptools
NAME = "Codex API Client" NAME = "Codex API Client"
VERSION = "0.0.1" VERSION = "0.0.1"
PYTHON_REQUIRES = ">=3.7" PYTHON_REQUIRES = ">= 3.8"
REQUIRES = [ REQUIRES = [
"urllib3 >= 1.25.3, < 2.1.0", "urllib3 >= 1.25.3, < 3.0.0",
"python-dateutil", "python-dateutil >= 2.8.2",
"pydantic >= 2", "pydantic >= 2",
"typing-extensions >= 4.7.1", "typing-extensions >= 4.7.1",
] ]

View File

@ -1,5 +1,6 @@
pytest~=7.1.3 pytest >= 7.2.1
pytest-cov>=2.8.1 pytest-cov >= 2.8.1
pytest-randomly>=3.12.0 tox >= 3.9.0
mypy>=1.4.1 flake8 >= 4.0.0
types-python-dateutil>=2.8.19 types-python-dateutil >= 2.8.19.14
mypy >= 1.5