Exemplo n.º 1
0
def log_files(dir:SubFS) -> list:
    """
    Given a directory, produces a list of json files in ascending chronological order.
    :param dir:
    :type dir:
    :return:
    :rtype:
    """
    name = dir.sub_dir[1:]      # remove /
    ext = '.json'
    files = [f for f in dir.listdir() if dir.isfile(f)]
    return sort_and_filter_log_files(files, name, ext)
Exemplo n.º 2
0
def log_files(dir: SubFS) -> list:
    """
    Given a directory, produces a list of json files in ascending chronological order.
    :param dir:
    :type dir:
    :return:
    :rtype:
    """
    name = dir.sub_dir[1:]  # remove /
    ext = '.json'
    files = [f for f in dir.listdir() if dir.isfile(f)]
    return sort_and_filter_log_files(files, name, ext)
Exemplo n.º 3
0
    def opendir(self, path):
        """Opens a directory and returns a FS object representing its contents.

        :param path: path to directory to open
        :rtype: an FS object
        
        """

        from fs.wrapfs.subfs import SubFS
        if not self.exists(path):
            raise ResourceNotFoundError(path)
        return SubFS(self, path)
Exemplo n.º 4
0
 def _setup(self):
     if make:
         fs.makedir(path, allow_recreate=True, recursive=make_recursive)
     elif not fs.exists(path):
         raise ResourceNotFoundError(path)
     self._wrapped = SubFS(fs, path)