Skip to content

Commit 0774493

Browse files
reformatted code files using black and isort
1 parent 54a66cc commit 0774493

File tree

19 files changed

+191
-188
lines changed

19 files changed

+191
-188
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ $ pip install geolysis
8585
- **Ultimate Bearing Capacity (UBC)**
8686

8787
```python
88-
from geolysis.bearing_capacity.ubc import create_ubc_4_all_soil_types
88+
from geolysis.bearing_capacity.ubc import create_ubc_4_all_soils
8989
```
9090

9191
### Foundation

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ from geolysis.bearing_capacity.abc import create_abc_4_cohesionless_soils
6868
#### Ultimate Bearing Capacity (UBC)
6969

7070
```python
71-
from geolysis.bearing_capacity.ubc import create_ubc_4_all_soil_types
71+
from geolysis.bearing_capacity.ubc import create_ubc_4_all_soils
7272
```
7373

7474
### Foundation

docs/user_guide/ultimate-bearing-capacity.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ correlation:
55

66
```python
77

8-
>>> from geolysis.bearing_capacity.ubc import create_ubc_4_all_soil_types
9-
>>> hansen_ubc = create_ubc_4_all_soil_types(friction_angle=20.0,
10-
... cohesion=20.0,
11-
... moist_unit_wgt=18.0,
12-
... depth=1.5,
13-
... width=2.0,
14-
... shape="square",
15-
... ubc_type="vesic")
8+
>>> from geolysis.bearing_capacity.ubc import create_ubc_4_all_soils
9+
>>> hansen_ubc = create_ubc_4_all_soils(friction_angle=20.0,
10+
... cohesion=20.0,
11+
... moist_unit_wgt=18.0,
12+
... depth=1.5,
13+
... width=2.0,
14+
... shape="square",
15+
... ubc_type="vesic")
1616
>>> hansen_ubc.ultimate_bearing_capacity()
1717
893.2
1818

geolysis/bearing_capacity/abc/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from ._cohl import (
22
ABCType,
3-
create_abc_4_cohesionless_soils,
4-
BowlesABC4PadFoundation,
53
BowlesABC4MatFoundation,
4+
BowlesABC4PadFoundation,
65
MeyerhofABC4MatFoundation,
76
MeyerhofABC4PadFoundation,
87
TerzaghiABC4MatFoundation,
98
TerzaghiABC4PadFoundation,
9+
create_abc_4_cohesionless_soils,
1010
)
1111

1212
__all__ = [

geolysis/bearing_capacity/abc/_cohl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import enum
2-
from typing import Optional, Annotated
2+
from typing import Annotated, Optional
33

44
from func_validator import MustBeMemberOf, validate_params
55

geolysis/bearing_capacity/abc/_cohl/_core.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
from dataclasses import dataclass
33
from typing import Annotated, Optional
44

5-
from func_validator import (
6-
validate_params,
7-
MustBeNonNegative,
8-
MustBeLessThanOrEqual,
9-
)
5+
from func_validator import MustBeLessThanOrEqual, MustBeNonNegative, validate_params
106

117
from geolysis.foundation import Foundation
128
from geolysis.utils import round_
@@ -24,10 +20,10 @@ class AllowableBearingCapacity(ABC):
2420
MAX_TOL_SETTLEMENT = 25.4
2521

2622
def __init__(
27-
self,
28-
corrected_spt_n_value: float,
29-
tol_settlement: float,
30-
foundation_size: Foundation,
23+
self,
24+
corrected_spt_n_value: float,
25+
tol_settlement: float,
26+
foundation_size: Foundation,
3127
) -> None:
3228
self.corrected_spt_n_value = corrected_spt_n_value
3329
self.tol_settlement = tol_settlement
@@ -41,8 +37,8 @@ def corrected_spt_n_value(self) -> float:
4137
@corrected_spt_n_value.setter
4238
@validate_params
4339
def corrected_spt_n_value(
44-
self,
45-
corrected_spt_n_value: Annotated[float, MustBeNonNegative()],
40+
self,
41+
corrected_spt_n_value: Annotated[float, MustBeNonNegative()],
4642
):
4743
self._corrected_spt_n_value = corrected_spt_n_value
4844

@@ -54,10 +50,10 @@ def tol_settlement(self) -> float:
5450
@tol_settlement.setter
5551
@validate_params
5652
def tol_settlement(
57-
self,
58-
tol_settlement: Annotated[
59-
float, MustBeNonNegative(), MustBeLessThanOrEqual(25.4)
60-
],
53+
self,
54+
tol_settlement: Annotated[
55+
float, MustBeNonNegative(), MustBeLessThanOrEqual(25.4)
56+
],
6157
):
6258
self._tol_settlement = tol_settlement
6359

geolysis/bearing_capacity/abc/_cohl/terzaghi_abc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from geolysis.foundation import Foundation
2-
from geolysis.utils import round_, isinf
2+
from geolysis.utils import isinf, round_
33

44
from ._core import AllowableBearingCapacity, AllowableBearingCapacityResult
55

geolysis/bearing_capacity/ubc/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import enum
2-
from typing import Optional, Annotated
2+
from typing import Annotated, Optional
33

44
from func_validator import MustBeMemberOf, validate_params
55

@@ -22,7 +22,7 @@
2222
"TerzaghiUBC4SquareFooting",
2323
"VesicUltimateBearingCapacity",
2424
"UBCType",
25-
"create_ubc_4_all_soil_types",
25+
"create_ubc_4_all_soils",
2626
]
2727

2828

@@ -52,7 +52,7 @@ class UBCType(AbstractStrEnum):
5252

5353

5454
@validate_params
55-
def create_ubc_4_all_soil_types(
55+
def create_ubc_4_all_soils(
5656
friction_angle: float,
5757
cohesion: float,
5858
moist_unit_wgt: float,
@@ -98,6 +98,7 @@ def create_ubc_4_all_soil_types(
9898
:raises ValidationError: Raised when length is not provided for a
9999
rectangular footing.
100100
"""
101+
101102
ubc_type = UBCType(ubc_type)
102103

103104
# exception from create_foundation will automatically propagate

geolysis/bearing_capacity/ubc/_core.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22
from dataclasses import dataclass
33
from typing import Annotated
44

5-
from func_validator import (
6-
validate_params,
7-
MustBeNonNegative,
8-
MustBePositive,
9-
)
5+
from func_validator import MustBeNonNegative, MustBePositive, validate_params
106

117
from geolysis.foundation import Foundation
12-
from geolysis.utils import arctandeg, round_, tandeg, isinf
8+
from geolysis.utils import arctandeg, isinf, round_, tandeg
139

1410

1511
@dataclass(frozen=True, slots=True)
@@ -181,6 +177,7 @@ def _surcharge_term(self) -> float:
181177
if not isinf(water_level):
182178
if water_level < depth:
183179
d_1 = water_level
180+
# d2 is the distance from the footing base to water level
184181
d_2 = depth - d_1
185182
unit_wgt = self.saturated_unit_wgt - 9.81
186183
eop = self.moist_unit_wgt * d_1 + unit_wgt * d_2
@@ -199,6 +196,7 @@ def _embedment_term(self, coef: float = 0.5) -> float:
199196
if water_level < depth:
200197
unit_wgt = wgt
201198
else:
199+
# d is the distance from the footing base to water level
202200
d = water_level - depth
203201
if d <= width:
204202
unit_wgt = wgt + (d / width) * (self.moist_unit_wgt - wgt)

geolysis/bearing_capacity/ubc/_terzaghi_ubc.py

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
from geolysis.utils import (
2-
cosdeg,
3-
cotdeg,
4-
deg2rad,
5-
exp,
6-
isclose,
7-
pi,
8-
round_,
9-
tandeg,
10-
)
1+
from geolysis.utils import cosdeg, cotdeg, deg2rad, exp, isclose, pi, round_, tandeg
2+
113
from ._core import UltimateBearingCapacity
124

135
__all__ = [
@@ -26,7 +18,7 @@ def n_c(friction_angle: float) -> float:
2618
if isclose(friction_angle, 0.0):
2719
return 5.7
2820
return cotdeg(friction_angle) * (
29-
TerzaghiBearingCapacityFactors.n_q(friction_angle) - 1.0
21+
TerzaghiBearingCapacityFactors.n_q(friction_angle) - 1.0
3022
)
3123

3224
@staticmethod
@@ -39,8 +31,7 @@ def n_q(friction_angle: float) -> float:
3931
@staticmethod
4032
@round_(ndigits=2)
4133
def n_gamma(friction_angle: float) -> float:
42-
return (TerzaghiBearingCapacityFactors.n_q(
43-
friction_angle) - 1.0) * tandeg(
34+
return (TerzaghiBearingCapacityFactors.n_q(friction_angle) - 1.0) * tandeg(
4435
1.4 * friction_angle
4536
)
4637

@@ -75,9 +66,9 @@ class TerzaghiUBC4StripFooting(TerzaghiUltimateBearingCapacity):
7566
def _bearing_capacity(self) -> float:
7667
"""Calculates ultimate bearing capacity for strip footing."""
7768
return (
78-
self._cohesion_term(1.0)
79-
+ self._surcharge_term()
80-
+ self._embedment_term(0.5)
69+
self._cohesion_term(1.0)
70+
+ self._surcharge_term()
71+
+ self._embedment_term(0.5)
8172
)
8273

8374

@@ -93,9 +84,9 @@ class TerzaghiUBC4CircularFooting(TerzaghiUltimateBearingCapacity):
9384
def _bearing_capacity(self) -> float:
9485
"""Calculates ultimate bearing capacity for circular footing."""
9586
return (
96-
self._cohesion_term(1.3)
97-
+ self._surcharge_term()
98-
+ self._embedment_term(0.3)
87+
self._cohesion_term(1.3)
88+
+ self._surcharge_term()
89+
+ self._embedment_term(0.3)
9990
)
10091

10192

@@ -110,9 +101,9 @@ class TerzaghiUBC4SquareFooting(TerzaghiUltimateBearingCapacity):
110101
def _bearing_capacity(self):
111102
"""Calcalates ultimate bearing capacity for square footing."""
112103
return (
113-
self._cohesion_term(1.3)
114-
+ self._surcharge_term()
115-
+ self._embedment_term(0.4)
104+
self._cohesion_term(1.3)
105+
+ self._surcharge_term()
106+
+ self._embedment_term(0.4)
116107
)
117108

118109

@@ -133,7 +124,7 @@ def _bearing_capacity(self) -> float:
133124
emb_coef = (1.0 - 0.2 * (width / length)) / 2.0
134125

135126
return (
136-
self._cohesion_term(coh_coef)
137-
+ self._surcharge_term()
138-
+ self._embedment_term(emb_coef)
127+
self._cohesion_term(coh_coef)
128+
+ self._surcharge_term()
129+
+ self._embedment_term(emb_coef)
139130
)

0 commit comments

Comments
 (0)