Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and lafrech committed Mar 13, 2024
1 parent 65f676a commit 2855263
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/apispec/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Contains main apispec classes: `APISpec` and `BasePlugin`"""

import typing

from .core import APISpec
Expand Down
5 changes: 3 additions & 2 deletions src/apispec/ext/marshmallow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class UserSchema(Schema):
# 'type': 'object'}}
"""

# pyright: reportIncompatibleMethodOverride=false
from __future__ import annotations

Expand Down Expand Up @@ -236,8 +237,8 @@ def warn_if_schema_already_in_spec(self, schema_key: tuple) -> None:
assert self.converter # needed for mypy
if schema_key in self.converter.refs:
warnings.warn(
"{} has already been added to the spec. Adding it twice may "
"cause references to not resolve properly.".format(schema_key[0]),
f"{schema_key[0]} has already been added to the spec. Adding it twice may "
"cause references to not resolve properly.",
UserWarning,
stacklevel=2,
)
4 changes: 2 additions & 2 deletions src/apispec/ext/marshmallow/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ def get_unique_schema_name(components: Components, name: str, counter: int = 0)
return name
if not counter: # first time through recursion
warnings.warn(
"Multiple schemas resolved to the name {}. The name has been modified. "
f"Multiple schemas resolved to the name {name}. The name has been modified. "
"Either manually add each of the schemas with a different name or "
"provide a custom schema_name_resolver.".format(name),
"provide a custom schema_name_resolver.",
UserWarning,
stacklevel=2,
)
Expand Down
5 changes: 3 additions & 2 deletions src/apispec/ext/marshmallow/field_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
This module is treated as private API.
Users should not need to use this module directly.
"""

from __future__ import annotations

import functools
Expand Down Expand Up @@ -386,8 +387,8 @@ def field2pattern(

if next(regex_validators, None) is not None:
warnings.warn(
"More than one regex validator defined on {} field. Only the "
"first one will be used in the output spec.".format(type(field)),
f"More than one regex validator defined on {type(field)} field. Only the "
"first one will be used in the output spec.",
UserWarning,
stacklevel=2,
)
Expand Down
1 change: 1 addition & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities to get elements of generated spec"""

import openapi_spec_validator
from openapi_spec_validator.exceptions import OpenAPISpecValidatorError

Expand Down

0 comments on commit 2855263

Please sign in to comment.