Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print warning if requested entry not present in the file #491

Merged
merged 2 commits into from
Sep 22, 2023
Merged
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
7 changes: 5 additions & 2 deletions tools/podio-dump
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def print_frame(frame, cat_name, ientry, detailed):
ientry (int): The entry number of this Frame
detailed (bool): Print just an overview or dump the whole contents
"""
print('{:#^82}'.format(f' {cat_name} {ientry} ')) # pylint: disable=consider-using-f-string
print('{:#^82}'.format(f' {cat_name}: {ientry} ')) # pylint: disable=consider-using-f-string

if detailed:
print_frame_detailed(frame)
Expand Down Expand Up @@ -126,7 +126,10 @@ def main(args):

frames = reader.get(args.category)
for ient in args.entries:
print_frame(frames[ient], args.category, ient, args.detailed)
try:
print_frame(frames[ient], args.category, ient, args.detailed)
except IndexError:
print(f'WARNING: Entry no. {ient} in "{args.category}" not present in the file!')


def parse_entry_range(ent_string):
Expand Down