5 def bitmask_str(map, value
):
7 for mask
in sorted(map.keys()):
8 if value
& mask
: ret
.append(map[mask
])
17 def opath_validchar(c
):
18 # _ is also escaped even though it is valid
20 string
.ascii_letters
.find(c
) != -1 or \
21 string
.digits
.find(c
) != -1
26 # TODO find a more elegant way
27 if not opath_validchar(c
):
33 def opath_unescape(s
):
35 unhex
= lambda xx
: chr(eval("0x"+xx
))
37 return re
.sub("_.._", lambda p
: unhex(p
.group()[1:3]), s
)
39 def dump_time(unixtime
):
40 return time
.asctime(time
.localtime(unixtime
))