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
3661ca3947763656165f8fc68ea42358ad37285a
Add stub for qiprofile update test.
test/unit/helpers/test_qiprofile.py
test/unit/helpers/test_qiprofile.py
import os import glob import shutil from nose.tools import (assert_equal, assert_is_not_none) import qixnat from ... import (project, ROOT) from ...helpers.logging import logger from qipipe.helpers import qiprofile COLLECTION = 'Sarcoma' """The test collection.""" SUBJECT = 'Sarcoma001' """The test subjects.""" SESS...
Python
0
1c7b9c1ed1f4d6a8ee201ba109db95449181fee1
Make operation tests timezone-aware
pylxd/tests/test_operation.py
pylxd/tests/test_operation.py
# Copyright (c) 2015 Canonical Ltd # # 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 ...
# Copyright (c) 2015 Canonical Ltd # # 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 ...
Python
0.000106
36af45d88f01723204d9b65d4081e74a80f0776b
Add test for layers module.
test/layers_test.py
test/layers_test.py
import theanets import numpy as np class TestLayer: def test_build(self): layer = theanets.layers.build('feedforward', nin=2, nout=4) assert isinstance(layer, theanets.layers.Layer) class TestFeedforward: def test_create(self): l = theanets.layers.Feedforward(nin=2, nout=4) a...
Python
0
3dcf251276060b43ac888e0239f26a0cf2531832
Add tests for proxy drop executable
tests/test_proxy_drop_executable.py
tests/test_proxy_drop_executable.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/. # Copyright (c) 2017 Mozilla Corporation from positive_alert_test_case import PositiveAlertTestCase from negative_alert_t...
Python
0
30d4301a04081f3d7a4fdba835a56aa0adac1375
fix latent slaves started serially with monkey patch instead
monkeypatch.py
monkeypatch.py
from twisted.python import log from twisted.internet import reactor def botmaster_maybeStartBuildsForSlave(self, slave_name): """ We delay this for 10 seconds, so that if multiple slaves start at the same time, builds will be distributed between them. """ def do_start(): log.msg(format="Re...
Python
0
379aef7e3aebc05352cacd274b43b156e32de18b
Add script to run tests
runtests.py
runtests.py
#!/usr/bin/env python import argparse import sys import django from django.conf import settings from django.test.utils import get_runner def runtests(test_labels): settings.configure(INSTALLED_APPS=['tests']) django.setup() TestRunner = get_runner(settings) test_runner = TestRunner() failures = t...
Python
0.000001
abf39931331f54aff5f10345939420041bd2039d
Add test for APS2 instruction merging.
tests/test_APS2Pattern.py
tests/test_APS2Pattern.py
import h5py import unittest import numpy as np from copy import copy from QGL import * from instruments.drivers import APS2Pattern class APSPatternUtils(unittest.TestCase): def setUp(self): self.q1gate = Channels.LogicalMarkerChannel(label='q1-gate') self.q1 = Qubit(label='q1', gateChan=self.q1gat...
Python
0
df05088b5a6233cb262017b8489723c23000eb17
Add variable
src/robotide/ui/images.py
src/robotide/ui/images.py
# Copyright 2008-2009 Nokia Siemens Networks Oyj # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
# Copyright 2008-2009 Nokia Siemens Networks Oyj # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
Python
0.000005
aeaf2e1a1207f2094ea4298b1ecff015f5996b5a
Add test cases for gabor filter
skimage/filter/tests/test_gabor.py
skimage/filter/tests/test_gabor.py
import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from skimage.filter import gabor_kernel, gabor_filter def test_gabor_kernel_sum(): for sigmax in range(1, 10, 2): for sigmay in range(1, 10, 2): for frequency in range(0, 10, 2): kernel...
Python
0
a70f46aac52be5b38b869cfbe18c0421a0032aee
Add script to count parameters of PyTorch model
count_params.py
count_params.py
import sys import numpy as np import torch model = torch.load(sys.argv[1]) params = 0 for key in model: params += np.multiply.reduce(model[key].shape) print('Total number of parameters: ' + str(params))
Python
0
fd4398b1e811aaa2b876c120f99ca7fff08618ca
install on windows via gohlke wheels
scripts/install_on_windows.py
scripts/install_on_windows.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Script for installing on Microsoft Windows Wheels from [GOHLKE WINDOWS REPOSITORY](https://www.lfd.uci.edu/~gohlke/pythonlibs/) """ try: from gohlkegrabber import GohlkeGrabber except ImportError: print("gohlkegrabber not installed -> 'pip install gohlkegrabb...
Python
0
495c937d39da1902948065a38502f9d582fa2b3b
Add darkobject tests.
tests/darkobject.py
tests/darkobject.py
""" .. moduleauthor:: Adam Gagorik <adam.gagorik@gmail.com> """ import unittest import pydarkstar.logutils import pydarkstar.darkobject pydarkstar.logutils.setDebug() class TestDarkObject(unittest.TestCase): def test_init(self): pydarkstar.darkobject.DarkObject() if __name__ == '__main__': unittest.m...
Python
0
6f8699288f79ff856ed58595169cb08956cd210d
Create toeplitz-matrix.py
Python/toeplitz-matrix.py
Python/toeplitz-matrix.py
# Time: O(m * n) # Space: O(1) class Solution(object): def isToeplitzMatrix(self, matrix): """ :type matrix: List[List[int]] :rtype: bool """ return all(i == 0 or j == 0 or matrix[i-1][j-1] == val for i, row in enumerate(matrix) for j, ...
Python
0.000017
d2a78f252bf9a584569e372ca9474863e4496c7a
Add one test
tests/test_utils.py
tests/test_utils.py
import os from contextlib import suppress import numpy as np import pandas as pd import pytest import legendary_potato.kernel import legendary_potato.utils TEST_PATH = os.path.join(os.path.abspath(os.path.curdir)) SAMPLE_PATH = os.path.join(TEST_PATH, 'sample') GRAMMATRIX_PATH = os.path.join(TEST_PATH, 'gram_matrix'...
Python
0.00105
76c040e9da5d94dfcb68d3e9a8003b894c1cf1dc
test file for vimba.py
tests/test_vimba.py
tests/test_vimba.py
import pytest from pymba import Vimba, VimbaException def test_version(): version = Vimba().version.split('.') assert int(version[0]) >= 1 assert int(version[1]) >= 7 assert int(version[2]) >= 0 def test_startup_shutdown(): with pytest.raises(VimbaException) as e: Vimba().system().featu...
Python
0
295b83d466b90ea812e8c0bda56b4d38a31c956a
Create reversedArrayNum.py
CodeWars/8kyu/reversedArrayNum.py
CodeWars/8kyu/reversedArrayNum.py
def digitize(n): return [int(i) for i in str(n)][::-1]
Python
0.000106
7b279117da06af5cf21b61ad810a9c3177de8e3e
Update fabfile.py
fabfile.py
fabfile.py
from fabric.api import local,run import os from os import path #Add settings module so fab file can see it os.environ['DJANGO_SETTINGS_MODULE'] = "adl_lrs.settings" from django.conf import settings adldir = settings.MEDIA_ROOT actor_profile = 'actor_profile' activity_profile = 'activity_profile' activity_state = 'act...
from fabric.api import local,run import os from os import path #Add settings module so fab file can see it os.environ['DJANGO_SETTINGS_MODULE'] = "adl_lrs.settings" from django.conf import settings adldir = settings.MEDIA_ROOT actor_profile = 'actor_profile' activity_profile = 'activity_profile' activity_state = 'act...
Python
0
86418c4f3ea786c6eb1aad6579dadfb286dec0a3
Create InMoov2.minimal.py
toSort/InMoov2.minimal.py
toSort/InMoov2.minimal.py
# a very minimal script for InMoov # although this script is very short you can still # do voice control of a right hand or finger box # for any command which you say - you will be required to say a confirmation # e.g. you say -> open hand, InMoov will ask -> "Did you say open hand?", you will need to # respond with a ...
Python
0.000001
35e76ec99a3710a20b17a5afddaa14389af65098
Add some simple MediaWiki importer.
tools/import_mediawiki.py
tools/import_mediawiki.py
import os import os.path import argparse from sqlalchemy import create_engine def main(): parser = argparse.ArgumentParser() parser.add_argument('url') parser.add_argument('-o', '--out', default='wikked_import') parser.add_argument('--prefix', default='wiki') parser.add_argument('-v', '--verbose',...
Python
0
237041aff9d99ac840572742467772edf1f4d5ef
Add image download example
examples/image/download.py
examples/image/download.py
# 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 writing, software # distributed under t...
Python
0.000003
5ea296703596306ea9895e37db9412f80731543a
Add a protein-plotting example, to show how to visualize nicely a graph
examples/mayavi/protein.py
examples/mayavi/protein.py
""" Visualize a protein graph structure downloaded from the protein database in standard pdb format. We parse the pdb file, but extract only a very small amount of information: the type of atoms, their positions, and the links between them. We assign a scalar value for the atoms to differenciate the different types o...
Python
0.000001
fed1cee9ea50e19b6cc0c3e95f4455d2550f5176
add initial disk I/O benchmark script
examples/run_benchmarks.py
examples/run_benchmarks.py
import sys import os import resource import shutil import shlex import time import subprocess import random # this is a disk I/O benchmark script. It runs menchmarks # over different filesystems, different cache sizes and # different number of peers (can be used to find a reasonable # range for unchoke slots). # it a...
Python
0.000005
ab60bd4f31a185884e0c05fa1a5f70c39a9d903a
add 52
python/p052.py
python/p052.py
def same(a, b): return sorted(str(a)) == sorted(str(b)) for i in xrange(1, 1000000): if same(i, 2 * i) and same(3 * i, 4 * i) and same(5 * i, 6 * i) and same(i, 6 * i): print i break
Python
0.998596
c67e4e0e9d2a771df4674cb9cd9f178c1fe6c9bc
Add git-restash functional tests
tests/functional/test_restash.py
tests/functional/test_restash.py
import os import shutil import subprocess import tempfile import unittest import git class TestGitRestash(unittest.TestCase): def setUp(self): self.dirpath = tempfile.mkdtemp() os.chdir(self.dirpath) self.repo = git.Repo.init(self.dirpath) # add files open('README.md', '...
Python
0
26bc79d7ed478872f615e80fa177f0c4582c3631
reverse string ii
src/main/python/pyleetcode/reverse_string_ii.py
src/main/python/pyleetcode/reverse_string_ii.py
""" Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters, then reverse the first k characters and left ...
Python
0.999999
fe6ece236e684d76441280ba700565f7fbce40cc
Create masked version based on pbcov cutogg
14B-088/HI/analysis/pbcov_masking.py
14B-088/HI/analysis/pbcov_masking.py
''' Cut out noisy regions by imposing a mask of the primary beam coverage. ''' from astropy.io import fits from spectral_cube import SpectralCube from spectral_cube.cube_utils import beams_to_bintable from astropy.utils.console import ProgressBar import os from analysis.paths import fourteenB_HI_data_path # execfil...
Python
0
d8ddd6a843000c8b4125f166645a41443b6c06ba
Add kms_decrypt module
kms_decrypt.py
kms_decrypt.py
#!/usr/bin/python import base64 DOCUMENTATION = ''' short_description: Decrypt a secret that was generated by KMS description: - This module decrypts the given secret using AWS KMS, and returns it as the Plaintext property version_added: null author: Ben Bridts notes: - Make sure you read http://docs.aws.amazon.co...
Python
0.000001
4af087e4920124eddb0342d0f22978872f9ba5dc
add landuse_sql.py which convert the .csv files from ArcMap to a SQL database
landuse_sql.py
landuse_sql.py
import sqlite3 import glob import pandas #Name of SQL database sql_schema = 'LandUse_Approx.db' files = [f for f in glob.glob("*.csv") if "LandUseApprox_" in f] #Create table names for the SQL database. #Table names will have 'landuse_' as prefix and the year and length as the ending in the format 'YYYY_Length' #St...
Python
0.000006
110179832ff8ccdda81599f7d6b0675ba8feac24
Fix document of gaussian
chainer/functions/gaussian.py
chainer/functions/gaussian.py
import numpy from chainer import cuda from chainer import function from chainer.utils import type_check class Gaussian(function.Function): """Gaussian sampling function. In forward calculation, this funciton takes mean and logarithm of variance as inputs, and draw a sample from a gaussian distribution....
import numpy from chainer import cuda from chainer import function from chainer.utils import type_check class Gaussian(function.Function): """Gaussian sampling function. In forward calculation, this funciton takes mean and logarithm of variance as inputs, and draw a sample from a gaussian distribution....
Python
0.000005
e23ccb850a6aef017ae91e35f672e6c6b5184e23
Add image preprocessing functions
skan/pre.py
skan/pre.py
import numpy as np from scipy import spatial, ndimage as ndi from skimage import filters, img_as_ubyte def hyperball(ndim, radius): """Return a binary morphological filter containing pixels within `radius`. Parameters ---------- ndim : int The number of dimensions of the filter. radius : ...
Python
0.000004
f8823429d1bc548e4a91fe8ea64086d35dd66676
Add race migration.
tvdordrecht/race/migrations/0003_auto_20150730_2250.py
tvdordrecht/race/migrations/0003_auto_20150730_2250.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('race', '0002_auto_20150729_1906'), ] ...
Python
0
564851a1a7f1378c9ef0e936640b690300a112fb
Add synthtool scripts (#3765)
java-containeranalysis/google-cloud-containeranalysis/synth.py
java-containeranalysis/google-cloud-containeranalysis/synth.py
# Copyright 2018 Google LLC # # 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 writing, s...
Python
0.000001
e2124aef9cb91dac3a597d353cd217ed328221e5
Add gyp file to build cpu_features static library.
ndk/sources/android/cpufeatures/cpu_features.gyp
ndk/sources/android/cpufeatures/cpu_features.gyp
# Copyright (c) 2012 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': 'cpu_features', 'type': 'static_library', 'direct_dependent_settings': { 'include_dirs': ...
Python
0
f4aad329c445415f1306882d386abe43969ba6a9
Add test for API ticket basics.
Allura/allura/tests/functional/test_rest_api_tickets.py
Allura/allura/tests/functional/test_rest_api_tickets.py
from pprint import pprint from datetime import datetime, timedelta import json from pylons import c from ming.orm import session from allura import model as M from allura.lib import helpers as h from alluratest.controller import TestController, TestRestApiBase class TestApiTicket(TestRestApiBase): def set_api_...
Python
0
38a5a1d5bd5bcccf52a66a84377429bdecdfa4a2
Replace g.next() with next(g)
troveclient/tests/test_common.py
troveclient/tests/test_common.py
from testtools import TestCase from mock import Mock from troveclient import common class CommonTest(TestCase): def test_check_for_exceptions(self): status = [400, 422, 500] for s in status: resp = Mock() resp.status_code = s self.assertRaises(Exception, ...
from testtools import TestCase from mock import Mock from troveclient import common class CommonTest(TestCase): def test_check_for_exceptions(self): status = [400, 422, 500] for s in status: resp = Mock() resp.status_code = s self.assertRaises(Exception, ...
Python
0.000939
3eb8e73faf56bf3e3e3eb7cc8209c780d0f71b62
create nanoparticle class
nanoparticle.py
nanoparticle.py
from scipy.constants import pi import numpy as np from math import cos, sin class NanoParticle(object): def __init__(self, r, n_acceptors, tau_D, R_Forster): """ Create a nanoparticle object Parameters ---------- R : float Radio of nanoparticule ...
Python
0.000002
b6356e4b7a88e1b2034f37aa135794b08e79c70b
Test POC script
tests/chk.py
tests/chk.py
import paramiko,sys,re,time,subprocess,getpass,os def main(argv): os.system('cls') #on windows mins = 0 print ("\n[info] "+time.strftime("%d/%m/%Y %H:%M:%S") +"\n") print (""" _ _ ______ _____ ___ ___ _ __(_)_ __ | |_ |_ /\ \/ / __| / __|/ __| '__| | '_ \| __| /...
Python
0.000015
b3e6855489eba5d59507ef6fb4c92f8284526ec1
Check consecutive elements in an array
Arrays/check_consecutive_elements.py
Arrays/check_consecutive_elements.py
import unittest """ Given an unsorted array of numbers, return true if the array only contains consecutive elements. Input: 5 2 3 1 4 Ouput: True (consecutive elements from 1 through 5) Input: 83 78 80 81 79 82 Output: True (consecutive elements from 78 through 83) Input: 34 23 52 12 3 Output: False """ """ Approach: ...
Python
0.000024
f325937df3f1f1f972c7a0780d702f7fea5d03f5
Test `__eq__`, `__ne__`, and `__hash__`
test/test_eq.py
test/test_eq.py
import pytest from permutation import Permutation EQUIV_CLASSES = [ [ Permutation(), Permutation(1), Permutation(1,2), Permutation(1,2,3,4,5), Permutation.transposition(2,2), Permutation.cycle(), Permutation.from_cycles(), Permutation.from_cycles(()...
Python
0.000011
55b33bff9856cc91943f0a5ae492db1fdc7d8d5a
Add missing python 3 only file.
numba/tests/jitclass_usecases.py
numba/tests/jitclass_usecases.py
""" Usecases with Python 3 syntax in the signatures. This is a separate module in order to avoid syntax errors with Python 2. """ class TestClass1(object): def __init__(self, x, y, z=1, *, a=5): self.x = x self.y = y self.z = z self.a = a class TestClass2(object): def __init_...
Python
0
e251aff9a232a66b2d24324f394da2ad9345ce79
Add migration script for changing users with None as email_verifications to {}
scripts/migration/migrate_none_as_email_verification.py
scripts/migration/migrate_none_as_email_verification.py
""" Ensure that users with User.email_verifications == None now have {} instead """ import logging import sys from tests.base import OsfTestCase from tests.factories import UserFactory from modularodm import Q from nose.tools import * from website import models from website.app import init_app from scripts import util...
Python
0.000001
97bf6ba36b27822a9bd73cb9a27d9878e48945e2
add a decorator to ignore signals from fixture loading
project/apps/utils/signal_decorators.py
project/apps/utils/signal_decorators.py
from functools import wraps def disable_for_loaddata(signal_handler): """ Decorator that turns off signal handlers when loading fixture data. based on http://stackoverflow.com/a/15625121 """ @wraps(signal_handler) def wrapper(*args, **kwargs): if kwargs.get('raw'): retur...
Python
0
f8b5e413b46350f25bd7d231a8102c706fbf34f8
Add new package: py-devlib (#16982)
var/spack/repos/builtin/packages/py-devlib/package.py
var/spack/repos/builtin/packages/py-devlib/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyDevlib(PythonPackage): """Library for interaction with and instrumentation of remote dev...
Python
0
de39aa257d845ecb6e1c2e7c4c4911497d00cdcf
add sample, non working, test_wsgi
os_loganalyze/tests/test_wsgi.py
os_loganalyze/tests/test_wsgi.py
#!/usr/bin/python # # Copyright (c) 2013 IBM Corp. # # 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 a...
Python
0
4c8ea40eeec6df07cf8721c256ad8cc3d35fb23e
Add intial unit test file
src/test_main.py
src/test_main.py
import pytest from main import * test_files = [ "examples/C/filenames/script", "examples/Clojure/index.cljs.hl", "examples/Chapel/lulesh.chpl", "examples/Forth/core.fth", "examples/GAP/Magic.gd", "examples/JavaScript/steelseries-min.js", "examples/Matlab/FTLE_reg.m", ...
Python
0
33a3e4a8adc6b3284de18fe02c67eafa3a391226
Create tinycrypt.py
tinycrypt.py
tinycrypt.py
Python
0.000091
5204633c8b3d578d3860b964239191510ae14665
Add imperfect NIH data script
nih_data.py
nih_data.py
#!/user/bin/env python3 '''Download NIH RePORTER database and find project data for funded researchers.''' import shutil import re import zipfile import csv import codecs import locale import os.path import urllib.request from collections import namedtuple from pprint import pprint _BASE_SUMMARY_URL = "https://projec...
Python
0.998359
6cda3951d27e819cb452233f514c953c923d9a53
Add Python script to check links (#872)
check_links.py
check_links.py
import os from fnmatch import fnmatch import bs4 from requests import get from tqdm import tqdm import webbrowser import pyinputplus as pyip from fake_headers import Headers from random import shuffle import validators # Create a list of all the HTML files in lopp.net all_html_files = [] website_directory = pyip.input...
Python
0
4a179825234b711a729fce5bc9ffc8de029c0999
Test for invalid data when loading
utest/controller/test_loading.py
utest/controller/test_loading.py
import unittest from robot.utils.asserts import assert_true, assert_raises, assert_raises_with_msg from robotide.controller import ChiefController from robotide.namespace import Namespace from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH, FakeLoadObserver from robot.errors import DataError class TestDataLoadi...
import unittest from robot.utils.asserts import assert_true, assert_raises from robotide.application.chiefcontroller import ChiefController from robotide.namespace import Namespace from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH from robot.errors import DataError class _FakeObserver(object): def notify...
Python
0
77fed107b4e224437995075bb8c11e1c0d2161d5
add a utility script that checks property names and types against currently installed mapnik python bindings
util/validate-mapnik-instance.py
util/validate-mapnik-instance.py
#!/usr/bin/env python import os import sys import json import mapnik if not mapnik.mapnik_version() > 200100: print 'Error: this script is only designed to work with Mapnik 2.1 and above (you have %s)' % mapnik.mapnik_version_string() sys.exit(1) mapnik_version = mapnik.mapnik_version_string().replace('-pre'...
Python
0
f8d49af459fb3b751f44ecf625521c62fa68df0a
Check in script to delete existing autochecked tasks
bin/ext_service/historical/fix_autocheck_tasks.py
bin/ext_service/historical/fix_autocheck_tasks.py
import logging import argparse import uuid import emission.core.wrapper.user as ecwu import emission.core.get_database as edb import emission.net.ext_service.habitica.proxy as proxy def fix_autocheck_for_user(uuid): auto_tasks = find_existing_auto_tasks(uuid) delete_tasks(uuid, auto_tasks) create_new_tasks...
Python
0
89ef576ba4e707eef653c670b32fa40d862e79ec
Add package for the Python regex library (#4771)
var/spack/repos/builtin/packages/py-regex/package.py
var/spack/repos/builtin/packages/py-regex/package.py
############################################################################## # Copyright (c) 2013-2016, 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
0e6a7a805ff08f191c88bda67992cb874f538c2f
Add migration for unitconnection section types
services/migrations/0097_alter_unitconnection_section_type.py
services/migrations/0097_alter_unitconnection_section_type.py
# Generated by Django 4.0.5 on 2022-06-22 05:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("services", "0096_create_syllables_fi_columns"), ] operations = [ migrations.AlterField( model_name="unitconnection", ...
Python
0
9009315381edd69adac3319b973b3bcdb16f23e4
Add missing module wirecloud.live.utils
src/wirecloud/live/utils.py
src/wirecloud/live/utils.py
# -*- coding: utf-8 -*- # Copyright (c) 2016 CoNWeT Lab., Universidad Politécnica de Madrid # This file is part of Wirecloud. # Wirecloud 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 versio...
Python
0.000024
5e49eb4fb6bce9cdeae515590530b78e4dde89d9
Add alternate example for `match_template`.
doc/examples/plot_match_face_template.py
doc/examples/plot_match_face_template.py
""" ================= Template Matching ================= In this example, we use template matching to identify the occurrence of an image patch (in this case, a sub-image centered on the camera man's head). Since there's only a single match, the maximum value in the `match_template` result` corresponds to the head lo...
Python
0
854fd7de75a14ee030b8f2e8a686dd96f40273de
Add mvn-push.py
mvn-push.py
mvn-push.py
#!/usr/bin/python import os import sys import getopt from os.path import realpath from os.path import join from os.path import basename import subprocess help_message = 'mvn-push.py --group package --id package --version version --file file [--javadoc file|path] [--sources file]' mvn_repo=os.getcwd() cleanup = '' d...
Python
0.000004
f284bb85a0b28142850f980a33f38a3cf25d9da8
Solve Knowit 2017/08
knowit2017/08.py
knowit2017/08.py
memoized = {} def christmas_number(n): in_sequence = {1: True} while True: if n > 10000000: for k in in_sequence: memoized[k] = False return False in_sequence[n] = True if n in memoized: return memoized[n] n = sum([int(d)...
Python
0.000118
2dd0efce803c4dfcc4c5d61cf6fec1d5ee64e1b3
test for btcSpecialTx.py
test/test_btcSpecialTx.py
test/test_btcSpecialTx.py
from pyethereum import tester from datetime import datetime, date import math import pytest slow = pytest.mark.slow class TestBtcSpecialTx(object): CONTRACT = 'btcSpecialTx.py' CONTRACT_GAS = 55000 ETHER = 10 ** 18 def setup_class(cls): tester.gas_limit = 2 * 10**6 cls.s = tester.st...
Python
0.000001
edc5116472c49370e5bf3ff7f9f7872732b0285e
Add a solution to the phone number problem: can a phone number be represented as words in a dictionary?
phone_numbers.py
phone_numbers.py
#!/usr/bin/env python import unittest words = set(["dog", "clog", "cat", "mouse", "rat", "can", "fig", "dig", "mud", "a", "an", "duh", "sin", "get", "shit", "done", "all", "glory", "comes", "from", "daring", "to", "begin", ]) dialmap = { 'a':2, 'b':2, 'c':2, 'd':3, 'e':...
Python
0.999746
904ac79bd278634c97f6f43f4d85bc0c2316117b
add configuration example
scripts/exchange-bots/config-example.py
scripts/exchange-bots/config-example.py
from bot.strategies.maker import MakerRamp, MakerSellBuyWalls wallet_host = "localhost" wallet_port = 8092 wallet_user = "" wallet_password = "" witness_url = "ws://testnet.bitshares.eu/ws" witness_user = "" witness_password = "" watch_markets = ["PE...
Python
0.000001
94ca753de7d6d7f82bc71fb2216128c13b2c2499
Add py
picasawebsync.py
picasawebsync.py
#!/usr/bin/python from gdata.photos.service import * import gdata.media import gdata.geo import os import re import pprint import sys import argparse # Class to store details of an album class Albums: def __init__(self, rootDir): self.albums = Albums.scanFileSystem(rootDir) # walk the directory tree...
Python
0.000288
d5cfa59c586053d911f8725dfd321d8ad0eecce6
Fix context comprobation. It must be exist at begining
account_voucher_payment_method/account_voucher.py
account_voucher_payment_method/account_voucher.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Addons modules by CLEARCORP S.A. # Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). # # This program is free software: you can redistribute...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Addons modules by CLEARCORP S.A. # Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). # # This program is free software: you can redistribute...
Python
0.994592
60efa5bbab4463714df8dd93c1c7c606bee4dbaf
add giphy plugin
plugins/giphy.py
plugins/giphy.py
from util import http, hook @hook.api_key('giphy') @hook.command('giphy', autohelp=False) @hook.command('gif', autohelp=False) @hook.command(autohelp=False) def giphy(inp, api_key=None): ".giphy [term] -- gets random gif for a term" data = http.get_json("http://api.giphy.com/v1/gifs/random", { "api_key": api_...
Python
0
227a8e0f654c9797a7dedf863f7568d55a6c2f8e
add download sample from go-sciter port
examples/download.py
examples/download.py
"""Go sciter example port.""" import sciter class MyEventHandler(sciter.EventHandler): def document_complete(self): print("content loaded.") pass def on_data_arrived(self, nm): print("data arrived, uri:", nm.uri, nm.dataSize) pass class Frame(sciter.Window): de...
Python
0
dff9d7a05e2a522b3dbbd7ea18866c5ba1fc0476
add a !stock plugin for stock images
plugins/stock.py
plugins/stock.py
"""!stock <search term> return a stock photo for <search term>""" from random import shuffle import re import requests from bs4 import BeautifulSoup def stock(searchterm): url = "http://www.shutterstock.com/cat.mhtml?searchterm={}&search_group=&lang=en&language=en&search_source=search_form&version=llv1".format(s...
Python
0
d26a78d3e0695e0bf492910c530beb54b30cdbbc
bump version number for development
stdeb/__init__.py
stdeb/__init__.py
# setuptools is required for distutils.commands plugin we use import logging import setuptools __version__ = '0.4.2.git' log = logging.getLogger('stdeb') log.setLevel(logging.INFO) handler = logging.StreamHandler() handler.setLevel(logging.INFO) formatter = logging.Formatter('%(message)s') handler.setFormatter(formatt...
# setuptools is required for distutils.commands plugin we use import logging import setuptools __version__ = '0.4.2' log = logging.getLogger('stdeb') log.setLevel(logging.INFO) handler = logging.StreamHandler() handler.setLevel(logging.INFO) formatter = logging.Formatter('%(message)s') handler.setFormatter(formatter) ...
Python
0
1cab72ac3c5f3cea8326ebc97ccae1a8068eb839
Add http responses collection module.
superview/http.py
superview/http.py
# -*- coding: utf-8 -*- """ The various HTTP responses for use in returning proper HTTP codes. """ from django.http import HttpResponse, StreamingHttpResponse class HttpCreated(HttpResponse): status_code = 201 def __init__(self, *args, **kwargs): location = kwargs.pop('location', '') super(...
Python
0
86baa4f437cf3892c15a56e8331c19b6d2e63b1d
Add a script for generating unicode name table
lib/gen-names.py
lib/gen-names.py
#!/usr/bin/python3 # Input: https://www.unicode.org/Public/UNIDATA/UnicodeData.txt import io import re class Builder(object): def __init__(self): pass def read(self, infile): names = [] for line in infile: if line.startswith('#'): continue line...
Python
0
a50190fe04e434ce70f6b02027e281a896dbb81b
Create Python password hasher
passwordhash.py
passwordhash.py
#!/usr/bin/env python # Password Hashing Module for Linux # Author: Dave Russell Jr (drussell393) from getpass import getpass import crypt # If you like Python 2, please to be importing. import os import binascii password = getpass('Enter your desired password, Harry: ') passwordConfirm = getpass('Confirm your passw...
Python
0.000107
961e9b031b94a0533c53c29787660ab954b6db37
Add patch-weight.py, patch weight into phrase segs.
patch-weight.py
patch-weight.py
#!/usr/bin/env python # -*- coding: utf-8 from codecs import open from argparse import ArgumentParser DEBUG_FLAG = False def load_weight_dict(weight_file): weight_dict = {} with open(weight_file, 'r') as fd: for line in fd: splited_line = line.strip().split() if len(splited_l...
Python
0.000001
9e51fc305f21a4031b6ec94ccfa39ef1e611da9e
add script to compare DFAs.
src/trusted/validator_ragel/unreviewed/compare_dfa.py
src/trusted/validator_ragel/unreviewed/compare_dfa.py
#!/usr/bin/python # Copyright (c) 2013 The Native Client 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 import os sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import dfa_parser visited_pairs = set() de...
Python
0.000011
3cdee1d40d3370686c9bff435a4575e985c121e9
Create __init__.py
pfc/__init__.py
pfc/__init__.py
"""pfc"""
Python
0.000429
438471a4a3b41637c5c1eb3c2e07d9d8ca81ee09
Add a stats ./manage.py command
www/management/commands/stats.py
www/management/commands/stats.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals # Copyright 2014, Cercle Informatique ASBL. All rights reserved. # # 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 ...
Python
0.000048
633e540a1718a5cc515725b13d3f1740bb950bb6
Use GitHub URL for ImageMagick
var/spack/repos/builtin/packages/ImageMagick/package.py
var/spack/repos/builtin/packages/ImageMagick/package.py
############################################################################## # Copyright (c) 2013-2016, 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...
############################################################################## # Copyright (c) 2013-2016, 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
3ba109622c24bd52f32e605c523249e1c26b0207
Add regression test with non ' ' space character as token
spacy/tests/regression/test_issue834.py
spacy/tests/regression/test_issue834.py
# coding: utf-8 from io import StringIO word2vec_str = """, -0.046107 -0.035951 -0.560418 de -0.648927 -0.400976 -0.527124 . 0.113685 0.439990 -0.634510   -1.499184 -0.184280 -0.598371""" def test_issue834(en_vocab): f = StringIO(word2vec_str) vector_length = en_vocab.load_vectors(f) assert vector_lengt...
Python
0.99974
d11707e651d4b44ef706f62677ba6a617102f239
Add test-code
test/post_test.py
test/post_test.py
import json import urllib2 data = { "cells":["ECT","VISC", "AAA"] } req = urllib2.Request('http://localhost:5000/api') req.add_header('Content-Type', 'application/json') response = urllib2.urlopen(req, json.dumps(data))
Python
0.000083
480852bb1dd6796b7fb12e40edc924b9a4dbee60
Add tests to cover no framework, no problem
test/test_misc.py
test/test_misc.py
import unittest from .helpers import run_module class MiscTests(unittest.TestCase): def setUp(self): self.name = "benchmarker" def test_no_framework(self): with self.assertRaises(Exception): run_module(self.name) def test_no_problem(self): with self.assertRaises(Exce...
Python
0
ae372375a7160978eb56ef9b710027887a844d6f
add tests, now i am cool.
test_app_input.py
test_app_input.py
""" Test sending data to process_message. """ import pytest from plugins.werewolf import app from plugins.werewolf.user_map import get_user_map, set_user_map, reset_user_map def get_empty_game_state(): # hi there # make mock game state. # we'll have several fixtures # and a basic one we can set up in...
Python
0
431760d7a840543901fc1ebc0069ecd384302101
Add tests/conftest.py for py.test
tests/conftest.py
tests/conftest.py
import decimal import os try: # Python 2 from ConfigParser import ConfigParser except ImportError: # Python 3 from configparser import ConfigParser import tests.helpers as th from .helpers import cfgpath, clear_db, get_app_lock, release_app_lock _parser = ConfigParser({ 'server': 'localhost', ...
Python
0
bceee12d94924931ff73b45d2ed3de8b3d71522c
Add case fixture to top-level conftest.py in tests
tests/conftest.py
tests/conftest.py
import pytest from gaphor.conftest import Case @pytest.fixture def case(): case = Case() yield case case.shutdown()
Python
0.000001
c8946c27aa334b3c0caa4be1e108715ed8969045
Add tests for app endpoint.
tests/test_app.py
tests/test_app.py
from __future__ import print_function import sys import os if sys.version_info > (2, 7, 0): import unittest else: import unittest2 as unittest from mock import Mock sys.path.append(os.path.join(os.path.dirname(__file__), '../bin')) import qds from qds_sdk.connection import Connection from test_base import pri...
Python
0
0146058fe8a5c91ce33102bb55f5f087428a03a3
Add tests for get_keeper_token
tests/test_cli.py
tests/test_cli.py
"""Test the ltd-mason CLI features.""" from base64 import b64encode import responses import pytest from ltdmason.cli import get_keeper_token @responses.activate def test_get_keeper_token(): """Test getting a token from LTD Keeper.""" expected_json = {'token': 'shake-it-off-shake-it-off'} responses.add(...
Python
0.000001
e1e8bef8c2c916505e9bdc0ea37c81a7626db6af
Add int tests
tests/test_int.py
tests/test_int.py
import pytest import parsenvy def test_int_positive(monkeypatch): """'13'""" monkeypatch.setenv("foo", "13") assert parsenvy.int("foo") == 13 def test_int_negative(monkeypatch): """'-42'""" monkeypatch.setenv("foo", "-42") assert parsenvy.int("foo") == -42 def test_int_zero(monkeypatch)...
Python
0.000061
3b66fbc844b023003420db7a9986811110f55489
Add tests for the run() function
tests/test_run.py
tests/test_run.py
import sys import tempfile import unittest try: from StringIO import StringIO except ImportError: from io import StringIO import icon_font_to_png class TestRun(unittest.TestCase): def create_css_file(self, contents): css_file = tempfile.NamedTemporaryFile() css_file.write(contents.encode(...
Python
0.000011
578de6c57f9698c7e273af06d1e815f71269bb18
Add a sample python file interesting to debug
tests/to_debug.py
tests/to_debug.py
import sys import os import time import threading import ikpdb TEST_MULTI_THREADING = False TEST_EXCEPTION_PROPAGATION = False TEST_POSTMORTEM = True TEST_SYS_EXIT = 0 TEST_STEPPING = False # Note that ikpdb.set_trace() will reset/mess breakpoints set using GUI TEST_SET_TRACE = False TCB = TEST_CONDITIONAL_BREAKPO...
Python
0
329270ddef5f4da4528750ebc463ffc910325ec8
add migration
temba/channels/migrations/0066_auto_20170306_1713.py
temba/channels/migrations/0066_auto_20170306_1713.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-06 17:13 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('channels', '0065_auto_20170228_0837'), ] operations = [ migrations.AlterFie...
Python
0.000001
a8caef202ba0fd6909359241ff385eca762aca1f
Add echo effect
quack/effects.py
quack/effects.py
# Author: Martin McBride # Created: 2018-09-25 # Copyright (C) 2018, Martin McBride # License: MIT import math import numpy as np from quack.buffer import create_buffer def echo(params, source, delay, strength): ''' Create an echo :param params: :param source: :param delay: :param strength: ...
Python
0.000002
bdd7016fe8f41abdc8562d114efc41622916a675
Create startBackEnd.py
startBackEnd.py
startBackEnd.py
#!/usr/bin/python import boto.ec2 conn = boto.ec2.connect_to_region("eu-central-1", aws_access_key_id='AKIAI111111111111111', aws_secret_access_key='keyyyyy') instance = conn.get_all_instances(instance_ids=['i-40eb8111']) print instance[0].instances[0].start()
Python
0.000002
f6f2c6fc2a51bb3243d9b99ab1093809a2d1a5bb
Add script that tests AI players
test_players.py
test_players.py
from AI import * import random def RandomPlayer(game): return 0, random.choice(game.get_available_moves()) def ABPlayer(game): return alpha_beta_search(game, 8, -np.inf, np.inf, True, evaluate_base) def ABChainPlayer1(game): return alpha_beta_search(game, 7, -np.inf, np.inf, True, evaluate_chain_len) de...
Python
0.000001
0cf85c1ab68ddc50787e6a09f3604320d18118b4
Add UniqueForFieldsMixin
django_more/mixins.py
django_more/mixins.py
from django.db.models.options import normalize_together from django.utils.functional import cached_property # Used by OrderByField to allow for unique_together constraints to be field declared class UniqueForFieldsMixin: """ Mixin first to a Field to add a unique_for_fields field option """ unique_for_fields ...
Python
0
419f86f5c50f812f19dd731e9c33f66e57f51a48
Test matrix - work in progress
tests/matrix.py
tests/matrix.py
import os.path, urllib, subprocess, shutil python_versions = ['2.4.6', '2.5.6', '2.6.8', '2.7.5'] libcurl_versions = ['7.19.0', '7.32.0'] class in_dir: def __init__(self, dir): self.dir = dir def __enter__(self): self.oldwd = os.getcwd() os.chdir(self.dir) def __exit__(se...
Python
0
c24647a921c64cfc8a1385f7e735622514e199c3
make it clear that we don't depend on gabble version for the test
tests/test-caps-update.py
tests/test-caps-update.py
""" Test that CapabilitiesChanged signal is emitted only once after all the caps in the presence have been analyzed. """ import dbus from twisted.words.xish import domish from servicetest import match, unwrap, lazy from gabbletest import go, make_result_iq def make_presence(from_jid, type, status): presence = d...
""" Test that CapabilitiesChanged signal is emitted only once after all the caps in the presence have been analyzed. """ import dbus from twisted.words.xish import domish from servicetest import match, unwrap, lazy from gabbletest import go, make_result_iq def make_presence(from_jid, type, status): presence = ...
Python
0.000001
1ef3c14af249f211df4cdad89cdd49d7f2845eb1
Add share count using Flask.
flask_share_count.py
flask_share_count.py
from flask import Flask, jsonify, request import grequests, re, json app = Flask(__name__) FACEBOOK = 'https://api.facebook.com/method/links.getStats?urls=%s&format=json' TWITTER = 'http://urls.api.twitter.com/1/urls/count.json?url=%s&callback=count' REDDIT = 'http://buttons.reddit.com/button_info.json?url=%s' STUMBL...
Python
0
7311f8f2a8a7ab285669dc02d26d7e2248583ff5
Add tests for 'rle_compress'
test_rle.py
test_rle.py
import pypolycomp import numpy as np def test_compression(): for cur_type in (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64): compressed = pypolycomp.rle_compress(np.array([1, 1, 1, 2, 3], dtype=cur_type)) assert np.all(compressed == np.array(...
Python
0.000013
da2b773bf6e669b3ec50bbd6af73e1d80bb0b5a5
Add tsstats/event.py for easy event-initialization
tsstats/events.py
tsstats/events.py
from collections import namedtuple Event = namedtuple( 'Event', ['timestamp', 'identifier', 'action', 'arg', 'arg_is_client'] ) def nick(timestamp, identifier, nick): return Event(timestamp, identifier, 'set_nick', nick, arg_is_client=False) def connect(timestamp, identifier): return Event( tim...
Python
0
99f5c2a9cd44ac8ed301a781460816e8f0dffdb8
add killall.py example script
examples/killall.py
examples/killall.py
#!/usr/bin/env python """ Kill a process by name. """ import os import sys import psutil def main(): if len(sys.argv) != 2: sys.exit('usage: %s name' % __file__) else: NAME = sys.argv[1] killed = [] for proc in psutil.process_iter(): if proc.name == NAME and proc.pid != os.ge...
Python
0.000001
20c08b96ce7a5377576e45953266c51079b5bdeb
Create testfile.py
testfile.py
testfile.py
print("Tess is cool")
Python
0.000005
da4bdccbc7ff3b949659e048c9a0b3643dfbca42
Add Docker pipeline operator - wip
airflow_pipeline/operators/docker_pipeline_operator.py
airflow_pipeline/operators/docker_pipeline_operator.py
""" .. module:: operators.docker_pipeline_operator :synopsis: A DockerOperator that moves XCOM data used by the pipeline .. moduleauthor:: Ludovic Claude <ludovic.claude@chuv.ch> """ try: from airflow.operators import DockerOperator except ImportError: from airflow.operators.docker_operator import Docker...
Python
0
d75eebbcb6b1922d37a97550bc4cbead6e50cfdb
add localdb.py
united/localdb.py
united/localdb.py
# -*- coding: utf-8 -*- """ Copyright (C) 2015, MuChu Hsu Contributed by Muchu Hsu (muchu1983@gmail.com) This file is part of BSD license <https://opensource.org/licenses/BSD-3-Clause> """ import sqlite3 import os import logging from pkg_resources import resource_filename """ 資料庫存取 類別 """ class SQLite3Db: #建構子 ...
Python
0.000001
b6d1b9365c356a14f0f9ef478247d498845a2b2c
add script to process normal vectors
coastline/data/vectors.py
coastline/data/vectors.py
import matplotlib.pyplot as plt import glob import math def extract_data(file_name): points = [] with open(file_name, 'r') as f: for i, line in enumerate(f): if i > 2: s = line.split() point = (float(s[0]), float(s[1])) points.append(point) ...
Python
0