Skip to content

Commit 5241579

Browse files
Apply linting and formatting
1 parent 817b83a commit 5241579

32 files changed

+464
-446
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,4 @@ jobs:
179179
- name: Upload coverage report
180180
uses: codecov/codecov-action@v4
181181
with:
182-
token: ${{ secrets.CODECOV_TOKEN }}
182+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ jobs:
6666
publish: ${{ steps.check-version.outputs.tag != '' }}
6767
tag: ${{ steps.check-version.outputs.tag }}
6868
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs/_static/anim/gen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
"""Script that combines multiple pngs into a gif."""
2+
13
import glob
24

35
from PIL import Image
46

5-
67
# filepaths
78
fp_in = "*.png"
89
fp_out = "anim.gif"

docs/_static/animation.ipynb

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@
249249
"\n",
250250
"\n",
251251
"def plot_stress_and_graph(res_idx, mk_res_list, k_list, m_list, **kwargs):\n",
252+
" \"\"\"Function that plots the animation.\"\"\"\n",
252253
" with plotting_context(title=\"Stress\", **kwargs) as (fig, ax):\n",
253254
" # plot background\n",
254255
" mk_res_list[res_idx].concrete_section.plot_section(\n",
@@ -267,14 +268,14 @@
267268
" conc_sig_max = (\n",
268269
" max([max(x) for x in mk_res_list[res_idx].concrete_stresses]) + 1e-12\n",
269270
" )\n",
270-
" steel_sig_min = min(mk_res_list[res_idx].lumped_reinforcement_stresses)\n",
271-
" steel_sig_max = max(mk_res_list[res_idx].lumped_reinforcement_stresses)\n",
271+
" # steel_sig_min = min(mk_res_list[res_idx].lumped_reinforcement_stresses)\n",
272+
" # steel_sig_max = max(mk_res_list[res_idx].lumped_reinforcement_stresses)\n",
272273
"\n",
273274
" # set up ticks\n",
274275
" v_conc = np.linspace(conc_sig_min, conc_sig_max, 15, endpoint=True)\n",
275-
" v_steel = np.linspace(steel_sig_min, steel_sig_max, 15, endpoint=True)\n",
276-
" ticks_conc = v_conc\n",
277-
" ticks_steel = v_steel\n",
276+
" # v_steel = np.linspace(steel_sig_min, steel_sig_max, 15, endpoint=True)\n",
277+
" # ticks_conc = v_conc\n",
278+
" # ticks_steel = v_steel\n",
278279
"\n",
279280
" # plot the concrete stresses\n",
280281
" for idx, sig in enumerate(mk_res_list[res_idx].concrete_stresses):\n",
@@ -294,9 +295,7 @@
294295
" )\n",
295296
"\n",
296297
" # plot the filled contour\n",
297-
" trictr = ax.tricontourf(\n",
298-
" triang, sig, v_conc, cmap=cmap_conc, norm=CenteredNorm()\n",
299-
" )\n",
298+
" ax.tricontourf(triang, sig, v_conc, cmap=cmap_conc, norm=CenteredNorm())\n",
300299
"\n",
301300
" # plot a zero stress contour, supressing warning\n",
302301
" with warnings.catch_warnings():\n",
@@ -308,21 +307,19 @@
308307
" # set zero stress for neutral axis contour\n",
309308
" zero_level = 0\n",
310309
"\n",
311-
" if min(sig) > 0:\n",
312-
" if min(sig) < 1e-3:\n",
313-
" zero_level = min(sig) + 1e-12\n",
310+
" if min(sig) > 0 and min(sig) < 1e-3:\n",
311+
" zero_level = min(sig) + 1e-12\n",
314312
"\n",
315-
" if max(sig) < 0:\n",
316-
" if max(sig) > -1e-3:\n",
317-
" zero_level = max(sig) - 1e-12\n",
313+
" if max(sig) < 0 and max(sig) > -1e-3:\n",
314+
" zero_level = max(sig) - 1e-12\n",
318315
"\n",
319316
" if min(sig) == 0:\n",
320317
" zero_level = 1e-12\n",
321318
"\n",
322319
" if max(sig) == 0:\n",
323320
" zero_level = -1e-12\n",
324321
"\n",
325-
" CS = ax.tricontour(\n",
322+
" ax.tricontour(\n",
326323
" triang, sig, [zero_level], linewidths=1, linestyles=\"dashed\"\n",
327324
" )\n",
328325
"\n",
@@ -409,7 +406,6 @@
409406
"\n",
410407
"from PIL import Image\n",
411408
"\n",
412-
"\n",
413409
"# filepaths\n",
414410
"fp_in = \"anim/*.png\"\n",
415411
"fp_out = \"anim.gif\"\n",
@@ -444,7 +440,7 @@
444440
"name": "python",
445441
"nbconvert_exporter": "python",
446442
"pygments_lexer": "ipython3",
447-
"version": "3.8.12"
443+
"version": "3.12.7"
448444
}
449445
},
450446
"nbformat": 4,

docs/_static/doc_plots/add_bar_context.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import numpy as np
88
import sectionproperties.pre.library.primitive_sections as sp_ps
99

10-
1110
if TYPE_CHECKING:
1211
from sectionproperties.pre.geometry import CompoundGeometry, Geometry
1312

docs/_static/logo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
"""Script to generate the concreteproperties logo."""
2+
13
from sectionproperties.analysis.section import Section
24
from sectionproperties.pre.geometry import Geometry
35
from sectionproperties.pre.library.primitive_sections import circular_section
46
from sectionproperties.pre.pre import Material
57

6-
78
concrete = Material(
89
name="Concrete",
910
elastic_modulus=30.1e3,

docs/examples/biaxial_bending.ipynb

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,10 @@
211211
"outputs": [],
212212
"source": [
213213
"n_list = np.linspace(0, 7400e3, 5)\n",
214-
"biaxial_results = []\n",
215-
"\n",
216-
"for n in n_list:\n",
217-
" biaxial_results.append(\n",
218-
" conc_sec.biaxial_bending_diagram(n=n, n_points=24, progress_bar=False)\n",
219-
" )"
214+
"biaxial_results = [\n",
215+
" conc_sec.biaxial_bending_diagram(n=n, n_points=24, progress_bar=False)\n",
216+
" for n in n_list\n",
217+
"]"
220218
]
221219
},
222220
{
@@ -270,19 +268,15 @@
270268
"metadata": {},
271269
"outputs": [],
272270
"source": [
273-
"labels = []\n",
271+
"import matplotlib.pyplot as plt\n",
274272
"\n",
275-
"for bb_res in biaxial_results[::2]:\n",
276-
" labels.append(f\"N = {bb_res.n / 1e3:.0f} kN\")\n",
273+
"labels = [f\"N = {bb_res.n / 1e3:.0f} kN\" for bb_rs in biaxial_results[::2]]\n",
277274
"\n",
278275
"ax = BiaxialBendingResults.plot_multiple_diagrams_2d(\n",
279276
" biaxial_results[::2], fmt=\"-\", labels=labels, render=False\n",
280277
")\n",
281278
"ax.set_xlabel(\"Bending Moment $M_x$ [kN.m]\")\n",
282279
"ax.set_ylabel(\"Bending Moment $M_y$ [kN.m]\")\n",
283-
"import matplotlib.pyplot as plt\n",
284-
"\n",
285-
"\n",
286280
"plt.show()"
287281
]
288282
}
@@ -303,7 +297,7 @@
303297
"name": "python",
304298
"nbconvert_exporter": "python",
305299
"pygments_lexer": "ipython3",
306-
"version": "3.11.4"
300+
"version": "3.12.7"
307301
}
308302
},
309303
"nbformat": 4,

docs/examples/composite_section.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,12 @@
598598
"metadata": {},
599599
"outputs": [],
600600
"source": [
601-
"print(\n",
602-
" f\"cx_geom = {conc_sec.moment_centroid[0]:.2f}; cy_geom = {conc_sec.moment_centroid[1]:.2f}\"\n",
603-
")\n",
604-
"print(\n",
605-
" f\"cx_gross = {conc_sec.gross_properties.cx_gross:.2f}; cy_gross = {conc_sec.gross_properties.cy_gross:.2f}\"\n",
606-
")"
601+
"cx_geom = conc_sec.moment_centroid[0]\n",
602+
"cy_geom = conc_sec.moment_centroid[1]\n",
603+
"cx_gross = conc_sec.gross_properties.cx_gross\n",
604+
"cy_gross = conc_sec.gross_properties.cy_gross\n",
605+
"print(f\"cx_geom = {cx_geom:.2f}; cy_geom = {cy_geom:.2f}\")\n",
606+
"print(f\"cx_gross = {cx_gross:.2f}; cy_gross = {cy_gross:.2f}\")"
607607
]
608608
},
609609
{
@@ -716,7 +716,7 @@
716716
"name": "python",
717717
"nbconvert_exporter": "python",
718718
"pygments_lexer": "ipython3",
719-
"version": "3.11.4"
719+
"version": "3.12.7"
720720
},
721721
"vscode": {
722722
"interpreter": {

docs/examples/moment_curvature.ipynb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,8 @@
326326
"metadata": {},
327327
"outputs": [],
328328
"source": [
329-
"print(\n",
330-
" f\"M_cr = {conc_sec.calculate_cracked_properties(theta=np.pi / 2).m_cr / 1e6:.2f} kN.m\"\n",
331-
")"
329+
"m_cr = conc_sec.calculate_cracked_properties(theta=np.pi / 2).m_cr / 1e6\n",
330+
"print(f\"M_cr = {m_cr:.2f} kN.m\")"
332331
]
333332
},
334333
{
@@ -348,7 +347,6 @@
348347
"source": [
349348
"import matplotlib.pyplot as plt\n",
350349
"\n",
351-
"\n",
352350
"fix, ax = plt.subplots()\n",
353351
"kappa = np.array(moment_curvature_results[-1].kappa)\n",
354352
"moment = np.array(moment_curvature_results[-1].m_xy) / 1e6\n",
@@ -700,7 +698,7 @@
700698
"name": "python",
701699
"nbconvert_exporter": "python",
702700
"pygments_lexer": "ipython3",
703-
"version": "3.11.4"
701+
"version": "3.12.7"
704702
},
705703
"vscode": {
706704
"interpreter": {

docs/examples/moment_interaction.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,11 @@
378378
"metadata": {},
379379
"outputs": [],
380380
"source": [
381-
"ax = mi_res.plot_diagram(fmt=\"-kx\", labels=True, label_offset=True, render=False)\n",
382-
"\n",
383-
"# reset axis limits to ensure labels are within plot\n",
384381
"import matplotlib.pyplot as plt\n",
385382
"\n",
383+
"ax = mi_res.plot_diagram(fmt=\"-kx\", labels=True, label_offset=True, render=False)\n",
386384
"\n",
385+
"# reset axis limits to ensure labels are within plot\n",
387386
"ax.set_xlim(-20, 850)\n",
388387
"ax.set_ylim(-3000, 9000)\n",
389388
"plt.show()"
@@ -406,7 +405,7 @@
406405
"name": "python",
407406
"nbconvert_exporter": "python",
408407
"pygments_lexer": "ipython3",
409-
"version": "3.11.4"
408+
"version": "3.12.7"
410409
},
411410
"vscode": {
412411
"interpreter": {

0 commit comments

Comments
 (0)