@@ -33,65 +33,27 @@ def get_leaf_classes(op):
33
33
ops .ScalarParameter ,
34
34
}
35
35
36
- GEOSPATIAL_OPS = frozenset (get_leaf_classes (ops .GeoSpatialUnOp )) | frozenset (
37
- get_leaf_classes (ops .GeoSpatialBinOp )
38
- )
36
+ PUBLIC_OPS = (frozenset (get_leaf_classes (ops .Value ))) - INTERNAL_OPS
39
37
40
- CORE_OPS = (frozenset (get_leaf_classes (ops .Value ))) - INTERNAL_OPS - GEOSPATIAL_OPS
41
-
42
- ICONS = {
43
- True : ":material-check-decagram:{ .verified }" ,
44
- False : ":material-cancel:{ .cancel }" ,
45
- }
46
-
47
-
48
- def gen_matrix (basename , possible_ops , raw_data_format = False ):
49
- if raw_data_format :
50
- support = {
51
- "operation" : [f"{ op .__module__ } .{ op .__name__ } " for op in possible_ops ]
52
- }
53
- else :
54
- support = {"operation" : [f"`{ op .__name__ } `" for op in possible_ops ]}
55
38
39
+ def main ():
40
+ support = {"operation" : [f"{ op .__module__ } .{ op .__name__ } " for op in PUBLIC_OPS ]}
56
41
support .update (
57
- (name , list (map (backend .has_operation , possible_ops )))
42
+ (name , list (map (backend .has_operation , PUBLIC_OPS )))
58
43
for name , backend in get_backends ()
59
44
)
60
45
61
46
df = pd .DataFrame (support ).set_index ("operation" ).sort_index ()
62
- if not raw_data_format :
63
- counts = df .sum ().sort_values (ascending = False )
64
- counts = counts [counts > 0 ]
65
- num_ops = len (possible_ops )
66
- coverage = (
67
- counts .map (lambda n : f"_{ n } ({ round (100 * n / num_ops )} %)_" )
68
- .to_frame (name = "**API Coverage**" )
69
- .T
70
- )
71
-
72
- ops_table = df .loc [:, counts .index ].replace (ICONS )
73
- table = pd .concat ([coverage , ops_table ])
74
- else :
75
- table = df
76
-
77
- file_path = Path ("backends" , f"{ basename } _support_matrix.csv" )
78
- local_pth = Path (__file__ ).parent / "docs" / file_path
47
+
48
+ file_path = Path ("backends" , "raw_support_matrix.csv" )
49
+ local_path = Path (__file__ ).parent / "docs" / file_path
50
+
79
51
buf = io .StringIO ()
80
- table .to_csv (buf , index_label = "Backends" )
81
- local_pth .write_text (buf .getvalue ())
52
+ df .to_csv (buf , index_label = "FullOperation" )
53
+
54
+ local_path .write_text (buf .getvalue ())
82
55
with mkdocs_gen_files .open (file_path , "w" ) as f :
83
56
f .write (buf .getvalue ())
84
57
85
58
86
- def main ():
87
- gen_matrix (basename = "core" , possible_ops = CORE_OPS )
88
- gen_matrix (
89
- basename = "geospatial" ,
90
- possible_ops = GEOSPATIAL_OPS ,
91
- )
92
- gen_matrix (
93
- basename = "raw" , possible_ops = CORE_OPS | GEOSPATIAL_OPS , raw_data_format = True
94
- )
95
-
96
-
97
59
main ()
0 commit comments