@@ -47,9 +47,21 @@ def __init__(self) -> None:
4747 self .configure_ssh_hosts ()
4848
4949 def configured_hosts (self ):
50+ """
51+ Return a list of all configured hosts except the default host.
52+
53+ Returns:
54+ list[Host]: List of configured Host objects excluding the default.
55+ """
5056 return list (filter (lambda x : x .alias != "default" , self .hosts ))
5157
5258 def _default_config (self ) -> YamlConfig :
59+ """
60+ Return a default YamlConfig object with empty groups and host_auth.
61+
62+ Returns:
63+ YamlConfig: Default configuration object.
64+ """
5365 return YamlConfig (groups = dict (), host_auth = dict ())
5466
5567 def ensure_config_directory_exists (self ) -> None :
@@ -62,6 +74,16 @@ def ensure_config_directory_exists(self) -> None:
6274 def _resolve_ssh_value (
6375 self , value : str | int | list [str | int ] | None , default : str | int = ""
6476 ) -> str | int :
77+ """
78+ Resolve a value from SSH config, handling lists and defaults.
79+
80+ Args:
81+ value (str | int | list[str | int] | None): The value to resolve.
82+ default (str | int): Default value if input is None or empty.
83+
84+ Returns:
85+ str | int: The resolved value.
86+ """
6587 if isinstance (value , list ):
6688 return value [0 ] if value else default
6789 return value or default
@@ -243,6 +265,12 @@ def get_ungrouped_hosts(self) -> list[str]:
243265 ]
244266
245267 def get_unconfigured_hosts (self ) -> list [dict [str , str ]]:
268+ """
269+ Get a list of hosts that do not have authentication configured.
270+
271+ Returns:
272+ list[dict[str, str]]: List of dicts with alias and identity_file for unconfigured hosts.
273+ """
246274 return [
247275 {"alias" : host .alias , "identity_file" : host .identity_file }
248276 for host in self .hosts
@@ -266,6 +294,12 @@ def assign_groups_to_hosts(self, host_group_mapping: dict[str, list[str]]) -> No
266294 self ._save_yaml ()
267295
268296 def save_host_auth (self , host_auth_details : dict [str , HostAuth ]) -> None :
297+ """
298+ Save authentication details for hosts and update the YAML config file.
299+
300+ Args:
301+ host_auth_details (dict[str, HostAuth]): Mapping of host aliases to HostAuth objects.
302+ """
269303 self .config .host_auth = host_auth_details
270304 self ._save_yaml ()
271305
0 commit comments