Skip to content

Commit

Permalink
Merge pull request #449 from dengzq1234/instance#428
Browse files Browse the repository at this point in the history
fix children validation and urllib import. Fixes #428 #430
  • Loading branch information
jhcepas authored Mar 29, 2020
2 parents 0b84a2a + 5e290f5 commit 766f211
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ete3/coretype/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ def _set_up(self, value):
def _get_children(self):
return self._children
def _set_children(self, value):
if type(value) == list and \
len(set([type(n)==type(self) for n in value]))<2:
if type(value) == list:
for n in value:
if type(n) != type(self):
raise TreeError("Incorrect child node type")
self._children = value
else:
raise TreeError("Incorrect children type")
Expand Down
6 changes: 4 additions & 2 deletions ete3/treeview/faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@
isfinite = lambda n: n and _isfinite(n)

try:
from urllib2 import urlopen
except ImportError:
# For Python 3.0 and later
from urllib.request import urlopen
except ImportError:
# Fall back to Python 2's urllib2
from urllib2 import urlopen

import six
from six.moves import map
Expand Down

0 comments on commit 766f211

Please # to comment.