@@ -98,6 +98,14 @@ def __repr__(self) -> str:
98
98
UNDEFINED = Undefined ()
99
99
100
100
101
+ # Debugger configuration constants
102
+ STATE_CHANGE_DELAY = 0.01 # Delay to avoid busy loops during state changes
103
+ EVALUATE_TIMEOUT = 120 # Timeout for keyword evaluation in seconds
104
+ KEYWORD_EVALUATION_TIMEOUT = 60 # Timeout for keyword evaluation wait in seconds
105
+ MAX_EVALUATE_CACHE_SIZE = 50 # Maximum number of items in evaluate cache
106
+ MAX_VARIABLE_ITEMS_DISPLAY = 500 # Maximum items to display in variable view
107
+
108
+
101
109
class DebugRepr (reprlib .Repr ):
102
110
def __init__ (self ) -> None :
103
111
super ().__init__ ()
@@ -418,7 +426,7 @@ def state(self, value: State) -> None:
418
426
self ._variables_object_cache .clear ()
419
427
self ._evaluate_cache .clear ()
420
428
421
- time .sleep (0.01 )
429
+ time .sleep (STATE_CHANGE_DELAY )
422
430
423
431
self ._state = value
424
432
@@ -813,7 +821,7 @@ def wait_for_running(self) -> None:
813
821
self ._evaluated_keyword_result = e
814
822
finally :
815
823
self ._evaluate_keyword_event .set ()
816
- self ._after_evaluate_keyword_event .wait (120 )
824
+ self ._after_evaluate_keyword_event .wait (EVALUATE_TIMEOUT )
817
825
818
826
continue
819
827
@@ -1636,10 +1644,10 @@ def get_variables(
1636
1644
1637
1645
for i , (k , v ) in enumerate (value .items (), start or 0 ):
1638
1646
result [repr (i )] = self ._create_variable (repr (k ), v )
1639
- if i >= 500 :
1647
+ if i >= MAX_VARIABLE_ITEMS_DISPLAY :
1640
1648
result ["Unable to handle" ] = self ._create_variable (
1641
1649
"Unable to handle" ,
1642
- "Maximum number of items (500 ) reached." ,
1650
+ f "Maximum number of items ({ MAX_VARIABLE_ITEMS_DISPLAY } ) reached." ,
1643
1651
)
1644
1652
break
1645
1653
@@ -1870,7 +1878,7 @@ def run_kw() -> Any:
1870
1878
1871
1879
def _create_evaluate_result (self , value : Any ) -> EvaluateResult :
1872
1880
self ._evaluate_cache .insert (0 , value )
1873
- if len (self ._evaluate_cache ) > 50 :
1881
+ if len (self ._evaluate_cache ) > MAX_EVALUATE_CACHE_SIZE :
1874
1882
self ._evaluate_cache .pop ()
1875
1883
1876
1884
if isinstance (value , Mapping ):
@@ -1910,7 +1918,7 @@ def run_in_robot_thread(self, kw: Callable[[], Any]) -> Any:
1910
1918
self .condition .notify_all ()
1911
1919
1912
1920
try :
1913
- self ._evaluate_keyword_event .wait (60 )
1921
+ self ._evaluate_keyword_event .wait (KEYWORD_EVALUATION_TIMEOUT )
1914
1922
finally :
1915
1923
result = self ._evaluated_keyword_result
1916
1924
@@ -1927,7 +1935,7 @@ def run_in_robot_thread(self, kw: Callable[[], Any]) -> Any:
1927
1935
1928
1936
def _create_set_variable_result (self , value : Any ) -> SetVariableResult :
1929
1937
self ._evaluate_cache .insert (0 , value )
1930
- if len (self ._evaluate_cache ) > 50 :
1938
+ if len (self ._evaluate_cache ) > MAX_EVALUATE_CACHE_SIZE :
1931
1939
self ._evaluate_cache .pop ()
1932
1940
1933
1941
if isinstance (value , Mapping ):
0 commit comments