<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> class Plugin ( object ) : <EOL> def __init__ ( self ) : <EOL> self . env = { } <EOL> for var , default in self . __get_dynamic_attr ( "<STR_LIT>" , None , { } ) . items ( ) : <EOL> self . env [ var ] = os . environ . get ( var , default ) <EOL> def __get_dynamic_attr ( self , attname , arg , default = None ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> attr = getattr ( self , attname ) <EOL> except AttributeError : <EOL> return default <EOL> if callable ( attr ) : <EOL> if hasattr ( attr , '<STR_LIT>' ) : <EOL> argcount = attr . func_code . co_argcount <EOL> else : <EOL> argcount = attr . __call__ . func_code . co_argcount <EOL> if argcount == <NUM_LIT:2> : <EOL> return attr ( arg ) <EOL> else : <EOL> return attr ( ) <EOL> return attr <EOL> def main ( self , argv ) : <EOL> if "<STR_LIT:_>" in argv [ <NUM_LIT:0> ] : <EOL> _ , arg = argv [ <NUM_LIT:0> ] . rsplit ( "<STR_LIT:_>" , <NUM_LIT:1> ) <EOL> else : <EOL> arg = None <EOL> args = argv [ <NUM_LIT:1> : ] <EOL> if "<STR_LIT>" in args and hasattr ( self , "<STR_LIT>" ) : <EOL> for suggested in self . __get_dynamic_attr ( "<STR_LIT>" , arg ) : <EOL> print suggested <EOL> return <NUM_LIT:0> <EOL> if "<STR_LIT>" in args : <EOL> if self . __get_dynamic_attr ( "<STR_LIT>" , arg , True ) : <EOL> print "<STR_LIT:yes>" <EOL> return <NUM_LIT:0> <EOL> else : <EOL> print "<STR_LIT>" <EOL> return <NUM_LIT:1> <EOL> if "<STR_LIT>" in args : <EOL> for field , value in self . __get_dynamic_attr ( "<STR_LIT>" , arg , [ ] ) : <EOL> print "<STR_LIT>" % ( field , value ) <EOL> return <NUM_LIT:0> <EOL> for field , value in self . __get_dynamic_attr ( "<STR_LIT>" , arg , [ ] ) : <EOL> print "<STR_LIT>" % ( field , value ) <EOL> return <NUM_LIT:0> <EOL> def run ( plugin ) : <EOL> if callable ( plugin ) : <EOL> plugin = plugin ( ) <EOL> sys . exit ( plugin . main ( sys . argv ) ) </s>
