Skip to content

Commit ba96dde

Browse files
🎨 Format Python code with psf/black (#129)
Co-authored-by: ccaprani <31228546+ccaprani@users.noreply.github.com>
1 parent f23ab4a commit ba96dde

4 files changed

Lines changed: 37 additions & 21 deletions

File tree

src/pycba/load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def get_cnl(self, L: float, eType: int) -> LoadCNL:
516516
if c <= 0:
517517
return LoadCNL(Va=0.0, Vb=0.0, Ma=0.0, Mb=0.0)
518518

519-
alpha = L - a # distance: load start → right beam end
519+
alpha = L - a # distance: load start → right beam end
520520
# delta = L - a - c # distance: load end → right beam end (not used directly)
521521

522522
# --- Ma: ∫ w(x) · x · (L−x)² dx / L² ---

src/pycba/results.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ class BeamResults:
1818
BeamResults Class for processing and containing the results for each member
1919
"""
2020

21-
def __init__(self, beam: Beam, d: np.ndarray, r: np.ndarray, npts: int = 100, rs: np.ndarray = None):
21+
def __init__(
22+
self,
23+
beam: Beam,
24+
d: np.ndarray,
25+
r: np.ndarray,
26+
npts: int = 100,
27+
rs: np.ndarray = None,
28+
):
2229
"""
2330
Initialize member results from global results
2431
@@ -235,18 +242,30 @@ def __init__(self, vResults: List[MemberResults]):
235242
self.nsup = len(vResults[0].R)
236243

237244
(
238-
self.Vmax, self.Vmin,
239-
self.Mmax, self.Mmin,
240-
self.Vco_Mmax, self.Vco_Mmin,
241-
self.Mco_Vmax, self.Mco_Vmin,
245+
self.Vmax,
246+
self.Vmin,
247+
self.Mmax,
248+
self.Mmin,
249+
self.Vco_Mmax,
250+
self.Vco_Mmin,
251+
self.Mco_Vmax,
252+
self.Mco_Vmin,
242253
) = self._get_envelopes_VM()
243254
self.Rmax, self.Rmin = self._get_envelope_R()
244255
self.Rmaxval = self.Rmax.max(axis=1)
245256
self.Rminval = self.Rmin.min(axis=1)
246257

247-
def _get_envelopes_VM(self) -> Tuple[
248-
np.ndarray, np.ndarray, np.ndarray, np.ndarray,
249-
np.ndarray, np.ndarray, np.ndarray, np.ndarray,
258+
def _get_envelopes_VM(
259+
self,
260+
) -> Tuple[
261+
np.ndarray,
262+
np.ndarray,
263+
np.ndarray,
264+
np.ndarray,
265+
np.ndarray,
266+
np.ndarray,
267+
np.ndarray,
268+
np.ndarray,
250269
]:
251270
"""
252271
Creates the envelopes for shear and moment, and tracks the coincident

tests/test_basic.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,9 @@ def test_prescribed_settlement_no_load():
598598
r = ba.beam_results.R
599599
assert r == pytest.approx(
600600
[
601-
-3 * EI * delta / L**3, # vertical reaction at A
602-
-3 * EI * delta / L**2, # moment reaction at A
603-
3 * EI * delta / L**3, # vertical reaction at B
601+
-3 * EI * delta / L**3, # vertical reaction at A
602+
-3 * EI * delta / L**2, # moment reaction at A
603+
3 * EI * delta / L**3, # vertical reaction at B
604604
],
605605
abs=1e-6,
606606
)
@@ -674,7 +674,7 @@ def test_spring_prescribed_displacement_error():
674674
ks = 1e5
675675
w = 10.0
676676
R = [-1, 0, ks, 0, -1, 0]
677-
LM = [[1, 1, w, 0, 0]] # UDL on span 1 → non-zero CNL at DOF 2
677+
LM = [[1, 1, w, 0, 0]] # UDL on span 1 → non-zero CNL at DOF 2
678678
D = [None, None, -0.005, None, None, None]
679679

680680
ba = cba.BeamAnalysis(L, EI, R, LM, D=D)
@@ -976,10 +976,10 @@ def test_trapezoidal_factor_LM():
976976
gamma = 1.5
977977
LM_f = factor_LM(LM, gamma)
978978

979-
assert LM_f[0][2] == pytest.approx(6.0) # w1 * 1.5
979+
assert LM_f[0][2] == pytest.approx(6.0) # w1 * 1.5
980980
assert LM_f[0][3] == pytest.approx(15.0) # w2 * 1.5
981-
assert LM_f[0][4] == pytest.approx(2.0) # a unchanged
982-
assert LM_f[0][5] == pytest.approx(5.0) # c unchanged
981+
assert LM_f[0][4] == pytest.approx(2.0) # a unchanged
982+
assert LM_f[0][5] == pytest.approx(5.0) # c unchanged
983983

984984

985985
def test_unstable_structure_error():
@@ -989,10 +989,9 @@ def test_unstable_structure_error():
989989
"""
990990
L = [5.0]
991991
EI = 30 * 600e7 * 1e-6
992-
R = [0, 0, 0, 0] # no supports → singular stiffness matrix
992+
R = [0, 0, 0, 0] # no supports → singular stiffness matrix
993993
LM = [[1, 1, 10, 0, 0]]
994994

995995
ba = cba.BeamAnalysis(L, EI, R, LM)
996996
with pytest.raises(ValueError, match="geometrically unstable"):
997997
ba.analyze()
998-

tests/test_bridge.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ def test_coincident_at_every_point():
187187
for j in range(npts):
188188
# Only check points with significant Mmax (skip boundary/zero points)
189189
if env.Mmax[j] > 1.0:
190-
assert env.Vco_Mmax[j] == pytest.approx(
191-
V_all[idx_mmax[j], j], abs=1e-6
192-
)
190+
assert env.Vco_Mmax[j] == pytest.approx(V_all[idx_mmax[j], j], abs=1e-6)
193191
checked += 1
194192

195193
# Ensure we checked a meaningful number of points

0 commit comments

Comments
 (0)