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

irr_rpsl_submit: error message should be an f string #967

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 10 additions & 5 deletions irrd/scripts/irr_rpsl_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,8 @@ def format_as_text(response):
Format an IRRd HTTP response into a human-friendly text.
"""
summary = response["summary"]
user_report = textwrap.dedent(f"""
user_report = textwrap.dedent(
f"""
SUMMARY OF UPDATE:

Number of objects found: {summary["objects_found"]:3}
Expand All @@ -655,7 +656,8 @@ def format_as_text(response):
DETAILED EXPLANATION:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
""")
"""
)
for object_result in response["objects"]:
user_report += "---\n"
user_report += format_report_object(object_result)
Expand Down Expand Up @@ -722,7 +724,8 @@ def process_args(options):
# output something.
if "--help" in options:
raise XHelp("") from error
raise XArgumentError("Error processing command-line arguments: {error.message}") from error
message = error.message if hasattr(error, "message") else ""
raise XArgumentError(f"Error processing command-line arguments: {message}") from error

if args.debug:
logger.setLevel(logging.DEBUG)
Expand Down Expand Up @@ -770,7 +773,8 @@ def metadata(metadata_values):
except IndexError as error:
raise ValueError() from error

description = textwrap.dedent("""\
description = textwrap.dedent(
"""\
Read RPSL submissions from stdin and return a response on stdout.
Errors or debug info are printed to stderr. This program accepts
the arguments for irrdv3's version of irr_rpsl_submit but ignores
Expand All @@ -797,7 +801,8 @@ def metadata(metadata_values):
16 - unexpected response
32 - an unidentified error

""")
"""
)

parser = argparse.ArgumentParser(
add_help=False,
Expand Down