How to use the diffoscope.config.Config function in diffoscope

To help you get started, we’ve selected a few diffoscope examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anthraxx / diffoscope / tests / comparators / test_icc.py View on Github external
def test_compare_non_existing(monkeypatch, icc1):
    monkeypatch.setattr(Config(), 'new_file', True)
    difference = icc1.compare(MissingFile('/nonexisting', icc1))
    assert difference.source2 == '/nonexisting'
    assert len(difference.details) > 0
github anthraxx / diffoscope / tests / comparators / test_macho.py View on Github external
def test_obj_compare_non_existing(monkeypatch, obj1):
    monkeypatch.setattr(Config(), 'new_file', True)
    difference = obj1.compare(MissingFile('/nonexisting', obj1))
    assert difference.source2 == '/nonexisting'
    assert len(difference.details) > 0
github anthraxx / diffoscope / tests / comparators / test_fonts.py View on Github external
def test_compare_non_existing(monkeypatch, ttf1):
    monkeypatch.setattr(Config(), 'new_file', True)
    difference = ttf1.compare(MissingFile('/nonexisting', ttf1))
    assert difference.source2 == '/nonexisting'
    assert len(difference.details) > 0
github anthraxx / diffoscope / diffoscope / comparators / utils / container.py View on Github external
# keep it sorted like my members
            while my_members:
                my_member_name, my_member = my_members.popitem(last=False)
                if my_member_name in other_members:
                    yield my_member, other_members.pop(my_member_name), NO_COMMENT
                    p.step(msg=my_member.progress_name)
                else:
                    my_reminders[my_member_name] = my_member

            my_members = my_reminders
            for my_name, other_name, score in perform_fuzzy_matching(my_members, other_members):
                comment = 'Files similar despite different names (difference score: %d)' % score
                yield my_members.pop(my_name), other_members.pop(other_name), comment
                p.step(2, msg=my_name)

            if Config().new_file:
                for my_member in my_members.values():
                    yield my_member, MissingFile('/dev/null', my_member), NO_COMMENT
                    p.step(msg=my_member)

                for other_member in other_members.values():
                    yield MissingFile('/dev/null', other_member), other_member, NO_COMMENT
                    p.step(msg=other_member)
github anthraxx / diffoscope / diffoscope / comparators / missing_file.py View on Github external
def recognizes(file):
        if isinstance(file, FilesystemFile) and not os.path.lexists(file.name):
            assert Config().new_file, '%s does not exist' % file.name
            return True
        return False
github anthraxx / diffoscope / diffoscope / main.py View on Github external
group2 = parser.add_argument_group('output limits')
    group2.add_argument('--no-default-limits', action='store_true', default=False,
                        help='Disable most default limits. Note that text '
                        'output already ignores most of these.')
    group2.add_argument('--max-text-report-size', metavar='BYTES',
                        dest='max_text_report_size', type=int,
                        help='Maximum bytes written in --text report. (0 to '
                        'disable)', default=None).completer=RangeCompleter(0,
                        Config().max_text_report_size, 200000)
    group2.add_argument('--max-report-size', metavar='BYTES',
                        dest='max_report_size', type=int,
                        help='Maximum bytes written in report. In html-dir '
                        'output, this is the max bytes of the parent page. '
                        '(0 to disable, default: %d)' %
                        Config().max_report_size,
                        default=None).completer=RangeCompleter(0,
                        Config().max_report_size, 200000)
    group2.add_argument('--max-report-child-size', metavar='BYTES',
                        dest='max_report_child_size', type=int,
                        help='In --html-dir output, this is the max bytes of '
                        'each child page (0 to disable, default: %(default)s, '
                        'remaining in effect even with --no-default-limits)',
                        default=Config().max_report_child_size).completer=RangeCompleter(0,
                        Config().max_report_child_size, 50000)
    group2.add_argument('--max-diff-block-lines', dest='max_diff_block_lines',
                        metavar='LINES', type=int,
                        help='Maximum number of lines output per diff block. '
                        'In --html-dir output, we use %d times this number instead, '
                        'taken over all pages. (0 to disable, default: %d)' %
                        (Config().max_diff_block_lines_html_dir_ratio,
                        Config().max_diff_block_lines),
github anthraxx / diffoscope / diffoscope / main.py View on Github external
help='Write Markdown text output to given file (use - for stdout)')
    group1.add_argument('--restructured-text', metavar='OUTPUT_FILE',
                        dest='restructuredtext_output',
                        help='Write RsT text output to given file (use - for stdout)')
    group1.add_argument('--profile', metavar='OUTPUT_FILE', dest='profile_output',
                        help='Write profiling info to given file (use - for stdout)')

    group2 = parser.add_argument_group('output limits')
    group2.add_argument('--no-default-limits', action='store_true', default=False,
                        help='Disable most default limits. Note that text '
                        'output already ignores most of these.')
    group2.add_argument('--max-text-report-size', metavar='BYTES',
                        dest='max_text_report_size', type=int,
                        help='Maximum bytes written in --text report. (0 to '
                        'disable)', default=None).completer=RangeCompleter(0,
                        Config().max_text_report_size, 200000)
    group2.add_argument('--max-report-size', metavar='BYTES',
                        dest='max_report_size', type=int,
                        help='Maximum bytes written in report. In html-dir '
                        'output, this is the max bytes of the parent page. '
                        '(0 to disable, default: %d)' %
                        Config().max_report_size,
                        default=None).completer=RangeCompleter(0,
                        Config().max_report_size, 200000)
    group2.add_argument('--max-report-child-size', metavar='BYTES',
                        dest='max_report_child_size', type=int,
                        help='In --html-dir output, this is the max bytes of '
                        'each child page (0 to disable, default: %(default)s, '
                        'remaining in effect even with --no-default-limits)',
                        default=Config().max_report_child_size).completer=RangeCompleter(0,
                        Config().max_report_child_size, 50000)
    group2.add_argument('--max-diff-block-lines', dest='max_diff_block_lines',
github anthraxx / diffoscope / diffoscope / main.py View on Github external
default=None).completer=RangeCompleter(0,
                        Config().max_report_size, 200000)
    group2.add_argument('--max-report-child-size', metavar='BYTES',
                        dest='max_report_child_size', type=int,
                        help='In --html-dir output, this is the max bytes of '
                        'each child page (0 to disable, default: %(default)s, '
                        'remaining in effect even with --no-default-limits)',
                        default=Config().max_report_child_size).completer=RangeCompleter(0,
                        Config().max_report_child_size, 50000)
    group2.add_argument('--max-diff-block-lines', dest='max_diff_block_lines',
                        metavar='LINES', type=int,
                        help='Maximum number of lines output per diff block. '
                        'In --html-dir output, we use %d times this number instead, '
                        'taken over all pages. (0 to disable, default: %d)' %
                        (Config().max_diff_block_lines_html_dir_ratio,
                        Config().max_diff_block_lines),
                        default=None).completer=RangeCompleter(0,
                        Config().max_diff_block_lines, 5)
    group2.add_argument('--max-diff-block-lines-parent', dest='max_diff_block_lines_parent',
                        metavar='LINES', type=int,
                        help='In --html-dir output, this is maximum number of '
                        'lines output per diff block on the parent page '
                        'before spilling it into child pages (0 to disable, '
                        'default: %(default)s, remaining in effect even with '
                        '--no-default-limits)',
                        default=Config().max_diff_block_lines_parent).completer=RangeCompleter(0,
                        Config().max_diff_block_lines_parent, 200)
    group2.add_argument('--max-diff-block-lines-saved', dest='max_diff_block_lines_saved',
                        metavar='LINES', type=int,
                        help='Maximum number of lines saved per diff block. '
                        'Most users should not need this, unless you run out '
                        'of memory. This truncates diff(1) output before even '
github anthraxx / diffoscope / diffoscope / main.py View on Github external
Config().max_report_size,
                        default=None).completer=RangeCompleter(0,
                        Config().max_report_size, 200000)
    group2.add_argument('--max-report-child-size', metavar='BYTES',
                        dest='max_report_child_size', type=int,
                        help='In --html-dir output, this is the max bytes of '
                        'each child page (0 to disable, default: %(default)s, '
                        'remaining in effect even with --no-default-limits)',
                        default=Config().max_report_child_size).completer=RangeCompleter(0,
                        Config().max_report_child_size, 50000)
    group2.add_argument('--max-diff-block-lines', dest='max_diff_block_lines',
                        metavar='LINES', type=int,
                        help='Maximum number of lines output per diff block. '
                        'In --html-dir output, we use %d times this number instead, '
                        'taken over all pages. (0 to disable, default: %d)' %
                        (Config().max_diff_block_lines_html_dir_ratio,
                        Config().max_diff_block_lines),
                        default=None).completer=RangeCompleter(0,
                        Config().max_diff_block_lines, 5)
    group2.add_argument('--max-diff-block-lines-parent', dest='max_diff_block_lines_parent',
                        metavar='LINES', type=int,
                        help='In --html-dir output, this is maximum number of '
                        'lines output per diff block on the parent page '
                        'before spilling it into child pages (0 to disable, '
                        'default: %(default)s, remaining in effect even with '
                        '--no-default-limits)',
                        default=Config().max_diff_block_lines_parent).completer=RangeCompleter(0,
                        Config().max_diff_block_lines_parent, 200)
    group2.add_argument('--max-diff-block-lines-saved', dest='max_diff_block_lines_saved',
                        metavar='LINES', type=int,
                        help='Maximum number of lines saved per diff block. '
                        'Most users should not need this, unless you run out '