Browse Source

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

Stefan Schmidt 6 years ago
parent
commit
342d5e5d1e
3 changed files with 3 additions and 9 deletions
  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
 # TODO: double check this import
 # does it complain because libpcapreader is not a .py?
 # does it complain because libpcapreader is not a .py?
 import ID2TLib.libpcapreader as pr
 import ID2TLib.libpcapreader as pr
-import matplotlib
-
 import Core.StatsDatabase as statsDB
 import Core.StatsDatabase as statsDB
 import ID2TLib.PcapFile as PcapFile
 import ID2TLib.PcapFile as PcapFile
 import ID2TLib.Utility as Util
 import ID2TLib.Utility as Util
 from ID2TLib.IPv4 import IPAddress
 from ID2TLib.IPv4 import IPAddress
-
-matplotlib.use('Cairo', force=True)
 import matplotlib.pyplot as plt
 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 ipaddress
 import os
 import os
 import random as rnd
 import random as rnd
-
-import matplotlib
-import scipy.stats as stats
-
-matplotlib.use('Cairo', force=True)
 import lea
 import lea
 import xdg.BaseDirectory as BaseDir
 import xdg.BaseDirectory as BaseDir
 import scapy.layers.inet as inet
 import scapy.layers.inet as inet