Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quality-kpi
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rivera Alcalde, Andrés Daniel
quality-kpi
Commits
f0988ace
Commit
f0988ace
authored
2 years ago
by
Hock, Martin
Browse files
Options
Downloads
Patches
Plain Diff
Docstrings, formatting. Rewrite of sum_kpi.
parent
d805baa7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
functions/calculation_rules.py
+34
-6
34 additions, 6 deletions
functions/calculation_rules.py
with
34 additions
and
6 deletions
functions/calculation_rules.py
+
34
−
6
View file @
f0988ace
...
...
@@ -4,20 +4,48 @@ File consists of several functions for the calculation rules of FAIR Quality KPI
def
test_function
():
"""
Test function to check module functionality
"""
print
(
"
You called the test function.
"
)
# Function to calculate KPIS that use sums
# Or function to calculate the mass with sum?
def
kpi_sum
(
*
args
):
return
sum
(
args
[
0
])
"""
Calculates the sum of one or more integers or lists.
Args:
*args: One or more integers or lists.
Returns:
total (int): The sum of all given integers and/or the sum
of all items in all given lists.
Raises:
TypeError: If an argument with unsupported type is passed
(i.e. anything other than int or list).
"""
total
=
0
for
arg
in
args
:
if
isinstance
(
arg
,
int
):
# Check if argument is an integer
total
+=
arg
elif
isinstance
(
arg
,
list
):
# Check if argument is a list
total
+=
sum
(
arg
)
else
:
raise
TypeError
(
f
"
Unsupported type
{
type
(
arg
)
}
passed to kpi_sum()
"
)
return
total
# if arguments are handed over not as a list: sum(list(args))
# KPI for calculating some real complicated metric
# Add new functions for calculating some real complicated metrics
if
__name__
==
"
__main__
"
:
"""
Function to inform that functions in this module is
intended for import not usage as script
"""
print
(
"
This script contains functions for calculating the FAIR Quality KPIs. It is not to be executed independently.
"
"
This script contains functions for calculating the FAIR Quality KPIs.
"
"
It is not to be executed independently.
"
)
pass
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment