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
1811ddb9e49307f3473add8363c464946dffb0d8
Create jsonToExcel.py
jsonToExcel.py
jsonToExcel.py
#! /usr/bin/python """ JSON to Excel v1.0 Python script to convert a JSON to a XLS file Created by: Miguel Jiménez Date: 22/10/2014 """ import json import xlwt import sys import os if sys.argv[1] == "help": print("Usage:\n\tjsonToExcel.py json_file.json") sys.exit(1) if not os.path.exists(sys.argv[1]): ...
Python
0.000019
41eeab76452cbbb92711c0a60bda4cfc28d8502f
Add network_training_tensorflow.py
demos/network_training_tensorflow.py
demos/network_training_tensorflow.py
""" TensorFlow Network Training Demo Trains a simple CNN to make velocity fields incompressible. This script runs for a certain number of steps before saving the trained network and halting. """ from phi.tf.flow import * math.seed(0) # Make the results reproducible net = u_net(2, 2) # for a fully connected network,...
Python
0.000001
ead3203a804e6397a00531d3b9e284edd87d0718
Add merge candidates cmd #72
calaccess_processed/management/commands/mergecandidates.py
calaccess_processed/management/commands/mergecandidates.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Merge Persons that share the same CAL-ACCESS filer_id. """ from django.db.models import Count from calaccess_processed.management.commands import LoadOCDModelsCommand from opencivicdata.models import Person, PersonIdentifier from opencivicdata.models.merge import merge ...
Python
0
8e857e8692bf8e07112dedb7042bdab1ecb1d20e
add implementation of Nagel and Schrekenberg algo (#5584)
cellular_automata/nagel_schrekenberg.py
cellular_automata/nagel_schrekenberg.py
""" Simulate the evolution of a highway with only one road that is a loop. The highway is divided in cells, each cell can have at most one car in it. The highway is a loop so when a car comes to one end, it will come out on the other. Each car is represented by its speed (from 0 to 5). Some information about speed: ...
Python
0
a7629ef3acedaa688a455c01afb65c40a53c14b0
Add unit test for drawing routines
tests/test_draw.py
tests/test_draw.py
import batoid import time import os import yaml import numpy as np import pytest from test_helpers import timer # Use matplotlib with a non-interactive backend. import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D @timer def initialize(ngrid=25, theta_x=1.):...
Python
0
d84ece5908afdfed7eabdb443714b7c8a615e4a4
Add Garden class - initial commit
garden/garden.py
garden/garden.py
from RPi import GPIO from time import sleep GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) class Greenhouse(object): leds = { 'red': [16, 11, 23], 'white': [13, 9, 27], 'green': [21, 12, 25], 'blue': [20, 6, 22], } def __init__(self): self._setup_gpio() def _s...
Python
0
2ea675d3f719e6e309a47d6c0e9b98b407377267
Create get_mac.py
get_mac.py
get_mac.py
import re, uuid print ':'.join(re.findall('..', '%012x' % uuid.getnode()))
Python
0.000002
a1294fc23c4875ef58676d14662e1628bb698065
Add the test structure
tests/test.py
tests/test.py
import select import socket import sys import urllib2 from time import time, sleep UDP_SOCKET_TIMEOUT = 5 class Test(object): def __init__(self, data): self.data = data def run(self): return class Data(object): """ The data aggregated from the uwsgi app """ def __init__(self...
Python
0.002096
8c9a1336ae6d200d3d6af43cd800f7da33707add
Add cifar10_with_datagen.py
cnn/cifar10_with_datagen.py
cnn/cifar10_with_datagen.py
import os import numpy as np from scipy.misc import toimage import matplotlib.pyplot as plt from keras.datasets import cifar10 from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Convolution2D, MaxPooling2D from keras.optimizers import SGD from kera...
Python
0.000005
703a94b1352d710ee4577dee0c5ad5c349d0c49e
Add SMTP returner
salt/returners/smtp_return.py
salt/returners/smtp_return.py
''' Return salt data via email The following fields can be set in the minion conf file: smtp.from (required) smtp.to (required) smtp.host (required) smtp.username (optional) smtp.password (optional) smtp.tls (optional, defaults to False) smtp.subject (optional, but helpful) smtp.fields...
Python
0.000064
ed9018fb5e234a60ea3affd0035cf562fea5fb05
add transient spiral
galpy/potential_src/TransientLogSpiralPotential.py
galpy/potential_src/TransientLogSpiralPotential.py
############################################################################### # TransientLogSpiralPotential: a transient spiral potential ############################################################################### import math as m from planarPotential import planarPotential _degtorad= m.pi/180. class TransientL...
Python
0.999387
feb25fc8b2eaa267c07990cb7f46a5b633f84119
Create matrixoff.py
matrixoff.py
matrixoff.py
""" Program is to drive the 16 pin 8x8 led matrix using WiringPi and Python. Script will turn off all led's in the matrix. by Evan Thompson January 3, 2017 https://github.com/ethom7/ledmatrix WiringPi Rpi PIN LED PIN 0 ...
Python
0.000007
58db9a9e941f165ceeb50c3ce68a9754bbafa76b
Add missing migration
geomat/stein/migrations/0007_auto_20160615_2017.py
geomat/stein/migrations/0007_auto_20160615_2017.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-06-15 20:17 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('stein', '0006_auto_20151115_1744'), ] operations = [ migrations.AddField( ...
Python
0.0002
12915a19cc860d29e80ce33be4fb318b4536f2ed
Add unit tests for get_options_html.py
csunplugged/tests/resources/utils/test_get_options_html.py
csunplugged/tests/resources/utils/test_get_options_html.py
from tests.BaseTest import BaseTest from resources.utils.get_options_html import get_options_html from resources.utils.resource_parameters import EnumResourceParameter from lxml import etree from django.test import override_settings class GetOptionsHTMLTest(BaseTest): def test_get_options_html_no_local(self): ...
Python
0.000001
1d07e80193be3cfa4e55b1c86994115fa5b7083e
test multi-layer neural network to predict numbers from pixels of images that represent numbers from 0 to 9
neural_network_test.py
neural_network_test.py
#! /usr/bin/env python # -*- coding:utf-8 # Testing a deep neural network with tensorflow. # Special thanks: Harisson@pythonprogramming.net ''' File name: neural_network_test.py Author: chimney37 Date created: 11/03/2017 Python Version: 3.62 ''' ''' We will use the MNIST data, using 60000 training sam...
Python
0.000092
dcc6ba3558696ba73d8e00f820eb8941b2d48b51
test Console-Logging
testConsoleLoggin.py
testConsoleLoggin.py
#!/usr/local/bin/python # -*- coding: utf-8 -*- from console_logging import console console.log("Hello World!") console.log("This is a log.") console.error("This is an error.") console.info("This is some neutral info.") console.success("This is a success message.")
Python
0
537e243d15d1689e9e14535acb01bf65c9cbffcf
Add migration <ADDON>GuidFile -> StoredFileNode
scripts/migrate_file_guids.py
scripts/migrate_file_guids.py
import sys import logging from website.app import init_app from scripts import utils as script_utils from framework.transactions.context import TokuTransaction from framework.guid.model import Guid from website.files import models from website.addons.box.model import BoxFile from website.addons.s3.model import S3Guid...
Python
0
a06d614a119ae25c702b51a282adc8d3f2971f9e
Stop false matches with changelog->upgradeactions linking
gen-changelog.py
gen-changelog.py
# Writes a changelog in trac WikiFormatting based on a git log from __future__ import unicode_literals, division, absolute_import import codecs from itertools import ifilter import os import re import subprocess import sys from bs4 import BeautifulSoup import dateutil.parser import requests out_path = 'ChangeLog' if...
# Writes a changelog in trac WikiFormatting based on a git log from __future__ import unicode_literals, division, absolute_import import codecs from itertools import ifilter import os import re import subprocess import sys from bs4 import BeautifulSoup import dateutil.parser import requests out_path = 'ChangeLog' if...
Python
0
4ac7d4ec350e0f56d39c72c8aa33894ff28d3fb0
add replacement for pfSctl
src/opnsense/service/configd_ctl.py
src/opnsense/service/configd_ctl.py
#!/usr/local/bin/python2.7 """ Copyright (c) 2015 Ad Schellevis part of OPNsense (https://www.opnsense.org/) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions ...
Python
0
7a687d60a607dda79e14e9e8ba50e92a19e3e916
Add basic main() function
haldane.py
haldane.py
from sensor import * from display import * from timer import * from model import * import time def main(): sensor = Sensor.factory("MS5803-14B") model = Model.factory("Buhlmann") timer = Timer.factory("Sleep", 1) display = Display.factory("Stdio") print("- Starting Haldane -") temp = sensor.g...
Python
0
80af3f92c08404a57cd660e84c1bf9d8f983920c
Create hangman.py
hangman.py
hangman.py
print 'This game is so fun right' print 'You won'
Python
0.000001
2cbeff222a7b3d0746d62c46566d463c95102fe6
Optimize the home page. #15
judge/views/blog.py
judge/views/blog.py
from django.core.urlresolvers import reverse from django.http import Http404 from django.utils import timezone from django.views.generic import ListView, DetailView from judge.comments import CommentedDetailView from judge.models import BlogPost, Comment, Problem from judge.utils.diggpaginator import DiggPaginator from...
from django.core.urlresolvers import reverse from django.http import Http404 from django.utils import timezone from django.views.generic import ListView, DetailView from judge.comments import CommentedDetailView from judge.models import BlogPost, Comment, Problem from judge.utils.diggpaginator import DiggPaginator from...
Python
0.999997
41f0533edc9ebe788722711af95e040d4f06abb9
Add simple BIRD client class
lglass/bird.py
lglass/bird.py
# coding: utf-8 import subprocess import netaddr import lglass.route class BirdClient(object): def __init__(self, executable="birdc"): self.executable = executable def send(self, command, raw=False): argv = [self.executable] if raw: argv.append("-v") if isinstance(command, str): argv.extend(comman...
Python
0
064386acbe509f872e40f3f577e7b6189ed91434
Test threading in app server rather than in serverTest.
src/test/ed/lang/python/thread2_test.py
src/test/ed/lang/python/thread2_test.py
import _10gen import ed.appserver.AppContext import ed.lang.python.Python import java.io.File # FIXME: this test produces a lot of output _10gen.__instance__ = ed.lang.python.Python.toPython(ed.appserver.AppContext(java.io.File('.'))) import test.test_thread import test.test_threading
Python
0
3d90377b062862d9461d9d8cca59025130d344d8
Add first prototype for Aizek body
python/robotics/aizek_body.py
python/robotics/aizek_body.py
import math from RPi import GPIO as gpio from actors.redbot_motor_actor import RedbotMotorActor from controllers.pid_controller import PIDController from interfaces.spi.mcp3008_spi_interface import MCP3008SpiInterface from sensors.redbot_wheel_encoder_sensor import RedbotWheelEncoderSensor from sensors.sharp_ir_dista...
Python
0
28b285e0f3810d009f141217759130afb517d8e8
Remove wrong log message
smile_log/models/smile_log.py
smile_log/models/smile_log.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011 Smile (<http://www.smile.fr>). All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under th...
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011 Smile (<http://www.smile.fr>). All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under th...
Python
0
ab79e32552e1292feb75db52426d6fd4418c8262
Add a snippet.
python/wave/read_wav_file2.py
python/wave/read_wav_file2.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Read the content of an audio wave file (.wav) # See: https://docs.python.org/3/library/wave.html import wave with wave.open("./test.wav", mode="rb") as wr: print(wr.readframes(20)) # Read the 20 first frames print("Num channels:", wr.getnchannels()) pr...
Python
0.000002
610f560c086320b42d83aab7644fe5d9a99d2cb7
Add channel invite test
tests/unit/channels/test_invite.py
tests/unit/channels/test_invite.py
# Copyright (c) 2014 Katsuya Noguchi # # 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, publish, dis...
Python
0
9b4c716117966194d046eef56ea5f891ce3d40f9
Implement char CNN
model.py
model.py
import tensorflow as tf def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial) def bias_variable(shape): initial = tf.constant(0.1, shape=shape) return tf.Variable(initial) def conv2d(input_, output_dim, k_h, k_w): w = weight_variable([k_h, k_w...
Python
0.99958
cf31afad7752c3da5eba72613f89e7247a3eaed4
put actual file up
trainwreck.py
trainwreck.py
import pygame from time import sleep from pygame.locals import * import sys pygame.init() white = (255,255,255) black = (0,0,0) red = (255, 0, 0) green = (0, 255, 0) blue = (0,0, 255) gray = (100, 100, 100) train = pygame.image.load('pixel-train2.png') screen = pygame.display.set_mode((600, 600)) pygame.display.se...
Python
0
3b5234a370db18fc51d8ad8573981c85544abb47
Add code to fix the python 2.6.6 auth failure issue.
test/frameworks/lib/fix_auth_failure.py
test/frameworks/lib/fix_auth_failure.py
#!/usr/bin/env python # $Id: fix_auth_failure.py,v 1.1 2011-02-15 20:28:38 barry409 Exp $ # Copyright (c) 2011 Board of Trustees of Leland Stanford Jr. University, # all rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation fi...
Python
0.997951
670bd6e65721df376d8b3a5305a1fdb358d214d3
bump version in __init__.py
oneflow/__init__.py
oneflow/__init__.py
VERSION = '0.16.1.7'
VERSION = '0.16.1.6'
Python
0.000023
3db5b1e7099e1c10d557577350dc28e323c70af4
fix stale libvirt images on download failure. Bug 801412
nova/virt/images.py
nova/virt/images.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you m...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you m...
Python
0.000002
ece1b5f163abb61d080b5e8d0fc8d57a311635d0
Fix changes in handler arguments
src/robotide/spec/libraryfetcher.py
src/robotide/spec/libraryfetcher.py
# Copyright 2008-2012 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-2012 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.000004
b7c54e6bf4c91587df0e74f04ba63b50d01977aa
Create test2.py
test2.py
test2.py
import sys with open(sys.argv[1]) as f: lines = f.readlines() for ln in lines: ln = ln.replace("\n", "") ln = ln.replace(" ", "") rev_ln = ''.join(sorted(ln, reverse=True)) result = True ln_len = len(ln) half_ln_len = ln_len/2 i = 0 while i < half_ln_len: if ln[i] != ln[ln_l...
Python
0.000004
651bcc183dbca491872b16a77054f165ab908c4d
Add tests for boards app serializers
blimp/boards/tests/test_serializers.py
blimp/boards/tests/test_serializers.py
from rest_framework.test import APIRequestFactory from ...utils.tests import BaseTestCase from ..views import BoardViewSet from ..serializers import BoardSerializer, BoardCollaboratorRequestSerializer class BoardSerializerTestCase(BaseTestCase): def setUp(self): self.create_user() self.create_acc...
Python
0
0596076729b651e1042aa3bf2d5018620aa281af
Add async object list iterator
gmn/src/d1_gmn/app/management/commands/objectlist_async.py
gmn/src/d1_gmn/app/management/commands/objectlist_async.py
# -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2016 DataONE # # Licensed under the Apache License, Version 2.0 ...
Python
0.000002
a8bd9defcf3359296acf7633041b036213868075
Make getting started easier with a handy script
install.py
install.py
#!/usr/bin/env python import subprocess def sudo(command_text): parts = ['sudo'] parts.extend(command_text.split(command_text)) subprocess.call(parts) def apt_get_install(package_name): command_text = "apt-get -y install {0}".format(package_name) sudo(command_text) def main(): # Install s...
Python
0.000001
fd1fcead596844552a90980166b9f2a73aabc089
test cases for 3X3_2K1R scenario and to the fucntion that validates a individual configuration
tests.py
tests.py
import naive def test_is_valid_configuration_3X3_2K1R(): all_configurations = [ (1,0,1,0,0,0,0,4,0), (1,0,0,0,0,4,1,0,0), (0,0,1,4,0,0,0,0,1), (0,4,0,0,0,0,1,0,1) ] M = N = 3 for conf in all_configurations: assert naive.is_valid_configuration(list(conf), M, N) ...
Python
0
b372c34cf8bb111c0dcc25b391220f54bc22b36f
add functioning bundestag_reden_down.py
bundestag_down/bundestag_reden_down.py
bundestag_down/bundestag_reden_down.py
# script to download all "Plenardebatten" from the Deutscher Bundestag # http://dipbt.bundestag.de/doc/btp/17/17140.pdf base_url = "http://dipbt.bundestag.de/doc/btp/" def get_name( period, docnum ): return base_url + '{:=02}'.format(period) + "/" + '{:=02}'.format(period) + '{:=03}'.format(docnum) + ".pdf" d...
Python
0.000025
deeeaba3070f3848c2ed85b85caa2291b5b42ae7
add script for cleaning up build env '.build' dirs after a successful build and backup.
tools/cleanup-buildenv-build-dir.py
tools/cleanup-buildenv-build-dir.py
#!/usr/bin/env python # -*- coding: utf-8 # Copyright 2014 The 'mumble-releng' Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that # can be found in the LICENSE file in the source tree or at # <http://mumble.info/mumble-releng/LICENSE>. # cleanup-buildenv-build-dir.py cleans...
Python
0
ac636016d75f0f874973edf2a8fe1ab991b868c7
Fix #6: Added auto-setup script
install.py
install.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import platform import subprocess # Identify the type of operating system for install packages OS = platform.dist()[0].lower() if OS == "fedora" or OS == "redhat": install = "sudo yum install " elif OS == "ubuntu" or OS == "debian": install = "sudo apt...
Python
0
d71eaed10b2c62fc5b5c6436d146a561479198a3
bump version in __init__.py
oneflow/__init__.py
oneflow/__init__.py
VERSION = '0.20.11.17'
VERSION = '0.20.11.16'
Python
0.000023
135a8117b14817ba06932f5af4c827e183265079
bump version in __init__.py
oneflow/__init__.py
oneflow/__init__.py
VERSION = '0.18.2.4'
VERSION = '0.18.2.2'
Python
0.000023
f2f1ba286a1e0d651b989c755585284e13401154
Fix following the rename `Preference` -> `Preferences`.
oneflow/core/api.py
oneflow/core/api.py
# -*- coding: utf-8 -*- import logging from tastypie_mongoengine.resources import MongoEngineResource from tastypie_mongoengine.fields import ReferencedListField, ReferenceField from tastypie.resources import ALL from tastypie.fields import CharField from .models.nonrel import (Feed, Subscription, ...
# -*- coding: utf-8 -*- import logging from tastypie_mongoengine.resources import MongoEngineResource from tastypie_mongoengine.fields import ReferencedListField, ReferenceField from tastypie.resources import ALL from tastypie.fields import CharField from .models.nonrel import Subscription, Feed, Article, Read, Aut...
Python
0.000012
c653d0cc8989755ba44c31910b5f3c93f44d9d45
Fix issue 121
pages/utils.py
pages/utils.py
# -*- coding: utf-8 -*- from django.conf import settings as django_settings from django.template import TemplateDoesNotExist from django.template.loader_tags import ExtendsNode, ConstantIncludeNode from django.template.loader_tags import BlockNode from django.template import loader, Context, RequestContext from django....
# -*- coding: utf-8 -*- from django.conf import settings as django_settings from django.template import TemplateDoesNotExist from django.template.loader_tags import ExtendsNode, ConstantIncludeNode from django.template.loader_tags import BlockNode from django.template import loader, Context, RequestContext from django....
Python
0
55b6134e9fbab02bbabb1a298f3bb2777608d9a1
Fix issue 106
pages/views.py
pages/views.py
# -*- coding: utf-8 -*- from django.http import Http404, HttpResponsePermanentRedirect from django.shortcuts import get_object_or_404 from django.contrib.sites.models import SITE_CACHE from pages import settings from pages.models import Page, Content from pages.utils import auto_render, get_language_from_request, get_p...
# -*- coding: utf-8 -*- from django.http import Http404, HttpResponsePermanentRedirect from django.shortcuts import get_object_or_404 from django.contrib.sites.models import SITE_CACHE from pages import settings from pages.models import Page, Content from pages.utils import auto_render, get_language_from_request, get_p...
Python
0
69cc1b9283f31042ea5f8e173f471f27a7cf130c
Add CommonPlaySkill, unifying search and control
mycroft/skills/common_play_skill.py
mycroft/skills/common_play_skill.py
# Copyright 2018 Mycroft AI Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
0
92d878f191b222316dcebb9e9b5492f871c00e06
Add instance class
instance.py
instance.py
""" Instance class to hold data for each example. """ import os import numpy as np import scipy.misc as misc from tqdm import tqdm # ---- Enum classes for vector descriptions class Gender: female = [1., 0.] male = [0., 1.] class Emotion: angry = [1., 0., 0., 0., 0., 0., 0., 0.] contempt...
Python
0.000007
6f3579e6ac32211779481307f8e508469dde7605
Add example of how to read from a external GPS outputting NMEA messages.
externalNMEA.py
externalNMEA.py
from __future__ import print_function import requests import argparse import time import logging import sys import serial import pynmea2 log = logging.getLogger() logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO) def set_position_master(url, latitude, longitude, orientation): payload = di...
Python
0.000005
8117e10dc49f20a167d94ae278cd904a0e27188e
Add Class definitions for models for the products calls and variables
pitchfork/models.py
pitchfork/models.py
from pitchfork import db import re class Product: def __init__(self, product): self.app_url = product.get('app_url') self.title = product.get('title') self.us_api = product.get('us_api') self.uk_api = product.get('uk_api') self.require_dc = bool(product.get('require_dc')...
Python
0
ac0d0b78b7b4eef913460894fca3af1ace222c7f
Test template for the Damage class
tests/test_damage.py
tests/test_damage.py
import unittest from damage import Damage class DamageTests(unittest.TestCase): def test_init(self): dmg = Damage(phys_dmg=1.34, magic_dmg=1.49391) expected_phys_dmg = 1.3 expected_m_dmg = 1.5 expected_absorbed = 0 # it should round the magic/phys dmg to 1 point after the ...
Python
0
dd5c0e1f66785089e4d996e40f1a8b93308ab42d
Add unittest
tests/test_params.py
tests/test_params.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import datetime as dt import decimal from datetime import datetime import mongoengine as me import pytest from marshmallow_mongoengine import ModelSchema TEST_DB = 'marshmallow_mongoengine-test' db = me.connect(TEST_DB) class BaseTest(object): @cl...
Python
0.000001
9349adb2efa5f0242cf9250d74d714a7e6aea1e9
Make version compatible with PEP386
ordination/__init__.py
ordination/__init__.py
from .base import CA, RDA, CCA __all__ = ['CA', 'RDA', 'CCA'] # #from numpy.testing import Tester #test = Tester().test # Compatible with PEP386 __version__ = '0.1.dev'
from .base import CA, RDA, CCA __all__ = ['CA', 'RDA', 'CCA'] # #from numpy.testing import Tester #test = Tester().test __version__ = '0.1-dev'
Python
0
df77b24a730190342b2f6384bcaf052532c82632
Add files via upload
find_min_max.py
find_min_max.py
path = "wordlist.txt" maxWordCount = 3 file = open(path, "r") words = file.read().replace("\n", "").split(",") file.close() maxlen = [] minlen = [] for i in range(maxWordCount): maxlen.append([]) minlen.append([]) for j in range(i+1): maxlen[i].append(0) minlen[i].append(100)...
Python
0
c0d9c0aa93a5e32e04eaba3bfc8d4cf30a88395d
add configuration class
micronota/config.py
micronota/config.py
# ---------------------------------------------------------------------------- # Copyright (c) 2015--, micronota development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # ---------------------------------------------...
Python
0.000001
cb210e39fc6dc9bc3654dad0a70f29bc206688b4
Create feedback.py
plugins/feedback.py
plugins/feedback.py
@bot.message_handler(commands=['feedback', 'sendfeedback']) def send_feedbackz(message): userid = message.from_user.id banlist = redisserver.sismember('zigzag_banlist', '{}'.format(userid)) if banlist: return if userid not in messanger_list: bot.reply_to(message, MESSANGER_JOIN_MSG, parse_mode="Markdown...
Python
0
c5e047ff0e1cfe35692838365b907db8c3746c4b
Add join_segmentations example to the gallery
doc/examples/plot_join_segmentations.py
doc/examples/plot_join_segmentations.py
""" ========================================== Find the intersection of two segmentations ========================================== When segmenting an image, you may want to combine multiple alternative segmentations. The `skimage.segmentation.join_segmentations` function computes the join of two segmentations, in wh...
Python
0
c231a440cd0b79a2e64fc050849ce3bc8e9b6f98
Annotate zerver/templatetags/minified_js.py.
zerver/templatetags/minified_js.py
zerver/templatetags/minified_js.py
from __future__ import absolute_import from typing import Any from django.template import Node, Library, TemplateSyntaxError from django.conf import settings from django.contrib.staticfiles.storage import staticfiles_storage if False: # no need to add dependency from django.template.base import Parser, Token ...
from __future__ import absolute_import from django.template import Node, Library, TemplateSyntaxError from django.conf import settings from django.contrib.staticfiles.storage import staticfiles_storage register = Library() class MinifiedJSNode(Node): def __init__(self, sourcefile): self.sourcefile = sour...
Python
0
6536a5893e44a40a776fe98c97ed0326299cc27b
Create 03.py
Euler/03.py
Euler/03.py
def prime_sieve(limit): is_prime = [False] * (limit + 1) for x in range(1,int(limit**.5)+1): for y in range(1,int(limit**.5)+1): n = 4*x**2 + y**2 if n<=limit and (n%12==1 or n%12==5): # print "1st if" is_prime[n] = not is_prime[n] n = ...
Python
0
ebb3af21130c817eb41ecc0b79ec0dab2f5f64bf
Implement pull_request event
captain_hook/services/github/events/pull_request.py
captain_hook/services/github/events/pull_request.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from ...base.events import BaseEvent class PullRequestEvent(BaseEvent): def process(self): pr_link = str(self.body['pull_request']['url']).replace('https://api.github.com/', '') params = { 'username': self.body['pull_requ...
Python
0.000008
b8db983c3b901ea45fabbfd87a1e92ae3722e8fe
Initialize 04.sameName
books/AutomateTheBoringStuffWithPython/Chapter03/04.sameName.py
books/AutomateTheBoringStuffWithPython/Chapter03/04.sameName.py
# This program uses the same variable name throughout def spam(): eggs = 'spam local' print(eggs) # prints 'spam local' def bacon(): eggs = 'bacon local' print(eggs) # prints 'bacon local' spam() print(eggs) # prints 'bacon local' eggs = 'global' bacon() print(eggs) # prints 'global'
Python
0.999987
2b146388d1804ca4cb069fa07ea5e614a8ee1d14
Add example of sending push notification via Firebase Cloud Messaging
tools/send_to_fcm.py
tools/send_to_fcm.py
import requests url = 'https://fcm.googleapis.com/fcm/send' headers = {'Content-Type': 'application/json', 'Authorization': 'key=AIza...(copy code here)...'} payload = """ { "to": "/topics/all", "notification": { "title": "Hello world", "body": "You are beautiful" } } """ resp = requests.po...
Python
0
42ee5971dfd7309e707213d18c2041128a79e901
add test for overwrite grads
treeano/sandbox/tests/utils_test.py
treeano/sandbox/tests/utils_test.py
import nose.tools as nt import numpy as np import theano import theano.tensor as T import treeano import treeano.nodes as tn from treeano.sandbox import utils fX = theano.config.floatX def test_overwrite_grad_multiple_args(): class Foo(utils.OverwriteGrad): def __init__(self): def fn(a, b):...
Python
0
6557b2fc86c340968755274bbd97262b79dd1115
Add blank __init__ to make NEURON a package
pyrho/NEURON/__init__.py
pyrho/NEURON/__init__.py
Python
0.000952
ebba34e159704332b26b9211392e7a1b0b3039ba
bump version to 1.0.3
setup.py
setup.py
#!/usr/bin/env python # Copyright 2011 The greplin-twisted-utils Authors. # # 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 require...
#!/usr/bin/env python # Copyright 2011 The greplin-twisted-utils Authors. # # 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 require...
Python
0
067236f0d1afc646967acfe3a37faa6643afbecb
Create setup.py
setup.py
setup.py
# setup.py info things from distutils.core import setup setup( name = "Kevin" )
Python
0.000001
b3c99aba7d5c82bc8c7c08c4ba8461522f18fef0
Add some more trove classifiers; most importantly License (#71)
setup.py
setup.py
import sys import io from setuptools import setup, find_packages, __version__ as setuptools_version from pkg_resources import parse_version import pkg_resources try: import _markerlib.markers except ImportError: _markerlib = None # _markerlib.default_environment() obtains its data from _VARS # and wraps it...
import sys import io from setuptools import setup, find_packages, __version__ as setuptools_version from pkg_resources import parse_version import pkg_resources try: import _markerlib.markers except ImportError: _markerlib = None # _markerlib.default_environment() obtains its data from _VARS # and wraps it...
Python
0
b53b228ec81a1d7e65e7056fee2711f6a2f557b0
Add setup.py
setup.py
setup.py
from setuptools import setup, find_packages import os import sys long_description = """This project contains library functions for converting\ between the Unit Address and MAC address representations of SCTE 55-1\ terminals, e.g. Motorola-brand set-top boxes and CableCARDs""" setup( name='scte_55-1_address', ...
Python
0.000001
3898db5ffff2b3515e6f41e7c17e3f5b5fce9243
Create setup.py
setup.py
setup.py
from setuptools import find_packages, setup version = __import__('deduplicated').__version__ setup( name='deduplicated', version=version, description='Check duplicated files', author='Eduardo Klosowski', author_email='eduardo_klosowski@yahoo.com', license='MIT', packages=find_packages(),...
Python
0.000001
a03130d23474efd7c4e2440618453d26e4f19f18
Create setup.py
setup.py
setup.py
from setuptools import setup, find_packages import re, os requirements = [] with open('requirements.txt') as f: requirements = f.read().splitlines() version = '' with open('cleverbot/__init__.py') as f: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1) if not ver...
Python
0.000001
5ae7dcf5c1ebfdb70b1e12ed48dfa42fba348c7c
Add setup.py
setup.py
setup.py
from setuptools import setup, find_packages import inbox requirements = [ "click", ] setup( name="inbox", version=inbox.__version__, url='TODO', description=inbox.__doc__, author=inbox.__author__, license=inbox.__license__, long_description="TODO", packages=find_packages(), in...
Python
0.000001
cf4c893560bede792e8f1c809d54a89f1c9b9870
Add setup.py.
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2014 Jan-Philip Gehrcke (http://gehrcke.de). # See LICENSE file for details. import re from setuptools import setup long_description = \ """Beautiful-readme converts a single README file into a simple and modern `Bootstrap`_-powered static website. Resource...
Python
0
450a186d7827b40dbb3a8ddde1f5f3e48b5143af
bump version
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup setup( name='django_linter', version='0.1', packages=('django_linter', 'django_linter.checkers'), description='Linter for django projects', long_description=open('README.rst').read(), author='Timofey Trukhanov', author_email='timofey.trukh...
#!/usr/bin/env python from setuptools import setup setup( name='django_linter', version='0.0.3', packages=('django_linter', 'django_linter.checkers'), description='Linter for django projects', long_description=open('README.rst').read(), author='Timofey Trukhanov', author_email='timofey.tru...
Python
0
49358019f146aa479b75ddb0dc75dffd1ecc351b
Create setup.py
setup.py
setup.py
#! /usr/bin/env python from setuptools import setup setup( name='rdfa_markdown', version='0.1', author='James McCusker', author_email='mccusj@cs.rpi.edu', description='Python-Markdown extension to add support for semantic data (RDFa).', url='https://github.com/tetherless-world/markdown-rdfa', ...
Python
0.000001
b8bab32410d866f9f547c4bd04de942e2e809816
Add a setup.py.
setup.py
setup.py
#!/usr/bin/env python3 from distutils.core import setup kwargs = { "name": "python-mpv", "author": "Lars Gustäbel", "author_email": "lars@gustaebel.de", "url": "http://github.com/gustaebel/python-mpv/", "description": "control mpv from Python using JSON IPC", "license":...
Python
0
adba5f0aef9a7bfbe9e239726fa627f126db8efd
Split into two packages #30
setup.py
setup.py
''' Nereid Nereid - Tryton as a web framework :copyright: (c) 2010-2013 by Openlabs Technologies & Consulting (P) Ltd. :license: GPLv3, see LICENSE for more details ''' from setuptools import setup setup( name='Nereid', version='2.4.0.7dev', url='http://nereid.openlabs.co.in/docs/', l...
''' Nereid Nereid - Tryton as a web framework :copyright: (c) 2010-2013 by Openlabs Technologies & Consulting (P) Ltd. :license: GPLv3, see LICENSE for more details ''' import re from setuptools import setup, Command class RunTests(Command): description = "Run tests" user_options = [] ...
Python
0.000002
9fa978c6673759142a875d9b05a4f9c110f13718
add setup.py
setup.py
setup.py
import os from setuptools import find_packages, setup with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='django-posttls', ve...
Python
0.000001
6ae505c2b6d8ad65b6cc61587b28a8de81ecb488
Add setup.py file
setup.py
setup.py
from distutils.core import setup setup( name = "twilio", py_modules = ['twilio'], version = "3.0.0", description = "Twilio API client and TwiML generator", author = "Twilio", author_email = "help@twilio.com", url = "http://github.com/twilio/twilio-python/", download_url = "http://github....
Python
0.000001
ff48d7a242e1b8c67faa7a4b5ab43e641a1dd910
add setup.py
setup.py
setup.py
# -*- coding:utf-8 -*- from setuptools import find_packages, setup README = """# tpl """ setup( name='tpl', version='0.1.0', description='Command line utility for generating files or directories from template', long_description=README, author='程飞', url='https://github.com/faycheng/tpl.git', ...
Python
0.000001
6df13e80a4684a11ccbc53d9b30bb54067ce8196
correct app URL
setup.py
setup.py
import os from setuptools import setup with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='yak-server', version='0.1', pac...
import os from setuptools import setup with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='yak-server', version='0.1', pac...
Python
0
7f9dee365f27bf288fae513739651462b8c78071
Create setup.py
setup.py
setup.py
from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='setbadge', version='0.0.1', description='Set the Pythonista app\'s badge value to a custom text string!', long_description=readme(), classifiers=[ 'Development Status :: 3 - Alpha', 'License :...
Python
0.000001
17e66f79118f87aea452f7ca658142e6d5d71a1b
Add shell.py
shell.py
shell.py
import pymongo as pm client = pm.MongoClient() db = client.kasm redirects = db.redirects ## list(redirects.find())
Python
0.000005
0e7f71c0e6c9d7f90710523cd657647c11fbd694
add csvsql
csvsql.py
csvsql.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import io import re import csv import sys import codecs import argparse import binascii import collections ESCAPE_SEQUENCE_RE = re.compile(r''' ( \\U........ # 8-digit hex escapes | \\u.... # 4-digit hex escapes | \\x.. # 2-...
Python
0.000014
1348f5c9068aa4059ed41ee03635c7da6f5b04f0
add max_path_sum
tree/max_path_sum.py
tree/max_path_sum.py
# http://www.geeksforgeeks.org/find-maximum-path-sum-in-a-binary-tree/ class Node: def __init__(self, value): self.value = value self.left = None self.right = None def run(root, s): if not root: return 0 max_child = max(run(root.left, s), run(root.right, s)) return s...
Python
0.000121
71bfe8974e3274c80c2fd6d1be4c54a24345a0e7
add test_rgw
src/test/pybind/test_rgw.py
src/test/pybind/test_rgw.py
from nose.tools import eq_ as eq, assert_raises from rgw import Rgw def test_rgw(): rgw = Rgw() xml = """<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Owner> <ID>foo</ID> <DisplayName>MrFoo</DisplayName> </Owner> <AccessControlList> <Grant> <Grantee xmlns:xsi=\"...
Python
0
2c444b9ebc03aaef77b12e7d649f9f7359681420
Add : first attempt of a webservice commands for the arbiter.
shinken/modules/ws_arbiter.py
shinken/modules/ws_arbiter.py
#!/usr/bin/python #Copyright (C) 2009 Gabes Jean, naparuba@gmail.com # #This file is part of Shinken. # #Shinken is free software: you can redistribute it and/or modify #it under the terms of the GNU Affero General Public License as published by #the Free Software Foundation, either version 3 of the License, or #(at yo...
Python
0
15c7b734bcd830b819bfbafdf94da48931dd7b7b
Create get-img.py
get-img.py
get-img.py
import urllib, json, sys, os.path, argparse import hashlib import time import re # //==== EDIT THIS ====\\ log_file = open('log.txt', 'r+') username = 'dronenerds' sleep_time = 120 download_img = False console_log = True download_img1 = True path_name = 'images/' # //==== EDIT THIS ====\\ def find_new_images(imag...
Python
0.000002
f4504fdb70cff7089164f0cc9ae30e972d61ec30
add lux.py
lux/lux.py
lux/lux.py
import logging import serial import time logger = logging.getLogger(__name__) class SingleLuxDevice(object): def __init__(self, port, baudrate=115200): self.ser = serial.Serial(port, baudrate) self.addresses = {} def close(self): self.ser.close() def raw_packet(self, data): ...
Python
0.000524
80b47093f6ccbe75be7e4382e0cfd948c868763d
add new log of media test (#3265)
functional_tests/core/05-log-media.py
functional_tests/core/05-log-media.py
#!/usr/bin/env python """Base case - logging sequence of media types multiple times --- id: 0.core.05-log-media plugin: - wandb - numpy assert: - :wandb:runs_len: 1 - :wandb:runs[0][config]: {} - :wandb:runs[0][summary][media][count]: 2 - :wandb:runs[0][summary][media][_type]: images/separated ...
Python
0
ee6ab9fc5f580267f089108dc9c27a8a0208ebf0
Add __init__.py to make it work like a module
pySMOTE/__init__.py
pySMOTE/__init__.py
from .smote import SMOTE
Python
0.000033
76ce99ba04151a00ee1101ebed4f883fd1112433
Create mad-lib.py
mad-lib.py
mad-lib.py
skill = raw_input("What's a skill you want to learn?:") adverb = raw_input("Enter an adverb:") animal = raw_input("Name an animal:") body = raw_input("Name a body part:") event = raw_input("Name a fun event:") emotion1 = raw_input("Name a positive emotion (past tense):") emotion2 = raw_input("Name another positive emot...
Python
0
c20abf6b2ae6cb2518971ea03b7edbf7035b1661
send email to system managers about gst setup
erpnext/patches/v8_1/setup_gst_india.py
erpnext/patches/v8_1/setup_gst_india.py
import frappe from frappe.email import sendmail_to_system_managers def execute(): frappe.reload_doc('regional', 'doctype', 'gst_hsn_code') for report_name in ('GST Sales Register', 'GST Purchase Register', 'GST Itemised Sales Register', 'GST Itemised Purchase Register'): frappe.reload_doc('regional', 'report',...
import frappe def execute(): frappe.reload_doc('regional', 'doctype', 'gst_hsn_code') for report_name in ('GST Sales Register', 'GST Purchase Register', 'GST Itemised Sales Register', 'GST Itemised Purchase Register'): frappe.reload_doc('regional', 'report', frappe.scrub(report_name)) if frappe.db.get_single...
Python
0
0c1ef1267a67ce103f5ba0545bae690ce77c8180
Add a deploy script
deploy.py
deploy.py
#!/usr/bin/env python """ Script for deploying a new version of the python-asana library. """ import argparse import re import subprocess import sys if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument( 'version', help='Version to deploy as, in format x.y.z') args = parser....
Python
0.000002
8255772770e20f51338da36dc7fa027b4dc0f07e
Allow photos in pages
awesomeshop/photo.py
awesomeshop/photo.py
import os.path, uuid from PIL import Image from flask.ext.babel import lazy_gettext from . import app, db thumb_size = app.config['THUMBNAIL_SIZE'] preview_size = app.config['PREVIEW_SIZE'] class Photo(db.EmbeddedDocument): filename = db.StringField(db_field='fname', max_length=50, ...
Python
0.000002
6c52676493bbf4d8f64a65712034b18bbee279ba
Create syracuse.py
python/syracuse/syracuse.py
python/syracuse/syracuse.py
n = int(input("Veuillez saisir un entier : ")) vol = 0 while(n != 1): if(n % 2 == 0): n /= 2 else: n = n*3 + 1 vol +=1 print("Le temps de vol du nombre ",n," est ",vol)
Python
0.000002
1064634cb9f3752e890b56bfddb49e51e70e530b
add munin alert script
python/utils/munin_alert.py
python/utils/munin_alert.py
#! /usr/bin/env python3 """ Script to send email alert for munin Munin Config: munin.conf contact.admin.command | /path/to/munin_alert.py contact.admin.max_messages 1 @author: cuongnb14@gmail.com """ import smtplib import fileinput import logging logger = logging.getLogger('munin_alert') logger.setLevel(logging.DE...
Python
0
23ad0bf077c846e13e8b970f8928f06d02d658a3
Make initial migration
students/migrations/0001_initial.py
students/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('master_data', '0001_initial'), ('back_office', '0007_teacher_nationality'), ] operations = [ migrations.CreateModel(...
Python
0.000015
1334b085f76db914ede6b941c23ea61329df1fbd
Create relaycontrol.py
raspberrypi/relaycontrol.py
raspberrypi/relaycontrol.py
import paho.mqtt.client as mqtt import json, time import RPi.GPIO as GPIO from time import sleep # The script as below using BCM GPIO 00..nn numbers GPIO.setmode(GPIO.BCM) # Set relay pins as output GPIO.setup(24, GPIO.OUT) # ----- CHANGE THESE FOR YOUR SETUP ----- MQTT_HOST = "190.97.168.236" MQTT_PORT = 1883 US...
Python
0.000001
f5ca504a390b8db3432dc7d67f934cd29daf3086
add openssl recipe
recipes/openssl/__init__.py
recipes/openssl/__init__.py
from toolchain import Recipe, shprint from os.path import join, exists import sh import os arch_mapper = {'i386': 'darwin-i386-cc', 'x86_64': 'darwin64-x86_64-cc', 'armv7': 'iphoneos-cross', 'arm64': 'iphoneos-cross'} class OpensslRecipe(Recipe): version = "1.0.2a" ...
Python
0.000001