Utilities#

Hashing, archive handling, run locking, and formatting helpers.

litsync.utils.utcnow()[source]#
Return type:

str

litsync.utils.new_src_stats()[source]#
Return type:

dict

litsync.utils.human_bytes(n)[source]#
Return type:

str

litsync.utils.partial_note(counted, files)[source]#
Parameters:
Return type:

str

litsync.utils.md5_file(path)[source]#
Parameters:

path (Path)

Return type:

str

litsync.utils.parse_md5(text)[source]#

NCBI .md5 sidecars look like ‘MD5(file.xml.gz)= <hex>’ or ‘<hex> file’.

Parameters:

text (str)

Return type:

str

litsync.utils.run_lock(path)[source]#

Prevent overlapping runs via an exclusive file lock.

Parameters:

path (Path)

litsync.utils.count_articles(path, source)[source]#

Cheaply count the articles/records inside one downloaded file.

Parameters:
Return type:

int