code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env python
import autopath
from py import path
import py
import os
import sys
from subprocess import *
pwd = path.local(__file__)
shell = pwd.dirpath('test', 'ecma', 'shell.js')
exclusionlist = ['shell.js', 'browser.js']
def filter(filename):
if filename.basename in exclusionlist or not filename.basena... | Python |
from pypy.rlib.parsing.ebnfparse import parse_ebnf, make_parse_function
from pypy.rlib.parsing.parsing import ParseError, Rule
import py
GFILE = py.magic.autopath().dirpath().join("jsgrammar.txt")
try:
t = GFILE.read(mode='U')
regexs, rules, ToAST = parse_ebnf(t)
except ParseError,e:
print e.nice_error_me... | Python |
#
| Python |
from pypy.rlib.parsing.ebnfparse import parse_ebnf, make_parse_function
from pypy.rlib.parsing.parsing import ParseError, Rule
from pypy.rlib.parsing.tree import RPythonVisitor, Symbol
from pypy.lang.js.jsobj import W_Number
from pypy.lang.js import operations
import sys
##try:
## t = open("jsgrammar.txt").read()
#... | Python |
# encoding: utf-8
from pypy.rlib.rarithmetic import r_uint, intmask
class SeePage(NotImplementedError):
pass
class JsBaseExcept(Exception): pass
class ExecutionReturned(JsBaseExcept):
def __init__(self, type='normal', value=None, identifier=None):
self.type = type
self.value = value
... | Python |
#!/usr/bin/env python
# encoding: utf-8
"""
js_interactive.py
"""
import autopath
import sys
import getopt
from pypy.lang.js.interpreter import load_source, Interpreter, load_file
from pypy.lang.js.jsparser import parse, ParseError
from pypy.lang.js.jsobj import W_Builtin, W_String, ThrowException, w_Undefined
from py... | Python |
import py
from pypy.lang.js.interpreter import *
from pypy.lang.js.jsobj import W_Array, JsBaseExcept
from pypy.rlib.parsing.parsing import ParseError
from py.__.test.outcome import Failed, ExceptionFailure
import pypy.lang.js as js
from pypy.lang.js import interpreter
interpreter.TEST = True
rootdir = py.magic.autop... | Python |
" a very stripped down version of cfbolz's algorithm/automaton module "
from pypy.rlib.jit import hint
from pypy.rpython.lltypesystem.lltype import GcArray, Signed, malloc
class DFA(object):
def __init__(self, num_states=0, transitions=None, final_states=None):
self.num_states = 0
self.transitions... | Python |
import py
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ___________________________________________________________________
# type verifications
def impl_nonvar(engine, var):
if isinstance(var, term.Var):
raise error.Uni... | Python |
import py
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ___________________________________________________________________
# operators
def impl_current_op(engine, precedence, typ, name, continuation):
for prec, allops in engine... | Python |
import py
from pypy.lang.prolog.interpreter.parsing import parse_file, TermBuilder
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ___________________________________________________________________
# control predicates
def impl_fail(... | Python |
import py
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ___________________________________________________________________
# meta-call predicates
def impl_call(engine, call, continuation):
try:
return engine.call(call, ... | Python |
import py
from pypy.lang.prolog.interpreter import arithmetic
from pypy.lang.prolog.interpreter.parsing import parse_file, TermBuilder
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ____________________________________________________... | Python |
import os
import string
from pypy.lang.prolog.interpreter.term import Term, Float, Number, Var, Atom
from pypy.lang.prolog.interpreter import error, helper, parsing
from pypy.lang.prolog.builtin.register import expose_builtin
class TermFormatter(object):
def __init__(self, engine, quoted=False, max_depth=0,
... | Python |
import py
from pypy.lang.prolog.interpreter.parsing import parse_file, TermBuilder
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin import builtins, builtins_list
from pypy.rlib.objectmodel import we_are_translated
class Builtin(object):
_immutable_ = True
def... | Python |
import py
from pypy.lang.prolog.interpreter import engine as enginemod, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
from pypy.lang.prolog.builtin.type import impl_ground
# ___________________________________________________________________
# exception handling
def impl_catch(engin... | Python |
import py
from pypy.lang.prolog.interpreter import arithmetic
from pypy.lang.prolog.interpreter.parsing import parse_file, TermBuilder
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.interpreter.error import UnificationFailed, FunctionNotFound
from pypy.lang.prolog.builtin.reg... | Python |
import py
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ___________________________________________________________________
# finding all solutions to a goal
class FindallContinuation(engine.Continuation):
def __init__(self, tem... | Python |
import py
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ___________________________________________________________________
# arithmetic
def impl_between(engine, lower, upper, varorint, continuation):
if isinstance(varorint, te... | Python |
import py
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ___________________________________________________________________
# analysing and construction atoms
def impl_atom_concat(engine, a1, a2, result, continuation):
if isinst... | Python |
# all builtins
builtins = {}
builtins_list = []
# imports to register builtins
import pypy.lang.prolog.builtin.allsolution
import pypy.lang.prolog.builtin.arithmeticbuiltin
import pypy.lang.prolog.builtin.atomconstruction
import pypy.lang.prolog.builtin.control
import pypy.lang.prolog.builtin.database
import pypy.lang... | Python |
import py
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ___________________________________________________________________
# database
def impl_abolish(engine, predicate):
from pypy.lang.prolog.builtin import builtins
name, ... | Python |
import py
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.builtin.register import expose_builtin
# ___________________________________________________________________
# analysing and construction terms
def impl_functor(engine, t, functor, arity):
if helper.is_atomic(t):
... | Python |
import os, sys
from pypy.rlib.parsing.parsing import ParseError
from pypy.rlib.parsing.deterministic import LexerError
from pypy.lang.prolog.interpreter.interactive import helptext
from pypy.lang.prolog.interpreter.parsing import parse_file, get_query_and_vars
from pypy.lang.prolog.interpreter.parsing import get_engine... | Python |
from pypy.jit.hintannotator.policy import ManualGraphPolicy
from pypy.lang.prolog.interpreter import term, engine, helper
from pypy.translator.translator import graphof
from pypy.annotation.specialize import getuniquenondirectgraph
forbidden_modules = {'pypy.lang.prolog.interpreter.parser': True,
... | Python |
class PrologError(Exception):
pass
class CatchableError(PrologError):
def __init__(self, errorterm):
from pypy.lang.prolog.interpreter import term
self.term = term.Term("error", [errorterm])
class UserError(CatchableError):
def __init__(self, errorterm):
self.term = errorterm
clas... | Python |
import py
from pypy.rlib.parsing.ebnfparse import parse_ebnf
from pypy.rlib.parsing.regexparse import parse_regex
from pypy.rlib.parsing.lexer import Lexer, DummyLexer
from pypy.rlib.parsing.deterministic import DFA
from pypy.rlib.parsing.tree import Nonterminal, Symbol, RPythonVisitor
from pypy.rlib.parsing.parsing im... | Python |
import py, sys
rootdir = py.magic.autopath().dirpath()
Option = py.test.config.Option
option = py.test.config.addoptions("prolog options",
Option('--slow', action="store_true", dest="slow", default=False,
help="view translation tests' flow graphs with Pygame"),
)
| Python |
#!/usr/bin/env python
try:
import autopath
except ImportError:
pass
import py
import sys
#sys.path.append(str(py.magic.autopath().dirpath().dirpath()))
from pypy.rlib.parsing.parsing import ParseError
from pypy.rlib.parsing.deterministic import LexerError
from pypy.lang.prolog.interpreter.parsing import pars... | Python |
import py
import math
from pypy.lang.prolog.interpreter.parsing import parse_file, TermBuilder
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.interpreter.error import UnificationFailed, FunctionNotFound
from pypy.rlib.rarithmetic import intmask
from pypy.rlib.jit import we_ar... | Python |
import os
import py
from py.magic import greenlet
from pypy.rlib.objectmodel import we_are_translated
from pypy.rpython.rstack import yield_current_heap_to_caller
from pypy.translator.c.test.test_stackless import StacklessTest
from pypy.lang.prolog.interpreter.error import UnificationFailed, CutException
def make_ll... | Python |
"""
self cloning, automatic path configuration
copy this into any subdirectory of pypy from which scripts need
to be run, typically all of the test subdirs.
The idea is that any such script simply issues
import autopath
and this will make sure that the parent directory containing "pypy"
is in sys.path.
If y... | Python |
import math
from pypy.rlib.objectmodel import we_are_translated, UnboxedValue
from pypy.rlib.rarithmetic import intmask
from pypy.lang.prolog.interpreter.error import UnificationFailed, UncatchableError
from pypy.lang.prolog.interpreter import error
from pypy.rlib.jit import hint
from pypy.rlib.objectmodel import speci... | Python |
""" Helper functions for dealing with prolog terms"""
from pypy.lang.prolog.interpreter import term
from pypy.lang.prolog.interpreter import error
emptylist = term.Atom.newatom("[]")
def wrap_list(python_list):
curr = emptylist
for i in range(len(python_list) - 1, -1, -1):
curr = term.Term(".", [pyth... | Python |
from pypy.lang.prolog.interpreter.term import Var, Term, Rule, Atom, debug_print, \
Callable
from pypy.lang.prolog.interpreter.error import UnificationFailed, FunctionNotFound, \
CutException
from pypy.lang.prolog.interpreter import error
from pypy.rlib.jit import hint, we_are_jitted, _is_early_constant, purefu... | Python |
#!/usr/bin/env python
try:
import autopath
except ImportError:
pass
import py
import sys
#sys.path.append(str(py.magic.autopath().dirpath().dirpath()))
from pypy.rlib.parsing.parsing import ParseError
from pypy.rlib.parsing.deterministic import LexerError
from pypy.lang.prolog.interpreter.parsing import pars... | Python |
from pypy.translator.interactive import Translation
from pypy.rpython.test.test_llinterp import interpret
from pypy.lang.prolog.interpreter import parsing
from pypy.lang.prolog.interpreter.term import Atom
from pypy.lang.prolog.interpreter.test.tool import *
from pypy.lang.prolog.interpreter.conftest import option
if ... | Python |
import py
from pypy.lang.prolog.interpreter.error import UnificationFailed, FunctionNotFound
from pypy.lang.prolog.interpreter.parsing import parse_query_term, get_engine
from pypy.lang.prolog.interpreter.engine import Continuation, Heap, Engine
def assert_true(query, e=None):
if e is None:
e = Engine()
... | Python |
from pypy.objspace.proxy import patch_space_in_place
from pypy.interpreter import gateway, baseobjspace
#-- THE BUILTINS ----------------------------------------------------------------------
# this collects all multimethods to be made part of the Space
all_mms = {}
W_Root = baseobjspace.W_Root
#-- MISC -----------... | Python |
import operator
from pypy.interpreter.error import OperationError
from pypy.interpreter.baseobjspace import ObjSpace
from pypy.interpreter.function import Function, Method
from pypy.interpreter.argument import Arguments
from pypy.interpreter.typedef import default_identity_hash
from pypy.tool.sourcetools import compile... | Python |
"""
Trace object space traces operations and bytecode execution
in frames.
"""
from pypy.tool import pydis
from pypy.rlib.rarithmetic import intmask
# __________________________________________________________________________
#
# Tracing Events
# _________________________________________________________________... | Python |
import os
from pypy.objspace.proxy import patch_space_in_place
from pypy.objspace.std.objspace import StdObjSpace, W_Object
from pypy.interpreter.error import OperationError
from pypy.interpreter import baseobjspace
DUMP_FILE_NAME = 'pypy-space-dump'
DUMP_FILE_MODE = 0600
class Dumper(object):
dump_fd = -1
d... | Python |
from pypy.interpreter.baseobjspace import ObjSpace
# __________________________________________________________________________
def get_operations():
return [r[0] for r in ObjSpace.MethodTable] + ObjSpace.IrregularOpTable
def patch_space_in_place(space, proxyname, proxymaker, operations=None):
"""Patches the... | Python |
from pypy.interpreter.baseobjspace import ObjSpace, Wrappable, W_Root
from pypy.rlib.nonconst import NonConstant
from pypy.rlib.rarithmetic import r_uint
from pypy.rlib.rbigint import rbigint
class W_Type(W_Root):
pass
class W_Object(W_Root):
pass
W_Object.typedef = W_Type()
def make_dummy(a=W_Object(), b=W_... | Python |
from copy import copy
from pypy.tool.error import debug
from pypy.interpreter.argument import AbstractArguments
from pypy.interpreter.gateway import interp2app
from pypy.rlib.nonconst import NonConstant
def my_import(name):
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
... | Python |
from objspace import FakeObjSpace
Space = FakeObjSpace
| Python |
"""
Just an experiment.
"""
import os
from pypy.objspace.std.objspace import StdObjSpace
from pypy.objspace.proxy import patch_space_in_place
from pypy.objspace.thunk import nb_forcing_args
from pypy.interpreter.error import OperationError
from pypy.interpreter import baseobjspace, gateway, executioncontext
from pypy.i... | Python |
from pypy.interpreter.executioncontext import ExecutionContext
from pypy.interpreter.error import OperationError
from pypy.interpreter import pyframe
from pypy.objspace.flow.model import *
from pypy.objspace.flow.framestate import FrameState
class OperationThatShouldNotBePropagatedError(OperationError):
pass
cla... | Python |
# The model produced by the flowobjspace
# this is to be used by the translator mainly.
#
# the below object/attribute model evolved from
# a discussion in Berlin, 4th of october 2003
from __future__ import generators
import py
from pypy.tool.uid import uid, Hashable
from pypy.tool.sourcetools import PY_IDENTIFIER, ni... | Python |
from pypy.objspace.flow.objspace import UnwrapException
from pypy.objspace.flow.model import Constant
from pypy.objspace.flow.operation import OperationName, Arity
from pypy.interpreter.gateway import ApplevelClass
from pypy.interpreter.error import OperationError
from pypy.tool.cache import Cache
def sc_import(space,... | Python |
from pypy.interpreter.pyframe import PyFrame
from pypy.interpreter.pyopcode import SuspendedUnroller
from pypy.interpreter.error import OperationError
from pypy.rlib.unroll import SpecTag
from pypy.objspace.flow.model import *
class FrameState:
# XXX this class depends on the internal state of PyFrame objects
... | Python |
# ______________________________________________________________________
import sys, operator, types
from pypy.interpreter.baseobjspace import ObjSpace, Wrappable
from pypy.interpreter.pycode import PyCode, cpython_code_signature
from pypy.interpreter.module import Module
from pypy.interpreter.error import OperationErr... | Python |
"""
This module defines mappings between operation names and Python's
built-in functions (or type constructors) implementing them.
"""
from pypy.interpreter.baseobjspace import ObjSpace
import operator, types, __future__
from pypy.tool.sourcetools import compile2
from pypy.rlib.rarithmetic import ovfcheck, ovfcheck_lsh... | Python |
from pypy.objspace.flow.objspace import FlowObjSpace
Space = FlowObjSpace
| Python |
# Empty
| Python |
from pypy.rpython.extregistry import ExtRegistryEntry, lookup_type
from pypy.interpreter.baseobjspace import W_Root, SpaceCache
from pypy.objspace.cpy.ctypes_base import W_Object
# ____________________________________________________________
# Hacks to support the app-level parts of MixedModules
class W_AppLevel(W_Ro... | Python |
from pypy.annotation import model as annmodel
from pypy.rpython.extregistry import ExtRegistryEntry
from pypy.objspace.cpy.capi import *
###################################################################
# ____________________ Reference counter hacks ____________________
_XX_PyObject_GetItem = pythonapi.PyObject_Ge... | Python |
"""
Generic support to turn interpreter objects (subclasses of Wrappable)
into CPython objects (subclasses of W_Object) based on their typedef.
"""
from pypy.objspace.cpy.capi import *
from pypy.interpreter.error import OperationError
from pypy.interpreter.baseobjspace import Wrappable, SpaceCache
from pypy.interprete... | Python |
"""
Support to turn Function objects into W_Objects containing a built-in
function of CPython.
"""
import py
from pypy.objspace.cpy.capi import *
from pypy.objspace.cpy.refcount import Py_XIncref
from pypy.objspace.cpy.objspace import CPyObjSpace
from pypy.interpreter.error import OperationError
from pypy.interpreter.... | Python |
"""
CTypes base classes to support the particularities of the CPyObjSpace
when it uses the CPython API: the W_Object class and the cpyapi accessor.
"""
import sys
from ctypes import *
from pypy.rpython.rctypes import apyobject
from pypy.interpreter.error import OperationError
from pypy.tool.sourcetools import func_wit... | Python |
import types, sys
from pypy.objspace.cpy.capi import *
from pypy.objspace.cpy.capi import _PyType_Lookup
from pypy.objspace.cpy.capi import _PyLong_Sign, _PyLong_NumBits, _PyLong_AsByteArray
from pypy.objspace.cpy.refcount import Py_Incref
from pypy.objspace.cpy.appsupport import W_AppLevel
from pypy.interpreter import... | Python |
from pypy.translator.goal.ann_override import PyPyAnnotatorPolicy
from pypy.annotation import model as annmodel
from pypy.interpreter.error import OperationError
from pypy.objspace.cpy.ctypes_base import W_Object, rctypes_pyerrchecker
class CPyAnnotatorPolicy(PyPyAnnotatorPolicy):
"""Annotation policy to compile C... | Python |
"""
Support to turn GetSetProperty objects into W_Objects containing a
property object of CPython.
"""
from pypy.interpreter.baseobjspace import SpaceCache
from pypy.interpreter.gateway import ObjSpace, W_Root, interp2app
from pypy.interpreter.function import BuiltinFunction
from pypy.objspace.cpy.objspace import W_Ob... | Python |
try:
import ctypes as _
except ImportError:
CPyObjSpace = None
else:
from objspace import CPyObjSpace
Space = CPyObjSpace
| Python |
"""
CTypes declarations for the CPython API.
"""
import sys
import ctypes
import py
from ctypes import *
from pypy.rpython.rctypes.tool import ctypes_platform
##from pypy.rpython.rctypes.implementation import CALLBACK_FUNCTYPE
from pypy.objspace.cpy.ctypes_base import W_Object, cpyapi
################################... | Python |
import py
from pypy.tool.pytest.modcheck import skipimporterror
class Directory(py.test.collect.Directory):
def run(self):
skipimporterror("ctypes")
return super(Directory, self).run()
| Python |
"""Example usage:
$ py.py -o thunk
>>> from __pypy__ import thunk, lazy, become
>>> def f():
... print 'computing...'
... return 6*7
...
>>> x = thunk(f)
>>> x
computing...
42
>>> x
42
>>> y = thunk(f)
>>> type(y)
computing...
<pypy type 'int'>
... | Python |
# empty
| Python |
from pypy.interpreter.error import OperationError
from pypy.objspace.descroperation import Object
from pypy.interpreter import gateway
from pypy.interpreter.typedef import default_identity_hash
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.register_all import register_all
from pypy.objspace.std.objs... | Python |
""" transparent list implementation
"""
from pypy.objspace.std.objspace import *
from pypy.objspace.std.proxy_helpers import register_type
from pypy.interpreter.error import OperationError
from pypy.interpreter import baseobjspace
#class W_Transparent(W_Object):
# def __init__(self, w_controller):
# self.c... | Python |
"""
Implementation of small ints, stored as odd-valued pointers in the
translated PyPy. To enable them, see inttype.py.
"""
from pypy.objspace.std.objspace import *
from pypy.objspace.std.noneobject import W_NoneObject
from pypy.rlib.rarithmetic import ovfcheck, ovfcheck_lshift, LONG_BIT, r_uint
from pypy.objspace.std... | Python |
from pypy.interpreter.error import OperationError
from pypy.interpreter import gateway
from pypy.objspace.std.strutil import interp_string_to_float, ParseStringError
from pypy.objspace.std.objspace import register_all
from pypy.objspace.std.noneobject import W_NoneObject
from pypy.objspace.std.stdtypedef import GetSetP... | Python |
from pypy.objspace.std.objspace import W_Object, OperationError
from pypy.objspace.std.objspace import registerimplementation, register_all
from pypy.rlib.objectmodel import r_dict
from pypy.rlib.rarithmetic import intmask, r_uint
from pypy.interpreter import gateway
class W_BaseSetObject(W_Object):
def __init__(... | Python |
"""
Reviewed 03-06-21
slice object construction tested, OK
indices method tested, OK
"""
from pypy.objspace.std.objspace import *
from pypy.interpreter import gateway
from pypy.objspace.std.slicetype import _Eval_SliceIndex
class W_SliceObject(W_Object):
from pypy.objspace.std.slicetype import sl... | Python |
from pypy.interpreter.error import OperationError, debug_print
from pypy.interpreter import baseobjspace
from pypy.interpreter import eval
from pypy.interpreter.function import Function, BuiltinFunction
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.model import W_Object, UnwrapError
from pypy.interp... | Python |
from pypy.objspace.std.objspace import *
from pypy.interpreter.function import Function, StaticMethod
from pypy.interpreter.argument import Arguments
from pypy.interpreter import gateway
from pypy.interpreter.typedef import weakref_descr
from pypy.objspace.std.stdtypedef import std_dict_descr, issubtypedef, Member
from... | Python |
from pypy.objspace.std.objspace import *
from pypy.interpreter import gateway
from pypy.objspace.std.stringobject import W_StringObject
from pypy.objspace.std.ropeobject import W_RopeObject
from pypy.objspace.std.noneobject import W_NoneObject
from pypy.objspace.std.sliceobject import W_SliceObject
from pypy.objspace.s... | Python |
from pypy.objspace.std.stdtypedef import *
# ____________________________________________________________
def descr_seqiter__reduce__(w_self, space):
"""
XXX to do: remove this __reduce__ method and do
a registration with copy_reg, instead.
"""
from pypy.objspace.std.iterobject import W_SeqIterObj... | Python |
from pypy.objspace.std.objspace import *
from pypy.interpreter import gateway
from pypy.objspace.std.noneobject import W_NoneObject
from pypy.objspace.std.longobject import W_LongObject
from pypy.rlib.rarithmetic import ovfcheck_float_to_int, intmask, isinf
from pypy.rlib.rarithmetic import formatd
import math
from py... | Python |
""" Some transparent helpers, put here because
of cyclic imports
"""
from pypy.objspace.std.model import W_ANY, W_Object
from pypy.interpreter import baseobjspace
from pypy.interpreter.argument import Arguments
from pypy.tool.sourcetools import func_with_new_name
def create_mm_names(classname, mm, is_local):
s =... | Python |
from pypy.objspace.std.objspace import *
from pypy.objspace.std.inttype import wrapint
from pypy.objspace.std.listtype import get_list_index
from pypy.objspace.std.sliceobject import W_SliceObject
from pypy.objspace.std.tupleobject import W_TupleObject
from pypy.objspace.std import slicetype
from pypy.interpreter impo... | Python |
from pypy.objspace.std.dictmultiobject import DictImplementation
from pypy.objspace.std.dictmultiobject import IteratorImplementation
class BucketNode:
def __init__(self, hash, w_key, w_value, next):
self.hash = hash
self.w_key = w_key
self.w_value = w_value
self.next = next
DIST... | Python |
from __future__ import generators
from pypy.interpreter import gateway
from pypy.interpreter.error import OperationError
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.register_all import register_all
from sys import maxint
list_append = SMM('append', 2,
doc='L.append(object) -... | Python |
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.inttype import int_typedef
# XXX should forbit subclassing of 'bool'
def descr__new__(space, w_booltype, w_obj=None):
space.w_bool.check_user_subclass(w_booltype)
if space.is_true(w_obj):
return space.w_True
else:
return sp... | Python |
# implementation of marshalling by multimethods
"""
The idea is to have an effective but flexible
way to implement marshalling for the native types.
The marshal_w operation is called with an object,
a callback and a state variable.
"""
from pypy.interpreter.error import OperationError
from pypy.objspace.std.register... | Python |
from pypy.interpreter import gateway
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.register_all import register_all
from pypy.interpreter.error import OperationError
dict_copy = SMM('copy', 1,
doc='D.copy() -> a shallow copy of D')
dict_items = SMM('items',... | Python |
import sys
from pypy.interpreter import baseobjspace
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.register_all import register_all
from pypy.interpreter.error import OperationError
# indices multimehtod
slice_indices = SMM('indices', 2,
doc='S.indices(len) -> (start, stop, stri... | Python |
_name_mappings = {
'and': 'and_',
'or': 'or_',
}
def register_all(module_dict, *alt_ns):
"""register implementations for multimethods.
By default a (name, object) pair of the given module dictionary
is registered on the multimethod 'name' of StdObjSpace.
If the name doesn't exist the... | Python |
# implement resizable arrays
# see "Resizable Arrays in Optimal time and Space"
# Brodnik, Carlsson, Demaine, Munro, Sedgewick, 1999
from pypy.objspace.std.listmultiobject import ListImplementation
import sys
import math
LOG2 = math.log(2)
NBITS = int(math.log(sys.maxint) / LOG2) + 2
LSBSTEPS = int(math.log(NBITS) / L... | Python |
"""
The full list of which Python types and which implementation we want
to provide in this version of PyPy, along with conversion rules.
"""
from pypy.objspace.std.multimethod import MultiMethodTable, FailedToImplement
from pypy.interpreter.baseobjspace import W_Root, ObjSpace
import pypy.interpreter.pycode
import py... | Python |
from pypy.objspace.std.objspace import *
class W_ObjectObject(W_Object):
"""Instances of this class are what the user can directly see with an
'object()' call."""
from pypy.objspace.std.objecttype import object_typedef as typedef
# ____________________________________________________________
register_a... | Python |
"""
Reviewed 03-06-22
All common dictionary methods are correctly implemented,
tested, and complete. The only missing feature is support
for order comparisons.
"""
from pypy.objspace.std.objspace import *
from pypy.interpreter import gateway
from pypy.rlib.objectmodel import r_dict
class W_DictObject(W_Object):
... | Python |
""" transparent.py - Several transparent proxy helpers
"""
from pypy.interpreter import gateway
from pypy.interpreter.function import Function
from pypy.interpreter.error import OperationError
from pypy.objspace.std.proxyobject import *
from pypy.objspace.std.typeobject import W_TypeObject
def proxy(space, w_type, w... | Python |
from pypy.objspace.std.stdtypedef import *
# ____________________________________________________________
none_typedef = StdTypeDef("NoneType",
)
| Python |
"""
Pure Python implementation of string utilities.
"""
from pypy.rlib.rarithmetic import ovfcheck, break_up_float, parts_to_float
from pypy.interpreter.error import OperationError
import math
# XXX factor more functions out of stringobject.py.
# This module is independent from PyPy.
def strip_spaces(s):
# XXX t... | Python |
from pypy.objspace.std.objspace import *
from pypy.objspace.std.inttype import wrapint
from pypy.objspace.std.listtype import get_list_index
from pypy.objspace.std.sliceobject import W_SliceObject
from pypy.objspace.std import slicetype
from pypy.interpreter import gateway, baseobjspace
from pypy.rlib.listsort import ... | Python |
"""
String formatting routines.
"""
from pypy.rlib.unroll import unrolling_iterable
from pypy.rlib.rarithmetic import ovfcheck, formatd_overflow
from pypy.interpreter.error import OperationError
class BaseStringFormatter(object):
def __init__(self, space, values_w, w_valuedict):
self.space = space
... | Python |
from pypy.tool.sourcetools import compile2
class FailedToImplement(Exception):
def __init__(self, w_type=None, w_value=None):
self.w_type = w_type
self.w_value = w_value
def raiseFailedToImplement():
raise FailedToImplement
class MultiMethodTable:
def __init__(self, arity, root_class... | Python |
from pypy.objspace.std.stdtypedef import *
# ____________________________________________________________
basestring_typedef = StdTypeDef("basestring",
__doc__ = '''Type basestring cannot be instantiated; it is the base for str and unicode.'''
)
| Python |
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.basestringtype import basestring_typedef
from sys import maxint
def wrapstr(space, s):
from pypy.objspace.std.stringobject import W_StringObject
from pypy.objspace.std.ropeobject import rope, W_RopeObject
if space.config.objspace.std.shares... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.