Loading README.md +7 −0 Changes for README.md: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ Options: for each file on stdout. --fast / --safe If --fast given, skip temporary sanity checks. [default: --safe] -q, --quiet Don't emit non-error messages to stderr. Errors are still emitted, silence those with 2>/dev/null. --version Show the version and exit. --help Show this message and exit. ``` Loading Loading @@ -409,6 +412,10 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). ## Change Log ### 18.4a1 * added `--quiet` (#78) ### 18.4a0 * added `--diff` (#87) Loading black.py +19 −4 Changes for black.py: 19 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -129,6 +129,15 @@ class WriteBack(Enum): is_flag=True, help="If --fast given, skip temporary sanity checks. [default: --safe]", ) @click.option( "-q", "--quiet", is_flag=True, help=( "Don't emit non-error messages to stderr. Errors are still emitted, " "silence those with 2>/dev/null." ), ) @click.version_option(version=__version__) @click.argument( "src", Loading @@ -144,6 +153,7 @@ def main( check: bool, diff: bool, fast: bool, quiet: bool, src: List[str], ) -> None: """The uncompromising code formatter.""" Loading Loading @@ -174,7 +184,7 @@ def main( ctx.exit(0) elif len(sources) == 1: p = sources[0] report = Report(check=check) report = Report(check=check, quiet=quiet) try: if not p.is_file() and str(p) == "-": changed = format_stdin_to_stdout( Loading @@ -195,7 +205,7 @@ def main( try: return_code = loop.run_until_complete( schedule_formatting( sources, line_length, write_back, fast, loop, executor sources, line_length, write_back, fast, quiet, loop, executor ) ) finally: Loading @@ -208,6 +218,7 @@ async def schedule_formatting( line_length: int, write_back: WriteBack, fast: bool, quiet: bool, loop: BaseEventLoop, executor: Executor, ) -> int: Loading Loading @@ -235,7 +246,7 @@ async def schedule_formatting( loop.add_signal_handler(signal.SIGTERM, cancel, _task_values) await asyncio.wait(tasks.values()) cancelled = [] report = Report(check=not write_back) report = Report(check=not write_back, quiet=quiet) for src, task in tasks.items(): if not task.done(): report.failed(src, "timed out, cancelling") Loading @@ -249,8 +260,9 @@ async def schedule_formatting( report.done(src, task.result()) if cancelled: await asyncio.gather(*cancelled, loop=loop, return_exceptions=True) else: elif not quiet: out("All done! ✨ 🍰 ✨") if not quiet: click.echo(str(report)) return report.return_code Loading Loading @@ -1974,6 +1986,7 @@ def gen_python_files_in_dir(path: Path) -> Iterator[Path]: class Report: """Provides a reformatting counter. Can be rendered with `str(report)`.""" check: bool = False quiet: bool = False change_count: int = 0 same_count: int = 0 failure_count: int = 0 Loading @@ -1982,9 +1995,11 @@ def done(self, src: Path, changed: bool) -> None: """Increment the counter for successful reformatting. Write out a message.""" if changed: reformatted = "would reformat" if self.check else "reformatted" if not self.quiet: out(f"{reformatted} {src}") self.change_count += 1 else: if not self.quiet: out(f"{src} already well formatted, good job.", bold=False) self.same_count += 1 Loading Loading
README.md +7 −0 Changes for README.md: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ Options: for each file on stdout. --fast / --safe If --fast given, skip temporary sanity checks. [default: --safe] -q, --quiet Don't emit non-error messages to stderr. Errors are still emitted, silence those with 2>/dev/null. --version Show the version and exit. --help Show this message and exit. ``` Loading Loading @@ -409,6 +412,10 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). ## Change Log ### 18.4a1 * added `--quiet` (#78) ### 18.4a0 * added `--diff` (#87) Loading
black.py +19 −4 Changes for black.py: 19 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -129,6 +129,15 @@ class WriteBack(Enum): is_flag=True, help="If --fast given, skip temporary sanity checks. [default: --safe]", ) @click.option( "-q", "--quiet", is_flag=True, help=( "Don't emit non-error messages to stderr. Errors are still emitted, " "silence those with 2>/dev/null." ), ) @click.version_option(version=__version__) @click.argument( "src", Loading @@ -144,6 +153,7 @@ def main( check: bool, diff: bool, fast: bool, quiet: bool, src: List[str], ) -> None: """The uncompromising code formatter.""" Loading Loading @@ -174,7 +184,7 @@ def main( ctx.exit(0) elif len(sources) == 1: p = sources[0] report = Report(check=check) report = Report(check=check, quiet=quiet) try: if not p.is_file() and str(p) == "-": changed = format_stdin_to_stdout( Loading @@ -195,7 +205,7 @@ def main( try: return_code = loop.run_until_complete( schedule_formatting( sources, line_length, write_back, fast, loop, executor sources, line_length, write_back, fast, quiet, loop, executor ) ) finally: Loading @@ -208,6 +218,7 @@ async def schedule_formatting( line_length: int, write_back: WriteBack, fast: bool, quiet: bool, loop: BaseEventLoop, executor: Executor, ) -> int: Loading Loading @@ -235,7 +246,7 @@ async def schedule_formatting( loop.add_signal_handler(signal.SIGTERM, cancel, _task_values) await asyncio.wait(tasks.values()) cancelled = [] report = Report(check=not write_back) report = Report(check=not write_back, quiet=quiet) for src, task in tasks.items(): if not task.done(): report.failed(src, "timed out, cancelling") Loading @@ -249,8 +260,9 @@ async def schedule_formatting( report.done(src, task.result()) if cancelled: await asyncio.gather(*cancelled, loop=loop, return_exceptions=True) else: elif not quiet: out("All done! ✨ 🍰 ✨") if not quiet: click.echo(str(report)) return report.return_code Loading Loading @@ -1974,6 +1986,7 @@ def gen_python_files_in_dir(path: Path) -> Iterator[Path]: class Report: """Provides a reformatting counter. Can be rendered with `str(report)`.""" check: bool = False quiet: bool = False change_count: int = 0 same_count: int = 0 failure_count: int = 0 Loading @@ -1982,9 +1995,11 @@ def done(self, src: Path, changed: bool) -> None: """Increment the counter for successful reformatting. Write out a message.""" if changed: reformatted = "would reformat" if self.check else "reformatted" if not self.quiet: out(f"{reformatted} {src}") self.change_count += 1 else: if not self.quiet: out(f"{src} already well formatted, good job.", bold=False) self.same_count += 1 Loading