MCPcopy Create free account
hub / github.com/pytorch/pytorch / categorize

Method categorize

scripts/release_notes/commitlist.py:187–373  ·  view source on GitHub ↗
(features)

Source from the content-addressed store, hash-verified

185
186 @staticmethod
187 def categorize(features):
188 title = features["title"]
189 labels = features["labels"]
190 category = "Uncategorized"
191 topic = "Untopiced"
192
193 # Revert commits are merged directly to master with no associated PR number
194 if features["pr_number"] is None:
195 if title.startswith("Revert"):
196 return "skip", topic
197
198 # We ask contributors to label their PR's appropriately
199 # when they're first landed.
200 # Check if the labels are there first.
201 already_categorized = already_topiced = False
202 for label in labels:
203 if label.startswith("release notes: "):
204 category = label.split("release notes: ", 1)[1]
205 category = CommitList.category_remapper(category)
206 already_categorized = True
207 if label.startswith("topic: "):
208 topic = label.split("topic: ", 1)[1]
209 already_topiced = True
210 if already_categorized and already_topiced:
211 return category, topic
212
213 # update this to check if each file starts with caffe2
214 if "caffe2" in title:
215 return "caffe2", topic
216 if "Reverted" in labels:
217 return "skip", topic
218 if "module: deprecation" in labels:
219 topic = "deprecation"
220
221 found_bracket_category = CommitList.bracket_category_matcher(title)
222 if found_bracket_category:
223 return found_bracket_category, topic
224
225 files_changed = features["files_changed"]
226 for file in files_changed:
227 file_lowercase = file.lower()
228 if CommitList.keywordInFile(
229 file,
230 [
231 "docker/",
232 ".circleci",
233 ".github",
234 ".jenkins",
235 ".ci",
236 ".azure_pipelines",
237 ],
238 ):
239 category = "releng"
240 break
241 # datapipe(s), torch/utils/data, test_{dataloader, datapipe}
242 if CommitList.keywordInFile(
243 file, ["torch/utils/data", "test_dataloader", "test_datapipe"]
244 ):

Callers 2

gen_commitMethod · 0.45
rerun_with_new_filtersFunction · 0.45

Calls 6

category_remapperMethod · 0.80
keywordInFileMethod · 0.80
allFunction · 0.50
splitMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected