Skip to content

Commit d6f96c9

Browse files
committed
fix typo and add more types
1 parent f923015 commit d6f96c9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

intbot/core/analysis/products.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Prase Products from PretixData for further joins and analysis in other places.
2+
Parse Products from PretixData for further joins and analysis in other places.
33
"""
44

55
from decimal import Decimal
@@ -11,7 +11,7 @@
1111

1212

1313
class LocalisedFieldsMixin:
14-
# Marking as ClassVar here is importnat. It doens't work without it :)
14+
# Marking as ClassVar here is important. It doens't work without it :)
1515
_localised_fields: ClassVar[Iterable[str]] = ()
1616

1717
@model_validator(mode="before")
@@ -65,6 +65,11 @@ def parse_latest_products_to_objects(pretix_data: PretixData) -> list[Product]:
6565

6666

6767
def flat_product_data(products: list[Product]) -> pl.DataFrame:
68+
"""
69+
Returns a polars data frame with flat description of available Products.
70+
Products hold nested `ProductVariation`s; flatten them so every variation
71+
(or base product) becomes one row in a DataFrame.
72+
"""
6873
rows = []
6974
for p in products:
7075
if p.variations:
@@ -104,7 +109,7 @@ def flat_product_data(products: list[Product]) -> pl.DataFrame:
104109
return pl.DataFrame(rows)
105110

106111

107-
def latest_flat_product_data():
112+
def latest_flat_product_data() -> pl.DataFrame:
108113
"""
109114
Thin wrapper on getting latest information from the database, and
110115
converting into a polars data frame

0 commit comments

Comments
 (0)