Skip to content

Commit

Permalink
fix(flake8 code F632): use '==' instead of 'is'
Browse files Browse the repository at this point in the history
* With MfList, check 'len(recs) == 0' instead of 'recs is 0'
  • Loading branch information
mwtoews committed Nov 21, 2019
1 parent abccfb7 commit b6443ab
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions flopy/mf6/utils/binaryfile_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,10 @@ def _reshape_binary_data(data, dtype=None):
data = np.array(data)
if dtype is None:
return data
elif dtype is 'V':
elif dtype == 'V':
nodes = len(data[0][0][0])
data.shape = (time, -1, nodes)
elif dtype is 'U':
elif dtype == 'U':
data.shape = (time, -1)
else:
err = "Invalid dtype flag supplied, valid are dtype='U', dtype='V'"
Expand Down
10 changes: 5 additions & 5 deletions flopy/mf6/utils/mfobservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,16 @@ def _get_datetime(self, times, start_dt, unit):

# create list of datetimes
t0 = dt.datetime(year, month, day, hour, minute, second)
if unit is 'Y':
if unit == 'Y':
dtlist = [dt.datetime(int(year + time), month, day, hour, minute,
second) for time in times]
elif unit is 'D':
elif unit == 'D':
dtlist = [t0+dt.timedelta(days=time) for time in times]
elif unit is 'H':
elif unit == 'H':
dtlist = [t0+dt.timedelta(hours=time) for time in times]
elif unit is 'M':
elif unit == 'M':
dtlist = [t0+dt.timedelta(minutes=time) for time in times]
elif unit is 'S':
elif unit == 'S':
dtlist = [t0+dt.timedelta(seconds=time) for time in times]
else:
raise TypeError('invalid time unit supplied')
Expand Down
2 changes: 1 addition & 1 deletion flopy/utils/gridintersect.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ def _intersect_linestring_structured(self, shp, keepzerolengths=False):
return np.recarray(0, names=["cellids", "vertices",
"lengths", "ixshapes"],
formats=["O", "O", "f8", "O"])
if lineclip.geom_type is 'MultiLineString': # there are multiple lines
if lineclip.geom_type == 'MultiLineString': # there are multiple lines
nodelist, lengths, vertices = [], [], []
ixshapes = []
for ls in lineclip:
Expand Down
2 changes: 1 addition & 1 deletion flopy/utils/util_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ def _get_fixed_cr(self, locat, value=None):
locat = -1 * np.abs(locat)
if locat is None:
locat = 0
if locat is 0:
if locat == 0:
fformat = ''
if self.dtype == np.int32:
cr = '{0:>10.0f}{1:>10.0f}{2:>19s}{3:>10.0f} #{4}\n' \
Expand Down
4 changes: 2 additions & 2 deletions flopy/utils/util_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,9 @@ def get_dataframe(self, squeeze=True):
dfs = []
for per in self.data.keys():
recs = self.data[per]
if recs is None or recs is 0:
if recs is None or len(recs) == 0:
# add an empty dataframe if a stress period is
# set to 0 (e.g. no pumping during a predevelopment
# empty (e.g. no pumping during a predevelopment
# period)
columns = names + list(['{}{}'.format(c, per)
for c in varnames])
Expand Down

0 comments on commit b6443ab

Please sign in to comment.