@@ -97,7 +97,6 @@ def get_endpoint_url(storage_options):
9797 endpoint_url = client_kwargs .get ('endpoint_url' )
9898 if endpoint_url is not None :
9999 return endpoint_url
100- return None
101100
102101
103102def load_from_https (uri , storage_options = None ):
@@ -516,6 +515,10 @@ def _from_storage(self, ds, indexer, chunks, out_shape, out_dtype,
516515 if self .storage_type == "s3" and self ._version == 2 :
517516 if self .storage_options is not None :
518517 key , secret = None , None
518+ if self .storage_options .get ("anon" , None ) is True :
519+ print ("Reductionist session for Anon S3 bucket." )
520+ session = reductionist .get_session (
521+ None , None , S3_ACTIVE_STORAGE_CACERT )
519522 if "key" in self .storage_options :
520523 key = self .storage_options ["key" ]
521524 if "secret" in self .storage_options :
@@ -629,7 +632,6 @@ def _get_endpoint_url(self):
629632 endpoint_url = get_endpoint_url (self .storage_options )
630633 if endpoint_url is not None :
631634 return endpoint_url
632-
633635 return f"http://{ urllib .parse .urlparse (self .filename ).netloc } "
634636
635637 def _process_chunk (self ,
@@ -675,7 +677,6 @@ def _process_chunk(self,
675677
676678 elif self .storage_type == "s3" and self ._version == 2 :
677679 # S3: pass in pre-configured storage options (credentials)
678- # print("S3 rfile is:", self.filename)
679680 parsed_url = urllib .parse .urlparse (self .filename )
680681
681682 bucket = parsed_url .netloc
@@ -686,8 +687,6 @@ def _process_chunk(self,
686687 if bucket == "" :
687688 bucket = os .path .dirname (object )
688689 object = os .path .basename (object )
689- # print("S3 bucket:", bucket)
690- # print("S3 file:", object)
691690 if self .storage_options is None :
692691
693692 # for the moment we need to force ds.dtype to be a numpy type
@@ -707,15 +706,9 @@ def _process_chunk(self,
707706 axis ,
708707 operation = self ._method )
709708 else :
710- # special case for "anon=True" buckets that work only with e.g.
711- # fs = s3fs.S3FileSystem(anon=True, client_kwargs={'endpoint_url': S3_URL})
712- # where file uri = bucketX/fileY.mc
713- # print("S3 Storage options to Reductionist:", self.storage_options)
714709 if self .storage_options .get ("anon" , None ) is True :
715- bucket = os .path .dirname (parsed_url .path ) # bucketX
716- object = os .path .basename (parsed_url .path ) # fileY
717- print ("S3 anon=True Bucket and File:" , bucket , object )
718-
710+ bucket = os .path .dirname (parsed_url .path )
711+ object = os .path .basename (parsed_url .path )
719712 # Reductionist returns "count" as a list even for single elements
720713 tmp , count = reductionist .reduce_chunk (
721714 session ,
0 commit comments