Skip to content

Commit

Permalink
Maint: GitHub Actions Black (#35)
Browse files Browse the repository at this point in the history
* maint: make black verbose

* add: workflow dispatch

* add: diff to see concerns

* maint: update requirements, update to black v24, run

* maint: rename 'lint' jobs for clarity

* maint: re-run black after rebase from main

* maint: additional flake8 violation by black
  • Loading branch information
maffettone authored Mar 15, 2024
1 parent 626fc6e commit 49d5ecd
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ exclude =
bluesky_adaptive/_version.py,
docs/source/conf.py
# There are some errors produced by 'black', therefore unavoidable
ignore = E203, W503
ignore = E203, W503, E701
max-line-length = 115
6 changes: 3 additions & 3 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Check Code Style - BLACK

on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

jobs:
lint:
lint-black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -18,4 +18,4 @@ jobs:
pip install black
- name: Run black
run: |
black . --check
black . --check --verbose --diff
2 changes: 1 addition & 1 deletion .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check Code Style - FLAKE8
on: [push, pull_request]

jobs:
lint:
lint-flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/isort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check Code Style - ISORT
on: [push, pull_request]

jobs:
lint:
lint-isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions bluesky_adaptive/agents/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- measurement_plan_kwargs
- unpack_run
"""

from abc import ABC
from logging import getLogger
from typing import Generator, Sequence, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions bluesky_adaptive/on_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
This corresponds to a "middle" scale of adaptive integration into
data collection.
"""

from queue import Queue

import event_model
Expand Down
1 change: 1 addition & 0 deletions bluesky_adaptive/recommendations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Toy recommendation engines for testing / demo purposes."""

from bluesky.utils import RunEngineControlException


Expand Down
4 changes: 1 addition & 3 deletions bluesky_adaptive/server/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ class EState(enum.Enum):
CLOSED = "closed" # For completeness


class RejectedError(RuntimeError):
...
class RejectedError(RuntimeError): ...


class WorkerProcess(Process):

"""
The class implementing the Worker process.
Expand Down
3 changes: 1 addition & 2 deletions bluesky_adaptive/tests/test_botorch_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ def unpack_run(self, run: BlueskyRun) -> Tuple[Union[float, ArrayLike], Union[fl
return self.counter, np.random.rand(10)


class TestGPAgent(OfflineAgentMixin, SingleTaskGPAgentBase):
...
class TestGPAgent(OfflineAgentMixin, SingleTaskGPAgentBase): ...


def test_gp_agent(tiled_profile, tiled_node):
Expand Down
6 changes: 2 additions & 4 deletions bluesky_adaptive/tests/test_sklearn_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,10 @@ def unpack_run(self, run: BlueskyRun) -> Tuple[Union[float, ArrayLike], Union[fl
return self.counter, np.random.rand(10)


class TestDecompAgent(DummyAgentMixin, DecompositionAgentBase):
...
class TestDecompAgent(DummyAgentMixin, DecompositionAgentBase): ...


class TestClusterAgent(DummyAgentMixin, ClusterAgentBase):
...
class TestClusterAgent(DummyAgentMixin, ClusterAgentBase): ...


@pytest.mark.parametrize("estimator", [PCA(2), NMF(2)], ids=["PCA", "NMF"])
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
codecov
coverage
flake8
black
pytest
sphinx
# These are dependencies of various sphinx extensions for documentation.
Expand Down

0 comments on commit 49d5ecd

Please sign in to comment.