<s> import re <EOL> from . . clients . github_client import GitHubClient <EOL> from . . downloaders . downloader_exception import DownloaderException <EOL> from . . clients . client_exception import ClientException <EOL> from . provider_exception import ProviderException <EOL> class GitHubUserProvider ( ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , repo , settings ) : <EOL> self . cache = { } <EOL> self . repo = repo <EOL> self . settings = settings <EOL> self . failed_sources = { } <EOL> @ classmethod <EOL> def match_url ( cls , repo ) : <EOL> """<STR_LIT>""" <EOL> return re . search ( '<STR_LIT>' , repo ) != None <EOL> def prefetch ( self ) : <EOL> """<STR_LIT>""" <EOL> [ name for name , info in self . get_packages ( ) ] <EOL> def get_failed_sources ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . failed_sources . items ( ) <EOL> def get_broken_packages ( self ) : <EOL> """<STR_LIT>""" <EOL> return { } . items ( ) <EOL> def get_broken_dependencies ( self ) : <EOL> """<STR_LIT>""" <EOL> return { } . items ( ) <EOL> def get_dependencies ( self , ) : <EOL> "<STR_LIT>" <EOL> return { } . items ( ) <EOL> def get_packages ( self , invalid_sources = None ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in self . cache : <EOL> for key , value in self . cache [ '<STR_LIT>' ] . items ( ) : <EOL> yield ( key , value ) <EOL> return <EOL> client = GitHubClient ( self . settings ) <EOL> if invalid_sources != None and self . repo in invalid_sources : <EOL> raise StopIteration ( ) <EOL> try : <EOL> user_repos = client . user_info ( self . repo ) <EOL> except ( DownloaderException , ClientException , ProviderException ) as e : <EOL> self . failed_sources = [ self . repo ] <EOL> self . cache [ '<STR_LIT>' ] = e <EOL> raise e <EOL> output = { } <EOL> for repo_info in user_repos : <EOL> try : <EOL> name = repo_info [ '<STR_LIT:name>' ] <EOL> repo_url = '<STR_LIT>' % ( repo_info [ '<STR_LIT>' ] , name ) <EOL> releases = [ ] <EOL> for download in client . download_info ( repo_url ) : <EOL> download [ '<STR_LIT>' ] = '<STR_LIT:*>' <EOL> download [ '<STR_LIT>' ] = [ '<STR_LIT:*>' ] <EOL> releases . append ( download ) <EOL> details = { <EOL> '<STR_LIT:name>' : name , <EOL> '<STR_LIT:description>' : repo_info [ '<STR_LIT:description>' ] , <EOL> '<STR_LIT>' : repo_info [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : repo_info [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : releases [ <NUM_LIT:0> ] . get ( '<STR_LIT:date>' ) , <EOL> '<STR_LIT>' : releases , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ self . repo ] , <EOL> '<STR_LIT>' : repo_info [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : repo_info [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : repo_info [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : None <EOL> } <EOL> output [ name ] = details <EOL> yield ( name , details ) <EOL> except ( DownloaderException , ClientException , ProviderException ) as e : <EOL> self . failed_sources [ repo_url ] = e <EOL> self . cache [ '<STR_LIT>' ] = output <EOL> def get_sources ( self ) : <EOL> """<STR_LIT>""" <EOL> return [ self . repo ] <EOL> def get_renamed_packages ( self ) : <EOL> """<STR_LIT>""" <EOL> return { } </s>
