Пример #1
0
import os
import traitlets as tl
import numpy as np

from lazy_import import lazy_module, lazy_class, lazy_function

zarr = lazy_module("zarr")
zarr_open = lazy_function("zarr.convenience.open")
zarr_open_consolidated = lazy_function("zarr.convenience.open_consolidated")
zarrGroup = lazy_class("zarr.Group")

from podpac.core.authentication import S3Mixin
from podpac.core.utils import common_doc, cached_property
from podpac.core.data.datasource import COMMON_DATA_DOC, DATA_DOC
from podpac.core.data.file_source import BaseFileSource, FileKeysMixin
from podpac.core.interpolation.interpolation import InterpolationMixin


class ZarrRaw(S3Mixin, FileKeysMixin, BaseFileSource):
    """Create a DataSource node using zarr.

    Attributes
    ----------
    source : str
        Path to the Zarr archive
    file_mode : str, optional
        Default is 'r'. The mode used to open the Zarr archive. Options are r, r+, w, w- or x, a.
    dataset : zarr.Group
        The h5py file object used to read the file
    coordinates : :class:`podpac.Coordinates`
        {coordinates}
Пример #2
0
PODPAC Authentication 
"""


import getpass
import logging

import requests
import traitlets as tl
from lazy_import import lazy_module, lazy_function

from podpac.core.settings import settings
from podpac.core.utils import cached_property

# Optional dependencies
pydap_setup_session = lazy_function("pydap.cas.urs.setup_session")

_log = logging.getLogger(__name__)


def set_credentials(hostname, username=None, password=None):
    """Set authentication credentials for a remote URL in the :class:`podpac.settings`.

    Parameters
    ----------
    hostname : str
        Hostname for `username` and `password`.
    username : str, optional
        Username to store in settings for `hostname`.
        If no username is provided and the username does not already exist in the settings,
        the user will be prompted to enter one.
Пример #3
0
identity = _lazy_import.lazy_module("oci.identity")
key_management = _lazy_import.lazy_module("oci.key_management")
load_balancer = _lazy_import.lazy_module("oci.load_balancer")
object_storage = _lazy_import.lazy_module("oci.object_storage")
resource_search = _lazy_import.lazy_module("oci.resource_search")

auth = _lazy_import.lazy_module("oci.auth")
config = _lazy_import.lazy_module("oci.config")
constants = _lazy_import.lazy_module("oci.constants")
decorators = _lazy_import.lazy_module("oci.decorators")
exceptions = _lazy_import.lazy_module("oci.exceptions")
regions = _lazy_import.lazy_module("oci.regions")
pagination = _lazy_import.lazy_module("oci.pagination")
retry = _lazy_import.lazy_module("retry")

BaseClient = _lazy_import.lazy_class("oci.base_client.BaseClient")
Request = _lazy_import.lazy_class("oci.request.Request")
Signer = _lazy_import.lazy_class("oci.signer.Signer")

# from .version import __version__  # noqa

wait_until = _lazy_import.lazy_function("oci.waiter.wait_until")

__all__ = [
    "BaseClient", "Request", "Signer", "config", "constants", "decorators",
    "exceptions", "regions", "wait_until", "pagination", "auth", "retry",
    "audit", "container_engine", "core", "database", "dns", "email",
    "file_storage", "identity", "key_management", "load_balancer",
    "object_storage", "resource_search"
]
Пример #4
0
 def lazy_class(c):
     return _lazy_import.lazy_function(c)
Пример #5
0
from ._errors import WeakPassphraseError, KeyManipulationError, \
                     SignatureVerificationError
from ._errors import DecryptionError

# tempfile = _lazy_import.lazy_module("tempfile")
import tempfile as _tempfile

_pyotp = _lazy_import.lazy_module("pyotp")

_re = _lazy_import.lazy_module("re")

_rsa = _lazy_import.lazy_module(
    "cryptography.hazmat.primitives.asymmetric.rsa")
_serialization = _lazy_import.lazy_module(
    "cryptography.hazmat.primitives.serialization")
_default_backend = _lazy_import.lazy_function(
    "cryptography.hazmat.backends.default_backend")
_hashes = _lazy_import.lazy_module("cryptography.hazmat.primitives.hashes")
_padding = _lazy_import.lazy_module(
    "cryptography.hazmat.primitives.asymmetric.padding")
_fernet = _lazy_import.lazy_module("cryptography.fernet")

__all__ = ["PrivateKey", "PublicKey"]


def _bytes_to_string(b):
    """Return the passed binary bytes safely encoded to
       a base64 utf-8 string"""
    if b is None:
        return None
    else:
        return _base64.b64encode(b).decode("utf-8")