bigyo package¶
Subpackages¶
Module contents¶
bigyo¶
Bigyo (비교(KR): comparison) is Python library for side-by-side diff in terminal.
use difflib as its engine.
Supports beautiful output with multi-width or zero-width character.
- date:
2023-01-10
- Author:
LegenDUST
- Version:
1.0.0
- class bigyo.Bigyo(renderer=None)¶
Bases:
objectBigyo (ko: 비교, comparison) is class for side-by-side comparison, using difflib as its engine.
Simply replace:
difflib.Differ().compare(a, b)
to:
Bigyo().compare()
and you’ll get nice side-by-side comparison.
- Parameters:
bigyo_renderer – Bigyo rendering strategy, which decides way to render comparison. It can be
BigyoRendererobject, or None (which usesSimpleBigyoRenderer), defaults to None
- compare(left, right)¶
Generator for generating side-by-side comparison.
- Parameters:
left (
Sequence[str]) – Left sequence to compareright (
Sequence[str]) – Right sequence to compare
- Return type:
Iterator[str]- Returns:
Iterator, where next() call returns line with its difference.
- comparison_string(left, right)¶
Return full compared string at once.
Is just
return ''.join(self.compare(left, right)). Guess it will quite comes in handy.- Parameters:
left (
Sequence[str]) – Left sequence to compareright (
Sequence[str]) – Right sequence to compare
- Return type:
str