<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> from google . appengine . _internal . django . utils import termcolors <EOL> def supports_color ( ) : <EOL> """<STR_LIT>""" <EOL> unsupported_platform = ( sys . platform in ( '<STR_LIT:win32>' , '<STR_LIT>' ) ) <EOL> is_a_tty = hasattr ( sys . stdout , '<STR_LIT>' ) and sys . stdout . isatty ( ) <EOL> if unsupported_platform or not is_a_tty : <EOL> return False <EOL> return True <EOL> def color_style ( ) : <EOL> """<STR_LIT>""" <EOL> if not supports_color ( ) : <EOL> style = no_style ( ) <EOL> else : <EOL> DJANGO_COLORS = os . environ . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> color_settings = termcolors . parse_color_setting ( DJANGO_COLORS ) <EOL> if color_settings : <EOL> class dummy : pass <EOL> style = dummy ( ) <EOL> for role in termcolors . PALETTES [ termcolors . NOCOLOR_PALETTE ] : <EOL> format = color_settings . get ( role , { } ) <EOL> setattr ( style , role , termcolors . make_style ( ** format ) ) <EOL> style . ERROR_OUTPUT = style . ERROR <EOL> else : <EOL> style = no_style ( ) <EOL> return style <EOL> def no_style ( ) : <EOL> """<STR_LIT>""" <EOL> class dummy : <EOL> def __getattr__ ( self , attr ) : <EOL> return lambda x : x <EOL> return dummy ( ) </s>
