sregistry/main/google_drive/query.py
def container_query(self, query, quiet=False):
    '''search for a specific container.
    This function is the same as the search all, but instead of showing all
    results, filters them down based on user criteria (the query)
    '''

    results = self._list_containers()

    matches = []
    for result in results:
 
        is_match = False
        if query in result['id']:
            is_match = True

        elif query in result['name']:
            is_match = True

        else:
            for key,val in result['properties'].items():
                if query in val and is_match is False:
                    is_match = True
                    break

        if is_match is True:
            matches.append(result)


    if not quiet:
        bot.info("[drive://%s] Found %s containers" %(self._base,len(matches)))
        for image in matches:

            # If the image has properties, show to the user
            if 'properties' in image:
                image.update(image['properties'])

            bot.info(image['uri'])

            for key in sorted(image, key=len):
                val = image[key]
                if isinstance(val,str):
                    bot.custom(prefix=key.ljust(10), message=val, color="CYAN")
            bot.newline()
    return matches
def container_query(self, query, quiet=False):
    '''search for a specific container.
    This function is the same as the search all, but instead of showing all
    results, filters them down based on user criteria (the query)
    '''

    results = self._list_containers()

    matches = []
    for result in results:
 
        is_match = False
        if query in result['id']:
            is_match = True

        elif query in result['name']:
            is_match = True

        else:
            for key,val in result['properties'].items():
                if query in val and is_match is False:
                    is_match = True
                    break

        if is_match is True:
            matches.append(result)


    if not quiet:
        bot.info("[drive://%s] Found %s containers" %(self._base,len(matches)))
        for image in matches:

            # If the image has properties, show to the user
            if 'properties' in image:
                image.update(image['properties'])

            bot.info(image['uri'])

            for key in sorted(image, key=len):
                val = image[key]
                if isinstance(val,str):
                    bot.custom(prefix=key.ljust(10), message=val, color="CYAN")
            bot.newline()
    return matches
search for a specific container.
    This function is the same as the search all, but instead of showing all
    results, filters them down based on user criteria (the query)