12 lines
331 B
Python
12 lines
331 B
Python
|
"""Utility functions."""
|
||
|
|
||
|
|
||
|
def drop_start(s: str, start: str) -> str:
|
||
|
"""Remove text from the start of a string."""
|
||
|
return s[len(start) :] if s.startswith(start) else s
|
||
|
|
||
|
|
||
|
def plural(num: int, label: str) -> str:
|
||
|
"""Make plural version of label as appropriate."""
|
||
|
return f'{num:,d} {label}{"s" if num != 1 else ""}'
|