code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
async def input_text(self, text: str) -> None:
"""Input text.
Args:
text: Text to input
"""
await self._adb.shell(self._serial, f"input text {text}") | Input text.
Args:
text: Text to input
| input_text | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def press_key(self, keycode: int) -> None:
"""Press a key.
Args:
keycode: Android keycode to press
"""
await self._adb.shell(self._serial, f"input keyevent {keycode}") | Press a key.
Args:
keycode: Android keycode to press
| press_key | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def start_activity(
self,
package: str,
activity: str = ".MainActivity",
extras: Optional[Dict[str, str]] = None
) -> None:
"""Start an app activity.
Args:
package: Package name
activity: Activity name
extras: Intent ... | Start an app activity.
Args:
package: Package name
activity: Activity name
extras: Intent extras
| start_activity | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def start_app(self, package: str, activity: str = "") -> str:
"""Start an app on the device.
Args:
package: Package name
activity: Optional activity name (if empty, launches default activity)
Returns:
Result message
"""
... | Start an app on the device.
Args:
package: Package name
activity: Optional activity name (if empty, launches default activity)
Returns:
Result message
| start_app | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def install_app(self, apk_path: str, reinstall: bool = False, grant_permissions: bool = True) -> str:
"""Install an APK on the device.
Args:
apk_path: Path to the APK file
reinstall: Whether to reinstall if app exists
grant_permissions: Whether to grant... | Install an APK on the device.
Args:
apk_path: Path to the APK file
reinstall: Whether to reinstall if app exists
grant_permissions: Whether to grant all requested permissions
Returns:
Installation result
| install_app | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def uninstall_app(self, package: str, keep_data: bool = False) -> str:
"""Uninstall an app from the device.
Args:
package: Package name to uninstall
keep_data: Whether to keep app data and cache directories
Returns:
Uninstallation r... | Uninstall an app from the device.
Args:
package: Package name to uninstall
keep_data: Whether to keep app data and cache directories
Returns:
Uninstallation result
| uninstall_app | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def list_packages(self, include_system_apps: bool = False) -> List[Dict[str, str]]:
"""List installed packages on the device.
Args:
include_system_apps: Whether to include system apps
Returns:
List of package dictionaries with 'package' and 'pa... | List installed packages on the device.
Args:
include_system_apps: Whether to include system apps
Returns:
List of package dictionaries with 'package' and 'path' keys
| list_packages | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
def __init__(self, adb_path: Optional[str] = None):
"""Initialize device manager.
Args:
adb_path: Path to ADB binary
"""
self._adb = ADBWrapper(adb_path)
self._devices: Dict[str, Device] = {} | Initialize device manager.
Args:
adb_path: Path to ADB binary
| __init__ | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
async def list_devices(self) -> List[Device]:
"""List connected devices.
Returns:
List of connected devices
"""
devices_info = await self._adb.get_devices()
# Update device cache
current_serials = set()
for device_info in devices_info... | List connected devices.
Returns:
List of connected devices
| list_devices | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
async def get_device(self, serial: str) -> Optional[Device]:
"""Get a specific device.
Args:
serial: Device serial number
Returns:
Device instance if found, None otherwise
"""
if serial in self._devices:
return self._devic... | Get a specific device.
Args:
serial: Device serial number
Returns:
Device instance if found, None otherwise
| get_device | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
async def connect(self, host: str, port: int = 5555) -> Optional[Device]:
"""Connect to a device over TCP/IP.
Args:
host: Device IP address
port: Device port
Returns:
Connected device instance
"""
try:
serial =... | Connect to a device over TCP/IP.
Args:
host: Device IP address
port: Device port
Returns:
Connected device instance
| connect | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
async def disconnect(self, serial: str) -> bool:
"""Disconnect from a device.
Args:
serial: Device serial number
Returns:
True if disconnected successfully
"""
success = await self._adb.disconnect(serial)
if success and serial... | Disconnect from a device.
Args:
serial: Device serial number
Returns:
True if disconnected successfully
| disconnect | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
def __init__(self, adb_path: Optional[str] = None):
"""Initialize ADB wrapper.
Args:
adb_path: Path to ADB binary (defaults to 'adb' in PATH)
"""
self.adb_path = adb_path or "adb"
self._devices_cache: List[Dict[str, str]] = [] | Initialize ADB wrapper.
Args:
adb_path: Path to ADB binary (defaults to 'adb' in PATH)
| __init__ | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def _run_command(
self,
args: List[str],
timeout: Optional[float] = None,
check: bool = True
) -> Tuple[str, str]:
"""Run an ADB command.
Args:
args: Command arguments
timeout: Command timeout in seconds
check: Whet... | Run an ADB command.
Args:
args: Command arguments
timeout: Command timeout in seconds
check: Whether to check return code
Returns:
Tuple of (stdout, stderr)
| _run_command | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def _run_device_command(
self,
serial: str,
args: List[str],
timeout: Optional[float] = None,
check: bool = True
) -> Tuple[str, str]:
"""Run an ADB command for a specific device."""
return await self._run_command(["-s", serial, *args], timeout, check... | Run an ADB command for a specific device. | _run_device_command | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def get_devices(self) -> List[Dict[str, str]]:
"""Get list of connected devices.
Returns:
List of device info dictionaries with 'serial' and 'status' keys
"""
stdout, _ = await self._run_command(["devices", "-l"])
devices = []
for line ... | Get list of connected devices.
Returns:
List of device info dictionaries with 'serial' and 'status' keys
| get_devices | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def connect(self, host: str, port: int = 5555) -> str:
"""Connect to a device over TCP/IP.
Args:
host: Device IP address
port: Device port
Returns:
Device serial number (host:port)
"""
serial = f"{host}:{port}"
... | Connect to a device over TCP/IP.
Args:
host: Device IP address
port: Device port
Returns:
Device serial number (host:port)
| connect | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def disconnect(self, serial: str) -> bool:
"""Disconnect from a device.
Args:
serial: Device serial number
Returns:
True if disconnected successfully
"""
try:
stdout, _ = await self._run_command(["disconnect", serial... | Disconnect from a device.
Args:
serial: Device serial number
Returns:
True if disconnected successfully
| disconnect | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def shell(self, serial: str, command: str, timeout: Optional[float] = None) -> str:
"""Run a shell command on the device.
Args:
serial: Device serial number
command: Shell command to run
timeout: Command timeout in seconds
Returns:
... | Run a shell command on the device.
Args:
serial: Device serial number
command: Shell command to run
timeout: Command timeout in seconds
Returns:
Command output
| shell | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def get_properties(self, serial: str) -> Dict[str, str]:
"""Get device properties.
Args:
serial: Device serial number
Returns:
Dictionary of device properties
"""
output = await self.shell(serial, "getprop")
pro... | Get device properties.
Args:
serial: Device serial number
Returns:
Dictionary of device properties
| get_properties | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def install_app(
self,
serial: str,
apk_path: str,
reinstall: bool = False,
grant_permissions: bool = True
) -> Tuple[str, str]:
"""Install an APK on the device.
Args:
serial: Device serial number
apk_path: Path to th... | Install an APK on the device.
Args:
serial: Device serial number
apk_path: Path to the APK file
reinstall: Whether to reinstall if app exists
grant_permissions: Whether to grant all permissions
Returns:
Tuple of (stdout, s... | install_app | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def pull_file(self, serial: str, device_path: str, local_path: str) -> Tuple[str, str]:
"""Pull a file from the device.
Args:
serial: Device serial number
device_path: Path on the device
local_path: Path on the local machine
Returns... | Pull a file from the device.
Args:
serial: Device serial number
device_path: Path on the device
local_path: Path on the local machine
Returns:
Tuple of (stdout, stderr)
| pull_file | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
def async_to_sync(func):
"""
Convert an async function to a sync function.
Args:
func: Async function to convert
Returns:
Callable: Synchronous version of the async function
"""
def wrapper(*args, **kwargs):
return asyncio.run(func(*args, **kwargs))
return wrapper |
Convert an async function to a sync function.
Args:
func: Async function to convert
Returns:
Callable: Synchronous version of the async function
| async_to_sync | python | droidrun/droidrun | droidrun/agent/utils/async_utils.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/async_utils.py | MIT |
async def add_ui_text_block(ui_state: str, chat_history: List[ChatMessage], copy = True) -> List[ChatMessage]:
"""Add UI elements to the chat history without modifying the original."""
if ui_state:
ui_block = TextBlock(text="\nCurrent Clickable UI elements from the device using the custom TopViewService... | Add UI elements to the chat history without modifying the original. | add_ui_text_block | python | droidrun/droidrun | droidrun/agent/utils/chat_utils.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/chat_utils.py | MIT |
def __init__(self, loop: AbstractEventLoop, locals: Dict[str, Any] = {}, globals: Dict[str, Any] = {}, tools = {}, use_same_scope: bool = True):
"""
Initialize the code executor.
Args:
locals: Local variables to use in the execution context
globals: Global variables to u... |
Initialize the code executor.
Args:
locals: Local variables to use in the execution context
globals: Global variables to use in the execution context
tools: List of tools available for execution
| __init__ | python | droidrun/droidrun | droidrun/agent/utils/executer.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/executer.py | MIT |
async def execute(self, ctx: Context, code: str) -> str:
"""
Execute Python code and capture output and return values.
Args:
code: Python code to execute
Returns:
str: Output from the execution, including print statements.
"""
# Update UI element... |
Execute Python code and capture output and return values.
Args:
code: Python code to execute
Returns:
str: Output from the execution, including print statements.
| execute | python | droidrun/droidrun | droidrun/agent/utils/executer.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/executer.py | MIT |
def load_llm(provider_name: str, **kwargs: Any) -> LLM:
"""
Dynamically loads and initializes a LlamaIndex LLM.
Imports `llama_index.llms.<provider_name_lower>`, finds the class named
`provider_name` within that module, verifies it's an LLM subclass,
and initializes it with kwargs.
Args:
... |
Dynamically loads and initializes a LlamaIndex LLM.
Imports `llama_index.llms.<provider_name_lower>`, finds the class named
`provider_name` within that module, verifies it's an LLM subclass,
and initializes it with kwargs.
Args:
provider_name: The case-sensitive name of the provider and t... | load_llm | python | droidrun/droidrun | droidrun/agent/utils/llm_picker.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/llm_picker.py | MIT |
def set_tasks(self, tasks: List[str], task_contexts: Optional[List[Dict[str, Any]]] = None):
"""
Clears the current task list and sets new tasks from a list.
Each task should be a string.
Args:
tasks: A list of strings, each representing a task.
task_contexts: Op... |
Clears the current task list and sets new tasks from a list.
Each task should be a string.
Args:
tasks: A list of strings, each representing a task.
task_contexts: Optional list of context dictionaries for each task.
| set_tasks | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def add_task(self, task_description: str, task_context: Optional[Dict[str, Any]] = None):
"""
Adds a new task to the list with a 'pending' status.
Args:
task_description: The string describing the task.
task_context: Optional dictionary with context for the task.
... |
Adds a new task to the list with a 'pending' status.
Args:
task_description: The string describing the task.
task_context: Optional dictionary with context for the task.
Returns:
int: The index of the newly added task.
Raises:
ValueErro... | add_task | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def get_task(self, index: int):
"""
Retrieves a specific task by its index.
Args:
index: The integer index of the task.
Returns:
dict: The task dictionary {'description': str, 'status': str}.
Raises:
IndexError: If the index is out of bounds... |
Retrieves a specific task by its index.
Args:
index: The integer index of the task.
Returns:
dict: The task dictionary {'description': str, 'status': str}.
Raises:
IndexError: If the index is out of bounds.
| get_task | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def update_status(self, index: int, new_status: str, result_info: Optional[Dict[str, Any]] = None):
"""
Updates the status of a specific task.
Args:
index: The index of the task to update.
new_status: The new status string (must be one of VALID_STATUSES).
res... |
Updates the status of a specific task.
Args:
index: The index of the task to update.
new_status: The new status string (must be one of VALID_STATUSES).
result_info: Optional dictionary with additional information about the task result.
Raises:
I... | update_status | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def delete_task(self, index: int):
"""
Deletes a task by its index.
Args:
index: The index of the task to delete.
Raises:
IndexError: If the index is out of bounds.
"""
if 0 <= index < len(self.tasks):
del self.tasks[index]
... |
Deletes a task by its index.
Args:
index: The index of the task to delete.
Raises:
IndexError: If the index is out of bounds.
| delete_task | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def clear_tasks(self):
"""Removes all tasks from the list."""
self.tasks = []
print("All tasks cleared.")
self.save_to_file() | Removes all tasks from the list. | clear_tasks | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def get_tasks_by_status(self, status: str):
"""
Filters and returns tasks matching a specific status.
Args:
status: The status string to filter by.
Returns:
list[dict]: A list of tasks matching the status.
Raises:
ValueError: If the status i... |
Filters and returns tasks matching a specific status.
Args:
status: The status string to filter by.
Returns:
list[dict]: A list of tasks matching the status.
Raises:
ValueError: If the status is not a valid status.
| get_tasks_by_status | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def __str__(self):
"""Provides a user-friendly string representation of the task list."""
if not self.tasks:
return "Task List (empty)"
output = "Task List:\n"
output += "----------\n"
for i, task in enumerate(self.tasks):
output += f"{i}: [{task['status'... | Provides a user-friendly string representation of the task list. | __str__ | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def save_to_file(self, filename=file_path):
"""Saves the current task list to a Markdown file."""
try:
with open(filename, 'w', encoding='utf-8') as f:
f.write(str(self))
#print(f"Tasks saved to {filename}.")
except Exception as e:
print(f"Erro... | Saves the current task list to a Markdown file. | save_to_file | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def complete_goal(self, message: str):
"""
Marks the goal as completed, use this whether the task completion was successful or on failure.
This method should be called when the task is finished, regardless of the outcome.
Args:
message: The message to be logged.
"""
... |
Marks the goal as completed, use this whether the task completion was successful or on failure.
This method should be called when the task is finished, regardless of the outcome.
Args:
message: The message to be logged.
| complete_goal | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def start_agent(self):
"""Starts the sub-agent to perform the tasks if there are any tasks to perform.
Use this function after setting the tasks.
Args:
None"""
if len(self.tasks) == 0:
print("No tasks to perform.")
return
self.start_execution = True | Starts the sub-agent to perform the tasks if there are any tasks to perform.
Use this function after setting the tasks.
Args:
None | start_agent | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def get_all_completed_tasks(self) -> List[Dict]:
"""
Returns all completed tasks, including those from previous planning cycles.
Returns:
List of completed task dictionaries
"""
# Get currently active completed tasks
current_completed = self.get_compl... |
Returns all completed tasks, including those from previous planning cycles.
Returns:
List of completed task dictionaries
| get_all_completed_tasks | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def get_all_failed_tasks(self) -> List[Dict]:
"""
Returns all failed tasks, including those from previous planning cycles.
Returns:
List of failed task dictionaries
"""
# Get currently active failed tasks
current_failed = self.get_tasks_by_status(self... |
Returns all failed tasks, including those from previous planning cycles.
Returns:
List of failed task dictionaries
| get_all_failed_tasks | python | droidrun/droidrun | droidrun/agent/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/task_manager.py | MIT |
def create_screenshot_gif(self, output_path: str, duration: int = 1000) -> str:
"""
Create a GIF from a list of screenshots.
Args:
output_path: Base path for the GIF (without extension)
duration: Duration for each frame in milliseconds
Returns:
... |
Create a GIF from a list of screenshots.
Args:
output_path: Base path for the GIF (without extension)
duration: Duration for each frame in milliseconds
Returns:
Path to the created GIF file
| create_screenshot_gif | python | droidrun/droidrun | droidrun/agent/utils/trajectory.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/trajectory.py | MIT |
def save_trajectory(
self,
directory: str = "trajectories",
) -> str:
"""
Save trajectory steps to a JSON file and create a GIF of screenshots if available.
Args:
directory: Directory to save the trajectory files
Returns:
Path... |
Save trajectory steps to a JSON file and create a GIF of screenshots if available.
Args:
directory: Directory to save the trajectory files
Returns:
Path to the saved trajectory file
| save_trajectory | python | droidrun/droidrun | droidrun/agent/utils/trajectory.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/trajectory.py | MIT |
def get_trajectory_statistics(trajectory_data: Dict[str, Any]) -> Dict[str, Any]:
"""
Get statistics about a trajectory.
Args:
trajectory_data: The trajectory data dictionary
Returns:
Dictionary with statistics about the trajectory
""... |
Get statistics about a trajectory.
Args:
trajectory_data: The trajectory data dictionary
Returns:
Dictionary with statistics about the trajectory
| get_trajectory_statistics | python | droidrun/droidrun | droidrun/agent/utils/trajectory.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/trajectory.py | MIT |
def print_trajectory_summary(self, trajectory_data: Dict[str, Any]) -> None:
"""
Print a summary of a trajectory.
Args:
trajectory_data: The trajectory data dictionary
"""
stats = self.get_trajectory_statistics(trajectory_data)
print("=== Tra... |
Print a summary of a trajectory.
Args:
trajectory_data: The trajectory data dictionary
| print_trajectory_summary | python | droidrun/droidrun | droidrun/agent/utils/trajectory.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/trajectory.py | MIT |
def __init__(self, logs: List[str], debug: bool = False):
"""
Initialize the event handler.
Args:
logs: List to append log messages to
update_display_callback: Callback function to update the display
"""
self.logs = logs
self.debug = debug... |
Initialize the event handler.
Args:
logs: List to append log messages to
update_display_callback: Callback function to update the display
| __init__ | python | droidrun/droidrun | droidrun/cli/event_handler.py | https://github.com/droidrun/droidrun/blob/master/droidrun/cli/event_handler.py | MIT |
def create_layout():
"""Create a layout with logs at top and status at bottom"""
layout = Layout()
layout.split(
Layout(name="logs"),
Layout(name="goal", size=3),
Layout(name="status", size=3)
)
return layout | Create a layout with logs at top and status at bottom | create_layout | python | droidrun/droidrun | droidrun/cli/main.py | https://github.com/droidrun/droidrun/blob/master/droidrun/cli/main.py | MIT |
def configure_logging(debug: bool):
"""Configure logging verbosity based on debug flag."""
warnings.filterwarnings("ignore")
logging.getLogger().setLevel(logging.CRITICAL + 1)
logging.getLogger().disabled = True
for logger_name in list(logging.Logger.manager.loggerDict.keys()):
log... | Configure logging verbosity based on debug flag. | configure_logging | python | droidrun/droidrun | droidrun/cli/main.py | https://github.com/droidrun/droidrun/blob/master/droidrun/cli/main.py | MIT |
def run(command: str, device: str | None, provider: str, model: str, steps: int, base_url: str, temperature: float, reasoning: bool, tracing: bool, debug: bool, save_trajectory: bool, trajectory_dir: str):
"""Run a command on your Android device using natural language."""
# Call our standalone function
retu... | Run a command on your Android device using natural language. | run | python | droidrun/droidrun | droidrun/cli/main.py | https://github.com/droidrun/droidrun/blob/master/droidrun/cli/main.py | MIT |
async def connect(ip_address: str, port: int):
"""Connect to a device over TCP/IP."""
try:
device = await device_manager.connect(ip_address, port)
if device:
console.print(f"[green]Successfully connected to {ip_address}:{port}[/]")
else:
console.print(f"[red]Faile... | Connect to a device over TCP/IP. | connect | python | droidrun/droidrun | droidrun/cli/main.py | https://github.com/droidrun/droidrun/blob/master/droidrun/cli/main.py | MIT |
async def setup(path: str, device: str | None):
"""Install an APK file and enable it as an accessibility service."""
try:
if not os.path.exists(path):
console.print(f"[bold red]Error:[/] APK file not found at {path}")
return
if not device:
devices... | Install an APK file and enable it as an accessibility service. | setup | python | droidrun/droidrun | droidrun/cli/main.py | https://github.com/droidrun/droidrun/blob/master/droidrun/cli/main.py | MIT |
def get_device_serial(self) -> str:
"""Get the device serial from the instance or environment variable."""
# First try using the instance's serial
if self.serial:
return self.serial | Get the device serial from the instance or environment variable. | get_device_serial | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def get_device(self) -> Optional[Device]:
"""Get the device instance using the instance's serial or from environment variable.
Returns:
Device instance or None if not found
"""
serial = self.get_device_serial()
if not serial:
raise ValueErro... | Get the device instance using the instance's serial or from environment variable.
Returns:
Device instance or None if not found
| get_device | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
def parse_package_list(self, output: str) -> List[Dict[str, str]]:
"""Parse the output of 'pm list packages -f' command.
Args:
output: Raw command output from 'pm list packages -f'
Returns:
List of dictionaries containing package info with 'package' and 'path' keys
... | Parse the output of 'pm list packages -f' command.
Args:
output: Raw command output from 'pm list packages -f'
Returns:
List of dictionaries containing package info with 'package' and 'path' keys
| parse_package_list | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def get_clickables(self, serial: Optional[str] = None) -> str:
"""
Get all clickable UI elements from the device using the custom TopViewService.
This function interacts with the TopViewService app installed on the device
to capture UI elements. The service writes UI data ... |
Get all clickable UI elements from the device using the custom TopViewService.
This function interacts with the TopViewService app installed on the device
to capture UI elements. The service writes UI data to a JSON file on the device,
which is then pulled to the host. If no el... | get_clickables | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def tap_by_index(self, index: int, serial: Optional[str] = None) -> str:
"""
Tap on a UI element by its index.
This function uses the cached clickable elements
to find the element with the given index and tap on its center coordinates.
Args:
in... |
Tap on a UI element by its index.
This function uses the cached clickable elements
to find the element with the given index and tap on its center coordinates.
Args:
index: Index of the element to tap
Returns:
Result message
... | tap_by_index | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
def collect_all_indices(elements):
"""Recursively collect all indices from elements and their children."""
indices = []
for item in elements:
if item.get('index') is not None:
indices.append(item.get('index'))
# Check children if pr... | Recursively collect all indices from elements and their children. | collect_all_indices | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
def find_element_by_index(elements, target_index):
"""Recursively find an element with the given index."""
for item in elements:
if item.get('index') == target_index:
return item
# Check children if present
children = item.get('... | Recursively find an element with the given index. | find_element_by_index | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def tap_by_coordinates(self, x: int, y: int) -> bool:
"""
Tap on the device screen at specific coordinates.
Args:
x: X coordinate
y: Y coordinate
Returns:
Bool indicating success or failure
"""
try:
... |
Tap on the device screen at specific coordinates.
Args:
x: X coordinate
y: Y coordinate
Returns:
Bool indicating success or failure
| tap_by_coordinates | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def tap(self, index: int) -> str:
"""
Tap on a UI element by its index.
This function uses the cached clickable elements from the last get_clickables call
to find the element with the given index and tap on its center coordinates.
Args:
index: ... |
Tap on a UI element by its index.
This function uses the cached clickable elements from the last get_clickables call
to find the element with the given index and tap on its center coordinates.
Args:
index: Index of the element to tap
Return... | tap | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def swipe(
self,
start_x: int,
start_y: int,
end_x: int,
end_y: int,
duration_ms: int = 300
) -> bool:
"""
Performs a straight-line swipe gesture on the device screen.
To perform a hold (long press), set the start and end coordinates to t... |
Performs a straight-line swipe gesture on the device screen.
To perform a hold (long press), set the start and end coordinates to the same values and increase the duration as needed.
Args:
start_x: Starting X coordinate
start_y: Starting Y coordinate
... | swipe | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def input_text(self, text: str, serial: Optional[str] = None) -> str:
"""
Input text on the device using Base64 encoding and broadcast intent.
Args:
text: Text to input. Can contain spaces, newlines, and special characters including non-ASCII.
serial: Optio... |
Input text on the device using Base64 encoding and broadcast intent.
Args:
text: Text to input. Can contain spaces, newlines, and special characters including non-ASCII.
serial: Optional device serial (for backward compatibility)
Returns:
Re... | input_text | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def press_key(self, keycode: int) -> str:
"""
Press a key on the device.
Common keycodes:
- 3: HOME
- 4: BACK
- 24: VOLUME UP
- 25: VOLUME DOWN
- 26: POWER
- 82: MENU
Args:
keycode: Android keycode to pre... |
Press a key on the device.
Common keycodes:
- 3: HOME
- 4: BACK
- 24: VOLUME UP
- 25: VOLUME DOWN
- 26: POWER
- 82: MENU
Args:
keycode: Android keycode to press
| press_key | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def start_app(
self,
package: str,
activity: str = ""
) -> str:
"""
Start an app on the device.
Args:
package: Package name (e.g., "com.android.settings")
activity: Optional activity name
"""
try:
if s... |
Start an app on the device.
Args:
package: Package name (e.g., "com.android.settings")
activity: Optional activity name
| start_app | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def install_app(
self,
apk_path: str,
reinstall: bool = False,
grant_permissions: bool = True
) -> str:
"""
Install an app on the device.
Args:
apk_path: Path to the APK file
reinstall: Whether to reinstall if app exist... |
Install an app on the device.
Args:
apk_path: Path to the APK file
reinstall: Whether to reinstall if app exists
grant_permissions: Whether to grant all permissions
| install_app | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def take_screenshot(self) -> bool:
"""
Take a screenshot of the device.
This function captures the current screen and adds the screenshot to context in the next message.
Also stores the screenshot in the screenshots list with timestamp for later GIF creation.
"""
tr... |
Take a screenshot of the device.
This function captures the current screen and adds the screenshot to context in the next message.
Also stores the screenshot in the screenshots list with timestamp for later GIF creation.
| take_screenshot | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def list_packages(
self,
include_system_apps: bool = False
) -> List[str]:
"""
List installed packages on the device.
Args:
include_system_apps: Whether to include system apps (default: False)
Returns:
List of package na... |
List installed packages on the device.
Args:
include_system_apps: Whether to include system apps (default: False)
Returns:
List of package names
| list_packages | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def extract(self, filename: Optional[str] = None) -> str:
"""Extract and save the current UI state to a JSON file.
This function captures the current UI state including all UI elements
and saves it to a JSON file for later analysis or reference.
Args:
... | Extract and save the current UI state to a JSON file.
This function captures the current UI state including all UI elements
and saves it to a JSON file for later analysis or reference.
Args:
filename: Optional filename to save the UI state (defaults to ui_state_TIME... | extract | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def get_all_elements(self) -> Dict[str, Any]:
"""
Get all UI elements from the device, including non-interactive elements.
This function interacts with the TopViewService app installed on the device
to capture all UI elements, even those that are not interactive. This prov... |
Get all UI elements from the device, including non-interactive elements.
This function interacts with the TopViewService app installed on the device
to capture all UI elements, even those that are not interactive. This provides
a complete view of the UI hierarchy for analysis o... | get_all_elements | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
def complete(self, success: bool, reason: str = ""):
"""
Mark the task as finished.
Args:
success: Indicates if the task was successful.
reason: Reason for failure/success
"""
if success:
self.success = True
self.reason = reason or... |
Mark the task as finished.
Args:
success: Indicates if the task was successful.
reason: Reason for failure/success
| complete | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def get_phone_state(self, serial: Optional[str] = None) -> Dict[str, Any]:
"""
Get the current phone state including current activity and keyboard visibility.
Args:
serial: Optional device serial number
Returns:
Dictionary with current phon... |
Get the current phone state including current activity and keyboard visibility.
Args:
serial: Optional device serial number
Returns:
Dictionary with current phone state information
| get_phone_state | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
async def remember(self, information: str) -> str:
"""
Store important information to remember for future context.
This information will be included in future LLM prompts to help maintain context
across interactions. Use this for critical facts, observations, or user preferences... |
Store important information to remember for future context.
This information will be included in future LLM prompts to help maintain context
across interactions. Use this for critical facts, observations, or user preferences
that should influence future decisions.
... | remember | python | droidrun/droidrun | droidrun/tools/actions.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/actions.py | MIT |
def load_tools(serial: Optional[str] = None) -> Tuple[Dict[str, Callable[..., Any]], Tools]:
"""
Initializes the Tools class and returns a dictionary of available tool functions
and the Tools instance itself. If serial is not provided, it attempts to find
the first connected device.
Args:
s... |
Initializes the Tools class and returns a dictionary of available tool functions
and the Tools instance itself. If serial is not provided, it attempts to find
the first connected device.
Args:
serial: The device serial number. If None, finds the first available device.
Returns:
A ... | load_tools | python | droidrun/droidrun | droidrun/tools/loader.py | https://github.com/droidrun/droidrun/blob/master/droidrun/tools/loader.py | MIT |
def __init__(
self,
task_ids: Optional[List[int]] = None,
task_names: Optional[List[str]] = None,
llm_provider: str = "OpenAI",
llm_model: str = "gpt-4o-mini",
temperature: float = 0.2,
adb_path: str = "adb",
console_port: int = 5554,
perform_emula... | Initialize the benchmark.
Args:
task_ids: List of task IDs to run (1-116)
task_names: List of specific task names to run
llm_provider: LLM provider to use (OpenAI, Anthropic, Gemini, etc.)
llm_model: Model name to use
temperature: Temperature ... | __init__ | python | droidrun/droidrun | eval/android_world_bench.py | https://github.com/droidrun/droidrun/blob/master/eval/android_world_bench.py | MIT |
async def initialize(self):
"""Initialize all components needed for the benchmark."""
# Initialize environment
self.env = initialize_environment(
adb_path=self.adb_path,
console_port=self.console_port,
perform_setup=self.perform_emulator_setup
)
... | Initialize all components needed for the benchmark. | initialize | python | droidrun/droidrun | eval/android_world_bench.py | https://github.com/droidrun/droidrun/blob/master/eval/android_world_bench.py | MIT |
def list_tasks(self):
"""Print the list of available tasks."""
if not self.task_registry:
self.task_registry = TaskRegistry(task_family=self.task_family)
task_ids = self.task_registry.get_task_ids()
print("\nAvailable AndroidWorld Tasks:")
print("---... | Print the list of available tasks. | list_tasks | python | droidrun/droidrun | eval/android_world_bench.py | https://github.com/droidrun/droidrun/blob/master/eval/android_world_bench.py | MIT |
async def run_task(self, task_name: str, task_instance):
"""Run a single task.
Args:
task_name: Name of the task
task_instance: Task instance to run
Returns:
Task result
"""
logger.info(f"Running task: {task_name}")
... | Run a single task.
Args:
task_name: Name of the task
task_instance: Task instance to run
Returns:
Task result
| run_task | python | droidrun/droidrun | eval/android_world_bench.py | https://github.com/droidrun/droidrun/blob/master/eval/android_world_bench.py | MIT |
async def run_benchmark(self):
"""Run the benchmark on the selected tasks."""
# Initialize components
await self.initialize()
# Create task suite
task_suite = self.task_registry.create_task_suite(
task_ids=self.task_ids,
task_names=self.task_names... | Run the benchmark on the selected tasks. | run_benchmark | python | droidrun/droidrun | eval/android_world_bench.py | https://github.com/droidrun/droidrun/blob/master/eval/android_world_bench.py | MIT |
async def main():
"""Main entry point for the benchmark script."""
parser = argparse.ArgumentParser(description="Run AndroidWorld benchmark tasks with DroidRun")
# Task selection arguments
task_group = parser.add_argument_group("Task Selection")
task_group.add_argument("--task-ids", type=int, n... | Main entry point for the benchmark script. | main | python | droidrun/droidrun | eval/android_world_bench.py | https://github.com/droidrun/droidrun/blob/master/eval/android_world_bench.py | MIT |
async def enable_accessibility_service(adb_path: str, device_serial: str,
service_name: str, disable_first: bool = False):
"""Enable the DroidRun accessibility service.
This is crucial for DroidRun to function correctly with Android UI interactions.
Args:
... | Enable the DroidRun accessibility service.
This is crucial for DroidRun to function correctly with Android UI interactions.
Args:
adb_path: Path to ADB executable
device_serial: Device serial number
service_name: Name of the accessibility service to enable
disable_first... | enable_accessibility_service | python | droidrun/droidrun | eval/utils/accessibility.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/accessibility.py | MIT |
async def create_agent(
device_serial: str,
task_description: str,
llm_provider: str,
llm_model: str,
temperature: float = 0.2,
max_steps: int = 50,
timeout: int = 600,
max_retries: int = 3,
vision: bool = True,
debug: bool = True
) -> Tuple[DroidAgent, Dict[str, Any]]:
"""Cr... | Create and configure a DroidRun agent.
Args:
device_serial: Device serial number
task_description: Description of the task
llm_provider: LLM provider name
llm_model: LLM model name
temperature: Temperature for LLM
max_steps: Maximum number of steps
timeou... | create_agent | python | droidrun/droidrun | eval/utils/agent.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/agent.py | MIT |
async def run_agent(agent: DroidAgent, task_name: str) -> Dict[str, Any]:
"""Run the agent on a task.
Args:
agent: The agent to run
task_name: Name of the task
Returns:
Result data
"""
logger.info(f"Running agent for task: {task_name}")
try:
# R... | Run the agent on a task.
Args:
agent: The agent to run
task_name: Name of the task
Returns:
Result data
| run_agent | python | droidrun/droidrun | eval/utils/agent.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/agent.py | MIT |
def check_android_world_path():
"""Check that the ANDROID_WORLD_PATH environment variable is set and valid."""
android_world_path = os.environ.get("ANDROID_WORLD_PATH", None)
if not android_world_path or not os.path.exists(android_world_path):
logger.error("ANDROID_WORLD_PATH environment variable no... | Check that the ANDROID_WORLD_PATH environment variable is set and valid. | check_android_world_path | python | droidrun/droidrun | eval/utils/environment.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/environment.py | MIT |
def initialize_environment(
adb_path: str = "adb",
console_port: int = 5554,
perform_setup: bool = False
) -> Optional[object]:
"""Initialize the AndroidWorld environment.
Args:
adb_path: Path to ADB executable
console_port: Emulator console port
perform_setup: Whether t... | Initialize the AndroidWorld environment.
Args:
adb_path: Path to ADB executable
console_port: Emulator console port
perform_setup: Whether to perform initial emulator setup
Returns:
Initialized environment or None if initialization failed
| initialize_environment | python | droidrun/droidrun | eval/utils/environment.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/environment.py | MIT |
async def get_device_serial() -> Optional[str]:
"""Get the serial number of the connected Android device.
Returns:
Device serial number or None if no device found
"""
try:
from droidrun.tools import DeviceManager
device_manager = DeviceManager()
devices = aw... | Get the serial number of the connected Android device.
Returns:
Device serial number or None if no device found
| get_device_serial | python | droidrun/droidrun | eval/utils/environment.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/environment.py | MIT |
def __init__(
self,
adb_path: str = "adb",
device_serial: Optional[str] = None,
interval: int = 5
):
"""Initialize the keepalive service.
Args:
adb_path: Path to ADB executable
device_serial: Device serial number
interval... | Initialize the keepalive service.
Args:
adb_path: Path to ADB executable
device_serial: Device serial number
interval: Interval in seconds between commands
| __init__ | python | droidrun/droidrun | eval/utils/keepalive.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/keepalive.py | MIT |
def start(self):
"""Start the keepalive service as a subprocess."""
if self.process and self.process.poll() is None:
logger.info("Keepalive service is already running")
return
# Path to the script file
script_path = os.path.join(os.path.dirname(__file__),... | Start the keepalive service as a subprocess. | start | python | droidrun/droidrun | eval/utils/keepalive.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/keepalive.py | MIT |
def _create_script_file(self, script_path: str):
"""Create the keepalive script file.
Args:
script_path: Path to write the script to
"""
script_content = '''#!/usr/bin/env python3
"""
Minimal keepalive script for DroidRun overlay toggling.
"""
import subprocess
impo... | Create the keepalive script file.
Args:
script_path: Path to write the script to
| _create_script_file | python | droidrun/droidrun | eval/utils/keepalive.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/keepalive.py | MIT |
async def disable_overlay_once(adb_path: str, device_serial: str):
"""Disable the overlay once.
Args:
adb_path: Path to ADB executable
device_serial: Device serial number
"""
try:
cmd = [
adb_path,
"-s", device_serial,
"shell",
... | Disable the overlay once.
Args:
adb_path: Path to ADB executable
device_serial: Device serial number
| disable_overlay_once | python | droidrun/droidrun | eval/utils/keepalive.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/keepalive.py | MIT |
def __init__(self, results_dir: str = "eval_results"):
"""Initialize the result manager.
Args:
results_dir: Directory to save results to
"""
self.results_dir = results_dir
self.results = []
# Create results directory if it doesn't exist
... | Initialize the result manager.
Args:
results_dir: Directory to save results to
| __init__ | python | droidrun/droidrun | eval/utils/results.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/results.py | MIT |
def save_task_result(self, result: Dict[str, Any]):
"""Save a task result.
Args:
result: Task result data
"""
# Add to results list
self.results.append(result)
# Save to file
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
... | Save a task result.
Args:
result: Task result data
| save_task_result | python | droidrun/droidrun | eval/utils/results.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/results.py | MIT |
def _update_summary(self, result: Dict[str, Any]):
"""Update the summary with a new result.
Args:
result: Task result data
"""
# Update total tasks
self.summary["total_tasks"] += 1
# Update successful tasks
if result.get("success", Fa... | Update the summary with a new result.
Args:
result: Task result data
| _update_summary | python | droidrun/droidrun | eval/utils/results.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/results.py | MIT |
def create_task_result(task_name: str, task_description: str) -> Dict[str, Any]:
"""Create a new task result object.
Args:
task_name: Name of the task
task_description: Description of the task
Returns:
Task result object
"""
return {
"task_name": task_na... | Create a new task result object.
Args:
task_name: Name of the task
task_description: Description of the task
Returns:
Task result object
| create_task_result | python | droidrun/droidrun | eval/utils/results.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/results.py | MIT |
def update_result_from_agent(result: Dict[str, Any], agent_result: Any, agent: Any) -> Dict[str, Any]:
"""Update a task result with information from an agent run.
Args:
result: Task result to update
agent_result: Result from agent run
agent: Agent instance
Returns:
... | Update a task result with information from an agent run.
Args:
result: Task result to update
agent_result: Result from agent run
agent: Agent instance
Returns:
Updated task result
| update_result_from_agent | python | droidrun/droidrun | eval/utils/results.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/results.py | MIT |
def __init__(self, progress_file: str):
"""Initialize the progress tracker.
Args:
progress_file: Path to progress file
"""
self.progress_file = progress_file
self.completed_tasks = 0
# Ensure directory exists if progress_file includes a direc... | Initialize the progress tracker.
Args:
progress_file: Path to progress file
| __init__ | python | droidrun/droidrun | eval/utils/results.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/results.py | MIT |
def update_progress(self, completed_tasks: int):
"""Update progress with the number of completed tasks.
Args:
completed_tasks: Number of completed tasks
"""
self.completed_tasks = completed_tasks
try:
progress_data = {
"co... | Update progress with the number of completed tasks.
Args:
completed_tasks: Number of completed tasks
| update_progress | python | droidrun/droidrun | eval/utils/results.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/results.py | MIT |
def __init__(self, task_family: str = registry.TaskRegistry.ANDROID_WORLD_FAMILY):
"""Initialize the task registry.
Args:
task_family: The task family to use
"""
self.task_family = task_family
self.registry = registry.TaskRegistry()
self.task_dict = s... | Initialize the task registry.
Args:
task_family: The task family to use
| __init__ | python | droidrun/droidrun | eval/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/task_manager.py | MIT |
def create_task_instance(self, task_name: str, random_seed: int = 42) -> Optional[task_eval.TaskEval]:
"""Create an instance of a task.
Args:
task_name: Name of the task
random_seed: Random seed for parameter generation
Returns:
Task inst... | Create an instance of a task.
Args:
task_name: Name of the task
random_seed: Random seed for parameter generation
Returns:
Task instance or None if task could not be created
| create_task_instance | python | droidrun/droidrun | eval/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/task_manager.py | MIT |
def filter_tasks(self, task_ids: Optional[List[int]] = None,
task_names: Optional[List[str]] = None) -> Dict[str, type]:
"""Filter tasks based on task IDs or names.
Args:
task_ids: List of task IDs to filter
task_names: List of task names to filter
... | Filter tasks based on task IDs or names.
Args:
task_ids: List of task IDs to filter
task_names: List of task names to filter
Returns:
Dictionary of filtered tasks
| filter_tasks | python | droidrun/droidrun | eval/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/task_manager.py | MIT |
def create_task_suite(self, task_ids: Optional[List[int]] = None,
task_names: Optional[List[str]] = None,
n_combinations: int = 1,
random_seed: int = 42) -> List[Tuple[str, task_eval.TaskEval]]:
"""Create a suite of tasks to benchmark... | Create a suite of tasks to benchmark.
Args:
task_ids: List of task IDs to include
task_names: List of task names to include
n_combinations: Number of parameter combinations per task
random_seed: Random seed for reproducibility
Returns... | create_task_suite | python | droidrun/droidrun | eval/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/task_manager.py | MIT |
async def initialize_task(env, task_instance: task_eval.TaskEval) -> bool:
"""Initialize a task in the environment.
Args:
env: AndroidWorld environment
task_instance: Task instance to initialize
Returns:
True if initialization was successful, False otherwise
"""
... | Initialize a task in the environment.
Args:
env: AndroidWorld environment
task_instance: Task instance to initialize
Returns:
True if initialization was successful, False otherwise
| initialize_task | python | droidrun/droidrun | eval/utils/task_manager.py | https://github.com/droidrun/droidrun/blob/master/eval/utils/task_manager.py | MIT |
Subsets and Splits
Django Code with Docstrings
Filters Python code examples from Django repository that contain Django-related code, helping identify relevant code snippets for understanding Django framework usage patterns.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves Python code examples from Django repository that contain 'django' in the code, which helps identify Django-specific code snippets but provides limited analytical insights beyond basic filtering.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves specific code examples from the Flask repository but doesn't provide meaningful analysis or patterns beyond basic data retrieval.
HTTPX Repo Code and Docstrings
Retrieves specific code examples from the httpx repository, which is useful for understanding how particular libraries are used but doesn't provide broader analytical insights about the dataset.
Requests Repo Docstrings & Code
Retrieves code examples with their docstrings and file paths from the requests repository, providing basic filtering but limited analytical value beyond finding specific code samples.
Quart Repo Docstrings & Code
Retrieves code examples with their docstrings from the Quart repository, providing basic code samples but offering limited analytical value for understanding broader patterns or relationships in the dataset.