code
stringlengths
1
1.72M
language
stringclasses
1 value
''' 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
''' 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 # by Aaron (ams@bio.aau.dk) # version 0.5 ###################################### # Version History # v. 0.1 started with the Genbank parser for CDS # v. 0.2 wrote the arguement parser # v. 0.3 wrote the proteinsearch function # v. 0.4 cds parser completed. Added a log file for the cds parser # v. 0.5 ...
Python
#!/usr/bin/python # by Aaron (ams@bio.aau.dk) ########## Import functions ########### import sys """ Docstring... blah blah """ ############## Functions ############### # def FunctionName(argument1, argument2, ...): # """ Optional Function description (Docstring) """ # +++ FUNCTION CODE +++ ...
Python
#!/usr/bin/python # by Aaron (ams@bio.aau.dk) # version 0.5 ###################################### # Version History # v. 0.1 started with the Genbank parser for CDS # v. 0.2 wrote the arguement parser # v. 0.3 wrote the proteinsearch function # v. 0.4 cds parser completed. Added a log file for the cds parser # v. 0.5 ...
Python
#!/usr/bin/python # by Aaron (ams@bio.aau.dk) ########## Import functions ########### import sys """ Docstring... blah blah """ ############## Functions ############### # def FunctionName(argument1, argument2, ...): # """ Optional Function description (Docstring) """ # +++ FUNCTION CODE +++ ...
Python
#!/usr/bin/python # Aaron Saunders | ams@bio.aau.dk import sys import re args = sys.argv[1:] fastafilename = args[0] ucfilename = args[1] with open(ucfilename, 'r') as fh: clusters = [ line for line in fh if line.startswith('S') ] ucmap = { } for line in clusters: data = line.rstrip().split...
Python
#!/usr/bin/python import phrap import os import subprocess from Bio.Seq import Seq from Bio.Alphabet import IUPAC import shutil from Bio import SeqIO import sys """ This script is a wrapper for the functions in the phrap.py module. """ args = sys.argv[1:] infilepath = args[0] rootpath = args[1] ####################...
Python
#!/usr/bin/python # Aaron Saunders | ams@bio.aau.dk import sys from Bio import SeqIO from Bio.SeqUtils.CheckSum import seguid import matplotlib.pyplot as plt import pickle infname = sys.argv[1] outfilestub = sys.argv[2] reps = {} counts = {} uniquebuffer = [] uniquefname = outfilestub + '.unique.fastq' uniquefile = ...
Python
#!/usr/bin/python # Aaron Saunders | ams@bio.aau.dk import sys import re args = sys.argv[1:] fastafilename = args[0] ucfilename = args[1] with open(ucfilename, 'r') as fh: clusters = [ line for line in fh if line.startswith('S') ] ucmap = { } for line in clusters: data = line.rstrip().split...
Python
#!/usr/bin/python import phrap import os import subprocess from Bio.Seq import Seq from Bio.Alphabet import IUPAC import shutil from Bio import SeqIO import sys """ This script is a wrapper for the functions in the phrap.py module. """ args = sys.argv[1:] infilepath = args[0] rootpath = args[1] ####################...
Python
#!/usr/bin/python # Aaron Saunders | ams@bio.aau.dk import sys from Bio import SeqIO from Bio.SeqUtils.CheckSum import seguid import matplotlib.pyplot as plt import pickle infname = sys.argv[1] outfilestub = sys.argv[2] reps = {} counts = {} uniquebuffer = [] uniquefname = outfilestub + '.unique.fastq' uniquefile = ...
Python
#!/usr/bin/python import time from math import sqrt, ceil def isprime(num): ans = True for n in xrange(2, int(ceil(sqrt(num)))+1): if num % n == 0: ans = False break return ans def main(): """ What is the 10 001st prime number?""" start = time.time() prime = 1...
Python
#!/usr/bin/python import time, sys import itertools """ Find the greatest product of five consecutive digits in the 1000-digit number. """ def main(): start = time.time() num = '73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545...
Python
#!/usr/bin/python """What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? """ import time def main(): start = time.time() seq = [x for x in range(1, 20)] print seq solved = False i = 20 while solved == False: for n in reversed...
Python
#!/usr/bin/python # http://projecteuler.net/problem=14 # import time """ Starting in the top left corner of a 2 x 2 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 20 x 20 grid? """ def main(): start = time.time() start r prin...
Python
#!/usr/bin/python def main(): """ sum the integers up to 1000 divisible by 3 or 5 """ nums = set() for i in xrange(1000): if i % 3 == 0: nums.add(i) if i % 5 == 0: nums.add(i) total = sum(nums) print total if __name__ == '__main__': main()
Python
#!/usr/bin/python # http://projecteuler.net/problem=14 # import time """ The following iterative sequence is defined for the set of positive integers: n n/2 (n is even) n 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 40 20 10 5 16 8 4 2 1 It can b...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor, log10 """ the sum of 10! is 3628800 Find the sum of the digits in 100! """ def factorial(n): if n == 1: fact = 1 else: fact = n * factorial(n-1) return fact def main(): start = time.time() n = 1...
Python
#!/usr/bin/python import time, sys """ Problem 17 If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: D...
Python
#!/usr/bin/python import time, sys import itertools """ In the 20 x 20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13...
Python
#!/usr/bin/python """What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? """ import time def main(): start = time.time() seq = [x for x in range(1, 20)] print seq solved = False i = 20 while solved == False: for n in reversed...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor """ The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? """ def isprime(num): ans = True for n in xrange(2, int(ceil(sqrt(num)))+1): if num % n == 0: ans = Fals...
Python
#!/usr/bin/python # http://projecteuler.net/problem=14 # import time """ The following iterative sequence is defined for the set of positive integers: n n/2 (n is even) n 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 40 20 10 5 16 8 4 2 1 It can b...
Python
#!/usr/bin/python import time, sys from math import pow as power """ The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 552 = 3025 Hence the difference between the sum of the squares of the first...
Python
#!/usr/bin/python import time, sys from math import ceil, sqrt, floor """ A Hamming number is a positive number which has no prime factor larger than 5. So the first few Hamming numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15. There are 1105 Hamming numbers not exceeding 10^8. We will call a positive number a gene...
Python
#!/usr/bin/python import time from math import sqrt, ceil def isprime(num): ans = True for n in xrange(2, int(ceil(sqrt(num)))+1): if num % n == 0: ans = False break return ans def main(): """ What is the 10 001st prime number?""" start = time.time() prime = 1...
Python
#!/usr/bin/python # http://projecteuler.net/problem=14 # import time """ The following iterative sequence is defined for the set of positive integers: n n/2 (n is even) n 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 40 20 10 5 16 8 4 2 1 It can b...
Python
#!/usr/bin/python import time, sys import itertools """ Find the greatest product of five consecutive digits in the 1000-digit number. """ def main(): start = time.time() num = '73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545...
Python
#!/usr/bin/python def main(): """ sum the integers up to 1000 divisible by 3 or 5 """ nums = set() for i in xrange(1000): if i % 3 == 0: nums.add(i) if i % 5 == 0: nums.add(i) total = sum(nums) print total if __name__ == '__main__': main()
Python
#!/usr/bin/python # version 2 import time, sys import itertools """ In the 20 x 20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 53 88...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor """ A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. Find the largest palindrome made from the product of two 3-digit numbers. """ def ispalindrome(x): x = s...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor, log10 """ The Fibonacci sequence is defined by the recurrence relation: fn = fn1 + fn2, where F1 = 1 afnd F2 = 1. Hence the first 12 terms will be: F1 = 1 F2 = 1 F3 = 2 F4 = 3 F5 = 5 F6 = 8 F7 = 13 F8 = 21 F9 = 34 F12 = 144 The 12th term, F12,...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor, log10 """ the sum of 10! is 3628800 Find the sum of the digits in 100! """ def factorial(n): if n == 1: fact = 1 else: fact = n * factorial(n-1) return fact def main(): start = time.time() n = 1...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor """ The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million """ def isprime(num): ans = True if num <= 1: return False if num == 2: return True for n in xrange(2,...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor def hyp(a, b): c = sqrt((a * a) + (b * b)) return c def main(): """ A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2 ...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor """ The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? """ def isprime(num): ans = True if num <= 1: return False if num % 2 == 0: return False for n in xr...
Python
#!/usr/bin/python import time, sys from math import pow as power """ A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left. For a given positive integer K of not more than 1000000 digits, write the value of the smallest...
Python
#!/usr/bin/python import time, sys """ The nth term of the sequence of triangle numbers is given by, tn = 0.5 * n(n+1); so the first ten triangle numbers are: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... By converting each letter in a word to a number corresponding to its alphabetical position and adding these values...
Python
#!/usr/bin/python # http://projecteuler.net/problem=14 # import time """ Starting in the top left corner of a 2 x 2 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 20 x 20 grid? """ def main(): start = time.time() start r prin...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor def hyp(a, b): c = sqrt((a * a) + (b * b)) return c def main(): """ A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2 ...
Python
#!/usr/bin/python import time, sys from math import ceil, sqrt, floor def isprime(num): ans = True if num <= 1: return False if num % 2 == 0: return False for n in xrange(3, int(ceil(sqrt(num)))+1, 2): if num % n == 0: ans = False break return ans ...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor """ The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? """ def isprime(num): ans = True if num <= 1: return False if num % 2 == 0: return False for n in xr...
Python
#!/usr/bin/python import time, sys """ Problem 17 If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: D...
Python
#!/usr/bin/python # version 2 import time, sys import itertools """ In the 20 x 20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 53 88...
Python
#!/usr/bin/python # http://projecteuler.net/problem=14 # import time """ The following iterative sequence is defined for the set of positive integers: n n/2 (n is even) n 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 40 20 10 5 16 8 4 2 1 It can b...
Python
#!/usr/bin/python import time, sys import itertools """ In the 20 x 20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13...
Python
#!/usr/bin/python import time, sys from math import pow as power """ The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 552 = 3025 Hence the difference between the sum of the squares of the first...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor, log10 """ The Fibonacci sequence is defined by the recurrence relation: fn = fn1 + fn2, where F1 = 1 afnd F2 = 1. Hence the first 12 terms will be: F1 = 1 F2 = 1 F3 = 2 F4 = 3 F5 = 5 F6 = 8 F7 = 13 F8 = 21 F9 = 34 F12 = 144 The 12th term, F12,...
Python
#!/usr/bin/python import time, sys from math import pow as power """ A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left. For a given positive integer K of not more than 1000000 digits, write the value of the smallest...
Python
#!/usr/bin/python import time, sys """ The nth term of the sequence of triangle numbers is given by, tn = 0.5 * n(n+1); so the first ten triangle numbers are: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... By converting each letter in a word to a number corresponding to its alphabetical position and adding these values...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor """ The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million """ def isprime(num): ans = True if num <= 1: return False if num == 2: return True for n in xrange(2,...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor """ A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. Find the largest palindrome made from the product of two 3-digit numbers. """ def ispalindrome(x): x = s...
Python
#!/usr/bin/python import time, sys from math import sqrt, ceil, floor """ The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? """ def isprime(num): ans = True for n in xrange(2, int(ceil(sqrt(num)))+1): if num % n == 0: ans = Fals...
Python
#!/usr/bin/python import time, sys from math import ceil, sqrt, floor """ A Hamming number is a positive number which has no prime factor larger than 5. So the first few Hamming numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15. There are 1105 Hamming numbers not exceeding 10^8. We will call a positive number a gene...
Python
#!/usr/bin/python # Database Module for functional genes # by Aaron (ams@bio.aau.dk) import Bio.SeqIO as SeqIO import Bio.Entrez as Entrez import os Entrez.email = "ams@bio.aau.dk"
Python
#!/usr/bin/python # ams@bio.aau.au from Bio.SeqIO.QualityIO import FastqGeneralIterator import os.path def reformat_for_qiime(filehandle, outfilepath): """takes a fh of a fastq-illumina file and reformats to fasta for qiime the output is compatible with the outpur of the slipt_libraries.py """ fastqfile =...
Python
#!/usr/bin/python # Database Module for functional genes # by Aaron (ams@bio.aau.dk) import Bio.SeqIO as SeqIO import Bio.Entrez as Entrez import os Entrez.email = "ams@bio.aau.dk"
Python
#!/usr/bin/python from Bio import SeqIO from Bio.SeqRecord import SeqRecord import os import os.path import re import subprocess def phd2fasta(filename, inpath, qualflag = 'TRUE'): '''Biopython implementation of phd2fasta ''' if filename[-6:] == '.phd.1': stubname = filename[:-6] elif filename [-4...
Python
#!/usr/bin/python # by Aaron (ams@bio.aau.dk) ########## Import functions ########### import sys from Bio import Entrez from Bio.Blast import NCBIWWW from Bio.Blast import NCBIXML """ A library of functions for efetch scripting """ ############## Functions ############### def efetch_nt_fasta(acc, start...
Python
#!/usr/bin/python # ams@bio.aau.dk import subprocess # make an alignment # muscle -in strep.mod.seqs.txt -out strep.align.txt # degap the alignment # calculate a tree # FastTree -nt strep.align.txt > strep.tree.txt # print the tree # in R # library(ape) # tree = read.tree('tree.nwk') # plot(tree)...
Python
#!/usr/bin/python # by Aaron (ams@bio.aau.dk) DNA_complements = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C', 'a': 't', 't': 'a', 'c': 'g', 'g': 'c',} RNA_complements = {'A': 'U', 'U': 'A', 'C': 'G', 'G': 'C', 'a': 'u', 'u': 'a', 'c': 'g', 'g': 'c',} DNA_codon_table = { ...
Python
#!/usr/bin/python # by Aaron (ams@bio.aau.dk) ########## Import functions ########### import sys from Bio import Entrez from Bio.Blast import NCBIWWW from Bio.Blast import NCBIXML """ A library of functions for efetch scripting """ ############## Functions ############### def efetch_nt_fasta(acc, start...
Python
#!/usr/bin/python from Bio import SeqIO from Bio.SeqRecord import SeqRecord import os import os.path import re import subprocess def phd2fasta(filename, inpath, qualflag = 'TRUE'): '''Biopython implementation of phd2fasta ''' if filename[-6:] == '.phd.1': stubname = filename[:-6] elif filename [-4...
Python
#!/usr/bin/python # ams@bio.aau.au from Bio.SeqIO.QualityIO import FastqGeneralIterator import os.path def reformat_for_qiime(filehandle, outfilepath): """takes a fh of a fastq-illumina file and reformats to fasta for qiime the output is compatible with the outpur of the slipt_libraries.py """ fastqfile =...
Python
#!/usr/bin/python # by Aaron (ams@bio.aau.dk) DNA_complements = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C', 'a': 't', 't': 'a', 'c': 'g', 'g': 'c',} RNA_complements = {'A': 'U', 'U': 'A', 'C': 'G', 'G': 'C', 'a': 'u', 'u': 'a', 'c': 'g', 'g': 'c',} DNA_codon_table = { ...
Python
#!/usr/bin/python # fasta.py # ams@bio.aau.dk def parse_rnammer_fasta_header(header): """take a header and returns gi, acc, start, stop, strand(PLUS/MINUS), molecule """ main, molecule, score = header.strip().split() fields = main.split('|') gi = fields[1] acc, version = fie...
Python
#Python code snippets # ams@bio.aau.dk # boiler plate if __name__ == '__main__': main() # to iterate and index (NOTE: base-zero index) for i, item in enumerate(iterator)): pass # index starts at 1!!! for i, item in enumerate(iterator, 1)): pass # take the first string in a delimited sting...
Python
#!/usr/bin/python # ams@bio.aau.dk import subprocess # make an alignment # muscle -in strep.mod.seqs.txt -out strep.align.txt # degap the alignment # calculate a tree # FastTree -nt strep.align.txt > strep.tree.txt # print the tree # in R # library(ape) # tree = read.tree('tree.nwk') # plot(tree)...
Python
#!/usr/bin/python from optparse import OptionParser import re import subprocess import sys """ This script generates a release note from the output of git log between the specified tags. Options: --issues Show output the commits with issues associated with them. --issue-numbers Show outputs issue numbers o...
Python
#!/usr/bin/env python import commands import getopt import sys SSH_USER = 'bot' SSH_HOST = 'localhost' SSH_PORT = 29418 SSH_COMMAND = 'ssh %s@%s -p %d gerrit approve ' % (SSH_USER, SSH_HOST, SSH_PORT) FAILURE_SCORE = '--code-review=-2' FAILURE_MESSAGE = 'This commit message does not match the standard.' \ + '...
Python
#!/usr/bin/env python2.6 # Copyright (c) 2010, Code Aurora Forum. 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 # not...
Python
#!/usr/bin/python # # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/env python # # Copyright (c) 2002, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this ...
Python
#!/usr/bin/env python # Copyright (c) 2010, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this l...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
#!/usr/bin/python2.4 # -*- coding: utf-8 -*- # # Copyright (C) 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
Python
# Copyright 2011 Google Inc. All Rights Reserved. """Locked file interface that should work on Unix and Windows pythons. This module first tries to use fcntl locking to ensure serialized access to a file, then falls back on a lock file if that is unavialable. Usage: f = LockedFile('filename', 'r+b', 'rb') f....
Python
# Copyright 2011 Google Inc. All Rights Reserved. """Multi-credential file store with lock support. This module implements a JSON credential store where multiple credentials can be stored in one file. That file supports locking both in a single process and across processes. The credential themselves are keyed off o...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
__version__ = "1.0c2"
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2007 Joe Gregorio # # Licensed under the MIT License """MIME-Type Parser This module provides basic functions for handling mime-types. It can handle matching mime-types against a list of media-ranges. See section 14.1 of the HTTP specification [RFC 2616] for a complete explanation. http://www.w3.o...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# 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
__version__ = "1.0c2"
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