error: cannot format app/logic/shparsing/validators.py: Cannot parse: 66:21:
return Union[*[types_mapping.get(type_['type'])(json_schema) for type_ in any_of]]
Code:
def json_schema_to_pydantic_type(json_schema: dict[str, Any]) -> Any:
if any_of := json_schema.get('anyOf', []):
return Union[*[types_mapping.get(type_['type'])(json_schema) for type_ in any_of]]
type_ = json_schema.get('type')
mapped = types_mapping.get(type_)(json_schema)
if not mapped:
raise ValueError(f'Unsupported JSON schema type: {type_}')
return mapped
I found a solution with # fmt: off and # fmt: on, but are there any other ways to fix it? Because this way doesn't work.
Hello, I got an error:
Code:
I found a solution with
# fmt: off
and# fmt: on
, but are there any other ways to fix it? Because this way doesn't work.