project_name
string
class_name
string
class_modifiers
string
class_implements
int64
class_extends
int64
function_name
string
function_body
string
cyclomatic_complexity
int64
NLOC
int64
num_parameter
int64
num_token
int64
num_variable
int64
start_line
int64
end_line
int64
function_index
int64
function_params
string
function_variable
string
function_return_type
string
function_body_line_type
string
function_num_functions
int64
function_num_lines
int64
outgoing_function_count
int64
outgoing_function_names
string
incoming_function_count
int64
incoming_function_names
string
lexical_representation
string
Sema4AI_actions
public
public
0
0
test_actions_process_pool_max_concurrent._create_run_in_ctx
def _create_run_in_ctx():# This won't complete until one of the previous context# managers actually return.with _create_run(tmpdir, actions_process_pool, action, 4) as run_info4:return run_info4.future.result()
1
5
0
26
0
252
258
252
null
[]
None
null
0
0
0
null
0
null
The function (test_actions_process_pool_max_concurrent._create_run_in_ctx) defined within the public class called public.The function start at line 252 and ends at 258. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_actions_process_pool_max_concurrent
def test_actions_process_pool_max_concurrent(actions_process_pool: ActionsProcessPool, tmpdir) -> None:actions = actions_process_pool.actionsassert len(actions) == 1action = next(iter(actions))with _create_run(tmpdir, actions_process_pool, action, 1) as run_info1:assert actions_process_pool.get_running_processes_count(...
1
27
2
215
3
230
274
230
actions_process_pool,tmpdir
['action', 'actions', 'fut']
None
{"Assign": 3, "Expr": 1, "Return": 1, "With": 5}
25
45
25
["len", "next", "iter", "_create_run", "actions_process_pool.get_running_processes_count", "_create_run", "actions_process_pool.get_running_processes_count", "_create_run", "actions_process_pool.get_running_processes_count", "run_info1.future.result", "run_info2.future.result", "run_info3.future.result", "actions_proce...
0
[]
The function (test_actions_process_pool_max_concurrent) defined within the public class called public.The function start at line 230 and ends at 274. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [230.0] and does not return any value. It declares 25.0 functi...
Sema4AI_actions
public
public
0
0
test_actions_process_pool_basic
def test_actions_process_pool_basic(actions_process_pool: ActionsProcessPool):actions = actions_process_pool.actionsassert len(actions) == 1action = next(iter(actions))assert actions_process_pool.get_idle_processes_count() == 2assert actions_process_pool.get_running_processes_count() == 0with actions_process_pool.obtai...
1
18
1
137
2
277
300
277
actions_process_pool
['action', 'actions']
None
{"Assign": 2, "With": 3}
14
24
14
["len", "next", "iter", "actions_process_pool.get_idle_processes_count", "actions_process_pool.get_running_processes_count", "actions_process_pool.obtain_process_for_action", "actions_process_pool.get_idle_processes_count", "actions_process_pool.get_running_processes_count", "actions_process_pool.obtain_process_for_act...
0
[]
The function (test_actions_process_pool_basic) defined within the public class called public.The function start at line 277 and ends at 300. It contains 18 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 14.0 functions, and It ...
Sema4AI_actions
public
public
0
0
get_internal_version_location
def get_internal_version_location(version: str) -> Path:import osimport sysif sys.platform == "win32":app_data_dir = os.getenv("LOCALAPPDATA")if not app_data_dir:raise RuntimeError("LOCALAPPDATA environment variable is not set")target_path = os.path.join(app_data_dir, "sema4ai", "bin", "action-server", "internal")else:...
3
16
1
92
3
4
21
4
version
['app_data_dir', 'home_dir', 'target_path']
Path
{"Assign": 4, "If": 2, "Return": 1}
6
18
6
["os.getenv", "RuntimeError", "os.path.join", "os.path.expanduser", "os.path.join", "Path"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_binary_py.test_binary_build"]
The function (get_internal_version_location) defined within the public class called public.The function start at line 4 and ends at 21. It contains 16 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 fun...
Sema4AI_actions
public
public
0
0
test_binary_build.run_executable
def run_executable():proc = subprocess.Popen([target_executable, "-h"],cwd=action_server_dir,env=env,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,)stdout, _ = proc.communicate()return stdout.decode("utf-8", errors="replace")
1
10
0
57
0
85
94
85
null
[]
None
null
0
0
0
null
0
null
The function (test_binary_build.run_executable) defined within the public class called public.The function start at line 85 and ends at 94. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_binary_build
def test_binary_build():import osimport shutilimport sysfrom sema4ai.common.run_in_thread import run_in_threadCURDIR = Path(__file__).absolute().parentaction_server_dir = CURDIR.parent.parentassert (action_server_dir / "pyproject.toml").exists()import subprocessenv = os.environ.copy()env.pop("PYTHONPATH", "")env.pop("P...
14
84
0
428
20
24
138
24
['outputs', 'dist_dir', 'assets', 'fut2', 'proc', 'futures', 'extracted_location', 'fut1', 'extracted', 'CURDIR', 'skipped', 'fut3', 'env', 'go_wrapper_name', 'target_executable', 'build_executable_output', 'full_outputs', 'version', 'action_server_dir', 'asset_path']
Returns
{"Assign": 23, "AugAssign": 2, "Expr": 8, "For": 2, "If": 6, "Return": 1, "Try": 3}
34
115
34
["absolute", "Path", "exists", "os.environ.copy", "env.pop", "env.pop", "env.pop", "os.getpid", "target_executable.exists", "os.remove", "RuntimeError", "asset_path.exists", "asset_path.unlink", "os.getpid", "subprocess.check_output", "target_executable.exists", "subprocess.Popen", "proc.communicate", "stdout.decode", ...
0
[]
The function (test_binary_build) defined within the public class called public.The function start at line 24 and ends at 138. It contains 84 lines of code and it has a cyclomatic complexity of 14. The function does not take any parameters, and this function return a value. It declares 34.0 functions, and It has 34.0 f...
Sema4AI_actions
public
public
0
0
test_version
def test_version() -> None:from action_server_tests.fixtures import sema4ai_action_server_runfrom sema4ai.action_server import __version__result = sema4ai_action_server_run(["version"], returncode=0)assert result.stdout.strip() == __version__
1
5
0
40
1
9
15
9
['result']
None
{"Assign": 1}
2
7
2
["sema4ai_action_server_run", "result.stdout.strip"]
0
[]
The function (test_version) defined within the public class called public.The function start at line 9 and ends at 15. 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 2.0 functions, and It has 2.0 functions called...
Sema4AI_actions
public
public
0
0
test_download_rcc
def test_download_rcc(tmpdir) -> None:from action_server_tests.fixtures import sema4ai_action_server_runrcc_location = tmpdir / ("rcc.exe" if sys.platform == "win32" else "rcc")sema4ai_action_server_run(["download-rcc", "--file", rcc_location], returncode=0)assert os.path.exists(rcc_location)
2
5
1
51
1
19
24
19
tmpdir
['rcc_location']
None
{"Assign": 1, "Expr": 1}
2
6
2
["sema4ai_action_server_run", "os.path.exists"]
0
[]
The function (test_download_rcc) defined within the public class called public.The function start at line 19 and ends at 24. 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 2.0 functions, and It has 2.0 functions ...
Sema4AI_actions
public
public
0
0
test_new
def test_new(tmpdir, action_server_process: ActionServerProcess, client: ActionServerClient) -> None:from sema4ai.action_server._selftest import check_new_templatecheck_new_template(tmpdir, action_server_process, client)
1
5
3
31
0
28
33
28
tmpdir,action_server_process,client
[]
None
{"Expr": 1}
1
6
1
["check_new_template"]
0
[]
The function (test_new) defined within the public class called public.The function start at line 28 and ends at 33. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [28.0] and does not return any value. It declare 1.0 function, and It has 1.0 function called in...
Sema4AI_actions
public
public
0
0
test_new_list_templates
def test_new_list_templates(tmpdir) -> None:import jsonfrom sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["new", "list-templates"], returncode=0, cwd=tmpdir)assert "Minimal" in output.stderrassert "Basic" in output.stderrassert "Advanced" in output.stderroutput = se...
2
22
1
124
2
37
64
37
tmpdir
['template_names', 'output']
None
{"AnnAssign": 1, "Assign": 3}
4
28
4
["sema4ai_action_server_run", "sema4ai_action_server_run", "json.loads", "template.get"]
0
[]
The function (test_new_list_templates) defined within the public class called public.The function start at line 37 and ends at 64. It contains 22 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 fun...
Sema4AI_actions
public
public
0
0
fix_eol
def fix_eol(text: str) -> str:return text.replace("\r\n", "\n").replace("\r", "\n").strip()
1
2
1
29
0
67
68
67
text
[]
str
{"Return": 1}
3
2
3
["strip", "replace", "text.replace"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_cli_py.test_help"]
The function (fix_eol) defined within the public class called public.The function start at line 67 and ends at 68. 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 3.0 functions, It has 3.0 functions called inside w...
Sema4AI_actions
public
public
0
0
test_help
def test_help(args, str_regression, datadir):import refrom action_server_tests.fixtures import sema4ai_action_server_runresult = sema4ai_action_server_run(args, returncode=0)out = re.sub(r"\(\d+.\d+.\d+\)", "(<version>)", result.stdout)out = fix_eol(out)v2_expected = datadir / f"test_help_{args[0]}_v2.txt"if v2_expecte...
3
12
3
88
4
81
95
81
args,str_regression,datadir
['v2_expected', 'out', 'result', 'found']
None
{"Assign": 5, "Expr": 1, "If": 2, "Return": 1}
8
15
8
["sema4ai_action_server_run", "re.sub", "fix_eol", "v2_expected.exists", "v2_expected.read_text", "fix_eol", "str_regression.check", "pytest.mark.parametrize"]
0
[]
The function (test_help) defined within the public class called public.The function start at line 81 and ends at 95. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [81.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functions call...
Sema4AI_actions
public
public
0
0
test_migrate
def test_migrate(database_v0):from action_server_tests.fixtures import sema4ai_action_server_runfrom sema4ai.action_server.migrations import MigrationStatus, db_migration_statusdb_path = database_v0assert db_migration_status(db_path) == MigrationStatus.NEEDS_MIGRATIONsema4ai_action_server_run(["migrate","--datadir",str...
1
16
1
72
1
99
117
99
database_v0
['db_path']
None
{"Assign": 1, "Expr": 1}
5
19
5
["db_migration_status", "sema4ai_action_server_run", "str", "str", "db_migration_status"]
0
[]
The function (test_migrate) defined within the public class called public.The function start at line 99 and ends at 117. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 functions cal...
Sema4AI_actions
public
public
0
0
test_default_datadir
def test_default_datadir(tmpdir):from pathlib import Pathfrom sema4ai.action_server._cli_impl import _create_parserfrom sema4ai.action_server._settings import setup_settingsuse_dir = Path(tmpdir) / "foobar"curdir = Path(".").absolute()try:use_dir.mkdir(parents=True, exist_ok=True)os.chdir(str(use_dir.absolute()))parser...
2
15
1
115
4
120
138
120
tmpdir
['parser', 'use_dir', 'curdir', 'base_args']
None
{"Assign": 4, "Expr": 3, "Try": 1, "With": 1}
13
19
13
["Path", "absolute", "Path", "use_dir.mkdir", "os.chdir", "str", "use_dir.absolute", "_create_parser", "parser.parse_args", "setup_settings", "settings.datadir.name.startswith", "os.chdir", "str"]
0
[]
The function (test_default_datadir) defined within the public class called public.The function start at line 120 and ends at 138. It contains 15 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 13.0 functions, and It has 13.0 fu...
Sema4AI_actions
public
public
0
0
test_datadir_user_specified
def test_datadir_user_specified(tmpdir):from pathlib import Pathfrom sema4ai.action_server._cli_impl import _create_parserfrom sema4ai.action_server._settings import setup_settingsuse_dir = Path(tmpdir) / "foobar"parser = _create_parser()base_args = parser.parse_args(["start", "--datadir", str(use_dir)])with setup_sett...
1
9
1
72
3
141
153
141
tmpdir
['parser', 'use_dir', 'base_args']
None
{"Assign": 3, "With": 1}
6
13
6
["Path", "_create_parser", "parser.parse_args", "str", "setup_settings", "Path"]
0
[]
The function (test_datadir_user_specified) defined within the public class called public.The function start at line 141 and ends at 153. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6....
Sema4AI_actions
public
public
0
0
test_package_update
def test_package_update(tmpdir, str_regression, op):from pathlib import Pathfrom action_server_tests.fixtures import sema4ai_action_server_runtmp = Path(tmpdir)robot_yaml = tmp / "robot.yaml"robot_yaml.write_text("""environmentConfigs:- environment_windows_amd64_freeze.yaml- environment_linux_amd64_freeze.yaml- environ...
5
66
3
318
4
160
235
160
tmpdir,str_regression,op
['robot_yaml', 'result', 'tmp', 'conda_yaml']
None
{"Assign": 7, "Expr": 3, "If": 4}
24
76
24
["Path", "robot_yaml.write_text", "conda_yaml.write_text", "sema4ai_action_server_run", "sema4ai_action_server_run", "exists", "exists", "exists", "sema4ai_action_server_run", "exists", "exists", "exists", "sema4ai_action_server_run", "exists", "exists", "exists", "sema4ai_action_server_run", "exists", "exists", "exist...
0
[]
The function (test_package_update) defined within the public class called public.The function start at line 160 and ends at 235. It contains 66 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [160.0] and does not return any value. It declares 24.0 functions, and It has 24.0...
Sema4AI_actions
public
public
0
0
test_oauth2_sema4ai_config
def test_oauth2_sema4ai_config(tmpdir) -> None:from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["oauth2"], returncode=1, cwd=tmpdir)assert "Command for oauth2 operation not specified." in output.stderr# Return code assertion happens inside the call.sema4ai_action_...
1
5
1
53
1
239
247
239
tmpdir
['output']
None
{"Assign": 1, "Expr": 1}
2
9
2
["sema4ai_action_server_run", "sema4ai_action_server_run"]
0
[]
The function (test_oauth2_sema4ai_config) defined within the public class called public.The function start at line 239 and ends at 247. 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 2.0 functions, and It has 2.0...
Sema4AI_actions
public
public
0
0
test_cloud_list_organizations
def test_cloud_list_organizations(data_regression):import jsonfrom sema4ai.action_server._selftest import sema4ai_action_server_runaccess_credentials = os.environ.get("ACTION_SERVER_TEST_ACCESS_CREDENTIALS")assert (access_credentials), "ACTION_SERVER_TEST_ACCESS_CREDENTIALS environment required for test."output = sema4...
1
20
1
86
2
4
25
4
data_regression
['output', 'access_credentials']
None
{"Assign": 2, "Expr": 1}
6
22
6
["os.environ.get", "sema4ai_action_server_run", "os.environ.get", "os.environ.get", "data_regression.check", "json.loads"]
0
[]
The function (test_cloud_list_organizations) defined within the public class called public.The function start at line 4 and ends at 25. It contains 20 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6....
Sema4AI_actions
public
public
0
0
wheel_path
def wheel_path(tmpdir, datadir) -> Path:import subprocesscreate_wheel_dir = datadir / "create_wheel"# python3 setup.py bdist_wheelsubprocess.run([sys.executable, "-m", "pip", "wheel", "."], cwd=create_wheel_dir)wheels_found = list(create_wheel_dir.glob("*.whl"))assert len(wheels_found) == 1, f"Expected one wheel. Found...
1
7
2
64
2
8
17
8
tmpdir,datadir
['create_wheel_dir', 'wheels_found']
Path
{"Assign": 2, "Expr": 1, "Return": 1}
4
10
4
["subprocess.run", "list", "create_wheel_dir.glob", "len"]
0
[]
The function (wheel_path) defined within the public class called public.The function start at line 8 and ends at 17. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [8.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions called...
Sema4AI_actions
public
public
0
0
test_package_update
def test_package_update(tmpdir, data_regression):import ioimport yamlfrom sema4ai.action_server.vendored_deps.action_package_handling import (update_package,)tmp = Path(tmpdir)conda_yaml = tmp / "conda.yaml"conda_yaml.write_text("""channels:- conda-forgedependencies:- python=3.10.12- pip=23.2.1- robocorp-truststore=0.8...
1
35
2
121
3
20
59
20
tmpdir,data_regression
['stream', 'tmp', 'conda_yaml']
None
{"Assign": 3, "Expr": 4, "With": 1}
10
40
10
["Path", "conda_yaml.write_text", "io.StringIO", "update_package", "exists", "update_package", "exists", "open", "data_regression.check", "yaml.safe_load"]
0
[]
The function (test_package_update) defined within the public class called public.The function start at line 20 and ends at 59. It contains 35 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [20.0] and does not return any value. It declares 10.0 functions, and It has 10.0 fu...
Sema4AI_actions
public
public
0
0
test_create_new_project_download_metadata_fail
def test_create_new_project_download_metadata_fail(log_warning_mock: mock.MagicMock, log_critical_mock: mock.MagicMock, _, tmpdir) -> None:from sema4ai.action_server._new_project import handle_new_projecttemplates_path = tmpdir / "action-templates"project_path = tmpdir / "my_project"with mock.patch("sema4ai.action_serv...
1
17
4
114
5
22
43
22
log_warning_mock,log_critical_mock,_,tmpdir
['log_critical_args', 'retcode', 'project_path', 'log_warning_args', 'templates_path']
None
{"Assign": 6, "With": 1}
6
22
6
["mock.patch", "handle_new_project", "os.path.isfile", "mock.patch", "mock.patch", "mock.patch"]
0
[]
The function (test_create_new_project_download_metadata_fail) defined within the public class called public.The function start at line 22 and ends at 43. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [22.0] and does not return any value. It declares 6.0 func...
Sema4AI_actions
public
public
0
0
test_create_new_project_download_metadata_fail_with_cached_templates
def test_create_new_project_download_metadata_fail_with_cached_templates(log_info_mock: mock.MagicMock,log_warning_mock: mock.MagicMock,log_critical_mock: mock.MagicMock,_,tmpdir,) -> None:from action_server_tests.fixtures import get_in_resourcesfrom sema4ai.action_server._new_project import handle_new_projecttemplates...
1
46
5
262
8
62
124
62
log_info_mock,log_warning_mock,log_critical_mock,_,tmpdir
['retcode', 'resources_templates_dir', 'initial_package_yaml_content', 'project_path', 'log_warning_args', 'templates_path', 'package_yaml_path', 'log_info_args']
None
{"Assign": 11, "Expr": 7, "With": 1}
20
63
20
["get_in_resources", "os.makedirs", "shutil.copyfile", "shutil.copyfile", "mock.patch", "project_path.mkdir", "write_text", "handle_new_project", "os.path.isfile", "log_critical_mock.assert_not_called", "package_yaml_path.read_text", "package_yaml_path.write_text", "handle_new_project", "package_yaml_path.read_text", "...
0
[]
The function (test_create_new_project_download_metadata_fail_with_cached_templates) defined within the public class called public.The function start at line 62 and ends at 124. It contains 46 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [62.0] and does not return any valu...
Sema4AI_actions
public
public
0
0
test_list_templates_no_templates_available
def test_list_templates_no_templates_available(print_mock: mock.MagicMock, log_info_mock: mock.MagicMock, _, tmpdir) -> None:from sema4ai.action_server._new_project import handle_list_templatesfrom sema4ai.action_server._new_project_helpers import ActionTemplatesMetadatawith mock.patch("sema4ai.action_server._new_proje...
1
22
4
129
3
138
164
138
print_mock,log_info_mock,_,tmpdir
['print_args', 'retcode', 'log_info_args']
None
{"Assign": 5, "With": 1}
7
27
7
["mock.patch", "ActionTemplatesMetadata", "handle_list_templates", "handle_list_templates", "mock.patch", "mock.patch", "mock.patch"]
0
[]
The function (test_list_templates_no_templates_available) defined within the public class called public.The function start at line 138 and ends at 164. It contains 22 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [138.0] and does not return any value. It declares 7.0 funct...
Sema4AI_actions
public
public
0
0
test_action_server_new_force_flag
def test_action_server_new_force_flag(datadir):from sema4ai.action_server._selftest import sema4ai_action_server_runproject_path = datadir / "my_project"project_path.mkdir()package_yaml_path = project_path / "package.yaml"package_yaml_path.write_text("foo", encoding="utf-8")assert package_yaml_path.read_text(encoding="...
1
20
1
86
2
167
188
167
datadir
['project_path', 'package_yaml_path']
None
{"Assign": 2, "Expr": 3}
5
22
5
["project_path.mkdir", "package_yaml_path.write_text", "package_yaml_path.read_text", "sema4ai_action_server_run", "package_yaml_path.read_text"]
0
[]
The function (test_action_server_new_force_flag) defined within the public class called public.The function start at line 167 and ends at 188. It contains 20 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, and It...
Sema4AI_actions
public
public
0
0
test_data_package_metadata
def test_data_package_metadata(datadir, data_regression):import jsonfrom action_server_tests.fixtures import fix_metadata, get_in_resourcesfrom sema4ai.action_server._selftest import sema4ai_action_server_rundata_package = get_in_resources("data_package")output = sema4ai_action_server_run(["package","metadata","--input...
1
18
2
83
2
1
21
1
datadir,data_regression
['output', 'data_package']
None
{"Assign": 2, "Expr": 1}
7
21
7
["get_in_resources", "sema4ai_action_server_run", "str", "str", "data_regression.check", "fix_metadata", "json.loads"]
0
[]
The function (test_data_package_metadata) defined within the public class called public.The function start at line 1 and ends at 21. It contains 18 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1.0] and does not return any value. It declares 7.0 functions, and It has 7.0...
Sema4AI_actions
public
public
0
0
test_foreign_keys_validation
def test_foreign_keys_validation(tmpdir) -> None:from sema4ai.action_server._database import DBErrordb = Database(tmpdir / "test_foreign_keys_validation.db")with db.connect():db.initialize([SomeActionPackage, SomeAction])with db.transaction():db.create_tables(_db_rules)with db.transaction():with pytest.raises(DBError):...
1
17
1
136
1
57
76
57
tmpdir
['db']
None
{"Assign": 1, "Expr": 5, "With": 5}
14
20
14
["Database", "db.connect", "db.initialize", "db.transaction", "db.create_tables", "db.transaction", "pytest.raises", "db.insert", "SomeAction", "db.transaction", "db.insert", "SomeActionPackage", "db.insert", "SomeAction"]
0
[]
The function (test_foreign_keys_validation) defined within the public class called public.The function start at line 57 and ends at 76. It contains 17 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 14.0 functions, and It has 1...
Sema4AI_actions
public
public
0
0
test_database_schema_evolution
def test_database_schema_evolution(str_regression) -> None:from sema4ai.action_server._models import get_all_model_classes, get_model_db_rulesdb = Database(":memory:")all_model_classes = get_all_model_classes()model_db_rules = get_model_db_rules()db.register_classes(all_model_classes)s = []for cls in all_model_classes:...
4
22
1
103
5
79
102
79
str_regression
['new_lines', 'model_db_rules', 'db', 'all_model_classes', 's']
None
{"Assign": 5, "Expr": 5, "For": 1}
15
24
15
["Database", "get_all_model_classes", "get_model_db_rules", "db.register_classes", "s.append", "strip", "db.create_table_sql", "s.extend", "x.strip", "db.create_unique_indexes_sql", "s.extend", "x.strip", "db.create_non_unique_indexes_sql", "str_regression.check", "new_lines.join"]
0
[]
The function (test_database_schema_evolution) defined within the public class called public.The function start at line 79 and ends at 102. It contains 22 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, and It ha...
Sema4AI_actions
public
public
0
0
test_counters._update_counter
def _update_counter(db):with db.cursor() as cursor:db.execute_update_returning(cursor,"UPDATE counter SET value=value+1 WHERE id=? RETURNING value",["foobar"],)return cursor.fetchall()[0][0]
1
8
1
39
0
113
120
113
null
[]
None
null
0
0
0
null
0
null
The function (test_counters._update_counter) defined within the public class called public.The function start at line 113 and ends at 120. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_counters.in_thread
def in_thread(ev: threading.Event,future1: futures.Future[int],future2: futures.Future[typing.Any],):try:db = Database(f)with db.connect():with db.transaction():future1.set_result(_update_counter(db))ev.wait()except Exception as e:future2.set_exception(e)else:future2.set_result("worked")
2
15
3
85
0
124
138
124
null
[]
None
null
0
0
0
null
0
null
The function (test_counters.in_thread) defined within the public class called public.The function start at line 124 and ends at 138. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [124.0] and does not return any value..
Sema4AI_actions
public
public
0
0
test_counters
def test_counters(tmpdir) -> None:from sema4ai.action_server._database import DBError@dataclassclass Counter:id: strvalue: intdef _update_counter(db):with db.cursor() as cursor:db.execute_update_returning(cursor,"UPDATE counter SET value=value+1 WHERE id=? RETURNING value",["foobar"],)return cursor.fetchall()[0][0]f = ...
2
35
1
233
3
105
180
105
tmpdir
['ev', 'db', 'f']
None
{"AnnAssign": 4, "Assign": 4, "Expr": 11, "Return": 1, "Try": 2, "With": 9}
37
76
37
["db.cursor", "db.execute_update_returning", "cursor.fetchall", "Path", "str", "Database", "db.connect", "db.transaction", "future1.set_result", "_update_counter", "ev.wait", "future2.set_exception", "future2.set_result", "Database", "db.connect", "db.initialize", "db.transaction", "db.create_tables", "db.insert", "Cou...
0
[]
The function (test_counters) defined within the public class called public.The function start at line 105 and ends at 180. It contains 35 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 37.0 functions, and It has 37.0 functions...
Sema4AI_actions
public
public
0
0
test_migrate
def test_migrate(database_v0: Path, tmpdir) -> None:from sema4ai.action_server._models import Action, create_dbfrom sema4ai.action_server.migrations import (CURRENT_VERSION,MIGRATION_ID_TO_NAME,Migration,MigrationStatus,db_migration_status,migrate_db,)base_path = tmpdir / "check.db"with create_db(base_path) as base_db:...
3
42
2
211
6
183
230
183
database_v0,tmpdir
['base_path', 'base_indexes', 'db_path', 'db', 'actions', 'base_table_and_columns']
None
{"Assign": 6, "For": 1, "With": 3}
19
48
19
["create_db", "base_db.connect", "base_db.list_table_and_columns", "base_db.list_indexes", "db_migration_status", "migrate_db", "db_migration_status", "Database", "db.connect", "sorted", "db.list_table_names", "sorted", "db.all", "Migration", "MIGRATION_ID_TO_NAME.items", "db.list_table_and_columns", "db.list_indexes",...
0
[]
The function (test_migrate) defined within the public class called public.The function start at line 183 and ends at 230. It contains 42 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [183.0] and does not return any value. It declares 19.0 functions, and It has 19.0 functi...
Sema4AI_actions
public
public
0
0
test_database_create_table
def test_database_create_table(str_regression) -> None:db = Database(":memory:")# path = tmpdir / "test.db"# print(path)# db = Database(path)db.register_classes([SomeActionPackage, SomeAction, SomeRun])sql = db.create_table_sql(SomeAction, _db_rules)str_regression.check(sql, basename="some_action")sql = db.create_table...
1
13
1
110
2
233
254
233
str_regression
['db', 'sql']
None
{"Assign": 3, "Expr": 5, "With": 1}
12
22
12
["Database", "db.register_classes", "db.create_table_sql", "str_regression.check", "db.create_table_sql", "str_regression.check", "db.connect", "db.initialize", "db.create_tables", "set", "db.list_table_names", "set"]
0
[]
The function (test_database_create_table) defined within the public class called public.The function start at line 233 and ends at 254. It contains 13 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 12.0 functions, and It has 1...
Sema4AI_actions
public
public
0
0
test_database_insert
def test_database_insert():db = Database(":memory:")with db.connect():# Note: in-memory, as soon as we close the connection, it's gone.db.initialize([SomeActionPackage, SomeAction, SomeRun])db.create_tables(_db_rules)insert = [SomeActionPackage(1, "my_name", "conda contents"),SomeActionPackage(2, "my_name2", "conda con...
4
22
0
159
3
257
282
257
['insert', 'db', 'found']
None
{"Assign": 3, "Expr": 3, "For": 1, "With": 2}
19
26
19
["Database", "db.connect", "db.initialize", "db.create_tables", "SomeActionPackage", "SomeActionPackage", "db.transaction", "db.insert", "join", "str", "db.all", "join", "str", "str", "db.first", "str", "str", "db.first", "str"]
0
[]
The function (test_database_insert) defined within the public class called public.The function start at line 257 and ends at 282. It contains 22 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 19.0 functions, and It has 19.0 fu...
Sema4AI_actions
public
public
0
0
test_database_update
def test_database_update():db = Database(":memory:")with db.connect():# Note: in-memory, as soon as we close the connection, it's gone.db.initialize([SomeActionPackage])db.create_tables(_db_rules)instance = SomeActionPackage(1, "my_name", "conda contents")with db.transaction():db.insert(instance)assert str(db.first(Som...
1
13
0
100
2
285
301
285
['instance', 'db']
None
{"Assign": 3, "Expr": 4, "With": 3}
13
17
13
["Database", "db.connect", "db.initialize", "db.create_tables", "SomeActionPackage", "db.transaction", "db.insert", "str", "db.first", "str", "db.transaction", "db.update", "db.first"]
0
[]
The function (test_database_update) defined within the public class called public.The function start at line 285 and ends at 301. It contains 13 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 13.0 functions, and It has 13.0 fu...
Sema4AI_actions
public
public
0
0
test_database_insert_or_update
def test_database_insert_or_update():db = Database(":memory:")with db.connect():# Note: in-memory, as soon as we close the connection, it's gone.db.initialize([SomeActionPackage])db.create_tables(_db_rules)instance = SomeActionPackage(1, "my_name", "conda contents")with db.transaction():db.insert_or_update(instance)ass...
1
20
0
191
4
304
329
304
['instance', 'instance_22', 'db', 'instance_22_new_name']
None
{"Assign": 4, "Expr": 6, "With": 5}
27
26
27
["Database", "db.connect", "db.initialize", "db.create_tables", "SomeActionPackage", "db.transaction", "db.insert_or_update", "str", "db.first", "str", "db.transaction", "db.insert_or_update", "str", "db.first", "str", "SomeActionPackage", "db.transaction", "db.insert_or_update", "str", "db.first", "str", "SomeActionPa...
0
[]
The function (test_database_insert_or_update) defined within the public class called public.The function start at line 304 and ends at 329. It contains 20 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 27.0 functions, and It h...
Sema4AI_actions
public
public
0
0
test_database_datetime
def test_database_datetime(str_regression):db = Database(":memory:")with db.connect():# Note: in-memory, as soon as we close the connection, it's gone.db.initialize([SomeActionPackage, SomeAction, SomeRun])db.create_tables(_db_rules)date = datetime.datetime(2023, 11, 22, 13, 50, 37, 457881, tzinfo=datetime.timezone.utc...
2
18
1
153
3
332
354
332
str_regression
['insert', 'db', 'date']
None
{"Assign": 3, "Expr": 4, "For": 1, "With": 2}
14
23
14
["Database", "db.connect", "db.initialize", "db.create_tables", "datetime.datetime", "SomeActionPackage", "SomeAction", "SomeRun", "datetime_to_str", "db.transaction", "db.insert", "str_regression.check", "json.dumps", "db.list_whole_db"]
0
[]
The function (test_database_datetime) defined within the public class called public.The function start at line 332 and ends at 354. It contains 18 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 14.0 functions, and It has 14.0 ...
Sema4AI_actions
public
public
0
0
test_database_transactions
def test_database_transactions():db = Database(":memory:")with db.connect():db.initialize([SomeActionPackage, SomeAction, SomeRun])db.create_tables(_db_rules)assert len(db.all(SomeActionPackage)) == 0with pytest.raises(Exception):with db.transaction():db.insert(SomeActionPackage(1, "foo", "foo"))raise Exception("err he...
1
14
0
124
1
357
373
357
['db']
None
{"Assign": 1, "Expr": 4, "With": 4}
18
17
18
["Database", "db.connect", "db.initialize", "db.create_tables", "len", "db.all", "pytest.raises", "db.transaction", "db.insert", "SomeActionPackage", "Exception", "len", "db.all", "db.transaction", "db.insert", "SomeActionPackage", "len", "db.all"]
0
[]
The function (test_database_transactions) defined within the public class called public.The function start at line 357 and ends at 373. It contains 14 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 18.0 functions, and It has 1...
Sema4AI_actions
public
public
0
0
test_database_limit_offset
def test_database_limit_offset():db = Database(":memory:")with db.connect():db.initialize([SomeObject])db.create_tables(_db_rules)with db.transaction():for i in range(5):db.insert(SomeObject(id=i))assert len(db.all(SomeObject)) == 5assert [x.id for x in db.all(SomeObject, limit=3)] == list(range(3))assert [x.id for x i...
4
13
0
129
1
381
395
381
['db']
None
{"Assign": 1, "Expr": 3, "For": 1, "With": 2}
16
15
16
["Database", "db.connect", "db.initialize", "db.create_tables", "db.transaction", "range", "db.insert", "SomeObject", "len", "db.all", "db.all", "list", "range", "db.all", "list", "range"]
0
[]
The function (test_database_limit_offset) defined within the public class called public.The function start at line 381 and ends at 395. It contains 13 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 16.0 functions, and It has 1...
Sema4AI_actions
public
public
0
0
test_database_transactions_nested
def test_database_transactions_nested():db = Database(":memory:")with db.connect():db.initialize([SomeActionPackage, SomeAction, SomeRun])db.create_tables(_db_rules)assert len(db.all(SomeActionPackage)) == 0with db.transaction():try:with db.transaction():db.insert(SomeActionPackage(1, "foo", "foo"))raise Exception("err...
2
17
0
122
1
398
417
398
['db']
None
{"Assign": 1, "Expr": 4, "Try": 1, "With": 3}
17
20
17
["Database", "db.connect", "db.initialize", "db.create_tables", "len", "db.all", "db.transaction", "db.transaction", "db.insert", "SomeActionPackage", "Exception", "db.insert", "SomeActionPackage", "str", "db.all", "str", "SomeActionPackage"]
0
[]
The function (test_database_transactions_nested) defined within the public class called public.The function start at line 398 and ends at 417. It contains 17 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 17.0 functions, and I...
Sema4AI_actions
public
public
0
0
test_database_concurrency.update_db
def update_db():with db.connect():for _i in range(ENTRIES_IN_ROUND):with db.transaction():db.insert(SomeActionPackage(next_id(), "foo", "foo"))return True
2
6
0
43
0
433
438
433
null
[]
None
null
0
0
0
null
0
null
The function (test_database_concurrency.update_db) defined within the public class called public.The function start at line 433 and ends at 438. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_database_concurrency.update_record
def update_record():with db.connect():for _i in range(ENTRIES_IN_ROUND):with db.transaction():db.update_by_id(SomeActionPackage, next_id(), {"name": "bar"})return True
2
6
0
44
0
451
456
451
null
[]
None
null
0
0
0
null
0
null
The function (test_database_concurrency.update_record) defined within the public class called public.The function start at line 451 and ends at 456. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_database_concurrency
def test_database_concurrency(datadir):db = Database(datadir / "my.db")with db.connect():db.initialize([SomeActionPackage, SomeAction, SomeRun])db.create_tables(_db_rules)assert len(db.all(SomeActionPackage)) == 0next_id = partial(next, itertools.count())ROUNDS = 8ENTRIES_IN_ROUND = 40def update_db():with db.connect():...
6
24
1
209
5
420
466
420
datadir
['futures', 'db', 'next_id', 'ENTRIES_IN_ROUND', 'ROUNDS']
Returns
{"Assign": 7, "Expr": 4, "For": 5, "Return": 2, "With": 8}
33
47
33
["Database", "db.connect", "db.initialize", "db.create_tables", "len", "db.all", "partial", "itertools.count", "db.connect", "range", "db.transaction", "db.insert", "SomeActionPackage", "next_id", "concurrent.futures.ThreadPoolExecutor", "executor.submit", "range", "concurrent.futures.as_completed", "future.result", "p...
0
[]
The function (test_database_concurrency) defined within the public class called public.The function start at line 420 and ends at 466. It contains 24 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters, and this function return a value. It declares 33.0 functions, and It ha...
Sema4AI_actions
public
public
0
0
test_database_temp_session_data_cleanup
def test_database_temp_session_data_cleanup(tmpdir):from sema4ai.action_server._models import TempUserSessionDatafrom sema4ai.action_server._user_session import (_temp_session_data_cleanup,datetime_to_iso,)db = Database(":memory:")with db.connect():db.initialize([TempUserSessionData])db.create_tables(_db_rules)with db....
3
38
1
220
7
469
513
469
tmpdir
['times', 'after_time2', 'curtime', 'db', 'before_time2', 'before_time1', 'after_time1']
None
{"Assign": 7, "Expr": 4, "For": 1, "With": 2}
17
45
17
["Database", "db.connect", "db.initialize", "db.create_tables", "db.transaction", "datetime.datetime", "datetime.timedelta", "datetime.timedelta", "datetime.timedelta", "datetime.timedelta", "db.insert", "TempUserSessionData", "datetime_to_iso", "_temp_session_data_cleanup", "db.all", "datetime_to_iso", "datetime_to_is...
0
[]
The function (test_database_temp_session_data_cleanup) defined within the public class called public.The function start at line 469 and ends at 513. It contains 38 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 17.0 functions, ...
Sema4AI_actions
public
public
0
0
test_datadir_related_actions.import_action
def import_action(action_name: str) -> None:sema4ai_action_server_run(["import",f"--dir={calculator.parent}","--db-file=server.db","-v","--skip-lint","--datadir",action_server_datadir,"--whitelist",action_name,],returncode=0,)
1
15
1
38
0
36
50
36
null
[]
None
null
0
0
0
null
0
null
The function (test_datadir_related_actions.import_action) defined within the public class called public.The function start at line 36 and ends at 50. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_datadir_related_actions.clear_actions
def clear_actions() -> None:sema4ai_action_server_run(["datadir","clear-actions","--datadir",action_server_datadir,"--db-file=server.db",],returncode=0,)
1
11
0
26
0
52
62
52
null
[]
None
null
0
0
0
null
0
null
The function (test_datadir_related_actions.clear_actions) defined within the public class called public.The function start at line 52 and ends at 62. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_datadir_related_actions.check_actions_enabled
def check_actions_enabled(enabled_count: int, total_count: int) -> None:db: Databasewith load_db(db_path) as db:with db.connect():actions = db.all(Action)assert (len([action for action in actions if action.enabled])== enabled_count)assert len(actions) == total_count
3
10
2
65
0
66
75
66
null
[]
None
null
0
0
0
null
0
null
The function (test_datadir_related_actions.check_actions_enabled) defined within the public class called public.The function start at line 66 and ends at 75. It contains 10 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [66.0] and does not return any value..
Sema4AI_actions
public
public
0
0
test_datadir_related_actions
def test_datadir_related_actions(tmpdir,action_server_datadir: Path,) -> None:from action_server_tests.fixtures import sema4ai_action_server_runfrom sema4ai.action_server._database import Databasefrom sema4ai.action_server._models import Action, load_dbaction_server_datadir.mkdir(parents=True, exist_ok=True)db_path = a...
1
38
2
147
3
7
94
7
tmpdir,action_server_datadir
['db_path', 'calculator', 'actions']
None
{"AnnAssign": 1, "Assign": 3, "Expr": 15, "With": 2}
22
88
22
["action_server_datadir.mkdir", "db_path.exists", "Path", "calculator.parent.mkdir", "calculator.write_text", "sema4ai_action_server_run", "sema4ai_action_server_run", "import_action", "load_db", "db.connect", "db.all", "len", "len", "check_actions_enabled", "import_action", "check_actions_enabled", "import_action", "c...
0
[]
The function (test_datadir_related_actions) defined within the public class called public.The function start at line 7 and ends at 94. It contains 38 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [7.0] and does not return any value. It declares 22.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
test_devenv
def test_devenv(datadir):from pathlib import Pathfrom action_server_tests.fixtures import sema4ai_action_server_runcwd = Path(datadir) / "pack1"# Error: No task names specified.sema4ai_action_server_run(["devenv", "task"], returncode=2, cwd=cwd)sema4ai_action_server_run(["devenv","--verbose","task","test-ok",],returnco...
2
20
1
123
2
6
32
6
datadir
['result', 'cwd']
None
{"Assign": 2, "Expr": 3}
7
27
7
["Path", "sema4ai_action_server_run", "sema4ai_action_server_run", "sema4ai_action_server_run", "sema4ai_action_server_run", "x.strip", "result.stdout.splitlines"]
0
[]
The function (test_devenv) defined within the public class called public.The function start at line 6 and ends at 32. It contains 20 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 7.0 functions, and It has 7.0 functions called...
Sema4AI_actions
public
public
0
0
test_run_actions_with_custom_pythonpath
def test_run_actions_with_custom_pythonpath(action_server_process: ActionServerProcess,client: ActionServerClient,datadir,):import jsonfrom pathlib import Pathfrom action_server_tests.fixtures import BUILD_ENV_IN_TESTS_TIMEOUTcwd = Path(datadir) / "pack1"action_server_process.start(cwd=cwd,actions_sync=True,db_file="se...
1
21
3
83
2
36
60
36
action_server_process,client,datadir
['found', 'cwd']
None
{"Assign": 2, "Expr": 1}
4
25
4
["Path", "action_server_process.start", "client.post_get_str", "json.loads"]
0
[]
The function (test_run_actions_with_custom_pythonpath) defined within the public class called public.The function start at line 36 and ends at 60. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [36.0] and does not return any value. It declares 4.0 functions, ...
Sema4AI_actions
public
public
0
0
test_logs_dont_contain_secrets
def test_logs_dont_contain_secrets(action_server_process: ActionServerProcess, client: ActionServerClient, tmpdir):"""Test to verify that logs don't contain secrets or sensitive information."""# Create a simple action that receives a secret passwordaction_file = Path(tmpdir) / "secret_action" / "secret_action.py"action...
1
43
3
183
7
12
74
12
action_server_process,client,tmpdir
['action_file', 'log_contents', 'log_html_contents', 'password', 'username', 'response', 'run_id']
None
{"Assign": 7, "Expr": 4}
12
63
12
["Path", "action_file.parent.mkdir", "action_file.write_text", "action_server_process.start", "client.post_get_response", "json.loads", "client.get_str", "pretty_format_logs_from_log_html_contents", "action_server_process.get_stdout", "action_server_process.get_stderr", "action_server_process.get_stdout", "action_serve...
0
[]
The function (test_logs_dont_contain_secrets) defined within the public class called public.The function start at line 12 and ends at 74. It contains 43 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [12.0] and does not return any value. It declares 12.0 functions, and It ...
Sema4AI_actions
public
public
0
0
_verify_oauth2_settings
def _verify_oauth2_settings() -> Path:import yamlfrom sema4ai.action_server._settings import get_user_sema4_pathuser = get_user_sema4_path()yaml_location = user / "oauth2_config.yaml"assert (yaml_location.exists()), f"Expected {yaml_location} to exist with the OAuth2 settings."txt = yaml_location.read_text()contents = ...
2
27
0
121
7
12
43
12
['txt', 'providers', 'google', 'user', 'contents', 'yaml_location', 'oauth2_config']
Path
{"Assign": 7, "For": 1, "Return": 1}
6
32
6
["get_user_sema4_path", "yaml_location.exists", "yaml_location.read_text", "yaml.safe_load", "contents.get", "oauth2_config.get"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_oauth2_py.manual_test_oauth2_action_server_ui", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action...
The function (_verify_oauth2_settings) defined within the public class called public.The function start at line 12 and ends at 43. It contains 27 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 6.0 functions, It has 6.0 function...
Sema4AI_actions
public
public
0
0
manual_test_oauth2_vscode
def manual_test_oauth2_vscode(action_server_process: ActionServerProcess, client: ActionServerClient, tmpdir):"""Note: this is a manual test that should open a browser to see if everythingis correct."""import webbrowserfrom sema4ai.action_server._encryption import make_unencrypted_data_envelopefrom sema4ai.action_serve...
1
85
3
376
9
46
157
46
action_server_process,client,tmpdir
['callback_url', 'found1', 'info', 'request_info', 'loaded', 'result', 'reference_id', 'pack', 'provider_to_status']
None
{"Assign": 11, "Expr": 5}
21
112
21
["_verify_oauth2_settings", "get_in_resources", "action_server_process.start", "client.get_json", "start_server_in_thread", "fut_address.result", "webbrowser.open", "client.build_full_url", "fut_uri.result", "json.loads", "client.get_json", "set", "provider_to_status.keys", "set", "info.keys", "iso_to_datetime", "clien...
0
[]
The function (manual_test_oauth2_vscode) defined within the public class called public.The function start at line 46 and ends at 157. It contains 85 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [46.0] and does not return any value. It declares 21.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
manual_test_oauth2_action_server_ui
def manual_test_oauth2_action_server_ui(action_server_process: ActionServerProcess, client: ActionServerClient):"""Note: this is a manual test that should open a browser to see if everythingis correct."""import webbrowserfrom sema4ai.action_server.vendored_deps.url_callback_server import (start_server_in_thread,)settin...
1
37
2
154
7
160
220
160
action_server_process,client
['callback_url', 'settings_file', 'request_info', 'loaded', 'result', 'reference_id', 'pack']
None
{"Assign": 8, "Expr": 3}
11
61
11
["_verify_oauth2_settings", "get_in_resources", "action_server_process.start", "str", "start_server_in_thread", "fut_address.result", "client.get_json", "webbrowser.open", "client.build_full_url", "fut_uri.result", "json.loads"]
0
[]
The function (manual_test_oauth2_action_server_ui) defined within the public class called public.The function start at line 160 and ends at 220. It contains 37 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [160.0] and does not return any value. It declares 11.0 functions, ...
Sema4AI_actions
public
public
0
0
test_settings
def test_settings(tmpdir):import yamlfrom sema4ai.action_server.vendored_deps.oauth2_settings import (get_oauthlib2_provider_settings,)oauth2_settings_file = Path(tmpdir) / "oauth2_settings.yaml"with pytest.raises(RuntimeError):# File does not existget_oauthlib2_provider_settings("google", str(oauth2_settings_file))oau...
1
45
1
182
3
223
277
223
tmpdir
['google_settings', 'oauth2_settings_file', 'custom_settings']
None
{"Assign": 3, "Expr": 2, "With": 1}
13
55
13
["Path", "pytest.raises", "get_oauthlib2_provider_settings", "str", "oauth2_settings_file.write_text", "yaml.safe_dump", "dict", "dict", "dict", "get_oauthlib2_provider_settings", "str", "get_oauthlib2_provider_settings", "str"]
0
[]
The function (test_settings) defined within the public class called public.The function start at line 223 and ends at 277. It contains 45 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 13.0 functions, and It has 13.0 functions...
Sema4AI_actions
public
public
0
0
test_oauth2_provider_settings
def test_oauth2_provider_settings():from sema4ai.action_server.vendored_deps.oauth2_settings import (OAuth2ProviderSettings,)settings = OAuth2ProviderSettings(clientId="foo")dumped = settings.model_dump()new_settings = OAuth2ProviderSettings.model_validate(dumped)assert new_settings.clientId == "foo"
1
8
0
46
3
280
288
280
['dumped', 'settings', 'new_settings']
None
{"Assign": 3}
3
9
3
["OAuth2ProviderSettings", "settings.model_dump", "OAuth2ProviderSettings.model_validate"]
0
[]
The function (test_oauth2_provider_settings) defined within the public class called public.The function start at line 280 and ends at 288. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
test_print_user_oauth2_config_path
def test_print_user_oauth2_config_path(print_mock: mock.MagicMock, buffer_write_mock: mock.MagicMock, tmpdir) -> None:from sema4ai.action_server._oauth2 import (USER_CONFIG_FILE_NAME,print_user_oauth2_config_path,)mock_settings_dir: Path = tmpdir / "action-server"mock_config_path: Path = mock_settings_dir / USER_CONFIG...
1
26
3
162
3
293
333
293
print_mock,buffer_write_mock,tmpdir
['print_args', 'retcode', 'json_data']
None
{"AnnAssign": 2, "Assign": 6, "Expr": 1, "With": 1}
10
41
10
["os.makedirs", "mock.patch", "mock_config_path.exists", "print_user_oauth2_config_path", "mock_config_path.exists", "print_user_oauth2_config_path", "mock_config_path.exists", "json.loads", "mock.patch", "mock.patch"]
0
[]
The function (test_print_user_oauth2_config_path) defined within the public class called public.The function start at line 293 and ends at 333. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [293.0] and does not return any value. It declares 10.0 functions, a...
Sema4AI_actions
public
public
0
0
check_regexp_in_lines
def check_regexp_in_lines(text, regexp):"""Checks if the given regexp is found in any line of the text.Args:text: The text to search in.regexp: The regular expression to search for.Returns:True if the regexp is found in any line, False otherwise."""compiled_regexp = re.compile(regexp)for line in text.splitlines():if co...
3
6
2
43
1
11
26
11
text,regexp
['compiled_regexp']
None
{"Assign": 1, "Expr": 1, "For": 1, "If": 1, "Return": 1}
4
16
4
["re.compile", "text.splitlines", "compiled_regexp.search", "RuntimeError"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_package_py.test_package_zip"]
The function (check_regexp_in_lines) defined within the public class called public.The function start at line 11 and ends at 26. It contains 6 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [11.0] and does not return any value. It declares 4.0 functions, It has 4.0 function...
Sema4AI_actions
public
public
0
0
test_package_zip.extract
def extract():from sema4ai.action_server import __version__sema4ai_action_server_run(["package","extract","--override","--output-dir",str(extract_to),str(target_zip),],returncode=0,cwd=datadir,)files = set(f.name for f in extract_to.glob("*") if "__pycache__" not in f.name)assert files == {"another","folder","hello_act...
3
26
0
116
0
74
101
74
null
[]
None
null
0
0
0
null
0
null
The function (test_package_zip.extract) defined within the public class called public.The function start at line 74 and ends at 101. It contains 26 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_package_zip
def test_package_zip(datadir):from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","build","--input-dir",str(Path(datadir, "pack1")),"--output-dir",str(datadir),"--datadir",str(datadir / "data"),"--json",# "-v",],returncode=0,cwd=datadir,)zip_name = "pack1-n...
3
40
1
203
9
29
106
29
datadir
['output', 'files', 'zip_name', 'metadata', 'extract_to', 'target_zip', 'escaped', 'contents', 'file_names']
None
{"Assign": 10, "Expr": 5, "With": 1}
25
78
25
["sema4ai_action_server_run", "str", "Path", "str", "str", "re.escape", "check_regexp_in_lines", "os.path.exists", "json.loads", "str", "zipfile.ZipFile", "set", "zip_file.namelist", "set", "exists", "sema4ai_action_server_run", "str", "str", "set", "extract_to.glob", "json.loads", "metadata.read_text", "extract", "os....
0
[]
The function (test_package_zip) defined within the public class called public.The function start at line 29 and ends at 106. It contains 40 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 25.0 functions, and It has 25.0 functio...
Sema4AI_actions
public
public
0
0
test_package_zip_no_actions
def test_package_zip_no_actions(datadir):from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","build","--output-dir",str(datadir),"--datadir",str(datadir / "data"),],returncode=1,cwd=datadir / "pack2",)assert "No actions found" in output.stderr
1
15
1
57
1
109
124
109
datadir
['output']
None
{"Assign": 1}
3
16
3
["sema4ai_action_server_run", "str", "str"]
0
[]
The function (test_package_zip_no_actions) defined within the public class called public.The function start at line 109 and ends at 124. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3...
Sema4AI_actions
public
public
0
0
test_package_pack_v2_fields_but_not_v2_marked
def test_package_pack_v2_fields_but_not_v2_marked(datadir):from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","build","--output-dir",str(datadir),"--datadir",str(datadir / "data"),],returncode=1,cwd=datadir / "pack_v2_fields_but_not_v2_marked",)assert ("Th...
1
18
1
59
1
127
145
127
datadir
['output']
None
{"Assign": 1}
3
19
3
["sema4ai_action_server_run", "str", "str"]
0
[]
The function (test_package_pack_v2_fields_but_not_v2_marked) defined within the public class called public.The function start at line 127 and ends at 145. It contains 18 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 functi...
Sema4AI_actions
public
public
0
0
test_package_metadata
def test_package_metadata(datadir, data_regression):from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","metadata","--input-dir",str(Path(datadir, "pack1")),"--datadir",str(datadir / "data"),],returncode=0,cwd=datadir / "pack1",)data_regression.check(fix_me...
1
15
2
74
1
148
163
148
datadir,data_regression
['output']
None
{"Assign": 1, "Expr": 1}
7
16
7
["sema4ai_action_server_run", "str", "Path", "str", "data_regression.check", "fix_metadata", "json.loads"]
0
[]
The function (test_package_metadata) defined within the public class called public.The function start at line 148 and ends at 163. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [148.0] and does not return any value. It declares 7.0 functions, and It has 7.0...
Sema4AI_actions
public
public
0
0
test_package_metadata_external_endpoints
def test_package_metadata_external_endpoints(datadir, data_regression):from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","metadata","--input-dir",str(Path(datadir, "pack_external_endpoints")),"--datadir",str(datadir / "data"),],returncode=0,cwd=datadir / ...
1
15
2
74
1
166
181
166
datadir,data_regression
['output']
None
{"Assign": 1, "Expr": 1}
7
16
7
["sema4ai_action_server_run", "str", "Path", "str", "data_regression.check", "fix_metadata", "json.loads"]
0
[]
The function (test_package_metadata_external_endpoints) defined within the public class called public.The function start at line 166 and ends at 181. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [166.0] and does not return any value. It declares 7.0 functio...
Sema4AI_actions
public
public
0
0
test_package_metadata_external_endpoints_bad
def test_package_metadata_external_endpoints_bad(datadir, data_regression):import itertoolsfrom sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","metadata","--input-dir",str(Path(datadir, "pack_external_endpoints_bad")),"--datadir",str(datadir / "data"),],ret...
4
20
2
119
2
184
205
184
datadir,data_regression
['output', 'found_entries']
None
{"Assign": 2, "Expr": 2, "For": 1, "If": 1}
13
22
13
["sema4ai_action_server_run", "str", "Path", "str", "set", "itertools.chain", "output.stdout.splitlines", "output.stderr.splitlines", "line.startswith", "line.startswith", "found_entries.add", "data_regression.check", "sorted"]
0
[]
The function (test_package_metadata_external_endpoints_bad) defined within the public class called public.The function start at line 184 and ends at 205. It contains 20 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [184.0] and does not return any value. It declares 13.0 fu...
Sema4AI_actions
public
public
0
0
test_package_metadata_oauth2_secrets
def test_package_metadata_oauth2_secrets(datadir, data_regression):from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","metadata","--datadir",str(datadir / "data"),],returncode=0,cwd=datadir / "pack_oauth2_secrets",)data_regression.check(fix_metadata(json.l...
1
13
2
62
1
208
221
208
datadir,data_regression
['output']
None
{"Assign": 1, "Expr": 1}
5
14
5
["sema4ai_action_server_run", "str", "data_regression.check", "fix_metadata", "json.loads"]
0
[]
The function (test_package_metadata_oauth2_secrets) defined within the public class called public.The function start at line 208 and ends at 221. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [208.0] and does not return any value. It declares 5.0 functions, ...
Sema4AI_actions
public
public
0
0
test_package_metadata_secrets
def test_package_metadata_secrets(datadir, data_regression):from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","metadata","--datadir",str(datadir / "data"),],returncode=0,cwd=datadir / "pack_secrets",)data_regression.check(fix_metadata(json.loads(output.st...
1
13
2
62
1
224
237
224
datadir,data_regression
['output']
None
{"Assign": 1, "Expr": 1}
5
14
5
["sema4ai_action_server_run", "str", "data_regression.check", "fix_metadata", "json.loads"]
0
[]
The function (test_package_metadata_secrets) defined within the public class called public.The function start at line 224 and ends at 237. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [224.0] and does not return any value. It declares 5.0 functions, and It...
Sema4AI_actions
public
public
0
0
test_package_metadata_api
def test_package_metadata_api(datadir, data_regression):from sema4ai.action_server import apiaction_package_dir = Path(datadir / "pack_secrets")found = api.package_metadata(action_package_dir, datadir=Path(datadir / "data"))data_regression.check(fix_metadata(found))data_regression.check(found)
1
6
2
53
2
240
246
240
datadir,data_regression
['action_package_dir', 'found']
None
{"Assign": 2, "Expr": 2}
6
7
6
["Path", "api.package_metadata", "Path", "data_regression.check", "fix_metadata", "data_regression.check"]
0
[]
The function (test_package_metadata_api) defined within the public class called public.The function start at line 240 and ends at 246. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [240.0] and does not return any value. It declares 6.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
test_package_upload
def test_package_upload(datadir, data_regression):raise pytest.skip(reason="Skip package upload test")from sema4ai.action_server._selftest import sema4ai_action_server_run# Build the action package firstsema4ai_action_server_run(["package","build","--output-dir",str(datadir),"--datadir",str(datadir / "data"),],returnco...
1
41
2
174
4
249
294
249
datadir,data_regression
['regression_check', 'zip_name', 'zip_path', 'output']
None
{"Assign": 5, "Expr": 2}
12
46
12
["pytest.skip", "sema4ai_action_server_run", "str", "str", "Path", "os.path.exists", "sema4ai_action_server_run", "str", "os.environ.get", "os.environ.get", "json.loads", "data_regression.check"]
0
[]
The function (test_package_upload) defined within the public class called public.The function start at line 249 and ends at 294. It contains 41 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [249.0] and does not return any value. It declares 12.0 functions, and It has 12.0...
Sema4AI_actions
public
public
0
0
test_package_status
def test_package_status(data_regression):raise pytest.skip(reason="Skip package upload test")from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","status","--package-id","21a4a0ea-7ada-4754-8a62-ed9d17dedb1d","--organization-id","6e49f3b9-9d25-4904-b22d-3b5e...
1
29
1
134
2
297
332
297
data_regression
['regression_check', 'output']
None
{"Assign": 3, "Expr": 1}
6
36
6
["pytest.skip", "sema4ai_action_server_run", "os.environ.get", "os.environ.get", "json.loads", "data_regression.check"]
0
[]
The function (test_package_status) defined within the public class called public.The function start at line 297 and ends at 332. It contains 29 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 funct...
Sema4AI_actions
public
public
0
0
test_package_set_changelog
def test_package_set_changelog(data_regression):raise pytest.skip(reason="Skip package upload test")from sema4ai.action_server._selftest import sema4ai_action_server_runoutput = sema4ai_action_server_run(["package","set-changelog","--package-id","fdd0e9da-0508-499b-8020-0dd7c94b0a8c","--organization-id","6e49f3b9-9d25-...
1
30
1
131
2
335
367
335
data_regression
['regression_check', 'output']
None
{"Assign": 3, "Expr": 1}
6
33
6
["pytest.skip", "sema4ai_action_server_run", "os.environ.get", "os.environ.get", "json.loads", "data_regression.check"]
0
[]
The function (test_package_set_changelog) defined within the public class called public.The function start at line 335 and ends at 367. It contains 30 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6....
Sema4AI_actions
public
public
0
0
test_package_yaml_structure_too_new
def test_package_yaml_structure_too_new(action_server_process: ActionServerProcess, datadir):from sema4ai.action_server._selftest import ActionServerExitedErrorwith pytest.raises(ActionServerExitedError):action_server_process.start(cwd=datadir / "pack_too_new", actions_sync=True)stderr = action_server_process.get_stder...
1
11
2
52
1
7
19
7
action_server_process,datadir
['stderr']
None
{"Assign": 1, "Expr": 1, "With": 1}
3
13
3
["pytest.raises", "action_server_process.start", "action_server_process.get_stderr"]
0
[]
The function (test_package_yaml_structure_too_new) defined within the public class called public.The function start at line 7 and ends at 19. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [7.0] and does not return any value. It declares 3.0 functions, and I...
Sema4AI_actions
public
public
0
0
test_package_yaml_structure_warn_spec_version
def test_package_yaml_structure_warn_spec_version(action_server_process: ActionServerProcess, datadir):from action_server_tests.fixtures import BUILD_ENV_IN_TESTS_TIMEOUTaction_server_process.start(cwd=datadir / "pack1", actions_sync=True, timeout=BUILD_ENV_IN_TESTS_TIMEOUT)stderr = action_server_process.get_stderr()as...
1
12
2
46
1
23
35
23
action_server_process,datadir
['stderr']
None
{"Assign": 1, "Expr": 1}
2
13
2
["action_server_process.start", "action_server_process.get_stderr"]
0
[]
The function (test_package_yaml_structure_warn_spec_version) defined within the public class called public.The function start at line 23 and ends at 35. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [23.0] and does not return any value. It declares 2.0 funct...
Sema4AI_actions
public
public
0
0
test_action_server_starts
def test_action_server_starts(action_server_process: ActionServerProcess, tmpdir):action_server_process.start(db_file="server.db")assert action_server_process.port > 0assert action_server_process.host == "localhost"p = Path(str(tmpdir)) / ".sema4ai-test-action-server"assert p.exists()assert (p / "server.db").exists()
1
7
2
56
1
14
21
14
action_server_process,tmpdir
['p']
None
{"Assign": 1, "Expr": 1}
5
8
5
["action_server_process.start", "Path", "str", "p.exists", "exists"]
0
[]
The function (test_action_server_starts) defined within the public class called public.The function start at line 14 and ends at 21. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [14.0] and does not return any value. It declares 5.0 functions, and It has 5.0...
Sema4AI_actions
public
public
0
0
test_action_server_in_memory_db
def test_action_server_in_memory_db(action_server_process: ActionServerProcess, tmpdir):action_server_process.start()# Default is starting in-memoryassert action_server_process.port > 0assert action_server_process.host == "localhost"p = Path(str(tmpdir)) / ".sema4ai-test-action-server"assert p.exists()assert not (p / "...
1
7
2
54
1
25
32
25
action_server_process,tmpdir
['p']
None
{"Assign": 1, "Expr": 1}
5
8
5
["action_server_process.start", "Path", "str", "p.exists", "exists"]
0
[]
The function (test_action_server_in_memory_db) defined within the public class called public.The function start at line 25 and ends at 32. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [25.0] and does not return any value. It declares 5.0 functions, and It h...
Sema4AI_actions
public
public
0
0
test_schema_request_no_actions_registered
def test_schema_request_no_actions_registered(client: ActionServerClient, data_regression) -> None:from action_server_tests.fixtures import fix_openapi_jsonopenapi_json = client.get_openapi_json()data_regression.check(fix_openapi_json(json.loads(openapi_json)))
1
6
2
38
1
36
42
36
client,data_regression
['openapi_json']
None
{"Assign": 1, "Expr": 1}
4
7
4
["client.get_openapi_json", "data_regression.check", "fix_openapi_json", "json.loads"]
0
[]
The function (test_schema_request_no_actions_registered) defined within the public class called public.The function start at line 36 and ends at 42. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [36.0] and does not return any value. It declares 4.0 functions,...
Sema4AI_actions
public
public
0
0
test_bad_return_on_no_conda
def test_bad_return_on_no_conda(action_server_process: ActionServerProcess,client: ActionServerClient,) -> None:from action_server_tests.fixtures import (BUILD_ENV_IN_TESTS_TIMEOUT,get_in_resources,)calculator = get_in_resources("no_conda", "calculator")action_server_process.start(db_file="server.db",cwd=calculator,act...
1
27
2
90
3
46
73
46
action_server_process,client
['calculator', 'message', 'found']
None
{"Assign": 3, "Expr": 1}
4
28
4
["get_in_resources", "action_server_process.start", "client.post_error", "found.json"]
0
[]
The function (test_bad_return_on_no_conda) defined within the public class called public.The function start at line 46 and ends at 73. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [46.0] and does not return any value. It declares 4.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
test_run_id_in_response_header
def test_run_id_in_response_header(action_server_process: ActionServerProcess,client: ActionServerClient,) -> None:from action_server_tests.fixtures import (BUILD_ENV_IN_TESTS_TIMEOUT,get_in_resources,)from robocorp.log._log_formatting import pretty_format_logs_from_log_html_contentscalculator = get_in_resources("no_co...
4
76
2
354
11
77
166
77
action_server_process,client
['line', 'log_pretty_printed', 'expected', 'log_html_contents', 'artifacts_dir', 'calculator', 'run_info', 'log_html_path', 'run_id', 'result', 'artifacts_response']
None
{"Assign": 18, "Expr": 2, "For": 3}
25
90
25
["get_in_resources", "action_server_process.start", "requests.post", "client.build_full_url", "json.loads", "requests.get", "client.build_full_url", "result.json", "json.loads", "json.loads", "client.get_json", "pretty_format_logs_from_log_html_contents", "expected.splitlines", "line.strip", "client.get_str", "pretty_f...
0
[]
The function (test_run_id_in_response_header) defined within the public class called public.The function start at line 77 and ends at 166. It contains 76 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [77.0] and does not return any value. It declares 25.0 functions, and It...
Sema4AI_actions
public
public
0
0
test_global_return_reuse_process
def test_global_return_reuse_process(action_server_process: ActionServerProcess,client: ActionServerClient,) -> None:from action_server_tests.fixtures import (BUILD_ENV_IN_TESTS_TIMEOUT,get_in_resources,)calculator = get_in_resources("no_conda", "calculator")action_server_process.start(db_file="server.db",cwd=calculato...
1
26
2
96
2
170
196
170
action_server_process,client
['calculator', 'found']
None
{"Assign": 3, "Expr": 1}
4
27
4
["get_in_resources", "action_server_process.start", "client.post_get_str", "client.post_get_str"]
0
[]
The function (test_global_return_reuse_process) defined within the public class called public.The function start at line 170 and ends at 196. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [170.0] and does not return any value. It declares 4.0 functions, and ...
Sema4AI_actions
public
public
0
0
test_import_action_server_strategies
def test_import_action_server_strategies(action_server_datadir: Path,strategy: str,) -> None:from action_server_tests.fixtures import get_in_resources, sema4ai_action_server_runfrom sema4ai.action_server._models import Action, ActionPackage, load_dbif strategy == "package.yaml":root_dir = get_in_resources("hello")elif ...
4
47
2
225
6
203
257
203
action_server_datadir,strategy
['env', 'action_package', 'db_path', 'action_packages', 'actions', 'root_dir']
None
{"Assign": 8, "Expr": 1, "If": 3, "With": 2}
17
55
17
["get_in_resources", "get_in_resources", "get_in_resources", "sema4ai_action_server_run", "load_db", "db.connect", "db.all", "db.all", "len", "next", "iter", "json.loads", "len", "env.get", "env.get", "len", "pytest.mark.parametrize"]
0
[]
The function (test_import_action_server_strategies) defined within the public class called public.The function start at line 203 and ends at 257. It contains 47 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [203.0] and does not return any value. It declares 17.0 functions,...
Sema4AI_actions
public
public
0
0
test_import_default_value
def test_import_default_value(tmpdir,action_server_datadir: Path,) -> None:from action_server_tests.fixtures import sema4ai_action_server_runfrom sema4ai.action_server._database import Databasefrom sema4ai.action_server._models import Action, load_dbaction_server_datadir.mkdir(parents=True, exist_ok=True)db_path = acti...
1
49
2
194
3
260
313
260
tmpdir,action_server_datadir
['db_path', 'calculator', 'actions']
None
{"AnnAssign": 1, "Assign": 3, "Expr": 4, "With": 2}
11
54
11
["action_server_datadir.mkdir", "db_path.exists", "Path", "calculator.parent.mkdir", "calculator.write_text", "sema4ai_action_server_run", "load_db", "db.connect", "db.all", "len", "json.loads"]
0
[]
The function (test_import_default_value) defined within the public class called public.The function start at line 260 and ends at 313. It contains 49 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [260.0] and does not return any value. It declares 11.0 functions, and It ha...
Sema4AI_actions
public
public
0
0
test_is_consequential_openapi_spec
def test_is_consequential_openapi_spec(action_server_process: ActionServerProcess,data_regression,tmpdir,action_server_datadir: Path,client: ActionServerClient,) -> None:from action_server_tests.fixtures import fix_openapi_jsonaction_server_datadir.mkdir(parents=True, exist_ok=True)db_path = action_server_datadir / "se...
1
26
5
120
2
317
345
317
action_server_process,data_regression,tmpdir,action_server_datadir,client
['db_path', 'calculator']
None
{"Assign": 2, "Expr": 5}
10
29
10
["action_server_datadir.mkdir", "db_path.exists", "Path", "calculator.parent.mkdir", "calculator.write_text", "action_server_process.start", "data_regression.check", "fix_openapi_json", "json.loads", "client.get_openapi_json"]
0
[]
The function (test_is_consequential_openapi_spec) defined within the public class called public.The function start at line 317 and ends at 345. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [317.0] and does not return any value. It declares 10.0 functions, a...
Sema4AI_actions
public
public
0
0
test_import_no_conda
def test_import_no_conda(action_server_process: ActionServerProcess,data_regression,str_regression,tmpdir,action_server_datadir: Path,client: ActionServerClient,) -> None:from action_server_tests.fixtures import fix_openapi_json, sema4ai_action_server_runfrom sema4ai.action_server._database import Databasefrom sema4ai....
3
102
6
375
5
349
468
349
action_server_process,data_regression,str_regression,tmpdir,action_server_datadir,client
['action_name_to_schema', 'db_path', 'action_name_to_enabled', 'calculator', 'actions']
None
{"AnnAssign": 1, "Assign": 9, "Expr": 11, "For": 2, "With": 6}
29
120
29
["action_server_datadir.mkdir", "db_path.exists", "Path", "calculator.parent.mkdir", "calculator.write_text", "sema4ai_action_server_run", "load_db", "db.connect", "db.all", "len", "calculator.write_text", "sema4ai_action_server_run", "load_db", "db.connect", "db.all", "len", "data_regression.check", "calculator.write_...
0
[]
The function (test_import_no_conda) defined within the public class called public.The function start at line 349 and ends at 468. It contains 102 lines of code and it has a cyclomatic complexity of 3. It takes 6 parameters, represented as [349.0] and does not return any value. It declares 29.0 functions, and It has 29...
Sema4AI_actions
public
public
0
0
test_full_run
def test_full_run(action_server_process: ActionServerProcess,data_regression,base_case,client: ActionServerClient,) -> None:from action_server_tests.fixtures import fix_openapi_jsonfrom robocorp.log._log_formatting import pretty_format_logs_from_log_html_contentsfrom sema4ai.action_server._database import Database, str...
5
74
4
406
7
472
568
472
action_server_process,data_regression,base_case,client
['runs', 'db_path', 'found', 'log_html_contents', 'openapi_json', 'contents', 'run']
None
{"AnnAssign": 1, "Assign": 11, "Expr": 3, "For": 1, "With": 2}
21
97
21
["client.get_openapi_json", "data_regression.check", "fix_openapi_json", "json.loads", "client.post_get_str", "client.post_error", "load_db", "db.connect", "db.all", "len", "str_to_datetime", "client.get_json", "sorted", "sorted", "client.get_json", "len", "client.get_json", "len", "client.get_str", "client.get_str", "...
0
[]
The function (test_full_run) defined within the public class called public.The function start at line 472 and ends at 568. It contains 74 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [472.0] and does not return any value. It declares 21.0 functions, and It has 21.0 funct...
Sema4AI_actions
public
public
0
0
test_full_run_with_env_build
def test_full_run_with_env_build(action_server_process: ActionServerProcess,data_regression,client: ActionServerClient,tmpdir,) -> None:from action_server_tests.fixtures import (BUILD_ENV_IN_TESTS_TIMEOUT,get_in_resources,)from robocorp.log._log_formatting import pretty_format_logs_from_log_html_contentsproject = get_i...
1
35
4
147
6
572
610
572
action_server_process,data_regression,client,tmpdir
['log_html_contents', 'found', 'project', 'response', 'contents', 'run_id']
None
{"Assign": 6, "Expr": 1}
6
39
6
["get_in_resources", "action_server_process.start", "str", "client.post_get_response", "client.get_str", "pretty_format_logs_from_log_html_contents"]
0
[]
The function (test_full_run_with_env_build) defined within the public class called public.The function start at line 572 and ends at 610. It contains 35 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [572.0] and does not return any value. It declares 6.0 functions, and It ...
Sema4AI_actions
public
public
0
0
test_routes
def test_routes(action_server_process: ActionServerProcess, data_regression):from action_server_tests.fixtures import fix_openapi_jsonfrom action_server_tests.sample_data import ACTION, ACTION_PACKAGE, RUN, RUN2from sema4ai.action_server._database import Databasefrom sema4ai.action_server._models import create_dbaction...
1
24
2
189
6
614
643
614
action_server_process,data_regression
['client', 'runs', 'db_path', 'openapi_json', 'spec', 'run0']
None
{"AnnAssign": 1, "Assign": 6, "Expr": 8, "With": 2}
17
30
17
["action_server_process.datadir.mkdir", "create_db", "db.transaction", "db.insert", "db.insert", "db.insert", "db.insert", "action_server_process.start", "ActionServerClient", "client.get_openapi_json", "json.loads", "data_regression.check", "fix_openapi_json", "client.get_json", "len", "client.get_json", "client.get_e...
0
[]
The function (test_routes) defined within the public class called public.The function start at line 614 and ends at 643. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [614.0] and does not return any value. It declares 17.0 functions, and It has 17.0 functio...
Sema4AI_actions
public
public
0
0
test_server_url_flag
def test_server_url_flag(action_server_process: ActionServerProcess, data_regression):from action_server_tests.fixtures import fix_openapi_jsonaction_server_process.start(additional_args=["--server-url=https://foo.bar"])client = ActionServerClient(action_server_process)openapi_json = client.get_openapi_json()spec = jso...
1
7
2
55
3
647
655
647
action_server_process,data_regression
['client', 'openapi_json', 'spec']
None
{"Assign": 3, "Expr": 2}
6
9
6
["action_server_process.start", "ActionServerClient", "client.get_openapi_json", "json.loads", "data_regression.check", "fix_openapi_json"]
0
[]
The function (test_server_url_flag) defined within the public class called public.The function start at line 647 and ends at 655. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [647.0] and does not return any value. It declares 6.0 functions, and It has 6.0 f...
Sema4AI_actions
public
public
0
0
test_server_full_openapi_flag
def test_server_full_openapi_flag(action_server_process: ActionServerProcess, data_regression):from action_server_tests.fixtures import fix_openapi_jsonaction_server_process.start(additional_args=["--full-openapi-spec"])client = ActionServerClient(action_server_process)openapi_json = client.get_openapi_json()spec = jso...
1
9
2
55
3
659
669
659
action_server_process,data_regression
['client', 'openapi_json', 'spec']
None
{"Assign": 3, "Expr": 2}
6
11
6
["action_server_process.start", "ActionServerClient", "client.get_openapi_json", "json.loads", "data_regression.check", "fix_openapi_json"]
0
[]
The function (test_server_full_openapi_flag) defined within the public class called public.The function start at line 659 and ends at 669. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [659.0] and does not return any value. It declares 6.0 functions, and It ...
Sema4AI_actions
public
public
0
0
test_auth_routes
def test_auth_routes(action_server_process: ActionServerProcess, data_regression):from action_server_tests.fixtures import fix_openapi_json, get_in_resourcespack = get_in_resources("no_conda", "greeter")action_server_process.start(cwd=pack,actions_sync=True,db_file="server.db",additional_args=["--api-key=Foo"],)client ...
1
20
2
114
5
673
696
673
action_server_process,data_regression
['client', 'found', 'openapi_json', 'spec', 'pack']
None
{"Assign": 5, "Expr": 3}
9
24
9
["get_in_resources", "action_server_process.start", "ActionServerClient", "client.get_openapi_json", "json.loads", "data_regression.check", "fix_openapi_json", "client.post_error", "client.post_get_str"]
0
[]
The function (test_auth_routes) defined within the public class called public.The function start at line 673 and ends at 696. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [673.0] and does not return any value. It declares 9.0 functions, and It has 9.0 func...
Sema4AI_actions
public
public
0
0
test_server_process_pool
def test_server_process_pool(action_server_process: ActionServerProcess, data_regression):from action_server_tests.fixtures import get_in_resourcesno_conda_dir = get_in_resources("no_conda")action_server_process.start(cwd=no_conda_dir,actions_sync=True,db_file="server.db",add_shutdown_api=True,min_processes=1,max_proce...
1
14
2
54
1
700
715
700
action_server_process,data_regression
['no_conda_dir']
None
{"Assign": 1, "Expr": 1}
2
16
2
["get_in_resources", "action_server_process.start"]
0
[]
The function (test_server_process_pool) defined within the public class called public.The function start at line 700 and ends at 715. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [700.0] and does not return any value. It declares 2.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
test_subprocesses_killed.request_in_thread
def request_in_thread():return requests.post(client.build_full_url("api/actions/no-conda/neverending-action/run"),json={},)
1
5
0
22
0
734
738
734
null
[]
None
null
0
0
0
null
0
null
The function (test_subprocesses_killed.request_in_thread) defined within the public class called public.The function start at line 734 and ends at 738. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_subprocesses_killed.is_process_alive
def is_process_alive(pid):# Note: the process may be a zombie process in Linux# (althought it's killed it remains in that state# because we're monitoring it).try:proc = psutil.Process(pid)if proc.status() == psutil.STATUS_ZOMBIE:return Falseexcept psutil.NoSuchProcess:return Falsereturn True
3
8
1
37
0
758
768
758
null
[]
None
null
0
0
0
null
0
null
The function (test_subprocesses_killed.is_process_alive) defined within the public class called public.The function start at line 758 and ends at 768. It contains 8 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_subprocesses_killed
def test_subprocesses_killed(action_server_process: ActionServerProcess, client: ActionServerClient):from concurrent.futures import TimeoutErrorimport requestsfrom action_server_tests.fixtures import get_in_resourcesfrom sema4ai.action_server._robo_utils.run_in_thread import run_in_threadno_conda_dir = get_in_resources...
5
43
2
247
10
719
790
719
action_server_process,client
['times', 'fut', 'proc', 'server_log_file', 'children_processes', 'text', 'datadir', 'request_result', 'no_conda_dir', 'p']
Returns
{"Assign": 10, "Expr": 4, "For": 2, "If": 3, "Return": 4, "Try": 1, "With": 1}
26
72
26
["get_in_resources", "action_server_process.start", "requests.post", "client.build_full_url", "run_in_thread", "pytest.raises", "fut.result", "psutil.Process", "list", "p.children", "requests.post", "client.build_full_url", "fut.result", "range", "psutil.Process", "proc.status", "is_process_alive", "AssertionError", "p...
0
[]
The function (test_subprocesses_killed) defined within the public class called public.The function start at line 719 and ends at 790. It contains 43 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [719.0], and this function return a value. It declares 26.0 functions, and It...
Sema4AI_actions
public
public
0
0
test_import_task_options
def test_import_task_options(action_server_process: ActionServerProcess,data_regression,str_regression,tmpdir,action_server_datadir: Path,client: ActionServerClient,) -> None:from action_server_tests.fixtures import sema4ai_action_server_runfrom sema4ai.action_server._database import Databasefrom sema4ai.action_server....
1
95
6
311
3
794
899
794
action_server_process,data_regression,str_regression,tmpdir,action_server_datadir,client
['db_path', 'calculator', 'actions']
None
{"AnnAssign": 1, "Assign": 5, "Expr": 8, "With": 6}
22
106
22
["action_server_datadir.mkdir", "db_path.exists", "Path", "calculator.parent.mkdir", "calculator.write_text", "sema4ai_action_server_run", "load_db", "db.connect", "db.all", "len", "calculator.write_text", "sema4ai_action_server_run", "load_db", "db.connect", "db.all", "len", "calculator.write_text", "sema4ai_action_se...
0
[]
The function (test_import_task_options) defined within the public class called public.The function start at line 794 and ends at 899. It contains 95 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [794.0] and does not return any value. It declares 22.0 functions, and It has...
Sema4AI_actions
public
public
0
0
test_port_in_use
def test_port_in_use(action_server_process: ActionServerProcess, tmpdir):from sema4ai.action_server._selftest import ActionServerExitedErroraction_server_datadir = tmpdir / ".sema4ai_action_server_2"process2 = ActionServerProcess(Path(action_server_datadir))action_server_process.start()try:process2.start(port=action_se...
3
18
2
80
3
903
923
903
action_server_process,tmpdir
['process2', 'stderr', 'action_server_datadir']
None
{"Assign": 3, "Expr": 2, "Try": 1}
6
21
6
["ActionServerProcess", "Path", "action_server_process.start", "process2.start", "AssertionError", "process2.get_stderr"]
0
[]
The function (test_port_in_use) defined within the public class called public.The function start at line 903 and ends at 923. It contains 18 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [903.0] and does not return any value. It declares 6.0 functions, and It has 6.0 func...
Sema4AI_actions
public
public
0
0
test_action_package_rename
def test_action_package_rename(action_server_process: ActionServerProcess, client: ActionServerClient, tmpdir):calculator = Path(tmpdir) / "calculator" / "action_calculator.py"calculator.parent.mkdir(parents=True, exist_ok=True)calculator.write_text("""from sema4ai.actions import action@actiondef calculator_sum(v1: flo...
2
35
3
190
5
927
966
927
action_server_process,client,tmpdir
['openapi1', 'client', 'action_server_process', 'openapi2', 'calculator']
None
{"Assign": 5, "Expr": 7, "Try": 1}
23
40
23
["Path", "calculator.parent.mkdir", "calculator.write_text", "action_server_process.start", "Path", "json.loads", "client.get_openapi_json", "action_server_process.stop", "ActionServerProcess", "Path", "os.rename", "Path", "Path", "action_server_process.start", "Path", "ActionServerClient", "json.loads", "client.get_op...
0
[]
The function (test_action_package_rename) defined within the public class called public.The function start at line 927 and ends at 966. It contains 35 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [927.0] and does not return any value. It declares 23.0 functions, and It h...
Sema4AI_actions
public
public
0
0
test_action_package_cwd.create_action
def create_action(package_dir: Path):from sema4ai.action_server._selftest import sema4ai_action_server_runpackage_dir.mkdir(parents=True, exist_ok=True)(package_dir / "action.py").write_text("""from sema4ai.actions import actionfrom pathlib import Pathimport oscurdir = Path(__file__).absolute().parent@actiondef do_it()...
1
34
1
60
0
973
1,008
973
null
[]
None
null
0
0
0
null
0
null
The function (test_action_package_cwd.create_action) defined within the public class called public.The function start at line 973 and ends at 1008. It contains 34 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
public
public
0
0
test_action_package_cwd
def test_action_package_cwd(action_server_process: ActionServerProcess, client: ActionServerClient, tmpdir):def create_action(package_dir: Path):from sema4ai.action_server._selftest import sema4ai_action_server_runpackage_dir.mkdir(parents=True, exist_ok=True)(package_dir / "action.py").write_text("""from sema4ai.actio...
2
22
3
111
5
970
1,030
970
action_server_process,client,tmpdir
['found1', 'package_dir2', 'action_server_datadir', 'package_dir1', 'found2']
None
{"Assign": 5, "Expr": 6, "For": 1}
11
61
11
["package_dir.mkdir", "write_text", "sema4ai_action_server_run", "Path", "create_action", "Path", "create_action", "action_server_process.start", "range", "client.post_get_str", "client.post_get_str"]
0
[]
The function (test_action_package_cwd) defined within the public class called public.The function start at line 970 and ends at 1030. It contains 22 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [970.0] and does not return any value. It declares 11.0 functions, and It has...
Sema4AI_actions
public
public
0
0
test_kill_lock_holder
def test_kill_lock_holder(action_server_process: ActionServerProcess, tmpdir, action_server_datadir):from sema4ai.common.wait_for import wait_for_conditionaction_server_process.start(actions_sync=True,cwd=tmpdir,db_file="server.db",)wait_for_condition(lambda: action_server_process.process.is_alive())proc2 = ActionServe...
3
23
3
129
2
1,034
1,060
1,034
action_server_process,tmpdir,action_server_datadir
['proc3', 'proc2']
None
{"Assign": 2, "Expr": 8, "Try": 2, "With": 1}
14
27
14
["action_server_process.start", "wait_for_condition", "action_server_process.process.is_alive", "ActionServerProcess", "proc2.start", "wait_for_condition", "proc2.process.is_alive", "wait_for_condition", "action_server_process.process.is_alive", "ActionServerProcess", "pytest.raises", "proc3.start", "proc3.stop", "proc...
0
[]
The function (test_kill_lock_holder) defined within the public class called public.The function start at line 1034 and ends at 1060. It contains 23 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [1034.0] and does not return any value. It declares 14.0 functions, and It has...
Sema4AI_actions
public
public
0
0
test_server_async_api_requests_while_waiting_for_action_to_complete.run_id_from_request_id_available
def run_id_from_request_id_available():response = client.get_get_response("api/runs/run-id-from-request-id/123",data={},)response.raise_for_status()
1
6
0
23
0
57
62
57
null
[]
None
null
0
0
0
null
0
null
The function (test_server_async_api_requests_while_waiting_for_action_to_complete.run_id_from_request_id_available) defined within the public class called public.The function start at line 57 and ends at 62. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters a...
Sema4AI_actions
public
public
0
0
test_server_async_api_requests_while_waiting_for_action_to_complete.check_cancelled_status
def check_cancelled_status():response = client.get_get_response(f"api/runs/{run_id}", data={})response.raise_for_status()status = response.json()assert status["status"] == 4# 4=cancelled
1
5
0
37
0
87
91
87
null
[]
None
null
0
0
0
null
0
null
The function (test_server_async_api_requests_while_waiting_for_action_to_complete.check_cancelled_status) defined within the public class called public.The function start at line 87 and ends at 91. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does no...