astral-sh/ruff
GitHub で見るUP013, UP014: Comments inside the definition are dropped
Open
#9,715 opened on 2024年1月30日
bugfixeshelp wanted
Repository metrics
- Stars
- (47,527 stars)
- PR merge metrics
- (平均マージ 3d 8h) (30d で 573 merged PRs)
説明
Starting with this code:
from typing import NamedTuple, TypedDict
X = TypedDict("X", {
"some_config": int, # important
})
Y = NamedTuple("Y", [
("some_config", int), # important
])
Ruff (via rules UP013 and UP014) turns it into:
from typing import NamedTuple, TypedDict
class X(TypedDict):
some_config: int
class Y(NamedTuple):
some_config: int
Ideally it should retain the end-of-line comments.