code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/python
import os
virtenv = os.environ['APPDIR'] + '/virtenv/'
os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib/python2.6/site-packages')
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
pass
#
# IMPORTANT: Put ... | Python |
#!/usr/bin/env python
# coding=utf-8
# Contributor:
# Phus Lu <phus.lu@gmail.com>
__version__ = '1.10.1'
__password__ = ''
import sys, os, time, struct, zlib, binascii, logging, httplib, urlparse
try:
from google.appengine.api import urlfetch
from google.appengine.runtime import apiproxy_errors, D... | Python |
import cgi
import datetime
import logging
import urlparse
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import memcache
from google.appengine.api import urlfetch
logging.getLogger().setLevel(logging.DEBUG)
class MainPage(webapp.RequestHan... | Python |
import cgi
import urlparse
import wsgiref.handlers
from google.appengine.api import urlfetch
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
def getOpmServer():
opmServers = []
opmServers.append('http://rogerxu-opm.appspo... | Python |
import cgi
import urlparse
import wsgiref.handlers
from google.appengine.api import urlfetch
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
def getOpmServer():
opmServers = []
opmServers.append('http://rogerxu-opm.appspo... | Python |
import cgi
import datetime
import time
import urlparse
import wsgiref.handlers
from google.appengine.api import urlfetch
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
def getOpmServer(index):
opmServers = []
opmServers.... | Python |
#!/usr/bin/env python
# coding=utf-8
# Based on GAppProxy by Du XiaoGang <dugang@188.com>
# Based on WallProxy 0.4.0 by hexieshe <www.ehust@gmail.com>
__version__ = '1.8.5'
__author__ = 'phus.lu@gmail.com'
__password__ = ''
import sys, os, re, time, struct, zlib, binascii, logging
try:
from google.appengine.api ... | Python |
#-*- coding:utf8 -*-
import config
from lib import verify
from app.base import BaseHandler
import time
import hashlib
class MemberHandler(BaseHandler):
def get(self):
self.display('reg.html', msg=[], parame={})
def post(self):
email = self.get_argument('email', '')
... | Python |
#-*- coding:utf8 -*-
'''
Created on 2012-7-13
@author: Bise
'''
import config
import time
from base import BaseHandler
import tornado.ioloop
from tornado.web import asynchronous
import json
class CometHandler(BaseHandler):
def initialize(self, method = ''):
self.__method = method
... | Python |
#-*- coding:utf8 -*-
'''
Created on 2012-7-4
@author: Bise
'''
from lib.session import Session
import tornado.template
import tornado.web
import config
class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self):
s = Session(self)
islogin = s.get('login')
if is... | Python |
#-*- coding:utf8 -*-
import config
import time
from app.base import BaseHandler
import htmlentitydefs
import re
from lib.session import Session
from tornado.web import authenticated
class QuestionHandler(BaseHandler):
def initialize(self, method = ''):
self.__method = method
... | Python |
#-*- coding:utf8 -*-
import config
import time
from lib.session import Session
from base import BaseHandler
from lib import verify
import hashlib
import urllib
import json
class IndexHandler(BaseHandler):
def initialize(self, method = ''):
self.__method = method
def get(self):
... | Python |
#-*- coding:utf8 -*-
'''
Created on 2012-7-5
@author: Bise
'''
import config
import time
import cgi
from app.base import BaseHandler
from lib.session import Session
from tornado.web import authenticated
AT_THANKS = 0
AT_NOTHELP = 1
AT_HELP = 2
class AnswerHandler(BaseHandler):
def initial... | Python |
#-*- coding:utf8 -*-
import os
from tornado import database
import struct,socket
from lib import session
import datetime
settings = {
"template": os.path.join(os.path.dirname(__file__), "template/default"),
"session": os.path.join(os.path.dirname(__file__), "temp/session"),
"db": {
"h... | Python |
#-*- coding:utf8 -*-
import os
import config
import tornado.httpserver
import tornado.ioloop
import tornado.autoreload
from app.member import MemberHandler
from app.question import QuestionHandler
from app.index import IndexHandler
from app.answer import AnswerHandler
from app.comet import CometHandler
app... | Python |
#-*- coding:utf8 -*-
import types
import re
def IsNumber(varObj):
return type(varObj) is types.IntType
def IsString(varObj):
return type(varObj) is types.StringType
def IsFloat(varObj):
return type(varObj) is types.FloatType
def IsDict(varObj):
return type(varObj) is types.DictType
... | Python |
#-*- coding:utf8 -*-
import pickle
import uuid
class Session:
__path = ''
__settings = {}
@staticmethod
def getVersion():
return 'v0.0.1'
@classmethod
def setPath(cls, path):
cls.__path = path
def __init__(self, req = None):
if req... | Python |
###############################################################
#
# Gesture Recognizer Test-Bed
#
# (c) Oct. 2008, Sven Kratz, Deutsche Telekom Laboratories, TU Berlin
###############################################################
import e32, graphics, sysinfo
import appuifw
import axyz
import audio
from... | Python |
##############################################################
#
# GestureLibrary.py -- Library for gesture data captured with WiiMote
#
# (c) Sven Kratz, Deutsche Telekom Labs, TU Berlin, 2008
#
# Saves and loads captured gesture data to and from disk.
#
# ++PyS60 Version++
#
###############################... | Python |
##############################################################
#
# GestureRec3D.py -- 1$ Gesture Recognizer in 3D
#
# (c) Sven Kratz, Deutsche Telekom Labs, TU Berlin, 2008
#
# Implements the 1$ Gesture Recongizer with modification for
# 3D Data from Wii-Controller
# Modified GSS Search
# Custom Scoring Heuris... | Python |
from google.appengine.ext import db
class Level(db.Model):
"""Holds meta-data for a level in the game."""
owner = db.UserProperty()
level = db.StringProperty(required=True)
next_level = db.StringProperty(default='')
base_rows = db.IntegerProperty(required=True)
static_blocks = db.TextProperty(required=Tru... | Python |
# Copyright 2011 Google Inc. All Rights Reserved.
# pylint: disable-msg=C6409,C6203
"""Separate models module for IAP Hello World."""
__author__ = 'dhermes@google.com (Danny Hermes)'
# standard library imports
import os
import pickle
import time
# third-party imports
from google.appengine.api import users
from goo... | Python |
OPEN_ID_PROVIDERS = (
('Google', 'www.google.com/accounts/o8/id'),
('Yahoo', 'yahoo.com'),
('MySpace', 'myspace.com'),
('AOL', 'aol.com'),
('MyOpenID', 'myopenid.com'),
)
POSTBACK_URL = 'http://iap-hello-world.appspot.com/postback-verify'
| Python |
""" JSON Web Token implementation
Minimum implementation based on this spec:
http://self-issued.info/docs/draft-jones-json-web-token-01.html
"""
import base64
import hashlib
import hmac
try:
import json
except ImportError:
import simplejson as json
__all__ = ['encode', 'decode', 'DecodeError']
class Dec... | Python |
SELLER_ID = "BOGUS_ID"
SELLER_SECRET = "BOGUS_KEY"
| Python |
from main import DBPIckle
from models import Level
level_one = Level(level='1', next_level='2', base_rows=4,
static_blocks=DBPIckle({7: [4, 5], 13: [4], 17: [4, 5]}),
move_blocks=DBPIckle({2: [4], 10: [4]}),
door=DBPIckle({'row': 4, 'column': 23}),
... | Python |
import string
def main():
inuser = input("Enter a string:")
message = ""
for b in inuser:
message = b + message
print(message)
main()
| Python |
import string
def main():
inuser = input("Enter a string:")
message = ""
for b in inuser:
message = b + message
print(message)
//addind this just to be able to create a conflict
main()
| Python |
def main():
phones_names = {"sam": 123, "john": 456, "ron" :789}
print(phones_names.keys())
print(phones_names['sam'], 'sam')
for i in phones_names:
print(i,phones_names[i])
//add to create conflict
main()
| Python |
#! /usr/bin/env python
# Hey, Emacs! This is -*-python-*-.
#
# Copyright (C) 2003 Joel Rosdahl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your o... | Python |
#! /usr/bin/env python
# Hey, Emacs! This is -*-python-*-.
#
# Copyright (C) 2003 Joel Rosdahl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your o... | Python |
#!/usr/bin/env python
# $Id$
# stdlib
import cPickle as pickle, os, random, re, socket, sys, time, traceback, urllib, struct
# third-party
import GeoIP
from lib import ircbot, irclib
# local
from lib import asinfo, dialect, masl, phone, translate, unaccent, wikilog, yahoo
decorator_with_args = lambda decorator: la... | Python |
#!/usr/bin/env python
# $Id: a2bot.py 2 2009-04-10 20:13:54Z dugsong $
# stdlib
import cPickle as pickle, os, random, re, socket, sys, time, traceback, urllib, struct
# third-party
import GeoIP
from lib import ircbot, irclib
# local
from lib import asinfo, dialect, masl, phone, translate, unaccent, wikilog, yahoo
... | Python |
#!/usr/bin/env python
import cgi, re, time
def main():
form = cgi.FieldStorage()
channel = form.getfirst('channel') or '#dev'
date = form.getfirst('date') or time.strftime('%m/%d/%Y')
filename = channel + '_' + date.replace('/', '-')
print """Content-type: text/html
<!DOCTYPE HTML PUBLIC "-/... | Python |
#!/usr/bin/env python
import cgi, re, time
def main():
form = cgi.FieldStorage()
channel = form.getfirst('channel') or '#dev'
date = form.getfirst('date') or time.strftime('%m/%d/%Y')
filename = channel + '_' + date.replace('/', '-')
print """Content-type: text/html
<!DOCTYPE HTML PUBLIC "-/... | Python |
# $Id: translate.py 2 2009-04-10 20:13:54Z dugsong $
try:
import json
except ImportError:
import simplejson as json
import urllib, urllib2
def translate(lang_from, lang_to, text):
url = 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&'
if not lang_from or lang_from == 'auto':
... | Python |
# Copyright (C) 1999--2002 Joel Rosdahl
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is ... | Python |
# $Id: wiki.py 2 2009-04-10 20:13:54Z dugsong $
import string, xmlrpclib
from wiki_keys import USERNAME, PASSWORD
all = string.maketrans('', '')
non_printable = all.translate(all, string.printable)
def asciify(txt):
"""Strip any non-printable ASCII chars."""
return txt.translate(all, non_printable)
class Wi... | Python |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-structur... | Python |
# Copyright (C) 1999--2002 Joel Rosdahl
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is ... | Python |
import re, urllib
__pat = re.compile(r'(?P<short_url>http://monkey.org/sl/[a-z0-9]+)</a>')
def shorten(url, desc):
f = urllib.urlopen('http://monkey.org/cgi-bin/masl.cgi?%s' %
urllib.urlencode({ 'long_link':url, 'desc':desc }))
buf = f.read()
m = __pat.search(buf)
if m:
... | Python |
# $Id: wikilog.py 2 2009-04-10 20:13:54Z dugsong $
import os, sys, time
import wiki
class Logger(object):
"""Irssi-compatible logger, with scheduled daily uploads to the wiki."""
def __init__(self, logdir, timeout_fn=None):
self.logdir = logdir
self.channels = {}
self.timeout_fn =... | Python |
# $Id: phone.py 2 2009-04-10 20:13:54Z dugsong $
import re
import BeautifulSoup
import soundex, wiki
tag_re = re.compile("</?[a-z0-9A-Z]+.*?>|<!.*?-->", re.M|re.S)
ws_re = re.compile("[ \t\r\n]+")
def html2txt(s):
# XXX
s = s.replace(' ', '')
s = s.replace('+', '+')
txt = tag_re.sub('', s)... | Python |
# $Id: soundex.py 2 2009-04-10 20:13:54Z dugsong $
def soundex(name, len=4):
""" soundex module conforming to Knuth's algorithm
implementation 2000-12-24 by Gregory Jorgensen
public domain
"""
# digits holds the soundex values for the alphabet
digits = '01230120022455012623010202'
sndx = ''... | Python |
import csv, urllib
from xml.dom import minidom
APPID = 'gZoapAXV34FkztB4Db5yj5fb4ij7jfQsaUzajLvXx_GYYnVHKpvTq3dumcGrrw--'
def geocode(location):
url = 'http://api.local.yahoo.com/MapsService/V1/geocode?' + \
urllib.urlencode({'appid':APPID, 'location':location})
buf = urllib.urlopen(url).read()
... | Python |
import os, socket
def _rev_ip(iptxt):
try:
l = iptxt.split('/')
if len(l) > 1:
n = { '8':1, '16':2, '24':3, '32':4 }[l[1]]
else:
n = 4
ai = socket.getaddrinfo(l[0], 0)
octs = ai[0][4][0].split('.')[:n]
except:
return None
octs.reverse... | Python |
# $Id: dialect.py 2 2009-04-10 20:13:54Z dugsong $
import re
class Dialectizer(object):
def process(self, text):
# called from handle_data
# Process text block by performing series of regular expression
# substitutions (actual substitions are defined in descendant)
for fromPattern, toPattern in self.subs:
... | Python |
#!/usr/bin/python
#
# Copyright (C) 2012 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 ... | Python |
#!/usr/bin/python
#
# Copyright (C) 2012 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 ... | Python |
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
... | Python |
"""
iri2uri
Converts an IRI to a URI.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = []
__version__ = "1.0.0"
__license__ = "MIT"
__history__ = """
"""
import urlparse
# Convert an IRI to a URI following the rules in RFC 3987
#
# The characte... | Python |
from __future__ import generators
"""
httplib2
A caching http interface that supports ETags and gzip
to conserve bandwidth.
Requires Python 2.3 or later
Changelog:
2007-08-18, Rick: Modified so it's able to use a socks proxy if needed.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright... | Python |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | Python |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | Python |
# This is the version of this source code.
manual_verstr = "1.5"
auto_build_num = "211"
verstr = manual_verstr + "." + auto_build_num
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil insta... | Python |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 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 ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 2011 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 agreed to in writ... | Python |
# Copyright 2011 Google Inc. All Rights Reserved.
"""Multi-credential file store with lock support.
This module implements a JSON credential store where multiple
credentials can be stored in one file. That file supports locking
both in a single process and across processes.
The credential themselves are keyed off o... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 2007 Joe Gregorio
#
# Licensed under the MIT License
"""MIME-Type Parser
This module provides basic functions for handling mime-types. It can handle
matching mime-types against a list of media-ranges. See section 14.1 of the
HTTP specification [RFC 2616] for a complete explanation.
http://www.w3.o... | Python |
#!/usr/bin/python2.4
#
# Copyright (C) 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 l... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
#!/usr/bin/python2.4
#
# Copyright (C) 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 l... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
import Cookie
import datetime
import time
import email.utils
import calendar
import base64
import hashlib
import hmac
import re
import logging
# Ripped from the Tornado Framework's web.py
# http://github.com/facebook/tornado/commit/39ac6d169a36a54bb1f6b9bf1fdebb5c9da96e09
#
# Tornado is licensed under the Apache Licen... | Python |
#!/usr/bin/env python
#
# Copyright (c) 2002, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this ... | Python |
#!/usr/bin/env python
# Copyright (c) 2010, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this l... | Python |
# Early, and incomplete implementation of -04.
#
import re
import urllib
RESERVED = ":/?#[]@!$&'()*+,;="
OPERATOR = "+./;?|!@"
EXPLODE = "*+"
MODIFIER = ":^"
TEMPLATE = re.compile(r"{(?P<operator>[\+\./;\?|!@])?(?P<varlist>[^}]+)}", re.UNICODE)
VAR = re.compile(r"^(?P<varname>[^=\+\*:\^]+)((?P<explode>[\+\*])|(?P<part... | Python |
import re
import sys
def a5result_readline(fname):
a5result = {}
with open(fname) as f:
content = f.readlines()
for line in content:
if line[0] != 'S':
continue
tokens = re.split(' |=|\t', line)
a5result[tokens[2]] = tokens[-1]
return ... | Python |
#!/usr/bin/python
#
# Copyright (C) 2012 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 ... | Python |
#!/usr/bin/python
#
# Copyright (C) 2012 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 ... | Python |
#!/usr/bin/env python
#
# Copyright (c) 2002, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this ... | Python |
#!/usr/bin/env python
# Copyright (c) 2010, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this l... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 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 ... | Python |
# Copyright 2011 Google Inc. All Rights Reserved.
"""Locked file interface that should work on Unix and Windows pythons.
This module first tries to use fcntl locking to ensure serialized access
to a file, then falls back on a lock file if that is unavialable.
Usage:
f = LockedFile('filename', 'r+b', 'rb')
f.... | Python |
# Copyright 2011 Google Inc. All Rights Reserved.
"""Multi-credential file store with lock support.
This module implements a JSON credential store where multiple
credentials can be stored in one file. That file supports locking
both in a single process and across processes.
The credential themselves are keyed off o... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 2011 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
__version__ = "1.0c2"
| Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 2012 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 agreed to in writ... | Python |
# Copyright (C) 2007 Joe Gregorio
#
# Licensed under the MIT License
"""MIME-Type Parser
This module provides basic functions for handling mime-types. It can handle
matching mime-types against a list of media-ranges. See section 14.1 of the
HTTP specification [RFC 2616] for a complete explanation.
http://www.w3.o... | Python |
# Copyright (C) 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 agreed to in writ... | Python |
# Copyright (C) 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 agreed to in writ... | 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.