Skip to content

Commit b9dc705

Browse files
committed
MAINT: small cleanup
1 parent c963e76 commit b9dc705

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

cropclassification/helpers/config_helper.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Module that manages configuration data."""
22

3+
# ruff: noqa: PLW0603
4+
35
import configparser
46
import json
57
import pprint
@@ -106,9 +108,9 @@ def read_config(
106108
overrules = []
107109

108110
# If there are overrules, write them to a temporary configuration file.
109-
global config_overrules # noqa: PLW0603
111+
global config_overrules
110112
config_overrules = overrules
111-
global config_overrules_path # noqa: PLW0603
113+
global config_overrules_path
112114
config_overrules_path = None
113115
if len(config_overrules) > 0:
114116
tmp_dir = Path(tempfile.gettempdir())
@@ -139,7 +141,7 @@ def read_config(
139141
config_paths.append(config_overrules_path)
140142

141143
# Read and parse the config files
142-
global config # noqa: PLW0603
144+
global config
143145
config = configparser.ConfigParser(
144146
interpolation=configparser.ExtendedInterpolation(),
145147
converters={
@@ -198,40 +200,40 @@ def read_config(
198200
tmp_dir=tmp_dir_str
199201
)
200202

201-
global config_paths_used # noqa: PLW0603
203+
global config_paths_used
202204
config_paths_used = config_paths
203205

204206
# Now set global variables to each section as shortcuts
205-
global general # noqa: PLW0603
207+
global general
206208
general = config["general"]
207-
global calc_timeseries_params # noqa: PLW0603
209+
global calc_timeseries_params
208210
calc_timeseries_params = config["calc_timeseries_params"]
209-
global calc_marker_params # noqa: PLW0603
211+
global calc_marker_params
210212
calc_marker_params = config["calc_marker_params"]
211-
global calc_periodic_mosaic_params # noqa: PLW0603
213+
global calc_periodic_mosaic_params
212214
if "calc_periodic_mosaic_params" in config:
213215
calc_periodic_mosaic_params = config["calc_periodic_mosaic_params"]
214216
else:
215217
calc_periodic_mosaic_params = None
216-
global roi # noqa: PLW0603
218+
global roi
217219
roi = config["roi"]
218-
global period # noqa: PLW0603
220+
global period
219221
period = config["period"]
220-
global images # noqa: PLW0603
222+
global images
221223
images = config["images"]
222-
global marker # noqa: PLW0603
224+
global marker
223225
marker = config["marker"]
224-
global timeseries # noqa: PLW0603
226+
global timeseries
225227
timeseries = config["timeseries"]
226-
global preprocess # noqa: PLW0603
228+
global preprocess
227229
preprocess = config["preprocess"]
228-
global classifier # noqa: PLW0603
230+
global classifier
229231
classifier = config["classifier"]
230-
global postprocess # noqa: PLW0603
232+
global postprocess
231233
postprocess = config["postprocess"]
232-
global columns # noqa: PLW0603
234+
global columns
233235
columns = config["columns"]
234-
global paths # noqa: PLW0603
236+
global paths
235237
paths = config["paths"]
236238

237239
# Check some parameters that should be overriden to have a valid config
@@ -242,7 +244,7 @@ def read_config(
242244
raise ValueError("paths.images_periodic_dir must be overridden")
243245

244246
# Load image profiles
245-
global image_profiles # noqa: PLW0603
247+
global image_profiles
246248
image_profiles_config_filepath = paths.getpath("image_profiles_config_filepath")
247249
if image_profiles_config_filepath is not None:
248250
image_profiles = _get_image_profiles(

0 commit comments

Comments
 (0)