code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/python2.5 # 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/python2.5 # 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/python2.5 # 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/python2.5 # 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/python2.5 # 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/python2.5 # 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 l...
Python
#!/usr/bin/python2.5 # 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/python2.5 # 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/python2.5 # 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
# Copyright 2005-2008 Ka-Ping Yee # # 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 wri...
Python
#!/usr/bin/python2.5 # 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/python2.5 # 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 google.appengine.ext import db class Realtor(db.Model): name = db.StringProperty() email = db.StringProperty() phone = db.StringProperty() date = db.DateTimeProperty(auto_now_add=True) class Listing(db.Model): name = db.StringProperty() author = db.UserProperty() realtor = db.Referenc...
Python
import os import wsgiref.handlers from google.appengine.ext.webapp.util import run_wsgi_app, login_required from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext import db import gdata.gauth import gdata.photos.service...
Python
#!/usr/bin/env python """ asciidocapi - AsciiDoc API wrapper class. The AsciiDocAPI class provides an API for executing asciidoc. Minimal example compiles `mydoc.txt` to `mydoc.html`: import asciidocapi asciidoc = asciidocapi.AsciiDocAPI() asciidoc.execute('mydoc.txt') - Full documentation in asciidocapi.txt. ...
Python
#!/usr/bin/env python """ asciidocapi - AsciiDoc API wrapper class. The AsciiDocAPI class provides an API for executing asciidoc. Minimal example compiles `mydoc.txt` to `mydoc.html`: import asciidocapi asciidoc = asciidocapi.AsciiDocAPI() asciidoc.execute('mydoc.txt') - Full documentation in asciidocapi.txt. ...
Python
#!/usr/bin/env python USAGE = '''Usage: testasciidoc.py [OPTIONS] COMMAND Run AsciiDoc conformance tests specified in configuration FILE. Commands: list List tests run [NUMBER] [BACKEND] Execute tests update [NUMBER] [BACKEND] Regenerate and update test data Options: -f, ...
Python
#!/usr/bin/env python ''' a2x - A toolchain manager for AsciiDoc (converts Asciidoc text files to other file formats) Copyright: Stuart Rackham (c) 2009 License: MIT Email: srackham@gmail.com ''' import os import fnmatch import HTMLParser import re import shutil import subprocess import sys import traceb...
Python
#!/usr/bin/env python """ asciidoc - converts an AsciiDoc text file to HTML or DocBook Copyright (C) 2002-2010 Stuart Rackham. Free use of this software is granted under the terms of the GNU General Public License (GPL). """ import sys, os, re, time, traceback, tempfile, subprocess, codecs, locale, unicodedata ### U...
Python
#!/usr/bin/env python ''' NAME latex2png - Converts LaTeX source to PNG file SYNOPSIS latex2png [options] INFILE DESCRIPTION This filter reads LaTeX source text from the input file INFILE (or stdin if INFILE is -) and renders it to PNG image file. Typically used to render math equations. Requ...
Python
#!/usr/bin/env python import os, sys, subprocess from optparse import * __AUTHOR__ = "Gouichi Iisaka <iisaka51@gmail.com>" __VERSION__ = '1.1.4' class EApp(Exception): '''Application specific exception.''' pass class Application(): ''' NAME graphviz2png - Converts textual graphviz notation to PNG fi...
Python
#!/usr/bin/env python ''' NAME code-filter - AsciiDoc filter to highlight language keywords SYNOPSIS code-filter -b backend -l language [ -t tabsize ] [ --help | -h ] [ --version | -v ] DESCRIPTION This filter reads source code from the standard input, highlights language keywords and ...
Python
#!/usr/bin/env python ''' NAME music2png - Converts textual music notation to classically notated PNG file SYNOPSIS music2png [options] INFILE DESCRIPTION This filter reads LilyPond or ABC music notation text from the input file INFILE (or stdin if INFILE is -), converts it to classical music notation...
Python
#!/bin/env python import xml.dom.minidom as dom import sys import struct WEAP_NUM = 780 struct_fmt = "<H BBHBBBB 8B8B8b8b8b8b8H bbBBBB" def pack_weapon(dict): l = [] l.append(dict['drain']) l.append(dict['shotRepeat']) l.append(dict['multi']) l.append(dict['weapAni']) l.append(dict['max']) l.append(dict['tx...
Python
#Fredkin gate structure program #Constant Definitions DEBUG = 1 cfgfileopen = open("Input.cfg","r"); splitline = cfgfileopen.readline().split(); print splitline[4]; ctrlvarno = splitline[4]; splitline = cfgfileopen.readline().split(); print splitline[2]; splitline = cfgfileopen.readline().split(); print splitline[2...
Python
#!/usr/bin/env python # # Copyright 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 o...
Python
from apiclient import discovery, model from apiclient.http import BatchHttpRequest import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() query1 = [{"name~=":"*doubt*","name":None,"type":"/media_common/quotation","author":[{"name":"William Shakespeare"}]}] query2 = [{"name~=":"*law*","n...
Python
from apiclient import discovery from apiclient import model import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() model.JsonModel.alt_param = "" freebase = discovery.build('freebase', 'v1', developerKey=api_key) topic = freebase.topic.lookup(id='/en/san_francisco').execute() for prope...
Python
from apiclient import discovery, model import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() query = [{'id': None, 'name': None, 'type': '/astronomy/planet'}] model.JsonModel.alt_param = "" freebase = discovery.build('freebase', 'v1', developerKey=api_key) response = json.loads(freeb...
Python
from apiclient import discovery from apiclient import model import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() model.JsonModel.alt_param = "" freebase = discovery.build('freebase', 'v1', developerKey=api_key) response = freebase.search(query='John Smith').execute() for result in re...
Python
from apiclient import discovery from apiclient import model import json import Image import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() model.JsonModel.alt_param = "" freebase = discovery.build('freebase', 'v1sandbox', developerKey=api_key) response = freebase.image(id='/en/espresso').execut...
Python
from apiclient import discovery from apiclient import model import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() model.JsonModel.alt_param = "" freebase = discovery.build('freebase', 'v1', developerKey=api_key) response = freebase.text(id='en/bob_dylan').execute() print response
Python
import json import MimeWriter import mimetools import urllib import urllib2 import StringIO import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() service_url = 'https://www.googleapis.com/freebase/v1/mqlread' def write_query_request(writer, query_name, query, service_url, api_key): params = { ...
Python
import json import urllib import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() service_url = 'https://www.googleapis.com/freebase/v1/topic' topic_id = '/m/0d6lp' params = { 'key': api_key, 'filter': 'suggest' } url = service_url + topic_id + '?' + urllib.urlencode(params) topic = json.loads(u...
Python
import json import urllib import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() service_url = 'https://www.googleapis.com/freebase/v1/mqlread' query = [{'id': None, 'name': None, 'type': '/astronomy/planet'}] params = { 'query': json.dumps(query), 'key': api_key } url = service_url + '?' + urlli...
Python
from oauth2client.file import Storage from oauth2client.client import OAuth2WebServerFlow from oauth2client.tools import run import json from urllib import urlencode import httplib2 import os CLIENT_ID = open(os.environ['HOME'] + "/.freebase_client_id").read() CLIENT_SECRET = open(os.environ['HOME'] + "/.freebase_cli...
Python
import json import urllib import os api_key = open(os.environ['HOME'] + "/.api_key").read() query = 'blue bottle' service_url = 'https://www.googleapis.com/freebase/v1/search' params = { 'query': query, 'key': api_key } url = service_url + '?' + urllib.urlencode(params) response = json.loads(urllib.urlopen(url).read...
Python
import json import urllib import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() query = [{'id': None, 'name': None, 'type': '/location/country'}] service_url = 'https://www.googleapis.com/freebase/v1/mqlread' params = { 'query': json.dumps(query), 'cursor': '', 'key': api_key } while params['cu...
Python
import sys import json import urllib import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() topic_id = '/en/bob_dylan' service_url = 'https://www.googleapis.com/freebase/v1/text' url = service_url + topic_id + '?key=' + api_key; response = json.loads(urllib.urlopen(url).read()) print response['resu...
Python
import urllib import urllib2 import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() url = 'https://www.googleapis.com/rpc' requests = [{ 'method': 'freebase.text.get', 'apiVersion': 'v1', 'params': { 'id': ['en','bob_dylan'] } },{ 'method': 'freebase.text.get', 'apiVe...
Python
import urllib import urllib2 import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() url = 'https://www.googleapis.com/rpc' request = { 'method': 'freebase.topic', 'apiVersion': 'v1', 'params': { 'id': ['en','bob_dylan'], ...
Python
import urllib import urllib2 import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() url = 'https://www.googleapis.com/rpc' query = [{ 'id':'/en/blade_runner', 'name':None }] request = { 'method': 'freebase.mqlread', 'apiVersion': 'v1', 'params': { 'query': json.dumps(que...
Python
import urllib import urllib2 import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() url = 'https://www.googleapis.com/rpc' request = { 'method': 'freebase.search', 'apiVersion': 'v1', 'params': { 'query': 'nirvana', 'key': api_key } } headers = { 'Content-Type': 'appli...
Python
import urllib import urllib2 import json import os api_key = open(os.environ['HOME'] + "/.freebase_api_key").read() url = 'https://www.googleapis.com/rpc' request = { 'method': 'freebase.text.get', 'apiVersion': 'v1', 'params': { 'id': ['en','bob_dylan'], ...
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
""" 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
""" 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
# 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
#!/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) 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. """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
__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
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
# 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) 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) 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
# 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
__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) 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
# 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
#!/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
"""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
#!/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
''' Module which prompts the user for translations and saves them. TODO: implement @author: Rodrigo Damazio ''' class Translator(object): ''' classdocs ''' def __init__(self, language): ''' Constructor ''' self._language = language def Translate(self, string_names): print string_names
Python
''' Module which brings history information about files from Mercurial. @author: Rodrigo Damazio ''' import re import subprocess REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*') def _GetOutputLines(args): ''' Runs an external process and returns its output as a list of lines. @param args: the argume...
Python
''' Module which parses a string XML file. @author: Rodrigo Damazio ''' from xml.parsers.expat import ParserCreate import re #import xml.etree.ElementTree as ET class StringsParser(object): ''' Parser for string XML files. This object is not thread-safe and should be used for parsing a single file at a time...
Python
#!/usr/bin/python ''' Entry point for My Tracks i18n tool. @author: Rodrigo Damazio ''' import mytracks.files import mytracks.translate import mytracks.validate import sys def Usage(): print 'Usage: %s <command> [<language> ...]\n' % sys.argv[0] print 'Commands are:' print ' cleanup' print ' translate' p...
Python
''' Module which compares languague files to the master file and detects issues. @author: Rodrigo Damazio ''' import os from mytracks.parser import StringsParser import mytracks.history class Validator(object): def __init__(self, languages): ''' Builds a strings file validator. Params: @para...
Python
''' Module for dealing with resource files (but not their contents). @author: Rodrigo Damazio ''' import os.path from glob import glob import re MYTRACKS_RES_DIR = 'MyTracks/res' ANDROID_MASTER_VALUES = 'values' ANDROID_VALUES_MASK = 'values-*' def GetMyTracksDir(): ''' Returns the directory in which the MyTrac...
Python
#!/usr/bin/env python """Bootstrap setuptools installation If you want to use setuptools in your package's setup.py, just include this file in the same directory with it, and add this to the top of your setup.py:: from ez_setup import use_setuptools use_setuptools() If you want to require a specific version ...
Python
#!/usr/bin/env python # # Copyright 2012 Google Inc. All Rights Reserved. # # 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 ...
Python
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. # # 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 ...
Python
#!/usr/bin/env python # # Copyright 2012 Google Inc. All Rights Reserved. """Python script for interacting with BigQuery.""" import cmd import codecs import datetime import httplib import json import os import pdb import pipes import platform import shlex import sys import time import traceback import types impo...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2012 Google Inc. All Rights Reserved. # # 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/LICENS...
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 2012 Google Inc. All Rights Reserved. """Bigquery Client library for Python.""" import abc import datetime import hashlib import itertools import json import logging import os import pkgutil import random import re import string import sys import textwrap import time import apicl...
Python
#!/usr/bin/env python # Copyright 2011 Google Inc. All Rights Reserved. """Tests for bigquery_client.py.""" import itertools import json import StringIO import tempfile from google.apputils import googletest import bigquery_client class BigqueryClientTest(googletest.TestCase): def setUp(self): self.clien...
Python
#!/usr/bin/env python # # Copyright 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 o...
Python
import httplib2 from apiclient.discovery import build from oauth2client.appengine import oauth2decorator_from_clientsecrets class BigQueryClient(object): def __init__(self, http, decorator): """Creates the BigQuery client connection""" self.service = build('bigquery', 'v2', http=http) self....
Python
#!/usr/bin/env python # # Copyright 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 o...
Python
# Copyright 2012 Google Inc. All Rights Reserved. """BigQuery App Engine demo. Demos how to start a BigQuery job running, then poll the job to get the results when it's complete. """ __author__ = 'kbrisbin@google.com (Kathryn Hurley)' import bigqueryv2 import errors import httplib2 import os import simplejson from ...
Python
# Copyright 2012 Google Inc. All Rights Reserved. """Any errors occurring during execution. - Error during query. - Error during poll. """ class Error(Exception): """Base exception.""" pass class QueryError(Error): """Exception raised for errors during query.""" pass class PollError(Error): """Excepti...
Python