remotelogin/devices/managers/files.py
def upload(self, local_files, remote_path='', device_files_path=None, device_folder_location='', remote_folder='',
               conn_name=None, **conn_kwargs):
        """ uploads a series of files given by local_files, to the device.

         Args:
            local_files (list): list of file paths in the local server that we want to upload to this device
            device_files_path (list): list of file paths on the device for every file given in local_files. If given this should be of the same size of local_files
            device_folder_location (str): this is used if device_files_path is not given. if neither of them is given the files will be uploaded to the home dir of the user
            conn_kwargs (dict): user, interface and/or tunnel name to use for the connection
         Returns:
              list: list of paths of the files uploaded at the device

        """
        device_files_path = device_files_path or remote_path
        device_files_path = utils.lists.to_sequence(device_files_path) if device_files_path else []
        local_files = utils.lists.to_sequence(local_files)

        if device_files_path and not len(device_files_path) == len(local_files):
            raise ValueError('Number of files path do not match between local and remote')

        uploaded_files_path = dict()

        device_folder_location = device_folder_location or remote_folder

        if device_folder_location:
            device_folder_location += self._dev.os.path.sep

        conn_name = conn_name or conn_kwargs.pop('name', None)
        with self._dev.conn.get_open_instance(name=conn_name, open_if_close=True, **conn_kwargs) as conn:
            for i, file_path in enumerate(local_files):
                if not device_files_path:
                    remote_file = self._dev.os.path.join(device_folder_location, os.path.basename(file_path))
                else:
                    remote_file = device_files_path[i]

                if not os.path.isabs(file_path):
                    file_path = os.path.join(self._dev_folder, file_path)

                conn.put_file(file_path, remote_file)
                uploaded_files_path[file_path] = remote_file

        return uploaded_files_path
 uploads a series of files given by local_files, to the device.

         Args:
            local_files (list): list of file paths in the local server that we want to upload to this device
            device_files_path (list): list of file paths on the device for every file given in local_files. If given this should be of the same size of local_files
            device_folder_location (str): this is used if device_files_path is not given. if neither of them is given the files will be uploaded to the home dir of the user
            conn_kwargs (dict): user, interface and/or tunnel name to use for the connection
         Returns:
              list: list of paths of the files uploaded at the device

        
uploads a series of files given by local_files, to the device.
uploads a series of files given by local_files to the device .
def upload(self, local_files, remote_path='', device_files_path=None, device_folder_location='', remote_folder='',
               conn_name=None, **conn_kwargs):
        device_files_path = device_files_path or remote_path
        device_files_path = utils.lists.to_sequence(device_files_path) if device_files_path else []
        local_files = utils.lists.to_sequence(local_files)
        if device_files_path and not len(device_files_path) == len(local_files):
            raise ValueError('Number of files path do not match between local and remote')
        uploaded_files_path = dict()
        device_folder_location = device_folder_location or remote_folder
        if device_folder_location:
            device_folder_location += self._dev.os.path.sep
        conn_name = conn_name or conn_kwargs.pop('name', None)
        with self._dev.conn.get_open_instance(name=conn_name, open_if_close=True, **conn_kwargs) as conn:
            for i, file_path in enumerate(local_files):
                if not device_files_path:
                    remote_file = self._dev.os.path.join(device_folder_location, os.path.basename(file_path))
                else:
                    remote_file = device_files_path[i]
                if not os.path.isabs(file_path):
                    file_path = os.path.join(self._dev_folder, file_path)
                conn.put_file(file_path, remote_file)
                uploaded_files_path[file_path] = remote_file
        return uploaded_files_path
def upload ( self , local_files , remote_path = '' , device_files_path = None , device_folder_location = '' , remote_folder = '' , conn_name = None , ** conn_kwargs ) : device_files_path = device_files_path or remote_path device_files_path = utils . lists . to_sequence ( device_files_path ) if device_files_path else [ ] local_files = utils . lists . to_sequence ( local_files ) if device_files_path and not len ( device_files_path ) == len ( local_files ) : raise ValueError ( 'Number of files path do not match between local and remote' ) uploaded_files_path = dict ( ) device_folder_location = device_folder_location or remote_folder if device_folder_location : device_folder_location += self . _dev . os . path . sep conn_name = conn_name or conn_kwargs . pop ( 'name' , None ) with self . _dev . conn . get_open_instance ( name = conn_name , open_if_close = True , ** conn_kwargs ) as conn : for i , file_path in enumerate ( local_files ) : if not device_files_path : remote_file = self . _dev . os . path . join ( device_folder_location , os . path . basename ( file_path ) ) else : remote_file = device_files_path [ i ] if not os . path . isabs ( file_path ) : file_path = os . path . join ( self . _dev_folder , file_path ) conn . put_file ( file_path , remote_file ) uploaded_files_path [ file_path ] = remote_file return uploaded_files_path
uploads a series of files given by local_files, to the device.
uploads a series of files given by local_files to the device .
""" uploads a series of files given by local_files, to the device.

         Args:
            local_files (list): list of file paths in the local server that we want to upload to this device
            device_files_path (list): list of file paths on the device for every file given in local_files. If given this should be of the same size of local_files
            device_folder_location (str): this is used if device_files_path is not given. if neither of them is given the files will be uploaded to the home dir of the user
            conn_kwargs (dict): user, interface and/or tunnel name to use for the connection
         Returns:
              list: list of paths of the files uploaded at the device

        """
list of paths of the files uploaded at the device
list of paths of the files uploaded at the device
list
self
local_files
list of file paths in the local server that we want to upload to this device
list of file paths in the local server that we want to upload to this device
remote_path
device_files_path
list of file paths on the device for every file given in local_files. If given this should be of the same size of local_files
list of file paths on the device for every file given in local_files . If given this should be of the same size of local_files
device_folder_location
this is used if device_files_path is not given. if neither of them is given the files will be uploaded to the home dir of the user
this is used if device_files_path is not given . if neither of them is given the files will be uploaded to the home dir of the user
remote_folder
conn_name
conn_kwargs
user, interface and/or tunnel name to use for the connection
user interface and / or tunnel name to use for the connection