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
IBeforeStartCallback
public
1
1
__call__
def __call__(self, app: "FastAPI") -> bool:"""Args:app: The (fully-configured) fast api appReturns: True if it's ok to continue starting up orFalse if the startup process should be stopped."""
1
1
2
12
0
75
82
75
self,app
[]
bool
{"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 IBeforeStartCallback, implement an interface, and it inherit another class.The function start at line 75 and ends at 82. It contains 1 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [75.0] and does not return an...
Sema4AI_actions
public
public
0
0
check_implements
def check_implements(x: T) -> T:"""Helper to check if a class implements some protocol.:important: It must be the last method in a class due tohttps://github.com/python/mypy/issues/9266Example:def __typecheckself__(self) -> None:_: IExpectedProtocol = check_implements(self)Mypy should complain if `self` is not implemen...
1
2
1
12
0
85
99
85
x
[]
T
{"Expr": 1, "Return": 1}
0
15
0
[]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.actions.src.sema4ai.actions._action_py.Action.__typecheckself__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.actions.src.sema4ai.actions._action_py.Context.__type...
The function (check_implements) defined within the public class called public.The function start at line 85 and ends at 99. 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 4.0 functions calling this function which are [...
Sema4AI_actions
EnvInfo
public
0
1
__init__
def __init__(self, env: Dict[str, str]):self.env = env
1
2
2
19
0
23
24
23
self,env
[]
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 EnvInfo, that inherit another class.The function start at line 23 and ends at 24. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [23.0] and does not return any value. It has 6243.0 functions callin...
Sema4AI_actions
public
public
0
0
as_str
def as_str(s) -> str:if isinstance(s, bytes):return s.decode("utf-8", "replace")return str(s)
2
4
1
29
0
27
30
27
s
[]
str
{"If": 1, "Return": 2}
3
4
3
["isinstance", "s.decode", "str"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._rcc_py.Rcc._run_rcc"]
The function (as_str) defined within the public class called public.The function start at line 27 and ends at 30. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called inside wh...
Sema4AI_actions
EnvInfo
public
0
1
__init__
def __init__(self, rcc_location: Path, sema4ai_home: Optional[Path]):self._rcc_location = rcc_locationself.sema4ai_home = sema4ai_homeself.config_location = os.environ.get("S4_ACTION_SERVER_RCC_CONFIG_LOCATION", "")
1
6
3
40
0
34
39
34
self,env
[]
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 EnvInfo, that inherit another class.The function start at line 34 and ends at 39. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [34.0] and does not return any value. It has 6243.0 functions callin...
Sema4AI_actions
Rcc
public
0
1
_compute_env
def _compute_env(self):env = os.environ.copy()env.pop("PYTHONPATH", "")env.pop("PYTHONHOME", "")env.pop("VIRTUAL_ENV", "")env["PYTHONIOENCODING"] = "utf-8"env["PYTHONUNBUFFERED"] = "1"if self.sema4ai_home:env["SEMA4AI_HOME"] = str(self.sema4ai_home)return env
2
10
1
68
0
41
52
41
self
[]
Returns
{"Assign": 4, "Expr": 3, "If": 1, "Return": 1}
5
12
5
["os.environ.copy", "env.pop", "env.pop", "env.pop", "str"]
0
[]
The function (_compute_env) defined within the public class called Rcc, that inherit another class.The function start at line 41 and ends at 52. It contains 10 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters, and this function return a value. It declares 5.0 functions, a...
Sema4AI_actions
Rcc
public
0
1
_compute_launch_args_and_kwargs
def _compute_launch_args_and_kwargs(self, cwd, env, args, stderr=Sentinel.SENTINEL) -> Tuple[list, dict]:from sema4ai.action_server._robo_utils.process import build_subprocess_kwargsif stderr is Sentinel.SENTINEL:stderr = subprocess.PIPEkwargs: dict = build_subprocess_kwargs(cwd, env, stderr=stderr)rcc_location = str(s...
2
14
5
91
0
54
70
54
self,cwd,env,args,stderr
[]
Tuple[list, dict]
{"AnnAssign": 1, "Assign": 3, "If": 1, "Return": 1}
2
17
2
["build_subprocess_kwargs", "str"]
0
[]
The function (_compute_launch_args_and_kwargs) defined within the public class called Rcc, that inherit another class.The function start at line 54 and ends at 70. It contains 14 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [54.0] and does not return any value. It declare...
Sema4AI_actions
public
public
0
0
_run_rcc.on_output
def on_output(content):try:sys.stderr.buffer.write(content)except BaseException:log.exception("Error reporting interactive output.")
2
5
1
26
0
130
134
130
null
[]
None
null
0
0
0
null
0
null
The function (_run_rcc.on_output) defined within the public class called public.The function start at line 130 and ends at 134. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Sema4AI_actions
Rcc
public
0
1
_run_rcc
def _run_rcc(self,args: List[str],timeout: float = 35,error_msg: str = "",mutex_name=None,cwd: Optional[str] = None,log_errors=True,stderr=Sentinel.SENTINEL,show_interactive_output: bool = False,hide_in_log: Optional[str] = None,) -> RCCActionResult:"""Returns an ActionResult where the result is the stdout of the execu...
23
94
10
551
0
72
204
72
self,args,timeout,error_msg,mutex_name,cwd,log_errors,stderr,show_interactive_output,hide_in_log
[]
RCCActionResult
{"AnnAssign": 1, "Assign": 23, "Expr": 17, "If": 14, "Return": 5, "Try": 2, "With": 1}
38
133
38
["self._compute_env", "env.get", "self._compute_launch_args_and_kwargs", "list2cmdline", "str", "timed_acquire_mutex", "msg.replace", "log.debug", "time.monotonic", "check_output", "sys.stderr.buffer.write", "log.exception", "check_output_interactive", "as_str", "as_str", "msg.replace", "log.exception", "RCCActionResul...
0
[]
The function (_run_rcc) defined within the public class called Rcc, that inherit another class.The function start at line 72 and ends at 204. It contains 94 lines of code and it has a cyclomatic complexity of 23. It takes 10 parameters, represented as [72.0] and does not return any value. It declares 38.0 functions, an...
Sema4AI_actions
Rcc
public
0
1
get_package_yaml_hash
def get_package_yaml_hash(self, package_yaml: Path, devenv: bool) -> str:args: list[str] = ["ht", "hash"]args.append(str(package_yaml))args.extend("--silent --no-temp-management --warranty-voided".split())if devenv:args.append("--devdeps")result = self._run_rcc(args)if result.success:if not result.result:raise RuntimeE...
4
16
3
94
0
206
223
206
self,package_yaml,devenv
[]
str
{"AnnAssign": 1, "Assign": 1, "Expr": 3, "If": 3, "Return": 1}
9
18
9
["args.append", "str", "args.extend", "split", "args.append", "self._run_rcc", "RuntimeError", "result.result.strip", "RuntimeError"]
0
[]
The function (get_package_yaml_hash) defined within the public class called Rcc, that inherit another class.The function start at line 206 and ends at 223. It contains 16 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [206.0] and does not return any value. It declares 9.0 f...
Sema4AI_actions
Rcc
public
0
1
create_env_and_get_vars
def create_env_and_get_vars(self, datadir: Path, package_yaml: Path, package_yaml_hash: str, devenv: bool) -> ActionResult[EnvInfo]:"""Creates the environment if needed. Note: this function needs to becareful so that it doesn't call `_create_env_and_get_vars` unlessthe environment file really changed, as that will buil...
7
39
5
224
0
225
274
225
self,datadir,package_yaml,package_yaml_hash,devenv
[]
ActionResult[EnvInfo]
{"Assign": 9, "Expr": 4, "If": 4, "Return": 3, "Try": 1}
16
50
16
["env_info_dir.mkdir", "env_info_cache_file.exists", "env_info_cache_file.read_text", "json.loads", "self._get_curr_time_as_str", "EnvInfo", "env_info.env.get", "os.path.exists", "os.remove", "ActionResult", "ActionResult", "self._create_env_and_get_vars", "isinstance", "self._get_curr_time_as_str", "env_info_cache_fil...
0
[]
The function (create_env_and_get_vars) defined within the public class called Rcc, that inherit another class.The function start at line 225 and ends at 274. It contains 39 lines of code and it has a cyclomatic complexity of 7. It takes 5 parameters, represented as [225.0] and does not return any value. It declares 16....
Sema4AI_actions
Rcc
public
0
1
_get_curr_time_as_str
def _get_curr_time_as_str(self):from datetime import datetimereturn datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f%Z")
1
3
1
20
0
276
279
276
self
[]
Returns
{"Return": 1}
2
4
2
["strftime", "datetime.now"]
0
[]
The function (_get_curr_time_as_str) defined within the public class called Rcc, that inherit another class.The function start at line 276 and ends at 279. It contains 3 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 2.0 fu...
Sema4AI_actions
public
public
0
0
_create_env_and_get_vars.return_failure
def return_failure(msg: Optional[str]) -> ActionResult[EnvInfo]:log.critical(("Unable to create environment from:\n%s\n""To recreate the environment, please fix the related package.yaml"),package_yaml,)if not msg:msg = "<unknown reason>"log.critical(msg)action_result: ActionResult[EnvInfo] = ActionResult(False, msg, No...
2
13
1
57
0
311
324
311
null
[]
None
null
0
0
0
null
0
null
The function (_create_env_and_get_vars.return_failure) defined within the public class called public.The function start at line 311 and ends at 324. It contains 13 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Sema4AI_actions
Rcc
public
0
1
_create_env_and_get_vars
def _create_env_and_get_vars(self, package_yaml: Path, package_yaml_hash: str, devenv: bool) -> ActionResult[EnvInfo]:""" """args = ["holotree","variables","--space",package_yaml_hash,str(package_yaml),]self._add_config_to_args(args)args.append("--json")args.append("--no-retry-build")args.append("--no-pyc-management")i...
9
45
4
249
0
281
348
281
self,package_yaml,package_yaml_hash,devenv
[]
ActionResult[EnvInfo]
{"AnnAssign": 2, "Assign": 10, "Expr": 9, "For": 1, "If": 8, "Return": 6}
22
68
22
["str", "self._add_config_to_args", "args.append", "args.append", "args.append", "os.getenv", "args.append", "args.append", "self._run_rcc", "str", "log.critical", "log.critical", "ActionResult", "return_failure", "return_failure", "json.loads", "str", "str", "return_failure", "return_failure", "ActionResult", "EnvInfo...
0
[]
The function (_create_env_and_get_vars) defined within the public class called Rcc, that inherit another class.The function start at line 281 and ends at 348. It contains 45 lines of code and it has a cyclomatic complexity of 9. It takes 4 parameters, represented as [281.0] and does not return any value. It declares 22...
Sema4AI_actions
Rcc
public
0
1
pull
def pull(self, url: str, directory: str) -> ActionResult[str]:args = ["pull", url, "--directory", directory]ret = self._run_rcc(args, mutex_name=RCC_CLOUD_ROBOT_MUTEX_NAME)if not ret.success:return ActionResult(False, ret.message, None)return ActionResult(True, None, ret.result)
2
6
3
69
0
350
355
350
self,url,directory
[]
ActionResult[str]
{"Assign": 2, "If": 1, "Return": 2}
3
6
3
["self._run_rcc", "ActionResult", "ActionResult"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3646985_mgaitan_waliki.waliki.git.views_py.webhook_pull", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95357388_basswood_io_BasswoodAV.bv.filter.graph_py.Graph.pull", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Cr...
The function (pull) defined within the public class called Rcc, that inherit another class.The function start at line 350 and ends at 355. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [350.0] and does not return any value. It declares 3.0 functions, It has 3...
Sema4AI_actions
Rcc
public
0
1
_add_config_to_args
def _add_config_to_args(self, args: List[str]) -> List[str]:config_location = self.config_locationif config_location:args.append("--config")args.append(config_location)return args
2
6
2
39
0
357
362
357
self,args
[]
List[str]
{"Assign": 1, "Expr": 2, "If": 1, "Return": 1}
2
6
2
["args.append", "args.append"]
0
[]
The function (_add_config_to_args) defined within the public class called Rcc, that inherit another class.The function start at line 357 and ends at 362. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [357.0] and does not return any value. It declares 2.0 func...
Sema4AI_actions
Rcc
public
0
1
feedack_metric
def feedack_metric(self, name, value="+1") -> None:env = self._compute_env()args = ["feedback", "metric", "-t", "action-server", "-n", name, "-v", value]self._add_config_to_args(args)cwd = Noneargs, kwargs = self._compute_launch_args_and_kwargs(cwd, env, args)try:subprocess.Popen(args, **kwargs)except BaseException:log...
2
10
3
82
0
364
374
364
self,name,value
[]
None
{"Assign": 4, "Expr": 3, "Try": 1}
5
11
5
["self._compute_env", "self._add_config_to_args", "self._compute_launch_args_and_kwargs", "subprocess.Popen", "log.exception"]
0
[]
The function (feedack_metric) defined within the public class called Rcc, that inherit another class.The function start at line 364 and ends at 374. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [364.0] and does not return any value. It declares 5.0 function...
Sema4AI_actions
Rcc
public
0
1
clean_tools_caches
def clean_tools_caches(self):args = ["config", "cleanup", "--caches"]self._add_config_to_args(args)self._run_rcc(args, timeout=600, show_interactive_output=True)
1
4
1
34
0
376
379
376
self
[]
None
{"Assign": 1, "Expr": 2}
2
4
2
["self._add_config_to_args", "self._run_rcc"]
0
[]
The function (clean_tools_caches) defined within the public class called Rcc, that inherit another class.The function start at line 376 and ends at 379. 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...
Sema4AI_actions
Rcc
public
0
1
get_network_settings
def get_network_settings(self) -> ActionResult:args = ["config", "settings", "--json"]return self._run_rcc(args)
1
3
1
23
0
381
383
381
self
[]
ActionResult
{"Assign": 1, "Return": 1}
1
3
1
["self._run_rcc"]
0
[]
The function (get_network_settings) defined within the public class called Rcc, that inherit another class.The function start at line 381 and ends at 383. 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...
Sema4AI_actions
public
public
0
0
initialize_rcc
def initialize_rcc(rcc_location: Path, sema4ai_home: Optional[Path]) -> Iterator[Rcc]:global _rccif _rcc:yield _rccreturnrcc = Rcc(rcc_location, sema4ai_home)_rcc = rcctry:yield rccfinally:_rcc = None
3
11
2
47
2
390
402
390
rcc_location,sema4ai_home
['_rcc', 'rcc']
Iterator[Rcc]
{"Assign": 3, "Expr": 2, "If": 1, "Return": 1, "Try": 1}
1
13
1
["Rcc"]
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 (initialize_rcc) defined within the public class called public.The function start at line 390 and ends at 402. It contains 11 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [390.0] and does not return any value. It declare 1.0 function, It has 1.0 function call...
Sema4AI_actions
public
public
0
0
get_rcc
def get_rcc() -> Rcc:assert _rcc is not None, "RCC not initialized"return _rcc
1
3
0
15
0
405
407
405
[]
Rcc
{"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._action_package_handler_py.ActionPackageHandler.bootstrap_environment"]
The function (get_rcc) defined within the public class called public.The function start at line 405 and ends at 407. 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 which is ["_.conten...
Sema4AI_actions
RunRuntimeInfo
public
0
0
__init__
def __init__(self, run_id: str):from sema4ai.action_server._robo_utils.callback import Callbackself._run_id = run_idself._canceled = Falseself.on_cancel = Callback()
1
5
2
36
0
30
35
30
self,run_id
[]
None
{"Assign": 3}
1
6
1
["Callback"]
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 RunRuntimeInfo.The function start at line 30 and ends at 35. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [30.0] and does not return any value. It declare 1.0 function, It has 1.0 function called...
Sema4AI_actions
RunRuntimeInfo
public
0
0
cancel
def cancel(self):self._canceled = Trueif not len(self.on_cancel):log.info(f"No listeners registered during run {self._run_id} cancellation (this means that it is still in the not run state).")self.on_cancel()# Notify all listeners that the run was canceled.
2
7
1
31
0
37
45
37
self
[]
None
{"Assign": 1, "Expr": 2, "If": 1}
3
9
3
["len", "log.info", "self.on_cancel"]
7
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3687273_internap_netman.netman.core.switch_sessions_py.SwitchSessionManager._stop_timer", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3929643_esphome_aioesphomeapi.tests.test_client_py.test_bluetooth_device_connec...
The function (cancel) defined within the public class called RunRuntimeInfo.The function start at line 37 and ends at 45. 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 i...
Sema4AI_actions
RunRuntimeInfo
public
0
0
is_canceled
def is_canceled(self) -> bool:return self._canceled
1
2
1
11
0
47
48
47
self
[]
bool
{"Return": 1}
0
2
0
[]
0
[]
The function (is_canceled) defined within the public class called RunRuntimeInfo.The function start at line 47 and ends at 48. 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
RunRuntimeInfo
public
0
0
__init__
def __init__(self, db: "Database"):# Clients that want to register/unregister must use this semaphore# to avoid racing conditions.## This is done because the expected scenario is the following:# 1. The client acquires this semaphore# 2. then notifies about existing# 3. then registers so that it knows about new runs in ...
1
5
2
50
0
52
73
52
self,run_id
[]
None
{"Assign": 3}
1
6
1
["Callback"]
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 RunRuntimeInfo.The function start at line 52 and ends at 73. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [52.0] and does not return any value. It declare 1.0 function, It has 1.0 function called...
Sema4AI_actions
RunsState
public
0
0
get_current_run_state
def get_current_run_state(self, offset: int = 0, limit: int = 200) -> list["Run"]:from ._database import Databasefrom ._models import Runassert (self.semaphore._value == 0), "Clients getting the current run state must acquire the semaphore."db: Database = self._dbwith db.connect():return self._db.all(Run, offset=offset...
1
11
3
79
0
75
87
75
self,offset,limit
[]
list['Run']
{"AnnAssign": 1, "Return": 1, "With": 1}
2
13
2
["db.connect", "self._db.all"]
0
[]
The function (get_current_run_state) defined within the public class called RunsState.The function start at line 75 and ends at 87. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [75.0] and does not return any value. It declares 2.0 functions, and It has 2.0...
Sema4AI_actions
RunsState
public
0
0
get_run_from_id
def get_run_from_id(self, run_id: str) -> "Run":"""Returns the run associated with the run id (or throws a KeyError if not found)."""assert run_id, "Run id cannot be empty."from ._database import Databasefrom ._models import Runassert (self.semaphore._value == 0), "Clients getting the current run state must acquire the...
1
10
2
65
0
89
103
89
self,run_id
[]
'Run'
{"AnnAssign": 1, "Expr": 1, "Return": 1, "With": 1}
2
15
2
["db.connect", "db.first"]
0
[]
The function (get_run_from_id) defined within the public class called RunsState.The function start at line 89 and ends at 103. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [89.0] and does not return any value. It declares 2.0 functions, and It has 2.0 func...
Sema4AI_actions
RunsState
public
0
0
get_run_from_request_id
def get_run_from_request_id(self, request_id: str) -> "Run":"""Returns the run associated with the request id (or throws a KeyError if not found)."""assert request_id, "Request id cannot be empty."from ._database import Databasefrom ._models import Runassert (self.semaphore._value == 0), "Clients getting the current ru...
1
10
2
65
0
105
119
105
self,request_id
[]
'Run'
{"AnnAssign": 1, "Expr": 1, "Return": 1, "With": 1}
2
15
2
["db.connect", "db.first"]
0
[]
The function (get_run_from_request_id) defined within the public class called RunsState.The function start at line 105 and ends at 119. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [105.0] and does not return any value. It declares 2.0 functions, and It ha...
Sema4AI_actions
RunsState
public
0
0
register
def register(self, listener):assert (self.semaphore._value == 0), "Clients registering must acquire the semaphore."self._run_listeners[listener] = 1
1
5
2
27
0
121
125
121
self,listener
[]
None
{"Assign": 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 RunsState.The function start at line 121 and ends at 125. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [121.0] and does not return any value. It has 904.0 functions calling this function which ar...
Sema4AI_actions
RunsState
public
0
0
unregister
def unregister(self, listener):assert (self.semaphore._value == 0), "Clients unregistering must acquire the semaphore."self._run_listeners.pop(listener, None)
1
5
2
29
0
127
131
127
self,listener
[]
None
{"Expr": 1}
1
5
1
["self._run_listeners.pop"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.actions.src.sema4ai.actions._hooks_py.SessionCallback.unregister"]
The function (unregister) defined within the public class called RunsState.The function start at line 127 and ends at 131. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [127.0] and does not return any value. It declare 1.0 function, It has 1.0 function called...
Sema4AI_actions
RunsState
public
0
0
on_run_inserted
def on_run_inserted(self, run: "Run"):# Semaphore is acquired internally in this case.from ._models import Runrun_copy = Run(**asdict(run))with self.semaphore:for listener in self._run_listeners.keys():listener(RunChangeEvent("added", run_copy))
2
6
2
49
0
133
140
133
self,run
[]
None
{"Assign": 1, "Expr": 1, "For": 1, "With": 1}
5
8
5
["Run", "asdict", "self._run_listeners.keys", "listener", "RunChangeEvent"]
0
[]
The function (on_run_inserted) defined within the public class called RunsState.The function start at line 133 and ends at 140. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [133.0] and does not return any value. It declares 5.0 functions, and It has 5.0 fun...
Sema4AI_actions
RunsState
public
0
0
create_run_runtime_info
def create_run_runtime_info(self, run_id: str) -> RunRuntimeInfo:"""Creates the runtime info for a run and returns it."""runtime_info = RunRuntimeInfo(run_id)assert run_id not in self._run_id_to_runtime_infoself._run_id_to_runtime_info[run_id] = runtime_inforeturn runtime_info
1
5
2
35
0
142
149
142
self,run_id
[]
RunRuntimeInfo
{"Assign": 2, "Expr": 1, "Return": 1}
1
8
1
["RunRuntimeInfo"]
0
[]
The function (create_run_runtime_info) defined within the public class called RunsState.The function start at line 142 and ends at 149. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [142.0] and does not return any value. It declare 1.0 function, and It has 1...
Sema4AI_actions
RunsState
public
0
0
on_run_changed
def on_run_changed(self, run: "Run", changes: Dict[str, Any]):from sema4ai.action_server._models import RunStatus# Semaphore is acquired internally in this case.from ._models import Runrun_copy = Run(**asdict(run))with self.semaphore:for listener in self._run_listeners.keys():listener(RunChangeEvent("changed", run_copy...
3
9
3
96
0
151
164
151
self,run,changes
[]
None
{"Assign": 1, "Expr": 2, "For": 1, "If": 1, "With": 1}
6
14
6
["Run", "asdict", "self._run_listeners.keys", "listener", "RunChangeEvent", "self._run_id_to_runtime_info.pop"]
0
[]
The function (on_run_changed) defined within the public class called RunsState.The function start at line 151 and ends at 164. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [151.0] and does not return any value. It declares 6.0 functions, and It has 6.0 func...
Sema4AI_actions
RunsState
public
0
0
cancel_run
def cancel_run(self, run_id: str) -> bool:"""Cancels a run.Args:run_id: The ID of the run to cancel.Returns:True if the run was canceled, False otherwise (if the run was not running)."""with self.semaphore:runtime_info = self._run_id_to_runtime_info.get(run_id)if runtime_info is not None:log.info(f"Cancelling run {run_...
2
9
2
56
0
166
184
166
self,run_id
[]
bool
{"Assign": 1, "Expr": 4, "If": 1, "Return": 2, "With": 1}
4
19
4
["self._run_id_to_runtime_info.get", "log.info", "runtime_info.cancel", "log.info"]
0
[]
The function (cancel_run) defined within the public class called RunsState.The function start at line 166 and ends at 184. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [166.0] and does not return any value. It declares 4.0 functions, and It has 4.0 function...
Sema4AI_actions
public
public
0
0
use_runs_state_ctx
def use_runs_state_ctx(db: "Database"):global _runs_state_runs_state = RunsState(db)try:yield _runs_statefinally:pass_runs_state = None
2
8
1
25
1
191
198
191
db
['_runs_state']
None
{"Assign": 2, "Expr": 1, "Try": 1}
1
8
1
["RunsState"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._command_requiring_datadir"]
The function (use_runs_state_ctx) defined within the public class called public.The function start at line 191 and ends at 198. 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 declare 1.0 function, It has 1.0 function calle...
Sema4AI_actions
public
public
0
0
get_global_runs_state
def get_global_runs_state() -> RunsState:assert _runs_statereturn _runs_state
1
3
0
10
0
201
203
201
[]
RunsState
{"Return": 1}
0
3
0
[]
9
["_.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", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.act...
The function (get_global_runs_state) defined within the public class called public.The function start at line 201 and ends at 203. 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 9.0 functions calling this function whic...
Sema4AI_actions
public
public
0
0
is_debugger_active
def is_debugger_active() -> bool:try:import pydevd# type:ignoreexcept ImportError:return Falsereturn bool(pydevd.get_global_debugger())
2
6
0
24
0
25
31
25
[]
bool
{"Return": 2, "Try": 1}
2
7
2
["bool", "pydevd.get_global_debugger"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selftest_py.ActionServerClient._get_default_timeout", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4a...
The function (is_debugger_active) defined within the public class called public.The function start at line 25 and ends at 31. 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 2.0 functions, It has 2.0 functions call...
Sema4AI_actions
ActionServerProcess
public
0
0
__init__
def __init__(self, datadir: Path) -> None:from io import StringIOself._datadir = datadir.absolute()self._process: Optional["Process"] = Noneself._host: str = ""self._port: int = -1self.started: bool = Falseself._stdout = StringIO()self._stderr = StringIO()
1
9
2
70
0
41
50
41
self,datadir
[]
None
{"AnnAssign": 4, "Assign": 3}
3
10
3
["datadir.absolute", "StringIO", "StringIO"]
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 ActionServerProcess.The function start at line 41 and ends at 50. It contains 9 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 3.0 functions, It has 3.0 function...
Sema4AI_actions
ActionServerProcess
public
0
0
datadir
def datadir(self) -> Path:return self._datadir
1
2
1
11
0
53
54
53
self
[]
Path
{"Return": 1}
0
2
0
[]
0
[]
The function (datadir) defined within the public class called ActionServerProcess.The function start at line 53 and ends at 54. 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
ActionServerProcess
public
0
0
host
def host(self) -> str:if not self.started:self.start()assert (self._host), "The action server was not properly started (no host available)"return self._host
2
7
1
30
0
57
64
57
self
[]
str
{"Expr": 1, "If": 1, "Return": 1}
1
8
1
["self.start"]
0
[]
The function (host) defined within the public class called ActionServerProcess.The function start at line 57 and ends at 64. 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 declare 1.0 function, and It has 1.0 function cal...
Sema4AI_actions
ActionServerProcess
public
0
0
port
def port(self) -> int:if not self.started:self.start()assert (self._port > 0), "The action server was not properly started (no port available)"return self._port
2
7
1
32
0
67
74
67
self
[]
int
{"Expr": 1, "If": 1, "Return": 1}
1
8
1
["self.start"]
0
[]
The function (port) defined within the public class called ActionServerProcess.The function start at line 67 and ends at 74. 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 declare 1.0 function, and It has 1.0 function cal...
Sema4AI_actions
ActionServerProcess
public
0
0
process
def process(self) -> "Process":assert (self._process is not None), "The action server was not properly started (process is None)."return self._process
1
5
1
22
0
77
81
77
self
[]
'Process'
{"Return": 1}
0
5
0
[]
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 ActionServerProcess.The function start at line 77 and ends at 81. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 56.0 functions calling this function which ...
Sema4AI_actions
public
public
0
0
start.collect_port_from_stdout
def collect_port_from_stdout(line):# Note: this is called in a thread.matches = re.findall(compiled, line)if matches:host, port = matches[0]future.set_result((host, port))
2
5
1
36
0
165
171
165
null
[]
None
null
0
0
0
null
0
null
The function (start.collect_port_from_stdout) defined within the public class called public.The function start at line 165 and ends at 171. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
start.on_stdout
def on_stdout(line):self._stdout.write(line)if self.SHOW_OUTPUT:sys.stdout.write(f"stdout: {line.rstrip()}\n")
2
4
1
27
0
173
176
173
null
[]
None
null
0
0
0
null
0
null
The function (start.on_stdout) defined within the public class called public.The function start at line 173 and ends at 176. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
start.on_stderr
def on_stderr(line):self._stderr.write(line)# Note: this is called in a thread.sys.stderr.write(f"stderr: {line.rstrip()}\n")
1
3
1
22
0
178
181
178
null
[]
None
null
0
0
0
null
0
null
The function (start.on_stderr) defined within the public class called public.The function start at line 178 and ends at 181. 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..
Sema4AI_actions
ActionServerProcess
public
0
0
start
def start(self,*,timeout: int = 10,db_file=":memory:",actions_sync=False,cwd: Optional[Path | str] = None,add_shutdown_api: bool = False,min_processes: int = 0,max_processes: int = 20,reuse_processes: bool = False,lint: bool = False,additional_args: Optional[list[str]] = None,env: Optional[Dict[str, str]] = None,port=0...
20
103
15
527
0
83
213
83
self,timeout,db_file,actions_sync,cwd,add_shutdown_api,min_processes,max_processes,reuse_processes,lint,additional_args,env,port,verbose,use_https
[]
None
{"AnnAssign": 2, "Assign": 18, "Expr": 15, "If": 18, "Try": 1, "While": 1, "With": 1}
40
131
40
["RuntimeError", "os.path.isfile", "is_frozen", "str", "new_args.append", "new_args.append", "new_args.append", "new_args.append", "new_args.append", "new_args.append", "use_env.update", "Process", "re.compile", "re.compile", "Future", "re.findall", "future.set_result", "self._stdout.write", "sys.stdout.write", "line.r...
136
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.cherrypy.test.test_bus_py.BusMethodTests.test_block", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.cherrypy.test.test_bus_...
The function (start) defined within the public class called ActionServerProcess.The function start at line 83 and ends at 213. It contains 103 lines of code and it has a cyclomatic complexity of 20. It takes 15 parameters, represented as [83.0] and does not return any value. It declares 40.0 functions, It has 40.0 func...
Sema4AI_actions
ActionServerProcess
public
0
0
stop
def stop(self):"""Returns a tuple with stdout/stderr."""if self._process is not None:self._process.stop()self._process = None
2
4
1
26
0
215
221
215
self
[]
None
{"Assign": 1, "Expr": 2, "If": 1}
1
7
1
["self._process.stop"]
35
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3392496_unipitechnology_evok.evok.evok_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3595150_twisted_txaws.txaws.reactor_py.get_exitcode_reactor", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Outp...
The function (stop) defined within the public class called ActionServerProcess.The function start at line 215 and ends at 221. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called...
Sema4AI_actions
ActionServerProcess
public
0
0
get_stdout
def get_stdout(self):return self._stdout.getvalue()
1
2
1
13
0
223
224
223
self
[]
Returns
{"Return": 1}
1
2
1
["self._stdout.getvalue"]
0
[]
The function (get_stdout) defined within the public class called ActionServerProcess.The function start at line 223 and ends at 224. 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 declare 1.0 function, and It has 1.0 ...
Sema4AI_actions
ActionServerProcess
public
0
0
get_stderr
def get_stderr(self):return self._stderr.getvalue()
1
2
1
13
0
226
227
226
self
[]
Returns
{"Return": 1}
1
2
1
["self._stderr.getvalue"]
0
[]
The function (get_stderr) defined within the public class called ActionServerProcess.The function start at line 226 and ends at 227. 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 declare 1.0 function, and It has 1.0 ...
Sema4AI_actions
ActionServerProcess
public
0
0
mcp_client
async def mcp_client(self, connection_mode: Literal["mcp", "sse"], headers: Optional[dict] = None) -> AsyncGenerator[ClientSession, None]:"""Returns a client that can be used to interact with the MCP server.Example:```pythonasync with client.mcp_client("mcp") as session:tools_list = await session.list_tools()print(tool...
3
19
3
119
0
230
262
230
self,connection_mode,headers
[]
AsyncGenerator[ClientSession, None]
{"AnnAssign": 1, "Assign": 4, "Expr": 3, "If": 1}
3
33
3
["client_protocol", "ClientSession", "session.initialize"]
0
[]
The function (mcp_client) defined within the public class called ActionServerProcess.The function start at line 230 and ends at 262. It contains 19 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [230.0] and does not return any value. It declares 3.0 functions, and It has 3...
Sema4AI_actions
ActionServerProcess
public
0
0
__init__
def __init__(self,action_server_process_or_base_url: ActionServerProcess | str,use_https: bool = False,):if isinstance(action_server_process_or_base_url, str):self._base_url = action_server_process_or_base_urlassert not self._base_url.endswith("/")self.action_server_process = Noneelse:self.action_server_process = actio...
2
13
3
63
0
269
281
269
self,datadir
[]
None
{"AnnAssign": 4, "Assign": 3}
3
10
3
["datadir.absolute", "StringIO", "StringIO"]
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 ActionServerProcess.The function start at line 269 and ends at 281. It contains 13 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [269.0] and does not return any value. It declares 3.0 functions, It has 3.0 func...
Sema4AI_actions
ActionServerClient
public
0
0
base_url
def base_url(self):if self._base_url:assert not self.action_server_processreturn self._base_urlhost = self.action_server_process.hostport = self.action_server_process.portif self._use_https:return f"https://{host}:{port}"else:return f"http://{host}:{port}"
3
10
1
46
0
284
294
284
self
[]
Returns
{"Assign": 2, "If": 2, "Return": 3}
0
11
0
[]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70596923_getappmap_appmap_python.appmap.http_py.HTTPConnectionPatch.putrequest", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95178197_gbtami_fairyfishnet.fairyfishnet_py.Worker.job_name"]
The function (base_url) defined within the public class called ActionServerClient.The function start at line 284 and ends at 294. It contains 10 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters, and this function return a value. It has 2.0 functions calling this function ...
Sema4AI_actions
ActionServerClient
public
0
0
build_full_url
def build_full_url(self, url: str) -> str:if url.startswith("/"):url = url[1:]return f"{self.base_url}/{url}"
2
4
2
29
0
296
299
296
self,url
[]
str
{"Assign": 1, "If": 1, "Return": 1}
1
4
1
["url.startswith"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3923647_code4romania_covid_19_ro_help.ro_help.hub.templatetags.social_share_py.social_buttons"]
The function (build_full_url) defined within the public class called ActionServerClient.The function start at line 296 and ends at 299. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [296.0] and does not return any value. It declare 1.0 function, It has 1.0 fu...
Sema4AI_actions
ActionServerClient
public
0
0
requests_kwargs
def requests_kwargs(self) -> dict:"""Provides the default kwargs that should be used for a requests call."""kwargs: dict = dict(timeout=self._get_default_timeout())return kwargs
1
3
1
24
0
301
307
301
self
[]
dict
{"AnnAssign": 1, "Expr": 1, "Return": 1}
2
7
2
["dict", "self._get_default_timeout"]
0
[]
The function (requests_kwargs) defined within the public class called ActionServerClient.The function start at line 301 and ends at 307. 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....
Sema4AI_actions
ActionServerClient
public
0
0
get_str
def get_str(self,url,params: Optional[dict | list[tuple]] = None,headers: Optional[dict] = None,cookies: Optional[dict] = None,) -> str:import sema4ai_httpheaders = headers or {}if cookies:headers["Cookie"] = "; ".join(f"{k}={v}" for k, v in cookies.items())result = sema4ai_http.get(self.build_full_url(url),fields=para...
4
19
5
113
0
309
329
309
self,url,params,headers,cookies
[]
str
{"Assign": 3, "Expr": 1, "If": 1, "Return": 1}
6
21
6
["join", "cookies.items", "sema4ai_http.get", "self.build_full_url", "self.requests_kwargs", "result.raise_for_status"]
0
[]
The function (get_str) defined within the public class called ActionServerClient.The function start at line 309 and ends at 329. It contains 19 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [309.0] and does not return any value. It declares 6.0 functions, and It has 6.0 f...
Sema4AI_actions
ActionServerClient
public
0
0
_get_default_timeout
def _get_default_timeout(self) -> Optional[int]:if is_debugger_active():return Nonereturn 10
2
4
1
19
0
331
334
331
self
[]
Optional[int]
{"If": 1, "Return": 2}
1
4
1
["is_debugger_active"]
0
[]
The function (_get_default_timeout) defined within the public class called ActionServerClient.The function start at line 331 and ends at 334. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has...
Sema4AI_actions
ActionServerClient
public
0
0
get_openapi_json
def get_openapi_json(self, params: Optional[dict] = None):return self.get_str("openapi.json", params=params)
1
2
2
25
0
336
337
336
self,params
[]
Returns
{"Return": 1}
1
2
1
["self.get_str"]
0
[]
The function (get_openapi_json) defined within the public class called ActionServerClient.The function start at line 336 and ends at 337. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [336.0], and this function return a value. It declare 1.0 function, and It...
Sema4AI_actions
ActionServerClient
public
0
0
get_json
def get_json(self,url,params: Optional[dict | list[tuple]] = None,headers: Optional[dict] = None,cookies: Optional[dict] = None,):contents = self.get_str(url, params=params, headers=headers, cookies=cookies)try:return json.loads(contents)except Exception:raise AssertionError(f"Unable to load: {contents!r}")
2
12
5
78
0
339
350
339
self,url,params,headers,cookies
[]
Returns
{"Assign": 1, "Return": 1, "Try": 1}
3
12
3
["self.get_str", "json.loads", "AssertionError"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3599349_djc_couchdb_python.couchdb.client_py.Database.__getitem__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3599349_djc_couchdb_python.couchdb.client_py.Database.get", "_.content.gdrive.MyDrive.Phd_Thesis.Data...
The function (get_json) defined within the public class called ActionServerClient.The function start at line 339 and ends at 350. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [339.0], and this function return a value. It declares 3.0 functions, It has 3.0 f...
Sema4AI_actions
ActionServerClient
public
0
0
post_get_str
def post_get_str(self,url,data,headers: Optional[dict] = None,cookies: Optional[dict] = None,params: Optional[dict] = None,):result = self.post_get_response(url, data, headers, cookies, params)result.raise_for_status()return result.text
1
11
6
62
0
352
362
352
self,url,data,headers,cookies,params
[]
Returns
{"Assign": 1, "Expr": 1, "Return": 1}
2
11
2
["self.post_get_response", "result.raise_for_status"]
0
[]
The function (post_get_str) defined within the public class called ActionServerClient.The function start at line 352 and ends at 362. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [352.0], and this function return a value. It declares 2.0 functions, and It ...
Sema4AI_actions
ActionServerClient
public
0
0
post_get_response
def post_get_response(self,url,data,headers: Optional[dict] = None,cookies: Optional[dict] = None,params: Optional[dict] = None,):import sema4ai_httpheaders = headers or {}if cookies:headers["Cookie"] = "; ".join(f"{k}={v}" for k, v in cookies.items())result = sema4ai_http.post(self.build_full_url(url),headers=headers,...
4
21
6
110
0
364
386
364
self,url,data,headers,cookies,params
[]
Returns
{"Assign": 3, "Expr": 1, "If": 1, "Return": 1}
6
23
6
["join", "cookies.items", "sema4ai_http.post", "self.build_full_url", "self.requests_kwargs", "result.raise_for_status"]
0
[]
The function (post_get_response) defined within the public class called ActionServerClient.The function start at line 364 and ends at 386. It contains 21 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [364.0], and this function return a value. It declares 6.0 functions, and...
Sema4AI_actions
ActionServerClient
public
0
0
get_get_response
def get_get_response(self,url,data,headers: Optional[dict] = None,cookies: Optional[dict] = None,params: Optional[dict] = None,):import sema4ai_httpheaders = headers or {}if cookies:headers["Cookie"] = "; ".join(f"{k}={v}" for k, v in cookies.items())result = sema4ai_http.get(self.build_full_url(url),headers=headers,js...
4
21
6
110
0
388
410
388
self,url,data,headers,cookies,params
[]
Returns
{"Assign": 3, "Expr": 1, "If": 1, "Return": 1}
6
23
6
["join", "cookies.items", "sema4ai_http.get", "self.build_full_url", "self.requests_kwargs", "result.raise_for_status"]
0
[]
The function (get_get_response) defined within the public class called ActionServerClient.The function start at line 388 and ends at 410. It contains 21 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [388.0], and this function return a value. It declares 6.0 functions, and ...
Sema4AI_actions
ActionServerClient
public
0
0
post_error
def post_error(self, url, status_code, data=None, headers=None):import sema4ai_httpresult = sema4ai_http.post(self.build_full_url(url),json=data or {},headers=headers or {},**self.requests_kwargs(),)if result.status_code != status_code:raise AssertionError((f"Expected: {status_code}.\n"f"Found: {result.status_code}\n"f...
4
17
5
75
0
412
429
412
self,url,status_code,data,headers
[]
Returns
{"Assign": 1, "If": 1, "Return": 1}
4
18
4
["sema4ai_http.post", "self.build_full_url", "self.requests_kwargs", "AssertionError"]
0
[]
The function (post_error) defined within the public class called ActionServerClient.The function start at line 412 and ends at 429. It contains 17 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [412.0], and this function return a value. It declares 4.0 functions, and It ha...
Sema4AI_actions
ActionServerClient
public
0
0
get_error
def get_error(self, url, status_code):import sema4ai_httpresult = sema4ai_http.get(self.build_full_url(url),**self.requests_kwargs(),)assert result.status_code == status_code
1
7
3
38
0
431
438
431
self,url,status_code
[]
None
{"Assign": 1}
3
8
3
["sema4ai_http.get", "self.build_full_url", "self.requests_kwargs"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3719354_databiosphere_dsub.dsub.providers.google_v2_operations_py.is_canceled", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3719354_databiosphere_dsub.dsub.providers.google_v2_operations_py.is_failed", "_.content....
The function (get_error) defined within the public class called ActionServerClient.The function start at line 431 and ends at 438. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [431.0] and does not return any value. It declares 3.0 functions, It has 3.0 funct...
Sema4AI_actions
public
public
0
0
sema4ai_action_server_run
def sema4ai_action_server_run(cmdline,returncode: Optional[Union[Literal["error"], int]],cwd=None,additional_env: Optional[Dict[str, str]] = None,timeout=None,capture_output=True,) -> CompletedProcess:from sema4ai.action_server._settings import is_frozenfor entry in cmdline:if entry is None:raise RuntimeError(f"Unable ...
6
41
6
167
2
441
485
441
cmdline,returncode,cwd,additional_env,timeout,capture_output
['base_args', 'executable']
CompletedProcess
{"Assign": 3, "For": 1, "If": 3, "Return": 2}
5
45
5
["RuntimeError", "is_frozen", "os.path.isfile", "run_command_line", "run_python_module"]
34
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selftest_py.check_new_template", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server.api_p...
The function (sema4ai_action_server_run) defined within the public class called public.The function start at line 441 and ends at 485. It contains 41 lines of code and it has a cyclomatic complexity of 6. It takes 6 parameters, represented as [441.0] and does not return any value. It declares 5.0 functions, It has 5.0 ...
Sema4AI_actions
public
public
0
0
run_python_module
def run_python_module(python_module: str,cmdline,returncode: Optional[Union[Literal["error"], int]],cwd=None,additional_env: Optional[Dict[str, str]] = None,timeout=None,capture_output=True,) -> CompletedProcess:return run_command_line([sys.executable, "-m", python_module] + cmdline,returncode=returncode,cwd=cwd,additi...
1
17
7
89
0
488
504
488
python_module,cmdline,returncode,cwd,additional_env,timeout,capture_output
[]
CompletedProcess
{"Return": 1}
1
17
1
["run_command_line"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selftest_py.sema4ai_action_server_run"]
The function (run_python_module) defined within the public class called public.The function start at line 488 and ends at 504. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [488.0] and does not return any value. It declare 1.0 function, It has 1.0 function c...
Sema4AI_actions
public
public
0
0
run_command_line
def run_command_line(cmdline,returncode: Optional[Union[Literal["error"], int]],cwd=None,additional_env: Optional[Dict[str, str]] = None,timeout=None,capture_output=True,) -> CompletedProcess:cp = os.environ.copy()cp["PYTHONPATH"] = os.pathsep.join([x for x in sys.path if x])cp["PYTHONIOENCODING"] = "utf-8"if additiona...
8
30
6
162
2
507
553
507
cmdline,returncode,cwd,additional_env,timeout,capture_output
['result', 'cp']
CompletedProcess
{"Assign": 4, "Expr": 1, "If": 4, "Return": 3}
5
47
5
["os.environ.copy", "os.pathsep.join", "cp.update", "subprocess.run", "AssertionError"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selftest_py.run_python_module", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selft...
The function (run_command_line) defined within the public class called public.The function start at line 507 and ends at 553. It contains 30 lines of code and it has a cyclomatic complexity of 8. It takes 6 parameters, represented as [507.0] and does not return any value. It declares 5.0 functions, It has 5.0 functions...
Sema4AI_actions
public
public
0
0
check_secrets_simple
def check_secrets_simple(tmpdir: Path,action_server_process: ActionServerProcess,client: ActionServerClient,verbose: bool = False,):from sema4ai.action_server._settings import is_frozencurdir = os.path.abspath(".")try:os.chdir(str(tmpdir))if verbose:print(f"is_frozen(): {is_frozen()}")print(f"Creating template project ...
5
95
4
287
9
556
672
556
tmpdir,action_server_process,client,verbose
['action', 'env', 'contents_with_encryption', 'curdir', 'found', 'package_yaml', 'ctx_info', 'keys', 'check_secrets']
None
{"Assign": 9, "Expr": 9, "If": 2, "Try": 1}
22
117
22
["os.path.abspath", "os.chdir", "str", "print", "is_frozen", "print", "check_secrets.mkdir", "package_yaml.write_text", "action.write_text", "AESGCM.generate_key", "AESGCM.generate_key", "dict", "json.dumps", "json.dumps", "decode", "base64.b64encode", "action_server_process.start", "make_encrypted_data_envelope", "cli...
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selftest_py.do_selftest", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_server_...
The function (check_secrets_simple) defined within the public class called public.The function start at line 556 and ends at 672. It contains 95 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [556.0] and does not return any value. It declares 22.0 functions, It has 22.0 fun...
Sema4AI_actions
public
public
0
0
check_new_template
def check_new_template(tmpdir: Path,action_server_process: ActionServerProcess,client: ActionServerClient,verbose: bool = False,) -> None:from sema4ai.action_server._settings import is_frozencurdir = os.path.abspath(".")try:os.chdir(str(tmpdir))if verbose:print(f"is_frozen(): {is_frozen()}")print(f"Creating template pr...
11
58
4
337
13
675
746
675
tmpdir,action_server_process,client,verbose
['my_project_package_yaml', 'output', 'action_package', 'paths', 'action_packages', 'curdir', 'open_api', 'run_path', 'found', 'actions', 'action_names', 'decoded', 'my_project_dir']
None
{"Assign": 13, "Expr": 13, "If": 8, "Try": 1}
37
72
37
["os.path.abspath", "os.chdir", "str", "print", "is_frozen", "print", "sema4ai_action_server_run", "str", "print", "print", "print", "my_project_dir.exists", "print", "my_project_package_yaml.exists", "my_project_package_yaml.exists", "RuntimeError", "print", "action_server_process.start", "str", "print", "client.get_j...
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selftest_py.do_selftest", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_cli_py....
The function (check_new_template) defined within the public class called public.The function start at line 675 and ends at 746. It contains 58 lines of code and it has a cyclomatic complexity of 11. It takes 4 parameters, represented as [675.0] and does not return any value. It declares 37.0 functions, It has 37.0 func...
Sema4AI_actions
public
public
0
0
make_tmpdir
def make_tmpdir() -> Iterator[Path]:import shutilimport tempfiletemp_dir = tempfile.mkdtemp()try:yield Path(temp_dir)finally:retry = 4for i in range(retry):try:shutil.rmtree(temp_dir)breakexcept Exception:# It's possible that the process takes a bit longer to cleanup,# so, wait a bit and retry.time.sleep(0.4)if i == re...
5
16
0
68
2
750
768
750
['retry', 'temp_dir']
Iterator[Path]
{"Assign": 2, "Expr": 3, "For": 1, "If": 1, "Try": 2}
5
19
5
["tempfile.mkdtemp", "Path", "range", "shutil.rmtree", "time.sleep"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selftest_py.do_selftest"]
The function (make_tmpdir) defined within the public class called public.The function start at line 750 and ends at 768. It contains 16 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 5.0 functions, It has 5.0 functions called i...
Sema4AI_actions
public
public
0
0
make_action_server_process
def make_action_server_process(tmpdir: Path) -> Iterator[ActionServerProcess]:action_server_datadir = tmpdir / ".sema4ai-test-action-server"ret = ActionServerProcess(action_server_datadir)try:yield retfinally:ret.stop()
2
7
1
34
2
772
778
772
tmpdir
['ret', 'action_server_datadir']
Iterator[ActionServerProcess]
{"Assign": 2, "Expr": 2, "Try": 1}
2
7
2
["ActionServerProcess", "ret.stop"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selftest_py.do_selftest"]
The function (make_action_server_process) defined within the public class called public.The function start at line 772 and ends at 778. 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 2.0 functions, It has 2.0 func...
Sema4AI_actions
public
public
0
0
make_client
def make_client(action_server_process: ActionServerProcess,) -> Iterator[ActionServerClient]:yield ActionServerClient(action_server_process)
1
4
1
18
0
782
785
782
action_server_process
[]
Iterator[ActionServerClient]
{"Expr": 1}
1
4
1
["ActionServerClient"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selftest_py.do_selftest"]
The function (make_client) defined within the public class called public.The function start at line 782 and ends at 785. 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, It has 1.0 function called insid...
Sema4AI_actions
public
public
0
0
do_selftest
def do_selftest():print(f"Running selftest on python: {sys.version}")retcode = 0from sema4ai.action_server._download_rcc import get_default_rcc_locationrcc_location = get_default_rcc_location()assert rcc_location.exists(), f"Expected rcc to be available in: {rcc_location}."print(f"Permissions for: {rcc_location}: {oct(...
4
31
0
159
2
788
824
788
['retcode', 'rcc_location']
Returns
{"Assign": 3, "Expr": 8, "If": 2, "Return": 1, "Try": 1, "With": 5}
20
37
20
["print", "get_default_rcc_location", "rcc_location.exists", "print", "oct", "os.stat", "os.access", "str", "AssertionError", "make_tmpdir", "make_action_server_process", "make_client", "check_new_template", "make_action_server_process", "make_client", "check_secrets_simple", "print", "traceback.print_exc", "print", "p...
0
[]
The function (do_selftest) defined within the public class called public.The function start at line 788 and ends at 824. It contains 31 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters, and this function return a value. It declares 20.0 functions, and It has 20.0 functio...
Sema4AI_actions
public
public
0
0
start_server.verify_api_key
def verify_api_key(token: HTTPAuthorizationCredentials = Security(HTTPBearer(auto_error=True)),) -> HTTPAuthorizationCredentials:if token.credentials != api_key:raise HTTPException(status_code=403,detail="Invalid or missing API Key",)else:return token
2
10
1
43
0
79
88
79
null
[]
None
null
0
0
0
null
0
null
The function (start_server.verify_api_key) defined within the public class called public.The function start at line 79 and ends at 88. 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..
Sema4AI_actions
public
public
0
0
start_server.shutdown
def shutdown(timeout: int = -1):# Note: timeout no longer used (the timeout to kill is# now handled by the timeout_graceful_shutdown parameter# of uvicorn.Config).import _thread_thread.interrupt_main()
1
3
1
17
0
101
107
101
null
[]
None
null
0
0
0
null
0
null
The function (start_server.shutdown) defined within the public class called public.The function start at line 101 and ends at 107. 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..
Sema4AI_actions
public
public
0
0
start_server.get_static_config_data
def get_static_config_data() -> dict[str, Any]:"""This information is not expected to be changed after the actionserver is started."""from sema4ai.action_server import __version__from ._server_expose import get_expose_session_payload, read_expose_session_jsonpayload = {"expose_url": False,"auth_enabled": False,# When t...
5
24
0
92
0
120
155
120
null
[]
None
null
0
0
0
null
0
null
The function (start_server.get_static_config_data) defined within the public class called public.The function start at line 120 and ends at 155. It contains 24 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
start_server.do_reload
def do_reload(explicit: bool = False) -> bool:"""Internal function to do a reload of the actions.Returns:True if the reload was successful and False otherwise."""from sema4ai.action_server._cli_impl import _import_actionsfrom sema4ai.action_server._models import get_dbfrom sema4ai.action_server._server_websockets impor...
3
31
1
143
0
160
202
160
null
[]
None
null
0
0
0
null
0
null
The function (start_server.do_reload) defined within the public class called public.The function start at line 160 and ends at 202. It contains 31 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
start_server.serve_config
async def serve_config() -> dict[str, Any]:payload = get_static_config_data()# When the mtime changes, this means that the contents# (actions/action packages/expose) may have changed or the# action server was restarted (potentially with different settings).payload["mtime_uuid"] = app.mtime_uuidreturn payload
1
4
0
26
0
210
216
210
null
[]
None
null
0
0
0
null
0
null
The function (start_server.serve_config) defined within the public class called public.The function start at line 210 and ends at 216. 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
public
public
0
0
start_server.serve_log_html
async def serve_log_html(request: Request):from robocorp.log import _index_v3 as indexreturn HTMLResponse(index.FILE_CONTENTS["index.html"])
1
3
1
25
0
218
221
218
null
[]
None
null
0
0
0
null
0
null
The function (start_server.serve_log_html) defined within the public class called public.The function start at line 218 and ends at 221. 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..
Sema4AI_actions
public
public
0
0
start_server._index_contents
def _index_contents(_cache={}) -> bytes:if IN_DEV:# No caching in dev mode_cache.pop("cached", None)try:return _cache["cached"]except KeyError:passimport base64from sema4ai.action_server._storage import get_keyfrom . import __version__, _static_contentsif IN_DEV:# Always reload in dev mode.from importlib import reload_...
4
23
1
113
0
227
259
227
null
[]
None
null
0
0
0
null
0
null
The function (start_server._index_contents) defined within the public class called public.The function start at line 227 and ends at 259. It contains 23 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
start_server.serve_index
async def serve_index(request: Request):from sema4ai.action_server._user_session import session_scopewith session_scope(request) as session:response = HTMLResponse(_index_contents())session.response = responsereturn response
1
6
1
38
0
261
267
261
null
[]
None
null
0
0
0
null
0
null
The function (start_server.serve_index) defined within the public class called public.The function start at line 261 and ends at 267. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
start_server._get_currrent_host
def _get_currrent_host():port = settings.port if settings.port != 0 else Nonehost = settings.addressif port is None:sockets_ipv4 = [s for s in server.servers[0].sockets if s.family == socket.AF_INET]if len(sockets_ipv4) == 0:raise Exception("Unable to find a port to expose")sockname = sockets_ipv4[0].getsockname()# Not...
6
12
0
86
0
288
304
288
null
[]
None
null
0
0
0
null
0
null
The function (start_server._get_currrent_host) defined within the public class called public.The function start at line 288 and ends at 304. It contains 12 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
start_server.expose_later
def expose_later(loop):from sema4ai.action_server._settings import is_frozennonlocal expose_subprocessif not server.started:loop.call_later(1 / 15.0, partial(expose_later, loop))return(host, port) = _get_currrent_host()url = f"{protocol}://{host}:{port}"parent_pid = os.getpid()if is_frozen():# The executable is 'action...
4
33
1
169
0
306
346
306
null
[]
None
null
0
0
0
null
0
null
The function (start_server.expose_later) defined within the public class called public.The function start at line 306 and ends at 346. It contains 33 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
start_server._on_started_message
def _on_started_message(self, **kwargs):(host, port) = _get_currrent_host()url = f"{protocol}://{host}:{port}"settings = get_settings()settings.base_url = urllog.info(colored("\n⚡️ Local MCP endpoint: ", "green", attrs=["bold"])+ colored(f"{url}/mcp", "light_blue"))log.info(colored("\n⚡️ Local Action Server: ", "green"...
4
28
2
153
0
350
382
350
null
[]
None
null
0
0
0
null
0
null
The function (start_server._on_started_message) defined within the public class called public.The function start at line 350 and ends at 382. It contains 28 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [350.0] and does not return any value..
Sema4AI_actions
public
public
0
0
start_server._expose_and_shutdown
async def _expose_and_shutdown(app: FastAPI):import psutilloop = asyncio.get_event_loop()_LoopHolder.loop = loopif expose:log.debug("Exposing action server...")loop.call_later(1 / 15.0, partial(expose_later, loop))else:log.debug("Not exposing action server...")yieldif file_watcher is not None:file_watcher.stop()log.inf...
8
35
1
190
0
385
426
385
null
[]
None
null
0
0
0
null
0
null
The function (start_server._expose_and_shutdown) defined within the public class called public.The function start at line 385 and ends at 426. It contains 35 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
start_server
def start_server(start_args: ArgumentsNamespaceStart,api_key: str | None,expose_session: str | None,before_start: Sequence[IBeforeStartCallback],) -> None:import jsonimport threadingfrom dataclasses import asdictfrom functools import lru_cachefrom typing import Anyimport uvicornfrom fastapi import Depends, HTTPExceptio...
10
104
4
567
37
27
440
27
start_args,api_key,expose_session,before_start
['expose_session_payload', 'protocol', 'parent_pid', 'args', 'expose_pid', 'config', 'index_routes', 'settings_dict', 'port', 'IN_DEV', 'server', 'url', 'loop', 'index_html', '_reload_lock', 'p', '_static_contents', 'expose_subprocess', 'settings_str', 'current_expose_session', 'app', 'env', 'action_routes', 'sockname'...
None
{"AnnAssign": 4, "Assign": 55, "AugAssign": 1, "Expr": 45, "For": 3, "If": 24, "Return": 12, "Try": 3, "With": 3}
111
414
111
["get_settings", "asdict", "join", "settings_dict.items", "log.debug", "get_app", "app.mount", "StaticFiles", "Security", "HTTPBearer", "HTTPException", "endpoint_dependencies.append", "Depends", "_ActionRoutes", "action_routes.setup_mcp_server", "action_routes.register_actions", "lower", "os.getenv", "_thread.interrup...
6
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3715200_praekeltfoundation_junebug.junebug.command_line_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3715200_praekeltfoundation_junebug.junebug.tests.test_command_line_py.TestCommandLine.test_start_server...
The function (start_server) defined within the public class called public.The function start at line 27 and ends at 440. It contains 104 lines of code and it has a cyclomatic complexity of 10. It takes 4 parameters, represented as [27.0] and does not return any value. It declares 111.0 functions, It has 111.0 functions...
Sema4AI_actions
public
public
0
0
get_expose_session_path
def get_expose_session_path(datadir: str) -> str:return os.path.join(datadir, "expose_session.json")
1
2
1
20
0
41
42
41
datadir
[]
str
{"Return": 1}
1
2
1
["os.path.join"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.read_expose_session_json", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_s...
The function (get_expose_session_path) defined within the public class called public.The function start at line 41 and ends at 42. 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 declare 1.0 function, It has 1.0 function ca...
Sema4AI_actions
public
public
0
0
read_expose_session_json
def read_expose_session_json(datadir: str) -> None | ExposeSessionJson:session_json = Nonetry:expose_session_path = get_expose_session_path(datadir)log.debug(f"🗂️ Reading expose_session.json path={expose_session_path}")with open(expose_session_path, "r") as f:session_json = ExposeSessionJson(**json.load(f))except File...
4
14
1
85
2
45
58
45
datadir
['session_json', 'expose_session_path']
None | ExposeSessionJson
{"Assign": 3, "Expr": 3, "Return": 1, "Try": 1, "With": 1}
7
14
7
["get_expose_session_path", "log.debug", "open", "ExposeSessionJson", "json.load", "log.error", "log.error"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._command_requiring_datadir", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_serv...
The function (read_expose_session_json) defined within the public class called public.The function start at line 45 and ends at 58. It contains 14 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 7.0 functions, It has 7.0 functio...
Sema4AI_actions
public
public
0
0
write_expose_session_json
def write_expose_session_json(datadir: str, expose_session_json: ExposeSessionJson) -> None:expose_session_path = get_expose_session_path(datadir)log.debug(f"🗂️ Writing expose_session.json path={expose_session_path}")with open(expose_session_path, "w") as f:json.dump(expose_session_json.model_dump(mode="json"),f,inden...
1
11
2
56
1
61
71
61
datadir,expose_session_json
['expose_session_path']
None
{"Assign": 1, "Expr": 2, "With": 1}
5
11
5
["get_expose_session_path", "log.debug", "open", "json.dump", "expose_session_json.model_dump"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.handle_session_payload"]
The function (write_expose_session_json) defined within the public class called public.The function start at line 61 and ends at 71. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [61.0] and does not return any value. It declares 5.0 functions, It has 5.0 fun...
Sema4AI_actions
public
public
0
0
get_expose_session
def get_expose_session(payload: SessionPayload) -> str:return f"{payload.sessionId}:{payload.sessionSecret}".encode("ascii").hex()
1
2
1
21
0
74
75
74
payload
[]
str
{"Return": 1}
2
2
2
["hex", "encode"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.handle_session_payload"]
The function (get_expose_session) defined within the public class called public.The function start at line 74 and ends at 75. 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, It has 2.0 functions call...
Sema4AI_actions
public
public
0
0
get_expose_session_payload
def get_expose_session_payload(expose_session: str) -> SessionPayload:session_id, session_secret = codecs.decode(expose_session.encode("ascii"), "hex").split(b":")return SessionPayload(sessionId=session_id.decode(), sessionSecret=session_secret.decode())
1
7
1
51
0
78
84
78
expose_session
[]
SessionPayload
{"Assign": 1, "Return": 1}
6
7
6
["split", "codecs.decode", "expose_session.encode", "SessionPayload", "session_id.decode", "session_secret.decode"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.listen_for_requests", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server...
The function (get_expose_session_payload) defined within the public class called public.The function start at line 78 and ends at 84. 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 6.0 functions, It has 6.0 functi...
Sema4AI_actions
public
public
0
0
forward_request_async
async def forward_request_async(session: "ClientSession", base_url: str, payload: BodyPayload) -> Tuple[int, dict]:url = base_url.rstrip("/") + "/" + payload.path.lstrip("/")async with session.request(payload.method, url, json=payload.body, headers=payload.headers) as response:return response.status, await response.jso...
1
8
3
79
1
87
95
87
session,base_url,payload
['url']
Tuple[int, dict]
{"Assign": 1, "Return": 1}
4
9
4
["base_url.rstrip", "payload.path.lstrip", "session.request", "response.json"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.handle_body_payload"]
The function (forward_request_async) defined within the public class called public.The function start at line 87 and ends at 95. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [87.0] and does not return any value. It declares 4.0 functions, It has 4.0 function...
Sema4AI_actions
public
public
0
0
handle_ping_pong
async def handle_ping_pong(ws: "websockets.WebSocketClientProtocol",pong_queue: asyncio.Queue,ping_interval: int,):while True:await asyncio.sleep(ping_interval)await ws.send("ping")try:await asyncio.wait_for(pong_queue.get(), timeout=ping_interval)except (asyncio.TimeoutError, TimeoutError):log.debug("Lost connection t...
3
14
3
74
0
98
112
98
ws,pong_queue,ping_interval
[]
None
{"Expr": 5, "Try": 1, "While": 1}
6
15
6
["asyncio.sleep", "ws.send", "asyncio.wait_for", "pong_queue.get", "log.debug", "ws.close"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.listen_for_requests"]
The function (handle_ping_pong) defined within the public class called public.The function start at line 98 and ends at 112. It contains 14 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [98.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions c...
Sema4AI_actions
public
public
0
0
handle_session_payload
def handle_session_payload(session_payload: SessionPayload, expose_url: str, datadir: str, api_key: str | None):url = f"https://{session_payload.sessionId}.{expose_url}"log.info(colored("🌍 Public URL: ", "green", attrs=["bold"])+ colored(f"{url}", "light_blue"))if api_key:log.info(colored("🔑 API Authorization Bearer ...
2
21
4
98
2
115
135
115
session_payload,expose_url,datadir,api_key
['url', 'new_expose_session']
None
{"Assign": 2, "Expr": 3, "If": 1}
8
21
8
["log.info", "colored", "colored", "log.info", "colored", "get_expose_session", "write_expose_session_json", "ExposeSessionJson"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.listen_for_requests"]
The function (handle_session_payload) defined within the public class called public.The function start at line 115 and ends at 135. It contains 21 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [115.0] and does not return any value. It declares 8.0 functions, It has 8.0 fun...
Sema4AI_actions
public
public
0
0
handle_body_payload
async def handle_body_payload(session: "ClientSession",get_ws_coro: Coroutine[Any, Any, Union["websockets.WebSocketClientProtocol", Literal["FINISH"]]],payload: BodyPayload,base_url: str,):try:status, json_dict = await forward_request_async(session=session, base_url=base_url, payload=payload)response_converted = json.d...
6
40
4
157
3
138
184
138
session,get_ws_coro,payload,base_url
['timeout_at', 'ws', 'response_converted']
None
{"Assign": 4, "Expr": 4, "If": 2, "Try": 2, "While": 1}
9
47
9
["forward_request_async", "json.dumps", "json.dumps", "time.monotonic", "ws.send", "time.monotonic", "log.exception", "log.exception", "log.exception"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.listen_for_requests"]
The function (handle_body_payload) defined within the public class called public.The function start at line 138 and ends at 184. It contains 40 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [138.0] and does not return any value. It declares 9.0 functions, It has 9.0 functi...
Sema4AI_actions
public
public
0
0
_headers_from_session_payload
def _headers_from_session_payload(session_payload: SessionPayload):headers = {"x-session-id": session_payload.sessionId,"x-session-secret": session_payload.sessionSecret,}return headers
1
6
1
25
1
187
192
187
session_payload
['headers']
Returns
{"Assign": 1, "Return": 1}
0
6
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.listen_for_requests"]
The function (_headers_from_session_payload) defined within the public class called public.The function start at line 187 and ends at 192. 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 has 1.0 function calling this fu...
Sema4AI_actions
public
public
0
0
listen_for_requests.get_ws_coro
async def get_ws_coro() -> (Union["websockets.WebSocketClientProtocol", Literal["FINISH"]]):nonlocal use_wsnonlocal use_ws_eventwhile use_ws is None:use_ws_event.clear()await use_ws_event.wait()return use_ws
2
9
0
38
0
261
271
261
null
[]
None
null
0
0
0
null
0
null
The function (listen_for_requests.get_ws_coro) defined within the public class called public.The function start at line 261 and ends at 271. It contains 9 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
listen_for_requests
async def listen_for_requests(server_url: str,expose_url: str,datadir: str,expose_session: str | None = None,ping_interval: int = 4,api_key: str | None = None,on_event: Callable[[ServerEvent], None] | None = None,) -> None:import aiohttpimport websocketspong_queue: asyncio.Queue = asyncio.Queue(maxsize=1)session_payloa...
25
136
8
626
14
228
407
228
server_url,expose_url,datadir,expose_session,ping_interval,api_key,on_event
['data', 'ping_task', 'use_ws_event', 'ctx', 'use_url', 'headers', 'body_payload', 'loaded', 'session_payload', 'message', 'ssl_certfile', 'use_ws', 'connector', 'https_info']
None
{"AnnAssign": 5, "Assign": 20, "Expr": 24, "If": 10, "Return": 1, "Try": 6, "While": 2}
53
180
53
["asyncio.Queue", "get_expose_session_payload", "_headers_from_session_payload", "expose_url.startswith", "expose_url.startswith", "asyncio.Event", "use_ws_event.clear", "use_ws_event.wait", "os.environ.get", "json.loads", "RuntimeError", "loaded.get", "loaded.get", "RuntimeError", "os.path.exists", "RuntimeError", "ss...
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.expose_server"]
The function (listen_for_requests) defined within the public class called public.The function start at line 228 and ends at 407. It contains 136 lines of code and it has a cyclomatic complexity of 25. It takes 8 parameters, represented as [228.0] and does not return any value. It declares 53.0 functions, It has 53.0 fu...
Sema4AI_actions
public
public
0
0
expose_server
async def expose_server(server_url: str,expose_url: str,datadir: str,expose_session: str | None = None,ping_interval: int = 4,api_key: str | None = None,on_event: Callable[[ServerEvent], None] | None = None,):"""Exposes the server to the world."""if on_event is not None:loop = asyncio.get_running_loop()on_event(EventAs...
7
34
8
149
2
410
447
410
server_url,expose_url,datadir,expose_session,ping_interval,api_key,on_event
['loop', 'task']
None
{"Assign": 2, "Expr": 7, "If": 3, "Try": 1}
11
38
11
["asyncio.get_running_loop", "on_event", "EventAsyncIOLoop", "asyncio.create_task", "listen_for_requests", "on_event", "EventTaskListenForRequests", "log.info", "log.exception", "on_event", "EventTaskListenForRequestsFinished"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_expose_py.main"]
The function (expose_server) defined within the public class called public.The function start at line 410 and ends at 447. It contains 34 lines of code and it has a cyclomatic complexity of 7. It takes 8 parameters, represented as [410.0] and does not return any value. It declares 11.0 functions, It has 11.0 functions ...
Sema4AI_actions
public
public
0
0
_setup_logging.remove_traceback
def remove_traceback(record):if record.levelname == "INFO":if record.exc_info:record.exc_info = Nonereturn True
3
5
1
24
0
458
462
458
null
[]
None
null
0
0
0
null
0
null
The function (_setup_logging.remove_traceback) defined within the public class called public.The function start at line 458 and ends at 462. It contains 5 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
_setup_logging
def _setup_logging(verbose="v", force=False):logging.basicConfig(level=logging.DEBUG if verbose.count("v") > 0 else logging.INFO,format="%(message)s",datefmt="[%X]",force=force,)def remove_traceback(record):if record.levelname == "INFO":if record.exc_info:record.exc_info = Nonereturn True# Don't bee too verbose when at...
2
9
2
55
0
450
465
450
verbose,force
[]
Returns
{"Assign": 1, "Expr": 2, "If": 2, "Return": 1}
3
16
3
["logging.basicConfig", "verbose.count", "log.addFilter"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3953430_aws_aws_encryption_sdk_python.decrypt_oracle._chalice.pipeline_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._command_r...
The function (_setup_logging) defined within the public class called public.The function start at line 450 and ends at 465. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [450.0], and this function return a value. It declares 3.0 functions, It has 3.0 function...