Skip to content

Commit

Permalink
refactor duplicate code in gen_exports
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Dec 19, 2024
1 parent 2aa5771 commit 8501b0c
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/trio/_tools/gen_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,13 @@ def run_linters(file: File, source: str) -> str:
SystemExit: If either failed.
"""

success, response = run_black(file, source)
if not success:
print(response)
sys.exit(1)

success, response = run_ruff(file, response)
if not success: # pragma: no cover # Test for run_ruff should catch
print(response)
sys.exit(1)

success, response = run_black(file, response)
if not success:
print(response)
sys.exit(1)

return response
for fn in (run_black, run_ruff, run_black):
success, source = fn(file, source)
if not success:
print(source)
sys.exit(1)

return source


def gen_public_wrappers_source(file: File) -> str:
Expand Down

0 comments on commit 8501b0c

Please sign in to comment.