Skip to content

Commit 2912b1d

Browse files
authored
style: apply consistent multi-line string formatting (#1166)
1 parent 08b95ea commit 2912b1d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1150
-1697
lines changed

autotest/t007_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,15 +1016,15 @@ def test_namfile_readwrite():
10161016
m2 = fm.Modflow.load("junk.nam", model_ws=os.path.join("temp", "t007"))
10171017

10181018
t_value = abs(m2.modelgrid.xoffset - xll)
1019-
msg = "m2.modelgrid.xoffset ({}) ".format(
1020-
m2.modelgrid.xoffset
1021-
) + "does not equal {}".format(xll)
1019+
msg = "m2.modelgrid.xoffset ({}) does not equal {}".format(
1020+
m2.modelgrid.xoffset, xll
1021+
)
10221022
assert t_value < 1e-2, msg
10231023

10241024
t_value = abs(m2.modelgrid.yoffset - yll)
1025-
msg = "m2.modelgrid.yoffset ({}) ".format(
1026-
m2.modelgrid.yoffset
1027-
) + "does not equal {}".format(yll)
1025+
msg = "m2.modelgrid.yoffset ({}) does not equal {}".format(
1026+
m2.modelgrid.yoffset, yll
1027+
)
10281028
assert t_value < 1e-2
10291029

10301030
msg = (

autotest/t008_test.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,8 @@ def load_nwt(nwtfile):
118118
]
119119
for l in lst:
120120
msg = (
121-
"{} data ".format(l)
122-
+ "instantiated from "
123-
+ "{} load ".format(os.path.basename(nwtfile))
124-
+ " is not the same as written to {}".format(os.path.basename(fn))
121+
"{} data instantiated from {} load is not the same as written to "
122+
"{}".format(l, nwtfile, os.path.basename(fn))
125123
)
126124
assert nwt2[l] == nwt[l], msg
127125

@@ -151,9 +149,8 @@ def load_nwt_model(nfile):
151149
]
152150
for l in lst:
153151
msg = (
154-
"{}.{} data ".format(pn, l)
155-
+ "instantiated from {} load ".format(model_ws)
156-
+ " is not the same as written to {}".format(tpth)
152+
"{}.{} data instantiated from {} load is not the same as "
153+
"written to {}".format(pn, l, model_ws, tpth)
157154
)
158155
assert p[l] == p2[l], msg
159156

autotest/t017_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,15 @@ def test_cellbudgetfile_readrecord():
240240
t = v.get_data(text="STREAM LEAKAGE", full3D=True)
241241
assert t[0].shape == (1, 15, 10), (
242242
"3D sfr budget data does not have correct shape (1, 15,10) - "
243-
+ "returned shape {}".format(t[0].shape)
243+
"returned shape {}".format(t[0].shape)
244244
)
245245

246246
for kk in kstpkper:
247247
t = v.get_data(kstpkper=kk, text="STREAM LEAKAGE", full3D=True)[0]
248248
assert t.shape == (1, 15, 10), (
249-
"3D sfr budget data for kstpkper {} ".format(kk)
250-
+ "does not have correct shape (1, 15,10) - "
251-
+ "returned shape {}".format(t[0].shape)
249+
"3D sfr budget data for kstpkper {} "
250+
"does not have correct shape (1, 15,10) - "
251+
"returned shape {}".format(kk, t[0].shape)
252252
)
253253

254254
idx = v.get_indices()
@@ -295,15 +295,15 @@ def test_cellbudgetfile_readrecord_waux():
295295
t = v.get_data(text="WELLS", full3D=True)
296296
assert t[0].shape == (1, 15, 10), (
297297
"3D wel budget data does not have correct shape (1, 15,10) - "
298-
+ "returned shape {}".format(t[0].shape)
298+
"returned shape {}".format(t[0].shape)
299299
)
300300

301301
for kk in kstpkper:
302302
t = v.get_data(kstpkper=kk, text="wells", full3D=True)[0]
303303
assert t.shape == (1, 15, 10), (
304-
"3D wel budget data for kstpkper {} ".format(kk)
305-
+ "does not have correct shape (1, 15,10) - "
306-
+ "returned shape {}".format(t[0].shape)
304+
"3D wel budget data for kstpkper {} "
305+
"does not have correct shape (1, 15,10) - "
306+
"returned shape {}".format(kk, t[0].shape)
307307
)
308308

309309
idx = v.get_indices()

autotest/t025_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def load_lak(mfnam, pth, run):
5050
try:
5151
success, buff = m.run_model(silent=True)
5252
except:
53-
msg = "could not run base model " + "{}".format(
53+
msg = "could not run base model {}".format(
5454
os.path.splitext(mfnam)[0]
5555
)
5656
print(msg)
@@ -79,7 +79,7 @@ def load_lak(mfnam, pth, run):
7979
try:
8080
success, buff = m.run_model(silent=False)
8181
except:
82-
msg = "could not run new model " + "{}".format(
82+
msg = "could not run new model {}".format(
8383
os.path.splitext(mfnam)[0]
8484
)
8585
print(msg)

autotest/t039_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,14 @@ def test_zonebudget_output_to_netcdf():
314314

315315
# test built in export function
316316
zbout = "freyberg_mlt.2.csv"
317-
ncf_name = zbout + ".bi1" + ".nc"
317+
ncf_name = zbout + ".bi1.nc"
318318

319319
zb = ZoneBudgetOutput(os.path.join(zb_ws, zbout), ml.dis, zone_array)
320320
zb.export(os.path.join(outpth, ncf_name), ml)
321321

322322
# test built in export function with NetCdf output object
323323
zbout = "freyberg_mlt.2.csv"
324-
ncf_name = zbout + ".bi2" + ".nc"
324+
ncf_name = zbout + ".bi2.nc"
325325

326326
zb = ZoneBudgetOutput(os.path.join(zb_ws, zbout), ml.dis, zone_array)
327327
export_dict = {"hds": hds}

autotest/t041_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def test_filenames():
292292
# Write the model input files
293293
m.write_input()
294294

295-
s = "output filename ({}) does " "not match specified name".format(
295+
s = "output filename ({}) does not match specified name".format(
296296
m.get_output(unit=51)
297297
)
298298
assert m.get_output(unit=51) == f_out, s

autotest/t049_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_modpath():
7979
except:
8080
success = False
8181
assert success, (
82-
"forward modpath model run " + "did not terminate successfully"
82+
"forward modpath model run did not terminate successfully"
8383
)
8484

8585
mpnam = "freybergmpp"
@@ -107,7 +107,7 @@ def test_modpath():
107107
except:
108108
success = False
109109
assert success, (
110-
"backward modpath model run " + "did not terminate successfully"
110+
"backward modpath model run did not terminate successfully"
111111
)
112112

113113
# load modpath output files
@@ -415,7 +415,7 @@ def eval_timeseries(file):
415415
tsd = ts.get_alldata()
416416
except:
417417
pass
418-
msg = "could not load data using get_alldata() from " + "{}.".format(
418+
msg = "could not load data using get_alldata() from {}.".format(
419419
os.path.basename(file)
420420
)
421421
assert len(tsd) > 0, msg

autotest/t074_test_geospatial_util.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def test_multipolygon():
214214

215215
if not is_equal:
216216
raise AssertionError(
217-
"GeoSpatialUtil multipolygon " "conversion error"
217+
"GeoSpatialUtil multipolygon conversion error"
218218
)
219219

220220

@@ -247,7 +247,7 @@ def test_point():
247247
is_equal = gi1 == gi2
248248

249249
if not is_equal:
250-
raise AssertionError("GeoSpatialUtil point " "conversion error")
250+
raise AssertionError("GeoSpatialUtil point conversion error")
251251

252252

253253
def test_multipoint():
@@ -279,9 +279,7 @@ def test_multipoint():
279279
is_equal = gi1 == gi2
280280

281281
if not is_equal:
282-
raise AssertionError(
283-
"GeoSpatialUtil multipoint " "conversion error"
284-
)
282+
raise AssertionError("GeoSpatialUtil multipoint conversion error")
285283

286284

287285
def test_linestring():
@@ -313,9 +311,7 @@ def test_linestring():
313311
is_equal = gi1 == gi2
314312

315313
if not is_equal:
316-
raise AssertionError(
317-
"GeoSpatialUtil linestring " "conversion error"
318-
)
314+
raise AssertionError("GeoSpatialUtil linestring conversion error")
319315

320316

321317
def test_multilinestring():
@@ -348,7 +344,7 @@ def test_multilinestring():
348344

349345
if not is_equal:
350346
raise AssertionError(
351-
"GeoSpatialUtil multilinestring " "conversion error"
347+
"GeoSpatialUtil multilinestring conversion error"
352348
)
353349

354350

@@ -386,7 +382,7 @@ def test_polygon_collection():
386382

387383
if not is_equal:
388384
raise AssertionError(
389-
"GeoSpatialCollection Polygon " "conversion error"
385+
"GeoSpatialCollection Polygon conversion error"
390386
)
391387

392388

@@ -420,7 +416,7 @@ def test_point_collection():
420416

421417
if not is_equal:
422418
raise AssertionError(
423-
"GeoSpatialCollection Point " "conversion error"
419+
"GeoSpatialCollection Point conversion error"
424420
)
425421

426422

@@ -454,7 +450,7 @@ def test_linestring_collection():
454450

455451
if not is_equal:
456452
raise AssertionError(
457-
"GeoSpatialCollection Linestring " "conversion error"
453+
"GeoSpatialCollection Linestring conversion error"
458454
)
459455

460456

flopy/datbase.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,43 @@ class DataInterface:
1818
@abc.abstractmethod
1919
def data_type(self):
2020
raise NotImplementedError(
21-
"must define dat_type in child " "class to use this base class"
21+
"must define dat_type in child class to use this base class"
2222
)
2323

2424
@property
2525
@abc.abstractmethod
2626
def dtype(self):
2727
def dtype(self):
2828
raise NotImplementedError(
29-
"must define dtype in child " "class to use this base class"
29+
"must define dtype in child class to use this base class"
3030
)
3131

3232
@property
3333
@abc.abstractmethod
3434
def array(self):
3535
raise NotImplementedError(
36-
"must define array in child " "class to use this base class"
36+
"must define array in child class to use this base class"
3737
)
3838

3939
@property
4040
@abc.abstractmethod
4141
def name(self):
4242
raise NotImplementedError(
43-
"must define name in child " "class to use this base class"
43+
"must define name in child class to use this base class"
4444
)
4545

4646
@property
4747
@abc.abstractmethod
4848
def model(self):
4949
raise NotImplementedError(
50-
"must define name in child " "class to use this base class"
50+
"must define name in child class to use this base class"
5151
)
5252

5353
@property
5454
@abc.abstractmethod
5555
def plottable(self):
5656
raise NotImplementedError(
57-
"must define plottable in child " "class to use this base class"
57+
"must define plottable in child class to use this base class"
5858
)
5959

6060

@@ -63,15 +63,15 @@ class DataListInterface:
6363
@abc.abstractmethod
6464
def package(self):
6565
raise NotImplementedError(
66-
"must define package in child " "class to use this base class"
66+
"must define package in child class to use this base class"
6767
)
6868

6969
@property
7070
@abc.abstractmethod
7171
def to_array(self, kper=0, mask=False):
7272
def to_array(self):
7373
raise NotImplementedError(
74-
"must define to_array in child " "class to use this base class"
74+
"must define to_array in child class to use this base class"
7575
)
7676

7777
@abc.abstractmethod

flopy/discretization/vertexgrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def intersect(self, x, y, local=False, forgive=False):
273273
if Path is None:
274274
s = (
275275
"Could not import matplotlib. Must install matplotlib "
276-
+ " in order to use VertexGrid.intersect() method"
276+
"in order to use VertexGrid.intersect() method"
277277
)
278278
raise ImportError(s)
279279

0 commit comments

Comments
 (0)