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
main
def main(parent_pid: str,server_url: str,verbose: str,expose_url: str,datadir: str,expose_session: str,api_key: str | None,config_logging: bool = True,) -> None:"""Args:parent_pid:The pid of the parent (when the given pid exists, this process mustalso exit itself). If it's an empty string, it's ignored.verbose:A string...
5
29
8
110
0
468
544
468
parent_pid,server_url,verbose,expose_url,datadir,expose_session,api_key,config_logging
[]
None
{"Expr": 4, "If": 2, "Try": 1}
4
77
4
["_setup_logging", "exit_when_pid_exists", "asyncio.run", "expose_server"]
199
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.pystache.tests.test_commands_py.CommandsTestCase.callScript", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3518760_makerbot_pyserial.ez_setup_py.main", "_.content.gdriv...
The function (main) defined within the public class called public.The function start at line 468 and ends at 544. It contains 29 lines of code and it has a cyclomatic complexity of 5. It takes 8 parameters, represented as [468.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions called insi...
Sema4AI_actions
SocketServer
public
0
0
__init__
def __init__(self) -> None:self.event_handlers: dict = {}self._rooms: Dict[str, Set[str]] = {}# List just to hold the callback called to notify that a change happened.self.on_run_change_callback: Optional[Callable[..., Any]] = Noneself._next_id = partial(next, itertools.count(0))self._sid_to_websocket: Dict[str, WebSoc...
1
6
1
74
0
52
59
52
self
[]
None
{"AnnAssign": 4, "Assign": 1}
2
8
2
["partial", "itertools.count"]
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 SocketServer.The function start at line 52 and ends at 59. 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 2.0 functions, It has 2.0 functions called i...
Sema4AI_actions
SocketServer
public
0
0
enter_room
def enter_room(self, sid: str, room: str) -> None:"""Adds an sid to a room."""self._rooms.setdefault(room, set()).add(sid)
1
2
3
33
0
61
65
61
self,sid,room
[]
None
{"Expr": 2}
3
5
3
["add", "self._rooms.setdefault", "set"]
0
[]
The function (enter_room) defined within the public class called SocketServer.The function start at line 61 and ends at 65. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [61.0] and does not return any value. It declares 3.0 functions, and It has 3.0 function...
Sema4AI_actions
SocketServer
public
0
0
leave_room
def leave_room(self, sid: str, room: str) -> None:"""Removes an sid from a room."""sids_in_room = self._rooms.get(room)if sids_in_room:sids_in_room.discard(sid)
2
4
3
35
0
67
73
67
self,sid,room
[]
None
{"Assign": 1, "Expr": 2, "If": 1}
2
7
2
["self._rooms.get", "sids_in_room.discard"]
0
[]
The function (leave_room) defined within the public class called SocketServer.The function start at line 67 and ends at 73. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [67.0] and does not return any value. It declares 2.0 functions, and It has 2.0 function...
Sema4AI_actions
SocketServer
public
0
0
get_room_sids
def get_room_sids(self, room: str) -> Optional[Set[str]]:"""Gets the sids that are in a room.Note: the returned set should not be mutated."""return self._rooms.get(room)
1
2
2
27
0
75
81
75
self,room
[]
Optional[Set[str]]
{"Expr": 1, "Return": 1}
1
7
1
["self._rooms.get"]
0
[]
The function (get_room_sids) defined within the public class called SocketServer.The function start at line 75 and ends at 81. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [75.0] and does not return any value. It declare 1.0 function, and It has 1.0 functio...
Sema4AI_actions
public
public
0
0
on.register
def register(func):self.event_handlers.setdefault(event_name, []).append(func)return func
1
3
1
23
0
88
90
88
null
[]
None
null
0
0
0
null
0
null
The function (on.register) defined within the public class called public.The function start at line 88 and ends at 90. 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
SocketServer
public
0
0
on
def on(self, event_name: str):"""Registers a handler function for a specific event."""def register(func):self.event_handlers.setdefault(event_name, []).append(func)return funcreturn register
1
3
2
14
0
83
92
83
self,event_name
[]
Returns
{"Expr": 2, "Return": 2}
2
10
2
["append", "self.event_handlers.setdefault"]
17
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3578708_ulno_ulnoiot_upy.examples.obsolete.device_types.rgb_single.rgb_handler_py.callback", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3578708_ulno_ulnoiot_upy.examples.obsolete.device_types.rgb_ws2812b.rgb_hand...
The function (on) defined within the public class called SocketServer.The function start at line 83 and ends at 92. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [83.0], and this function return a value. It declares 2.0 functions, It has 2.0 functions called ...
Sema4AI_actions
SocketServer
public
0
0
_gen_id
def _gen_id(self) -> str:"""Generates an identifier used to identify a connection."""return f"client-{self._next_id()}"
1
2
1
11
0
94
98
94
self
[]
str
{"Expr": 1, "Return": 1}
1
5
1
["self._next_id"]
0
[]
The function (_gen_id) defined within the public class called SocketServer.The function start at line 94 and ends at 98. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 function called ...
Sema4AI_actions
SocketServer
public
0
0
emit
async def emit(self, event: str, data=None, *, to: Optional[str | Sequence[str]] = None):"""Emits an event which is sent to the user.Args:to: The client(s) to which the event should be emitted. If notspecified the event is sent to all clients."""notify: Sequence[str]if to is None:# Notify allnotify = tuple(self._sid_to...
7
20
4
128
0
100
132
100
self,event,data,to
[]
None
{"AnnAssign": 1, "Assign": 5, "Expr": 3, "For": 1, "If": 4, "Try": 1}
6
33
6
["tuple", "self._sid_to_websocket.keys", "isinstance", "self._sid_to_websocket.get", "ws.send_json", "log.exception"]
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 SocketServer.The function start at line 100 and ends at 132. It contains 20 lines of code and it has a cyclomatic complexity of 7. It takes 4 parameters, represented as [100.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions calle...
Sema4AI_actions
SocketServer
public
0
0
manage_websocket
async def manage_websocket(self, websocket: WebSocket):"""Registers a client websocket so that it's possible to talk toit from the server."""sid = self._gen_id()self._sid_to_websocket[sid] = websocketawait self._notify("connect", sid)try:while True:data = await websocket.receive_json()if not isinstance(data, dict):log....
8
27
2
153
0
134
168
134
self,websocket
[]
None
{"Assign": 4, "Expr": 10, "If": 3, "Try": 1, "While": 1}
13
35
13
["self._gen_id", "self._notify", "websocket.receive_json", "isinstance", "log.critical", "data.get", "log.critical", "self._notify", "self._notify", "log.debug", "log.exception", "self._notify", "self._sid_to_websocket.pop"]
0
[]
The function (manage_websocket) defined within the public class called SocketServer.The function start at line 134 and ends at 168. It contains 27 lines of code and it has a cyclomatic complexity of 8. It takes 2 parameters, represented as [134.0] and does not return any value. It declares 13.0 functions, and It has 1...
Sema4AI_actions
SocketServer
public
0
0
_notify
async def _notify(self, event: str, sid: str, *args):handlers = self.event_handlers.get(event)if handlers:for handler in handlers:try:await handler(sid, *args)except Exception:log.exception("Unexpected exception in handler.")
4
8
4
53
0
170
177
170
self,event,sid,*args
[]
None
{"Assign": 1, "Expr": 2, "For": 1, "If": 1, "Try": 1}
3
8
3
["self.event_handlers.get", "handler", "log.exception"]
0
[]
The function (_notify) defined within the public class called SocketServer.The function start at line 170 and ends at 177. It contains 8 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [170.0] and does not return any value. It declares 3.0 functions, and It has 3.0 function...
Sema4AI_actions
public
public
0
0
handle_connect
async def handle_connect(sid: str):pass
1
2
1
8
0
184
185
184
sid
[]
None
{}
1
2
1
["_socket_server.on"]
0
[]
The function (handle_connect) defined within the public class called public.The function start at line 184 and ends at 185. 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, and It has 1.0 function call...
Sema4AI_actions
public
public
0
0
handle_disconnect
async def handle_disconnect(sid: str):# print("Disconnected", sid)from sema4ai.action_server._runs_state_cache import get_global_runs_stateglobal_runs_state = get_global_runs_state()with global_runs_state.semaphore:_socket_server.leave_room(sid, "clients_listening_runs")if not _socket_server.get_room_sids("clients_list...
3
9
1
63
1
190
202
190
sid
['global_runs_state']
None
{"Assign": 2, "Expr": 2, "If": 2, "With": 1}
5
13
5
["get_global_runs_state", "_socket_server.leave_room", "_socket_server.get_room_sids", "global_runs_state.unregister", "_socket_server.on"]
0
[]
The function (handle_disconnect) defined within the public class called public.The function start at line 190 and ends at 202. It contains 9 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 function...
Sema4AI_actions
public
public
0
0
handle_echo
async def handle_echo(sid: str, data):# Just echo something (testing)await _socket_server.emit("echo", data, to=sid)
1
2
2
22
0
206
208
206
sid,data
[]
None
{"Expr": 1}
2
3
2
["_socket_server.emit", "_socket_server.on"]
0
[]
The function (handle_echo) defined within the public class called public.The function start at line 206 and ends at 208. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [206.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions ...
Sema4AI_actions
public
public
0
0
handle_request._report_listed_actions
async def _report_listed_actions(message: dict):await _socket_server.emit(message["message_type"], message["data"], to=sid)
1
4
1
26
0
222
225
222
null
[]
None
null
0
0
0
null
0
null
The function (handle_request._report_listed_actions) defined within the public class called public.The function start at line 222 and ends at 225. 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
handle_request.on_listed_actions
def on_listed_actions(message: dict):asyncio.run_coroutine_threadsafe(_report_listed_actions(message), loop)
1
2
1
18
0
227
228
227
null
[]
None
null
0
0
0
null
0
null
The function (handle_request.on_listed_actions) defined within the public class called public.The function start at line 227 and ends at 228. 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
public
public
0
0
handle_request
async def handle_request(sid: str, request_data):from starlette.concurrency import run_in_threadpoolmethod = request_data.get("method")loop = asyncio.get_running_loop()if method == "GET":message_id = request_data.get("message_id")url = request_data.get("url")if url == "/api/actionPackages":async def _report_listed_acti...
3
19
2
78
4
212
238
212
sid,request_data
['method', 'url', 'message_id', 'loop']
None
{"Assign": 4, "Expr": 3, "If": 2}
11
27
11
["request_data.get", "asyncio.get_running_loop", "request_data.get", "request_data.get", "_socket_server.emit", "asyncio.run_coroutine_threadsafe", "_report_listed_actions", "loop.create_task", "run_in_threadpool", "partial", "_socket_server.on"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056683_Yelp_pyramid_swagger.tests.tween_test_py.test_handle_request_returns_request_data"]
The function (handle_request) defined within the public class called public.The function start at line 212 and ends at 238. It contains 19 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [212.0] and does not return any value. It declares 11.0 functions, It has 11.0 functions...
Sema4AI_actions
public
public
0
0
handle_start_listen_run_events
async def handle_start_listen_run_events(sid: str):from sema4ai.action_server._runs_state_cache import get_global_runs_stateglobal_runs_state = get_global_runs_state()loop = asyncio.get_running_loop()with global_runs_state.semaphore:runs = global_runs_state.get_current_run_state()await _report_runs(sid, runs)if not _so...
3
14
1
88
3
242
259
242
sid
['global_runs_state', 'loop', 'runs']
None
{"Assign": 4, "Expr": 3, "If": 2, "With": 1}
9
18
9
["get_global_runs_state", "asyncio.get_running_loop", "global_runs_state.get_current_run_state", "_report_runs", "_socket_server.get_room_sids", "partial", "global_runs_state.register", "_socket_server.enter_room", "_socket_server.on"]
0
[]
The function (handle_start_listen_run_events) defined within the public class called public.The function start at line 242 and ends at 259. It contains 14 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It ha...
Sema4AI_actions
public
public
0
0
_report_runs
async def _report_runs(sid: str, runs: list["Run"]):await _socket_server.emit("runs_collected", [asdict(run) for run in runs], to=sid)
2
2
2
36
0
262
263
262
sid,runs
[]
None
{"Expr": 1}
2
2
2
["_socket_server.emit", "asdict"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_websockets_py.handle_start_listen_run_events"]
The function (_report_runs) defined within the public class called public.The function start at line 262 and ends at 263. It contains 2 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [262.0] and does not return any value. It declares 2.0 functions, It has 2.0 functions call...
Sema4AI_actions
public
public
0
0
_on_run_change_found_in_thread
def _on_run_change_found_in_thread(loop, run_change_event: "RunChangeEvent"):"""Note that this callback is called from a different thread."""asyncio.run_coroutine_threadsafe(_report_change_event(run_change_event), loop)
1
2
2
21
0
266
270
266
loop,run_change_event
[]
None
{"Expr": 2}
2
5
2
["asyncio.run_coroutine_threadsafe", "_report_change_event"]
0
[]
The function (_on_run_change_found_in_thread) defined within the public class called public.The function start at line 266 and ends at 270. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [266.0] and does not return any value. It declares 2.0 functions, and It...
Sema4AI_actions
public
public
0
0
_report_change_event
async def _report_change_event(run_change_event: "RunChangeEvent"):try:# i.e.: send the notification to all connected websockets when found.notify_all = Noneif run_change_event.ev == "added":await _socket_server.emit("run_added", {"run": asdict(run_change_event.run)}, to=notify_all)elif run_change_event.ev == "changed"...
4
20
1
95
1
273
294
273
run_change_event
['notify_all']
None
{"Assign": 1, "Expr": 4, "If": 2, "Try": 1}
5
22
5
["_socket_server.emit", "asdict", "_socket_server.emit", "log.critical", "log.exception"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_websockets_py._on_run_change_found_in_thread"]
The function (_report_change_event) defined within the public class called public.The function start at line 273 and ends at 294. It contains 20 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 5.0 functions, It has 5.0 functions...
Sema4AI_actions
public
public
0
0
_report_mtime_changed
async def _report_mtime_changed():notify_all = Noneawait _socket_server.emit("mtime_changed", [], to=notify_all)
1
3
0
21
1
297
299
297
['notify_all']
None
{"Assign": 1, "Expr": 1}
1
3
1
["_socket_server.emit"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_websockets_py.report_mtime_changed"]
The function (_report_mtime_changed) defined within the public class called public.The function start at line 297 and ends at 299. 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, It has 1.0 function ca...
Sema4AI_actions
public
public
0
0
report_mtime_changed
def report_mtime_changed(loop):"""Note that this callback is called from a different thread."""asyncio.run_coroutine_threadsafe(_report_mtime_changed(), loop)
1
2
1
16
0
302
306
302
loop
[]
None
{"Expr": 2}
2
5
2
["asyncio.run_coroutine_threadsafe", "_report_mtime_changed"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._server_py.start_server"]
The function (report_mtime_changed) defined within the public class called public.The function start at line 302 and ends at 306. 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 ...
Sema4AI_actions
public
public
0
0
websocket_endpoint
async def websocket_endpoint(websocket: WebSocket):await websocket.accept()await _socket_server.manage_websocket(websocket)
1
3
1
20
0
310
312
310
websocket
[]
None
{"Expr": 2}
3
3
3
["websocket.accept", "_socket_server.manage_websocket", "websocket_api_router.websocket"]
0
[]
The function (websocket_endpoint) defined within the public class called public.The function start at line 310 and ends at 312. 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 3.0 functions, and It has 3.0 functio...
Sema4AI_actions
public
public
0
0
_list_actions_in_threadpool
def _list_actions_in_threadpool(on_response_run_coroutine, message_id):from sema4ai.action_server._api_action_package import list_action_packagestry:action_packages = list_action_packages()except Exception:log.exception("Error collection action packages.")action_packages = []on_response_run_coroutine({"message_type": "...
3
16
2
66
1
315
332
315
on_response_run_coroutine,message_id
['action_packages']
None
{"Assign": 2, "Expr": 2, "Try": 1}
4
18
4
["list_action_packages", "log.exception", "on_response_run_coroutine", "asdict"]
0
[]
The function (_list_actions_in_threadpool) defined within the public class called public.The function start at line 315 and ends at 332. It contains 16 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [315.0] and does not return any value. It declares 4.0 functions, and It h...
Sema4AI_actions
public
public
0
0
is_frozen
def is_frozen():if getattr(sys, "frozen", False):return Truetry:__file__except NameError:return Truereturn False
3
8
0
26
0
47
55
47
[]
Returns
{"Expr": 1, "If": 1, "Return": 3, "Try": 1}
1
9
1
["getattr"]
10
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94556497_datawhores_OF_Scraper.ofscraper.utils.system.system_py.get_mulitproc_start_type", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._action_packa...
The function (is_frozen) defined within the public class called public.The function start at line 47 and ends at 55. It contains 8 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 declare 1.0 function, It has 1.0 function called insid...
Sema4AI_actions
public
public
0
0
get_python_exe_from_env
def get_python_exe_from_env(env):python = env.get("PYTHON_EXE")if not python:if is_frozen():raise RuntimeError("Unable to run because no 'package.yaml' was present to bootstrap the environment\n""(note: when the action server is distributed without sources, an 'package.yaml' for ""the target environment is always requi...
3
12
1
38
1
58
70
58
env
['python']
Returns
{"Assign": 2, "If": 2, "Return": 1}
3
13
3
["env.get", "is_frozen", "RuntimeError"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_import_py._add_actions_to_db", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server...
The function (get_python_exe_from_env) defined within the public class called public.The function start at line 58 and ends at 70. It contains 12 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 3.0 functions, It has 3.0 func...
Sema4AI_actions
public
public
0
0
_legacy_get_default_settings_dir
def _legacy_get_default_settings_dir() -> Path:if sys.platform == "win32":localappdata = os.environ.get("LOCALAPPDATA")if not localappdata:raise RuntimeError("Error. LOCALAPPDATA not defined in environment!")path = Path(localappdata) / "robocorp" / ".action_server"else:# Linux/Macpath = Path("~/.robocorp/.action_server...
3
9
0
56
2
73
82
73
['path', 'localappdata']
Path
{"Assign": 3, "If": 2, "Return": 1}
5
10
5
["os.environ.get", "RuntimeError", "Path", "expanduser", "Path"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._settings_py.get_default_settings_dir"]
The function (_legacy_get_default_settings_dir) defined within the public class called public.The function start at line 73 and ends at 82. It contains 9 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 5.0 functions, It has 5.0 ...
Sema4AI_actions
public
public
0
0
get_default_settings_dir
def get_default_settings_dir() -> Path:home_env_var = os.environ.get("SEMA4AI_HOME")if home_env_var:home = Path(home_env_var)else:if sys.platform == "win32":localappdata = os.environ.get("LOCALAPPDATA")if not localappdata:raise RuntimeError("Error. LOCALAPPDATA not defined in environment!")home = Path(localappdata) / "...
5
21
0
117
5
86
126
86
['home_env_var', 'old_dir', 'home', 'localappdata', 'default_settings_dir']
Path
{"Assign": 7, "Expr": 2, "If": 4, "Return": 1}
12
41
12
["os.environ.get", "Path", "os.environ.get", "RuntimeError", "Path", "expanduser", "Path", "_legacy_get_default_settings_dir", "os.path.exists", "log.critical", "bold_red", "default_settings_dir.mkdir"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_helpers_py._get_action_templates_dir_path", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema...
The function (get_default_settings_dir) defined within the public class called public.The function start at line 86 and ends at 126. It contains 21 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 12.0 functions, It has 12.0 func...
Sema4AI_actions
public
public
0
0
get_user_sema4_path
def get_user_sema4_path() -> Path:if sys.platform == "win32":localappdata = os.environ.get("LOCALAPPDATA")if not localappdata:raise RuntimeError("Error. LOCALAPPDATA not defined in environment!")home = Path(localappdata) / "sema4ai"else:# Linux/Machome = Path("~/.sema4ai").expanduser()user_sema4_path = home / "action-s...
3
11
0
71
3
130
142
130
['user_sema4_path', 'home', 'localappdata']
Path
{"Assign": 4, "Expr": 1, "If": 2, "Return": 1}
6
13
6
["os.environ.get", "RuntimeError", "Path", "expanduser", "Path", "user_sema4_path.mkdir"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._settings_py.Settings._create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._storag...
The function (get_user_sema4_path) defined within the public class called public.The function start at line 130 and ends at 142. It contains 11 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 6.0 functions, It has 6.0 functions ...
Sema4AI_actions
Settings
public
0
0
defaults
def defaults(cls):fields = cls.__dataclass_fields__ret = {}SENTINEL = []for name, field in fields.items():v = getattr(field, "default", SENTINEL)if v is not SENTINEL:ret[name] = vreturn ret
3
9
1
53
0
178
186
178
cls
[]
Returns
{"Assign": 5, "For": 1, "If": 1, "Return": 1}
2
9
2
["fields.items", "getattr"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._create_parser"]
The function (defaults) defined within the public class called Settings.The function start at line 178 and ends at 186. It contains 9 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 2.0 functions, It has 2.0 functions called...
Sema4AI_actions
Settings
public
0
0
_create
def _create(cls, args: ArgumentsNamespaceRequiringDatadir | ArgumentsNamespaceDevEnvTask) -> "Settings":from sema4ai.action_server._errors_action_server import (ActionServerValidationError,)user_specified_datadir = args.datadirif not user_specified_datadir:import hashlibcurr_cwd_dir = Path(".").absolute()name = curr_cw...
23
86
2
486
0
189
304
189
cls,args
[]
'Settings'
{"Assign": 24, "Expr": 7, "For": 1, "If": 15, "Return": 1}
38
116
38
["absolute", "Path", "curr_cwd_dir.as_posix", "as_posix.lower", "hexdigest", "hashlib.sha256", "as_posix.encode", "get_default_settings_dir", "log.info", "colored", "expanduser", "Path", "log.info", "expanduser", "Path", "user_expanded_datadir.absolute", "Settings", "hasattr", "hasattr", "setattr", "getattr", "hasattr"...
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3965647_etesync_server.etebase_server.fastapi.routers.collection_py.create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._settings_py.setup_settings...
The function (_create) defined within the public class called Settings.The function start at line 189 and ends at 304. It contains 86 lines of code and it has a cyclomatic complexity of 23. It takes 2 parameters, represented as [189.0] and does not return any value. It declares 38.0 functions, It has 38.0 functions cal...
Sema4AI_actions
Settings
public
0
0
to_uvicorn
def to_uvicorn(self) -> dict:"""Provides keyword arguments that will later be usedto create a `uvicorn.Config` instance."""ret = {"host": self.address,"port": self.port,"reload": False,"log_config": None,}if self.use_https:ret["ssl_keyfile"] = self.ssl_keyfileret["ssl_certfile"] = self.ssl_certfilereturn ret
2
11
1
55
0
306
323
306
self
[]
dict
{"Assign": 3, "Expr": 1, "If": 1, "Return": 1}
0
18
0
[]
0
[]
The function (to_uvicorn) defined within the public class called Settings.The function start at line 306 and ends at 323. It contains 11 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
setup_settings
def setup_settings(args: ArgumentsNamespaceRequiringDatadir | ArgumentsNamespaceDevEnvTask,) -> Iterator[Settings]:global _global_settingssettings = Settings._create(args)_global_settings = settingstry:yield settingsfinally:_global_settings = None
2
10
1
37
2
330
339
330
args
['_global_settings', 'settings']
Iterator[Settings]
{"Assign": 3, "Expr": 1, "Try": 1}
1
10
1
["Settings._create"]
9
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94556497_datawhores_OF_Scraper.ofscraper.utils.settings_py.get_settings", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94556497_datawhores_OF_Scraper.ofscraper.utils.settings_py.resetUserFilters", "_.content.gdrive...
The function (setup_settings) defined within the public class called public.The function start at line 330 and ends at 339. It contains 10 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called i...
Sema4AI_actions
public
public
0
0
get_settings
def get_settings() -> Settings:if _global_settings is None:raise AssertionError("It seems that the settings have not been setup yet.")return _global_settings
2
4
0
18
0
342
345
342
[]
Settings
{"If": 1, "Return": 1}
1
4
1
["AssertionError"]
41
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.81027805_ritheshrkrm_piroautofilterbot.database.ia_filterdb_py.get_search_results", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.81027805_ritheshrkrm_piroautofilterbot.plugins.commands_py.settings", "_.content.gdri...
The function (get_settings) defined within the public class called public.The function start at line 342 and ends at 345. 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 insi...
Sema4AI_actions
public
public
0
0
slugify
def slugify(value: str, allow_unicode: bool = False) -> str:"""Convert to ASCII if 'allow_unicode' is False. Convert spaces or repeateddashes to single dashes. Remove characters that aren't alphanumerics,underscores, or hyphens. Convert to lowercase. Also strip leading andtrailing whitespace, dashes, and underscores.""...
2
7
2
83
1
22
35
22
value,allow_unicode
['value']
str
{"Assign": 3, "Expr": 1, "If": 1, "Return": 1}
8
14
8
["unicodedata.normalize", "decode", "encode", "_remove_accents", "re.sub", "value.lower", "strip", "re.sub"]
39
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.markdown.extensions.headerid_py.HeaderIdTreeprocessor.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3554290_abakan_zz_ablog.ablog.blog_py.Collection.__init__", "_....
The function (slugify) defined within the public class called public.The function start at line 22 and ends at 35. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [22.0] and does not return any value. It declares 8.0 functions, It has 8.0 functions called insid...
Sema4AI_actions
public
public
0
0
_remove_accents
def _remove_accents(input_str):nfkd_form = unicodedata.normalize("NFKD", input_str)return "".join([c for c in nfkd_form if not unicodedata.combining(c)])
3
3
1
36
1
38
40
38
input_str
['nfkd_form']
Returns
{"Assign": 1, "Return": 1}
3
3
3
["unicodedata.normalize", "join", "unicodedata.combining"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._slugify_py.slugify", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.common.src.sema4ai.common.text_py.slugify"]
The function (_remove_accents) defined within the public class called public.The function start at line 38 and ends at 40. It contains 3 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters, and this function return a value. It declares 3.0 functions, It has 3.0 functions cal...
Sema4AI_actions
public
public
0
0
get_storage_path
def get_storage_path() -> Path:"""The path used to store (encrypted) access credentials."""return get_default_settings_dir() / "action_server_storage.json"
1
2
0
13
0
42
46
42
[]
Path
{"Expr": 1, "Return": 1}
1
5
1
["get_default_settings_dir"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._storage_py.get_access_credentials", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._s...
The function (get_storage_path) defined within the public class called public.The function start at line 42 and ends at 46. 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 called in...
Sema4AI_actions
public
public
0
0
get_key_file_path
def get_key_file_path(purpose: Literal["local", "ui"] = "local") -> Path:if purpose == "local":return get_user_sema4_path() / ".storage.key"elif purpose == "ui":return get_user_sema4_path() / ".ui.storage.key"raise AssertionError(f"Unexpected purpose: {purpose}")
3
6
1
44
0
50
56
50
purpose
[]
Path
{"If": 2, "Return": 2}
3
7
3
["get_user_sema4_path", "get_user_sema4_path", "AssertionError"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._storage_py.get_key"]
The function (get_key_file_path) defined within the public class called public.The function start at line 50 and ends at 56. It contains 6 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions calle...
Sema4AI_actions
public
public
0
0
get_key
def get_key(purpose: Literal["local", "ui"] = "local") -> bytes:"""Args:purpose: The purpose for the key'local' means a key used to store settings in the action server locally'ui' means a key used to store settings for the action server UI (runningin a different client).Returns:The bytes to be used for the key."""key_f...
4
19
1
121
2
60
89
60
purpose
['key', 'key_file_path']
bytes
{"Assign": 2, "Expr": 7, "If": 3, "Return": 2, "With": 2}
15
30
15
["get_key_file_path", "key_file_path.exists", "key_file_path.is_file", "key_file_path.stat", "open", "f.read", "log.warning", "key_file_path.unlink", "log.error", "str", "key_file_path.rmdir", "os.urandom", "open", "f.write", "key_file_path.chmod"]
13
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3715200_praekeltfoundation_junebug.junebug.stores_py.InboundMessageStore.get_key", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3715200_praekeltfoundation_junebug.junebug.stores_py.MessageRateStore.get_key", "_.con...
The function (get_key) defined within the public class called public.The function start at line 60 and ends at 89. It contains 19 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 15.0 functions, It has 15.0 functions called insid...
Sema4AI_actions
public
public
0
0
encrypt_value
def encrypt_value(value: str, purpose: Literal["local", "ui"] = "local") -> StorageEncryptedValue:from sema4ai.action_server._encryption import encryptkey = get_key(purpose)iv, encrypted_value, tag = encrypt(key, value.encode("utf-8"))b64_iv = base64.b64encode(iv).decode("utf-8")b64_value = base64.b64encode(encrypted_v...
1
10
2
105
4
92
105
92
value,purpose
['b64_iv', 'b64_value', 'key', 'b64_tag']
StorageEncryptedValue
{"Assign": 5, "Return": 1}
10
14
10
["get_key", "encrypt", "value.encode", "decode", "base64.b64encode", "decode", "base64.b64encode", "decode", "base64.b64encode", "StorageEncryptedValue"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._storage_py.store"]
The function (encrypt_value) defined within the public class called public.The function start at line 92 and ends at 105. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [92.0] and does not return any value. It declares 10.0 functions, It has 10.0 functions ca...
Sema4AI_actions
public
public
0
0
decrypt_value
def decrypt_value(encrypted_value: StorageEncryptedValue, purpose: Literal["local", "ui"] = "local") -> str:from sema4ai.action_server._encryption import decryptkey = get_key(purpose)iv = base64.b64decode(encrypted_value.iv)tag = base64.b64decode(encrypted_value.tag)value = base64.b64decode(encrypted_value.value)decryp...
1
10
2
83
5
108
121
108
encrypted_value,purpose
['decrypted_value', 'value', 'tag', 'key', 'iv']
str
{"Assign": 5, "Return": 1}
6
14
6
["get_key", "base64.b64decode", "base64.b64decode", "base64.b64decode", "decrypt", "decrypted_value.decode"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._storage_py.get_access_credentials"]
The function (decrypt_value) defined within the public class called public.The function start at line 108 and ends at 121. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [108.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions ca...
Sema4AI_actions
public
public
0
0
load_storage
def load_storage() -> typing.Optional[Storage]:"""Load the storage from a file.Returns:File read error."""storage_file_path = get_storage_path()if not storage_file_path.exists():return Nonewith open(storage_file_path, "r") as f:contents = f.read()try:return Storage.model_validate_json(contents)except ValueError:storage...
3
11
0
66
2
125
143
125
['storage_file_path', 'contents']
typing.Optional[Storage]
{"Assign": 2, "Expr": 2, "If": 1, "Return": 2, "Try": 1, "With": 1}
7
19
7
["get_storage_path", "storage_file_path.exists", "open", "f.read", "Storage.model_validate_json", "storage_file_path.unlink", "Exception"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._storage_py.get_access_credentials", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._s...
The function (load_storage) defined within the public class called public.The function start at line 125 and ends at 143. It contains 11 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 7.0 functions, It has 7.0 functions called ...
Sema4AI_actions
public
public
0
0
save_storage
def save_storage(storage: Storage):"""Save the storage to a file and reset the load_cache.Args:Storage contents.Throws:File write error."""storage_file_path = get_storage_path()with open(storage_file_path, "w") as f:f.write(storage.model_dump_json())load_storage.cache_clear()
1
5
1
38
1
146
160
146
storage
['storage_file_path']
None
{"Assign": 1, "Expr": 3, "With": 1}
5
15
5
["get_storage_path", "open", "f.write", "storage.model_dump_json", "load_storage.cache_clear"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._storage_py.store"]
The function (save_storage) defined within the public class called public.The function start at line 146 and ends at 160. 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 5.0 functions, It has 5.0 functions called i...
Sema4AI_actions
public
public
0
0
get_access_credentials
def get_access_credentials() -> typing.Optional[str]:from sema4ai.action_server.vendored_deps.termcolors import bold_redtry:storage = load_storage()if not storage:return Nonereturn decrypt_value(storage.cloud.access_credentials)except Exception as e:log.error(bold_red(f"Failed to get stored access credentials\n{e}"))ra...
3
12
0
64
1
163
175
163
['storage']
typing.Optional[str]
{"Assign": 1, "Expr": 1, "If": 1, "Return": 2, "Try": 1}
6
13
6
["load_storage", "decrypt_value", "log.error", "bold_red", "Exception", "get_storage_path"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_cloud_py.handle_list_organizations_command", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai...
The function (get_access_credentials) defined within the public class called public.The function start at line 163 and ends at 175. It contains 12 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 6.0 functions, It has 6.0 functio...
Sema4AI_actions
public
public
0
0
get_hostname
def get_hostname() -> str:from sema4ai.action_server.vendored_deps.termcolors import bold_redtry:storage = load_storage()if not storage:return DEFAULT_CR_HOSTNAMEhostname = storage.cloud.hostnameexcept Exception as e:log.error(bold_red(f"Failed to get stored hostname\n{e}"))return hostname if hostname else DEFAULT_CR_H...
4
10
0
57
2
178
189
178
['hostname', 'storage']
str
{"Assign": 2, "Expr": 1, "If": 1, "Return": 2, "Try": 1}
3
12
3
["load_storage", "log.error", "bold_red"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_cloud_py.handle_list_organizations_command", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai...
The function (get_hostname) defined within the public class called public.The function start at line 178 and ends at 189. It contains 10 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called ...
Sema4AI_actions
public
public
0
0
store
def store(access_credentials: str, hostname: str) -> None:"""Save the cloud storage to a file and reset the load_cache.Args:access_credentials: Action Server Control Room access credentialshostname: Action Server Control Room hostnameThrows:File write error."""storage_cloud = StorageCloud(access_credentials=encrypt_val...
1
6
2
41
2
192
207
192
access_credentials,hostname
['storage_cloud', 'storage']
None
{"Assign": 2, "Expr": 2}
4
16
4
["StorageCloud", "encrypt_value", "Storage", "save_storage"]
39
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3581153_zetaops_pyoko.pyoko.db.adapter.db_riak_py.Adapter.save_model", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3581153_zetaops_pyoko.pyoko.manage_py.LoadData.save_obj", "_.content.gdrive.MyDrive.Phd_Thesis.Dat...
The function (store) defined within the public class called public.The function start at line 192 and ends at 207. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [192.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions called insi...
Sema4AI_actions
public
public
0
0
get_current_time_as_iso
def get_current_time_as_iso() -> str:return datetime_to_iso(datetime.datetime.now())
1
2
0
17
0
29
30
29
[]
str
{"Return": 1}
2
2
2
["datetime_to_iso", "datetime.datetime.now"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._user_session_py.create_user_session"]
The function (get_current_time_as_iso) defined within the public class called public.The function start at line 29 and ends at 30. 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...
Sema4AI_actions
public
public
0
0
datetime_to_iso
def datetime_to_iso(d: datetime.datetime | float) -> str:"""Accepts a datetime or a float with seconds from epoch."""if isinstance(d, float):d = datetime.datetime.fromtimestamp(d)return d.isoformat()
2
4
1
38
1
33
39
33
d
['d']
str
{"Assign": 1, "Expr": 1, "If": 1, "Return": 1}
3
7
3
["isinstance", "datetime.datetime.fromtimestamp", "d.isoformat"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._api_oauth2_py._update_db_with_token", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server....
The function (datetime_to_iso) defined within the public class called public.The function start at line 33 and ends at 39. 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 ...
Sema4AI_actions
public
public
0
0
iso_to_datetime
def iso_to_datetime(isostr: str) -> datetime.datetime:return datetime.datetime.fromisoformat(isostr)
1
2
1
20
0
42
43
42
isostr
[]
datetime.datetime
{"Return": 1}
1
2
1
["datetime.datetime.fromisoformat"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._api_oauth2_py._should_renew", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._user_se...
The function (iso_to_datetime) defined within the public class called public.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, It has 1.0 function called ins...
Sema4AI_actions
public
public
0
0
create_user_session
def create_user_session(external: bool) -> "UserSession":"""Args:external: when True this session id will allow authenticationtokens to be queried (other sessions don't allow externalclients to request the actual token)."""from sema4ai.action_server._models import UserSession, get_dbdb = get_db()with db.connect():impor...
3
25
1
118
4
46
84
46
external
['created', 'db', 'session_id', 'current_time']
'UserSession'
{"Assign": 5, "Expr": 3, "Return": 1, "Try": 1, "While": 1, "With": 2}
11
39
11
["get_db", "db.connect", "str", "uuid.uuid4", "db.first", "str", "uuid.uuid4", "get_current_time_as_iso", "db.transaction", "UserSession", "db.insert"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._api_oauth2_py.create_reference_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._u...
The function (create_user_session) defined within the public class called public.The function start at line 46 and ends at 84. 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. It declares 11.0 functions, It has 11.0 functions ...
Sema4AI_actions
public
public
0
0
get_user_session_from_id
def get_user_session_from_id(session_id: str, db: "Database") -> "Optional[UserSession]":from sema4ai.action_server._models import UserSessiontry:return db.first(UserSession, "SELECT * FROM user_session WHERE id = ?", [session_id])except KeyError:return None
2
10
2
41
0
87
97
87
session_id,db
[]
'Optional[UserSession]'
{"Return": 2, "Try": 1}
1
11
1
["db.first"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_process_pool_py.ProcessHandle._do_run_action", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4...
The function (get_user_session_from_id) defined within the public class called public.The function start at line 87 and ends at 97. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [87.0] and does not return any value. It declare 1.0 function, It has 1.0 functi...
Sema4AI_actions
public
public
0
0
_get_session_id
def _get_session_id(request: Request) -> str:from sema4ai.action_server._models import get_dbdb = get_db()with db.connect(), db.transaction():session_id = request.cookies.get(COOKIE_SESSION_ID)if not session_id:session_id = create_user_session(external=False).idelse:# There is a session id in the request. Let's check i...
5
30
1
187
6
100
142
100
request
['created_at', 'user_session', 'db', 'now', 'accessed_at', 'session_id']
str
{"Assign": 9, "Expr": 3, "If": 4, "Return": 1, "With": 1}
16
43
16
["get_db", "db.connect", "db.transaction", "request.cookies.get", "create_user_session", "get_user_session_from_id", "create_user_session", "iso_to_datetime", "datetime.datetime.now", "datetime.timedelta", "iso_to_datetime", "datetime.timedelta", "db.execute", "db.execute", "db.execute", "create_user_session"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._user_session_py.SessionScopeContext.__init__"]
The function (_get_session_id) defined within the public class called public.The function start at line 100 and ends at 142. It contains 30 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 16.0 functions, It has 16.0 functions ca...
Sema4AI_actions
public
public
0
0
_set_session_id
def _set_session_id(response: Response, session_id: str) -> None:ONE_DAY = 60 * 60 * 24TWO_WEEKS = ONE_DAY * 14response.set_cookie(COOKIE_SESSION_ID, session_id, max_age=TWO_WEEKS)
1
4
2
37
2
145
148
145
response,session_id
['TWO_WEEKS', 'ONE_DAY']
None
{"Assign": 2, "Expr": 1}
1
4
1
["response.set_cookie"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._user_session_py.SessionScopeContext.response"]
The function (_set_session_id) defined within the public class called public.The function start at line 145 and ends at 148. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [145.0] and does not return any value. It declare 1.0 function, It has 1.0 function call...
Sema4AI_actions
public
public
0
0
_set_session_data
def _set_session_data(session_id: str, key: str, value: JSONValue, expires_at: datetime.datetime) -> None:import jsonfrom sema4ai.action_server._models import TempUserSessionData, get_dbdb = get_db()with db.connect(), db.transaction():_temp_session_data_cleanup(db)db.insert_or_update(TempUserSessionData(user_session_id...
1
17
4
98
1
151
169
151
session_id,key,value,expires_at
['db']
None
{"Assign": 1, "Expr": 2, "With": 1}
8
19
8
["get_db", "db.connect", "db.transaction", "_temp_session_data_cleanup", "db.insert_or_update", "TempUserSessionData", "json.dumps", "datetime_to_iso"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._user_session_py._BaseScopeContext.set_session_data"]
The function (_set_session_data) defined within the public class called public.The function start at line 151 and ends at 169. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [151.0] and does not return any value. It declares 8.0 functions, It has 8.0 function...
Sema4AI_actions
public
public
0
0
_get_session_data
def _get_session_data(session_id: str, key: str, drop: bool) -> JSONValue:"""If drop is True, the data is deleted after being collected(usually the oauth2 authentication just needs a single access)."""import jsonfrom sema4ai.action_server._models import TempUserSessionData, get_dbdb = get_db()with db.connect(), db.tran...
4
23
3
137
3
172
202
172
session_id,key,drop
['db', 'found', 'expires_at']
JSONValue
{"Assign": 3, "Expr": 4, "If": 2, "Return": 3, "Try": 1, "With": 1}
10
31
10
["get_db", "db.connect", "db.transaction", "_temp_session_data_cleanup", "db.first", "datetime.datetime.now", "iso_to_datetime", "db.delete", "db.delete", "json.loads"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._user_session_py._BaseScopeContext.get_session_data"]
The function (_get_session_data) defined within the public class called public.The function start at line 172 and ends at 202. It contains 23 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [172.0] and does not return any value. It declares 10.0 functions, It has 10.0 functi...
Sema4AI_actions
public
public
0
0
_temp_session_data_cleanup
def _temp_session_data_cleanup(db: "Database", now_datetime: datetime.datetime | None = None):from sema4ai.action_server._models import TempUserSessionDataif now_datetime is None:now_datetime = datetime.datetime.now()db.delete_where(TempUserSessionData,"expires_at < ?",[datetime_to_iso(now_datetime)],)
2
11
2
55
1
205
217
205
db,now_datetime
['now_datetime']
None
{"Assign": 1, "Expr": 1, "If": 1}
3
13
3
["datetime.datetime.now", "db.delete_where", "datetime_to_iso"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._user_session_py._get_session_data", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._u...
The function (_temp_session_data_cleanup) defined within the public class called public.The function start at line 205 and ends at 217. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [205.0] and does not return any value. It declares 3.0 functions, It has 3.0...
Sema4AI_actions
_BaseScopeContext
protected
0
0
__init__
def __init__(self, session_id: str):self.session_id = session_id
1
2
2
14
0
221
222
221
self,session_id
[]
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 protected class called _BaseScopeContext.The function start at line 221 and ends at 222. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [221.0] and does not return any value. It has 6243.0 functions calling this funct...
Sema4AI_actions
_BaseScopeContext
protected
0
0
set_session_data
def set_session_data(self, key: str, value: JSONValue, expires_at: datetime.datetime) -> None:_set_session_data(self.session_id, key, value, expires_at)
1
4
4
33
0
224
227
224
self,key,value,expires_at
[]
None
{"Expr": 1}
1
4
1
["_set_session_data"]
0
[]
The function (set_session_data) defined within the protected class called _BaseScopeContext.The function start at line 224 and ends at 227. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [224.0] and does not return any value. It declare 1.0 function, and It h...
Sema4AI_actions
_BaseScopeContext
protected
0
0
get_session_data
def get_session_data(self, key: str, drop: bool) -> JSONValue:return _get_session_data(self.session_id, key, drop)
1
2
3
26
0
229
230
229
self,key,drop
[]
JSONValue
{"Return": 1}
1
2
1
["_get_session_data"]
0
[]
The function (get_session_data) defined within the protected class called _BaseScopeContext.The function start at line 229 and ends at 230. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [229.0] and does not return any value. It declare 1.0 function, and It h...
Sema4AI_actions
_BaseScopeContext
protected
0
0
__init__
def __init__(self, reference_id: str):from sema4ai.action_server._models import get_dbsuper().__init__(session_id=reference_id)db = get_db()with db.connect():user_session = get_user_session_from_id(reference_id, db=db)if user_session is None:raise AssertionError(f"The given reference_id: {reference_id} is not valid")if...
3
10
2
72
0
239
252
239
self,session_id
[]
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 protected class called _BaseScopeContext.The function start at line 239 and ends at 252. It contains 10 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [239.0] and does not return any value. It has 6243.0 functions calling this func...
Sema4AI_actions
_BaseScopeContext
protected
0
0
__init__
def __init__(self, request: Request):super().__init__(_get_session_id(request))self.request = requestself._response: Optional[Response] = None
1
4
2
35
0
256
259
256
self,session_id
[]
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 protected class called _BaseScopeContext.The function start at line 256 and ends at 259. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [256.0] and does not return any value. It has 6243.0 functions calling this funct...
Sema4AI_actions
SessionScopeContext
public
0
1
response
def response(self) -> Optional[Response]:return self._response
1
2
1
14
0
262
263
262
self
[]
Optional[Response]
{"Return": 1}
0
2
0
[]
41
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3660789_mahmoud_clastic.clastic.application_py.Application._dispatch_wsgi", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3715200_praekeltfoundation_junebug.junebug.api_py.JunebugApi.create_channel", "_.content.gdri...
The function (response) defined within the public class called SessionScopeContext, that inherit another class.The function start at line 262 and ends at 263. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 41.0 functio...
Sema4AI_actions
SessionScopeContext
public
0
1
response
def response(self, response: Response):_set_session_id(response, self.session_id)self._response = response
1
3
2
22
0
266
268
266
self
[]
Optional[Response]
{"Return": 1}
0
2
0
[]
41
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3660789_mahmoud_clastic.clastic.application_py.Application._dispatch_wsgi", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3715200_praekeltfoundation_junebug.junebug.api_py.JunebugApi.create_channel", "_.content.gdri...
The function (response) defined within the public class called SessionScopeContext, that inherit another class.The function start at line 266 and ends at 268. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [266.0] and does not return any value. It has 41.0 fun...
Sema4AI_actions
public
public
0
0
session_scope
def session_scope(request: Request) -> Iterator[SessionScopeContext]:scope = SessionScopeContext(request)yield scopeassert (scope.response is not None), "The response must be set to set the cookie (if it was just created)."
1
6
1
31
1
272
277
272
request
['scope']
Iterator[SessionScopeContext]
{"Assign": 1, "Expr": 1}
1
6
1
["SessionScopeContext"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._api_oauth2_py.oauth2_login", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._api_oaut...
The function (session_scope) defined within the public class called public.The function start at line 272 and ends at 277. 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 declare 1.0 function, It has 1.0 function called ins...
Sema4AI_actions
public
public
0
0
referenced_session_scope
def referenced_session_scope(reference_id: str) -> Iterator[ReferencedScopeContext]:scope = ReferencedScopeContext(reference_id)yield scope
1
3
1
20
1
281
284
281
reference_id
['scope']
Iterator[ReferencedScopeContext]
{"Assign": 1, "Expr": 1}
1
4
1
["ReferencedScopeContext"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._api_oauth2_py.oauth2_logout", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._api_oau...
The function (referenced_session_scope) defined within the public class called public.The function start at line 281 and ends at 284. 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, It has 1.0 function...
Sema4AI_actions
ActionServerFileWatcher
public
0
1
__init__
def __init__(self, dirs, do_reload):threading.Thread.__init__(self, name="ActionServerFileWatcher")self.daemon = Trueself._dirs = dirsself._do_reload = do_reloadself._stop_event = threading.Event()
1
6
3
45
0
10
15
10
self,dirs,do_reload
[]
None
{"Assign": 4, "Expr": 1}
2
6
2
["threading.Thread.__init__", "threading.Event"]
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 ActionServerFileWatcher, that inherit another class.The function start at line 10 and ends at 15. 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....
Sema4AI_actions
ActionServerFileWatcher
public
0
1
run
def run(self):import osfrom watchfiles.filters import PythonFilterwatch_dirs = [os.path.abspath(action_package_dir) for action_package_dir in self._dirs]import watchfilesfor _changes in watchfiles.watch(*watch_dirs,watch_filter=PythonFilter(extra_extensions=(".yaml",)),stop_event=self._stop_event,ignore_permission_deni...
3
14
1
72
0
17
34
17
self
[]
None
{"Assign": 1, "Expr": 1, "For": 1}
4
18
4
["os.path.abspath", "watchfiles.watch", "PythonFilter", "self._do_reload"]
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 ActionServerFileWatcher, that inherit another class.The function start at line 17 and ends at 34. It contains 14 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 4.0 funct...
Sema4AI_actions
ActionServerFileWatcher
public
0
1
stop
def stop(self):self._stop_event.set()
1
2
1
12
0
36
37
36
self
[]
None
{"Expr": 1}
1
2
1
["self._stop_event.set"]
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 ActionServerFileWatcher, 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 functi...
Sema4AI_actions
public
public
0
0
_normalize_name
def _normalize_name(name):"""Normalizes action names to handle hyphens and underscores interchangeably."""return name.replace("-", "_").strip()
1
2
1
19
0
4
8
4
name
[]
Returns
{"Expr": 1, "Return": 1}
2
5
2
["strip", "name.replace"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._whitelist_py.accept_action", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._whitelis...
The function (_normalize_name) defined within the public class called public.The function start at line 4 and ends at 8. 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 declares 2.0 functions, It has 2.0 functions calle...
Sema4AI_actions
public
public
0
0
accept_action
def accept_action(pattern: str, package_name: str, action_name: str) -> bool:"""Determines whether an action should be accepted based on the whitelist pattern.Args:pattern: The whitelist pattern to match against.package_name: The name of the package containing the action (can be empty).action_name: The name of the acti...
5
14
3
95
5
11
41
11
pattern,package_name,action_name
['package_name', 'pattern', 'action_pattern', 'package_pattern', 'action_name']
bool
{"Assign": 6, "Expr": 1, "For": 1, "If": 3, "Return": 2}
7
31
7
["_normalize_name", "_normalize_name", "_normalize_name", "pattern.split", "single_pattern.split", "fnmatch.fnmatch", "fnmatch.fnmatch"]
8
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_import_py._add_actions_to_db", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server...
The function (accept_action) defined within the public class called public.The function start at line 11 and ends at 41. It contains 14 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [11.0] and does not return any value. It declares 7.0 functions, It has 7.0 functions calle...
Sema4AI_actions
public
public
0
0
accept_action_package
def accept_action_package(pattern: str, package_name: str) -> bool:"""Determines whether an action package should be accepted based on the whitelist pattern.Args:pattern: The whitelist pattern to match against.package_name: The name of the package containing the action (can be empty).action_name: The name of the action...
4
11
2
72
3
44
70
44
pattern,package_name
['package_name', 'pattern', 'package_pattern']
bool
{"Assign": 4, "Expr": 1, "For": 1, "If": 2, "Return": 2}
5
27
5
["_normalize_name", "_normalize_name", "pattern.split", "single_pattern.split", "fnmatch.fnmatch"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_import_py.import_action_package"]
The function (accept_action_package) defined within the public class called public.The function start at line 44 and ends at 70. It contains 11 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [44.0] and does not return any value. It declares 5.0 functions, It has 5.0 functio...
Sema4AI_actions
public
public
0
0
package_metadata
def package_metadata(action_package_dir: Path, *, datadir: Optional[Path] = None) -> dict:"""Collects metadata from the action package in the target dir and returns it.Args:action_package_dir: The directory with the action package whose metadatashould be collected.datadir: Directory to store the data for operating the ...
3
20
2
106
2
5
42
5
action_package_dir,datadir
['any_return', 'result']
dict
{"AnnAssign": 1, "Assign": 2, "Expr": 2, "If": 2, "Return": 1}
6
38
6
["cmdline.extend", "str", "sema4ai_action_server_run", "str", "json.loads", "RuntimeError"]
0
[]
The function (package_metadata) defined within the public class called public.The function start at line 5 and ends at 42. It contains 20 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [5.0] and does not return any value. It declares 6.0 functions, and It has 6.0 functions...
Sema4AI_actions
public
public
0
0
main
def main(args: Optional[list[str]] = None, *, exit=True) -> int:# noqaimport osimport sysfrom ._cli_impl import _main_retcodeif args is None:args = sys.argv[1:]if not args:# Note this is not to be relied by clients. Added for the build.if os.environ.get("RC_ACTION_SERVER_FORCE_DOWNLOAD_RCC", "").strip().lower() in ("1"...
6
33
2
163
2
22
65
22
args,exit
['args', 'retcode']
int
{"Assign": 2, "Expr": 5, "If": 5, "Return": 1}
13
44
13
["lower", "strip", "os.environ.get", "log.info", "download_rcc", "lower", "strip", "os.environ.get", "log.info", "sys.exit", "_selftest.do_selftest", "_main_retcode", "sys.exit"]
199
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.pystache.tests.test_commands_py.CommandsTestCase.callScript", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3518760_makerbot_pyserial.ez_setup_py.main", "_.content.gdriv...
The function (main) defined within the public class called public.The function start at line 22 and ends at 65. It contains 33 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [22.0] and does not return any value. It declares 13.0 functions, It has 13.0 functions called insid...
Sema4AI_actions
public
public
0
0
is_process_alive
def is_process_alive(pid):"""Check whether the process with the given pid is still alive.Running `os.kill()` on Windows always exits the process, so it can't be used tocheck for an alive process.see: https://docs.python.org/3/library/os.html?highlight=os%20kill#os.killHence ctypes is used to check for the process direc...
4
10
1
48
0
38
63
38
null
[]
None
null
0
0
0
null
0
null
The function (is_process_alive) defined within the public class called public.The function start at line 38 and ends at 63. It contains 10 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
_is_process_alive
def _is_process_alive(pid):"""Check whether the process with the given pid is still alive.Args:pid (int): process IDReturns:bool: False if the process is not alive or don't have permission to check,True otherwise."""if pid < 0:return Falsetry:os.kill(pid, 0)except OSError as e:if e.errno == errno.ESRCH:return False# No...
5
15
1
68
0
68
91
68
null
[]
None
null
0
0
0
null
0
null
The function (_is_process_alive) defined within the public class called public.The function start at line 68 and ends at 91. It contains 15 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
is_process_alive
def is_process_alive(pid):if _is_process_alive(pid):# Check if zombie...try:cmd = ["ps", "-p", str(pid), "-o", "stat"]try:process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)except Exception:log.exception("Error calling: %s.", " ".join(cmd))else:stdout, _ = process.communicate()stdout = stdou...
7
21
1
139
0
93
115
93
null
[]
None
null
0
0
0
null
0
null
The function (is_process_alive) defined within the public class called public.The function start at line 93 and ends at 115. It contains 21 lines of code and it has a cyclomatic complexity of 7. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
exit_when_pid_exists.watch_parent_process
def watch_parent_process():# exit when any of the ids we're tracking exit.while True:for pid in _track_pids_to_exit:if not is_process_alive(pid):# Note: just exit since the parent process already# exited.log.debug(f"Force-quit process: {os.getpid()} because parent: {pid} exited")_os_exit(0)time.sleep(interval)
4
9
0
36
0
125
137
125
null
[]
None
null
0
0
0
null
0
null
The function (exit_when_pid_exists.watch_parent_process) defined within the public class called public.The function start at line 125 and ends at 137. It contains 9 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
exit_when_pid_exists
def exit_when_pid_exists(pid: str | int, interval=PARENT_PROCESS_WATCH_INTERVAL):pid = int(pid)if pid:_track_pids_to_exit.add(pid)global _watching_thread_globalif _watching_thread_global is None:def watch_parent_process():# exit when any of the ids we're tracking exit.while True:for pid in _track_pids_to_exit:if not is...
3
12
2
62
2
118
143
118
pid,interval
['pid', '_watching_thread_global']
None
{"Assign": 3, "Expr": 5, "For": 1, "If": 3, "While": 1}
9
26
9
["int", "_track_pids_to_exit.add", "is_process_alive", "log.debug", "os.getpid", "_os_exit", "time.sleep", "threading.Thread", "_watching_thread_global.start"]
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 (exit_when_pid_exists) defined within the public class called public.The function start at line 118 and ends at 143. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [118.0] and does not return any value. It declares 9.0 functions, It has 9.0 funct...
Sema4AI_actions
public
public
0
0
_os_exit
def _os_exit(retcode: int):"""Kills subprocesses and exits with the given returncode."""try:import psutilcurr_process = psutil.Process()try:try:children_processes = list(curr_process.children(recursive=True))except Exception:# Retry oncechildren_processes = list(curr_process.children(recursive=True))try:names = ",".joi...
10
34
1
199
3
146
192
146
retcode
['children_processes', 'names', 'curr_process']
None
{"Assign": 6, "Expr": 13, "For": 2, "Try": 6}
20
47
20
["psutil.Process", "list", "curr_process.children", "list", "curr_process.children", "join", "x.name", "log.debug", "log.info", "p.kill", "log.debug", "psutil.wait_procs", "p.terminate", "log.debug", "psutil.wait_procs", "log.debug", "sys.stdout.flush", "sys.stderr.flush", "time.sleep", "os._exit"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._preload_actions.preload_actions_autoexit_py.exit_when_pid_exists", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.actions.src...
The function (_os_exit) defined within the public class called public.The function start at line 146 and ends at 192. It contains 34 lines of code and it has a cyclomatic complexity of 10. The function does not take any parameters and does not return any value. It declares 20.0 functions, It has 20.0 functions called i...
Sema4AI_actions
_DummyStdin
protected
0
1
__init__
def __init__(self, original_stdin=sys.stdin, *args, **kwargs):try:self.encoding = sys.stdin.encodingexcept Exception:# Not sure if it's available in all Python versions...passself.original_stdin = original_stdintry:self.errors = (sys.stdin.errors)# Who knew? sys streams have an errors attribute!except Exception:# Not s...
3
12
4
54
0
20
34
20
self,original_stdin,*args,**kwargs
[]
None
{"Assign": 3, "Try": 2}
0
15
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 protected class called _DummyStdin, that inherit another class.The function start at line 20 and ends at 34. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [20.0] and does not return any value. It has 6243.0 function...
Sema4AI_actions
_DummyStdin
protected
0
1
readline
def readline(self, *args, **kwargs):return "\n"
1
2
3
13
0
36
37
36
self,*args,**kwargs
[]
Returns
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3957941_jschneier_django_storages.storages.backends.s3_py.S3File.readline"]
The function (readline) defined within the protected class called _DummyStdin, 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. It takes 3 parameters, represented as [36.0], and this function return a value. It has 1.0 function...
Sema4AI_actions
_DummyStdin
protected
0
1
read
def read(self, *args, **kwargs):return self.readline()
1
2
3
17
0
39
40
39
self,*args,**kwargs
[]
Returns
{"Return": 1}
1
2
1
["self.readline"]
662
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3474748_nzjrs_gnome_tweak_tool.gtweak.utils_py.AutostartFile.is_start_at_login_enabled", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.app.models.pubspec_py.Pubspec.from_archive", "...
The function (read) defined within the protected class called _DummyStdin, 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 3 parameters, represented as [39.0], and this function return a value. It declare 1.0 function...
Sema4AI_actions
_DummyStdin
protected
0
1
write
def write(self, *args, **kwargs):pass
1
2
3
12
0
42
43
42
self,*args,**kwargs
[]
None
{}
0
2
0
[]
120
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3495544_aio_libs_multidict.tests.gen_pickles_py.generate", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.cherrypy.process.plugins_py.PIDFile.start", "_.content.gdrive.My...
The function (write) defined within the protected class called _DummyStdin, 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. It takes 3 parameters, represented as [42.0] and does not return any value. It has 120.0 functions cal...
Sema4AI_actions
_DummyStdin
protected
0
1
flush
def flush(self, *args, **kwargs):pass
1
2
3
12
0
45
46
45
self,*args,**kwargs
[]
None
{}
0
2
0
[]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.pygments.formatters.other_py.RawTokenFormatter.format", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3665904_ldx_python_iptables.tests.test_iptc_py.TestTable.tearDown",...
The function (flush) defined within the protected class called _DummyStdin, 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 3 parameters, represented as [45.0] and does not return any value. It has 5.0 functions calli...
Sema4AI_actions
_DummyStdin
protected
0
1
close
def close(self, *args, **kwargs):pass
1
2
3
12
0
48
49
48
self,*args,**kwargs
[]
None
{}
0
2
0
[]
137
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.__main___py.pre_run_main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3535344_amarian12_e_pool_net.p2pool.util.logging_py.LogFile.reopen", "_.content....
The function (close) defined within the protected class called _DummyStdin, that inherit another class.The function start at line 48 and ends at 49. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [48.0] and does not return any value. It has 137.0 functions cal...
Sema4AI_actions
public
public
0
0
binary_stdio
def binary_stdio():stdin, stdout = sys.stdin.buffer, sys.stdout.buffer# The original stdin cannot be used and anything written to stdout will# be put in the stderr.sys.stdin, sys.stdout = (_DummyStdin(), sys.stderr)return stdin, stdout
1
4
0
40
0
52
59
52
[]
Returns
{"Assign": 2, "Return": 1}
1
8
1
["_DummyStdin"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._preload_actions.preload_actions_server_main_py.main"]
The function (binary_stdio) defined within the public class called public.The function start at line 52 and ends at 59. It contains 4 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, It has 1.0 function called in...
Sema4AI_actions
public
public
0
0
socket_connect
def socket_connect(host, port):import socket as socket_modules = socket_module.socket(socket_module.AF_INET, socket_module.SOCK_STREAM)#Set TCP keepalive on an open socket.#It activates after 1 second (TCP_KEEPIDLE,) of idleness,#then sends a keepalive ping once every 3 seconds (TCP_KEEPINTVL),#and closes the connectio...
7
28
2
181
3
62
98
62
host,port
['s', 'rfile', 'wfile']
Returns
{"Assign": 3, "Expr": 7, "Return": 1, "Try": 5}
11
37
11
["socket_module.socket", "s.setsockopt", "s.setsockopt", "s.setsockopt", "s.setsockopt", "s.settimeout", "s.connect", "s.settimeout", "RuntimeError", "s.makefile", "s.makefile"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._preload_actions.preload_actions_server_main_py.main"]
The function (socket_connect) defined within the public class called public.The function start at line 62 and ends at 98. It contains 28 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [62.0], and this function return a value. It declares 11.0 functions, It has 11.0 function...
Sema4AI_actions
public
public
0
0
add_arguments
def add_arguments(parser):parser.description = "Preload action-server actions"parser.add_argument("--tcp", action="store_true", help="Use TCP server instead of stdio")parser.add_argument("--host", default="127.0.0.1", help="Bind to this address")parser.add_argument("--port", default=-1, type=int, help="Bind to this por...
1
7
1
57
0
101
108
101
parser
[]
None
{"Assign": 1, "Expr": 3}
3
8
3
["parser.add_argument", "parser.add_argument", "parser.add_argument"]
27
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3707904_bernardopires_django_tenant_schemas.src.tenant_schemas.management.commands.__init___py.BaseTenantCommand.add_arguments", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3707904_bernardopires_django_tenant_sche...
The function (add_arguments) defined within the public class called public.The function start at line 101 and ends at 108. 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 3.0 functions, It has 3.0 functions called ...
Sema4AI_actions
_DummyStdin
protected
0
1
__init__
def __init__(self, read_stream, write_stream):try:from preload_actions_streams import (# type: ignoreJsonRpcStreamReaderThread,JsonRpcStreamWriter,)except ImportError:from .preload_actions_streams import (JsonRpcStreamReaderThread,JsonRpcStreamWriter,)from queue import Queueself._readqueue = Queue()self._jsonrpc_stream...
2
17
3
68
0
112
130
112
self,original_stdin,*args,**kwargs
[]
None
{"Assign": 3, "Try": 2}
0
15
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 protected class called _DummyStdin, that inherit another class.The function start at line 112 and ends at 130. It contains 17 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [112.0] and does not return any value. It has 6243.0 funct...
Sema4AI_actions
MessagesHandler
public
0
0
start
def start(self):self._jsonrpc_stream_reader.start()# Removed for now: this messes up the logging because# by the time the imports are done it's important that the# needed scaffolding to collect the log contents is in place.## import io# from contextlib import redirect_stderr, redirect_stdout# Collect actions so that it...
2
5
1
30
0
132
154
132
self
[]
None
{"Assign": 1, "Expr": 2, "While": 1}
3
23
3
["self._jsonrpc_stream_reader.start", "self._readqueue.get", "self._on_message"]
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 MessagesHandler.The function start at line 132 and ends at 154. 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. It declares 3.0 functions, It has 3.0 functions called...
Sema4AI_actions
MessagesHandler
public
0
0
_on_message
def _on_message(self, message):# Original command line is something as:# python = get_python_exe_from_env(env)# cmdline: List[str] = [# python,# "-m",# "sema4ai.actions",# "run",# "--preload-module",# "preload_actions",# "-a",# action.name,# ]## cmdline.append(str(action.file))# cmdline.append(f"--json-input={input_jso...
11
56
2
318
0
156
247
156
self,message
[]
None
{"Assign": 20, "Expr": 8, "For": 1, "If": 4, "Try": 2}
14
92
14
["message.get", "os.environ.pop", "os.environ.pop", "os.environ.pop", "os.environ.pop", "headers.items", "key.upper", "key.upper", "sys.modules.pop", "os.chdir", "cli.main", "self._plugin_manager_kwargs", "traceback.print_exc", "self._jsonrpc_stream_writer.write"]
0
[]
The function (_on_message) defined within the public class called MessagesHandler.The function start at line 156 and ends at 247. It contains 56 lines of code and it has a cyclomatic complexity of 11. It takes 2 parameters, represented as [156.0] and does not return any value. It declares 14.0 functions, and It has 14...
Sema4AI_actions
MessagesHandler
public
0
0
_plugin_manager_kwargs
def _plugin_manager_kwargs(self, managed_parameters) -> Dict[str, Any]:try:# newfrom sema4ai.actions._customization._extension_points import (EPManagedParameters,)from sema4ai.actions._customization._plugin_manager import PluginManagerfrom sema4ai.actions._managed_parameters import ManagedParametersfrom sema4ai.actions...
4
33
2
163
0
249
293
249
self,managed_parameters
[]
Dict[str, Any]
{"Assign": 2, "Expr": 1, "Return": 2, "Try": 3}
5
45
5
["getattr", "PluginManager", "pm.set_instance", "ManagedParameters", "Request.model_validate"]
0
[]
The function (_plugin_manager_kwargs) defined within the public class called MessagesHandler.The function start at line 249 and ends at 293. It contains 33 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [249.0] and does not return any value. It declares 5.0 functions, and ...
Sema4AI_actions
public
public
0
0
main
def main(args=None):original_args = args if args is not None else sys.argv[1:]parser = argparse.ArgumentParser()add_arguments(parser)args = parser.parse_args(args=original_args)if args.tcp:rfile, wfile = socket_connect(args.host, args.port)else:rfile, wfile = binary_stdio()try:import preload_actions_autoexit# type: ign...
5
18
1
117
5
296
318
296
args
['parser', 'args', 'original_args', 'pid', 'server']
None
{"Assign": 7, "Expr": 3, "If": 2, "Try": 1}
9
23
9
["argparse.ArgumentParser", "add_arguments", "parser.parse_args", "socket_connect", "binary_stdio", "os.environ.get", "preload_actions_autoexit.exit_when_pid_exists", "MessagesHandler", "server.start"]
199
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.pystache.tests.test_commands_py.CommandsTestCase.callScript", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3518760_makerbot_pyserial.ez_setup_py.main", "_.content.gdriv...
The function (main) defined within the public class called public.The function start at line 296 and ends at 318. It contains 18 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 9.0 functions, It has 9.0 functions called inside w...
Sema4AI_actions
public
public
0
0
read
def read(stream) -> Optional[str]:"""Reads one message from the stream and returns the message (or None if EOF was reached).:param stream:The stream we should be reading from.:return str|NoneType:The message or None if the stream was closed."""headers = {}while True:# Interpret the http protocol headersline = stream.re...
6
19
1
122
4
26
59
26
stream
['line', 'headers', 'body', 'content_length']
Optional[str]
{"Assign": 7, "Expr": 1, "If": 3, "Return": 2, "Try": 1, "While": 1}
12
34
12
["stream.readline", "decode", "line.strip", "line.split", "RuntimeError", "format", "name.strip", "value.strip", "RuntimeError", "int", "_read_len", "body.decode"]
662
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3474748_nzjrs_gnome_tweak_tool.gtweak.utils_py.AutostartFile.is_start_at_login_enabled", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.app.models.pubspec_py.Pubspec.from_archive", "...
The function (read) defined within the public class called public.The function start at line 26 and ends at 59. It contains 19 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value. It declares 12.0 functions, It has 12.0 functions called inside w...
Sema4AI_actions
public
public
0
0
_read_len
def _read_len(stream, content_length) -> bytes:buf = b""if not content_length:return buf# Grab the bodywhile True:data = stream.read(content_length - len(buf))if not buf and len(data) == content_length:# Common casereturn databuf += dataif len(buf) == content_length:return bufif len(buf) > content_length:raise Assertio...
7
16
2
92
2
62
80
62
stream,content_length
['buf', 'data']
bytes
{"Assign": 2, "AugAssign": 1, "If": 4, "Return": 3, "While": 1}
8
19
8
["stream.read", "len", "len", "len", "len", "AssertionError", "len", "buf.decode"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._preload_actions.preload_actions_streams_py.read"]
The function (_read_len) defined within the public class called public.The function start at line 62 and ends at 80. It contains 16 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [62.0] and does not return any value. It declares 8.0 functions, It has 8.0 functions called in...
Sema4AI_actions
JsonRpcStreamReaderThread
public
0
1
__init__
def __init__(self, rfile, queue, message_consumer):threading.Thread.__init__(self)self._rfile = rfileself._queue = queueself._message_consumer = message_consumerself.name = "JsonRpcStreamReaderThread"self.daemon = True
1
7
4
44
0
85
91
85
self,rfile,queue,message_consumer
[]
None
{"Assign": 5, "Expr": 1}
1
7
1
["threading.Thread.__init__"]
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 JsonRpcStreamReaderThread, that inherit another class.The function start at line 85 and ends at 91. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [85.0] and does not return any value. It declare 1...
Sema4AI_actions
JsonRpcStreamReaderThread
public
0
1
run
def run(self):try:while not self._rfile.closed:data = read(self._rfile)if data is None:log.debug("Read: %s", data)returntry:msg = json.loads(data)except Exception:log.exception("Failed to parse JSON message %s", data)continueif isinstance(msg, dict):# Note: parsing is done on a thread so that we can read# while process...
12
32
1
165
0
93
133
93
self
[]
None
{"Assign": 2, "Expr": 9, "If": 5, "Return": 2, "Try": 3, "While": 1}
15
41
15
["read", "log.debug", "json.loads", "log.exception", "isinstance", "msg.get", "self._message_consumer", "log.exception", "log.debug", "log.debug", "self._queue.put", "isinstance", "msg.get", "log.exception", "self._queue.put"]
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 JsonRpcStreamReaderThread, that inherit another class.The function start at line 93 and ends at 133. It contains 32 lines of code and it has a cyclomatic complexity of 12. The function does not take any parameters and does not return any value. It declares 15.0 ...
Sema4AI_actions
JsonRpcStreamReaderThread
public
0
1
_name
def _name(self):return f"{self.__name} (closed: {self._rfile.closed})"
1
2
1
8
0
136
137
136
self
[]
Returns
{"Return": 1}
0
2
0
[]
19
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70285642_evo_company_hiku.hiku.export.graphql_py.Exporter.visit_field", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70285642_evo_company_hiku.hiku.export.graphql_py.Exporter.visit_fragment", "_.content.gdrive.MyDr...
The function (_name) defined within the public class called JsonRpcStreamReaderThread, that inherit another class.The function start at line 136 and ends at 137. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 19.0 ...
Sema4AI_actions
JsonRpcStreamReaderThread
public
0
1
_name
def _name(self, name):self.__name = name
1
2
2
12
0
140
141
140
self
[]
Returns
{"Return": 1}
0
2
0
[]
19
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70285642_evo_company_hiku.hiku.export.graphql_py.Exporter.visit_field", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70285642_evo_company_hiku.hiku.export.graphql_py.Exporter.visit_fragment", "_.content.gdrive.MyDr...
The function (_name) defined within the public class called JsonRpcStreamReaderThread, that inherit another class.The function start at line 140 and ends at 141. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [140.0], and this function return a value. It has 1...