Skip to content

Commit 1a695c9

Browse files
committed
linting and adding requirements
1 parent 6817777 commit 1a695c9

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

.github/workflows/python-app.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install flake8 pytest
29+
python -m pip install .
30+
pip install ruff pytest
3031
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3132
- name: Lint with flake8
3233
run: |
3334
# stop the build if there are Python syntax errors or undefined names
34-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35+
ruff check --exit-non-zero-on-fix
3736
- name: Test with pytest
3837
run: |
3938
pytest

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pandas
22
numpy
33
scipy
4+
pydantic

src/pulse_transitions/common.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from enum import Enum
2-
from enum import StrEnum
32
from typing import Tuple
43

54
from pydantic import BaseModel
6-
from pydantic import Extra
75
from pydantic import model_validator
86

97

@@ -13,10 +11,11 @@ class EdgeSign(Enum):
1311
none = 0
1412

1513
class StrictBaseModel(BaseModel):
16-
class Config:
17-
extra = Extra.forbid # No extra fields allowed
14+
model_config = {
15+
"extra": "forbid" # Disallow extra fields
16+
}
1817

19-
class GroupStrategy(StrEnum):
18+
class GroupStrategy(Enum):
2019
median = "median"
2120
mode = "mode"
2221
first = "first"

src/pulse_transitions/impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def _detect_edge_wrapper(sign: EdgeSign, x: NumberIterable, fs: Optional[float]=
444444

445445
return _detect_first_edge(x=t_uniform, y=x_uniform,
446446
thresholds=edge_thresholds,
447-
sign=sign, settings=settings)
447+
sign=sign)
448448

449449

450450
def _calculate_thresholds(x: NumberIterable, y: NumberIterable,

0 commit comments

Comments
 (0)