code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
"""
Tutorial - Sessions
Storing session data in CherryPy applications is very easy: cherrypy
provides a dictionary called "session" that represents the session
data for the current user. If you use RAM based sessions, you can store
any kind of object into that dictionary; otherwise, you are limited to
objects that can... | [
[
8,
0,
0.1136,
0.2045,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.25,
0.0227,
0,
0.66,
0.2,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.5,
0.3864,
0,
0.66,
0.... | [
"\"\"\"\nTutorial - Sessions\n\nStoring session data in CherryPy applications is very easy: cherrypy\nprovides a dictionary called \"session\" that represents the session\ndata for the current user. If you use RAM based sessions, you can store\nany kind of object into that dictionary; otherwise, you are limited to\... |
# This is used in test_config to test unrepr of "from A import B"
thing2 = object() | [
[
14,
0,
1,
0.3333,
0,
0.66,
0,
699,
3,
0,
0,
0,
186,
10,
1
]
] | [
"thing2 = object()"
] |
"""
Tutorial - Object inheritance
You are free to derive your request handler classes from any base
class you wish. In most real-world applications, you will probably
want to create a central base class used for all your pages, which takes
care of things like printing a common page header and footer.
"""
import cherr... | [
[
8,
0,
0.0542,
0.0964,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1205,
0.012,
0,
0.66,
0.1429,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.2651,
0.2289,
0,
0.66,... | [
"\"\"\"\nTutorial - Object inheritance\n\nYou are free to derive your request handler classes from any base\nclass you wish. In most real-world applications, you will probably\nwant to create a central base class used for all your pages, which takes\ncare of things like printing a common page header and footer.\n\"... |
###**********************************************###
### Unique Keychain Python Code ###
### ECE 387, Miami University, Spring 2013 ###
### Created By: Andrew Heldt, Lee Mondini and ###
### Shiloh Womack ###
###********************************************... | [
[
1,
0,
0.1667,
0.0238,
0,
0.66,
0,
601,
0,
6,
0,
0,
601,
0,
0
],
[
14,
0,
0.2381,
0.0238,
0,
0.66,
0.125,
157,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2619,
0.0238,
0,
0... | [
"import serial, sys, feedparser, pprint, time, imaplib",
"USERNAME=\"387keychain\"",
"PASSWORD=\"keychain2013\"",
"SERIALPORT = 'COM4'",
"NO_MAIL = b'm'",
"YES_MAIL = b'n'",
"try:\n\tser = serial.Serial(SERIALPORT, 9600)\nexcept serial.SerialException:\n\tprint (\"no device connected - exiting\")\n\tsys... |
#!/usr/bin/python
import pyglet
from anim3d import *
#3d projection setup func
def setup_gl(dims):
global angle
glMatrixMode(GL_PROJECTION)
glPushMatrix()
glLoadIdentity()
gluPerspective(40, float(dims[0])/dims[1], 0.1, 100)
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glLoadIdentity()
... | [
[
1,
0,
0.0303,
0.0152,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.0455,
0.0152,
0,
0.66,
0.0625,
507,
0,
1,
0,
0,
507,
0,
0
],
[
2,
0,
0.1667,
0.1667,
0,
... | [
"import pyglet",
"from anim3d import *",
"def setup_gl(dims):\n global angle\n\n glMatrixMode(GL_PROJECTION)\n glPushMatrix()\n glLoadIdentity()\n gluPerspective(40, float(dims[0])/dims[1], 0.1, 100)\n glMatrixMode(GL_MODELVIEW)",
" glMatrixMode(GL_PROJECTION)",
" glPushMatrix()",
... |
#!/usr/bin/python
import pyglet
from anim3d import *
#3d projection setup func
def setup_gl(dims):
global angle
glMatrixMode(GL_PROJECTION)
glPushMatrix()
glLoadIdentity()
gluPerspective(40, float(dims[0])/dims[1], 0.1, 100)
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glLoadIdentity()
... | [
[
1,
0,
0.0303,
0.0152,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.0455,
0.0152,
0,
0.66,
0.0625,
507,
0,
1,
0,
0,
507,
0,
0
],
[
2,
0,
0.1667,
0.1667,
0,
... | [
"import pyglet",
"from anim3d import *",
"def setup_gl(dims):\n global angle\n\n glMatrixMode(GL_PROJECTION)\n glPushMatrix()\n glLoadIdentity()\n gluPerspective(40, float(dims[0])/dims[1], 0.1, 100)\n glMatrixMode(GL_MODELVIEW)",
" glMatrixMode(GL_PROJECTION)",
" glPushMatrix()",
... |
from pyglet.gl import *
import math
class Face:
def __init__(self, ind, uv):
self.indices = ind
self.uv = uv
class KeyFrame:
def __init__(self, fp, nv):
self.verts = []
self.frame_num = int(fp.readline())
for i in xrange(nv):
(v1, v2, v3) = fp.readline().sp... | [
[
1,
0,
0.0088,
0.0088,
0,
0.66,
0,
531,
0,
1,
0,
0,
531,
0,
0
],
[
1,
0,
0.0177,
0.0088,
0,
0.66,
0.125,
526,
0,
1,
0,
0,
526,
0,
0
],
[
3,
0,
0.0487,
0.0354,
0,
0... | [
"from pyglet.gl import *",
"import math",
"class Face:\n def __init__(self, ind, uv):\n self.indices = ind \n self.uv = uv",
" def __init__(self, ind, uv):\n self.indices = ind \n self.uv = uv",
" self.indices = ind",
" self.uv = uv",
"class KeyFrame:\n ... |
#!BPY
"""
Name: '3Danim (.txt)'
Blender: 243
Group: 'Export'
Tooltip: 'export an animated text format.'
"""
__author__ = 'V Vamsi Krishna'
__version__ = '0.1'
__url__ = ["3danim project, http://code.google.com/p/3danim",
"", "blender", "blenderartists.org"]
__email__ = ["V.Vamsi Krishna, vamsikrishna.v:gmail*com... | [
[
8,
0,
0.0579,
0.0632,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1053,
0.0105,
0,
0.66,
0.0769,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1158,
0.0105,
0,
0.66... | [
"\"\"\"\nName: '3Danim (.txt)'\nBlender: 243\nGroup: 'Export'\nTooltip: 'export an animated text format.'\n\"\"\"",
"__author__ = 'V Vamsi Krishna'",
"__version__ = '0.1'",
"__url__ = [\"3danim project, http://code.google.com/p/3danim\",\n \"\", \"blender\", \"blenderartists.org\"]",
"__email__ = [\"V.V... |
bl_info = {
"name": "Export 3DAnim Format(.txt)",
"author": "V.Vamsi Krishna(vkrishna)",
"version": (1, 0),
"blender": (2, 64, 0),
"api": 40000,
"location": "File > Export > 3DAnim (.txt)",
"description": "Export 3dAnim (.txt)",
"warning": "",
"category": "Import-Export"}
... | [
[
14,
0,
0.0509,
0.0926,
0,
0.66,
0,
767,
0,
0,
0,
0,
0,
6,
0
],
[
1,
0,
0.1111,
0.0093,
0,
0.66,
0.0909,
573,
0,
1,
0,
0,
573,
0,
0
],
[
1,
0,
0.1204,
0.0093,
0,
0... | [
"bl_info = {\n \"name\": \"Export 3DAnim Format(.txt)\",\n \"author\": \"V.Vamsi Krishna(vkrishna)\",\n \"version\": (1, 0),\n \"blender\": (2, 64, 0),\n \"api\": 40000,\n \"location\": \"File > Export > 3DAnim (.txt)\",\n \"description\": \"Export 3dAnim (.txt)\",",
"import bpy",
"from bpy... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Michael Liao (askxuefeng@gmail.com)'
from os import path
from Cheetah.Template import Template
def main():
file = path.join(path.split(__file__)[0], 'home.html')
print 'Compile template %s...' % file
cc = Template.compile(source=None,... | [
[
14,
0,
0.1739,
0.0435,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2609,
0.0435,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3043,
0.0435,
0,
0.6... | [
"__author__ = 'Michael Liao (askxuefeng@gmail.com)'",
"from os import path",
"from Cheetah.Template import Template",
"def main():\n file = path.join(path.split(__file__)[0], 'home.html')\n print('Compile template %s...' % file)\n cc = Template.compile(source=None, file=file, returnAClass=False, modu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Michael Liao (askxuefeng@gmail.com)'
import datetime
from xml.parsers.expat import ParserCreate
codes = {
0 : u'龙卷风', # tornado
1 : u'热带风暴', # tropical storm
2 : u'飓风', # hurricane
3 : u'风暴', # severe thunderstorm... | [
[
14,
0,
0.0172,
0.0043,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0258,
0.0043,
0,
0.66,
0.0714,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.03,
0.0043,
0,
0.6... | [
"__author__ = 'Michael Liao (askxuefeng@gmail.com)'",
"import datetime",
"from xml.parsers.expat import ParserCreate",
"codes = {\n 0 : u'龙卷风', # tornado\n 1 : u'热带风暴', # tropical storm\n 2 : u'飓风', # hurricane\n 3 : u'风暴', # severe thunderstorms\n 4 : u'雷雨', # thunderstorms... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
##################################################
## DEPENDENCIES
import sys
import os
import os.path
import __builtin__
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVers... | [
[
1,
0,
0.0253,
0.0028,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0281,
0.0028,
0,
0.66,
0.0345,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0309,
0.0028,
0,
... | [
"import sys",
"import os",
"import os.path",
"import __builtin__",
"from os.path import getmtime, exists",
"import time",
"import types",
"from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion",
"from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTupl... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Michael Liao (askxuefeng@gmail.com)'
from google.appengine.ext import db
class City(db.Model):
name = db.StringProperty(required=True)
aliases = db.StringListProperty(required=True)
code = db.IntegerProperty(required=True)
def f... | [
[
14,
0,
0.0151,
0.0038,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0226,
0.0038,
0,
0.66,
0.0455,
167,
0,
1,
0,
0,
167,
0,
0
],
[
3,
0,
0.0472,
0.0377,
0,
0... | [
"__author__ = 'Michael Liao (askxuefeng@gmail.com)'",
"from google.appengine.ext import db",
"class City(db.Model):\n name = db.StringProperty(required=True)\n aliases = db.StringListProperty(required=True)\n code = db.IntegerProperty(required=True)\n\n def first_alias(self):\n return self.al... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Michael Liao (askxuefeng@gmail.com)'
import os
import cgi
import time
import logging
import simplejson
from datetime import date
from google.appengine.api import xmpp
from google.appengine.ext import webapp
from google.appengine.ext.webapp.uti... | [
[
14,
0,
0.0175,
0.0044,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0263,
0.0044,
0,
0.66,
0.0357,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0307,
0.0044,
0,
0... | [
"__author__ = 'Michael Liao (askxuefeng@gmail.com)'",
"import os",
"import cgi",
"import time",
"import logging",
"import simplejson",
"from datetime import date",
"from google.appengine.api import xmpp",
"from google.appengine.ext import webapp",
"from google.appengine.ext.webapp.util import run_... |
'''
Provides an abstract Servlet baseclass for Cheetah's Template class
'''
import sys
import os.path
isWebwareInstalled = False
try:
try:
from ds.appserver.Servlet import Servlet as BaseServlet
except:
from WebKit.Servlet import Servlet as BaseServlet
isWebwareInstalled = True
if not... | [
[
8,
0,
0.0179,
0.0268,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0446,
0.0089,
0,
0.66,
0.2,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0536,
0.0089,
0,
0.66,
... | [
"'''\nProvides an abstract Servlet baseclass for Cheetah's Template class\n'''",
"import sys",
"import os.path",
"isWebwareInstalled = False",
"try:\n try:\n from ds.appserver.Servlet import Servlet as BaseServlet\n except:\n from WebKit.Servlet import Servlet as BaseServlet\n isWebwa... |
#
| [] | [] |
"Template support for Cheetah"
import sys, os, imp
from Cheetah import Compiler
import pkg_resources
def _recompile_template(package, basename, tfile, classname):
tmpl = pkg_resources.resource_string(package, "%s.tmpl" % basename)
c = Compiler.Compiler(source=tmpl, mainClassName='GenTemplate')
code = str... | [
[
8,
0,
0.0091,
0.0091,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0273,
0.0091,
0,
0.66,
0.2,
509,
0,
3,
0,
0,
509,
0,
0
],
[
1,
0,
0.0455,
0.0091,
0,
0.66,
... | [
"\"Template support for Cheetah\"",
"import sys, os, imp",
"from Cheetah import Compiler",
"import pkg_resources",
"def _recompile_template(package, basename, tfile, classname):\n tmpl = pkg_resources.resource_string(package, \"%s.tmpl\" % basename)\n c = Compiler.Compiler(source=tmpl, mainClassName='... |
from turbocheetah import cheetahsupport
TurboCheetah = cheetahsupport.TurboCheetah
__all__ = ["TurboCheetah"] | [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
172,
0,
1,
0,
0,
172,
0,
0
],
[
14,
0,
0.6,
0.2,
0,
0.66,
0.5,
316,
7,
0,
0,
0,
0,
0,
0
],
[
14,
0,
1,
0.2,
0,
0.66,
1,
272,
... | [
"from turbocheetah import cheetahsupport",
"TurboCheetah = cheetahsupport.TurboCheetah",
"__all__ = [\"TurboCheetah\"]"
] |
"""
@@TR: This code is pretty much unsupported.
MondoReport.py -- Batching module for Python and Cheetah.
Version 2001-Nov-18. Doesn't do much practical yet, but the companion
testMondoReport.py passes all its tests.
-Mike Orr (Iron)
TODO: BatchRecord.prev/next/prev_batches/next_batches/query, prev.query,
next.quer... | [
[
8,
0,
0.0162,
0.0302,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0323,
0.0022,
0,
0.66,
0.0455,
616,
0,
1,
0,
0,
616,
0,
0
],
[
7,
0,
0.0399,
0.0129,
0,
0.66... | [
"\"\"\"\n@@TR: This code is pretty much unsupported.\n\nMondoReport.py -- Batching module for Python and Cheetah.\n\nVersion 2001-Nov-18. Doesn't do much practical yet, but the companion\ntestMondoReport.py passes all its tests.\n-Mike Orr (Iron)",
"import operator",
"try:\n from functools import reduce\nex... |
# $Id: CGITemplate.py,v 1.6 2006/01/29 02:09:59 tavis_rudd Exp $
"""A subclass of Cheetah.Template for use in CGI scripts.
Usage in a template:
#extends Cheetah.Tools.CGITemplate
#implements respond
$cgiHeaders#slurp
Usage in a template inheriting a Python class:
1. The template
#extends MyPythonClass... | [
[
8,
0,
0.2532,
0.4675,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.4935,
0.013,
0,
0.66,
0.2,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.5065,
0.013,
0,
0.66,
... | [
"\"\"\"A subclass of Cheetah.Template for use in CGI scripts.\n\nUsage in a template:\n #extends Cheetah.Tools.CGITemplate\n #implements respond\n $cgiHeaders#slurp\n\nUsage in a template inheriting a Python class:",
"__author__ = \"Mike Orr <iron@mso.oz.net>\"",
"__revision__ = \"$Revision: 1.6 $\"[11... |
# $Id: SiteHierarchy.py,v 1.1 2001/10/11 03:25:54 tavis_rudd Exp $
"""Create menus and crumbs from a site hierarchy.
You define the site hierarchy as lists/tuples. Each location in the hierarchy
is a (url, description) tuple. Each list has the base URL/text in the 0
position, and all the children coming after it. A... | [
[
8,
0,
0.0512,
0.0843,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1145,
0.006,
0,
0.66,
0.25,
890,
0,
1,
0,
0,
890,
0,
0
],
[
7,
0,
0.1295,
0.0241,
0,
0.66,
... | [
"\"\"\"Create menus and crumbs from a site hierarchy.\n\nYou define the site hierarchy as lists/tuples. Each location in the hierarchy\nis a (url, description) tuple. Each list has the base URL/text in the 0\nposition, and all the children coming after it. Any child can be a list,\nrepresenting further depth to ... |
"""
Nothing, but in a friendly way. Good for filling in for objects you want to
hide. If $form.f1 is a RecursiveNull object, then
$form.f1.anything["you"].might("use") will resolve to the empty string.
This module was contributed by Ian Bicking.
"""
class RecursiveNull(object):
def __getattr__(self, attr):
... | [
[
8,
0,
0.1429,
0.25,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.6429,
0.6786,
0,
0.66,
1,
956,
0,
8,
0,
0,
186,
0,
0
],
[
2,
1,
0.375,
0.0714,
1,
0.74,
0,... | [
"\"\"\"\nNothing, but in a friendly way. Good for filling in for objects you want to\nhide. If $form.f1 is a RecursiveNull object, then\n$form.f1.anything[\"you\"].might(\"use\") will resolve to the empty string.\n\nThis module was contributed by Ian Bicking.\n\"\"\"",
"class RecursiveNull(object):\n def __g... |
"""This package contains classes, functions, objects and packages contributed
by Cheetah users. They are not used by Cheetah itself. There is no
guarantee that this directory will be included in Cheetah releases, that
these objects will remain here forever, or that they will remain
backward-compatible.
""... | [
[
8,
0,
0.4375,
0.75,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\"This package contains classes, functions, objects and packages contributed\n by Cheetah users. They are not used by Cheetah itself. There is no\n guarantee that this directory will be included in Cheetah releases, that\n these objects will remain here forever, or that they will remain\n backward-co... |
Version = '2.4.1'
VersionTuple = (2, 4, 1, 'final', 0)
MinCompatibleVersion = '2.0rc6'
MinCompatibleVersionTuple = (2, 0, 0, 'candidate', 6)
####
def convertVersionStringToTuple(s):
versionNum = [0, 0, 0]
releaseType = 'final'
releaseTypeSubNum = 0
if s.find('a')!=-1:
num, releaseTypeSubNum = ... | [
[
14,
0,
0.0172,
0.0172,
0,
0.66,
0,
444,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0345,
0.0172,
0,
0.66,
0.2,
292,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.069,
0.0172,
0,
0.66,... | [
"Version = '2.4.1'",
"VersionTuple = (2, 4, 1, 'final', 0)",
"MinCompatibleVersion = '2.0rc6'",
"MinCompatibleVersionTuple = (2, 0, 0, 'candidate', 6)",
"def convertVersionStringToTuple(s):\n versionNum = [0, 0, 0]\n releaseType = 'final'\n releaseTypeSubNum = 0\n if s.find('a')!=-1:\n nu... |
"""SourceReader class for Cheetah's Parser and CodeGenerator
"""
import re
import sys
EOLre = re.compile(r'[ \f\t]*(?:\r\n|\r|\n)')
EOLZre = re.compile(r'(?:\r\n|\r|\n|\Z)')
ENCODINGsearch = re.compile("coding[=:]\s*([-\w.]+)").search
class Error(Exception):
pass
class SourceReade... | [
[
8,
0,
0.0052,
0.0069,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0103,
0.0034,
0,
0.66,
0.1429,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0138,
0.0034,
0,
0.66... | [
"\"\"\"SourceReader class for Cheetah's Parser and CodeGenerator\n\"\"\"",
"import re",
"import sys",
"EOLre = re.compile(r'[ \\f\\t]*(?:\\r\\n|\\r|\\n)')",
"EOLZre = re.compile(r'(?:\\r\\n|\\r|\\n|\\Z)')",
"ENCODINGsearch = re.compile(\"coding[=:]\\s*([-\\w.]+)\").search",
"class Error(Exception):\n ... |
import gettext
_ = gettext.gettext
class I18n(object):
def __init__(self, parser):
pass
## junk I'm playing with to test the macro framework
# def parseArgs(self, parser, startPos):
# parser.getWhiteSpace()
# args = parser.getExpression(useNameMapper=False,
# ... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
723,
0,
1,
0,
0,
723,
0,
0
],
[
14,
0,
0.0299,
0.0149,
0,
0.66,
0.5,
660,
7,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.5149,
0.9552,
0,
0.66... | [
"import gettext",
"_ = gettext.gettext",
"class I18n(object):\n def __init__(self, parser):\n pass\n\n## junk I'm playing with to test the macro framework \n# def parseArgs(self, parser, startPos):\n# parser.getWhiteSpace()\n# args = parser.getExpression(useNameMapper=False,",
" ... |
#
| [] | [] |
# $Id: ErrorCatchers.py,v 1.7 2005/01/03 19:59:07 tavis_rudd Exp $
"""ErrorCatcher class for Cheetah Templates
Meta-Data
================================================================================
Author: Tavis Rudd <tavis@damnsimple.com>
Version: $Revision: 1.7 $
Start Date: 2001/08/01
Last Revision Date: $Date:... | [
[
8,
0,
0.0968,
0.1452,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1774,
0.0161,
0,
0.66,
0.1,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1935,
0.0161,
0,
0.66,
... | [
"\"\"\"ErrorCatcher class for Cheetah Templates\n\nMeta-Data\n================================================================================\nAuthor: Tavis Rudd <tavis@damnsimple.com>\nVersion: $Revision: 1.7 $\nStart Date: 2001/08/01\nLast Revision Date: $Date: 2005/01/03 19:59:07 $",
"__author__ = \"Tavis Rud... |
'''
Compiler classes for Cheetah:
ModuleCompiler aka 'Compiler'
ClassCompiler
MethodCompiler
If you are trying to grok this code start with ModuleCompiler.__init__,
ModuleCompiler.compile, and ModuleCompiler.__getattr__.
'''
import sys
import os
import os.path
from os.path import getmtime, exi... | [
[
8,
0,
0.0025,
0.0045,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0055,
0.0005,
0,
0.66,
0.0312,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.006,
0.0005,
0,
0.66,... | [
"'''\n Compiler classes for Cheetah:\n ModuleCompiler aka 'Compiler'\n ClassCompiler\n MethodCompiler\n\n If you are trying to grok this code start with ModuleCompiler.__init__,\n ModuleCompiler.compile, and ModuleCompiler.__getattr__.",
"import sys",
"import os",
"import os.path",
"from o... |
'''
Provides several CacheStore backends for Cheetah's caching framework. The
methods provided by these classes have the same semantics as those in the
python-memcached API, except for their return values:
set(key, val, time=0)
set the value unconditionally
add(key, val, time=0)
set only if the server doesn't alr... | [
[
8,
0,
0.0787,
0.1481,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1574,
0.0093,
0,
0.66,
0.1667,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.1759,
0.0093,
0,
0.66... | [
"'''\nProvides several CacheStore backends for Cheetah's caching framework. The\nmethods provided by these classes have the same semantics as those in the\npython-memcached API, except for their return values:\n\nset(key, val, time=0)\n set the value unconditionally\nadd(key, val, time=0)",
"import time",
"fr... |
# $Id: ImportHooks.py,v 1.27 2007/11/16 18:28:47 tavis_rudd Exp $
"""Provides some import hooks to allow Cheetah's .tmpl files to be imported
directly like Python .py modules.
To use these:
import Cheetah.ImportHooks
Cheetah.ImportHooks.install()
Meta-Data
========================================================... | [
[
8,
0,
0.0761,
0.1159,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1377,
0.0072,
0,
0.66,
0.0455,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1449,
0.0072,
0,
0.66... | [
"\"\"\"Provides some import hooks to allow Cheetah's .tmpl files to be imported\ndirectly like Python .py modules.\n\nTo use these:\n import Cheetah.ImportHooks\n Cheetah.ImportHooks.install()\n\nMeta-Data",
"__author__ = \"Tavis Rudd <tavis@damnsimple.com>\"",
"__revision__ = \"$Revision: 1.27 $\"[11:-2]",
... |
import os.path
import string
l = ['_'] * 256
for c in string.digits + string.letters:
l[ord(c)] = c
_pathNameTransChars = string.join(l, '')
del l, c
def convertTmplPathToModuleName(tmplPath,
_pathNameTransChars=_pathNameTransChars,
splitdrive=os.pat... | [
[
1,
0,
0.0667,
0.0667,
0,
0.66,
0,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.1333,
0.0667,
0,
0.66,
0.2,
890,
0,
1,
0,
0,
890,
0,
0
],
[
14,
0,
0.2667,
0.0667,
0,
0.66... | [
"import os.path",
"import string",
"l = ['_'] * 256",
"for c in string.digits + string.letters:\n l[ord(c)] = c",
" l[ord(c)] = c",
"_pathNameTransChars = string.join(l, '')",
"def convertTmplPathToModuleName(tmplPath,\n _pathNameTransChars=_pathNameTransChars,\n ... |
"""
Parser classes for Cheetah's Compiler
Classes:
ParseError( Exception )
_LowLevelParser( Cheetah.SourceReader.SourceReader ), basically a lexer
_HighLevelParser( _LowLevelParser )
Parser === _HighLevelParser (an alias)
"""
import os
import sys
import re
from re import DOTALL, MULTILINE
from types import St... | [
[
8,
0,
0.0019,
0.0034,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0041,
0.0004,
0,
0.66,
0.0132,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0045,
0.0004,
0,
0.66... | [
"\"\"\"\nParser classes for Cheetah's Compiler\n\nClasses:\n ParseError( Exception )\n _LowLevelParser( Cheetah.SourceReader.SourceReader ), basically a lexer\n _HighLevelParser( _LowLevelParser )\n Parser === _HighLevelParser (an alias)",
"import os",
"import sys",
"import re",
"from re import DOTALL, ... |
#!/usr/bin/env python
import os
import pprint
try:
from functools import reduce
except ImportError:
# Assume we have reduce
pass
from Cheetah import Parser
from Cheetah import Compiler
from Cheetah import Template
class Analyzer(Parser.Parser):
def __init__(self, *args, **kwargs):
self.calls... | [
[
1,
0,
0.0306,
0.0102,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0408,
0.0102,
0,
0.66,
0.0714,
276,
0,
1,
0,
0,
276,
0,
0
],
[
7,
0,
0.0816,
0.051,
0,
0... | [
"import os",
"import pprint",
"try:\n from functools import reduce\nexcept ImportError:\n # Assume we have reduce\n pass",
" from functools import reduce",
"from Cheetah import Parser",
"from Cheetah import Compiler",
"from Cheetah import Template",
"class Analyzer(Parser.Parser):\n def... |
try:
from ds.sys.Unspecified import Unspecified
except ImportError:
class _Unspecified:
def __repr__(self):
return 'Unspecified'
def __str__(self):
return 'Unspecified'
Unspecified = _Unspecified()
| [
[
7,
0,
0.5556,
1,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
1
],
[
1,
1,
0.2222,
0.1111,
1,
0.08,
0,
219,
0,
1,
0,
0,
219,
0,
0
],
[
3,
1,
0.6667,
0.5556,
1,
0.08,
0,
... | [
"try:\n from ds.sys.Unspecified import Unspecified\nexcept ImportError:\n class _Unspecified:\n def __repr__(self):\n return 'Unspecified' \n def __str__(self):\n return 'Unspecified'",
" from ds.sys.Unspecified import Unspecified",
" class _Unspecified:\n ... |
# $Id: WebInputMixin.py,v 1.10 2006/01/06 21:56:54 tavis_rudd Exp $
"""Provides helpers for Template.webInput(), a method for importing web
transaction variables in bulk. See the docstring of webInput for full details.
Meta-Data
================================================================================
Author: ... | [
[
8,
0,
0.0735,
0.1176,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1373,
0.0098,
0,
0.66,
0.1667,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1471,
0.0098,
0,
0.66... | [
"\"\"\"Provides helpers for Template.webInput(), a method for importing web\ntransaction variables in bulk. See the docstring of webInput for full details.\n\nMeta-Data\n================================================================================\nAuthor: Mike Orr <iron@mso.oz.net>\nLicense: This software is r... |
## statprof.py
## Copyright (C) 2004,2005 Andy Wingo <wingo at pobox dot com>
## Copyright (C) 2001 Rob Browning <rlb at defaultvalue dot org>
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foun... | [
[
8,
0,
0.2336,
0.3257,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.4276,
0.0362,
0,
0.66,
0.0556,
0,
0,
1,
0,
0,
0,
0,
1
],
[
1,
1,
0.4145,
0.0033,
1,
0.06,
... | [
"\"\"\"\nstatprof is intended to be a fairly simple statistical profiler for\npython. It was ported directly from a statistical profiler for guile,\nalso named statprof, available from guile-lib [0].\n\n[0] http://wingolog.org/software/guile-lib/statprof/\n\nTo start profiling, call statprof.start():",
"try:\n ... |
"""This is a copy of the htmlDecode function in Webware.
@@TR: It implemented more efficiently.
"""
from Cheetah.Utils.htmlEncode import htmlCodesReversed
def htmlDecode(s, codes=htmlCodesReversed):
""" Returns the ASCII decoded version of the given HTML string. This does
NOT remove normal HTML tags like <p... | [
[
8,
0,
0.2143,
0.3571,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5,
0.0714,
0,
0.66,
0.5,
756,
0,
1,
0,
0,
756,
0,
0
],
[
2,
0,
0.8214,
0.4286,
0,
0.66,
... | [
"\"\"\"This is a copy of the htmlDecode function in Webware.\n\n@@TR: It implemented more efficiently.\n\n\"\"\"",
"from Cheetah.Utils.htmlEncode import htmlCodesReversed",
"def htmlDecode(s, codes=htmlCodesReversed):\n \"\"\" Returns the ASCII decoded version of the given HTML string. This does\n NOT rem... |
#!/usr/bin/env python
"""
Miscellaneous functions/objects used by Cheetah but also useful standalone.
"""
import os # Used in mkdirsWithPyInitFile.
import sys # Used in die.
##################################################
## MISCELLANEOUS FUNCTIONS
def die(reason):
sys.stderr.write(reason... | [
[
8,
0,
0.0448,
0.0448,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0746,
0.0149,
0,
0.66,
0.1429,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0896,
0.0149,
0,
0.66... | [
"\"\"\"\n Miscellaneous functions/objects used by Cheetah but also useful standalone.\n\"\"\"",
"import os # Used in mkdirsWithPyInitFile.",
"import sys # Used in die.",
"def die(reason):\n sys.stderr.write(reason + '\\n')\n sys.exit(1)",
" sys.stderr.write(reason + '\\n')",
"... |
"""
Indentation maker.
@@TR: this code is unsupported and largely undocumented ...
This version is based directly on code by Robert Kuzelj
<robert_kuzelj@yahoo.com> and uses his directive syntax. Some classes and
attributes have been renamed. Indentation is output via
$self._CHEETAH__indenter.indent() to prevent '_i... | [
[
8,
0,
0.0488,
0.0894,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1057,
0.0081,
0,
0.66,
0.2,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1138,
0.0081,
0,
0.66,
... | [
"\"\"\"\nIndentation maker.\n@@TR: this code is unsupported and largely undocumented ...\n\nThis version is based directly on code by Robert Kuzelj\n<robert_kuzelj@yahoo.com> and uses his directive syntax. Some classes and\nattributes have been renamed. Indentation is output via\n$self._CHEETAH__indenter.indent()... |
"""This is a copy of the htmlEncode function in Webware.
@@TR: It implemented more efficiently.
"""
htmlCodes = [
['&', '&'],
['<', '<'],
['>', '>'],
['"', '"'],
]
htmlCodesReversed = htmlCodes[:]
htmlCodesReversed.reverse()
def htmlEncode(s, codes=htmlCodes):
""" Returns the HTML... | [
[
8,
0,
0.1667,
0.2857,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.4524,
0.2857,
0,
0.66,
0.25,
350,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.619,
0.0476,
0,
0.66,
... | [
"\"\"\"This is a copy of the htmlEncode function in Webware.\n\n\n@@TR: It implemented more efficiently.\n\n\"\"\"",
"htmlCodes = [\n ['&', '&'],\n ['<', '<'],\n ['>', '>'],\n ['\"', '"'],\n]",
"htmlCodesReversed = htmlCodes[:]",
"htmlCodesReversed.reverse()",
"def htmlEncode(s, c... |
#
| [] | [] |
import sys
import os.path
import copy as copyModule
from ConfigParser import ConfigParser
import re
from tokenize import Intnumber, Floatnumber, Number
from types import *
import types
import new
import time
from StringIO import StringIO # not cStringIO because of unicode support
import imp # used by S... | [
[
1,
0,
0.0034,
0.0034,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0069,
0.0034,
0,
0.66,
0.0455,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.0103,
0.0034,
0,
0.... | [
"import sys",
"import os.path",
"import copy as copyModule",
"from ConfigParser import ConfigParser",
"import re",
"from tokenize import Intnumber, Floatnumber, Number",
"from types import *",
"import types",
"import new",
"import time",
"from StringIO import StringIO # not cStringIO because of ... |
# $Id: _SkeletonPage.py,v 1.13 2002/10/01 17:52:02 tavis_rudd Exp $
"""A baseclass for the SkeletonPage template
Meta-Data
==========
Author: Tavis Rudd <tavis@damnsimple.com>,
Version: $Revision: 1.13 $
Start Date: 2001/04/05
Last Revision Date: $Date: 2002/10/01 17:52:02 $
"""
__author__ = "Tavis Rudd <tavis@damnsim... | [
[
8,
0,
0.0282,
0.0423,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0516,
0.0047,
0,
0.66,
0.2,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0563,
0.0047,
0,
0.66,
... | [
"\"\"\"A baseclass for the SkeletonPage template\n\nMeta-Data\n==========\nAuthor: Tavis Rudd <tavis@damnsimple.com>,\nVersion: $Revision: 1.13 $\nStart Date: 2001/04/05\nLast Revision Date: $Date: 2002/10/01 17:52:02 $",
"__author__ = \"Tavis Rudd <tavis@damnsimple.com>\"",
"__revision__ = \"$Revision: 1.13 $\... |
# $Id: CacheRegion.py,v 1.3 2006/01/28 04:19:30 tavis_rudd Exp $
'''
Cache holder classes for Cheetah:
Cache regions are defined using the #cache Cheetah directive. Each
cache region can be viewed as a dictionary (keyed by cacheRegionID)
handling at least one cache item (the default one). It's possible to add
cacheIte... | [
[
8,
0,
0.0809,
0.1397,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.1728,
0.0294,
0,
0.66,
0.1667,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.1691,
0.0074,
1,
0.64,
... | [
"'''\nCache holder classes for Cheetah:\n\nCache regions are defined using the #cache Cheetah directive. Each\ncache region can be viewed as a dictionary (keyed by cacheRegionID)\nhandling at least one cache item (the default one). It's possible to add\ncacheItems in a region by using the `varyBy` #cache directive ... |
# $Id: CheetahWrapper.py,v 1.26 2007/10/02 01:22:04 tavis_rudd Exp $
"""Cheetah command-line interface.
2002-09-03 MSO: Total rewrite.
2002-09-04 MSO: Bugfix, compile command was using wrong output ext.
2002-11-08 MSO: Another rewrite.
Meta-Data
========================================================================... | [
[
8,
0,
0.0127,
0.0206,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0237,
0.0016,
0,
0.66,
0.05,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0253,
0.0016,
0,
0.66,
... | [
"\"\"\"Cheetah command-line interface.\n\n2002-09-03 MSO: Total rewrite.\n2002-09-04 MSO: Bugfix, compile command was using wrong output ext.\n2002-11-08 MSO: Another rewrite.\n\nMeta-Data\n================================================================================",
"__author__ = \"Tavis Rudd <tavis@damnsim... |
'''
Cheetah is an open source template engine and code generation tool.
It can be used standalone or combined with other tools and frameworks. Web
development is its principle use, but Cheetah is very flexible and is also being
used to generate C++ game code, Java, sql, form emails and even Python code.
Homepage
... | [
[
8,
0,
0.475,
0.9,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
1,
0.05,
0,
0.66,
1,
444,
0,
1,
0,
0,
444,
0,
0
]
] | [
"'''\nCheetah is an open source template engine and code generation tool.\n\nIt can be used standalone or combined with other tools and frameworks. Web\ndevelopment is its principle use, but Cheetah is very flexible and is also being\nused to generate C++ game code, Java, sql, form emails and even Python code.\n\nH... |
#!/usr/bin/env python
'''
Core module of Cheetah's Unit-testing framework
TODO
================================================================================
# combo tests
# negative test cases for expected exceptions
# black-box vs clear-box testing
# do some tests that run the Template for long enough to check tha... | [
[
8,
0,
0.1226,
0.1887,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2453,
0.0189,
0,
0.66,
0.0588,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.2642,
0.0189,
0,
0.66... | [
"'''\nCore module of Cheetah's Unit-testing framework\n\nTODO\n================================================================================\n# combo tests\n# negative test cases for expected exceptions\n# black-box vs clear-box testing",
"import sys",
"import unittest",
"from Cheetah.Tests import SyntaxAn... |
"""
XML Test Runner for PyUnit
"""
# Written by Sebastian Rittau <srittau@jroger.in-berlin.de> and placed in
# the Public Domain. With contributions by Paolo Borelli.
__revision__ = "$Id: /private/python/stdlib/xmlrunner.py 16654 2007-11-12T12:46:35.368945Z srittau $"
import os.path
import re
import sys
import time... | [
[
8,
0,
0.0052,
0.0079,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.021,
0.0026,
0,
0.66,
0.05,
809,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0262,
0.0026,
0,
0.66,
... | [
"\"\"\"\nXML Test Runner for PyUnit\n\"\"\"",
"__revision__ = \"$Id: /private/python/stdlib/xmlrunner.py 16654 2007-11-12T12:46:35.368945Z srittau $\"",
"import os.path",
"import re",
"import sys",
"import time",
"import traceback",
"import unittest",
"from StringIO import StringIO",
"from xml.sa... |
#!/usr/bin/env python
# -*- encoding: utf8 -*-
from Cheetah.Template import Template
from Cheetah import CheetahWrapper
from Cheetah import DummyTransaction
import imp
import os
import sys
import tempfile
import unittest
class CommandLineTest(unittest.TestCase):
def createAndCompile(self, source):
sourcef... | [
[
1,
0,
0.0169,
0.0042,
0,
0.66,
0,
171,
0,
1,
0,
0,
171,
0,
0
],
[
1,
0,
0.0211,
0.0042,
0,
0.66,
0.0476,
920,
0,
1,
0,
0,
920,
0,
0
],
[
1,
0,
0.0253,
0.0042,
0,
... | [
"from Cheetah.Template import Template",
"from Cheetah import CheetahWrapper",
"from Cheetah import DummyTransaction",
"import imp",
"import os",
"import sys",
"import tempfile",
"import unittest",
"class CommandLineTest(unittest.TestCase):\n def createAndCompile(self, source):\n sourcefil... |
#!/usr/bin/env python
import unittest
from Cheetah import SettingsManager
class SettingsManagerTests(unittest.TestCase):
def test_mergeDictionaries(self):
left = {'foo' : 'bar', 'abc' : {'a' : 1, 'b' : 2, 'c' : (3,)}}
right = {'xyz' : (10, 9)}
expect = {'xyz': (10, 9), 'foo': 'bar', 'abc... | [
[
1,
0,
0.15,
0.05,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.25,
0.05,
0,
0.66,
0.3333,
920,
0,
1,
0,
0,
920,
0,
0
],
[
3,
0,
0.575,
0.4,
0,
0.66,
0.66... | [
"import unittest",
"from Cheetah import SettingsManager",
"class SettingsManagerTests(unittest.TestCase):\n def test_mergeDictionaries(self):\n left = {'foo' : 'bar', 'abc' : {'a' : 1, 'b' : 2, 'c' : (3,)}}\n right = {'xyz' : (10, 9)}\n expect = {'xyz': (10, 9), 'foo': 'bar', 'abc': {'a'... |
#!/usr/bin/env python
import unittest
from Cheetah import Parser
class ArgListTest(unittest.TestCase):
def setUp(self):
super(ArgListTest, self).setUp()
self.al = Parser.ArgList()
def test_merge1(self):
'''
Testing the ArgList case results from Template.Preprocessors.tes... | [
[
1,
0,
0.0612,
0.0204,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.102,
0.0204,
0,
0.66,
0.3333,
920,
0,
1,
0,
0,
920,
0,
0
],
[
3,
0,
0.5306,
0.7959,
0,
0.6... | [
"import unittest",
"from Cheetah import Parser",
"class ArgListTest(unittest.TestCase):\n def setUp(self):\n super(ArgListTest, self).setUp()\n self.al = Parser.ArgList()\n\n def test_merge1(self):\n ''' \n Testing the ArgList case results from Template.Preprocessors.test_c... |
#!/usr/bin/env python
import unittest
from Cheetah import DirectiveAnalyzer
class AnalyzerTests(unittest.TestCase):
def test_set(self):
template = '''
#set $foo = "bar"
Hello ${foo}!
'''
calls = DirectiveAnalyzer.analyze(template)
self.assertEquals(1, calls.get('s... | [
[
1,
0,
0.1034,
0.0345,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.1724,
0.0345,
0,
0.66,
0.3333,
920,
0,
1,
0,
0,
920,
0,
0
],
[
3,
0,
0.5517,
0.5862,
0,
0.... | [
"import unittest",
"from Cheetah import DirectiveAnalyzer",
"class AnalyzerTests(unittest.TestCase):\n def test_set(self):\n template = '''\n #set $foo = \"bar\"\n Hello ${foo}!\n '''\n calls = DirectiveAnalyzer.analyze(template)\n self.assertEquals(1, calls.get('set... |
#!/usr/bin/env python
import Cheetah.NameMapper
import Cheetah.Template
import sys
import unittest
majorVer, minorVer = sys.version_info[0], sys.version_info[1]
versionTuple = (majorVer, minorVer)
def isPython23():
''' Python 2.3 is still supported by Cheetah, but doesn't support decorators '''
return maj... | [
[
1,
0,
0.0122,
0.0041,
0,
0.66,
0,
308,
0,
1,
0,
0,
308,
0,
0
],
[
1,
0,
0.0163,
0.0041,
0,
0.66,
0.0714,
171,
0,
1,
0,
0,
171,
0,
0
],
[
1,
0,
0.0244,
0.0041,
0,
... | [
"import Cheetah.NameMapper",
"import Cheetah.Template",
"import sys",
"import unittest",
"majorVer, minorVer = sys.version_info[0], sys.version_info[1]",
"versionTuple = (majorVer, minorVer)",
"def isPython23():\n ''' Python 2.3 is still supported by Cheetah, but doesn't support decorators '''\n r... |
#!/usr/bin/env python
'''
Tests for the 'cheetah' command.
Besides unittest usage, recognizes the following command-line options:
--list CheetahWrapper.py
List all scenarios that are tested. The argument is the path
of this script.
--nodelete
Don't delete scratch directory at end.
... | [
[
8,
0,
0.0131,
0.0209,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0244,
0.0017,
0,
0.66,
0.027,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0262,
0.0017,
0,
0.66,... | [
"'''\nTests for the 'cheetah' command.\n\nBesides unittest usage, recognizes the following command-line options:\n --list CheetahWrapper.py\n List all scenarios that are tested. The argument is the path\n of this script.\n --nodelete",
"import os",
"import os.path",
"import pdb",
"impo... |
#
| [] | [] |
#!/usr/bin/env python
import hotshot
import hotshot.stats
import os
import sys
import unittest
from test import pystone
import time
import Cheetah.NameMapper
import Cheetah.Template
# This can be turned on with the `--debug` flag when running the test
# and will cause the tests to all just dump out how long they t... | [
[
1,
0,
0.0123,
0.0041,
0,
0.66,
0,
974,
0,
1,
0,
0,
974,
0,
0
],
[
1,
0,
0.0165,
0.0041,
0,
0.66,
0.04,
226,
0,
1,
0,
0,
226,
0,
0
],
[
1,
0,
0.0206,
0.0041,
0,
0.... | [
"import hotshot",
"import hotshot.stats",
"import os",
"import sys",
"import unittest",
"from test import pystone",
"import time",
"import Cheetah.NameMapper",
"import Cheetah.Template",
"DEBUG = False",
"kPS = 1000",
"TOLERANCE = 0.5*kPS",
"class DurationError(AssertionError):\n pass",
... |
#!/usr/bin/env python
import sys
import types
import os
import os.path
import unittest
from Cheetah.NameMapper import NotFound, valueForKey, \
valueForName, valueFromSearchList, valueFromFrame, valueFromFrameOrSearchList
class DummyClass:
classVar1 = 123
def __init__(self):
self.instanceVar1 ... | [
[
1,
0,
0.0076,
0.0019,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0095,
0.0019,
0,
0.66,
0.0385,
209,
0,
1,
0,
0,
209,
0,
0
],
[
1,
0,
0.0114,
0.0019,
0,
... | [
"import sys",
"import types",
"import os",
"import os.path",
"import unittest",
"from Cheetah.NameMapper import NotFound, valueForKey, \\\n valueForName, valueFromSearchList, valueFromFrame, valueFromFrameOrSearchList",
"class DummyClass:\n classVar1 = 123\n\n def __init__(self):\n self... |
import Cheetah.Template
def render(template_file, **kwargs):
'''
Cheetah.Django.render() takes the template filename
(the filename should be a file in your Django
TEMPLATE_DIRS)
Any additional keyword arguments are passed into the
template are propogated into the templat... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
171,
0,
1,
0,
0,
171,
0,
0
],
[
2,
0,
0.5938,
0.875,
0,
0.66,
1,
24,
0,
2,
1,
0,
0,
0,
4
],
[
8,
1,
0.4688,
0.5,
1,
0.59,
0,... | [
"import Cheetah.Template",
"def render(template_file, **kwargs):\n '''\n Cheetah.Django.render() takes the template filename \n (the filename should be a file in your Django \n TEMPLATE_DIRS)\n\n Any additional keyword arguments are passed into the \n template are propogated ... |
from glob import glob
import os
from os import listdir
import os.path
import re
from tempfile import mktemp
def _escapeRegexChars(txt,
escapeRE=re.compile(r'([\$\^\*\+\.\?\{\}\[\]\(\)\|\\])')):
return escapeRE.sub(r'\\\1', txt)
def findFiles(*args, **kw):
"""Recursively find all the file... | [
[
1,
0,
0.0056,
0.0028,
0,
0.66,
0,
958,
0,
1,
0,
0,
958,
0,
0
],
[
1,
0,
0.0084,
0.0028,
0,
0.66,
0.0769,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0112,
0.0028,
0,
... | [
"from glob import glob",
"import os",
"from os import listdir",
"import os.path",
"import re",
"from tempfile import mktemp",
"def _escapeRegexChars(txt,\n escapeRE=re.compile(r'([\\$\\^\\*\\+\\.\\?\\{\\}\\[\\]\\(\\)\\|\\\\])')):\n return escapeRE.sub(r'\\\\\\1', txt)",
" ret... |
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Sep 8 2010)
## http://www.wxformbuilder.org/
##
## PLEASE DO "NOT" EDIT THIS FILE!
##########################################################################... | [
[
1,
0,
0.0704,
0.007,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
14,
0,
0.0845,
0.007,
0,
0.66,
0.1,
180,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.0915,
0.007,
0,
0.66,
... | [
"import wx",
"wx.ID_Window = 1000",
"wx.ID_Window_StatusBar = 1001",
"wx.ID_Window_MenuBar = 1002",
"wx.ID_Window_Quit = 1003",
"wx.ID_Window_SplitterWindow_LeftPanel = 1004",
"class Window ( wx.Frame ):\n\t\n\tdef __init__( self, parent ):\n\t\twx.Frame.__init__ ( self, parent, id = wx.ID_Window, title... |
""" some utility function for use in load_balance benchmark """
# MPI imports
from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
import sys
import os
from os.path import join, exists
import traceback
from optparse import OptionParser
# logging imports
import logging
# local ... | [
[
8,
0,
0.003,
0.003,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0121,
0.003,
0,
0.66,
0.0417,
985,
0,
1,
0,
0,
985,
0,
0
],
[
14,
0,
0.0152,
0.003,
0,
0.66,
... | [
"\"\"\" some utility function for use in load_balance benchmark \"\"\"",
"from mpi4py import MPI",
"comm = MPI.COMM_WORLD",
"size = comm.Get_size()",
"rank = comm.Get_rank()",
"import sys",
"import os",
"from os.path import join, exists",
"import traceback",
"from optparse import OptionParser",
... |
''' Module to run bench modules which need to be run in mpi
This module imports the given module to run, and returns the result
of the bench functions of the modules. Also results are written to
mpirunner.log file
Usage:
1. Print the result in formatted form:
$ mpiexec -n <num_procs> python mpirunner.py <bench_name>
... | [
[
8,
0,
0.0959,
0.1781,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2055,
0.0137,
0,
0.66,
0.1429,
985,
0,
1,
0,
0,
985,
0,
0
],
[
1,
0,
0.2192,
0.0137,
0,
0.66... | [
"''' Module to run bench modules which need to be run in mpi\n\nThis module imports the given module to run, and returns the result\nof the bench functions of the modules. Also results are written to\nmpirunner.log file\n\nUsage:\n1. Print the result in formatted form:",
"from mpi4py import MPI",
"import sys",
... |
""" Time comparison for the Cython and OpenCL integrators.
We use the NBody integration example as the benchmark. Here, and all
neighbor locator is used. The setup consists of four points at the
vertices of the unit square in 2D.
"""
import numpy
from time import time
import pysph.solver.api as solver
import pysp... | [
[
8,
0,
0.0446,
0.0792,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.099,
0.0099,
0,
0.66,
0.0189,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.1089,
0.0099,
0,
0.66,... | [
"\"\"\" Time comparison for the Cython and OpenCL integrators.\n\nWe use the NBody integration example as the benchmark. Here, and all\nneighbor locator is used. The setup consists of four points at the\nvertices of the unit square in 2D.\n\n\n\"\"\"",
"import numpy",
"from time import time",
"import pysph.so... |
""" Benchmark for the PySPH neighbor search functions. """
import sys
import numpy
import time
#PySPH imports
import pysph.base.api as base
def get_points(np = 10000):
""" Get np particles in domain [1, -1] X [-1, 1] """
x = numpy.random.random(np)*2.0 - 1.0
y = numpy.random.random(np)*2.0 - 1.0
z =... | [
[
8,
0,
0.0092,
0.0092,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0183,
0.0092,
0,
0.66,
0.1,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0275,
0.0092,
0,
0.66,
... | [
"\"\"\" Benchmark for the PySPH neighbor search functions. \"\"\"",
"import sys",
"import numpy",
"import time",
"import pysph.base.api as base",
"def get_points(np = 10000):\n \"\"\" Get np particles in domain [1, -1] X [-1, 1] \"\"\"\n\n x = numpy.random.random(np)*2.0 - 1.0\n y = numpy.random... |
from setuptools import find_packages, setup
from Cython.Distutils import build_ext
from numpy.distutils.extension import Extension
ext_modules = [Extension("cython_nnps", ["cython_nnps.pyx"],
language="c++",
extra_compile_args=["-O3", "-Wall"]
... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.0909,
0.0455,
0,
0.66,
0.25,
413,
0,
1,
0,
0,
413,
0,
0
],
[
1,
0,
0.1364,
0.0455,
0,
0.... | [
"from setuptools import find_packages, setup",
"from Cython.Distutils import build_ext",
"from numpy.distutils.extension import Extension",
"ext_modules = [Extension(\"cython_nnps\", [\"cython_nnps.pyx\"],\n language=\"c++\",\n extra_compile_args=[\"-O3\", \"-Wa... |
"""This module compiles the specified (all) the cython .pyx files
in the specified (current) directory into python extensions
"""
import sys
import os
from setuptools import setup
from Cython.Distutils import build_ext
from numpy.distutils.extension import Extension
import numpy
def get_spcl_extn(extn):
""" spe... | [
[
1,
0,
0.0164,
0.0164,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0328,
0.0164,
0,
0.66,
0.1429,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0656,
0.0164,
0,
... | [
"import sys",
"import os",
"from setuptools import setup",
"from Cython.Distutils import build_ext",
"from numpy.distutils.extension import Extension",
"import numpy",
"def get_spcl_extn(extn):\n \"\"\" special-case extensions with specific requirements \"\"\"\n cpp_extensions = 'sph_funcs', 'nnps... |
import pysph.base.api as base
import pysph.solver.api as solver
import pysph.sph.api as sph
import numpy
import time
import pyopencl as cl
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
# number of particles
np = 1 << 20
# number of times a single calc is evaluated
neval = 5
x = numpy... | [
[
1,
0,
0.0079,
0.0079,
0,
0.66,
0,
212,
0,
1,
0,
0,
212,
0,
0
],
[
1,
0,
0.0159,
0.0079,
0,
0.66,
0.0667,
683,
0,
1,
0,
0,
683,
0,
0
],
[
1,
0,
0.0238,
0.0079,
0,
... | [
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"import pysph.sph.api as sph",
"import numpy",
"import time",
"import pyopencl as cl",
"CLDomain = base.DomainManagerType",
"CLLocator = base.OpenCLNeighborLocatorType",
"np = 1 << 20",
"neval = 5",
"x = numpy.linspace(0,1,np)... |
""" Benchmark example for binning particles in Cython and OpenCL """
import numpy
import numpy.random as random
from time import time
import pysph.base.api as base
import pysph.solver.api as solver
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
# number of points
np = 2**20
# number o... | [
[
8,
0,
0.0164,
0.0164,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0492,
0.0164,
0,
0.66,
0.0323,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0656,
0.0164,
0,
0.66... | [
"\"\"\" Benchmark example for binning particles in Cython and OpenCL \"\"\"",
"import numpy",
"import numpy.random as random",
"from time import time",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"CLDomain = base.DomainManagerType",
"CLLocator = base.OpenCLNeighborLocatorType... |
import pysph.base.api as base
import pysph.solver.api as solver
import pysph.sph.api as sph
import numpy
import time
import pyopencl as cl
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
Locator = base.NeighborLocatorType
# number of particles
np = 16384
# number of times a single calc ... | [
[
1,
0,
0.0077,
0.0077,
0,
0.66,
0,
212,
0,
1,
0,
0,
212,
0,
0
],
[
1,
0,
0.0154,
0.0077,
0,
0.66,
0.0625,
683,
0,
1,
0,
0,
683,
0,
0
],
[
1,
0,
0.0231,
0.0077,
0,
... | [
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"import pysph.sph.api as sph",
"import numpy",
"import time",
"import pyopencl as cl",
"CLDomain = base.DomainManagerType",
"CLLocator = base.OpenCLNeighborLocatorType",
"Locator = base.NeighborLocatorType",
"np = 16384",
"nev... |
from cStringIO import StringIO
import compiler
import inspect
import textwrap
import tokenize
from compiler_unparse import unparse
class Comment(object):
""" A comment block.
"""
is_comment = True
def __init__(self, start_lineno, end_lineno, text):
# int : The first line number in the block. ... | [
[
1,
0,
0.0063,
0.0063,
0,
0.66,
0,
764,
0,
1,
0,
0,
764,
0,
0
],
[
1,
0,
0.0127,
0.0063,
0,
0.66,
0.1,
738,
0,
1,
0,
0,
738,
0,
0
],
[
1,
0,
0.019,
0.0063,
0,
0.66... | [
"from cStringIO import StringIO",
"import compiler",
"import inspect",
"import textwrap",
"import tokenize",
"from compiler_unparse import unparse",
"class Comment(object):\n \"\"\" A comment block.\n \"\"\"\n is_comment = True\n def __init__(self, start_lineno, end_lineno, text):\n #... |
""" Turn compiler.ast structures back into executable python code.
The unparse method takes a compiler.ast tree and transforms it back into
valid python code. It is incomplete and currently only works for
import statements, function calls, function definitions, assignments, and
basic expressions.
... | [
[
8,
0,
0.0076,
0.014,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0163,
0.0012,
0,
0.66,
0.1667,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0174,
0.0012,
0,
0.66,... | [
"\"\"\" Turn compiler.ast structures back into executable python code.\n\n The unparse method takes a compiler.ast tree and transforms it back into\n valid python code. It is incomplete and currently only works for\n import statements, function calls, function definitions, assignments, and\n basic expr... |
import inspect
import os
import pydoc
import docscrape
from docscrape_sphinx import SphinxClassDoc, SphinxFunctionDoc
import numpydoc
import comment_eater
class SphinxTraitsDoc(SphinxClassDoc):
def __init__(self, cls, modulename='', func_doc=SphinxFunctionDoc):
if not inspect.isclass(cls):
rai... | [
[
1,
0,
0.0071,
0.0071,
0,
0.66,
0,
878,
0,
1,
0,
0,
878,
0,
0
],
[
1,
0,
0.0142,
0.0071,
0,
0.66,
0.0909,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0213,
0.0071,
0,
... | [
"import inspect",
"import os",
"import pydoc",
"import docscrape",
"from docscrape_sphinx import SphinxClassDoc, SphinxFunctionDoc",
"import numpydoc",
"import comment_eater",
"class SphinxTraitsDoc(SphinxClassDoc):\n def __init__(self, cls, modulename='', func_doc=SphinxFunctionDoc):\n if n... |
import re, textwrap
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
class SphinxDocString(NumpyDocString):
# string conversion routines
def _str_header(self, name, symbol='`'):
return ['.. rubric:: ' + name, '']
def _str_field_list(self, name):
return [':' + name + ':']
de... | [
[
1,
0,
0.0093,
0.0093,
0,
0.66,
0,
540,
0,
2,
0,
0,
540,
0,
0
],
[
1,
0,
0.0185,
0.0093,
0,
0.66,
0.25,
91,
0,
3,
0,
0,
91,
0,
0
],
[
3,
0,
0.4907,
0.9167,
0,
0.66... | [
"import re, textwrap",
"from docscrape import NumpyDocString, FunctionDoc, ClassDoc",
"class SphinxDocString(NumpyDocString):\n # string conversion routines\n def _str_header(self, name, symbol='`'):\n return ['.. rubric:: ' + name, '']\n\n def _str_field_list(self, name):\n return [':' +... |
def exact_solution(tf=0.00076, dt=1e-4):
""" Exact solution for the the elliptical drop equations """
import numpy
A0 = 100
a0 = 1.0
t = 0.0
theta = numpy.linspace(0,2*numpy.pi, 101)
Anew = A0
anew = a0
while t <= tf:
t += dt
Aold = Anew
aold = anew
... | [
[
2,
0,
0.4667,
0.9,
0,
0.66,
0,
167,
0,
2,
1,
0,
0,
0,
3
],
[
8,
1,
0.0667,
0.0333,
1,
0.3,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
1,
0.1,
0.0333,
1,
0.3,
0.0909,
... | [
"def exact_solution(tf=0.00076, dt=1e-4):\n \"\"\" Exact solution for the the elliptical drop equations \"\"\"\n import numpy\n \n A0 = 100\n a0 = 1.0\n\n t = 0.0",
" \"\"\" Exact solution for the the elliptical drop equations \"\"\"",
" import numpy",
" A0 = 100",
" a0 = 1.0",... |
""" An example solving stress test case """
import sys
import numpy
from numpy import pi, sin, sinh, cos, cosh
import pysph.base.api as base
import pysph.sph.api as sph
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver, get_particle_array
from pysph.sph.funcs import stress_funcs
fr... | [
[
8,
0,
0.0058,
0.0058,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0174,
0.0058,
0,
0.66,
0.037,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0233,
0.0058,
0,
0.66,... | [
"\"\"\" An example solving stress test case \"\"\"",
"import sys",
"import numpy",
"from numpy import pi, sin, sinh, cos, cosh",
"import pysph.base.api as base",
"import pysph.sph.api as sph",
"import pysph.solver.api as solver",
"from pysph.solver.stress_solver import StressSolver, get_particle_array... |
""" An example solving stress test case """
import sys
import numpy
from numpy import pi, sin, sinh, cos, cosh
import pysph.base.api as base
import pysph.sph.api as sph
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver
from pysph.sph.funcs import stress_funcs
from pysph.sph.api imp... | [
[
8,
0,
0.0051,
0.0051,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0154,
0.0051,
0,
0.66,
0.0385,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0205,
0.0051,
0,
0.66... | [
"\"\"\" An example solving stress test case \"\"\"",
"import sys",
"import numpy",
"from numpy import pi, sin, sinh, cos, cosh",
"import pysph.base.api as base",
"import pysph.sph.api as sph",
"import pysph.solver.api as solver",
"from pysph.solver.stress_solver import StressSolver",
"from pysph.sph... |
""" Balls colliding in 2D """
import numpy
import pysph.base.api as base
import pysph.sph.api as sph
import pysph.solver.api as solver
import pysph.sph.funcs.stress_funcs as stress_funcs
app = solver.Application()
Solid = base.ParticleType.Solid
E = 1e7
nu = 0.3975
G = E/(2.0*(1+nu))
K = sph.get_K(G, nu)
ro = 1.0... | [
[
8,
0,
0.0029,
0.0029,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0088,
0.0029,
0,
0.66,
0.0167,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0146,
0.0029,
0,
0.66... | [
"\"\"\" Balls colliding in 2D \"\"\"",
"import numpy",
"import pysph.base.api as base",
"import pysph.sph.api as sph",
"import pysph.solver.api as solver",
"import pysph.sph.funcs.stress_funcs as stress_funcs",
"app = solver.Application()",
"Solid = base.ParticleType.Solid",
"E = 1e7",
"nu = 0.397... |
""" An example solving stress test case """
import numpy
import sys
import pysph.base.api as base
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver, get_particle_array
from pysph.sph.funcs import stress_funcs, arithmetic_funcs
from pysph.sph.api import SPHFunction
app = solver.App... | [
[
8,
0,
0.0081,
0.0081,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0242,
0.0081,
0,
0.66,
0.04,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0323,
0.0081,
0,
0.66,
... | [
"\"\"\" An example solving stress test case \"\"\"",
"import numpy",
"import sys",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"from pysph.solver.stress_solver import StressSolver, get_particle_array",
"from pysph.sph.funcs import stress_funcs, arithmetic_funcs",
"from pysph.... |
""" An example solving stress test case : colliding rubber balls """
import sys
import numpy
from numpy import pi, sin, sinh, cos, cosh
import pysph.base.api as base
import pysph.sph.api as sph
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver
from pysph.sph.funcs import stress_fun... | [
[
8,
0,
0.0071,
0.0071,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0213,
0.0071,
0,
0.66,
0.0435,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0284,
0.0071,
0,
0.66... | [
"\"\"\" An example solving stress test case : colliding rubber balls \"\"\"",
"import sys",
"import numpy",
"from numpy import pi, sin, sinh, cos, cosh",
"import pysph.base.api as base",
"import pysph.sph.api as sph",
"import pysph.solver.api as solver",
"from pysph.solver.stress_solver import StressS... |
""" An example solving stress test case """
import numpy
import sys
import os
import pysph.base.api as base
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver, get_particle_array
from pysph.sph.funcs import stress_funcs, arithmetic_funcs
from pysph.sph.api import SPHFunction
app = ... | [
[
8,
0,
0.006,
0.006,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0179,
0.006,
0,
0.66,
0.0192,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0238,
0.006,
0,
0.66,
... | [
"\"\"\" An example solving stress test case \"\"\"",
"import numpy",
"import sys",
"import os",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"from pysph.solver.stress_solver import StressSolver, get_particle_array",
"from pysph.sph.funcs import stress_funcs, arithmetic_funcs",... |
""" Example file showing the use of solver controller and various interfaces
Usage:
Run this file after running the `controller_elliptical_drop.py` example file
A matplotlib plot window will open showing the current position of all
the particles and colored according to their velocities. The plot is update... | [
[
8,
0,
0.0353,
0.0641,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0769,
0.0064,
0,
0.66,
0.0588,
75,
0,
1,
0,
0,
75,
0,
0
],
[
8,
0,
0.0833,
0.0064,
0,
0.66,
... | [
"\"\"\" Example file showing the use of solver controller and various interfaces\n\nUsage:\n Run this file after running the `controller_elliptical_drop.py` example file\n A matplotlib plot window will open showing the current position of all\n the particles and colored according to their velocities. The p... |
""" An example solving the Elliptical drop test case with various interfaces """
import pysph.base.api as base
import pysph.solver.api as solver
app = solver.Application()
app.process_command_line(['-q', '--interactive',
'--xml-rpc=0.0.0.0:8900', '--multiproc=pysph@0.0.0.0:8800'])
s = solver.Flu... | [
[
8,
0,
0.0455,
0.0455,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1364,
0.0455,
0,
0.66,
0.1,
212,
0,
1,
0,
0,
212,
0,
0
],
[
1,
0,
0.1818,
0.0455,
0,
0.66,
... | [
"\"\"\" An example solving the Elliptical drop test case with various interfaces \"\"\"",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"app = solver.Application()",
"app.process_command_line(['-q', '--interactive',\n '--xml-rpc=0.0.0.0:8900', '--multiproc=pysph@0.... |
""" Simple motion. """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import pysph.sph.api as sph
from random import randint
from numpy import random
nx = 1 << 5
dx = 0.5/nx
def create_particles_3d(**kwargs):
x, y, z = numpy.mgrid[0.25:0.75+1e-10:dx,
0.25... | [
[
8,
0,
0.0061,
0.0061,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0184,
0.0061,
0,
0.66,
0.0455,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0245,
0.0061,
0,
0.66... | [
"\"\"\" Simple motion. \"\"\"",
"import numpy",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"import pysph.sph.api as sph",
"from random import randint",
"from numpy import random",
"nx = 1 << 5",
"dx = 0.5/nx",
"def create_particles_3d(**kwargs):\n\n x, y, z = numpy.mg... |
""" A script to demonstrate the simplest of calculations in parallel
Setup:
------
Two particle arrays are created on two separate processors with the
following procerties:
processor 0:
x ~ [0,1], dx = 0.1, h = 0.2, m = 0.1, fval = x*x
processor 1:
x ~ [1.1, 2], dx = 0.1, h = 0.2, m = 0.1, fval = x*x
"""
#... | [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
985,
0,
1,
0,
0,
985,
0,
0
],
[
1,
0,
0.3,
0.1,
0,
0.66,
0.1667,
954,
0,
2,
0,
0,
954,
0,
0
],
[
1,
0,
0.5,
0.1,
0,
0.66,
0.3333,
... | [
"from mpi4py import MPI",
"import numpy, logging",
"import pysph.sph.api as sph",
"import pysph.solver.api as solver",
"from pysph.base.carray import LongArray",
"from pysph.base.api import Particles, get_particle_array",
"from pysph.base.kernels import CubicSplineKernel"
] |
""" The moving square test case is part of the SPHERIC benchmark
tests. Refer to the document for the test details.
Numerical Parameters:
---------------------
dx = dy = 0.005
h = 0.0065 => h/dx = 1.3
Length of Box = 10
Height of Box = 5
Number of particles = 27639 + 1669 = 29308
ro = 1000.0
Vmax = 1.0
co = 15 (1... | [
[
8,
0,
0.0522,
0.1007,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1082,
0.0037,
0,
0.66,
0.0238,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.1119,
0.0037,
0,
0.66... | [
"\"\"\" The moving square test case is part of the SPHERIC benchmark\ntests. Refer to the document for the test details. \n\nNumerical Parameters:\n---------------------\n\ndx = dy = 0.005\nh = 0.0065 => h/dx = 1.3",
"import numpy",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"impo... |
""" 2D Dam Break Over a dry bed. The case is described in "State of
the art classical SPH for free surface flows", Benedict D Rogers,
Robert A, Dalrymple and Alex J.C Crespo, Journal of Hydraulic
Research, Vol 48, Extra Issue (2010), pp 6-27
Setup:
------
x x !
x x !
x ... | [
[
8,
0,
0.1374,
0.2711,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2784,
0.0037,
0,
0.66,
0.0238,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.2857,
0.0037,
0,
0.66... | [
"\"\"\" 2D Dam Break Over a dry bed. The case is described in \"State of\nthe art classical SPH for free surface flows\", Benedict D Rogers,\nRobert A, Dalrymple and Alex J.C Crespo, Journal of Hydraulic\nResearch, Vol 48, Extra Issue (2010), pp 6-27\n\n\nSetup:\n------",
"import warnings",
"import numpy",
"i... |
""" 2D Dam Break Over a dry bed. The case is described in "State of
the art classical SPH for free surface flows", Benedict D Rogers,
Robert A, Dalrymple and Alex J.C Crespo, Journal of Hydraulic
Research, Vol 48, Extra Issue (2010), pp 6-27
Setup:
------
x x !
x x !
x ... | [
[
8,
0,
0.1109,
0.2189,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2249,
0.003,
0,
0.66,
0.0244,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.2308,
0.003,
0,
0.66,
... | [
"\"\"\" 2D Dam Break Over a dry bed. The case is described in \"State of\nthe art classical SPH for free surface flows\", Benedict D Rogers,\nRobert A, Dalrymple and Alex J.C Crespo, Journal of Hydraulic\nResearch, Vol 48, Extra Issue (2010), pp 6-27\n\n\nSetup:\n------",
"import warnings",
"import numpy",
"i... |
""" A tiny dam break problem
Setup:
------
x x !
x x !
x x !
x x !
x o o o o o x !
x o o o o o x !3m
x o o o o o x !
x o o o o o x !
x o o o o o x !
x x !
xxxxxxxxxxxxxxxxxxxxx | ... | [
[
8,
0,
0.1569,
0.3088,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3137,
0.0049,
0,
0.66,
0.0263,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.3186,
0.0049,
0,
0.66... | [
"\"\"\" A tiny dam break problem\n\n\nSetup:\n------",
"import sys",
"import numpy",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"import pysph.sph.api as sph",
"Fluid = base.ParticleType.Fluid",
"Solid = base.ParticleType.Solid",
"h = 0.05",
"dx = dy = h/1.25",
"ro = 10... |
""" 2D Dam Break Over a dry bed. The case is described in "State of
the art classical SPH for free surface flows", Benedict D Rogers,
Robert A, Dalrymple and Alex J.C Crespo, Journal of Hydraulic
Research, Vol 48, Extra Issue (2010), pp 6-27
Setup:
------
x x !
x x !
x ... | [
[
8,
0,
0.1431,
0.2824,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2901,
0.0038,
0,
0.66,
0.0233,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.2977,
0.0038,
0,
0.66... | [
"\"\"\" 2D Dam Break Over a dry bed. The case is described in \"State of\nthe art classical SPH for free surface flows\", Benedict D Rogers,\nRobert A, Dalrymple and Alex J.C Crespo, Journal of Hydraulic\nResearch, Vol 48, Extra Issue (2010), pp 6-27\n\n\nSetup:\n------",
"import warnings",
"import numpy",
"i... |
""" Dam break simulation over a wet bed.
This is part of the SPHERIC validation test cases (case 5)
(http://wiki.manchester.ac.uk/spheric/index.php/SPHERIC_Home_Page)
The main reference for this test case is 'State-of-the-art classical SPH for free-surface flows' by Moncho Gomez-Gesteira and Benedict D. Rogers and Ro... | [
[
8,
0,
0.0211,
0.0383,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.046,
0.0038,
0,
0.66,
0.0238,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0536,
0.0038,
0,
0.66,... | [
"\"\"\" Dam break simulation over a wet bed.\n\nThis is part of the SPHERIC validation test cases (case 5)\n(http://wiki.manchester.ac.uk/spheric/index.php/SPHERIC_Home_Page)\n\nThe main reference for this test case is 'State-of-the-art classical SPH for free-surface flows' by Moncho Gomez-Gesteira and Benedict D. ... |
""" An example Script to study the behavior of Monaghan type repulsive
particles (Smoothed Particle Hydrodynamics, Reports on Progresses in
Physics)
The boundary particles are an improvement over the Lenard Jones type
repulsive boundary particles. One of the main features is that a
particle moving parallel to the wall... | [
[
8,
0,
0.2083,
0.4118,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4216,
0.0049,
0,
0.66,
0.0244,
715,
0,
2,
0,
0,
715,
0,
0
],
[
1,
0,
0.4265,
0.0049,
0,
0.66... | [
"\"\"\" An example Script to study the behavior of Monaghan type repulsive\nparticles (Smoothed Particle Hydrodynamics, Reports on Progresses in\nPhysics)\n\nThe boundary particles are an improvement over the Lenard Jones type\nrepulsive boundary particles. One of the main features is that a\nparticle moving parall... |
""" A simple example in which two drops collide """
import pysph.solver.api as solver
import pysph.base.api as base
import pysph.sph.api as sph
import numpy
def get_circular_patch(name="", type=0, dx=0.05):
x,y = numpy.mgrid[-1.05:1.05+1e-4:dx, -1.05:1.05+1e-4:dx]
x = x.ravel()
y = y.ravel()
m... | [
[
8,
0,
0.0133,
0.0133,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.04,
0.0133,
0,
0.66,
0.0769,
683,
0,
1,
0,
0,
683,
0,
0
],
[
1,
0,
0.0533,
0.0133,
0,
0.66,
... | [
"\"\"\" A simple example in which two drops collide \"\"\"",
"import pysph.solver.api as solver",
"import pysph.base.api as base",
"import pysph.sph.api as sph",
"import numpy",
"def get_circular_patch(name=\"\", type=0, dx=0.05):\n \n x,y = numpy.mgrid[-1.05:1.05+1e-4:dx, -1.05:1.05+1e-4:dx]\n x... |
""" NBody Example """
import pysph.base.api as base
import pysph.solver.api as solver
import pysph.sph.api as sph
import numpy
Fluid = base.ParticleType.Fluid
# number of particles, time step and final time
np = 1024
dt = 1e-2
tf = 10.0
nsteps = tf/dt
def get_particles(**kwargs):
x = numpy.random.random(... | [
[
8,
0,
0.0164,
0.0164,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0492,
0.0164,
0,
0.66,
0.0526,
212,
0,
1,
0,
0,
212,
0,
0
],
[
1,
0,
0.0656,
0.0164,
0,
0.66... | [
"\"\"\" NBody Example \"\"\"",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"import pysph.sph.api as sph",
"import numpy",
"Fluid = base.ParticleType.Fluid",
"np = 1024",
"dt = 1e-2",
"tf = 10.0",
"nsteps = tf/dt",
"def get_particles(**kwargs):\n \n x = numpy.rando... |
""" Shock tube problem with the ADKE procedure of Sigalotti """
import pysph.solver.api as solver
import pysph.base.api as base
import pysph.sph.api as sph
from pysph.base.kernels import CubicSplineKernel
import numpy
Fluid = base.ParticleType.Fluid
Boundary = base.ParticleType.Boundary
# Shock tube parameters
nl ... | [
[
8,
0,
0.0049,
0.0049,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0146,
0.0049,
0,
0.66,
0.0323,
683,
0,
1,
0,
0,
683,
0,
0
],
[
1,
0,
0.0194,
0.0049,
0,
0.66... | [
"\"\"\" Shock tube problem with the ADKE procedure of Sigalotti \"\"\"",
"import pysph.solver.api as solver",
"import pysph.base.api as base",
"import pysph.sph.api as sph",
"from pysph.base.kernels import CubicSplineKernel",
"import numpy",
"Fluid = base.ParticleType.Fluid",
"Boundary = base.Particle... |
""" Sjogreen's test case """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import get_shock_tube_data as get_data
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
Locator = base.NeighborLocatorType
# shock tube parameters
xl = -1.0; xr = 1.0
pl = 0.4; pr =... | [
[
8,
0,
0.0118,
0.0118,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0353,
0.0118,
0,
0.66,
0.025,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0588,
0.0118,
0,
0.66,... | [
"\"\"\" Sjogreen's test case \"\"\"",
"import numpy",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"import get_shock_tube_data as get_data",
"CLDomain = base.DomainManagerType",
"CLLocator = base.OpenCLNeighborLocatorType",
"Locator = base.NeighborLocatorType",
"xl = -1.0; x... |
""" Standard shock tube problem by Monaghan """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import get_shock_tube_data as data
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
Locator = base.NeighborLocatorType
kernel = base.CubicSplineKernel
hks=False
... | [
[
8,
0,
0.0118,
0.0118,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0353,
0.0118,
0,
0.66,
0.0244,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0588,
0.0118,
0,
0.66... | [
"\"\"\" Standard shock tube problem by Monaghan \"\"\"",
"import numpy",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"import get_shock_tube_data as data",
"CLDomain = base.DomainManagerType",
"CLLocator = base.OpenCLNeighborLocatorType",
"Locator = base.NeighborLocatorType",
... |
"""Woodward and COllela interacting blast wave."""
import numpy
import pysph.sph.api as sph
import pysph.base.api as base
import pysph.solver.api as solver
xl = 0
xr = 1.0
np = 5001
nbp = 100
dx = (xr-xl)/(np-1)
D = 1.5
h0 = D*dx
adke_eps = 0.5
adke_k = 1.0
g1 = 0.2
g2 = 0.4
alpha = 1.0
beta = 1.0
gamma = 1.4
t... | [
[
8,
0,
0.0064,
0.0064,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0191,
0.0064,
0,
0.66,
0.0345,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0318,
0.0064,
0,
0.66... | [
"\"\"\"Woodward and COllela interacting blast wave.\"\"\"",
"import numpy",
"import pysph.sph.api as sph",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"xl = 0",
"xr = 1.0",
"np = 5001",
"nbp = 100",
"dx = (xr-xl)/(np-1)",
"D = 1.5",
"h0 = D*dx",
"adke_eps = 0.5",
... |
"""1D shock tube problem which simulates the collision of two strong
shocks. The test is described in 'An adaptive SPH method for strong
shocks' by Leonardo Di. G. Sigalotti and Henri Lopez and Leonardo
Trujillo, JCP, vol 228, pp (5888-5907)
"""
import pysph.solver.api as solver
import pysph.base.api as base
import p... | [
[
8,
0,
0.0412,
0.0706,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0941,
0.0118,
0,
0.66,
0.0256,
683,
0,
1,
0,
0,
683,
0,
0
],
[
1,
0,
0.1059,
0.0118,
0,
0.66... | [
"\"\"\"1D shock tube problem which simulates the collision of two strong\nshocks. The test is described in 'An adaptive SPH method for strong\nshocks' by Leonardo Di. G. Sigalotti and Henri Lopez and Leonardo\nTrujillo, JCP, vol 228, pp (5888-5907)\n\n\"\"\"",
"import pysph.solver.api as solver",
"import pysph.... |
""" Robert's problem """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import get_shock_tube_data as get_data
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
Locator = base.NeighborLocatorType
# Roberts problem parameters
vc = 0.42
xl = -4.8; xr = 8.0
pl... | [
[
8,
0,
0.0104,
0.0104,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0312,
0.0104,
0,
0.66,
0.0227,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0521,
0.0104,
0,
0.66... | [
"\"\"\" Robert's problem \"\"\"",
"import numpy",
"import pysph.base.api as base",
"import pysph.solver.api as solver",
"import get_shock_tube_data as get_data",
"CLDomain = base.DomainManagerType",
"CLLocator = base.OpenCLNeighborLocatorType",
"Locator = base.NeighborLocatorType",
"vc = 0.42",
"x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.