Skip to content

Commit af9c3ca

Browse files
Natasha ChetwyndNatasha Chetwynd
authored andcommitted
suppression function
1 parent 7e65912 commit af9c3ca

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

codonPython/suppression.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,36 @@
1-
import math
1+
def suppress_value(valuein: int, rc:str = '*')->str:
2+
"""
3+
Suppress values less than or equal to 7
4+
5+
This function takes the metric value and suppresses it if it is less than or equal to 7.
6+
If the metric value is 0 then it will remain as 0.
7+
8+
Parameters
9+
----------
10+
valuein : int
11+
Metric value
12+
rc : str
13+
Replacement character if value needs suppressing
14+
15+
Returns
16+
-------
17+
out : str
18+
Suppressed value (*), 0 or valuein if greater than 7
19+
20+
Examples
21+
--------
22+
>>> suppress_value(3)
23+
'*'
24+
>>> suppress_value(24)
25+
'24'
26+
>>> suppress_value(0)
27+
'0'
28+
"""
29+
30+
if valuein ==0:
31+
valueout = str(valuein)
32+
if 1 <= valuein <= 7:
33+
valueout = rc
34+
if valuein >7:
35+
valueout = str(valuein)
36+
return valueout

0 commit comments

Comments
 (0)