Skip to content

Commit

Permalink
fix: rename Power units to plural
Browse files Browse the repository at this point in the history
  • Loading branch information
unexcellent committed Nov 19, 2024
1 parent 93f1c29 commit 5fbfc8e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions generate/generate_boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ def _generat_zero_function(current_class: str) -> list[str]:
"micrograms": "10**-9",
},
"Power": {
"gigawatt": "10**9",
"megawatt": "10**6",
"kilowatt": "10**3",
"watt": "1",
"milliwatt": "10**-3",
"gigawatts": "10**9",
"megawatts": "10**6",
"kilowatts": "10**3",
"watts": "1",
"milliwatts": "10**-3",
},
"Velocity": {
"meters_per_second": "1",
Expand Down
42 changes: 21 additions & 21 deletions quantio/quantities.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,48 +351,48 @@ class Power(_QuantityBase):

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

BASE_UNIT = "watt"
BASE_UNIT = "watts"

@property
def gigawatt(self) -> float:
"""The power in gigawatt."""
def gigawatts(self) -> float:
"""The power in gigawatts."""
return self._base_value / 10**9

@property
def megawatt(self) -> float:
"""The power in megawatt."""
def megawatts(self) -> float:
"""The power in megawatts."""
return self._base_value / 10**6

@property
def kilowatt(self) -> float:
"""The power in kilowatt."""
def kilowatts(self) -> float:
"""The power in kilowatts."""
return self._base_value / 10**3

@property
def watt(self) -> float:
"""The power in watt."""
def watts(self) -> float:
"""The power in watts."""
return self._base_value / 1

@property
def milliwatt(self) -> float:
"""The power in milliwatt."""
def milliwatts(self) -> float:
"""The power in milliwatts."""
return self._base_value / 10**-3

def __init__(
self,
_base_value: float = 0.0,
gigawatt: float = 0.0,
megawatt: float = 0.0,
kilowatt: float = 0.0,
watt: float = 0.0,
milliwatt: float = 0.0,
gigawatts: float = 0.0,
megawatts: float = 0.0,
kilowatts: float = 0.0,
watts: float = 0.0,
milliwatts: float = 0.0,
) -> None:
self._base_value = _base_value
self._base_value += gigawatt * 10**9
self._base_value += megawatt * 10**6
self._base_value += kilowatt * 10**3
self._base_value += watt * 1
self._base_value += milliwatt * 10**-3
self._base_value += gigawatts * 10**9
self._base_value += megawatts * 10**6
self._base_value += kilowatts * 10**3
self._base_value += watts * 1
self._base_value += milliwatts * 10**-3

@classmethod
def zero(cls) -> Power:
Expand Down

0 comments on commit 5fbfc8e

Please sign in to comment.