Przeglądaj źródła

Moved (duplicated) matplotlib backend configuration to Core/__init__.py

Stefan Schmidt 6 lat temu
rodzic
commit
342d5e5d1e
3 zmienionych plików z 3 dodań i 9 usunięć
  1. 0 4
      code/Core/Statistics.py
  2. 3 0
      code/Core/__init__.py
  3. 0 5
      code/ID2TLib/Utility.py

+ 0 - 4
code/Core/Statistics.py

@@ -8,14 +8,10 @@ from operator import itemgetter
 # TODO: double check this import
 # does it complain because libpcapreader is not a .py?
 import ID2TLib.libpcapreader as pr
-import matplotlib
-
 import Core.StatsDatabase as statsDB
 import ID2TLib.PcapFile as PcapFile
 import ID2TLib.Utility as Util
 from ID2TLib.IPv4 import IPAddress
-
-matplotlib.use('Cairo', force=True)
 import matplotlib.pyplot as plt
 
 

+ 3 - 0
code/Core/__init__.py

@@ -0,0 +1,3 @@
+# Set the required backend as early as possible to avoid conflicts
+import matplotlib as mplt
+mplt.use('Cairo', force=True)

+ 0 - 5
code/ID2TLib/Utility.py

@@ -3,11 +3,6 @@ import datetime as dt
 import ipaddress
 import os
 import random as rnd
-
-import matplotlib
-import scipy.stats as stats
-
-matplotlib.use('Cairo', force=True)
 import lea
 import xdg.BaseDirectory as BaseDir
 import scapy.layers.inet as inet