This repository has been archived on 2019-12-12. You can view files and clone it, but cannot push or open issues/pull-requests.
tildetown-scripts/tildetown-py/util.py

21 lines
395 B
Python
Raw Normal View History

2015-07-28 22:05:52 +00:00
def slurp(file_path):
contents = None
2015-08-01 04:07:51 +00:00
try:
2015-08-01 04:13:58 +00:00
with open(file_path, 'r', encoding="utf-8") as f:
2015-08-01 04:07:51 +00:00
contents = f.read()
except FileNotFoundError:
pass
2015-08-01 04:13:58 +00:00
except UnicodeDecodeError:
2015-08-01 05:03:02 +00:00
pass
return contents
2015-07-28 22:05:52 +00:00
def thread(initial, *fns):
value = initial
for fn in fns:
value = fn(value)
return value
2015-07-29 00:33:42 +00:00
def p(x):
print(x)
return x