Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Dec 7, 2023
1 parent 63865c0 commit 26d6ce6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions snakemake_storage_plugin_gcs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from dataclasses import dataclass, field
import sys
from typing import Any, Iterable, List, Optional
from snakemake_interface_common.utils import lazy_property
from snakemake_interface_storage_plugins.settings import StorageProviderSettingsBase
Expand All @@ -17,7 +16,7 @@
StorageObjectGlob,
)
from snakemake_interface_storage_plugins.common import Operation
from snakemake_interface_storage_plugins.io import IOCacheStorageInterface, Mtime
from snakemake_interface_storage_plugins.io import IOCacheStorageInterface
from urllib.parse import urlparse
import base64
import os
Expand Down Expand Up @@ -464,7 +463,7 @@ def bucket(self):
return self.client.bucket(
self.bucket_name, user_project=self.provider.settings.project
)

@property
def blob(self):
return self.bucket.blob(self.key)
Expand Down
8 changes: 5 additions & 3 deletions tests/test_fake_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
from google.cloud import storage

# This endpoint assumes that you are using the default port 4443 from the container.
# If you are using a different port, please set the environment variable STORAGE_EMULATOR_HOST.
# If you are using a different port, please set the environment variable
# STORAGE_EMULATOR_HOST.
os.environ.setdefault("STORAGE_EMULATOR_HOST", "http://localhost:4443")


client = storage.Client(
credentials=AnonymousCredentials(),
project="test",
# Alternatively instead of using the global env STORAGE_EMULATOR_HOST. You can define it here.
# Alternatively instead of using the global env STORAGE_EMULATOR_HOST. You can
# define it here.
# This will set this client object to point to the local google cloud storage.
# client_options={"api_endpoint": "http://localhost:4443"},
)
Expand All @@ -35,4 +37,4 @@
# Create a new Bucket
bucket = client.bucket("snakemake-test-bucket")
client.create_bucket(bucket)
bucket.blob("test-file.txt").upload_from_string("Hello World!")
bucket.blob("test-file.txt").upload_from_string("Hello World!")

0 comments on commit 26d6ce6

Please sign in to comment.