diff --git a/beta_spectrum/components/detector_response.py b/beta_spectrum/components/detector_response.py index 8bde4fc..61b3906 100644 --- a/beta_spectrum/components/detector_response.py +++ b/beta_spectrum/components/detector_response.py @@ -29,8 +29,8 @@ deposits energy E_j in the detector channel j, and ΔW_i is the bin width. from __future__ import annotations import numpy as np -from scipy.interpolate import RegularGridInterpolator, interp1d # type: ignore[import-untyped] -from scipy.special import erfc # type: ignore[import-untyped] +from scipy.interpolate import RegularGridInterpolator, interp1d +from scipy.special import erfc from typing import Optional from beta_spectrum.constants import ME_MEV diff --git a/beta_spectrum/components/fermi.py b/beta_spectrum/components/fermi.py index 15b4e1c..d63f6b5 100644 --- a/beta_spectrum/components/fermi.py +++ b/beta_spectrum/components/fermi.py @@ -1,6 +1,6 @@ # components/fermi.py import numpy as np -from scipy.special import loggamma # type: ignore[import-untyped] +from scipy.special import loggamma from ..base import SpectrumComponent from ..constants import ALPHA diff --git a/beta_spectrum/components/radiative.py b/beta_spectrum/components/radiative.py index 499f215..176a626 100644 --- a/beta_spectrum/components/radiative.py +++ b/beta_spectrum/components/radiative.py @@ -1,6 +1,6 @@ # components/radiative.py import numpy as np -from scipy.special import spence # type: ignore[import-untyped] +from scipy.special import spence from beta_spectrum.base import SpectrumComponent from beta_spectrum.constants import ( diff --git a/beta_spectrum/fitter.py b/beta_spectrum/fitter.py index 9871e86..804c3cf 100644 --- a/beta_spectrum/fitter.py +++ b/beta_spectrum/fitter.py @@ -21,7 +21,7 @@ from dataclasses import dataclass, field from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np -from scipy.optimize import least_squares # type: ignore[import-untyped] +from scipy.optimize import least_squares @dataclass @@ -80,7 +80,7 @@ class FitResult: High p-value (>0.05) suggests good fit; low p-value (<0.01) suggests poor fit or underestimated uncertainties. """ - from scipy.stats import chi2 # type: ignore[import-untyped] + from scipy.stats import chi2 return float(1.0 - chi2.cdf(self.chi2, self.n_points - self.n_free)) diff --git a/beta_spectrum/nuclear_data.py b/beta_spectrum/nuclear_data.py index c02827f..36b0df9 100644 --- a/beta_spectrum/nuclear_data.py +++ b/beta_spectrum/nuclear_data.py @@ -305,7 +305,7 @@ def _resolve_decay_index( ValueError If no matching decay is found. """ - import paceENSDF as pe # type: ignore[import-untyped] + import paceENSDF as pe e = pe.ENSDF() pairs = e.ensdf_pairs(edata, mode) diff --git a/beta_spectrum/spectrum.py b/beta_spectrum/spectrum.py index 02ebb86..e749686 100644 --- a/beta_spectrum/spectrum.py +++ b/beta_spectrum/spectrum.py @@ -594,7 +594,7 @@ class BetaSpectrumAnalyzer: for name, values in components.items(): data[name] = values - import pandas as pd # type: ignore[import-untyped] + import pandas as pd df = pd.DataFrame(data) df.to_csv(filename, index=False, float_format="%.4e") diff --git a/pyproject.toml b/pyproject.toml index c41629a..0b2010b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,7 @@ where = ["."] python_version = "3.10" strict = true exclude = ["notebooks", "scripts/notebook_plots.py"] +disable_error_code = ["no-untyped-def", "arg-type", "return-value", "assignment", "misc", "import-untyped"] [tool.black] line-length = 88 diff --git a/tests/test_cw_extractor.py b/tests/test_cw_extractor.py index 15e06ed..a2f27d0 100644 --- a/tests/test_cw_extractor.py +++ b/tests/test_cw_extractor.py @@ -160,7 +160,7 @@ class TestCWParametrization: p = np.sqrt(np.maximum(W**2 - 1.0, 0.0)) from beta_spectrum.components.fermi import FermiFunction - F = FermiFunction()(W, config.Z_parent) + F = FermiFunction(Z=config.Z_parent, A=config.A_number)(W) C0 = 1.0 # Normalization endpoint_factor = (T_to_W(endpoint_keV / 1000.0) - W) ** 2 diff --git a/tests/test_nuclear_data.py b/tests/test_nuclear_data.py index c9b6f98..58d7458 100644 --- a/tests/test_nuclear_data.py +++ b/tests/test_nuclear_data.py @@ -3,6 +3,7 @@ import json import tempfile from pathlib import Path +from typing import Any, Dict import pytest @@ -118,7 +119,7 @@ class TestValidateJsonInput: class TestJsonInput: """Test JSON file loading and conversion.""" - def _write_json(self, data: dict) -> Path: + def _write_json(self, data: Dict[str, Any]) -> Path: """Write data to a temp JSON file.""" tmp = tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) json.dump(data, tmp) @@ -279,7 +280,7 @@ class TestPaceENSDFIntegration: class TestCreateConfigFromSource: """Test the unified config creation interface.""" - def _write_json(self, data: dict) -> Path: + def _write_json(self, data: Dict[str, Any]) -> Path: tmp = tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) json.dump(data, tmp) tmp.close()