code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/python
with open('t.out') as fp:
lines = fp.readlines()
nums = [float(l) for l in lines]
print("{0:.2f}".format(sum(nums) / len(nums)))
| Python |
#!/usr/bin/python
with open('t.out') as fp:
lines = fp.readlines()
nums = [float(l) for l in lines]
print("{0:.2f}".format(sum(nums) / len(nums)))
| Python |
#!/usr/bin/python
import os
from datetime import datetime, timedelta
N = (64, 128, 256, 512, 1024, 2048)
# M = ('IJK', 'IKJ', 'JIK', 'JKI', 'KIJ', 'KJI')
# D = (0, )
M = ('IJKIJ', )
D = range(10)
for d in D:
for n in N:
for m in M:
time = timedelta(seconds=0)
start = datetime.now(... | Python |
#!/usr/bin/python
import os
from datetime import datetime, timedelta
N = (64, 128, 256, 512, 1024, 2048)
# M = ('IJK', 'IKJ', 'JIK', 'JKI', 'KIJ', 'KJI')
# D = (0, )
M = ('IJKIJ', )
D = range(10)
for d in D:
for n in N:
for m in M:
time = timedelta(seconds=0)
start = datetime.now(... | Python |
import os
from datetime import datetime, timedelta
T = (2, 4, 8)
S = (32, 256, 1024, 16*1024, 256*1024)
S = (1, )
for t in T:
for s in S:
command = './1 {} {} > /dev/null'.format(t, s)
time = timedelta(seconds=0)
for i in range(4):
start = datetime.now()
os.system(... | Python |
#! /usr/bin/env python
# Copyright 2004, Magnus Hagdorn
#
# This file is part of glimmer.
#
# PyGMT 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 option) any... | Python |
#! /usr/bin/env python
# Copyright 2004, Magnus Hagdorn
#
# This file is part of glimmer.
#
# PyGMT 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 option) any... | 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 |
SELLER_ID = "BOGUS_ID"
SELLER_SECRET = "BOGUS_KEY"
| 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 |
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 |
#!/usr/bin/env python
import threading
import os
import sys
import time
import SimpleHTTPServer
import SocketServer
import subprocess
http_port = 8001
class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
allow_reuse_address = True
class WebServer:
def __init__(self, port):
... | Python |
# vim: fdm=indent
'''
author: Richard Neher, Fabio Zanini
date: 23/08/12
license: GPL3
content: Distutils setup script for the Python bindings of FFPopSim.
If your compiler has problems finding GSL and/or BOOST and you are
sure they are installed on your system, check the sectio... | Python |
# vim: fdm=indent
'''
author: Fabio Zanini
date: 14/05/12
content: Test script for the python bindings to the low-dimensional
simulation
'''
# Import module
import sys
sys.path.insert(0, '../pkg/python')
import numpy as np
import matplotlib.pyplot as plt
import FFPopSim as h
# Construct class... | Python |
# vim: fdm=indent
'''
author: Fabio Zanini
date: 25/04/12
content: Test script for the python bindings
'''
# Import module
import sys
sys.path.insert(0, '../pkg/python')
import numpy as np
import matplotlib.pyplot as plt
import FFPopSim as h
# Construct class
pop = h.hivpopulation(1000)
# Test I/O fitne... | Python |
# vim: fdm=indent
'''
author: Fabio Zanini
date: 22/08/12
content: Test script for the python bindings (haploid_highd)
'''
# Import module
import sys
sys.path.insert(0, '../pkg/python')
import numpy as np
import matplotlib.pyplot as plt
import FFPopSim as h
from Bio import Phylo
# Globals
L = 1000 # ... | Python |
"""reST directive for syntax-highlighting ipython interactive sessions.
"""
#-----------------------------------------------------------------------------
# Needed modules
# Standard library
import re
# Third party
from pygments.lexer import Lexer, do_insertions
from pygments.lexers.agile import (PythonConsoleLexer,... | Python |
# vim: fdm=indent
'''
author: Fabio Zanini, Richard Neher
date: 08/12/12
content: Split a parent population into two daughter populations.
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the PYTHONPATH)
import sys
sys.path.insert(0, '../pkg/python')
import ... | Python |
'''
author: Richard Neher, Fabio Zanini
date: 11/07/12
content: Compare the speed of evolution at different recombination rates.
Sexual populations reach higher fitnesses than asexual ones.
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the PYTH... | Python |
import FFPopSim as h
import numpy as np
from matplotlib import pyplot as plt
import random as rd
from Bio import Phylo
print "This script is meant to illustrate and explore the effect of\n\
purifying selection on genealogies in asexual and sexual populations. \n\n\
Simulations are performed using an finite sites model... | Python |
# vim: fdm=indent
'''
author: Richard Neher, Fabio Zanini
date: 25/05/12
content: Find the time for valley crossing
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the PYTHONPATH)
import sys
sys.path.insert(0, '../pkg/python')
import numpy as np
import matp... | Python |
import FFPopSim as h
import numpy as np
from matplotlib import pyplot as plt
import random as rd
print 'FFPopSim uses a finite sites implementation with a genome \n\
of fixed length L. One can, however, specify the number of segregating sites \n\
and FFPopSim will keep these sites polymorphic by introducing a mutation... | Python |
import FFPopSim as h
import numpy as np
from matplotlib import pyplot as plt
import random as rd
print 'FFPopSim uses a finite sites implementation with a genome \n\
of fixed length L. One can, however, specify the number of segregating sites \n\
and FFPopSim will keep these sites polymorphic by introducing a mutation... | Python |
# vim: fdm=indent
'''
author: Richard Neher, Fabio Zanini
date: 23/08/12
content: Example of haploid_highd demonstrating the balance between
recombination and genetic drift in a finite population. The example
plots the average r^2 (squared correlation coefficient) for loci at
... | Python |
# vim: fdm=indent
'''
author: Fabio Zanini, Richard Neher
date: 25/04/12
content: Example of the hivpopulation subclass. This example is similar to
fitness_wave.py, but exploits the specialized subclass hivpopulation
for simulating HIV populations.
'''
# Import modules (setting the ... | Python |
import FFPopSim as h
import numpy as np
from matplotlib import pyplot as plt
import random as rd
def get_mut_count_subtree(R):
if R.is_terminal():
return 1,[]
else:
tmp_mut_count = []
sub_tree_size = 0
for C in R.clades:
csize,cmut = get_mut_count_subtree(C)
sub_tree_size += csize
tmp_mut_count.ext... | Python |
# vim: fdm=indent
'''
author: Richard Neher, Fabio Zanini
date: 24/08/12
content: Example of haploid_lowd on the algorithm runtime complexity.
The same series of simulations are performed:
- with multiple crossovers, O(3^L),
- with at most one crossover, O(L 2^L)... | Python |
# vim: fdm=indent
'''
author: Richard Neher, Fabio Zanini
date: 23/08/12
content: Example of haploid_highd showing how neutral alleles are affected
by linked selective sweeps
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the PYTHONPATH)
import ... | Python |
# vim: fdm=indent
'''
author: Fabio Zanini, Richard Neher
date: 28/05/12
content: Example of immune escape in HIV using a few effective loci and
haploid_lowd
Note: this example shows some alternative Python syntaxes from most other
example scripts, such as the following:
- if __name__ == ... | Python |
# vim: fdm=indent
'''
author: Richard Neher, Fabio Zanini
date: 24/08/12
content: Example of haploid_lowd on the algorithm runtime complexity.
The same series of simulations are performed:
- for a human-like population,
- for an HIV-like (viral) population,
... | Python |
'''
author: Richard Neher, Fabio Zanini
date: 11/07/12
content: Example on the steady state distribution of allele frequency in a
balance between mutation and genetic drift using haploid_lowd.
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the ... | Python |
# vim: fdm=indent
'''
author: Fabio Zanini and Richard Neher
date: 23/08/12
content: Example of haploid_highd on linkage relaxation via recombination
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the PYTHONPATH)
import sys
sys.path.insert(0, '../pkg/python... | Python |
'''
author: Richard Neher, Fabio Zanini
date: 11/07/12
content: Example on the steady state distribution of allele frequency in a
balance between mutation and genetic drift using haploid_highd.
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the... | Python |
import FFPopSim as h
import numpy as np
from matplotlib import pyplot as plt
import random as rd
from Bio import Phylo
print "This script is meant to illustrate and explore the effect of\n\
positive selection on genealogies in asexual and sexual populations. \n\n\
Simulations are performed using an infinite sites mode... | Python |
# vim: fdm=indent
'''
author: Fabio Zanini, Richard Neher
date: 08/12/12
content: Split a parent population into two daughter populations.
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the PYTHONPATH)
import sys
sys.path.insert(0, '../pkg/python')
import ... | Python |
# vim: fdm=indent
'''
author: Richard Neher, Fabio Zanini
date: 23/08/12
content: Example of haploid_lowd on linkage relaxation via recombination
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the PYTHONPATH)
import sys
sys.path.insert(0, '../pkg/python')
... | Python |
'''
author: Richard Neher, Fabio Zanini
date: 11/07/12
content: Genotype condensation is driven by epistasis.
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the PYTHONPATH)
import sys
sys.path.insert(0, '../pkg/python')
import time
import numpy as np
impor... | Python |
'''
author: Richard Neher, Fabio Zanini
date: 11/07/12
content: Example on genetic drift using haploid_highd
'''
# Import modules (setting the path should not be necessary when the module is
# installed in the PYTHONPATH)
import sys
sys.path.insert(0, '../pkg/python')
import numpy as np
from matplotlib im... | Python |
import FFPopSim as h
import numpy as np
from matplotlib import pyplot as plt
import random as rd
L=100
pop=h.haploid_highd(L)
pop.outcrossing_rate=0.1
pop.crossover_rate=1.0/pop.L
pop.mutation_rate=5.0/pop.L
pop.carrying_capacity=30
#track the loci 10, 50 and 90
pop.track_locus_genealogy([10,50,90])
#initialize the... | Python |
# vim: fdm=indent
'''
author: Fabio Zanini, Richard Neher
date: 07/09/12
content: Example of tracking the fitness distribution wave along the
simulation.
Note: This example also shows subclassing of FFPopSim classes. In this case, the
syntax construct if __name__ == '__main__' is a... | Python |
#!/usr/bin/env python
import re
import os
import sys
import shutil
PACKAGE_NAME = 'com.google.android.apps.dashclock.api'
def main():
root = sys.argv[1]
for path, _, files in os.walk(root):
for f in [f for f in files if f.endswith('.html')]:
fp = open(os.path.join(path, f), 'r')
html = fp.read()... | 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 os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basena... | Python |
#!/usr/bin/python
"""
Pull a oAuth protected page from foursquare.
Expects ~/.oget to contain (one on each line):
CONSUMER_KEY
CONSUMER_KEY_SECRET
USERNAME
PASSWORD
Don't forget to chmod 600 the file!
"""
import httplib
import os
import re
import sys
import urllib
import urllib2
import urlparse
import user
from xml.... | Python |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... | Python |
#!/usr/bin/python
import logging
from xml.dom import minidom
from xml.dom import pulldom
BOOLEAN = "boolean"
STRING = "String"
GROUP = "Group"
# Interfaces that all FoursquareTypes implement.
DEFAULT_INTERFACES = ['FoursquareType']
# Interfaces that specific FoursqureTypes implement.
INTERFACES = {
}
DEFAULT_CLA... | Python |
from plot_type import *
import imagecache
from link import Link
from border import Fence, Border
from item import Item
class Plot:
def __init__(self, type=SOIL):
self.type = type
self.watered = False
self.plant = None
self.contents = list()
# vestige of a t... | Python |
from __future__ import division
from __future__ import with_statement
import math
import os
import plant_parser
from player import Player
from field import Field
from plot import Plot
import plant
import pygame
from pygame import Surface
import imagecache
import constants
from plot_type import *
from bord... | Python |
# Module for items that can be interacted with by the player.
# These will be added as contents into a plot
import imagecache
# Uninstantiatable base class.
# Subclasses must implement the fields:
# image_path: where the image is stored
class Item:
def __init__(*kwargs):
import inspect
... | Python |
from plot import Plot
from pygame import Surface
import math
plot_size = 40
# Holds a collection of Plots.
# A Plot is referenced by column and row number, starting at 0.
# Because this object caches its images, self.changed must be set to True if the contents of the Field change to update the image.
class F... | Python |
import pygame
# Identical items in the Inventory get stored together, and a count of them kept,
# so the top is not necessarily where an item will be added to
class Inventory:
def __init__(self, size=-1):
self.size = size # maximum number of items, -1 means infinite
self.top = 0
se... | Python |
class ConfigError(ValueError): pass | Python |
from __future__ import division
import imagecache
from inventory import Inventory
import constants
# how many pixels off a player can before being in a tile, 0 doesn't play well
# should be a small compared to constants.tile_size
movement_tolerance = 5
class Player:
def __init__(self):
self... | Python |
import imagecache
import image
from pygame import Surface
class Building:
def __init__(self, width, height):
self.width = width
self.height = height
self.door_coordinates = None
self.image = None
def walkable(self):
return False
def set_do... | Python |
# module is for objects which will move the player from one field to another
import imagecache
# all subclasses must implement the follow fields:
# destination: a str, which will be looked up in World, that the player will be transported to on touching this link
# destination-coords: a pair of x, y coordinates ... | Python |
#constants
x_res = 640
y_res = 480
tile_size = 40
controls = ("quit",
"menu",
"move_down",
"move_up",
"move_left",
"move_right",
"interact",
"use_item",
"prev_inventory_item",
"next_inventory_item",
"toggle_money",
"toggle_inventory",
"toggle_fps",
"toggle_time",
... | Python |
import xml.dom.minidom
import re
def init_plants(filename):
xml_tree = xml.dom.minidom.parse(filename)
#where to store information about each plant
plants_dict = dict()
#get all plants in the file
plants = xml_tree.getElementsByTagName("plant")
for plant in plants:
... | Python |
class Clock:
def __init__(self, start_hour=0, start_minute=0):
self.hour = start_hour
self.start_hour = start_hour
self.minute = start_minute
self.start_minute = start_minute
def add(self, hour=0, minute=0):
self.minute += minute
extra_hour... | Python |
from item import Item
from display_window import Menu, Alert
from inventory_item import Seeds
import imagecache
# People are just items. This is a societal comment.
class SeedSeller(Item):
def __init__(self):
pass
def walkable(self):
return False
def get_image(self):
... | Python |
# various colour constants as rgb triples
BLACK = (0x00, 0x00, 0x00)
RED = (0xFF, 0x00, 0x00)
GREEN = (0x00, 0xFF, 0x00)
BLUE = (0x00, 0x00, 0xFF)
WHITE = (0xFF, 0xFF, 0xFF)
NAVY = (0x00, 0x00, 0x80)
ORANGE = (0xFF, 0xA5, 0x00)
LINEN = (250, 240, 230)
PINK = ... | Python |
from __future__ import division #so that / represents true division
import imagecache
#construct a Plant object from a dictionary
def Plant_from_dict(d):
return Plant(d['name'], d['growth_time'], d['base_price'], d['tilename'])
class Plant:
def __init__(self, name, growth_time, base_price, tilename... | Python |
# Module for items that are held in the player's inventory
import imagecache
from field import Field
from map import PlacedObject
import plant
# Uninstantiatable base class.
# Subclasses must implement the fields:
# image_path: where the image is stored
class InventoryItem:
def __init__(*kwargs):
... | Python |
(SOIL, STONE, PATH, GRASS, FLOOR, BLANK) = range(6) | Python |
from __future__ import division
from pygame import Surface, Rect, RLEACCEL
import pygame
import image
import imagecache
import constants
import colour
from link import Link
# Because this object caches its images, self.changed must be set to True if the contents of it change to update the image.
class Map:... | Python |
# Module for borders of fields that cannot be walked through
import pygame
import imagecache
import constants
# Uninstantiatable base class.
# Subclasses must implement the fields:
# image_centre: where the image for the centre of a border is
# image_connector: where the image to connect two borders i... | Python |
import pygame
import colour
# contents must consist of a sequence of triples (str, on_select, on_choose) where str is what is displayed on the screen
# on_select is what will happen when that option is selected, on_choose is what will happen when that is chosen
# a function may be None
# by default, the last opt... | Python |
from pygame import Surface
import pygame
def tile_image(base_image, width, height):
tiled_image = Surface((width, height))
for i in range(width // base_image.get_width() + 1):
for j in range(height // base_image.get_height() + 1):
tiled_image.blit(base_image, (i*base_image.get_... | Python |
import pygame
cache = {}
def get_image(imagename):
if not cache.has_key(imagename):
cache[imagename] = pygame.image.load('../images/' + imagename + '.png').convert_alpha()
return cache[imagename]
| Python |
from plot_type import *
from border import Fence
from link import Link, Door
from item import TakeableItem, Bed
from inventory_item import Seeds
from building import Building
from map import Map, Blank
from field import Field
from person import SeedSeller
# When placing doors, make sure they are slightly off... | 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.
"""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) 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 |
# 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 |
# 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 |
# 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 |
#!/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 |
"""
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 |
"""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 |
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 |
# 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 |
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.