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
2ee6c3c890f236eb7dff0a8094ca3207df119b49
add new unittest for issue #28
NLeSC/pyxenon,NLeSC/pyxenon
tests/test_issue28.py
tests/test_issue28.py
import pytest from xenon import Path from xenon.exceptions import NoSuchPathException def test_file_does_not_exist(local_filesystem, tmpdir): tmpdir = Path(str(tmpdir)) with pytest.raises(NoSuchPathException): filename = tmpdir / 'this-file-does-not-exist' result = bytearray() for chun...
apache-2.0
Python
5e0b80cada5ebae0412347471723af9b444007a6
Add sticker tests
carpedm20/fbchat
tests/test_sticker.py
tests/test_sticker.py
import pytest from fbchat._sticker import Sticker def test_from_graphql_none(): assert None == Sticker._from_graphql(None) def test_from_graphql_minimal(): assert Sticker(uid=1) == Sticker._from_graphql({"id": 1}) def test_from_graphql_normal(): assert Sticker( uid="369239383222810", p...
bsd-3-clause
Python
6cd7bd0d304c751bd40ce292074a034676ce0a30
Add setupeggscons script, to use scons build under setuptools.
sonnyhu/scipy,grlee77/scipy,jor-/scipy,ChanderG/scipy,e-q/scipy,ndchorley/scipy,WillieMaddox/scipy,lhilt/scipy,josephcslater/scipy,anntzer/scipy,vanpact/scipy,ogrisel/scipy,aman-iitj/scipy,person142/scipy,hainm/scipy,pnedunuri/scipy,aeklant/scipy,pyramania/scipy,gertingold/scipy,behzadnouri/scipy,person142/scipy,sargas...
setupeggscons.py
setupeggscons.py
#!/usr/bin/env python """ A setup.py script to use setuptools, which gives egg goodness, etc. """ from setuptools import setup execfile('setupscons.py')
bsd-3-clause
Python
163b29a07c4d25ee9d3157eb5c517f06a170f42c
Update autocons.py
xcat2/confluent,jjohnson42/confluent,xcat2/confluent,jjohnson42/confluent,xcat2/confluent,xcat2/confluent,jjohnson42/confluent,jjohnson42/confluent,jjohnson42/confluent,xcat2/confluent
misc/autocons.py
misc/autocons.py
import os import struct import termios addrtoname = { 0x3f8: '/dev/ttyS0', 0x2f8: '/dev/ttyS1', 0x3e8: '/dev/ttyS2', 0x2e8: '/dev/ttyS3', } speedmap = { 0: None, 3: 9600, 4: 19200, 6: 57600, 7: 115200, } termiobaud = { 9600: termios.B9600, 19200: termios.B19200, 57600: ...
apache-2.0
Python
871405e3e4721ae4f31efb5add8dc0e6d48500df
add test cases for inference new X for bayesian GPLVM
strongh/GPy,mikecroucher/GPy,jameshensman/GPy,dhhjx880713/GPy,PredictiveScienceLab/GPy,befelix/GPy,ysekky/GPy,mikecroucher/GPy,Dapid/GPy,AlexGrig/GPy,esiivola/GPYgradients,AlexGrig/GPy,beckdaniel/GPy,ysekky/GPy,mikecroucher/GPy,beckdaniel/GPy,TianpeiLuke/GPy,buntyke/GPy,beckdaniel/GPy,AlexGrig/GPy,jameshensman/GPy,pton...
GPy/testing/inference_tests.py
GPy/testing/inference_tests.py
""" The test cases for various inference algorithms """ import unittest, itertools import numpy as np import GPy class InferenceXTestCase(unittest.TestCase): def genData(self): D1,D2,N = 12,12,50 np.random.seed(1234) x = np.linspace(0, 4 * np.pi, N)[:, None] s1 = np.vec...
bsd-3-clause
Python
883cd30860d881a9d201c088210deb4ee0d6f6d0
add an example file to show off colorbar types in vispy.plot
jdreaver/vispy,drufat/vispy,ghisvail/vispy,dchilds7/Deysha-Star-Formation,srinathv/vispy,jdreaver/vispy,kkuunnddaannkk/vispy,Eric89GXL/vispy,Eric89GXL/vispy,srinathv/vispy,kkuunnddaannkk/vispy,dchilds7/Deysha-Star-Formation,ghisvail/vispy,QuLogic/vispy,julienr/vispy,QuLogic/vispy,julienr/vispy,inclement/vispy,RebeccaWP...
examples/basics/plotting/colorbar_types.py
examples/basics/plotting/colorbar_types.py
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # vispy: gallery 1 """ Plot different styles of ColorBar """ import numpy as np from vispy import plot as vp fig = vp.Fig(size=(800, 400), show=False) plot = fig[0, 0] cente...
bsd-3-clause
Python
e73b31fb03c42873ad553891d3b643c9c9196a62
add migration file
jamesbeebop/evennia,jamesbeebop/evennia,jamesbeebop/evennia
evennia/typeclasses/migrations/0013_auto_20191015_1922.py
evennia/typeclasses/migrations/0013_auto_20191015_1922.py
# Generated by Django 2.2.6 on 2019-10-15 19:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('typeclasses', '0012_attrs_to_picklev4_may_be_slow'), ] operations = [ migrations.AlterField( model_name='tag', name=...
bsd-3-clause
Python
36975cb23aa628f4346095c180b627505d1a692e
Add spider for Barnes & Noble
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
locations/spiders/barnesandnoble.py
locations/spiders/barnesandnoble.py
import scrapy import re import json from urllib.parse import urlencode from locations.items import GeojsonPointItem from locations.hours import OpeningHours DAY_MAPPING = { 'Sun': 'Su', 'Mon': 'Mo', 'Tue': 'Tu', 'Wed': 'We', 'Thu': 'Th', 'Fri': 'Fr', 'Sat': 'Sa' } DAY_ORDER = ['Sun', 'Mon'...
mit
Python
ff03cab2f3164af68719466df7049ec4cd272c72
Implement idbe client
Kinnay/NintendoClients
nintendo/idbe.py
nintendo/idbe.py
from Crypto.Cipher import AES from nintendo.common.streams import StreamIn import requests import hashlib class IDBEStrings: def __init__(self, stream): self.short_name = stream.wchars(64).rstrip("\0") self.long_name = stream.wchars(128).rstrip("\0") self.publisher = stream.wchars(64).rstrip("\0") ...
mit
Python
cdbddcfff74cffe7ca32de64068a5404ae9eae3f
Add tests for i3bar input processing
tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status
tests/test_i3barinput.py
tests/test_i3barinput.py
# pylint: disable=C0103,C0111 import json import mock import unittest import mocks from bumblebee.input import I3BarInput, LEFT_MOUSE, RIGHT_MOUSE class TestI3BarInput(unittest.TestCase): def setUp(self): self.input = I3BarInput() self.input.need_event = True self._stdin = mock.patch("b...
mit
Python
d048d02cde1c4eea536bc6348757389e2ff0f994
add test to load ophiuchus potential
adrn/ophiuchus,adrn/ophiuchus,adrn/ophiuchus,adrn/ophiuchus
ophiuchus/potential/tests/test_load.py
ophiuchus/potential/tests/test_load.py
# coding: utf-8 from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os import sys import logging # Third-party from astropy import log as logger import matplotlib.pyplot as pl import numpy as np # Project from ..load import load_potential def tes...
mit
Python
18d4d5febb9143b764e53fabb3503b94836abbf5
Create restricted-sum.py
Pouf/CodingCompetition,Pouf/CodingCompetition
CiO/restricted-sum.py
CiO/restricted-sum.py
def checkio(d): eval('+'.join(map(str,d)))
mit
Python
3063044995a14921fd0da2ebbbd57942bb5ca24d
Add the skeleton and docs
basepi/hubble,basepi/hubble
hubblestack/extmods/modules/safecommand.py
hubblestack/extmods/modules/safecommand.py
# -*- encoding: utf-8 -*- ''' Safe Command ============ The idea behind this module is to allow an arbitrary command to be executed safely, with the arguments to the specified binary (optionally) coming from the fileserver. For example, you might have some internal license auditing application for which you need the ...
apache-2.0
Python
4a73c4faecf3584e6a18861fec8c7c97b1b72e1c
add initial migration
kojdjak/django-reservations,kojdjak/django-reservations
reservations/migrations/0001_initial.py
reservations/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.dev20160603044730 on 2016-06-03 11:28 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ...
mit
Python
d1f595068cad18695c048a7620cc16098281bc9e
fix option and working on stand-alone python demo
UM-ARM-Lab/sdf_tools
scripts/3d_sdf_demo_rviz.py
scripts/3d_sdf_demo_rviz.py
""" Demonstrates creating a 3d SDF displays it in rviz """ import ros_numpy import rospy import numpy as np from geometry_msgs.msg import Point from sdf_tools.utils_3d import compute_sdf_and_gradient from sensor_msgs.msg import PointCloud2 from visualization_msgs.msg import MarkerArray, Marker def create_point_cloud...
bsd-2-clause
Python
4e1062ea02ccd99940da18a887e2092b0a9e5650
add basic test
vyos/vyos-1x,vyos/vyos-1x,vyos/vyos-1x,vyos/vyos-1x
scripts/cli/test_service_mdns-repeater.py
scripts/cli/test_service_mdns-repeater.py
#!/usr/bin/env python3 # # Copyright (C) 2020 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as # published by the Free Software Foundation. # # This program is distributed in the hope t...
lgpl-2.1
Python
abac63b3ac4646af52ae7cc2a3cf90c180db9ff1
Create views2.py
SNAPPETITE/backend,SNAPPETITE/backend,SNAPPETITE/backend,SNAPPETITE/backend,SNAPPETITE/backend
app/views2.py
app/views2.py
from flask import Flask from flask import render_template from flask import request, redirect from flask import json, jsonify from flask import make_response app = Flask(__name__) global email #renders the main website using the index template.html template @app.route('/') def hello_world(): return render_templa...
mit
Python
f770299a4de9e18c84fe67c3235b82066a9a98c2
Create boids_init.py
marios-tsiliakos/AgentsGHPython
src/boids_init.py
src/boids_init.py
def Agents_Init(n): Boids_population=[]#agent population list for i in range(len(n)): #instantiate the boid class #float(u0) #float(v0) pos_init= n[i] t,u0,v0 = Terrain.ClosestPoint(pos_init) pos_init = Terrain.PointAt(u0,v0) #print pos_init vec_i...
mit
Python
53d0d5886670ba33a645fd8c82479fb4495d25d1
Add new migrations (use "" as default for hash)
sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz
website/migrations/0002_auto_20150118_2210.py
website/migrations/0002_auto_20150118_2210.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('website', '0001_initial'), ] operations = [ migrations.AddField( model_name='query', name='cacheable...
mit
Python
c8a8944f97b746a42d18aee8718b6ac90e0b883a
Introduce prepare_pub_packages.py helper script for uploading pub packages
chinmaygarde/mojo,afandria/mojo,jianglu/mojo,afandria/mojo,jianglu/mojo,afandria/mojo,chinmaygarde/mojo,afandria/mojo,jianglu/mojo,jianglu/mojo,chinmaygarde/mojo,jianglu/mojo,afandria/mojo,chinmaygarde/mojo,afandria/mojo,chinmaygarde/mojo,chinmaygarde/mojo,chinmaygarde/mojo,jianglu/mojo,afandria/mojo,chinmaygarde/mojo,...
mojo/tools/prepare_pub_packages.py
mojo/tools/prepare_pub_packages.py
#!/usr/bin/env python # Copyright 2015 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. """Prepare pub packages for upload""" # NOTE: Requires the following build artifacts: # *) out/Config/gen/dart-pkg # *) out/Config/apk...
bsd-3-clause
Python
a91e4313a7cd7d0089dc9d2cef9c77d3f928c1bf
add tests for naff
adrn/SuperFreq
tests/test_naff.py
tests/test_naff.py
# coding: utf-8 """ Test action-angle stuff """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os import sys import logging # Third-party from astropy import log as logger from astropy.utils.console import color_print import astropy.units as ...
mit
Python
7e8f110610c6c4d02b042a1f47a7385c0d18c3bb
Create LeetCode-ReverseBits.py
lingcheng99/Algorithm
LeetCode-ReverseBits.py
LeetCode-ReverseBits.py
""" Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000). """ class Solution(object): def reverseBits(self, n): """ :type n: int...
mit
Python
322a7907c6dbd6f742b19161869d46a13fb691d8
convert pkl to raw
mjirik/lisa,mjirik/lisa
src/pkl_to_raw.py
src/pkl_to_raw.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Module is used for converting data from pkl format to raw. """ import argparse import misc import qmisc def main(): parser = argparse.ArgumentParser(description=__doc__) # 'Simple VTK Viewer') parser.add_argument('-i','--inputfile', default=None, ...
bsd-3-clause
Python
a76a9bf10450eb7f5f69eb2264f75c0cd3a4d283
Add example
votti/PyLaTeX,sebastianhaas/PyLaTeX,ovaskevich/PyLaTeX,JelteF/PyLaTeX,JelteF/PyLaTeX,votti/PyLaTeX,bjodah/PyLaTeX,ovaskevich/PyLaTeX,jendas1/PyLaTeX,sebastianhaas/PyLaTeX,bjodah/PyLaTeX,jendas1/PyLaTeX
examples/plt.py
examples/plt.py
#!/usr/bin/python import matplotlib.pyplot as pyplot from pylatex import Document, Section, Plt if __name__ == '__main__': x = [0, 1, 2, 3, 4, 5, 6] y = [15, 2, 7, 1, 5, 6, 9] pyplot.plot(x, y) doc = Document('matplolib_pdf') doc.append('Introduction.') with doc.create(Sectio...
mit
Python
a57157352e40439ba4155eaa4a62ba7d62c793dc
Add ielex/lexicon/migrations/0090_issue_236.py
lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public
ielex/lexicon/migrations/0090_issue_236.py
ielex/lexicon/migrations/0090_issue_236.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from django.db.models import Max from datetime import datetime def forwards_func(apps, schema_editor): ''' Computes statistics for https://github.com/lingdb/CoBL/issues/236 ''' # Models to work with: ...
bsd-2-clause
Python
d6e12d64341fbdc4fc0fdfc9792de9310ac6d2ff
Add "dsl" library.
PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge
src/puzzle/dsl.py
src/puzzle/dsl.py
"""This module is automatically imported into jupyter sessions.""" from puzzle.puzzlepedia import puzzlepedia solve = puzzlepedia.parse parse = puzzlepedia.parse
mit
Python
05f9717d4f7ef1f2a4bfeec382cc30d311b1fd21
Create cat_dog.py
dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey
Python/CodingBat/cat_dog.py
Python/CodingBat/cat_dog.py
# http://codingbat.com/prob/p164876 def cat_dog(str): cat_count = 0 dog_count = 0 for i in range(len(str)-2): if str[i:i+3] == "cat": cat_count += 1 elif str[i:i+3] == "dog": dog_count += 1 return (cat_count == dog_count)
mit
Python
8422fc90b804e250c3e918f028271cdb0b95d076
test case for operation access
mission-liao/pyopenapi
pyopenapi/tests/v2_0/test_op_access.py
pyopenapi/tests/v2_0/test_op_access.py
from pyopenapi import SwaggerApp, utils from ..utils import get_test_data_folder import unittest def _check(u, op): u.assertEqual(op.operationId, 'addPet') class OperationAccessTestCase(unittest.TestCase): """ test for methods to access Operation """ @classmethod def setUpClass(kls): kls.app ...
mit
Python
fb2a8c9b30360f185f3d56504222efc43c6cc1a0
Add constants.py module
jamesgk/ufo2ft,googlei18n/ufo2ft,moyogo/ufo2ft,googlefonts/ufo2ft,jamesgk/ufo2fdk
Lib/ufo2ft/constants.py
Lib/ufo2ft/constants.py
from __future__ import absolute_import, unicode_literals UFO2FT_PREFIX = 'com.github.googlei18n.ufo2ft.' GLYPHS_PREFIX = 'com.schriftgestaltung.' USE_PRODUCTION_NAMES = UFO2FT_PREFIX + "useProductionNames" GLYPHS_DONT_USE_PRODUCTION_NAMES = GLYPHS_PREFIX + "Don't use Production Names"
mit
Python
63f6b3e8b9febd298a8c8b3b0db467c47b7ec5d1
Create valid_phone_number.py
Kunalpod/codewars,Kunalpod/codewars
valid_phone_number.py
valid_phone_number.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Valid Phone Number #Problem level: 6 kyu import re def validPhoneNumber(phoneNumber): return bool(re.match('[(][0-9][0-9][0-9][)] [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]', phoneNumber)) and len(phoneNumber)==14
mit
Python
37b5531e2cc969e1ee73a46bf372d89871f922a7
Add array of prime number generator code
everyevery/programming_study,everyevery/algorithm_code,everyevery/algorithm_code,everyevery/programming_study,everyevery/algorithm_code,everyevery/algorithm_code,everyevery/algorithm_code,everyevery/programming_study,everyevery/algorithm_code,everyevery/programming_study,everyevery/algorithm_code,everyevery/programming...
tools/gen_prime.py
tools/gen_prime.py
import argparse import sys # Sieve of Eratosthenes # Code by David Eppstein, UC Irvine, 28 Feb 2002 # http://code.activestate.com/recipes/117119/ def gen_primes(): """ Generate an infinite sequence of prime numbers. """ # Maps composites to primes witnessing their compositeness. # This is memory effic...
mit
Python
0dfdf0c10be48c220b8c2fd7c18b3a04dbf639ba
add debugging slash.py script
ros/ros,ros/ros,ros/ros
tools/rosbag/scripts/slash.py
tools/rosbag/scripts/slash.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2009, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code...
bsd-3-clause
Python
5f58f4cec89570a1b884847aad84bca7a88d5a29
Create ballDetect.py
ilyajob05/ballDetect
ballDetect.py
ballDetect.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import cv2 import numpy as np from math import * import time cap = cv2.VideoCapture('video.3gp') fourcc = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G') writer = cv2.VideoWriter('output.avi', fourcc, 30.0, (1280, 720)) # ball tracking class class CBall: ballPosition = {...
mit
Python
fbe270c39a355a62630244aa19c16c74368275f1
add BackupJSON, a BaseJSONMonitor to read the output of a backup script
Audish/sd-agent-plugins
BackupJSON.py
BackupJSON.py
#! /usr/bin/env python # This is a Server Density plugin which reports what it founds in a JSON file created by a backup script. # Author: yaniv.aknin@audish.com import sys assert sys.version_info[0] == 2 and sys.version_info[1] >= 6 or sys.version_info[0] > 2, 'needs Python >= v2.6' from datetime import timedelta f...
mit
Python
27a1632a768028477f54450ccf7aaa7fba8bc428
Initialize P09_countdown
JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials
books/AutomateTheBoringStuffWithPython/Chapter15/P09_countdown.py
books/AutomateTheBoringStuffWithPython/Chapter15/P09_countdown.py
#! python3 # P09_countdown.py - A simple countdown script. # # Note: # - sound file can be downloaded from http://nostarch.com/automatestuff/ import time, subprocess timeLeft = 60 while timeLeft > 0: print(timeLeft, end='') time.sleep(1) timeLeft = timeLeft - 1 # At the end of the countdown, play a sound...
mit
Python
47775471e2e8f0d88cb79d362114b5f49128a492
Add example of factory usage
duboviy/zca
factory/main.py
factory/main.py
import random def get_digit(): return random.randint(1, 9) from zope.component.factory import Factory factory = Factory(get_digit, 'random_digit', 'Gives a random digit') from zope.component import getGlobalSiteManager from zope.component.interfaces import IFactory gsm = getGlobalSiteManager() gsm.registerUt...
mit
Python
49da38f9c3514c8d886e1b6f6b42a29fccaf9e7d
Add split_mdf.py, used for exploring
ajd4096/inject_gba
tools/split_mdf.py
tools/split_mdf.py
#!/bin/env python3 # vim: set fileencoding=latin-1 import sys import binascii import getopt import struct import zlib def write_mdf_section(filename, data): # Write out the raw MDF section open(filename, 'wb').write(data) def split_mdf_file(filename): # Read in the whole file (zelda alldata.bin is 49M) data ...
bsd-2-clause
Python
091c82579d52cba080c0e2f4d5852884815551a1
Create RechercheTD1.py
trinhtuananh/AlgoBioinfo
RechercheTexte/RechercheTD1.py
RechercheTexte/RechercheTD1.py
#!/usr/bin/env python # -*- coding: utf-8 -*- def naif(motif,texte): reponse=[] for i in range (len(texte)): if (motif==texte[i:len(motif)+i]): reponse.append(i) def RK(motif,texte): Lmotif=len(motif) Ltexte=len(texte) motifConverti=conversion(motif) motifConverti=hash(motifConverti,10) for i in rang...
apache-2.0
Python
b9d167cf1eba2d55ab7710e78f38c3fa010d21ef
Change init to add inverse strategy
marcharper/Axelrod,ranjinidas/Axelrod,ranjinidas/Axelrod,marcharper/Axelrod
axelrod/strategies/__init__.py
axelrod/strategies/__init__.py
from cooperator import * from defector import * from grudger import * from rand import * from titfortat import * from gobymajority import * from alternator import * from averagecopier import * from grumpy import * from inverse import * strategies = [ Defector, Cooperator, TitForTat, Gr...
from cooperator import * from defector import * from grudger import * from rand import * from titfortat import * from gobymajority import * from alternator import * from averagecopier import * from grumpy import * strategies = [ Defector, Cooperator, TitForTat, Grudger, GoByMaj...
mit
Python
a15eb286e3235ff627bf9d18a4b4b64845ba00c1
Create Days_Alive.py
kkkkkbruce/MyMiscPiCode
Days_Alive.py
Days_Alive.py
#------------------------------------------------------------------------------- # Name: Days_Alive # Purpose: # # Author: KKKKKBruce # # Created: 13/02/2013 # Copyright: (c) Kevin 2013 # Licence: The MIT License (MIT) #------------------------------------------------------------------------------...
mit
Python
00f0ddced329724ce1b6bf49e86520ce47eaa10a
Add migration for Registry
lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin
src/ansible/migrations/0004_registry.py
src/ansible/migrations/0004_registry.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-05-15 15:28 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('ansible', '0003_auto_20170510_2007'), ] operations...
bsd-3-clause
Python
61c3b4f6a0afb1743faa6b3174f0e15ef8d8c043
add unit tests for the relocate_urls function
camptocamp/c2c.recipe.cssmin,sbrunner/c2c.cssmin
tests/c2c_recipe_cssmin_tests.py
tests/c2c_recipe_cssmin_tests.py
import unittest from c2c.recipe.cssmin.buildout import relocate_urls class TestCssminRecipe(unittest.TestCase): def test_relocate_urls(self): # Same directory: self.assertEqual(relocate_urls("url( 'foo.png')", "/a/b/src.css", "/a/b/dest.css"), "url('foo.png')") # Same directory, relative pa...
mit
Python
4990022a7ee0ee3a99414984f7bc54c1f4fee2f3
Add Python classification template
a-holm/MachinelearningAlgorithms,a-holm/MachinelearningAlgorithms
Classification/classificationTemplate.py
Classification/classificationTemplate.py
# -*- coding: utf-8 -*- """Classification template for machine learning.""" import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.metrics impo...
mit
Python
de5cce3d06f20d21fde766bcb85d128d89df7bf7
add new example for traffic matrix
pupeng/hone,pupeng/hone,bolshoibooze/hone,bolshoibooze/hone,pupeng/hone,bolshoibooze/hone,pupeng/hone,bolshoibooze/hone
Controller/exp_calculateTrafficMatrix.py
Controller/exp_calculateTrafficMatrix.py
# Copyright (c) 2011-2013 Peng Sun. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the COPYRIGHT file. # HONE application # calculate traffic matrix from hone_lib import * import time def TrafficMatrixQuery(): return (Select(['srcIP','srcPort','dstIP','d...
bsd-3-clause
Python
ed2af274741d2227c9e6c3a95dee3672e3acb4cf
Add the disabled two views test.
probcomp/cgpm,probcomp/cgpm
tests/disabled_test_two_views.py
tests/disabled_test_two_views.py
# -*- coding: utf-8 -*- # Copyright (c) 2015-2016 MIT Probabilistic Computing Project # 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 # Unles...
apache-2.0
Python
3c5b1d439748363e755c257d75d25e40585410ca
Create process_reads.py
iandriver/RNA-sequence-tools,idbedead/RNA-sequence-tools,iandriver/RNA-sequence-tools,iandriver/RNA-sequence-tools,idbedead/RNA-sequence-tools,idbedead/RNA-sequence-tools
process_reads.py
process_reads.py
import os from subprocess import call def tophat_and_cuff(path, out= './'): annotation_file = 'path to gtf annotation file' index_gen_loc = 'path to index genome' pathlist = [] for root, dirs, files in os.walk(path): if 'fastq' in root: pathlist.append([root,files]) for p in pathlist: n = p[0]...
mit
Python
054941e5251a6ce9477f2ce5cf0c458a5b7faa34
add tests for zpm.create_project
zerovm/zerovm-cli,zerovm/zerovm-cli,zerovm/zerovm-cli,zerovm/zpm,zerovm/zpm,zerovm/zpm,zerovm/zpm,zerovm/zerovm-cli,zerovm/zpm,zerovm/zerovm-cli,zerovm/zpm,zerovm/zerovm-cli
zpmlib/tests/test_zpm.py
zpmlib/tests/test_zpm.py
# Copyright 2014 Rackspace, 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...
apache-2.0
Python
dcbc9ca37406c1d2f25656e11c8a5ad170acd827
Create Observable feature
PaulieC/sprint1_Council,PaulieC/sprint5-Council,PaulieC/sprint2-Council,PaulieC/rls-c,PaulieC/sprint1_Council_b,PaulieC/sprint1_Council_a,PaulieC/sprint3-Council,geebzter/game-framework
Observable.py
Observable.py
-__author__= 'Dan and Pat' -#Describes an Observable object. -#includes methods to notify all observers -#and to add/delete them - -#abstract class for Observable -class Observable(object): - - #list of all observers - observer_list = [] - - #notify all observers - def notify_all(self, msg): - for o...
apache-2.0
Python
6fb3e783c25b973f7b49cd3f53274a2c11981192
Add js integration tests.
chevah/pocket-lint,chevah/pocket-lint
pocketlint/tests/test_javascript.py
pocketlint/tests/test_javascript.py
# Copyright (C) 2011 - Curtis Hovey <sinzui.is at verizon.net> # This software is licensed under the MIT license (see the file COPYING). from pocketlint.formatcheck import( JavascriptChecker, JS, ) from pocketlint.tests import CheckerTestCase from pocketlint.tests.test_text import TestAnyTextMixin good...
mit
Python
7bc5d0eda2c8cbc2b89b71c2510fe9f0d60dce4f
Add forgotten module 'exceptions'
reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/ActiveDri...
website/exceptions.py
website/exceptions.py
class ValidationError(Exception): pass @property def message(self): return self.args[0]
lgpl-2.1
Python
725ddbb207f2b1f93be4f8c38504cb41c7515009
add logentries integration to diamond handler
saucelabs/Diamond,ramjothikumar/Diamond,python-diamond/Diamond,joel-airspring/Diamond,CYBERBUGJR/Diamond,TinLe/Diamond,janisz/Diamond-1,signalfx/Diamond,krbaker/Diamond,Slach/Diamond,ramjothikumar/Diamond,thardie/Diamond,rtoma/Diamond,Netuitive/netuitive-diamond,bmhatfield/Diamond,codepython/Diamond,russss/Diamond,Ensi...
src/diamond/handler/logentries_diamond.py
src/diamond/handler/logentries_diamond.py
# coding=utf-8 """ [Logentries: Log Management & Analytics Made Easy ](https://logentries.com/). Send Diamond stats to your Logentries Account where you can monitor and alert based on data in real time. #### Dependencies #### Configuration Enable this handler * handers = diamond.handler.logentries.logentriesHandl...
mit
Python
118f412777a2c65763cfa4bd0d45ca197f9865ff
Create andropy.py
ccjj/andropy
andropy.py
andropy.py
import argparser import sys import ConfigClass import createfiles import OnlineNotifierClass import machineClass import apkparse import subprocess import time import thread import threading import adbcommands def create_and_config(a, b, c ,d, e, isrunning): config = ConfigClass.Config(a, b, c, d, e) createfiles.cre...
mit
Python
f86fe6b9d1014c8115d776f7e03353e273142607
Create SubwayFeed.py
dunnette/SubwayTimes,dunnette/st-gae
SubwayFeed.py
SubwayFeed.py
from google.transit import gtfs_realtime_pb2 import urllib import datetime # http://datamine.mta.info/sites/all/files/pdfs/GTFS-Realtime-NYC-Subway%20version%201%20dated%207%20Sep.pdf # http://datamine.mta.info/list-of-feeds class SubwayFeed: endpoint_url = 'http://datamine.mta.info/mta_esi.php' def __in...
apache-2.0
Python
973405a852779f443c8c967a5e23ac40f5a0e4a2
Add 217-contains-duplicate.py
mvj3/leetcode
217-contains-duplicate.py
217-contains-duplicate.py
""" Question: Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct. Performance: 1. Total Accepted: 39720 Total Submissions: 10589...
mit
Python
426f90ba500aa5d213a8b130e1841806e2dae388
Implement roulette wheel selection algorithm
nemanja-m/gaps,nemanja-m/genetic-jigsaw-solver
solver/operators.py
solver/operators.py
import random import bisect def select(population): """Roulette wheel selection. Each individual is selected to reproduce, with probability directly proportional to its fitness score. :params population: Collection of the individuals for selecting. Usage:: >>> from operators import sele...
mit
Python
435f55e8e25f51b9622ece010fa132383bfdfd31
Add Support for /r/wasletztepreis
nsiregar/reddit2telegram,nsiregar/reddit2telegram,Fillll/reddit2telegram,Fillll/reddit2telegram
channels/wasletztepreis/app.py
channels/wasletztepreis/app.py
#encoding:utf-8 from utils import get_url, weighted_random_subreddit from utils import SupplyResult # Subreddit that will be a source of content subreddit = weighted_random_subreddit({ 'wasletztepreis': 1.0, # If we want get content from several subreddits # please provide here 'subreddit': probability ...
mit
Python
bd9641ae4f96fd15e3fe02b969d157e69962308c
Create solution2.py
lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges
leetcode/easy/remove_duplicates_from_sorted_array/py/solution2.py
leetcode/easy/remove_duplicates_from_sorted_array/py/solution2.py
# # The lazybones' approach. In order to eliminate duplicates, conver the array # to a set. Sort the values in the set and assign the sorted array back to "nums". # The [:] subscript operator is important in emulating assignment by reference. # In reality, given no arguments as it is shown in the code, it simply copies...
mit
Python
f09b51df190bcf0d22349de7a09560cb3069f402
Add merge migration
mfraezz/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,Johnetordoff/osf.io,mattclark/osf.io,aaxelb/osf.io,HalcyonChimera/osf.io,saradbowman/osf.io,felliott/osf.io,baylee-d/osf.io,Johnetordoff/osf.io,adlius/osf.io,baylee-d/osf.io,felliott/osf.io,icereval/osf.io,mfraezz/osf.io,cslzchen/osf.io,brianjgeig...
osf/migrations/0107_merge_20180604_1232.py
osf/migrations/0107_merge_20180604_1232.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-06-04 17:32 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0105_merge_20180525_1529'), ('osf', '0106_set_preprint_identifier_category'), ] ...
apache-2.0
Python
31fe72931d29d81088f23c7609aa612d4735814b
Add new sample files for Python3-py grammar
antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4
python3-py/examples/new_features.py
python3-py/examples/new_features.py
def ls(self, msg, match): """ A sample function to test the parsing of ** resolution """ langs = list(map(lambda x: x.lower(), match.group(1).split())) bears = client.list.bears.get().json() bears = [{**{'name': bear}, **content} for bear, content in bears.items()] # Asyncio examp...
mit
Python
95769dcf378dd81d0ccf14cf1f1f380efcb602cd
Create PedidoDeletar.py
AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb
backend/Models/Matricula/PedidoDeletar.py
backend/Models/Matricula/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
2ed7b7b6a1bda9028b93120d410d3c4de850d6fe
Support unicode.
brockwhittaker/zulip,showell/zulip,verma-varsha/zulip,tommyip/zulip,mahim97/zulip,jackrzhang/zulip,tommyip/zulip,rishig/zulip,punchagan/zulip,amanharitsh123/zulip,rishig/zulip,zulip/zulip,rishig/zulip,shubhamdhama/zulip,verma-varsha/zulip,zulip/zulip,verma-varsha/zulip,rht/zulip,andersk/zulip,vabs22/zulip,showell/zulip...
zerver/webhooks/slack/view.py
zerver/webhooks/slack/view.py
from __future__ import absolute_import from django.utils.translation import ugettext as _ from django.http import HttpRequest, HttpResponse from django.utils.translation import ugettext as _ from zerver.lib.actions import check_send_message, create_stream_if_needed from zerver.lib.response import json_success, json_err...
from __future__ import absolute_import from django.utils.translation import ugettext as _ from django.http import HttpRequest, HttpResponse from django.utils.translation import ugettext as _ from zerver.lib.actions import check_send_message, create_stream_if_needed from zerver.lib.response import json_success, json_err...
apache-2.0
Python
2244885111fe505a757abf9bb528b8fd8ad346f6
add rosenbrock task
aaronkl/RoBO,automl/RoBO,aaronkl/RoBO,aaronkl/RoBO,automl/RoBO,numairmansur/RoBO,numairmansur/RoBO
robo/task/synthetic_functions/rosenbrock.py
robo/task/synthetic_functions/rosenbrock.py
import numpy as np from robo.task.base_task import BaseTask class Rosenbrock(BaseTask): def __init__(self, d=3): self.d = d X_lower = np.ones([d]) * -5 X_upper = np.ones([d]) * 10 opt = np.ones([1, d]) fopt = 0.0 super(Rosenbrock, self).__init__(X_lower, X_upper, ...
bsd-3-clause
Python
aa8a0d3ce614a02233d31e97ce91eedc03727394
add determine_endpoint_type helper
globus/globus-cli,globus/globus-cli
src/globus_cli/helpers/endpoint_type.py
src/globus_cli/helpers/endpoint_type.py
from enum import Enum, auto class EndpointType(Enum): # endpoint / collection types GCP = auto() GCSV5_ENDPOINT = auto() GUEST_COLLECTION = auto() MAPPED_COLLECTION = auto() SHARE = auto() NON_GCSV5_ENDPOINT = auto() # most likely GCSv4, but not necessarily def determine_endpoint_type(e...
apache-2.0
Python
c9266bd5cb11fd8f46b6f237f30d698048f88460
Write test for dump_graph
okuta/chainer,jnishi/chainer,ktnyt/chainer,kashif/chainer,wkentaro/chainer,tkerola/chainer,delta2323/chainer,jnishi/chainer,niboshi/chainer,chainer/chainer,jnishi/chainer,hvy/chainer,wkentaro/chainer,okuta/chainer,rezoo/chainer,ktnyt/chainer,chainer/chainer,keisuke-umezawa/chainer,pfnet/chainer,keisuke-umezawa/chainer,...
tests/chainer_tests/training_tests/extensions_tests/test_computational_graph.py
tests/chainer_tests/training_tests/extensions_tests/test_computational_graph.py
import tempfile import os import shutil import unittest import numpy import chainer from chainer import configuration from chainer import functions from chainer import links from chainer import testing from chainer import training from chainer.training.extensions import computational_graph as c class Dataset(chaine...
mit
Python
2b74b894333557ab0aa9054c3d8af6b321d8e85e
Add background extractor
zephinzer/cs4243
background_extractor.py
background_extractor.py
import cv2 import cv2.cv as cv import numpy as np import os def bg_extract(video): cap = cv2.VideoCapture(video) fcount = int(cap.get(cv.CV_CAP_PROP_FRAME_COUNT)) _, img = cap.read() avgImg = np.float32(img) for fr in range(1, fcount): _, img = cap.read() img = np.float32(img) ...
mit
Python
8149048a78ebbcdb46719eab5209e51bdeb3f86d
add new package (#25747)
LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack
var/spack/repos/builtin/packages/py-colorclass/package.py
var/spack/repos/builtin/packages/py-colorclass/package.py
# Copyright 2013-2021 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 PyColorclass(PythonPackage): """Colorful worry-free console applications for Linux, Mac OS...
lgpl-2.1
Python
9264d92444049b3aa2d7acbca27c2082aecac63c
Add a command line interface for bna
jleclanche/python-bna,Adys/python-bna
bin/cli.py
bin/cli.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import bna import keyring import sys from binascii import hexlify, unhexlify SERVICE = "trogdor" def ERROR(txt): sys.stderr.write("Error: %s\n" % (txt)) exit(1) def normalizeSerial(serial): return serial.lower().replace("-", "").strip() def prettifySerial(serial): ...
mit
Python
3aab9ef96c7b8b0c4c48be4cca2d8f8813099110
Make zsh/zpython also call .shutdown correctly
dragon788/powerline,russellb/powerline,keelerm84/powerline,DoctorJellyface/powerline,DoctorJellyface/powerline,areteix/powerline,junix/powerline,bezhermoso/powerline,kenrachynski/powerline,russellb/powerline,blindFS/powerline,EricSB/powerline,wfscheper/powerline,blindFS/powerline,lukw00/powerline,xfumihiro/powerline,be...
powerline/bindings/zsh/__init__.py
powerline/bindings/zsh/__init__.py
# vim:fileencoding=utf-8:noet import zsh import atexit from powerline.shell import ShellPowerline from powerline.lib import parsedotval used_powerlines = [] def shutdown(): for powerline in used_powerlines: powerline.renderer.shutdown() def get_var_config(var): try: return [parsedotval(i) for i in zsh.getva...
# vim:fileencoding=utf-8:noet import zsh from powerline.shell import ShellPowerline from powerline.lib import parsedotval def get_var_config(var): try: return [parsedotval(i) for i in zsh.getvalue(var).items()] except: return None class Args(object): ext = ['shell'] renderer_module = 'zsh_prompt' @propert...
mit
Python
2d562c2642dc874d6734843a18073a1c7feaf066
Add RandomTreesEmbedding for robust clustering
Don86/microscopium,Don86/microscopium,microscopium/microscopium,microscopium/microscopium,jni/microscopium,jni/microscopium,starcalibre/microscopium
husc/cluster.py
husc/cluster.py
from sklearn.ensemble import RandomTreesEmbedding def rt_embedding(X, n_estimators=100, max_depth=10, n_jobs=-1, **kwargs): """Embed data matrix X in a random forest. Parameters ---------- X : array, shape (n_samples, n_features) The data matrix. n_estimators : int, optional The nu...
bsd-3-clause
Python
af1262d175e2a3b2371df77685483c8e5074d90e
Create most-wanted-letter.py
Pouf/CodingCompetition,Pouf/CodingCompetition
CiO/most-wanted-letter.py
CiO/most-wanted-letter.py
def checkio(l): l = sorted(l.lower()) return max(filter(str.isalpha, l), key=l.count)
mit
Python
fac97130396057802f1ebf21928667a971395ba9
Add a basic example of the Tabler API.
bschmeck/tabler
examples/ex_tabler.py
examples/ex_tabler.py
from tabler import Tabler table = """<table> <thead> <tr> <th>Number</th> <th>First Name</th> <th>Last Name</th> <th>Phone Number</th> </tr> <tr> <td>1</td> <td>Bob</td> <td>Evans</td> <td>(847) 332-0461</td> </tr> <tr> <td>2</td> <td>Mary</td> <td>Newell</td> ...
bsd-3-clause
Python
e279f8a046d2d9b985df2b01abe23dbe154da188
Add a simple test for version finder.
punchagan/cinspect,punchagan/cinspect
cinspect/tests/test_version.py
cinspect/tests/test_version.py
from __future__ import absolute_import, print_function # Standard library import unittest # Local library from cinspect.index.serialize import _get_most_similar class TestVersions(unittest.TestCase): def test_most_similar(self): # Given names = ['index-2.7.3.json', 'index-3.4.json'] ver...
bsd-3-clause
Python
43d3d0351df4be3354519a6e5b7e1f630d5ede74
Add testjars.py to tools - tests jars in plugins/ directory for CraftBukkit dependencies. Requires Solum (https://github.com/TkTech/Solum).
jimmikaelkael/GlowstonePlusPlus,keke142/GlowstonePlusPlus,keke142/GlowstonePlusPlus,Postremus/GlowstonePlusPlus,Tonodus/GlowSponge,kukrimate/Glowstone,GlowstoneMC/GlowstonePlusPlus,GreenBeard/GlowstonePlusPlus,karlthepagan/Glowstone,jimmikaelkael/GlowstonePlusPlus,Tonodus/GlowSponge,LukBukkit/GlowstonePlusPlus,BlazePow...
etc/tools/testjars.py
etc/tools/testjars.py
# testjars.py # # Scans all .jar files in plugins/ directory of current # WD for dependencies on CraftBukkit-only methods and # classes (org.bukkit.craftbukkit and net.minecraft). # Prints SAFE if no dependencies are found, or UNSAFE # if the plugin requires CraftBukkit. # # Requires Solum (https://github.com/TkTech/So...
mit
Python
fcbfaded67747984899dbbabb2cdcdefe00002df
Add example script for 'simpleflow.download.with_binaries' decorator
botify-labs/simpleflow,botify-labs/simpleflow
examples/download1.py
examples/download1.py
import subprocess from simpleflow.download import with_binaries @with_binaries({ "how-is-simpleflow": "s3://botify-labs-simpleflow/binaries/latest/how_is_simpleflow", }) def a_task(): print "command: which how-is-simpleflow" print subprocess.check_output(["which", "how-is-simpleflow"]) print "comman...
mit
Python
1904e1987114d9c57602b5c1fdb41a8725cdb090
Add LED dance example
JoeGlancy/micropython,JoeGlancy/micropython,JoeGlancy/micropython
examples/led_dance.py
examples/led_dance.py
# Light LEDs at random and make them fade over time # # Usage: # # led_dance(delay) # # 'delay' is the time between each new LED being turned on. # # TODO The random number generator is not great. Perhaps the accelerometer # or compass could be used to add entropy. import microbit def led_dance(delay): dots = ...
mit
Python
7e90e76c0fed3abeb5c163b96ac203b251ab5b81
Add functions to simplify graphs.
musec/py-cdg
cgnet/simplify.py
cgnet/simplify.py
import networkx as nx def is_simple_node( graph, node ): """A node is "Simple" if none of the following is true - it has multiple inputs (it joins chains together) - it has no inputs (it's a root node) - it has multiple outputs (it splits chains apart) - it has no outputs (it's a leaf node) Ke...
apache-2.0
Python
e840a73991cde9d291aa61989d8b59d07fe949f2
add ressource tree entry point
NaturalSolutions/NsPortal,NaturalSolutions/NsPortal,NaturalSolutions/NsPortal
Back/ns_portal/routes/__init__.py
Back/ns_portal/routes/__init__.py
from ns_portal.resources import root_factory def includeme(config): ''' every resources or actions in this API will start by this object be careful if you try to mix urlDispatch and traversal algorithm keep it in mind ''' config.set_root_factory(root_factory) config.add_static_view('static...
mit
Python
665f53c2b91ca974a6ee2f3ac4c494e9543af3cd
Add test for 0 version txs
qtumproject/qtum,qtumproject/qtum,qtumproject/qtum,qtumproject/qtum,qtumproject/qtum,qtumproject/qtum,qtumproject/qtum
qa/rpc-tests/qtum-no-exec-call-disabled.py
qa/rpc-tests/qtum-no-exec-call-disabled.py
#!/usr/bin/env python3 from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from test_framework.script import * from test_framework.mininode import * from test_framework.address import * from test_framework.qtum import * from test_framework.blocktools import * import sys imp...
mit
Python
639143e3145682d776251f39f0a791f0c77e5169
ADD Domain association_requests unit tests
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
apps/domain/tests/test_routes/test_association_requests.py
apps/domain/tests/test_routes/test_association_requests.py
def test_send_association_request(client): result = client.post("/association-requests/request", data={"id": "54623156", "address": "159.15.223.162"}) assert result.status_code == 200 assert result.get_json() == {"msg": "Association request sent!"} def test_receive_association_request(client): result ...
apache-2.0
Python
576d4090cb087a60c3a996430fef5b1550798e6c
Create mean_vol.py
algoix/blog
mean_vol.py
mean_vol.py
"""Compute mean volume""" import pandas as pd def get_mean_volume(symbol): """Return the mean volume for stock indicated by symbol. Note: Data for a stock is stored in file: data/<symbol>.csv """ df = pd.read_csv("data/{}.csv".format(symbol)) # read in data #Compute and return the mean volum...
mit
Python
1d7d86ba12fd00d388b939206abf305a6db569db
Add trainer for siamese models
Flowerfan524/TriClustering,Flowerfan524/TriClustering,zydou/open-reid,Cysu/open-reid
reid/train_siamese.py
reid/train_siamese.py
from __future__ import print_function import time from torch.autograd import Variable from .evaluation import accuracy from .utils.meters import AverageMeter class Trainer(object): def __init__(self, model, criterion, args): super(Trainer, self).__init__() self.model = model self.criteri...
mit
Python
34be87320de5d5d10e55e8c91506dee230afb1b6
Add cli menu
HugoPouliquen/lzw-tools
menu_cli.py
menu_cli.py
# -*- coding: utf-8 -*- import curses def init_curses(): stdsrc = curses.initscr() curses.noecho() curses.cbreak() stdsrc.keypad(1) return stdsrc def close_curses(stdsrc): stdsrc.keypad(0) curses.nocbreak() curses.echo() curses.endwin() def init_colors(): curses.start_colo...
mit
Python
3f92a621c35d84c4d1dffd3333e015cb5ca8c0d8
add osvReader.py
buguen/pyosv
src/osvReader.py
src/osvReader.py
from OCC.STEPControl import STEPControl_Reader from OCC.IFSelect import IFSelect_RetDone, IFSelect_ItemsByEntity from OCC.Display.SimpleGui import init_display step_reader = STEPControl_Reader() status = step_reader.ReadFile('./TABBY_EVO_step_asm.stp') if status == IFSelect_RetDone: # check status failsonly = ...
mit
Python
dec97d72f034826ec88de6de1609bb19bb2a410f
test file commit
mir-cat/BST234-FP,mir-cat/BST234-FP
just_for_git.py
just_for_git.py
# -*- coding: utf-8 -*- """ Created on Fri Apr 21 11:25:45 2017 @author: Katharine """
mit
Python
528afdc0f00b958f6920bd6e66c3bac841b3a8b8
Add a test for mission.
kcaa/kcaa,kcaa/kcaa,kcaa/kcaa,kcaa/kcaa
server/kcaa/kcsapi/mission_test.py
server/kcaa/kcsapi/mission_test.py
#!/usr/bin/env python import pytest import mission class TestMissionList(object): def pytest_funcarg__mission_list(self): mission_list = mission.MissionList() mission_list.missions.extend([ mission.Mission( id=1, name=u'Mission1', mapa...
apache-2.0
Python
cba6fbf305beb3cb1c90c071339822a9f7ee7179
Create __init__.py
seedinvest/base-crm-api-client
base_api/__init__.py
base_api/__init__.py
apache-2.0
Python
38e294e7d8e8053ac604fdbcdcaeed59fecae1e9
Test libewf-less calls in ewf module
akaIDIOT/Digestive
tests/test_ewf.py
tests/test_ewf.py
from os import path from digestive.ewf import EWFSource, format_supported, list_ewf_files here = path.dirname(path.abspath(__file__)) def test_format_supported(): supported = ['file.S01', 'file.E01', 'file.e01', 'file.L01', 'file.Ex01', 'file.Lx01', 'file.tar.E01'] not_supported = ['file.dd', 'file.raw', '...
isc
Python
fbc375a51aca560554f3dd28fa212d6d877449f2
Add tests for observers and observable.
VISTAS-IVES/pyvistas
source/tests/core/test_observer.py
source/tests/core/test_observer.py
from copy import copy from pytest import fixture from vistas.core.observers.interface import * @fixture(scope='session') def observer(): class TestObserver(Observer): def __init__(self): self.x = 5 def update(self, observable): self.x **= 2 obs = TestObserver() yi...
bsd-3-clause
Python
3c5116f3a26fb93ab85fd973462a582a0fa5d877
Add script to validate web/db/handlerpresets.json file
nkapu/handlers,ouspg/urlhandlers,ouspg/urlhandlers,nkapu/handlers,nkapu/handlers,nkapu/handlers,ouspg/urlhandlers,ouspg/urlhandlers
bin/validate-presets.py
bin/validate-presets.py
#!/usr/bin/python import json import sys def validate_presets(presets_file): with open(presets_file) as jsonfile: presets_dict = json.load(jsonfile) for handler in presets_dict.iterkeys(): for entry in presets_dict.get(handler).get("presets"): value = entry.get("value") ...
mit
Python
35bc8d1d262d658dc1d75d20cc46f853245c4d2f
Add test
comandrei/celery-janitor
celery_janitor/tests.py
celery_janitor/tests.py
import unittest import mock from celery_janitor.utils import Config class ConfigTest(unittest.TestCase): @mock.patch('celery_janitor.utils.conf.BROKER_URL', 'sqs://aws_access_key_id:aws_secret@') def test_sqs_backend(self): self.config = Config() backend = self.config.get_backend() ...
mit
Python
61b91f6541457834f6442a44d7e3f97630be931b
Split the passwords off to a seperate file
c00w/bitHopper,c00w/bitHopper
password.py
password.py
#SET THESE bclc_user = "FSkyvM" bclc_pass = "xndzEU" mtred_user = 'scarium' mtred_pass = 'x' eligius_address = '1AofHmwVef5QkamCW6KqiD4cRqEcq5U7hZ' btcguild_user = 'c00w_test' btcguild_pass = '1234' bitclockers_user = 'flargle' bitclockers_pass = 'x' mineco_user = 'c00w.test' mineco_pass = 'x' #REALLY
mit
Python
a840ca18158d63e0359d7316354e9833e0608712
Add __init__.py
Geosyntec/gisutils,phobson/gisutils
Mapping/__init__.py
Mapping/__init__.py
'''Initialization File so that modules in this directory are accessible to outside modules'''
bsd-3-clause
Python
b1a8c5d05fcc6bde19f7159d88f46da3fbadff6f
Add sub /r/arma
Fillll/reddit2telegram,Fillll/reddit2telegram
channels/arma/app.py
channels/arma/app.py
#encoding:utf-8 from utils import get_url, weighted_random_subreddit from utils import SupplyResult # Subreddit that will be a source of content subreddit = weighted_random_subreddit({ 'arma': 1.0, # If we want get content from several subreddits # please provide here 'subreddit': probability # 'any_...
mit
Python
3a5e1b80a2d2242bee4e0ba524fc91883e131088
Add Closure pattern
jackaljack/design-patterns
closure.py
closure.py
"""Closure pattern A closure is a record storing a function together with an environment. """ def outer(x): def inner(y): return x + y return inner def outer2(x): def inner2(y, x=x): return x + y return inner2 def main(): # inner is defined in the local scope of outer, so we c...
mit
Python
d3d813ca174924e2424bdafcb613aace8b7a5324
Create publicip.py
liorvh/pythonpentest,liorvh/pythonpentest,funkandwagnalls/pythonpentest,funkandwagnalls/pythonpentest,funkandwagnalls/pythonpentest,liorvh/pythonpentest
publicip.py
publicip.py
#!/usr/bin/env python # Author: Christopher Duffy # Date: February 2, 2015 # Purpose: To grab your current public IP address import urllib2 def get_public_ip(request_target): grabber = urllib2.build_opener() grabber.addheaders = [('User-agent','Mozilla/5.0')] try: public_ip_address = grabber.open(...
bsd-3-clause
Python
00a545e9ddc53ed99da59bdb99db728ff448fde4
Add proof-of-concept implementation.
mbr/wrimg
wr.py
wr.py
#!/usr/bin/env python import os import sys import time source = '/dev/zero' dest = '/dev/sdg' min_chunk_size = 4 * 1024 chunk_size = min_chunk_size max_chunk_size = min_chunk_size * 1024 * 4 adaptive = True total = 4 * 10 * 1024 * 1024 with open(source, 'rb') as src, open(dest, 'wb') as dst: while total: ...
mit
Python
1c7e7be7132c3495802a066bc81fe63286b029cb
add 155
wait4pumpkin/leetcode,wait4pumpkin/leetcode
155.py
155.py
class MinStack: def __init__(self): """ initialize your data structure here. """ self.data = [] self.minVals = [] def push(self, x): """ :type x: int :rtype: void """ self.data.append(x) if self.minVals: self.m...
mit
Python
24b6126871a5378faa2e8f9848c279999e50cb96
Check issue numbers to find out of order listings
xchewtoyx/comicmgt,xchewtoyx/comicmgt
ooo.py
ooo.py
#!/usr/bin/python import os import sys import re from collections import defaultdict COMIC_RE = re.compile(r'^\d+ +([^#]+)#(\d+)') def lines(todofile): with open(todofile) as todolines: for line in todolines: title_match = COMIC_RE.match(line) if title_match: # (title, issue) yield ...
mit
Python
aaa64ca93372c8b9d534636482a2c6349b11b757
Add run.py
illumenati/duwamish-sensor,tipsqueal/duwamish-sensor
run.py
run.py
import serial import threading print('Starting server...') temperature_usb = '/dev/ttyAMA0' BAUD_RATE = 9600 temperature_ser = ser.Serial(temperature_usb, BAUD_RATE) def process_line(line): print('Need to process line: {}'.format(line)) def temperature_loop(): while True: data = ser.read() if(data == "\r"): ...
mit
Python
c2cc91621535d121d2188f7e391f6c52728eeba1
Create run.py for uwsgi setup
spoonref/haiku,spoonref/haiku,spoonref/litbit,spoonref/haiku,spoonref/haiku,spoonref/litbit,spoonref/haiku
run.py
run.py
from index import app if __name__ == "name" app.run()
mit
Python