Skip to content

Commit

Permalink
Bump ruff from 0.5.5 to 0.5.6 (#3501)
Browse files Browse the repository at this point in the history
* Bump ruff from 0.5.5 to 0.5.6

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.5.5 to 0.5.6.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.5.5...0.5.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* 🚨 Ruff v0.5.6 update

* 🏷️ Fix parameterframe typing location

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: james <james.cook1@ukaea.uk>
  • Loading branch information
dependabot[bot] and je-cook committed Sep 9, 2024
1 parent f60dd99 commit 68bff56
Show file tree
Hide file tree
Showing 53 changed files with 223 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
exclude: test_data

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
rev: v0.5.6
hooks:
- id: ruff
args: [--fix]
Expand Down
5 changes: 3 additions & 2 deletions bluemira/balance_of_plant/steady_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
if TYPE_CHECKING:
from collections.abc import Iterable

from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.base.parameter_frame.typed import ParameterFrameLike


CoolantPumpingT = TypeVar("CoolantPumpingT", bound="CoolantPumping")
Expand Down Expand Up @@ -436,7 +436,8 @@ def calculate(*args, **kwargs) -> tuple[float, float, float, float]:
Parasitic loads to power the tritium plant
p_other:
Parasitic loads to power other miscellaneous things
"""
""" # noqa: DOC202
...


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

if TYPE_CHECKING:
from bluemira.base.components import ComponentT
from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.base.parameter_frame.typed import ParameterFrameLike

BuildConfig: TypeAlias = dict[str, Union[int, float, str, "BuildConfig"]]
"""
Expand Down
4 changes: 0 additions & 4 deletions bluemira/base/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,6 @@ def add_child(self, child: Component):
child:
The child to be added
Returns
-------
This component.
Raises
------
ComponentError
Expand Down
2 changes: 1 addition & 1 deletion bluemira/base/designer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from collections.abc import Callable

from bluemira.base.builder import BuildConfig
from bluemira.base.parameter_frame.typing import ParameterFrameLike, ParameterFrameT
from bluemira.base.parameter_frame.typed import ParameterFrameLike, ParameterFrameT

_DesignerReturnT = TypeVar("_DesignerReturnT")

Expand Down
2 changes: 1 addition & 1 deletion bluemira/base/parameter_frame/_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from collections.abc import Generator, Iterable
from types import GenericAlias

from bluemira.base.parameter_frame.typing import ParameterFrameLike, ParameterFrameT
from bluemira.base.parameter_frame.typed import ParameterFrameLike, ParameterFrameT
from bluemira.base.reactor_config import ConfigParams


Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions bluemira/base/reactor_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from collections.abc import Iterable

from bluemira.base.parameter_frame._parameter import ParamDictT
from bluemira.base.parameter_frame.typing import ParameterFrameT
from bluemira.base.parameter_frame.typed import ParameterFrameT


@dataclass
Expand Down Expand Up @@ -329,7 +329,7 @@ def _extract(self, arg_keys: tuple[str], *, is_config: bool = True) -> dict:

for next_idx, current_arg_key in enumerate(arg_keys, start=1):
current_layer = current_layer.get(current_arg_key, {})
next_arg_key = arg_keys[next_idx] if next_idx < len(arg_keys) else None # noqa: PLR1736
next_arg_key = arg_keys[next_idx] if next_idx < len(arg_keys) else None

to_extract = current_layer
if not is_config:
Expand Down
4 changes: 2 additions & 2 deletions bluemira/builders/coil_supports.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

if TYPE_CHECKING:
from bluemira.base.builder import BuildConfig
from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.optimisation.typing import ConstraintT
from bluemira.base.parameter_frame.typed import ParameterFrameLike
from bluemira.optimisation import ConstraintT


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion bluemira/builders/cryostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from bluemira.geometry.tools import make_polygon

if TYPE_CHECKING:
from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.base.parameter_frame.typed import ParameterFrameLike


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion bluemira/builders/divertor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

if TYPE_CHECKING:
from bluemira.base.builder import BuildConfig
from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.base.parameter_frame.typed import ParameterFrameLike
from bluemira.geometry.face import BluemiraFace


Expand Down
2 changes: 1 addition & 1 deletion bluemira/builders/pf_coil.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

if TYPE_CHECKING:
from bluemira.base.builder import BuildConfig
from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.base.parameter_frame.typed import ParameterFrameLike
from bluemira.geometry.wire import BluemiraWire


Expand Down
2 changes: 1 addition & 1 deletion bluemira/builders/plasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

if TYPE_CHECKING:
from bluemira.base.builder import BuildConfig
from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.base.parameter_frame.typed import ParameterFrameLike
from bluemira.geometry.wire import BluemiraWire


Expand Down
2 changes: 1 addition & 1 deletion bluemira/builders/radiation_shield.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

if TYPE_CHECKING:
from bluemira.base.builder import BuildConfig
from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.base.parameter_frame.typed import ParameterFrameLike


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions bluemira/builders/tf_coils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
from bluemira.optimisation import optimise

if TYPE_CHECKING:
from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.geometry.optimisation.typing import GeomConstraintT
from bluemira.base.parameter_frame.typed import ParameterFrameLike
from bluemira.geometry.optimisation import GeomConstraintT
from bluemira.geometry.parameterisations import GeometryParameterisation
from bluemira.geometry.wire import BluemiraWire

Expand Down
2 changes: 1 addition & 1 deletion bluemira/builders/thermal_shield.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

if TYPE_CHECKING:
from bluemira.base.builder import BuildConfig
from bluemira.base.parameter_frame.typing import ParameterFrameLike
from bluemira.base.parameter_frame.typed import ParameterFrameLike
from bluemira.geometry.wire import BluemiraWire


Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion bluemira/codes/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
if TYPE_CHECKING:
from bluemira.base.builder import BuildConfig
from bluemira.base.parameter_frame import Parameter as ParameterFrame
from bluemira.codes._typing import TransportSolver
from bluemira.codes.interface import CodesSolver
from bluemira.codes.params import MappedParameterFrame

Expand Down Expand Up @@ -86,7 +87,7 @@ def transport_code_solver(
params: ParameterFrame,
build_config: BuildConfig,
module: str = "PLASMOD",
) -> CodesSolver:
) -> TransportSolver:
"""
Transport solver
Expand Down
5 changes: 3 additions & 2 deletions bluemira/display/auto_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import functools
import os
import sys
from multiprocessing import Pool, TimeoutError
from multiprocessing import Pool
from multiprocessing import TimeoutError as mpTimeoutError

import numpy as np
import seaborn as sns
Expand Down Expand Up @@ -44,7 +45,7 @@ def get_primary_screen_size(timeout: float = 3):
result = pool.apply_async(_get_primary_screen_size)
try:
val = result.get(timeout=timeout)
except TimeoutError:
except mpTimeoutError:
pool.terminate()
bluemira_warn(
"Unable to get screensize, please check your X server."
Expand Down
3 changes: 2 additions & 1 deletion bluemira/equilibria/optimisation/problem/_breakdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def breakdown_point(self) -> tuple[float, float]:
Radial coordinate of the breakdown point
z_c:
Vertical coordinate of the breakdown point
"""
""" # noqa: DOC202
...

@abc.abstractproperty
def breakdown_radius(self) -> float:
Expand Down
2 changes: 1 addition & 1 deletion bluemira/equilibria/optimisation/problem/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
if TYPE_CHECKING:
from bluemira.equilibria.coils import CoilSet
from bluemira.optimisation._optimiser import OptimiserResult
from bluemira.optimisation.typing import ConstraintT
from bluemira.optimisation.typed import ConstraintT


@dataclass
Expand Down
3 changes: 2 additions & 1 deletion bluemira/equilibria/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def __call__(
Returns
-------
True if the convergence criterion is met, else False.
"""
""" # noqa: DOC202
...

def check_converged(self, value: float) -> bool:
"""
Expand Down
6 changes: 4 additions & 2 deletions bluemira/fuel_cycle/timeline_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ def generate_phase_availabilities(
Returns
-------
Operational availabilities at each operational phase
"""
""" # noqa: DOC202
...


class UniformLearningStrategy(LearningStrategy):
Expand Down Expand Up @@ -351,7 +352,8 @@ def generate_distribution(self, n: int, integral: float) -> np.ndarray:
Returns
-------
The distribution of size n and of the correct integral value
"""
""" # noqa: DOC202
...


class LogNormalAvailabilityStrategy(OperationalAvailabilityStrategy):
Expand Down
27 changes: 24 additions & 3 deletions bluemira/gen_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@
bluemira_warn,
print_banner,
)
from bluemira.base.parameter_frame import ParameterFrame
from bluemira.base.parameter_frame._frame import ParameterFrame
from bluemira.base.parameter_frame._parameter import ParamDictT
from bluemira.utilities.tools import get_module, json_writer


def def_param() -> dict:
def def_param() -> dict[str, str]:
"""
Get the default parameter json skeleton
Returns
-------
the default parameter keys and types
"""
dp = deepcopy(ParamDictT.__annotations__)
del dp["name"]
Expand Down Expand Up @@ -72,6 +76,10 @@ def create_parameterframe(
header: bool
add import header
Returns
-------
Python parameter frame as a string
"""
param_cls = (
"from dataclasses import dataclass\n\n"
Expand All @@ -98,6 +106,10 @@ def create_parameterframe(
def parse_args():
"""
Parse arguments
Returns
-------
parsed argument namespace
"""
parser = argparse.ArgumentParser(
description="Generate ParameterFrame files from module or package"
Expand Down Expand Up @@ -134,6 +146,10 @@ def parse_args():
def get_param_classes(module) -> dict:
"""
Get all ParameterFrame classes
Returns
-------
all found ParameterFrames
"""
return {
f"{m[0]}: {m[1].param_cls.__name__}": m[1].param_cls
Expand All @@ -144,7 +160,12 @@ def get_param_classes(module) -> dict:


def find_modules(path: str) -> set:
"""Recursively get modules from package"""
"""Recursively get modules from package
Returns
-------
all found modules
"""
modules = set()
for pkg in find_packages(path):
if "test" in pkg:
Expand Down
10 changes: 10 additions & 0 deletions bluemira/geometry/optimisation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@

from bluemira.geometry.optimisation._optimise import KeepOutZone, optimise_geometry
from bluemira.geometry.optimisation.problem import GeomOptimisationProblem
from bluemira.geometry.optimisation.typed import (
GeomClsOptimiserCallable,
GeomConstraintT,
GeomOptimiserCallable,
GeomOptimiserObjective,
)

__all__ = [
"GeomClsOptimiserCallable",
"GeomConstraintT",
"GeomOptimisationProblem",
"GeomOptimiserCallable",
"GeomOptimiserObjective",
"KeepOutZone",
"optimise_geometry",
]
2 changes: 1 addition & 1 deletion bluemira/geometry/optimisation/_optimise.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from bluemira.geometry.optimisation import _tools
from bluemira.geometry.optimisation._tools import KeepOutZone
from bluemira.geometry.optimisation.typing import (
from bluemira.geometry.optimisation.typed import (
GeomConstraintT,
GeomOptimiserCallable,
GeomOptimiserObjective,
Expand Down
8 changes: 2 additions & 6 deletions bluemira/geometry/optimisation/_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np

from bluemira.geometry.optimisation.typing import (
from bluemira.geometry.optimisation.typed import (
GeomClsOptimiserCallable,
GeomConstraintT,
GeomOptimiserCallable,
Expand All @@ -16,12 +16,8 @@
from bluemira.geometry.parameterisations import GeometryParameterisation
from bluemira.geometry.tools import signed_distance_2D_polygon
from bluemira.geometry.wire import BluemiraWire
from bluemira.optimisation import ConstraintT, ObjectiveCallable, OptimiserCallable
from bluemira.optimisation.error import GeometryOptimisationError
from bluemira.optimisation.typing import (
ConstraintT,
ObjectiveCallable,
OptimiserCallable,
)


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion bluemira/geometry/optimisation/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
KeepOutZone,
optimise_geometry,
)
from bluemira.geometry.optimisation.typing import GeomConstraintT
from bluemira.geometry.optimisation.typed import GeomConstraintT
from bluemira.geometry.parameterisations import GeometryParameterisation
from bluemira.optimisation._algorithm import Algorithm, AlgorithmType
from bluemira.optimisation.problem import OptimisationProblemBase
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion bluemira/geometry/parameterisations.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ def create_shape(self, label: str = "") -> BluemiraWire:
Returns
-------
CAD Wire of the geometry
"""
""" # noqa: DOC202
...

def to_json(self, file: str):
"""
Expand Down
3 changes: 2 additions & 1 deletion bluemira/magnetostatics/baseclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def field(
Returns
-------
The magnetic field vector {Bx, By, Bz} in [T]
"""
""" # noqa: DOC202
...

@abstractmethod
def plot(self, ax: Axes | None, **kwargs):
Expand Down
Loading

0 comments on commit 68bff56

Please sign in to comment.