generated from nullndr/pyproj
fixes
This commit is contained in:
@@ -13,19 +13,19 @@ class Tree:
|
|||||||
return f"{leaf}"
|
return f"{leaf}"
|
||||||
return "<empty>"
|
return "<empty>"
|
||||||
|
|
||||||
def build_tree(args: Tuple):
|
def build_tree(args):
|
||||||
if args == None:
|
if args == None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if not isinstance(args, tuple):
|
if not isinstance(args, tuple):
|
||||||
raise "Invalid argument"
|
raise RuntimeError("Invalid argument")
|
||||||
|
|
||||||
if len(args) != 3:
|
if len(args) != 3:
|
||||||
raise "Invalid number of parameters in the tuple"
|
raise RuntimeError("Invalid number of parameters in the tuple")
|
||||||
|
|
||||||
value, right, left = args
|
value, right, left = args
|
||||||
|
|
||||||
if (not isinstance(right, tuple) and right != None) or (not isinstance(left, tuple) and left != None):
|
if (not isinstance(right, tuple) and right != None) or (not isinstance(left, tuple) and left != None):
|
||||||
raise "Nodes must be tuples"
|
raise RuntimeError("Nodes must be tuples")
|
||||||
|
|
||||||
return Tree(value, build_tree(right), build_tree(left))
|
return Tree(value, build_tree(right), build_tree(left))
|
||||||
|
|||||||
Reference in New Issue
Block a user