Skip to content

Commit

Permalink
Don't use trailrunner to format exactly one file
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobronium authored May 17, 2022
1 parent 63839ac commit b30aba2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion usort/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ def usort_path(path: Path, *, write: bool = False) -> Iterable[Result]:
paths = list(walk(path, excludes=config.excludes))

fn = partial(usort_file, write=write)
results = [v for v in run(paths, fn).values()]
if len(paths) == 1:
results = [fn(paths[0])] # shave off multiprocessing overhead
else:
results = [v for v in run(paths, fn).values()]
return results


Expand Down

0 comments on commit b30aba2

Please sign in to comment.