ruff: process remaining existing checks and suppress the annoying ones

This commit is contained in:
Dima Gerasimov 2024-08-28 03:58:28 +01:00 committed by karlicoss
parent 1c5efc46aa
commit d58453410c
6 changed files with 38 additions and 8 deletions

View file

@ -178,12 +178,12 @@ def repos() -> List[Path]:
# returns modification time for an index to use as hash function
def _repo_depends_on(_repo: Path) -> int:
for pp in {
for pp in [
".git/FETCH_HEAD",
".git/HEAD",
"FETCH_HEAD", # bare
"HEAD", # bare
}:
]:
ff = _repo / pp
if ff.exists():
return int(ff.stat().st_mtime)

View file

@ -27,7 +27,7 @@ class Ext:
def is_compressed(p: Path) -> bool:
# todo kinda lame way for now.. use mime ideally?
# should cooperate with kompress.kopen?
return any(p.name.endswith(ext) for ext in {Ext.xz, Ext.zip, Ext.lz4, Ext.zstd, Ext.zst, Ext.targz})
return any(p.name.endswith(ext) for ext in [Ext.xz, Ext.zip, Ext.lz4, Ext.zstd, Ext.zst, Ext.targz])
def _zstd_open(path: Path, *args, **kwargs) -> IO:

View file

@ -14,7 +14,7 @@ from typing import (
)
from . import compat
from . import warnings as warnings
from . import warnings
# some helper functions
# TODO start deprecating this? soon we'd be able to use Path | str syntax which is shorter and more explicit

View file

@ -123,7 +123,7 @@ class always_supports_sequence(Iterator[V]):
self.it = it
self._list: Optional[List] = None
def __iter__(self) -> Iterator[V]:
def __iter__(self) -> Iterator[V]: # noqa: PYI034
return self.it.__iter__()
def __next__(self) -> V:

View file

@ -65,7 +65,7 @@ def _make_photo_aux(*args, **kwargs) -> List[Result]:
def _make_photo(photo: Path, mtype: str, *, parent_geo: Optional[LatLon]) -> Iterator[Result]:
exif: Exif
if any(x in mtype for x in {'image/png', 'image/x-ms-bmp', 'video'}):
if any(x in mtype for x in ['image/png', 'image/x-ms-bmp', 'video']):
# TODO don't remember why..
logger.debug(f"skipping exif extraction for {photo} due to mime {mtype}")
exif = {}