Load a trajectory file from a remote location specified by *url*.

    .. seealso:: load_remote_system
350487
def load_remote_trajectory(url, format=None):
    '''
    
    '''
    from urllib import urlretrieve
    filename, headers = urlretrieve(url)
    load_trajectory(filename, format)
834384
def _load_url(url):
    
    try:
        response = requests.get(url)
        return BytesIO(response.content)
    except IOError as ex:
        parser.error("{url} could not be loaded remotely! ({ex})".format(url=url, ex=ex))
917533
def load(path=None, root=None, db=None, load_user=True):
    " "

    config = load_config(path, load_user=load_user)

    remotes = load_remotes(path, load_user=load_user)

    # The external file overwrites the main config
    if remotes:
        if not 'remotes' in config:
            config.remotes = AttrDict()

        for k, v in remotes.remotes.items():
            config.remotes[k] = v

    accounts = load_accounts(path, load_user=load_user)

    # The external file overwrites the main config
    if accounts:
        if not 'accounts' in config:
            config.accounts = AttrDict()
        for k, v in accounts.accounts.items():
            config.accounts[k] = v

    update_config(config)

    if root:
        config.library.filesystem_root = root

    if db:
        config.library.database = db

    return config
1025770
def getfile(url, outdir=None):
    
    fn = os.path.split(url)[-1]
    if outdir is not None:
        fn = os.path.join(outdir, fn)
    if not os.path.exists(fn):
        #Find appropriate urlretrieve for Python 2 and 3
        try:
            from urllib.request import urlretrieve
        except ImportError:
            from urllib import urlretrieve 
        print("Retrieving: %s" % url)
        #Add progress bar
        urlretrieve(url, fn)
    return fn
195992
def load_waypoints(self, filename):
        ''''''
        self.wploader.target_system = self.target_system
        self.wploader.target_component = self.target_component
        try:
            self.wploader.load(filename)
        except Exception as msg:
            print("Unable to load %s - %s" % (filename, msg))
            return
        print("Loaded %u waypoints from %s" % (self.wploader.count(), filename))
        self.send_all_waypoints()
579889
def load(cls, path):
        
        auth = cls()
        with open(path) as fd:
            for pubkey in itertools.imap(str.strip, fd):
                # skip empty lines
                if not pubkey:
                    continue
                auth.add(pubkey)
        return auth
537309
def pull(self, remote: _PATH, local: _PATH) -> None:
        ''''''
        output, _ = self._execute('-s', self.device_sn, 'pull', remote, local)
        if 'error' in output:
            raise FileNotFoundError(f'Remote {remote!r} does not exist.')
770463
def _map_trajectory(self):
        
        self.trajectory_map = {}
        with open(self.filepath, 'r') as trajectory_file:
            with closing(
                    mmap(
                        trajectory_file.fileno(), 0,
                        access=ACCESS_READ)) as mapped_file:
                progress = 0
                line = 0
                frame = -1
                frame_start = 0
                while progress <= len(mapped_file):
                    line = line + 1
                    # We read a binary data from a mapped file.
                    bline = mapped_file.readline()
                    # If the bline length equals zero we terminate.
                    # We reached end of the file but still add the last frame!
                    if len(bline) == 0:
                        frame = frame + 1
                        if progress - frame_start > 10:
                            self.trajectory_map[frame] = [
                                frame_start, progress
                            ]
                        break
                    # We need to decode byte line into an utf-8 string.
                    sline = bline.decode("utf-8").strip('\n').split()
                    # We extract map's byte coordinates for each frame
                    if len(sline) == 1 and sline[0] == 'END':
                        frame = frame + 1
                        self.trajectory_map[frame] = [frame_start, progress]
                        frame_start = progress
                    # Here we extract the map's byte coordinates for the header
                    # And also the periodic system type needed for later.
                    progress = progress + len(bline)
            self.no_of_frames = frame
577627
def get_remote_url(path, remote="origin"):
    
    path = get_path(path)
    cmd = ["config", "--get", "remote.%s.url" % remote]
    return __run_git(cmd, path)[0]
417304
def download(remote_location, remotes=None, prefix="", dry_run=False):
    
    if remotes is None:
        remotes, _ = _resources_files(
            abs_paths=remote_location.startswith('s3://'))
    if remote_location.startswith('s3://'):
        from .s3 import S3Backend
        backend = S3Backend(remote_location, dry_run=dry_run)
        backend.download(list_local(remotes, prefix), prefix)
    else:
        dest_root = '.'
        shell_command([
                '/usr/bin/rsync',
                '-thrRvz', '--rsync-path', '/usr/bin/rsync',
                '%s/./' % remote_location, dest_root], dry_run=dry_run)
176638
def load_controllers
      return unless File.directory?(controllers_path)

      path = File.realpath(controllers_path)
      $LOAD_PATH.unshift(path)
      Dir["#{path}/**/*.rb"].each do |f|
        next if f.include?('_pb') # exclude if people include proto generated files in app/rpc

        logger.info "- Loading gRPC service file: #{f}"
        load File.realpath(f)
      end
    end
119217
def load(*args)
      super(*args)
      self.id = self.uri.split('/').last if self.id.nil? and defined? self.uri
    end
188809
def download_url(self, remote_path, **kwargs):
        

        def get_url(dlink):
            return self.session.get(dlink,
                                    headers=BAIDUPAN_HEADERS,
                                    stream=True).url

        if not hasattr(self, 'dsign'):
            self.get_sign()

        if isinstance(remote_path, str) or isinstance(remote_path, str):
            remote_path = [remote_path]

        file_list = []
        jdata = json.loads(self.meta(remote_path).content)
        if jdata['errno'] != 0:
            jdata = self.__err_handler('generic', jdata['errno'],
                                       self.meta,
                                       args=(remote_path,)
                                       )
        logging.debug('[*]' + str(jdata))
        for i, entry in enumerate(jdata['info']):
            url = entry['dlink']
            foo = get_url(url)
            if 'wenxintishi' in foo:
                file_list.append(self._yunguanjia_format(remote_path[i]))
            else:
                file_list.append(get_url(entry['dlink']))

        return file_list
249376
def load_trajectory(name, format=None, skip=1):
    '''

    '''
    df = datafile(name, format=format)

    ret = {}
    t, coords = df.read('trajectory', skip=skip)
    boxes = df.read('boxes')
    ret['t'] = t
    ret['coords'] = coords
    ret['boxes'] = boxes

    return ret
318878
def _load(self, reload=False):
        
        if self.autoreload or reload:
            # First, we load from YAML, failing if syntax errors are found
            options = self.storage_options or {}
            if hasattr(self.path, 'path') or hasattr(self.path, 'read'):
                file_open = self.path
                self.path = make_path_posix(
                    getattr(self.path, 'path',
                            getattr(self.path, 'name', 'file')))
            else:
                file_open = open_files(self.path, mode='rb', **options)
                assert len(file_open) == 1
                file_open = file_open[0]
            self._dir = get_dir(self.path)

            with file_open as f:
                text = f.read().decode()
            if "!template " in text:
                logger.warning("Use of '!template' deprecated - fixing")
                text = text.replace('!template ', '')
            self.parse(text)
1100736
def download_file(self, remote, local):
        
        file = open(local, 'wb')
        try:
            self.download(remote, file)
        finally:
            file.close()
919687
def load_remotes(extra_path=None, load_user=True):
    

    from os.path import getmtime

    try:
        remotes_file = find_config_file(REMOTES_FILE, extra_path=extra_path, load_user=load_user)
    except ConfigurationError:
        remotes_file = None


    if remotes_file is not None and os.path.exists(remotes_file):
        config = AttrDict()
        config.update_yaml(remotes_file)

        if not 'remotes' in config:
            config.remotes = AttrDict()

        config.remotes.loaded = [remotes_file, getmtime(remotes_file)]

        return config
    else:
        return None