Browse Source

docs: align docstrings with Google style (#5328)

Cheng Yang 1 year ago
parent
commit
05cc6d4fc3
1 changed files with 27 additions and 25 deletions
  1. 27 25
      openhands/core/config/app_config.py

+ 27 - 25
openhands/core/config/app_config.py

@@ -19,28 +19,30 @@ class AppConfig:
     """Configuration for the app.
 
     Attributes:
-        llms: A dictionary of name -> LLM configuration. Default config is under 'llm' key.
-        agents: A dictionary of name -> Agent configuration. Default config is under 'agent' key.
-        default_agent: The name of the default agent to use.
-        sandbox: The sandbox configuration.
-        runtime: The runtime environment.
-        file_store: The file store to use.
-        file_store_path: The path to the file store.
-        trajectories_path: The folder path to store trajectories.
-        workspace_base: The base path for the workspace. Defaults to ./workspace as an absolute path.
-        workspace_mount_path: The path to mount the workspace. This is set to the workspace base by default.
-        workspace_mount_path_in_sandbox: The path to mount the workspace in the sandbox. Defaults to /workspace.
-        workspace_mount_rewrite: The path to rewrite the workspace mount path to.
-        cache_dir: The path to the cache directory. Defaults to /tmp/cache.
+        llms: Dictionary mapping LLM names to their configurations.
+            The default configuration is stored under the 'llm' key.
+        agents: Dictionary mapping agent names to their configurations.
+            The default configuration is stored under the 'agent' key.
+        default_agent: Name of the default agent to use.
+        sandbox: Sandbox configuration settings.
+        runtime: Runtime environment identifier.
+        file_store: Type of file store to use.
+        file_store_path: Path to the file store.
+        trajectories_path: Folder path to store trajectories.
+        workspace_base: Base path for the workspace. Defaults to `./workspace` as absolute path.
+        workspace_mount_path: Path to mount the workspace. Defaults to `workspace_base`.
+        workspace_mount_path_in_sandbox: Path to mount the workspace in sandbox. Defaults to `/workspace`.
+        workspace_mount_rewrite: Path to rewrite the workspace mount path.
+        cache_dir: Path to cache directory. Defaults to `/tmp/cache`.
         run_as_openhands: Whether to run as openhands.
-        max_iterations: The maximum number of iterations.
-        max_budget_per_task: The maximum budget allowed per task, beyond which the agent will stop.
-        e2b_api_key: The E2B API key.
-        disable_color: Whether to disable color. For terminals that don't support color.
-        debug: Whether to enable debugging.
-        file_uploads_max_file_size_mb: Maximum file size for uploads in megabytes. 0 means no limit.
-        file_uploads_restrict_file_types: Whether to restrict file types for file uploads. Defaults to False.
-        file_uploads_allowed_extensions: List of allowed file extensions for uploads. ['.*'] means all extensions are allowed.
+        max_iterations: Maximum number of iterations allowed.
+        max_budget_per_task: Maximum budget per task, agent stops if exceeded.
+        e2b_api_key: E2B API key.
+        disable_color: Whether to disable terminal colors. For terminals that don't support color.
+        debug: Whether to enable debugging mode.
+        file_uploads_max_file_size_mb: Maximum file upload size in MB. `0` means unlimited.
+        file_uploads_restrict_file_types: Whether to restrict upload file types.
+        file_uploads_allowed_extensions: Allowed file extensions. `['.*']` allows all.
     """
 
     llms: dict[str, LLMConfig] = field(default_factory=dict)
@@ -74,7 +76,7 @@ class AppConfig:
     defaults_dict: ClassVar[dict] = {}
 
     def get_llm_config(self, name='llm') -> LLMConfig:
-        """Llm is the name for default config (for backward compatibility prior to 0.8)"""
+        """'llm' is the name for default config (for backward compatibility prior to 0.8)."""
         if name in self.llms:
             return self.llms[name]
         if name is not None and name != 'llm':
@@ -85,18 +87,18 @@ class AppConfig:
             self.llms['llm'] = LLMConfig()
         return self.llms['llm']
 
-    def set_llm_config(self, value: LLMConfig, name='llm'):
+    def set_llm_config(self, value: LLMConfig, name='llm') -> None:
         self.llms[name] = value
 
     def get_agent_config(self, name='agent') -> AgentConfig:
-        """Agent is the name for default config (for backward compability prior to 0.8)"""
+        """'agent' is the name for default config (for backward compatibility prior to 0.8)."""
         if name in self.agents:
             return self.agents[name]
         if 'agent' not in self.agents:
             self.agents['agent'] = AgentConfig()
         return self.agents['agent']
 
-    def set_agent_config(self, value: AgentConfig, name='agent'):
+    def set_agent_config(self, value: AgentConfig, name='agent') -> None:
         self.agents[name] = value
 
     def get_agent_to_llm_config_map(self) -> dict[str, LLMConfig]: