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
Sema4AI_actions
public
public
0
0
_get_file_size
def _get_file_size(filename: str | Path) -> int:# Check if file already exists and get downloaded size (if any)file_size = 0if os.path.exists(filename):with open(filename, "rb") as f:file_size = os.fstat(f.fileno()).st_sizereturn file_size
2
6
1
50
1
86
92
86
filename
['file_size']
int
{"Assign": 2, "If": 1, "Return": 1, "With": 1}
4
7
4
["os.path.exists", "open", "os.fstat", "f.fileno"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.build_py._download_with_resume", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.build_py._resume_download"]
The function (_get_file_size) defined within the public class called public.The function start at line 86 and ends at 92. 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. It declares 4.0 functions, It has 4.0 functions called i...
Sema4AI_actions
public
public
0
0
_resume_download
def _resume_download(url: str, filename: str | Path, chunk_size: int = 1024):"""Downloads a file in chunks with resume support.Args:url: The URL of the file to download.filename: The filename to save the downloaded file.chunk_size: The size of each chunk to download (in bytes)."""downloaded_size = _get_file_size(filena...
5
14
3
100
4
95
119
95
url,filename,chunk_size
['content_size', 'headers', 'downloaded_size', 'chunk']
None
{"Assign": 5, "Expr": 2, "If": 3, "While": 1, "With": 1}
7
25
7
["_get_file_size", "_open_urllib", "open", "response.getheader", "RuntimeError", "response.read", "stream.write"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.build_py._download_with_resume"]
The function (_resume_download) defined within the public class called public.The function start at line 95 and ends at 119. It contains 14 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [95.0] and does not return any value. It declares 7.0 functions, It has 7.0 functions c...
Sema4AI_actions
public
public
0
0
_download_rcc
def _download_rcc():"""Downloads RCC in the place where the action server expects it."""if sys.platform == "win32":rcc_path = (CURDIR/ "src"/ "sema4ai"/ "action_server"/ "bin"/ f"rcc-{RCC_VERSION}.exe")else:rcc_path = (CURDIR / "src" / "sema4ai" / "action_server" / "bin" / f"rcc-{RCC_VERSION}")machine = platform.machin...
8
35
0
135
6
122
166
122
['prefix', 'relative_path', 'machine', 'is_64', 'rcc_path', 'rcc_url']
Returns
{"Assign": 11, "Expr": 2, "If": 6, "Return": 1}
4
45
4
["platform.machine", "RuntimeError", "print", "_download_with_resume"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.build_py.build", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.devutils.src.devutils.fixtures_py.rcc_loc"]
The function (_download_rcc) defined within the public class called public.The function start at line 122 and ends at 166. It contains 35 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters, and this function return a value. It declares 4.0 functions, It has 4.0 functions ca...
Sema4AI_actions
public
public
0
0
build
def build(*args, **kwarg):if os.environ.get("ACTION_SERVER_SKIP_DOWNLOAD_IN_BUILD", "").lower().strip() in ("1","true",):return_download_rcc()
2
7
2
40
0
169
176
169
*args,**kwarg
[]
None
{"Expr": 1, "If": 1, "Return": 1}
4
8
4
["strip", "lower", "os.environ.get", "_download_rcc"]
442
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.app.handlers.search_py.Search._query_search", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3594492_mangroveorg_mangrove.mangrove.feeds.tests.test_enriched_survey_response_IT_py.Tes...
The function (build) defined within the public class called public.The function start at line 169 and ends at 176. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [169.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions called insi...
Sema4AI_actions
public
public
0
0
chdir
def chdir(path: Path):old = Path.cwd()try:os.chdir(path)yieldfinally:os.chdir(old)
2
7
1
31
1
32
38
32
path
['old']
None
{"Assign": 1, "Expr": 3, "Try": 1}
3
7
3
["Path.cwd", "os.chdir", "os.chdir"]
17
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3645277_yelp_venv_update.tests.testing.make_sdists_py.make_copy", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3645277_yelp_venv_update.tests.testing.make_sdists_py.sdist", "_.content.gdrive.MyDrive.Phd_Thesis.Data...
The function (chdir) defined within the public class called public.The function start at line 32 and ends at 38. 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. It declares 3.0 functions, It has 3.0 functions called inside whi...
Sema4AI_actions
public
public
0
0
run
def run(ctx: Context, *args: str, **options):cmd = " ".join(args)options.setdefault("pty", sys.platform != "win32")options.setdefault("echo", True)ctx.run(cmd, **options)
1
5
3
52
1
41
45
41
ctx,*args,**options
['cmd']
None
{"Assign": 1, "Expr": 3}
4
5
4
["join", "options.setdefault", "options.setdefault", "ctx.run"]
596
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.app.handlers.package_versions_py.PackageVersions.index", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.cherrypy.test.benchmark_py.run_m...
The function (run) defined within the public class called public.The function start at line 41 and ends at 45. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [41.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions called inside wh...
Sema4AI_actions
public
public
0
0
_change_to_frontend_dir
def _change_to_frontend_dir():RESOLVED_CURDIR = CURDIR.resolve()# vite build has a bug which makes it misbehave when working with a subst# (presumably this is because it's resolving the actual location of# things and then compares with unresolved paths).# In order to fix that we resolve the directory ourselves prior to...
1
4
0
20
1
49
58
49
['RESOLVED_CURDIR']
None
{"Assign": 1, "Expr": 1, "With": 1}
2
10
2
["CURDIR.resolve", "chdir"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tasks_py.build_frontend", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tasks_py.dev_frontend"]
The function (_change_to_frontend_dir) defined within the public class called public.The function start at line 49 and ends at 58. 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 2.0 functions, It has 2.0 functions...
Sema4AI_actions
public
public
0
0
_change_to_build_binary
def _change_to_build_binary():RESOLVED_CURDIR = CURDIR.absolute()with chdir(RESOLVED_CURDIR / "build-binary"):yield
1
4
0
20
1
62
66
62
['RESOLVED_CURDIR']
None
{"Assign": 1, "Expr": 1, "With": 1}
2
5
2
["CURDIR.absolute", "chdir"]
0
[]
The function (_change_to_build_binary) defined within the public class called public.The function start at line 62 and ends at 66. 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 2.0 functions, and It has 2.0 func...
Sema4AI_actions
public
public
0
0
_change_to_build_go_wrapper
def _change_to_build_go_wrapper():RESOLVED_CURDIR = CURDIR.absolute()with chdir(RESOLVED_CURDIR / "go-wrapper"):yield
1
4
0
20
1
70
74
70
['RESOLVED_CURDIR']
None
{"Assign": 1, "Expr": 1, "With": 1}
2
5
2
["CURDIR.absolute", "chdir"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tasks_py.build_go_wrapper"]
The function (_change_to_build_go_wrapper) defined within the public class called public.The function start at line 70 and ends at 74. 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 2.0 functions, It has 2.0 funct...
Sema4AI_actions
public
public
0
0
dev_frontend
def dev_frontend(ctx: Context):"""Run the frontend in dev mode (starts its own localhost server using vite)."""with _change_to_frontend_dir():run(ctx, "npm", "run", "dev")
1
3
1
23
0
78
82
78
ctx
[]
None
{"Expr": 2, "With": 1}
2
5
2
["_change_to_frontend_dir", "run"]
0
[]
The function (dev_frontend) defined within the public class called public.The function start at line 78 and ends at 82. 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. It declares 2.0 functions, and It has 2.0 functions calle...
Sema4AI_actions
public
public
0
0
build_frontend
def build_frontend(ctx: Context, debug: bool = False, install: bool = True):"""Build static .html frontend"""with _change_to_frontend_dir():if install:run(ctx, "npm", "ci", "--no-audit", "--no-fund")if debug:run(ctx, "npm", "run", "build:debug")else:run(ctx, "npm", "run", "build")index_src = CURDIR / "frontend" / "dist...
3
18
3
133
3
86
117
86
ctx,debug,install
['index_src', 'dest_static_contents', 'file_contents']
None
{"Assign": 3, "Expr": 6, "If": 2, "With": 2}
10
32
10
["_change_to_frontend_dir", "run", "run", "run", "index_src.exists", "index_src.read_bytes", "open", "print", "stream.write", "repr"]
0
[]
The function (build_frontend) defined within the public class called public.The function start at line 86 and ends at 117. It contains 18 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [86.0] and does not return any value. It declares 10.0 functions, and It has 10.0 functi...
Sema4AI_actions
public
public
0
0
build_oauth2_config
def build_oauth2_config(ctx: Context):"""Build static OAuth2 .yaml config."""import subprocesssema4ai_config_file_name = "sema4ai-oauth-config.yaml"default_user_config_file_name = "oauth-config.yaml"sema4ai_config_local_file_path = CURDIR / sema4ai_config_file_namedefault_user_config_local_file_path = CURDIR / default_...
1
36
1
146
9
121
172
121
ctx
['default_user_config_file_name', 'default_user_config_contents', 'base_api_url', 'sema4ai_config_file_name', 'sema4ai_config_local_file_path', 'default_user_config_local_file_path', 'dest_path', 'file_contents', 'result_sema4ai_config_contents']
None
{"Assign": 9, "Expr": 3, "With": 1}
8
52
8
["stdout.decode", "subprocess.run", "stdout.decode", "subprocess.run", "open", "print", "stream.write", "repr"]
0
[]
The function (build_oauth2_config) defined within the public class called public.The function start at line 121 and ends at 172. It contains 36 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 8.0 functions, and It has 8.0 funct...
Sema4AI_actions
public
public
0
0
build_executable
def build_executable(ctx: Context,debug: bool = False,ci: bool = True,dist_path: str = "dist",sign: bool = False,go_wrapper: bool = False,version: str = None,go_wrapper_name: str | None = None,) -> None:"""Build the project executable via PyInstaller."""from sema4ai.build_common.root_dir import get_root_dirfrom sema4ai...
2
27
8
131
2
185
215
185
ctx,debug,ci,dist_path,sign,go_wrapper,version,go_wrapper_name
['root_dir', 'version']
None
{"Assign": 2, "Expr": 2, "If": 1}
3
31
3
["get_root_dir", "build_and_sign_executable", "task"]
0
[]
The function (build_executable) defined within the public class called public.The function start at line 185 and ends at 215. It contains 27 lines of code and it has a cyclomatic complexity of 2. It takes 8 parameters, represented as [185.0] and does not return any value. It declares 3.0 functions, and It has 3.0 func...
Sema4AI_actions
public
public
0
0
clean
def clean(ctx: Context):"""Clean build artifacts."""from sema4ai.build_common.root_dir import get_root_dirfrom sema4ai.build_common.workflows import clean_common_build_artifactsclean_common_build_artifacts(get_root_dir())
1
4
1
30
0
221
226
221
ctx
[]
None
{"Expr": 2}
2
6
2
["clean_common_build_artifacts", "get_root_dir"]
124
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527220_mitar_django_mongo_auth.mongo_auth.contrib.form_fields_py.LimitedDateTimeField.clean", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3594492_mangroveorg_mangrove.mangrove.contrib.registration_validators_py.M...
The function (clean) defined within the public class called public.The function start at line 221 and ends at 226. 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 2.0 functions, It has 2.0 functions called inside w...
Sema4AI_actions
public
public
0
0
build_go_wrapper
def build_go_wrapper(ctx: Context) -> None:with _change_to_build_go_wrapper():target = "action-server-unsigned" + (".exe" if sys.platform == "win32" else "")run(ctx,"go","build","-o",target,)print(f"Built go wrapper at: {os.path.abspath(target)}")
2
11
1
47
1
230
240
230
ctx
['target']
None
{"Assign": 1, "Expr": 2, "With": 1}
4
11
4
["_change_to_build_go_wrapper", "run", "print", "os.path.abspath"]
0
[]
The function (build_go_wrapper) defined within the public class called public.The function start at line 230 and ends at 240. It contains 11 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 function...
Sema4AI_actions
public
public
0
0
download_rcc
def download_rcc(ctx: Context, system: Optional[str] = None) -> None:"""Downloads RCC in the place where the action server expects it"""env = os.environ.copy()curr_pythonpath = env.get("PYTHONPATH", "")env["PYTHONPATH"] = curr_pythonpath + os.pathsep + str(CURDIR / "src")run(ctx, "python -m sema4ai.action_server downlo...
1
5
2
65
2
244
251
244
ctx,system
['env', 'curr_pythonpath']
None
{"Assign": 3, "Expr": 2}
4
8
4
["os.environ.copy", "env.get", "str", "run"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._main_retcode", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server.cli_py.mai...
The function (download_rcc) defined within the public class called public.The function start at line 244 and ends at 251. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [244.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions call...
Sema4AI_actions
public
public
0
0
_replace_deps
def _replace_deps(content, new_deps):"""Replaces the contents between ## START DEPS and ## ENDS DEPS with new_deps.Args:content: The content of the file as a string.new_deps: The new dependencies to insert.Returns:The content of the file with the dependencies replaced."""start_marker = "## START DEPS\n"end_marker = "##...
3
8
2
62
4
254
274
254
content,new_deps
['end_marker', 'start_marker', 'end_pos', 'start_pos']
Returns
{"Assign": 4, "Expr": 1, "If": 1, "Return": 1}
3
21
3
["content.find", "content.find", "ValueError"]
0
[]
The function (_replace_deps) defined within the public class called public.The function start at line 254 and ends at 274. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [254.0], and this function return a value. It declares 3.0 functions, and It has 3.0 func...
Sema4AI_actions
public
public
0
0
test_not_integration
def test_not_integration(ctx: Context):from sema4ai.build_common.process_call import runfrom sema4ai.build_common.root_dir import get_root_diraction_server_dir = get_root_dir()run([sys.executable,"-m","pytest","-m","not integration_test","-rfE","-vv","--force-regen","-n","auto",],cwd=str(action_server_dir / "tests"),)
1
19
1
65
1
278
297
278
ctx
['action_server_dir']
None
{"Assign": 1, "Expr": 1}
3
20
3
["get_root_dir", "run", "str"]
0
[]
The function (test_not_integration) defined within the public class called public.The function start at line 278 and ends at 297. It contains 19 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 functions, and It has 3.0 func...
Sema4AI_actions
public
public
0
0
test_binary
def test_binary(ctx: Context, test: str = "", jobs: str = "auto"):"""Test the binary"""import subprocessfrom sema4ai.build_common.process_call import runfrom sema4ai.build_common.root_dir import get_root_dir# The binary should be in the dist directory already.# Run all the tests using pytest -m integration_test# While ...
3
43
3
197
4
301
351
301
ctx,test,jobs
['env', 'action_server_executable', 'args', 'action_server_dir']
None
{"Assign": 7, "Expr": 7, "If": 1}
12
51
12
["get_root_dir", "action_server_executable.exists", "os.environ.copy", "env.pop", "env.pop", "env.pop", "str", "str", "args.append", "args.append", "run", "str"]
0
[]
The function (test_binary) defined within the public class called public.The function start at line 301 and ends at 351. It contains 43 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [301.0] and does not return any value. It declares 12.0 functions, and It has 12.0 functio...
Sema4AI_actions
public
public
0
0
print_env
def print_env(ctx: Context):import osprint(" ============== ENV ============== ")for key, value in os.environ.items():if len(value) > 100:print(f"{key}:")parts = value.split(os.pathsep)for part in parts:print(f"{part}")else:print(f"{key}={value}")print(" ============== END ENV ============== ")
4
12
1
70
1
355
367
355
ctx
['parts']
None
{"Assign": 1, "Expr": 5, "For": 2, "If": 1}
8
13
8
["print", "os.environ.items", "len", "print", "value.split", "print", "print", "print"]
0
[]
The function (print_env) defined within the public class called public.The function start at line 355 and ends at 367. It contains 12 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8.0 functions calle...
Sema4AI_actions
public
public
0
0
test_run_in_parallel
def test_run_in_parallel(ctx: Context):"""Just runs the action server in dist/final/action-server 3 times in parallel(may be used to manually check issues with the lock file)."""import subprocessfrom sema4ai.build_common.process_call import runfrom sema4ai.build_common.root_dir import get_root_dir# The binary should be...
2
17
1
97
2
371
394
371
ctx
['action_server_executable', 'action_server_dir']
None
{"Assign": 2, "Expr": 4}
5
24
5
["get_root_dir", "action_server_executable.exists", "subprocess.Popen", "subprocess.Popen", "subprocess.Popen"]
0
[]
The function (test_run_in_parallel) defined within the public class called public.The function start at line 371 and ends at 394. It contains 17 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 func...
Sema4AI_actions
public
public
0
0
sh
def sh(command):task = subprocess.Popen([command], shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)out, _ = task.communicate()return task.returncode, out.decode()
1
6
1
50
1
119
124
119
command
['task']
Returns
{"Assign": 2, "Return": 1}
3
6
3
["subprocess.Popen", "task.communicate", "out.decode"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.build_binary.downloads_index_py.gittags_top"]
The function (sh) defined within the public class called public.The function start at line 119 and ends at 124. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declares 3.0 functions, It has 3.0 functions called inside ...
Sema4AI_actions
public
public
0
0
gittags_top
def gittags_top(count):sh(FETCH_TAGS)code, out = sh(TAGLISTING)if code == 0:for line in out.splitlines():if count == 0:breakif found := TAG_PATTERN.match(line):yield (found.group(1))count -= 1
5
10
1
59
0
127
136
127
count
[]
None
{"Assign": 1, "AugAssign": 1, "Expr": 2, "For": 1, "If": 3}
5
10
5
["sh", "sh", "out.splitlines", "TAG_PATTERN.match", "found.group"]
0
[]
The function (gittags_top) defined within the public class called public.The function start at line 127 and ends at 136. It contains 10 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 functions cal...
Sema4AI_actions
public
public
0
0
changelog_top
def changelog_top(filename, count):with open(filename) as source:for line in source:if count == 0:breakif found := VERSION_PATTERN.match(line):yield (found.groups())count -= 1
4
8
2
47
0
139
146
139
filename,count
[]
None
{"AugAssign": 1, "Expr": 1, "For": 1, "If": 2, "With": 1}
3
8
3
["open", "VERSION_PATTERN.match", "found.groups"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.build_binary.downloads_index_py.process_versions"]
The function (changelog_top) defined within the public class called public.The function start at line 139 and ends at 146. It contains 8 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [139.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions cal...
Sema4AI_actions
public
public
0
0
download
def download(version, suffix):return "https://cdn.sema4.ai/action-server/releases/%s/%s" % (version,suffix,)
1
5
2
16
0
149
153
149
version,suffix
[]
Returns
{"Return": 1}
0
5
0
[]
16
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3640381_floydhub_floyd_cli.floyd.cli.data_py.getfile", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692576_megagonlabs_ginza.ginza.command_line_py.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output...
The function (download) defined within the public class called public.The function start at line 149 and ends at 153. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [149.0], and this function return a value. It has 16.0 functions calling this function which ar...
Sema4AI_actions
public
public
0
0
process_versions
def process_versions(options, sink):biglist = tuple(changelog_top(options.changelog, 10000))limited = biglist[:LIMIT] if len(biglist) > LIMIT else biglistdaymap = dict()for version, when in biglist:daymap[version] = whentested = list()edge = list()result = dict(tested=tested, edge=edge)seen = set()# For now we only inc...
5
22
2
180
8
156
194
156
options,sink
['details', 'limited', 'daymap', 'seen', 'edge', 'result', 'tested', 'biglist']
Returns
{"Assign": 13, "Expr": 4, "For": 2, "If": 1, "Return": 1}
17
39
17
["tuple", "changelog_top", "len", "dict", "list", "list", "dict", "set", "sink.write", "dict", "dict", "download", "download", "download", "download", "sink.write", "edge.append"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.build_binary.downloads_index_py.process"]
The function (process_versions) defined within the public class called public.The function start at line 156 and ends at 194. It contains 22 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [156.0], and this function return a value. It declares 17.0 functions, It has 17.0 fun...
Sema4AI_actions
public
public
0
0
process
def process(options):with open(options.page, "w+") as sink:sink.write(HEADER % dict(limit=LIMIT))data = process_versions(options, sink)sink.write(FOOTER)with open(options.json, "w+") as sink:json.dump(data, sink, indent=1)
1
7
1
68
1
197
203
197
options
['data']
None
{"Assign": 1, "Expr": 3, "With": 2}
7
7
7
["open", "sink.write", "dict", "process_versions", "sink.write", "open", "json.dump"]
56
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.cherrypy._cpreqbody_py.RequestBody.process", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3535344_amarian12_e_pool_net.p2pool.bitcoin.sha256_py.sha256.digest", "_.conte...
The function (process) defined within the public class called public.The function start at line 197 and ends at 203. It contains 7 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 7.0 functions, It has 7.0 functions called inside...
Sema4AI_actions
public
public
0
0
commandline
def commandline(args):parser = argparse.ArgumentParser(description="shim -- a simple tool shimming")parser.add_argument("--changelog","-c",type=str,default=CHANGELOG,help="Name for changelog file.",)parser.add_argument("--page","-p",type=str,default="build/index.html",help='Name for "index.html" file.',)parser.add_argu...
1
24
1
85
1
206
229
206
args
['parser']
Returns
{"Assign": 1, "Expr": 3, "Return": 1}
5
24
5
["argparse.ArgumentParser", "parser.add_argument", "parser.add_argument", "parser.add_argument", "parser.parse_args"]
0
[]
The function (commandline) defined within the public class called public.The function start at line 206 and ends at 229. It contains 24 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declares 5.0 functions, and It has 5.0 functions...
Sema4AI_actions
public
public
0
0
_raise_deprecated_conda
def _raise_deprecated_conda(found: Path):from sema4ai.action_server._settings import is_frozenfrom sema4ai.action_server.vendored_deps.action_package_handling.cli_errors import (ActionPackageError,)if is_frozen():cmd = "action-server"else:cmd = "python -m sema4ai.action_server"raise ActionPackageError("Deprecated: The ...
2
16
1
54
1
7
23
7
found
['cmd']
None
{"Assign": 2, "If": 1}
2
17
2
["is_frozen", "ActionPackageError"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._action_package_handler_py.ActionPackageHandler.__init__"]
The function (_raise_deprecated_conda) defined within the public class called public.The function start at line 7 and ends at 23. It contains 16 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions...
Sema4AI_actions
ActionPackageHandler
public
0
0
__init__
def __init__(self, action_package_dir: str, datadir: Path):import osimport yamlfrom sema4ai.action_server.vendored_deps.action_package_handling.cli_errors import (ActionPackageError,)from ._errors_action_server import ActionServerValidationErrorfrom ._settings import is_frozenself._action_package_dir = action_package_d...
14
67
3
310
0
27
109
27
self,action_package_dir,datadir
[]
None
{"AnnAssign": 1, "Assign": 18, "Expr": 3, "For": 1, "If": 10, "Try": 1, "With": 1}
22
83
22
["datadir.absolute", "absolute", "Path", "import_path.exists", "ActionPackageError", "import_path.is_dir", "ActionPackageError", "original_package_yaml.exists", "open", "yaml.safe_load", "ActionPackageError", "isinstance", "ActionPackageError", "package_yaml_contents.get", "log.warn", "package_yaml_contents.get", "log....
6,243
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called ActionPackageHandler.The function start at line 27 and ends at 109. It contains 67 lines of code and it has a cyclomatic complexity of 14. It takes 3 parameters, represented as [27.0] and does not return any value. It declares 22.0 functions, It has 22.0 fu...
Sema4AI_actions
ActionPackageHandler
public
0
0
package_yaml_contents
def package_yaml_contents(self) -> dict | None:return self._package_yaml_contents
1
2
1
13
0
112
113
112
self
[]
dict | None
{"Return": 1}
0
2
0
[]
0
[]
The function (package_yaml_contents) defined within the public class called ActionPackageHandler.The function start at line 112 and ends at 113. 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..
Sema4AI_actions
ActionPackageHandler
public
0
0
import_path
def import_path(self) -> Path:return self._import_path
1
2
1
11
0
116
117
116
self
[]
Path
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.actions.src.sema4ai.actions._collect_actions_py.collect_actions"]
The function (import_path) defined within the public class called ActionPackageHandler.The function start at line 116 and ends at 117. 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. It has 1.0 function calling this function w...
Sema4AI_actions
ActionPackageHandler
public
0
0
original_package_yaml
def original_package_yaml(self) -> Path:return self._original_package_yaml
1
2
1
11
0
120
121
120
self
[]
Path
{"Return": 1}
0
2
0
[]
0
[]
The function (original_package_yaml) defined within the public class called ActionPackageHandler.The function start at line 120 and ends at 121. 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..
Sema4AI_actions
ActionPackageHandler
public
0
0
package_yaml_exists
def package_yaml_exists(self) -> bool:return self._package_yaml_exists
1
2
1
11
0
124
125
124
self
[]
bool
{"Return": 1}
0
2
0
[]
0
[]
The function (package_yaml_exists) defined within the public class called ActionPackageHandler.The function start at line 124 and ends at 125. 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..
Sema4AI_actions
ActionPackageHandler
public
0
0
action_package_name
def action_package_name(self) -> str:return self._action_package_name
1
2
1
11
0
128
129
128
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (action_package_name) defined within the public class called ActionPackageHandler.The function start at line 128 and ends at 129. 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..
Sema4AI_actions
ActionPackageHandler
public
0
0
package_root
def package_root(self) -> str:return str(self._original_package_yaml.parent.absolute())
1
2
1
20
0
132
133
132
self
[]
str
{"Return": 1}
2
2
2
["str", "self._original_package_yaml.parent.absolute"]
0
[]
The function (package_root) defined within the public class called ActionPackageHandler.The function start at line 132 and ends at 133. 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. It declares 2.0 functions, and It has 2.0...
Sema4AI_actions
ActionPackageHandler
public
0
0
get_pythonpath_entries
def get_pythonpath_entries(self) -> tuple[str, ...]:"""Returns:Tuple with the entries of the pythonpath (as the user entered them in the package.yaml,usually relative to the package.yaml file, although absolute paths are also accepted)."""if self._pythonpath_entries is not None:return self._pythonpath_entriesfrom sema4...
7
26
1
134
0
135
172
135
self
[]
tuple[str, ...]
{"AnnAssign": 1, "Assign": 2, "Expr": 4, "For": 1, "If": 5, "Return": 2}
11
38
11
["pythonpath_entries.append", "self._package_yaml_contents.get", "pythonpath_entries.append", "isinstance", "ActionServerValidationError", "type", "isinstance", "ActionServerValidationError", "type", "pythonpath_entries.append", "tuple"]
0
[]
The function (get_pythonpath_entries) defined within the public class called ActionPackageHandler.The function start at line 135 and ends at 172. It contains 26 lines of code and it has a cyclomatic complexity of 7. The function does not take any parameters and does not return any value. It declares 11.0 functions, and...
Sema4AI_actions
ActionPackageHandler
public
0
0
bootstrap_environment
def bootstrap_environment(self, devenv: bool = False) -> tuple[str, dict]:"""Args:devenv: Whether the environment is being bootstrapped for the devenvironment.Returns:Tuple of condahash and the environment variables.Raises:ActionPackageError: If it was not possible to bootstrap the environment."""import osfrom sema4ai....
14
79
2
359
0
174
277
174
self,devenv
[]
tuple[str, dict]
{"Assign": 16, "Expr": 7, "For": 1, "If": 12, "Return": 1}
21
104
21
["log.info", "self._package_yaml_contents.get", "log.warn", "bold_yellow", "ActionServerValidationError", "log.info", "get_rcc", "rcc.get_package_yaml_hash", "rcc.create_env_and_get_vars", "ActionPackageError", "ActionPackageError", "self.get_pythonpath_entries", "self._package_yaml_contents.get", "log.critical", "os.p...
0
[]
The function (bootstrap_environment) defined within the public class called ActionPackageHandler.The function start at line 174 and ends at 277. It contains 79 lines of code and it has a cyclomatic complexity of 14. It takes 2 parameters, represented as [174.0] and does not return any value. It declares 21.0 functions,...
Sema4AI_actions
public
public
0
0
handle_login_command
def handle_login_command(args: ArgumentsNamespace) -> int:from sema4ai.action_server._ask_user import (ask_user_for_hostname,ask_user_to_provide_access_credentials,)from sema4ai.action_server._protocols import ArgumentsNamespaceCloudloginfrom sema4ai.action_server._storage import storecloud_login_args: ArgumentsNamespa...
4
30
1
108
2
11
46
11
args
['hostname', 'access_credentials']
int
{"AnnAssign": 1, "Assign": 2, "Expr": 2, "Return": 2, "Try": 1}
6
36
6
["typing.cast", "ask_user_to_provide_access_credentials", "ask_user_for_hostname", "store", "log.critical", "bold_red"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_cloud_py.handle_cloud_command"]
The function (handle_login_command) defined within the public class called public.The function start at line 11 and ends at 46. It contains 30 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 6.0 functions, It has 6.0 functions c...
Sema4AI_actions
public
public
0
0
handle_verify_login_command
def handle_verify_login_command(base_args: ArgumentsNamespace) -> int:from sema4ai.action_server._protocols import ArgumentsNamespaceCloudVerifyLoginfrom sema4ai.action_server._storage import get_access_credentials, get_hostnameverify_login_args: ArgumentsNamespaceCloudVerifyLogin = typing.cast(ArgumentsNamespaceCloudV...
5
31
1
118
2
49
83
49
base_args
['hostname', 'access_credentials']
int
{"AnnAssign": 1, "Assign": 2, "Expr": 4, "If": 2, "Return": 2, "Try": 1}
9
35
9
["typing.cast", "get_access_credentials", "get_hostname", "print", "json.dumps", "log.info", "log.info", "log.critical", "bold_red"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_cloud_py.handle_cloud_command"]
The function (handle_verify_login_command) defined within the public class called public.The function start at line 49 and ends at 83. It contains 31 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 9.0 functions, It has 9.0 func...
Sema4AI_actions
public
public
0
0
handle_list_organizations_command
def handle_list_organizations_command(base_args: ArgumentsNamespace) -> int:import sysfrom sema4ai.action_server._errors_action_server import ActionServerValidationErrorfrom sema4ai.action_server._protocols import ArgumentsNamespaceCloudOrganizationsfrom sema4ai.action_server._storage import get_access_credentials, get...
9
41
1
197
4
86
136
86
base_args
['hostname', 'access_credentials', 'organizations', 'output']
int
{"AnnAssign": 1, "Assign": 4, "Expr": 4, "For": 1, "If": 3, "Return": 2, "Try": 1}
14
51
14
["typing.cast", "get_access_credentials", "ActionServerValidationError", "get_hostname", "list_organizations", "json.dumps", "org.model_dump", "sys.stdout.buffer.write", "output.encode", "log.info", "len", "log.info", "log.critical", "bold_red"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_cloud_py.handle_cloud_command"]
The function (handle_list_organizations_command) defined within the public class called public.The function start at line 86 and ends at 136. It contains 41 lines of code and it has a cyclomatic complexity of 9. The function does not take any parameters and does not return any value. It declares 14.0 functions, It has ...
Sema4AI_actions
public
public
0
0
handle_cloud_command
def handle_cloud_command(base_args: ArgumentsNamespace) -> int:from sema4ai.action_server._protocols import ArgumentsNamespaceCloudcloud_args: ArgumentsNamespaceCloud = typing.cast(ArgumentsNamespaceCloud, base_args)cloud_command = cloud_args.cloud_commandmatch cloud_command:case "login":return handle_login_command(clo...
1
16
1
73
1
139
157
139
base_args
['cloud_command']
int
{"AnnAssign": 1, "Assign": 1, "Expr": 1, "Return": 4}
5
19
5
["typing.cast", "handle_login_command", "handle_verify_login_command", "handle_list_organizations_command", "log.critical"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._main_retcode"]
The function (handle_cloud_command) defined within the public class called public.The function start at line 139 and ends at 157. It contains 16 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 5.0 functions, It has 5.0 functions...
Sema4AI_actions
IHookOnActionsListCallback
public
1
1
__call__
def __call__(self,action_package: "ActionPackage",actions_list_result: list["ActionsListActionTypedDict"],data_package_metadata: dict | None,):...
1
7
4
24
0
23
29
23
self,action_package,actions_list_result,data_package_metadata
[]
None
{"Expr": 1}
0
7
0
[]
50
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3561509_collective_solgema_fullcalendar.Solgema.fullcalendar.browser.views_py.SolgemaFullcalendarEventJS.__call__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3598540_saltstack_salt_testing.salttesting.runtests_p...
The function (__call__) defined within the public class called IHookOnActionsListCallback, implement an interface, and it inherit another class.The function start at line 23 and ends at 29. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [23.0] and does not ret...
Sema4AI_actions
IHookOnActionsList
public
1
1
register
def register(self,callback: IHookOnActionsListCallback,) -> OnExitContextManager:...
1
5
2
13
0
33
37
33
self,callback
[]
OnExitContextManager
{"Expr": 1}
0
5
0
[]
904
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3625043_uber_tchannel_python.tests.integration.json.test_json_server_py.json_server", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3625043_uber_tchannel_python.tests.integration.test_error_handling_py.mock_server",...
The function (register) defined within the public class called IHookOnActionsList, implement an interface, and it inherit another class.The function start at line 33 and ends at 37. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [33.0] and does not return any ...
Sema4AI_actions
IHookOnActionsListCallback
public
1
1
__call__
def __call__(self,action_package: "ActionPackage",actions_list_result: list["ActionsListActionTypedDict"],data_package_metadata: dict | None,):...
1
7
4
24
0
39
45
23
self,action_package,actions_list_result,data_package_metadata
[]
None
{"Expr": 1}
0
7
0
[]
50
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3561509_collective_solgema_fullcalendar.Solgema.fullcalendar.browser.views_py.SolgemaFullcalendarEventJS.__call__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3598540_saltstack_salt_testing.salttesting.runtests_p...
The function (__call__) defined within the public class called IHookOnActionsListCallback, implement an interface, and it inherit another class.The function start at line 39 and ends at 45. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [23.0] and does not ret...
Sema4AI_actions
public
public
0
0
import_action_package
def import_action_package(*,datadir: Path,action_package_dir: str,disable_not_imported: bool,skip_lint: bool,whitelist: str,):"""Imports action packages based on directories given in the filesystem.Note that the action package is expected to be in the proper directory atthis point (meaning that it should have been extr...
14
110
5
427
16
52
201
52
datadir,action_package_dir,disable_not_imported,skip_lint,whitelist
['action_package_id', 'action_package', 'env', 'actions_library_version', 'expected_version', 'actions_library_version_str', 'expected_version_str', 'min_version_for_encryption_with_auth_tag', 'action_package_handler', 'package_yaml_exists', 'import_path', 'directory_path', 'found_actions', 'action_package_name', 'pyth...
None
{"Assign": 21, "Expr": 8, "If": 7, "Return": 1, "Try": 3}
29
150
29
["log.debug", "ActionPackageHandler", "accept_action_package", "log.info", "action_package_handler.bootstrap_environment", "import_path.relative_to", "import_path.samefile", "gen_uuid", "use_env.get", "log.info", "colored", "ActionPackage", "directory_path.as_posix", "json.dumps", "log.debug", "build_python_launch_env"...
0
[]
The function (import_action_package) defined within the public class called public.The function start at line 52 and ends at 201. It contains 110 lines of code and it has a cyclomatic complexity of 14. It takes 5 parameters, represented as [52.0] and does not return any value. It declares 29.0 functions, and It has 29...
Sema4AI_actions
public
public
0
0
_get_actions_version
def _get_actions_version(env, cwd, libname: Literal["robocorp.actions"] | Literal["sema4ai.actions"]) -> tuple[int, ...]:from sema4ai.action_server._settings import get_python_exe_from_envpython = get_python_exe_from_env(env)cmdline: list[str] = [python,"-c",f"import {libname};print({libname}.__version__)",]msg = f"""U...
4
23
3
128
4
204
237
204
env,cwd,libname
['str_output', 'output', 'msg', 'python']
tuple[int, ...]
{"AnnAssign": 1, "Assign": 4, "Return": 1, "Try": 2}
10
34
10
["get_python_exe_from_env", "libname.replace", "subprocess.check_output", "RuntimeError", "output.decode", "tuple", "int", "split", "str_output.strip", "RuntimeError"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_import_py.import_action_package"]
The function (_get_actions_version) defined within the public class called public.The function start at line 204 and ends at 237. It contains 23 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [204.0] and does not return any value. It declares 10.0 functions, It has 10.0 fun...
Sema4AI_actions
public
public
0
0
_add_actions_to_db
def _add_actions_to_db(datadir: Path,env: dict,import_path: Path,action_package: "ActionPackage",disable_not_imported: bool,skip_lint: bool,whitelist: str,actions_library_version: tuple[int, ...],):from dataclasses import asdictfrom sema4ai.actions._lint_action import format_lint_resultsfrom sema4ai.action_server._erro...
36
187
8
998
26
240
475
240
datadir,env,import_path,action_package,disable_not_imported,skip_lint,whitelist,actions_library_version
['new_action_package_as_dict', 'filepath', 'existing_action_package', 'actions', 'loaded_from_stdout', 'python', 'managed_params_str', 'new_action_as_dict', 'lint_result', 'options', 'code', 'seen_action_ids', 'db', 'existing_actions', 'cmdline', 'action_name', 'existing_action_name_to_action', 'metadata_result', 'pope...
None
{"AnnAssign": 1, "Assign": 34, "Expr": 21, "For": 6, "If": 24, "Try": 4, "With": 2}
79
236
79
["get_python_exe_from_env", "subprocess.Popen", "str", "popen.communicate", "popen.poll", "popen.poll", "json.loads", "isinstance", "loaded_from_stdout.get", "isinstance", "format_lint_results", "ActionServerValidationError", "RuntimeError", "subprocess.list2cmdline", "stdout.decode", "stderr.decode", "strip", "stderr....
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_import_py.import_action_package"]
The function (_add_actions_to_db) defined within the public class called public.The function start at line 240 and ends at 475. It contains 187 lines of code and it has a cyclomatic complexity of 36. It takes 8 parameters, represented as [240.0] and does not return any value. It declares 79.0 functions, It has 79.0 fun...
Sema4AI_actions
public
public
0
0
_create_server_socket
def _create_server_socket(host: str, port: int):try:server = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)if sys.platform == "win32":server.setsockopt(SOL_SOCKET, SO_EXCLUSIVEADDRUSE, 1)else:server.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)server.bind((host, port))server.settimeout(None)except Exception:server.close()raiseret...
3
13
2
79
1
43
57
43
host,port
['server']
Returns
{"Assign": 1, "Expr": 5, "If": 1, "Return": 1, "Try": 1}
6
15
6
["socket", "server.setsockopt", "server.setsockopt", "server.bind", "server.settimeout", "server.close"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_process_pool_py.ProcessHandle.__init__"]
The function (_create_server_socket) defined within the public class called public.The function start at line 43 and ends at 57. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [43.0], and this function return a value. It declares 6.0 functions, It has 6.0 fun...
Sema4AI_actions
public
public
0
0
_connect_to_socket
def _connect_to_socket(host, port):"""connects to a host/port"""s = socket(AF_INET, SOCK_STREAM)#Set TCP keepalive on an open socket.#It activates after 1 second (TCP_KEEPIDLE,) of idleness,#then sends a keepalive ping once every 3 seconds (TCP_KEEPINTVL),#and closes the connection after 5 failed ping (TCP_KEEPCNT), or...
5
23
2
137
2
60
90
60
host,port
['s', 'timeout']
Returns
{"Assign": 2, "Expr": 8, "Return": 1, "Try": 4}
8
31
8
["socket", "s.setsockopt", "s.setsockopt", "s.setsockopt", "s.setsockopt", "s.settimeout", "s.connect", "s.settimeout"]
0
[]
The function (_connect_to_socket) defined within the public class called public.The function start at line 60 and ends at 90. It contains 23 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [60.0], and this function return a value. It declares 8.0 functions, and It has 8.0 f...
Sema4AI_actions
public
public
0
0
__init__._process_stream_reader
def _process_stream_reader(stderr_or_stdout):while True:line_bytes = stderr_or_stdout.readline()if not line_bytes:breakline_as_str = line_bytes.decode("utf-8", "replace")print(colored(f"output (pid: {pid}): ", attrs=["dark"])+ f"{line_as_str.strip()}\n",end="",)self._on_output(line_bytes)
3
12
1
58
0
166
177
166
null
[]
None
null
0
0
0
null
0
null
The function (__init__._process_stream_reader) defined within the public class called public.The function start at line 166 and ends at 177. It contains 12 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
__init__.accept_connection
def accept_connection():server_socket.listen(1)sock, _addr = server_socket.accept()return sock
1
4
0
21
0
193
196
193
null
[]
None
null
0
0
0
null
0
null
The function (__init__.accept_connection) defined within the public class called public.The function start at line 193 and ends at 196. 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..
Sema4AI_actions
ProcessHandle
public
0
0
__init__
def __init__(self,settings: Settings,action_package: ActionPackage,post_run_args: Optional[tuple[str, ...]],):from sema4ai.action_server._preload_actions.preload_actions_streams import (JsonRpcStreamWriter,)from sema4ai.action_server._robo_utils.callback import Callbackfrom sema4ai.action_server._robo_utils.run_in_thre...
6
110
4
603
0
94
259
94
self,settings,action_package,post_run_args
[]
Returns
{"AnnAssign": 2, "Assign": 45, "Expr": 12, "If": 5, "Return": 2, "Try": 1, "While": 1}
42
166
42
["_get_process_handle_key", "json.loads", "_add_preload_actions_dir_to_env_pythonpath", "build_python_launch_env", "env.pop", "is_frozen", "log.critical", "get_action_package_cwd", "build_subprocess_kwargs", "subprocess_kwargs.update", "str", "stderr_or_stdout.readline", "line_bytes.decode", "print", "colored", "line_a...
6,243
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called ProcessHandle.The function start at line 94 and ends at 259. It contains 110 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [94.0], and this function return a value. It declares 42.0 functions, It has 42.0 funct...
Sema4AI_actions
ProcessHandle
public
0
0
pid
def pid(self):return self._process.pid
1
2
1
11
0
262
263
262
self
[]
Returns
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3653784_wrobell_geotiler.geotiler.provider_py.providers"]
The function (pid) defined within the public class called ProcessHandle.The function start at line 262 and ends at 263. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 1.0 function calling this function which is ["_...
Sema4AI_actions
ProcessHandle
public
0
0
cwd
def cwd(self) -> str:return self._cwd
1
2
1
11
0
266
267
266
self
[]
str
{"Return": 1}
0
2
0
[]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.model_io.bioimage._readme_factory_py.readme_factory", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.utils.test_context_py.test_cwd", "_.c...
The function (cwd) defined within the public class called ProcessHandle.The function start at line 266 and ends at 267. 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. It has 3.0 functions calling this function which are ["_.c...
Sema4AI_actions
ProcessHandle
public
0
0
is_alive
def is_alive(self) -> bool:if self._kill_called:return Falsefrom ._robo_utils.process import is_process_aliveif self._process.poll() is not None:return Falsereturn is_process_alive(self._process.pid)
3
7
1
44
0
269
278
269
self
[]
bool
{"If": 2, "Return": 3}
2
10
2
["self._process.poll", "is_process_alive"]
0
[]
The function (is_alive) defined within the public class called ProcessHandle.The function start at line 269 and ends at 278. It contains 7 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions ...
Sema4AI_actions
ProcessHandle
public
0
0
kill
def kill(self) -> None:from ._robo_utils.process import kill_process_and_subprocessesif not self.is_alive():log.info(f"Process related to run {self._process.pid} is not running, cannot kill.")returnself._kill_called = Truelog.info("Subprocess kill [pid=%s]", self._process.pid)kill_process_and_subprocesses(self._process...
2
10
1
55
0
280
292
280
self
[]
None
{"Assign": 1, "Expr": 3, "If": 1, "Return": 1}
4
13
4
["self.is_alive", "log.info", "log.info", "kill_process_and_subprocesses"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3657321_dvrhax_upymysql.tests.test_issues_py.TestNewIssues.test_issue_36", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3704533_opentsdb_tcollector.tcollector_py.Collector.shutdown", "_.content.gdrive.MyDrive.Phd_T...
The function (kill) defined within the public class called ProcessHandle.The function start at line 280 and ends at 292. It contains 10 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions called i...
Sema4AI_actions
ProcessHandle
public
0
0
_do_run_action
def _do_run_action(self,run: Run,action_package: ActionPackage,action: Action,input_json: Path,run_artifacts_dir: Path,result_json: Path,headers: dict,cookies: dict,reuse_process: bool,) -> int:from sema4ai.action_server._api_oauth2 import (get_resolved_provider_settings,refresh_tokens,)from sema4ai.action_server._api_...
24
134
10
671
0
294
464
294
self,run,action_package,action,input_json,run_artifacts_dir,result_json,headers,cookies,reuse_process
[]
int
{"AnnAssign": 4, "Assign": 33, "Expr": 9, "For": 3, "If": 15, "Return": 1, "Try": 2, "With": 1}
37
171
37
["IN_MEMORY_SECRETS.update_headers", "headers.get", "ActionContext", "cookies.get", "get_db", "db.connect", "get_user_session_from_id", "db.where_from_dict", "set", "json.loads", "loaded.items", "param_info.get", "param_info.get", "required_providers.add", "db.all", "refresh_tokens", "provider_to_access_data.values", "...
0
[]
The function (_do_run_action) defined within the public class called ProcessHandle.The function start at line 294 and ends at 464. It contains 134 lines of code and it has a cyclomatic complexity of 24. It takes 10 parameters, represented as [294.0] and does not return any value. It declares 37.0 functions, and It has...
Sema4AI_actions
public
public
0
0
_call_post_run_script.run_post_run_command_in_thread
def run_post_run_command_in_thread():import iotry:# Note: should log when starting automatically.p = process.Process(use_args, cwd=cwd, env=env)output = io.StringIO()p.on_stderr.register(lambda line: output.write(line))p.on_stdout.register(lambda line: output.write(line))p.start()p.join()if p.returncode != 0:log.error(...
3
20
0
121
0
513
534
513
null
[]
None
null
0
0
0
null
0
null
The function (_call_post_run_script.run_post_run_command_in_thread) defined within the public class called public.The function start at line 513 and ends at 534. It contains 20 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
Sema4AI_actions
ProcessHandle
public
0
0
_call_post_run_script
def _call_post_run_script(self,post_run_args: tuple[str, ...],initial_action_context_value: Optional[JSONValue],msg: dict,run: Run,) -> None:import shlexfrom string import Templatefrom sema4ai.action_server._robo_utils import process, run_in_threadfrom sema4ai.action_server._robo_utils.process import build_python_launc...
9
44
5
241
0
466
539
466
self,post_run_args,initial_action_context_value,msg,run
[]
None
{"Assign": 11, "Expr": 11, "For": 2, "If": 4, "Try": 3}
29
74
29
["get_settings", "isinstance", "initial_action_context_value.get", "isinstance", "invocation_context.items", "isinstance", "use_args.append", "substitute", "Template", "log.exception", "RuntimeError", "k.upper", "mapping.items", "build_python_launch_env", "process.Process", "io.StringIO", "p.on_stderr.register", "outpu...
0
[]
The function (_call_post_run_script) defined within the public class called ProcessHandle.The function start at line 466 and ends at 539. It contains 44 lines of code and it has a cyclomatic complexity of 9. It takes 5 parameters, represented as [466.0] and does not return any value. It declares 29.0 functions, and It...
Sema4AI_actions
public
public
0
0
run_action.on_output
def on_output(line_bytes: bytes):stream.write(line_bytes)
1
2
1
13
0
561
562
561
null
[]
None
null
0
0
0
null
0
null
The function (run_action.on_output) defined within the public class called public.The function start at line 561 and ends at 562. 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..
Sema4AI_actions
ProcessHandle
public
0
0
run_action
def run_action(self,run: Run,action_package: ActionPackage,action: Action,input_json: Path,run_artifacts_dir: Path,output_file: Path,result_json: Path,headers: dict,cookies: dict,reuse_process: bool,) -> int:"""Runs the action and returns the returncode from running the action.(returncode=0 means everything is Ok)."""w...
1
28
11
98
0
541
577
541
self,run,action_package,action,input_json,run_artifacts_dir,output_file,result_json,headers,cookies,reuse_process
[]
int
{"Assign": 1, "Expr": 2, "Return": 1, "With": 2}
4
37
4
["output_file.open", "stream.write", "self._on_output.register", "self._do_run_action"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3915406_pythonprofilers_memory_profiler.mprof_py.attach_action", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981960_dask_dask_kubernetes.ci.pre_commit_crd_py.main"]
The function (run_action) defined within the public class called ProcessHandle.The function start at line 541 and ends at 577. It contains 28 lines of code and it has a cyclomatic complexity of 1. It takes 11 parameters, represented as [541.0] and does not return any value. It declares 4.0 functions, It has 4.0 functio...
Sema4AI_actions
public
public
0
0
_get_process_handle_key
def _get_process_handle_key(settings: Settings, action_package: ActionPackage) -> _Key:"""Given an action provides a key where the key identifies whether agiven action can be run at a given ProcessHandle."""from ._actions_run_helpers import get_action_package_cwdenv = tuple(sorted(json.loads(action_package.env_json).it...
1
5
2
58
2
580
589
580
settings,action_package
['env', 'cwd']
_Key
{"Assign": 2, "Expr": 1, "Return": 1}
6
10
6
["tuple", "sorted", "items", "json.loads", "get_action_package_cwd", "_Key"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_process_pool_py.ActionsProcessPool.obtain_process_for_action", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_...
The function (_get_process_handle_key) defined within the public class called public.The function start at line 580 and ends at 589. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [580.0] and does not return any value. It declares 6.0 functions, It has 6.0 fun...
Sema4AI_actions
ProcessHandle
public
0
0
__init__
def __init__(self,settings: Settings,action_package_id_to_action_package: Dict[str, ActionPackage],actions: List[Action],):import osimport shlexself._settings = settingsself.action_package_id_to_action_package = action_package_id_to_action_packagepost_run_cmd = os.environ.get("SEMA4AI_ACTION_SERVER_POST_RUN_CMD")if not...
5
32
4
196
0
593
635
593
self,settings,action_package,post_run_args
[]
Returns
{"AnnAssign": 2, "Assign": 45, "Expr": 12, "If": 5, "Return": 2, "Try": 1, "While": 1}
42
166
42
["_get_process_handle_key", "json.loads", "_add_preload_actions_dir_to_env_pythonpath", "build_python_launch_env", "env.pop", "is_frozen", "log.critical", "get_action_package_cwd", "build_subprocess_kwargs", "subprocess_kwargs.update", "str", "stderr_or_stdout.readline", "line_bytes.decode", "print", "colored", "line_a...
6,243
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called ProcessHandle.The function start at line 593 and ends at 635. It contains 32 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [593.0], and this function return a value. It declares 42.0 functions, It has 42.0 func...
Sema4AI_actions
ActionsProcessPool
public
0
0
on_reload
def on_reload(self,action_package_id_to_action_package: Dict[str, ActionPackage],actions: List[Action],):"""On a reload, we need to kill all the related, idle processes and markany running process as non-reusable."""with self._lock:for key, idle_processes in tuple(self._idle_processes.items()):for process in idle_proce...
7
19
3
127
0
637
666
637
self,action_package_id_to_action_package,actions
[]
None
{"Assign": 4, "Expr": 4, "For": 4, "With": 1}
8
30
8
["tuple", "self._idle_processes.items", "process.kill", "self._idle_processes.pop", "tuple", "self._running_processes.items", "itertools.cycle", "self._warmup_processes"]
0
[]
The function (on_reload) defined within the public class called ActionsProcessPool.The function start at line 637 and ends at 666. It contains 19 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [637.0] and does not return any value. It declares 8.0 functions, and It has 8.0...
Sema4AI_actions
ActionsProcessPool
public
0
0
_reuse_processes
def _reuse_processes(self) -> bool:"""Returns:Whether processes can be reused."""return self._settings.reuse_processes
1
2
1
14
0
669
674
669
self
[]
bool
{"Expr": 1, "Return": 1}
0
6
0
[]
0
[]
The function (_reuse_processes) defined within the public class called ActionsProcessPool.The function start at line 669 and ends at 674. 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..
Sema4AI_actions
ActionsProcessPool
public
0
0
max_processes
def max_processes(self) -> int:"""Returns:The maximum number of processes that may be created by the processpool."""return self._settings.max_processes
1
2
1
14
0
677
683
677
self
[]
int
{"Expr": 1, "Return": 1}
0
7
0
[]
0
[]
The function (max_processes) defined within the public class called ActionsProcessPool.The function start at line 677 and ends at 683. 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..
Sema4AI_actions
ActionsProcessPool
public
0
0
min_processes
def min_processes(self) -> int:return self._settings.min_processes
1
2
1
13
0
686
687
686
self
[]
int
{"Return": 1}
0
2
0
[]
0
[]
The function (min_processes) defined within the public class called ActionsProcessPool.The function start at line 686 and ends at 687. 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..
Sema4AI_actions
ActionsProcessPool
public
0
0
_create_process
def _create_process(self, action: Action):action_package: ActionPackage = self.action_package_id_to_action_package[action.action_package_id]process_handle = ProcessHandle(self._settings, action_package, self._post_run_cmd_args)assert self._lock.locked(), "Lock must be acquired at this point."self._add_to_idle_processes...
1
9
2
51
0
689
698
689
self,action
[]
None
{"AnnAssign": 1, "Assign": 1, "Expr": 1}
3
10
3
["ProcessHandle", "self._lock.locked", "self._add_to_idle_processes"]
0
[]
The function (_create_process) defined within the public class called ActionsProcessPool.The function start at line 689 and ends at 698. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [689.0] and does not return any value. It declares 3.0 functions, and It ha...
Sema4AI_actions
ActionsProcessPool
public
0
0
dispose
def dispose(self):with self._lock:for processes in itertools.chain(self._idle_processes.values(), self._running_processes.values()):for process_handle in processes:process_handle.kill()self._idle_processes.clear()self._running_processes.clear()
3
9
1
58
0
700
708
700
self
[]
None
{"Expr": 3, "For": 2, "With": 1}
6
9
6
["itertools.chain", "self._idle_processes.values", "self._running_processes.values", "process_handle.kill", "self._idle_processes.clear", "self._running_processes.clear"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3963889_stevearc_pypicloud.pypicloud.access.sql_py.SQLAccessBackend.postfork", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3963889_stevearc_pypicloud.pypicloud.cache.sql_py.SQLCache.postfork"]
The function (dispose) defined within the public class called ActionsProcessPool.The function start at line 700 and ends at 708. It contains 9 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 6.0 functions, It has 6.0 functions c...
Sema4AI_actions
ActionsProcessPool
public
0
0
get_idle_processes_count
def get_idle_processes_count(self) -> int:with self._lock:return self._get_idle_processes_count_unlocked()
1
3
1
18
0
710
712
710
self
[]
int
{"Return": 1, "With": 1}
1
3
1
["self._get_idle_processes_count_unlocked"]
0
[]
The function (get_idle_processes_count) defined within the public class called ActionsProcessPool.The function start at line 710 and ends at 712. 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. It declare 1.0 function, and It...
Sema4AI_actions
ActionsProcessPool
public
0
0
_get_idle_processes_count_unlocked
def _get_idle_processes_count_unlocked(self) -> int:assert self._lock.locked(), "Lock must be acquired at this point."count = 0for v in self._idle_processes.values():count += len(v)return count
2
6
1
39
0
714
719
714
self
[]
int
{"Assign": 1, "AugAssign": 1, "For": 1, "Return": 1}
3
6
3
["self._lock.locked", "self._idle_processes.values", "len"]
0
[]
The function (_get_idle_processes_count_unlocked) defined within the public class called ActionsProcessPool.The function start at line 714 and ends at 719. 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. It declares 3.0 functi...
Sema4AI_actions
ActionsProcessPool
public
0
0
get_running_processes_count
def get_running_processes_count(self) -> int:with self._lock:return self._get_running_processes_count_unlocked()
1
3
1
18
0
721
723
721
self
[]
int
{"Return": 1, "With": 1}
1
3
1
["self._get_running_processes_count_unlocked"]
0
[]
The function (get_running_processes_count) defined within the public class called ActionsProcessPool.The function start at line 721 and ends at 723. 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. It declare 1.0 function, and ...
Sema4AI_actions
ActionsProcessPool
public
0
0
_get_running_processes_count_unlocked
def _get_running_processes_count_unlocked(self) -> int:assert self._lock.locked(), "Lock must be acquired at this point."count = 0for v in self._running_processes.values():count += len(v)return count
2
6
1
39
0
725
730
725
self
[]
int
{"Assign": 1, "AugAssign": 1, "For": 1, "Return": 1}
3
6
3
["self._lock.locked", "self._running_processes.values", "len"]
0
[]
The function (_get_running_processes_count_unlocked) defined within the public class called ActionsProcessPool.The function start at line 725 and ends at 730. 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. It declares 3.0 fun...
Sema4AI_actions
ActionsProcessPool
public
0
0
_count_total_processes
def _count_total_processes(self) -> int:assert self._lock.locked(), "Lock must be acquired at this point."count = 0for v in itertools.chain(self._running_processes.values(), self._idle_processes.values()):count += len(v)return count
2
8
1
52
0
732
739
732
self
[]
int
{"Assign": 1, "AugAssign": 1, "For": 1, "Return": 1}
5
8
5
["self._lock.locked", "itertools.chain", "self._running_processes.values", "self._idle_processes.values", "len"]
0
[]
The function (_count_total_processes) defined within the public class called ActionsProcessPool.The function start at line 732 and ends at 739. It contains 8 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It...
Sema4AI_actions
ActionsProcessPool
public
0
0
_add_to_idle_processes
def _add_to_idle_processes(self, process_handle: ProcessHandle):assert self._lock.locked(), "Lock must be acquired at this point."processes = self._idle_processes.get(process_handle.key)if processes is None:processes = self._idle_processes[process_handle.key] = set()processes.add(process_handle)
2
6
2
56
0
741
746
741
self,process_handle
[]
None
{"Assign": 2, "Expr": 1, "If": 1}
4
6
4
["self._lock.locked", "self._idle_processes.get", "set", "processes.add"]
0
[]
The function (_add_to_idle_processes) defined within the public class called ActionsProcessPool.The function start at line 741 and ends at 746. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [741.0] and does not return any value. It declares 4.0 functions, and...
Sema4AI_actions
ActionsProcessPool
public
0
0
_add_to_running_processes
def _add_to_running_processes(self, process_handle: ProcessHandle):assert self._lock.locked(), "Lock must be acquired at this point."processes = self._running_processes.get(process_handle.key)if processes is None:processes = self._running_processes[process_handle.key] = set()processes.add(process_handle)
2
6
2
56
0
748
753
748
self,process_handle
[]
None
{"Assign": 2, "Expr": 1, "If": 1}
4
6
4
["self._lock.locked", "self._running_processes.get", "set", "processes.add"]
0
[]
The function (_add_to_running_processes) defined within the public class called ActionsProcessPool.The function start at line 748 and ends at 753. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [748.0] and does not return any value. It declares 4.0 functions, ...
Sema4AI_actions
ActionsProcessPool
public
0
0
_remove_from_running_processes
def _remove_from_running_processes(self, process_handle: ProcessHandle):assert self._lock.locked(), "Lock must be acquired at this point."processes = self._running_processes.get(process_handle.key)if not processes:returnprocesses.discard(process_handle)
2
6
2
42
0
755
760
755
self,process_handle
[]
None
{"Assign": 1, "Expr": 1, "If": 1, "Return": 1}
3
6
3
["self._lock.locked", "self._running_processes.get", "processes.discard"]
0
[]
The function (_remove_from_running_processes) defined within the public class called ActionsProcessPool.The function start at line 755 and ends at 760. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [755.0] and does not return any value. It declares 3.0 functi...
Sema4AI_actions
ActionsProcessPool
public
0
0
_warmup_processes
def _warmup_processes(self):if not self.actions:returnwith self._lock:while self._count_total_processes() < self._settings.min_processes:one_action = next(self._cycle_actions_iterator)self._create_process(one_action)
3
7
1
44
0
762
769
762
self
[]
None
{"Assign": 1, "Expr": 1, "If": 1, "Return": 1, "While": 1, "With": 1}
3
8
3
["self._count_total_processes", "next", "self._create_process"]
0
[]
The function (_warmup_processes) defined within the public class called ActionsProcessPool.The function start at line 762 and ends at 769. It contains 7 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has ...
Sema4AI_actions
ActionsProcessPool
public
0
0
obtain_process_for_action
def obtain_process_for_action(self, action: Action, runtime_info: Optional["RunRuntimeInfo"] = None) -> Iterator[ProcessHandle]:import timefrom concurrent.futures import CancelledErroraction_package: ActionPackage = self.action_package_id_to_action_package[action.action_package_id]key = _get_process_handle_key(self._se...
22
121
3
475
0
772
924
772
self,action,runtime_info
[]
Iterator[ProcessHandle]
{"AnnAssign": 2, "Assign": 12, "Expr": 24, "If": 17, "Try": 2, "While": 1, "With": 2}
42
153
42
["_get_process_handle_key", "time.monotonic", "self._processes_running_semaphore.release", "runtime_info.is_canceled", "CancelledError", "self._processes_running_semaphore.acquire", "time.monotonic", "log.info", "time.monotonic", "self._idle_processes.get", "processes.pop", "log.debug", "process_handle.is_alive", "log....
0
[]
The function (obtain_process_for_action) defined within the public class called ActionsProcessPool.The function start at line 772 and ends at 924. It contains 121 lines of code and it has a cyclomatic complexity of 22. It takes 3 parameters, represented as [772.0] and does not return any value. It declares 42.0 functio...
Sema4AI_actions
public
public
0
0
setup_actions_process_pool
def setup_actions_process_pool(settings: Settings,action_package_id_to_action_package: Dict[str, ActionPackage],actions: List[Action],):global _actions_process_pool_actions_process_pool = ActionsProcessPool(settings, action_package_id_to_action_package, actions)yield_actions_process_pool = None
1
11
3
40
1
931
942
931
settings,action_package_id_to_action_package,actions
['_actions_process_pool']
None
{"Assign": 2, "Expr": 1}
1
12
1
["ActionsProcessPool"]
0
[]
The function (setup_actions_process_pool) defined within the public class called public.The function start at line 931 and ends at 942. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [931.0] and does not return any value. It declare 1.0 function, and It has ...
Sema4AI_actions
public
public
0
0
get_actions_process_pool
def get_actions_process_pool() -> ActionsProcessPool:assert _actions_process_pool is not Nonereturn _actions_process_pool
1
3
0
13
0
945
947
945
[]
ActionsProcessPool
{"Return": 1}
0
3
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_run_py._ActionsRunner._run_action_impl"]
The function (get_actions_process_pool) defined within the public class called public.The function start at line 945 and ends at 947. 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. It has 1.0 function calling this function wh...
Sema4AI_actions
public
public
0
0
_create_run_artifacts_dir
def _create_run_artifacts_dir(action: "Action", run_id: str) -> str:"""Returns:The path, relative to the settings.artifacts_dir which should be usedto store the output of the given run."""from ._settings import get_settingssettings = get_settings()artifacts_dir = settings.artifacts_dirpath = run_idtarget_dir = artifact...
1
8
2
51
4
41
54
41
action,run_id
['target_dir', 'artifacts_dir', 'settings', 'path']
str
{"Assign": 4, "Expr": 2, "Return": 1}
2
14
2
["get_settings", "target_dir.mkdir"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_run_py._ActionsRunner.__init__"]
The function (_create_run_artifacts_dir) defined within the public class called public.The function start at line 41 and ends at 54. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [41.0] and does not return any value. It declares 2.0 functions, It has 2.0 func...
Sema4AI_actions
public
public
0
0
_create_run
def _create_run(action: "Action",run_id: str,inputs: dict,relative_artifacts_dir: str,request_id: str,) -> "Run":from sema4ai.action_server._models import RUN_ID_COUNTER, Counterfrom ._database import datetime_to_strfrom ._models import Run, RunStatus, get_dbfrom ._runs_state_cache import get_global_runs_statedb = get_...
2
42
5
219
4
57
104
57
action,run_id,inputs,relative_artifacts_dir,request_id
['global_runs_state', 'db', 'run', 'counter_record']
'Run'
{"AnnAssign": 1, "Assign": 5, "Expr": 3, "If": 1, "Return": 1, "With": 2}
15
48
15
["get_db", "dict", "datetime_to_str", "datetime.datetime.now", "json.dumps", "db.transaction", "db.cursor", "db.execute_update_returning", "cursor.fetchall", "RuntimeError", "db.all", "Run", "db.insert", "get_global_runs_state", "global_runs_state.on_run_inserted"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_run_py._ActionsRunner.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tes...
The function (_create_run) defined within the public class called public.The function start at line 57 and ends at 104. It contains 42 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [57.0] and does not return any value. It declares 15.0 functions, It has 15.0 functions call...
Sema4AI_actions
public
public
0
0
_update_run
def _update_run(run: "Run", initial_time: float, run_finished: bool, **changes):from sema4ai.action_server._settings import get_settingsfrom ._models import get_dbfrom ._runs_state_cache import get_global_runs_stateif run_finished:changes["run_time"] = time.monotonic() - initial_timedb = get_db()changes_repr = []for k,...
4
22
4
158
6
107
135
107
run,initial_time,run_finished,**changes
['global_runs_state', 'db', 'url', 'changes_str', 'changes_repr', 'fields_changed']
None
{"Assign": 7, "Expr": 6, "For": 1, "If": 2, "With": 1}
15
29
15
["time.monotonic", "get_db", "changes.items", "setattr", "changes_repr.append", "changes_repr.append", "tuple", "changes.keys", "join", "get_settings", "log.info", "db.transaction", "db.update", "get_global_runs_state", "global_runs_state.on_run_changed"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_run_py._set_run_as_finished_cancelled", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.acti...
The function (_update_run) defined within the public class called public.The function start at line 107 and ends at 135. It contains 22 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [107.0] and does not return any value. It declares 15.0 functions, It has 15.0 functions ca...
Sema4AI_actions
public
public
0
0
_set_run_as_finished_ok
def _set_run_as_finished_ok(run: "Run", result: str, initial_time: float) -> int:from ._models import RunStatus_update_run(run, initial_time, True, result=result, status=RunStatus.PASSED)return RunStatus.PASSED
1
4
3
44
0
138
142
138
run,result,initial_time
[]
int
{"Expr": 1, "Return": 1}
1
5
1
["_update_run"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_run_py._ActionsRunner._run_action_impl"]
The function (_set_run_as_finished_ok) defined within the public class called public.The function start at line 138 and ends at 142. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [138.0] and does not return any value. It declare 1.0 function, It has 1.0 funct...
Sema4AI_actions
public
public
0
0
_set_run_as_finished_failed_with_response
def _set_run_as_finished_failed_with_response(run: "Run", result: str, initial_time: float) -> int:from ._models import RunStatus_update_run(run, initial_time, True, status=RunStatus.FAILED, result=result)return RunStatus.FAILED
1
6
3
44
0
145
151
145
run,result,initial_time
[]
int
{"Expr": 1, "Return": 1}
1
7
1
["_update_run"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_run_py._ActionsRunner._run_action_impl"]
The function (_set_run_as_finished_failed_with_response) defined within the public class called public.The function start at line 145 and ends at 151. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [145.0] and does not return any value. It declare 1.0 function...
Sema4AI_actions
public
public
0
0
_set_run_as_finished_cancelled
def _set_run_as_finished_cancelled(run: "Run", error_message: str, initial_time: float) -> int:from ._models import RunStatus_update_run(run, initial_time, True, status=RunStatus.CANCELLED, error_message=error_message)return RunStatus.CANCELLED
1
8
3
44
0
154
162
154
run,error_message,initial_time
[]
int
{"Expr": 1, "Return": 1}
1
9
1
["_update_run"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_run_py._ActionsRunner._run_action_impl"]
The function (_set_run_as_finished_cancelled) defined within the public class called public.The function start at line 154 and ends at 162. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [154.0] and does not return any value. It declare 1.0 function, It has 1....
Sema4AI_actions
public
public
0
0
_set_run_as_finished_failed
def _set_run_as_finished_failed(run: "Run", error_message: str, initial_time: float) -> int:from ._models import RunStatus_update_run(run, initial_time, True, status=RunStatus.FAILED, error_message=error_message)return RunStatus.FAILED
1
8
3
44
0
165
173
165
run,error_message,initial_time
[]
int
{"Expr": 1, "Return": 1}
1
9
1
["_update_run"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_run_py._ActionsRunner._run_action_impl"]
The function (_set_run_as_finished_failed) defined within the public class called public.The function start at line 165 and ends at 173. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [165.0] and does not return any value. It declare 1.0 function, It has 1.0 f...
Sema4AI_actions
public
public
0
0
_set_run_as_running
def _set_run_as_running(run: "Run", initial_time: float) -> int:from ._models import RunStatus_update_run(run, initial_time, False, status=RunStatus.RUNNING)return RunStatus.RUNNING
1
4
2
36
0
176
180
176
run,initial_time
[]
int
{"Expr": 1, "Return": 1}
1
5
1
["_update_run"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_run_py._ActionsRunner._run_action_impl"]
The function (_set_run_as_running) defined within the public class called public.The function start at line 176 and ends at 180. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [176.0] and does not return any value. It declare 1.0 function, It has 1.0 function ...
Sema4AI_actions
IResponseHandler
public
1
1
set_run_id
def set_run_id(self, run_id: str):pass
1
2
2
10
0
184
185
184
self,run_id
[]
None
{}
0
2
0
[]
0
[]
The function (set_run_id) defined within the public class called IResponseHandler, implement an interface, and it inherit another class.The function start at line 184 and ends at 185. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [184.0] and does not return a...
Sema4AI_actions
IResponseHandler
public
1
1
set_async_completion
def set_async_completion(self):pass
1
2
1
6
0
187
188
187
self
[]
None
{}
0
2
0
[]
0
[]
The function (set_async_completion) defined within the public class called IResponseHandler, implement an interface, and it inherit another class.The function start at line 187 and ends at 188. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not re...
Sema4AI_actions
ResponseHandler
public
0
0
__init__
def __init__(self, response: Response):self.response = response
1
2
2
14
0
192
193
192
self,response
[]
None
{"Assign": 1}
0
2
0
[]
6,243
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called ResponseHandler.The function start at line 192 and ends at 193. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [192.0] and does not return any value. It has 6243.0 functions calling this function w...
Sema4AI_actions
IResponseHandler
public
1
1
set_run_id
def set_run_id(self, run_id: str):self.response.headers[HEADER_ACTION_SERVER_RUN_ID] = run_id
1
2
2
19
0
195
196
195
self,run_id
[]
None
{}
0
2
0
[]
0
[]
The function (set_run_id) defined within the public class called IResponseHandler, implement an interface, and it inherit another class.The function start at line 195 and ends at 196. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [195.0] and does not return a...
Sema4AI_actions
IResponseHandler
public
1
1
set_async_completion
def set_async_completion(self):self.response.headers[HEADER_ACTION_ASYNC_COMPLETION] = "1"
1
2
1
15
0
198
199
198
self
[]
None
{}
0
2
0
[]
0
[]
The function (set_async_completion) defined within the public class called IResponseHandler, implement an interface, and it inherit another class.The function start at line 198 and ends at 199. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not re...
Sema4AI_actions
IInternalFuncAPI
public
1
1
__call__
async def __call__(self,response_handler: IResponseHandler,inputs: dict,headers: dict,cookies: dict,) -> Any:...
1
8
5
25
0
203
210
203
self,response_handler,inputs,headers,cookies
[]
Any
{"Expr": 1}
0
8
0
[]
50
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3561509_collective_solgema_fullcalendar.Solgema.fullcalendar.browser.views_py.SolgemaFullcalendarEventJS.__call__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3598540_saltstack_salt_testing.salttesting.runtests_p...
The function (__call__) defined within the public class called IInternalFuncAPI, implement an interface, and it inherit another class.The function start at line 203 and ends at 210. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [203.0] and does not return any...
Sema4AI_actions
ResponseHandler
public
0
0
__init__
def __init__(self,action_package: "ActionPackage",action: "Action",input_schema_dict: dict,output_schema_dict: dict,input_validator: Callable[[dict], None],output_validator: Callable[[dict], None],inputs: dict,response_handler: IResponseHandler,headers: dict,cookies: dict,) -> None:"""Constructor. Still running in the ...
2
49
11
276
0
223
283
223
self,response
[]
None
{"Assign": 1}
0
2
0
[]
6,243
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called ResponseHandler.The function start at line 223 and ends at 283. It contains 49 lines of code and it has a cyclomatic complexity of 2. It takes 11 parameters, represented as [223.0] and does not return any value. It has 6243.0 functions calling this function...
Sema4AI_actions
_ActionsRunner
protected
0
0
run_in_thread
def run_in_thread(self) -> Any:"""This is where the action is actually run.This runs in a thread and spawns a new thread to actually run theaction (this 2-thread approach is required because we need to be ableto return to the client while the action is still running in thebackground).We have to take care of making a ru...
4
15
1
101
0
285
322
285
self
[]
Any
{"Assign": 2, "Expr": 2, "If": 2, "Return": 4, "Try": 1}
6
38
6
["self.response_handler.set_run_id", "run_in_thread.run_in_thread", "fut.result", "self._async_result", "fut.result", "self._async_result"]
10
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_process_pool_py.ProcessHandle.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.act...
The function (run_in_thread) defined within the protected class called _ActionsRunner.The function start at line 285 and ends at 322. It contains 15 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 6.0 functions, It has 6.0 funct...
Sema4AI_actions
_ActionsRunner
protected
0
0
_async_result
def _async_result(self) -> Any:self._returning_async_result = Trueself.response_handler.set_async_completion()return "async-return"
1
4
1
21
0
324
327
324
self
[]
Any
{"Assign": 1, "Expr": 1, "Return": 1}
1
4
1
["self.response_handler.set_async_completion"]
0
[]
The function (_async_result) defined within the protected class called _ActionsRunner.The function start at line 324 and ends at 327. 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 declare 1.0 function, and It has 1.0 fun...
Sema4AI_actions
_ActionsRunner
protected
0
0
_run_action
def _run_action(self) -> Any:"""This is where the action is actually run (to completion).If the action is async and the timeout for the async returnwas reached, this will call the callback url with the result.Returns:The result of the action."""# Before even running the action, validate the inputs.inputs: dict = self.i...
8
40
1
166
0
329
383
329
self
[]
Any
{"AnnAssign": 3, "Assign": 4, "Expr": 5, "For": 1, "If": 4, "Return": 1, "Try": 2}
8
55
8
["input_validator", "RequestValidationError", "self._run_action_impl", "range", "sema4ai_http.post", "time.sleep", "log.critical", "log.exception"]
0
[]
The function (_run_action) defined within the protected class called _ActionsRunner.The function start at line 329 and ends at 383. It contains 40 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8.0 fu...