]>
git.madduck.net Git - etc/vim.git/blobdiff - src/black/report.py
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
"""
Summarize Black runs to users.
"""
"""
Summarize Black runs to users.
"""
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from click import style
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from click import style
-from black.output import out, err
+from black.output import err, out
+class NothingChanged(UserWarning):
+ """Raised when reformatted code is the same as source."""
+
+
@dataclass
class Report:
"""Provides a reformatting counter. Can be rendered with `str(report)`."""
@dataclass
class Report:
"""Provides a reformatting counter. Can be rendered with `str(report)`."""
if self.change_count:
s = "s" if self.change_count > 1 else ""
report.append(
if self.change_count:
s = "s" if self.change_count > 1 else ""
report.append(
- style(f"{self.change_count} file{s} {reformatted}", bold=True)
+ style(f"{self.change_count} file{s} ", bold=True, fg="blue")
+ + style(f"{reformatted}", bold=True)
if self.same_count:
s = "s" if self.same_count > 1 else ""
if self.same_count:
s = "s" if self.same_count > 1 else ""
- report.append(f"{self.same_count} file{s} {unchanged}" )
+ report.append(style(f"{self.same_count} file{s} ", fg="blue") + unchanged )
if self.failure_count:
s = "s" if self.failure_count > 1 else ""
report.append(style(f"{self.failure_count} file{s} {failed}", fg="red"))
if self.failure_count:
s = "s" if self.failure_count > 1 else ""
report.append(style(f"{self.failure_count} file{s} {failed}", fg="red"))