Skip to content

Commit 21e56af

Browse files
Attributes instead of properties
1 parent 625f94f commit 21e56af

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

s3fs/core.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,11 @@ class S3File(AbstractBufferedFile):
900900
def __init__(self, s3, path, mode='rb', block_size=5 * 2 ** 20, acl="",
901901
version_id=None, fill_cache=True, s3_additional_kwargs=None,
902902
autocommit=True, cache_type='bytes'):
903-
if not split_path(path)[1]:
903+
bucket, key = split_path(self.path)
904+
if not key:
904905
raise ValueError('Attempt to open non key-like path: %s' % path)
906+
self.bucket = bucket
907+
self.key = key
905908
self.version_id = version_id
906909
self.acl = acl
907910
self.mpu = None
@@ -966,16 +969,6 @@ def _initiate_upload(self):
966969
self.parts.append({'PartNumber': 1,
967970
'ETag': out['CopyPartResult']['ETag']})
968971

969-
@property
970-
def bucket(self):
971-
bucket, key = split_path(self.path)
972-
return bucket
973-
974-
@property
975-
def key(self):
976-
bucket, key = split_path(self.path)
977-
return key
978-
979972
def metadata(self, refresh=False, **kwargs):
980973
""" Return metadata of file.
981974
See :func:`~s3fs.S3Filesystem.metadata`.
@@ -1083,7 +1076,7 @@ def commit(self):
10831076

10841077
def discard(self):
10851078
if self.autocommit:
1086-
raise ValueError("Cannot discad when autocommit is enabled")
1079+
raise ValueError("Cannot discard when autocommit is enabled")
10871080
self._call_s3(
10881081
self.fs.s3.abort_multipart_upload,
10891082
Bucket=self.bucket,

0 commit comments

Comments
 (0)