forked from loafle/openapi-generator-original
python: simplify module imports (#17507)
In #16624, I introduced a new mechanism to record imports to other modules, instead of having specialized datetime/typing/pydantic objects to manage imports for these modules. This change reuses the mechanism from #16624 and replace the specialized import managers by the generic one. Unused imports from various .mustache templates are also cleaned up.
This commit is contained in:
@@ -12,12 +12,9 @@
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import io
|
||||
import warnings
|
||||
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Dict, List, Optional, Tuple, Union, Any
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
try:
|
||||
from typing import Annotated
|
||||
|
||||
@@ -12,24 +12,18 @@
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import io
|
||||
import warnings
|
||||
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Dict, List, Optional, Tuple, Union, Any
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
try:
|
||||
from typing import Annotated
|
||||
except ImportError:
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from pydantic import Field
|
||||
from typing_extensions import Annotated
|
||||
from pydantic import StrictBytes, StrictStr
|
||||
|
||||
from pydantic import Field, StrictBytes, StrictStr
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from typing_extensions import Annotated
|
||||
from openapi_client.models.pet import Pet
|
||||
from openapi_client.models.tag import Tag
|
||||
|
||||
@@ -519,7 +513,7 @@ class BodyApi:
|
||||
if body is not None:
|
||||
# convert to byte array if the input is a file name (str)
|
||||
if isinstance(body, str):
|
||||
with io.open(body, "rb") as _fp:
|
||||
with open(body, "rb") as _fp:
|
||||
_body_params = _fp.read()
|
||||
else:
|
||||
_body_params = body
|
||||
|
||||
@@ -12,12 +12,9 @@
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import io
|
||||
import warnings
|
||||
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Dict, List, Optional, Tuple, Union, Any
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
try:
|
||||
from typing import Annotated
|
||||
@@ -25,10 +22,8 @@ except ImportError:
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from pydantic import StrictBool, StrictInt, StrictStr
|
||||
|
||||
from typing import Optional
|
||||
|
||||
|
||||
from openapi_client.api_client import ApiClient
|
||||
from openapi_client.api_response import ApiResponse
|
||||
from openapi_client.rest import RESTResponseType
|
||||
|
||||
@@ -12,12 +12,9 @@
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import io
|
||||
import warnings
|
||||
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Dict, List, Optional, Tuple, Union, Any
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
try:
|
||||
from typing import Annotated
|
||||
@@ -25,9 +22,7 @@ except ImportError:
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from pydantic import StrictBool, StrictInt, StrictStr, field_validator
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
|
||||
from openapi_client.api_client import ApiClient
|
||||
|
||||
@@ -12,12 +12,9 @@
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import io
|
||||
import warnings
|
||||
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Dict, List, Optional, Tuple, Union, Any
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
try:
|
||||
from typing import Annotated
|
||||
@@ -25,7 +22,6 @@ except ImportError:
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from pydantic import StrictInt, StrictStr, field_validator
|
||||
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
|
||||
from openapi_client.api_client import ApiClient
|
||||
|
||||
@@ -12,12 +12,9 @@
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import io
|
||||
import warnings
|
||||
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Dict, List, Optional, Tuple, Union, Any
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
try:
|
||||
from typing import Annotated
|
||||
@@ -25,11 +22,8 @@ except ImportError:
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from datetime import date, datetime
|
||||
|
||||
from pydantic import StrictBool, StrictInt, StrictStr, field_validator
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
from openapi_client.models.pet import Pet
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
|
||||
Reference in New Issue
Block a user