Conversation
|
Can we enforce those via ruff? |
Kludex
left a comment
There was a problem hiding this comment.
If you can find ruff rules to enforce this behavior, I'm happy to accept it.
|
Run A mini demo to verify: # bb.py
import typing
from typing import Callable, ContextManager, Sequence
def foo(a: Callable, b: ContextManager, c: Sequence) -> tuple[typing.Sequence, typing.ContextManager]:
passRun Then run import typing
from collections.abc import Sequence
from typing import Callable, ContextManager
def foo(a: Callable, b: ContextManager, c: Sequence) -> tuple[typing.Sequence, typing.ContextManager]:
pass |
Yes, |
But you replaced everything in this PR manually... Right? The diff duplicated since last time I checked. |
dcb657e to
7aefc73
Compare
|
@Kludex I use the following script to replace everything: Command line is: |
|
I guess it's time to do this. It will make the code shorter, and more readable - also updating the packages to use btw, same PR welcome on uvicorn if you are up to it. π |
Kludex/uvicorn#2638 |
Summary
Only improve type hints, does not change any logic
ruff check --fix starlette testsfrom typing import ContextManager-->from contextlib import AbstractContextManagerChecklist