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
f06d8ccbd066c432a91ffc127d347277253f95c3
Add pynbs module
pynbs.py
pynbs.py
from struct import Struct from collections import namedtuple __all__ = ['read', 'File', 'Header', 'Note', 'Layer', 'Instrument'] BYTE = Struct('<b') SHORT = Struct('<h') INT = Struct('<i') Note = namedtuple('Note', ['tick', 'layer', 'instrument', 'key']) Layer = namedtuple('Layer', ['id', 'name', '...
Python
0
6050610a5cf34bc55a05fa3a8d8a38f6e8e743af
Add test_ko.py for "ko" locale (#9)
tests/localization_tests/test_ko.py
tests/localization_tests/test_ko.py
# -*- coding: utf-8 -*- from pendulum import Pendulum from .. import AbstractTestCase from . import AbstractLocalizationTestCase class KoTest(AbstractLocalizationTestCase, AbstractTestCase): locale = 'ko' def diff_for_humans(self): with self.wrap_with_test_now(): d = Pendulum.now().su...
Python
0
013c6c57959fd8317ba8b27a2a467a37f0a1d8be
Create __init__.py
stock/__init__.py
stock/__init__.py
Python
0.000429
1eb1851e4dec9c6425c3cf127e6c4ec5b0d3c987
Add LineNumberTable tests
tests/test_line_number_attribute.py
tests/test_line_number_attribute.py
# -*- coding: utf-8 -*- import os.path import pytest from jawa import ClassFile @pytest.fixture def cf(): sample_path = os.path.join( os.path.dirname(__file__), 'data', 'HelloWorldDebug.class' ) with open(sample_path, 'rb') as fin: cf = ClassFile(fin) yield cf ...
Python
0
beb98425423e0278d9d4d5e39e6b5196146425a0
add manual tests
manual_tests.py
manual_tests.py
import os import sys import copy from estnin import estnin from estnin import _estnin from datetime import date from timeit import default_timer as timer def target(count): # return [p for p in estnin.create(estnin.FEMALE, date(2199, 12, 1), 0)] for _ in range(count): #estnin(89912319991, set_checksu...
Python
0
cf0021c664612082c669fc562d98759fcd7a4915
Add setup.py
setup.py
setup.py
# Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: ...
Python
0.000001
e785008aa948e929f7e3ecab3445c1347cb128f3
Add setup.py file
setup.py
setup.py
#!/usr/bin/env python from setuptools import find_packages from setuptools import setup setup( name='django-signage', version='0.0.1', description='A lightweight web-based digital signage application', license='BSD', author='Jason Bittel', author_email='jason.bittel@gmail.com', url='https...
Python
0.000001
7a21009efda275372be7b801e07635bd2a9e47af
add setup.py
setup.py
setup.py
import os from setuptools import setup, find_packages import coupons def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='django-coupons', version=coupons.__version__, description='A reuseable Django application for coupon gereration and handling.', lo...
Python
0.000001
d0430066830350b3ef1621bb7c9d7ae7ae7045f4
Add setup.py.
setup.py
setup.py
""" * Copyright (c) 2016. Mingyu Gao * All rights reserved. * """ import os import re # To use a consistent encoding from codecs import open # Always prefer setuptools over distutils import setuptools here = os.path.abspath(os.path.dirname(__file__)) package = 'easypyplot' version = '0.0.0' desc = 'Python matplotl...
Python
0
3f1b78f5156a6ee18020340290dde24d02d01105
Add basic setup.py
setup.py
setup.py
""" Flask-AtlassianConnect ------------- This is the description for that library """ from setuptools import setup setup( name='AC-Flask-HipChat', version='0.1-dev', url='https://bitbucket.org/mrdon/ac-flask-hipchat', license='APLv2', author='Don Brown', author_email='mrdon@twdata.org', d...
Python
0.000002
ec25f1901d60814a62790cae2becfb6cac0f5e3e
add argparse dep
setup.py
setup.py
#!/usr/bin/python from setuptools import setup, find_packages setup( name='configdb', version='0.1', description='database framework for configuration info', author='ale', author_email='ale@incal.net', url='http://git.autistici.org/p/configdb', install_requires=['argparse', 'Flask', 'formencode', 'infle...
#!/usr/bin/python from setuptools import setup, find_packages setup( name='configdb', version='0.1', description='database framework for configuration info', author='ale', author_email='ale@incal.net', url='http://git.autistici.org/p/configdb', install_requires=['Flask', 'formencode', 'inflect', 'SQLAlc...
Python
0.000019
089b020b07fda88ba4679d161badb4423a75444e
add Python setup script
setup.py
setup.py
# Based on PyPA sample project's setup script. """Pymultihash installation script.""" import os.path from setuptools import setup # Load readme file into long description. thisdir = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(thisdir, 'README.rst')) as readme: long_description = readme.read...
Python
0
67b5eb144dbe14c134657ccc807343f361c5e249
add setup.py
setup.py
setup.py
from distutils.core import setup version = '0.1.0.dev0' setup(name='sworkflow', version=version, description='Simple Workflow', url='https://github.com/mydeco-dev-team/sworkflow', packages=['sworkflow'], )
Python
0.000001
4161de9755b531825e83f684c964441bff9ffa7d
bump version to 1.0.0
setup.py
setup.py
""" setup.py """ from setuptools import setup version = "1.0.0" setup( name="nco", version=version, author="Joe Hamman", author_email="jhamman@ucar.edu", license="MIT", description="""python bindings to NCO""", packages=["nco"], py_modules=["nco.nco", "nco.custom"], url="https://g...
""" setup.py """ from setuptools import setup version = "0.0.4" setup( name="nco", version=version, author="Joe Hamman", author_email="jhamman@ucar.edu", license="MIT", description="""python bindings to NCO""", packages=["nco"], py_modules=["nco.nco", "nco.custom"], url="https://g...
Python
0
d0b1762a098e78ee9d012628ad96d6a18e8d2565
Create setup.py
setup.py
setup.py
from distutils.core import setup import py2exe setup(console=["./server.py"], data_files=[('.', ['./config.ini'])])
Python
0.000001
7b6610e03d4485575b18881c375f83e999d20459
Add setup.py #1
setup.py
setup.py
from setuptools import setup import io import os here = os.path.abspath(os.path.dirname(__file__)) def read(*filenames, **kwargs): encoding = kwargs.get('encoding', 'utf-8') sep = kwargs.get('sep', '\n') buf = [] for filename in filenames: with io.open(filename, encoding=encoding) as f: ...
Python
0
c43802f4cc071c6baf31f8d1461ce8c96e38fa9e
Bump greenlet==0.4.0 to support ARM architectures.
setup.py
setup.py
#!/usr/bin/env python try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup import os import sys # Add /usr/local/include to the path for macs, fixes easy_install for several packages (like gevent and pyyaml) if sys.platform == 'darwin': os.environ['C_INCLU...
#!/usr/bin/env python try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup import os import sys # Add /usr/local/include to the path for macs, fixes easy_install for several packages (like gevent and pyyaml) if sys.platform == 'darwin': os.environ['C_INCLU...
Python
0
3a6dd52e3cdfc5eca51d6dac4eb0701a1a04d550
make version 0.3.5
setup.py
setup.py
from setuptools import setup setup(name='DukeDSClient', version='0.3.5', description='Command line tool(ddsclient) to upload/manage projects on the duke-data-service.', url='https://github.com/Duke-GCB/DukeDSClient', keywords='duke dds dukedataservice', author='John Bradley', ...
from setuptools import setup setup(name='DukeDSClient', version='0.3.4', description='Command line tool(ddsclient) to upload/manage projects on the duke-data-service.', url='https://github.com/Duke-GCB/DukeDSClient', keywords='duke dds dukedataservice', author='John Bradley', ...
Python
0.000016
995c75162a00b89fe23f43ec12f5e9495deb7799
add optionnal dependancies
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim:set expandtab tabstop=4 shiftwidth=4: import os import re import sys from distutils.core import setup #some install path variables sysconfdir = os.getenv("SYSCONFDIR", "/etc") datarootdir = os.getenv("DATAROOTDIR", sys.prefix) data_dir = os.path.join(sys.prefix, 's...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim:set expandtab tabstop=4 shiftwidth=4: import os import re import sys from distutils.core import setup #some install path variables sysconfdir = os.getenv("SYSCONFDIR", "/etc") datarootdir = os.getenv("DATAROOTDIR", sys.prefix) data_dir = os.path.join(sys.prefix, 's...
Python
0
b25e21745ecdc5c03b3229ba77ee51b5fdd1561d
Move scapy to scapyproto to avoid breaking import of scapy from inside of protocols
ooni/protocols/scapyproto.py
ooni/protocols/scapyproto.py
import random from zope.interface import implements from twisted.python import usage from twisted.plugin import IPlugin from twisted.internet import protocol, defer from ooni.plugoo.tests import ITest, OONITest from ooni.plugoo.assets import Asset from ooni.utils import log from ooni.lib.txscapy import txsr, txsend c...
Python
0
3cab374806f9fd8a5fd90265025a4b021e0056f6
add preliminary mergetools tests
test_mergetools.py
test_mergetools.py
""" Tests for the mergetools.py script. """ import tempfile import random from contextlib import contextmanager import string import datetime import csv import pandas as pd import mergetools from scraper import CSV_HEADERS def random_str(length, chars=string.ascii_lowercase): return ''.join(random.choice(chars) ...
Python
0
992191d290df8d7764a272c3b45e2f7b937456ec
add fib
misc/py3/fib.py
misc/py3/fib.py
#!/usr/bin/env python # Python 3: Fibonacci series up to n def fib(n): a, b = 0, 1 while a < n: print(a, end=' ') a, b = b, a + b print() fib(1000)
Python
0.999999
abf7b0ffd86656f8311da7bfde65663d35ffd543
fix for using stencilview
kivy/uix/scrollview.py
kivy/uix/scrollview.py
''' Scroll View =========== A ScrollView provides a scrollable/pannable viewport which is clipped to the ScrollView's bounding box. ''' __all__ = ('ScrollView', ) from kivy.uix.stencilview import StencilView from kivy.uix.scatter import ScatterPlane class ScrollView(StencilView): '''ScrollView class. See modul...
''' ScrollView widget ''' __all__ = ('ScrollView', ) from kivy.uix.stencil import StencilView from kivy.uix.scatter import ScatterPlane class ScrollView(StencilView): ''' ScrollView: A ScrollView provides a scrollable/pannable viewport which is clipped to the ScrollView's bounding box. '...
Python
0.000001
befa79ec76752f0811b49ec323813e6e1931638d
Create solution.py
hackerrank/algorithms/implementation/medium/bigger_is_greater/py/solution.py
hackerrank/algorithms/implementation/medium/bigger_is_greater/py/solution.py
def solution(s): # # The next permutation algorithm. For more information, please look up: # [href.] https://www.nayuki.io/page/next-lexicographical-permutation-algorithm # [href.] https://en.wikipedia.org/wiki/Permutation#Generation_in_lexicographic_order # chars = list(s) i = len(...
Python
0.000018
8738148bc5c1c650a4196b73f9f6d311dddeafea
Add validator for the DEP-11 file-format
contrib/dep11/dep11-validate.py
contrib/dep11/dep11-validate.py
#!/usr/bin/python3 # # Copyright (C) 2014 Matthias Klumpp <mak@debian.org> # # Licensed under the GNU General Public License Version 3 # # 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, either ve...
Python
0.000001
df8ddd56ad51f0a644696cb0ff12c2e7a17c5913
Create lonely-pixel-i.py
Python/lonely-pixel-i.py
Python/lonely-pixel-i.py
# Time: O(m * n) # Space: O(m + n) class Solution(object): def findLonelyPixel(self, picture): """ :type picture: List[List[str]] :rtype: int """ rows, cols = [0] * len(picture), [0] * len(picture[0]) for i in xrange(len(picture)): for j in xrange(len(p...
Python
0.00022
c1dcb46e95d5b96ecf45db2e1f466b6f99330e1c
Add VimwikiTask cache-ing
taskwiki/cache.py
taskwiki/cache.py
import copy import vim class TaskCache(object): """ A cache that holds all the tasks in the given file and prevents multiple redundant taskwarrior calls. """ def __init__(self, tw): self.task_cache = dict() self.vimwikitask_cache = dict() self.tw = tw def __getitem__(...
import copy import vim class TaskCache(object): """ A cache that holds all the tasks in the given file and prevents multiple redundant taskwarrior calls. """ def __init__(self, tw): self.cache = dict() self.tw = tw def __getitem__(self, key): task = self.cache.get(key...
Python
0
67c3c0e3c165dc73f548cff57d6cb390614d5aad
Bring back old watcher module
virtool/watcher.py
virtool/watcher.py
import os import time import logging from virtool.utils import file_stats from setproctitle import setproctitle from multiprocessing import Process from inotify.adapters import Inotify logger = logging.getLogger(__name__) TYPE_NAME_DICT = { "IN_CREATE": "create", "IN_MODIFY": "modify", "IN_DELETE": "dele...
Python
0
4d08ff430eba96ebef3f0824fe83f5bc2a236675
add share_mem
multiprocessing/share_mem.py
multiprocessing/share_mem.py
#!/usr/bin/env python from multiprocessing import Process, Value, Array def f(n, a): n.value = 3.1415927 for i in range(len(a)): a[i] = -a[i] if __name__ == '__main__': num = Value('d', 0.0) arr = Array('i', range(10)) p = Process(target=f, args=(num, arr)) p.start() p.join() ...
Python
0
119aabe89912c324d1588601c9cbc4b4a48e16ae
Add restarting_flup.py
restarting_flup.py
restarting_flup.py
#!/usr/bin/env python """ This is the same as the usual .fcgi file[1] for using FastCGI with flup, except that this one terminates itself when the .fcgi fileโ€™s modification date changes. Assuming you have something[2] that restarts FastCGI processes as needed (which you should anyway), this effectively allows you to r...
Python
0.000007
7496159322a173bb6265aed2dac4e50ad64de858
Add base fullfill service
service.py
service.py
from flask import Flask from flask import jsonify from flask import request app = Flask(__name__) @app.route("/chainBot", methods=['POST']) def chainBot(): print(request.data) return jsonify({ "speech": "My Test Speech", "displayText": "My Test Text", "data": {}, "contextOut": ...
Python
0
5b01f26d92a32964bcc97cbf9429177bce7c89be
add tests for progress indicator
tests/test_util.py
tests/test_util.py
# -*- coding: utf-8 -*- from StringIO import StringIO from biseqt.util import ProgressIndicator def test_progress_indicator(): logs = StringIO() ProgressIndicator.write = lambda self, message: logs.write(message) indic = ProgressIndicator(num_total=1) indic.start() indic.progress() assert log...
Python
0
de7aee058348c00d2cdf244df102010b422e941b
Add a place holder for the PSNR metric
toolbox/metrics.py
toolbox/metrics.py
def psnr(y_true, y_pred): raise NotImplementedError
Python
0.000009
0da51215709f338e77acfa6e7933595d0c1df95d
Create SIP OPTIONS sender/receiver.
networks/sip.py
networks/sip.py
# -*- coding: utf-8 -*- import argparse import socket CRLF = '\r\n' def send_sip_options(server_host, server_port, client_host, client_port, verbose=True): """Sends SIP OPTIONS. :param str server_host: SIP server host (IP address). :param int server_port: SIP server port. :param str client_host: Lo...
Python
0
3b9a0c0b83dda484586ea9c19091b7da1cae55d1
prepare a test file for python
test_riak3k.py
test_riak3k.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import nose from nose.tools import * import riak3k
Python
0.000002
8f41417f27e3712dc796bdcb4d0105a12cb3f62c
Add test for mark_list
test/test_mark_list.py
test/test_mark_list.py
from support import lib,ffi from qcgc_test import QCGCTest class MarkListTestCase(QCGCTest): def test_create_destroy(self): """Lifetime management""" for i in range(100): l = lib.qcgc_mark_list_create(i) self.assertNotEqual(l, ffi.NULL) self.assertEqual(l.head, l...
Python
0.000001
17c9e1a16c5c16c1b49836cc376ddd6408b73de0
make the dispatcher a global variable and the deprecation warning more developer friendly
coherence/extern/louie.py
coherence/extern/louie.py
""" Wrapper module for the louie implementation """ import warnings from coherence.dispatcher import Dispatcher class Any(object): pass class All(object): pass class Anonymous(object): pass # fake the API class Dummy(object): pass signal = Dummy() sender = Dummy() #senders sender.Anonymous = Anonymous sender.A...
""" Wrapper module for the louie implementation """ import warnings from coherence.dispatcher import Dispatcher class Any(object): pass class All(object): pass class Anonymous(object): pass # fake the API class Dummy(object): pass signal = Dummy() sender = Dummy() #senders sender.Anonymous = Anonymous sender.A...
Python
0
0475e35bb6e0bab1d61c038ddd902e32478211d7
Create whois.py
whois.py
whois.py
# เธญเนˆเธฒเธ™เธšเธ—เธ„เธงเธฒเธกเน„เธ”เน‰เธ—เธตเนˆ https://python3.wannaphong.com/2016/12/เธ”เธถเธ‡เธ‚เน‰เธญเธกเธนเธฅ-whois-เน‚เธ”เน€เธกเธ™เธ”เน‰เธงเธข-python.html # เน€เธ‚เธตเธขเธ™เน‚เธ”เธข เธงเธฃเธฃเธ“เธžเธ‡เธฉเนŒ เธ เธฑเธ—เธ—เธดเธขเน„เธžเธšเธนเธฅเธขเนŒ import whois w = whois.whois('abc.xyz') # เธเธฃเธญเธเน‚เธ”เน€เธกเธ™เธ—เธตเนˆเธ•เน‰เธญเธ‡เธเธฒเธฃเธ‚เน‰เธญเธกเธนเธฅ Whois print(w.expiration_date) # เธงเธฑเน‰เธ™เธซเธกเธ”เธญเธฒเธขเธธ print(w.text) # เธฃเธฒเธขเธฅเธฐเน€เธญเธตเธขเธ”เน‚เธ”เน€เธกเธ™
Python
0.000003
47f0edcbe4dd4902e679d4f1e384be1795c3d465
Add str() calls around messages in tty
lib/spack/spack/tty.py
lib/spack/spack/tty.py
############################################################################## # Copyright (c) 2013, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 ...
############################################################################## # Copyright (c) 2013, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 ...
Python
0.000001
416872a1e7191f62dd2353f3e221a9e9c93c161f
Add tests for utils.
test_utils.py
test_utils.py
""" Tests for the utils.py file """ import axelrod as axl import unittest import utils import tempfile import csv class TestUtils(unittest.TestCase): """ Simple tests for the utils """ axl.seed(0) players = [s() for s in axl.demo_strategies] tournament = axl.Tournament(players) results = t...
Python
0
b28ace414c7087936ec14665026b78413b1f3791
Create __init__.py
neutron_dynamic_routing/neutron/cmd/eventlet/agents/__init__.py
neutron_dynamic_routing/neutron/cmd/eventlet/agents/__init__.py
Python
0.000429
8c367b23d32e3cefbb6eebd0bb8b53f12d47b3ec
Add a simple cycle finder.
runtests/cycles.py
runtests/cycles.py
""" Finding reference cycles of objects. The analysis is more or less static and oriented for single thread applications. Use objgraph for some of the lower level operations. main entry point is: .. code:: assert_no_cycles(*objs) """ import gc def assert_no_cycles(*objs): ""...
Python
0
bf7ad11cc32af83aab6496ac7d7b911bea3d7876
Use new API.
l10n_it_pec/model/partner.py
l10n_it_pec/model/partner.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 Associazione Odoo Italia # (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General ...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 Associazione Odoo Italia # (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General ...
Python
0
2c590b82b716ecfca9b683afa1181a8368b6cb41
Add some helper methods to deal with sqlite migrations
gertty/dbsupport.py
gertty/dbsupport.py
# Copyright 2014 Mirantis Inc. # Copyright 2014 OpenStack Foundation # # 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...
Python
0
489d883af246e7de727ea14e01ae4a0cd17f88eb
fix emoji on python3.4
limbo/plugins/emoji.py
limbo/plugins/emoji.py
"""!emoji <n> will return n random emoji""" import re import random from emojicodedict import emojiCodeDict def randomelt(dic): keys = list(dic.keys()) i = random.randint(0, len(keys) - 1) return dic[keys[i]] def emoji(n=1): emoji = [] for i in range(n): emoji.append(randomelt(emojiCodeDic...
"""!emoji <n> will return n random emoji""" import re import random from emojicodedict import emojiCodeDict def randomelt(dic): keys = dic.keys() i = random.randint(0, len(keys) - 1) return dic[keys[i]] def emoji(n=1): emoji = [] for i in range(n): emoji.append(randomelt(emojiCodeDict)) ...
Python
0
b35908d8ed8257bfde75953c360112f87c0eccd3
add api/urls.py
django_comments_xtd/api/urls.py
django_comments_xtd/api/urls.py
from django.urls import path, re_path from .views import ( CommentCount, CommentCreate, CommentList, CreateReportFlag, ToggleFeedbackFlag, preview_user_avatar, ) urlpatterns = [ path('comment/', CommentCreate.as_view(), name='comments-xtd-api-create'), path('preview/', preview_user_avatar...
Python
0
8e422c867f25424fbc2d95e4a11cb76ea4de66ac
Create land.py
objects/land.py
objects/land.py
{"rows":[ {"C": [ {"tile_start": "6C","tile_end": "21C", "side": NULL}, {"tile_start": "26C","tile_end": "57C", "side": NULL}, ]}, {"D": [ {"tile_start": "20D","tile_end": "20D", "side": "USA"}, {"tile_start": "38D","tile_end": "42D", "side": "USA"}, {"tile_start": "44D","tile_end": "56D", "side": "USA"} ...
Python
0.000001
4a9a844353a565a596148e31c17dad6b57cda081
Add text encoding functionality.
txtencoding.py
txtencoding.py
#!/usr/bin/env python3 from chardet.universaldetector import UniversalDetector class TxtEncoding: def __init__(self): # inspired by https://chardet.readthedocs.org/en/latest/usage.html#example-detecting-encodings-of-multiple-files self.detector = UniversalDetector() def detectEncoding(self, ...
Python
0.000001
ff7d96204d528e65faec8312e98fd727bd163d08
Save and load files.
scr/model/model.py
scr/model/model.py
# 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/. """ Model implementation """ import json from pathlib import Path _EXTENSION = '.json' def save(data, file_name, fol...
Python
0
24210f31a5b54adf1b3b038fdad73b679656217c
fix mr_unit.py so that it records test failures properly
scripts/mr_unit.py
scripts/mr_unit.py
import sys, os import csv import MySQLdb import traceback def add_perf_results_to_mr_unit(args): mr_unit = MySQLdb.connect(host='mr-0x8', user='root', passwd=args[1], db='mr_unit') mr_unit.autocommit(False) cursor = mr_unit.cursor() try: for row in csv.reader(file(os.path.join(args[2], "perf.cs...
import sys, os import csv import MySQLdb import traceback def add_perf_results_to_mr_unit(args): mr_unit = MySQLdb.connect(host='mr-0x8', user='root', passwd=args[1], db='mr_unit') mr_unit.autocommit(False) cursor = mr_unit.cursor() try: for row in csv.reader(file(os.path.join(args[2], "perf.cs...
Python
0.000001
f424001f409fd35b0e62be9a82d62b21b438e082
Add missing comma
onetime/urls.py
onetime/urls.py
from django.conf.urls.defaults import * from django.views.generic.simple import redirect_to from onetime.views import cleanup, login urlpatterns = patterns('', (r'^cleanup/$', cleanup), (r'^(?P<key>[a-z0-9+])$', login), (r'^$', redirect_to, {'url': None}), )
from django.conf.urls.defaults import * from django.views.generic.simple import redirect_to from onetime.views import cleanup, login urlpatterns = patterns('' (r'^cleanup/$', cleanup), (r'^(?P<key>[a-z0-9+])$', login), (r'^$', redirect_to, {'url': None}), )
Python
0.999998
6d9bf98b5c077421b2cdaca7ae9adf39f4ed475c
Add a migration to rename "type" field to "status"
src/kanboard/migrations/0002_type_to_status.py
src/kanboard/migrations/0002_type_to_status.py
from south.db import db from django.db import models from kanboard.models import * class Migration: def forwards(self, orm): db.rename_column('kanboard_phase', 'type', 'status') def backwards(self, orm): db.rename_column('kanboard_phase', 'status', 'type') models = { 'kan...
Python
0
59f49535cc5f6ad1dbcb579e723d69a9aa1b2304
add signal_comparison.py
metaseq/integration/signal_comparison.py
metaseq/integration/signal_comparison.py
""" Module for working with comparisons between two genomic_signal objects, e.g., genome-wide correlation """ import sys import pybedtools import itertools import numpy as np def compare(signal1, signal2, features, outfn, comparefunc=np.subtract, batchsize=5000, array_kwargs=None, verbose=False): """ C...
Python
0.000003
8d88bf0808c5249d2c1feace5b8a1db1679e44b6
Create tests_unit.py
tests_unit.py
tests_unit.py
""" Nmeta2 Unit Tests Uses pytest, install with: sudo apt-get install python-pytest To run test, type in: py.test tests_unit.py """ #*** Testing imports: import mock import unittest #*** Ryu imports: from ryu.base import app_manager # To suppress cyclic import from ryu.controller import controller from ry...
Python
0.000003
cba429780061bcdafde6f2bc799e74106e2cc336
Create textevolve.py
textevolve.py
textevolve.py
''' Evolve a piece of text with a simple evolutionary algorithm Author: Saquib 7/27/13 ''' import random def fitness(source, target): fitval = 0 for i in range(0, len(source)): fitval += (ord(target[i]) - ord(source[i])) ** 2 return(fitval) def mutate(source): charpos = random.randint(0, len(source)...
Python
0.000001
ff98bdf9ce263648de784183ad5984864f9d387a
Add ref create api test
tests/api/test_refs.py
tests/api/test_refs.py
async def test_create(spawn_client, test_random_alphanumeric, static_time): client = await spawn_client(authorize=True, permissions=["create_ref"]) data = { "name": "Test Viruses", "description": "A bunch of viruses used for testing", "data_type": "genome", "organism": "virus", ...
Python
0.000001
7d21b55f2de7cd2c34cd3cd985824178d382398d
add 'stages' code
util/stages.py
util/stages.py
from astrometry.util.file import * class CallGlobal(object): def __init__(self, pattern, *args, **kwargs): self.pat = pattern self.args = args self.kwargs = kwargs def __call__(self, stage, kwargs): func = self.pat % stage kwa = self.kwargs.copy() kwa.update(kwargs) return func(*self.args, **kwa) def ...
Python
0.000123
6a9447b6fb92369496178b1a379c724dfa9eb7aa
add management command to bootstrap Twilio gateway fees for incoming messages
corehq/apps/smsbillables/management/commands/bootstrap_twilio_gateway_incoming.py
corehq/apps/smsbillables/management/commands/bootstrap_twilio_gateway_incoming.py
import logging from django.core.management.base import LabelCommand from corehq.apps.accounting.models import Currency from corehq.apps.twilio.models import TwilioBackend from corehq.apps.sms.models import INCOMING from corehq.apps.smsbillables.models import SmsGatewayFee, SmsGatewayFeeCriteria logger = logging.getL...
Python
0
ce2eb871b852fafa58c0d92761b38d158b8bbf1e
Add some tests for MultiQuerySet.
utils/tests.py
utils/tests.py
# -*- coding: utf-8 -*- # Universal Subtitles, universalsubtitles.org # # Copyright (C) 2011 Participatory Culture Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either vers...
Python
0
adee3f0763a1119cfac212ce0eca88a08f7c65fa
Create masterStock.py
masterStock.py
masterStock.py
import requests from bs4 import BeautifulSoup import json def loadMasterStock(): url = "http://www.supremenewyork.com/mobile_stock.json" user = {"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1"} # user = {"User-Ag...
Python
0
8397cd87fc05949f2f1b8d24505ae2b817f5dda1
Add unittest for classification_summary
tests/chainer_tests/functions_tests/evaluation_tests/test_classification_summary.py
tests/chainer_tests/functions_tests/evaluation_tests/test_classification_summary.py
import unittest import numpy import six import chainer from chainer import cuda from chainer import functions as F from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.testing import condition from chainer.utils import type_check def recall(preds, ts, dtype, l...
Python
0.000034
570fdc71697fba6180787b9309d3a2d49f512ed2
Add queueing python script
scripts/queue_sync_to_solr.py
scripts/queue_sync_to_solr.py
#! /bin/env python # -*- coding: utf-8 -*- import sys import os import logbook from harvester.config import config as config_harvest from redis import Redis from rq import Queue EMAIL_RETURN_ADDRESS = os.environ.get('EMAIL_RETURN_ADDRESS', 'example@example.com') # csv delim email ...
Python
0.000001
d06b3b41f786fc7cd2c05a6215fed026eef1cb8f
Add misc plugin.
curiosity/plugins/misc.py
curiosity/plugins/misc.py
import curio import sys import curious from curious.commands import command from curious.commands.context import Context from curious.commands.plugin import Plugin from curious.dataclasses.embed import Embed class Misc(Plugin): """ Miscellaneous commands. """ @command() async def info(self, ctx: ...
Python
0
3d7a1ad963a11c8fc425c7d82f5e0f8f877dc861
Add Python benchmark
lib/node_modules/@stdlib/math/base/special/atan2/benchmark/python/benchmark.py
lib/node_modules/@stdlib/math/base/special/atan2/benchmark/python/benchmark.py
#!/usr/bin/env python """Benchmark atan2.""" import timeit name = "atan2" repeats = 3 iterations = 1000000 def print_version(): """Print the TAP version.""" print("TAP version 13") def print_summary(total, passing): """Print the benchmark summary. # Arguments * `total`: total number of test...
Python
0.000138
14160c8ee729a094b6a980ed7c94b37d11f6dfba
Create xor_recursive.py
tests/xor_recursive.py
tests/xor_recursive.py
import sys def xor(*store): print("---------------recursive call----------------") print(len(store)) if(len(store) == 2): print("lowest level") b = store[0] a = store[1] print(b) print(a) return bool((a or b) and not(a and b)) else: print("middle level") b = store[0] remaini...
Python
0
d003babe55d8b7a202a50bc6eeb2e1113ef8247f
Add oeis plugin
plugins/oeis.py
plugins/oeis.py
import requests import re class Plugin: limit = 5 def on_command(self, bot, msg, stdin, stdout, reply): session = smartbot.utils.web.requests_session() url = "http://oeis.org/search" payload = { "fmt": "text", "q": " ".join(msg["args"][1:]), } ...
Python
0
c122db5ceda59d786bd550f586ea87d808595ab6
Add a script to reimport the LGA boundaries from the GADM.org data
pombola/nigeria/management/commands/nigeria_update_lga_boundaries_from_gadm.py
pombola/nigeria/management/commands/nigeria_update_lga_boundaries_from_gadm.py
from django.contrib.gis.gdal import DataSource from django.core.management import BaseCommand from django.db import transaction from mapit.management.command_utils import save_polygons, fix_invalid_geos_geometry from mapit.models import Area, Type class Command(BaseCommand): help = "Update the Nigeria boundaries ...
Python
0.000022
8c176349d064db3dbc4db505cdc8a2d6a162dd56
Create a consolidated broker initialization script
dataactcore/scripts/initialize.py
dataactcore/scripts/initialize.py
import argparse import logging import os from flask_bcrypt import Bcrypt from dataactvalidator.app import createApp from dataactbroker.scripts.setupEmails import setupEmails from dataactcore.models.userModel import User from dataactcore.interfaces.function_bag import createUserWithPassword from dataactcore.scripts.se...
Python
0
11df88564a4c3aed330c84031cceaecace867d41
Add cython version of temporal_daily
pds/temporal_daily_cython.py
pds/temporal_daily_cython.py
import os import cPickle import glob import datetime as dt import math import time import zlib import bitarray import numpy as np from bloomfilter_cython import BloomFilter from pycassa import NotFoundException from pycassa.pool import ConnectionPool from pycassa.system_manager import SystemManager, SIMPLE_STRATEGY f...
Python
0.000001
e60f13ab304c04e17af91bc87edc1891948a6f7a
Add validation function for python schema events
parsely_raw_data/validate.py
parsely_raw_data/validate.py
from __future__ import print_function import logging import pprint from collections import defaultdict from six import string_types from .schema import SCHEMA """ Data Pipeline validation functions """ SCHEMA_DICT = None REQ_FIELDS = None CHECKS = {'req': 'Fields "{}" are required. ({} are present)', 'si...
Python
0.000001
271be0bf16692aae2736d40e96447262e75c4a0f
add missing web.py
zmq/web.py
zmq/web.py
#----------------------------------------------------------------------------- # Copyright (C) 2013 Brian Granger, Min Ragan-Kelley # # This file is part of pyzmq # # Distributed under the terms of the New BSD License. The full license is in # the file COPYING.BSD, distributed as part of this software. #----------...
Python
0
0a7f1695f9155bbe10b933e47637e4df0e2e31d4
Create HttpAndWeb.py
day3/HttpAndWeb.py
day3/HttpAndWeb.py
import requests def Get(url, PostId): try: isinstance(int(PostId), int) if int(PostId) <= 100 and int(PostId) > 0: r = requests.get(url + PostId) return r else: print("Number must be between 1 and 100") except ValueError as err: raise(err) return "No Results" def Post(PostUrl,title, body, userId=...
Python
0.000002
9fa6ec498d70afdb4f28410d4ac7c29780c60861
Add first stab at origen submodule
transmutagen/origen.py
transmutagen/origen.py
from subprocess import run from pyne.origen22 import (nlibs, write_tape5_irradiation, write_tape4, parse_tape9, merge_tape9, write_tape9) from pyne.material import from_atom_frac if __name__ == '__main__': ORIGEN = '/home/origen22/code/o2_therm_linux.exe' xs_TAPE9 = "/Users/aaronmeurer/Documents/origen/C...
Python
0.000001
72f9d74fe6503de45e7251460d5419eebcabfb7e
Add files via upload
old/hefesto_temp_fix.py
old/hefesto_temp_fix.py
import os def replace_temp(inputfile_folder): os.chdir(inputfile_folder) home_dir = os.getcwd() for i in os.listdir(os.getcwd()): if os.path.isdir(i): os.chdir(i) print("In folder: {}".format(os.getcwd())) for z in os.listdir(os.getcwd()): if...
Python
0
816872186966186eb463d1fd45bea3a4c6f68e00
Add new sanity test for demoproject views
demoproject/tests_demo.py
demoproject/tests_demo.py
from demoproject.urls import urlpatterns from django.test import Client, TestCase class DemoProject_TestCase(TestCase): def setUp(self): self.client = Client() def test_all_views_load(self): """ A simple sanity test to make sure all views from demoproject still continu...
Python
0
2cdf9728bd185fa7a32e4a7f758311594245fae0
Add proc_suffixes_file.py
file_path/proc_suffixes_file.py
file_path/proc_suffixes_file.py
#!/usr/bin/env python import os import re import sys SUFFIX_PAT = re.compile(r'(?P<FILE>[a-zA-z0-9]+)_\d+\b') SUFFIXED_LIST = [] def is_suffixed_file(dir_path, file_name): base_name, ext_name = os.path.splitext(file_name) match_obj = SUFFIX_PAT.match(base_name) if not match_obj: return False ...
Python
0.000001
286c9c8a6618fc0a87dbe1b50787331986155940
Create __init__.py
__init__.py
__init__.py
Python
0.000429
959aecd612f66eee22e179f985227dbb6e63202a
Move buckling calcs to continuum_analysis
__init__.py
__init__.py
from abaqus_model import * from abaqus_postproc import * from continuum_analysis import * from rayleighritz import RayleighRitzDiscrete from stiffcalc import *
Python
0
6d2735035d7230e6a709f66be93b760531a42868
Create __init__.py
__init__.py
__init__.py
Python
0.000429
662b0754ea73ef9dc19c50ac8d9b3e2aaa7fbb02
Create __init__.py
__init__.py
__init__.py
Python
0.000429
05a6080eed951f80da3b6f7ee4962101884f328e
add testing utility for checking term lookback windows
zipline/pipeline/factors/testing.py
zipline/pipeline/factors/testing.py
import numpy as np from zipline.testing.predicates import assert_equal from .factor import CustomFactor class IDBox(object): """A wrapper that hashs to the id of the underlying object and compares equality on the id of the underlying. Parameters ---------- ob : any The object to wrap. ...
Python
0
d3a684b06d2d61f2a498346f78a5cbbabd7828e7
Create elastic_search.py
misc/elastic_search.py
misc/elastic_search.py
import requests import json import pprint es = 'http://hostt:9200/' query = ''' {'fields': ['field1', 'field2',], 'filter': {'bool': {'must': [{'terms': {'field1': [1, 2]}}, {'bool': {'should': [{'term': {'field2': 'p'}}, ...
Python
0.000057
7bf376c57cc989f382f6a1cdc6a5f956b2c73fd6
Add pixels_with_value()
ml/img/segmentation.py
ml/img/segmentation.py
import numpy as np def pixels_with_value(img, val): return np.all(img==np.array(val), axis=2)
Python
0
13c40d631c5d0e6035ea143a68e45201691b46a5
Create 0303_restaurant_plural_foods.py
2019/0303_restaurant_plural_foods.py
2019/0303_restaurant_plural_foods.py
# -*- coding: utf-8 -*- """ NPR 2019-03-03 https://www.npr.org/2019/03/03/699735287/sunday-puzzle-in-this-game-a-chance-to-claim-vic-tor-y Name a popular restaurant chain in two words. Its letters can be rearranged to spell some things to eat and some things to drink. Both are plural words. What things are these, an...
Python
0.999927
bfdac16ca4e0ae30e345b221c7754f19669a55da
update full version of criteria module.
biokit/stats/criteria.py
biokit/stats/criteria.py
<<<<<<< HEAD # -*- coding: utf-8 -*- import math __all__ = ['AIC', 'AICc', 'BIC'] def AIC(L, k): """Return Akaike information criterion (AIC) :param int k: number of parameters :param float L: maximised value of the likelihood function Suppose that we have a statistical model of some data,...
Python
0
ed46c3887c7b51cd75d46523af7b901b79eb92fc
add import script for Milton Keynes (closes #863)
polling_stations/apps/data_collection/management/commands/import_milton_keynes.py
polling_stations/apps/data_collection/management/commands/import_milton_keynes.py
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter class Command(BaseXpressDemocracyClubCsvImporter): council_id = 'E06000042' addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017 (1).tsv' stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June201...
Python
0
4f042e64e3155abfc4b86f61623a4d999dad0f89
Move tinyHttpServer.py
tinyHttpServer.py
tinyHttpServer.py
import SimpleHTTPServer import SocketServer PORT = 8080 try: Handler = SimpleHTTPServer.SimpleHTTPRequestHandler httpd = SocketServer.TCPServer(("", PORT), Handler) print("serving at port %d" % (PORT)) print("Type Ctrl+C to quit") httpd.serve_forever() except KeyboardInterrupt as e: print("\nserver ...
Python
0.000004
5fb6b31ea928162c5185d66381ae99c7454d33c0
Add comb sort algorithm
sorts/comb_sort.py
sorts/comb_sort.py
""" Comb sort is a relatively simple sorting algorithm originally designed by Wlodzimierz Dobosiewicz in 1980. Later it was rediscovered by Stephen Lacey and Richard Box in 1991. Comb sort improves on bubble sort. This is pure python implementation of counting sort algorithm For doctests run following command: python ...
Python
0.000008
2ed853301e8cedb72c7c07367d58e55cac23aa7c
add PI to arduino
raspi-pl2303.py
raspi-pl2303.py
#!/usr/bin/env python import serial print 'RaspberryPi PL2303(USB2SerialTTL) communicate.' print "Copyright (c) 2015 winlin(winlin@vip.126.com)" f = serial.Serial('/dev/ttyUSB0', 115200) while True: v = "Hello, Arduino, this is RaspberryPi 2.0~" f.write(v) print 'PI: %s'%(v) r = '' for i in v: ...
Python
0.999473
bb7a6ecc72c007ba3c13069d7f3bddfa8c8309f4
Remove structures_dir for now, to be developed later
ssbio/core/complex.py
ssbio/core/complex.py
""" Complex ======= """ import os.path as op import logging import ssbio.utils from ssbio.core.object import Object from ssbio.core.protein import Protein from cobra.core import DictList log = logging.getLogger(__name__) class Complex(Object): """Store information about a protein complex, a generic representat...
Python
0
30412406b354f510a7321c3b3a159df6d7743668
Add a database file for Loren to complete
utils/database.py
utils/database.py
import database_setup assert(database_setup.is_table_set_up()) # TODO: Create the stubs for database files # Assignee: Loren
Python
0
a24cdefd6e29a651d69db1a264a30fcea4ad6141
Add LiteLogger class.
forge/lite_logger.py
forge/lite_logger.py
#!/usr/bin/env python from inspect import getframeinfo from inspect import stack from threading import Lock from threading import Event from threading import Thread from time import clock from time import sleep from weakref import ref from colorama import Fore from colorama import Style from colorama import init as co...
Python
0
929abedc5f971a58dfb54b706c66548609351835
Create fair_warning.py
google-code-jam/fair_warning.py
google-code-jam/fair_warning.py
""" https://code.google.com/codejam/contest/433101/dashboard#s=p1 """ def gcd(a, b): if b > a: return gcd(b, a) elif b == 0: return a else: return gcd(b, a % b) def big_gcd(a): return reduce(lambda x,y: gcd(x, y), a) def solve(nums): nums = sorted(nums) diffs = [(num...
Python
0.002125
b7a019b41cbfac78ff48fe604d401921786d7459
Add size_continuous_layer helper tests
test/viz/helpers/test_size_continuous_layer.py
test/viz/helpers/test_size_continuous_layer.py
import unittest from unittest.mock import Mock from cartoframes.viz import helpers, Source class TestSizeContinuousLayerHelper(unittest.TestCase): def test_helpers(self): "should be defined" self.assertNotEqual(helpers.size_continuous_layer, None) def test_size_continuous_layer(self): ...
Python
0.000001
e79445de75721b0d0b8ab1b6c8e24f036bf35a11
make qsub
nexus_obj/ascii_txt.py
nexus_obj/ascii_txt.py
import os def qsub_file(fnames,nmpi=64,title='title',hours=2): header = """#!/bin/bash #PBS -N %s #PBS -l walltime=0%d:00:00 #PBS -l nodes=%d #PBS -A mat158 #PBS -j oe #PBS -k n cd ${PBS_O_WORKDIR} export OMP_NUM_THREADS=8 BIN=~/soft/kylin_qmcpack/qmcpack_cpu_comp\n\n""" % ( title, hours, len(fnames)*nmpi/2 ...
Python
0.999677
430c5301d7db50b153b0ae33f5c281506948099c
Add new package
plasTeX/Packages/afterpage.py
plasTeX/Packages/afterpage.py
#!/usr/bin/env python from plasTeX import Command, Environment class afterpage(Command): args = 'self:nox' def invoke(self, tex): super(afterpage, self).invoke(tex) return []
Python
0.000001
b40eb5723eeab38edb2440d04d65f1c5be4ad4c0
Create solution.py
data_structures/linked_list/problems/anagrams/py/solution.py
data_structures/linked_list/problems/anagrams/py/solution.py
import LinkedList # Problem description: # Solution time complexity: # Comments: # Linked List Node inside the LinkedList module is declared as: # # class Node: # def __init__(self, val, nxt=None): # self.val = val # self.nxt = nxt # def AreAnagrams(left: LinkedLis...
Python
0.000018
e9a71173eae28b378052ddce4e0fe8a3d3313c4e
Disable screenshot_sync_tests on Mac.
content/test/gpu/gpu_tests/screenshot_sync.py
content/test/gpu/gpu_tests/screenshot_sync.py
# Copyright 2014 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 os import screenshot_sync_expectations as expectations from telemetry import test from telemetry.core import util from telemetry.page import page fro...
# Copyright 2014 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 os import screenshot_sync_expectations as expectations from telemetry import test from telemetry.core import util from telemetry.page import page fro...
Python
0.000006
48e19852c6e1f5a0f2792a62adeb560121d77d11
Create __init__.py
crispy/__init__.py
crispy/__init__.py
Python
0.000429
bad7bfee43ef7d560b186d3f41af2aa35fe0c4af
allow FactorScheduler factor=1
python/mxnet/lr_scheduler.py
python/mxnet/lr_scheduler.py
""" learning rate scheduler, which adaptive changes the learning rate based on the progress """ import logging class LRScheduler(object): """Base class of a learning rate scheduler""" def __init__(self): """ base_lr : float the initial learning rate """ self.base_lr ...
""" learning rate scheduler, which adaptive changes the learning rate based on the progress """ import logging class LRScheduler(object): """Base class of a learning rate scheduler""" def __init__(self): """ base_lr : float the initial learning rate """ self.base_lr ...
Python
0.000005