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
bce910100fe0c3970b82d4f5544f11ce3392bc3c
Remove NoQueueMinCycleTime nonsense from sync worker
sync_worker.py
sync_worker.py
from datetime import datetime, timedelta import os print("Sync worker %s booting at %s" % (os.getpid(), datetime.now())) from tapiriik.requests_lib import patch_requests_with_default_timeout, patch_requests_source_address from tapiriik import settings from tapiriik.database import db, close_connections import time imp...
from datetime import datetime, timedelta import os print("Sync worker %s booting at %s" % (os.getpid(), datetime.now())) from tapiriik.requests_lib import patch_requests_with_default_timeout, patch_requests_source_address from tapiriik import settings from tapiriik.database import db, close_connections import time imp...
Python
0.000001
6d134c2a870150477ecc41edbab272e75462bbcd
Add benchmark script
tests/bench.py
tests/bench.py
import os import re import time root = os.path.dirname(__file__) known = [] def listdir(folder): folder = os.path.join(root, folder) files = os.listdir(folder) files = filter(lambda o: o.endswith('.text'), files) return files def mistune_runner(content): import mistune return mistune.mark...
Python
0.000001
f5970d1488d28f27c5f20dd11619187d0c13c960
Add simple windows registry read/write functions
os/win_registry.py
os/win_registry.py
import _winreg keyName = "myKey" def write_to_registry(): try: key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\" + keyName) _winreg.SetValueEx(key, "myVal", 0, _winreg.REG_SZ, "This is a value.") print("value created") except Exception as e: print(e) def read_f...
Python
0.000001
a37007e03747395c12cc4bc34c761aa3253f7599
Add tests folder
tests/__init__.py
tests/__init__.py
# -*- coding: utf-8 -*-
Python
0.000001
d046bc3be27c39ca70a45d92939a2aa2444f3195
test examples
test/examples/test_examples.py
test/examples/test_examples.py
""" Runs all example scripts. Only tests whether examples can be executed. """ import pytest import os import subprocess import glob import sys # set environment flag # can be used in examples to reduce cpu cost os.environ['THETIS_REGRESSION_TEST'] = "1" exclude_files = [ 'baroclinic_eddies/diagnostics.py', '...
Python
0
b5f3a96c9da9cb957fab1849c658c6982bcf0678
Create MockEnv helper for unit tests
tests/mock_env.py
tests/mock_env.py
""" Copyright (c) 2020 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ from __future__ import unicode_literals, absolute_import from flexmock import flexmock from atomic_reactor.constants import PLUGIN_BUILD_OR...
Python
0
b872aaa2837e7cd72c36f2b3fd7679106fda57b4
Add test cli
tests/test_cli.py
tests/test_cli.py
import unittest import sys, os import cli from io import StringIO io = StringIO() class TestBuildInCommands(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_normal(self): sys.stdout = io # $ iroha-ya-cli cli.main.main(['iroha-ya-cli']) ...
Python
0
89cab892b1cb6b93521a9e4cb5321b90699c2943
Create main.py
main.py
main.py
#!/usr/bin/python # -*- coding: utf-8 -*- import psycopg2 import sys from xlrd import open_workbook con = None program_list =[] measure_list = [] ##This is a bit of code that will parse an excel file and read records to a postgreSQL db. For this example the data consists ##of clinical quality measures and the govern...
Python
0.000001
3d7bb0dfcbfda9c99ee2372394959667c76bb83f
Add first .py file to project
main.py
main.py
print("Hello!")
Python
0
59a57a25ff925bd1ce6d467d316ec478847b58ad
Create combinations.py
combinations.py
combinations.py
#!/usr/bin/env python from string import uppercase, lowercase, maketrans import math, sys class combinations(): def combs(self, total, choice): return (math.factorial(total)/(math.factorial(choice)*math.factorial(total-choice))) if __name__ == '__main__': try: total = sys.argv[1] ...
Python
0
2c63d77428b84c7d1be1c861079d39d641d51fcf
add script to scrap stock data and save them locally
stock_scraping/stock_price_scraping_to_local.py
stock_scraping/stock_price_scraping_to_local.py
''' This script helps you scrap stock data avaliable on Bloomberg Finance and store them locally. Please obey applicable local and federal laws and applicable API term of use when using this scripts. I, the creater of this script, will not be responsible for any legal issues resulting from the use of this script. @au...
Python
0
72fe45ca6e6cd13b0b5fbb250ce769f5ec883e90
Add awful pixiv command.
joku/cogs/pixiv.py
joku/cogs/pixiv.py
""" Cog for interacting with the Pixiv API. """ import random import shutil import requests from discord.ext import commands from io import BytesIO from pixivpy3 import AppPixivAPI from asyncio_extras import threadpool from pixivpy3 import PixivAPI from pixivpy3 import PixivError from joku.bot import Context class ...
Python
0.000003
ba06683866ce8e4e3bccd4acebd6ec2278acfeaa
Add Litecoin testnet, and Litecoin BIP32 prefixes.
pycoin/networks.py
pycoin/networks.py
from collections import namedtuple from .serialize import h2b NetworkValues = namedtuple('NetworkValues', ('network_name', 'subnet_name', 'code', 'wif', 'address', 'pay_to_script', 'prv32', 'pub32')) NETWORKS = ( NetworkValues("Bitcoin", "mainnet", "BTC", b'...
from collections import namedtuple from .serialize import h2b NetworkValues = namedtuple('NetworkValues', ('network_name', 'subnet_name', 'code', 'wif', 'address', 'pay_to_script', 'prv32', 'pub32')) NETWORKS = ( NetworkValues("Bitcoin", "mainnet", "BTC", b'...
Python
0
1de668219f618a0632fac80fd892a0a229b8fa05
Solve Code Fights addition without carrying problem
CodeFights/additionWithoutCarrying.py
CodeFights/additionWithoutCarrying.py
#!/usr/local/bin/python # Code Fights Addition Without Carrying Problem def additionWithoutCarrying(param1, param2): s1, s2 = str(param1), str(param2) shorter = s1 if len(s1) < len(s2) else s2 longer = s2 if shorter == s1 else s1 if len(shorter) < len(longer): shorter = shorter.zfill(len(longe...
Python
0.000002
ed5c27623711a7f3b798aed9c0f7cdbdcebc0dcd
test python interpreter
test/test_interpreter_layer.py
test/test_interpreter_layer.py
# This code is so you can run the samples without installing the package import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # import cocos from cocos.director import director import pyglet if __name__ == "__main__": director.init() interpreter_layer = cocos.layer....
Python
0.00001
7f4bd900d1e647fe017ce4c01e279dd41a71a349
Add management command to set SoftwareSecure verification status.
lms/djangoapps/verify_student/management/commands/set_software_secure_status.py
lms/djangoapps/verify_student/management/commands/set_software_secure_status.py
""" Manually set Software Secure verification status. """ import sys from django.core.management.base import BaseCommand from verify_student.models import ( SoftwareSecurePhotoVerification, VerificationCheckpoint, VerificationStatus ) class Command(BaseCommand): """ Command to trigger the actions that w...
Python
0
4dd66150c922e1c700fad74727955ef72c045f37
Add Find Command MCEdit filter
minecraft/FindCommand.py
minecraft/FindCommand.py
# MCEdit filter from albow import alert displayName = "Find Command" inputs = ( ("Command:", ("string", "value=")), ) def perform(level, box, options): command = options["Command:"] n = 0 result = "" for (chunk, slices, point) in level.getChunkSlices(box): for e in chunk.TileEntities: ...
Python
0
5e4ef4737c78b6154596ab8c76c4e60bd840453c
Add component.navbar
src/penn_chime_dash/app/components/navbar.py
src/penn_chime_dash/app/components/navbar.py
# components/navbar.py import dash_bootstrap_components as dbc import dash_html_components as html import dash_core_components as dcc from ..config import Config cfg = Config() navbar = dbc.NavbarSimple( brand='Penn Med CHIME', # Browser window title brand_href='/', # index page children=[ ...
Python
0
eea33e6207da7446e1713eb4d78b76d37ae5eaf2
Add sample of scheduler using celery
with_celery.py
with_celery.py
from celery import Celery # The host in which RabbitMQ is running HOST = 'amqp://guest@localhost' app = Celery('pages_celery', broker=HOST) @app.task def work(msg): print msg # To execute the task: # # $ python # >>> from with_celery import work # >>> work.delay('Hi there!!')
Python
0
7ca1f6c5d51f5e2fc582603012c3ca5a053ee4eb
Add BLT package (#19410)
var/spack/repos/builtin/packages/blt/package.py
var/spack/repos/builtin/packages/blt/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Blt(Package): """BLT is a streamlined CMake-based foundation for Building, Linking and ...
Python
0
4537ab84bb87eeae6b6865b7b9140d5324384e4a
add test cases for address operations
test/test-rpc/TestCase/Account/test_address.py
test/test-rpc/TestCase/Account/test_address.py
import random from TestCase.MVSTestCase import * class TestAccount(MVSTestCaseBase): roles = (Alice,) need_mine = False def test_0_new_address(self): #password error ec, message = mvs_rpc.new_address(Alice.name, Alice.password+'1') self.assertEqual(ec, 1000, message) #chec...
Python
0
de40e15b661806dc75e73bd9f1fc2c37af60b0d3
test case for geometry utils
testbeam_analysis/tests/test_geometry_utils.py
testbeam_analysis/tests/test_geometry_utils.py
''' Script to check the correctness of the geometry utils functions (rotation, translation matrices) ''' import os import numpy as np import unittest from testbeam_analysis import geometry_utils tests_data_folder = r'tests/test_track_analysis/' class TestTrackAnalysis(unittest.TestCase): @classmethod def ...
Python
0
83cdd840979dc452f444914a0c40d077e6917c38
Add DB connector class.
DBConnection.py
DBConnection.py
__author__ = 'David'
Python
0
e54d1f73bc09ca29a4f760f5846652c689cc45b8
Create pmf.py
pmf.py
pmf.py
# coding = utf-8 import numpy as np import random import math parameter = { "path":"./ml-100k.csv.clean", "split":" ", "learnrate":0.005, "trainratio":0.8, "D":10, "epoch_num": 10, "topn":5, "lambda_u":0.9, "lambda_v": 0.9, } class PMF(): def __init__(self, parameter): ...
Python
0
4ff0e6a4d190d8c1f60903d18dcdaac1edeace8a
Create test.py
test.py
test.py
import unittest from mock import patch import RedDefineBot class TestBot(unittest.TestCase): def test_auth_called(self,mock): self.assertTrue(mock.called) def test_auth_notcalled(self,mock): self.assertFalse(mock.called) if __name__ == '__main__': unittest.main()
Python
0.000005
00b04f773b9e2018b08776c5d53ff3dad7ed00d1
Create test.py
test.py
test.py
"""test.py """ print "Hello world"
Python
0.000005
b4b2b80cb1d0c0729e8e98085c2cfc3bc55ddda3
Solve the Longest Lines challenge using Python3
LongestLines.py
LongestLines.py
# Longest Lines # # https://www.codeeval.com/open_challenges/2/ # # Challenge Description: Write a program which reads a file and prints to # stdout the specified number of the longest lines that are sorted based on # their length in descending order. import sys input_file = sys.argv[1] with open(input_file, 'r') a...
Python
0.999972
37e674f05547c7b6b93f447477443644865975d1
Bring back the Root URL config
urls.py
urls.py
__author__ = 'ankesh' from django.conf.urls import patterns, include, url from django.http import HttpResponseRedirect # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'upload.views.home', name='home')...
Python
0
b733f433d797b302c46cb71cf0230b986f630d26
Create w3_1.py
w3_1.py
w3_1.py
print("ä½ ę•™å¾—ēœŸå„½")
Python
0.000482
d23461fb7b81f70c919fb028eb22009deaae13da
Generate posterior information
main.py
main.py
import math import numpy as np import matplotlib.pyplot as plt import tensorflow as tf def generate_sample(mean, cov_matrix): '''generate_sample: Generate sample function output from a mean and covariance matrix.''' cholesky_decomp = tf.cholesky(cov_matrix) cov_shape = tf.shape(cov_matrix) result_shape...
import math import numpy as np import matplotlib.pyplot as plt import tensorflow as tf def generate_sample(mean, cov_matrix): '''generate_sample: Generate sample function output from a mean and covariance matrix.''' cholesky_decomp = tf.cholesky(cov_matrix) cov_shape = tf.shape(cov_matrix) result_shape...
Python
1
73afce309f0e73b441c0ade49849397cba0fb0c2
update spec runner to work with invoke's boolean flags to run specs untranslated
tasks/specs.py
tasks/specs.py
from invoke import task, run as run_ from .base import BaseTest class Rubyspecs(BaseTest): def __init__(self, files, options, untranslated=False): super(Rubyspecs, self).__init__() self.exe = "`pwd`/bin/%s" % ("topaz_untranslated.py" if untranslated else "topaz") self.files = files ...
from invoke import task, run as run_ from .base import BaseTest class Rubyspecs(BaseTest): def __init__(self, files, options, translated=True): super(Rubyspecs, self).__init__() self.exe = "`pwd`/bin/%s" % ("topaz" if translated else "topaz_untranslated.py") self.files = files sel...
Python
0
90399f50a3f50d9193ae1e6b2042215fb388230f
Create Video Stream program for webcam
VideoStream.py
VideoStream.py
import cv2 import numpy as np cap = cv2.VideoCapture(0) print('Beginning Capture Device opening...\n') print('Capture device opened?', cap.isOpened()) while True: ret, frame = cap.read() gray_image = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cv2.imshow('frame', gray_image) if cv2.wait...
Python
0
1437bb868844731d3fdb13c6dd52dfd706df6f63
Add a new script to clean up a habitica user given user email
bin/ext_service/clean_habitica_user.py
bin/ext_service/clean_habitica_user.py
import argparse import sys import logging import emission.core.get_database as edb import emission.net.ext_service.habitica.proxy as proxy if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG) parser = argparse.ArgumentParser() parser.add_argument("user_email", help="the email addre...
Python
0
b9820246c62733e9e47103d41a07a9a4253be15a
Create weather-script.py
weather-script.py
weather-script.py
#!/usr/bin/python2 #Rory Crispin -- rozzles.com -- 2015 from xml.dom import minidom import datetime import codecs import pywapi result = pywapi.get_weather_from_yahoo('UKXX3856', 'metric') iconCodes = ["056", "073", "073", "01e", "01e", "064", "01c", "064", "01c", "01c", "015", "019", "019", "064", "064", ...
Python
0.000001
a9dd25c825bacd03ae358cc153c94ce3960ec0cf
Add serializers
chipy_org/apps/meetings/serializers.py
chipy_org/apps/meetings/serializers.py
from rest_framework import serializers from .models import Meeting, Topic, Presentor class PresentorSerializer(serializers.ModelSerializer): class Meta: model = Presentor fields = ('name', 'release') class TopicSerializer(serializers.ModelSerializer): presentor = PresentorSerializer() ...
Python
0.000005
55185a7a7402c9d0ce2677b00a329aa4197556c3
add mediator
Mediator.py
Mediator.py
# -*- coding: utf-8 -*- """ Mediator pattern """ class AbstractColleague(object): """ AbstractColleague """ def __init__(self, mediator): self.mediator = mediator class ConcreteColleague(AbstractColleague): """ ConcreteColleague """ def __init__(self, name, mediator): ...
Python
0.001741
290f990e31a5f732fb054846caea9346946778df
enable import as module
__init__.py
__init__.py
""" .. module:: lmtscripts :platform: Unix :synopsis: useful scripts for EHT observations at LMT .. moduleauthor:: Lindy Blackburn <lindylam@gmail.com> .. moduleauthor:: Katie Bouman <klbouman@gmail.com> """
Python
0.000001
19a4c4364d1629cd6bfd7ca27ae4e6441f13747e
Make mygmm a module
__init__.py
__init__.py
from .mygmm.mygmm import *
Python
0.000018
a7f4d96becfd1a58794a4dbedb9e9c8f6ac8c1a6
Create acceptor.py
acceptor.py
acceptor.py
#! /usr/bin/env python import message import logging class Acceptor(message.MessageListener): def __init__(self, config, network): message.MessageListener.__init__(self, name = 'AcceptorListenser', mapping = { message.MSG_PROPOSAL_REQ : self.on_proposal_reques...
Python
0.000001
1265e6ce2e6f8423e13f5fb5d54328369cfaa3ec
add geojsonloader tester
tests/geojson/geojsonloader.py
tests/geojson/geojsonloader.py
# -*- coding: utf-8 -*- import sys import os import unittest import uuid PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) sys.path.insert(0, PROJECT_ROOT) class GeoJSONLoaderTester(unittest.TestCase): def setUp(self): pass def test__init__(self): ...
Python
0
13b94129947cbfab4b7870e130a2efbbf41bfbb7
Add missing file
rehash/__init__.py
rehash/__init__.py
from __future__ import absolute_import, division, print_function, unicode_literals import os, sys, hashlib from ctypes import cast, c_void_p, POINTER, Structure, c_int, c_ulong, c_char, c_size_t, c_ssize_t, py_object, memmove from ssl import OPENSSL_VERSION PyObject_HEAD = [ ('ob_refcnt', c_size_t), ('ob_type...
Python
0.000006
72d19081bea1dba061c7bf1f57c305f427be1e28
Implement the SQUIT server command
txircd/modules/server/squit.py
txircd/modules/server/squit.py
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import Command, ICommand, IModuleData, ModuleData from txircd.utils import ircLower from zope.interface import implements class ServerQuit(ModuleData): implements(IModuleData) name = "ServerQuit" co...
Python
0.000013
5bb387947ac13bcd3949c6b17839033231c05e2d
Add unittests for cupy.testing.array
tests/cupy_tests/testing_tests/test_array.py
tests/cupy_tests/testing_tests/test_array.py
import copy import unittest import numpy import six import cupy from cupy import testing @testing.parameterize( *testing.product({ 'assertion': ['assert_allclose', 'assert_array_almost_equal', 'assert_array_almost_equal_nulp', 'assert_array_max_ulp', 'assert_a...
Python
0.000001
9e862d1ae83a75c9b7ea6fef37ff8d30e920511c
Add tests for cache generation IDs.
ci/tsqa/tests/test_cache_generation.py
ci/tsqa/tests/test_cache_generation.py
''' Test the cache generation configuration ''' # 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...
Python
0
6891c9e635cbe9ba663ac7f72bdff653bb8c8220
make sure we can call commit
netforce_general/netforce_general/controllers/root.py
netforce_general/netforce_general/controllers/root.py
# Copyright (c) 2012-2015 Netforce Co. Ltd. # # 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, merge, publ...
# Copyright (c) 2012-2015 Netforce Co. Ltd. # # 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, merge, publ...
Python
0
21d7e6f83f34e66167d7452998f2c7622a90e46c
Create test_parser.py
test_parser.py
test_parser.py
import os import csv import json import collections from collections import defaultdict filename = "C:/Users/zeffi/Documents/Export_482016.csv" some_dict = defaultdict(list) def sanedate(date): MM, DD, YYYY = date.split('/') return '/'.join([DD, MM, YYYY]) def formatted_time(gtime): HH, MM, SS = gtime.sp...
Python
0.000008
0c49c3dcd168e01512deb72bfbeed1438430abe4
remove duplicate error messages before displaying, issue 486
src/robotide/context/logger.py
src/robotide/context/logger.py
# Copyright 2008-2009 Nokia Siemens Networks Oyj # # 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...
# Copyright 2008-2009 Nokia Siemens Networks Oyj # # 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...
Python
0
fabf4e8bd93155101d459716b35c10b32a3dfd16
add tests/utils.py
tests/utils.py
tests/utils.py
import sys import yappi import unittest class YappiUnitTestCase(unittest.TestCase): def setUp(self): if yappi.is_running(): yappi.stop() yappi.clear_stats() yappi.set_clock_type('cpu') # reset to default clock type def tearDown(self): fstats = yappi.get_...
Python
0.000001
21a9ca4487d0d3ef9f2aa2ba5909b37c735c18e6
Fix linter errors in test_tftrt.py
tensorflow/contrib/tensorrt/test/test_tftrt.py
tensorflow/contrib/tensorrt/test/test_tftrt.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Python
0.000027
a333a5c15ffd2b775ad4d854c7accd32b898d2fb
Add encryptor_python3.py compatible with Python 3
encryptor_python3.py
encryptor_python3.py
from __future__ import print_function __author__ = 'Samuel Gratzl' if __name__ == '__main__': import uuid import hashlib password = input('enter password: ').encode('utf-8') salt = uuid.uuid4().hex.encode('utf-8') hashed_password = hashlib.sha512(password + salt).hexdigest() print(password) print(salt)...
Python
0.000669
5a634b9b837726a595a4450c8b1f46dd24b282a0
Add generic Python context template
scripts/Context.py
scripts/Context.py
# Copyright (c) 2015-2019 Agalmic Ventures LLC (www.agalmicventures.com) # # 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
a7b25e343623f41b0466c8cea852ecc07ffab359
Create marsLanderLevelTwo.py
Codingame/Python/Medium/marsLanderLevelTwo.py
Codingame/Python/Medium/marsLanderLevelTwo.py
import sys import math # Auto-generated code below aims at helping you parse # the standard input according to the problem statement. surface_n = int(input()) # the number of points used to draw the surface of Mars. surface = [] for i in range(surface_n): # land_x: X coordinate of a surface point. (0 to 6999) ...
Python
0.000045
ac2f517f15816277dd808ac473c4581212b8e841
add migration for meta
Seeder/www/migrations/0004_auto_20170223_1457.py
Seeder/www/migrations/0004_auto_20170223_1457.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-02-23 14:57 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('www', '0003_auto_20170216_2204'), ] operations = [ migrations.AlterModelOptions( ...
Python
0
0a8af4a4f5e9fa711e9e4b1b14cc639d5ff166a0
Create beta_dog_recommendation_system.py
Solutions/beta/beta_dog_recommendation_system.py
Solutions/beta/beta_dog_recommendation_system.py
from itertools import takewhile def find_similar_dogs(breed): compare = dogs[breed] scores = sorted(( [ dog, sum(1 if q in compare else 0 for q in dogs[dog]) ] for dog in dogs if dog != breed ), key = lambda x: x[1], reverse...
Python
0.000007
8a293ddc633730a6c2323392b1ac9083e5a45ad4
Create lora_test_recv.py
device/src/test/lora_test_recv.py
device/src/test/lora_test_recv.py
# lora_test_recv.py #Communication module: LoRa. #Communication method with gateway via LoRa. #Uart port drive LoRa module. #Parse JSON between device and gateway via LoRa channel. #LoRa module: E32-TTL-100 #Pin specification: #Module MCU #M0(IN) <--> GPIO(X3)(OUT) #mode setting, can not hang #M1(IN) ...
Python
0.000002
d19a36fda0bfc9d221d65bde1612ff6181fca66d
add proposed setup.py file
setup.py
setup.py
from distutils.core import setup setup( name='vectortween', version='0.0.1', packages=['vectortween'], url='', license='MIT', author='stefaan himpe', author_email='stefaan.himpe@gmail.com', description='some tweening for use with libraries like gizeh and moviepy' )
Python
0
f96686735db03abdc2470c27ff8d7a04643c7727
Add Exercise 9.8.
Kane1985/Chapter5/Ex9.8.py
Kane1985/Chapter5/Ex9.8.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Exercise 9.8 from Kane 1985.""" from __future__ import division from sympy import simplify, solve, symbols, Matrix from sympy.physics.mechanics import ReferenceFrame, Point from sympy.physics.mechanics import inertia, RigidBody from sympy.physics.mechanics import cross,...
Python
0.000002
a57d39e7f63e6c034644a158aabb5ff6e6f04ae9
add response test to testing module
oct/testing/response.py
oct/testing/response.py
# This file is fit for containing basic response status check # All functions have to take a response object in param def check_response_status(resp, status): """ This will check is the response_code is equal to the status :param resp: a response object :param status: the expected status :type st...
Python
0
f37bcfdae9bfc14bacccdcba325d2b8fb1284d32
set keystone user name to user's email address
planetstack/observer/steps/sync_user_deployments.py
planetstack/observer/steps/sync_user_deployments.py
import os import base64 import hashlib from collections import defaultdict from django.db.models import F, Q from planetstack.config import Config from observer.openstacksyncstep import OpenStackSyncStep from core.models.site import SiteDeployments, Deployment from core.models.user import User, UserDeployments from uti...
import os import base64 import hashlib from collections import defaultdict from django.db.models import F, Q from planetstack.config import Config from observer.openstacksyncstep import OpenStackSyncStep from core.models.site import SiteDeployments, Deployment from core.models.user import User, UserDeployments from uti...
Python
0.000008
2f1b12a6f173c01f9631d0ad5a4d3c3f411983cb
add file notification platform
homeassistant/components/notify/file.py
homeassistant/components/notify/file.py
""" homeassistant.components.notify.file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ File notification service. Configuration: To use the File notifier you will need to add something like the following to your config/configuration.yaml notify: platform: file path: PATH_TO_FILE filename: FILENAME timestamp: 1 or 0 ...
Python
0
a9893fc562c9131fdaebaa842f587f415b7fdfda
Add second test.
oommfmif/test_basics.py
oommfmif/test_basics.py
import oommfmif as o def test_get_oommf_version_return_type(): assert isinstance(o.get_version(), str) def test_get_oommf_version(): assert o.get_version()[0:4] == "1.2."
import oommfmif as o def test_get_oommf_version(): assert isinstance(o.get_version(), str)
Python
0.000007
99389c1f863592c8c56c8dca415155536abbd0fd
Create new.py
simple_mqtt/new.py
simple_mqtt/new.py
Python
0.000001
0ec30eb8bcf0e7688182f827bea24fd0ceb33501
add models
models.py
models.py
from peewee import * from config import db class BaseModel(Model): class Meta: database = db class HistoricalTrainPosition(BaseModel): cars = IntegerField() line_code = CharField() next_station = CharField() dest_station = CharField() time = IntegerField() timestamp = DateTimeField...
Python
0
5c02d902753327b3413e994d6edc089b8ca72749
Add create_flipper step
dbaas/workflow/steps/create_flipper.py
dbaas/workflow/steps/create_flipper.py
# -*- coding: utf-8 -*- import logging from base import BaseStep from dbaas_flipper.provider import FlipperProvider LOG = logging.getLogger(__name__) class CreateFlipper(BaseStep): def __unicode__(self): return "Creating Flipper" def do(self, workflow_dict): try: if workflow_di...
Python
0.000001
cf99929c923cb31782a192f108c735bfcc9cde2f
Add render module, this will be the interface to manage rendering state files into high state data
salt/render.py
salt/render.py
''' Render is a module used to parse the render files into high salt state data structures. The render system uses render modules which are plugable interfaces under the render directory. ''' # Import salt modules import salt.loader class Render(object): ''' Render state files. ''' def __init__(self, ...
Python
0
773efcb6aec427034263d550c600da0654031fa4
Add simpleTestCondition.py script to test condition notification framework w/o using full Django unit test infrastucture
apps/basaltApp/scripts/simpleTestCondition.py
apps/basaltApp/scripts/simpleTestCondition.py
#! /usr/bin/env python #__BEGIN_LICENSE__ # Copyright (c) 2015, United States Government, as represented by the # Administrator of the National Aeronautics and Space Administration. # All rights reserved. # # The xGDS platform is licensed under the Apache License, Version 2.0 # (the "License"); you may not use this fi...
Python
0
c735935c983cc7ccd72b2c71733e6f785a8a3ae3
Create urls.py
Assessment/urls.py
Assessment/urls.py
from django.conf.urls import url from . import views urlpatterns = [ url(r'^getAssignmentByCode', views.getAssignmentByCode, name='getAssignmentByCode'), url(r'^retrieveAssignments', views.retrieveAssignments, name='retrieveAssignments'), ]
Python
0.000017
1bfbd397e3b3c805aa29f407915e1d10ca7eb179
Create rbgLib.py
rbgLib.py
rbgLib.py
from __future__ import division import time import RPi.GPIO as GPIO # noinspection PyPep8Naming class rgbColour(object): red = 0 green = 0 blue = 0 def __init__(self, red, green, blue): self.red = red self.green = green self.blue = blue def hexToColour(r,g,b): hex_constan...
Python
0.000003
83d4ac6c3565044727c9b3fcbada9966d529a80e
Add forgotten font leader lib
lib/font_loader.py
lib/font_loader.py
import os import sys import logging FONT_FILE_NAME_LIST = ( "fontawesome-webfont.ttf", ) FONT_DIRECTORY = "share" FONT_DIRECTORY_SYSTEM = "/usr/share/fonts" FONT_DIRECTORY_USER = os.path.join(os.environ['HOME'], ".local/share/fonts") class FontLoader: def __init__(self): self.fonts_loaded...
Python
0
d8f7cb58e7f760ccbb839aafeda4dbf7204d7d82
Add r_latestagecapitalism
channels/r_latestagecapitalism/app.py
channels/r_latestagecapitalism/app.py
#encoding:utf-8 subreddit = 'latestagecapitalism' t_channel = '@r_latestagecapitalism' def send_post(submission, r2t): return r2t.send_simple(submission)
Python
0.999492
151e8fc71e5ef2e31db13730bff57bc8fd915c30
Add test case for list invoice
paystackapi/tests/test_invoice.py
paystackapi/tests/test_invoice.py
import httpretty from paystackapi.tests.base_test_case import BaseTestCase from paystackapi.invoice import Invoice class TestInvoice(BaseTestCase): @httpretty.activate def test_create_invoice(self): """Method defined to test create Invoice.""" httpretty.register_uri( httpretty.PO...
Python
0.000001
dcd1d962feec4f3cd914677545f74924ad9e6351
Add test for file creation of low level library
testing/test_direct_wrapper.py
testing/test_direct_wrapper.py
import os from cffitsio._cfitsio import ffi, lib def test_create_file(tmpdir): filename = str(tmpdir.join('test.fits')) f = ffi.new('fitsfile **') status = ffi.new('int *') lib.fits_create_file(f, filename, status) assert status[0] == 0 assert os.path.isfile(filename)
Python
0
2ccd94f9fb6f4a64976124ca82ac4c5ef585d64b
add serializer field
djbitcoin/serializers.py
djbitcoin/serializers.py
from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from .utils import is_bitcoin_address_valid class BitcoinAddressField(serializers.CharField): default_error_messages = { 'invalid': _('Invalid bitcoin address.') } def to_internal_value(self, data): ...
Python
0
dddc76173a5150939535b2c506aa967fe17ee000
Fix #12 : env implementation
elevator/env.py
elevator/env.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from ConfigParser import ConfigParser from utils.patterns import Singleton from utils.decorators import lru_cache from utils.snippets import items_to_dict class Environment(object): """ Unix shells like environment class. Implements add, get, load, flush met...
Python
0.000001
01b42c531f7ab0ca81768b6e9833062f9e31ba95
Update train_tagger script
examples/training/train_tagger.py
examples/training/train_tagger.py
"""A quick example for training a part-of-speech tagger, without worrying about the tokenization, or other language-specific customizations.""" from __future__ import unicode_literals from __future__ import print_function import plac from pathlib import Path from spacy.vocab import Vocab from spacy.tagger import Tag...
Python
0
8fc4fdc96c07432f87b49676b4ba9ca92a0f3385
Add tool.parser module
grab/tools/parser.py
grab/tools/parser.py
def parse_int(val): if val is None: return None else: return int(val)
Python
0.000001
e426afbe9ccbc72a1aa0d00032144e8b9b2b8cdc
Implement utility for colored, tabular output using fabric's color controls.
gusset/colortable.py
gusset/colortable.py
""" Pretty table generation. """ from itertools import cycle from string import capwords from fabric.colors import red, green, blue, magenta, white, yellow class ColorRow(dict): """ Ordered collection of column values. """ def __init__(self, table, **kwargs): super(ColorRow, self).__init__(sel...
Python
0
af61c9a44871b1da8a939470492c18a45ab373e1
Create lineValueDisp.py
lineValueDisp.py
lineValueDisp.py
import TCP import Motor import Steering import Status import time import Cameras import Lights import Modes import os try: trip_meter = Motor.TripMeter() motors = Motor.Motor(trip_meter) follow_line = Steering.FollowLine(motors, start_speed = 0) while True: time.sleep(10) except: motors.turn_off() fo...
Python
0.000009
3660c183ba1ddec8033ceae21b1b06fd0ab9a8b7
Add Signal class
phasortoolbox/signal.py
phasortoolbox/signal.py
class Signal(object): run = False
Python
0
913bb348938c2b54ab7a76c7e16ce9b3fb999dbe
Copy fail.
judge/management/commands/render_pdf.py
judge/management/commands/render_pdf.py
import os import sys from django.conf import settings from django.core.management.base import BaseCommand from django.template import Context from django.template.loader import get_template from django.utils import translation from judge.models import Problem, ProblemTranslation from judge.pdf_problems import WebKitP...
import os import sys from django.conf import settings from django.core.management.base import BaseCommand from django.template import Context from django.template.loader import get_template from django.utils import translation from judge.models import Problem, ProblemTranslation from judge.pdf_problems import WebKitP...
Python
0
b31e15d12dbff8eaab71ec523ec16d5f1afe908b
add sharpen pic tool
sharpen_pic.py
sharpen_pic.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #function: 锐化图像 import os import os.path import sys, getopt, argparse from PIL import Image, ImageEnhance def sharpenPic(filein,fileout): im02 =Image.open(filein) im_30 =ImageEnhance.Sharpness (im02).enhance(2.0) im_30.save(fileout) def main(): argc = len(sys.arg...
Python
0
ca53fcbba66dd4999f68f3523367c20a6b5e1e47
Create script.py
script.py
script.py
import math def getMatrix(): L = [None] * 3 for j in range(3): print "Ligne "+str(j)+ "\n" L[j] = [None] * 3 for i in range(3): L[j][i] = input("Terme "+str(i)+"\n") return L def getPoint(): L = [None] * 3 for j in range(2): L[j] = input("Terme "+str(j)+"\n") L[2] = 1 return L def PrintPoint(L): s ...
Python
0.000002
338a23f907a82d821844639128d070385138af80
Simple https server. requires key and cert files
server.py
server.py
import SimpleHTTPServer import SocketServer import BaseHTTPServer, SimpleHTTPServer import ssl httpd = BaseHTTPServer.HTTPServer(('localhost', 4443), SimpleHTTPServer.SimpleHTTPRequestHandler) httpd.socket = ssl.wrap_socket (httpd.socket, certfile='/Users/jtep/Code/own/audioviz/cert.pem', keyfile='/Users/jtep/Code/ow...
Python
0.999993
98e086696ea36d6050de9f23d2380b704fee305d
Create chatbot3.py
ai/chatbot3.py
ai/chatbot3.py
# ąø—ąø³ Chat Bot ąø‡ą¹ˆąø²ąø¢ ๆ ą¹ƒąø™ąø ąø²ąø©ąø² Python # เขียนโดย นาย ąø§ąø£ąø£ąø“ąøžąø‡ąø©ą¹Œ ąø ąø±ąø—ąø—ąø“ąø¢ą¹„ąøžąøšąø¹ąø„ąø¢ą¹Œ # https://python3.wannaphong.com/2015/07/ąø—ąø³-chat-bot-ąø‡ą¹ˆąø²ąø¢-ๆ-ą¹ƒąø™ąø ąø²ąø©ąø²-python.html from tinydb import TinyDB, where # ą¹€ąø£ąøµąø¢ąøą¹ƒąøŠą¹‰ąø‡ąø²ąø™ą¹‚ąø”ąø”ąø¹ąø„ tinydb import random db = TinyDB('db.json') # ą¹€ąø£ąøµąø¢ąøą¹ƒąøŠą¹‰ąøąø²ąø™ąø‚ą¹‰ąø­ąø”ąø¹ąø„ąøˆąø²ąøą¹„ąøŸąø„ą¹Œ db.json def addword(): print("ą¹„ąø”ą¹ˆąøžąøšąø›ąø£ąø°ą¹‚ąø¢ąø„ąø™ąøµ...
Python
0.00215
0882c8885b88618ea55b97ace256cdf833a1547d
Add tests for pylama isort
tests/test_pylama_isort.py
tests/test_pylama_isort.py
import os from isort.pylama_isort import Linter class TestLinter: instance = Linter() def test_allow(self): assert not self.instance.allow("test_case.pyc") assert not self.instance.allow("test_case.c") assert self.instance.allow("test_case.py") def test_run(self, src_dir, tmpdir...
Python
0
8a7ea0e8d29d443676c8893790625cbeb9d973ad
Test addByUniqueID Survey model
tests/test_survey_model.py
tests/test_survey_model.py
# Copyright (C) 2016 University of Zurich. All rights reserved. # # This file is part of MSRegistry Backend. # # MSRegistry Backend is free software: you can redistribute it and/or # modify it under the terms of the version 3 of the GNU Affero General # Public License as published by the Free Software Foundation, or a...
Python
0
280e72331d99a8c49783196951287627a933a659
Add py solution for 459. Repeated Substring Pattern
py/repeated-substring-pattern.py
py/repeated-substring-pattern.py
class Solution(object): def repeatedSubstringPattern(self, s): """ :type s: str :rtype: bool """ for i in xrange(1, len(s) / 2 + 1): if len(s) % i == 0 and len(set(s[j:j+i] for j in xrange(0, len(s), i))) == 1: return True return False
Python
0.00038
ce0834943d28f8f1b69992efd12d5e62743fb670
add an UDP multihoming example
python_examples/udp_multihome.py
python_examples/udp_multihome.py
#!/usr/bin/env python3 # -*- coding:UTF-8 -*- # Copyright (c) 2014 Nicolas Iooss # # 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...
Python
0.00001
75dc32ef71fd32c7728269b01a74faf840690473
Add a slow bot to test timeout feature
examples/too_slow_bot.py
examples/too_slow_bot.py
import random import asyncio import sc2 from sc2 import Race, Difficulty from sc2.constants import * from sc2.player import Bot, Computer from proxy_rax import ProxyRaxBot class SlowBot(ProxyRaxBot): async def on_step(self, state, iteration): await asyncio.sleep(random.random()) await super().on_...
Python
0
7c865c63d5debcf7463ad1b81470d2f044ec4738
Add lab result models
radar/patients/lab_results/models.py
radar/patients/lab_results/models.py
from sqlalchemy import Column, Integer, String, ForeignKey, Numeric, Date, Boolean from sqlalchemy.orm import relationship from radar.database import db from radar.models import PatientMixin, UnitMixin, CreatedModifiedMixin, DataSource class LabOrderDefinition(db.Model): __tablename__ = 'lab_order_definitions' ...
Python
0
36d8a0e091ec1dd4ff451031810c75cd0431ac44
add admins.py file
aligot/admin.py
aligot/admin.py
# coding: utf-8 from django.contrib import admin from .models import Note, NoteBook, NoteRevision, User admin.site.register(User) admin.site.register(NoteBook) admin.site.register(Note) admin.site.register(NoteRevision)
Python
0.000001
4e4b23ebae9274511fa3fad438b198c19b38c98d
Add a breakpad / content_shell integration test
content/shell/tools/breakpad_integration_test.py
content/shell/tools/breakpad_integration_test.py
#!/usr/bin/env python # # Copyright 2014 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. """Integration test for breakpad in content shell. This test checks that content shell and breakpad are correctly hooked up, as well...
Python
0.999999
f85a5954d337eca9b577664b1ba04e580fdf9b5c
Add slice01.py
trypython/basic/slice01.py
trypython/basic/slice01.py
# coding: utf-8 """ slice é–¢ę•°ć«ć¤ć„ć¦ć®ć‚µćƒ³ćƒ—ćƒ«ć§ć™ć€‚ """ import itertools from trypython.common.commoncls import SampleBase class Sample(SampleBase): def exec(self): ############################################################# # slice 関数 # - https://docs.python.jp/3/library/functions.html#slice ...
Python
0.00177
cf93f84dd794b63dd373cf59d802000799e32232
Create main.py
example/main.py
example/main.py
Python
0.000001
44afa72717f181fedefe692ea2f2b8d47924395f
add 'fw08.py' which defines 'BaseAction' class
framework_python/fw08.py
framework_python/fw08.py
# -*- coding: utf-8 -*- ## ## å‰å‡¦ē†ćØå¾Œå‡¦ē†ć‚’ć‚µćƒćƒ¼ćƒˆć€JSON ć‚’ć‚µćƒćƒ¼ćƒˆ ## import os import json class Request(object): def __init__(self, environ): self.environ = environ self.method = environ['REQUEST_METHOD'] self.path = environ['PATH_INFO'] class Response(object): def __init__(self): ...
Python
0.000012
4efc45499d1736933691b9de39090b86526ea4e1
Create 217_contain_duplicates.py
217_contain_duplicates.py
217_contain_duplicates.py
""" https://leetcode.com/problems/contains-duplicate/description/ Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct. """ class Solution(object): def conta...
Python
0.000607
7ab2298f22de79cd14fae9f3add1417a76bcbcd0
Add package file.
app/__init__.py
app/__init__.py
#!/usr/bin/env python from pkgutil import extend_path __path__ = extend_path(__path__, __name__) __all__ = [ 'data_visualization', 'knn_prediction', 'load_dataset', 'model_visualization', 'select_model', 'svm_prediction', 'validate_dataset', ]
Python
0
f622255dc2c6695b785213c8d69cb57ae5d8a5e9
Add pebble sdk version for detecting sdk features
waftools/pebble_sdk_version.py
waftools/pebble_sdk_version.py
from waflib.Configure import conf @conf def compare_sdk_version(ctx, platform, version): target_env = ctx.all_envs[platform] if platform in ctx.all_envs else ctx.env target_version = (int(target_env.SDK_VERSION_MAJOR or 0x5) * 0xff + int(target_env.SDK_VERSION_MINOR or 0x19)) other_v...
Python
0
79fdfaceee84321bb802f9f99ee500f400f38780
Add admin to credentials
dbaas/integrations/credentials/admin/__init__.py
dbaas/integrations/credentials/admin/__init__.py
# -*- coding:utf-8 -*- from django.contrib import admin from .. import models admin.site.register(models.IntegrationType, ) admin.site.register(models.IntegrationCredential, )
Python
0
acf0ab67db2856c71440093d0b686650e70e58e1
Create network_class.py
network_class.py
network_class.py
""" Author: Joel Rieger October 29, 2016 Description: Classes and functions to perform basic network abstraction and plotting. """ from numpy import pi as pi class network(object): """Class for one dimension network (i.e. a matching network).""" element_array=[] def __init__(self,*args): pass ...
Python
0.000004