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

Line length formatting to 88 #1699

Merged
merged 2 commits into from
Dec 15, 2022
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
11 changes: 7 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
repos:
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.11.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
args:
- --line-length=88

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
Expand Down
8 changes: 7 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,13 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, "ansys.mapdl.core", "ansys.mapdl.core Documentation", [author], 1)
(
master_doc,
"ansys.mapdl.core",
"ansys.mapdl.core Documentation",
[author],
1,
)
]


Expand Down
15 changes: 13 additions & 2 deletions examples/00-mapdl-examples/2d_plate_with_a_hole.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@
mapdl.esize(plate_esize)
mapdl.amesh(plate_with_hole_anum)
mapdl.eplot(
vtk=True, cpos="xy", show_edges=True, show_axes=False, line_width=2, background="w"
vtk=True,
cpos="xy",
show_edges=True,
show_axes=False,
line_width=2,
background="w",
)

###############################################################################
Expand Down Expand Up @@ -160,7 +165,13 @@
# grab the result from the ``mapdl`` instance
result = mapdl.result
result.plot_principal_nodal_stress(
0, "SEQV", lighting=False, cpos="xy", background="w", text_color="k", add_text=False
0,
"SEQV",
lighting=False,
cpos="xy",
background="w",
text_color="k",
add_text=False,
)

nnum, stress = result.principal_nodal_stress(0)
Expand Down
11 changes: 9 additions & 2 deletions examples/00-mapdl-examples/composite_dcb.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@
# Apply the fix condition
mapdl.allsel()
mapdl.nsel(
type_="s", item="loc", comp="x", vmin=length + pre_crack, vmax=length + pre_crack
type_="s",
item="loc",
comp="x",
vmin=length + pre_crack,
vmax=length + pre_crack,
)
mapdl.d(node="all", lab="ux", value=0.0)
mapdl.d(node="all", lab="uy", value=0.0)
Expand Down Expand Up @@ -435,7 +439,10 @@
# an animation.
disp = model.results.displacement.on_all_time_freqs.eval()
camera_pos = disp.animate(
scale_factor=10.0, save_as="dcb_animate.gif", return_cpos=True, show_axes=True
scale_factor=10.0,
save_as="dcb_animate.gif",
return_cpos=True,
show_axes=True,
)

###############################################################################
Expand Down
4 changes: 3 additions & 1 deletion examples/00-mapdl-examples/cyclic_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def gen_sector(mapdl, sectors):
# radius
rad = 0.01 # M
arc = pv.CircularArc(
[rad, 0, 0], [np.cos(arc_end) * rad, np.sin(arc_end) * rad, 0], [0, 0, 0]
[rad, 0, 0],
[np.cos(arc_end) * rad, np.sin(arc_end) * rad, 0],
[0, 0, 0],
)

# interior circle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@

# Perform data mapping
inter_grid = grid.interpolate(
wrapped, sharpness=5, radius=0.0001, strategy="closest_point", progress_bar=True
wrapped,
sharpness=5,
radius=0.0001,
strategy="closest_point",
progress_bar=True,
) # Map the imported data to MAPDL grid
inter_grid.plot(show_edges=False) # Plot the interpolated data on MAPDL grid
temperature_load_val = pv.convert_array(
Expand Down
6 changes: 5 additions & 1 deletion examples/00-mapdl-examples/path_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@
scalar_bar_args={"title": "Stress YZ"},
)
pl.add_mesh(
stress_slice, scalars="Stress YZ", opacity=0.25, clim=clim, show_scalar_bar=False
stress_slice,
scalars="Stress YZ",
opacity=0.25,
clim=clim,
show_scalar_bar=False,
)
pl.add_mesh(rst.grid, color="w", style="wireframe", show_scalar_bar=False)
pl.camera_position = cpos
Expand Down
5 changes: 4 additions & 1 deletion examples/02-geometry/00-keypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@
# There are a variety of plotting options available for all the common
# plotting methods.
mapdl.kplot(
show_keypoint_numbering=True, background="black", show_bounds=True, font_size=26
show_keypoint_numbering=True,
background="black",
show_bounds=True,
font_size=26,
)

###############################################################################
Expand Down
13 changes: 10 additions & 3 deletions examples/04-general-fea/00-how_finite_element_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ def __init__(self, nodes):

def shape_functions(self, s, t):
return 0.25 * np.array(
[(1 - s) * (1 - t), (1 + s) * (1 - t), (1 + s) * (1 + t), (1 - s) * (1 + t)],
[
(1 - s) * (1 - t),
(1 + s) * (1 - t),
(1 + s) * (1 + t),
(1 - s) * (1 + t),
],
dtype=float,
)

Expand Down Expand Up @@ -553,7 +558,8 @@ def __init__(self, ex, nu):

def evaluate(self):
d = np.array(
[[1, self.nu, 0], [self.nu, 1, 0], [0, 0, (1 - self.nu) / 2.0]], dtype=float
[[1, self.nu, 0], [self.nu, 1, 0], [0, 0, (1 - self.nu) / 2.0]],
dtype=float,
)

return d * (self.ex / (1 - self.nu**2))
Expand Down Expand Up @@ -772,7 +778,8 @@ def __init__(self, ex, nu):

def evaluate(self):
d = np.array(
[[1, self.nu, 0], [self.nu, 1, 0], [0, 0, (1 - self.nu) / 2.0]], dtype=float
[[1, self.nu, 0], [self.nu, 1, 0], [0, 0, (1 - self.nu) / 2.0]],
dtype=float,
)

return d * (self.ex / (1 - self.nu**2))
Expand Down
7 changes: 6 additions & 1 deletion examples/06-verif-manual/vm-006-pinched_cylinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ def meshing():

# Plot the nodes using VTK.
mapdl.nplot(
vtk=True, nnum=True, background="", cpos="iso", show_bounds=True, point_size=10
vtk=True,
nnum=True,
background="",
cpos="iso",
show_bounds=True,
point_size=10,
)

# Print the list of nodes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@
)

# Define stress - strain properties of the aluminum.
aluminum = {"stress_a": [0, 55000, 55000, 55000], "strain_a": [0, 0.05, 0.1, 0.2]}
aluminum = {
"stress_a": [0, 55000, 55000, 55000],
"strain_a": [0, 0.05, 0.1, 0.2],
}

# Define yielding strength point of the Aluminum on the curve.
xp = aluminum["strain_a"][1]
Expand Down Expand Up @@ -492,7 +495,11 @@ def getload():
load_181 = load_181_theta * 360 / theta

# Return load results of each element model.
return abs(round(load_288, 0)), abs(round(load_185, 0)), abs(round(load_181, 0))
return (
abs(round(load_288, 0)),
abs(round(load_185, 0)),
abs(round(load_181, 0)),
)


###############################################################################
Expand Down Expand Up @@ -525,7 +532,17 @@ def getload():
# - 3rd Load Step with deflection :math:`\delta = 0.1 (in)` has :math:`load_3 = 1262000\,(lb)`.

target_res = np.asarray(
[1024400, 1262000, 1262000, 1024400, 1262000, 1262000, 1024400, 1262000, 1262000]
[
1024400,
1262000,
1262000,
1024400,
1262000,
1262000,
1024400,
1262000,
1262000,
]
)

simulation_res = np.asarray(
Expand Down
19 changes: 17 additions & 2 deletions src/ansys/mapdl/core/_commands/apdl/array_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,14 @@ def starvput(
return self.run(command, **kwargs)

def sread(
self, strarray="", fname="", ext="", nchar="", nskip="", nread="", **kwargs
self,
strarray="",
fname="",
ext="",
nchar="",
nskip="",
nread="",
**kwargs,
):
"""Reads a file into a string array parameter.

Expand Down Expand Up @@ -509,7 +516,15 @@ def sread(
return self.run(command, **kwargs)

def toper(
self, parr="", par1="", oper="", par2="", fact1="", fact2="", con1="", **kwargs
self,
parr="",
par1="",
oper="",
par2="",
fact1="",
fact2="",
con1="",
**kwargs,
):
"""Operates on table parameters.

Expand Down
9 changes: 8 additions & 1 deletion src/ansys/mapdl/core/_commands/apdl/matrix_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,14 @@ def eigen(self, kmatrix="", mmatrix="", cmatrix="", evals="", evects="", **kwarg
return self.run(command, **kwargs)

def export(
self, matrix="", format_="", fname="", val1="", val2="", val3="", **kwargs
self,
matrix="",
format_="",
fname="",
val1="",
val2="",
val3="",
**kwargs,
):
"""Exports a matrix to a file in the specified format.

Expand Down
9 changes: 8 additions & 1 deletion src/ansys/mapdl/core/_commands/aux12_/radiosity_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,14 @@ def vfsm(self, action="", encl="", opt="", maxiter="", conv="", **kwargs):
return self.run(command, **kwargs)

def vfopt(
self, opt="", filename="", ext="", dir_="", filetype="", fileformat="", **kwargs
self,
opt="",
filename="",
ext="",
dir_="",
filetype="",
fileformat="",
**kwargs,
):
"""Specifies options for the view factor file and calculates view factors.

Expand Down
9 changes: 8 additions & 1 deletion src/ansys/mapdl/core/_commands/aux3_.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ def fileaux3(self, fname="", ext="", **kwargs):
return self.run(command, **kwargs)

def modify(
self, set_="", lstep="", iter_="", cumit="", time="", ktitle="", **kwargs
self,
set_="",
lstep="",
iter_="",
cumit="",
time="",
ktitle="",
**kwargs,
):
"""Changes the listed values of the data in a set.

Expand Down
18 changes: 16 additions & 2 deletions src/ansys/mapdl/core/_commands/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,14 @@ def catiain(self, name="", extension="", path="", blank="", **kwargs):
return self.run(f"~CATIAIN,{name},{extension},{path},,,{blank}", **kwargs)

def parain(
self, name="", extension="", path="", entity="", fmt="", scale="", **kwargs
self,
name="",
extension="",
path="",
entity="",
fmt="",
scale="",
**kwargs,
):
"""Transfers a Parasolid file into the ANSYS program.

Expand Down Expand Up @@ -277,7 +284,14 @@ def satin(
return self.run(command, **kwargs)

def ugin(
self, name="", extension="", path="", entity="", layer="", fmt="", **kwargs
self,
name="",
extension="",
path="",
entity="",
layer="",
fmt="",
**kwargs,
):
"""Transfers an NX part into the ANSYS program.

Expand Down
7 changes: 6 additions & 1 deletion src/ansys/mapdl/core/_commands/database/coord_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,12 @@ def cswpla(self, kcn="", kcs="", par1="", par2="", **kwargs):

This command is valid in any processor.
"""
command = "CSWPLA,%s,%s,%s,%s" % (str(kcn), str(kcs), str(par1), str(par2))
command = "CSWPLA,%s,%s,%s,%s" % (
str(kcn),
str(kcs),
str(par1),
str(par2),
)
return self.run(command, **kwargs)

def csys(self, kcn="", **kwargs):
Expand Down
7 changes: 6 additions & 1 deletion src/ansys/mapdl/core/_commands/database/picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ def fitem(self, nfield="", item="", itemy="", itemz="", **kwargs):

This command is valid in any processor.
"""
command = "FITEM,%s,%s,%s,%s" % (str(nfield), str(item), str(itemy), str(itemz))
command = "FITEM,%s,%s,%s,%s" % (
str(nfield),
str(item),
str(itemy),
str(itemz),
)
return self.run(command, **kwargs)

def flst(self, nfield="", narg="", type_="", otype="", leng="", **kwargs):
Expand Down
Loading