from __future__ import annotations import sys import typing import cache import supply def main() -> None: (fio_burn,) = supply.get_fio_burn([sys.argv[1]]) planet = supply.Planet(fio_burn) materials: typing.Mapping[str, supply.Material] = {mat['Ticker']: mat for mat in cache.get('https://rest.fnar.net/material/allmaterials')} total_weight = total_volume = 0.0 for mat in planet.exporting: if amount := planet.inventory.get(mat): weight = amount * materials[mat]['Weight'] volume = amount * materials[mat]['Volume'] print(f'{mat:3} {amount:5,} {weight:5.2f}t {volume:5.2f}m³') total_weight += weight total_volume += volume print(f'total {total_weight:.2f}t {total_volume:.2f}m³') if __name__ == '__main__': main()