Skip to content

Commit af9c9fa

Browse files
committed
Remove now-dead code
1 parent e798afe commit af9c9fa

File tree

8 files changed

+12
-26
lines changed

8 files changed

+12
-26
lines changed

openapi_python_client/parser/properties/const.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ def get_type_string(
9494
no_optional: bool = False,
9595
json: bool = False,
9696
*,
97-
multipart: bool = False,
9897
quoted: bool = False,
9998
) -> str:
10099
lit = f"Literal[{self.value.python_code}]"

openapi_python_client/parser/properties/list_property.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ def get_type_string(
138138
no_optional: bool = False,
139139
json: bool = False,
140140
*,
141-
multipart: bool = False,
142141
quoted: bool = False,
143142
) -> str:
144143
"""
@@ -150,8 +149,6 @@ def get_type_string(
150149
"""
151150
if json:
152151
type_string = self.get_base_json_type_string()
153-
elif multipart:
154-
type_string = "tuple[None, bytes, str]"
155152
else:
156153
type_string = self.get_base_type_string()
157154

openapi_python_client/parser/properties/model_property.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ def get_type_string(
189189
no_optional: bool = False,
190190
json: bool = False,
191191
*,
192-
multipart: bool = False,
193192
quoted: bool = False,
194193
) -> str:
195194
"""
@@ -201,8 +200,6 @@ def get_type_string(
201200
"""
202201
if json:
203202
type_string = self.get_base_json_type_string()
204-
elif multipart:
205-
type_string = "tuple[None, bytes, str]"
206203
else:
207204
type_string = self.get_base_type_string()
208205

openapi_python_client/parser/properties/protocol.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def get_type_string(
101101
no_optional: bool = False,
102102
json: bool = False,
103103
*,
104-
multipart: bool = False,
105104
quoted: bool = False,
106105
) -> str:
107106
"""
@@ -110,13 +109,10 @@ def get_type_string(
110109
Args:
111110
no_optional: Do not include Optional or Unset even if the value is optional (needed for isinstance checks)
112111
json: True if the type refers to the property after JSON serialization
113-
multipart: True if the type should be used in a multipart request
114112
quoted: True if the type should be wrapped in quotes (if not a base type)
115113
"""
116114
if json:
117115
type_string = self.get_base_json_type_string(quoted=quoted)
118-
elif multipart:
119-
type_string = "tuple[None, bytes, str]"
120116
else:
121117
type_string = self.get_base_type_string(quoted=quoted)
122118

openapi_python_client/parser/properties/union.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,9 @@ def convert_value(self, value: Any) -> Value | None | PropertyError:
106106
return value_or_error
107107
return value_or_error
108108

109-
def _get_inner_type_strings(self, json: bool, multipart: bool) -> set[str]:
109+
def _get_inner_type_strings(self, json: bool) -> set[str]:
110110
return {
111-
p.get_type_string(no_optional=True, json=json, multipart=multipart, quoted=not p.is_base_type)
112-
for p in self.inner_properties
111+
p.get_type_string(no_optional=True, json=json, quoted=not p.is_base_type) for p in self.inner_properties
113112
}
114113

115114
@staticmethod
@@ -119,12 +118,12 @@ def _get_type_string_from_inner_type_strings(inner_types: set[str]) -> str:
119118
return f"Union[{', '.join(sorted(inner_types))}]"
120119

121120
def get_base_type_string(self, *, quoted: bool = False) -> str:
122-
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=False, multipart=False))
121+
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=False))
123122

124123
def get_base_json_type_string(self, *, quoted: bool = False) -> str:
125-
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=True, multipart=False))
124+
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=True))
126125

127-
def get_type_strings_in_union(self, *, no_optional: bool = False, json: bool, multipart: bool) -> set[str]:
126+
def get_type_strings_in_union(self, *, no_optional: bool = False, json: bool) -> set[str]:
128127
"""
129128
Get the set of all the types that should appear within the `Union` representing this property.
130129
@@ -133,12 +132,11 @@ def get_type_strings_in_union(self, *, no_optional: bool = False, json: bool, mu
133132
Args:
134133
no_optional: Do not include `None` or `Unset` in this set.
135134
json: If True, this returns the JSON types, not the Python types, of this property.
136-
multipart: If True, this returns the multipart types, not the Python types, of this property.
137135
138136
Returns:
139137
A set of strings containing the types that should appear within `Union`.
140138
"""
141-
type_strings = self._get_inner_type_strings(json=json, multipart=multipart)
139+
type_strings = self._get_inner_type_strings(json=json)
142140
if no_optional:
143141
return type_strings
144142
if not self.required:
@@ -150,15 +148,14 @@ def get_type_string(
150148
no_optional: bool = False,
151149
json: bool = False,
152150
*,
153-
multipart: bool = False,
154151
quoted: bool = False,
155152
) -> str:
156153
"""
157154
Get a string representation of type that should be used when declaring this property.
158155
This implementation differs slightly from `Property.get_type_string` in order to collapse
159156
nested union types.
160157
"""
161-
type_strings_in_union = self.get_type_strings_in_union(no_optional=no_optional, json=json, multipart=multipart)
158+
type_strings_in_union = self.get_type_strings_in_union(no_optional=no_optional, json=json)
162159
return self._get_type_string_from_inner_type_strings(type_strings_in_union)
163160

164161
def get_imports(self, *, prefix: str) -> set[str]:

openapi_python_client/templates/property_templates/enum_property.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
{% macro check_type_for_construct(property, source) %}isinstance({{ source }}, {{ property.value_type.__name__ }}){% endmacro %}
1212

13-
{% macro transform(property, source, destination, declare_type=True, multipart=False) %}
13+
{% macro transform(property, source, destination, declare_type=True) %}
1414
{% set transformed = source + ".value" %}
1515
{% set type_string = property.get_type_string(json=True) %}
1616
{% if property.required %}

openapi_python_client/templates/property_templates/literal_enum_property.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ check_{{ property.get_class_name_snake_case() }}({{ source }})
1010

1111
{% macro check_type_for_construct(property, source) %}isinstance({{ source }}, {{ property.get_instance_type_string() }}){% endmacro %}
1212

13-
{% macro transform(property, source, destination, declare_type=True, multipart=False) %}
13+
{% macro transform(property, source, destination, declare_type=True) %}
1414
{% set type_string = property.get_type_string(json=True) %}
1515
{% if property.required %}
1616
{{ destination }}{% if declare_type %}: {{ type_string }}{% endif %} = {{ source }}

openapi_python_client/templates/property_templates/union_property.py.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{% macro construct(property, source) %}
22
def _parse_{{ property.python_name }}(data: object) -> {{ property.get_type_string() }}:
3-
{% if "None" in property.get_type_strings_in_union(json=True, multipart=False) %}
3+
{% if "None" in property.get_type_strings_in_union(json=True) %}
44
if data is None:
55
return data
66
{% endif %}
7-
{% if "Unset" in property.get_type_strings_in_union(json=True, multipart=False) %}
7+
{% if "Unset" in property.get_type_strings_in_union(json=True) %}
88
if isinstance(data, Unset):
99
return data
1010
{% endif %}
@@ -41,7 +41,7 @@ def _parse_{{ property.python_name }}(data: object) -> {{ property.get_type_stri
4141

4242
{% macro transform(property, source, destination, declare_type=True) %}
4343
{% 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, multipart=False) }}{% endif %}
44+
{% if declare_type %}{{ destination }}: {{ property.get_type_string(json=True) }}{% endif %}
4545

4646
{% if not property.required %}
4747
if isinstance({{ source }}, Unset):

0 commit comments

Comments
 (0)