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
5439a712f1f33117561ca0448d8a88ff53ec8979
Add initial spin_fort test (#5658)
pokemongo_bot/test/spin_fort_test.py
pokemongo_bot/test/spin_fort_test.py
import os import pickle import unittest from mock import MagicMock, patch from pokemongo_bot.cell_workers.spin_fort import SpinFort from pokemongo_bot.inventory import Items config = { "spin_wait_min": 0, "spin_wait_max": 0, "daily_spin_limit": 100, } response_dict = {'responses': {'FORT_SEARCH': { ...
Python
0.000001
0eeff1ec1498f98d624dad90a60d24ab44cc31de
Fix cleanvcf.py when handling chromosome changes Arvados-DCO-1.1-Signed-off-by: Jiayong Li <jli@curii.com> refs #14992
cwl-version/preprocess/gvcf/filterclean/src/cleanvcf.py
cwl-version/preprocess/gvcf/filterclean/src/cleanvcf.py
#!/usr/bin/env python from __future__ import print_function import sys def is_header(line): """Check if a line is header.""" return line.startswith('#') # FIELD index # CHROM 0, POS 1, REF 3 def main(): previous_CHROM = "" previous_end_POS = 0 for line in sys.stdin: if not is_header(li...
#!/usr/bin/env python from __future__ import print_function import sys def is_header(line): """Check if a line is header.""" return line.startswith('#') # FIELD index # CHROM 0, POS 1, REF 3 def main(): previous_CHROM = "" previous_end_POS = 0 for line in sys.stdin: if not is_header(li...
Python
0.000005
b99faa449f8136221494f4cbe6c11053fa383383
Create createModel.py
createModel.py
createModel.py
#coding:utf-8 __author__ = 'Jerry' import sys prefix = 'uro_' """ title comment """ def fileTitleComment(): return """ /** *author:Jerry */\n""" """ help """ def showHelp(): print """help\n example: 1:createObject.py obj:CWDemoObject 1 s:sName s:sTitle i:nID d:d...
Python
0.000001
d2c26cdfb9077aa5e3e8f9a5e2b89c8085bdd2d9
Create RLU_back_propagation.py
Neural-Networks/RLU_back_propagation.py
Neural-Networks/RLU_back_propagation.py
# back propagation algorithm from numpy import * def back_propagation(y, A, MEGA_THETA, xi): # assume y, A, xi are 1-D column vectors (row-less) # assume MEGA_THETA is 2-D array # define useful constants L = size(xi) a = A[-xi[-1]:][:, newaxis] delta = a - y[:, newaxis] DIM = shape(MEGA_THETA) DELTA = zero...
Python
0.000002
9ec9dca1bc599a3a4234881029f9dfff5f0a2e63
Add vacation_overlap.
problem/bench/db/vacation_overlap.py
problem/bench/db/vacation_overlap.py
#! /usr/bin/env python """Al and Ben will each take vacations, with overlap. How short staffed will the office be, on a daily basis? """ import datetime as dt import sqlalchemy as sa class Vacation: def __init__(self): self.engine = sa.create_engine('sqlite:////tmp/vacation.db') def _create_table...
Python
0.000003
1dc52c2139e535b487cd9082259ac74802313132
Create Wiki_XML.py
week4-5/Wiki_XML.py
week4-5/Wiki_XML.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 27 14:25:47 2017 @author: Laurent Vermue (lauve@dtu.dk) """ import xml.etree.ElementTree as ET import time import re from bz2file import BZ2File import sqlite3 from psutil import virtual_memory # Possibility to take memory into account(Machine opti...
Python
0.000002
4900617f38a912fbf386c6a87c55627d87dd59fd
Add test_assign.py
python/test/function/test_assign.py
python/test/function/test_assign.py
# Copyright (c) 2017 Sony Corporation. 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.00003
b9044185e572c811ebe8a8fc89d54f141b0466fb
Add getCurrentConfig method to track.py
play-server/track.py
play-server/track.py
import configmanager import osascript APP_CONFIG_PATH = "applications/" applicationConfigs = configmanager.ConfigManager(APP_CONFIG_PATH) #TODO: Make this user choosable currentApplication = "radiant" def getCurrentConfig(): return applicationConfigs[currentApplication]
Python
0.000001
dff6aebe247601bbd1a28acc1ddda57052fb7fb3
Create seaborn.py
seaborn.py
seaborn.py
import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline #------------------------------------------------------------------------------------ # http://gree2.github.io/python/2015/05/05/python-seaborn-tutorial-controlling-figure-aesthetics # Reset all parameters to default sns.set() # STYLES # default...
Python
0.000007
5426b2be91d7cd42e70d074e305b6e6b705dd67b
Improve multy ordering in admin change list: http://code.djangoproject.com/ticket/389
misc/admin.py
misc/admin.py
from django.contrib.admin.views.main import ChangeList class SpecialOrderingChangeList(ChangeList): """ Override change list for improve multiordering in admin change list. `Django will only honor the first element in the list/tuple ordering attribute; any others will be ignored.` Example: ...
Python
0
554862c81e084f55a1b42db60b1275bf7b90868d
Function to work out useful things for spatial data: TwoPoinDistanceKm
Geography.py
Geography.py
#!/usr/local/sci/bin/python #*************************************** # Code to work out useful things from spatial data: # #1. TwoPointDistanceKm # Distance between two points in space in km # Needs latitudes (-90 to 90) and longitudes (-180 to 180) # www.johndcook.com/python_longitude_latotude.html # 6 June 2...
Python
0.999937
edca5c6332d8301da5473e204a10e82acf47c40f
Add mixin_demo.py
mixin_demo.py
mixin_demo.py
import time class Mixin(object): mixins = {} def __init__(self, target, mixin, key=""): self.key = key.upper() + "_CALCULATION_MODE" self.target = target self.mixin = mixin def __enter__(self): return self._load() def __exit__(self, *args): self._unload() ...
Python
0.000001
95d855743e9f37e87397c9be7ffc9b888320a4ac
Add the init method to the note model.
model/note.py
model/note.py
class NoteModel(Query): def __init__(self, db): self.db = db self.table_name = "note" super(NoteModel, self).__init__()
Python
0
87a77ca8150c970ac9083894b67c3d73a8a73e7f
Add configuration.py
polyvore/configuration.py
polyvore/configuration.py
# Copyright 2017 Xintong Han. 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.000003
5854334b3ed9b20886e0dd62e21094e7df0fdad0
add basic test for schema
tests/test_schema.py
tests/test_schema.py
from __future__ import absolute_import # import pytest import schematec.schema # import schematec.converters as converters # import schematec.validators as validators # import schematec.exc as exc def test_empty_schema_with_empty_value(): schema = schematec.schema.Schema() assert schema({}) == {}
Python
0.000002
41df504a86bdab0e2a9510e9c26940ae24d82405
test applianceSpotlight
test/sitetest.py
test/sitetest.py
#!/usr/bin/python2.4 # # Copyright (c) 2005-2006 rPath, Inc. # # All Rights Reserved # import testsuite testsuite.setup() import cPickle import os import urlparse import time import mint_rephelp from mint_rephelp import MINT_HOST, MINT_PROJECT_DOMAIN, MINT_DOMAIN import rephelp class SiteTest(mint_rephelp.WebReposi...
Python
0
3f0340f45f81a0eeab78186cf14e204a79b3a2be
Add rest_api, a new task that starts up /usr/bin/ceph-rest-api running as a daemon.
teuthology/task/rest_api.py
teuthology/task/rest_api.py
import logging import contextlib from teuthology import misc as teuthology from teuthology import contextutil from ..orchestra import run from teuthology.task.ceph import CephState log = logging.getLogger(__name__) @contextlib.contextmanager def run_rest_api_daemon(ctx, api_clients): if not hasattr(ctx, 'daemons...
Python
0
655fc717469c2f8fa49b4c55e4f0a1768b045758
add quick sort
Python/quick_sort.py
Python/quick_sort.py
arr = [134,53,4,234,23,452,3,5,43,534,3,5,435,345] def sort(arr): low = 0 high = len(arr)-1 quick_sort(arr,low,high) def get_pivot(arr,low,high): mid = (high + low) // 2 pivot = high if arr[low] < arr[mid]: pivot = mid elif arr[low] < arr[high]: pivot = low return pivot def quick_sort(arr,low,high): if ...
Python
0.000001
fb9fa7dd1098aa5e433ad0692138cd00d1a7efbc
Create __init__.py
__init__.py
__init__.py
__author__ = 'Agnese' import re import json import os import time class ServerPyProlog: def __init__(self): self.result = "" #risultato, stato attuale della conversione path = sys.path[0] self.root = path[:path.rfind('DALI')] #print(path) #print (self.root) def findRo...
Python
0
b75e72c5a0a8aa328afa03dee593daaa8400e96a
Add nosetest
test_utaskweb.py
test_utaskweb.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # import requests from bs4 import BeautifulSoup import utaskweb def assert_text_obj(obj): unicode_obj = unicode(obj) assert type(unicode_obj) == unicode def test_get_text_if_exists(): node1 = BeautifulSoup('<tr>Hello World</tr>') node2 = BeautifulSoup('...
Python
0.000172
2448b2608ab4d32c4d80c1bbd2a09063197524e6
Create __init__.py
__init__.py
__init__.py
import product_attachments
Python
0.000429
8e83b41a4796d62868a113ccb1e949a2d09bafac
Test throwing future callback
python/test/test_servicedirectory.py
python/test/test_servicedirectory.py
import time from qi import ServiceDirectory from qi import Session def main(): def raising(f): raise Exception("woops") local = "tcp://127.0.0.1:5555" sd = ServiceDirectory() sd.listen(local) s = Session() s.connect(local) f = s.service("ServiceDirectory", _async=True) f.add...
Python
0.000001
fcae40e5bbc5e593d4245747dd0d1d1ef78cad3a
Add a (hackish) feed wrapper for auto-subscribing and reading new MLs
tools/feedwrapper.py
tools/feedwrapper.py
#!/usr/bin/env python3.4 # 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 "Li...
Python
0
d50d43854596522f7cef8712e0599b39c71b027b
Add initial jenkins python script for jenkins tests
tests/jenkins.py
tests/jenkins.py
#!/usr/bin/env python ''' This script is used to test salt from a jenkins server, specifically jenkins.satstack.com. This script is intended to be shell centric!! ''' import subprocess import hashlib import random import optparse def run(platform, provider): ''' RUN! ''' htag = hashlib.md5(str(rando...
Python
0
4cddb31cd5054ff146f4bab8471367dcc48297c4
Create server2.py
server2.py
server2.py
# -*- coding: UTF-8 -*- import socket, threading, string debug = True _connector = None _running = True _host = '0.0.0.0' _port = 2222 _maxClient = 10 _recvBuffer = 1024 def printd (aString): if debug: print aString class talkToClient (threading.Thread): def __init__(self, clientSock, addr): ...
Python
0.000001
13fd2335eb8b8b93e5330fe9bcc125557bffb198
Add missing migration for verbose_name alter
ecommerce/extensions/payment/migrations/0012_auto_20161109_1456.py
ecommerce/extensions/payment/migrations/0012_auto_20161109_1456.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('payment', '0011_paypalprocessorconfiguration'), ] operations = [ migrations.AlterField( model_name='paypalproces...
Python
0.000002
65c1ddc6837a36b87992304e2d364b5eb6e8d0d9
add selenium test
tests/seltest.py
tests/seltest.py
from selenium import webdriver import pytest def test_selenium_basic(): driver = webdriver.Firefox() driver.get("localhost:5000") bod = driver.get_element_by_tag_name('body') assert "Hello" in bod.text driver.quit()
Python
0.000003
98262d909ad612684df9dfe6f98ee3c8217df2ce
Create __init__.py
FAFT_2048-points_C2C/__init__.py
FAFT_2048-points_C2C/__init__.py
Python
0.000429
a301a90ed9cc570c3de1fdcd4c6908512cfd1183
add require_billing_admin decorator
corehq/apps/accounting/decorators.py
corehq/apps/accounting/decorators.py
from django.http import Http404 from corehq import BillingAccountAdmin def require_billing_admin(): def decorate(fn): """ Decorator to require the current logged in user to be a billing admin to access the decorated view. """ def wrapped(request, *args, **kwargs): if no...
Python
0.000001
c38d3695c0b056da3014951ee842bae4f817b657
Add serialization unit-test
chimenea/tests/test_obsinfo.py
chimenea/tests/test_obsinfo.py
from __future__ import absolute_import from unittest import TestCase import json from chimenea.obsinfo import ObsInfo class TestObsInfoSerialization(TestCase): def setUp(self): self.obs = ObsInfo(name='foo', group='fooish', metadata={'bar':'baz'}) ...
Python
0.000009
a6703a7cbbc738fc72343be8c582bdfae1b69a44
Fix small pep8 issue
openstack_dashboard/dashboards/admin/instances/forms.py
openstack_dashboard/dashboards/admin/instances/forms.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Kylin OS, 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 # #...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Kylin OS, 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 # #...
Python
0
0d7706db887bb5d1522f3de39b9fe1533f80fd8d
Add original script version, still not fit for general use
dota2parser.py
dota2parser.py
from bs4 import BeautifulSoup import urllib.request import MySQLdb db = MySQLdb.connect(user="", passwd="", db="") c = db.cursor() c.execute("SELECT id, name FROM heroes WHERE active=1") heroes = c.fetchall() for hero_id, hero_name in heroes: hero_url = 'https://www.dota2.com/hero/'+str(hero_name).replace(' ', '_')....
Python
0
a8e2f22bcc521aedc216d0d1849b6e4f58ede443
Add old matrix file
matrix.py
matrix.py
''' Cover the screen in green ones and zeroes, as if in the Matrix. ''' import time, sys import random from console import getTerminalSize ESC = '\033' def getLine(cols): ''' Create a matrix line. ''' CHOICES = '000111 ' line = ''.join(random.choice(CHOICES) for _ in range(cols)) return line def matr...
Python
0.000001
33155a213e1b31e8676a92c8e7a7f0330050b4c1
Add base class for plugins.
pycollectd/plugin.py
pycollectd/plugin.py
# -*- coding: utf-8 -*- # # © 2013 Lyft, 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
0f84eb57024bb856c10a6326a3827cb91e4d20c2
Put the contents of a pyui file onto the clipboard
pyui_to_clipboard.py
pyui_to_clipboard.py
import clipboard filename = 'put_your_filename_here.pyui' # edit this line before running with open(filename) as in_file: clipboard.set(in_file.read()) print('The contents of {} are now on the clipboard.'.format(filename))
Python
0
6126ef6028449abab49994bbbe555ecf591ad910
Work on comets tracking
plugins/Scripts/Plugins/Test_In_Vivo_Comets_Tracking.py
plugins/Scripts/Plugins/Test_In_Vivo_Comets_Tracking.py
# @Float(label="Sigma 1", required=true, value=4.2) sigma1 # @Float(label="Sigma 2", required=true, value=1.25) sigma2 # @Boolean(label="Do thresholding ?", required=true, value=true) do_thresholding # @Boolean(label="Show intermediates images (for debugging)", required=true, value=true) show_images # @ImageJ ij # @Im...
Python
0.000001
ae0ebcc4da3425539e067d4d6a611554327357ad
Add web-scraping
hackathonupdate-webscraping.py
hackathonupdate-webscraping.py
from lxml import html import requests page=requests.get('https://mlh.io/seasons/s2015/events.html') tree=html.fromstring(page.text) titles=tree.xpath('//*[name()="h3"]/text()') #add dates and locations later print(titles)
Python
0.000001
a3706e1c743ef7ec7f38375b116538a71ccb8455
Add utilities to convert from python2 to python3.
rasterfairy/utils.py
rasterfairy/utils.py
def cmp_to_key(mycmp): """ Convert `sorted` function from python2 to python3. This function is used to convert `cmp` parameter of python2 sorted function into `key` parameter of python3 sorted function. This code is taken from here: https://docs.python.org/2/howto/sorting.html#the-old-way-usin...
Python
0
c0b53a195974173942b73d320248febd19b6788c
Add exercise 9
exercise/9.py
exercise/9.py
import random i = random.randint(1, 9) def ask_for_input(): while True: s = input('Please guess what I got (an integer between 1 and 9) in hand?: ' ) ii = int(s) if 1 <= ii <= 9: return ii else: print('Wrong input!') continue def ask_for_again()...
Python
0.000002
141bb79f45053e7bc5bfc4aa06e98d6e2788fc2c
Implement type reranker
type_reranker.py
type_reranker.py
from dbpediaEnquirerPy import * from KafNafParserPy import * import os def get_entity_sent(filename, parser, entity): terms=[] for ref in entity.get_references(): termbs=ref.get_span().get_span_ids() if len(termbs)==0: w.write(filename + "\t" + entity.get_id() + "\n") return 100 print termbs, len(...
Python
0.000001
37e3380cbbef86f35f963ebfa3bdb07eb3d3ae3d
Add condor test
libsubmit/tests/test_integration/test_ssh/test_ssh_condor_earth.py
libsubmit/tests/test_integration/test_ssh/test_ssh_condor_earth.py
import os import libsubmit from libsubmit import SshChannel, Condor import time def test_1(): config = { "site": "T3_US_NotreDame", "execution": { "scriptDir": ".scripts", "environment": { 'CONDOR_CONFIG': '/opt/condor/RedHat6/etc/condor_config', ...
Python
0
ed31ebcd8c8058b3cc92a9fd4411577e9227605b
Add models.py with sqla settings and player, game classes
models.py
models.py
from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base import json engine = create_engine('sqlite:///db.sqlite', echo=True) Base = declarative_base() class Player(Base): __tablename__ = 'players' id = Column(Integer, primary_key=True) username = Colum...
Python
0
546e9441b7dc6eb1575aab3c534f414aed0f0c3c
Create GC_content.py
sequence_manipulation/GC_content.py
sequence_manipulation/GC_content.py
''' Written by Cham K. June 16th 2015 ''' from sequence_manipulation import nucleotide_count def GC_content(sequence, percent=True): ''' (str, bool) -> (float) Returns the GC-content as a non-rounded percentage (or ratio if percent=False) of a DNA sequence. Can process upper-case and lower-case sequence i...
Python
0.000001
150b1c07a55d2f3ce429cc0108fdaf653b9b7132
Create models.py
models.py
models.py
from django.db import models class Mode(models.Model): name = models.CharField(max_length=50) class State(models.Model): name = models.CharField(max_length=50)
Python
0.000001
d26034963c0332346ea1b6b50b9ad3d637da7e36
Add script to try and push stripe payment of unpaid invoices
spiff/payment/management/commands/attempt_payment.py
spiff/payment/management/commands/attempt_payment.py
from django.core.management import BaseCommand from spiff.payment.models import Invoice import stripe class Command(BaseCommand): help = 'Attempts to process an invoice via stripe' def handle(self, *args, **options): for invoice in Invoice.objects.unpaid().all(): print invoice try: unpaid ...
Python
0
c5ed01ce81b1c0e459d93bf26bf96cdeb80a0344
Use specific notifications when possible.
Lib/defconAppKit/representationFactories/__init__.py
Lib/defconAppKit/representationFactories/__init__.py
from defcon import Glyph, Image, registerRepresentationFactory from defconAppKit.representationFactories.nsBezierPathFactory import NSBezierPathFactory from defconAppKit.representationFactories.glyphCellFactory import GlyphCellFactory from defconAppKit.representationFactories.glyphCellDetailFactory import GlyphCellDeta...
from defcon import Glyph, Image, registerRepresentationFactory from defconAppKit.representationFactories.nsBezierPathFactory import NSBezierPathFactory from defconAppKit.representationFactories.glyphCellFactory import GlyphCellFactory from defconAppKit.representationFactories.glyphCellDetailFactory import GlyphCellDeta...
Python
0
31d26cefd8f3d246437511c2b0852051d68cb2c8
modify wod2vec
exampleWtoV.py
exampleWtoV.py
#/datastore/zhenyang/bin/python import gensim, logging import sys import os from xml.etree import ElementTree def get_parentmap(tree): parent_map = {} for p in tree.iter(): for c in p: if c in parent_map: parent_map[c].append(p) # Or raise, if you don't want...
Python
0.000011
b68244965b4f69711f0c4d9d42f24e6b3f5742f4
Add script to update images in the js code
update-images.py
update-images.py
#!/usr/bin/env python import urllib def img2base64(img): return open(img, "rb").read().encode("base64").replace('\n', '') disabled_base64 = img2base64("assets/no-js.png") enabled_base64 = img2base64("assets/jsenabled.png") data = open('bootstrap.js') output = [] for line in data.readlines(): if line.starts...
Python
0
ef526fe30b0bfcf82319195e76e4da01ab613ca3
add initial spline
epistasis/models/nonlinear/spline.py
epistasis/models/nonlinear/spline.py
import numpy as np from .minimizer import Minimizer from .ordinary import EpistasisNonlinearRegression from epistasis.models import EpistasisLinearRegression from epistasis.models.utils import (arghandler, FittingError) from scipy.interpolate import UnivariateSpline # -------------------- Minimizer object -----------...
Python
0.000001
8fb6e77baf5babbfde79eabe076da1e9baee1ff0
Add dygraph triple grad test (#36814)
python/paddle/fluid/tests/unittests/test_imperative_triple_grad.py
python/paddle/fluid/tests/unittests/test_imperative_triple_grad.py
# Copyright (c) 2021 PaddlePaddle 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 by appli...
Python
0
49cb9138a10e3fc9324f6c2e655cc4b8bd34276c
Add transliteration tool
extranslit.py
extranslit.py
#!/usr/bin/env python # -*- coding: utf8 -*- """ Usage: translit_location.py INCOLUMN [--lang LANG] [--reverse] [--minlen MINLEN] INFILE... Options: INCOLUMN The number of the INCOLUMN to use, 1 based (A=1). OUTCOLUMN The number of the OUTCOLUMN to put the result in (WILL OVERWRITE ALL VALUES), 1 ...
Python
0.000004
0c50fc3838cd87f09e767727c41ee6c0771b396d
Create type.py
code/neominim/type.py
code/neominim/type.py
# -*- coding: utf-8 -*- __author__ = "joshhartigan" class NeoMinimError(Exception): """ general purpose neominim error """ pass
Python
0.000001
9ede4e498bdf41f576c266f2fdedb96f277bc548
provide a kcli bmc
extras/kbmc.py
extras/kbmc.py
import argparse import sys from kvirt.config import Kconfig from kvirt.common import pprint import pyghmi.ipmi.bmc as bmc class KBmc(bmc.Bmc): def __init__(self, authdata, port, name): super(KBmc, self).__init__(authdata, port) self.bootdevice = 'default' self.k = Kconfig().k if n...
Python
0.999999
b0c6bddfac0931de679972a4d8674269889e5cd2
Correct set_node_options argument list
zuul/openstack_functions.py
zuul/openstack_functions.py
# Copyright 2013 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
# Copyright 2013 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
Python
0.000204
02d5370f09956077623ea76340e51d1cf6d10f93
Add boolean primitive type support.
source/harmony/ui/widget/boolean.py
source/harmony/ui/widget/boolean.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. from PySide import QtGui from .simple import Simple class Boolean(Simple): '''Boolean control.''' def _constructControl(self, **kw): '''Return the control widget.''' return QtGui.QCheckBo...
Python
0
2a93cd12a8e198cd6a09d2a077148999eb6c3739
add source file collection_builder.py
collection_builder.py
collection_builder.py
#!/usr/bin/python #===================================================================================== # conversion from .bib file to Jekyll collection files (ver 1.0) # # Copyright (c) <2015> <Haining Wang> # https://github.com/ellenzinc/ # Permission is hereby granted, free of charge, to any person obtaining a ...
Python
0.000001
e3900a167b0f9bba731353bd8175b8a5ede9491b
add loggeduser migration
activitydb/migrations/0024_loggeduser.py
activitydb/migrations/0024_loggeduser.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-08-23 21:22 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('activitydb', '0023_tolasites_tola_report_url'), ] operations = [ migrations....
Python
0.000001
c168efd883bcc1fc5ed8fe3c80de95db905bb468
Add file for nontermianl adding when grammar is create
tests/grammar_creation_test/NonterminalAddingTest.py
tests/grammar_creation_test/NonterminalAddingTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy import * class NonterminalAddingTest(TestCase): pass if __name__ == '__main__': main()
Python
0
307e4fda61f92e344bfd90c1a43f5a9076e7b832
Add files for rule's invalid syntax validation
tests/rules_tests/isValid_tests/InvalidSyntaxTest.py
tests/rules_tests/isValid_tests/InvalidSyntaxTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import Rule class InvalidSyntaxTest(TestCase): pass if __name__ == '__main__': main()
Python
0.000001
bb9a796abc1a1535c5113c260ac5a703c4cefb53
Add Python source code
primes.py
primes.py
#!/usr/bin/env python import sys number = int(sys.argv[1]) candidate = 2 while (number > 1): while (number % candidate == 0): print candidate number /= candidate candidate += 1
Python
0.016778
8e48aec6d1e6aca9c2ce54108fface01d2cbde8f
add bottom Ekman layer test
test/bottomFriction/test_ekman_bottom.py
test/bottomFriction/test_ekman_bottom.py
""" Bottom Ekman layer test ======================= Steady state flow in a channel subject to bottom friction and rotation. Vertical viscosity is assumed to be constant to allow simple analytical solution. """ from thetis import * import numpy import pytest def run_test(layers=25, tolerance=0.05, verify=True, **mode...
Python
0
83470a90d8f765438ec77a61527e4d3d8963890f
add test for the fastq_count script
test/scripts/test_sequana_fastq_count.py
test/scripts/test_sequana_fastq_count.py
from sequana.scripts import fastq_count from nose.plugins.attrib import attr from sequana import sequana_data #@attr("skip") class TestPipeline(object): @classmethod def setup_class(klass): """This method is run once for each class before any tests are run""" klass.prog = "sequana_fastq_count...
Python
0
7101a601edbff6626350e4d1c7434692881072f6
Fix : remove a dangerous print of utf8 char for hudson.
test/test_strange_characters_commands.py
test/test_strange_characters_commands.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #Copyright (C) 2009-2010 : # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # #This file is part of Shinken. # #Shinken is free software: you can redistribute it and/or modify #it under the terms of the GNU Affero General Public License as...
#!/usr/bin/env python # -*- coding: utf-8 -*- #Copyright (C) 2009-2010 : # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # #This file is part of Shinken. # #Shinken is free software: you can redistribute it and/or modify #it under the terms of the GNU Affero General Public License as...
Python
0
c6e2732575993f76657ba15b155e6cfe45aa60c4
add static data generator
gen-static.py
gen-static.py
#!/usr/bin/env python import json import sqlite3 class SDE: def __init__(self, db): self.db = db def groups_in_category(self, category): c = self.db.cursor() c.execute("SELECT categoryID FROM invCategories WHERE categoryName = ?", (category,)) category_id = c.fetchone()[0] c.execute("SELECT groupName FR...
Python
0.000001
1e15f0953076810c1ccd2d04c258d3fb0eba71e1
Create sample.py
sample.py
sample.py
Python
0
2900f014bf7d8bdf5b7f4fe10d844cd516d0372a
Add basic views tests
web/web/tests.py
web/web/tests.py
from django.test import Client, TestCase from django.core.urlresolvers import reverse # Create your tests here. class BasicViewsTestCase(TestCase): fixtures = [] def setUp(self): self.public_views = [('login', dict()), ('logout', dict())] self.private_views = [('homepage', dict()), ...
Python
0
81c4f9300e0cef204aaf2a0205ebf21be23f9414
add strings to return ehllo world as output
hellomarly.py
hellomarly.py
#This is my hello marly..... print 'Hello Marly'
Python
0.999907
b3962e17bbc0328faa928d1eaed57de40cc28ee0
add heroku_api.py
heroku_api.py
heroku_api.py
import heroku import argparse import os import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning, SNIMissingWarning, InsecurePlatformWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) requests.packages.urllib3.disable_warnings(SNIMissingWarning) requests.packages....
Python
0.000002
257d0c9e8e6a8b571bfc896b2197f303251173df
Create p.py
webscraping/p.py
webscraping/p.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import urllib2 t = urllib2.urlopen('http://www.gmasson.com.br/').read() # TAG tags = t.split('<p')[1:] tags = [ tag.split('</p>')[0] for tag in tags ] for i in tags: print i
Python
0.000004
01710f18efbe29dc5cf187726d5c686beec7e6e7
Add helper script for getting plaso timeline in to timesketch
utils/add_plaso_timeline.py
utils/add_plaso_timeline.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 a...
Python
0
2c0fc3387a6dbd54bbcd4c47952ce8739d0b2152
Add super-simple deduplication filter that uses a dictionary
dedup_worker.py
dedup_worker.py
# Pull URL # Strip query string # Query exists # IFN save to sqlite # IFN push to queue # IFY do nothing seen = {} if __name__ == '__main__': from helpers import client ingest = client.queue('ingest') scrape = client.queue('scrape') while True: claimed = ingest.claim(ttl=180, grace=60) ...
Python
0.000006
d62ffdce6df8cf848c1b1b198fc65d4dc0d70a1e
Add MergeSort.py
Sorting/MergeSort.py
Sorting/MergeSort.py
# @auther Besir Kurtulmus ''' The MIT License (MIT) Copyright (c) 2014 Ahmet Besir Kurtulmus 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 ...
Python
0
c8da605c3eef2cc205a47851e9c3e5b7c2a60f00
Create nltk13.py
nltk13.py
nltk13.py
from __future__ import division import sqlite3 import time conn = sqlite3.connect('knowledgeBase.db') conn.text_factory = str c = conn.cursor() negativeWords = [] positiveWords = [] sql = "SELECT * FROM wordVals WHERE value = ?" def loadWordArrays(): for negRow in c.execute(sql, [(-1)]): negativeWords...
Python
0.000001
4ec6852368a79d272da145cdb3aa34620cbf0573
Create a.py
abc006/a.py
abc006/a.py
n = int(input()) if n % 3 == 0 or '3' in str(n): print('YES') else: print('NO')
Python
0.000489
f25fe8cd315cfd08e5c717a2706bf85fa0fbbbe2
Add LBFGS tomography example
examples/solvers/lbfgs_tomography.py
examples/solvers/lbfgs_tomography.py
# Copyright 2014-2016 The ODL development group # # This file is part of ODL. # # ODL is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. #...
Python
0
51c6335718e5aca75d1c8e7e1fa08e396aa8a557
Create Valid_Parentheses.py
Array/Valid_Parentheses.py
Array/Valid_Parentheses.py
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not. class Solution: # @return a boolean def isValid(self, s): stack = [] ...
Python
0
dbba2e9b541af2b95cbc3f9f306b3062be81460e
Create AnimationBase.py
AnimationBase.py
AnimationBase.py
# -*- coding: utf_8 -*- """ Created on 13.07.2014 @author: gitoni """ import subprocess as sp import os import webbrowser as wb class Animation(object): """ A class for creating animations with ImageMagick. Paths need to be adapted to your system. This here works on Windows, asuming that ImageMagi...
Python
0.000001
83632d537a033deb017dbfeab02ba4e1073e309a
add export filters
couchforms/filters.py
couchforms/filters.py
''' Out of the box filters you can use to filter your exports ''' def instances(doc): """ Only return XFormInstances, not duplicates or errors """ return doc["doc_type"] == "XFormInstance" def duplicates(doc): """ Only return Duplicates """ return doc["doc_type"] == "XFormDuplicate" ...
Python
0.000001
7e8ff3971c21335468a683edcb9efb260c49bd61
Add packet class
packet.py
packet.py
class Packet: PACKET_LENGTH = 4 def decode(b): """Retuns a Packet object for the given string, or None if it isn't valid.""" if len(b) != Packet.PACKET_LENGTH: return None if b[0] ^ b[1] ^ b[2] != b[3] or ((b[0] & 0x80) >> 7) != 1: return None if (b[0] ...
Python
0.000001
38aaf30aa1d148bfa31e7856b399a735ba818c6b
Add test for accessing module docstring.
tests/basics/module_docstring.py
tests/basics/module_docstring.py
""" doc string""" try: __doc__ except NameError: print("SKIP") raise SystemExit print(__doc__)
Python
0.000008
a91e1dad57331e4e944c1bd7168d61ec1ebc0fdf
fix #69 feincms_render_content templatetag error
feincms/templatetags/feincms_tags.py
feincms/templatetags/feincms_tags.py
from django import template from django.template.loader import render_to_string from feincms import settings as feincms_settings from feincms import utils register = template.Library() def _render_content(content, **kwargs): # Track current render level and abort if we nest too deep. Avoids # crashing in r...
from django import template from django.template.loader import render_to_string from feincms import settings as feincms_settings from feincms import utils register = template.Library() def _render_content(content, **kwargs): # Track current render level and abort if we nest too deep. Avoids # crashing in r...
Python
0
bbd8b248fb804349682e7c7a7e62c90aefaed536
the most common letters is [space][e][a][t]
51_100/Problem#59.py
51_100/Problem#59.py
import operator def most_common(lst): return max(set(lst), key=lst.count) if __name__ == "__main__": with open("cipher1.txt") as f: for line in f: numbers = [int(x) for x in line.split()] f.close() list1 = [numbers[i] for i in range(len(numbers)) if i % 3 == 0] list2 = [numb...
Python
0.999999
3a2bec63eff4a2657250e46a523b5f98b9d27aea
Add tests for validate models.
coda/coda_validate/tests/test_models.py
coda/coda_validate/tests/test_models.py
from .. import factories class TestValidate: def test_unicode(self): validate = factories.ValidateFactory.build() assert unicode(validate) == validate.identifier
Python
0
9d30c51aac7ca00b4f191270a82f24372687163c
Add Pandoc filter to convert SVG illustrations to PDF
svg2pdf.py
svg2pdf.py
#!/usr/bin/env python """ Pandoc filter to convert svg files to pdf as suggested at: https://github.com/jgm/pandoc/issues/265#issuecomment-27317316 """ __author__ = "Jerome Robert" import mimetypes import subprocess import os import sys from pandocfilters import toJSONFilter, Image fmt_to_option = { "sile": ("--...
Python
0
6892e38e328508e05a349b0c4bc9a154dd854f4f
Create Maximal-Square.py
Array/Maximal-Square.py
Array/Maximal-Square.py
''' Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 Return 4. ''' # Method 1: use the 2D array DP, the details showed in the following links class Solution: # @param...
Python
0.000001
d9b03bf39a83a473f76aec045b3b182f25d1d7f5
Teste de JSON
backend/test/curso_tests/rest_tests.py
backend/test/curso_tests/rest_tests.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from base import GAETestCase from course_app.course_model import Course from mommygae import mommy from routes.courses import rest class ListarTests(GAETestCase): def test_sucesso(self): mommy.save_one(Course) respost...
Python
0.000001
286232f060f4268881105fdc7b08bdf3f2f276a9
Add meeting.py
meeting.py
meeting.py
#!/usr/bin/python # # A simple tool to manage the discuss meetings. # import argparse import discuss import sys acl_flags = "acdorsw" def die(text): sys.stderr.write("%s\n" % text) sys.exit(1) def get_user_realm(client): user = client.who_am_i() return user[user.find('@'):] def add_meeting(): ...
Python
0.000021
df09148f7c53177124e898de27f49a082afb86d6
Create foursq_tips.py
foursq_tips.py
foursq_tips.py
# -*- coding: utf-8 -*- import json import guess_language from textblob import TextBlob from foursq_utils import * def get_venue_category(venue_category_name): if venue_category_name in category_Arts_Entertainment: return 'Arts_Entertainment' elif venue_category_name in category_College_University: ...
Python
0.000396
e51431c5fb111fc86f1087184accc84d633590de
add first hash of assignee_disambiguatiion
lib/assignee_disambiguation.py
lib/assignee_disambiguation.py
#!/usr/bin/env Python """ Performs a basic assignee disambiguation """ import redis from collections import Counter from Levenshtein import jaro_winkler from alchemy import fetch_session # gives us the `session` variable from alchemy.schema import * THRESHOLD = 0.95 # get alchemy.db from the directory above s = fetch...
Python
0.000002
3ffe8dd8ed59cb5c03087844534a94b11bb73a8d
Add longest increasing subsequence
algo/lis.py
algo/lis.py
arr = [1, 6, 3, 5, 9, 7] ans = [1] for i in range(1, len(arr)): t = [] for j in range(i): if arr[i] > arr[j]: t.append(ans[j]+1) else: t.append(ans[j]) ans.append(max(t)) print max(ans)
Python
0.999999
b7c6b5115ce5aec129af64d6b85c672901a435d3
Add a multiprocessor for particle learning.
gpmcc/experiments/particle_engine.py
gpmcc/experiments/particle_engine.py
# -*- coding: utf-8 -*- # 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
61324ef30839bdcf99e20e0de2a4bb029e189166
Fix byte/str typing error
compose/cli/utils.py
compose/cli/utils.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import os import platform import ssl import subprocess import sys import docker import compose # WindowsError is not defined on non-win32 platforms. Avoid runtime errors by # defining it as OSError (its pa...
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import os import platform import ssl import subprocess import sys import docker import compose # WindowsError is not defined on non-win32 platforms. Avoid runtime errors by # defining it as OSError (its pa...
Python
0.000005
ac58f25c47c9954a694a98008f8c658ae3a0f840
add a way to merge cut files together
add-cuts.py
add-cuts.py
import os import csv import json def add_cuts(cuts_left, cuts_right): output_dict = {} for h in cuts_left.keys(): output_dict[h] = dict((k, cuts_left[h][k]+cuts_right[h][k]) for k in ["raw", "scaled", "weighted"]) return output_dict if __name__ == '__main__': import argparse import subprocess class ...
Python
0.000001
db4d640bb4ec5cc3d6e7a21334b3ba35ca6a9268
Create obmplib.py
obmplib.py
obmplib.py
def read4bint(f, o): ret = f[o+3] ret *= 256 ret += f[o+2] ret *= 256 ret += f[o+1] ret *= 256 ret += f[o] return ret def read2bint(f, o): ret = f[o+1] ret *= 256 ret += f[o] return ret def loadBMP(filename): f = open(filename, 'b+r') bts = f.read() f.close(...
Python
0.000002
12a53e27471e4a647b2cb858b4abe5396c4f4a64
Fix DoorBird push notifications for installations with an API password (#12020)
homeassistant/components/doorbird.py
homeassistant/components/doorbird.py
""" Support for DoorBird device. For more details about this component, please refer to the documentation at https://home-assistant.io/components/doorbird/ """ import asyncio import logging import voluptuous as vol from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD from homeassistant.components....
""" Support for DoorBird device. For more details about this component, please refer to the documentation at https://home-assistant.io/components/doorbird/ """ import asyncio import logging import voluptuous as vol from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD from homeassistant.components....
Python
0
6aba6b7f4602a3d967ffec05cc3fafcd4d471b00
Add test that interact with running hydrachain
hydrachain/tests/test_working_app.py
hydrachain/tests/test_working_app.py
import os import time import signal import syslog import pytest import random import gevent import traceback from threading import Thread from click.testing import CliRunner from hydrachain import app from pyethapp.rpc_client import JSONRPCClient from requests.exceptions import ConnectionError from ethereum.processbloc...
Python
0.000001
336550b27887966b6f40a1161cb6dfdadc7f779b
Create VitalSourcePrinter_ChapPageV2.py
VitalSourcePrinter_ChapPageV2.py
VitalSourcePrinter_ChapPageV2.py
''' This script is designed to legally and automatically print your purchased e-books from VitalSource.com See ReadMe at https://github.com/LifeAlgorithm/VitalSourcePrinter and/or watch tutorial video for instructions This version is for printing chapter pages with the Ctrl + pagedown requirement ''' try: imp...
Python
0
e5a0647862c179fb0840454fd6b827c46a05ecbc
Add check_scattering_factor.py to see atomic scattering factors for X-ray and electrons Commit 41956836
cctbx_progs/check_scattering_factor.py
cctbx_progs/check_scattering_factor.py
import numpy import cctbx.eltbx.xray_scattering import cctbx.eltbx.e_scattering def fetch_equation(table): return "+".join(["%f*exp(-%f*s**2)" %(a,b) for a,b in zip(table.array_of_a(), table.array_of_b())]) + "+%f" % table.c() def run(elements, smin=0, smax=1, sstep=0.01): #reg = cctbx.xray.scattering_type_re...
Python
0
3a9807fd14257c49490ec429d7365c902209508c
Add beginnings of a Python driver. Currently just prints out input file.
gumbo_stats.py
gumbo_stats.py
import ctypes import sys def parse_warc(filename): pass def parse_file(filename): with open(filename) as infile: text = infile.read() print(text) if __name__ == '__main__': filename = sys.argv[1] if filename.endswith('.warc.gz'): parse_warc(filename) else: parse_file(filename)
Python
0
36d7bc4719490b046d8782465ddeba6e8240233e
Split images into bf and bc bears. Defaults to images.
tools/xml_split_images_locale.py
tools/xml_split_images_locale.py
#! /usr/bin/python3 import sys import argparse import xml_utils as u import datetime from argparse import RawTextHelpFormatter from collections import defaultdict ##------------------------------------------------------------ ## can be called with: ## ## write bc and bf face images to separate files ##--------...
Python
0