From 04528552b99ea6b03f4714a1c96620a96e4ad8b2 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 30 Jul 2020 18:50:35 -0700 Subject: comments documenting tuple/dict types in graphics.py --- python/fatcat_web/graphics.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'python/fatcat_web') diff --git a/python/fatcat_web/graphics.py b/python/fatcat_web/graphics.py index a8e217e3..0765a777 100644 --- a/python/fatcat_web/graphics.py +++ b/python/fatcat_web/graphics.py @@ -7,6 +7,8 @@ from pygal.style import CleanStyle def ia_coverage_histogram(rows: List[Tuple]) -> pygal.Graph: """ Note: this returns a raw pygal chart; it does not render it to SVG/PNG + + Rows are tuples of: (year: float or int, in_ia: bool, count: int) """ raw_years = [int(r[0]) for r in rows] @@ -40,6 +42,9 @@ def ia_coverage_histogram(rows: List[Tuple]) -> pygal.Graph: def preservation_by_year_histogram(rows: List[Dict], merge_shadows: bool = False) -> pygal.Graph: """ Note: this returns a raw pygal chart; it does not render it to SVG/PNG + + Rows are dict with keys as preservation types and values as counts (int). + There is also a 'year' key with float/int value. """ years = sorted(rows, key=lambda x: x['year']) @@ -70,6 +75,9 @@ def preservation_by_year_histogram(rows: List[Dict], merge_shadows: bool = False def preservation_by_date_histogram(rows: List[Dict], merge_shadows: bool = False) -> pygal.Graph: """ Note: this returns a raw pygal chart; it does not render it to SVG/PNG + + Rows are dict with keys as preservation types and values as counts (int). + There is also a 'date' key with str value. """ dates = sorted(rows, key=lambda x: x['date']) @@ -100,6 +108,9 @@ def preservation_by_date_histogram(rows: List[Dict], merge_shadows: bool = False def preservation_by_volume_histogram(rows: List[Dict], merge_shadows: bool = False) -> pygal.Graph: """ Note: this returns a raw pygal chart; it does not render it to SVG/PNG + + Rows are dict with keys as preservation types and values as counts (int). + There is also a 'volume' key with str value. """ volumes = sorted(rows, key=lambda x: x['volume']) -- cgit v1.2.3