def _annotate_failure(fail_message=''): # frames # 0: call to nth_frame_info # 1: _annotate_failure (this function) # 2: _annotate_failure caller (soft assert func or CM) # 3: failed assertion frameinfo = nth_frame_info(3) if not fail_message: fail_message = str(frameinfo.code_context[0]).strip() filename = get_rel_path(frameinfo.filename) path = '{}:{!r}'.format(filename, frameinfo.lineno) return '{} ({})'.format(fail_message, path)
def _annotate_failure(fail_message=''): # frames # 0: call to nth_frame_info # 1: _annotate_failure (this function) # 2: _annotate_failure caller (soft assert func or CM) # 3: failed assertion frameinfo = nth_frame_info(3) if not fail_message: fail_message = str(frameinfo.code_context[0]).strip() filename = get_rel_path(frameinfo.filename) path = f'{filename}:{frameinfo.lineno!r}' return f'{fail_message} ({path})'
def filter(self, record): record.pathname = get_rel_path(record.pathname) return True
# if index_to_remove is empty, package not found in file click.echo(f"Package '{package}' not found in {file_name}") return # ----- Command line function defs ------- @click.group(help="Functions for adding, updating, and freezing requirements") def main(): pass scan_template_opt = click.option( '--scan-template', 'scan_template', show_default=True, default=get_rel_path(str(DEFAULT_SCAN_TEMPLATE)), help= 'The path to the template file (pip -r arg) for scanned imports, will be overwritten', ) extra_template_opt = click.option( '--extra-template', 'extra_template', show_default=True, default=get_rel_path(str(DEFAULT_EXTRA_TEMPLATE)), help= 'The path to the template file (pip -r arg) for extra packages (e.g. pre-commit)' ', will be overwritten', ) constraint_opt = click.option(