Skip to content

Commit

Permalink
Revert "Handle the SaasBucket specifics"
Browse files Browse the repository at this point in the history
This reverts commit 5241057.
  • Loading branch information
Shmuma committed Dec 18, 2024
1 parent e59f449 commit d0f5fcd
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions exasol/nb_connector/bfs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@
_logger = logging.getLogger(__name__)


def _file_in_bucket(file_name: str, bucket: bfs.Bucket) -> bool:
"""
Checks that given file name is present in bucket.
:param file_name: name to check
:param bucket: bucket object
:return: True if name is present, else False
"""
try:
return file_name in list(bucket)
except TypeError as e:
# SaaSBucket is not iterable, need to handle it here
if e.args[0].endswith("not iterable"):
return False
raise e


def put_file(bucket: bfs.Bucket, file_path: pathlib.Path,
skip_if_exists: bool = True) -> pathlib.Path:
"""
Expand All @@ -37,7 +21,7 @@ def put_file(bucket: bfs.Bucket, file_path: pathlib.Path,
if not file_path.exists():
raise ValueError(f"Local file doesn't exist: {file_path}")
local_name = file_path.name
if skip_if_exists and _file_in_bucket(local_name, bucket):
if skip_if_exists and local_name in list(bucket):
_logger.info("File %s is already present in the bucketfs", local_name)
else:
_logger.info("Uploading file %s to bucketfs", local_name)
Expand Down

0 comments on commit d0f5fcd

Please sign in to comment.