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 |
|---|---|---|---|---|---|---|---|---|
e6d327a5249e14765999357a391d97c4fd2cd8b8 | Test for sitemap.xml | praekelt/jmbo-skeleton,praekelt/jmbo-skeleton,praekelt/jmbo-skeleton | skeleton/tests.py | skeleton/tests.py | from django.core import management
from django.test import TestCase as BaseTestCase
from django.test.client import Client as BaseClient, FakePayload, \
RequestFactory
from django.core.urlresolvers import reverse
from post.models import Post
from foundry.models import Member
class TestCase(BaseTestCase):
@cl... | from django.core import management
from django.test import TestCase as BaseTestCase
from django.test.client import Client as BaseClient, FakePayload, \
RequestFactory
from django.core.urlresolvers import reverse
from post.models import Post
from foundry.models import Member
class TestCase(BaseTestCase):
@cl... | bsd-3-clause | Python |
2eb3a682706a5ff0255474230ec32fd0ac96c727 | update mac build script | SasView/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview | sansview/setup_mac.py | sansview/setup_mac.py | """
This is a setup.py script partly generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
import periodictable.xsf
import DataLoader.readers
from distutils.sysconfig import get_python_lib
import os
DATA_FILES = []
RESOURCES_FILES = []
#Periodictable data file
DATA_FILES = period... | """
This is a setup.py script partly generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
import periodictable.xsf
import DataLoader.readers
from distutils.sysconfig import get_python_lib
import os
DATA_FILES = []
RESOURCES_FILES = []
#Periodictable data file
DATA_FILES = period... | bsd-3-clause | Python |
b6c8e38b96293bacd7739411200cd85f47f1efca | handle division by zero | Emsu/prophet,YuepengGuo/prophet | prophet/analyze.py | prophet/analyze.py | from prophet.utils.formatters import dict_to_table
import math
import numpy as np
class Analyzer(object):
def __repr__(self):
return self.name
class Volatility(Analyzer):
name = 'volatility'
def run(self, backtest, **kwargs):
return backtest.get_daily_returns().std()
class Sharpe(Ana... | from prophet.utils.formatters import dict_to_table
import math
import numpy as np
class Analyzer(object):
def __repr__(self):
return self.name
class Volatility(Analyzer):
name = 'volatility'
def run(self, backtest, **kwargs):
return backtest.get_daily_returns().std()
class Sharpe(Ana... | bsd-3-clause | Python |
6ddc32c10124d10db53f9017044be65a00a35a33 | Add newline to end of __init__.py. | jensengroup/propka,jensengroup/propka-3.1 | propka/__init__.py | propka/__init__.py | """PROPKA 3.1
See https://github.com/jensengroup/propka-3.1 for more information.
Please cite these PROPKA references in publications:
* Sondergaard, Chresten R., Mats HM Olsson, Michal Rostkowski, and Jan H. Jensen.
"Improved Treatment of Ligands and Coupling Effects in Empirical Calculation and
Rationalization of ... | """PROPKA 3.1
See https://github.com/jensengroup/propka-3.1 for more information.
Please cite these PROPKA references in publications:
* Sondergaard, Chresten R., Mats HM Olsson, Michal Rostkowski, and Jan H. Jensen.
"Improved Treatment of Ligands and Coupling Effects in Empirical Calculation and
Rationalization of ... | lgpl-2.1 | Python |
0560f65eb6740281c77c9b016bd9a44f486be6ae | Use dense matrices instead of sparse where that makes sense | ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc | openprescribing/matrixstore/matrix_ops.py | openprescribing/matrixstore/matrix_ops.py | from __future__ import division
import numpy
import scipy.sparse
# Above a certain level of density it becomes more efficient to use a normal
# dense matrix instead of a sparse one. This threshold was determined through a
# not particularly scientific process of trial and error. Due to the
# compression we apply th... | import numpy
import scipy.sparse
def sparse_matrix(shape, integer=False):
"""
Create a new sparse matrix (either integer or floating point) in a form
suitable for populating with data
"""
dtype = numpy.int_ if integer else numpy.float_
return scipy.sparse.lil_matrix(shape, dtype=dtype)
def f... | mit | Python |
1185595ea55f4b4be2f227a37b33d8142bcf92c1 | bump version to 6.0.0.dev0 | StellarCN/py-stellar-base | stellar_sdk/__version__.py | stellar_sdk/__version__.py | """
_____ _______ ______ _ _ _____ _____ _____ _ __
/ ____|__ __| ____| | | | /\ | __ \ / ____| __ \| |/ /
| (___ | | | |__ | | | | / \ | |__) |____| (___ | | | | ' /
\___ \ | | | __| | | | | / /\ \ | _ /______\___ \| | | | <
_... | """
_____ _______ ______ _ _ _____ _____ _____ _ __
/ ____|__ __| ____| | | | /\ | __ \ / ____| __ \| |/ /
| (___ | | | |__ | | | | / \ | |__) |____| (___ | | | | ' /
\___ \ | | | __| | | | | / /\ \ | _ /______\___ \| | | | <
_... | apache-2.0 | Python |
e589f4347a730abc64f43b3b427ac556643c361f | Use proper mesh | certik/cos-10-poster,certik/ccms-10-poster | graphs/hydrogen_pfem.py | graphs/hydrogen_pfem.py | R_x = {
0: [5, 7, 10, 16, 18, 22, 28, 34],
}
R_y = {
(1, 0): [0.17076672795968373, 0.043356138894337204, 0.041045532914633254, 0.0058943597765469535, 0.00018759868059159412, 1.7891829137695048e-06, 7.0804719309869313e-09, 6.5346731359383625e-09],
(2, 0): [0.044544127593562716, 0.010965171727... | R_x = {
0: [5, 7, 13, 15, 21, 25, 29],
}
R_y = {
(1, 0): [0.1843068472879863, 0.06235603500209852, 0.011111956105256449, 0.00050366115986938409, 7.1562463805907583e-06, 4.0298526238213839e-08, 3.9956294661802616e-08],
(2, 0): [0.046105675637867799, 0.013246017078074462, 0.005542485710768652,... | mit | Python |
c98ef2e8b64b7daa94c0e883f71813a3e3226a78 | set current day to none if there is none | whatsthehubbub/rippleeffect,whatsthehubbub/rippleeffect,whatsthehubbub/rippleeffect,whatsthehubbub/rippleeffect,whatsthehubbub/rippleeffect | riskgame/context_processors.py | riskgame/context_processors.py | # -*- coding: utf-8
from riskgame.models import Player, TeamPlayer, EpisodeDay, Game
def player(request):
returnDict = {}
if request.user.is_authenticated():
try:
currentPlayer = Player.objects.get(user=request.user)
except Player.DoesNotExist:
currentPlayer = Playe... | # -*- coding: utf-8
from riskgame.models import Player, TeamPlayer, EpisodeDay, Game
def player(request):
returnDict = {}
if request.user.is_authenticated():
try:
currentPlayer = Player.objects.get(user=request.user)
except Player.DoesNotExist:
currentPlayer = Playe... | mit | Python |
546d4ac0bbf14da2bc5610aa09b5a75627b297a6 | Add 131 | byung-u/ProjectEuler | 100_to_199/euler_131.py | 100_to_199/euler_131.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Problem 131
There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube.
For example, when p = 19, 83 + 82×19 = 123.
What is perhaps most surprising is that for each prime with this property the val... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Problem 131
There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube.
For example, when p = 19, 83 + 82×19 = 123.
What is perhaps most surprising is that for each prime with this property the val... | mit | Python |
10318a11dded5e69c3d9c98325613700c9b3db63 | Fix for dependent package detection. | lgarren/spack,lgarren/spack,iulian787/spack,mfherbst/spack,skosukhin/spack,LLNL/spack,LLNL/spack,EmreAtes/spack,iulian787/spack,tmerrick1/spack,TheTimmy/spack,mfherbst/spack,mfherbst/spack,tmerrick1/spack,lgarren/spack,krafczyk/spack,iulian787/spack,krafczyk/spack,skosukhin/spack,matthiasdiener/spack,lgarren/spack,Emre... | lib/spack/spack/cmd/dependents.py | lib/spack/spack/cmd/dependents.py | ##############################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
... | lgpl-2.1 | Python | |
4f3c3755d9fcbfd9ce0551c19bb893e7ba73db91 | Add missing setup.py | leifdenby/numpy,mwiebe/numpy,seberg/numpy,ssanderson/numpy,chatcannon/numpy,dimasad/numpy,nguyentu1602/numpy,dwf/numpy,cowlicks/numpy,Anwesh43/numpy,MSeifert04/numpy,numpy/numpy,NextThought/pypy-numpy,NextThought/pypy-numpy,WarrenWeckesser/numpy,ContinuumIO/numpy,GaZ3ll3/numpy,MSeifert04/numpy,mattip/numpy,Dapid/numpy,... | numpy/numarray/setup.py | numpy/numarray/setup.py |
from os.path import join
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('numarray',parent_package,top_path)
config.add_data_files('include/numarray/*.h')
# Configure fftpack_lite
config.add_extension('_capi',
... | bsd-3-clause | Python | |
735ce7f11b70bf8e916bad5610093b5886c57db6 | Add quickseg.py | simmimourya1/cyvlfeat,simmimourya1/cyvlfeat,simmimourya1/cyvlfeat | cyvlfeat/quickshift/quickseg.py | cyvlfeat/quickshift/quickseg.py | import numpy as np
from cyvlfeat.quickshift import quickshift
from cyvlfeat.quickshift import flatmap
from cyvlfeat.quickshift import imseg
def quickseg(image, ratio, kernel_size, max_dist):
"""
Produce a quickshift segmentation of a greyscale image.
Parameters
----------
image : [H, W] or [H, W,... | bsd-2-clause | Python | |
766569894a5c849c449971aca5c7d999e7019aef | check required packages | SasView/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview | check_packages.py | check_packages.py | """
Checking and reinstalling the external packages
"""
import os
import sys
if sys.platform =='win32':
IS_WIN = True
else:
IS_WIN = False
try:
import setuptools
print "==> setuptools-%s installed."% setuptools.__version__
#if setuptools.__version__ != '0.6c11':
# print "!!! Recommend to inst... | bsd-3-clause | Python | |
8080128d2ca5718ac971160bf964c3ca73b235b7 | add downloader | zenja/benchmarking-cloud-storage-systems | operators/downloader.py | operators/downloader.py | import os
from drivers import driver
from file_utils import file_util
class Downloader(object):
def __init__(self, server_driver):
"""Init a Uploader object
Args:
server_driver: a driver already connected to cloud service
"""
if not issubclass(driver.Driver, driver.Dr... | apache-2.0 | Python | |
49071cbeda14133019b0969e7499ea8f26cdb1cf | Create OogOrderedSet.py | longanimit/npni4processing | OogOrderedSet.py | OogOrderedSet.py |
# -*- coding: utf8-*-
# coding: utf-8
__author__ = "Dominique Dutoit"
__date__ = "$5 march 2014$"
from collections import MutableSet
class OrderedSet(MutableSet):
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.map = {} # key -->... | artistic-2.0 | Python | |
5be32f4022135a10585cf094b6fb8118dd87a2f6 | Add files via upload (#396) | TheAlgorithms/Python | ciphers/Atbash.py | ciphers/Atbash.py | def Atbash():
inp=raw_input("Enter the sentence to be encrypted ")
output=""
for i in inp:
extract=ord(i)
if extract>=65 and extract<=90:
output+=(unichr(155-extract))
elif extract>=97 and extract<=122:
output+=(unichr(219-extract))
else:
... | mit | Python | |
8d1016437e87794fb39b447b51427bae98a51bc2 | Add one public IP provider | Saphyel/ipteller,Saphyel/ipteller | classes/jsonip.py | classes/jsonip.py | from json import load
from urllib2 import urlopen
class JsonIp:
def __init__(self):
url = 'https://jsonip.com/'
uri = urlopen(url)
response = load(uri)
self.ip = response["ip"]
# self.ip = '1.1.1.1'
| mit | Python | |
b1be1bbf785406f4d286c7eb85ea459309ea03a2 | Fix file hierarchy. | hakanu/scripts | batch_image_resizer2/batch_image_resizer.py | batch_image_resizer2/batch_image_resizer.py | """Resize images in a folder using imagemagick command line tools.
http://hakanu.net
"""
import glob
import os
def main():
print 'Started'
images = glob.glob("/home/h/Desktop/all_karikatur_resized/*.jpg")
counter = 0
for image in images:
print 'Processing: ', image
index = image[image.rfind('/') + 1:... | apache-2.0 | Python | |
98b85a9fd8d5082e40996dfba0359b0ec32a9267 | Add solution for "Cakes" kata https://www.codewars.com/kata/525c65e51bf619685c000059 | davidlukac/codekata-python | codewars/cakes.py | codewars/cakes.py | # Cakes
# https://www.codewars.com/kata/525c65e51bf619685c000059
import math
import unittest
from typing import Dict
def cakes_1(recipe, available):
# type: (Dict[str, int], Dict[str, int]) -> int
lowest_available = math.inf
for i, a in recipe.items():
if i in available.keys():
av = ... | mit | Python | |
5b97e6fc0446912d5b9b8da65e60d06165ed1b8b | Add profile tests | ltowarek/budget-supervisor | budgetsupervisor/users/tests/test_models.py | budgetsupervisor/users/tests/test_models.py | from users.models import Profile
def test_profile_is_created_when_user_is_created(user_foo):
assert len(Profile.objects.all()) == 1
assert hasattr(user_foo, "profile")
def test_profile_is_not_created_when_user_is_updated(user_foo):
assert len(Profile.objects.all()) == 1
user_foo.username = "abc"
... | mit | Python | |
275adbea5477bbc6938e59edab23e1df182435ea | Create split-array-with-equal-sum.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,jaredkoontz/... | Python/split-array-with-equal-sum.py | Python/split-array-with-equal-sum.py | # Time: O(n^2)
# Space: O(n)
class Solution(object):
def splitArray(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
if len(nums) < 7:
return False
accumulated_sum = [0] * len(nums)
accumulated_sum[0] = nums[0]
for i in xr... | mit | Python | |
5e427315f46c026dd3b72b49349d3dcdbf04d138 | add financial_insights | hugochan/KATE | financial_insights.py | financial_insights.py | '''
Created on Apr, 2017
@author: hugo
'''
import numpy as np
def calc_ranks(x):
"""Given a list of items, return a list(in ndarray type) of ranks.
"""
n = len(x)
index = list(zip(*sorted(list(enumerate(x)), key=lambda d:d[1], reverse=True))[0])
rank = np.zeros(n)
rank[index] = range(1, n + ... | bsd-3-clause | Python | |
6c133d4de6a79eab6bfc2da9ff9a0045e0a0994d | add problem hanckerrank 009 | caoxudong/code_practice,caoxudong/code_practice,caoxudong/code_practice,caoxudong/code_practice | hackerrank/009_sherlock_and_the_beast.py | hackerrank/009_sherlock_and_the_beast.py | #!/bin/python3
"""
https://www.hackerrank.com/challenges/sherlock-and-the-beast?h_r=next-challenge&h_v=zen
Sherlock Holmes suspects his archenemy, Professor Moriarty, is once again plotting something diabolical. Sherlock's companion, Dr. Watson, suggests Moriarty may be responsible for MI6's recent issues with t... | mit | Python | |
ef1fa03d753f5d8a0b32831320a1b3e076ace363 | Add a test runner for our jqplot demo too | ralphbean/moksha,mokshaproject/moksha,lmacken/moksha,mokshaproject/moksha,pombredanne/moksha,mokshaproject/moksha,pombredanne/moksha,ralphbean/moksha,lmacken/moksha,lmacken/moksha,ralphbean/moksha,pombredanne/moksha,pombredanne/moksha,mokshaproject/moksha | moksha/apps/demo/MokshaJQPlotDemo/run_tests.py | moksha/apps/demo/MokshaJQPlotDemo/run_tests.py | #!/usr/bin/env python
"""
nose runner script.
"""
__requires__ = 'moksha'
import pkg_resources
import nose
if __name__ == '__main__':
nose.main()
| apache-2.0 | Python | |
bd87286dccc22c6e7ac1470882550c2515df4882 | Add support for eve-central | desaster/uusipuu | modules/evecentral.py | modules/evecentral.py | from core.Uusipuu import UusipuuModule
from twisted.internet import defer
from twisted.internet.defer import inlineCallbacks
from twisted.web import client
from xml.dom import minidom
import locale
class Module(UusipuuModule):
def startup(self):
self.db_open('evedb', 'data/db/evedb.sqlite')
def shutd... | bsd-2-clause | Python | |
3623b058670f19dc7a6aa3372a04b61bc96a8678 | Create SenderNode.py | ricardodeazambuja/BrianConnectUDP | examples/SenderNode.py | examples/SenderNode.py | '''
This is the Sender Node.
It sends the start spike train and then simply receives and sends spikes using Brian NeuronGroups. At the end of
the simulation the data collected is plotted.
'''
from brian import *
import argparse
from brian_multiprocess_udp import BrianConnectUDP
def main_NeuronGroup(input_Neuron... | cc0-1.0 | Python | |
b261704bc0ada9cfae773eaf1e40b18dc49d6ceb | add outline of backgrond job processor and task interface | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/background.py | portality/background.py | from portality import models
from portality.core import app
class BackgroundApi(object):
@classmethod
def execute(self, background_task):
job = background_task.background_job
ctx = None
if job.user is not None:
ctx = app.test_request_context("/")
ctx.push()
... | apache-2.0 | Python | |
c8ec0689950a5fea0aff98afe54b172bd84e2ce9 | Add example using Tom's registration code in scipy. | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD | examples/coregister.py | examples/coregister.py | """Example using Tom's registration code from scipy.
"""
from os import path
from glob import glob
import scipy.ndimage._registration as reg
# Data files
basedir = '/Users/cburns/data/twaite'
anatfile = path.join(basedir, 'ANAT1_V0001.img')
funcdir = path.join(basedir, 'fMRIData')
fileglob = path.join(funcdir, 'FUN... | bsd-3-clause | Python | |
114f8012a7faec4fe107c1d68c2ead10cdd88fbe | update zero.1flow.io settings for sparks 2.x. | 1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow | oneflow/settings/zero_1flow_io.py | oneflow/settings/zero_1flow_io.py | # -*- coding: utf-8 -*-
# Settings for zero.1flow.io, a master clone used to validate migrations.
from sparks.django.settings import include_snippets
include_snippets(
(
'000_nobother',
'00_production',
'1flow_io',
'common',
'db_common',
'db_production',
'ca... | # -*- coding: utf-8 -*-
# Settings for zero.1flow.io, a master clone used to validate migrations.
import os
from sparks.django.settings import include_snippets
include_snippets(
os.path.dirname(__file__), (
'000_nobother',
'00_production',
'1flow_io',
'common',
'db_common',... | agpl-3.0 | Python |
db60219a1446bb75dd98bfbb12ee6ec4eda6d6bb | add structure for the pcaptotal API | abdesslem/pcapTotal,abdesslem/pcapTotal,abdesslem/pcapTotal | web/api.py | web/api.py | from flask import jsonify, abort, make_response
from flask.ext.httpauth import HTTPBasicAuth
auth = HTTPBasicAuth()
from app import app
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
},
{
'id': 2,
... | mit | Python | |
62b01c3c1614d5719cc69be951b2f6c660e40faa | Add generic function for iterating arrays. | matusvalo/python-easyldap | pyldap/libldap/tools.py | pyldap/libldap/tools.py | def iterate_array(arr, f=None):
i = 0
while True:
if not arr[i]:
break
yield arr[i] if f is None else f(arr[i])
i += 1 | bsd-3-clause | Python | |
d8cd42940df8c1d2fc9ae28e9c5caa21995ca68c | Add word-counter.py | bamos/python-scripts,bamos/python-scripts | python3/word-counter.py | python3/word-counter.py | #!/usr/bin/env python3
from collections import Counter
import argparse
import re
from itertools import islice
import operator
parser = argparse.ArgumentParser()
parser.add_argument('--numWords',type=int,default=10)
parser.add_argument('--maxTuples',type=int,default=4)
parser.add_argument('--minWordLength',type=int,de... | mit | Python | |
377a8be7c0b1e77f0e9c2dfd55f603e199727907 | make pairs | mathii/europe_selection,mathii/europe_selection,mathii/europe_selection | files/v8/make_pairs.py | files/v8/make_pairs.py | import fileinput
pops=[]
for line in fileinput.input():
pops.append(line[:-1])
for i in range(len(pops)-1):
for j in range(i+1, len(pops)):
print pops[i]+","+pops[j]
| mit | Python | |
9c0ddb1c4fff5fb3f44ad77192a7f435bc7a22fe | Create AdafruitMotorHat4Pi.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | service/AdafruitMotorHat4Pi.py | service/AdafruitMotorHat4Pi.py | # Start the services needed
raspi = Runtime.start("raspi","RasPi")
hat = Runtime.start("hat","AdafruitMotorHat4Pi")
m1 = Runtime.start("m1","MotorHat4Pi")
# Attach the HAT to i2c bus 1 and address 0x60
hat.attach("raspi","1","0x60")
# Use the M1 motor port and attach the motor to the hat
m1.setMotor("M1")
m1.attach("ha... | apache-2.0 | Python | |
b376b0dca7ec73451ff36ebae1718fa11ec159f0 | Add utils.py for general purpose functions | Zloool/manyfaced-honeypot | manyfaced/common/utils.py | manyfaced/common/utils.py | import time
import pickle
from socket import error as socket_error
from common.status import CLIENT_TIMEOUT
def dump_file(data):
try:
with file('temp.db') as f:
string_file = f.read()
db = pickle.loads(string_file)
except:
db = list()
db.append(data)
with open('tem... | mit | Python | |
a3cbfeca2828ac3d210921524d850091dc775db7 | Revert "Revert "New VMware Module to support configuring a VMware vmkernel IP…" | thaim/ansible,thaim/ansible | lib/ansible/modules/extras/cloud/vmware/vmware_vmkernel_ip_config.py | lib/ansible/modules/extras/cloud/vmware/vmware_vmkernel_ip_config.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.com>
#
# This file is part of Ansible
#
# Ansible 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 3 of the Li... | mit | Python | |
b9759f60c9f107c3d2c319f53ed2985ee58dc319 | Write test for mock_pose generator. | masasin/spirit,masasin/spirit | src/tests/test_mock_pose.py | src/tests/test_mock_pose.py | try:
from unittest.mock import patch, MagicMock
except ImportError:
from mock import patch, MagicMock
import pytest
import rospy
MockTf2 = MagicMock()
modules = {"tf2_ros": MockTf2}
patcher = patch.dict("sys.modules", modules)
patcher.start()
try:
rospy.init_node("pytest", anonymous=True)
except rospy.... | mit | Python | |
1ce12ab6eb2a3b5578eba253929275bb3b394b76 | Create line_follow.py | CSavvy/python | line_follow.py | line_follow.py | from Myro import *
init("/dev/tty.scribbler")
# To stop the Scribbler, wave your hand/something in front of the fluke
while getObstacle('center') < 6300:
# Get the reading from the line sensors on the bottom of Scribbler
left, right = getLine()
# If both left and right sensors are on track
if left... | mit | Python | |
5fa39bb65f88fa3596cc3831890cd258cc5768e1 | Add the module file | LabPy/lantz,LabPy/lantz_qt,LabPy/lantz,LabPy/lantz,LabPy/lantz,LabPy/lantz_qt,varses/awsch,varses/awsch,LabPy/lantz_qt | lantz/drivers/ni/__init__.py | lantz/drivers/ni/__init__.py | # -*- coding: utf-8 -*-
"""
lantz.drivers.ni
~~~~~~~~~~~~~~~~
:company: National Instruments
:description:
:website: http://www.ni.com/
----
:copyright: 2012 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from .daqe import NI6052E
... | bsd-3-clause | Python | |
b3dcbe95d766d902d22a0c4c171cbbe5ce207571 | Add test for longitivity-testing: both LED-s ON at the same time for extended periods of time | anroots/teensy-moonica | python/tests/stress_test.py | python/tests/stress_test.py | #!/usr/bin/env python
import time
import sys
import os
from random import randint
# Hack to import from a parent dir
# http://stackoverflow.com/a/11158224/401554
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)
from octo import Octo
octo = Octo('/dev/ttyACM0')
oct... | mit | Python | |
d2a9f0cfd34f6a58c647d32b9a32fc517a210fd5 | Create tests for ChartBasedAnnotationsAccumulator | facebookresearch/detectron2,facebookresearch/detectron2,facebookresearch/detectron2 | projects/DensePose/tests/test_chart_based_annotations_accumulator.py | projects/DensePose/tests/test_chart_based_annotations_accumulator.py | # Copyright (c) Facebook, Inc. and its affiliates.
import unittest
import torch
from detectron2.structures import Boxes, BoxMode, Instances
from densepose.modeling.losses.utils import ChartBasedAnnotationsAccumulator
from densepose.structures import DensePoseDataRelative, DensePoseList
image_shape = (100, 100)
inst... | apache-2.0 | Python | |
9bc154d662464a0073b8b7cd3bcf39312a4ac1d7 | add ifttt notification | mofhu/pkuairquality | ifttt_notification.py | ifttt_notification.py | import requests
def Air_alert():
report = {}
report["value1"] = "test"
report["value2"] = "second"
report["value3"] = "third"
requests.post(
"https://maker.ifttt.com/trigger/Air_Test/with/key/{user_key}".format(user_key=""), data=report)
if __name__ == "__main__":
Air_alert()
| mit | Python | |
369676cfacd35c7b3321edaef97bf64f063e7d50 | Add nephrectomy model | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | radar/radar/models/nephrectomy.py | radar/radar/models/nephrectomy.py | from sqlalchemy import Column, Integer, ForeignKey, Date, Index
from sqlalchemy.orm import relationship
from radar.database import db
from radar.models.common import MetaModelMixin, IntegerLookupTable
NEPHRECTOMY_SIDES = OrderedDict([
('LEFT', 'Left'),
('RIGHT', 'Right'),
('BILATERAL', 'Bilateral'),
])
N... | agpl-3.0 | Python | |
0378a225c5519ad39fee6a132c455e1848151a44 | Create run_test.py | scopatz/staged-recipes,shadowwalkersb/staged-recipes,mcs07/staged-recipes,jakirkham/staged-recipes,grlee77/staged-recipes,birdsarah/staged-recipes,conda-forge/staged-recipes,conda-forge/staged-recipes,sodre/staged-recipes,mariusvniekerk/staged-recipes,sodre/staged-recipes,synapticarbors/staged-recipes,barkls/staged-rec... | recipes/django-braces/run_test.py | recipes/django-braces/run_test.py | import django
from django.conf import settings
settings.configure(INSTALLED_APPS=['braces', 'django.contrib.contenttypes', 'django.contrib.auth'])
django.setup()
import braces
| bsd-3-clause | Python | |
7e9c90c179df8666a75eef1610dbda764add1408 | Create elec_temp_join.py | mdbartos/RIPS,mdbartos/RIPS,mdbartos/RIPS | elec_temp_join.py | elec_temp_join.py | import numpy as np
import pandas as pd
import geopandas as gpd
from geopandas import tools
utility = '/home/akagi/Desktop/electricity_data/Electric_Retail_Service_Ter.shp'
util = gpd.read_file(utility)
urbarea = '/home/akagi/GIS/census/cb_2013_us_ua10_500k/cb_2013_us_ua10_500k.shp'
ua = gpd.read_file(urbarea)
ua = ... | mit | Python | |
e9135583af7a862bd426b4a068743765c4604da3 | add test for dials.convert_to_cbf (only works on dls computers) | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | test/command_line/test_convert_to_cbf.py | test/command_line/test_convert_to_cbf.py | from __future__ import absolute_import, division, print_function
import glob
import os
import pytest
import procrunner
pytestmark = pytest.mark.skipif(
not os.access("/dls/i04/data/2019/cm23004-1/20190109/Eiger", os.R_OK),
reason="Test images not available",
)
@pytest.mark.parametrize(
"master_h5",
... | bsd-3-clause | Python | |
03e9a75d69538649df3e05d40a1c8e7d870fd807 | Add gaussian_elimination.py for solving linear systems (#1448) | TheAlgorithms/Python | arithmetic_analysis/gaussian_elimination.py | arithmetic_analysis/gaussian_elimination.py | """
Gaussian elimination method for solving a system of linear equations.
Gaussian elimination - https://en.wikipedia.org/wiki/Gaussian_elimination
"""
import numpy as np
def retroactive_resolution(coefficients: np.matrix, vector: np.array) -> np.array:
"""
This function performs a retroactive linear system... | mit | Python | |
12731a74be889eff48e0e505de666ef3180794fe | add missing file | sassoftware/rmake,sassoftware/rmake,sassoftware/rmake3,sassoftware/rmake,sassoftware/rmake3,sassoftware/rmake3 | rmake/plugins/plugin.py | rmake/plugins/plugin.py | #
# Copyright (c) 2006 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.opensource.org/licen... | apache-2.0 | Python | |
3e0e898d0d3ab494edc5dbc65ccde4020f427be8 | Create quiz-eliecer.py | eliecer11/Uip-prog3 | laboratorios/quiz-eliecer.py | laboratorios/quiz-eliecer.py |
base=5
altura=7
perimetro=2*5+2*7
print ("mi perimetro es" + str(perimetro))
area=5*7
print ("mi area es" + str (area))
metrop=perimetro/100
print ("mi perimetro en metro es" + str(metrop))
pulgadap=perimetro/2.54
print ("mi perimetro en pulgada es" + str(pulgadap))
metroa=area/100
print ("mi area en metro es" +... | mit | Python | |
ee554d89d1c822537345ce4d03d2bff8783d7f1b | Disable nacl_integration due to #261724. | chuan9/chromium-crosswalk,chuan9/chromium-crosswalk,ChromiumWebApps/chromium,Fireblend/chromium-crosswalk,dednal/chromium.src,axinging/chromium-crosswalk,chuan9/chromium-crosswalk,Chilledheart/chromium,anirudhSK/chromium,fujunwei/chromium-crosswalk,dushu1203/chromium.src,PeterWangIntel/chromium-crosswalk,ondra-novak/ch... | chrome/test/nacl_test_injection/buildbot_nacl_integration.py | chrome/test/nacl_test_injection/buildbot_nacl_integration.py | #!/usr/bin/env python
# Copyright (c) 2012 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 os
import subprocess
import sys
def Main(args):
if sys.platform == 'darwin':
print >> sys.stderr, "SKIPPING NACL INT... | #!/usr/bin/env python
# Copyright (c) 2012 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 os
import subprocess
import sys
def Main(args):
pwd = os.environ.get('PWD', '')
is_integration_bot = 'nacl-chrome' in ... | bsd-3-clause | Python |
33448340d278da7e0653701d78cbab317893279d | Add a simple analysis tool to get some structural properties about an AG's specfile. | jcnelson/syndicate,iychoi/syndicate,iychoi/syndicate,jcnelson/syndicate,iychoi/syndicate,iychoi/syndicate,iychoi/syndicate,iychoi/syndicate,iychoi/syndicate,jcnelson/syndicate,jcnelson/syndicate,jcnelson/syndicate,jcnelson/syndicate,iychoi/syndicate,jcnelson/syndicate,jcnelson/syndicate | AG/datasets/analyze.py | AG/datasets/analyze.py | #!/usr/bin/python
import os
import sys
import lxml
from lxml import etree
import math
class StatsCounter(object):
prefixes = {}
cur_tag = None
def start( self, tag, attrib ):
self.cur_tag = tag
def end( self, tag ):
pass
#self.cur_tag = None
def data( self, _data ):
... | apache-2.0 | Python | |
cc8e38b46ee79b08c76b31d173301549722693b9 | add examples of deployment object | kubernetes-client/python,mbohlool/client-python,mbohlool/client-python,kubernetes-client/python | examples/deployment_examples.py | examples/deployment_examples.py | # Copyright 2016 The Kubernetes 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 law or agreed to ... | apache-2.0 | Python | |
16165a9387807d54b91873e95a677bfe5d251aba | Add healthcheck module to contrib | ayust/kitnirc | kitnirc/contrib/healthcheck.py | kitnirc/contrib/healthcheck.py | import logging
import sys
import threading
import time
from kitnirc.modular import Module
_log = logging.getLogger(__name__)
class HealthcheckModule(Module):
"""A KitnIRC module which checks connection health.
By default, this module will request a PONG response from the server
if it hasn't seen any t... | mit | Python | |
a533cf1eeea7f0126df86b84f54208154685ab32 | Implement color brightness and contrast ratio calculations in preparation for improving label handling of text colors | cruor99/KivyMD | kivymd/theming_dynamic_text.py | kivymd/theming_dynamic_text.py | # -*- coding: utf-8 -*-
# Two implementations. The first is based on color brightness obtained from:-
# https://www.w3.org/TR/AERT#color-contrast
# The second is based on relative luminance calculation for sRGB obtained from:-
# https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
# and contrast ratio c... | mit | Python | |
cad7db237c68139d3f4f7dd691205b207edb0b79 | Refactor plugin api code into its own module | jjohnson42/confluent,michaelfardu/thinkconfluent,jjohnson42/confluent,jufm/confluent,chenglch/confluent,michaelfardu/thinkconfluent,xcat2/confluent,jufm/confluent,jjohnson42/confluent,chenglch/confluent,michaelfardu/thinkconfluent,xcat2/confluent,jufm/confluent,jjohnson42/confluent,whowutwut/confluent,chenglch/confluen... | confluent/pluginapi.py | confluent/pluginapi.py | # concept here that mapping from the resource tree and arguments go to
# specific python class signatures. The intent is to require
# plugin authors to come here if they *really* think they need new 'commands'
# and hopefully curtail deviation by each plugin author
# have to specify a standard place for cfg selection... | apache-2.0 | Python | |
2cef2ff2eb9c415f374de0a2f8a7174fddca8836 | add missing session.py file | blablacar/exabgp,lochiiconnectivity/exabgp,earies/exabgp,lochiiconnectivity/exabgp,PowerDNS/exabgp,dneiter/exabgp,dneiter/exabgp,benagricola/exabgp,PowerDNS/exabgp,dneiter/exabgp,fugitifduck/exabgp,fugitifduck/exabgp,blablacar/exabgp,PowerDNS/exabgp,earies/exabgp,benagricola/exabgp,earies/exabgp,lochiiconnectivity/exab... | lib/exabgp/configuration/bgp/session.py | lib/exabgp/configuration/bgp/session.py | # encoding: utf-8
"""
session.py
Created by Thomas Mangin on 2014-06-22.
Copyright (c) 2014-2014 Exa Networks. All rights reserved.
"""
from exabgp.configuration.engine.registry import Raised
from exabgp.configuration.engine.section import Section
from exabgp.configuration.engine.parser import asn
from exabgp.configu... | bsd-3-clause | Python | |
5c8caad82cd43044152171973e2386d655a1fa3a | Add tests for the way "between" works if no limits are set up | FrankSalad/django-recurrence,django-recurrence/django-recurrence,linux2400/django-recurrence,Nikola-K/django-recurrence,django-recurrence/django-recurrence,Nikola-K/django-recurrence,linux2400/django-recurrence,FrankSalad/django-recurrence | tests/test_recurrences_without_limits.py | tests/test_recurrences_without_limits.py | from datetime import datetime
from recurrence import Recurrence, Rule
import recurrence
RULE = Rule(
recurrence.DAILY
)
PATTERN = Recurrence(
rrules=[RULE]
)
def test_between_without_dtend_and_dtstart():
occurrences = [
instance for instance in
PATTERN.between(
datetime(2014... | bsd-3-clause | Python | |
a9ca7f2f22551256213ecd32047022048c72db5c | Add Python 3 Script for Converting Image Types | Molecular-Image-Recognition/Molecular-Image-Recognition | scripts/convert_svgs.py | scripts/convert_svgs.py | import cairosvg
import os
# MUST RUN IN PYTHON 3 and pip install cairosvg
file_dir = '../data/hough_test/Test_Set_1/'
svgs = os.listdir(os.path.join(file_dir, 'SVGs'))
for svg in svgs:
name = svg.split('.svg')[0]
cairosvg.svg2png(url=os.path.join(file_dir, 'SVGs', svg),
write_to=os.path... | mit | Python | |
392be3310efc812686c0d43f7ca884d9c730a879 | Add stop-by-time script to end simulation after a specified amount of simulated time | abanaiyan/sniper,abanaiyan/sniper,abanaiyan/sniper,abanaiyan/sniper,abanaiyan/sniper | scripts/stop-by-time.py | scripts/stop-by-time.py | # End ROI after x nanoseconds
# Usage: -s stop-by-time:1000000 # End after 1 ms of simulated time
import sim
class StopByTime:
def setup(self, args):
args = dict(enumerate((args or '').split(':')))
self.time = long(args.get(0, 1e6))
self.done = False
sim.util.Every(self.time * sim.ut... | mit | Python | |
30a0b17d028f279a9877150ac4eb60b1ce135fa2 | Add check script for MultiplyHueAndSaturation | aleju/imgaug,aleju/imgaug,aleju/ImageAugmenter | checks/check_multiply_hue_and_saturation.py | checks/check_multiply_hue_and_saturation.py | from __future__ import print_function, division
import numpy as np
import imgaug as ia
from imgaug import augmenters as iaa
def main():
image = ia.quokka_square((128, 128))
images_aug = []
for mul in np.linspace(0.0, 2.0, 10):
aug = iaa.MultiplyHueAndSaturation(mul)
image_aug = aug.augm... | mit | Python | |
45ec6d5451062c8e3310332c0246eebb231233ef | Add script | erinspace/osf.io,TomBaxter/osf.io,cwisecarver/osf.io,cslzchen/osf.io,caseyrollins/osf.io,pattisdr/osf.io,mattclark/osf.io,adlius/osf.io,baylee-d/osf.io,icereval/osf.io,chennan47/osf.io,icereval/osf.io,Johnetordoff/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,laurenrevere/osf.io,baylee-d/osf.io,cwisecarver/osf.io,... | scripts/migrate_duplicate_external_accounts.py | scripts/migrate_duplicate_external_accounts.py | from __future__ import absolute_import
import logging
import sys
from dropbox.rest import ErrorResponse
from dropbox.client import DropboxClient
from framework.mongo import database as db
from framework.transactions.context import TokuTransaction
from website.app import init_app
from website.addons.github.api import... | apache-2.0 | Python | |
fb18da6685948de4e66c310af8b850739034c1e9 | Add move.py | AlexMathew/directory-move | move.py | move.py | import Tkinter as tk
import os
class Application(tk.Frame):
""" The Application class manages the GUI.
The create_widgets() method creates the widgets to be inserted in the frame.
A button triggers an event that calls the perform_move() method.
This function calls the recursive method move_directories(). """
de... | mit | Python | |
769036ffd7a21477a9133c58b352711d85c7a7a0 | add regression test for monkey patching of Queue | urllib3/urllib3,Lukasa/urllib3,Disassem/urllib3,sigmavirus24/urllib3,Lukasa/urllib3,sigmavirus24/urllib3,Disassem/urllib3,urllib3/urllib3 | test/test_queue_monkeypatch.py | test/test_queue_monkeypatch.py | from __future__ import absolute_import
import unittest
import urllib3
from urllib3.exceptions import EmptyPoolError
import Queue
class BadError(Exception):
"""
This should not be raised.
"""
pass
Queue.Empty = BadError
class TestConnectionPool(unittest.TestCase):
"""
"""
def test_queue... | mit | Python | |
338559737e34ca395cec895ac8e822fc3147c7aa | Add basic code | VictorLoren/hanging-fabric-calculator | tule.py | tule.py | def calcLength(x,y,z=0):
return (x**2 + y**2 + z**2)**0.5
#lengths are in feet
L = 92; W=68; H=22; MidXY=(W/2,L/2)
def feetToYards(inFeet):
return inFeet/3.0
def yardsToFeet(inYards):
return inYards * 3.0
#widthOfStrand is how wide the tule piece (in feet)
def findTotal(widthOfStrand,z=0,printTotal=Fals... | mit | Python | |
242479ace03928b20dc86806f7592ec1148b615b | Add integration test for DraftService. | pixelated-project/pixelated-user-agent,torquemad/pixelated-user-agent,torquemad/pixelated-user-agent,PuZZleDucK/pixelated-user-agent,PuZZleDucK/pixelated-user-agent,kaeff/pixelated-user-agent,SamuelToh/pixelated-user-agent,pixelated-project/pixelated-user-agent,PuZZleDucK/pixelated-user-agent,torquemad/pixelated-user-a... | service/test/integration/test_draft_service.py | service/test/integration/test_draft_service.py | #
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated 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 version.
#
# Pixelated is distrib... | agpl-3.0 | Python | |
c58be8c77fdad5ec8b6c9da9ba6cfc45ae0f6d07 | fix typo in fuzz_addresses.py | amac0/google-location-tools | fuzz-addresses.py | fuzz-addresses.py | import sys
import csv
from dateutil.parser import parse
from datetime import datetime
#Take a csv with datetime stamps and addresses split across remaing cells and output
#a fuzzed csv that contains two columns. A datetime stamp of the first day of the year
#in which the location occured, and the country.
#call it wi... | apache-2.0 | Python | |
0ff705b6bbe2d2844d6b947ca2aa8fc9cc9ead66 | Create PedidoDeletar.py | AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb | backend/Models/Grau/PedidoDeletar.py | backend/Models/Grau/PedidoDeletar.py | from Framework.Pedido import Pedido
from Framework.ErroNoHTTP import ErroNoHTTP
class PedidoDeletar(Pedido):
def __init__(self,variaveis_do_ambiente):
super(PedidoDeletar, self).__init__(variaveis_do_ambiente)
try:
self.id = self.corpo['id']
except:
raise ErroNoHTTP(400)
def getId(self):
return ... | mit | Python | |
d85442d5961602ae91c385a65e9503c409316b3f | Scrub stale data from redis | mozilla/tc-coalesce,dividehex/tc-coalesce | bin/scrub_stale_lists.py | bin/scrub_stale_lists.py | #!/usr/bin/env python
import sys
import os
import time
import redis
import requests
import logging
from urlparse import urlparse
from datetime import timedelta
def main(rds):
pf = "coalesce.v1."
tasks_removed = 0
lists_removed = 0
list_keys = rds.smembers(pf + "list_keys")
for key in list_keys:... | mpl-2.0 | Python | |
b2b81ac5222a5be7a310c8ef7774f9e2887b412e | optimise lags implemented | andrew0harney/Semantic-encoding-model | optimiseLDA.py | optimiseLDA.py | import cPickle, string, numpy, getopt, sys, random, time, re, pprint
import numpy as np
import glob
from gensim import corpora, models
import pickle
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.corpus import wordnet as wn
import logging
import matplotlib.pyplot as plt
import copy
from matplotli... | mit | Python | |
9870fdd4b0996254216ff85a4dc0f9706843ca50 | Add test for nested while with exc and break. | ruffy91/micropython,jmarcelino/pycom-micropython,henriknelson/micropython,puuu/micropython,neilh10/micropython,xuxiaoxin/micropython,utopiaprince/micropython,cwyark/micropython,aethaniel/micropython,tuc-osg/micropython,vitiral/micropython,orionrobots/micropython,noahchense/micropython,paul-xxx/micropython,ganshun666/mi... | tests/basics/while_nest_exc.py | tests/basics/while_nest_exc.py | # test nested whiles within a try-except
while 1:
print(1)
try:
print(2)
while 1:
print(3)
break
except:
print(4)
print(5)
break
| mit | Python | |
6a541b8d5b7c2c742420bbbe758866daef804e90 | Add a unit test to verify controller objects do not persist across classes. (#483) | google/mobly | tests/mobly/test_suite_test.py | tests/mobly/test_suite_test.py | # Copyright 2018 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 writing, ... | apache-2.0 | Python | |
56cb3c6c046c403e186a5191e30b8b982900c57c | Add cli project tests | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | tests/test_cli/test_project.py | tests/test_cli/test_project.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from mock import patch
from tests.test_cli.utils import BaseCommandTestCase
from polyaxon_cli.cli.project import project
class TestProject(BaseCommandTestCase):
@patch('polyaxon_client.api.project.ProjectApi.create_project... | apache-2.0 | Python | |
bf28aa8fbe9aa735d017f935aefb89c5ed48f836 | Add bubble sort implementation | ueg1990/aids | aids/sorting_and_searching/bubble_sort.py | aids/sorting_and_searching/bubble_sort.py | '''
In this module, we implement bubble sort
Time complexity: O(n ^ 2)
'''
def bubble_sort(arr):
'''
Sort array using bubble sort
'''
for index_x in xrange(len(arr)):
for index_y in xrange(len(arr) - 1, index_x, -1):
if arr[index_y] < arr[index_y - 1]:
arr[index_... | mit | Python | |
73cab4c1e0a591504176011b53b9774c8782238e | test kalman | 207leftovers/cs207project,207leftovers/cs207project | tests/tsdb/test_tsdb_kalman.py | tests/tsdb/test_tsdb_kalman.py | from tsdb import TSDBClient, TSDB_REST_Client
import timeseries as ts
import numpy as np
import subprocess
import unittest
import asyncio
import asynctest
import time
class Test_TSDB_Kalman(asynctest.TestCase):
def setUp(self):
#############
### SETUP ###
#############
# We'll... | mit | Python | |
faef1804e1781365fc027ecf08d61fbab56a4679 | Add migratioss I forgot to commit out of saltyness | Angoreher/xcero,Angoreher/xcero,Angoreher/xcero,Angoreher/xcero | magic/migrations/0003_auto_20170929_0229.py | magic/migrations/0003_auto_20170929_0229.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-29 05:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('magic', '0002_auto_20170929_0159'),
]
operations = [
migrations.AlterField(... | mit | Python | |
e61dcb055fb4767e6e662648c89cbdfda4422c97 | Update expected error message in this test | chapel-lang/pychapel,russel/pychapel,chapel-lang/pychapel,russel/pychapel,russel/pychapel,chapel-lang/pychapel | docs/source/examples/test_no_depends_fails.py | docs/source/examples/test_no_depends_fails.py | from pych.extern import Chapel
@Chapel(sfile="users.onlyonce.chpl")
def useTwoModules(x=int, y=int):
return int
if __name__ == "__main__":
print(useTwoModules(2, 4))
import testcase
# contains the general testing method, which allows us to gather output
import os.path
def test_using_multiple_modules():
... | from pych.extern import Chapel
@Chapel(sfile="users.onlyonce.chpl")
def useTwoModules(x=int, y=int):
return int
if __name__ == "__main__":
print(useTwoModules(2, 4))
import testcase
# contains the general testing method, which allows us to gather output
import os.path
def test_using_multiple_modules():
... | apache-2.0 | Python |
2e7048d8feae5ed2c244e617077235b5b771f326 | Add deleted selenium runner | josthkko/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,prasannav7/ggrc-core,AleksNeStu/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,kr41/ggrc-core,edofic/ggrc-c... | test/selenium/src/run_selenium.py | test/selenium/src/run_selenium.py | #!/usr/bin/env python2.7
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
""" Basic selenium test runner
This script is used for... | apache-2.0 | Python | |
3bb65466d40c1b59faebe0db40eced260ff60010 | Create SampleFunction.py | lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples | src/Python/ImplicitFunctions/SampleFunction.py | src/Python/ImplicitFunctions/SampleFunction.py | #!/usr/bin/env python
import vtk
def main():
value = 2.0
colors = vtk.vtkNamedColors()
implicitFunction = vtk.vtkSuperquadric()
implicitFunction.SetPhiRoundness(2.5)
implicitFunction.SetThetaRoundness(.5)
# Sample the function.
sample = vtk.vtkSampleFunction()
sample.SetSampleDimensions(50,50,50)
sample.... | apache-2.0 | Python | |
95a890b988435fb019083026572ddb7042dc1379 | Create generate.py | mmcgaley/CoreRopeMemory,mmcgaley/CoreRopeMemory,mmcgaley/CoreRopeMemory | PrettyBits/generate.py | PrettyBits/generate.py | # coding=UTF-8
#
# generate a list of all 8 bit binary strings,
# sort them by how "pretty" they will be in
# Core Rope Memory
#
# mmcgaley@gmail.com
# 2015.04.19
#
WORDLEN = 7
import math
def addLeadingZeros(binaryString) :
return ((WORDLEN - len(binaryString)) * "0") + binaryString
def maxZeros(binaryStri... | mit | Python | |
524f47a4d4e0db5b76dfb7ebf9447b6199e48b6d | Add data utils tests. | christabor/flask_jsondash,christabor/flask_jsondash,christabor/flask_jsondash | tests/test_data_utils_filetree.py | tests/test_data_utils_filetree.py | from uuid import uuid1
import json
import pytest
from flask_jsondash.data_utils import filetree
def test_path_hierarchy(tmpdir):
uid = uuid1()
tmpfile = tmpdir.mkdir('{}'.format(uid))
data = filetree.path_hierarchy(tmpfile.strpath)
assert json.dumps(data)
for key in ['type', 'name', 'path']:
... | mit | Python | |
8d6959a6d950e243ebd2c930ae176a3debf4cc9c | Add package-updates-metric.py | cmattoon/sensu-community-plugins,himyouten/sensu-community-plugins,madAndroid/sensu-community-plugins,JonathanHuot/sensu-community-plugins,himyouten/sensu-community-plugins,lenfree/sensu-community-plugins,estately/sensu-community-plugins,ideais/sensu-community-plugins,mecavity/sensu-community-plugins,giorgiosironi/sens... | plugins/system/package-updates-metric.py | plugins/system/package-updates-metric.py | #!/usr/bin/env python
#coding=utf-8
import apt
import apt_pkg
import json
import os
import subprocess
import sys
"""
security-updates-metric is used to check avaliable package updates
for Debian or Ubuntu system.
The program is inspired by /usr/lib/update-notifier/apt_check.py
"""
SYNAPTIC_PINFILE = "/var/lib/synap... | mit | Python | |
37d0843c76b558d6d7a1892963a30e9a56d73f24 | Document typical Stylesheet attributes | leviroth/praw,gschizas/praw,praw-dev/praw,praw-dev/praw,leviroth/praw,gschizas/praw | praw/models/stylesheet.py | praw/models/stylesheet.py | """Provide the Stylesheet class."""
from .base import PRAWBase
class Stylesheet(PRAWBase):
"""Represent a stylesheet.
**Typical Attributes**
This table describes attributes that typically belong to objects of this
class. Since attributes are dynamically provided (see
:ref:`determine-available-a... | """Provide the Stylesheet class."""
from .base import PRAWBase
class Stylesheet(PRAWBase):
"""Represent a stylesheet."""
| bsd-2-clause | Python |
4cde1f2fcc21ff83daabdb5221c462f44991c73f | Create remove-boxes.py | jaredkoontz/leetcode,yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,jaredkoontz/leetcode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,jared... | Python/remove-boxes.py | Python/remove-boxes.py | # Time: O(n^3) ~ O(n^4)
# Space: O(n^3)
# Given several boxes with different colors represented by different positive numbers.
# You may experience several rounds to remove boxes until there is no box left.
# Each time you can choose some continuous boxes with the same color (composed of k boxes, k >= 1),
# remove t... | mit | Python | |
9a5bfb7f5bf114bb4bcf2dd4c88ddd8924a97ed9 | add menu function to menu.py | marshki/pyWipe,marshki/pyWipe | menu.py | menu.py | #!/usr/bin/end python
# Text-based menu for use in pyWype.py
def menu():
""" Menu prompt for user to select program option """
while True:
print 'I'
print 'II'
print 'III'
print 'IV'
print 'V'
choice = raw_input('Select an option (I, II, III, IV, V): ')
... | mit | Python | |
fb61398b6a0cdd4f40d16729ab2ff0ca47730526 | Add the main file | pahumadad/raspi-relay-api | relay_api/__main__.py | relay_api/__main__.py | from relay_api.api.server import server
from relay_api.conf.config import relays
import relay_api.api.server as api
@server.route("/relay-api/relays", methods=["GET"])
def get_relays():
return api.get_relays(relays)
@server.route("/relay-api/relays/<int:relay_id>", methods=["GET"])
def get_relay(relay_id):
... | mit | Python | |
72a0d635e497f0f4c6c58d84f7001ec04063ea90 | Add mfnd.py that prints todays date | mes32/mfnd | mfnd.py | mfnd.py | #!/usr/bin/env python3
"""
MFND - A simple to-do list application
"""
import datetime
today = datetime.date.today()
print( today.strftime('MFND - %B %d, %Y') )
| mit | Python | |
d3469fd3ab39eeee381457588931636bf0987ea9 | Create impossible_bet.py | shyadow/impossible-bet | impossible_bet.py | impossible_bet.py | import random
def play_bet(participants=100, times=1000, checks=50):
"""Simulate the bet x times with x participants."""
wins = 0
losses = 0
for time in range(times):
boxes = list(range(1, participants + 1))
random.shuffle(boxes)
for participant in range(1, participants + 1):
... | mit | Python | |
aeabe6bb89a359e644c5adcb4c6456fd3428f6de | Stop using intersphinx | bcrochet/python-ironicclient,varunarya10/python-ironicclient,redhat-openstack/python-ironicclient,NaohiroTamura/python-ironicclient,openstack/python-ironicclient,openstack/python-ironicclient,JioCloud/python-ironicclient,rdo-management/python-ironicclient,NaohiroTamura/python-ironicclient | doc/source/conf.py | doc/source/conf.py | # -*- coding: utf-8 -*-
#
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.view... | # -*- coding: utf-8 -*-
#
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.inte... | apache-2.0 | Python |
e8c2406cbcff96196d2404e9df167cc96f468779 | add sources api | fkmclane/MCP,fkmclane/MCP,fkmclane/MCP,fkmclane/MCP | mcp/interface/sources.py | mcp/interface/sources.py | import json
from mcp import sources
from mcp.interface import common
class SourcesHandler(common.AuthorizedHandler):
def forbidden(self):
return True
def do_get(self):
return 200, json.dumps(list(iter(sources.source_db)))
class SourceHandler(common.AuthorizedHandler):
def __init__(self, request, response, gr... | mit | Python | |
5dabba3941f870f3f365e186fdf852e834649595 | Move config to docs | leoc/home-assistant,open-homeautomation/home-assistant,ct-23/home-assistant,LinuxChristian/home-assistant,hmronline/home-assistant,bdfoster/blumate,Zyell/home-assistant,jnewland/home-assistant,aronsky/home-assistant,hmronline/home-assistant,miniconfig/home-assistant,soldag/home-assistant,joopert/home-assistant,shaftoe/... | homeassistant/components/sensor/eliqonline.py | homeassistant/components/sensor/eliqonline.py | """
homeassistant.components.sensor.eliqonline
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monitors home energy use for the eliq online service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.eliqonline/
"""
import logging
from homeassistant.helper... | """
homeassistant.components.sensor.eliqonline
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitors home energy use for the eliq online service
api documentation:
https://my.eliq.se/knowledge/sv-SE/49-eliq-online/299-eliq-online-api
access to api access token:
https://my.eliq.se/user/settings/api
current energy u... | mit | Python |
b2aa91648fe3ae915381e68cac95e5c3f6e5a182 | add zhihu_login.py | dnxbjyj/python-basic,dnxbjyj/python-basic,dnxbjyj/python-basic | spider/login/zhihu_login.py | spider/login/zhihu_login.py | # coding:utf-8
# 模拟账户登录 | mit | Python | |
c505927ae756fe1740e8603aadf23dae0ad12ff5 | Create 01.CenturiesToMinutes.py | stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity | TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Lab/01.CenturiesToMinutes.py | TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Lab/01.CenturiesToMinutes.py | centuries = int(input())
years = centuries * 100
days = int(years * 365.2422)
hours = days * 24
minutes = hours * 60
print("%d centuries = %d years = %d days = %d hours %d = minutes" %
(centuries, years, days, hours, minutes))
| mit | Python | |
dca52ab05af01b96610e5044c45bd7c0655c17ec | introduce an Exporter API | gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl | pynodegl-utils/pynodegl_utils/export.py | pynodegl-utils/pynodegl_utils/export.py | import os
import platform
import subprocess
import pynodegl as ngl
from PyQt5 import QtGui, QtCore
class _PipeThread(QtCore.QThread):
def __init__(self, fd, unused_fd, w, h, fps):
super(_PipeThread, self).__init__()
self.fd = fd
self.unused_fd = unused_fd
self.w, self.h, self.fps... | apache-2.0 | Python | |
ab9800183b3ab229782016aa3f88e6825467d01b | Add forgot username tests | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | api/radar_api/tests/test_forgot_username.py | api/radar_api/tests/test_forgot_username.py | def test_forgot_username(app):
client = app.test_client()
response = client.post('/forgot-username', data={
'email': 'foo@example.org'
})
assert response.status_code == 200
def test_email_missing(app):
client = app.test_client()
response = client.post('/forgot-username', data={})
... | agpl-3.0 | Python | |
9b9fb4df30a8183c4de9f157200c5ff225d11d67 | Add the plot script | liveontologies/elk-justifications,liveontologies/elk-justifications,liveontologies/elk-justifications,liveontologies/elk-justifications | src/scripts/prepare_gnuplot.py | src/scripts/prepare_gnuplot.py | #!/usr/bin/python
import sys
import argparse
import csv
from string import Template
parser = argparse.ArgumentParser(description='Prepare gnuplot script from the supplied data files.')
parser.add_argument('files', nargs='+', help='The data files.')
MIN_Y_RANGE = 0.000001
GNUPLOT_SCRIPT_TEMPLATE = Template("""
rese... | apache-2.0 | Python | |
6f1729a96e1fe0f4e8d00813b6c2829519cdc15f | Handle the case where we encounter a snap shot correctly. | n0ano/ganttclient | nova/tests/test_image_utils.py | nova/tests/test_image_utils.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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.or... | apache-2.0 | Python | |
27a3ca8d746890c7404845d18b8031763ec6b6a7 | add netcat-nonblock.py | chenshuo/recipes,chenshuo/recipes,chenshuo/recipes,chenshuo/recipes,chenshuo/recipes,chenshuo/recipes | python/netcat-nonblock.py | python/netcat-nonblock.py | #!/usr/bin/python
import errno
import fcntl
import os
import select
import socket
import sys
def setNonBlocking(fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK)
def nonBlockingWrite(fd, data):
try:
nw = os.write(fd, data)
return nw
exc... | bsd-3-clause | Python | |
34fd215d73d87c017cdae299aebd6484e6541991 | Revert 176254 > Android: upgrade sandbox_linux_unitests to a stable test > > > BUG=166704 > NOTRY=true > > Review URL: https://chromiumcodereview.appspot.com/11783106 | Chilledheart/chromium,krieger-od/nwjs_chromium.src,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,fujunwei/chromium-crosswalk,M4sse/chromium.src,zcbenz/cefode-chromium,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,M4sse/chromium.src,hujiajie/pa-chromium,anirudhSK/chromium,dushu1203/chromium.src,jaruba/chromium.src,... | build/android/pylib/gtest/gtest_config.py | build/android/pylib/gtest/gtest_config.py | # Copyright (c) 2013 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.
"""Configuration file for android gtest suites."""
# Add new suites here before upgrading them to the stable list below.
EXPERIMENTAL_TEST_SUITES = [
... | # Copyright (c) 2013 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.
"""Configuration file for android gtest suites."""
# Add new suites here before upgrading them to the stable list below.
EXPERIMENTAL_TEST_SUITES = [
]
... | bsd-3-clause | Python |
4783f68cb2fc3eb25b611b4662d1ca3a2fddd7b3 | Fix issue #51: added throttled_ftpd.py script in the demo directory. | giampaolo/pyftpdlib | demo/throttled_ftpd.py | demo/throttled_ftpd.py | #!/usr/bin/env python
# throttled_ftpd.py
"""ftpd supporting bandwidth throttling capabilities for data transfer.
"""
import os
import time
import asyncore
from pyftpdlib import ftpserver
class ThrottledDTPHandler(ftpserver.DTPHandler):
"""A DTPHandler which wraps sending and receiving in a data ... | mit | Python | |
732fd24d06f49570c24016b7adfb3ad511e2e6af | Add test for ValidationResultIdentifier.to_tuple() | great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations | tests/data_context/test_data_context_resource_identifiers.py | tests/data_context/test_data_context_resource_identifiers.py | from great_expectations.data_context.types.resource_identifiers import (
ValidationResultIdentifier
)
def test_ValidationResultIdentifier_to_tuple(expectation_suite_identifier):
validation_result_identifier = ValidationResultIdentifier(
expectation_suite_identifier,
"my_run_id",
"my_ba... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.