@@ -98,6 +98,14 @@ def __repr__(self) -> str:
9898UNDEFINED = Undefined ()
9999
100100
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+
101109class DebugRepr (reprlib .Repr ):
102110 def __init__ (self ) -> None :
103111 super ().__init__ ()
@@ -418,7 +426,7 @@ def state(self, value: State) -> None:
418426 self ._variables_object_cache .clear ()
419427 self ._evaluate_cache .clear ()
420428
421- time .sleep (0.01 )
429+ time .sleep (STATE_CHANGE_DELAY )
422430
423431 self ._state = value
424432
@@ -813,7 +821,7 @@ def wait_for_running(self) -> None:
813821 self ._evaluated_keyword_result = e
814822 finally :
815823 self ._evaluate_keyword_event .set ()
816- self ._after_evaluate_keyword_event .wait (120 )
824+ self ._after_evaluate_keyword_event .wait (EVALUATE_TIMEOUT )
817825
818826 continue
819827
@@ -1636,10 +1644,10 @@ def get_variables(
16361644
16371645 for i , (k , v ) in enumerate (value .items (), start or 0 ):
16381646 result [repr (i )] = self ._create_variable (repr (k ), v )
1639- if i >= 500 :
1647+ if i >= MAX_VARIABLE_ITEMS_DISPLAY :
16401648 result ["Unable to handle" ] = self ._create_variable (
16411649 "Unable to handle" ,
1642- "Maximum number of items (500 ) reached." ,
1650+ f "Maximum number of items ({ MAX_VARIABLE_ITEMS_DISPLAY } ) reached." ,
16431651 )
16441652 break
16451653
@@ -1870,7 +1878,7 @@ def run_kw() -> Any:
18701878
18711879 def _create_evaluate_result (self , value : Any ) -> EvaluateResult :
18721880 self ._evaluate_cache .insert (0 , value )
1873- if len (self ._evaluate_cache ) > 50 :
1881+ if len (self ._evaluate_cache ) > MAX_EVALUATE_CACHE_SIZE :
18741882 self ._evaluate_cache .pop ()
18751883
18761884 if isinstance (value , Mapping ):
@@ -1910,7 +1918,7 @@ def run_in_robot_thread(self, kw: Callable[[], Any]) -> Any:
19101918 self .condition .notify_all ()
19111919
19121920 try :
1913- self ._evaluate_keyword_event .wait (60 )
1921+ self ._evaluate_keyword_event .wait (KEYWORD_EVALUATION_TIMEOUT )
19141922 finally :
19151923 result = self ._evaluated_keyword_result
19161924
@@ -1927,7 +1935,7 @@ def run_in_robot_thread(self, kw: Callable[[], Any]) -> Any:
19271935
19281936 def _create_set_variable_result (self , value : Any ) -> SetVariableResult :
19291937 self ._evaluate_cache .insert (0 , value )
1930- if len (self ._evaluate_cache ) > 50 :
1938+ if len (self ._evaluate_cache ) > MAX_EVALUATE_CACHE_SIZE :
19311939 self ._evaluate_cache .pop ()
19321940
19331941 if isinstance (value , Mapping ):
0 commit comments