diff --git a/pyproject.toml b/pyproject.toml index 36af3e424963..72d0a4df4c9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ select = [ "RUF", # Ruff-specific and unused-noqa "SLOT", # flake8-slots "T10", # flake8-debugger + "TD", # flake8-todos "TRY", # tryceratops "UP", # pyupgrade "YTT", # flake8-2020 @@ -167,6 +168,11 @@ ignore = [ "PLR2004", # Magic value used in comparison, consider replacing `{value}` with a constant variable # Keep codeflow path separation explicit "PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation + # Allow FIXME + "TD001", # Invalid TODO tag: `{tag}` + # Git blame is sufficient + "TD002", # Missing author in TODO; + "TD003", # Missing issue link for this TODO # Mostly from scripts and tests, it's ok to have messages passed directly to exceptions "TRY003", # Avoid specifying long messages outside the exception class # Slower and more verbose https://github.com/astral-sh/ruff/issues/7871 diff --git a/stdlib/_ctypes.pyi b/stdlib/_ctypes.pyi index 0ce1cb39eff6..690f900eb75a 100644 --- a/stdlib/_ctypes.pyi +++ b/stdlib/_ctypes.pyi @@ -292,7 +292,7 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType): @raw.setter def raw(self, value: ReadableBuffer) -> None: ... value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise - # TODO These methods cannot be annotated correctly at the moment. + # TODO: These methods cannot be annotated correctly at the moment. # All of these "Any"s stand for the array's element type, but it's not possible to use _CT # here, because of a special feature of ctypes. # By default, when accessing an element of an Array[_CT], the returned object has type _CT. diff --git a/stdlib/colorsys.pyi b/stdlib/colorsys.pyi index 443ee828ebfe..7842f80284ef 100644 --- a/stdlib/colorsys.pyi +++ b/stdlib/colorsys.pyi @@ -7,7 +7,7 @@ def hls_to_rgb(h: float, l: float, s: float) -> tuple[float, float, float]: ... def rgb_to_hsv(r: float, g: float, b: float) -> tuple[float, float, float]: ... def hsv_to_rgb(h: float, s: float, v: float) -> tuple[float, float, float]: ... -# TODO undocumented +# TODO: undocumented ONE_SIXTH: float ONE_THIRD: float TWO_THIRD: float diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index 4f44975d657f..459c01a60fd1 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -158,7 +158,7 @@ def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to if sys.platform == "win32": def DllCanUnloadNow() -> int: ... - def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO not documented + def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO: not documented # Actually just an instance of _NamedFuncPointer (aka _CDLLFuncPointer), # but we want to set a more specific __call__ @@ -247,7 +247,7 @@ class c_bool(_SimpleCData[bool]): def __init__(self, value: bool = ...) -> None: ... if sys.platform == "win32": - class HRESULT(_SimpleCData[int]): ... # TODO undocumented + class HRESULT(_SimpleCData[int]): ... # TODO: undocumented if sys.version_info >= (3, 12): # At runtime, this is an alias for either c_int32 or c_int64, diff --git a/stdlib/distutils/fancy_getopt.pyi b/stdlib/distutils/fancy_getopt.pyi index e66d8cc9f2c5..f3fa2a1255a6 100644 --- a/stdlib/distutils/fancy_getopt.pyi +++ b/stdlib/distutils/fancy_getopt.pyi @@ -13,7 +13,7 @@ longopt_xlate: Final[dict[int, int]] class FancyGetopt: def __init__(self, option_table: list[_Option] | None = None) -> None: ... - # TODO kinda wrong, `getopt(object=object())` is invalid + # TODO: kinda wrong, `getopt(object=object())` is invalid @overload def getopt( self, args: _SliceableT[_StrSequenceT_co] | None = None, object: None = None diff --git a/stdlib/logging/handlers.pyi b/stdlib/logging/handlers.pyi index d594d6569a7e..7f913bd97fd7 100644 --- a/stdlib/logging/handlers.pyi +++ b/stdlib/logging/handlers.pyi @@ -191,7 +191,7 @@ class SysLogHandler(Handler): class NTEventLogHandler(Handler): def __init__(self, appname: str, dllname: str | None = None, logtype: str = "Application") -> None: ... def getEventCategory(self, record: LogRecord) -> int: ... - # TODO correct return value? + # TODO: correct return value? def getEventType(self, record: LogRecord) -> int: ... def getMessageID(self, record: LogRecord) -> int: ... diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index 56a4574bdba8..8b7fcd82e5a5 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -239,7 +239,7 @@ class Values: # __getattr__ doesn't exist, but anything passed as a default to __init__ # is set on the instance. def __getattr__(self, name: str) -> Any: ... - # TODO mypy infers -> object for __getattr__ if __setattr__ has `value: object` + # TODO: mypy infers -> object for __getattr__ if __setattr__ has `value: object` def __setattr__(self, name: str, value: Any, /) -> None: ... def __eq__(self, other: object) -> bool: ... diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index fef35b56945a..21ac3a6a2798 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -2556,7 +2556,7 @@ class Popen(Generic[AnyStr]): def poll(self) -> int | None: ... def wait(self, timeout: float | None = None) -> int: ... # morally the members of the returned tuple should be optional - # TODO this should allow ReadableBuffer for Popen[bytes], but adding + # TODO: this should allow ReadableBuffer for Popen[bytes], but adding # overloads for that runs into a mypy bug (python/mypy#14070). def communicate(self, input: AnyStr | None = None, timeout: float | None = None) -> tuple[AnyStr, AnyStr]: ... def send_signal(self, sig: int) -> None: ... diff --git a/stdlib/urllib/request.pyi b/stdlib/urllib/request.pyi index ad4f91fc31ae..1f453fd1e1d6 100644 --- a/stdlib/urllib/request.pyi +++ b/stdlib/urllib/request.pyi @@ -175,7 +175,7 @@ class HTTPCookieProcessor(BaseHandler): class ProxyHandler(BaseHandler): def __init__(self, proxies: dict[str, str] | None = None) -> None: ... def proxy_open(self, req: Request, proxy: str, type: str) -> _UrlopenRet | None: ... # undocumented - # TODO add a method for every (common) proxy protocol + # TODO: add a method for every (common) proxy protocol class HTTPPasswordMgr: def add_password(self, realm: str, uri: str | Sequence[str], user: str, passwd: str) -> None: ... diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index 4a9113868d7e..198e1c3d6435 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -366,7 +366,7 @@ _E = TypeVar("_E", default=Element) class XMLParser(Generic[_E]): parser: XMLParserType target: _Target - # TODO-what is entity used for??? + # TODO: what is entity used for??? entity: dict[str, str] version: str def __init__(self, *, target: _Target | None = None, encoding: str | None = None) -> None: ... diff --git a/stubs/geopandas/geopandas/tools/geocoding.pyi b/stubs/geopandas/geopandas/tools/geocoding.pyi index cb6474150141..3748d7945de1 100644 --- a/stubs/geopandas/geopandas/tools/geocoding.pyi +++ b/stubs/geopandas/geopandas/tools/geocoding.pyi @@ -10,7 +10,7 @@ class _GeoCoder(Protocol): def geocode(self, query: str, /): ... def reverse(self, coords, /, exactly_one: bool = ...): ... -# TODO Use something like `provider: Callable[P, _GeoCoder], **kwargs: P.kwargs` in the functions +# TODO: Use something like `provider: Callable[P, _GeoCoder], **kwargs: P.kwargs` in the functions # below if this ever becomes a thing def geocode(strings: Iterable[str], provider: str | Callable[..., _GeoCoder] | None = None, **kwargs) -> GeoDataFrame: ... def reverse_geocode( diff --git a/stubs/shapely/shapely/_typing.pyi b/stubs/shapely/shapely/_typing.pyi index 226fa7a1d1d0..224af9553f03 100644 --- a/stubs/shapely/shapely/_typing.pyi +++ b/stubs/shapely/shapely/_typing.pyi @@ -24,7 +24,7 @@ OptGeoT = TypeVar("OptGeoT", bound=Geometry | None) # noqa: Y001 class SupportsArray(Protocol[_DType_co]): def __array__(self) -> np.ndarray[Any, _DType_co]: ... -# TODO revisit when mypy is happy with generic recursive type alias +# TODO: revisit when mypy is happy with generic recursive type alias # NestedSequence: TypeAlias = Sequence[_T] | Sequence[NestedSequence[_T]] NestedSequence: TypeAlias = Sequence[_T] | Sequence[Sequence[_T]] | Sequence[Sequence[Sequence[_T]]] DualArrayLike: TypeAlias = SupportsArray[_DType] | NestedSequence[SupportsArray[_DType]] | NestedSequence[_T] diff --git a/stubs/tensorflow/tensorflow/__init__.pyi b/stubs/tensorflow/tensorflow/__init__.pyi index 6ef9e1cb54f3..873a2b860f0e 100644 --- a/stubs/tensorflow/tensorflow/__init__.pyi +++ b/stubs/tensorflow/tensorflow/__init__.pyi @@ -147,7 +147,7 @@ class VariableAggregation(Enum): class _VariableMetaclass(type): ... # Variable class in intent/documentation is a Tensor. In implementation there's -# TODO comment to make it Tensor. It is not actually Tensor type wise, but even +# TODO: comment to make it Tensor. It is not actually Tensor type wise, but even # dynamically patches on most methods of tf.Tensor # https://github.com/tensorflow/tensorflow/blob/9524a636cae9ae3f0554203c1ba7ee29c85fcf12/tensorflow/python/ops/variables.py#L1086. class Variable(Tensor, metaclass=_VariableMetaclass): diff --git a/stubs/tqdm/tqdm/contrib/logging.pyi b/stubs/tqdm/tqdm/contrib/logging.pyi index 3b5bfde1c402..73e0006846a6 100644 --- a/stubs/tqdm/tqdm/contrib/logging.pyi +++ b/stubs/tqdm/tqdm/contrib/logging.pyi @@ -12,7 +12,7 @@ def logging_redirect_tqdm( loggers: Sequence[logging.Logger] | None = None, tqdm_class: type[std_tqdm[Any]] = ... ) -> _GeneratorContextManager[None]: ... -# TODO type *args, **kwargs here more precisely +# TODO: type *args, **kwargs here more precisely @overload def tqdm_logging_redirect(*args, tqdm_class: Callable[..., _TqdmT], **kwargs) -> _GeneratorContextManager[_TqdmT]: ... @overload