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
566e3e9140ef96d58aaa4bfc0f89d9429a978485
add a script to get connections between the minima
get_connections.py
get_connections.py
from lj_run import LJClusterNew import sys from pygmin.landscape import Graph natoms = int(sys.argv[1]) dbname = sys.argv[2] system = LJClusterNew(natoms) db = system.create_database(dbname) while True: min1 = db.minima()[0] graph = Graph(db) all_connected = True for m2 in db.minima()[1:]: ...
Python
0
d362847f0eb895dd3661a636f94b2216b6497ec6
Add tests for Model.
magetool/tests/commands/model_test.py
magetool/tests/commands/model_test.py
import os import unittest from magetool.commands.model import Model from magetool.commands.module import Module from magetool.tests.util import remove_module, TEST_DIR reference_reg_config = """<?xml version="1.0"?> <config> <modules> <Foo_Quux> <version>0.1.0</version> </Foo_Quux> </modules> <glo...
Python
0
72b701652271178e08d9cccd088d24177d4a2fc6
Add functions for storing/getting blogs and posts
pyblogit/database_handler.py
pyblogit/database_handler.py
""" pyblogit.database_handler ~~~~~~~~~~~~~~~~~~~~~~~~~ This module handles the connection and manipulation of the local database. """ import sqlite3 def get_cursor(blog_id): """Connects to a local sqlite database""" conn = sqlite3.connect(blog_id) c = conn.cursor() return c def add_blog(blog_id, ...
Python
0
726316b50209dfc5f6a8f6373cd7e3f53e267bb3
Implement a genre string parser
geodj/genre_parser.py
geodj/genre_parser.py
import re from django.utils.encoding import smart_str class GenreParser: @staticmethod def parse(genre): genre = smart_str(genre).lower() if re.search(r"\b(jazz|blues)\b", genre): return "jazz" if re.search(r"\b(ska|reggae|ragga|dub)\b", genre): return "ska" ...
Python
0.999999
23402487a2b12aca391bb5958b4ba3e9424a6801
Add a new management command 'olccperiodic' to update the 'on_sale' property for all products.
django_olcc/olcc/management/commands/olccperiodic.py
django_olcc/olcc/management/commands/olccperiodic.py
import datetime from django.core.management.base import BaseCommand from django.db import IntegrityError, transaction from olcc.models import Product, ProductPrice from optparse import make_option class Command(BaseCommand): help = """\ A command to be run periodically to calculate Product status from upd...
Python
0
860d81ec5f0b9ae4c28a1996773c06240c31b67a
Update names
canvas.py
canvas.py
#!/usr/bin/env python3 from tkinter import * from tkinter import ttk import math class App: def __init__(self): self.lastx = 0 self.lasty = 0 self.fill = 'red' self.width = 2 root = Tk() root.columnconfigure(0, weight=1) root.rowconfigure(0, weight=1) ...
Python
0.000001
d5c7d429be93a2b2de4a1c09bd73f72c02664499
Move win32 audio experiment to trunk.
experimental/directshow.py
experimental/directshow.py
#!/usr/bin/python # $Id:$ # Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU. # Caveats: # - Requires a filename (not from memory or stream yet). Looks like we need # to manually implement a filter which provides an output IPin. Lot of # work. # - Theoretically can traverse the ...
Python
0
285c852bb246042a4f882ab9ca2948e4f0241dac
add GTC.meshgrid Core
src/processors/GTC/meshgrid.py
src/processors/GTC/meshgrid.py
# -*- coding: utf-8 -*- # Copyright (c) 2018 shmilee ''' Source fortran code: v110922 ------- diagnosis.F90, subroutine diagnosis:37-50 !!diagnosis xy if(mype==1)then open(341,file='meshgrid.out',status='replace') do i=0,mpsi write(341,*)psimesh(i) write(341,*)sprpsi(psimesh(i)) ...
Python
0.000001
e731bfdabbf42b636b02e93ccd3b67c55a28d213
add unit test
axelrod/tests/test_appeaser.py
axelrod/tests/test_appeaser.py
""" Test for the appeaser strategy """ import unittest import axelrod class TestAppeaser(unittest.TestCase): def test_strategy(self): P1 = axelrod.Appeaser() P2 = axelrod.Player() P1.str = 'C'; self.assertEqual(P1.strategy(P2), 'C') P1.history = ['C'] P1.history = ['C'] self.assertEqua...
Python
0.000001
ebcc46d312b807406b824edca7a35ea648beceaf
finished problem A. 1
sequence_limits.py
sequence_limits.py
#! /usr/bin/env python """ File: sequence_limits.py Copyright (c) 2016 Austin Ayers License: MIT Course: PHYS227 Assignment: A. 1 Date: Feb 11, 2016 Email: ayers111@mail.chapman.edu Name: Austin Ayers Description: Determines the limit of a sequence """ import numpy as np import matplotlib.pyplot as plt def seq_a(n):...
Python
0.999999
0a0d31077746e69bf5acc7d90fa388e121544339
Add skeleton for new python scripts.
script_skeleton.py
script_skeleton.py
#!/usr/bin/python """Usage: <SCRIPT_NAME> [--log-level=<log-level>] -h --help Show this message. -v --version Show version. --log-level=<log-level> Set logging level (one of {log_level_vals}) [default: info]. """ import docopt import ordutils.log as log import ordutils.options as opt import schema im...
Python
0
63b954c952dda9d123e6fa1e348babae97523e21
Create securitygroup.py
azurecloudify/securitygroup.py
azurecloudify/securitygroup.py
Python
0.000001
01f7ef27825baf76b3dd9afaa2f4c12e05272d9d
Add Commodity Futures Trading Commission.
inspectors/cftc.py
inspectors/cftc.py
#!/usr/bin/env python import datetime import logging import os import re from urllib.parse import urljoin from bs4 import BeautifulSoup from utils import utils, inspector # http://www.cftc.gov/About/OfficeoftheInspectorGeneral/index.htm # Oldest report: 2000 # options: # standard since/year options for a year ran...
Python
0
24c6ede2c7950e36516f0611811ff922d7a5b86f
Create grayl_g-throughput.py
grayl_g-throughput.py
grayl_g-throughput.py
#!/usr/bin/python # # == Synopsis # # Script to get Graylog throughput data pushed # to Graphite # # # === Workflow # This script grabs JSON from your Graylog # cluster, transforms data into # valid Carbon metrics and delivers it into carbon # # Carbon only needs three things: # <metric> <value> <timestamp> # # So what...
Python
0.000005
ac78f3f774dbfda4e2c96786ddebf74066a56f54
add mtbf_job_runner
mtbf_job_runner.py
mtbf_job_runner.py
#!/usr/bin/env python import combo_runner.action_decorator from combo_runner.base_action_runner import BaseActionRunner from utils.zip_utils import modify_zipfile import os class MtbfJobRunner(BaseActionRunner): action = combo_runner.action_decorator.action def pre_flash(self): pass def flash(s...
Python
0.000004
f5bb497960f9f9256cc9794baf0c53c4ba5d734f
Add Spider class for web crawling.
Spider.py
Spider.py
''' Created on 7/07/2016 @author: garet ''' class Spider(): def __init__(self): pass
Python
0
8c8d28e95cf99f8aff4ba45819b08995ef63ea44
add hubble
hubble.py
hubble.py
import urllib import os def fetchImages(start, stop): counter = 0 imgIndex = start for i in range(start, start+stop+1): urllib.urlretrieve(""+str(imgIndex)+".jpg", str(imgIndex)+".jpg") print("Image# "+str(counter)+" of "+str(stop)+" captured.") counter += 1 imgIndex += 1 ...
Python
0.998455
62296474a389f684dbc1b66fb5256d494111b7c9
Add a script to reproduce ezio issue #4
SocketABC/ezio_issue4_reproduce.py
SocketABC/ezio_issue4_reproduce.py
# -*- coding: utf-8 -*- import hashlib import socket import struct SERVER_NAME = 'localhost' SERVER_PORT = 9876 def main(): client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect((SERVER_NAME, SERVER_PORT)) msg_len = 1600 payload = 'a' * msg_len msg = struct.pack...
Python
0
6d93e603cd45544e296b8cd90853377688af6376
Add median/LoG filter fcn
imgphon/ultrasound.py
imgphon/ultrasound.py
import numpy as np from scipy.ndimage import median_filter from scipy.ndimage.filters import gaussian_laplace def clean_frame(frame, median_radius=5, log_sigma=4): """ Input: ndarray image, filter kernel settings Output: cleaned ndarray image A median filter is used to remove speckle noise, ...
Python
0.000001
ca3add180e8dc124e9ebec35682215a6de0ae9b1
Add test_poly_divide script.
research/test_poly_divide.py
research/test_poly_divide.py
# use time() instead on unix import sys if sys.platform=='win32': from time import clock else: from time import time as clock from sympycore import profile_expr def time1(n=500): import sympycore as sympy w = sympy.Fraction(3,4) x = sympy.polynomials.poly([0, 1, 1]) a = (x-1)*(x-2)*(x-3)*(x-4...
Python
0
8adbbc365042d49c1304610b3425e0974b1c6451
Switch a little of the html generation to jinja2
blaze/server/datashape_html.py
blaze/server/datashape_html.py
from ..datashape import DataShape, Record, Fixed, Var, CType, String, JSON #from blaze_server_config import jinja_env from jinja2 import Template json_comment_templ = Template("""<font style="font-size:x-small"> # <a href="{{base_url}}?r=data.json">JSON</a></font> """) datashape_outer_templ = Template(""" <pre> type...
from ..datashape import DataShape, Record, Fixed, Var, CType, String, JSON #from blaze_server_config import jinja_env #from jinja2 import Template def json_comment(array_url): return '<font style="font-size:x-small"> # <a href="' + \ array_url + '?r=data.json">JSON</a></font>\n' def render_datashape_recur...
Python
0.000001
ce1921e079b68c250b6bc979e67c478b94747688
Change the order of metric name components
src/collectors/postgres/postgres.py
src/collectors/postgres/postgres.py
# coding=utf-8 """ Collect metrics from postgresql #### Dependencies * psycopg2 """ import diamond.collector try: import psycopg2 psycopg2 # workaround for pyflakes issue #13 except ImportError: psycopg2 = None class PostgresqlCollector(diamond.collector.Collector): def get_default_config_hel...
# coding=utf-8 """ Collect metrics from postgresql #### Dependencies * psycopg2 """ import diamond.collector try: import psycopg2 psycopg2 # workaround for pyflakes issue #13 except ImportError: psycopg2 = None class PostgresqlCollector(diamond.collector.Collector): def get_default_config_hel...
Python
0.99894
711de8a04598fb531b5f70f334633b713dfa76c7
Create TypeIt.py
TypeIt.py
TypeIt.py
print("Hello Daniel")
Python
0.000001
94151b40c3b862c5ddf57c11228f6c99a8c38a7e
Define manage.py to launch app and app-related tasks
edx_data_research/web_app/manage.py
edx_data_research/web_app/manage.py
#!/usr/bin/python from flask.ext.script import Manager, Server, Shell from edx_data_research.web_app import app from edx_data_research.web_app.models import User, Role manager = Manager(app) manager.add_command('run-server', Server(use_debugger=True, use_reloader=True, host='...
Python
0.000001
ec919af7fba21e98e73e6c435dda4f10e90b82ba
Create Vector.py
Vector.py
Vector.py
# The Vector class class Vector: # Initialiser def __init__(self, p=(0,0)): self.x = p[0] self.y = p[1] # Returns a string representation of the vector def __str__(self): return "("+ str(self.x) + "," + str(self.y) + ")" # Tests the equality of this vector and another ...
Python
0
cab2ad2d82951ad988c1c2da146b4d62b6d90ec6
Add track evalution code.
src/tpn/evaluate.py
src/tpn/evaluate.py
#!/usr/bin/env python import argparse import os import os.path as osp import glob from data_io import tpn_test_iterator from vdetlib.utils.protocol import proto_load import numpy as np import sys sys.path.insert(0, '/Volumes/Research/ImageNet2016/Code/external/kwang/py-faster-rcnn-craft/lib') from fast_rcnn.nms_wrappe...
Python
0
a70abcdd95612fe3df4fc3dd9c4ae8151add5a28
add an example file
example.py
example.py
import numpy as np from pyscatter3d import pyscatter3d X0,Y0 = np.meshgrid(np.linspace(-3,3,50), np.linspace(-3,3,50)) D = np.sqrt(X0**2+Y0**2) # radial distance Z0 = np.sinc(D) _ = np.random.randn(3, 1e3) X1,Y1,Z1 = _/np.linalg.norm(_, axis=0) np.savetxt('sinc.csv', np.array([arr.flatten() for arr in [X0,Y0,Z0,1/D]...
Python
0.000001
28e6c21e2a8bc78a6f4292eef2daec4b70d0b887
Add support for Pocket
services/pocket.py
services/pocket.py
from werkzeug.urls import url_decode import requests import foauth.providers class Pocket(foauth.providers.OAuth2): # General info about the provider provider_url = 'http://getpocket.com/' docs_url = 'http://getpocket.com/developer/docs/overview' category = 'News' # URLs to interact with the API ...
Python
0
e42b22dc0a71fb5c7572ca69c63ab6a7b0ba8479
add error handling for celery tasks
src/helfertool/tasks.py
src/helfertool/tasks.py
from __future__ import absolute_import from celery.signals import task_failure from django.conf import settings from django.core.mail import mail_admins from django.views.debug import ExceptionReporter @task_failure.connect def celery_error_handler(task_id, exception, traceback, einfo, *args, **kwargs): if sett...
Python
0.000001
73f75483156056b61f3b6bec4fe2f09522c2c34a
Add tests for mixin order
test/integration/ggrc/models/test_eager_query.py
test/integration/ggrc/models/test_eager_query.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """Tests for making sure eager queries are working on all mixins.""" from ggrc....
Python
0
6ed99163b10209566a0575a9a67d1ab2ad552fd9
Add test for committee subscriptions page
tests/views/test_committee_subscriptions_page.py
tests/views/test_committee_subscriptions_page.py
import datetime from tests import PMGLiveServerTestCase from tests.fixtures import dbfixture, HouseData, CommitteeData THIS_YEAR = datetime.datetime.today().year class TestCommitteeSubscriptionsPage(PMGLiveServerTestCase): def test_committee_subscriptions_page(self): """ Test committee subscripti...
Python
0
5e9b6bc60f0f81db3ed451eb89c23b77888e1167
Update a comment
djangae/db/backends/appengine/expressions.py
djangae/db/backends/appengine/expressions.py
from django.db.models.expressions import F from djangae.db.utils import get_prepared_db_value CONNECTORS = { F.ADD: lambda l, r: l + r, F.SUB: lambda l, r: l - r, F.MUL: lambda l, r: l * r, F.DIV: lambda l, r: l / r, } def evaluate_expression(expression, instance, connection): """ A limited eval...
from django.db.models.expressions import F from djangae.db.utils import get_prepared_db_value CONNECTORS = { F.ADD: lambda l, r: l + r, F.SUB: lambda l, r: l - r, F.MUL: lambda l, r: l * r, F.DIV: lambda l, r: l / r, } def evaluate_expression(expression, instance, connection): """ A limited eval...
Python
0
37e59cbd7e8b4901644adcb73a7f491247fdea69
Add py-pyperclip package (#12375)
var/spack/repos/builtin/packages/py-pyperclip/package.py
var/spack/repos/builtin/packages/py-pyperclip/package.py
# Copyright 2013-2019 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 PyPyperclip(PythonPackage): """A cross-platform clipboard module for Python.""" homep...
Python
0
a773f428512ecc9bc4f81b633aaf3dfa8faa10ed
Create client.py
client.py
client.py
#!/usr/bin/env python #LGS SimSuite Client #Copyright (c) 2015 Filip Marinic from time import gmtime, strftime, time, sleep import socket import math import sys import paramiko #server parameters server_username = "Pi" server_password = "********" server_path = "python /home/pi/server.py" #if server script is compile...
Python
0.000001
6427c55bbd51abaef6847e4f2af239d5977d0048
Create client.py
client.py
client.py
import socket target_host = "0.0.0.0" target_port = 9999 if(len(sys.argv) > 1): try: target_ip = sys.argv[1] target_port = int(sys.argv[2]) except Exception: pass #lazy client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect((target_host, target_port)) ''' ...
Python
0
04d6765c14de3d6d5eb36d9ad268012f9e7625bc
add test for search items #30
vagrant/tradyfit/tests/functional/test_search.py
vagrant/tradyfit/tests/functional/test_search.py
# -*- coding: utf-8 -*- import re from bs4 import BeautifulSoup from helper import SeleniumTestCase import page class SearchTestCase(SeleniumTestCase): @classmethod def setUpClass(cls): # connect to webdriver, create app, launch server in thread super(SearchTestCase, cls).setUpClass() @classmethod d...
Python
0
ad3744acef6d855fcc074c7412c3e224d5a8f205
add missing file
saga/utils/pty_exceptions.py
saga/utils/pty_exceptions.py
import saga.exceptions as se # ---------------------------------------------------------------- # def translate_exception (e, msg=None) : """ In many cases, we should be able to roughly infer the exception cause from the error message -- this is centrally done in this method. If possible, it will re...
Python
0.000003
df7a5c4aa4f5898de3c70cef17c3c5031f7e05a6
Add support for executing scrapy using -m option of python
scrapy/__main__.py
scrapy/__main__.py
from scrapy.cmdline import execute if __name__ == '__main__': execute()
Python
0.000007
d94123ba898032e7837aa8a2fd0fe585ed81e2d5
Add back a filesystem backend for testing and development
scrapi/processing/storage.py
scrapi/processing/storage.py
import os import json from scrapi.processing.base import BaseProcessor class StorageProcessor(BaseProcessor): NAME = 'storage' def process_raw(self, raw): filename = 'archive/{}/{}/raw.{}'.format(raw['source'], raw['docID'], raw['filetype']) if not os.path.exists(os.path.dirname(filename)): ...
Python
0
e6699947ebde4d51b1bd8b6016879d4917d7a648
implement initial base exception class and httperror exception class
scup/exceptions.py
scup/exceptions.py
class ScupPythonError(Exception): """ Base class for exceptions raised by scup-python. """ class ScupError(ScupPythonError): """ Exception for Scup errors. """ def __init__(self, message=None, code=None, error_data=None): self.message = message self.code = code self.error_data = error_data if self.code: ...
Python
0
ded34849d9eb2feb51b9ad7f31e210db3a28c7e1
change case
aleph/assets.py
aleph/assets.py
import os from flask.ext.assets import Bundle from aleph.core import assets, app deps_assets = Bundle( 'vendor/jquery/dist/jquery.js', 'vendor/angular/angular.js', 'vendor/ng-debounce/angular-debounce.js', 'vendor/angular-route/angular-route.js', 'vendor/angular-animate/angular-animate.js', 'v...
import os from flask.ext.assets import Bundle from aleph.core import assets, app deps_assets = Bundle( 'vendor/jquery/dist/jquery.js', 'vendor/angular/angular.js', 'vendor/ng-debounce/angular-debounce.js', 'vendor/angular-route/angular-route.js', 'vendor/angular-animate/angular-animate.js', 'v...
Python
0.00005
b2d60408688cc1bf27842d8744d1048a64b00e94
Add script to get public registrations for staff members
scripts/staff_public_regs.py
scripts/staff_public_regs.py
# -*- coding: utf-8 -*- """Get public registrations for staff members. python -m scripts.staff_public_regs """ from collections import defaultdict import logging from modularodm import Q from website.models import Node, User from website.app import init_app logger = logging.getLogger('staff_public_regs') STAFF...
Python
0
b77f90c4372161243fcabb3eddbe4d35b4792bfc
Create jupyter_notebook_config.py
jupyter_notebook_config.py
jupyter_notebook_config.py
# Copyright 2015 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.000002
acc8ccfb26614993a62b99319ef7db72373c457f
add daemon code
sms_khomp_api/daemon.py
sms_khomp_api/daemon.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' *** Modified generic daemon class *** Author: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ www.boxedice.com License: http://creativecommons.org/licenses/by-sa/3.0/ Changes: 23rd Jan 2009...
Python
0.000001
d4a8c33d50a7c130d6203ef6332a241392516ba2
Create database.py
database.py
database.py
#!/usr/bin/python import MySQLdb def getemail(): alist=[] # Open database connection Replace username, password with your username password and dbname with the name of database db = MySQLdb.connect("localhost","username","password","dbname" ) # prepare a cursor object using cursor() method cursor =...
Python
0.000001
5eb474a5ff3110ef2b6955bd98bbe6bf16f7b0ab
add RNN policy with batch version (not working yet)
labs/notebooks/reinforcement_learning/RL.py
labs/notebooks/reinforcement_learning/RL.py
from IPython import embed # Load Part-of-Speech data from lxmls.readers.pos_corpus import PostagCorpusData data = PostagCorpusData() print(data.input_size) print(data.output_size) print(data.maxL) # Alterbative native CuDNN native implementation of RNNs from lxmls.deep_learning.pytorch_models.rnn import PolicyRNN m...
Python
0
cb73106d4a47a21f82021794234672600cceb2c6
Add fix_genre_counts
populate_database/fix_genre_counts.py
populate_database/fix_genre_counts.py
#!/usr/bin/python # we've been outputting stuff to text so now I get to wedge it into a database # funtimes # set up the database with `sqlite3 netflix_genres.sqlite < create_tables.sql` import codecs import sqlite3 import sys conn = sqlite3.connect('netflix.sqlite') c = conn.cursor() c.execute('SELECT genre_id, n...
Python
0.000018
549f6e590cf158fe62158c5ce3cbdbe46e22c5e0
添加抓取 Peuland 的爬虫
Spiders/PeulandSpider.py
Spiders/PeulandSpider.py
#-*- coding: utf-8 -*- import json import logging import requests import base64 from Proxy import Proxy from utils import log from Spider import Spider class PeulandSpider(Spider): def __init__(self, queue): super(PeulandSpider, self).__init__(queue) self.name = 'PeulandSpider' self.urls...
Python
0
d74f0d174f509b0a65e5643356af8eff1f5a4ca8
Add a snippet.
python/scipy/write_stereo_wav_file.py
python/scipy/write_stereo_wav_file.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Read the content of an audio wave file (.wav) # See: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.io.wavfile.write.html import numpy as np from scipy.io import wavfile def sin_wave(freq1, freq2, num_frames, rate): data_list_1 = [int(127 * (np.s...
Python
0.000002
181832a67d3fa3a4993d495dc9db12fdae7329f7
add context processor tests
clastic/tests/test_context_proc.py
clastic/tests/test_context_proc.py
from __future__ import unicode_literals from nose.tools import eq_, raises import json from werkzeug.test import Client from werkzeug.wrappers import BaseResponse from clastic import Application, json_response from clastic.middleware import SimpleContextProcessor, ContextProcessor from common import hello_world, hel...
Python
0.000001
f9bdf777a13404ba25e0e8cdf99a3554320529c9
Add warnings to inspector DOM count unittest baselines.
tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py
tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py
# Copyright 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. from telemetry import benchmark from telemetry.unittest import tab_test_case class InspectorMemoryTest(tab_test_case.TabTestCase): @benchmark.Enabled('h...
# Copyright 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. from telemetry import benchmark from telemetry.unittest import tab_test_case class InspectorMemoryTest(tab_test_case.TabTestCase): @benchmark.Enabled('h...
Python
0.000003
3119222d27bd63b9f4e9a57ff8e9d88e53d9735a
Modify island.py
island.py
island.py
from noise import generate_noise from PIL import Image import numpy as np WIDTH = 128 HEIGHT = 128 if __name__ == '__main__': data = np.array(generate_noise(WIDTH, HEIGHT, triple=True), dtype=np.uint8) img = Image.fromarray(data, 'RGB') img.save('out.png')
Python
0.000007
2d55503216d7020a71017fbcb2c1b48661c345cb
Add manage
manage.py
manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Python
0.000001
77738a8b7e895b5f71418d5417db04f34b08f918
add manage.py
manage.py
manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Python
0.000001
10ef7955b21e3f9d3f3ac9eb43995e7cf0e91201
Add meta/import_all.py for testing
meta/import_all.py
meta/import_all.py
#! /usr/bin/env python # encoding: utf-8 """Imports all the modules under the specified path. This can be useful as a basic static analysis test, assuming that the imports do not have side-effects. """ from __future__ import print_function import argparse import importlib import os import sys def main(): pars...
Python
0
efd125ef973a680b6413e820e1308070a79554b4
Encrypt with vigenere cipher
practic_stage/hmw8/main.py
practic_stage/hmw8/main.py
import string letters = string.ascii_uppercase vigenere_table = {letter: {letters[j]: letters[(i + j) % 26] for j, l in enumerate(letters)} for i, letter in enumerate(letters)} def encrypt(text, key): encrypted = [] for index, letter in enumerate(text): encrypted...
Python
0.007626
5f63a5ebfe3210fe68df036eef27a51bf431f6a3
Initialize transpositionFileCipher
books/CrackingCodesWithPython/Chapter10/transpositionFileCipher.py
books/CrackingCodesWithPython/Chapter10/transpositionFileCipher.py
# Transposition Cipher Encrypt/Decrypt File # https://www.nostarch.com/crackingcodes/ (BSD Licensed) import time, os, sys, transpositionEncrypt, transpositionDecrypt def main(): inputFilename = 'frankenstein.txt' # BE CAREFUL! If a file with the outputFilename name already exists, # this program will over...
Python
0.00001
fc8a37b63ddc2455afbeeae0a6c2ac911c113337
add new
maya/python/animation/grapheditor/fit_key_tangent.py
maya/python/animation/grapheditor/fit_key_tangent.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Author : Masahiro Ohmomo # DCC : Maya # Version : 2013 - Latest # Recommend: 2013 # # Description. # In this script, do the fitting. # The target is keyframe's tangent. # You should be selected keyframe's of least two index. # # Run command. # import fit_key_t...
Python
0.000002
73fce6afc07496dcc79c2e2763523207c257185b
Update the docstring
rhea/vendor/device_clock_mgmt_prim.py
rhea/vendor/device_clock_mgmt_prim.py
from __future__ import absolute_import import myhdl from myhdl import instance, delay, always_comb from rhea.system import timespec @myhdl.block def _clock_generate(clock, enable, ticks): assert len(ticks) == 2 totticks = sum(ticks) @instance def mdlclk(): clock.next = False while ...
from __future__ import absolute_import import myhdl from myhdl import instance, delay, always_comb from rhea.system import timespec @myhdl.block def _clock_generate(clock, enable, ticks): assert len(ticks) == 2 totticks = sum(ticks) @instance def mdlclk(): clock.next = False while ...
Python
0.000061
ea7c05a74a7d2b652bff7f3501be8e4a87e9fdef
Test suite setting and running all tests
proto/parallel/Parallel.py
proto/parallel/Parallel.py
import subprocess from time import time from random import randint import os import re import sys from robot.libraries import BuiltIn from robot.utils import html_escape class Parallel(object): def __init__(self, runner_script, *arguments): self._script = runner_script self._arguments = list(argum...
import subprocess from time import time from random import randint import os import re import sys from robot.libraries import BuiltIn from robot.utils import html_escape class Parallel(object): def __init__(self, runner_script, *arguments): self._script = runner_script self._arguments = list(argum...
Python
0
2c740bbf7b5e7e9da28c5e1bce7811203ec21228
Add initial test suite using unittest module, for 2.6.
cobs26/test.py
cobs26/test.py
""" Consistent Overhead Byte Stuffing (COBS) Unit Tests This version is for Python 2.6. """ import cobs import unittest decode_error_test_strings = [ b"\x00", b"\x05123", b"\x051234\x00", b"\x0512\x004", ] def infinite_non_zero_generator(): while True: for i in xrange(1,50): ...
Python
0
ce1a4f7f55e03429dd0baf219fda71debc7e2ba2
add test to backup degraded
plenum/test/replica/test_replica_removing_with_backup_degraded.py
plenum/test/replica/test_replica_removing_with_backup_degraded.py
import pytest from plenum.test.replica.helper import check_replica_removed from stp_core.loop.eventually import eventually from plenum.test.helper import waitForViewChange from plenum.test.test_node import ensureElectionsDone def test_replica_removing_with_backup_degraded(looper, ...
Python
0
46be255fd0cfaeb2352f2f49b4ec5996a804768d
Add unit test for base Handler.
test/unit/handler/test_base.py
test/unit/handler/test_base.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. from mock import Mock from bark.log import Log from bark.handler.base import Handler from bark.formatter.base import Formatter class Concrete(Handler): '''Concrete subclass of abstract base for testing.''' ...
Python
0
90e96e741bce834e3862a6ed84b22c6d45f64d3f
solve 11997
UVA/vol-119/11997.py
UVA/vol-119/11997.py
from heapq import heapify, heappush, heappop from sys import stdin, stdout I = list(map(int, stdin.read().split())) ii = 0 while ii < len(I): N = I[ii] sums = I[ii+1: ii+1 + N] sums.sort() for k in range(1, N): X = I[ii+1 + k*N: ii+1 + k*N + N] X.sort() q = list(-(s + X[0]) for s in sums) h...
Python
0.999998
40a83c5fc16facc0fa7e64752dd348c255f07754
add C/C++ building tools named `Surtr`
cplusplus/chaos/tools/surtr/Surtr.py
cplusplus/chaos/tools/surtr/Surtr.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # Copyright (c) 2016 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright...
Python
0
ea9473959c1d6c505b8c25405c8c2674945d84e9
add uts for backup_processor
tests/backup_processor_test.py
tests/backup_processor_test.py
#!/usr/bin/env python3 import sys import os import shutil import unittest import create_and_write_file import mvtools_test_fixture import backup_processor class BackupProcessorTest(unittest.TestCase): def setUp(self): v, r = self.delegate_setUp() if not v: self.tearDown() ...
Python
0
88c5a9e79a986e828a1da7a09b7cdaf3fddd68a4
Add Elasticsearch Service Domain
stacker_blueprints/elasticsearch.py
stacker_blueprints/elasticsearch.py
"""AWS Elasticsearch Service. Blueprint to configure AWS Elasticsearch service. Example:: - name: elasticsearch class_path: stacker_blueprints.elasticsearch.Domain variables: Roles: - ${empireMinion::IAMRole} InternalZoneId: ${vpc::InternalZoneId} InternalZoneName: $...
Python
0.000001
ed57bed46a54bfd531e32a3c69a1f5e465f80662
add tests for parse_args
tests/test_tcurl.py
tests/test_tcurl.py
from __future__ import absolute_import import pytest from tchannel.tcurl import parse_args @pytest.mark.parametrize('input,expected', [ ( # basic case '--host foo --profile', [['foo/'], [None], [None], True] ), ( # multiple bodies, constant host/headers '--host foo -d 1 2', ...
Python
0.000001
0a2c658d4d44a5c813b40d5040e101688eeac118
Update os.py
tendrl/node_agent/persistence/os.py
tendrl/node_agent/persistence/os.py
from tendrl.common.etcdobj.etcdobj import EtcdObj from tendrl.common.etcdobj import fields class Os(EtcdObj): """A table of the Os, lazily updated """ __name__ = 'nodes/%s/Os/' node_id = fields.StrField("node_id") os = fields.StrField("os") os_version = fields.StrField("os_version") kern...
from tendrl.common.etcdobj.etcdobj import EtcdObj from tendrl.common.etcdobj import fields class Os(EtcdObj): """A table of the Os, lazily updated """ __name__ = 'nodes/%s/Os/' node_uuid = fields.StrField("node_id") os = fields.StrField("os") os_version = fields.StrField("os_version") ke...
Python
0.000001
dcc5065c7cc4cc167affcbf906eaf81e73fa6d3e
Add py solution for 645. Set Mismatch
py/set-mismatch.py
py/set-mismatch.py
class Solution(object): def findErrorNums(self, nums): """ :type nums: List[int] :rtype: List[int] """ for i, n in enumerate(nums, 1): while i != n and nums[n - 1] != n: nums[i - 1], nums[n - 1] = nums[n - 1], nums[i - 1] n = nums[i...
Python
0.000168
236a25a159ea523c0b7d3eb009f6bf7df523d37f
Add py file used to build win64 binaries
pyinstalive_win.py
pyinstalive_win.py
from pyinstalive.__main__ import main if __name__ == '__main__': main()
Python
0
c806eb658e9a7088662fe7d520e3c59be6883099
Create pyspark_starter
pyspark_starter.py
pyspark_starter.py
from pyspark import SparkConf, SparkContext conf = SparkConf().setMaster("local[2]").setAppName("RDD Example") sc = SparkContext(conf=conf) # different way of setting configurations #conf.setMaster('some url') #conf.set('spark.executor.memory', '2g') #conf.set('spark.executor.cores', '4') #conf.set('spark.cores.max'...
Python
0.000001
53cbc714d9e7d498443356c370e5e77d24118764
add clear names_txt script
tmp_tools/cleanup_names.txt.py
tmp_tools/cleanup_names.txt.py
#!/usr/bin/python3 """ Remove entries from names.txt that already present in ini files. """ import os import re from enviroment import BASE_PATH, MP_PATH from ini_file import IniFile name_reg = re.compile('^([\w-]+)[ \t]+(.*)') def clean(module_path, module_name): print("Cleaning %s(%s)" % (module_name, module_...
Python
0.000001
712c76e9ae053079cd8c1de7ddc48736bb916d56
add a compare_tsv utility to debug bad outputs
compare_tsv.py
compare_tsv.py
#!/usr/bin/env python2 import cmath import csv import os import os.path import math import re import subprocess import sys CMD = './mdl' BASE = 'test/compat' EXTS = ['xmile'] #, 'stmx', 'itmx', 'STMX', 'ITMX', 'mdl', 'MDL'] # from rainbow def make_reporter(verbosity, quiet, filelike): if not quiet: def ...
Python
0
ea51e276d17169c0ec62d694b513cea4fea167a4
Add file for dealing with search queries
search.py
search.py
import click import requests def anime_search(): pass def manga_search(): pass
Python
0
8c25fb10724ad4824ee9d94c270d95f8d4bae691
Add 3D hybridization demo with file-write
experiments/hybridization_3D_extr.py
experiments/hybridization_3D_extr.py
from __future__ import absolute_import, print_function, division from firedrake import * def test_slate_hybridization_extr(degree, resolution, layers): base = UnitSquareMesh(2 ** resolution, 2 ** resolution, quadrilateral=False) mesh = ExtrudedMesh(base, layers=layers, layer_height=...
Python
0
f75bc25d3aed7bce65a8274fcf539db0eafc9900
Add adversarial module
artificial/searches/adversarial.py
artificial/searches/adversarial.py
import time import numpy as np from . import base class MinMax(base.Search): """Min Max Adversarial Search. Parameters ---------- time_limit : float (default=np.inf) Time limit (in seconds) for a performance. By default, search has infinite time to make a decision. depth...
Python
0.000002
e37b855bf50afefafb190c6c2346c13cbc3f14b4
Create quiz5.py
laboratorios/quiz5.py
laboratorios/quiz5.py
#quiz5 class Hola(object): mensaje = "Hola mundo" __contador = 0 def ingresar(self,texto): texto = input("Ingrese mensaje") self.texto = texto def comparar(object): if texto == mensaje: return(+str"mensaje"+) else: return("Adios mundo") def guardarTexto(): out_file = open(archivo, "wt") ou...
Python
0.000002
1b4bf232b9fd348a94b8bc4e9c851ed5b6d8e801
Add tests for config generation
tests/config/test_room_directory.py
tests/config/test_room_directory.py
# -*- coding: utf-8 -*- # Copyright 2018 New Vector Ltd # # 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 la...
Python
0.000001
b7b01cc092cd8ea62ac5f8cb64d4dfe1dafd877f
Create client.py
client.py
client.py
import ntplib import sys, os, subprocess from time import ctime HostIP = '127.0.0.1' # Essential shell functionality def run_command(cmd): proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) stdoutput = proc.stdout.read() + proc.stderr.read() retur...
Python
0.000001
db61502f493871a1355d0d23c50ada89b8696bff
Add white_balance tests module
tests/plantcv/test_white_balance.py
tests/plantcv/test_white_balance.py
import pytest import cv2 from plantcv.plantcv import white_balance def test_white_balance_gray_16bit(test_data): # Read in test data img = cv2.imread(test_data.fmax, -1) # Test with mode "hist" white_balanced = white_balance(img=img, mode='hist', roi=(5, 5, 80, 80)) assert img.shape == white_balan...
Python
0.000001
340441af25a2c21a72d9b8e7027874302baf0cde
add result storage feature
thumbor_memcached/result_storage.py
thumbor_memcached/result_storage.py
#!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/thumbor/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com timehome@corp.globo.com import hashlib import sys from datetime import datetime from json imp...
Python
0
3f10c701d5b7c778a2f82a047ef3bb940d684fa7
rename camelcase fields in slice
planetstack/core/migrations/0004_slice_field_case.py
planetstack/core/migrations/0004_slice_field_case.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import timezones.fields class Migration(migrations.Migration): dependencies = [ ('core', '0003_network_field_case'), ] operations = [ migrations.RenameField( model_name='...
Python
0.000001
948200f4cf10449a40e75e539f58cab409ce3461
Update sites -> migrations
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/contrib/sites/migrations/0001_initial.py
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/contrib/sites/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.contrib.sites.models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Site', fields=[ ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.contrib.sites.models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Site', fields=[ ...
Python
0
3cd759c4794f8688866970d68c39023c6bef1a3d
Add tests for representations
test_classy/test_representations.py
test_classy/test_representations.py
from flask import Flask, make_response from flask_classy import FlaskView import json from nose.tools import * class JsonResource(object): content_type = 'application/json' def output(self, data, code, headers=None): dumped = json.dumps(data) response = make_response(dumped, code) if ...
Python
0
958a8bb4de0f11688b02a3501fe1e0b9cac28178
add gnomad
pynnotator/helpers/gnomad.py
pynnotator/helpers/gnomad.py
#Gemini wrapper import argparse from subprocess import run from pynnotator import settings import os class GnomAD: def __init__(self, vcf, cores): self.data = [] def install(): print('Install gnomAD') os.chdir(settings.data_dir) if not os.path.exists('gnomad'): ...
Python
0.000171
83c17fe4afe87db3d1445a4a4ce06ce2f46a2221
Remove unnecessary importing
vint/linting/formatter/formatter.py
vint/linting/formatter/formatter.py
from pathlib import Path from ansicolor import Colors, colorize DEFAULT_FORMAT = '{file_path}:{line_number}:{column_number}: {description} (see {reference})' FORMAT_COLOR_MAP = { 'file_path': Colors.Red, 'file_name': Colors.Red, 'line_number': Colors.White, 'column_number': Colors.White, 'severit...
from pathlib import Path from ansicolor import Colors, colorize from operator import attrgetter DEFAULT_FORMAT = '{file_path}:{line_number}:{column_number}: {description} (see {reference})' FORMAT_COLOR_MAP = { 'file_path': Colors.Red, 'file_name': Colors.Red, 'line_number': Colors.White, 'column_num...
Python
0.000014
fefcc9ab57b5dc818690c4febc4250fffb0f9543
Add a new sub example regarding custom ACL modification
subs/modify_acl.py
subs/modify_acl.py
# Copyright 2016 Netfishers # # 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...
Python
0
8cc020949f1d7eb9c66121a7d3a762738cb44c2c
Add dictionary mapping abbreviations to station names
src/station_map.py
src/station_map.py
station_map = { '12th': '12th St. Oakland City Center', '16th': '16th St. Mission (SF)', '19th': '19th St. Oakland', '24th': '24th St. Mission (SF)', 'ashb': 'Ashby (Berkeley)', 'balb': 'Balboa Park (SF)', 'bayf': 'Bay Fair (San Leandro)', 'cast': 'Castro Valley', 'civc': 'Civic Cent...
Python
0.000003
eeee6f03131fe20bb3374cbd6c8f80b3894083da
Create main.py
main.py
main.py
#!/usr/bin/env python """ qr - Convert stdin (or the first argument) to a QR Code. When stdout is a tty the QR Code is printed to the terminal and when stdout is a pipe to a file an image is written. The default image format is PNG. """ import sys, os import optparse import qrcode default_factories = { 'pil': 'qrcod...
Python
0
af492e64e4da81a5e65c3d2f2a9cdc6c6b34e786
add main
main.py
main.py
import argparse def main(): """Main method.""" parser = argparse.ArgumentParser(description='Look for an author in the Web of Science.') parser.add_argument('author', help='Surname and name of the author') parser.add_argument('-v', '--verbose', action='store_true', help='Verbose') parser.add_argum...
Python
0.000378
cb1d6f417a5349df485b99bf8a41744b7692cf07
Create main.py
main.py
main.py
import sys from Tkinter import * from winsound import * from PIL import ImageTk, Image import tkFont window = Tk() im0 = Image.open('image\\background.jpg') tkimage = ImageTk.PhotoImage(im0) Label(window,image = tkimage).pack() window.iconbitmap('image\\icon.ico') window.title('FIPER') window.attributes('-fullscree...
Python
0.000001
184c33d7528e61010116599f1ca3fbb68f1dc4a7
add tkinter template
main.py
main.py
#!/usr/local/bin/python3.4 #coding: utf-8 import tkinter as tk class MainApplication(tk.Frame): def __init__(self, parent, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) self.parent = parent # <create the rest of your GUI here> if __name__ == "__main__": root = tk....
Python
0
46a130d1a28025cc5060560d734deed11b4346c9
Introduce node.py.
node.py
node.py
#!/usr/bin/env python # -*- coding: UTF-8 import os import sys import socks class Node(object): def __init__(self, address, port): self.address = address self.port = port """ []: node = NetworkNode("192.168.0.112", 5555, "SOCKS5") []: node_socket = node.wrap_socket() """ class NetworkNode(Node): ...
Python
0
7ff3d55691d89eb8a00f273af18bade8602f34d0
insert to db outbox
insert.py
insert.py
#!/usr/bin/env python """ insert.py - Program to : 1. insert to outbox collection, 2. check if main is running? if not run then run """ print "Content-Type: text-html" print import cgitb cgitb.enable() import cgi import smsweb form = cgi.FieldStorage() rcpt = form["rcpt"].value msg = form["msg"].value sw = smsweb....
Python
0
cded6c2f088736ace88c0771a08cd9c8ef6dccef
Test for NullConfigStorage
server/lib/python/cartodb_services/test/refactor/storage/test_null_config.py
server/lib/python/cartodb_services/test/refactor/storage/test_null_config.py
from unittest import TestCase from cartodb_services.refactor.storage.null_config import NullConfigStorage from cartodb_services.refactor.core.interfaces import ConfigBackendInterface class TestNullConfigStorage(TestCase): def test_is_a_config_backend(self): null_config = NullConfigStorage() asser...
Python
0
4c5a2540ea665d763e7a66fcae108dd1a2656a00
fix file extension issue
you_get/downloader/mixcloud.py
you_get/downloader/mixcloud.py
#!/usr/bin/env python __all__ = ['mixcloud_download'] from ..common import * def mixcloud_download(url, output_dir = '.', merge = True, info_only = False): html = get_html(url) title = r1(r'<meta property="og:title" content="([^"]*)"', html) url = r1("data-preview-url=\"([^\"]+)\"", html) url = ...
#!/usr/bin/env python __all__ = ['mixcloud_download'] from ..common import * def mixcloud_download(url, output_dir = '.', merge = True, info_only = False): html = get_html(url) title = r1(r'<meta property="og:title" content="([^"]*)"', html) url = r1("data-preview-url=\"([^\"]+)\"", html) url = ...
Python
0
8951477a3b6f9e07e2f81e18b698cd0afda69d60
add terms tests
bluebottle/terms/tests/test_api.py
bluebottle/terms/tests/test_api.py
from django.core.urlresolvers import reverse from rest_framework import status from bluebottle.test.utils import BluebottleTestCase from bluebottle.test.factory_models.accounts import BlueBottleUserFactory from bluebottle.test.factory_models.terms import TermsFactory class TermsAPITest(BluebottleTestCase): """ ...
Python
0.00022
538a652a5a149f54266973b32691bfb2870c28b5
Add unit tests for local container launch functions in `xm_local.execution`.
xmanager/xm_local/execution_test.py
xmanager/xm_local/execution_test.py
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
Python
0.000644
6632f374d0d9979fd94f462e861dfb21ae146a48
Move utilities out of FilePlayer into sound.Util
code/python/echomesh/sound/Util.py
code/python/echomesh/sound/Util.py
from __future__ import absolute_import, division, print_function, unicode_literals import aifc import math import numpy import sunau import wave from echomesh.util import Subprocess LOGGER = Log.logger(__name__) DEFAULT_AUDIO_DIRECTORY = DefaultFile.DefaultFile('assets/audio') FILE_READERS = {'au': sunau, 'aifc': ...
Python
0.000001