2020-12-08 01:59:34 +00:00
|
|
|
import argparse
|
2023-12-31 22:17:00 +00:00
|
|
|
import PIL.Image
|
2019-06-12 05:41:31 +00:00
|
|
|
import glob
|
|
|
|
import math
|
|
|
|
import os
|
|
|
|
import random
|
|
|
|
import re
|
2022-11-03 01:41:30 +00:00
|
|
|
import string
|
2019-06-12 05:41:31 +00:00
|
|
|
import sys
|
|
|
|
|
|
|
|
from voussoirkit import pipeable
|
|
|
|
|
|
|
|
def quote(s):
|
|
|
|
return '"%s"' % s
|
|
|
|
|
|
|
|
def apostrophe(s):
|
|
|
|
return "'%s'" % s
|
|
|
|
|
|
|
|
def random_hex(length=12):
|
|
|
|
randbytes = os.urandom(math.ceil(length / 2))
|
|
|
|
token = ''.join('{:02x}'.format(x) for x in randbytes)
|
|
|
|
token = token[:length]
|
|
|
|
return token
|
|
|
|
|
2020-12-08 01:59:34 +00:00
|
|
|
def eval_argparse(args):
|
|
|
|
for line in pipeable.input(args.lines):
|
|
|
|
x = line
|
2021-05-25 08:35:46 +00:00
|
|
|
pipeable.stdout(eval(args.eval_string))
|
2020-12-08 01:59:34 +00:00
|
|
|
|
2021-09-24 06:42:34 +00:00
|
|
|
return 0
|
|
|
|
|
2020-12-08 01:59:34 +00:00
|
|
|
def main(argv):
|
|
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
|
|
|
|
|
|
parser.add_argument('lines')
|
|
|
|
parser.add_argument('eval_string')
|
|
|
|
parser.set_defaults(func=eval_argparse)
|
|
|
|
|
|
|
|
args = parser.parse_args(argv)
|
|
|
|
return args.func(args)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
raise SystemExit(main(sys.argv[1:]))
|