mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-07 22:10:10 +08:00
Enable Ruff flake8-todos (TD) (#13748)
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
|
||||
+1
-1
@@ -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: ...
|
||||
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user