schrodinger.utils.compare module¶
This is a postprocessor for the ‘diff’ command. It hides differences if they just represent numerical differences below some cutoff. It also ignores lines matching particular regular expressions, specified in the file ‘skip_lines’.
- class schrodinger.utils.compare.DiffCompareArgumentParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)¶
Bases:
argparse.ArgumentParser
- exit(status=0, message=None)¶
- schrodinger.utils.compare.get_arg_parser()¶
- schrodinger.utils.compare.get_diff_chunks(diff_lines)¶
- schrodinger.utils.compare.compare_diff_chunks(args, skip_patterns, diff_lines)¶
- schrodinger.utils.compare.process_nonchange_diffs(diff_output_from_file1, diff_output_from_file2, skip_patterns)¶
- schrodinger.utils.compare.can_skip_line(line, skip_patterns)¶
- schrodinger.utils.compare.translate_nan_tokens_in_line(line)¶
- schrodinger.utils.compare.get_diff_tokens_in_line(diff_output_line)¶
- schrodinger.utils.compare.convert_diff_token_to_float(diff_token)¶
- schrodinger.utils.compare.numerical_diff_is_acceptable(file1_float_token, file2_float_token, args)¶
- schrodinger.utils.compare.compare_diff_lines(diff_key, diff_output_from_file1, diff_output_from_file2, skip_patterns, args)¶
- schrodinger.utils.compare.get_regex_patterns_of_lines_to_skip(args)¶
- schrodinger.utils.compare.get_diff_output_with_numerical_tolerance(diff_lines, *options)¶
- schrodinger.utils.compare.file_is_empty(f, *skip_options, allow_skip_lines=True)¶
A utility function to check if a file contains any lines that cannot be skipped. This function can be used in certain tests that try to assert that a file is empty when it may contain ignorable lines.
- Parameters
f – file path/name which can be opened with open(f)
skip_options – a subset of the ‘options’ argument to get_diff_output_with_numerical_tolerance that only uses the skip_file (-s, -skip) argument. If no arguments are set, there are still some lines skipped by default.
allow_skip_lines – toggle the skipped-lines checking. If allow_skip_lines=False, then this function will only check if the file is actually empty (file size == 0)
- Returns
True if the file is either 1) empty or 2) contains only ignorable lines (and allow_skip_lines==True), and False if there is non-ignorable content.
- schrodinger.utils.compare.main()¶