original_docstring: 
          Task for downloading files from an SFTP server.
  
          Args:
              - host (str): Name of the host to use.
              - username (str): Username used to authenticate.
              - password (str): Password used to authenticate.
              - port_number (int): The port to connect to the server.
              - remote_path (str): The remote SFTP file path.
              - local_path (str): The local file path to download file to.
  
          Raises:
              - ValueError: Raised if a required parameter is not supplied.
              - ClientError: Raised if exception occurs when connecting/downloading from the server.
          
docstring: Task for downloading files from an SFTP server.
docstring_tokens: Task for downloading files from an SFTP server .
code: def run(
          self,
          host: str = None,
          username: str = None,
          password: str = None,
          port_number: int = None,
          remote_path: str = None,
          local_path: str = None,
      ):
          """
          Task for downloading files from an SFTP server.
  
          Args:
              - host (str): Name of the host to use.
              - username (str): Username used to authenticate.
              - password (str): Password used to authenticate.
              - port_number (int): The port to connect to the server.
              - remote_path (str): The remote SFTP file path.
              - local_path (str): The local file path to download file to.
  
          Raises:
              - ValueError: Raised if a required parameter is not supplied.
              - ClientError: Raised if exception occurs when connecting/downloading from the server.
          """
          if not host:
              raise ValueError("A host name must be provided")
          if not username:
              raise ValueError("User name must be provided")
          if not password:
              raise ValueError("A password must be provided")
          if not port_number:
              raise ValueError("A port_number name must be provided")
          if not remote_path:
              raise ValueError("A remote_path must be provided")
  
          # set default to local path if arg not provided
          self.local_path = (
              "sftp_downloads/" + remote_path.split("/")[-1]
              if local_path is None
              else local_path
          )
  
          # check if local path exists or not
          local_dir = "/".join(self.local_path.split("/")[:-1]) + "/"
          if not os.path.isdir(local_dir):
              os.mkdir(local_dir)
  
          with contextlib.closing(self._create_connection()) as conn:
              self.file_exists(remote_path, conn)
              conn.get(remote_path, local_path, callback=None)
code_tokens: def run ( self , host : str = None , username : str = None , password : str = None , port_number : int = None , remote_path : str = None , local_path : str = None , ) : if not host : raise ValueError ( "A host name must be provided" ) if not username : raise ValueError ( "User name must be provided" ) if not password : raise ValueError ( "A password must be provided" ) if not port_number : raise ValueError ( "A port_number name must be provided" ) if not remote_path : raise ValueError ( "A remote_path must be provided" ) self . local_path = ( "sftp_downloads/" + remote_path . split ( "/" ) [ - 1 ] if local_path is None else local_path ) local_dir = "/" . join ( self . local_path . split ( "/" ) [ : - 1 ] ) + "/" if not os . path . isdir ( local_dir ) : os . mkdir ( local_dir ) with contextlib . closing ( self . _create_connection ( ) ) as conn : self . file_exists ( remote_path , conn ) conn . get ( remote_path , local_path , callback = None )
short_docstring: Task for downloading files from an SFTP server.
short_docstring_tokens: Task for downloading files from an SFTP server .
comment: """
          Task for downloading files from an SFTP server.
  
          Args:
              - host (str): Name of the host to use.
              - username (str): Username used to authenticate.
              - password (str): Password used to authenticate.
              - port_number (int): The port to connect to the server.
              - remote_path (str): The remote SFTP file path.
              - local_path (str): The local file path to download file to.
  
          Raises:
              - ValueError: Raised if a required parameter is not supplied.
              - ClientError: Raised if exception occurs when connecting/downloading from the server.
          """$SEP$# set default to local path if arg not provided$SEP$# check if local path exists or not