Skip to content

Commit a36b49c

Browse files
committed
vendored openapi_schema_pydantic / correct flake8 warnings
- correct: W293, W291, F821
1 parent ec1a8bc commit a36b49c

21 files changed

+124
-126
lines changed

openapi_python_client/schema/openapi_schema_pydantic/__init__.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,36 +36,37 @@
3636
"ServerVariable",
3737
"Tag",
3838
"XML",
39+
"Callback",
3940
]
4041

4142

42-
from .open_api import OpenAPI
43-
from .info import Info
43+
from .callback import Callback
44+
from .components import Components
4445
from .contact import Contact
46+
from .discriminator import Discriminator
47+
from .encoding import Encoding
48+
from .example import Example
49+
from .external_documentation import ExternalDocumentation
50+
from .header import Header
51+
from .info import Info
4552
from .license import License
46-
from .server import Server
47-
from .server_variable import ServerVariable
48-
from .components import Components
49-
from .paths import Paths
50-
from .path_item import PathItem
53+
from .link import Link
54+
from .media_type import MediaType
55+
from .oauth_flow import OAuthFlow
56+
from .oauth_flows import OAuthFlows
57+
from .open_api import OpenAPI
5158
from .operation import Operation
52-
from .external_documentation import ExternalDocumentation
5359
from .parameter import Parameter
60+
from .path_item import PathItem
61+
from .paths import Paths
62+
from .reference import Reference
5463
from .request_body import RequestBody
55-
from .media_type import MediaType
56-
from .encoding import Encoding
57-
from .responses import Responses
5864
from .response import Response
59-
from .callback import Callback
60-
from .example import Example
61-
from .link import Link
62-
from .header import Header
63-
from .tag import Tag
64-
from .reference import Reference
65+
from .responses import Responses
6566
from .schema import Schema
66-
from .discriminator import Discriminator
67-
from .xml import XML
68-
from .security_scheme import SecurityScheme
69-
from .oauth_flows import OAuthFlows
70-
from .oauth_flow import OAuthFlow
7167
from .security_requirement import SecurityRequirement
68+
from .security_scheme import SecurityScheme
69+
from .server import Server
70+
from .server_variable import ServerVariable
71+
from .tag import Tag
72+
from .xml import XML

openapi_python_client/schema/openapi_schema_pydantic/callback.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from typing import Dict
22

3-
4-
Callback = Dict[str, "PathItem"]
3+
Callback = Dict[str, "PathItem"] # noqa
54
"""
65
A map of possible out-of band callbacks related to the parent operation.
76
Each value in the map is a [Path Item Object](#pathItemObject)

openapi_python_client/schema/openapi_schema_pydantic/encoding.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ class Encoding(BaseModel):
1212
"""
1313
The Content-Type for encoding a specific property.
1414
Default value depends on the property type:
15-
15+
1616
- for `string` with `format` being `binary` – `application/octet-stream`;
1717
- for other primitive types – `text/plain`;
1818
- for `object` - `application/json`;
1919
- for `array` – the default is defined based on the inner type.
20-
20+
2121
The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`),
2222
or a comma-separated list of the two types.
2323
"""
2424

25-
headers: Optional[Dict[str, Union["Header", Reference]]] = None
25+
headers: Optional[Dict[str, Union["Header", Reference]]] = None # noqa
2626
"""
2727
A map allowing additional information to be provided as headers, for example `Content-Disposition`.
28-
28+
2929
`Content-Type` is described separately and SHALL be ignored in this section.
3030
This property SHALL be ignored if the request body media type is not a `multipart`.
3131
"""
3232

3333
style: Optional[str] = None
3434
"""
3535
Describes how a specific property value will be serialized depending on its type.
36-
36+
3737
See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property.
3838
The behavior follows the same values as `query` parameters, including default values.
3939
This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
@@ -43,7 +43,7 @@ class Encoding(BaseModel):
4343
"""
4444
When this is true, property values of type `array` or `object` generate separate parameters
4545
for each value of the array, or key-value-pair of the map.
46-
46+
4747
For other types of properties this property has no effect.
4848
When [`style`](#encodingStyle) is `form`, the default value is `true`.
4949
For all other styles, the default value is `false`.

openapi_python_client/schema/openapi_schema_pydantic/example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Example(BaseModel):
2828
"""
2929
A URL that points to the literal example.
3030
This provides the capability to reference examples that cannot easily be included in JSON or YAML documents.
31-
31+
3232
The `value` field and `externalValue` field are mutually exclusive.
3333
"""
3434

openapi_python_client/schema/openapi_schema_pydantic/link.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Link(BaseModel):
3131
operationId: Optional[str] = None
3232
"""
3333
The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`.
34-
34+
3535
This field is mutually exclusive of the `operationRef` field.
3636
"""
3737

@@ -41,7 +41,7 @@ class Link(BaseModel):
4141
as specified with `operationId` or identified via `operationRef`.
4242
The key is the parameter name to be used,
4343
whereas the value can be a constant or an expression to be evaluated and passed to the linked operation.
44-
44+
4545
The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}`
4646
for operations that use the same parameter name in different locations (e.g. path.id).
4747
"""

openapi_python_client/schema/openapi_schema_pydantic/media_type.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ class MediaType(BaseModel):
1919
example: Optional[Any] = None
2020
"""
2121
Example of the media type.
22-
22+
2323
The example object SHOULD be in the correct format as specified by the media type.
24-
24+
2525
The `example` field is mutually exclusive of the `examples` field.
26-
26+
2727
Furthermore, if referencing a `schema` which contains an example,
2828
the `example` value SHALL _override_ the example provided by the schema.
2929
"""
3030

3131
examples: Optional[Dict[str, Union[Example, Reference]]] = None
3232
"""
3333
Examples of the media type.
34-
34+
3535
Each example object SHOULD match the media type and specified schema if present.
36-
36+
3737
The `examples` field is mutually exclusive of the `example` field.
38-
38+
3939
Furthermore, if referencing a `schema` which contains an example,
4040
the `examples` value SHALL _override_ the example provided by the schema.
4141
"""

openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Dict, Optional, Union
1+
from typing import Dict, Optional
22

33
from pydantic import AnyUrl, BaseModel, Extra
44

openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ class OAuthFlows(BaseModel):
2323
clientCredentials: Optional[OAuthFlow] = None
2424
"""
2525
Configuration for the OAuth Client Credentials flow.
26-
26+
2727
Previously called `application` in OpenAPI 2.0.
2828
"""
2929

3030
authorizationCode: Optional[OAuthFlow] = None
3131
"""
3232
Configuration for the OAuth Authorization Code flow.
33-
33+
3434
Previously called `accessCode` in OpenAPI 2.0.
3535
"""
3636

openapi_python_client/schema/openapi_schema_pydantic/open_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class OpenAPI(BaseModel):
2121

2222
servers: List[Server] = [Server(url="/")]
2323
"""
24-
An array of Server Objects, which provide connectivity information to a target server.
24+
An array of Server Objects, which provide connectivity information to a target server.
2525
If the `servers` property is not provided, or is an empty array,
2626
the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`.
2727
"""
@@ -38,10 +38,10 @@ class OpenAPI(BaseModel):
3838

3939
security: Optional[List[SecurityRequirement]] = None
4040
"""
41-
A declaration of which security mechanisms can be used across the API.
42-
The list of values includes alternative security requirement objects that can be used.
43-
Only one of the security requirement objects need to be satisfied to authorize a request.
44-
Individual operations can override this definition.
41+
A declaration of which security mechanisms can be used across the API.
42+
The list of values includes alternative security requirement objects that can be used.
43+
Only one of the security requirement objects need to be satisfied to authorize a request.
44+
Individual operations can override this definition.
4545
To make security optional, an empty security requirement (`{}`) can be included in the array.
4646
"""
4747

openapi_python_client/schema/openapi_schema_pydantic/operation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ class Operation(BaseModel):
5959

6060
requestBody: Optional[Union[RequestBody, Reference]] = None
6161
"""
62-
The request body applicable for this operation.
63-
62+
The request body applicable for this operation.
63+
6464
The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification
65-
[RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies.
65+
[RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies.
6666
In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers.
6767
"""
6868

@@ -75,7 +75,7 @@ class Operation(BaseModel):
7575
"""
7676
A map of possible out-of band callbacks related to the parent operation.
7777
The key is a unique identifier for the Callback Object.
78-
Each value in the map is a [Callback Object](#callbackObject)
78+
Each value in the map is a [Callback Object](#callbackObject)
7979
that describes a request that may be initiated by the API provider and the expected responses.
8080
"""
8181

@@ -99,7 +99,7 @@ class Operation(BaseModel):
9999
servers: Optional[List[Server]] = None
100100
"""
101101
An alternative `server` array to service this operation.
102-
If an alternative `server` object is specified at the Path Item Object or Root level,
102+
If an alternative `server` object is specified at the Path Item Object or Root level,
103103
it will be overridden by this value.
104104
"""
105105

openapi_python_client/schema/openapi_schema_pydantic/parameter.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Any, Dict, Optional, Union
22

3-
from pydantic import BaseModel, Field, Extra
3+
from pydantic import BaseModel, Extra, Field
44

55
from ..parameter_location import ParameterLocation
66
from .example import Example
@@ -21,12 +21,12 @@ class Parameter(BaseModel):
2121
name: str = ...
2222
"""
2323
**REQUIRED**. The name of the parameter.
24-
Parameter names are *case sensitive*.
25-
26-
- If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to a template expression occurring
24+
Parameter names are *case sensitive*.
25+
26+
- If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to a template expression occurring
2727
within the [path](#pathsPath) field in the [Paths Object](#pathsObject).
2828
See [Path Templating](#pathTemplating) for further information.
29-
- If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`,
29+
- If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`,
3030
the parameter definition SHALL be ignored.
3131
- For all other cases, the `name` corresponds to the parameter name used by the [`in`](#parameterIn) property.
3232
"""
@@ -76,7 +76,7 @@ class Parameter(BaseModel):
7676
"""
7777
Describes how the parameter value will be serialized depending on the type of the parameter value.
7878
Default values (based on value of `in`):
79-
79+
8080
- for `query` - `form`;
8181
- for `path` - `simple`;
8282
- for `header` - `simple`;
@@ -111,7 +111,7 @@ class Parameter(BaseModel):
111111
Example of the parameter's potential value.
112112
The example SHOULD match the specified schema and encoding properties if present.
113113
The `example` field is mutually exclusive of the `examples` field.
114-
Furthermore, if referencing a `schema` that contains an example,
114+
Furthermore, if referencing a `schema` that contains an example,
115115
the `example` value SHALL _override_ the example provided by the schema.
116116
To represent examples of media types that cannot naturally be represented in JSON or YAML,
117117
a string value can contain the example with escaping where necessary.
@@ -127,7 +127,7 @@ class Parameter(BaseModel):
127127
"""
128128

129129
"""
130-
For more complex scenarios, the [`content`](#parameterContent) property
130+
For more complex scenarios, the [`content`](#parameterContent) property
131131
can define the media type and schema of the parameter.
132132
A parameter MUST contain either a `schema` property, or a `content` property, but not both.
133133
When `example` or `examples` are provided in conjunction with the `schema` object,

openapi_python_client/schema/openapi_schema_pydantic/path_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class PathItem(BaseModel):
2020
"""
2121
Allows for an external definition of this path item.
2222
The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject).
23-
23+
2424
In case a Path Item Object field appears both in the defined object and the referenced object,
2525
the behavior is undefined.
2626
"""

openapi_python_client/schema/openapi_schema_pydantic/paths.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from .path_item import PathItem
44

5-
65
Paths = Dict[str, PathItem]
76
"""
87
Holds the relative paths to the individual endpoints and their operations.
@@ -17,7 +16,7 @@
1716
"""
1817
A relative path to an individual endpoint.
1918
The field name MUST begin with a forward slash (`/`).
20-
The path is **appended** (no relative URL resolution) to the expanded URL
19+
The path is **appended** (no relative URL resolution) to the expanded URL
2120
from the [`Server Object`](#serverObject)'s `url` field in order to construct the full URL.
2221
[Path templating](#pathTemplating) is allowed.
2322
When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts.

openapi_python_client/schema/openapi_schema_pydantic/request_body.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class RequestBody(BaseModel):
1111
description: Optional[str] = None
1212
"""
1313
A brief description of the request body.
14-
This could contain examples of use.
15-
14+
This could contain examples of use.
15+
1616
[CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
1717
"""
1818

@@ -21,7 +21,7 @@ class RequestBody(BaseModel):
2121
**REQUIRED**. The content of the request body.
2222
The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D)
2323
and the value describes it.
24-
24+
2525
For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
2626
"""
2727

openapi_python_client/schema/openapi_schema_pydantic/response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class Response(BaseModel):
3131
"""
3232
A map containing descriptions of potential response payloads.
3333
The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D)
34-
and the value describes it.
35-
34+
and the value describes it.
35+
3636
For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
3737
"""
3838

openapi_python_client/schema/openapi_schema_pydantic/responses.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from typing import Dict, Union
22

3-
from .response import Response
43
from .reference import Reference
5-
4+
from .response import Response
65

76
Responses = Dict[str, Union[Response, Reference]]
87
"""

0 commit comments

Comments
 (0)