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
11a69bd2fe6e7eb9e2372dc8a21dd3c41b0ab2ef
Add iow_util.py
webapp/graphite/iow_util.py
webapp/graphite/iow_util.py
from django.conf import settings def check_tenant(tenant): if tenant not in settings.TENANT_LIST: return settings.TENANT_LIST[0] return tenant
Python
0.000103
29a6ac8b0744e8569928dbdf3648485f0fe78ae7
add register handlers
bot.py
bot.py
from telegram import Updater, InlineQueryResultPhoto from game_manager import GameManager import card as c from credentials import TOKEN gm = GameManager() u = Updater(TOKEN) dp = u.dispatcher def new_game(bot, update): chat_id = update.message.chat_id link = gm.generate_invite_link(u.bot.getMe().username,...
from telegram import Updater, InlineQueryResultPhoto from game_manager import GameManager import card as c from credentials import TOKEN gm = GameManager() u = Updater(TOKEN) dp = u.dispatcher def new_game(bot, update): chat_id = update.message.chat_id link = gm.generate_invite_link(u.bot.getMe().username,...
Python
0.000001
a2413403a59a313397b517c90a2405a0599a0fa6
add initial code
bot.py
bot.py
#! /usr/bin/python3 import discord import asyncio client = discord.Client() discord_colors = discord.Color.__dict__ colors = list(filter(lambda x: isinstance(discord_colors[x],classmethod), discord_colors)) colors.sort() @asyncio.coroutine def handle_color(message): words = message.content.split(' ') ...
Python
0.000002
938fa9463b4cf248593ae1917bd6d7f9413a183a
add a modle to send serial data
Python/servercode/simchipcomputer.py
Python/servercode/simchipcomputer.py
# coding=UTF-8 from time import sleep, ctime import serial import threading port='com4'; baudrate=9600; Myserial = serial.Serial(port,baudrate); def Handle(Text124): while True: count = Myserial.inWaiting() if count != 0: recv = Myserial.read(count) print(recv.decode('ascii')) Myserial.flushInput() s...
Python
0
8f2c2e566281507dfded1bae855ba0236694aac0
Add a few tests.
test/system_test.py
test/system_test.py
# -*- coding: utf-8 -*- # Copyright (C) 2015 Björn Edström <be@bjrn.se> import signify import unittest class SignifyTest(unittest.TestCase): KAT = [ { 'pub': """untrusted comment: bjorntest public key RWQ100QRGZoxU+Oy1g7Ko+8LjK1AQLIEavp/NuL54An1DC0U2cfCLKEl """, 'priv': """untrus...
Python
0.000001
37d23e16f091f462f83708959cfff73d8811eb47
build docker image for SPM
neurodocker/interfaces/tests/test_spm.py
neurodocker/interfaces/tests/test_spm.py
"""Tests for neurodocker.interfaces.SPM""" # Author: Jakub Kaczmarzyk <jakubk@mit.edu> from __future__ import absolute_import, division, print_function from io import BytesIO import pytest from neurodocker.docker_api import Dockerfile, DockerImage, DockerContainer from neurodocker.parser import SpecsParser from neuro...
Python
0
51faed84f4d56fe3455a6568bdadbc9b16196175
Add day 5 part 1.
day5-1.py
day5-1.py
"""Module to find the passowrd on a bunny door.""" import hashlib def main(): """Run the main function.""" id = 'cxdnnyjw' password = [] begin = '00000' index = 0 while len(password) < 8: test = id + str(index) if begin == hashlib.md5(test).hexdigest()[0:5]: pass...
Python
0.000041
c019af0f2d155ed2edaf600732218057cabc441e
Add test_client.py.
test/test_client.py
test/test_client.py
#! /usr/bin/python # Test program for client APIs. import time import os import sys import select import glib import termios import tty import ibus from ibus import keysyms from ibus import modifier class DemoTerm: def __init__(self): self.__term_old = termios.tcgetattr(0) tty.setraw(0) self.__bus = ibus.Bus()...
Python
0
d813448c1b9a16d58c8d24d27267893b39c4b908
Add calc_coolfunc_profile.py: calculate cooling function proifle
bin/calc_coolfunc_profile.py
bin/calc_coolfunc_profile.py
#!/usr/bin/env python3 # # Copyright (c) 2017 Weitian LI <liweitianux@live.com> # MIT license """ Calculate the cooling function profile with respect to the input temperature profile by interpolating the previously calculated cooling function table. In this way, the cooling function profile can be calculated very qui...
Python
0.000001
18bc9e0fb7c084e56e77b54b69fca5471d04be5f
add missing Devince migration
devices/migrations/0007_device_used_in_rm_default.py
devices/migrations/0007_device_used_in_rm_default.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-06-28 19:59 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('devices', '0006_device_used_in'), ] operations = ...
Python
0.999274
28dda425039716b23a22f8f61889d10c96467e17
Add site context processor
app/context_processors.py
app/context_processors.py
from django.contrib.sites.models import Site def request_site(request): """Current site instalnce processor""" return { 'SITE': Site.objects.get_current(), }
Python
0.000001
7ea4d3d9117f0586749dad3ce1ff3a038c40ffa8
Add missing file
openprescribing/openprescribing/slack.py
openprescribing/openprescribing/slack.py
import os import requests def notify_slack(message): """Posts the message to #general """ # Set the webhook_url to the one provided by Slack when you create # the webhook at # https://my.slack.com/services/new/incoming-webhook/ webhook_url = os.environ['SLACK_GENERAL_POST_KEY'] slack_data...
Python
0.000006
41a83a622fda7776ddc9efdf5bed1be1cd698b51
Test Lab for review, with support file codingbat
students/pvosper/session06/codingbat.py
students/pvosper/session06/codingbat.py
#!/usr/bin/env python3 # Coding Bat Samples for Test Lab ''' Pick an example from codingbat: http://codingbat.com Do a bit of test-driven development on it: run something on the web site. write a few tests using the examples from the site. then write the function, and fix it ‘till it passes the tests. Do at least ...
Python
0
764a4396300fa5c50c7c129bc24ce1cfdd597c03
add foo.py
foo.py
foo.py
# -*- coding: utf-8 -*- # Project pxchar import sys import os.path from PIL import Image # 初期化 def init(): pass; # テキストファイルを一文字ずつ読み込む def readChar(fileName): pass; # 読み込んだ文字からピクセルデータを決定する def determinePxColor(char): pass; # PNGファイルを出力する def applyPxColor(color): pass; if __name__ == '__main__':
Python
0.998168
82199c60097599f5273c97fee649473a8a069ec8
Add missing migration
democracy/migrations/0023_add_comment_location_and_images.py
democracy/migrations/0023_add_comment_location_and_images.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-09-15 12:32 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import djgeojson.fields class Migration(migrations.Migration): d...
Python
0.0002
e6b52bbb4353ef797a83ead2a8dd2037f284cbb1
Update create_manufacturer_records.py
erpnext/patches/v6_16/create_manufacturer_records.py
erpnext/patches/v6_16/create_manufacturer_records.py
# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import cstr def execute(): frappe.reload_doc("stock", "doctype", "manufacturer") frappe.reload_doctype("Item") for...
# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import cstr def execute(): frappe.reload_doctype("Manufacturer") frappe.reload_doctype("Item") for d in frappe.db....
Python
0.000001
f2bec4c2c2bd2cb55a98a4aeda52a40781734086
Add simple binary heap implementation
binary_heap.py
binary_heap.py
""" A simple binary heap implementation (using a list). Operations: - __len__ - insert - pop - peek TODO: - Add operations: heapify (maybe in __init__) Author: Christos Nitsas (nitsas) (chrisnitsas) Language: Python 3(.4) Date: November, 2014 """ import operator __all__ = ['BinaryHeap'] cl...
Python
0.000008
a8efd5e94c206a9bbaf4a523fda7513acc2afa7f
add test-room-list.py
tests/twisted/avahi/test-room-list.py
tests/twisted/avahi/test-room-list.py
from saluttest import exec_test from avahitest import AvahiAnnouncer, AvahiListener from avahitest import get_host_name import avahi from xmppstream import setup_stream_listener, connect_to_stream from servicetest import make_channel_proxy from twisted.words.xish import xpath, domish import time import dbus CHANNE...
Python
0.000007
81f9e6b245e81d653184579ca0c78b4d5559e715
Create config-lite.py
config-lite.py
config-lite.py
## ## User configuration file - edit these settings to suit your own project ## file_path = '/home/pi/RPi-RTL/images/' ## path to save images file_prefix = 'img_' ## prefix before timestamp.jpg, if needed - e.g. a project number use_timestamp = True ## True = timestamp in filename, False = incremental numbering
Python
0.000001
b0f112c6ab2a8860e9032adcccc4c90a4c43d5c3
Create __init__.py
maya/python/playblast/timeUnitConvasion/__init__.py
maya/python/playblast/timeUnitConvasion/__init__.py
Python
0.000429
76ccb3e14da170000c8071203e931eeb8bc7c642
Add a test case for deepcopy
tests/test_deepcopy.py
tests/test_deepcopy.py
from tests.models import ( Cat, Location, ) import copy from rest_framework.test import APITestCase class DeepcopyTestCase(APITestCase): def test_cat(self): home = Location(name='Home', blob='ILUVU') papa = Cat(name='Papa') kitkat = Cat(name='KitKat', home=home, parent=papa) ...
Python
0.000016
880a15054ab5fbc49afe2aafce584fd423e511fa
Define constants module
napalm_iosxr/constants.py
napalm_iosxr/constants.py
"""Constants for the IOS-XR driver.""" from __future__ import unicode_literals from napalm_base.constants import * # noqa SR_638170159_SOLVED = False # this flag says if the Cisco TAC SR 638170159 # has been solved # # "XML Agent Does not retrieve correct BGP routes data" # is a weird bug reported on 2016-02-22 22:...
Python
0.000003
47d770c6008116dd72c6c6b4572a0a92faa39e66
Add test file for update.py
test/test_update.py
test/test_update.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys import logging basedir = os.path.realpath('..') if basedir not in sys.path: sys.path.append(basedir) import update as up # logging LOGFORMAT_STDOUT = { logging.DEBUG: '%(module)s:%(funcName)s:%(lineno)s - ' '%(levelname)-...
Python
0
d8e61765f8896bcdc469af59145cae9867a380e9
Add inital implementation of bunch of widgets.
widgets.py
widgets.py
from basewidget import * from editorext import * class Dialog(Widget): def __init__(self, x, y, w, h): super().__init__() self.x = x self.y = y self.w = w self.h = h self.childs = [] def add(self, x, y, widget): widget.set_xy(self.x + x, self.y + y) ...
Python
0
7101dac32926e0f1403b44a93a6f5882a0aa5d2e
Create woc32p3.py
woc32p3.py
woc32p3.py
#!/bin/python3 import sys def boolProd(m1, m2): def circularWalk(n, s, t, r_0, g, seed, p): # Complete this function dist = [] boolMatrix = [[] for w in range(n)] for w in range(n): for e in range(n): boolMatrix[w].append(0) for q in range(n): if q == 0: ...
Python
0.000007
97b933815dcbc179e25bc9c1c16cfa1153036ae1
Add performance test for epsilon convolution
performance_tests/epsilon_convolution.py
performance_tests/epsilon_convolution.py
#!/usr/bin/python3 ''' Convolution ''' from __future__ import print_function import numpy as np import cProfile import random import matplotlib.pyplot as plt def eps(s, t_membran): return np.exp(-s / t_membran) def small_spiketrain(): # 1000 timesteps # With 10 random spikes s = np.array([0]*1000) ...
Python
0.000026
5e27bf30286265f6ce2ba82a8a2edbae2bb421ae
add tests
test_tracemalloc.py
test_tracemalloc.py
import os import sys import time import tracemalloc import unittest EMPTY_STRING_SIZE = sys.getsizeof(b'') def get_lineno(): frame = sys._getframe(1) return frame.f_lineno def allocate_bytes(size): filename = __file__ lineno = get_lineno() + 1 data = b'x' * (size - EMPTY_STRING_SIZE) return d...
Python
0
fc3ac8ca281bccc2f50c9f1fdd9a16b0c8658a01
Add GDP test
platforms/m3/programming/goc_gdp_test.py
platforms/m3/programming/goc_gdp_test.py
#!/usr/bin/env python2 import code try: import Image except ImportError: from PIL import Image import gdp gdp.gdp_init() gcl_name = gdp.GDP_NAME("edu.umich.eecs.m3.test01") gcl_handle = gdp.GDP_GCL(gcl_name, gdp.GDP_MODE_RA) #j = Image.open('/tmp/capture1060.jpeg') #d = {"data": j.tostring()} #gcl_handle.append(...
Python
0.000062
db43b2fe5c713ea91e189fb464d479142c5b7134
tuple begins
think_python/tuples.py
think_python/tuples.py
def min_max(t): return min(t),max(t) sum = 0 def sumall(*args): """sum(1,2,3) gives invalid o/p """ global sum for i in args: sum += i return sum print 'Tuples are a seq of vals , indexed by integers ~ list' t1 = 'a', print 't1 = \'a\',',type(t1) print 'The comma is important\n' t2 = ('a') print 't2 = (\'...
Python
0.999996
b3624916b29d25d1baec7c55da4cc7184e724812
Add tests for LocalizedFieldsAdminMixin
tests/test_admin.py
tests/test_admin.py
from django.apps import apps from django.contrib import admin from django.contrib.admin.checks import check_admin_app from django.db import models from django.test import TestCase from localized_fields.fields import LocalizedField from localized_fields.admin import LocalizedFieldsAdminMixin from tests.fake_model impo...
Python
0
cf090648a8c88b7f30eaa925358ff175cbcb976c
use dtype float32
examples/ensemble/plot_gradient_boosting_quantile.py
examples/ensemble/plot_gradient_boosting_quantile.py
""" ===================================================== Prediction Intervals for Gradient Boosting Regression ===================================================== This example shows how quantile regression can be used to create prediction intervals. """ import numpy as np from sklearn.ensemble import GradientBoost...
""" ===================================================== Prediction Intervals for Gradient Boosting Regression ===================================================== This example shows how quantile regression can be used to create prediction intervals. """ import numpy as np from sklearn.ensemble import GradientBoost...
Python
0.000012
42347f1106f91cb68fe914c9ea05e0c24f46ee08
add missing migration for langpack model
mkt/langpacks/migrations/0002_auto_20150824_0820.py
mkt/langpacks/migrations/0002_auto_20150824_0820.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('langpacks', '0001_initial'), ] operations = [ migrations.AlterField( model_name='langpack', name='la...
Python
0
296ab4d527558a77cb635ea0754078c66bbd5462
bump version to 1.0.0 pre
admin_sso/__init__.py
admin_sso/__init__.py
VERSION = (1, 0, 0, 'pre') __version__ = '.'.join(map(str, VERSION)) # Do not use Django settings at module level as recommended try: from django.utils.functional import LazyObject except ImportError: pass else: class LazySettings(LazyObject): def _setup(self): from admin_sso import def...
VERSION = (0, 1, 3,) __version__ = '.'.join(map(str, VERSION)) # Do not use Django settings at module level as recommended try: from django.utils.functional import LazyObject except ImportError: pass else: class LazySettings(LazyObject): def _setup(self): from admin_sso import default_s...
Python
0
608896368fecb8c6fd6b0920280440b2720851ae
Update __init__.py
tendrl/node_agent/node_sync/__init__.py
tendrl/node_agent/node_sync/__init__.py
import gevent from tendrl.commons.event import Event from tendrl.commons.message import ExceptionMessage from tendrl.commons.message import Message from tendrl.commons import sds_sync from tendrl.commons.utils import time_utils from tendrl.node_agent.node_sync import cluster_contexts_sync from tendrl.node_agent.node_...
import gevent from tendrl.commons.event import Event from tendrl.commons.message import ExceptionMessage from tendrl.commons.message import Message from tendrl.commons import sds_sync from tendrl.commons.utils import time_utils from tendrl.node_agent.node_sync import cluster_contexts_sync from tendrl.node_agent.node_...
Python
0.000002
394d8b1ebd14a0ad566e67a352085968126701c4
Add test for object source marked down
teuthology/task/object_source_down.py
teuthology/task/object_source_down.py
import logging import ceph_manager from teuthology import misc as teuthology import time log = logging.getLogger(__name__) def rados(remote, cmd): log.info("rados %s" % ' '.join(cmd)) pre = [ 'LD_LIBRARY_PATH=/tmp/cephtest/binary/usr/local/lib', '/tmp/cephtest/enable-coredump', '/tmp...
Python
0
aa02a1ff3722b4ccb644daf4f5d57a0e01f5e9e2
add make Data
makeData.py
makeData.py
import random import cPickle as pickle from numpy import concatenate, ones, array, shape, size, zeros, exp, arange from numpy import concatenate,ones,array,shape,size,zeros,exp import numpy as np import copy import math import pdb dna = ['A', 'C', 'G', 'T'] def simulate_sequence(length): sequence = '' for i in...
Python
0.000053
d32058b6a6d3db162b79628cadc9fa061672a297
Add django sync db after migrate if using south
blues/django.py
blues/django.py
from fabric.context_managers import cd from fabric.decorators import task, runs_once from fabric.operations import prompt from refabric.api import run, info from refabric.context_managers import shell_env from refabric.contrib import blueprints from . import virtualenv from .application.project import virtualenv_path...
from fabric.context_managers import cd from fabric.decorators import task, runs_once from fabric.operations import prompt from refabric.api import run, info from refabric.context_managers import shell_env from refabric.contrib import blueprints from . import virtualenv from .application.project import virtualenv_path...
Python
0
3f52fc50bd17dd3a0674bc193cd4fd6bf7f762fd
add comparemtz.py
tests/comparemtz.py
tests/comparemtz.py
#!/usr/bin/env cctbx.python USAGE = "Usage: comparemtz.py [-r] file1.mtz..." import os import sys import iotbx.mtz # Columns in refmac HKLOUT: # - FC_ALL is maximum likelihood scaled and is used for map calculation # - FC_ALL_LS is least-squares scaled and is used Rfactor calculations # - F (or FP or anything els...
Python
0
60fa72f1d6c21eda46124db02f1907046f8e3cb4
Add boot_switch.py
boot_switch.py
boot_switch.py
import pyb sw = pyb.Switch() # 1 - Red # 2 - Green # 3 - Yellow # 4 - Blue pyb.LED(2).off() # Turn Greem LED off since normal boot turns it on led = pyb.LED(1) leds = (pyb.LED(4), pyb.LED(3), pyb.LED(2)) try: import boot_mode persisted_mode = boot_mode.mode mode = boot_mode.mode except: persisted_mode...
Python
0.000002
561980aeb9a04150768cb07797e2d62ffae5c522
Add math
maths/polynomials.py
maths/polynomials.py
from itertools import groupby # If you have problems with 'rufv' show=True, # enable the console compatbility mode to use # more common characters. compat = False if compat: vbar = '|' hbar = '-' intersection = '+' else: vbar = '│' hbar = '─' intersection = '┼' def ruf(pol, x): """For th...
Python
0.000361
2bb33986002a1e1e5152b311662a200db717aa78
change school object
migrations/versions/2ae4701a60b4_.py
migrations/versions/2ae4701a60b4_.py
"""empty message Revision ID: 2ae4701a60b4 Revises: 013b5c571b68 Create Date: 2016-09-11 15:43:53.495932 """ # revision identifiers, used by Alembic. revision = '2ae4701a60b4' down_revision = '013b5c571b68' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - ...
Python
0.000016
855057d96d0335005c172c244de5f20d27e54907
Create check_purefa_occpy.py
check_purefa_occpy.py
check_purefa_occpy.py
#!/usr/bin/env python # Copyright (c) 2018 Pure Storage, Inc. # ## Overview # # This short Nagios/Icinga plugin code shows how to build a simple plugin to monitor Pure Storage FlashArrays. # The Pure Storage Python REST Client is used to query the FlashArray occupancy indicators. # Plugin leverages the remarkably help...
Python
0.000001
f2693a72f99a2d414b7ee76d0f542535aa0d9ec0
Remove debug prints
checkers/rstripped.py
checkers/rstripped.py
def check(process_output, judge_output, **kwargs): from itertools import izip process_lines = process_output.split('\n') judge_lines = judge_output.split('\n') if 'filter_new_line' in kwargs: process_lines = filter(None, process_lines) judge_lines = filter(None, judge_lines) if len(p...
def check(process_output, judge_output, **kwargs): from itertools import izip process_lines = process_output.split('\n') judge_lines = judge_output.split('\n') if 'filter_new_line' in kwargs: process_lines = filter(None, process_lines) judge_lines = filter(None, judge_lines) print pr...
Python
0.000001
9d24ced3ea0cc010bd210643ee57895624892ee2
Create power10.py
power10.py
power10.py
import pandas as pd import requests import time import numpy as np import itertools from lxml import html from lxml import etree def get_p10_results(events, ages, sexes, years): """ Return a dictionary combining results returned for a given combination of url parameters. """ # xpath patterns ...
Python
0
143bd8066ed53f7a1f70664f89dfd7323aba8e57
Create 07.py
02/qu/07.py
02/qu/07.py
# Define a procedure, is_friend, that takes # a string as its input, and returns a # Boolean indicating if the input string # is the name of a friend. Assume # I am friends with everyone whose name # starts with either 'D' or 'N', but no one # else. You do not need to check for # lower case 'd' or 'n' def is_friend(na...
Python
0
f7d15618c661f1e7f555ce9d9a12fdbc851e76c9
fix handling of version
octave_kernel/_version.py
octave_kernel/_version.py
__version__ = '0.33.1'
Python
0
b7b088fc8e46376c8cb4608738c9dffcdb7d5dec
Add a test to verify filedes.subprocess.Popen()'s close_fds
tests/subprocess.py
tests/subprocess.py
from __future__ import absolute_import from filedes.test.base import BaseFDTestCase from filedes.subprocess import Popen from filedes import get_open_fds from subprocess import PIPE, STDOUT import filedes class SubprocessTests(BaseFDTestCase): def testPopenCloseFds(self): r, w = filedes.pipe() t...
Python
0.000001
be9d5ffc427c7303d6c85a091d2508021cc330dd
Add utility tests
tests/test_utils.py
tests/test_utils.py
import numpy as np import scarab from nose.tools import * from common.utils import * def test_binary(): a = binary(1, size=5) assert_true(np.all(a == [0, 0, 0, 0, 1])) a = binary(2, size=3) assert_true(np.all(a == [0, 1, 0])) def test_encrypt_index(): pk, sk = scarab.generate_pair() c = encr...
Python
0.000001
f3a4f4d200648becaaf63996d6ff0a6d9d770adb
update codes
src/yoda_tools/validate/cvvalidator.py
src/yoda_tools/validate/cvvalidator.py
# Supporting Python3 try: import urllib.request as request except ImportError: import urllib as request import xml.etree.ElementTree as ET import odm2api.ODM2.models as odm2model url = "http://vocabulary.odm2.org/api/v1/%s/?format=skos" vocab= {"ActionTypeCV": "actiontype", "QualityCodeCV": "qualityc...
Python
0
32c32d38d1305b92bcda07efaadd3b29dbf4ac31
add piling-up
python/containers/piling-up/piling-up.py
python/containers/piling-up/piling-up.py
from collections import deque if __name__ == "__main__": T = int(raw_input()) for _ in xrange(T): n = int(raw_input()) sl = deque(map(int, raw_input().split())) ans = [] while len(sl) > 0: if sl[0] >= sl[-1]: ans.append(sl[0]) sl.pople...
Python
0.00007
5c57882c74cf8dad132b255a285566c7329a1569
add google reader starred python example
pythonexamples/addGoogleReaderStarred.py
pythonexamples/addGoogleReaderStarred.py
#!/usr/bin/python import sys sys.path.append('../lib/py') # unnecessary if libZotero is installed separately import json import time import argparse from libZotero import zotero parser = argparse.ArgumentParser(description='Add starred items from google reader to your Zotero library.') parser.add_argument('--library...
Python
0
2e7252fab4667047c04b540040d5ad2287a73299
Add management command to import geolocation data
parrainage/app/management/commands/import_geoloc.py
parrainage/app/management/commands/import_geoloc.py
# Copyright 2017 Raphaël Hertzog # # This file is subject to the license terms in the LICENSE file found in # the top-level directory of this distribution. import argparse from datetime import datetime import csv import logging import sys from django.core.management.base import BaseCommand from django.db import trans...
Python
0.000001
3d7640a014d110f5600dc317b16585874934b3e7
check updates for amazon linux
check_updates_amazonlinux.py
check_updates_amazonlinux.py
#!/usr/bin/python import subprocess,sys,json METRIC_UNITS={'Available_Updates':'count','Security_Updates':'count'} PLUGIN_VERSION="1" HEARTBEAT="true" class datacollector: def __init__(self): self.data={} self.data['plugin_version']=PLUGIN_VERSION self.data['heartbeat_required']=HEARTBEAT...
Python
0
73bb34ad6e481f5ebcc3623d7f63af87986d3cc7
Create new package. (#5642)
var/spack/repos/builtin/packages/r-affycomp/package.py
var/spack/repos/builtin/packages/r-affycomp/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
9c869e97967c9029cdb37745f9e4ca43ef5fcecc
add vmTweak vfhostdev2interface.py
vmm/kvm/deploy-tweaks.d.example/vfhostdev2interface.py
vmm/kvm/deploy-tweaks.d.example/vfhostdev2interface.py
#!/usr/bin/env python # -------------------------------------------------------------------------- # # Copyright 2015-2018, StorPool (storpool.com) # # # # Licensed under the Apache License, Version 2.0 (the "Licen...
Python
0
2ea0f3c172f80e8ca5dc55d1ab6416707d4ba485
Add motor configuration
core/mongo.py
core/mongo.py
from motor.motor_tornado import MotorClient def mongo_configurations(config): return MotorClient(config.get('MONGO_URI'))
Python
0.000002
679b94772232e20095692361a43d48834ed383f3
Create flight.py
flight.py
flight.py
''' Created on Aug 12, 2015 @author: sadhna01 ''' ''' Created on Aug 12, 2015 @author: sahil.singla01 ''' class Flight: def __init__(self): self.__flight_id=None self.__flight_name=None self.__source=None self.__destination=None self.__departure_time=None self.__ar...
Python
0.000054
be4abd8d3b54ab66f89c88e56cb948d5bf5f5725
Add the static info gatherer
stoneridge_info_gatherer.py
stoneridge_info_gatherer.py
#!/usr/bin/env python try: import configparser except ImportError: import ConfigParser as configparser import json import os import platform import stoneridge class StoneRidgeInfoGatherer(object): def run(self): info_file = os.path.join(stoneridge.bindir, 'application.ini') cp = configpa...
Python
0
daf6ef7990cb56c960f5099dcee5ebc93596dba0
Add verifier
coliziune/verifier.py
coliziune/verifier.py
def verify(n, m, b, first, second): s1, s2 = 0, 0 for i in range(len(first)): s1 += (int(first[i]) + 1) * b ** (n-i) s2 += (int(second[i]) + 1) * b ** (n-i) return s1 % m == s2 % m with open('coliziune.in') as fin, open('coliziune.out') as fout: input_lines = fin.readlines()[1:] out...
Python
0.000006
e1a836a5f0bf45854ae634134984a69517c4c1e0
fix wrong variable name was used
django_object_actions/utils.py
django_object_actions/utils.py
from functools import wraps from django.conf.urls import patterns from django.contrib import messages from django.db.models.query import QuerySet from django.http import Http404, HttpResponse, HttpResponseRedirect from django.views.generic import View from django.views.generic.detail import SingleObjectMixin class D...
from functools import wraps from django.conf.urls import patterns from django.contrib import messages from django.db.models.query import QuerySet from django.http import Http404, HttpResponse, HttpResponseRedirect from django.views.generic import View from django.views.generic.detail import SingleObjectMixin class D...
Python
0.000003
3dfe72a6da11e8223a66e86fabf67146e1d4cb1f
Add base error type for user code
app/common/errors.py
app/common/errors.py
from __future__ import unicode_literals, absolute_import, division class BaseAppError(Exception): pass
Python
0.000001
47abeb5aecd01a0841349e0c7b167b13782a9f2a
add test for Newton solver.
test/odl_solvers/vector/newton_test.py
test/odl_solvers/vector/newton_test.py
# Copyright 2014, 2015 The ODL development group # # This file is part of ODL. # # ODL is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. ...
Python
0
f8373cefae048b8d60db06d9527c45375d49549e
Add locust test script.
testing/cloudControllerLocustTester.py
testing/cloudControllerLocustTester.py
from locust import HttpLocust, TaskSet, task class WebsiteTasks(TaskSet): @task def index(self): self.client.get("/service") class WebsiteUser(HttpLocust): task_set = WebsiteTasks min_wait = 1000 max_wait = 1000
Python
0
85c6aad62db7c7c5daa47eff871fbd1483c8dff9
Add a gdb viewer for skbitmap.
tools/gdb/bitmap.py
tools/gdb/bitmap.py
# Copyright 2017 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Visualize bitmaps in gdb. (gdb) source <path to this file> (gdb) sk_bitmap <symbol> This should pop up a window with the bitmap displayed. Right clicking should bring up a menu, al...
Python
0.000007
5a2394f8445350387adc30dd5bc818971aefc91d
Add work for Exercise 25.
lpthw/ex25.py
lpthw/ex25.py
def break_words(stuff): """This function will brea up words for us.""" words = stuff.split(' ') return words def sort_words(words): """Sorts the words.""" return sorted(words) def print_first_word(words): """Prints the first word after popping it off.""" word = words.pop(0) print word ...
Python
0
f8e78cdf12142b214f7f6513dc858abffc133789
add test suite for issues and bugs
test_project/test_project/test_bugs.py
test_project/test_project/test_bugs.py
import unittest import transaction import testing.postgresql import webtest import urllib from pyramid.paster import get_app from sqlalchemy import create_engine from .models import ( DBSession, Base ) from . import test_data class TestBugs(unittest.TestCase): '''Tests for issues. https://github.com...
Python
0
98a50ad5cbcf6239d9ebcecb13d99e6078c93668
add plot file
tools/scripts/mosaic/plots/plot_all.py
tools/scripts/mosaic/plots/plot_all.py
#!/usr/bin/env python # Plot the output of process-all-latencies.rb import matplotlib.pyplot as plt import argparse import yaml import os queries = ['1', '3', '4', '6', '11a', '12', '17'] nodes = [1, 4, 8, 16, 31] scale_factors = [0.1, 1, 10, 100] tuple_sizes = {0.1: 8 * 10**5, 1: 8 * 10**6, 10: 8 * 10**7, 100: 8*10...
Python
0.000001
650b0db8f27f90d1092ffd4295ec154c33f25cde
test commit
pid.py
pid.py
#!/usr/bin/env python #coding: utf-8 import jpype,time,os #开启JVM,且指定jar包位置 jarpath = os.path.join(os.path.abspath('.'), '/work/appiumframework/apps/') print(jarpath, jpype.getDefaultJVMPath()) jpype.startJVM(jpype.getDefaultJVMPath(), "-ea", "-Djava.ext.dirs=%s" % jarpath) print("toe he") #引入java程序中的类.路径应该是项目中的packa...
Python
0.000001
abab11646518f78019d44542c277cadfbb354c1a
add computation of temperature within a season
scripts/feature/temperature_in_season.py
scripts/feature/temperature_in_season.py
import psycopg2 import numpy import datetime COOP = psycopg2.connect(database='coop', host='iemdb', user='nobody') cursor = COOP.cursor() # 50 to 120 in_summer = numpy.zeros( (70,)) counts = numpy.zeros( (70,)) in_jja = numpy.zeros( (70,)) cofreq = numpy.zeros( (70,)) for year in range(1893,2013): cursor.execute(...
Python
0.999066
6e62c6e65376c890adb4c3f56159ba8cc857d565
Create new_file.py
new_file.py
new_file.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """A new file""" print 'New files rule!'
Python
0.000006
9cd2eb451f14656668953db13acff7911047bf9f
Add a tool to be able to diff sln files
tools/pretty_sln.py
tools/pretty_sln.py
#!/usr/bin/python2.5 # Copyright 2009 Google Inc. # All Rights Reserved. """Prints the information in a sln file in a diffable way. It first outputs each projects in alphabetical order with their dependencies. Then it outputs a possible build order. """ __author__ = 'nsylvain (Nicolas Sylvain)' import re ...
Python
0
ef56a72b73bd408bb51d235b2274eef8766e0277
add simple watch_notify stress test
teuthology/task/watch_notify_stress.py
teuthology/task/watch_notify_stress.py
import contextlib import logging from ..orchestra import run log = logging.getLogger(__name__) @contextlib.contextmanager def task(ctx, config): """ Run test_stress_watch The config should be as follows: test_stress_watch: clients: [client list] example: tasks: - ceph: - t...
Python
0.000017
1c68c6b3da5677ce0847eb563bfea0ed3d8810a0
add language detection tween (from PATH_INFO)
amnesia/translations/tweens.py
amnesia/translations/tweens.py
# -*- coding: utf-8 -*- def path_info_lang_tween_factory(handler, registry): def path_info_lang_tween(request): if not hasattr(request, '_LOCALE_'): if request.path_info_peek() in ('en', 'fr'): lang = request.path_info_pop() else: lang = 'en' ...
Python
0
38d340c2a866a445160393029fa3b0c07131818a
Create test-tport.py
test/python/test-tport.py
test/python/test-tport.py
import os import sys from tibrv.tport import * from tibrv.status import * from tibrv.tport import * import unittest class TransportTest(unittest.TestCase): @classmethod def setUpClass(cls): status = Tibrv.open() if status != TIBRV_OK: raise TibrvError(status) @classmethod ...
Python
0.000002
b45b425414da5fc65f171b6f81c5983aade98fb6
Add run.py
run.py
run.py
# -*- coding: utf-8 -*- """ This script generates all the relevant figures from the experiment. """ from Modules.processing import * from Modules.plotting import * def main(): save = True savetype = ".pdf" plot_perf_curves(save=save, savetype=savetype) plot_perf_re_dep(save=save, savetype=savetype, e...
Python
0.000009
103f1fe13a8a807a0bfc93df5e4b1a17281e28b4
Create tool instance and run from command line
run.py
run.py
#!/usr/bin/env python from performance_testing.command_line import Tool def main(): tool = Tool(config='config.yml', output_directory='result') tool.run() if __name__ == '__main__': main()
Python
0
0700ce9be37ada187105c5f38983092b6bba9762
Test new backend methods
test/util/test_backend.py
test/util/test_backend.py
# -*- encoding: utf-8 -*- from __future__ import print_function import unittest import mock from autosklearn.util.backend import Backend class BackendModelsTest(unittest.TestCase): class BackendStub(Backend): def __init__(self, model_directory): self.__class__ = Backend self.get_...
Python
0.000001
faffa1c83e599730105f1fe38b253aafb2b00d18
Add headerimage tests
src/zeit/content/cp/browser/blocks/tests/test_headerimage.py
src/zeit/content/cp/browser/blocks/tests/test_headerimage.py
import zeit.cms.testing import zeit.content.cp import zeit.content.cp.centerpage class TestHeaderImage(zeit.cms.testing.BrowserTestCase): layer = zeit.content.cp.testing.ZCML_LAYER def setUp(self): super(TestHeaderImage, self).setUp() with zeit.cms.testing.site(self.getRootFolder()): ...
Python
0
bdd532cccf504dc9fbf21a9e72b8185dc910ec94
Add management command for running the task for validating all data catalogs.
thezombies/management/commands/validate_all_data_catalogs.py
thezombies/management/commands/validate_all_data_catalogs.py
from django.core.management.base import NoArgsCommand from thezombies.tasks.main import validate_data_catalogs class Command(NoArgsCommand): """Validate all of the agency data catalogs""" def handle_noargs(self): validator_group = validate_data_catalogs.delay() self.stdout.write(u"\nSpawned d...
Python
0.000001
0dbc7432bf78850dee10b8d814b1d9eb74fa5afc
add test wing defender play
soccer/gameplay/plays/testing/test_wing_defender.py
soccer/gameplay/plays/testing/test_wing_defender.py
import play import behavior import constants import robocup import tactics.positions.wing_defender import main class TestWingDefender(play.Play): def __init__(self): super().__init__(continuous=True) self.add_transition(behavior.Behavior.State.start, behavior.Behavior.S...
Python
0.000001
a2086c9c5c11586b04ca934bdad838babad087ee
add a mk-wof-config utility script
utils/mk-wof-config.py
utils/mk-wof-config.py
#!/usr/bin/env python import sys import os import json import random import logging import socket import mapzen.whosonfirst.placetypes if __name__ == '__main__': import optparse opt_parser = optparse.OptionParser() opt_parser.add_option('-w', '--wof', dest='wof', action='store', default=None, help='The...
Python
0
0fb8dec880b7a48002929fc54c6e337be63afa05
Add missing manage.py
travis_ci/manage.py
travis_ci/manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "travis_ci.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Python
0.00001
24e14b7d53e43f1574971ff5b6eee6d0185df23a
Add tests for retrieving/updating reverse fks
rest_framework/tests/nested_relations.py
rest_framework/tests/nested_relations.py
from copy import deepcopy from django.db import models from django.test import TestCase from rest_framework import serializers # ForeignKey class ForeignKeyTarget(models.Model): name = models.CharField(max_length=100) class ForeignKeySource(models.Model): name = models.CharField(max_length=100) target ...
Python
0
78fa851ffa6a9594dbbd41a6d572674552d76c85
Install constants file.
txrudp/constants.py
txrudp/constants.py
"""Constants governing operation of txrudp package.""" # [bytes] UDP_SAFE_PACKET_SIZE = 1000 # [length] WINDOW_SIZE = 65535 // UDP_SAFE_PACKET_SIZE # [seconds] TIMEOUT = 0.7 # [seconds] _MAX_PACKET_DELAY = 20 # If a packet is retransmitted more than that many times, # the connection should be considered broken. MA...
Python
0
9d550e9403560a84a75aad55a91ca661fcef7957
Implement a hook for Issue #41
aspen/hooks/options200.py
aspen/hooks/options200.py
from aspen import Response def hook(request): """A hook to return 200 to an 'OPTIONS *' request""" if request.line.method == "OPTIONS" and request.line.uri == "*": raise Response(200) return request
Python
0.000002
632b3530f6b04d82bc66299d34137d3a76fb8f90
add a test for only loading N items parameter
tests/test_special_feeds.py
tests/test_special_feeds.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ libG(oogle)Reader Copyright (C) 2010 Matt Behrens <askedrelic@gmail.com> http://asktherelic.com Python library for working with the unofficial Google Reader API. Unit tests for feeds. Requires mechanize for automated oauth authenication. """ try: import unitte...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ libG(oogle)Reader Copyright (C) 2010 Matt Behrens <askedrelic@gmail.com> http://asktherelic.com Python library for working with the unofficial Google Reader API. Unit tests for feeds. Requires mechanize for automated oauth authenication. """ try: import unitte...
Python
0
8ee78c14af3b9974ad96cf85f6ea32c4e254f958
Add calcurse-dateutil
contrib/calcurse-dateutil.py
contrib/calcurse-dateutil.py
#!/usr/bin/env python3 import argparse import datetime def get_date(s): return datetime.datetime.strptime(s, '%Y-%m-%d').date() parser = argparse.ArgumentParser('calcurse-dateutil') parser.add_argument('--date', type=get_date, action='store', dest='date') parser.add_argument('--range', type=int, action='store'...
Python
0.000568
bbf1e1532ef1827c808c60fe8f7459a438789aaf
work on csv collection
smappdragon/collection/csv_collection.py
smappdragon/collection/csv_collection.py
import os import unicodecsv from smappdragon.tools.tweet_parser import TweetParser from smappdragon.collection.base_collection import BaseCollection class CsvCollection(BaseCollection): ''' method that tells us how to create the CsvCollection object ''' def __init__(self, filepath): ...
Python
0
755f6f701c5bef733531c33da2b1a0918a9f84dc
add daemonize
tsutil/daemonize.py
tsutil/daemonize.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: Turbidsoul Chen # @Date: 2014-03-07 17:11:20 # @Last Modified by: Turbidsoul Chen # @Last Modified time: 2014-07-16 15:52:49 import os import sys def daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): try: pid = os.fork() ...
Python
0.000002
aeb633ae76f2ffe0e927a3230e1ad456891c9afc
add chart networth endpoint
sample-code/Python/get_chart_networth.py
sample-code/Python/get_chart_networth.py
''' - login and get token - process 2FA if 2FA is setup for this account - if the user is a regular customer then get cashflow chart data for this user - if the user is a partner_admin then get a cashflow chart data for the first user from the list of users this partner admin has access to ''' import requests import j...
Python
0
e8235b10c610aae51213e8f090e3bf692f99adcc
Add the cbtf-lanl spack build package. cbtf-lanl is LANLs contribution to the CBTF project. It contains psTool and memTool which are example tools, showing use case examples for CBTF.
var/spack/packages/cbtf-lanl/package.py
var/spack/packages/cbtf-lanl/package.py
################################################################################ # Copyright (c) 2015 Krell Institute. All Rights Reserved. # # 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; eith...
Python
0
e3842cfbdfbf5c28e70916080fe4ce1ffad7c75c
Add bleu-score calculator
CA4011/bleu-score.py
CA4011/bleu-score.py
print((lambda n,p,t,r:min(1,len(t)/len(r))*__import__(math).pow(p(n,t,r,1)*p(n,t,r,2)*p(n,t,r,3)*p(n,t,r,4),0.25))(lambda s,l:[s[i:i+l]for i in range(len(s)-l+1)],lambda n,t,r,s:(lambda T,R:sum([g in R and(R.remove(g)or 1)for g in T])/len(T)if len(T+R)else 1)([.join(x)for x in n(t,s)],[.join(x)for x in n(r,s)]),print(E...
Python
0
adbe1d4f06028ba13e21386f7d62939d4b2eb740
Add PatchELF package
var/spack/packages/patchelf/package.py
var/spack/packages/patchelf/package.py
from spack import * class Patchelf(Package): """PatchELF is a small utility to modify the dynamic linker and RPATH of ELF executables.""" homepage = "https://nixos.org/patchelf.html" url = "http://nixos.org/releases/patchelf/patchelf-0.8/patchelf-0.8.tar.gz" list_url = "http://nixos.org/releases/...
Python
0
b4d6fc7ed10bb7e424797aaa8bcfff8ad738cd97
Add __init__ file to permit import as module
__init__.py
__init__.py
Python
0.000004
195eba54a45e8d841e1e9574938bef1d2440eb06
Create __init__.py
__init__.py
__init__.py
Python
0.000429
2124026b3b6468789f599a2bc5382e69e3d27310
Add __main__.py
__main__.py
__main__.py
#! usr/bin/env python2 import PlayAsOne if __name__ == '__main__': PlayAsOne.PlayAsOne()
Python
0.001431
b46e223340ecb4c4056eb89fa08aaff64fceaa09
Add command
mangaki/mangaki/management/commands/findneighbors.py
mangaki/mangaki/management/commands/findneighbors.py
from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User from mangaki.models import Neighborship, Rating from collections import Counter class Command(BaseCommand): args = '' help = '' def handle(self, *args, **options): values = {'like': 2, 'dis...
Python
0.001952
7627d58460c3683e51f944e49dc9ab31c8beda06
Create default_gateway_checker.py
mk-verificator/networking/default_gateway_checker.py
mk-verificator/networking/default_gateway_checker.py
#!/usr/bin/env python import json import salt.client as client def main(): local = client.LocalClient() netstat_info = local.cmd('*', 'cmd.run', ['ip r | sed -n 1p']) # {node:"default via 10.xxx.xxx.xxx dev ethx", } groups = {} for node_name, node_gw in netstat_info.items(): group_na...
Python
0.000003
12c50dbac8179b92272136c512e034f6782027df
Introduce a GlobalStack class
cura/Settings/GlobalStack.py
cura/Settings/GlobalStack.py
# Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase from UM.Settings.ContainerStack import ContainerStack from UM.Settings.ContainerRegistry import ContainerRegistry class CannotSetNextStackError(Exception): pas...
Python
0
f5ef5c2a986d56495069c7ccad5e56fb097ea17b
Create t.py
t.py
t.py
from appJar import gui import sys keyfilename = "" keyfileinuse = False port = sys.argv[4] ip = sys.argv[1] username = sys.argv[2] password = sys.argv[3] #The stuff above takes args from login.py balance = 0 #Gets balance app = gui("HODLER ADMIN", "400x200") app.setFont(10) app.addLabelOptionBox("Options", ["File","...
Python
0.000001