1+ """Directory helper functions for sysrsync."""
12from typing import Tuple , Optional
23
34
45def get_directory_with_ssh (directory : str , ssh : Optional [str ]) -> str :
56 """
6- Returns the directory path with SSH prefix if SSH is provided.
7+ Return the directory path with SSH prefix if SSH is provided.
78
89 Args:
910 directory (str): The directory path.
@@ -46,7 +47,7 @@ def sanitize_trailing_slash(source_dir, target_dir, sync_sourcedir_contents=True
4647
4748def strip_trailing_slash (directory : str ) -> str :
4849 """
49- Strips the trailing slash from the directory path if it exists.
50+ Strip the trailing slash from the directory path if it exists.
5051
5152 Args:
5253 directory (str): The directory path.
@@ -55,14 +56,12 @@ def strip_trailing_slash(directory: str) -> str:
5556 str: The directory path without the trailing slash, if present. Otherwise,
5657 returns the directory path as is.
5758 """
58-
5959 return (directory [:- 1 ]
6060 if directory .endswith ('/' )
6161 else directory )
6262
6363def add_trailing_slash (directory : str ) -> str :
64- """
65- Adds a trailing slash to the directory path if it doesn't already have one.
64+ """Add a trailing slash to the directory path if it doesn't already have one.
6665
6766 Args:
6867 directory (str): The directory path.
@@ -71,7 +70,6 @@ def add_trailing_slash(directory: str) -> str:
7170 str: The directory path with a trailing slash, if it doesn't already have one.
7271 Otherwise, returns the directory path as is.
7372 """
74-
7573 return (directory
7674 if directory .endswith ('/' )
7775 else f'{ directory } /' )
0 commit comments