From b8ccd25a79cf5d189e64be521574ee215cf6ba51 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 26 Apr 2023 17:12:10 +0800 Subject: [PATCH] [python-nextgen] Various fixes reported by pylint (#15309) * various pylint fixes * rearrange test * Revert "rearrange test" This reverts commit 24d777a8a87161b6fc36527f6c1a06c03216bb64. --- .../python-nextgen/model_anyof.mustache | 2 +- .../python-nextgen/model_generic.mustache | 34 ++++++------ .../python-nextgen/model_oneof.mustache | 2 +- .../python-nextgen/pyproject.mustache | 4 +- .../openapi_client/models/bird.py | 4 +- .../openapi_client/models/category.py | 4 +- .../openapi_client/models/data_query.py | 4 +- .../models/data_query_all_of.py | 4 +- .../openapi_client/models/default_value.py | 15 ++--- .../models/number_properties_only.py | 4 +- .../openapi_client/models/pet.py | 15 ++--- .../openapi_client/models/query.py | 13 +++-- .../openapi_client/models/tag.py | 4 +- ...ue_object_all_of_query_object_parameter.py | 4 +- ...rue_array_string_query_object_parameter.py | 4 +- .../echo_api/python-nextgen/pyproject.toml | 4 +- .../models/additional_properties_class.py | 4 +- .../models/all_of_with_single_ref.py | 4 +- .../petstore_api/models/animal.py | 2 +- .../petstore_api/models/any_of_pig.py | 4 +- .../petstore_api/models/api_response.py | 4 +- .../models/array_of_array_of_number_only.py | 4 +- .../models/array_of_number_only.py | 4 +- .../petstore_api/models/array_test.py | 4 +- .../petstore_api/models/basque_pig.py | 4 +- .../petstore_api/models/capitalization.py | 4 +- .../petstore_api/models/cat.py | 4 +- .../petstore_api/models/cat_all_of.py | 4 +- .../petstore_api/models/category.py | 4 +- .../models/circular_reference_model.py | 4 +- .../petstore_api/models/class_model.py | 4 +- .../petstore_api/models/client.py | 4 +- .../petstore_api/models/danish_pig.py | 4 +- .../petstore_api/models/deprecated_object.py | 4 +- .../petstore_api/models/dog.py | 4 +- .../petstore_api/models/dog_all_of.py | 4 +- .../petstore_api/models/dummy_model.py | 4 +- .../petstore_api/models/enum_arrays.py | 26 +++++---- .../petstore_api/models/enum_test.py | 55 ++++++++++--------- .../petstore_api/models/file.py | 4 +- .../models/file_schema_test_class.py | 4 +- .../petstore_api/models/first_ref.py | 4 +- .../petstore_api/models/foo.py | 4 +- .../models/foo_get_default_response.py | 4 +- .../petstore_api/models/format_test.py | 48 ++++++++-------- .../petstore_api/models/has_only_read_only.py | 4 +- .../models/health_check_result.py | 4 +- .../models/inner_dict_with_property.py | 4 +- .../petstore_api/models/list.py | 4 +- .../petstore_api/models/map_test.py | 15 ++--- ...perties_and_additional_properties_class.py | 4 +- .../petstore_api/models/model200_response.py | 4 +- .../petstore_api/models/model_return.py | 4 +- .../petstore_api/models/name.py | 4 +- .../petstore_api/models/nullable_class.py | 4 +- .../petstore_api/models/number_only.py | 4 +- .../models/object_with_deprecated_fields.py | 4 +- .../petstore_api/models/order.py | 15 ++--- .../petstore_api/models/outer_composite.py | 4 +- .../models/outer_object_with_enum_property.py | 4 +- .../petstore_api/models/parent.py | 4 +- .../models/parent_with_optional_dict.py | 4 +- .../petstore_api/models/pet.py | 15 ++--- .../petstore_api/models/pig.py | 4 +- .../petstore_api/models/read_only_first.py | 4 +- .../petstore_api/models/second_ref.py | 4 +- .../models/self_reference_model.py | 4 +- .../petstore_api/models/special_model_name.py | 4 +- .../petstore_api/models/special_name.py | 15 ++--- .../petstore_api/models/tag.py | 4 +- .../petstore_api/models/user.py | 4 +- .../petstore_api/models/with_nested_one_of.py | 4 +- .../python-nextgen-aiohttp/pyproject.toml | 4 +- .../models/additional_properties_class.py | 4 +- .../models/all_of_with_single_ref.py | 4 +- .../petstore_api/models/animal.py | 2 +- .../petstore_api/models/any_of_pig.py | 4 +- .../petstore_api/models/api_response.py | 4 +- .../models/array_of_array_of_number_only.py | 4 +- .../models/array_of_number_only.py | 4 +- .../petstore_api/models/array_test.py | 4 +- .../petstore_api/models/basque_pig.py | 4 +- .../petstore_api/models/capitalization.py | 4 +- .../python-nextgen/petstore_api/models/cat.py | 4 +- .../petstore_api/models/cat_all_of.py | 4 +- .../petstore_api/models/category.py | 4 +- .../models/circular_reference_model.py | 4 +- .../petstore_api/models/class_model.py | 4 +- .../petstore_api/models/client.py | 4 +- .../petstore_api/models/danish_pig.py | 4 +- .../petstore_api/models/deprecated_object.py | 4 +- .../python-nextgen/petstore_api/models/dog.py | 4 +- .../petstore_api/models/dog_all_of.py | 4 +- .../petstore_api/models/dummy_model.py | 4 +- .../petstore_api/models/enum_arrays.py | 26 +++++---- .../petstore_api/models/enum_test.py | 55 ++++++++++--------- .../petstore_api/models/file.py | 4 +- .../models/file_schema_test_class.py | 4 +- .../petstore_api/models/first_ref.py | 4 +- .../python-nextgen/petstore_api/models/foo.py | 4 +- .../models/foo_get_default_response.py | 4 +- .../petstore_api/models/format_test.py | 48 ++++++++-------- .../petstore_api/models/has_only_read_only.py | 4 +- .../models/health_check_result.py | 4 +- .../models/inner_dict_with_property.py | 4 +- .../petstore_api/models/list.py | 4 +- .../petstore_api/models/map_test.py | 15 ++--- ...perties_and_additional_properties_class.py | 4 +- .../petstore_api/models/model200_response.py | 4 +- .../petstore_api/models/model_return.py | 4 +- .../petstore_api/models/name.py | 4 +- .../petstore_api/models/nullable_class.py | 4 +- .../petstore_api/models/number_only.py | 4 +- .../models/object_with_deprecated_fields.py | 4 +- .../petstore_api/models/order.py | 15 ++--- .../petstore_api/models/outer_composite.py | 4 +- .../models/outer_object_with_enum_property.py | 4 +- .../petstore_api/models/parent.py | 4 +- .../models/parent_with_optional_dict.py | 4 +- .../python-nextgen/petstore_api/models/pet.py | 15 ++--- .../python-nextgen/petstore_api/models/pig.py | 4 +- .../petstore_api/models/read_only_first.py | 4 +- .../petstore_api/models/second_ref.py | 4 +- .../models/self_reference_model.py | 4 +- .../petstore_api/models/special_model_name.py | 4 +- .../petstore_api/models/special_name.py | 15 ++--- .../python-nextgen/petstore_api/models/tag.py | 4 +- .../petstore_api/models/user.py | 4 +- .../petstore_api/models/with_nested_one_of.py | 4 +- .../petstore/python-nextgen/pyproject.toml | 4 +- 130 files changed, 469 insertions(+), 426 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/model_anyof.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/model_anyof.mustache index f4687163d26..d0dbb52f33c 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/model_anyof.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/model_anyof.mustache @@ -64,7 +64,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} error_messages.append(str(e)) {{/isPrimitiveType}} {{^isPrimitiveType}} - if type(v) is not {{{dataType}}}: + if not isinstance(v, {{{dataType}}}): error_messages.append(f"Error! Input type `{type(v)}` is not `{{{dataType}}}`") else: return v diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/model_generic.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/model_generic.mustache index 6402a352c8b..6b3ca7a5c56 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/model_generic.mustache @@ -1,5 +1,4 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,53 +30,56 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#vendorExtensions.x-regex}} @validator('{{{name}}}') - def {{{name}}}_validate_regular_expression(cls, v): + def {{{name}}}_validate_regular_expression(cls, value): + """Validates the regular expression""" {{^required}} - if v is None: - return v + if value is None: + return value {{/required}} {{#required}} {{#isNullable}} - if v is None: + if value is None: return v {{/isNullable}} {{/required}} - if not re.match(r"{{{.}}}", v{{#vendorExtensions.x-modifiers}} ,re.{{{.}}}{{/vendorExtensions.x-modifiers}}): + if not re.match(r"{{{.}}}", value{{#vendorExtensions.x-modifiers}} ,re.{{{.}}}{{/vendorExtensions.x-modifiers}}): raise ValueError(r"must validate the regular expression {{{vendorExtensions.x-pattern}}}") - return v + return value {{/vendorExtensions.x-regex}} {{#isEnum}} @validator('{{{name}}}') - def {{{name}}}_validate_enum(cls, v): + def {{{name}}}_validate_enum(cls, value): + """Validates the enum""" {{^required}} - if v is None: - return v + if value is None: + return value {{/required}} {{#required}} {{#isNullable}} - if v is None: - return v + if value is None: + return value {{/isNullable}} {{/required}} {{#isArray}} - for i in v: + for i in value: if i not in ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}): raise ValueError("each list item must be one of ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})") {{/isArray}} {{^isArray}} - if v not in ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}): + if value not in ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}): raise ValueError("must be one of enum values ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})") {{/isArray}} - return v + return value {{/isEnum}} {{/vars}} class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -210,7 +212,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return {{{classname}}}.parse_obj(obj) {{#disallowAdditionalPropertiesIfNotPresent}} diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/model_oneof.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/model_oneof.mustache index b65f784d1cc..d0a2fc6b6c4 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/model_oneof.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/model_oneof.mustache @@ -64,7 +64,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} error_messages.append(str(e)) {{/isPrimitiveType}} {{^isPrimitiveType}} - if type(v) is not {{{dataType}}}: + if not isinstance(v, {{{dataType}}}): error_messages.append(f"Error! Input type `{type(v)}` is not `{{{dataType}}}`") else: match += 1 diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/pyproject.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/pyproject.mustache index 1ab024d87f2..af3b379c628 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/pyproject.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/pyproject.mustache @@ -23,7 +23,7 @@ tornado = ">=4.2,<5" pem = ">= 19.3.0" pycryptodome = ">= 3.9.0" {{/hasHttpSignatureMethods}} -pydantic = "^1.10.5" +pydantic = "^1.10.5, <2" aenum = ">=3.1.11" [tool.poetry.dev-dependencies] @@ -35,3 +35,5 @@ flake8 = ">=4.0.0" requires = ["setuptools"] build-backend = "setuptools.build_meta" +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/bird.py b/samples/client/echo_api/python-nextgen/openapi_client/models/bird.py index 2f8814af624..1b443544391 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/bird.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/bird.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Bird(BaseModel): __properties = ["size", "color"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -62,7 +62,7 @@ class Bird(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Bird.parse_obj(obj) _obj = Bird.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/category.py b/samples/client/echo_api/python-nextgen/openapi_client/models/category.py index 20e8ef180c2..5d5c5205046 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/category.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/category.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Category(BaseModel): __properties = ["id", "name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -62,7 +62,7 @@ class Category(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Category.parse_obj(obj) _obj = Category.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/data_query.py b/samples/client/echo_api/python-nextgen/openapi_client/models/data_query.py index 500a087fe75..7d491a7aabf 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/data_query.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/data_query.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -34,6 +33,7 @@ class DataQuery(Query): __properties = ["suffix", "text", "date", "id", "outcomes"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -64,7 +64,7 @@ class DataQuery(Query): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DataQuery.parse_obj(obj) _obj = DataQuery.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/data_query_all_of.py b/samples/client/echo_api/python-nextgen/openapi_client/models/data_query_all_of.py index b0fcf04d3f9..9e0080d2196 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/data_query_all_of.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/data_query_all_of.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class DataQueryAllOf(BaseModel): __properties = ["suffix", "text", "date"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -63,7 +63,7 @@ class DataQueryAllOf(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DataQueryAllOf.parse_obj(obj) _obj = DataQueryAllOf.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py b/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py index 5fa33c19aba..9039bbbc68a 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -39,16 +38,18 @@ class DefaultValue(BaseModel): __properties = ["array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable"] @validator('array_string_enum_default') - def array_string_enum_default_validate_enum(cls, v): - if v is None: - return v + def array_string_enum_default_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - for i in v: + for i in value: if i not in ('success', 'failure', 'unclassified'): raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -94,7 +95,7 @@ class DefaultValue(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DefaultValue.parse_obj(obj) _obj = DefaultValue.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/number_properties_only.py b/samples/client/echo_api/python-nextgen/openapi_client/models/number_properties_only.py index cd837770154..4a7a717f637 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/number_properties_only.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/number_properties_only.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class NumberPropertiesOnly(BaseModel): __properties = ["number", "float", "double"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -63,7 +63,7 @@ class NumberPropertiesOnly(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return NumberPropertiesOnly.parse_obj(obj) _obj = NumberPropertiesOnly.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py b/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py index 1d41038d83a..905002e6a14 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -38,15 +37,17 @@ class Pet(BaseModel): __properties = ["id", "name", "category", "photoUrls", "tags", "status"] @validator('status') - def status_validate_enum(cls, v): - if v is None: - return v + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('available', 'pending', 'sold'): + if value not in ('available', 'pending', 'sold'): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -87,7 +88,7 @@ class Pet(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Pet.parse_obj(obj) _obj = Pet.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/query.py b/samples/client/echo_api/python-nextgen/openapi_client/models/query.py index 4f932a13a86..f24cd4b2af3 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/query.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/query.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,16 +31,18 @@ class Query(BaseModel): __properties = ["id", "outcomes"] @validator('outcomes') - def outcomes_validate_enum(cls, v): - if v is None: - return v + def outcomes_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - for i in v: + for i in value: if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'): raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/tag.py b/samples/client/echo_api/python-nextgen/openapi_client/models/tag.py index 430b70f4519..b0a4598e068 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/tag.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/tag.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Tag(BaseModel): __properties = ["id", "name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -62,7 +62,7 @@ class Tag(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Tag.parse_obj(obj) _obj = Tag.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py index e43c6fc5a81..11113ca0d70 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -34,6 +33,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod __properties = ["size", "color", "id", "name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -64,7 +64,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.parse_obj(obj) _obj = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py index f39267b5ac5..f9d2a601f24 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -14,7 +14,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel): __properties = ["values"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.parse_obj(obj) _obj = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.parse_obj({ diff --git a/samples/client/echo_api/python-nextgen/pyproject.toml b/samples/client/echo_api/python-nextgen/pyproject.toml index 0a22d86748b..2be7cdbbec6 100644 --- a/samples/client/echo_api/python-nextgen/pyproject.toml +++ b/samples/client/echo_api/python-nextgen/pyproject.toml @@ -13,7 +13,7 @@ python = "^3.7" urllib3 = ">= 1.25.3" python-dateutil = ">=2.8.2" -pydantic = "^1.10.5" +pydantic = "^1.10.5, <2" aenum = ">=3.1.11" [tool.poetry.dev-dependencies] @@ -25,3 +25,5 @@ flake8 = ">=4.0.0" requires = ["setuptools"] build-backend = "setuptools.build_meta" +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/additional_properties_class.py index 34cead3a8a3..c2e07e7095a 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/additional_properties_class.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class AdditionalPropertiesClass(BaseModel): __properties = ["map_property", "map_of_map_property"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ class AdditionalPropertiesClass(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return AdditionalPropertiesClass.parse_obj(obj) _obj = AdditionalPropertiesClass.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/all_of_with_single_ref.py index c6826c1a651..aeb365da90b 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/all_of_with_single_ref.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/all_of_with_single_ref.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class AllOfWithSingleRef(BaseModel): __properties = ["username", "SingleRefType"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -62,7 +62,7 @@ class AllOfWithSingleRef(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return AllOfWithSingleRef.parse_obj(obj) _obj = AllOfWithSingleRef.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/animal.py index 5bdd2d93816..9279e039841 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/animal.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Animal(BaseModel): __properties = ["className", "color"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/any_of_pig.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/any_of_pig.py index e9e97b7d404..d18b58876df 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/any_of_pig.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/any_of_pig.py @@ -47,13 +47,13 @@ class AnyOfPig(BaseModel): instance = cls() error_messages = [] # validate data type: BasquePig - if type(v) is not BasquePig: + if not isinstance(v, BasquePig): error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") else: return v # validate data type: DanishPig - if type(v) is not DanishPig: + if not isinstance(v, DanishPig): error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") else: return v diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/api_response.py index 26f3025fb3a..d42d3d86576 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/api_response.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class ApiResponse(BaseModel): __properties = ["code", "type", "message"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -62,7 +62,7 @@ class ApiResponse(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ApiResponse.parse_obj(obj) _obj = ApiResponse.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_array_of_number_only.py index 4593b477f59..3a392f17c20 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_array_of_number_only.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel): __properties = ["ArrayArrayNumber"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ArrayOfArrayOfNumberOnly.parse_obj(obj) _obj = ArrayOfArrayOfNumberOnly.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_number_only.py index 9a03e3150aa..96fa5c93a0d 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_number_only.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class ArrayOfNumberOnly(BaseModel): __properties = ["ArrayNumber"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class ArrayOfNumberOnly(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ArrayOfNumberOnly.parse_obj(obj) _obj = ArrayOfNumberOnly.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_test.py index 021c38893c6..e6775be1c70 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_test.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class ArrayTest(BaseModel): __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -70,7 +70,7 @@ class ArrayTest(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ArrayTest.parse_obj(obj) _obj = ArrayTest.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/basque_pig.py index 2c9210a9fa1..9f2a647b3e2 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/basque_pig.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/basque_pig.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class BasquePig(BaseModel): __properties = ["className", "color"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ class BasquePig(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return BasquePig.parse_obj(obj) _obj = BasquePig.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/capitalization.py index 64518b99447..d849bb224f8 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/capitalization.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -35,6 +34,7 @@ class Capitalization(BaseModel): __properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -65,7 +65,7 @@ class Capitalization(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Capitalization.parse_obj(obj) _obj = Capitalization.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/cat.py index 0f1ece68548..b4bc6a226ff 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/cat.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class Cat(Animal): __properties = ["className", "color", "declawed"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ class Cat(Animal): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Cat.parse_obj(obj) _obj = Cat.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/cat_all_of.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/cat_all_of.py index 7fd50e58975..1d64673d4da 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/cat_all_of.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/cat_all_of.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class CatAllOf(BaseModel): __properties = ["declawed"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class CatAllOf(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return CatAllOf.parse_obj(obj) _obj = CatAllOf.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/category.py index 311634b1081..95eeff4eecd 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/category.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class Category(BaseModel): __properties = ["id", "name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ class Category(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Category.parse_obj(obj) _obj = Category.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/circular_reference_model.py index 3a03dad4ddd..a2267f66d48 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/circular_reference_model.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/circular_reference_model.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class CircularReferenceModel(BaseModel): __properties = ["size", "nested"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -64,7 +64,7 @@ class CircularReferenceModel(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return CircularReferenceModel.parse_obj(obj) _obj = CircularReferenceModel.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/class_model.py index 04cd03eb71f..ed62d02c898 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/class_model.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class ClassModel(BaseModel): __properties = ["_class"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class ClassModel(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ClassModel.parse_obj(obj) _obj = ClassModel.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/client.py index 793b26fab96..25a00323c5d 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/client.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class Client(BaseModel): __properties = ["client"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class Client(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Client.parse_obj(obj) _obj = Client.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/danish_pig.py index 9a45a77b607..0071d437816 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/danish_pig.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/danish_pig.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class DanishPig(BaseModel): __properties = ["className", "size"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ class DanishPig(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DanishPig.parse_obj(obj) _obj = DanishPig.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/deprecated_object.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/deprecated_object.py index 1b17a9aec47..364d0b2fb2f 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/deprecated_object.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/deprecated_object.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class DeprecatedObject(BaseModel): __properties = ["name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class DeprecatedObject(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DeprecatedObject.parse_obj(obj) _obj = DeprecatedObject.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dog.py index 03b803d8788..52df38fcdd5 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dog.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class Dog(Animal): __properties = ["className", "color", "breed"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ class Dog(Animal): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Dog.parse_obj(obj) _obj = Dog.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dog_all_of.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dog_all_of.py index 9fa8cea2d48..5caa2492ffc 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dog_all_of.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dog_all_of.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class DogAllOf(BaseModel): __properties = ["breed"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class DogAllOf(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DogAllOf.parse_obj(obj) _obj = DogAllOf.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dummy_model.py index 47cc18f1a12..806332316df 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dummy_model.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/dummy_model.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class DummyModel(BaseModel): __properties = ["category", "self_ref"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -64,7 +64,7 @@ class DummyModel(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DummyModel.parse_obj(obj) _obj = DummyModel.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py index c56f6e927c1..73d6b81c171 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,25 +30,28 @@ class EnumArrays(BaseModel): __properties = ["just_symbol", "array_enum"] @validator('just_symbol') - def just_symbol_validate_enum(cls, v): - if v is None: - return v + def just_symbol_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('>=', '$'): + if value not in ('>=', '$'): raise ValueError("must be one of enum values ('>=', '$')") - return v + return value @validator('array_enum') - def array_enum_validate_enum(cls, v): - if v is None: - return v + def array_enum_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - for i in v: + for i in value: if i not in ('fish', 'crab'): raise ValueError("each list item must be one of ('fish', 'crab')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -80,7 +82,7 @@ class EnumArrays(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return EnumArrays.parse_obj(obj) _obj = EnumArrays.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_test.py index 2f62f6d76e5..f93051f4365 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_test.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -42,48 +41,54 @@ class EnumTest(BaseModel): __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] @validator('enum_string') - def enum_string_validate_enum(cls, v): - if v is None: - return v + def enum_string_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('UPPER', 'lower', ''): + if value not in ('UPPER', 'lower', ''): raise ValueError("must be one of enum values ('UPPER', 'lower', '')") - return v + return value @validator('enum_string_required') - def enum_string_required_validate_enum(cls, v): - if v not in ('UPPER', 'lower', ''): + def enum_string_required_validate_enum(cls, value): + """Validates the enum""" + if value not in ('UPPER', 'lower', ''): raise ValueError("must be one of enum values ('UPPER', 'lower', '')") - return v + return value @validator('enum_integer_default') - def enum_integer_default_validate_enum(cls, v): - if v is None: - return v + def enum_integer_default_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in (1, 5, 14): + if value not in (1, 5, 14): raise ValueError("must be one of enum values (1, 5, 14)") - return v + return value @validator('enum_integer') - def enum_integer_validate_enum(cls, v): - if v is None: - return v + def enum_integer_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in (1, -1): + if value not in (1, -1): raise ValueError("must be one of enum values (1, -1)") - return v + return value @validator('enum_number') - def enum_number_validate_enum(cls, v): - if v is None: - return v + def enum_number_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in (1.1, -1.2): + if value not in (1.1, -1.2): raise ValueError("must be one of enum values (1.1, -1.2)") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -119,7 +124,7 @@ class EnumTest(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return EnumTest.parse_obj(obj) _obj = EnumTest.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file.py index aae806f9515..fb0c1b03752 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class File(BaseModel): __properties = ["sourceURI"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class File(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return File.parse_obj(obj) _obj = File.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file_schema_test_class.py index 86c9b1bd46f..80f8965a595 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file_schema_test_class.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class FileSchemaTestClass(BaseModel): __properties = ["file", "files"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -72,7 +72,7 @@ class FileSchemaTestClass(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return FileSchemaTestClass.parse_obj(obj) _obj = FileSchemaTestClass.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/first_ref.py index 0856f9b0daf..14a1cf6f4f3 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/first_ref.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/first_ref.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class FirstRef(BaseModel): __properties = ["category", "self_ref"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -64,7 +64,7 @@ class FirstRef(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return FirstRef.parse_obj(obj) _obj = FirstRef.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/foo.py index c85ac8cec6c..7f92613b7a9 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/foo.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class Foo(BaseModel): __properties = ["bar"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class Foo(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Foo.parse_obj(obj) _obj = Foo.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/foo_get_default_response.py index 1a8502a9eb6..d51b9180234 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/foo_get_default_response.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/foo_get_default_response.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class FooGetDefaultResponse(BaseModel): __properties = ["string"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -64,7 +64,7 @@ class FooGetDefaultResponse(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return FooGetDefaultResponse.parse_obj(obj) _obj = FooGetDefaultResponse.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/format_test.py index ce02674ff3b..ccaf4712da7 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/format_test.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -46,42 +45,47 @@ class FormatTest(BaseModel): __properties = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] @validator('string') - def string_validate_regular_expression(cls, v): - if v is None: - return v + def string_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value - if not re.match(r"[a-z]", v ,re.IGNORECASE): + if not re.match(r"[a-z]", value ,re.IGNORECASE): raise ValueError(r"must validate the regular expression /[a-z]/i") - return v + return value @validator('string_with_double_quote_pattern') - def string_with_double_quote_pattern_validate_regular_expression(cls, v): - if v is None: - return v + def string_with_double_quote_pattern_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value - if not re.match(r"this is \"something\"", v): + if not re.match(r"this is \"something\"", value): raise ValueError(r"must validate the regular expression /this is \"something\"/") - return v + return value @validator('pattern_with_digits') - def pattern_with_digits_validate_regular_expression(cls, v): - if v is None: - return v + def pattern_with_digits_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value - if not re.match(r"^\d{10}$", v): + if not re.match(r"^\d{10}$", value): raise ValueError(r"must validate the regular expression /^\d{10}$/") - return v + return value @validator('pattern_with_digits_and_delimiter') - def pattern_with_digits_and_delimiter_validate_regular_expression(cls, v): - if v is None: - return v + def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value - if not re.match(r"^image_\d{1,3}$", v ,re.IGNORECASE): + if not re.match(r"^image_\d{1,3}$", value ,re.IGNORECASE): raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -112,7 +116,7 @@ class FormatTest(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return FormatTest.parse_obj(obj) _obj = FormatTest.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/has_only_read_only.py index 47345cc0a89..d966338a757 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/has_only_read_only.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class HasOnlyReadOnly(BaseModel): __properties = ["bar", "foo"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -63,7 +63,7 @@ class HasOnlyReadOnly(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return HasOnlyReadOnly.parse_obj(obj) _obj = HasOnlyReadOnly.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/health_check_result.py index 8f674067ff8..df22bd73b5e 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/health_check_result.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class HealthCheckResult(BaseModel): __properties = ["NullableMessage"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -65,7 +65,7 @@ class HealthCheckResult(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return HealthCheckResult.parse_obj(obj) _obj = HealthCheckResult.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/inner_dict_with_property.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/inner_dict_with_property.py index 8bce01a25b4..bdafe053581 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/inner_dict_with_property.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/inner_dict_with_property.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class InnerDictWithProperty(BaseModel): __properties = ["aProperty"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class InnerDictWithProperty(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return InnerDictWithProperty.parse_obj(obj) _obj = InnerDictWithProperty.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/list.py index e0a3f4b55e4..07630b0932c 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/list.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/list.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class List(BaseModel): __properties = ["123-list"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class List(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return List.parse_obj(obj) _obj = List.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/map_test.py index 512f09d73eb..89513002284 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/map_test.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,15 +32,17 @@ class MapTest(BaseModel): __properties = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"] @validator('map_of_enum_string') - def map_of_enum_string_validate_enum(cls, v): - if v is None: - return v + def map_of_enum_string_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('UPPER', 'lower'): + if value not in ('UPPER', 'lower'): raise ValueError("must be one of enum values ('UPPER', 'lower')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -72,7 +73,7 @@ class MapTest(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return MapTest.parse_obj(obj) _obj = MapTest.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py index 23b80efa20e..c381b9ab526 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): __properties = ["uuid", "dateTime", "map"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -70,7 +70,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return MixedPropertiesAndAdditionalPropertiesClass.parse_obj(obj) _obj = MixedPropertiesAndAdditionalPropertiesClass.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/model200_response.py index 55ddbc2a050..d5443ea6a15 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/model200_response.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class Model200Response(BaseModel): __properties = ["name", "class"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ class Model200Response(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Model200Response.parse_obj(obj) _obj = Model200Response.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/model_return.py index 527a4f5b47e..0f7e4bbe06a 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/model_return.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class ModelReturn(BaseModel): __properties = ["return"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class ModelReturn(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ModelReturn.parse_obj(obj) _obj = ModelReturn.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/name.py index bf9ab74413b..b13fdb2e507 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/name.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class Name(BaseModel): __properties = ["name", "snake_case", "property", "123Number"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -65,7 +65,7 @@ class Name(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Name.parse_obj(obj) _obj = Name.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/nullable_class.py index 969acaeca05..0235d20c8e5 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/nullable_class.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -42,6 +41,7 @@ class NullableClass(BaseModel): __properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -127,7 +127,7 @@ class NullableClass(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return NullableClass.parse_obj(obj) _obj = NullableClass.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/number_only.py index c4a400a846c..e7eaf5ef060 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/number_only.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class NumberOnly(BaseModel): __properties = ["JustNumber"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class NumberOnly(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return NumberOnly.parse_obj(obj) _obj = NumberOnly.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/object_with_deprecated_fields.py index d056ce8778a..e2ae308b3e0 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/object_with_deprecated_fields.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -34,6 +33,7 @@ class ObjectWithDeprecatedFields(BaseModel): __properties = ["uuid", "id", "deprecatedRef", "bars"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class ObjectWithDeprecatedFields(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ObjectWithDeprecatedFields.parse_obj(obj) _obj = ObjectWithDeprecatedFields.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/order.py index 7a61819b8b1..6b88135404e 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/order.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -35,15 +34,17 @@ class Order(BaseModel): __properties = ["id", "petId", "quantity", "shipDate", "status", "complete"] @validator('status') - def status_validate_enum(cls, v): - if v is None: - return v + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('placed', 'approved', 'delivered'): + if value not in ('placed', 'approved', 'delivered'): raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -74,7 +75,7 @@ class Order(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Order.parse_obj(obj) _obj = Order.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/outer_composite.py index 7fce7797fee..5846744e3bd 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/outer_composite.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/outer_composite.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class OuterComposite(BaseModel): __properties = ["my_number", "my_string", "my_boolean"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -62,7 +62,7 @@ class OuterComposite(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return OuterComposite.parse_obj(obj) _obj = OuterComposite.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/outer_object_with_enum_property.py index 78ea1841d7b..a08adf4f3ae 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/outer_object_with_enum_property.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/outer_object_with_enum_property.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class OuterObjectWithEnumProperty(BaseModel): __properties = ["str_value", "value"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class OuterObjectWithEnumProperty(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return OuterObjectWithEnumProperty.parse_obj(obj) _obj = OuterObjectWithEnumProperty.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/parent.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/parent.py index 8af68a0065d..f8fff21bf2d 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/parent.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/parent.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class Parent(BaseModel): __properties = ["optionalDict"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class Parent(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Parent.parse_obj(obj) _obj = Parent.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/parent_with_optional_dict.py index 0918d6e7e38..faf22175056 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/parent_with_optional_dict.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/parent_with_optional_dict.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class ParentWithOptionalDict(BaseModel): __properties = ["optionalDict"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class ParentWithOptionalDict(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ParentWithOptionalDict.parse_obj(obj) _obj = ParentWithOptionalDict.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py index af7b3e37fdc..28614099822 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -37,15 +36,17 @@ class Pet(BaseModel): __properties = ["id", "category", "name", "photoUrls", "tags", "status"] @validator('status') - def status_validate_enum(cls, v): - if v is None: - return v + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('available', 'pending', 'sold'): + if value not in ('available', 'pending', 'sold'): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -86,7 +87,7 @@ class Pet(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Pet.parse_obj(obj) _obj = Pet.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pig.py index baa32ba0c4a..5f27432d247 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pig.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pig.py @@ -50,13 +50,13 @@ class Pig(BaseModel): error_messages = [] match = 0 # validate data type: BasquePig - if type(v) is not BasquePig: + if not isinstance(v, BasquePig): error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") else: match += 1 # validate data type: DanishPig - if type(v) is not DanishPig: + if not isinstance(v, DanishPig): error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") else: match += 1 diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/read_only_first.py index ac16280844b..d6c71f77e83 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/read_only_first.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/read_only_first.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class ReadOnlyFirst(BaseModel): __properties = ["bar", "baz"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -62,7 +62,7 @@ class ReadOnlyFirst(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ReadOnlyFirst.parse_obj(obj) _obj = ReadOnlyFirst.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/second_ref.py index f00e2756920..2e5442dcc57 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/second_ref.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/second_ref.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class SecondRef(BaseModel): __properties = ["category", "circular_ref"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -64,7 +64,7 @@ class SecondRef(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return SecondRef.parse_obj(obj) _obj = SecondRef.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/self_reference_model.py index b8fa0dd875f..5e40902ead5 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/self_reference_model.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/self_reference_model.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class SelfReferenceModel(BaseModel): __properties = ["size", "nested"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -64,7 +64,7 @@ class SelfReferenceModel(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return SelfReferenceModel.parse_obj(obj) _obj = SelfReferenceModel.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_model_name.py index bc9f7b4cdaa..5f7a78250bd 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_model_name.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_model_name.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,6 +29,7 @@ class SpecialModelName(BaseModel): __properties = ["$special[property.name]"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -60,7 +60,7 @@ class SpecialModelName(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return SpecialModelName.parse_obj(obj) _obj = SpecialModelName.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_name.py index bdb0c8931b0..a72b537dcdb 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_name.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_name.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,15 +32,17 @@ class SpecialName(BaseModel): __properties = ["property", "async", "schema"] @validator('var_schema') - def var_schema_validate_enum(cls, v): - if v is None: - return v + def var_schema_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('available', 'pending', 'sold'): + if value not in ('available', 'pending', 'sold'): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -75,7 +76,7 @@ class SpecialName(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return SpecialName.parse_obj(obj) _obj = SpecialName.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/tag.py index 80c683f5d95..8d53ed20969 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/tag.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class Tag(BaseModel): __properties = ["id", "name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ class Tag(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Tag.parse_obj(obj) _obj = Tag.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/user.py index 77c6b277f01..8e58d9ae491 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/user.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -37,6 +36,7 @@ class User(BaseModel): __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class User(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return User.parse_obj(obj) _obj = User.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/with_nested_one_of.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/with_nested_one_of.py index 6690f8dd734..519318efdb2 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/with_nested_one_of.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/with_nested_one_of.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class WithNestedOneOf(BaseModel): __properties = ["size", "nested_pig"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -65,7 +65,7 @@ class WithNestedOneOf(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return WithNestedOneOf.parse_obj(obj) _obj = WithNestedOneOf.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/pyproject.toml b/samples/openapi3/client/petstore/python-nextgen-aiohttp/pyproject.toml index 6c4548406a1..70ac4c13846 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/pyproject.toml +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/pyproject.toml @@ -16,7 +16,7 @@ python-dateutil = ">=2.8.2" aiohttp = ">= 3.8.4" pem = ">= 19.3.0" pycryptodome = ">= 3.9.0" -pydantic = "^1.10.5" +pydantic = "^1.10.5, <2" aenum = ">=3.1.11" [tool.poetry.dev-dependencies] @@ -28,3 +28,5 @@ flake8 = ">=4.0.0" requires = ["setuptools"] build-backend = "setuptools.build_meta" +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/additional_properties_class.py index e99d1d384d5..82e55e0c621 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/additional_properties_class.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class AdditionalPropertiesClass(BaseModel): __properties = ["map_property", "map_of_map_property"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class AdditionalPropertiesClass(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return AdditionalPropertiesClass.parse_obj(obj) _obj = AdditionalPropertiesClass.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/all_of_with_single_ref.py index 7480ccec361..4a364b413ef 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/all_of_with_single_ref.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/all_of_with_single_ref.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class AllOfWithSingleRef(BaseModel): __properties = ["username", "SingleRefType"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -69,7 +69,7 @@ class AllOfWithSingleRef(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return AllOfWithSingleRef.parse_obj(obj) _obj = AllOfWithSingleRef.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/animal.py index c37cccbf446..446dfeba435 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/animal.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class Animal(BaseModel): __properties = ["className", "color"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/any_of_pig.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/any_of_pig.py index e9e97b7d404..d18b58876df 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/any_of_pig.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/any_of_pig.py @@ -47,13 +47,13 @@ class AnyOfPig(BaseModel): instance = cls() error_messages = [] # validate data type: BasquePig - if type(v) is not BasquePig: + if not isinstance(v, BasquePig): error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") else: return v # validate data type: DanishPig - if type(v) is not DanishPig: + if not isinstance(v, DanishPig): error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") else: return v diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/api_response.py index da810c92086..7c7ae29a6f2 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/api_response.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class ApiResponse(BaseModel): __properties = ["code", "type", "message"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -69,7 +69,7 @@ class ApiResponse(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ApiResponse.parse_obj(obj) _obj = ApiResponse.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_array_of_number_only.py index 981ec9cebd9..78fcaaf5b50 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_array_of_number_only.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel): __properties = ["ArrayArrayNumber"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ArrayOfArrayOfNumberOnly.parse_obj(obj) _obj = ArrayOfArrayOfNumberOnly.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_number_only.py index 89a4169e085..f3968f5b0b2 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_number_only.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class ArrayOfNumberOnly(BaseModel): __properties = ["ArrayNumber"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class ArrayOfNumberOnly(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ArrayOfNumberOnly.parse_obj(obj) _obj = ArrayOfNumberOnly.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_test.py index 9fe1c047ecb..afef8bee0fd 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_test.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -34,6 +33,7 @@ class ArrayTest(BaseModel): __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -77,7 +77,7 @@ class ArrayTest(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ArrayTest.parse_obj(obj) _obj = ArrayTest.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/basque_pig.py index cc775a10e26..bdbd436295e 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/basque_pig.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/basque_pig.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class BasquePig(BaseModel): __properties = ["className", "color"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class BasquePig(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return BasquePig.parse_obj(obj) _obj = BasquePig.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/capitalization.py index 92695072b18..03532ccd4c8 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/capitalization.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -36,6 +35,7 @@ class Capitalization(BaseModel): __properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -72,7 +72,7 @@ class Capitalization(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Capitalization.parse_obj(obj) _obj = Capitalization.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/cat.py index f2aca668519..ec62d7beff5 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/cat.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Cat(Animal): __properties = ["className", "color", "declawed"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class Cat(Animal): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Cat.parse_obj(obj) _obj = Cat.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/cat_all_of.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/cat_all_of.py index 349fcc17b58..38dfa14c5f0 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/cat_all_of.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/cat_all_of.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class CatAllOf(BaseModel): __properties = ["declawed"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class CatAllOf(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return CatAllOf.parse_obj(obj) _obj = CatAllOf.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/category.py index d1cfde84d0f..17edf3573cf 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/category.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Category(BaseModel): __properties = ["id", "name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class Category(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Category.parse_obj(obj) _obj = Category.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/circular_reference_model.py index eacb22736b3..381caa66407 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/circular_reference_model.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/circular_reference_model.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class CircularReferenceModel(BaseModel): __properties = ["size", "nested"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -71,7 +71,7 @@ class CircularReferenceModel(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return CircularReferenceModel.parse_obj(obj) _obj = CircularReferenceModel.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/class_model.py index b20fe9ca213..7963b831455 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/class_model.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class ClassModel(BaseModel): __properties = ["_class"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class ClassModel(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ClassModel.parse_obj(obj) _obj = ClassModel.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/client.py index a2d08564732..5b70640f005 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/client.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class Client(BaseModel): __properties = ["client"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class Client(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Client.parse_obj(obj) _obj = Client.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/danish_pig.py index 88cf28e3b67..c4c92e4d292 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/danish_pig.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/danish_pig.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class DanishPig(BaseModel): __properties = ["className", "size"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class DanishPig(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DanishPig.parse_obj(obj) _obj = DanishPig.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/deprecated_object.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/deprecated_object.py index 870fec8e859..62775488383 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/deprecated_object.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/deprecated_object.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class DeprecatedObject(BaseModel): __properties = ["name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class DeprecatedObject(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DeprecatedObject.parse_obj(obj) _obj = DeprecatedObject.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dog.py index eb6510a7a17..a3d3b960079 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dog.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Dog(Animal): __properties = ["className", "color", "breed"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class Dog(Animal): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Dog.parse_obj(obj) _obj = Dog.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dog_all_of.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dog_all_of.py index 50b2b59ac0f..7e61359cdb1 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dog_all_of.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dog_all_of.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class DogAllOf(BaseModel): __properties = ["breed"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class DogAllOf(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DogAllOf.parse_obj(obj) _obj = DogAllOf.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dummy_model.py index d0db2bdc188..31dcde4857b 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dummy_model.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/dummy_model.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class DummyModel(BaseModel): __properties = ["category", "self_ref"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -71,7 +71,7 @@ class DummyModel(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return DummyModel.parse_obj(obj) _obj = DummyModel.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py index f270d1cd14d..1e9f7e748a4 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,25 +31,28 @@ class EnumArrays(BaseModel): __properties = ["just_symbol", "array_enum"] @validator('just_symbol') - def just_symbol_validate_enum(cls, v): - if v is None: - return v + def just_symbol_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('>=', '$'): + if value not in ('>=', '$'): raise ValueError("must be one of enum values ('>=', '$')") - return v + return value @validator('array_enum') - def array_enum_validate_enum(cls, v): - if v is None: - return v + def array_enum_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - for i in v: + for i in value: if i not in ('fish', 'crab'): raise ValueError("each list item must be one of ('fish', 'crab')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -87,7 +89,7 @@ class EnumArrays(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return EnumArrays.parse_obj(obj) _obj = EnumArrays.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_test.py index 6da81fb921e..49ab3671883 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_test.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -43,48 +42,54 @@ class EnumTest(BaseModel): __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] @validator('enum_string') - def enum_string_validate_enum(cls, v): - if v is None: - return v + def enum_string_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('UPPER', 'lower', ''): + if value not in ('UPPER', 'lower', ''): raise ValueError("must be one of enum values ('UPPER', 'lower', '')") - return v + return value @validator('enum_string_required') - def enum_string_required_validate_enum(cls, v): - if v not in ('UPPER', 'lower', ''): + def enum_string_required_validate_enum(cls, value): + """Validates the enum""" + if value not in ('UPPER', 'lower', ''): raise ValueError("must be one of enum values ('UPPER', 'lower', '')") - return v + return value @validator('enum_integer_default') - def enum_integer_default_validate_enum(cls, v): - if v is None: - return v + def enum_integer_default_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in (1, 5, 14): + if value not in (1, 5, 14): raise ValueError("must be one of enum values (1, 5, 14)") - return v + return value @validator('enum_integer') - def enum_integer_validate_enum(cls, v): - if v is None: - return v + def enum_integer_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in (1, -1): + if value not in (1, -1): raise ValueError("must be one of enum values (1, -1)") - return v + return value @validator('enum_number') - def enum_number_validate_enum(cls, v): - if v is None: - return v + def enum_number_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in (1.1, -1.2): + if value not in (1.1, -1.2): raise ValueError("must be one of enum values (1.1, -1.2)") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -126,7 +131,7 @@ class EnumTest(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return EnumTest.parse_obj(obj) _obj = EnumTest.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file.py index 182d9cd0fc0..f6c6932f005 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class File(BaseModel): __properties = ["sourceURI"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class File(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return File.parse_obj(obj) _obj = File.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file_schema_test_class.py index f822f4599b3..8915c11973d 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file_schema_test_class.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class FileSchemaTestClass(BaseModel): __properties = ["file", "files"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -79,7 +79,7 @@ class FileSchemaTestClass(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return FileSchemaTestClass.parse_obj(obj) _obj = FileSchemaTestClass.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/first_ref.py index 31ac2390677..2916d18a506 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/first_ref.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/first_ref.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class FirstRef(BaseModel): __properties = ["category", "self_ref"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -71,7 +71,7 @@ class FirstRef(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return FirstRef.parse_obj(obj) _obj = FirstRef.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/foo.py index 7a29b7f5728..e97ebbda9b8 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/foo.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class Foo(BaseModel): __properties = ["bar"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class Foo(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Foo.parse_obj(obj) _obj = Foo.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/foo_get_default_response.py index 99b2dca4723..a1400273409 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/foo_get_default_response.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/foo_get_default_response.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class FooGetDefaultResponse(BaseModel): __properties = ["string"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -71,7 +71,7 @@ class FooGetDefaultResponse(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return FooGetDefaultResponse.parse_obj(obj) _obj = FooGetDefaultResponse.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/format_test.py index f2718790a0b..12f9555d7d8 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/format_test.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -47,42 +46,47 @@ class FormatTest(BaseModel): __properties = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] @validator('string') - def string_validate_regular_expression(cls, v): - if v is None: - return v + def string_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value - if not re.match(r"[a-z]", v ,re.IGNORECASE): + if not re.match(r"[a-z]", value ,re.IGNORECASE): raise ValueError(r"must validate the regular expression /[a-z]/i") - return v + return value @validator('string_with_double_quote_pattern') - def string_with_double_quote_pattern_validate_regular_expression(cls, v): - if v is None: - return v + def string_with_double_quote_pattern_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value - if not re.match(r"this is \"something\"", v): + if not re.match(r"this is \"something\"", value): raise ValueError(r"must validate the regular expression /this is \"something\"/") - return v + return value @validator('pattern_with_digits') - def pattern_with_digits_validate_regular_expression(cls, v): - if v is None: - return v + def pattern_with_digits_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value - if not re.match(r"^\d{10}$", v): + if not re.match(r"^\d{10}$", value): raise ValueError(r"must validate the regular expression /^\d{10}$/") - return v + return value @validator('pattern_with_digits_and_delimiter') - def pattern_with_digits_and_delimiter_validate_regular_expression(cls, v): - if v is None: - return v + def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value - if not re.match(r"^image_\d{1,3}$", v ,re.IGNORECASE): + if not re.match(r"^image_\d{1,3}$", value ,re.IGNORECASE): raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -119,7 +123,7 @@ class FormatTest(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return FormatTest.parse_obj(obj) _obj = FormatTest.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/has_only_read_only.py index 6207f7f2ece..72c07842560 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/has_only_read_only.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class HasOnlyReadOnly(BaseModel): __properties = ["bar", "foo"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -70,7 +70,7 @@ class HasOnlyReadOnly(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return HasOnlyReadOnly.parse_obj(obj) _obj = HasOnlyReadOnly.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/health_check_result.py index 51dcd4cdccf..84caace7566 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/health_check_result.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class HealthCheckResult(BaseModel): __properties = ["NullableMessage"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -72,7 +72,7 @@ class HealthCheckResult(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return HealthCheckResult.parse_obj(obj) _obj = HealthCheckResult.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/inner_dict_with_property.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/inner_dict_with_property.py index 23cc8e6a3a1..a560f57f7c2 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/inner_dict_with_property.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/inner_dict_with_property.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class InnerDictWithProperty(BaseModel): __properties = ["aProperty"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class InnerDictWithProperty(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return InnerDictWithProperty.parse_obj(obj) _obj = InnerDictWithProperty.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/list.py index 27daff87ea4..378f9a3f098 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/list.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/list.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class List(BaseModel): __properties = ["123-list"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class List(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return List.parse_obj(obj) _obj = List.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/map_test.py index 30cc0146b07..c28cccb50b4 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/map_test.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -34,15 +33,17 @@ class MapTest(BaseModel): __properties = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"] @validator('map_of_enum_string') - def map_of_enum_string_validate_enum(cls, v): - if v is None: - return v + def map_of_enum_string_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('UPPER', 'lower'): + if value not in ('UPPER', 'lower'): raise ValueError("must be one of enum values ('UPPER', 'lower')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -79,7 +80,7 @@ class MapTest(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return MapTest.parse_obj(obj) _obj = MapTest.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/mixed_properties_and_additional_properties_class.py index 0e9351ebf19..bbece70cf3b 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -34,6 +33,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): __properties = ["uuid", "dateTime", "map"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -77,7 +77,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return MixedPropertiesAndAdditionalPropertiesClass.parse_obj(obj) _obj = MixedPropertiesAndAdditionalPropertiesClass.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/model200_response.py index 30425febafa..0158f829fb9 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/model200_response.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Model200Response(BaseModel): __properties = ["name", "class"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class Model200Response(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Model200Response.parse_obj(obj) _obj = Model200Response.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/model_return.py index e26375be4f7..b4a4d3a6c6c 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/model_return.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class ModelReturn(BaseModel): __properties = ["return"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class ModelReturn(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ModelReturn.parse_obj(obj) _obj = ModelReturn.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/name.py index b17307dc3a3..5ce9d8caf1f 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/name.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -34,6 +33,7 @@ class Name(BaseModel): __properties = ["name", "snake_case", "property", "123Number"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -72,7 +72,7 @@ class Name(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Name.parse_obj(obj) _obj = Name.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/nullable_class.py index f29c76b594d..5b4366c6ac5 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/nullable_class.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -42,6 +41,7 @@ class NullableClass(BaseModel): __properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -127,7 +127,7 @@ class NullableClass(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return NullableClass.parse_obj(obj) _obj = NullableClass.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/number_only.py index 65809405f19..16fa97f69e3 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/number_only.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class NumberOnly(BaseModel): __properties = ["JustNumber"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class NumberOnly(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return NumberOnly.parse_obj(obj) _obj = NumberOnly.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/object_with_deprecated_fields.py index 7904c259858..3987fcd787c 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/object_with_deprecated_fields.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -35,6 +34,7 @@ class ObjectWithDeprecatedFields(BaseModel): __properties = ["uuid", "id", "deprecatedRef", "bars"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -74,7 +74,7 @@ class ObjectWithDeprecatedFields(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ObjectWithDeprecatedFields.parse_obj(obj) _obj = ObjectWithDeprecatedFields.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/order.py index babf76251b2..27df77588bc 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/order.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -36,15 +35,17 @@ class Order(BaseModel): __properties = ["id", "petId", "quantity", "shipDate", "status", "complete"] @validator('status') - def status_validate_enum(cls, v): - if v is None: - return v + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('placed', 'approved', 'delivered'): + if value not in ('placed', 'approved', 'delivered'): raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -81,7 +82,7 @@ class Order(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Order.parse_obj(obj) _obj = Order.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/outer_composite.py index 855fb1a585e..1afabc591c2 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/outer_composite.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/outer_composite.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class OuterComposite(BaseModel): __properties = ["my_number", "my_string", "my_boolean"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -69,7 +69,7 @@ class OuterComposite(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return OuterComposite.parse_obj(obj) _obj = OuterComposite.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/outer_object_with_enum_property.py index c29ef3b4312..de96620dd78 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/outer_object_with_enum_property.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/outer_object_with_enum_property.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -34,6 +33,7 @@ class OuterObjectWithEnumProperty(BaseModel): __properties = ["str_value", "value"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -75,7 +75,7 @@ class OuterObjectWithEnumProperty(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return OuterObjectWithEnumProperty.parse_obj(obj) _obj = OuterObjectWithEnumProperty.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/parent.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/parent.py index 1ed518fabbc..01074916751 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/parent.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/parent.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Parent(BaseModel): __properties = ["optionalDict"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -75,7 +75,7 @@ class Parent(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Parent.parse_obj(obj) _obj = Parent.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/parent_with_optional_dict.py index 0e7948d73b3..53fa6f72cba 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/parent_with_optional_dict.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/parent_with_optional_dict.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class ParentWithOptionalDict(BaseModel): __properties = ["optionalDict"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -75,7 +75,7 @@ class ParentWithOptionalDict(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ParentWithOptionalDict.parse_obj(obj) _obj = ParentWithOptionalDict.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py index 446e5de9c45..b13a9b1b8da 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -38,15 +37,17 @@ class Pet(BaseModel): __properties = ["id", "category", "name", "photoUrls", "tags", "status"] @validator('status') - def status_validate_enum(cls, v): - if v is None: - return v + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('available', 'pending', 'sold'): + if value not in ('available', 'pending', 'sold'): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -93,7 +94,7 @@ class Pet(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Pet.parse_obj(obj) _obj = Pet.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pig.py index 66cebdd798c..e39ad8ccea9 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pig.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pig.py @@ -50,13 +50,13 @@ class Pig(BaseModel): error_messages = [] match = 0 # validate data type: BasquePig - if type(v) is not BasquePig: + if not isinstance(v, BasquePig): error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") else: match += 1 # validate data type: DanishPig - if type(v) is not DanishPig: + if not isinstance(v, DanishPig): error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") else: match += 1 diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/read_only_first.py index 73a9c98aec4..cf0814ba688 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/read_only_first.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/read_only_first.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class ReadOnlyFirst(BaseModel): __properties = ["bar", "baz"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -69,7 +69,7 @@ class ReadOnlyFirst(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ReadOnlyFirst.parse_obj(obj) _obj = ReadOnlyFirst.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/second_ref.py index 228c8b24b92..486f5dec934 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/second_ref.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/second_ref.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class SecondRef(BaseModel): __properties = ["category", "circular_ref"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -71,7 +71,7 @@ class SecondRef(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return SecondRef.parse_obj(obj) _obj = SecondRef.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/self_reference_model.py index faca1f2f565..743ece5ae39 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/self_reference_model.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/self_reference_model.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class SelfReferenceModel(BaseModel): __properties = ["size", "nested"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -71,7 +71,7 @@ class SelfReferenceModel(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return SelfReferenceModel.parse_obj(obj) _obj = SelfReferenceModel.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_model_name.py index 0f7f93facf7..ea5cafa061c 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_model_name.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_model_name.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class SpecialModelName(BaseModel): __properties = ["$special[property.name]"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ class SpecialModelName(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return SpecialModelName.parse_obj(obj) _obj = SpecialModelName.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_name.py index 4715e8dac30..69c7ab7ea93 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_name.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_name.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -34,15 +33,17 @@ class SpecialName(BaseModel): __properties = ["property", "async", "schema"] @validator('var_schema') - def var_schema_validate_enum(cls, v): - if v is None: - return v + def var_schema_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if v not in ('available', 'pending', 'sold'): + if value not in ('available', 'pending', 'sold'): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -82,7 +83,7 @@ class SpecialName(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return SpecialName.parse_obj(obj) _obj = SpecialName.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/tag.py index 4b01f942e82..dc39529e068 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/tag.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class Tag(BaseModel): __properties = ["id", "name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -68,7 +68,7 @@ class Tag(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Tag.parse_obj(obj) _obj = Tag.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/user.py index c52f49d337a..7046a2ce644 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/user.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -38,6 +37,7 @@ class User(BaseModel): __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -74,7 +74,7 @@ class User(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return User.parse_obj(obj) _obj = User.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/with_nested_one_of.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/with_nested_one_of.py index 52a535dcef2..4967259433d 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/with_nested_one_of.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/with_nested_one_of.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -33,6 +32,7 @@ class WithNestedOneOf(BaseModel): __properties = ["size", "nested_pig"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -72,7 +72,7 @@ class WithNestedOneOf(BaseModel): if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return WithNestedOneOf.parse_obj(obj) _obj = WithNestedOneOf.parse_obj({ diff --git a/samples/openapi3/client/petstore/python-nextgen/pyproject.toml b/samples/openapi3/client/petstore/python-nextgen/pyproject.toml index b31e8940819..ed6bee8c6b8 100644 --- a/samples/openapi3/client/petstore/python-nextgen/pyproject.toml +++ b/samples/openapi3/client/petstore/python-nextgen/pyproject.toml @@ -15,7 +15,7 @@ urllib3 = ">= 1.25.3" python-dateutil = ">=2.8.2" pem = ">= 19.3.0" pycryptodome = ">= 3.9.0" -pydantic = "^1.10.5" +pydantic = "^1.10.5, <2" aenum = ">=3.1.11" [tool.poetry.dev-dependencies] @@ -27,3 +27,5 @@ flake8 = ">=4.0.0" requires = ["setuptools"] build-backend = "setuptools.build_meta" +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic"