-
-
Save altendky/df74405c0f6d58fa2ca15bfcc7a3fe20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
epoch2stat = { | |
key: val | |
for key, val in iteritems({ | |
k: tuple( | |
(lambda stats: stats)( | |
tuple(imap(itemgetter(1), v)) | |
) | |
) | |
for k, v in groupby(sorted( | |
imap( | |
lambda l: (l[0], l[1]), | |
ifilter( | |
None, | |
imap( | |
lambda l: ( | |
lambda fst: ( | |
lambda three: ( | |
( | |
int(three), | |
l.rstrip()[l.rfind(':') + 2:], | |
) | |
if ( | |
three is not None | |
and three.isdigit() | |
and int(three[0]) < 4 | |
else None | |
) | |
)( | |
l[fst - 3:fst] | |
if fst > -1 | |
else None | |
) | |
)(l.rfind(']')), | |
infile, | |
), | |
), | |
), | |
key=itemgetter(0), | |
), | |
itemgetter(0), | |
)) | |
}) | |
if val and len(val) == 2 | |
} | |
# ----- | |
def a(): | |
return groupby(sorted( | |
imap( | |
lambda l: (l[0], l[1]), | |
ifilter( | |
None, | |
imap( | |
lambda l: ( | |
lambda fst: ( | |
lambda three: ( | |
( | |
int(three), | |
l.rstrip()[l.rfind(':') + 2:], | |
) | |
if ( | |
three is not None | |
and three.isdigit() | |
and int(three[0]) < 4 | |
else None | |
) | |
)( | |
l[fst - 3:fst] | |
if fst > -1 | |
else None | |
) | |
)(l.rfind(']')), | |
infile, | |
), | |
), | |
), | |
key=itemgetter(0), | |
), | |
itemgetter(0), | |
)) | |
def b(grouped): | |
for k, v in grouped: | |
v = tuple(imap(itemgetter(1), v)) | |
if len(v) == 2: | |
yield (k, v) | |
epoch2stat = dict(b(a())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment