]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
⬆️ Upgrade version of Ruff and reformat (#12032)
authorSebastián Ramírez <tiangolo@gmail.com>
Sat, 17 Aug 2024 04:13:50 +0000 (23:13 -0500)
committerGitHub <noreply@github.com>
Sat, 17 Aug 2024 04:13:50 +0000 (23:13 -0500)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
.github/actions/people/app/main.py
.pre-commit-config.yaml
fastapi/dependencies/utils.py
fastapi/routing.py
fastapi/utils.py
requirements-tests.txt
tests/test_dependency_contextmanager.py
tests/test_inherited_custom_class.py

index 33156f1ca2b6c224872817d4f938e69c29266da5..b752d9d2b2fd78d88d04694ac23d6621c64cdbc5 100644 (file)
@@ -515,9 +515,9 @@ def get_individual_sponsors(settings: Settings):
 
     tiers: DefaultDict[float, Dict[str, SponsorEntity]] = defaultdict(dict)
     for node in nodes:
-        tiers[node.tier.monthlyPriceInDollars][
-            node.sponsorEntity.login
-        ] = node.sponsorEntity
+        tiers[node.tier.monthlyPriceInDollars][node.sponsorEntity.login] = (
+            node.sponsorEntity
+        )
     return tiers
 
 
index 4d49845d6730db07a7c629038c885d1acf6b3a76..1ed005657204993b02cab087785881f8a6c9a065 100644 (file)
@@ -14,7 +14,7 @@ repos:
     -   id: end-of-file-fixer
     -   id: trailing-whitespace
 -   repo: https://github.com/charliermarsh/ruff-pre-commit
-    rev: v0.2.0
+    rev: v0.6.1
     hooks:
     -   id: ruff
         args:
index 4f984177a4085184946146183ad5ea1204e6573e..3e8e7b4101e0fd33333eeef8efc2c4729bb36cc4 100644 (file)
@@ -342,9 +342,9 @@ def analyze_param(
             if isinstance(arg, (params.Param, params.Body, params.Depends))
         ]
         if fastapi_specific_annotations:
-            fastapi_annotation: Union[
-                FieldInfo, params.Depends, None
-            ] = fastapi_specific_annotations[-1]
+            fastapi_annotation: Union[FieldInfo, params.Depends, None] = (
+                fastapi_specific_annotations[-1]
+            )
         else:
             fastapi_annotation = None
         if isinstance(fastapi_annotation, FieldInfo):
index fa1351859fb91857a6572d4c7175b3dbd6831a2c..2e7959f3dfcc02f31493878e76b89017b575a4aa 100644 (file)
@@ -454,9 +454,9 @@ class APIRoute(routing.Route):
             methods = ["GET"]
         self.methods: Set[str] = {method.upper() for method in methods}
         if isinstance(generate_unique_id_function, DefaultPlaceholder):
-            current_generate_unique_id: Callable[
-                ["APIRoute"], str
-            ] = generate_unique_id_function.value
+            current_generate_unique_id: Callable[[APIRoute], str] = (
+                generate_unique_id_function.value
+            )
         else:
             current_generate_unique_id = generate_unique_id_function
         self.unique_id = self.operation_id or current_generate_unique_id(self)
@@ -482,9 +482,9 @@ class APIRoute(routing.Route):
             # By being a new field, no inheritance will be passed as is. A new model
             # will always be created.
             # TODO: remove when deprecating Pydantic v1
-            self.secure_cloned_response_field: Optional[
-                ModelField
-            ] = create_cloned_field(self.response_field)
+            self.secure_cloned_response_field: Optional[ModelField] = (
+                create_cloned_field(self.response_field)
+            )
         else:
             self.response_field = None  # type: ignore
             self.secure_cloned_response_field = None
index dfda4e678a544e233ad3ffb10bdfd98ff032f0f2..5c2538facaa937a45a8bf3e3ca17043bc38124ba 100644 (file)
@@ -34,9 +34,9 @@ if TYPE_CHECKING:  # pragma: nocover
     from .routing import APIRoute
 
 # Cache for `create_cloned_field`
-_CLONED_TYPES_CACHE: MutableMapping[
-    Type[BaseModel], Type[BaseModel]
-] = WeakKeyDictionary()
+_CLONED_TYPES_CACHE: MutableMapping[Type[BaseModel], Type[BaseModel]] = (
+    WeakKeyDictionary()
+)
 
 
 def is_body_allowed_for_status_code(status_code: Union[int, str, None]) -> bool:
index 801cf9dd4cba0a46205a7e8d530852d02351efe9..08561d23a9ac06f7b4d83c31181385ec316facd9 100644 (file)
@@ -3,7 +3,7 @@
 pytest >=7.1.3,<8.0.0
 coverage[toml] >= 6.5.0,< 8.0
 mypy ==1.8.0
-ruff ==0.2.0
+ruff ==0.6.1
 dirty-equals ==0.6.0
 # TODO: once removing databases from tutorial, upgrade SQLAlchemy
 # probably when including SQLModel
index 008dab7bc74cbe07f911de17e1d258779f61918f..039c423b9850a61a3aeae6e115e03984be851a18 100644 (file)
@@ -196,9 +196,9 @@ async def get_sync_context_b_bg(
     tasks: BackgroundTasks, state: dict = Depends(context_b)
 ):
     async def bg(state: dict):
-        state[
-            "sync_bg"
-        ] = f"sync_bg set - b: {state['context_b']} - a: {state['context_a']}"
+        state["sync_bg"] = (
+            f"sync_bg set - b: {state['context_b']} - a: {state['context_a']}"
+        )
 
     tasks.add_task(bg, state)
     return state
index 42b249211ddc9ee6a44c306d0b1fc99a85a4a7d1..fe9350f4ef35307902db98973afa73d001732c68 100644 (file)
@@ -36,7 +36,7 @@ def test_pydanticv2():
     def return_fast_uuid():
         asyncpg_uuid = MyUuid("a10ff360-3b1e-4984-a26f-d3ab460bdb51")
         assert isinstance(asyncpg_uuid, uuid.UUID)
-        assert type(asyncpg_uuid) != uuid.UUID
+        assert type(asyncpg_uuid) is not uuid.UUID
         with pytest.raises(TypeError):
             vars(asyncpg_uuid)
         return {"fast_uuid": asyncpg_uuid}
@@ -79,7 +79,7 @@ def test_pydanticv1():
     def return_fast_uuid():
         asyncpg_uuid = MyUuid("a10ff360-3b1e-4984-a26f-d3ab460bdb51")
         assert isinstance(asyncpg_uuid, uuid.UUID)
-        assert type(asyncpg_uuid) != uuid.UUID
+        assert type(asyncpg_uuid) is not uuid.UUID
         with pytest.raises(TypeError):
             vars(asyncpg_uuid)
         return {"fast_uuid": asyncpg_uuid}