(episodes)
return [
        x[0] for x in filter(lambda x: max_episodes / float(x[1]) >= TYPE_THRESHOLD, l)
    ]
Returns the types of a podcast

    A podcast is considered to be of a given types if the ratio of episodes that are of that type equals TYPE_THRESHOLD
Returns the types of a podcast
Returns the types of a podcast
def get_podcast_types(episodes):
    """Returns the types of a podcast

    A podcast is considered to be of a given types if the ratio of episodes that are of that type equals TYPE_THRESHOLD
    """
    has_mimetype = lambda e: e.mimetypes
    episodes = filter(has_mimetype, episodes)
    types = defaultdict()
    for e in episodes:
        for mimetype in e.mimetypes:
            t = get_type(mimetype)
            if not t:
                continue
            types[t] = types.get(t, 0) + 1

    max_episodes = sum(types.values())
    l = list(types.items())
    l.sort(key=lambda x: x[1], reverse=True)

    return [
        x[0] for x in filter(lambda x: max_episodes / float(x[1]) >= TYPE_THRESHOLD, l)
    ]
def get_podcast_types ( episodes ) : has_mimetype = lambda e : e . mimetypes episodes = filter ( has_mimetype , episodes ) types = defaultdict ( ) for e in episodes : for mimetype in e . mimetypes : t = get_type ( mimetype ) if not t : continue types [ t ] = types . get ( t , 0 ) + 1 max_episodes = sum ( types . values ( ) ) l = list ( types . items ( ) ) l . sort ( key = lambda x : x [ 1 ] , reverse = True ) return [ x [ 0 ] for x in filter ( lambda x : max_episodes / float ( x [ 1 ] ) >= TYPE_THRESHOLD , l ) ]