1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

replace flake8 with ruff for linting, refactor issues

This commit is contained in:
thatmattlove
2022-12-24 17:53:05 -05:00
parent 086279ab85
commit 9c9a8469a4
40 changed files with 494 additions and 423 deletions

View File

@@ -24,14 +24,14 @@ async def move_files(src: Path, dst: Path, files: t.Iterable[Path]) -> t.Tuple[s
if not isinstance(src, Path):
try:
src = Path(src)
except TypeError:
raise error("{p} is not a valid path", p=src)
except TypeError as err:
raise error("{p} is not a valid path", p=src) from err
if not isinstance(dst, Path):
try:
dst = Path(dst)
except TypeError:
raise error("{p} is not a valid path", p=dst)
except TypeError as err:
raise error("{p} is not a valid path", p=dst) from err
if not isinstance(files, (t.List, t.Tuple, t.Generator)):
raise error(
@@ -57,7 +57,7 @@ async def move_files(src: Path, dst: Path, files: t.Iterable[Path]) -> t.Tuple[s
shutil.copyfile(file, dst_file)
migrated += (str(dst_file),)
except Exception as e:
raise error("Failed to migrate {f}: {e}", f=dst_file, e=e)
raise error("Failed to migrate {f}: {e}", f=dst_file, e=e) from e
return migrated