Skip to content

Commit 4b253d2

Browse files
authored
Enable Ruff flake8-todos (TD) (#13748)
1 parent bd0f64a commit 4b253d2

File tree

14 files changed

+20
-14
lines changed

14 files changed

+20
-14
lines changed

Diff for: pyproject.toml

+6
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ select = [
6363
"RUF", # Ruff-specific and unused-noqa
6464
"SLOT", # flake8-slots
6565
"T10", # flake8-debugger
66+
"TD", # flake8-todos
6667
"TRY", # tryceratops
6768
"UP", # pyupgrade
6869
"YTT", # flake8-2020
@@ -167,6 +168,11 @@ ignore = [
167168
"PLR2004", # Magic value used in comparison, consider replacing `{value}` with a constant variable
168169
# Keep codeflow path separation explicit
169170
"PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation
171+
# Allow FIXME
172+
"TD001", # Invalid TODO tag: `{tag}`
173+
# Git blame is sufficient
174+
"TD002", # Missing author in TODO;
175+
"TD003", # Missing issue link for this TODO
170176
# Mostly from scripts and tests, it's ok to have messages passed directly to exceptions
171177
"TRY003", # Avoid specifying long messages outside the exception class
172178
# Slower and more verbose https://github.com/astral-sh/ruff/issues/7871

Diff for: stdlib/_ctypes.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
292292
@raw.setter
293293
def raw(self, value: ReadableBuffer) -> None: ...
294294
value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise
295-
# TODO These methods cannot be annotated correctly at the moment.
295+
# TODO: These methods cannot be annotated correctly at the moment.
296296
# All of these "Any"s stand for the array's element type, but it's not possible to use _CT
297297
# here, because of a special feature of ctypes.
298298
# By default, when accessing an element of an Array[_CT], the returned object has type _CT.

Diff for: stdlib/colorsys.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def hls_to_rgb(h: float, l: float, s: float) -> tuple[float, float, float]: ...
77
def rgb_to_hsv(r: float, g: float, b: float) -> tuple[float, float, float]: ...
88
def hsv_to_rgb(h: float, s: float, v: float) -> tuple[float, float, float]: ...
99

10-
# TODO undocumented
10+
# TODO: undocumented
1111
ONE_SIXTH: float
1212
ONE_THIRD: float
1313
TWO_THIRD: float

Diff for: stdlib/ctypes/__init__.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to
158158

159159
if sys.platform == "win32":
160160
def DllCanUnloadNow() -> int: ...
161-
def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO not documented
161+
def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO: not documented
162162

163163
# Actually just an instance of _NamedFuncPointer (aka _CDLLFuncPointer),
164164
# but we want to set a more specific __call__
@@ -247,7 +247,7 @@ class c_bool(_SimpleCData[bool]):
247247
def __init__(self, value: bool = ...) -> None: ...
248248

249249
if sys.platform == "win32":
250-
class HRESULT(_SimpleCData[int]): ... # TODO undocumented
250+
class HRESULT(_SimpleCData[int]): ... # TODO: undocumented
251251

252252
if sys.version_info >= (3, 12):
253253
# At runtime, this is an alias for either c_int32 or c_int64,

Diff for: stdlib/distutils/fancy_getopt.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ longopt_xlate: Final[dict[int, int]]
1313

1414
class FancyGetopt:
1515
def __init__(self, option_table: list[_Option] | None = None) -> None: ...
16-
# TODO kinda wrong, `getopt(object=object())` is invalid
16+
# TODO: kinda wrong, `getopt(object=object())` is invalid
1717
@overload
1818
def getopt(
1919
self, args: _SliceableT[_StrSequenceT_co] | None = None, object: None = None

Diff for: stdlib/logging/handlers.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class SysLogHandler(Handler):
191191
class NTEventLogHandler(Handler):
192192
def __init__(self, appname: str, dllname: str | None = None, logtype: str = "Application") -> None: ...
193193
def getEventCategory(self, record: LogRecord) -> int: ...
194-
# TODO correct return value?
194+
# TODO: correct return value?
195195
def getEventType(self, record: LogRecord) -> int: ...
196196
def getMessageID(self, record: LogRecord) -> int: ...
197197

Diff for: stdlib/optparse.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class Values:
239239
# __getattr__ doesn't exist, but anything passed as a default to __init__
240240
# is set on the instance.
241241
def __getattr__(self, name: str) -> Any: ...
242-
# TODO mypy infers -> object for __getattr__ if __setattr__ has `value: object`
242+
# TODO: mypy infers -> object for __getattr__ if __setattr__ has `value: object`
243243
def __setattr__(self, name: str, value: Any, /) -> None: ...
244244
def __eq__(self, other: object) -> bool: ...
245245

Diff for: stdlib/subprocess.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -2556,7 +2556,7 @@ class Popen(Generic[AnyStr]):
25562556
def poll(self) -> int | None: ...
25572557
def wait(self, timeout: float | None = None) -> int: ...
25582558
# morally the members of the returned tuple should be optional
2559-
# TODO this should allow ReadableBuffer for Popen[bytes], but adding
2559+
# TODO: this should allow ReadableBuffer for Popen[bytes], but adding
25602560
# overloads for that runs into a mypy bug (python/mypy#14070).
25612561
def communicate(self, input: AnyStr | None = None, timeout: float | None = None) -> tuple[AnyStr, AnyStr]: ...
25622562
def send_signal(self, sig: int) -> None: ...

Diff for: stdlib/urllib/request.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class HTTPCookieProcessor(BaseHandler):
175175
class ProxyHandler(BaseHandler):
176176
def __init__(self, proxies: dict[str, str] | None = None) -> None: ...
177177
def proxy_open(self, req: Request, proxy: str, type: str) -> _UrlopenRet | None: ... # undocumented
178-
# TODO add a method for every (common) proxy protocol
178+
# TODO: add a method for every (common) proxy protocol
179179

180180
class HTTPPasswordMgr:
181181
def add_password(self, realm: str, uri: str | Sequence[str], user: str, passwd: str) -> None: ...

Diff for: stdlib/xml/etree/ElementTree.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ _E = TypeVar("_E", default=Element)
366366
class XMLParser(Generic[_E]):
367367
parser: XMLParserType
368368
target: _Target
369-
# TODO-what is entity used for???
369+
# TODO: what is entity used for???
370370
entity: dict[str, str]
371371
version: str
372372
def __init__(self, *, target: _Target | None = None, encoding: str | None = None) -> None: ...

Diff for: stubs/geopandas/geopandas/tools/geocoding.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class _GeoCoder(Protocol):
1010
def geocode(self, query: str, /): ...
1111
def reverse(self, coords, /, exactly_one: bool = ...): ...
1212

13-
# TODO Use something like `provider: Callable[P, _GeoCoder], **kwargs: P.kwargs` in the functions
13+
# TODO: Use something like `provider: Callable[P, _GeoCoder], **kwargs: P.kwargs` in the functions
1414
# below if this ever becomes a thing
1515
def geocode(strings: Iterable[str], provider: str | Callable[..., _GeoCoder] | None = None, **kwargs) -> GeoDataFrame: ...
1616
def reverse_geocode(

Diff for: stubs/shapely/shapely/_typing.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ OptGeoT = TypeVar("OptGeoT", bound=Geometry | None) # noqa: Y001
2424
class SupportsArray(Protocol[_DType_co]):
2525
def __array__(self) -> np.ndarray[Any, _DType_co]: ...
2626

27-
# TODO revisit when mypy is happy with generic recursive type alias
27+
# TODO: revisit when mypy is happy with generic recursive type alias
2828
# NestedSequence: TypeAlias = Sequence[_T] | Sequence[NestedSequence[_T]]
2929
NestedSequence: TypeAlias = Sequence[_T] | Sequence[Sequence[_T]] | Sequence[Sequence[Sequence[_T]]]
3030
DualArrayLike: TypeAlias = SupportsArray[_DType] | NestedSequence[SupportsArray[_DType]] | NestedSequence[_T]

Diff for: stubs/tensorflow/tensorflow/__init__.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class VariableAggregation(Enum):
147147
class _VariableMetaclass(type): ...
148148

149149
# Variable class in intent/documentation is a Tensor. In implementation there's
150-
# TODO comment to make it Tensor. It is not actually Tensor type wise, but even
150+
# TODO: comment to make it Tensor. It is not actually Tensor type wise, but even
151151
# dynamically patches on most methods of tf.Tensor
152152
# https://github.com/tensorflow/tensorflow/blob/9524a636cae9ae3f0554203c1ba7ee29c85fcf12/tensorflow/python/ops/variables.py#L1086.
153153
class Variable(Tensor, metaclass=_VariableMetaclass):

Diff for: stubs/tqdm/tqdm/contrib/logging.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def logging_redirect_tqdm(
1212
loggers: Sequence[logging.Logger] | None = None, tqdm_class: type[std_tqdm[Any]] = ...
1313
) -> _GeneratorContextManager[None]: ...
1414

15-
# TODO type *args, **kwargs here more precisely
15+
# TODO: type *args, **kwargs here more precisely
1616
@overload
1717
def tqdm_logging_redirect(*args, tqdm_class: Callable[..., _TqdmT], **kwargs) -> _GeneratorContextManager[_TqdmT]: ...
1818
@overload

0 commit comments

Comments
 (0)