<s> from __future__ import print_function <EOL> def someFunctionWritingLocals ( ) : <EOL> x = <NUM_LIT:1> <EOL> r = locals ( ) <EOL> y = <NUM_LIT:2> <EOL> r [ '<STR_LIT:z>' ] = <NUM_LIT:3> <EOL> del x <EOL> try : <EOL> z <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , e ) <EOL> return r , y <EOL> def someFunctionWritingLocalsContainingExec ( ) : <EOL> x = <NUM_LIT:1> <EOL> r = locals ( ) <EOL> y = <NUM_LIT:2> <EOL> r [ '<STR_LIT:z>' ] = <NUM_LIT:3> <EOL> try : <EOL> z <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , e ) <EOL> return r , y <EOL> exec ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( someFunctionWritingLocals ( ) ) <EOL> print ( someFunctionWritingLocalsContainingExec ( ) ) <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> import pprint <EOL> return pprint . pformat ( d ) <EOL> print ( "<STR_LIT>" , displayDict ( vars ( ) ) ) <EOL> module_locals = locals ( ) <EOL> import os <EOL> module_locals [ "<STR_LIT>" ] = os . path . basename ( module_locals [ "<STR_LIT>" ] ) <EOL> del module_locals <EOL> print ( "<STR_LIT>" , displayDict ( locals ( ) ) ) <EOL> def someFunctionUsingGlobals ( ) : <EOL> g = globals ( ) <EOL> g [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> global hallo <EOL> print ( "<STR_LIT>" , hallo ) <EOL> print ( "<STR_LIT>" ) <EOL> someFunctionUsingGlobals ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" , end = '<STR_LIT:U+0020>' ) <EOL> def someFunctionUsingDir ( ) : <EOL> x = someFunctionUsingGlobals ( ) <EOL> print ( "<STR_LIT>" , dir ( ) ) <EOL> return x <EOL> someFunctionUsingDir ( ) <EOL> print ( "<STR_LIT>" , end = '<STR_LIT:U+0020>' ) <EOL> new_class = type ( "<STR_LIT:Name>" , ( object , ) , { } ) <EOL> print ( new_class , new_class ( ) ) <EOL> print ( "<STR_LIT>" , type ( None ) ) <EOL> print ( "<STR_LIT>" , range ( <NUM_LIT:2> ) , range ( <NUM_LIT:1> , <NUM_LIT:6> ) , range ( <NUM_LIT:3> , <NUM_LIT:0> , - <NUM_LIT:1> ) , range ( <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:2> ) , range ( <NUM_LIT:5> , - <NUM_LIT:5> , - <NUM_LIT:3> ) ) <EOL> print ( "<STR_LIT>" , range ( <NUM_LIT:0> ) , range ( - <NUM_LIT:1> ) , range ( - <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> print ( "<STR_LIT>" , range ( - <NUM_LIT:2> ** <NUM_LIT:100> ) ) <EOL> print ( "<STR_LIT>" , range ( <NUM_LIT:2> ** <NUM_LIT:100> , <NUM_LIT:2> ** <NUM_LIT:100> + <NUM_LIT:2> ) ) <EOL> try : <EOL> print ( "<STR_LIT>" , end = '<STR_LIT:U+0020>' ) <EOL> print ( range ( <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:0> ) ) <EOL> except ValueError as e : <EOL> print ( repr ( e ) ) <EOL> try : <EOL> print ( "<STR_LIT>" , end = '<STR_LIT:U+0020>' ) <EOL> print ( range ( <NUM_LIT:1.0> ) ) <EOL> except TypeError as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> print ( "<STR_LIT>" , end = '<STR_LIT:U+0020>' ) <EOL> print ( range ( ) ) <EOL> except TypeError as e : <EOL> print ( "<STR_LIT>" , e ) <EOL> print ( "<STR_LIT>" , list ( "<STR_LIT:abc>" ) , list ( ) ) <EOL> print ( "<STR_LIT>" , list ( sequence = ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> ) ) ) <EOL> print ( "<STR_LIT>" , tuple ( "<STR_LIT>" ) , tuple ( ) ) <EOL> print ( "<STR_LIT>" , tuple ( sequence = ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> ) ) ) <EOL> print ( "<STR_LIT>" , dict ( ( "<STR_LIT>" , ( <NUM_LIT:1> , <NUM_LIT:2> ) ) , f = <NUM_LIT:1> , g = <NUM_LIT:1> ) ) <EOL> print ( "<STR_LIT>" , { "<STR_LIT>" : <NUM_LIT:2> , "<STR_LIT>" : <NUM_LIT:1> } , { } , dict ( ) ) <EOL> g = { "<STR_LIT>" : <NUM_LIT:2> , "<STR_LIT>" : <NUM_LIT:1> } <EOL> print ( "<STR_LIT>" , dict ( g ) ) <EOL> print ( "<STR_LIT>" , dict ( dict ( { "<STR_LIT>" : <NUM_LIT:2> , "<STR_LIT>" : <NUM_LIT:1> } ) , fu = <NUM_LIT:3> ) , dict ( named = dict ( { "<STR_LIT>" : <NUM_LIT:2> , "<STR_LIT>" : <NUM_LIT:1> } ) ) ) <EOL> print ( "<STR_LIT>" , float ( "<STR_LIT>" ) , float ( x = <NUM_LIT> ) , float ( ) ) <EOL> print ( "<STR_LIT>" , float ( float ( "<STR_LIT>" ) ) , float ( x = float ( <NUM_LIT> ) ) ) <EOL> print ( "<STR_LIT>" , complex ( "<STR_LIT>" ) , complex ( real = <NUM_LIT> ) , complex ( imag = <NUM_LIT> ) , complex ( <NUM_LIT:1> , <NUM_LIT:2> ) , complex ( ) ) <EOL> print ( "<STR_LIT>" , complex ( float ( "<STR_LIT>" ) ) , complex ( real = float ( <NUM_LIT> ) ) , complex ( imag = float ( <NUM_LIT> ) ) ) <EOL> print ( "<STR_LIT>" , str ( "<STR_LIT>" ) , str ( object = <NUM_LIT> ) , str ( ) ) <EOL> print ( "<STR_LIT>" , str ( float ( "<STR_LIT>" ) ) , str ( object = float ( <NUM_LIT> ) ) ) <EOL> print ( "<STR_LIT>" , bool ( "<STR_LIT>" ) , bool ( x = <NUM_LIT> ) , bool ( <NUM_LIT:0> ) , bool ( ) ) <EOL> print ( "<STR_LIT>" , bool ( float ( "<STR_LIT>" ) ) , bool ( x = float ( <NUM_LIT:0.0> ) ) ) <EOL> print ( "<STR_LIT>" , int ( '<STR_LIT:3>' ) , int ( x = '<STR_LIT>' ) , int ( '<STR_LIT:f>' , <NUM_LIT:16> ) , int ( x = '<STR_LIT:e>' , base = <NUM_LIT:16> ) , int ( "<STR_LIT>" , base = <NUM_LIT:2> ) , int ( <NUM_LIT:0> ) , int ( ) ) <EOL> print ( "<STR_LIT>" , int ( int ( '<STR_LIT:3>' ) ) , int ( x = int ( <NUM_LIT:0.0> ) ) ) <EOL> try : <EOL> print ( "<STR_LIT>" , long ( '<STR_LIT:3>' ) , long ( x = '<STR_LIT>' ) , long ( '<STR_LIT:f>' , <NUM_LIT:16> ) , long ( x = '<STR_LIT:e>' , base = <NUM_LIT:16> ) , long ( "<STR_LIT>" , base = <NUM_LIT:2> ) , long ( <NUM_LIT:0> ) , long ( ) ) <EOL> print ( "<STR_LIT>" , long ( long ( '<STR_LIT:3>' ) ) , long ( x = long ( <NUM_LIT:0.0> ) ) ) <EOL> except NameError : <EOL> print ( "<STR_LIT>" ) <EOL> pass <EOL> try : <EOL> print ( "<STR_LIT>" , int ( base = <NUM_LIT:2> ) , end = '<STR_LIT:U+0020>' ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> try : <EOL> print ( "<STR_LIT>" , int ( <NUM_LIT:2> , <NUM_LIT> ) , end = '<STR_LIT:U+0020>' ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> try : <EOL> print ( "<STR_LIT>" , int ( base = <NUM_LIT:2> ) , end = '<STR_LIT:U+0020>' ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" , oct ( <NUM_LIT> ) , oct ( <NUM_LIT:0> ) ) <EOL> print ( "<STR_LIT>" , oct ( int ( '<STR_LIT:3>' ) ) ) <EOL> print ( "<STR_LIT>" , hex ( <NUM_LIT> ) , hex ( <NUM_LIT:0> ) ) <EOL> print ( "<STR_LIT>" , hex ( int ( '<STR_LIT:3>' ) ) ) <EOL> print ( "<STR_LIT>" , bin ( <NUM_LIT> ) , bin ( <NUM_LIT:0> ) ) <EOL> print ( "<STR_LIT>" , bin ( int ( '<STR_LIT:3>' ) ) ) <EOL> try : <EOL> int ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> int ( y = <NUM_LIT:1> ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> f = <NUM_LIT:3> <EOL> print ( "<STR_LIT>" , int ( '<STR_LIT:0>' * f , base = <NUM_LIT:16> ) ) <EOL> d = { '<STR_LIT:x>' : "<STR_LIT>" , "<STR_LIT>" : <NUM_LIT:8> } <EOL> print ( "<STR_LIT>" , int ( ** d ) ) <EOL> base = <NUM_LIT:16> <EOL> try : <EOL> value = unicode ( "<STR_LIT>" ) <EOL> except NameError : <EOL> print ( "<STR_LIT>" ) <EOL> value = "<STR_LIT>" <EOL> print ( "<STR_LIT>" , int ( value , base ) , int ( value ) ) <EOL> base = <NUM_LIT> <EOL> try : <EOL> print ( "<STR_LIT>" , int ( <NUM_LIT:2> , base ) , end = '<STR_LIT:U+0020>' ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> try : <EOL> print ( chr ( ) ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> print ( ord ( ) ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> print ( ord ( s = <NUM_LIT:1> ) ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> print ( ord ( <NUM_LIT:1> , <NUM_LIT:2> ) ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> print ( ord ( <NUM_LIT:1> , s = <NUM_LIT:2> ) ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> print ( str ( '<STR_LIT:1>' , offer = <NUM_LIT:2> ) ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> a = <NUM_LIT:2> <EOL> print ( "<STR_LIT>" , int ( * ( a , ) ) , end = '<STR_LIT:U+0020>' ) <EOL> print ( "<STR_LIT>" , int ( * tuple ( ) ) , end = '<STR_LIT:U+0020>' ) <EOL> print ( "<STR_LIT>" , int ( ** dict ( ) ) ) <EOL> print ( "<STR_LIT>" , dict ( ) , dict ( a = f ) ) <EOL> print ( <EOL> "<STR_LIT>" , <EOL> displayDict ( <EOL> dict ( q = "<STR_LIT>" , w = "<STR_LIT>" , e = "<STR_LIT>" , r = "<STR_LIT>" , t = "<STR_LIT>" , y = "<STR_LIT>" ) <EOL> ) <EOL> ) <EOL> a = <NUM_LIT:5> <EOL> print ( "<STR_LIT>" , isinstance ( a , int ) ) <EOL> try : <EOL> print ( "<STR_LIT>" , isinstance ( a , long , int ) ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> print ( "<STR_LIT>" , isinstance ( a ) ) <EOL> except Exception as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> def usingIterToCheckIterable ( a ) : <EOL> try : <EOL> iter ( a ) <EOL> except TypeError : <EOL> print ( "<STR_LIT>" ) <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> usingIterToCheckIterable ( <NUM_LIT:1> ) <EOL> print ( "<STR_LIT>" , end = '<STR_LIT:U+0020>' ) <EOL> print ( [ dict ( type = int ) ] ) <EOL> print ( "<STR_LIT>" ) <EOL> from math import copysign <EOL> print ( copysign ( <NUM_LIT:1.0> , float ( "<STR_LIT>" ) ) ) <EOL> print ( copysign ( <NUM_LIT:1.0> , float ( "<STR_LIT>" ) ) ) <EOL> print ( "<STR_LIT>" ) <EOL> a = float ( "<STR_LIT>" ) <EOL> if a != a : <EOL> print ( "<STR_LIT>" ) <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> class CustomStr ( str ) : pass <EOL> class CustomBytes ( bytes ) : pass <EOL> class CustomByteArray ( bytearray ) : pass <EOL> values = [ <EOL> b'<STR_LIT:100>' , <EOL> b'<STR_LIT>' , <EOL> bytearray ( b'<STR_LIT:100>' ) , <EOL> CustomStr ( "<STR_LIT:100>" ) , <EOL> CustomBytes ( b'<STR_LIT:100>' ) , <EOL> CustomByteArray ( b'<STR_LIT:100>' ) <EOL> ] <EOL> for x in values : <EOL> try : <EOL> print ( "<STR_LIT:int>" , repr ( x ) , int ( x ) , int ( x , <NUM_LIT:2> ) ) <EOL> except ( TypeError , ValueError ) as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> print ( "<STR_LIT>" , repr ( x ) , long ( x ) , long ( x , <NUM_LIT:2> ) ) <EOL> except ( TypeError , ValueError ) as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> except NameError : <EOL> print ( "<STR_LIT>" ) <EOL> z = range ( <NUM_LIT:5> ) <EOL> try : <EOL> next ( z ) <EOL> except TypeError as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> try : <EOL> open ( ) <EOL> except TypeError as e : <EOL> print ( "<STR_LIT>" , repr ( e ) ) <EOL> print ( "<STR_LIT>" , type ( id ( id ) ) ) </s>
