Skip to content

Commit 2f5dbad

Browse files
committed
Fix Ruff SIM108 lint error: use ternary operator
Replace if-else block with ternary operator at line 302 to comply with Ruff linting rules
1 parent 0c6897c commit 2f5dbad

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

data_structures/binary_tree/splay_tree.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,7 @@ def search(self, key: Any) -> bool:
299299
self._splay(current)
300300
return True
301301
parent = current
302-
if key < current.key:
303-
current = current.left
304-
else:
305-
current = current.right
302+
current = current.left if key < current.key else current.right
306303

307304
# Key not found, splay the last accessed node
308305
if parent is not None:

0 commit comments

Comments
 (0)