<s> """<STR_LIT>""" <EOL> from collections import defaultdict <EOL> def group_repositories ( repos ) : <EOL> """<STR_LIT>""" <EOL> sections = defaultdict ( list ) <EOL> for repo in repos : <EOL> sections [ repo . owner . login ] . append ( repo ) <EOL> for key in sections . keys ( ) : <EOL> if len ( sections [ key ] ) <= <NUM_LIT:1> : <EOL> sections [ '<STR_LIT>' ] . extend ( sections . pop ( key ) ) <EOL> order = lambda t : '<STR_LIT:z>' * <NUM_LIT:100> if t [ <NUM_LIT:0> ] == '<STR_LIT>' else t [ <NUM_LIT:0> ] . lower ( ) <EOL> return sorted ( sections . items ( ) , key = order ) <EOL> def get_user_active_repositories ( user ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> return user . repositories . filter ( webhook__active = True ) <EOL> except AttributeError : <EOL> return [ ] </s>
