Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import json
from urllib.parse import urlparse
from traitlets import Any
from s3contents.genericmanager import GenericContentsManager, from_dict
from s3contents.ipycompat import Unicode
from s3contents.s3_fs import S3FS
class S3ContentsManager(GenericContentsManager):
access_key_id = Unicode(
help="S3/AWS access key ID", allow_none=True, default_value=None
).tag(config=True, env="JPYNB_S3_ACCESS_KEY_ID")
secret_access_key = Unicode(
help="S3/AWS secret access key", allow_none=True, default_value=None
).tag(config=True, env="JPYNB_S3_SECRET_ACCESS_KEY")
endpoint_url = Unicode("https://s3.amazonaws.com", help="S3 endpoint URL").tag(
config=True, env="JPYNB_S3_ENDPOINT_URL"
)
region_name = Unicode("us-east-1", help="Region name").tag(
config=True, env="JPYNB_S3_REGION_NAME"
)
bucket = Unicode("notebooks", help="Bucket name to store notebooks").tag(
config=True, env="JPYNB_S3_BUCKET"
from s3contents.gcs_fs import GCSFS
from s3contents.genericmanager import GenericContentsManager
from s3contents.ipycompat import Unicode
class GCSContentsManager(GenericContentsManager):
project = Unicode(help="GCP Project", allow_none=True, default_value=None).tag(
config=True, env="JPYNB_GCS_PROJECT"
)
token = Unicode(
help="Path to the GCP token", allow_none=True, default_value=None
).tag(config=True, env="JPYNB_GCS_TOKEN_PATH")
region_name = Unicode("us-east-1", help="Region name").tag(
config=True, env="JPYNB_GCS_REGION_NAME"
)
bucket = Unicode("notebooks", help="Bucket name to store notebooks").tag(
config=True, env="JPYNB_GCS_BUCKET"
)
prefix = Unicode("", help="Prefix path inside the specified bucket").tag(
def __init__(self, *args, **kwargs):
super(GenericContentsManager, self).__init__(*args, **kwargs)
self._fs = None