Answers value converted to int if same value, otherwise answer float. >>> asIntOrFloat(100.00) 100 >>> asIntOrFloat(100) 100 >>> asIntOrFloat(100.12) 100.12
(value)
| 156 | return default |
| 157 | |
| 158 | def asIntOrFloat(value): |
| 159 | """Answers value converted to int if same value, otherwise answer float. |
| 160 | |
| 161 | >>> asIntOrFloat(100.00) |
| 162 | 100 |
| 163 | >>> asIntOrFloat(100) |
| 164 | 100 |
| 165 | >>> asIntOrFloat(100.12) |
| 166 | 100.12 |
| 167 | """ |
| 168 | if value == math.inf: |
| 169 | value = XXXL |
| 170 | iValue = int(value) |
| 171 | if iValue == value: |
| 172 | return iValue |
| 173 | return value |
| 174 | |
| 175 | def asFormatted(value, default=None, hasFormat=None): |
| 176 | """Answers the formatted string of value. Use the format string if defined. |
no outgoing calls
no test coverage detected