|
|
@@ -6,7 +6,7 @@
|
|
|
# - Time vs date plots of emails
|
|
|
# - Recipients domains as a function of time
|
|
|
#
|
|
|
-# Copyright 2015-2016 George C. Privon
|
|
|
+# Copyright 2015-2017 George C. Privon
|
|
|
#
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
@@ -25,7 +25,6 @@
|
|
|
import mailbox
|
|
|
import datetime
|
|
|
import matplotlib.pyplot as plt
|
|
|
-import matplotlib.dates as mdates
|
|
|
import argparse
|
|
|
import re
|
|
|
import numpy as np
|
|
|
@@ -72,14 +71,14 @@ for msg in a:
|
|
|
print("Skipping message from " + msg['date'])
|
|
|
continue
|
|
|
dateID = r"${0:1d}-{1:02d}$".format(z.year, z.month)
|
|
|
- if not(dateID in senders.keys()):
|
|
|
+ if dateID not in senders.keys():
|
|
|
senders[dateID] = np.zeros(len(domains) + 1)
|
|
|
dmatch = False
|
|
|
for i, domain in enumerate(domains):
|
|
|
if not(msg['To'] is None) and re.search(domain, msg['To']):
|
|
|
senders[dateID][i+1] += 1
|
|
|
dmatch = True
|
|
|
- if not(dmatch):
|
|
|
+ if not dmatch:
|
|
|
senders[dateID][0] += 1
|
|
|
if args.sendercolors:
|
|
|
for search in enumerate(slist):
|
|
|
@@ -107,8 +106,8 @@ scolor = cubehelix.cmap(startHue=240, endHue=-300,
|
|
|
|
|
|
if args.sendercolors:
|
|
|
for plid in enumerate(slist):
|
|
|
- plt.plot_date(np.array(pldata[plid[1]])[:,0],
|
|
|
- np.array(pldata[plid[1]])[:,1],
|
|
|
+ plt.plot_date(np.array(pldata[plid[1]])[:, 0],
|
|
|
+ np.array(pldata[plid[1]])[:, 1],
|
|
|
color=scolor(plid[0] / (nsend + 1)),
|
|
|
marker='.',
|
|
|
#tz=z.tzname(),
|
|
|
@@ -116,8 +115,8 @@ if args.sendercolors:
|
|
|
xdate=True)
|
|
|
|
|
|
if len(pldata['unknown']) > 0:
|
|
|
- plt.plot_date(np.array(pldata['unknown'])[:,0],
|
|
|
- np.array(pldata['unknown'])[:,1],
|
|
|
+ plt.plot_date(np.array(pldata['unknown'])[:, 0],
|
|
|
+ np.array(pldata['unknown'])[:, 1],
|
|
|
color=scolor(1),
|
|
|
marker='.',
|
|
|
#tz=z.tzname(),
|