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
609e143589d89b5be167914b70de99658776745f
add redirection test
ci/new_tsqa/tests/test_redirection.py
ci/new_tsqa/tests/test_redirection.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
Python
0.000001
2d8b0266dc1bf0eadc2737d35844f5fb45bedd12
Add functional tests for loading by name
nose2/tests/functional/test_loading.py
nose2/tests/functional/test_loading.py
""" pkg1 pkg1.test pkg1.test.test_things pkg1.test.test_things.test_func pkg1.test.test_things.test_gen pkg1.test.test_things.test_gen:3 pkg1.test.test_things.SomeTests pkg1.test.test_things.SomeTests.test_ok # generator method # generator method index # param func # param func index # param method # param method ind...
Python
0
0a610a44f0d20170ba9c3e6f9ec4eafaac937be1
Add unit test for Pattern filterer.
test/unit/filterer/test_pattern.py
test/unit/filterer/test_pattern.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import pytest from bark.log import Log from bark.filterer.pattern import Pattern def test_missing_key_passes(): '''Test log record with missing key passes.''' log = Log() filterer = Pattern('bark\.tes...
Python
0
ef65c5eefdcbb21b83504710e3131affbeb88c88
Create map-reduce-advanced-count-number-of-friends.py
databases/nosql_xml_mapreduce/map-reduce-advanced-count-number-of-friends.py
databases/nosql_xml_mapreduce/map-reduce-advanced-count-number-of-friends.py
import sys from collections import OrderedDict class MapReduce: def __init__(self): self.intermediate = OrderedDict() self.result = [] def emitIntermediate(self, key, value): self.intermediate.setdefault(key, []) self.intermediate[key].append(value) def emit(self, value):...
Python
0.000007
517cb7c66f28e977bf44b7013846f50af8f673fb
Create QiClient.py
Basic/Python/QiPy/Python2/QiClient.py
Basic/Python/QiPy/Python2/QiClient.py
Python
0
1c1967e5a1e941ffa6a8f32d35269f333644cd98
Create 1.py
solutions/1.py
solutions/1.py
CODE = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U':...
Python
0.000001
4a7b60d47a20084867015490cc52f3c5967b979f
add test file
AFQ/utils/tests/test_conversions.py
AFQ/utils/tests/test_conversions.py
import numpy as np import numpy.testing as npt import AFQ.data as afd from AFQ.utils.conversion import matlab_tractography, matlab_mori_groups import os def test_matlab_tractography(): sft = matlab_tractography( "AFQ/tests/data/WholeBrainFG_test.mat", afd.read_mni_template()) npt.assert_equal...
Python
0.000001
c64a687f738cefd6f9461f487e76a3920d0f652c
Add new example
examples/consume_queue_until_empty.py
examples/consume_queue_until_empty.py
import logging from amqpstorm import Connection logging.basicConfig(level=logging.DEBUG) def consume_until_queue_is_empty(): with Connection('127.0.0.1', 'guest', 'guest') as connection: with connection.channel() as channel: while True: message = channel.basic.get('simple_que...
Python
0.000004
f09ee3772d6e15a104af284ed6864005cf8450ef
Add example from listing 11.4
ch11/radix_sort8.py
ch11/radix_sort8.py
""" Listing 11.4: An eight-element radix sort """ from io import open import numpy as np import pyopencl as cl import utility NUM_SHORTS = 8 kernel_src = ''' __kernel void radix_sort8(__global ushort8 *global_data) { typedef union { ushort8 vec; ushort array[8]; } vec_array; uint one_count, ze...
Python
0
b33303779a520a0751648d63977f78890ca11d37
make SCRAPY_LOG_FILE and SCRAPY_FEED_URI optional
scrapyd/launcher.py
scrapyd/launcher.py
import sys from datetime import datetime from multiprocessing import cpu_count from twisted.internet import reactor, defer, protocol, error from twisted.application.service import Service from twisted.python import log from scrapy.utils.python import stringify_dict from scrapyd.utils import get_crawl_args from .inter...
import sys from datetime import datetime from multiprocessing import cpu_count from twisted.internet import reactor, defer, protocol, error from twisted.application.service import Service from twisted.python import log from scrapy.utils.python import stringify_dict from scrapyd.utils import get_crawl_args from .inter...
Python
0
75a0cbbd5af597c6683b6644659780c3076b835e
Disable test_nonlocal_symbol unit test
tensorflow/python/autograph/pyct/static_analysis/activity_py3_test.py
tensorflow/python/autograph/pyct/static_analysis/activity_py3_test.py
# python3 # Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
# python3 # Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
Python
0.000001
f5271083eb9f90fba51bea91126d5eb7005f7c51
add script to delete webhooks
demos/webhooks_delete.py
demos/webhooks_delete.py
import sys from Ziggeo import Ziggeo if(len(sys.argv) < 4): print ("Error\n") print ("Usage: $>python webhooks_delete.py YOUR_API_TOKEN YOUR_PRIVATE_KEY WEBHOOK_URL \n") print ("Example: $>python webhooks_delete.py 1234567890abcdef 1234567890abcdef http://yoursite.com \n") sys.exit() api_token = sys....
Python
0
bbf056f834724a263dbce5c58104db296240a49c
add gyp file
pty.gyp
pty.gyp
{ 'targets': [{ 'target_name': 'pty', 'type': 'loadable_module', 'product_extension': 'node', 'product_prefix': '', 'include_dirs': [ './src' ], 'sources': [ 'src/pty.cc' ], 'libraries': [ '-lutil' ] }] }
Python
0.000001
d98db37dc70a1126de371bf64e89cc4f20e03511
Create repr.py
repr.py
repr.py
""" One useful class method to override is the built-in __repr__() method, which is short for representation; by providing a return value in this method, we can tell Python how to represent an object of our class """ class Point3D(object): def __init__(self,x,y,z): self.x = x self.y = y sel...
Python
0.000001
267bf6b38481b2753721e2b5245362c5e6b033cb
Add test for optional host argument in RedisBuffer
tests/sentry/buffer/redis/tests.py
tests/sentry/buffer/redis/tests.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import mock from sentry.buffer.redis import RedisBuffer from sentry.models import Group, Project from sentry.tasks.process_buffer import process_incr from tests.base import TestCase class RedisBufferTest(TestCase): def setUp(self): self.buf...
# -*- coding: utf-8 -*- from __future__ import absolute_import import mock from sentry.buffer.redis import RedisBuffer from sentry.models import Group, Project from sentry.tasks.process_buffer import process_incr from tests.base import TestCase class RedisBufferTest(TestCase): def setUp(self): self.buf...
Python
0
e7faa99d9816745338ada38d1a7d974bf3a739ae
Create pretty table of tie averages + function for pretty averages
s5v3.py
s5v3.py
from s5v2 import * from prettytable import PrettyTable def my_table(): # no arguments are passed in, which seems a bit weird. We're hard-coding a function that only does one thing. x = PrettyTable(['Style', 'Average Price']) # setup a new pretty table list and give and give it two list items x.add_row(['Print', pret...
Python
0.000004
dd9c96c7b12221029b7ea1a4f9748106520bd7a6
add syntax checker/linter/gotype support
gslint.py
gslint.py
import sublime, sublime_plugin import gscommon as gs import re, threading LINE_PAT = re.compile(r':(\d+):(\d+):\s+(.+)\s*$', re.MULTILINE) class GsLint(sublime_plugin.EventListener): rc = 0 errors = {} def on_selection_modified(self, view): sel = view.sel()[0].begin() if view.score_select...
Python
0
0e681d5b5e0d23517a6f050d168e1e86de9eb074
Add unit test for utils.termcolor (closes #4)
test/t_utils/test_termcolor.py
test/t_utils/test_termcolor.py
# -*- coding: utf-8 -*- """ test.t_utils.test_termcolor ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2014 by the RootForum.org team, see AUTHORS. :license: MIT License, see LICENSE for details. """ from unittest import TestCase from magrathea.utils.termcolor import supports_color class TestMagra...
Python
0
9b2166c62b312baf7769279ca56b02eca3ea0078
check host smallRNA end point
lib/SmallRNA/smallRNAEndPosition.py
lib/SmallRNA/smallRNAEndPosition.py
import sys import gzip import os import logging import argparse import re from Bio import SeqIO from Bio.Seq import Seq from CountXmlUtils import readCountXmlFeatures from Feature import FeatureItem, FeatureGroup from audioop import reverse DEBUG = 1 if DEBUG: #inputFile="/scratch/cqs/shengq2/vickers...
Python
0
6aa2621afd8253036834f48da6562c25deed54ec
Add tests
test_pe.py
test_pe.py
#!/usr/bin/env python import unittest import pe class TestGapBuffer(unittest.TestCase): def setUp(self): # correct content for each typecode self.valid_content = { "c": str("abc"), "b": [0, 1, 2], "B": [0, 1, 2], "u": unicode("abc"), "h":...
Python
0.000001
a48c52ccb6e89edbc186e4e916b8151ff0fa232f
Add an admin
sendgrid_events/admin.py
sendgrid_events/admin.py
from django.contrib import admin from .models import Event admin.site.register(Event, list_display=["kind", "email", "created_at"], list_filter=["created_at", "kind"], search_fields=["email", "data"])
Python
0
601b55aca479befbdc77ea65c4c3936c81f0e92a
Fix Travis CI Paths
tests/test_html_builder.py
tests/test_html_builder.py
import os import sys import unittest try: sys.path.insert(0, os.path.abspath('..')) #Works for local from sheetmaker import html_builder from data import test_html_constants except: sys.path.insert(0, os.path.abspath('.')) #Works for Travis CI from sheetmaker import html_builder from data impo...
import os import sys import unittest try: sys.path.insert(0, os.path.abspath('..')) #Works for local from sheetmaker import html_builder from data import test_html_constants except: from sheetmaker import html_builder #Works for Travis CI from data import test_html_constants class HtmlBuilderTes...
Python
0.000003
ad59ee2bce3e0de3e6fce9647a0ae7faa33e6135
Create testGame.py
Testes/testGame.py
Testes/testGame.py
import sys # Adicionar o caminho do MAP FACTORY sys.path.insert(0, '../Modelos/') sys.path.insert(0, '../Modelos/Mapa/') from Game import * from Map import * from MapFactory import * import json """ Metodo principal para rodar o cliente """ if __name__ == "__main__": fct = MapFactory() with open('../Recursos/M...
Python
0.000001
3a7459f0f9e171954eb1f86a9e320ef889b9d1a5
Tidy up and en-repo my little monitor
watch_emotes.py
watch_emotes.py
import sys import time import pprint import subprocess import requests sys.path.append("../mustard-mine") import config emote_count = None while emote_count is None or emote_count == len(emotes): req = requests.get("https://api.twitch.tv/kraken/chat/emoticon_images?emotesets=317117,317121,317122", headers={...
Python
0
5e5e74e606d9be3c60fb810ed215dfa109a6ad9f
fix #5 wavファイルを生成する処理を行うクラスを定義
libs/audio/create.py
libs/audio/create.py
import wave import struct from pylab import * """ 振幅amp、基本周波数frq、サンプリング周波数 fs、 ビット深度bit_depthbit、長さlength秒の正弦波を作成して返す """ def createSineWave(amp, frq, fs, bit_depth, length) : data = [] clip_hi = 1.0 clip_lo = -1.0 #正規化した波を整数値に変換する時の倍率 mult_bit = 0 if bit_depth == 16 : mult_bit = 32767.0 ...
Python
0
acda4ae5deff6b45f56b84cdecb867a09586af4a
Add lc295_find_median_from_data_stream.py
lc295_find_median_from_data_stream.py
lc295_find_median_from_data_stream.py
"""Leetcode 295. Find Median from Data Stream Hard URL: https://leetcode.com/problems/find-median-from-data-stream/ Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. For example, [2,3,4], the median i...
Python
0.000084
e2a47d1ef44aa6b0ccc294aae68babd8ca54eb22
Create search_log_files.py
search_log_files.py
search_log_files.py
#!/usr/bin/env python import os.path #Author: Sumit Joshi #date:5/12/2015 # Log File Search Script # This Script is useful for searching specific keyword in log files. For specific keyword it returns matching lines. print "*******************************************************" print "" print "" print "Welcome to t...
Python
0.000003
ae90cf26caa471f85d7e5e20ef2e349b78183f41
make python2 wokr
python/static_dependencies/__init__.py
python/static_dependencies/__init__.py
__all__ = ['ecdsa']
Python
0.999998
40421dfe33f422b3117652dfbec5861a9c62136c
Migration to fix past mistakes
every_election/apps/elections/migrations/0056_cleanup_group_types.py
every_election/apps/elections/migrations/0056_cleanup_group_types.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations group_type_map = { # These mayoral elections all have group_type='organisation', but they should # be None to bring them into line with the current convention for mayor/pcc "mayor.west-of-england.2017-05-04":...
Python
0.999077
54250baa4e2a34146506693b2da683ded2ee7cdb
add fake client ability that performs all required API calls
mender/cli/client.py
mender/cli/client.py
# The MIT License (MIT) # # Copyright (c) 2016 Gregorio Di Stefano # # 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, including without limitation the rights # to use, cop...
Python
0
ffff66e05210b638bf792fcc61dc2ff4fe841ad0
Create a new customized benders test file
tests/testcustomizedbenders.py
tests/testcustomizedbenders.py
""" flp-benders.py: model for solving the capacitated facility location problem using Benders' decomposition minimize the total (weighted) travel cost from n customers to some facilities with fixed costs and capacities. Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ from pyscipopt import Model, quicksu...
Python
0
5dc22c0a30b2e326665f67df1d85cd2ae0243c00
Increase the sleep timeout to 4 seconds to prevent the main thread from quitting
resources/site-packages/pulsar/main.py
resources/site-packages/pulsar/main.py
import threading import xbmc from pulsar.rpc import server_thread from pulsar.monitor import PulsarMonitor from pulsar.daemon import pulsard_thread def main(): # Make sure the XBMC jsonrpc server is started. xbmc.startServer(xbmc.SERVER_JSONRPCSERVER, True) # Start the JSONRPC thread threading.Thread...
import threading import xbmc from pulsar.rpc import server_thread from pulsar.monitor import PulsarMonitor from pulsar.daemon import pulsard_thread def main(): # Make sure the XBMC jsonrpc server is started. xbmc.startServer(xbmc.SERVER_JSONRPCSERVER, True) # Start the JSONRPC thread threading.Thread...
Python
0
3352646b1cc03c5f6ba2c6c9478d5bcc76099e7b
publication date can be null
activities/migrations/0024_null_publication_date.py
activities/migrations/0024_null_publication_date.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('activities', '0023_invitation'), ] operations = [ migrations.AlterField( model_name='invitation', na...
Python
0.999999
fe5100f5d13ed7461619c8beff791d40306f83ff
Remove annoying SQL view that prevents some operations
addons/document/migrations/8.0.2.1/pre-migration.py
addons/document/migrations/8.0.2.1/pre-migration.py
# -*- coding: utf-8 -*- ############################################################################## # # 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 version 3 of the # License...
Python
0
935115215259ce011f3f0b46781655119413e720
Add a directives file for pygments support.
pelican/rstdirectives.py
pelican/rstdirectives.py
# -*- coding: utf-8 -*- from docutils import nodes from docutils.parsers.rst import directives, Directive from pygments.formatters import HtmlFormatter from pygments import highlight from pygments.lexers import get_lexer_by_name, TextLexer INLINESTYLES = False DEFAULT = HtmlFormatter(noclasses=INLINESTYLES) VARIANTS =...
Python
0
1b22ec95ec7a659031e59b5a14d018028b29485b
Create hcf.py
math/highest_common_factor/cpp/hcf.py
math/highest_common_factor/cpp/hcf.py
#A python program to determine the highest common factor of positive integers only. def hcf(x, y): #set the highest common factor to 1 hcf = 1 #To check if one of the number is divisible by the other if x % y == 0: return y #iterate within half the range of one of the ...
Python
0.000001
3a6f724e7d31c1f42bfd426623dcaec3cdd642a8
add utils for multi gpus
multi_gpus.py
multi_gpus.py
import tensorflow as tf import numpy as np def average_gradients(tower_grads): """Calculate the average gradient for each shared variable across all towers. Note that this function provides a synchronization point across all towers. Args: tower_grads: List of lists of (gradient, variable) tuples. The outer...
Python
0
6463b8165f964dc7e068143d5e8b22a7e2f00ff5
Fix deCONZ change entity_id bug (#22974)
homeassistant/components/deconz/deconz_device.py
homeassistant/components/deconz/deconz_device.py
"""Base class for deCONZ devices.""" from homeassistant.core import callback from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import Entity from .const import DOMAIN as DECONZ_DOMAIN class Decon...
"""Base class for deCONZ devices.""" from homeassistant.core import callback from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import Entity from .const import DOMAIN as DECONZ_DOMAIN class Decon...
Python
0
a2ec630cde4e36cc391ac5eee560c8097c8ceab3
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
77b9961cbf6b4ce6d453bbc974b0c695308fdd83
add import script for Broxbourne (closes #1167)
polling_stations/apps/data_collection/management/commands/import_broxbourne.py
polling_stations/apps/data_collection/management/commands/import_broxbourne.py
from data_collection.management.commands import BaseDemocracyCountsCsvImporter class Command(BaseDemocracyCountsCsvImporter): council_id = 'E07000095' addresses_name = 'local.2018-05-03/Version 1/Democracy Club - Polling Districts-2018- Broxbourne.csv' stations_name = 'local.2018-05-03/Version 1/Democracy ...
Python
0
e8e8c20422248fa4c394efbe1b8f04adbc006674
Add lc0111_minimum_depth_of_binary_tree.py
lc0111_minimum_depth_of_binary_tree.py
lc0111_minimum_depth_of_binary_tree.py
"""Leetcode 111. Minimum Depth of Binary Tree Easy URL: https://leetcode.com/problems/minimum-depth-of-binary-tree/ Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no children....
Python
0.000032
312bbdefa256413b4891cd0e13e6ccf3c614541f
Add datetime header to Crank
util.py
util.py
""" util === Common utilities across the Crank system. """ from datetime import datetime DATETIME_FORMAT = '%Y %b %d @ %H%M' def get_timestamp_header(): return datetime.now().strftime(DATETIME_FORMAT)
Python
0
776efb9c76f29fa7e15066fa38d3fbb06f959e61
update 040.py
040_1.py
040_1.py
#! /usr/bin/python # 得到数字n的第bit位(从左起) def getNbit(n, bit): return int(str(n)[bit]) def cham(n): t = thresh() while 1: low, high, bit = t.next() if n <= high: #若t<high,则为此区间内 offset = n - low # 本区间内的偏移量 num = offset / bit + pow(10, bit - 1) #...
Python
0
49add5b219824e4f7d23e6cb75d930bdd11f41d7
Create script to build launchd installer pkgs
scripts/buildLaunchDPkg.py
scripts/buildLaunchDPkg.py
#!/usr/bin/python # buildLaunchDPkg.py # # # Created by Jacob F. Grant # # Written: 11/30/17 # Updated: 12/01/17 # """ buildLaunchDPkg Packages a launchd LaunchDaemon/LaunchAgent into a pkg file using the munkipkg tool. https://github.com/munki/munki-pkg """ # Import modules import sys import os import time ...
Python
0
a737acb0310c11618802ed8610cf8b7d3bafd543
Add Python EC2 example change_instance_security_groups.py
python/example_code/ec2/change_instance_security_groups.py
python/example_code/ec2/change_instance_security_groups.py
# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] # snippet-sourcedescription:[create_instance.py demonstrates how to create an Amazon EC2 instance.] # snippet-service:[ec2] # snippet-keyword:[Amazon Elastic Compute Cloud (Amazon EC2)] # snippet-keyword:[Python] # snippet-keyword:...
Python
0
713128bf6d5bb824f0ea9176d3d39ab1a44e8a95
add basic test script
scripts/team_basic_test.py
scripts/team_basic_test.py
#! /usr/bin/env python """ Basic test. Copyright (C) 2012 Jiri Pirko <jpirko@redhat.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (...
Python
0
c94de10cc97a4e948e2cf35f7b29cdf20c11f2ab
Add poisson sphere benchmark
convergence_tests/sphere_poisson.py
convergence_tests/sphere_poisson.py
from __future__ import absolute_import, division from firedrake import * import numpy as np def poisson_sphere(MeshClass, refinement, hdiv_space): """Test hybridizing lowest order mixed methods on a sphere.""" mesh = MeshClass(refinement_level=refinement) mesh.init_cell_orientations(Expression(("x[0]", "x...
Python
0.000039
e36e809699d387368d5c7edb478961c04692787f
Create BlockSelection.py
Documents/GitHub/BlockSelection.py
Documents/GitHub/BlockSelection.py
import pygame import random BLACK = ( 0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) class Block(pygame.sprite.Sprite): def __init__(self, color, width, height): super(Block, self).__init__() self.image = pygame.Surface([width, height]) self.image.fill(color) self...
Python
0
10c83fbc01dee9d95290466338f262abffc12a3e
Create a folder in a datacenter if not exists
samples/create_folder_in_datacenter.py
samples/create_folder_in_datacenter.py
#!/usr/bin/env python """ Written by Chinmaya Bharadwaj Github: https://github.com/chinmayb/ Email: acbharadwaj@gmail.com Create a folder in a datacenter """ from __future__ import print_function from pyVmomi import vim from pyVim.connect import SmartConnect, Disconnect import argparse import atexit import getpass ...
Python
0.000001
7a781a7cb9da6ab585f9b2ea72df991b4def19dd
Write entry/Preparations list test
whats_fresh/whats_fresh_api/tests/views/entry/test_list_preparations.py
whats_fresh/whats_fresh_api/tests/views/entry/test_list_preparations.py
from django.test import TestCase from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class ListPreparationTestCase(TestCase): fixtures = ['test_fixtures'] def test_url_endpoint(self): url = reverse('entry-list-preparat...
Python
0
e0344625a6a2b9640481622a12c4dd810f5ca4c5
merge overlapping pairs (set BQ to 0)
bam-merge-pairs.py
bam-merge-pairs.py
""" In order to avoid double counting of bases in overlapping paired end reads, this script accept mapped reads in SAM format, use the position to determine overlap, and set the lower base-quality of pair overlap to 0. It is assumed that the reads are name-sorted as when they come from the aligner. Usage: bwa mem...
Python
0
6f9f87ec8fe3d19de7b995288fa799e36a5c50d5
add mont test
tools/harness/tests/tommath.py
tools/harness/tests/tommath.py
########################################################################## # Copyright (c) 2016, ETH Zurich. # All rights reserved. # # This file is distributed under the terms in the attached LICENSE file. # If you do not find this file, copies can be found by writing to: # ETH Zurich D-INFK, Universitaetsstrasse 4, C...
Python
0
a26ba96db8ac3149e457f2eaab0ef55e2b68d4cb
add 114
python/114_flatten_binary_tree_to_linked_list.py
python/114_flatten_binary_tree_to_linked_list.py
""" Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 \ 3 \ 4 \ 5 \ 6 Hints: If yo...
Python
0.999996
c05d1d511f544d5480d064614c5fe64a6d740c1d
move DF API to dlframe (#2269)
python/test/bigdl/dlframes/test_dl_classifier.py
python/test/bigdl/dlframes/test_dl_classifier.py
# # Copyright 2016 The BigDL Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
Python
0
85f67084f44419bf9d44439133314e6ffdadfea0
Introduce OvnNbctlDaemonContext
rally_ovs/plugins/ovs/context/ovnnbctl_daemon.py
rally_ovs/plugins/ovs/context/ovnnbctl_daemon.py
# Copyright 2020 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 agreed to in writing, ...
Python
0
ce44189d905f783b3963ac71057fe201f52faf64
Add new sample
detect_face/detect_face_video_swap.py
detect_face/detect_face_video_swap.py
# coding:utf-8 import cv2 cap = cv2.VideoCapture(0) cascade_path = "../opencv/data/haarcascades/haarcascade_frontalface_default.xml" cascade = cv2.CascadeClassifier(cascade_path) _response, frame = cap.read() minsize = (int(frame.shape[0] * 0.08), int(frame.shape[1] * 0.08)) while True: _response, frame = cap.re...
Python
0
210133ea4a6dfd314470d8d08c6c6431fa12f7be
train svm classifier
process_ims/train_svm.py
process_ims/train_svm.py
from sklearn.svm import SVC from sklearn.cross_validation import train_test_split from sklearn.metrics import classification_report from sklearn.grid_search import GridSearchCV # load pca fit pcaFG = pk.load(open('pickle_files/pcaFG.pk', 'rb')) # load training data training_data = pk.load(open('pickle_files/training_d...
Python
0.999222
bbd732720fc25f5c47147c6f4c2c05ad1c180b35
Add api_subscribe_request.py
devicehive/api_subscribe_request.py
devicehive/api_subscribe_request.py
class ApiSubscribeRequest(object): """Api request class.""" def __init__(self, transport): self._transport = transport self._action = None self._request = {} self._params = {'method': 'GET', 'url': None, 'request_delete_keys': [], ...
Python
0.000008
f78a485000ef8dacb584db1f03b7157b79bd5fe7
Add module for mocking node.get() with Responses
d1_libclient_python/src/d1_client/tests/mock_get.py
d1_libclient_python/src/d1_client/tests/mock_get.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2016 DataONE # # Licensed under the Apache...
Python
0
ae05372f0a2f4b152fc700593e9a2b99612c9d69
create tag models manager tags via slug
tags/models.py
tags/models.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django.template.defaultfilters import slugify class Tag(models.Model): name = models.CharField(_(u'Name'), max_length=150, unique=True, db_index=True)...
Python
0
6e1d2ce723fbdf4f37147f1f1cb692c4fb705c12
handle cache file on disk
Cache.py
Cache.py
'''maintain a pickled cache file on disk''' import cPickle as pickle import os import pdb import time import unittest if False: # example class Cache(object): pass def read_data(dictionary): 'return the data; it will be pickled and written to the file at path_to_cache' return None ...
Python
0.000001
0287d807b8b03e5adf30e95c53504378f0bb2f8d
Add basic implementation
derivative.py
derivative.py
from __future__ import division class Dual(object): def __init__(self, a=0.0, b=0.0): self.a = a self.b = b def __add__(self, other): if isinstance(other, Dual): return Dual(self.a + other.a, self.b + other.b) else: return Dual(self.a + other, self.b) def __radd__(self, other): if isinstance(other...
Python
0.000002
8223e9ffa61a2772a7a6f52244c5f1bbde4956b8
Add py solution for 409. Longest Palindrome
py/longest-palindrome.py
py/longest-palindrome.py
from collections import Counter class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: int """ counter = Counter(s) odd = 0 ans = 0 for char, cnt in counter.iteritems(): if cnt % 2 == 0: ans += cnt ...
Python
0.998206
6b06a383a6a306991a601f2a862e8b2bdfba1615
Add a test to check that advanced filters data is fetched
akvo/rsr/tests/deployed_code_tests.py
akvo/rsr/tests/deployed_code_tests.py
# -*- coding: utf-8 -*- # Akvo RSR is covered by the GNU Affero General Public License. # See more details in the license.txt file located at the root folder of the # Akvo RSR module. For additional details on the GNU license please see < # http://www.gnu.org/licenses/agpl.html >. """Script to run tests using Browse...
Python
0
8223d62c22d4c4f7a66e1e468de53556796a03a9
Write a function that print something n times including relatives spaces
src/functions/exercise7.py
src/functions/exercise7.py
"""Module docstring. This serves as a long usage message. """ import sys import getopt def main(): # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) except getopt.error, msg: print msg print "for help use --help" sys.exit(2) # pro...
Python
0.999965
98c07739702fbf3951ccd0359d04be80a303d9ce
Add a fontname to TachyFont Jar file mapper.
run_time/src/gae_server/font_mapper.py
run_time/src/gae_server/font_mapper.py
""" Copyright 2014 Google Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
Python
0
4074c4fae998ac1bb6f49bb47b34f4890dc90532
Add integration tests for pylast.py
test_pylast.py
test_pylast.py
#!/usr/bin/env python """ Integration (not unit) tests for pylast.py """ import datetime import time import unittest import pylast class TestSequenceFunctions(unittest.TestCase): def setUp(self): self.username = "TODO" password_hash = "TODO" API_KEY = "TODO" API_SECRET = "TODO" ...
Python
0
52cf67258e5f1e6378fec2794cc3abb1d5b394e9
copia de serialCom sem a comunicacao serial
testeLogica.py
testeLogica.py
import serial import time ############################ def num(s): try: retorno = int(s) if retorno > 100 : return 100 if retorno < 0 : return 0 return int(s) except ValueError: return 0 ############################ porta = "COM3" velocidade = 9600 d...
Python
0
fb5ef2e7bf3b3315ab6491ec46dd97114162b7c6
Add tests directory and dummy objects for use in developing and running unit tests.
pywikibot/tests/dummy.py
pywikibot/tests/dummy.py
# -*- coding: utf-8 -*- """Dummy objects for use in unit tests.""" # # (C) Pywikipedia bot team, 2007 # # Distributed under the terms of the MIT license. # __version__ = '$Id: $' # add in any other attributes or methods that are needed for testing class TestSite(object): """Mimic a Site object.""" ...
Python
0
862016c070155fa44ed082a47d969ecacbba8aae
add TagAlias class (broken)
anormbookmarker/TagAlias.py
anormbookmarker/TagAlias.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # MIT License from sqlalchemy import Column #from sqlalchemy import ForeignKey #from sqlalchemy import UniqueConstraint #from sqlalchemy import CheckConstraint from sqlalchemy import Integer #from sqlalchemy import Unicode from sqlalchemy.orm import relationship #from sql...
Python
0
0dd2662d3aefe49a6a706461ca9b7a9fd1b380e8
add rotary_encoder.py from http://abyz.co.uk/rpi/pigpio/examples.html#Python code
pi/rotary_encoder.py
pi/rotary_encoder.py
#!/usr/bin/env python import pigpio class decoder: """Class to decode mechanical rotary encoder pulses.""" def __init__(self, pi, gpioA, gpioB, callback): """ Instantiate the class with the pi and gpios connected to rotary encoder contacts A and B. The common contact should be connec...
Python
0.000001
871a49b8d1e18c675cb7b5e6730cf8ebd4c56e36
Create q1.py
2013/q1.py
2013/q1.py
# A solution to the British Informatics Olympiad 2012 Question 1 from time import strftime, gmtime # number of minutes a = -1 # number of minutes b = 0 i = input() fast = [int(x) for x in i.split()] actual = 0 while a != b: if a == -1: a = 0 a = (a + 60 + fast[0]) % 1440 b = (b + 60 + fast[1])...
Python
0.000046
4785a42d218e75a49f9e5c270f159a17c7e22bcd
add count_clonotypes.py
count_clonotypes.py
count_clonotypes.py
import sys def count_clonotypes_in_files(link_path): def get_sequence(words): tmp = 0 res = '' try: tmp = float(words[2]) res = words[3] except Exception: res = words[2] if not res: print("Empty string in NUC!!!") return res global_sequences = {} local_sequences = {} sample_list = [] wi...
Python
0.000016
3def1498495e0abf230a3deb3873f6c502f3c6ad
Add management command for removing content rotation's settings on sections
molo/core/management/commands/remove_content_rotation_settings_from_sections.py
molo/core/management/commands/remove_content_rotation_settings_from_sections.py
from __future__ import absolute_import, unicode_literals from django.core.management.base import BaseCommand from molo.core.models import SectionPage class Command(BaseCommand): def handle(self, **options): SectionPage.objects.all().update( content_rotation_start_date=None, conten...
Python
0
17477cdc9ef7234037911664983d0ba5c9081513
add expect_column_values_url_has_got_valid_cert (#4648)
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_url_has_got_valid_cert.py
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_url_has_got_valid_cert.py
""" This is a template for creating custom ColumnMapExpectations. For detailed instructions on how to use it, please see: https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations """ import datetime import json import socket import ssl from...
Python
0
ea67a84c83fb11237383102c4c447f70c4b83e64
Add solution to 114.
114/114.py
114/114.py
""" A row measuring seven units in length has red blocks with a minimum length of three units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. There are exactly seventeen ways of doing this. How many ways can a row measuring fifty units ...
Python
0.000014
e67594c61ad6c317a60a3e3d6cd15d7e447649fc
373. Find K Pairs with Smallest Sums. Minheap
p373_heapq.py
p373_heapq.py
import heapq import unittest class Solution(object): def kSmallestPairs(self, nums1, nums2, k): """ :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]] """ if not nums1 or not nums2: return [] result = [] ...
Python
0.999999
d563e6aed8061d4e439bdad9ece1a9383d00cff2
add parse_wadl.py, a first attempt to parse this wadl
parse_wadl.py
parse_wadl.py
#!/usr/bin/env python import os import xml.parsers.expat filename = 'samples/cloud-images/wadl/image-2.0.wadl' def start_resource(name,attrs): print('start resource: ', attrs) def start_resources(name,attrs): print('start resources ', attrs) start_dispatch = { 'resource': start_resource, 'resources'...
Python
0.000002
656d65a484cc4319ba67e4e4bb4cee8adb37136a
copy from hadoop
copy_from_hadoop.py
copy_from_hadoop.py
import subprocess import argparse CMD_BASE = "hadoop fs -copyToLocal" ''' Script to experiment output files from hdfs to dst ''' def copy_from_hadoop(src, dst): p = subprocess.Popen(" ".join([CMD_BASE, src, dst]), shell=True, executable='/bin/bash') p.wait() if p.returncode != 0: ...
Python
0
fa60d9857b4412edf5f8f59fa5b65914ee38a279
add d18 (not working, too tired)
d18.py
d18.py
#!/bin/env python3 with open("d18.txt") as f: state1 = f.read().splitlines() for i in range(0, len(state1)): state1[i] = list(state1[i]) new_state = 2 dim_x = len(state1) dim_y = len(state1[0]) state2 = [["."]*(dim_y)]*(dim_x) def light_active(x, y): if new_state == 1: return state2[x][y] == "#...
Python
0.000002
a610154749d081e613b8bf58acf62af55958de9c
Automate the update of the version number in setup.py.
rev.py
rev.py
import fileinput import re import sys pattern = re.compile("\s*version='([0-9.]+)',") line = "" maj = "" min = "" ver = "" for line in fileinput.FileInput("setup.py", inplace=1): m = pattern.match(line) if m: version = m.groups()[0] maj, min, rev = version.split('.') line = line.re...
Python
0.000002
47a575a69b6a55cc188aa7ccecf9d15719efe405
Include base test class
tests/check.py
tests/check.py
from unittest import TestCase import os class Check(TestCase): __test__ = False @property def this_check(self): raise NotImplementedError def check(self, lst): if isinstance(lst, basestring): lst = [lst] errors = [] for text in lst: errors.ap...
Python
0
11c4fedc55a32f27b4aebd44cc03ba1f5d1e6357
add board_build_example
examples/build/board_build_example.py
examples/build/board_build_example.py
""" This file contains a general function to run the build for various boards. >> python example_build_boards.py --board=<board name> """ import argparse import rhea.build as build from rhea.build.boards import get_board from rhea.build.boards import get_all_board_names #from blink import blinky # some boards...
Python
0.000001
6138012dc3ce06250684edc641eb26d1beb3fc99
Add controller test code
experiments/python/controller_test.py
experiments/python/controller_test.py
# For getting an unbuffered write import sys # For getting the time import time # For threading import threading class ControllerInputListener(): def new_controller_input(self, controller_input, channel, value): raise NotImplementedError("new_controller_input(channel, value) not implements") class ControllerIn...
Python
0
4d579e832bb5c6b300ccd77859ea1fc6644f20c7
Create asda.py
asda.py
asda.py
sasd=2
Python
0.000009
0984e3d09e4520870e655b731fea92975884cf30
Add a script to run test.py in the build directory
msvc14/make-check.py
msvc14/make-check.py
""" Run Link Grammar Python scripts using the build target locations. This program sets PYTHONPATH and PATH, and uses Python2 or Python3 to run the script, as needed. This program is designed to run from this directory It reads Local.props in order to find Python's EXE location. It also generates relative PYT...
Python
0
4e2172b8bd0953fd706f6c11029f9e4cfeb55407
Add tests for the registry's root object's Component interface
tests/registryd/test_root_component.py
tests/registryd/test_root_component.py
import pytest import dbus COMPONENT_IFACE = 'org.a11y.atspi.Component' COORD_TYPE_WINDOW = 1 LAYER_WIDGET = 3 def test_contains(registry_root, session_manager): assert registry_root.Contains(0, 0, COORD_TYPE_WINDOW, dbus_interface=COMPONENT_IFACE) == False def test_get_accessible_at_point(registry_root, session...
Python
0
f7a1595e39eeb754290c62e9194868d98d9755f4
Add test for symbol selection
tests/symbols/test_symbol_selection.py
tests/symbols/test_symbol_selection.py
import pytest from tests.symbols import get_symbols from thinglang.compiler.errors import NoMatchingOverload from thinglang.compiler.references import Reference from thinglang.lexer.values.identifier import Identifier from thinglang.parser.values.named_access import NamedAccess from thinglang.symbols.argument_selector...
Python
0
08e6aa3410ef406ccdd0db452fbbb2762f137261
Revert "Use codecs.open() with utf-8"
cities_light/geonames.py
cities_light/geonames.py
from __future__ import unicode_literals import six import time import os import os.path import zipfile import logging try: from urllib.request import urlopen except ImportError: from urllib import urlopen from .settings import * class Geonames(object): logger = logging.getLogger('cities_light') de...
from __future__ import unicode_literals import six import codecs import time import os import os.path import zipfile import logging try: from urllib.request import urlopen except ImportError: from urllib import urlopen from .settings import * class Geonames(object): logger = logging.getLogger('cities_l...
Python
0
1ee1068d0203b591a734837d72f2f8a38c40399a
Add new project String -> MethodAndOperator.py
StartWithPython/StartWithPython/String/MethodAndOperator.py
StartWithPython/StartWithPython/String/MethodAndOperator.py
#STRING(2) print('\n\t\tSTRING(2)\t\t\n') user = 'Tuna' print(user[0]) # use it if you want a specif letter of a string print(user[1]) # ... print(user[2]) # ... print(user[3]) # ... print('') print(user[-1]) # ...if you want to start from the end print(user[-2]) # ... pri...
Python
0.000013
e9b2131da038c7e65dde33c04ee7c5888063827c
Add a test suite for json_marshal.bzl.
internal/common/json_marshal_test.bzl
internal/common/json_marshal_test.bzl
"""Unit tests for json marshaling. Note, this cannot live next to the file it tests, because that file is in third_party bazel rules, and bazel doesn't support skylark testing yet. """ load("//third_party/bazel_skylib/lib:unittest.bzl", "asserts", "unittest") load("//third_party/bazel_rules/rules_typescript/internal:...
Python
0.999991
698d838ed225f42c7acee40c564e0f15aefa16ef
Add code to support optional debugging
conpaas-director/cpsdirector/debug.py
conpaas-director/cpsdirector/debug.py
import sys from common import log class Debug: def __init__(self): self.level = 5; def set_level(self, l): self.level = l def get_level(self): return(self.level) def debug(self, level, txt): if self.get_level() >= level...
Python
0
5a8c8afee5e50a04f38d91745563842fc548cef8
add favorites to the admin
crate_project/apps/favorites/admin.py
crate_project/apps/favorites/admin.py
from django.contrib import admin from favorites.models import Favorite class FavoriteAdmin(admin.ModelAdmin): list_display = ["user", "package", "created", "modified"] list_filter = ["created", "modified"] search_fields = ["user__username", "package__name"] raw_id_fields = ["user", "package"] admin....
Python
0
6a0a99c856c1f52993db2d0471a5aead948dc403
Use correct attribute.
flocker/volume/script.py
flocker/volume/script.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """The command-line ``flocker-volume`` tool.""" import sys from twisted.python.usage import Options from twisted.python.filepath import FilePath from twisted.internet.defer import succeed from zope.interface import implementer from .service import ( ...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """The command-line ``flocker-volume`` tool.""" import sys from twisted.python.usage import Options from twisted.python.filepath import FilePath from twisted.internet.defer import succeed from zope.interface import implementer from .service import ( ...
Python
0.000001
cae06ce3f07cd241431baf792e5e3b9dbec04e6b
Create __init__.py
genes/docker/__init__.py
genes/docker/__init__.py
#Add
Python
0.000429
e5238b616f1a9be3fe5863e0aa9e9c118343df0f
add error wrapper to echo to stderr
DTError.py
DTError.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This software is under a BSD license. See LICENSE.txt for details. import sys _errors = [] def DTErrorMessage(fcn, msg): err_msg = "%s: %s" % (fcn, msg) _errors.append(err_msg) sys.stderr.write(err_msg + "\n") def DTSaveError(datafile, name): if len(...
Python
0.000001
0a6de323b3b878ca6e68c66c3a6b97d78aac65c5
Create LoginTest.py
LoginTest.py
LoginTest.py
#!/usr/bin/env python import urllib, urllib2 from datetime import datetime from dateutil.relativedelta import relativedelta from BeautifulSoup import BeautifulSoup #useragent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome_Scrape/33.0.1750.154' accountwww = 'https://account.tfl.g...
Python
0.000001
bd761bda5c01384870083ad750e59859c4a5b04a
add collector for http://hosts-file.net/
collectors/hosts-file.py
collectors/hosts-file.py
#!/usr/bin/python # -*- coding: utf-8 -*- import socket from time import gmtime, strftime import requests import ipwhois from pprint import pprint def get_url(url): try: res = requests.get(url) except requests.exceptions.ConnectionError: raise requests.exceptions.ConnectionError("DNS lookup f...
Python
0
233090aac7d71a1a8e0caf348b3d785bca15f69c
Create initial image.py file
derpibooru/image.py
derpibooru/image.py
# this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCH...
Python
0.000001
1eb9d5aff303ff920b4bacbeea0d1de6bab419d9
add bonuses solution SRM 145 DIV 1
Bonuses.py
Bonuses.py
from __future__ import division class Bonuses: def getDivision(self, points): bonuses = [] # calculate bonuses total = sum(points) extra = 0 for p in points: percent = p / total * 100 extra += percent % 1 bonuses.append(int(percent)) # award any extra points extra = round(extra) count = 1 a...
Python
0.000001