Skip to content

Commit

Permalink
ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed Jun 28, 2024
1 parent 00a78df commit 4115b84
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
15 changes: 4 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,23 @@ 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)
echo "check_check: str = 42" > WDL/DELETEME_check_check.py
$(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
Expand All @@ -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
1 change: 1 addition & 0 deletions WDL/Lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions WDL/_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion WDL/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 1 addition & 5 deletions WDL/runtime/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions WDL/runtime/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4115b84

Please sign in to comment.