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
6d0933b2a068013c79e1a6aa24f4a3dd42a31af7
new package starting at 3.3 (#9173)
var/spack/repos/builtin/packages/steps/package.py
var/spack/repos/builtin/packages/steps/package.py
############################################################################## # Copyright (c) 2013-2018, 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.999995
7e5b4e178a5d36ca89034287168560a73bd9e63d
Create drivers.py
chips/sensor/lis3dh/drivers.py
chips/sensor/lis3dh/drivers.py
# This code has to be added to the corresponding __init__.py DRIVERS["lis3dh"] = ["LIS3DH"]
Python
0.000001
f342dbf8d9455db91286823ec5d6ef64e2ace68c
Create MCP3202.py
Other_Applications/Ultrasonic/MCP3202.py
Other_Applications/Ultrasonic/MCP3202.py
#!/usr/bin/python import RPi.GPIO as GPIO import time import datetime import os from time import strftime CS = 4 CS2 = 7 CLK = 11 MOSI = 10 MISO = 9 LDAC = 8 GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(CS, GPIO.OUT) GPIO.setup(CLK, GPIO.OUT) GPIO.setup(MOSI, GPIO.OUT) GPIO.setup(CS2, GPIO.OUT) GPIO.setu...
Python
0.000005
bfc8d1052ba6f1011fcdb882a825694acf98dd39
Add regression test for bug 1797580
nova/tests/functional/regressions/test_bug_1797580.py
nova/tests/functional/regressions/test_bug_1797580.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
5d514b33e28964b38aeb42a8dd5b93f3fc8ae239
Add functional regression test for bug 1806064
nova/tests/functional/regressions/test_bug_1806064.py
nova/tests/functional/regressions/test_bug_1806064.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.000001
64b842d0af6c4e07971a733d8ed6e70109e26979
Add sample logging
samples/sample_logging.py
samples/sample_logging.py
#!/usr/bin/env python # # Author: Ying Xiong. # Created: Dec 04, 2015. import logging import sys class DebugOrInfoFilter(logging.Filter): """Keep the record only if the level is debug or info.""" def filter(self, record): return record.levelno in (logging.DEBUG, logging.INFO) def config_logger(logger...
Python
0
a6fcf0fdc9a97773453f8ca17ddb071d1a2dfd79
hello world
contact/app.py
contact/app.py
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return "Hello world!" if __name__ == '__main__': app.run(host='0.0.0.0', debug=True)
Python
0.999981
4f0b6a6eefd6848a702fe4b808f137ef0b2ee2f8
rename as "config.py" after adding keys
exampleconfig.py
exampleconfig.py
URL_F = 'http://datamine.mta.info/mta_esi.php?key='KEY'&feed_id=21' URL_AC = 'http://datamine.mta.info/mta_esi.php?key='KEY'&feed_id=26'
Python
0.000047
85daad5401267b613e546896bb2abd1658f730b1
Create 1_triple_step.py
ch09/1_triple_step.py
ch09/1_triple_step.py
# 0 - (1) [0] # 1 - (1) [1] # 2 - (2) [1, 1], [2] # 3 - (4) [1, 1, 1], [1, 2], [2, 1], [3] # 4 - #subtract 1 #subtract 2 #subtract 3 ways = {0: 0, 1:1, 2: 2, 3: 4} def calculate_ways(steps): if steps < 4: return ways[steps] for i in range(4, steps + 1): ways[i] = ways[i-1] + ways[i-2] + way...
Python
0.000006
3e51c57a8611a8ebfb4f2eb045510c50587bd781
Test password tokens not in response
api/radar_api/tests/test_users.py
api/radar_api/tests/test_users.py
import json from radar_api.tests.fixtures import get_user def test_serialization(app): admin = get_user('admin') client = app.test_client() client.login(admin) response = client.get('/users') assert response.status_code == 200 data = json.loads(response.data) for user in data['data']...
Python
0.000001
3660767a92750eae3c3ede69ef6778a23d3074a7
Add the Action enum
wdim/client/actions.py
wdim/client/actions.py
import enum class Action(enum.Enum): create = 0 delete = 1 update = 2
Python
0.000001
71bab0603cbf52d6b443cfff85ef19a04f882a36
Add the SQL statements because I forgot
inventory_control/database/sql.py
inventory_control/database/sql.py
""" So this is where all the SQL commands live """ CREATE_SQL = """ CREATE TABLE component_type ( id INT PRIMARY KEY AUTO_INCREMENT, type VARCHAR(255) UNIQUE ); CREATE TABLE components ( id INT PRIMARY KEY AUTO_INCREMENT, sku TEXT, type INT, status INT, FOREIGN KEY (type) REFERENCES compo...
Python
0.000837
52076834e04fd735d4bba88472163c31347bc201
Create scarp_diffusion_no_component.py
scripts/diffusion/scarp_diffusion_no_component.py
scripts/diffusion/scarp_diffusion_no_component.py
#Import statements so that you will have access to the necessary methods import numpy from landlab import RasterModelGrid from landlab.plot.imshow import imshow_node_grid, imshow_core_node_grid from pylab import show, figure #Create a raster grid with 25 rows, 40 columns, and cell spacing of 10 m mg = RasterModelGrid(...
Python
0.000004
9d8278e98e505ffb68c2dcf870e61c0239721e5b
Add the gpio proxy for the Intel Edison
elpiwear/Edison/gpio.py
elpiwear/Edison/gpio.py
# The MIT License (MIT) # # Copyright (c) 2015 Frederic Jacob # # 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, copy, mo...
Python
0.000001
a49d28c552600ee2a0fe24ee83ed5cc7bbe36417
Add wrist tracker class
wristtracker.py
wristtracker.py
import math from markerutils import * class TrackedMarker(object): def __init__(self, marker, size, distance, position): self.marker = marker self.size = size self.distance = distance self.position = position class WristTracker(object): def __init__(self, marker_finder, marke...
Python
0
49716ea37b36785faeb4a8b1cb43e6225e6b1d82
add revised jobfile script for excalibur
genJobfile_ex.py
genJobfile_ex.py
#genJobfile.py """ more-or-less automated generation of PBS jobfile """ import argparse parser = argparse.ArgumentParser(prog="genJobfile.py", description="PBS Jobfile generation script.") parser.add_argument('jobfileName',type=str) parser.add_argument('jobName',type=str) parser.add_a...
Python
0
b056b3f9ccb3da86169fbbd7e12f33a9d1bc0828
Create gui_breathing.py
gui_breathing.py
gui_breathing.py
# -*- coding: utf-8 -*- """ Created on Fri Oct 02 22:27:03 2015 @author: William Herrera IMPORTANT: run as administrator Color breathing gui program for G20aj series PC """ import os import ctypes import threading import Tkinter as tki import ttk from tkColorChooser import askcolor import tkFileDialog as tkfd imp...
Python
0.000004
cbc1609758762c7db4d3477248e87ecf29fdd288
add dep
hilbert/common/__accessdata__.py
hilbert/common/__accessdata__.py
from sys import platform from platform import architecture def install_data_files(): """ """ if sys.platform.startswith('netbsd'): """ """ pass elif sys.platform.startswith('freebsd'): """ """ pass elif sys.platform.startswith('linux'): if PY3: data_...
Python
0.000001
dfe3f7fd7775ce13a670e1d27beddba5c1254a4a
Define the HPACK reference structure.
hyper/http20/hpack_structures.py
hyper/http20/hpack_structures.py
# -*- coding: utf-8 -*- """ hyper/http20/hpack_structures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Contains data structures used in hyper's HPACK implementation. """ class Reference(object): """ The reference object is essentially an object that 'points to' another object, not unlike a pointer in C or similar languag...
Python
0
5326519e69b1280ae53c02fa6e62ed6a9aa2db03
Create Ethiopia.py
holidays/countries/Ethiopia.py
holidays/countries/Ethiopia.py
# -*- coding: utf-8 -*- # python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Author: ryanss <ryanssdev@icl...
Python
0.000001
4df070d5b39898ca67127ef17aa8d80f47e2c992
Add files via upload
Embeddings_2_DNNClass_General.py
Embeddings_2_DNNClass_General.py
#All the imports. import gensim import codecs from gensim import corpora, models, similarities import nltk import csv import pandas as pd import tempfile import codecs import csv model = models.Word2Vec.load(input('Where are your word embeddings coming from, shitbags? ')) word = model.wv.vocab #Just some notes when ...
Python
0
37b1250e213b78262075664e4291707ff369e981
Create clase-3.py
Ene-Jun-2019/Ejemplos/clase-3.py
Ene-Jun-2019/Ejemplos/clase-3.py
diccionario = { 'a': ['accion', 'arte', 'arquitectura', 'agrego', 'actual'], 'b': ['bueno', 'bien', 'bonito'], 'c': ['casa', 'clase', 'coctel'] } diccionario['d'] = ['dado', 'diccionario', 'duda'] # print(diccionario) # print(diccionario['a']) for llave, valor in diccionario.items(): pass #print("sho...
Python
0.000002
48f2be780f6aa569bb1d8b8c0623e54cac49f613
add instance action model
core/models/instance_action.py
core/models/instance_action.py
from django.db import models class InstanceAction(models.Model): name = models.CharField(max_length=50) description = models.TextField() class Meta: db_table = 'instance_action' app_label = 'core'
Python
0.000001
78aaccb71fc64e52497abf0d0c768f3767a3d932
Update expenses status on database
fellowms/migrations/0020_auto_20160602_1607.py
fellowms/migrations/0020_auto_20160602_1607.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-06-02 16:07 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fellowms', '0019_auto_20160601_1512'), ] operations = [ migrations.AlterFiel...
Python
0
1c6b74129d6e6a815d73e2a935fc86755ffb4f8a
Improve sourcecode (issue #11 and #17).
imagedownloader/requester/api.py
imagedownloader/requester/api.py
from requester.models import AutomaticDownload from tastypie.authentication import SessionAuthentication from tastypie.resources import ModelResource class AutomaticDownloadResource(ModelResource): class Meta(object): queryset = AutomaticDownload.objects.all() resource_name = 'automatic_download' filtering =...
from requester.models import AutomaticDownload from tastypie import fields from tastypie.authentication import SessionAuthentication from tastypie.resources import ModelResource from libs.tastypie_polymorphic import ModelResource class AutomaticDownloadResource(ModelResource): class Meta(object): queryset = Auto...
Python
0
83965907ce548ca664afa81c1b6e6ed554332d4b
add evaluation_measures.py
evaluations_measures.py
evaluations_measures.py
#Copyright (c) 2014 Mitsuo YAMAMOTO(miyamamoto@d-itlab.co.jp) # Kato Makoto(kato@dl.kuis.kyoto-u.ac.jp) # #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.000003
65830295d30507e632a1a71c15083c0e58977c9c
add badchans.py, for honeypot purposes...
2.0/plugins/badchans.py
2.0/plugins/badchans.py
""" badchans.py - Kills unopered users when they join specified channels. """ from pylinkirc import utils, conf, world from pylinkirc.log import log REASON = "You have si" + "nned..." # XXX: config option def handle_join(irc, source, command, args): """ killonjoin JOIN listener. """ # Ignore our own ...
Python
0
e3ad95017bced8dac5474d6de5958decf4f58279
add migration file
corehq/apps/auditcare/migrations/0005_auditcaremigrationmeta.py
corehq/apps/auditcare/migrations/0005_auditcaremigrationmeta.py
# Generated by Django 2.2.24 on 2021-06-20 14:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auditcare', '0004_add_couch_id'), ] operations = [ migrations.CreateModel( name='AuditcareMigrationMeta', fields=[ ...
Python
0.000001
77a6100cbb45342d471d3d258b73c346bebacbbb
Add weather warnings
weather_warning.py
weather_warning.py
from bs4 import BeautifulSoup from urllib.request import Request, urlopen from settings import REGION_CODE, REGION_NAME from datetime import date class NoWarningsException(Exception): pass def get_weather_warning(): try: return WarningDetails(REGION_CODE, REGION_NAME) #get warning for London and South...
Python
0.999905
9c70a5d65b1c06f62751dfb4fcdd4d6a60a5eb71
Add unit tests for testing the widget tree iterators.
kivy/tests/test_widget_walk.py
kivy/tests/test_widget_walk.py
import unittest class FileWidgetWalk(unittest.TestCase): def test_walk_large_tree(self): from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.uix.widget import walk, walk_reverse ''' the tree BoxLayout BoxLayout Label ...
Python
0
989320c3f2bdf65eb8c22822f34052047e0d1a2b
Reorder array
Arrays/reorder_array.py
Arrays/reorder_array.py
""" Given two integer arrays of same size, arr[] and index[], reorder elements in arr[] according to given index array. Input: arr: 50 40 70 60 90 index: 3 0 4 1 2 Output: arr: 60 50 90 40 70 index: 0 1 2 3 4 """ """ Approach: 1. Do the following for every element arr[i] 2. While index[i] != i, store array and index v...
Python
0.00003
3a4de870ebefd0e3e32b8c1b9facee6c98ce8b7f
Convert python 2 version to python 3
ltk2to3.py
ltk2to3.py
import os import shutil import fnmatch def get_files(patterns): """ gets all files matching pattern from root pattern supports any unix shell-style wildcards (not same as RE) """ cwd = os.getcwd() if isinstance(patterns,str): patterns = [patterns] matched_files = [] for pattern in...
Python
0.999999
0babd53317322cea1a56cc8cacd6ffc417145c80
Add migration file.
django_project/realtime/migrations/0033_auto_20180202_0723.py
django_project/realtime/migrations/0033_auto_20180202_0723.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('realtime', '0032_auto_20180201_0947'), ] operations = [ migrations.AlterField( model_name='ash', nam...
Python
0
844049b0d4aecb25fc480fae37111e8aebac6438
Add mimeformats.py to support drag and drop
src/mcedit2/util/mimeformats.py
src/mcedit2/util/mimeformats.py
""" mimeformats """ from __future__ import absolute_import, division, print_function, unicode_literals import logging log = logging.getLogger(__name__) class MimeFormats(object): MapItem = "application/x-mcedit-mapitem"
Python
0
d2c99675bce99da0c0b77829081a805c0aa817be
add init evtxinfo.py
Evtx/evtxinfo.py
Evtx/evtxinfo.py
#!/bin/python # This file is part of python-evtx. # # Copyright 2012, 2013 Willi Ballenthin <william.ballenthin@mandiant.com> # while at Mandiant <http://www.mandiant.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance wit...
Python
0.000002
fa1223c661d60033b7d7aba2a27151d6ee18a299
Add tests for circle ci checks
tests/ci_checks/test_circle.py
tests/ci_checks/test_circle.py
import pytest from semantic_release import ci_checks from semantic_release.errors import CiVerificationError def test_circle_should_pass_if_branch_is_master_and_no_pr(monkeypatch): monkeypatch.setenv('CIRCLE_BRANCH', 'master') monkeypatch.setenv('CI_PULL_REQUEST', '') assert ci_checks.circle('master') ...
Python
0
6a50f602ebc2334d45352cd2ff13c1f91db7e0bd
Integrate LLVM at llvm/llvm-project@8e22539067d9
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "8e22539067d9376c4f808b25f543feba728d40c9" LLVM_SHA256 = "db0a7099e6e1eacbb51338f0b18c237be7354c25e8126c523390bef965a9b6f6" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "223261cbaa6b4c74cf9eebca3452ec0d15ea018e" LLVM_SHA256 = "8425d6458484c6e7502b4e393cd8d98b533826a3b040261d67261f1364936518" tf_http_archive( ...
Python
0.000003
bd729068b1683954ab190f187e59d8a5fc0741f1
Integrate LLVM at llvm/llvm-project@7ed7d4ccb899
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "7ed7d4ccb8991e2b5b95334b508f8cec2faee737" LLVM_SHA256 = "6584ccaffd5debc9fc1bb275a36af9bad319a7865abecf36f97cbe3c2da028d0" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "b109172d993edacd9853a8bbb8128a94da014399" LLVM_SHA256 = "36ee6bf7d89b43034c1c58c57aa63d0703d1688807480969dfd1f4d7ccaa3787" tf_http_archive( ...
Python
0.000004
e1fc8b6774c6283a8c4f81235f1a1d9dc10c5fc6
Add tSNE-script
tSNE-images.py
tSNE-images.py
# Copied with permission from https://github.com/ml4a/ml4a-ofx.git import argparse import sys import numpy as np import json import os from os.path import isfile, join import keras from keras.preprocessing import image from keras.applications.imagenet_utils import decode_predictions, preprocess_input from keras.models ...
Python
0.000001
f29dab9a82b44fac483d71c432a40a0bb2ca51b1
Add the beginnings of an example client.
examples/dbus_client.py
examples/dbus_client.py
import dbus bus = dbus.SystemBus() # This adds a signal match so that the client gets signals sent by Blivet1's # ObjectManager. These signals are used to notify clients of changes to the # managed objects (for blivet, this will be devices, formats, and actions). bus.add_match_string("type='signal',sender='com.redha...
Python
0
ebf4d87390307dcf735c53f18a18f3466a4ee5e4
Add standalone wave trigger tool.
tools/standalonewavetrigger.py
tools/standalonewavetrigger.py
#!/usr/bin/env python # Standard library imports import argparse import collections import logging import os import time # Additional library imports import requests # Named logger for this module _logger = logging.getLogger(__name__) # Parse the command line arguments _parser = argparse.ArgumentParser('') _parser...
Python
0
d76c7f73701edeb263ebffc94ccc3f4893f7ef0d
add leetcode Reorder List
leetcode/ReorderList/solution.py
leetcode/ReorderList/solution.py
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None def printList(self): head = self while head: print head, head = head.next print '' def __str__(self): return str(self.val) cl...
Python
0
27a177a9c03ca5e98f1997eae18d046875a17c3b
Create alias.py
HexChat/alias.py
HexChat/alias.py
import hexchat __module_name__ = "Alias" __module_author__ = "TingPing" __module_version__ = "0" __module_description__ = "Create aliases for commands" alias_hooks = {} help_cmds = ['alias', 'unalias', 'aliases'] help_msg = 'Alias: Valid commands are:\n \ ALIAS name command\n \ UNALIAS name\n \ ALIASE...
Python
0.000002
a86852fe908bb0a44ef267a75b9446ddcaf03f6e
Add basic support for LimitlessLED
homeassistant/components/light/limitlessled.py
homeassistant/components/light/limitlessled.py
""" homeassistant.components.light.limitlessled ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support for LimitlessLED bulbs, also known as... EasyBulb AppLight AppLamp MiLight LEDme dekolight iLight """ import random import logging from homeassistant.helpers.entity import ToggleEntity from homeassistant.const import STATE_O...
Python
0
8d1917785f4cf8cc17ec1b3898dcb90f7402cfe9
Revert of Attempt to add tracing dir into path, so that tracing_project can be imported. (patchset #1 id:1 of https://codereview.chromium.org/1300373002/ )
tracing/tracing_build/__init__.py
tracing/tracing_build/__init__.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. # import os import sys import tracing_project tracing_project.UpdateSysPathIfNeeded()
# 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. # import os import sys def _AddTracingProjectPath(): tracing_path = os.path.normpath( os.path.abspath(os.path.join(os.path.dirname(__file__), '....
Python
0.000007
4bc62bf69a3500c44bb0794ee4d11073b93a18a1
Add postgresql support for grab.spider cache backend
grab/spider/cache_backend/postgresql.py
grab/spider/cache_backend/postgresql.py
""" CacheItem interface: '_id': string, 'url': string, 'response_url': string, 'body': string, 'head': string, 'response_code': int, 'cookies': None,#grab.response.cookies, """ from __future__ import absolute_import from hashlib import sha1 import zlib import logging import psycopg2 from psycopg2.extensions import ISOL...
Python
0
b09a6fdd14e2e65bddd03bd11d14a20133f36f57
Create nad2wgs.py
nad2wgs.py
nad2wgs.py
#---------------------------- # NAD83 to WGS84 Converter # # Python Version # #---------------------------- # Adapted from Node-coordinator Project (https://github.com/beatgammit/node-coordinator) # # Original and this version released under MIT License (Provided below as per licensing) # # Copyright (c) 2...
Python
0.000006
37f286812bea7429bea67172a40d26ad435d6f67
Add test for 'holes' argument in add_polygon
test/examples/hole_in_square.py
test/examples/hole_in_square.py
#!/usr/bin/python # -*- coding: utf-8 -*- import pygmsh as pg import numpy as np def generate(): # Characteristic length lcar = 1e-1 # Coordinates of lower-left and upper-right vertices of a square domain xmin = 0.0 xmax = 5.0 ymin = 0.0 ymax = 5.0 # Vertices of a square hole squ...
Python
0.000004
db4bc200f9a48edf9e160c2134293df0313183a7
Add conditional command prefix plugin
conditional_prefix.py
conditional_prefix.py
from cloudbot import hook import re @hook.sieve def conditional_prefix(bot, event, plugin): if plugin.type == 'command': if event.chan in event.conn.config['prefix_blocked_channels']: command_prefix = event.conn.config['command_prefix'] if not event.chan.lower() == event.nick.lowe...
Python
0.000001
46977f4d36e09cccd5485352b27d1bac4d5b702a
Add unit tests for cmus module
tests/modules/test_cmus.py
tests/modules/test_cmus.py
# pylint: disable=C0103,C0111 import mock import unittest import tests.mocks as mocks from bumblebee.config import Config from bumblebee.input import I3BarInput, LEFT_MOUSE from bumblebee.modules.cmus import Module class TestCmusModule(unittest.TestCase): def setUp(self): self._stdin, self._select, self...
Python
0
cb7e900ee2feb8bb01539536b563f929e22be031
add VPC-SC system tests (#9272)
tests/system/test_vpcsc.py
tests/system/test_vpcsc.py
# -*- coding: utf-8 -*- # # Copyright 2019 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...
Python
0
450eb8aee6d3638d6a5211e6c5ae1fa8ff8d1b9b
Add unittests for SelectTask, ProcessStreamHandler
tests/tasks/test_select.py
tests/tasks/test_select.py
# Copyright (c) 2014, Facebook, Inc. All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. # from sparts.fileutils import set...
Python
0
a2ea7c7d4d6b680f180b9916eb2a814713887154
Test empty record.
tests/test_empty_record.py
tests/test_empty_record.py
#!/usr/bin/env python # Copyright 2016 Ben Walsh # # 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
cba5a8058e96bd6c5ee639df223c77f56d8296fa
Add ladot package (#10905)
var/spack/repos/builtin/packages/ladot/package.py
var/spack/repos/builtin/packages/ladot/package.py
# Copyright 2013-2019 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 Ladot(Package): """Ladot is a script that makes using LaTeX in graphs generated by dot ...
Python
0
02371d2ace7c366f0b0b6332010323d478bc7652
Add new package nlopt (#6499)
var/spack/repos/builtin/packages/nlopt/package.py
var/spack/repos/builtin/packages/nlopt/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
152bf235721c5b6c8ba61da4d8521733a2842885
Send script
extract_norcal_table.py
extract_norcal_table.py
import urllib2 from bs4 import BeautifulSoup url = "http://www.mapsofworld.com/usa/states/california/map-of-northern- california.html" page = urllib2.urlopen(url) soup = BeautifulSoup(page) tables = soup.findAll("table") tables[3].find_all('td') for td in tables[3].find_all('td'): print ...
Python
0
32c95175538b4324f1cf6b21a2c3bd5d2cb29413
Add product type test
tests/Product_type_unit_test.py
tests/Product_type_unit_test.py
from selenium import webdriver from selenium.webdriver.support.ui import Select import unittest import re import sys class ProductTest(unittest.TestCase): def setUp(self): # change path of chromedriver according to which directory you have chromedriver. self.driver = webdriver.Chrome('/home/dr3dd/...
Python
0.000005
a7ef2b03ad23c9b76274d114ad6edc628b73b691
Create RiskSimulator.py
RiskSimulator.py
RiskSimulator.py
## #Name: Sam Kantor #Assignment: Risk simulator # ## import random TeamARolls = [] TeamBRolls = [] TeamA_Attacking = False TeamB_Attacking = False TeamA_LostMen = 0 TeamB_LostMen = 0 keepGoing = True class Team: def __init__ (self): while True: try: self.amount = int(inpu...
Python
0
b80e52ecf09f96e84625eb6fff9aa7a20059c0f8
Add new top level script to ease running of individual unittests.
test_single.py
test_single.py
import sys import unittest from toast.mpirunner import MPITestRunner file = sys.argv[1] loader = unittest.TestLoader() runner = MPITestRunner(verbosity=2) suite = loader.discover('tests', pattern='{}'.format(file), top_level_dir='.') runner.run(suite)
Python
0
2ae235215d33555b077fbd9e2f0c42d52ccce8c4
add listener
dyn-listener.py
dyn-listener.py
#!/usr/bin/env python from logentries import LogentriesHandler import logging from flask import Flask, jsonify, request listener = Flask(__name__) # Configure the port your postback URL will listen on and provide your # LOGENTRIES_TOKEN PORT = 5000 LOGENTRIES_TOKEN = "your-log-token-here" log = logging.getLogger('l...
Python
0
abc32403d85c536f38a2072941f1864418c55b4f
Create editdistance.py
editdistance.py
editdistance.py
# Author: Vikram Raman # Date: 09-12-2015 import time # edit distance between two strings # e(i,j) = min (1 + e(i-1,j) | 1 + e(i,j-1) | diff(i,j) + e(i-1,j-1)) def editdistance(s1, s2): m = 0 if s1 is None else len(s1) n = 0 if s2 is None else len(s2) if m == 0: return n elif n == 0: ...
Python
0
2435d04f7972df5433c35112127e3d06d6631edc
Add tool-replay.py
tool-replay.py
tool-replay.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2010 Jérémie DECOCK (http://www.jdhp.org) import sys import os import shutil import getopt from pyarm import fig from pyarm import clock as clock_mod # Lionel's old format COMMAND_SLICE = slice(8, 14) ANGLES_SLICE = slice(2, 4) VELOCITIES_SLICE = slice(0...
Python
0.000001
f79e0782235943e0ace543db754cca232682f6ad
Add some basic tests
km3pipe/io/tests/test_aanet.py
km3pipe/io/tests/test_aanet.py
# Filename: test_aanet.py # pylint: disable=locally-disabled,C0111,R0904,C0301,C0103,W0212 from km3pipe.testing import TestCase, patch, Mock from km3pipe.io.aanet import AanetPump import sys sys.modules['ROOT'] = Mock() sys.modules['aa'] = Mock() __author__ = "Tamas Gal" __copyright__ = "Copyright 2018, Tamas Gal and...
Python
0.000012
9f39ed48b6f745a96b5874bc87e306c01d3f016f
add 0.py
0.py
0.py
if __name__ == "__main__": print 2**38
Python
0.999328
0575be4316e930de71dce8c92d7be428d4565470
Add c.py
c.py
c.py
class C(object): def c(self): print("c") C().c()
Python
0.997858
61cfa59b7881f8658a8eab13ba4bc50ac17ba6ce
Add sample plugin used by functional tests
nose2/tests/functional/support/lib/plugin_a.py
nose2/tests/functional/support/lib/plugin_a.py
from nose2 import events class PluginA(events.Plugin): configSection = 'a' def __init__(self): self.a = self.config.as_int('a', 0)
Python
0
0fd71a51f9c90ca6fe405f1d0040c696504fb38c
Create Image_Preprocessing_Class.py
octoprint_OctoPNP/Image_Preprocessing_Class.py
octoprint_OctoPNP/Image_Preprocessing_Class.py
# -*- coding: utf-8 -*- """ Created on Tue Feb 17 02:12:51 2015 @author: soubarna """ import cv2 import numpy as np #import scipy.signal as sig #from matplotlib import pyplot as plt class Image_Preprocessing: def __init__(self,img_input): self.img=img_input def boundary_detect(self): ...
Python
0.000002
2e6c7235c555799cc9dbb9d1fa7faeab4557ac13
Add stubby saved roll class
db.py
db.py
import sqlite3 connection = sqlite3.connect('data.db') class SavedRoll: @staticmethod def save(user, name, args): pass @staticmethod def get(user, name): pass @staticmethod def delete(user, name): pass
Python
0
85044ad914029d9b421b3492e828ad89a85b62a3
Create ept.py
ept.py
ept.py
# -*- coding: utf-8 -*- from TorCtl import TorCtl import requests,json proxies = {'http': 'socks5://127.0.0.1:9050','https': 'socks5://127.0.0.1:9050'} class TorProxy(object): def __init__(self,): pass def connect(self, url, method): r = getattr(requests, method)(url,proxies=proxies) return r def new_ip(s...
Python
0.000002
062473c20e59f259d38edcd79e22d0d215b8f52f
Add file to store API Access keys
key.py
key.py
consumer_key = '' # Enter your values here consumer_secret = '' # Enter your values here access_token = '' # Enter your values here access_token_secret = '' # Enter your values here
Python
0.000001
49b8f4b50ea1ff8c62977699c8e568a6d8d14887
Create obs.py
obs.py
obs.py
import numpy as np from pydelft.read_griddep import grd, dep from PyQt4 import QtGui import mpl_toolkits.basemap.pyproj as pyproj import mpl_toolkits.basemap as Basemap #------------------------------------------------------------------------------ # OBS SAVE FILE DIALOG class SaveObsFileDialog(QtGui.QMainWindow): ...
Python
0
7f3411268e153c47edc77c681e14aef5747639de
use the subdir /httplib2, follow up for 10273
pwb.py
pwb.py
import sys,os sys.path.append('.') sys.path.append('externals/httplib2') sys.path.append('pywikibot/compat') if "PYWIKIBOT2_DIR" not in os.environ: os.environ["PYWIKIBOT2_DIR"] = os.path.split(__file__)[0] sys.argv.pop(0) if len(sys.argv) > 0: if not os.path.exists(sys.argv[0]): testpath = ...
import sys,os sys.path.append('.') sys.path.append('externals') sys.path.append('pywikibot/compat') if "PYWIKIBOT2_DIR" not in os.environ: os.environ["PYWIKIBOT2_DIR"] = os.path.split(__file__)[0] sys.argv.pop(0) if len(sys.argv) > 0: if not os.path.exists(sys.argv[0]): testpath = os.path.j...
Python
0
81c722316d75e929d120f4d7139c499052a4e2fb
add cli program
cli.py
cli.py
#!/usr/bin/env python # -*- codeing: utf-8 -*- import socket import logging import json LOG = logging.getLogger('DynamicLoadCmd') def main(): sc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sc.connect(('127.0.0.1', 10807)) while True: line = raw_input('(ryu) ') if line == 'e...
Python
0
4f08f057c7e4cc8230a996d853892ab3eef36065
Add simple terminal-based version of rock-paper-scissors.
rps.py
rps.py
from random import choice class RPSGame: shapes = ['rock', 'paper', 'scissors'] draws = [('rock', 'rock'), ('paper', 'paper'), ('scissors', 'scissors')] first_wins = [('rock', 'scissors'), ('scissors', 'paper'), ('paper', 'rock')] def _evaluate(self, player_move, computer_move): if (player...
Python
0
024b9dbfb3e34b5ff092ad86a1bec1e82ccfb9f9
Convert tests/test_elsewhere_twitter.py to use Harness & TestClient.
tests/test_elsewhere_twitter.py
tests/test_elsewhere_twitter.py
from gittip.elsewhere import twitter from gittip.models import Elsewhere from gittip.testing import Harness class TestElsewhereTwitter(Harness): def test_twitter_resolve_resolves(self): alice = self.make_participant('alice') alice_on_twitter = Elsewhere(platform='twitter', user_id="1", ...
from gittip.testing import tip_graph from gittip.elsewhere import twitter def test_twitter_resolve_resolves(): with tip_graph(('alice', 'bob', 1, True, False, False, "twitter", "2345")): expected = 'alice' actual = twitter.resolve(u'alice') assert actual == expected, actual
Python
0
3739819ed85a03520ad3152a569ad6cfb3dd7fb5
Add a used test.
lib/tagnews/tests/test_crimetype_tag.py
lib/tagnews/tests/test_crimetype_tag.py
import tagnews class TestCrimetype(): @classmethod def setup_method(cls): cls.model = tagnews.CrimeTags() def test_tagtext(self): self.model.tagtext('This is example article text') def test_tagtext_proba(self): article = 'Murder afoul, someone has been shot!' probs =...
Python
0.000001
edc335e68d44c6a0c99499bc4416c55a6072232e
add proper test for govobj stuff
test/test_governance_methods.py
test/test_governance_methods.py
import pytest import os os.environ['SENTINEL_ENV'] = 'test' import sys sys.path.append( os.path.join( os.path.dirname(__file__), '..', 'lib' ) ) # NGM/TODO: setup both Proposal and Superblock, and insert related rows, # including Events def setup(): pass #this is doog. def teardown(): pass #you SON O...
Python
0
8c49123ccaf16a4513f8096475dd2b865cfee66f
Revert of Re-enable mobile memory tests. (https://codereview.chromium.org/414473002/)
tools/perf/benchmarks/memory.py
tools/perf/benchmarks/memory.py
# Copyright 2013 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 measurements import memory import page_sets from telemetry import benchmark @benchmark.Disabled('android') # crbug.com/370977 class MemoryMobile(benc...
# Copyright 2013 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 measurements import memory import page_sets from telemetry import benchmark class MemoryMobile(benchmark.Benchmark): test = memory.Memory page_set...
Python
0.000018
d36310c6316379086faaf6a29c0392a6ff5ab465
Simple sentence parser with a defined CFG
Natural_Language_Processing/simple_parser.py
Natural_Language_Processing/simple_parser.py
import nltk from nltk import CFG grammar1 = CFG.fromstring(""" S -> NP VP VP -> V NP | V NP PP PP -> P NP V -> "saw" | "ate" | "walked" NP -> "John" | "Mary" | "Bob" | Det N | Det N PP | N Det -> "a" | "an" | "the" | "my" N -> "man" | "dog" | "cat" | "telescope" | "park" P -> "in" | "on" | "by" | "with" """) sent = "...
Python
0.997157
baff0200dfbe5ac33949f2fa3cddca72912b3b09
add results.py
epac/results.py
epac/results.py
# -*- coding: utf-8 -*- """ Created on Fri May 17 16:37:54 2013 @author: edouard.duchesnay@cea.fr """ class Results(dict): TRAIN = "tr" TEST = "te" SCORE = "score" PRED = "pred" TRUE = "true" SEP = "_" def __init__(self, **kwargs): if kwargs: self.add(**kwargs) d...
Python
0.000001
553ba87b8858c11b2c2778d35a3c6e3694304278
create the Spider of Turkey of McDonalds
locations/spiders/mcdonalds_tr.py
locations/spiders/mcdonalds_tr.py
# -*- coding: utf-8 -*- import scrapy import json import re from locations.items import GeojsonPointItem class McDonaldsTRSpider(scrapy.Spider): name = 'mcdonalds_tr' allowed_domains = ['www.mcdonalds.com.tr'] def start_requests(self): url = 'https://www.mcdonalds.com.tr/Content/WebService...
Python
0
8d3067870d68f2f6a8b60afdee62ba29231c3277
put together galaxy selection information (#42)
galdata/combine_info.py
galdata/combine_info.py
import pyfits import numpy as np import matplotlib.pyplot as plt import os # define filenames, etc. cat_file_name = '/Users/rmandelb/great3/data-23.5/real_galaxy_catalog_23.5.fits' fit_file_name = '/Users/rmandelb/great3/data-23.5/real_galaxy_catalog_23.5_fits.fits' shape_file_name = 'real_galaxy_23.5_shapes.fits' pro...
Python
0
0c100408bce925392ee1cae3b5b201ab4eb15112
Add tests for VirHostNet processor
indra/tests/test_virhostnet.py
indra/tests/test_virhostnet.py
from indra.statements import Complex from indra.sources import virhostnet from indra.sources.virhostnet.api import data_columns from indra.sources.virhostnet.processor import parse_psi_mi, parse_source_ids, \ parse_text_refs, get_agent_from_grounding, process_row def test_get_agent_from_grounding(): ag = get_...
Python
0
fab191fa1c490e8fb494417ba33e8f41c8ae4fec
Add a slice viewer widget class.
ui/widgets/SliceViewerWidget.py
ui/widgets/SliceViewerWidget.py
""" SliceViewerWidget :Authors: Berend Klein Haneveld """ from vtk import vtkRenderer from vtk import vtkInteractorStyleUser from vtk import vtkImagePlaneWidget from vtk import vtkCellPicker from PySide.QtGui import QGridLayout from PySide.QtGui import QWidget from PySide.QtCore import Signal from ui.QVTKRenderWindo...
Python
0
0fef9ab4e7a70a5e53cf5e5ae91d7cc5fd8b91da
Create xml_grabber.py
grabbing/xml_grabber.py
grabbing/xml_grabber.py
"""XML TYPE <?xml version="1.0" encoding="utf-8"?> <rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> <channel> <title>Q Blog</title> <link>http://agus.appdev.my.id/feed/</link> <description>Latest Posts of Q</description> <atom:link href="http://agus.appdev.my.id/feed/" rel="self"></atom:link> <la...
Python
0.000008
8fded9a735f40c4d4503ae01f1f5bb9592226bf6
Add script to synchronize photos and poses from the 2019 porto IR dataset
python/fire_rs/neptus_mission_analysis.py
python/fire_rs/neptus_mission_analysis.py
# Copyright (c) 2019, CNRS-LAAS # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the...
Python
0
6b6f7d225633e9c6bd406de695a1e52ce830a14e
Create feature_util.py
feature_util.py
feature_util.py
''' Contains methods to extract features for training '''
Python
0.000001
88ff76fbc9275a327e016e9aef09d4ab2c3647e9
test setup
Classes/test_Classes/test_State.py
Classes/test_Classes/test_State.py
"""Attribute System unit tests.""" import pytest from ..State import State
Python
0.000001
ae86eb3f7a3d7b2a8289f30c8d3d312c459710fb
update code laplacian article
assets/codes/laplacian_filter.py
assets/codes/laplacian_filter.py
import cv2 import numpy as np from PIL import Image image = cv2.imread("output.jpg") gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) laplacian0 = np.array(([0, 1, 0], [1, -4, 1], [0, 1, 0]), dtype="int") laplacian1 = np.array(([1, 1, 1], [1, -8, 1], ...
Python
0
d892914381a3067fdd04d6d0af0aceda0c092039
test staff
staff/tests/test_staff.py
staff/tests/test_staff.py
"""Test sending emails.""" from happening.tests import TestCase from model_mommy import mommy from django.conf import settings class TestStaff(TestCase): """Test staff views.""" def setUp(self): """Set up users.""" self.user = mommy.make(settings.AUTH_USER_MODEL, is_staff=True) self...
Python
0.000005
a193f1d9b1816f72661254bba69c2c4a1e2c1b30
Add tests for google menu
tests/extensions/functional/tests/test_google_menu.py
tests/extensions/functional/tests/test_google_menu.py
""" Google Menu tests """ from base import BaseTouchscreenTest import time from base import MAPS_URL, ZOOMED_IN_MAPS_URL, Pose from base import screenshot_on_error, make_screenshot import re class TestGoogleMenu(BaseTouchscreenTest): @screenshot_on_error def test_google_menu_is_visible(self): self.b...
Python
0
d3b4c2e39f397127d3a808a76eb04f80b1601c17
Add ctypes Cocoa binding.
alfred/cocoa.py
alfred/cocoa.py
""" A little framework for interacting with Cocoa via ctypes. """ import ctypes import ctypes.util from functools import wraps foundation = ctypes.cdll.LoadLibrary(ctypes.util.find_library('Foundation')) appkit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('AppKit')) objc = ctypes.cdll.LoadLibrary(ctypes.util.f...
Python
0
26df96a0c772c70013cc7a027022e84383ccaee2
Add a helper script for converting -print-before-all output into a file based equivelent
utils/chunk-print-before-all.py
utils/chunk-print-before-all.py
#!/usr/bin/env python # Given a -print-before-all -print-module-scope log from an opt invocation, # chunk it into a series of individual IR files, one for each pass invocation. # If the log ends with an obvious stack trace, try to split off a separate # "crashinfo.txt" file leaving only the valid input IR in the last c...
Python
0.999981
cd08fb72fea040d31394435bc6c1892bc208bcc0
Add sumclip.py for WPA analysis
bin/sumclip.py
bin/sumclip.py
# Copyright 2016 Bruce Dawson. 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 applicabl...
Python
0
34317172bc8b0cf6ec512181e7fac30bc4804cea
Create goingLoopyWithPython.py
goingLoopyWithPython.py
goingLoopyWithPython.py
# date: 11/09/15 # username: A1fus # name: Alfie Bowman # description: Going Loopy with Python lines = 0 #defines variable while lines <50: #causes Python to do anything indented until the condition is met print("I will not mess about in Computer Science lessons") #prints the str lines = lines + 1 ...
Python
0.00004
3b3be788b4d414e5828b985300e4e5cca43afdff
initialize listfield before __set__
modularodm/fields/ListField.py
modularodm/fields/ListField.py
from ..fields import Field, List import copy class ListField(Field): def __init__(self, field_instance): super(self.__class__, self).__init__(list=True) # ListField is a list of the following (e.g., ForeignFields) self._field_instance = field_instance # Descriptor data is this t...
from ..fields import Field, List import copy class ListField(Field): def __init__(self, field_instance): super(self.__class__, self).__init__(list=True) # ListField is a list of the following (e.g., ForeignFields) self._field_instance = field_instance # Descriptor data is this t...
Python
0.000001
a90c05355c2735c0a8d2b87d12b143d91f801660
make timeline of training output
bsd/epochizer.py
bsd/epochizer.py
'''Group ims''' import os import sys import time if __name
Python
0.000096
d3fa9df4c4f91ddb42954ea125ed69c2380ada62
create python version of list_change_file_hashes
src/list_changed_file_hashes.py
src/list_changed_file_hashes.py
from git import Repo import os class CommitList: def __init__(self, repo): self.repo = repo def print_all_blob_hashes(self): hashes = set() for commit in self.repo.iter_commits(self.repo.head): for p in commit.parents: diff = p.diff(commit) ...
Python
0.000003
c2d9801ada5f28267edfeaf090c3ce973a6197b4
add breast_segment.py, implement threshold, initial documentation
breast_segment/breast_segment.py
breast_segment/breast_segment.py
import numpy as np from skimage.exposure import equalize_hist from skimage.filters.rank import median from skimage.measure import regionprops from skimage.morphology import disk from skimage.segmentation import felzenszwalb from skimage.transform import rescale from scipy.ndimage import binary_fill_holes from scipy.mis...
Python
0
5f3f2ce52569eb3ae57ab3e4a2eaff29fc0d6522
add pyqt demo
study/python/pyqt/demo.py
study/python/pyqt/demo.py
from PyQt5.QtWidgets import QMainWindow, QPushButton , QWidget , QMessageBox, QApplication, QHBoxLayout import sys, sqlite3 class WinForm(QMainWindow): def __init__(self, parent=None): super(WinForm, self).__init__(parent) button1 = QPushButton('插入数据') button2 = QPushButton('显示数据') ...
Python
0