소스 검색

some pylint improvements

George C. Privon 9 년 전
부모
커밋
1f672ca9aa
1개의 변경된 파일7개의 추가작업 그리고 8개의 파일을 삭제
  1. 7 8
      email_stats.py

+ 7 - 8
email_stats.py

@@ -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(),