From 4115b8481de2cc0106a33f1000a1891cd58c038f Mon Sep 17 00:00:00 2001 From: Mike Lin Date: Fri, 28 Jun 2024 09:59:51 -0700 Subject: [PATCH] ruff format --- Makefile | 15 ++++----------- WDL/Lint.py | 1 + WDL/_grammar.py | 4 +--- WDL/_util.py | 2 +- WDL/runtime/config.py | 6 +----- WDL/runtime/workflow.py | 1 + 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 5b1efeea..61bd1c4f 100644 --- a/Makefile +++ b/Makefile @@ -36,13 +36,14 @@ singularity_tests: MINIWDL__SCHEDULER__CONTAINER_BACKEND=singularity \ sh -c 'python3 -m WDL run_self_test && prove -v tests/applied/viral_assemble.t' -ci_housekeeping: sopretty check_check check doc +ci_housekeeping: check_check check doc ci_unit_tests: unit_tests check: ruff check --ignore E741 WDL mypy WDL + ruff format --check --line-length 100 WDL check_check: # regression test against pyre/mypy doing nothing (issue #100) @@ -50,16 +51,8 @@ check_check: $(MAKE) check > /dev/null 2>&1 && exit 1 || exit 0 rm WDL/DELETEME_check_check.py -# uses black to rewrite source files! pretty: - black --line-length 100 --target-version py36 WDL/ - pylint -d cyclic-import,empty-docstring,missing-docstring,invalid-name,bad-continuation --exit-zero WDL - -# for use in CI: complain if source code isn't at a fixed point for black -sopretty: - @git diff --quiet || (echo "ERROR: 'make sopretty' must start with a clean working tree"; exit 1) - $(MAKE) pretty - @git diff --quiet || (echo "ERROR: source files were modified by black; please fix up this commit with 'make pretty'"; exit 1) + ruff format --line-length 100 WDL # build docker image with current source tree, poised to run tests e.g.: # docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp miniwdl @@ -86,4 +79,4 @@ doc: docs: doc -.PHONY: check check_check sopretty pretty test qtest docker doc docs pypi_test pypi bdist ci_housekeeping unit_tests integration_tests skylab_bulk_rna DVGLx viral_assemble +.PHONY: check check_check pretty test qtest docker doc docs pypi_test pypi bdist ci_housekeeping unit_tests integration_tests skylab_bulk_rna DVGLx viral_assemble diff --git a/WDL/Lint.py b/WDL/Lint.py index d03eea61..e0ddaebf 100644 --- a/WDL/Lint.py +++ b/WDL/Lint.py @@ -26,6 +26,7 @@ The ``descend_imports`` flag controls whether lint warnings are generated for imported documents recursively (true, default), or otherwise only the given document (false). """ + import subprocess import tempfile import json diff --git a/WDL/_grammar.py b/WDL/_grammar.py index 960fd653..b5a951ef 100644 --- a/WDL/_grammar.py +++ b/WDL/_grammar.py @@ -269,9 +269,7 @@ # Development grammar version; any bugfixes to the draft-2/1.0 grammar may need to be forward- # ported into this. -versions[ - "development" -] = r""" +versions["development"] = r""" /////////////////////////////////////////////////////////////////////////////////////////////////// // document /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/WDL/_util.py b/WDL/_util.py index aa6a306f..d7ae4eba 100644 --- a/WDL/_util.py +++ b/WDL/_util.py @@ -211,7 +211,7 @@ def link_force(src: str, dst: str) -> None: @export def write_values_json( - values_env: "Env.Bindings[Value.Base]", filename: str, namespace: str = "" # noqa + values_env: "Env.Bindings[Value.Base]", filename: str, namespace: str = "" ) -> None: from . import values_to_json diff --git a/WDL/runtime/config.py b/WDL/runtime/config.py index c80d2d2f..bf2a08f7 100644 --- a/WDL/runtime/config.py +++ b/WDL/runtime/config.py @@ -321,11 +321,7 @@ def _strip(value: str) -> str: if ans: ans = value.strip() if len(ans) >= 2 and ( - ( - ans.startswith("'") - and ans.endswith("'") - or (ans.startswith('"') and ans.endswith('"')) - ) + ans.startswith("'") and ans.endswith("'") or (ans.startswith('"') and ans.endswith('"')) ): ans = ans[1:-1] return ans diff --git a/WDL/runtime/workflow.py b/WDL/runtime/workflow.py index b58fb841..1acdd783 100644 --- a/WDL/runtime/workflow.py +++ b/WDL/runtime/workflow.py @@ -674,6 +674,7 @@ def _gather( class _StdLib(StdLib.Base): "checks against & updates the file/directory allowlist for the read_* and write_* functions" + cfg: config.Loader state: StateMachine cache: CallCache