File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
"""
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.
3
3
"""
4
4
5
5
from decimal import Decimal
11
11
12
12
13
13
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 :)
15
15
_localised_fields : ClassVar [Iterable [str ]] = ()
16
16
17
17
@model_validator (mode = "before" )
@@ -65,6 +65,11 @@ def parse_latest_products_to_objects(pretix_data: PretixData) -> list[Product]:
65
65
66
66
67
67
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
+ """
68
73
rows = []
69
74
for p in products :
70
75
if p .variations :
@@ -104,7 +109,7 @@ def flat_product_data(products: list[Product]) -> pl.DataFrame:
104
109
return pl .DataFrame (rows )
105
110
106
111
107
- def latest_flat_product_data ():
112
+ def latest_flat_product_data () -> pl . DataFrame :
108
113
"""
109
114
Thin wrapper on getting latest information from the database, and
110
115
converting into a polars data frame
You can’t perform that action at this time.
0 commit comments