def walk(self, tag, ignore_missing=True, tagpath=(), token=None): """ Walks the tag graph starting at `tag`. Yields a 3-tuple `(tagpath, tags, blobs)`. :type ignore_missing: bool :param ignore_missing: Whether or not missing tags will raise a :class:`disco.error.CommError`. """ tagpath += (canonizetag(tag),) try: urls = self.get(tag, token=token).get("urls", []) tags, blobs = partition(urls, istag) tags = canonizetags(tags) yield tagpath, tags, blobs except CommError as e: if ignore_missing and e.code == 404: tags = blobs = () yield tagpath, tags, blobs else: yield tagpath, None, None raise e for next_tag in relativizetags(tags, tag): for child in self.walk(next_tag, ignore_missing=ignore_missing, tagpath=tagpath, token=token): yield child
def walk(self, tag, ignore_missing=True, tagpath=(), token=None): """ Walks the tag graph starting at `tag`. Yields a 3-tuple `(tagpath, tags, blobs)`. :type ignore_missing: bool :param ignore_missing: Whether or not missing tags will raise a :class:`disco.error.CommError`. """ tagpath += (canonizetag(tag), ) try: urls = self.get(tag, token=token).get('urls', []) tags, blobs = partition(urls, istag) tags = canonizetags(tags) yield tagpath, tags, blobs except CommError as e: if ignore_missing and e.code == 404: tags = blobs = () yield tagpath, tags, blobs else: yield tagpath, None, None raise e for next_tag in relativizetags(tags, tag): for child in self.walk(next_tag, ignore_missing=ignore_missing, tagpath=tagpath, token=token): yield child
def findtags(self, tags=(), ignore_missing=True, token=None): import sys """ Finds the nodes of the tag graph starting at `tags`. Yields a 3-tuple `(tag, tags, blobs)`. """ seen = set() tag_queue = canonizetags(tags) for tag in tag_queue: if tag not in seen: try: urls = self.get(tag, token=token).get("urls", []) tags, blobs = partition(urls, istag) tags = canonizetags(tags) yield tag, tags, blobs tag_queue += relativizetags(tags, tag) seen.add(tag) except CommError as e: if ignore_missing and e.code == 404: tags = blobs = () else: raise
def findtags(self, tags=(), ignore_missing=True, token=None): import sys """ Finds the nodes of the tag graph starting at `tags`. Yields a 3-tuple `(tag, tags, blobs)`. """ seen = set() tag_queue = canonizetags(tags) for tag in tag_queue: if tag not in seen: try: urls = self.get(tag, token=token).get('urls', []) tags, blobs = partition(urls, istag) tags = canonizetags(tags) yield tag, tags, blobs tag_queue += relativizetags(tags, tag) seen.add(tag) except CommError as e: if ignore_missing and e.code == 404: tags = blobs = () else: raise
def walk(self, tag, ignore_missing=True, tagpath=()): """ Walks the tag graph starting at `tag`. Yields a 3-tuple `(tagpath, tags, blobs)`. :type ignore_missing: bool :param ignore_missing: Whether or not missing tags will raise a :class:`disco.error.CommError`. """ tagpath += (tagname(tag),) try: urls = self.get(tag).get('urls', []) tags, blobs = partition(urls, tagname) tags = canonizetags(tags) yield tagpath, tags, blobs except CommError, e: if ignore_missing and e.code == 404: tags = blobs = () yield tagpath, tags, blobs else: yield tagpath, None, None raise e
def separate_tags(self, *urls): from disco.util import partition from disco.ddfs import istag return partition(urls, istag)
def separate_tags(self, *urls): from disco.util import partition def istag(url): return url.startswith('tag://') or '/' not in url return partition(urls, istag)