|
|
@ -217,6 +217,17 @@ def get_prev_node_of_type(node, type): |
|
|
|
return current |
|
|
|
return None |
|
|
|
|
|
|
|
def get_upper_node_of_type(node, type): |
|
|
|
# vrací první vyšší node daného typu (ignoruje sourozence) |
|
|
|
if node is None: |
|
|
|
return |
|
|
|
current = node |
|
|
|
while get_parent(current) is not None: |
|
|
|
current = get_parent(current) |
|
|
|
if isinstance(current, type): |
|
|
|
return current |
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Exception, kterou některé metody při špatném použití mohou házet |
|
|
|