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
61b7ee073efcd698329bec69a9eb682a1bc032d3
Add py_trace_event to DEPS.
telemetry/telemetry/util/trace.py
telemetry/telemetry/util/trace.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. from telemetry.core import util util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'third_party', 'py_trace_event', 'src') from trac...
Python
0.000008
c3789b5f8a8c90902693194cf257b6c9e4ac7783
Add solution to 119.
119/119.py
119/119.py
""" The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284. We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a su...
Python
0.000083
2c155d4fe286f685bca696c60730bd2fca2151f1
Add new package: sysbench (#18310)
var/spack/repos/builtin/packages/sysbench/package.py
var/spack/repos/builtin/packages/sysbench/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Sysbench(AutotoolsPackage): """Scriptable database and system performance benchmark.""" ...
Python
0
34a9969495f1b1c9452bff54cb03148e68fde303
Create Insertion_sort_with_binary_search.py
C02-Getting-Started/exercise_code/Insertion_sort_with_binary_search.py
C02-Getting-Started/exercise_code/Insertion_sort_with_binary_search.py
# Exercise 2.3-6 in book # Standalone Python version 2.7 code import os import re import math import time from random import randint def insertion_sort(array): for j, v in enumerate(array): key = v i = j - 1 while i > -1 and array[i] > key: array[i+1] = array[i] i = i - 1 array[i+1] = key def inserti...
Python
0.000002
274e7a93bac93461f07dd43f3f84f1f00e229ffd
Add migration script hr_family -> hr_employee_relative
hr_employee_relative/migrations/12.0.1.0.0/post-migration.py
hr_employee_relative/migrations/12.0.1.0.0/post-migration.py
# Copyright 2019 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openupgradelib import openupgrade @openupgrade.migrate() def migrate(env, version): cr = env.cr columns = 'fam_spouse, fam_spouse_employer, fam_spouse_tel, fam_father,' \ ' fam_father_date_of_...
Python
0
5f9bb1a027664a0107a213b5dfa82c22d75c1196
handle relative paths
pls-files.py
pls-files.py
#!/usr/bin/env python from ConfigParser import SafeConfigParser from contextlib import closing from os.path import basename, dirname, join, normpath, realpath import sys from urllib2 import urlopen def generic_open(arg): try: return urlopen(arg), None except ValueError: arg = normpath(realpath(...
#!/usr/bin/env python from ConfigParser import SafeConfigParser from contextlib import closing from os.path import basename, dirname, join import sys from urllib2 import urlopen def generic_open(arg): try: return urlopen(arg), None except ValueError: return open(arg, "r"), dirname(arg) def pla...
Python
0.000003
061ba14918eb6598031c9ad8a1c3f8e9c0f0a34b
Create LeetCode-LowestCommonAncestor2.py
LeetCode-LowestCommonAncestor2.py
LeetCode-LowestCommonAncestor2.py
""" Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. Notice it is binary tree, not BST """ class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def lowestCommonAncest...
Python
0.000004
63208828762d01122054d122c8d305fa8930f9bd
Make service postage nullable
migrations/versions/0258_service_postage_nullable.py
migrations/versions/0258_service_postage_nullable.py
""" Revision ID: 0258_service_postage_nullable Revises: 0257_letter_branding_migration Create Date: 2019-02-12 11:52:53.139383 """ from alembic import op import sqlalchemy as sa revision = '0258_service_postage_nullable' down_revision = '0257_letter_branding_migration' def upgrade(): # ### commands auto gener...
Python
0.999996
bc1fe15c77b8eedb40993e5ea24fa4d7340ff646
Fix bug 17 (#4254)
PaddleRec/multi-task/MMoE/args.py
PaddleRec/multi-task/MMoE/args.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # 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 appl...
Python
0
0179d4d84987da76c517de4e01100f0e1d2049ea
Add unit tests for pacman list packages
tests/unit/modules/pacman_test.py
tests/unit/modules/pacman_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Eric Vz <eric@base10.org>` ''' # Import Python Libs from __future__ import absolute_import # Import Salt Testing Libs from salttesting import TestCase, skipIf from salttesting.mock import ( MagicMock, patch, NO_MOCK, NO_MOCK_REASON ) from salttesti...
Python
0
f2d4ddba7c594ec93f0ede0be1fc515b0c7c2d7b
Remove HInput and Isolate joystick related code because son path isues with pygame
HJoystick.py
HJoystick.py
#from direct.showbase import DirectObject import pygame #pygame must be in the Main.py directory #THIS FILE MUST BE IN THE MAIN.PY DIRECTORY BECAUSE SON PATH ISSUES class HJoystickSensor(): def __init__(self,joystickId=0): #print os.getcwd() pygame.init() pygame.joystick.init() c=p...
Python
0
fe63d6e1e822f7cb60d1c0bdaa08eb53d3849783
Add script to extract artist names from MusicBrainz database
benchmark/datasets/musicbrainz/extract-from-dbdump.py
benchmark/datasets/musicbrainz/extract-from-dbdump.py
#!/usr/bin/env python """ Script to extract the artist names from a MusicBrainz database dump. Usage: ./extract-from-dbdump.py <dump_dir>/artist <outfile> """ import pandas as pd import sys __author__ = "Uwe L. Korn" __license__ = "MIT" input_file = sys.argv[1] output_file = sys.argv[2] df = pd.read_csv(input...
Python
0
842092122b14343c9b1c2e2a4e0dd67dd8bdf767
build SlideEvaluation objects from existing data
promort/slides_manager/migrations/0014_auto_20171201_1119.py
promort/slides_manager/migrations/0014_auto_20171201_1119.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-12-01 11:19 from __future__ import unicode_literals from django.db import migrations def populate_slide_evaluations(apps, schema_editor): SlideEvaluation = apps.get_model('slides_manager', 'SlideEvaluation') SlideQualityControl = apps.get_model('sl...
Python
0
116f41481062e6d9f15c7a81c2e5268aa1b706c7
add sources script
admin/scripts/addListOfSources.py
admin/scripts/addListOfSources.py
from collections import defaultdict import re import sys import time sys.path.append('../..') from crawler.crawler import crawl, itemFactory from engine.data.database.databaseConnection import commit, rollback from engine.data.database.sourceTable import addSource, sourceExists, urlToLookupId from engine.data.database...
Python
0.000001
76ff934621268a52bf4502449ea6a3843036c849
add missing test
cairis/cairis/test/test_Persona.py
cairis/cairis/test/test_Persona.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
Python
0.000288
b95798ef7723443adbd66915c375bfe6d8f62173
Add CIFAR-10/100 datasets
chainer/dataset/datasets/cifar.py
chainer/dataset/datasets/cifar.py
import tarfile import numpy from six.moves.cPickle import pickle from chainer.dataset.datasets import tuple_dataset from chainer.dataset import download def get_cifar10(withlabel=True, ndim=3, scale=1.): """Gets the CIFAR-10 dataset. `CIFAR-10 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ is a set of sma...
Python
0.000012
3a235e25ac3f5d76eb4030e01afbe7b716ec6d91
Add py solution for 331. Verify Preorder Serialization of a Binary Tree
py/verify-preorder-serialization-of-a-binary-tree.py
py/verify-preorder-serialization-of-a-binary-tree.py
class Solution(object): def isValidSerialization(self, preorder): """ :type preorder: str :rtype: bool """ def get_tree(nodes, offset): if nodes[offset] == '#': return offset + 1 else: left = get_tree(nodes, offset + 1) ...
Python
0.005023
d733d3359038e6b249a6bd878ba0d6c3224b5e9a
fix flake8 errors
run_tests.py
run_tests.py
#!/usr/bin/env python import sys import shutil import tempfile try: import django except ImportError: print("Error: missing test dependency:") print(" django library is needed to run test suite") print(" you can install it with 'pip install django'") print(" or use tox to automatically handle t...
#!/usr/bin/env python import sys import shutil import tempfile try: import django except ImportError: print("Error: missing test dependency:") print(" django library is needed to run test suite") print(" you can install it with 'pip install django'") print(" or use tox to automatically handle t...
Python
0.000001
f6dce9177421f61c7a773e1bbe53588eb54defc9
Create score.py
Samples/AzureML/score.py
Samples/AzureML/score.py
#example: scikit-learn and Swagger import json import numpy as np import pandas as pd import azureml.train.automl from sklearn.externals import joblib from sklearn.linear_model import Ridge from azureml.core.model import Model from inference_schema.schema_decorators import input_schema, output_schema from inference_sc...
Python
0.000008
4f45932c2a3519b6ccbdee20fb4beaafe1774bb2
Refactor for spaceapi, closes #135
plugins/status.py
plugins/status.py
from irc3.plugins.command import command from bytebot_config import BYTEBOT_PLUGIN_CONFIG from irc3 import asyncio import json import aiohttp @command(permission="view") @asyncio.coroutine def status(bot, mask, target, args): """Returns the door status of the hackerspace rooms %%status """ try: ...
from irc3.plugins.command import command from bytebot_config import BYTEBOT_PLUGIN_CONFIG from irc3 import asyncio import json import aiohttp @command(permission="view") @asyncio.coroutine def status(bot, mask, target, args): """Returns the door status of the hackerspace rooms %%status """ try: ...
Python
0
f1599a7b3f342a86cf7eb7201593b8515d5f13ad
Add views for handling 400 & 500 errors
arcutils/views.py
arcutils/views.py
import logging from django.http import HttpResponseBadRequest, HttpResponseServerError from django.template import loader from django.views.decorators.csrf import requires_csrf_token log = logging.getLogger(__name__) @requires_csrf_token def bad_request(request, exception=None, template_name='400.html'): """Ov...
Python
0
7aee25badd2085d63012c83f6be8082d93427754
Add files via upload
polyregreesion.py
polyregreesion.py
# -*- coding: utf-8 -*- """ Created on Sun Jul 31 10:03:15 2016 @author:Viky Code for polynomial regression """ #importing necessary packages import numpy as np import tensorflow as tf import matplotlib.pyplot as plt #input data: x_input=np.linspace(0,3,1000) x1=x_input/np.max(x_input) x2=np.power(x_input,2)/np.ma...
Python
0
6f4d5917abdbae1fe731e7a1786d8589d2b31ac0
Fix #160 -- Add missing migration
machina/apps/forum/migrations/0011_auto_20190627_2132.py
machina/apps/forum/migrations/0011_auto_20190627_2132.py
# Generated by Django 2.2.2 on 2019-06-28 02:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('forum', '0010_auto_20181103_1401'), ] operations = [ migrations.AlterField( model_name='forum', name='level', ...
Python
0
4c601ce9b91a0bef7082e3d8a5c1b95dc512d829
add csl_util
User_Crawler/util_csl.py
User_Crawler/util_csl.py
# -*- coding: utf-8 -*- from types import * import pandas as pd USER_ATTR_LIST = ['./data/cross-site-linking/user_type.csv', './data/graph/CC.csv', './data/graph/degree.csv', './data/graph/pagerank.csv' ] def dict_merge(dict_1, dict_2): res...
Python
0.000006
27b10f95e12c1fc1492be61643a057a9934ad535
Add SSA.
inspectors/ssa.py
inspectors/ssa.py
#!/usr/bin/env python import datetime import logging import os from urllib.parse import urljoin from bs4 import BeautifulSoup from utils import utils, inspector # http://oig.ssa.gov/ # Oldest report: 1996 # options: # standard since/year options for a year range to fetch from. # # Notes for IG's web team: # AUDI...
Python
0
bcee6173027c48bfb25a65d3e97660f2e2a0852b
Add a python script to generate test methods
gentest.py
gentest.py
from itertools import product import json import numpy cube = numpy.array(range(1, 9)).reshape(2, 2, 2) pcube = [ cube[0 ,0 ,0 ], cube[0 ,0 ,0:2], cube[0 ,0:2,0:1], cube[0 ,0:2,0:2], cube[0:2,0:1,0:1], cube[0:2,0:1,0:2], cube[0:2,0:2,0:1], cube[0:2,0:2,0:2], ] for (i, (a, b)) i...
Python
0.000017
052392da7980c4f4e2e86cd8eb65da5b91d3547b
Solve Code Fights different symbols naive problem
CodeFights/differentSymbolsNaive.py
CodeFights/differentSymbolsNaive.py
#!/usr/local/bin/python # Code Fights Different Symbols Naive Problem from collections import Counter def differentSymbolsNaive(s): return len(Counter(s)) def main(): tests = [ ["cabca", 3], ["aba", 2] ] for t in tests: res = differentSymbolsNaive(t[0]) ans = t[1] ...
Python
0.001563
226f9430f81c4833a7541c2093dca07ef3645744
Add build script
bin/build.py
bin/build.py
#!/usr/bin/env python3 # Copyright (c) 2014, Ruslan Baratov # All rights reserved. import argparse import os import re import shutil import subprocess import sys parser = argparse.ArgumentParser(description="Script for building") parser.add_argument( '--toolchain', choices=[ 'libcxx', 'xcode'...
Python
0.000001
f625f46e89c8e95677492cfb03ee113a3f6c7bb3
Add utils.py
src/utils.py
src/utils.py
""" The MIT License (MIT) Copyright (c) 2017 Stefan Graupner 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, mer...
Python
0.000004
f156cde55596ab7d954d41454f951227a719f6d5
Create keys repository script
metadata_repo/scripts/create_keys_repo.py
metadata_repo/scripts/create_keys_repo.py
''' Script for creating the RSA keys and creating a new repository ''' from tuf.libtuf import * # Generate and write the first of two root keys for the TUF repository. # The following function creates an RSA key pair, where the private key is saved to # "path/to/root_key" and the public key to "path/to/root_key.pub"...
Python
0.000001
05c588866cc66bff33cb77fe35434f850ddd07f0
Handle values larger than 2**63-1 in numeric crash address conversion (#119)
server/crashmanager/migrations/0009_copy_crashaddress.py
server/crashmanager/migrations/0009_copy_crashaddress.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function import sys from django.db import models, migrations from django.conf import settings def create_migration_tool(apps, schema_editor): CrashEntry = apps.get_model("crashmanager", "CrashEntry") for entry in CrashEntry.objects.f...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function import sys from django.db import models, migrations from django.conf import settings def create_migration_tool(apps, schema_editor): CrashEntry = apps.get_model("crashmanager", "CrashEntry") for entry in CrashEntry.objects.f...
Python
0
4c381da905d81bde6ed28407f8e4cd3bcbd6d8be
Add cart forms
apps/cart/forms.py
apps/cart/forms.py
from django import forms PRODUCT_QUANTITY_CHOICES = [(i, str(i)) for i in range(1, 21)] class CartAddProductForm(forms.Form): quantity = forms.TypedChoiceField(choices=PRODUCT_QUANTITY_CHOICES, coerce=int) update = forms.BooleanField(required=False, initial=False, ...
Python
0.000001
46f25a4e0a43ea1ea8e1aaddbcdf18f6f20badba
Add package for open source Shiny Server (#3688)
var/spack/repos/builtin/packages/shiny-server/package.py
var/spack/repos/builtin/packages/shiny-server/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.000004
55ee723c6a95046d59efedb47f276262835892af
reverse string
learning/test/reverse_string.py
learning/test/reverse_string.py
__author__ = 'root' def reverse(text): reverse_text = "" for char in range(len(text)): reverse_text = text[char] + reverse_text return reverse_text print reverse("abcd")
Python
0.999999
1bb2a9213dad8bde8a05da63438dbcdd0d8d09c6
add example for asynchronous execution, little simpler than multiprocessing, uses a decorator to simplify it further
examples/async.py
examples/async.py
#!/usr/bin/env python2.7 """Example of asynchronously running "show version". async(): decorator to make further functions asynchronous command_runner(): creates a connection and runs an arbitrary command main(): entry point, runs the command_runner """ import netmiko from inspect import getmodule from multiprocessing...
Python
0
d159b32d51339915ef633f3c6d33ce5eeafa78d6
Add py solution for 396. Rotate Function
py/rotate-function.py
py/rotate-function.py
class Solution(object): def maxRotateFunction(self, A): """ :type A: List[int] :rtype: int """ lA = len(A) if not lA: return 0 subsum = 0 F = 0 for i in xrange(1, lA): subsum += A[-i] F += subsum subs...
Python
0.998434
70ff0faa7da6066bb75ddb871f67aa749f5bdc4e
Add custom field rendering tests
django_admin_bootstrapped/tests.py
django_admin_bootstrapped/tests.py
from __future__ import absolute_import from django.test import TestCase from django.contrib.admin.widgets import AdminDateWidget from django.template import Template, Context from django import forms try: from bootstrap3 import renderers except ImportError: # nothing to test if we don't have django-bootstrap3...
Python
0
84e14782f353ef1d0dec20ed1da31cfb1da413a4
Add diary example.
examples/diary.py
examples/diary.py
#!/usr/bin/env python from collections import OrderedDict import datetime import sys from walrus import * database = Database(host='localhost', port=6379, db=0) class Entry(Model): database = database namespace = 'diary' content = TextField(fts=True) timestamp = DateTimeField(default=datetime.datet...
Python
0
eca8accb984c252f36289cd7bbab8ab23c198317
Create problem3.py
W2/L4/problem3.py
W2/L4/problem3.py
#L4 PROBLEM 3 def square(x): ''' x: int or float. ''' return x ** 2
Python
0.000022
3332370d70ad30856c9517e51eedc454500f8bf8
Add forwarding script for build-bisect.py.
build/build-bisect.py
build/build-bisect.py
#!/usr/bin/python # Copyright (c) 2010 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 sys print "This script has been moved to tools/bisect-builds.py." print "Please update any docs you're working from!" sys.exit...
Python
0.000002
35e720cf7b9cbae4e077d0699dd321f741180787
Create cached_test.py
cached/cached_test.py
cached/cached_test.py
from cached import cached class Double: def __init__(self, x): self._x = x @cached("_double_x") def value(self): return self._x * 2
Python
0.000003
5578504506edfd121fd80cbc50c32a462504cd48
Add oskar/taper_sky.py: Taper sky image with Tukey window
astro/oskar/taper_sky.py
astro/oskar/taper_sky.py
#!/usr/bin/env python3 # # Copyright (c) 2017 Weitian LI <weitian@aaronly.me> # MIT License # """ Taper the sky image (input of OSKAR simulation) to mitigate the side lobes effects, which causes trouble in creating good images. The circular Tukey window is adopted, which is also built in by e.g., WSClean. """ import...
Python
0
ee7c257b62bff832b899f54fd7bf39ae47db05b7
Add tool to get new url
get_new_url.py
get_new_url.py
import sys import polycules if len(sys.argv) != 2: print('Expected ID, got too little or too much') old_id = sys.argv[1] db = polycules.connect_db() result = db.execute('select hash from polycules where id = ?', [ old_id, ]).fetchone() if result is None: print("Couldn't find the polycule with that ID"...
Python
0
a994df7e8961e0d82a37ed268dba55c021c7ccd1
Move order - here till i get the order_desc stuff working.
objects/OrderExtra/Move.py
objects/OrderExtra/Move.py
from xstruct import pack from objects import Order class Move(Order): """\ Move to a place in space. """ subtype = 1 substruct = "qqq" def __init__(self, sequence, \ id, type, slot, turns, resources, \ x, y, z): Order.__init__(self, sequence, \ id, type, slot, turns, resources, x, y, z) ...
Python
0
b8764629331caeeb37a4845480ed884841719525
scale phage counts to percent so match bacteria counts
code/percent_phage_counts.py
code/percent_phage_counts.py
""" The phage counts per metagenome are normalized based on the number of reads that hit. I want to scale that to a percent, so that it matches the bacterial data. If there was a single phage present it would get 100% of the reads """ import os import sys try: inf = sys.argv[1] ouf = sys.argv[2] except: ...
Python
0.000001
d2a84fb3a8165c9526aa5c96f308dda3b92a2c2c
add new decision module
code/decision.py
code/decision.py
""" Module for rover decision-handling. Used to build a decision tree for determining throttle, brake and steer commands based on the output of the perception_step() function in the perception module. """ __author__ = 'Salman Hashmi' __license__ = 'BSD License' import time import numpy as np import states import...
Python
0
3896ddcf660e168afaa80a0be9d7b40b6dd15967
Add script to clean source code of compiled files.
sansview/clean.py
sansview/clean.py
""" Remove all compiled code. """ import os filedirs = ['.', 'perspectives', 'perspectives/fitting'] for d in filedirs: files = os.listdir(d) for f in files: if f.find('.pyc')>0: print "Removed", f os.remove(os.path.join(d,f))
Python
0
ec736876e11a5aa4f52c63a91b05fc342e298051
Add config.sample.py.
config.sample.py
config.sample.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: config.sample.py Author: huxuan <i@huxuan.org> Description: Configuration file for app. """ # Debug or not DEBUG = True # Make jsonfiy encode in utf-8. JSON_AS_ASCII = False # Secret key. SECRET_KEY = 'CAPUHOME_Secret_Key' # Database & sqlalchemy. DB_USERNAME ...
Python
0
cd014f09534e422851955c65c1e60ac39a478816
add glycan residues
bomeba0/glycans.py
bomeba0/glycans.py
from collections import namedtuple import numpy as np """ Templates for amino acidic residues """ AA_info = namedtuple('AA_info', 'coords atom_names bonds bb sc offset') BDP_info = AA_info(coords=np.array([[-14.69, 10.15, -18.15], [-15.46, 11.47, -18.33], ...
Python
0.999583
ec9d97f7017939651fc78605fc81a2f030f88b5f
Add exceptions file
brew/exceptions.py
brew/exceptions.py
# -*- coding: utf-8 -*- __all__ = [ u'BrewdayException', u'DataLoaderException', u'GrainException', u'HopException', u'StyleException', u'YeastException', ] class BrewdayException(Exception): pass class DataLoaderException(BrewdayException): pass class GrainException(BrewdayExcept...
Python
0.000001
2dd55385c3c8209217bde19c5a8d30ad929ce084
Create employee.py
scheduler/employee.py
scheduler/employee.py
# -*- coding: utf-8 -*- # employee.py # # Created by Thomas Nelson <tn90ca@gmail.com> # # Created..........2015-03-12 # Modified.........2015-03-12 class Employee (object): """This class will represent an employee and there available time slots for each work day that the provided store is open. """ def __init...
Python
0.000053
70116d7181f48c16d614063df4de54dff172e8c6
Add internal note
conda_env/cli/main_export.py
conda_env/cli/main_export.py
from argparse import RawDescriptionHelpFormatter from copy import copy import os import sys import textwrap import yaml from conda.cli import common from conda.cli import main_list from conda import config from conda import install description = """ Export a given environment """ example = """ examples: conda e...
from argparse import RawDescriptionHelpFormatter from copy import copy import os import sys import textwrap import yaml from conda.cli import common from conda.cli import main_list from conda import config from conda import install description = """ Export a given environment """ example = """ examples: conda e...
Python
0
1a23860bfcc4fc5259bdcb0f208e38909e7055cc
add peak-merging script
cpv/peaks.py
cpv/peaks.py
""" find peaks or troughs in bed files for a bedgraph file with pvalues in the 4th column. usage would be: $ python peaks.py --dist 100 --seed 0.01 some.bed > some.regions.bed where regions.bed contains the start and end of the region and (currently) the lowest p-value in that region. """ from itertools import g...
Python
0
865069adb5312aa7a275ef377992a44bca6689da
Add initial file
cronjobparser.py
cronjobparser.py
# -*- coding: utf-8 -*- import codecs from pyparsing import White, Word, alphanums, CharsNotIn from pyparsing import Forward, Group, OneOrMore from pyparsing import pythonStyleComment from .freeradiusparser import BaseParser class CronJobParser(BaseParser): dtime = Word("0123456789-*") command = CharsNo...
Python
0.000001
f66038d1599843913dbe88eb02fa80b79e0d6e57
add script for bitwise operation
codecademy/bitwise.py
codecademy/bitwise.py
print 5 >> 4 # Right Shift print 5 << 1 # Left Shift print 8 & 5 # Bitwise AND print 9 | 4 # Bitwise OR print 12 ^ 42 # Bitwise XOR print ~88 # Bitwise NOT print "the base 2 number system" print 0b1, #1 print 0b10, #2 print 0b11, #3 print 0b100, #4 print 0b101, #5 print 0b110, #6 print 0b111 #7 ...
Python
0
059ab529b05d0640e7099e307878db58d6f2ffc9
update board test
scripts/test-board.py
scripts/test-board.py
"""Test script for the game board. Author: Yuhuang Hu Email : duguyue100@gmail.com """ from __future__ import print_function from minesweeper.msgame import MSGame game = MSGame(10, 10, 20) game.print_board() try: input = raw_input except NameError: pass while game.game_status == 2: # play move mo...
Python
0
65d2202bc686019ebdaf292693c79ace326ef798
Create MyoThalmic.py
service/MyoThalmic.py
service/MyoThalmic.py
from com.thalmic.myo import Pose myo = Runtime.start("python", "Python") myo = Runtime.start("myo", "MyoThalmic") myo.connect() myo.addPoseListener(python) onPose(pose): print(pose.getType())
Python
0
045f711f59c89559746ffddafecd92302c0a9ec6
add fct_collapse and fct_lump funcs
siuba/dply/forcats.py
siuba/dply/forcats.py
import pandas as pd import numpy as np from ..siu import create_sym_call, Symbolic from functools import singledispatch # TODO: move into siu def register_symbolic(f): @f.register(Symbolic) def _dispatch_symbol(__data, *args, **kwargs): return create_sym_call(f, __data.source, *args, **kwargs) ret...
Python
0.000003
c1b27a617c9050799bb11f4c161f925f153da5bc
add test_gst_rtsp_server.py
test_gst_rtsp_server.py
test_gst_rtsp_server.py
#!/usr/bin/env python # -*- coding:utf-8 vi:ts=4:noexpandtab # Simple RTSP server. Run as-is or with a command-line to replace the default pipeline import sys import gi gi.require_version('Gst', '1.0') from gi.repository import Gst, GstRtspServer, GObject loop = GObject.MainLoop() GObject.threads_init() Gst.init(Non...
Python
0.000002
20b3616c810e5f1c4891c5b877b924925c8b28a8
Add basic tests for redirect/callback/auth flow
tests/authorize_test.py
tests/authorize_test.py
import json import urlparse import pytest from oauthclientbridge import app, crypto, db @pytest.fixture def client(): app.config.update({ 'TESTING': True, 'SECRET_KEY': 's3cret', 'OAUTH_DATABASE': ':memory:', 'OAUTH_CLIENT_ID': 'client', 'OAUTH_CLIENT_SECRET': 's3cret', ...
Python
0
3e9fc3e3b4b5b870578d2c642d88a6ef14b340dd
max path 1: python
max_path_1/python/max_path_1.py
max_path_1/python/max_path_1.py
triangle = [ [75], [95, 64], [17, 47, 82], [18, 35, 87, 10], [20, 4, 82, 47, 65], [19, 1, 23, 75, 3, 34], [88, 2, 77, 73, 7, 63, 67], [99, 65, 4, 28, 6, 16, 70, 92], [41, 41, 26, 56, 83, 40, 80, 70, 33], [41, 48, 72, 33, 47, 32, 37, 16, 94, 29], [53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14],...
Python
0.999998
497f1c70d0ecedb904f5b71be494e01246d874f6
Add weight test
kansha/card_addons/weight/tests.py
kansha/card_addons/weight/tests.py
# -*- coding:utf-8 -*- #-- # Copyright (c) 2012-2014 Net-ng. # All rights reserved. # # This software is licensed under the BSD License, as described in # the file LICENSE.txt, which you should have received as part of # this distribution. #-- from kansha.cardextension.tests import CardExtensionTestCase from .comp im...
Python
0.000006
6aed81e89e321f45ba2ff95bfb0c78504c0bf79e
add setup_database script (tests) using scripts/import_osm.sh (in progress)
tests/setup_database.py
tests/setup_database.py
#!/usr/bin/env python import argparse import subprocess def main(): parser = argparse.ArgumentParser() parser.add_argument("-l", "--osm_url", required=True, help="OSM download URL (*.osm.bz2)", type=str) parser.add_argument("-p", "--user", required=True, help="PostgreSQL database password", type=str) ...
Python
0
783b04ad8da2b65d9a07a0bdd4f236273f9ad39d
Create test.py
ProjectMidway/test.py
ProjectMidway/test.py
Python
0.000005
7383343f7fb77c74455a50490ad2886fcf36bbd5
Comment test for the moment
dlstats/fetchers/test_ecb.py
dlstats/fetchers/test_ecb.py
import unittest import mongomock import ulstats from dlstats.fetchers._skeleton import (Skeleton, Category, Series, BulkSeries, Dataset, Provider) import datetime from bson import ObjectId #class CategoriesTestCase(unittest.TestCase): #if __name__ == '__main__': # unittest.ma...
Python
0
e446ab24ba981b22bf84ae2e09a8ba62cf17528e
Create batch_download.py
batch_download.py
batch_download.py
import time #used to pause script import os #library used to open magnet link from selenium import webdriver #use selenium #global variables driverLocation = "C:/Users/Kevin/Downloads/Browsers/chromedriver.exe" url = "http://horriblesubs.info/shows/shigatsu-wa-kimi-no-uso/" quality = "1080p" download_format = "Magnet"...
Python
0.000001
fa0886bdeab19cb326a3e751dff1c46fb7911228
Apply migration 1160 again
migrations/versions/1180_set_framework_datetimes_not_nullable_again.py
migrations/versions/1180_set_framework_datetimes_not_nullable_again.py
"""Remove deprecated application_close_date field and set the remaining date fields to non-nullable. Revision ID: 1180 Revises: 1170 Create Date: 2018-05-08 09:53:43.699711 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql from sqlalchemy.sql import table, column, and_ # r...
Python
0
413b035073fe6772dcfb28f491265dd5b7dd8aae
add unit test for webutils
supvisors/tests/test_webutils.py
supvisors/tests/test_webutils.py
#!/usr/bin/python #-*- coding: utf-8 -*- # ====================================================================== # Copyright 2016 Julien LE CLEACH # # 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 Lice...
Python
0
9167643047c61bae50a7c73775631c7bfe434cc9
Add a new wrapper class for managing ansible static inventory.
spam/ansiInventory.py
spam/ansiInventory.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ AnsibleInventory: INTRO: USAGE: """ import os import ansible.inventory class AnsibleInventory(object): ''' Ansible Inventory wrapper class. ''' def __init__(self, inventory_filename): ''' Initialize Inventory ''' if...
Python
0
761a0afb8576f8bcdf9c50e79f21e55bf0f2243c
Correct path to doxyxml (#182) and break long line
doc/build.py
doc/build.py
#!/usr/bin/env python # Build the documentation. from __future__ import print_function import os, shutil, tempfile from subprocess import check_call, CalledProcessError, Popen, PIPE def pip_install(package, commit=None): "Install package using pip." if commit: cmd = ['pip', 'show', package.split('/')[1]] ...
#!/usr/bin/env python # Build the documentation. from __future__ import print_function import os, shutil, tempfile from subprocess import check_call, CalledProcessError, Popen, PIPE def pip_install(package, commit=None): "Install package using pip." if commit: cmd = ['pip', 'show', package.split('/')[1]] ...
Python
0
77eecb7a809a7b4f56d70e6d7e09deb2c7e0188b
add template engine
template-engine/code/templite.py
template-engine/code/templite.py
#!/usr/bin/env python # coding: utf-8 class CodeBuilder(object): INDENT_STEP = 4 def __init__(self, indent=0): self.code = [] self.indent_level = indent def add_line(self, line): self.code.extend([" " * self.indent_level, line, "\n"]) def indent(self): self.indent_le...
Python
0
c8f504c52f9e981b3974f4be1581da890021473a
add new collector for cassandra cfstats
src/collectors/mmcassandra/mmcassandra.py
src/collectors/mmcassandra/mmcassandra.py
import subprocess, socket, math import diamond.collector def parse_line(line): metric_name, rhs = line.strip().split(':', 1) rhs = rhs.strip() if ' ' in rhs: str_value, units = rhs.split(' ', 1) if units not in ('ms', 'ms.'): raise ValueError("Cannot parse " + repr(line)) ...
Python
0
26f8d5cb563171725056a82ab21ab9bd6e354ade
Create NameThatTune.py
NameThatTune/NameThatTune.py
NameThatTune/NameThatTune.py
#!/usr/bin/python # -*- coding: iso-8859-1 -*- import Tkinter import time import os class simpleapp_tk(Tkinter.Tk): def __init__(self,parent): Tkinter.Tk.__init__(self,parent) self.parent = parent self.initialize() def initialize(self): self.HOME = os.path.expanduser("~") os.system("cd $HOME/.NTT || mk...
Python
0
ebd15d9bcf5a46417af7f3d46769716c4d12b793
rename pre_push hook
pre_push.py
pre_push.py
#!/usr/bin/env python import atexit import glob import os import re import subprocess import sys stable_branch_re = re.compile(r'master|stable|prod|production') def chain_cmds(cmds, stdin=None): for cmd in cmds: p = subprocess.Popen(cmd, stdin=stdin, stdout=subprocess.PIPE) stdin = p.stdout re...
Python
0.000001
a123b42eb3aed078aea26109056cf786aec2664a
add link_flair.py for interacting with link flair on submissions
bin/link_flair.py
bin/link_flair.py
import argparse import praw def main(): parser = argparse.ArgumentParser(description='Get or set link flair') parser.add_argument('action', choices=['get', 'set'], help='get or set') parser.add_argument('id', help='id of the submission') parser.add_argument('--text', help='link flair text to set') ...
Python
0
495e9680ae7c1b9c1071c9f840df7881f5d4934b
add a Spider to KFC#15
locations/spiders/kfc.py
locations/spiders/kfc.py
import json import re import scrapy from locations.items import GeojsonPointItem class KFCSpider(scrapy.Spider): name = "kfc" allowed_domains = ["www.kfc.com"] def start_requests(self): url = 'https://services.kfc.com/services/query/locations' headers = { 'Accept-Language': 'e...
Python
0.000004
a67a4e15ce25e9e9a795534b4e629d6680fb491b
Implement player choosing a random pawn to move
ludo/playermoverandom.py
ludo/playermoverandom.py
# Player from playerbase import PlayerBase, Players from random import randint class PlayerMoveRandom(PlayerBase): def get_desc(self): """"Return description string""""" return "Chooses a random pawn to move" def _choose_move_impl(self, moves): if not moves: return None ...
Python
0.000002
7c5187ddfeb205105932f4e6f873c1228491fbfa
Add Google reference API for YouTube - https://github.com/youtube/api-samples/blob/master/python/upload_video.py
podpublish/upload_video.py
podpublish/upload_video.py
#!/usr/bin/python import httplib import httplib2 import os import random import sys import time from apiclient.discovery import build from apiclient.errors import HttpError from apiclient.http import MediaFileUpload from oauth2client.client import flow_from_clientsecrets from oauth2client.file import Storage from oau...
Python
0.000066
298d4e6eaca54defe914530ebdee9ded255cfd79
add lxc integration tests
tests/integration/modules/lxc.py
tests/integration/modules/lxc.py
# -*- coding: utf-8 -*- ''' Test the lxc module ''' # Import Salt Testing libs from salttesting.helpers import ensure_in_syspath, requires_salt_modules ensure_in_syspath('../../') # Import salt libs import integration @requires_salt_modules('lxc.list') class LXCModuleTest(integration.ModuleCase): ''' Test ...
Python
0
c7e7430d76337ef5cfd6779d9a32c2c9d948eb86
Add guess phred encoding script
carbon/guess-encoding.py
carbon/guess-encoding.py
""" awk 'NR % 4 == 0' your.fastq | python %prog [options] guess the encoding of a stream of qual lines. """ import sys import optparse RANGES = { 'Sanger': (33, 93), 'Solexa': (59, 104), 'Illumina-1.3': (64, 104), 'Illumina-1.5': (67, 104) } def get_qual_range(qual_str): """ >>> get_qual_...
Python
0.000005
7dbec704e0e9011b87940b48d21ab343f4003a8b
Add performance testing script.
perftest.py
perftest.py
#! /usr/bin/env python import argparse import logging import logging.config import sys import time def main(argv=sys.argv): parser = argparse.ArgumentParser(prog="perftest.py") parser.add_argument('--graylog-host', help='Graylog2 host. Do not test GELFHandler if not specified.') parser.add_argument...
Python
0
06092ce552c78de4efdc5845d94146fd5cf6fd38
add plot tool
plot_csv.py
plot_csv.py
import pandas as pd import numpy as np import plotly.plotly as py import plotly.graph_objs as go import argparse clean_text = lambda s: "".join([c for c in s if c.isalpha() or c.isdigit() or c==' ']).rstrip() def make_hbar_plot(options_table, symbol, parameter): data = [ go.Bar( name=otype, ...
Python
0.000001
dbe71d02a95e65b644a1ac811712a31059975457
test update
tests/api/v1/test_jobs_update.py
tests/api/v1/test_jobs_update.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2016 Red Hat, 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 applicab...
Python
0.000002
cf83ba227dac6dd51201d13a11af0cf70012ac58
Add skeleton for JunebugBackend
casepro/backend/junebug.py
casepro/backend/junebug.py
from . import BaseBackend class JunebugBackend(BaseBackend): ''' Junebug instance as a backend. ''' def pull_contacts( self, org, modified_after, modified_before, progress_callback=None): """ Pulls contacts modified in the given time window :param org:...
Python
0.000001
fdada5e48a13ef5b1c55710a584d281d36a32375
Add stub for testing `generic_decorators`.
tests/test_generic_decorators.py
tests/test_generic_decorators.py
__author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>" __date__ = "$Mar 25, 2015 13:30:52 EDT$"
Python
0
adc7e20f4828bdc226e86e018a153740c30897c8
Move status to api
api/events/monitors/statuses.py
api/events/monitors/statuses.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import logging import os import time from kubernetes import watch from kubernetes.client.rest import ApiException from django.conf import settings from polyaxon_k8s.manager import K8SManager from polyaxon_k8s.constants import P...
Python
0.000001
61e0c6e325a91564250a937c0b1769992f65a7f5
Add initial unit tests for swarm module
tests/unit/modules/test_swarm.py
tests/unit/modules/test_swarm.py
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt Libs import salt.modules.swarm # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.mock import patch from tests.support.unit import Test...
Python
0
2e953f9571d132f2a346351b4593849e5c5bee14
Add unit tests for download_repo_run_scan.py
run_scan/unit_test.py
run_scan/unit_test.py
import unittest import download_repo_run_scan from os import path, remove import shutil #Test that when given a valid zip file url, #the download_github_zip will result in the creation #of a local file at the returned location class downloadFileTestCase(unittest.TestCase): file_location = '' url = 'https://github.co...
Python
0
a88959202e66d47f032797c2c5790461fe458392
add tests boilerplates
api/v1/tests/test_api_tokens.py
api/v1/tests/test_api_tokens.py
import unittest import json class TestAuthentication(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_validates_user_inputs(self): self.assertTrue(True) def test_user_can_register(self): self.assertTrue(True) def test_no_ducplicated_use...
Python
0.000001
16850052ced6975ab99c73c2c15497a3f91ccab9
Add reader back in again.. will use for blender
edm/reader.py
edm/reader.py
#!/usr/bin/env python3 import struct from collections import namedtuple from .typereader import get_type_reader import logging logger = logging.getLogger(__name__) class Reader(object): def __init__(self, filename): self.filename = filename self.stream = open(filename, "rb") def tell(self): return ...
Python
0
8022d7361affddde110a289bc683201ea70af5fe
add weight conversion script
examples/yolo/darknet2npz.py
examples/yolo/darknet2npz.py
import argparse import numpy as np import chainer from chainer import serializers from chainercv.links import Conv2DBNActiv from chainercv.links import YOLOv3 def load(file, link): if isinstance(link, Conv2DBNActiv): for param in ( link.bn.beta.array, link.bn.gamma.array,...
Python
0.000001
7bd4ecf4f0f16ed58f253ca16045c3dd86f0a28c
Test script.
runtests.py
runtests.py
# -*- coding: utf-8 -*- import os from django.conf import settings def make_absolute_path(path): return os.path.join(os.path.realpath(os.path.dirname(__file__)), path) if not settings.configured: settings.configure( DATABASES = { 'default': { 'ENGINE': 'django.db.backen...
Python
0
a4d5e88973a25464be26488d17ecc663cce776d7
Add map example with data generators
altair/examples/world_map.py
altair/examples/world_map.py
""" World Map --------- This example shows how to create a world map using data generators for different background layers. """ # category: maps import altair as alt from vega_datasets import data # Data generators for the background sphere = alt.sphere() graticule = alt.graticule() # Source of land data source = a...
Python
0
8cbe2878f5fdca899ec71bc08e7d2de4a3c3caf2
add python solution to "project euler - problem3"
problem3.py
problem3.py
number = 600851475143 for divisor in xrange(2,number): if (number % divisor == 0): print divisor, " is a divisor" number = number / divisor print "new number is", number
Python
0
f1976ef533d98ac6e423312435bb25692831bfd9
Create bumper.py
cmp3103m-code-fragments/scripts/bumper.py
cmp3103m-code-fragments/scripts/bumper.py
import rospy from geometry_msgs.msg import Twist from kobuki_msgs.msg import BumperEvent class Chatter: def __init__(self): rospy.init_node('chatter') self.publisher = rospy.Publisher('/mobile_base/commands/velocity', Twist, queue_size=1) self.scan_sub = rospy.Subscriber('/mobile_base/eve...
Python
0.000004
d571af56293912042846047c88e4a7b2c2f40df9
add archive command
alexBot/cogs/memework.py
alexBot/cogs/memework.py
# -*- coding: utf-8 -*- from ..tools import Cog from discord.ext import commands import discord from datetime import datetime class Memework(Cog): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.archive_cat = self.bot.get_channel(355886867285147648) self.rowboa...
Python
0
4b0656a2581df14bee4ae97da95f68360c24ee82
Create rrd_export.py
scripts/rrd_export.py
scripts/rrd_export.py
#------------------------------------------------------------------------------- # # The MIT License (MIT) # # Copyright (c) 2015 William De Freitas # # 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 ...
Python
0.000001
d3166947023283ae6aed9737703c852552cf17f8
Update app/extensions/allows/allows.py
app/extensions/allows/allows.py
app/extensions/allows/allows.py
from flask import current_app from flask import request from functools import wraps from werkzeug import LocalProxy from werkzeug.exceptions import Forbidden class Allows(object): def __init__(self, app=None, identity_loader=None, throws=Forbidden, on_fail=None): self._identity_loader = ...
Python
0
37dc854c8af69c679f91163355b2a4314d66820b
Add a marker interface
usingnamespace/api/interfaces.py
usingnamespace/api/interfaces.py
from zope.interface import Interface class ISerializer(Interface): """Marker Interface"""
Python
0
b4333af5737b1376452eb0490f4175a1554ba212
Fix #116
configure-aspen.py
configure-aspen.py
import os import gittip import gittip.wireup import gittip.authentication import gittip.csrf from gittip.networks import github gittip.wireup.canonical() gittip.wireup.db() gittip.wireup.billing() website.github_client_id = os.environ['GITHUB_CLIENT_ID'].decode('ASCII') website.github_client_secret = os.environ['G...
import os import gittip import gittip.wireup import gittip.authentication import gittip.csrf gittip.wireup.canonical() gittip.wireup.db() gittip.wireup.billing() website.github_client_id = os.environ['GITHUB_CLIENT_ID'].decode('ASCII') website.github_client_secret = os.environ['GITHUB_CLIENT_SECRET'].decode('ASCII...
Python
0.000001