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
98dcea81abcfb795c61b24b260c5a5592d24b2d4
use this file to built unit tests
tests/test_money.py
tests/test_money.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from decimal import Decimal import cPickle as pickle from django.utils.formats import number_format from . import Money from .money_maker import MoneyMaker, AbstractMoney # Tests: m1 = Money('1.46') m2 = Money('3.54') m3 = Money(Decimal('8.99')) m4 = Mone...
Python
0
0d32800fec1419eac39711fd8c94ce07896cddaf
Test for the gaussian output layer, going through all same fit() and predict() tests as the linear output.
sknn/tests/test_gaussian.py
sknn/tests/test_gaussian.py
import unittest from nose.tools import (assert_is_not_none, assert_raises, assert_equal) from sknn.mlp import MultiLayerPerceptronRegressor as MLPR from . import test_linear class TestGaussianOutput(test_linear.TestLinearNetwork): def setUp(self): self.nn = MLPR(layers=[("LinearGaussian",)])
Python
0
dfa8f4b867a17a6f63a0e2e2e5f7f615ad514fc0
improve proj
notes/code/linked_list.py
notes/code/linked_list.py
# Hmm.... python classes are not so clear. class LinkedList: pass class Node: def __str__(self): return str(self.value) names = LinkedList() names.head = None def add(llist,x): newnode = Node() newnode.value = x newnode.next = llist.head llist.head = newnode def printlist(llist): ...
Python
0.000002
5fb337e143ae55d98b3772dc6f5059d0c01115c1
Create package __init__.py file.
__init__.py
__init__.py
""" SConsProject The sconsproject package proposes a way to easily create the compilation system of your project with the minimum of information. It's an helper around SCons. ######################################## # Example 1 from sconsProject import SConsProject project = SConsProject() Export('project') Export({...
Python
0
436029e6f4626d0e13393206cc38e5f2cae9c770
Create __init__.py
__init__.py
__init__.py
Python
0.000429
3402602d0aaf39e491a6422ba35f175bc249539b
Add __init__.py.
__init__.py
__init__.py
from mpyq import MPQArchive __all__ = ['MPQArchive']
Python
0.000084
4ed138d379aa1e16d852907aa31e40b799818356
tornado blocking task
toys/tornado_blocking_task.py
toys/tornado_blocking_task.py
# coding=utf-8 """ Ref: https://gist.github.com/methane/2185380 测试方法: curl 'http://127.0.0.1:8888/' & curl 'http://127.0.0.1:8888/' & curl 'http://127.0.0.1:8888/' & curl 'http://127.0.0.1:8888/' & curl 'http://127.0.0.1:8888/hello' & curl 'http://127.0.0.1:8888/hello' & curl 'http://12...
Python
0.999553
993166a29428c7381f09aac0bd8d7de3a5be3bfc
Add a status_logger for better monitoring of buildbot events.
scripts/master/status_logger.py
scripts/master/status_logger.py
# 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. import logging import os import time from logging.handlers import TimedRotatingFileHandler from buildbot.status.base import StatusReceiverMultiService c...
Python
0.000006
6d33848780d71c9bf725288f1f92d022f143a7e6
add sift_matcher #132
jsk_2015_05_baxter_apc/node_scripts/sift_matcher.py
jsk_2015_05_baxter_apc/node_scripts/sift_matcher.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # import os import gzip import cPickle as pickle import numpy as np import yaml import rospy from posedetection_msgs.msg import ImageFeature0D from jsk_2014_picking_challenge.srv import ObjectMatch, ObjectMatchResponse from sift_matcher_oneimg import SiftMatcherOneImg ...
Python
0.000001
c0aa12111befbc6a5779be6a0111f7b80027082d
add new package (#6659)
var/spack/repos/builtin/packages/tasmanian/package.py
var/spack/repos/builtin/packages/tasmanian/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
d8fd5835b6ba0a6de757fe4aa63fa97bdbd15f83
add new package (#2486)
var/spack/repos/builtin/packages/rename/package.py
var/spack/repos/builtin/packages/rename/package.py
############################################################################## # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
a3261609967444c01039908d4eb7ccd7feaf3616
add blinker example.
trypython/extlib/blinker01.py
trypython/extlib/blinker01.py
""" イベントディスパッチライブラリ blinker のサンプルです。 基本的な signal の使い方について。 REFERENCES:: https://github.com/jek/blinker https://pythonhosted.org/blinker/ """ import blinker as bl from trypython.common.commoncls import SampleBase from trypython.common.commonfunc import hr class Sample(SampleBase): """Blinker の基本的な使い方について""" ...
Python
0
558e5ff1a4d33f339d34a4fe2fac649cd22f45c3
add reprlib.repr() sample.
trypython/stdlib/reprlib01.py
trypython/stdlib/reprlib01.py
""" reprlib についてのサンプルです。 link:: https://docs.python.jp/3/library/reprlib.html """ import functools import random import reprlib import string from typing import Sequence, Callable from trypython.common.commoncls import SampleBase from trypython.common.commonfunc import pr class ManyFields: def __init__(self, ...
Python
0
a4945972bb4f04c2d18fec87ec4c6d6e955cba1c
add release script
release.py
release.py
#! /usr/bin/env python import subprocess import sys GIT_SHOW_REF_HEARD = 'git show-ref --verify --quiet refs/heads/%s' GIT_SHOW_REF_TAGS = 'git show-ref --verify --quiet refs/tags/%s' def checkExistingTag(version): if (subprocess.call((GIT_SHOW_REF_HEARD % version).split()) == 0 or subprocess.call((GIT_SHO...
Python
0.000006
e8e00263acb7f04e19c0839bd881151b6ed4abd1
Create webhook.py
webhook.py
webhook.py
print 'Hello'
Python
0.000005
d2c674bf5583ea20e63a64486efb5d0e9e908e5a
Add module for mapping data onto KEGG pathways.
src/Figures/KEGG.py
src/Figures/KEGG.py
__author__ = 'agross' import re import itertools import urllib import pandas as pd from matplotlib.colors import rgb2hex from matplotlib.cm import RdBu KEGG_PATH = 'http://www.kegg.jp/kegg-bin/' from Figures.KEGG import * def pull_pathway_info_from_kegg(kegg_id): o = urllib.urlopen('http://rest.kegg.jp/get/' +...
Python
0
6bba6221343ec2b2c2626504ea46aba621a39df0
convert gatk result to gistic segment file
lib/Format/gatk2gistic_segment_file.py
lib/Format/gatk2gistic_segment_file.py
import argparse import gzip import math import logging parser = argparse.ArgumentParser(description="Convert GATK segment CNV to gistic2 segmentation file", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-i', '--input', action='store', nargs='?', help='In...
Python
0.000489
27177a3e27edfa8524c9bffee5aa4e4430d1e311
Create base mesh
api/mesh.py
api/mesh.py
import bpy from .base import BlenderObject class Mesh(BlenderObject): """Base mesh""" def add_modifier(self, type): """Add a modifier to the active object :param type: Type of the modifier, must be one of the following: - DATA_TRANSFER Data Transfer. ...
Python
0
0b8ca8c7015ddd567abdd08e508a27c6ee3ed778
fix history pickup payload
karrot/history/migrations/0009_extend_historic_data_more.py
karrot/history/migrations/0009_extend_historic_data_more.py
from django.db import migrations BATCH_SIZE = 1000 def migrate(apps, schema_editor): History = apps.get_model('history', 'History') # rewrite pickup date payload date field from string to list save_payload = [] for h in History.objects.filter(payload__date__0__isnull=True, payload__date__isnull=Fal...
Python
0
adbdacfceca33e0dc22f1d28b8e1963932c7e31a
save work for augmentation
donkeycar/parts/stores/augmentation.py
donkeycar/parts/stores/augmentation.py
import numpy as np def white_unbalance(x, y): # Adjust white balance. min_channel_high_end = 0.25 max_channel_low_end = 0.25 rmin = random.random()*min_channel_high_end gmin = random.random()*min_channel_high_end bmin = random.random()*min_channel_high_end rmax = random.random()*max_channe...
Python
0
23526005714a7cdeecc9288ddcdda562004e0c91
Add rply based parser
rattle/parser.py
rattle/parser.py
import ast import rply lg = rply.LexerGenerator() lg.add('NUMBER', '\d+') lg.add('STRING', "'.*?'|\".*?\"") lg.add('NAME', '\w+') lg.add('LSQB', '\[') lg.add('RSQB', '\]') lg.add('LPAREN', '\(') lg.add('RPAREN', '\)') #lg.add('EQUALS', '=') #lg.add('COMMA', ',') lg.add('DOT', '\.') pg = rply.ParserGenerator( [...
Python
0.000001
b5e9821642c07f30909f7cbaff193af6666777a7
Revert "disable 'svn init' for blink temporarily"
recipes/blink.py
recipes/blink.py
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json # pylint: disable=F0401 import recipe_util import sys # pylint: disable=W0232 class Blink(recipe_util.Recipe): """Basic Recipe alias for B...
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # TOOD(dpranke): reenable import json # pylint: disable=F0401 import recipe_util import sys # pylint: disable=W0232 class Blink(recipe_util.Recipe): "...
Python
0.000022
345b26fff755dbdea4021ba9bc613647a374644c
Add match group migration
matches/migrations/0007_match_group.py
matches/migrations/0007_match_group.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-05-24 13:07 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('matches', '0006_match_is_finished'), ] operations = [ migrations.AddField( ...
Python
0
907ff7fca6228248010dbb86fc81c2266cdeb264
Add release script
release.py
release.py
#!/usr/bin/env python from collections import OrderedDict from itertools import zip_longest import json import os import re from subprocess import check_output, CalledProcessError import sys from zipfile import ZipFile def sh(command, v=False): if v: print(command) return check_output(command, text=T...
Python
0.000001
1efab4cc16ded69d8da798aea61806890710bd2a
Add script drawing samples from P(z) binary file
draw_pofz_samples.py
draw_pofz_samples.py
from sys import exit import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import InterpolatedUnivariateSpline from scipy.optimize import brentq, fsolve from struct import * #fileName = '/Users/guochaosun/Desktop/Caltech_OBSCOS/pofz/UVISTA_DR2_master_v2.1.tempfilt' fileName = '/data/gjsun/catalo...
Python
0
3ac53be481ec0b6465420d4a223378263f87475c
add test client
test/client.py
test/client.py
import json import socket import ssl import struct import logging import time import sys from kutils.ksonsocket import KSONClientConnection from threading import Thread def _client_default_handler(json_connection, msg): print msg def main(argv): client_connection = KSONClientConnection(port=8080, secure=Fal...
Python
0.000001
53f54b114d23e5aa5e19aebc145944156d7ae87c
add example file starting to summarize an LRAUV log like the old review scripts
examples/review-scripts/log-summary.py
examples/review-scripts/log-summary.py
#!/usr/bin/env python import matplotlib.pyplot as plt import okeanidanalysis as oa def main(logfile, verbose=0): """summarize an LRAUV log file with plots """ if type(logfile) is not str: s = oa.logs.OkeanidLog(logfile.name) else: s = oa.logs.OkeanidLog(logfile) map_fig = plt.figure() mbm...
Python
0
237df47a31240ebf35a5de304bcc6c73e8f921b9
Create merge_sort_fastest.py
sorts/merge_sort_fastest.py
sorts/merge_sort_fastest.py
''' Python implementation of merge sort algorithm. Takes an average of 0.6 microseconds to sort a list of length 1000 items. Best Case Scenario : O(n) Worst Case Scenario : O(n) ''' def merge_sort(LIST): start = [] end = [] a = LIST[0] b = LIST[-1] while (LIST.index(a) == LIST.index(b) and len(LIST)...
Python
0.999998
ec5337dc7d8fe4f642447e9b438818b61cdc74c2
call docker logs on context.failed=true
openchain/peer/bddtests/environment.py
openchain/peer/bddtests/environment.py
import subprocess from steps.bdd_test_util import cli_call def after_scenario(context, scenario): if context.failed: file_suffix = "_" + scenario.name.replace(" ", "_") + ".log" for containerData in context.compose_containers: with open(containerData.containerName + file_suffix, "w+") ...
from steps.bdd_test_util import cli_call def after_scenario(context, scenario): if context.failed: filename = scenario.name.replace(" ", "_") for containerData in context.compose_containers: logfile = containerData.containerName + filename print("********** Test failed. Doc...
Python
0.000649
03c0b3e679e08f857a78479d73b5335ed2af46f0
Create InputDataIO.py
InputDataIO.py
InputDataIO.py
import win32api, win32con import actionFunctions #Write Function for AI #Text format: # [goodness number] [distance from ground] [distance from pipe] #returns a list of the last iteration's input values def writeToFile(goodness, distFromGround, distFromPipe) outputFile = open("BotInputData.txt", 'w') if (out...
Python
0.000006
e63b4b62cd5cd957da11e6c23bac1844d2a414a3
Create main.py
pomodor/main.py
pomodor/main.py
#!/usr/bin/env python __version__ = '0.0.1' __name__ = 'pomodoro' import click import progressbar import time @click.command() @click.option('--minutes', default=25, help='Number of minutes, default 25.') def pomodoro(minutes): bar = progressbar.ProgressBar(widgets=[ progressbar.Bar(), ]) for i in ...
Python
0.000001
5d7c18219dfe3595a07901e7e56f69068ef7d586
add vectorization example
examples/vectorization.py
examples/vectorization.py
# Copyright 2014, 2015 The ODL development group # # This file is part of ODL. # # ODL is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. ...
Python
0
6aaf8b3843b0da2083b41519b273dfe2a5f43172
Add experimental structarray code
scratch.py
scratch.py
import unittest import numpy as np def data_struct_array(sample, **vectors): # data_struct_array(sample, *, energy, **vectors): """Combine samples and per-sample data into a numpy structured array. Args: sample (array_like): Samples, in any form that can be converted into a numpy array....
Python
0.001062
e40ddb72243faaf5a754537ea11d0393b02b27f2
Create rest-mqtt.py
rest-mqtt.py
rest-mqtt.py
# Title: Script to catch rest calls for home automation and forward to MQTT (rest-mqtt) # Author: Dr. Asif Rana (aiqbalrana@gmail.com) # Date: 20160525 from flask import Flask from flask import request from flask_restful import Resource, Api import paho.mqtt.publish as publish import paho.mqtt.client as mqtt import ti...
Python
0
da5949e020709e38f88d923dce5ab656696a0bd7
Copy code from cluster mixin
Mixtape/pca.py
Mixtape/pca.py
# Author: Matthew Harrigan <matthew.p.harrigan@gmail.com> # Contributors: # Copyright (c) 2014, Stanford University and the Authors # All rights reserved. # # Mixtape is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software...
Python
0
785e37a65ee8bc311326e3c2db90a273858a345c
Prepare for rally-openstack package
rally/plugins/__init__.py
rally/plugins/__init__.py
# Copyright 2015: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
# Copyright 2015: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
Python
0
3448e13b1c00e5434f9dc972eff368400271e0be
add missing test cases of .dicts
tests/dicts.py
tests/dicts.py
# # Forked from m9dicts.tests.{api,dicts} # # Copyright (C) 2011 - 2016 Satoru SATOH <ssato @ redhat.com> # Copyright (C) 2017 Red Hat, Inc. # # pylint: disable=missing-docstring,invalid-name,protected-access from __future__ import absolute_import import unittest import anyconfig.dicts as TT from tests.common import ...
Python
0.000619
263d183c73f45efe780dc5bc97bf680e43509351
List question
Sketches/MPS/List/HelloWorldServer/HelloWorldServer.py
Sketches/MPS/List/HelloWorldServer/HelloWorldServer.py
#!/usr/bin/python import Axon from Kamaelia.Chassis.ConnectedServer import FastRestartServer class HelloWorld(Axon.Component.component): def main(self): self.send("Hello ", "outbox") self.send("World", "outbox") self.send("\r\n", "outbox") # Network end of line yield 1 ...
Python
0.999958
c5c0aabc127e584ee7c6027623d1ce6757c97f7d
Add shortest_simple_paths mod from depmap_analysis
indra/explanation/pathfinding.py
indra/explanation/pathfinding.py
import networkx as nx import networkx.algorithms.simple_paths as simple_paths # Copy from networkx.algorithms.simple_paths # Added ignore_nodes and ignore_edges arguments def shortest_simple_paths(G, source, target, weight=None, ignore_nodes=None, ignore_edges=None): """Generate all simp...
Python
0.000001
d31528540950cd8b5e8a398b50bc59ea98271d26
Create overlay.py
client/opencv/pic_on_pic/overlay.py
client/opencv/pic_on_pic/overlay.py
import cv2 import numpy as np # Load two images img1 = cv2.imread('1.jpg') img2 = cv2.imread('2.png') # I want to put logo on top-left corner, So I create a ROI rows,cols,channels = img2.shape roi = img1[0:rows, 0:cols ] # Now create a mask of logo and create its inverse mask also img2gray = cv2.cvtColor(img2,cv2.CO...
Python
0.000001
74ffdab0c54f332b8787aea04582ee7312a34b4c
Remove control_id column from assessments table
src/ggrc/migrations/versions/20161123124848_1f5c3e0025da_remove_control_id_column_from_.py
src/ggrc/migrations/versions/20161123124848_1f5c3e0025da_remove_control_id_column_from_.py
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """ Remove control_id column from assessments table Create Date: 2016-11-23 12:48:48.942528 """ # disable Invalid constant name pylint warning for mandatory Alembic variables. # pylint: disable=invalid-name...
Python
0.000001
7a6fd0ca5951bc1134fd0ac5b0cdbbb9b94fb3d4
add palindrome exercise
exercises/IsPalindrome.py
exercises/IsPalindrome.py
description = r""" (Exercise 3.1.13) A <i>palindrome</i> is a string that reads the same forwards or backwards, like <tt>"RADAR"</tt> or <tt>"STOOTS"</tt>. Define a method <tt>isPalindrome</tt> that takes as input a string and returns true if the string is a palindrome, and false otherwise. You will need to use the i...
Python
0.99996
79d6958670090f052ee0a1b1150364618838ff5e
add dev example settings file
{{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/settings/dev_example.py
{{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/settings/dev_example.py
import os from .base import * DEBUG = True ALLOWED_HOSTS = ['*'] DEV = DEBUG INSTALLED_APPS += ('debug_toolbar',) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'arwoad.db', } } SECRET_KEY = 'devel' EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBacken...
Python
0
ea0e181659f328198955b07252d09ad2e3da0e42
change name of setupTS
setupTS.py
setupTS.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Setup file for timeseries. This file was generated with PyScaffold 2.5.6, a tool that easily puts up a scaffold for your new Python project. Learn more under: http://pyscaffold.readthedocs.org/ """ import sys from setuptools import setup def setup_pa...
Python
0.000006
92d520127e01369be10f777d85e6021a023dec7d
Create scraper.py
scraper.py
scraper.py
#modocDB/scraper.py #Scrapes the offender web search library for offender data class Scraper: def __init__(self): pass dataSet = Scraper()
Python
0.000004
02831edd80949a474f3923f67addb642f8da0492
Create randomQuizGenerator.py
Generating-Random-Quiz-Files/randomQuizGenerator.py
Generating-Random-Quiz-Files/randomQuizGenerator.py
#! python 3 # randomQuizGenerator.py - Creates quizzes with questions and answers in # random order, along with the answer key. import random # The quiz data. Keys are states and values are their capitals. capitals = { 'Alabama': 'Montgomery', 'Alaska': 'Juneau', 'Arizona': 'Phoenix', 'Arkansas': 'Little Rock', ...
Python
0.000003
809acb9fd29b0834745571c21f128d02932bc118
Add bgr2hsv.
bgr2hsv.py
bgr2hsv.py
import cv2 import numpy import sys bgrColor = None # Get user supplied values if len(sys.argv) != 3: print(""" Usage: python bgr2hsv.py -rgb 0,255,0 Output: OpenCV HSV: [60, 255, 255] """) sys.exit() if sys.argv[1]=="-rgb": bgrColor = sys.argv[2].split(',') bgrCo...
Python
0
04c665b7bb71320b920812001f364a5b49544d41
add tests for FasterRCNN
tests/links_tests/model_tests/fpn_tests/test_faster_rcnn.py
tests/links_tests/model_tests/fpn_tests/test_faster_rcnn.py
import numpy as np import unittest import chainer from chainer import testing from chainer.testing import attr from chainercv.links.model.fpn import FasterRCNN from chainercv.links.model.fpn import Head from chainercv.links.model.fpn import RPN from chainercv.utils import assert_is_detection_link def _random_array(...
Python
0
21f248d3fc90a604cd85283c48e339784e6ea523
add command line interface
topik/cli.py
topik/cli.py
from __future__ import absolute_import import os from topik.readers import iter_document_json_stream, iter_documents_folder from topik.tokenizers import (SimpleTokenizer, CollocationsTokenizer, EntitiesTokenizer, MixedTokenizer) from topik.vectorizers import CorpusBOW from topik.model...
Python
0.000003
316ec13f041bc8b928ba7bb1253c0242ed2b5579
Add example test script
example.py
example.py
#!/usr/bin/env python from __future__ import division, absolute_import, print_function, unicode_literals import secretsocks import socket import Queue import threading class Client(secretsocks.Client): def __init__(self, ip, port): secretsocks.Client.__init__(self) s = socket.socket(socke...
Python
0.000001
d7f24713ad5b8372f5c5aacac252521d2dbbe192
Add ui version
openspending/ui/__init__.py
openspending/ui/__init__.py
__version__ = '0.8'
Python
0
c41212807781af2c4f6078bbb1bb047591c0923a
Create tweet_basic.py
Automation/tweet_basic.py
Automation/tweet_basic.py
from selenium import webdriver from getpass import getpass from time import sleep usr = input('Enter your username or email : ') pwd = getpass('Enter your password : ') msg = input('Enter your tweet : ') driver = webdriver.Chrome() driver.get('https://twitter.com/login') usr_box = driver.find_element_by_class_name('...
Python
0.002536
970f3bed70cb751f094b01d46cf097aa650ad52f
Create searchEngine.py
searchEngine.py
searchEngine.py
def searchEngine(curs, connection): print("Search Engine") stop = False while not stop: validity = False while not (validity == 1 or validity == 2 or validity == 3): print("\nPlease enter the correct option") ...
Python
0
83515e8e4c354a68e317f6ba9f97c9ca73e0850c
Add Henon plot
fractals/iterate-henon.py
fractals/iterate-henon.py
import matplotlib.pyplot as plt xvalues = [] yvalues = [] x = 1.12 y = 0.09 for i in range(10): xvalues.append(x) yvalues.append(y) print(x, y) x, y = y+1-1.4*x*x, 0.3*x plt.plot(xvalues, yvalues) plt.plot(xvalues, yvalues, 'bo') plt.show()
Python
0.000001
fe4e5b0eba9d1064ce17cc5b8e7c64271969f2a9
add initial migration for core app
credentials/apps/core/migrations/0001_initial.py
credentials/apps/core/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone import django.core.validators import django.contrib.auth.models class Migration(migrations.Migration): dependencies = [ ('auth', '0006_require_contenttypes_0002'), ] ...
Python
0
5444920a3447be65592e14d26aba0ef6d257f6cb
Create rename_images.py
rename_images.py
rename_images.py
#!/usr/bin/env python import os rootdir = os.getcwd() for root, dirs, files in os.walk(rootdir): for directory in dirs: workingdir = os.path.join(root, directory) contents = os.listdir(workingdir) if '*.jpg' or '*.JPG' in contents: count = 1 os.chdir(workingdir) for file in contents: if os.path.isf...
Python
0.000002
206eeb3c9ef3df1e2f7c4f7b2e3c2a002e642375
Fix tab/spaces issue
simpleLogger.py
simpleLogger.py
from colorama import init, Fore, Back # Local imports import formatter init(autoreset=True) class SimpleLogger: """ Class Used to log messages to the terminal """ @staticmethod def init(verboseLoggingEnabled): """ Initialize the logger with this function Parameters: verboseLo...
Python
0
13301a422da97d1bfc7fe745217d0bcbabf5efd3
Implement Kanayama-Fahroo Line Tracking Example
scripts/example_driver.py
scripts/example_driver.py
import driver from driver import heading_to_quaternion, quaternion_to_heading from driver import dot_product, cross_product, scale, unit class ExampleDriver(driver.Driver): smoothness = 10 k = 1.0/smoothness a = 3*k b = 3*pow(k,2) c = pow(k,3) max_v = 1.0 max_accel = .05 max_omega = 0....
Python
0
2178c706dc583c9a2325de7a9ca87a7ea9cb088b
Add start td_agent step
dbaas/workflow/steps/util/region_migration/td_agent.py
dbaas/workflow/steps/util/region_migration/td_agent.py
# -*- coding: utf-8 -*- import logging from util import full_stack from util import exec_remote_command from util import build_context_script from dbaas_cloudstack.models import HostAttr as CS_HostAttr from workflow.steps.util.base import BaseStep from workflow.steps.util import test_bash_script_error from workflow.ste...
Python
0.000002
25802ed351018958fecf0808f70265d678709ce6
Create 3longestWord.py
3longestWord.py
3longestWord.py
#Finds the longest word in a string #1. Split the string by space using .split() #2. using max function to find the biggest using the length as the criteria def LongestWord(sen): return max(sen.split(), key=len) print LongestWord(raw_input())
Python
0.999998
164f01c8a44c48486b3a2d161ac219e11c1a69e0
Add check-version command
dodo_commands/extra/standard_commands/check-version.py
dodo_commands/extra/standard_commands/check-version.py
"""Compare configuration version to version in original project config file.""" from . import DodoCommand import os import sys import yaml class Command(DodoCommand): # noqa def _get_version(self, config_filename): with open(config_filename) as f: config = yaml.load(f.read()) version ...
Python
0.000003
35d3f38a9450c06212a4eceb93bfb890806d7f3e
Create Longest_Valid_Parentheses.py
Longest_Valid_Parentheses.py
Longest_Valid_Parentheses.py
class Solution(object): def longestValidParentheses(self, s): """ :type s: str :rtype: int """ stack = [] ret = 0 last = -1 for i in range(len(s)): if s[i] == '(': stack.append(i) else: ...
Python
0.000222
da91ec5e931f798fd263563846dd440f76617409
fix issue #63. thanks!
gunicorn/workers/async.py
gunicorn/workers/async.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from __future__ import with_statement import errno import socket import traceback import gunicorn.http as http import gunicorn.http.wsgi as wsgi import gunicorn.util as util import gunicorn...
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import errno import socket import traceback import gunicorn.http as http import gunicorn.http.wsgi as wsgi import gunicorn.util as util import gunicorn.workers.base as base ALREADY_HANDLED ...
Python
0
372bd768acae6fbf425271b193d1734e5001c71a
Add initial working solution 4
4/Solution.py
4/Solution.py
class Solution(object): def findMedianSortedArrays(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: float """ nums1.extend(nums2) merged = sorted(nums1) length = len(merged) if length % 2 != 0: return ...
Python
0.000014
84769e0cf76f750e7b8c5315a937d881b097d969
Add binding.gyp file for building the module with node-gyp. Should be used for nodejs v0.7 and v0.8 or so.
binding.gyp
binding.gyp
{ 'targets' : [ { 'target_name' : 'odbc_bindings', 'sources' : [ 'src/Database.cpp' ], 'libraries' : [ '-lodbc' ], 'include_dirs' : [ '/usr/local/lib', '/opt/local/lib', '/usr/include' ], 'conditions' : [ [ 'OS == "linux"', { }], [ 'OS=="win"', { ...
Python
0
2f0d186ef1a0b63e4c66ecd9e63cd1d02c73ecf8
Create LeetCode-SummaryRanges.py
LeetCode-SummaryRanges.py
LeetCode-SummaryRanges.py
""" Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. """ class Solution(object): def summaryRanges(self, nums): """ :type nums: List[int] :rtype: List[str] """ alist=[] i...
Python
0
e96e7cbcc1f7bc28832958e31baff11e8bfbf94c
Create gapstat.py
gapstat.py
gapstat.py
#!/usr/bin/env python """ Author : Jaganadh Gopinadhan Licence : Apahce 2 e-mail jaganadhg at gmail dot com """ import scipy from sklearn.cluster import KMeans from sklearn.datasets import load_iris import pandas as pd class TWHGapStat(object): """ Implementation of Gap Statistic from Tibshirani, Walther,...
Python
0.000011
5013a7dfc3297a5f8d6f6d7107f0839f5b12d150
Update network-delay-time.py
Python/network-delay-time.py
Python/network-delay-time.py
# Time: O((|E| + |V|) * log|V|) # Space: O(|E| + |V|) # Dijkstra's algorithm class Solution(object): def networkDelayTime(self, times, N, K): """ :type times: List[List[int]] :type N: int :type K: int :rtype: int """ adj = [[] for _ in xrange(N)] for...
# Time: O((|E| + |V|) * log|V|) # Space: O(|E| + |V|) # Dijkstra's algorithm class Solution(object): def networkDelayTime(self, times, N, K): """ :type times: List[List[int]] :type N: int :type K: int :rtype: int """ min_heap = [] adj = [[] for _ in ...
Python
0.000002
e00cc32b2cea8d95e5178336c4a296e09abb6dba
Remove local testing secret from settings.py
server/server/settings.py
server/server/settings.py
""" Django settings for server project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) imp...
""" Django settings for server project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) imp...
Python
0
bbeea2f235a345d8ac8f2cb6f5fd145b12fdf8ae
Add tests for the new `ImportScan` options
dojo/unittests/test_apiv2_scan_import_options.py
dojo/unittests/test_apiv2_scan_import_options.py
from rest_framework.test import APITestCase, APIClient from django.core.urlresolvers import reverse from dojo.models import Finding, Test, Test_Type from rest_framework.authtoken.models import Token from django.core.files.uploadedfile import SimpleUploadedFile class ScanImportOptionsTest(APITestCase): """ Tes...
Python
0
9532664cabae175aed73355d79f62f2326e2a9ef
add flask as server in react
react/s.py
react/s.py
from flask import Flask import os app = Flask(__name__, static_url_path='', static_folder='') def serve_dir(path): h = "<html>\n" h = h + "<ul>\n" for entry in os.scandir(path): a = "<li><a href='{0}/{1}'>{1}</a></li>\n".format(path, entry.name) h = h + a h = h + "</ul>\n" h = h ...
Python
0
b66ad576230fb7c96a8f5c6c7b6af8a8e4c8d0b5
Add module for Source Engine game logic entities
vmf/games/source.py
vmf/games/source.py
""" Helper classes for creating maps in any Source Engine game. """ from vmf.vmf import Entity from vmf.types import Origin class LogicAuto(Entity): """Sets up certain game logic. Fires some useful map events. https://developer.valvesoftware.com/wiki/Logic_auto """ def __init__(self): ...
Python
0
688a9ab3bcc8312d88014ed93177c0b9d75f88cc
Create minimum_partition.py
dynamic_programming/minimum_partition.py
dynamic_programming/minimum_partition.py
""" Partition a set into two subsets such that the difference of subset sums is minimum """ def findMin(arr): n = len(arr) s = sum(arr) dp = [[False for x in range(s+1)]for y in range(n+1)] for i in range(1, n+1): dp[i][0] = True for i in range(1, s+1): dp[0][i] = False for i...
Python
0.999999
a198ab95fe34f368f8a579ec5e4c8fb7ef27c9c5
Solve non abundant sums
project_euler/023.non_abundant_sums.py
project_euler/023.non_abundant_sums.py
''' Problem 023 A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. A number n is called deficient if the sum of its proper divisors is ...
Python
0.999999
6beabd635451ee9aff833112138deba5dcbe76b4
work on plotting the distance integral on the small patch
py/plot_distanceintegral_smallpatch.py
py/plot_distanceintegral_smallpatch.py
############################################################################### # plot_distanceintegral_smallpatch.py: make a useful plot of the distance # integration in the effective volume # for a small patch of the sky with better # ...
Python
0
b18cf437f499ee8ebe536779883d05518a69c00f
Fix conflicting migrations
accelerator/migrations/0100_update_program_model.py
accelerator/migrations/0100_update_program_model.py
# Generated by Django 2.2.28 on 2022-04-20 13:05 import sorl.thumbnail.fields from django.db import ( migrations, models, ) class Migration(migrations.Migration): dependencies = [ <<<<<<< HEAD:accelerator/migrations/0101_update_program_model.py ('accelerator', '0100_add_innovation_stage_model'),...
Python
0.000003
64d4e6d302702e912d3db1125a00d22ad8eee2ab
Create get_collocations3.py
get_collocations3.py
get_collocations3.py
import string from nltk.tokenize import word_tokenize from nltk.collocations import BigramCollocationFinder from nltk.collocations import BigramAssocMeasures from nltk.corpus import stopwords # find collocations for each word def get_collocations(corpus, windowsize=10, numresults=10): '''This function uses the Na...
Python
0.000001
d3fceb049ac2c3278bdf65d0d465bf47776e9ae8
Placeholder entity
gludb/annotations.py
gludb/annotations.py
from functools import wraps # TODO: this is just a single object for package testing # it will change when we actually decide on a namespace def DataObject(f): # TODO: actual work return f
Python
0.999992
7d60876f2b1152fbe92ba90ec0fa9e2acfb05af2
fix InMoov launching button
src/main/resources/resource/Intro/InMoov01_start.py
src/main/resources/resource/Intro/InMoov01_start.py
######################################### # InMoov01_start.py # categories: inmoov # more info @: http://myrobotlab.org/service/InMoov ######################################### # uncomment for virtual hardware # Platform.setVirtual(True) i01 = Runtime.start('i01', 'InMoov2')
Python
0
8f2ec9462b038704d00f85b706cfb34a19eac974
add weekly backup job
etc/weekly_backup.py
etc/weekly_backup.py
#!/usr/bin/env python from datetime import datetime import os.path import sys def day_abbrev(): return datetime.now().strftime('%Y%m%d').lower() def warn(txt): print >> sys.stderr, "WARNING: %s!" % txt os.system("""echo "At %s: %s" | mail -s "WARNING: %s" euccastro@gmail.com""" % (datetime.now(), txt, t...
Python
0.000001
2084569577c24fa0ba028bb6d0e8c8b62a604c61
Create arduinoMicroShiftRegisterTests_PythonCompanion_debugSerialCmds_staticListOfPatterns.py
pyxhook/arduinoMicroShiftRegisterTests_PythonCompanion_debugSerialCmds_staticListOfPatterns.py
pyxhook/arduinoMicroShiftRegisterTests_PythonCompanion_debugSerialCmds_staticListOfPatterns.py
# -*- coding: utf-8 -*- #!/usr/bin/env python ## -*- coding: iso-8859-1 -*- # the above is to prevent that damn " SyntaxError: Non-ASCII character '\xc2' " error # "Arduino companion" # test implm of a LEDs animations using an Arduino Micro & 74HC595 shift registers import serial # needed for serial communicatio...
Python
0.000008
4761b92bc058c49b696757580212a599e4a22bed
update 26 ott 2016
realmain.py
realmain.py
# Micropython Http Server # Erni Tron ernitron@gmail.com # Copyright (c) 2016 import time import network import gc import machine from config import read_config, get_config, set_config, save_config development = True def do_connect(ssid, pwd): sta_if = network.WLAN(network.STA_IF) if not sta_if.isconnected(...
Python
0
fa1294ea535d7e08ad80d15d5f900757f6a17520
Add first pass at spammer
spammer.py
spammer.py
#!/usr/bin/python # force.py # Josh Villbrandt <josh@javconcepts.com> # 2015/01/26 import argparse import django import logging import copy import time import sys import os from colorama import Fore # import django models sys.path.append('/home/GoProController') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "GoPr...
Python
0
69df0819456c45bcac8ace28cfd3f294795ae726
Create ATM.py
src/ATM.py
src/ATM.py
# Copyright 2014 Rico Antonio Felix # # 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.000973
6616d17a534ff2cf0dbdeb9f138d4ef09bf8d03d
update app.config
run_all.py
run_all.py
def func(self): import sys, os import py_compile if os.environ['EXECUTOR'] != "docker": sys.path.append("/home/philipsahli/workspace/httptest/app") py_compile.compile("/home/philipsahli/workspace/httptest/app/run_all.py", doraise=True) import run_all import utils reload(run_all) reload(utils) else: f...
Python
0.000002
de4359d228b47a4da87c0f79603373b916ff9464
Add migration from other branch
temba/flows/migrations/0083_populate_recent_msgs.py
temba/flows/migrations/0083_populate_recent_msgs.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-01-11 09:46 from __future__ import unicode_literals from django.db import migrations def old_recent_messages_lookup(FlowStep, step_uuid, rule_uuid, next_uuid): """ The old way of looking up recent messages from flow step table """ recent_me...
Python
0
a32b4216b98fb2bb23d8a0a700d05bd417df1906
Implement main function
useless_passport_validator/umain.py
useless_passport_validator/umain.py
#!/usr/bin/python3.4 import ulibrary import sys from uwindow import UWindow from gi.repository import Gtk class Usage(Exception): def __init__(self, msg): self.msg = msg def main(): ulibrary.init() uwindow = UWindow() uwindow.connect("delete-event", Gtk.main.quit) uwindow.show_all() ...
Python
0.999999
845a74ca5475aa8121733ab92d4e1141e62d39a1
rename error to result error.
testcube/core/migrations/0006_auto_20170610_0526.py
testcube/core/migrations/0006_auto_20170610_0526.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-06-10 05:26 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0005_auto_20170610_0506'), ] operations = [ migrations.RenameModel( ...
Python
0
a9388f7d4c4747e6710d20d618b57f19360cb69c
Add remove vlan compliance test
tests/adapters/compliance_tests/remove_vlan_test.py
tests/adapters/compliance_tests/remove_vlan_test.py
# Copyright 2019 Internap. # # 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, so...
Python
0
b9ba0f23b4e9efdc2c6158ce2047f5e4cc73f9b5
Add conftest.py to ignore top-level stuff
conftest.py
conftest.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- collect_ignore = ["setup.py", ".pythonrc.py"]
Python
0
63326149ba56677f2fbcfc6e875819d0b2ddf5de
Create sqlsync.py
sqlsync.py
sqlsync.py
import MySQLdb as db HOST = "" PORT = USER = "" PASSWORD = "" DB = "" def post_file (path, filename): try: conn = db.Connection(host=HOST, port=PORT, user=USER, passwd=PASSWORD, db=DB) dbhandler = conn.cursor(db.cursors.DictCursor) sql = ("INSERT INTO db2s3 (PATH, FILENAME, DROPBOX_DOWNLOADED) VALUES(...
Python
0.001791
03e1a4d988650196f698623da8d84070f9ace47d
Create ModisLADSFTP.py
ModisLADSFTP.py
ModisLADSFTP.py
# -*- coding: utf-8 -*- """ Created on Tue Apr 4 13:02:35 2017 @author: Tomás Acuña y Italo Moletto mail: tomasacuna@ug.uchile.cl Modified from : http://www.science-emergence.com/Codes/Download-a-file-of-MODIS-MYD08-M3-from-ladsftp-using-python/ """ from ftplib import FTP import numpy as np import os import calendar ...
Python
0
d0c3e0901cbb1c89477ec081a5dce0d3a12f8df8
add test runner script for local development
runtests.py
runtests.py
#!/usr/bin/env nix-shell #! nix-shell -i python3 -p python3Packages.pyyaml """Run the tests in the circleci config, for local dev.""" from os.path import dirname, join from subprocess import call import yaml with open(join(dirname(__file__), ".circleci", "config.yml")) as f: circle_cfg = yaml.load(f) results = {}...
Python
0
3361cf94d06bdc3a207caa490c7ce2e43cc5795f
Add 136-single-number.py
136-single-number.py
136-single-number.py
""" Question: Single Number Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Performance: 1. Total Accepted: 92009 Total Submissions: 19999...
Python
0.999995
c8c026cb1f0d19a928671dd80e7a9664d13507c6
add leetcode Binary Tree Preorder Traversal
leetcode/BinaryTreePreorderTraversal/solution.py
leetcode/BinaryTreePreorderTraversal/solution.py
# -*- coding:utf-8 -*- # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return a list of integers def preorderTraversal(self, root): ret = ...
Python
0.000001
dea7ab53723bade73affbb3c10db3ad8279c8dca
Add interaction_plot
statsmodels/graphics/factor_plots.py
statsmodels/graphics/factor_plots.py
import numpy as np from statsmodels.graphics.plottools import rainbow def interaction_plot(x, trace, response, func=np.mean, ax=None, plottype='b', xlabel=None, ylabel=None, colors = [], markers = [], linestyles = [], legendloc='best', legendtitle=None, *...
Python
0.000002
3c4cc20a2b9708f01569abd7985573e26f0a19ad
add tic_tac_toe.py part 1
intro/tic_tac_toe.py
intro/tic_tac_toe.py
import random import copy #We will represent the board as a string with # TEN THINGS in it. The first thing will be blank (always), # and the next nine will be 'X', 'O', or ' '. board = ' XO XO XOO' def draw_board(board): print ' | | ' print ' {} | {} | {} '.format(board[7], board[8], boar...
Python
0.000837
19f58aca5dbfbdd6e47cca5927df51dc8904371c
Add mocked up settings
settings.py
settings.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 SECRET_KEY = 'this is not a secret key' INSTALLED_APPS = ( 'couchdbkit.ext.django', 'couchforms', 'coverage' ) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'couchforms', } } ####### ...
Python
0.000001
158e4df1738ab1b1e104ee50a93cb829ed868374
Create tutorial2.py
tutorial2.py
tutorial2.py
from ggame import App, Color, LineStyle, Sprite from ggame import CircleAsset red = Color(0xff0000, 1.0) green = Color(0x00ff00, 1.0) blue = Color(0x0000ff, 1.0) black = Color(0x000000, 1.0) thinline = LineStyle(1, black) mycircle = CircleAsset(5, thinline, blue) xcoordinates = range(100, 600, 10) # Generate a list ...
Python
0
d0789d6b47a7186077927d8b8b0f812c597e26bc
Add check_keys.py
check_keys.py
check_keys.py
from hr.app import * with open('results.txt', 'w') as f: for key in APIKey.query.all(): try: auth = xmlapi.auth(keyID=key.key, vCode=key.code) result = auth.account.APIKeyInfo() if not result.key.accessMask == app.config['API_KEY_MASK']: f.write('Invalid...
Python
0.000007