project_name
string
class_name
string
class_modifiers
string
class_implements
int64
class_extends
int64
function_name
string
function_body
string
cyclomatic_complexity
int64
NLOC
int64
num_parameter
int64
num_token
int64
num_variable
int64
start_line
int64
end_line
int64
function_index
int64
function_params
string
function_variable
string
function_return_type
string
function_body_line_type
string
function_num_functions
int64
function_num_lines
int64
outgoing_function_count
int64
outgoing_function_names
string
incoming_function_count
int64
incoming_function_names
string
lexical_representation
string
Sema4AI_actions
public
public
0
0
_main_retcode
def _main_retcode(args: Optional[list[str]],is_subcommand: bool = False,use_db: Optional["Database"] = None,before_start: Sequence[IBeforeStartCallback] = (),) -> int:"""The main entrypoint that returns the returncode.Args:args: The (cli) arguments to run.is_subcommand: This call may be recursive on cases where one com...
18
111
4
502
6
606
769
606
args,is_subcommand,use_db,before_start
['parser', 'args', 'logger', 'command', 'migrate_import_or_start_args', 'log_level']
int
{"AnnAssign": 2, "Assign": 7, "Expr": 14, "If": 14, "Return": 14, "Try": 2, "With": 2}
36
164
36
["_setup_global_logging", "RuntimeError", "_server_expose.main", "_create_parser", "parser.parse_args", "parser.print_help", "print", "sys.stdout.flush", "_get_log_level", "logger.setLevel", "_setup_stderr_logging", "log.debug", "subprocess.list2cmdline", "log.debug", "os.path.abspath", "os.getcwd", "typing.cast", "dow...
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server.cli_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server.package._package_build_py...
The function (_main_retcode) defined within the public class called public.The function start at line 606 and ends at 769. It contains 111 lines of code and it has a cyclomatic complexity of 18. It takes 4 parameters, represented as [606.0] and does not return any value. It declares 36.0 functions, It has 36.0 function...
Sema4AI_actions
public
public
0
0
_basic_setup
def _basic_setup(base_args: ArgumentsNamespaceRequiringDatadir,rcc: "Rcc",):from ._settings import setup_settingswith setup_settings(base_args) as settings:settings.datadir.mkdir(parents=True, exist_ok=True)yield _SetupInfo(rcc=rcc, settings=settings)
1
8
2
50
0
779
788
779
base_args,rcc
[]
None
{"Expr": 2, "With": 1}
3
10
3
["setup_settings", "settings.datadir.mkdir", "_SetupInfo"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._main_retcode"]
The function (_basic_setup) defined within the public class called public.The function start at line 779 and ends at 788. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [779.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions call...
Sema4AI_actions
public
public
0
0
_command_requiring_datadir._use_db_ctx
def _use_db_ctx(*args, **kwags):yield use_db
1
2
2
11
0
844
845
844
null
[]
None
null
0
0
0
null
0
null
The function (_command_requiring_datadir._use_db_ctx) defined within the public class called public.The function start at line 844 and ends at 845. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [844.0] and does not return any value..
Sema4AI_actions
public
public
0
0
_command_requiring_datadir
def _command_requiring_datadir(base_args: ArgumentsNamespaceRequiringDatadir,command: Literal["import"]| Literal["migrate"]| Literal["start"]| Literal["datadir"],setup_info: _SetupInfo,use_db: Optional["Database"] = None,before_start: Sequence[IBeforeStartCallback] = (),) -> int:from sema4ai.common.app_mutex import obt...
35
173
5
807
12
791
1,009
791
base_args,command,setup_info,use_db,before_start
['runs_to_cancel', 'migration_status', 'parent_pid', 'use_db_ctx', 'db_path', 'code', 'expose_session', 'confirm', 'mutex', 'api_key', 'is_new', 'current_status_str']
int
{"AnnAssign": 3, "Assign": 22, "Expr": 18, "For": 1, "If": 26, "Return": 13, "Try": 2, "With": 3}
45
219
45
["obtain_app_mutex", "_setup_logging", "_get_log_level", "os.path.exists", "log.info", "log.critical", "migrate_db", "db_migration_status", "migrate_db", "log.critical", "use_db_ctx", "_import_actions", "typing.cast", "datadir_command", "typing.cast", "typing.cast", "log.debug", "setup_info.rcc.feedack_metric", "exit_w...
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._main_retcode"]
The function (_command_requiring_datadir) defined within the public class called public.The function start at line 791 and ends at 1009. It contains 173 lines of code and it has a cyclomatic complexity of 35. It takes 5 parameters, represented as [791.0] and does not return any value. It declares 45.0 functions, It has...
Sema4AI_actions
public
public
0
0
_make_table_name
def _make_table_name(cls: type):cls_name = cls.__name__s1 = _RE_FIRST_CAP.sub(r"\1_\2", cls_name)ret = _RE_ALL_CAP.sub(r"\1_\2", s1).lower()# At this point something as OAuth2UserData is `o_auth2_user_data`return ret
1
5
1
40
3
34
40
34
cls
['cls_name', 'ret', 's1']
Returns
{"Assign": 3, "Return": 1}
3
7
3
["_RE_FIRST_CAP.sub", "lower", "_RE_ALL_CAP.sub"]
12
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._database_py.Database.all", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._database_p...
The function (_make_table_name) defined within the public class called public.The function start at line 34 and ends at 40. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declares 3.0 functions, It has 3.0 functions ca...
Sema4AI_actions
public
public
0
0
datetime_to_str
def datetime_to_str(val: datetime.datetime) -> str:return val.isoformat()
1
2
1
17
0
47
48
47
val
[]
str
{"Return": 1}
1
2
1
["val.isoformat"]
7
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.91560513_saic_ismart_api_saic_python_mqtt_gateway.src.status_publisher.__init___py.VehicleDataPublisher._publish_directly", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.91560513_saic_ismart_api_saic_python_mqtt_gat...
The function (datetime_to_str) defined within the public class called public.The function start at line 47 and ends at 48. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called ins...
Sema4AI_actions
public
public
0
0
str_to_datetime
def str_to_datetime(val: str) -> datetime.datetime:return datetime.datetime.fromisoformat(val)
1
2
1
20
0
51
52
51
val
[]
datetime.datetime
{"Return": 1}
1
2
1
["datetime.datetime.fromisoformat"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_server_py.test_full_run"]
The function (str_to_datetime) defined within the public class called public.The function start at line 51 and ends at 52. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called ins...
Sema4AI_actions
DBRules
public
0
0
__init__
def __init__(self) -> None:# Fields which should have unique indexes in the format:# "Class.field_name"self.unique_indexes: Set[str] = set()# Fields which should have indexes in the format:# "Class.field_name"self.indexes: Set[str] = set()# Fields which are foreign keys in the format:# "Class.field_name"self.foreign_ke...
1
4
1
43
0
60
71
60
self
[]
None
{"AnnAssign": 3}
3
12
3
["set", "set", "set"]
6,243
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called DBRules.The function start at line 60 and ends at 71. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called inside...
Sema4AI_actions
DBRules
public
0
0
__init__
def __init__(self, db_path: Optional[Union[Path, str]] = None):self._cls_to_type_hint: Dict[type, dict] = {}if not db_path:from ._settings import get_settingsself._db_path = get_settings().datadir / "server.db"else:self._db_path = Path(db_path)self._table_name_to_cls: Dict[str, type] = {}self._tlocal = threading.local(...
2
12
2
114
0
88
101
88
self
[]
None
{"AnnAssign": 3}
3
12
3
["set", "set", "set"]
6,243
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called DBRules.The function start at line 88 and ends at 101. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [88.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions called i...
Sema4AI_actions
Database
public
0
0
db_path
def db_path(self) -> Path:return self._db_path
1
2
1
11
0
104
105
104
self
[]
Path
{"Return": 1}
0
2
0
[]
0
[]
The function (db_path) defined within the public class called Database.The function start at line 104 and ends at 105. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
Database
public
0
0
log_internal_info
def log_internal_info(self):log.debug("sqlite version: %s", sqlite3.sqlite_version)
1
2
1
15
0
107
108
107
self
[]
None
{"Expr": 1}
1
2
1
["log.debug"]
0
[]
The function (log_internal_info) defined within the public class called Database.The function start at line 107 and ends at 108. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 function...
Sema4AI_actions
Database
public
0
0
_get_type_hints
def _get_type_hints(self, cls) -> dict:try:return self._cls_to_type_hint[cls]except KeyError:from typing import get_type_hintsret = get_type_hints(cls)self._cls_to_type_hint[cls] = retreturn ret
2
8
2
41
0
110
118
110
self,cls
[]
dict
{"Assign": 2, "Return": 2, "Try": 1}
1
9
1
["get_type_hints"]
0
[]
The function (_get_type_hints) defined within the public class called Database.The function start at line 110 and ends at 118. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [110.0] and does not return any value. It declare 1.0 function, and It has 1.0 functi...
Sema4AI_actions
Database
public
0
0
_iter_name_and_name_cls_fields
def _iter_name_and_name_cls_fields(self, cls) -> Iterator[Tuple[str, type]]:yield from self._get_type_hints(cls).items()
1
2
2
29
0
120
121
120
self,cls
[]
Iterator[Tuple[str, type]]
{"Expr": 1}
2
2
2
["items", "self._get_type_hints"]
0
[]
The function (_iter_name_and_name_cls_fields) defined within the public class called Database.The function start at line 120 and ends at 121. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [120.0] and does not return any value. It declares 2.0 functions, and ...
Sema4AI_actions
Database
public
0
0
_iter_name_fields
def _iter_name_fields(self, cls) -> Iterator[str]:yield from self._get_type_hints(cls).keys()
1
2
2
24
0
123
124
123
self,cls
[]
Iterator[str]
{"Expr": 1}
2
2
2
["keys", "self._get_type_hints"]
0
[]
The function (_iter_name_fields) defined within the public class called Database.The function start at line 123 and ends at 124. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [123.0] and does not return any value. It declares 2.0 functions, and It has 2.0 fu...
Sema4AI_actions
Database
public
0
0
connect
def connect(self) -> Iterator[None]:try:conn = self._tlocal.connexcept AttributeError:conn = Noneif conn is not None:yieldreturnwith closing(sqlite3.connect(self._db_path, isolation_level=None)) as conn:conn.execute("PRAGMA foreign_keys = ON")self._tlocal.conn = conntry:yieldfinally:self._tlocal.conn = None
4
15
1
77
0
127
143
127
self
[]
Iterator[None]
{"Assign": 4, "Expr": 3, "If": 1, "Return": 1, "Try": 2, "With": 1}
3
17
3
["closing", "sqlite3.connect", "conn.execute"]
76
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3536723_plivo_plivoframework.src.plivo.core.freeswitch.outboundsocket_py.OutboundEventSocket.connect", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3561619_pymysql_tornado_mysql.tornado_mysql.pools_py.Pool._get_con...
The function (connect) defined within the public class called Database.The function start at line 127 and ends at 143. It contains 15 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called ins...
Sema4AI_actions
Database
public
0
0
_next_savepoint_name
def _next_savepoint_name(self):return f"savepoint_{next(self._counter)}"
1
2
1
8
0
145
146
145
self
[]
Returns
{"Return": 1}
1
2
1
["next"]
0
[]
The function (_next_savepoint_name) defined within the public class called Database.The function start at line 145 and ends at 146. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declare 1.0 function, and It has 1.0 f...
Sema4AI_actions
Database
public
0
0
cursor
def cursor(self) -> Iterator[sqlite3.Cursor]:"""A cursor should be requested to do queries."""try:conn = self._tlocal.connexcept AttributeError:conn = Noneif conn is None:raise RuntimeError("Error. Cannot create a cursor without a connection in place.")with closing(conn.cursor()) as cur:yield cur
3
11
1
52
0
149
163
149
self
[]
Iterator[sqlite3.Cursor]
{"Assign": 2, "Expr": 2, "If": 1, "Try": 1, "With": 1}
3
15
3
["RuntimeError", "closing", "conn.cursor"]
38
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3561619_pymysql_tornado_mysql.tornado_mysql.connections_py.Connection.cursor", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3561619_pymysql_tornado_mysql.tornado_mysql.tests.test_connection_py.TestConnection.test_l...
The function (cursor) defined within the public class called Database.The function start at line 149 and ends at 163. It contains 11 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called insi...
Sema4AI_actions
Database
public
0
0
in_transaction
def in_transaction(self) -> bool:"""Returns:True if we're currently in a transaction and False otherwise."""try:in_transaction = self._tlocal.in_transactionexcept AttributeError:in_transaction = self._tlocal.in_transaction = 0return in_transaction > 0
2
6
1
33
0
165
175
165
self
[]
bool
{"Assign": 2, "Expr": 1, "Return": 1, "Try": 1}
0
11
0
[]
0
[]
The function (in_transaction) defined within the public class called Database.The function start at line 165 and ends at 175. 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
Database
public
0
0
transaction
def transaction(self) -> Iterator[None]:"""A transaction should be created when contents are about to be written.SQLite can't deal with multiple writers, so, we use a lock in Pythonwhich will prevent other threads from writing at the same time.Important: as a lock is held in python, it's important to try to minimizethe...
9
44
1
181
0
178
253
178
self
[]
Iterator[None]
{"Assign": 5, "AugAssign": 4, "Expr": 9, "If": 2, "Return": 1, "Try": 4, "With": 1}
8
76
8
["DBError", "self._next_savepoint_name", "self.execute", "self.execute", "self.execute", "log.exception", "conn.rollback", "conn.commit"]
14
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.app.models.__init___py.transactional", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3695233_trigger_trigger.trigger.packages.peewee_py.Database.transaction", "_.content.gdrive.MyDr...
The function (transaction) defined within the public class called Database.The function start at line 178 and ends at 253. It contains 44 lines of code and it has a cyclomatic complexity of 9. The function does not take any parameters and does not return any value. It declares 8.0 functions, It has 8.0 functions called...
Sema4AI_actions
Database
public
0
0
where
def where(self, instance, keys: Sequence[str]) -> tuple[str, list[Any]]:"""Makes an sql which can be used in a where clause.Example:Something as:sql,values = db.where(some_class, keys=['id', 'age'])Will have as result:'id=? AND age=?', [id_value, age_value])"""sql = ""values = []for i, key in enumerate(keys):if i != 0:...
3
9
3
71
0
255
275
255
self,instance,keys
[]
tuple[str, list[Any]]
{"Assign": 2, "AugAssign": 2, "Expr": 2, "For": 1, "If": 1, "Return": 1}
3
21
3
["enumerate", "values.append", "getattr"]
410
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3581943_jasonmillward_autorippr.classes.database_py.next_video_to_compress", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3581943_jasonmillward_autorippr.classes.database_py.next_video_to_filebot", "_.content.gdriv...
The function (where) defined within the public class called Database.The function start at line 255 and ends at 275. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [255.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions called in...
Sema4AI_actions
Database
public
0
0
where_from_dict
def where_from_dict(self, dct: dict[str, Any]) -> tuple[str, list[Any]]:"""Makes an sql which can be used in a where clause.Example:Something as:sql,values = db.where_from_dict(some_class, keys=['id', 'age'])Will have as result:'id=? AND age=?', [id_value, age_value])"""sql = ""values = []for i, (key, value) in enumera...
3
9
2
74
0
277
297
277
self,dct
[]
tuple[str, list[Any]]
{"Assign": 2, "AugAssign": 2, "Expr": 2, "For": 1, "If": 1, "Return": 1}
3
21
3
["enumerate", "dct.items", "values.append"]
0
[]
The function (where_from_dict) defined within the public class called Database.The function start at line 277 and ends at 297. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [277.0] and does not return any value. It declares 3.0 functions, and It has 3.0 func...
Sema4AI_actions
Database
public
0
0
delete_where
def delete_where(self, cls: Type, where: str, values: list[Any]):table_name = _make_table_name(cls)self.execute(f"DELETE FROM {table_name} WHERE {where}", values)
1
3
4
35
0
299
301
299
self,cls,where,values
[]
None
{"Assign": 1, "Expr": 1}
2
3
2
["_make_table_name", "self.execute"]
0
[]
The function (delete_where) defined within the public class called Database.The function start at line 299 and ends at 301. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [299.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functio...
Sema4AI_actions
Database
public
0
0
delete
def delete(self, instance, keys: Sequence[str]):"""Deletes the given instance from the db given the keys given."""table_name = _make_table_name(instance.__class__)sql, values = self.where(instance, keys)self.execute(f"DELETE FROM {table_name} WHERE {sql}", values)
1
4
3
44
0
303
310
303
self,instance,keys
[]
None
{"Assign": 2, "Expr": 2}
3
8
3
["_make_table_name", "self.where", "self.execute"]
259
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.test.test_handlers.api.test_package_versions_py.PackageVersionsTest.test_api_dartdoc_requires_oauth_key", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dart...
The function (delete) defined within the public class called Database.The function start at line 303 and ends at 310. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [303.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions called i...
Sema4AI_actions
Database
public
0
0
insert_or_update
def insert_or_update(self, instance, keys: Sequence[str] = ("id",)):"""Updates database values from some instance given its id."""table_name = _make_table_name(instance.__class__)where, values = self.where(instance, keys)sql = f"SELECT * FROM {table_name} WHERE {where}"try:self.first(instance.__class__, sql, values)exc...
2
10
3
77
0
312
327
312
self,instance,keys
[]
None
{"Assign": 3, "Expr": 4, "Try": 1}
5
16
5
["_make_table_name", "self.where", "self.first", "self.insert", "self.update_by_fields"]
0
[]
The function (insert_or_update) defined within the public class called Database.The function start at line 312 and ends at 327. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [312.0] and does not return any value. It declares 5.0 functions, and It has 5.0 fu...
Sema4AI_actions
Database
public
0
0
update
def update(self, instance, *fields: str):"""Updates database values from some instance given its id.Args:fields: The name of the fields that should be updated(only the selected fields will be updated)."""fields_dict: dict[str, Any] = {}for field in fields:fields_dict[field] = getattr(instance, field)self.update_by_id(i...
2
5
3
54
0
329
340
329
self,instance,*fields
[]
None
{"AnnAssign": 1, "Assign": 1, "Expr": 2, "For": 1}
2
12
2
["getattr", "self.update_by_id"]
1,190
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.cherrypy._cpconfig_py.merge", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3537748_rainerf_ricodebug.src.datagraph.htmlvariableview_py.HtmlVariableView.render", "_.cont...
The function (update) defined within the public class called Database.The function start at line 329 and ends at 340. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [329.0] and does not return any value. It declares 2.0 functions, It has 2.0 functions called i...
Sema4AI_actions
Database
public
0
0
update_by_id
def update_by_id(self, cls: Type, id: Any, fields: dict[str, Any]):"""Updates database values from some instance given its id."""table_name = _make_table_name(cls)set_fields = []values = []for name, value in fields.items():set_fields.append(f"{name}=?")values.append(value)values.append(id)sql = f"UPDATE {table_name} SE...
2
10
4
79
0
342
355
342
self,cls,id,fields
[]
None
{"Assign": 4, "Expr": 5, "For": 1}
7
14
7
["_make_table_name", "fields.items", "set_fields.append", "values.append", "values.append", "join", "self.execute"]
0
[]
The function (update_by_id) defined within the public class called Database.The function start at line 342 and ends at 355. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [342.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functi...
Sema4AI_actions
Database
public
0
0
update_by_fields
def update_by_fields(self, instance, keys: Sequence[str]):"""Updates all the database values from some instance.Args:instance: The instance with the values to be update.keys: The keys for which the values should be updated."""set_placeholders: list[str] = []set_values = []where_placeholders: list[str] = []where_values ...
3
15
3
120
0
357
383
357
self,instance,keys
[]
None
{"AnnAssign": 2, "Assign": 4, "Expr": 6, "For": 1, "If": 1}
11
27
11
["self._iter_name_and_name_cls_fields", "where_placeholders.append", "where_values.append", "getattr", "set_placeholders.append", "set_values.append", "getattr", "_make_table_name", "join", "join", "self.execute"]
0
[]
The function (update_by_fields) defined within the public class called Database.The function start at line 357 and ends at 383. It contains 15 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [357.0] and does not return any value. It declares 11.0 functions, and It has 11.0 ...
Sema4AI_actions
Database
public
0
0
insert
def insert(self,instance,) -> None:table_name = _make_table_name(instance.__class__)field_names = []values = []placeholders = []for name in self._iter_name_fields(instance.__class__):field_names.append(name)values.append(getattr(instance, name))placeholders.append("?")fields_str = ", ".join(field_names)placeholders_str...
2
17
2
91
0
385
410
385
self,instance
[]
None
{"Assign": 6, "Expr": 4, "For": 1}
9
26
9
["_make_table_name", "self._iter_name_fields", "field_names.append", "values.append", "getattr", "placeholders.append", "join", "join", "self.execute"]
83
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.markdown.blockprocessors_py.ListIndentProcessor.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.markdown.blockprocessor...
The function (insert) defined within the public class called Database.The function start at line 385 and ends at 410. It contains 17 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [385.0] and does not return any value. It declares 9.0 functions, It has 9.0 functions called ...
Sema4AI_actions
Database
public
0
0
all
def all(self,cls: Type[T],*,offset: Optional[int] = None,limit: Optional[int] = None,order_by: Optional[str] = None,where: Optional[str] = None,values: Optional[list] = None,) -> List[T]:table_name = _make_table_name(cls)if limit is not None:assert isinstance(limit, int)if offset is not None:assert isinstance(offset, i...
7
25
7
140
0
412
444
412
self,cls,offset,limit,order_by,where,values
[]
List[T]
{"Assign": 2, "AugAssign": 4, "If": 6, "Return": 1}
4
33
4
["_make_table_name", "isinstance", "isinstance", "self.select"]
1,473
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3495544_aio_libs_multidict.tests.test_multidict_py.test_convert_multidict_to_cimultidict_and_back", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527220_mitar_django_mongo_auth.mongo_auth.forms_py.PasswordResetForm...
The function (all) defined within the public class called Database.The function start at line 412 and ends at 444. It contains 25 lines of code and it has a cyclomatic complexity of 7. It takes 7 parameters, represented as [412.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions called ins...
Sema4AI_actions
Database
public
0
0
select
def select(self, cls: Type[T], sql: str, values: Optional[list] = None):with self.cursor() as cursor:self.execute_query(cursor, sql, values)return [cls(*x) for x in cursor.fetchall()]
2
4
4
60
0
446
449
446
self,cls,sql,values
[]
Returns
{"Expr": 1, "Return": 1, "With": 1}
4
4
4
["self.cursor", "self.execute_query", "cls", "cursor.fetchall"]
394
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.test.testcase_py.TestCase.assert_list_in_html", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3654448_hasgeek_lastuser.migrations.versions.3b3583fcbaea_namespace_column_py.upgrade",...
The function (select) defined within the public class called Database.The function start at line 446 and ends at 449. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [446.0], and this function return a value. It declares 4.0 functions, It has 4.0 functions call...
Sema4AI_actions
Database
public
0
0
first
def first(self,cls: Type[T],query: Optional[str] = None,values: Optional[List[Any]] = None,) -> T:"""Note: we want to use plain sql, not a bunch of ORM to query.Maybe we can use the same structure as:https://github.com/kruxia/sqlyto build the SQL though (but right now the query is justthe actual SQL with placeholders a...
3
15
4
95
0
451
487
451
self,cls,query,values
[]
T
{"Assign": 3, "Expr": 2, "If": 2, "Return": 1, "With": 1}
6
37
6
["_make_table_name", "self.cursor", "self.execute_query", "cursor.fetchone", "KeyError", "cls"]
517
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3644508_geodesign_django_raster.raster.migrations.0036_auto_20170509_0548_py.set_legend_on_entry", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3644508_geodesign_django_raster.raster.tiles.parser_py.RasterLayerPars...
The function (first) defined within the public class called Database.The function start at line 451 and ends at 487. It contains 15 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [451.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions called i...
Sema4AI_actions
Database
public
0
0
list_table_names
def list_table_names(self) -> List[str]:with self.cursor() as cursor:self.execute_query(cursor,"""SELECTnameFROMsqlite_masterWHEREtype ='table' ANDname NOT LIKE 'sqlite_%';""",)return [x[0] for x in cursor.fetchall()]
2
15
1
43
0
489
503
489
self
[]
List[str]
{"Expr": 1, "Return": 1, "With": 1}
3
15
3
["self.cursor", "self.execute_query", "cursor.fetchall"]
0
[]
The function (list_table_names) defined within the public class called Database.The function start at line 489 and ends at 503. 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 3.0 functions, and It has 3.0 functi...
Sema4AI_actions
Database
public
0
0
list_table_and_columns
def list_table_and_columns(self) -> Dict[str, List[str]]:with self.cursor() as cursor:self.execute_query(cursor,"""SELECT m.name as tableName,p.name as columnNameFROM sqlite_master mleft outer join pragma_table_info((m.name)) p on m.name <> p.nameorder by tableName, columnName;""",)found: Dict[str, List[str]] = {}for t...
3
20
1
87
0
505
524
505
self
[]
Dict[str, List[str]]
{"AnnAssign": 1, "Assign": 2, "Expr": 2, "For": 1, "If": 1, "Return": 1, "With": 1}
5
20
5
["self.cursor", "self.execute_query", "cursor.fetchall", "found.get", "columns.append"]
0
[]
The function (list_table_and_columns) defined within the public class called Database.The function start at line 505 and ends at 524. It contains 20 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 ...
Sema4AI_actions
Database
public
0
0
list_indexes
def list_indexes(self) -> List[List[str]]:with self.cursor() as cursor:self.execute_query(cursor,"""SELECT m.tbl_name as table_name,il.name as index_name,ii.name as column_name,CASE il.origin when 'pk' then 1 else 0 END as is_primary_key,CASE il.[unique] when 1 then 0 else 1 END as non_unique,il.[unique] as is_unique,i...
2
31
1
43
0
526
556
526
self
[]
List[List[str]]
{"Expr": 1, "Return": 1, "With": 1}
3
31
3
["self.cursor", "self.execute_query", "cursor.fetchall"]
0
[]
The function (list_indexes) defined within the public class called Database.The function start at line 526 and ends at 556. It contains 31 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions ...
Sema4AI_actions
Database
public
0
0
list_whole_db
def list_whole_db(self) -> Dict[str, List[Dict[str, Any]]]:table_to_contents: Dict[str, List[Dict[str, Any]]] = {}for table, cls in self._table_name_to_cls.items():with self.cursor() as cursor:self.execute_query(cursor, f"SELECT * FROM {table}")cls = self._table_name_to_cls[table]field_names = list(self._iter_name_fiel...
3
12
1
126
0
558
571
558
self
[]
Dict[str, List[Dict[str, Any]]]
{"AnnAssign": 1, "Assign": 4, "Expr": 2, "For": 2, "Return": 1, "With": 1}
9
14
9
["self._table_name_to_cls.items", "self.cursor", "self.execute_query", "list", "self._iter_name_fields", "cursor.fetchall", "rows.append", "dict", "itertools.zip_longest"]
0
[]
The function (list_whole_db) defined within the public class called Database.The function start at line 558 and ends at 571. It contains 12 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions...
Sema4AI_actions
Database
public
0
0
load_whole_db
def load_whole_db(self, contents: Dict[str, List[Dict[str, Any]]]) -> None:with self.transaction():for table, table_rows in contents.items():cls = self._table_name_to_cls[table]for row in table_rows:instance = cls(**row)self.insert(instance)
3
7
2
68
0
573
579
573
self,contents
[]
None
{"Assign": 2, "Expr": 1, "For": 2, "With": 1}
4
7
4
["self.transaction", "contents.items", "cls", "self.insert"]
0
[]
The function (load_whole_db) defined within the public class called Database.The function start at line 573 and ends at 579. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [573.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functi...
Sema4AI_actions
Database
public
0
0
_print_sql
def _print_sql(self, sql: str, values: Optional[list] = None):func_name = sys._getframe(1).f_code.co_nameprint(f"db.{func_name}('''\n{sql.strip()}\n''', {values!r})\n")
1
3
3
35
0
581
583
581
self,sql,values
[]
None
{"Assign": 1, "Expr": 1}
3
3
3
["sys._getframe", "print", "sql.strip"]
0
[]
The function (_print_sql) defined within the public class called Database.The function start at line 581 and ends at 583. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [581.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions...
Sema4AI_actions
Database
public
0
0
_raise_execute_error
def _raise_execute_error(self, msg):if self.verbose:print(msg, file=sys.stderr)raise DBError(msg)
2
4
2
27
0
585
588
585
self,msg
[]
None
{"Expr": 1, "If": 1}
2
4
2
["print", "DBError"]
0
[]
The function (_raise_execute_error) defined within the public class called Database.The function start at line 585 and ends at 588. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [585.0] and does not return any value. It declares 2.0 functions, and It has 2.0...
Sema4AI_actions
Database
public
0
0
execute_query
def execute_query(self, cursor: sqlite3.Cursor, sql: str, values: Optional[list] = None):"""Executes a query which will NOT change the database (and should return values).No write-lock needed."""if self.verbose:self._print_sql(sql, values)try:if values:cursor.execute(sql, values)else:cursor.execute(sql)except Exception...
4
14
4
69
0
590
609
590
self,cursor,sql,values
[]
None
{"Expr": 5, "If": 2, "Try": 1}
4
20
4
["self._print_sql", "cursor.execute", "cursor.execute", "self._raise_execute_error"]
0
[]
The function (execute_query) defined within the public class called Database.The function start at line 590 and ends at 609. It contains 14 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [590.0] and does not return any value. It declares 4.0 functions, and It has 4.0 funct...
Sema4AI_actions
Database
public
0
0
execute_update_returning
def execute_update_returning(self, cursor: sqlite3.Cursor, sql: str, values: Optional[list] = None):"""Executes a query which will NOT change the database (and should return values).No write-lock needed."""if self.verbose:self._print_sql(sql, values)try:if not self.in_transaction():raise DBError("When running an sql th...
5
20
4
88
0
611
635
611
self,cursor,sql,values
[]
None
{"Expr": 5, "If": 3, "Try": 1, "With": 1}
6
25
6
["self._print_sql", "self.in_transaction", "DBError", "cursor.execute", "cursor.execute", "self._raise_execute_error"]
0
[]
The function (execute_update_returning) defined within the public class called Database.The function start at line 611 and ends at 635. It contains 20 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [611.0] and does not return any value. It declares 6.0 functions, and It ha...
Sema4AI_actions
Database
public
0
0
execute
def execute(self, sql: str, values: Optional[list] = None) -> None:"""Executes a query which will change the database.Requires the write-lock to be acquired since SQLite can't deal withwrites in multiple threads concurrently."""if self.verbose:self._print_sql(sql, values)try:if not self.in_transaction():raise DBError("...
5
20
3
96
0
637
663
637
self,sql,values
[]
None
{"Assign": 1, "Expr": 5, "If": 3, "Try": 1, "With": 1}
6
27
6
["self._print_sql", "self.in_transaction", "DBError", "conn.execute", "conn.execute", "self._raise_execute_error"]
224
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.app.handlers.search_py.Search._query_search", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3650710_avinashreddy3108_paperplaneextended.userbot.modules.gdrive_py.create_directory", ...
The function (execute) defined within the public class called Database.The function start at line 637 and ends at 663. It contains 20 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [637.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions called...
Sema4AI_actions
Database
public
0
0
register_classes
def register_classes(self, classes: List[Type]) -> None:if self._table_name_to_cls:values = set(self._table_name_to_cls.values())if values != set(classes):raise RuntimeError("The classes were already registered ""(and do not match the new values).")# i.e.: they were already registered.returnself._classes = classesfor c...
4
12
2
67
0
665
678
665
self,classes
[]
None
{"Assign": 3, "For": 1, "If": 2, "Return": 1}
5
14
5
["set", "self._table_name_to_cls.values", "set", "RuntimeError", "_make_table_name"]
0
[]
The function (register_classes) defined within the public class called Database.The function start at line 665 and ends at 678. It contains 12 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [665.0] and does not return any value. It declares 5.0 functions, and It has 5.0 fu...
Sema4AI_actions
Database
public
0
0
initialize
def initialize(self, classes: List[Type]) -> None:"""Initializes the internal structure of the tables as needed(but doesn't really create the db -- use 'create_tables'if needed)."""self.register_classes(classes)
1
2
2
21
0
680
686
680
self,classes
[]
None
{"Expr": 2}
1
7
1
["self.register_classes"]
20
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3392496_unipitechnology_evok.evok.rpc_handler_py.UserBasicHelper.initialize", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3711345_tableau_tabpy.tabpy.tabpy_server.handlers.endpoint_handler_py.EndpointHandler.initi...
The function (initialize) defined within the public class called Database.The function start at line 680 and ends at 686. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [680.0] and does not return any value. It declare 1.0 function, It has 1.0 function called ...
Sema4AI_actions
Database
public
0
0
create_tables
def create_tables(self, db_rules: Optional[DBRules] = None):if db_rules is None:db_rules = DBRules()sqls = []for cls in self._classes:sql = self.create_table_sql(cls, db_rules)sqls.append(sql)sqls.extend(self.create_unique_indexes_sql(cls, db_rules))sqls.extend(self.create_non_unique_indexes_sql(cls, db_rules))with sel...
4
13
2
102
0
688
703
688
self,db_rules
[]
None
{"Assign": 3, "Expr": 4, "For": 2, "If": 1, "With": 2}
10
16
10
["DBRules", "self.create_table_sql", "sqls.append", "sqls.extend", "self.create_unique_indexes_sql", "sqls.extend", "self.create_non_unique_indexes_sql", "self.connect", "self.transaction", "self.execute"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3581943_jasonmillward_autorippr.classes.database_py.db_integrity_check", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3965417_google_llvm_premerge_checks.scripts.metrics.repo_hist_db_py.update_comits", "_.content.g...
The function (create_tables) defined within the public class called Database.The function start at line 688 and ends at 703. It contains 13 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [688.0] and does not return any value. It declares 10.0 functions, It has 10.0 function...
Sema4AI_actions
Database
public
0
0
create_unique_indexes_sql
def create_unique_indexes_sql(self, cls: Type, db_rules: DBRules) -> List[str]:table_name = _make_table_name(cls)columns: List[str] = []for name in self._iter_name_fields(cls):field_full_name = f"{cls.__name__}.{name}"if field_full_name in db_rules.unique_indexes:columns.append(name)ret: List[str] = []for column in col...
4
11
3
86
0
705
720
705
self,cls,db_rules
[]
List[str]
{"AnnAssign": 2, "Assign": 3, "Expr": 2, "For": 2, "If": 1, "Return": 1}
4
16
4
["_make_table_name", "self._iter_name_fields", "columns.append", "ret.append"]
0
[]
The function (create_unique_indexes_sql) defined within the public class called Database.The function start at line 705 and ends at 720. It contains 11 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [705.0] and does not return any value. It declares 4.0 functions, and It h...
Sema4AI_actions
Database
public
0
0
create_non_unique_indexes_sql
def create_non_unique_indexes_sql(self, cls: Type, db_rules: DBRules) -> List[str]:table_name = _make_table_name(cls)columns: List[str] = []for name in self._iter_name_fields(cls):field_full_name = f"{cls.__name__}.{name}"if field_full_name in db_rules.indexes:columns.append(name)ret: List[str] = []for column in column...
4
11
3
86
0
722
737
722
self,cls,db_rules
[]
List[str]
{"AnnAssign": 2, "Assign": 3, "Expr": 2, "For": 2, "If": 1, "Return": 1}
4
16
4
["_make_table_name", "self._iter_name_fields", "columns.append", "ret.append"]
0
[]
The function (create_non_unique_indexes_sql) defined within the public class called Database.The function start at line 722 and ends at 737. It contains 11 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [722.0] and does not return any value. It declares 4.0 functions, and ...
Sema4AI_actions
Database
public
0
0
create_table_sql
def create_table_sql(self, cls: Type, db_rules: DBRules) -> str:table_name = _make_table_name(cls)fields = []foreign_keys = []for name, field_cls in self._iter_name_and_name_cls_fields(cls):field_full_name = f"{cls.__name__}.{name}"fields.append(self._get_field_create_sql(cls, field_full_name, name, field_cls, db_rules...
4
25
3
131
0
739
772
739
self,cls,db_rules
[]
str
{"Assign": 7, "Expr": 3, "For": 1, "If": 2, "Return": 1}
9
34
9
["_make_table_name", "self._iter_name_and_name_cls_fields", "fields.append", "self._get_field_create_sql", "name.endswith", "RuntimeError", "foreign_keys.append", "fields.extend", "join"]
0
[]
The function (create_table_sql) defined within the public class called Database.The function start at line 739 and ends at 772. It contains 25 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [739.0] and does not return any value. It declares 9.0 functions, and It has 9.0 fu...
Sema4AI_actions
Database
public
0
0
_get_field_create_sql
def _get_field_create_sql(self,cls,field_full_name: str,name: str,field_cls: Type,db_rules: DBRules,) -> str:primary_key = name == "id"if field_cls.__name__ == "Optional":not_none = [x for x in field_cls.__args__ if x != NoneType]assert len(not_none) == 1, f"Expected one not none in: {field_cls.__args__}"field_cls = no...
19
53
6
221
0
774
840
774
self,cls,field_full_name,name,field_cls,db_rules
[]
str
{"Assign": 18, "If": 11, "Return": 1, "Try": 2}
5
67
5
["len", "getattr", "RuntimeError", "RuntimeError", "getattr"]
0
[]
The function (_get_field_create_sql) defined within the public class called Database.The function start at line 774 and ends at 840. It contains 53 lines of code and it has a cyclomatic complexity of 19. It takes 6 parameters, represented as [774.0] and does not return any value. It declares 5.0 functions, and It has ...
Sema4AI_actions
public
public
0
0
datadir_command
def datadir_command(args: ArgumentsNamespaceDatadir,) -> int:if args.datadir_command == "clear-actions":_clear_all_actions()return 0
2
6
1
22
0
8
13
8
args
[]
int
{"Expr": 1, "If": 1, "Return": 1}
1
6
1
["_clear_all_actions"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._command_requiring_datadir"]
The function (datadir_command) defined within the public class called public.The function start at line 8 and ends at 13. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called insi...
Sema4AI_actions
public
public
0
0
_clear_all_actions
def _clear_all_actions():"""Disables all previously imported actions in the database.Args:datadir: The data directory where the database is located.Returns:None"""from sema4ai.action_server._models import Action, get_dbtry:db = get_db()all_actions = db.all(Action)if not all_actions:log.info("No actions found to disable...
6
22
0
129
3
16
50
16
['all_actions', 'db', 'disabled_count']
None
{"Assign": 3, "AugAssign": 1, "Expr": 7, "For": 1, "If": 3, "Return": 1, "Try": 1, "With": 1}
11
35
11
["get_db", "db.all", "log.info", "db.transaction", "log.info", "db.update_by_id", "dict", "log.info", "log.info", "log.error", "str"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._datadir_commands_py.datadir_command"]
The function (_clear_all_actions) defined within the public class called public.The function start at line 16 and ends at 50. It contains 22 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value. It declares 11.0 functions, It has 11.0 functions c...
Sema4AI_actions
public
public
0
0
_handle_devenv_task_command
def _handle_devenv_task_command(devenv_args: ArgumentsNamespaceDevEnvTask) -> int:import os.pathimport shleximport subprocessimport sysfrom pathlib import Pathfrom sema4ai.action_server._robo_utils.process import build_python_launch_envfrom ._action_package_handler import ActionPackageHandlerfrom ._settings import setu...
26
110
1
599
13
11
141
11
devenv_args
['env', 'env_val', 'm', 'command_path', 'popen', 'action_package_handler', 'dev_tasks', 'c', 'package_yaml_contents', 'cwd', 'datadir', 'task_command', 'PATH']
int
{"AnnAssign": 2, "Assign": 16, "Expr": 20, "For": 6, "If": 16, "Return": 12, "Try": 2, "With": 1}
52
131
52
["log.critical", "isinstance", "log.critical", "type", "setup_settings", "ActionPackageHandler", "Path", "log.critical", "os.path.abspath", "log.critical", "action_package_handler.bootstrap_environment", "build_python_launch_env", "package_yaml_contents.get", "dev_tasks.get", "log.critical", "isinstance", "log.critical...
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._devenv_py.handle_devenv_command"]
The function (_handle_devenv_task_command) defined within the public class called public.The function start at line 11 and ends at 141. It contains 110 lines of code and it has a cyclomatic complexity of 26. The function does not take any parameters and does not return any value. It declares 52.0 functions, It has 52.0...
Sema4AI_actions
public
public
0
0
handle_devenv_command
def handle_devenv_command(base_args: ArgumentsNamespace) -> int:import typingfrom sema4ai.action_server._protocols import ArgumentsNamespaceDevEnvdevenv_args: ArgumentsNamespaceDevEnv = typing.cast(ArgumentsNamespaceDevEnv, base_args)devenv_command = devenv_args.devenv_commandif not devenv_command:log.critical("Command...
3
16
1
76
1
144
164
144
base_args
['devenv_command']
int
{"AnnAssign": 1, "Assign": 1, "Expr": 2, "If": 2, "Return": 3}
5
21
5
["typing.cast", "log.critical", "_handle_devenv_task_command", "typing.cast", "log.critical"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._main_retcode"]
The function (handle_devenv_command) defined within the public class called public.The function start at line 144 and ends at 164. 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 5.0 functions, It has 5.0 function...
Sema4AI_actions
public
public
0
0
get_default_rcc_location
def get_default_rcc_location() -> Path:CURDIR = Path(__file__).parent.absolute()if sys.platform == "win32":rcc_path = CURDIR / "bin" / f"rcc-{RCC_VERSION}.exe"else:rcc_path = CURDIR / "bin" / f"rcc-{RCC_VERSION}"return rcc_path
2
7
0
45
2
13
19
13
['rcc_path', 'CURDIR']
Path
{"Assign": 3, "If": 1, "Return": 1}
2
7
2
["parent.absolute", "Path"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._download_rcc_py.download_rcc", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._selfte...
The function (get_default_rcc_location) defined within the public class called public.The function start at line 13 and ends at 19. It contains 7 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 function...
Sema4AI_actions
public
public
0
0
download_rcc
def download_rcc(target: Optional[str] = None,force=False,) -> Path:"""Downloads RCC in the place where the action server expects it."""if target:rcc_path = Path(target)else:rcc_path = get_default_rcc_location()if not force:if rcc_path.exists():return rcc_pathlog.info(f"RCC not available at: {rcc_path}. Downloading.")r...
11
40
2
191
7
22
76
22
target,force
['prefix', 'status', 'relative_path', 'machine', 'is_64', 'rcc_path', 'rcc_url']
Path
{"Assign": 12, "Expr": 3, "If": 9, "Return": 2}
9
55
9
["Path", "get_default_rcc_location", "rcc_path.exists", "log.info", "rcc_path.parent.mkdir", "platform.machine", "RuntimeError", "sema4ai_http.download_with_resume", "RuntimeError"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._main_retcode", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server.cli_py.mai...
The function (download_rcc) defined within the public class called public.The function start at line 22 and ends at 76. It contains 40 lines of code and it has a cyclomatic complexity of 11. It takes 2 parameters, represented as [22.0] and does not return any value. It declares 9.0 functions, It has 9.0 functions calle...
Sema4AI_actions
public
public
0
0
_get_str_list_from_env
def _get_str_list_from_env(env_name: str, env) -> List[str]:# Verify if it's an encrypted header.in_env: str = env.get(env_name, "")if not in_env:return []try:lst_info_to_decrypt = json.loads(in_env)except Exception:raise RuntimeError(f"Error: the {env_name} is expected to be a json list of strings, "f"however it canno...
6
23
2
95
1
9
35
9
env_name,env
['lst_info_to_decrypt']
List[str]
{"AnnAssign": 1, "Assign": 1, "For": 1, "If": 3, "Return": 2, "Try": 1}
7
27
7
["env.get", "json.loads", "RuntimeError", "isinstance", "RuntimeError", "isinstance", "RuntimeError"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._encryption_py.get_encryption_keys", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.actions.src.sema4ai.actions._action_contex...
The function (_get_str_list_from_env) defined within the public class called public.The function start at line 9 and ends at 35. It contains 23 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [9.0] and does not return any value. It declares 7.0 functions, It has 7.0 function...
Sema4AI_actions
public
public
0
0
decrypt
def decrypt(key: bytes, iv: bytes, ciphertext: bytes, tag: bytes) -> bytes:from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modesdecryptor = Cipher(algorithms.AES(key),modes.GCM(iv, tag),).decryptor()return decryptor.update(ciphertext) + decryptor.finalize()
1
7
4
73
1
38
46
38
key,iv,ciphertext,tag
['decryptor']
bytes
{"Assign": 1, "Return": 1}
6
9
6
["decryptor", "Cipher", "algorithms.AES", "modes.GCM", "decryptor.update", "decryptor.finalize"]
32
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3913781_flask_restful_flask_restful.flask_restful.utils.crypto_py.decrypt", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3915661_xeroc_python_graphenelib.tests.test_bip38_py.Testcases.test_deencrypt", "_.content.gd...
The function (decrypt) defined within the public class called public.The function start at line 38 and ends at 46. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [38.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions called insid...
Sema4AI_actions
public
public
0
0
get_encryption_keys
def get_encryption_keys(env: Optional[dict[str, str]] = None) -> tuple[bytes, ...]:"""Args:env: The environment to be used.Returns:A tuple with the keys which should be used for encryption."""keys = _get_str_list_from_env("ACTION_SERVER_DECRYPT_KEYS", env=env or os.environ)return tuple(base64.b64decode(key.encode("asci...
3
3
1
58
1
49
58
49
env
['keys']
tuple[bytes, ...]
{"Assign": 1, "Expr": 1, "Return": 1}
4
10
4
["_get_str_list_from_env", "tuple", "base64.b64decode", "key.encode"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_process_pool_py.ProcessHandle._do_run_action", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4...
The function (get_encryption_keys) defined within the public class called public.The function start at line 49 and ends at 58. It contains 3 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions cal...
Sema4AI_actions
public
public
0
0
make_unencrypted_data_envelope
def make_unencrypted_data_envelope(data: Any) -> str:"""Our envelope in this case is a base64(json(data))"""action_server_context: str = json.dumps(data)return base64.b64encode(action_server_context.encode("utf-8")).decode("ascii")
1
3
1
37
0
61
66
61
data
[]
str
{"AnnAssign": 1, "Expr": 1, "Return": 1}
4
6
4
["json.dumps", "decode", "base64.b64encode", "action_server_context.encode"]
7
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_process_pool_py.ProcessHandle._do_run_action", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4...
The function (make_unencrypted_data_envelope) defined within the public class called public.The function start at line 61 and ends at 66. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 fu...
Sema4AI_actions
public
public
0
0
encrypt
def encrypt(key: bytes, plaintext: bytes) -> tuple[bytes, bytes, bytes]:from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes# Generate a random 96-bit IV.iv = os.urandom(12)# Construct an AES-GCM Cipher object with the given key and a# randomly generated IV.encryptor = Cipher(algorithms.AES(key)...
1
9
2
89
3
69
86
69
key,plaintext
['encryptor', 'ciphertext', 'iv']
tuple[bytes, bytes, bytes]
{"Assign": 3, "Return": 1}
7
18
7
["os.urandom", "encryptor", "Cipher", "algorithms.AES", "modes.GCM", "encryptor.update", "encryptor.finalize"]
48
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.cherrypy.lib.httpauth_py._checkBasicResponse", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3689772_zalando_stups_senza.senza.templates.postgresapp_py.gather_user_varia...
The function (encrypt) defined within the public class called public.The function start at line 69 and ends at 86. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [69.0] and does not return any value. It declares 7.0 functions, It has 7.0 functions called insid...
Sema4AI_actions
public
public
0
0
make_encrypted_data_envelope
def make_encrypted_data_envelope(key: bytes, secrets: Any) -> str:"""Our envelope in this case is a base64(json(encrypted-envelope(json(data))))"""data: bytes = json.dumps(secrets).encode("utf-8")iv, encrypted_data, tag = encrypt(key, data)action_server_context = {"cipher": base64.b64encode(encrypted_data).decode("asci...
1
13
2
118
1
89
107
89
key,secrets
['action_server_context']
str
{"AnnAssign": 2, "Assign": 2, "Expr": 1, "Return": 1}
13
19
13
["encode", "json.dumps", "encrypt", "decode", "base64.b64encode", "decode", "base64.b64encode", "decode", "base64.b64encode", "decode", "base64.b64encode", "encode", "json.dumps"]
9
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_process_pool_py.ProcessHandle._do_run_action", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4...
The function (make_encrypted_data_envelope) defined within the public class called public.The function start at line 89 and ends at 107. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [89.0] and does not return any value. It declares 13.0 functions, It has 13...
Sema4AI_actions
MaybeEncryptedJsonData
public
0
0
__init__
def __init__(self,data: str,env: Optional[Dict[str, str]] = None,keys: Optional[tuple[bytes, ...]] = None,):"""Args:data: The data requested from that source.If encrypted, must be something as:base64(json.dumps({ cipher: blob_of_data algorithm: "aes256-gcm" iv: nonce}))Otherwise the payload should be passed directly,wh...
5
21
4
137
0
119
173
119
self,data,env,keys
[]
None
{"AnnAssign": 2, "Assign": 5, "Expr": 1, "If": 2}
6
55
6
["json.loads", "decode", "base64.b64decode", "data.encode", "isinstance", "RuntimeError"]
6,243
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called MaybeEncryptedJsonData.The function start at line 119 and ends at 173. It contains 21 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [119.0] and does not return any value. It declares 6.0 functions, It has 6.0 f...
Sema4AI_actions
MaybeEncryptedJsonData
public
0
0
encrypted
def encrypted(self) -> bool:return self._encrypted
1
2
1
11
0
176
177
176
self
[]
bool
{"Return": 1}
0
2
0
[]
0
[]
The function (encrypted) defined within the public class called MaybeEncryptedJsonData.The function start at line 176 and ends at 177. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Sema4AI_actions
MaybeEncryptedJsonData
public
0
0
value
def value(self) -> JSONValue:# Data already decryptedtry:return self._raw_dataexcept AttributeError:passif not self._encrypted:raise RuntimeError("Expected data to be encrypted if it reached here!")keys: tuple[bytes, ...]if self._keys:keys = self._keyselse:keys = get_encryption_keys(env=self._env)if not keys:raise Runt...
15
64
1
267
0
180
258
180
self
[]
JSONValue
{"AnnAssign": 3, "Assign": 8, "For": 1, "If": 8, "Return": 2, "Try": 5}
21
79
21
["RuntimeError", "get_encryption_keys", "RuntimeError", "isinstance", "RuntimeError", "isinstance", "RuntimeError", "isinstance", "RuntimeError", "isinstance", "RuntimeError", "base64.b64decode", "RuntimeError", "base64.b64decode", "RuntimeError", "base64.b64decode", "RuntimeError", "RuntimeError", "decrypt", "RuntimeE...
27
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.third_party.cherrypy.test.test_config_py.setup_server", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3676862_pecan_pecan.pecan.hooks_py.RequestViewerHook.after", "_.content.gdrive....
The function (value) defined within the public class called MaybeEncryptedJsonData.The function start at line 180 and ends at 258. It contains 64 lines of code and it has a cyclomatic complexity of 15. The function does not take any parameters and does not return any value. It declares 21.0 functions, It has 21.0 funct...
Sema4AI_actions
public
public
0
0
encrypt_simple
def encrypt_simple(data: JSONValue, key: bytes = b"") -> str:"""Encrypts a message by converting the entry to json and storing itin a custom format.If the key is not passed, the default storage key is used.Returns:A base-64 string with the encrypted contents."""from sema4ai.action_server._storage import get_keyif not k...
2
6
2
44
2
261
277
261
data,key
['key', 'encrypted']
str
{"Assign": 2, "Expr": 1, "If": 1, "Return": 1}
2
17
2
["get_key", "make_encrypted_data_envelope"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._api_oauth2_py._update_db_with_token"]
The function (encrypt_simple) defined within the public class called public.The function start at line 261 and ends at 277. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [261.0] and does not return any value. It declares 2.0 functions, It has 2.0 functions ca...
Sema4AI_actions
public
public
0
0
decrypt_simple
def decrypt_simple(data: str, key: bytes = b"") -> JSONValue:"""Decrypts a message (from a previous `encrypt_simple` call).If the key is not passed, the default storage key is used."""from sema4ai.action_server._storage import get_keyif not key:key = get_key()d = MaybeEncryptedJsonData(data, keys=(key,))assert d.encryp...
2
7
2
55
2
280
293
280
data,key
['key', 'd']
JSONValue
{"Assign": 2, "Expr": 1, "If": 1, "Return": 1}
2
14
2
["get_key", "MaybeEncryptedJsonData"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._actions_process_pool_py.ProcessHandle._do_run_action", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4...
The function (decrypt_simple) defined within the public class called public.The function start at line 280 and ends at 293. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [280.0] and does not return any value. It declares 2.0 functions, It has 2.0 functions ca...
Sema4AI_actions
RequestError
public
0
1
__init__
def __init__(self, error_code: ErrorCode, message: str):super().__init__()self.error_code = error_codeself.message = message
1
4
3
30
0
29
32
29
self,error_code,message
[]
None
{"Assign": 2, "Expr": 1}
2
4
2
["__init__", "super"]
6,243
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called RequestError, that inherit another class.The function start at line 29 and ends at 32. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [29.0] and does not return any value. It declares 2.0 functions...
Sema4AI_actions
public
public
0
0
_to_response
def _to_response(error_code: ErrorCode,message: str,path: str,trace=False,) -> Dict[str, Any]:LOGGER.error("Invalid request: %s [%s]", message, path)if trace:LOGGER.error(traceback.format_exc())return {"error_code": error_code, "message": message}
2
10
4
60
0
40
50
40
error_code,message,path,trace
[]
Dict[str, Any]
{"Expr": 2, "If": 1, "Return": 1}
3
11
3
["LOGGER.error", "LOGGER.error", "traceback.format_exc"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._errors_py.http422_error_handler", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._err...
The function (_to_response) defined within the public class called public.The function start at line 40 and ends at 50. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [40.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions called...
Sema4AI_actions
public
public
0
0
request_error_handler
async def request_error_handler(request: Request, exc: RequestError):return JSONResponse(status_code=400,content=_to_response(error_code=exc.error_code,message=exc.message,path=str(request.url.path),),)
1
9
2
48
0
53
61
53
request,exc
[]
Returns
{"Return": 1}
3
9
3
["JSONResponse", "_to_response", "str"]
0
[]
The function (request_error_handler) defined within the public class called public.The function start at line 53 and ends at 61. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [53.0], and this function return a value. It declares 3.0 functions, and It has 3.0...
Sema4AI_actions
public
public
0
0
http_error_handler
async def http_error_handler(request: Request,exc: HTTPException,) -> JSONResponse:return JSONResponse(status_code=exc.status_code,content=_to_response(error_code=ErrorCode.INTERNAL_ERROR,message=str(exc.detail),path=str(request.url.path),),)
1
12
2
56
0
64
75
64
request,exc
[]
JSONResponse
{"Return": 1}
4
12
4
["JSONResponse", "_to_response", "str", "str"]
0
[]
The function (http_error_handler) defined within the public class called public.The function start at line 64 and ends at 75. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [64.0] and does not return any value. It declares 4.0 functions, and It has 4.0 funct...
Sema4AI_actions
public
public
0
0
http422_error_handler
async def http422_error_handler(request: Request,exc: Union[RequestValidationError, ValidationError],) -> JSONResponse:return JSONResponse(status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,content=_to_response(error_code=ErrorCode.VALIDATION_ERROR,message="\n".join(str(err) for err in exc.errors()),path=str(request.url....
2
12
2
72
0
78
89
78
request,exc
[]
JSONResponse
{"Return": 1}
6
12
6
["JSONResponse", "_to_response", "join", "str", "exc.errors", "str"]
0
[]
The function (http422_error_handler) defined within the public class called public.The function start at line 78 and ends at 89. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [78.0] and does not return any value. It declares 6.0 functions, and It has 6.0 fu...
Sema4AI_actions
public
public
0
0
http500_error_handler
async def http500_error_handler(request: Request,exc: Exception,) -> JSONResponse:response = JSONResponse(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,content=_to_response(error_code=ErrorCode.INTERNAL_ERROR,message=str(exc),path=str(request.url.path),trace=True,),)# CORSMiddleware is not used for unhandled server...
6
29
2
167
3
92
124
92
request,exc
['origin', 'cors', 'response']
JSONResponse
{"Assign": 5, "Expr": 2, "If": 3, "Return": 1}
9
33
9
["JSONResponse", "_to_response", "str", "str", "request.headers.get", "CORSMiddleware", "response.headers.update", "cors.is_allowed_origin", "response.headers.add_vary_header"]
0
[]
The function (http500_error_handler) defined within the public class called public.The function start at line 92 and ends at 124. It contains 29 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [92.0] and does not return any value. It declares 9.0 functions, and It has 9.0 f...
Sema4AI_actions
public
public
0
0
get_counter
def get_counter(counter_name: Optional[str] = None):try:return _counters[counter_name]except KeyError:_counters[counter_name] = itertools.count()return _counters[counter_name]
2
6
1
37
0
8
13
8
counter_name
[]
Returns
{"Assign": 1, "Return": 2, "Try": 1}
1
6
1
["itertools.count"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._gen_ids_py.gen_uuid"]
The function (get_counter) defined within the public class called public.The function start at line 8 and ends at 13. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters, and this function return a value. It declare 1.0 function, It has 1.0 function called insi...
Sema4AI_actions
public
public
0
0
gen_uuid
def gen_uuid(counter_name: Optional[Literal["action_package", "action", "run"]] = None):if not counter_name:prefix = ""elif counter_name == "action_package":prefix = "ap-"else:prefix = f"{str(counter_name)[0:3]}-"return f"{prefix}{next(get_counter(counter_name)):03d}-{uuid4()}"
3
8
1
43
1
16
23
16
counter_name
['prefix']
Returns
{"Assign": 3, "If": 2, "Return": 1}
4
8
4
["str", "next", "get_counter", "uuid4"]
7
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70099916_voc_schedule.csv2schedule_deu_py.process", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70099916_voc_schedule.voc.room_py.Room.graphql", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_...
The function (gen_uuid) defined within the public class called public.The function start at line 16 and ends at 23. It contains 8 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters, and this function return a value. It declares 4.0 functions, It has 4.0 functions called ins...
Sema4AI_actions
public
public
0
0
run_status_to_str
def run_status_to_str(run_status: int) -> str:"""Args:run_status: The run status to convert to a string.Returns:The string representation of the run status."""if run_status == RunStatus.NOT_RUN:return "not run"elif run_status == RunStatus.RUNNING:return "running"elif run_status == RunStatus.PASSED:return "passed"elif r...
6
13
1
63
0
177
196
177
run_status
[]
str
{"Expr": 1, "If": 5, "Return": 5}
1
20
1
["ValueError"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._command_requiring_datadir"]
The function (run_status_to_str) defined within the public class called public.The function start at line 177 and ends at 196. It contains 13 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function calle...
Sema4AI_actions
public
public
0
0
get_all_model_classes
def get_all_model_classes():from sema4ai.action_server.migrations import Migrationreturn [Migration,ActionPackage,Action,Run,Counter,UserSession,TempUserSessionData,OAuth2UserData,]
1
12
0
31
0
199
211
199
[]
Returns
{"Return": 1}
0
13
0
[]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._models_py.load_db", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server.migrations.__init_...
The function (get_all_model_classes) defined within the public class called public.The function start at line 199 and ends at 211. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 4.0 functions calling this function...
Sema4AI_actions
public
public
0
0
get_model_db_rules
def get_model_db_rules() -> DBRules:return _db_rules
1
2
0
8
0
214
215
214
[]
DBRules
{"Return": 1}
0
2
0
[]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._models_py.create_db", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test_database_py...
The function (get_model_db_rules) defined within the public class called public.The function start at line 214 and ends at 215. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 2.0 functions calling this function which a...
Sema4AI_actions
public
public
0
0
load_db
def load_db(db_path: Union[Path, str]) -> Iterator["Database"]:"""Loads the database from the given path and initializes the internalmodels, besides setting this db as the global db for the durationof the context manager."""from sema4ai.action_server._database import Databaseglobal _global_dbif _global_db is not None:r...
3
13
1
72
2
222
242
222
db_path
['_global_db', 'db']
Iterator['Database']
{"Assign": 3, "Expr": 3, "If": 1, "Try": 1, "With": 1}
5
21
5
["AssertionError", "Database", "db.connect", "db.initialize", "get_all_model_classes"]
9
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3599349_djc_couchdb_python.couchdb.tools.load_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._models_py.create_db", "_.content.gdrive.MyDrive...
The function (load_db) defined within the public class called public.The function start at line 222 and ends at 242. It contains 13 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 5.0 functions, It has 5.0 functions called insid...
Sema4AI_actions
public
public
0
0
create_db
def create_db(db_path: Union[Path, str]) -> Iterator["Database"]:"""Creates the database and sets this db as the global db for the durationof the context manager."""from sema4ai.action_server.migrations import (CURRENT_VERSION,MIGRATION_ID_TO_NAME,Migration,)with load_db(db_path) as db:with db.transaction():db.create_t...
2
14
1
91
1
246
264
246
db_path
['current_migration']
Iterator['Database']
{"Assign": 1, "Expr": 5, "For": 1, "With": 2}
8
19
8
["load_db", "db.transaction", "db.create_tables", "get_model_db_rules", "db.insert", "Migration", "db.insert", "Counter"]
6
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3594492_mangroveorg_mangrove.mangrove.transport.player.integrationtests.test_sms_submission_py.TestShouldSaveSMSSubmission.setUpClass", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3953339_corralpeltzer_newtrackon....
The function (create_db) defined within the public class called public.The function start at line 246 and ends at 264. It contains 14 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 8.0 functions, It has 8.0 functions called ins...
Sema4AI_actions
public
public
0
0
get_db
def get_db() -> "Database":if _global_db is None:raise DBNotInitializedError("DB not initialized")return _global_db
2
4
0
18
0
271
274
271
[]
'Database'
{"If": 1, "Return": 1}
1
4
1
["DBNotInitializedError"]
25
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.mongo.initialize.migration_py._apply_migrations", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.mongo.initialize.migration_py._en...
The function (get_db) defined within the public class called public.The function start at line 271 and ends at 274. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called inside whi...
Sema4AI_actions
public
public
0
0
get_action_package_from_action
def get_action_package_from_action(action: Action) -> ActionPackage:db = get_db()return db.first(ActionPackage,"SELECT * FROM action_package WHERE id = ?",[action.action_package_id],)
1
7
1
30
1
277
283
277
action
['db']
ActionPackage
{"Assign": 1, "Return": 1}
2
7
2
["get_db", "db.first"]
0
[]
The function (get_action_package_from_action) defined within the public class called public.The function start at line 277 and ends at 283. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has...
Sema4AI_actions
public
public
0
0
handle_new_project
def handle_new_project(directory: str = ".", template_name: str = "", force: bool = False) -> int:"""Creates a new project under the specified directory.Args:directory: The directory to create the project in.template_name: Template to use for the new project.force: If true, the project will be created even if the direc...
14
71
3
300
6
15
107
15
directory,template_name,force
['package_exclude_handler', 'directory', 'template_name', 'found', 'choice', 'metadata']
int
{"Assign": 6, "Expr": 12, "If": 8, "Return": 3, "Try": 3, "While": 1}
28
93
28
["_ensure_latest_templates", "log.warning", "bold_yellow", "_get_local_templates_metadata", "RuntimeError", "input", "RuntimeError", "os.path.exists", "PackageExcludeHandler", "package_exclude_handler.fill_exclude_patterns", "list", "package_exclude_handler.collect_files_excluding_patterns", "Path", "RuntimeError", "_p...
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_py.handle_new_command", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.te...
The function (handle_new_project) defined within the public class called public.The function start at line 15 and ends at 107. It contains 71 lines of code and it has a cyclomatic complexity of 14. It takes 3 parameters, represented as [15.0] and does not return any value. It declares 28.0 functions, It has 28.0 functi...
Sema4AI_actions
public
public
0
0
handle_list_templates
def handle_list_templates(output_json: bool = False) -> int:"""Lists availabe templates.Args:output_json: If true, the output will be formatted as JSON."""import sysfrom sema4ai.action_server.vendored_deps.termcolors import bold_redfrom ._new_project_helpers import (ActionTemplate,_ensure_latest_templates,_get_local_te...
6
27
1
143
2
110
148
110
output_json
['output', 'metadata']
int
{"AnnAssign": 1, "Assign": 2, "Expr": 6, "If": 2, "Return": 2, "Try": 1}
11
39
11
["_ensure_latest_templates", "_get_local_templates_metadata", "json.dumps", "template.model_dump", "sys.stdout.buffer.write", "output.encode", "len", "log.info", "_print_templates_list", "log.critical", "bold_red"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_py.handle_new_command", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.te...
The function (handle_list_templates) defined within the public class called public.The function start at line 110 and ends at 148. It contains 27 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value. It declares 11.0 functions, It has 11.0 functi...
Sema4AI_actions
public
public
0
0
handle_new_command
def handle_new_command(base_args: ArgumentsNamespace) -> int:new_args: ArgumentsNamespaceNew = typing.cast(ArgumentsNamespaceNew, base_args)if new_args.new_command == "list-templates":list_templates_args: ArgumentsNamespaceNewTemplates = typing.cast(ArgumentsNamespaceNewTemplates, base_args)return handle_list_templates...
2
10
1
70
0
151
163
151
base_args
[]
int
{"AnnAssign": 2, "If": 1, "Return": 2}
4
13
4
["typing.cast", "typing.cast", "handle_list_templates", "handle_new_project"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._main_retcode"]
The function (handle_new_command) defined within the public class called public.The function start at line 151 and ends at 163. It contains 10 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions c...
Sema4AI_actions
public
public
0
0
_ensure_latest_templates
def _ensure_latest_templates() -> None:# Ensures the existence of the latest templates package.# It downloads the latest templates metadata file, and compares the hash with the metadata held locally (if exists).# If there is no match (or metadata is not available locally), it will download the templates package.import ...
4
17
0
91
5
41
68
41
['local_metadata', 'new_metadata', 'new_metadata_content', 'action_templates_dir_path', 'response']
None
{"Assign": 5, "Expr": 4, "If": 1, "With": 1}
10
28
10
["_get_action_templates_dir_path", "os.makedirs", "_get_local_templates_metadata", "sema4ai_http.get", "response.raise_for_status", "_parse_templates_metadata", "_download_and_unzip_templates", "open", "_get_action_templates_metadata_path", "f.write"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_py.handle_list_templates", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server...
The function (_ensure_latest_templates) defined within the public class called public.The function start at line 41 and ends at 68. It contains 17 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 10.0 functions, It has 10.0 funct...
Sema4AI_actions
public
public
0
0
_download_and_unzip_templates
def _download_and_unzip_templates(action_templates_dir: Path) -> None:import sema4ai_httptemplates_response = sema4ai_http.get(TEMPLATES_PACKAGE_URL)with zipfile.ZipFile(io.BytesIO(templates_response.data)) as zip_ref:zip_ref.extractall(action_templates_dir)
1
5
1
42
1
71
77
71
action_templates_dir
['templates_response']
None
{"Assign": 1, "Expr": 1, "With": 1}
4
7
4
["sema4ai_http.get", "zipfile.ZipFile", "io.BytesIO", "zip_ref.extractall"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_helpers_py._ensure_latest_templates"]
The function (_download_and_unzip_templates) defined within the public class called public.The function start at line 71 and ends at 77. 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 4.0 functions, It has 4.0 fun...
Sema4AI_actions
public
public
0
0
_get_local_templates_metadata
def _get_local_templates_metadata() -> Optional[ActionTemplatesMetadata]:action_templates_metadata_path = _get_action_templates_metadata_path()if not os.path.isfile(action_templates_metadata_path):return Nonereturn _parse_templates_metadata(action_templates_metadata_path.read_text())
2
5
0
36
1
80
86
80
['action_templates_metadata_path']
Optional[ActionTemplatesMetadata]
{"Assign": 1, "If": 1, "Return": 2}
4
7
4
["_get_action_templates_metadata_path", "os.path.isfile", "_parse_templates_metadata", "action_templates_metadata_path.read_text"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_helpers_py._ensure_latest_templates", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.ac...
The function (_get_local_templates_metadata) defined within the public class called public.The function start at line 80 and ends at 86. 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 4.0 functions, It has 4.0 fun...
Sema4AI_actions
public
public
0
0
_parse_templates_metadata
def _parse_templates_metadata(yaml_content: str) -> Optional[ActionTemplatesMetadata]:try:metadata: ActionTemplatesYaml = yaml.safe_load(yaml_content)templates: list[ActionTemplate] = []for name, description in metadata.get("templates", {}).items():templates.append(ActionTemplate(name=name, description=description))ret...
3
15
1
124
0
89
106
89
yaml_content
[]
Optional[ActionTemplatesMetadata]
{"AnnAssign": 2, "Expr": 2, "For": 1, "Return": 2, "Try": 1}
10
18
10
["yaml.safe_load", "items", "metadata.get", "templates.append", "ActionTemplate", "ActionTemplatesMetadata", "metadata.get", "metadata.get", "metadata.get", "log.warning"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_helpers_py._ensure_latest_templates", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.ac...
The function (_parse_templates_metadata) defined within the public class called public.The function start at line 89 and ends at 106. It contains 15 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 10.0 functions, It has 10.0 fun...
Sema4AI_actions
public
public
0
0
_unpack_template
def _unpack_template(template_name: str, directory: str = ".") -> None:template_path = _get_action_templates_dir_path() / f"{template_name}.zip"if not os.path.isfile(template_path):raise RuntimeError(f"Template {template_name} does not exist")os.makedirs(directory, exist_ok=True)with zipfile.ZipFile(template_path, "r")...
2
7
2
68
1
109
118
109
template_name,directory
['template_path']
None
{"Assign": 1, "Expr": 2, "If": 1, "With": 1}
6
10
6
["_get_action_templates_dir_path", "os.path.isfile", "RuntimeError", "os.makedirs", "zipfile.ZipFile", "zip_ref.extractall"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_py.handle_new_project"]
The function (_unpack_template) defined within the public class called public.The function start at line 109 and ends at 118. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [109.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions ...
Sema4AI_actions
public
public
0
0
_get_action_templates_dir_path
def _get_action_templates_dir_path() -> Path:return Path(get_default_settings_dir() / "action-templates")
1
2
0
15
0
121
122
121
[]
Path
{"Return": 1}
2
2
2
["Path", "get_default_settings_dir"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_helpers_py._ensure_latest_templates", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.ac...
The function (_get_action_templates_dir_path) defined within the public class called public.The function start at line 121 and ends at 122. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 ...
Sema4AI_actions
public
public
0
0
_get_action_templates_metadata_path
def _get_action_templates_metadata_path() -> Path:return Path(_get_action_templates_dir_path() / ACTION_TEMPLATES_METADATA_FILENAME)
1
2
0
15
0
125
126
125
[]
Path
{"Return": 1}
2
2
2
["Path", "_get_action_templates_dir_path"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_helpers_py._ensure_latest_templates", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.ac...
The function (_get_action_templates_metadata_path) defined within the public class called public.The function start at line 125 and ends at 126. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has...
Sema4AI_actions
public
public
0
0
_print_templates_list
def _print_templates_list(templates: list[ActionTemplate]) -> None:from sema4ai.action_server.vendored_deps.termcolors import coloredfor index, template in enumerate(templates, start=1):log.info(colored(f" > {index}. {template.description}", "cyan"))
2
4
1
48
0
129
133
129
templates
[]
None
{"Expr": 1, "For": 1}
3
5
3
["enumerate", "log.info", "colored"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._new_project_py.handle_list_templates", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server...
The function (_print_templates_list) defined within the public class called public.The function start at line 129 and ends at 133. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions...
Sema4AI_actions
public
public
0
0
get_sema4ai_provided_oauth2_config
def get_sema4ai_provided_oauth2_config() -> str:"""Provides the content with the Sema4.ai info for user authentication usingan APP-based flow (with JWT token)."""from ._oauth2_config import FILE_CONTENTSreturn FILE_CONTENTS["sema4ai_config"]
1
3
0
17
0
16
23
16
[]
str
{"Expr": 1, "Return": 1}
0
8
0
[]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._oauth2_py._print_sema4ai_oauth2_config", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_serv...
The function (get_sema4ai_provided_oauth2_config) defined within the public class called public.The function start at line 16 and ends at 23. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 3.0 functions calling this fu...
Sema4AI_actions
public
public
0
0
_print_sema4ai_oauth2_config
def _print_sema4ai_oauth2_config() -> int:import syscontents = get_sema4ai_provided_oauth2_config()sys.stdout.buffer.write(contents.encode("utf-8"))return 0
1
5
0
30
1
26
32
26
['contents']
int
{"Assign": 1, "Expr": 1, "Return": 1}
3
7
3
["get_sema4ai_provided_oauth2_config", "sys.stdout.buffer.write", "contents.encode"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._oauth2_py.handle_get_sema4ai_oauth_config_command", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai....
The function (_print_sema4ai_oauth2_config) defined within the public class called public.The function start at line 26 and ends at 32. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 func...
Sema4AI_actions
public
public
0
0
print_user_oauth2_config_path
def print_user_oauth2_config_path(output_json: bool = False) -> int:"""Note that besides printing it may also generate the configuration if it's notcurrently available.Returns:0 if everything worked properly and 1 if some error happened."""import jsonimport sysfrom ._settings import get_default_settings_dirconfig_path:...
4
21
1
129
0
35
71
35
output_json
[]
int
{"AnnAssign": 1, "Expr": 5, "If": 2, "Return": 2, "Try": 1, "With": 1}
11
37
11
["get_default_settings_dir", "config_path.exists", "open", "f.write", "sys.stdout.buffer.write", "encode", "json.dumps", "str", "print", "log.critical", "bold_red"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._oauth2_py.handle_oauth2_command", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.tests.action_server_tests.test...
The function (print_user_oauth2_config_path) defined within the public class called public.The function start at line 35 and ends at 71. It contains 21 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 11.0 functions, It has 11.0 ...
Sema4AI_actions
public
public
0
0
handle_get_sema4ai_oauth_config_command
def handle_get_sema4ai_oauth_config_command() -> int:return _print_sema4ai_oauth2_config()
1
2
0
10
0
74
75
74
[]
int
{"Return": 1}
1
2
1
["_print_sema4ai_oauth2_config"]
0
[]
The function (handle_get_sema4ai_oauth_config_command) defined within the public class called public.The function start at line 74 and ends at 75. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and I...
Sema4AI_actions
public
public
0
0
handle_oauth2_command
def handle_oauth2_command(base_args: ArgumentsNamespace) -> int:oauth2_args: ArgumentsNamespaceOAuth2 = typing.cast(ArgumentsNamespaceOAuth2, base_args)oauth2_command = oauth2_args.oauth2_commandif not oauth2_command:log.critical("Command for oauth2 operation not specified.")return 1if oauth2_command == "sema4ai-config...
4
16
1
73
1
78
98
78
base_args
['oauth2_command']
int
{"AnnAssign": 2, "Assign": 1, "Expr": 1, "If": 3, "Return": 4}
5
21
5
["typing.cast", "log.critical", "_print_sema4ai_oauth2_config", "typing.cast", "print_user_oauth2_config_path"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.action_server.src.sema4ai.action_server._cli_impl_py._main_retcode"]
The function (handle_oauth2_command) defined within the public class called public.The function start at line 78 and ends at 98. It contains 16 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 5.0 functions, It has 5.0 functions ...
Sema4AI_actions
ActionResult
public
0
1
__init__
def __init__(self, success: bool, message: Optional[str] = None, result: Optional[T] = None):self.success = successself.message = messageself.result = result
1
6
4
42
0
40
45
40
self,success,message,result
[]
None
{"Assign": 3}
0
6
0
[]
6,245
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called ActionResult, that inherit another class.The function start at line 40 and ends at 45. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [40.0] and does not return any value. It has 6245.0 functions c...
Sema4AI_actions
ActionResult
public
0
1
as_dict
def as_dict(self) -> ActionResultDict:return {"success": self.success, "message": self.message, "result": self.result}
1
2
1
27
0
47
48
47
self
[]
ActionResultDict
{"Return": 1}
0
2
0
[]
44
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3511986_dart_archive_pub_dartlang.app.handlers.api.package_versions_py.PackageVersions.show", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3670790_opencivicdata_pupa.pupa.tests.importers.test_base_importer_py.test_...
The function (as_dict) defined within the public class called ActionResult, that inherit another class.The function start at line 47 and ends at 48. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 44.0 functions calling...
Sema4AI_actions
ActionResult
public
0
1
__str__
def __str__(self):return (f"ActionResult(success={self.success!r}, message={self.message!r}, "f"result={self.result!r})")
1
5
1
12
0
50
54
50
self
[]
Returns
{"Return": 1}
0
5
0
[]
83
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3675814_usyd_blockchain_vandal.src.evm_cfg_py.EVMBasicBlock.__str__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3675814_usyd_blockchain_vandal.src.tac_cfg_py.TACBasicBlock.__str__", "_.content.gdrive.MyDrive.Phd...
The function (__str__) defined within the public class called ActionResult, that inherit another class.The function start at line 50 and ends at 54. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 83.0 functions cal...
Sema4AI_actions
ActionResult
public
0
1
__init__
def __init__(self,command_line: str,success: bool,message: Optional[str] = None,result: Optional[str] = None,):ActionResult.__init__(self, success, message, result)self.command_line = command_line
1
9
5
49
0
63
71
63
self,success,message,result
[]
None
{"Assign": 3}
0
6
0
[]
6,245
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.AlertCollector_py.AlertCollector.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.11269405_sapcc_vrops_exporter.collectors.ClusterAlertCollector_py.ClusterAlertCollec...
The function (__init__) defined within the public class called ActionResult, that inherit another class.The function start at line 63 and ends at 71. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [63.0] and does not return any value. It has 6245.0 functions c...