code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
#!/usr/bin/env python
# Copyright (c) 2001 actzero, inc. All rights reserved.
import sys
sys.path.insert(1, "..")
from SOAPpy import *
# Uncomment to see outgoing HTTP headers and SOAP and incoming
#Config.debug = 1
Config.BuildWithNoType = 1
Config.BuildWithNoNamespacePrefix = 1
hd = headerType(data = {"mystr... | [
[
1,
0,
0.2174,
0.0435,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
8,
0,
0.2609,
0.0435,
0,
0.66,
0.125,
368,
3,
2,
0,
0,
0,
0,
1
],
[
1,
0,
0.3478,
0.0435,
0,
0.6... | [
"import sys",
"sys.path.insert(1, \"..\")",
"from SOAPpy import *",
"Config.BuildWithNoType = 1",
"Config.BuildWithNoNamespacePrefix = 1",
"hd = headerType(data = {\"mystring\": \"Hello World\"})",
"server = SOAPProxy(\"http://localhost:9900/\", header=hd)",
"print(server.echo(\"Hello world\"))",
"s... |
#!/usr/bin/env python
import time
from SOAPpy import SOAP
srv = SOAP.SOAPProxy('http://localhost:10080/')
for p in ('good param', 'ok param'):
ret = srv.badparam(p)
if isinstance(ret, SOAP.faultType):
print ret
else:
print 'ok'
dt = SOAP.dateTimeType(time.localtime(time.time()))
print sr... | [
[
1,
0,
0.1579,
0.0526,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.2105,
0.0526,
0,
0.66,
0.2,
181,
0,
1,
0,
0,
181,
0,
0
],
[
14,
0,
0.3158,
0.0526,
0,
0.... | [
"import time",
"from SOAPpy import SOAP",
"srv = SOAP.SOAPProxy('http://localhost:10080/')",
"for p in ('good param', 'ok param'):\n ret = srv.badparam(p)\n if isinstance(ret, SOAP.faultType):\n print(ret)\n else:\n print('ok')",
" ret = srv.badparam(p)",
" if isinstance(ret, ... |
"""
################################################################################
#
# SOAPpy - Cayce Ullman (cayce@actzero.com)
# Brian Matthews (blm@actzero.com)
# Gregory Warnes (Gregory.R.Warnes@Pfizer.com)
# Christopher Blunck (blunck@gst.com)
#
##########################... | [
[
8,
0,
0.2658,
0.519,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5443,
0.0127,
0,
0.66,
0.125,
977,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.557,
0.0127,
0,
0.66,
... | [
"\"\"\"\n################################################################################\n#\n# SOAPpy - Cayce Ullman (cayce@actzero.com)\n# Brian Matthews (blm@actzero.com)\n# Gregory Warnes (Gregory.R.Warnes@Pfizer.com)\n# Christopher Blunck (blunck@gst.com)\n#",
"ident ... |
"""This file is here for backward compatibility with versions <= 0.9.9
Delete when 1.0.0 is released!
"""
ident = '$Id: SOAP.py,v 1.38 2004/01/31 04:20:06 warnes Exp $'
from version import __version__
from Client import *
from Config import *
from Errors import *
from NS import *
from Parser... | [
[
8,
0,
0.0625,
0.1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.15,
0.025,
0,
0.66,
0.0667,
977,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.175,
0.025,
0,
0.66,
0.1... | [
"\"\"\"This file is here for backward compatibility with versions <= 0.9.9 \n\nDelete when 1.0.0 is released!\n\"\"\"",
"ident = '$Id: SOAP.py,v 1.38 2004/01/31 04:20:06 warnes Exp $'",
"from version import __version__",
"from Client import *",
"from Config import *",
"from Errors import *"... |
__version__="0.12.0"
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
162,
1,
0,
0,
0,
0,
3,
0
]
] | [
"__version__=\"0.12.0\""
] |
"""Provide a class for loading data from URL's that handles basic
authentication"""
ident = '$Id: URLopener.py,v 1.2 2004/01/31 04:20:06 warnes Exp $'
from version import __version__
from Config import Config
from urllib import FancyURLopener
class URLopener(FancyURLopener):
username = None
passwd = None
... | [
[
8,
0,
0.0652,
0.087,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1739,
0.0435,
0,
0.66,
0.2,
977,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2174,
0.0435,
0,
0.66,
... | [
"\"\"\"Provide a class for loading data from URL's that handles basic\nauthentication\"\"\"",
"ident = '$Id: URLopener.py,v 1.2 2004/01/31 04:20:06 warnes Exp $'",
"from version import __version__",
"from Config import Config",
"from urllib import FancyURLopener",
"class URLopener(FancyURLopener):\n\n ... |
ident = '$Id: __init__.py,v 1.9 2004/01/31 04:20:06 warnes Exp $'
from version import __version__
from Client import *
from Config import *
from Errors import *
from NS import *
from Parser import *
from SOAPBuilder import *
from Server import *
from Types import *
from Utiliti... | [
[
14,
0,
0.1333,
0.0667,
0,
0.66,
0,
977,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2,
0.0667,
0,
0.66,
0.0833,
623,
0,
1,
0,
0,
623,
0,
0
],
[
1,
0,
0.3333,
0.0667,
0,
0.66... | [
"ident = '$Id: __init__.py,v 1.9 2004/01/31 04:20:06 warnes Exp $'",
"from version import __version__",
"from Client import *",
"from Config import *",
"from Errors import *",
"from NS import *",
"from Parser import *",
"from SOAPBuilder import *",
"from Server impo... |
#! /usr/bin/env python
"""Logging"""
import sys
class ILogger:
'''Logger interface, by default this class
will be used and logging calls are no-ops.
'''
level = 0
def __init__(self, msg):
return
def warning(self, *args):
return
def debug(self, *args):
return
def... | [
[
8,
0,
0.0235,
0.0118,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0353,
0.0118,
0,
0.66,
0.1,
509,
0,
1,
0,
0,
509,
0,
0
],
[
3,
0,
0.1588,
0.1882,
0,
0.66,
... | [
"\"\"\"Logging\"\"\"",
"import sys",
"class ILogger:\n '''Logger interface, by default this class\n will be used and logging calls are no-ops.\n '''\n level = 0\n def __init__(self, msg):\n return\n def warning(self, *args):",
" '''Logger interface, by default this class\n will ... |
"""
A more or less complete user-defined wrapper around tuple objects.
Adapted version of the standard library's UserList.
Taken from Stefan Schwarzer's ftputil library, available at
<http://www.ndh.net/home/sschwarzer/python/python_software.html>, and used under this license:
Copyright (C) 1999, Stefan Schwarzer ... | [
[
8,
0,
0.2172,
0.4242,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.7677,
0.4545,
0,
0.66,
1,
366,
0,
16,
0,
0,
0,
0,
26
],
[
2,
1,
0.6263,
0.1515,
1,
0.92,
... | [
"\"\"\"\nA more or less complete user-defined wrapper around tuple objects.\nAdapted version of the standard library's UserList.\n\nTaken from Stefan Schwarzer's ftputil library, available at\n<http://www.ndh.net/home/sschwarzer/python/python_software.html>, and used under this license:",
"class UserTuple:\n d... |
#! /usr/bin/env python
"""WSDL parsing services package for Web Services for Python."""
ident = "$Id: __init__.py,v 1.11 2004/12/07 15:54:53 blunck2 Exp $"
import WSDLTools
import XMLname
import logging
| [
[
8,
0,
0.2222,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.4444,
0.1111,
0,
0.66,
0.25,
977,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.6667,
0.1111,
0,
0.66,
... | [
"\"\"\"WSDL parsing services package for Web Services for Python.\"\"\"",
"ident = \"$Id: __init__.py,v 1.11 2004/12/07 15:54:53 blunck2 Exp $\"",
"import WSDLTools",
"import XMLname",
"import logging"
] |
"""Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <http://www.w3.org/TR/soap12-part2/#namem... | [
[
8,
0,
0.0843,
0.1573,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1798,
0.0112,
0,
0.66,
0.125,
977,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2022,
0.0112,
0,
0.66,
... | [
"\"\"\"Translate strings to and from SOAP 1.2 XML name encoding\n\nImplements rules for mapping application defined name to XML names\nspecified by the w3 SOAP working group for SOAP version 1.2 in\nAppendix A of \"SOAP Version 1.2 Part 2: Adjuncts\", W3C Working Draft\n17, December 2001, <http://www.w3.org/TR/soap... |
#! /usr/bin/env python
"""Namespace module, so you don't need PyXML
"""
try:
from xml.ns import SOAP, SCHEMA, WSDL, XMLNS, DSIG, ENCRYPTION
DSIG.C14N = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
except:
class SOAP:
ENV = "http://schemas.xmlsoap.org/soap/envelope/"
... | [
[
8,
0,
0.02,
0.016,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.3,
0.528,
0,
0.66,
0.0769,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.048,
0.008,
1,
0.22,
0,
... | [
"\"\"\"Namespace module, so you don't need PyXML \n\"\"\"",
"try:\n from xml.ns import SOAP, SCHEMA, WSDL, XMLNS, DSIG, ENCRYPTION\n DSIG.C14N = \"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"\n \nexcept:\n class SOAP:\n ENV = \"http://schemas.xmlsoap.org/soap/envelope/\"\n ... |
#! /usr/bin/env python
"""wstools.WSDLTools.WSDLReader tests directory."""
import utils
| [
[
8,
0,
0.4,
0.2,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.8,
0.2,
0,
0.66,
1,
970,
0,
1,
0,
0,
970,
0,
0
]
] | [
"\"\"\"wstools.WSDLTools.WSDLReader tests directory.\"\"\"",
"import utils"
] |
"""Parse web services description language to get SOAP methods.
Rudimentary support."""
ident = '$Id: WSDL.py,v 1.11 2005/02/21 20:16:15 warnes Exp $'
from version import __version__
import wstools
from Client import SOAPProxy, SOAPAddress
from Config import Config
import urllib
class Proxy:
"""WSDL Proxy.
... | [
[
8,
0,
0.0172,
0.0259,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0431,
0.0086,
0,
0.66,
0.1429,
977,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0517,
0.0086,
0,
0.66,... | [
"\"\"\"Parse web services description language to get SOAP methods.\n\nRudimentary support.\"\"\"",
"ident = '$Id: WSDL.py,v 1.11 2005/02/21 20:16:15 warnes Exp $'",
"from version import __version__",
"import wstools",
"from Client import SOAPProxy, SOAPAddress",
"from Config import Config",
"import url... |
"""
GSIServer - Contributed by Ivan R. Judson <judson@mcs.anl.gov>
################################################################################
#
# SOAPpy - Cayce Ullman (cayce@actzero.com)
# Brian Matthews (blm@actzero.com)
# Gregory Warnes (Gregory.R.Warnes@Pfizer.com)
# ... | [
[
8,
0,
0.1573,
0.3077,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3217,
0.007,
0,
0.66,
0.0435,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.3357,
0.007,
0,
0.66,... | [
"\"\"\"\nGSIServer - Contributed by Ivan R. Judson <judson@mcs.anl.gov>\n\n\n################################################################################\n#\n# SOAPpy - Cayce Ullman (cayce@actzero.com)\n# Brian Matthews (blm@actzero.com)",
"from __future__ import nested_scopes",
"ident = ... |
#!/usr/bin/env python
import string
import cgi
ident = '$Id: interop2html.py,v 1.1.1.1 2001/06/27 21:36:14 cullman Exp $'
lines = open('output.txt').readlines()
#preserve the tally
tally = lines[-6:]
#whack the tally from lines
lines = lines[:-6]
table={}
for line in lines:
if line[:3] == ' ' or line == '>\n' : ... | [
[
1,
0,
0.0395,
0.0132,
0,
0.66,
0,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.0526,
0.0132,
0,
0.66,
0.0476,
934,
0,
1,
0,
0,
934,
0,
0
],
[
14,
0,
0.0789,
0.0132,
0,
... | [
"import string",
"import cgi",
"ident = '$Id: interop2html.py,v 1.1.1.1 2001/06/27 21:36:14 cullman Exp $'",
"lines = open('output.txt').readlines()",
"tally = lines[-6:]",
"lines = lines[:-6]",
"table={}",
"for line in lines:\n if line[:3] == ' ' or line == '>\\n' : continue\n line = line[:-1] #... |
"""
------------------------------------------------------------------
Author: Gregory R. Warnes <Gregory.R.Warnes@Pfizer.com>
Date: 2005-02-24
Version: 0.7.2
Copyright: (c) 2003-2005 Pfizer, Licensed to PSF under a Contributor Agreement
License: Licensed under the Apache License, Version 2.0 (the"License")... | [
[
8,
0,
0.2692,
0.5128,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.6154,
0.0256,
0,
0.66,
0.25,
152,
0,
1,
0,
0,
152,
0,
0
],
[
14,
0,
0.6667,
0.0256,
0,
0.66,... | [
"\"\"\"\n------------------------------------------------------------------\nAuthor: Gregory R. Warnes <Gregory.R.Warnes@Pfizer.com>\nDate: 2005-02-24\nVersion: 0.7.2\nCopyright: (c) 2003-2005 Pfizer, Licensed to PSF under a Contributor Agreement\nLicense: Licensed under the Apache License, Version 2.0 ... |
"""Utilities for handling IEEE 754 floating point special values
This python module implements constants and functions for working with
IEEE754 double-precision special values. It provides constants for
Not-a-Number (NaN), Positive Infinity (PosInf), and Negative Infinity
(NegInf), as well as functions to test for th... | [
[
8,
0,
0.1067,
0.2079,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2191,
0.0056,
0,
0.66,
0.0455,
162,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2247,
0.0056,
0,
0.66... | [
"\"\"\"Utilities for handling IEEE 754 floating point special values\n\nThis python module implements constants and functions for working with\nIEEE754 double-precision special values. It provides constants for\nNot-a-Number (NaN), Positive Infinity (PosInf), and Negative Infinity\n(NegInf), as well as functions t... |
from sys import stdin, stdout
#fin = stdin
fin = open('input.txt')
fout = stdout
#fout = open('output.txt', 'w')
s = list(fin.read().strip().split())
n = list(map(len, s))
dp = [[0] * (n[1] + 1) for i in range(n[0] + 1)]
fr = [[(0, 0)] * (n[1] + 1) for i in range(n[0] + 1)]
for i in range(n[0]):
f... | [
[
1,
0,
0.0312,
0.0312,
0,
0.66,
0,
509,
0,
2,
0,
0,
509,
0,
0
],
[
14,
0,
0.125,
0.0312,
0,
0.66,
0.0909,
225,
3,
1,
0,
0,
693,
10,
1
],
[
14,
0,
0.1562,
0.0312,
0,
... | [
"from sys import stdin, stdout",
"fin = open('input.txt')",
"fout = stdout",
"s = list(fin.read().strip().split())",
"n = list(map(len, s))",
"dp = [[0] * (n[1] + 1) for i in range(n[0] + 1)]",
"fr = [[(0, 0)] * (n[1] + 1) for i in range(n[0] + 1)]",
"for i in range(n[0]):\n for j in range(n[1]):\n... |
from sys import stdin, stdout
fin = stdin
#fin = open('input.txt')
fout = stdout
#fout = open('output.txt', 'w')
n = int(fin.readline())
ans = [[] for i in range(n)]
for i in range(n):
for j in range(n):
ans[(i + j) % n].append(i * n + j + 1)
for i in range(n):
print(' '.join(map(str, ans[i]))... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
509,
0,
2,
0,
0,
509,
0,
0
],
[
14,
0,
0.1765,
0.0588,
0,
0.66,
0.1667,
225,
2,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2941,
0.0588,
0,
... | [
"from sys import stdin, stdout",
"fin = stdin",
"fout = stdout",
"n = int(fin.readline())",
"ans = [[] for i in range(n)]",
"for i in range(n):\n\tfor j in range(n):\n\t\tans[(i + j) % n].append(i * n + j + 1)",
"\tfor j in range(n):\n\t\tans[(i + j) % n].append(i * n + j + 1)",
"\t\tans[(i + j) % n]... |
'''
Created on 21-03-2011
@author: maciek
'''
def formatString(format, **kwargs):
'''
'''
if not format: return ''
for arg in kwargs.keys():
format = format.replace("{" + arg + "}", "##" + arg + "##")
format = format.replace ("{", "{{")
format = format.replace("}", "}}")
for... | [
[
8,
0,
0.1304,
0.2174,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.6739,
0.6957,
0,
0.66,
1,
798,
0,
2,
1,
0,
0,
0,
9
],
[
8,
1,
0.413,
0.087,
1,
0.76,
0,
... | [
"'''\nCreated on 21-03-2011\n\n@author: maciek\n'''",
"def formatString(format, **kwargs):\n '''\n '''\n if not format: return ''\n \n for arg in kwargs.keys():\n format = format.replace(\"{\" + arg + \"}\", \"##\" + arg + \"##\")\n format = format.replace (\"{\", \"{{\")",
" '''\n ... |
'''
Created on 21-03-2011
@author: maciek
'''
from IndexGenerator import IndexGenerator
from optparse import OptionParser
import os
import tempfile
import shutil
import logging
logging.basicConfig(level = logging.DEBUG)
parser = OptionParser()
parser.add_option('-n', '--app-name', action='store', dest='appName', hel... | [
[
8,
0,
0.0341,
0.0568,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0682,
0.0114,
0,
0.66,
0.0303,
933,
0,
1,
0,
0,
933,
0,
0
],
[
1,
0,
0.0795,
0.0114,
0,
0.66... | [
"'''\nCreated on 21-03-2011\n\n@author: maciek\n'''",
"from IndexGenerator import IndexGenerator",
"from optparse import OptionParser",
"import os",
"import tempfile",
"import shutil",
"import logging",
"logging.basicConfig(level = logging.DEBUG)",
"parser = OptionParser()",
"parser.add_option('-n... |
'''
Created on 21-03-2011
@author: maciek
'''
from formater import formatString
import os
class IndexGenerator(object):
'''
Generates Index.html for iOS app OTA distribution
'''
basePath = os.path.dirname(__file__)
templateFile = os.path.join(basePath,"templates/index.tmpl")
releaseUrls = ""
... | [
[
8,
0,
0.0526,
0.0877,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1053,
0.0175,
0,
0.66,
0.3333,
11,
0,
1,
0,
0,
11,
0,
0
],
[
1,
0,
0.1228,
0.0175,
0,
0.66,
... | [
"'''\nCreated on 21-03-2011\n\n@author: maciek\n'''",
"from formater import formatString",
"import os",
"class IndexGenerator(object):\n '''\n Generates Index.html for iOS app OTA distribution\n '''\n basePath = os.path.dirname(__file__)\n templateFile = os.path.join(basePath,\"templates/index.... |
from math import sqrt, sin, cos, tan, pi
from numpy import *
# linear interp between key frames startKey and endKey, returns a list of frames
# includes startKey's time exclude endKey's time
def lerpt(startKey, endKey):
step = 1 / 30.0 #assuming 30 frames a second
#key format is [time, pose] i have th... | [
[
1,
0,
0.0038,
0.0038,
0,
0.66,
0,
526,
0,
5,
0,
0,
526,
0,
0
],
[
1,
0,
0.0077,
0.0038,
0,
0.66,
0.0714,
954,
0,
1,
0,
0,
954,
0,
0
],
[
2,
0,
0.0728,
0.1034,
0,
... | [
"from math import sqrt, sin, cos, tan, pi",
"from numpy import *",
"def lerpt(startKey, endKey):\n step = 1 / 30.0 #assuming 30 frames a second\n\n #key format is [time, pose] i have the time now, so i just pull out the pose\n startTime = startKey[0]\n endTime = endKey[0]\n\n startPose = startKey... |
#!/usr/bin/python
from random import uniform
def find_xIndex(x, array):
i = 0
for value in array:
if x < value:
return i
i += 1
return 0
func = lambda x:x**2.
weight = lambda x:x**1.
x = [.001*(i+1.) for i in range(1000)]
# create the weight prob. boundary and name as norm_w
weightList = [weight(i) for i in... | [
[
1,
0,
0.0541,
0.027,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
2,
0,
0.1622,
0.1892,
0,
0.66,
0.0667,
593,
0,
2,
1,
0,
0,
0,
0
],
[
14,
1,
0.1081,
0.027,
1,
0.9... | [
"from random import uniform",
"def find_xIndex(x, array):\n\ti = 0\n\tfor value in array:\n\t\tif x < value:\n\t\t\treturn i\n\t\ti += 1\n\treturn 0",
"\ti = 0",
"\tfor value in array:\n\t\tif x < value:\n\t\t\treturn i\n\t\ti += 1",
"\t\tif x < value:\n\t\t\treturn i",
"\t\t\treturn i",
"\treturn 0",
... |
#!/usr/bin/python
import time
from random import uniform
# position : [up, down, left, right]
moveList = {
1 : (4, 0, 0, 2),
2 : (5, 0, 1, 3),
3 : (6, 0, 2, 0),
4 : (7, 1, 0, 5),
5 : (8, 2, 4, 6),
6 : (9, 3, 5, 0),
7 : (0, 4, 0, 8),
8 : (0, 5, 7, 9),
9 : (0, 6, 8, 0)
}
Nhits = {
1 : 0,
2 : 0,
3 : 0,
4 : 0,
5 : 0,
6 : ... | [
[
1,
0,
0.0206,
0.0103,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0309,
0.0103,
0,
0.66,
0.0588,
715,
0,
1,
0,
0,
715,
0,
0
],
[
14,
0,
0.1031,
0.1134,
0,
... | [
"import time",
"from random import uniform",
"moveList = {\n1 : (4, 0, 0, 2),\n2 : (5, 0, 1, 3),\n3 : (6, 0, 2, 0),\n4 : (7, 1, 0, 5),\n5 : (8, 2, 4, 6),\n6 : (9, 3, 5, 0),\n7 : (0, 4, 0, 8),",
"Nhits = {\n1 : 0,\n2 : 0,\n3 : 0,\n4 : 0,\n5 : 0,\n6 : 0,\n7 : 0,",
"N = 4000",
"startPosition = 9",
"positio... |
#!/usr/bin/python
import Gnuplot
import math
from random import uniform
def markov_throw(delta, x, y):
return x + uniform(-delta, delta), y + uniform(-delta, delta)
def direct_throw(start, end):
return uniform(start, end), uniform(start, end)
def IsInSquare(x, y):
if abs(x) < 1. and abs(y) < 1.:
return True... | [
[
1,
0,
0.0202,
0.0101,
0,
0.66,
0,
580,
0,
1,
0,
0,
580,
0,
0
],
[
1,
0,
0.0303,
0.0101,
0,
0.66,
0.1111,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0404,
0.0101,
0,
... | [
"import Gnuplot",
"import math",
"from random import uniform",
"def markov_throw(delta, x, y):\n\treturn\tx + uniform(-delta, delta), y + uniform(-delta, delta)",
"\treturn\tx + uniform(-delta, delta), y + uniform(-delta, delta)",
"def direct_throw(start, end):\n\treturn uniform(start, end), uniform(start... |
from random import uniform
def cont_integral(a, b, N):
summ = 0.0
summ_n = 0.0
for i in range(N):
x = uniform(0, 1)**(1./(a+1.))
area = x**(b-a)
summ += area
return summ/float(N)
a = 2.
b = 3.
N = 1000
print cont_integral(a, b, N)
| [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
2,
0,
0.4062,
0.5,
0,
0.66,
0.2,
893,
0,
3,
1,
0,
0,
0,
3
],
[
14,
1,
0.25,
0.0625,
1,
0.05,
... | [
"from random import uniform",
"def cont_integral(a, b, N):\n\tsumm = 0.0\n\tsumm_n = 0.0\n\tfor i in range(N):\n\t\tx = uniform(0, 1)**(1./(a+1.))\n\t\tarea = x**(b-a)\n\t\tsumm += area\n\treturn summ/float(N)",
"\tsumm = 0.0",
"\tsumm_n = 0.0",
"\tfor i in range(N):\n\t\tx = uniform(0, 1)**(1./(a+1.))\n\t\... |
from random import uniform
class ThrowMethod:
def Throw(self):
return 0.
class DirectPyThrow(ThrowMethod):
def __init__(self, start = 0., end = 1.):
self.start = start
self.end = end
def Throw(self):
return uniform(self.start, self.end), uniform(self.start, self.end)
class DirectNaiveThrow(ThrowMethod):... | [
[
1,
0,
0.0049,
0.0049,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
3,
0,
0.0196,
0.0147,
0,
0.66,
0.0909,
337,
0,
1,
0,
0,
0,
0,
0
],
[
2,
1,
0.0221,
0.0098,
1,
0.... | [
"from random import uniform",
"class ThrowMethod:\n\tdef Throw(self):\n\t\treturn 0.",
"\tdef Throw(self):\n\t\treturn 0.",
"\t\treturn 0.",
"class DirectPyThrow(ThrowMethod):\n\tdef __init__(self, start = 0., end = 1.):\n\t\tself.start = start\n\t\tself.end = end\n\n\tdef Throw(self):\n\t\treturn uniform(s... |
import numpy as np
from random import uniform
class record(object):
def __init__(self):
self.summ = 0. # summation f
self.sumSquare = 0. # summation f^2
self.count = 0
def Clear(self):
self.summ = 0.
self.sumSquare = 0.
self.count = 0
def Add(self, value):
self.count += 1
self.summ += value
se... | [
[
1,
0,
0.0041,
0.0041,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0082,
0.0041,
0,
0.66,
0.125,
715,
0,
1,
0,
0,
715,
0,
0
],
[
3,
0,
0.0615,
0.0861,
0,
0... | [
"import numpy as np",
"from random import uniform",
"class record(object):\n\tdef __init__(self):\n\t\tself.summ = 0.\t\t# summation f\n\t\tself.sumSquare = 0.\t# summation f^2\n\t\tself.count = 0\n\n\tdef Clear(self):\n\t\tself.summ = 0.",
"\tdef __init__(self):\n\t\tself.summ = 0.\t\t# summation f\n\t\tself... |
import csv
import numpy as np
a = csv.reader(open('test.txt', 'r'), delimiter='\t')
a.next() # skip a column
data = []
for row in a:
data.append(row[:-1])
print np.array(data, dtype='float')
| [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
312,
0,
1,
0,
0,
312,
0,
0
],
[
1,
0,
0.2,
0.1,
0,
0.66,
0.1667,
954,
0,
1,
0,
0,
954,
0,
0
],
[
14,
0,
0.4,
0.1,
0,
0.66,
0.3333,... | [
"import csv",
"import numpy as np",
"a = csv.reader(open('test.txt', 'r'), delimiter='\\t')",
"a.next()\t# skip a column",
"data = []",
"for row in a:\n\tdata.append(row[:-1])",
"\tdata.append(row[:-1])",
"print(np.array(data, dtype='float'))"
] |
import numpy as np
from scipy.constants import codata
from random import uniform
class OneD_Ising:
def __init__(self, n = 0, J = 1., T = 0., B = 0.):
self.up = 1.
self.down = -1.
self.J = J
self.n = n
self.B = B
self.chain = np.zeros(self.n)
self.currH = 0.
self.sumH = 0.
self.beta = 1/float(T)
def... | [
[
1,
0,
0.0145,
0.0145,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.029,
0.0145,
0,
0.66,
0.0833,
19,
0,
1,
0,
0,
19,
0,
0
],
[
1,
0,
0.0435,
0.0145,
0,
0.6... | [
"import numpy as np",
"from scipy.constants import codata",
"from random import uniform",
"class OneD_Ising:\n\tdef __init__(self, n = 0, J = 1., T = 0., B = 0.):\n\t\tself.up = 1.\n\t\tself.down = -1.\n\t\tself.J = J\n\t\tself.n = n\n\t\tself.B = B\n\t\tself.chain = np.zeros(self.n)",
"\tdef __init__(self,... |
from matplotlib.pylab import *
import numpy as np
t = np.arange(0, 10, 1)
y1 = np.e**(-t/2.)
y2 = np.e**(-t/5.)
ion()
#title("This is test title")
#xlabel("Hello", fontsize=28)
#ylabel("$\Delta$R/R", fontsize=28, weight='bold')
#grid(True)
"""
marker
marker +, o, <, >, ^, ., s, v, x ...etc.
ms markersize
mew markere... | [
[
1,
0,
0.02,
0.02,
0,
0.66,
0,
607,
0,
1,
0,
0,
607,
0,
0
],
[
1,
0,
0.04,
0.02,
0,
0.66,
0.0588,
954,
0,
1,
0,
0,
954,
0,
0
],
[
14,
0,
0.08,
0.02,
0,
0.66,
0... | [
"from matplotlib.pylab import *",
"import numpy as np",
"t = np.arange(0, 10, 1)",
"y1 = np.e**(-t/2.)",
"y2 = np.e**(-t/5.)",
"ion()",
"\"\"\"\nmarker\n\tmarker\t+, o, <, >, ^, ., s, v, x ...etc.\nms\tmarkersize\nmew\tmarkeredgewidth\nmec\tmarkeredgecolor\nmfc\tmarkerfillercolor",
"\"\"\"\nb\tblue\ng... |
from pylab import *
from scipy import optimize
from numpy import *
class Parameter:
def __init__(self, value):
self.value = value
def set(self, value):
self.value = value
def __call__(self):
return self.value
def fit(function, parameters, y, x = None):
def f(param... | [
[
1,
0,
0.0238,
0.0238,
0,
0.66,
0,
735,
0,
1,
0,
0,
735,
0,
0
],
[
1,
0,
0.0476,
0.0238,
0,
0.66,
0.0588,
265,
0,
1,
0,
0,
265,
0,
0
],
[
1,
0,
0.0714,
0.0238,
0,
... | [
"from pylab import *",
"from scipy import optimize",
"from numpy import *",
"class Parameter:\n def __init__(self, value):\n self.value = value\n\n def set(self, value):\n self.value = value\n\n def __call__(self):",
" def __init__(self, value):\n self.value = va... |
from pylab import *
from scipy import *
from scipy import optimize
# if you experience problem "optimize not found", try to uncomment the following line. The problem is present at least at Ubuntu Lucid python scipy package
# from scipy import optimize
# Generate data points with noise
num_points = 500
Tx = linspace(0... | [
[
1,
0,
0.025,
0.025,
0,
0.66,
0,
735,
0,
1,
0,
0,
735,
0,
0
],
[
1,
0,
0.05,
0.025,
0,
0.66,
0.0526,
265,
0,
1,
0,
0,
265,
0,
0
],
[
1,
0,
0.075,
0.025,
0,
0.66,
... | [
"from pylab import *",
"from scipy import *",
"from scipy import optimize",
"num_points = 500",
"Tx = linspace(0., 200., num_points)",
"Ty = Tx",
"tX = 1.6*cos(2*pi*(Tx/29.-1.32/360.)) +1.4*((0.5-rand(num_points))*exp(2*rand(num_points)**2))",
"fitfunc = lambda p, x: p[0]*cos(2*pi*(x/p[1]+p[2]/360.)) ... |
#!/usr/bin/python2.4
#
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | [
[
8,
0,
0.5,
0.0156,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5469,
0.0156,
0,
0.66,
0.2,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.5781,
0.0156,
0,
0.66,
0... | [
"\"\"\"Run all tests defined in the DSPL Tools code.\"\"\"",
"__author__ = 'Benjamin Yolken <yolken@google.com>'",
"import unittest",
"_TEST_MODULE_NAMES = [\n 'dsplcheck_test',\n 'dsplgen_test',\n 'dspllib.data_sources.csv_data_source_test',\n 'dspllib.data_sources.csv_data_source_sqlite_test',\n... |
#!/usr/bin/python2.4
#
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | [
[
8,
0,
0.1481,
0.0046,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.162,
0.0046,
0,
0.66,
0.0667,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1713,
0.0046,
0,
0.66,
... | [
"\"\"\"Tests of dsplcheck module.\"\"\"",
"__author__ = 'Benjamin Yolken <yolken@google.com>'",
"import os",
"import os.path",
"import re",
"import shutil",
"import StringIO",
"import sys",
"import tempfile",
"import unittest",
"import zipfile",
"import dsplcheck",
"_DSPL_CONTENT = (\n\"\"\"... |
#!/usr/bin/python2.4
#
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | [
[
8,
0,
0.1641,
0.0051,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1795,
0.0051,
0,
0.66,
0.0667,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1897,
0.0051,
0,
0.66,... | [
"\"\"\"Check a DSPL dataset for likely import errors.\"\"\"",
"__author__ = 'Benjamin Yolken <yolken@google.com>'",
"import optparse",
"import os",
"import shutil",
"import sys",
"import tempfile",
"import time",
"import zipfile",
"from dspllib.model import dspl_model_loader",
"from dspllib.vali... |
#!/usr/bin/python2.4
#
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | [
[
8,
0,
0.256,
0.008,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.28,
0.008,
0,
0.66,
0.0714,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.296,
0.008,
0,
0.66,
0.... | [
"\"\"\"Tests of dsplgen module.\"\"\"",
"__author__ = 'Benjamin Yolken <yolken@google.com>'",
"import os",
"import os.path",
"import re",
"import shutil",
"import StringIO",
"import sys",
"import tempfile",
"import unittest",
"import dsplcheck",
"import dsplgen",
"_TEST_CSV_CONTENT = (\n\"\"... |
#!/usr/bin/python2.4
#
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | [
[
8,
0,
0.2581,
0.0081,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2823,
0.0081,
0,
0.66,
0.1,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2984,
0.0081,
0,
0.66,
... | [
"\"\"\"Generate a DSPL dataset from a tabular data source via the command-line.\"\"\"",
"__author__ = 'Benjamin Yolken <yolken@google.com>'",
"import optparse",
"import sys",
"import time",
"from dspllib.data_sources import csv_data_source",
"from dspllib.data_sources import csv_data_source_sqlite",
"... |
#!/usr/bin/python2.4
#
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | [
[
8,
0,
0.5926,
0.0185,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.6296,
0.0185,
0,
0.66,
0.5,
152,
0,
1,
0,
0,
152,
0,
0
],
[
8,
0,
0.8426,
0.3333,
0,
0.66,
... | [
"\"\"\"Setup script for the DSPLtools suite.\"\"\"",
"from distutils.core import setup",
"setup(name='dspltools',\n version='0.4.3',\n description='Suite of command-line tools for generating DSPL datasets',\n author='Benjamin Yolken',\n author_email='yolken@google.com',\n url='http://co... |
import os
import sys
from distutils.core import setup
from distutils.command.install import INSTALL_SCHEMES
#install data file in the same way as *.py
for scheme in INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']
def fullsplit(path, result=None):
"""
Split a pathname into components (the op... | [
[
1,
0,
0.0122,
0.0122,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0244,
0.0122,
0,
0.66,
0.1,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0366,
0.0122,
0,
0.6... | [
"import os",
"import sys",
"from distutils.core import setup",
"from distutils.command.install import INSTALL_SCHEMES",
"for scheme in INSTALL_SCHEMES.values():\n scheme['data'] = scheme['purelib']",
" scheme['data'] = scheme['purelib']",
"def fullsplit(path, result=None):\n \"\"\"\n Split a... |
import os
import sys
from distutils.core import setup
from distutils.command.install import INSTALL_SCHEMES
#install data file in the same way as *.py
for scheme in INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']
def fullsplit(path, result=None):
"""
Split a pathname into components (the op... | [
[
1,
0,
0.0122,
0.0122,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0244,
0.0122,
0,
0.66,
0.1,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0366,
0.0122,
0,
0.6... | [
"import os",
"import sys",
"from distutils.core import setup",
"from distutils.command.install import INSTALL_SCHEMES",
"for scheme in INSTALL_SCHEMES.values():\n scheme['data'] = scheme['purelib']",
" scheme['data'] = scheme['purelib']",
"def fullsplit(path, result=None):\n \"\"\"\n Split a... |
#!/usr/bin/env python
from bots import webserver
if __name__ == '__main__':
webserver.start()
| [
[
1,
0,
0.4,
0.2,
0,
0.66,
0,
261,
0,
1,
0,
0,
261,
0,
0
],
[
4,
0,
0.9,
0.4,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.2,
1,
0.14,
0,
511,
3,
... | [
"from bots import webserver",
"if __name__ == '__main__':\n webserver.start()",
" webserver.start()"
] |
import unittest
import bots.botsglobal as botsglobal
import bots.inmessage as inmessage
import bots.botslib as botslib
import bots.transform as transform
import pickle
import bots.botsinit as botsinit
import utilsunit
'''plugin unittranslateutils.zip '''
#as the max length is
class TestTranslate(unittest.TestCase):
... | [
[
1,
0,
0.0081,
0.0081,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0161,
0.0081,
0,
0.66,
0.1,
662,
0,
1,
0,
0,
662,
0,
0
],
[
1,
0,
0.0242,
0.0081,
0,
0.66,... | [
"import unittest",
"import bots.botsglobal as botsglobal",
"import bots.inmessage as inmessage",
"import bots.botslib as botslib",
"import bots.transform as transform",
"import pickle",
"import bots.botsinit as botsinit",
"import utilsunit",
"'''plugin unittranslateutils.zip '''",
"class TestTrans... |
import unittest
import filecmp
import glob
import shutil
import os
import subprocess
import logging
import utilsunit
import bots.botslib as botslib
import bots.botsinit as botsinit
import bots.botsglobal as botsglobal
from bots.botsconfig import *
'''
plugin unitconfirm.zip
before each run: clear transactions!
'''
b... | [
[
1,
0,
0.0052,
0.0052,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0105,
0.0052,
0,
0.66,
0.0833,
891,
0,
1,
0,
0,
891,
0,
0
],
[
1,
0,
0.0157,
0.0052,
0,
0.... | [
"import unittest",
"import filecmp",
"import glob",
"import shutil",
"import os",
"import subprocess",
"import logging",
"import utilsunit",
"import bots.botslib as botslib",
"import bots.botsinit as botsinit",
"import bots.botsglobal as botsglobal",
"from bots.botsconfig import *",
"class T... |
#!/usr/bin/env python
from bots import grammarcheck
if __name__=='__main__':
grammarcheck.start()
| [
[
1,
0,
0.4,
0.2,
0,
0.66,
0,
261,
0,
1,
0,
0,
261,
0,
0
],
[
4,
0,
0.9,
0.4,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.2,
1,
0.38,
0,
511,
3,
... | [
"from bots import grammarcheck",
"if __name__=='__main__':\n grammarcheck.start()",
" grammarcheck.start()"
] |
import os
import unittest
import shutil
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import filecmp
try:
import json as simplejson
except ImportError:
import simplejson
import bots.botslib as botslib
import bots.botsinit as botsinit
import utilsunit
''' pluging unitinisout.zip'''
c... | [
[
1,
0,
0.0067,
0.0067,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0133,
0.0067,
0,
0.66,
0.0667,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.02,
0.0067,
0,
0.66... | [
"import os",
"import unittest",
"import shutil",
"import bots.inmessage as inmessage",
"import bots.outmessage as outmessage",
"import filecmp",
"try:\n import json as simplejson\nexcept ImportError:\n import simplejson",
" import json as simplejson",
" import simplejson",
"import bots... |
import unittest
import bots.botslib as botslib
import bots.botsinit as botsinit
import bots.inmessage as inmessage
import bots.outmessage as outmessage
from bots.botsconfig import *
import utilsunit
''' plugin unitformats '''
#python 2.6 treats -0 different. in outmessage this is adapted, for inmessage: python 2.6 do... | [
[
1,
0,
0.001,
0.001,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0019,
0.001,
0,
0.66,
0.0833,
816,
0,
1,
0,
0,
816,
0,
0
],
[
1,
0,
0.0029,
0.001,
0,
0.66,
... | [
"import unittest",
"import bots.botslib as botslib",
"import bots.botsinit as botsinit",
"import bots.inmessage as inmessage",
"import bots.outmessage as outmessage",
"from bots.botsconfig import *",
"import utilsunit",
"''' plugin unitformats '''",
"testdummy={MPATH:'dummy for tests'}",
"class Te... |
import copy
import os
import glob
import bots.inmessage as inmessage
import bots.outmessage as outmessage
def comparenode(node1,node2org):
node2 = copy.deepcopy(node2org)
if node1.record is not None and node2.record is None:
print 'node2 is "None"'
return False
if node1.record is None and ... | [
[
1,
0,
0.0123,
0.0123,
0,
0.66,
0,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.0247,
0.0123,
0,
0.66,
0.0909,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.037,
0.0123,
0,
0... | [
"import copy",
"import os",
"import glob",
"import bots.inmessage as inmessage",
"import bots.outmessage as outmessage",
"def comparenode(node1,node2org):\n node2 = copy.deepcopy(node2org)\n if node1.record is not None and node2.record is None:\n print('node2 is \"None\"')\n return Fal... |
#constants/definitions for Bots
#to be used as from bots.config import *
#for statust in ta:
OPEN = 0 #Bots always closes transaction. OPEN is severe error
ERROR = 1 #error in transaction.
OK = 2 #successfull, result is 'save'. But processing has stopped: next step with error, or no next steps defined
DONE ... | [
[
14,
0,
0.0833,
0.0167,
0,
0.66,
0,
484,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.1,
0.0167,
0,
0.66,
0.0238,
88,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.1167,
0.0167,
0,
0.66,... | [
"OPEN = 0 #Bots always closes transaction. OPEN is severe error",
"ERROR = 1 #error in transaction.",
"OK = 2 #successfull, result is 'save'. But processing has stopped: next step with error, or no next steps defined",
"DONE = 3 #successfull, and result is picked up by next step",
"PROCESS =... |
"""
sef2bots.py
Command line params: sourcefile.sef targetfile.py
Optional command line params: -seq, -struct
Converts a SEF grammar into a Bots grammar. If targetfile exists (and is writeable),
it will be overwritten.
If -seq is specified, field names in record definitions will be
sequential (TAG01, TAG... | [
[
8,
0,
0.0375,
0.073,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0769,
0.002,
0,
0.66,
0.0333,
113,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.0789,
0.002,
0,
0.66,
... | [
"\"\"\"\nsef2bots.py\n\nCommand line params: sourcefile.sef targetfile.py\n\nOptional command line params: -seq, -struct\n\nConverts a SEF grammar into a Bots grammar. If targetfile exists (and is writeable),",
"MAXMAX = 99999 # for dealing with segs/groups with max '>1'",
"MAXLEN = 99999 # for overly large elm... |
#!/usr/bin/env python
import sys
import os
import logging
from logging.handlers import TimedRotatingFileHandler
from django.core.handlers.wsgi import WSGIHandler
from django.utils.translation import ugettext as _
import cherrypy
from cherrypy import wsgiserver
import botslib
import botsglobal
import botsinit
def showu... | [
[
1,
0,
0.0225,
0.0112,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0337,
0.0112,
0,
0.66,
0.0769,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0449,
0.0112,
0,
... | [
"import sys",
"import os",
"import logging",
"from logging.handlers import TimedRotatingFileHandler",
"from django.core.handlers.wsgi import WSGIHandler",
"from django.utils.translation import ugettext as _",
"import cherrypy",
"from cherrypy import wsgiserver",
"import botslib",
"import botsgloba... |
# Django settings for bots project.
import os
import bots
#*******settings for bots error reports**********************************
MANAGERS = ( #bots will send error reports to the MANAGERS
('name_manager', 'manager@domain.org'),
)
#~ EMAIL_HOST = 'smtp.gmail.com' #Default: 'localhost'
#~ EMAIL... | [
[
1,
0,
0.0146,
0.0073,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0219,
0.0073,
0,
0.66,
0.0286,
261,
0,
1,
0,
0,
261,
0,
0
],
[
14,
0,
0.0511,
0.0219,
0,
... | [
"import os",
"import bots",
"MANAGERS = ( #bots will send error reports to the MANAGERS\n ('name_manager', 'manager@domain.org'),\n )",
"PROJECT_PATH = os.path.abspath(os.path.dirname(bots.__file__))",
"MEDIA_ROOT = PROJECT_PATH + '/'",
"MEDIA_URL = ''",
"ADMIN_MEDIA_PREFIX = '/media/'",
"ROO... |
import time
import django
import models
import viewlib
import botslib
import botsglobal
django.contrib.admin.widgets.AdminSplitDateTime
HiddenInput = django.forms.widgets.HiddenInput
DEFAULT_ENTRY = ('',"---------")
editypelist=[DEFAULT_ENTRY] + sorted(models.EDITYPES)
confirmtypelist=[DEFAULT_ENTRY] + models.CONFIRMTY... | [
[
1,
0,
0.0046,
0.0046,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0093,
0.0046,
0,
0.66,
0.0294,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0139,
0.0046,
0,
... | [
"import time",
"import django",
"import models",
"import viewlib",
"import botslib",
"import botsglobal",
"django.contrib.admin.widgets.AdminSplitDateTime",
"HiddenInput = django.forms.widgets.HiddenInput",
"DEFAULT_ENTRY = ('',\"---------\")",
"editypelist=[DEFAULT_ENTRY] + sorted(models.EDITYPES... |
from django.utils.translation import ugettext as _
#bots-modules
import botslib
import node
from botsconfig import *
class Message(object):
''' abstract class; represents a edi message.
is subclassed as outmessage or inmessage object.
'''
def __init__(self):
self.recordnumber=0 ... | [
[
1,
0,
0.0043,
0.0043,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.013,
0.0043,
0,
0.66,
0.25,
484,
0,
1,
0,
0,
484,
0,
0
],
[
1,
0,
0.0173,
0.0043,
0,
0.6... | [
"from django.utils.translation import ugettext as _",
"import botslib",
"import node",
"from botsconfig import *",
"class Message(object):\n ''' abstract class; represents a edi message.\n is subclassed as outmessage or inmessage object.\n '''\n def __init__(self):\n self.recordnumber... |
import os
import re
import zipfile
from django.utils.translation import ugettext as _
#bots-modules
import botslib
import botsglobal
from botsconfig import *
@botslib.log_session
def preprocess(routedict,function, status=FILEIN,**argv):
''' for pre- and postprocessing of files.
these are NOT translations; ... | [
[
1,
0,
0.0031,
0.0031,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0061,
0.0031,
0,
0.66,
0.0833,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0092,
0.0031,
0,
... | [
"import os",
"import re",
"import zipfile",
"from django.utils.translation import ugettext as _",
"import botslib",
"import botsglobal",
"from botsconfig import *",
"def preprocess(routedict,function, status=FILEIN,**argv):\n ''' for pre- and postprocessing of files.\n these are NOT translat... |
#bots modules
import botslib
import botsglobal
from botsconfig import *
from django.utils.translation import ugettext as _
tavars = 'idta,statust,divtext,child,ts,filename,status,idroute,fromchannel,tochannel,frompartner,topartner,frommail,tomail,contenttype,nrmessages,editype,messagetype,errortext,script'
def evalua... | [
[
1,
0,
0.0049,
0.0025,
0,
0.66,
0,
484,
0,
1,
0,
0,
484,
0,
0
],
[
1,
0,
0.0074,
0.0025,
0,
0.66,
0.0909,
261,
0,
1,
0,
0,
261,
0,
0
],
[
1,
0,
0.0099,
0.0025,
0,
... | [
"import botslib",
"import botsglobal",
"from botsconfig import *",
"from django.utils.translation import ugettext as _",
"tavars = 'idta,statust,divtext,child,ts,filename,status,idroute,fromchannel,tochannel,frompartner,topartner,frommail,tomail,contenttype,nrmessages,editype,messagetype,errortext,script'",... |
'''module contains the functions to be called from user scripts'''
try:
import cPickle as pickle
except:
import pickle
import copy
import collections
from django.utils.translation import ugettext as _
#bots-modules
import botslib
import botsglobal
import inmessage
import outmessage
from botsconfig import *
#**... | [
[
8,
0,
0.0026,
0.0026,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.009,
0.0103,
0,
0.66,
0.025,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0078,
0.0026,
1,
0.22,
... | [
"'''module contains the functions to be called from user scripts'''",
"try:\n import cPickle as pickle\nexcept:\n import pickle",
" import cPickle as pickle",
" import pickle",
"import copy",
"import collections",
"from django.utils.translation import ugettext as _",
"import botslib",
"i... |
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext as _
'''
django is not excellent in generating db. But they have provided a way to customize the generated database using SQL. see bots/sql/*.
'''
STATUST = [
(0, _(u'Open')),
(1, _(u'Error')),
(2, _(u'... | [
[
1,
0,
0.0023,
0.0023,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0046,
0.0023,
0,
0.66,
0.037,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0068,
0.0023,
0,
0.6... | [
"from datetime import datetime",
"from django.db import models",
"from django.utils.translation import ugettext as _",
"'''\ndjango is not excellent in generating db. But they have provided a way to customize the generated database using SQL. see bots/sql/*.\n'''",
"STATUST = [\n (0, _(u'Open')),\n (1... |
#!/usr/bin/env python
import os
import optparse
import subprocess
import sys
here = os.path.dirname(__file__)
def main():
usage = "usage: %prog [file1..fileN]"
description = """With no file paths given this script will automatically
compress all jQuery-based files of the admin app. Requires the Google Closure... | [
[
1,
0,
0.0426,
0.0213,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0638,
0.0213,
0,
0.66,
0.1667,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0851,
0.0213,
0,
... | [
"import os",
"import optparse",
"import subprocess",
"import sys",
"here = os.path.dirname(__file__)",
"def main():\n usage = \"usage: %prog [file1..fileN]\"\n description = \"\"\"With no file paths given this script will automatically\ncompress all jQuery-based files of the admin app. Requires the ... |
#!/usr/bin/env python
import os
import optparse
import subprocess
import sys
here = os.path.dirname(__file__)
def main():
usage = "usage: %prog [file1..fileN]"
description = """With no file paths given this script will automatically
compress all jQuery-based files of the admin app. Requires the Google Closure... | [
[
1,
0,
0.0426,
0.0213,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0638,
0.0213,
0,
0.66,
0.1667,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0851,
0.0213,
0,
... | [
"import os",
"import optparse",
"import subprocess",
"import sys",
"here = os.path.dirname(__file__)",
"def main():\n usage = \"usage: %prog [file1..fileN]\"\n description = \"\"\"With no file paths given this script will automatically\ncompress all jQuery-based files of the admin app. Requires the ... |
''' Base library for bots. Botslib should not import from other Bots-modules.'''
import sys
import os
import codecs
import traceback
import subprocess
import socket #to set a time-out for connections
import string
import urlparse
import urllib
import platform
import django
from django.utils.translation import ugettex... | [
[
8,
0,
0.0013,
0.0013,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0025,
0.0013,
0,
0.66,
0.0116,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0038,
0.0013,
0,
0.66... | [
"''' Base library for bots. Botslib should not import from other Bots-modules.'''",
"import sys",
"import os",
"import codecs",
"import traceback",
"import subprocess",
"import socket #to set a time-out for connections",
"import string",
"import urlparse",
"import urllib",
"import platform",
... |
""" Python Character Mapping Codec generated from CP1252.TXT with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
Adapted by Henk-Jan Ebbers for Bots open source EDI translator
Regular UNOB: UNOB char, CR, LF and... | [
[
8,
0,
0.0291,
0.0529,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0635,
0.0053,
0,
0.66,
0.1,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0688,
0.0053,
0,
0.66,
... | [
"\"\"\" Python Character Mapping Codec generated from CP1252.TXT with gencodec.py.\n\nWritten by Marc-Andre Lemburg (mal@lemburg.com).\n\n(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\n(c) Copyright 2000 Guido van Rossum.\n\nAdapted by Henk-Jan Ebbers for Bots open source EDI translator",
"import codecs",... |
""" Python Character Mapping Codec generated from CP1252.TXT with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
Adapted by Henk-Jan Ebbers for Bots open source EDI translator
Regular UNOA: UNOA char, CR, LF and... | [
[
8,
0,
0.0291,
0.0529,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0635,
0.0053,
0,
0.66,
0.1,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0688,
0.0053,
0,
0.66,
... | [
"\"\"\" Python Character Mapping Codec generated from CP1252.TXT with gencodec.py.\n\nWritten by Marc-Andre Lemburg (mal@lemburg.com).\n\n(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\n(c) Copyright 2000 Guido van Rossum.\n\nAdapted by Henk-Jan Ebbers for Bots open source EDI translator",
"import codecs",... |
codeconversions = {
'351':'AAK',
'35E':'AAK',
'220':'ON',
'224':'ON',
'50E':'ON',
'83':'IV',
'380':'IV',
'384':'IV',
'TESTIN':'TESTOUT',
}
| [
[
14,
0,
0.5455,
1,
0,
0.66,
0,
543,
0,
0,
0,
0,
0,
6,
0
]
] | [
"codeconversions = {\n'351':'AAK',\n'35E':'AAK',\n'220':'ON',\n'224':'ON',\n'50E':'ON',\n'83':'IV',\n'380':'IV',"
] |
import time
import sys
try:
import cPickle as pickle
except:
import pickle
import decimal
NODECIMAL = decimal.Decimal(1)
try:
import cElementTree as ET
#~ print 'imported cElementTree'
except ImportError:
try:
import elementtree.ElementTree as ET
#~ print 'imported elementtree.Elemen... | [
[
1,
0,
0.0012,
0.0012,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0025,
0.0012,
0,
0.66,
0.0312,
509,
0,
1,
0,
0,
509,
0,
0
],
[
7,
0,
0.0056,
0.005,
0,
0... | [
"import time",
"import sys",
"try:\n import cPickle as pickle\nexcept:\n import pickle",
" import cPickle as pickle",
" import pickle",
"import decimal",
"NODECIMAL = decimal.Decimal(1)",
"try:\n import cElementTree as ET\n #~ print 'imported cElementTree'\nexcept ImportError:\n t... |
from django.conf.urls.defaults import *
from django.contrib import admin,auth
from django.views.generic.simple import redirect_to
from django.contrib.auth.decorators import login_required,user_passes_test
from bots import views
admin.autodiscover()
staff_required = user_passes_test(lambda u: u.is_staff)
superuser_requ... | [
[
1,
0,
0.025,
0.025,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.05,
0.025,
0,
0.66,
0.1111,
302,
0,
2,
0,
0,
302,
0,
0
],
[
1,
0,
0.075,
0.025,
0,
0.66,
... | [
"from django.conf.urls.defaults import *",
"from django.contrib import admin,auth",
"from django.views.generic.simple import redirect_to",
"from django.contrib.auth.decorators import login_required,user_passes_test",
"from bots import views",
"admin.autodiscover()",
"staff_required = user_passes_test(la... |
from django import template
register = template.Library()
@register.filter
def url2path(value):
if value.startswith('/admin/bots/'):
value = value[12:]
else:
value = value[1:]
if value:
if value[-1] == '/':
value = value[:-1]
else:
value = 'home'
return ... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.1765,
0.0588,
0,
0.66,
0.5,
276,
3,
0,
0,
0,
77,
10,
1
],
[
2,
0,
0.6471,
0.6471,
0,
0.... | [
"from django import template",
"register = template.Library()",
"def url2path(value):\n if value.startswith('/admin/bots/'):\n value = value[12:]\n else:\n value = value[1:]\n if value:\n if value[-1] == '/':\n value = value[:-1]",
" if value.startswith('/admin/bots... |
import sys
from django.utils.translation import ugettext as _
#bots-modules
import communication
import envelope
import transform
import botslib
import botsglobal
import preprocess
from botsconfig import *
@botslib.log_session
def prepareretransmit():
''' prepare the retransmittable files. Return: indication if fi... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0075,
0.0037,
0,
0.66,
0.0714,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0149,
0.0037,
0,
... | [
"import sys",
"from django.utils.translation import ugettext as _",
"import communication",
"import envelope",
"import transform",
"import botslib",
"import botsglobal",
"import preprocess",
"from botsconfig import *",
"def prepareretransmit():\n ''' prepare the retransmittable files. Return: i... |
import sys
import os
import botsinit
import botslib
import grammar
def showusage():
print
print " Usage: %s -c<directory> <editype> <messagetype>"%os.path.basename(sys.argv[0])
print
print " Checks a Bots grammar."
print " Same checks are used as in translations with bots-engine."
pr... | [
[
1,
0,
0.0132,
0.0132,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0263,
0.0132,
0,
0.66,
0.125,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0395,
0.0132,
0,
0... | [
"import sys",
"import os",
"import botsinit",
"import botslib",
"import grammar",
"def showusage():\n print(\" Same checks are used as in translations with bots-engine.\")\n print(\" Searches for grammar in regular place: bots/usersys/grammars/<editype>/<messagetype>.py\")\n print(\" Opt... |
import os
import sys
import atexit
import traceback
import logging
#import bots-modules
import bots.botslib as botslib
import bots.botsglobal as botsglobal
def showusage():
print ' Update existing bots database for new release 1.6.0'
print ' Options:'
print " -c<directory> directory for conf... | [
[
1,
0,
0.0096,
0.0096,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0192,
0.0096,
0,
0.66,
0.125,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0288,
0.0096,
0,
0... | [
"import os",
"import sys",
"import atexit",
"import traceback",
"import logging",
"import bots.botslib as botslib",
"import bots.botsglobal as botsglobal",
"def showusage():\n print(' Update existing bots database for new release 1.6.0')\n print(' Options:')\n print(\" -c<directo... |
import decimal
import copy
from django.utils.translation import ugettext as _
import botslib
import botsglobal
from botsconfig import *
comparekey=None
def nodecompare(node):
global comparekey
return node.get(*comparekey)
class Node(object):
''' Node class for building trees in inmessage and outmessage
... | [
[
1,
0,
0.0021,
0.0021,
0,
0.66,
0,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.0042,
0.0021,
0,
0.66,
0.125,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.0063,
0.0021,
0,
0... | [
"import decimal",
"import copy",
"from django.utils.translation import ugettext as _",
"import botslib",
"import botsglobal",
"from botsconfig import *",
"comparekey=None",
"def nodecompare(node):\n global comparekey\n return node.get(*comparekey)",
" return node.get(*comparekey)",
"class... |
import django
from django.contrib import admin
from django.utils.translation import ugettext as _
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.contrib.admin.util import unquote, flatten_fieldsets, get_deleted_objects, model_ngettext, model_format_dict
from django.core.exceptions impor... | [
[
1,
0,
0.005,
0.005,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0101,
0.005,
0,
0.66,
0.027,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0151,
0.005,
0,
0.66,... | [
"import django",
"from django.contrib import admin",
"from django.utils.translation import ugettext as _",
"from django.http import Http404, HttpResponse, HttpResponseRedirect",
"from django.contrib.admin.util import unquote, flatten_fieldsets, get_deleted_objects, model_ngettext, model_format_dict",
"fro... |
import sys
import os
import encodings
import codecs
import ConfigParser
import logging, logging.handlers
from django.utils.translation import ugettext as _
#Bots-modules
from botsconfig import *
import botsglobal
import botslib
class BotsConfig(ConfigParser.SafeConfigParser):
''' See SafeConfigParser.... | [
[
1,
0,
0.0051,
0.0051,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0102,
0.0051,
0,
0.66,
0.0625,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0153,
0.0051,
0,
... | [
"import sys",
"import os",
"import encodings",
"import codecs",
"import ConfigParser",
"import logging, logging.handlers",
"from django.utils.translation import ugettext as _",
"from botsconfig import *",
"import botsglobal",
"import botslib",
"class BotsConfig(ConfigParser.SafeConfigParser):\n ... |
import shutil
import time
from django.utils.translation import ugettext as _
#bots-modules
import botslib
import botsglobal
import grammar
import outmessage
from botsconfig import *
@botslib.log_session
def mergemessages(startstatus=TRANSLATED,endstatus=MERGED,idroute=''):
''' Merges en envelopes several messages ... | [
[
1,
0,
0.0019,
0.0019,
0,
0.66,
0,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0039,
0.0019,
0,
0.66,
0.037,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0058,
0.0019,
0,
0... | [
"import shutil",
"import time",
"from django.utils.translation import ugettext as _",
"import botslib",
"import botsglobal",
"import grammar",
"import outmessage",
"from botsconfig import *",
"def mergemessages(startstatus=TRANSLATED,endstatus=MERGED,idroute=''):\n ''' Merges en envelopes several... |
# Django settings for bots project.
import os
import bots
#*******settings for bots error reports**********************************
MANAGERS = ( #bots will send error reports to the MANAGERS
('name_manager', 'manager@domain.org'),
)
#~ EMAIL_HOST = 'smtp.gmail.com' #Default: 'localhost'
#~ EMAIL... | [
[
1,
0,
0.0146,
0.0073,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0219,
0.0073,
0,
0.66,
0.0286,
261,
0,
1,
0,
0,
261,
0,
0
],
[
14,
0,
0.0511,
0.0219,
0,
... | [
"import os",
"import bots",
"MANAGERS = ( #bots will send error reports to the MANAGERS\n ('name_manager', 'manager@domain.org'),\n )",
"PROJECT_PATH = os.path.abspath(os.path.dirname(bots.__file__))",
"MEDIA_ROOT = PROJECT_PATH + '/'",
"MEDIA_URL = ''",
"ADMIN_MEDIA_PREFIX = '/media/'",
"ROO... |
'''
code found at code.djangoproject.com/ticket/3777
'''
from django import http
class FilterPersistMiddleware(object):
def _get_default(self, key):
""" Gets any set default filters for the admin. Returns None if no
default is set. """
default = None
#~ default = settings.ADM... | [
[
8,
0,
0.025,
0.0375,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.05,
0.0125,
0,
0.66,
0.3333,
294,
0,
1,
0,
0,
294,
0,
0
],
[
3,
0,
0.4188,
0.675,
0,
0.66,
... | [
"'''\ncode found at code.djangoproject.com/ticket/3777\n'''",
"from django import http",
"class FilterPersistMiddleware(object):\n\n def _get_default(self, key):\n \"\"\" Gets any set default filters for the admin. Returns None if no \n default is set. \"\"\"\n default = None\n ... |
try:
from pysqlite2 import dbapi2 as sqlite #prefer external modules for pylite
except ImportError:
import sqlite3 as sqlite #works OK for python26
#~ #bots engine uses:
#~ ''' SELECT *
#~ FROM ta
#~ WHERE idta=%(idta)s ''',
#~ {'idta':12345})
#~ #SQLite wants:
#~ ''' SELECT *
#~ FROM ta... | [
[
7,
0,
0.0472,
0.0755,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0377,
0.0189,
1,
0.11,
0,
987,
0,
1,
0,
0,
987,
0,
0
],
[
1,
1,
0.0755,
0.0189,
1,
0.11,
... | [
"try:\n from pysqlite2 import dbapi2 as sqlite #prefer external modules for pylite\nexcept ImportError:\n import sqlite3 as sqlite #works OK for python26",
" from pysqlite2 import dbapi2 as sqlite #prefer external modules for pylite",
" import sqlite3 as sqlite #works OK for python26",
"im... |
''' Reading/lexing/parsing/splitting an edifile.'''
import StringIO
import time
import sys
try:
import cPickle as pickle
except:
import pickle
try:
import cElementTree as ET
except ImportError:
try:
import elementtree.ElementTree as ET
except ImportError:
try:
from xml.et... | [
[
8,
0,
0.0009,
0.0009,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0017,
0.0009,
0,
0.66,
0.0323,
609,
0,
1,
0,
0,
609,
0,
0
],
[
1,
0,
0.0026,
0.0009,
0,
0.66... | [
"''' Reading/lexing/parsing/splitting an edifile.'''",
"import StringIO",
"import time",
"import sys",
"try:\n import cPickle as pickle\nexcept:\n import pickle",
" import cPickle as pickle",
" import pickle",
"try:\n import cElementTree as ET\nexcept ImportError:\n try:\n imp... |
import copy
from django.utils.translation import ugettext as _
import botslib
import botsglobal
from botsconfig import *
def grammarread(editype,grammarname):
''' dispatch function for class Grammar or subclass
read whole grammar
'''
try:
classtocall = globals()[editype]
except KeyError... | [
[
1,
0,
0.0012,
0.0012,
0,
0.66,
0,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.0023,
0.0012,
0,
0.66,
0.0476,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0035,
0.0012,
0,
... | [
"import copy",
"from django.utils.translation import ugettext as _",
"import botslib",
"import botsglobal",
"from botsconfig import *",
"def grammarread(editype,grammarname):\n ''' dispatch function for class Grammar or subclass\n read whole grammar\n '''\n try:\n classtocall = glob... |
import os
import glob
import time
import datetime
import stat
import shutil
from django.utils.translation import ugettext as _
#bots modules
import botslib
import botsglobal
from botsconfig import *
def cleanup():
''' public function, does all cleanup of the database and file system.'''
try:
_cleanups... | [
[
1,
0,
0.008,
0.008,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.016,
0.008,
0,
0.66,
0.0625,
958,
0,
1,
0,
0,
958,
0,
0
],
[
1,
0,
0.024,
0.008,
0,
0.66,
... | [
"import os",
"import glob",
"import time",
"import datetime",
"import stat",
"import shutil",
"from django.utils.translation import ugettext as _",
"import botslib",
"import botsglobal",
"from botsconfig import *",
"def cleanup():\n ''' public function, does all cleanup of the database and fi... |
#Globals used by Bots
incommunicate = False #used to set all incommunication off
db = None #db-object
ini = None #ini-file-object that is read (bots.ini)
routeid = '' #current route. This is used to set routeid for Processes.
preprocessnumber = 0 #different preprocessnumbers ... | [
[
14,
0,
0.2222,
0.1111,
0,
0.66,
0,
483,
1,
0,
0,
0,
0,
4,
0
],
[
14,
0,
0.3333,
0.1111,
0,
0.66,
0.1667,
761,
1,
0,
0,
0,
0,
9,
0
],
[
14,
0,
0.4444,
0.1111,
0,
0... | [
"incommunicate = False #used to set all incommunication off",
"db = None #db-object",
"ini = None #ini-file-object that is read (bots.ini)",
"routeid = '' #current route. This is used to set routeid for Processes.",
"preprocessnumber = 0 #different preprocessnumbe... |
#!/usr/bin/env python
from bots import xml2botsgrammar
if __name__=='__main__':
xml2botsgrammar.start()
| [
[
1,
0,
0.4,
0.2,
0,
0.66,
0,
261,
0,
1,
0,
0,
261,
0,
0
],
[
4,
0,
0.9,
0.4,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.2,
1,
0.53,
0,
511,
3,
... | [
"from bots import xml2botsgrammar",
"if __name__=='__main__':\n xml2botsgrammar.start()",
" xml2botsgrammar.start()"
] |
import os
import unittest
import shutil
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import filecmp
try:
import json as simplejson
except ImportError:
import simplejson
import bots.botslib as botslib
import bots.botsinit as botsinit
import utilsunit
try:
import cElementTree as ET... | [
[
1,
0,
0.004,
0.004,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.008,
0.004,
0,
0.66,
0.0769,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.012,
0.004,
0,
0.66,
... | [
"import os",
"import unittest",
"import shutil",
"import bots.inmessage as inmessage",
"import bots.outmessage as outmessage",
"import filecmp",
"try:\n import json as simplejson\nexcept ImportError:\n import simplejson",
" import json as simplejson",
" import simplejson",
"import bots... |
import os
import unittest
import shutil
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import filecmp
import bots.botslib as botslib
import bots.botsinit as botsinit
import utilsunit
''' pluging unitinmessagexml.zip'''
class TestInmessage(unittest.TestCase):
''' Read messages; some shoul... | [
[
1,
0,
0.0036,
0.0036,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0073,
0.0036,
0,
0.66,
0.0833,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0109,
0.0036,
0,
0.... | [
"import os",
"import unittest",
"import shutil",
"import bots.inmessage as inmessage",
"import bots.outmessage as outmessage",
"import filecmp",
"import bots.botslib as botslib",
"import bots.botsinit as botsinit",
"import utilsunit",
"''' pluging unitinmessagexml.zip'''",
"class TestInmessage(u... |
import os
import unittest
import shutil
import filecmp
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import bots.botslib as botslib
import bots.botsinit as botsinit
'''plugin unitnode.zip'''
class Testnode(unittest.TestCase):
''' test node.py and message.py.
'''
def testedifact0... | [
[
1,
0,
0.0075,
0.0075,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.015,
0.0075,
0,
0.66,
0.1,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0226,
0.0075,
0,
0.66,
... | [
"import os",
"import unittest",
"import shutil",
"import filecmp",
"import bots.inmessage as inmessage",
"import bots.outmessage as outmessage",
"import bots.botslib as botslib",
"import bots.botsinit as botsinit",
"'''plugin unitnode.zip'''",
"class Testnode(unittest.TestCase):\n ''' test node... |
#!/usr/bin/env python
if __name__ == '__main__':
import cProfile
cProfile.run('from bots import engine; engine.start()','profile.tmp')
import pstats
p = pstats.Stats('profile.tmp')
#~ p.sort_stats('cumulative').print_stats(25)
p.sort_stats('time').print_stats(25)
#~ p.print_callees('deepcop... | [
[
4,
0,
0.5,
0.6429,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
5
],
[
1,
1,
0.2857,
0.0714,
1,
0.01,
0,
686,
0,
1,
0,
0,
686,
0,
0
],
[
8,
1,
0.3571,
0.0714,
1,
0.01,
0.... | [
"if __name__ == '__main__':\n import cProfile\n cProfile.run('from bots import engine; engine.start()','profile.tmp')\n import pstats\n p = pstats.Stats('profile.tmp')\n #~ p.sort_stats('cumulative').print_stats(25)\n p.sort_stats('time').print_stats(25)\n #~ p.print_callees('deepcopy').print_s... |
import unittest
import bots.inmessage as inmessage
import bots.botslib as botslib
import bots.botsinit as botsinit
import utilsunit
'''plugin unitinmessageedifact.zip'''
class TestInmessage(unittest.TestCase):
def testEdifact0401(self):
''' 0401 Errors in records'''
self.assertRaises(botslib.InMe... | [
[
1,
0,
0.0115,
0.0115,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.023,
0.0115,
0,
0.66,
0.1429,
855,
0,
1,
0,
0,
855,
0,
0
],
[
1,
0,
0.0345,
0.0115,
0,
0.6... | [
"import unittest",
"import bots.inmessage as inmessage",
"import bots.botslib as botslib",
"import bots.botsinit as botsinit",
"import utilsunit",
"'''plugin unitinmessageedifact.zip'''",
"class TestInmessage(unittest.TestCase):\n def testEdifact0401(self):\n ''' 0401\tErrors in records'''\n ... |
import filecmp
import glob
import shutil
import os
import sys
import subprocess
import logging
import logging
import bots.botslib as botslib
import bots.botsinit as botsinit
import bots.botsglobal as botsglobal
from bots.botsconfig import *
'''plugin unitretry.zip'''
#!!!activate rotues
''' input: mime (complex struc... | [
[
1,
0,
0.0081,
0.0081,
0,
0.66,
0,
891,
0,
1,
0,
0,
891,
0,
0
],
[
1,
0,
0.0161,
0.0081,
0,
0.66,
0.0556,
958,
0,
1,
0,
0,
958,
0,
0
],
[
1,
0,
0.0242,
0.0081,
0,
... | [
"import filecmp",
"import glob",
"import shutil",
"import os",
"import sys",
"import subprocess",
"import logging",
"import logging",
"import bots.botslib as botslib",
"import bots.botsinit as botsinit",
"import bots.botsglobal as botsglobal",
"from bots.botsconfig import *",
"'''plugin unit... |
import unittest
import bots.botslib as botslib
import bots.botsinit as botsinit
import bots.grammar as grammar
import bots.inmessage as inmessage
import bots.outmessage as outmessage
import utilsunit
''' plugin unitgrammar.zip '''
class TestGrammar(unittest.TestCase):
def testgeneralgrammarerrors(self):
... | [
[
1,
0,
0.0044,
0.0044,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0088,
0.0044,
0,
0.66,
0.1111,
816,
0,
1,
0,
0,
816,
0,
0
],
[
1,
0,
0.0132,
0.0044,
0,
0.... | [
"import unittest",
"import bots.botslib as botslib",
"import bots.botsinit as botsinit",
"import bots.grammar as grammar",
"import bots.inmessage as inmessage",
"import bots.outmessage as outmessage",
"import utilsunit",
"''' plugin unitgrammar.zip '''",
"class TestGrammar(unittest.TestCase):\n\n ... |
#!/usr/bin/env python
from bots import engine
if __name__ == '__main__':
engine.start()
| [
[
1,
0,
0.4,
0.2,
0,
0.66,
0,
261,
0,
1,
0,
0,
261,
0,
0
],
[
4,
0,
0.9,
0.4,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.2,
1,
0.21,
0,
511,
3,
... | [
"from bots import engine",
"if __name__ == '__main__':\n engine.start()",
" engine.start()"
] |
import sys
import os
import tarfile
import glob
import shutil
import subprocess
import traceback
import bots.botsglobal as botsglobal
def join(path,*paths):
return os.path.normpath(os.path.join(path,*paths))
#******************************************************************************
#*** start ... | [
[
1,
0,
0.0323,
0.0323,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0645,
0.0323,
0,
0.66,
0.1111,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0968,
0.0323,
0,
... | [
"import sys",
"import os",
"import tarfile",
"import glob",
"import shutil",
"import subprocess",
"import traceback",
"import bots.botsglobal as botsglobal",
"def join(path,*paths):\n return os.path.normpath(os.path.join(path,*paths))",
" return os.path.normpath(os.path.join(path,*paths))",
... |
import os
import sys
from distutils.core import setup
def fullsplit(path, result=None):
"""
Split a pathname into components (the opposite of os.path.join) in a
platform-neutral way.
"""
if result is None:
result = []
head, tail = os.path.split(path)
if head == '':
ret... | [
[
1,
0,
0.0122,
0.0122,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0244,
0.0122,
0,
0.66,
0.1111,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0366,
0.0122,
0,
... | [
"import os",
"import sys",
"from distutils.core import setup",
"def fullsplit(path, result=None):\n \"\"\"\n Split a pathname into components (the opposite of os.path.join) in a\n platform-neutral way.\n \"\"\"\n if result is None:\n result = []\n head, tail = os.path.split(path)",
... |
'''
Module which prompts the user for translations and saves them.
TODO: implement
@author: Rodrigo Damazio
'''
class Translator(object):
'''
classdocs
'''
def __init__(self, language):
'''
Constructor
'''
self._language = language
def Translate(self, string_names):
print string_names | [
[
8,
0,
0.1905,
0.3333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.7143,
0.619,
0,
0.66,
1,
229,
0,
2,
0,
0,
186,
0,
1
],
[
8,
1,
0.5238,
0.1429,
1,
0.2,
0... | [
"'''\nModule which prompts the user for translations and saves them.\n\nTODO: implement\n\n@author: Rodrigo Damazio\n'''",
"class Translator(object):\n '''\n classdocs\n '''\n\n def __init__(self, language):\n '''\n Constructor",
" '''\n classdocs\n '''",
" def __init__(self, language):\n '''... |
'''
Module which brings history information about files from Mercurial.
@author: Rodrigo Damazio
'''
import re
import subprocess
REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')
def _GetOutputLines(args):
'''
Runs an external process and returns its output as a list of lines.
@param args: the argume... | [
[
8,
0,
0.0319,
0.0532,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0745,
0.0106,
0,
0.66,
0.1429,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0851,
0.0106,
0,
0.66... | [
"'''\nModule which brings history information about files from Mercurial.\n\n@author: Rodrigo Damazio\n'''",
"import re",
"import subprocess",
"REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')",
"def _GetOutputLines(args):\n '''\n Runs an external process and returns its output as a list of lines... |
'''
Module which parses a string XML file.
@author: Rodrigo Damazio
'''
from xml.parsers.expat import ParserCreate
import re
#import xml.etree.ElementTree as ET
class StringsParser(object):
'''
Parser for string XML files.
This object is not thread-safe and should be used for parsing a single file at
a time... | [
[
8,
0,
0.0261,
0.0435,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0609,
0.0087,
0,
0.66,
0.3333,
573,
0,
1,
0,
0,
573,
0,
0
],
[
1,
0,
0.0696,
0.0087,
0,
0.66... | [
"'''\nModule which parses a string XML file.\n\n@author: Rodrigo Damazio\n'''",
"from xml.parsers.expat import ParserCreate",
"import re",
"class StringsParser(object):\n '''\n Parser for string XML files.\n\n This object is not thread-safe and should be used for parsing a single file at\n a time, only.\n... |
#!/usr/bin/python
'''
Entry point for My Tracks i18n tool.
@author: Rodrigo Damazio
'''
import mytracks.files
import mytracks.translate
import mytracks.validate
import sys
def Usage():
print 'Usage: %s <command> [<language> ...]\n' % sys.argv[0]
print 'Commands are:'
print ' cleanup'
print ' translate'
p... | [
[
8,
0,
0.0417,
0.0521,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0104,
0,
0.66,
0.125,
640,
0,
1,
0,
0,
640,
0,
0
],
[
1,
0,
0.0938,
0.0104,
0,
0.66,... | [
"'''\nEntry point for My Tracks i18n tool.\n\n@author: Rodrigo Damazio\n'''",
"import mytracks.files",
"import mytracks.translate",
"import mytracks.validate",
"import sys",
"def Usage():\n print('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])\n print('Commands are:')\n print(' cleanup')\n p... |
'''
Module which compares languague files to the master file and detects
issues.
@author: Rodrigo Damazio
'''
import os
from mytracks.parser import StringsParser
import mytracks.history
class Validator(object):
def __init__(self, languages):
'''
Builds a strings file validator.
Params:
@para... | [
[
8,
0,
0.0304,
0.0522,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0696,
0.0087,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0783,
0.0087,
0,
0.66,
... | [
"'''\nModule which compares languague files to the master file and detects\nissues.\n\n@author: Rodrigo Damazio\n'''",
"import os",
"from mytracks.parser import StringsParser",
"import mytracks.history",
"class Validator(object):\n\n def __init__(self, languages):\n '''\n Builds a strings file valida... |
'''
Module for dealing with resource files (but not their contents).
@author: Rodrigo Damazio
'''
import os.path
from glob import glob
import re
MYTRACKS_RES_DIR = 'MyTracks/res'
ANDROID_MASTER_VALUES = 'values'
ANDROID_VALUES_MASK = 'values-*'
def GetMyTracksDir():
'''
Returns the directory in which the MyTrac... | [
[
8,
0,
0.0667,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1333,
0.0222,
0,
0.66,
0.125,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.1556,
0.0222,
0,
0.66,
... | [
"'''\nModule for dealing with resource files (but not their contents).\n\n@author: Rodrigo Damazio\n'''",
"import os.path",
"from glob import glob",
"import re",
"MYTRACKS_RES_DIR = 'MyTracks/res'",
"ANDROID_MASTER_VALUES = 'values'",
"ANDROID_VALUES_MASK = 'values-*'",
"def GetMyTracksDir():\n '''\n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.