Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for galaxy.files.sources.onedata

try:
    from fs.onedatarestfs import OnedataRESTFS
except ImportError:
    OnedataRESTFS = None

from typing import Optional

from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource


def remove_prefix(prefix, string):
    if string.startswith(prefix):
        string = string[len(prefix) :]
    return string


[docs]class OnedataFilesSource(PyFilesystem2FilesSource): plugin_type = "onedata" required_module = OnedataRESTFS required_package = "fs.onedatarestfs" def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None): props = self._serialization_props(user_context) onezone_domain = props.pop("onezoneDomain", "") or "" onezone_domain = remove_prefix("http://", remove_prefix("https://", onezone_domain)) access_token = props.pop("accessToken", "") or "" handle = OnedataRESTFS(onezone_domain, access_token) return handle
__all__ = ("OnedataFilesSource",)