commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
a737126f8f8bcac1a00999f9e5c2a23bca9efd0d | Create hamming.py | mikejthomas/biote100_pset2 | hamming.py | hamming.py | #Python Problem 2
#hamming.py
#Introduction to Bioinformatics Assignment 2
#Purpose:Calculate Hamming Distance
#Your Name: Michael Thomas
#Date: 10/10/15
#stores 3 database sequences
seqList = ["AGGATACAGCGGCTTCTGCGCGACAAATAAGAGCTCCTTGTAAAGCGCCAAAAAAAGCCTCTCGGTCTGTGGCAGCAGCGTTGGCCCGGCCCCGGGAGCGGAGAGCGAGGGGAGGCAGATTCGG... | mit | Python | |
7b73c957ad52f9b846955b96b7cc6d0938587bb3 | Add 3rd order covariance | synergetics/spectrum | src/conventional/cum3est.py | src/conventional/cum3est.py | #!/usr/bin/env python
from __future__ import division
import numpy as np
from scipy.linalg import hankel
import scipy.io as sio
import matplotlib.pyplot as plt
from tools import *
def cum3est(y, maxlag, nsamp, overlap, flag, k1):
"""
UM3EST Third-order cumulants.
Should be invoked via "CUMEST" for proper para... | mit | Python | |
ded893c34db0c6de521e6d735d6fce30f16f3a51 | Add WSGI file. | Osmose/noodleamp,Osmose/noodleamp | noodleamp.wsgi | noodleamp.wsgi | import os
import pwd
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def path(*paths):
return os.path.join(BASE_DIR, *paths)
os.environ['NOODLEAMP_CONFIG'] = path('settings_local.py')
# http://code.google.com/p/modwsgi/wiki/ApplicationIssues#User_HOME_Environment_Variable
os.environ['HOME'] =... | mit | Python | |
33393fcfcca30edafcf06df53550f4985033c459 | Add numba error module | stuartarchibald/numba,cpcloud/numba,pombredanne/numba,stuartarchibald/numba,pombredanne/numba,stonebig/numba,cpcloud/numba,sklam/numba,IntelLabs/numba,seibert/numba,pitrou/numba,stefanseefeld/numba,seibert/numba,ssarangi/numba,seibert/numba,gmarkall/numba,gmarkall/numba,stuartarchibald/numba,sklam/numba,stefanseefeld/n... | numba/error.py | numba/error.py | class NumbaError(Exception):
"Some error happened during compilation" | bsd-2-clause | Python | |
e8a5720c6959a3166c1c8a373ef00a390b89ac22 | Add rasp2geotiff script | TobiasLohner/rasp2geotiff | rasp2geotiff.py | rasp2geotiff.py | #!/usr/bin/env python
import xcsoar
import osr
import gdal
import numpy as np
import os, sys
import math
idx_min_x = idx_max_x = idx_min_y = idx_max_y = 0
spa_x = spa_y = 0
lat_0 = lat_1 = lon_0 = 0
lat_c = lon_c = 0
raster_data = None
def get_parameters(line):
global idx_min_x, idx_max_x, idx_min_y, idx_max_y, s... | unlicense | Python | |
c1e801798d3b7e8d4c9ba8a11f79ffa92bf182f5 | Add test cases for the logger | thombashi/pingparsing,thombashi/pingparsing | test/test_logger.py | test/test_logger.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
from __future__ import unicode_literals
import logbook
from pingparsing import (
set_logger,
set_log_level,
)
import pytest
class Test_set_logger(object):
@pytest.mark.parame... | mit | Python | |
c559cdd34a2dc8f3129c1fed5235291f22329368 | install crontab | ralokt/ubuntu-cleanup-annoyifier | install_crontab.py | install_crontab.py | #!/usr/bin/python2
from crontab import CronTab
import sys
CRONTAB_TAG = "ubuntu-cleanup-annoifier"
def install_cron():
my_cron = CronTab(user=True)
# job = my_cron.new(command=executable_path(args))
job = my_cron.new(command="dummy123")
job.minute.on(0)
job.hour.on(0)
job.enable()
jo... | mit | Python | |
ca8a7320cbec1d4fa71ec5a7f909908b8765f573 | Allow underscores for release tags (#4976) | GoogleCloudPlatform/gcloud-python,tseaver/google-cloud-python,tseaver/gcloud-python,tswast/google-cloud-python,tseaver/google-cloud-python,GoogleCloudPlatform/gcloud-python,jonparrott/gcloud-python,jonparrott/google-cloud-python,dhermes/google-cloud-python,dhermes/gcloud-python,tseaver/gcloud-python,googleapis/google-c... | test_utils/scripts/circleci/get_tagged_package.py | test_utils/scripts/circleci/get_tagged_package.py | # Copyright 2016 Google LLC
#
# 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 writing, s... | # Copyright 2016 Google LLC
#
# 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 writing, s... | apache-2.0 | Python |
ee679b745e955e3d555b49500ae2d09aa3336abb | Add a util function for SNMP | whowutwut/confluent,jjohnson42/confluent,jjohnson42/confluent,jjohnson42/confluent,whowutwut/confluent,whowutwut/confluent,xcat2/confluent,whowutwut/confluent,jjohnson42/confluent,xcat2/confluent,xcat2/confluent,xcat2/confluent,jjohnson42/confluent,xcat2/confluent | confluent_server/confluent/snmputil.py | confluent_server/confluent/snmputil.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2016 Lenovo
#
# 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 ... | apache-2.0 | Python | |
74e24debf55b003f1d56d35f4b040d91a0698e0a | Add example for cluster centroids method | dvro/UnbalancedDataset,dvro/imbalanced-learn,fmfn/UnbalancedDataset,scikit-learn-contrib/imbalanced-learn,scikit-learn-contrib/imbalanced-learn,glemaitre/UnbalancedDataset,dvro/UnbalancedDataset,dvro/imbalanced-learn,fmfn/UnbalancedDataset,glemaitre/UnbalancedDataset | example/under-sampling/plot_cluster_centroids.py | example/under-sampling/plot_cluster_centroids.py | """
=================
Cluster centroids
=================
An illustration of the cluster centroids method.
"""
print(__doc__)
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# Define some color for the plotting
almost_black = '#262626'
palette = sns.color_palette()
from sklearn.datasets import mak... | mit | Python | |
25cd25dab4de9e6963ffa622474b3f0bdcdc1e48 | Create preprocessor.py | zahllang/zahl | interpreter/preprocessor.py | interpreter/preprocessor.py | mit | Python | ||
0c1ccd5180601d3ed3f5dc98b3330d40c014f7c0 | Add simul. (#3300) | krafczyk/spack,mfherbst/spack,EmreAtes/spack,skosukhin/spack,EmreAtes/spack,LLNL/spack,matthiasdiener/spack,krafczyk/spack,lgarren/spack,skosukhin/spack,lgarren/spack,krafczyk/spack,TheTimmy/spack,matthiasdiener/spack,iulian787/spack,iulian787/spack,tmerrick1/spack,skosukhin/spack,tmerrick1/spack,LLNL/spack,EmreAtes/sp... | var/spack/repos/builtin/packages/simul/package.py | var/spack/repos/builtin/packages/simul/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
6cb953dc01a77bc549c53cc325a741d1952ed6b6 | Bump FIDO version to 1.3.12 | artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin | fpr/migrations/0025_update_fido_1312.py | fpr/migrations/0025_update_fido_1312.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def data_migration_up(apps, schema_editor):
"""
Update identification tool FIDO to 1.3.12, correcting a
character-spacing issue bug identified in PRONOM94 (again)
"""
idtool = apps.get_model('fpr', ... | agpl-3.0 | Python | |
8fa9a54c9a5ee683fc9e9d361a4eb7affe5e83ed | Add functions to paint game of life to screen | akud/stem-club-presentation,akud/stem-club-presentation,akud/stem-club-presentation | game_of_life.py | game_of_life.py | #!/usr/bin/env python
from curses import wrapper
from time import sleep
def enumerate_lines(matrix):
on = '*'
off = ' '
for i, row in enumerate(matrix):
yield i, ''.join(on if v else off for v in row)
def paint(stdscr, matrix):
stdscr.clear()
for i, line in enumerate_lines(matrix):
... | mit | Python | |
ff8cee4f98dde0533751dfd15308c5fdfdec3982 | test file for rapid iteration | ClimbsRocks/auto_ml | tests/quick_test.py | tests/quick_test.py | """
nosetests -sv --nologcapture tests/quick_test.py
"""
import datetime
import os
import random
import sys
sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path
os.environ['is_test_suite'] = 'True'
os.environ['KERAS_BACKEND'] = 'theano'
from auto_ml import Predictor
from auto_ml.utils_models import load... | mit | Python | |
c98a744f5f436ae2c6266a7bb5d32173cfd0e4a9 | Add a script that scrapes the Socrata catalog, just in case we need that in another format | opensmc/service-locator,opensmc/service-locator,opensmc/service-locator | scripts/socrata_scraper.py | scripts/socrata_scraper.py | #!/usr/bin/python3
"""
This is a basic script that downloads the catalog data from the smcgov.org
website and pulls out information about all the datasets.
This is in python3
There is an optional download_all argument that will allow you to download
all of the datasets individually and in their entirety. I have incl... | mit | Python | |
0c11d2740e561586bb4f9d2b67bda2ccc87e146e | Add new command to notify New Relic of deployment | infoxchange/ixdjango | ixdjango/management/commands/newrelic_notify_deploy.py | ixdjango/management/commands/newrelic_notify_deploy.py | """
Management command to enable New Relic notification of deployments
.. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au>
"""
import pwd
import os
from subprocess import Popen, PIPE
from urllib import urlencode
from httplib2 import Http
from django.conf import settings
from django.core... | mit | Python | |
c0ea919305bcedf080a2213f4c549c68fa4efa2d | test tools | gipi/parcel,gipi/parcel | tests/test_tools.py | tests/test_tools.py | import unittest2 as unittest
from fabric.api import run
import tempfile
from mixins import WebServerMixin
from parcel.tools import dl, rpull, rpush
def tempname():
return tempfile.mkstemp()[1]
import zlib, os
def crc32(filename):
CHUNKSIZE = 8192
checksum = 0
with open(filename, 'rb') as fh:
... | isc | Python | |
9de5728e5fdb0f7dc606681df685eb084477d8d0 | Add exercise | MindCookin/python-exercises | multiplyTwoNumbers.py | multiplyTwoNumbers.py | #!/usr/bin/env python
def main():
a = input("Enter a number: ")
b = input("Enter another number: ")
print "The product of %d and %d is %d" % (a, b, a * b)
main()
| apache-2.0 | Python | |
f883edc209928494c45693c5ecfd279bfbb09c97 | Add partfrac1 | mph-/lcapy | timing/partfrac1.py | timing/partfrac1.py | import time
from lcapy import *
funcs = [1 / s, 1 / s**2, 1 / (s + 3), 1 / (s + 3)**2, (s + 3) / (s + 4),
1 / (s + 3)**2 / (s + 4), 1 / (s + 3)**3 / (s + 4),
1 / (s + 3) / (s + 4) / (s + 5), (s + 6) / (s + 3) / (s + 4) / (s + 5),
1 / (s + 3)**2 / (s + 4)**2, 1 / (s + 3)**3 / (s + 4)**2,
... | lgpl-2.1 | Python | |
e71c232660a7480c2b56f6e76e83fad4c7e9da8a | Add ctm_test.py test for testing CRTC's CTM color matrix property. | tomba/kmsxx,tomba/kmsxx,tomba/kmsxx,tomba/kmsxx | py/tests/ctm_test.py | py/tests/ctm_test.py | #!/usr/bin/python3
import sys
import pykms
def ctm_to_blob(ctm, card):
len=9
arr = bytearray(len*8)
view = memoryview(arr).cast("I")
for x in range(len):
i, d = divmod(ctm[x], 1)
if i < 0:
i = -i
sign = 1 << 31
else:
sign = 0
view[x ... | mpl-2.0 | Python | |
04477b11bbe7efa1720829691b7d1c3fe2a7a492 | Add __init__ | Kriechi/hyper-h2,mhils/hyper-h2,Kriechi/hyper-h2,python-hyper/hyper-h2,vladmunteanu/hyper-h2,vladmunteanu/hyper-h2,bhavishyagopesh/hyper-h2,python-hyper/hyper-h2 | h2/__init__.py | h2/__init__.py | # -*- coding: utf-8 -*-
"""
h2
~~
A HTTP/2 implementation.
"""
__version__ = '0.1.0'
| mit | Python | |
2e2ad49c7ada145b5a4a81bd8941cf5e72d2d81b | Test case for wordaxe bug | thomaspurchas/rst2pdf,thomaspurchas/rst2pdf | rst2pdf/tests/input/test_180.py | rst2pdf/tests/input/test_180.py | # -*- coding: utf-8 -*-
from reportlab.platypus import SimpleDocTemplate
from reportlab.platypus.paragraph import Paragraph
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.colors import Color
from reportlab.platypus.flowables import _listWrapOn, _FUZZ
from wordaxe.rl.NewParagraph... | mit | Python | |
698eee3db238189ba066670c4fe4a1193e6a942a | add flask-login | dwisulfahnur/flask-login,dwisulfahnur/flask-login,dwisulfahnur/flask-login | app/user/loginmanager.py | app/user/loginmanager.py | from flask.ext.login import LoginManager
from models import User
login_manager = LoginManager()
@login_manager.user_loader
def user_loader(user_id):
return User.query.get(user_id)
login_manager.login_view = '.login'
| apache-2.0 | Python | |
d5d8e16b5ccbbb65398ce015f020db3839fac409 | add test_rotate.py | yuyu2172/chainercv,yuyu2172/chainercv,chainer/chainercv,pfnet/chainercv,chainer/chainercv | tests/transforms_tests/image_tests/test_rotate.py | tests/transforms_tests/image_tests/test_rotate.py | import random
import unittest
import numpy as np
from chainer import testing
from chainercv.transforms import flip
from chainercv.transforms import rotate
class TestRotate(unittest.TestCase):
def test_rotate(self):
img = np.random.uniform(size=(3, 32, 24))
angle = random.uniform(0, 180)
... | mit | Python | |
de74c933b74d9066984fe040edf026b7d9f87711 | Split problem statement 2 | rahulbohra/Python-Basic | 69_split_problem_statement_2.py | 69_split_problem_statement_2.py | '''
Open the file sample.txt and read it line by line.
When you find a line that starts with 'From:' like the following line:
From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008
You will parse the From line using split() and print out the second word in the line
(i.e. the entire address of the person who sent ... | mit | Python | |
01029805a6fb3484cf803f0c0abd18232b4ad810 | Add database tools | openego/ego.io,openego/ego.io | egoio/tools/db.py | egoio/tools/db.py | def grant_db_access(conn, schema, table, role):
r"""Gives access to database users/ groups
Parameters
----------
conn : sqlalchemy connection object
A valid connection to a database
schema : str
The database schema
table : str
The database table
role : str
da... | agpl-3.0 | Python | |
bc9072cee7ce880c30af83ee4c239ae9cf1ddbfe | Create NumberofIslandsII_001.py | cc13ny/Allin,Chasego/codirit,Chasego/cod,Chasego/codi,cc13ny/Allin,cc13ny/algo,Chasego/cod,cc13ny/Allin,Chasego/cod,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,Chasego/codi,Chasego/codi,Chasego/codi,Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/codirit,cc13ny/algo,Chasego/cod,cc13ny/algo,Chasego/codirit,cc13ny/algo,Chaseg... | lintcode/Number-of-Islands-II/NumberofIslandsII_001.py | lintcode/Number-of-Islands-II/NumberofIslandsII_001.py | # Definition for a point.
# class Point:
# def __init__(self, a=0, b=0):
# self.x = a
# self.y = b
class UnionFind:
def __init__(self, n, m):
self.fathers = {}
self.nsets = 0
self.grid = [[0 for _ in range(m)] for _ in range(n)]
self.n = n
self.m = m
... | mit | Python | |
bc3f4575c7267db8f7841a82e8f6866c59d15237 | Add some example function tests that use gaeftest | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | tests/test_functional.py | tests/test_functional.py | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange authors.
#
# 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... | apache-2.0 | Python | |
4856b426b380d4d46cccc2f5b8ab2212956a96c2 | test of time module. not terribly fancy, but it does touch every function and variable in the module, verifies a few return values and even tests a couple of known error conditions. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_time.py | Lib/test/test_time.py | import time
time.altzone
time.clock()
t = time.time()
time.asctime(time.gmtime(t))
if time.ctime(t) <> time.asctime(time.localtime(t)):
print 'time.ctime(t) <> time.asctime(time.localtime(t))'
time.daylight
if int(time.mktime(time.localtime(t))) <> int(t):
print 'time.mktime(time.localtime(t)) <> t'
time.sle... | mit | Python | |
c851501cc8149685a9e9c023aa200b92c17a9078 | Add decoder ida fields name | goodwinxp/ATFGenerator,goodwinxp/ATFGenerator,goodwinxp/ATFGenerator | pida_fields.py | pida_fields.py | def decode_name_fields(ida_fields):
i = -1
stop = len(ida_fields)
while True:
i += 1
if i == stop:
break
count = ord(ida_fields[i]) - 1
if count == 0:
continue
i += 1
yield ida_fields[i:i + count]
i += count - 1
| mit | Python | |
e869c7ef9e3d19da4c98cda57b5e22fb5a35cba5 | Add first basic unittests using py.test | Khan/wtforms | tests/test_validators.py | tests/test_validators.py | """
test_validators
~~~~~~~~~~~~~~
Unittests for bundled validators.
:copyright: 2007-2008 by James Crasta, Thomas Johansson.
:license: MIT, see LICENSE.txt for details.
"""
from py.test import raises
from wtforms.validators import ValidationError, length, url, not_empty, email, ip_addres... | bsd-3-clause | Python | |
54c358a296733d2a5236a9a776830f1b78682b73 | Add lc040_combination_sum_ii.py | bowen0701/algorithms_data_structures | lc040_combination_sum_ii.py | lc040_combination_sum_ii.py | """Leetcode 40. Combination Sum II
Medium
URL: https://leetcode.com/problems/combination-sum-ii/
Given a collection of candidate numbers (candidates) and a target number (target),
find all unique combinations in candidates where the candidate numbers sums to target.
Each number in candidates may only be used once in... | bsd-2-clause | Python | |
7fab8c2d014f013131bd4d6301f5f8e5268d6037 | add leetcode Pow(x, n) | Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code | leetcode/powx-n/solution.py | leetcode/powx-n/solution.py | # -*- coding:utf-8 -*-
class Solution:
# @param x, a float
# @param n, a integer
# @return a float
def pow(self, x, n):
if n == 0:
return 1
if n < 0:
neg_flag = True
n = -n
else:
neg_flag = False
ret = 1
while n > 0... | mit | Python | |
736103ea495c89defcae9bf6ab72aa7b89768026 | add start of advisory module | sassoftware/mirrorball,sassoftware/mirrorball | updatebot/advise.py | updatebot/advise.py | #
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | apache-2.0 | Python | |
27b9727926139ae2cfde6d3cdcdf5746ed28e03d | Add new package arbor (#11914) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/arbor/package.py | var/spack/repos/builtin/packages/arbor/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Arbor(CMakePackage):
"""Arbor is a high-performance library for computational neuroscience... | lgpl-2.1 | Python | |
ac851c402952cf44b24dfdf5277765ff286dd994 | convert embeddingns to js-friendly format | brandonmburroughs/food2vec,altosaar/food2vec,altosaar/food2vec,brandonmburroughs/food2vec,altosaar/food2vec,brandonmburroughs/food2vec,brandonmburroughs/food2vec | src/convert_embeddings_to_js.py | src/convert_embeddings_to_js.py | import h5py
import json
import numpy as np
def load_embeddings(path):
f = h5py.File(path, 'r')
nemb = f['nemb'][:]
f.close()
return nemb
def load_vocab(path):
vocab = []
with open(path, 'rb') as f:
for line in f.readlines():
split = line.split(' ')
vocab.append((split[0], int(split[1].rstr... | mit | Python | |
11efa5583bbeeee7c7823264f6f73715ea81edc0 | Add trivial test for ECO fetching | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | luigi/tests/ontologies/eco_test.py | luigi/tests/ontologies/eco_test.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | apache-2.0 | Python | |
ec3b080b2f1922f4989b853db45475d185e314de | add all | pombredanne/pyjs,gpitel/pyjs,pyjs/pyjs,spaceone/pyjs,pombredanne/pyjs,spaceone/pyjs,anandology/pyjamas,anandology/pyjamas,minghuascode/pyj,Hasimir/pyjs,minghuascode/pyj,pyjs/pyjs,pyjs/pyjs,anandology/pyjamas,pombredanne/pyjs,Hasimir/pyjs,pyjs/pyjs,lancezlin/pyjs,minghuascode/pyj,minghuascode/pyj,gpitel/pyjs,gpitel/pyjs... | examples/gcharttestapp/TestGChart00.py | examples/gcharttestapp/TestGChart00.py |
import GChartTestAppUtil
from pyjamas.chart.GChart import GChart
"""* Empty chart without anything on it except a title and footnotes """
class TestGChart00 (GChart):
def __init__(self):
GChart.__init__(self, 150,150)
self.setChartTitle(GChartTestAppUtil.getTitle(self))
self.setChartFootn... | apache-2.0 | Python | |
4fdba8a1a5a2123843cc9eefd8949fb8996f59b2 | Add a wrapper for ChromeOS to call into telemetry. | SummerLW/Perf-Insight-Report,SummerLW/Perf-Insight-Report,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult-csm,catapult-project/catapult,benschmaus/catapult,benschmaus/catapult,catapult-project/catapult-csm,catapult-project/catapult-csm,catapult-project/catapult,Su... | telemetry/telemetry/unittest/run_chromeos_tests.py | telemetry/telemetry/unittest/run_chromeos_tests.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import sys
from telemetry.unittest import gtest_progress_reporter
from telemetry.unittest import run_tests
from telemetry.core impor... | bsd-3-clause | Python | |
fcce65daf40bb1c198be7ddadee8769bf6feea9b | Create k-order-test.py | wangxiaox10/projetlibre | k-order-test.py | k-order-test.py | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 6 16:41:40 2014
@author: xiao
"""
from k_order import *
#number of items to recommand
p=2
fadress = "/home/xiao/ProjetLibre/matrix/matrixInfo"
readDataFromFile(fadress)
getDu()
recommendationListe = zeros((m,p))
############################################
#### We ... | bsd-3-clause | Python | |
d73235dd994d3705178d0cff142293444977d764 | Remove bad imports | cowlicks/odo,quantopian/odo,quantopian/odo,ContinuumIO/odo,cowlicks/odo,cpcloud/odo,ContinuumIO/odo,cpcloud/odo,blaze/odo,blaze/odo | odo/backends/tests/conftest.py | odo/backends/tests/conftest.py | import os
import shutil
import pytest
@pytest.fixture(scope='session')
def sc():
pyspark = pytest.importorskip('pyspark')
return pyspark.SparkContext('local[*]', 'odo')
@pytest.yield_fixture(scope='session')
def sqlctx(sc):
pyspark = pytest.importorskip('pyspark')
try:
yield pyspark.HiveCon... | import os
import shutil
import pytest
@pytest.fixture(scope='session')
def sc():
pytest.importorskip('pyspark')
from pyspark import SparkContext
return SparkContext('local[*]', 'odo')
@pytest.yield_fixture(scope='session')
def sqlctx(sc):
pytest.importorskip('pyspark')
from odo.backends.sparksql... | bsd-3-clause | Python |
4c5a8f018af4377ce3f9367b0c66a51a6cad671b | add __init__.py | esjeon/eatable | eatable/__init__.py | eatable/__init__.py |
from .table import Table
from .row import Row
| mit | Python | |
2b15d2df8333db5f5cd6fcefaf56f5400baba95e | add test_results_table.py | daler/metaseq,daler/metaseq,daler/metaseq,agrimaldi/metaseq,mrGeen/metaseq,mrGeen/metaseq,agrimaldi/metaseq,agrimaldi/metaseq,mrGeen/metaseq | metaseq/test/test_results_table.py | metaseq/test/test_results_table.py | from metaseq import results_table
import metaseq
import numpy as np
fn = metaseq.example_filename('ex.deseq')
d = results_table.ResultsTable(fn)
def test_dataframe_access():
# different ways of accessing get the same data in memory
assert d.id is d.data.id
assert d['id'] is d.data.id
def test_dataframe... | mit | Python | |
2382c1c9daf2b17799ceb03f42a6917966b3162c | add kattis/cold | mjenrungrot/competitive_programming,mjenrungrot/competitive_programming,mjenrungrot/competitive_programming,mjenrungrot/competitive_programming,mjenrungrot/algorithm | Kattis/cold.py | Kattis/cold.py | """
Problem: cold
Link: https://open.kattis.com/problems/cold
Source: Kattis
"""
N = int(input())
A = list(map(int, input().split()))
answer = 0
for i in range(len(A)):
answer += (A[i] < 0)
print(answer)
| mit | Python | |
dd93b450eb0cc92debd8b5cec82f3127c454d77f | put this back... | annayqho/TheCannon,annayqho/TheCannon | TheCannon/infer_labels.py | TheCannon/infer_labels.py | from __future__ import (absolute_import, division, print_function, unicode_literals)
from scipy import optimize as opt
import numpy as np
LARGE = 200.
SMALL = 1. / LARGE
def _get_lvec(labels):
"""
Constructs a label vector for an arbitrary number of labels
Assumes that our model is quadratic in the label... | mit | Python | |
652a03d96cbc5c06850fa62fa3507fb74ee3deab | Create python_ciphertext.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | Encryption/python_ciphertext.py | Encryption/python_ciphertext.py | #Simply how to make a ciphertext only with 1 line.
>>> #hex_encode = 'summonagus'.encode('hex')
>>> hex_encode = '73756d6d6f6e61677573'
>>> chip = ''.join([ str(int(a)*2) if a.isdigit() and int(a) == 3 else str(int(a)/2) if a.isdigit() and int(a) == 6 else a for a in hex_encode ])
>>>
>>> hex_encode
'73756d6d6f6e616... | agpl-3.0 | Python | |
8add0d44139b527d40aaa9da43d023ddde52c410 | Add string python solution | byung-u/ProjectEuler | HackerRank/PYTHON/Strings/alphabet_rangoli.py | HackerRank/PYTHON/Strings/alphabet_rangoli.py | #!/usr/bin/env python3
import sys
from string import ascii_lowercase
def print_rangoli(size):
width = size * 4 - 3
alphabet = (ascii_lowercase[0:size])[::-1]
res = []
for i in range(size):
s = ''
for a in alphabet[0:i+1]:
s = '%s-%s' % (s, a)
temp = s + s[::-1][1:]
... | mit | Python | |
eac74d731b01f732d23ce21e8132fa0785aa1ab2 | Create visible_elements.py | kiryushah/test-selenium_first | visible_elements.py | visible_elements.py | # -*- coding: utf-8 -*-
import unittest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
class visible_elements(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome("C://chromedriver/chromedriver.exe")
... | apache-2.0 | Python | |
5343c89686fd05cf251388e1f28bfd4343d4c277 | Add python-based CPU implementation | kwadraterry/GPGPU-LUT,kwadraterry/GPGPU-LUT,kwadraterry/GPGPU-LUT,kwadraterry/GPGPU-LUT,kwadraterry/GPGPU-LUT | src/CPU/color_histogram.py | src/CPU/color_histogram.py | from PIL import Image
from collections import defaultdict
import sys
im = Image.open(sys.argv[1])
colors = defaultdict(int)
for pixel in im.getdata():
colors[pixel] += 1
print colors
| bsd-3-clause | Python | |
f408465521484032631adfe9dced21119ad2bf82 | Revert "Delete old MultiServer implementation" | HubbeKing/Hubbot_Twisted | MultiServer.py | MultiServer.py | from multiprocessing import Process
import subprocess
import GlobalVars
def botInstance(server, channels):
args = ["python", "hubbebot.py"]
args.append(server)
for chan in channels:
args.append(chan)
subprocess.call(args)
if __name__ == "__main__":
for (server,channels) in GlobalVars.con... | mit | Python | |
2ef9618e705bb293641674ca5e7cc1f14daf3483 | Set default branding for all organisations | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0285_default_org_branding.py | migrations/versions/0285_default_org_branding.py | """empty message
Revision ID: 0285_default_org_branding
Revises: 0284_0283_retry
Create Date: 2016-10-25 17:37:27.660723
"""
# revision identifiers, used by Alembic.
revision = '0285_default_org_branding'
down_revision = '0284_0283_retry'
from alembic import op
import sqlalchemy as sa
BRANDING_TABLES = ('email_br... | mit | Python | |
52b870d36370f46fdc33de2948504c2aec8db1a1 | fix field names in network object | wathsalav/xos,wathsalav/xos,wathsalav/xos,wathsalav/xos | planetstack/core/migrations/0002_network_field_case.py | planetstack/core/migrations/0002_network_field_case.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import timezones.fields
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='networktemp... | apache-2.0 | Python | |
9b584c6d23ad93fd497fb2e71d2343a954cea4e5 | Create PaulFinalproject.py | kingmayonaise/Final-Project | PaulFinalproject.py | PaulFinalproject.py | mit | Python | ||
8462466f8a21f25f85b8a06076877361b2545a12 | Add initialize script | MaritimeRenewable/PyResis | PyResis/__init__.py | PyResis/__init__.py | __author__ = 'Yu Cao'
| mit | Python | |
8fcc727f9a7fbd886bc900f9c24cf2711a0c5b99 | Create Record.py | Larz60p/Python-Record-Structure | Record.py | Record.py | """
The MIT License (MIT)
Copyright (c) <2016> <Larry McCaig (aka: Larz60+ aka: Larz60p)>
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 rig... | mit | Python | |
1708eb17fb9c232414b0e162754ca31b6fd9366c | Add tests for plagiarism filter command | empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core | services/comprehension/main-api/comprehension/tests/management/commands/test_pre_filter_responses.py | services/comprehension/main-api/comprehension/tests/management/commands/test_pre_filter_responses.py | import csv
from io import StringIO
from unittest.mock import call, MagicMock, patch
from django.test import TestCase
from ....views.plagiarism import PlagiarismFeedbackView
from ....management.commands import pre_filter_responses
Command = pre_filter_responses.Command
class TestCommandBase(TestCase):
def setU... | agpl-3.0 | Python | |
06ced5abe2226a234c2e2887fbf84f18dfa7ddc4 | Update timer for new label. Clean up a bit and use more pyglet 1.1 features. | xshotD/pyglet,mpasternak/pyglet-fix-issue-518-522,kmonsoor/pyglet,Austin503/pyglet,kmonsoor/pyglet,gdkar/pyglet,odyaka341/pyglet,google-code-export/pyglet,odyaka341/pyglet,cledio66/pyglet,mpasternak/pyglet-fix-issue-518-522,mpasternak/michaldtz-fix-552,Alwnikrotikz/pyglet,qbektrix/pyglet,google-code-export/pyglet,mpast... | examples/timer.py | examples/timer.py | '''A full-screen minute:second timer. Leave it in charge of your conference
lighting talks.
After 5 minutes, the timer goes red. This limit is easily adjustable by
hacking the source code.
Press spacebar to start, stop and reset the timer.
'''
import pyglet
window = pyglet.window.Window(fullscreen=True)
class Ti... | from pyglet import window
from pyglet import text
from pyglet import clock
from pyglet import font
w = window.Window(fullscreen=True)
class Timer(text.Label):
def stop(self):
self.__time = 0
def reset(self):
self.__time = 0
self.__running = False
self.text = '00:00'
def ani... | bsd-3-clause | Python |
064c1a5bd8790c9ea407f62de0428657354e979f | Create jcolor.py | JaredMHall/pulltag,zwparchman/pulltag | jcolor.py | jcolor.py | # colors
HEADER = '\033[95m'
FAIL = '\033[91m'
FGBLUE2 = '\033[94m'
FGGREEN2 = '\033[92m'
FGORANGE = '\033[93m'
FGGRAY = '\033[30m'
FGRED = '\033[31m'
FGGREEN = '\033[32m'
FGYELLOW = '\033[33m'
FGBLUE = '\033[34m'
FGMAG = '\033[35m'
FGCYAN = '\033[36m'
FGWHITE = '\033[37m'
# FGGRAY = '\033[61m'
BGBLACK = '\033[40m'
B... | mit | Python | |
040911e2343ec6753c767eff44be2cf54eb33ff8 | add file name to fasta sequence headers | fandemonium/code,chnops/code,fandemonium/code,chnops/code,fandemonium/code,chnops/code,fandemonium/code | add_file_name_to_reads.py | add_file_name_to_reads.py | import os
import sys
from Bio import SeqIO
out = open(sys.argv[2], 'w')
for records in SeqIO.parse(open(sys.argv[1], 'rU'), "fasta"):
records.id = records.id.strip() + '%s' % sys.argv[1].split('.')[0]
records.name = records.id
records.description = records.id
SeqIO.write(records, out, 'fasta')
| mit | Python | |
c420f6bf996c53fa8958956626c136ac0e9e55f6 | Add sonos updater plugin. | jackwilsdon/beets,ibmibmibm/beets,beetbox/beets,sampsyo/beets,shamangeorge/beets,jackwilsdon/beets,sampsyo/beets,SusannaMaria/beets,jackwilsdon/beets,beetbox/beets,sampsyo/beets,jackwilsdon/beets,shamangeorge/beets,beetbox/beets,shamangeorge/beets,ibmibmibm/beets,SusannaMaria/beets,beetbox/beets,sampsyo/beets,SusannaMa... | beetsplug/sonosupdate.py | beetsplug/sonosupdate.py | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2018, Tobias Sauerwein.
#
# 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... | mit | Python | |
797114781ed4f31c265c58a76e39aa8ff6a16443 | Add missing file from last commit | ppwwyyxx/tensorpack,eyaler/tensorpack,eyaler/tensorpack,ppwwyyxx/tensorpack | tensorpack/utils/compatible_serialize.py | tensorpack/utils/compatible_serialize.py | #!/usr/bin/env python
import os
from .serialize import loads_msgpack, loads_pyarrow, dumps_msgpack, dumps_pyarrow
"""
Serialization that has compatibility guarantee (therefore is safe to store to disk).
"""
__all__ = ['loads', 'dumps']
# pyarrow has no compatibility guarantee
# use msgpack for persistent serializa... | apache-2.0 | Python | |
2f155e1dafd5302dfbf4607af81bfa979046be8e | add test file | parrt/msan501-starterkit | junk/t.py | junk/t.py | def f():
print "hi"
f() | bsd-2-clause | Python | |
cfb39d7389d63a293dc075d420f80276a34df193 | Add minimal pygstc example to play a video | RidgeRun/gstd-1.x,RidgeRun/gstd-1.x,RidgeRun/gstd-1.x,RidgeRun/gstd-1.x | examples/pygstc/simple_pipeline.py | examples/pygstc/simple_pipeline.py | import time
import sys
from pygstc.gstc import *
from pygstc.logger import *
#Create a custom logger with loglevel=DEBUG
gstd_logger = CustomLogger('simple_pipeline', loglevel='DEBUG')
#Create the client with the logger
gstd_client = GstdClient(logger=gstd_logger)
def printError():
print("To play run: python3 si... | lgpl-2.1 | Python | |
f8d06f85e896c1098f58667c161d920f6d255d7b | Add utility for sent mail | Micronaet/micronaet-utility,Micronaet/micronaet-utility,Micronaet/micronaet-utility,Micronaet/micronaet-utility | sendmail/log_mail.py | sendmail/log_mail.py | # -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | agpl-3.0 | Python | |
ddac657da2743c7435e8408677406d37eaea5836 | Add migration. | open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,open-craft/opencraft | instance/migrations/0041_auto_20160420_1409.py | instance/migrations/0041_auto_20160420_1409.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('instance', '0040_auto_20160420_0754'),
]
operations = [
migrations.AlterField(
model_name='openstackserver',
... | agpl-3.0 | Python | |
4c6964a6043c6c5bb3df7ad184e2c6a5537ca6da | Create __init__.py | pkug/intelmq,certtools/intelmq,aaronkaplan/intelmq,aaronkaplan/intelmq,pkug/intelmq,robcza/intelmq,aaronkaplan/intelmq,robcza/intelmq,pkug/intelmq,certtools/intelmq,robcza/intelmq,pkug/intelmq,robcza/intelmq,certtools/intelmq | intelmq/tests/bots/experts/fqdn2ip/__init__.py | intelmq/tests/bots/experts/fqdn2ip/__init__.py | agpl-3.0 | Python | ||
ce5ca3ac3268af331150f66865072a049869b3b2 | add abstraction magics | dekstop/ipython_extensions,NunoEdgarGub1/ipython_extensions,NunoEdgarGub1/ipython_extensions,danielballan/ipython_extensions,dekstop/ipython_extensions,minrk/ipython_extensions,NunoEdgarGub1/ipython_extensions,minrk/ipython_extensions,danielballan/ipython_extensions,danielballan/ipython_extensions,minrk/ipython_extensi... | abstraction.py | abstraction.py | """
abstraction magics
let's you turn a cell into a function
In [1]: plot(x, f(y))
...: xlabel('x')
...: ylabel('y')
In [2]: %functionize 1
"""
from IPython.utils.text import indent
def parse_ranges(s):
blocks = s.split(',')
ranges = []
for block in blocks:
if '-' in block:
sta... | bsd-3-clause | Python | |
9af5c4e79234a47ac26e5d1890e70f741363b18a | Create factorise_test.py | nick599/PythonMathsAlgorithms | factorise_test.py | factorise_test.py | apache-2.0 | Python | ||
425a8e26d371038f6ebf7c80dd7faea0f1dd906e | Add base test for admin endpoints [WAL-883] | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/core/tests/unittests/test_admin.py | nodeconductor/core/tests/unittests/test_admin.py | from django.contrib import admin
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
User = get_user_model()
class TestAdminEndpoints(TestCase):
def setUp(self):
user, _ = User.objects.get_or_create(username='username', is_staff=True)
... | mit | Python | |
90a30ae1b3165c03f6de5458c92f8ecb9d3f948a | Add homework min_three | lukin155/skola-programiranja | domaci-zadaci/05/test_min_three.py | domaci-zadaci/05/test_min_three.py | from solutions import min_three
import unittest
import random
class TestMinThree(unittest.TestCase):
def test_1000_cases(self):
for _ in range(1000):
first = (random.random() - 0.5) * 2000
second = (random.random() - 0.5) * 2000
third = (random.random() - 0.5) * 2000
... | mit | Python | |
aad51679cc2e4e719ed12e3983b54dcf15a2c06f | Update slack.py | fried-sausage/graphite-beacon,klen/graphite-beacon,klen/graphite-beacon,klen/graphite-beacon,fried-sausage/graphite-beacon,fried-sausage/graphite-beacon | graphite_beacon/handlers/slack.py | graphite_beacon/handlers/slack.py | import json
from tornado import gen, httpclient as hc
from graphite_beacon.handlers import AbstractHandler, LOGGER
from graphite_beacon.template import TEMPLATES
class SlackHandler(AbstractHandler):
name = 'slack'
# Default options
defaults = {
'webhook': None,
'channel': None,
... | import json
from tornado import gen, httpclient as hc
from graphite_beacon.handlers import AbstractHandler, LOGGER
from graphite_beacon.template import TEMPLATES
class SlackHandler(AbstractHandler):
name = 'slack'
# Default options
defaults = {
'webhook': None,
'channel': None,
... | mit | Python |
34908071bd11470806a84d9f76c630fd3fcc2d4b | test file :-) | g-weatherill/oq-hazardlib,gem/oq-engine,vup1120/oq-hazardlib,g-weatherill/oq-hazardlib,silviacanessa/oq-hazardlib,ROB-Seismology/oq-hazardlib,gem/oq-engine,mmpagani/oq-hazardlib,rcgee/oq-hazardlib,mmpagani/oq-hazardlib,gem/oq-hazardlib,larsbutler/oq-hazardlib,g-weatherill/oq-hazardlib,gem/oq-hazardlib,larsbutler/oq-haz... | tests/gsim/abrahamson_silva_2008_test.py | tests/gsim/abrahamson_silva_2008_test.py | # nhlib: A New Hazard Library
# Copyright (C) 2012 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later versio... | agpl-3.0 | Python | |
9fc373bbfa606aeb23c237df9c8d9143e14b60a1 | structure of preprocessing module for lea to fill in | vincentadam87/gatsby-hackathon-seizure,vincentadam87/gatsby-hackathon-seizure | code/python/seizures/preprocessing/preprocessing.py | code/python/seizures/preprocessing/preprocessing.py | import scipy.signal
def preprocess_multichannel_data(matrix):
n_channel,m= matrix.shape
for i in range(n_channel):
preprocess_single_channel(matrix[i,:])
def preprocess_single_channel(x):
x = remove_elec_noise(x)
x = hp_filter(x)
x = remove_dc(x)
return x
def remove_dc():
"""
... | bsd-2-clause | Python | |
3e7429a36532e7c731d5d254b853dd72bdd94c82 | Create test.py | crap0101/fup,crap0101/fup,crap0101/fup | home/crap0101/test/500fup/test.py | home/crap0101/test/500fup/test.py | import operator
import re
import sys
import time
import urlparse
import fhp.api.five_hundred_px as _fh
import fhp.helpers.authentication as _a
from fhp.models.user import User
_TREG = re.compile('^(\d+)-(\d+)-(\d+).*?(\d+):(\d+):(\d+).*')
_URL = 'http://500px.com/'
_HTML_BEGIN = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD H... | mit | Python | |
42c82bc865d69b904ec688aa152caf3a247df1c6 | Create frontdoor.py | paulpoco/Raspi2GarageOpenerVideo,paulpoco/Raspi2GarageOpenerVideo,paulpoco/Raspi2GarageOpenerVideo,paulpoco/Raspi2GarageOpenerVideo | home/pi/PirFrontDoor/frontdoor.py | home/pi/PirFrontDoor/frontdoor.py | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
import requests
GPIO.setmode(GPIO.BCM)
PIR_PIN = 22
GPIO.setup(PIR_PIN, GPIO.IN)
def MOTION(PIR_PIN):
print "Motion Detected!"
payload = { 'value1' : 'Someone at Front Door'}
r = requests.post("https://maker.ifttt.com/trigger/{Event}/wit... | mit | Python | |
1307070cfe27ca605bfcc279644b735ee941f627 | Add work for ex21.py. | jaredmanning/learning,jaredmanning/learning | lpthw/ex31.py | lpthw/ex31.py | print "You enter a dark room with two doors. Do you go through door #1 or #2?"
door = raw_input("> ")
if door == "1":
print "Ther's a giant bear here eating a cheese cake. What do you do?"
print "1. Take the cake."
print "2. Scream at the bear."
bear = raw_input("> ")
if bear == "1":
pri... | mit | Python | |
d3c6c91bc4b6214053b9a1d1d2291a402c164b86 | add file | jvc2688/cpm | GridPixelPlot.py | GridPixelPlot.py | import kplr
import numpy as np
import matplotlib.pyplot as plt
qua = 5
client = kplr.API()
# Find the target KOI.
koi = client.koi(282.02)
originStar = koi.star
# Find potential targets by Kepler magnitude
koisOver = client.kois(where="koi_kepmag between %f and %f"%(originStar.kic_kepmag, originStar.kic_kepmag+0.1... | mit | Python | |
8515155d9d0df940eea758121124995320fce6bb | add experimental C/clang plugin | simonzack/SublimeLinter3,ikappas/SublimeLinter3,paulirish/SublimeLinter3,jasonrhaas/SublimeLinter3,SublimeLinter/SublimeLinter3,Raynos/SublimeLinter3-raynos,smanolloff/SublimeLinter3,paulirish/SublimeLinter3,lunixbochs/sublimelint,lunixbochs/sublimelint,zenlambda/SublimeLinter3,ikappas/SublimeLinter3,jasonrhaas/Sublime... | languages/c.py | languages/c.py | import os
from lint.linter import Linter
from lint.util import find
class C(Linter):
language = 'c'
cmd = ('clang', '-xc', '-fsyntax-only', '-std=c99', '-Werror',
'-pedantic')
regex = (
r'^<stdin>:(?P<line>\d+):(?P<col>\d+):'
r'(?:(?P<ranges>[{}0-9:\-]+):)?\s+'
r'(?P<error>... | mit | Python | |
0026beea95ec26b8763feae270e79872f86de8a5 | Add run_sample_tests for executing sample tests in Travis | intracom-telecom-sdn/nstat,intracom-telecom-sdn/nstat | stress_test/sample_test_confs/run_sample_tests.py | stress_test/sample_test_confs/run_sample_tests.py | #! /usr/bin/env python3.4
# Copyright (c) 2015 Intracom S.A. Telecom Solutions. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.ht... | epl-1.0 | Python | |
352b17d8139fb0d269e4c17c01fe8ee488961c3a | Create HR_miniMaxSum.py | bluewitch/Code-Blue-Python | HR_miniMaxSum.py | HR_miniMaxSum.py | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the miniMaxSum function below.
def miniMaxSum(arr):
maxx = max(arr)
minn = min(arr)
mini = arr.copy()
mini.remove(maxx)
maxi = arr.copy()
maxi.remove(minn)
sum_min = sum(mini)
sum_max = sum(ma... | mit | Python | |
b8fe92674773c7470c3b47899a8832bbb94771b4 | Add path module | hundeboll/core,sknsean/core,sknsean/core,sknsean/core,diorcety/oe-lite-core,diorcety/oe-lite-core,hundeboll/core,sknsean/core,hundeboll/core,hundeboll/core,sknsean/core | lib/oelite/path.py | lib/oelite/path.py | import os
TOPDIR = os.getcwd()
def init(topdir):
global TOPDIR
TOPDIR = topdir
def relpath(path):
"""Return a relative version of paths compared to TOPDIR."""
global TOPDIR
if path.startswith(TOPDIR):
return path[len(TOPDIR):].lstrip("/")
return path
def which(path, filename, path... | mit | Python | |
8ce2da2ed2e445480ee2e10483a5fae1c7c677a0 | Include self contained method for output to a view | OdatNurd/OverrideAudit | lib/output_view.py | lib/output_view.py | import sublime
import sublime_plugin
###-----------------------------------------------------------------------------
def output_to_view(window,
title,
content,
reuse=True,
syntax=None,
clear=True,
settin... | mit | Python | |
0d35b502515a9775166e775c3462ca9300fe4517 | add examples | nschloe/maelstrom,nschloe/maelstrom | examples/helpers.py | examples/helpers.py | # -*- coding: utf-8 -*-
#
from dolfin import as_backend_type
import matplotlib.pyplot as plt
import scipy.linalg
def show_matrix(A):
A = as_backend_type(A)
A_matrix = A.sparray()
# colormap
cmap = plt.cm.gray_r
A_dense = A_matrix.todense()
# A_r = A_dense[0::2][0::2]
# A_i = A_dense[1::2]... | mit | Python | |
9f9955ff920d88cb0c9dd7ce4abeaac54a1c4977 | add tests for the migration command | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/motech/repeaters/tests/test_repeaters_migration.py | corehq/motech/repeaters/tests/test_repeaters_migration.py | from django.core.management import call_command
from django.test import TestCase
from corehq.motech.dhis2.repeaters import (
SQLDhis2EntityRepeater,
SQLDhis2Repeater,
)
from corehq.motech.fhir.repeaters import SQLFHIRRepeater
from corehq.motech.models import ConnectionSettings
from corehq.motech.repeaters.dbac... | bsd-3-clause | Python | |
f4bf1c83f55013051037b4380f1b579375bad3d7 | Add test for ContextAwareForm | patrick91/pycon,patrick91/pycon | backend/tests/api/test_forms.py | backend/tests/api/test_forms.py | import pytest
from api.forms import ContextAwareForm
from users.models import User
def test_cannot_use_form_context_if_its_not_passed():
class TestModelForm(ContextAwareForm):
class Meta:
model = User
fields = ('id',)
form = TestModelForm()
with pytest.raises(ValueError... | mit | Python | |
3d40378e0e42f62615199daf97a48f24d5b9eb12 | add basic test for LIS | cjwfuller/algorithms | test_lis.py | test_lis.py | import unittest
import lis
class TestLis(unittest.TestCase):
def test_basic(self):
l = lis.Lis()
answer = [[0, 4, 6, 9, 13, 15], [0, 2, 6, 9, 13, 15], [0, 4, 6, 9, 11, 15], [0, 2, 6, 9, 11, 15]]
self.assertEquals(answer, l.lis([0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15]))
if __n... | mit | Python | |
71675f81214ea510c377abf23fe2a11dfb113717 | create module | metadata1984/pyAhocorasick | pyAhocorasick/pyAhocorasick.py | pyAhocorasick/pyAhocorasick.py | #-*- encoding=utf-8 -*-
'''
Created on Mar 15, 2014
@author: tonyzhang
'''
| mit | Python | |
963866e795df42121f972ee2170ddeb890f7e5b7 | Create pytest test file | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various | python-practice/test_arrays.py | python-practice/test_arrays.py | import arrays
# Reverse an array in place
def test_reverse_array():
input = [1, 2, 3]
assert arrays.reverse_array(input) == [3, 2, 1]
# Search a sorted list
def test_binary_search_no_list():
input_array = []
target = 1
assert arrays.binary_search(input_array, target) == -1
def test_binary_sea... | mit | Python | |
4932483b10876eddab39477063a9b8546e5e0f33 | Create a.py | Kim-Seonghyeon/youtube_8m | a.py | a.py | a
| apache-2.0 | Python | |
051bbd588e7ad20dd9a00918c437a86d46ba8f7e | Create transfer.py | leewiny/ctransfer,leewiny/ctransfer | transfer.py | transfer.py | #! /usr/bin/env python
#-*-coding:utf-8-*-
import MySQLdb
import psutil
import urllib
import time
import sys
import os
#########################################################################################################################
## MySQLdb : 在部署前需要确定系统安装了该python模块
## psutil : 在python中进行系统进程管理的模块
#########... | mit | Python | |
50e24b0445f259d975e5dd78dd34a8e760e4ed88 | Create SQLite database and table and insert data from CSV file | joykuotw/python-endpoints,joykuotw/python-endpoints,joykuotw/python-endpoints | DB.py | DB.py | # Create a database
import sqlite3
import csv
from datetime import datetime
import sys
reload(sys)
sys.setdefaultencoding('utf8')
class createDB():
def readCSV(self, filename):
conn = sqlite3.connect('CIUK.db')
print 'DB Creation Successful!'
cur = conn.cursor()
# cur.execute(... | mit | Python | |
874c01374397014e7c99afd67f5680ed32f1c5c6 | Build and revision number script | atifaziz/NCrontab,atifaziz/NCrontab | bn.py | bn.py | import sys
from time import gmtime
year, mon, mday, hour, min, sec, wday, yday, isdst = gmtime()
bld = ((year - 2000) * 12 + mon - 1) * 100 + mday
rev = hour * 100 + min
print 'Your build and revision number for today is %d.%d.' % (bld, rev)
| apache-2.0 | Python | |
480b0bd80f65646da52824403ade92880af1af2e | Add circle ci settings | magnet-cl/django-project-template-py3,magnet-cl/django-project-template-py3,magnet-cl/django-project-template-py3,magnet-cl/django-project-template-py3 | project/circleci_settings.py | project/circleci_settings.py | # -*- coding: utf-8 -*-
DEBUG = True
LOCAL_DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'circle_test',
'USER': 'circleci',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '5432',
}
}
LOCALLY_INSTALLED_APPS = [
]
ENABLE_EMAILS = Fa... | mit | Python | |
780e4eb03420d75c18d0b21b5e616f2952aeda41 | Test sending headers with end stream. | python-hyper/hyper-h2,bhavishyagopesh/hyper-h2,Kriechi/hyper-h2,Kriechi/hyper-h2,mhils/hyper-h2,vladmunteanu/hyper-h2,vladmunteanu/hyper-h2,python-hyper/hyper-h2 | test/test_basic_logic.py | test/test_basic_logic.py | # -*- coding: utf-8 -*-
"""
test_basic_logic
~~~~~~~~~~~~~~~~
Test the basic logic of the h2 state machines.
"""
import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
... | # -*- coding: utf-8 -*-
"""
test_basic_logic
~~~~~~~~~~~~~~~~
Test the basic logic of the h2 state machines.
"""
import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
... | mit | Python |
8adac46cd59c562ec494508ad735843253adc1f2 | add frequencies benchmark | pombredanne/toolz,llllllllll/toolz,jcrist/toolz,bartvm/toolz,berrytj/toolz,berrytj/toolz,simudream/toolz,whilo/toolz,llllllllll/toolz,karansag/toolz,whilo/toolz,machinelearningdeveloper/toolz,quantopian/toolz,jdmcbr/toolz,pombredanne/toolz,jcrist/toolz,quantopian/toolz,bartvm/toolz,cpcloud/toolz,karansag/toolz,jdmcbr/t... | bench/test_frequencies.py | bench/test_frequencies.py | from toolz import frequencies, identity
data = range(1000)*1000
def test_frequencies():
frequencies(data)
| bsd-3-clause | Python | |
892740ce17c2906de996089f07f005c7812270ef | add init back | Hawt-Lava/Charizard | src/__init__.py | src/__init__.py | """ Source Files, and a location for Global Imports """
| mit | Python | |
94acf181f063808c2b6444dbc15ea40ee17bdee3 | print structure | JohanComparat/pyEmerge,JohanComparat/pyEmerge | bin/print_h5_structure.py | bin/print_h5_structure.py | import sys
file_name = sys.argv[1]
# python3 print_data_structure.py filename
import glob
import os
import numpy as n
import h5py # HDF5 support
f0 = h5py.File(file_name, "r")
def print_attr(h5item):
for attr in h5item:
print(attr, h5item[attr])
def print_all_key(h5item):
for key in h5item.keys():... | unlicense | Python | |
fea9e1e80d03b87c05eacd02b5440fc783eb456d | Fix buildfier | dlorenc/debian-docker,GoogleContainerTools/base-images-docker,dlorenc/debian-docker,GoogleContainerTools/base-images-docker | package_managers/apt_get/repos.bzl | package_managers/apt_get/repos.bzl | # Copyright 2017 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 by applicable law or agre... | # Copyright 2017 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 by applicable law or agre... | apache-2.0 | Python |
f5a561494ece69c32d4bbd3e23c435a0fe74788a | Add local enum capability (needed for contentwrapper) | arobb/python-processrunner,arobb/python-processrunner | processrunner/enum.py | processrunner/enum.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# For use with deployment statuses
# https://stackoverflow.com/a/1695250
def enum(*sequential, **named):
"""An implementation of the Enum data type
Usage
myEnum= enum(
'Apple'
, 'Banana')
"""
enums = ... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.