debugging fn

master
nathaniel smith 2015-07-28 17:33:42 -07:00
parent b1e504331e
commit d070d6c2eb
2 changed files with 7 additions and 2 deletions

View File

@ -4,13 +4,12 @@ from os import listdir
from os.path import getmtime, join from os.path import getmtime, join
from datetime import datetime from datetime import datetime
from sh import find, facter from sh import find, facter
from util import slurp, thread from util import slurp, thread, p
# this script emits json on standard out that has information about tilde.town # this script emits json on standard out that has information about tilde.town
# users. It denotes who has not updated their page from the default. It also # users. It denotes who has not updated their page from the default. It also
# reports the time this script was run. The user list is sorted by public_html update time. # reports the time this script was run. The user list is sorted by public_html update time.
DEFAULT_HTML = slurp("/etc/skel/public_html/index.html") DEFAULT_HTML = slurp("/etc/skel/public_html/index.html")
username_to_html_path = lambda u: "/home/{}/public_html".format(u) username_to_html_path = lambda u: "/home/{}/public_html".format(u)
@ -29,11 +28,13 @@ def guarded_mtime(path):
return 0 return 0
def modify_time(username): def modify_time(username):
p(username)
files_to_mtimes = partial(map, guarded_mtime) files_to_mtimes = partial(map, guarded_mtime)
return thread(username, return thread(username,
username_to_html_path, username_to_html_path,
bounded_find, bounded_find,
files_to_mtimes, files_to_mtimes,
p
list, list,
max) max)

View File

@ -9,3 +9,7 @@ def thread(initial, *fns):
for fn in fns: for fn in fns:
value = fn(value) value = fn(value)
return value return value
def p(x):
print(x)
return x