Load data from the following sources in order of priority:

        1. Filesystem

        :param relpath: path relative to "data_path"
        :return: str - data content
516970
def load_data(cls, relpath):
        
        filepath = os.path.join(cls.data_path, relpath)
        with open(filepath) as fp:
            content = fp.read()

        return content
1218932
def relpath(self):
        
        here = os.path.abspath(os.path.curdir)
        relpath = os.path.relpath(self.fpath, here)
        return relpath
1224244
def recursive_load(search_root):
    """"""
    for root, dirs, files in os.walk(search_root):
        dir_name = os.path.basename(root)
        if dir_name == 'fixtures':
            for file_name in files:
                fixture_path = os.path.join(root, file_name)
                execute_manage('loaddata', fixture_path)
1162777
def _load_resource(self, source_r, abs_path=False):
        

        from itertools import islice
        from metapack.exc import MetapackError
        from os.path import splitext

        # Refetch the resource ... IIRC b/c the source_r resource may actually be from
        # a different package. So r is the resource we want to possibly modify in this package,
        # while source_r is from a different souce package, whose data is being loaded into this
        # one.

        r = self.datafile(source_r.name)

        if self.reuse_resources:
            self.prt("Re-using data for '{}' ".format(r.name))
        else:
            self.prt("Loading data for '{}' ".format(r.name))

        if not r.name:
            raise MetapackError(f"Resource/reference term has no name: {str(r)}")

        # Special handing for SQL should not be done here; it should be done in Rowgenerators, probably.
        if r.term_is('root.sql'):
            new_r = self.doc['Resources'].new_term('Root.Datafile', '')
            new_r.name = r.name

            self.doc.remove_term(r)

            r = new_r

        r.url = 'data/' + r.name + '.csv' # Re-writing the URL for the resource.

        path = join(self.package_path.path, r.url)

        makedirs(dirname(path), exist_ok=True)

        if not self.reuse_resources or not exists(path):

            if self.reuse_resources:
                self.prt("Resource {} doesn't exist, rebuilding".format(path))

            if exists(path):
                remove(path)

            gen = islice(source_r, 1, None)
            headers = source_r.headers
            self.write_csv(path, headers, gen)

        for k, v in source_r.post_iter_meta.items():
            r[k] = v

        try:
            if source_r.errors:
                for col_name, errors in source_r.errors.items():
                    self.warn("ERRORS for column '{}' ".format(col_name))
                    for e in islice(errors,5):
                        self.warn('   {}'.format(e))
                    if len(errors) > 5:
                        self.warn("... and {} more ".format(len(errors)-5))
        except AttributeError:
            pass # Maybe generator does not track errors

        if source_r.errors:
            self.err("Resource processing generated conversion errors")

        # Writing between resources so row-generating programs and notebooks can
        # access previously created resources. We have to clean the doc before writing it

        ref = self._write_doc()

        # What a wreck ... we also have to get rid of the 'Transform' values, since the CSV files
        # that are written don't need them, and a lot of intermediate processsing ( specifically,
        # jupyter Notebooks, ) does not load them.
        p = FileSystemPackageBuilder(ref, self.package_root)
        p._clean_doc()

        ref = p._write_doc()
747133
def _load_data_and_files(self):
        
        if not _hasattr(self, '_data'):
            self._data, self._files = self._parse()
            if self._files:
                self._full_data = self._data.copy()
                self._full_data.update(self._files)
            else:
                self._full_data = self._data
435509
def load_file(self, app, pathname, relpath, pypath):
        
        try:
            view_class = self.get_file_view_cls(relpath)
            return create_view_from_file(pathname, source_template=relpath, view_class=view_class)
        except DeclarativeViewError:
            pass
85665
def _load_file(self):
        

        if not os.path.exists(self.file):
            return {}

        with open(self.file, "r") as infile:
            data = json.load(infile)

        return data
1318854
def load_and_set_file_content(self, file_system_path):
        
        content = filesystem.read_file(file_system_path, storage.SCRIPT_FILE)
        if content is not None:
            self.set_script_text(content)
1171252
def load_content(self, path):
        ""
        log.debug('Opening {0} in {1} load_content'.format(path, __name__))
        with open(path) as fin:
            self.path = path
            self.content = fin.read()
1117255
def load(path, shuffle=True):
        
        df = LMDBData(path, shuffle=shuffle)
        return MapData(df, lambda dp: loads(dp[1]))
185345
def load_and_set_file_content(self, file_system_path):
        
        semantic_data = load_data_file(os.path.join(file_system_path, storage.SEMANTIC_DATA_FILE))
        self.model.state.semantic_data = semantic_data
1226759
def relpath(self, path):
        
        for root in self.roots:
            # Root is regex, convert to matching root string
            if isinstance(root, Pattern):
                match = root.match(path)
                if not match:
                    continue
                root = match.group(0)

            # Split root and relative path
            try:
                relative = path.split(root, 1)[1]
                # Strip "/" only at path start. "/" is used to known if
                # path is a directory on some cloud storage.
                return relative.lstrip('/')
            except IndexError:
                continue

        return path
344518
def _load_data(path):
    
    path = os.path.abspath(path)
    if not os.path.isdir(path):
        raise InitializationError('Directory not found: {0}'.format(path))
    wordlists = {}
    for file_name in os.listdir(path):
        if os.path.splitext(file_name)[1] != '.txt':
            continue
        file_path = os.path.join(path, file_name)
        name = os.path.splitext(os.path.split(file_path)[1])[0]
        try:
            with codecs.open(file_path, encoding='utf-8') as file:
                wordlists[name] = _load_wordlist(name, file)
        except OSError as ex:
            raise InitializationError('Failed to read {}: {}'.format(file_path, ex))
    config = _load_config(os.path.join(path, 'config.json'))
    return (config, wordlists)
1091869
def load(self, path):
        
        with open(path) as f:
            code = f.read()
            exec(code, {}, self.__dict__)
340027
def DataPath():
    
    return os.path.abspath('%s/data'%(os.path.dirname( \
        os.path.realpath(__file__))))
151452
def _get_reparse_data(path):
    '''
    
    '''
    # ensure paths are using the right slashes
    path = os.path.normpath(path)

    if not _is_reparse_point(path):
        return None

    fileHandle = None
    try:
        fileHandle = win32file.CreateFileW(
            path,
            0x80000000,  # GENERIC_READ
            1,  # share with other readers
            None,  # no inherit, default security descriptor
            3,  # OPEN_EXISTING
            0x00200000 | 0x02000000  # FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS
        )

        reparseData = win32file.DeviceIoControl(
            fileHandle,
            0x900a8,  # FSCTL_GET_REPARSE_POINT
            None,  # in buffer
            16384  # out buffer size (MAXIMUM_REPARSE_DATA_BUFFER_SIZE)
        )

    finally:
        if fileHandle:
            win32file.CloseHandle(fileHandle)

    return reparseData
1082113
def content(self, file_relpath):
    
    if self.isignored(file_relpath):
      self._raise_access_ignored(file_relpath)

    return self._content_raw(file_relpath)