PageRenderTime 25ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/rpython/rlib/types.py

https://bitbucket.org/cbjadwani/pypy
Python | 65 lines | 41 code | 24 blank | 0 comment | 0 complexity | 1ea14c22b5e8f41e29de7c29a354865a MD5 | raw file
Possible License(s): Apache-2.0
  1. from rpython.annotator import model
  2. from rpython.annotator.listdef import ListDef
  3. from rpython.annotator.dictdef import DictDef
  4. def none():
  5. return model.s_None
  6. def float():
  7. return model.SomeFloat()
  8. def singlefloat():
  9. return model.SomeSingleFloat()
  10. def longfloat():
  11. return model.SomeLongFloat()
  12. def int():
  13. return model.SomeInteger()
  14. def unicode():
  15. return model.SomeUnicodeString()
  16. def unicode0():
  17. return model.SomeUnicodeString(no_nul=True)
  18. def str():
  19. return model.SomeString()
  20. def str0():
  21. return model.SomeString(no_nul=True)
  22. def char():
  23. return model.SomeChar()
  24. def ptr(ll_type):
  25. from rpython.rtyper.lltypesystem.lltype import Ptr
  26. return model.SomePtr(Ptr(ll_type))
  27. def list(element):
  28. listdef = ListDef(None, element, mutated=True, resized=True)
  29. return model.SomeList(listdef)
  30. def array(element):
  31. listdef = ListDef(None, element, mutated=True, resized=False)
  32. return model.SomeList(listdef)
  33. def dict(keytype, valuetype):
  34. dictdef = DictDef(None, keytype, valuetype)
  35. return model.SomeDict(dictdef)
  36. def instance(class_):
  37. return lambda bookkeeper: model.SomeInstance(bookkeeper.getuniqueclassdef(class_))
  38. class SelfTypeMarker(object):
  39. pass
  40. def self():
  41. return SelfTypeMarker()