<s> from __future__ import absolute_import <EOL> import sys <EOL> from rpython . rlib . rarithmetic import intmask <EOL> from topaz . module import ModuleDef <EOL> from topaz . objects . classobject import W_ClassObject <EOL> class Topaz ( object ) : <EOL> moduledef = ModuleDef ( "<STR_LIT>" ) <EOL> @ moduledef . setup_module <EOL> def setup_module ( space , w_mod ) : <EOL> space . set_const ( w_mod , "<STR_LIT>" , space . newint ( sys . maxint ) ) <EOL> @ moduledef . function ( "<STR_LIT>" ) <EOL> def method_intmask ( self , space , w_int ) : <EOL> if space . is_kind_of ( w_int , space . w_fixnum ) : <EOL> return w_int <EOL> elif space . is_kind_of ( w_int , space . w_bignum ) : <EOL> bigint = space . bigint_w ( w_int ) <EOL> return space . newint ( intmask ( bigint . uintmask ( ) ) ) <EOL> @ moduledef . function ( "<STR_LIT>" , method = "<STR_LIT>" ) <EOL> def method_convert_type ( self , space , w_obj , w_type , method ) : <EOL> if not isinstance ( w_type , W_ClassObject ) : <EOL> raise space . error ( space . w_TypeError , "<STR_LIT>" ) <EOL> return space . convert_type ( w_obj , w_type , method ) <EOL> @ moduledef . function ( "<STR_LIT>" , method = "<STR_LIT>" ) <EOL> def method_try_convert_type ( self , space , w_obj , w_type , method ) : <EOL> if not isinstance ( w_type , W_ClassObject ) : <EOL> raise space . error ( space . w_TypeError , "<STR_LIT>" ) <EOL> return space . convert_type ( w_obj , w_type , method , raise_error = False ) <EOL> @ moduledef . function ( "<STR_LIT>" ) <EOL> def method_compare ( self , space , w_a , w_b , block = None ) : <EOL> return space . compare ( w_a , w_b , block ) <EOL> @ moduledef . function ( "<STR_LIT>" , taint = "<STR_LIT:bool>" , untrust = "<STR_LIT:bool>" , freeze = "<STR_LIT:bool>" ) <EOL> def method_infect ( self , space , w_dest , w_src , taint = True , untrust = True , freeze = False ) : <EOL> space . infect ( w_dest , w_src , taint = taint , untrust = untrust , freeze = freeze ) <EOL> return self </s>
