project_name
string
class_name
string
class_modifiers
string
class_implements
int64
class_extends
int64
function_name
string
function_body
string
cyclomatic_complexity
int64
NLOC
int64
num_parameter
int64
num_token
int64
num_variable
int64
start_line
int64
end_line
int64
function_index
int64
function_params
string
function_variable
string
function_return_type
string
function_body_line_type
string
function_num_functions
int64
function_num_lines
int64
outgoing_function_count
int64
outgoing_function_names
string
incoming_function_count
int64
incoming_function_names
string
lexical_representation
string
pytorch_ao
public
public
0
0
__init__
def __init__(self, org: str, project: str, pr_num: int) -> None:assert isinstance(pr_num, int)self.org = orgself.project = projectself.pr_num = pr_numself.info = gh_get_pr_info(org, project, pr_num)self.changed_files: Optional[List[str]] = Noneself.labels: Optional[List[str]] = Noneself.conclusions: Optional[JobNameToS...
1
14
4
161
0
682
695
682
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 682 and ends at 695. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [682.0] and does not return any value..
pytorch_ao
public
public
0
0
is_closed
def is_closed(self) -> bool:return bool(self.info["closed"])
1
2
1
17
0
697
698
697
null
[]
None
null
0
0
0
null
0
null
The function (is_closed) defined within the public class called public.The function start at line 697 and ends at 698. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
is_cross_repo
def is_cross_repo(self) -> bool:return bool(self.info["isCrossRepository"])
1
2
1
17
0
700
701
700
null
[]
None
null
0
0
0
null
0
null
The function (is_cross_repo) defined within the public class called public.The function start at line 700 and ends at 701. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
base_ref
def base_ref(self) -> str:return cast(str, self.info["baseRefName"])
1
2
1
19
0
703
704
703
null
[]
None
null
0
0
0
null
0
null
The function (base_ref) defined within the public class called public.The function start at line 703 and ends at 704. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
default_branch
def default_branch(self) -> str:return cast(str, self.info["baseRepository"]["defaultBranchRef"]["name"])
1
2
1
25
0
706
707
706
null
[]
None
null
0
0
0
null
0
null
The function (default_branch) defined within the public class called public.The function start at line 706 and ends at 707. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
head_ref
def head_ref(self) -> str:return cast(str, self.info["headRefName"])
1
2
1
19
0
709
710
709
null
[]
None
null
0
0
0
null
0
null
The function (head_ref) defined within the public class called public.The function start at line 709 and ends at 710. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
is_ghstack_pr
def is_ghstack_pr(self) -> bool:return RE_GHSTACK_HEAD_REF.match(self.head_ref()) is not None
1
2
1
21
0
712
713
712
null
[]
None
null
0
0
0
null
0
null
The function (is_ghstack_pr) defined within the public class called public.The function start at line 712 and ends at 713. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_ghstack_orig_ref
def get_ghstack_orig_ref(self) -> str:assert self.is_ghstack_pr()return re.sub(r"/head$", "/orig", self.head_ref())
1
3
1
29
0
715
717
715
null
[]
None
null
0
0
0
null
0
null
The function (get_ghstack_orig_ref) defined within the public class called public.The function start at line 715 and ends at 717. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
is_base_repo_private
def is_base_repo_private(self) -> bool:return bool(self.info["baseRepository"]["isPrivate"])
1
2
1
20
0
719
720
719
null
[]
None
null
0
0
0
null
0
null
The function (is_base_repo_private) defined within the public class called public.The function start at line 719 and ends at 720. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_changed_files_count
def get_changed_files_count(self) -> int:return int(self.info["changedFiles"])
1
2
1
17
0
722
723
722
null
[]
None
null
0
0
0
null
0
null
The function (get_changed_files_count) defined within the public class called public.The function start at line 722 and ends at 723. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
last_commit
def last_commit(self) -> Any:return self.info["commits"]["nodes"][-1]["commit"]
1
2
1
24
0
725
726
725
null
[]
None
null
0
0
0
null
0
null
The function (last_commit) defined within the public class called public.The function start at line 725 and ends at 726. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_merge_base
def get_merge_base(self) -> str:if self.merge_base:return self.merge_baselast_commit_oid = self.last_commit()["oid"]# NB: We could use self.base_ref() here for regular PR, however, that doesn't# work for ghstack where the base is the custom branch, i.e. gh/USER/ID/base,# so let's just use main insteadself.merge_base = ...
3
10
1
73
0
728
748
728
null
[]
None
null
0
0
0
null
0
null
The function (get_merge_base) defined within the public class called public.The function start at line 728 and ends at 748. It contains 10 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_changed_files
def get_changed_files(self) -> List[str]:if self.changed_files is None:info = self.infounique_changed_files = set()# Do not try to fetch more than 10K filesfor _ in range(100):unique_changed_files.update([x["path"] for x in info["files"]["nodes"]])if not info["files"]["pageInfo"]["hasNextPage"]:breakrc = gh_graphql(GH_...
6
20
1
151
0
750
771
750
null
[]
None
null
0
0
0
null
0
null
The function (get_changed_files) defined within the public class called public.The function start at line 750 and ends at 771. It contains 20 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_submodules
def get_submodules(self) -> List[str]:if self.submodules is None:rc = gh_graphql(GH_GET_REPO_SUBMODULES, name=self.project, owner=self.org)info = rc["data"]["repository"]["submodules"]self.submodules = [s["path"] for s in info["nodes"]]return self.submodules
3
6
1
68
0
773
778
773
null
[]
None
null
0
0
0
null
0
null
The function (get_submodules) defined within the public class called public.The function start at line 773 and ends at 778. It contains 6 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_changed_submodules
def get_changed_submodules(self) -> List[str]:submodules = self.get_submodules()return [f for f in self.get_changed_files() if f in submodules]
3
3
1
33
0
780
782
780
null
[]
None
null
0
0
0
null
0
null
The function (get_changed_submodules) defined within the public class called public.The function start at line 780 and ends at 782. It contains 3 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
has_invalid_submodule_updates
def has_invalid_submodule_updates(self) -> bool:"""Submodule updates in PR are invalid if submodule keywordis not mentioned in neither the title nor body/descriptionnor in any of the labels."""return (len(self.get_changed_submodules()) > 0and "submodule" not in self.get_title().lower()and "submodule" not in self.get_bo...
5
7
1
63
0
784
794
784
null
[]
None
null
0
0
0
null
0
null
The function (has_invalid_submodule_updates) defined within the public class called public.The function start at line 784 and ends at 794. It contains 7 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_get_reviews
def _get_reviews(self) -> List[Tuple[str, str]]:if self._reviews is None:self._reviews = []info = self.infofor _ in range(100):nodes = info["reviews"]["nodes"]self._reviews = [(node["author"]["login"], node["state"]) for node in nodes] + self._reviewsif not info["reviews"]["pageInfo"]["hasPreviousPage"]:breakrc = gh_gr...
7
24
1
175
0
796
819
796
null
[]
None
null
0
0
0
null
0
null
The function (_get_reviews) defined within the public class called public.The function start at line 796 and ends at 819. It contains 24 lines of code and it has a cyclomatic complexity of 7. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_approved_by
def get_approved_by(self) -> List[str]:return [login for (login, state) in self._get_reviews() if state == "APPROVED"]
3
2
1
30
0
821
822
821
null
[]
None
null
0
0
0
null
0
null
The function (get_approved_by) defined within the public class called public.The function start at line 821 and ends at 822. It contains 2 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_commit_count
def get_commit_count(self) -> int:return int(self.info["commits_with_authors"]["totalCount"])
1
2
1
20
0
824
825
824
null
[]
None
null
0
0
0
null
0
null
The function (get_commit_count) defined within the public class called public.The function start at line 824 and ends at 825. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_pr_creator_login
def get_pr_creator_login(self) -> str:return cast(str, self.info["author"]["login"])
1
2
1
22
0
827
828
827
null
[]
None
null
0
0
0
null
0
null
The function (get_pr_creator_login) defined within the public class called public.The function start at line 827 and ends at 828. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_fetch_authors.add_authors
def add_authors(info: Dict[str, Any]) -> None:for node in info["commits_with_authors"]["nodes"]:for author_node in node["commit"]["authors"]["nodes"]:user_node = author_node["user"]author = f"{author_node['name']} <{author_node['email']}>"if user_node is None:# If author is not github user, user node will be nullauthor...
4
9
1
84
0
835
844
835
null
[]
None
null
0
0
0
null
0
null
The function (_fetch_authors.add_authors) defined within the public class called public.The function start at line 835 and ends at 844. It contains 9 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_fetch_authors
def _fetch_authors(self) -> List[Tuple[str, str]]:if self._authors is not None:return self._authorsauthors: List[Tuple[str, str]] = []def add_authors(info: Dict[str, Any]) -> None:for node in info["commits_with_authors"]["nodes"]:for author_node in node["commit"]["authors"]["nodes"]:user_node = author_node["user"]autho...
4
20
1
131
0
830
860
830
null
[]
None
null
0
0
0
null
0
null
The function (_fetch_authors) defined within the public class called public.The function start at line 830 and ends at 860. It contains 20 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_committer_login
def get_committer_login(self, num: int = 0) -> str:return self._fetch_authors()[num][0]
1
2
2
25
0
862
863
862
null
[]
None
null
0
0
0
null
0
null
The function (get_committer_login) defined within the public class called public.The function start at line 862 and ends at 863. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [862.0] and does not return any value..
pytorch_ao
public
public
0
0
get_committer_author
def get_committer_author(self, num: int = 0) -> str:return self._fetch_authors()[num][1]
1
2
2
25
0
865
866
865
null
[]
None
null
0
0
0
null
0
null
The function (get_committer_author) defined within the public class called public.The function start at line 865 and ends at 866. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [865.0] and does not return any value..
pytorch_ao
public
public
0
0
get_labels
def get_labels(self) -> List[str]:if self.labels is not None:return self.labelslabels = ([node["node"]["name"] for node in self.info["labels"]["edges"]]if "labels" in self.infoelse [])self.labels = labelsreturn self.labels
4
10
1
65
0
868
877
868
null
[]
None
null
0
0
0
null
0
null
The function (get_labels) defined within the public class called public.The function start at line 868 and ends at 877. It contains 10 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_checkrun_conclusions.get_pr_next_check_runs
def get_pr_next_check_runs(edges: List[Dict[str, Dict[str, Any]]], edge_idx: int, checkruns: Any) -> Any:rc = gh_graphql(GH_GET_PR_NEXT_CHECK_RUNS,name=self.project,owner=self.org,number=self.pr_num,cs_cursor=edges[edge_idx - 1]["cursor"] if edge_idx > 0 else None,cr_cursor=checkruns["pageInfo"]["endCursor"],)last_comm...
2
16
3
126
0
885
900
885
null
[]
None
null
0
0
0
null
0
null
The function (get_checkrun_conclusions.get_pr_next_check_runs) defined within the public class called public.The function start at line 885 and ends at 900. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [885.0] and does not return any value..
pytorch_ao
public
public
0
0
get_checkrun_conclusions.get_pr_next_checksuites
def get_pr_next_checksuites(checksuites: Any) -> Any:rc = gh_graphql(GH_GET_PR_NEXT_CHECKSUITES,name=self.project,owner=self.org,number=self.pr_num,cursor=checksuites["edges"][-1]["cursor"],)info = rc["data"]["repository"]["pullRequest"]last_commit = info["commits"]["nodes"][-1]["commit"]if last_commit["oid"] != orig_l...
2
13
1
97
0
902
914
902
null
[]
None
null
0
0
0
null
0
null
The function (get_checkrun_conclusions.get_pr_next_checksuites) defined within the public class called public.The function start at line 902 and ends at 914. It contains 13 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_checkrun_conclusions
def get_checkrun_conclusions(self) -> JobNameToStateDict:"""Returns dict of checkrun -> [conclusion, url]"""if self.conclusions is not None:return self.conclusionsorig_last_commit = self.last_commit()def get_pr_next_check_runs(edges: List[Dict[str, Dict[str, Any]]], edge_idx: int, checkruns: Any) -> Any:rc = gh_graphql...
5
23
1
122
0
879
936
879
null
[]
None
null
0
0
0
null
0
null
The function (get_checkrun_conclusions) defined within the public class called public.The function start at line 879 and ends at 936. It contains 23 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_authors
def get_authors(self) -> Dict[str, str]:rc = {}for idx in range(len(self._fetch_authors())):rc[self.get_committer_login(idx)] = self.get_committer_author(idx)return rc
2
5
1
49
0
938
943
938
null
[]
None
null
0
0
0
null
0
null
The function (get_authors) defined within the public class called public.The function start at line 938 and ends at 943. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_author
def get_author(self) -> str:authors = self.get_authors()if len(authors) == 1:return next(iter(authors.values()))creator = self.get_pr_creator_login()# If PR creator is not among authors# Assume it was authored by first commit authorif creator not in authors:return self.get_committer_author(0)return authors[creator]
3
8
1
59
0
945
954
945
null
[]
None
null
0
0
0
null
0
null
The function (get_author) defined within the public class called public.The function start at line 945 and ends at 954. It contains 8 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_title
def get_title(self) -> str:return cast(str, self.info["title"])
1
2
1
19
0
956
957
956
null
[]
None
null
0
0
0
null
0
null
The function (get_title) defined within the public class called public.The function start at line 956 and ends at 957. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_body
def get_body(self) -> str:return cast(str, self.info["body"])
1
2
1
19
0
959
960
959
null
[]
None
null
0
0
0
null
0
null
The function (get_body) defined within the public class called public.The function start at line 959 and ends at 960. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_merge_commit
def get_merge_commit(self) -> Optional[str]:mc = self.info["mergeCommit"]return mc["oid"] if mc is not None else None
2
3
1
30
0
962
964
962
null
[]
None
null
0
0
0
null
0
null
The function (get_merge_commit) defined within the public class called public.The function start at line 962 and ends at 964. It contains 3 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_pr_url
def get_pr_url(self) -> str:return f"https://github.com/{self.org}/{self.project}/pull/{self.pr_num}"
1
2
1
10
0
966
967
966
null
[]
None
null
0
0
0
null
0
null
The function (get_pr_url) defined within the public class called public.The function start at line 966 and ends at 967. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_comment_from_node
def _comment_from_node(node: Any) -> GitHubComment:editor = node["editor"]return GitHubComment(body_text=node["bodyText"],created_at=node["createdAt"] if "createdAt" in node else "",author_login=node["author"]["login"],author_association=node["authorAssociation"],editor_login=editor["login"] if editor else None,databas...
3
11
1
81
0
970
980
970
null
[]
None
null
0
0
0
null
0
null
The function (_comment_from_node) defined within the public class called public.The function start at line 970 and ends at 980. It contains 11 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_comments
def get_comments(self) -> List[GitHubComment]:if self.comments is not None:return self.commentsself.comments = []info = self.info["comments"]# Do not try to fetch more than 10K commentsfor _ in range(100):self.comments = [self._comment_from_node(node) for node in info["nodes"]] + self.commentsif not info["pageInfo"]["h...
5
20
1
132
0
982
1,002
982
null
[]
None
null
0
0
0
null
0
null
The function (get_comments) defined within the public class called public.The function start at line 982 and ends at 1002. It contains 20 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_last_comment
def get_last_comment(self) -> GitHubComment:return self._comment_from_node(self.info["comments"]["nodes"][-1])
1
2
1
26
0
1,004
1,005
1,004
null
[]
None
null
0
0
0
null
0
null
The function (get_last_comment) defined within the public class called public.The function start at line 1004 and ends at 1005. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_comment_by_id
def get_comment_by_id(self, database_id: int) -> GitHubComment:if self.comments is None:# Fastpath - try searching in partial prefetched commentsfor node in self.info["comments"]["nodes"]:comment = self._comment_from_node(node)if comment.database_id == database_id:return commentfor comment in self.get_comments():if com...
8
14
2
102
0
1,007
1,028
1,007
null
[]
None
null
0
0
0
null
0
null
The function (get_comment_by_id) defined within the public class called public.The function start at line 1007 and ends at 1028. It contains 14 lines of code and it has a cyclomatic complexity of 8. It takes 2 parameters, represented as [1007.0] and does not return any value..
pytorch_ao
public
public
0
0
get_diff_revision
def get_diff_revision(self) -> Optional[str]:rc = RE_DIFF_REV.search(self.get_body())return rc.group(1) if rc is not None else None
2
3
1
36
0
1,030
1,032
1,030
null
[]
None
null
0
0
0
null
0
null
The function (get_diff_revision) defined within the public class called public.The function start at line 1030 and ends at 1032. It contains 3 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
has_internal_changes
def has_internal_changes(self) -> bool:checkrun_name = INTERNAL_CHANGES_CHECKRUN_NAMEif self.get_diff_revision() is None:return Falsechecks = self.get_checkrun_conclusions()if checks is None or checkrun_name not in checks:return Falsereturn checks[checkrun_name].status != "SUCCESS"
4
8
1
49
0
1,034
1,041
1,034
null
[]
None
null
0
0
0
null
0
null
The function (has_internal_changes) defined within the public class called public.The function start at line 1034 and ends at 1041. It contains 8 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
has_no_connected_diff
def has_no_connected_diff(self) -> bool:checkrun_name = INTERNAL_CHANGES_CHECKRUN_NAMEchecks = self.get_checkrun_conclusions()if checks is None or checkrun_name not in checks:return Falsereturn checks[checkrun_name].title == HAS_NO_CONNECTED_DIFF_TITLE
3
6
1
38
0
1,043
1,048
1,043
null
[]
None
null
0
0
0
null
0
null
The function (has_no_connected_diff) defined within the public class called public.The function start at line 1043 and ends at 1048. It contains 6 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
merge_ghstack_into
def merge_ghstack_into(self,repo: GitRepo,skip_mandatory_checks: bool,comment_id: Optional[int] = None,skip_all_rule_checks: bool = False,) -> List["GitHubPR"]:assert self.is_ghstack_pr()ghstack_prs = get_ghstack_prs(repo, self, open_only=False)# raises error if out of syncpr_dependencies = []for pr, rev in ghstack_prs...
7
30
5
158
0
1,050
1,081
1,050
null
[]
None
null
0
0
0
null
0
null
The function (merge_ghstack_into) defined within the public class called public.The function start at line 1050 and ends at 1081. It contains 30 lines of code and it has a cyclomatic complexity of 7. It takes 5 parameters, represented as [1050.0] and does not return any value..
pytorch_ao
public
public
0
0
gen_commit_message
def gen_commit_message(self,filter_ghstack: bool = False,ghstack_deps: Optional[List["GitHubPR"]] = None,) -> str:"""Fetches title and body from PR descriptionadds reviewed by, pull request resolved and optionallyfilters out ghstack info"""# Adding the url here makes it clickable within the Github UIapproved_by_urls = ...
6
21
3
135
0
1,083
1,111
1,083
null
[]
None
null
0
0
0
null
0
null
The function (gen_commit_message) defined within the public class called public.The function start at line 1083 and ends at 1111. It contains 21 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [1083.0] and does not return any value..
pytorch_ao
public
public
0
0
add_numbered_label
def add_numbered_label(self, label_base: str, dry_run: bool) -> None:labels = self.get_labels() if self.labels is not None else []full_label = label_basecount = 0for label in labels:if label_base in label:count += 1full_label = f"{label_base}X{count}"gh_add_labels(self.org, self.project, self.pr_num, [full_label], dry_...
4
9
3
75
0
1,113
1,121
1,113
null
[]
None
null
0
0
0
null
0
null
The function (add_numbered_label) defined within the public class called public.The function start at line 1113 and ends at 1121. It contains 9 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [1113.0] and does not return any value..
pytorch_ao
public
public
0
0
merge_into
def merge_into(self,repo: GitRepo,*,skip_mandatory_checks: bool = False,dry_run: bool = False,comment_id: Optional[int] = None,ignore_current_checks: Optional[List[str]] = None,) -> None:# Raises exception if matching rule is not found(merge_rule,pending_checks,failed_checks,ignorable_checks,) = find_matching_merge_rul...
5
52
6
285
0
1,123
1,182
1,123
null
[]
None
null
0
0
0
null
0
null
The function (merge_into) defined within the public class called public.The function start at line 1123 and ends at 1182. It contains 52 lines of code and it has a cyclomatic complexity of 5. It takes 6 parameters, represented as [1123.0] and does not return any value..
pytorch_ao
public
public
0
0
merge_changes
def merge_changes(self,repo: GitRepo,skip_mandatory_checks: bool = False,comment_id: Optional[int] = None,branch: Optional[str] = None,skip_all_rule_checks: bool = False,) -> List["GitHubPR"]:""":param skip_all_rule_checks: If true, skips all rule checks, useful for dry-running merge locally"""branch_to_merge_into = se...
4
25
6
148
0
1,184
1,211
1,184
null
[]
None
null
0
0
0
null
0
null
The function (merge_changes) defined within the public class called public.The function start at line 1184 and ends at 1211. It contains 25 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [1184.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, message: str, rule: Optional["MergeRule"] = None) -> None:super().__init__(message)self.rule = rule
1
3
3
33
0
1,215
1,217
1,215
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 1215 and ends at 1217. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [1215.0] and does not return any value..
pytorch_ao
public
public
0
0
gen_new_issue_link
def gen_new_issue_link(org: str, project: str, labels: List[str], template: str = "bug-report.yml") -> str:labels_str = ",".join(labels)return (f"https://github.com/{org}/{project}/issues/new?"f"labels={urllib.parse.quote(labels_str)}&"f"template={urllib.parse.quote(template)}")
1
9
4
43
1
1,237
1,245
1,237
null
['labels_str']
None
null
0
0
0
null
0
null
The function (gen_new_issue_link) defined within the public class called public.The function start at line 1237 and ends at 1245. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [1237.0] and does not return any value..
pytorch_ao
public
public
0
0
read_merge_rules
def read_merge_rules(repo: Optional[GitRepo], org: str, project: str) -> List[MergeRule]:"""Returns the list of all merge rules for the repo or project.NB: this function is used in Meta-internal workflows, see the commentat the top of this file for details."""repo_relative_rules_path = MERGE_RULE_PATHif repo is None:js...
5
20
3
138
5
1,248
1,272
1,248
null
['repo_relative_rules_path', 'rules_path', 'json_data', 'content', 'rc']
None
null
0
0
0
null
0
null
The function (read_merge_rules) defined within the public class called public.The function start at line 1248 and ends at 1272. It contains 20 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [1248.0] and does not return any value..
pytorch_ao
public
public
0
0
find_matching_merge_rule
def find_matching_merge_rule(pr: GitHubPR,repo: Optional[GitRepo] = None,skip_mandatory_checks: bool = False,skip_internal_checks: bool = False,ignore_current_checks: Optional[List[str]] = None,) -> Tuple[MergeRule,List[Tuple[str, Optional[str], Optional[int]]],List[Tuple[str, Optional[str], Optional[int]]],Dict[str, L...
1
11
5
91
0
1,275
1,285
1,275
null
[]
None
null
0
0
0
null
0
null
The function (find_matching_merge_rule) defined within the public class called public.The function start at line 1275 and ends at 1285. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [1275.0] and does not return any value..
pytorch_ao
public
public
0
0
checks_to_str
def checks_to_str(checks: List[Tuple[str, Optional[str]]]) -> str:return ", ".join(f"[{c[0]}]({c[1]})" if c[1] is not None else c[0] for c in checks)
3
2
1
45
0
1,472
1,473
1,472
null
[]
None
null
0
0
0
null
0
null
The function (checks_to_str) defined within the public class called public.The function start at line 1472 and ends at 1473. It contains 2 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
checks_to_markdown_bullets
def checks_to_markdown_bullets(checks: List[Tuple[str, Optional[str], Optional[int]]],) -> List[str]:return [f"- [{c[0]}]({c[1]})" if c[1] is not None else f"- {c[0]}" for c in checks[:5]]
3
6
1
53
0
1,476
1,481
1,476
null
[]
None
null
0
0
0
null
0
null
The function (checks_to_markdown_bullets) defined within the public class called public.The function start at line 1476 and ends at 1481. It contains 6 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
save_merge_record
def save_merge_record(comment_id: int,pr_num: int,owner: str,project: str,author: str,pending_checks: List[Tuple[str, Optional[str], Optional[int]]],failed_checks: List[Tuple[str, Optional[str], Optional[int]]],ignore_current_checks: List[Tuple[str, Optional[str], Optional[int]]],broken_trunk_checks: List[Tuple[str, Op...
1
46
18
304
2
1,485
1,538
1,485
null
['data', 'repo_root']
None
null
0
0
0
null
0
null
The function (save_merge_record) defined within the public class called public.The function start at line 1485 and ends at 1538. It contains 46 lines of code and it has a cyclomatic complexity of 1. It takes 18 parameters, represented as [1485.0] and does not return any value..
pytorch_ao
public
public
0
0
get_rockset_results
def get_rockset_results(head_sha: str, merge_base: str) -> List[Dict[str, Any]]:query = f"""SELECTw.name as workflow_name,j.id,j.name,j.conclusion,j.completed_at,j.html_url,j.head_sha,j.torchci_classification.captures as failure_captures,LENGTH(j.steps) as steps,FROMcommons.workflow_job j join commons.workflow_run w on...
2
10
2
80
2
1,542
1,568
1,542
null
['res', 'query']
None
null
0
0
0
null
0
null
The function (get_rockset_results) defined within the public class called public.The function start at line 1542 and ends at 1568. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1542.0] and does not return any value..
pytorch_ao
public
public
0
0
get_drci_classifications
def get_drci_classifications(pr_num: int, project: str = "pytorch") -> Any:"""Query HUD API to find similar failures to decide if they are flaky"""# NB: This doesn't work internally atm because this requires making an# external API call to HUDfailures = gh_fetch_url(f"https://hud.pytorch.org/api/drci/drci?prNumber={pr_...
2
12
2
77
1
1,572
1,589
1,572
null
['failures']
None
null
0
0
0
null
0
null
The function (get_drci_classifications) defined within the public class called public.The function start at line 1572 and ends at 1589. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1572.0] and does not return any value..
pytorch_ao
public
public
0
0
remove_job_name_suffix
def remove_job_name_suffix(name: str, replacement: str = ")") -> str:return re.sub(REMOVE_JOB_NAME_SUFFIX_REGEX, replacement, name)
1
2
2
26
0
1,595
1,596
1,595
null
[]
None
null
0
0
0
null
0
null
The function (remove_job_name_suffix) defined within the public class called public.The function start at line 1595 and ends at 1596. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1595.0] and does not return any value..
pytorch_ao
public
public
0
0
is_broken_trunk
def is_broken_trunk(check: JobCheckState,drci_classifications: Any,) -> bool:if not check or not drci_classifications:return Falsename = check.namejob_id = check.job_id# Consult the list of broken trunk failures from Dr.CIreturn any((name == broken_trunk["name"]) or (job_id and job_id == broken_trunk["id"])for broken_t...
6
12
2
68
2
1,599
1,613
1,599
null
['job_id', 'name']
None
null
0
0
0
null
0
null
The function (is_broken_trunk) defined within the public class called public.The function start at line 1599 and ends at 1613. It contains 12 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [1599.0] and does not return any value..
pytorch_ao
public
public
0
0
is_unstable
def is_unstable(check: JobCheckState,drci_classifications: Any,) -> bool:if not check or not drci_classifications:return Falsename = check.namejob_id = check.job_id# The job name has the unstable keyword. This is the original way to mark a job# as unstable on HUD, Dr.CI, and trymergeif "unstable" in name:return True# C...
7
14
2
75
2
1,616
1,635
1,616
null
['job_id', 'name']
None
null
0
0
0
null
0
null
The function (is_unstable) defined within the public class called public.The function start at line 1616 and ends at 1635. It contains 14 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [1616.0] and does not return any value..
pytorch_ao
public
public
0
0
is_flaky
def is_flaky(check: JobCheckState,drci_classifications: Any,) -> bool:if not check or not drci_classifications:return Falsename = check.namejob_id = check.job_id# Consult the list of flaky failures from Dr.CIreturn any((name == flaky["name"] or (job_id and job_id == flaky["id"]))for flaky in drci_classifications.get("F...
6
12
2
68
2
1,638
1,652
1,638
null
['job_id', 'name']
None
null
0
0
0
null
0
null
The function (is_flaky) defined within the public class called public.The function start at line 1638 and ends at 1652. It contains 12 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [1638.0] and does not return any value..
pytorch_ao
public
public
0
0
is_invalid_cancel
def is_invalid_cancel(name: str,conclusion: Optional[str],drci_classifications: Any,) -> bool:"""After https://github.com/pytorch/test-infra/pull/4579, invalid cancelledsignals have been removed from HUD and Dr.CI. The same needs to be donehere for consistency"""if (not nameor not drci_classificationsor not conclusiono...
6
15
3
66
0
1,655
1,677
1,655
null
[]
None
null
0
0
0
null
0
null
The function (is_invalid_cancel) defined within the public class called public.The function start at line 1655 and ends at 1677. It contains 15 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [1655.0] and does not return any value..
pytorch_ao
public
public
0
0
get_classifications.get_readable_drci_results
def get_readable_drci_results(drci_classifications: Any) -> str:try:s = f"From Dr.CI API ({pr_num}):\n"for classification, jobs in drci_classifications.items():s += f"{classification}: \n"for job in jobs:s += f"{job['id']} {job['name']}\n"return sexcept Exception:return f"From Dr.CI API: {json.dumps(drci_classification...
4
10
1
47
0
1,691
1,700
1,691
null
[]
None
null
0
0
0
null
0
null
The function (get_classifications.get_readable_drci_results) defined within the public class called public.The function start at line 1691 and ends at 1700. It contains 10 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
get_classifications
def get_classifications(pr_num: int,project: str,checks: Dict[str, JobCheckState],ignore_current_checks: Optional[List[str]],) -> Dict[str, JobCheckState]:# Get the failure classification from Dr.CI, which is the source of truth# going forward. It's preferable to try calling Dr.CI API directly first# to get the latest ...
15
81
4
374
4
1,680
1,789
1,680
null
['drci_classifications', 'drci_summary', 's', 'checks_with_classifications']
None
null
0
0
0
null
0
null
The function (get_classifications) defined within the public class called public.The function start at line 1680 and ends at 1789. It contains 81 lines of code and it has a cyclomatic complexity of 15. It takes 4 parameters, represented as [1680.0] and does not return any value..
pytorch_ao
public
public
0
0
filter_checks_with_lambda
def filter_checks_with_lambda(checks: JobNameToStateDict, status_filter: Callable[[Optional[str]], bool]) -> List[JobCheckState]:return [check for check in checks.values() if status_filter(check.status)]
3
4
2
45
0
1,792
1,795
1,792
null
[]
None
null
0
0
0
null
0
null
The function (filter_checks_with_lambda) defined within the public class called public.The function start at line 1792 and ends at 1795. It contains 4 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1792.0] and does not return any value..
pytorch_ao
public
public
0
0
get_pr_commit_sha
def get_pr_commit_sha(repo: GitRepo, pr: GitHubPR) -> str:commit_sha = pr.get_merge_commit()if commit_sha is not None:return commit_shacommits = repo.commits_resolving_gh_pr(pr.pr_num)if len(commits) == 0:raise PostCommentError("Can't find any commits resolving PR")return commits[0]
3
8
2
56
2
1,798
1,805
1,798
null
['commits', 'commit_sha']
None
null
0
0
0
null
0
null
The function (get_pr_commit_sha) defined within the public class called public.The function start at line 1798 and ends at 1805. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1798.0] and does not return any value..
pytorch_ao
public
public
0
0
validate_revert
def validate_revert(repo: GitRepo, pr: GitHubPR, *, comment_id: Optional[int] = None) -> Tuple[str, str]:comment = (pr.get_last_comment()if comment_id is Noneelse pr.get_comment_by_id(comment_id))if comment.editor_login is not None:raise PostCommentError("Don't want to revert based on edited command")author_association...
5
25
3
136
5
1,808
1,835
1,808
null
['allowed_reverters', 'comment', 'commit_sha', 'author_login', 'author_association']
None
null
0
0
0
null
0
null
The function (validate_revert) defined within the public class called public.The function start at line 1808 and ends at 1835. It contains 25 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [1808.0] and does not return any value..
pytorch_ao
public
public
0
0
get_ghstack_dependent_prs
def get_ghstack_dependent_prs(repo: GitRepo, pr: GitHubPR, only_closed: bool = True) -> List[Tuple[str, GitHubPR]]:"""Get the PRs in the stack that are above this PR (inclusive).Throws error if stack have branched or original branches are gone"""assert pr.is_ghstack_pr()orig_ref = f"{repo.remote}/{pr.get_ghstack_orig_r...
9
30
3
209
5
1,838
1,874
1,838
null
['skip_len', 'orig_ref', 'commit_sha', 'rev_list', 'candidate']
None
null
0
0
0
null
0
null
The function (get_ghstack_dependent_prs) defined within the public class called public.The function start at line 1838 and ends at 1874. It contains 30 lines of code and it has a cyclomatic complexity of 9. It takes 3 parameters, represented as [1838.0] and does not return any value..
pytorch_ao
public
public
0
0
do_revert_prs
def do_revert_prs(repo: GitRepo,shas_and_prs: List[Tuple[str, GitHubPR]],*,author_login: str,extra_msg: str = "",skip_internal_checks: bool = False,dry_run: bool = False,) -> None:# Prepare and push revert commitsfor commit_sha, pr in shas_and_prs:revert_msg = f"\nReverted {pr.get_pr_url()} on behalf of {prefix_with_gi...
7
37
6
221
3
1,877
1,917
1,877
null
['revert_msg', 'revert_message', 'msg']
None
null
0
0
0
null
0
null
The function (do_revert_prs) defined within the public class called public.The function start at line 1877 and ends at 1917. It contains 37 lines of code and it has a cyclomatic complexity of 7. It takes 6 parameters, represented as [1877.0] and does not return any value..
pytorch_ao
public
public
0
0
try_revert
def try_revert(repo: GitRepo,pr: GitHubPR,*,dry_run: bool = False,comment_id: Optional[int] = None,reason: Optional[str] = None,) -> None:try:author_login, commit_sha = validate_revert(repo, pr, comment_id=comment_id)except PostCommentError as e:gh_post_pr_comment(pr.org, pr.project, pr.pr_num, str(e), dry_run=dry_run)...
7
37
5
199
3
1,920
1,958
1,920
null
['extra_msg', 'prs_to_revert', 'shas_and_prs']
None
null
0
0
0
null
0
null
The function (try_revert) defined within the public class called public.The function start at line 1920 and ends at 1958. It contains 37 lines of code and it has a cyclomatic complexity of 7. It takes 5 parameters, represented as [1920.0] and does not return any value..
pytorch_ao
public
public
0
0
prefix_with_github_url
def prefix_with_github_url(suffix_str: str) -> str:return f"https://github.com/{suffix_str}"
1
2
1
12
0
1,961
1,962
1,961
null
[]
None
null
0
0
0
null
0
null
The function (prefix_with_github_url) defined within the public class called public.The function start at line 1961 and ends at 1962. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
check_for_sev
def check_for_sev(org: str, project: str, skip_mandatory_checks: bool) -> None:if skip_mandatory_checks:returnresponse = cast(Dict[str, Any],gh_fetch_json_list("https://api.github.com/search/issues",params={"q": f'repo:{org}/{project} is:open is:issue label:"ci: sev"'},),)if response["total_count"] != 0:for item in res...
5
19
3
83
1
1,965
1,983
1,965
null
['response']
None
null
0
0
0
null
0
null
The function (check_for_sev) defined within the public class called public.The function start at line 1965 and ends at 1983. It contains 19 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [1965.0] and does not return any value..
pytorch_ao
public
public
0
0
has_label
def has_label(labels: List[str], pattern: Pattern[str] = CIFLOW_LABEL) -> bool:return len(list(filter(pattern.match, labels))) > 0
1
2
2
38
0
1,986
1,987
1,986
null
[]
None
null
0
0
0
null
0
null
The function (has_label) defined within the public class called public.The function start at line 1986 and ends at 1987. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1986.0] and does not return any value..
pytorch_ao
public
public
0
0
categorize_checks
def categorize_checks(check_runs: JobNameToStateDict,required_checks: List[str],ok_failed_checks_threshold: Optional[int] = None,) -> Tuple[List[Tuple[str, Optional[str], Optional[int]]],List[Tuple[str, Optional[str], Optional[int]]],Dict[str, List[Any]],
1
8
3
72
0
1,990
1,997
1,990
null
[]
None
null
0
0
0
null
0
null
The function (categorize_checks) defined within the public class called public.The function start at line 1990 and ends at 1997. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [1990.0] and does not return any value..
pytorch_ao
public
public
0
0
merge
def merge(pr: GitHubPR,repo: GitRepo,dry_run: bool = False,skip_mandatory_checks: bool = False,comment_id: Optional[int] = None,timeout_minutes: int = 400,stale_pr_days: int = 3,ignore_current: bool = False,) -> None:initial_commit_sha = pr.last_commit()["oid"]pr_link = f"https://github.com/{pr.org}/{pr.project}/pull/{...
21
140
8
660
16
2,070
2,233
2,070
null
['initial_commit_sha', 'failed_rule_message', 'explainer', 'elapsed_time', 'ignore_current_checks', 'last_exception', 'checks', 'pr_link', 'msg', 'current_time', 'ignore_flaky_failures', 'pr', 'start_time', 'ignore_current_checks_info', 'startup_failures', 'required_checks']
None
null
0
0
0
null
0
null
The function (merge) defined within the public class called public.The function start at line 2070 and ends at 2233. It contains 140 lines of code and it has a cyclomatic complexity of 21. It takes 8 parameters, represented as [2070.0] and does not return any value..
pytorch_ao
public
public
0
0
main.handle_exception
def handle_exception(e: Exception, title: str = "Merge failed") -> None:exception = f"**Reason**: {e}"failing_rule = Noneif isinstance(e, MergeRuleFailedError):failing_rule = e.rule.name if e.rule else Noneinternal_debugging = ""run_url = os.getenv("GH_RUN_URL")if run_url is not None:# Hide this behind a collapsed bull...
7
22
2
133
0
2,242
2,269
2,242
null
[]
None
null
0
0
0
null
0
null
The function (main.handle_exception) defined within the public class called public.The function start at line 2242 and ends at 2269. It contains 22 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [2242.0] and does not return any value..
pytorch_ao
public
public
0
0
main
def main() -> None:args = parse_args()repo = GitRepo(get_git_repo_dir(), get_git_remote_name())org, project = repo.gh_owner_and_name()pr = GitHubPR(org, project, args.pr_num)def handle_exception(e: Exception, title: str = "Merge failed") -> None:exception = f"**Reason**: {e}"failing_rule = Noneif isinstance(e, MergeRul...
17
106
0
481
9
2,236
2,378
2,236
null
['repo', 'args', 'internal_debugging', 'failing_rule', 'pr', 'run_url', 'message', 'exception', 'msg']
None
null
0
0
0
null
0
null
The function (main) defined within the public class called public.The function start at line 2236 and ends at 2378. It contains 106 lines of code and it has a cyclomatic complexity of 17. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
has_label
def has_label(labels: List[str], pattern: Pattern[str] = CIFLOW_LABEL) -> bool:return len(list(filter(pattern.match, labels))) > 0
1
2
2
38
0
15
16
15
null
[]
None
null
0
0
0
null
0
null
The function (has_label) defined within the public class called public.The function start at line 15 and ends at 16. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [15.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,force: bool,labels: List[str],pr_num: int,org: str,project: str,ignore_current: bool,):self.force = forceself.labels = labelsself.pr_num = pr_numself.org = orgself.project = projectself.ignore_current = ignore_current
1
15
7
63
0
30
44
30
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 30 and ends at 44. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [30.0] and does not return any value..
pytorch_ao
public
public
0
0
_get_flag_msg
def _get_flag_msg(self,ignore_current_checks: Optional[List[Tuple[str, Optional[str], Optional[int]]]] = None,) -> str:if self.force:return ("Your change will be merged immediately since you used the force (-f) flag, "+ "**bypassing any CI checks** (ETA: 1-5 minutes)."+ "Please use `-f` as last resort and instead consi...
5
20
3
83
0
46
65
46
null
[]
None
null
0
0
0
null
0
null
The function (_get_flag_msg) defined within the public class called public.The function start at line 46 and ends at 65. It contains 20 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [46.0] and does not return any value..
pytorch_ao
public
public
0
0
get_merge_message
def get_merge_message(self,ignore_current_checks: Optional[List[Tuple[str, Optional[str], Optional[int]]]] = None,) -> str:title = "### Merge started"main_message = self._get_flag_msg(ignore_current_checks)advanced_debugging = "\n".join(("<details><summary>Advanced Debugging</summary>","Check the merge workflow status ...
1
22
3
85
0
67
90
67
null
[]
None
null
0
0
0
null
0
null
The function (get_merge_message) defined within the public class called public.The function start at line 67 and ends at 90. It contains 22 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [67.0] and does not return any value..
pytorch_ao
public
public
0
0
get_revert_message
def get_revert_message(org: str, project: str, pr_num: int) -> str:msg = ("@pytorchbot successfully started a revert job."+ f" Check the current status [here]({os.getenv('GH_RUN_URL')}).\n")msg += CONTACT_USreturn msg
1
7
3
30
1
93
99
93
null
['msg']
None
null
0
0
0
null
0
null
The function (get_revert_message) defined within the public class called public.The function start at line 93 and ends at 99. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [93.0] and does not return any value..
pytorch_ao
public
public
0
0
eval_peak_memory_usage
def eval_peak_memory_usage(model_id: str):model = AutoModelForCausalLM.from_pretrained(model_id, device_map="cuda:0", torch_dtype=torch.bfloat16)tokenizer = AutoTokenizer.from_pretrained(model_id)torch.cuda.reset_peak_memory_stats()prompt = "Hey, are you conscious? Can you talk to me?"messages = [{"role": "system","con...
1
32
1
174
9
13
47
13
null
['messages', 'mem', 'templated_prompt', 'output_text', 'tokenizer', 'model', 'prompt', 'generated_ids', 'inputs']
None
null
0
0
0
null
0
null
The function (eval_peak_memory_usage) defined within the public class called public.The function start at line 13 and ends at 47. It contains 32 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_get_username
def _get_username():token = get_token()username = whoami(token=token)["name"]return username
1
4
0
22
2
31
34
31
null
['username', 'token']
None
null
0
0
0
null
0
null
The function (_get_username) defined within the public class called public.The function start at line 31 and ends at 34. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_untie_weights_and_save_locally
def _untie_weights_and_save_locally(model_id):untied_model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="cuda:0")tokenizer = AutoTokenizer.from_pretrained(model_id)from transformers.modeling_utils import find_tied_parametersif getattr(untied_model.config.get_text_config(decoder=True),...
2
24
1
137
4
37
67
37
null
['untied_model', 'MODEL_NAME', 'tokenizer', 'save_to_local_path']
None
null
0
0
0
null
0
null
The function (_untie_weights_and_save_locally) defined within the public class called public.The function start at line 37 and ends at 67. It contains 24 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
quantize_and_upload
def quantize_and_upload(model_id: str,quant: str,tasks: List[str],calibration_limit: int,max_seq_length: int,push_to_hub: bool,push_to_user_id: str,populate_model_card_template: bool,):_int8_int4_linear_config = Int8DynamicActivationIntxWeightConfig(weight_dtype=torch.int4,weight_granularity=PerGroup(32),)_int8_int4_em...
14
162
8
727
27
582
765
582
null
['torchao_config_kwargs', 'content', 'card', 'tokenizer', 'username', 'quant_config', 'model_to_quantize', 'quantized_model_id', 'output_text', 'quantization_config', 'MODEL_NAME', 'quant_to_quant_code', 'untied_model_path', '_int8_int4_linear_config', 'save_to_user_id', 'base_config', 'messages', 'quant_to_config', 'i...
None
null
0
0
0
null
0
null
The function (quantize_and_upload) defined within the public class called public.The function start at line 582 and ends at 765. It contains 162 lines of code and it has a cyclomatic complexity of 14. It takes 8 parameters, represented as [582.0] and does not return any value..
pytorch_ao
public
public
0
0
_int8wo_api
def _int8wo_api(mod, **kwargs):quantize_(mod, Int8WeightOnlyConfig(**kwargs), set_inductor_config=False)
1
2
2
22
0
25
26
25
null
[]
None
null
0
0
0
null
0
null
The function (_int8wo_api) defined within the public class called public.The function start at line 25 and ends at 26. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [25.0] and does not return any value..
pytorch_ao
public
public
0
0
_int8da_int8w_api
def _int8da_int8w_api(mod, **kwargs):quantize_(mod,Int8DynamicActivationInt8WeightConfig(**kwargs),set_inductor_config=False,)
1
6
2
23
0
29
34
29
null
[]
None
null
0
0
0
null
0
null
The function (_int8da_int8w_api) defined within the public class called public.The function start at line 29 and ends at 34. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [29.0] and does not return any value..
pytorch_ao
public
public
0
0
_int4wo_api
def _int4wo_api(mod, **kwargs):kwargs_copy = kwargs.copy()if "groupsize" in kwargs_copy:kwargs_copy["group_size"] = kwargs_copy["groupsize"]del kwargs_copy["groupsize"]quantize_(mod, Int4WeightOnlyConfig(**kwargs_copy), set_inductor_config=False)
2
6
2
48
1
37
42
37
null
['kwargs_copy']
None
null
0
0
0
null
0
null
The function (_int4wo_api) defined within the public class called public.The function start at line 37 and ends at 42. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [37.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, m=64, n=32, k=64, has_bias=False, dtype=torch.float, device="cuda"):super().__init__()self.m = mself.dtype = dtypeself.device = deviceself.linear = torch.nn.Linear(k, n, bias=has_bias).to(dtype=self.dtype, device=self.device)
1
10
7
86
0
48
57
48
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 48 and ends at 57. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [48.0] and does not return any value..
pytorch_ao
public
public
0
0
example_inputs
def example_inputs(self):return (torch.randn(self.m, self.linear.in_features, dtype=self.dtype, device=self.device),)
1
6
1
35
0
59
64
59
null
[]
None
null
0
0
0
null
0
null
The function (example_inputs) defined within the public class called public.The function start at line 59 and ends at 64. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):x = self.linear(x)return x
1
3
2
17
0
66
68
66
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 66 and ends at 68. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [66.0] and does not return any value..
pytorch_ao
public
public
0
0
_ref_change_linear_weights_to_int8_dqtensors._in_features_greater_than_16
def _in_features_greater_than_16(mod, *args):return hasattr(mod, "in_features") and mod.in_features > 16
2
2
2
21
0
82
83
82
null
[]
None
null
0
0
0
null
0
null
The function (_ref_change_linear_weights_to_int8_dqtensors._in_features_greater_than_16) defined within the public class called public.The function start at line 82 and ends at 83. It contains 2 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [82.0] and does not return any v...
pytorch_ao
public
public
0
0
_ref_change_linear_weights_to_int8_dqtensors
def _ref_change_linear_weights_to_int8_dqtensors(model, filter_fn=None, **kwargs):"""The deprecated implementation for int8 dynamic quant API, used as a reference fornumerics and performance"""from torchao.quantization.quant_api import (_get_subclass_inserter,_is_linear,)from torchao.quantization.subclass import Int8Dy...
3
18
3
77
1
71
96
71
null
['filter_fn']
None
null
0
0
0
null
0
null
The function (_ref_change_linear_weights_to_int8_dqtensors) defined within the public class called public.The function start at line 71 and ends at 96. It contains 18 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [71.0] and does not return any value..
pytorch_ao
public
public
0
0
_get_ref_change_linear_weights_to_woqtensors._ref_change_linear_weights_to_woqtensors
def _ref_change_linear_weights_to_woqtensors(model, filter_fn=None, **kwargs):"""The deprecated implementation for weight only quant API, used as a reference fornumerics and performance"""from torchao.quantization.quant_api import _get_subclass_inserter, _is_linearfilter_fn = kwargs.pop("filter_fn", _is_linear)_replace...
1
10
3
52
0
100
115
100
null
[]
None
null
0
0
0
null
0
null
The function (_get_ref_change_linear_weights_to_woqtensors._ref_change_linear_weights_to_woqtensors) defined within the public class called public.The function start at line 100 and ends at 115. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [100.0] and does ...
pytorch_ao
public
public
0
0
_get_ref_change_linear_weights_to_woqtensors
def _get_ref_change_linear_weights_to_woqtensors(deprecated_tenosr_subclass):def _ref_change_linear_weights_to_woqtensors(model, filter_fn=None, **kwargs):"""The deprecated implementation for weight only quant API, used as a reference fornumerics and performance"""from torchao.quantization.quant_api import _get_subclas...
1
3
1
9
1
99
117
99
null
['filter_fn']
None
null
0
0
0
null
0
null
The function (_get_ref_change_linear_weights_to_woqtensors) defined within the public class called public.The function start at line 99 and ends at 117. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_bench_quantized_tensor_subclass_perf
def _bench_quantized_tensor_subclass_perf(api, ref_api, M, N, K, kwargs=None):if kwargs is None:kwargs = {}m = ToyLinearModel(M, N, K, has_bias=True, dtype=torch.bfloat16, device="cuda").eval()m_bf16 = copy.deepcopy(m)m_ref = copy.deepcopy(m)example_inputs = m.example_inputs()api(m, **kwargs)# referenceref_api(m_ref, *...
2
32
6
254
12
132
177
132
null
['ref_elapsed_time', 'res', 'elapsed_time', 'm_bf16', 'ref', 'm', 'kwargs', 'example_inputs', 'WARMUP', 'RUNS', 'bf16_elapsed_time', 'm_ref']
None
null
0
0
0
null
0
null
The function (_bench_quantized_tensor_subclass_perf) defined within the public class called public.The function start at line 132 and ends at 177. It contains 32 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [132.0] and does not return any value..
pytorch_ao
public
public
0
0
benchmark_microseconds
def benchmark_microseconds(f, *args, warmup=25, rep=100):return (do_bench(lambda: f(*args), warmup=warmup, rep=rep, return_mode="median") * 1e3)
1
4
4
43
0
26
29
26
null
[]
None
null
0
0
0
null
0
null
The function (benchmark_microseconds) defined within the public class called public.The function start at line 26 and ends at 29. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [26.0] and does not return any value..
pytorch_ao
public
public
0
0
get_blockwise_problem
def get_blockwise_problem(m: int, n: int, k: int, block_size: int, dtype: torch.dtype, device):assert n % block_size == 0 and k % block_size == 0, ("N and K dims must be divisible by block_size")assert dtype in [torch.float8_e4m3fn,torch.float8_e5m2,], "dtype must be torch.float8_e4m3fn or torch.float8_e5m2"dtype_max =...
2
18
6
155
5
32
50
32
null
['dtype_max', 'B', 'A_scale', 'B_scale', 'A']
None
null
0
0
0
null
0
null
The function (get_blockwise_problem) defined within the public class called public.The function start at line 32 and ends at 50. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [32.0] and does not return any value..
pytorch_ao
public
public
0
0
benchmark_latency
def benchmark_latency(m: int, k: int, n: int, block_size: int, dtype: torch.dtype, device):A_ref = torch.randn((m, k), dtype=torch.half, device=device)B_ref = torch.randn((n, k), dtype=torch.half, device=device)fp16_time = benchmark_microseconds(torch.nn.functional.linear, A_ref, B_ref)A, A_scale, B, B_scale = get_bloc...
1
20
6
162
4
53
74
53
null
['fp16_time', 'blockwise_time', 'A_ref', 'B_ref']
None
null
0
0
0
null
0
null
The function (benchmark_latency) defined within the public class called public.The function start at line 53 and ends at 74. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [53.0] and does not return any value..
pytorch_ao
public
public
0
0
benchmark_precision
def benchmark_precision(m: int, k: int, n: int, block_size: int, dtype: torch.dtype, device):lin = torch.nn.Linear(k, n, False, device, torch.half)A = torch.randn((m, k), dtype=torch.half, device=device)W = lin.weightoutput = A @ W.TA_q, A_s = fp8_blockwise_act_quant(A, block_size, dtype)W_q, W_s = fp8_blockwise_weight...
1
18
6
151
5
77
96
77
null
['output', 'lin', 'output_blockwise', 'W', 'A']
None
null
0
0
0
null
0
null
The function (benchmark_precision) defined within the public class called public.The function start at line 77 and ends at 96. It contains 18 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [77.0] and does not return any value..
pytorch_ao
public
public
0
0
benchmark_microseconds
def benchmark_microseconds(f, *args):return do_bench(lambda: f(*args), return_mode="median") * 1e3
1
2
2
25
0
25
26
25
null
[]
None
null
0
0
0
null
0
null
The function (benchmark_microseconds) defined within the public class called public.The function start at line 25 and ends at 26. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [25.0] and does not return any value..