code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# ba... | Python |
# The contents of this file are subject to the Mozilla Public License
# (MPL) 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 http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# ba... | Python |
#!/usr/bin/env python
# -*- Mode: Python; indent-tabs-mode: nil -*-
# vi: set ts=4 sw=4 expandtab:
#
# The MIT License
#
# Copyright (c) 2011 Alexander Macdonald
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to de... | Python |
#!/usr/bin/env python
# -*- Mode: Python; indent-tabs-mode: nil -*-
# vi: set ts=4 sw=4 expandtab:
#
# The MIT License
#
# Copyright (c) 2011 Alexander Macdonald
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to de... | Python |
#!/usr/bin/env python
# -*- Mode: Python; indent-tabs-mode: nil -*-
# vi: set ts=4 sw=4 expandtab:
#
# The MIT License
#
# Copyright (c) 2011 Alexander Macdonald
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to de... | Python |
#!/usr/bin/env python
# -*- Mode: Python; indent-tabs-mode: nil -*-
# vi: set ts=4 sw=4 expandtab:
#
# The MIT License
#
# Copyright (c) 2011 Alexander Macdonald
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to de... | Python |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | Python |
#!/usr/bin/python2.6
#
# Copyright 2011 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 |
# Run from the commandline:
#
# python server.py
# POST audio to http://localhost:9000
# GET audio from http://localhost:9000
#
# A simple server to collect audio using python. To be more secure,
# you might want to check the file names and place size restrictions
# on the incoming data.
import cgi
from BaseHTTPSe... | Python |
#!/usr/bin/python
import xml.parsers.expat;
import sys;
import re;
parser=xml.parsers.expat.ParserCreate('UTF-8');
values_en = {}
values_lang = {}
values_hash = {}
name=''
def parse(lang, values):
def start_element(n, attrs):
global name;
if n != u'string': return
name=attrs[u'name']
def end_element(... | Python |
__author__ = 'jcorbett'
import unittest
import types
import time
import random
from rest import RestApi, get_default_release, get_default_build, AttributeDict
random.seed()
class TestrunGroupTests(unittest.TestCase):
"""
Tests for adding, deleting, updating specifically projects.
"""
def setUp(self):... | Python |
import json
import urllib
import urlparse
import httplib2
json_content = {'Content-Type': 'application/json'}
STREAM_CONTENT = {'Content-Type': 'application/octet-stream'}
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
DELETE = 'DELETE'
class AttributeDict(dict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__set... | Python |
__author__ = 'jcorbett'
import unittest
from rest import RestApi
class ProjectTest(unittest.TestCase):
"""
Tests for adding, deleting, updating specifically projects.
"""
def setUp(self):
self.api = RestApi("http://localhost:9090/api")
def create_project(self, **kwargs):
if "nam... | Python |
#!/usr/bin/env python
__author__ = 'jcorbett'
import argparse
import pymongo
import sys
from gridfs import GridFS
def main(arguments):
parser = argparse.ArgumentParser(description='Remove files from a set of results.')
parser.add_argument("-p", "--project", dest="project", required=True, help="The project to... | Python |
#!/usr/bin/env python
import os
from distutils.core import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
#TODO: support pip and dependencies
setup(
name = "slickqa",
version = "0.1.407",
author = "Chris Saxey",
author_email = "jared.jorgensen@quest.com",... | Python |
import os
import sys
import thread
import threading
import datetime
import traceback
from logging import *
from slickApi import SlickAsPy
from dateutil.tz import *
ERROR = 40
WARN = 30
INFO = 20
DEBUG = 10
TRACE = 5
log_levels = {
ERROR : 'ERROR',
WARN : 'WARN',
INFO : 'INFO',
DEBUG : 'DEBUG',
TRA... | Python |
import json
import zlib
import urllib
import urlparse
import httplib2
import traceback
from dateutil.tz import *
from datetime import datetime
import slick_utilities
json_content = {'Content-Type': 'application/json'}
STREAM_CONTENT = {'Content-Type': 'application/octet-stream'}
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
D... | Python |
import sys
import logging
from unittest import TestSuite, util, case
from unittest.suite import _isnotsuite,_DebugResult,_ErrorHolder
from SlickTestResult import SlickTestResult
class SlickTestSuite(TestSuite):
def __init__(self, tests=(), loggerName='root'):
super(SlickTestSuite, self).__init__(tests)
... | Python |
from datetime import datetime, timedelta
from dateutil.tz import *
#----------------------------------------------------------------------
def get_date():
"""
A date object formatted for slick with the local time zone
"""
return datetime.now(tzlocal()).strftime('%a, %m %b %Y %H:%M:%S %Z') | Python |
import logging
from slickApi import *
from unittest import TestResult
from datetime import datetime, timedelta
from dateutil.tz import *
import slick_utilities
FIN = "FINISHED"
class SlickTestResult(TestResult):
"""Adds reporting through slick"""
def __init__(self, project, testRunRef, slick, loggername='roo... | Python |
import logging
import sys
from unittest import TestCase, SkipTest
from unittest.case import _ExpectedFailure, _UnexpectedSuccess
from slickApi import SlickAsPy
from slickLogging import Slicklogger
class SlickTestCase(TestCase):
""""""
logger = None
queued_files = []
# for wing ide source assistance and... | Python |
from slickApi import SlickAsPy, SlickError
from SlickTestResult import SlickTestResult
from SlickTestRunner import SlickTestRunner
from slickLogging import SlickFormatter, SlickHandler, Slicklogger
from SlickTestCase import SlickTestCase
from SlickTestSuite import SlickTestSuite
__all__ = ["SlickAsPy", "SlickError", "... | Python |
import logging
import traceback
import re
import slickLogging
from slickApi import SlickAsPy, SlickError
from SlickTestResult import SlickTestResult
from unittest import TextTestRunner
from unittest.signals import registerResult
from slick_utilities import get_date
class SlickTestRunner(TextTestRunner):
"""
A ... | Python |
#!/usr/bin/python2.6
#
# Simple http server to emulate api.playfoursquare.com
import logging
import shutil
import sys
import urlparse
import SimpleHTTPServer
import BaseHTTPServer
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Handle playfoursquare.com requests, for testing."""
def do_GET(self... | Python |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... | Python |
#!/usr/bin/python
"""
Pull a oAuth protected page from foursquare.
Expects ~/.oget to contain (one on each line):
CONSUMER_KEY
CONSUMER_KEY_SECRET
USERNAME
PASSWORD
Don't forget to chmod 600 the file!
"""
import httplib
import os
import re
import sys
import urllib
import urllib2
import urlparse
import user
from xml.... | Python |
#!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basena... | Python |
#!/usr/bin/python
import logging
from xml.dom import minidom
from xml.dom import pulldom
BOOLEAN = "boolean"
STRING = "String"
GROUP = "Group"
# Interfaces that all FoursquareTypes implement.
DEFAULT_INTERFACES = ['FoursquareType']
# Interfaces that specific FoursqureTypes implement.
INTERFACES = {
}
DEFAULT_CLA... | Python |
#!/usr/bin/python
'''Usage: %s [OPTIONS] <input file(s)>
Generate test source file for CxxTest.
-v, --version Write CxxTest version
-o, --output=NAME Write output to file NAME
--runner=CLASS Create a main() function that runs CxxTest::CLASS
--gui=CLASS Like --runner, with GUI c... | Python |
# module pyparsing.py
#
# Copyright (c) 2003-2010 Paul T. McGuire
#
# 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 rights to u... | Python |
# module pyparsing.py
#
# Copyright (c) 2003-2010 Paul T. McGuire
#
# 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 rights to u... | Python |
#!/usr/bin/python
import sys
import os
import string
import subprocess
import time
"""
Usage: rpcexec -n n_to_start -f [hostsfile] [program] [options]
To start local only: rpcexec [program] [options]
"""
def escape(s):
s = string.replace(s, '"', '\\"')
s = string.replace(s, "'", "\\'")
return s
#enddef
# gui: ... | Python |
import math
# Python implementation of pagerank
def update(scope, scheduler):
vertex = scope.getVertex()
oldval = vertex.value
newval = vertex.value * vertex.selfEdgeWeight
newval = newval + sum([e.weight*e.value for e in scope.getInboundEdges()])
vertex.setValue(newval)
if (abs(newval-oldval)... | Python |
class pagerank_vertex:
def __init__(self, value, selfedge):
self.rank = value
self.selfedge = selfedge
f = open(filename, "r")
lines = f.readlines()
# First line is header
header = lines[0]
lines = lines[1:]
nvertices = int(header.split(",")[1])
for i in range(0,nvertices):
# format: first v... | Python |
import math
# Python implementation of pagerank
damping = 0.85
def update(scope, scheduler):
pvertex = scope.getVertex().value
sumval = pvertex.rank * pvertex.selfedge + sum([e.value * scope.getNeighbor(e.from).value.rank for e in scope.getInboundEdges()])
newval = (1-damping)/scope.getNumOfVertices() + ... | Python |
import math
lamb = 0.5
# Python implementation of Lasso Shooting algorithm.
# min ||Ax-y||_2^2 + lambda ||x||_1
def update(scope, scheduler):
# Of class lasso_variable_vertex or lasso_estimate_vertex
lassov = scope.getVertex().value
if (lassov.vtype == 0):
if lassov.initialized == False:
... | Python |
leastsqr_err = 0.0
penalty = 0.0
lamb = 0.5
for v in graph.getVertices():
lassov = v.value
if lassov.vtype == 0:
penalty += lamb * abs(lassov.value)
else:
leastsqr_err += pow(lassov.observed - lassov.curval,2)
print("Objective:", penalty + leastsqr_err) | Python |
graphlab.setScheduler("round_robin")
graphlab.setIterations(100)
graphlab.setScopeType("vertex") | Python |
for v in graph.getVertices():
print(v.value.rank) | Python |
#
# Solve Lasso: min ||Ax-y||_2^2 + \lambda ||x||_1
#
# We present Lasso as a bipartite graph. On the left side, we have
# variables x_i (predictors) and on the right side the current estimates
# for y_i = (Ax)_i. Sides are connected by edges weighted by A_ij
#
#
# Rights side of the graph. Estimate for y_i. We st... | Python |
#! /usr/bin/env python
# encoding: utf-8
# waf 1.6.2
VERSION='0.3.3'
import sys
APPNAME='p2t'
top = '.'
out = 'build'
CPP_SOURCES = ['poly2tri/common/shapes.cc',
'poly2tri/sweep/cdt.cc',
'poly2tri/sweep/advancing_front.cc',
'poly2tri/sweep/sweep_context.cc',
... | Python |
# Given a Data Structure having first n integers and next n chars. A = i1 i2 i3 ... iN c1 c2 c3 ... cN. Write an in-place algorithm to rearrange the elements of the array ass A = i1 c1 i2 c2 ... iN cN
inputs = []
inputs += [[ 1, 'A' ]]
inputs += [[ 1, 2, 'A', 'B' ]]
inputs += [[ 1, 2, 3, 'A', 'B', 'C' ]]
inputs ... | Python |
# Shift table by x elements
inputs = []
inputs += [[1]]
inputs += [[1, 2]]
inputs += [[1, 2, 3]]
inputs += [[1, 2, 3, 4]]
inputs += [[1, 2, 3, 4, 5]]
inputs += [[1, 2, 3, 4, 5, 6]]
inputs += [[1, 2, 3, 4, 5, 6, 7]]
inputs += [[1, 2, 3, 4, 5, 6, 7, 8]]
inputs += [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
inputs += [[1, ... | Python |
# -*- coding: utf-8 -*-
# Django settings for abeona project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
# ('Patricio Molina', 'patriciomolina@gmail.com'),
# ('Nicolás Giorgetti', 'niko.kane@gmail.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'postgresql_psyc... | 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('',
# Example:
# (r'^abeona/', include('abeona.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs' ... | Python |
#!/usr/bin/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 run ... | Python |
#!/usr/bin/python
import glob, os, sys, string as s
# cc files from ocr-* folders are compiled into libocropus by default
# extra directories for libocropus
extradirs = """
""".split()
# extra files which should not go to libocropus
exclude = """
""".split()
# optional files
exclude = []
def print_header():
p... | Python |
# -*- python -*-
# vi: ft=python
# Copyright 2008 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
# or its licensors, as applicable.
#
# You may not use this file except under the terms of the accompanying license.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this f... | Python |
#!/usr/bin/python
import sys,os,re,string,os.path,glob
if not os.path.isdir("ocroscript") and os.path.isdir("ocr-layout"):
sys.stderr.write("must run this script from the top directory of ocropus")
sys.exit(1)
dirs = {}
edges = []
files = glob.glob("*/*.h") + glob.glob("*/*.cc")
for file in files:
dir =... | Python |
#!/usr/bin/python
import os,sys,re,string,glob
if len(glob.glob("*/*.a"))<10:
sys.stderr.write("not enough libraries; you probably need to build ocropus first")
sys.exit(255)
sources = {}
nsymbols = 0
for line in os.popen("nm -o -C */*.a","r").readlines():
line = line[:-1]
fields = line.split(None,3... | Python |
#!/usr/bin/python
# Copyright 2008 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
# or its licensors, as applicable.
#
# You may not use this file except under the terms of the accompanying license.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in co... | Python |
#!/usr/bin/python
import os,sys,re,string
def die(s):
sys.stderr.write(s)
sys.exit(1)
def run(s):
sys.stderr.write("# "+s+"\n")
return os.system(s)
def tick(s):
return os.popen(s,"r").read()
file = sys.argv[-1]
rest = sys.argv[1:-1]
temp = "___temp___.cc"
tempo = "___temp___.o"
def clean():
... | Python |
#!/usr/bin/python
# Copyright 2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
# or its licensors, as applicable.
#
# You may not use this file except under the terms of the accompanying license.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in c... | Python |
#!/usr/bin/python
# Copyright 2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
# or its licensors, as applicable.
#
# You may not use this file except under the terms of the accompanying license.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in c... | Python |
#!/usr/bin/python
import sys,os,re,string,os.path,glob
if not os.path.exists("ocr-utils"):
sys.stderr.write("must be run from top level of ocropus installation")
sys.exit(1)
sources = glob.glob("*/*.h") + glob.glob("*/*.cc")
class UnionFind:
def __init__(self):
self.num_weights = {}
self... | Python |
#!/usr/bin/python
import os,string,glob,sys,getopt,re
script = sys.argv[0]
assert os.path.exists(script)
def uptodate(source=None,target=None):
if not os.path.exists(target): return 0
return os.path.getmtime(source)<os.path.getmtime(target)
def keywords(**keywords): return keywords
extraction_params = keyw... | Python |
#!/usr/bin/python
# these are possible justifications; please stick to one of them
STANDARD = "it's a textbook algorithm"
APIDOCS = "it's based on a sample from the API documentation of the corresponding library"
PERFORMANCE = "strict inlining is demonstrably necessary for performance"
STABLE = "we don't expect to be... | Python |
#!/usr/bin/python
# extract lines from Google 1000 book sample
import string,re,sys,os,shutil,glob
import xml.sax as sax
from PIL import Image
usage = """
... hocr image_pattern output_prefix
Process Google 1000 books volumes and prepares line or word images
for alignment using OCRopus.
Run ocroscript align-... ... | Python |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import string,re,sys,os,shutil,glob
import xml.sax as sax
from PIL import Image
usage = """
... hocr image_pattern output_prefix
Arguments:
xml_pattern: either a glob pattern that results in a list
of xml files, or @filename for a file containing
... | Python |
#!/usr/bin/python
import os,sys,os.path,glob,re,string,random
from pylab import *
# FIXME
# -- fix boxplot to use list-of-list representation (currently broken)
stream = sys.stdin
if len(sys.argv)>1: stream = open(sys.argv[1],"r")
data = []
for line in stream.xreadlines():
f = line.split()
if len(f)>0 and f[... | Python |
#!/usr/bin/python
import os,sys,os.path,glob,re,string,random
ocropus = "../ocropus-cmd/ocropus"
simp_re = re.compile(r'[^a-zA-Z0-9,.+=/*?!-]+')
def die(s):
sys.stderr.write("FATAL: %s\n"%s)
sys.exit(1)
def ensure(s):
if not os.path.exists(s):
die("%s: file not found" % s)
ensure(ocropus)
direct... | Python |
#!/usr/bin/python
import os,sys,os.path,glob,re,string,random
# FIXME
# -- better documentation
# -- better command line error checking
# -- use temporary file names instead of _truth, _ocr
# -- more informative error messages
# -- record machine, processing times
# -- get rid of ./distance
# -- output data into sqlit... | Python |
#!/usr/bin/python
import sys,os
vars = {}
results = []
for file in sys.argv[1:]:
current = {}
for line in open(file).readlines():
f = line.split()
if len(f)>1 and f[0]=="pick":
key,value = f[1].split("=")
if len(value.split(":"))==2:
m,s = value.split("... | Python |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import urllib2, zlib, gzip, StringIO, Image, threading
import sys, zipfile, os, os.path, re, tempfile, datetime, shutil
import xml.dom.minidom as dom
nThreads = 8
def getImages(siteRoot, siteName, dir=None):
global logFile
if dir == None:
dir = tempfile.... | 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 |
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.