code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/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 sys
import os
from lib import main
main.main(fullscreen=True)
| Python |
from setuptools import setup, find_packages
setup(
name="666 Luftballons",
version="1.0",
description="Puzzle/action game in which you try to stomp devils in "
"balloons.",
author="Thijs Jonkman & Jeroen Vloothuis",
packages=find_packages(),
install_requires=[
'setuptools... | Python |
#! /usr/bin/env python
import sys
import os
from lib import main
main.main(fullscreen=True)
| Python |
import pygame
from game import Game
from credits import CreditsScreen
from highscore import HighScoreScreen
from help import HelpScreen
import data
from foot import Foot, GodlyCloud
from clouds import Clouds
class Button(pygame.sprite.Sprite):
def __init__(self, normal_image, highlight_image, sound=None):
... | Python |
import pygame
class GodlyCloud(pygame.sprite.RenderUpdates):
def __init__(self, cloud, foot, square_size, max_column, droprange,
offset=0):
super(GodlyCloud, self).__init__()
self.column = 0
self.max_column = max_column
self.foot = Foot(foot, square_size, droprange... | Python |
'''Simple data loader module.
Loads data files from the "data" directory shipped with a game.
Enhancing this to handle caching etc. is left as an exercise for the reader.
'''
import os
import sys
import pygame
from animation import Animation
data_py = os.path.abspath(os.path.dirname(__file__))
data_dir = os.path.no... | Python |
import sys
from balloon import BalloonFactory, BalloonGenerator
from field import Field, Pop, TimedSprite
from foot import Foot, GodlyCloud
import data
from gameinfo import GameInfo, ScoreSystem, Timer
from animation import Animation
import pygame
from background import Sun
from spiral import Spiral
from clouds import ... | Python |
import os
import pygame
import data
import pickle
class HighScores(object):
def __init__(self, filename):
self.filename = filename
self.max_scores = 6
self.load()
@property
def path(self):
return os.path.expanduser(os.path.join('~', '.' + self.filename))
def load(self)... | Python |
import pygame
from foot import Foot
class TimedSprite(pygame.sprite.Sprite):
def __init__(self, image, display_time, position):
super(Pop, self).__init__()
self.image = image
self.rect = image.get_rect()
self.rect.center = position
self.clock = pygame.time.Clock()
se... | Python |
'''Game main module.
Contains the entry point used by the run_game.py script.
Feel free to put all your game code here, or in other modules in this "lib"
directory.
'''
import data
import os
import pygame
from startscreen import StartScreen
from optparse import OptionParser
def main(fullscreen=False):
parser = ... | Python |
import pygame
import math
_movement = {
0:(0,1),
1:(1,1),
2:(1,0),
3:(1,-1),
4:(0,-1),
-3:(-1,-1),
-2:(-1,0),
-1:(-1,1)}
class Sun(pygame.sprite.Sprite):
def __init__(self, animation):
super(Sun, self).__init__()
self.animation = animation
self.rect = self.i... | Python |
import pygame
import data
class CreditsScreen(object):
def run(self, screen):
from keys import *
background = data.load_graphic('credits.png')
screen.blit(background, (0, 0))
pygame.display.update()
clock = pygame.time.Clock()
while True:
clock.tick(80)
... | Python |
import pygame
import random
import time
class Balloon(pygame.sprite.Sprite):
def __init__(self, normal_animation, fire_animation, cell, type):
super(Balloon, self).__init__()
self.normal_animation = normal_animation
self.fire_animation = fire_animation
self.current_animation = self.... | Python |
import ConfigParser
def load_data_configuration(data_dir):
configuration = ConfigParser.ConfigParser()
configuration.read([data_dir])
return configuration
| Python |
import pygame
class Spiral(pygame.sprite.Sprite):
def __init__(self, animation_clock_wise, animation_counter_clock_wise):
super(Spiral, self).__init__()
self.animation, self.animation_clock_wise = animation_clock_wise, animation_clock_wise
self.animation_counter_clock_wise = animation_count... | Python |
import pygame
import data
class HelpScreen(object):
def run(self, screen):
from keys import *
background = data.load_graphic('help.png')
screen.blit(background, (0, 0))
pygame.display.update()
clock = pygame.time.Clock()
while True:
clock.tick(80)
... | Python |
import pygame
K_LEFT, K_RIGHT = pygame.K_LEFT, pygame.K_RIGHT
DROP_KEYS = (pygame.K_SPACE, pygame.K_DOWN, pygame.K_RETURN)
TO_LEFT, TO_RIGHT = (-1, 1)
ROTATE_RIGHT_KEYS = (pygame.K_d,)
ROTATE_LEFT_KEYS = (pygame.K_s,)
QUIT_KEYS = (pygame.K_q, pygame.K_ESCAPE)
| Python |
import pygame
class Animation(object):
def __init__(self, images, fps):
self.images = images
self.current_image = 0
self.animation_frame_rate = fps
self.animation_time_passed = 0
self.animation_frame_time = 1000 / self.animation_frame_rate
self.clock = pygame.time.Cl... | Python |
import pygame
import random
import time
class GameInfo(pygame.sprite.RenderUpdates):
def __init__(self, score, timer, score_animations, numerals, timer_banner,
combo_banner, score_banner):
super(GameInfo, self).__init__()
combo_panel = ComboPanel(score, score_animations, combo_bann... | Python |
import pygame
import random
class Clouds(pygame.sprite.RenderUpdates):
def __init__(self, clouds):
super(Clouds, self).__init__()
self.clouds_gfx = clouds
self.layers = 6
self.layer_distance = 600 / self.layers
self.speeds = range(6, 12)
self.creat_clouds()
... | 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 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
"""
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 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
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 |
#
# Modificacion del ejemplo http://matplotlib.org/examples/animation/animate_decay.html
#
# Requiere matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# CONFIG
XLIMITS = (0, 5)
YLIMITS = (-1.1, 1.1)
CONTINUO = False
INTERVAL_UPDATE = 10
#Dummy generator of data.... | Python |
#!/usr/bin/env python
import sys
def data_gen ():
line = sys.stdin.readline()
while line:
try:
val = int(line)
yield val
except:
pass
line = sys.stdin.readline()
COUNT = 8
MIX = 0.95
gen = data_gen()
buf = []
output = None
for emt in gen:
if ou... | Python |
#!/usr/bin/env python
from fw_interface import app_request, get_mediciones
app_request('APP_ADC_START')
while True:
for n in get_mediciones():
print n
| Python |
#!/usr/bin/env python
FREQ_BUF_LEN = 8
from peak import F_SAMPLE, pulse_peak_gen
gen = pulse_peak_gen()
buf = []
freq_buf = []
while len(buf)+1 < 4:
buf.append(gen.next()[0])
while True:
buf.append(gen.next()[0])
dist_buf = []
dist_buf.append(buf[3] - buf[1])
dist_buf.append(buf[2] - buf[0... | Python |
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
""" Bootloader interface: macros y funciones del bootloader usb compartidos
entre el firmware del bootloader del dispositivo y el software de aplicación.
(Definido en USB_BL_Interface.h)
"""
import ctypes as c
## Constantes globlales
INVALID_HANDLE_VALUE = 0
##... | Python |
#!/usr/bin/env python
# Modificacion del ejemplo http://matplotlib.org/examples/animation/animate_decay.html
#
# Requiere matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import sys
# CONFIG
XLIMITS = (0, 1)
YLIMITS = (0, 3.3)
CONTINUO = True
INTERVAL_UPDATE = 10... | Python |
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
""" Interface con el firmware del bootloader: funciones que se comunican
directamente con el bootloader en el dispositivo.
"""
import ctypes as c
from bl_interface import *
from usb_interface import *
import time
SI_SUCCESS = 0
## USBXpress Read/Write Timeouts (in... | Python |
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
""" Interfaz para el firmware de usuario
"""
__version__='0.1'
from bl_fw_interface import *
from usb_interface import *
from util import *
import sys
## comandos de la aplicación
app_comm={ 'APP_BL_REQ': '\x3D',
'APP_LED_ON': '\xB2',
... | Python |
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
""" Interfaz con libSiUSBXp
"""
from bl_interface import *
import ctypes as c
import time
# Global para referir a libSiUSBXp
api = c.CDLL('./libSiUSBXp.so')
if api is None:
raise ValueError('No se encuentra la librería libSiUSBXp.so')
## CheckRxQueue timeout (in m... | Python |
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
""" Upgrade de firmware para dispositivos con bootloader usbxpress
"""
# lo que sigue: verificar WriteFlash en fw_interface.py
# paso 3: verificar crc
# verificar polinomio
__version__='0.1'
#import wx
import time
import ctypes as c
from fw_interface import *
f... | Python |
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
""" Funciones de proposito general que no estan en libreria estandar
"""
import subprocess as sub
def cmd(string):
proc=sub.Popen(string,shell=True,stdout=sub.PIPE)
out=proc.stdout.read()
print out
def pregunta_sn(pregunta, usarDefault = True, defaultSi = ... | Python |
#!/usr/bin/env python
"""
Matplotlib Animation Example
author: Jake Vanderplas
email: vanderplas@astro.washington.edu
website: http://jakevdp.github.com
license: BSD
Please feel free to use and modify this, but keep the above information. Thanks!
"""
import numpy as np
from matplotlib import pyplot as plt
from matpl... | Python |
#!/usr/bin/env python
import sys
F_SAMPLE = 1000.0
MAX_PULSE = 120.0
PEAK_RADIUS = 2
MIN_BEAT = 50.0
MAX_BEAT = 130.0
def data_gen ():
line = sys.stdin.readline()
current_x = 0
while line:
try:
val = int(line)
yield current_x, val
except:
pass
l... | 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 la... | 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 la... | 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 la... | 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 la... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Programa encargado de ejecutar en un motor de inferencia un archivo de texto
que contiene las definiciones de atributos, constantes, reglas y
estimulos.
"""
import sys
import cgi
import cmd
#import codecs
#from controlDeTareas import tarea
import mo... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Este modulo define la clase Ecuacion, que permite interpretar una ecuacion
de una cadena de caracteres y separala en sus componentes, para ser
almacenados en notacion polaca inversa.
"""
import re
class Ecuacion(object):
"""
Represent... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Objetos encargados de realizar operaciones entre dos parametros;
uno denominado izquierdo y el otro derecho.
"""
class EvaluadorAbstracto (object):
"""
Define la interfaz necesaria para todo evaluador.
"""
def get_nombre(self)... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Genera un archivo de comandos para ser procesado por el modulo motor.
Genera en base a los parametros, un conjunto de atributos, un conjunto de
reglas con los mismos, y finalmente estimulos para intentar disparar
alguna regla.
"""
import rand... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Genera un archivo de comandos para ser procesado por el modulo motor.
Genera en base a los parametros, un conjunto de atributos, un conjunto de
reglas con los mismos, y finalmente estimulos para intentar disparar
alguna regla.
"""
import rand... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
El modulo **motor** proporciona clases de utilidad, para la construccion
de un motor de inferencia, en conjunto con una manera de definir reglas y
hechos que las disparen, como asi tambien poder consultar el estado del
grafo subyacente de la red de infere... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Programa encargado de ejecutar en un motor de inferencia un archivo de texto
que contiene las definiciones de atributos, constantes, reglas y
estimulos.
"""
import sys
import cgi
import cmd
#import codecs
#from controlDeTareas import tarea
import mo... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Aplica el concepto de mixin para definir atributos y gramatica comun.
- Nombre: objetos que tienen un nombre.
- Entrenamiento: objetos que tienen dos estados de entrenamiento.
- Output: objetos que tienen un conjunto de salida.
(ej... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Objetos encargados de realizar operaciones entre dos parametros;
uno denominado izquierdo y el otro derecho.
"""
class EvaluadorAbstracto (object):
"""
Define la interfaz necesaria para todo evaluador.
"""
def get_nombre(self)... | Python |
#!/usr/bin/env python
"""Web Crawler/Spider
This module implements a web crawler. This is very _basic_ only
and needs to be extended to do anything usefull with the
traversed pages.
From: http://code.activestate.com/recipes/576551-simple-web-crawler/
"""
import re
import sys
import os
import time
import math
impor... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Este modulo define la clase Ecuacion, que permite interpretar una ecuacion
de una cadena de caracteres y separala en sus componentes, para ser
almacenados en notacion polaca inversa.
"""
import re
class Ecuacion(object):
"""
Represent... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Aplica el concepto de mixin para definir atributos y gramatica comun.
- Nombre: objetos que tienen un nombre.
- Entrenamiento: objetos que tienen dos estados de entrenamiento.
- Output: objetos que tienen un conjunto de salida.
(ej... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
El modulo **motor** proporciona clases de utilidad, para la construccion
de un motor de inferencia, en conjunto con una manera de definir reglas y
hechos que las disparen, como asi tambien poder consultar el estado del
grafo subyacente de la red de infere... | Python |
#!/usr/bin/env python
"""Web Crawler/Spider
This module implements a web crawler. This is very _basic_ only
and needs to be extended to do anything usefull with the
traversed pages.
From: http://code.activestate.com/recipes/576551-simple-web-crawler/
"""
import re
import sys
import os
import time
import math
impor... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import re
from Tarea import *
import Tesauro
# Transforma lineas de palabras separadas por algun elemento de @separadores, en lineas de palabras separadas por espacios que no estan en el conjunto listaNegra.
class Limpieza(Tarea):
# Metodo de utilidad para construir una... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from Tarea import *
# Genera un dicccionario donde cada palabra indica la cantidad de veces que aparecio.
class ContarPalabras(Tarea):
def __init__(self, nombre, entrada = None, noLeer = None, salida = None, log = None, errores = None, mostrarN = 20):
Tarea.__init__(self... | Python |
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
import sys
import logging
from echo3Ways import *
def main():
# Construir logger.
logger = logging.getLogger('echo3Ways.log')
hl = logging.FileHandler('echo3Ways.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hl.setFormatter(formatter)
... | Python |
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
import codecs
import os
import sys
import logging
import getopt
from ExtraerVerbosYSustantivos import *
from Limpieza import *
from ContarPalabras import *
def armarTareas():
return ('limpieza','extraer','contar')
def usage():
print ' Prototipo de control de tareas: Es... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from __future__ import print_function
import re
import datetime
import sys
class Tarea (object):
NOERROR = 0
ERROR = 1
def __init__(self, nombre, entrada = None, noLeer = None, salida = None, log = None, errores = None):
# Nombre de la tarea.
self.nombre = nombre
... | Python |
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
import sys
import logging
from echo3Ways import *
def main():
# Construir logger.
logger = logging.getLogger('echo3Ways.log')
hl = logging.FileHandler('echo3Ways.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hl.setFormatter(formatter)
... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#from __future__ import print_function
from Tarea import *
# Un ejemplo de tarea: entrada -> echo3Ways -> stdout \ log \ errores
class echo3Ways (Tarea):
def __init__(self, entrada, salida, log, errores):
Tarea.__init__(self,"echo3Ways",entrada,salida,log,errores)
def... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import re
from Tarea import *
import Tesauro
# Transforma lineas de palabras separadas por algun elemento de @separadores, en lineas de palabras separadas por espacios que no estan en el conjunto listaNegra.
class Limpieza(Tarea):
# Metodo de utilidad para construir una... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from Tarea import *
# Genera un dicccionario donde cada palabra indica la cantidad de veces que aparecio.
class ContarPalabras(Tarea):
def __init__(self, nombre, entrada = None, noLeer = None, salida = None, log = None, errores = None, mostrarN = 20):
Tarea.__init__(self... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
class Tesauro:
def __init__(self):
self.adverbios = set( (
"apenas", "bastante", "casi", "cuanto", "demasiado", "justo", "mas", "menos", "mucho", "muy", "nada", "poco", "sobremanera", "tan", "todo", "tanto", "medio", "algo", "adelante", "adonde", "ahi", "aqu... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from Tarea import *
from Tesauro import *
# Transforma lineas que contienen solo palabras en minusculas separadas por espacios en una lista de lineas separadas por espacios que son o raices de verbos o palabras sueltas.
# TODO las palabras sueltas deberian ser solo sustanti... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from __future__ import print_function
import re
import datetime
import sys
class Tarea (object):
NOERROR = 0
ERROR = 1
def __init__(self, nombre, entrada = None, noLeer = None, salida = None, log = None, errores = None):
# Nombre de la tarea.
self.nombre = nombre
... | Python |
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
import codecs
import os
import sys
import logging
import getopt
from ExtraerVerbosYSustantivos import *
from Limpieza import *
from ContarPalabras import *
def armarTareas():
return ('limpieza','extraer','contar')
def usage():
print ' Prototipo de control de tareas: Es... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from Tarea import *
from Tesauro import *
# Transforma lineas que contienen solo palabras en minusculas separadas por espacios en una lista de lineas separadas por espacios que son o raices de verbos o palabras sueltas.
# TODO las palabras sueltas deberian ser solo sustanti... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
class Tesauro:
def __init__(self):
self.adverbios = set( (
"apenas", "bastante", "casi", "cuanto", "demasiado", "justo", "mas", "menos", "mucho", "muy", "nada", "poco", "sobremanera", "tan", "todo", "tanto", "medio", "algo", "adelante", "adonde", "ahi", "aqu... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#from __future__ import print_function
from Tarea import *
# Un ejemplo de tarea: entrada -> echo3Ways -> stdout \ log \ errores
class echo3Ways (Tarea):
def __init__(self, entrada, salida, log, errores):
Tarea.__init__(self,"echo3Ways",entrada,salida,log,errores)
def... | Python |
# -*- coding: utf-8 -*-
'''
Created on 2013-3-25
首页模块,将显示登陆界面和欢迎界面
@author: zhiyong.luo
'''
from framework.bottle import Bottle
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
from framework.gaesessions import get_current_session
#jinja2
env = Environment(loader ... | Python |
# -*- coding: utf-8 -*-
'''
Created on 2013-3-25
@author: zhiyong.luo
'''
from framework.bottle import Bottle, debug,redirect, static_file
from google.appengine.ext.webapp.util import run_wsgi_app
from app.index import indexController
debug(True)
#root app
root = Bottle()
root.mount("/index.html... | Python |
# -*- coding: utf-8 -*-
from framework.gaesessions import SessionMiddleware
COOKIE_KEY = 'h\xb79\xecp\xe1\xa0UE\x0f\x86\xdbs\xa6\x8e \xc1\x95\x0f#\xe9\xa5\xe7\xec\xa9\xf5\n\x88\xedn\rlM*M\x01\xe9t\xc07\xee0\x96\x86\xb8\xd8\xb9\x0b\xe5\x8fI\xbf\xf0o\xb2\x01\xd9Q\xaa\x9cc\xfe\xb4\xb8'
def webapp_add_wsgi_middleware(a... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.runtime
~~~~~~~~~~~~~~
Runtime helpers.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from itertools import chain, imap
from jinja2.nodes import EvalContext, _context_function_types
from jinja2.utils import Markup, partial, soft_unicode, escape, miss... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.bccache
~~~~~~~~~~~~~~
This module implements the bytecode cache system Jinja is optionally
using. This is useful if you have very complex template situations and
the compiliation of all those templates slow down your application too
much.
Situations whe... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.compiler
~~~~~~~~~~~~~~~
Compiles nodes into python code.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from cStringIO import StringIO
from itertools import chain
from copy import deepcopy
from jinja2 import nodes
from j... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.meta
~~~~~~~~~~~
This module implements various functions that exposes information about
templates that might be interesting for various kinds of applications.
:copyright: (c) 2010 by the Jinja Team, see AUTHORS for more details.
:license: BSD, see LICENSE fo... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.nodes
~~~~~~~~~~~~
This module implements additional nodes derived from the ast base node.
It also provides some node tree helper functions like `in_lineno` and
`get_nodes` used by the parser and translator in order to normalize
python and jinja nodes.
:... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.tests
~~~~~~~~~~~~
Jinja test functions. Used with the "is" operator.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
from jinja2.runtime import Undefined
try:
from collections import Mapping as MappingType
... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.debug
~~~~~~~~~~~~
Implements the debug interface for Jinja. This module does some pretty
ugly stuff with the Python traceback system in order to achieve tracebacks
with correct line numbers, locals and contents.
:copyright: (c) 2010 by the Jinja Team.
:... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.optimizer
~~~~~~~~~~~~~~~~
The jinja optimizer is currently trying to constant fold a few expressions
and modify the AST in place so that it should be easier to evaluate it.
Because the AST does not contain all the scoping information and the
compiler has to ... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.lexer
~~~~~~~~~~~~
This module implements a Jinja / Python combination lexer. The
`Lexer` class provided by this module is used to do some preprocessing
for Jinja.
On the one hand it filters out invalid operators like the bitshift
operators we don't allow... | Python |
# -*- coding: utf-8 -*-
"""
jinja.constants
~~~~~~~~~~~~~~~
Various constants.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
#: list of lorem ipsum words used by the lipsum() helper function
LOREM_IPSUM_WORDS = u'''\
a ac accumsan ad adipiscing aenean a... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.sandbox
~~~~~~~~~~~~~~
Adds a sandbox layer to Jinja as it was the default behavior in the old
Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the
default behavior is easier to use.
The behavior can be changed by subclassing the environm... | Python |
import gc
import unittest
from jinja2._markupsafe import Markup, escape, escape_silent
class MarkupTestCase(unittest.TestCase):
def test_markup_operations(self):
# adding two strings should escape the unsafe one
unsafe = '<script type="application/x-some-script">alert("foo");</script>'
sa... | Python |
# -*- coding: utf-8 -*-
"""
markupsafe._constants
~~~~~~~~~~~~~~~~~~~~~
Highlevel implementation of the Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
HTML_ENTITIES = {
'AElig': 198,
'Aacute': 193,
'Acirc': 194,
'Agrave': 1... | Python |
# -*- coding: utf-8 -*-
"""
jinja2._markupsafe._bundle
~~~~~~~~~~~~~~~~~~~~~~~~~~
This script pulls in markupsafe from a source folder and
bundles it with Jinja2. It does not pull in the speedups
module though.
:copyright: Copyright 2010 by the Jinja team, see AUTHORS.
:license: BSD, see ... | Python |
# -*- coding: utf-8 -*-
"""
markupsafe
~~~~~~~~~~
Implements a Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import re
from itertools import imap
__all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
_striptags_re = re.compile... | Python |
# -*- coding: utf-8 -*-
"""
markupsafe._native
~~~~~~~~~~~~~~~~~~
Native Python implementation the C module is not compiled.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from jinja2._markupsafe import Markup
def escape(s):
"""Convert the characters... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.loaders
~~~~~~~~~~~~~~
Jinja loader classes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import weakref
from types import ModuleType
from os import path
try:
from hashlib import sha1
except Imp... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.utils
~~~~~~~~~~~~
Utility functions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import sys
import errno
try:
from thread import allocate_lock
except ImportError:
from dummy_thread import allocate_lo... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.ext
~~~~~~~~~~
Jinja extensions allow to add custom tags similar to the way django custom
tags work. By default two example extensions exist: an i18n and a cache
extension.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from collections impor... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.