fixes
Some checks failed
Run tests / test (push) Failing after 15s
Code Quality / lint (push) Successful in 18s

This commit is contained in:
2026-01-25 23:45:07 +01:00
parent 02f60b1d7e
commit b3811a26fa
2 changed files with 6 additions and 4 deletions

2
.pylintrc Normal file
View File

@@ -0,0 +1,2 @@
[MAIN]
source-roots=src/

View File

@@ -13,19 +13,19 @@ class Tree:
return f"{leaf}"
return "<empty>"
def build_tree(args: Tuple):
def build_tree(args):
if args == None:
return None
if not isinstance(args, tuple):
raise "Invalid argument"
raise RuntimeError("Invalid argument")
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
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))