aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-07-30 18:50:35 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-07-30 18:50:39 -0700
commit04528552b99ea6b03f4714a1c96620a96e4ad8b2 (patch)
treeee6486a9125da40dda1af2a86ea87c117c3f7737 /python/fatcat_web
parent388778627cc599af8bd50085a5862efa38e5c054 (diff)
downloadfatcat-04528552b99ea6b03f4714a1c96620a96e4ad8b2.tar.gz
fatcat-04528552b99ea6b03f4714a1c96620a96e4ad8b2.zip
comments documenting tuple/dict types in graphics.py
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/graphics.py11
1 files changed, 11 insertions, 0 deletions
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'])