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 f4687163d261..d0dbb52f33c8 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 6402a352c8b0..6b3ca7a5c56a 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 b65f784d1cc1..d0a2fc6b6c4e 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 1ab024d87f21..af3b379c628e 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 2f8814af624d..1b4435443910 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 20e8ef180c2a..5d5c52050461 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 500a087fe754..7d491a7aabf2 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 b0fcf04d3f9a..9e0080d2196a 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 5fa33c19abac..9039bbbc68a6 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 cd8377701544..4a7a717f6376 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 1d41038d83a2..905002e6a14d 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 4f932a13a86f..f24cd4b2af33 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 430b70f45190..b0a4598e0686 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 e43c6fc5a814..11113ca0d706 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 f39267b5ac5d..f9d2a601f24a 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 0a22d86748b6..2be7cdbbec6c 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 34cead3a8a35..c2e07e7095a4 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 c6826c1a651d..aeb365da90be 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 5bdd2d938163..9279e0398410 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 e9e97b7d404a..d18b58876df1 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 26f3025fb3a1..d42d3d865769 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 4593b477f599..3a392f17c201 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 9a03e3150aae..96fa5c93a0d8 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 021c38893c64..e6775be1c70e 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 2c9210a9fa19..9f2a647b3e23 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 64518b994479..d849bb224f87 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 0f1ece68548c..b4bc6a226ffd 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 7fd50e589754..1d64673d4dae 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 311634b1081f..95eeff4eecd9 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 3a03dad4ddd5..a2267f66d489 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 04cd03eb71fd..ed62d02c8980 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 793b26fab96d..25a00323c5d7 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 9a45a77b607c..0071d4378166 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 1b17a9aec471..364d0b2fb2fc 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 03b803d87888..52df38fcdd55 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 9fa8cea2d486..5caa2492ffc0 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 47cc18f1a121..806332316dfa 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 c56f6e927c1c..73d6b81c171d 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 2f62f6d76e5c..f93051f43650 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 aae806f95159..fb0c1b037523 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 86c9b1bd46fc..80f8965a5956 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 0856f9b0dafb..14a1cf6f4f32 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 c85ac8cec6ce..7f92613b7a99 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 1a8502a9eb6e..d51b9180234c 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 ce02674ff3b7..ccaf4712da75 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 47345cc0a89e..d966338a757c 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 8f674067ff83..df22bd73b5ed 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 8bce01a25b4e..bdafe0535816 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 e0a3f4b55e4a..07630b0932c5 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 512f09d73eb0..89513002284a 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 23b80efa20ed..c381b9ab5263 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 55ddbc2a050c..d5443ea6a15e 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 527a4f5b47e7..0f7e4bbe06ab 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 bf9ab74413bc..b13fdb2e507e 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 969acaeca05b..0235d20c8e51 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 c4a400a846c2..e7eaf5ef0604 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 d056ce8778a6..e2ae308b3e0f 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 7a61819b8b15..6b88135404e9 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 7fce7797fee4..5846744e3bde 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 78ea1841d7b7..a08adf4f3ae0 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 8af68a0065d7..f8fff21bf2da 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 0918d6e7e38a..faf221750569 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 af7b3e37fdcb..28614099822e 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 baa32ba0c4a9..5f27432d247d 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 ac16280844b1..d6c71f77e836 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 f00e27569201..2e5442dcc573 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 b8fa0dd875f0..5e40902ead50 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 bc9f7b4cdaa2..5f7a78250bd2 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 bdb0c8931b03..a72b537dcdb3 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 80c683f5d95d..8d53ed209692 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 77c6b277f014..8e58d9ae4915 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 6690f8dd7348..519318efdb28 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 6c4548406a1c..70ac4c13846f 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 e99d1d384d5d..82e55e0c6215 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 7480ccec361d..4a364b413ef1 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 c37cccbf4465..446dfeba4355 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 e9e97b7d404a..d18b58876df1 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 da810c920868..7c7ae29a6f26 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 981ec9cebd91..78fcaaf5b50d 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 89a4169e0855..f3968f5b0b2e 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 9fe1c047ecbe..afef8bee0fda 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 cc775a10e26e..bdbd436295ee 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 92695072b184..03532ccd4c8f 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 f2aca6685191..ec62d7beff5a 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 349fcc17b58b..38dfa14c5f09 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 d1cfde84d0f7..17edf3573cf0 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 eacb22736b36..381caa664070 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 b20fe9ca2139..7963b8314556 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 a2d085647327..5b70640f0059 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 88cf28e3b674..c4c92e4d2925 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 870fec8e859f..627754883837 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 eb6510a7a171..a3d3b960079f 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 50b2b59ac0f7..7e61359cdb17 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 d0db2bdc1884..31dcde4857be 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 f270d1cd14dd..1e9f7e748a47 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 6da81fb921ee..49ab3671883e 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 182d9cd0fc04..f6c6932f005e 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 f822f4599b3d..8915c11973da 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 31ac23906770..2916d18a5066 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 7a29b7f57287..e97ebbda9b80 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 99b2dca47233..a1400273409a 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 f2718790a0b5..12f9555d7d8f 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 6207f7f2ecec..72c07842560b 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 51dcd4cdccfe..84caace75668 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 23cc8e6a3a13..a560f57f7c2c 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 27daff87ea4a..378f9a3f0985 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 30cc0146b075..c28cccb50b44 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 0e9351ebf19e..bbece70cf3bb 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 30425febafa4..0158f829fb98 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 e26375be4f7d..b4a4d3a6c6c9 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 b17307dc3a3d..5ce9d8caf1f9 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 f29c76b594d7..5b4366c6ac5d 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 65809405f19a..16fa97f69e36 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 7904c259858f..3987fcd787ca 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 babf76251b24..27df77588bcf 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 855fb1a585e9..1afabc591c23 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 c29ef3b43123..de96620dd781 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 1ed518fabbc1..010749167511 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 0e7948d73b39..53fa6f72cbac 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 446e5de9c45f..b13a9b1b8daa 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 66cebdd798c5..e39ad8ccea99 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 73a9c98aec46..cf0814ba6888 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 228c8b24b922..486f5dec934e 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 faca1f2f565f..743ece5ae39b 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 0f7f93facf76..ea5cafa061c4 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 4715e8dac309..69c7ab7ea939 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 4b01f942e820..dc39529e068a 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 c52f49d337a3..7046a2ce644b 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 52a535dcef23..4967259433de 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 b31e89408191..ed6bee8c6b85 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"