Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-499: rm D205, D401, EM101, EM102, TRY003 #510

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion glass/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
The :mod:`glass.core` module contains core functionality for developing
GLASS modules.

""" # noqa: D205, D400
""" # noqa: D400
10 changes: 5 additions & 5 deletions glass/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def inv_triangle_number(triangle_number: int) -> int:
The :math:`n`-th triangle number is :math:`T_n = n \, (n+1)/2`. If
the argument is :math:`T_n`, then :math:`n` is returned. Otherwise,
a :class:`ValueError` is raised.
""" # noqa: D205, D401
"""
n = math.floor(math.sqrt(2 * triangle_number))
if n * (n + 1) // 2 != triangle_number:
msg = f"not a triangle number: {triangle_number}"
Expand Down Expand Up @@ -503,7 +503,7 @@ def getcl(
The angular power spectrum for indices *i* and *j* from an
array in *GLASS* ordering.

""" # noqa: D205
"""
if j > i:
i, j = j, i
cl = cls[i * (i + 1) // 2 + i - j]
Expand All @@ -529,7 +529,7 @@ def enumerate_spectra(
>>> list(enumerate_spectra(spectra))
[(0, 0, [1, 2, 3]), (1, 1, [4, 5, 6]), (1, 0, [7, 8, 9])]

""" # noqa: D205
"""
for k, cl in enumerate(entries):
i = int((2 * k + 0.25) ** 0.5 - 0.5)
j = i * (i + 3) // 2 - k
Expand All @@ -552,7 +552,7 @@ def spectra_indices(n: int) -> NDArray[np.integer]:
[2, 1],
[2, 0]])

""" # noqa: D205
"""
i, j = np.tril_indices(n)
return np.transpose([i, i - j])

Expand Down Expand Up @@ -685,7 +685,7 @@ def lognormal_fields(
-------
A sequence describing the lognormal fields.

""" # noqa: D205
"""
if shift is None:
shift = lambda _z: 1.0 # noqa: E731

Expand Down
2 changes: 1 addition & 1 deletion glass/galaxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.. autofunction:: galaxy_shear
.. autofunction:: gaussian_phz

""" # noqa: D205, D400
""" # noqa: D400

from __future__ import annotations

Expand Down
4 changes: 2 additions & 2 deletions glass/grf/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def dcorr(t1: Transformation, t2: Transformation, x: NDArray[Any], /) -> NDArray
-------
The derivative of the transformed angular correlation function.

""" # noqa: D401
"""
msg = f"{t1.__class__.__name__} x {t2.__class__.__name__}"
raise NotImplementedError(msg)

Expand Down Expand Up @@ -196,7 +196,7 @@ def compute(
--------
glass.grf.solve: Iterative solver for non-band-limited spectra.

""" # noqa: D205
"""
if t2 is None:
t2 = t1

Expand Down
2 changes: 1 addition & 1 deletion glass/grf/_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class SquaredNormal:
lamda
The parameter :math:`\lambda`.

""" # noqa: D205
"""

a: float
lamda: float = 1.0
Expand Down
2 changes: 1 addition & 1 deletion glass/lensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

.. autofunction:: deflect

""" # noqa: D205, D400
""" # noqa: D400

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion glass/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.. autofunction:: vmap_galactic_ecliptic
""" # noqa: D205, D400
""" # noqa: D400

from __future__ import annotations

Expand Down
4 changes: 2 additions & 2 deletions glass/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
.. autofunction:: linear_bias
.. autofunction:: loglinear_bias

""" # noqa: D205, D400
""" # noqa: D400

from __future__ import annotations

Expand Down Expand Up @@ -221,7 +221,7 @@ def positions_from_delta( # noqa: PLR0912, PLR0913, PLR0915
if isinstance(bias_model, str):
bias_model_callable = globals()[f"{bias_model}_bias"]
elif not callable(bias_model):
raise TypeError("bias_model must be string or callable") # noqa: EM101,TRY003
raise TypeError("bias_model must be string or callable")
else:
bias_model_callable = bias_model

Expand Down
2 changes: 1 addition & 1 deletion glass/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

.. autofunction:: triaxial_axis_ratio

""" # noqa: D205, D400
""" # noqa: D400

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion glass/shells.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
.. autofunction:: volume_weight
.. autofunction:: density_weight

""" # noqa: D205, D400
""" # noqa: D400

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion glass/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.. autofunction:: load_cls
.. autofunction:: write_catalog

""" # noqa: D205, D400
""" # noqa: D400

from __future__ import annotations

Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ lint.per-file-ignores = {"__init__.py" = [
"PLR2004", # magic-value-comparison
"T201", # print
], "glass*" = [
"D205", # missing-blank-line-after-summary
"D401", # non-imperative-mood
"EM101", # raw-string-in-exception
"EM102", # f-string-in-exception
"PLR2004", # TODO: magic-value-comparison
"TRY003", # raise-vanilla-args
], "noxfile.py" = [
"T201", # print
], "tests*" = [
Expand Down
Loading