Skip to content

Commit b2ce4ca

Browse files
Add defaults to public docstrings
1 parent 9f5bdbb commit b2ce4ca

File tree

15 files changed

+325
-217
lines changed

15 files changed

+325
-217
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: CI
22

33
on:
4+
push:
5+
branches:
6+
- master
47
pull_request:
58
types: [opened, reopened, synchronize]
69

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
- dev
87

98
env:
109
UV_VERSION: "0.4.26"
@@ -37,12 +36,12 @@ jobs:
3736
if: ${{ env.sha }}
3837
uses: salsify/action-detect-and-tag-new-version@v2
3938
with:
40-
version-command: uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version
39+
version-command: echo $(grep "^version =" pyproject.toml | sed 's/version = "\(.*\)"/\1/')
4140

4241
- name: Bump version for dev release
4342
if: "! steps.check-version.outputs.tag"
4443
run: |
45-
VERSION=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)
44+
VERSION=$(grep "^version =" pyproject.toml | sed 's/version = "\(.*\)"/\1/')
4645
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION.dev.$(date +%s)
4746
4847
- name: Build package
@@ -61,7 +60,7 @@ jobs:
6160
with:
6261
user: __token__
6362
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
64-
repository_url: https://test.pypi.org/legacy/
63+
repository-url: https://test.pypi.org/legacy/
6564

6665
- name: Publish the release notes
6766
uses: release-drafter/release-drafter@v6

src/sectionproperties/analysis/fea.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ def _assemble_torsion(
9494

9595
@njit(cache=True, nogil=True)
9696
def _shear_parameter(
97-
nx: float, ny: float, ixx: float, iyy: float, ixy: float
97+
nx: float,
98+
ny: float,
99+
ixx: float,
100+
iyy: float,
101+
ixy: float,
98102
) -> tuple[float, float, float, float, float, float]:
99103
"""Utility function for calculating the shear parameters.
100104

src/sectionproperties/analysis/section.py

Lines changed: 63 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def __init__(
7373
Args:
7474
geometry: Cross-section geometry object used to generate the mesh
7575
time_info: If set to True, a detailed description of the computation and the
76-
time cost is printed to the terminal for every computation performed
76+
time cost is printed to the terminal for every computation performed.
77+
Defaults to ``False``.
7778
7879
Raises:
7980
ValueError: If geometry does not contain a mesh
@@ -301,7 +302,8 @@ def calculate_warping_properties(
301302
302303
Args:
303304
solver_type: Solver used for solving systems of linear equations, either
304-
using the ``"direct"`` method or ``"cgs"`` iterative method
305+
using the ``"direct"`` method or ``"cgs"`` iterative method. Defaults to
306+
``"direct"``.
305307
306308
Raises:
307309
RuntimeError: If the geometric properties have not been calculated prior to
@@ -811,7 +813,8 @@ def calculate_frame_properties(
811813
812814
Args:
813815
solver_type: Solver used for solving systems of linear equations, either
814-
using the ``"direct"`` method or ``"cgs"`` iterative method
816+
using the ``"direct"`` method or ``"cgs"`` iterative method. Defaults to
817+
``"direct"``.
815818
816819
Returns:
817820
Cross-section properties to be used for a frame analysis (``area``, ``ixx``,
@@ -1095,7 +1098,7 @@ def calculate_plastic_properties(
10951098
10961099
Args:
10971100
verbose: If set to True, the number of iterations required for each plastic
1098-
axis is printed to the terminal.
1101+
axis is printed to the terminal. Defaults to ``False``.
10991102
11001103
Raises:
11011104
RuntimeError: If the geometric properties have not been calculated prior to
@@ -1185,14 +1188,14 @@ def calculate_stress(
11851188
post-processing of the stress results.
11861189
11871190
Args:
1188-
n: Axial force
1189-
vx: Shear force acting in the x-direction
1190-
vy: Shear force acting in the y-direction
1191-
mxx: Bending moment about the centroidal xx-axis
1192-
myy: Bending moment about the centroidal yy-axis
1193-
m11: Bending moment about the centroidal 11-axis
1194-
m22: Bending moment about the centroidal 22-axis
1195-
mzz: Torsion moment about the centroidal zz-axis
1191+
n: Axial force. Defaults to ``0.0``.
1192+
vx: Shear force acting in the x-direction. Defaults to ``0.0``.
1193+
vy: Shear force acting in the y-direction. Defaults to ``0.0``.
1194+
mxx: Bending moment about the centroidal xx-axis. Defaults to ``0.0``.
1195+
myy: Bending moment about the centroidal yy-axis. Defaults to ``0.0``.
1196+
m11: Bending moment about the centroidal 11-axis. Defaults to ``0.0``.
1197+
m22: Bending moment about the centroidal 22-axis. Defaults to ``0.0``.
1198+
mzz: Torsion moment about the centroidal zz-axis. Defaults to ``0.0``.
11961199
11971200
Returns:
11981201
Object for post-processing cross-section stresses
@@ -1475,11 +1478,13 @@ def plot_mesh(
14751478
r"""Plots the finite element mesh.
14761479
14771480
Args:
1478-
alpha: Transparency of the mesh outlines: :math:`0 \leq \alpha \leq 1`
1481+
alpha: Transparency of the mesh outlines: :math:`0 \leq \alpha \leq 1`.
1482+
Defaults to ``0.5``.
14791483
materials: If set to True shades the elements with the specified material
1480-
colors
1481-
mask: Mask array, of length ``num_nodes``, to mask out triangles
1482-
title: Plot title
1484+
colors. Defaults to ``True``.
1485+
mask: Mask array, of length ``num_nodes``, to mask out triangles. Defaults
1486+
to ``None``.
1487+
title: Plot title. Defaults to ``"Finite Element Mesh"``.
14831488
kwargs: Passed to :func:`~sectionproperties.post.post.plotting_context`
14841489
14851490
Returns:
@@ -1594,8 +1599,9 @@ def plot_centroids(
15941599
principal axis, if they have been calculated, on top of the finite element mesh.
15951600
15961601
Args:
1597-
alpha: Transparency of the mesh outlines: :math:`0 \leq \alpha \leq 1`
1598-
title: Plot title
1602+
alpha: Transparency of the mesh outlines: :math:`0 \leq \alpha \leq 1`.
1603+
Defaults to ``0.5``.
1604+
title: Plot title. Defaults to ``"Centroids"``.
15991605
kwargs: Passed to :func:`~sectionproperties.post.post.plotting_context`
16001606
16011607
Returns:
@@ -1708,11 +1714,13 @@ def plot_warping_function(
17081714
r"""Plots the warping function over the mesh.
17091715
17101716
Args:
1711-
title: Plot title
1712-
level: Number of contour levels
1713-
cmap: Colormap
1714-
with_lines: If set to True, contour lines are displayed
1715-
alpha: Transparency of the mesh outlines: :math:`0 \leq \alpha \leq 1`
1717+
title: Plot title. Defaults to ``"Warping Function"``.
1718+
level: Number of contour levels. Defaults to ``20``.
1719+
cmap: Colormap. Defaults to ``"viridis"``.
1720+
alpha: Transparency of the mesh outlines: :math:`0 \leq \alpha \leq 1`.
1721+
Defaults to ``0.2``.
1722+
with_lines: If set to True, contour lines are displayed. Defaults to
1723+
``True``.
17161724
kwargs: Passed to :func:`~sectionproperties.post.post.plotting_context`
17171725
17181726
Raises:
@@ -1783,7 +1791,7 @@ def display_results(
17831791
17841792
Args:
17851793
fmt: Number formatting string, see
1786-
https://docs.python.org/3/library/string.html
1794+
https://docs.python.org/3/library/string.html. Defaults to ``"8.6e"``.
17871795
"""
17881796
post.print_results(section=self, fmt=fmt)
17891797

@@ -1873,7 +1881,7 @@ def get_mass(self) -> float:
18731881

18741882
def get_ea(
18751883
self,
1876-
e_ref: float | pre.Material = 1,
1884+
e_ref: float | pre.Material = 1.0,
18771885
) -> float:
18781886
"""Returns the cross-section axial rigidity.
18791887
@@ -1885,7 +1893,7 @@ def get_ea(
18851893
18861894
Args:
18871895
e_ref: Reference elastic modulus or material property by which to transform
1888-
the results
1896+
the results. Defaults to ``1.0``.
18891897
18901898
Returns:
18911899
Modulus weighted area (axial rigidity)
@@ -1935,7 +1943,7 @@ def get_q(self) -> tuple[float, float]:
19351943

19361944
def get_eq(
19371945
self,
1938-
e_ref: float | pre.Material = 1,
1946+
e_ref: float | pre.Material = 1.0,
19391947
) -> tuple[float, float]:
19401948
"""Returns the modulus-weighted cross-section first moments of area.
19411949
@@ -1947,7 +1955,7 @@ def get_eq(
19471955
19481956
Args:
19491957
e_ref: Reference elastic modulus or material property by which to transform
1950-
the results
1958+
the results. Defaults to ``1.0``.
19511959
19521960
Returns:
19531961
Modulus-weighted first moments of area about the global axis (``e.qx``,
@@ -2007,7 +2015,7 @@ def get_ig(self) -> tuple[float, float, float]:
20072015

20082016
def get_eig(
20092017
self,
2010-
e_ref: float | pre.Material = 1,
2018+
e_ref: float | pre.Material = 1.0,
20112019
) -> tuple[float, float, float]:
20122020
"""Returns the modulus-weighted cross-section global second moments of area.
20132021
@@ -2019,7 +2027,7 @@ def get_eig(
20192027
20202028
Args:
20212029
e_ref: Reference elastic modulus or material property by which to transform
2022-
the results
2030+
the results. Defaults to ``1.0``.
20232031
20242032
Returns:
20252033
Modulus weighted second moments of area about the global axis (``e.ixx_g``,
@@ -2102,7 +2110,7 @@ def get_ic(self) -> tuple[float, float, float]:
21022110

21032111
def get_eic(
21042112
self,
2105-
e_ref: float | pre.Material = 1,
2113+
e_ref: float | pre.Material = 1.0,
21062114
) -> tuple[float, float, float]:
21072115
"""Returns the modulus-weighted cross-section centroidal second moments of area.
21082116
@@ -2114,7 +2122,7 @@ def get_eic(
21142122
21152123
Args:
21162124
e_ref: Reference elastic modulus or material property by which to transform
2117-
the results
2125+
the results. Defaults to ``1.0``.
21182126
21192127
Returns:
21202128
Modulus weighted second moments of area about the centroidal axis
@@ -2184,7 +2192,7 @@ def get_z(self) -> tuple[float, float, float, float]:
21842192

21852193
def get_ez(
21862194
self,
2187-
e_ref: float | pre.Material = 1,
2195+
e_ref: float | pre.Material = 1.0,
21882196
) -> tuple[float, float, float, float]:
21892197
"""Returns the modulus-weighted cross-section centroidal elastic section moduli.
21902198
@@ -2196,7 +2204,7 @@ def get_ez(
21962204
21972205
Args:
21982206
e_ref: Reference elastic modulus or material property by which to transform
2199-
the results
2207+
the results. Defaults to ``1.0``.
22002208
22012209
Returns:
22022210
Modulus weighted elastic section moduli about the centroidal axis with
@@ -2273,7 +2281,7 @@ def get_ip(self) -> tuple[float, float]:
22732281

22742282
def get_eip(
22752283
self,
2276-
e_ref: float | pre.Material = 1,
2284+
e_ref: float | pre.Material = 1.0,
22772285
) -> tuple[float, float]:
22782286
"""Returns the modulus-weighted cross-section principal second moments of area.
22792287
@@ -2285,7 +2293,7 @@ def get_eip(
22852293
22862294
Args:
22872295
e_ref: Reference elastic modulus or material property by which to transform
2288-
the results
2296+
the results. Defaults to ``1.0``.
22892297
22902298
Returns:
22912299
Modulus weighted second moments of area about the principal axis
@@ -2362,7 +2370,7 @@ def get_zp(self) -> tuple[float, float, float, float]:
23622370

23632371
def get_ezp(
23642372
self,
2365-
e_ref: float | pre.Material = 1,
2373+
e_ref: float | pre.Material = 1.0,
23662374
) -> tuple[float, float, float, float]:
23672375
"""Returns the modulus-weighted cross-section principal elastic section moduli.
23682376
@@ -2374,7 +2382,7 @@ def get_ezp(
23742382
23752383
Args:
23762384
e_ref: Reference elastic modulus or material property by which to transform
2377-
the results
2385+
the results. Defaults to ``1.0``.
23782386
23792387
Returns:
23802388
Modulus weighted elastic section moduli about the principal axis with
@@ -2523,7 +2531,7 @@ def get_j(self) -> float:
25232531

25242532
def get_ej(
25252533
self,
2526-
e_ref: float | pre.Material = 1,
2534+
e_ref: float | pre.Material = 1.0,
25272535
) -> float:
25282536
"""Returns the modulus-weighted cross-section St Venant torsion constant.
25292537
@@ -2535,7 +2543,7 @@ def get_ej(
25352543
25362544
Args:
25372545
e_ref: Reference elastic modulus or material property by which to transform
2538-
the results
2546+
the results. Defaults to ``1.0``.
25392547
25402548
Returns:
25412549
Modulus weighted St. Venant torsion constant
@@ -2649,7 +2657,7 @@ def get_gamma(self) -> float:
26492657

26502658
def get_egamma(
26512659
self,
2652-
e_ref: float | pre.Material = 1,
2660+
e_ref: float | pre.Material = 1.0,
26532661
) -> float:
26542662
"""Returns the modulus-weighted cross-section warping constant.
26552663
@@ -2661,7 +2669,7 @@ def get_egamma(
26612669
26622670
Args:
26632671
e_ref: Reference elastic modulus or material property by which to transform
2664-
the results
2672+
the results. Defaults to ``1.0``.
26652673
26662674
Returns:
26672675
Modulus weighted warping constant
@@ -2711,7 +2719,7 @@ def get_as(self) -> tuple[float, float]:
27112719

27122720
def get_eas(
27132721
self,
2714-
e_ref: float | pre.Material = 1,
2722+
e_ref: float | pre.Material = 1.0,
27152723
) -> tuple[float, float]:
27162724
"""Returns modulus-weighted the cross-section centroidal axis shear area.
27172725
@@ -2723,7 +2731,7 @@ def get_eas(
27232731
27242732
Args:
27252733
e_ref: Reference elastic modulus or material property by which to transform
2726-
the results
2734+
the results. Defaults to ``1.0``.
27272735
27282736
Returns:
27292737
Modulus weighted shear area for loading about the centroidal axis
@@ -2776,7 +2784,7 @@ def get_as_p(self) -> tuple[float, float]:
27762784

27772785
def get_eas_p(
27782786
self,
2779-
e_ref: float | pre.Material = 1,
2787+
e_ref: float | pre.Material = 1.0,
27802788
) -> tuple[float, float]:
27812789
"""Returns the modulus-weighted cross-section princicpal axis shear area.
27822790
@@ -2788,7 +2796,7 @@ def get_eas_p(
27882796
27892797
Args:
27902798
e_ref: Reference elastic modulus or material property by which to transform
2791-
the results
2799+
the results. Defaults to ``1.0``.
27922800
27932801
Returns:
27942802
Modulus weighted shear area for loading about the princicpal bending axis
@@ -3118,17 +3126,18 @@ def get_stress_at_points(
31183126
Args:
31193127
pts: A list of points ``[(x, y), ..., ]``
31203128
n: Axial force
3121-
mxx: Bending moment about the centroidal xx-axis
3122-
myy: Bending moment about the centroidal yy-axis
3123-
m11: Bending moment about the centroidal 11-axis
3124-
m22: Bending moment about the centroidal 22-axis
3125-
mzz: Torsion moment about the centroidal zz-axis
3126-
vx: Shear force acting in the x-direction
3127-
vy: Shear force acting in the y-direction
3129+
mxx: Bending moment about the centroidal xx-axis. Defaults to ``0.0``.
3130+
myy: Bending moment about the centroidal yy-axis. Defaults to ``0.0``.
3131+
m11: Bending moment about the centroidal 11-axis. Defaults to ``0.0``.
3132+
m22: Bending moment about the centroidal 22-axis. Defaults to ``0.0``.
3133+
mzz: Torsion moment about the centroidal zz-axis. Defaults to ``0.0``.
3134+
vx: Shear force acting in the x-direction. Defaults to ``0.0``.
3135+
vy: Shear force acting in the y-direction. Defaults to ``0.0``.
31283136
agg_func: A function that aggregates the stresses if the point is shared by
31293137
several elements. If the point, ``pt``, is shared by several elements
31303138
(e.g. if it is a node or on an edge), the stresses are retrieved from
3131-
each element and combined according to this function.
3139+
each element and combined according to this function. Defaults to
3140+
``np.average``.
31323141
31333142
Raises:
31343143
RuntimeError: If a warping analysis has not been carried out and a shear

0 commit comments

Comments
 (0)