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
bd0bdc543ba1e44ddc9d149fbaadd12ab051614d
Add migrations
accession/migrations/0003_auto_20191101_1625.py
accession/migrations/0003_auto_20191101_1625.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.25 on 2019-11-01 16:25 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accession', '0002_auto_20191031_2139'), ] operations = [ migrations.AlterF...
Python
0.000001
7b0ebe74cbaad610bb65f24cc2555d82e7d7a750
read attachments path from settings, catch jpeg/png
apps/photos/views.py
apps/photos/views.py
from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.http import HttpResponseRedirect from rapidsms.webui.utils import render_to_response from photos.models import Photo import os import settings # default page - show all thumbnails by date @login_required() def ...
from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.http import HttpResponseRedirect from rapidsms.webui.utils import render_to_response from photos.models import Photo import os import settings # default page - show all thumbnails by date @login_required() def ...
Python
0
fda4f436bbaea9215efa03648d2df8e413fb47dd
add class loader tests
test/test_loader.py
test/test_loader.py
# Copyright (c) 2018 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the Apache License version 2.0 # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, software # d...
Python
0
dd75e1c5afb05c5d46adae465947fb3f893cdf6b
Create 7kyu_complete_the_pattern4.py
Solutions/7kyu/7kyu_complete_the_pattern4.py
Solutions/7kyu/7kyu_complete_the_pattern4.py
def pattern(n): l=list(range(1,n+1)) return '\n'.join(''.join(map(str,l[i:])) for i in range(n))
Python
0.001969
a5f8248b1b4a237e66a8dbf443ea822b5e01a2f9
Add backport-pr script
tools/backport_pr.py
tools/backport_pr.py
#!/usr/bin/env python """ Backport pull requests to a particular branch. Usage: backport_pr.py branch [PR] [PR2] e.g.: python tools/backport_pr.py 0.13.1 123 155 to backport PR #123 onto branch 0.13.1 or python tools/backport_pr.py 2.1 to see what PRs are marked for backport with milestone=2.1 that have ...
Python
0
422b5573b72cc2014893aa15758b9d0bc61baf05
refactor from core.py
Synopsis/Formatters/HTML/DeclarationStyle.py
Synopsis/Formatters/HTML/DeclarationStyle.py
# $Id: DeclarationStyle.py,v 1.1 2003/11/15 19:55:06 stefan Exp $ # # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # class Style: """This class just maintains a mappin...
Python
0.000202
20cbfa3646bc38429ee202c0e77c32a9c5c614d9
blotto.py
blotto.py
blotto.py
from ea import adult_selection from ea import parent_selection from ea import reproduction from ea import main from ea import binary_gtype def fitness_test(population): '''Naive fitness test for onemax, just the number of ones''' return [(ind[0], ind[1], sum(ind[1]), ind[2]) for ind in population] def develop...
Python
0.999968
b8cc84245ae7f3ceda0e0cd92b6b2eecb0426ee3
add start of peg generator
src/mugen/parser/peg.py
src/mugen/parser/peg.py
#!/usr/bin/env python next_var = 0 def nextVar(): global next_var; next_var += 1; return next_var class Pattern: def __init__(self): pass def generate(self, result): pass class PatternNot(Pattern): def __init__(self, next): Pattern.__init__(self) self.next = n...
Python
0
82f15b2dae1b23b75a019362e5925c4a3591fa92
Create InputNeuronGroup_multiple_inputs_1.py
examples/InputNeuronGroup_multiple_inputs_1.py
examples/InputNeuronGroup_multiple_inputs_1.py
''' Example of a spike generator (only outputs spikes) In this example spikes are generated and sent through UDP packages. At the end of the simulation a raster plot of the spikes is created. ''' from brian import * import numpy from brian_multiprocess_udp import BrianConnectUDP number_of_neurons_total = 40 numbe...
Python
0
765897a05a7aae6a89bfd62d8493fb14aa16048a
Create db_migrate.py
db_migrate.py
db_migrate.py
#!venv/bin/python import imp from migrate.versioning import api from app import db from config import SQLALCHEMY_DATABASE_URI from config import SQLALCHEMY_MIGRATE_REPO v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) migration = SQLALCHEMY_MIGRATE_REPO + ('/versions/%03d_migration.py' % (v+1)) tmp_...
Python
0.000003
c085f9b5af73a50a86d592b3d8b02b1e8e444cde
Create optsimulate.py
docs/assets/optsimulate.py
docs/assets/optsimulate.py
# OpenPTrack Sender Simulator # Sept 13, 2015 # jburke@ucla.edu import socket, time, json, time, random UDP_IP = "127.0.0.1" UDP_PORT = 21234 PERIOD = .100 # how often to publish in time # For the random walk MAXSTEP_X = 10 MAXSTEP_Y = 10 WOBBLE_Z = 1 Z_NOMINAL = 40 # Increasing packet seq number _...
Python
0
7e30de04cad1070eb84c1de0c370e950b5e2c783
Annotate zerver.views.webhooks.pingdom.
zerver/views/webhooks/pingdom.py
zerver/views/webhooks/pingdom.py
# Webhooks for external integrations. from __future__ import absolute_import from typing import Any from django.utils.translation import ugettext as _ from django.http import HttpRequest, HttpResponse from zerver.lib.actions import check_send_message from zerver.lib.response import json_success, json_error from zerve...
# Webhooks for external integrations. from __future__ import absolute_import from django.utils.translation import ugettext as _ from zerver.lib.actions import check_send_message from zerver.lib.response import json_success, json_error from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view ...
Python
0
d8c359b27d371f5bd66825202860a0a376a2466c
add script to convert old plans to new ones
jsonQueries/old_to_new_plan.py
jsonQueries/old_to_new_plan.py
#!/usr/bin/env python import json import sys def read_json(filename): with open(filename, 'r') as f: return json.load(f) def uniquify_fragments(query_plan): fragment_inv = [] for worker in sorted(query_plan.keys()): worker_plan = query_plan[worker] for fragment in worker_plan: ...
Python
0
f71ce70330f7dea86820f1d9cdc390ea972aaeca
add 2s-complement
algorithms/bit-manipulation/2s-complement.py
algorithms/bit-manipulation/2s-complement.py
import sys def ones(x): uCount = x - ((x >> 1) & 033333333333) - ((x >> 2) & 011111111111); return ((uCount + (uCount >> 3)) & 030707070707) % 63; def count(x): if x >= 0: if x == 0: return 0 if x % 2 == 0: return count(x - 1) + ones(x) return (x + 1) / 2 + ...
Python
0.999978
27a6b27a74f7c3a52c08b7dc3fbcc810a680b89d
Add a generic namespaced lock queue.
lib/python2.6/aquilon/locks.py
lib/python2.6/aquilon/locks.py
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- import logging from threading import Condition, Lock from aquilon.exceptions_ import InternalError LOGGER = logging.getLogger('aquilon.locks') class LockQueue(object): """Provide a layered (namespaced?) locking ...
Python
0
173565f7f2b9ffa548b355a0cbc8f972f1445a50
Add test coverage for rdopkg.guess version2tag and tag2version
tests/test_guess.py
tests/test_guess.py
from rdopkg import guess from collections import namedtuple import pytest VersionTestCase = namedtuple('VersionTestCase', ('expected', 'input_data')) data_table_good = [ VersionTestCase(('1.2.3', None), '1.2.3'), VersionTestCase(('1.2.3', 'vX.Y.Z'), 'v1.2.3'), VersionTestCase(('1.2.3', 'VX.Y.Z'), 'V1.2.3...
Python
0
7b5abb9bf56ed0da2b79f757bb27438d95589d52
change in irpp 2010 real amount
tests/test_irpp1.py
tests/test_irpp1.py
# -*- coding: utf-8 -*- # OpenFisca -- A versatile microsimulation software # By: OpenFisca Team <contact@openfisca.fr> # # Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team # https://github.com/openfisca # # This file is part of OpenFisca. # # OpenFisca is free software; you can redistribute it and/or modify # it ...
Python
0
e50060ca76c667b77db433ca03ef640140831dc9
Add migration for dagman_metrics
migrations/004_add_dagman_metrics.py
migrations/004_add_dagman_metrics.py
import migrations conn = migrations.connect() cur = conn.cursor() cur.execute(""" create table dagman_metrics ( id INTEGER UNSIGNED NOT NULL, ts DOUBLE, remote_addr VARCHAR(15), hostname VARCHAR(256), domain VARCHAR(256), version VARCHAR(10), wf_uuid VARCHAR(36), root_wf_uuid VARCHAR(...
Python
0.000001
dc314e50a573f3ecb2cf41d1e08df29ea991d3b6
Add migrations versions
migrations/versions/d71a3e9499ef_.py
migrations/versions/d71a3e9499ef_.py
"""empty message Revision ID: d71a3e9499ef Revises: Create Date: 2017-11-21 23:19:12.740735 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'd71a3e9499ef' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
Python
0.000001
5bac311ac9da94edbd08b0b43c5214ba6b9fc1c8
add scollable pages
app2.py
app2.py
from webkit import WebView import pygtk pygtk.require('2.0') import gtk, threading, time from nuimo import NuimoScanner, Nuimo, NuimoDelegate class App: def __init__(self): window = gtk.Window(gtk.WINDOW_TOPLEVEL) fixed = gtk.Fixed() views = [WebView(), WebView(), WebView()] width =...
Python
0
4933e4ca107516a667ae3449337746bf7e002cc2
Create bkvm.py
bkvm.py
bkvm.py
#!/usr/bin/python import commands, time def prepareTarget(): print "prepare backup Target" print "---------------------" cmd = "mount -t cifs //10.0.0.9/public/BK\ VM\ XEN -o username=xxx,password=yyy /bak/" output = commands.getoutput(cmd) cmd = "ls -lht --time-style=\"long-iso\" /bak/" output = c...
Python
0.000002
e050d9ce4fb4d63ec7857f581033258f87c805b0
Create pyPdfMerger.py
pyPdfMerger.py
pyPdfMerger.py
# -*- coding: utf-8 -*- """ TITLE: pyPdfMerger.py AUTHOR: John Himics EMAIL: john@johnhimics.com TIMEZONE: EST VERSION: 0 DESCRIPTION: Merges pdf files together DEPENDANCIES: PyPDF2 """ from PyPDF2 import PdfFileMerger #Global Variables merger = PdfFileMerger() #Methods #Program starts here if...
Python
0
62e65ae978b703b6af0b594e958e79d467e83421
add 63
python/p063.py
python/p063.py
def g(power): count = 0 i = 1 min = 10**(power - 1) max = 10**power - 1 while True: result = i**power if result >= min: if result <= max: count += 1 else: break i += 1 return count count = 0 for i in xrange(1, 100...
Python
0.99912
600bf1bbce7db5f62d55537a33d4586fa2892d8a
Create conf.py
conf.py
conf.py
#OK
Python
0.000001
66c8c6f587c49f587901cf6a9cf7e122d110d668
Add migration to encrypt secrets
migrations/versions/3bac7f8ccfdb_encrypt_secrets.py
migrations/versions/3bac7f8ccfdb_encrypt_secrets.py
"""encrypt_secrets Revision ID: 3bac7f8ccfdb Revises: 291237183b82 Create Date: 2019-01-14 17:35:58.872052 """ # revision identifiers, used by Alembic. revision = '3bac7f8ccfdb' down_revision = '291237183b82' from alembic import op, context import sqlalchemy as sa # def upgrade(): # op.add_column('secret', # ...
Python
0
45cb6df45df84cb9ae85fc8aa15710bde6a15bad
Add create image functional negative tests
nova/tests/functional/test_images.py
nova/tests/functional/test_images.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 # d...
Python
0.000005
18e2263a636e97519272a21562cbba4b978fcf49
Create EmailForm
headlines/forms.py
headlines/forms.py
from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField, SubmitField from wtforms.validators import DataRequired, Email class EmailForm(FlaskForm): """ Form used to submit messages to the admin. """ name = StringField('Name') reply_to = StringField('Email', validators=[Email(), Data...
Python
0
61b21d1ec14e0be683f8da2b92b3ca2aa9fdcf59
add sample for api caller
InvenTree/plugin/samples/integration/api_caller.py
InvenTree/plugin/samples/integration/api_caller.py
""" Sample plugin for calling an external API """ from django.utils.translation import ugettext_lazy as _ from plugin import IntegrationPluginBase from plugin.mixins import APICallMixin, SettingsMixin class SampleApiCallerPlugin(APICallMixin, SettingsMixin, IntegrationPluginBase): """ A small api call sample...
Python
0
1a68a1a461a66c4a4aaf3a19a607ab64475cb05c
Create simpleExamples.py
simpleExamples.py
simpleExamples.py
import DSM as dsmx import random as rnd import copy def example1(): myDSM=dsmx.DSM('example') ## adding components myDSM.addComponent(['c1']) myDSM.addComponent(['c2']) myDSM.addComponent(['c3']) # myDSM.display() print "--------" ## adding relations between existing component...
Python
0.000001
d5fcaf05d100d3fe709b34b8f6b839736773a130
Create dict.py
dict.py
dict.py
import random a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s"\ ,"t","u","v","w","x","y","z"] def create(): dictionary=open("dictionary.py","w") tablewenn=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s"\ ,"t","u","v","w","x","y","z"," "] table...
Python
0.000001
2fba29b90156e844d7d61a15c9ad9c37e2b5dfe2
load template
examples/aimsun/load_template.py
examples/aimsun/load_template.py
""" Load an already existing Aimsun template and run the simulation """ from flow.core.experiment import Experiment from flow.core.params import AimsunParams, EnvParams, NetParams from flow.core.params import VehicleParams from flow.envs import TestEnv from flow.scenarios.loop import Scenario from flow.controllers.rlc...
Python
0.000001
c6f6278c1915ef90e8825f94cc33a4dea4124722
Add http directory listing with content display
network/http_server_cat.py
network/http_server_cat.py
#!/bin/env python3 import http.server import string import click import pathlib import urllib.parse import os @click.command() @click.argument("port", required=False) @click.option("-s", "--server", default="0.0.0.0") def main(port, server): if not port: port = 8888 http_server = http.server.HTTPServe...
Python
0
8fa81263cfcc63f6bf22ed2ad50103f91bc43b21
Create hira.py
hira.py
hira.py
#coding:utf-8 import hashlib start = ord(u'あ') end = ord(u'ん') hira = [] print "Create hiragana" for i in range(start, end+1, 1): hira.append(unichr(i).encode('utf-8')) num = len(hira) for i4 in range(num): for i3 in range(num): for i2 in range(num): for i1 in range(num): ...
Python
0.000002
92bc1ad22b6147f61ef4b51b16e115109bc04596
add build.gyp
build.gyp
build.gyp
{ 'targets':[ { 'target_name':'start_first', 'type':'executable', 'dependencies':[], 'defines':[], 'include_dirs':[], 'sources':[ 'start_first/opengl_first.c', ], 'libraries':[ '-lG...
Python
0.000001
45a0b65106f665872f14780e93ab9f09e65bbce3
add genRandomGraph.py
ComplexCiPython/genRandomGraph.py
ComplexCiPython/genRandomGraph.py
import networkx import sys if len(sys.argv) < 2: print ("python genRandomGraph.py [output folder]"); input() sys.exit(0); outputPath = sys.argv[1] G=networkx.erdos_renyi_graph(100000,3/100000) networkx.write_edgelist(G, outputPath + "/genRandomGraph.csv", data=False , delimiter=',')
Python
0.000001
3b15fb1d43bad6d6cf2112538d1de8c1710d0272
add test for within_page_range
freelancefinder/freelancefinder/tests/test_within_page_range_templatetag.py
freelancefinder/freelancefinder/tests/test_within_page_range_templatetag.py
"""Test the within_page_range function.""" from ..templatetags.within_page_range import within_filter def test_in_range_above(): """One page above current should be displayed.""" test_page = 5 current_page = 4 result = within_filter(test_page, current_page) assert result def test_in_range_belo...
Python
0.000001
0c315f766b31c105c60b39746db977d6702955ca
Remove unneeded model attributes
successstories/views.py
successstories/views.py
from django.contrib import messages from django.core.urlresolvers import reverse from django.utils.decorators import method_decorator from django.views.generic import CreateView, DetailView, ListView from honeypot.decorators import check_honeypot from .forms import StoryForm from .models import Story, StoryCategory ...
from django.contrib import messages from django.core.urlresolvers import reverse from django.utils.decorators import method_decorator from django.views.generic import CreateView, DetailView, ListView from honeypot.decorators import check_honeypot from .forms import StoryForm from .models import Story, StoryCategory ...
Python
0.000001
9abb8108f62451fb993a398c8165a4605e40ec4a
Add tests for JSONPResponseMiddleware
mapit/tests/test_middleware.py
mapit/tests/test_middleware.py
from django.test import TestCase from django.test.client import RequestFactory from django.http import HttpResponse, HttpResponsePermanentRedirect from ..middleware import JSONPMiddleware class JSONPMiddlewareTest(TestCase): def setUp(self): self.middleware = JSONPMiddleware() self.factory = Req...
Python
0
e20d3ff6147b857cb9a8efa32bfb4ee80610dd34
Revert "dump"
dump/fastMessageReaderOriginal.py
dump/fastMessageReaderOriginal.py
#!/usr/bin/python import sys import re # ============================================================================ class MessageReader: messageRegexp = r"s*(\w+)\[\d+\]=(.*?)(?=\s\w+\[\d+\]|$)"; def __init__(self, fileName): self.fileName = fileName #self.file = open(fileName, encoding...
Python
0.000002
f917c7ccfbe22a50049e76957a05f35eaaa46b2a
migrate child table
polling_stations/apps/addressbase/migrations/0010_remove_onsud_ctry_flag.py
polling_stations/apps/addressbase/migrations/0010_remove_onsud_ctry_flag.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-02-15 14:12 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [("addressbase", "0009_onsud_ced")] operations = [migrations.RemoveField(model_name="onsud", name="ctry_fl...
Python
0.000002
1553cdda2edc16368ba2281616923e849f09bdee
Create matching_{x,y}.py
hacker_rank/regex/repetitions/matching_{x,y}.py
hacker_rank/regex/repetitions/matching_{x,y}.py
Regex_Pattern = r'^\d{1,2}[a-zA-Z]{3,}\W{0,3}$' # Do not delete 'r'.
Python
0.998695
527a53ee1e43f59462b94b50ea997058836a7031
Create voicersss-inmoovservice-test.py
home/moz4r/Test/voicersss-inmoovservice-test.py
home/moz4r/Test/voicersss-inmoovservice-test.py
i01 = Runtime.createAndStart("i01", "InMoov") i01.mouth = Runtime.createAndStart("i01.mouth", "voiceRSS") python.subscribe(i01.mouth.getName(),"publishStartSpeaking") python.subscribe(i01.mouth.getName(),"publishEndSpeaking") def onEndSpeaking(text): print "end speak" def onStartSpeaking(text): print "start speak" ...
Python
0
75980fc2e2f63e210f1e58e9a1d56c09072aa04e
add play_camera.py
python/video/play_camera.py
python/video/play_camera.py
#!/usr/bin/env python3 # encoding: utf-8 # pylint: disable=no-member """Play a video with OpenCV.""" import sys import cv2 def main(): """The main function of this module.""" cv2.namedWindow('video', cv2.WINDOW_AUTOSIZE) cap = cv2.VideoCapture(0) i = 0 while cap.isOpened(): ret, frame = ...
Python
0.000002
6dfc5a3d7845633570b83aac06c47756292cf8ac
Add tests for get_uid() method for common DB models.
st2common/tests/unit/test_db_model_uids.py
st2common/tests/unit/test_db_model_uids.py
# 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 not use this file except in compliance with # the License. You may obtain a ...
Python
0
5d64acfd475ca0bb0db2ef7c032fc4ee16df4f75
remove highlight table
alembic/versions/186928676dbc_remove_highlights.py
alembic/versions/186928676dbc_remove_highlights.py
"""remove_highlights Revision ID: 186928676dbc Revises: f163a00a02aa Create Date: 2019-06-01 15:14:13.999836 """ # revision identifiers, used by Alembic. revision = '186928676dbc' down_revision = 'f163a00a02aa' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa from sqlalchemy.dia...
Python
0.000005
8658ad72c74306617e58ca82ff0f3fdba35bd353
implement auto build database interface
app/tools/dbautocreat.py
app/tools/dbautocreat.py
#-*- coding:utf-8 -*- import asyncio import aiomysql from tools.config import Config class AutoCreate(obj): def __init__(self): pass def _create_db(self): pass def _create_field_type(self): pass def _create_field_primary_key(self): pass def _create_field_unique_key(self): pass def _create_auto_increme...
Python
0
36b8c44f8c2554109ab4ab09add9ac10fae20781
add entities orm
cliche/services/tvtropes/entities.py
cliche/services/tvtropes/entities.py
from sqlalchemy import Column, DateTime, ForeignKey, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship Base = declarative_base() __all__ = 'Entity' class Entity(Base): namespace = Column(String, primary_key=True) name = Column(String, primary_key=True) ...
Python
0.000406
ad664a7722da63d783a2b9d73077d91a8a012057
Create hello.py
Python/hello.py
Python/hello.py
print("hello world!!!")
Python
0.999979
dfed8f837b5fe07445b3914b33c1dab1b0b5741b
add basic UAV object incl. very basic search algo
uav.py
uav.py
import random class Uav: def __init__(x,y, worldMap): self.x = x self.y = y self.worldMap = worldMap self.sensorStrength = None def setMap(self, newMap): self.worldMap = newMap def nextStep(self): """ where should we go next tick? """ options = self...
Python
0
8d1946c9656ea6c29d4730a68cbf4610152cd98b
make migrations
poll/migrations/0002_vote_user_id.py
poll/migrations/0002_vote_user_id.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('poll', '0001_initial'), ] operations = [ migrations.AddField( model_name='vote', name='user_id', ...
Python
0.000057
64109dddedb7441456ae8e255c6a4b20ccaa6a73
Create ReinhardNorm.py
ReinhardNorm.py
ReinhardNorm.py
import numpy def ReinhardNorm(I, TargetMu, TargetSigma): ''' Performs Reinhard color normalization to transform the color characteristics of an image to a desired standard. The standard is defined by the mean and standard deviations of the target image in LAB color space defined by Ruderman. The input image is conver...
Python
0.000001
ebabfa0e14bdfd061e248285b8f7b5473f5a676e
Create convert_to_morse.py
morse_code/convert_to_morse.py
morse_code/convert_to_morse.py
from ConfigParser import SafeConfigParser import string target = 'target.txt' def parse_ini(): parser = SafeConfigParser() parser.read('conversion.ini') morselist = list(string.ascii_uppercase) number = 0 for i in morselist: i = parser.get('CONVERSIONS', i) morselist[number] = i ...
Python
0.998175
fcb311ffd264821767f58c92e96101aa8086acf5
rewrite DHKE.py as crypto.py
crypto.py
crypto.py
import random import time timestamp = int(time.time()) random.seed(timestamp) def gen_check(n): if not isprime(n): while not isprime(n): n = random.randint(0, timestamp) def input_check(n): if not isprime(n): n = input("Sorry, that number isn't prime. Please try another: ") de...
Python
0.999999
81c793870387910cd0c4eda02b2b95588a02cc7f
Add files via upload
cypher.py
cypher.py
#!/usr/bin/python import argparse, sys ALPHABET_SIZE = 26 parser = argparse.ArgumentParser(description='Encrypts a message from a text file.') parser.add_argument('walzenlage1', metavar='w1', type=int, action='store', help='') parser.add_argument('walzenlage2', metavar='w2', type=int, action='stor...
Python
0.000001
47c8aa34eb9f4d2c4f702bc3957c87ef92cf7d28
add simple learning switch app for OF1.3
ryu/app/simple_switch_13.py
ryu/app/simple_switch_13.py
# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation. # # 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
615e51ce1bf15c012a6c7cc2d026cb69bf0ce2b8
Create MAIN.py
MAIN.py
MAIN.py
def pythagoras(SIDE, LEN1, LEN2): from math import sqrt # This is function is needed to work, it **SHOULD** be included with the default install. ANSWER = "Error Code 1" # This should not logicaly happen if the user is not an idiot and follows the usage. if type(LEN1) is str or type(LEN2) is st...
Python
0.000002
cbe0d5b37d4055ea78568838c3fd4cc953342b80
remove stale data
geoconnect/apps/gis_tabular/utils_stale_data.py
geoconnect/apps/gis_tabular/utils_stale_data.py
from datetime import datetime, timedelta from apps.gis_tabular.models import TabularFileInfo # for testing from apps.gis_tabular.models import WorldMapTabularLayerInfo,\ WorldMapLatLngInfo, WorldMapJoinLayerInfo from apps.worldmap_connect.models import WorldMapLayerInfo DEFAULT_STALE_AGE = 3 * 60 * 60 # 3...
Python
0.002077
cb56e0151b37a79e2ba95815555cde0633e167e7
add client subscribe testing
samples/client_subscribe.py
samples/client_subscribe.py
import logging from hbmqtt.client._client import MQTTClient import asyncio logger = logging.getLogger(__name__) C = MQTTClient() @asyncio.coroutine def test_coro(): yield from C.connect(uri='mqtt://iot.eclipse.org:1883/', username=None, password=None) yield from C.subscribe([ {'filter': '$SY...
Python
0
c422b5019c6e638bce40a7fecef6977aa5e63ce0
add __init__.py
python/18-package/parent/__init__.py
python/18-package/parent/__init__.py
#!/usr/bin/env python #-*- coding=utf-8 -*- if __name__ == "__main__": print "Package parent running as main program" else: print "Package parent initializing"
Python
0.00212
8d6a5c4092d4f092416fc39fc7faa8bb20e701c3
Add a manage command to sync reservations from external hook .. hard coded first product only atm (cherry picked from commit 63a80b711e1be9a6047965b8d0061b676d8c50ed)
cartridge/shop/management/commands/syncreshooks.py
cartridge/shop/management/commands/syncreshooks.py
from django.core.management.base import BaseCommand from django.core.management.base import CommandError from mezzanine.conf import settings from cartridge.shop.models import * class Command(BaseCommand): help = 'Sync reservations from external hook' def handle(self, *args, **options): p = Reservable...
Python
0
afab4bcd795da4395920eab6107bc33e401ed86a
Create PiWS.py
PiWS.py
PiWS.py
import time import datetime import csv from math import log from flask import Flask, render_template from sense_hat import SenseHat app = Flask(__name__) def weather(): sense = SenseHat() sense.clear() celcius = round(sense.get_temperature(), 1) fahrenheit = round(1.8 * celcius + 32, 1) humidity ...
Python
0.000001
7e71b21f655ec35bd5ebd79aeb5dbec6945a77a7
Add purdue harvester
scrapi/harvesters/purdue.py
scrapi/harvesters/purdue.py
''' Harvester for the Purdue University Research Repository for the SHARE project Example API call: http://purr.purdue.edu/oaipmh?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester class PurdueHarvester(OAIHarvester): short_name = 'purdue' ...
Python
0.999533
7ecfe7d20f8708a1dada5761cdc02905b0e370e5
use correct separator
scripts/ci/wheel_factory.py
scripts/ci/wheel_factory.py
#!/usr/bin/env python import requirements import argparse import glob import os parser = argparse.ArgumentParser() parser.add_argument('file', help="requirements.txt", type=str) parser.add_argument('wheeldir', help="wheeldir location", type=str) args = parser.parse_args() req_file = open(args.file, 'r') for req in ...
#!/usr/bin/env python import requirements import argparse import glob import os parser = argparse.ArgumentParser() parser.add_argument('file', help="requirements.txt", type=str) parser.add_argument('wheeldir', help="wheeldir location", type=str) args = parser.parse_args() req_file = open(args.file, 'r') for req in ...
Python
0.000691
027a199924ee256170a2e369733a57fcc7483c88
Add missing numeter namespace in poller
poller/numeter/__init__.py
poller/numeter/__init__.py
__import__('pkg_resources').declare_namespace(__name__)
Python
0.00005
6557ef962a4147e5995347c11b8a8a14b26495f0
Add a facility to delegate credentials to another principal. This is currently useless, since nobody can verify delegated credentials yet.
protogeni/test/delegate.py
protogeni/test/delegate.py
#! /usr/bin/env python # # EMULAB-COPYRIGHT # Copyright (c) 2009 University of Utah and the Flux Group. # All rights reserved. # # Permission to use, copy, modify and distribute this software is hereby # granted provided that (1) source code retains these copyright, permission, # and disclaimer notices, and (2) redist...
Python
0
95e09bf90e898092eaf841eac0330287f5627533
Add files via upload
demo_video_args.py
demo_video_args.py
#!/usr/bin/env python #./tools/demo_webcam.py --net output/faster_rcnn_end2end/train/ZF_faster_rcnn_iter_10000.caffemodel --prototxt models/FACEACT/ZF/faster_rcnn_end2end/test.prototxt # -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT Lice...
Python
0.999913
2022245c9172037bf71be29d0da53f1c47f6aac9
guess user number: python3
guess_user_number/python3/guess_user_number.py
guess_user_number/python3/guess_user_number.py
#!/usr/bin/python min=1 max=100 print("Think of a number from "+str(min)+" to "+str(max)+". Then, tell the computer if its guess is correct (Y), lower than the number (L), or higher than the number (H).") found=False while not found: mid = int((max-min)/2+min) response = input(str(mid)+"? >>> ") response = resp...
Python
0.999999
7420f49f8e1508fa2017c629d8d11a16a9e28c4a
add abstract biobox class
biobox_cli/biobox.py
biobox_cli/biobox.py
from abc import ABCMeta, abstractmethod import biobox_cli.container as ctn import biobox_cli.util.misc as util import tempfile as tmp class Biobox: __metaclass__ = ABCMeta @abstractmethod def prepare_volumes(opts): pass @abstractmethod def get_doc(self): pass @abstractmet...
Python
0.000001
4d1b006e5ba559715d55a88528cdfc0bed755182
add import script for Weymouth
polling_stations/apps/data_collection/management/commands/import_weymouth.py
polling_stations/apps/data_collection/management/commands/import_weymouth.py
from data_collection.management.commands import BaseXpressDCCsvInconsistentPostcodesImporter class Command(BaseXpressDCCsvInconsistentPostcodesImporter): council_id = 'E07000053' addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017WPBC.TSV' stations_name = 'parl.2017-06-08/Version 1/Democ...
Python
0
2ce80e667de438fca20de7b4ab6847751b683e33
Add digikey command.
src/commands/digikey.py
src/commands/digikey.py
# # Copyright (c) 2013 Joshua Hughes <kivhift@gmail.com> # import urllib import webbrowser import qmk class DigikeyCommand(qmk.Command): """Look up a part on Digi-Key. A new tab will be opened in the default web browser that contains the search results. """ def __init__(self): self._name ...
Python
0.000001
8b4bbd23bf37fb946b664f5932e4903f802c6e0d
Add first pass at integration style tests
flake8/tests/test_integration.py
flake8/tests/test_integration.py
from __future__ import with_statement import os import unittest try: from unittest import mock except ImportError: import mock # < PY33 from flake8 import engine class IntegrationTestCase(unittest.TestCase): """Integration style tests to exercise different command line options.""" def this_file(se...
Python
0
0d2adfcce21dd2efb5d781babec3e6b03464b6d5
Add basic tests
tests/app/main/test_request_header.py
tests/app/main/test_request_header.py
from tests.conftest import set_config_values def test_route_correct_secret_key(app_, client): with set_config_values(app_, { 'ROUTE_SECRET_KEY_1': 'key_1', 'ROUTE_SECRET_KEY_2': '', 'DEBUG': False, }): response = client.get( path='/_status', headers=[ ...
Python
0.000004
77af87198d1116b77df431d9139b30f76103dd64
Add migration for latitute and longitude of event
fellowms/migrations/0023_auto_20160617_1350.py
fellowms/migrations/0023_auto_20160617_1350.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-06-17 13:50 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fellowms', '0022_event_report_url'), ] operations = [ migrations.AddField( ...
Python
0.000001
fb07837db870a5fdea3a98aa1381793b1b20d2c0
Create main.py
main.py
main.py
import webapp2 import jinja2 import os import urllib from google.appengine.api import users from google.appengine.ext import ndb JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), extensions=['jinja2.ext.autoescape'], autoescape=True) def user_key(id): ...
Python
0.000001
b920f5aeecf7843fcc699db4a70a9a0f124fa198
Add unit test for protonate.py
tests/test_protonate.py
tests/test_protonate.py
import propka.atom import propka.protonate def test_protonate_atom(): atom = propka.atom.Atom( "HETATM 4479 V VO4 A1578 -19.097 16.967 0.500 1.00 17.21 V " ) assert not atom.is_protonated p = propka.protonate.Protonate() p.protonate_atom(atom) assert atom.is_proto...
Python
0
f502b9bb7c0cddda05cd85cf60f88f0a801b43d1
Add docstrings
flocker/common/script.py
flocker/common/script.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """Helpers for flocker shell commands.""" import sys from twisted.internet.task import react from twisted.python import usage from zope.interface import Interface from .. import __version__ def flocker_standard_options(cls): """ Add various sta...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """Helpers for flocker shell commands.""" import sys from twisted.internet.task import react from twisted.python import usage from zope.interface import Interface from .. import __version__ def flocker_standard_options(cls): """ Add various sta...
Python
0.000005
addba07842f95e9b5bac3a97ddb4f81035bb2fc8
Don't add args that return None names
ouimeaux/device/api/service.py
ouimeaux/device/api/service.py
import logging from xml.etree import cElementTree as et import requests from .xsd import service as serviceParser log = logging.getLogger(__name__) REQUEST_TEMPLATE = """ <?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.o...
import logging from xml.etree import cElementTree as et import requests from .xsd import service as serviceParser log = logging.getLogger(__name__) REQUEST_TEMPLATE = """ <?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.o...
Python
0.999303
2bf763e39e91ef989c121bba420e4ae09ea0a569
Add Diagonal Difference HackerRank Problem
algorithms/diagonal_difference/kevin.py
algorithms/diagonal_difference/kevin.py
#!/usr/bin/env python def get_matrix_row_from_input(): return [int(index) for index in input().strip().split(' ')] n = int(input().strip()) primary_diag_sum = 0 secondary_diag_sum = 0 for row_count in range(n): row = get_matrix_row_from_input() primary_diag_sum += row[row_count] secondary_diag_sum +...
Python
0.000006
9098904ffcd47c4327594f8fc6ce8ce8694e5422
Create getsubinterfaces.py
python/getsubinterfaces.py
python/getsubinterfaces.py
#Device subinterface data retrieval script. Copyright Ingmar Van Glabbeek ingmar@infoblox.com #Licensed under Apache-2.0 #This script will pull all devices of a given device group and then list the devices management ip as well as the available management ips. #By default it saves the output to "deviceinterfacedump.js...
Python
0.000001
9b0b3c474e250193730308b555034d458697e01b
Fix dispatching of WeMo switch devices.
homeassistant/components/wemo.py
homeassistant/components/wemo.py
""" homeassistant.components.wemo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WeMo device discovery. For more details about this component, please refer to the documentation at https://home-assistant.io/components/wemo/ """ import logging from homeassistant.components import discovery from homeassistant.const import EVENT_H...
""" homeassistant.components.wemo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WeMo device discovery. For more details about this component, please refer to the documentation at https://home-assistant.io/components/wemo/ """ import logging from homeassistant.components import discovery from homeassistant.const import EVENT_H...
Python
0
54a8a77c75660eeae314c410685243e2b5bc59ca
add sw infer wrapper
dltk/core/utils.py
dltk/core/utils.py
import numpy as np from dltk.core.io.sliding_window import SlidingWindow def sliding_window_segmentation_inference(session, ops_list, sample_dict, batch_size=1): """ Parameters ---------- session ops_list sample_dict Returns ------- """ # TODO: asserts pl_shape = list(s...
Python
0.000012
c262cc4cc18336257972105c1cd6c409da8ed5cd
Create mcmc.py
mcmc.py
mcmc.py
# MIT License # Copyright (c) 2017 Rene Jean Corneille # 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, modify, m...
Python
0.000031
4b561d710e9ad72ad94ffb1ff3ae37db668899e4
Add generate_examples script
seq2seq/scripts/generate_examples.py
seq2seq/scripts/generate_examples.py
#! /usr/bin/env python """ Generates a TFRecords file given sequence-aligned source and target files. Example Usage: python ./generate_examples.py --source_file <SOURCE_FILE> \ --target_file <TARGET_FILE> \ --output_file <OUTPUT_FILE> """ import tensorflow as tf tf.flags.DEFINE_string('source_file', None, ...
Python
0.000002
edb28fffe19e2b0de3113b43aeb075119c9e5830
Work in progress. Creating new data migration.
emgapi/migrations/0019_auto_20200110_1455.py
emgapi/migrations/0019_auto_20200110_1455.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.24 on 2020-01-10 14:55 from __future__ import unicode_literals from django.db import migrations def create_download_description(apps, schema_editor): DownloadDescriptionLabel = apps.get_model("emgapi", "DownloadDescriptionLabel") downloads = ( ("Phyl...
Python
0
d41274ce2a54d37c35f23c8c78de196e57667b0a
add google translate plugin
plugins_examples/translate.py
plugins_examples/translate.py
#!/usr/bin/env python import sys import re from googletrans import Translator translator = Translator() line = sys.stdin.readline() while line: match = re.search('^:([^\s]+) PRIVMSG (#[^\s]+) :(.+)', line) if not match: line = sys.stdin.readline() continue who = match.group(1) chan = m...
Python
0
b450734eea74f5f3536a44ed40c006c3da13656c
Add diff.py
diff.py
diff.py
# vim: set et ts=4 sw=4 fdm=marker """ MIT License Copyright (c) 2016 Jesse Hogan 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 u...
Python
0.000001
176af82121da5282842fd7e77809da9780ac57a5
implement server pool.
rsocks/pool.py
rsocks/pool.py
from __future__ import unicode_literals import logging import contextlib from .eventlib import GreenPool from .utils import debug __all__ = ['ServerPool'] logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG if debug() else logging.INFO) logger.addHandler(logging.StreamHandler()) class ServerPool(o...
Python
0
416d2b0ffd617c8c6e58360fefe554ad7dc3057b
add example for discovering existing connections
examples/connections.py
examples/connections.py
""" Print out a list of existing Telepathy connections. """ import dbus.glib import telepathy prefix = 'org.freedesktop.Telepathy.Connection.' if __name__ == '__main__': for conn in telepathy.client.Connection.get_connections(): conn_iface = conn[telepathy.CONN_INTERFACE] handle = conn_iface.Ge...
Python
0.000001
ff53f699ac371266791487f0b863531dd8f5236a
Add hug 'hello_world' using to be developed support for optional URLs
examples/hello_world.py
examples/hello_world.py
import hug @hug.get() def hello_world(): return "Hello world"
Python
0.000009
397ab61df61d5acac46cf60ede38fa928fdacd7c
Create solution.py
data_structures/linked_list/problems/pos_num_to_linked_list/solution.py
data_structures/linked_list/problems/pos_num_to_linked_list/solution.py
import LinkedList # Linked List Node inside the LinkedList module is declared as: # # class Node: # def __init__(self, val, nxt=None): # self.val = val # self.nxt = nxt # def ConvertPositiveNumToLinkedList(val: int) -> LinkedList.Node: node = None while True: dig = va...
Python
0.000018
724bc46c85e6ea75ac8d786f4d1706b74df8f330
Create dictid.py
dictid.py
dictid.py
a = (1,2) b = [1,2] c = {a: 1} # outcome: c= {(1,2): 1} d = {b: 1} # outcome: error
Python
0.000001
0fb7a5559f525ab1149ac41d4b399442f7649664
add script to show statistics (number of chunks, data volume)
scale_stats.py
scale_stats.py
#! /usr/bin/env python3 # # Copyright (c) 2016, 2017, Forschungszentrum Juelich GmbH # Author: Yann Leprince <y.leprince@fz-juelich.de> # # This software is made available under the MIT licence, see LICENCE.txt. import collections import json import math import os import os.path import sys import numpy as np SI_PRE...
Python
0
7d574c1f6d194df1f2b2009fb2e48fbaacaca873
Add migration for_insert_base
oedb_datamodels/versions/6887c442bbee_insert_base.py
oedb_datamodels/versions/6887c442bbee_insert_base.py
"""Add _insert_base Revision ID: 6887c442bbee Revises: 3886946416ba Create Date: 2019-04-25 16:09:20.572057 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '6887c442bbee' down_revision = '3886946416ba' branch_labels = None depends_on = None def upgrade(): ...
Python
0.000002
2ef707337adc3d0abc33ca638b2adb70a681bd12
update for new API
doc/examples/filters/plot_denoise.py
doc/examples/filters/plot_denoise.py
""" ==================== Denoising a picture ==================== In this example, we denoise a noisy version of the picture of the astronaut Eileen Collins using the total variation and bilateral denoising filter. These algorithms typically produce "posterized" images with flat domains separated by sharp edges. It i...
""" ==================== Denoising a picture ==================== In this example, we denoise a noisy version of the picture of the astronaut Eileen Collins using the total variation and bilateral denoising filter. These algorithms typically produce "posterized" images with flat domains separated by sharp edges. It i...
Python
0
9e6a016c5a59b25199426f6825b2c83571997e68
Refactor buildbot tests so that they can be used downstream.
build/android/buildbot/tests/bb_run_bot_test.py
build/android/buildbot/tests/bb_run_bot_test.py
#!/usr/bin/env python # Copyright (c) 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. import os import subprocess import sys BUILDBOT_DIR = os.path.join(os.path.dirname(__file__), '..') sys.path.append(BUILDBOT_DIR) ...
#!/usr/bin/env python # Copyright (c) 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. import os import subprocess import sys BUILDBOT_DIR = os.path.join(os.path.dirname(__file__), '..') sys.path.append(BUILDBOT_DIR) ...
Python
0.000099
eb9f9d8bfa5ea278e1fb39c59ed660a223b1f6a9
Add flask api app creation to init
api/__init__.py
api/__init__.py
from flask_sqlalchemy import SQLAlchemy import connexion from config import config db = SQLAlchemy() def create_app(config_name): app = connexion.FlaskApp(__name__, specification_dir='swagger/') app.add_api('swagger.yaml') application = app.app application.config.from_object(config[config_name]) ...
Python
0.000001
c10eb3861daf48c13ec854bd210db5d5e1163b11
Add LotGroupAutocomplete
livinglots_lots/autocomplete_light_registry.py
livinglots_lots/autocomplete_light_registry.py
from autocomplete_light import AutocompleteModelBase, register from livinglots import get_lotgroup_model class LotGroupAutocomplete(AutocompleteModelBase): autocomplete_js_attributes = {'placeholder': 'lot group name',} search_fields = ('name',) def choices_for_request(self): choices = super(Lot...
Python
0
a5081ac307e037caee6bbd1add49d4c0d9424353
Fix wake_on_lan for german version of Windows 10 (#6397) (#6398)
homeassistant/components/switch/wake_on_lan.py
homeassistant/components/switch/wake_on_lan.py
""" Support for wake on lan. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.wake_on_lan/ """ import logging import platform import subprocess as sp import voluptuous as vol from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHE...
""" Support for wake on lan. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.wake_on_lan/ """ import logging import platform import subprocess as sp import voluptuous as vol from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHE...
Python
0
2527683522394c823bc100c75f1ce4885949136e
add paths module for other modules to find paths from one place
glim/paths.py
glim/paths.py
import os from termcolor import colored PROJECT_PATH = os.getcwd() APP_PATH = os.path.join(PROJECT_PATH, 'app') EXT_PATH = os.path.join(PROJECT_PATH, 'ext') GLIM_ROOT_PATH = os.path.dirname(os.path.dirname(__file__)) PROTO_PATH = os.path.join(os.path.dirname(__file__), 'prototype') import sys from pprint import pprin...
Python
0
24f21146b01ff75a244df40d1626c54883abeb1a
Add helper-lib for json object conversion and split dicts
lib/helpers.py
lib/helpers.py
#! /usr/bin/env python2.7 import datetime def typecast_json(o): if isinstance(o, datetime.datetime) or isinstance(o, datetime.date): return o.isoformat() else: return o def split_dict(src, keys): result = dict() for k in set(src.keys()) & set(keys): result[k] = src[k] return result
Python
0