From 59c4525a301b8f9a2a2897dc149c270edb9f0f93 Mon Sep 17 00:00:00 2001 From: Wout Bittremieux Date: Tue, 16 Apr 2024 20:56:22 +0200 Subject: [PATCH 1/4] Fix linting --- .github/workflows/lint.yml | 2 -- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0757a94..c667dfd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,8 +22,6 @@ jobs: - name: Lint with black uses: psf/black@stable - with: - options: "--check --diff --line-length 79" - name: Check for debugging print statements run: | diff --git a/pyproject.toml b/pyproject.toml index d17a4dd..8c70c5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = 'setuptools.build_meta' [tool.black] line-length = 79 -target-version = ['py37'] +target-version = ['py312'] include = '\.pyi?$' exclude = ''' ( From ca1e089146cf8a1d653a0dee9481d6948520c416 Mon Sep 17 00:00:00 2001 From: Wout Bittremieux Date: Tue, 16 Apr 2024 20:58:53 +0200 Subject: [PATCH 2/4] Use Python 3.12 --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c667dfd..1b83e9e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,7 @@ 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" From 8a2b63a67cd76f189ffc6879e7c7b185526dcc99 Mon Sep 17 00:00:00 2001 From: Wout Bittremieux Date: Tue, 16 Apr 2024 21:00:14 +0200 Subject: [PATCH 3/4] More Python 3.12 --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1b83e9e..17fae13 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: - 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 From e8a2dc52924b72a5a68ab627db9b7bc0cac51b2d Mon Sep 17 00:00:00 2001 From: Wout Bittremieux Date: Tue, 16 Apr 2024 21:06:57 +0200 Subject: [PATCH 4/4] Reformat with black for Python 3.12 --- spectrum_utils/proforma.py | 10 ++++------ tests/spectrum_test.py | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/spectrum_utils/proforma.py b/spectrum_utils/proforma.py index 234424c..684d222 100644 --- a/spectrum_utils/proforma.py +++ b/spectrum_utils/proforma.py @@ -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. @@ -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], ]: diff --git a/tests/spectrum_test.py b/tests/spectrum_test.py index bf5e7a8..a1bc57d 100644 --- a/tests/spectrum_test.py +++ b/tests/spectrum_test.py @@ -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 ) @@ -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 )