tessl install tessl/pypi-ipython@9.5.0IPython: Productive Interactive Computing - An advanced interactive computing environment and command shell for Python.
Agent Success
Agent success rate when using this tile
86%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.09x
Baseline
Agent success rate without this tile
79%
Build a custom extension manager for tracking and managing extension lifecycles in an interactive environment.
Create a system that manages extensions with the following capabilities:
Your implementation should provide:
'already loaded' when attempting to load an extension that's already loaded'no load function' when a module doesn't have the required load function'not loaded' when attempting to unload an extension that isn't loaded'no unload function' when a module doesn't have an unload functionNone for successful operationsCreate test files that verify the following behaviors:
@generates
class ExtensionManager:
"""
Manager for loading and unloading extensions.
Tracks loaded extensions and provides methods for loading,
unloading, and reloading extensions by module name.
"""
def __init__(self, shell=None):
"""
Initialize the extension manager.
Parameters:
- shell: Optional shell instance to pass to extension functions
"""
pass
def load_extension(self, module_str):
"""
Load an extension by module name.
Imports the module and calls its initialization function
if present. Tracks the extension as loaded.
Parameters:
- module_str: str - Python module name of the extension
Returns:
- str: 'already loaded' if extension is already loaded
- str: 'no load function' if module lacks the required initialization function
- None: if load succeeds
"""
pass
def unload_extension(self, module_str):
"""
Unload an extension by module name.
Calls the module's cleanup function if present
and removes it from the loaded extensions.
Parameters:
- module_str: str - Python module name of the extension
Returns:
- str: 'not loaded' if extension is not currently loaded
- str: 'no unload function' if module lacks the required cleanup function
- None: if unload succeeds
"""
pass
def reload_extension(self, module_str):
"""
Reload an extension by unloading and loading it.
Parameters:
- module_str: str - Python module name of the extension
Returns:
- Result from load_extension after unloading
"""
passProvides the interactive computing framework and extension system patterns.