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
7a64fb0c3093fd23eeed84799c1590a72f59a96c
Create boafiSettings.py
webGUI/boafiSettings.py
webGUI/boafiSettings.py
#!/usr/bin/python import os,time,argparse parser = argparse.ArgumentParser() parser.add_argument('-intf', action='store', dest='intf',default="none", help='Select interface') parser.add_argument('-ip', action='store', dest='ip',default="none", help='Use given ip address') ...
Python
0.000001
fdd2a50445d2f2cb92480f8f42c463b312411361
Add a simple command to print all areas in all generations
mapit/management/commands/mapit_print_areas.py
mapit/management/commands/mapit_print_areas.py
# For each generation, show every area, grouped by type from django.core.management.base import NoArgsCommand from mapit.models import Area, Generation, Type, NameType, Country, CodeType class Command(NoArgsCommand): help = 'Show all areas by generation and area type' def handle_noargs(self, **options): ...
Python
0.000003
9dee7d8d253847758d3252401c01215f972a22b1
Add synthtool scripts (#3765)
google-cloud-monitoring/synth.py
google-cloud-monitoring/synth.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
Python
0.000001
92ccb08f72828ba6454bbc3ff162ec73534ceea2
Interview question: find exact sum of two numbers
python/interviewquestions/find_exact_sum.py
python/interviewquestions/find_exact_sum.py
""" You've built an in-flight entertainment system with on-demand movie streaming. Users on longer flights like to start a second movie right when their first one ends, but they complain that the plane usually lands before they can see the ending. So you're building a feature for choosing two movies whose total runtime...
Python
0.99999
92f799d0584b598f368df44201446531dffd7d13
Copy paste artist from filename1 to filename2
python/utilities/transform_mp3_filenames.py
python/utilities/transform_mp3_filenames.py
# Extract the artist name from songs with filenames in this format: # (number) - (artist) - (title).mp3 # and add the artists name to songs with filenames in this format: # (number)..(title).mp3 # to make filenames in this format: # (number)..(artist)..(title).mp3 # # eg.: 14 - 13th Floor Elevators -...
Python
0
ec0ee6ffc7b72ba50846bac60ec63e1188bf0481
test parser
parser.py
parser.py
#!/usr/bin/python3 import requests import sys from bs4 import BeautifulSoup #filters through text from soup and strips text of whitespace def filterText(text): if text.parent.name in ['style', 'script', '[document]', 'head', 'title']: return False if text in ['\n', ' ', '\r', '\t']: return Fals...
Python
0.000028
c6afa2826d6b1ad425919c0b4bc64101d2d4a2d1
add first file
deepthought_web.py
deepthought_web.py
import random import string import pickle import cherrypy import numpy as np import pandas as pd from scipy.sparse import csr_matrix cherrypy.server.socket_host = '0.0.0.0' cherrypy.config.update({'server.socket_port': 7071}) class DeepThought(object): def __init__(self): self.all_identifiers = pickle.load...
Python
0.000001
58e0ea4b555cf89ace4f5d97c579dbba905e7eeb
Add script to list objects
jsk_arc2017_common/scripts/list_objects.py
jsk_arc2017_common/scripts/list_objects.py
#!/usr/bin/env python import os.path as osp import rospkg PKG_PATH = rospkg.RosPack().get_path('jsk_arc2017_common') object_names = ['__background__'] with open(osp.join(PKG_PATH, 'data/names/objects.txt')) as f: object_names += [x.strip() for x in f] object_names.append('__shelf__') for obj_id, obj in enumer...
Python
0.000001
04feafc2b3a13b394d5b510e9bc48e542d4880c5
Create pfkill.py
pfkill.py
pfkill.py
""" how to it use: $ python pfkill <port number> what doing: 1. read <port number>.pid file 2. send signal to running app 3. delete <port number>.rule 4. delete <port number>.pid """ import os import sys import signal # import logging port = sys.argv[1] # read <port>.pid pid = int(open("%s.pid" % port, 'r').read()....
Python
0.000001
e988a10ea18b644b9bc319286d75cb2a15079c59
add case owners endpoint
corehq/apps/reports/v2/endpoints/case_owner.py
corehq/apps/reports/v2/endpoints/case_owner.py
from __future__ import absolute_import from __future__ import unicode_literals from corehq.apps.reports.filters.controllers import ( CaseListFilterOptionsController, ) from corehq.apps.reports.v2.models import BaseOptionsEndpoint class CaseOwnerEndpoint(BaseOptionsEndpoint): slug = "case_owner" @propert...
Python
0
458091fe923038fe8537bf3b9efbff6157a7e57a
add tests for riakcached.clients.ThreadedRiakClient
riakcached/tests/test_threadedriakclient.py
riakcached/tests/test_threadedriakclient.py
import mock import unittest2 from riakcached.clients import ThreadedRiakClient import riakcached.pools class TestThreadedRiakClient(unittest2.TestCase): def test_get_many(self): pool = mock.Mock(spec=riakcached.pools.Pool) pool.request.return_value = 200, "result", {"content-type": "text/plain"} ...
Python
0
1d388bf1a38eaaafa4d79287ce7aabb59f84e649
Add initial img module
salt/modules/img.py
salt/modules/img.py
''' Virtual machine image management tools ''' def mnt_image(location): ''' Mount the named image and return the mount point CLI Example:: salt '*' img.mount_image /tmp/foo ''' if 'guestfs.mount' in __salt__: return __salt__['guestfs.mount'](location) elif 'qemu_nbd' in __salt...
Python
0
ae5407acd1fb93fe04747a10b7bda2fc1ec91790
add smf module to support virtual service module on solaris 10+
salt/modules/smf.py
salt/modules/smf.py
''' Service support for Solaris 10 and 11, should work with other systems that use SMF also. (e.g. SmartOS) ''' def __virtual__(): ''' Only work on systems which default to SMF ''' # Don't let this work on Solaris 9 since SMF doesn't exist on it. enable = [ 'Solaris', ...
Python
0
a91a942c45921b64fe0d740d81604dba921c214e
Create folder for QC and CNV cutoff codes
bin/cutoffs/__init__.py
bin/cutoffs/__init__.py
Python
0
e40b92966762dfadff53355e9e38636a4769543f
Add intermediate tower 2
pythonwarrior/towers/intermediate/level_002.py
pythonwarrior/towers/intermediate/level_002.py
# ---- # |@s | # | sS>| # ---- level.description("Another large room, but with several enemies " "blocking your way to the stairs.") level.tip("Just like walking, you can attack_ and feel in multiple " "directions ('forward', 'left', 'right', 'backward').") level.clue("Call warrior.feel(...
Python
0.999719
71d66fb3bdbcb38d29accb6bdfbf4ac8b2996e89
Add intermediate tower 3
pythonwarrior/towers/intermediate/level_003.py
pythonwarrior/towers/intermediate/level_003.py
# --- # |>s | # |s@s| # | C | # --- level.description("You feel slime on all sides, you're surrounded!") level.tip("Call warrior.bind_(direction) to bind an enemy to keep him " "from attacking. Bound enemies look like captives.") level.clue("Count the number of enemies around you. Bind an enemy if " ...
Python
0.999787
260cb76132bfe618b58cf34ad8dd61f59e847f90
create table
zaifbot/models/nonce.py
zaifbot/models/nonce.py
from sqlalchemy import Column, Integer, String, DateTime from datetime import datetime from zaifbot.models import Base class Nonce(Base): __tablename__ = 'nonces' id = Column(Integer, primary_key=True) key = Column(String, nullable=False) secret = Column(String, nullable=False) nonce = Column(Inte...
Python
0.00008
a72567202e9b4024758706c00f016153ec04a53d
Create render.py
render.py
render.py
#! /usr/bin/python3 from random import random import pyglet from pyglet.window import key, Window from pyglet.gl import * from pyglet.gl.glu import * window = Window() @window.event def on_draw(): pass # TODO: implement! @window.event def on_resize(width, height): pass # TODO: implement! @window.event d...
Python
0.000001
77dca533f2d2fe94b233bd48561e1ed887928265
add sample.py
sample.py
sample.py
#-*- coding: UTF-8 -*- # https://github.com/carpedm20/LINE from line import LineClient, LineGroup, LineContact f = open("credentials") ID = f.readline().strip() PASSWD = f.readline().strip() f.close() client = LineClient(ID, PASSWD, com_name="line_api_demo") friends = client.contacts for i, friend in enumerate(fri...
Python
0.000001
cf3ed974c97d6eaa7983b249a65b4e6df4309c28
Rename owners to instances
nycodex/db.py
nycodex/db.py
from enum import Enum import os import typing import sqlalchemy from sqlalchemy.dialects import postgresql from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() # type: typing.Any engine = sqlalchemy.create_engine(os.environ["DATABASE_URI"]) Session = sqlalchemy.orm.sessionmaker(bind=en...
from enum import Enum import os import typing import sqlalchemy from sqlalchemy.dialects import postgresql from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() engine = sqlalchemy.create_engine(os.environ["DATABASE_URI"]) Session = sqlalchemy.orm.sessionmaker(bind=engine) class DomainC...
Python
0.000082
db195957288ef7b6c5c9de6551689d4d06db28c1
Create add_digits.py
lintcode/naive/add_digits/py/add_digits.py
lintcode/naive/add_digits/py/add_digits.py
class Solution: # @param {int} num a non-negative integer # @return {int} one digit def addDigits(self, num): while len(str(num)) > 1: num = sum(map(int, str(num))) return num
Python
0.000094
836845abde53ee55bca93f098ece78880ab6b5c6
Use same variable names as testing environment
examples/events/create_massive_dummy_events.py
examples/events/create_massive_dummy_events.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from pymisp import PyMISP from keys import url, key import argparse import tools if __name__ == '__main__': parser = argparse.ArgumentParser(description='Create a given number of event containing a given number of attributes eachh.') parser.add_argument("-l", "--...
#!/usr/bin/env python # -*- coding: utf-8 -*- from pymisp import PyMISP from keys import misp_url, misp_key, misp_verifycert import argparse import tools def init(url, key): return PyMISP(url, key, misp_verifycert, 'json') if __name__ == '__main__': parser = argparse.ArgumentParser(description='Create a give...
Python
0.000016
2d12c640e42e83580ee27933f0ad9bed2ebcc169
add allauth and make owner of audio required
satsound/migrations/0007_auto_20170115_0331.py
satsound/migrations/0007_auto_20170115_0331.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-01-15 03:31 from __future__ import unicode_literals import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('satsound', '0006_auto_20161...
Python
0
a635a8d58e46cf4ef1bc225f8824d73984971fee
Add the answer to the sixth question of Assignment 3
countVowels.py
countVowels.py
""" Q6- Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print: Number of vowels: 5 """ # Using the isVowel function from isVowel.py module (Answer of fifth question of Assignment 3) ...
Python
0.999999
58fabd7929a4c712f5e87a39aaf8c34bae8759b8
Add photos to the admin
quickphotos/admin.py
quickphotos/admin.py
from django.contrib import admin from .models import Photo @admin.register(Photo) class PhotoAdmin(admin.ModelAdmin): list_display = ('user', 'caption', 'created') list_filter = ('created',) date_hierarchy = 'created' readonly_fields = ( 'photo_id', 'user', 'image', 'created', 'caption', 'lin...
Python
0
f7035a6c328bb237dd3c9be5d9da805606e059ae
Create adjust_xml_impath.py
object_detection/adjust_xml_impath.py
object_detection/adjust_xml_impath.py
import os import glob import re import argparse ap = argparse.ArgumentParser() ap.add_argument('-i', '--input_xml_dir', type=str, default='./annot', help='path to root dir of xmls') ap.add_argument('-s', '--subfolder', type=str, default='images', help='name of image subfolder') args = vars(ap.parse_args()) xmls = glo...
Python
0.000004
0266a6cec641f244a8788f50f80ac3f11f87e1e4
Add back fix_root script
scripts/fix_root.py
scripts/fix_root.py
import sys import logging from website.app import setup_django setup_django() from scripts import utils as script_utils from osf.models import AbstractNode from framework.database import paginated logger = logging.getLogger(__name__) def main(dry=True): count = 0 for node in paginated(AbstractNode, increment=...
Python
0.000001
ecc15e50967f61e9e8ba8a96d4b8f6855c77b401
Create geoprocess_exposure.py
hurricane/geoprocess_exposure.py
hurricane/geoprocess_exposure.py
import sys import os import datetime import psycopg2 import pandas from subprocess import call, Popen conn_string = "dbname='hamlethurricane' user=postgres port='5432' host='127.0.0.1' password='password'" os.system("exit") os.system("exit") print "Connecting to database..." try: conn = psycopg2.connect(conn_strin...
Python
0.000001
8578320e023dc3424da055c4a506931ec44b19ce
Save user's name to db when verifying AGA id
web/app/verify/views.py
web/app/verify/views.py
from . import verify from .aga_membership import get_aga_info from flask import abort, redirect, url_for, render_template, current_app from flask.ext.security import login_required from flask.ext.login import current_user from flask.ext.wtf import Form from flask.ext.mail import Message from sqlalchemy.sql import and_...
from . import verify from .aga_membership import get_aga_info from flask import abort, redirect, url_for, render_template, current_app from flask.ext.security import login_required from flask.ext.login import current_user from flask.ext.wtf import Form from flask.ext.mail import Message from sqlalchemy.sql import and_...
Python
0
ac3a3b583b028e53d80749eaaee58b4eb80d1c6a
Implement stack functionality
stack/stack.py
stack/stack.py
class Node(object): def __init__(self, value=None, next_node=None): self.value = value self.next_node = next_node class Stack(object): def __init__(self, head=None): self.head = head def push(self, data): self.head = Node(data, self.head) def pop(self): if se...
Python
0.000002
a6137714c55ada55571759b851e1e4afa7818f29
Add cli tool to delete documents.
app/utils/scripts/delete-docs.py
app/utils/scripts/delete-docs.py
#!/usr/bin/python # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope t...
Python
0.000013
c71a3f1adbf310c63ce9ab7611cf0e198ffe69da
Add load test
metakernel/magics/tests/test_load_magic.py
metakernel/magics/tests/test_load_magic.py
from metakernel.tests.utils import get_kernel def test_load_magic(): kernel = get_kernel() ret = kernel.do_execute("%%load %s" % __file__) assert 'def test_load_magic' in ret['payload'][0]['text']
Python
0.000001
e575f343f55fd54994fdb1f4d02fe6e2e52ba056
add phonetizer.py - really
phonetizer.py
phonetizer.py
import re class Phonetizer(): # Define shorthands for phonological classes ph_classes = { 'C' : 'p|t|k|b|d|g', 'V' : 'a|e|i|o|u|y' } def __init__(self, mappings_filename): with open(mappings_filename) as mfile: self.read_mfile(mfile) def read_mfile(self, mfile): ...
Python
0
91a23d6a946f70b4750e9141fb71e0bd3b7c2705
Rename the main file to minesweeper.py
minesweeper.py
minesweeper.py
import pygame import random from constants import * def initialize(): # Do initial window and pygame management pygame.init() pygame.display.set_caption("Minesweeper PRE-ALPHA") def get_screen(): # create and return the screen size = (SCREEN_HEIGHT, SCREEN_WIDTH) screen = pygame.display.set_mo...
Python
0.000316
163da52a48eb0d84cde47f7cfe99e1188350db47
Add MOBIB Basic reader script
mobib_basic.py
mobib_basic.py
#!/bin/env python3 import sys from smartcard.System import readers CALYPSO_CLA = [0x94] SELECT_INS = [0xA4] READ_RECORD_INS = [0xB2] GET_RESPONSE_INS = [0xC0] TICKETING_COUNTERS_FILE_ID = [0x20, 0x69] def main(): local_readers = readers() if local_readers: if len(local_readers) == 1: re...
Python
0
97531bdb1501748c7039d194e98408245dc5d2b2
Make graphflow loading script
load-tx-to-graphflow.py
load-tx-to-graphflow.py
from constants import * import csv walletsMap={} #address -> number OR transaction_id->number lastNumber = 0 with open(IN_TRANSACTION_CSV_LOCATION, 'rb') as tx_in_file: in_reader = csv.reader(tx_in_file, delimiter=",") for row in in_reader: tx_hash = row[0] wallet_addr = row[1] tx_amt ...
Python
0.000002
7f6aab7dc177dc1178eca30e0ba40874b217e7cf
Create *variable.py
*variable.py
*variable.py
def num(*nums): // One * takes in any number of single data type, in this case : Int sum = 0 for x in nums: sum += x return sum sum(22,33,44,55,66) // You can type as many numbers as you wish def whatever(**kwargs): // Double ** take more than just a type of data, in t...
Python
0.000001
70da5f3657ee847f315b0d0dfbe5adb393c55ca6
add system_info.py
system_info.py
system_info.py
# -*- coding: utf-8 -*- """System info""" import platform import subprocess import sys import numpy class SystemInfo: """Collect system info.""" @property def platform(self): """Info on the underlying platform.""" return platform.platform() @property def architecture(self): ...
Python
0.000002
2910f54c75e3f7cc9d7be08886547060a7e69b69
Implement basic CLI control
pusher.py
pusher.py
from __future__ import print_function, absolute_import, unicode_literals, division from stackable.stack import Stack from stackable.utils import StackablePickler from stackable.network import StackableSocket, StackablePacketAssembler from stackable.stackable import StackableError from runnable.network import RunnableSe...
Python
0.000001
e10ed243f6cae2e020d468bbd13a619e45ed0c5d
Add a forgotten migration
sponsors/migrations/0011_auto_20170629_1208.py
sponsors/migrations/0011_auto_20170629_1208.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-29 10:08 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sponsors', '0010_auto_20170627_2001'), ] operations = [ migrations.AlterFie...
Python
0.000029
ca5d47f3749c188d0858e996ba0253077260cd6c
Create GetUserGraphInstagram.py
GetUserGraphInstagram.py
GetUserGraphInstagram.py
#! /bin/bash for (( i=1; i <= 5; i++ )) do userid=$i curl https://api.instagram.com/v1/users/$userid/follows?access_token=XXXXXX > followers/$userid.followers curl https://api.instagram.com/v1/users/$userid/followed-by?access_token=XXXXXX > followedby/$userid.followedby done
Python
0
a8f4f0aa06e1469e758d5775bfea4176c7561e9f
Create stop_playlist.py
HA/syno/stop_playlist.py
HA/syno/stop_playlist.py
#!/usr/bin/python import sys import http.cookiejar, urllib.request, urllib.error, urllib.parse import json import codecs cj = http.cookiejar.CookieJar() opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj)) IP_syno = "IP_OF_YOUR_NAS" LOGIN = "********" PASSWORD = "********" player = sys.argv[1]...
Python
0.000008
b6daa366a38f224132c8f276d3fbc212964900c2
add currency
zametki/currency.py
zametki/currency.py
import requests as req def getUSD_RUB(): currency_url = 'http://api.fixer.io/latest?symbols=RUB&base=USD' res = req.get(currency_url).json() return res['rates']['RUB'] #print(getUSD_RUB())
Python
0.999995
df5884cd07d30f8b027b193bc819b61f7a6bdd31
Create cap_sense_test.py
MPR121/cap_sense_test.py
MPR121/cap_sense_test.py
#!/usr/bin/python ###################################################################### """ cap_sense_test.py - demo to use 12-channel MPR121 capacitive touch sensor controller as a sound board. Bart Spainhour <bart@tinkernauts.org> From Freescale Semiconductor whitepaper: Proximity Capacitive Touch Sensor Contro...
Python
0
16883c227549707ef2a66d7e6020809fe9ecd909
Add visitor base class
tater/visit.py
tater/visit.py
from tater.utils import CachedAttr class _MethodDict(dict): 'Dict for caching visitor methods.' def __init__(self, visitor): self.visitor = visitor def __missing__(self, node): name = node.__class__.__name__ method = getattr(self.visitor, 'visit_' + name, None) self[name] ...
Python
0
f291633a4a24aed310f46798ffa2472db4539aaf
Add a pyunit test for type-checking utilities
h2o-py/tests/testdir_misc/pyunit_typechecks.py
h2o-py/tests/testdir_misc/pyunit_typechecks.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- """Pyunit for h2o.utils.typechecks.""" from __future__ import absolute_import, division, print_function from h2o.exceptions import H2OTypeError, H2OValueError from h2o.utils.typechecks import (U, assert_is_type, assert_matches, assert_satisfies) def test_asserts(): "...
Python
0
7dd4919809c626d83cfc17447396aff98e636cfe
Add problem 13
problem_13.py
problem_13.py
from collections import OrderedDict from crypto_library import ecb_aes_encrypt, ecb_aes_decrypt from problem_12 import find_blocksize from crypto_library import apply_pkcs_7_padding ENCRYPTION_KEY = ',y!3<CWn@1?wwF]\x0b' def oracle(adversary_input): profile = profile_for(adversary_input) return ecb_aes_encry...
Python
0.000001
253ad82c316bd6d11dcf798e626b7eaf638867bd
add simple font comparison tool in examples
examples/font_comparison.py
examples/font_comparison.py
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are me...
Python
0
8416f73011ff2d2e53a46e6b575faca919c61de7
Create rockpaperScissors.py
rockpaperScissors.py
rockpaperScissors.py
#!/usr/bin/env/ python #Henry Kudzanai Dambanemuya presents: Rock, Paper, Scissors #Created: 10/13/2015 #Location: Notre Dame, Indiana import random import time rock = 1 paper = 2 scissors = 3 names = { rock: "Rock", paper: "Paper", scissors: "Scissors" } rules = { rock: scissors, paper: rock, scissors: paper } pla...
Python
0.000048
a1ba3031171992e4c07bef13b6edcdb1b80e32e6
Create psyko-ddos.py
psyko-ddos.py
psyko-ddos.py
""" Title: Psyko DDoS Type: Hacking Tool Version: 1.0 Author: Brandon Hammond Summary: Psyko DDoS is a Python DDoS tool that uses TCP packets to conduct a layer 4 DDoS attack on the target IP address at the given port. It uses multithreading to distribute the DDoS ...
Python
0.000013
dd36aef29cd1e45ec447260f9ac8848a86a430dc
Create ptb_reader.py
ptb_reader.py
ptb_reader.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import os import sys import tensorflow as tf def _read_words(filename): with open(filename, "r") as f: if sys.version_info[0] >= 3: return f.read().replace("\n", "<eos>").split() e...
Python
0.000004
532fdfa4a0fa4f0f5f441a572eef739f081e6522
Create hello.py
hello.py
hello.py
#!/usr/bin/env python print 'hello world'
Python
0.999503
98d956b6a249caeaee76732a0679c2dd3384cda7
Create pytemplate.py
pytemplate.py
pytemplate.py
import os,sys,string file_name = "" if sys.argv[1] == "": file_name = "template.tf" else: file_name = sys.argv[1] path = [] def build_path(): s_path = "" for i in path: s_path += i + "\\" return s_path type_state = [] def manage_state(word,operation): if operation == "append": ...
Python
0.000004
2305b514df6d654dfb10445d67a6d3addf4b94cb
Implement a version of snake.
demos/snake.py
demos/snake.py
from microbit import * import random # number of time intensity of apple changes per movement of snake _FRAME_COUNT = 10 # Directions N = (-1, 0) W = (0, -1) S = (1, 0) E = (0, 1) def turn_left(direction): if direction == N: return W if direction == W: return S if direction == S: ...
Python
0.998979
f4d70c81c55e744ef6ff4dd9fded2ca6e771fe30
add missing profiles migration
profiles/migrations/0003_auto_20210225_1754.py
profiles/migrations/0003_auto_20210225_1754.py
# Generated by Django 2.2.16 on 2021-02-25 17:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("profiles", "0002_auto_20200903_1942"), ] operations = [ migrations.AlterField( model_name="profile", name="api_tier...
Python
0.000001
14caf06fe4f30be96f0397f935df1daf48d40d81
Create report.py
report.py
report.py
""" This module is for API consumer-side reporting on QBOv3-querried transactions. In addition to mimmicking such features as "QuickReport," "General Ledger," "Profit & Loss," et al, it provides some helpful functions, such as finding the starting and ending balance of a particular account as of a particular date a...
Python
0
79acf77b7d711c88ea0ca8a733721ce5285f9a00
Create Randomkick.py
Randomkick.py
Randomkick.py
__module_name__ = 'Random Kick Reason' __module_version__ = '0.1' __module_description__ = 'Kicks the designated player with a random kick reason.' __module_author__ = 'Jake0720' rkickhelp = '\x02USAGE: /rk <nick>' import xchat import random def rk(word, word_eol, userdata): rkicks = (('Goodbye','See you later'...
Python
0
d021c05e483f556122d0f3251c2a299e0c47792c
add language detection code (even if it's not used)
src/detect_language.py
src/detect_language.py
def determine_language(item): import langid # latin my ass def classify(s): rank = langid.rank(s) if rank[0][0] == 'la': return rank[1][0] return rank[0][0] # extract text soup = boil_soup(item) for tag in ['script', 'style']: for el in soup.find_all...
Python
0
7961b5cf5d2cae486d898cd7885986cd3c685dc2
Add simple test for point defects filter
atoman/filtering/filters/tests/test_pointDefects.py
atoman/filtering/filters/tests/test_pointDefects.py
""" Unit tests for the point defects filter """ import copy import unittest import numpy as np from ....lattice_gen import lattice_gen_pu3ga from ....system import lattice from .. import pointDefectsFilter from .. import base ################################################################################ class ...
Python
0
f0392ebda49fa0222a3b317f50002d7e03659f47
Test we can approve Flutterwave bank accounts
bluebottle/funding_flutterwave/tests/test_states.py
bluebottle/funding_flutterwave/tests/test_states.py
from bluebottle.files.tests.factories import PrivateDocumentFactory from bluebottle.funding.tests.factories import FundingFactory, PlainPayoutAccountFactory, \ BudgetLineFactory from bluebottle.funding_flutterwave.tests.factories import FlutterwaveBankAccountFactory from bluebottle.test.utils import BluebottleTestC...
Python
0
9c3449cdfa7b39069b691b31ff75defa7cf9b302
add example.py
doc/example.py
doc/example.py
import numpy as np import os import metaseq ip_filename = metaseq.helpers.example_filename( 'wgEncodeHaibTfbsK562Atf3V0416101AlnRep1_chr17.bam') input_filename = metaseq.helpers.example_filename( 'wgEncodeHaibTfbsK562RxlchV0416101AlnRep1_chr17.bam') ip_signal = metaseq.genomic_signal(ip_filename, 'bam') input...
Python
0.000002
c1fc0121b02656de7bc99c587743485b5e45e416
Create angelbambi.py
angelbambi.py
angelbambi.py
#the following lines will allow you to use buttons and leds import btnlib as btn import ledlib as led import time #the led.startup() function cycles through the leds led.startup() time.sleep(1) print("All on and off") #to turn on all leds, use the led.turn_on_all(2) function: led.turn_on_all() time.sleep(2) #to turn ...
Python
0.002066
d3f46aba674f6fb402702ad803938c3401bfd0dd
Refactor of stix2misp - only a beginning atm
app/files/scripts/stix_to_misp.py
app/files/scripts/stix_to_misp.py
# -*- coding: utf-8 -*- # Copyright (C) 2017-2018 CIRCL Computer Incident Response Center Luxembourg (smile gie) # Copyright (C) 2017-2018 Christian Studer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published...
Python
0
0135ce760bb3bf8f2fd828fdb195bcdc4e4c3117
Add sample.py
sample.py
sample.py
from traitscli import TraitsCLIBase from traits.api import Bool, Float, Int, Str, Enum, Event class SampleCLI(TraitsCLIBase): """Sample CLI using `traitscli`.""" not_configurable_from_cli = Bool yes = Bool(config=True) fnum = Float(config=True) inum = Int(config=True) string = Str(config=Tru...
Python
0.000001
1706531082d75f7d6522b4f7d409df8d4fb2b3d7
Create __init__.py
plantcv/plantcv/visualize/eCDF/__init__.py
plantcv/plantcv/visualize/eCDF/__init__.py
from plantcv.plantcv.visualize.eCDF.obj_size import obj_size __all__ = ["obj_size"]
Python
0.000429
4d4120d6982a02a01b8dd2a4853eab47d7fe6f83
Create tests.py
polls/tests.py
polls/tests.py
import datetime from django.utils import timezone from django.test import TestCase from .models import Question # Create your tests here. class QuestionMethodTests(TestCase): def test_was_published_recently_with_future_question(self): """ was_published_recently() should return False for question...
Python
0.000001
84e52f3aa2679c0dd709a2cb794b3426541060d4
add cftt/feature/feature.py new file: cftt/feature/feature.py
cftt/feature/feature.py
cftt/feature/feature.py
# -*- coding: utf-8 -*- import sys import os import json import collections from shapely.geometry.point import BaseGeometry from shapely.geometry import shape, mapping from shapely.ops import cascaded_union import util class Feature(object): """単一の feature を扱うためのクラス """ def __init__(self, data): ...
Python
0.000001
15aa7efa3dfdade3001cdb6b5ac4c2f3c5cc2461
Test Commit
raspberry/asip/RelationSemanticTag.py
raspberry/asip/RelationSemanticTag.py
from SemanticTag import * #Test
Python
0.000001
95c34b9ad7ca6c425853642353a2d56282cc94d1
add script
plugins/Scripts/Plugins/Convert_To_8bit.py
plugins/Scripts/Plugins/Convert_To_8bit.py
# @DatasetIOService ds # @ConvertService convert # @UIService ui import os from ij import IJ from ij import ImagePlus d = "/home/hadim/Insync/Data/Microscopy/PSF/2016.04.12.T1/raw" files = os.listdir(d) for fname in files: fpath = os.path.join(d, fname) print(fpath) print(fpath) dataset = ds.open(fpath) ui....
Python
0.000001
0b058198539195b5520687c744b5cd1eebae3d18
predict all files in dir
predict_dir.py
predict_dir.py
import argparse import os from predict import main def run_dir(in_path, out_path): for item in os.listdir(in_path): if item.endswith('.wav'): out_file_path = out_path + item.replace('.wav', '.TextGrid') main(in_path + item, out_file_path) if __name__ == "__main__": # the fir...
Python
0.998316
8cdbda5c0694f4137c1b8a92bafd7f33a6a84d78
solve pep_751
pe-solution/src/main/python/pep_751.py
pe-solution/src/main/python/pep_751.py
from typing import Tuple from decimal import Decimal, ROUND_FLOOR def b_a(b: Decimal) -> Tuple[Decimal, Decimal]: a = b.to_integral_exact(ROUND_FLOOR) b = a * (b % 1 + 1) return a, b def th_tau(th: Decimal, n: int) -> Decimal: a1, b = b_a(th) l = [] for _ in range(2, n + 1): a, b = ...
Python
0.999969
0428d4889b34568a5b5397532dfd0091029b64de
Create problem-10.py
problem-10.py
problem-10.py
import math def is_prime(next): if n == 2: return True if n == 3: return True if n % 2 == 0: return False if n % 3 == 0: return False i = 5 w = 2 while math.pow(i, 2) <= n: if n % i == 0: return False i += w w = 6 - w ...
Python
0.00049
4fe4cad49367b462c2201b98cce4382bff3a0206
Add a script which use the iterative parsing to process the map file and find out not only what tags are there, but also how many, to get the feeling on how much of which data you can expect to have in the map.
DataWrangling/CaseStudy/mapparser.py
DataWrangling/CaseStudy/mapparser.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Your task is to use the iterative parsing to process the map file and find out not only what tags are there, but also how many, to get the feeling on how much of which data you can expect to have in the map. Fill out the count_tags function. It should return a dictionar...
Python
0
3d18f6e3ba3519422aa30bd25f3511f62361d5ca
Add test to ensure no mutable default arguments
tests/chainer_tests/test_chainer_objects.py
tests/chainer_tests/test_chainer_objects.py
import importlib import inspect import pkgutil import types import six import unittest import chainer from chainer import testing def walk_modules(): root = chainer.__path__ for loader, modname, ispkg in pkgutil.walk_packages(root, 'chainer.'): # Skip modules generated by protobuf. if '_pb2'...
Python
0
fcb07c7cd94f96cd533c55d18a657673f9eeac7f
Move log related functions over to this file
SpicyTwitch/Log_tools.py
SpicyTwitch/Log_tools.py
# Imports----------------------------------------------------------------------- import logging import os from inspect import stack, getmodulename from . import Storage # Base setup-------------------------------------------------------------------- log_to_stdout = True log_to_file = True logging_level = logging.DEBU...
Python
0
7ec36d0a1d0a757d0c914e4857ae06f4fece88f8
Add HexTerrain
problem/pop_map/hexagon/hex_terrain.py
problem/pop_map/hexagon/hex_terrain.py
#! /usr/bin/env python # Copyright 2020 John Hanley. # # 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, me...
Python
0.000012
4061e5db7097a680405282e371ab3bf07758648a
Add simple unit tests to validate all configs
projects/DensePose/tests/test_setup.py
projects/DensePose/tests/test_setup.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import os import unittest from detectron2.config import get_cfg from detectron2.engine import default_setup from densepose import add_densepose_config _CONFIG_DIR = "configs" _QUICK_SCHEDULES_CONFIG_SUB_DIR = "quick_schedules" _CONFIG_FILE_PREF...
Python
0.000001
d1bc6c3fd5741c5c8d3d6dd2ee5c5c28c2764ba3
add Tumblr.py
TumblrResource/Tumblr.py
TumblrResource/Tumblr.py
#!/usr/bin/env python # coding:utf-8
Python
0
2d73440f76faab151745ebf5a7a92aaec21cb491
Write a more reliable transaction decorator
djangae/db/transaction.py
djangae/db/transaction.py
from google.appengine.api.datastore import ( CreateTransactionOptions, _GetConnection, _PushConnection, _PopConnection, _SetConnection, IsInTransaction ) from google.appengine.datastore.datastore_rpc import TransactionOptions from djangae.db.backends.appengine import caching class ContextDec...
from google.appengine.api.datastore import ( CreateTransactionOptions, _GetConnection, _PushConnection, _PopConnection, _SetConnection, IsInTransaction ) from google.appengine.datastore.datastore_rpc import TransactionOptions from djangae.db.backends.appengine import caching class AtomicDeco...
Python
0.000012
a0d196af4d3854365bedb581d25d73af3271cb1a
add python script file
mydatetime.py
mydatetime.py
#!/usr/bin/python from datetime import datetime,timedelta import numpy # ----------------------------------------------------------------- # mydatetime v0.2 for python # Copyright (c) 2007 t.hada # ----------------------------------------------------------------- ### # This script is convert from/into date in...
Python
0.000002
30bb73da2b75b5cfcaadf743762bccb119b2c147
First challenge converted to Python 3
set1/ch1/hextob64.py
set1/ch1/hextob64.py
#!/usr/bin/python3 """ The string: 49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d Should produce: SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t """ import argparse import base64 import sys def hextobase64(hexstr): return base64.b64encode(by...
Python
0.999736
3129819c7d2ff3b35dd0270c0a27ef694a7e4d9e
Add regularizers.py
seya/regularizers.py
seya/regularizers.py
from keras.regularizers import Regularizer class GaussianKL(Regularizer): def set_param(self, p): self.p = p def set_layer(self, layer): self.layer = layer def __call__(self, loss): # See Variational Auto-Encoding Bayes by Kingma and Welling. mean, sigma = self.layer.get_...
Python
0
0a47253307d427c6e668d7cdf3bdf186dfc93858
Fix the ConsolesController class doc string
nova/api/openstack/compute/contrib/consoles.py
nova/api/openstack/compute/contrib/consoles.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 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-...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 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-...
Python
0.996907
e0eb68fa33dc6dea9f1b4a0f6cb1161e4128cfd7
add paper sim by summary
recommendation/paper_sim_by_summary.py
recommendation/paper_sim_by_summary.py
import MySQLdb import sys sys.path.append("../../include/python/") from paper import Paper import math from operator import itemgetter def getWordFreq(): connection1 = MySQLdb.connect(host = "127.0.0.1", user = "recop", passwd = "recop", db = "recop") cursor1 = connection1.cursor() cursor1.execute("select id, titil...
Python
0.000001
bdb75567519914386da7f1d598c6c7aaf96d8e02
Add sql solution for 561. Array Partition I
py/array-partition-i.py
py/array-partition-i.py
class Solution(object): def arrayPairSum(self, nums): """ :type nums: List[int] :rtype: int """ return sum(sorted(nums)[::2])
Python
0.999996
7275a50343cba5073dc2fa77e2e964daec002c38
move refactored OttTestCase to utils
ott/utils/tests/ott_test_case.py
ott/utils/tests/ott_test_case.py
import os import sys import unittest import urllib import contextlib from ott.utils import config_util from ott.utils import file_utils class OttTestCase(unittest.TestCase): domain = "localhost" port = "33333" path = None url_file = None def get_url(self, svc_name, params=None, lang=None): ...
Python
0.000001
e07c699caf699852c98b3396150b343553a386c4
Add tests for language api
server/tests/api/test_language_api.py
server/tests/api/test_language_api.py
import json from server.tests.helpers import FlaskTestCase, fixtures class TestLanguageAPI(FlaskTestCase): @fixtures('base.json') def test_get_empty_languages(self): """Test GET /api/languages endpoint with no data""" response, data = self.api_request('get', '/api/languages') assert d...
Python
0
5f56abf2e3bef6d7947b08603b86f59254bed000
add support for OGC Web Services Common 1.1.0 (#172)
owslib/ows.py
owslib/ows.py
# -*- coding: ISO-8859-15 -*- # ============================================================================= # Copyright (c) 2008 Tom Kralidis # # Authors : Tom Kralidis <tomkralidis@hotmail.com> # # Contact email: tomkralidis@hotmail.com # ============================================================================= ...
Python
0
6e736a48f8c49b8257305125742d89cb7f729fbc
index Ansible source versions
shotglass/make_ver_ansible.py
shotglass/make_ver_ansible.py
#!/usr/bin/env python ''' make_versions -- index many versions of a project ALPHA code, will need modification for general use. ''' import re import subprocess import sys import git NAME = 'ansible' bad_tag_re = re.compile(r'(rc|beta|alpha)') repos = git.Repo(NAME) tags = [tag.name for tag in repos.tags if t...
Python
0
24e6a8a21ef61edbe00e6af8a1aea274394a23ed
Add a snippet (python/pygtk).
python/pygtk/minimal.py
python/pygtk/minimal.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org) # 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 withou...
Python
0.000036
08e4f449f0e871f996e9a265fd23a967a0377078
Add bfx example
quant/example/ex_bfx.py
quant/example/ex_bfx.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- import time from quant import config from quant.api.bitfinex import PrivateClient client = PrivateClient(key=config.Bitfinex_SUB_API_KEY, secret=config.Bitfinex_SUB_SECRET_TOKEN) # client = PrivateClient(key=config.Bitfinex_API_KEY, secret=config.Bitfinex_SECRET_TOKEN) # ...
Python
0
800639fe381ec502e54a3fbd95241b460bd3e3c3
add tests for shannon.py
dit/algorithms/tests/test_shannon.py
dit/algorithms/tests/test_shannon.py
from __future__ import division from nose.tools import * from dit import Distribution as D, ScalarDistribution as SD from dit.algorithms import (entropy as H, mutual_information as I, conditional_entropy as CH) def test_H1(): d = SD([1/2, 1/2]) assert_a...
Python
0
8c1353537d0920d8137d5ea9d22843da67e41d9a
Add string_format pylint plugin.
test/sanity/pylint/plugins/string_format.py
test/sanity/pylint/plugins/string_format.py
# (c) 2018, Matt Martz <matt@sivel.net> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function) __metaclass__ = type import sys import six import astroid from pylint.interfaces import IAstr...
Python
0
d6d21f6e7b8d2a44ff3406ddc9a050cc17372da8
Add analyze_nir_intensity tests module
tests/plantcv/test_analyze_nir_intensity.py
tests/plantcv/test_analyze_nir_intensity.py
import cv2 import numpy as np from plantcv.plantcv import analyze_nir_intensity, outputs def test_analyze_nir(test_data): # Clear previous outputs outputs.clear() # Read in test data img = cv2.imread(test_data.small_gray_img, -1) mask = cv2.imread(test_data.small_bin_img, -1) _ = analyze_nir_...
Python
0.000001
9790fb109d59214ee016750307cd39b2f2780cf7
solve increment counter
algo/incrementcounter.py
algo/incrementcounter.py
from datetime import datetime, timedelta from time import sleep second = timedelta(seconds=1) day = timedelta(days=1) class Increment: def __init__(self): self.last_second_count = 0 self.last_day_count = 0 self.seconds_now = datetime.now() self.days_now = datetime.now() ...
Python
0.000124
aa2b788c4d0b148ed9881da86de97965311b9cb4
Add server.py
server.py
server.py
import socket, sys import datetime import time, random TCP_IP = '72.36.65.116' TCP_PORT = 5005 BUFFER_SIZE = 1024 if len(sys.argv) < 2: print ("Enter the server id") sys.exit(1) while True: v = random.randint(1, 10) ts = time.time() MESSAGE = str(v) + ";" + sys.argv[1] + ";" + datetime.datetime.fromtimestamp(...
Python
0.000001
287c659ad35f5036ba2687caf73009ef455c7239
update example
examples/plot_otda_linear_mapping.py
examples/plot_otda_linear_mapping.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 20 14:31:15 2018 @author: rflamary """ import numpy as np import pylab as pl import ot from scipy import ndimage ############################################################################## # Generate data # ------------- n = 1000 d = 2 sigma =...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 20 14:31:15 2018 @author: rflamary """ import numpy as np import pylab as pl import ot from scipy import ndimage ############################################################################## # Generate data # ------------- n = 1000 d = 2 sigma =...
Python
0.000001
e5f1f2a19ed86106728c4b70b1c4652ee618f918
add skeleton for light driver
Lights/light_drv.py
Lights/light_drv.py
from threading import Thread import logging logger = logging.getLogger("light_drv") DMX_RED_CHANNEL = 2 DMX_GREEN_CHANNEL = 3 DMX_BLUE_CHANNEL = 4 DMX_WHITE_CHANNEL = 5 DMX_CHANNEL_COUNT = 6 # Did we decide on another number def init(lightQueue): global lightThread lightThread = LightThread(lightQueue) l...
Python
0
dcca93fbb66e5cd8bf0e0500aca3f187922e8806
Add in team id spider
scrapy_espn/scrapy_espn/spiders/team_spider.py
scrapy_espn/scrapy_espn/spiders/team_spider.py
import scrapy class TeamSpider(scrapy.Spider): name = "team" start_urls = [ 'http://www.espn.com/mens-college-basketball/teams', ] def parse(self, response): for conf in response.css('ul'): for team in conf.css('li'): yield { 'team':team.css('h5 a::text').extract(), 'id':team.css('h5 a::attr(...
Python
0
4eb6c05df9b8faf4492b23db1ef0e2aee141d24b
test case for tpt
emma2/msm/analysis/api_test.py
emma2/msm/analysis/api_test.py
''' Created on 18.10.2013 @author: marscher ''' import unittest import emma2.msm.analysis.api as api import numpy as np class Test(unittest.TestCase): def testTPT(self): A = np.ndarray([1, 2, 3], dtype=int) B = np.ndarray([4, 2], dtype=int) T = np.ndarray([[ 0.5, 0, 0.5, 0], ...
Python
0