Skip to content

Commit b5dd6f8

Browse files
fix(deps): update openapitools/openapi-generator-cli docker tag to v7.10.0
1 parent 7ae0a07 commit b5dd6f8

File tree

3 files changed

+174
-40
lines changed

3 files changed

+174
-40
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
55

66
- API version: v4.0.11.2680
77
- Package version: 1.0.2 <!--- x-release-please-version -->
8-
- Generator version: 7.9.0
8+
- Generator version: 7.10.0
99
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1010

1111
## Requirements.
1212

13-
Python 3.7+
13+
Python 3.8+
1414

1515
## Installation & Usage
1616
### pip install

pyproject.toml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ warn_unused_ignores = true
4949

5050
## Getting these passing should be easy
5151
strict_equality = true
52-
strict_concatenate = true
52+
extra_checks = true
5353

5454
## Strongly recommend enabling this one as soon as you can
5555
check_untyped_defs = true
@@ -70,3 +70,20 @@ disallow_any_generics = true
7070
#
7171
### This one can be tricky to get passing if you use a lot of untyped libraries
7272
#warn_return_any = true
73+
74+
[[tool.mypy.overrides]]
75+
module = [
76+
"sonarr.configuration",
77+
]
78+
warn_unused_ignores = true
79+
strict_equality = true
80+
extra_checks = true
81+
check_untyped_defs = true
82+
disallow_subclassing_any = true
83+
disallow_untyped_decorators = true
84+
disallow_any_generics = true
85+
disallow_untyped_calls = true
86+
disallow_incomplete_defs = true
87+
disallow_untyped_defs = true
88+
no_implicit_reexport = true
89+
warn_return_any = true

sonarr/configuration.py

Lines changed: 154 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,125 @@
1313

1414

1515
import copy
16+
import http.client as httplib
1617
import logging
1718
from logging import FileHandler
1819
import multiprocessing
1920
import sys
20-
from typing import Optional
21+
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict
22+
from typing_extensions import NotRequired, Self
23+
2124
import urllib3
2225

23-
import http.client as httplib
2426

2527
JSON_SCHEMA_VALIDATION_KEYWORDS = {
2628
'multipleOf', 'maximum', 'exclusiveMaximum',
2729
'minimum', 'exclusiveMinimum', 'maxLength',
2830
'minLength', 'pattern', 'maxItems', 'minItems'
2931
}
3032

33+
ServerVariablesT = Dict[str, str]
34+
35+
GenericAuthSetting = TypedDict(
36+
"GenericAuthSetting",
37+
{
38+
"type": str,
39+
"in": str,
40+
"key": str,
41+
"value": str,
42+
},
43+
)
44+
45+
46+
OAuth2AuthSetting = TypedDict(
47+
"OAuth2AuthSetting",
48+
{
49+
"type": Literal["oauth2"],
50+
"in": Literal["header"],
51+
"key": Literal["Authorization"],
52+
"value": str,
53+
},
54+
)
55+
56+
57+
APIKeyAuthSetting = TypedDict(
58+
"APIKeyAuthSetting",
59+
{
60+
"type": Literal["api_key"],
61+
"in": str,
62+
"key": str,
63+
"value": Optional[str],
64+
},
65+
)
66+
67+
68+
BasicAuthSetting = TypedDict(
69+
"BasicAuthSetting",
70+
{
71+
"type": Literal["basic"],
72+
"in": Literal["header"],
73+
"key": Literal["Authorization"],
74+
"value": Optional[str],
75+
},
76+
)
77+
78+
79+
BearerFormatAuthSetting = TypedDict(
80+
"BearerFormatAuthSetting",
81+
{
82+
"type": Literal["bearer"],
83+
"in": Literal["header"],
84+
"format": Literal["JWT"],
85+
"key": Literal["Authorization"],
86+
"value": str,
87+
},
88+
)
89+
90+
91+
BearerAuthSetting = TypedDict(
92+
"BearerAuthSetting",
93+
{
94+
"type": Literal["bearer"],
95+
"in": Literal["header"],
96+
"key": Literal["Authorization"],
97+
"value": str,
98+
},
99+
)
100+
101+
102+
HTTPSignatureAuthSetting = TypedDict(
103+
"HTTPSignatureAuthSetting",
104+
{
105+
"type": Literal["http-signature"],
106+
"in": Literal["header"],
107+
"key": Literal["Authorization"],
108+
"value": None,
109+
},
110+
)
111+
112+
113+
AuthSettings = TypedDict(
114+
"AuthSettings",
115+
{
116+
"X-Api-Key": APIKeyAuthSetting,
117+
"apikey": APIKeyAuthSetting,
118+
},
119+
total=False,
120+
)
121+
122+
123+
class HostSettingVariable(TypedDict):
124+
description: str
125+
default_value: str
126+
enum_values: List[str]
127+
128+
129+
class HostSetting(TypedDict):
130+
url: str
131+
description: str
132+
variables: NotRequired[Dict[str, HostSettingVariable]]
133+
134+
31135
class Configuration:
32136
"""This class contains various settings of the API client.
33137
@@ -81,20 +185,26 @@ class Configuration:
81185
Cookie: JSESSIONID abc123
82186
"""
83187

84-
_default = None
85-
86-
def __init__(self, host=None,
87-
api_key=None, api_key_prefix=None,
88-
username=None, password=None,
89-
access_token=None,
90-
server_index=None, server_variables=None,
91-
server_operation_index=None, server_operation_variables=None,
92-
ignore_operation_servers=False,
93-
ssl_ca_cert=None,
94-
retries=None,
95-
*,
96-
debug: Optional[bool] = None
97-
) -> None:
188+
_default: ClassVar[Optional[Self]] = None
189+
190+
def __init__(
191+
self,
192+
host: Optional[str]=None,
193+
api_key: Optional[Dict[str, str]]=None,
194+
api_key_prefix: Optional[Dict[str, str]]=None,
195+
username: Optional[str]=None,
196+
password: Optional[str]=None,
197+
access_token: Optional[str]=None,
198+
server_index: Optional[int]=None,
199+
server_variables: Optional[ServerVariablesT]=None,
200+
server_operation_index: Optional[Dict[int, int]]=None,
201+
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
202+
ignore_operation_servers: bool=False,
203+
ssl_ca_cert: Optional[str]=None,
204+
retries: Optional[int] = None,
205+
*,
206+
debug: Optional[bool] = None,
207+
) -> None:
98208
"""Constructor
99209
"""
100210
self._base_path = "http://localhost:8989" if host is None else host
@@ -218,7 +328,7 @@ def __init__(self, host=None,
218328
"""date format
219329
"""
220330

221-
def __deepcopy__(self, memo):
331+
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
222332
cls = self.__class__
223333
result = cls.__new__(cls)
224334
memo[id(self)] = result
@@ -232,11 +342,11 @@ def __deepcopy__(self, memo):
232342
result.debug = self.debug
233343
return result
234344

235-
def __setattr__(self, name, value):
345+
def __setattr__(self, name: str, value: Any) -> None:
236346
object.__setattr__(self, name, value)
237347

238348
@classmethod
239-
def set_default(cls, default):
349+
def set_default(cls, default: Optional[Self]) -> None:
240350
"""Set default instance of configuration.
241351
242352
It stores default configuration, which can be
@@ -247,7 +357,7 @@ def set_default(cls, default):
247357
cls._default = default
248358

249359
@classmethod
250-
def get_default_copy(cls):
360+
def get_default_copy(cls) -> Self:
251361
"""Deprecated. Please use `get_default` instead.
252362
253363
Deprecated. Please use `get_default` instead.
@@ -257,7 +367,7 @@ def get_default_copy(cls):
257367
return cls.get_default()
258368

259369
@classmethod
260-
def get_default(cls):
370+
def get_default(cls) -> Self:
261371
"""Return the default configuration.
262372
263373
This method returns newly created, based on default constructor,
@@ -267,11 +377,11 @@ def get_default(cls):
267377
:return: The configuration object.
268378
"""
269379
if cls._default is None:
270-
cls._default = Configuration()
380+
cls._default = cls()
271381
return cls._default
272382

273383
@property
274-
def logger_file(self):
384+
def logger_file(self) -> Optional[str]:
275385
"""The logger file.
276386
277387
If the logger_file is None, then add stream handler and remove file
@@ -283,7 +393,7 @@ def logger_file(self):
283393
return self.__logger_file
284394

285395
@logger_file.setter
286-
def logger_file(self, value):
396+
def logger_file(self, value: Optional[str]) -> None:
287397
"""The logger file.
288398
289399
If the logger_file is None, then add stream handler and remove file
@@ -302,7 +412,7 @@ def logger_file(self, value):
302412
logger.addHandler(self.logger_file_handler)
303413

304414
@property
305-
def debug(self):
415+
def debug(self) -> bool:
306416
"""Debug status
307417
308418
:param value: The debug status, True or False.
@@ -311,7 +421,7 @@ def debug(self):
311421
return self.__debug
312422

313423
@debug.setter
314-
def debug(self, value):
424+
def debug(self, value: bool) -> None:
315425
"""Debug status
316426
317427
:param value: The debug status, True or False.
@@ -333,7 +443,7 @@ def debug(self, value):
333443
httplib.HTTPConnection.debuglevel = 0
334444

335445
@property
336-
def logger_format(self):
446+
def logger_format(self) -> str:
337447
"""The logger format.
338448
339449
The logger_formatter will be updated when sets logger_format.
@@ -344,7 +454,7 @@ def logger_format(self):
344454
return self.__logger_format
345455

346456
@logger_format.setter
347-
def logger_format(self, value):
457+
def logger_format(self, value: str) -> None:
348458
"""The logger format.
349459
350460
The logger_formatter will be updated when sets logger_format.
@@ -355,7 +465,7 @@ def logger_format(self, value):
355465
self.__logger_format = value
356466
self.logger_formatter = logging.Formatter(self.__logger_format)
357467

358-
def get_api_key_with_prefix(self, identifier, alias=None):
468+
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
359469
"""Gets API key (with prefix if set).
360470
361471
:param identifier: The identifier of apiKey.
@@ -372,7 +482,9 @@ def get_api_key_with_prefix(self, identifier, alias=None):
372482
else:
373483
return key
374484

375-
def get_basic_auth_token(self):
485+
return None
486+
487+
def get_basic_auth_token(self) -> Optional[str]:
376488
"""Gets HTTP basic authentication header (string).
377489
378490
:return: The token for basic HTTP authentication.
@@ -387,12 +499,12 @@ def get_basic_auth_token(self):
387499
basic_auth=username + ':' + password
388500
).get('authorization')
389501

390-
def auth_settings(self):
502+
def auth_settings(self)-> AuthSettings:
391503
"""Gets Auth Settings dict for api client.
392504
393505
:return: The Auth Settings information dict.
394506
"""
395-
auth = {}
507+
auth: AuthSettings = {}
396508
if 'X-Api-Key' in self.api_key:
397509
auth['X-Api-Key'] = {
398510
'type': 'api_key',
@@ -413,7 +525,7 @@ def auth_settings(self):
413525
}
414526
return auth
415527

416-
def to_debug_report(self):
528+
def to_debug_report(self) -> str:
417529
"""Gets the essential information for debugging.
418530
419531
:return: The report for debugging.
@@ -425,7 +537,7 @@ def to_debug_report(self):
425537
"SDK Package Version: {v}".\
426538
format(env=sys.platform, pyversion=sys.version, v="1.0.2") # x-release-please-version
427539

428-
def get_host_settings(self):
540+
def get_host_settings(self) -> List[HostSetting]:
429541
"""Gets an array of host settings
430542
431543
:return: An array of host settings
@@ -451,7 +563,12 @@ def get_host_settings(self):
451563
}
452564
]
453565

454-
def get_host_from_settings(self, index, variables=None, servers=None):
566+
def get_host_from_settings(
567+
self,
568+
index: Optional[int],
569+
variables: Optional[ServerVariablesT]=None,
570+
servers: Optional[List[HostSetting]]=None,
571+
) -> str:
455572
"""Gets host URL based on the index and variables
456573
:param index: array index of the host settings
457574
:param variables: hash of variable and the corresponding value
@@ -491,12 +608,12 @@ def get_host_from_settings(self, index, variables=None, servers=None):
491608
return url
492609

493610
@property
494-
def host(self):
611+
def host(self) -> str:
495612
"""Return generated host."""
496613
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
497614

498615
@host.setter
499-
def host(self, value):
616+
def host(self, value: str) -> None:
500617
"""Fix base path."""
501618
self._base_path = value
502619
self.server_index = None

0 commit comments

Comments
 (0)