-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.py
More file actions
24 lines (19 loc) · 714 Bytes
/
util.py
File metadata and controls
24 lines (19 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
""" Utilities and helpers for microcli.
"""
from enum import Enum
class Void(Enum):
""" This Enum represents values that haven't been supplied. It is intended
to provide more information None, while also being distinct from None
(this makes it useful for introspecting and metaprogramming, where None
could be a regular Python value and is therefore unsuited to flagging
missing information).
"""
UNKNOWN = 1
UNDEFINED = 2
NIL = 3
def __bool__(self):
# Like None, Void values are falsy
return False
def __str__(self):
# Return a title-cased version of the instance's name
return f"{self.name.title()}-({self.value})"