Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions esgprep/_contexts/multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def __init__(self, args):
self.checksums_from = self.set("checksums_from")

# Checksums file takes priority on checksumming behavior setting.
if self.checksums_from:
self.no_checksum = True
if self.checksums_from and self.no_checksum:
self.no_checksum = False
Print.warning('"--checksums-from" ignores "--no-checksum".')

# Set multiprocessing configuration. Processes number is caped by cpu_count().
Expand Down
18 changes: 8 additions & 10 deletions esgprep/_utils/checksum.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,12 @@ def get_checksum(ffp, checksum_type="sha256", checksums=None):
2. Through a list of checksums in a dictionary way {file: checksum}.

"""
# Verify checksum dictionary.
if checksums:
# Verify file in dictionary keys.
if ffp in checksums:
# Verify checksum pattern.
if re.match(get_checksum_pattern(checksum_type), checksums[ffp]):
# Return pre-computed checksum.
return checksums[ffp]

# Return computed checksum.
# If pre-computed checksum with correct pattern exists in dictionary,
# then return it.
if (checksums
and ffp in checksums
and re.match(get_checksum_pattern(checksum_type), checksums[ffp])):
return checksums[ffp]

# Otherwise return computed checksum.
return checksum(ffp, checksum_type)
4 changes: 2 additions & 2 deletions esgprep/esgmapfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def get_args():
make.add_argument(
"--checksums-from",
metavar="CHECKSUM_FILE",
type=ChecksumsReader,
action=ChecksumsReader,
help=CHECKSUMS_FROM_HELP,
)
make.add_argument(
Expand Down Expand Up @@ -234,7 +234,7 @@ def get_args():
group.add_argument(
"--dataset-list",
metavar="TXT_FILE",
type=DatasetsReader,
action=DatasetsReader,
nargs="?",
const=sys.stdin,
help=DATASET_LIST_HELP,
Expand Down
Loading