Raise TypeError instead of allowing default none return.
This commit is contained in:
parent
9d69e8ce8c
commit
f76fef06b8
1 changed files with 4 additions and 3 deletions
|
@ -363,15 +363,16 @@ class Mega:
|
||||||
return node
|
return node
|
||||||
if isinstance(node, int):
|
if isinstance(node, int):
|
||||||
return self.get_node_by_type(node)[1]
|
return self.get_node_by_type(node)[1]
|
||||||
|
raise TypeError(f'Invalid node {node}.')
|
||||||
|
|
||||||
def normalize_node_id(self, node):
|
def normalize_node_id(self, node):
|
||||||
if node is None:
|
if node is None:
|
||||||
return self._root_node_id
|
return self._root_node_id
|
||||||
elif isinstance(node, int):
|
if isinstance(node, int):
|
||||||
return self.get_node_by_type(node)[1]['h']
|
return self.get_node_by_type(node)[1]['h']
|
||||||
elif isinstance(node, dict):
|
if isinstance(node, dict):
|
||||||
return node['h']
|
return node['h']
|
||||||
elif isinstance(node, str):
|
if isinstance(node, str):
|
||||||
return node
|
return node
|
||||||
else:
|
else:
|
||||||
raise TypeError(f'Invalid node {node}.')
|
raise TypeError(f'Invalid node {node}.')
|
||||||
|
|
Loading…
Reference in a new issue