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
921b0adf8b93ccad54eb0a82e42ff4b742e176db
Add label_wav_dir.py (#14847)
tensorflow/examples/speech_commands/label_wav_dir.py
tensorflow/examples/speech_commands/label_wav_dir.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Python
0.000002
a3a48824b36ef62edaf128379f1baec5482166e7
Save error_message for resources (SAAS-982)
src/nodeconductor_saltstack/migrations/0005_resource_error_message.py
src/nodeconductor_saltstack/migrations/0005_resource_error_message.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('nodeconductor_saltstack', '0004_remove_useless_spl_fields'), ] operations = [ migrations.AddField( model_name='d...
Python
0
bfb51cadc66f34a67686bef3b15e9197c9d0617b
Create ping_help.py
ping_help.py
ping_help.py
import time import subprocess import os hostname=raw_input('') #while 1: os.system("ping -c 10 -i 5 " + hostname + " >1.txt") os.system("awk -F'[= ]' '{print $6,$10}' < 1.txt >final.txt") os.system("grep [0-9] final.txt >final1.txt")
Python
0.000023
dacffcb3e79877e1ea5e71d1a2e67bd4edd865bf
Add SettingOverrideModel that exposes a SettingOverrideDecorator to QML
plugins/Tools/PerObjectSettingsTool/SettingOverrideModel.py
plugins/Tools/PerObjectSettingsTool/SettingOverrideModel.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from PyQt5.QtCore import Qt, pyqtSlot, QUrl from UM.Application import Application from UM.Qt.ListModel import ListModel class SettingOverrideModel(ListModel): KeyRole = Qt.UserRole + 1 LabelRole = Qt.UserRole ...
Python
0
3652f1c666f3bf482862727838f0b4bbc9fea5e9
fix bug 1076270 - add support for Windows 10
alembic/versions/17e83fdeb135_bug_1076270_support_windows_10.py
alembic/versions/17e83fdeb135_bug_1076270_support_windows_10.py
"""bug 1076270 - support windows 10 Revision ID: 17e83fdeb135 Revises: 52dbc7357409 Create Date: 2014-10-03 14:03:29.837940 """ # revision identifiers, used by Alembic. revision = '17e83fdeb135' down_revision = '52dbc7357409' from alembic import op from socorro.lib import citexttype, jsontype, buildtype from socorr...
Python
0
dcdd783859da957ae92c04fd22fcb70c48d3144f
Create MultipartPostHandler.py
Slack.indigoPlugin/Contents/Server-Plugin/MultipartPostHandler.py
Slack.indigoPlugin/Contents/Server-Plugin/MultipartPostHandler.py
#!/usr/bin/python #### # 02/2006 Will Holcomb <wholcomb@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later ve...
Python
0
f5ada694fae30f15498c775e8c4aa14a08459251
Add slogan plugin
plugins/slogan.py
plugins/slogan.py
import re import requests import urllib.parse class Plugin: def __call__(self, bot): bot.on_respond(r"slogan(?:ise)? (.*)$", self.on_respond) bot.on_help("slogan", self.on_help) def on_respond(self, bot, msg, reply): url = "http://www.sloganizer.net/en/outbound.php?slogan={0}".format(u...
Python
0.000001
779fb015913a17fcb8fb290515845e6b47c3ae50
Create the converter (with span-conversion functionality)
latex2markdown.py
latex2markdown.py
""" A Very simple tool to convert latex documents to markdown documents """ import re span_substitutions = [ (r'\\emph\{(.+)\}', r'*\1*'), (r'\\textbf\{(.+)\}', r'**\1**'), (r'\\verb;(.+);', r'`\1`'), (r'\\includegraphics\{(.+)\}', r'![](\1)'), ] def convert_span_elements(line...
Python
0
2fdabf544c75096efafe2d14988efa28619643ab
add scheme
app/scheme_mongodb.py
app/scheme_mongodb.py
import pymongo import bson from bson import json_util import warnings from cStringIO import StringIO from pymongo import Connection, uri_parser import bson.son as son import json import logging def open(url=None, task=None): #parses a mongodb uri and returns the database #"mongodb://localhost/test.in?query='{"...
Python
0.000032
ea06c46d0c79846fada6175dff7ea085ed9fed7d
Add test script for sv_comp
run_benchmark.py
run_benchmark.py
#!/usr/bin/env python """Usage: run_benchmark.py <symdivine_dir> <benchmark> [options] Arguments: <benchmark> input *.i file <symdivine_dir> location of symdivine Options: --cheapsimplify Use only cheap simplification methods --dontsimplify Disable simplification --disabletimeout...
Python
0
03ad7302f75ea5de0870c798ec70f1a1912288ca
Add main.py file Description for 'hello! hosvik'
src/main.py
src/main.py
import sys print(sys.platform); print('Hello hosvik!')
Python
0.000001
054c75ce1a63732be7a58ec1150e9f8aaff2aedb
Create test.py
plugins/test.py
plugins/test.py
@bot.message_handler(commands=['test', 'toast']) def send_test(message): bot.send_message(message.chat.id, TEST_MSG.encode("utf-8"))
Python
0.000005
5c9ffaaa8e244bb9db627a0408258750cc0e81d6
Create ping.py
src/ping.py
src/ping.py
nisse
Python
0.000003
1473e0f4f1949349ef7212e0755fa8ffa6401cbe
Create process_htk_mlf_zh.py
process_htk_mlf_zh.py
process_htk_mlf_zh.py
#!/usr/bin/env python # # This script reads in a HTK MLF format label file and converts the # encoded contents to GBK encoding. # import string, codecs fin=open('vom_utt_wlab.mlf') fout=codecs.open('vom_utt_wlab.gbk.mlf', encoding='gbk', mode='w') while True: sr=fin.readline() if sr=='':break sr=sr.strip(...
Python
0
c8c807cfcb4422edc0e2dbe3a4673a62fa37cbfa
Add extra migration triggered by updated django / parler (#501)
djangocms_blog/migrations/0037_auto_20190806_0743.py
djangocms_blog/migrations/0037_auto_20190806_0743.py
# Generated by Django 2.1.11 on 2019-08-06 05:43 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import parler.fields import taggit_autosuggest.managers class Migration(migrations.Migration): dependencies = [ ('djangocms_blog', '0036_auto_201809...
Python
0
e082c803bf5ce31c4948d0d512e9ec0366cf0adc
Create politeusersbot.py
politeusersbot.py
politeusersbot.py
#Polite Users Bot created by Kooldawgstar import praw from time import sleep import random USERNAME = "USERNAME" PASSWORD = "PASSWORD" LIMIT = 100 RESPONSES = ["Thanks for being a nice user and thanking people for help!", "Thank you for being a nice user and thanking people for help!", ] res...
Python
0.00002
94481f656690956b2a4eb5a1227948d24ba4cc05
Add actual command line python function (#7)
bin/CCDSingleEpochStile.py
bin/CCDSingleEpochStile.py
#!/usr/bin/env python from stile.lsst.base_tasks import CCDSingleEpochStileTask CCDSingleEpochStileTask.parseAndRun()
Python
0.00002
225d5232cca6bb42e39959b2330758225a748477
add little script to retrieve URLs to PS1-DR1 images
py/legacyanalysis/get-ps1-skycells.py
py/legacyanalysis/get-ps1-skycells.py
import requests from astrometry.util.fits import * from astrometry.util.multiproc import * def get_cell((skycell, subcell)): url = 'http://ps1images.stsci.edu/cgi-bin/ps1filenames.py?skycell=%i.%03i' % (skycell, subcell) print('Getting', url) r = requests.get(url) lines = r.text.split('\n') #assert...
Python
0
0f5ecc42485d4f0e89fbe202b57a2e7735ea69cc
Create product_images.py
product_images.py
product_images.py
from openerp.osv import osv, fields class product_template(osv.Model): _inherit = 'product.template' _columns = { 'x_secondpicture': fields.binary("Second Image", help="This field holds the second image used as image for the product, limited to 1024x1024px."), } product_template()
Python
0.000012
e81f6e01ac55723e015c4d7d9d8f61467378325a
Add autoincrement to ZUPC.id
migrations/versions/e187aca7c77a_zupc_id_autoincrement.py
migrations/versions/e187aca7c77a_zupc_id_autoincrement.py
"""ZUPC.id autoincrement Revision ID: e187aca7c77a Revises: ccd5b0142a76 Create Date: 2019-10-21 14:01:10.406983 """ # revision identifiers, used by Alembic. revision = 'e187aca7c77a' down_revision = '86b41c3dbd00' from alembic import op from sqlalchemy.dialects import postgresql from sqlalchemy.schema import Seque...
Python
0.00001
cc8b3f8a7fb6af29f16d47e4e4caf56f17605325
Add command handler.
src/server/commandHandler.py
src/server/commandHandler.py
from src.shared.encode import decodePosition class CommandHandler(object): def __init__(self, gameState, connectionManager): self.gameState = gameState self.connectionManager = connectionManager def broadcastMessage(self, *args, **kwargs): self.connectionManager.broadcastMessage(*args...
Python
0
be67baac2314408b295bddba3e5e4b2ca9bfd262
Add ffs.exceptions
ffs/exceptions.py
ffs/exceptions.py
""" ffs.exceptions Base and definitions for all exceptions raised by FFS """ class Error(Exception): "Base Error class for FFS" class DoesNotExistError(Error): "Something should have been here"
Python
0.00354
2737e1d46263eff554219a5fa5bad060b8f219d3
Add CLI script for scoring huk-a-buk.
score_hukabuk.py
score_hukabuk.py
import json import os import time DATA = {'turns': {}} class Settings(object): FILENAME = None CURRENT_TURN = 0 NAME_CHOICES = None def set_filename(): filename = raw_input('Set the filename? ').strip() if not filename: filename = str(int(time.time())) Settings.FILENAME = filename ...
Python
0
7f64a56a17fc6d73da4ac2987d42931885925db0
Create server.py
server/server.py
server/server.py
import http.server import socketserver PORT = 80 Handler = http.server.SimpleHTTPRequestHandler httpd = socketserver.TCPServer(("", PORT), Handler) httpd.serve_forever()
Python
0.000001
d599e5a35d4ac056dbefa8ec8af6c8be242c12f1
Add test case for input pipeline.
linen_examples/wmt/input_pipeline_test.py
linen_examples/wmt/input_pipeline_test.py
# Copyright 2021 The Flax Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
Python
0.998969
be6997772bd7e39dd1f68d96b3d52a82372ad216
update migartions
tracpro/supervisors/migrations/0002_auto_20141102_2231.py
tracpro/supervisors/migrations/0002_auto_20141102_2231.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('supervisors', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='supervisor', opt...
Python
0
0ccca70cf289fb219768d1a124cacf11396a0ecc
Add files via upload
src/pque.py
src/pque.py
class Pque(object): """make as priority queue priority scale is 0 through -99 0 has greatest priority with ties being first come first pop""" def __init__(self): self.next_node = None self.priority = 0 self.value = None self.tail = None self.head = None s...
Python
0
06235d5913cd5eb54d3767f6a7cf60acb1966b39
Create prettyrpc.py
prettyrpc.py
prettyrpc.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from xmlrpclib import ServerProxy class PrettyProxy(object): def __init__(self, *args, **kwargs): self._real_proxy = ServerProxy(*args, **kwargs) def __getattr__(self, name): return lambda *args, **kwargs: getattr(self._real_proxy, name)(args, kwa...
Python
0
38faa038cbc7b8cedbb2dc13c2760f2a270a5f1a
Create problem-5.py
problem-5.py
problem-5.py
n = 0 while True: n += 1 divisible_list = [] for i in range(1,21): is_divisible = (n % i == 0) if is_divisible: divisible_list.append(is_divisible) else: break if len(divisible_list) == 20: break print(n)
Python
0.000911
d326391f6412afb54ee05a02b3b11e075f703765
fix value < 0 or higher than max. closes #941
kivy/uix/progressbar.py
kivy/uix/progressbar.py
''' Progress Bar ============ .. versionadded:: 1.0.8 .. image:: images/progressbar.jpg :align: right The :class:`ProgressBar` widget is used to visualize progress of some task. Only horizontal mode is supported, vertical mode is not available yet. The progress bar has no interactive elements, It is a display-o...
''' Progress Bar ============ .. versionadded:: 1.0.8 .. image:: images/progressbar.jpg :align: right The :class:`ProgressBar` widget is used to visualize progress of some task. Only horizontal mode is supported, vertical mode is not available yet. The progress bar has no interactive elements, It is a display-o...
Python
0.000019
5e2e5eed760fdc40d474e511662cf7c22b1ea29b
add usbwatch.py
usbwatch.py
usbwatch.py
#!/usr/bin/env python3 # usbwatch.py - monitor addition/removal of USB devices # # import pyudev class UsbDevice: @staticmethod def fromUdevDevice(udev): attr = lambda name: udev.attributes.asstring(name) try: try: manufacturer = attr('manufacturer') except KeyError: manufactur...
Python
0.000003
4380a8492698d389cf070ea5c7d76a9c4664a8ac
Add a script to produce mmcif file of stats from crystfel log files Commit ad3700e8
yamtbx/dataproc/crystfel/command_line/stats_mmcif.py
yamtbx/dataproc/crystfel/command_line/stats_mmcif.py
def parse_dat(f_in, ret): ifs = open(f_in) first = ifs.readline() if first.startswith(" 1/d centre"): key = "" if "Rsplit/%" in first: key = "table_rsplit" elif first.split()[2] == "CC": key = "table_cc" else: return None if key i...
Python
0
ac7c3ccfdbd02eed6b2b7070160ef08f725c3578
test migration
migrations/versions/5dc51870eece_initial_migration.py
migrations/versions/5dc51870eece_initial_migration.py
"""initial migration Revision ID: 5dc51870eece Revises: None Create Date: 2016-08-19 03:16:41.577553 """ # revision identifiers, used by Alembic. revision = '5dc51870eece' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust!...
Python
0.000001
61a4d783f2c16a7b8f4fbf5a79f9588c58c8f618
Add a serial port emulation module for debug/development use
systemd/emulator_serialport.py
systemd/emulator_serialport.py
class SerialPortEmurator: def __init__(self): self.res = { 'AT+CGDCONT?': [ "(ECHO_BACK)", "", "", "+CGDCONT: 1,\"IPV4V6\",\"access_point_name\",\"0.0.0.0\",0,0", "", "OK", "" ], 'AT$QCPDPP?': [ "(ECHO_BACK)", "", "...
Python
0
c85d867614ae9cd4e21a912acee83bdd9cf5cb8e
Create pypylayer.py
pypylayer.py
pypylayer.py
import subprocess import atexit import os import functools import time import select import sys try: import queue except ImportError: import Queue as queue class MPlayerCasting(object): types = { "Flag": bool, "Integer": int, "Position": int, "Float": float, "Time...
Python
0.000026
144541a563a4f05a762aea82f39bdd63f33c19d5
Add tests for new membrane
tartpy/tests/test_membrane2.py
tartpy/tests/test_membrane2.py
import pytest from tartpy.runtime import SimpleRuntime, behavior from tartpy.eventloop import EventLoop from tartpy.membrane2 import Membrane def test_membrane_protocol(): runtime = SimpleRuntime() evloop = EventLoop() m1 = Membrane({'protocol': 'membrane'}, runtime) m2 = Membrane({'protocol': '...
Python
0
9c2be5533dc14443a67ed22c34e2f059992e43cb
Create camera.py
Camera/camera.py
Camera/camera.py
from SimpleCV import Camera # Initialize the camera cam = Camera() # Loop to continuously get images while True: # Get Image from camera img = cam.getImage() # Make image black and white img = img.binarize() # Draw the text "Hello World" on image img.drawText("Hello World!") # Show the image...
Python
0.000002
6014dab06ed2275c5703ab9f9e63272656733c69
Add retrieve_all_pages util method from mtp-cashbook
moj_utils/rest.py
moj_utils/rest.py
from django.conf import settings def retrieve_all_pages(api_endpoint, **kwargs): """ Some MTP apis are paginated, this method loads all pages into a single results list :param api_endpoint: slumber callable, e.g. `[api_client].cashbook.transactions.locked.get` :param kwargs: additional arguments to pa...
Python
0
8d10e0e2db81023cb435b047f5c1da793e4b992e
Add python/matplotlib_.py
python/matplotlib_.py
python/matplotlib_.py
# matplotlib_.py # Imports from matplotlib import ticker # label_axis def label_axis(ax, x_or_y, axis_labels, flip, **props): axis_ticks = range(0, len(axis_labels)) axis = getattr(ax, '%saxis' % x_or_y) axis.set_major_locator(ticker.FixedLocator(axis_ticks)) axis.set_minor_locator(ticker.Nu...
Python
0.00352
de6d7c2531f59d407864c737468ae50de38ba9ac
Add some spanish bad words
revscoring/languages/spanish.regex.py
revscoring/languages/spanish.regex.py
# import re # import warnings # import enchant # from nltk.corpus import stopwords # from nltk.stem.snowball import SnowballStemmer # from .language import Language, LanguageUtility # STEMMER = SnowballStemmer("english") # STOPWORDS = set(stopwords.words('english')) BAD_REGEXES = set([ 'ano', 'bastardo', 'bo...
Python
0.999999
326ef75042fc1d3eeeb6834fd5ff80a2bd1a2be1
Add incoreect_regex.py solution
HackerRank/PYTHON/Errors_and_Exceptions/incoreect_regex.py
HackerRank/PYTHON/Errors_and_Exceptions/incoreect_regex.py
#!/usr/bin/env python3 import re if __name__ == '__main__': for _ in range(int(input())): try: re.compile(input()) print('True') except: print('False')
Python
0.000002
eea09f501e957ede24c8ca830fd488ebc34f3d9f
change question values based on answer for subtraction and division - related to issue #52
questions/migrations/0010_recompute_values.py
questions/migrations/0010_recompute_values.py
# -*- coding: utf-8 -*- import json from south.v2 import DataMigration class Migration(DataMigration): def forwards(self, orm): for q in orm.Question.objects.all(): if q.skill.level == 4 and (q.skill.parent.parent.name == "subtraction" or q.skill.parent.parent.name == "division"): ...
Python
0.000002
c675fe2a82733ef210bf287df277f8ae956a4295
Add beginning of main script
rarbg-get.py
rarbg-get.py
#!env /usr/bin/python3 import sys import urllib.parse import urllib.request def main(): search = sys.argv[1] url = 'http://rarbg.to/torrents.php?order=seeders&by=DESC&search=' url = url + search print(url) req = urllib.request.Request(url, headers={'User-Agent' : "Magic Browser"}) resp = urlli...
Python
0.000005
552f082168b0243cc3998a2027c326031879e869
add observables
robosuite/utils/observables.py
robosuite/utils/observables.py
import numpy as np from robosuite.utils.buffers import DelayBuffer class Observable: """ Base class for all observables -- defines interface for interacting with sensors Args: name (str): Name for this observable sensor (function): Method to grab raw sensor data for this observable. Shoul...
Python
0.00209
480ae590ea1116fdbb5c6601d7466408f274c433
Implement for GNOME activateAutoLoginCommand
src/nrvr/el/gnome.py
src/nrvr/el/gnome.py
#!/usr/bin/python """nrvr.el.gnome - Manipulate Enterprise Linux GNOME Classes provided by this module include * Gnome To be improved as needed. Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com> Public repository - https://github.com/srguiwiz/nrvr-commander Copyright (c) Nirvana Research 200...
Python
0.000001
d135f84307a9ff7225938f3fae5314b8b5fa3d40
add local store
rqbacktest/data/data_source.py
rqbacktest/data/data_source.py
import pytz import pandas as pd from ..instruments import Instrument class LocalDataSource: DAILY = 'daily.bcolz' INSTRUMENTS = 'instruments.pk' DIVIDEND = 'dividend.bcolz' TRADING_DATES = 'trading_dates.bcolz' YIELD_CURVE = 'yield_curve.bcolz' YIELD_CURVE_TENORS = { 0 : 'S0', ...
Python
0.000296
6affa7946bafc418423c8e1857c6f2b55066c31a
this will find all the primes below a given number
generateprimes.py
generateprimes.py
#!/usr/bin/env python 3.1 #doesn't work for numbers less than 4 from math import sqrt def nextprime(number): "This function will find the smallest prime larger than the current number" potential= number j=2 while j<=sqrt(potential): if potential%j: j=j+1 else: #print "not prime" potential=pot...
Python
0.999869
6d12624e094ec58118d39c4340438c4a814d404f
add wildcard, this is just a string contain problem
wildcard.py
wildcard.py
class Solution: # @param s, an input string # @param p, a pattern string # @return a boolean def shrink(self, pattern): shrinked = [] i = 0 while i < len(pattern): stars = 0 questions = 0 while i < len(pattern) and pattern[i] in ['*', '?']: ...
Python
0.000001
00c86aff808ecc5b6f015da5977265cfa76826bb
add fixtures that start related worker for tests
livewatch/tests/conftest.py
livewatch/tests/conftest.py
import pytest import time import django_rq from celery.signals import worker_ready from .celery import celery WORKER_READY = list() @worker_ready.connect def on_worker_ready(**kwargs): """Called when the Celery worker thread is ready to do work. This is to avoid race conditions since everything is in one ...
Python
0
275cddfa56501868787abeef10fc515102ffd11d
make setup.py find all packages, now in src
python/setup.py
python/setup.py
from distutils.core import setup from setuptools import find_packages setup(name='fancontrol', version='0.1.0', modules=['fancontrol'], packages=find_packages(where="src"), package_dir={"": "src"}, )
Python
0
a14ac8fb2f10124a4978db19049bdf932e91c49d
Add avahi based beacon for zeroconf announcement
salt/beacons/avahi_announce.py
salt/beacons/avahi_announce.py
# -*- coding: utf-8 -*- ''' Beacon to announce via avahi (zeroconf) ''' # Import Python libs from __future__ import absolute_import import logging # Import 3rd Party libs try: import avahi HAS_PYAVAHI = True except ImportError: HAS_PYAVAHI = False import dbus log = logging.getLogger(__name__) __virtual...
Python
0
9c5de3b667a8e98b0304fb64e30113f551b33404
Create getTwitterData.py
getTwitterData.py
getTwitterData.py
from tweepy import Stream from tweepy import OAuthHandler from tweepy.streaming import StreamListener import time ckey = 'dNATh8K9vGwlOSR2phVzaB9fh' csecret = 'LmBKfyfoZmK1uIu577yFR9jYkVDRC95CXcKZQBZ8jWx9qdS4Vt' atoken = '2165798475-nuQBGrTDeCgXTOneasqSFZLd3SppqAJDmXNq09V' asecret = 'FOVzgXM0NJO2lHFydFCiOXCZdkhHlYBkmP...
Python
0.000001
44cee3df6cf5a1ce567df3cec0298c3e5145a95d
Add script query-vector.py, generate vector for query/bidword from word-vector.tsv
query-vector.py
query-vector.py
#!/usr/bin/env python # -*- coding: utf-8 from sys import stdout from threading import Thread from codecs import open from json import loads from numpy import array, zeros, dot, sqrt from hashlib import md5 from argparse import ArgumentParser from progressbar import ProgressBar, Bar from relevence_db import * class ...
Python
0.000103
e84640c5c67759be3de1a934d974c250d7b73a0c
Split kernels into their own name space
scikits/statsmodels/sandbox/kernel.py
scikits/statsmodels/sandbox/kernel.py
# -*- coding: utf-8 -*- """ This models contains the Kernels for Kernel smoothing. Hopefully in the future they may be reused/extended for other kernel based method """ class Kernel(object): """ Generic 1D Kernel object. Can be constructed by selecting a standard named Kernel, or providing a lambda exp...
Python
0.999848
54187d401656061b0f17f2b84ab5a114c25e4137
add a scoring script used in the KDD'12 track2 example.
examples/kdd2012track2/scoreKDD.py
examples/kdd2012track2/scoreKDD.py
""" Scoring Metrics for KDD Cup 2012, Track 2 Reads in a solution/subission files Scores on the following three metrics: -NWMAE -WRMSE -AUC Author: Ben Hamner (kdd2012@benhamner.com) """ def scoreElementwiseMetric(num_clicks, num_impressions, predicted_ctr, elementwise_metric): """ Calculates an elementwise...
Python
0
632056eef0666808d16740f434a305d0c8995132
Create magooshScraper.py
magooshScraper.py
magooshScraper.py
import scrapy from bs4 import BeautifulSoup class magooshSpider(scrapy.Spider): name = 'magoosh' start_urls = ['http://gre.magoosh.com/login'] def parse(self, response): return scrapy.FormRequest.from_response( response, ''' Replace the fake text below with your own registered email and password on h...
Python
0.000001
dbfc033fdfaad5820765a41766a5342831f3c4f9
add util script to dump twitter oauth tokens
scripts/remove_twuser_oauth.py
scripts/remove_twuser_oauth.py
"""Remove a twitter user's oauth tokens and reload iembot""" from __future__ import print_function import json import sys import psycopg2 import requests def main(argv): """Run for a given username""" screen_name = argv[1] settings = json.load(open("../settings.json")) pgconn = psycopg2.connect(datab...
Python
0
77aa24bbea447d8684614f0d089320d134412710
Test ini-configured app.
test_app.py
test_app.py
from flask import Flask from flask.ext.iniconfig import INIConfig app = Flask(__name__) INIConfig(app) with app.app_context(): app.config.from_inifile('settings.ini')
Python
0
d1df2b573c515d3ea18ce46ccc58c8bc9e788915
Clean commit
src/pymatgen_pars.py
src/pymatgen_pars.py
import pymatgen as mg from pymatgen.matproj.rest import MPRester import pandas as pd from pymatgen import Element,Composition import multiprocessing as mp import pickle import json from monty.json import MontyEncoder,MontyDecoder import numpy as np def ret_struct_obj(i): return mg.Structure.from_str(i,fmt="cif") ...
Python
0
74bde8878aa9b336046374ce75fc4c7bc63eaba7
add test for VampSimpleHost
tests/test_vamp_simple_host.py
tests/test_vamp_simple_host.py
#! /usr/bin/env python from unit_timeside import unittest, TestRunner from timeside.decoder.file import FileDecoder from timeside.core import get_processor from timeside import _WITH_VAMP from timeside.tools.test_samples import samples @unittest.skipIf(not _WITH_VAMP, 'vamp-simple-host library is not available') cla...
Python
0.000001
0d596f8c7148c2ac13c2b64be09ca1e20719cdb9
add dumper of flowpaths to shapefile
scripts/util/dump_flowpaths.py
scripts/util/dump_flowpaths.py
"""Dump flowpaths to a shapefile.""" from geopandas import read_postgis from pyiem.util import get_dbconn def main(): """Go Main Go.""" pgconn = get_dbconn('idep') df = read_postgis(""" SELECT f.fpath, f.huc_12, ST_Transform(f.geom, 4326) as geo from flowpaths f, huc12 h WHERE h.scenario ...
Python
0
345af55938baef0da1f0793d8a109fcee63692dd
Add files via upload
tokenize.py
tokenize.py
#!/usr/bin/python #-*-coding:utf-8 -*- # author: mld # email: miradel51@126.com # date : 2017/9/28 import sys import string import re def tokenizestr(original_str): after_tok = "" #in order to encoding type, I only do like this and only use replace some special tokens without re.sub #sym = "[$%#@~...
Python
0
f7768b10df84a4b3bb784ee1d449e380b93d88bb
add a simple scan example
data/scan_example.py
data/scan_example.py
import numpy import theano from theano import tensor # some numbers n_steps = 10 n_samples = 5 dim = 10 input_dim = 20 output_dim = 2 # one step function that will be used by scan def oneStep(x_t, h_tm1, W_x, W_h, W_o): h_t = tensor.tanh(tensor.dot(x_t, W_x) + tensor.dot(h_tm1, W_h)) ...
Python
0.000001
9737f8b1551adb5d3be62b1922de27d867ac2b24
Add forwarding script for build-bisect.py.
build/build-bisect.py
build/build-bisect.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 sys print "This script has been moved to tools/bisect-builds.py." print "Please update any docs you're working from!" sys.exit...
Python
0.000002
4c2663939008285c395ee5959c38fab280f43e58
Create 03.PracticeCharsAndStrings.py
TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Exercises/03.PracticeCharsAndStrings.py
TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Exercises/03.PracticeCharsAndStrings.py
print(input()) print(input()) print(input()) print(input()) print(input())
Python
0
782e4da9d04c656b3e5290269a4f06328ee5d508
add file
main.py
main.py
import numpy as np @np.vectorize def F(n): return 1./np.sqrt(5.)*(((1.+np.sqrt(5))/2.)**n-((1.-np.sqrt(5))/2.)**n) n = np.arange(10) F = F(n) np.savetxt("F.txt", F)
Python
0.000002
ea0f02d6be95d0d8ef3081d49743702605467b51
Add toy box
royalword.py
royalword.py
# Public: Toybox verison of W3 program. # # w3_dict - dictionary of interesting words. # w3_defs - dictionary of definitions. # # Keys for both dicts are matching integers for word/defintion. # # word_display() - Displays a randomly generated word and its definition. # learning_listed - Removes displayed word from main...
Python
0.999799
60f13bdfb97e83ac1bf2f72e3eec2e2c2b88cbb3
add tests for potential density computation
biff/tests/test_bfe.py
biff/tests/test_bfe.py
# coding: utf-8 from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Third-party import astropy.units as u from astropy.constants import G as _G G = _G.decompose([u.kpc,u.Myr,u.Msun]).value import numpy as np # Project from .._bfe import density # Check that we get A000=1...
Python
0.000001
1e808aa70882cd30cd0ac7a567d12efde99b5e61
Create runserver.py
runserver.py
runserver.py
from ucwa.http import app app.run(debug=True)
Python
0.000002
98eb8c1bb013106108e239c7bc8b6961a2f321cd
Allow debug mode from the CLI
blaze/server/spider.py
blaze/server/spider.py
#!/usr/bin/env python from __future__ import absolute_import import os import sys import argparse import yaml from odo import resource from odo.utils import ignoring from .server import Server, DEFAULT_PORT __all__ = 'spider', 'from_yaml' def _spider(resource_path, ignore, followlinks, hidden): resources =...
#!/usr/bin/env python from __future__ import absolute_import import os import sys import argparse import yaml from odo import resource from odo.utils import ignoring from .server import Server, DEFAULT_PORT __all__ = 'spider', 'from_yaml' def _spider(resource_path, ignore, followlinks, hidden): resources =...
Python
0.000001
f737a8be41111f65944b00eb85a76687653fc8c0
Create sort_fpkm.py
sort_fpkm.py
sort_fpkm.py
import os import fnmatch import sys, csv ,operator for root, dirnames, filenames in os.walk('/Users/idriver/RockLab-files/test'): for filename in fnmatch.filter(filenames, '*.fpkm_tracking'): if filename =='isoforms.fpkm_tracking': data = csv.reader(open(os.path.join(root, filename), 'rU'),delimiter='\t') ...
Python
0
d42aad6a15dfe9cc5a63dbb19efe112534b91a5e
Add autoexec script for reference (already bundled in config)
resources/autoexec.py
resources/autoexec.py
# place at ~/.kodi/userdata/autoexec.py import xbmc import time xbmc.executebuiltin("XBMC.ReplaceWindow(1234)") time.sleep(0.1) xbmc.executebuiltin('PlayMedia("/storage/videos/SSL","isdir")') xbmc.executebuiltin('xbmc.PlayerControl(repeatall)') xbmc.executebuiltin("Action(Fullscreen)")
Python
0
159ed7dd9dd5ade6c4310d2aa106b13bf94aa903
Add empty cloner
stoneridge_cloner.py
stoneridge_cloner.py
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # TODO - This will run on the central server, and download releases from ftp.m.o # to a local dire...
Python
0.000007
9c3682ec717fd4de5555874ad3665c6f7be479b8
improve ecom
netforce_sale/netforce_sale/models/payment_method.py
netforce_sale/netforce_sale/models/payment_method.py
from netforce.model import Model,fields,get_model from netforce import database from netforce.logger import audit_log class PaymentMethod(Model): _inherit="payment.method" def payment_received(self,context={}): res=super().payment_received(context=context) if res: return res ...
from netforce.model import Model,fields,get_model from netforce import database from netforce.logger import audit_log class PaymentMethod(Model): _inherit="payment.method" def payment_received(self,context={}): res=super().payment_received(context=context) if res: return res ...
Python
0.000035
3f6a08d92f46c606e99c14eb12849e1386704cf3
Bump version to 0.6
oscar/__init__.py
oscar/__init__.py
import os # Use 'final' as the 4th element to indicate # a full release VERSION = (0, 6, 0, 'final', 0) def get_short_version(): return '%s.%s' % (VERSION[0], VERSION[1]) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: # Append 3rd digit if > 0 version = ...
import os # Use 'final' as the 4th element to indicate # a full release VERSION = (0, 6, 0, 'beta', 1) def get_short_version(): return '%s.%s' % (VERSION[0], VERSION[1]) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: # Append 3rd digit if > 0 version = '...
Python
0
d9710fa2af26ab4ab5fef62adc5be670437bea68
Create logistics_regression.py
logistics_regression.py
logistics_regression.py
#!/usr/bin/python # -*-coding:utf-8 -*- from math import exp import random import data_tool #y = x1*a1 + x2*a2 + x3*a3 + ... + xn*an + b def predict(data, coef, bias): pred = 0.0 for index in range(len(coef)): pred += (data[index] * coef[index] + bias) return sigmoid(pred) ...
Python
0.000024
9fc090e5ea669630e3a9932d21f28285b6aa0dc5
add widget with nltk and Stanford taggers
orangecontrib/text/widgets/owpostagging.py
orangecontrib/text/widgets/owpostagging.py
from PyQt4 import QtGui from Orange.widgets import gui from Orange.widgets import settings from Orange.widgets.widget import OWWidget from orangecontrib.text.corpus import Corpus from orangecontrib.text.tag.pos import taggers, StanfordPOSTagger from orangecontrib.text.widgets.utils import ResourceLoader class Input:...
Python
0
8ee7798af73f374485c1a97e82a98fd5ff8b3c48
Add module for loading specific classes
nova/loadables.py
nova/loadables.py
# Copyright (c) 2011-2012 OpenStack, LLC. # 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 ...
Python
0.000023
a8412ea3d8d72499db48e4a55c6f7b416d307025
Add plan tests
tests/test_plan.py
tests/test_plan.py
import datetime from fbchat._plan import GuestStatus, Plan def test_plan_properties(): plan = Plan(time=..., title=...) plan.guests = { "1234": GuestStatus.INVITED, "2345": GuestStatus.INVITED, "3456": GuestStatus.GOING, "4567": GuestStatus.DECLINED, } assert set(plan.i...
Python
0.000001
5211117033f596bd506e81e8825ddfb08634c25e
Create battery.py
client/iOS/battery.py
client/iOS/battery.py
# coding: utf-8 import collections, objc_util battery_info = collections.namedtuple('battery_info', 'level state') def get_battery_info(): device = objc_util.ObjCClass('UIDevice').currentDevice() device.setBatteryMonitoringEnabled_(True) try: return battery_info(int(device.batteryLevel() * 100), ...
Python
0.000028
840d4d555b7b2858ca593251f1593943b10b135b
Add setup_egg.py
setup_egg.py
setup_egg.py
#!/usr/bin/env python """Wrapper to run setup.py using setuptools.""" from setuptools import setup ################################################################################ # Call the setup.py script, injecting the setuptools-specific arguments. extra_setuptools_args = dict( tests...
Python
0.000001
71a6c671f802e3b1c123b083ef34f81efeb55750
Create MakeMaskfiles.py
MakeMaskfiles.py
MakeMaskfiles.py
import gzip import sys from collections import defaultdict def readFasta(infile): sequence = '' if '.gz' in infile: with gzip.open(infile) as data: for line in data: if '>' in line: seqname = line.strip().replace('>','') else: sequence += line.strip().replace(' ','') else: with open(infil...
Python
0.000001
8e4cbd3dd09aac90cf2d71adb5ad841274b60575
Create convolution_digit_recognition.py
Convolution_Neural_Networks/convolution_digit_recognition.py
Convolution_Neural_Networks/convolution_digit_recognition.py
# Optimise a neural network import threading from Queue import Queue from numpy import * from create_MEGA_THETA import * from RLU_forward_backward import * from get_overlaps import * # get data from csv file into array data = genfromtxt('train2.csv', delimiter=',') # get a subset for testing num_cpus = 4 N = 5*num_...
Python
0.999784
675de92e16e268badd8c6f5de992c3901cc8f2ce
Update Category Model
apps/shop/migrations/0004_category_parent_category.py
apps/shop/migrations/0004_category_parent_category.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-11 19:34 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('shop', '0003_product_model_name'), ] operations = ...
Python
0
f2d1421555f00f7bcb77f43cd010c221045c6bfd
Add tests for nd-shifty
tests/console/test_shifty.py
tests/console/test_shifty.py
import click.testing from netdumplings.console.shifty import shifty from netdumplings.exceptions import NetDumplingsError class TestShifty: """ Test the nd-shifty commandline tool. """ def test_shifty(self, mocker): """ Test that the DumplingHub is instantiated as expected and that ru...
Python
0
dd983ae232829559766bcdf4d2ea58861b8a47ad
Bring your own daemon.
varnish_statd.py
varnish_statd.py
#!/usr/bin/env python import time import os from pprint import pprint import varnishapi def stat(name=None): if name is None: vsc = varnishapi.VarnishStat() else: vsc = varnishapi.VarnishStat(opt=["-n", name]) r = vsc.getStats() values = dict(((k, v['val']) for k, v in r.iteritems())...
Python
0
c1d4525d5f43a5c2bfbfd88ab0dd943eb2452574
add 127
vol3/127.py
vol3/127.py
from fractions import gcd if __name__ == "__main__": LIMIT = 120000 rad = [1] * LIMIT for i in range(2, LIMIT): if rad[i] == 1: for j in range(i, LIMIT, i): rad[j] *= i ele = [] for i in range(1, LIMIT): ele.append([rad[i], i]) ele = sorted(ele) ...
Python
0.999999
8e7b57c8bc7be6a061d0c841700291a7d85df989
add 174
vol4/174.py
vol4/174.py
if __name__ == "__main__": L = 10 ** 6 count = [0] * (L + 1) for inner in range(1, L / 4 + 1): outer = inner + 2 used = outer * outer - inner * inner while used <= L: count[used] += 1 outer += 2 used = outer * outer - inner * inner print sum(ma...
Python
0.999959
86ae2fbda8974c093770a9a3563bd40975202d15
add display image
displayImage/main.py
displayImage/main.py
#!/usr/bin/env python # -*- coding: utf-8 -*- '''display an image using opengl''' import sys import PySide from PySide.QtGui import * from PySide.QtCore import * from PySide.QtOpenGL import * from OpenGL.GL import * from OpenGL.GL import shaders import numpy as np from PIL import Image def shaderFromFile(shaderT...
Python
0.000001
a5b4fa261750fa79d61fc16b6061d449aa7e3523
Add missing block.py
rasterio/block.py
rasterio/block.py
"""Raster Blocks""" from collections import namedtuple BlockInfo = namedtuple('BlockInfo', ['row', 'col', 'window', 'size'])
Python
0.000088
65843b537e45b98068566c6cc57e4a3ad139d607
add variant.py
cendr/views/api/variant.py
cendr/views/api/variant.py
# NEW API from cendr import api, cache, app from cyvcf2 import VCF from flask import jsonify import re import sys from subprocess import Popen, PIPE def get_region(region): m = re.match("^([0-9A-Za-z]+):([0-9]+)-([0-9]+)$", region) if not m: return msg(None, "Invalid region", 400) chrom = m.grou...
Python
0.000001
d2bcba204d36a8ffd1e6a1ed79b89fcb6f1c88c5
Add file to test out kmc approach. Dump training k-mers to fasta file
ideas/test_kmc.py
ideas/test_kmc.py
# This code will test out the idea of using kmc to # 1. quickly enumerate the k-mers # 2. intersect these with the training database, output as fasta # 3. use that reduced fasta of intersecting kmers as the query to CMash #################################################################### # First, I will need to dump...
Python
0
c584bca2f9ac7bc005128d22b4e81a6b4885724c
allow Fabric to infrastructure config from YAML data files
templates/fabfile.py
templates/fabfile.py
import yaml from fabric.api import env, run def import_inf(data='web_app_basic.yml'): inf_data = open(data, 'r') inf = yaml.load(inf_data) # for box in inf: # print '\n' # for parameter in box: # print parameter, ':', box[parameter] return inf inf_data.close() inf = import_...
Python
0
f657a02a560af1a5860f9a532052f54330018620
Build "shell" target with chromium_code set.
ui/shell/shell.gyp
ui/shell/shell.gyp
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'targets': [ { 'target_name': 'shell', 'type': 'static_library', 'dependencies': [ ...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'shell', 'type': 'static_library', 'dependencies': [ '../aura/aura.gyp:aura', '../vie...
Python
0.999994
bddfeeec193d9fb61d99c70be68093c854e541f7
Add initial check thorium state
salt/thorium/check.py
salt/thorium/check.py
''' The check Thorium state is used to create gateways to commands, the checks make it easy to make states that watch registers for changes and then just succeed or fail based on the state of the register, this creates the pattern of having a command execution get gated by a check state via a requisite. ''' def gt(na...
Python
0
6c08a3d795f9bd2f2d0850fb4c2b7f20474908a9
Add test for scrunch block
test/test_scrunch.py
test/test_scrunch.py
# Copyright (c) 2016, The Bifrost Authors. All rights reserved. # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must re...
Python
0
0b0647a0537c3c325f5cf57cae933e06f7997ea9
add "_" prefix to plot names
crosscat/tests/timing_analysis.py
crosscat/tests/timing_analysis.py
import argparse def _generate_parser(): default_num_rows = [100, 400, 1000, 4000] default_num_cols = [8, 16, 32] default_num_clusters = [1, 2] default_num_views = [1, 2] # parser = argparse.ArgumentParser() parser.add_argument('--dirname', default='timing_analysis', type=str) parser.ad...
import argparse def _generate_parser(): default_num_rows = [100, 400, 1000, 4000] default_num_cols = [8, 16, 32] default_num_clusters = [1, 2] default_num_views = [1, 2] # parser = argparse.ArgumentParser() parser.add_argument('--dirname', default='timing_analysis', type=str) parser.ad...
Python
0
42e0504933d6b9e55cdb6edb9931ba080baab136
add 408, replace print in test cases into assert
python/408_valid_word_abbreviation.py
python/408_valid_word_abbreviation.py
""" Given a non-empty string s and an abbreviation abbr, return whether the string matches with the given abbreviation. A string such as "word" contains only the following valid abbreviations: ["word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d", "1or1", "w1r1", "1o2", "2r1", "3d", "w3", "4"] Notice...
Python
0.000002
5e91e3b2c7e4cbc9f14067a832b87c336c0811e7
update add test for c4
redis_i_action/c4-process-log-and-replication/test.py
redis_i_action/c4-process-log-and-replication/test.py
class TestCh04(unittest.TestCase): def setUp(self): import redis self.conn = redis.Redis(db=15) self.conn.flushdb() def tearDown(self): self.conn.flushdb() del self.conn print print def test_list_item(self): import pprint conn = self.conn print "We need to set up just enough state so that a user c...
Python
0
5fd556bc01fdd5d3c9690a56a70557fbd6eb73f8
print the to calc statistical test
MachineLearning/print_ensemble_precisions.py
MachineLearning/print_ensemble_precisions.py
# # This program is distributed without any warranty and it # can be freely redistributed for research, classes or private studies, # since the copyright notices are not removed. # # This file just read the data to calculate the statistical test # # Jadson Santos - jadsonjs@gmail.com # # to run this exemple install py...
Python
0.999999