6
mirror of https://github.com/AllSpiceIO/cofactr-cogs.git synced 2025-04-18 07:48:55 +00:00

Merge pull request from AllSpiceIO/jt/types

fix: Fix to pass mypy type-checking
This commit is contained in:
Jonathan Tran 2024-05-14 17:20:28 -04:00 committed by GitHub
commit d544b05d78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -61,8 +61,8 @@ def fetch_price_for_part(part_number: str) -> dict[int, float]:
params={
"q": part_number,
"schema": "product-offers-v0",
"external": True,
"limit": 1,
"external": "true",
"limit": "1",
},
)
@ -149,8 +149,6 @@ if __name__ == "__main__":
print("No prices found for any parts", file=sys.stderr)
sys.exit(1)
cogs_for_quantities = {}
headers = [
"Part Number",
"Quantity",
@ -161,7 +159,7 @@ if __name__ == "__main__":
headers.append(f"Total at {quantity}")
rows = []
totals = {quantity: 0 for quantity in quantities}
totals: dict[int, float] = {quantity: 0 for quantity in quantities}
for part in parts:
part_number = part[part_number_column]
@ -199,7 +197,7 @@ if __name__ == "__main__":
totals_row = ["Totals", None]
for quantity in quantities:
totals_row.append(None)
totals_row.append(totals[quantity])
totals_row.append(str(totals[quantity]))
writer.writerow(totals_row)