Skip to content

Commit 8f172fb

Browse files
committed
pre-commit/pyupgrade - using --py39-plus
1 parent 2aab9ab commit 8f172fb

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ repos:
3838
rev: v3.17.0
3939
hooks:
4040
- id: pyupgrade
41-
args: [--py38-plus, --keep-runtime-typing]
42-
41+
args: [--py39-plus, --keep-runtime-typing]
4342
ci:
4443
autofix_commit_msg: |
4544
[pre-commit.ci] auto fixes from pre-commit.ci hooks

tests/api/v1/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Optional
1+
from typing import Optional
22

33
from pydantic import BaseModel, RootModel, Field
44

@@ -17,7 +17,7 @@ class Pet(PetBase):
1717

1818

1919
class Pets(RootModel):
20-
root: List[Pet] = Field(..., description="list of pet")
20+
root: list[Pet] = Field(..., description="list of pet")
2121

2222

2323
class Error(BaseModel):

tests/api/v2/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import errno
22
import uuid
33
from typing import Optional, Union
4-
from typing_extensions import Annotated
4+
from typing import Annotated
55

66
import starlette.status
77
from fastapi import Body, Response, Header, APIRouter, Path

tests/api/v2/schema.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
from datetime import timedelta
22
import uuid
33

4-
import sys
5-
6-
if sys.version_info >= (3, 9):
7-
from typing import List, Optional, Literal, Union, Annotated
8-
else:
9-
from typing import List, Optional, Union
10-
from typing_extensions import Annotated, Literal
114

5+
from typing import Optional, Literal, Union, Annotated
126

137
import pydantic
148
from pydantic import BaseModel, RootModel, Field, ConfigDict
@@ -21,7 +15,7 @@ class PetBase(BaseModel):
2115
model_config = ConfigDict(extra="forbid")
2216
identifier: Optional[str] = Field(default_factory=lambda: str(uuid.uuid4()))
2317
name: str
24-
tags: List[str] = Field(default_factory=list)
18+
tags: list[str] = Field(default_factory=list)
2519

2620

2721
class BlackCat(PetBase):
@@ -62,7 +56,7 @@ def __setattr__(self, item, value):
6256
# root: Annotated[Union[Cat, Dog], Field(discriminator="pet_type")]
6357

6458

65-
Pets = List[Pet]
59+
Pets = list[Pet]
6660

6761

6862
class Error(BaseModel):

0 commit comments

Comments
 (0)