commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
76fe998ad769e97b3424f2a3b8a5cccf2496816f
add very rudimentary/prototype range splitter program, without robust input checking
rangesplitter.py
rangesplitter.py
#! /usr/bin/env python3.4 import ipaddress import math toSplit=False while not toSplit: inputRange = input('Input the IP range you would like to split into subranges: ') try: toSplit =ipaddress.ip_network(inputRange) except: ValueError rangeSize = False default = False while (not rangeSize and not default): ...
Python
0
b2661e8156f9a4e96cce3cc720563b1589037ad5
Add frequency_estimator.py
mhealthx/extractors/frequency_estimator.py
mhealthx/extractors/frequency_estimator.py
#!/usr/bin/env python """ This program implements some of the frequency estimation functions from: https://gist.github.com/endolith/255291 and https://github.com/endolith/waveform-analyzer """ def freq_from_autocorr(signal, fs): """ Estimate frequency using autocorrelation. Pros: Best method for finding ...
Python
0.998838
92c5570889f3880ffc394d528eaaa2942a383414
test for publishing a granule from a tomato
ion/services/sa/test/test_granule_publish.py
ion/services/sa/test/test_granule_publish.py
from pyon.util.int_test import IonIntegrationTestCase from pyon.util.context import LocalContextMixin from pyon.public import RT, LCS, PRED from pyon.public import Container, log, IonObject from interface.services.coi.iresource_registry_service import ResourceRegistryServiceClient from interface.services.dm.ipubsub_...
Python
0.000001
2ac858bad9c3601aaa0c56c78b2a70e3877ff241
create test against husconet with median 5.
interpolation/interpolate_test_against_husconet_median_5.py
interpolation/interpolate_test_against_husconet_median_5.py
""" Run demo with python3 -m interpolation.interpolate_test_against_husconet_median_5 interpolate.py """ import datetime import logging import itertools import sys import os import random import numpy import pandas from filter_weather_data.filters import StationRepository as CrowdsoucingStationRepository from gathe...
Python
0
d2a80a76fdf28625ad36b2fd71af56938b9b9506
Add needed track known class.
src/trackknown.py
src/trackknown.py
#!/usr/bin/env python ''' @author jstober Simple class to track knowledge of states and actions. Based on L. Li, M. L. Littman, and C. R. Mansley, “Online exploration in least-squares policy iteration” AAMAS, 2009. ''' import numpy as np import pdb class TrackKnown: """ Track knowledge of states and action...
Python
0
5dfa4397a282ddbafb57d990bc7d630fb6f927de
Add helper method for execute a commands
build.py
build.py
"""Update conda packages on binstars with latest versions""" import os import six import subprocess import time ATTEMPTS = 3 RETRY_INTERVAL = 0.1 def execute(command, **kwargs): """Helper method to shell out and execute a command through subprocess. :param attempts: How many times to retry running th...
Python
0.000006
387758ebcc2a0fa29e9e7744eacc6c753ae5284e
add example for FIFOQueue and coordinate application
TF-Demo/QueueRunnerDemo/queue_runner_demo.py
TF-Demo/QueueRunnerDemo/queue_runner_demo.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Author: violinsolo # Created on 12/12/2017 import tensorflow as tf # define FIFO queue q = tf.FIFOQueue(capacity=1000, dtypes='float32') # define ops counter = tf.Variable(initial_value=0, dtype='float32') counter_increment_op = tf.assign_add(counter, 1.) queue_enqueue_op...
Python
0
20b2e70fe732b6f0cc049d18da9cac717cd7e967
Remove groups from admin
polyaxon/db/admin/groups.py
polyaxon/db/admin/groups.py
from django.contrib import admin from django.contrib.auth.models import Group admin.site.unregister(Group)
Python
0
4a7fc9efce33bba3aa9ea818d09f6e9b621ab152
add script to pull out contacts csv
portality/migrate/emails.py
portality/migrate/emails.py
from portality.models import Account import csv OUT = "emails.csv" f = open(OUT, "wb") writer = csv.writer(f) writer.writerow(["ID", "Name", "Journal Count", "Email"]) for a in Account.iterall(): id = a.id name = a.name count = len(a.journal) if a.journal is not None else 0 email = a.email if nam...
Python
0
9639ab62ed0f6e0c5229be9820a9b902e5870a67
update readme and make command line script
scripts/dianon.py
scripts/dianon.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import dicom import sys if __name__ == "__main__": #pragma nocover from dianonymous.dianonymous import anonymize parser = argparse.ArgumentParser(description="Anonymize DICOM files") parser.add_argument( '-r', '--recurse', defa...
Python
0
38a1039a427d73ad959cc978d44fcf8c21388868
Add code generation script for _mesa_create_exec_table().
src/mapi/glapi/gen/gl_genexec.py
src/mapi/glapi/gen/gl_genexec.py
#!/usr/bin/env python # Copyright (C) 2012 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, mo...
Python
0.999996
bd371ecbd2ac163e44f104a775390b2ca2b88d35
Add migration for index on departement
migrations/versions/75704b2e975e_add_index_on_departement_for_numero.py
migrations/versions/75704b2e975e_add_index_on_departement_for_numero.py
"""Add index on Departement for numero Revision ID: 75704b2e975e Revises: 34c2049aaee2 Create Date: 2019-10-22 17:27:10.925104 """ # revision identifiers, used by Alembic. revision = '75704b2e975e' down_revision = '34c2049aaee2' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgres...
Python
0
70428a920ae9e02820e63e7dba98fc16faab6f10
add benchmark for linalg.logm
benchmarks/benchmarks/linalg_logm.py
benchmarks/benchmarks/linalg_logm.py
""" Benchmark linalg.logm for various blocksizes. """ import numpy as np try: import scipy.linalg except ImportError: pass from .common import Benchmark class Logm(Benchmark): params = [ ['float64', 'complex128'], [64, 256], ['gen', 'her', 'pos'] ] param_names = ['dtype'...
Python
0.000001
4be38d1f523696a48333797cbdb4a99a874a9cd5
Create albumCoverFinder.py
albumCoverFinder.py
albumCoverFinder.py
# albumCoverFinder - Brian Tran, btran29@gmail.com # This program scans a tree of directories containing mp3 files. For # each directory, it attempts to download the cover image from the # Apple iTunes service. Subdirectories must be named <Artist>/<Album> # contain .mp3 files to be considered. The cover will be saved...
Python
0
e7e37e9b1fd56d18711299065d6f421c1cb28bac
Add some Feed test cases
moksha/tests/test_feed.py
moksha/tests/test_feed.py
from tw.api import Widget from moksha.feed import Feed class TestFeed(object): def test_feed_subclassing(self): class MyFeed(Feed): url = 'http://lewk.org/rss' feed = MyFeed() assert feed.url == 'http://lewk.org/rss' assert feed.num_entries() > 0 for entry in fe...
Python
0
d308695c79face90ba7f908230edb5e2e2437cbd
Decrypt file using XOR
tools/xor_decryptor.py
tools/xor_decryptor.py
#! /usr/bin/env python3 import sys import os from ctypes import c_ubyte keys = [0xd1, 0x73, 0x52, 0xf6, 0xd2, 0x9a, 0xcb, 0x27, 0x3e, 0xaf, 0x59, 0x31, 0x37, 0xb3, 0xe7, 0xa2] initial_key = 0x5e delta_key = 0x3d if __name__ == '__main__': for path in sys.argv[1:]: if os.path.isfile(path): wi...
Python
0.000003
7a02f383986f347d208f69ba59526d9ce7df59bf
Add access grant functions
access.py
access.py
# # access.py # # functions for dealing with access to Discord bot commands # def grant_user_access(user, commandclass): new_grant = CommandClassAccess(user_id = user.id, command_class_id = commandclass.id) session.add(new_grant) session.commit() def grant_role_access(role, commandclass): new_grant = CommandClas...
Python
0
c4001a95dee88bc98eda5ce67a2f14485f4e85a5
Add configurations
configurations/initial.py
configurations/initial.py
#TODO: add code
Python
0.000003
9666a0d60eeb6954bae0c02300110a6772998859
Fix connection-refused error handling
ssbench/worker.py
ssbench/worker.py
import re import socket import time import yaml from ssbench.constants import * from swift.common import client class Worker: MAX_RETRIES = 10 def __init__(self, queue): queue.use(STATS_TUBE) self.queue = queue def go(self): job = self.queue.reserve() while job: ...
import re import time import yaml from ssbench.constants import * from swift.common import client class Worker: MAX_RETRIES = 10 def __init__(self, queue): queue.use(STATS_TUBE) self.queue = queue def go(self): job = self.queue.reserve() while job: job.delete(...
Python
0.000001
226cf36e4b4d069a920785b492804b78eebc34a5
Make non-commtrack location types administrative
corehq/apps/locations/management/commands/migrate_admin_status.py
corehq/apps/locations/management/commands/migrate_admin_status.py
# One-off migration from 2016-04-04 from optparse import make_option from time import sleep from django.core.management.base import BaseCommand from corehq.apps.locations.models import LocationType, SQLLocation from corehq.apps.es import DomainES from corehq.util.log import with_progress_bar def get_affected_location...
Python
0.000313
15d4a5347120110980a0f293fdf05550fca495ed
Add tests and clean up old ones for gutting
blaze/compute/tests/test_sparksql.py
blaze/compute/tests/test_sparksql.py
from __future__ import absolute_import, print_function, division import os import pytest xfail = pytest.mark.xfail pytest.importorskip('pyspark') pytest.importorskip('pyspark.sql') sa = pytest.importorskip('sqlalchemy') import pandas as pd from datashape.predicates import iscollection from datashape import dshape f...
Python
0
be2ac14fbb228e5a5addd393867b9b3c7267ba89
Add and define string_permu_check problem.
pyexp/string_permu_check.py
pyexp/string_permu_check.py
'''Module to solve the algoritm question: Given a string S, how to count how many permutations of S is in a longer string L, assuming, of course, that permutations of S must be in contagious blocks in L. I will solve it in O(len(L)) time. '''
Python
0
a59682d4b8bd4f594dce72b0f86f2ed4096c4178
Add missing migration file
akvo/rsr/migrations/0127_auto_20180529_0955.py
akvo/rsr/migrations/0127_auto_20180529_0955.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import akvo.rsr.fields class Migration(migrations.Migration): dependencies = [ ('rsr', '0126_auto_20180320_1252'), ] operations = [ migrations.AlterField( model_name='rep...
Python
0
4322ca998fadbd0e380626b895415bf75c4f7214
change ordering on ability levels
editor/migrations/0043_auto_20160303_1138.py
editor/migrations/0043_auto_20160303_1138.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('editor', '0042_remove_comment_date'), ] operations = [ migrations.AlterModelOptions( name='abilitylevel', ...
Python
0
774b0b3d11aaf3fd529f95233eb13e87829802f7
create catalog script written
gnowsys-ndf/gnowsys_ndf/ndf/management/commands/create_catalog.py
gnowsys-ndf/gnowsys_ndf/ndf/management/commands/create_catalog.py
import subprocess from django.core.management.base import BaseCommand, CommandError from gnowsys_ndf.factory_type import * from gnowsys_ndf.ndf.models import * class Command(BaseCommand): def handle(self,*args,**options): #print factory_attribute_types GSystemTypeList = [i['name'] for i in factory_gsystem_typ...
Python
0
65d7e81510980d85af5b52504e6d98e45943cc36
Create getdata.py
python_flask/public_html/nuotiovahti/nuotiovahti/getdata.py
python_flask/public_html/nuotiovahti/nuotiovahti/getdata.py
import paho.mqtt.client as mqtt import mysql.connector from flask import Flask, jsonify, json, request app = Flask(__name__) app.route("/") with app.app_context(): def fetchfrombase(): try: cnx = mysql.connector.connect(option_files='/home/mint/connectors.cnf') except mysql.connector.Error as err: ...
Python
0.000002
26fcd91313b15ee2426aec36817a3f29734f4b93
add diagonal gaussian demo
examples/demo-diaggaussian.py
examples/demo-diaggaussian.py
from __future__ import division import numpy as np np.seterr(invalid='raise') from matplotlib import pyplot as plt import copy from pybasicbayes import models, distributions from pybasicbayes.util.text import progprint_xrange alpha_0=5.0 obs_hypparams=dict( mu_0=np.zeros(2), alphas_0=2*np.ones(2), ...
Python
0.000008
f48535102b6f71ba802e9b656c73cdd3ec746a3b
Add the test_repeat_layer.py
python/paddle/trainer_config_helpers/tests/configs/test_repeat_layer.py
python/paddle/trainer_config_helpers/tests/configs/test_repeat_layer.py
from paddle.trainer_config_helpers import * settings(batch_size=1000, learning_rate=1e-5) din = data_layer(name='data', size=30) outputs( repeat_layer( input=din, num_repeats=10, as_row_vector=True), repeat_layer( input=din, num_repeats=10, act=TanhActivation(), as_row_vector=False))
Python
0.00104
aa5c8164b26c388b6a3a1efe8ea402a63a1c7ae8
add migrations file
django_db_meter/migrations/0003_testmodel.py
django_db_meter/migrations/0003_testmodel.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('django_db_meter', '0002_appwiseaggregated...
Python
0.000001
4db578f728a1eeda337f642513c57814fa9ec855
create module to save script to s3 bucket
session2s3.py
session2s3.py
""" Save session to S3 bucket. Ex: ses2s3.workspace_to_s3('my-project-script') """ from datetime import datetime import re import boto3 import dill def session_to_s3(prefix, bucket_name, timestamp=True): """Save session to S3 bucket. Login via ~/.aws/credentials as per boto3.""" if timestamp: now_str = str(da...
Python
0
a6ac0949b32e8e02d26fe0eff159fd057c11c8e2
rename test_shore.py in test_shore_odf.py
dipy/reconst/tests/test_shore_odf.py
dipy/reconst/tests/test_shore_odf.py
import numpy as np from dipy.data import get_data, two_shells_voxels, three_shells_voxels, get_sphere from dipy.data.fetcher import (fetch_isbi2013_2shell, read_isbi2013_2shell, fetch_sherbrooke_3shell, read_sherbrooke_3shell) from dipy.reconst.shore import ShoreModel from dipy.recon...
Python
0.004674
76ac913fc0862421b7e4ef1f32994c8084a21f86
Add influx component
homeassistant/components/influx.py
homeassistant/components/influx.py
""" homeassistant.components.influx ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ InfluxDB component which allows you to send data to an Influx database. For more details about this component, please refer to the documentation at https://home-assistant.io/components/influx/ Configuration: influx: host: localhost port: 8086 ...
Python
0.000001
730c8bf23dbd687b3070eae58378ebcccf523736
add 'split' filter
filter_plugins/split.py
filter_plugins/split.py
class FilterModule(object): ''' A comment ''' def filters(self): return { 'split': self.split, } def split(self, input_value, separator): return input_value.split(separator)
Python
0.000009
938a6fabbc67feb409f6874966b30cb5c3e927a6
Create myotpsecrets.py
app/myotpsecrets.py
app/myotpsecrets.py
ttp_user = 'admin' http_pass = 'admin' codes = { 'account1': 'pefjehegNusherewSunaumIcwoafIfyi', 'account2': 'memJarrIfomWeykvajLyutIkJeafcoyt', 'account3': 'rieshjaynEgDoipEjkecPopHiWighath', }
Python
0.000015
eb396c12cccbda03a46381b5a54ff55d8f876152
Fix NameError
vdirsyncer/__init__.py
vdirsyncer/__init__.py
# -*- coding: utf-8 -*- ''' vdirsyncer is a synchronization tool for vdir. See the README for more details. ''' from __future__ import print_function PROJECT_HOME = 'https://github.com/untitaker/vdirsyncer' DOCS_HOME = 'https://vdirsyncer.readthedocs.org/en/stable' try: from .version import version as __version_...
# -*- coding: utf-8 -*- ''' vdirsyncer is a synchronization tool for vdir. See the README for more details. ''' from __future__ import print_function try: from .version import version as __version__ # noqa except ImportError: # pragma: no cover raise ImportError( 'Failed to find (autogenerated) vers...
Python
0
6d10af076e65189f76f5d0a8d2b691eba0ccdd55
Add unit tests for LinkCollection
panoptes_client/tests/test_linkcollection.py
panoptes_client/tests/test_linkcollection.py
from __future__ import absolute_import, division, print_function import unittest import sys if sys.version_info <= (3, 0): from mock import Mock, patch else: from unittest.mock import Mock, patch from panoptes_client.panoptes import LinkCollection LINKED_OBJECT_IDS = ('1','2','3','4') class MockPanoptesO...
Python
0
0e3711000bcf7d59f75baa68f357f49f5246f812
Add video capturing functionality
humblemedia/resources/utils/video_capture.py
humblemedia/resources/utils/video_capture.py
import subprocess import re def get_video_duration(filename): # returns duration in seconds command = 'ffmpeg -i %s 2>&1 | grep "Duration"' % filename result = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) stdout_lines = result.stdout.readlines() du...
Python
0
63d900d6c68d0f744b921a5f5005f1e6bbc95fb9
Create dataStoring.py
dataStoring.py
dataStoring.py
__author__ = 'Salvatore Cassano' from pydblite.pydblite import Base from items import SapItem import re class DataStoring(): #Inizialize an instantiated object by opening json file and the database def __init__(self): self.out_file = open("abap.json", "a") self.out_file.close() self.d...
Python
0.000001
ff63bb34aaf01cd9cd7eff89c0c94135f896640f
Create mqtt_easydriver_stepper.py
linkit/easydriver/mqtt_easydriver_stepper.py
linkit/easydriver/mqtt_easydriver_stepper.py
import paho.mqtt.client as mqtt import json, time import mraa pin19 = mraa.Pwm(19) pin0 = mraa.Gpio(0) pin0.dir(mraa.DIR_OUT) # ----- CHANGE THESE FOR YOUR SETUP ----- MQTT_HOST = "190.97.168.236" MQTT_PORT = 1883 def on_connect(client, userdata, rc): print("\nConnected with result code " + str(rc) + "\n") ...
Python
0.000002
c89ffbc61f8cf1e3d872dcd45f67ba94be944cbb
add an alternative to date parsing
samples/date_alternative.py
samples/date_alternative.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import time from bacpypes.primitivedata import Tag, Atomic _mm = r'(?P<month>0?\d|1[0-4]|odd|even|255|[*])' _dd = r'(?P<day>[0-3]?\d|last|odd|even|255|[*])' _yy = r'(?P<year>\d{2}|255|[*])' _yyyy = r'(?P<year>\d{4}|255|[*])' _dow = r'(?P<dow>[1-7]|mon|tue|wed|t...
Python
0.000004
2ae6f4183b2096287f8155d7db7e2ed0444618c4
Add first version of Day One entry splitter
day_one_entry_splitter.py
day_one_entry_splitter.py
#!/usr/bin/env python # encoding: utf-8 """ day_one_entry_splitter.py Created by Rod Docking on 2017-01-01. All rights reserved. """ import sys def main(): """Split entries from Day One export into separate files""" # Entry headers look like: # "Date: February 14, 2005 at 9:00 AM" # Need to: # ...
Python
0
87e590c56a68871b1430d71704f303d38fc19e61
Generate Pascal Triangle
PascalsTriangle.py
PascalsTriangle.py
#!/usr/bin/env python # HanoiMoves.py # Author: Lijuan Marissa Zhou # CreatedAt: 10/10/2014 """Interesting play with Pascals Triangle Problem in Python.""" class PascalsTriangle: """ Class of PascalsTriangle """ def __init__(self): self.data = [] def generate(self, n): """ ...
Python
0.999999
d73070f268e240439c71ffd193a18c477403dd2e
Add project model class
clowder/project.py
clowder/project.py
import argparse import sys class Project(object): def __init__(self, name, path, url): self.name = name self.path = path self.url = url
Python
0
dd708956ed19a38be09597cae94172e0b9863623
Add signing thanks @jmcarp
waterbutler/signing.py
waterbutler/signing.py
# encoding: utf-8 import hmac import json import base64 import collections from waterbutler import settings # Written by @jmcarp originally def order_recursive(data): """Recursively sort keys of input data and all its nested dictionaries. Used to ensure consistent ordering of JSON payloads. """ if i...
Python
0
553624fcd4d7e8a4c561b182967291a1cc44ade9
Add algorithm for Casimir Effect (#7141)
physics/casimir_effect.py
physics/casimir_effect.py
""" Title : Finding the value of magnitude of either the Casimir force, the surface area of one of the plates or distance between the plates provided that the other two parameters are given. Description : In quantum field theory, the Casimir effect is a physical force acting on the macroscopic boundaries of a confined...
Python
0
cad438214ec55684bfc7d5f1d5383109934f29ff
add weboob.tools.application.prompt.PromptApplication
weboob/tools/application/prompt.py
weboob/tools/application/prompt.py
# -*- coding: utf-8 -*- """ Copyright(C) 2010 Romain Bignon This program 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, version 3 of the License. This program is distributed in the hope that it will be useful...
Python
0.000001
1b3d7078a4ca91ef07f90d1645f26761d1f7abac
Add example of using lower-level plotting methods directly
examples/scatter.py
examples/scatter.py
""" Example of how `ax.scatter` can be used to plot linear data on a stereonet varying color and/or size by other variables. This also serves as a general example of how to convert orientation data into the coordinate system that the stereonet plot uses so that generic matplotlib plotting methods may be used. """ impo...
Python
0.000001
7383cc2a4b6ad21c747794dbb3d33338d8eea528
Add another example.
examples/tor-irc.py
examples/tor-irc.py
# Copyright (c) Aaron Gallagher <_@habnab.it> # See COPYING for details. from twisted.internet.defer import Deferred from twisted.internet.endpoints import TCP4ClientEndpoint from twisted.internet.protocol import ClientFactory from twisted.internet.task import react from twisted.words.protocols.irc import IRCClient fr...
Python
0.000001
7a3e85231efeb5c03cab944f6da346d138f6fcb1
Add tests for pips
test/test_pips.py
test/test_pips.py
import pytest @pytest.mark.parametrize("name", [ ("awscli"), ("boto3"), ("docker-py"), ("GitPython"), ("mkdocs"), ("pep8"), ("virtualenv"), ("virtualenvwrapper"), ]) def test_pips(host, name): assert name in host.pip_package.get_packages()
Python
0.000001
8b4d27851889bccc87392b14557ce63d3f95e426
add build.py
build.py
build.py
#!/usr/bin/python import glob import gzip import os import platform import re import sh import shutil import subprocess import sys import time from optparse import OptionParser log = lambda *a: None def VerbosePrint(*args): # Print each argument separately so caller doesn't need to # stuff everything to be pr...
Python
0.000001
4a97d5b9f9998a5b8ca8509547dabf8d757e70d9
Add build script.
build.py
build.py
import version print "Reading gitmake.py..." with open('gitmake.py') as fp: lines = fp.readlines() print "Rewriting gitmake.py..." with open('gitmake.py', 'w') as fp: for line in lines: if line.startswith('version_info ='): fp.write('version_info = (%d,%d,%d,\'%s\')\n' % (version.major, ve...
Python
0
6dabd92990df570d81a621e51d7119345671d4c0
Create Neopixel_Serial.py (#43)
home/moz4r/Neopixel_Serial.py
home/moz4r/Neopixel_Serial.py
#Just a poc maybe there is a best method #Flash Neopixel_MRL.ino import time serial = Runtime.createAndStart("serial","Serial") Runtime.createAndStart("mouth", "AcapelaSpeech") serial.connect("COM7", 9600, 8, 1, 0) sleep(5) mouth.speak("Hi everybody this is neo pixel ring controled by my robot lab") sleep(3) mouth.spea...
Python
0
86ae30203475a2ac718cf3839e38522e8e1aa203
Add tests package #5
tests/__init__.py
tests/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2017 Jun-ya HASEBA # # 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 r...
Python
0
0fec255426bc48e7674cc1391bdb3e1f64386be6
Add disk_variability script, used to generate box plot for paper
scripts/disk_variability.py
scripts/disk_variability.py
#!/usr/bin/env python # Copyright (c) 2011 Stanford University # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND ...
Python
0
d519c7f171d7e89f30f073616f71af24654d223d
add solution for Rotate List
src/rotateList.py
src/rotateList.py
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @param k, an integer # @return a ListNode def rotateRight(self, head, k): if not head: return None ...
Python
0
5828823d505aae1425fd2353f898c5b18722e6e5
Introduce base class and ProgressObserver for renaming occurences.
src/robotide/ui/progress.py
src/robotide/ui/progress.py
# Copyright 2008-2009 Nokia Siemens Networks Oyj # # 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...
# Copyright 2008-2009 Nokia Siemens Networks Oyj # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
Python
0
0d7b1d848d7ab80cc9054931f14b98bc123287bf
Create test_bulkresize.py file
jarviscli/plugins/test_bulkresize.py
jarviscli/plugins/test_bulkresize.py
from unittest import mock import unittest import os from Jarvis import Jarvis from plugins.bulkresize import spin from plugins import bulkresize from tests import PluginTest CURRENT_PATH = os.path.dirname(os.path.abspath(__file__)) DATA_PATH = os.path.join(CURRENT_PATH, '..', 'data/') class Bulkresize(PluginTest):...
Python
0
35fd6f5829f25b8f9dd1b3e5fa816e7dbbd08c04
add --all options to `lx export-aria2` and `lx download-aria2`
lixian_plugins/commands/aria2.py
lixian_plugins/commands/aria2.py
from lixian_plugins.api import command from lixian_config import * from lixian_encoding import default_encoding from lixian_cli_parser import command_line_parser from lixian_cli_parser import with_parser from lixian_cli_parser import command_line_option, command_line_value from lixian_commands.util import parse_login...
from lixian_plugins.api import command from lixian_config import * from lixian_encoding import default_encoding from lixian_cli_parser import command_line_parser from lixian_cli_parser import with_parser from lixian_cli_parser import command_line_value from lixian_commands.util import parse_login, create_client def ...
Python
0
a8a87818094f0cf9954815caca9fb586ddb4099b
Add a gallery example to show coloring of points by categories (#1006)
examples/gallery/symbols/points_categorical.py
examples/gallery/symbols/points_categorical.py
""" Color points by categories --------------------------- The :meth:`pygmt.Figure.plot` method can be used to plot symbols which are color-coded by categories. In the example below, we show how the `Palmer Penguins dataset <https://github.com/allisonhorst/palmerpenguins>`__ can be visualized. Here, we can pass the ind...
Python
0.000622
8702eee2e6bd107a414bc80be2428d6db05c3ec4
Add example of option pricing using BS
examples/finance/black_scholes.py
examples/finance/black_scholes.py
import argparse import contextlib import time import cupy import numpy # This sample computes call and put prices for Europian options with # Black-Scholes equation. It was based on a sample of the financial package # in CUDA toolkit. For details, please see a corresponding whitepaper. # # The following code shows th...
Python
0
7ff0c1fd4eb77129c7829f92fc176678a06abe19
add solution for Balanced Binary Tree
src/balancedBinaryTree.py
src/balancedBinaryTree.py
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return a boolean def isBalanced(self, root): return self.getDepth(root) != -1 def ge...
Python
0.000001
81a79933aa593f79ae054053068b04073f9db68f
Add hit calibration example
examples/plot_calibrating_hits.py
examples/plot_calibrating_hits.py
#!/usr/bin/env python # coding: utf-8 -*- """ ================== Calibrating Hits ================== Hits stored in ROOT and HDF5 files are usually not calibrated, which means that they have invalid positions, directions and uncorrected hit times. This example shows how to assign the PMT position and direction to eac...
Python
0
d19599227935139585a013227e816090a48e3a83
Create bh.py
bh.py
bh.py
import requests import re import tweepy import os from time import gmtime, strftime, sleep import json from random import uniform def getName(name): product = "RX " if "570" in name: product += "570" else: product += "580" if "4G" in name: product += " 4GB" else: product += " 8GB" return product def s...
Python
0.000009
7c17dfaf8d727047e32ab4e18438897f1b35feb2
226. Invert Binary Tree
problems/test_0226_bfs.py
problems/test_0226_bfs.py
import unittest import utils from tree import TreeNode # O(n) time. O(log(n)) space. BFS. class Solution: def invertTree(self, root: TreeNode) -> TreeNode: if not root: return None q = [root] while q: new_q = [] for curr in q: curr.lef...
Python
0.999305
8bc4dddfad944d385c02e2a6ebd8031bfb6bfae8
Test dynamic_length
extenteten/dynamic_length_test.py
extenteten/dynamic_length_test.py
import numpy as np import tensorflow as tf from .dynamic_length import * def test_id_tree_to_root_width(): with tf.Session() as session, session.as_default(): id_tree = tf.constant([[[1], [2], [3], [0], [0]]]) assert id_tree_to_root_width(id_tree).eval() == np.array([3]) def test_id_sequence_to...
Python
0.000001
471d60f41a283e5a2b2fb4a364cde67150de8acd
Create pmcolor.py
HexChat/pmcolor.py
HexChat/pmcolor.py
__module_name__ = "PMColor" __module_author__ = "TingPing" __module_version__ = "1" __module_description__ = "Color PM tabs like Hilights" import xchat def pm_cb(word, word_eol, userdata): xchat.command('GUI COLOR 3') return None xchat.hook_print("Private Message to Dialog", pm_cb) xchat.hook_print("Private Actio...
Python
0
8b5c9a434b1d8ae8d46a34d45114bc9c71dac0ea
Create install for nginx
genes/nginx/main.py
genes/nginx/main.py
from genes.apt import commands as apt from genes.brew import commands as brew from genes.debian.traits import is_debian from genes.mac.traits import is_osx from genes.ubuntu.traits import is_ubuntu def main(): if is_ubuntu() or is_debian(): apt.update() apt.install('nginx') elif is_osx(): ...
Python
0
cd1f02d5707e1285fab54d31e65b6098e967a8d3
Move quality plugin priority earlier, so it can reject before e.g. regexp plugin causes imdb lookups.
flexget/plugins/filter/quality.py
flexget/plugins/filter/quality.py
import logging from flexget.plugin import register_plugin, priority import flexget.utils.qualities as quals log = logging.getLogger('quality') class FilterQuality(object): """ Rejects all entries that don't have one of the specified qualities Example: quality: - hdtv """ ...
import logging from flexget.plugin import register_plugin, priority import flexget.utils.qualities as quals log = logging.getLogger('quality') class FilterQuality(object): """ Rejects all entries that don't have one of the specified qualities Example: quality: - hdtv """ ...
Python
0.000003
e1a40e6a43915f8e8be2aa27387cd0d25f05ed67
Create Multiplication_Of_2_Numbers.py
Code/Multiplication_Of_2_Numbers.py
Code/Multiplication_Of_2_Numbers.py
a=input("Enter a number -->") b=input("Enter a number -->") print a*b
Python
0.008666
2059aa7776a8e0c947b68e9401d74bdd146a59cd
Test passed for week day
ch03_04.py
ch03_04.py
(day, month, year) = input().split() day = int(day); month = int(month); year = int(year) if month < 3: month += 12 year -= 1 c = year / 100 k = year % 100 week_day = int( day + (26 * (month + 1) / 10) + k + ( k / 4 ) + ( c / 4 ) + ( 5 * c ) ) % 7 week_day_name = '' # 1. Follow from flowchart if 0 == week_...
Python
0.000002
bda7ef0f449c40d572cc4fe40aaaa2f60996bde5
add spider for solitaireonline.com
gaming_spiders/solitaireonline.py
gaming_spiders/solitaireonline.py
#!/usr/bin/env python import json from cloudfeaster import spider from zygomatic import ZygomaticSpider class SolitaireOnlineSpider(ZygomaticSpider): @classmethod def get_metadata(cls): return { "url": "http://www.solitaireonline.com/?sort=mostPlayed", } if __name__ == "__mai...
Python
0
868293aee14d6216c69446dc367491b25469f6e8
add import_question_metadata to import display_text and key for questions from csv file
apps/stories/management/commands/import_question_metadata.py
apps/stories/management/commands/import_question_metadata.py
from django.core.management.base import BaseCommand import csv from stories.models import Question, Questiongroup, QuestiongroupQuestions class Command(BaseCommand): args = "filename to import from" help = """Import Key and Display Text metadata for questions python manage.py import_question_me...
Python
0.000001
9f1dfbf4bf36c0e3ef991a66c5a68b2674223b19
Add a constant decoractor
const.py
const.py
def constant(func): """ Decorator used to emulate constant values """ def fset(self, value): raise TypeError("Cannot modify the value of a constant.") def fget(self): return func() return property(fget, fset)
Python
0.000978
2ee04a1b668501eb41ce4b08e6c92ffe4f57d861
Build dependencies were borken because something sorts 1.0.1-XX and 1.0-YY wrong
aliyun/__init__.py
aliyun/__init__.py
""" Aliyun API ========== The Aliyun API is well-documented at `dev.aliyun.com <http://dev.aliyun.com/thread.php?spm=0.0.0.0.MqTmNj&fid=8>`_. Each service's API is very similar: There are regions, actions, and each action has many parameters. It is an OAuth2 API, so you need to have an ID and a secret. You can get the...
""" Aliyun API ========== The Aliyun API is well-documented at `dev.aliyun.com <http://dev.aliyun.com/thread.php?spm=0.0.0.0.MqTmNj&fid=8>`_. Each service's API is very similar: There are regions, actions, and each action has many parameters. It is an OAuth2 API, so you need to have an ID and a secret. You can get the...
Python
0.000026
c480982a09f354a05c5e5ff0dc8a7c93f13f3970
add config for quakenet script
config/quakenet.py
config/quakenet.py
settings = { "authname": "authname", "password": "authpw", "channels": "#pwnagedeluxe" }
Python
0
6b0721b6aeda6d3ec6f5d31be7c741bc7fcc4635
bump release for 18.0.1 development
setup.py
setup.py
"""Functionality that should be in the standard library. Like builtins, but Boltons. Otherwise known as, "everyone's util.py," but cleaned up and tested. Contains over 160 BSD-licensed utility types and functions that can be used as a package or independently. `Extensively documented on Read the Docs <http://boltons....
"""Functionality that should be in the standard library. Like builtins, but Boltons. Otherwise known as, "everyone's util.py," but cleaned up and tested. Contains over 160 BSD-licensed utility types and functions that can be used as a package or independently. `Extensively documented on Read the Docs <http://boltons....
Python
0
95d3306f2f7c492ea5f58c86b86165544273e6b9
Create mp.py
mp.py
mp.py
import multiprocessing as mp import time THREADS=10 def f(x): print("Starting...." + str(x)) time.sleep(5) print("Finishing...."+ str(x)) processes = [None] * THREADS print(processes) def add_to_processes(args): while True: for idx, process in enumerate(processes): if process is ...
Python
0.000002
934c4136c6415b76577d206739b352ad965210f0
Create test_postures.py
home/beetlejuice/test_postures.py
home/beetlejuice/test_postures.py
# Sweety's postures test import random Runtime.createAndStart("sweety", "Sweety") sweety.arduino.setBoard("atmega2560") sweety.connect("COM9") sleep(1) # give a second to the arduino for connect sweety.attach() sweety.mouthState("smile") sleep(1) # set delays for led sync (delayTime, delayTimeStop, delayTimeLetter) ...
Python
0.000001
89714cf01186e9aa5575fadf45c6c1fa70812871
Create count.py
count.py
count.py
#!/usr/bin/env python import rospy from std_msgs.msg import Int32 if __name__ == '__main__': rospy.init_node('count') pub = rospy.Publisher('count_up', Int32, queue_size=1) rate = rospy.Rate(10) n = 0 while not rospy.is_shutdown(): n += 1 pub.publ...
Python
0.000003
3e5a90930560cc891ce6ac130980a29602228911
Add scheduler utils unit tests
nova/tests/scheduler/test_scheduler_utils.py
nova/tests/scheduler/test_scheduler_utils.py
# Copyright (c) 2013 Rackspace Hosting # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
Python
0.000004
9f443a5af6537867712f12419d93a5b8c824858a
Add Notify-osd option for linux based systems
flexget/plugins/output/notify_osd.py
flexget/plugins/output/notify_osd.py
from __future__ import unicode_literals, division, absolute_import import logging from flexget.plugin import register_plugin, priority, DependencyError from flexget.utils.template import RenderError, render_from_task log = logging.getLogger('notify_osd') class OutputNotifyOsd(object): def validator(self): ...
Python
0
77922e6527ad0e2c223983c59329dea127cd38ef
Create heuristic_test
models/players/heuristic_test.py
models/players/heuristic_test.py
from models.algorithm.minimax import Heuristic from models.algorithm.minimax import Minimax
Python
0.00001
55679ed98454ed450525cd56a3f6d133af705a1c
Add Multivariate Analysis using corpus size, bilingual size, exec time, correlation score, p value
modules/analysis/multivariate.py
modules/analysis/multivariate.py
""" Perform Multivariate Analysis. Variables considered: * Corpus Size * Bilingual Dictionary Size * Execution time * Correlation Coefficient * P Value """ import os import csv import time import codecs from modules.preprocessor.hccorpus_preprocessor import HcCorpusPreprocessor from modules.model_generator import mod...
Python
0
e67cdab86b93ee07271f57fa77cfda708d716259
Add async search wrapper
chemspipy/search.py
chemspipy/search.py
# -*- coding: utf-8 -*- """ chemspipy.search ~~~~~~~~~~~~~~~~ A wrapper for asynchronous search requests. :copyright: Copyright 2014 by Matt Swain. :license: MIT, see LICENSE file for more details. """ from __future__ import print_function from __future__ import unicode_literals from __future__ import division impor...
Python
0.000001
93b2d737407389a1c4dbc67836a949663eeba948
Call the new presubmit checks from chrome/ code, with a blacklist.
chrome/PRESUBMIT.py
chrome/PRESUBMIT.py
# Copyright (c) 2009 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. """Makes sure that the chrome/ code is cpplint clean.""" INCLUDE_CPP_FILES_ONLY = ( r'.*\.cc$', r'.*\.h$' ) EXCLUDE = ( # Objective C confuses ever...
Python
0.000001
923786f0ee9e5128337997b6687374f74388c1c2
add leetcode Find Minimum in Rotated Sorted Array
leetcode/FindMinimuminRotatedSortedArray/solution.py
leetcode/FindMinimuminRotatedSortedArray/solution.py
# -*- coding:utf-8 -*- class Solution: # @param num, a list of integer # @return an integer def findMin(self, num): l = 0 h = len(num) - 1 while l < h: mid = (l + h) // 2 if num[l] > num[mid]: h = mid elif num[h] < num[mid]: ...
Python
0
227e38318e41b3c11ee818fdb08b273f527ba686
add test_source_stream.pyc
lacli/t/test_source_stream.py
lacli/t/test_source_stream.py
import os from testtools import TestCase from lacli.decorators import coroutine class StreamSourceTest(TestCase): def setUp(self): super(StreamSourceTest, self).setUp() self.home = os.path.join('t', 'data', 'home') self.testfile = os.path.join('t', 'data', 'longaccess-74-5N93.html') d...
Python
0.000006
f8c7a80fc8500d53cacef904c4a7caea88263465
Add 20150608 question.
LeetCode/gas_station.py
LeetCode/gas_station.py
class Solution: # @param {integer[]} gas # @param {integer[]} cost # @return {integer} def canCompleteCircuit(self, gas, cost): diff = [] i = 0 while i < len(gas): diff.append(gas[i] - cost[i]) i += 1 leftGas, sumCost, start = 0, 0, 0 i =...
Python
0.000001
08e57c27c47437b46c557f4697dd32d00f27fd7f
Create whatIsYourName.py
whatIsYourName.py
whatIsYourName.py
a = 20 b = 130 c = a + b print (c) d = 100 e = 2 f = d / e print (f) g = 34 h = 47 i = 82 j= g + h + i print (j) name = input("What is your name? ") print("hello, ", name)
Python
0.000175
4f99ffbc3deb321ba3ff76b23bacb889b11e1f4d
add to index solved
Lesson4/add_to_index.py
Lesson4/add_to_index.py
# Define a procedure, add_to_index, # that takes 3 inputs: # - an index: [[<keyword>,[<url>,...]],...] # - a keyword: String # - a url: String # If the keyword is already # in the index, add the url # to the list of urls associated # with that keyword. # If the keyword is not in the index, # add an entry to the inde...
Python
0.000001
d824d2fc32774ce51e4f36d702a2a6cc131db558
add migration file to automatically parse citations
osf/migrations/0074_parse_citation_styles.py
osf/migrations/0074_parse_citation_styles.py
# This migration port `scripts/parse_citation_styles` to automatically parse citation styles. # Additionally, this set the corresponding `has_bibliography` field to `False` for all citation formats whose CSL files do not # include a bibliography section. As a result, all such citation formats would not show up in OSF #...
Python
0
9f46cf4836ad555a54dc9c47b8b2843643a878f2
Create migration for draft dos1 briefs to dos2
migrations/versions/840_migrate_draft_dos1_briefs_to_draft_dos2.py
migrations/versions/840_migrate_draft_dos1_briefs_to_draft_dos2.py
"""Migrate draft DOS1 briefs to draft DOS2 briefs Revision ID: 840 Revises: 830 Create Date: 2017-02-07 15:31:50.715832 """ # revision identifiers, used by Alembic. revision = '840' down_revision = '830' from alembic import op def upgrade(): # Change framework of draft DOS1 briefs from DOS1 (framework_id == 5)...
Python
0.000001
4a3d56589cbf4e94618795d3f1bc09fa0f59e5ca
Add "ROV_SRS_Library.py" file containing functions for main script.
ROV_SRS_Library.py
ROV_SRS_Library.py
# ROV_SRS_Library # # # Overview: A collection of helper functions used by the BeagleBone # to control the ROV SRS Actuators. # # Authors: Jonathan Lee (2015) # import Adafruit_BBIO.GPIO as GPIO import Adafruit_BBIO.PWM as PWM def calc_pulse_width(pin_name): """Calculates the pulse width of a PWM signal input. St...
Python
0
0a45c8f0632f3e8ca5502b9e4fdbaef410b07c71
rename settings.py
config.py
config.py
# -*- coding: utf-8 -*- from flask import Flask app = Flask(__name__)
Python
0.000001
1d35451387f9cab55df12f28e71824b2dbe37153
add back after exposing my key
config.py
config.py
ECHO_NEST_API_KEY = "INSERT ECHO NEST API KEY HERE"
Python
0
88a1f41c99320117bedb9d9922f3737fa820768a
fix import in config
config.py
config.py
#!/usr/bin/env python # encoding: utf-8 """ config.py Application configurations db_file : the SQLite file used to store the progress serial : settings for the serial port that the RFID reader connects to mpd_conn : the connection details for the MPD client gpio_pins : the ids of the GPIO input pins and their callb...
#!/usr/bin/env python # encoding: utf-8 """ config.py Application configurations db_file : the SQLite file used to store the progress serial : settings for the serial port that the RFID reader connects to mpd_conn : the connection details for the MPD client gpio_pins : the ids of the GPIO input pins and their callb...
Python
0.000001
a335c9dbaa2da6dc429c9e280c6a6786422f0809
Add code that generates byte encodings for various x86-32 instructions, with holes for constant operands
encoder.py
encoder.py
import re import subprocess def write_file(filename, data): fh = open(filename, "w") try: fh.write(data) finally: fh.close() def Encode(instr): write_file('tmp.S', instr + '\n') subprocess.check_call(['as', '--32', 'tmp.S', '-o', 'tmp.o']) proc = subprocess.Popen(['objdump', '-d', 'tmp.o'], ...
Python
0.000004
ffca5ea26c02170cc5edf6eea25ec9ef2c0c72bf
Disable trix serializer tests with Jython
test/test_trix_serialize.py
test/test_trix_serialize.py
#!/usr/bin/env python import unittest from rdflib.graph import ConjunctiveGraph from rdflib.term import URIRef, Literal from rdflib.graph import Graph try: from io import BytesIO except ImportError: from StringIO import StringIO as BytesIO class TestTrixSerialize(unittest.TestCase): def setUp(self): ...
#!/usr/bin/env python import unittest from rdflib.graph import ConjunctiveGraph from rdflib.term import URIRef, Literal from rdflib.graph import Graph try: from io import BytesIO except ImportError: from StringIO import StringIO as BytesIO class TestTrixSerialize(unittest.TestCase): def setUp(self): ...
Python
0
760b83da2a45a560ec3fa82575f459a22e5d0e4b
Add makeindex.py
makeindex.py
makeindex.py
#!/usr/bin/env python from __future__ import print_function import fnmatch import json import re import os import sys OSI = [ 'BSD-2-Clause', 'BSD-3-Clause', 'AFL-3.0', 'APL-1.0', 'Apache-2.0', 'APSL-2.0', 'Artistic-2.0', 'AAL', 'BSL-1.0', 'CECILL-2.1', 'CATOSL-1.1', '...
Python
0.000009
ba6dc4269f96903f863748a779521d2bd8803d4f
Create Process.py
Samples/Process.py
Samples/Process.py
__author__ = 'Marius' from TM1py import TM1Queries, Process import uuid import unittest class TestAnnotationMethods(unittest.TestCase): q = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True) random_string = str(uuid.uuid4()).replace('-', '_') p_none = Process(name='unittest_none_' + r...
Python
0