plesna/dashboard/libs/fs_schema.py

36 lines
914 B
Python

from .schema import AbstractSchema
from pathlib import Path
class FSSchema(AbstractSchema):
def __init__(self, basepath, metadata_engine=None):
self.basepath = basepath
self._metadata_engine = metadata_engine
def ls(self, dir, only_files=True):
dirpath = Path(dir)
if only_files:
return [f for f in dirpath.iterdir() if f.is_dir()]
return [f for f in dirpath.iterdir()]
def tables(self, dir, only_files=True):
dirpath = Path(dir)
if only_files:
return [f for f in dirpath.iterdir() if f.is_dir()]
return [f for f in dirpath.iterdir()]
def info(self, path):
path = Path(path)
pass
def read(self, path):
path = Path(path)
pass
def write(self, path, content):
path = Path(path)
pass
def delete(self, path):
path = Path(path)
pass