Skip to content
Snippets Groups Projects
Commit d2e283c1 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Inline the functionality of maybe_set_limit.

parent d6585834
No related branches found
No related tags found
No related merge requests found
......@@ -594,19 +594,21 @@ class ListDebianSubstvarsAction(argparse._StoreTrueAction):
sys.exit(0)
def maybe_set_limit(parsed_args, key):
def configure(parsed_args):
for x in (
"max_report_size",
"max_text_report_size",
"max_diff_block_lines",
"max_diff_block_lines_saved",
"max_diff_input_lines",
):
# apply limits affected by "no-default-limits"
v = getattr(parsed_args, key)
v = getattr(parsed_args, x)
if v is not None:
setattr(Config(), key, float("inf") if v == 0 else v)
setattr(Config(), x, float("inf") if v == 0 else v)
elif parsed_args.no_default_limits:
setattr(Config(), key, float("inf"))
setattr(Config(), x, float("inf"))
def configure(parsed_args):
maybe_set_limit(parsed_args, "max_report_size")
maybe_set_limit(parsed_args, "max_text_report_size")
maybe_set_limit(parsed_args, "max_diff_block_lines")
Config().max_page_size = parsed_args.max_page_size
# TODO: old flag kept for backwards-compat, drop 6 months after v84
if parsed_args.max_report_size_child is not None:
......@@ -628,8 +630,6 @@ def configure(parsed_args):
)
Config().max_page_diff_block_lines = parsed_args.max_page_diff_block_lines
maybe_set_limit(parsed_args, "max_diff_block_lines_saved")
maybe_set_limit(parsed_args, "max_diff_input_lines")
Config().max_container_depth = parsed_args.max_container_depth
Config().use_dbgsym = parsed_args.use_dbgsym
Config().force_details = parsed_args.force_details
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment