Skip to content

Commit 08307b0

Browse files
Merge pull request #90 from robbievanleeuwen/dev
Bump sectionproperties to 3.1.0, add nbQA, add flake8-pytest-style
2 parents 8976127 + 639a254 commit 08307b0

20 files changed

+232
-121
lines changed

.flake8

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
[flake8]
2-
select = B,B9,C,D,DAR,E,F,N,RST,S,W
2+
select = B,B9,C,D,DAR,E,F,N,PT,RST,S,W
33
ignore = B028,B905,E203,E501,E741,RST201,RST203,RST301,RST303,W503
44
max-line-length = 80
55
docstring-convention = google
66
per-file-ignores = tests/*:S101,__init__.py:F401,post.py:C901
77
rst-roles = class,const,func,meth,mod,ref
88
rst-directives = deprecated
9+
pytest-fixture-no-parentheses = True
10+
pytest-mark-no-parentheses = True

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,14 @@ repos:
6868
rev: 0.6.1
6969
hooks:
7070
- id: nbstripout
71+
- repo: https://github.com/nbQA-dev/nbQA
72+
rev: 1.7.0
73+
hooks:
74+
- id: nbqa-black
75+
additional_dependencies: [black==23.9.1]
76+
- id: nbqa-pyupgrade
77+
additional_dependencies: [pyupgrade==3.14.0]
78+
args: ["--py39-plus"]
79+
- id: nbqa-isort
80+
additional_dependencies: [isort==5.12.0]
81+
args: [--profile=black]

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Now that you have all the dependencies up and running, you can install
7979
```shell
8080
git clone https://github.com/robbievanleeuwen/concrete-properties.git
8181
cd concrete-properties
82-
poetry install --all-extras
82+
poetry install
8383
```
8484

8585
You can now run an interactive Python session, or the command-line interface:

docs/_static/animation.ipynb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
20-
"import concreteproperties.stress_strain_profile as ssp\n",
2120
"import numpy as np\n",
21+
"from sectionproperties.pre.geometry import Geometry\n",
22+
"from shapely import Polygon\n",
23+
"\n",
24+
"import concreteproperties.stress_strain_profile as ssp\n",
2225
"from concreteproperties.concrete_section import ConcreteSection\n",
2326
"from concreteproperties.material import Concrete, SteelBar\n",
24-
"from concreteproperties.pre import add_bar_rectangular_array\n",
25-
"from sectionproperties.pre.geometry import Geometry\n",
26-
"from shapely import Polygon"
27+
"from concreteproperties.pre import add_bar_rectangular_array"
2728
]
2829
},
2930
{
@@ -241,10 +242,11 @@
241242
"import matplotlib.patches as mpatches\n",
242243
"import matplotlib.pyplot as plt\n",
243244
"import matplotlib.tri as tri\n",
244-
"from concreteproperties.post import plotting_context\n",
245245
"from matplotlib.collections import PatchCollection\n",
246246
"from matplotlib.colors import CenteredNorm\n",
247247
"\n",
248+
"from concreteproperties.post import plotting_context\n",
249+
"\n",
248250
"\n",
249251
"def plot_stress_and_graph(res_idx, mk_res_list, k_list, m_list, **kwargs):\n",
250252
" with plotting_context(title=\"Stress\", **kwargs) as (fig, ax):\n",
@@ -404,8 +406,10 @@
404406
"outputs": [],
405407
"source": [
406408
"import glob\n",
409+
"\n",
407410
"from PIL import Image\n",
408411
"\n",
412+
"\n",
409413
"# filepaths\n",
410414
"fp_in = \"anim/*.png\"\n",
411415
"fp_out = \"anim.gif\"\n",

docs/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Now that you have all the dependencies up and running, you can install
9191
9292
git clone https://github.com/robbievanleeuwen/concrete-properties.git
9393
cd concrete-properties
94-
poetry install --all-extras
94+
poetry install
9595
9696
You can now run an interactive Python session, or the command-line interface:
9797

docs/examples/area_properties.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@
2323
"metadata": {},
2424
"outputs": [],
2525
"source": [
26+
"from sectionproperties.pre.library import concrete_rectangular_section\n",
27+
"\n",
2628
"from concreteproperties import (\n",
2729
" Concrete,\n",
28-
" SteelBar,\n",
2930
" ConcreteLinear,\n",
31+
" ConcreteSection,\n",
3032
" RectangularStressBlock,\n",
33+
" SteelBar,\n",
3134
" SteelElasticPlastic,\n",
32-
" ConcreteSection,\n",
33-
")\n",
34-
"from sectionproperties.pre.library import concrete_rectangular_section"
35+
")"
3536
]
3637
},
3738
{

docs/examples/as3600.ipynb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@
1616
"metadata": {},
1717
"outputs": [],
1818
"source": [
19-
"import numpy as np\n",
2019
"import matplotlib.pyplot as plt\n",
21-
"from concreteproperties.design_codes import AS3600\n",
20+
"import numpy as np\n",
21+
"from sectionproperties.pre.library import concrete_rectangular_section\n",
22+
"\n",
2223
"from concreteproperties import (\n",
23-
" RectangularStressBlock,\n",
2424
" BilinearStressStrain,\n",
25-
" EurocodeParabolicUltimate,\n",
2625
" ConcreteSection,\n",
26+
" EurocodeParabolicUltimate,\n",
27+
" RectangularStressBlock,\n",
2728
")\n",
28-
"from sectionproperties.pre.library import concrete_rectangular_section\n",
29+
"from concreteproperties.design_codes import AS3600\n",
2930
"from concreteproperties.results import MomentInteractionResults"
3031
]
3132
},
@@ -262,7 +263,7 @@
262263
"n_list, _ = mi_res.get_results_lists(moment=\"m_x\") # get list of axial loads\n",
263264
"ax.plot(np.array(n_list) / 1e3, phis, \"-x\")\n",
264265
"plt.xlabel(\"Axial Force [kN]\")\n",
265-
"plt.ylabel(\"$\\phi$\")\n",
266+
"plt.ylabel(r\"$\\phi$\")\n",
266267
"plt.grid()\n",
267268
"plt.show()"
268269
]

docs/examples/biaxial_bending.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,17 @@
2424
"outputs": [],
2525
"source": [
2626
"import numpy as np\n",
27+
"from sectionproperties.pre.library import rectangular_section\n",
28+
"\n",
2729
"from concreteproperties import (\n",
2830
" Concrete,\n",
29-
" SteelBar,\n",
3031
" ConcreteLinear,\n",
32+
" ConcreteSection,\n",
3133
" RectangularStressBlock,\n",
34+
" SteelBar,\n",
3235
" SteelElasticPlastic,\n",
3336
" add_bar_rectangular_array,\n",
34-
" ConcreteSection,\n",
3537
")\n",
36-
"from sectionproperties.pre.library import rectangular_section\n",
3738
"from concreteproperties.results import BiaxialBendingResults"
3839
]
3940
},
@@ -281,6 +282,7 @@
281282
"ax.set_ylabel(\"Bending Moment $M_y$ [kN.m]\")\n",
282283
"import matplotlib.pyplot as plt\n",
283284
"\n",
285+
"\n",
284286
"plt.show()"
285287
]
286288
}

docs/examples/composite_section.ipynb

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,25 @@
2424
"outputs": [],
2525
"source": [
2626
"import numpy as np\n",
27+
"from sectionproperties.pre.library import (\n",
28+
" circular_section_by_area,\n",
29+
" concrete_circular_section,\n",
30+
" i_section,\n",
31+
" rectangular_section,\n",
32+
")\n",
33+
"\n",
34+
"import concreteproperties.results as res\n",
2735
"from concreteproperties import (\n",
2836
" Concrete,\n",
29-
" Steel,\n",
30-
" SteelBar,\n",
3137
" ConcreteLinearNoTension,\n",
38+
" ConcreteSection,\n",
3239
" RectangularStressBlock,\n",
40+
" Steel,\n",
41+
" SteelBar,\n",
3342
" SteelElasticPlastic,\n",
3443
" add_bar_circular_array,\n",
3544
" add_bar_rectangular_array,\n",
36-
" ConcreteSection,\n",
37-
")\n",
38-
"from sectionproperties.pre.library import (\n",
39-
" rectangular_section,\n",
40-
" circular_section_by_area,\n",
41-
" i_section,\n",
42-
" concrete_circular_section,\n",
43-
")\n",
44-
"import concreteproperties.results as res"
45+
")"
4546
]
4647
},
4748
{

docs/examples/cracked_properties.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@
2424
"outputs": [],
2525
"source": [
2626
"import numpy as np\n",
27+
"from sectionproperties.pre.library import concrete_tee_section\n",
28+
"\n",
2729
"from concreteproperties import (\n",
2830
" Concrete,\n",
29-
" SteelBar,\n",
3031
" ConcreteLinear,\n",
32+
" ConcreteSection,\n",
3133
" RectangularStressBlock,\n",
34+
" SteelBar,\n",
3235
" SteelElasticPlastic,\n",
33-
" ConcreteSection,\n",
34-
")\n",
35-
"from sectionproperties.pre.library import concrete_tee_section"
36+
")"
3637
]
3738
},
3839
{

docs/examples/moment_curvature.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
"outputs": [],
2525
"source": [
2626
"import numpy as np\n",
27-
"from sectionproperties.pre.library import rectangular_section, circular_section\n",
27+
"from sectionproperties.pre.library import circular_section, rectangular_section\n",
28+
"\n",
29+
"import concreteproperties.stress_strain_profile as ssp\n",
2830
"from concreteproperties import (\n",
2931
" Concrete,\n",
32+
" ConcreteSection,\n",
3033
" SteelBar,\n",
3134
" add_bar_rectangular_array,\n",
32-
" ConcreteSection,\n",
3335
")\n",
34-
"import concreteproperties.stress_strain_profile as ssp\n",
3536
"from concreteproperties.results import MomentCurvatureResults"
3637
]
3738
},
@@ -347,6 +348,7 @@
347348
"source": [
348349
"import matplotlib.pyplot as plt\n",
349350
"\n",
351+
"\n",
350352
"fix, ax = plt.subplots()\n",
351353
"kappa = np.array(moment_curvature_results[-1].kappa)\n",
352354
"moment = np.array(moment_curvature_results[-1].m_xy) / 1e6\n",

docs/examples/moment_interaction.ipynb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,17 @@
2424
"outputs": [],
2525
"source": [
2626
"import numpy as np\n",
27+
"from sectionproperties.pre.library import concrete_rectangular_section\n",
28+
"\n",
2729
"from concreteproperties import (\n",
2830
" Concrete,\n",
29-
" SteelBar,\n",
3031
" ConcreteLinear,\n",
32+
" ConcreteSection,\n",
3133
" RectangularStressBlock,\n",
34+
" SteelBar,\n",
3235
" SteelElasticPlastic,\n",
33-
" ConcreteSection,\n",
3436
")\n",
35-
"from concreteproperties.results import MomentInteractionResults\n",
36-
"from sectionproperties.pre.library import concrete_rectangular_section"
37+
"from concreteproperties.results import MomentInteractionResults"
3738
]
3839
},
3940
{
@@ -209,7 +210,7 @@
209210
"\n",
210211
" conc_sec = ConcreteSection(geom)\n",
211212
" mi_results.append(conc_sec.moment_interaction_diagram(progress_bar=False))\n",
212-
" labels.append(\"p = {0}\".format(0.01 * (idx + 1)))"
213+
" labels.append(f\"p = {0.01 * (idx + 1)}\")"
213214
]
214215
},
215216
{
@@ -382,6 +383,7 @@
382383
"# reset axis limits to ensure labels are within plot\n",
383384
"import matplotlib.pyplot as plt\n",
384385
"\n",
386+
"\n",
385387
"ax.set_xlim(-20, 850)\n",
386388
"ax.set_ylim(-3000, 9000)\n",
387389
"plt.show()"

docs/examples/nzs3101.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,21 @@
1616
"metadata": {},
1717
"outputs": [],
1818
"source": [
19-
"import numpy as np\n",
2019
"import matplotlib.pyplot as plt\n",
21-
"\n",
20+
"import numpy as np\n",
2221
"from sectionproperties.pre.library import concrete_rectangular_section\n",
2322
"\n",
24-
"from concreteproperties.design_codes import NZS3101\n",
2523
"from concreteproperties import (\n",
2624
" Concrete,\n",
25+
" ConcreteSection,\n",
2726
" ModifiedMander,\n",
2827
" RectangularStressBlock,\n",
29-
" ConcreteSection,\n",
3028
")\n",
29+
"from concreteproperties.design_codes import NZS3101\n",
3130
"from concreteproperties.results import (\n",
32-
" MomentInteractionResults,\n",
3331
" BiaxialBendingResults,\n",
3432
" MomentCurvatureResults,\n",
33+
" MomentInteractionResults,\n",
3534
")"
3635
]
3736
},

docs/examples/prestressed_section.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@
2828
"from sectionproperties.pre.library import rectangular_section\n",
2929
"\n",
3030
"from concreteproperties import (\n",
31-
" Concrete,\n",
32-
" SteelStrand,\n",
33-
" EurocodeNonLinear,\n",
3431
" BilinearStressStrain,\n",
32+
" Concrete,\n",
3533
" ConcreteLinearNoTension,\n",
34+
" EurocodeNonLinear,\n",
35+
" PrestressedSection,\n",
36+
" SteelStrand,\n",
3637
" StrandHardening,\n",
3738
" add_bar_rectangular_array,\n",
38-
" PrestressedSection,\n",
3939
")\n",
40-
"\n",
4140
"from concreteproperties.results import MomentCurvatureResults"
4241
]
4342
},

docs/examples/stress_analysis.ipynb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
"source": [
2626
"import numpy as np\n",
2727
"from rich.pretty import pprint\n",
28+
"from sectionproperties.pre.library import concrete_circular_section\n",
29+
"\n",
2830
"from concreteproperties import (\n",
2931
" Concrete,\n",
30-
" SteelBar,\n",
32+
" ConcreteSection,\n",
3133
" EurocodeNonLinear,\n",
3234
" RectangularStressBlock,\n",
35+
" SteelBar,\n",
3336
" SteelElasticPlastic,\n",
34-
" ConcreteSection,\n",
35-
")\n",
36-
"from sectionproperties.pre.library import concrete_circular_section"
37+
")"
3738
]
3839
},
3940
{
@@ -278,8 +279,9 @@
278279
"metadata": {},
279280
"outputs": [],
280281
"source": [
281-
"from rich.table import Table\n",
282282
"from rich.console import Console\n",
283+
"from rich.table import Table\n",
284+
"\n",
283285
"\n",
284286
"# store forces & moments for later\n",
285287
"forces = []\n",

docs/examples/ultimate_bending.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
"outputs": [],
2525
"source": [
2626
"import numpy as np\n",
27+
"from sectionproperties.pre.library import rectangular_section, triangular_section\n",
28+
"\n",
29+
"import concreteproperties.stress_strain_profile as ssp\n",
2730
"from concreteproperties import (\n",
2831
" Concrete,\n",
32+
" ConcreteSection,\n",
2933
" SteelBar,\n",
3034
" add_bar_rectangular_array,\n",
31-
" ConcreteSection,\n",
32-
")\n",
33-
"import concreteproperties.stress_strain_profile as ssp\n",
34-
"from sectionproperties.pre.library import rectangular_section, triangular_section"
35+
")"
3536
]
3637
},
3738
{

0 commit comments

Comments
 (0)