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
27899a91fc6cdf73dccc7f9c5c353b05d2433c42
add example participant client inbound drop rule for blackholing
pclnt/blackholing_test.py
pclnt/blackholing_test.py
{ "inbound": [ { "cookie": 3, "match": { "eth_src": "08:00:27:89:3b:9f" }, "action": { "drop": 0 } } ] }
Python
0
cbded2a70fd854d502653137beb8809004e5874b
Add example Deep Zoom static tiler
examples/deepzoom/deepzoom-tile.py
examples/deepzoom/deepzoom-tile.py
#!/bin/env python # # deepzoom-tile - Convert whole-slide images to Deep Zoom format # # Copyright (c) 2010-2011 Carnegie Mellon University # # This library is free software; you can redistribute it and/or modify it # under the terms of version 2.1 of the GNU Lesser General Public License # as published by the Free Sof...
Python
0
cd910f95753a138e2df48a1370e666bee49ad1dd
Add py solution for 693. Binary Number with Alternating Bits
py/binary-number-with-alternating-bits.py
py/binary-number-with-alternating-bits.py
class Solution(object): def hasAlternatingBits(self, n): """ :type n: int :rtype: bool """ power_2 = (n ^ (n >> 1)) + 1 return (power_2 & -power_2) == power_2
Python
0.000085
b34c0ec439a997705799136e56a926649bd93e52
add new function to test whether an object is completely within the bounds of an image
plantcv/plantcv/within_frame.py
plantcv/plantcv/within_frame.py
import cv2 as cv2 import numpy as np def within_frame(img, obj): ''' This function tests whether the plant object is completely in the field of view Input: img - an image with the bounds you are interested in obj - a single object, preferably after calling pcv.image_composition(), that is from with...
Python
0.000054
c4040803cb670f913bc8743ee68f5a5f0721d4f8
Add game logic
backend/game.py
backend/game.py
# All game related code import json import random class Game(): def __init__(self): self.players = {} self.turn = None self.running = False def add_player(self, conn, data): player = Player(conn, data) self.players[player.get_name()] = player conn.send(json.du...
Python
0.000059
69e22c778a576f746784270fa9971a6399433f92
Add docstring to UnivariateFilter.
examples/plot_feature_selection.py
examples/plot_feature_selection.py
""" =============================== Univariate Feature Selection =============================== An example showing univariate feature selection. Noisy (non informative) features are added to the iris data and univariate feature selection is applied. For each feature, we plot the p-values for the univariate feature s...
""" =============================== Univariate Feature Selection =============================== An example showing univariate feature selection. Noisy (non informative) features are added to the iris data and univariate feature selection is applied. For each feature, we plot the p-values for the univariate feature s...
Python
0
1beec05941a6a34452bea6e9f60a1673c0f0925f
add base test case file
keen/tests/base_test_case.py
keen/tests/base_test_case.py
__author__ = 'dkador'
Python
0.000001
1fa849f1a0eadad9573b677d3904986d76f900eb
Create main.py
challenge_2/python/wost/main.py
challenge_2/python/wost/main.py
""" Python 3.6: :: Counts all the instances of all the elements in a list. :: Returns all the instances with a count of 1. """ def find_one_in_list(a_list): a_dict = {} for char in a_list: if char not in a_dict.keys(): a_dict[char] = 1 else: a_dict[char] += 1 for letter in a_dict....
Python
0.000001
ac4679b4dcbbc3b2a29230233afc138f98cf2c42
Add the basics
anvil.py
anvil.py
import gzip import io import nbt.nbt import pathlib import re import zlib class Region: def __init__(self, path): if isinstance(path, str): path = pathlib.Path(path) with path.open('rb') as f: data = f.read() self.locations = data[:4096] self.timestam...
Python
0.006448
702abe6dc661fbcda04f743edc56d2938098cefa
Add checkJSON file function only for checking a JSON file against a specified schema
src/main/python/convertfiles/checkJSON.py
src/main/python/convertfiles/checkJSON.py
#!/nfs/projects/c/ci3_jwaldo/MONGO/bin/python """ This function will check an existing JSON newline delimited file against a specified schema Input is a newline delimited JSON file and schema file Output is a summary printout of statistics Usage: python checkJSON [-options] OPTIONS: --input Name of input filename (r...
Python
0
7330f9f1423fe7ee169569957d537441b6d72c08
Create 0106_us_city_synonyms.py
2019/0106_us_city_synonyms.py
2019/0106_us_city_synonyms.py
#%% """ NPR 2019-01-06 https://www.npr.org/2019/01/06/682575357/sunday-puzzle-stuck-in-the-middle Name a major U.S. city in 10 letters. If you have the right one, you can rearrange its letters to get two 5-letter words that are synonyms. What are they? """ import sys sys.path.append('..') import nprcommontools as nct...
Python
0.00367
2f08053dc04470c9a1e4802e0e90c198bb5eae63
Update app/views/account/__init__.py
app/views/account/__init__.py
app/views/account/__init__.py
from flask import Blueprint account = Blueprint( 'account', __name__ ) from . import views
Python
0
5470661c6f171f1e9da609c3bf67ece21cf6d6eb
Add example for response status code
examples/return_400.py
examples/return_400.py
import hug from falcon import HTTP_400 @hug.get() def only_positive(positive: int, response): if positive < 0: response.status = HTTP_400
Python
0.000001
450f55f158bdec4b290851d68b8b79bd824d50f6
Add the joystick test
bin/joy_test.py
bin/joy_test.py
#!/usr/bin/env python from __future__ import print_function import pygame # Define some colors BLACK = ( 0, 0, 0) WHITE = ( 255, 255, 255) # This is a simple class that will help us print to the screen # It has nothing to do with the joysticks, just outputing the # information. class TextPrint: def _...
Python
0.000004
34f44cd57baf9f0a548d728e90ca0c67f47b08a1
Add tests for Resource
tests/test_resource.py
tests/test_resource.py
import unittest import soccermetrics from soccermetrics import __api_version__ from soccermetrics.rest import SoccermetricsRestClient from soccermetrics.rest.resource import Resource class ResourceTest(unittest.TestCase): def setUp(self): base_url = "http://api-summary.soccermetrics.net" auth = d...
Python
0
0b0d77ca77cf5359175836d68fc0bcce3829d731
Create change_config.py
static/scripts/change_hostname/change_config.py
static/scripts/change_hostname/change_config.py
import os, sys from change_gluu_host import Installer, FakeRemote, ChangeGluuHostname name_changer = ChangeGluuHostname( old_host='<current_hostname>', new_host='<new_hostname>', cert_city='<city>', cert_mail='<email>', cert_state='<state_or_region>', cert_country='<country>', server='<actu...
Python
0.000002
d3d077cb7aae7a5b125dcd7daa19f00e3e22a53b
Add user-desc module
cme/modules/user_description.py
cme/modules/user_description.py
from pathlib import Path from datetime import datetime from impacket.ldap import ldap, ldapasn1 from impacket.ldap.ldap import LDAPSearchError class CMEModule: ''' Get user descriptions stored in Active Directory. Module by Tobias Neitzel (@qtc_de) ''' name = 'user-desc' description = 'Get us...
Python
0
3cb39bc8be7fdf857ebbdd2f78cbb617b2dda104
Create PowofTwo_003.py
leetcode/231-Power-of-Two/PowofTwo_003.py
leetcode/231-Power-of-Two/PowofTwo_003.py
class Solution: # @param {integer} n # @return {boolean} def isPowerOfTwo(self, n): return n > 0 and (n & n - 1 is 0)
Python
0.000009
90987fccd2f604a5224e5b1cf8f91073b173fdc8
Splitting a sentence by ending characters
split_sentences.py
split_sentences.py
""" Splitting a sentence by ending characters """ import re st1 = " Another example!! Let me contribute 0.50 cents here?? \ How about pointer '.' character inside the sentence? \ Uni Mechanical Pencil Kurutoga, Blue, 0.3mm (M310121P.33). \ Maybe there could be a multipoint delimeter?.. Jus...
Python
1
98d8716192bfb6b4223d84855f647e2b698b5f19
Add test for viewport inspection
tests/test_viewport.py
tests/test_viewport.py
from tests.base import IntegrationTest from time import sleep class TestViewportsTaskGeneration(IntegrationTest): viminput = """ === Work tasks | +work === """ vimoutput = """ === Work tasks | +work === * [ ] tag work task #{uuid} """ tasks = [ dict(description="tag work ta...
from tests.base import IntegrationTest class TestViewportsTaskGeneration(IntegrationTest): viminput = """ === Work tasks | +work === """ vimoutput = """ === Work tasks | +work === * [ ] tag work task #{uuid} """ tasks = [ dict(description="tag work task", tags=['work']), ...
Python
0.000001
5e2a14af770ca07cdf6f3674ef54668a0a433078
hello py
helloworld.py
helloworld.py
print "Hello World";
Python
0.99991
3ac33d336166a041caa4fbdd895f789d86081029
add unit test
lib/new_xml_parsing/test_compatibility.py
lib/new_xml_parsing/test_compatibility.py
#!/usr/bin/env python import unittest import os import sys import re from xml.sax import parseString sys.path.append('..') from patXML import * from parsexml import Patent # Directory of test files and logs xml_files = [x for x in os.listdir('test_xml_files') if re.match(r"2012_\d.xml", x) != None] # M...
Python
0.000001
edd28dc68b91af78da1a1d576fcb9dcb83ebd0c8
Create lin_reg.py
lin_reg.py
lin_reg.py
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from scipy.signal import square #Mean Square error function def costf(X, y, theta): m = y.shape[0] #print m return (1.0/m)*np.sum(np.power(np.dot(X,theta) - y, 2)) #Gradient of error function def gradientf(X, y, theta): m = y.shape[...
Python
0.00001
dc854dc41929b027f393c7e341be51193b4ca7b9
Create SearchinRSArr_001.py
leetcode/033-Search-in-Rotated-Sorted-Array/SearchinRSArr_001.py
leetcode/033-Search-in-Rotated-Sorted-Array/SearchinRSArr_001.py
class Solution: # @param {integer[]} nums # @param {integer} target # @return {integer} def search(self, nums, target): l, r = 0, len(nums) - 1 while l <= r: m = (l + r) / 2 if nums[m] == target: return m elif nums[m] > target:...
Python
0
a10554b81d4def386b016698c1e7dd771cecd35b
fix automatic testing
python/qidoc/test/test_qidoc.py
python/qidoc/test/test_qidoc.py
## Copyright (c) 2012 Aldebaran Robotics. All rights reserved. ## Use of this source code is governed by a BSD-style license that can be ## found in the COPYING file. import os import tempfile import unittest import qidoc.core import qibuild class TestQiDoc(unittest.TestCase): def setUp(self): self.tmp ...
## Copyright (c) 2012 Aldebaran Robotics. All rights reserved. ## Use of this source code is governed by a BSD-style license that can be ## found in the COPYING file. import os import tempfile import unittest import qidoc.core import qibuild class TestQiDoc(unittest.TestCase): def setUp(self): self.tmp ...
Python
0.000225
b57c24b23fa9566178455da895ea63baf6e16ff4
Test cases to verify parsing of bitwise encoded PIDs
tests/scanner_tests.py
tests/scanner_tests.py
from shadetree.obd.scanner import decode_bitwise_pids DURANGO_SUPPORTED_PIDS_RESPONSE = 'BE 3E B8 10 ' JETTA_DIESEL_SUPPORTED_PIDS_RESPONSE = '98 3B 80 19 ' def test_decode_bitwise_pids_durango(): """ Verify we correctly parse information about supported PIDs on a 1999 Dodge Durango """ supported...
Python
0
0eb28e89a5c5453a8337e031dd71a5019d828aab
Remove radmin credentials from create_heat_client
trove/common/remote.py
trove/common/remote.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010-2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www....
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010-2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www....
Python
0.000006
7a9bb7d412ccfa4921dc691232c1192bbb2789cd
Add rudimentary swarming service.
dashboard/dashboard/services/swarming_service.py
dashboard/dashboard/services/swarming_service.py
# Copyright 2016 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. """Functions for interfacing with the Chromium Swarming Server. The Swarming Server is a task distribution service. It can be used to kick off a test run. ...
Python
0.000001
1a3839a083293200862ea21283c9c4d82a836846
Add test for profiles.
tests/test_catalyst.py
tests/test_catalyst.py
from vdm.catalyst import DisambiguationEngine def pretty(raw): """ Pretty print xml. """ import xml.dom.minidom xml = xml.dom.minidom.parseString(raw) pretty = xml.toprettyxml() return pretty def test_profile(): #Basic info about a person. p = [ 'Josiah', 'Carberr...
Python
0
15b69945a209515c236d8ed788e824a895ef6859
Create uvcontinuum.py
xmps/color_selection/uvcontinuum.py
xmps/color_selection/uvcontinuum.py
Python
0.000006
ba60687fec047ed94bf7bb76dcf8bcf485c705ec
Add script to repair member relations between organizations and packages.
repair_organizations_members.py
repair_organizations_members.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # Etalab-CKAN-Scripts -- Various scripts that handle Etalab datasets in CKAN repository # By: Emmanuel Raviart <emmanuel@raviart.com> # # Copyright (C) 2013 Emmanuel Raviart # http://github.com/etalab/etalab-ckan-scripts # # This file is part of Etalab-CKAN-Scripts. # # ...
Python
0
baac9ff6b831a1b91271daa3eb02cce32774f2f5
Create DMX Blackout routine
pyEnttecBlackout.py
pyEnttecBlackout.py
#!/usr/bin/env python #import msvcrt import serial import sys import time class pydmx(object): def __init__(self, port_number=2): self.channels = [0 for i in range(512)] self.port_number = port_number # DMX_USB Interface variables self.SOM_VALU...
Python
0
c6f09446076677e5a3af8fda8c7fbbb73885234f
Add Custom Filter Design demo
demo/custom_filter_design.py
demo/custom_filter_design.py
import yodel.analysis import yodel.filter import yodel.complex import yodel.conversion import matplotlib.pyplot as plt def frequency_response(response): size = len(response) freq_response_real = [0] * size freq_response_imag = [0] * size fft = yodel.analysis.FFT(size) fft.forward(response, freq_re...
Python
0
4826764c24fca8204322f88adfde75968b3985ee
add wrapper to start bucky from source tree
bucky.py
bucky.py
#!/usr/bin/env python import bucky.main if __name__ == '__main__': bucky.main.main()
Python
0
c757c6ad714afb393c65c1b82bca31de357332fc
Add test coverage for utility module
python/util_test.py
python/util_test.py
# # (C) Copyright IBM Corp. 2017 # # 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 writi...
Python
0
7492df7b83a99a3173726d4f253718a96ec13200
add initial gyp file
deps/mpg123/mpg123.gyp
deps/mpg123/mpg123.gyp
# This file is used with the GYP meta build system. # http://code.google.com/p/gyp # To build try this: # svn co http://gyp.googlecode.com/svn/trunk gyp # ./gyp/gyp -f make --depth=. mpg123.gyp # make # ./out/Debug/test { 'target_defaults': { 'default_configuration': 'Debug', 'configurations': { ...
Python
0
8ee2f2b4c3a0ac40c6b7582a2cf3724f30f41dae
Add data migration
workshops/migrations/0035_auto_20150107_1205.py
workshops/migrations/0035_auto_20150107_1205.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def copy_project_to_tags(apps, schema_editor): Event = apps.get_model('workshops', 'Event') for event in Event.objects.all().exclude(project=None): tag = event.project print('add {} to {}'...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('workshops', '0034_auto_20150107_1200'), ] operations = [ migrations.RenameModel( old_name='Project', ...
Python
0.999708
660d04ac87ea05032a0c19b293fd237bda15fad9
tempson main class
tempson/tempson.py
tempson/tempson.py
# -*- coding: utf-8 -*- def render(): print "1234"
Python
0.999092
3ba67bf461f2f35f549cc2ac5c85dd1bfb39cfa4
Add a collection of tests around move_or_merge.py
src/MCPClient/tests/test_move_or_merge.py
src/MCPClient/tests/test_move_or_merge.py
# -*- encoding: utf-8 import pytest from .move_or_merge import move_or_merge def test_move_or_merge_when_dst_doesnt_exist(tmpdir): src = tmpdir.join("src.txt") dst = tmpdir.join("dst.txt") src.write("hello world") move_or_merge(src=src, dst=dst) assert not src.exists() assert dst.exists() ...
Python
0.000001
3c2c6002cf25dab301044f2dc4c2c3bbd99e121e
add script file
get-polymer-imports.py
get-polymer-imports.py
#!/usr/bin/env python import os import sys #rootDir = "bower_components" numArgs = len(sys.argv) if numArgs <= 1: print 'usage: get_all_imports.py <bower_components directory> [prefix (default "..")]' exit(1) rootDir = sys.argv[1] if not (rootDir == "bower_components" or rootDir == "components"): prin...
Python
0.000002
30dcfef191666951a4084a4b9d9c135c9edb5de8
Create check.py
check.py
check.py
# -*- coding: utf-8 -*- __author__ = 'https://github.com/password123456/' import sys reload(sys) sys.setdefaultencoding('utf-8') import requests class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\03...
Python
0.000001
c5ae855af4c999ab2cbf6d4b5c77a0f04a84c13a
Update design-search-autocomplete-system.py
Python/design-search-autocomplete-system.py
Python/design-search-autocomplete-system.py
# Time: O(p^2), p is the length of the prefix # Space: O(p * t + s), t is the number of nodes of trie # , s is the size of the sentences class TrieNode(object): def __init__(self): self.__TOP_COUNT = 3 self.infos = [] self.leaves = {} def insert(self, s, times...
# Time: O(p^2), p is the length of the prefix # Space: O(p * t + s), t is the number of nodes of trie # , s is the size of the sentences class TrieNode(object): def __init__(self): self.__TOP_COUNT = 3 self.infos = [] self.leaves = {} def insert(self, s, times...
Python
0.000001
0b9810227b91b7ee7bb58cee2dccec992c752768
add xmpp plugin
gozerlib/plugs/xmpp.py
gozerlib/plugs/xmpp.py
# gozerlib/plugs/xmpp.py # # """ xmpp related commands. """ ## gozerlib imports from gozerlib.commands import cmnds from gozerlib.examples import examples from gozerlib.fleet import fleet ## commands def handle_xmppinvite(bot, event): """ invite (subscribe to) a different user. """ if not event.rest: ...
Python
0
b9986a12ac4370a9499e1ca3f006eb3a5050944f
Add spooler service module
cme/modules/spooler.py
cme/modules/spooler.py
# https://raw.githubusercontent.com/SecureAuthCorp/impacket/master/examples/rpcdump.py from impacket.examples import logger from impacket import uuid, version from impacket.dcerpc.v5 import transport, epm from impacket.dcerpc.v5.rpch import RPC_PROXY_INVALID_RPC_PORT_ERR, \ RPC_PROXY_CONN_A1_0X6BA_ERR, RPC_PROXY_CO...
Python
0.000001
e1fad0e5759908b3c1f6d3bafa2110cb4c26b7e1
Add get_jpp_env command...
km3pipe/shell.py
km3pipe/shell.py
# coding=utf-8 # cython: profile=True # Filename: shell.py # cython: embedsignature=True # pylint: disable=C0103 """ Some shell helpers """ from __future__ import division, absolute_import, print_function import os from .logger import logging __author__ = "Tamas Gal" __copyright__ = "Copyright 2016, Tamas Gal and t...
Python
0
1360a7031d4389f2ecdef24ce3190a88e5f8f794
add trivial pjit tests
tests/pjit_test.py
tests/pjit_test.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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.000144
a8d359fd91cb6e92a034703d6203a2997b28c965
Add utility to augment jsdoc with @method tag.
tools/yuimethod.py
tools/yuimethod.py
#!/usr/bin/env python """ Adds the @method tag to method comment blocks. """ import sys import os import re import argparse COMMENT_START_REGEX = re.compile('^(\s*)(/\*|###)\*\s*$') COMMENT_END_REGEX = re.compile('^\s*(\*/|###)\s*$') COMMENT_TAG_REGEX = re.compile('^\s*\* @(\w+).*$') METHOD_REGEX = re.compile('^\s...
Python
0
7c1b0d4efd000fee8f065f2f5815075833811331
Change file location and rename
scripts/reporting/svn_report.py
scripts/reporting/svn_report.py
''' This file creates a .csv file containing the name of each laptop and its last changed date ''' import argparse import csv from datetime import datetime, timezone import os import svn.local import pandas as pd ''' Constants -- paths for reports, default save names, SLA, columns, and sites TO-DO: Change SLA_DAYS to ...
Python
0.000001
d04c5c777b1603e274a5ce722f21dbcdf083f416
add rgw module
ceph_deploy/rgw.py
ceph_deploy/rgw.py
from cStringIO import StringIO import errno import logging import os from ceph_deploy import conf from ceph_deploy import exc from ceph_deploy import hosts from ceph_deploy.util import system from ceph_deploy.lib import remoto from ceph_deploy.cliutil import priority LOG = logging.getLogger(__name__) def get_boots...
Python
0
f3f363e8911d3a635d68c7dbe767ee2585ed4f36
Check for duplicates based on coordinates and select only one database (EU/NASA)
checkDuplicates.py
checkDuplicates.py
import pandas as pd from astropy import coordinates as coord from astropy import units as u class Sweetcat: """Load SWEET-Cat database""" def __init__(self): self.fname_sc = 'WEBSITE_online_EU-NASA_full_database.rdb' # Loading the SweetCat database self.readSC() def read...
Python
0
485bbe732dfb8539ffaf017f3a005896a7f3e503
create subhash module
iscc_bench/imageid/subhash.py
iscc_bench/imageid/subhash.py
# -*- coding: utf-8 -*- """Test strategy with hashing mutiple shift invariant aligned patches See: https://stackoverflow.com/a/20316789/51627 """ def main(): pass if __name__ == '__main__': main()
Python
0.000001
1742beec320d40e7859ea6f3b72e5fb3a7d1a51e
add flask hello world
hello.py
hello.py
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run()
Python
0.999928
f2b329d5ab98cfd1c1e9a9c28e373e1411a78967
Convert text/plain to multipart/alternative
home/bin/parse_mail.py
home/bin/parse_mail.py
#!/usr/bin/python3 import email from email import policy import pypandoc import fileinput import subprocess from email import charset # use 8bit encoded utf-8 when applicable charset.add_charset('utf-8', charset.SHORTEST, '8bit') # read email stdin_lines = [] with fileinput.input(["-"]) as stdin: msg = email.mes...
Python
0.999999
3fabca45d6071c7fe333050264e8b92f23336c12
fix type
kaczmarz.py
kaczmarz.py
import numpy as np #import matplotlib.pyplot as plt def kaczmarz_ART(A,b,maxIter=8,x0=None,lambdaRelax=1,stopmode=None,taudelta=0,nonneg=True,dbglvl=0): # TODO: add randomized ART, and other variants # Michael Hirsch May 2014 # GPL v3+ license # # inputs: # A: M x N 2-D projection matrix #...
Python
0.000003
ef192ebd7679b96317cc6d878fb82c925787710d
Add Pattern based filterer.
source/bark/filterer/pattern.py
source/bark/filterer/pattern.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import re from .base import Filterer class Pattern(Filterer): '''Filter logs using pattern matching.''' INCLUDE, EXCLUDE = ('include', 'exclude') def __init__(self, pattern, key='name', mode=INCLUDE...
Python
0
bcd485f240a7eb6373f847d6cc9dd07ebd2c3ef2
add test case for redeem of default coupon (user limit=1, not bound to user)
coupons/tests/test_use_cases.py
coupons/tests/test_use_cases.py
from datetime import datetime from django.contrib.auth.models import User from django.utils import timezone from django.test import TestCase from coupons.forms import CouponForm from coupons.models import Coupon class DefaultCouponTestCase(TestCase): def setUp(self): self.user = User.objects.create(user...
Python
0
424d7107944f3ecb8ebf78a62dc35428952b380b
add reindex script
contrib/reindex.py
contrib/reindex.py
#!/bin/python # coding: utf-8 import signal import argparse from datetime import datetime argparser = argparse.ArgumentParser() argparser.add_argument("--database-type", "-T", choices=["nic", "ipam"], default="nic") argparser.add_argument("database") args = argparser.parse_args() if args.database_type == "ni...
Python
0.000001
65a1c06b6e5d7ec37ac232ab048b3cc541b75a45
refactor Coupon
customermanage/models/Coupon.py
customermanage/models/Coupon.py
from django.db import models from storemanage.models.Currency import Currency from storemanage.models.Ticket import Ticket from django.contrib.auth.models import User from django.contrib.postgres.fields import JSONField # Create your models here. class Coupon(models.Model): ticket = models.ForeignKey(Ticket, on_de...
Python
0.999424
837dc69a430161f6b942b629793ec1d37db780d4
Create virtool.db.settings
virtool/db/settings.py
virtool/db/settings.py
import logging import pymongo.errors logger = logging.getLogger(__name__) async def initialize(db): try: await db.settings.insert_one({ "_id": "settings", "enable_sentry": {"type": "boolean", "default": True}, "sample_group": "none", "sample_group_read": Tr...
Python
0.000001
094020855126721827342da98992a8c057d1a135
fix memory benchmark for reference builds.
tools/perf/perf_tools/memory_benchmark.py
tools/perf/perf_tools/memory_benchmark.py
# 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. from telemetry import multi_page_benchmark MEMORY_HISTOGRAMS = [ {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'}, {'name': 'V...
# 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. from telemetry import multi_page_benchmark MEMORY_HISTOGRAMS = [ {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'}, {'name': 'V...
Python
0.000017
4e797dd9c8b43ab62f70b0515dee9e6b5c17d043
Create secret.py
propalyzer_site/propalyzer_site/secret.py
propalyzer_site/propalyzer_site/secret.py
class Secret(): SECRET_KEY = ''
Python
0.000032
16a78150d9b208597e73157155646b2d534c11a1
add methods for parinx
libcloudcli/apps/provider.py
libcloudcli/apps/provider.py
# -*- coding:utf-8 -*- import inspect import re from libcloud.utils.misc import get_driver from parinx import ARGS_TO_XHEADERS_DICT, parse_args, \ parse_docstring, get_method_docstring from libcloudcli.errors import ProviderNotSupportedError,\ MissingArguments, MissingHeadersError, MethodParsingException,\ ...
Python
0.000001
3d8fe5cfc64c3667f938fa221353489846a9aeb0
Add test of F.diagonal
tests/chainer_tests/functions_tests/array_tests/test_diagonal.py
tests/chainer_tests/functions_tests/array_tests/test_diagonal.py
import unittest import numpy import chainer from chainer.backends import cuda from chainer import functions from chainer import gradient_check from chainer import testing from chainer.testing import attr @testing.parameterize(*testing.product_dict( [ {'shape': (2, 4, 6), 'args': (1, 2, 0)}, {'sha...
Python
0.999693
254564ceb905dc512693febed44e908c27f249ce
Add tests for cupyx.scipy.ndimage.label
tests/cupyx_tests/scipy_tests/ndimage_tests/test_measurements.py
tests/cupyx_tests/scipy_tests/ndimage_tests/test_measurements.py
import unittest import numpy from cupy import testing import cupyx.scipy.ndimage # NOQA try: import scipy.ndimage # NOQA except ImportError: pass def _generate_binary_structure(rank, connectivity): if connectivity < 1: connectivity = 1 if rank < 1: return numpy.array(True, dtype=b...
Python
0
2a6907ddf9c7b5df2e1b59c8feeb0fa4bd4b5752
add rudimentary validation tests for azure
tests/validation/cattlevalidationtest/core/test_machine_azure.py
tests/validation/cattlevalidationtest/core/test_machine_azure.py
import logging from common_fixtures import * # NOQA DEFAULT_TIMEOUT = 900 subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID') subscription_cert = os.environ.get('AZURE_SUBSCRIPTION_CERT') # Use azure settings from environment variables , if set i = 'b39f27a8b8c64d52b05eac6a62ebad85__' i = i + 'Ubuntu-14_04_1...
Python
0
e9091be4ae9ddf0cb83bd7535c4ced5bb2d691d2
add config_edit.py
castiron/lib/castiron/actions/config_edit.py
castiron/lib/castiron/actions/config_edit.py
from castiron.tools import Action, register_actions import os import re class G: all_edits = [] def _file_contains_re(runner, path, contains_re): real_path = os.path.realpath(os.path.expanduser(path)) if os.path.exists(real_path): with open(real_path) as f: for line in f: ...
Python
0.000004
99430e9f51eccb79f32af49bedfb28ba5f39cd09
update : minor changes
ptop/plugins/system_sensor.py
ptop/plugins/system_sensor.py
''' System sensor plugin Generates the basic system info ''' from ptop.core import Plugin import psutil, socket, getpass import datetime, time class SystemSensor(Plugin): def __init__(self,**kwargs): super(SystemSensor,self).__init__(**kwargs) # overriding the update method def update(sel...
Python
0.000001
ded21520c1fde89336480b48387d383a2e449c2a
Write test for array
tests/chainer_tests/utils_tests/test_array.py
tests/chainer_tests/utils_tests/test_array.py
import unittest import numpy from chainer import cuda from chainer.utils import array from chainer.testing import attr class TestFullLike(unittest.TestCase): def test_full_like_cpu(self): x = numpy.array([1, 2], numpy.float32) y = array.full_like(x, 3) self.assertIsInstance(y, numpy.nda...
Python
0.000234
f4260ad3e652a09922395e64d29bcf8f96ee12bc
Add test_colormap.py
tests/test_colormap.py
tests/test_colormap.py
# -*- coding: utf-8 -*- """" Folium Colormap Module ---------------------- """ import folium.colormap as cm def test_simple_step(): step = cm.StepColormap(['green','yellow','red'], vmin=3., vmax=10., index=[3,4,8,10], caption='step') step = cm.StepColormap(['r','y','g','c','b','m']) step._repr_html_() def...
Python
0.000003
dd65fb84e41b11f8d97e3862d00137969589ab4b
integrate greenify
tests/test_greenify.py
tests/test_greenify.py
from __future__ import absolute_import import sys import time import greenify greenify.greenify() import pylibmc import random from tornado.ioloop import IOLoop from tornado.gen import coroutine from gtornado import green greenify.patch_lib("/usr/lib/x86_64-linux-gnu/libmemcached.so") def call_mc(i): mc = pylibmc...
Python
0.000475
7401d1ecd6b3323b266cf02eabd42a2c4e40d988
Add initial tests for test module
tests/test_test.py
tests/test_test.py
"""tests/test_test.py. Test to ensure basic test functionality works as expected. Copyright (C) 2019 Timothy Edmund Crosley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, i...
Python
0
925da64adf0b74ba18eb78acd9127e3a6dc6f903
Add test cases for reported issues
tests/test_reported.py
tests/test_reported.py
# -*- coding: utf-8 -*- from pyrql import parse CMP_OPS = ['eq', 'lt', 'le', 'gt', 'ge', 'ne'] class TestReportedErrors: def test_like_with_string_parameter(self): expr = 'like(name,*new jack city*)' rep = {'name': 'like', 'args': ['name', '*new jack city*']} pd = parse(expr) ...
Python
0
85b4c2a3966c09bdfebc788b7e3d31fbb8285b77
Add tests for TaskWikiDelete
tests/test_selected.py
tests/test_selected.py
from tests.base import IntegrationTest from time import sleep class TestAnnotateAction(IntegrationTest): viminput = """ * [ ] test task 1 #{uuid} * [ ] test task 2 #{uuid} """ tasks = [ dict(description="test task 1"), dict(description="test task 2"), ] def execute(sel...
from tests.base import IntegrationTest from time import sleep class TestAnnotateAction(IntegrationTest): viminput = """ * [ ] test task 1 #{uuid} * [ ] test task 2 #{uuid} """ tasks = [ dict(description="test task 1"), dict(description="test task 2"), ] def execute(sel...
Python
0
e61c6eb5b5a9f6f70df036dcfedf552325a6e9bd
move unit test syn import to pytest fixture
tests/unit/conftest.py
tests/unit/conftest.py
import logging import pytest from synapseclient import Synapse from synapseclient.core.logging_setup import SILENT_LOGGER_NAME """ pytest unit test session level fixtures """ @pytest.fixture(scope="session") def syn(): """ Create a Synapse instance that can be shared by all tests in the session. """ ...
Python
0
182762812cb1945dd2b50c21b34609be00b7bf45
Create wordlist_add_digits.py
wordlist_add_digits.py
wordlist_add_digits.py
#!/usr/bin/env python #Adds 4digits to the end of the common word lists import os, sys class Wordlist_Add_Digits(): def add_digits(self, wordlist, outfile): #File to start with file=wordlist #Output file out=open(outfile, 'w') #Start loop of 0000-9999 added to each word with open(file) as f: content ...
Python
0.000575
da3e9d5f7ffeae68ef7ae3b07247a9f6cb16d40d
Create get_user_statuses.py
src/Python/get_user_statuses.py
src/Python/get_user_statuses.py
import sys import urllib2 import time import re from lxml import html def get_user_statuses(userid): reached_end = False i = 1 saying_list = [] while not reached_end: page_url = "http://www.douban.com/people/%s/statuses?p=%d" % (userid, i) # TODO: User login. Results limited to the first 10 pag...
Python
0.000003
c0637f482a95dd7ec02bb7b85bc8d164c0a80585
add missing check_headers tool
tools/check_headers.py
tools/check_headers.py
#!/usr/bin/env python2 import sys from os import unlink from os.path import exists HEADERS = ('Content-Disposition', 'Content-Length', 'Content-Type', 'ETag', 'Last-Modified') def is_sig_header(header): header = header.lower() for s in HEADERS: if header.startswith(s.lower()): ...
Python
0.000001
34fd994053b581d0dbb29a5f8f5cbda805c796cf
fix minor bug
xgbmagic/__init__.py
xgbmagic/__init__.py
from xgboost.sklearn import XGBClassifier, XGBRegressor import xgboost as xgb import pandas as pd import operator import seaborn as sns import numpy as np from sklearn import grid_search, metrics class Xgb: def __init__(self, df, target_column='', id_column='', target_type='binary', categorical_columns=[], num_t...
Python
0.000001
3e5105218976549a0a782f179bb358edfd4e89c9
Add load_tests / __init__.py to the azure/cli/tests module to allow for simpler unit test discovery
src/azure/cli/tests/__init__.py
src/azure/cli/tests/__init__.py
from .test_argparse import Test_argparse from unittest import TestSuite test_cases = [Test_argparse] def load_tests(loader, tests, pattern): suite = TestSuite() for testclass in test_cases: tests = loader.loadTestsFromTestCase(testclass) suite.addTests(tests) return suite
Python
0.000001
94128fb2c9dfec51a1a012130734e72cd74bb98b
add new tools to help cleaning fastq files
sequana/scripts/substractor.py
sequana/scripts/substractor.py
# -*- coding: utf-8 -*- # # This file is part of Sequana software # # Copyright (c) 2016 - Sequana Development Team # # File author(s): # Thomas Cokelaer <thomas.cokelaer@pasteur.fr> # # Distributed under the terms of the 3-clause BSD license. # The full license is in the LICENSE file, distributed with this sof...
Python
0
f91d666cc06f5db48bea43de29ca4153e58c473d
add test for os platform check
check.py
check.py
#!/bin/py import os import sys def osCheck(): """ Check if OS is 'UNIX-like' """ if not sys.platform.startswith('linux') or sys.platform.startswith('darwin'): # if not sys.platform.startswith('darwin'): print("This program was designed for UNIX-like systems. Exiting.") sys.exit() osChe...
Python
0
cafb802c51e0c0b8ff58cb749fa30b99cd7182b4
Fix versions script to accept versions without -ce suffix
scripts/versions.py
scripts/versions.py
import operator import re from collections import namedtuple import requests base_url = 'https://download.docker.com/linux/static/{0}/x86_64/' categories = [ 'edge', 'stable', 'test' ] STAGES = ['tp', 'beta', 'rc'] class Version(namedtuple('_Version', 'major minor patch stage edition')): @classmet...
import operator import re from collections import namedtuple import requests base_url = 'https://download.docker.com/linux/static/{0}/x86_64/' categories = [ 'edge', 'stable', 'test' ] STAGES = ['tp', 'beta', 'rc'] class Version(namedtuple('_Version', 'major minor patch stage edition')): @classmet...
Python
0
ba82331fa694ec26c7f0108451abf3912b5a37ff
Reimplement deprecated (1.6) _is_ignorable_404
opbeat/contrib/django/middleware/__init__.py
opbeat/contrib/django/middleware/__init__.py
""" opbeat.contrib.django.middleware ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011-2012 Opbeat Large portions are :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from django.conf import setti...
""" opbeat.contrib.django.middleware ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011-2012 Opbeat Large portions are :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from django.middleware.commo...
Python
0.000001
92b572004264c69baed5cce721e20e1a830514f8
add 'is_changed' filter
filter_plugins/is_changed.py
filter_plugins/is_changed.py
class FilterModule(object): ''' A comment ''' def filters(self): return { 'is_changed': self.is_changed, } def is_changed(self, input_value, key, value): if type(input_value) is not dict: raise TypeError, u"{} must be dict (got {})".format(input_value, str(t...
Python
0.000036
82cab3f91df9b4bb9f60e553d6b9e4ef431cb6ae
Add __init__.py
eppconvert/__init__.py
eppconvert/__init__.py
# # Copyright (c) 2017 Ralf Horstmann <ralf@ackstorm.de> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUT...
Python
0.006636
2f9699d5088266aaa76dad1742f2432d78da9d3b
add validator class
biothings_explorer/resolve_ids/validator.py
biothings_explorer/resolve_ids/validator.py
from collections import defaultdict from ..config_new import ID_RESOLVING_APIS from ..exceptions.id_resolver import InvalidIDResolverInputError from ..utils.common import getPrefixFromCurie class Validator: def __init__(self, user_input): self.__user_input = user_input self.__valid = defaultdict(...
Python
0.000001
c69fdba07aa4228f3e708b49e7fef4d0143e7a13
Add missing stats.py
vpr/tests/api_stats.py
vpr/tests/api_stats.py
from django.db import connection SQL_COUNT = 'select count(id) from vpr_api_apirecord where %s=%s;' def countValue(field, value, time_start=None, time_end=None): cur = connection.cursor() cur.execute(SQL_COUNT % (field, value)) return cur.fetchone()
Python
0.000095
13addaf6e5a0423b632efcc4d16e3e5d864fdac3
Create validate_csv_wd.py
validate_csv_wd.py
validate_csv_wd.py
#!/usr/bin/env python3.5 import sys import re import os import csv def read_file(fname): f = open(fname, 'r') csv_reader = csv.reader(f, delimiter='~') no_rows = 0 for row in csv_reader: no_rows += 1 no_cols = len(row) print("Row %d: columns = %d" % (no_rows, no_cols)) f.close() print("..........
Python
0.001169
6c4ef8298bbdf48f82d13fb25a0f3958237392f2
Add nova client for retrieving instance information
novajoin/nova.py
novajoin/nova.py
# Copyright 2016 Red Hat, Inc. # # 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 agre...
Python
0
d53358a6a0a564a5b4982f7f3dfdfd1163d6a295
Add test covering no RunStop for v2.
databroker/tests/test_v2/test_no_run_stop.py
databroker/tests/test_v2/test_no_run_stop.py
# This is a special test because we corrupt the generated data. # That is why it does not reuse the standard fixures. import tempfile from suitcase.jsonl import Serializer from bluesky import RunEngine from bluesky.plans import count from ophyd.sim import det from databroker._drivers.jsonl import BlueskyJSONLCatalog ...
Python
0
ace782a3f4c616f9e22e1a1ce29f053b71391845
Add missing migration for column description.
cms/migrations/0002_update_template_field.py
cms/migrations/0002_update_template_field.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cms', '0001_initial'), ] operations = [ migrations.AlterField( model_name='page', name='template', ...
Python
0
750fd86c3b5d490003c68adf78b49a74d0a17862
Add cluster.conf shared mapper
falafel/mappers/cluster_conf.py
falafel/mappers/cluster_conf.py
from falafel.core.plugins import mapper import xml.etree.ElementTree as ET @mapper('cluster.conf') def get_cluster_conf(context): """ Return node, fence, fencedevices and resources infomation.The json structure accord the xml struct. Here is example: <cluster name="mycluster" config_version="3"> ...
Python
0.000001
c1e76dbdf07e67d98814d6f357a70c692af3a31d
Add first pass at db router
osf/db/router.py
osf/db/router.py
from django.conf import settings import psycopg2 CACHED_MASTER = None class PostgreSQLFailoverRouter(object): """ 1. CHECK MASTER_SERVER_DSN @ THREAD LOCAL 2. THERE?, GOTO 9 3. GET RANDOM_SERVER FROM `settings.DATABASES` 4. CONNECT TO RANDOM_SERVER 5. IS MASTER SERVER? 6. YES? GOTO 8 ...
Python
0
aca6b8b4cd221efca6d3a5f59f96b73d70e65714
test integration against scipy
gary/integrate/tests/test_1d.py
gary/integrate/tests/test_1d.py
# coding: utf-8 from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os import time import logging # Third-party import numpy as np from astropy import log as logger from scipy.integrate import simps # Project from ..simpsgauss import simpson logg...
Python
0.000001
003cb0478a7fcbc7fb9b3521c174397a9dd9a318
Use sources.list instead of sources.all.
zilencer/lib/stripe.py
zilencer/lib/stripe.py
from functools import wraps import logging import os from typing import Any, Callable, TypeVar from django.conf import settings from django.utils.translation import ugettext as _ import stripe from zerver.lib.exceptions import JsonableError from zerver.lib.logging_util import log_to_file from zerver.models import Rea...
from functools import wraps import logging import os from typing import Any, Callable, TypeVar from django.conf import settings from django.utils.translation import ugettext as _ import stripe from zerver.lib.exceptions import JsonableError from zerver.lib.logging_util import log_to_file from zerver.models import Rea...
Python
0.000001
ca002a18b7e392bbdca9d7e0ed8c39739dc5b4a3
Add code to get 99th percentile absolute pointing for POG
pog_absolute_pointing.py
pog_absolute_pointing.py
import numpy as np from Chandra.Time import DateTime import plot_aimpoint # Get 99th percential absolute pointing radius plot_aimpoint.opt = plot_aimpoint.get_opt() asols = plot_aimpoint.get_asol() # Last six months of data asols = asols[asols['time'] > DateTime(-183).secs] # center of box of range of data mid_dy = (...
Python
0
874da8664a6ee62937fb859665e17c035a66324b
add utils
custom/enikshay/management/commands/utils.py
custom/enikshay/management/commands/utils.py
from __future__ import print_function import csv import datetime from django.core.management import BaseCommand from casexml.apps.case.mock import CaseFactory from casexml.apps.case.xform import get_case_updates from corehq.form_processor.interfaces.dbaccessors import CaseAccessors from custom.enikshay.case_utils ...
Python
0.000004
fa28e80dc7aeed1eb4fb0a18126a2f8105d5a5d2
Create Cleverbot.py
Cleverbot.py
Cleverbot.py
mport re import cleverbot import traceback WORDS = ["CLEVERBOT", "BOT"] PATTERN = r"\b(cleverbot|bot)\b" def handle(text, mic, profile): """ Responds to user-input, typically speech text, starting a conversation with cleverbot Arguments: text -- user-input, typically transcribed speech ...
Python
0
405dfc9a0a814001961e4090be83a3da4a4d4369
Copy in constants file from master
cea/technologies/constants.py
cea/technologies/constants.py
""" Constants used throughout the cea.technologies package. History lesson: This is a first step at removing the `cea.globalvars.GlobalVariables` object. """ # Heat Exchangers U_cool = 2500.0 # W/m2K U_heat = 2500.0 # W/m2K dT_heat = 5.0 # K - pinch delta at design conditions dT_cool = 2.0 # K - pinch delta a...
Python
0
656cf2955510151675dfb4acae4e92e21021a6b5
Add the Course of LiaoXueFeng
LiaoXueFeng/function.py
LiaoXueFeng/function.py
def fact(n): if n==1: return 1 return n * fact(n - 1) print fact(10)
Python
0.000001