code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
# jsb/boot.py
#
#
""" admin related data and functions. """
## jsb imports
from jsb.utils.generic import checkpermissions, isdebian, botuser
from jsb.lib.persist import Persist
from jsb.utils.exception import handle_exception
from jsb.lib.datadir import makedirs, getdatadir
from jsb.lib.config import Config
from jsb... | Python |
# jsb/persist.py
#
#
"""
allow data to be written to disk or BigTable in JSON format. creating
the persisted object restores data.
"""
## jsb imports
from jsb.utils.trace import whichmodule, calledfrom
from jsb.utils.lazydict import LazyDict
from jsb.utils.exception import handle_exception
from jsb.utils.... | Python |
# jsb/threads.py
#
#
""" own threading wrapper. """
## jsb imports
from jsb.utils.exception import handle_exception
## basic imports
import threading
import re
import time
import thread
import logging
import uuid
## defines
# RE to determine thread name
methodre = re.compile('method\s+(\S+)', re.I)
funcre = re.... | Python |
# jsb/lib/config.py
#
#
""" config module. config is stored as item = JSON pairs. """
## jsb imports
from jsb.utils.trace import whichmodule, calledfrom
from jsb.utils.lazydict import LazyDict
from jsb.utils.exception import handle_exception
from jsb.utils.name import stripname
from datadir import getdatadir
from er... | Python |
# gozerbot/persistconfig.py
#
#
""" plugin related config file with commands added to the bot to config a plugin.
usage:
!plug-cfg -> shows list of all config
!plug-cfg key value -> sets value to key
!plug-cfg key -> shows list of key
!plug-cfg key add value -> adds value to list
!plug-cfg... | Python |
# jsb/lib/fleet.py
#
#
""" fleet is a list of bots. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.generic import waitforqueue
from config import Config
from users import users
from plugins import plugs
from persist import Persist
from errors import NoSuchBotType, BotNotEnabled
fr... | Python |
# jsb/commands.py
#
#
"""
the commands module provides the infrastructure to dispatch commands.
commands are the first word of a line.
"""
## jsb imports
from threads import start_new_thread, start_bot_command
from jsb.utils.xmpp import stripped
from jsb.utils.trace import calledfrom, whichmodule
from js... | Python |
# jsb/container.py
#
#
""" container for bot to bot communication. """
__version__ = "1"
## jsb imports
from jsb.lib.gozerevent import GozerEvent
## xmpp import
from jsb.contrib.xmlstream import NodeBuilder, XMLescape, XMLunescape
## basic imports
import hmac
import uuid
import time
import hashlib
## defines
... | Python |
# jsb/lib/aliases.py
#
#
""" global aliases. """
## jsb imports
from jsb.lib.datadir import getdatadir
## basic imports
import os
## getaliases function
def getaliases():
from jsb.lib.persist import Persist
p = Persist(getdatadir() + os.sep + "aliases")
if not p.data: p.data = {}
return p | Python |
# jsb/rest/client.py
#
#
""" Rest Client class """
## jsb imports
from jsb.utils.url import geturl4, posturl, deleteurl, useragent
from jsb.utils.generic import toenc
from jsb.utils.exception import handle_exception, exceptionmsg
from jsb.utils.locking import lockdec
from jsb.utils.lazydict import LazyDict
from jsb.... | Python |
# jsb/socklib/rest/server.py
#
#
## jsb imports
from jsb.utils.exception import handle_exception, exceptionmsg
from jsb.utils.trace import calledfrom
from jsb.lib.persiststate import ObjectState
from jsb.lib.threads import start_new_thread
from jsb.version import version
## basic imports
from SocketServer import Ba... | Python |
# jsb/errors.py
#
#
""" jsb exceptions. """
## jsb imports
from jsb.utils.trace import calledfrom
## basic imports
import sys
## exceptions
class JsonBotError(Exception):
pass
class NotConnected(JsonBotError):
pass
class FeedAlreadyExists(JsonBotError):
pass
class NoSuchFile(JsonBotError):
... | Python |
# jsb/tasks.py
#
#
## jsb imports
from jsb.utils.trace import calledfrom
from jsb.lib.plugins import plugs
## basic imports
import logging
import sys
## TaskManager class
class TaskManager(object):
def __init__(self):
self.handlers = {}
self.plugins = {}
def add(self, taskname, func):
... | Python |
# jsb/threadloop.py
#
#
""" class to implement start/stoppable threads. """
## lib imports
from jsb.utils.exception import handle_exception
from threads import start_new_thread, getname
## basic imports
import Queue
import time
import logging
## ThreadLoop class
class ThreadLoop(object):
""" implement start... | Python |
# jsb/examples.py
#
#
""" examples is a dict of example objects. """
## basic imports
import re
## Example class
class Example(object):
""" an example. """
def __init__(self, descr, ex):
self.descr = descr
self.example = ex
## Collection of exanples
class Examples(dict):
""" exampl... | Python |
# jsb/lib/waiter.py
#
#
""" wait for events. """
## jsb imports
from jsb.lib.runner import waitrunner
from jsb.utils.trace import whichmodule
from jsb.utils.exception import handle_exception
## basic imports
import logging
import copy
import types
import time
import uuid
## defines
cpy = copy.deepcopy
## Wait c... | Python |
# jsb/eventhandler.py
#
#
""" event handler. use to dispatch function in main loop. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.locking import lockdec
from threads import start_new_thread
## basic imports
import Queue
import thread
import logging
import time
## locks
handle... | Python |
# jsb package
#
#
""" jsb core package. """
__version__ = "0.8"
import warnings
warnings.simplefilter('ignore')
| Python |
# jsb/jsbimport.py
#
#
""" use the imp module to import modules. """
## basic imports
import time
import sys
import imp
import os
import thread
import logging
## _import function
def _import(name):
""" do a import (full). """
mods = []
mm = ""
for m in name.split('.'):
mm += m
mods.... | Python |
# jsb/callbacks.py
#
#
"""
bot callbacks .. callbacks take place on registered events. a precondition
function can optionaly be provided to see if the callback should fire.
"""
## jsb imports
from threads import getname, start_new_thread
from jsb.utils.locking import lockdec
from jsb.utils.exception impo... | Python |
# jsb/socklib/partyline.py
#
#
""" provide partyline functionality .. manage dcc sockets. """
__copyright__ = 'this file is in the public domain'
__author__ = 'Aim'
## jsb imports
from jsb.lib.fleet import getfleet
from jsb.utils.exception import handle_exception
from jsb.lib.threads import start_new_thread
from j... | Python |
# jsb/lib/factory.py
#
#
""" Factory to produce instances of classes. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.lib.errors import NoSuchBotType
## basic imports
import logging
## Factory base class
class Factory(object):
pass
## BotFactory class
class BotFactory(Factory)... | Python |
# jsb/runner.py
#
#
""" threads management to run jobs. """
## jsb imports
from jsb.lib.threads import getname, start_new_thread, start_bot_command
from jsb.utils.exception import handle_exception
from jsb.utils.locking import locked, lockdec
from jsb.utils.lockmanager import rlockmanager, lockmanager
from jsb.utils... | Python |
# jsb/persiststate.py
#
#
""" persistent state classes. """
## jsb imports
from jsb.utils.name import stripname
from jsb.utils.trace import calledfrom
from persist import Persist
from jsb.lib.datadir import getdatadir
## basic imports
import types
import os
import sys
import logging
## PersistState classes
class... | Python |
# jsb/cache.py
#
#
""" jsb cache provding get, set and delete functions. """
## basic imports
import logging
## defines
cache = {}
## functions
def get(name, namespace=""):
""" get data from the cache. """
global cache
try:
data = cache[name]
if data: logging.debug("cache - returning... | Python |
'''
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... | Python |
'''
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... | Python |
'''
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 = ""
... | Python |
'''
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 = ""
... | Python |
'''
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... | Python |
'''
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... | Python |
""" YABEE (Yet another Blender's egg-exporter)
for Blender 2.59
rev 11.1
"""
# -------------- Change this to setup parameters -----------------------
#: file name to write
FILE_PATH = './exp_test/test.egg'
#: { 'animation_name' : (start_frame, end_frame, frame_rate) }
ANIMATIONS = {'anim1':(0,10,5),
... | Python |
""" Part of the YABEE
rev 1.1
"""
bl_info = {
"name": "Panda3d EGG format",
"author": "Andrey (Ninth) Arbuzov",
"blender": (2, 6, 0),
"api": 41226,
"location": "File > Import-Export",
"description": ("Export to Panda3D EGG: meshes, uvs, materials, textures, "
"armatures, ... | Python |
"""
Part of the YABEE
rev 1.2
"""
import bpy
if __name__ != '__main__':
from io_scene_egg.yabee_libs.utils import convertFileNameToPanda, save_image
BAKE_TYPES = {'diffuse': ('TEXTURE', 'MODULATE'),
'normal': ('NORMALS', 'NORMAL'),
'gloss': ('SPEC_INTENSITY', 'GLOSS'),
... | Python |
"""
Part of the YABEE
rev 1.1
"""
import bpy, os, sys, shutil
def convertFileNameToPanda(filename):
""" (Get from Chicken) Converts Blender filenames to Panda 3D filenames.
"""
path = filename.replace('//', './').replace('\\', '/')
if os.name == 'nt' and path.find(':') != -1:
path = '/'+ path[0].... | Python |
""" Part of the YABEE
rev 11.2
"""
import bpy, os, sys, shutil
from mathutils import *
from math import pi
import io_scene_egg.yabee_libs.tbn_generator
from io_scene_egg.yabee_libs.texture_processor import SimpleTextures, TextureBaker
from io_scene_egg.yabee_libs.utils import *
import imp
imp.reload(io_scene_egg.y... | Python |
"""
Part of the YABEE
rev 1
"""
import bpy
from mathutils import *
class TBNGenerator():
def __init__(self,obj):
self.obj_ref = obj
self.triangles = None
self.uv_layers = None
def generate(self):
tris = []
fidxs = 0
for face in self.obj_ref... | 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 |
# Pseudo-Python rendition of the code for ``get_next_access_unit()``.
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of ... | Python |
#! /usr/bin/env python
"""Build HTML from the reStructuredText files in this directory.
This is a script just so I don't have to remember the particular incantation
required. It's not in the Makefile because I'm not yet sure it belongs there...
Requires Python and docutils.
Uses rst2html.py on individual files becau... | Python |
#! /usr/bin/env python
"""Run the doctest on a text file
Usage: doctext.py [file]
[file] defaults to ``test.txt``
"""
import sys
import doctest
def main():
args = sys.argv[1:]
filename = None
verbose = False
for word in args:
if word in ("-v", "-verbose"):
verbose = True
... | Python |
"""Setup.py -- for building tstools Pyrex modules
"""
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#... | Python |
"""tstools -- a package of Pyrex bindings for the tstools
This is being developed on a Mac, running OS X, and also tested on my Ubuntu
system at work.
I do not expect it to build (as it stands) on Windows, as it is making
assumptions that may not follow thereon.
It is my intent to worry about Windows after it works ... | Python |
#! /usr/bin/env python
"""sockread.py -- a simple client to read from a socket
"""
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obta... | Python |
#! /usr/bin/env python
"""socktest.py -- a simple client to talk to tsserve
Command line - optionally:
-host <host> defaults to "localhost"
-port <port> defaults to 8889
-output <filename> defaults to None
-file <filename> the same
-nonblock the socket should ... | Python |
"""
>>> from gmapi import maps
# Test Map creation.
>>> m = maps.Map()
>>> m
{'arg': ['div'], 'cls': 'Map'}
# Test setting and getting the map center.
>>> m.setCenter(maps.LatLng(38, -97))
>>> m.getCenter()
{'arg': [38, -97], 'cls': 'LatLng'}
# Test setting the map type.
>>> m.setMapTypeId(maps.MapTypeId.ROADMAP)
>>... | Python |
from django.utils.http import urlquote_plus
def urlencode(query, doseq=0, safe=''):
"""Custom urlencode that leaves static map delimiters ("|", ",", ":") alone.
Based on Django's unicode-safe version of urllib.quote_plus.
"""
safe = safe + '|,:'
if hasattr(query, 'items'):
query = query.... | Python |
"""URL pattern for serving static media. Use only to DEBUG!
Add something like the following to the bottom of your urls.py:
from django.conf import settings
if settings.DEBUG:
urlpatterns = patterns('',
(r'', include('gmapi.urls.media')),
) + urlpatterns
"""
from os import path
from django.conf import... | Python |
"""Implements the Google Maps API v3."""
import time
import urllib
from django.conf import settings
from django.core.cache import cache
from django.utils.encoding import force_unicode, smart_str
from django.utils.simplejson import loads
from gmapi.utils.http import urlencode
STATIC_URL = getattr(settings, 'GMAPI_STAT... | Python |
"""Custom Map widget."""
from django.conf import settings
from django.forms.forms import Media
from django.forms.util import flatatt
from django.forms.widgets import Widget
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.simplejson import dumps
from gmapi import maps... | Python |
from distutils.core import setup
import os
# Compile the list of packages available, because distutils doesn't have
# an easy way to do this.
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
for dirpath, dirnames, filenames in os.walk('gmapi'):
# Ignore dirna... | Python |
# -*- coding: utf-8 -*-
"""Setup script for django-gae2django."""
import os
from distutils.core import setup
def find_packages(base_dir):
yield base_dir
for fname in os.listdir(base_dir):
if fname.startswith('.'):
continue
fullpath = os.path.join(base_dir, fname)
if os.p... | Python |
#!/usr/bin/env python
import gae2django
gae2django.install()
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 yo... | Python |
from django.db import models
from gaeapi.appengine.ext import db
class RefTestModel(db.Model):
value = db.StringProperty()
class RegressionTestModel(db.Model):
xstring = db.StringProperty()
xlist = db.ListProperty(str)
xuser = db.UserProperty(auto_current_user_add=True)
ref = db.ReferenceProper... | Python |
#!/usr/bin/python2.4
#
# Copyright 2008 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 |
#
# Copyright 2008 Andi Albrecht <albrecht.andi@gmail.com>
#
# 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... | Python |
#
# Copyright 2008 Andi Albrecht <albrecht.andi@gmail.com>
#
# 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... | Python |
from django.http import HttpResponse
from django.template import Context, Template
from gaeapi.appengine.api import users
def test(request):
t = Template('Test view')
c = Context({'user': request.user,
'is_admin': users.is_current_user_admin()})
return HttpResponse(t.render(c))
| Python |
#
# Copyright 2008 Andi Albrecht <albrecht.andi@gmail.com>
#
# 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... | Python |
#
# Copyright 2008 Andi Albrecht <albrecht.andi@gmail.com>
#
# 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... | Python |
#
# Copyright 2008 Andi Albrecht <albrecht.andi@gmail.com>
#
# 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... | Python |
# Customized version of Google's GQL class (google.appengine.ext.gql.GQL).
import datetime
import heapq
import logging
import re
import time
from gaeapi.appengine.api import datastore
from gaeapi.appengine.api import users
from gaeapi.appengine.ext import db
LOG_LEVEL = logging.DEBUG - 1
# Hacks
ASCENDING = 1
DESCE... | Python |
import base64
import binascii
import cPickle
import logging
import os
import random
import re
import time
import types
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.model... | Python |
from django.conf import settings
from django.contrib.auth.models import User
def get_current_user():
from gae2django import middleware
return middleware.get_current_user()
def is_current_user_admin():
user = get_current_user()
if user:
return user.is_superuser
return False
def create_l... | Python |
#
# Copyright 2008 Andi Albrecht <albrecht.andi@gmail.com>
#
# 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... | Python |
class Query(dict):
def __init__(self, model_class):
self._model_cls = model_class
def filter(self, property_operator, value):
raise NotImplementedError
def order(self, property):
raise NotImplementedError
def ancestor(self, ancestor):
raise NotImplementedError
de... | Python |
#
# Copyright 2008 Andi Albrecht <albrecht.andi@gmail.com>
#
# 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... | Python |
"""Stub XMPP module that does nothing except exposing the API."""
NO_ERROR = 0
INVALID_JID = 1
OTHER_ERROR = 2
MESSAGE_TYPE_CHAT = 'chat'
MESSAGE_TYPE_ERROR = 'error'
MESSAGE_TYPE_GROUPCHAT = 'groupchat'
MESSAGE_TYPE_HEADLINE = 'headline'
MESSAGE_TYPE_NORMAL = 'normal'
class Error(Exception):
pass
class Invali... | Python |
#
# Copyright 2008 Andi Albrecht <albrecht.andi@gmail.com>
#
# 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... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
(r'', 'gae2django.views.test'),
)
| Python |
# Django settings for django_gae2django project.
# NOTE: Keep the settings.py in examples directories in sync with this one!
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql'... | Python |
#!/usr/bin/env python
import gae2django
# Use gae2django.install(server_software='Dev') to enable a link to the
# admin frontend at the top of each page. By default this link is hidden.
gae2django.install(server_software='Django')
from django.core.management import execute_manager
try:
import settings # Assumed to... | Python |
# Django settings for django_gae2django project.
# NOTE: Keep the settings.py in examples directories in sync with this one!
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresq... | Python |
from django.db import models
# Create your models here.
| Python |
from django.conf.urls.defaults import *
from django.contrib import admin
from codereview.urls import urlpatterns
admin.autodiscover()
urlpatterns = patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': 'static/'}),
(r'^accounts/login/$', 'django.contrib.auth.... | Python |
from django.contrib.messages.api import get_messages
from codereview import models
class DisableCSRFMiddleware(object):
"""This is a BAD middleware. It disables CSRF protection.
If someone comes up with a smart approach to make upload.py work
with Django's CSRF protection, please submit a patch!
"""... | Python |
from django.contrib import admin
from codereview import models
# Patch in some simple lambda's, Django uses them.
#models.Issue.__unicode__ = lambda self: self.subject
#models.PatchSet.__unicode__ = lambda self: self.message or ''
#class PatchSetInlineAdmin(admin.TabularInline):
# model = models.PatchSet
#clas... | Python |
from django.http import HttpResponseRedirect
def admin_redirect(request):
return HttpResponseRedirect('/admin/')
| Python |
from django import template
from django.db.models.signals import post_save
from django.contrib.auth.models import AnonymousUser, User
from codereview import library
from gae2django.utils import CallableString
def nickname(email, arg=None):
if isinstance(email, AnonymousUser):
email = None
elif isinst... | Python |
# Copyright 2011 Tobias Rodaebel
#
# 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 agreed to in writi... | Python |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | Python |
# -*- coding: utf-8 -*-
#
# Copyright 2011 Tobias Rodäbel
#
# 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 ... | Python |
# -*- coding: utf-8 -*-
#
# Copyright 2011 Tobias Rodäbel
#
# 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 ... | Python |
def webapp_add_wsgi_middleware(app):
from google.appengine.ext.appstats import recording
app = recording.appstats_wsgi_middleware(app)
return app
| Python |
# Python package
from test_handlers import *
from test_json_rpc import *
from test_sync import *
| Python |
# -*- coding: utf-8 -*-
#
# Copyright 2010, 2011 Florian Glanzner (fgl), Tobias Rodäbel
#
# 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
#
# ... | Python |
# -*- coding: utf-8 -*-
#
# Copyright 2011 Tobias Rodäbel
#
# 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 ... | Python |
# -*- coding: utf-8 -*-
#
# Copyright 2011 Tobias Rodäbel
#
# 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 ... | 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.