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
test_server_async_api_requests_while_waiting_for_action_to_complete
def test_server_async_api_requests_while_waiting_for_action_to_complete(action_server_process: ActionServerProcess, client: ActionServerClient, datadir):"""Test that the server can handle requests while waiting for an action to complete."""from devutils.fixtures import wait_for_non_error_conditionfrom sema4ai.action_se...
1
48
3
233
5
16
93
16
action_server_process,client,datadir
['callback_url', 'status', 'headers', 'response', 'run_id']
None
{"Assign": 12, "Expr": 9}
22
78
22
["start_server_in_thread", "action_server_process.start", "fut_address.result", "client.post_get_response", "response.raise_for_status", "response.json", "headers.get", "client.get_get_response", "response.raise_for_status", "client.get_get_response", "response.raise_for_status", "response.json", "client.get_get_respon...
0
[]
The function (test_server_async_api_requests_while_waiting_for_action_to_complete) defined within the public class called public.The function start at line 16 and ends at 93. It contains 48 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [16.0] and does not return any value....
Sema4AI_actions
public
public
0
0
test_server_async_api
def test_server_async_api(action_server_process: ActionServerProcess,client: ActionServerClient,):"""Process for asynchronously calling an action in the action server:- Action Server receives a request with something as x-actions-async-timeout: <timeout in seconds> and x-actions-async-callback: url- If the action compl...
1
53
2
275
7
97
174
97
action_server_process,client
['callback_url', 'found', 'headers', 'response', 'result', 'run_id', 'pack']
None
{"Assign": 11, "Expr": 5}
18
78
18
["start_server_in_thread", "get_in_resources", "action_server_process.start", "fut_address.result", "client.post_get_response", "response.raise_for_status", "headers.get", "headers.get", "fut_uri.result", "headers.get", "headers.get", "client.post_get_response", "response.raise_for_status", "response.json", "client.get...
0
[]
The function (test_server_async_api) defined within the public class called public.The function start at line 97 and ends at 174. It contains 53 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [97.0] and does not return any value. It declares 18.0 functions, and It has 18.0...
Sema4AI_actions
public
public
0
0
do_run
def do_run(client: ActionServerClient, time_to_sleep: float, async_run: bool, request_id: str):if async_run:headers = {HEADER_ACTIONS_ASYNC_TIMEOUT: "0",# Return immediatelyHEADER_ACTIONS_REQUEST_ID: request_id,# Can be used to cancel the action, get status, get the result, ...}else:headers = {}response = client.post_g...
3
24
4
96
4
177
202
177
client,time_to_sleep,async_run,request_id
['headers', 'run_id', 'found', 'response']
Returns
{"Assign": 6, "Expr": 1, "If": 2, "Return": 1}
3
26
3
["client.post_get_response", "response.raise_for_status", "headers.get"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94734234_oceanprotocol_pdr_backend.pdr_backend.trader.approach1.test.test_trader_agent1_py.test_trader_agent1_run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94734234_oceanprotocol_pdr_backend.pdr_backend.trader...
The function (do_run) defined within the public class called public.The function start at line 177 and ends at 202. It contains 24 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [177.0], and this function return a value. It declares 3.0 functions, It has 3.0 functions calle...
Sema4AI_actions
public
public
0
0
test_server_async_process_poll_with_cancel.get_run_status
def get_run_status(run_id: str):response = client.get_get_response(f"api/runs/{run_id}/fields", data={"fields": ["status"]})response.raise_for_status()return response.json()["status"]
1
6
1
40
0
220
225
220
null
[]
None
null
0
0
0
null
0
null
The function (test_server_async_process_poll_with_cancel.get_run_status) defined within the public class called public.The function start at line 220 and ends at 225. 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
test_server_async_process_poll_with_cancel.check_cancelled_run2
def check_cancelled_run2():status = get_run_status(run_id2)if status != 4:raise RuntimeError(f"Run {run_id2} is not cancelled. Status: {status}")
2
4
0
21
0
235
238
235
null
[]
None
null
0
0
0
null
0
null
The function (test_server_async_process_poll_with_cancel.check_cancelled_run2) defined within the public class called public.The function start at line 235 and ends at 238. 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
test_server_async_process_poll_with_cancel.check_cancelled_run1
def check_cancelled_run1():status = get_run_status(run_id1)if status != 4:raise RuntimeError(f"Run {run_id1} is not cancelled. Status: {status}")
2
4
0
21
0
240
243
240
null
[]
None
null
0
0
0
null
0
null
The function (test_server_async_process_poll_with_cancel.check_cancelled_run1) defined within the public class called public.The function start at line 240 and ends at 243. 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
test_server_async_process_poll_with_cancel.check_run_id3_completed
def check_run_id3_completed():status = get_run_status(run_id3)if status != 2:raise RuntimeError(f"Run {run_id3} is not completed. Status: {status}")
2
4
0
21
0
258
261
258
null
[]
None
null
0
0
0
null
0
null
The function (test_server_async_process_poll_with_cancel.check_run_id3_completed) defined within the public class called public.The function start at line 258 and ends at 261. 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
test_server_async_process_poll_with_cancel
def test_server_async_process_poll_with_cancel(action_server_process: ActionServerProcess,client: ActionServerClient,datadir: Path,):from devutils.fixtures import wait_for_non_error_conditionaction_server_process.start(cwd=datadir,actions_sync=True,db_file="server.db",max_processes=1,)def get_run_status(run_id: str):re...
1
28
3
179
5
206
263
206
action_server_process,client,datadir
['run_id2', 'status', 'run_id3', 'response', 'run_id1']
Returns
{"Assign": 9, "Expr": 7, "If": 3, "Return": 1}
22
58
22
["action_server_process.start", "client.get_get_response", "response.raise_for_status", "response.json", "do_run", "do_run", "client.post_get_response", "response.raise_for_status", "response.json", "get_run_status", "RuntimeError", "get_run_status", "RuntimeError", "wait_for_non_error_condition", "client.post_get_resp...
0
[]
The function (test_server_async_process_poll_with_cancel) defined within the public class called public.The function start at line 206 and ends at 263. It contains 28 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [206.0], and this function return a value. It declares 22.0 ...
Sema4AI_actions
public
public
0
0
test_cancel_existing_runs_on_restart
def test_cancel_existing_runs_on_restart(action_server_datadir, datadir):action_server_process = ActionServerProcess(action_server_datadir)try:action_server_process.start(cwd=datadir,actions_sync=True,db_file="server.db",max_processes=1,)client = ActionServerClient(action_server_process)run_id = do_run(client, 20, asyn...
3
29
2
142
4
267
297
267
action_server_datadir,datadir
['client', 'action_server_process', 'response', 'run_id']
None
{"Assign": 6, "Expr": 5, "Try": 2}
12
31
12
["ActionServerProcess", "action_server_process.start", "ActionServerClient", "do_run", "action_server_process.stop", "ActionServerProcess", "action_server_process.start", "ActionServerClient", "client.get_get_response", "response.raise_for_status", "response.json", "action_server_process.stop"]
0
[]
The function (test_cancel_existing_runs_on_restart) defined within the public class called public.The function start at line 267 and ends at 297. It contains 29 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [267.0] and does not return any value. It declares 12.0 functions,...
Sema4AI_actions
public
public
0
0
test_automigrate
def test_automigrate(database_v0, datadir, action_server_process: ActionServerProcess, tmpdir):import shutilfrom action_server_tests.fixtures import get_in_resourcesfrom sema4ai.action_server._database import Databasefrom sema4ai.action_server._selftest import sema4ai_action_server_runfrom sema4ai.action_server.migrati...
1
49
4
212
6
10
66
10
database_v0,datadir,action_server_process,tmpdir
['target_db', 'db_path', 'db', 'action_server_datadir', 'root_dir', 'result']
None
{"Assign": 6, "Expr": 4, "With": 2}
14
57
14
["Path", "str", "action_server_datadir.mkdir", "shutil.copy", "db_migration_status", "get_in_resources", "sema4ai_action_server_run", "db_migration_status", "Database", "db.connect", "db.transaction", "db.insert", "Migration", "sema4ai_action_server_run"]
0
[]
The function (test_automigrate) defined within the public class called public.The function start at line 10 and ends at 66. It contains 49 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [10.0] and does not return any value. It declares 14.0 functions, and It has 14.0 funct...
Sema4AI_actions
public
public
0
0
test_server_custom_model_argument
def test_server_custom_model_argument(action_server_process: ActionServerProcess,client: ActionServerClient,data_regression,) -> None:from action_server_tests.fixtures import fix_openapi_json, get_in_resourcespack = get_in_resources("no_conda", "custom_model")action_server_process.start(cwd=pack,actions_sync=True,db_fi...
1
33
3
158
4
9
48
9
action_server_process,client,data_regression
['openapi_json', 'found', 'spec', 'pack']
None
{"Assign": 4, "Expr": 3}
9
40
9
["get_in_resources", "action_server_process.start", "client.get_openapi_json", "json.loads", "data_regression.check", "fix_openapi_json", "client.post_get_str", "json.loads", "client.post_error"]
0
[]
The function (test_server_custom_model_argument) defined within the public class called public.The function start at line 9 and ends at 48. It contains 33 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [9.0] and does not return any value. It declares 9.0 functions, and It ...
Sema4AI_actions
public
public
0
0
wait_for_expose_session_info
def wait_for_expose_session_info(action_server_process):from json import JSONDecodeErrortimeout_at = time.monotonic() + 15target = action_server_process.datadir / "expose_session.json"while time.monotonic() < timeout_at:try:expose_session_info = json.loads(target.read_text())return expose_session_infoexcept (FileNotFou...
3
11
1
64
3
19
31
19
action_server_process
['expose_session_info', 'target', 'timeout_at']
Returns
{"Assign": 3, "Return": 1, "Try": 1, "While": 1}
5
13
5
["time.monotonic", "time.monotonic", "json.loads", "target.read_text", "AssertionError"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_server_expose_py.manual_test_server_expose"]
The function (wait_for_expose_session_info) defined within the public class called public.The function start at line 19 and ends at 31. It contains 11 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 declares 5.0 functions, It has 5.0...
Sema4AI_actions
public
public
0
0
manual_test_server_expose.manual_test_server_expose.call_sleep.func
def func():ret = client.post_get_str("/api/actions/test-server-expose/sleep-a-while/run",{"time_to_sleep": time_to_sleep},headers=headers,)return float(ret)
1
7
0
28
0
78
84
78
null
[]
None
null
0
0
0
null
0
null
The function (manual_test_server_expose.manual_test_server_expose.call_sleep.func) 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..
Sema4AI_actions
public
public
0
0
manual_test_server_expose.call_sleep
def call_sleep(time_to_sleep: float):def func():ret = client.post_get_str("/api/actions/test-server-expose/sleep-a-while/run",{"time_to_sleep": time_to_sleep},headers=headers,)return float(ret)fut = run_in_thread(func)return fut
1
4
1
17
0
77
87
77
null
[]
None
null
0
0
0
null
0
null
The function (manual_test_server_expose.call_sleep) defined within the public class called public.The function start at line 77 and ends at 87. 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
manual_test_server_expose
def manual_test_server_expose(datadir, action_server_process: ActionServerProcess, data_regression, use_https):"""Tests the action server --expose against the real server."""from action_server_tests.fixtures import BUILD_ENV_IN_TESTS_TIMEOUTfrom sema4ai.action_server._selftest import ActionServerClientadditional_args =...
2
35
4
209
13
36
95
36
datadir,action_server_process,data_regression,use_https
['expose_session_info', 'client', 'first_finished_at', 'fut', 'target_url', 'additional_args', 'openapi', 'ret', 'first', 'headers', 'api_key', 'second', 'second_finished_at']
Returns
{"Assign": 13, "Expr": 4, "If": 1, "Return": 2}
17
60
17
["additional_args.append", "action_server_process.start", "wait_for_expose_session_info", "read_text", "ActionServerClient", "json.loads", "client.get_openapi_json", "openapi.pop", "data_regression.check", "client.post_get_str", "float", "run_in_thread", "call_sleep", "call_sleep", "first.result", "second.result", "pyt...
0
[]
The function (manual_test_server_expose) defined within the public class called public.The function start at line 36 and ends at 95. It contains 35 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [36.0], and this function return a value. It declares 17.0 functions, and It h...
Sema4AI_actions
public
public
0
0
run_in_loop.callback
def callback():try:result = func()except BaseException as e:fut.set_exception(e)else:fut.set_result(result)
2
7
0
30
0
101
107
101
null
[]
None
null
0
0
0
null
0
null
The function (run_in_loop.callback) defined within the public class called public.The function start at line 101 and ends at 107. 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..
Sema4AI_actions
public
public
0
0
run_in_loop
def run_in_loop(loop: asyncio.AbstractEventLoop, func, timeout=10):fut: futures.Future = futures.Future()def callback():try:result = func()except BaseException as e:fut.set_exception(e)else:fut.set_result(result)loop.call_soon_threadsafe(callback)return fut.result(timeout)
1
5
3
41
1
98
110
98
loop,func,timeout
['result']
Returns
{"AnnAssign": 1, "Assign": 1, "Expr": 3, "Return": 1, "Try": 1}
6
13
6
["futures.Future", "func", "fut.set_exception", "fut.set_result", "loop.call_soon_threadsafe", "fut.result"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_server_expose_py.test_server_expose_local"]
The function (run_in_loop) defined within the public class called public.The function start at line 98 and ends at 110. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [98.0], and this function return a value. It declares 6.0 functions, It has 6.0 functions cal...
Sema4AI_actions
public
public
0
0
run_coro_in_loop.callback
async def callback():try:result = await coroexcept BaseException as e:fut.set_exception(e)else:fut.set_result(result)
2
7
0
29
0
116
122
116
null
[]
None
null
0
0
0
null
0
null
The function (run_coro_in_loop.callback) defined within the public class called public.The function start at line 116 and ends at 122. 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..
Sema4AI_actions
public
public
0
0
run_coro_in_loop
def run_coro_in_loop(loop: asyncio.AbstractEventLoop, coro, timeout=10):fut: futures.Future = futures.Future()async def callback():try:result = await coroexcept BaseException as e:fut.set_exception(e)else:fut.set_result(result)asyncio.run_coroutine_threadsafe(callback(), loop)return fut.result(timeout)
1
5
3
46
1
113
125
113
loop,coro,timeout
['result']
Returns
{"AnnAssign": 1, "Assign": 1, "Expr": 3, "Return": 1, "Try": 1}
6
13
6
["futures.Future", "fut.set_exception", "fut.set_result", "asyncio.run_coroutine_threadsafe", "callback", "fut.result"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_server_expose_py.test_server_expose_local"]
The function (run_coro_in_loop) defined within the public class called public.The function start at line 113 and ends at 125. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [113.0], and this function return a value. It declares 6.0 functions, It has 6.0 functi...
Sema4AI_actions
WranglerProcess
public
0
0
__init__
def __init__(self) -> None:import subprocessfrom sema4ai.action_server._robo_utils.process import Processself.host = "127.0.0.1"self.port = 8788this_file = Path(__file__).absolute()action_server_dir = this_file.parent.parent.parentassert action_server_dir.name == "action_server"robo_dir = action_server_dir.parentaction...
2
17
1
116
0
129
148
129
self
[]
None
{"AnnAssign": 1, "Assign": 7, "Expr": 1, "If": 1}
5
20
5
["absolute", "Path", "action_server_tunnel_dir.exists", "pytest.skip", "subprocess.check_call"]
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 WranglerProcess.The function start at line 129 and ends at 148. 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, It has 5.0 functions ca...
Sema4AI_actions
WranglerProcess
public
0
0
start
def start(self):assert self.process is None, "Process is already started"from sema4ai.action_server._robo_utils.process import Processself.process = Process(["npm", "run", "dev", "--", f"--port={self.port}", f"--ip={self.host}"],cwd=self.action_server_tunnel_dir,)self.process.on_stderr.register(sys.stderr.write)self.pr...
1
10
1
90
0
150
162
150
self
[]
None
{"Assign": 1, "Expr": 3}
4
13
4
["Process", "self.process.on_stderr.register", "self.process.on_stdout.register", "self.process.start"]
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 WranglerProcess.The function start at line 150 and ends at 162. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions calle...
Sema4AI_actions
WranglerProcess
public
0
0
stop
def stop(self):if self.process:self.process.stop()self.process = None
2
4
1
22
0
164
167
164
self
[]
None
{"Assign": 1, "Expr": 1, "If": 1}
1
4
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 WranglerProcess.The function start at line 164 and ends at 167. 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 ins...
Sema4AI_actions
public
public
0
0
wrangler_process
def wrangler_process() -> Iterator[WranglerProcess]:wrangler_process = WranglerProcess()wrangler_process.start()yield wrangler_processwrangler_process.stop()
1
5
0
26
1
171
175
171
['wrangler_process']
Iterator[WranglerProcess]
{"Assign": 1, "Expr": 3}
3
5
3
["WranglerProcess", "wrangler_process.start", "wrangler_process.stop"]
0
[]
The function (wrangler_process) defined within the public class called public.The function start at line 171 and ends at 175. 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 declares 3.0 functions, and It has 3.0 functions...
Sema4AI_actions
public
public
0
0
test_server_expose_local.wait_for_ev
def wait_for_ev(cls: typing.Type[T]) -> T:while True:try:ev = events_queue.get(timeout=20)except Exception:raise AssertionError(f"Timed out waiting for event of type: {cls}")if isinstance(ev, cls):return ev
4
8
1
48
0
230
237
230
null
[]
None
null
0
0
0
null
0
null
The function (test_server_expose_local.wait_for_ev) defined within the public class called public.The function start at line 230 and ends at 237. It contains 8 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_server_expose_local.expose
def expose():_server_expose._setup_logging(force=True)asyncio.run(_server_expose.expose_server(server_url=f"http://{host}:{port}",expose_url=websocket_expose_url,# localhostdatadir=datadir,expose_session=None,api_key=None,on_event=events_queue.put,))
1
12
0
49
0
240
251
240
null
[]
None
null
0
0
0
null
0
null
The function (test_server_expose_local.expose) defined within the public class called public.The function start at line 240 and ends at 251. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_server_expose_local.test_server_expose_local.call_sleep.func
def func():ret = client.post_get_str("/api/actions/test-server-expose/sleep-a-while/run",{"time_to_sleep": time_to_sleep},params={"sessionId": session_payload_ev.session_payload.sessionId},)return float(ret)
1
7
0
36
0
282
288
282
null
[]
None
null
0
0
0
null
0
null
The function (test_server_expose_local.test_server_expose_local.call_sleep.func) defined within the public class called public.The function start at line 282 and ends at 288. 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..
Sema4AI_actions
public
public
0
0
test_server_expose_local.call_sleep
def call_sleep(time_to_sleep: float):def func():ret = client.post_get_str("/api/actions/test-server-expose/sleep-a-while/run",{"time_to_sleep": time_to_sleep},params={"sessionId": session_payload_ev.session_payload.sessionId},)return float(ret)fut = run_in_thread(func)return fut
1
4
1
17
0
281
291
281
null
[]
None
null
0
0
0
null
0
null
The function (test_server_expose_local.call_sleep) defined within the public class called public.The function start at line 281 and ends at 291. 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
test_server_expose_local
def test_server_expose_local(datadir,action_server_process: ActionServerProcess,data_regression,wrangler_process: WranglerProcess,) -> None:"""This tests the "real" exposed server but in a local version.To work it requires `action-server-tunnel` (private repo) and 'npm' in the env.-- It must be cloned alongside the `ro...
1
67
4
370
18
179
309
179
datadir,action_server_process,data_regression,wrangler_process
['client', 'first_finished_at', 'connected_ev', 'fut', 'session_payload_ev', 'target_url', 'ev', 'port', 'first', 'ret', 'host', 'websocket_expose_url', 'second_finished_at', 'loop_ev', 'params', 'second', 'session_payload_ev2', 'server_expose_thread']
None
{"AnnAssign": 3, "Assign": 20, "Expr": 12, "If": 1, "Return": 3, "Try": 1, "While": 1}
36
131
36
["action_server_process.start", "Queue", "events_queue.get", "AssertionError", "isinstance", "_server_expose._setup_logging", "asyncio.run", "_server_expose.expose_server", "threading.Thread", "server_expose_thread.start", "wait_for_ev", "wait_for_ev", "wait_for_ev", "wait_for_ev", "ActionServerClient", "data_regressio...
0
[]
The function (test_server_expose_local) defined within the public class called public.The function start at line 179 and ends at 309. It contains 67 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [179.0] and does not return any value. It declares 36.0 functions, and It has...
Sema4AI_actions
public
public
0
0
test_server_headers_in_body
def test_server_headers_in_body(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,scenario: str,):import base64import jsonfrom cryptography.hazmat.primitives.ciphers.aead import AESGCMfrom sema4ai.action_server._settings import HEADER_ACTION_INVOCATION_CONTEXTkey = AESGCM.generate_key(256)fr...
3
42
4
234
6
14
63
14
action_server_process,client,datadir,scenario
['env', 'args', 'kwargs', 'key', 'found', 'ctx_info']
None
{"AnnAssign": 1, "Assign": 7, "Expr": 2, "If": 2}
14
50
14
["AESGCM.generate_key", "dict", "json.dumps", "decode", "base64.b64encode", "action_server_process.start", "make_encrypted_data_envelope", "dict", "json.dumps", "dict", "ValueError", "client.post_get_str", "print", "pytest.mark.parametrize"]
0
[]
The function (test_server_headers_in_body) defined within the public class called public.The function start at line 14 and ends at 63. It contains 42 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [14.0] and does not return any value. It declares 14.0 functions, and It has...
Sema4AI_actions
public
public
0
0
test_server_hot_reload.check_mcp_tools
async def check_mcp_tools():async with action_server_process.mcp_client("mcp") as mcp_session:tools_result = await mcp_session.list_tools()tools_list = tools_result.toolsassert len(tools_list) == 1assert tools_list[0].name == "calculator_sum", ("Expected calculator_sum. Found: " + str(tools_list[0].name))
1
8
0
58
0
38
45
38
null
[]
None
null
0
0
0
null
0
null
The function (test_server_hot_reload.check_mcp_tools) defined within the public class called public.The function start at line 38 and ends at 45. It contains 8 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
test_server_hot_reload.check_reloaded
def check_reloaded():found = client.post_get_str("api/actions/calculator/calculator-subtract/run", {"v1": 1.0, "v2": 2.0})assert float(found) == 1.0 - 2.0
1
5
0
39
0
61
65
61
null
[]
None
null
0
0
0
null
0
null
The function (test_server_hot_reload.check_reloaded) defined within the public class called public.The function start at line 61 and ends at 65. 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..
Sema4AI_actions
public
public
0
0
test_server_hot_reload.check_mcp_tools_after_reload
async def check_mcp_tools_after_reload():async with action_server_process.mcp_client("mcp") as mcp_session:tools_result = await mcp_session.list_tools()tools_list = tools_result.toolsassert len(tools_list) == 1, "Expected 1 tool. Found: " + str(tools_list)assert tools_list[0].name == "calculator_subtract", ("Expected c...
1
8
0
65
0
69
76
69
null
[]
None
null
0
0
0
null
0
null
The function (test_server_hot_reload.check_mcp_tools_after_reload) defined within the public class called public.The function start at line 69 and ends at 76. It contains 8 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
test_server_hot_reload
def test_server_hot_reload(action_server_process: ActionServerProcess, client: ActionServerClient, tmpdir) -> None:from pathlib import Pathfrom action_server_tests.fixtures import run_async_in_new_threadfrom devutils.fixtures import wait_for_non_error_conditioncalculator = Path(tmpdir) / "calculator" / "action_calculat...
1
43
3
150
4
7
78
7
action_server_process,client,tmpdir
['calculator', 'tools_result', 'tools_list', 'found']
None
{"Assign": 7, "Expr": 7}
22
72
22
["Path", "calculator.parent.mkdir", "calculator.write_text", "action_server_process.start", "Path", "client.post_get_str", "float", "action_server_process.mcp_client", "mcp_session.list_tools", "len", "str", "run_async_in_new_thread", "calculator.write_text", "client.post_get_str", "float", "wait_for_non_error_conditio...
0
[]
The function (test_server_hot_reload) defined within the public class called public.The function start at line 7 and ends at 78. It contains 43 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [7.0] and does not return any value. It declares 22.0 functions, and It has 22.0 f...
Sema4AI_actions
public
public
0
0
test_serve_https
def test_serve_https(action_server_process: ActionServerProcess):from action_server_tests.fixtures import get_in_resourcespack = get_in_resources("no_conda", "greeter")action_server_process.start(cwd=pack,actions_sync=True,db_file="server.db",use_https=True,additional_args=["--ssl-self-signed"],)client = ActionServerCl...
1
22
1
135
3
9
34
9
action_server_process
['client', 'found', 'pack']
None
{"Assign": 3, "Expr": 2}
12
26
12
["get_in_resources", "action_server_process.start", "ActionServerClient", "json", "requests.get", "client.build_full_url", "str", "get_user_sema4_path", "requests.post", "client.build_full_url", "str", "get_user_sema4_path"]
0
[]
The function (test_serve_https) defined within the public class called public.The function start at line 9 and ends at 34. It contains 22 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 12.0 functions, and It has 12.0 functions...
Sema4AI_actions
public
public
0
0
test_action_server_parent_pid
def test_action_server_parent_pid(action_server_process: ActionServerProcess, data_regression):from action_server_tests.fixtures import get_in_resourcesfrom sema4ai.action_server._robo_utils.process import kill_process_and_subprocessesprocess = Process(["python", "-c", "import time;time.sleep(1000000)"])process.start()...
1
27
2
146
5
9
43
9
action_server_process,data_regression
['client', 'pid', 'found', 'process', 'pack']
None
{"Assign": 5, "Expr": 4}
10
35
10
["Process", "process.start", "get_in_resources", "action_server_process.start", "ActionServerClient", "client.post_get_str", "action_server_process.process.is_alive", "kill_process_and_subprocesses", "wait_for_condition", "action_server_process.process.is_alive"]
0
[]
The function (test_action_server_parent_pid) defined within the public class called public.The function start at line 9 and ends at 43. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [9.0] and does not return any value. It declares 10.0 functions, and It has...
Sema4AI_actions
public
public
0
0
test_server_post_run.func
def func():import jsonfound = json.loads(Path(output_json).read_text())assert found["run_id"].startswith("run")base_artifacts_dir = found["base_artifacts_dir"]run_artifacts_dir = found["run_artifacts_dir"]agent_id = found["agent_id"]thread_id = found["thread_id"]action_name = found["action_name"]assert agent_id == "my-...
1
14
0
91
0
51
66
51
null
[]
None
null
0
0
0
null
0
null
The function (test_server_post_run.func) defined within the public class called public.The function start at line 51 and ends at 66. It contains 14 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
test_server_post_run
def test_server_post_run(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):import osimport sysfrom pathlib import Pathfrom action_server_tests.fixtures import get_in_resourcesfrom devutils.fixtures import wait_for_non_error_conditionfrom sema4ai.action_server._encryption import make_unencr...
1
38
3
170
12
7
68
7
action_server_process,client,datadir
['env', 'agent_id', 'found', 'cmd', 'run_artifacts_dir', 'x_action_context', 'post_run_script', 'output_json', 'thread_id', 'action_name', 'base_artifacts_dir', 'pack']
None
{"Assign": 13, "Expr": 2}
17
62
17
["os.path.exists", "get_in_resources", "Path", "as_posix", "Path", "post_run_script.as_posix", "output_json.as_posix", "action_server_process.start", "make_unencrypted_data_envelope", "client.post_get_str", "json.loads", "read_text", "Path", "startswith", "os.path.exists", "os.path.exists", "wait_for_non_error_conditio...
0
[]
The function (test_server_post_run) defined within the public class called public.The function start at line 7 and ends at 68. It contains 38 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [7.0] and does not return any value. It declares 17.0 functions, and It has 17.0 fun...
Sema4AI_actions
public
public
0
0
test_server_post_run_on_failure.func
def func():import jsonfound = json.loads(Path(output_json).read_text())assert found["run_id"].startswith("run")base_artifacts_dir = found["base_artifacts_dir"]run_artifacts_dir = found["run_artifacts_dir"]agent_id = found["agent_id"]thread_id = found["thread_id"]action_name = found["action_name"]assert agent_id == "my-...
1
14
0
91
0
115
130
115
null
[]
None
null
0
0
0
null
0
null
The function (test_server_post_run_on_failure.func) defined within the public class called public.The function start at line 115 and ends at 130. It contains 14 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
test_server_post_run_on_failure
def test_server_post_run_on_failure(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):import osimport sysfrom pathlib import Pathfrom action_server_tests.fixtures import get_in_resourcesfrom devutils.fixtures import wait_for_non_error_conditionfrom sema4ai.action_server._encryption import ...
1
37
3
157
12
72
132
72
action_server_process,client,datadir
['env', 'agent_id', 'found', 'cmd', 'run_artifacts_dir', 'x_action_context', 'post_run_script', 'output_json', 'thread_id', 'action_name', 'base_artifacts_dir', 'pack']
None
{"Assign": 12, "Expr": 3}
17
61
17
["os.path.exists", "get_in_resources", "Path", "as_posix", "Path", "post_run_script.as_posix", "output_json.as_posix", "action_server_process.start", "make_unencrypted_data_envelope", "client.post_error", "json.loads", "read_text", "Path", "startswith", "os.path.exists", "os.path.exists", "wait_for_non_error_condition"...
0
[]
The function (test_server_post_run_on_failure) defined within the public class called public.The function start at line 72 and ends at 132. It contains 37 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [72.0] and does not return any value. It declares 17.0 functions, and I...
Sema4AI_actions
public
public
0
0
test_server_bad_post_run_command
def test_server_bad_post_run_command(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):import sysfrom pathlib import Pathfrom action_server_tests.fixtures import get_in_resourcesfrom sema4ai.action_server._encryption import make_unencrypted_data_envelopepost_run_script = datadir / "post_ru...
1
32
3
134
6
136
174
136
action_server_process,client,datadir
['env', 'cmd', 'x_action_context', 'post_run_script', 'output_json', 'pack']
None
{"Assign": 6, "Expr": 2}
9
39
9
["get_in_resources", "Path", "as_posix", "Path", "post_run_script.as_posix", "output_json.as_posix", "action_server_process.start", "make_unencrypted_data_envelope", "client.post_error"]
0
[]
The function (test_server_bad_post_run_command) defined within the public class called public.The function start at line 136 and ends at 174. It contains 32 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [136.0] and does not return any value. It declares 9.0 functions, and ...
Sema4AI_actions
public
public
0
0
test_issue_167_access_headers
def test_issue_167_access_headers(action_server_process: ActionServerProcess,client: ActionServerClient,):from action_server_tests.fixtures import get_in_resourcespack = get_in_resources("no_conda", "check_headers")action_server_process.start(cwd=pack,actions_sync=True,db_file="server.db",lint=True,)found = client.post...
1
25
2
136
4
9
37
9
action_server_process,client
['headers', 'cookies', 'found', 'pack']
None
{"Assign": 5, "Expr": 1}
7
29
7
["get_in_resources", "action_server_process.start", "client.post_get_str", "dict", "json.loads", "json.loads", "dict"]
0
[]
The function (test_issue_167_access_headers) defined within the public class called public.The function start at line 9 and ends at 37. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [9.0] and does not return any value. It declares 7.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
test_return_response_ok_action.case1
def case1():# ---------- case bad schemaresponse = client.post_error("api/actions/test-server-response/bad-schema/run",500,{},)found = json.loads(response.text)assert found["error_code"] == "internal-error"assert ("Inconsistent value returned from action.\ni.e.: the returned value: 1\ndoes not match the expected output...
1
12
0
44
0
17
29
17
null
[]
None
null
0
0
0
null
0
null
The function (test_return_response_ok_action.case1) defined within the public class called public.The function start at line 17 and ends at 29. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_return_response_ok_action.case2
def case2():# ---------- case without response (action error)response = client.post_error("api/actions/test-server-response/raise-action-error-action-not-response/run",500,{},)found = json.loads(response.text)assert found == {"error_code": "internal-error", "message": "Action error"}
1
8
0
40
0
31
39
31
null
[]
None
null
0
0
0
null
0
null
The function (test_return_response_ok_action.case2) defined within the public class called public.The function start at line 31 and ends at 39. It contains 8 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
test_return_response_ok_action.case3
def case3():# ---------- case without response (other error)response = client.post_error("api/actions/test-server-response/raise-action-error-other-not-response/run",500,{},)found = json.loads(response.text)assert found == {"error_code": "internal-error","message": "Unexpected error (RuntimeError)",}
1
11
0
41
0
41
52
41
null
[]
None
null
0
0
0
null
0
null
The function (test_return_response_ok_action.case3) defined within the public class called public.The function start at line 41 and ends at 52. It contains 11 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
test_return_response_ok_action.case4
def case4():# ---------- all okfound = client.post_get_str("api/actions/test-server-response/return-response-ok-action/run",{},)found = json.loads(found)assert found == {"result": {"show": False}, "error": None}
1
7
0
40
0
54
61
54
null
[]
None
null
0
0
0
null
0
null
The function (test_return_response_ok_action.case4) defined within the public class called public.The function start at line 54 and ends at 61. 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..
Sema4AI_actions
public
public
0
0
test_return_response_ok_action.case5
def case5():# ---------- return is a response with an errorfound = client.post_get_str("api/actions/test-server-response/return-response-error-action/run",{},)found = json.loads(found)assert found == {"result": None, "error": "Something bad happened"}
1
7
0
36
0
63
70
63
null
[]
None
null
0
0
0
null
0
null
The function (test_return_response_ok_action.case5) defined within the public class called public.The function start at line 63 and ends at 70. 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..
Sema4AI_actions
public
public
0
0
test_return_response_ok_action.case6
def case6():# ---------- unexpected exception raisedfound = client.post_get_str("api/actions/test-server-response/raise-other-error-action/run",{},)found = json.loads(found)assert found == {"result": None, "error": "Unexpected error (RuntimeError)"}
1
7
0
36
0
72
79
72
null
[]
None
null
0
0
0
null
0
null
The function (test_return_response_ok_action.case6) defined within the public class called public.The function start at line 72 and ends at 79. 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..
Sema4AI_actions
public
public
0
0
test_return_response_ok_action.case7
def case7():# ---------- exception raised with an 'Action error' messagefound = client.post_get_str("api/actions/test-server-response/raise-action-error-action/run",{},)found = json.loads(found)assert found == {"result": None, "error": "Action error"}
1
7
0
36
0
81
88
81
null
[]
None
null
0
0
0
null
0
null
The function (test_return_response_ok_action.case7) defined within the public class called public.The function start at line 81 and ends at 88. 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..
Sema4AI_actions
public
public
0
0
test_return_response_ok_action
def test_return_response_ok_action(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):def case1():# ---------- case bad schemaresponse = client.post_error("api/actions/test-server-response/bad-schema/run",500,{},)found = json.loads(response.text)assert found["error_code"] == "internal-error...
6
31
3
141
4
12
113
12
action_server_process,client,datadir
['check_cases', 'futures', 'found', 'response']
None
{"Assign": 16, "Expr": 2, "For": 1, "With": 1}
24
102
24
["client.post_error", "json.loads", "client.post_error", "json.loads", "client.post_error", "json.loads", "client.post_get_str", "json.loads", "client.post_get_str", "json.loads", "client.post_get_str", "json.loads", "client.post_get_str", "json.loads", "f_locals.items", "sys._getframe", "inspect.isfunction", "name.sta...
0
[]
The function (test_return_response_ok_action) defined within the public class called public.The function start at line 12 and ends at 113. It contains 31 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [12.0] and does not return any value. It declares 24.0 functions, and It...
Sema4AI_actions
public
public
0
0
test_action_package_json
def test_action_package_json(action_server_process: ActionServerProcess, client: ActionServerClient, tmpdir):from pathlib import Pathcalculator = Path(tmpdir) / "calculator" / "action_calculator.py"calculator.parent.mkdir(parents=True, exist_ok=True)calculator.write_text("""from sema4ai.actions import action, Responsef...
1
33
3
94
2
117
151
117
action_server_process,client,tmpdir
['calculator', 'found']
None
{"Assign": 2, "Expr": 4}
7
35
7
["Path", "calculator.parent.mkdir", "calculator.write_text", "action_server_process.start", "Path", "client.post_get_str", "print"]
0
[]
The function (test_action_package_json) defined within the public class called public.The function start at line 117 and ends at 151. It contains 33 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [117.0] and does not return any value. It declares 7.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
test_secrets_simple
def test_secrets_simple(action_server_process: ActionServerProcess, client: ActionServerClient, tmpdir):from pathlib import Pathfrom sema4ai.action_server._selftest import check_secrets_simplecheck_secrets_simple(Path(tmpdir), action_server_process, client, verbose=False)
1
6
3
40
0
10
17
10
action_server_process,client,tmpdir
[]
None
{"Expr": 1}
2
8
2
["check_secrets_simple", "Path"]
0
[]
The function (test_secrets_simple) defined within the public class called public.The function start at line 10 and ends at 17. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [10.0] and does not return any value. It declares 2.0 functions, and It has 2.0 funct...
Sema4AI_actions
public
public
0
0
test_secrets_encrypted
def test_secrets_encrypted(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):import base64import jsonfrom cryptography.hazmat.primitives.ciphers.aead import AESGCMpack = datadir / "pack_encryption"keys = [AESGCM.generate_key(256), AESGCM.generate_key(256)]if USE_STATIC_INFO:keys = [b"a" * ...
3
35
3
194
5
21
71
21
action_server_process,client,datadir
['env', 'found', 'ctx_info', 'keys', 'pack']
None
{"Assign": 6, "Expr": 1, "If": 1}
12
51
12
["AESGCM.generate_key", "AESGCM.generate_key", "len", "dict", "json.dumps", "json.dumps", "decode", "base64.b64encode", "action_server_process.start", "make_encrypted_data_envelope", "client.post_get_str", "json.loads"]
0
[]
The function (test_secrets_encrypted) defined within the public class called public.The function start at line 21 and ends at 71. It contains 35 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [21.0] and does not return any value. It declares 12.0 functions, and It has 12.0...
Sema4AI_actions
public
public
0
0
test_secrets_not_encrypted
def test_secrets_not_encrypted(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):import json# Verify that things work if the X-Action-Context is not encrypted.from sema4ai.action_server._encryption import make_unencrypted_data_envelopepack = datadir / "pack_encryption"action_server_process...
1
23
3
96
3
75
103
75
action_server_process,client,datadir
['found', 'secrets_in_base64', 'pack']
None
{"Assign": 3, "Expr": 1}
4
29
4
["action_server_process.start", "make_unencrypted_data_envelope", "client.post_get_str", "json.loads"]
0
[]
The function (test_secrets_not_encrypted) defined within the public class called public.The function start at line 75 and ends at 103. It contains 23 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 4.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
test_secrets_unencrypted_set_through_separate_post_request
def test_secrets_unencrypted_set_through_separate_post_request(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):import base64import jsonpack = datadir / "pack_encryption"action_server_process.start(cwd=pack,actions_sync=True,db_file="server.db",lint=True,)data: str = json.dumps({"secrets"...
1
43
3
199
4
107
156
107
action_server_process,client,datadir
['data', 'ctx_info', 'found', 'pack']
None
{"AnnAssign": 2, "Assign": 6, "Expr": 1}
14
50
14
["action_server_process.start", "json.dumps", "decode", "base64.b64encode", "data.encode", "client.post_get_str", "json.loads", "client.post_get_str", "json.loads", "json.dumps", "decode", "base64.b64encode", "data.encode", "client.post_error"]
0
[]
The function (test_secrets_unencrypted_set_through_separate_post_request) defined within the public class called public.The function start at line 107 and ends at 156. It contains 43 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [107.0] and does not return any value. It de...
Sema4AI_actions
public
public
0
0
test_secrets_encrypted_set_through_separate_post_request_env_var_or_header
def test_secrets_encrypted_set_through_separate_post_request_env_var_or_header(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,scenario,):import base64import jsonfrom cryptography.hazmat.primitives.ciphers.aead import AESGCMfrom sema4ai.action_server._encryption import make_encrypted_data_...
9
69
4
336
5
170
252
170
action_server_process,client,datadir,scenario
['env', 'set_result', 'found', 'keys', 'pack']
None
{"AnnAssign": 1, "Assign": 11, "Expr": 1, "If": 7}
19
83
19
["AESGCM.generate_key", "AESGCM.generate_key", "len", "dict", "json.dumps", "decode", "base64.b64encode", "make_encrypted_data_envelope", "action_server_process.start", "make_encrypted_data_envelope", "client.post_get_str", "json.loads", "client.post_get_str", "client.post_get_str", "client.post_get_str", "make_encrypt...
0
[]
The function (test_secrets_encrypted_set_through_separate_post_request_env_var_or_header) defined within the public class called public.The function start at line 170 and ends at 252. It contains 69 lines of code and it has a cyclomatic complexity of 9. It takes 4 parameters, represented as [170.0] and does not return ...
Sema4AI_actions
public
public
0
0
test_secrets_encrypted_oauth2
def test_secrets_encrypted_oauth2(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):import base64import jsonfrom cryptography.hazmat.primitives.ciphers.aead import AESGCMpack = datadir / "pack_encryption_oauth2"keys = [AESGCM.generate_key(256), AESGCM.generate_key(256)]if USE_STATIC_INFO:k...
3
44
3
212
5
256
315
256
action_server_process,client,datadir
['env', 'found', 'ctx_info', 'keys', 'pack']
None
{"Assign": 6, "Expr": 1, "If": 1}
12
60
12
["AESGCM.generate_key", "AESGCM.generate_key", "len", "dict", "json.dumps", "json.dumps", "decode", "base64.b64encode", "action_server_process.start", "make_encrypted_data_envelope", "client.post_get_str", "json.loads"]
0
[]
The function (test_secrets_encrypted_oauth2) defined within the public class called public.The function start at line 256 and ends at 315. It contains 44 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [256.0] and does not return any value. It declares 12.0 functions, and I...
Sema4AI_actions
public
public
0
0
test_secrets_oauth2_encrypted_set_through_separate_post_request
def test_secrets_oauth2_encrypted_set_through_separate_post_request(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):import base64import jsonfrom cryptography.hazmat.primitives.ciphers.aead import AESGCMfrom sema4ai.action_server._encryption import make_encrypted_data_envelopepack = datad...
3
48
3
228
4
319
375
319
action_server_process,client,datadir
['env', 'found', 'keys', 'pack']
None
{"AnnAssign": 1, "Assign": 6, "Expr": 1, "If": 1}
13
57
13
["AESGCM.generate_key", "AESGCM.generate_key", "len", "dict", "json.dumps", "decode", "base64.b64encode", "action_server_process.start", "make_encrypted_data_envelope", "client.post_get_str", "json.loads", "client.post_get_str", "json.loads"]
0
[]
The function (test_secrets_oauth2_encrypted_set_through_separate_post_request) defined within the public class called public.The function start at line 319 and ends at 375. It contains 48 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [319.0] and does not return any value. ...
Sema4AI_actions
AsyncIOThread
public
0
1
__init__
def __init__(self):threading.Thread.__init__(self)self.loop = asyncio.new_event_loop()
1
3
1
22
0
32
34
32
self
[]
None
{"Assign": 1, "Expr": 1}
2
3
2
["threading.Thread.__init__", "asyncio.new_event_loop"]
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 AsyncIOThread, that inherit another class.The function start at line 32 and ends at 34. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, ...
Sema4AI_actions
AsyncIOThread
public
0
1
run
def run(self):self.loop.run_forever()
1
2
1
12
0
36
37
36
self
[]
None
{"Expr": 1}
1
2
1
["self.loop.run_forever"]
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 AsyncIOThread, that inherit another class.The function start at line 36 and ends at 37. 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 ...
Sema4AI_actions
AsyncIOThread
public
0
1
submit_async
def submit_async(self, awaitable):return asyncio.run_coroutine_threadsafe(awaitable, self.loop)
1
2
2
18
0
39
40
39
self,awaitable
[]
Returns
{"Return": 1}
1
2
1
["asyncio.run_coroutine_threadsafe"]
0
[]
The function (submit_async) defined within the public class called AsyncIOThread, that inherit another class.The function start at line 39 and ends at 40. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [39.0], and this function return a value. It declare 1.0 f...
Sema4AI_actions
AsyncIOThread
public
0
1
stop_async
def stop_async(self):self.loop.call_soon_threadsafe(self.loop.stop)
1
2
1
17
0
42
43
42
self
[]
None
{"Expr": 1}
1
2
1
["self.loop.call_soon_threadsafe"]
0
[]
The function (stop_async) defined within the public class called AsyncIOThread, that inherit another class.The function start at line 42 and ends at 43. 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, ...
Sema4AI_actions
AsyncIOThread
public
0
1
websocket_connect
def websocket_connect(self, url):self.submit_async(self._connect(url))
1
2
2
18
0
45
46
45
self,url
[]
None
{"Expr": 1}
2
2
2
["self.submit_async", "self._connect"]
0
[]
The function (websocket_connect) defined within the public class called AsyncIOThread, that inherit another class.The function start at line 45 and ends at 46. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [45.0] and does not return any value. It declares 2.0...
Sema4AI_actions
public
public
0
0
asyncio_thread
def asyncio_thread():asyncio_thread = AsyncIOThread()asyncio_thread.start()yield asyncio_threadasyncio_thread.stop_async()asyncio_thread.join()
1
6
0
26
1
50
55
50
['asyncio_thread']
None
{"Assign": 1, "Expr": 4}
4
6
4
["AsyncIOThread", "asyncio_thread.start", "asyncio_thread.stop_async", "asyncio_thread.join"]
0
[]
The function (asyncio_thread) defined within the public class called public.The function start at line 50 and ends at 55. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 functions cal...
Sema4AI_actions
public
public
0
0
build_ws_url
def build_ws_url(action_server_process, url="api/ws"):host = action_server_process.hostport = action_server_process.portif url.startswith("/"):url = url[1:]return f"ws://{host}:{port}/{url}"
2
6
2
37
3
58
63
58
action_server_process,url
['url', 'port', 'host']
Returns
{"Assign": 3, "If": 1, "Return": 1}
1
6
1
["url.startswith"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_server_websockets_py.check_websocket_action_package", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests....
The function (build_ws_url) defined within the public class called public.The function start at line 58 and ends at 63. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [58.0], and this function return a value. It declare 1.0 function, It has 1.0 function called...
Sema4AI_actions
AsyncIOThread
public
0
1
__init__
def __init__(self, ws):self.ws = ws
1
2
2
12
0
67
68
67
self
[]
None
{"Assign": 1, "Expr": 1}
2
3
2
["threading.Thread.__init__", "asyncio.new_event_loop"]
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 AsyncIOThread, that inherit another class.The function start at line 67 and ends at 68. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [67.0] and does not return any value. It declares 2.0 function...
Sema4AI_actions
SocketClient
public
0
0
emit
async def emit(self, event, data=None):msg = {"event": event}if data is not None:msg["data"] = dataawait self.ws.send(json.dumps(msg))
2
5
3
44
0
70
74
70
self,event,data
[]
None
{"Assign": 2, "Expr": 1, "If": 1}
2
5
2
["self.ws.send", "json.dumps"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3687109_tuhiproject_tuhi.tools.kete_py.TuhiKeteShellLogHandler.emit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3715200_praekeltfoundation_junebug.junebug.command_line_py.PythonExceptionFilteringLoggingObserver....
The function (emit) defined within the public class called SocketClient.The function start at line 70 and ends at 74. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [70.0] and does not return any value. It declares 2.0 functions, It has 2.0 functions called in...
Sema4AI_actions
SocketClient
public
0
0
receive
async def receive(self):received = json.loads(await self.ws.recv())return received["event"], received.get("data")
1
3
1
32
0
76
78
76
self
[]
Returns
{"Assign": 1, "Return": 1}
3
3
3
["json.loads", "self.ws.recv", "received.get"]
21
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3707933_aiortc_aioquic.examples.demo_py.wt", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3963099_pgjones_hypercorn.compliance.autobahn.server_py.app", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.C...
The function (receive) defined within the public class called SocketClient.The function start at line 76 and ends at 78. 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 3.0 functions, It has 3.0 functions calle...
Sema4AI_actions
public
public
0
0
check_websocket_runs
async def check_websocket_runs(action_server_process: ActionServerProcess, queue: Queue[Any]):try:url = build_ws_url(action_server_process)import websocketsasync with websockets.connect(url, logger=log, open_timeout=_get_timeout()) as ws:sio = SocketClient(ws)await sio.emit("echo", "echo-val")event, val = await sio.rec...
2
32
2
203
2
81
127
81
action_server_process,queue
['url', 'sio']
None
{"Assign": 6, "Expr": 6, "Try": 1}
18
47
18
["build_ws_url", "websockets.connect", "_get_timeout", "SocketClient", "sio.emit", "sio.receive", "sio.emit", "sio.receive", "queue.put", "sio.receive", "tuple", "added.keys", "sio.receive", "tuple", "changed.keys", "traceback.print_exc", "queue.put", "queue.put"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_server_websockets_py.test_server_websockets"]
The function (check_websocket_runs) defined within the public class called public.The function start at line 81 and ends at 127. It contains 32 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [81.0] and does not return any value. It declares 18.0 functions, It has 18.0 funct...
Sema4AI_actions
public
public
0
0
check_websocket_action_package
async def check_websocket_action_package(action_server_process: ActionServerProcess, queue: Queue[Any]):try:url = build_ws_url(action_server_process)import websocketsasync with websockets.connect(url, logger=log, open_timeout=_get_timeout()) as ws:sio = SocketClient(ws)await sio.emit("request",{"method": "GET","url": "...
2
26
2
133
2
130
159
130
action_server_process,queue
['url', 'sio']
None
{"Assign": 3, "Expr": 3, "Try": 1}
9
30
9
["build_ws_url", "websockets.connect", "_get_timeout", "SocketClient", "sio.emit", "sio.receive", "len", "queue.put", "queue.put"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_server_websockets_py.test_server_websockets"]
The function (check_websocket_action_package) defined within the public class called public.The function start at line 130 and ends at 159. It contains 26 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [130.0] and does not return any value. It declares 9.0 functions, It has...
Sema4AI_actions
public
public
0
0
_get_timeout
def _get_timeout():if "pydevd" in sys.modules:return Nonereturn 20
2
4
0
15
0
162
165
162
[]
Returns
{"If": 1, "Return": 2}
0
4
0
[]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_server_websockets_py.check_websocket_action_package", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests....
The function (_get_timeout) defined within the public class called public.The function start at line 162 and ends at 165. It contains 4 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 has 3.0 functions calling this function which are...
Sema4AI_actions
public
public
0
0
test_server_websockets
def test_server_websockets(action_server_process: ActionServerProcess,asyncio_thread: AsyncIOThread,base_case,client,) -> None:queue: Queue[Any] = Queue()asyncio_thread.submit_async(check_websocket_runs(action_server_process, queue))while True:curr = queue.get(timeout=_get_timeout())if curr == "worked":breakif curr == ...
6
27
4
127
1
169
198
169
action_server_process,asyncio_thread,base_case,client
['curr']
None
{"AnnAssign": 1, "Assign": 2, "Expr": 3, "If": 3, "While": 2}
12
30
12
["Queue", "asyncio_thread.submit_async", "check_websocket_runs", "queue.get", "_get_timeout", "client.post_get_str", "AssertionError", "asyncio_thread.submit_async", "check_websocket_action_package", "queue.get", "_get_timeout", "AssertionError"]
0
[]
The function (test_server_websockets) defined within the public class called public.The function start at line 169 and ends at 198. It contains 27 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [169.0] and does not return any value. It declares 12.0 functions, and It has 1...
Sema4AI_actions
public
public
0
0
test_whitelist_exact_match
def test_whitelist_exact_match():"""Tests if an exact match is accepted."""assert accept_action("action1", "package", "action1")assert not accept_action("action1", "any-package-name", "action2")
1
3
0
24
0
10
13
10
[]
None
{"Expr": 1}
2
4
2
["accept_action", "accept_action"]
0
[]
The function (test_whitelist_exact_match) defined within the public class called public.The function start at line 10 and ends at 13. 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 f...
Sema4AI_actions
public
public
0
0
test_whitelist_package_match
def test_whitelist_package_match():"""Tests if an action in a specific package is accepted."""assert accept_action("package1/action1", "package1", "action1")assert not accept_action("package1/action1", "package2", "action1")
1
3
0
24
0
16
19
16
[]
None
{"Expr": 1}
2
4
2
["accept_action", "accept_action"]
0
[]
The function (test_whitelist_package_match) defined within the public class called public.The function start at line 16 and ends at 19. 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...
Sema4AI_actions
public
public
0
0
test_whitelist_wildcard_match
def test_whitelist_wildcard_match():"""Tests if an action is accepted using wildcards."""assert accept_action("action*", "any-name", "action1")assert accept_action("action*", "any-name", "action_name")assert not accept_action("other_action*", "any-name", "action1")
1
4
0
33
0
22
26
22
[]
None
{"Expr": 1}
3
5
3
["accept_action", "accept_action", "accept_action"]
0
[]
The function (test_whitelist_wildcard_match) defined within the public class called public.The function start at line 22 and ends at 26. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3....
Sema4AI_actions
public
public
0
0
test_whitelist_multiple_patterns
def test_whitelist_multiple_patterns():"""Tests if multiple patterns separated by comma are accepted."""assert accept_action("action1,action2", "any-name", "action1")assert accept_action("action1,action2", "any-name", "action2")assert not accept_action("action1,action2", "any-name", "action3")
1
4
0
33
0
29
33
29
[]
None
{"Expr": 1}
3
5
3
["accept_action", "accept_action", "accept_action"]
0
[]
The function (test_whitelist_multiple_patterns) defined within the public class called public.The function start at line 29 and ends at 33. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has...
Sema4AI_actions
public
public
0
0
test_whitelist_hyphen_underscore_match
def test_whitelist_hyphen_underscore_match():"""Tests if hyphens and underscores are treated interchangeably."""assert accept_action("action_1", "any-name", "action-1")assert accept_action("action-2", "any-name", "action_2")
1
3
0
23
0
36
39
36
[]
None
{"Expr": 1}
2
4
2
["accept_action", "accept_action"]
0
[]
The function (test_whitelist_hyphen_underscore_match) defined within the public class called public.The function start at line 36 and ends at 39. 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 ...
Sema4AI_actions
public
public
0
0
test_whitelist_on_import
def test_whitelist_on_import(str_regression,tmpdir,action_server_datadir: Path,client: ActionServerClient,) -> None:from action_server_tests.fixtures import sema4ai_action_server_runfrom sema4ai.action_server._database import Databasefrom sema4ai.action_server._models import Action, load_dbaction_server_datadir.mkdir(p...
1
46
4
160
3
43
93
43
str_regression,tmpdir,action_server_datadir,client
['db_path', 'calculator', 'actions']
None
{"AnnAssign": 1, "Assign": 3, "Expr": 4, "With": 2}
10
51
10
["action_server_datadir.mkdir", "db_path.exists", "Path", "calculator.parent.mkdir", "calculator.write_text", "sema4ai_action_server_run", "load_db", "db.connect", "db.all", "len"]
0
[]
The function (test_whitelist_on_import) defined within the public class called public.The function start at line 43 and ends at 93. It contains 46 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [43.0] and does not return any value. It declares 10.0 functions, and It has 10...
Sema4AI_actions
public
public
0
0
test_whitelist_on_start
def test_whitelist_on_start(action_server_process: ActionServerProcess,str_regression,tmpdir,client: ActionServerClient,) -> None:from action_server_tests.fixtures import fix_openapi_jsoncalculator = Path(tmpdir) / "v1" / "calculator" / "action_calculator.py"calculator.parent.mkdir(parents=True, exist_ok=True)calculato...
1
32
4
122
2
97
131
97
action_server_process,str_regression,tmpdir,client
['calculator', 'spec']
None
{"Assign": 2, "Expr": 4}
9
35
9
["Path", "calculator.parent.mkdir", "calculator.write_text", "action_server_process.start", "json.dumps", "fix_openapi_json", "json.loads", "client.get_openapi_json", "str_regression.check"]
0
[]
The function (test_whitelist_on_start) defined within the public class called public.The function start at line 97 and ends at 131. It contains 32 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [97.0] and does not return any value. It declares 9.0 functions, and It has 9.0...
Sema4AI_actions
public
public
0
0
test_whitelist_on_start_run
def test_whitelist_on_start_run(action_server_process: ActionServerProcess,str_regression,tmpdir,client: ActionServerClient,action_server_datadir: Path,) -> None:from action_server_tests.fixtures import fix_openapi_jsonfrom sema4ai.action_server._selftest import sema4ai_action_server_runcalculator = Path(tmpdir) / "v1"...
1
46
5
159
2
135
185
135
action_server_process,str_regression,tmpdir,client,action_server_datadir
['calculator', 'spec']
None
{"Assign": 2, "Expr": 5}
10
51
10
["Path", "calculator.parent.mkdir", "calculator.write_text", "sema4ai_action_server_run", "action_server_process.start", "json.dumps", "fix_openapi_json", "json.loads", "client.get_openapi_json", "str_regression.check"]
0
[]
The function (test_whitelist_on_start_run) defined within the public class called public.The function start at line 135 and ends at 185. It contains 46 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [135.0] and does not return any value. It declares 10.0 functions, and It ...
Sema4AI_actions
public
public
0
0
test_sorting_robolog
def test_sorting_robolog():"""Test the sorting of robolog files."""from sema4ai.action_server._api_run import _sort_robolog_files# Create test file pathstest_files = [Path("output_2.robolog"),Path("output.robolog"),Path("output_1.robolog"),Path("output_10.robolog"),Path("other_3.robolog"),Path("other.robolog"),Path("ot...
2
31
0
119
4
4
42
4
['test_files', 'expected_order', 'actual_order', 'sorted_files']
None
{"Assign": 4, "Expr": 1}
12
39
12
["Path", "Path", "Path", "Path", "Path", "Path", "Path", "Path", "Path", "Path", "Path", "_sort_robolog_files"]
0
[]
The function (test_sorting_robolog) defined within the public class called public.The function start at line 4 and ends at 42. It contains 31 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 12.0 functions, and It has 12.0 funct...
Sema4AI_actions
public
public
0
0
check_mcp_server
async def check_mcp_server(port: int,connection_mode: Literal["mcp", "sse"],headers: dict[str, str] | None = None,use_sema4ai_mcp: bool = True,):"""This method is meant to check that the `resources/no_conda/mcp` implementationis working."""from mcp.client.sse import sse_clientfrom mcp.client.streamable_http import stre...
16
191
4
872
25
10
241
10
port,connection_mode,headers,use_sema4ai_mcp
['client_protocol', 'as_dict', 'prompt_result', 'input_schema', 'expected_mcp', 'tools_list', 'resources', 'resource_templates_list', 'expected_prompt_result', 'resource_content', 'tool_result', 'uris', 'resource', 'tool_content', 'prompts_list', 'found', 'resources_list', 'expected_action_server', 'greet_tool', 'resou...
Returns
{"AnnAssign": 5, "Assign": 33, "Expr": 2, "If": 2, "Return": 1}
29
232
29
["client_protocol", "ClientSession", "session.initialize", "session.list_tools", "len", "next", "session.call_tool", "isinstance", "isinstance", "session.list_prompts", "next", "prompt_with_optional_arg.model_dump", "next", "prompt_without_optional_arg.model_dump", "session.get_prompt", "isinstance", "prompt_result.mod...
0
[]
The function (check_mcp_server) defined within the public class called public.The function start at line 10 and ends at 241. It contains 191 lines of code and it has a cyclomatic complexity of 16. It takes 4 parameters, represented as [10.0], and this function return a value. It declares 29.0 functions, and It has 29....
Sema4AI_actions
public
public
0
0
check_mcp_server_with_actions
async def check_mcp_server_with_actions(port: int,connection_mode: Literal["mcp", "sse"],headers: dict[str, str] | None = None,):"""This method is meant to check that the `resources/no_conda/greeter` actionswork as mcp tools."""from mcp.client.sse import sse_clientfrom mcp.client.streamable_http import streamablehttp_c...
6
74
3
374
10
244
335
244
port,connection_mode,headers
['client_protocol', 'tool_result', 'tool_content', 'tool_names', 'input_schema', 'expected_mcp', 'tools', 'tools_list', 'expected_action_server', 'greet_tool']
Returns
{"AnnAssign": 1, "Assign": 12, "Expr": 2, "If": 1, "Return": 1}
9
92
9
["client_protocol", "ClientSession", "session.initialize", "session.list_tools", "len", "next", "session.call_tool", "isinstance", "isinstance"]
0
[]
The function (check_mcp_server_with_actions) defined within the public class called public.The function start at line 244 and ends at 335. It contains 74 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [244.0], and this function return a value. It declares 9.0 functions, and...
Sema4AI_actions
public
public
0
0
mcp_server_port.on_output
def on_output(line):nonlocal portprint(f"on_output: {line}")lines.append(line)if port is None:match = re.search(r"running on http://[^:]+:(\d+)", line)if match:port = int(match.group(1))
3
8
1
48
0
360
367
360
null
[]
None
null
0
0
0
null
0
null
The function (mcp_server_port.on_output) defined within the public class called public.The function start at line 360 and ends at 367. It contains 8 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
mcp_server_port
def mcp_server_port():import osimport reimport sysfrom action_server_tests.fixtures import get_in_resourcesfrom sema4ai.common.process import Processfrom sema4ai.common.wait_for import wait_for_conditioncp = os.environ.copy()cp["PYTHONPATH"] = os.pathsep.join([x for x in sys.path if x])cp["PYTHONIOENCODING"] = "utf-8"p...
4
30
0
164
5
339
383
339
['port', 'cp', 'match', 'lines', 'process']
None
{"Assign": 8, "Expr": 9, "If": 3}
18
45
18
["os.environ.copy", "os.pathsep.join", "Process", "get_in_resources", "print", "lines.append", "re.search", "int", "match.group", "process.on_stdout.register", "process.on_stderr.register", "process.start", "wait_for_condition", "process.stop", "RuntimeError", "join", "process.stop", "pytest.fixture"]
0
[]
The function (mcp_server_port) defined within the public class called public.The function start at line 339 and ends at 383. 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 18.0 functions, and It has 18.0 functio...
Sema4AI_actions
public
public
0
0
test_mcp_integration
def test_mcp_integration(mcp_server_port: int) -> None:"""Tests that we can check using the "simple_mcp_server.py" (based on thestandard MCP server implementation using their python SDK)."""from functools import partialassert (run_async_in_new_thread(partial(check_mcp_server,mcp_server_port,"mcp",use_sema4ai_mcp=False,...
1
13
1
35
0
386
403
386
mcp_server_port
[]
None
{"Expr": 1}
2
18
2
["run_async_in_new_thread", "partial"]
0
[]
The function (test_mcp_integration) defined within the public class called public.The function start at line 386 and ends at 403. It contains 13 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
test_mcp_integration_with_actions_in_no_conda_greeter
def test_mcp_integration_with_actions_in_no_conda_greeter(action_server_process: ActionServerProcess,) -> None:"""Tests that run the mcp server based on `sema4ai.mcp` bundled in theaction server."""from functools import partialfrom action_server_tests.fixtures import get_in_resourcesroot_dir = get_in_resources("no_cond...
1
22
1
76
1
407
435
407
action_server_process
['root_dir']
None
{"Assign": 1, "Expr": 2}
5
29
5
["get_in_resources", "action_server_process.start", "str", "run_async_in_new_thread", "partial"]
0
[]
The function (test_mcp_integration_with_actions_in_no_conda_greeter) defined within the public class called public.The function start at line 407 and ends at 435. It contains 22 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....
Sema4AI_actions
public
public
0
0
test_mcp_integration_with_actions_in_no_conda_mcp
def test_mcp_integration_with_actions_in_no_conda_mcp(action_server_process: ActionServerProcess,connection_mode: Literal["mcp", "sse"],) -> None:from functools import partialfrom action_server_tests.fixtures import get_in_resourcesroot_dir = get_in_resources("no_conda", "mcp")action_server_process.start(db_file="serve...
1
46
2
154
1
440
490
440
action_server_process,connection_mode
['root_dir']
None
{"Assign": 1, "Expr": 3, "With": 2}
12
51
12
["get_in_resources", "action_server_process.start", "str", "run_async_in_new_thread", "partial", "pytest.raises", "run_async_in_new_thread", "partial", "pytest.raises", "run_async_in_new_thread", "partial", "pytest.mark.parametrize"]
0
[]
The function (test_mcp_integration_with_actions_in_no_conda_mcp) defined within the public class called public.The function start at line 440 and ends at 490. It contains 46 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [440.0] and does not return any value. It declares 12...
Sema4AI_actions
public
public
0
0
test_mcp_integration_secrets.check_with_secrets
async def check_with_secrets():from mcp.client.streamable_http import streamablehttp_clientport = action_server_process.portasync with streamablehttp_client(f"http://localhost:{port}/mcp",headers={"x-my-secret": "FooSecret"}if scenario == "request_header"else None,) as (read_stream,write_stream,*_,):async with ClientSe...
3
25
0
127
0
517
542
517
null
[]
None
null
0
0
0
null
0
null
The function (test_mcp_integration_secrets.check_with_secrets) defined within the public class called public.The function start at line 517 and ends at 542. It contains 25 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
test_mcp_integration_secrets
def test_mcp_integration_secrets(action_server_process: ActionServerProcess,scenario: Literal["env_var", "request_header"],) -> None:from functools import partialfrom action_server_tests.fixtures import get_in_resourcesroot_dir = get_in_resources("no_conda", "mcp")action_server_process.start(db_file="server.db",cwd=str...
2
20
2
91
5
495
544
495
action_server_process,scenario
['port', 'tool_names', 'tools_list', 'root_dir', 'result']
None
{"Assign": 5, "Expr": 2, "Return": 1}
11
50
11
["get_in_resources", "action_server_process.start", "str", "streamablehttp_client", "ClientSession", "session.initialize", "session.list_tools", "session.call_tool", "run_async_in_new_thread", "partial", "pytest.mark.parametrize"]
0
[]
The function (test_mcp_integration_secrets) defined within the public class called public.The function start at line 495 and ends at 544. It contains 20 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [495.0] and does not return any value. It declares 11.0 functions, and It...
Sema4AI_actions
public
public
0
0
test_resource_template_matches
def test_resource_template_matches():from sema4ai.action_server.mcp.setup_mcp_server_from_actions import (McpServerSetupHelper,)setup = McpServerSetupHelper()assert setup._resource_template_matches("https://example.com/resource/{id}", "https://example.com/resource/123") == {"id": "123"}assert setup._resource_template_m...
1
21
0
85
1
1
25
1
['setup']
None
{"Assign": 1}
5
25
5
["McpServerSetupHelper", "setup._resource_template_matches", "setup._resource_template_matches", "setup._resource_template_matches", "setup._resource_template_matches"]
0
[]
The function (test_resource_template_matches) defined within the public class called public.The function start at line 1 and ends at 25. It contains 21 lines of code and it has a cyclomatic complexity of 1. It take 0 parameter, represented as [1.0] and does not return any value. It declares 5.0 functions, and It has 5...
Sema4AI_actions
public
public
0
0
test_collect_and_call_resource.run
async def run(*, inputs: dict, **kwargs):received_inputs.update(inputs)return "run result"
1
3
2
20
0
63
65
63
null
[]
None
null
0
0
0
null
0
null
The function (test_collect_and_call_resource.run) defined within the public class called public.The function start at line 63 and ends at 65. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [63.0] and does not return any value..
Sema4AI_actions
public
public
0
0
test_collect_and_call_resource.call
async def call():from mcp.types import ReadResourceRequest, ReadResourceRequestParamshandler = setup.server.request_handlers[ReadResourceRequest]request = ReadResourceRequest(method="resources/read",params=ReadResourceRequestParams(uri=AnyUrl("https://example.com/resource/123")),)result = await handler(request)return r...
1
11
0
52
0
77
88
77
null
[]
None
null
0
0
0
null
0
null
The function (test_collect_and_call_resource.call) defined within the public class called public.The function start at line 77 and ends at 88. It contains 11 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
test_collect_and_call_resource
def test_collect_and_call_resource():import jsonfrom action_server_tests.fixtures import run_async_in_new_threadfrom pydantic.networks import AnyUrlfrom sema4ai.action_server._models import Actionfrom sema4ai.action_server.mcp.setup_mcp_server_from_actions import (McpServerSetupHelper,)action = Action(id="123",action_p...
1
43
0
195
6
28
93
28
['action', 'received_inputs', 'request', 'setup', 'result', 'handler']
Returns
{"Assign": 7, "Expr": 2, "Return": 2}
15
66
15
["Action", "json.dumps", "json.dumps", "json.dumps", "McpServerSetupHelper", "received_inputs.update", "setup.register_action", "len", "ReadResourceRequest", "ReadResourceRequestParams", "AnyUrl", "handler", "run_async_in_new_thread", "str", "str"]
0
[]
The function (test_collect_and_call_resource) defined within the public class called public.The function start at line 28 and ends at 93. It contains 43 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 15.0 functions, and It...
Sema4AI_actions
public
public
0
0
test_collect_and_call_prompt.run
async def run(*, inputs: dict, **kwargs):received_inputs.update(inputs)return "prompt result"
1
3
2
20
0
129
131
129
null
[]
None
null
0
0
0
null
0
null
The function (test_collect_and_call_prompt.run) defined within the public class called public.The function start at line 129 and ends at 131. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [129.0] and does not return any value..
Sema4AI_actions
public
public
0
0
test_collect_and_call_prompt.call
async def call():from mcp.types import GetPromptRequest, GetPromptRequestParamshandler = setup.server.request_handlers[GetPromptRequest]request = GetPromptRequest(method="prompts/get",params=GetPromptRequestParams(name="test_prompt", arguments={"text": "test input"}),)result = await handler(request)return result
1
11
0
57
0
141
152
141
null
[]
None
null
0
0
0
null
0
null
The function (test_collect_and_call_prompt.call) defined within the public class called public.The function start at line 141 and ends at 152. It contains 11 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
test_collect_and_call_prompt
def test_collect_and_call_prompt():import jsonfrom action_server_tests.fixtures import run_async_in_new_threadfrom sema4ai.action_server._models import Actionfrom sema4ai.action_server.mcp.setup_mcp_server_from_actions import (McpServerSetupHelper,)action = Action(id="123",action_package_id="456",name="test_prompt",doc...
1
39
0
180
6
96
156
96
['action', 'received_inputs', 'request', 'setup', 'result', 'handler']
Returns
{"Assign": 7, "Expr": 2, "Return": 2}
12
61
12
["Action", "json.dumps", "json.dumps", "json.dumps", "McpServerSetupHelper", "received_inputs.update", "setup.register_action", "GetPromptRequest", "GetPromptRequestParams", "handler", "run_async_in_new_thread", "str"]
0
[]
The function (test_collect_and_call_prompt) defined within the public class called public.The function start at line 96 and ends at 156. It contains 39 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 12.0 functions, and It ...
Sema4AI_actions
public
public
0
0
calculator_sum
def calculator_sum(v1: float, v2: float) -> float:"""Sums 2 numbers and returns them.Args:v1: First number.v2: Second number.Returns:The sum of v1 + v2."""return v1 + v2
1
2
2
18
0
5
16
5
v1,v2
[]
float
{"Expr": 1, "Return": 1}
0
12
0
[]
0
[]
The function (calculator_sum) defined within the public class called public.The function start at line 5 and ends at 16. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [5.0] and does not return any value..
Sema4AI_actions
public
public
0
0
broken_action
def broken_action() -> int:"""This always raises an error."""raise RuntimeError("This is broken")return 1
1
3
0
14
0
20
25
20
[]
int
{"Expr": 1, "Return": 1}
1
6
1
["RuntimeError"]
0
[]
The function (broken_action) defined within the public class called public.The function start at line 20 and ends at 25. 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 has 1.0 function called ...
Sema4AI_actions
public
public
0
0
predict_churn
def predict_churn(datasource: ChurnPredictionDataSource | FileChurnDataSource,limit: int = 10,) -> ChurnPredictionResultSet:"""This is a simple query that joins the churn predictor with the churn data.Args:limit: The number of results to return.Returns:A list of churn predictions."""sql = """SELECT t.customerID AS cust...
1
12
2
50
2
19
40
19
datasource,limit
['result', 'sql']
ChurnPredictionResultSet
{"Assign": 2, "Expr": 1, "Return": 1}
3
22
3
["datasource.query", "ChurnPredictionResultSet", "result.build_list"]
0
[]
The function (predict_churn) defined within the public class called public.The function start at line 19 and ends at 40. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [19.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions ...
Sema4AI_actions
public
public
0
0
query_userinfo
def query_userinfo(name: str, datasource: SqliteTestDbDataSource) -> str:"""Query the user information for a user with the given name.Args:name: The name of the user to query.datasource: foobarReturns:The user information as a markdown table."""result = datasource.query("select * from user_info where name = ?", [name])...
1
3
2
32
1
7
19
7
name,datasource
['result']
str
{"Assign": 1, "Expr": 1, "Return": 1}
2
13
2
["datasource.query", "result.to_markdown"]
0
[]
The function (query_userinfo) defined within the public class called public.The function start at line 7 and ends at 19. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [7.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions ca...