diff --git a/rst_include/libs/lib_block_options.py b/rst_include/libs/lib_block_options.py index dff4366..9523f70 100644 --- a/rst_include/libs/lib_block_options.py +++ b/rst_include/libs/lib_block_options.py @@ -19,29 +19,29 @@ def get_option_value_from_block_or_raise_if_empty_or_invalid(option: str, block: Block, value_must_be_int: bool = False) -> str: """ - >>> block = lib_test.get_test_block_ok() + >>> my_block = lib_test.get_test_block_ok() >>> # test ok - >>> get_option_value_from_block_or_raise_if_empty_or_invalid('code', block) + >>> get_option_value_from_block_or_raise_if_empty_or_invalid('code', my_block) 'python' >>> # empty value - >>> get_option_value_from_block_or_raise_if_empty_or_invalid('pass-through1', block) + >>> get_option_value_from_block_or_raise_if_empty_or_invalid('pass-through1', my_block) Traceback (most recent call last): ... ValueError: Error in File ".../README.template.rst", Line 47107: option "pass-through1" has no value >>> # option not found - >>> get_option_value_from_block_or_raise_if_empty_or_invalid('no-option', block) + >>> get_option_value_from_block_or_raise_if_empty_or_invalid('no-option', my_block) Traceback (most recent call last): ... ValueError: Error in File: ".../README.template.rst", option "no-option" not found in block starting with Line: 47100 >>> # option check type integer ok - >>> get_option_value_from_block_or_raise_if_empty_or_invalid('start-line', block, value_must_be_int=True) + >>> get_option_value_from_block_or_raise_if_empty_or_invalid('start-line', my_block, value_must_be_int=True) '10' >>> # option check type not integer - >>> get_option_value_from_block_or_raise_if_empty_or_invalid('start-after', block, value_must_be_int=True) + >>> get_option_value_from_block_or_raise_if_empty_or_invalid('start-after', my_block, value_must_be_int=True) Traceback (most recent call last): ... TypeError: Error in File ".../README.template.rst", Line 47105: option "start-after" has to be integer @@ -56,8 +56,8 @@ def get_option_value_from_block_or_raise_if_empty_or_invalid(option: str, block: def get_option_value_from_block(option: str, block: Block) -> str: """ - >>> block = lib_test.get_test_block_ok() - >>> get_option_value_from_block('code', block) + >>> my_block = lib_test.get_test_block_ok() + >>> get_option_value_from_block('code', my_block) 'python' >>> get_option_value_from_block('encoding', block) 'utf-8' @@ -83,8 +83,8 @@ def get_option_value_from_source_line(source_line: SourceLine) -> str: def is_option_in_block(option: str, block: Block) -> bool: """ - >>> block = lib_test.get_test_block_ok() - >>> is_option_in_block('code', block) + >>> my_block = lib_test.get_test_block_ok() + >>> is_option_in_block('code', my_block) True >>> is_option_in_block('no-option', block) False @@ -100,8 +100,8 @@ def is_option_in_block(option: str, block: Block) -> bool: def get_source_line_number_for_option(option: str, block: Block) -> int: """ - >>> block = lib_test.get_test_block_ok() - >>> get_source_line_number_for_option('code', block) + >>> my_block = lib_test.get_test_block_ok() + >>> get_source_line_number_for_option('code', my_block) 47101 >>> get_source_line_number_for_option('encoding', block) 47102 @@ -121,8 +121,8 @@ def get_source_line_number_for_option(option: str, block: Block) -> int: def is_option_in_source_line(source_line: SourceLine, option: str) -> bool: """ - >>> source_line = lib_classes.SourceLine(line_number=4711, content=' :code:') - >>> is_option_in_source_line(source_line, 'code') + >>> my_source_line = lib_classes.SourceLine(line_number=4711, content=' :code:') + >>> is_option_in_source_line(my_source_line, 'code') True >>> is_option_in_source_line(source_line, 'encoding') False @@ -137,8 +137,8 @@ def is_option_in_source_line(source_line: SourceLine, option: str) -> bool: def get_option_key_from_source_line(source_line: SourceLine) -> str: """ - >>> source_line = lib_classes.SourceLine(line_number=4711, content=' :code:') - >>> get_option_key_from_source_line(source_line) + >>> my_source_line = lib_classes.SourceLine(line_number=4711, content=' :code:') + >>> get_option_key_from_source_line(my_source_line) 'code' """ key = source_line.content.split(':')[1] @@ -147,7 +147,8 @@ def get_option_key_from_source_line(source_line: SourceLine) -> str: def log_and_raise_value_error_if_option_not_in_block(option: str, block: Block) -> None: if not is_option_in_block(option, block): - s_error = f'Error in File: "{block.source}", option "{option}" not found in block starting with Line: {block.l_source_lines[0].line_number}' # noqa: E713 # for python 3.12beta + s_error = f'Error in File: "{block.source}", option "{option}' \ + f'" not found in block starting with Line: {block.l_source_lines[0].line_number}' # noqa: E713 # for python 3.12beta lib_log_utils.log_error(s_error) raise ValueError(s_error)