MCPcopy Create free account
hub / github.com/apache/tvm / categorize_csv_file

Function categorize_csv_file

tests/scripts/release/make_notes.py:126–155  ·  view source on GitHub ↗
(csv_path: str)

Source from the content-addressed store, hash-verified

124
125
126def categorize_csv_file(csv_path: str):
127 headings = defaultdict(lambda: defaultdict(list))
128 sprint("Opening CSV")
129 with open(csv_path) as f:
130 input_file = csv.DictReader(f)
131
132 i = 0
133 blank_cate_set = {"Misc"}
134 for row in input_file:
135 # print(row)
136 tags = row["pr_title_tags"].split("/")
137 tags = ["misc"] if len(tags) == 0 else tags
138
139 categories = map(lambda t: TAG_DICT.get(t.lower(), "Misc"), tags)
140 categories = list(categories)
141 categories = list(set(categories) - blank_cate_set)
142 category = "Misc" if len(categories) == 0 else categories[0]
143
144 subject = row["subject"].strip()
145 pr_number = row["url"].split("/")[-1]
146
147 if category == "" or subject == "":
148 sprint(f"Skipping {i}th pr with number: {pr_number}, row: {row}")
149 continue
150
151 headings[category][subject].append(pr_number)
152 i += 1
153 # if i > 30:
154 # break
155 return headings
156
157
158if __name__ == "__main__":

Callers 1

make_notes.pyFile · 0.85

Calls 4

sprintFunction · 0.70
splitMethod · 0.45
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…