mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 13:08:19 -04:00
fixed most ruff error
This commit is contained in:
@@ -1,20 +1,25 @@
|
||||
def calculate_capacitor_capacity(voltage, farads):
|
||||
"""capasitor."""
|
||||
|
||||
|
||||
def calculate_capacitor_capacity(voltage: float, farads: float) -> float:
|
||||
"""Calculate capacitor capacity."""
|
||||
joules = (farads * voltage**2) // 2
|
||||
return joules // 3600
|
||||
|
||||
|
||||
def calculate_pack_capacity(cells, cell_voltage, farads):
|
||||
def calculate_pack_capacity(cells: int, cell_voltage: float, farads: float) -> float:
|
||||
"""Calculate pack capacity."""
|
||||
return calculate_capacitor_capacity(cells * cell_voltage, farads / cells)
|
||||
|
||||
|
||||
def calculate_pack_capacity2(cells, cell_voltage, farads, cell_cost):
|
||||
capacitor_capacity = calculate_capacitor_capacity(
|
||||
cells * cell_voltage, farads / cells
|
||||
)
|
||||
def calculate_pack_capacity2(cells: int, cell_voltage: float, farads: float, cell_cost: float) -> tuple[float, float]:
|
||||
"""Calculate pack capacity."""
|
||||
capacitor_capacity = calculate_capacitor_capacity(cells * cell_voltage, farads / cells)
|
||||
return capacitor_capacity, cell_cost * cells
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
"""Main."""
|
||||
watt_hours = calculate_pack_capacity(cells=10, cell_voltage=2.7, farads=500)
|
||||
print(f"{watt_hours=}")
|
||||
print(f"{watt_hours*16=}")
|
||||
|
||||
Reference in New Issue
Block a user