-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-133722: Add Difflib theme to _colorize
and 'color' option to difflib.unified_diff
#133725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
5c5b248
fdc0fa0
fcdd7ab
0e9b070
7c31749
66475a2
dbf0547
a72012e
2a3d818
252982e
3422fa7
bffdd71
3255866
c48a6ac
8ca50fa
eb0e81e
f7b34c3
fb092b0
734b0bc
8a10e40
57b80d1
c235425
387cfe6
833d86a
25f9d80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -207,6 +207,16 @@ class Unittest(ThemeSection): | |||||||||||||||||
reset: str = ANSIColors.RESET | ||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
@dataclass(frozen=True) | ||||||||||||||||||
class Difflib(ThemeSection): | ||||||||||||||||||
dougthor42 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||
"""A 'git diff'-like theme for `difflib.unified_diff`.""" | ||||||||||||||||||
header: str = ANSIColors.BOLD # eg "---" and "+++" lines | ||||||||||||||||||
hunk: str = ANSIColors.CYAN # the "@@" lines | ||||||||||||||||||
insert: str = ANSIColors.GREEN | ||||||||||||||||||
delete: str = ANSIColors.RED | ||||||||||||||||||
reset: str = ANSIColors.RESET | ||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
@dataclass(frozen=True) | ||||||||||||||||||
class Theme: | ||||||||||||||||||
"""A suite of themes for all sections of Python. | ||||||||||||||||||
|
@@ -218,6 +228,7 @@ class Theme: | |||||||||||||||||
syntax: Syntax = field(default_factory=Syntax) | ||||||||||||||||||
traceback: Traceback = field(default_factory=Traceback) | ||||||||||||||||||
unittest: Unittest = field(default_factory=Unittest) | ||||||||||||||||||
difflib: Difflib = field(default_factory=Difflib) | ||||||||||||||||||
|
syntax: Syntax = field(default_factory=Syntax) | |
traceback: Traceback = field(default_factory=Traceback) | |
unittest: Unittest = field(default_factory=Unittest) | |
difflib: Difflib = field(default_factory=Difflib) | |
difflib: Difflib = field(default_factory=Difflib) | |
syntax: Syntax = field(default_factory=Syntax) | |
traceback: Traceback = field(default_factory=Traceback) | |
unittest: Unittest = field(default_factory=Unittest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very slightly concerned about sorting when the dataclasses aren't kw_only
.
Should I update the dataclass decorator to include kw_only=True
and then sort? Or is that out of scope of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ask @ambv about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Done
dougthor42 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dougthor42 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dougthor42 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,2 @@ | ||||||
Added a ``color`` option to :func:`difflib.unified_diff` that injects ANSI color | ||||||
|
Added a ``color`` option to :func:`difflib.unified_diff` that injects ANSI color | |
Added a *color* option to :func:`difflib.unified_diff` that injects ANSI color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still todo :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops!
Uh oh!
There was an error while loading. Please reload this page.