MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / listdir

Method listdir

tensorboard/compat/tensorflow_stub/io/gfile.py:378–394  ·  view source on GitHub ↗

Returns a list of entries contained within a directory.

(self, dirname)

Source from the content-addressed store, hash-verified

376 return False
377
378 def listdir(self, dirname):
379 """Returns a list of entries contained within a directory."""
380 client = boto3.client("s3", endpoint_url=self._s3_endpoint)
381 bucket, path = self.bucket_and_path(dirname)
382 p = client.get_paginator("list_objects")
383 if not path.endswith("/"):
384 path += "/" # This will now only retrieve subdir content
385 keys = []
386 for r in p.paginate(Bucket=bucket, Prefix=path, Delimiter="/"):
387 keys.extend(
388 o["Prefix"][len(path) : -1] for o in r.get("CommonPrefixes", [])
389 )
390 for o in r.get("Contents", []):
391 key = o["Key"][len(path) :]
392 if key: # Skip the base dir, which would add an empty string
393 keys.append(key)
394 return keys
395
396 def makedirs(self, dirname):
397 """Creates a directory and all parent/intermediate directories."""

Callers 15

test_audioMethod · 0.45
test_graph_defMethod · 0.45
_list_info_dirMethod · 0.45
get_allFunction · 0.45
testListdirMethod · 0.45
testListDirectoryMethod · 0.45
testListdirMethod · 0.45
testListdirMethod · 0.45
listdirMethod · 0.45
listdirMethod · 0.45
listdirFunction · 0.45

Calls 3

bucket_and_pathMethod · 0.95
getMethod · 0.65
appendMethod · 0.45

Tested by 11

test_audioMethod · 0.36
test_graph_defMethod · 0.36
_list_info_dirMethod · 0.36
testListdirMethod · 0.36
testListDirectoryMethod · 0.36
testListdirMethod · 0.36
testListdirMethod · 0.36
test_eagerMethod · 0.36
test_explicit_writerMethod · 0.36
_get_unique_summaryFunction · 0.36