@@ -900,8 +900,11 @@ class S3File(AbstractBufferedFile):
900
900
def __init__ (self , s3 , path , mode = 'rb' , block_size = 5 * 2 ** 20 , acl = "" ,
901
901
version_id = None , fill_cache = True , s3_additional_kwargs = None ,
902
902
autocommit = True , cache_type = 'bytes' ):
903
- if not split_path (path )[1 ]:
903
+ bucket , key = split_path (self .path )
904
+ if not key :
904
905
raise ValueError ('Attempt to open non key-like path: %s' % path )
906
+ self .bucket = bucket
907
+ self .key = key
905
908
self .version_id = version_id
906
909
self .acl = acl
907
910
self .mpu = None
@@ -966,16 +969,6 @@ def _initiate_upload(self):
966
969
self .parts .append ({'PartNumber' : 1 ,
967
970
'ETag' : out ['CopyPartResult' ]['ETag' ]})
968
971
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
-
979
972
def metadata (self , refresh = False , ** kwargs ):
980
973
""" Return metadata of file.
981
974
See :func:`~s3fs.S3Filesystem.metadata`.
@@ -1083,7 +1076,7 @@ def commit(self):
1083
1076
1084
1077
def discard (self ):
1085
1078
if self .autocommit :
1086
- raise ValueError ("Cannot discad when autocommit is enabled" )
1079
+ raise ValueError ("Cannot discard when autocommit is enabled" )
1087
1080
self ._call_s3 (
1088
1081
self .fs .s3 .abort_multipart_upload ,
1089
1082
Bucket = self .bucket ,
0 commit comments