code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
'''
reference material:
http://webreference.com/javascript/reference/core_ref/
http://webreference.com/programming/javascript/
http://mochikit.com/
http://www.mozilla.org/js/spidermonkey/
svn co http://codespeak.net/svn/kupu/trunk/ecmaunit
'''
import py
import os
from pypy.rpython.rmodel import i... | Python |
"""Contains high level javascript compilation function
"""
import autopath
#from pypy.translator.js.test.runtest import compile_function
#from pypy.translator.translator import TranslationContext
from pypy.translator.driver import TranslationDriver
from pypy.translator.js.js import JS
from pypy.tool.error import Anno... | Python |
try:
set
except NameError:
from sets import Set as set
from pypy.objspace.flow import model as flowmodel
from pypy.rpython.lltypesystem.lltype import Signed, Unsigned, Void, Bool, Float
from pypy.rpython.lltypesystem.lltype import SignedLongLong, UnsignedLongLong
from pypy.rpython.ootypesystem import ootype
fr... | Python |
import py
Option = py.test.config.Option
option = py.test.config.addoptions("pypy-ojs options",
Option('--use-browser', action="store", dest="browser", type="string",
default="", help="run Javascript tests in your default browser"),
Option('--tg', action="store_true", dest="tg... | Python |
""" backend generator routines
"""
from pypy.translator.js.log import log
from pypy.objspace.flow.model import Variable
from StringIO import StringIO
class CodeGenerator(object):
def __init__(self, out, indentstep = 4, startblock = '{', endblock = '}'):
self._out = out
self._indent = 0
... | Python |
#!/usr/bin/env python
"""
In this example I'll show how to manipulate DOM tree
from inside RPython code
Note that this is low-level API to manipulate it, which
might be suitable if you don't like boilerplate on top.
There is ongoing effort to provide API of somewhat higher level,
which will be way easier to manipulat... | Python |
#!/usr/bin/env python
"""
In this example, we'll show how to add javascript to our simple
server from previous example
"""
from pypy.translator.js.lib import server
import sys
# here we have virtual script "source.js" which we generate
# on-the-fly when requested
HTML = """
<html>
<head>
<script src="source.js"/>
... | Python |
#!/usr/bin/env python
"""
In this example I'll show how to manipulate DOM tree
from inside RPython code
Note that this is low-level API to manipulate it, which
might be suitable if you don't like boilerplate on top.
There is ongoing effort to provide API of somewhat higher level,
which will be way easier to manipulat... | Python |
#!/usr/bin/env python
"""
In this example, we'll show how to add javascript to our simple
server from previous example
"""
from pypy.translator.js.lib import server
import sys
# here we have virtual script "source.js" which we generate
# on-the-fly when requested
HTML = """
<html>
<head>
<script src="source.js"/>
... | Python |
#!/usr/bin/env python
"""
This is simple all-in-one self-containing server,
which just shows almost-empty HTML page
"""
# here we import server, which is derivative of
# BaseHTTPServer from python standard library
from pypy.translator.js.lib import server
# We create handler, which will handle all our requests
clas... | Python |
#!/usr/bin/env python
"""
This is simple all-in-one self-containing server,
which just shows almost-empty HTML page
"""
# here we import server, which is derivative of
# BaseHTTPServer from python standard library
from pypy.translator.js.lib import server
# We create handler, which will handle all our requests
clas... | Python |
""" Communication proxy rendering
"""
from pypy.objspace.flow.model import Variable, Constant
from pypy.rpython.ootypesystem.bltregistry import ArgDesc
GET_METHOD_BODY = """
%(class)s.prototype.%(method)s = function ( %(args)s ) {
var data,str;
var x = new XMLHttpRequest();
data = %(data)s;
str = ""... | Python |
import py
from pypy.tool.ansi_print import ansi_log
log = py.log.Producer("js")
py.log.setconsumer("js", ansi_log)
| Python |
""" JavaScript type system
"""
from pypy.rpython.ootypesystem import ootype
from pypy.rpython.lltypesystem import lltype
from pypy.translator.cli import oopspec
from pypy.rpython.lltypesystem.lltype import Signed, Unsigned, Void, Bool, Float
from pypy.rpython.lltypesystem.lltype import SignedLongLong, UnsignedLongLon... | Python |
""" Opcode meaning objects, descendants of MicroInstruction
"""
#from pypy.translator.js.jsbuiltin import Builtins
from pypy.translator.oosupport.metavm import PushArg, PushAllArgs, StoreResult,\
InstructionList, New, GetField, MicroInstruction
from pypy.translator.js.log import log
from pypy.rpython.ootypesystem... | Python |
""" JavaScript builtin mappings
"""
from pypy.translator.oosupport.metavm import InstructionList, PushAllArgs,\
_PushAllArgs
from pypy.translator.js.metavm import SetBuiltinField, ListGetitem, ListSetitem, \
GetBuiltinField, CallBuiltin, Call, SetTimeout, ListContains,\
NewBuiltin, SetOnEvent, ListRemove,... | 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 |
#!/usr/bin/env python
""" A basic Python console from your browser.
This depends on MochiKit for proper quoting.
You need to provide the files as ..jsdemo/MochiKit/*.js.
(Symlinks are your friends.)
Try to type: import time; time.sleep(2); print 'hi'
"""
import autopath
import sys, os, cStringIO
from cgi import pa... | Python |
from struct import pack, unpack, calcsize
try:
from localmsg import PORTS
except ImportError:
PORTS = {}
try:
from localmsg import HOSTNAME
except ImportError:
from socket import gethostname
HOSTNAME = gethostname()
MSG_WELCOME = "Welcome to gamesrv.py(3) !\n"
MSG_BROADCAST_PORT= "*"
MSG_DEF_PLAY... | Python |
from msgstruct import *
from zlib import decompressobj, decompress
from urllib import quote
from os.path import exists
from struct import unpack
from time import time
import md5
debug = True
def log(msg):
if debug:
print msg
class BitmapCreationException(Exception):
pass
#proxy messages
#PMSG_PING... | Python |
#!/usr/bin/env python
""" bub-n-bros testing utility
"""
import autopath
import py
from pypy.translator.js.main import rpython2javascript
from pypy.translator.js.modules.dom import document, window
from pypy.translator.js.modules.mochikit import log, logWarning,\
createLoggingPane, logDebug, connect
from pypy.t... | 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 |
""" xmlhttp controllers, usefull for testing
"""
import py
from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc
from pypy.translator.js.examples.bnb.servermessage import log, ServerMessage,\
PMSG_INLINE_FRAME, PMSG_DEF_ICON
from pypy.translator.js.examples.bnb.msgstruct import *
from pypy.... | Python |
#!/usr/bin/env python
""" bub-n-bros testing utility
"""
import autopath
import py
from pypy.translator.js.main import rpython2javascript
from pypy.translator.js.modules.dom import document, window
from pypy.translator.js.modules.mochikit import log, logWarning,\
createLoggingPane, logDebug, connect
from pypy.t... | Python |
""" example of (very simple) serialiser
"""
def serialise(obj):
if isinstance(obj, str):
return "S" + obj
elif isinstance(obj, int):
return "I" + str(obj)
return "?"
serialise._annspecialcase_ = "specialize:argtype(0)"
def serialisetest():
return serialise("aaa") + serialise(3) + ser... | Python |
""" In this file we define all necessary stuff
build around subprocess to run python console in it
"""
KILL_TIMEOUT = 300
TIMEOUT = 10
""" The idea behind is that we create xmlhttprequest immediataly
and reply with new data (if available) or reply anyway
after TIMEOUT
"""
import py
import subprocess
from Queue impo... | Python |
from pypy.translator.js.modules import dom
from pypy.translator.js.modules.mochikit import log, createLoggingPane
from pypy.translator.js.examples.console.console import exported_methods
class Glob(object):
def __init__(self):
self.console_running = False
self.next_console = ""
self.text_t... | Python |
import py
from pypy.translator.js.lib import server
from pypy.translator.js.main import rpython2javascript
from pypy.translator.js.lib.support import callback
from pypy.translator.js import commproxy
from pypy.translator.js.examples.console.session import Interpreter, Killed
from pypy.translator.js.examples.console.do... | Python |
""" Simple module for loading documentation of various
pypy-cs from doc directory
"""
import py
class DocLoader(object):
def __init__(self, consoles, docdir, testfile):
self.consoles = consoles
self.docdir = py.path.local(docdir)
assert self.docdir.check(dir=1)
self.testfile = tes... | Python |
from pypy.conftest import gettestobjspace
class AppTest_pypy_c(object):
def setup_class(cls):
cls.space = gettestobjspace(**{"objspace.std.withtproxy": True,
"usemodules":("_stackless",)})
def test_snippet_1(self):
from tputil import make_proxy
history = []
... | Python |
"""rpython javascript code"""
from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc
from pypy.translator.js.lib.support import callback
from pypy.translator.js.modules import mochikit
from pypy.translator.js.modules import dom
class PingHandler(BasicExternal):
"""Server side code which hand... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | Python |
from django.conf.urls.defaults import *
urlpatterns = patterns('pypy.translator.js.examples.djangoping.views',
(r"^ping.js$", "ping_js"),
(r"^ping/$", "ping"),
(r"^$", "index"),
)
| Python |
# Django settings for djangoping project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = '' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DAT... | Python |
"""Django python views"""
from django.http import HttpResponse
from django.shortcuts import render_to_response
from pypy.translator.js.main import rpython2javascript
import simplejson
from pypy.translator.js.examples.djangoping import client
def render_json_response(data):
response = HttpResponse(mimetype="app... | Python |
#!/usr/bin/env python
""" A basic Python console from your browser.
This depends on MochiKit for proper quoting.
You need to provide the files as ..jsdemo/MochiKit/*.js.
(Symlinks are your friends.)
Try to type: import time; time.sleep(2); print 'hi'
"""
import autopath
import sys, os, cStringIO
from cgi import pa... | Python |
#!/usr/bin/env python
""" the mandatory guestbook example
accompanies the pypyp/doc/js/webapps_with_pypy.txt document, serves as
a simple example to show how to go about writing a pypy web application
"""
import autopath
from pypy.translator.js.lib import server
from pypy.translator.js.lib.support import ca... | Python |
#!/usr/bin/env python
""" This is script which collects all the demos and
run them when needed
"""
import autopath
from pypy.translator.js.lib import server
from pypy.translator.js.lib.support import callback
from pypy.rpython.ootypesystem.bltregistry import described
from pypy.translator.js.main import rpython2javas... | Python |
""" Client side of overmind.py
"""
from pypy.translator.js.modules import dom
def callback(port):
hname = dom.window.location.hostname
dom.window.location.assign("http://%s:%d" % (hname, port))
def bnb_redirect():
loc = dom.window.location
new_loc = loc.protocol + "//" + loc.hostname + ":7070"
l... | 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 |
""" rpython guestbook client-side code
this code can be tested in CPython, but will also be converted to
JavaScript to provide the client-side functionality for the guestbook
example
"""
from pypy.translator.js.modules import dom
from pypy.translator.js.examples.guestbook import exported_methods
def _get... | Python |
#!/usr/bin/env python
""" the mandatory guestbook example
accompanies the pypyp/doc/js/webapps_with_pypy.txt document, serves as
a simple example to show how to go about writing a pypy web application
"""
import autopath
from pypy.translator.js.lib import server
from pypy.translator.js.lib.support import ca... | Python |
# | Python |
#!/usr/bin/env python
""" This is script which collects all the demos and
run them when needed
"""
import autopath
from pypy.translator.js.lib import server
from pypy.translator.js.lib.support import callback
from pypy.rpython.ootypesystem.bltregistry import described
from pypy.translator.js.main import rpython2javas... | Python |
from setuptools import setup, find_packages
from turbogears.finddata import find_package_data
import os
svninfo = os.popen('svn info rpython2javascript').read().split()
version = int(svninfo[svninfo.index('Revision:') + 1])
setup(
name="rpython2javascript",
version="0.%d" % version,
description="RPyt... | Python |
import cherrypy
from rpython2javascript.pypy.translator.js.main import rpython2javascript
class TemplatePlugin:
def __init__(self, extra_vars_func=None, options=None):
"""The standard constructor takes an 'extra_vars_func',
which is a callable that is called for additional
variables with e... | Python |
#!/usr/bin/env python
"""Command-line user interface for rpython2javascript."""
import optparse
from rpython2javascript.pypy.translator.js.main import rpython2javascript_main
class JsCommand:
"Translate RPython code to Javascript via command-line interface."
desc = "Translate RPython to Javascript"
na... | Python |
#!/usr/bin/env python
"""Command-line user interface for rpython2javascript."""
import optparse
from rpython2javascript.pypy.translator.js.main import rpython2javascript_main
class JsCommand:
"Translate RPython code to Javascript via command-line interface."
desc = "Translate RPython to Javascript"
na... | Python |
from turbogears.widgets.base import JSSource, CoreWD, RenderOnlyWD
class RPyJSSource(JSSource):
def __init__(self, src, location=None):
#print 'RPyJSSource: python:', src
mod = 'RPyJSSourceTmp.py'
f = open(mod, 'w')
f.write(src)
f.close()
function_names = []
... | Python |
from pypy.translator.gensupp import NameManager
#from pypy.translator.js.optimize import is_optimized_function
class JavascriptNameManager(NameManager):
def __init__(self, db):
NameManager.__init__(self)
self.db = db
self.reserved = {}
#http://javascript.about.com/library/blreserve... | Python |
""" Some helpers
"""
from pypy.translator.js.modules.dom import document
def escape(s):
#return s.replace("&", "&").replace("<", "<").replace(">", ">"). \
# replace("'", "\\'").replace(" ", " ").replace("\n", "<br/>")
return s
def create_debug_div():
debug_div = document.createElem... | Python |
""" opcode definitions
"""
from pypy.translator.oosupport.metavm import PushArg, PushAllArgs, StoreResult,\
InstructionList, New, GetField, MicroInstruction, RuntimeNew, PushPrimitive
from pypy.translator.oosupport.metavm import _GetFieldDispatcher, _SetFieldDispatcher, \
_CallDispatcher, _MethodDispatch... | Python |
""" genjs class definition
"""
from pypy.translator.cli.node import Node
from pypy.translator.cli.cts import CTS
class Class(Node):
def __init__(self, db, classdef):
self.db = db
self.cts = db.genoo.TypeSystem(db)
self.classdef = classdef
self.name = classdef._name.replace('.', '_... | Python |
""" This is example of totally basic server for XMLHttp request
built on top of BaseHTTPServer.
Construction is like that:
you take your own implementation of Handler and subclass it
to provide whatever you like. Each request is checked first for
apropriate method in handler (with dots replaced as _) and this method... | Python |
""" Some support files for mapping urls, mostly bindings
for existing cgi stuff
"""
import cgi
import urllib
class URL(object):
def __init__(self, path, vars):
self.path = path
self.vars = vars
def __eq__(self, other):
if isinstance(other, URL):
return self.path == other.... | Python |
""" Various simple support functions
"""
from pypy.rpython.ootypesystem.bltregistry import described, load_dict_args,\
MethodDesc
from pypy.rpython.extfunc import genericcallable
def callback(retval=None, args={}):
""" Variant of described decorator, which flows
an additional argument with return value... | Python |
""" genjs constant database module
"""
from pypy.rpython.ootypesystem import ootype
from pypy.translator.js.opcodes import opcodes
from pypy.translator.js.function import Function
from pypy.translator.js.log import log
from pypy.translator.js._class import Class
from pypy.translator.js.support import JavascriptNameMa... | Python |
""" tester - support module for testing js code inside python
Needs to be imported in case one wants tests involving calling BasicExternal
methods
"""
from pypy.rpython.ootypesystem.bltregistry import BasicExternal
def __getattr__(self, attr):
val = super(BasicExternal, self).__getattribute__(attr)
if not c... | Python |
import py, os, re, subprocess
from pypy.translator.translator import TranslationContext
from pypy.translator.backendopt.all import backend_optimizations
from pypy.translator.js.js import JS
from pypy.translator.js.test.browsertest import jstest
from pypy.translator.js import conftest
from pypy.translator.js.log import... | Python |
from BaseHTTPServer import HTTPServer as BaseHTTPServer, BaseHTTPRequestHandler
import py
from os import system
from cgi import parse_qs
from sys import platform
from time import sleep
import webbrowser
from pypy.translator.js.log import log
log = log.browsertest
class HTTPServer(BaseHTTPServer):
allow_reuse_a... | Python |
""" TurboGears browser testing utility
"""
import thread
import pkg_resources
pkg_resources.require("TurboGears")
import cherrypy
import os
import sys
import webbrowser
from pypy.translator.js.demo.jsdemo import controllers
conf_file = os.path.join(os.path.dirname(controllers.__file__), "..", "dev.cfg")
class ru... | Python |
"""PyPy Translator Frontend
The Translator is a glue class putting together the various pieces of the
translation-related code. It can be used for interactive testing of the
translator; see pypy/bin/translatorshell.py.
"""
import autopath, os, sys, types, copy
from pypy.objspace.flow.model import *
from pypy.transla... | Python |
"""Flow Graph Transformation
The difference between simplification and transformation is that
transformation is based on annotations; it runs after the annotator
completed.
"""
from __future__ import generators
import types
from pypy.objspace.flow.model import SpaceOperation
from pypy.objspace.flow.model import Vari... | Python |
"""Flow Graph Simplification
'Syntactic-ish' simplifications on a flow graph.
simplify_graph() applies all simplifications defined in this file.
"""
import py
from pypy.objspace.flow.model import SpaceOperation
from pypy.objspace.flow.model import Variable, Constant, Block, Link
from pypy.objspace.flow.model import ... | Python |
from pypy.translator.flex.modules.flex import *
from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc
def flash_main( x=1 ):
i = Image()
i.source = load_resource("py_grossini_png")
w = castToWindow( x )
w.addChild(i)
r = load_sound_resource("py_sal_mp3")
r.play()
| Python |
from pypy.rpython.extfunc import genericcallable, register_external
from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc
from pypy.translator.flex.asmgen import add_import
def flexTrace(s):
pass
register_external(flexTrace, args=[str], export_name="_consts_0.flexTrace")
def trace(s):
pa... | Python |
""" Support classes needed for javascript to translate
"""
| Python |
""" mochikit wrappers
"""
from pypy.rpython.extfunc import genericcallable, register_external
from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc
from pypy.translator.js.modules import dom
# MochiKit.LoggingPane
def createLoggingPane(var):
pass
register_external(createLoggingPane, args=[... | Python |
def get_init():
return True
class Sound:
def __init__(self, filename):
self.filename = filename | Python |
class Sprite:
def __init__(self):
pass
class RenderPlain:
def __init__(self, sprites):
pass
def update(self):
pass
def draw(self, surface):
pass | Python |
def get():
return [Event() for x in range(2) ]
class Event:
def __init__(self):
self.type = 1
| Python |
def init():
pass
class Rect:
pass
class Surface:
def __init__(self, size):
self.size = size
def convert(self):
return Surface(self.size)
def fill(self, color):
pass
def blit(self, surface, position):
pass
blit._annspecialcase_... | Python |
import pygame
class Font:
def __init__(self, fontfile, size):
self.size = size
def render(self, text, alpha, color):
return pygame.Surface( (len(text)*self.size, self.size) ) | Python |
from pygame import *
import mixer
import sprite
import font
import time
import event
import image
class error(Exception):
pass | Python |
import pygame
def load(filename):
return pygame.Surface((10,10)) | Python |
ACTIVEEVENT = 1
ANYFORMAT = 268435456
ASYNCBLIT = 4
AUDIO_S16 = 32784
AUDIO_S16LSB = 32784
AUDIO_S16MSB = 36880
AUDIO_S16SYS = 36880
AUDIO_S8 = 32776
AUDIO_U16 = 16
AUDIO_U16LSB = 16
AUDIO_U16MSB = 4112
AUDIO_U16SYS = 4112
AUDIO_U8 = 8
DOUBLEBUF = 1073741824
FULLSCREEN = -2147483648
GL_ACCUM_ALPHA_SIZE = 11
GL_ACCUM_BL... | Python |
class Clock:
def tick(self, delta):
pass | Python |
"""Document Object Model support
this provides a mock browser API, both the standard DOM level 2 stuff as
the browser-specific additions
in addition this provides the necessary descriptions that allow rpython
code that calls the browser DOM API to be translated
note that the API is not and w... | Python |
import string
import types
## json.py implements a JSON (http://json.org) reader and writer.
## Copyright (C) 2005 Patrick D. Logan
## Contact mailto:patrickdlogan@stardecisions.com
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser Genera... | Python |
'''
reference material:
http://webreference.com/javascript/reference/core_ref/
http://webreference.com/programming/javascript/
http://mochikit.com/
http://www.mozilla.org/js/spidermonkey/
svn co http://codespeak.net/svn/kupu/trunk/ecmaunit
'''
import py
import os
from pypy.rpython.rmodel import i... | Python |
"""Contains high level javascript compilation function
"""
import autopath
#from pypy.translator.flex.test.runtest import compile_function
#from pypy.translator.translator import TranslationContext
from pypy.translator.driver import TranslationDriver
from pypy.translator.flex.js import JS
from pypy.tool.error import ... | Python |
try:
set
except NameError:
from sets import Set as set
from pypy.objspace.flow import model as flowmodel
from pypy.rpython.lltypesystem.lltype import Signed, Unsigned, Void, Bool, Float
from pypy.rpython.lltypesystem.lltype import SignedLongLong, UnsignedLongLong
from pypy.rpython.ootypesystem import ootype
fr... | Python |
import py
Option = py.test.config.Option
option = py.test.config.addoptions("pypy-ojs options",
Option('--use-browser', action="store", dest="browser", type="string",
default="", help="run Javascript tests in your default browser"),
Option('--tg', action="store_true", dest="tg... | Python |
""" backend generator routines
"""
from pypy.translator.flex.log import log
from pypy.objspace.flow.model import Variable
from StringIO import StringIO
import_list = []
def add_import(name):
import_list.append(name)
class CodeGenerator(object):
def __init__(self, out, indentstep = 4, startblock = '{',... | Python |
#!/usr/bin/env python
"""
In this example I'll show how to manipulate DOM tree
from inside RPython code
Note that this is low-level API to manipulate it, which
might be suitable if you don't like boilerplate on top.
There is ongoing effort to provide API of somewhat higher level,
which will be way easier to manipulat... | Python |
#!/usr/bin/env python
"""
In this example, we'll show how to add javascript to our simple
server from previous example
"""
from pypy.translator.js.lib import server
import sys
# here we have virtual script "source.js" which we generate
# on-the-fly when requested
HTML = """
<html>
<head>
<script src="source.js"/>
... | Python |
#!/usr/bin/env python
"""
In this example I'll show how to manipulate DOM tree
from inside RPython code
Note that this is low-level API to manipulate it, which
might be suitable if you don't like boilerplate on top.
There is ongoing effort to provide API of somewhat higher level,
which will be way easier to manipulat... | Python |
#!/usr/bin/env python
"""
In this example, we'll show how to add javascript to our simple
server from previous example
"""
from pypy.translator.js.lib import server
import sys
# here we have virtual script "source.js" which we generate
# on-the-fly when requested
HTML = """
<html>
<head>
<script src="source.js"/>
... | Python |
#!/usr/bin/env python
"""
This is simple all-in-one self-containing server,
which just shows almost-empty HTML page
"""
# here we import server, which is derivative of
# BaseHTTPServer from python standard library
from pypy.translator.js.lib import server
# We create handler, which will handle all our requests
clas... | Python |
#!/usr/bin/env python
"""
This is simple all-in-one self-containing server,
which just shows almost-empty HTML page
"""
# here we import server, which is derivative of
# BaseHTTPServer from python standard library
from pypy.translator.js.lib import server
# We create handler, which will handle all our requests
clas... | Python |
""" Communication proxy rendering
"""
from pypy.objspace.flow.model import Variable, Constant
from pypy.rpython.ootypesystem.bltregistry import ArgDesc
GET_METHOD_BODY = """
%(class)s.prototype.%(method)s = function ( %(args)s ) {
var data,str;
var x = new XMLHttpRequest();
data = %(data)s;
str = ""... | Python |
import py
from pypy.tool.ansi_print import ansi_log
log = py.log.Producer("flex")
py.log.setconsumer("flex", ansi_log)
| Python |
#!/usr/bin/env python
import urllib2
import os.path
import sys
import re
import string
url_root = "http://livedocs.adobe.com/flex/3/langref/package-summary.html"
url_root = "file:///Users/gui/Downloads/flex3_documentation/langref/package-summary.html"
dump_file = open('dump.txt', 'w')
def get_page(url):
# print... | Python |
#!/usr/bin/env python
from __future__ import with_statement
import subprocess
import os
import os.path
import re
import sys
import operator as op
import string
import logging
__doc__ = """
Program to convert an intermediate text format that contains the package names,
classes and function/attribute declarations for... | Python |
#!/usr/bin/env python
import urllib2
import os.path
import sys
import re
import string
url_root = "http://livedocs.adobe.com/flex/3/langref/package-summary.html"
url_root = "file:///Users/gui/Downloads/flex3_documentation/langref/package-summary.html"
dump_file = open('dump.txt', 'w')
def get_page(url):
# print... | Python |
#!/usr/bin/env python
from __future__ import with_statement
import subprocess
import os
import os.path
import re
import sys
import operator as op
import string
import logging
__doc__ = """
Program to convert an intermediate text format that contains the package names,
classes and function/attribute declarations for... | Python |
""" JavaScript type system
"""
from pypy.rpython.ootypesystem import ootype
from pypy.rpython.lltypesystem import lltype
from pypy.translator.cli import oopspec
from pypy.rpython.lltypesystem.lltype import Signed, Unsigned, Void, Bool, Float
from pypy.rpython.lltypesystem.lltype import SignedLongLong, UnsignedLongLon... | Python |
""" Opcode meaning objects, descendants of MicroInstruction
"""
#from pypy.translator.js.jsbuiltin import Builtins
from pypy.translator.oosupport.metavm import PushArg, PushAllArgs, StoreResult,\
InstructionList, New, GetField, MicroInstruction
from pypy.translator.flex.log import log
from pypy.rpython.ootypesyst... | Python |
""" JavaScript builtin mappings
"""
from pypy.translator.oosupport.metavm import InstructionList, PushAllArgs,\
_PushAllArgs
from pypy.translator.flex.metavm import SetBuiltinField, ListGetitem, ListSetitem, \
GetBuiltinField, CallBuiltin, Call, SetTimeout, ListContains,\
NewBuiltin, SetOnEvent, ListRemov... | 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.