File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 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
55from decimal import Decimal
1111
1212
1313class 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
6767def 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
You can’t perform that action at this time.
0 commit comments