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
get_all_asset_schemas
def get_all_asset_schemas():return [{"$ref": f"#/components/schemas/{clz.__name__}"} for clz in get_all_read_classes().values()]
2
4
0
23
0
26
29
26
[]
Returns
{"Return": 1}
2
4
2
["values", "get_all_read_classes"]
0
[]
The function (get_all_asset_schemas) defined within the public class called public.The function start at line 26 and ends at 29. It contains 4 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 2.0 functions, and It has 2.0 fu...
aiondemand_AIOD-rest-api
public
public
0
0
get_asset_type_by_abbreviation
def get_asset_type_by_abbreviation() -> dict[str, type[AIoDConcept]]:return {cls.__abbreviation__: clsfor cls in non_abstract_subclasses(AIoDConcept)if hasattr(cls, "__abbreviation__")}
3
6
0
36
0
33
38
33
[]
dict[str, type[AIoDConcept]]
{"Return": 1}
2
6
2
["non_abstract_subclasses", "hasattr"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.database.review_py.Submission.assets", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.routers.asset_router_py.create", "_.content.gdrive.MyD...
The function (get_asset_type_by_abbreviation) defined within the public class called public.The function start at line 33 and ends at 38. It contains 6 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 fu...
aiondemand_AIOD-rest-api
public
public
0
0
get_router_by_type
def get_router_by_type() -> dict[type[AIoDConcept], type["ResourceRouter"]]:from routers.resource_routers import versioned_routers# avoid cyclical importrouters = versioned_routers[Version.LATEST]return {r.resource_class: r for r in routers}
2
4
0
43
1
42
46
42
['routers']
dict[type[AIoDConcept], type['ResourceRouter']]
{"Assign": 1, "Return": 1}
0
5
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.routers.review_router_py._submit_resource"]
The function (get_router_by_type) defined within the public class called public.The function start at line 42 and ends at 46. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It has 1.0 function calling this function which is [...
aiondemand_AIOD-rest-api
ParentRouter
public
1
1
resource_name
def resource_name(self) -> str:"""The name of the resource. E.g. 'agent'"""
1
1
1
8
0
24
25
24
self
[]
str
{"Expr": 1}
0
2
0
[]
0
[]
The function (resource_name) defined within the public class called ParentRouter, implement an interface, and it inherit another class.The function start at line 24 and ends at 25. It contains 1 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any valu...
aiondemand_AIOD-rest-api
ParentRouter
public
1
1
resource_name_plural
def resource_name_plural(self) -> str:"""The plural of the name of the resource. E.g. 'agents'"""
1
1
1
8
0
29
30
29
self
[]
str
{"Expr": 1}
0
2
0
[]
0
[]
The function (resource_name_plural) defined within the public class called ParentRouter, implement an interface, and it inherit another class.The function start at line 29 and ends at 30. It contains 1 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return a...
aiondemand_AIOD-rest-api
ParentRouter
public
1
1
parent_class
def parent_class(self):"""The resource type. E.g. Agent"""
1
1
1
6
0
34
35
34
self
[]
None
{"Expr": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95100531_dfxml_working_group_dfxml_python.tests.test_objects_py.test_AbstractHierarchyObject_append"]
The function (parent_class) defined within the public class called ParentRouter, implement an interface, and it inherit another class.The function start at line 34 and ends at 35. It contains 1 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
ParentRouter
public
1
1
parent_class_table
def parent_class_table(self):"""The table class of the resource. E.g. AgentTable"""
1
1
1
6
0
39
40
39
self
[]
None
{"Expr": 1}
0
2
0
[]
0
[]
The function (parent_class_table) defined within the public class called ParentRouter, implement an interface, and it inherit another class.The function start at line 39 and ends at 40. It contains 1 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any...
aiondemand_AIOD-rest-api
ParentRouter
public
1
1
create
def create(self, url_prefix: str, version: Version) -> APIRouter:router = APIRouter()default_kwargs = {"response_model_exclude_none": True,"deprecated": True,"tags": ["parents"],}available_schemas: list[SQLModel] = list(non_abstract_subclasses(self.parent_class))classes_dict = {clz.__tablename__: clz for clz in availab...
6
42
3
208
0
42
97
42
self,url_prefix,version
[]
APIRouter
{"AnnAssign": 1, "Assign": 9, "Expr": 1, "Return": 1}
7
56
7
["APIRouter", "list", "non_abstract_subclasses", "self.get_resource_func", "self.resource_name.replace", "read_classes_dict.values", "router.add_api_route"]
158
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.deployments.managers_py.PRDeploymentManager.create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3635000_umutbozkurt_django_rest_framework_mongoengine.tests.test_reference_py.ComboRefe...
The function (create) defined within the public class called ParentRouter, implement an interface, and it inherit another class.The function start at line 42 and ends at 97. It contains 42 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [42.0] and does not return any value. ...
aiondemand_AIOD-rest-api
public
public
0
0
get_resource_func.get_resource
def get_resource(identifier: str):with DbSession() as session:query = select(self.parent_class_table).where(self.parent_class_table.identifier == identifier)parent_resource = session.scalars(query).first()if not parent_resource:self.raise_404(identifier)child_type: str = parent_resource.typechild_class = classes_dict[c...
5
29
1
172
0
100
130
100
null
[]
None
null
0
0
0
null
0
null
The function (get_resource_func.get_resource) defined within the public class called public.The function start at line 100 and ends at 130. It contains 29 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
ParentRouter
public
1
1
get_resource_func
def get_resource_func(self, classes_dict: dict, read_classes_dict: dict):def get_resource(identifier: str):with DbSession() as session:query = select(self.parent_class_table).where(self.parent_class_table.identifier == identifier)parent_resource = session.scalars(query).first()if not parent_resource:self.raise_404(iden...
1
3
3
17
0
99
132
99
self,classes_dict,read_classes_dict
[]
Returns
{"AnnAssign": 2, "Assign": 6, "Expr": 2, "If": 3, "Return": 2, "With": 1}
15
34
15
["DbSession", "where", "select", "first", "session.scalars", "self.raise_404", "hasattr", "where", "select", "getattr", "first", "session.scalars", "self.raise_404", "HTTPException", "child_class_read.from_orm"]
0
[]
The function (get_resource_func) defined within the public class called ParentRouter, implement an interface, and it inherit another class.The function start at line 99 and ends at 132. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [99.0], and this function r...
aiondemand_AIOD-rest-api
ParentRouter
public
1
1
raise_404
def raise_404(self, identifier: str):raise HTTPException(status_code=HTTP_404_NOT_FOUND,detail=f"{self.resource_name} with identifier {identifier} not found.",)
1
5
2
22
0
134
138
134
self,identifier
[]
None
{}
1
5
1
["HTTPException"]
0
[]
The function (raise_404) defined within the public class called ParentRouter, implement an interface, and it inherit another class.The function start at line 134 and ends at 138. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [134.0] and does not return any va...
aiondemand_AIOD-rest-api
ResourceAIAssetRouter
public
0
1
create
def create(self, url_prefix: str, version: Version = Version.LATEST) -> APIRouter:default_kwargs = {"response_model_exclude_none": True,"deprecated": False,"tags": [self.resource_name_plural],}router = super().create(url_prefix, version)router.add_api_route(path=f"/{self.resource_name_plural}/{{identifier}}/content",en...
1
26
3
132
0
13
42
13
self,url_prefix,version
[]
APIRouter
{"Assign": 2, "Expr": 2, "Return": 1}
6
30
6
["create", "super", "router.add_api_route", "self.get_resource_content_func", "router.add_api_route", "self.get_resource_content_func"]
158
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.deployments.managers_py.PRDeploymentManager.create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3635000_umutbozkurt_django_rest_framework_mongoengine.tests.test_reference_py.ComboRefe...
The function (create) defined within the public class called ResourceAIAssetRouter, that inherit another class.The function start at line 13 and ends at 42. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [13.0] and does not return any value. It declares 6.0 f...
aiondemand_AIOD-rest-api
public
public
0
0
get_resource_content_func.get_resource_content
def get_resource_content(identifier: Annotated[str, Path(description=f"The identifier of the {self.resource_name}")],distribution_idx: Annotated[int,Path(description=f"The index of the distribution within the {self.resource_name}"),],user: KeycloakUser | None = Depends(get_user_or_none),):metadata: AIAsset = self.get_r...
5
37
3
166
0
51
89
51
null
[]
None
null
0
0
0
null
0
null
The function (get_resource_content_func.get_resource_content) defined within the public class called public.The function start at line 51 and ends at 89. It contains 37 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [51.0] and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
get_resource_content_func.get_resource_content_default
def get_resource_content_default(identifier: Annotated[str, Path(description=f"The identifier of the {self.resource_name}")],user: KeycloakUser | None = Depends(get_user_or_none),):return get_resource_content(identifier=identifier, distribution_idx=0, user=user)
1
7
2
45
0
91
97
91
null
[]
None
null
0
0
0
null
0
null
The function (get_resource_content_func.get_resource_content_default) defined within the public class called public.The function start at line 91 and ends at 97. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [91.0] and does not return any value..
aiondemand_AIOD-rest-api
ResourceAIAssetRouter
public
0
1
get_resource_content_func
def get_resource_content_func(self, default: bool):"""Returns a function to download the content from resources.This function returns a function (instead of being that function directly) because thedocstring and the variables are dynamic, and used in Swagger."""def get_resource_content(identifier: Annotated[str, Path(d...
2
6
2
21
0
44
102
44
self,default
[]
Returns
{"AnnAssign": 1, "Assign": 2, "Expr": 1, "If": 4, "Return": 4}
13
59
13
["Path", "Path", "Depends", "self.get_resource", "HTTPException", "len", "HTTPException", "len", "HTTPException", "RedirectResponse", "Path", "Depends", "get_resource_content"]
0
[]
The function (get_resource_content_func) defined within the public class called ResourceAIAssetRouter, that inherit another class.The function start at line 44 and ends at 102. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [44.0], and this function return a v...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
__init__
def __init__(self, resource: VersionedResource | None = None):resource = resource or VersionedResource(self.resource_class)self.resource_class_create = resource.resource_class_createself.resource_class_read = resource.resource_class_readself.create_to_orm = resource.create_to_ormself.orm_to_read = resource.orm_to_read
2
6
2
51
0
60
65
60
self,resource
[]
None
{"Assign": 5}
1
6
1
["VersionedResource"]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 60 and ends at 65. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [60.0] and does not return any valu...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
version
def version(self) -> int:"""The API version.When introducing a breaking change, the current version should be deprecated, any previousversions removed, and a new version should be created. The breaking changes should onlybe implemented in the new version."""
1
1
1
8
0
69
76
69
self
[]
int
{"Expr": 1}
0
8
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 ResourceRouter, implement an interface, and it inherit another class.The function start at line 69 and ends at 76. It contains 1 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. I...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
resource_name
def resource_name(self) -> str:pass
1
2
1
8
0
80
81
80
self
[]
str
{}
0
2
0
[]
0
[]
The function (resource_name) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 80 and ends at 81. 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 va...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
resource_name_plural
def resource_name_plural(self) -> str:pass
1
2
1
8
0
85
86
85
self
[]
str
{}
0
2
0
[]
0
[]
The function (resource_name_plural) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 85 and ends at 86. 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...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
resource_class
def resource_class(self) -> type[RESOURCE_MODEL]:pass
1
2
1
11
0
90
91
90
self
[]
type[RESOURCE_MODEL]
{}
0
2
0
[]
0
[]
The function (resource_class) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 90 and ends at 91. 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 v...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
schema_converters
def schema_converters(self) -> dict[str, SchemaConverter[RESOURCE, Any]]:"""If a resource can be served in different formats, the resource converter should returna dictionary of schema converters.Returns:a dictionary containing as key the name of a schema, and as value the schemaconverter. The key "aiod" should not be ...
1
2
1
21
0
94
104
94
self
[]
dict[str, SchemaConverter[RESOURCE, Any]]
{"Expr": 1, "Return": 1}
0
11
0
[]
0
[]
The function (schema_converters) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 94 and ends at 104. 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 a...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
create
def create(self, url_prefix: str, version: Version = Version.LATEST) -> APIRouter:router = APIRouter()default_kwargs = {"response_model_exclude_none": True,"tags": [self.resource_name_plural],}available_schemas: list[Type] = [c.to_class for c in self.schema_converters.values()]response_model = Union[self.resource_class...
5
93
3
462
0
106
207
106
self,url_prefix,version
[]
APIRouter
{"AnnAssign": 1, "Assign": 4, "Expr": 9, "If": 2, "Return": 1}
21
102
21
["APIRouter", "self.schema_converters.values", "router.add_api_route", "self.get_resources_func", "router.add_api_route", "self.get_resource_count_func", "router.add_api_route", "self.get_submit_func", "router.add_api_route", "self.register_resource_func", "router.add_api_route", "self.get_resource_func", "router.add_a...
158
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.deployments.managers_py.PRDeploymentManager.create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3635000_umutbozkurt_django_rest_framework_mongoengine.tests.test_reference_py.ComboRefe...
The function (create) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 106 and ends at 207. It contains 93 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [106.0] and does not return any va...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
get_resources
def get_resources(self,schema: str,pagination: Pagination,resource_filters: ResourceFilters,user: KeycloakUser | None = None,platform: str | None = None,get_image: bool = False,):"""Fetch all published resources of this platform in given schema, using pagination"""_raise_error_on_invalid_schema(self._possible_schemas, ...
10
29
7
178
0
209
243
209
self,schema,pagination,resource_filters,user,platform,get_image
[]
Returns
{"AnnAssign": 1, "Assign": 2, "Expr": 3, "For": 2, "If": 2, "Return": 1, "Try": 1, "With": 1}
10
35
10
["_raise_error_on_invalid_schema", "DbSession", "cast", "partial", "cast", "self._retrieve_resources_and_post_process", "hasattr", "self._add_binary_bytes_to_resource", "convert_schema", "as_http_exception"]
0
[]
The function (get_resources) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 209 and ends at 243. It contains 29 lines of code and it has a cyclomatic complexity of 10. It takes 7 parameters, represented as [209.0], and this function...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
get_resource
def get_resource(self,identifier: str,schema: str,user: KeycloakUser | None = None,platform: str | None = None,get_image: bool = False,):"""Get the resource identified by AIoD identifier (if platform is None) or by platform ANDplatform-identifier (if platform is not None), return in given schema."""_raise_error_on_inva...
11
35
6
206
0
245
288
245
self,identifier,schema,user,platform,get_image
[]
Returns
{"AnnAssign": 1, "Assign": 2, "Expr": 2, "For": 1, "If": 6, "Return": 2, "Try": 1, "With": 1}
11
44
11
["_raise_error_on_invalid_schema", "DbSession", "self._retrieve_resource_and_post_process", "hasattr", "self._add_binary_bytes_to_resource", "HTTPException", "user_can_read", "HTTPException", "convert", "self.orm_to_read", "as_http_exception"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70001713_aws_controllers_k8s_test_infra.src.acktest.k8s.resource_py.get_resource_condition", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70001713_aws_controllers_k8s_test_infra.src.acktest.k8s.resource_py.get_reso...
The function (get_resource) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 245 and ends at 288. It contains 35 lines of code and it has a cyclomatic complexity of 11. It takes 6 parameters, represented as [245.0], and this function ...
aiondemand_AIOD-rest-api
public
public
0
0
get_resources_func.get_resources
def get_resources(pagination: PaginationParams,resource_filters: ResourceFiltersParams,schema: self._possible_schemas_type = "aiod",# type:ignoreuser: KeycloakUser | None = Depends(get_user_or_none),):resources = self.get_resources(schema=schema,pagination=pagination,resource_filters=resource_filters,user=user,platform...
1
14
4
60
0
297
310
297
null
[]
None
null
0
0
0
null
0
null
The function (get_resources_func.get_resources) defined within the public class called public.The function start at line 297 and ends at 310. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [297.0] and does not return any value..
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
get_resources_func
def get_resources_func(self):"""Return a function that can be used to retrieve a list of resources.This function returns a function (instead of being that function directly) because thedocstring and the variables are dynamic, and used in Swagger."""def get_resources(pagination: PaginationParams,resource_filters: Resour...
1
3
1
10
0
290
312
290
self
[]
Returns
{"Assign": 1, "Expr": 1, "Return": 2}
2
23
2
["Depends", "self.get_resources"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3915747_balena_io_balena_sdk_python.tests.functional.models.test_tag_py.BaseTagTest.test_remove"]
The function (get_resources_func) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 290 and ends at 312. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function ...
aiondemand_AIOD-rest-api
public
public
0
0
get_resource_count_func.get_resource_count
def get_resource_count(detailed: Annotated[bool, Query(description="If true, a more detailed output is returned.")] = False,):try:with DbSession() as session:if not detailed:return (session.query(self.resource_class).join(self.resource_class.aiod_entry, isouter=True).where(is_(self.resource_class.date_deleted, None),AI...
5
37
1
187
0
321
357
321
null
[]
None
null
0
0
0
null
0
null
The function (get_resource_count_func.get_resource_count) defined within the public class called public.The function start at line 321 and ends at 357. It contains 37 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
get_resource_count_func
def get_resource_count_func(self):"""Gets the total number of published resources from the database.This function returns a function (instead of being that function directly) because thedocstring and the variables are dynamic, and used in Swagger."""def get_resource_count(detailed: Annotated[bool, Query(description="If...
1
3
1
10
0
314
359
314
self
[]
Returns
{"Assign": 1, "Expr": 1, "If": 1, "Return": 3, "Try": 1, "With": 1}
15
46
15
["Query", "DbSession", "count", "where", "join", "session.query", "is_", "all", "group_by", "where", "join", "session.query", "func.count", "is_", "as_http_exception"]
0
[]
The function (get_resource_count_func) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 314 and ends at 359. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this func...
aiondemand_AIOD-rest-api
public
public
0
0
get_platform_resources_func.get_resources
def get_resources(platform: Annotated[str,Path(description="Return resources of this platform",example="huggingface",),],pagination: PaginationParams,resource_filters: ResourceFiltersParams,schema: self._possible_schemas_type = "aiod",# type:ignoreuser: KeycloakUser | None = Depends(get_user_or_none),):resources = self...
1
21
5
80
0
368
388
368
null
[]
None
null
0
0
0
null
0
null
The function (get_platform_resources_func.get_resources) defined within the public class called public.The function start at line 368 and ends at 388. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [368.0] and does not return any value..
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
get_platform_resources_func
def get_platform_resources_func(self):"""Return a function that can be used to retrieve a list of resources for a platform.This function returns a function (instead of being that function directly) because thedocstring and the variables are dynamic, and used in Swagger."""def get_resources(platform: Annotated[str,Path(...
1
3
1
10
0
361
390
361
self
[]
Returns
{"Assign": 1, "Expr": 1, "Return": 2}
3
30
3
["Path", "Depends", "self.get_resources"]
0
[]
The function (get_platform_resources_func) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 361 and ends at 390. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this ...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_add_binary_bytes_to_resource
def _add_binary_bytes_to_resource(self, session: Session, resource: AIoDConcept):"""Attach binary_blob bytes as base64 encoded image from the resource's media."""if hasattr(resource, "media") and resource.media:for media_obj in resource.media:if media_obj.binary_blob:media_obj.binary_blob = base64.b64encode(media_obj.b...
5
8
3
64
0
392
402
392
self,session,resource
[]
Returns
{"Assign": 2, "Expr": 1, "For": 1, "If": 2, "Return": 1}
3
11
3
["hasattr", "decode", "base64.b64encode"]
0
[]
The function (_add_binary_bytes_to_resource) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 392 and ends at 402. It contains 8 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [392.0], and...
aiondemand_AIOD-rest-api
public
public
0
0
get_resource_func.get_resource
def get_resource(identifier: str,schema: self._possible_schemas_type = "aiod",# type: ignoreuser: KeycloakUser | None = Depends(get_user_or_none),):self._raise_if_identifier_is_wrong_type(identifier)resource = self.get_resource(identifier=identifier, schema=schema, user=user, platform=None)return resource
1
10
3
57
0
411
421
411
null
[]
None
null
0
0
0
null
0
null
The function (get_resource_func.get_resource) defined within the public class called public.The function start at line 411 and ends at 421. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [411.0] and does not return any value..
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
get_resource_func
def get_resource_func(self):"""Return a function that can be used to retrieve a single resource.This function returns a function (instead of being that function directly) because thedocstring and the variables are dynamic, and used in Swagger."""def get_resource(identifier: str,schema: self._possible_schemas_type = "ai...
1
3
1
10
0
404
423
404
self
[]
Returns
{"Assign": 1, "Expr": 2, "Return": 2}
3
20
3
["Depends", "self._raise_if_identifier_is_wrong_type", "self.get_resource"]
0
[]
The function (get_resource_func) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 404 and ends at 423. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function r...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_raise_if_identifier_is_wrong_type
def _raise_if_identifier_is_wrong_type(self, identifier: str):if not identifier.startswith(self.resource_class.__abbreviation__):hint = ""if other_type := get_asset_type_by_abbreviation().get(identifier.split("_")[0]):hint = f" Did you mean to request a {other_type.__tablename__!r} instead?"raise HTTPException(status_c...
3
13
2
72
0
425
437
425
self,identifier
[]
None
{"Assign": 2, "If": 2}
5
13
5
["identifier.startswith", "get", "get_asset_type_by_abbreviation", "identifier.split", "HTTPException"]
0
[]
The function (_raise_if_identifier_is_wrong_type) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 425 and ends at 437. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [425.0...
aiondemand_AIOD-rest-api
public
public
0
0
get_platform_resource_func.get_resource
def get_resource(identifier: Annotated[str,Path(description="The identifier under which the resource is known by the platform.",),],platform: Annotated[str,Path(description="Return resources of this platform",example="huggingface",),],schema: self._possible_schemas_type = "aiod",# type:ignoreuser: KeycloakUser | None =...
1
20
4
80
0
446
465
446
null
[]
None
null
0
0
0
null
0
null
The function (get_platform_resource_func.get_resource) defined within the public class called public.The function start at line 446 and ends at 465. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [446.0] and does not return any value..
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
get_platform_resource_func
def get_platform_resource_func(self):"""Return a function that can be used to retrieve a single resource of a platform.This function returns a function (instead of being that function directly) because thedocstring and the variables are dynamic, and used in Swagger."""def get_resource(identifier: Annotated[str,Path(des...
1
3
1
10
0
439
467
439
self
[]
Returns
{"Expr": 1, "Return": 2}
4
29
4
["Path", "Path", "Depends", "self.get_resource"]
0
[]
The function (get_platform_resource_func) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 439 and ends at 467. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this f...
aiondemand_AIOD-rest-api
public
public
0
0
register_resource_func.register_resource
def register_resource(resource_create: clz_create,# type: ignoreuser: KeycloakUser = Depends(get_user_or_raise),):platform = getattr(resource_create, "platform", None)platform_resource_identifier = getattr(resource_create, "platform_resource_identifier", None)if user.is_connector:# Check if connector belongs to the spe...
10
42
2
218
0
477
523
477
null
[]
None
null
0
0
0
null
0
null
The function (register_resource_func.register_resource) defined within the public class called public.The function start at line 477 and ends at 523. It contains 42 lines of code and it has a cyclomatic complexity of 10. It takes 2 parameters, represented as [477.0] and does not return any value..
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
register_resource_func
def register_resource_func(self):"""Return a function that can be used to register a resource.This function returns a function (instead of being that function directly) because thedocstring is dynamic and used in Swagger."""clz_create = self.resource_class_createdef register_resource(resource_create: clz_create,# type:...
1
4
1
15
0
469
525
469
self
[]
Returns
{"Assign": 5, "Expr": 6, "If": 5, "Return": 2, "Try": 2, "With": 1}
15
57
15
["Depends", "getattr", "getattr", "user.is_connector_for_platform", "HTTPException", "HTTPException", "HTTPException", "_raise_if_contains_binary_blob", "DbSession", "self.create_resource", "register_user", "set_permission", "session.commit", "self._raise_clean_http_exception", "as_http_exception"]
0
[]
The function (register_resource_func) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 469 and ends at 525. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this funct...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
create_resource
def create_resource(self,session: Session,resource_create_instance: SQLModel,user: KeycloakUser | None = None,):"""Store a resource in the database"""resource = self.create_to_orm(resource_create_instance)deserialize_resource_relationships(session, self.resource_class, resource, resource_create_instance, user)session.a...
3
17
4
90
0
527
547
527
self,session,resource_create_instance,user
[]
Returns
{"Assign": 3, "Expr": 5, "If": 1, "Return": 1}
5
21
5
["self.create_to_orm", "deserialize_resource_relationships", "session.add", "session.flush", "session.commit"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70001713_aws_controllers_k8s_test_infra.src.acktest.k8s.resource_py.load_and_create_resource"]
The function (create_resource) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 527 and ends at 547. It contains 17 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [527.0], and this functio...
aiondemand_AIOD-rest-api
public
public
0
0
put_resource_func.put_resource
def put_resource(identifier: str,resource_create_instance: clz_create,# type: ignoreuser: KeycloakUser = Depends(get_user_or_raise),):self._raise_if_identifier_is_wrong_type(identifier)with DbSession() as session:try:resource: Any = self._retrieve_resource(session, identifier)_raise_if_contains_binary_blob(resource_cre...
10
41
3
239
0
557
600
557
null
[]
None
null
0
0
0
null
0
null
The function (put_resource_func.put_resource) defined within the public class called public.The function start at line 557 and ends at 600. It contains 41 lines of code and it has a cyclomatic complexity of 10. It takes 3 parameters, represented as [557.0] and does not return any value..
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
put_resource_func
def put_resource_func(self):"""Return a function that can be used to update a resource.This function returns a function (instead of being that function directly) because thedocstring is dynamic and used in Swagger."""clz_create = self.resource_class_createdef put_resource(identifier: str,resource_create_instance: clz_c...
1
4
1
15
0
549
602
549
self
[]
Returns
{"AnnAssign": 1, "Assign": 3, "Expr": 8, "For": 1, "If": 4, "Return": 2, "Try": 2, "With": 1}
21
54
21
["Depends", "self._raise_if_identifier_is_wrong_type", "DbSession", "self._retrieve_resource", "_raise_if_contains_binary_blob", "user_can_write", "user.has_role", "user.is_connector_for_platform", "HTTPException", "HTTPException", "resource.schema", "hasattr", "getattr", "setattr", "deserialize_resource_relationships"...
0
[]
The function (put_resource_func) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 549 and ends at 602. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function r...
aiondemand_AIOD-rest-api
public
public
0
0
delete_resource_func.delete_resource
def delete_resource(identifier: str,user: KeycloakUser = Depends(get_user_or_raise),):self._raise_if_identifier_is_wrong_type(identifier)with DbSession() as session:try:# Raise error if it does not existresource: Any = self._retrieve_resource(session, identifier)if not (user_can_administer(user, resource.aiod_entry)or ...
7
29
2
153
0
611
640
611
null
[]
None
null
0
0
0
null
0
null
The function (delete_resource_func.delete_resource) defined within the public class called public.The function start at line 611 and ends at 640. It contains 29 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [611.0] and does not return any value..
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
delete_resource_func
def delete_resource_func(self):"""Return a function that can be used to delete a resource.This function returns a function (instead of being that function directly) because thedocstring is dynamic and used in Swagger."""def delete_resource(identifier: str,user: KeycloakUser = Depends(get_user_or_raise),):self._raise_if...
1
3
1
10
0
604
642
604
self
[]
Returns
{"AnnAssign": 1, "Assign": 1, "Expr": 5, "If": 2, "Return": 2, "Try": 1, "With": 1}
14
39
14
["Depends", "self._raise_if_identifier_is_wrong_type", "DbSession", "self._retrieve_resource", "user_can_administer", "user.has_role", "user.is_connector_for_platform", "HTTPException", "hasattr", "session.delete", "datetime.datetime.utcnow", "session.add", "session.commit", "as_http_exception"]
0
[]
The function (delete_resource_func) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 604 and ends at 642. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this functio...
aiondemand_AIOD-rest-api
public
public
0
0
get_submit_func.submit_resource
def submit_resource(identifier: str,submission: SubmissionCreateV2 | None = None,user: KeycloakUser = Depends(get_user_or_raise),):self._raise_if_identifier_is_wrong_type(identifier)with DbSession() as session:resource = self._retrieve_resource(identifier=identifier, session=session)# type: ignoreif not resource.aiod_e...
4
31
3
186
0
647
681
647
null
[]
None
null
0
0
0
null
0
null
The function (get_submit_func.submit_resource) defined within the public class called public.The function start at line 647 and ends at 681. It contains 31 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [647.0] and does not return any value..
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
get_submit_func
def get_submit_func(self):"""Return a function that can be used to submit a single resource for review."""def submit_resource(identifier: str,submission: SubmissionCreateV2 | None = None,user: KeycloakUser = Depends(get_user_or_raise),):self._raise_if_identifier_is_wrong_type(identifier)with DbSession() as session:reso...
1
3
1
10
0
644
683
644
self
[]
Returns
{"Assign": 5, "Expr": 5, "If": 2, "Return": 2, "With": 1}
12
40
12
["Depends", "self._raise_if_identifier_is_wrong_type", "DbSession", "self._retrieve_resource", "HTTPException", "user_can_administer", "HTTPException", "Submission", "review_request._assets.append", "AssetReview", "session.add", "session.commit"]
0
[]
The function (get_submit_func) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 644 and ends at 683. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function ret...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_retrieve_resource
def _retrieve_resource(self,session: Session,identifier: int | str,platform: str | None = None,*,is_entry_identifier: bool = False,) -> type[RESOURCE_MODEL]:"""Retrieve a resource from the database based on the provided identifierand platform (if applicable)."""if platform is None:if is_entry_identifier:query = select(...
9
43
5
210
0
685
731
685
self,session,identifier,platform,is_entry_identifier
[]
type[RESOURCE_MODEL]
{"Assign": 6, "Expr": 1, "If": 4, "Return": 1}
13
47
13
["where", "select", "where", "select", "HTTPException", "where", "select", "and_", "first", "session.scalars", "self.resource_name.capitalize", "self.resource_name.capitalize", "HTTPException"]
0
[]
The function (_retrieve_resource) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 685 and ends at 731. It contains 43 lines of code and it has a cyclomatic complexity of 9. It takes 5 parameters, represented as [685.0] and does not r...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_retrieve_resources
def _retrieve_resources(self,session: Session,pagination: Pagination,resource_filters: ResourceFilters,platform: str | None = None,) -> Sequence[type[RESOURCE_MODEL]]:"""Retrieve a sequence of published resources from the database based on theprovided identifier, platform and resource filters (if applicable)."""where_c...
4
27
5
168
0
733
763
733
self,session,pagination,resource_filters,platform
[]
Sequence[type[RESOURCE_MODEL]]
{"AnnAssign": 1, "Assign": 2, "Expr": 1, "Return": 1}
9
31
9
["and_", "is_", "limit", "offset", "where", "join", "select", "all", "session.scalars"]
0
[]
The function (_retrieve_resources) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 733 and ends at 763. It contains 27 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [733.0] and does not ...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_retrieve_resource_and_post_process
def _retrieve_resource_and_post_process(self,session: Session,identifier: int | str,user: KeycloakUser | None = None,platform: str | None = None,) -> type[RESOURCE_MODEL]:"""Retrieve a resource from the database based on the provided identifierand platform (if applicable). The user parameter can be used by subclasses t...
1
10
5
73
0
765
779
765
self,session,identifier,user,platform
[]
type[RESOURCE_MODEL]
{"AnnAssign": 1, "Assign": 1, "Expr": 1, "Return": 1}
2
15
2
["self._retrieve_resource", "self._mask_or_filter"]
0
[]
The function (_retrieve_resource_and_post_process) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 765 and ends at 779. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [765....
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_retrieve_resources_and_post_process
def _retrieve_resources_and_post_process(self,session: Session,pagination: Pagination,resource_filters: ResourceFilters,user: KeycloakUser | None = None,platform: str | None = None,) -> Sequence[type[RESOURCE_MODEL]]:"""Retrieve a sequence of resources from the database based on the provided identifierand platform (if ...
1
12
6
76
0
781
797
781
self,session,pagination,resource_filters,user,platform
[]
Sequence[type[RESOURCE_MODEL]]
{"AnnAssign": 1, "Expr": 1, "Return": 1}
2
17
2
["self._retrieve_resources", "self._mask_or_filter"]
0
[]
The function (_retrieve_resources_and_post_process) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 781 and ends at 797. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [781...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_mask_or_filter
def _mask_or_filter(resources: Sequence[type[RESOURCE_MODEL]], session: Session, user: KeycloakUser | None) -> Sequence[type[RESOURCE_MODEL]]:"""Can be implemented in children to post process resources based on user rolesor something else."""return resources
1
4
3
34
0
800
807
800
resources,session,user
[]
Sequence[type[RESOURCE_MODEL]]
{"Expr": 1, "Return": 1}
0
8
0
[]
0
[]
The function (_mask_or_filter) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 800 and ends at 807. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [800.0] and does not retur...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_possible_schemas
def _possible_schemas(self) -> list[str]:return ["aiod"] + list(self.schema_converters.keys())
1
2
1
25
0
810
811
810
self
[]
list[str]
{"Return": 1}
2
2
2
["list", "self.schema_converters.keys"]
0
[]
The function (_possible_schemas) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 810 and ends at 811. 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 ...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_possible_schemas_type
def _possible_schemas_type(self):return Annotated[Literal[tuple(self._possible_schemas)],# type: ignoreQuery(description="Return the resource(s) in this schema.",include_in_schema=len(self._possible_schemas) > 1,),]
1
8
1
38
0
814
821
814
self
[]
Returns
{"Return": 1}
3
8
3
["tuple", "Query", "len"]
0
[]
The function (_possible_schemas_type) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 814 and ends at 821. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this funct...
aiondemand_AIOD-rest-api
ResourceRouter
public
1
1
_raise_clean_http_exception
def _raise_clean_http_exception(self, e: Exception, session: Session, resource_create: AIoDConcept):"""Raise an understandable exception based on this SQL IntegrityError."""session.rollback()if isinstance(e, HTTPException):raise eif len(e.args) == 0:traceback.print_exc()raise HTTPException(status_code=status.HTTP_500_I...
16
65
4
358
0
823
894
823
self,e,session,resource_create
[]
None
{"Assign": 10, "Expr": 3, "If": 10}
25
72
25
["session.rollback", "isinstance", "len", "traceback.print_exc", "HTTPException", "isinstance", "HTTPException", "where", "select", "and_", "getattr", "getattr", "is_", "getattr", "first", "session.scalars", "HTTPException", "HTTPException", "where", "select", "first", "session.scalars", "HTTPException", "error.split",...
0
[]
The function (_raise_clean_http_exception) defined within the public class called ResourceRouter, implement an interface, and it inherit another class.The function start at line 823 and ends at 894. It contains 65 lines of code and it has a cyclomatic complexity of 16. It takes 4 parameters, represented as [823.0] and ...
aiondemand_AIOD-rest-api
public
public
0
0
_raise_error_on_invalid_schema
def _raise_error_on_invalid_schema(possible_schemas, schema):if schema not in possible_schemas:raise HTTPException(detail=f"Invalid schema {schema}. Expected {' or '.join(possible_schemas)}",status_code=status.HTTP_400_BAD_REQUEST,)
2
6
2
28
0
897
902
897
possible_schemas,schema
[]
None
{"If": 1}
2
6
2
["HTTPException", "join"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.routers.resource_router_py.ResourceRouter.get_resource", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.routers.resource_router_py.ResourceR...
The function (_raise_error_on_invalid_schema) defined within the public class called public.The function start at line 897 and ends at 902. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [897.0] and does not return any value. It declares 2.0 functions, It has ...
aiondemand_AIOD-rest-api
public
public
0
0
_raise_if_contains_binary_blob
def _raise_if_contains_binary_blob(item):distributions = []if hasattr(item, "distribution") and (distribution := getattr(item, "distribution")):distributions += distributionif hasattr(item, "media") and (media := getattr(item, "media")):distributions += mediaif any((isinstance(item, Distribution) and item.binary_blob) ...
8
11
1
88
1
905
916
905
item
['distributions']
None
{"Assign": 1, "AugAssign": 2, "If": 3}
7
12
7
["hasattr", "getattr", "hasattr", "getattr", "any", "isinstance", "HTTPException"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.routers.resource_router_py.ResourceRouter.put_resource_func", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.routers.resource_router_py.Reso...
The function (_raise_if_contains_binary_blob) defined within the public class called public.The function start at line 905 and ends at 916. It contains 11 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters and does not return any value. It declares 7.0 functions, It has 7.0...
aiondemand_AIOD-rest-api
public
public
0
0
create
def create(url_prefix: str, version: Version) -> APIRouter:router = APIRouter()router.post("/submissions/retract/{submission_identifier}",tags=["Reviewing"],description="Retract an asset under review, setting its status to 'draft'.",)(retract_submission)router.get("/submissions/{identifier}",tags=["Reviewing"],descript...
1
31
2
139
1
28
64
28
url_prefix,version
['router']
APIRouter
{"Assign": 1, "Expr": 5, "Return": 1}
6
37
6
["APIRouter", "router.post", "router.get", "router.get", "router.post", "router.post"]
158
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.deployments.managers_py.PRDeploymentManager.create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3635000_umutbozkurt_django_rest_framework_mongoengine.tests.test_reference_py.ComboRefe...
The function (create) defined within the public class called public.The function start at line 28 and ends at 64. It contains 31 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [28.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions called insid...
aiondemand_AIOD-rest-api
public
public
0
0
_get_single_submission
def _get_single_submission(*,which: Literal[ListMode.NEWEST, ListMode.OLDEST],from_requestee: str | None = None,) -> Submission | None:with DbSession() as session:has_review = select(1).where(Submission.identifier == Review.submission_identifier).exists()submissions = select(Submission).where(~has_review)if which == Li...
3
13
2
121
2
75
88
75
which,from_requestee
['submissions', 'has_review']
Submission | None
{"Assign": 4, "If": 2, "Return": 1, "With": 1}
11
14
11
["DbSession", "exists", "where", "select", "where", "select", "submissions.order_by", "Submission.request_date.desc", "submissions.where", "first", "session.scalars"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.routers.review_router_py.list_submissions"]
The function (_get_single_submission) defined within the public class called public.The function start at line 75 and ends at 88. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [75.0] and does not return any value. It declares 11.0 functions, It has 11.0 func...
aiondemand_AIOD-rest-api
public
public
0
0
_get_submissions_by_state
def _get_submissions_by_state(*,which: Literal[ListMode.COMPLETED, ListMode.PENDING, ListMode.ALL],from_requestee: str | None = None,) -> Sequence[Submission]:with DbSession() as session:has_review = select(1).where(Submission.identifier == Review.submission_identifier).exists()submissions = select(Submission)if which ...
4
15
2
130
2
91
105
91
which,from_requestee
['submissions', 'has_review']
Sequence[Submission]
{"Assign": 5, "If": 3, "Return": 1, "With": 1}
10
15
10
["DbSession", "exists", "where", "select", "select", "submissions.where", "submissions.where", "submissions.where", "all", "session.scalars"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.routers.review_router_py.list_submissions"]
The function (_get_submissions_by_state) defined within the public class called public.The function start at line 91 and ends at 105. It contains 15 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [91.0] and does not return any value. It declares 10.0 functions, It has 10.0 ...
aiondemand_AIOD-rest-api
public
public
0
0
list_submissions
def list_submissions(mode: ListMode = ListMode.NEWEST, user: KeycloakUser = Depends(get_user_or_raise)) -> Sequence[Submission]:# mypy does not do type narrowing properly: https://github.com/python/mypy/issues/12535user_filter = None if user.is_reviewer else user._subject_identifierif mode in [ListMode.NEWEST, ListMode...
5
10
2
104
2
108
118
108
mode,user
['submission', 'user_filter']
Sequence[Submission]
{"Assign": 2, "If": 2, "Return": 2}
4
11
4
["Depends", "_get_single_submission", "_get_submissions_by_state", "ValueError"]
0
[]
The function (list_submissions) defined within the public class called public.The function start at line 108 and ends at 118. It contains 10 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [108.0] and does not return any value. It declares 4.0 functions, and It has 4.0 func...
aiondemand_AIOD-rest-api
public
public
0
0
get_submission
def get_submission(identifier: int,user: KeycloakUser = Depends(get_user_or_raise),session: Session = Depends(get_session),) -> Submission:submission = session.get(Submission, identifier)if not submission:raise HTTPException(status_code=HTTPStatus.NOT_FOUND,detail=f"No submission with identifier {identifier} found.",)i...
4
17
2
88
1
121
137
121
identifier,user,session
['submission']
Submission
{"Assign": 1, "If": 2, "Return": 1}
5
17
5
["Depends", "Depends", "session.get", "HTTPException", "HTTPException"]
0
[]
The function (get_submission) defined within the public class called public.The function start at line 121 and ends at 137. It contains 17 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [121.0] and does not return any value. It declares 5.0 functions, and It has 5.0 functi...
aiondemand_AIOD-rest-api
public
public
0
0
_submit_resource
def _submit_resource(submission: SubmissionCreate,user: KeycloakUser = Depends(get_user_or_raise),):id_to_type = {identifier: get_asset_type_by_abbreviation().get(identifier.split("_")[0])for identifier in submission.asset_identifiers}invalid_identifier = next((identifier for identifier, type_ in id_to_type.items() if ...
8
43
2
265
6
140
187
140
submission,user
['resource', 'id_to_type', 'invalid_identifier', 'router', 'review_request', 'msg']
Returns
{"Assign": 8, "Expr": 3, "For": 1, "If": 3, "Return": 1, "With": 1}
20
48
20
["Depends", "get", "get_asset_type_by_abbreviation", "identifier.split", "next", "id_to_type.items", "HTTPException", "DbSession", "Submission", "id_to_type.items", "get_router_by_type", "cast", "router._retrieve_resource", "HTTPException", "user_can_administer", "HTTPException", "review_request._assets.append", "Asset...
0
[]
The function (_submit_resource) defined within the public class called public.The function start at line 140 and ends at 187. It contains 43 lines of code and it has a cyclomatic complexity of 8. It takes 2 parameters, represented as [140.0], and this function return a value. It declares 20.0 functions, and It has 20....
aiondemand_AIOD-rest-api
public
public
0
0
_review_resource
def _review_resource(review: ReviewCreate,user: KeycloakUser = Depends(get_user_or_raise),session: Session = Depends(get_session),):if not user.is_reviewer:raise HTTPException(status_code=status.HTTP_403_FORBIDDEN,detail="You must have reviewing privileges to use this endpoint.",)submission = session.get(Submission, re...
7
48
2
222
4
190
241
190
review,user,session
['submission', 'review', 'aiod_entry', 'new_status']
Returns
{"Assign": 6, "Expr": 3, "For": 1, "If": 5, "Return": 1}
14
52
14
["Depends", "Depends", "HTTPException", "session.get", "HTTPException", "HTTPException", "register_user", "cast", "session.get", "user_can_write", "HTTPException", "Review", "session.add", "session.commit"]
0
[]
The function (_review_resource) defined within the public class called public.The function start at line 190 and ends at 241. It contains 48 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [190.0], and this function return a value. It declares 14.0 functions, and It has 14....
aiondemand_AIOD-rest-api
public
public
0
0
retract_submission
def retract_submission(submission_identifier: str,user: KeycloakUser = Depends(get_user_or_raise),):with DbSession() as session:submission = session.get(Submission, submission_identifier)if submission is None:return HTTPException(status_code=HTTPStatus.NOT_FOUND,detail=f"Submission {submission_identifier} not found.",)...
6
36
2
189
3
244
282
244
submission_identifier,user
['submission', 'retraction', 'msg']
Returns
{"Assign": 4, "Expr": 2, "For": 1, "If": 3, "Return": 2, "With": 1}
12
39
12
["Depends", "DbSession", "session.get", "HTTPException", "HTTPException", "any", "user_can_administer", "session.get", "HTTPException", "Review", "session.add", "session.commit"]
0
[]
The function (retract_submission) defined within the public class called public.The function start at line 244 and ends at 282. It contains 36 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [244.0], and this function return a value. It declares 12.0 functions, and It has 1...
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
es_index
def es_index(self) -> str:"""The name of the elasticsearch index"""
1
1
1
8
0
41
42
41
self
[]
str
{"Expr": 1}
0
2
0
[]
0
[]
The function (es_index) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 41 and ends at 42. It contains 1 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
SearchRouter
public
1
1
resource_name_plural
def resource_name_plural(self) -> str:"""The name of the resource (plural)"""
1
1
1
8
0
46
47
46
self
[]
str
{"Expr": 1}
0
2
0
[]
0
[]
The function (resource_name_plural) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 46 and ends at 47. It contains 1 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return a...
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
key_translations
def key_translations(self) -> dict[str, str]:"""If an attribute is called differently in elasticsearch than in ourmetadata model, you can define a translation dictionary here. The keyshould be the name in elasticsearch, the value the name in our datamodel."""return {}
1
2
1
16
0
50
55
50
self
[]
dict[str, str]
{"Expr": 1, "Return": 1}
0
6
0
[]
0
[]
The function (key_translations) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 50 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 v...
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
resource_class
def resource_class(self) -> RESOURCE:"""The resource class"""
1
1
1
8
0
59
60
59
self
[]
RESOURCE
{"Expr": 1}
0
2
0
[]
0
[]
The function (resource_class) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 59 and ends at 60. It contains 1 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any val...
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
global_indexed_fields
def global_indexed_fields(self) -> set[str]:"""The set of indexed fields that are mandatory for every entity"""return {"name", "description_plain", "description_html"}
1
2
1
19
0
63
65
63
self
[]
set[str]
{"Expr": 1, "Return": 1}
0
3
0
[]
0
[]
The function (global_indexed_fields) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 63 and ends at 65. 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 ...
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
extra_indexed_fields
def extra_indexed_fields(self) -> set[str]:"""The set of other indexed fields in addition to the global ones"""return set()
1
2
1
15
0
68
70
68
self
[]
set[str]
{"Expr": 1, "Return": 1}
1
3
1
["set"]
0
[]
The function (extra_indexed_fields) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 68 and ends at 70. 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 a...
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
indexed_fields
def indexed_fields(self) -> set[str]:"""The set of indexed fields"""return set.union(self.global_indexed_fields, self.extra_indexed_fields)
1
2
1
24
0
73
75
73
self
[]
set[str]
{"Expr": 1, "Return": 1}
1
3
1
["set.union"]
0
[]
The function (indexed_fields) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 73 and ends at 75. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any val...
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
linked_fields
def linked_fields(self) -> set[str]:"""The set of linked fields (those with aiod 'link' relations)"""return set()
1
2
1
15
0
78
80
78
self
[]
set[str]
{"Expr": 1, "Return": 1}
1
3
1
["set"]
0
[]
The function (linked_fields) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 78 and ends at 80. 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 valu...
aiondemand_AIOD-rest-api
public
public
0
0
create.search
def search(search_query: Annotated[str,Query(description="The text to find. It is used in an ElasticSearch match query.",examples=["Name of the resource"],),],exact_match: Annotated[bool,Query(description="If true, it searches for an exact match.",),] = False,search_fields: Annotated[list[indexed_fields] | None,Query(d...
20
127
1
690
0
93
222
93
null
[]
None
null
0
0
0
null
0
null
The function (create.search) defined within the public class called public.The function start at line 93 and ends at 222. It contains 127 lines of code and it has a cyclomatic complexity of 20. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
create
def create(self, url_prefix: str, version: Version) -> APIRouter:router = APIRouter()versioned_resource = get_versioned_resource(self.resource_class, version)read_class = versioned_resource.resource_class_read# type: ignoreindexed_fields: TypeAlias = Literal[tuple(self.indexed_fields)]# type: ignore@router.get(f"/searc...
1
11
3
72
0
82
224
82
self,url_prefix,version
[]
APIRouter
{"AnnAssign": 4, "Assign": 23, "Expr": 2, "If": 9, "Return": 2, "Try": 1, "With": 1}
28
143
28
["APIRouter", "get_versioned_resource", "tuple", "Query", "Query", "Query", "Query", "Query", "Query", "Query", "Query", "Query", "Query", "DbSession", "select", "all", "session.scalars", "as_http_exception", "issubset", "set", "HTTPException", "must_clause.append", "must_clause.append", "client.search", "Elasticsearch...
158
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.deployments.managers_py.PRDeploymentManager.create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3635000_umutbozkurt_django_rest_framework_mongoengine.tests.test_reference_py.ComboRefe...
The function (create) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 82 and ends at 224. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [82.0] and does not return any value....
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
_db_query
def _db_query(self,orm_to_read: Callable[[Type[AIoDConcept]], Type[SQLModel]],resource_class: RESOURCE,identifiers: list[str],) -> list[SQLModel]:try:with DbSession() as session:filter_ = resource_class.identifier.in_(identifiers)# type: ignore[attr-defined]query = select(resource_class).where(filter_)resources = sessi...
5
23
4
141
0
226
248
226
self,orm_to_read,resource_class,identifiers
[]
list[SQLModel]
{"Assign": 5, "If": 1, "Return": 1, "Try": 1, "With": 1}
12
23
12
["DbSession", "resource_class.identifier.in_", "where", "select", "all", "session.scalars", "set", "HTTPException", "join", "map", "orm_to_read", "as_http_exception"]
0
[]
The function (_db_query) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 226 and ends at 248. It contains 23 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [226.0] and does not return any v...
aiondemand_AIOD-rest-api
SearchRouter
public
1
1
_cast_resource
def _cast_resource(self, read_class: Type[SQLModel], resource_dict: dict[str, Any]) -> Type[RESOURCE]:kwargs = {self.key_translations.get(key, key): valfor key, val in resource_dict.items()if key != "type" and not key.startswith("@") and key not in self.linked_fields}resource = read_class(**kwargs)resource.aiod_entry =...
7
21
3
156
0
250
271
250
self,read_class,resource_dict
[]
Type[RESOURCE]
{"Assign": 4, "Expr": 1, "For": 1, "If": 1, "Return": 1}
8
22
8
["self.key_translations.get", "resource_dict.items", "key.startswith", "read_class", "AIoDEntryRead", "resource_dict.get", "setattr", "split"]
0
[]
The function (_cast_resource) defined within the public class called SearchRouter, implement an interface, and it inherit another class.The function start at line 250 and ends at 271. It contains 21 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [250.0] and does not return ...
aiondemand_AIOD-rest-api
public
public
0
0
create.get_versioned_resources_for_user
def get_versioned_resources_for_user(pagination: PaginationParams,user: KeycloakUser = Depends(get_user_or_raise),session: Session = Depends(get_session),) -> dict[str, list[AIoDConcept]]:limit: int | None = pagination.limitif limit == 10 and version == Version.V2:limit = Noneresources = _get_resources_for_user(user,se...
6
22
2
131
0
49
71
49
null
[]
None
null
0
0
0
null
0
null
The function (create.get_versioned_resources_for_user) defined within the public class called public.The function start at line 49 and ends at 71. It contains 22 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [49.0] and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
create
def create(url_prefix: str, version: Version) -> APIRouter:router = APIRouter()# We define a custom response class here to ensure all the asset# types are included, and the (schema) documentation is generated.# It also makes sure assets are deserialized the same way as# direct access would have.suffix = version.prefix....
3
24
2
107
7
20
73
20
url_prefix,version
['limit', 'orm_to_read', 'suffix', 'router', 'Catalogue', 'resources_for_user_description', 'resources']
APIRouter
{"AnnAssign": 1, "Assign": 7, "AugAssign": 1, "If": 2, "Return": 2}
12
54
12
["APIRouter", "version.prefix.capitalize", "create_model", "Field", "items", "get_all_read_classes", "Depends", "Depends", "_get_resources_for_user", "versioned_routers.get", "resources.items", "router.get"]
158
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.deployments.managers_py.PRDeploymentManager.create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3635000_umutbozkurt_django_rest_framework_mongoengine.tests.test_reference_py.ComboRefe...
The function (create) defined within the public class called public.The function start at line 20 and ends at 73. It contains 24 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [20.0] and does not return any value. It declares 12.0 functions, It has 12.0 functions called ins...
aiondemand_AIOD-rest-api
public
public
0
0
_get_resources_for_user
def _get_resources_for_user(user: KeycloakUser,session: Session,*,offset: int = 0,limit: int | None = None,) -> dict[str, list[AIoDConcept]]:# "Ownership" is currently equivalent to having ADMIN permissionsstmt = (select(AIoDEntryORM).join(Permission.aiod_entry).where(Permission.user_identifier == user._subject_identif...
6
33
4
228
6
76
112
76
user,session,offset,limit
['entries', 'asset_types', 'assets', 'assets_to_fetch', 'stmt', 'query']
dict[str, list[AIoDConcept]]
{"AnnAssign": 1, "Assign": 8, "For": 1, "If": 2, "Return": 1}
21
37
21
["offset", "where", "join", "select", "stmt.limit", "all", "session.scalars", "list", "non_abstract_subclasses", "where", "where", "select", "asset_type.aiod_entry_identifier.in_", "asset_type.date_deleted.is_", "all", "session.scalars", "list", "sum", "map", "found_assets.values", "len"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95056621_aiondemand_AIOD_rest_api.src.routers.user_router_py.create"]
The function (_get_resources_for_user) defined within the public class called public.The function start at line 76 and ends at 112. It contains 33 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [76.0] and does not return any value. It declares 21.0 functions, It has 21.0 fu...
aiondemand_AIOD-rest-api
EnumRouter
public
1
1
__init__
def __init__(self, resource_class: Type[NamedRelation]):self.resource_class = resource_classself.resource_name = resource_class.__tablename__self.resource_name_plural = (self.resource_name + "s" if not self.resource_name.endswith("s") else self.resource_name)
2
6
2
49
0
18
23
18
self,resource_class
[]
None
{"Assign": 3}
1
6
1
["self.resource_name.endswith"]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called EnumRouter, implement an interface, and it inherit another class.The function start at line 18 and ends at 23. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [18.0] and does not return any value. I...
aiondemand_AIOD-rest-api
EnumRouter
public
1
1
create
def create(self, url_prefix: str, version: Version = Version.LATEST) -> APIRouter:router = APIRouter()default_kwargs = {"response_model_exclude_none": True,"tags": ["enums"],}router.add_api_route(path=f"/{self.resource_name_plural}",endpoint=self.get_resources_func(),response_model=list[str],name=self.resource_name,**d...
1
14
3
74
0
25
39
25
self,url_prefix,version
[]
APIRouter
{"Assign": 2, "Expr": 1, "Return": 1}
3
15
3
["APIRouter", "router.add_api_route", "self.get_resources_func"]
158
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.deployments.managers_py.PRDeploymentManager.create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3635000_umutbozkurt_django_rest_framework_mongoengine.tests.test_reference_py.ComboRefe...
The function (create) defined within the public class called EnumRouter, implement an interface, and it inherit another class.The function start at line 25 and ends at 39. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [25.0] and does not return any value. It...
aiondemand_AIOD-rest-api
public
public
0
0
get_resources_func.get_resources
def get_resources():with DbSession() as session:query = select(self.resource_class)resources = session.scalars(query).all()return [r.name for r in resources]
2
5
0
41
0
42
46
42
null
[]
None
null
0
0
0
null
0
null
The function (get_resources_func.get_resources) defined within the public class called public.The function start at line 42 and ends at 46. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
EnumRouter
public
1
1
get_resources_func
def get_resources_func(self):def get_resources():with DbSession() as session:query = select(self.resource_class)resources = session.scalars(query).all()return [r.name for r in resources]return get_resources
1
3
1
9
0
41
48
41
self
[]
Returns
{"Assign": 2, "Return": 2, "With": 1}
4
8
4
["DbSession", "select", "all", "session.scalars"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3915747_balena_io_balena_sdk_python.tests.functional.models.test_tag_py.BaseTagTest.test_remove"]
The function (get_resources_func) defined within the public class called EnumRouter, implement an interface, and it inherit another class.The function start at line 41 and ends at 48. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return...
aiondemand_AIOD-rest-api
EnumRouter
public
1
1
create_resource
def create_resource(self, session: Session, resource_create_instance: str):# Used by synchronization.py: router.create_resourceresource = self.resource_class(name=resource_create_instance)session.add(resource)session.commit()return resource
1
5
3
36
0
50
55
50
self,session,resource_create_instance
[]
Returns
{"Assign": 1, "Expr": 2, "Return": 1}
3
6
3
["self.resource_class", "session.add", "session.commit"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70001713_aws_controllers_k8s_test_infra.src.acktest.k8s.resource_py.load_and_create_resource"]
The function (create_resource) defined within the public class called EnumRouter, implement an interface, and it inherit another class.The function start at line 50 and ends at 55. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [50.0], and this function return...
aiondemand_AIOD-rest-api
TaxonomyRouter
public
0
1
__init__
def __init__(self, resource_class: Type[Taxonomy]):super().__init__(resource_class)
1
2
2
20
0
25
26
25
self,resource_class
[]
None
{"Expr": 1}
2
2
2
["__init__", "super"]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called TaxonomyRouter, that inherit another class.The function start at line 25 and ends at 26. It contains 2 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 2.0 functio...
aiondemand_AIOD-rest-api
TaxonomyRouter
public
0
1
create
def create(self, url_prefix: str, version: Version = Version.LATEST) -> APIRouter:router = APIRouter()default_kwargs = {"response_model_exclude_none": True,"tags": ["Taxonomies"],"endpoint": self.get_official_terms_func(),"response_model": list[TaxonomyHierarchy],"name": self.resource_name,}new_path = f"/{self.resource...
3
28
3
123
0
28
56
28
self,url_prefix,version
[]
APIRouter
{"Assign": 4, "Expr": 2, "If": 1, "Return": 1}
5
29
5
["APIRouter", "self.get_official_terms_func", "self.resource_class.__plural__.replace", "router.add_api_route", "router.add_api_route"]
158
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.deployments.managers_py.PRDeploymentManager.create", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3635000_umutbozkurt_django_rest_framework_mongoengine.tests.test_reference_py.ComboRefe...
The function (create) defined within the public class called TaxonomyRouter, that inherit another class.The function start at line 28 and ends at 56. It contains 28 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [28.0] and does not return any value. It declares 5.0 function...
aiondemand_AIOD-rest-api
public
public
0
0
get_official_terms_func.create_hierarchical_representation
def create_hierarchical_representation(term):children = [create_hierarchical_representation(t) for t in term.children]return TaxonomyHierarchy(term=term.name, definition=term.definition, subterms=children)
2
3
1
38
0
59
61
59
null
[]
None
null
0
0
0
null
0
null
The function (get_official_terms_func.create_hierarchical_representation) defined within the public class called public.The function start at line 59 and ends at 61. It contains 3 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
public
public
0
0
get_official_terms_func.get_official
def get_official():with DbSession() as session:query = select(self.resource_class)resources = session.scalars(query).all()# TODO: With Pydantic V2 this can be 'automatic' by using `serialization_alias`taxonomies = [create_hierarchical_representation(term)for term in resourcesif term.official and term.parent is None]ret...
4
10
0
55
0
63
73
63
null
[]
None
null
0
0
0
null
0
null
The function (get_official_terms_func.get_official) defined within the public class called public.The function start at line 63 and ends at 73. It contains 10 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
TaxonomyRouter
public
0
1
get_official_terms_func
def get_official_terms_func(self):def create_hierarchical_representation(term):children = [create_hierarchical_representation(t) for t in term.children]return TaxonomyHierarchy(term=term.name, definition=term.definition, subterms=children)def get_official():with DbSession() as session:query = select(self.resource_class...
1
4
1
11
0
58
75
58
self
[]
Returns
{"Assign": 4, "Return": 3, "With": 1}
7
18
7
["create_hierarchical_representation", "TaxonomyHierarchy", "DbSession", "select", "all", "session.scalars", "create_hierarchical_representation"]
0
[]
The function (get_official_terms_func) defined within the public class called TaxonomyRouter, that inherit another class.The function start at line 58 and ends at 75. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It decl...
aiondemand_AIOD-rest-api
AgentRouter
public
0
1
resource_name
def resource_name(self) -> str:return "agent"
1
2
1
9
0
10
11
10
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (resource_name) defined within the public class called AgentRouter, that inherit another class.The function start at line 10 and ends at 11. 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
AgentRouter
public
0
1
resource_name_plural
def resource_name_plural(self) -> str:return "agents"
1
2
1
9
0
14
15
14
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (resource_name_plural) defined within the public class called AgentRouter, that inherit another class.The function start at line 14 and ends at 15. 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
AgentRouter
public
0
1
parent_class
def parent_class(self) -> Type[Agent]:return Agent
1
2
1
12
0
18
19
18
self
[]
Type[Agent]
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95100531_dfxml_working_group_dfxml_python.tests.test_objects_py.test_AbstractHierarchyObject_append"]
The function (parent_class) defined within the public class called AgentRouter, that inherit another class.The function start at line 18 and ends at 19. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 1.0 function calli...
aiondemand_AIOD-rest-api
AgentRouter
public
0
1
parent_class_table
def parent_class_table(self) -> Type[AgentTable]:return AgentTable
1
2
1
12
0
22
23
22
self
[]
Type[AgentTable]
{"Return": 1}
0
2
0
[]
0
[]
The function (parent_class_table) defined within the public class called AgentRouter, that inherit another class.The function start at line 22 and ends at 23. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
AIAssetRouter
public
0
1
resource_name
def resource_name(self) -> str:return "ai_asset"
1
2
1
9
0
10
11
10
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (resource_name) defined within the public class called AIAssetRouter, that inherit another class.The function start at line 10 and ends at 11. 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
AIAssetRouter
public
0
1
resource_name_plural
def resource_name_plural(self) -> str:return "ai_assets"
1
2
1
9
0
14
15
14
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (resource_name_plural) defined within the public class called AIAssetRouter, that inherit another class.The function start at line 14 and ends at 15. 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
AIAssetRouter
public
0
1
parent_class
def parent_class(self) -> Type[AIAsset]:return AIAsset
1
2
1
12
0
18
19
18
self
[]
Type[AIAsset]
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95100531_dfxml_working_group_dfxml_python.tests.test_objects_py.test_AbstractHierarchyObject_append"]
The function (parent_class) defined within the public class called AIAssetRouter, that inherit another class.The function start at line 18 and ends at 19. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 1.0 function cal...
aiondemand_AIOD-rest-api
AIAssetRouter
public
0
1
parent_class_table
def parent_class_table(self) -> Type[AIAssetTable]:return AIAssetTable
1
2
1
12
0
22
23
22
self
[]
Type[AIAssetTable]
{"Return": 1}
0
2
0
[]
0
[]
The function (parent_class_table) defined within the public class called AIAssetRouter, that inherit another class.The function start at line 22 and ends at 23. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
aiondemand_AIOD-rest-api
AIResourceRouter
public
0
1
resource_name
def resource_name(self) -> str:return "ai_resource"
1
2
1
9
0
10
11
10
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (resource_name) defined within the public class called AIResourceRouter, that inherit another class.The function start at line 10 and ends at 11. 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
AIResourceRouter
public
0
1
resource_name_plural
def resource_name_plural(self) -> str:return "ai_resources"
1
2
1
9
0
14
15
14
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (resource_name_plural) defined within the public class called AIResourceRouter, that inherit another class.The function start at line 14 and ends at 15. 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
AIResourceRouter
public
0
1
parent_class
def parent_class(self) -> Type[AIResource]:return AIResource
1
2
1
12
0
18
19
18
self
[]
Type[AIResource]
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95100531_dfxml_working_group_dfxml_python.tests.test_objects_py.test_AbstractHierarchyObject_append"]
The function (parent_class) defined within the public class called AIResourceRouter, that inherit another class.The function start at line 18 and ends at 19. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 1.0 function ...
aiondemand_AIOD-rest-api
AIResourceRouter
public
0
1
parent_class_table
def parent_class_table(self) -> Type[AIResourceORM]:return AIResourceORM
1
2
1
12
0
22
23
22
self
[]
Type[AIResourceORM]
{"Return": 1}
0
2
0
[]
0
[]
The function (parent_class_table) defined within the public class called AIResourceRouter, that inherit another class.The function start at line 22 and ends at 23. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..