Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#374)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.12.0 → 23.3.0](psf/black@22.12.0...23.3.0)
- [github.com/asottile/pyupgrade: v3.3.1 → v3.6.0](asottile/pyupgrade@v3.3.1...v3.6.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Jun 14, 2023
1 parent 0fab51c commit a8d2e6f
Show file tree
Hide file tree
Showing 20 changed files with 8 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
exclude: ref_vtk_hexahedra.vtu
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
Expand All @@ -29,7 +29,7 @@ repos:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.6.0
hooks:
- id: pyupgrade
- repo: https://github.com/PyCQA/flake8
Expand Down
4 changes: 2 additions & 2 deletions examples/backward_facing_step_2d/postprocessor_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def sort_nicely(my_list):

###################################################################


# Reattachment length:
def reattachment_length(filelist):

print("Calculating reattachment point locations using change of x-velocity sign\n")

results = []
Expand Down Expand Up @@ -140,9 +140,9 @@ def reattachment_length(filelist):

#########################################################################


# Velocity profiles:
def meanvelo(file, x, y):

print("\nRunning velocity profile script on files at times...\n")

# create array of points. Correct for origin not at step.
Expand Down
4 changes: 0 additions & 4 deletions examples/backward_facing_step_3d/extract_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def restresseslemoin(off):


def velocityprofileslemoin():

Le = open(str(mydir) + "/Le-profiles/Le-profile1-U-x4.dat").readlines()
Le_u4 = [float(line.split()[0]) for line in Le]
Le_y4 = [float(line.split()[1]) for line in Le]
Expand Down Expand Up @@ -130,7 +129,6 @@ def velocityprofileslemoin():


def ercoftacvelocityprofiles():

y4 = []
U4 = []
y6 = []
Expand Down Expand Up @@ -168,7 +166,6 @@ def ercoftacvelocityprofiles():


def ercoftacrestressprofiles():

datafile = open(str(mydir) + "/Ercoftac-test31-BFS/BFS-SEM-ERCOFTAC181-table.dat")
print("reading in data from file: BFS-SEM-ERCOFTAC181-table.dat")
# ignore header line
Expand All @@ -191,7 +188,6 @@ def ercoftacrestressprofiles():


def panjwaniprofiles(variable):

off = 0.05 if variable == "uu" else 0.0
inv = -1.0 if variable == "uv" else 1.0
# get data from relevant files
Expand Down
2 changes: 2 additions & 0 deletions examples/backward_facing_step_3d/postprocessor_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def sort_nicely(my_list):

###################################################################


# Reattachment length:
def reatt_length(filelist, zarray):
print("Calculating reattachment point locations using change of x-velocity sign\n")
Expand Down Expand Up @@ -155,6 +156,7 @@ def reatt_length(filelist, zarray):

#########################################################################


# Velocity profiles:
def velo(filelist, xarray, zarray, yarray):
print("\nRunning mean velocity profile script on files at times...\n")
Expand Down
1 change: 0 additions & 1 deletion examples/lock_exchange/plot_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def Froudenumber(flmlname):


def mixing(flmlname):

print("\n********** Calculating the mixing diagnostics\n")
# warn user about assumptions
print(
Expand Down
1 change: 0 additions & 1 deletion python/elementtree/ElementPath.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class xpath_descendant_or_self:


class Path:

##
# Create an Path instance from an XPath expression.

Expand Down
7 changes: 0 additions & 7 deletions python/fluidity_ufl/ufl_fortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def __init__(self, integral, dim="dim"):
self.map_sum_indices()

def fortran(self):

dim_indices = ["dim" + str(i) + "_i" for i in range(self.integral.rank)]

name, declaration, lhs = self.function_spec(dim_indices)
Expand Down Expand Up @@ -149,7 +148,6 @@ def iterfunctions(self):
yield self.integral.trial

def function_spec(self, dim_indices):

name = "integral"
declaration = "real, dimension("
lhs_args = dim_indices + ["test_i"]
Expand All @@ -160,11 +158,9 @@ def function_spec(self, dim_indices):
for i in f.indices:
# Slices are free indices.
if isinstance(i, slice):

declaration = declaration + str(self.dim) + ", "

else:

name = name + "_i" + str(self.sum_index_map[i.id])

name = name + "_" + self.integral.measure.name
Expand Down Expand Up @@ -201,7 +197,6 @@ def set_arguments(self):
self.actual_arguments = []

for f in self.iterfunctions():

args = function_to_arguments(f)
self.dummy_arguments.append(args[0])
self.actual_arguments.append(args[1])
Expand Down Expand Up @@ -238,12 +233,10 @@ def function_to_arguments(function):


def indent(code):

return [" " + line for line in code]


def do_loop(var, size, body):

code = ["do " + var + " = 1, " + str(size)] + indent(body) + ["end do"]

return code
1 change: 0 additions & 1 deletion tests/biology_conservation/values_per_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


def values_per_node(file):

u = vtktools.vtu(file)
zoo = u.GetScalarField("Zooplankton")
phyto = u.GetScalarField("Phytoplankton")
Expand Down
1 change: 0 additions & 1 deletion tests/netcdf_read_errors/createnetcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def create(
incorrectdimension=False,
incorrectvariable=False,
):

if missingdata:
filename = "missingdata.nc"
description = ", with missing data."
Expand Down
2 changes: 0 additions & 2 deletions tests/turbine_flux_dg_2d/mesh/scripts/triangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def pnode(fnode):
nbnodes = 0

for line in fnode:

if line[0] == "#":
continue
else:
Expand Down Expand Up @@ -220,7 +219,6 @@ def peles(fele):
count = 0
nbeles = 0
for line in fele:

if line[0] == "#":
continue
else:
Expand Down
2 changes: 0 additions & 2 deletions tests/turbine_flux_dg_2plus1/mesh/scripts/triangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def pnode(fnode):
nbnodes = 0

for line in fnode:

if line[0] == "#":
continue
else:
Expand Down Expand Up @@ -220,7 +219,6 @@ def peles(fele):
count = 0
nbeles = 0
for line in fele:

if line[0] == "#":
continue
else:
Expand Down
2 changes: 0 additions & 2 deletions tests/turbine_flux_penalty_2d/mesh/scripts/triangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def pnode(fnode):
nbnodes = 0

for line in fnode:

if line[0] == "#":
continue
else:
Expand Down Expand Up @@ -220,7 +219,6 @@ def peles(fele):
count = 0
nbeles = 0
for line in fele:

if line[0] == "#":
continue
else:
Expand Down
2 changes: 0 additions & 2 deletions tests/turbine_flux_penalty_2plus1/mesh/scripts/triangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def pnode(fnode):
nbnodes = 0

for line in fnode:

if line[0] == "#":
continue
else:
Expand Down Expand Up @@ -220,7 +219,6 @@ def peles(fele):
count = 0
nbeles = 0
for line in fele:

if line[0] == "#":
continue
else:
Expand Down
1 change: 0 additions & 1 deletion tests/wetting_and_drying_balzano1_cg/plotfs_detec.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def bathymetry_function(X):

# Main #
def main(argv=None):

filename = ""
timestep_ana = 0.0
dzero = 0.01
Expand Down
5 changes: 0 additions & 5 deletions tools/clean_mayavi_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ def find_bounding_box(ps, margin=10):


def set_bounding_box(ps, margin):

bb = find_bounding_box(ps, margin)

for i in range(len(ps)):

if bb_re.match(ps[i]):
ps[i] = "%%BoundingBox: " + " ".join(map(str, bb)) + "\n"

Expand All @@ -58,9 +56,7 @@ def set_bounding_box(ps, margin):


def set_linestyle(ps):

for i in range(len(ps)):

if linestyle_re.match(ps[i]):
ps[i] = "1 setlinecap 1 setlinejoin\n"
return
Expand All @@ -69,7 +65,6 @@ def set_linestyle(ps):


def process_file(inname, outname, options):

ps = open(inname).readlines()

set_bounding_box(ps, options.margin)
Expand Down
10 changes: 2 additions & 8 deletions tools/edge_length_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def pair_off(nodes):
# e.g. for [1,5,7,9] will yield [1,5], [1,7], [1,9]
# then knock off 1 and yield [5,7], [5,9]
# then knock off 5 and yield [7,9]
for (idx_i, node) in enumerate(nodes):
for (idx_j, node_j) in enumerate(nodes[idx_i + 1 :]):
for idx_i, node in enumerate(nodes):
for idx_j, node_j in enumerate(nodes[idx_i + 1 :]):
yield (node, node_j)


Expand All @@ -119,7 +119,6 @@ def key(s):


def GetEdgeLengths(data):

eles = data.ugrid.GetNumberOfCells()
edgeset = set()

Expand All @@ -145,7 +144,6 @@ def GetEdgeLengths(data):


def PlotEdgeLengths(edge_lengths_all, time, options):

for i in range(len(edge_lengths_all)):
plt.figure(num=None, figsize=(16.5, 11.5))
plt.hist(edge_lengths_all[i], options.no_bins)
Expand All @@ -166,7 +164,6 @@ def PlotEdgeLengths(edge_lengths_all, time, options):


def PlotMaxMin(edge_lengths_all, time):

min_edgelength = []
max_edgelength = []

Expand Down Expand Up @@ -195,7 +192,6 @@ def PlotMaxMin(edge_lengths_all, time):


def PlotCumulative(edge_lengths_all, options):

all_vals = []
for edge_lengths in edge_lengths_all:
all_vals = all_vals + edge_lengths
Expand Down Expand Up @@ -235,7 +231,6 @@ def PlotCumulative(edge_lengths_all, options):
pass

if options.plot_only is True:

try:
time_log = open("edge_length_distribution_plots/time.log")
except OSError:
Expand Down Expand Up @@ -264,7 +259,6 @@ def PlotCumulative(edge_lengths_all, options):
edge_lengths_all.append(line)

else:

time_log = open("edge_length_distribution_plots/time.log", "w")
edge_lengths_log = open("edge_length_distribution_plots/edge_lengths.log", "w")
if options.end_vtu is None:
Expand Down
4 changes: 0 additions & 4 deletions tools/make_check_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ def safe_decode(x):
module_list = []

for filename in fortran_files:

fortran = open(filename, "rb").read().decode("utf-8")

modules = module_re.findall(fortran)

for module in modules:

if re.search(
r"^\s*subroutine\s+" + module + r"_check_options\S*\s*$",
fortran,
Expand All @@ -59,7 +57,6 @@ def safe_decode(x):
module_list.append(module)

for module in module_list:

output.write(
safe_decode(" use " + module + ", only: " + module + "_check_options\n")
)
Expand All @@ -74,7 +71,6 @@ def safe_decode(x):
)

for module in module_list:

output.write(safe_decode(" call " + module + "_check_options\n"))

output.write(safe_decode(footer))
Expand Down
4 changes: 0 additions & 4 deletions tools/make_register_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ def safe_decode(x):
module_list = []

for filename in fortran_files:

fortran = open(filename, "rb").read().decode("utf-8")

modules = module_re.findall(fortran)

for module in modules:

if re.search(
r"^\s*subroutine\s+" + module + r"_register_diagnostic\s*$",
fortran,
Expand All @@ -59,7 +57,6 @@ def safe_decode(x):
module_list.append(module)

for module in module_list:

output.write(
safe_decode(" use " + module + ", only: " + module + "_register_diagnostic\n")
)
Expand All @@ -74,7 +71,6 @@ def safe_decode(x):
)

for module in module_list:

output.write(safe_decode(" call " + module + "_register_diagnostic\n"))

output.write(safe_decode(footer))
Expand Down
1 change: 0 additions & 1 deletion tools/profiling-graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def draw_graph(times, output):


if __name__ == "__main__":

import optparse

usage = "usage: %prog [--subroutines] [--output] profiling-logs"
Expand Down
Loading

0 comments on commit a8d2e6f

Please sign in to comment.