botlib.utils

lib local helper functions.

Exceptions

ENODATE date cannot be determined.
class Completer(options)[source]

Bases: rlcompleter.Completer

complete(text, state)[source]
cdir(path)[source]
check_permissions(path, dirmask=448, filemask=384)[source]
close_history()[source]
copydir(orig, dest)[source]
copyright()[source]
dated(object)[source]

fetch the date from an object.

day()[source]

” return the current day.

days(object)[source]

calculate the time passed since an object got logged.

elapsed(seconds, short=True)[source]

return a string showing the elapsed days, hours, minutes, seconds.

enable_history()[source]
extract_time(daystr)[source]

use standard time timeformats to extract a time from a string.

file_time(timestamp)[source]

return a pseudo random time on today’s start of the day.

fn_time(daystr)[source]

determine the time used in a BOTLIB filename.

fromstring(txt)[source]
get_day(daystring)[source]

get the day from the string provided.

get_hour(daystr)[source]

get the hour from the string provided.

get_path(object)[source]

Return the path used to store the object’s json dump.

get_saved(object)[source]

return the saved attribue of an object.

get_time(txt)[source]

get time from a string containing day and/or hour.

get_url(url, **kwargs)[source]
hms()[source]

return hour:minutes:seconds of toda=y.

locatedir(path, match='')[source]
locked(func, *args, **kwargs)[source]
make_opts(options)[source]
make_signature(object)[source]
n(object)[source]
name(object)[source]
now()[source]

turn a datetime string of the current time.

parse_cli(*args, **kwargs)[source]
parse_time(txt)[source]

” parse a string for a time mentioned. also parse for a diff in seconds.

pathname(path)[source]
pname(object)[source]
reboot()[source]
reset()[source]
root()[source]

return the root directory.

rtime()[source]

return a filestamp usable in a filename.

set_completer(optionlist)[source]
smooth(obj)[source]
sname(object)[source]
split_txt(txt, l=450)[source]
startup()[source]
strip_html(text)[source]
stripped(jid)[source]
termreset(fd, old)[source]
termsetup(fd)[source]
timed(object)[source]

calculated the time of an object.

tname(object)[source]
to_date(*args, **kwargs)[source]

convert to date.

to_day(daystring)[source]

try to detect a time in a string.

to_time(daystr)[source]

convert time/date string to a unix timestamp

example: 2016-08-29 16:34:23.837288 example: Sat Jan 14 00:02:29 2017

today()[source]

” return the day of a filename.

touch(fname)[source]
unescape(text)[source]
urled(object)[source]

return a url for the object so it can be fetched with the REST service.

useragent()[source]
userhost(u)[source]
verify_signature(object, signature)[source]
year()[source]

return the year we are living in.