rajkumarrawal commited on
Commit
05859a6
·
1 Parent(s): 4294d6f

fix: correct indentation in AgentManager.__getstate__ to fix IndentationError

Browse files

The __getstate__ method in AgentManager had an indentation issue where the code handling non-serializable objects was misplaced. The comments and performance_metrics cleanup logic were not properly indented under the method body, causing an IndentationError. Fixed by indenting the relevant code block to be part of the method's implementation.

__pycache__/autonomous_engine.cpython-312.pyc DELETED
Binary file (70.6 kB)
 
app.py CHANGED
@@ -228,17 +228,17 @@ class AgentManager:
228
  def __getstate__(self):
229
  """Custom pickling to handle non-serializable objects."""
230
  state = self.__dict__.copy()
231
- # Remove any non-serializable objects if they exist
232
- # Remove performance metrics that might contain non-serializable objects
233
- if '_performance_metrics' in state:
234
- # Create a copy without thread-locked objects
235
- safe_metrics = state['_performance_metrics'].copy()
236
- # Ensure all values are serializable
237
- for key, value in safe_metrics.items():
238
- if hasattr(value, '__dict__') and not isinstance(value, (list, dict, str, int, float, bool)):
239
- safe_metrics[key] = str(value)
240
- state['_performance_metrics'] = safe_metrics
241
- return state
242
 
243
  def __setstate__(self, state):
244
  """Custom unpickling to restore object state."""
 
228
  def __getstate__(self):
229
  """Custom pickling to handle non-serializable objects."""
230
  state = self.__dict__.copy()
231
+ # Remove any non-serializable objects if they exist
232
+ # Remove performance metrics that might contain non-serializable objects
233
+ if '_performance_metrics' in state:
234
+ # Create a copy without thread-locked objects
235
+ safe_metrics = state['_performance_metrics'].copy()
236
+ # Ensure all values are serializable
237
+ for key, value in safe_metrics.items():
238
+ if hasattr(value, '__dict__') and not isinstance(value, (list, dict, str, int, float, bool)):
239
+ safe_metrics[key] = str(value)
240
+ state['_performance_metrics'] = safe_metrics
241
+ return state
242
 
243
  def __setstate__(self, state):
244
  """Custom unpickling to restore object state."""