proj/__init__.py
def list(pattern=()):
    "List the contents of the archive directory."
    # strategy: pick the intersection of all the patterns the user provides
    globs = ['*{0}*'.format(p) for p in pattern] + ['*']

    matches = []
    offset = len(PROJ_ARCHIVE) + 1
    for suffix in globs:
        glob_pattern = os.path.join(PROJ_ARCHIVE, '*', '*', suffix)
        matches.append(set(
            f[offset:] for f in glob.glob(glob_pattern)
        ))

    matches = reduce(lambda x, y: x.intersection(y),
                     matches)

    for m in sorted(matches):
        print(m)
def list(pattern=()):
    "List the contents of the archive directory."
    # strategy: pick the intersection of all the patterns the user provides
    globs = ['*{0}*'.format(p) for p in pattern] + ['*']

    matches = []
    offset = len(PROJ_ARCHIVE) + 1
    for suffix in globs:
        glob_pattern = os.path.join(PROJ_ARCHIVE, '*', '*', suffix)
        matches.append(set(
            f[offset:] for f in glob.glob(glob_pattern)
        ))

    matches = reduce(lambda x, y: x.intersection(y),
                     matches)

    for m in sorted(matches):
        print(m)
List the contents of the archive directory.