@@ -167,7 +167,7 @@ def variable(
167167def _log_data_availability_errors (dataset ):
168168 """Check if the required input data is available."""
169169 input_files = dataset .files
170- patterns = dataset ._file_globs
170+ patterns = dataset ._file_globs # noqa: SLF001
171171 if not input_files :
172172 logger .error ("No input files found for %s" , dataset )
173173 if patterns :
@@ -436,22 +436,20 @@ def _check_duration_periods(timerange):
436436 try :
437437 isodate .parse_duration (timerange [0 ])
438438 except isodate .isoerror .ISO8601Error as exc :
439- raise RecipeError (
440- "Invalid value encountered for `timerange`. "
441- f"{ timerange [0 ]} is not valid duration according to ISO 8601."
442- + "\n "
443- + str (exc ),
444- ) from exc
439+ msg = (
440+ f"Invalid value encountered for `timerange`. { timerange [0 ]} is "
441+ f"not valid duration according to ISO 8601.\n { exc } "
442+ )
443+ raise RecipeError (msg ) from exc
445444 elif timerange [1 ].startswith ("P" ):
446445 try :
447446 isodate .parse_duration (timerange [1 ])
448447 except isodate .isoerror .ISO8601Error as exc :
449- raise RecipeError (
450- "Invalid value encountered for `timerange`. "
451- f"{ timerange [1 ]} is not valid duration according to ISO 8601."
452- + "\n "
453- + str (exc ),
454- ) from exc
448+ msg = (
449+ f"Invalid value encountered for `timerange`. { timerange [1 ]} is "
450+ f"not valid duration according to ISO 8601.\n { exc } "
451+ )
452+ raise RecipeError (msg ) from exc
455453
456454
457455def _check_format_years (date ):
@@ -475,13 +473,14 @@ def _check_timerange_values(date, timerange):
475473 else :
476474 isodate .parse_date (date )
477475 except isodate .isoerror .ISO8601Error as exc :
478- raise RecipeError (
476+ msg = (
479477 "Invalid value encountered for `timerange`. "
480478 "Valid value must follow ISO 8601 standard "
481479 "for dates and duration periods, or be "
482480 "set to '*' to load available years. "
483- f"Got { timerange } instead." + "\n " + str (exc ),
484- ) from exc
481+ f"Got { timerange } instead.\n { exc } "
482+ )
483+ raise RecipeError (msg ) from exc
485484
486485
487486def valid_time_selection (timerange ):
0 commit comments