Skip to content

Commit 1ae0369

Browse files
committed
Avoiding the need to propagate global variables in python
1 parent cfd5e58 commit 1ae0369

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

python/__init__.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,6 @@
66
# which can be found in the LICENSE file in the root directory, or at
77
# http://opensource.org/licenses/BSD-2-Clause
88
#
9-
10-
# Attempt to import matplotlib.pyplot and save whether or not this succeeded
11-
try:
12-
import numpy as np
13-
import matplotlib as mpl
14-
import matplotlib.pyplot as plt
15-
havePyPlot=True
16-
except:
17-
havePyPlot=False
18-
print 'Could not import matplotlib.pyplot'
19-
20-
if havePyPlot:
21-
try:
22-
import networkx as nx
23-
haveNetworkX = True
24-
except:
25-
haveNetworkX = False
26-
print 'Could not import networkx'
27-
else:
28-
haveNetworkX = False
29-
309
from core import *
3110
from blas_like import *
3211
from io import *

python/io.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,26 @@
99
from El.core import *
1010
from El.blas_like import Copy, CopyFromRoot, CopyFromNonRoot, RealPart, ImagPart
1111

12+
# Attempt to import matplotlib.pyplot and save whether or not this succeeded
13+
try:
14+
import numpy as np
15+
import matplotlib as mpl
16+
import matplotlib.pyplot as plt
17+
havePyPlot=True
18+
except:
19+
havePyPlot=False
20+
print 'Could not import matplotlib.pyplot'
21+
22+
if havePyPlot:
23+
try:
24+
import networkx as nx
25+
haveNetworkX = True
26+
except:
27+
haveNetworkX = False
28+
print 'Could not import networkx'
29+
else:
30+
haveNetworkX = False
31+
1232
# Input/Output
1333
# ************
1434

0 commit comments

Comments
 (0)