Bladeren bron

Release: 8a325608d1

master
Dirk Alders 4 jaren geleden
bovenliggende
commit
a12e00bb81
4 gewijzigde bestanden met toevoegingen van 10881 en 6047 verwijderingen
  1. 55
    0
      __init__.py
  2. 235
    0
      _testresults_/coverage.xml
  3. 10591
    6047
      _testresults_/unittest.json
  4. BIN
      _testresults_/unittest.pdf

+ 55
- 0
__init__.py Bestand weergeven

@@ -33,6 +33,7 @@ from stringtools import stp
33 33
 from stringtools import csp
34 34
 __DEPENDENCIES__ = []
35 35
 
36
+import fractions
36 37
 import gzip
37 38
 import logging
38 39
 import time
@@ -56,6 +57,60 @@ __all__ = ['gzip_compress',
56 57
            'stp']
57 58
 
58 59
 
60
+def physical_value_repr(value, unit=''):
61
+    prefix = {
62
+        -4: 'p',
63
+        -3: 'n',
64
+        -2: 'µ',
65
+        -1: 'm',
66
+        0: '',
67
+        1: 'k',
68
+        2: 'M',
69
+        3: 'G',
70
+        4: 'T',
71
+        5: 'P',
72
+    }
73
+    u = 0
74
+    while u > -4 and u < 5 and (value >= 1000. or value < 1.):
75
+        if value >= 1:
76
+            u += 1
77
+            value /= 1000.
78
+        else:
79
+            u -= 1
80
+            value *= 1000.
81
+    if u == 0:
82
+        ext = ''
83
+    else:
84
+        ext = prefix[u]
85
+    #
86
+    if value < 100.:
87
+        value = '%.2f' % (value)
88
+    else:
89
+        value = '%.1f' % (value)
90
+    while value.find('.') > -1 and (value.endswith('0') or value.endswith('.')):
91
+        value = value[:-1]
92
+    return value + ext + unit
93
+
94
+
95
+def time_repr(seconds):
96
+    days = seconds / (24 * 60 * 60)
97
+    seconds = seconds % (24 * 60 * 60)
98
+    if seconds >= 60 * 60:
99
+        rv = time.strftime('%H:%M:%S', time.gmtime(seconds))
100
+    else:
101
+        rv = time.strftime('%M:%S', time.gmtime(seconds))
102
+    if days >= 1:
103
+        rv = '%dD %s' % (days, rv)
104
+    if rv.endswith(' 00:00'):
105
+        rv = rv[:-6]
106
+    return rv
107
+
108
+
109
+def frac_repr(value):
110
+    f = fractions.Fraction(value).limit_denominator()
111
+    return '%s/%s' % (f.numerator, f.denominator)
112
+
113
+
59 114
 def gzip_compress(s, compresslevel=9):
60 115
     """
61 116
     Method to compress a stream of bytes.

+ 235
- 0
_testresults_/coverage.xml Bestand weergeven

@@ -0,0 +1,235 @@
1
+<?xml version="1.0" ?>
2
+<coverage branch-rate="0.9767" branches-covered="84" branches-valid="86" complexity="0" line-rate="1" lines-covered="208" lines-valid="208" timestamp="1580751729089" version="4.5">
3
+	<!-- Generated by coverage.py: https://coverage.readthedocs.io -->
4
+	<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
5
+	<sources/>
6
+	<packages>
7
+		<package branch-rate="0.9767" complexity="0" line-rate="1" name=".user_data.data.dirk.prj.unittest.stringtools.pylibs.stringtools">
8
+			<classes>
9
+				<class branch-rate="0.9375" complexity="0" filename="/user_data/data/dirk/prj/unittest/stringtools/pylibs/stringtools/__init__.py" line-rate="1" name="__init__.py">
10
+					<methods/>
11
+					<lines>
12
+						<line hits="1" number="4"/>
13
+						<line hits="1" number="32"/>
14
+						<line hits="1" number="33"/>
15
+						<line hits="1" number="34"/>
16
+						<line hits="1" number="36"/>
17
+						<line hits="1" number="37"/>
18
+						<line hits="1" number="38"/>
19
+						<line hits="1" number="39"/>
20
+						<line hits="1" number="40"/>
21
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="41"/>
22
+						<line hits="1" number="42"/>
23
+						<line hits="1" number="44"/>
24
+						<line hits="1" number="45"/>
25
+						<line hits="1" number="47"/>
26
+						<line hits="1" number="50"/>
27
+						<line hits="1" number="53"/>
28
+						<line hits="1" number="60"/>
29
+						<line hits="1" number="61"/>
30
+						<line hits="1" number="73"/>
31
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="74"/>
32
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="75"/>
33
+						<line hits="1" number="76"/>
34
+						<line hits="1" number="77"/>
35
+						<line hits="1" number="79"/>
36
+						<line hits="1" number="80"/>
37
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="81"/>
38
+						<line hits="1" number="82"/>
39
+						<line hits="1" number="84"/>
40
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="86"/>
41
+						<line hits="1" number="87"/>
42
+						<line hits="1" number="89"/>
43
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="90"/>
44
+						<line hits="1" number="91"/>
45
+						<line hits="1" number="92"/>
46
+						<line hits="1" number="95"/>
47
+						<line hits="1" number="96"/>
48
+						<line hits="1" number="97"/>
49
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="98"/>
50
+						<line hits="1" number="99"/>
51
+						<line hits="1" number="101"/>
52
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="102"/>
53
+						<line hits="1" number="103"/>
54
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="104"/>
55
+						<line hits="1" number="105"/>
56
+						<line hits="1" number="106"/>
57
+						<line hits="1" number="109"/>
58
+						<line hits="1" number="110"/>
59
+						<line hits="1" number="111"/>
60
+						<line hits="1" number="114"/>
61
+						<line hits="1" number="131"/>
62
+						<line hits="1" number="132"/>
63
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="133"/>
64
+						<line hits="1" number="134"/>
65
+						<line hits="1" number="136"/>
66
+						<line hits="1" number="137"/>
67
+						<line hits="1" number="138"/>
68
+						<line hits="1" number="139"/>
69
+						<line hits="1" number="141"/>
70
+						<line hits="1" number="142"/>
71
+						<line hits="1" number="143"/>
72
+						<line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="146" number="144"/>
73
+						<line hits="1" number="145"/>
74
+						<line hits="1" number="146"/>
75
+						<line hits="1" number="149"/>
76
+						<line hits="1" number="165"/>
77
+						<line hits="1" number="166"/>
78
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="167"/>
79
+						<line hits="1" number="168"/>
80
+						<line hits="1" number="170"/>
81
+						<line hits="1" number="171"/>
82
+						<line hits="1" number="172"/>
83
+						<line hits="1" number="173"/>
84
+						<line hits="1" number="175"/>
85
+						<line hits="1" number="176"/>
86
+						<line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="179" number="177"/>
87
+						<line hits="1" number="178"/>
88
+						<line hits="1" number="179"/>
89
+						<line hits="1" number="182"/>
90
+						<line hits="1" number="197"/>
91
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="198"/>
92
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="199"/>
93
+						<line hits="1" number="200"/>
94
+						<line hits="1" number="202"/>
95
+						<line hits="1" number="203"/>
96
+						<line hits="1" number="206"/>
97
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="213"/>
98
+						<line hits="1" number="214"/>
99
+						<line hits="1" number="216"/>
100
+					</lines>
101
+				</class>
102
+				<class branch-rate="1" complexity="0" filename="/user_data/data/dirk/prj/unittest/stringtools/pylibs/stringtools/csp.py" line-rate="1" name="csp.py">
103
+					<methods/>
104
+					<lines>
105
+						<line hits="1" number="4"/>
106
+						<line hits="1" number="22"/>
107
+						<line hits="1" number="24"/>
108
+						<line hits="1" number="25"/>
109
+						<line hits="1" number="27"/>
110
+						<line hits="1" number="28"/>
111
+						<line hits="1" number="30"/>
112
+						<line hits="1" number="33"/>
113
+						<line hits="1" number="44"/>
114
+						<line hits="1" number="46"/>
115
+						<line hits="1" number="47"/>
116
+						<line hits="1" number="48"/>
117
+						<line hits="1" number="50"/>
118
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="58"/>
119
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="59"/>
120
+						<line hits="1" number="60"/>
121
+						<line hits="1" number="62"/>
122
+						<line hits="1" number="63"/>
123
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="64"/>
124
+						<line hits="1" number="65"/>
125
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="66"/>
126
+						<line hits="1" number="67"/>
127
+						<line hits="1" number="68"/>
128
+						<line hits="1" number="71"/>
129
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="86"/>
130
+						<line hits="1" number="87"/>
131
+						<line hits="1" number="89"/>
132
+					</lines>
133
+				</class>
134
+				<class branch-rate="1" complexity="0" filename="/user_data/data/dirk/prj/unittest/stringtools/pylibs/stringtools/stp.py" line-rate="1" name="stp.py">
135
+					<methods/>
136
+					<lines>
137
+						<line hits="1" number="4"/>
138
+						<line hits="1" number="22"/>
139
+						<line hits="1" number="24"/>
140
+						<line hits="1" number="25"/>
141
+						<line hits="1" number="27"/>
142
+						<line hits="1" number="28"/>
143
+						<line hits="1" number="30"/>
144
+						<line hits="1" number="32"/>
145
+						<line hits="1" number="34"/>
146
+						<line hits="1" number="36"/>
147
+						<line hits="1" number="39"/>
148
+						<line hits="1" number="41"/>
149
+						<line hits="1" number="43"/>
150
+						<line hits="1" number="45"/>
151
+						<line hits="1" number="49"/>
152
+						<line hits="1" number="60"/>
153
+						<line hits="1" number="62"/>
154
+						<line hits="1" number="63"/>
155
+						<line hits="1" number="64"/>
156
+						<line hits="1" number="65"/>
157
+						<line hits="1" number="67"/>
158
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="68"/>
159
+						<line hits="1" number="69"/>
160
+						<line hits="1" number="70"/>
161
+						<line hits="1" number="72"/>
162
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="80"/>
163
+						<line hits="1" number="81"/>
164
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="82"/>
165
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="83"/>
166
+						<line hits="1" number="84"/>
167
+						<line hits="1" number="86"/>
168
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="88"/>
169
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="89"/>
170
+						<line hits="1" number="90"/>
171
+						<line hits="1" number="92"/>
172
+						<line hits="1" number="93"/>
173
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="95"/>
174
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="96"/>
175
+						<line hits="1" number="97"/>
176
+						<line hits="1" number="98"/>
177
+						<line hits="1" number="100"/>
178
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="101"/>
179
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="102"/>
180
+						<line hits="1" number="103"/>
181
+						<line hits="1" number="104"/>
182
+						<line hits="1" number="105"/>
183
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="106"/>
184
+						<line hits="1" number="107"/>
185
+						<line hits="1" number="108"/>
186
+						<line hits="1" number="110"/>
187
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="111"/>
188
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="112"/>
189
+						<line hits="1" number="113"/>
190
+						<line hits="1" number="114"/>
191
+						<line hits="1" number="116"/>
192
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="117"/>
193
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="118"/>
194
+						<line hits="1" number="119"/>
195
+						<line hits="1" number="120"/>
196
+						<line hits="1" number="121"/>
197
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="122"/>
198
+						<line hits="1" number="123"/>
199
+						<line hits="1" number="124"/>
200
+						<line hits="1" number="125"/>
201
+						<line hits="1" number="126"/>
202
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="127"/>
203
+						<line hits="1" number="128"/>
204
+						<line hits="1" number="129"/>
205
+						<line hits="1" number="130"/>
206
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="131"/>
207
+						<line hits="1" number="132"/>
208
+						<line hits="1" number="133"/>
209
+						<line hits="1" number="134"/>
210
+						<line hits="1" number="136"/>
211
+						<line hits="1" number="137"/>
212
+						<line hits="1" number="138"/>
213
+						<line hits="1" number="140"/>
214
+						<line hits="1" number="141"/>
215
+						<line hits="1" number="142"/>
216
+						<line hits="1" number="143"/>
217
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="144"/>
218
+						<line hits="1" number="145"/>
219
+						<line hits="1" number="146"/>
220
+						<line hits="1" number="149"/>
221
+						<line hits="1" number="164"/>
222
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="166"/>
223
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="167"/>
224
+						<line hits="1" number="168"/>
225
+						<line branch="true" condition-coverage="100% (2/2)" hits="1" number="169"/>
226
+						<line hits="1" number="170"/>
227
+						<line hits="1" number="172"/>
228
+						<line hits="1" number="174"/>
229
+						<line hits="1" number="175"/>
230
+					</lines>
231
+				</class>
232
+			</classes>
233
+		</package>
234
+	</packages>
235
+</coverage>

+ 10591
- 6047
_testresults_/unittest.json
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


BIN
_testresults_/unittest.pdf Bestand weergeven


Laden…
Annuleren
Opslaan