<s> from __future__ import ( absolute_import , division , generators , nested_scopes , print_function , <EOL> unicode_literals , with_statement ) <EOL> from pants . backend . codegen . targets . java_thrift_library import JavaThriftLibrary <EOL> from pants . subsystem . subsystem import Subsystem <EOL> class ThriftDefaults ( Subsystem ) : <EOL> """<STR_LIT>""" <EOL> options_scope = '<STR_LIT>' <EOL> @ classmethod <EOL> def register_options ( cls , register ) : <EOL> register ( '<STR_LIT>' , type = str , advanced = True , default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> register ( '<STR_LIT>' , type = str , advanced = True , default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> register ( '<STR_LIT>' , type = str , advanced = True , default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( ThriftDefaults , self ) . __init__ ( * args , ** kwargs ) <EOL> self . _default_compiler = self . get_options ( ) . compiler <EOL> self . _default_language = self . get_options ( ) . language <EOL> self . _default_rpc_style = self . get_options ( ) . rpc_style <EOL> def compiler ( self , target ) : <EOL> """<STR_LIT>""" <EOL> self . _check_target ( target ) <EOL> return target . compiler or self . _default_compiler <EOL> def language ( self , target ) : <EOL> """<STR_LIT>""" <EOL> self . _check_target ( target ) <EOL> return target . language or self . _default_language <EOL> def rpc_style ( self , target ) : <EOL> """<STR_LIT>""" <EOL> self . _check_target ( target ) <EOL> return target . rpc_style or self . _default_rpc_style <EOL> def _check_target ( self , target ) : <EOL> if not isinstance ( target , JavaThriftLibrary ) : <EOL> raise ValueError ( '<STR_LIT>' <EOL> '<STR_LIT>' . format ( target , type ( target ) ) ) <EOL> def _tuple ( self ) : <EOL> return self . _default_compiler , self . _default_language , self . _default_rpc_style <EOL> def __hash__ ( self ) : <EOL> return hash ( self . _tuple ( ) ) <EOL> def __eq__ ( self , other ) : <EOL> return type ( self ) == type ( other ) and self . _tuple ( ) == other . _tuple ( ) </s>
