Skip to content

Commit

Permalink
feat: add Acceleration
Browse files Browse the repository at this point in the history
  • Loading branch information
unexcellent committed Nov 9, 2024
1 parent 24f6449 commit 3e4f839
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions generate/generate_boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def _generate_properties(current_class: str, units: dict[str, str]) -> list[str]

if __name__ == "__main__":
quantities_with_fields = {
"Acceleration": {
"meters_per_square_second": "1",
"g_force": "(1 / 9.8)",
},
"Area": {
"square_miles": "1609.34**2",
"square_kilometers": "10 ** (3 * 2)",
Expand Down
27 changes: 27 additions & 0 deletions quantio/quantities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,33 @@
from ._quantity_base import _QuantityBase


class Acceleration(_QuantityBase):
"""Rate of change of velocity."""

# --- This part is auto generated. Do not change manually. ---

def __init__(
self,
meters_per_square_second: float = 0.0,
g_force: float = 0.0,
) -> None:
self._base_value = 0.0
self._base_value += meters_per_square_second * 1
self._base_value += g_force * (1 / 9.8)

@property
def meters_per_square_second(self) -> float:
"""The acceleration in meters per square second."""
return self._base_value / 1

@property
def g_force(self) -> float:
"""The acceleration in g force."""
return self._base_value / (1 / 9.8)

# --- End of auto generated part. ---


class Area(_QuantityBase):
"""The two-dimensional extent of an object."""

Expand Down

0 comments on commit 3e4f839

Please sign in to comment.