diff --git a/.github/workflows/Black.yml b/.github/workflows/Black.yml new file mode 100644 index 00000000..18767f7b --- /dev/null +++ b/.github/workflows/Black.yml @@ -0,0 +1,28 @@ +name: Black Formatting +on: [pull_request] +jobs: + black: + if: ${{ github.actor != 'dependabot[bot]' }} # Do not run on commits created by dependabot + runs-on: ubuntu-latest + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the changed files. + contents: write # Allows reading and writing repository contents (e.g., commits) + pull-requests: write # Allows reading and writing pull requests + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.sha }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Black Code Formatter + uses: psf/black@stable + with: + options: "--verbose" + src: "." + + - name: Commit changes + if: success() + uses: stefanzweifel/git-auto-commit-action@v5 + id: auto-commit-action + with: + commit_message: 'Style fixes by Black' \ No newline at end of file diff --git a/jcvi/formats/gff.py b/jcvi/formats/gff.py index da13f3b6..6bd66def 100644 --- a/jcvi/formats/gff.py +++ b/jcvi/formats/gff.py @@ -2850,9 +2850,7 @@ def note(args): continue if AED is not None and float(g.attributes["_AED"][0]) > AED: continue - keyval = [g.accn] + [ - ",".join(g.attributes.get(x, ["nan"])) for x in attrib - ] + keyval = [g.accn] + [",".join(g.attributes.get(x, ["nan"])) for x in attrib] if exoncounts: nexons = exoncounts.get(g.accn, 0) keyval.append(str(nexons)) diff --git a/tests/formats/test_bed.py b/tests/formats/test_bed.py index dc742f62..9d10f194 100644 --- a/tests/formats/test_bed.py +++ b/tests/formats/test_bed.py @@ -3,6 +3,7 @@ from jcvi.formats.bed import summary + def test_summary(): cwd = os.getcwd() os.chdir(op.join(op.dirname(__file__), "data")) diff --git a/tests/formats/test_cblast_benchmark.py b/tests/formats/test_cblast_benchmark.py index 73161b90..c17dcdb0 100644 --- a/tests/formats/test_cblast_benchmark.py +++ b/tests/formats/test_cblast_benchmark.py @@ -5,6 +5,7 @@ import pytest import time + # Benchmark cblast vs blast module @pytest.mark.benchmark( group="CBlastLine vs PyBlastLine", timer=time.time, disable_gc=True, warmup=False diff --git a/tests/graphics/test_grabseeds.py b/tests/graphics/test_grabseeds.py index 432d2314..81b2c808 100644 --- a/tests/graphics/test_grabseeds.py +++ b/tests/graphics/test_grabseeds.py @@ -17,7 +17,7 @@ def test_main(): # Test calibrate json_file = "calibrate.json" cleanup(json_file, output_image) - json_file = calibrate(["calibrate.JPG", "1"]) # `1` for the boxsize arg + json_file = calibrate(["calibrate.JPG", "1"]) # `1` for the boxsize arg assert op.exists(json_file) seeds(["test.JPG", "--calibrate", json_file]) diff --git a/tests/utils/test_range.py b/tests/utils/test_range.py index cbb0008d..74808eaa 100644 --- a/tests/utils/test_range.py +++ b/tests/utils/test_range.py @@ -212,4 +212,4 @@ def test_range_conflict(ranges, expected): def test_range_chain(ranges, expected): from jcvi.utils.range import range_chain - assert range_chain(ranges) == expected \ No newline at end of file + assert range_chain(ranges) == expected