mirror of
https://github.com/taoky/shadowmire.git
synced 2025-07-08 09:12:43 +00:00
Some linting fixes
This commit is contained in:
parent
4d602a3649
commit
f1a2a023de
@ -90,7 +90,7 @@ class LocalVersionKV:
|
|||||||
|
|
||||||
def batch_set(self, d: dict[str, int]) -> None:
|
def batch_set(self, d: dict[str, int]) -> None:
|
||||||
cur = self.conn.cursor()
|
cur = self.conn.cursor()
|
||||||
kvs = [(k, v) for k, v in d.items()]
|
kvs = list(d.items())
|
||||||
cur.executemany(self.INSERT_SQL, kvs)
|
cur.executemany(self.INSERT_SQL, kvs)
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
|
||||||
@ -557,9 +557,7 @@ class SyncBase:
|
|||||||
if serial:
|
if serial:
|
||||||
self.local_db.set(package_name, serial)
|
self.local_db.set(package_name, serial)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if isinstance(e, ExitProgramException) or isinstance(
|
if isinstance(e, (ExitProgramException, KeyboardInterrupt)):
|
||||||
e, KeyboardInterrupt
|
|
||||||
):
|
|
||||||
raise
|
raise
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"%s generated an exception", package_name, exc_info=True
|
"%s generated an exception", package_name, exc_info=True
|
||||||
@ -749,7 +747,7 @@ class SyncPyPI(SyncBase):
|
|||||||
if dest.exists():
|
if dest.exists():
|
||||||
continue
|
continue
|
||||||
dest.parent.mkdir(parents=True, exist_ok=True)
|
dest.parent.mkdir(parents=True, exist_ok=True)
|
||||||
success, resp = download(self.session, url, dest)
|
success, _resp = download(self.session, url, dest)
|
||||||
if not success:
|
if not success:
|
||||||
logger.warning("skipping %s as it fails downloading", package_name)
|
logger.warning("skipping %s as it fails downloading", package_name)
|
||||||
return None
|
return None
|
||||||
@ -1083,8 +1081,8 @@ def verify(
|
|||||||
|
|
||||||
logger.info("remove packages NOT in local db")
|
logger.info("remove packages NOT in local db")
|
||||||
local_names = set(local_db.keys())
|
local_names = set(local_db.keys())
|
||||||
simple_dirs = set([i.name for i in (basedir / "simple").iterdir() if i.is_dir()])
|
simple_dirs = {i.name for i in (basedir / "simple").iterdir() if i.is_dir()}
|
||||||
json_files = set([i.name for i in (basedir / "json").iterdir() if i.is_file()])
|
json_files = {i.name for i in (basedir / "json").iterdir() if i.is_file()}
|
||||||
not_in_local = (simple_dirs | json_files) - local_names
|
not_in_local = (simple_dirs | json_files) - local_names
|
||||||
logger.info("%s packages NOT in local db", len(not_in_local))
|
logger.info("%s packages NOT in local db", len(not_in_local))
|
||||||
for package_name in not_in_local:
|
for package_name in not_in_local:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user