Skip to content

Commit

Permalink
Update layout.py
Browse files Browse the repository at this point in the history
Bring `None` comparisons in line with PEP 8: "Comparisons to singletons like None should always be done with `is` or `is not`, never the equality operators." Also, satisfy "FutureWarning: comparison to `None` will result in an elementwise object comparison in the future."
  • Loading branch information
dhimmel committed Jul 23, 2015
1 parent 585bb3e commit 2ae63c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions networkx/drawing/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def _fruchterman_reingold(A, dim=2, k=None, pos=None, fixed=None,

A=np.asarray(A) # make sure we have an array instead of a matrix

if pos==None:
if pos is None:
# random initial positions
pos=np.asarray(np.random.random((nnodes,dim)),dtype=A.dtype)
else:
Expand Down Expand Up @@ -398,15 +398,15 @@ def _sparse_fruchterman_reingold(A, dim=2, k=None, pos=None, fixed=None,
except:
A=(coo_matrix(A)).tolil()

if pos==None:
if pos is None:
# random initial positions
pos=np.asarray(np.random.random((nnodes,dim)),dtype=A.dtype)
else:
# make sure positions are of same type as matrix
pos=pos.astype(A.dtype)

# no fixed nodes
if fixed==None:
if fixed is None:
fixed=[]

# optimal distance between nodes
Expand Down

0 comments on commit 2ae63c5

Please sign in to comment.