project_name
string
class_name
string
class_modifiers
string
class_implements
int64
class_extends
int64
function_name
string
function_body
string
cyclomatic_complexity
int64
NLOC
int64
num_parameter
int64
num_token
int64
num_variable
int64
start_line
int64
end_line
int64
function_index
int64
function_params
string
function_variable
string
function_return_type
string
function_body_line_type
string
function_num_functions
int64
function_num_lines
int64
outgoing_function_count
int64
outgoing_function_names
string
incoming_function_count
int64
incoming_function_names
string
lexical_representation
string
Sema4AI_actions
public
public
0
0
test_http_helper_basic
def test_http_helper_basic():import sema4ai_httpresponse = sema4ai_http.get("https://google.com")assert response.status == 200assert response.status_code == 200assert response.raise_for_status() is Noneassert response.text is not None
1
7
0
41
1
1
9
1
['response']
None
{"Assign": 1}
2
9
2
["sema4ai_http.get", "response.raise_for_status"]
0
[]
The function (test_http_helper_basic) defined within the public class called public.The function start at line 1 and ends at 9. It contains 7 lines of code and it has a cyclomatic complexity of 1. It take 0 parameter, represented as [1.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functio...
Sema4AI_actions
public
public
0
0
test_http_helper_download_with_resume
def test_http_helper_download_with_resume(tmpdir):import osimport subprocessimport sysfrom pathlib import Pathimport sema4ai_httpfrom sema4ai_http import _PartialDownloaderif sys.platform == "win32":url = "https://github.com/Sema4AI/actions/releases/download/sema4ai-action_server-0.23.2/sema4ai-action_server-0.23.2-win...
5
42
1
267
5
12
67
12
tmpdir
['target', 'partial_target', 'url', 'executable', 'result']
None
{"Assign": 10, "AugAssign": 1, "Expr": 6, "If": 4}
16
56
16
["Path", "sema4ai_http.download_with_resume", "target.is_file", "subprocess.check_output", "target.write_text", "sema4ai_http.download_with_resume", "target.read_text", "sema4ai_http.download_with_resume", "target.is_file", "subprocess.check_output", "os.remove", "_PartialDownloader.get_partial_target", "partial_target...
0
[]
The function (test_http_helper_download_with_resume) defined within the public class called public.The function start at line 12 and ends at 67. It contains 42 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 16.0 functions, and ...
Sema4AI_actions
public
public
0
0
create_repository_issue
def create_repository_issue(github_access_token: Secret,repository_info: RepositoryInfo,issue_data: CreateIssueData,) -> Response[str]:"""Creates a new issue in the specified repository.Args:github_access_token: Your private GitHub access token.repository_info: Information needed to locate the repository.issue_data: In...
2
18
3
86
1
8
38
8
github_access_token,repository_info,issue_data
['response']
Response[str]
{"Assign": 1, "Expr": 1, "If": 1, "Return": 1}
8
31
8
["requests.post", "ActionError", "get", "response.json", "Response", "get", "response.json", "action"]
0
[]
The function (create_repository_issue) defined within the public class called public.The function start at line 8 and ends at 38. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [8.0] and does not return any value. It declares 8.0 functions, and It has 8.0 fu...
Sema4AI_actions
public
public
0
0
get_repository_commits
def get_repository_commits(github_access_token: Secret, repository_info: RepositoryInfo, limit: int = 10) -> Response[list]:"""Returns commit messages from given repository.Args:github_access_token: Your private GitHub access token.repository_info: Information needed to locate the repository.limit: The maximum number o...
4
17
3
105
4
16
49
16
github_access_token,repository_info,limit
['output', 'commit_messages', 'items', 'response']
Response[list]
{"Assign": 4, "Expr": 2, "If": 1, "Return": 1}
7
34
7
["ActionError", "requests.get", "response.json", "join", "print", "Response", "action"]
0
[]
The function (get_repository_commits) defined within the public class called public.The function start at line 16 and ends at 49. It contains 17 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [16.0] and does not return any value. It declares 7.0 functions, and It has 7.0 f...
Sema4AI_actions
public
public
0
0
test_actions
def test_actions() -> None:from github.get_actions import get_repository_commits# noqafrom github.create_actions import create_repository_issue# noqaassert 1 == 1, "TODO: Add your tests here"
1
4
0
24
0
1
5
1
[]
None
{}
0
5
0
[]
0
[]
The function (test_actions) defined within the public class called public.The function start at line 1 and ends at 5. It contains 4 lines of code and it has a cyclomatic complexity of 1. It take 0 parameter, represented as [1.0] and does not return any value..
Sema4AI_actions
public
public
0
0
get_wikipedia_article_summary
def get_wikipedia_article_summary(article_url: str) -> Response[str]:"""Retrieves the summary (first paragraph) of given Wikipedia article.Args:article_url: URL of the article to get the summary of.Returns:Summary of the article."""browser.configure(browser_engine="chromium", headless=HEADLESS_BROWSER)page = browser.go...
1
9
1
74
3
18
42
18
article_url
['summary', 'paragraphs', 'page']
Response[str]
{"Assign": 3, "Expr": 5, "Return": 1}
8
25
8
["browser.configure", "browser.goto", "page.wait_for_load_state", "page.wait_for_load_state", "page.query_selector_all", "inner_text", "print", "Response"]
0
[]
The function (get_wikipedia_article_summary) defined within the public class called public.The function start at line 18 and ends at 42. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8....
Sema4AI_actions
public
public
0
0
test_actions
def test_actions() -> None:from actions import get_wikipedia_article_summary# noqaassert 1 == 1, "TODO: Add your tests here"
1
3
0
16
0
1
4
1
[]
None
{}
0
4
0
[]
0
[]
The function (test_actions) defined within the public class called public.The function start at line 1 and ends at 4. It contains 3 lines of code and it has a cyclomatic complexity of 1. It take 0 parameter, represented as [1.0] and does not return any value..
Sema4AI_actions
public
public
0
0
list_records
def list_records(data_source: KnowledgeBaseDataSource,req: ListRequest) -> Response[List[Dict[str, Any]]]:"""List records in a knowledge base with optional filtering.Args:data_source: The knowledge base data sourcereq: ListRequest containing filter and limit parametersReturns:Response containing list of records with th...
7
21
2
150
6
17
64
17
data_source,req
['sql', 'placeholders', 'params', 'where_conditions', 'result', 'where_clause']
Response[List[Dict[str, Any]]]
{"Assign": 7, "Expr": 3, "For": 1, "If": 3, "Return": 1}
9
48
9
["join", "where_conditions.append", "req.filter.metadata_filters.items", "where_conditions.append", "join", "query", "get_connection", "Response", "result.to_dict_list"]
0
[]
The function (list_records) defined within the public class called public.The function start at line 17 and ends at 64. It contains 21 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [17.0] and does not return any value. It declares 9.0 functions, and It has 9.0 functions c...
Sema4AI_actions
public
public
0
0
delete_records
def delete_records(data_source: KnowledgeBaseDataSource,req: RecordFilter) -> Response[bool]:"""Delete specific records from a knowledge base by their IDs and/or metadata.Args:data_source: The knowledge base data sourcereq: RecordFilter containing list of record IDs and/or metadatafilters to deleteReturns:Response indi...
7
23
2
138
5
68
116
68
data_source,req
['sql', 'placeholders', 'params', 'where_conditions', 'where_clause']
Response[bool]
{"Assign": 6, "Expr": 5, "For": 1, "If": 4, "Return": 1}
11
49
11
["join", "where_conditions.append", "req.metadata_filters.items", "where_conditions.append", "ActionError", "join", "execute_sql", "get_connection", "execute_sql", "get_connection", "Response"]
0
[]
The function (delete_records) defined within the public class called public.The function start at line 68 and ends at 116. It contains 23 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [68.0] and does not return any value. It declares 11.0 functions, and It has 11.0 functi...
Sema4AI_actions
public
public
0
0
search
def search(data_source: KnowledgeBaseDataSource,req: SearchRequest) -> Response[List[SearchResult]]:"""Search across the entire knowledge base.Args:data_source: The knowledge base data sourcereq: SearchRequest containing query and search parametersReturns:Response containing search results with relevance scores"""sql =...
2
12
2
83
4
120
152
120
data_source,req
['params', 'result', 'sql', 'search_results']
Response[List[SearchResult]]
{"Assign": 4, "Expr": 1, "Return": 1}
5
33
5
["query", "get_connection", "SearchResult", "result.to_dict_list", "Response"]
84
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3599553_mozilla_minion_backend.minion.backend.views.invites_py.get_invites", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3605117_crosswalk_project_crosswalk_tizen.tools.cpplint_py.Search", "_.content.gdrive.MyDriv...
The function (search) defined within the public class called public.The function start at line 120 and ends at 152. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [120.0] and does not return any value. It declares 5.0 functions, It has 5.0 functions called in...
Sema4AI_actions
public
public
0
0
advanced_search
def advanced_search(data_source: KnowledgeBaseDataSource,req: AdvancedSearchRequest) -> Response[List[SearchResult]]:"""Advanced search with specific criteria like record IDs or metadata filters.Args:data_source: The knowledge base data sourcereq: AdvancedSearchRequest containing search and filter parametersReturns:Res...
8
30
2
192
7
156
213
156
data_source,req
['sql', 'search_results', 'placeholders', 'params', 'where_conditions', 'result', 'where_clause']
Response[List[SearchResult]]
{"Assign": 8, "Expr": 3, "For": 1, "If": 3, "Return": 1}
11
58
11
["ActionError", "join", "where_conditions.append", "req.filter.metadata_filters.items", "where_conditions.append", "join", "query", "get_connection", "SearchResult", "result.to_dict_list", "Response"]
0
[]
The function (advanced_search) defined within the public class called public.The function start at line 156 and ends at 213. It contains 30 lines of code and it has a cyclomatic complexity of 8. It takes 2 parameters, represented as [156.0] and does not return any value. It declares 11.0 functions, and It has 11.0 fun...
Sema4AI_actions
public
public
0
0
get_metadata_columns
def get_metadata_columns(data_source: KnowledgeBaseDataSource) -> Response[Dict[str, Any]]:"""Get the available metadata columns for a knowledge base.Args:data_source: The knowledge base data sourceReturns:Response containing metadata column information including column namesand types"""# Query to get metadata columns ...
12
51
1
244
6
217
292
217
data_source
['metadata_columns_raw', 'sql', 'parsed_columns', 'first_row', 'result', 'metadata_columns']
Response[Dict[str, Any]]
{"Assign": 12, "Expr": 1, "If": 6, "Return": 1, "Try": 1}
17
76
17
["query", "get_connection", "result.to_dict_list", "ActionError", "result.to_dict_list", "first_row.get", "isinstance", "json.loads", "isinstance", "isinstance", "isinstance", "isinstance", "Response", "list", "metadata_columns.keys", "type", "str"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.templates.data_access_kb.data_actions_py.insert_records"]
The function (get_metadata_columns) defined within the public class called public.The function start at line 217 and ends at 292. It contains 51 lines of code and it has a cyclomatic complexity of 12. The function does not take any parameters and does not return any value. It declares 17.0 functions, It has 17.0 functi...
Sema4AI_actions
public
public
0
0
insert_records
def insert_records(data_source: KnowledgeBaseDataSource,req: KnowledgeBaseInsertRequest) -> Response[bool]:"""Insert multiple records into a knowledge base.Args:data_source: The knowledge base data sourcereq: KnowledgeBaseInsertRequest containing records to insert and specific metadata columns.Returns:Response indicati...
6
24
2
142
6
296
349
296
data_source,req
['sql', 'metadata_columns_result', 'placeholders', 'available_columns', 'columns', 'params']
Response[bool]
{"Assign": 7, "Expr": 2, "For": 2, "If": 2, "Return": 1}
9
54
9
["ActionError", "get_metadata_columns", "metadata_columns_result.result.get", "join", "join", "record.metadata.get", "execute_sql", "get_connection", "Response"]
0
[]
The function (insert_records) defined within the public class called public.The function start at line 296 and ends at 349. It contains 24 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [296.0] and does not return any value. It declares 9.0 functions, and It has 9.0 functi...
Sema4AI_actions
RecordFilter
public
0
1
convert_empty_strings_to_none
def convert_empty_strings_to_none(cls, v):"""Convert empty strings to None for optional fields."""if v == "":return Nonereturn v
2
4
2
17
0
43
47
43
cls,v
[]
Returns
{"Expr": 1, "If": 1, "Return": 2}
1
5
1
["field_validator"]
0
[]
The function (convert_empty_strings_to_none) defined within the public class called RecordFilter, that inherit another class.The function start at line 43 and ends at 47. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [43.0], and this function return a value. ...
Sema4AI_actions
RecordFilter
public
0
1
convert_empty_strings_to_none
def convert_empty_strings_to_none(cls, v):"""Convert empty strings to None for optional fields."""if v == "":return Nonereturn v
2
4
2
17
0
61
65
43
cls,v
[]
Returns
{"Expr": 1, "If": 1, "Return": 2}
1
5
1
["field_validator"]
0
[]
The function (convert_empty_strings_to_none) defined within the public class called RecordFilter, that inherit another class.The function start at line 61 and ends at 65. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [43.0], and this function return a value. ...
Sema4AI_actions
RecordFilter
public
0
1
convert_empty_strings_to_none
def convert_empty_strings_to_none(cls, v):"""Convert empty strings to None for optional fields."""if v == "":return Nonereturn v
2
4
2
17
0
79
83
43
cls,v
[]
Returns
{"Expr": 1, "If": 1, "Return": 2}
1
5
1
["field_validator"]
0
[]
The function (convert_empty_strings_to_none) defined within the public class called RecordFilter, that inherit another class.The function start at line 79 and ends at 83. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [43.0], and this function return a value. ...
Sema4AI_actions
public
public
0
0
search_customers_per_country_substring
def search_customers_per_country_substring(search_string: str, datasource: PostgresCustomersDataSource) -> Response[Table]:"""Search for customers in a country containing the search string.Args:search_string: The substring to search for in the country name, for example "er"Returns:List of all customers and their data""...
1
8
2
47
2
6
24
6
search_string,datasource
['result', 'sql']
Response[Table]
{"Assign": 2, "Expr": 1, "Return": 1}
3
19
3
["datasource.native_query", "Response", "result.to_table"]
0
[]
The function (search_customers_per_country_substring) defined within the public class called public.The function start at line 6 and ends at 24. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [6.0] and does not return any value. It declares 3.0 functions, and ...
Sema4AI_actions
public
public
0
0
get_customers_in_country
def get_customers_in_country(country: str) -> Response[Table]:"""Get all customer names, their id's and account managers in a given country.Args:country: Name of the country in english, for example "France"Returns:Customers in the country as markdown."""sql = """SELECT company_name, customer_id, account_managerFROM pub...
1
9
1
45
2
8
26
8
country
['result', 'sql']
Response[Table]
{"Assign": 2, "Expr": 1, "Return": 1}
4
19
4
["query", "get_connection", "Response", "result.to_table"]
0
[]
The function (get_customers_in_country) defined within the public class called public.The function start at line 8 and ends at 26. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 func...
Sema4AI_actions
public
public
0
0
get_customers_orders_per_month
def get_customers_orders_per_month(company_name: str) -> Response[Table]:"""Get one customer's aggregated order totals (sales) for all historic months.Args:company_name: Company name or part of it like "GermanSys"Returns:Customers historic orders (sales) per month as markdown.If more than one company is found with the ...
3
29
1
95
3
34
77
34
company_name
['result', 'number_of_rows', 'sql']
Response[Table]
{"Assign": 5, "Expr": 1, "If": 2, "Return": 1}
10
44
10
["query", "get_connection", "len", "ActionError", "ActionError", "result.to_markdown", "query", "get_connection", "Response", "result.to_table"]
0
[]
The function (get_customers_orders_per_month) defined within the public class called public.The function start at line 34 and ends at 77. It contains 29 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, and It has...
Sema4AI_actions
public
public
0
0
get_countries
def get_countries() -> Response[Table]:"""Get all countries where there are customers. Use this to understand the dataset better.Returns:List of all countries."""sql = """SELECT distinct(country)FROM public_demo.demo_customersLIMIT 100;"""result = get_connection().query(sql)return Response(result=result.to_table())
1
8
0
34
2
82
97
82
['result', 'sql']
Response[Table]
{"Assign": 2, "Expr": 1, "Return": 1}
4
16
4
["query", "get_connection", "Response", "result.to_table"]
0
[]
The function (get_countries) defined within the public class called public.The function start at line 82 and ends at 97. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 functions call...
Sema4AI_actions
public
public
0
0
get_customers
def get_customers() -> Response[Table]:"""Get all available customers company names and their ids.Returns:List of all customers and their IDs."""sql = """SELECT company_name, customer_idFROM public_demo.demo_customersLIMIT 100;"""result = get_connection().query(sql)return Response(result=result.to_table())
1
8
0
34
2
101
116
101
['result', 'sql']
Response[Table]
{"Assign": 2, "Expr": 1, "Return": 1}
4
16
4
["query", "get_connection", "Response", "result.to_table"]
0
[]
The function (get_customers) defined within the public class called public.The function start at line 101 and ends at 116. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 functions ca...
Sema4AI_actions
public
public
0
0
greet
def greet() -> str:"""An empty AI Action Template.Returns:Simple "Hello world" message."""return "Hello world!\n"
1
2
0
9
0
13
20
13
[]
str
{"Expr": 1, "Return": 1}
0
8
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053458_Sema4AI_actions.templates.minimal.tests.test_template_py.test_actions"]
The function (greet) defined within the public class called public.The function start at line 13 and ends at 20. 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 1.0 function calling this function which is ["_.content.gd...
Sema4AI_actions
public
public
0
0
test_actions
def test_actions() -> None:from actions import greetassert greet() == "Hello world!\n"
1
3
0
16
0
1
4
1
[]
None
{}
1
4
1
["greet"]
0
[]
The function (test_actions) defined within the public class called public.The function start at line 1 and ends at 4. It contains 3 lines of code and it has a cyclomatic complexity of 1. It take 0 parameter, represented as [1.0] and does not return any value. It declare 1.0 function, and It has 1.0 function called ins...
aiondemand_AIOD-rest-api
public
public
0
0
run_migrations_offline
def run_migrations_offline() -> None:"""Run migrations in 'offline' mode.This configures the context with just a URLand not an Engine, though an Engine is acceptablehere as well.By skipping the Engine creationwe don't even need a DBAPI to be available.Calls to context.execute() here emit the given string to thescript o...
1
10
0
49
1
30
51
30
['url']
None
{"Assign": 1, "Expr": 3, "With": 1}
4
22
4
["db_url", "context.configure", "context.begin_transaction", "context.run_migrations"]
0
[]
The function (run_migrations_offline) defined within the public class called public.The function start at line 30 and ends at 51. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 func...
aiondemand_AIOD-rest-api
public
public
0
0
run_migrations_online
def run_migrations_online() -> None:"""Run migrations in 'online' mode.In this scenario we need to create an Engineand associate a connection with the context."""connectable = EngineSingleton().enginewith connectable.connect() as connection:context.configure(connection=connection, target_metadata=target_metadata)with c...
1
6
0
47
1
54
66
54
['connectable']
None
{"Assign": 1, "Expr": 3, "With": 2}
5
13
5
["EngineSingleton", "connectable.connect", "context.configure", "context.begin_transaction", "context.run_migrations"]
0
[]
The function (run_migrations_online) defined within the public class called public.The function start at line 54 and ends at 66. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 functi...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:# All models that derive from AIResourceBasefor table in ["news","team","person","organisation","event","project","service","dataset","case_study","publication","computational_asset","ml_model","experiment","educational_resource",]:op.alter_column(f"note_{table}","value",type_=String(VERY_LONG),)
2
22
0
57
0
23
45
23
[]
None
{"Expr": 1, "For": 1}
2
23
2
["op.alter_column", "String"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 23 and ends at 45. It contains 22 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions called inside ...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:pass
1
2
0
7
0
48
49
48
[]
None
{}
0
2
0
[]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 48 and ends at 49. 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..
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:for column in ["date_created", "date_modified"]:op.alter_column("aiod_entry",column,existing_type=sa.DateTime(),nullable=False,)
2
8
0
36
0
22
29
22
[]
None
{"Expr": 1, "For": 1}
2
8
2
["op.alter_column", "sa.DateTime"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 22 and ends at 29. It contains 8 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions called inside w...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:for column in ["date_created", "date_modified"]:op.alter_column("aiod_entry",column,existing_type=sa.DateTime(),nullable=True,)
2
8
0
36
0
32
39
32
[]
None
{"Expr": 1, "For": 1}
2
8
2
["op.alter_column", "sa.DateTime"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 32 and ends at 39. It contains 8 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called i...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:op.drop_table("aiod_entry_status_link")op.add_column("aiod_entry",Column("status", Enum(EntryStatus)),)op.execute("""UPDATE aiod_entryINNER JOIN statusON status.identifier = aiod_entry.status_identifierSET aiod_entry.status = status.name""")op.drop_constraint(constraint_name="aiod_entry_ibfk_1",ta...
1
24
0
71
0
25
48
25
[]
None
{"Expr": 6}
8
24
8
["op.drop_table", "op.add_column", "Column", "Enum", "op.execute", "op.drop_constraint", "op.drop_column", "op.drop_table"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 25 and ends at 48. It contains 24 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 8.0 functions, It has 8.0 functions called inside ...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:# No need to recreate table status link, it was not used.op.create_table("status",Column("identifier", type_=INT, primary_key=True),Column("name",unique=True,type_=String(NORMAL),index=True,),)op.execute("""INSERT INTO statusVALUES (1, 'draft'), (2, 'published'), (3, 'rejected'), (4, 'submitted'...
1
40
0
101
0
51
91
51
[]
None
{"Expr": 6}
10
41
10
["op.create_table", "Column", "Column", "String", "op.execute", "op.add_column", "Column", "op.execute", "op.drop_column", "op.create_foreign_key"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 51 and ends at 91. It contains 40 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 10.0 functions, and It has 10.0 functions calle...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:op.alter_column("project","total_cost_euro",new_column_name="total_cost_euros",existing_type=DECIMAL(12, 2),existing_nullable=True,existing_server_default=None,)
1
9
0
36
0
22
30
22
[]
None
{"Expr": 1}
2
9
2
["op.alter_column", "DECIMAL"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 22 and ends at 30. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions called inside w...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:op.alter_column("project","total_cost_euros",new_column_name="total_cost_euro",existing_type=DECIMAL(12, 2),existing_nullable=True,existing_server_default=None,)
1
9
0
36
0
33
41
33
[]
None
{"Expr": 1}
2
9
2
["op.alter_column", "DECIMAL"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 33 and ends at 41. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called i...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:# All models that have associated distributionsfor table in ["dataset","case_study","publication","computational_asset","ml_model","experiment",]:op.alter_column(f"distribution_{table}","content_url",type_=String(LONG),)
2
14
0
41
0
24
38
24
[]
None
{"Expr": 1, "For": 1}
2
15
2
["op.alter_column", "String"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 24 and ends at 38. 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 2.0 functions, It has 2.0 functions called inside ...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:# from NORMALpass
1
2
0
7
0
41
43
41
[]
None
{}
0
3
0
[]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 41 and ends at 43. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:# Simply forgot to update knowledge asset identifiers last time.# This script follows the same setup as the last, but only applies to knowledge asset,# which at this point only has `publication` as a child referencing it.# Fetch foreign key constraints so we can drop them and add them back later.w...
6
38
0
204
2
36
83
36
['constraints', 'updated_columns']
None
{"Assign": 3, "Expr": 12, "For": 4, "If": 1, "With": 1}
18
48
18
["DbSession", "logger.info", "session.execute", "text", "list", "logger.info", "len", "op.execute", "set", "logger.info", "op.execute", "updated_columns.add", "logger.info", "op.execute", "logger.info", "op.execute", "logger.info", "op.execute"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 36 and ends at 83. It contains 38 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 18.0 functions, It has 18.0 functions called insid...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:pass
1
2
0
7
0
86
87
86
[]
None
{}
0
2
0
[]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 86 and ends at 87. 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..
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:# For more information, see docs/developer/schema/index.md#a-note-on-identifiersaiod_concept = ParentTable(name="aiod_concept",fk_identifier="identifier",children=["contact","organisation","person","dataset","publication","case_study","computational_asset","experiment","ml_model","educational_reso...
9
124
0
433
8
35
173
35
['agent', 'updated_columns', 'aiod_concept', 'constraints', 'ai_resource', 'ai_asset', 'tables_with_referenced_key', 'child_data']
None
{"Assign": 9, "Expr": 14, "For": 6, "If": 1, "With": 1}
27
139
27
["ParentTable", "ParentTable", "ParentTable", "ParentTable", "logger.info", "op.execute", "DbSession", "logger.info", "session.execute", "text", "join", "map", "list", "logger.info", "len", "op.execute", "set", "logger.info", "op.execute", "updated_columns.add", "logger.info", "op.execute", "logger.info", "op.execute",...
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 35 and ends at 173. It contains 124 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 27.0 functions, It has 27.0 functions called ins...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:pass
1
2
0
7
0
176
177
176
[]
None
{}
0
2
0
[]
0
[]
The function (downgrade) defined within the public class called public.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..
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:op.rename_table("edu_educational_level", "educational_level")op.rename_table("educational_resource_edu_educational_level_link","educational_resource_educational_level_link",)description_column = Column("definition", String(LONG), nullable=True)official_column = Column("official", Boolean(), nullab...
4
29
0
251
3
41
72
41
['official_column', 'parent_id', 'description_column']
None
{"Assign": 3, "Expr": 6, "For": 3}
21
32
21
["op.rename_table", "op.rename_table", "Column", "String", "Column", "Boolean", "Column", "Integer", "op.add_column", "op.execute", "op.create_table", "sa.Column", "sa.Column", "sa.String", "sa.Column", "sa.String", "sa.Column", "sa.Column", "sa.UniqueConstraint", "sa.ForeignKeyConstraint", "op.create_index"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 41 and ends at 72. It contains 29 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 21.0 functions, It has 21.0 functions called insid...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:op.rename_table("educational_level", "edu_educational_level")for table, _ in UPGRADE_TAXONOMY_TABLES:op.drop_column(table_name=table, column_name="definition")op.drop_column(table_name=table, column_name="official")op.alter_column(table,column_name="name",type_=String(length=NORMAL),existing_nul...
3
13
0
80
0
75
89
75
[]
None
{"Expr": 5, "For": 2}
6
15
6
["op.rename_table", "op.drop_column", "op.drop_column", "op.alter_column", "String", "op.drop_table"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 75 and ends at 89. 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 6.0 functions, and It has 6.0 functions called ...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade():op.add_column("organisation", sa.Column("turnover_identifier", sa.Integer(), nullable=True))op.add_column("organisation", sa.Column("number_of_employees_identifier", sa.Integer(), nullable=True))op.create_foreign_key("fk_organisation_turnover_identifier","organisation","turnover",["turnover_identifier"],[...
1
19
0
88
0
22
42
22
[]
None
{"Expr": 4}
8
21
8
["op.add_column", "sa.Column", "sa.Integer", "op.add_column", "sa.Column", "sa.Integer", "op.create_foreign_key", "op.create_foreign_key"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 22 and ends at 42. It contains 19 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 8.0 functions, It has 8.0 functions called inside ...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:op.drop_constraint("fk_organisation_number_of_employees_identifier", "organisation", type_="foreignkey")op.drop_constraint("fk_organisation_turnover_identifier", "organisation", type_="foreignkey")op.drop_column("organisation", "number_of_employees_identifier")op.drop_column("organisation", "tur...
1
7
0
46
0
45
52
45
[]
None
{"Expr": 4}
4
8
4
["op.drop_constraint", "op.drop_constraint", "op.drop_column", "op.drop_column"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 45 and ends at 52. 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 4.0 functions, and It has 4.0 functions called i...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:description_column = Column("definition", String(LONG), nullable=True)official_column = Column("official", Boolean(), nullable=True, default=False)parent_id = Column("parent_id", Integer(), nullable=True)for table, class_name in TAXONOMY_TABLES:for column in [description_column, official_column, p...
3
8
0
90
3
32
40
32
['official_column', 'parent_id', 'description_column']
None
{"Assign": 3, "Expr": 2, "For": 2}
8
9
8
["Column", "String", "Column", "Boolean", "Column", "Integer", "op.add_column", "op.execute"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 32 and ends at 40. It contains 8 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 8.0 functions, It has 8.0 functions called inside w...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:for table, _ in TAXONOMY_TABLES:op.drop_column(table_name=table, column_name="definition")op.drop_column(table_name=table, column_name="official")op.alter_column(table,column_name="name",type_=String(length=NORMAL),existing_nullable=False,)
2
10
0
61
0
43
52
43
[]
None
{"Expr": 3, "For": 1}
4
10
4
["op.drop_column", "op.drop_column", "op.alter_column", "String"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 43 and ends at 52. It contains 10 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 functions called ...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:# For more information, see docs/developer/schema/index.md#a-note-on-identifiersaiod_concept = ParentTable(name="aiod_concept",fk_identifier="identifier",children=["contact","organisation","person","dataset","publication","case_study","computational_asset","experiment","ml_model","educational_reso...
4
124
0
371
7
33
166
33
['map_table', 'agent', 'aiod_concept', 'abbreviations', 'ai_resource', 'ai_asset', 'child_data']
None
{"Assign": 8, "Expr": 7, "For": 2}
19
134
19
["ParentTable", "ParentTable", "ParentTable", "ParentTable", "op.execute", "text", "logger.info", "op.create_table", "Column", "Column", "String", "op.execute", "logger.info", "op.create_table", "Column", "Column", "String", "join", "op.execute"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 33 and ends at 166. It contains 124 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 19.0 functions, It has 19.0 functions called ins...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:pass
1
2
0
7
0
169
170
169
[]
None
{}
0
2
0
[]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 169 and ends at 170. 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..
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:op.add_column("educational_resource",sa.Column("required_competency_level_identifier", sa.Integer(), nullable=True),)op.create_foreign_key("educational_resource_required_competency_level_ibfk","educational_resource","educational_competency",["required_competency_level_identifier"],["identifier"],)
1
12
0
49
0
22
33
22
[]
None
{"Expr": 2}
4
12
4
["op.add_column", "sa.Column", "sa.Integer", "op.create_foreign_key"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 22 and ends at 33. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions called inside ...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:op.drop_constraint("educational_resource_required_competency_level_ibfk","educational_resource",type_="foreignkey",)op.drop_column("educational_resource", "required_competency_level_identifier")
1
7
0
27
0
36
42
36
[]
None
{"Expr": 2}
2
7
2
["op.drop_constraint", "op.drop_column"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 36 and ends at 42. 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 2.0 functions called i...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:# We use a nuclear approach as there are no reviews in the database anyway:op.drop_table("review")op.drop_table("submission")# We could leave it at the above an rely on SQLAlchemy to create the tables below.# However, this increases the complexity of the deployment so make it explicit:op.create_ta...
1
60
0
454
0
22
87
22
[]
None
{"Expr": 9}
43
66
43
["op.drop_table", "op.drop_table", "op.create_table", "sa.Column", "sa.Integer", "sa.Column", "sa.DateTime", "sa.Column", "sa.String", "sa.Column", "sa.String", "sa.PrimaryKeyConstraint", "sa.ForeignKeyConstraint", "op.create_index", "op.create_table", "sa.Column", "sa.String", "sa.Column", "sa.Enum", "sa.Column", "sa....
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 22 and ends at 87. It contains 60 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 43.0 functions, It has 43.0 functions called insid...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:op.drop_table("review")op.drop_table("asset_review")op.drop_table("submission")
1
4
0
24
0
90
93
90
[]
None
{"Expr": 3}
3
4
3
["op.drop_table", "op.drop_table", "op.drop_table"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 90 and ends at 93. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions called i...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:op.add_column(table_name="news",column=Column("source", String(LONG), nullable=True),)
1
5
0
31
0
24
28
24
[]
None
{"Expr": 1}
3
5
3
["op.add_column", "Column", "String"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 24 and ends at 28. 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 functions called inside w...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:op.drop_column(table_name="news", column_name="source")
1
2
0
18
0
31
32
31
[]
None
{"Expr": 1}
1
2
1
["op.drop_column"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 31 and ends at 32. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 function called insi...
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:# Migrate existing countries to country table as unofficialop.execute("insert into country(name, definition, official) SELECT distinct(country), '', false from address;")# Create new column that references the identifierop.add_column("address", Column("country_identifier", sa.Integer(), nullable=T...
1
16
0
66
0
22
41
22
[]
None
{"Expr": 5}
7
20
7
["op.execute", "op.add_column", "Column", "sa.Integer", "op.execute", "op.create_foreign_key", "op.drop_column"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 22 and ends at 41. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 7.0 functions, It has 7.0 functions called inside ...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:pass
1
2
0
7
0
44
45
44
[]
None
{}
0
2
0
[]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 44 and ends at 45. 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..
aiondemand_AIOD-rest-api
public
public
0
0
upgrade
def upgrade() -> None:for asset_type in assets_with_media:op.alter_column(f"media_{asset_type}","content_url",existing_type=sa.String(length=1800),nullable=True,)op.add_column(table_name=f"media_{asset_type}",column=sa.Column("binary_blob", sa.LargeBinary(), nullable=True),)for asset_type in assets_with_distributions:o...
3
17
0
99
0
49
67
49
[]
None
{"Expr": 3, "For": 2}
8
19
8
["op.alter_column", "sa.String", "op.add_column", "sa.Column", "sa.LargeBinary", "op.add_column", "sa.Column", "sa.LargeBinary"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.fairseq.utils_py._match_types"]
The function (upgrade) defined within the public class called public.The function start at line 49 and ends at 67. It contains 17 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 8.0 functions, It has 8.0 functions called inside ...
aiondemand_AIOD-rest-api
public
public
0
0
downgrade
def downgrade() -> None:for asset_type in assets_with_media:op.alter_column(f"media_{asset_type}","content_url",existing_type=sa.String(length=1800),nullable=False,)op.drop_column(f"media_{asset_type}", "binary_blob")for asset_type in assets_with_distributions:op.drop_column(f"distribution_{asset_type}", "binary_blob")
3
11
0
59
0
70
82
70
[]
None
{"Expr": 3, "For": 2}
4
13
4
["op.alter_column", "sa.String", "op.drop_column", "op.drop_column"]
0
[]
The function (downgrade) defined within the public class called public.The function start at line 70 and ends at 82. 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 4.0 functions, and It has 4.0 functions called ...
aiondemand_AIOD-rest-api
public
public
0
0
fetch_huggingface_metadata
def fetch_huggingface_metadata() -> list[dict]:next_url = "https://huggingface.co/api/datasets"datasets = []while next_url:logging.info(f"Counted {len(datasets)} so far.")if token := os.environ.get("HUGGINGFACE_TOKEN"):headers = {"Authorization": f"Bearer {token}"}else:headers = {}response = requests.get(next_url,param...
5
25
0
162
5
35
61
35
['next_info', 'datasets', 'headers', 'response', 'next_url']
list[dict]
{"Assign": 8, "Expr": 3, "If": 3, "Return": 1, "While": 1}
11
27
11
["logging.info", "len", "os.environ.get", "requests.get", "logging.info", "response.json", "datasets.extend", "response.json", "response.headers.get", "re.search", "next_url_match.group"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.scripts.migrate_hf_py.load_id_map"]
The function (fetch_huggingface_metadata) defined within the public class called public.The function start at line 35 and ends at 61. It contains 25 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 11.0 functions, It has 11.0 fun...
aiondemand_AIOD-rest-api
public
public
0
0
load_id_map
def load_id_map():HF_DATA_FILE = Path(__file__).parent / "hf_metadata.json"if HF_DATA_FILE.exists():logging.info(f"Loading HF data from {HF_DATA_FILE}.")with open(HF_DATA_FILE, "r") as fh:hf_data = json.load(fh)else:logging.info("Fetching HF data from Hugging Face.")hf_data = fetch_huggingface_metadata()with open(HF_DA...
3
13
0
96
3
64
76
64
['hf_data', 'id_map', 'HF_DATA_FILE']
Returns
{"Assign": 4, "Expr": 3, "If": 1, "Return": 1, "With": 2}
9
13
9
["Path", "HF_DATA_FILE.exists", "logging.info", "open", "json.load", "logging.info", "fetch_huggingface_metadata", "open", "json.dump"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.scripts.migrate_hf_py.main"]
The function (load_id_map) defined within the public class called public.The function start at line 64 and ends at 76. It contains 13 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 9.0 functions, It has 9.0 functions called...
aiondemand_AIOD-rest-api
public
public
0
0
main
def main():logging.basicConfig(level=logging.INFO)AIoDConcept.metadata.create_all(EngineSingleton().engine, checkfirst=True)id_map = load_id_map()with DbSession() as session:datasets_query = select(Dataset).where(Dataset.platform == PlatformName.huggingface)datasets = session.scalars(datasets_query).all()logging.info(f...
6
26
0
173
4
79
107
79
['datasets_query', 'is_old_style_identifier', 'datasets', 'id_map']
None
{"Assign": 6, "Expr": 8, "For": 1, "If": 1, "With": 2}
21
29
21
["logging.basicConfig", "AIoDConcept.metadata.create_all", "EngineSingleton", "load_id_map", "DbSession", "where", "select", "all", "session.scalars", "logging.info", "len", "any", "is_old_style_identifier", "logging.info", "len", "DbSession", "id_map.get", "session.add", "session.delete", "session.commit", "logging.in...
332
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.main_py.init", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3625043_uber_tchannel_python.tests.test_tcurl_py.test_tcurl_health", "_.content.gdrive.MyDrive.Phd_Thesis...
The function (main) defined within the public class called public.The function start at line 79 and ends at 107. It contains 26 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 21.0 functions, It has 21.0 functions called inside ...
aiondemand_AIOD-rest-api
public
public
0
0
assert_required_settings_configured
def assert_required_settings_configured() -> None:# These variables are required for the API to function, so we provide context beyond KeyError.# Should be managed together with other settings in the future (#67)assert REVIEWER_ROLE, "Environment variable 'REVIEWER_ROLE_NAME' not set."# noqa: S101assert client_secret, ...
1
3
0
14
0
49
53
49
[]
None
{}
0
5
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.main_py.create_app"]
The function (assert_required_settings_configured) defined within the public class called public.The function start at line 49 and ends at 53. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 1.0 function calling this fu...
aiondemand_AIOD-rest-api
KeycloakUser
public
0
0
has_role
def has_role(self, role: str) -> bool:return role in self.roles
1
2
2
17
0
62
63
62
self,role
[]
bool
{"Return": 1}
0
2
0
[]
0
[]
The function (has_role) defined within the public class called KeycloakUser.The function start at line 62 and ends at 63. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [62.0] and does not return any value..
aiondemand_AIOD-rest-api
KeycloakUser
public
0
0
has_any_role
def has_any_role(self, *roles: str) -> bool:return bool(set(roles) & self.roles)
1
2
2
24
0
65
66
65
self,*roles
[]
bool
{"Return": 1}
2
2
2
["bool", "set"]
0
[]
The function (has_any_role) defined within the public class called KeycloakUser.The function start at line 65 and ends at 66. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [65.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functi...
aiondemand_AIOD-rest-api
KeycloakUser
public
0
0
is_connector_for_platform
def is_connector_for_platform(self, platform_name: str) -> bool:"""Check if the user is a connector for a specific platform."""return f"platform_{platform_name}" in self.roles
1
2
2
19
0
68
72
68
self,platform_name
[]
bool
{"Expr": 1, "Return": 1}
0
5
0
[]
0
[]
The function (is_connector_for_platform) defined within the public class called KeycloakUser.The function start at line 68 and ends at 72. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [68.0] and does not return any value..
aiondemand_AIOD-rest-api
KeycloakUser
public
0
0
is_reviewer
def is_reviewer(self):return REVIEWER_ROLE in self.roles
1
2
1
11
0
75
76
75
self
[]
Returns
{"Return": 1}
0
2
0
[]
0
[]
The function (is_reviewer) defined within the public class called KeycloakUser.The function start at line 75 and ends at 76. 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..
aiondemand_AIOD-rest-api
KeycloakUser
public
0
0
is_connector
def is_connector(self) -> bool:"""Check if the user is a connector."""return any(role.startswith("platform_") for role in self.roles)
2
2
1
24
0
79
83
79
self
[]
bool
{"Expr": 1, "Return": 1}
2
5
2
["any", "role.startswith"]
0
[]
The function (is_connector) defined within the public class called KeycloakUser.The function start at line 79 and ends at 83. It contains 2 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions...
aiondemand_AIOD-rest-api
public
public
0
0
_get_user
async def _get_user(token) -> KeycloakUser:"""Check the roles of the user for authorization.Raises:NoTokenError on missing token (unauthorized message) and InvalidUserError on inactive user.Also HTTPException with status 401 on any problem with the token(we don't want to leak information), and status 500 on any request...
6
30
1
158
2
86
126
86
token
['userinfo', 'token']
KeycloakUser
{"Assign": 2, "Expr": 3, "If": 3, "Return": 1, "Try": 1}
13
41
13
["HTTPException", "NoTokenError", "token.replace", "keycloak_openid.introspect", "userinfo.get", "logging.error", "InvalidUserError", "KeycloakUser", "set", "get", "userinfo.get", "logging.error", "HTTPException"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.authentication_py.get_user_or_none", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.authentication_py.get_user_or_raise"]
The function (_get_user) defined within the public class called public.The function start at line 86 and ends at 126. It contains 30 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 13.0 functions, It has 13.0 functions called in...
aiondemand_AIOD-rest-api
public
public
0
0
get_user_or_none
async def get_user_or_none(token=Security(oidc)) -> KeycloakUser | None:"""Use this function in Depends() to ask for authentication.This method should be only used to get the current userwithout raising exception when the token is not found,or the user is not active, or the userinfo is invalid."""try:return await _get_...
2
5
1
32
0
129
139
129
token
[]
KeycloakUser | None
{"Expr": 1, "Return": 2, "Try": 1}
2
11
2
["Security", "_get_user"]
0
[]
The function (get_user_or_none) defined within the public class called public.The function start at line 129 and ends at 139. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions...
aiondemand_AIOD-rest-api
public
public
0
0
get_user_or_raise
async def get_user_or_raise(token=Security(oidc)) -> KeycloakUser:"""Use this function in Depends() to force authentication. Check the roles of the user forauthorization.Raises:HTTPException with status 401 on missing token (unauthorized message), or invalid user.It also raises a HTTPException with status 401 onany pro...
2
9
1
55
0
142
160
142
token
[]
KeycloakUser
{"Expr": 1, "Return": 1, "Try": 1}
3
19
3
["Security", "_get_user", "HTTPException"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.test_authentication_py.test_happy_path", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.test_authentication_py.test_happy_path_p...
The function (get_user_or_raise) defined within the public class called public.The function start at line 142 and ends at 160. It contains 9 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions cal...
aiondemand_AIOD-rest-api
public
public
0
0
_merge_configurations
def _merge_configurations(default: dict[str, Any], override: dict[str, Any], path: str = "root") -> dict[str, Any]:if extra_keys := (set(override) - set(default)):keys = ", ".join(map(repr, extra_keys))raise KeyError(f"The custom configuration has unknown key(s) at {path!r}: {keys}")merged = copy.copy(default)for key, ...
4
13
3
124
2
33
45
33
default,override,path
['merged', 'keys']
dict[str, Any]
{"Assign": 4, "For": 1, "If": 2, "Return": 1}
9
13
9
["set", "set", "join", "map", "KeyError", "copy.copy", "override.items", "isinstance", "_merge_configurations"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.config_py._merge_configurations", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.test_configuration_py.test_merge_configuration_array"...
The function (_merge_configurations) defined within the public class called public.The function start at line 33 and ends at 45. It contains 13 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [33.0] and does not return any value. It declares 9.0 functions, It has 9.0 functio...
aiondemand_AIOD-rest-api
public
public
0
0
_mask_configuration
def _mask_configuration(configuration: dict[str, Any], to_mask: Sequence[str] | None = None) -> dict[str, Any]:if to_mask is None:to_mask = ["password"]masked = copy.copy(configuration)for key, value in configuration.items():if key in to_mask:masked[key] = "****"elif isinstance(value, dict):masked[key] = _mask_configur...
5
12
2
91
2
48
59
48
configuration,to_mask
['masked', 'to_mask']
dict[str, Any]
{"Assign": 4, "For": 1, "If": 3, "Return": 1}
4
12
4
["copy.copy", "configuration.items", "isinstance", "_mask_configuration"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.config_py._mask_configuration", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.config_py.log_configuration"]
The function (_mask_configuration) defined within the public class called public.The function start at line 48 and ends at 59. It contains 12 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [48.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions...
aiondemand_AIOD-rest-api
public
public
0
0
log_configuration
def log_configuration():"""Logs stacked log lines and then outputs the current configuration."""while _log_lines:level, message = _log_lines.popleft()logger.log(level, message)logger.info(f"Starting with merged configuration: {_mask_configuration(CONFIG)}")
2
5
0
32
0
62
67
62
[]
None
{"Assign": 1, "Expr": 3, "While": 1}
4
6
4
["_log_lines.popleft", "logger.log", "logger.info", "_mask_configuration"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.setup_logger_py.setup_logger"]
The function (log_configuration) defined within the public class called public.The function start at line 62 and ends at 67. 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 functions calle...
aiondemand_AIOD-rest-api
public
public
0
0
add_routes.home
def home(request: Request) -> str:"""Provides a redirect page to the docs."""proxy_prefix = request.headers.get("x-forwarded-prefix", "")prefix = proxy_prefix + version.prefixreturn f"""<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url='{prefix}/docs'" /></head><body><p>The REST API documentation is...
1
3
1
32
0
62
76
62
null
[]
None
null
0
0
0
null
0
null
The function (add_routes.home) defined within the public class called public.The function start at line 62 and ends at 76. 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..
aiondemand_AIOD-rest-api
public
public
0
0
add_routes.test_authorization
def test_authorization(user: KeycloakUser = Depends(get_user_or_raise)) -> KeycloakUser:"""Returns the user, if authenticated correctly."""return user
1
2
1
17
0
79
83
79
null
[]
None
null
0
0
0
null
0
null
The function (add_routes.test_authorization) defined within the public class called public.The function start at line 79 and ends at 83. 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..
aiondemand_AIOD-rest-api
public
public
0
0
add_routes.counts
def counts() -> dict:return {router.resource_name_plural: countfor router in resource_routers.versioned_routers.get(version, [])if issubclass(router.resource_class, AIoDConcept)and (count := router.get_resource_count_func()(detailed=True))}
4
7
0
52
0
86
92
86
null
[]
None
null
0
0
0
null
0
null
The function (add_routes.counts) defined within the public class called public.The function start at line 86 and ends at 92. It contains 7 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
add_routes
def add_routes(app: FastAPI, version: Version, url_prefix=""):"""Add routes to the FastAPI application"""@app.get("/", include_in_schema=False, response_class=HTMLResponse)def home(request: Request) -> str:"""Provides a redirect page to the docs."""proxy_prefix = request.headers.get("x-forwarded-prefix", "")prefix = pr...
3
18
3
130
2
58
106
58
app,version,url_prefix
['prefix', 'proxy_prefix']
Returns
{"Assign": 2, "Expr": 6, "For": 2, "Return": 3}
15
49
15
["request.headers.get", "app.get", "Depends", "app.get", "resource_routers.versioned_routers.get", "issubclass", "router.get_resource_count_func", "app.get", "versioned_routers.get", "app.include_router", "router.create", "app.include_router", "router.create", "app.include_router", "create_access_stats_router"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.main_py.build_app"]
The function (add_routes) defined within the public class called public.The function start at line 58 and ends at 106. It contains 18 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [58.0], and this function return a value. It declares 15.0 functions, It has 15.0 functions c...
aiondemand_AIOD-rest-api
public
public
0
0
create_app
def create_app() -> FastAPI:"""Create the FastAPI application, complete with routes."""setup_logger()assert_required_settings_configured()build_database_setting = DB_CONFIG.get("build_database", "never")if build_database_setting == "never":if not database_exists():logging.warning("AI-on-Demand database does not exist o...
6
25
0
126
4
109
136
109
['drop_database', 'dist_version', 'build_database_setting', 'app']
FastAPI
{"Assign": 5, "Expr": 6, "If": 4, "Return": 1, "Try": 1}
14
28
14
["setup_logger", "assert_required_settings_configured", "DB_CONFIG.get", "database_exists", "logging.warning", "build_database", "DEV_CONFIG.get", "is_file", "Path", "ValueError", "synchronize_taxonomy_from_file", "pkg_version", "build_app", "DEV_CONFIG.get"]
78
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3653826_zalando_zmon_zmon_worker.zmon_worker_monitor.web_server.web_py.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3918618_moveangel_one4ubot.userbot.modules.gdrive_py.google_drive", "_.content.gdrive.MyDriv...
The function (create_app) defined within the public class called public.The function start at line 109 and ends at 136. It contains 25 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 14.0 functions, It has 14.0 functions called ...
aiondemand_AIOD-rest-api
public
public
0
0
build_app
def build_app(*, url_prefix: str = "", version: str = "dev"):kwargs = dict(docs_url=None,# We override the default pages with custom htmlredoc_url=None,description="This is the REST API documentation of the AIoD Metadata Catalogue. ""See also our general "'<a href="https://aiondemand.github.io/AIOD-rest-api/">metadata ...
5
47
2
225
3
139
190
139
url_prefix,version
['versioned_apps', 'kwargs', 'main_app']
Returns
{"Assign": 3, "Expr": 7, "For": 2, "Return": 1}
16
52
16
["dict", "KEYCLOAK_CONFIG.get", "KEYCLOAK_CONFIG.get", "KEYCLOAK_CONFIG.get", "FastAPI", "FastAPI", "versions.items", "add_routes", "app.add_exception_handler", "add_deprecation_and_sunset_middleware", "add_version_to_openapi", "expose", "instrument", "Instrumentator", "main_app.add_middleware", "main_app.mount"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.main_py.create_app", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.testutils.default_sqlalchemy_py.client"]
The function (build_app) defined within the public class called public.The function start at line 139 and ends at 190. It contains 47 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [139.0], and this function return a value. It declares 16.0 functions, It has 16.0 functions ...
aiondemand_AIOD-rest-api
public
public
0
0
build_database
def build_database(drop_database: bool = False):create_database(delete_first=drop_database)SQLModel.metadata.create_all(EngineSingleton().engine, checkfirst=True)with DbSession() as session:triggers = create_delete_triggers(AIoDConcept)sync_triggers = create_identifier_synchronization_triggers()for trigger in triggers ...
6
17
1
141
4
193
211
193
drop_database
['missing_platforms', 'triggers', 'existing_platforms', 'sync_triggers']
None
{"Assign": 4, "Expr": 7, "For": 1, "If": 2, "With": 1}
18
19
18
["create_database", "SQLModel.metadata.create_all", "EngineSingleton", "DbSession", "create_delete_triggers", "create_identifier_synchronization_triggers", "session.execute", "DEV_CONFIG.get", "disable_review_process", "enable_review_process", "all", "session.scalars", "select", "set", "any", "session.add_all", "Platfo...
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.main_py.create_app"]
The function (build_database) defined within the public class called public.The function start at line 193 and ends at 211. It contains 17 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 18.0 functions, It has 18.0 functions cal...
aiondemand_AIOD-rest-api
public
public
0
0
main
def main():"""Run the application. Placed in a separate function, to avoid having global variables"""# TODO: unify configuration and environment file?GH#82# This parsing allows users to see the message on `--help` or incorrect (old) invocations.msg = ("Configuration options can be set in the configuration file. ""Pleas...
1
12
0
49
1
214
230
214
['msg']
None
{"Assign": 1, "Expr": 3}
4
17
4
["parse_args", "argparse.ArgumentParser", "uvicorn.run", "DEV_CONFIG.get"]
332
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.main_py.init", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3625043_uber_tchannel_python.tests.test_tcurl_py.test_tcurl_health", "_.content.gdrive.MyDrive.Phd_Thesis...
The function (main) defined within the public class called public.The function start at line 214 and ends at 230. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions called inside w...
aiondemand_AIOD-rest-api
public
public
0
0
setup_logger
def setup_logger(config: dict | None = None):config = config or CONFIGassert "dev" in config, "There should be a [dev] section in the configuration.toml file."assert "log_level" in config["dev"], ("Missing `log_level` setting in the [dev] section of the configuration.toml file.")log_level: str = config["dev"]["log_leve...
3
17
1
94
2
13
33
13
config
['config', 'levels']
None
{"AnnAssign": 1, "Assign": 2, "Expr": 2}
6
21
6
["upper", "logging.getLevelNamesMapping", "isinstance", "set", "logging.basicConfig", "log_configuration"]
8
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16418165_szabgab_pydigger_com.PyDigger.fetch_py.setup", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3711514_c0d3d3v_moodle_downloader_2.moodle_dl.main_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creatio...
The function (setup_logger) defined within the public class called public.The function start at line 13 and ends at 33. It contains 17 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 6.0 functions, It has 6.0 functions called in...
aiondemand_AIOD-rest-api
public
public
0
0
disable_review_process
def disable_review_process(session: Session) -> None:"""Sets new entries to automatically be published, circumventing the review process."""session.execute(DDL(f"""CREATE TRIGGER IF NOT EXISTS {BYPASS_REVIEW_TRIGGER_NAME}BEFORE INSERT ON aiod_entryFOR EACH ROWBEGINSET NEW.status = 'PUBLISHED';END;"""))
1
3
1
20
0
7
18
7
session
[]
None
{"Expr": 2}
2
12
2
["session.execute", "DDL"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.main_py.build_database"]
The function (disable_review_process) defined within the public class called public.The function start at line 7 and ends at 18. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions c...
aiondemand_AIOD-rest-api
public
public
0
0
enable_review_process
def enable_review_process(session: Session) -> None:"""Drops the trigger created by `disable_review_process`"""session.execute(DDL(f"DROP TRIGGER IF EXISTS {BYPASS_REVIEW_TRIGGER_NAME};"))
1
2
1
20
0
21
23
21
session
[]
None
{"Expr": 2}
2
3
2
["session.execute", "DDL"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.main_py.build_database"]
The function (enable_review_process) defined within the public class called public.The function start at line 21 and ends at 23. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions c...
aiondemand_AIOD-rest-api
Version
public
0
1
prefix
def prefix(self) -> str:if self == Version.LATEST:return ""return f"/{self}"
2
4
1
19
0
36
39
36
self
[]
str
{"If": 1, "Return": 2}
0
4
0
[]
6
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3508273_sc3_cookcountyjail.fabfile_py.activate_cmd", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3926013_duniter_silkaj.silkaj.tx_history_py.parse_received_tx", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creatio...
The function (prefix) defined within the public class called Version, that inherit another class.The function start at line 36 and ends at 39. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It has 6.0 functions calling this f...
aiondemand_AIOD-rest-api
public
public
0
0
add_deprecation_header_middleware.add_deprecation_header
async def add_deprecation_header(request: Request, call_next):"""Adds a deprecation header: https://datatracker.ietf.org/doc/html/rfc9745"""response = await call_next(request)response.headers["Deprecation"] = f"@{int(date.timestamp())}"if link is None:return responsedeprecation_link = f'<{link}>; rel="deprecation"; typ...
4
10
2
67
0
43
54
43
null
[]
None
null
0
0
0
null
0
null
The function (add_deprecation_header_middleware.add_deprecation_header) defined within the public class called public.The function start at line 43 and ends at 54. It contains 10 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [43.0] and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
add_deprecation_header_middleware
def add_deprecation_header_middleware(app: FastAPI, date: datetime, link: str | None = None):async def add_deprecation_header(request: Request, call_next):"""Adds a deprecation header: https://datatracker.ietf.org/doc/html/rfc9745"""response = await call_next(request)response.headers["Deprecation"] = f"@{int(date.times...
1
3
3
31
4
42
56
42
app,date,link
['separator', 'current_link', 'deprecation_link', 'response']
Returns
{"Assign": 6, "Expr": 2, "If": 1, "Return": 2}
5
15
5
["call_next", "int", "date.timestamp", "response.headers.get", "app.middleware"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.versioning_py.add_deprecation_and_sunset_middleware"]
The function (add_deprecation_header_middleware) defined within the public class called public.The function start at line 42 and ends at 56. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [42.0], and this function return a value. It declares 5.0 functions, It ...
aiondemand_AIOD-rest-api
public
public
0
0
add_sunset_header_middleware.add_sunset_header
async def add_sunset_header(request: Request, call_next):"""Adds a sunset header: https://datatracker.ietf.org/doc/html/rfc8594"""response = await call_next(request)response.headers["Sunset"] = date.strftime("%a, %d %b %Y %H:%M:%S %Z")if link is None:return responsesunset_link = f'<{link}>; rel="sunset"; type="text/htm...
4
10
2
71
0
60
71
60
null
[]
None
null
0
0
0
null
0
null
The function (add_sunset_header_middleware.add_sunset_header) defined within the public class called public.The function start at line 60 and ends at 71. It contains 10 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [60.0] and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
add_sunset_header_middleware
def add_sunset_header_middleware(app: FastAPI, date: datetime, link: str | None = None):async def add_sunset_header(request: Request, call_next):"""Adds a sunset header: https://datatracker.ietf.org/doc/html/rfc8594"""response = await call_next(request)response.headers["Sunset"] = date.strftime("%a, %d %b %Y %H:%M:%S %...
1
3
3
31
4
59
73
59
app,date,link
['separator', 'sunset_link', 'current_link', 'response']
Returns
{"Assign": 6, "Expr": 2, "If": 1, "Return": 2}
4
15
4
["call_next", "date.strftime", "response.headers.get", "app.middleware"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.versioning_py.add_deprecation_and_sunset_middleware"]
The function (add_sunset_header_middleware) defined within the public class called public.The function start at line 59 and ends at 73. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [59.0], and this function return a value. It declares 4.0 functions, It has 4...
aiondemand_AIOD-rest-api
public
public
0
0
add_deprecation_and_sunset_middleware
def add_deprecation_and_sunset_middleware(app: FastAPI):info = versions.get(app.version)if info is None:logger.warning(f"Version {app.version!r} isn't present in `versions`.")returnif info.deprecated is not None:add_deprecation_header_middleware(app, date=info.deprecated, link=info.link)for route in app.routes:# Adds a...
5
11
1
90
1
76
89
76
app
['info']
None
{"Assign": 2, "Expr": 3, "For": 1, "If": 3, "Return": 1}
4
14
4
["versions.get", "logger.warning", "add_deprecation_header_middleware", "add_sunset_header_middleware"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.main_py.build_app"]
The function (add_deprecation_and_sunset_middleware) defined within the public class called public.The function start at line 76 and ends at 89. It contains 11 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 4.0 functions, It ha...
aiondemand_AIOD-rest-api
public
public
0
0
add_version_to_openapi.custom_openapi
def custom_openapi():if versioned_api.openapi_schema:return versioned_api.openapi_schemaschema = versioned_api._openapi()if root_path:schema["servers"] = [{"url": root_path}]elif "servers" in schema:del schema["servers"]versioned_api.openapi_schema = schemaif not version_prefix:return schema# We prefer the `/vX/...` be...
6
16
0
97
0
110
132
110
null
[]
None
null
0
0
0
null
0
null
The function (add_version_to_openapi.custom_openapi) defined within the public class called public.The function start at line 110 and ends at 132. It contains 16 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
add_version_to_openapi.overridden_swagger
def overridden_swagger(request: Request):nonlocal root_pathroot_path = request.headers.get("x-forwarded-prefix", "")show_versions = {"latest": f"{root_path}/docs"} | {version: f"{root_path}/{version}/docs"for version, info in versions.items()if not info.retired}menu = generate_version_menu(all_versions=show_versions, s...
3
23
1
143
0
137
160
137
null
[]
None
null
0
0
0
null
0
null
The function (add_version_to_openapi.overridden_swagger) defined within the public class called public.The function start at line 137 and ends at 160. It contains 23 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
add_version_to_openapi.oauth_redirect
async def oauth_redirect(request: Request) -> HTMLResponse:return get_swagger_ui_oauth2_redirect_html()
1
2
1
13
0
164
165
164
null
[]
None
null
0
0
0
null
0
null
The function (add_version_to_openapi.oauth_redirect) defined within the public class called public.The function start at line 164 and ends at 165. 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..
aiondemand_AIOD-rest-api
public
public
0
0
add_version_to_openapi.overridden_redoc
def overridden_redoc(request: Request):nonlocal root_pathroot_path = request.headers.get("x-forwarded-prefix", "")html = get_redoc_html(openapi_url=f"{root_path}{version_prefix}/openapi.json",title="AI-on-Demand REST API",redoc_favicon_url="https://aiod.eu/wp-content/themes/aiod-v2/assets/img/favicon-192x192.png",)retu...
1
9
1
41
0
171
179
171
null
[]
None
null
0
0
0
null
0
null
The function (add_version_to_openapi.overridden_redoc) defined within the public class called public.The function start at line 171 and ends at 179. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
add_version_to_openapi
def add_version_to_openapi(versioned_api: FastAPI):"""Adds the version prefix to all paths in the schema."""if versioned_api.version == "latest":version_prefix = ""else:version_prefix = f"/{versioned_api.version}"# custom_openapi does not have access to the `request` information which# details whether or not the applic...
2
17
1
88
12
92
181
92
versioned_api
['root_path', 'html_response', 'html_str', 'version_prefix', 'schema', 'show_versions', 'menu', 'html', 'paths', 'new_html', 'redirect_url', 'start_of_swagger']
Returns
{"Assign": 20, "Expr": 4, "For": 1, "If": 5, "Return": 6}
17
90
17
["versioned_api._openapi", "copy", "paths.items", "request.headers.get", "versions.items", "generate_version_menu", "get_swagger_ui_html", "html_response.body.decode", "html_str.find", "encode", "HTMLResponse", "versioned_api.get", "get_swagger_ui_oauth2_redirect_html", "versioned_api.add_route", "request.headers.get",...
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.main_py.build_app"]
The function (add_version_to_openapi) defined within the public class called public.The function start at line 92 and ends at 181. It contains 17 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters, and this function return a value. It declares 17.0 functions, It has 17.0 fu...
aiondemand_AIOD-rest-api
public
public
0
0
generate_version_menu
def generate_version_menu(all_versions: dict[str, str], selected: str) -> str:DARK_BLUE = "#0047BB"LIGHT_BLUE = "#41B6E6"button = '<a href={dest} style="background: {bg_color}; color: white; text-decoration: none; font-weight: bold; border-radius: 0.5em; padding: .5em 1em;">{alias}</a>'buttons = []for name, url in all_...
3
16
2
80
6
184
200
184
all_versions,selected
['DARK_BLUE', 'LIGHT_BLUE', 'button', 'menu_div', 'bg_color', 'buttons']
str
{"Assign": 6, "Expr": 1, "For": 1, "Return": 1}
4
17
4
["all_versions.items", "buttons.append", "button.format", "join"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.versioning_py.add_version_to_openapi"]
The function (generate_version_menu) defined within the public class called public.The function start at line 184 and ends at 200. It contains 16 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [184.0] and does not return any value. It declares 4.0 functions, It has 4.0 func...
aiondemand_AIOD-rest-api
VersionedResource
public
0
1
__post_init__
def __post_init__(self):self.resource_class_create = self.resource_class_create or resource_create(self.orm_class)self.resource_class_read = self.resource_class_read or resource_read(self.orm_class)self.create_to_orm = self.create_to_orm or self.orm_class.model_validateself.orm_to_read = self.orm_to_read or self.resour...
5
5
1
59
0
244
248
244
self
[]
None
{"Assign": 4}
2
5
2
["resource_create", "resource_read"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3953269_alisaifee_flask_limiter.flask_limiter._limits_py.RouteLimit.__post_init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.88805393_amisadmin_fastapi_amis_admin.fastapi_amis_admin.admin.extensions.schemas_py....
The function (__post_init__) defined within the public class called VersionedResource, that inherit another class.The function start at line 244 and ends at 248. It contains 5 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 2.0 ...
aiondemand_AIOD-rest-api
public
public
0
0
load_version_metadata._safe_date_parse
def _safe_date_parse(date: str | None) -> datetime | None:if not date:return Nonereturn datetime.strptime(date, "%Y-%m-%d").astimezone(timezone.utc)
2
4
1
35
0
254
257
254
null
[]
None
null
0
0
0
null
0
null
The function (load_version_metadata._safe_date_parse) defined within the public class called public.The function start at line 254 and ends at 257. 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..
aiondemand_AIOD-rest-api
public
public
0
0
load_version_metadata
def load_version_metadata(file_path: Path) -> dict[Version, VersionMetadata]:version_metadata = tomllib.loads(file_path.read_text())def _safe_date_parse(date: str | None) -> datetime | None:if not date:return Nonereturn datetime.strptime(date, "%Y-%m-%d").astimezone(timezone.utc)return {Version(version): VersionMetadat...
2
13
1
97
1
251
268
251
file_path
['version_metadata']
dict[Version, VersionMetadata]
{"Assign": 1, "If": 1, "Return": 3}
13
18
13
["tomllib.loads", "file_path.read_text", "astimezone", "datetime.strptime", "Version", "VersionMetadata", "_safe_date_parse", "metadata.get", "_safe_date_parse", "metadata.get", "metadata.get", "metadata.get", "version_metadata.items"]
0
[]
The function (load_version_metadata) defined within the public class called public.The function start at line 251 and ends at 268. It contains 13 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 13.0 functions, and It has 13.0 f...
aiondemand_AIOD-rest-api
public
public
0
0
schema_transform
def schema_transform(original,# : type[AIoDConcept],name: str,add_fields: dict[str, tuple[type, FieldInfo]] | None = None,update_fields: dict[str, tuple[type, FieldInfo]] | None = None,remove_fields: list[str] | None = None,) -> type[SQLModel]:"""Helper function for generating a modified schema based on `original`.Args...
6
19
5
145
5
275
322
275
original,name,add_fields,update_fields,remove_fields
['fields', 'update_fields', 'new_model', 'add_fields', 'remove_fields']
type[SQLModel]
{"Assign": 5, "Expr": 2, "For": 1, "Return": 1}
3
48
3
["original.__fields__.items", "fields.update", "create_model"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.database.model.project.project_py.project_v3_to_v2"]
The function (schema_transform) defined within the public class called public.The function start at line 275 and ends at 322. It contains 19 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [275.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions...
aiondemand_AIOD-rest-api
VersionedResourceCollection
public
0
1
__init__
def __init__(self, *args, **kwargs):super().__init__(*args, **kwargs)# If a version is not defined, we assume no changes happened.# We still want this version to be accessible for general use,# so we map it to the next available version.versions = list(Version)latest_version = self[Version.LATEST]for version in reverse...
3
9
3
64
0
326
338
326
self,*args,**kwargs
[]
None
{"Assign": 4, "Expr": 1, "For": 1, "If": 1}
4
13
4
["__init__", "super", "list", "reversed"]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called VersionedResourceCollection, that inherit another class.The function start at line 326 and ends at 338. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [326.0] and does not return any value. It decl...