From d4e75c051b5b3eaaaabed9ba0aa60fbf2c94e63a Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Tue, 12 Nov 2024 11:22:43 +1300 Subject: [PATCH] Run: ruff check --select ISC001 --fix --- autotest/regression/test_mf6.py | 4 ++-- autotest/regression/test_modflow.py | 9 ++++++--- autotest/test_binarygrid_util.py | 18 +++++++++--------- autotest/test_cbc_full3D.py | 12 ++++++------ autotest/test_grid.py | 6 +++--- autotest/test_gridgen.py | 6 ++---- autotest/test_lake_connections.py | 16 ++++++++-------- autotest/test_model_splitter.py | 2 +- autotest/test_obs.py | 4 ++-- autotest/test_usg.py | 4 +--- flopy/discretization/grid.py | 2 +- flopy/export/utils.py | 4 ++-- flopy/export/vtk.py | 2 +- flopy/mbase.py | 4 ++-- flopy/mf6/coordinates/modelgrid.py | 2 +- flopy/mf6/data/mfdataarray.py | 4 ++-- flopy/mf6/data/mfdatalist.py | 8 +++----- flopy/mf6/data/mfdataplist.py | 6 ++---- flopy/mf6/data/mfdatascalar.py | 4 ++-- flopy/mf6/data/mffileaccess.py | 4 ++-- flopy/mf6/mfmodel.py | 4 +--- flopy/mf6/mfpackage.py | 14 +++++++------- flopy/mf6/mfsimbase.py | 8 +++----- flopy/mf6/modflow/mfgweuze.py | 2 +- flopy/mf6/modflow/mfgwfcsub.py | 6 +++--- flopy/mf6/modflow/mfgwfevt.py | 2 +- flopy/mf6/modflow/mfgwflak.py | 2 +- flopy/mf6/modflow/mfgwfmaw.py | 4 ++-- flopy/mf6/modflow/mfgwfsfr.py | 2 +- flopy/mf6/modflow/mfgwfuzf.py | 2 +- flopy/mf6/modflow/mfgwtuzt.py | 2 +- flopy/mf6/utils/createpackages.py | 18 ++++++++---------- flopy/mf6/utils/mfobservation.py | 2 +- flopy/mf6/utils/model_splitter.py | 6 +++--- flopy/mf6/utils/postprocessing.py | 2 +- flopy/mfusg/mfusgcln.py | 2 +- flopy/mfusg/mfusgsms.py | 4 +--- flopy/modflow/mf.py | 4 ++-- flopy/modflow/mffhb.py | 26 +++++++++----------------- flopy/modflow/mfgage.py | 2 +- flopy/modflow/mfhob.py | 2 +- flopy/modflow/mflak.py | 2 +- flopy/modflow/mfmnw2.py | 2 +- flopy/modflow/mfpks.py | 2 +- flopy/modflow/mfsfr2.py | 14 ++++++-------- flopy/modflow/mfsor.py | 2 +- flopy/modflow/mfstr.py | 2 +- flopy/modflowlgr/mflgr.py | 4 ++-- flopy/modpath/mp7.py | 2 +- flopy/modpath/mp7sim.py | 2 +- flopy/mt3d/mt.py | 6 ++---- flopy/mt3d/mtlkt.py | 8 ++------ flopy/mt3d/mtsft.py | 12 ++++-------- flopy/mt3d/mtssm.py | 4 +--- flopy/pakbase.py | 2 +- flopy/plot/crosssection.py | 2 +- flopy/utils/binaryfile.py | 12 +++++------- flopy/utils/check.py | 2 +- flopy/utils/datafile.py | 4 ++-- flopy/utils/datautil.py | 2 +- flopy/utils/mflistfile.py | 2 +- flopy/utils/modpathfile.py | 4 ++-- flopy/utils/util_array.py | 4 ++-- flopy/utils/zonbud.py | 4 ++-- 64 files changed, 150 insertions(+), 187 deletions(-) diff --git a/autotest/regression/test_mf6.py b/autotest/regression/test_mf6.py index 10605a0c2..f2e62408b 100644 --- a/autotest/regression/test_mf6.py +++ b/autotest/regression/test_mf6.py @@ -2054,7 +2054,7 @@ def test004_create_tests_bcfss(function_tmpdir, example_data_path): ) chk = riv_package.check() summary = ".".join(chk.summary_array.desc) - assert summary == "Invalid non-numeric value 'bad value' in auxiliary " "data." + assert summary == "Invalid non-numeric value 'bad value' in auxiliary data." # test with boundnames riv_package.boundnames = True riv_period_array = [] @@ -2064,7 +2064,7 @@ def test004_create_tests_bcfss(function_tmpdir, example_data_path): riv_package.stress_period_data = riv_period chk = riv_package.check() summary = ".".join(chk.summary_array.desc) - assert summary == "Invalid non-numeric value 'bad value' in auxiliary " "data." + assert summary == "Invalid non-numeric value 'bad value' in auxiliary data." # fix aux variable riv_package.boundnames = False diff --git a/autotest/regression/test_modflow.py b/autotest/regression/test_modflow.py index 3e2a73741..2b15a9399 100644 --- a/autotest/regression/test_modflow.py +++ b/autotest/regression/test_modflow.py @@ -90,9 +90,12 @@ def test_unitnums(function_tmpdir, mf2005_test_path): assert m.load_fail is False, "failed to load all packages" v = (m.nlay, m.nrow, m.ncol, m.nper) - assert v == (1, 7, 100, 50), ( - "modflow-2005 testsfr2_tab does not have " "1 layer, 7 rows, and 100 columns" - ) + assert v == ( + 1, + 7, + 100, + 50, + ), "modflow-2005 testsfr2_tab does not have 1 layer, 7 rows, and 100 columns" success, buff = m.run_model(silent=False) assert success, "base model run did not terminate successfully" diff --git a/autotest/test_binarygrid_util.py b/autotest/test_binarygrid_util.py index ec36eb895..4750c3fef 100644 --- a/autotest/test_binarygrid_util.py +++ b/autotest/test_binarygrid_util.py @@ -54,9 +54,9 @@ def test_mfgrddis_modelgrid(mfgrd_test_path): maxvertex = max([max(sublist[1:]) for sublist in iverts]) assert maxvertex + 1 == nvert, f"nvert ({maxvertex + 1}) does not equal {nvert}" verts = modelgrid.verts - assert nvert == verts.shape[0], ( - f"number of vertex (x, y) pairs ({verts.shape[0]}) " f"does not equal {nvert}" - ) + assert ( + nvert == verts.shape[0] + ), f"number of vertex (x, y) pairs ({verts.shape[0]}) does not equal {nvert}" def test_mfgrddisv_MfGrdFile(mfgrd_test_path): @@ -102,9 +102,9 @@ def test_mfgrddisv_modelgrid(mfgrd_test_path): maxvertex = max([max(sublist[1:]) for sublist in iverts]) assert maxvertex + 1 == nvert, f"nvert ({maxvertex + 1}) does not equal {nvert}" verts = mg.verts - assert nvert == verts.shape[0], ( - f"number of vertex (x, y) pairs ({verts.shape[0]}) " f"does not equal {nvert}" - ) + assert ( + nvert == verts.shape[0] + ), f"number of vertex (x, y) pairs ({verts.shape[0]}) does not equal {nvert}" cellxy = np.column_stack(mg.xyzcellcenters[:2]) errmsg = f"shape of flow.disv centroids {cellxy.shape} not equal to (218, 2)." @@ -156,6 +156,6 @@ def test_mfgrddisu_modelgrid(mfgrd_test_path): maxvertex = max([max(sublist[1:]) for sublist in iverts]) assert maxvertex + 1 == nvert, f"nvert ({maxvertex + 1}) does not equal {nvert}" verts = mg.verts - assert nvert == verts.shape[0], ( - f"number of vertex (x, y) pairs ({verts.shape[0]}) " f"does not equal {nvert}" - ) + assert ( + nvert == verts.shape[0] + ), f"number of vertex (x, y) pairs ({verts.shape[0]}) does not equal {nvert}" diff --git a/autotest/test_cbc_full3D.py b/autotest/test_cbc_full3D.py index f690c36f7..d714b777d 100644 --- a/autotest/test_cbc_full3D.py +++ b/autotest/test_cbc_full3D.py @@ -73,14 +73,14 @@ def load_mf6(path, ws_out): def cbc_eval_size(cbcobj, nnodes, shape3d): cbc_pth = cbcobj.filename - assert cbcobj.nnodes == nnodes, ( - f"{cbc_pth} nnodes ({cbcobj.nnodes}) " f"does not equal {nnodes}" - ) + assert ( + cbcobj.nnodes == nnodes + ), f"{cbc_pth} nnodes ({cbcobj.nnodes}) does not equal {nnodes}" a = np.squeeze(np.ones(cbcobj.shape, dtype=float)) b = np.squeeze(np.ones(shape3d, dtype=float)) - assert a.shape == b.shape, ( - f"{cbc_pth} shape {cbcobj.shape} " f"does not conform to {shape3d}" - ) + assert ( + a.shape == b.shape + ), f"{cbc_pth} shape {cbcobj.shape} does not conform to {shape3d}" def cbc_eval_data(cbcobj, shape3d): diff --git a/autotest/test_grid.py b/autotest/test_grid.py index b54ded007..0cec2fa2c 100644 --- a/autotest/test_grid.py +++ b/autotest/test_grid.py @@ -452,9 +452,9 @@ def test_structured_from_gridspec(example_data_path, spc_file): maxvertex = max([max(sublist[1:]) for sublist in iverts]) assert maxvertex + 1 == nvert, f"nvert ({maxvertex + 1}) does not equal {nvert}" verts = modelgrid.verts - assert nvert == verts.shape[0], ( - f"number of vertex (x, y) pairs ({verts.shape[0]}) " f"does not equal {nvert}" - ) + assert ( + nvert == verts.shape[0] + ), f"number of vertex (x, y) pairs ({verts.shape[0]}) does not equal {nvert}" @requires_pkg("shapely") diff --git a/autotest/test_gridgen.py b/autotest/test_gridgen.py index 9412f4fe5..fbd7d8ad7 100644 --- a/autotest/test_gridgen.py +++ b/autotest/test_gridgen.py @@ -777,10 +777,8 @@ def test_gridgen(function_tmpdir): 455, 384, ] - msg = ( - "gridgen line intersect did not identify the correct " "cells {} <> {}".format( - nlist, nlist2 - ) + msg = "gridgen line intersect did not identify the correct cells {} <> {}".format( + nlist, nlist2 ) assert nlist == nlist2, msg diff --git a/autotest/test_lake_connections.py b/autotest/test_lake_connections.py index 5afba3153..fc63833f5 100644 --- a/autotest/test_lake_connections.py +++ b/autotest/test_lake_connections.py @@ -260,10 +260,10 @@ def test_lake(function_tmpdir, example_data_path): pakdata_dict[0] == 54 ), f"number of lake connections ({pakdata_dict[0]}) not equal to 54." - assert len(connectiondata) == 54, ( - "number of lake connectiondata entries ({}) not equal " "to 54.".format( - len(connectiondata) - ) + assert ( + len(connectiondata) == 54 + ), "number of lake connectiondata entries ({}) not equal to 54.".format( + len(connectiondata) ) lak_pak_data = [] @@ -461,10 +461,10 @@ def test_embedded_lak_ex01(function_tmpdir, example_data_path): pakdata_dict[0] == 57 ), f"number of lake connections ({pakdata_dict[0]}) not equal to 57." - assert len(connectiondata) == 57, ( - "number of lake connectiondata entries ({}) not equal " "to 57.".format( - len(connectiondata) - ) + assert ( + len(connectiondata) == 57 + ), "number of lake connectiondata entries ({}) not equal to 57.".format( + len(connectiondata) ) lak_pak_data = [] diff --git a/autotest/test_model_splitter.py b/autotest/test_model_splitter.py index 8bafbf362..dc19a45e5 100644 --- a/autotest/test_model_splitter.py +++ b/autotest/test_model_splitter.py @@ -1285,7 +1285,7 @@ def build_gwt_model(sim, gwtname, rch_package): X_split = mfs.reconstruct_array(array_dict) - err_msg = f"Outputs from {name} and split model " f"are not within tolerance" + err_msg = f"Outputs from {name} and split model are not within tolerance" X_split[idomain == 0] = np.nan X[idomain == 0] = np.nan if name == "gwf": diff --git a/autotest/test_obs.py b/autotest/test_obs.py index 0c7595162..b2fb79ad7 100644 --- a/autotest/test_obs.py +++ b/autotest/test_obs.py @@ -413,10 +413,10 @@ def test_multilayerhob_pr_multiline(): problem_hob = [ "2 4 7", "1 1", - "A19E1_1 -2 140 91 1 1 -0.28321 -0.05389" " 69 1 1 1 # A19E1 8/13/1975", + "A19E1_1 -2 140 91 1 1 -0.28321 -0.05389 69 1 1 1 # A19E1 8/13/1975", "3 0.954", "4 0.046", - "A19E1_2 -2 140 91 1 1 -0.28321 -0.05389" " 72 1 1 1 # A19E1 10/9/1975", + "A19E1_2 -2 140 91 1 1 -0.28321 -0.05389 72 1 1 1 # A19E1 10/9/1975", "3 0.954", "4 0.046", ] diff --git a/autotest/test_usg.py b/autotest/test_usg.py index 82aa61f4d..33817d220 100644 --- a/autotest/test_usg.py +++ b/autotest/test_usg.py @@ -136,9 +136,7 @@ def test_usg_model(function_tmpdir): @requires_exe("mfusg") def test_usg_load_01B(function_tmpdir, mfusg_01A_nestedgrid_nognc_model_path): - print( - "testing 1-layer unstructured mfusg model " "loading: 01A_nestedgrid_nognc.nam" - ) + print("testing 1-layer unstructured mfusg model loading: 01A_nestedgrid_nognc.nam") fname = mfusg_01A_nestedgrid_nognc_model_path / "flow.nam" assert os.path.isfile(fname), f"nam file not found {fname}" diff --git a/flopy/discretization/grid.py b/flopy/discretization/grid.py index e8239fa27..ea98aae80 100644 --- a/flopy/discretization/grid.py +++ b/flopy/discretization/grid.py @@ -561,7 +561,7 @@ def zcellcenters(self): @property def xyzcellcenters(self): raise NotImplementedError( - "must define get_cellcenters in child " "class to use this base class" + "must define get_cellcenters in child class to use this base class" ) @property diff --git a/flopy/export/utils.py b/flopy/export/utils.py index 195c4a025..9aef5ff98 100644 --- a/flopy/export/utils.py +++ b/flopy/export/utils.py @@ -858,7 +858,7 @@ def mflist_export(f: Union[str, os.PathLike, NetCdf], mfl, **kwargs): """ if not isinstance(mfl, (DataListInterface, DataInterface)): - err = "mflist_helper only helps instances that support " "DataListInterface" + err = "mflist_helper only helps instances that support DataListInterface" raise AssertionError(err) modelgrid = mfl.model.modelgrid @@ -1007,7 +1007,7 @@ def transient2d_export(f: Union[str, os.PathLike], t2d, fmt=None, **kwargs): """ if not isinstance(t2d, DataInterface): - err = "transient2d_helper only helps instances that support " "DataInterface" + err = "transient2d_helper only helps instances that support DataInterface" raise AssertionError(err) min_valid = kwargs.get("min_valid", -1.0e9) diff --git a/flopy/export/vtk.py b/flopy/export/vtk.py index 71d638699..579a2990c 100644 --- a/flopy/export/vtk.py +++ b/flopy/export/vtk.py @@ -1272,7 +1272,7 @@ def add_cell_budget(self, cbc, text=None, kstpkper=None, masked_values=None): if array.size < self.nnodes: if array.size < self.ncpl: raise AssertionError( - "Array size must be equal to " "either ncpl or nnodes" + "Array size must be equal to either ncpl or nnodes" ) array = np.zeros(self.nnodes) * np.nan diff --git a/flopy/mbase.py b/flopy/mbase.py index 840e6de16..f0bfbdaac 100644 --- a/flopy/mbase.py +++ b/flopy/mbase.py @@ -973,7 +973,7 @@ def set_output_attribute( break else: raise TypeError( - "either fname or unit must be passed " "to set_output_attribute()" + "either fname or unit must be passed to set_output_attribute()" ) if attr is not None: if idx is not None: @@ -1016,7 +1016,7 @@ def get_output_attribute( break else: raise TypeError( - "either fname or unit must be passed " "to set_output_attribute()" + "either fname or unit must be passed to set_output_attribute()" ) v = None if attr is not None: diff --git a/flopy/mf6/coordinates/modelgrid.py b/flopy/mf6/coordinates/modelgrid.py index e12f114f7..6a027d2d0 100644 --- a/flopy/mf6/coordinates/modelgrid.py +++ b/flopy/mf6/coordinates/modelgrid.py @@ -484,7 +484,7 @@ def get_idomain(self): return self._simulation_data.mfdata[ (self._model_name, "disv2d", "griddata", "idomain") ].get_data() - except_str = "ERROR: Grid type {} for model {} not " "recognized.".format( + except_str = "ERROR: Grid type {} for model {} not recognized.".format( self._grid_type, self._model_name ) print(except_str) diff --git a/flopy/mf6/data/mfdataarray.py b/flopy/mf6/data/mfdataarray.py index 39c588754..b35f1df23 100644 --- a/flopy/mf6/data/mfdataarray.py +++ b/flopy/mf6/data/mfdataarray.py @@ -535,7 +535,7 @@ def store_as_external_file( >= VerbosityLevel.verbose.value ): print( - "Storing {} layer {} to external file {}.." ".".format( + "Storing {} layer {} to external file {}...".format( self.structure.name, current_layer[0] + 1, file_path, @@ -622,7 +622,7 @@ def store_internal( >= VerbosityLevel.verbose.value ): print( - "Storing {} layer {} internally.." ".".format( + "Storing {} layer {} internally...".format( self.structure.name, current_layer[0] + 1, ) diff --git a/flopy/mf6/data/mfdatalist.py b/flopy/mf6/data/mfdatalist.py index 14c3e6dc3..d683f3a71 100644 --- a/flopy/mf6/data/mfdatalist.py +++ b/flopy/mf6/data/mfdatalist.py @@ -219,7 +219,7 @@ def store_as_external_file( >= VerbosityLevel.verbose.value ): print( - "Storing {} to external file {}.." ".".format( + "Storing {} to external file {}...".format( self.structure.name, external_file_path ) ) @@ -1167,7 +1167,7 @@ def _get_file_entry_record( self.structure.get_model(), self.structure.get_package(), self._path, - "converting data " "to a string", + "converting data to a string", self.structure.name, inspect.stack()[0][3], type_, @@ -1809,9 +1809,7 @@ def _set_data_record( super().set_data(data, autofill) else: if is_record: - comment = ( - "Set record method requires that data_record is a " "dictionary." - ) + comment = "Set record method requires that data_record is a dictionary." type_, value_, traceback_ = sys.exc_info() raise MFDataException( self.structure.get_model(), diff --git a/flopy/mf6/data/mfdataplist.py b/flopy/mf6/data/mfdataplist.py index d34bff98b..7fbea2c53 100644 --- a/flopy/mf6/data/mfdataplist.py +++ b/flopy/mf6/data/mfdataplist.py @@ -1047,7 +1047,7 @@ def store_as_external_file( >= VerbosityLevel.verbose.value ): print( - "Storing {} to external file {}.." ".".format( + "Storing {} to external file {}...".format( self.structure.name, external_file_path ) ) @@ -2271,9 +2271,7 @@ def _set_data_record( super().set_data(data_record, autofill) else: if is_record: - comment = ( - "Set record method requires that data_record is a " "dictionary." - ) + comment = "Set record method requires that data_record is a dictionary." type_, value_, traceback_ = sys.exc_info() raise MFDataException( self.structure.get_model(), diff --git a/flopy/mf6/data/mfdatascalar.py b/flopy/mf6/data/mfdatascalar.py index 73b1a323e..ec503e6cb 100644 --- a/flopy/mf6/data/mfdatascalar.py +++ b/flopy/mf6/data/mfdatascalar.py @@ -194,7 +194,7 @@ def set_data(self, data): except Exception as ex: type_, value_, traceback_ = sys.exc_info() comment = ( - f'Could not convert data "{data}" to type ' f'"{self._data_type}".' + f'Could not convert data "{data}" to type "{self._data_type}".' ) raise MFDataException( self.structure.get_model(), @@ -293,7 +293,7 @@ def add_one(self): ex, ) else: - message = "{} of type {} does not support add one " "operation.".format( + message = "{} of type {} does not support add one operation.".format( self._data_name, self.structure.get_datum_type() ) type_, value_, traceback_ = sys.exc_info() diff --git a/flopy/mf6/data/mffileaccess.py b/flopy/mf6/data/mffileaccess.py index 04d3ee498..5779da0ca 100644 --- a/flopy/mf6/data/mffileaccess.py +++ b/flopy/mf6/data/mffileaccess.py @@ -35,7 +35,7 @@ def _get_next_data_line(self, file_handle): while not end_of_file: line = file_handle.readline() if line == "": - message = "More data expected when reading {} from file " "{}".format( + message = "More data expected when reading {} from file {}".format( self.structure.name, file_handle.name ) type_, value_, traceback_ = sys.exc_info() @@ -1656,7 +1656,7 @@ def load_list_line( struct.get_model(), struct.get_package(), struct.path, - "loading data list from " "package file", + "loading data list from package file", struct.name, inspect.stack()[0][3], type_, diff --git a/flopy/mf6/mfmodel.py b/flopy/mf6/mfmodel.py index 1d3b7217e..8bb957ec5 100644 --- a/flopy/mf6/mfmodel.py +++ b/flopy/mf6/mfmodel.py @@ -1164,9 +1164,7 @@ def inspect_cells( fd.write(f"Results from {package_name}\n") for search_output in matches: # write header line with data name - fd.write( - f",Results from " f"{search_output.path_to_data[-1]}\n" - ) + fd.write(f",Results from {search_output.path_to_data[-1]}\n") # write data header if search_output.transient: if search_output.output: diff --git a/flopy/mf6/mfpackage.py b/flopy/mf6/mfpackage.py index 44d5688a5..28a6a1416 100644 --- a/flopy/mf6/mfpackage.py +++ b/flopy/mf6/mfpackage.py @@ -291,7 +291,7 @@ def get_transient_key(self, data_path=None): ): if key_index is None: raise FlopyException( - "Block header index could " "not be determined." + "Block header index could not be determined." ) else: raise FlopyException( @@ -1139,7 +1139,7 @@ def _get_package_info(self, dataset): # package package_types = [ package_type, - f"{self._container_package.package_type}" f"{package_type}", + f"{self._container_package.package_type}{package_type}", ] package_type_found = None for ptype in package_types: @@ -1441,7 +1441,7 @@ def _write_block(self, fd, block_header, ext_file_action): >= VerbosityLevel.verbose.value ): print( - " writing data {} ({}).." ".".format( + " writing data {} ({})...".format( dataset.structure.name, transient_key ) ) @@ -2197,13 +2197,13 @@ def _get_data_str(self, formal, show_data=True): if formal: bl_repr = repr(block) if len(bl_repr.strip()) > 0: - data_str = "{}Block {}\n--------------------\n{}" "\n".format( + data_str = "{}Block {}\n--------------------\n{}\n".format( data_str, block.structure.name, repr(block) ) else: bl_str = str(block) if len(bl_str.strip()) > 0: - data_str = "{}Block {}\n--------------------\n{}" "\n".format( + data_str = "{}Block {}\n--------------------\n{}\n".format( data_str, block.structure.name, str(block) ) return data_str @@ -2668,7 +2668,7 @@ def build_mfdata(self, var_name, data=None): self._data_list.append(ds) return ds - message = 'Unable to find variable "{}" in package ' '"{}".'.format( + message = 'Unable to find variable "{}" in package "{}".'.format( var_name, self.package_type ) type_, value_, traceback_ = sys.exc_info() @@ -3016,7 +3016,7 @@ def write(self, ext_file_action=ExtFileAction.copy_relative_paths): # write flopy header if self.simulation_data.write_headers: dt = datetime.datetime.now() - header = "# File generated by Flopy version {} on {} at {}." "\n".format( + header = "# File generated by Flopy version {} on {} at {}.\n".format( __version__, dt.strftime("%m/%d/%Y"), dt.strftime("%H:%M:%S"), diff --git a/flopy/mf6/mfsimbase.py b/flopy/mf6/mfsimbase.py index f9ade6f0e..6dc926341 100644 --- a/flopy/mf6/mfsimbase.py +++ b/flopy/mf6/mfsimbase.py @@ -625,7 +625,7 @@ def __str__(self): def _get_data_str(self, formal): file_mgt = self.simulation_data.mfpath - data_str = "sim_name = {}\nsim_path = {}\nexe_name = " "{}\n" "\n".format( + data_str = "sim_name = {}\nsim_path = {}\nexe_name = {}\n\n".format( self.name, file_mgt.get_sim_path(), self.exe_name ) @@ -1044,9 +1044,7 @@ def load( ) if verbosity_level.value >= VerbosityLevel.normal.value: - print( - f" loading solution package " f"{sln_package._get_pname()}..." - ) + print(f" loading solution package {sln_package._get_pname()}...") sln_package.load(strict) instance.simulation_data.mfpath.set_last_accessed_path() @@ -1684,7 +1682,7 @@ def write_simulation( self.simulation_data.verbosity_level.value >= VerbosityLevel.normal.value ): - print(f" writing solution package " f"{solution_file._get_pname()}...") + print(f" writing solution package {solution_file._get_pname()}...") solution_file.write(ext_file_action=ext_file_action) # write exchange files diff --git a/flopy/mf6/modflow/mfgweuze.py b/flopy/mf6/modflow/mfgweuze.py index 04f11d3d1..e5e6ade93 100644 --- a/flopy/mf6/modflow/mfgweuze.py +++ b/flopy/mf6/modflow/mfgweuze.py @@ -520,7 +520,7 @@ class ModflowGweuze(mfpackage.MFPackage): [ "block period", "name uzesetting", - "type keystring status temperature infiltration uzet " "auxiliaryrecord", + "type keystring status temperature infiltration uzet auxiliaryrecord", "shape", "tagged false", "in_record true", diff --git a/flopy/mf6/modflow/mfgwfcsub.py b/flopy/mf6/modflow/mfgwfcsub.py index 4c343e6f6..2a2974684 100644 --- a/flopy/mf6/modflow/mfgwfcsub.py +++ b/flopy/mf6/modflow/mfgwfcsub.py @@ -553,7 +553,7 @@ class ModflowGwfcsub(mfpackage.MFPackage): [ "block options", "name compaction_inelastic_filerecord", - "type record compaction_inelastic fileout " "inelastic_compaction_filename", + "type record compaction_inelastic fileout inelastic_compaction_filename", "shape", "reader urword", "tagged true", @@ -582,7 +582,7 @@ class ModflowGwfcsub(mfpackage.MFPackage): [ "block options", "name compaction_interbed_filerecord", - "type record compaction_interbed fileout " "interbed_compaction_filename", + "type record compaction_interbed fileout interbed_compaction_filename", "shape", "reader urword", "tagged true", @@ -669,7 +669,7 @@ class ModflowGwfcsub(mfpackage.MFPackage): [ "block options", "name package_convergence_filerecord", - "type record package_convergence fileout " "package_convergence_filename", + "type record package_convergence fileout package_convergence_filename", "shape", "reader urword", "tagged true", diff --git a/flopy/mf6/modflow/mfgwfevt.py b/flopy/mf6/modflow/mfgwfevt.py index 71dcaafc4..41f0b030c 100644 --- a/flopy/mf6/modflow/mfgwfevt.py +++ b/flopy/mf6/modflow/mfgwfevt.py @@ -324,7 +324,7 @@ class ModflowGwfevt(mfpackage.MFPackage): [ "block period", "name stress_period_data", - "type recarray cellid surface rate depth pxdp petm petm0 aux " "boundname", + "type recarray cellid surface rate depth pxdp petm petm0 aux boundname", "shape (maxbound)", "reader urword", "mf6internal spd", diff --git a/flopy/mf6/modflow/mfgwflak.py b/flopy/mf6/modflow/mfgwflak.py index 450635240..c72e6a9dc 100644 --- a/flopy/mf6/modflow/mfgwflak.py +++ b/flopy/mf6/modflow/mfgwflak.py @@ -611,7 +611,7 @@ class ModflowGwflak(mfpackage.MFPackage): [ "block options", "name package_convergence_filerecord", - "type record package_convergence fileout " "package_convergence_filename", + "type record package_convergence fileout package_convergence_filename", "shape", "reader urword", "tagged true", diff --git a/flopy/mf6/modflow/mfgwfmaw.py b/flopy/mf6/modflow/mfgwfmaw.py index 816c20bb8..e1077f986 100644 --- a/flopy/mf6/modflow/mfgwfmaw.py +++ b/flopy/mf6/modflow/mfgwfmaw.py @@ -691,7 +691,7 @@ class ModflowGwfmaw(mfpackage.MFPackage): [ "block packagedata", "name packagedata", - "type recarray ifno radius bottom strt condeqn ngwfnodes aux " "boundname", + "type recarray ifno radius bottom strt condeqn ngwfnodes aux boundname", "shape (nmawwells)", "reader urword", ], @@ -774,7 +774,7 @@ class ModflowGwfmaw(mfpackage.MFPackage): [ "block connectiondata", "name connectiondata", - "type recarray ifno icon cellid scrn_top scrn_bot hk_skin " "radius_skin", + "type recarray ifno icon cellid scrn_top scrn_bot hk_skin radius_skin", "reader urword", ], [ diff --git a/flopy/mf6/modflow/mfgwfsfr.py b/flopy/mf6/modflow/mfgwfsfr.py index 873f21fc2..ec142824f 100644 --- a/flopy/mf6/modflow/mfgwfsfr.py +++ b/flopy/mf6/modflow/mfgwfsfr.py @@ -629,7 +629,7 @@ class ModflowGwfsfr(mfpackage.MFPackage): [ "block options", "name package_convergence_filerecord", - "type record package_convergence fileout " "package_convergence_filename", + "type record package_convergence fileout package_convergence_filename", "shape", "reader urword", "tagged true", diff --git a/flopy/mf6/modflow/mfgwfuzf.py b/flopy/mf6/modflow/mfgwfuzf.py index fce61e4b9..ae2456e7f 100644 --- a/flopy/mf6/modflow/mfgwfuzf.py +++ b/flopy/mf6/modflow/mfgwfuzf.py @@ -438,7 +438,7 @@ class ModflowGwfuzf(mfpackage.MFPackage): [ "block options", "name package_convergence_filerecord", - "type record package_convergence fileout " "package_convergence_filename", + "type record package_convergence fileout package_convergence_filename", "shape", "reader urword", "tagged true", diff --git a/flopy/mf6/modflow/mfgwtuzt.py b/flopy/mf6/modflow/mfgwtuzt.py index 6870936ff..c1df4d8d7 100644 --- a/flopy/mf6/modflow/mfgwtuzt.py +++ b/flopy/mf6/modflow/mfgwtuzt.py @@ -521,7 +521,7 @@ class ModflowGwtuzt(mfpackage.MFPackage): [ "block period", "name uztsetting", - "type keystring status concentration infiltration uzet " "auxiliaryrecord", + "type keystring status concentration infiltration uzet auxiliaryrecord", "shape", "tagged false", "in_record true", diff --git a/flopy/mf6/utils/createpackages.py b/flopy/mf6/utils/createpackages.py index da1218096..727346c0a 100644 --- a/flopy/mf6/utils/createpackages.py +++ b/flopy/mf6/utils/createpackages.py @@ -154,7 +154,7 @@ def build_dfn_string(dfn_list, header, package_abbr, flopy_dict): if key == "multi-package": dfn_string = f'{dfn_string}\n{leading_spaces} "multi-package", ' if key == "package-type": - dfn_string = f'{dfn_string}\n{leading_spaces} "package-type ' f'{value}"' + dfn_string = f'{dfn_string}\n{leading_spaces} "package-type {value}"' # process solution packages if package_abbr in flopy_dict["solution_packages"]: @@ -655,7 +655,7 @@ def create_packages(): build_doc_string( "exgmnamea", "", - "is the name of the first model that is " "part of this exchange.", + "is the name of the first model that is part of this exchange.", indent, ), None, @@ -676,7 +676,7 @@ def create_packages(): build_doc_string( "exgmnameb", "", - "is the name of the second model that is " "part of this exchange.", + "is the name of the second model that is part of this exchange.", indent, ), None, @@ -860,7 +860,7 @@ def create_packages(): ) # write out child packages class - chld_cls = "\n\nclass {}Packages(mfpackage.MFChildPackage" "s):\n".format( + chld_cls = "\n\nclass {}Packages(mfpackage.MFChildPackages):\n".format( package_name.title() ) chld_var = ( @@ -1006,17 +1006,15 @@ def create_packages(): options_param_list.insert(0, "use_pandas=True") options_param_list.insert(0, "write_headers=True") options_param_list.insert(0, "verbosity_level=1") - options_param_list.insert( - 0, "sim_ws: Union[str, os.PathLike] = " "os.curdir" - ) + options_param_list.insert(0, "sim_ws: Union[str, os.PathLike] = os.curdir") options_param_list.insert(0, "exe_name: Union[str, os.PathLike] " '= "mf6"') options_param_list.insert(0, "version='mf6'") options_param_list.insert(0, "sim_name='sim'") init_string_sim = " def __init__(self" init_string_sim = build_init_string(init_string_sim, options_param_list) - class_def_string = "class MFSimulation(mfsimbase." "MFSimulationBase):\n" + class_def_string = "class MFSimulation(mfsimbase.MFSimulationBase):\n" doc_string.add_parameter( - " sim_name : str\n" " Name of the simulation", + " sim_name : str\n Name of the simulation", beginning_of_list=True, model_parameter=True, ) @@ -1049,7 +1047,7 @@ def create_packages(): ) ) sim_import_string = ( - "import os\n" "from typing import Union\n" "from .. import mfsimbase" + "import os\nfrom typing import Union\nfrom .. import mfsimbase" ) load_txt, doc_text = build_sim_load() diff --git a/flopy/mf6/utils/mfobservation.py b/flopy/mf6/utils/mfobservation.py index 9dac0771b..1f3537748 100644 --- a/flopy/mf6/utils/mfobservation.py +++ b/flopy/mf6/utils/mfobservation.py @@ -455,7 +455,7 @@ def _check_for_observations(self): else: raise KeyError( - "There are no observation files associated " "with this project" + "There are no observation files associated with this project" ) def _get_obsfile_names(self, partial_key, OBS8, obstype): diff --git a/flopy/mf6/utils/model_splitter.py b/flopy/mf6/utils/model_splitter.py index 4af279e03..299711da8 100644 --- a/flopy/mf6/utils/model_splitter.py +++ b/flopy/mf6/utils/model_splitter.py @@ -349,7 +349,7 @@ def optimize_splitting_mask(self, nparts): """ pymetis = import_optional_dependency( "pymetis", - "please install pymetis using: " "conda install -c conda-forge pymetis", + "please install pymetis using: conda install -c conda-forge pymetis", ) # create graph of nodes graph = [] @@ -3210,7 +3210,7 @@ def split_model(self, array): """ if not self._allow_splitting: raise AssertionError( - "Mf6Splitter cannot split a model that " "is part of a split simulation" + "Mf6Splitter cannot split a model that is part of a split simulation" ) # set number formatting string for file paths @@ -3269,7 +3269,7 @@ def split_multi_model(self, array): """ if not self._allow_splitting: raise AssertionError( - "Mf6Splitter cannot split a model that " "is part of a split simulation" + "Mf6Splitter cannot split a model that is part of a split simulation" ) # set number formatting string for file paths diff --git a/flopy/mf6/utils/postprocessing.py b/flopy/mf6/utils/postprocessing.py index 50835a091..71cbecad6 100644 --- a/flopy/mf6/utils/postprocessing.py +++ b/flopy/mf6/utils/postprocessing.py @@ -52,7 +52,7 @@ def get_structured_faceflows( grb = MfGrdFile(grb_file, verbose=verbose) if grb.grid_type != "DIS": raise ValueError( - "get_structured_faceflows method " "is only for structured DIS grids" + "get_structured_faceflows method is only for structured DIS grids" ) ia, ja = grb.ia, grb.ja nlay, nrow, ncol = grb.nlay, grb.nrow, grb.ncol diff --git a/flopy/mfusg/mfusgcln.py b/flopy/mfusg/mfusgcln.py index bbc2612d8..e88b8f312 100644 --- a/flopy/mfusg/mfusgcln.py +++ b/flopy/mfusg/mfusgcln.py @@ -337,7 +337,7 @@ def _define_cln_networks(self, model): if self.ncln > 0: # Linear CLN segments if self.nndcln is None: raise Exception( - "mfcln: number of nodes for each CLN segment must be " "provided" + "mfcln: number of nodes for each CLN segment must be provided" ) self.nndcln = Util2d( model, diff --git a/flopy/mfusg/mfusgsms.py b/flopy/mfusg/mfusgsms.py index cebf9cab4..afd00d11c 100644 --- a/flopy/mfusg/mfusgsms.py +++ b/flopy/mfusg/mfusgsms.py @@ -463,9 +463,7 @@ def load(cls, f, model, ext_unit_dict=None): # Record 1b -- line will have already been read if model.verbose: - print( - " loading HCLOSE HICLOSE MXITER ITER1 " "IPRSMS NONLINMETH LINMETH..." - ) + print(" loading HCLOSE HICLOSE MXITER ITER1 IPRSMS NONLINMETH LINMETH...") ll = line_parse(line) hclose = float(ll.pop(0)) hiclose = float(ll.pop(0)) diff --git a/flopy/modflow/mf.py b/flopy/modflow/mf.py index cd4f2f91e..f4c3836e8 100644 --- a/flopy/modflow/mf.py +++ b/flopy/modflow/mf.py @@ -228,7 +228,7 @@ def __init__( def __repr__(self): nrow, ncol, nlay, nper = self.get_nrow_ncol_nlay_nper() # structured case - s = "MODFLOW {} layer(s) {} row(s) {} column(s) " "{} stress period(s)".format( + s = "MODFLOW {} layer(s) {} row(s) {} column(s) {} stress period(s)".format( nlay, nrow, ncol, nper ) return s @@ -287,7 +287,7 @@ def modelgrid(self): ja=self.disu.ja.array, **common_kwargs, ) - print("WARNING: Model grid functionality limited for unstructured " "grid.") + print("WARNING: Model grid functionality limited for unstructured grid.") else: # build structured grid self._modelgrid = StructuredGrid( diff --git a/flopy/modflow/mffhb.py b/flopy/modflow/mffhb.py index 5bc07c60c..259caa8ba 100644 --- a/flopy/modflow/mffhb.py +++ b/flopy/modflow/mffhb.py @@ -237,7 +237,7 @@ def __init__( # perform some simple verification if len(self.bdtime) != self.nbdtim: raise ValueError( - "bdtime has {} entries but requires " "{} entries.".format( + "bdtime has {} entries but requires {} entries.".format( len(self.bdtime), self.nbdtim ) ) @@ -250,7 +250,7 @@ def __init__( if self.ds5.shape[0] != self.nflw: raise ValueError( - "dataset 5 has {} rows but requires " "{} rows.".format( + "dataset 5 has {} rows but requires {} rows.".format( self.ds5.shape[0], self.nflw ) ) @@ -261,7 +261,7 @@ def __init__( nc += 2 if len(self.ds5.dtype.names) != nc: raise ValueError( - "dataset 5 has {} columns but requires " "{} columns.".format( + "dataset 5 has {} columns but requires {} columns.".format( len(self.ds5.dtype.names), nc ) ) @@ -273,7 +273,7 @@ def __init__( ) if self.ds7.shape[0] != self.nhed: raise ValueError( - "dataset 7 has {} rows but requires " "{} rows.".format( + "dataset 7 has {} rows but requires {} rows.".format( self.ds7.shape[0], self.nhed ) ) @@ -284,7 +284,7 @@ def __init__( nc += 2 if len(self.ds7.dtype.names) != nc: raise ValueError( - "dataset 7 has {} columns but requires " "{} columns.".format( + "dataset 7 has {} columns but requires {} columns.".format( len(self.ds7.dtype.names), nc ) ) @@ -572,9 +572,7 @@ def load(cls, f, model, nper=None, ext_unit_dict=None): for naux in range(nfhbx1): if model.verbose: print(f"loading fhb dataset 6a - aux {naux + 1}") - print( - "dataset 6a will not be preserved in " "the created fhb object." - ) + print("dataset 6a will not be preserved in the created fhb object.") # Dataset 6a IFHBUN CNSTM IFHBPT line = f.readline() raw = line.strip().split() @@ -590,9 +588,7 @@ def load(cls, f, model, nper=None, ext_unit_dict=None): if model.verbose: print(f"loading fhb dataset 6b - aux {naux + 1}") - print( - "dataset 6b will not be preserved in " "the created fhb object." - ) + print("dataset 6b will not be preserved in the created fhb object.") current = np.recarray(nflw, dtype=dtype) for n in range(nflw): ds6b = read1d(f, np.zeros((nbdtim,))) @@ -647,9 +643,7 @@ def load(cls, f, model, nper=None, ext_unit_dict=None): for naux in range(nfhbx1): if model.verbose: print(f"loading fhb dataset 8a - aux {naux + 1}") - print( - "dataset 8a will not be preserved in " "the created fhb object." - ) + print("dataset 8a will not be preserved in the created fhb object.") # Dataset 6a IFHBUN CNSTM IFHBPT line = f.readline() raw = line.strip().split() @@ -666,9 +660,7 @@ def load(cls, f, model, nper=None, ext_unit_dict=None): if model.verbose: print(f"loading fhb dataset 8b - aux {naux + 1}") - print( - "dataset 8b will not be preserved in " "the created fhb object." - ) + print("dataset 8b will not be preserved in the created fhb object.") current = np.recarray(nflw, dtype=dtype) for n in range(nhed): ds8b = read1d(f, np.zeros((nbdtim,))) diff --git a/flopy/modflow/mfgage.py b/flopy/modflow/mfgage.py index d4cce7f47..588e6dbd1 100644 --- a/flopy/modflow/mfgage.py +++ b/flopy/modflow/mfgage.py @@ -157,7 +157,7 @@ def __init__( gage_data = d else: raise Exception( - "gage_data must be a numpy record array, numpy array " "or a list" + "gage_data must be a numpy record array, numpy array or a list" ) # add gage output files to model diff --git a/flopy/modflow/mfhob.py b/flopy/modflow/mfhob.py index 71758b4f9..c2761d72d 100644 --- a/flopy/modflow/mfhob.py +++ b/flopy/modflow/mfhob.py @@ -650,7 +650,7 @@ def __init__( names = [names] elif not isinstance(names, list): raise ValueError( - "HeadObservation names must be a " "string or a list of strings" + "HeadObservation names must be a string or a list of strings" ) if len(names) < self.nobs: raise ValueError( diff --git a/flopy/modflow/mflak.py b/flopy/modflow/mflak.py index 9855340b5..dd686441a 100644 --- a/flopy/modflow/mflak.py +++ b/flopy/modflow/mflak.py @@ -376,7 +376,7 @@ def __init__( if self.dis.steady[0]: if stage_range.shape != (nlakes, 2): raise Exception( - "stages shape should be ({},2) but is only " "{}.".format( + "stages shape should be ({},2) but is only {}.".format( nlakes, stage_range.shape ) ) diff --git a/flopy/modflow/mfmnw2.py b/flopy/modflow/mfmnw2.py index 12fac37c9..643a6f630 100644 --- a/flopy/modflow/mfmnw2.py +++ b/flopy/modflow/mfmnw2.py @@ -561,7 +561,7 @@ def get_default_spd_dtype(structured=True): ) else: raise NotImplementedError( - "Mnw2: get_default_spd_dtype not implemented for " "unstructured grids" + "Mnw2: get_default_spd_dtype not implemented for unstructured grids" ) @staticmethod diff --git a/flopy/modflow/mfpks.py b/flopy/modflow/mfpks.py index 86ef19f1e..688098f91 100644 --- a/flopy/modflow/mfpks.py +++ b/flopy/modflow/mfpks.py @@ -245,7 +245,7 @@ def load(cls, f, model, ext_unit_dict=None): # dataset 0 -- header - print(" Warning: " "load method not completed. default pks object created.") + print(" Warning: load method not completed. default pks object created.") if openfile: f.close() diff --git a/flopy/modflow/mfsfr2.py b/flopy/modflow/mfsfr2.py index c129de957..c6e1e53ae 100644 --- a/flopy/modflow/mfsfr2.py +++ b/flopy/modflow/mfsfr2.py @@ -2347,9 +2347,7 @@ def routing(self): print(txt) self._txt_footer(headertxt, txt, "reach connections", warning=False) else: - txt += ( - "No DIS package or modelgrid object; cannot " "check reach proximities." - ) + txt += "No DIS package or modelgrid object; cannot check reach proximities." self._txt_footer(headertxt, txt, "") def overlapping_conductance(self, tol=1e-6): @@ -2359,7 +2357,7 @@ def overlapping_conductance(self, tol=1e-6): """ headertxt = ( - "Checking for model cells with multiple non-zero " "SFR conductances...\n" + "Checking for model cells with multiple non-zero SFR conductances...\n" ) txt = "" if self.verbose: @@ -2495,7 +2493,7 @@ def elevations(self, min_strtop=-10, max_strtop=15000): passed = False if self.sfr.isfropt in [1, 2, 3]: if np.diff(self.reach_data.strtop).max() == 0: - txt += "isfropt setting of 1,2 or 3 " "requires strtop information!\n" + txt += "isfropt setting of 1,2 or 3 requires strtop information!\n" else: is_greater = self.reach_data.strtop > max_strtop if np.any(is_greater): @@ -2515,7 +2513,7 @@ def elevations(self, min_strtop=-10, max_strtop=15000): self._txt_footer(headertxt, txt, "maximum streambed top", passed) headertxt = ( - "Checking segment_data for " "downstream rises in streambed elevation...\n" + "Checking segment_data for downstream rises in streambed elevation...\n" ) txt = "" if self.verbose: @@ -2540,7 +2538,7 @@ def elevations(self, min_strtop=-10, max_strtop=15000): datatype="Segment", ) if len(t) > 0: - txt += "Elevation check requires " "consecutive segment numbering." + txt += "Elevation check requires consecutive segment numbering." self._txt_footer(headertxt, txt, "") return @@ -2604,7 +2602,7 @@ def elevations(self, min_strtop=-10, max_strtop=15000): self._txt_footer(headertxt, txt, "segment elevations", passed) headertxt = ( - "Checking reach_data for " "downstream rises in streambed elevation...\n" + "Checking reach_data for downstream rises in streambed elevation...\n" ) txt = "" if self.verbose: diff --git a/flopy/modflow/mfsor.py b/flopy/modflow/mfsor.py index 9d2e2f0c1..af0c5b5cf 100644 --- a/flopy/modflow/mfsor.py +++ b/flopy/modflow/mfsor.py @@ -165,7 +165,7 @@ def load(cls, f, model, ext_unit_dict=None): # dataset 0 -- header - print(" Warning: load method not completed. " "Default sor object created.") + print(" Warning: load method not completed. Default sor object created.") if openfile: f.close() diff --git a/flopy/modflow/mfstr.py b/flopy/modflow/mfstr.py index 16667d9ef..01ffa7578 100644 --- a/flopy/modflow/mfstr.py +++ b/flopy/modflow/mfstr.py @@ -373,7 +373,7 @@ def __init__( elif isinstance(d, int): if model.verbose: if d < 0: - print(" reusing str data from previous " "stress period") + print(" reusing str data from previous stress period") elif d == 0: print(f" no str data for stress period {key}") else: diff --git a/flopy/modflowlgr/mflgr.py b/flopy/modflowlgr/mflgr.py index 5a6ff60ad..790ed197b 100644 --- a/flopy/modflowlgr/mflgr.py +++ b/flopy/modflowlgr/mflgr.py @@ -249,7 +249,7 @@ def _get_path(self, bpth, pth, fpth=""): rpth = fpth else: rpth = os.path.join(rpth, fpth) - msg = "namefiles must be in the same directory as " "the lgr control file\n" + msg = "namefiles must be in the same directory as the lgr control file\n" msg += f"Control file path: {lpth}\n" msg += f"Namefile path: {mpth}\n" msg += f"Relative path: {rpth}\n" @@ -422,7 +422,7 @@ def change_model_ws(self, new_pth=None, reset_external=False): not_valid = new_pth new_pth = os.getcwd() print( - "\n{} not valid, workspace-folder was changed to {}" "\n".format( + "\n{} not valid, workspace-folder was changed to {}\n".format( not_valid, new_pth ) ) diff --git a/flopy/modpath/mp7.py b/flopy/modpath/mp7.py index d895b2314..4e8d06c44 100644 --- a/flopy/modpath/mp7.py +++ b/flopy/modpath/mp7.py @@ -179,7 +179,7 @@ def __init__( tdis = self.flowmodel.simulation.get_package("TDIS") if tdis is None: raise Exception( - "TDIS package must be " "included in the passed MODFLOW 6 model" + "TDIS package must be included in the passed MODFLOW 6 model" ) tdis_file = tdis.filename diff --git a/flopy/modpath/mp7sim.py b/flopy/modpath/mp7sim.py index f4ae6606f..3a5e883fd 100644 --- a/flopy/modpath/mp7sim.py +++ b/flopy/modpath/mp7sim.py @@ -538,7 +538,7 @@ def __init__( if self.retardationfactoroption == 2: if retardation is None: raise ValueError( - "retardation must be specified if " "retardationfactoroption='on'." + "retardation must be specified if retardationfactoroption='on'." ) self.retardation = Util3d( model, diff --git a/flopy/mt3d/mt.py b/flopy/mt3d/mt.py index 870882e4b..522a6190c 100644 --- a/flopy/mt3d/mt.py +++ b/flopy/mt3d/mt.py @@ -178,9 +178,7 @@ def __init__( ): pass else: - print( - "Specified value of ftlfree conflicts with FTL " "file format" - ) + print("Specified value of ftlfree conflicts with FTL file format") print( f"Switching ftlfree from {self.ftlfree} to {not self.ftlfree}" ) @@ -657,7 +655,7 @@ def load( # write message indicating packages that were successfully loaded if mt.verbose: print( - "\n The following {} packages were " "successfully loaded.".format( + "\n The following {} packages were successfully loaded.".format( len(files_successfully_loaded) ) ) diff --git a/flopy/mt3d/mtlkt.py b/flopy/mt3d/mtlkt.py index 17df885f9..a9f9a5f10 100644 --- a/flopy/mt3d/mtlkt.py +++ b/flopy/mt3d/mtlkt.py @@ -367,13 +367,9 @@ def load(cls, f, model, nlak=None, nper=None, ncomp=None, ext_unit_dict=None): if model.verbose: print(" loading initial concentration (COLDLAK) ") if model.free_format: - print( - " Using MODFLOW style array reader utilities to " "read COLDLAK" - ) + print(" Using MODFLOW style array reader utilities to read COLDLAK") elif model.array_format == "mt3d": - print( - " Using historic MT3DMS array reader utilities to " "read COLDLAK" - ) + print(" Using historic MT3DMS array reader utilities to read COLDLAK") kwargs = {} coldlak = Util2d.load( diff --git a/flopy/mt3d/mtsft.py b/flopy/mt3d/mtsft.py index 69be3f43c..c66fd613c 100644 --- a/flopy/mt3d/mtsft.py +++ b/flopy/mt3d/mtsft.py @@ -604,11 +604,9 @@ def load(cls, f, model, nsfinit=None, nper=None, ncomp=None, ext_unit_dict=None) print(" loading COLDSF...") if model.free_format: - print(" Using MODFLOW style array reader utilities to " "read COLDSF") + print(" Using MODFLOW style array reader utilities to read COLDSF") elif model.array_format == "mt3d": - print( - " Using historic MT3DMS array reader utilities to " "read COLDSF" - ) + print(" Using historic MT3DMS array reader utilities to read COLDSF") coldsf = Util2d.load( f, @@ -640,11 +638,9 @@ def load(cls, f, model, nsfinit=None, nper=None, ncomp=None, ext_unit_dict=None) # Item 4 (DISPSF(NRCH)) Reach-by-reach dispersion if model.verbose: if model.free_format: - print(" Using MODFLOW style array reader utilities to " "read DISPSF") + print(" Using MODFLOW style array reader utilities to read DISPSF") elif model.array_format == "mt3d": - print( - " Using historic MT3DMS array reader utilities to " "read DISPSF" - ) + print(" Using historic MT3DMS array reader utilities to read DISPSF") dispsf = Util2d.load( f, diff --git a/flopy/mt3d/mtssm.py b/flopy/mt3d/mtssm.py index 697533485..e0af06e1a 100644 --- a/flopy/mt3d/mtssm.py +++ b/flopy/mt3d/mtssm.py @@ -719,9 +719,7 @@ def load( # Item D8: KSS, ISS, JSS, CSS, ITYPE, (CSSMS(n),n=1,NCOMP) if model.verbose: - print( - " loading KSS, ISS, JSS, CSS, ITYPE, " "(CSSMS(n),n=1,NCOMP)..." - ) + print(" loading KSS, ISS, JSS, CSS, ITYPE, (CSSMS(n),n=1,NCOMP)...") if nss > 0: current = np.empty((nss), dtype=dtype) for ibnd in range(nss): diff --git a/flopy/pakbase.py b/flopy/pakbase.py index 239452bbc..24233a1a3 100644 --- a/flopy/pakbase.py +++ b/flopy/pakbase.py @@ -523,7 +523,7 @@ def __getitem__(self, item): if item[1] not in self.dtype.names: raise Exception( - "package.__getitem(): item {} not in dtype names " "{}".format( + "package.__getitem(): item {} not in dtype names {}".format( item, self.dtype.names ) ) diff --git a/flopy/plot/crosssection.py b/flopy/plot/crosssection.py index 9be80e50b..7229fddb3 100644 --- a/flopy/plot/crosssection.py +++ b/flopy/plot/crosssection.py @@ -1090,7 +1090,7 @@ def plot_vector( arbitrary = True if arbitrary: err_msg = ( - "plot_specific_discharge() does not " "support arbitrary cross-sections" + "plot_specific_discharge() does not support arbitrary cross-sections" ) raise AssertionError(err_msg) diff --git a/flopy/utils/binaryfile.py b/flopy/utils/binaryfile.py index a67f5ab47..f5dd47c0d 100644 --- a/flopy/utils/binaryfile.py +++ b/flopy/utils/binaryfile.py @@ -217,9 +217,7 @@ def set_values(self, **kwargs): try: self.header[0][k] = float(kwargs[k]) except: - print( - f"{k} key not available " f"in {self.header_type} header dtype" - ) + print(f"{k} key not available in {self.header_type} header dtype") for k in ckey: if k in kwargs.keys(): # Convert to upper case to be consistent case used by MODFLOW @@ -1455,7 +1453,7 @@ def _find_paknam(self, paknam, to=False): break if paknam16 is None: raise Exception( - "The specified package name string is not " "in the budget file." + "The specified package name string is not in the budget file." ) return paknam16 @@ -1800,7 +1798,7 @@ def get_ts(self, idx, text=None, times=None): # issue exception if text not provided if text is None: raise Exception( - "text keyword must be provided to CellBudgetFile " "get_ts() method." + "text keyword must be provided to CellBudgetFile get_ts() method." ) kijlist = self._build_kijlist(idx) @@ -1889,7 +1887,7 @@ def _build_kijlist(self, idx): fail = True if fail: raise Exception( - "Invalid cell index. Cell {} not within model grid: " "{}".format( + "Invalid cell index. Cell {} not within model grid: {}".format( (k, i, j), (self.nlay, self.nrow, self.ncol) ) ) @@ -1977,7 +1975,7 @@ def get_record(self, idx, full3D=False): dtype = np.dtype([("node", np.int32), ("q", self.realtype)]) if self.verbose: if full3D: - s += f"a numpy masked array of " f"size ({nlay}, {nrow}, {ncol})" + s += f"a numpy masked array of size ({nlay}, {nrow}, {ncol})" else: s += f"a numpy recarray of size ({nlist}, 2)" print(s) diff --git a/flopy/utils/check.py b/flopy/utils/check.py index 3de16ca41..22868ad11 100644 --- a/flopy/utils/check.py +++ b/flopy/utils/check.py @@ -589,7 +589,7 @@ def _has_cell_indices(self, stress_period_data): ) != {"k", "i", "j"}: self._add_to_summary( type="Error", - desc="\r Stress period data missing k, " "i, j for structured grid.", + desc="\r Stress period data missing k, i, j for structured grid.", ) return False elif ( diff --git a/flopy/utils/datafile.py b/flopy/utils/datafile.py index 13e0649b8..34a911afb 100644 --- a/flopy/utils/datafile.py +++ b/flopy/utils/datafile.py @@ -120,7 +120,7 @@ def __init__(self, filetype=None, precision="single"): self.dtype = None self.header = None print( - "Specified {} type is not available. " "Available types are:".format( + "Specified {} type is not available. Available types are:".format( self.header_type ) ) @@ -626,7 +626,7 @@ def _build_kijlist(self, idx): fail = True if fail: raise Exception( - "Invalid cell index. Cell {} not within model grid: " "{}".format( + "Invalid cell index. Cell {} not within model grid: {}".format( (k, i, j), (self.nlay, self.nrow, self.ncol) ) ) diff --git a/flopy/utils/datautil.py b/flopy/utils/datautil.py index 674849106..468e51305 100644 --- a/flopy/utils/datautil.py +++ b/flopy/utils/datautil.py @@ -508,7 +508,7 @@ def __init__(self, mdlist=None, shape=None, callback=None): self.build_list(callback) else: raise Exception( - "MultiList requires either a mdlist or a shape " "at initialization." + "MultiList requires either a mdlist or a shape at initialization." ) def __getitem__(self, k): diff --git a/flopy/utils/mflistfile.py b/flopy/utils/mflistfile.py index a329fd674..add18381e 100644 --- a/flopy/utils/mflistfile.py +++ b/flopy/utils/mflistfile.py @@ -683,7 +683,7 @@ def _set_entries(self): ) except: raise Exception( - "unable to read budget information from first " "entry in list file" + "unable to read budget information from first entry in list file" ) self.entries = incdict.keys() null_entries = {} diff --git a/flopy/utils/modpathfile.py b/flopy/utils/modpathfile.py index aa5432161..550db4789 100644 --- a/flopy/utils/modpathfile.py +++ b/flopy/utils/modpathfile.py @@ -96,7 +96,7 @@ def intersect(self, cells, to_recarray) -> Union[list[np.recarray], np.recarray] raslice = self._data[["k", "i", "j"]] except (KeyError, ValueError): raise KeyError( - "could not extract 'k', 'i', and 'j' keys " "from {} data".format( + "could not extract 'k', 'i', and 'j' keys from {} data".format( self.output_type.lower() ) ) @@ -738,7 +738,7 @@ def write_shapefile( xcol, ycol, zcol = "x0", "y0", "z0" else: raise Exception( - 'flopy.map.plot_endpoint direction must be "ending" ' 'or "starting".' + 'flopy.map.plot_endpoint direction must be "ending" or "starting".' ) if mg is None: raise ValueError("A modelgrid object was not provided.") diff --git a/flopy/utils/util_array.py b/flopy/utils/util_array.py index dea2057c8..0000345b7 100644 --- a/flopy/utils/util_array.py +++ b/flopy/utils/util_array.py @@ -1821,7 +1821,7 @@ def __init__( self._model = model if len(shape) not in (1, 2): raise ValueError( - "Util2d: shape must describe 1- or 2-dimensions, " "e.g. (nrow, ncol)" + "Util2d: shape must describe 1- or 2-dimensions, e.g. (nrow, ncol)" ) if min(shape) < 1: raise ValueError("Util2d: each shape dimension must be at least 1") @@ -2166,7 +2166,7 @@ def _get_fixed_cr(self, locat, value=None): if self.format.binary: if locat is None: raise Exception( - "Util2d._get_fixed_cr(): locat is None but " "format is binary" + "Util2d._get_fixed_cr(): locat is None but format is binary" ) if not self.format.array_free_format: locat = -1 * np.abs(locat) diff --git a/flopy/utils/zonbud.py b/flopy/utils/zonbud.py index 48849e82b..37b43af05 100644 --- a/flopy/utils/zonbud.py +++ b/flopy/utils/zonbud.py @@ -1571,7 +1571,7 @@ def export(self, f, ml, **kwargs): if isinstance(f, str): if not f.endswith(".nc"): raise AssertionError( - "File extension must end with .nc to " "export a netcdf file" + "File extension must end with .nc to export a netcdf file" ) zbncfobj = dataframe_to_netcdf_fmt( @@ -2024,7 +2024,7 @@ def export(self, f, ml, **kwargs): f = str(f) if not f.endswith(".nc"): raise AssertionError( - "File extension must end with .nc to " "export a netcdf file" + "File extension must end with .nc to export a netcdf file" ) zbncfobj = dataframe_to_netcdf_fmt(