Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

Commit 7087127

Browse files
jayanthchandraChase Roberts
authored andcommitted
Fix unsafe None checks (#449)
* None checks added for constructors * Changes in None check and resolve comments
1 parent 5d6ffc9 commit 7087127

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tensornetwork/network_components.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __init__(self,
6969
"""
7070

7171
self.is_disabled = False
72-
if not name:
72+
if name is None:
7373
name = '__unnamed_node__'
7474
else:
7575
if not isinstance(name, str):
@@ -554,7 +554,7 @@ def __init__(self,
554554
#always use the `Node`'s backend
555555
backend = tensor.backend
556556
tensor = tensor.tensor
557-
if not backend:
557+
if backend is None:
558558
backend = get_default_backend()
559559
if isinstance(backend, BaseBackend):
560560
backend_obj = backend
@@ -715,7 +715,7 @@ def __init__(self,
715715
backend with a tf.Dtype=tf.floa32, `dtype` has to be `np.float32`.
716716
"""
717717

718-
if not backend:
718+
if backend is None:
719719
backend = get_default_backend()
720720
backend_obj = backend_factory.get_backend(backend)
721721

@@ -924,7 +924,7 @@ def __init__(self,
924924
raise ValueError(
925925
"node2 and axis2 must either be both None or both not be None")
926926
self.is_disabled = False
927-
if not name:
927+
if name is None:
928928
name = '__unnamed_edge__'
929929
else:
930930
if not isinstance(name, str):

0 commit comments

Comments
 (0)