Skip to content

Commit e6c6f11

Browse files
committed
quick formatting
1 parent e1f1f0a commit e6c6f11

File tree

8 files changed

+23
-18
lines changed

8 files changed

+23
-18
lines changed

pyhdtoolkit/cpymadtools/lhc/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
.. tab-item:: Importing from the lhc module
2222
2323
.. code-block:: python
24-
24+
2525
from pyhdtoolkit.cpymadtools.lhc import LHCSetup
2626
# use this now
2727
2828
.. tab-item:: Importing from the private module
2929
3030
.. code-block:: python
31-
31+
3232
from pyhdtoolkit.cpymadtools.lhc._setup import LHCSetup
3333
# use this now
3434
"""

pyhdtoolkit/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from . import cmdline, decorators, contexts, htc_monitor, logging # noqa: TID252
1+
from . import cmdline, contexts, decorators, htc_monitor, logging # noqa: TID252
22

33
__all__ = ["cmdline", "decorators", "contexts", "htc_monitor", "logging"]

pyhdtoolkit/utils/_misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def add_noise_to_arc_bpms(
177177
The BPM names should be in the index of the dataframe.
178178
Selection is case insensitive.
179179
180-
180+
181181
Parameters
182182
----------
183183
df : pandas.DataFrame

pyhdtoolkit/utils/contexts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
import time
1313

1414
from contextlib import contextmanager
15-
1615
from typing import TYPE_CHECKING
1716

1817
if TYPE_CHECKING:
1918
from collections.abc import Callable
2019
from types import NoneType
2120

21+
2222
@contextmanager
23-
def timeit(function: Callable) -> NoneType: # type: ignore
23+
def timeit(function: Callable) -> NoneType: # type: ignore
2424
"""
2525
.. versionadded:: 0.4.0
2626

pyhdtoolkit/utils/decorators.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
77
Provides useful decorators.
88
"""
9+
910
from __future__ import annotations
11+
1012
import functools
1113
import inspect
1214
import traceback
1315
import warnings
16+
1417
from typing import TYPE_CHECKING
1518

1619
if TYPE_CHECKING:
@@ -32,12 +35,12 @@ def deprecated(message: str = "") -> Callable:
3235
Extra information to be displayed after the deprecation
3336
notice, when the function is used. Defaults to an empty
3437
string (no extra information).
35-
38+
3639
Returns
3740
-------
3841
Callable
3942
The decorated function.
40-
43+
4144
Example
4245
-------
4346
.. code-block:: python
@@ -71,6 +74,7 @@ def function_wrapper(*args, **kwargs):
7174

7275
# ----- Utility JIT Compilation decorator ----- #
7376

77+
7478
def maybe_jit(func: Callable, **kwargs) -> Callable:
7579
"""
7680
.. versionadded:: 1.7.0

pyhdtoolkit/utils/htc_monitor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def _make_tasks_table(tasks: list[HTCTaskSummary]) -> Table:
176176
tasks : list[HTCTaskSummary]
177177
A list of `~.models.htc.HTCTaskSummary` models, as
178178
parsed from the output of the ``condor_q`` command.
179-
179+
180180
Returns
181181
-------
182182
rich.table.Table
@@ -247,7 +247,7 @@ def _process_scheduler_information_line(line: str) -> str:
247247
----------
248248
line : str
249249
The line containing the scheduler information.
250-
250+
251251
Returns
252252
-------
253253
str
@@ -266,7 +266,7 @@ def _process_task_summary_line(line: str) -> HTCTaskSummary:
266266
----------
267267
line : str
268268
The line containing the task summary information.
269-
269+
270270
Returns
271271
-------
272272
pyhdtoolkit.models.htc.HTCTaskSummary
@@ -352,7 +352,7 @@ def _default_cluster_table() -> Table:
352352
"""
353353
Create the default structure for the Cluster
354354
Table, hard coded columns and no rows added.
355-
355+
356356
Returns
357357
-------
358358
rich.table.Table

tests/test_optics.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import numpy as np
44
import pytest
5+
56
from numpy.testing import assert_allclose
7+
68
from pyhdtoolkit.optics import ripken, twiss
79
from pyhdtoolkit.optics.beam import Beam, compute_beam_parameters
810
from pyhdtoolkit.optics.rdt import determine_rdt_line, rdt_to_order_and_type
@@ -62,7 +64,6 @@ def test_gamma_transition_raises():
6264
Beam(6500, 2.5e-6).gamma_transition(0)
6365

6466

65-
6667
def test_beam_parameters():
6768
pc_gev = 19
6869
nemitt_x = 5e-6
@@ -83,7 +84,6 @@ def test_beam_parameters():
8384
assert_allclose(built.gamma_rel, 20.274666054506927)
8485

8586

86-
8787
def test_beam_size(_fake_coordinates):
8888
assert_allclose(ripken._beam_size(_fake_coordinates), _fake_coordinates.std()) # noqa: SLF001
8989
assert_allclose(
@@ -102,9 +102,10 @@ def test_beam_size_raises(_fake_coordinates):
102102
@pytest.mark.parametrize("gemitt_x", [5e-6, 2.75e-6, 3.5e-6])
103103
@pytest.mark.parametrize("gemitt_y", [5e-6, 2.75e-6, 3.5e-6])
104104
def test_lebedev_size_floats(beta11, beta21, gemitt_x, gemitt_y):
105-
assert_allclose(ripken.lebedev_beam_size(beta1_=beta11, beta2_=beta21, gemitt_x=gemitt_x, gemitt_y=gemitt_y), np.sqrt(
106-
gemitt_x * beta11 + gemitt_y * beta21
107-
))
105+
assert_allclose(
106+
ripken.lebedev_beam_size(beta1_=beta11, beta2_=beta21, gemitt_x=gemitt_x, gemitt_y=gemitt_y),
107+
np.sqrt(gemitt_x * beta11 + gemitt_y * beta21),
108+
)
108109

109110

110111
def test_courant_snyder_transform():

tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
from pyhdtoolkit.utils import _misc, logging
1919
from pyhdtoolkit.utils.cmdline import CommandLine
20+
from pyhdtoolkit.utils.decorators import deprecated, maybe_jit
2021
from pyhdtoolkit.utils.htc_monitor import (
2122
ClusterSummary,
2223
HTCTaskSummary,
2324
_make_cluster_table,
2425
_make_tasks_table,
2526
read_condor_q,
2627
)
27-
from pyhdtoolkit.utils.decorators import deprecated, maybe_jit
2828

2929
CURRENT_DIR = pathlib.Path(__file__).parent
3030
INPUTS_DIR = CURRENT_DIR / "inputs"

0 commit comments

Comments
 (0)