openapi-python-client 0.29.0__py3-none-any.whl → 0.30.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openapi_python_client/__init__.py +30 -21
- openapi_python_client/cli.py +10 -3
- openapi_python_client/config.py +4 -1
- openapi_python_client/parser/bodies.py +8 -7
- openapi_python_client/parser/openapi.py +58 -48
- openapi_python_client/parser/properties/__init__.py +36 -33
- openapi_python_client/parser/properties/any.py +12 -10
- openapi_python_client/parser/properties/boolean.py +14 -13
- openapi_python_client/parser/properties/const.py +11 -10
- openapi_python_client/parser/properties/date.py +13 -11
- openapi_python_client/parser/properties/datetime.py +13 -11
- openapi_python_client/parser/properties/enum_property.py +23 -20
- openapi_python_client/parser/properties/file.py +12 -10
- openapi_python_client/parser/properties/float.py +14 -13
- openapi_python_client/parser/properties/int.py +12 -11
- openapi_python_client/parser/properties/list_property.py +22 -22
- openapi_python_client/parser/properties/literal_enum_property.py +20 -20
- openapi_python_client/parser/properties/merge_properties.py +9 -6
- openapi_python_client/parser/properties/model_property.py +35 -34
- openapi_python_client/parser/properties/none.py +12 -11
- openapi_python_client/parser/properties/protocol.py +42 -32
- openapi_python_client/parser/properties/schemas.py +30 -23
- openapi_python_client/parser/properties/string.py +11 -11
- openapi_python_client/parser/properties/union.py +24 -22
- openapi_python_client/parser/properties/uuid.py +12 -11
- openapi_python_client/parser/responses.py +31 -24
- openapi_python_client/schema/__init__.py +2 -1
- openapi_python_client/schema/openapi_schema_pydantic/callback.py +3 -1
- openapi_python_client/schema/openapi_schema_pydantic/components.py +10 -9
- openapi_python_client/schema/openapi_schema_pydantic/contact.py +5 -3
- openapi_python_client/schema/openapi_schema_pydantic/discriminator.py +4 -2
- openapi_python_client/schema/openapi_schema_pydantic/encoding.py +4 -3
- openapi_python_client/schema/openapi_schema_pydantic/example.py +5 -3
- openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py +4 -2
- openapi_python_client/schema/openapi_schema_pydantic/header.py +20 -6
- openapi_python_client/schema/openapi_schema_pydantic/info.py +5 -4
- openapi_python_client/schema/openapi_schema_pydantic/license.py +4 -2
- openapi_python_client/schema/openapi_schema_pydantic/link.py +5 -4
- openapi_python_client/schema/openapi_schema_pydantic/media_type.py +3 -2
- openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py +6 -4
- openapi_python_client/schema/openapi_schema_pydantic/open_api.py +5 -3
- openapi_python_client/schema/openapi_schema_pydantic/operation.py +6 -5
- openapi_python_client/schema/openapi_schema_pydantic/parameter.py +6 -5
- openapi_python_client/schema/openapi_schema_pydantic/path_item.py +5 -3
- openapi_python_client/schema/openapi_schema_pydantic/paths.py +2 -1
- openapi_python_client/schema/openapi_schema_pydantic/reference.py +3 -1
- openapi_python_client/schema/openapi_schema_pydantic/request_body.py +3 -2
- openapi_python_client/schema/openapi_schema_pydantic/response.py +5 -4
- openapi_python_client/schema/openapi_schema_pydantic/responses.py +2 -1
- openapi_python_client/schema/openapi_schema_pydantic/schema.py +9 -8
- openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py +3 -1
- openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py +8 -7
- openapi_python_client/schema/openapi_schema_pydantic/server.py +4 -3
- openapi_python_client/schema/openapi_schema_pydantic/server_variable.py +5 -3
- openapi_python_client/schema/openapi_schema_pydantic/tag.py +3 -2
- openapi_python_client/schema/openapi_schema_pydantic/xml.py +5 -3
- openapi_python_client/schema/ref.py +52 -0
- openapi_python_client/schema/untrusted_string.py +56 -0
- openapi_python_client/strings.py +245 -0
- openapi_python_client/templates/README.md.jinja +9 -9
- openapi_python_client/templates/client.py.jinja +31 -31
- openapi_python_client/templates/endpoint_macros.py.jinja +19 -19
- openapi_python_client/templates/endpoint_module.py.jinja +18 -21
- openapi_python_client/templates/helpers.jinja +3 -7
- openapi_python_client/templates/literal_enum.py.jinja +1 -1
- openapi_python_client/templates/model.py.jinja +18 -18
- openapi_python_client/templates/package_init.py.jinja +2 -2
- openapi_python_client/templates/property_templates/const_property.py.jinja +3 -3
- openapi_python_client/templates/property_templates/date_property.py.jinja +1 -1
- openapi_python_client/templates/property_templates/datetime_property.py.jinja +1 -1
- openapi_python_client/templates/property_templates/enum_property.py.jinja +1 -1
- openapi_python_client/templates/property_templates/file_property.py.jinja +1 -1
- openapi_python_client/templates/property_templates/list_property.py.jinja +3 -3
- openapi_python_client/templates/property_templates/literal_enum_property.py.jinja +2 -2
- openapi_python_client/templates/property_templates/model_property.py.jinja +1 -1
- openapi_python_client/templates/property_templates/property_macros.py.jinja +1 -1
- openapi_python_client/templates/property_templates/union_property.py.jinja +9 -9
- openapi_python_client/templates/property_templates/uuid_property.py.jinja +1 -1
- openapi_python_client/templates/pyproject_pdm.toml.jinja +3 -3
- openapi_python_client/templates/pyproject_poetry.toml.jinja +3 -3
- openapi_python_client/templates/pyproject_uv.toml.jinja +4 -4
- openapi_python_client/templates/setup.py.jinja +3 -3
- openapi_python_client/templates/str_enum.py.jinja +2 -2
- openapi_python_client/templates/types.py.jinja +2 -2
- {openapi_python_client-0.29.0.dist-info → openapi_python_client-0.30.0.dist-info}/METADATA +10 -9
- openapi_python_client-0.30.0.dist-info/RECORD +115 -0
- {openapi_python_client-0.29.0.dist-info → openapi_python_client-0.30.0.dist-info}/WHEEL +1 -1
- openapi_python_client/utils.py +0 -122
- openapi_python_client-0.29.0.dist-info/RECORD +0 -113
- {openapi_python_client-0.29.0.dist-info → openapi_python_client-0.30.0.dist-info}/entry_points.txt +0 -0
- {openapi_python_client-0.29.0.dist-info → openapi_python_client-0.30.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -8,10 +8,10 @@ check_{{ property.get_class_name_snake_case() }}({{ source }})
|
|
|
8
8
|
{{ construct_template(construct_function, property, source) }}
|
|
9
9
|
{% endmacro %}
|
|
10
10
|
|
|
11
|
-
{% macro check_type_for_construct(property, source) %}isinstance({{ source }}, {{ property.get_instance_type_string() }}){% endmacro %}
|
|
11
|
+
{% macro check_type_for_construct(property, source) %}isinstance({{ source }}, {{ property.get_instance_type_string() | as_unembedded_code }}){% endmacro %}
|
|
12
12
|
|
|
13
13
|
{% macro transform(property, source, destination, declare_type=True, skip_unset=False) %}
|
|
14
|
-
{% set type_string = property.get_type_string(json=True) %}
|
|
14
|
+
{% set type_string = property.get_type_string(json=True) | as_unembedded_code %}
|
|
15
15
|
{% if property.required %}
|
|
16
16
|
{{ destination }}{% if declare_type %}: {{ type_string }}{% endif %} = {{ source }}
|
|
17
17
|
{%- else %}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
{% macro transform(property, source, destination, declare_type=True, skip_unset=False) %}
|
|
14
14
|
{% set transformed = source + ".to_dict()" %}
|
|
15
|
-
{% set type_string = property.get_type_string(json=True) %}
|
|
15
|
+
{% set type_string = property.get_type_string(json=True) | as_unembedded_code %}
|
|
16
16
|
{% if property.required %}
|
|
17
17
|
{{ destination }} = {{ transformed }}
|
|
18
18
|
{%- else %}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{{ property.python_name }} = {{ construct_function(property, source) }}
|
|
4
4
|
{% else %}{# Must be non-required #}
|
|
5
5
|
_{{ property.python_name }} = {{ source }}
|
|
6
|
-
{{ property.python_name }}: {{ property.get_type_string() }}
|
|
6
|
+
{{ property.python_name }}: {{ property.get_type_string() | as_unembedded_code }}
|
|
7
7
|
{% if not property.required %}
|
|
8
8
|
if isinstance(_{{ property.python_name }}, Unset):
|
|
9
9
|
{{ property.python_name }} = UNSET
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{% macro construct(property, source) %}
|
|
2
|
-
def _parse_{{ property.python_name }}(data: object) -> {{ property.get_type_string() }}:
|
|
3
|
-
{% if "None" in property.get_type_strings_in_union(json=True) %}
|
|
2
|
+
def _parse_{{ property.python_name }}(data: object) -> {{ property.get_type_string() | as_unembedded_code }}:
|
|
3
|
+
{% if PythonCode("None") in property.get_type_strings_in_union(json=True) %}
|
|
4
4
|
if data is None:
|
|
5
5
|
return data
|
|
6
6
|
{% endif %}
|
|
7
|
-
{% if "Unset" in property.get_type_strings_in_union(json=True) %}
|
|
7
|
+
{% if PythonCode("Unset") in property.get_type_strings_in_union(json=True) %}
|
|
8
8
|
if isinstance(data, Unset):
|
|
9
9
|
return data
|
|
10
10
|
{% endif %}
|
|
@@ -33,7 +33,7 @@ def _parse_{{ property.python_name }}(data: object) -> {{ property.get_type_stri
|
|
|
33
33
|
{% endif %}
|
|
34
34
|
{% endfor %}
|
|
35
35
|
{% if ns.contains_unmodified_properties %}
|
|
36
|
-
return cast({{ property.get_type_string() }}, data)
|
|
36
|
+
return cast({{ property.get_type_string() | as_unembedded_code }}, data)
|
|
37
37
|
{% endif %}
|
|
38
38
|
|
|
39
39
|
{{ property.python_name }} = _parse_{{ property.python_name }}({{ source }})
|
|
@@ -41,7 +41,7 @@ def _parse_{{ property.python_name }}(data: object) -> {{ property.get_type_stri
|
|
|
41
41
|
|
|
42
42
|
{% macro transform(property, source, destination, declare_type=True, skip_unset=False) %}
|
|
43
43
|
{% set ns = namespace(contains_properties_without_transform = false, contains_modified_properties = not property.required, has_if = false) %}
|
|
44
|
-
{% if declare_type %}{{ destination }}: {{ property.get_type_string(json=True) }}{% endif %}
|
|
44
|
+
{% if declare_type %}{{ destination }}: {{ property.get_type_string(json=True) | as_unembedded_code }}{% endif %}
|
|
45
45
|
|
|
46
46
|
{% if not property.required and not skip_unset %}
|
|
47
47
|
if isinstance({{ source }}, Unset):
|
|
@@ -57,10 +57,10 @@ if isinstance({{ source }}, Unset):
|
|
|
57
57
|
{% set ns.contains_modified_properties = true %}
|
|
58
58
|
{% endif %}
|
|
59
59
|
{% if not ns.has_if %}
|
|
60
|
-
if isinstance({{ source }}, {{ inner_property.get_instance_type_string() }}):
|
|
60
|
+
if isinstance({{ source }}, {{ inner_property.get_instance_type_string() | as_unembedded_code }}):
|
|
61
61
|
{% set ns.has_if = true %}
|
|
62
62
|
{% elif not loop.last or ns.contains_properties_without_transform %}
|
|
63
|
-
elif isinstance({{ source }}, {{ inner_property.get_instance_type_string() }}):
|
|
63
|
+
elif isinstance({{ source }}, {{ inner_property.get_instance_type_string() | as_unembedded_code }}):
|
|
64
64
|
{% else %}
|
|
65
65
|
else:
|
|
66
66
|
{% endif %}
|
|
@@ -76,10 +76,10 @@ else:
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
{% macro instance_check(inner_property, source) %}
|
|
79
|
-
{% if inner_property.get_instance_type_string() == "None" %}
|
|
79
|
+
{% if inner_property.get_instance_type_string() == PythonCode("None") %}
|
|
80
80
|
if {{ source }} is None:
|
|
81
81
|
{% else %}
|
|
82
|
-
if isinstance({{ source }}, {{ inner_property.get_instance_type_string() }}):
|
|
82
|
+
if isinstance({{ source }}, {{ inner_property.get_instance_type_string() | as_unembedded_code }}):
|
|
83
83
|
{% endif %}
|
|
84
84
|
{% endmacro %}
|
|
85
85
|
|
|
@@ -17,7 +17,7 @@ UUID({{ source }})
|
|
|
17
17
|
{%- else %}
|
|
18
18
|
{% if not skip_unset %}
|
|
19
19
|
{% if declare_type %}
|
|
20
|
-
{% set type_annotation = property.get_type_string(json=True) %}
|
|
20
|
+
{% set type_annotation = property.get_type_string(json=True) | as_unembedded_code %}
|
|
21
21
|
{{ destination }}: {{ type_annotation }} = UNSET
|
|
22
22
|
{% else %}
|
|
23
23
|
{{ destination }} = UNSET
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "{{ project_name }}"
|
|
3
|
-
version = "{{ package_version }}"
|
|
4
|
-
description = "{{ package_description }}"
|
|
3
|
+
version = "{{ package_version | in_double_quote_literal }}"
|
|
4
|
+
description = "{{ package_description | in_double_quote_literal }}"
|
|
5
5
|
authors = []
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
requires-python = ">=3.11"
|
|
8
8
|
dependencies = [
|
|
9
|
-
"
|
|
9
|
+
"httpx2>=2.13.1,<3",
|
|
10
10
|
"attrs>=22.2.0",
|
|
11
11
|
]
|
|
12
12
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "{{ project_name }}"
|
|
3
|
-
version = "{{ package_version }}"
|
|
4
|
-
description = "{{ package_description }}"
|
|
3
|
+
version = "{{ package_version | in_double_quote_literal }}"
|
|
4
|
+
description = "{{ package_description | in_double_quote_literal }}"
|
|
5
5
|
authors = []
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
packages = [
|
|
@@ -11,7 +11,7 @@ include = ["{{ package_name }}/py.typed"]
|
|
|
11
11
|
|
|
12
12
|
[tool.poetry.dependencies]
|
|
13
13
|
python = "^3.11"
|
|
14
|
-
|
|
14
|
+
httpx2 = ">=2.13.1,<3"
|
|
15
15
|
attrs = ">=22.2.0"
|
|
16
16
|
|
|
17
17
|
[build-system]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "{{ project_name }}"
|
|
3
|
-
version = "{{ package_version }}"
|
|
4
|
-
description = "{{ package_description }}"
|
|
3
|
+
version = "{{ package_version | in_double_quote_literal }}"
|
|
4
|
+
description = "{{ package_description | in_double_quote_literal }}"
|
|
5
5
|
authors = []
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
dependencies = [
|
|
9
|
-
"
|
|
9
|
+
"httpx2>=2.13.1,<3",
|
|
10
10
|
"attrs>=22.2.0",
|
|
11
11
|
]
|
|
12
12
|
|
|
@@ -15,5 +15,5 @@ module-name = "{{ package_name }}"
|
|
|
15
15
|
module-root = ""
|
|
16
16
|
|
|
17
17
|
[build-system]
|
|
18
|
-
requires = ["uv_build>=0.
|
|
18
|
+
requires = ["uv_build>=0.13.0,<0.14.0"]
|
|
19
19
|
build-backend = "uv_build"
|
|
@@ -7,12 +7,12 @@ long_description = (here / "README.md").read_text(encoding="utf-8")
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="{{ project_name }}",
|
|
10
|
-
version="{{ package_version }}",
|
|
11
|
-
description="{{ package_description }}",
|
|
10
|
+
version="{{ package_version | in_double_quote_literal }}",
|
|
11
|
+
description="{{ package_description | in_double_quote_literal }}",
|
|
12
12
|
long_description=long_description,
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
14
14
|
packages=find_packages(),
|
|
15
15
|
python_requires=">=3.11, <4",
|
|
16
|
-
install_requires=["
|
|
16
|
+
install_requires=["httpx2 >= 2.13.1, < 3", "attrs >= 22.2.0"],
|
|
17
17
|
package_data={"{{ package_name }}": ["py.typed"]},
|
|
18
18
|
)
|
|
@@ -14,7 +14,7 @@ class Unset:
|
|
|
14
14
|
|
|
15
15
|
UNSET: Unset = Unset()
|
|
16
16
|
|
|
17
|
-
# The types that `
|
|
17
|
+
# The types that `httpx2.Client(files=)` can accept, copied from that library.
|
|
18
18
|
FileContent = IO[bytes] | bytes | str
|
|
19
19
|
FileTypes = (
|
|
20
20
|
# (filename, file (or bytes), content_type)
|
|
@@ -33,7 +33,7 @@ class File:
|
|
|
33
33
|
mime_type: str | None = None
|
|
34
34
|
|
|
35
35
|
def to_tuple(self) -> FileTypes:
|
|
36
|
-
""" Return a tuple representation that
|
|
36
|
+
""" Return a tuple representation that httpx2 will accept for multipart/form-data """
|
|
37
37
|
return self.file_name, self.payload, self.mime_type
|
|
38
38
|
|
|
39
39
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: openapi-python-client
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.30.0
|
|
4
4
|
Summary: Generate modern Python clients from OpenAPI
|
|
5
5
|
Project-URL: repository, https://github.com/openapi-generators/openapi-python-client
|
|
6
6
|
Author-email: Dylan Anthony <contact@dylananthony.com>
|
|
7
|
-
License: MIT
|
|
7
|
+
License-Expression: MIT
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Keywords: Client,Generator,OpenAPI
|
|
10
10
|
Classifier: Development Status :: 4 - Beta
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
12
|
Classifier: Programming Language :: Python :: 3
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -20,13 +19,13 @@ Classifier: Typing :: Typed
|
|
|
20
19
|
Requires-Python: <4.0,>=3.11
|
|
21
20
|
Requires-Dist: attrs>=22.2.0
|
|
22
21
|
Requires-Dist: colorama>=0.4.3; sys_platform == 'win32'
|
|
23
|
-
Requires-Dist:
|
|
22
|
+
Requires-Dist: httpx2<3,>=2.13.1
|
|
24
23
|
Requires-Dist: jinja2<4.0.0,>=3.0.0
|
|
25
24
|
Requires-Dist: pydantic<3.0.0,>=2.10
|
|
26
25
|
Requires-Dist: ruamel-yaml<0.20.0,>=0.18.6
|
|
27
26
|
Requires-Dist: ruff>=0.2
|
|
28
27
|
Requires-Dist: shellingham<2.0.0,>=1.3.2
|
|
29
|
-
Requires-Dist: typer<0.
|
|
28
|
+
Requires-Dist: typer<0.28,>0.16
|
|
30
29
|
Description-Content-Type: text/markdown
|
|
31
30
|
|
|
32
31
|

|
|
@@ -92,7 +91,8 @@ _Be forewarned, this is a beta-level feature in the sense that the API exposed i
|
|
|
92
91
|
|
|
93
92
|
## What You Get
|
|
94
93
|
|
|
95
|
-
1. A `pyproject.toml` file, optionally with [Poetry] metadata (default), [
|
|
94
|
+
1. A `pyproject.toml` file, optionally with [Poetry] metadata (default), [uv] (with `--meta=uv`), [PDM]
|
|
95
|
+
(with `--meta=pdm`), or only [Ruff] config.
|
|
96
96
|
2. A `README.md` you'll most definitely need to update with your project's details
|
|
97
97
|
3. A Python module named just like the auto-generated project name (e.g. "my_api_client") which contains:
|
|
98
98
|
1. A `client` module which will have both a `Client` class and an `AuthenticatedClient` class. You'll need these
|
|
@@ -231,7 +231,7 @@ This extension has been adopted by similar projects such as [OpenAPI Tools](http
|
|
|
231
231
|
It is intended to provide user-friendly names for integer Enum members that get generated.
|
|
232
232
|
It is critical that the length of the array matches that of the enum values.
|
|
233
233
|
|
|
234
|
-
```
|
|
234
|
+
```json
|
|
235
235
|
"Colors": {
|
|
236
236
|
"type": "integer",
|
|
237
237
|
"format": "int32",
|
|
@@ -249,7 +249,7 @@ It is critical that the length of the array matches that of the enum values.
|
|
|
249
249
|
```
|
|
250
250
|
|
|
251
251
|
Results in:
|
|
252
|
-
```
|
|
252
|
+
```python
|
|
253
253
|
class Color(IntEnum):
|
|
254
254
|
RED = 0
|
|
255
255
|
GREEN = 1
|
|
@@ -258,5 +258,6 @@ class Color(IntEnum):
|
|
|
258
258
|
|
|
259
259
|
[changelog.md]: CHANGELOG.md
|
|
260
260
|
[poetry]: https://python-poetry.org/
|
|
261
|
+
[uv]: https://docs.astral.sh/uv/
|
|
261
262
|
[PDM]: https://pdm-project.org/latest/
|
|
262
263
|
[Ruff]: https://docs.astral.sh/ruff/
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
openapi_python_client/__init__.py,sha256=wyb-Efn6ZGhZmpaVtBsfTlPFzhqOguyDTKwCIgt6xpc,14562
|
|
2
|
+
openapi_python_client/__main__.py,sha256=wcCrL4PjG51r5wVKqJhcoJPTLfHW0wNbD31DrUN0MWI,28
|
|
3
|
+
openapi_python_client/cli.py,sha256=9lGfusepcXWa-1Z6rQef2RsDZt3m8pSCTzYH3-rd9nY,5637
|
|
4
|
+
openapi_python_client/config.py,sha256=FQXr4nHBopytMtSpjvhxn1rTJiFpgZnNXkP93QD0wT0,4247
|
|
5
|
+
openapi_python_client/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
|
6
|
+
openapi_python_client/strings.py,sha256=1Oo4Y7bgDw-Y8v8BSpbHiSMV-kWcs1XXhp-5pGS1F-U,9702
|
|
7
|
+
openapi_python_client/parser/__init__.py,sha256=dpY1jYmWFPBubtjKCZIlg2uHC_DLC-KpfuMNdQF8RUc,177
|
|
8
|
+
openapi_python_client/parser/bodies.py,sha256=M2uRhnyfK904mzsAb6bxDb6fE1oCDYGgc9HLU_a6FDY,4664
|
|
9
|
+
openapi_python_client/parser/errors.py,sha256=COPpNRWjPGUWlgebwJetBhuVy2NkHQ63WWKJ9Skcimw,1191
|
|
10
|
+
openapi_python_client/parser/openapi.py,sha256=Up0JwnFHNU-v78BHZ9OwR1nwfAWabiNGqtsnhY6jzLU,23877
|
|
11
|
+
openapi_python_client/parser/responses.py,sha256=lXG0Y3nKBkQCr4RA12U5uzqnHShgNJwrQI1qi-uDBDI,9017
|
|
12
|
+
openapi_python_client/parser/properties/__init__.py,sha256=cpm7BTL0g6rtylTElRH4YDNL-dkbgZpvxV4Q7N3MqbM,17565
|
|
13
|
+
openapi_python_client/parser/properties/any.py,sha256=dSYBV8rDcodubsovnpHCSIzodeSA9Mgy8nV8V8Gm3cU,1543
|
|
14
|
+
openapi_python_client/parser/properties/boolean.py,sha256=zCSiJ5q3fx2dy1FHGxirMkU1ZC6APPiyVPH8IVJXq0g,2235
|
|
15
|
+
openapi_python_client/parser/properties/const.py,sha256=saY5coCj49gNmUKc3-NmFZtCJG0uny0zovtseyaORLw,3910
|
|
16
|
+
openapi_python_client/parser/properties/date.py,sha256=9eoXtLM743ewCylwUVfXTqVNCEuZ6pu3gYU4JOtdSvY,2516
|
|
17
|
+
openapi_python_client/parser/properties/datetime.py,sha256=PlWYzuNplsyrSgM4rkTNMF0kMQrG6Rf6kPHiipyFZ5Q,2566
|
|
18
|
+
openapi_python_client/parser/properties/enum_property.py,sha256=6uScve1WE10yl1Jb15TUtLohsm_NZlqi4FM5-4Ix8Jc,9107
|
|
19
|
+
openapi_python_client/parser/properties/file.py,sha256=N3GFQVYsVX2EYtmlvDkxmenaItcj5OHtJrMblV8QCjc,2169
|
|
20
|
+
openapi_python_client/parser/properties/float.py,sha256=3XxqD6yrsWXbDhABvN_YViTeBqCMPEk5kcD_5Gk-SlQ,2394
|
|
21
|
+
openapi_python_client/parser/properties/int.py,sha256=3FfAMCWnno0F894uC8D_b_dat3Pr75L9n1rlr9gd5oQ,2369
|
|
22
|
+
openapi_python_client/parser/properties/list_property.py,sha256=z2N2rS_08f_AsSL3KO7gMv8l7HzZkNVqkgtuMlJRYys,5967
|
|
23
|
+
openapi_python_client/parser/properties/literal_enum_property.py,sha256=QfALmZ3Q05uoHl68aYyQ0TJXsv7p7QkF0RxfwNeKTw8,7712
|
|
24
|
+
openapi_python_client/parser/properties/merge_properties.py,sha256=x4TDQUXB6D6Ae1r27yZldN9q-lz56tEnObHlnZiEY0E,9773
|
|
25
|
+
openapi_python_client/parser/properties/model_property.py,sha256=m_0YC3Spij6Wf7ADtjwdMQUdFP48Hcf_E4dx3OeSeGQ,17345
|
|
26
|
+
openapi_python_client/parser/properties/none.py,sha256=dKw-GVlqASMDmo3SYUZVWNdBQfHb6dtx7wavQyM3gLQ,1923
|
|
27
|
+
openapi_python_client/parser/properties/property.py,sha256=tUNaC-96EKSqpuqW_4NeEp9LG7_PMUeE0DOkIXU89M0,971
|
|
28
|
+
openapi_python_client/parser/properties/protocol.py,sha256=rY2QbKysLiOrmODoh76gcMmZxxanj8BrCFMtv4yzBQk,7181
|
|
29
|
+
openapi_python_client/parser/properties/schemas.py,sha256=Ohhw3YsluuO-VKOBjMj-uk0GoJJXDWmfX-UWLLrODLM,9129
|
|
30
|
+
openapi_python_client/parser/properties/string.py,sha256=LkeVmi_J06h1p6hqkFlk2IjlYxJpUCGpfgZuO5tQSrY,2059
|
|
31
|
+
openapi_python_client/parser/properties/union.py,sha256=4VTvSwgXXaWQdjkVZkB_FpktpQh3BI826DiOs7Wgx9s,9097
|
|
32
|
+
openapi_python_client/parser/properties/uuid.py,sha256=_3rI6XrsZw5TphW3CdZh97HcKJrVMoARggJZjr4ed-M,2621
|
|
33
|
+
openapi_python_client/schema/3.0.3.md,sha256=0a25-q_HFDVcsxOnMOGeTo67K4FtLHqMfI5U8VwneJg,126244
|
|
34
|
+
openapi_python_client/schema/3.1.0.md,sha256=O4SlQ2wux5Sa68Q9jrCcZYEJ5RcqXniJ9pSixtR15Rc,131397
|
|
35
|
+
openapi_python_client/schema/__init__.py,sha256=BR4j82a9atqOI14sUEvO27CtcO8e-O4MKj5z2cbl8DY,559
|
|
36
|
+
openapi_python_client/schema/data_type.py,sha256=-YJVw_47psCr57Jd-A2o20zltksb-gNJBBwjXz6SYdU,452
|
|
37
|
+
openapi_python_client/schema/parameter_location.py,sha256=JhMzMAIwDWsQ7nzYLUhIZCZ666Z8bdhYXzsjV01jAos,212
|
|
38
|
+
openapi_python_client/schema/ref.py,sha256=7qMjQDwESS-2NgFkE3loNuKe4KFesyoqUQ-D0V8ESsg,1805
|
|
39
|
+
openapi_python_client/schema/untrusted_string.py,sha256=Bn_9SvLUNwOp520GXjj1XH7ALMKoS9tldl6_wVxFXQ4,1994
|
|
40
|
+
openapi_python_client/schema/openapi_schema_pydantic/LICENSE,sha256=yoy6owJ7bArVSVjpCNoU0zuGiN3LAxqNVQ1_ZAumOf8,1064
|
|
41
|
+
openapi_python_client/schema/openapi_schema_pydantic/README.md,sha256=LamzQvAYwLzJxutVBn1hffpquePeKoJdqZSXKfzwE_s,1996
|
|
42
|
+
openapi_python_client/schema/openapi_schema_pydantic/__init__.py,sha256=n06seSNejSl9FhIBZ-RGUp0hLEz9adX1Hdbhjg3OqJY,2076
|
|
43
|
+
openapi_python_client/schema/openapi_schema_pydantic/callback.py,sha256=5dB6pDrZjJSYI2gAEOOm76qQO7GyJPCaRueKPJiG9Os,628
|
|
44
|
+
openapi_python_client/schema/openapi_schema_pydantic/components.py,sha256=gfVGNfBh5aduiVOXWr-RRLi0mzSgpLECS_MYjhODnqU,4666
|
|
45
|
+
openapi_python_client/schema/openapi_schema_pydantic/contact.py,sha256=_ZILAjFbZfdGmVl11JpbOaQvk2aFFwkZpawugu1SFEs,692
|
|
46
|
+
openapi_python_client/schema/openapi_schema_pydantic/discriminator.py,sha256=n7w3U48A7AlCWlq2OX_suJhXCIwNpkvPQUaPswmgHN0,1330
|
|
47
|
+
openapi_python_client/schema/openapi_schema_pydantic/encoding.py,sha256=DIBc5W88LVaAZdrquLy7061x7lmPqGwAQtau4evKyLA,1384
|
|
48
|
+
openapi_python_client/schema/openapi_schema_pydantic/example.py,sha256=U5Tu0IVtBEed75i7UqlVZnpwhYv7BzYBUx5yZsVBRqc,1085
|
|
49
|
+
openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py,sha256=r9bthU1OCCgeNG7cx_CqyOjqcgdQK6Ki6J3ZTI2YrXU,616
|
|
50
|
+
openapi_python_client/schema/openapi_schema_pydantic/header.py,sha256=t1i4x_XUXPgBhC1CXkXA-0rd5nAaRhRp372SecKAiWI,1775
|
|
51
|
+
openapi_python_client/schema/openapi_schema_pydantic/info.py,sha256=seExa-tTSYnt5mxnMQurS0DuiC2Psiqqe_YYFSQB1ag,1532
|
|
52
|
+
openapi_python_client/schema/openapi_schema_pydantic/license.py,sha256=jl6EiBj7cnV2do_MQuOsYMF0pDswQiDsk4OgZ13zXD8,567
|
|
53
|
+
openapi_python_client/schema/openapi_schema_pydantic/link.py,sha256=TlrTy7U8mQc208_GFsJCjAZBXVILyWEUulgQ7At6wSg,1742
|
|
54
|
+
openapi_python_client/schema/openapi_schema_pydantic/media_type.py,sha256=CqZU2j0NJKelWVkK86kfEtFEiGczrewbHM6WsEZMz_o,2143
|
|
55
|
+
openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py,sha256=Lujk-yjueT6l7RH9gY3lLqRSuZ9w3Wi-wMBJWYOX7U8,1231
|
|
56
|
+
openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py,sha256=GpK7P2q8ttCDqqqopGSqNEmUVpQbHMRZdibNMNxfAnE,584
|
|
57
|
+
openapi_python_client/schema/openapi_schema_pydantic/open_api.py,sha256=ladRUDYu9ruUcK7npyASOfDyX-XlL5Iq8iT89-JjpTA,1754
|
|
58
|
+
openapi_python_client/schema/openapi_schema_pydantic/operation.py,sha256=-JmCK2odofOHFzmcDQsm6bJC35Wz39IKlXu-uyUaEzc,3672
|
|
59
|
+
openapi_python_client/schema/openapi_schema_pydantic/parameter.py,sha256=DcqzRplOUTbwUWNVAFCw4x8TdoB59PGinrANJskG9o0,3317
|
|
60
|
+
openapi_python_client/schema/openapi_schema_pydantic/path_item.py,sha256=U1ImA6thYxkX9ZAJP1Q7X8WHA-4NRuQHNHfMW_wwBgQ,3001
|
|
61
|
+
openapi_python_client/schema/openapi_schema_pydantic/paths.py,sha256=JMsWkjxkKgU1tUUr2vqG5lbL1OxKOMytsmiNyXiEimE,554
|
|
62
|
+
openapi_python_client/schema/openapi_schema_pydantic/reference.py,sha256=V_cJ60q8t-fcIZih0xL4pWQeuUFIV_JuawXt-ceI6DY,1504
|
|
63
|
+
openapi_python_client/schema/openapi_schema_pydantic/request_body.py,sha256=DOVbvez6UXjwKXpMb9gVPpxfzWVYnMA8Wq7qv4JozJw,2821
|
|
64
|
+
openapi_python_client/schema/openapi_schema_pydantic/response.py,sha256=AQYlgdDnqUpLWk4Gu73oiL8TpGrbgDqfq-PO0EGuyXE,2517
|
|
65
|
+
openapi_python_client/schema/openapi_schema_pydantic/responses.py,sha256=VlnFD1Uz8DWbdNVO-DxDyv8EI-7O5_D6RTda2Btv-Y8,868
|
|
66
|
+
openapi_python_client/schema/openapi_schema_pydantic/schema.py,sha256=vwTDoYxR8GGO_BNxBQwMtcNoiaMfHRC2iLBJKihWCGs,8954
|
|
67
|
+
openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py,sha256=89WK-8Zlfyx4P_-ySSXdzsOMqqDFWCwt-UitCt-EZ90,942
|
|
68
|
+
openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py,sha256=5i4o0Kky-5qpVQf9CweHGondjFoprTgDj68HkXh4_pc,1952
|
|
69
|
+
openapi_python_client/schema/openapi_schema_pydantic/server.py,sha256=NX_0Dqp51OFjRroMj6vJxA0TW2DE2Kt1zn2ny64tkps,1436
|
|
70
|
+
openapi_python_client/schema/openapi_schema_pydantic/server_variable.py,sha256=6c-h_HB28HqCZ0lBFOyex3SBTKVFL_TAcaU-EhMYdsc,581
|
|
71
|
+
openapi_python_client/schema/openapi_schema_pydantic/tag.py,sha256=99HECCPoDxgHvvD1_7s5lnCrJnaXy9eUO1UJv6eZHc0,829
|
|
72
|
+
openapi_python_client/schema/openapi_schema_pydantic/xml.py,sha256=8OePi0SrUiv9PhJqiVS34RgvhoeFWjECsc9XPECHJYE,1054
|
|
73
|
+
openapi_python_client/templates/.gitignore.jinja,sha256=SwZvl9qyKaHN9YjwaQrBsmpAclN11usf9Gohz1SFVg8,195
|
|
74
|
+
openapi_python_client/templates/README.md.jinja,sha256=DDErcO12YzXqzi2N7OUbl3CHW9Dof4QD1xrskh1ifFs,5981
|
|
75
|
+
openapi_python_client/templates/api_init.py.jinja,sha256=87ApBzKyGb5zsgTMOkQXDqsLZCmaSFoJMwbGzCDQZMw,47
|
|
76
|
+
openapi_python_client/templates/client.py.jinja,sha256=gLlBoj7XFhXLwZtv6Z3TBqV0VXgULCIkTL44Te6ibwY,8327
|
|
77
|
+
openapi_python_client/templates/endpoint_init.py.jinja,sha256=wYN6A3_bvYW13B1J9YvYCmcv5Els-q-E07kZJwJ7Vto,58
|
|
78
|
+
openapi_python_client/templates/endpoint_macros.py.jinja,sha256=6-IMqumJz2kUiRN4mD-WqQk3GqRgoXEzMVJZU-oW0mk,7709
|
|
79
|
+
openapi_python_client/templates/endpoint_module.py.jinja,sha256=6oX1DyrWCn7Ecq0NiLY32Lnr3yqTIs99e3hUCzpz9N4,5270
|
|
80
|
+
openapi_python_client/templates/errors.py.jinja,sha256=trp-p5qn1_JLRxGZhdHtICaNPaCrcDCe4TgIihBravk,546
|
|
81
|
+
openapi_python_client/templates/helpers.jinja,sha256=Tmrae3qIBuc5-qex8zDB2yuSQYCjAD3wpOBI7ctUnwI,210
|
|
82
|
+
openapi_python_client/templates/int_enum.py.jinja,sha256=z4d2hVsdgmlxUB1fbVs4w8tJaq2SdmhLjs4mjbZ5GLw,224
|
|
83
|
+
openapi_python_client/templates/literal_enum.py.jinja,sha256=BPLrkzTdVDq3-pGh_jpz59Xyz1DgnYZEKd21jlBsi2g,641
|
|
84
|
+
openapi_python_client/templates/model.py.jinja,sha256=_Rx5aA1RwGz7uJgJrRI3ULqa3Zi2iANsBMq78fi6QKA,8689
|
|
85
|
+
openapi_python_client/templates/models_init.py.jinja,sha256=T2Sj1uGxWlYb5Vc8G3cC65KMDk-mtnEH0g5Xp0xE1Ro,233
|
|
86
|
+
openapi_python_client/templates/package_init.py.jinja,sha256=rBWQfjLcOb2bg-pvIAL7h1FPIYK5f4gjG1qcRzIfYhA,207
|
|
87
|
+
openapi_python_client/templates/pyproject.toml.jinja,sha256=rBaFq0oqlGeW-NesqPeF_BGCnEEB4P2Qq95vIrGOFQQ,255
|
|
88
|
+
openapi_python_client/templates/pyproject_pdm.toml.jinja,sha256=hjI2PbsAuT8jSQDDwlcfHhyTsBsVyaX4GpIDos01C3Q,397
|
|
89
|
+
openapi_python_client/templates/pyproject_poetry.toml.jinja,sha256=8hvtbGz_DZn6qN5PjtpydkpH86GZNKwEzW8cA0tLcxo,487
|
|
90
|
+
openapi_python_client/templates/pyproject_ruff.toml.jinja,sha256=OgFfCd9Ca3YsU8WdCxqJoJdCJEtzADpxAxfMghqzn80,74
|
|
91
|
+
openapi_python_client/templates/pyproject_uv.toml.jinja,sha256=iukty-eMzWEcHxRO2y34MucZuHgI6k6Dqme8H1ZugSQ,452
|
|
92
|
+
openapi_python_client/templates/setup.py.jinja,sha256=vCqtCLQ_Hj0IHjpo3VomVrrQogSVYe2ssU8TJkYjnAM,627
|
|
93
|
+
openapi_python_client/templates/str_enum.py.jinja,sha256=5JeaXmszg1HtqL2sU0AXz761GoCbSU_TxjLbOUFIF_w,233
|
|
94
|
+
openapi_python_client/templates/types.py.jinja,sha256=1YN_lyNzGx5BDFJTg-TaiVRAXij-DDvHnrmBa9B-D8M,1352
|
|
95
|
+
openapi_python_client/templates/property_templates/any_property.py.jinja,sha256=H1-aMl9Mxs9z-gXQUw9MCNNrGYewG1p0s43flY4YHtA,135
|
|
96
|
+
openapi_python_client/templates/property_templates/boolean_property.py.jinja,sha256=3xghrbqSeUh-Qk1vdaWb_RxGOBNjhfKFf9EBOmMOBzU,225
|
|
97
|
+
openapi_python_client/templates/property_templates/const_property.py.jinja,sha256=0paITBHzqvrWdy2Mtx3go9CK02ya0ZfA5ycIL4bzJlk,651
|
|
98
|
+
openapi_python_client/templates/property_templates/date_property.py.jinja,sha256=knWVwF18qoAE3D8OydjxLXncavudCrKtUr8fioSkXhc,1141
|
|
99
|
+
openapi_python_client/templates/property_templates/datetime_property.py.jinja,sha256=x4nRHY6ibLWrY3RwscEQSWUr9kOENONjJSEuQDBNf_k,1165
|
|
100
|
+
openapi_python_client/templates/property_templates/enum_property.py.jinja,sha256=KPEHS91fDX5mYYx-PltuO3VGet8lqXGSKQXfC_Pc8SY,1171
|
|
101
|
+
openapi_python_client/templates/property_templates/file_property.py.jinja,sha256=x-SnVrFRCIha49rBDDMKjQk79CIV-AzvsBL6X3XboKo,972
|
|
102
|
+
openapi_python_client/templates/property_templates/float_property.py.jinja,sha256=vMZbRtomIEPvnKy95fT4QNQRrufv5xgdSnZ97xSN38U,207
|
|
103
|
+
openapi_python_client/templates/property_templates/helpers.jinja,sha256=oyHJU9cQGhsY7Xf1Q7OapX6G4mW3qRNUX2wFKhK2Mxs,395
|
|
104
|
+
openapi_python_client/templates/property_templates/int_property.py.jinja,sha256=vMZbRtomIEPvnKy95fT4QNQRrufv5xgdSnZ97xSN38U,207
|
|
105
|
+
openapi_python_client/templates/property_templates/list_property.py.jinja,sha256=Q5C19nP9sQ0a5_R_0nIKiNzlOkxkphN1SVWVZvkQeiw,2870
|
|
106
|
+
openapi_python_client/templates/property_templates/literal_enum_property.py.jinja,sha256=GzCWtxhyRs9COD255lkmnhhhsqVLJsuDfpvct4hpNjA,1209
|
|
107
|
+
openapi_python_client/templates/property_templates/model_property.py.jinja,sha256=n279v7YhLuTLryUUnCddBLJiywPcacMbwwEoKlgWf2g,1412
|
|
108
|
+
openapi_python_client/templates/property_templates/property_macros.py.jinja,sha256=x5qZVFeZAqIU18rs9bfACRLR8guUEjjSkAmfywJyM_k,601
|
|
109
|
+
openapi_python_client/templates/property_templates/union_property.py.jinja,sha256=A3kPJxDerrIZwY5RiuGDrUpB7aH3jPYl0Tnt_3VGzSY,4324
|
|
110
|
+
openapi_python_client/templates/property_templates/uuid_property.py.jinja,sha256=5WURNZ-NPGiFjH-AcYKZzMS8lmO1zLgCtf1HLMiD2aI,1096
|
|
111
|
+
openapi_python_client-0.30.0.dist-info/METADATA,sha256=eagnZ6tNiaJJ7ES4ZsotOnb_dhrNgg-ZuniFkr13zl4,11618
|
|
112
|
+
openapi_python_client-0.30.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
113
|
+
openapi_python_client-0.30.0.dist-info/entry_points.txt,sha256=iRfSdN2foASZXr8GghkYa6KRXkDgO0EFfLut5IXoBTU,72
|
|
114
|
+
openapi_python_client-0.30.0.dist-info/licenses/LICENSE,sha256=4dpxQYqY0DB3aTauRrqYRuu6BVNsPSJdYeUT3sH6pQY,1075
|
|
115
|
+
openapi_python_client-0.30.0.dist-info/RECORD,,
|
openapi_python_client/utils.py
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import builtins
|
|
4
|
-
import re
|
|
5
|
-
from email.message import Message
|
|
6
|
-
from keyword import iskeyword
|
|
7
|
-
from typing import Any
|
|
8
|
-
|
|
9
|
-
from .config import Config
|
|
10
|
-
|
|
11
|
-
DELIMITERS = r"\. _-"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class PythonIdentifier(str):
|
|
15
|
-
"""A snake_case string which has been validated / transformed into a valid identifier for Python"""
|
|
16
|
-
|
|
17
|
-
def __new__(cls, value: str, prefix: str, skip_snake_case: bool = False) -> PythonIdentifier:
|
|
18
|
-
new_value = sanitize(value)
|
|
19
|
-
if not skip_snake_case:
|
|
20
|
-
new_value = snake_case(new_value)
|
|
21
|
-
new_value = fix_reserved_words(new_value)
|
|
22
|
-
|
|
23
|
-
if not new_value.isidentifier() or value.startswith("_"):
|
|
24
|
-
new_value = f"{prefix}{new_value}"
|
|
25
|
-
return str.__new__(cls, new_value)
|
|
26
|
-
|
|
27
|
-
def __deepcopy__(self, _: Any) -> PythonIdentifier:
|
|
28
|
-
return self
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class ClassName(str):
|
|
32
|
-
"""A PascalCase string which has been validated / transformed into a valid class name for Python"""
|
|
33
|
-
|
|
34
|
-
def __new__(cls, value: str, prefix: str) -> ClassName:
|
|
35
|
-
new_value = fix_reserved_words(pascal_case(sanitize(value)))
|
|
36
|
-
|
|
37
|
-
if not new_value.isidentifier():
|
|
38
|
-
value = f"{prefix}{new_value}"
|
|
39
|
-
new_value = fix_reserved_words(pascal_case(sanitize(value)))
|
|
40
|
-
return str.__new__(cls, new_value)
|
|
41
|
-
|
|
42
|
-
def __deepcopy__(self, _: Any) -> ClassName:
|
|
43
|
-
return self
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def sanitize(value: str) -> str:
|
|
47
|
-
"""Removes every character that isn't 0-9, A-Z, a-z, or a known delimiter"""
|
|
48
|
-
return re.sub(rf"[^\w{DELIMITERS}]+", "", value)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def split_words(value: str) -> list[str]:
|
|
52
|
-
"""Split a string on words and known delimiters"""
|
|
53
|
-
# We can't guess words if there is no capital letter
|
|
54
|
-
if any(c.isupper() for c in value):
|
|
55
|
-
value = " ".join(re.split("([A-Z]?[a-z]+)", value))
|
|
56
|
-
return re.findall(rf"[^{DELIMITERS}]+", value)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
RESERVED_WORDS = (set(dir(builtins)) | {"self", "true", "false", "datetime"}) - {
|
|
60
|
-
"id",
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def fix_reserved_words(value: str) -> str:
|
|
65
|
-
"""
|
|
66
|
-
Using reserved Python words as identifiers in generated code causes problems, so this function renames them.
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
value: The identifier to-be that should be renamed if it's a reserved word.
|
|
70
|
-
|
|
71
|
-
Returns:
|
|
72
|
-
`value` suffixed with `_` if it was a reserved word.
|
|
73
|
-
"""
|
|
74
|
-
if value in RESERVED_WORDS or iskeyword(value):
|
|
75
|
-
return f"{value}_"
|
|
76
|
-
return value
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def snake_case(value: str) -> str:
|
|
80
|
-
"""Converts to snake_case"""
|
|
81
|
-
words = split_words(sanitize(value))
|
|
82
|
-
return "_".join(words).lower()
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def pascal_case(value: str) -> str:
|
|
86
|
-
"""Converts to PascalCase"""
|
|
87
|
-
words = split_words(sanitize(value))
|
|
88
|
-
capitalized_words = (word.capitalize() if not word.isupper() else word for word in words)
|
|
89
|
-
return "".join(capitalized_words)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def kebab_case(value: str) -> str:
|
|
93
|
-
"""Converts to kebab-case"""
|
|
94
|
-
words = split_words(sanitize(value))
|
|
95
|
-
return "-".join(words).lower()
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def remove_string_escapes(value: str) -> str:
|
|
99
|
-
"""Used when parsing string-literal defaults to prevent escaping the string to write arbitrary Python
|
|
100
|
-
|
|
101
|
-
**REMOVING OR CHANGING THE USAGE OF THIS FUNCTION HAS SECURITY IMPLICATIONS**
|
|
102
|
-
|
|
103
|
-
See Also:
|
|
104
|
-
- https://github.com/openapi-generators/openapi-python-client/security/advisories/GHSA-9x4c-63pf-525f
|
|
105
|
-
"""
|
|
106
|
-
return value.replace('"', r"\"")
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
def get_content_type(content_type: str, config: Config) -> str | None:
|
|
110
|
-
"""
|
|
111
|
-
Given a string representing a content type with optional parameters, returns the content type only
|
|
112
|
-
"""
|
|
113
|
-
content_type = config.content_type_overrides.get(content_type, content_type)
|
|
114
|
-
message = Message()
|
|
115
|
-
message.add_header("Content-Type", content_type)
|
|
116
|
-
|
|
117
|
-
parsed_content_type = message.get_content_type()
|
|
118
|
-
if not content_type.startswith(parsed_content_type):
|
|
119
|
-
# Always defaults to `text/plain` if it's not recognized. We want to return an error, not default.
|
|
120
|
-
return None
|
|
121
|
-
|
|
122
|
-
return parsed_content_type
|