MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / glob

Method glob

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

Returns a list of files that match the given pattern(s).

(self, filename)

Source from the content-addressed store, hash-verified

337 client.put_object(Body=file_content, Bucket=bucket, Key=path)
338
339 def glob(self, filename):
340 """Returns a list of files that match the given pattern(s)."""
341 # Only support prefix with * at the end and no ? in the string
342 star_i = filename.find("*")
343 quest_i = filename.find("?")
344 if quest_i >= 0:
345 raise NotImplementedError(
346 "{} not supported by compat glob".format(filename)
347 )
348 if star_i != len(filename) - 1:
349 # Just return empty so we can use glob from directory watcher
350 #
351 # TODO: Remove and instead handle in GetLogdirSubdirectories.
352 # However, we would need to handle it for all non-local registered
353 # filesystems in some way.
354 return []
355 filename = filename[:-1]
356 client = boto3.client("s3", endpoint_url=self._s3_endpoint)
357 bucket, path = self.bucket_and_path(filename)
358 p = client.get_paginator("list_objects")
359 keys = []
360 for r in p.paginate(Bucket=bucket, Prefix=path):
361 for o in r.get("Contents", []):
362 key = o["Key"][len(path) :]
363 if key: # Skip the base dir, which would add an empty string
364 keys.append(filename + key)
365 return keys
366
367 def isdir(self, dirname):
368 """Returns whether the path is a directory or not."""

Callers 15

testGlobMethod · 0.45
testGlobMethod · 0.45
testGlobChainingMethod · 0.45
testGlobAbsoluteMethod · 0.45
testGlobMethod · 0.45
globMethod · 0.45
globMethod · 0.45
globFunction · 0.45

Calls 3

bucket_and_pathMethod · 0.95
getMethod · 0.65
appendMethod · 0.45

Tested by 14

testGlobMethod · 0.36
testGlobMethod · 0.36
testGlobChainingMethod · 0.36
testGlobAbsoluteMethod · 0.36
testGlobMethod · 0.36
mesh_eventsMethod · 0.36
image_eventMethod · 0.36
audio_eventMethod · 0.36
histogram_eventMethod · 0.36