Skip to content

Commit fcde9f1

Browse files
committed
remove un-used parameter postfix and fix sonar warnings
1 parent 9b33474 commit fcde9f1

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

hydrolib/tools/ext_old_to_new/main_converter.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def ext_old_to_new(
5353
inifieldfile: PathOrStr = None,
5454
structurefile: PathOrStr = None,
5555
backup: bool = False,
56-
postfix: str = "",
5756
) -> Union[Tuple[ExtOldModel, FileModel, FileModel, FileModel], None]:
5857
"""
5958
Convert old external forcing file to new format files.
@@ -66,7 +65,6 @@ def ext_old_to_new(
6665
structurefile (PathOrStr, optional): Path to the structure file.
6766
backup (bool, optional): Create a backup of each file that will be
6867
overwritten.
69-
postfix (str, optional): Append POSTFIX to the output filenames. Defaults to "".
7068
7169
Returns:
7270
Tuple[ExtOldModel, ExtModel, IniFieldModel, StructureModel]:
@@ -174,12 +172,9 @@ def ext_old_to_new_from_mdu(
174172

175173
workdir = fmmodel._resolved_filepath.parent
176174
os.chdir(workdir)
177-
if fmmodel.external_forcing.extforcefile is None:
178-
if _verbose:
179-
print(
180-
f"mdufile: {mdufile} does not contain an old style external forcing file"
181-
)
182-
return
175+
if fmmodel.external_forcing.extforcefile is None and _verbose:
176+
print(f"mdufile: {mdufile} does not contain an old style external forcing file")
177+
return
183178
# Input file:
184179
extoldfile = fmmodel.external_forcing.extforcefile._resolved_filepath
185180
# Output files:
@@ -201,7 +196,7 @@ def ext_old_to_new_from_mdu(
201196

202197
# The actual conversion:
203198
extold_model, ext_model, inifield_model, structure_model = ext_old_to_new(
204-
extoldfile, extfile, inifieldfile, structurefile, backup, postfix
199+
extoldfile, extfile, inifieldfile, structurefile, backup
205200
)
206201
try:
207202
# And include the new files in the FM model:
@@ -325,9 +320,9 @@ def main(args=None):
325320
args.mdufile, **outfiles, backup=backup, postfix=args.postfix
326321
)
327322
elif args.extoldfile is not None:
328-
ext_old_to_new(args.extoldfile, **outfiles, backup=backup, postfix=args.postfix)
323+
ext_old_to_new(args.extoldfile, **outfiles, backup=backup)
329324
elif args.dir is not None:
330-
ext_old_to_new_dir_recursive(args.dir, backup=backup, postfix=args.postfix)
325+
ext_old_to_new_dir_recursive(args.dir, backup=backup)
331326
else:
332327
print("Error: no input specified. Use one of --mdufile, --extoldfile or --dir.")
333328

0 commit comments

Comments
 (0)