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
anaconda_anaconda-client
UploaderTestCase
public
0
1
test_version
def test_version(self):aserver_api = mock.MagicMockuploader = Uploader(aserver_api, 'project', version='version')self.assertEqual(uploader.version, 'version')uploader = Uploader(aserver_api, 'project')self.assertIsInstance(uploader.version, str)
1
6
1
50
0
29
35
29
self
[]
None
{"Assign": 3, "Expr": 2}
4
7
4
["Uploader", "self.assertEqual", "Uploader", "self.assertIsInstance"]
0
[]
The function (test_version) defined within the public class called UploaderTestCase, that inherit another class.The function start at line 29 and ends at 35. 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. It declares 4.0 func...
anaconda_anaconda-client
UploaderTestCase
public
0
1
test_package_name
def test_package_name(self):aserver_api = mock.MagicMock()uploader = Uploader(aserver_api, '~/notebooks/my notebook.ipynb')self.assertEqual(uploader.project, 'my-notebook')
1
4
1
30
0
37
40
37
self
[]
None
{"Assign": 2, "Expr": 1}
3
4
3
["mock.MagicMock", "Uploader", "self.assertEqual"]
0
[]
The function (test_package_name) defined within the public class called UploaderTestCase, that inherit another class.The function start at line 37 and ends at 40. 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. It declares 3.0...
pytorch_ao
public
public
0
0
get_git_commit_id
def get_git_commit_id():try:return (subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).decode("ascii").strip())except Exception:return ""
2
9
0
37
0
22
30
22
null
[]
None
null
0
0
0
null
0
null
The function (get_git_commit_id) defined within the public class called public.The function start at line 22 and ends at 30. It contains 9 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
read_requirements
def read_requirements(file_path):with open(file_path, "r") as file:return file.read().splitlines()
1
3
1
25
0
33
35
33
null
[]
None
null
0
0
0
null
0
null
The function (read_requirements) defined within the public class called public.The function start at line 33 and ends at 35. 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
read_version
def read_version(file_path="version.txt"):with open(file_path, "r") as file:return file.readline().strip()
1
3
1
27
0
38
40
38
null
[]
None
null
0
0
0
null
0
null
The function (read_version) defined within the public class called public.The function start at line 38 and ends at 40. 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
use_debug_mode
def use_debug_mode():return os.getenv("DEBUG", "0") == "1"
1
2
0
15
0
97
98
97
null
[]
None
null
0
0
0
null
0
null
The function (use_debug_mode) defined within the public class called public.The function start at line 97 and ends at 98. 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
__init__
def __init__(self):# TORCHAO_BUILD_CPU_AARCH64 is enabled by default on Arm-based Apple machines# The kernels require sdot/udot, which are not required on Arm until Armv8.4 or later,# but are available on Arm-based Apple machines.On non-Apple machines, the kernels# can be built by explicitly setting TORCHAO_BUILD_CPU_A...
8
39
1
170
0
114
171
114
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 114 and ends at 171. It contains 39 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_os_bool_var
def _os_bool_var(self, var, default) -> bool:default_val = "1" if default else "0"return os.getenv(var, default_val) == "1"
2
3
3
29
0
173
175
173
null
[]
None
null
0
0
0
null
0
null
The function (_os_bool_var) defined within the public class called public.The function start at line 173 and ends at 175. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [173.0] and does not return any value..
pytorch_ao
public
public
0
0
get_submodule_folders
def get_submodule_folders():git_modules_path = os.path.join(cwd, ".gitmodules")default_modules_path = [os.path.join(third_party_path, name)for name in ["cutlass",]]if not os.path.exists(git_modules_path):return default_modules_pathwith open(git_modules_path) as f:return [os.path.join(cwd, line.split("=", 1)[1].strip())...
5
16
0
100
2
183
198
183
null
['default_modules_path', 'git_modules_path']
None
null
0
0
0
null
0
null
The function (get_submodule_folders) defined within the public class called public.The function start at line 183 and ends at 198. It contains 16 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
check_submodules.check_for_files
def check_for_files(folder, files):if not any(os.path.exists(os.path.join(folder, f)) for f in files):print("Could not find any of {} in {}".format(", ".join(files), folder))print("Did you run 'git submodule update --init --recursive'?")sys.exit(1)
3
5
2
60
0
202
206
202
null
[]
None
null
0
0
0
null
0
null
The function (check_submodules.check_for_files) defined within the public class called public.The function start at line 202 and ends at 206. It contains 5 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [202.0] and does not return any value..
pytorch_ao
public
public
0
0
check_submodules.not_exists_or_empty
def not_exists_or_empty(folder):return not os.path.exists(folder) or (os.path.isdir(folder) and len(os.listdir(folder)) == 0)
3
4
1
38
0
208
211
208
null
[]
None
null
0
0
0
null
0
null
The function (check_submodules.not_exists_or_empty) defined within the public class called public.The function start at line 208 and ends at 211. It contains 4 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
check_submodules
def check_submodules():def check_for_files(folder, files):if not any(os.path.exists(os.path.join(folder, f)) for f in files):print("Could not find any of {} in {}".format(", ".join(files), folder))print("Did you run 'git submodule update --init --recursive'?")sys.exit(1)def not_exists_or_empty(folder):return not os.pat...
6
31
0
127
3
201
241
201
null
['end', 'start', 'folders']
None
null
0
0
0
null
0
null
The function (check_submodules) defined within the public class called public.The function start at line 201 and ends at 241. It contains 31 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_cuda_version_from_nvcc
def get_cuda_version_from_nvcc():"""Get CUDA version from nvcc if available."""try:result = subprocess.check_output(["nvcc", "--version"], stderr=subprocess.STDOUT)output = result.decode("utf-8")# Look for version line like "release 12.6"for line in output.split("\n"):if "release" in line.lower():parts = line.split()fo...
7
14
0
103
3
244
260
244
null
['result', 'parts', 'output']
None
null
0
0
0
null
0
null
The function (get_cuda_version_from_nvcc) defined within the public class called public.The function start at line 244 and ends at 260. It contains 14 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_cutlass_build_flags
def get_cutlass_build_flags():"""Determine which CUTLASS kernels to build based on CUDA version.SM90a: CUDA 12.6+, SM100a: CUDA 12.8+"""# Try nvcc then torch versioncuda_version = get_cuda_version_from_nvcc() or torch.version.cudatry:if not cuda_version:raise ValueError("No CUDA version found")major, minor = map(int, c...
10
19
0
114
4
263
290
263
null
['cuda_arch_flags', 'build_sm100a', 'build_sm90a', 'cuda_version']
None
null
0
0
0
null
0
null
The function (get_cutlass_build_flags) defined within the public class called public.The function start at line 263 and ends at 290. It contains 19 lines of code and it has a cyclomatic complexity of 10. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, *args, **kwargs) -> None:super().__init__(*args, **kwargs)
1
2
3
25
0
295
296
295
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 295 and ends at 296. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [295.0] and does not return any value..
pytorch_ao
public
public
0
0
build_extensions
def build_extensions(self):cmake_extensions = [ext for ext in self.extensions if isinstance(ext, CMakeExtension)]other_extensions = [ext for ext in self.extensions if not isinstance(ext, CMakeExtension)]for ext in cmake_extensions:self.build_cmake(ext)# Use BuildExtension to build other extensionsself.extensions = othe...
6
12
1
72
0
298
312
298
null
[]
None
null
0
0
0
null
0
null
The function (build_extensions) defined within the public class called public.The function start at line 298 and ends at 312. It contains 12 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
build_cmake
def build_cmake(self, ext):extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))if not os.path.exists(self.build_temp):os.makedirs(self.build_temp)# Get the expected extension file name that Python will look for# We force CMake to use this library nameext_filename = os.path.basename(self.get_ext_fi...
2
31
2
164
0
314
350
314
null
[]
None
null
0
0
0
null
0
null
The function (build_cmake) defined within the public class called public.The function start at line 314 and ends at 350. It contains 31 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [314.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, name, cmake_lists_dir: str = "", cmake_args: Optional[List[str]] = None):Extension.__init__(self, name, sources=[])self.cmake_lists_dir = os.path.abspath(cmake_lists_dir)if cmake_args is None:cmake_args = []self.cmake_args = cmake_args
2
8
4
64
0
354
361
354
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 354 and ends at 361. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [354.0] and does not return any value..
pytorch_ao
public
public
0
0
get_extensions.bool_to_on_off
def bool_to_on_off(value):return "ON" if value else "OFF"
2
2
1
11
0
735
736
735
null
[]
None
null
0
0
0
null
0
null
The function (get_extensions.bool_to_on_off) defined within the public class called public.The function start at line 735 and ends at 736. It contains 2 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_extensions
def get_extensions():# Skip building C++ extensions if USE_CPP is set to "0"if use_cpp == "0":print("USE_CPP=0: Skipping compilation of C++ extensions")return []debug_mode = use_debug_mode()if debug_mode:print("Compiling in debug mode")if CUDA_HOME is None and torch.version.cuda:print("CUDA toolkit is not available. Sk...
76
328
0
1,647
44
364
762
364
null
['found_vec_ext', 'mxfp8_sources_to_exclude', 'build_for_sm90a', 'rocm_args', 'curdir', 'cutlass_extensions_include_dir', 'ext_modules', 'build_for_sm100a', 'text', 'extra_link_args', 'mxfp8_src_files_exist', 'mxfp8_extension_dir', 'extensions_dir', 'debug_mode', 'torch_dir', 'cutlass_100a_extra_compile_args', 'build_o...
None
null
0
0
0
null
0
null
The function (get_extensions) defined within the public class called public.The function start at line 364 and ends at 762. It contains 328 lines of code and it has a cyclomatic complexity of 76. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
gh_fetch_url_and_headers
def gh_fetch_url_and_headers(url: str,*,headers: Optional[Dict[str, str]] = None,data: Union[Optional[Dict[str, Any]], str] = None,method: Optional[str] = None,reader: Callable[[Any], Any] = lambda x: x.read(),) -> Tuple[Any, Any]:if headers is None:headers = {}token = os.environ.get("GITHUB_TOKEN")if token is not None...
10
26
7
222
3
26
58
26
null
['data_', 'headers', 'token']
None
null
0
0
0
null
0
null
The function (gh_fetch_url_and_headers) defined within the public class called public.The function start at line 26 and ends at 58. It contains 26 lines of code and it has a cyclomatic complexity of 10. It takes 7 parameters, represented as [26.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_fetch_url
def gh_fetch_url(url: str,*,headers: Optional[Dict[str, str]] = None,data: Union[Optional[Dict[str, Any]], str] = None,method: Optional[str] = None,reader: Callable[[Any], Any] = lambda x: x.read(),) -> Any:return gh_fetch_url_and_headers(url, headers=headers, data=data, reader=json.load, method=method)[1]
1
11
7
100
0
61
71
61
null
[]
None
null
0
0
0
null
0
null
The function (gh_fetch_url) defined within the public class called public.The function start at line 61 and ends at 71. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [61.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_fetch_json
def gh_fetch_json(url: str,params: Optional[Dict[str, Any]] = None,data: Optional[Dict[str, Any]] = None,method: Optional[str] = None,) -> List[Dict[str, Any]]:headers = {"Accept": "application/vnd.github.v3+json"}if params is not None and len(params) > 0:url += "?" + "&".join(f"{name}={quote(str(val))}" for name, val ...
4
15
4
133
1
74
88
74
null
['headers']
None
null
0
0
0
null
0
null
The function (gh_fetch_json) defined within the public class called public.The function start at line 74 and ends at 88. It contains 15 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [74.0] and does not return any value..
pytorch_ao
public
public
0
0
_gh_fetch_json_any
def _gh_fetch_json_any(url: str,params: Optional[Dict[str, Any]] = None,data: Optional[Dict[str, Any]] = None,) -> Any:headers = {"Accept": "application/vnd.github.v3+json"}if params is not None and len(params) > 0:url += "?" + "&".join(f"{name}={quote(str(val))}" for name, val in params.items())return gh_fetch_url(url...
4
11
3
98
1
91
101
91
null
['headers']
None
null
0
0
0
null
0
null
The function (_gh_fetch_json_any) defined within the public class called public.The function start at line 91 and ends at 101. It contains 11 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [91.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_fetch_json_list
def gh_fetch_json_list(url: str,params: Optional[Dict[str, Any]] = None,data: Optional[Dict[str, Any]] = None,) -> List[Dict[str, Any]]:return cast(List[Dict[str, Any]], _gh_fetch_json_any(url, params, data))
1
6
3
68
0
104
109
104
null
[]
None
null
0
0
0
null
0
null
The function (gh_fetch_json_list) defined within the public class called public.The function start at line 104 and ends at 109. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [104.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_fetch_json_dict
def gh_fetch_json_dict(url: str,params: Optional[Dict[str, Any]] = None,data: Optional[Dict[str, Any]] = None,) -> Dict[str, Any]:return cast(Dict[str, Any], _gh_fetch_json_any(url, params, data))
1
6
3
62
0
112
117
112
null
[]
None
null
0
0
0
null
0
null
The function (gh_fetch_json_dict) defined within the public class called public.The function start at line 112 and ends at 117. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [112.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_graphql
def gh_graphql(query: str, **kwargs: Any) -> Dict[str, Any]:rc = gh_fetch_url("https://api.github.com/graphql",data={"query": query, "variables": kwargs},reader=json.load,)if "errors" in rc:raise RuntimeError(f"GraphQL query {query}, args {kwargs} failed: {rc['errors']}")return cast(Dict[str, Any], rc)
2
11
2
67
1
120
130
120
null
['rc']
None
null
0
0
0
null
0
null
The function (gh_graphql) defined within the public class called public.The function start at line 120 and ends at 130. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [120.0] and does not return any value..
pytorch_ao
public
public
0
0
_gh_post_comment
def _gh_post_comment(url: str, comment: str, dry_run: bool = False) -> List[Dict[str, Any]]:if dry_run:print(comment)return []return gh_fetch_json_list(url, data={"body": comment})
2
7
3
50
0
133
139
133
null
[]
None
null
0
0
0
null
0
null
The function (_gh_post_comment) defined within the public class called public.The function start at line 133 and ends at 139. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [133.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_post_pr_comment
def gh_post_pr_comment(org: str, repo: str, pr_num: int, comment: str, dry_run: bool = False) -> List[Dict[str, Any]]:return _gh_post_comment(f"{GITHUB_API_URL}/repos/{org}/{repo}/issues/{pr_num}/comments",comment,dry_run,)
1
8
5
46
0
142
149
142
null
[]
None
null
0
0
0
null
0
null
The function (gh_post_pr_comment) defined within the public class called public.The function start at line 142 and ends at 149. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [142.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_post_commit_comment
def gh_post_commit_comment(org: str, repo: str, sha: str, comment: str, dry_run: bool = False) -> List[Dict[str, Any]]:return _gh_post_comment(f"{GITHUB_API_URL}/repos/{org}/{repo}/commits/{sha}/comments",comment,dry_run,)
1
8
5
46
0
152
159
152
null
[]
None
null
0
0
0
null
0
null
The function (gh_post_commit_comment) defined within the public class called public.The function start at line 152 and ends at 159. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [152.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_delete_comment
def gh_delete_comment(org: str, repo: str, comment_id: int) -> None:url = f"{GITHUB_API_URL}/repos/{org}/{repo}/issues/comments/{comment_id}"gh_fetch_url(url, method="DELETE")
1
3
3
29
1
162
164
162
null
['url']
None
null
0
0
0
null
0
null
The function (gh_delete_comment) defined within the public class called public.The function start at line 162 and ends at 164. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [162.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_fetch_merge_base
def gh_fetch_merge_base(org: str, repo: str, base: str, head: str) -> str:merge_base = ""# Get the merge base using the GitHub REST API. This is the same as using# git merge-base without the need to have git. The API doc can be found at# https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-...
3
17
4
92
2
167
187
167
null
['merge_base', 'json_data']
None
null
0
0
0
null
0
null
The function (gh_fetch_merge_base) defined within the public class called public.The function start at line 167 and ends at 187. It contains 17 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [167.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_update_pr_state
def gh_update_pr_state(org: str, repo: str, pr_num: int, state: str = "open") -> None:url = f"{GITHUB_API_URL}/repos/{org}/{repo}/pulls/{pr_num}"try:gh_fetch_url(url, method="PATCH", data={"state": state})except HTTPError as err:# When trying to open the pull request, error 422 means that the branch# has been deleted a...
4
11
4
71
1
190
202
190
null
['url']
None
null
0
0
0
null
0
null
The function (gh_update_pr_state) defined within the public class called public.The function start at line 190 and ends at 202. It contains 11 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [190.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_query_issues_by_labels
def gh_query_issues_by_labels(org: str, repo: str, labels: List[str], state: str = "open") -> List[Dict[str, Any]]:url = f"{GITHUB_API_URL}/repos/{org}/{repo}/issues"return gh_fetch_json(url, method="GET", params={"labels": ",".join(labels), "state": state})
1
7
4
64
1
205
211
205
null
['url']
None
null
0
0
0
null
0
null
The function (gh_query_issues_by_labels) defined within the public class called public.The function start at line 205 and ends at 211. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [205.0] and does not return any value..
pytorch_ao
public
public
0
0
get_git_remote_name
def get_git_remote_name() -> str:return os.getenv("GIT_REMOTE_NAME", "origin")
1
2
0
15
0
27
28
27
null
[]
None
null
0
0
0
null
0
null
The function (get_git_remote_name) defined within the public class called public.The function start at line 27 and ends at 28. 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_git_repo_dir
def get_git_repo_dir() -> str:from pathlib import Pathreturn os.getenv("GIT_REPO_DIR", str(Path(__file__).resolve().parent.parent.parent))
1
3
0
35
0
31
34
31
null
[]
None
null
0
0
0
null
0
null
The function (get_git_repo_dir) defined within the public class called public.The function start at line 31 and ends at 34. 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
fuzzy_list_to_dict
def fuzzy_list_to_dict(items: List[Tuple[str, str]]) -> Dict[str, List[str]]:"""Converts list to dict preserving elements with duplicate keys"""rc: Dict[str, List[str]] = defaultdict(list)for key, val in items:rc[key].append(val)return dict(rc)
2
5
1
63
0
37
44
37
null
[]
None
null
0
0
0
null
0
null
The function (fuzzy_list_to_dict) defined within the public class called public.The function start at line 37 and ends at 44. 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
_check_output
def _check_output(items: List[str], encoding: str = "utf-8") -> str:from subprocess import STDOUT, CalledProcessError, check_outputtry:return check_output(items, stderr=STDOUT).decode(encoding)except CalledProcessError as e:msg = f"Command `{' '.join(e.cmd)}` returned non-zero exit code {e.returncode}"stdout = e.stdout...
5
15
2
124
3
47
63
47
null
['stdout', 'msg', 'stderr']
None
null
0
0
0
null
0
null
The function (_check_output) defined within the public class called public.The function start at line 47 and ends at 63. It contains 15 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [47.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,commit_hash: str,author: str,author_date: datetime,title: str,body: str,commit_date: Optional[datetime] = None,) -> None:self.commit_hash = commit_hashself.author = authorself.author_date = author_dateself.commit_date = commit_dateself.title = titleself.body = body
1
15
7
67
0
74
88
74
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 74 and ends at 88. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [74.0] and does not return any value..
pytorch_ao
public
public
0
0
__repr__
def __repr__(self) -> str:return f"{self.title} ({self.commit_hash})"
1
2
1
10
0
90
91
90
null
[]
None
null
0
0
0
null
0
null
The function (__repr__) defined within the public class called public.The function start at line 90 and ends at 91. 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
__contains__
def __contains__(self, item: Any) -> bool:return item in self.body or item in self.title
2
2
2
23
0
93
94
93
null
[]
None
null
0
0
0
null
0
null
The function (__contains__) defined within the public class called public.The function start at line 93 and ends at 94. It contains 2 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [93.0] and does not return any value..
pytorch_ao
public
public
0
0
parse_fuller_format
def parse_fuller_format(lines: Union[str, List[str]]) -> GitCommit:"""Expect commit message generated using `--format=fuller --date=unix` format, i.e.:commit <sha1>Author: <author>AuthorDate: <author date>Commit: <committer>CommitDate: <committer date><title line><full commit message>"""if isinstance(lines, str):lines ...
4
20
1
249
1
97
130
97
null
['lines']
None
null
0
0
0
null
0
null
The function (parse_fuller_format) defined within the public class called public.The function start at line 97 and ends at 130. 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
__init__
def __init__(self, path: str, remote: str = "origin", debug: bool = False) -> None:self.repo_dir = pathself.remote = remoteself.debug = debug
1
4
4
38
0
134
137
134
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 134 and ends at 137. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [134.0] and does not return any value..
pytorch_ao
public
public
0
0
_run_git
def _run_git(self, *args: Any) -> str:if self.debug:print(f"+ git -C {self.repo_dir} {' '.join(args)}")return _check_output(["git", "-C", self.repo_dir] + list(args))
2
4
2
40
0
139
142
139
null
[]
None
null
0
0
0
null
0
null
The function (_run_git) defined within the public class called public.The function start at line 139 and ends at 142. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [139.0] and does not return any value..
pytorch_ao
public
public
0
0
revlist
def revlist(self, revision_range: str) -> List[str]:rc = self._run_git("rev-list", revision_range, "--", ".").strip()return rc.split("\n") if len(rc) > 0 else []
2
3
2
49
0
144
146
144
null
[]
None
null
0
0
0
null
0
null
The function (revlist) defined within the public class called public.The function start at line 144 and ends at 146. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [144.0] and does not return any value..
pytorch_ao
public
public
0
0
branches_containing_ref
def branches_containing_ref(self, ref: str, *, include_remote: bool = True) -> List[str]:rc = (self._run_git("branch", "--remote", "--contains", ref)if include_remoteelse self._run_git("branch", "--contains", ref))return [x.strip() for x in rc.split("\n") if x.strip()] if len(rc) > 0 else []
5
9
3
84
0
148
156
148
null
[]
None
null
0
0
0
null
0
null
The function (branches_containing_ref) defined within the public class called public.The function start at line 148 and ends at 156. It contains 9 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [148.0] and does not return any value..
pytorch_ao
public
public
0
0
current_branch
def current_branch(self) -> Optional[str]:try:return self._run_git("symbolic-ref", "--short", "HEAD").strip()except RuntimeError:# we are in detached HEAD statereturn None
2
5
1
32
0
158
163
158
null
[]
None
null
0
0
0
null
0
null
The function (current_branch) defined within the public class called public.The function start at line 158 and ends at 163. 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
checkout
def checkout(self, branch: str) -> None:self._run_git("checkout", branch)
1
2
2
19
0
165
166
165
null
[]
None
null
0
0
0
null
0
null
The function (checkout) defined within the public class called public.The function start at line 165 and ends at 166. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [165.0] and does not return any value..
pytorch_ao
public
public
0
0
create_branch_and_checkout
def create_branch_and_checkout(self, branch: str) -> None:self._run_git("checkout", "-b", branch)
1
2
2
21
0
168
169
168
null
[]
None
null
0
0
0
null
0
null
The function (create_branch_and_checkout) defined within the public class called public.The function start at line 168 and ends at 169. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [168.0] and does not return any value..
pytorch_ao
public
public
0
0
fetch
def fetch(self, ref: Optional[str] = None, branch: Optional[str] = None) -> None:if branch is None and ref is None:self._run_git("fetch", self.remote)elif branch is None:self._run_git("fetch", self.remote, ref)else:self._run_git("fetch", self.remote, f"{ref}:{branch}")
4
7
3
76
0
171
177
171
null
[]
None
null
0
0
0
null
0
null
The function (fetch) defined within the public class called public.The function start at line 171 and ends at 177. It contains 7 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [171.0] and does not return any value..
pytorch_ao
public
public
0
0
show_ref
def show_ref(self, name: str) -> str:refs = self._run_git("show-ref", "-s", name).strip().split("\n")if not all(refs[i] == refs[0] for i in range(1, len(refs))):raise RuntimeError(f"reference {name} is ambiguous")return refs[0]
3
5
2
70
0
179
183
179
null
[]
None
null
0
0
0
null
0
null
The function (show_ref) defined within the public class called public.The function start at line 179 and ends at 183. It contains 5 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [179.0] and does not return any value..
pytorch_ao
public
public
0
0
rev_parse
def rev_parse(self, name: str) -> str:return self._run_git("rev-parse", "--verify", name).strip()
1
2
2
26
0
185
186
185
null
[]
None
null
0
0
0
null
0
null
The function (rev_parse) defined within the public class called public.The function start at line 185 and ends at 186. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [185.0] and does not return any value..
pytorch_ao
public
public
0
0
get_merge_base
def get_merge_base(self, from_ref: str, to_ref: str) -> str:return self._run_git("merge-base", from_ref, to_ref).strip()
1
2
3
30
0
188
189
188
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 188 and ends at 189. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [188.0] and does not return any value..
pytorch_ao
public
public
0
0
patch_id
def patch_id(self, ref: Union[str, List[str]]) -> List[Tuple[str, str]]:is_list = isinstance(ref, list)if is_list:if len(ref) == 0:return []ref = " ".join(ref)rc = _check_output(["sh", "-c", f"git -C {self.repo_dir} show {ref}|git patch-id --stable"]).strip()return [cast(Tuple[str, str], x.split(" ", 1)) for x in rc.sp...
4
10
2
104
0
191
200
191
null
[]
None
null
0
0
0
null
0
null
The function (patch_id) defined within the public class called public.The function start at line 191 and ends at 200. It contains 10 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [191.0] and does not return any value..
pytorch_ao
public
public
0
0
commits_resolving_gh_pr
def commits_resolving_gh_pr(self, pr_num: int) -> List[str]:owner, name = self.gh_owner_and_name()msg = f"Pull Request resolved: https://github.com/{owner}/{name}/pull/{pr_num}"rc = self._run_git("log", "--format=%H", "--grep", msg).strip()return rc.split("\n") if len(rc) > 0 else []
2
5
2
62
0
202
206
202
null
[]
None
null
0
0
0
null
0
null
The function (commits_resolving_gh_pr) defined within the public class called public.The function start at line 202 and ends at 206. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [202.0] and does not return any value..
pytorch_ao
public
public
0
0
get_commit
def get_commit(self, ref: str) -> GitCommit:return parse_fuller_format(self._run_git("show", "--format=fuller", "--date=unix", "--shortstat", ref))
1
4
2
29
0
208
211
208
null
[]
None
null
0
0
0
null
0
null
The function (get_commit) defined within the public class called public.The function start at line 208 and ends at 211. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [208.0] and does not return any value..
pytorch_ao
public
public
0
0
cherry_pick
def cherry_pick(self, ref: str) -> None:self._run_git("cherry-pick", "-x", ref)
1
2
2
21
0
213
214
213
null
[]
None
null
0
0
0
null
0
null
The function (cherry_pick) defined within the public class called public.The function start at line 213 and ends at 214. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [213.0] and does not return any value..
pytorch_ao
public
public
0
0
revert
def revert(self, ref: str) -> None:self._run_git("revert", "--no-edit", ref)
1
2
2
21
0
216
217
216
null
[]
None
null
0
0
0
null
0
null
The function (revert) defined within the public class called public.The function start at line 216 and ends at 217. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [216.0] and does not return any value..
pytorch_ao
public
public
0
0
compute_branch_diffs
def compute_branch_diffs(self, from_branch: str, to_branch: str) -> Tuple[List[str], List[str]]:"""Returns list of commmits that are missing in each other branch since their merge baseMight be slow if merge base is between two branches is pretty far off"""from_ref = self.rev_parse(from_branch)to_ref = self.rev_parse(to...
14
50
3
305
0
219
279
219
null
[]
None
null
0
0
0
null
0
null
The function (compute_branch_diffs) defined within the public class called public.The function start at line 219 and ends at 279. It contains 50 lines of code and it has a cyclomatic complexity of 14. It takes 3 parameters, represented as [219.0] and does not return any value..
pytorch_ao
public
public
0
0
cherry_pick_commits
def cherry_pick_commits(self, from_branch: str, to_branch: str) -> None:orig_branch = self.current_branch()assert orig_branch is not None, "Must be on a branch"self.checkout(to_branch)from_commits, to_commits = self.compute_branch_diffs(from_branch, to_branch)if len(from_commits) == 0:print("Nothing to do")self.checkou...
3
13
3
91
0
281
293
281
null
[]
None
null
0
0
0
null
0
null
The function (cherry_pick_commits) defined within the public class called public.The function start at line 281 and ends at 293. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [281.0] and does not return any value..
pytorch_ao
public
public
0
0
push
def push(self, branch: str, dry_run: bool, retry: int = 3) -> None:for cnt in range(retry):try:if dry_run:self._run_git("push", "--dry-run", self.remote, branch)else:self._run_git("push", self.remote, branch)except RuntimeError as e:print(f"{cnt} push attempt failed with {e}")self.fetch()self._run_git("rebase", f"{self...
4
11
4
86
0
295
305
295
null
[]
None
null
0
0
0
null
0
null
The function (push) defined within the public class called public.The function start at line 295 and ends at 305. It contains 11 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [295.0] and does not return any value..
pytorch_ao
public
public
0
0
head_hash
def head_hash(self) -> str:return self._run_git("show-ref", "--hash", "HEAD").strip()
1
2
1
22
0
307
308
307
null
[]
None
null
0
0
0
null
0
null
The function (head_hash) defined within the public class called public.The function start at line 307 and ends at 308. 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
remote_url
def remote_url(self) -> str:return self._run_git("remote", "get-url", self.remote)
1
2
1
20
0
310
311
310
null
[]
None
null
0
0
0
null
0
null
The function (remote_url) defined within the public class called public.The function start at line 310 and ends at 311. 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
gh_owner_and_name
def gh_owner_and_name(self) -> Tuple[str, str]:url = os.getenv("GIT_REMOTE_URL", None)if url is None:url = self.remote_url()rc = RE_GITHUB_URL_MATCH.match(url)if rc is None:raise RuntimeError(f"Unexpected url format {url}")return cast(Tuple[str, str], rc.groups())
3
8
1
69
0
313
320
313
null
[]
None
null
0
0
0
null
0
null
The function (gh_owner_and_name) defined within the public class called public.The function start at line 313 and ends at 320. 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
commit_message
def commit_message(self, ref: str) -> str:return self._run_git("log", "-1", "--format=%B", ref)
1
2
2
24
0
322
323
322
null
[]
None
null
0
0
0
null
0
null
The function (commit_message) defined within the public class called public.The function start at line 322 and ends at 323. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [322.0] and does not return any value..
pytorch_ao
public
public
0
0
amend_commit_message
def amend_commit_message(self, msg: str) -> None:self._run_git("commit", "--amend", "-m", msg)
1
2
2
23
0
325
326
325
null
[]
None
null
0
0
0
null
0
null
The function (amend_commit_message) defined within the public class called public.The function start at line 325 and ends at 326. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [325.0] and does not return any value..
pytorch_ao
public
public
0
0
diff
def diff(self, from_ref: str, to_ref: Optional[str] = None) -> str:if to_ref is None:return self._run_git("diff", f"{from_ref}^!")return self._run_git("diff", f"{from_ref}..{to_ref}")
2
4
3
45
0
328
331
328
null
[]
None
null
0
0
0
null
0
null
The function (diff) defined within the public class called public.The function start at line 328 and ends at 331. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [328.0] and does not return any value..
pytorch_ao
public
public
0
0
clone_repo
def clone_repo(username: str, password: str, org: str, project: str) -> GitRepo:path = tempfile.mkdtemp()_check_output(["git","clone",f"https://{username}:{password}@github.com/{org}/{project}",path,]).strip()return GitRepo(path=path)
1
11
4
53
1
334
344
334
null
['path']
None
null
0
0
0
null
0
null
The function (clone_repo) defined within the public class called public.The function start at line 334 and ends at 344. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [334.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, val: str) -> None:self._val = valself._idx = -1
1
3
2
22
0
348
350
348
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 348 and ends at 350. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [348.0] and does not return any value..
pytorch_ao
public
public
0
0
peek
def peek(self) -> Optional[str]:if self._idx + 1 >= len(self._val):return Nonereturn self._val[self._idx + 1]
2
4
1
37
0
352
355
352
null
[]
None
null
0
0
0
null
0
null
The function (peek) defined within the public class called public.The function start at line 352 and ends at 355. It contains 4 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
__iter__
def __iter__(self) -> "PeekableIterator":return self
1
2
1
9
0
357
358
357
null
[]
None
null
0
0
0
null
0
null
The function (__iter__) defined within the public class called public.The function start at line 357 and ends at 358. 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
__next__
def __next__(self) -> str:rc = self.peek()if rc is None:raise StopIterationself._idx += 1return rc
2
6
1
28
0
360
365
360
null
[]
None
null
0
0
0
null
0
null
The function (__next__) defined within the public class called public.The function start at line 360 and ends at 365. It contains 6 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
patterns_to_regex
def patterns_to_regex(allowed_patterns: List[str]) -> Any:"""pattern is glob-like, i.e. the only special sequences it has are:- ? - matches single character- * - matches any non-folder separator characters or no character- ** - matches any characters or no characterAssuming that patterns are free of braces and backslas...
9
22
1
114
2
368
397
368
null
['pattern_', 'rc']
None
null
0
0
0
null
0
null
The function (patterns_to_regex) defined within the public class called public.The function start at line 368 and ends at 397. It contains 22 lines of code and it has a cyclomatic complexity of 9. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_shasum
def _shasum(value: str) -> str:import hashlibm = hashlib.sha256()m.update(value.encode("utf-8"))return m.hexdigest()
1
5
1
35
1
400
405
400
null
['m']
None
null
0
0
0
null
0
null
The function (_shasum) defined within the public class called public.The function start at line 400 and ends at 405. It contains 5 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_commit_hash
def is_commit_hash(ref: str) -> bool:"True if ref is hexadecimal number, else false"try:int(ref, 16)except ValueError:return Falsereturn True
2
7
1
25
0
408
414
408
null
[]
None
null
0
0
0
null
0
null
The function (is_commit_hash) defined within the public class called public.The function start at line 408 and ends at 414. It contains 7 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
are_ghstack_branches_in_sync
def are_ghstack_branches_in_sync(repo: GitRepo, head_ref: str, base_ref: Optional[str] = None) -> bool:"""Checks that diff between base and head is the same as diff between orig and its parent"""orig_ref = re.sub(r"/head$", "/orig", head_ref)if base_ref is None:base_ref = re.sub(r"/head$", "/base", head_ref)orig_diff_s...
3
14
3
93
4
417
431
417
null
['orig_ref', 'orig_diff_sha', 'head_diff_sha', 'base_ref']
None
null
0
0
0
null
0
null
The function (are_ghstack_branches_in_sync) defined within the public class called public.The function start at line 417 and ends at 431. It contains 14 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [417.0] and does not return any value..
pytorch_ao
public
public
0
0
retries_decorator.retries_decorator.decorator.wrapper
def wrapper(*args: List[Any], **kwargs: Dict[str, Any]) -> T:for idx in range(num_retries):try:return f(*args, **kwargs)except Exception as e:print(f'Attempt {idx} of {num_retries} to call {f.__name__} failed with "{e}"')passreturn cast(T, rc)
3
10
2
60
0
439
448
439
null
[]
None
null
0
0
0
null
0
null
The function (retries_decorator.retries_decorator.decorator.wrapper) defined within the public class called public.The function start at line 439 and ends at 448. It contains 10 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [439.0] and does not return any value..
pytorch_ao
public
public
0
0
retries_decorator.decorator
def decorator(f: Callable[..., T]) -> Callable[..., T]:@wraps(f)def wrapper(*args: List[Any], **kwargs: Dict[str, Any]) -> T:for idx in range(num_retries):try:return f(*args, **kwargs)except Exception as e:print(f'Attempt {idx} of {num_retries} to call {f.__name__} failed with "{e}"')passreturn cast(T, rc)return wrappe...
1
4
1
28
0
437
450
437
null
[]
None
null
0
0
0
null
0
null
The function (retries_decorator.decorator) defined within the public class called public.The function start at line 437 and ends at 450. 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
retries_decorator
def retries_decorator(rc: Any = None, num_retries: int = 3) -> Callable[[Callable[..., T]], Callable[..., T]]:def decorator(f: Callable[..., T]) -> Callable[..., T]:@wraps(f)def wrapper(*args: List[Any], **kwargs: Dict[str, Any]) -> T:for idx in range(num_retries):try:return f(*args, **kwargs)except Exception as e:prin...
1
5
2
38
0
434
452
434
null
[]
None
null
0
0
0
null
0
null
The function (retries_decorator) defined within the public class called public.The function start at line 434 and ends at 452. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [434.0] and does not return any value..
pytorch_ao
public
public
0
0
request_for_labels
def request_for_labels(url: str) -> Tuple[Any, Any]:headers = {"Accept": "application/vnd.github.v3+json"}return gh_fetch_url_and_headers(url, headers=headers, reader=lambda x: x.read().decode("utf-8"))
1
5
1
46
1
30
34
30
null
['headers']
None
null
0
0
0
null
0
null
The function (request_for_labels) defined within the public class called public.The function start at line 30 and ends at 34. It contains 5 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
update_labels
def update_labels(labels: List[str], info: str) -> None:labels_json = json.loads(info)labels.extend([x["name"] for x in labels_json])
2
3
2
39
1
37
39
37
null
['labels_json']
None
null
0
0
0
null
0
null
The function (update_labels) defined within the public class called public.The function start at line 37 and ends at 39. It contains 3 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
get_last_page_num_from_header
def get_last_page_num_from_header(header: Any) -> int:# Link info looks like: <https://api.github.com/repositories/65600975/labels?per_page=100&page=2>;# rel="next", <https://api.github.com/repositories/65600975/labels?per_page=100&page=3>; rel="last"link_info = header["link"]# Docs does not specify that it should be p...
2
9
1
53
3
42
54
42
null
['link_info', 'prefix', 'suffix']
None
null
0
0
0
null
0
null
The function (get_last_page_num_from_header) defined within the public class called public.The function start at line 42 and ends at 54. It contains 9 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
gh_get_labels
def gh_get_labels(org: str, repo: str) -> List[str]:prefix = f"https://api.github.com/repos/{org}/{repo}/labels?per_page=100"header, info = request_for_labels(prefix + "&page=1")labels: List[str] = []update_labels(labels, info)last_page = get_last_page_num_from_header(header)assert last_page > 0, ("Error reading header...
2
13
2
90
2
58
72
58
null
['prefix', 'last_page']
None
null
0
0
0
null
0
null
The function (gh_get_labels) defined within the public class called public.The function start at line 58 and ends at 72. It contains 13 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [58.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_add_labels
def gh_add_labels(org: str, repo: str, pr_num: int, labels: Union[str, List[str]], dry_run: bool) -> None:if dry_run:print(f"Dryrun: Adding labels {labels} to PR {pr_num}")returngh_fetch_url_and_headers(url=f"https://api.github.com/repos/{org}/{repo}/issues/{pr_num}/labels",data={"labels": labels},)
2
10
5
58
0
75
84
75
null
[]
None
null
0
0
0
null
0
null
The function (gh_add_labels) defined within the public class called public.The function start at line 75 and ends at 84. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [75.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_remove_label
def gh_remove_label(org: str, repo: str, pr_num: int, label: str, dry_run: bool) -> None:if dry_run:print(f"Dryrun: Removing {label} from PR {pr_num}")returngh_fetch_url_and_headers(url=f"https://api.github.com/repos/{org}/{repo}/issues/{pr_num}/labels/{label}",method="DELETE",)
2
10
5
46
0
87
96
87
null
[]
None
null
0
0
0
null
0
null
The function (gh_remove_label) defined within the public class called public.The function start at line 87 and ends at 96. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [87.0] and does not return any value..
pytorch_ao
public
public
0
0
get_release_notes_labels
def get_release_notes_labels(org: str, repo: str) -> List[str]:return [labelfor label in gh_get_labels(org, repo)if label.lstrip().startswith("release notes:")]
3
6
2
40
0
99
104
99
null
[]
None
null
0
0
0
null
0
null
The function (get_release_notes_labels) defined within the public class called public.The function start at line 99 and ends at 104. It contains 6 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [99.0] and does not return any value..
pytorch_ao
public
public
0
0
has_required_labels
def has_required_labels(pr: "GitHubPR") -> bool:pr_labels = pr.get_labels()# Check if PR is not user facingis_not_user_facing_pr = any(label.strip() == "topic: not user facing" for label in pr_labels)return is_not_user_facing_pr or any(label.strip() in get_release_notes_labels(pr.org, pr.project)for label in pr_labels)
4
9
1
58
2
107
116
107
null
['is_not_user_facing_pr', 'pr_labels']
None
null
0
0
0
null
0
null
The function (has_required_labels) defined within the public class called public.The function start at line 107 and ends at 116. 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
is_label_err_comment
def is_label_err_comment(comment: GitHubComment) -> bool:# comment.body_text returns text without markdownno_format_title = LABEL_ERR_MSG_TITLE.replace("`", "")return (comment.body_text.lstrip(" #").startswith(no_format_title)and comment.author_login in BOT_AUTHORS)
2
6
1
41
1
119
125
119
null
['no_format_title']
None
null
0
0
0
null
0
null
The function (is_label_err_comment) defined within the public class called public.The function start at line 119 and ends at 125. It contains 6 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
__init__
def __init__(self, name: str, url: str, status: Optional[str]):self.name: str = nameself.url: str = urlself.status: Optional[str] = statusself.jobs: JobNameToStateDict = {}
1
5
4
52
0
81
85
81
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 81 and ends at 85. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [81.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_get_pr_info
def gh_get_pr_info(org: str, proj: str, pr_no: int) -> Any:rc = gh_graphql(GH_GET_PR_INFO_QUERY, name=proj, owner=org, number=pr_no)return rc["data"]["repository"]["pullRequest"]
1
3
3
46
1
462
464
462
null
['rc']
None
null
0
0
0
null
0
null
The function (gh_get_pr_info) defined within the public class called public.The function start at line 462 and ends at 464. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [462.0] and does not return any value..
pytorch_ao
public
public
0
0
gh_get_team_members
def gh_get_team_members(org: str, name: str) -> List[str]:rc: List[str] = []team_members: Dict[str, Any] = {"pageInfo": {"hasNextPage": "true", "endCursor": None}}while bool(team_members["pageInfo"]["hasNextPage"]):query = gh_graphql(GH_GET_TEAM_MEMBERS_QUERY,org=org,name=name,cursor=team_members["pageInfo"]["endCursor...
4
19
2
132
3
468
486
468
null
['team', 'query', 'team_members']
None
null
0
0
0
null
0
null
The function (gh_get_team_members) defined within the public class called public.The function start at line 468 and ends at 486. It contains 19 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [468.0] and does not return any value..
pytorch_ao
public
public
0
0
get_check_run_name_prefix
def get_check_run_name_prefix(workflow_run: Any) -> str:if workflow_run is None:return ""else:return f"{workflow_run['workflow']['name']} / "
2
5
1
21
0
489
493
489
null
[]
None
null
0
0
0
null
0
null
The function (get_check_run_name_prefix) defined within the public class called public.The function start at line 489 and ends at 493. 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
is_passing_status
def is_passing_status(status: Optional[str]) -> bool:return status is not None and status.upper() in ["SUCCESS", "SKIPPED", "NEUTRAL"]
2
2
1
31
0
496
497
496
null
[]
None
null
0
0
0
null
0
null
The function (is_passing_status) defined within the public class called public.The function start at line 496 and ends at 497. It contains 2 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
add_workflow_conclusions.add_conclusions
def add_conclusions(edges: Any) -> None:for edge_idx, edge in enumerate(edges):node = edge["node"]workflow_run = node["workflowRun"]checkruns = node["checkRuns"]workflow_obj: WorkflowCheckState = no_workflow_objif workflow_run is not None:workflow_name = workflow_run["workflow"]["name"]workflow_conclusion = node["concl...
12
41
1
238
0
514
559
514
null
[]
None
null
0
0
0
null
0
null
The function (add_workflow_conclusions.add_conclusions) defined within the public class called public.The function start at line 514 and ends at 559. It contains 41 lines of code and it has a cyclomatic complexity of 12. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
add_workflow_conclusions
def add_workflow_conclusions(checksuites: Any,get_next_checkruns_page: Callable[[List[Dict[str, Dict[str, Any]]], int, Any], Any],get_next_checksuites: Callable[[Any], Any],) -> JobNameToStateDict:# graphql seems to favor the most recent workflow run, so in theory we# shouldn't need to account for reruns, but do it jus...
6
31
4
220
10
500
588
500
null
['checkruns', 'node', 'all_edges', 'checkrun_name', 'workflow_run', 'workflow_conclusion', 'workflow_name', 'workflow_obj', 'checksuites', 'existing_checkrun']
None
null
0
0
0
null
0
null
The function (add_workflow_conclusions) defined within the public class called public.The function start at line 500 and ends at 588. It contains 31 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [500.0] and does not return any value..
pytorch_ao
public
public
0
0
parse_args
def parse_args() -> Any:from argparse import ArgumentParserparser = ArgumentParser("Merge PR into default branch")parser.add_argument("--dry-run", action="store_true")parser.add_argument("--revert", action="store_true")parser.add_argument("--force", action="store_true")parser.add_argument("--ignore-current", action="st...
1
12
0
102
1
591
603
591
null
['parser']
None
null
0
0
0
null
0
null
The function (parse_args) defined within the public class called public.The function start at line 591 and ends at 603. It contains 12 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
can_skip_internal_checks
def can_skip_internal_checks(pr: "GitHubPR", comment_id: Optional[int] = None) -> bool:if comment_id is None:return Falsecomment = pr.get_comment_by_id(comment_id)if comment.editor_login is not None:return Falsereturn comment.author_login == "facebook-github-bot"
3
7
2
49
1
606
612
606
null
['comment']
None
null
0
0
0
null
0
null
The function (can_skip_internal_checks) defined within the public class called public.The function start at line 606 and ends at 612. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [606.0] and does not return any value..
pytorch_ao
public
public
0
0
_revlist_to_prs
def _revlist_to_prs(repo: GitRepo,pr: "GitHubPR",rev_list: Iterable[str],should_skip: Optional[Callable[[int, "GitHubPR"], bool]] = None,) -> List[Tuple["GitHubPR", str]]:rc: List[Tuple[GitHubPR, str]] = []for idx, rev in enumerate(rev_list):msg = repo.commit_message(rev)m = RE_PULL_REQUEST_RESOLVED.search(msg)if m is ...
8
24
5
186
4
615
638
615
null
['m', 'pr_num', 'msg', 'candidate']
None
null
0
0
0
null
0
null
The function (_revlist_to_prs) defined within the public class called public.The function start at line 615 and ends at 638. It contains 24 lines of code and it has a cyclomatic complexity of 8. It takes 5 parameters, represented as [615.0] and does not return any value..
pytorch_ao
public
public
0
0
get_ghstack_prs.skip_func
def skip_func(idx: int, candidate: "GitHubPR") -> bool:if not open_only or not candidate.is_closed():return Falseprint(f"Skipping {idx + 1} of {len(rev_list)} PR (#{candidate.pr_num}) as its already been merged")return True
3
7
2
33
0
652
658
652
null
[]
None
null
0
0
0
null
0
null
The function (get_ghstack_prs.skip_func) defined within the public class called public.The function start at line 652 and ends at 658. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [652.0] and does not return any value..
pytorch_ao
public
public
0
0
get_ghstack_prs
def get_ghstack_prs(repo: GitRepo, pr: "GitHubPR", open_only: bool = True) -> List[Tuple["GitHubPR", str]]:"""Get the PRs in the stack that are below this PR (inclusive).Throws error if any of the open PRs are out of sync.@:param open_only: Only return open PRs"""# For ghstack, cherry-pick commits based from originorig...
5
24
3
138
4
641
678
641
null
['orig_ref', 'base_ref', 'rev_list', 'entire_stack']
None
null
0
0
0
null
0
null
The function (get_ghstack_prs) defined within the public class called public.The function start at line 641 and ends at 678. It contains 24 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [641.0] and does not return any value..