Enable the yield-in-for-loop ruff rule and fix warnings (#2984)
This commit is contained in:
parent
af043afa88
commit
8fa5ec15af
|
|
@ -80,8 +80,7 @@ class Boot:
|
||||||
|
|
||||||
def __iter__(self) -> Iterator[bytes]:
|
def __iter__(self) -> Iterator[bytes]:
|
||||||
if self.session:
|
if self.session:
|
||||||
for value in self.session:
|
yield from self.session
|
||||||
yield value
|
|
||||||
|
|
||||||
def __contains__(self, key: bytes) -> bool:
|
def __contains__(self, key: bytes) -> bool:
|
||||||
if self.session is None:
|
if self.session is None:
|
||||||
|
|
|
||||||
|
|
@ -383,8 +383,7 @@ class SysCommand:
|
||||||
|
|
||||||
def __iter__(self, *args: list[Any], **kwargs: dict[str, Any]) -> Iterator[bytes]:
|
def __iter__(self, *args: list[Any], **kwargs: dict[str, Any]) -> Iterator[bytes]:
|
||||||
if self.session:
|
if self.session:
|
||||||
for line in self.session:
|
yield from self.session
|
||||||
yield line
|
|
||||||
|
|
||||||
def __getitem__(self, key: slice) -> bytes | None:
|
def __getitem__(self, key: slice) -> bytes | None:
|
||||||
if not self.session:
|
if not self.session:
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,6 @@ ignore = [
|
||||||
"RUF012", # mutable-class-default
|
"RUF012", # mutable-class-default
|
||||||
"RUF015", # unnecessary-iterable-allocation-for-first-element
|
"RUF015", # unnecessary-iterable-allocation-for-first-element
|
||||||
"RUF039", # unraw-re-pattern
|
"RUF039", # unraw-re-pattern
|
||||||
"UP028", # yield-in-for-loop
|
|
||||||
"UP037", # quoted-annotation
|
"UP037", # quoted-annotation
|
||||||
"W191", # tab-indentation
|
"W191", # tab-indentation
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue