Skip to content

Commit 0c81200

Browse files
committed
style: fix mypy
1 parent ed647d3 commit 0c81200

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

examples/fastapi/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@ async def get_users():
2020
return await User_Pydantic.from_queryset(Users.all())
2121

2222

23-
@app.post("/users", response_model=User_Pydantic) # type: ignore
23+
@app.post("/users", response_model=User_Pydantic)
2424
async def create_user(user: UserIn_Pydantic):
2525
user_obj = await Users.create(**user.dict(exclude_unset=True))
2626
return await User_Pydantic.from_tortoise_orm(user_obj)
2727

2828

29-
@app.get("/user/{user_id}", response_model=User_Pydantic) # type: ignore
29+
@app.get("/user/{user_id}", response_model=User_Pydantic)
3030
async def get_user(user_id: int):
3131
return await User_Pydantic.from_queryset_single(Users.get(id=user_id))
3232

3333

34-
@app.put("/user/{user_id}", response_model=User_Pydantic) # type: ignore
34+
@app.put("/user/{user_id}", response_model=User_Pydantic)
3535
async def update_user(user_id: int, user: UserIn_Pydantic):
3636
await Users.filter(id=user_id).update(**user.dict(exclude_unset=True))
3737
return await User_Pydantic.from_queryset_single(Users.get(id=user_id))
3838

3939

40-
@app.delete("/user/{user_id}", response_model=Status) # type: ignore
40+
@app.delete("/user/{user_id}", response_model=Status)
4141
async def delete_user(user_id: int):
4242
deleted_count = await Users.filter(id=user_id).delete()
4343
if not deleted_count:

tortoise/contrib/fastapi/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,26 @@ def register_tortoise(
8989
For any configuration error
9090
"""
9191

92-
@app.on_event("startup") # type: ignore
92+
@app.on_event("startup")
9393
async def init_orm() -> None: # pylint: disable=W0612
9494
await Tortoise.init(config=config, config_file=config_file, db_url=db_url, modules=modules)
9595
logger.info("Tortoise-ORM started, %s, %s", connections._get_storage(), Tortoise.apps)
9696
if generate_schemas:
9797
logger.info("Tortoise-ORM generating schema")
9898
await Tortoise.generate_schemas()
9999

100-
@app.on_event("shutdown") # type: ignore
100+
@app.on_event("shutdown")
101101
async def close_orm() -> None: # pylint: disable=W0612
102102
await connections.close_all()
103103
logger.info("Tortoise-ORM shutdown")
104104

105105
if add_exception_handlers:
106106

107-
@app.exception_handler(DoesNotExist) # type: ignore
107+
@app.exception_handler(DoesNotExist)
108108
async def doesnotexist_exception_handler(request: Request, exc: DoesNotExist):
109109
return JSONResponse(status_code=404, content={"detail": str(exc)})
110110

111-
@app.exception_handler(IntegrityError) # type: ignore
111+
@app.exception_handler(IntegrityError)
112112
async def integrityerror_exception_handler(request: Request, exc: IntegrityError):
113113
return JSONResponse(
114114
status_code=422,

0 commit comments

Comments
 (0)