]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
⬆️ Upgrade Ruff (#5698)
authorSebastián Ramírez <tiangolo@gmail.com>
Sun, 27 Nov 2022 13:59:32 +0000 (14:59 +0100)
committerGitHub <noreply@github.com>
Sun, 27 Nov 2022 13:59:32 +0000 (14:59 +0100)
.pre-commit-config.yaml
fastapi/dependencies/utils.py
fastapi/encoders.py
fastapi/utils.py
pyproject.toml

index e59e05abe4e3e3536c51d1848cd8cec328d2db93..4e34cc7ede902937a455eefb02b55d24589b24b9 100644 (file)
@@ -19,7 +19,7 @@ repos:
         - --py3-plus
         - --keep-runtime-typing
 -   repo: https://github.com/charliermarsh/ruff-pre-commit
-    rev: v0.0.114
+    rev: v0.0.138
     hooks:
     -   id: ruff
         args:
index 3df5ccfc8b58eb72bdbd69784c16d874779ad675..4c817d5d0ba8938af1ea5967fe97c493287daf02 100644 (file)
@@ -105,10 +105,10 @@ def check_file_field(field: ModelField) -> None:
                 assert parse_options_header
             except ImportError:
                 logger.error(multipart_incorrect_install_error)
-                raise RuntimeError(multipart_incorrect_install_error)
+                raise RuntimeError(multipart_incorrect_install_error) from None
         except ImportError:
             logger.error(multipart_not_installed_error)
-            raise RuntimeError(multipart_not_installed_error)
+            raise RuntimeError(multipart_not_installed_error) from None
 
 
 def get_param_sub_dependant(
index 6bde9f4abf5830dd0ab733d395947d0025bafe9f..2f95bcbf6692d7e5cd18a41338025e6e68b20ace 100644 (file)
@@ -157,7 +157,7 @@ def jsonable_encoder(
             data = vars(obj)
         except Exception as e:
             errors.append(e)
-            raise ValueError(errors)
+            raise ValueError(errors) from e
     return jsonable_encoder(
         data,
         include=include,
index b94dacecc55d897d7f5670cd305576f82028409b..b15f6a2cfb09b047dcc86236d66197b3043d0ae0 100644 (file)
@@ -89,7 +89,7 @@ def create_response_field(
     except RuntimeError:
         raise fastapi.exceptions.FastAPIError(
             f"Invalid args for response field! Hint: check that {type_} is a valid pydantic field type"
-        )
+        ) from None
 
 
 def create_cloned_field(
index 9549cc47da1566eb76086905be1711dd70ccef8e..4ae3809864b2a5eeba2d756d3143d744ae8a8927 100644 (file)
@@ -53,7 +53,7 @@ test = [
     "pytest >=7.1.3,<8.0.0",
     "coverage[toml] >= 6.5.0,<7.0",
     "mypy ==0.982",
-    "ruff ==0.0.114",
+    "ruff ==0.0.138",
     "black == 22.10.0",
     "isort >=5.0.6,<6.0.0",
     "httpx >=0.23.0,<0.24.0",
@@ -87,7 +87,7 @@ doc = [
     "pyyaml >=5.3.1,<7.0.0",
 ]
 dev = [
-    "ruff ==0.0.114",
+    "ruff ==0.0.138",
     "uvicorn[standard] >=0.12.0,<0.19.0",
     "pre-commit >=2.17.0,<3.0.0",
 ]
@@ -168,6 +168,7 @@ select = [
 ignore = [
     "E501",  # line too long, handled by black
     "B008",  # do not perform function calls in argument defaults
+    "C901",  # too complex
 ]
 
 [tool.ruff.per-file-ignores]
@@ -178,7 +179,8 @@ ignore = [
 "docs_src/dependencies/tutorial010.py" = ["F821"]
 "docs_src/custom_response/tutorial007.py" = ["B007"]
 "docs_src/dataclasses/tutorial003.py" = ["I001"]
-
+"docs_src/path_operation_advanced_configuration/tutorial007.py" = ["B904"]
+"docs_src/custom_request_and_route/tutorial002.py" = ["B904"]
 
 [tool.ruff.isort]
 known-third-party = ["fastapi", "pydantic", "starlette"]