code
stringlengths
1
1.72M
language
stringclasses
1 value
# -*- coding: utf-8 -*- # # Copyright (C) 2008-2009 Christopher Lenz # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. """Utility code for managing design documents.""" from copy import deepcopy from inspect import get...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you ...
Python
#!/usr/bin/python2.6 # # Simple http server to emulate api.playfoursquare.com import logging import shutil import sys import urlparse import SimpleHTTPServer import BaseHTTPServer class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): """Handle playfoursquare.com requests, for testing.""" def do_GET(self...
Python
#!/usr/bin/python import os import subprocess import sys BASEDIR = '../main/src/com/joelapenna/foursquare' TYPESDIR = '../captures/types/v1' captures = sys.argv[1:] if not captures: captures = os.listdir(TYPESDIR) for f in captures: basename = f.split('.')[0] javaname = ''.join([c.capitalize() for c in basena...
Python
#!/usr/bin/python """ Pull a oAuth protected page from foursquare. Expects ~/.oget to contain (one on each line): CONSUMER_KEY CONSUMER_KEY_SECRET USERNAME PASSWORD Don't forget to chmod 600 the file! """ import httplib import os import re import sys import urllib import urllib2 import urlparse import user from xml....
Python
#!/usr/bin/python import datetime import sys import textwrap import common from xml.dom import pulldom PARSER = """\ /** * Copyright 2009 Joe LaPenna */ package com.joelapenna.foursquare.parsers; import com.joelapenna.foursquare.Foursquare; import com.joelapenna.foursquare.error.FoursquareError; import com.joel...
Python
#!/usr/bin/python import logging from xml.dom import minidom from xml.dom import pulldom BOOLEAN = "boolean" STRING = "String" GROUP = "Group" # Interfaces that all FoursquareTypes implement. DEFAULT_INTERFACES = ['FoursquareType'] # Interfaces that specific FoursqureTypes implement. INTERFACES = { } DEFAULT_CLA...
Python
#!/usr/bin/env python import time t = time.time() u = time.gmtime(t) s = time.strftime('%a, %e %b %Y %T GMT', u) print 'Content-Type: text/javascript' print 'Cache-Control: no-cache' print 'Date: ' + s print 'Expires: ' + s print '' print 'var timeskew = new Date().getTime() - ' + str(t*1000) + ';'
Python
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ...
Python
from django import forms from django.contrib.auth.models import User class ContactForm(forms.Form): name = forms.CharField(max_length=100, help_text="Full Name", widget=forms.TextInput(attrs={'size':'40'}),required=False) subject = forms.CharField(max_length=100, help_text="Subject of ...
Python
from django.conf.urls.defaults import * from views import * urlpatterns = patterns('', (r'^', contact), (r'^thanks/$', static, {'template':'contact_thanks.html'}), )
Python
#r!/usr/bin/env python # # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
Python
from django.conf import settings from django.conf.urls.defaults import * from django.contrib import databrowse from django.contrib import admin admin.autodiscover() #from shapeft.custom_admin import editor #from registration.views import register urlpatterns = patterns('', (r'^_admin_/', include(admin.site.url...
Python
#Please create a local_settings.py which should include, at least: # - ADMINS # - DEFAULT_FROM_EMAIL # - DATABASES # - SECRET_KEY # - FT_DOMAIN_KEY # - FT_DOMAIN_SECRET # - EMAIL_HOST # - EMAIL_HOST_USER # - EMAIL_HOST_PASSWORD # - EMAIL_PORT # - EMAIL_USE_TLS import os DEBUG = True TEMPLATE_DEBUG = DEBUG STATIC_DA...
Python
#!/usr/bin/env python # # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
#!/usr/bin/env python # # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
import random import md5 from django.db import models from ft_auth.models import OAuthAccessToken STATUS_CODES = { 1 : 'In Queue (%s ahead of you)', 2 : 'Initial Processing', 3 : 'Importing into Fusion Tables', 4 : 'Complete', 6 : 'Error' } class shapeUpload(models.Model): """An upload -- includes location ...
Python
#!/usr/bin/env python # # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
#!/usr/bin/env python # # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
#!/usr/bin/env python # # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from fpu_structure import * from datahandling import * import math #TODO, faltan agregar las modificaciones que se hacen a las banderas de los diferentes registros #TODO, faltan un montón de instrucciones uesp = None #ultimo_elemento_sacado_de_pila pila = Pila() control ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de isntruction_set.py """ import unittest import random from fpu_structure import Pila, StatusRegister, ControlRegister, StatusX86 """ Test Pila Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Especificado en cada test en particular Dependencias: P...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- #import re import copy #import instruction_set as iset #modificado por el momento import reduced_instruction_set as iset from fpu_structure import * uesp = None #ultimo_elemento_sacado_de_pila uesp_temp = None #ultimo_elemento_sacado_de_pila pila_temp = None control_temp...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de instruction_set.py """ import random import math #módulo de Tests Unitarios import unittest #importa el módulo a testear: from reduced_instruction_set import * """ Test FLD Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Observar que el dato que...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from datahandling import * """ Pin Configuration """ """ pin[ 1 ]='GND' pin[ 2:16 ]= AD[14:0] pin[ 17 ]= 'NC' pin[ 18 ]= 'NC' pin[ 19 ]= 'CLK' pin[ 20 ]= 'GND' pin[ 21 ]= 'RESET' pin[ 22 ]= 'READY' pin[ 23 ]= 'BUSY' pin[ 24 ]= QS1 pin[ 25 ]= QS0 pin[ 26 ]= S0 #neg pin[ ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de instruction_set.py """ import random #módulo de Tests Unitarios import unittest #importa el módulo a testear: from reduced_instruction_set import * """ Test FLD Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Observar que el dato que se introduc...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys try: import pygtk pygtk.require("2.0") except: pass try: import gtk import gtk.glade except: sys.exit(1) from fpu_structure import * #mas comentarios #from instruction_set import * #Por el momento queda así import reduced_instruction_set as iset from dat...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from fpu_structure import * from datahandling import * import math #TODO, faltan agregar las modificaciones que se hacen a las banderas de los diferentes registros #TODO, faltan un montón de instrucciones uesp = None #ultimo_elemento_sacado_de_pila res = None #resultado d...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from fpu_structure import * from datahandling import * import math #TODO, faltan agregar las modificaciones que se hacen a las banderas de los diferentes registros #TODO, faltan un montón de instrucciones uesp = None #ultimo_elemento_sacado_de_pila pila = Pila() control ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de instruction_set.py """ import random #módulo de Tests Unitarios import unittest #importa el módulo a testear: from reduced_instruction_set import * """ Test FLD Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Observar que el dato que se introduc...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- #import re import copy #import instruction_set as iset #modificado por el momento import reduced_instruction_set as iset from fpu_structure import * uesp = None #ultimo_elemento_sacado_de_pila uesp_temp = None #ultimo_elemento_sacado_de_pila pila_temp = None control_temp...
Python
# -*- coding: utf-8 -*- """ Tipos de Datos """ """ BCD, será considerado como una lista ordenada de números enteros entre 0 y 9 Para convertirlo se pasará multiplicando sea a = [1,2,3,4,5,6,7...] donde el último dígito es el más significativo y el primero el menos sea b el número decimal, entonces b=0 j=0 for i in a:...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys try: import pygtk pygtk.require("2.0") except: pass try: import gtk import gtk.glade except: sys.exit(1) from fpu_structure import * #mas comentarios #from instruction_set import * #Por el momento queda así import reduced_instruction_set as iset from dat...
Python
from ctypes import * # load the shared object libtest = cdll.LoadLibrary('./libtest.so.1.0') # call the function, yes it is as simple as that! print libtest.add(10, 20) #llamo a hello de asm libtest.hello_asm() n = int(raw_input(u'ingrese limite de sumantoria: ')) print "La sumatoria de 1 a %i es %i" % (n, libt...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from datahandling import * """ Pin Configuration """ """ pin[ 1 ]='GND' pin[ 2:16 ]= AD[14:0] pin[ 17 ]= 'NC' pin[ 18 ]= 'NC' pin[ 19 ]= 'CLK' pin[ 20 ]= 'GND' pin[ 21 ]= 'RESET' pin[ 22 ]= 'READY' pin[ 23 ]= 'BUSY' pin[ 24 ]= QS1 pin[ 25 ]= QS0 pin[ 26 ]= S0 #neg pin[ ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de isntruction_set.py """ import unittest import random from fpu_structure import Pila, StatusRegister, ControlRegister, StatusX86 """ Test Pila Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Especificado en cada test en particular Dependencias: P...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de instruction_set.py """ import random import math #módulo de Tests Unitarios import unittest #importa el módulo a testear: from reduced_instruction_set import * """ Test FLD Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Observar que el dato que...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from fpu_structure import * from datahandling import * import math #TODO, faltan agregar las modificaciones que se hacen a las banderas de los diferentes registros #TODO, faltan un montón de instrucciones uesp = None #ultimo_elemento_sacado_de_pila res = None #resultado d...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from fpu_structure import * from datahandling import * import math #TODO, faltan agregar las modificaciones que se hacen a las banderas de los diferentes registros #TODO, faltan un montón de instrucciones uesp = None #ultimo_elemento_sacado_de_pila pila = Pila() control ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de isntruction_set.py """ import unittest import random from fpu_structure import Pila, StatusRegister, ControlRegister, StatusX86 """ Test Pila Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Especificado en cada test en particular Dependencias: P...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- #import re import copy #import instruction_set as iset #modificado por el momento import reduced_instruction_set as iset from fpu_structure import * uesp = None #ultimo_elemento_sacado_de_pila uesp_temp = None #ultimo_elemento_sacado_de_pila pila_temp = None control_temp...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de instruction_set.py """ import random import math #módulo de Tests Unitarios import unittest #importa el módulo a testear: from reduced_instruction_set import * """ Test FLD Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Observar que el dato que...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from datahandling import * """ Pin Configuration """ """ pin[ 1 ]='GND' pin[ 2:16 ]= AD[14:0] pin[ 17 ]= 'NC' pin[ 18 ]= 'NC' pin[ 19 ]= 'CLK' pin[ 20 ]= 'GND' pin[ 21 ]= 'RESET' pin[ 22 ]= 'READY' pin[ 23 ]= 'BUSY' pin[ 24 ]= QS1 pin[ 25 ]= QS0 pin[ 26 ]= S0 #neg pin[ ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de instruction_set.py """ import random #módulo de Tests Unitarios import unittest #importa el módulo a testear: from reduced_instruction_set import * """ Test FLD Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Observar que el dato que se introduc...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys try: import pygtk pygtk.require("2.0") except: pass try: import gtk import gtk.glade except: sys.exit(1) from fpu_structure import * #mas comentarios #from instruction_set import * #Por el momento queda así import reduced_instruction_set as iset from dat...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from fpu_structure import * from datahandling import * import math #TODO, faltan agregar las modificaciones que se hacen a las banderas de los diferentes registros #TODO, faltan un montón de instrucciones uesp = None #ultimo_elemento_sacado_de_pila res = None #resultado d...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from fpu_structure import * from datahandling import * import math #TODO, faltan agregar las modificaciones que se hacen a las banderas de los diferentes registros #TODO, faltan un montón de instrucciones uesp = None #ultimo_elemento_sacado_de_pila pila = Pila() control ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de instruction_set.py """ import random #módulo de Tests Unitarios import unittest #importa el módulo a testear: from reduced_instruction_set import * """ Test FLD Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Observar que el dato que se introduc...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- #import re import copy #import instruction_set as iset #modificado por el momento import reduced_instruction_set as iset from fpu_structure import * uesp = None #ultimo_elemento_sacado_de_pila uesp_temp = None #ultimo_elemento_sacado_de_pila pila_temp = None control_temp...
Python
# -*- coding: utf-8 -*- """ Tipos de Datos """ """ BCD, será considerado como una lista ordenada de números enteros entre 0 y 9 Para convertirlo se pasará multiplicando sea a = [1,2,3,4,5,6,7...] donde el último dígito es el más significativo y el primero el menos sea b el número decimal, entonces b=0 j=0 for i in a:...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys try: import pygtk pygtk.require("2.0") except: pass try: import gtk import gtk.glade except: sys.exit(1) from fpu_structure import * #mas comentarios #from instruction_set import * #Por el momento queda así import reduced_instruction_set as iset from dat...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from datahandling import * """ Pin Configuration """ """ pin[ 1 ]='GND' pin[ 2:16 ]= AD[14:0] pin[ 17 ]= 'NC' pin[ 18 ]= 'NC' pin[ 19 ]= 'CLK' pin[ 20 ]= 'GND' pin[ 21 ]= 'RESET' pin[ 22 ]= 'READY' pin[ 23 ]= 'BUSY' pin[ 24 ]= QS1 pin[ 25 ]= QS0 pin[ 26 ]= S0 #neg pin[ ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de isntruction_set.py """ import unittest import random from fpu_structure import Pila, StatusRegister, ControlRegister, StatusX86 """ Test Pila Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Especificado en cada test en particular Dependencias: P...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Casos de prueba de instruction_set.py """ import random import math #módulo de Tests Unitarios import unittest #importa el módulo a testear: from reduced_instruction_set import * """ Test FLD Fecha: 28/07/2008 Leonardo Manuel Rocha Propósito: Observar que el dato que...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from fpu_structure import * from datahandling import * import math #TODO, faltan agregar las modificaciones que se hacen a las banderas de los diferentes registros #TODO, faltan un montón de instrucciones uesp = None #ultimo_elemento_sacado_de_pila res = None #resultado d...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Python
"""Implementation of JSONEncoder """ import re try: from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from simplejson._speedups import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ...
Python
"""Implementation of JSONDecoder """ import re import sys import struct from simplejson.scanner import make_scanner try: from simplejson._speedups import scanstring as c_scanstring except ImportError: c_scanstring = None __all__ = ['JSONDecoder'] FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL def _floatconst...
Python
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`simplejson` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of ...
Python
r"""Using simplejson from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -msimplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -msimplejson.tool Expecting property name: line 1 column 2 (char 2) """ import simplejson def main(): import sys if l...
Python
"""JSON token scanner """ import re try: from simplejson._speedups import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scan...
Python
#!/usr/bin/python2.4 '''Load the latest update for a Twitter user and leave it in an XHTML fragment''' __author__ = 'dewitt@google.com' import codecs import getopt import sys import twitter TEMPLATE = """ <div class="twitter"> <span class="twitter-user"><a href="http://twitter.com/%s">Twitter</a>: </span> <span...
Python
#!/usr/bin/python2.4 '''Post a message to twitter''' __author__ = 'dewitt@google.com' import ConfigParser import getopt import os import sys import twitter USAGE = '''Usage: tweet [options] message This script posts a message to Twitter. Options: -h --help : print this help --consumer-key : the twit...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Python
#!/usr/bin/python2.4 # -*- coding: utf-8 -*-# # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
Python
# File: cdf.py # """ Start debugging import sys import os.path this_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, this_dir) # """ End debugging import cdflib as clib import os.path class CDF(object): """ This class defines a CDF object. A CDF object is only bound at most one CDF d...
Python
# File: cdflib_dict.py """ This file defines lookup dictionaries for the cdflib module. """ #-------------------- Copy of cdf.h ------------------------------------------- CDF_MIN_DIMS = 0 # Min number of dimensions a CDF variable may have CDF_MAX_DIMS = 10 # Max number of dimensions a CDF variable may have # * Len...
Python
# File: cdflib_namedtuple.py """ This file defines named tuple for cdflib. """ import collections VarInfo = collections.namedtuple('VarInfo', [ 'blockingFactor', 'dataType', ...
Python
# File: setup.py from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import glob import os.path """ Steps of this script: 1. Define metadata for setup(). 2. Construct paths and file lists. 3. Define modules for different platforms. 4. Call setup() """ #--...
Python
__all__ = ['parse_robolog', 'parse_latest'] import csv, os ''' This python script requires Matplotlib and Numpy to be installed. It is designed for Python 2.6 or 2.7 ''' def parse_robolog(filename): # Seperate the robot log into a list of dicts global linenum, ln, keyname print("Checking " + ...
Python
#!/usr/bin/env python import commands import getopt import sys SSH_USER = 'bot' SSH_HOST = 'localhost' SSH_PORT = 29418 SSH_COMMAND = 'ssh %s@%s -p %d gerrit approve ' % (SSH_USER, SSH_HOST, SSH_PORT) FAILURE_SCORE = '--code-review=-2' FAILURE_MESSAGE = 'This commit message does not match the standard.' \ + '...
Python
#!/usr/bin/env python2.6 # Copyright (c) 2010, Code Aurora Forum. 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 # not...
Python
#!/usr/bin/python2.4 # # Copyright 2008 The RE2 Authors. All Rights Reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. """Unittest for the util/regexp/re2/unicode.py module.""" import os import StringIO from google3.pyglib import flags from google3.testing...
Python
# Copyright 2008 The RE2 Authors. All Rights Reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. """Parser for Unicode data files (as distributed by unicode.org).""" import os import re import urllib2 # Directory or URL where Unicode tables reside. _UNICOD...
Python
# coding=utf-8 # (The line above is necessary so that I can use 世界 in the # *comment* below without Python getting all bent out of shape.) # Copyright 2007-2009 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
Python
from build import plot_results, print_results #valid formats are png, pdf, ps, eps and svg #if format=None the plot will be displayed format = 'png' #output = print_results output = plot_results for function in ['fill', 'reduce', 'inner_product', 'gather', 'merge']: output(function + '.xml', 'InputType', 'InputSi...
Python
import os import glob from build.perftest import compile_test # try to import an environment first try: Import('env') except: exec open("../build/build-env.py") env = Environment() def cu_build_function(source, target, env): compile_test(str(source[0]), str(target[0])) # define a rule to build a .cu from a ...
Python
import os import inspect # try to import an environment first try: Import('env') except: exec open("../build/build-env.py") env = Environment() # on windows we have to do /bigobj if env['PLATFORM'] == "win32" or env['PLATFORM'] == "win64": env.Append(CPPFLAGS = "/bigobj") # find all .cus & .cpps in the curre...
Python
import os import glob from warnings import warn thrust_abspath = os.path.abspath("../../thrust/") # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # this function builds a trivial source file from a Thrust header def trivial_source_from_h...
Python
import os import glob # try to import an environment first try: Import('env') except: exec open("../../build/build-env.py") env = Environment() # on mac we have to tell the linker to link against the C++ library if env['PLATFORM'] == "darwin": env.Append(LINKFLAGS = "-lstdc++") # find all .cus & .cpps in the...
Python
import os import inspect import glob # try to import an environment first try: Import('env') except: exec open("../build/build-env.py") env = Environment() # find all .cus & .cpps in the current directory sources = [] directories = ['.'] extensions = ['*.cu', '*.cpp'] if env['backend'] == 'cuda' or env['backen...
Python
#!/usr/bin/env python # encoding: UTF-8 import sys import logging try: import json except ImportError: import simplejson as json import onering logging.basicConfig(level=logging.DEBUG) def app(environ, start_response): start_response('200 OK', []) path = environ['PATH_INFO'] if path == '/init': ...
Python
import os, sys from setuptools import setup, Extension if sys.platform == 'darwin': include_dirs = ['/Library/Frameworks/OneRing.framework/Headers/'] library_dirs = [] libraries = [] extra_link_args = ['-framework', 'OneRing'] else: include_dirs = [os.path.join('..', '..', 'include')] library_d...
Python
import logging from cStringIO import StringIO try: import json except ImportError: import simplejson as json import _onering __all__ = ['register_wsgi_app', 'loop', 'publish'] logger = logging.getLogger('onering') def register_wsgi_app(appname, app): def callback(method, url, body=None): respons...
Python
#!/usr/bin/env python # encoding: UTF-8 __version__ = '0.1' import sys, os try: import json except ImportError: import simplejson as json import logging import web from web.contrib.template import render_mako import onering urls = ( '/init', 'init', '/', 'index', '/create_window', 'create_windo...
Python
from distutils.core import setup from glob import glob import sys, os from demo import __version__ as version def gen_data_files(topdir): for dirpath, dirnames, filenames in os.walk(topdir): filenames = [x for x in filenames if not x.startswith('.')] yield dirpath, [os.path.join(dirpath, fn) for fn...
Python
#!/usr/bin/env python # encoding: UTF-8 __author__ = "Qiangning Hong <hongqn@gmail.com>" __version__ = "$Revision$" __date__ = "$Date$" import sys, os import logging import commands import re import shutil from subprocess import check_call logger = logging.getLogger() def get_qt_dir(): onering = '/Library/Frame...
Python
''' Created on Dec 27, 2010 @author: t-bone ''' from django.shortcuts import render_to_response from django.forms import forms, fields, widgets from google.appengine.api import taskqueue #from google.appengine.ext import db from django.http import HttpResponseRedirect, HttpResponse from google.appengine.api ...
Python
''' Created on Nov 30, 2010 @author: t-bone ''' #from pricing.option import kirk95 #print kirk95('c',[5,4],1,.5,.02,[.35,.35],.85) x = [1] if x: print True else: print False
Python
''' Created on Dec 18, 2010 @author: t-bone ''' from google.appengine.ext import db from pricing import option import datetime class UnitOfMeasure(db.Model): name = db.StringProperty() type = db.StringProperty(choices=set(['Energy','Volume'])) joules_con_factor = db.FloatProperty(verbose_n...
Python
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha...
Python
''' Created on Nov 20, 2010 @author: t-bone ''' import logging, os, sys # Google App Engine imports. from google.appengine.ext.webapp import util # Remove the standard version of Django. for k in [k for k in sys.modules if k.startswith('django')]: del sys.modules[k] # Force sys.path to have our ow...
Python
''' Created on Nov 29, 2010 @author: t-bone ''' import math def pdf(x, mu=0, sigma=1): u = (x-mu)/abs(sigma) y = (1/(math.sqrt(2*math.pi)*abs(sigma)))*math.exp(-u*u/2) return y def erf(x): a = 0.140012 if x == 0: y = 0 else: y = x/abs(x) * math.sqrt(1 ...
Python
''' Created on Mar 7, 2011 @author: t-bone ''' import math def percentile(N, percent, key=lambda x:x): """ Find the percentile of a list of values. @parameter N - is a list of values. Note N MUST BE already sorted. @parameter percent - a float value from 0.0 to 1.0. @parameter key - ...
Python
from django.conf.urls.defaults import * from web.views import * # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', (r'^entry/(\w*)/delete/(\d*)', delete), #(r'^entry/(\w*):(\d*)/(\w*):(\d*)', entry), #(r'^entry/(...
Python
''' Created on Nov 29, 2010 @author: t-bone ''' import math from stats.normal import cdf # Black Merton Scholes Function def bms(call_put,S,X,T,r,v,q): d1 = (math.log(S/X)+(r+v*v/2.)*T)/(v*math.sqrt(T)) d2 = d1-v*math.sqrt(T) if call_put=='c': return S*math.exp(-q*T)*cdf(d1)-X...
Python