[python] client bug fixes + type hint improvements (#13665)

* Adds python client, template, and spec updates for query param content type json

* Samples regenerated

* Finishes adding test cases for query param json content type

* Uses newest templates

* Templates replaced, spec replaces, sample replaced

* Samples updated
This commit is contained in:
Justin Black
2022-10-10 20:13:31 -07:00
committed by GitHub
parent 02916822f7
commit ef8e55ca21
511 changed files with 61345 additions and 8047 deletions

View File

@@ -53,6 +53,8 @@ class RequestField(RequestFieldBase):
class JSONEncoder(json.JSONEncoder):
compact_separators = (',', ':')
def default(self, obj):
if isinstance(obj, str):
return str(obj)
@@ -324,8 +326,25 @@ class StyleSimpleSerializer(ParameterSerializerBase):
)
class JSONDetector:
"""
Works for:
application/json
application/json; charset=UTF-8
application/json-patch+json
application/geo+json
"""
__json_content_type_pattern = re.compile("application/[^+]*[+]?(json);?.*")
@classmethod
def _content_type_is_json(cls, content_type: str) -> bool:
if cls.__json_content_type_pattern.match(content_type):
return True
return False
@dataclass
class ParameterBase:
class ParameterBase(JSONDetector):
name: str
in_type: ParameterInType
required: bool
@@ -352,7 +371,6 @@ class ParameterBase:
}
__disallowed_header_names = {'Accept', 'Content-Type', 'Authorization'}
_json_encoder = JSONEncoder()
_json_content_type = 'application/json'
@classmethod
def __verify_style_to_in_type(cls, style: typing.Optional[ParameterStyle], in_type: ParameterInType):
@@ -399,8 +417,11 @@ class ParameterBase:
def _serialize_json(
self,
in_data: typing.Union[None, int, float, str, bool, dict, list]
in_data: typing.Union[None, int, float, str, bool, dict, list],
eliminate_whitespace: bool = False
) -> str:
if eliminate_whitespace:
return json.dumps(in_data, separators=self._json_encoder.compact_separators)
return json.dumps(in_data)
@@ -495,7 +516,7 @@ class PathParameter(ParameterBase, StyleSimpleSerializer):
for content_type, schema in self.content.items():
cast_in_data = schema(in_data)
cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type:
if self._content_type_is_json(content_type):
value = self._serialize_json(cast_in_data)
return self._to_dict(self.name, value)
raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type))
@@ -513,7 +534,7 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
schema: typing.Optional[typing.Type[Schema]] = None,
content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None
):
used_style = ParameterStyle.FORM if style is None and content is None and schema else style
used_style = ParameterStyle.FORM if style is None else style
used_explode = self._get_default_explode(used_style) if explode is None else explode
super().__init__(
@@ -576,8 +597,6 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
return self._to_dict(self.name, value)
def get_prefix_separator_iterator(self) -> typing.Optional[PrefixSeparatorIterator]:
if not self.schema:
return None
if self.style is ParameterStyle.FORM:
return PrefixSeparatorIterator('?', '&')
elif self.style is ParameterStyle.SPACE_DELIMITED:
@@ -616,12 +635,17 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
elif self.style is ParameterStyle.PIPE_DELIMITED:
return self.__serialize_pipe_delimited(cast_in_data, prefix_separator_iterator)
# self.content will be length one
if prefix_separator_iterator is None:
prefix_separator_iterator = self.get_prefix_separator_iterator()
for content_type, schema in self.content.items():
cast_in_data = schema(in_data)
cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type:
value = self._serialize_json(cast_in_data)
return self._to_dict(self.name, value)
if self._content_type_is_json(content_type):
value = self._serialize_json(cast_in_data, eliminate_whitespace=True)
return self._to_dict(
self.name,
next(prefix_separator_iterator) + self.name + '=' + quote(value)
)
raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type))
@@ -680,7 +704,7 @@ class CookieParameter(ParameterBase, StyleFormSerializer):
for content_type, schema in self.content.items():
cast_in_data = schema(in_data)
cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type:
if self._content_type_is_json(content_type):
value = self._serialize_json(cast_in_data)
return self._to_dict(self.name, value)
raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type))
@@ -737,7 +761,7 @@ class HeaderParameter(ParameterBase, StyleSimpleSerializer):
for content_type, schema in self.content.items():
cast_in_data = schema(in_data)
cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type:
if self._content_type_is_json(content_type):
value = self._serialize_json(cast_in_data)
return self.__to_headers(((self.name, value),))
raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type))
@@ -800,23 +824,6 @@ class ApiResponseWithoutDeserialization(ApiResponse):
headers: typing.Union[Unset, typing.List[HeaderParameter]] = unset
class JSONDetector:
"""
Works for:
application/json
application/json; charset=UTF-8
application/json-patch+json
application/geo+json
"""
__json_content_type_pattern = re.compile("application/[^+]*[+]?(json);?.*")
@classmethod
def _content_type_is_json(cls, content_type: str) -> bool:
if cls.__json_content_type_pattern.match(content_type):
return True
return False
class OpenApiResponse(JSONDetector):
__filename_content_disposition_pattern = re.compile('filename="(.+?)"')
@@ -991,7 +998,7 @@ class ApiClient:
self.pool_threads = pool_threads
self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {}
self.default_headers = HTTPHeaderDict()
if header_name is not None:
self.default_headers[header_name] = header_value
self.cookie = cookie
@@ -1048,15 +1055,18 @@ class ApiClient:
) -> urllib3.HTTPResponse:
# header parameters
headers = headers or HTTPHeaderDict()
headers.update(self.default_headers)
used_headers = HTTPHeaderDict(self.default_headers)
if self.cookie:
headers['Cookie'] = self.cookie
# auth setting
self.update_params_for_auth(headers,
self.update_params_for_auth(used_headers,
auth_settings, resource_path, method, body)
# must happen after cookie setting and auth setting in case user is overriding those
if headers:
used_headers.update(headers)
# request url
if host is None:
url = self.configuration.host + resource_path
@@ -1068,7 +1078,7 @@ class ApiClient:
response = self.request(
method,
url,
headers=headers,
headers=used_headers,
fields=fields,
body=body,
stream=stream,

View File

@@ -105,18 +105,48 @@ _all_accept_content_types = (
class BaseApi(api_client.Api):
@typing.overload
def _custom_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def _custom_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def _custom_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def _custom_server_oapg(
self: api_client.Api,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
"""
Use custom server
:param skip_deserialization: If true then api_response.response will be set but
@@ -160,17 +190,48 @@ class BaseApi(api_client.Api):
class CustomServer(BaseApi):
# this class is used by api classes that refer to endpoints with operationId fn names
@typing.overload
def custom_server(
self: BaseApi,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def custom_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def custom_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def custom_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
return self._custom_server_oapg(
accept_content_types=accept_content_types,
host_index=host_index,
@@ -183,17 +244,48 @@ class CustomServer(BaseApi):
class ApiForget(BaseApi):
# this class is used by api classes that refer to endpoints by path and http method names
@typing.overload
def get(
self: BaseApi,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
return self._custom_server_oapg(
accept_content_types=accept_content_types,
host_index=host_index,

View File

@@ -50,18 +50,48 @@ _all_accept_content_types = (
class BaseApi(api_client.Api):
@typing.overload
def _custom_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def _custom_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def _custom_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def _custom_server_oapg(
self: api_client.Api,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
"""
Use custom server
:param skip_deserialization: If true then api_response.response will be set but
@@ -105,17 +135,48 @@ class BaseApi(api_client.Api):
class CustomServer(BaseApi):
# this class is used by api classes that refer to endpoints with operationId fn names
@typing.overload
def custom_server(
self: BaseApi,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def custom_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def custom_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def custom_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
return self._custom_server_oapg(
accept_content_types=accept_content_types,
host_index=host_index,
@@ -128,17 +189,48 @@ class CustomServer(BaseApi):
class ApiForget(BaseApi):
# this class is used by api classes that refer to endpoints by path and http method names
@typing.overload
def get(
self: BaseApi,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
host_index: typing.Optional[int] = None,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
return self._custom_server_oapg(
accept_content_types=accept_content_types,
host_index=host_index,

View File

@@ -55,17 +55,44 @@ _all_accept_content_types = (
class BaseApi(api_client.Api):
@typing.overload
def _default_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def _default_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def _default_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def _default_server_oapg(
self: api_client.Api,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
"""
Use default server
:param skip_deserialization: If true then api_response.response will be set but
@@ -106,16 +133,44 @@ class BaseApi(api_client.Api):
class DefaultServer(BaseApi):
# this class is used by api classes that refer to endpoints with operationId fn names
@typing.overload
def default_server(
self: BaseApi,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def default_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def default_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def default_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
return self._default_server_oapg(
accept_content_types=accept_content_types,
stream=stream,
@@ -127,16 +182,44 @@ class DefaultServer(BaseApi):
class ApiForget(BaseApi):
# this class is used by api classes that refer to endpoints by path and http method names
@typing.overload
def get(
self: BaseApi,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
return self._default_server_oapg(
accept_content_types=accept_content_types,
stream=stream,

View File

@@ -50,17 +50,44 @@ _all_accept_content_types = (
class BaseApi(api_client.Api):
@typing.overload
def _default_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def _default_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def _default_server_oapg(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def _default_server_oapg(
self: api_client.Api,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
"""
Use default server
:param skip_deserialization: If true then api_response.response will be set but
@@ -101,16 +128,44 @@ class BaseApi(api_client.Api):
class DefaultServer(BaseApi):
# this class is used by api classes that refer to endpoints with operationId fn names
@typing.overload
def default_server(
self: BaseApi,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def default_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def default_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def default_server(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
return self._default_server_oapg(
accept_content_types=accept_content_types,
stream=stream,
@@ -122,16 +177,44 @@ class DefaultServer(BaseApi):
class ApiForget(BaseApi):
# this class is used by api classes that refer to endpoints by path and http method names
@typing.overload
def get(
self: BaseApi,
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: typing_extensions.Literal[False] = ...,
) -> typing.Union[
ApiResponseFor200,
]: ...
@typing.overload
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
) -> api_client.ApiResponseWithoutDeserialization: ...
@typing.overload
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = ...,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization,
]: ...
def get(
self,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
):
return self._default_server_oapg(
accept_content_types=accept_content_types,
stream=stream,

View File

@@ -1,5 +1,6 @@
certifi >= 14.05.14
frozendict >= 2.0.3
python_dateutil >= 2.5.3
certifi >= 14.5.14
frozendict ~= 2.3.4
python-dateutil ~= 2.7.0
setuptools >= 21.0.0
urllib3 >= 1.15.1
typing_extensions ~= 4.3.0
urllib3 ~= 1.26.7

View File

@@ -21,11 +21,12 @@ VERSION = "1.0.0"
# http://pypi.python.org/pypi/setuptools
REQUIRES = [
"urllib3 >= 1.15",
"certifi",
"python-dateutil",
"frozendict >= 2.0.3",
"typing_extensions",
"certifi >= 14.5.14",
"frozendict ~= 2.3.4",
"python-dateutil ~= 2.7.0",
"setuptools >= 21.0.0",
"typing_extensions ~= 4.3.0",
"urllib3 ~= 1.26.7",
]
setup(