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
7a8250e6640c8ebf36cd159607da24b095cf708e
Create Fibonacci.py
Fibonacci.py
Fibonacci.py
#Author-Michael Aubry #Description-This script outputs a spiraling fibinacci sequence onto a Fusion 360 sketch import adsk.core, adsk.fusion app= adsk.core.Application.get() design = app.activeProduct ui = app.userInterface; #**User Inputs** Steps = 15 #How many steps of Fibonacci would you like to plot? Length = 2...
Python
0.999733
85c02da33f5e9ed4ef1e72bef3cec094ca8cf4d5
add DBMetric class that holds data that has to be recorded
django_db_meter/message.py
django_db_meter/message.py
import datetime import cPickle as pickle import pylzma import json from collections import namedtuple from django.core.serializers import serialize, deserialize from django.conf import settings from core.log import sclient from core.utils import run_async from newsfeed.activity import Actor, Target from newsfeed.cons...
Python
0
b777872d1b06714f538dc8fb21b790de822b5a66
Update Example folder
examples/listing_instruments.py
examples/listing_instruments.py
import visa rm = visa.ResourceManager() rm.list_resources()
Python
0
735c55d68d4831137255808042684733f93d5c18
add iconv clone
iconv.py
iconv.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import locale import argparse import fileinput preferredenc = locale.getpreferredencoding() parser = argparse.ArgumentParser( description="Convert encoding of given files from one encoding to another.") parser.add_argument( "-f", "--from-code", metava...
Python
0
aa7f888605dee0a845a20e1c0869cc5061719151
Add rtree spatial index class
plotink/rtree.py
plotink/rtree.py
# -*- coding: utf-8 -*- # rtree.py # part of plotink: https://github.com/evil-mad/plotink # # See below for version information # # Written by Michal Migurski https://github.com/migurski @michalmigurski # as a contribution to the AxiDraw project https://github.com/evil-mad/axidraw/ # # Copyright (c) 2022 Windell H. Osk...
Python
0.000001
56ca21d312f34b6a229fe6cdb720ccc96ef712a5
add polysites2vcf
polysites2vcf.py
polysites2vcf.py
#This is for converting Shop Mallick's polysite format to vcf #Probably only useful to you if you are working on the SGDP #Very specific to this particular format. from __future__ import division, print_function import argparse, sys, pdb #Remember, in eigenstrat, 2 means "2 ref copies" CODES={ "A":"AA", ...
Python
0.000001
6a13295ea0e3e763683ec2317502141e4913935b
Make prowl debug output actually go to debug log
flexget/plugins/output/prowl.py
flexget/plugins/output/prowl.py
from __future__ import unicode_literals, division, absolute_import import logging from requests import RequestException from flexget.plugin import register_plugin, priority from flexget.utils.template import RenderError __version__ = 0.1 log = logging.getLogger('prowl') headers = {'User-Agent': 'FlexGet Prowl plug...
from __future__ import unicode_literals, division, absolute_import import logging from requests import RequestException from flexget.plugin import register_plugin, priority from flexget.utils.template import RenderError __version__ = 0.1 log = logging.getLogger('prowl') headers = {'User-Agent': 'FlexGet Prowl plug...
Python
0.000001
72dcd6857f5f895f0fb9325681302f5875bc50ec
Add a new user-defined file
profile_collection/startup/31-capillaries.py
profile_collection/startup/31-capillaries.py
#6.342 mm apart #6.074 def capillary6_in(): mov(diff.xh,12.41) mov(diff.yh,-12.58) def capillary7_in(): mov(diff.xh,6.075) mov(diff.yh,-12.58) def capillary8_in(): mov(diff.xh,-.26695) mov(diff.yh,-12.58) def capillary9_in(): mov(diff.xh,-6.609) mov(diff.yh,-12.58) def ...
Python
0
f1ee6ce108626342b42a2d2a7b5aa4779af87e6c
Add python code to plot the histogram
plot-histogram.py
plot-histogram.py
import matplotlib.pyplot as plt import sys if __name__ == "__main__": with open(sys.argv[1]) as f: data = map(float, f.readlines()) plt.hist(list(data), 100) plt.show()
Python
0.00008
0852aa9328cf3fe2b975581f4e67357fc2c68f06
add reprozip installation and trace cmd
neurodocker/interfaces/reprozip.py
neurodocker/interfaces/reprozip.py
"""Add Dockerfile instructions to minimize container with ReproZip. Project repository: https://github.com/ViDA-NYU/reprozip/ See https://github.com/freesurfer/freesurfer/issues/70 for an example of using ReproZip to minimize Freesurfer's recon-all command. """ # Author: Jakub Kaczmarzyk <jakubk@mit.edu> from __futu...
Python
0
c9f64c0e61fb08c43b1c8cb93ec6f9c389b9c31c
delete finished pods from cluster
XcScripts/deletePods.py
XcScripts/deletePods.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import json import shutil import subprocess import time def ReadPodsToBeDeleted(fname): """ self explanatory """ listPods = [] with open(fname,'r') as f: for line in f: listPods.append(line.rstrip('\n')) ...
Python
0
375134eba8a7fa1cbf2ab5c94ae0976eebc65de9
Solve Code Fights crazyball problem
CodeFights/crazyball.py
CodeFights/crazyball.py
#!/usr/local/bin/python # Code Fights Crazyball Problem from itertools import combinations def crazyball(players, k): return sorted([sorted(list(l)) for l in combinations(players, k)]) def main(): tests = [ [["Ninja", "Warrior", "Trainee", "Newbie"], 3, [["Newbie", "Ninja", "Trainee"], ...
Python
0.000561
e7bac459119e32cb79708ae7764a149dc22a1ed8
add visitor.py from python svn (python 2.5 doesnt have it)
pyjs/src/pyjs/visitor.py
pyjs/src/pyjs/visitor.py
# XXX should probably rename ASTVisitor to ASTWalker # XXX can it be made even more generic? class ASTVisitor: """Performs a depth-first walk of the AST The ASTVisitor will walk the AST, performing either a preorder or postorder traversal depending on which method is called. methods: preorder(tre...
Python
0
93c828b7c94004321a3801c2b53ba692532d1c79
Update TwitterSearchSensor to retrieve and store last_id in the datastore.
packs/twitter/sensors/twitter_search_sensor.py
packs/twitter/sensors/twitter_search_sensor.py
from TwitterSearch import TwitterSearch from TwitterSearch import TwitterSearchOrder from st2reactor.sensor.base import PollingSensor __all__ = [ 'TwitterSearchSensor' ] BASE_URL = 'https://twitter.com' class TwitterSearchSensor(PollingSensor): def __init__(self, sensor_service, config=None, poll_interval=...
from TwitterSearch import TwitterSearch from TwitterSearch import TwitterSearchOrder from st2reactor.sensor.base import PollingSensor BASE_URL = 'https://twitter.com' class TwitterSearchSensor(PollingSensor): def __init__(self, sensor_service, config=None, poll_interval=None): super(TwitterSearchSensor,...
Python
0
7da94fd5576f4c052e79a8068164c101054d5ae7
Add Python / `requests` example
python/simple.py
python/simple.py
import requests # http://python-requests.org/ # Premium user authentication process and API access example r = requests.post('https://api.masterleague.net/auth/token/', data={'username': 'user', 'password': '12345'}) if 'token' not in r.json(): print(r.text) raise ValueError("Unable to extract authentication...
Python
0.000024
84138d6df951df7a4a44516cec31eca3ad15d308
add pytorch support
pytorch_model.py
pytorch_model.py
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.autograd import Variable # Training settings # now the argments setting parser = argparse.ArgumentParser(descripti...
Python
0
f6e49221370d8087403be1a4679e62ba217c8be9
Create embedhelp.py
embedhelp/embedhelp.py
embedhelp/embedhelp.py
import discord import os import collections from .utils.dataIO import fileIO, dataIO from .utils import checks from discord.ext import commands class Help: def __init__(self, bot): self.bot = bot self.profile = "data/help/toggle.json" self.riceCog = dataIO.load_json(self.profile) @comm...
Python
0.000001
b4f2c7b8bde0d28f7d1b61718eb7cd0b9159f507
add __version__
epistasis/__version__.py
epistasis/__version__.py
__version__ = "0.6.4"
Python
0.000984
9498ac9ec27bbef1725b92e84a3b0d4c9e967aa6
add ex14
lpthw/ex14.py
lpthw/ex14.py
#!/usr/bin/env python # Exercise 14: Prompting and Passing from sys import argv script, user_name = argv prompt = '> ' print "Hi %s, I'm the %s script." % (user_name, script) print "I'd like to ask you a few questions." print "Do you like me %s?" % user_name likes = raw_input(prompt) print "Where do you live %s?" ...
Python
0.99846
1c8fd79c783ba6f21140b4c08bbf648bf5989dd4
Add main module
core/hybra.py
core/hybra.py
import data_loader import descriptives import network import timeline import wordclouds def load_data( terms = [], data_folder = '' ): if data_folder == '': return load_all_data( terms ) else: if '/' not in data_folder: data_folder += '/' loader = data_folder.split( '/' )[0...
Python
0.000001
0ec0398f8e50ed0adca426f9c468fd5154603941
add mmd matrix example
open_spiel/python/examples/mmd_matrix_example.py
open_spiel/python/examples/mmd_matrix_example.py
""" Example of using MMD with dilated entropy to solve for QRE in a Matrix Game """ from absl import app from absl import flags from open_spiel.python.algorithms import mmd_dilated import pyspiel FLAGS = flags.FLAGS flags.DEFINE_integer("iterations", 1000, "Number of iterations") flags.DEFINE_float("alpha", 0.1...
Python
0
eb2cbb45fd78c2e8accdaa6f8ba37ef1403159dd
Add brainfuck live shell
bf/bf_cmd.py
bf/bf_cmd.py
#!/usr/bin/env python3 class BracketError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class Machine(): def __init__(self): self.tape = [0] self.p = 0 def run(self, code): pc = 0 loop_stack = [] brackets = 0 printed = False for instr in ...
Python
0.000023
3425d265c32d33c189710bcffd1d0df62ce27b3a
update model
model.py
model.py
class User(dict): """ Every user must have keys for a username, name, passphrase (this is a bcrypt hash of the password), salt, groups, and an email address. They can be blank or None, but the keys must exist. """ def __init__(self, dict=None): for key in ['username', 'name', 'passphrase', 'salt...
class User(dict): """ Every user must have keys for a username, name, passphrase (this is a md5 hash of the password), groups, and an email address. They can be blank or None, but the keys must exist. """ def __init__(self, dict=None): for key in ['username', 'name', 'passphrase', 'email']: ...
Python
0.000001
b4eb3a55be9e753496c5fd12a89ef85d6a904c09
Annotate zerver/management/commands/realm_emoji.py.
zerver/management/commands/realm_emoji.py
zerver/management/commands/realm_emoji.py
from __future__ import absolute_import from __future__ import print_function from argparse import RawTextHelpFormatter from typing import Any from argparse import ArgumentParser from django.core.management.base import BaseCommand, CommandParser from zerver.models import Realm, get_realm from zerver.lib.actions import...
from __future__ import absolute_import from __future__ import print_function from argparse import RawTextHelpFormatter from typing import Any from argparse import ArgumentParser from django.core.management.base import BaseCommand from zerver.models import Realm, get_realm from zerver.lib.actions import check_add_real...
Python
0
f95d7011ff89badfadbd07da0226f67f6dbd27a5
Remove unused `organizations:new-tracebacks` flag. (#4083)
src/sentry/features/__init__.py
src/sentry/features/__init__.py
from __future__ import absolute_import from .base import * # NOQA from .handler import * # NOQA from .manager import * # NOQA default_manager = FeatureManager() # NOQA default_manager.add('auth:register') default_manager.add('organizations:api-keys', OrganizationFeature) # NOQA default_manager.add('organization...
from __future__ import absolute_import from .base import * # NOQA from .handler import * # NOQA from .manager import * # NOQA default_manager = FeatureManager() # NOQA default_manager.add('auth:register') default_manager.add('organizations:api-keys', OrganizationFeature) # NOQA default_manager.add('organization...
Python
0
bbfcddbb21a6b6f40fafe8c88ca76ab4a0b4667b
add script to analysis the flow map
FlowNet/flowAnalysis.py
FlowNet/flowAnalysis.py
# When the movement of the objects in the video is not distinct to be # captured by optical flow algorithm, training this "noisy" flow map # against the ground truth labeling is risky. In this code, we would # like to iterate through all the generated flow videos, and filter # out the noisy flow map. # # # Contact: Chi...
Python
0
629ccdc27d2eb3522def903cc42606e43c3f816b
Add script to write network related files
AdaptivePELE/analysis/writeNetworkFiles.py
AdaptivePELE/analysis/writeNetworkFiles.py
import os import sys import argparse from AdaptivePELE.utilities import utilities import matplotlib.pyplot as plt def parseArguments(): desc = "Write the information related to the conformation network to file\n" parser = argparse.ArgumentParser(description=desc) parser.add_argument("clusteringObject", ty...
Python
0
daa4565abe4059e8588ddf374fde0f51d9ec784e
Create a skeleton for node propagation integration tests
test/integration/test_node_propagation.py
test/integration/test_node_propagation.py
class TestPropagation(object): def test_node_propagation(self): """ Tests that check node propagation 1) Spin up four servers. 2) Make the first one send a sync request to all three others. 3) Count the numbers of requests made. 4) Check databases to see that they al...
Python
0.000001
5b9b27d98cad06f0bbd67026b6533dee7c218df7
update series server code shifted from custom script to py file
setup/doctype/update_series/update_series.py
setup/doctype/update_series/update_series.py
# Please edit this list and import only required elements import webnotes from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate,...
Python
0
4eab434002c99daf9c302cb1007e7ec384453aae
Fix cherrypy example
examples/cherrypysample.py
examples/cherrypysample.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 import bottle @bottle.get('/') def index(): return {'key': 'value'} bottle.run(port=8080, host="0.0.0.0", server="cherrypy")
Python
0.000045
93e07841d961fb7956612339f13dfd4e8ddd8bac
Create RPi_Final.py
RPi_Final.py
RPi_Final.py
from random import *
Python
0.000001
2eba3f5072b547829964eac9d2d5b03076a49faf
add firmwareupdate sample
examples/firmwareupdate.py
examples/firmwareupdate.py
from sakuraio.hardware.rpi import SakuraIOGPIO #from sakuraio.hardware.rpi import SakuraIOSMBus import time sakuraio = SakuraIOGPIO() #sakuraio = SakuraIOSMBus() sakuraio.unlock() time.sleep(1) sakuraio.update_firmware() #print(sakuraio.get_firmware_version())
Python
0
16c57e5f3bd63667c7ca0b828e1f0fcd85d64b76
Create SecureMSG.py
SecureMSG.py
SecureMSG.py
#!/usr/python # # I dedicate this application for my best friend, Robert Niemiec :) # # Copyright (c) 2015 Dawid Wiktor # This app is writed for all whistleblowers, journalists and # cryptoanarchists. Use it when you need. Be carefull! NSA watchin' # # This is the Open Source Software. You can freely use it, edit cod...
Python
0.000001
522fb2e4b9fdf46abed3b5ca8ba43758b22253a1
add missing file
addons/web/ir_module.py
addons/web/ir_module.py
from openerp.osv import osv import openerp.wsgi.core as oewsgi from common.http import Root class ir_module(osv.Model): _inherit = 'ir.module.module' def update_list(self, cr, uid, context=None): result = super(ir_module, self).update_list(cr, uid, context=context) if tuple(result) != (0, 0)...
Python
0.000001
9c7d04b4eecb392b368e4b84a48197682ea63b8d
Add blackroom/python/auto-push.py
blackroom/python/auto-push.py
blackroom/python/auto-push.py
#!/usr/bin/python3 # -*-coding:utf-8 -*- # ProjectName:Bilibili小黑屋爬虫v2 # Author:zhihaofans # Github:https://github.com/zhihaofans/Bilibili/tree/master/blackroom # PythonVersion:3.x import requests import os import json import time from bilibili import blackRoom from zhihaofans import file as f savePath = f.getUpPath(f...
Python
0.000013
380a87e71c347eab5d9c5d22a255753e62e1d739
Add the original game code to the files to show progress made during the week using classes and other skills
Original_python_game.py
Original_python_game.py
import random GuessesTaken = 0 print ("Hello and welcome to my higher or lower number guessing game.") print ("Whats your name?") myName = input() number = random.randint(1, 20) number1 = random.randint(1, 20) number2 = random.randint(1, 20) number3 = random.randint(1, 20) number4 = random.randint(1, 20) number5 = r...
Python
0
958e6ca0ba5be68802e61a450aeb2bf39ea5d5ba
Create psf2pdb.py
psf2pdb.py
psf2pdb.py
import sys pdbfile = open(sys.argv[1],'r') psfile = open(sys.argv[2],'r') inline = pdbfile.readline() output = '' while inline != 'END\n': output = output + inline inline = pdbfile.readline() if inline == '': #sanity check print "Error" exit() inline = psfile.readline().split() while inli...
Python
0.000012
e73d16d4051c6bc66daf415d2da4e8d204a97004
Add rainbow function
rainbow.py
rainbow.py
import re import colorsys from pymol import cmd def rainbow(range_string): """ DESCRIPTION Colors rainbow spectrum for a selection given in range string. The difference between coloring in rainbow with built-in 'spectrum' is that this relies on the segment order in range string (not alphabetically ...
Python
0
cbaed7d194f4a91198fc097d4657ad327819af4b
Add new migration.
invite/migrations/0004_auto_20191126_1740.py
invite/migrations/0004_auto_20191126_1740.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-11-26 17:40 from __future__ import unicode_literals from django.db import migrations, models import uuid class Migration(migrations.Migration): dependencies = [ ('invite', '0003_abstract_invitation_auto_now_add'), ] operations = [ ...
Python
0
47044317e4067fb38bf9e0fdb2e9c5f9ccb78053
add migration
pokemon_v2/migrations/0006_auto_20200725_2205.py
pokemon_v2/migrations/0006_auto_20200725_2205.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("pokemon_v2", "0005_auto_20200709_1930"), ] operations = [ migrations.AlterField( model_name="pokemon", name="height", field=models.IntegerField(blank=Tru...
Python
0.000001
bad97abfe7fd93cefac10d46b5434b63cc7e3d2b
add line to end of file
keras_contrib/constraints.py
keras_contrib/constraints.py
from __future__ import absolute_import from . import backend as K from keras.utils.generic_utils import get_from_module from keras.constraints import * class Clip(Constraint): """Clips weights to [-c, c]. # Arguments c: Clipping parameter. """ def __init__(self, c=0.01): self.c = c ...
from __future__ import absolute_import from . import backend as K from keras.utils.generic_utils import get_from_module from keras.constraints import * class Clip(Constraint): """Clips weights to [-c, c]. # Arguments c: Clipping parameter. """ def __init__(self, c=0.01): self.c = c ...
Python
0.000001
d558ed9875cf99ebdf6915e7acd877fc7fae69f3
Add missing migration
candidates/migrations/0028_auto_20160411_1055.py
candidates/migrations/0028_auto_20160411_1055.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('candidates', '0027_create_standard_complex_fields'), ] operations = [ migrations.AlterField( model_name='complex...
Python
0.0002
90a5242a93beda053ad91adca0728995232e23d2
Create toggle_editor_text_console.py
cg/blender/scripts/toggle_editor_text_console.py
cg/blender/scripts/toggle_editor_text_console.py
import bpy keyconfig = bpy.context.window_manager.keyconfigs.user args = ('wm.context_set_enum', 'ESC', 'PRESS') kwargs = {'shift':True} for source, destination in (('Console', 'TEXT_EDITOR'), ('Text', 'CONSOLE')): kmi = keyconfig.keymaps[source].keymap_items.new(*args, **kwargs) properties = kmi.properties...
Python
0
cb505bd4c86c39bd7ce575a7d72e4a3d33875b93
Create polyDataMake.py
figureCode/polyDataMake.py
figureCode/polyDataMake.py
import numpy as np from random import seed, getstate, setstate def polyDataMake(n=21,deg=3,sampling='sparse'): old_state = getstate() seed(0) if sampling == 'irregular': xtrain = np.array([np.linspace(-1,-.5,6),np.linspace(3,3.5,6)]).reshape(-1,1) elif sampling == 'sparse': xtrain = np...
Python
0
53dc0a5a1e8cc94dd23f6b6cfa1997f7b8b6f926
call FSL NIDM export from command line
nidm-results_fsl.py
nidm-results_fsl.py
#!/usr/bin/python """ Export neuroimaging results created with FSL feat following NIDM-Results specification. The path to feat directory must be passed as first argument. @author: Camille Maumet <c.m.j.maumet@warwick.ac.uk> @copyright: University of Warwick 2013-2014 """ import sys import os from fsl_exporter.fsl_ex...
Python
0
88fe28ea1bca1f0f0784828592c2414e85e5ceb9
add update service
homeassistant/components/sensor/speedtest.py
homeassistant/components/sensor/speedtest.py
""" homeassistant.components.sensor.speedtest ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Speedtest.net sensor based on speedtest-cli. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.speedtest/ """ import logging import sys import re from datetime imp...
""" homeassistant.components.sensor.speedtest ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Speedtest.net sensor based on speedtest-cli. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.speedtest/ """ import logging import sys import re from datetime imp...
Python
0
cfb3384ee31945d0afef6c558b873d956247e791
Add link to docs
homeassistant/components/switch/tellstick.py
homeassistant/components/switch/tellstick.py
""" homeassistant.components.switch.tellstick ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support for Tellstick switches. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.tellstick.html """ import logging from homeassistant.const import (EVENT_HOMEAS...
""" homeassistant.components.switch.tellstick ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support for Tellstick switches. Because the tellstick sends its actions via radio and from most receivers it's impossible to know if the signal was received or not. Therefore you can configure the switch to try to send each signal ...
Python
0
775a86179c321ac3cab73c9556edaa798f4273fd
add PassiveTotal OneShotAnalytics
plugins/analytics/passive_total.py
plugins/analytics/passive_total.py
import requests import json from datetime import datetime from core.analytics import OneShotAnalytics from core.observables import Observable, Hostname class PassiveTotal(OneShotAnalytics): default_values = { "name": "PassiveTotal Passive DNS", "description": "Perform passive DNS (reverse) lookup...
Python
0.000001
24aad104e2cdc8e37e66c4d87401b30619c8cd97
Fix code style
chainer/functions/softplus.py
chainer/functions/softplus.py
import numpy from chainer import cuda from chainer import function from chainer.utils import type_check class Softplus(function.Function): """Softplus function.""" def __init__(self, beta=1.0): self.beta = numpy.float32(beta) self.beta_inv = numpy.float32(1.0 / beta) def check_type_for...
import numpy from chainer import cuda from chainer import function from chainer.utils import type_check class Softplus(function.Function): """Softplus function.""" def __init__(self, beta=1.0): self.beta = numpy.float32(beta) self.beta_inv = numpy.float32(1.0 / beta) def check_type_for...
Python
0.000169
2bd913c6cad94f3bc244d92a1ae1caffda82dcf8
Add humble plugin
plugins/humble.py
plugins/humble.py
import lxml.html import requests from smartbot import utils class Plugin: def __call__(self, bot): bot.on_respond(r"humble( weekly)?( sale)?", self.on_respond) bot.on_help("humble", self.on_help) def on_respond(self, bot, msg, reply): page = requests.get("https://www.humblebundle.com/...
Python
0
23ffdaf1ed0e1739975de058b9f8c1adeef15531
Add "nice guy bot" strategy
nicebotbot.py
nicebotbot.py
#!/bin/python def calculate_bid(player,pos,first_moves,second_moves): remaining = remaining_amount(player, first_moves, second_moves) amortized_bid = remaining / steps_remaining(player, pos) if(amortized_bid < 1): amortized_bid = 1 default_bid = 14 last_first_bid = 0 ...
Python
0.000777
48951aa7c2c82ca03e801e1bfce09be5492ce27b
Add python_analytics package
python_analytics/__init__.py
python_analytics/__init__.py
import logging try: # pragma: no cover from ._version import full_version as __version__ except ImportError: # pragma: no cover __version__ = "not-built" logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler())
Python
0.000031
9fa9b339cb0da0ae6a4318288afd8c75e6890e4e
prepare for provider
flask_oauthlib/provider.py
flask_oauthlib/provider.py
# coding: utf-8 """ Flask-OAuthlib -------------- Implemnts OAuth2 provider support for Flask. :copyright: (c) 2013 by Hsiaoming Yang. """
Python
0
f8e64d26c86e84ce9efe36db1155fdf5a4c6d5f8
Add example to show of icons.
flexx/ui/examples/icons.py
flexx/ui/examples/icons.py
# doc-export: Icons """ This example demonstrates the use of icons in Flexx. """ import os import flexx from flexx import app, ui # todo: support icons in widgets like Button, TabWidget, etc. # todo: support fontawesome icons class Icons(ui.Widget): def init(self): ui.Button(text='Not mu...
Python
0
5e574a24d95e686bc2592af439e148e68036c61d
Add unit test for nova connector
tests/unit/cloud/clouds/nova_test.py
tests/unit/cloud/clouds/nova_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Bo Maryniuk <bo@suse.de>` ''' # Import Python libs from __future__ import absolute_import # Import Salt Testing Libs from salttesting import TestCase from salt.cloud.clouds import nova from salttesting.mock import MagicMock, patch from tests.unit.cloud.clouds impor...
Python
0
e6a7fa5412f5bde58345491011336d74723170a2
Add script to generate relabeled HDF5 volume
toolbox/json_result_to_labelimage.py
toolbox/json_result_to_labelimage.py
import argparse import h5py import vigra from vigra import numpy as np import sys import json sys.path.append('.') from progressbar import ProgressBar def get_uuid_to_traxel_map(traxelIdPerTimestepToUniqueIdMap): timesteps = [t for t in traxelIdPerTimestepToUniqueIdMap.keys()] uuidToTraxelMap = {} for t in...
Python
0
2b8ff3b38e4f8bdc9da30c7978062174b0259f76
Add lc0068_text_justification.py
lc0068_text_justification.py
lc0068_text_justification.py
"""Leetcode 68. Text Justification Hard URL: https://leetcode.com/problems/text-justification/ Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified. You should pack your words in a greedy approach; that is, pack as m...
Python
0.000002
63a8f4af91048d0847cb7628f2ea15bb2b5f0e0a
Add abstract base classes to fs.archive
fs/archive/base.py
fs/archive/base.py
# coding: utf-8 from __future__ import absolute_import from __future__ import unicode_literals import os import io import abc import six import shutil import tempfile from .. import errors from ..base import FS from ..proxy.writer import ProxyWriter @six.add_metaclass(abc.ABCMeta) class ArchiveSaver(object): ...
Python
0.000001
ed463c7ea52bea26d724ee372fbd7319bfee8e1f
add preprocessor
src/preprocessor.py
src/preprocessor.py
#! /usr/bin/python import os import re import sys try: from cStringIO import StringIO except: from StringIO import StringIO def process(input_file): invalidchar = ('\t') blockcomment = ['#{','}#'] stack = [0] output = StringIO() newindent = False commented = False linejoin = False debug = Fal...
Python
0.000059
8fe5e768f20abfdd790870075950b6537c5cad6a
Add class containing test state and report + print methods
ptest.py
ptest.py
#!/usr/bin/python3 from sys import exit class Ptest(object): def __init__(self, module_name): self.module_name = module_name self.passed = 0 self.failed = 0 print('\nRunning tests for module "', module_name, '"', sep='') def report(self, test_name, test_result): if t...
Python
0
20375ca41cce0ee6a9a22bfe6faa766ab6db53fc
add tests for coordinate rounding and basic pen commands
Lib/fontTools/pens/t2CharStringPen_test.py
Lib/fontTools/pens/t2CharStringPen_test.py
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * from fontTools.pens.t2CharStringPen import T2CharStringPen import unittest class T2CharStringPenTest(unittest.TestCase): def assertAlmostEqualProgram(self, expected, actual): self.assertEqual(len(expected),...
Python
0
1669f9a3a9fabc2ded8fa92542dca65036c201e5
Create sizes.py
plantcv/plantcv/visualize/sizes.py
plantcv/plantcv/visualize/sizes.py
# Visualize an annotated image with object sizes import os import cv2 import random import numpy as np from plantcv.plantcv import params from plantcv.plantcv import plot_image from plantcv.plantcv import print_image from plantcv.plantcv import find_objects from plantcv.plantcv import color_palette def sizes(img, ma...
Python
0.000001
e03ecf68055e820106172413967713f98f7905ac
copy api_util to client to make it self-contained
net/client/api_util.py
net/client/api_util.py
import simplejson def json2python(json): try: return simplejson.loads(json) except: pass return None python2json = simplejson.dumps
Python
0.000001
addc7f33af75070333369a01c71e8acd231376ba
Add FilterNotifier for keyword based notification filtering
reconbot/notifiers/filter.py
reconbot/notifiers/filter.py
class FilterNotifier: """ Filters notifications based on their type or keywords """ def __init__(self, notifier, keywords=[], ignore=[]): self.notifier = notifier self.keywords = keywords self.ignore = ignore def notify(self, text, options={}): if len(self.ignore) > 0 and an...
Python
0
b09b11de1a025196cceb1c8fd71bda5515437a10
Add max31855 example driver
sw/examples/drivers/max31855.py
sw/examples/drivers/max31855.py
#!/usr/bin/env python # # SPI example (using the STM32F407 discovery board) # import sys import time import ctypes from silta import stm32f407 def bytes_to_int(byte_list): num = 0 for byte in range(len(byte_list)): num += byte_list[byte] << ((len(byte_list) - 1 - byte) * 8) return num class MA...
Python
0
a15e363718ab41c5e02b9eaa919fb689cd266af6
Add common module for our tests
nose2/tests/_common.py
nose2/tests/_common.py
"""Common functionality.""" import os.path import tempfile import shutil import sys class TestCase(unittest2.TestCase): """TestCase extension. If the class variable _RUN_IN_TEMP is True (default: False), tests will be performed in a temporary directory, which is deleted afterwards. """ ...
Python
0
b802f1d5453840ea4b16113d5d03f6c27224ce0c
Add try/except example.
examples/try.py
examples/try.py
# Honeybadger for Python # https://github.com/honeybadger-io/honeybadger-python # # This file is an example of how to catch an exception in Python and report it # to Honeybadger without re-raising. To run this example: # $ pip install honeybadger # $ HONEYBADGER_API_KEY=your-api-key python try.py from honeybadger impo...
Python
0
f81d32b0ec19c2f370df31ec4d86b1c735d414cf
Create extract_all_features.py
preprocess/extract_all_features.py
preprocess/extract_all_features.py
import os from scipy.io import loadmat from skimage.color import rgb2gray from numpy import array, vstack, reshape, delete from skimage.feature import local_binary_pattern from skimage.feature import hog from skimage.filters import sobel_h,sobel_v from scipy.io import savemat from sklearn.metrics import precision_...
Python
0
6bbef11c982ddee4981318e6bca9fa85610f1cc8
Increase revision content lenght
src/ggrc/migrations/versions/20170112112254_177a979b230a_update_revision_content_field.py
src/ggrc/migrations/versions/20170112112254_177a979b230a_update_revision_content_field.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Update revision content field. Create Date: 2017-01-12 11:22:54.998164 """ # disable Invalid constant name pylint warning for mandatory Alembic variables. # pylint: disable=invalid-name import sqlalche...
Python
0
eb4fbb28ed06b223282b02bb31f5f91e1eeb3f9f
Add RenormalizeWeight callback
seya/callbacks.py
seya/callbacks.py
import numpy as np from keras.callbacks import Callback class RenormalizeWeight(Callback): def __init__(self, W): Callback.__init__(self) self.W = W self.W_shape = self.W.get_value().shape def on_batch_start(self, batch, logs={}): W = self.W.get_value() if self.W_shape...
Python
0
c575f030feb90d3c6383d11265fcf7f80414ce34
Add an example hook script for checking valid commits
contrib/check-valid-commit.py
contrib/check-valid-commit.py
#!/usr/bin/env python import commands import getopt import sys SSH_USER = 'bot' SSH_HOST = 'localhost' SSH_PORT = 29418 SSH_COMMAND = 'ssh %s@%s -p %d gerrit approve ' % (SSH_USER, SSH_HOST, SSH_PORT) FAILURE_SCORE = '--code-review=-2' FAILURE_MESSAGE = 'This commit message does not match the standard.' \ + '...
Python
0
1f1d2df36a16b80c770974a9ac2bf48ccbebc3ab
add callable list
jasily/collection/funcs.py
jasily/collection/funcs.py
# -*- coding: utf-8 -*- # # Copyright (c) 2018~2999 - Cologler <skyoflw@gmail.com> # ---------- # # ---------- from functools import partial class CallableList(list): ''' a simple callable list. ''' def __call__(self): ret = None for func in self: ret = func() retu...
Python
0.000002
bb925f03cbbb3b4a6f9abfa70c3f6df7a4f0ae16
Add script to update perf_expectations.json.
tools/perf_expectations/make_expectations.py
tools/perf_expectations/make_expectations.py
#!/usr/bin/python # Copyright (c) 2010 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import math import optparse import re import simplejson import subprocess import sys import time import urllib2 __version__ = '1.0' ...
Python
0.00012
467170482c97c3b586d58c4729d051c1b1b99f3d
Add sentence level classifier.
actionizer_sentences.py
actionizer_sentences.py
#! /usr/bin/python import numpy as np import os import re from sklearn import datasets, cross_validation from sklearn.base import TransformerMixin from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.metrics import classification_report f...
Python
0.999983
5350af9b80e6317c6c5c65720216c8e539194e87
Add account test file
tests/jcl/model/test_account.py
tests/jcl/model/test_account.py
## ## test_account.py ## Login : David Rousselie <dax@happycoders.org> ## Started on Wed Nov 22 19:32:53 2006 David Rousselie ## $Id$ ## ## Copyright (C) 2006 David Rousselie ## 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...
Python
0.000001
44b6b0ff5efc6d9fcda4f886640663b68e7d6c14
Add initial code for getting batting stats over a specified timeframe
pybaseball/league_batting_stats.py
pybaseball/league_batting_stats.py
""" TODO pull batting stats over specified time period allow option to get stats for full seasons instead of ranges """ import requests import pandas as pd from bs4 import BeautifulSoup def get_soup(start_dt, end_dt): # get most recent standings if date not specified if((start_dt is None) or (end_dt is None)): ...
Python
0
072423365ad1c03dd593f5b8528a7b60c0c9bee9
Add AuctionHouse table.
pydarkstar/tables/auction_house.py
pydarkstar/tables/auction_house.py
""" .. moduleauthor:: Adam Gagorik <adam.gagorik@gmail.com> """ from sqlalchemy import Column, Integer, SmallInteger, String, text from pydarkstar.tables.base import Base class AuctionHouse(Base): __tablename__ = 'auction_house' id = Column(Integer, primary_key=True) itemid = Column(SmallInt...
Python
0
2cf3694ac4f5a5920a65e9b4b914262e7e375500
1-4. MNIST-Classification with softmax function
mnist.py
mnist.py
# tensorflow를 사용할 것이기에 import 합니다. import tensorflow as tf # MNIST data를 받아옵니다. MNIST data는 0~9까지의 숫자들 입니다. # 본 Code에서는 MNIST data를 학습하고 새로운 입력(숫자)를 판단해내는 방법을 설명합니다. from tensorflow.examples.tutorials.mnist import input_data # one-hot encoding을 합니다. 예를들어 숫자가 1이라면 [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] 이 됩니다. # 숫자가 2라면 [0, 1...
Python
0.999571
f85f6ba07c47a6ccbd38a9e7bc2e9a2c69ebd09a
read senor values from rpi
pythonLib/ArduinoMoistureSensor.py
pythonLib/ArduinoMoistureSensor.py
import smbus import time bus = smbus.SMBus(1) address = int(sys.argv[1]) data = bus.read_i2c_block_data(address,0) for i in range (0,6): print (data[2*i] << 8)+ data[2*i+1]
Python
0.000001
47d7cfcd9db1a54e52532819895060527e1988b9
update qlcoder
qlcoder/scheme_study/functional.py
qlcoder/scheme_study/functional.py
if __name__ == '__main__': my_arr = [None] * 7654321 for i in range(0, 7654321): my_arr[i]=i
Python
0.000001
7618697cdb892388d7c5ddb731f5b9f138389ca4
add A4
A4/TestHashtable.py
A4/TestHashtable.py
#!/usr/bin/env python2 from hashtable import Hashtable, LinkedList, hashFunction import unittest import collections class TestHashtable(unittest.TestCase): def setUp(self): buildings = { "CSCI" : "McGlothlin-Street", "GSWS" : "Tucker", "ENGL" : "Tucker", "...
Python
0.999996
c26b20a44c47474f88c8f155b36c8c6f0dcfd072
Move packet processing into its own class
innovate/packet.py
innovate/packet.py
"""One data packet in Innovate Serial Protocol version 2 (ISP2). For data format specifications, see http://www.innovatemotorsports.com/support/downloads/Seriallog-2.pdf """ import struct class InnovatePacket(object): """An packet in the Innovate Serial Protocol version 2 (ISP2). ISP2 packets are composed ...
Python
0
d635a60140c11c64db4ac887bc79396484bb55e3
Add model_utils.print_graph_layer_shapes to handle Graph models. Also handle Merge layers
keras/utils/model_utils.py
keras/utils/model_utils.py
from __future__ import print_function import numpy as np import theano def print_graph_layer_shapes(graph, input_shapes): """ Utility function to print the shape of the output at each layer of a Graph Arguments: graph: An instance of models.Graph input_shapes: A dict that gives a shape for...
from __future__ import print_function import numpy as np import theano def print_layer_shapes(model, input_shape): """ Utility function that prints the shape of the output at each layer. Arguments: model: An instance of models.Model input_shape: The shape of the input you will provide to ...
Python
0
f379160e56a94359d9571ea1b1db1f7544677a57
Fix reference to `latestEvent` in tests.
tests/sentry/api/serializers/test_grouphash.py
tests/sentry/api/serializers/test_grouphash.py
from __future__ import absolute_import from sentry.api.serializers import serialize from sentry.models import Event, GroupHash from sentry.testutils import TestCase class GroupHashSerializerTest(TestCase): def test_no_latest_event(self): user = self.create_user() group = self.create_group() ...
from __future__ import absolute_import from sentry.api.serializers import serialize from sentry.models import Event, GroupHash from sentry.testutils import TestCase class GroupHashSerializerTest(TestCase): def test_no_latest_event(self): user = self.create_user() group = self.create_group() ...
Python
0
91e04b558b95aa21d5f7c730fc8355e5413ab83c
Use values and values_list in API closes #433
judge/views/api.py
judge/views/api.py
from operator import attrgetter from django.db.models import Prefetch from django.http import JsonResponse, Http404 from django.shortcuts import get_object_or_404 from dmoj import settings from judge.models import Contest, Problem, Profile, Submission, ContestTag def sane_time_repr(delta): days = delta.days ...
from operator import attrgetter from django.db.models import Prefetch from django.http import JsonResponse, Http404 from django.shortcuts import get_object_or_404 from dmoj import settings from judge.models import Contest, Problem, Profile, Submission, ContestTag def sane_time_repr(delta): days = delta.days ...
Python
0
db13f88055d5ea2357ecc4b996f80d3392655516
Create parse.py
parse.py
parse.py
__version__ = "1.0" import os from ciscoconfparse import CiscoConfParse # ----------------------------------------------- # Create the db dictionary to store all records # ----------------------------------------------- db = {} # ---------------------------------------------------------------- # Update the dictionary...
Python
0.00002
bee35885bb845ea77aa4586bca33da3e54b92ed2
Add `albumtypes` plugin
beetsplug/albumtypes.py
beetsplug/albumtypes.py
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2021, Edgars Supe. # # 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...
Python
0.000001
f859eb67fdc66b930c3664a3586c454f5c9afe87
Add files via upload
subunits/blink.py
subunits/blink.py
from nanpy import ArduinoApi from nanpy import SerialManager from time import sleep link = SerialManager(device='/dev/ttyACM0') A = ArduinoApi(connection=link) led = 13 # SETUP: A.pinMode(led, A.OUTPUT) # LOOP: while True: A.digitalWrite(led, A.HIGH) # turn the LED on (HIGH is the voltage level) ...
Python
0
a11cee952e1abc7e7310b760c8a4845c4f46fbae
add date_range.py
date_range.py
date_range.py
from sqlalchemy.dialects.postgresql import JSONB from sqlalchemy.orm import deferred from sqlalchemy import or_ from sqlalchemy import sql from sqlalchemy import text from sqlalchemy import orm import requests from time import sleep from time import time import datetime import shortuuid from urllib import quote from a...
Python
0.000905
7d258bdb68119ad54a69e92ac7c7c1c2fc51e087
Create scrap.py
scrap.py
scrap.py
#!usr/bin/env python import requests from bs4 import BeautifulSoup uri = requests.get("http://video9.in/english/") soup=BeautifulSoup(url.text) for link in soup.find_all("div",{"class": "updates"}): print link.text
Python
0.000001
2aae4701fd98f560e7e112084f47f66515f6f574
Add setup.py
setup.py
setup.py
from setuptools import setup, find_packages import go_nogo_rig setup( name='Go-NoGo', version=go_nogo_rig.__version__, packages=find_packages(), install_requires=['moa', 'pybarst', 'moadevs'], author='Matthew Einhorn', author_email='moiein2000@gmail.com', url='https://cpl.cornell.edu/', ...
Python
0.000001
7ae1d4b99e2354f76bed894493281d4885d97f34
Add newer template rendering code
cms/test_utils/project/placeholderapp/views.py
cms/test_utils/project/placeholderapp/views.py
from django.http import HttpResponse from django.shortcuts import render from django.template import RequestContext from django.template.base import Template from django.views.generic import DetailView from cms.test_utils.project.placeholderapp.models import ( Example1, MultilingualExample1, CharPksExample) from cm...
from django.http import HttpResponse from django.shortcuts import render from django.template import RequestContext from django.template.base import Template from django.views.generic import DetailView from cms.test_utils.project.placeholderapp.models import ( Example1, MultilingualExample1, CharPksExample) from cm...
Python
0
aef67e19a3494880620fd87a68ff581edaa9ce81
Add unittest for madx.evaluate
test/test_madx.py
test/test_madx.py
import unittest from cern.madx import madx from math import pi class TestMadX(unittest.TestCase): """Test methods of the madx class.""" def setUp(self): self.madx = madx() def tearDown(self): del self.madx def testEvaluate(self): self.madx.command("FOO = PI*3;") val =...
Python
0.000001
0a55f6f2bf49c679a422d44007df3f66c323e719
mask unit test
test/test_mask.py
test/test_mask.py
import numpy as np from minimask.mask import Mask from minimask.spherical_poly import spherical_polygon def test_mask_sample(): """ """ vertices = [[0,0],[10,0],[10,10],[0,10]] S = spherical_polygon(vertices) M = Mask(polys=[S], fullsky=False) x,y = M.sample(100) assert len(x) == 1000 a...
Python
0
25495d675c44a75d7dedfe123f30a858f9cd60be
Add minimal (no asserts) test for play plugin
test/test_play.py
test/test_play.py
# -*- coding: utf-8 -*- """Tests for the play plugin""" from __future__ import (division, absolute_import, print_function, unicode_literals) from mock import patch, Mock from test._common import unittest from test.helper import TestHelper from beetsplug.play import PlayPlugin class PlayPl...
Python
0.000001
b3ad7a7735d55a91682ea6798e6ebcfcf94b1969
287. Find the Duplicate Number. Brent's
p287_brent.py
p287_brent.py
import unittest class Solution(object): def findDuplicate(self, nums): """ :type nums: List[int] :rtype: int """ t = nums[0] h = nums[t] max_loop_length = 1 loop_length = 1 while t != h: if loop_length == max_loop_length: ...
Python
0.999999
83d00fea8adf611984c3b56a63f080f144612c69
Create data_tool.py
data_tool.py
data_tool.py
#!/usr/bin/python # -*- coding:utf-8 -*- import pickle import random def load_data(): with open('dataset.pkl', 'r') as file: data_set = pickle.load(file) return data_set def feature_format(data_set): features = [] labels = [] for item in data_set: features.append(item[:-1]) ...
Python
0.000001
c488e446aee3d28fa84bb24d446ca22af20e461c
Add setup.py
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages def lt27(): import sys v = sys.version_info return (v[0], v[1]) < (2, 7) tests_require = [ 'nose>=1.0', 'mock', ] if lt27(): tests_require.append('unittest2') setup( name='dynsupdate', description='Dynamic DNS ...
Python
0.000001
6d3a9f41bec03405fa648ce169b9565f937e4598
add setup.py
setup.py
setup.py
from setuptools import setup setup( name="timekeeper", version="0.1.0", description="Send runtime measurements of your code to InfluxDB", author="Torsten Rehn", author_email="torsten@rehn.email", license="ISC", url="https://github.com/trehn/timekeeper", keywords=["profiling", "profile"...
Python
0.000001
bc9401da60e8f10827f37772af937d4fb11ca248
Add PyPI setup.py file
setup.py
setup.py
try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='component', author='Daniel Chatfield', author_email='chatfielddaniel@gmail.com', version='0.0.1', url='http://github.com/import/component', py_modules=['component'], description='A p...
Python
0.000001