<s> from pypy . interpreter . baseobjspace import ObjSpace , Wrappable , W_Root <EOL> from pypy . interpreter . typedef import TypeDef <EOL> from pypy . rlib . nonconst import NonConstant <EOL> from pypy . rlib . rarithmetic import r_uint <EOL> from pypy . rlib . rbigint import rbigint <EOL> class W_Object ( W_Root ) : <EOL> _attrs_ = ( ) <EOL> W_Object . typedef = TypeDef ( '<STR_LIT>' ) <EOL> def make_dummy ( a = W_Object ( ) , b = W_Object ( ) ) : <EOL> def fn ( * args ) : <EOL> if NonConstant ( True ) : <EOL> return a <EOL> else : <EOL> return b <EOL> return fn <EOL> int_dummy = make_dummy ( <NUM_LIT> , <NUM_LIT> ) <EOL> float_dummy = make_dummy ( <NUM_LIT> , <NUM_LIT> ) <EOL> uint_dummy = make_dummy ( r_uint ( <NUM_LIT> ) , r_uint ( <NUM_LIT> ) ) <EOL> str_dummy = make_dummy ( '<STR_LIT:foo>' , '<STR_LIT:bar>' ) <EOL> bool_dummy = make_dummy ( True , False ) <EOL> unicode_dummy = make_dummy ( u'<STR_LIT:abc>' , u'<STR_LIT>' ) <EOL> bigint_dummy = make_dummy ( rbigint ( [ <NUM_LIT:0> ] ) , rbigint ( [ <NUM_LIT:1> ] ) ) <EOL> class FakeObjSpace ( ObjSpace ) : <EOL> w_None = W_Object ( ) <EOL> w_False = W_Object ( ) <EOL> w_True = W_Object ( ) <EOL> w_Ellipsis = W_Object ( ) <EOL> w_NotImplemented = W_Object ( ) <EOL> w_int = W_Object ( ) <EOL> w_dict = W_Object ( ) <EOL> w_float = W_Object ( ) <EOL> w_long = W_Object ( ) <EOL> w_tuple = W_Object ( ) <EOL> w_str = W_Object ( ) <EOL> w_basestring = W_Object ( ) <EOL> w_unicode = W_Object ( ) <EOL> w_type = W_Object ( ) <EOL> w_instance = W_Object ( ) <EOL> w_slice = W_Object ( ) <EOL> w_hex = W_Object ( ) <EOL> w_oct = W_Object ( ) <EOL> def initialize ( self ) : <EOL> self . config . objspace . geninterp = False <EOL> self . config . objspace . disable_call_speedhacks = True <EOL> self . wrap_cache = { } <EOL> self . make_builtins ( ) <EOL> def _freeze_ ( self ) : <EOL> return True <EOL> def wrap ( self , x ) : <EOL> if isinstance ( x , Wrappable ) : <EOL> w_result = x . __spacebind__ ( self ) <EOL> return w_result <EOL> return W_Object ( ) <EOL> wrap . _annspecialcase_ = "<STR_LIT>" <EOL> def unwrap ( self , w_obj ) : <EOL> assert isinstance ( w_obj , W_Object ) <EOL> return None <EOL> lookup = make_dummy ( ) <EOL> allocate_instance = make_dummy ( ) <EOL> getattr = make_dummy ( ) <EOL> setattr = make_dummy ( ) <EOL> getitem = make_dummy ( ) <EOL> setitem = make_dummy ( ) <EOL> delitem = make_dummy ( ) <EOL> int_w = int_dummy <EOL> uint_w = uint_dummy <EOL> float_w = float_dummy <EOL> unicode_w = unicode_dummy <EOL> bigint_w = bigint_dummy <EOL> iter = make_dummy ( ) <EOL> type = make_dummy ( ) <EOL> str = make_dummy ( ) <EOL> int = make_dummy ( ) <EOL> float = make_dummy ( ) <EOL> repr = make_dummy ( ) <EOL> id = make_dummy ( ) <EOL> len = make_dummy ( ) <EOL> str_w = str_dummy <EOL> call_args = make_dummy ( ) <EOL> new_interned_str = make_dummy ( ) <EOL> newint = make_dummy ( ) <EOL> newlong = make_dummy ( ) <EOL> newfloat = make_dummy ( ) <EOL> def newdict ( self , module = False ) : <EOL> return self . newfloat ( ) <EOL> newlist = make_dummy ( ) <EOL> emptylist = make_dummy ( ) <EOL> newtuple = make_dummy ( ) <EOL> newslice = make_dummy ( ) <EOL> lt = make_dummy ( ) <EOL> le = make_dummy ( ) <EOL> eq = make_dummy ( ) <EOL> ne = make_dummy ( ) <EOL> gt = make_dummy ( ) <EOL> ge = make_dummy ( ) <EOL> lt_w = bool_dummy <EOL> le_w = bool_dummy <EOL> eq_w = bool_dummy <EOL> ne_w = bool_dummy <EOL> gt_w = bool_dummy <EOL> ge_w = bool_dummy <EOL> is_w = bool_dummy <EOL> is_ = make_dummy ( ) <EOL> next = make_dummy ( ) <EOL> is_true = bool_dummy <EOL> nonzero = make_dummy ( ) <EOL> issubtype = make_dummy ( ) <EOL> ord = make_dummy ( ) <EOL> hash = make_dummy ( ) <EOL> delattr = make_dummy ( ) <EOL> contains = make_dummy ( ) <EOL> hex = make_dummy ( ) <EOL> oct = make_dummy ( ) <EOL> pow = make_dummy ( ) <EOL> inplace_pow = make_dummy ( ) <EOL> cmp = make_dummy ( ) <EOL> def coerce ( self , * args ) : raise NotImplementedError ( "<STR_LIT>" ) <EOL> def get ( self , * args ) : raise NotImplementedError ( "<STR_LIT>" ) <EOL> def set ( self , * args ) : raise NotImplementedError ( "<STR_LIT>" ) <EOL> def delete ( self , * args ) : raise NotImplementedError ( "<STR_LIT>" ) <EOL> def userdel ( self , * args ) : raise NotImplementedError ( "<STR_LIT>" ) <EOL> def marshal_w ( self , * args ) : raise NotImplementedError ( "<STR_LIT>" ) <EOL> gettypefor = make_dummy ( ) <EOL> gettypeobject = make_dummy ( ) <EOL> unpackiterable = make_dummy ( [ W_Object ( ) ] , [ W_Object ( ) ] ) <EOL> import exceptions <EOL> for name in ObjSpace . ExceptionTable : <EOL> exc = getattr ( exceptions , name ) <EOL> setattr ( FakeObjSpace , '<STR_LIT>' + name , W_Object ( ) ) </s>
