3 from irclib
import irc_lower
5 from globals import private
7 def get_timestamp(when
=None):
10 return time
.ctime(when
) + " " + time
.tzname
[time
.daylight
]
12 def resize(list_or_tuple
, length
):
13 '''Creates a new list or tuple of length 'length', using as many elements from
14 list_or_tuple as possible and right-padding with "". Does not modify
16 if len(list_or_tuple
) < length
:
17 if type(list_or_tuple
) == list:
18 return list_or_tuple
+ [""] * (length
- len(list_or_tuple
))
20 return list_or_tuple
+ ("",) * (length
- len(list_or_tuple
))
22 return list_or_tuple
[:length
]
24 def extract(dbs
, key
, default_maker
):
26 default
= default_maker()
30 def extract_my_db(dbs
, who
, where
, default_maker
):
35 return extract(dbs
, key
, default_maker
)
37 def real_where(who
, where
):
48 def multiunion(*sets
):
51 result
= result
.union(s
)
54 def ircdict_to_set(my_dict
):
55 return Set([irc_lower(key
) for key
in my_dict
])