Skip to content

Commit d7d4215

Browse files
author
Doug Borg
committed
style: apply black formatting
Run black formatter to fix code style issues. ✅ Verified: poetry run ty check src/ ✅ Verified: poetry run black --check . ✅ Verified: All tests pass
1 parent 09efd72 commit d7d4215

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

.claude/settings.local.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"permissions": {
33
"allow": [
4-
"Bash(poetry run pytest:*)"
4+
"Bash(poetry run pytest:*)",
5+
"Bash(gh pr checks:*)",
6+
"Bash(poetry run ty:*)",
7+
"Bash(gh run view:*)",
8+
"Bash(poetry run black:*)"
59
],
610
"deny": [],
711
"ask": []

src/openapi_python_generator/language_converters/python/model_generator.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ def _collect_unique_imports(conversions: List[TypeConversion]) -> Optional[List[
163163
return imports if imports else None
164164

165165

166-
def _convert_primitive_type(
167-
type_str: Optional[str], required: bool
168-
) -> TypeConversion:
166+
def _convert_primitive_type(type_str: Optional[str], required: bool) -> TypeConversion:
169167
"""
170168
Handle simple primitive type conversion (string, int, float, bool, object, null, Any).
171169
@@ -225,7 +223,9 @@ def _convert_array_type(
225223
)
226224
import_types = converted_reference.type.import_types
227225
original_type = "array<" + converted_reference.type.original_type + ">"
228-
converted_type = list_prefix + converted_reference.type.converted_type + list_suffix
226+
converted_type = (
227+
list_prefix + converted_reference.type.converted_type + list_suffix
228+
)
229229
elif isinstance(schema.items, Schema30) or isinstance(schema.items, Schema31):
230230
# For schema items, always pass True (items are always required within the array)
231231
item_type_str = _normalize_schema_type(schema.items)
@@ -288,17 +288,23 @@ def _convert_composite_schema(
288288

289289
# Build original type string
290290
if kind == "allOf":
291-
original_type = "tuple<" + ",".join([c.original_type for c in conversions]) + ">"
291+
original_type = (
292+
"tuple<" + ",".join([c.original_type for c in conversions]) + ">"
293+
)
292294
type_wrapper = "Tuple"
293295
else: # oneOf or anyOf
294-
original_type = "union<" + ",".join([c.original_type for c in conversions]) + ">"
296+
original_type = (
297+
"union<" + ",".join([c.original_type for c in conversions]) + ">"
298+
)
295299
type_wrapper = "Union"
296300

297301
# Build converted type string
298302
if len(conversions) == 1:
299303
converted_type = conversions[0].converted_type
300304
else:
301-
converted_type = type_wrapper + "[" + ",".join([c.converted_type for c in conversions]) + "]"
305+
converted_type = (
306+
type_wrapper + "[" + ",".join([c.converted_type for c in conversions]) + "]"
307+
)
302308

303309
converted_type = _wrap_optional(converted_type, required)
304310
import_types = _collect_unique_imports(conversions)

0 commit comments

Comments
 (0)