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
aiondemand_AIOD-rest-api
public
public
0
0
test_relations_between_resources
def test_relations_between_resources(client: TestClient,mocked_privileged_token: Mock,body_asset: dict,dataset: Dataset,publication: Publication,organisation: Organisation,auto_publish: None,):with DbSession() as session:session.add(dataset)session.merge(publication)session.merge(organisation)session.commit()session.re...
1
55
7
540
3
376
434
376
client,mocked_privileged_token,body_asset,dataset,publication,organisation,auto_publish
['body', 'identifier', 'response']
None
{"Assign": 9, "Expr": 19, "With": 2}
32
59
32
["DbSession", "session.add", "session.merge", "session.merge", "session.commit", "session.refresh", "client.post", "response.json", "response.json", "assert_relations", "assert_relations", "assert_relations", "client.put", "response.json", "assert_relations", "assert_relations", "assert_relations", "client.put", "respo...
0
[]
The function (test_relations_between_resources) defined within the public class called public.The function start at line 376 and ends at 434. It contains 55 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [376.0] and does not return any value. It declares 32.0 functions, and...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,body_asset: dict,auto_publish: None,):body = copy.deepcopy(body_asset)body["time_required"] = "3 weeks"body["type"] = "presentation"body["pace"] = "self-paced"body["access_mode"] = ["textual", "online course"]body["educational_level"] = ["secondary sc...
1
50
4
347
5
7
59
7
client,mocked_privileged_token,body_asset,auto_publish
['body', 'locations', 'response_json', 'response', 'identifier']
None
{"Assign": 16}
12
53
12
["copy.deepcopy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json", "set", "set", "set", "set", "set"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 7 and ends at 59. It contains 50 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [7.0] and does not return any value. It declares 12.0 functions, and It has 12.0 function...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,body_resource: dict,person: Person,auto_publish: None,):with DbSession() as session:session.add(person)session.commit()session.refresh(person)body = copy.copy(body_resource)body["start_date"] = "2021-02-03T15:15:00"body["end_date"] = "2022-02-03T15:15...
1
50
5
369
5
10
66
10
client,mocked_privileged_token,body_resource,person,auto_publish
['body', 'locations', 'response_json', 'response', 'identifier']
None
{"Assign": 19, "Expr": 3, "With": 1}
13
57
13
["DbSession", "session.add", "session.commit", "session.refresh", "copy.copy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json", "client.put", "response.json"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 10 and ends at 66. It contains 50 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [10.0] and does not return any value. It declares 13.0 functions, and It has 13.0 functi...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,body_asset: dict,auto_publish: None,):body = copy.copy(body_asset)body["pid"] = "https://doi.org/10.1000/182"body["experimental_workflow"] = "Example workflow."body["execution_settings"] = "Example execution settings."body["reproducibility_explanation...
1
44
4
244
5
7
54
7
client,mocked_privileged_token,body_asset,auto_publish
['body', 'response_json', 'response', 'distribution', 'identifier']
None
{"Assign": 11}
7
48
7
["copy.copy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 7 and ends at 54. It contains 44 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [7.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions ...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,experiment: Experiment,body_asset: dict,auto_publish: None,):with DbSession() as session:session.add(experiment)session.commit()session.refresh(experiment)body = copy.copy(body_asset)body["pid"] = "https://doi.org/10.1000/182"body["type"] = "Large Lan...
1
47
5
267
5
10
60
10
client,mocked_privileged_token,experiment,body_asset,auto_publish
['body', 'response_json', 'response', 'distribution', 'identifier']
None
{"Assign": 10, "Expr": 3, "With": 1}
11
51
11
["DbSession", "session.add", "session.commit", "session.refresh", "copy.copy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 10 and ends at 60. It contains 47 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [10.0] and does not return any value. It declares 11.0 functions, and It has 11.0 functi...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,body_resource: dict,auto_publish: None,):body = copy.deepcopy(body_resource)body["headline"] = "A headline to show on top of the page."body["alternative_headline"] = "An alternative headline."body["category"] = ["research: education", "research: award...
1
30
4
189
4
7
39
7
client,mocked_privileged_token,body_resource,auto_publish
['response_json', 'body', 'identifier', 'response']
None
{"Assign": 10}
8
33
8
["copy.deepcopy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json", "set"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 7 and ends at 39. It contains 30 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [7.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functions ...
aiondemand_AIOD-rest-api
public
public
0
0
with_organisation_taxonomies
def with_organisation_taxonomies():with DbSession() as session:synchronize(NumberOfEmployees,[NumberOfEmployees(name=value,definition="", official=True, children=[])for value in ["<10", "<50", "<250", ">=250"]],session)synchronize(Turnover,[Turnover(name=value,definition="", official=True, children=[])for value in STAN...
3
20
0
89
0
21
40
21
[]
None
{"Expr": 4, "With": 1}
6
20
6
["DbSession", "synchronize", "NumberOfEmployees", "synchronize", "Turnover", "session.commit"]
0
[]
The function (with_organisation_taxonomies) defined within the public class called public.The function start at line 21 and ends at 40. 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 6.0 functions, and It has 6....
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,organisation: Organisation,contact: Contact,body_agent: dict,auto_publish: None,with_organisation_taxonomies,):body = copy.copy(body_agent)body["date_founded"] = "2023-01-01"body["legal_name"] = "A name for the organisation"body["ai_relevance"] = "Par...
1
59
7
509
4
43
116
43
client,mocked_privileged_token,organisation,contact,body_agent,auto_publish,with_organisation_taxonomies
['response_json', 'body', 'identifier', 'response']
None
{"Assign": 20, "Expr": 3, "With": 1}
21
74
21
["copy.copy", "DbSession", "session.add", "session.add", "session.commit", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json", "client.put", "response.json", "client.get", "response.json", "client.put", "response.json", "client.get", "response.json", "client.delete", "respon...
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 43 and ends at 116. It contains 59 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [43.0] and does not return any value. It declares 21.0 functions, and It has 21.0 funct...
aiondemand_AIOD-rest-api
public
public
0
0
test_ai_resource_contacts_field_is_ignored
def test_ai_resource_contacts_field_is_ignored(client: TestClient,mocked_privileged_token: Mock,organisation: Organisation,contact: Contact,body_agent: dict,auto_publish: None,):with DbSession() as session:session.add(contact)session.commit()session.refresh(contact)body = copy.copy(body_agent)body["contacts"] = [contac...
1
20
6
147
3
119
140
119
client,mocked_privileged_token,organisation,contact,body_agent,auto_publish
['body', 'identifier', 'response']
None
{"Assign": 5, "Expr": 3, "With": 1}
12
22
12
["DbSession", "session.add", "session.commit", "session.refresh", "copy.copy", "contact.json", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json"]
0
[]
The function (test_ai_resource_contacts_field_is_ignored) defined within the public class called public.The function start at line 119 and ends at 140. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [119.0] and does not return any value. It declares 12.0 func...
aiondemand_AIOD-rest-api
public
public
0
0
test_organisation_post_image
def test_organisation_post_image(client: TestClient,organisation: Organisation,):identifier = register_asset(organisation)fake_image = io.BytesIO(b"\x89PNG\r\n\x1a\n...")# fake PNG bytesfake_image.name = "logo.png"with logged_in_user():response = client.post(f"/organisations/{identifier}/image",params={"name": "logo"},...
1
15
2
91
3
143
160
143
client,organisation
['identifier', 'fake_image', 'response']
None
{"Assign": 4, "With": 1}
5
18
5
["register_asset", "io.BytesIO", "logged_in_user", "client.post", "response.json"]
0
[]
The function (test_organisation_post_image) defined within the public class called public.The function start at line 143 and ends at 160. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [143.0] and does not return any value. It declares 5.0 functions, and It ...
aiondemand_AIOD-rest-api
public
public
0
0
test_organisation_post_image_too_large
def test_organisation_post_image_too_large(client: TestClient,organisation: Organisation):identifier = register_asset(organisation)large_content = b"x" * (1 * 1024 * 1024 + 1)large_image = io.BytesIO(large_content)large_image.name = "big_logo.png"with logged_in_user():response = client.post(f"/organisations/{identifier...
1
17
2
108
4
162
182
162
client,organisation
['large_image', 'large_content', 'identifier', 'response']
None
{"Assign": 5, "With": 1}
5
21
5
["register_asset", "io.BytesIO", "logged_in_user", "client.post", "response.json"]
0
[]
The function (test_organisation_post_image_too_large) defined within the public class called public.The function start at line 162 and ends at 182. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [162.0] and does not return any value. It declares 5.0 functions...
aiondemand_AIOD-rest-api
public
public
0
0
test_organisation_post_image_incorrect_type
def test_organisation_post_image_incorrect_type(client: TestClient, organisation: Organisation):identifier = register_asset(organisation)pdf_data = io.BytesIO(b"%PDF-1.4 test-pdf content")with logged_in_user():response = client.post(f"/organisations/{identifier}/image",params={"name": "wrong_logo_type"},files={"file": ...
1
12
2
91
3
185
199
185
client,organisation
['pdf_data', 'identifier', 'response']
None
{"Assign": 3, "With": 1}
5
15
5
["register_asset", "io.BytesIO", "logged_in_user", "client.post", "response.json"]
0
[]
The function (test_organisation_post_image_incorrect_type) defined within the public class called public.The function start at line 185 and ends at 199. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [185.0] and does not return any value. It declares 5.0 func...
aiondemand_AIOD-rest-api
public
public
0
0
test_organisation_put_image
def test_organisation_put_image(client: TestClient,organisation: Organisation,):identifier = register_asset(organisation)fake_image = io.BytesIO(b"\x89PNG\r\n\x1a\n...")# fake PNG bytesfake_image.name = "logo.png"with logged_in_user():response = client.post(f"/organisations/{identifier}/image",params={"name": "logo"},f...
1
21
2
131
3
202
227
202
client,organisation
['identifier', 'fake_image', 'response']
None
{"Assign": 5, "With": 1}
6
26
6
["register_asset", "io.BytesIO", "logged_in_user", "client.post", "client.put", "response.json"]
0
[]
The function (test_organisation_put_image) defined within the public class called public.The function start at line 202 and ends at 227. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [202.0] and does not return any value. It declares 6.0 functions, and It h...
aiondemand_AIOD-rest-api
public
public
0
0
test_organisation_put_image_non_existent
def test_organisation_put_image_non_existent(client: TestClient,organisation: Organisation,):identifier = register_asset(organisation)fake_image = io.BytesIO(b"\x89PNG\r\n\x1a\n...")# fake PNG bytesfake_image.name = "logo.png"with logged_in_user():response = client.put(f"/organisations/{identifier}/image",params={"name...
1
16
2
96
3
229
248
229
client,organisation
['identifier', 'fake_image', 'response']
None
{"Assign": 4, "With": 1}
5
20
5
["register_asset", "io.BytesIO", "logged_in_user", "client.put", "response.json"]
0
[]
The function (test_organisation_put_image_non_existent) defined within the public class called public.The function start at line 229 and ends at 248. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [229.0] and does not return any value. It declares 5.0 functio...
aiondemand_AIOD-rest-api
public
public
0
0
test_organisation_get_with_and_without_image
def test_organisation_get_with_and_without_image(client: TestClient, organisation: Organisation, get_image: bool):identifier = register_asset(organisation)fake_image = io.BytesIO(b"\x89PNG\r\n\x1a\n...")# fake PNG bytesfake_image.name = "logo.png"with logged_in_user():response = client.post(f"/organisations/{identifier...
2
21
3
174
3
252
280
252
client,organisation,get_image
['identifier', 'fake_image', 'response']
None
{"Assign": 6, "If": 1, "With": 1}
11
29
11
["register_asset", "io.BytesIO", "logged_in_user", "client.post", "response.json", "client.get", "lower", "str", "response.json", "get", "pytest.mark.parametrize"]
0
[]
The function (test_organisation_get_with_and_without_image) defined within the public class called public.The function start at line 252 and ends at 280. It contains 21 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [252.0] and does not return any value. It declares 11.0 fu...
aiondemand_AIOD-rest-api
public
public
0
0
test_organisation_get_image
def test_organisation_get_image(client: TestClient,organisation: Organisation):identifier = register_asset(organisation)fake_image = io.BytesIO(b"\x89PNG\r\n\x1a\n...")with logged_in_user():response = client.post(f"/organisations/{identifier}/image",params={"name": "logo"},files={"file": ("logo.png", fake_image, "image...
1
21
2
123
3
283
308
283
client,organisation
['identifier', 'fake_image', 'response']
None
{"Assign": 5, "With": 1}
6
26
6
["register_asset", "io.BytesIO", "logged_in_user", "client.post", "client.get", "response.json"]
0
[]
The function (test_organisation_get_image) defined within the public class called public.The function start at line 283 and ends at 308. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [283.0] and does not return any value. It declares 6.0 functions, and It h...
aiondemand_AIOD-rest-api
public
public
0
0
test_organisation_get_image_non_existent
def test_organisation_get_image_non_existent(client: TestClient,organisation: Organisation,):identifier = register_asset(organisation)response = client.get(f"/organisations/{identifier}/image")assert response.status_code == HTTPStatus.OKassert response.json() == []
1
10
2
44
2
311
321
311
client,organisation
['identifier', 'response']
None
{"Assign": 2}
3
11
3
["register_asset", "client.get", "response.json"]
0
[]
The function (test_organisation_get_image_non_existent) defined within the public class called public.The function start at line 311 and ends at 321. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [311.0] and does not return any value. It declares 3.0 functio...
aiondemand_AIOD-rest-api
public
public
0
0
test_organisation_delete_image
def test_organisation_delete_image(client: TestClient,organisation: Organisation):identifier = register_asset(organisation)fake_image = io.BytesIO(b"\x89PNG\r\n\x1a\n...")with logged_in_user():response = client.post(f"/organisations/{identifier}/image",params={"name": "logo"},files={"file": ("logo.png", fake_image, "im...
1
26
2
150
4
324
353
324
client,organisation
['second_delete_response', 'identifier', 'fake_image', 'response']
None
{"Assign": 5, "With": 1}
7
30
7
["register_asset", "io.BytesIO", "logged_in_user", "client.post", "client.delete", "client.delete", "second_delete_response.json"]
0
[]
The function (test_organisation_delete_image) defined within the public class called public.The function start at line 324 and ends at 353. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [324.0] and does not return any value. It declares 7.0 functions, and I...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,body_agent: dict,person: Person,contact: Contact,organisation: Organisation,auto_publish: None,):body = copy.copy(body_agent)body["expertise"] = ["machine learning"]body["languages"] = ["eng", "nld"]body["price_per_hour_euro"] = 10.50body["wants_to_be...
1
38
7
288
4
16
60
16
client,mocked_privileged_token,body_agent,person,contact,organisation,auto_publish
['response_json', 'body', 'identifier', 'response']
None
{"Assign": 11, "Expr": 4, "With": 1}
14
45
14
["copy.copy", "DbSession", "session.add", "session.add", "session.merge", "session.commit", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json", "set", "set"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 16 and ends at 60. It contains 38 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [16.0] and does not return any value. It declares 14.0 functions, and It has 14.0 functi...
aiondemand_AIOD-rest-api
public
public
0
0
test_privacy_for_ai4europe_cms
def test_privacy_for_ai4europe_cms(client: TestClient,mocked_privileged_token: Mock,overwrites_keycloak_token: None,# Technically already used by privileged token, but we also overwrite explicitly# noqa: E501platform: Platform,person: Person,contact: Contact,endpoint: str,auto_publish: None,):"""Test to ensure that onl...
5
40
8
255
4
72
119
72
client,mocked_privileged_token,overwrites_keycloak_token,platform,person,contact,endpoint,auto_publish
['headers', 'response_json', 'endpoint', 'response']
None
{"Assign": 14, "Expr": 6, "For": 2, "With": 1}
14
48
14
["DbSession", "session.add", "session.add", "session.commit", "session.refresh", "session.refresh", "endpoint.replace", "client.get", "response.json", "isinstance", "client.get", "response.json", "isinstance", "pytest.mark.parametrize"]
0
[]
The function (test_privacy_for_ai4europe_cms) defined within the public class called public.The function start at line 72 and ends at 119. It contains 40 lines of code and it has a cyclomatic complexity of 5. It takes 8 parameters, represented as [72.0] and does not return any value. It declares 14.0 functions, and It...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(mocked_token: Mock, client: TestClient, auto_publish: None):body = {"name": "my_favourite_platform"}response = client.post("/platforms", json=body, headers={"Authorization": "Fake token"})assert response.status_code == 200, response.json()response = client.get("/platforms")assert response.status_cod...
3
8
3
109
3
12
19
12
mocked_token,client,auto_publish
['platforms', 'body', 'response']
None
{"Assign": 4}
7
8
7
["client.post", "response.json", "client.get", "response.json", "response.json", "union", "pytest.mark.parametrize"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 12 and ends at 19. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [12.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions...
aiondemand_AIOD-rest-api
public
public
0
0
test_get_platform_of_platform
def test_get_platform_of_platform(client: TestClient, url: str):response = client.get(url)assert response.status_code == 404, response.json()assert response.json()["detail"] == "Not Found"
1
4
2
42
1
25
28
25
client,url
['response']
None
{"Assign": 1}
4
4
4
["client.get", "response.json", "response.json", "pytest.mark.parametrize"]
0
[]
The function (test_get_platform_of_platform) defined within the public class called public.The function start at line 25 and ends at 28. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [25.0] and does not return any value. It declares 4.0 functions, and It has...
aiondemand_AIOD-rest-api
public
public
0
0
test_delete_platform
def test_delete_platform(client: TestClient, mocked_token: Mock):body = {"name": "my_favourite_platform"}response = client.post("/platforms", json=body, headers={"Authorization": "Fake token"})assert response.status_code == 200, response.json()id_ = response.json()["identifier"]response = client.delete(f"/platforms/{id...
1
9
2
121
3
34
42
34
client,mocked_token
['body', 'id_', 'response']
None
{"Assign": 5}
8
9
8
["client.post", "response.json", "response.json", "client.delete", "response.json", "client.post", "response.json", "pytest.mark.parametrize"]
0
[]
The function (test_delete_platform) defined within the public class called public.The function start at line 34 and ends at 42. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [34.0] and does not return any value. It declares 8.0 functions, and It has 8.0 func...
aiondemand_AIOD-rest-api
public
public
0
0
test_platform_same_name
def test_platform_same_name(client: TestClient, mocked_token: Mock):body = {"name": "my_favourite_platform"}response = client.post("/platforms", json=body, headers={"Authorization": "Fake token"})assert response.status_code == 200, response.json()response = client.post("/platforms", json=body, headers={"Authorization":...
1
7
2
93
2
48
54
48
client,mocked_token
['body', 'response']
None
{"Assign": 3}
6
7
6
["client.post", "response.json", "client.post", "response.json", "response.json", "pytest.mark.parametrize"]
0
[]
The function (test_platform_same_name) defined within the public class called public.The function start at line 48 and ends at 54. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [48.0] and does not return any value. It declares 6.0 functions, and It has 6.0 f...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,body_resource: dict,person: Person,organisation: Organisation,publication: Publication,dataset: Dataset,auto_publish: None,):with DbSession() as session:session.add(person)session.merge(organisation)session.merge(dataset)session.merge(publication)sess...
1
47
8
367
4
16
68
16
client,mocked_privileged_token,body_resource,person,organisation,publication,dataset,auto_publish
['response_json', 'body', 'identifier', 'response']
None
{"Assign": 19, "Expr": 6, "With": 1}
16
53
16
["DbSession", "session.add", "session.merge", "session.merge", "session.merge", "session.commit", "session.refresh", "copy.deepcopy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json", "client.put", "response.json"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 16 and ends at 68. It contains 47 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [16.0] and does not return any value. It declares 16.0 functions, and It has 16.0 functi...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path_v2_total_cost_euros
def test_happy_path_v2_total_cost_euros(client: TestClient,field_alias: str,body_resource: dict,auto_publish: None,):body = copy.deepcopy(body_resource)body[field_alias] = 10000000.53with logged_in_user():response = client.post("/projects", json=body, headers={"Authorization": "Fake token"})assert response.status_code ...
1
17
4
129
4
75
94
75
client,field_alias,body_resource,auto_publish
['response_json', 'body', 'identifier', 'response']
None
{"Assign": 6, "With": 1}
10
20
10
["copy.deepcopy", "logged_in_user", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json", "pytest.mark.versions", "pytest.mark.parametrize"]
0
[]
The function (test_happy_path_v2_total_cost_euros) defined within the public class called public.The function start at line 75 and ends at 94. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [75.0] and does not return any value. It declares 10.0 functions, and...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,body_asset: dict,dataset: Dataset,auto_publish: None,):body = copy.copy(body_asset)body["permanent_identifier"] = "http://dx.doi.org/10.1093/ajae/aaq063"body["isbn"] = "9783161484100"body["issn"] = "20493630"body["type"] = "journal"body["content"] = {...
1
24
5
175
4
9
35
9
client,mocked_privileged_token,body_asset,dataset,auto_publish
['response_json', 'body', 'identifier', 'response']
None
{"Assign": 10}
7
27
7
["copy.copy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 9 and ends at 35. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [9.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions ...
aiondemand_AIOD-rest-api
public
public
0
0
test_resource_bundle_api
def test_resource_bundle_api(client: TestClient,mocked_privileged_token: Mock,body_asset: dict,auto_publish: None,):"""Test creating and retrieving a ResourceBundle through the API."""resource_1 = AIResourceORM(name="AI Resource 1")resource_2 = AIResourceORM(name="AI Resource 2")with DbSession() as session:session.add(...
1
27
4
213
6
9
46
9
client,mocked_privileged_token,body_asset,auto_publish
['resource_1', 'resource_2', 'body', 'response_json', 'response', 'identifier']
None
{"Assign": 10, "Expr": 6, "With": 1}
16
38
16
["AIResourceORM", "AIResourceORM", "DbSession", "session.add", "session.add", "session.commit", "session.refresh", "session.refresh", "copy.copy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json", "set"]
0
[]
The function (test_resource_bundle_api) defined within the public class called public.The function start at line 9 and ends at 46. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [9.0] and does not return any value. It declares 16.0 functions, and It has 16.0...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,body_resource: dict,auto_publish: None,):body = copy.copy(body_resource)body["slogan"] = "Smart Blockchains for everyone!"body["terms_of_service"] = "Some text here"response = client.post("/services", json=body, headers={"Authorization": "Fake token"}...
1
19
4
138
4
7
28
7
client,mocked_privileged_token,body_resource,auto_publish
['response_json', 'body', 'identifier', 'response']
None
{"Assign": 7}
7
22
7
["copy.copy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 7 and ends at 28. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [7.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions ...
aiondemand_AIOD-rest-api
public
public
0
0
test_happy_path
def test_happy_path(client: TestClient,mocked_privileged_token: Mock,body_resource: dict,person: Person,organisation: Organisation,auto_publish: None,):with DbSession() as session:session.add(person)session.merge(organisation)session.commit()session.refresh(person)body = copy.deepcopy(body_resource)body["price_per_hour...
1
28
6
204
4
11
42
11
client,mocked_privileged_token,body_resource,person,organisation,auto_publish
['response_json', 'body', 'identifier', 'response']
None
{"Assign": 9, "Expr": 4, "With": 1}
12
32
12
["DbSession", "session.add", "session.merge", "session.commit", "session.refresh", "copy.deepcopy", "client.post", "response.json", "response.json", "client.get", "response.json", "response.json"]
0
[]
The function (test_happy_path) defined within the public class called public.The function start at line 11 and ends at 42. It contains 28 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [11.0] and does not return any value. It declares 12.0 functions, and It has 12.0 functi...
aiondemand_AIOD-rest-api
public
public
0
0
test_search_happy_path
def test_search_happy_path(client: TestClient, search_router):mock_elasticsearch(filename_mock=f"{search_router.es_index}_search.json")search_service = f"/search/{search_router.resource_name_plural}"params = {"search_query": "description", "get_all": False}response = client.get(search_service, params=params)assert resp...
2
18
2
164
6
17
38
17
client,search_router
['resource', 'search_service', 'global_fields', 'extra_fields', 'response', 'params']
None
{"Assign": 6, "Expr": 1, "For": 1}
7
22
7
["mock_elasticsearch", "client.get", "response.json", "response.json", "startswith", "list", "pytest.mark.parametrize"]
0
[]
The function (test_search_happy_path) defined within the public class called public.The function start at line 17 and ends at 38. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [17.0] and does not return any value. It declares 7.0 functions, and It has 7.0 f...
aiondemand_AIOD-rest-api
public
public
0
0
test_search_happy_path_get_all
def test_search_happy_path_get_all(client: TestClient, mocked_privileged_token: Mock):body = {"name": "A name.", "keyword": ["keyword1", "keyword2"]}# keywords not indexed by ESresponse = client.post("/events", json=body, headers={"Authorization": "Fake token"})response.raise_for_status()identifier = response.json()['i...
1
15
2
160
6
41
63
41
client,mocked_privileged_token
['resource', 'body', 'search_service', 'response', 'params', 'identifier']
None
{"Assign": 7, "Expr": 2}
8
23
8
["client.post", "response.raise_for_status", "response.json", "mock_elasticsearch", "client.get", "response.json", "response.json", "set"]
0
[]
The function (test_search_happy_path_get_all) defined within the public class called public.The function start at line 41 and ends at 63. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [41.0] and does not return any value. It declares 8.0 functions, and It h...
aiondemand_AIOD-rest-api
public
public
0
0
test_search_get_all_not_found_in_db
def test_search_get_all_not_found_in_db(client: TestClient):mock_elasticsearch(filename_mock="event_search.json")search_service = "/search/events"params = {"search_query": "description", "get_all": True}response = client.get(search_service, params=params)assert response.status_code == HTTPStatus.NOT_FOUND, response.jso...
1
10
1
66
3
66
77
66
client
['params', 'search_service', 'response']
None
{"Assign": 3, "Expr": 1}
4
12
4
["mock_elasticsearch", "client.get", "response.json", "response.json"]
0
[]
The function (test_search_get_all_not_found_in_db) defined within the public class called public.The function start at line 66 and ends at 77. 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...
aiondemand_AIOD-rest-api
public
public
0
0
test_search_bad_platform
def test_search_bad_platform(client: TestClient, search_router):"""Tests the search router bad platform error"""mock_elasticsearch(filename_mock=f"{search_router.es_index}_search.json")search_service = f"/search/{search_router.resource_name_plural}"params = {"search_query": "description", "platforms": ["bad_platform"]}...
1
8
2
81
4
81
91
81
client,search_router
['err_msg', 'params', 'search_service', 'response']
None
{"Assign": 4, "Expr": 2}
6
11
6
["mock_elasticsearch", "client.get", "response.json", "response.json", "len", "pytest.mark.parametrize"]
0
[]
The function (test_search_bad_platform) defined within the public class called public.The function start at line 81 and ends at 91. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [81.0] and does not return any value. It declares 6.0 functions, and It has 6.0 ...
aiondemand_AIOD-rest-api
public
public
0
0
test_search_bad_fields
def test_search_bad_fields(client: TestClient, search_router):"""Tests the search router bad fields error"""mock_elasticsearch(filename_mock=f"{search_router.es_index}_search.json")search_service = f"/search/{search_router.resource_name_plural}"params = {"search_query": "description", "search_fields": ["bad_field"]}res...
1
7
2
80
3
95
105
95
client,search_router
['params', 'search_service', 'response']
None
{"Assign": 3, "Expr": 2}
6
11
6
["mock_elasticsearch", "client.get", "response.json", "startswith", "response.json", "pytest.mark.parametrize"]
0
[]
The function (test_search_bad_fields) defined within the public class called public.The function start at line 95 and ends at 105. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [95.0] and does not return any value. It declares 6.0 functions, and It has 6.0 f...
aiondemand_AIOD-rest-api
public
public
0
0
test_search_bad_limit
def test_search_bad_limit(client: TestClient, search_router):"""Tests the search router bad fields error"""mock_elasticsearch(filename_mock=f"{search_router.es_index}_search.json")search_service = f"/search/{search_router.resource_name_plural}"params = {"search_query": "description", "limit": 1001}response = client.get...
1
14
2
96
3
109
125
109
client,search_router
['params', 'search_service', 'response']
None
{"Assign": 3, "Expr": 2}
5
17
5
["mock_elasticsearch", "client.get", "response.json", "response.json", "pytest.mark.parametrize"]
0
[]
The function (test_search_bad_limit) defined within the public class called public.The function start at line 109 and ends at 125. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [109.0] and does not return any value. It declares 5.0 functions, and It has 5.0...
aiondemand_AIOD-rest-api
public
public
0
0
test_search_bad_offset
def test_search_bad_offset(client: TestClient, search_router):"""Tests the search router bad fields error"""mock_elasticsearch(filename_mock=f"{search_router.es_index}_search.json")search_service = f"/search/{search_router.resource_name_plural}"params = {"search_query": "description", "offset": -1}response = client.get...
1
14
2
97
3
129
145
129
client,search_router
['params', 'search_service', 'response']
None
{"Assign": 3, "Expr": 2}
5
17
5
["mock_elasticsearch", "client.get", "response.json", "response.json", "pytest.mark.parametrize"]
0
[]
The function (test_search_bad_offset) defined within the public class called public.The function start at line 129 and ends at 145. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [129.0] and does not return any value. It declares 5.0 functions, and It has 5....
aiondemand_AIOD-rest-api
public
public
0
0
mock_elasticsearch
def mock_elasticsearch(filename_mock: str, identifier: str = ""):with open(path_test_resources() / "elasticsearch" / filename_mock, "r") as f:mocked_results = json.load(f)if identifier:mocked_results["hits"]["hits"][0]["_source"]["identifier"] = identifiermocked_elasticsearch = Elasticsearch("https://example.com:9200")...
2
8
2
82
2
148
157
148
filename_mock,identifier
['mocked_elasticsearch', 'mocked_results']
None
{"Assign": 4, "Expr": 1, "If": 1, "With": 1}
7
10
7
["open", "path_test_resources", "json.load", "Elasticsearch", "Mock", "patch", "ElasticsearchSingleton"]
7
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.routers.search_routers.test_search_routers_py.test_search_bad_fields", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.routers.se...
The function (mock_elasticsearch) defined within the public class called public.The function start at line 148 and ends at 157. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [148.0] and does not return any value. It declares 7.0 functions, It has 7.0 function...
aiondemand_AIOD-rest-api
public
public
0
0
load_body_concept
def load_body_concept() -> dict:with open(path_test_resources() / "schemes" / "aiod" / "aiod_concept.json", "r") as f:return json.load(f)
1
3
0
31
0
30
32
30
[]
dict
{"Return": 1, "With": 1}
4
3
4
["open", "path_test_resources", "json.load", "pytest.fixture"]
0
[]
The function (load_body_concept) defined within the public class called public.The function start at line 30 and ends at 32. 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, and It has 4.0 functions ...
aiondemand_AIOD-rest-api
public
public
0
0
body_concept
def body_concept(load_body_concept: dict) -> dict:return copy.deepcopy(load_body_concept)
1
2
1
16
0
36
37
36
load_body_concept
[]
dict
{"Return": 1}
2
2
2
["copy.deepcopy", "pytest.fixture"]
0
[]
The function (body_concept) defined within the public class called public.The function start at line 36 and ends at 37. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions calle...
aiondemand_AIOD-rest-api
public
public
0
0
load_body_resource
def load_body_resource() -> dict:with open(path_test_resources() / "schemes" / "aiod" / "ai_resource.json", "r") as f:return json.load(f)
1
3
0
31
0
41
43
41
[]
dict
{"Return": 1, "With": 1}
4
3
4
["open", "path_test_resources", "json.load", "pytest.fixture"]
0
[]
The function (load_body_resource) defined within the public class called public.The function start at line 41 and ends at 43. 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, and It has 4.0 functions...
aiondemand_AIOD-rest-api
public
public
0
0
body_resource
def body_resource(body_concept: dict, load_body_resource: dict) -> dict:body = copy.deepcopy(body_concept)body.update(load_body_resource)return copy.deepcopy(body)
1
4
2
34
1
47
50
47
body_concept,load_body_resource
['body']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
4
4
4
["copy.deepcopy", "body.update", "copy.deepcopy", "pytest.fixture"]
0
[]
The function (body_resource) defined within the public class called public.The function start at line 47 and ends at 50. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [47.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions c...
aiondemand_AIOD-rest-api
public
public
0
0
load_body_asset
def load_body_asset() -> dict:with open(path_test_resources() / "schemes" / "aiod" / "ai_asset.json", "r") as f:return json.load(f)
1
3
0
31
0
54
56
54
[]
dict
{"Return": 1, "With": 1}
4
3
4
["open", "path_test_resources", "json.load", "pytest.fixture"]
0
[]
The function (load_body_asset) defined within the public class called public.The function start at line 54 and ends at 56. 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, and It has 4.0 functions ca...
aiondemand_AIOD-rest-api
public
public
0
0
body_asset
def body_asset(body_resource: dict, load_body_asset: dict) -> dict:body = copy.deepcopy(body_resource)body.update(load_body_asset)return copy.deepcopy(body)
1
4
2
34
1
60
63
60
body_resource,load_body_asset
['body']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
4
4
4
["copy.deepcopy", "body.update", "copy.deepcopy", "pytest.fixture"]
0
[]
The function (body_asset) defined within the public class called public.The function start at line 60 and ends at 63. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [60.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions call...
aiondemand_AIOD-rest-api
public
public
0
0
load_body_agent
def load_body_agent() -> dict:with open(path_test_resources() / "schemes" / "aiod" / "agent.json", "r") as f:return json.load(f)
1
3
0
31
0
67
69
67
[]
dict
{"Return": 1, "With": 1}
4
3
4
["open", "path_test_resources", "json.load", "pytest.fixture"]
0
[]
The function (load_body_agent) defined within the public class called public.The function start at line 67 and ends at 69. 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, and It has 4.0 functions ca...
aiondemand_AIOD-rest-api
public
public
0
0
body_agent
def body_agent(body_resource: dict, load_body_agent: dict) -> dict:body = copy.deepcopy(body_resource)body.update(load_body_agent)return copy.deepcopy(body)
1
4
2
34
1
73
76
73
body_resource,load_body_agent
['body']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
4
4
4
["copy.deepcopy", "body.update", "copy.deepcopy", "pytest.fixture"]
0
[]
The function (body_agent) defined within the public class called public.The function start at line 73 and ends at 76. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [73.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions call...
aiondemand_AIOD-rest-api
public
public
0
0
make_publication
def make_publication(body_asset: dict, with_random_platform_identifier: bool = False) -> Publication:body = copy.deepcopy(body_asset)body["permanent_identifier"] = "http://dx.doi.org/10.1093/ajae/aaq063"body["isbn"] = "9783161484100"body["issn"] = "20493630"body["type"] = "journal"return _create_class_with_body(Publica...
1
7
2
54
1
79
85
79
body_asset,with_random_platform_identifier
['body']
Publication
{"Assign": 5, "Return": 1}
2
7
2
["copy.deepcopy", "_create_class_with_body"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.testutils.default_instances_py.publication"]
The function (make_publication) defined within the public class called public.The function start at line 79 and ends at 85. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [79.0] and does not return any value. It declares 2.0 functions, It has 2.0 functions cal...
aiondemand_AIOD-rest-api
public
public
0
0
publication
def publication(body_asset: dict) -> Publication:return make_publication(body_asset)
1
2
1
14
0
89
90
89
body_asset
[]
Publication
{"Return": 1}
1
2
1
["make_publication"]
0
[]
The function (publication) defined within the public class called public.The function start at line 89 and ends at 90. 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 in...
aiondemand_AIOD-rest-api
public
public
0
0
publication_factory
def publication_factory(body_asset: dict) -> Callable[[], Publication]:return partial(make_publication, body_asset, with_random_platform_identifier=True)
1
2
1
26
0
94
95
94
body_asset
[]
Callable[[], Publication]
{"Return": 1}
1
2
1
["partial"]
10
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.authorization.test_authorization_py.test_retrieving_single_submission_works", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.aut...
The function (publication_factory) defined within the public class called public.The function start at line 94 and ends at 95. 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...
aiondemand_AIOD-rest-api
public
public
0
0
contact
def contact(body_concept, engine: Engine) -> Contact:body = copy.deepcopy(body_concept)body["email"] = ["a@b.com"]body["name"] = "Aaron Bar"body["telephone"] = ["0032 XXXX XXXX"]body["location"] = [{"address": {"country": "Spain", "street": "Street Name 10", "postal_code": "1234AB"},"geo": {"latitude": 37.42242, "longi...
1
12
2
94
1
99
110
99
body_concept,engine
['body']
Contact
{"Assign": 5, "Return": 1}
2
12
2
["copy.deepcopy", "_create_class_with_body"]
0
[]
The function (contact) defined within the public class called public.The function start at line 99 and ends at 110. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [99.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions calle...
aiondemand_AIOD-rest-api
public
public
0
0
dataset
def dataset(body_asset: dict) -> Dataset:body = copy.deepcopy(body_asset)body["issn"] = "20493630"body["measurement_technique"] = "mass spectrometry"body["temporal_coverage"] = "2011/2012"return _create_class_with_body(Dataset, body)
1
6
1
42
1
114
119
114
body_asset
['body']
Dataset
{"Assign": 4, "Return": 1}
2
6
2
["copy.deepcopy", "_create_class_with_body"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3665918_alvinwan_neural_backed_decision_trees.nbdt.data.custom_py.get_exclude_labels_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3665918_alvinwan_neural_backed_decision_trees.nbdt.data.custom_py.get_incl...
The function (dataset) defined within the public class called public.The function start at line 114 and ends at 119. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions called inside...
aiondemand_AIOD-rest-api
public
public
0
0
organisation
def organisation(body_agent: dict) -> Organisation:body = copy.deepcopy(body_agent)body["date_founded"] = "2022-01-01"body["legal_name"] = "Legal Name"body["ai_relevance"] = "Description of relevance in AI"return _create_class_with_body(Organisation, body)
1
6
1
42
1
123
128
123
body_agent
['body']
Organisation
{"Assign": 4, "Return": 1}
2
6
2
["copy.deepcopy", "_create_class_with_body"]
0
[]
The function (organisation) defined within the public class called public.The function start at line 123 and ends at 128. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions cal...
aiondemand_AIOD-rest-api
public
public
0
0
person
def person(body_agent: dict) -> Person:body = copy.deepcopy(body_agent)body["expertise"] = ["machine learning"]body["language"] = ["eng", "nld"]return _create_class_with_body(Person, body)
1
5
1
42
1
132
136
132
body_agent
['body']
Person
{"Assign": 3, "Return": 1}
2
5
2
["copy.deepcopy", "_create_class_with_body"]
12
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3573634_xray7224_pypump.pypump.models.__init___py.Addressable._serialize_people", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3658006_betterrules_openfisca_aotearoa.openfisca_aotearoa.variables.acts.income_tax.ind...
The function (person) defined within the public class called public.The function start at line 132 and ends at 136. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions called inside ...
aiondemand_AIOD-rest-api
public
public
0
0
experiment
def experiment(body_asset: dict) -> Experiment:return _create_class_with_body(Experiment, body_asset)
1
2
1
16
0
140
141
140
body_asset
[]
Experiment
{"Return": 1}
1
2
1
["_create_class_with_body"]
0
[]
The function (experiment) defined within the public class called public.The function start at line 140 and ends at 141. 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 i...
aiondemand_AIOD-rest-api
public
public
0
0
platform
def platform() -> Platform:body = {"name": "aiod"}return _create_class_with_body(Platform, body)
1
3
0
20
1
145
147
145
['body']
Platform
{"Assign": 1, "Return": 1}
1
3
1
["_create_class_with_body"]
0
[]
The function (platform) defined within the public class called public.The function start at line 145 and ends at 147. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 function called ins...
aiondemand_AIOD-rest-api
public
public
0
0
_create_class_with_body
def _create_class_with_body(clz, body: dict):pydantic_class = resource_create(clz)res_create = pydantic_class(**body)res = clz.from_orm(res_create)with DbSession() as session:deserialize_resource_relationships(session, clz, res, res_create, user=None)session.commit()if hasattr(res, "ai_resource"):res.ai_resource.type =...
2
10
2
75
3
150
159
150
clz,body
['pydantic_class', 'res', 'res_create']
Returns
{"Assign": 4, "Expr": 2, "If": 1, "Return": 1, "With": 1}
7
10
7
["resource_create", "pydantic_class", "clz.from_orm", "DbSession", "deserialize_resource_relationships", "session.commit", "hasattr"]
8
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.routers.resource_routers.test_router_contact_py.contact2", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.testutils.default_inst...
The function (_create_class_with_body) defined within the public class called public.The function start at line 150 and ends at 159. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [150.0], and this function return a value. It declares 7.0 functions, It has 7....
aiondemand_AIOD-rest-api
public
public
0
0
engine
def engine() -> Iterator[Engine]:"""Create a SqlAlchemy engine for tests, backed by a temporary sqlite file."""temporary_file = tempfile.NamedTemporaryFile()engine = create_engine(f"sqlite:///{temporary_file.name}?check_same_thread=False")AIoDConcept.metadata.create_all(engine)with Session(engine) as session:for trigge...
3
11
0
80
2
100
115
100
['temporary_file', 'engine']
Iterator[Engine]
{"Assign": 2, "Expr": 6, "For": 2, "With": 1}
11
16
11
["tempfile.NamedTemporaryFile", "create_engine", "AIoDConcept.metadata.create_all", "Session", "create_delete_triggers", "session.execute", "create_identifier_synchronization_triggers", "session.execute", "patch", "EngineSingleton", "pytest.fixture"]
0
[]
The function (engine) defined within the public class called public.The function start at line 100 and ends at 115. 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 11.0 functions, and It has 11.0 functions called...
aiondemand_AIOD-rest-api
public
public
0
0
engine_test_resource_filled
def engine_test_resource_filled(engine: Engine) -> Iterator[str]:"""Engine will be filled with an example value after before each test, in clear_db."""yield DEFAULT_TEST_RESOURCE_IDENTIFIER
1
2
1
15
0
119
123
119
engine
[]
Iterator[str]
{"Expr": 2}
0
5
0
[]
0
[]
The function (engine_test_resource_filled) defined within the public class called public.The function start at line 119 and ends at 123. 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
clear_db
def clear_db(request, engine: Engine):"""This fixture will be used by every test and checks if the test uses an engine.If it does, it deletes the content of the database, so the test has a fresh db to work with."""with Session(engine) as session:if session.scalars(select(Platform)).first():pytest.exit("A previous test ...
10
41
2
288
2
127
173
127
request,engine
['transaction', 'test_resource']
None
{"Assign": 3, "Expr": 12, "For": 3, "If": 2, "Try": 1, "With": 3}
25
47
25
["Session", "first", "session.scalars", "select", "pytest.exit", "Session", "session.add_all", "Platform", "any", "factory_test_resource", "session.add", "session.commit", "bypass_reviewer_publish_everything", "session.add", "taxonomy", "term._asdict", "session.commit", "engine.connect", "connection.begin", "reversed",...
0
[]
The function (clear_db) defined within the public class called public.The function start at line 127 and ends at 173. It contains 41 lines of code and it has a cyclomatic complexity of 10. It takes 2 parameters, represented as [127.0] and does not return any value. It declares 25.0 functions, and It has 25.0 functions...
aiondemand_AIOD-rest-api
public
public
0
0
sqlite_enable_foreign_key_constraints
def sqlite_enable_foreign_key_constraints(dbapi_connection, connection_record):"""On default, sqlite disables foreign key constraints"""if isinstance(dbapi_connection, sqlite3.Connection):cursor = dbapi_connection.cursor()cursor.execute("PRAGMA foreign_keys=ON")cursor.close()
2
5
2
36
1
177
184
177
dbapi_connection,connection_record
['cursor']
None
{"Assign": 1, "Expr": 3, "If": 1}
5
8
5
["isinstance", "dbapi_connection.cursor", "cursor.execute", "cursor.close", "event.listens_for"]
0
[]
The function (sqlite_enable_foreign_key_constraints) defined within the public class called public.The function start at line 177 and ends at 184. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [177.0] and does not return any value. It declares 5.0 functions, ...
aiondemand_AIOD-rest-api
public
public
0
0
client
def client(request, engine: Engine) -> TestClient:"""Create a TestClient that can be used to mock sending requests to our application"""app = build_app(version="unittest")client = TestClient(app,base_url=f"http://localhost{request.param.prefix}/",# param is Version)client.version = request.paramyield client
1
8
2
41
2
188
198
188
request,engine
['client', 'app']
TestClient
{"Assign": 3, "Expr": 2}
3
11
3
["build_app", "TestClient", "pytest.fixture"]
82
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3587106_thriftpy_thriftpy.tests.test_http_py.test_client_timeout", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3587106_thriftpy_thriftpy.tests.test_http_py.test_complex_tstruct", "_.content.gdrive.MyDrive.Phd_Thes...
The function (client) defined within the public class called public.The function start at line 188 and ends at 198. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [188.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions called ins...
aiondemand_AIOD-rest-api
public
public
0
0
auto_publish
def auto_publish(engine: Engine):"""Automatically sets *all* new insertions to the aiod_entry table as published.This can be useful to bypass the reviewing workflow, as otherwise assets that werejust uploaded also require authenticated requests as they would be in a privateDRAFT status."""trigger_name = "publish_on_ins...
1
8
1
48
1
203
225
203
engine
['trigger_name']
None
{"Assign": 1, "Expr": 4, "With": 2}
8
23
8
["Session", "session.execute", "text", "EntryStatus.PUBLISHED.upper", "Session", "session.execute", "text", "pytest.fixture"]
0
[]
The function (auto_publish) defined within the public class called public.The function start at line 203 and ends at 225. 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 8.0 functions, and It has 8.0 functions cal...
aiondemand_AIOD-rest-api
public
public
0
0
client_test_resource
def client_test_resource(engine: Engine) -> TestClient:"""A Startlette TestClient including routes to the TestResource, only in "aiod" schema"""app = FastAPI()app.include_router(RouterTestResource().create(""))return TestClient(app, base_url="http://localhost")
1
4
1
37
1
229
233
229
engine
['app']
TestClient
{"Assign": 1, "Expr": 2, "Return": 1}
6
5
6
["FastAPI", "app.include_router", "create", "RouterTestResource", "TestClient", "pytest.fixture"]
0
[]
The function (client_test_resource) defined within the public class called public.The function start at line 229 and ends at 233. 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 6.0 functions, and It has 6.0 funct...
aiondemand_AIOD-rest-api
public
public
0
0
_user_with_roles
def _user_with_roles(*roles: str) -> dict[str, Any]:return {"realm_access": {"roles": roles},"resource_access": {"account": {"roles": ["manage-account", "manage-account-links", "view-profile"]}},"scope": "openid profile email","username": "user","token_type": "Bearer","active": True,"sub": "default0-fake-test-only-0000...
1
12
1
64
0
236
247
236
*roles
[]
dict[str, Any]
{"Return": 1}
0
12
0
[]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.testutils.default_sqlalchemy_py.mocked_privileged_token", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.testutils.default_sqlal...
The function (_user_with_roles) defined within the public class called public.The function start at line 236 and ends at 247. 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 has 2.0 functions calling this function which ar...
aiondemand_AIOD-rest-api
public
public
0
0
overwrites_keycloak_token
def overwrites_keycloak_token():original = keycloak_openid.introspectyieldkeycloak_openid.introspect = original
1
4
0
15
1
251
254
251
['original']
None
{"Assign": 2, "Expr": 1}
1
4
1
["pytest.fixture"]
0
[]
The function (overwrites_keycloak_token) defined within the public class called public.The function start at line 251 and ends at 254. 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 declare 1.0 function, and It has 1.0 fu...
aiondemand_AIOD-rest-api
public
public
0
0
mocked_token
def mocked_token(request: FixtureRequest, overwrites_keycloak_token: None):"""Return a mocked function that returns a user, to mock the authentication.Optionally, you can give a list of roles to this fixture, using Pytest indirect parametrization:https://docs.pytest.org/en/latest/example/parametrize.html#deferring-the-...
2
7
2
48
1
258
270
258
request,overwrites_keycloak_token
['roles']
None
{"Assign": 2, "Expr": 1}
4
13
4
["hasattr", "Mock", "_user_with_roles", "pytest.fixture"]
0
[]
The function (mocked_token) defined within the public class called public.The function start at line 258 and ends at 270. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [258.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions...
aiondemand_AIOD-rest-api
public
public
0
0
mocked_privileged_token
def mocked_privileged_token(mocked_token: Mock, overwrites_keycloak_token: None):roles = ["offline_access", "uma_authorization", "default-roles-aiod"]keycloak_openid.introspect = Mock(return_value=_user_with_roles(*roles))
1
3
2
34
1
274
276
274
mocked_token,overwrites_keycloak_token
['roles']
None
{"Assign": 2}
3
3
3
["Mock", "_user_with_roles", "pytest.fixture"]
0
[]
The function (mocked_privileged_token) defined within the public class called public.The function start at line 274 and ends at 276. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [274.0] and does not return any value. It declares 3.0 functions, and It has 3....
aiondemand_AIOD-rest-api
public
public
0
0
MockedKeycloak
def MockedKeycloak(type_: TestUserType = TestUserType.user) -> responses.RequestsMock:"""Mock the keycloak instance."""path_user = path_test_resources() / "authentication" / type_.valuereturn _mocked_user(path_user)
1
3
1
32
1
21
26
21
type_
['path_user']
responses.RequestsMock
{"Assign": 1, "Expr": 1, "Return": 1}
2
6
2
["path_test_resources", "_mocked_user"]
3
["_.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 (MockedKeycloak) defined within the public class called public.The function start at line 21 and ends at 26. 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 called i...
aiondemand_AIOD-rest-api
public
public
0
0
_mocked_user
def _mocked_user(path_user_json: Path) -> responses.RequestsMock:with path_user_json.open("r") as f:response = json.load(f)with responses.RequestsMock() as request_mock:request_mock.add(responses.POST,"http://keycloak:8080/aiod-auth/realms/aiod/protocol/openid-connect/token/introspect",json=response,)yield request_mock
1
10
1
55
1
29
39
29
path_user_json
['response']
responses.RequestsMock
{"Assign": 1, "Expr": 2, "With": 2}
4
11
4
["path_user_json.open", "json.load", "responses.RequestsMock", "request_mock.add"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.testutils.mock_keycloak_py.MockedKeycloak"]
The function (_mocked_user) defined within the public class called public.The function start at line 29 and ends at 39. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions called in...
aiondemand_AIOD-rest-api
public
public
0
0
path_test_resources
def path_test_resources() -> pathlib.Path:"""Return the absolute path of src/tests/resources"""return pathlib.Path(__file__).parent.parent / "resources"
1
2
0
22
0
4
6
4
[]
pathlib.Path
{"Expr": 1, "Return": 1}
1
3
1
["pathlib.Path"]
17
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.connectors.huggingface.test_huggingface_dataset_connector_py.mock_parquet", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.conne...
The function (path_test_resources) defined within the public class called public.The function start at line 4 and ends at 6. 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 i...
aiondemand_AIOD-rest-api
public
public
0
0
factory_test_resource
def factory_test_resource(title="default_title", status=EntryStatus.DRAFT, platform="example", platform_resource_identifier="1", date_deleted=None):return TestResource(title=title,platform=platform,platform_resource_identifier=platform_resource_identifier,aiod_entry=AIoDEntryORM(status=status),date_deleted=date_deleted...
1
10
5
54
0
26
35
26
title,status,platform,platform_resource_identifier,date_deleted
[]
Returns
{"Return": 1}
2
10
2
["TestResource", "AIoDEntryORM"]
10
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.database.deletion.test_hard_delete_py.test_hard_delete", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.routers.generic.test_rou...
The function (factory_test_resource) defined within the public class called public.The function start at line 26 and ends at 35. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [26.0], and this function return a value. It declares 2.0 functions, It has 2.0 fun...
aiondemand_AIOD-rest-api
RouterTestResource
public
0
1
version
def version(self) -> int:return 0
1
2
1
9
0
42
43
42
self
[]
int
{"Return": 1}
0
2
0
[]
20
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3719382_myint_rstcheck.src.rstcheck._cli_py.version_callback", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3913638_scijava_scyjava.src.scyjava._versions_py.get_version", "_.content.gdrive.MyDrive.Phd_Thesis.Datase...
The function (version) defined within the public class called RouterTestResource, that inherit another class.The function start at line 42 and ends at 43. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 20.0 functions c...
aiondemand_AIOD-rest-api
RouterTestResource
public
0
1
resource_name
def resource_name(self) -> str:return "test_resource"
1
2
1
9
0
46
47
46
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (resource_name) defined within the public class called RouterTestResource, that inherit another class.The function start at line 46 and ends at 47. 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
RouterTestResource
public
0
1
resource_name_plural
def resource_name_plural(self) -> str:return "test_resources"
1
2
1
9
0
50
51
50
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (resource_name_plural) defined within the public class called RouterTestResource, that inherit another class.The function start at line 50 and ends at 51. 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
RouterTestResource
public
0
1
resource_class
def resource_class(self) -> Type[TestResource]:return TestResource
1
2
1
12
0
54
55
54
self
[]
Type[TestResource]
{"Return": 1}
0
2
0
[]
0
[]
The function (resource_class) defined within the public class called RouterTestResource, that inherit another class.The function start at line 54 and ends at 55. 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
_register_user_in_db
def _register_user_in_db(user: KeycloakUser) -> KeycloakUser:with DbSession() as session:register_user(user, session)session.commit()return user
1
5
1
29
0
23
27
23
user
[]
KeycloakUser
{"Expr": 2, "Return": 1, "With": 1}
3
5
3
["DbSession", "register_user", "session.commit"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.authorization.test_authorization_py.test_get_submission_by_id_must_be_reviewer_or_owner", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.s...
The function (_register_user_in_db) defined within the public class called public.The function start at line 23 and ends at 27. 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 ca...
aiondemand_AIOD-rest-api
public
public
0
0
kc_connector_with_roles
def kc_connector_with_roles(*roles: str) -> KeycloakUser:""" Generates a connector user. """return KeycloakUser(name="Connector",roles={CONNECTOR_ROLE, *roles}, # type: ignore[arg-type]_subject_identifier="connector-sub",)
1
6
1
32
0
29
35
29
*roles
[]
KeycloakUser
{"Expr": 1, "Return": 1}
1
7
1
["KeycloakUser"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.routers.generic.test_router_post_py.test_connector_can_post_to_valid_platform", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.r...
The function (kc_connector_with_roles) defined within the public class called public.The function start at line 29 and ends at 35. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function ca...
aiondemand_AIOD-rest-api
public
public
0
0
kc_user_with_roles
def kc_user_with_roles(*roles: str) -> KeycloakUser:""" Generates a user with name 'Dummy' and identifier 'Foo' and the provided roles. """return KeycloakUser(name="Dummy",roles=set(roles),_subject_identifier="Foo",)
1
6
1
30
0
37
43
37
*roles
[]
KeycloakUser
{"Expr": 1, "Return": 1}
2
7
2
["KeycloakUser", "set"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.routers.generic.test_router_put_py.test_no_platform_with_platform_resource_identifier", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src...
The function (kc_user_with_roles) defined within the public class called public.The function start at line 37 and ends at 43. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions call...
aiondemand_AIOD-rest-api
public
public
0
0
logged_in_user
def logged_in_user(user: KeycloakUser | None = None):"""Act as if the specified user is logged in. If no user is specified, a new user will be generated. """original = keycloak_openid.introspectuser = user or kc_user_with_roles()keycloak_openid.introspect = Mock(return_value={"realm_access": {"roles": user.roles},"reso...
2
18
1
93
2
46
64
46
user
['user', 'original']
None
{"Assign": 4, "Expr": 2}
2
19
2
["kc_user_with_roles", "Mock"]
91
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.authorization.test_authorization_py.test_a_draft_is_not_pending_for_review", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.auth...
The function (logged_in_user) defined within the public class called public.The function start at line 46 and ends at 64. It contains 18 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions called ...
aiondemand_AIOD-rest-api
public
public
0
0
register_asset
def register_asset(asset: AIoDConcept, /, *, owner: KeycloakUser | None = None, status: EntryStatus = EntryStatus.PUBLISHED):owner = owner or kc_user_with_roles()try:if not asset.aiod_entry:asset.aiod_entry = AIoDEntryORM()except DetachedInstanceError:pass# if the asset came from a database connection, it already has a...
6
30
3
210
3
67
100
67
asset,owner,status
['submission', 'owner', 'review']
Returns
{"Assign": 6, "Expr": 9, "If": 3, "Return": 1, "Try": 1, "With": 1}
15
34
15
["kc_user_with_roles", "AIoDEntryORM", "DbSession", "session.add", "session.commit", "register_user", "set_permission", "Submission", "submission._assets.append", "AssetReview", "session.add", "register_user", "Review", "session.add", "session.commit"]
52
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.authorization.test_authorization_py.test_a_draft_is_not_pending_for_review", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.auth...
The function (register_asset) defined within the public class called public.The function start at line 67 and ends at 100. It contains 30 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [67.0], and this function return a value. It declares 15.0 functions, It has 15.0 functio...
aiondemand_AIOD-rest-api
public
public
0
0
bypass_reviewer_publish_everything
def bypass_reviewer_publish_everything() -> None:"""Function to set the AIoD entry to published without a review.This function is a *test utility* to simplify test setups, and avoide.g., authentication for get requests."""with DbSession() as session:session.exec(update(AIoDEntryORM).values(status=EntryStatus.PUBLISHED)...
1
4
0
37
0
102
109
102
[]
None
{"Expr": 3, "With": 1}
5
8
5
["DbSession", "session.exec", "values", "update", "session.commit"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.tests.testutils.default_sqlalchemy_py.clear_db"]
The function (bypass_reviewer_publish_everything) defined within the public class called public.The function start at line 102 and ends at 109. 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 5.0 functions, It has ...
aiondemand_AIOD-rest-api
public
public
0
0
test_identifier
def test_identifier(identifier: str, expected_error: ValueError | None):if expected_error is None:huggingface_validators.throw_error_on_invalid_identifier(identifier)else:with pytest.raises(type(expected_error)) as exception_info:huggingface_validators.throw_error_on_invalid_identifier(identifier)assert exception_info....
2
7
2
61
0
37
43
37
identifier,expected_error
[]
None
{"Expr": 2, "If": 1, "With": 1}
8
7
8
["huggingface_validators.throw_error_on_invalid_identifier", "pytest.raises", "type", "huggingface_validators.throw_error_on_invalid_identifier", "pytest.mark.parametrize", "ValueError", "ValueError", "ValueError"]
0
[]
The function (test_identifier) defined within the public class called public.The function start at line 37 and ends at 43. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [37.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functions...
aiondemand_AIOD-rest-api
public
public
0
0
test_repo_id
def test_repo_id(repo_id: str, expected_error: ValueError | None):if expected_error is None:zenodo_validators.throw_error_on_invalid_identifier(repo_id)else:with pytest.raises(type(expected_error)) as exception_info:zenodo_validators.throw_error_on_invalid_identifier(repo_id)assert exception_info.value.args[0] == expec...
2
7
2
61
0
39
46
39
repo_id,expected_error
[]
None
{"Expr": 2, "If": 1, "With": 1}
17
8
17
["zenodo_validators.throw_error_on_invalid_identifier", "pytest.raises", "type", "zenodo_validators.throw_error_on_invalid_identifier", "pytest.mark.parametrize", "ValueError", "ValueError", "ValueError", "ValueError", "ValueError", "ValueError", "ValueError", "ValueError", "ValueError", "ValueError", "ValueError", "Va...
0
[]
The function (test_repo_id) defined within the public class called public.The function start at line 39 and ends at 46. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [39.0] and does not return any value. It declares 17.0 functions, and It has 17.0 functions ...
anaconda_anaconda-client
Binstar
public
0
1
__init__
def __init__(self, token=None, domain='https://api.anaconda.org', verify=True, **kwargs):self._session = requests.Session()self._session.headers['x-binstar-api-version'] = __version__self.session.verify = verifyself.session.auth = NullAuth()self.token = tokenself._token_warning_sent = Falseuser_agent = 'Anaconda-Client...
4
22
5
157
0
39
63
39
self,token,domain,verify,**kwargs
[]
None
{"Assign": 10, "Expr": 2, "If": 3}
8
25
8
["requests.Session", "NullAuth", "format", "self._session.headers.update", "self._session.headers.update", "format", "domain.endswith", "domain.startswith"]
14,667
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15914487_netbox_community_pynetbox.pynetbox.core.query_py.AllocationError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15914487_netbox_community_pynetbox.pynetbox.core.query_py.ContentError.__init__", "_...
The function (__init__) defined within the public class called Binstar, that inherit another class.The function start at line 39 and ends at 63. It contains 22 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [39.0] and does not return any value. It declares 8.0 functions, It...
anaconda_anaconda-client
Binstar
public
0
1
session
def session(self):return self._session
1
2
1
9
0
66
67
66
self
[]
Returns
{"Return": 1}
0
2
0
[]
25
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3930807_kane610_deconz.pydeconz.utils_py.request", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3966267_mkb79_audible.noxfile_py.coverage", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3...
The function (session) defined within the public class called Binstar, that inherit another class.The function start at line 66 and ends at 67. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 25.0 functions calling ...
anaconda_anaconda-client
Binstar
public
0
1
check_server
def check_server(self):"""Check if server is reachable or throw an exception if it isn't."""msg = 'API server is unavailable. Please check your API url configuration.'try:response = self.session.head(self.domain)except Exception as error:raise errors.ServerError(msg) from errortry:self._check_response(response)except e...
3
10
1
61
0
69
81
69
self
[]
None
{"Assign": 2, "Expr": 2, "Try": 2}
4
13
4
["self.session.head", "errors.ServerError", "self._check_response", "errors.ServerError"]
0
[]
The function (check_server) defined within the public class called Binstar, that inherit another class.The function start at line 69 and ends at 81. It contains 10 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, a...
anaconda_anaconda-client
Binstar
public
0
1
authentication_type
def authentication_type(self):url = '%s/authentication-type' % self.domainres = self.session.get(url)try:self._check_response(res)res = res.json()return res['authentication_type']except BinstarError:return 'password'
2
9
1
47
0
83
91
83
self
[]
Returns
{"Assign": 3, "Expr": 1, "Return": 2, "Try": 1}
3
9
3
["self.session.get", "self._check_response", "res.json"]
0
[]
The function (authentication_type) defined within the public class called Binstar, that inherit another class.The function start at line 83 and ends at 91. It contains 9 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 3.0 fu...
anaconda_anaconda-client
Binstar
public
0
1
krb_authenticate
def krb_authenticate(self, *args, **kwargs):try:from requests_kerberos import HTTPKerberosAuthreturn self._authenticate(HTTPKerberosAuth(), *args, **kwargs)except ImportError as error:raise BinstarError('Kerberos authentication requires the requests-kerberos package to be installed:\n''conda install requests-kerberos\n...
2
11
3
47
0
93
104
93
self,*args,**kwargs
[]
Returns
{"Return": 1, "Try": 1}
3
12
3
["self._authenticate", "HTTPKerberosAuth", "BinstarError"]
0
[]
The function (krb_authenticate) defined within the public class called Binstar, that inherit another class.The function start at line 93 and ends at 104. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [93.0], and this function return a value. It declares 3.0 ...
anaconda_anaconda-client
Binstar
public
0
1
authenticate
def authenticate(self, username, password, *args, **kwargs):return self._authenticate((username, password), *args, **kwargs)
1
2
5
32
0
106
107
106
self,username,password,*args,**kwargs
[]
Returns
{"Return": 1}
1
2
1
["self._authenticate"]
51
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3708229_unbit_uwsgi_it.uwsgi_it_api.uwsgi_it_api.decorators_py.api_auth", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3721124_tivix_django_rest_auth.rest_auth.serializers_py.LoginSerializer.authenticate", "_.conte...
The function (authenticate) defined within the public class called Binstar, that inherit another class.The function start at line 106 and ends at 107. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [106.0], and this function return a value. It declare 1.0 func...
anaconda_anaconda-client
Binstar
public
0
1
_authenticate
def _authenticate(self,auth,application,application_url=None,for_user=None,scopes=None,max_age=None,strength='strong',fail_if_already_exists=False,hostname=_platform.node(),):"""Use basic authentication to create an authentication token using the interface below.With this technique, a username and password need not be ...
1
30
10
157
0
109
151
109
self,auth,application,application_url,for_user,scopes,max_age,strength,fail_if_already_exists,hostname
[]
Returns
{"Assign": 6, "Expr": 3, "Return": 1}
6
43
6
["_platform.node", "jencode", "self.session.post", "self._check_response", "res.json", "self.session.headers.update"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94562214_home_assistant_core.homeassistant.components.clicksend.notify_py.get_service", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94562214_home_assistant_core.homeassistant.components.clicksend_tts.notify_py.get...
The function (_authenticate) defined within the public class called Binstar, that inherit another class.The function start at line 109 and ends at 151. It contains 30 lines of code and it has a cyclomatic complexity of 1. It takes 10 parameters, represented as [109.0], and this function return a value. It declares 6.0 ...
anaconda_anaconda-client
Binstar
public
0
1
list_scopes
def list_scopes(self):url = f'{self.domain}/scopes'res = requests.get(url, timeout=60)self._check_response(res)return res.json()
1
5
1
33
0
153
157
153
self
[]
Returns
{"Assign": 2, "Expr": 1, "Return": 1}
3
5
3
["requests.get", "self._check_response", "res.json"]
0
[]
The function (list_scopes) defined within the public class called Binstar, that inherit another class.The function start at line 153 and ends at 157. 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 function...
anaconda_anaconda-client
Binstar
public
0
1
authentication
def authentication(self):"""Retrieve information on the current authentication token."""url = '%s/authentication' % (self.domain)res = self.session.get(url)self._check_response(res)return res.json()
1
5
1
37
0
159
164
159
self
[]
Returns
{"Assign": 2, "Expr": 2, "Return": 1}
3
6
3
["self.session.get", "self._check_response", "res.json"]
0
[]
The function (authentication) defined within the public class called Binstar, that inherit another class.The function start at line 159 and ends at 164. 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 funct...
anaconda_anaconda-client
Binstar
public
0
1
authentications
def authentications(self):"""Get a list of the current authentication tokens."""url = '%s/authentications' % (self.domain)res = self.session.get(url)self._check_response(res)return res.json()
1
5
1
37
0
166
172
166
self
[]
Returns
{"Assign": 2, "Expr": 2, "Return": 1}
3
7
3
["self.session.get", "self._check_response", "res.json"]
0
[]
The function (authentications) defined within the public class called Binstar, that inherit another class.The function start at line 166 and ends at 172. 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 func...
anaconda_anaconda-client
Binstar
public
0
1
remove_authentication
def remove_authentication(self, auth_name=None, organization=None):"""Remove the current authentication or the one given by `auth_name`"""if auth_name:if organization:url = '%s/authentications/org/%s/name/%s' % (self.domain, organization, auth_name)else:url = '%s/authentications/name/%s' % (self.domain, auth_name)else:...
3
10
3
78
0
174
187
174
self,auth_name,organization
[]
None
{"Assign": 4, "Expr": 2, "If": 2}
2
14
2
["self.session.delete", "self._check_response"]
0
[]
The function (remove_authentication) defined within the public class called Binstar, that inherit another class.The function start at line 174 and ends at 187. It contains 10 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [174.0] and does not return any value. It declares 2...
anaconda_anaconda-client
Binstar
public
0
1
_check_response
def _check_response(self, res, allowed=None):allowed = [200] if allowed is None else allowedif not self._token_warning_sent and 'Conda-Token-Warning' in res.headers:logger.warning('Token warning: %s', res.headers['Conda-Token-Warning'])self._token_warning_sent = Trueif 'X-Anaconda-Lockdown' in res.headers:logger.warnin...
12
27
3
217
0
189
222
189
self,res,allowed
[]
None
{"Assign": 12, "Expr": 3, "If": 8, "Try": 1}
7
34
7
["logger.warning", "logger.warning", "logger.warning", "STATUS_CODES.get", "res.json", "data.get", "ErrCls"]
0
[]
The function (_check_response) defined within the public class called Binstar, that inherit another class.The function start at line 189 and ends at 222. It contains 27 lines of code and it has a cyclomatic complexity of 12. It takes 3 parameters, represented as [189.0] and does not return any value. It declares 7.0 fu...
anaconda_anaconda-client
Binstar
public
0
1
user
def user(self, login=None):"""Get user information.:param login: (optional) the login name of the user or None. If login is Nonethis method will return the information of the authenticated user."""if login:url = f'{self.domain}/user/{login}'elif self.token:url = f'{self.domain}/user'else:raise errors.Unauthorized('Auth...
3
12
2
67
0
224
243
224
self,login
[]
Returns
{"Assign": 3, "Expr": 2, "If": 2, "Return": 1}
4
20
4
["errors.Unauthorized", "self.session.get", "self._check_response", "res.json"]
6
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18354993_vaticle_typedb_client_python.tests.behaviour.connection.user.user_steps_py.step_impl", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3914568_treasure_data_td_client_python.tdclient.client_py.Client.users", ...
The function (user) defined within the public class called Binstar, that inherit another class.The function start at line 224 and ends at 243. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [224.0], and this function return a value. It declares 4.0 functions,...
anaconda_anaconda-client
Binstar
public
0
1
user_packages
def user_packages(self, login=None, platform=None, package_type=None, type_=None, access=None):"""Returns a list of packages for a given user and optionally filterby `platform`, `package_type` and `type_`.:param login: (optional) the login name of the user or None. If loginis None this method will return the packages f...
6
17
6
122
0
245
281
245
self,login,platform,package_type,type_,access
[]
Returns
{"Assign": 8, "Expr": 2, "If": 5, "Return": 1}
6
37
6
["format", "format", "collections.OrderedDict", "self.session.get", "self._check_response", "res.json"]
0
[]
The function (user_packages) defined within the public class called Binstar, that inherit another class.The function start at line 245 and ends at 281. It contains 17 lines of code and it has a cyclomatic complexity of 6. It takes 6 parameters, represented as [245.0], and this function return a value. It declares 6.0 f...
anaconda_anaconda-client
Binstar
public
0
1
package
def package(self, login, package_name):"""Get information about a specific package:param login: the login of the package owner:param package_name: the name of the package"""url = '%s/package/%s/%s' % (self.domain, login, package_name)res = self.session.get(url)self._check_response(res)return res.json()
1
5
3
45
0
283
293
283
self,login,package_name
[]
Returns
{"Assign": 2, "Expr": 2, "Return": 1}
3
11
3
["self.session.get", "self._check_response", "res.json"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3678342_kieranjol_ifiscripts.seq2ffv1_py.run_loop"]
The function (package) defined within the public class called Binstar, that inherit another class.The function start at line 283 and ends at 293. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [283.0], and this function return a value. It declares 3.0 function...
anaconda_anaconda-client
Binstar
public
0
1
package_add_collaborator
def package_add_collaborator(self, owner, package_name, collaborator):url = '%s/packages/%s/%s/collaborators/%s' % (self.domain, owner, package_name, collaborator)res = self.session.put(url)self._check_response(res, [201])
1
4
4
46
0
295
298
295
self,owner,package_name,collaborator
[]
None
{"Assign": 2, "Expr": 1}
2
4
2
["self.session.put", "self._check_response"]
0
[]
The function (package_add_collaborator) defined within the public class called Binstar, that inherit another class.The function start at line 295 and ends at 298. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [295.0] and does not return any value. It declares...
anaconda_anaconda-client
Binstar
public
0
1
package_remove_collaborator
def package_remove_collaborator(self, owner, package_name, collaborator):url = '%s/packages/%s/%s/collaborators/%s' % (self.domain, owner, package_name, collaborator)res = self.session.delete(url)self._check_response(res, [201])
1
4
4
46
0
300
303
300
self,owner,package_name,collaborator
[]
None
{"Assign": 2, "Expr": 1}
2
4
2
["self.session.delete", "self._check_response"]
0
[]
The function (package_remove_collaborator) defined within the public class called Binstar, that inherit another class.The function start at line 300 and ends at 303. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [300.0] and does not return any value. It decla...