MCPcopy Create free account
hub / github.com/SkyworkAI/DeepResearchAgent / get_source_code

Method get_source_code

src/dynamic/server.py:357–370  ·  view source on GitHub ↗

Extract source code of a class or callable object if possible. Args: object: The class or callable object to extract source code from Returns: Source code string if available, None otherwise

(self, object: Union[Type['T'], Callable])

Source from the content-addressed store, hash-verified

355 '<' in module_name)
356
357 def get_source_code(self, object: Union[Type['T'], Callable]) -> Optional[str]:
358 """Extract source code of a class or callable object if possible.
359
360 Args:
361 object: The class or callable object to extract source code from
362
363 Returns:
364 Source code string if available, None otherwise
365 """
366 try:
367 return inspect.getsource(object)
368 except (OSError, TypeError):
369 # Source code not available (e.g., dynamically generated, compiled, etc.)
370 return None
371
372 def get_full_module_source(self, cls: Type) -> str:
373 """Get the full source code of the module containing the class, including all imports.

Callers 10

registerMethod · 0.80
updateMethod · 0.80
copyMethod · 0.80
registerMethod · 0.80
updateMethod · 0.80
copyMethod · 0.80
registerMethod · 0.80
updateMethod · 0.80
copyMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected