blob: 62e579846b52bed06ade1a37b3e1959bc5c3fa0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/bin/env python3
import os
import string_utils
def is_running_as_root() -> bool:
return os.geteuid() == 0
def is_are(n: int) -> str:
if n == 1:
return "is"
return "are"
def pluralize(n: int) -> str:
if n == 1:
return ""
return "s"
def thify(n: int) -> str:
digit = str(n)
assert string_utils.is_integer_number(digit)
digit = digit[-1:]
if digit == "1":
return "st"
elif digit == "2":
return "nd"
elif digit == "3":
return "rd"
else:
return "th"
|