<s> from __future__ import unicode_literals <EOL> import platform <EOL> import mopidy <EOL> "<STR_LIT>" <EOL> def format_proxy ( proxy_config , auth = True ) : <EOL> """<STR_LIT>""" <EOL> if not proxy_config . get ( '<STR_LIT>' ) : <EOL> return None <EOL> port = proxy_config . get ( '<STR_LIT:port>' ) <EOL> if not port or port < <NUM_LIT:0> : <EOL> port = <NUM_LIT> <EOL> if proxy_config . get ( '<STR_LIT:username>' ) and proxy_config . get ( '<STR_LIT:password>' ) and auth : <EOL> template = '<STR_LIT>' <EOL> else : <EOL> template = '<STR_LIT>' <EOL> return template . format ( scheme = proxy_config . get ( '<STR_LIT>' ) or '<STR_LIT:http>' , <EOL> username = proxy_config . get ( '<STR_LIT:username>' ) , <EOL> password = proxy_config . get ( '<STR_LIT:password>' ) , <EOL> hostname = proxy_config [ '<STR_LIT>' ] , port = port ) <EOL> def format_user_agent ( name = None ) : <EOL> """<STR_LIT>""" <EOL> parts = [ '<STR_LIT>' % ( mopidy . __version__ ) , <EOL> '<STR_LIT>' % ( platform . python_implementation ( ) , <EOL> platform . python_version ( ) ) ] <EOL> if name : <EOL> parts . insert ( <NUM_LIT:0> , name ) <EOL> return '<STR_LIT:U+0020>' . join ( parts ) </s>
