|
1 | 1 | import string |
| 2 | +from collections.abc import Iterator |
| 3 | +from collections.abc import Sequence |
2 | 4 | from typing import TYPE_CHECKING |
3 | 5 | from typing import Any |
4 | | -from typing import Sequence |
5 | | -from typing import Iterator |
6 | | -from typing import List |
7 | 6 | from typing import Optional |
8 | 7 | from typing import cast |
9 | 8 |
|
@@ -68,7 +67,7 @@ class SchemaValidator(KeywordValidator): |
68 | 67 | def __init__(self, registry: "KeywordValidatorRegistry"): |
69 | 68 | super().__init__(registry) |
70 | 69 |
|
71 | | - self.schema_ids_registry: Optional[List[int]] = [] |
| 70 | + self.schema_ids_registry: Optional[list[int]] = [] |
72 | 71 |
|
73 | 72 | @property |
74 | 73 | def default_validator(self) -> ValueValidator: |
@@ -113,8 +112,9 @@ def __call__( |
113 | 112 | all_of = schema / "allOf" |
114 | 113 | for inner_schema in all_of: |
115 | 114 | yield from self(inner_schema, require_properties=False) |
116 | | - nested_properties += list(self._collect_properties(inner_schema)) |
117 | | - |
| 115 | + nested_properties += list( |
| 116 | + self._collect_properties(inner_schema) |
| 117 | + ) |
118 | 118 |
|
119 | 119 | if "anyOf" in schema: |
120 | 120 | any_of = schema / "anyOf" |
@@ -154,8 +154,12 @@ def __call__( |
154 | 154 | require_properties=False, |
155 | 155 | ) |
156 | 156 |
|
157 | | - required = "required" in schema and (schema / "required").read_value() or [] |
158 | | - properties = "properties" in schema and (schema / "properties").keys() or [] |
| 157 | + required = ( |
| 158 | + "required" in schema and (schema / "required").read_value() or [] |
| 159 | + ) |
| 160 | + properties = ( |
| 161 | + "properties" in schema and (schema / "properties").keys() or [] |
| 162 | + ) |
159 | 163 | if "allOf" in schema: |
160 | 164 | extra_properties = list( |
161 | 165 | set(required) - set(properties) - set(nested_properties) |
@@ -305,7 +309,7 @@ class OperationValidator(KeywordValidator): |
305 | 309 | def __init__(self, registry: "KeywordValidatorRegistry"): |
306 | 310 | super().__init__(registry) |
307 | 311 |
|
308 | | - self.operation_ids_registry: Optional[List[str]] = [] |
| 312 | + self.operation_ids_registry: Optional[list[str]] = [] |
309 | 313 |
|
310 | 314 | @property |
311 | 315 | def responses_validator(self) -> ResponsesValidator: |
@@ -356,8 +360,7 @@ def __call__( |
356 | 360 | for path in self._get_path_params_from_url(url): |
357 | 361 | if path not in all_params: |
358 | 362 | yield UnresolvableParameterError( |
359 | | - "Path parameter '{}' for '{}' operation in '{}' " |
360 | | - "was not resolved".format(path, name, url) |
| 363 | + f"Path parameter '{path}' for '{name}' operation in '{url}' was not resolved" |
361 | 364 | ) |
362 | 365 | return |
363 | 366 |
|
|
0 commit comments