]>
git.madduck.net Git - etc/vim.git/commitdiff
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:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b4cee97 )
* typing stub files (`.pyi`) are now formatted in a style that is consistent
with PEP 484 (#207, #210)
* typing stub files (`.pyi`) are now formatted in a style that is consistent
with PEP 484 (#207, #210)
+* progress when reformatting many files is now reported incrementally
+
* fixed trailers (content with brackets) being unnecessarily exploded
into their own lines after a dedented closing bracket (#119)
* fixed trailers (content with brackets) being unnecessarily exploded
into their own lines after a dedented closing bracket (#119)
manager = Manager()
lock = manager.Lock()
tasks = {
manager = Manager()
lock = manager.Lock()
tasks = {
- src: loop.run_in_executor(
executor, format_file_in_place, src, line_length, fast, write_back, lock
executor, format_file_in_place, src, line_length, fast, write_back, lock
+ ): src
+ for src in sorted(sources)
- _task_values = list(tasks.values() )
+ pending: Iterable[asyncio.Task] = tasks.keys( )
- loop.add_signal_handler(signal.SIGINT, cancel, _task_values )
- loop.add_signal_handler(signal.SIGTERM, cancel, _task_values )
+ loop.add_signal_handler(signal.SIGINT, cancel, pending )
+ loop.add_signal_handler(signal.SIGTERM, cancel, pending )
except NotImplementedError:
# There are no good alternatives for these on Windows
pass
except NotImplementedError:
# There are no good alternatives for these on Windows
pass
- await asyncio.wait(_task_values)
- for src, task in tasks.items():
- if not task.done():
- report.failed(src, "timed out, cancelling")
- task.cancel()
- cancelled.append(task)
- elif task.cancelled():
- cancelled.append(task)
- elif task.exception():
- report.failed(src, str(task.exception()))
- else:
- formatted.append(src)
- report.done(src, Changed.YES if task.result() else Changed.NO)
-
+ while pending:
+ done, _ = await asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED)
+ for task in done:
+ src = tasks.pop(task)
+ if task.cancelled():
+ cancelled.append(task)
+ elif task.exception():
+ report.failed(src, str(task.exception()))
+ else:
+ formatted.append(src)
+ report.done(src, Changed.YES if task.result() else Changed.NO)
if cancelled:
await asyncio.gather(*cancelled, loop=loop, return_exceptions=True)
if write_back == WriteBack.YES and formatted:
if cancelled:
await asyncio.gather(*cancelled, loop=loop, return_exceptions=True)
if write_back == WriteBack.YES and formatted:
-def cancel(tasks: List [asyncio.Task]) -> None:
+def cancel(tasks: Iterable [asyncio.Task]) -> None:
"""asyncio signal handler that cancels all `tasks` and reports to stderr."""
err("Aborted!")
for task in tasks:
"""asyncio signal handler that cancels all `tasks` and reports to stderr."""
err("Aborted!")
for task in tasks: