<s> from __future__ import print_function <EOL> import inspect , types , sys , pprint <EOL> def compiledFunction ( a , b ) : <EOL> pass <EOL> assert inspect . isfunction ( compiledFunction ) is True <EOL> assert isinstance ( compiledFunction , types . FunctionType ) <EOL> assert isinstance ( compiledFunction , ( int , types . FunctionType ) ) <EOL> print ( "<STR_LIT>" , inspect . getargspec ( compiledFunction ) ) <EOL> print ( "<STR_LIT>" , inspect . formatargspec ( * inspect . getargspec ( compiledFunction ) ) ) <EOL> assert type ( compiledFunction ) == types . FunctionType <EOL> class CompiledClass : <EOL> def __init__ ( self ) : <EOL> pass <EOL> def compiledMethod ( self ) : <EOL> pass <EOL> assert inspect . isfunction ( CompiledClass ) is False <EOL> assert isinstance ( CompiledClass , types . FunctionType ) is False <EOL> assert inspect . ismethod ( compiledFunction ) is False <EOL> assert inspect . ismethod ( CompiledClass ) is False <EOL> assert inspect . ismethod ( CompiledClass . compiledMethod ) == ( sys . version_info < ( <NUM_LIT:3> , ) ) <EOL> assert inspect . ismethod ( CompiledClass ( ) . compiledMethod ) is True <EOL> assert bool ( type ( CompiledClass . compiledMethod ) == types . MethodType ) == ( sys . version_info < ( <NUM_LIT:3> , ) ) <EOL> print ( "<STR_LIT>" , inspect . getargspec ( CompiledClass ( ) . compiledMethod ) ) <EOL> print ( "<STR_LIT>" , inspect . formatargspec ( * inspect . getargspec ( CompiledClass ( ) . compiledMethod ) ) ) <EOL> def compiledGenerator ( ) : <EOL> yield <NUM_LIT:1> <EOL> assert inspect . isfunction ( compiledGenerator ) is True <EOL> assert inspect . isgeneratorfunction ( compiledGenerator ) is True <EOL> assert isinstance ( compiledGenerator ( ) , types . GeneratorType ) is True <EOL> assert type ( compiledGenerator ( ) ) == types . GeneratorType <EOL> assert isinstance ( compiledGenerator , types . GeneratorType ) is False <EOL> assert inspect . ismethod ( compiledGenerator ( ) ) is False <EOL> assert inspect . isfunction ( compiledGenerator ( ) ) is False <EOL> assert inspect . isgenerator ( compiledFunction ) is False <EOL> assert inspect . isgenerator ( compiledGenerator ) is False <EOL> assert inspect . isgenerator ( compiledGenerator ( ) ) is True <EOL> def someFunction ( a ) : <EOL> assert inspect . isframe ( sys . _getframe ( ) ) <EOL> someFunction ( <NUM_LIT:2> ) <EOL> class C : <EOL> print ( "<STR_LIT>" , str ( sys . _getframe ( ) . f_locals ) . replace ( "<STR_LIT>" , "<STR_LIT>" ) . replace ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> print ( "<STR_LIT>" , sys . _getframe ( ) . f_code . co_flags ) <EOL> def f ( ) : <EOL> print ( "<STR_LIT>" , sys . _getframe ( ) . f_locals ) <EOL> print ( "<STR_LIT>" , sys . _getframe ( ) . f_code . co_flags ) <EOL> f ( ) <EOL> def g ( ) : <EOL> yield ( "<STR_LIT>" , sys . _getframe ( ) . f_locals ) <EOL> yield ( "<STR_LIT>" , sys . _getframe ( ) . f_code . co_flags ) <EOL> for line in g ( ) : <EOL> print ( * line ) <EOL> print ( "<STR_LIT>" , g . __code__ . co_flags ) <EOL> def displayDict ( d ) : <EOL> if "<STR_LIT>" in d : <EOL> d = dict ( d ) <EOL> d [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> if "<STR_LIT>" in d : <EOL> d = dict ( d ) <EOL> d [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> return pprint . pformat ( d ) <EOL> print ( "<STR_LIT>" , displayDict ( sys . _getframe ( ) . f_locals ) ) <EOL> print ( "<STR_LIT>" , sys . _getframe ( ) . f_code . co_flags ) <EOL> print ( "<STR_LIT>" , sys . _getframe ( ) . f_code . co_name ) <EOL> print ( "<STR_LIT>" , dir ( sys . _getframe ( ) ) ) </s>
