Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: clean-up python 2 'next' and redundant '__future__' imports #1181

Merged
merged 1 commit into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion autotest/autotest_scripts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Remove the temp directory and then create a fresh one
from __future__ import print_function
import os
import sys
import shutil
Expand Down
1 change: 0 additions & 1 deletion examples/Testing/flopy3_plotdata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import os

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/flopy_swi2_ex1.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import os
import sys
import math
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/flopy_swi2_ex2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import os
import sys
import collections
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/flopy_swi2_ex3.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import os
import sys

Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/flopy_swi2_ex4.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import os
import platform
import sys
Expand Down
2 changes: 0 additions & 2 deletions examples/scripts/flopy_swi2_ex5.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import os
import sys
import math
Expand Down
1 change: 0 additions & 1 deletion flopy/export/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import json
import os
import numpy as np
Expand Down
1 change: 0 additions & 1 deletion flopy/export/vtk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division
import os
import numpy as np
from ..discretization import StructuredGrid
Expand Down
2 changes: 0 additions & 2 deletions flopy/mbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
all of the other models inherit from.

"""

from __future__ import print_function
import abc
import sys
import os
Expand Down
6 changes: 3 additions & 3 deletions flopy/mf6/data/mfdatastorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2423,10 +2423,10 @@ def _fill_dimensions(self, data_iter, dimensions):
data_array = np.ndarray(shape=dimensions, dtype=np_dtype)
# fill array
for index in ArrayIndexIter(dimensions):
data_array.itemset(index, data_iter.__next__())
data_array.itemset(index, next(data_iter))
return data_array
elif self.data_structure_type == DataStructureType.scalar:
return data_iter.__next__()
return next(data_iter)
else:
data_array = None
data_line = ()
Expand Down Expand Up @@ -2471,7 +2471,7 @@ def _fill_dimensions(self, data_iter, dimensions):
)
current_col = 0
data_line = ()
data_array[index] = data_iter.next()
data_array[index] = next(data_iter)
return data_array

def set_tas(self, tas_name, tas_label, current_key, check_name=True):
Expand Down
3 changes: 0 additions & 3 deletions flopy/pakbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
all of the other packages inherit from.

"""

from __future__ import print_function

import abc
import os
import webbrowser as wb
Expand Down
1 change: 0 additions & 1 deletion flopy/pest/params.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import numpy as np


Expand Down
1 change: 0 additions & 1 deletion flopy/pest/templatewriter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
from ..pest import tplarray as tplarray


Expand Down
1 change: 0 additions & 1 deletion flopy/pest/tplarray.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import numpy as np
from ..utils.util_array import Util3d as Util3d
from ..utils.util_array import Transient2d as Transient2d
Expand Down
1 change: 0 additions & 1 deletion flopy/plot/plotutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
shapefiles are also included.

"""
from __future__ import print_function
import os
import sys
import math
Expand Down
1 change: 0 additions & 1 deletion flopy/utils/binaryfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* CellBudgetFile (Binary cell-by-cell flow file)

"""
from __future__ import print_function
import numpy as np
import warnings
from collections import OrderedDict
Expand Down
1 change: 0 additions & 1 deletion flopy/utils/datafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
abstract classes that should not be directly accessed.

"""
from __future__ import print_function
import numpy as np
import flopy.utils
from ..discretization.structuredgrid import StructuredGrid
Expand Down
16 changes: 2 additions & 14 deletions flopy/utils/datautil.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def nth_index(self, n):
aii = ArrayIndexIter(self.list_shape, True)
index_num = 0
while index_num <= n:
index = aii.next()
index = next(aii)
index_num += 1
return index

Expand Down Expand Up @@ -651,8 +651,6 @@ def __next__(self):
self.current_index -= 1
raise StopIteration()

next = __next__ # Python 2 support


class MultiListIter:
def __init__(self, multi_list, detailed_info=False, iter_leaf_lists=False):
Expand All @@ -673,8 +671,6 @@ def __next__(self):
else:
return next_val[0]

next = __next__ # Python 2 support


class ConstIter:
def __init__(self, value):
Expand All @@ -686,8 +682,6 @@ def __iter__(self):
def __next__(self):
return self.value

next = __next__ # Python 2 support


class FileIter:
def __init__(self, file_path):
Expand Down Expand Up @@ -729,8 +723,6 @@ def _next_line(self):
return
self._current_data = PyListUtil.split_data_line(data_line)

next = __next__ # Python 2 support


class NameIter:
def __init__(self, name, first_not_numbered=True):
Expand All @@ -748,8 +740,6 @@ def __next__(self):
else:
return "{}_{}".format(self.name, self.iter_num)

next = __next__ # Python 2 support


class PathIter:
def __init__(self, path, first_not_numbered=True):
Expand All @@ -760,6 +750,4 @@ def __iter__(self):
return self

def __next__(self):
return self.path[0:-1] + (self.name_iter.__next__(),)

next = __next__ # Python 2 support
return self.path[0:-1] + (next(self.name_iter),)
1 change: 0 additions & 1 deletion flopy/utils/gridgen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import os
import numpy as np
import subprocess
Expand Down
2 changes: 0 additions & 2 deletions flopy/utils/util_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
instantiate these classes directly.

"""
from __future__ import division, print_function

# from future.utils import with_metaclass

import os
Expand Down
2 changes: 0 additions & 2 deletions flopy/utils/util_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
some more info

"""
from __future__ import division, print_function

import os
import warnings
import numpy as np
Expand Down