36 lines
857 B
Python
36 lines
857 B
Python
|
#!/usr/bin/env python3
|
||
|
from functools import reduce
|
||
|
from itertools import permutations, product, combinations, pairwise, groupby
|
||
|
from more_itertools import batched
|
||
|
from collections import defaultdict, deque
|
||
|
import re, sys
|
||
|
import math
|
||
|
import numpy as np
|
||
|
import cv2 as cv
|
||
|
from icecream import ic
|
||
|
|
||
|
def commaline(line):
|
||
|
return [int(n) for n in line.strip().split(',')]
|
||
|
|
||
|
def headerfooter(f):
|
||
|
return f.read().split('\n\n', maxsplit=1)
|
||
|
|
||
|
def pgphs(text):
|
||
|
return text.split('\n\n')
|
||
|
|
||
|
def hfl(f): # header footer lines
|
||
|
return [p.strip().split('\n') for p in headerfooter(f)]
|
||
|
|
||
|
def lines(f):
|
||
|
return [l.strip() for l in f.readlines()]
|
||
|
|
||
|
def dprint(*args):
|
||
|
sep = False
|
||
|
for arg in args:
|
||
|
if sep:
|
||
|
print('--------')
|
||
|
sep = True
|
||
|
for a, b in arg.items():
|
||
|
print('%10s: %s' % (a, ','.join(b)))
|
||
|
print()
|