Convert rate string (`"100/m"`, `"2/h"` or `"0.5/s"`) to seconds.
(r: str)
| 251 | |
| 252 | |
| 253 | def rate(r: str) -> float: |
| 254 | """Convert rate string (`"100/m"`, `"2/h"` or `"0.5/s"`) to seconds.""" |
| 255 | if r: |
| 256 | if isinstance(r, str): |
| 257 | ops, _, modifier = r.partition('/') |
| 258 | return RATE_MODIFIER_MAP[modifier or 's'](float(ops)) or 0 |
| 259 | return r or 0 |
| 260 | return 0 |
| 261 | |
| 262 | |
| 263 | def weekday(name: str) -> int: |
no outgoing calls