lentiq.io module
from lentiq.lentiq_dict import LentiqDict def __get_storage_wrapper(remote_path): lq_dict = LentiqDict.get_instance() storage_wrapper = lq_dict.get_storage_wrapper(remote_path) if storage_wrapper is None: raise Exception("Bucket not initialized!") return storage_wrapper def open_file(remote_path, mode): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.open_file(remote_path, mode) def get_file(remote_path, file_obj): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.get_file(remote_path, file_obj) def get_file_as_string(remote_path): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.get_file_as_string(remote_path) def get(remote_path, local_path=None): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.get(remote_path, local_path) def put_file(file_obj, remote_path, overwrite=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.put_file(file_obj, remote_path, overwrite) def put_file_from_local(local_path, remote_path, overwrite=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.put_file_from_local(local_path, remote_path, overwrite) def put_file_from_string(s, remote_path, overwrite=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.put_file_from_string(s, remote_path, overwrite) def put(path_or_object, remote_path): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.put(path_or_object, remote_path) def create_directory(remote_path, create_all=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.create_directory(remote_path, create_all) def mkdir(remote_path, create_all=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.mkdir(remote_path, create_all) def list_directory(remote_path, extended=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.list_directory(remote_path, extended) def ls(remote_path, extended=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.ls(remote_path, extended) def file_exists(remote_path): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.file_exists(remote_path) def get_file_size(remote_path): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.get_file_size(remote_path) def get_default_path(): lq_dict = LentiqDict.get_instance() return lq_dict.get_default_path().rstrip("/") def path(path): return "{}/{}".format(get_default_path(),path.lstrip("/"))
Functions
def create_directory(
remote_path, create_all=False)
def create_directory(remote_path, create_all=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.create_directory(remote_path, create_all)
def file_exists(
remote_path)
def file_exists(remote_path): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.file_exists(remote_path)
def get(
remote_path, local_path=None)
def get(remote_path, local_path=None): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.get(remote_path, local_path)
def get_default_path(
)
def get_default_path(): lq_dict = LentiqDict.get_instance() return lq_dict.get_default_path().rstrip("/")
def get_file(
remote_path, file_obj)
def get_file(remote_path, file_obj): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.get_file(remote_path, file_obj)
def get_file_as_string(
remote_path)
def get_file_as_string(remote_path): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.get_file_as_string(remote_path)
def get_file_size(
remote_path)
def get_file_size(remote_path): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.get_file_size(remote_path)
def list_directory(
remote_path, extended=False)
def list_directory(remote_path, extended=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.list_directory(remote_path, extended)
def ls(
remote_path, extended=False)
def ls(remote_path, extended=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.ls(remote_path, extended)
def mkdir(
remote_path, create_all=False)
def mkdir(remote_path, create_all=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.mkdir(remote_path, create_all)
def open_file(
remote_path, mode)
def open_file(remote_path, mode): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.open_file(remote_path, mode)
def path(
path)
def path(path): return "{}/{}".format(get_default_path(),path.lstrip("/"))
def put(
path_or_object, remote_path)
def put(path_or_object, remote_path): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.put(path_or_object, remote_path)
def put_file(
file_obj, remote_path, overwrite=False)
def put_file(file_obj, remote_path, overwrite=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.put_file(file_obj, remote_path, overwrite)
def put_file_from_local(
local_path, remote_path, overwrite=False)
def put_file_from_local(local_path, remote_path, overwrite=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.put_file_from_local(local_path, remote_path, overwrite)
def put_file_from_string(
s, remote_path, overwrite=False)
def put_file_from_string(s, remote_path, overwrite=False): storage_wrapper = __get_storage_wrapper(remote_path) return storage_wrapper.put_file_from_string(s, remote_path, overwrite)