Browse Source

fix: resolve ruff lint errors (Dict -> dict, remove outdated version block)

pull/14557/head
lif 7 months ago
parent
commit
831fd18892
  1. 2
      fastapi/dependencies/utils.py
  2. 9
      tests/test_annotated_forward_ref.py

2
fastapi/dependencies/utils.py

@ -286,7 +286,7 @@ def get_typed_annotation(annotation: Any, globalns: dict[str, Any]) -> Any:
return annotation
def _try_resolve_annotated_string(annotation_str: str, globalns: Dict[str, Any]) -> Any:
def _try_resolve_annotated_string(annotation_str: str, globalns: dict[str, Any]) -> Any:
"""
Try to partially resolve an Annotated string annotation.

9
tests/test_annotated_forward_ref.py

@ -2,15 +2,8 @@
from __future__ import annotations
import sys
from dataclasses import dataclass
# Annotated is available in typing from Python 3.9+
# For Python 3.8, we need to import from typing_extensions
if sys.version_info >= (3, 9):
from typing import Annotated
else:
from typing import Annotated
from typing import Annotated
from fastapi import Depends, FastAPI
from fastapi.testclient import TestClient

Loading…
Cancel
Save