Skip to content

Commit

Permalink
Fix linting (#66)
Browse files Browse the repository at this point in the history
* Fix linting

* Use Python 3.12

* More Python 3.12

* Reformat with black for Python 3.12
  • Loading branch information
bittremieux authored Apr 16, 2024
1 parent e4847f6 commit b1fc7bf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python 3.10
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"

- name: Lint with black
uses: psf/black@stable
with:
options: "--check --diff --line-length 79"

- name: Check for debugging print statements
run: |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = 'setuptools.build_meta'

[tool.black]
line-length = 79
target-version = ['py37']
target-version = ['py312']
include = '\.pyi?$'
exclude = '''
(
Expand Down
10 changes: 4 additions & 6 deletions spectrum_utils/proforma.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ def proteoform(self, tree) -> Proteoform:
self._modifications.sort(key=_modification_sort_key)
proteoform = Proteoform(
sequence=sequence,
modifications=self._modifications
if len(self._modifications) > 0
else None,
modifications=(
self._modifications if len(self._modifications) > 0 else None
),
charge=charge,
)
# Reset class variables.
Expand Down Expand Up @@ -664,9 +664,7 @@ def parse(proforma: str) -> List[Proteoform]:


@functools.lru_cache
def _import_cv(
cv_id: str, cache: Optional[str]
) -> Union[
def _import_cv(cv_id: str, cache: Optional[str]) -> Union[
Tuple[Dict[str, Tuple[float, str]], Dict[str, Tuple[float, str]]],
Dict[str, float],
]:
Expand Down
4 changes: 2 additions & 2 deletions tests/spectrum_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def test_scale_intensity_root():
intensity_unscaled = spec.intensity.copy()
spec.scale_intensity(scaling="root", degree=degree)
np.testing.assert_allclose(
spec.intensity ** degree, intensity_unscaled, rtol=1e-5
spec.intensity**degree, intensity_unscaled, rtol=1e-5
)


Expand All @@ -434,7 +434,7 @@ def test_scale_intensity_log():
intensity_unscaled = spec.intensity.copy()
spec.scale_intensity(scaling="log", base=base)
np.testing.assert_allclose(
base ** spec.intensity - 1, intensity_unscaled, rtol=1e-5
base**spec.intensity - 1, intensity_unscaled, rtol=1e-5
)


Expand Down

0 comments on commit b1fc7bf

Please sign in to comment.