From 39e945acef78edfabe8582b312ca8cc5608a09d3 Mon Sep 17 00:00:00 2001 From: james <81617086+je-cook@users.noreply.github.com> Date: Thu, 2 Jul 2026 15:45:20 +0100 Subject: [PATCH 1/2] fix doc102 --- process/core/io/in_dat/base.py | 7 ++- process/core/io/mfile/base.py | 20 +++++--- process/core/io/mfile/comparison.py | 12 ++++- process/core/io/plot/summary.py | 7 +-- process/core/io/vary_run/tools.py | 7 +-- process/core/solver/objectives.py | 2 +- process/models/blankets/blanket_library.py | 4 +- process/models/geometry/shield.py | 2 +- process/models/tfcoil/superconducting.py | 58 +++++----------------- pyproject.toml | 3 +- 10 files changed, 47 insertions(+), 75 deletions(-) diff --git a/process/core/io/in_dat/base.py b/process/core/io/in_dat/base.py index 8ce7e7f737..4a639ae503 100644 --- a/process/core/io/in_dat/base.py +++ b/process/core/io/in_dat/base.py @@ -228,14 +228,13 @@ def get_constraint_equations(data): Parameters ---------- - dict: - data: Data dictionary for the IN.DAT information - data : + data: + Data dictionary for the IN.DAT information Returns ------- - dict + : dict of the constraint numbers and their comments """ constraints = {} diff --git a/process/core/io/mfile/base.py b/process/core/io/mfile/base.py index 59532ed469..b8685c288e 100644 --- a/process/core/io/mfile/base.py +++ b/process/core/io/mfile/base.py @@ -396,6 +396,8 @@ def to_toml( Parameters ---------- + filename: + file name keys_to_write : keys to select scan : @@ -419,12 +421,14 @@ def to_csv( Parameters ---------- - args : string, list of tuples - input filename, variable data - csv_outfile : - - output_data : - (Default value = None) + filename: + file name + keys_to_write : + keys to select + scan : + scan to select + verbose : + verbosity of output """ columns = ( ("Description", "Varname", "Value") if verbose else ("Varname", "Value") @@ -555,8 +559,8 @@ def search_des(dictionary, description): ---------- dictionary : dictionary to search in - variable : - variable name to search for + description : + variable description to search for Returns ------- diff --git a/process/core/io/mfile/comparison.py b/process/core/io/mfile/comparison.py index 9ed37ecae4..95825a1d15 100644 --- a/process/core/io/mfile/comparison.py +++ b/process/core/io/mfile/comparison.py @@ -290,8 +290,16 @@ def compare_mfiles( Parameters ---------- - arg : - List of arguments + files: + file paths + comparison: + comparison type + acc: + percentage tolerance + save: + save flag + verbose: + verbosity flag """ print_counter = 0 n = 2 diff --git a/process/core/io/plot/summary.py b/process/core/io/plot/summary.py index 241adb8c5f..978c53e1e2 100644 --- a/process/core/io/plot/summary.py +++ b/process/core/io/plot/summary.py @@ -4423,11 +4423,10 @@ def read_imprad_data(_skiprows, data_path): Parameters ---------- - skiprows : + _skiprows : number of rows to skip when reading impurity data files data_path : path to impurity data - _skiprows : """ label = [ @@ -9902,8 +9901,6 @@ def plot_cs_coil_structure( MFILE scan : scan number to use - demo_ranges : - whether to use demo ranges for the plot colour_scheme : colour scheme to use for the plot (Default value = 1) @@ -15309,8 +15306,6 @@ def main_plot( Parameters ---------- - figs : - figure object to add plot to m_file : MFILE scan : diff --git a/process/core/io/vary_run/tools.py b/process/core/io/vary_run/tools.py index 3a2e05dbb8..b8503c7ac3 100644 --- a/process/core/io/vary_run/tools.py +++ b/process/core/io/vary_run/tools.py @@ -11,6 +11,7 @@ from process.core.io.data_structure_dicts import get_dicts from process.core.io.in_dat import InDat from process.core.io.mfile import MFile +from process.core.io.vary_run import RunProcessConfig from process.core.model import DataStructure from process.core.solver.iteration_variables import ITERATION_VARIABLES @@ -253,7 +254,7 @@ def no_unfeasible_mfile(wdir=".", mfile="MFILE.DAT"): return 100000 -def vary_iteration_variables(itervars, lbs, ubs, config): +def vary_iteration_variables(itervars, lbs, ubs, config: RunProcessConfig): """Routine to change the iteration variables in the initial IN.DAT within given bounds. @@ -265,8 +266,8 @@ def vary_iteration_variables(itervars, lbs, ubs, config): float list of lower bounds for variables ubs : float list of upper bounds for variables - generator : - Generator numpy generator to create random numbers + config : + vary run configuration """ in_dat = InDat(config.initial_infile) diff --git a/process/core/solver/objectives.py b/process/core/solver/objectives.py index 6045fa7c9f..52fcc96b88 100644 --- a/process/core/solver/objectives.py +++ b/process/core/solver/objectives.py @@ -10,7 +10,7 @@ def objective_function(minmax: int, data: DataStructure) -> float: Parameters ---------- - minimax : int + minmax : int the ID and sign of the figure of merit to evaluate. A negative value indicates maximisation. A positive value indicates minimisation. diff --git a/process/models/blankets/blanket_library.py b/process/models/blankets/blanket_library.py index db1c458f0c..e2b5b95115 100644 --- a/process/models/blankets/blanket_library.py +++ b/process/models/blankets/blanket_library.py @@ -2851,7 +2851,7 @@ def total_pressure_drop( Whether to write output to file. icoolpump : int Switch for coolant type (1=primary He/H2O, 2=secondary PbLi/Li). - flow_velocity : float + vel_coolant : float Coolant flow velocity (m/s). len_pipe : float Total flow length along pipe (m). @@ -3379,7 +3379,7 @@ def coolant_pumping_power( Pump outlet temperature (K). temp_coolant_pump_inlet : float Pump inlet temperature (K). - pressure : float + pres_coolant_pump_inlet : float Outlet (pump inlet) coolant pressure (Pa). dpres_coolant : float Coolant pressure drop (Pa). diff --git a/process/models/geometry/shield.py b/process/models/geometry/shield.py index 7efaaffd4f..f515bebebd 100644 --- a/process/models/geometry/shield.py +++ b/process/models/geometry/shield.py @@ -135,7 +135,7 @@ def shield_geometry_double_null( Parameters ---------- - cumulative_lowe: + cumulative_lower: cumulative vertical thicknesses of components below the midplane radx_far: outboard radius of outer surface of shield diff --git a/process/models/tfcoil/superconducting.py b/process/models/tfcoil/superconducting.py index ce00a7b28a..2761144702 100644 --- a/process/models/tfcoil/superconducting.py +++ b/process/models/tfcoil/superconducting.py @@ -4399,65 +4399,31 @@ def tf_croco_averaged_turn_geometry( Parameters ---------- - j_tf_wp : float + j_tf_wp: Current density in the TF winding pack (in A/m²). - - dx_tf_turn_steel : float + dx_tf_turn_steel: Thickness of the steel layer in the TF turn (in meters). - - dx_tf_turn_insulation : float + dx_tf_turn_insulation: Thickness of the insulation layer in the TF turn (in meters). - - i_tf_sc_mat : int - Identifier for the superconducting material type. - - dx_tf_turn_general : float + dx_tf_turn_general : General dimension of the TF turn (in meters). - - c_tf_turn : float + c_tf_turn: Current per turn in the TF coil (in Amperes). - - i_dx_tf_turn_general_input : bool + i_dx_tf_turn_general_input: Flag indicating if the general turn dimension is provided as input. - - i_dx_tf_turn_cable_space_general_input : bool + i_dx_tf_turn_cable_space_general_input: Flag indicating if the cable space dimension is provided as input. - - dx_tf_turn_cable_space_general : float + dx_tf_turn_cable_space_general: General dimension of the cable space in the TF turn (in meters). - - layer_ins : float + layer_ins: Thickness of the insulation layer in the TF turn (in meters). - - a_tf_wp_no_insulation : float + a_tf_wp_no_insulation: Area of the TF winding pack without insulation (in square meters). - dia_tf_turn_coolant_channel : float - Diameter of the coolant channel in the TF turn (in meters). - - f_a_tf_turn_cable_space_extra_void : float - Fraction of extra void space in the cable space of the TF turn. - Returns ------- - CROCOAveragedTurnGeometry - A dataclass containing the calculated geometry of the TF turn, including: - - a_tf_turn: Area of the TF turn (in square meters). - - dx_tf_turn: Dimension of the TF turn (in meters). - - dr_tf_turn: Dimension of the TF turn (in meters). - - t_conductor: Thickness of the conductor in the TF turn (in meters). - - n_tf_coil_turns: Number of turns in the TF coil (not necessarily - an integer). - - a_tf_turn_insulation: Area of the insulation in the TF turn - (in square meters). - - a_tf_turn_cable_space_no_void: Area of the cable space in the TF turn - without voids (in square meters). - - a_tf_turn_steel: Area of the steel in the TF turn (in square meters). - - a_tf_turn_cable_space_effective: Effective area of the cable space in the - TF turn after accounting for cooling channels and voids (in square meters). - - f_a_tf_turn_cable_space_cooling: Fraction of the cable space used for - cooling. - + : + A dataclass containing the calculated geometry of the TF turn """ # Turn dimension is a an input if i_dx_tf_turn_general_input: diff --git a/pyproject.toml b/pyproject.toml index 1ff12cc836..2c0e2e2353 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,7 +116,7 @@ dependencies = ["pre-commit", "ruff", "ty"] [tool.hatch.envs.lint.scripts] fmt = ["pre-commit run --all-files --hook-stage manual {args:}"] -fmt_extra = ["ruff check --select=E501,C901,PLR0904,PLR0911,PLR0912,PLR0913,PLR0914,PLR0915,PLR0916,PLR0917,PLR1702,D100,D101,D102,D103,DOC501,D404,DOC102,D104,D105,PLC1901,S307 {args:.}"] +fmt_extra = ["ruff check --select=E501,C901,PLR0904,PLR0911,PLR0912,PLR0913,PLR0914,PLR0915,PLR0916,PLR0917,PLR1702,D100,D101,D102,D103,DOC501,D404,D104,D105,PLC1901,S307 {args:.}"] [tool.coverage.report] exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"] @@ -254,7 +254,6 @@ ignore = [ "D103", "DOC501", # docstring-missing-exception "D404", # docstring-starts-with-this - "DOC102", # docstring-extraneous-parameter "D104", # undocumented-public-package "D105", # undocumented-magic-method "PLC1901", # compare-to-empty-string From ffa2dcb8d48ea5ae854734956c918bc79a9e5722 Mon Sep 17 00:00:00 2001 From: james <81617086+je-cook@users.noreply.github.com> Date: Thu, 2 Jul 2026 15:48:52 +0100 Subject: [PATCH 2/2] type checking fix --- process/core/io/vary_run/tools.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/process/core/io/vary_run/tools.py b/process/core/io/vary_run/tools.py index b8503c7ac3..63d94f6a8d 100644 --- a/process/core/io/vary_run/tools.py +++ b/process/core/io/vary_run/tools.py @@ -2,19 +2,24 @@ A selection of functions for using the PROCESS code """ +from __future__ import annotations + import logging import re import sys from pathlib import Path +from typing import TYPE_CHECKING from process.core.input import INPUT_VARIABLES from process.core.io.data_structure_dicts import get_dicts from process.core.io.in_dat import InDat from process.core.io.mfile import MFile -from process.core.io.vary_run import RunProcessConfig -from process.core.model import DataStructure from process.core.solver.iteration_variables import ITERATION_VARIABLES +if TYPE_CHECKING: + from process.core.io.vary_run import RunProcessConfig + from process.core.model import DataStructure + logger = logging.getLogger(__name__)