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
f069a3feda43ebc436e404dad66dfaa06055e35a
Add h5sh python package (#14001)
var/spack/repos/builtin/packages/py-h5sh/package.py
var/spack/repos/builtin/packages/py-h5sh/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 PyH5sh(PythonPackage): """Shell-like environment for HDF5.""" homepage = "https://pyp...
Python
0
5d3a774587bef551553a731d4f9dcfeefdb70ed3
Add package for scalpel@0.5.3 (#5901)
var/spack/repos/builtin/packages/scalpel/package.py
var/spack/repos/builtin/packages/scalpel/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.000002
1f731dcbfcff76ba63e4aea4fc05a15dd5021daa
Test for overriding sys.stdout.
tests/io/sys_stdio_override.py
tests/io/sys_stdio_override.py
try: import uio as io except ImportError: try: import io except ImportError: print("SKIP") raise SystemExit import sys try: sys.stdout = sys.stdout except AttributeError: print("SKIP") raise SystemExit buf = io.StringIO() sys.stdout = buf print(1, "test", 10 + 20)
Python
0.000009
855d10b768fbfec7772f8e5df4c181d971fe0dd4
add tests.
tests/test_primesieve_array.py
tests/test_primesieve_array.py
from primesieve.array import n_primes, primes def assert_array_equal(have, want): assert list(have) == want def test_primes_array(): assert_array_equal(primes(10), [2,3,5,7]) assert_array_equal(primes(10, 20), [11,13,17,19]) def test_n_primes_array(): assert_array_equal(n_primes(7), [2,3,5,7,11,13,17...
Python
0
9de475e8007b209d005ed222686cb46bddef053d
Integrate LLVM at llvm/llvm-project@9e37b1e5a0c1
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "9e37b1e5a0c15f36c5642406d5aa02a657a0b19c" LLVM_SHA256 = "e2cca91a76ee6b44a6af91874e429af582b248b96ccd139373fec69ed0b0215f" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "ab85996e475ceddfda82255c314229ac0c0f4994" LLVM_SHA256 = "140b4198fa4f0ec1917a0e252feec5e19ccd9d7e96fc818c555b5551c796ec5b" tf_http_archive( ...
Python
0.000003
c6b0b5a8cef752481d5ec6672313ec8829d4299f
Create saving.py
Webpage/cgi-bin/saving.py
Webpage/cgi-bin/saving.py
#!/usr/bin/python3 import os import os.path import cgi, cgitb import re import pickle #own packages import dbcPattern def dbc_main(): # NEW except for the call to processInput form = cgi.FieldStorage() # standard cgi script lines to here! # use format of next two lines with YOUR names and default data...
Python
0.000001
8c6335c7ba7ebb34566603eb2943752fd3f524db
Add Exercise 9.13.
Kane1985/Chapter5/Ex9.13.py
Kane1985/Chapter5/Ex9.13.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Exercise 9.13 from Kane 1985.""" from __future__ import division from sympy import expand, symbols from sympy.physics.mechanics import ReferenceFrame, Point from sympy.physics.mechanics import dynamicsymbols from util import msprint, partial_velocities from util import ...
Python
0.000001
5a2f8967ac09b3aa1fc1cda21fd6dc5cf1d3f896
Add gesture recognition prototype
gesture_recognition/__init__.py
gesture_recognition/__init__.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pygame from pygame import camera from pygame.constants import QUIT, K_ESCAPE, KEYDOWN import numpy as np class Capture(object): def __init__(self): camera.init() self.size = (640, 480, ) # create a display surface. standard pygame stuf...
Python
0.000002
41ee54414845c3d8c1592048fe2f7cee57153eee
Add Python Numpy and Pandas cheatsheet
pythonCheatsheet.py
pythonCheatsheet.py
#!/usr/local/bin/python # Python Numpy and Pandas Cheatsheet
Python
0.000001
a813d79ccd63c9ff40afaf3fda4e2c8c0a37ee25
Add wsgi file
readthedocs/wsgi.py
readthedocs/wsgi.py
import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. from django.core.wsgi import get_wsgi_application application = get_wsgi_a...
Python
0.000001
3d0ac61fa03ab27c567155f989db0ceb2134c9e0
adding test_hello
test_hello.py
test_hello.py
print "Hello World"
Python
0.999096
f0e80e3ab82b5edae6ee4e71ecc243cb7c49a4a0
Revert "move to directory"
pathmark/medbookAdapterPATHMARK.py
pathmark/medbookAdapterPATHMARK.py
#!/usr/bin/env python """ medbookAdapterPATHMARK.py by Robert Baertsch """ import logging, math, os, random, re, shutil, sys, types, zipfile from copy import deepcopy from optparse import OptionParser ## logger logging.basicConfig(filename = "medbook-pathmark.log", level = logging.INFO) ## executables print "sta...
Python
0
7e9794dc98a268479f0f57128effc67f88586c8f
Add default message for list pages
bvspca/core/migrations/0025_auto_20180202_1214.py
bvspca/core/migrations/0025_auto_20180202_1214.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-02-02 19:14 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0024_contentindexpage_empty_message'), ] operations = [ migrations....
Python
0.000001
63db1dc6c23c4afd41bca5cf06207e383c982b51
structure of the commandprocessor
app/core/commandprocessor.py
app/core/commandprocessor.py
class CommandProcessor: def parseCommand(self): pass def constructUrl(self): pass def processCommand(self): pass
Python
0.000015
2c687118a9aa248d6e6f28259d8a81217ee9cb1d
add solution for Number of Digit One
algorithms/numberOfDigitOne/numberOfDigitOne.py
algorithms/numberOfDigitOne/numberOfDigitOne.py
class Solution: # @param {integer} n # @return {integer} def countDigitOne(self, n): res = prev = 0 x = 1 while n > 0: # n = 23[y]xxx y = n % 10 n /= 10 if y > 1: res += x # 23[2]xxx elif y == 1: res +...
Python
0.999957
67dfcd5abb73aff7fd416f665de0d8461ba3e8b4
Create Subset.py
Tests/Subset.py
Tests/Subset.py
__author__ = 'Marius Wirtz' from TM1py import TM1Queries, Subset import uuid import json import unittest class TestAnnotationMethods(unittest.TestCase): q = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True) random_string1 = str(uuid.uuid4()).replace('-', '_') random_string2 = str(uui...
Python
0.000001
93d6915c0e45d1873a48c298749d6956edbc337e
add remote ssh capability to fs-drift.py
ssh_thread.py
ssh_thread.py
#!/usr/bin/python # -*- coding: utf-8 -*- ''' ssh_thread.py -- manages parallel execution of shell commands on remote hosts Copyright 2012 -- Ben England Licensed under the Apache License at http://www.apache.org/licenses/LICENSE-2.0 See Appendix on this page for instructions pertaining to license. ''' import threadi...
Python
0.000001
88e05bd1fe0f2e46e740a3d8d631d4a810c155a6
Complete P8
Quiz/Problem8_satisfiesF.py
Quiz/Problem8_satisfiesF.py
def satisfiesF(L): """ Assumes L is a list of strings Assume function f is already defined for you and it maps a string to a Boolean Mutates L such that it contains all of the strings, s, originally in L such that f(s) returns True, and no other elements Returns the length of L after mut...
Python
0
820fe44762f0037eaacba9b7bf4129a29e25e799
add migration
accelerator/migrations/0036_add_user_deferrable_modal.py
accelerator/migrations/0036_add_user_deferrable_modal.py
# Generated by Django 2.2.10 on 2021-03-03 17:08 from django.conf import settings from django.db import ( migrations, models, ) import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('accelerato...
Python
0
a5cabf4b778d03cac472e22b0e62bc262796b5ff
Add tests for `cms.templatetags.pagination`.
cms/tests/test_templatetags_pagination.py
cms/tests/test_templatetags_pagination.py
from django.http import Http404 from django.test import RequestFactory, TestCase from ..templatetags.pagination import paginate, pagination, pagination_url class Object(object): paginator = None class PaginationTest(TestCase): def setUp(self): self.factory = RequestFactory() self.request =...
Python
0
aa218407a9efdde9daa53d638fdfdacff873f14b
test change
clients/python/flask-server/tests/client_tests.py
clients/python/flask-server/tests/client_tests.py
""" integration test in python !!!! NEED PYTHON 2.7.8 """ import unittest import urllib2 import urllib import thread import time import json from client import app from multiprocessing import Process class ServerHandlerTest(unittest.TestCase): server = Process(target=app.run) @classmethod def setUpClass(...
Python
0.000002
e2ed85ae1bb3f647095abb00b118cf06ae7549aa
add setup (even if not really needed)
0_Python/setup.py
0_Python/setup.py
#!/usr/bin/python from distutils.core import setup from Cython.Distutils import build_ext from distutils.extension import Extension cy_mod = Extension("inside_polygon", sources= ["inside_polygon.pyx"]) setup(ext_modules=[cy_mod], cmdclass={'build_ext': build_ext})
Python
0
cd1c88c519a7079b2cef752473e5da3ddb4224e3
Add stress package (#3695)
var/spack/repos/builtin/packages/stress/package.py
var/spack/repos/builtin/packages/stress/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
9ce90bc43cfcc5a56be958671f304e7929eb0446
Add missing migration step dua changes in model
cmsplugin_collapse/migrations/0002_auto_20160210_0651.py
cmsplugin_collapse/migrations/0002_auto_20160210_0651.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cmsplugin_collapse', '0001_initial'), ] operations = [ migrations.AlterField( model_name='accordionheader', ...
Python
0
b0ea743fa320f0df6e35b4381e6bd778906a5532
Add caching mechanism
labmanager/rlms/caches.py
labmanager/rlms/caches.py
import calendar from cachecontrol import CacheControl from cachecontrol.caches import FileCache from cachecontrol.heuristics import LastModified, TIME_FMT from email.utils import formatdate, parsedate, parsedate_tz class LastModifiedNoDate(LastModified): """ This takes the original LastModified implementation of...
Python
0.000001
b6ac6a73cf10372be3384dbeb99b82b137a9daa2
Use chevrons instead of arrows in sortable links
oscar/templatetags/sorting_tags.py
oscar/templatetags/sorting_tags.py
# This is a rewrite of django-sorting but with added support for i18n title # strings. # See https://github.com/directeur/django-sorting from django import template from django.conf import settings register = template.Library() DEFAULT_SORT_UP = getattr( settings, 'DEFAULT_SORT_UP', '<i class="icon-chevron-u...
# This is a rewrite of django-sorting but with added support for i18n title # strings. # See https://github.com/directeur/django-sorting from django import template from django.conf import settings register = template.Library() DEFAULT_SORT_UP = getattr(settings, 'DEFAULT_SORT_UP', '&uarr;') DEFAULT_SORT_DOWN = geta...
Python
0
38f28bd0e5d4ea5af69ac7ccc553403a85ac61be
add problem 053
problem_053.py
problem_053.py
#!/usr/bin/env python #-*-coding:utf-8-*- ''' There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 235, 245, and 345 In combinatorics, we use the notation, 5C3 = 10. In general, nCr = n! r!(n−r)! ,where r ≤ n, n! = n×(n−1)×...×3×2×1, and 0! = 1. It is not until n = 23, th...
Python
0.000383
ac2d5c10e7895515acd63e2ca91924e99ec17003
add (Failing) test
test/test_writing.py
test/test_writing.py
import RMF RMF.set_log_level("trace") path = RMF._get_temporary_file_path("writing.rmf") print path fh = RMF.create_rmf_file(path) fh.add_frame("frame", RMF.FRAME) fn = fh.get_root_node().add_child("frag", RMF.REPRESENTATION) pf = RMF.ParticleFactory(fh) ff = RMF.FragmentFactory(fh) pf.get(fn).set_radius(1.0) pf.get...
Python
0.000033
3c7b4f727f5f4a061e3e2d8bcabdc007175ab4db
Add cache structures from pycrest (as base work)
esipy/cache.py
esipy/cache.py
# -*- encoding: utf-8 -*- import hashlib import zlib import os try: import pickle except ImportError: # pragma: no cover import cPickle as pickle import logging logger = logging.getLogger("esipy.cache") class BaseCache(object): """ Base cache 'abstract' object that defined the cache...
Python
0
492d90e1197803f2dbce0b07417d12497c9031fe
Implement away-notify
txircd/modules/ircv3/awaynotify.py
txircd/modules/ircv3/awaynotify.py
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from zope.interface import implements class AwayNotify(ModuleData): implements(IPlugin, IModuleData) name = "AwayNotify" def actions(self): return [ ("usermetadataupdate", 10, self.sendAwayNotice), ("capa...
Python
0.999988
4d883c28053ff40802433d8ad8efe463e9c05638
add tiny migration management command
cyder/management/commands/tiny_migrate.py
cyder/management/commands/tiny_migrate.py
#!/usr/bin/env python from django.core.management.base import LabelCommand from django.core.exceptions import ValidationError from cyder.models import (Domain, TXT, AddressRecord, Nameserver, MX, CNAME, SOA, PTR, SRV, StaticInterface, View) import subprocess """ ' txt 'fqdn:s:ttl:timest...
Python
0.000001
8fc45acd2b0447988e6dd18cc6de75c4316d60e5
Create wally_test.py
run_tests/shaker_run/wally_test.py
run_tests/shaker_run/wally_test.py
import ConfigParser import base64 import json import urllib2 # Testrail API class APIClient: def __init__(self, base_url): self.user = '' self.password = '' if not base_url.endswith('/'): base_url += '/' self.__url = base_url + 'index.php?/api/v2/' def send_get(sel...
Python
0.000055
f230b3bbc4946527dd6776ad9e8cf60831da4256
cache module
brocade/cache.py
brocade/cache.py
# -*- coding: utf-8 -*- """ KVSキャッシュモジュール """ class BaseCache(object): """ ベースクラス """ def get(self, key, default = None): """ 値の取得 @param key: キー @param default: 取得できない場合のデフォルト値 @return: 取得した値 """ raise NotImplementedError() def set(self, key, value): """ 値の設定 @param key: キー @param value:...
Python
0.999508
a6ca9fdb71eacffe94fad476712650f82870bb2e
Add base code for choosing solver
pyoommf/sim.py
pyoommf/sim.py
import os from drivers.llg import LLG import oommfmif as o class Sim(object): def __init__(self, mesh, Ms, name=None): self.mesh = mesh self.Ms = Ms self.name = name self.gamma = 2.21e5 self.energies = [] self.N_Sims_Run = 0 # Want some kind of persistent '...
import os from drivers.llg import LLG import oommfmif as o class Sim(object): def __init__(self, mesh, Ms, name=None): self.mesh = mesh self.Ms = Ms self.name = name self.gamma = 2.21e5 self.energies = [] self.N_Sims_Run = 0 # Want some kind of persistent '...
Python
0.000001
cc78dc401b16ff189b86466e3c0cb4609a72af0d
add tester
batch/depute/test.py
batch/depute/test.py
#!/usr/bin/env python import os, sys, json split = False splitval = False if len(sys.argv) > 1: field = sys.argv[1] if len(sys.argv) > 2: split = True if len(sys.argv) > 3: splitval = int(sys.argv[3]) else: field = "all" values = {} def add_value(val): if split and ' / ' i...
Python
0.000001
b674a3e4de86728139e97bb02fa90a62a7700c31
add speech processing test
testing/miniBrain.py
testing/miniBrain.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import time from os.path import dirname, abspath sys.path.append(dirname(dirname(abspath(__file__)))) reload(sys) sys.setdefaultencoding('utf-8') from EmeraldAI.Pipelines.InputProcessing.ProcessInput import ProcessInput from EmeraldAI.Pipelines.ScopeAnalyzer.Analyze...
Python
0.000001
0942d6bcc1d15b16b4d3170a1574fc5218b2c53b
add python_tips.py
python_tips.py
python_tips.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import argparse import subprocess # print 尽量用函数,不用语句 print('Hello World') # do not use print 'Hello World' def subprocess_test(): # 执行子进程获得输出内容,尽量用 subprocess吧 text = os.popen('echo 123').read() print(text) # subprocess #...
Python
0.000419
842c796a223ee9cb78c69ccb59416a2afe0fcee0
Add tests for Permission class.
tests/permissions.py
tests/permissions.py
import unittest from permission import Permission, PERMISSION_DELIMITER class BasicPermissionTests(unittest.TestCase): def setUp(self): self.p1 = Permission("test{0}1{0}hello".format(PERMISSION_DELIMITER)) self.p2 = Permission("test{0}2{0}hello".format(PERMISSION_DELIMITER)) self.p3 = Per...
Python
0
dbd453155797829bc1acc472a8939f1dba15f37c
Add very basic tests
tests/spoke-tests.py
tests/spoke-tests.py
import spoke import unittest2 from datetime import datetime CUSTOMER_NAME = 'abc123' CUSTOMER_KEY = 'abc123' FAUX_ADDRESS = '123 Fake St' FAUX_CITY = 'Funkytown' FAUX_FIRST_NAME = 'Xavier' FAUX_LAST_NAME = 'Ample' FAUXN_NUMBER = '555 555 5555' FAUX_ZIP = '12345' FAUX_STATE = 'IL' class S...
Python
0
3bb78837f26e1a16ba5261cf14b0b76f55e67a1c
Add test cases for columns
tests/test_column.py
tests/test_column.py
import cygroonga as grn import os import shutil import tempfile def test_create_column(): work_dir = tempfile.mkdtemp() try: with grn.Groonga(): with grn.Context() as ctx: db_path = os.path.join(work_dir, "test.db") ctx.create_database(db_path) ...
Python
0.000003
cb7d205add1d6e114277e596b2023c755dd1ff19
add an example unit test
tests/test_docker.py
tests/test_docker.py
""" run with python setup.py install; pip install . ; nosetests -v --nocapture tests/docker/test_docker.py python setup.py install; pip install . ; nosetests -v --nocapture tests/docker/test_docker.py:Test_docker.test_001 nosetests -v --nocapture tests/cm_basic/test_var.py or nosetests -v tests/cm_basic/test_var.py...
Python
0
4e0476fa83d0832c328abf00b5167887a0af3fe6
Add tests for hashes
tests/test_hashes.py
tests/test_hashes.py
from webhooks.hashes import placebo_hash_function, basic_hash_function def test_placebo(): assert placebo_hash_function() == "" def test_basic(): hashes = set([basic_hash_function() for x in range(30)]) assert len(hashes) == 30
Python
0.000001
ef8ca51dbd9b93a801a4a87be3c04f2c56cdef5a
test for call to enqueue passing
tests/test_server.py
tests/test_server.py
import hashlib import json from unittest.mock import Mock from unittest.mock import ANY from queue_functions import do_work from server import handle_post from uploaders.s3 import get_url from uploaders.s3 import upload def test_post(): q = Mock() filename = 'afakefilename' files = {'file': [{'body': b'a...
Python
0
b73e125fdcb12649e79aa2e108dcc019d9fffeb0
add strtol test
tests/test_strtol.py
tests/test_strtol.py
import nose import angr import subprocess import logging l = logging.getLogger('angr.tests.strtol') import os test_location = str(os.path.dirname(os.path.realpath(__file__))) def test_strtol(): b = angr.Project(os.path.join(test_location, "../../binaries/tests/x86_64/strtol_test")) pg = b.factory.path_grou...
Python
0.000043
f5d2b17371dbd974820b9b8ab1fcdb11ad8fa646
Add in script to count duplicates.
backend/scripts/countdups.py
backend/scripts/countdups.py
#!/usr/bin/env python import rethinkdb as r conn = r.connect('localhost', 30815, db='materialscommons') rql = r.table('datafiles').filter(r.row['usesid'].match("^[0-9a-f]")).pluck('size') total_bytes = 0 total_files = 0 for doc in rql.run(conn): total_bytes = total_bytes + doc['size'] total_files = total_file...
Python
0
23b9274f2dca42df5c838bc6b437f0408799b4dc
add missing file
bambou/nurest_root_object.py
bambou/nurest_root_object.py
# -*- coding: utf-8 -*- # # Copyright (c) 2015, Alcatel-Lucent Inc # 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 # no...
Python
0.000003
8488e7c5245758e4651e6d723f93d52f3ff54d73
Add tool for submitting jobs to AreWeCompressedYet
tools/submit_awcy.py
tools/submit_awcy.py
#!/usr/bin/env python from __future__ import print_function import requests import argparse import os import subprocess import sys if 'DAALA_ROOT' not in os.environ: print("Please specify the DAALA_ROOT environment variable to use this tool.") sys.exit(1) keyfile = open('secret_key','r') key = keyfile.read(...
Python
0
0c145918d0f34bee1193eeaa0488eb369f0e843e
Use item_lookup_field for DELETE methods
eve/methods/delete.py
eve/methods/delete.py
# -*- coding: utf-8 -*- """ eve.methods.delete ~~~~~~~~~~~~~~~~~~ This module imlements the DELETE method. :copyright: (c) 2013 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ from flask import current_app as app, abort from eve.utils import config from eve.auth import requir...
# -*- coding: utf-8 -*- """ eve.methods.delete ~~~~~~~~~~~~~~~~~~ This module imlements the DELETE method. :copyright: (c) 2013 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ from flask import current_app as app, abort from eve.utils import config from eve.auth import requir...
Python
0
837089f9195af984597522fffc8c2c6a02e73097
Create config.example.py
scripts/eurotram/config.example.py
scripts/eurotram/config.example.py
dbname='gis' user='trolleway' host='localhost' password='admin' ngw_url='http://trolleway.nextgis.com' ngw_resource_id= ngw_login = 'administrator' ngw_password = 'admin'
Python
0.000003
4d30756e722cafa40fa449e48c967eeebc58500a
Add a manage.py command to import realm filters
zerver/management/commands/import_realm_filters.py
zerver/management/commands/import_realm_filters.py
from __future__ import absolute_import from django.core.management.base import BaseCommand from zerver.models import RealmFilter, get_realm import logging class Command(BaseCommand): help = """Imports realm filters to database""" def handle(self, *args, **options): realm_filters = { "zu...
Python
0
c7fa4500b22104b34b50bbcacc3b64923d6da294
Add a parser for plain text
trex/parsers.py
trex/parsers.py
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from io import TextIOWrapper from rest_framework.parsers import BaseParser class PlainTextParser(BaseParser): media_type = "text/plain" def parse(self, stream, media_...
Python
0.000945
72d7e2a37bec5f7ae904ed2119dd8c30c22801fb
Add clinvar bot users
gennotes_server/migrations/0002_add_clinvar_bot_users.py
gennotes_server/migrations/0002_add_clinvar_bot_users.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.auth import get_user_model from django.db import migrations def add_clinvar_bot_users(apps, schema_editor): usernames = ['clinvar-variant-importer', 'clinvar-data-importer'] for username in usernames: get_user_model()...
Python
0
9eb52487a23ae7cd970e26ef7c4ad49d542b7524
Add command for removing Wine versions from installers. With hard-coded Wine versions as per Tannis' request.
games/management/commands/remove_wine_versions.py
games/management/commands/remove_wine_versions.py
"""Removes specified Wine versions from all installers.""" import logging from django.core.management.base import BaseCommand from django.db.models import Q from common.util import load_yaml, dump_yaml from games.models import Installer LOGGER = logging.getLogger(__name__) VERSIONS_TO_KEEP = ( 'tkg-mwo-4.1-x86_...
Python
0
d56515878d4a1d4d56a10426fe5d6c45de97a671
Create servos.py
gadgets/motors/servos.py
gadgets/motors/servos.py
from gadgets.th_gpio import TH_GPIO import time class Servo5V(): def __init__(self,pin_number=12,freq=100): self.pin_number = pin_number self.freq = freq self.pwm = TH_GPIO().pwm_create(self.pin_number,freq=self.freq) self.width = float(1000/self.freq) def set_freq(self,freq): self.freq = freq self.p...
Python
0.000022
0a074f3af770f049cf6f112bdc7fa5ae35c4a6dc
Create Run.py
ImageNet/Run.py
ImageNet/Run.py
# From https://groups.google.com/a/tensorflow.org/forum/#!topic/discuss/4xjc7tSrb18 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os, math, time import cv2, csv import numpy as np import tensorflow as tf import CIFAR10 from datetime import da...
Python
0.000001
99f2130476064062c3dd6338163010df53d60594
Bootstrap output
output.py
output.py
import colour import csv import json # export as json, csv, textfile or output to console def write_data(data, format=None): pass
Python
0.999999
4fb80eede37a2af23c165cb0997989c039f8166e
Add utterance extraction script
utterances.py
utterances.py
####################################### ## SPADE utterance extraction script ## ####################################### ## Processes and extracts start-times and end-times for all speaker utterances. ## Used for extracting data collected as part of the SPeech Across Dialects of English ## (SPADE) project. ## Input: #...
Python
0.000724
b453943f86f97e38e52af3a1b048ee93b0177df8
add a test to make sure we don't have any more missing migrations
axes/tests/test_models.py
axes/tests/test_models.py
from django.test import TestCase class MigrationsCheck(TestCase): def setUp(self): from django.utils import translation self.saved_locale = translation.get_language() translation.deactivate_all() def tearDown(self): if self.saved_locale is not None: from django.uti...
Python
0
1e7aee8c5597a7ccd9f2bc8f4e05e3ae489c3bfd
Add bot.py to run as an actual bot, via pywikibot
src/bot.py
src/bot.py
from app import * from time import sleep import pywikibot def run_bot(template_param, access_token=None, site=None, max_edits=100000): cached_pages = list_cache_contents('bot_cache/') edits_made = 0 for page_name in cached_pages: print(page_name) cache_fname = 'bot_cache/'+to_cache_name(pag...
Python
0
eb517e5b323ea183571b9d4967f46821729dd3e7
add part 6
part_6.py
part_6.py
# Let's try to draw a point moving on a line # To make things simple, we are going back to 1D pos = 1 velo = 1 # Since there are multiple positions at a time, we can represent as a list line_1 = [' ', ' ', ' '] line_2 = 3*[' '] # Note how they are equal statements print(line_1, line_2) # If we wanted to print the l...
Python
0.000012
7f714b662908e60bd78eef8d5a1729da5ededbe6
include gpx.py, which is the start of a new GPX module that fits better than gpxparser.py
vector/gpx.py
vector/gpx.py
""" GPX IO and manipulation (UNDER DEVELOPMENT) This is a rewrite of gpxparser.py, designed to fit better with guppy types. """ import sys from xml.dom import minidom, Node from xml.etree.ElementTree import ElementTree, Element import collections Point = collections.namedtuple("Point", ["vertex", "data", "properties...
Python
0.000001
98a6fd1b1d095d6babc55c5d415c2450743fdba6
Add antibody audits
src/encoded/audit/antibody_lot.py
src/encoded/audit/antibody_lot.py
from snovault import ( AuditFailure, audit_checker, ) from .conditions import rfa @audit_checker('antibody_lot', frame=['characterizations'], condition=rfa('ENCODE3', 'modERN')) def audit_antibody_missing_characterizations(value, system): ''' Check to see what characterizations are lack...
Python
0
e8560c42e3ae73f1753073b8ad6aef7d564e6d65
Implement basic active monitoring algorithm
Host/original.py
Host/original.py
import sys from functools import reduce tempVmId = -1 def enhancedActiveVMLoadBalancer(vmStateList, currentAllocationCounts): ''' vmStateList: Dict<vmId, vmState> currentAllocationCounts: Dict<vmId, currentActiveAllocationCount> ''' global tempVmId vmId = -1 tot...
Python
0.000018
0a5e419dd91317d3a9d755cc5e8ee32c3a68d4af
Fix dates in show pending notifications
src/ggrc/notification/__init__.py
src/ggrc/notification/__init__.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: mouli@meics.org # Maintained By: miha@reciprocitylabs.com from collections import defaultdict from freezegun import freeze_time from datetime impo...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: mouli@meics.org # Maintained By: miha@reciprocitylabs.com from collections import defaultdict from freezegun import freeze_time from datetime impo...
Python
0
b7e09bb39aa6161215799960bd5fda33a882e40f
fix docstring
01_basics/03_advanced_expressions/01_basic_indexing_soln.py
01_basics/03_advanced_expressions/01_basic_indexing_soln.py
# Fill in the TODOs in this exercise, then run the script to see if your # solution works. import numpy as np import theano.tensor as T def increment_odd(x): """ x: a Theano vector Returns: y: a Theano vector equal to x, but with all odd-numbered elements incremented by 1. """ raise NotImp...
Python
0.000018
787b46749a26f8078c1ac4e914aea7fbd0ced8c6
Add test for checking if privatecode in journey's is unique per day
bin/test.py
bin/test.py
import helper import logging import psycopg2 from settings.const import database_connect conn = psycopg2.connect(database_connect) cur = conn.cursor() cur.execute(""" SELECT j.id,jp.operator_id,j.operator_id FROM (select journeypatternref,count(distinct pointorder) as points from pointinjourneypattern group by journey...
Python
0
3693b1aea769af1e0fbe31007a00f3e33bcec622
Add function to solve two pair sum
aids/sorting_and_searching/pair_sum.py
aids/sorting_and_searching/pair_sum.py
''' Given an integer array, output all pairs that sum up to a specific value k ''' from binary_search import binary_search_iterative def pair_sum_sorting(arr, k): ''' Using sorting - O(n logn) ''' number_of_items = len(arr) if number_of_items < 2: return arr.sort() for index, item in enumerate(arr): ind...
Python
0.002605
72cfd9b52e860aaaca05e7ef7941d0b4e17ad95f
Add vocab_word.py
vocab_word.py
vocab_word.py
import cv2 import numpy as np from os import listdir from os.path import isfile, join from numpy import * from scipy.cluster.vq import kmeans,vq def buildVocabulary(path,k,grid_m,grid_n): files = [ f for f in listdir(path) if isfile(join(path,f)) ] dict_vocab = array([]) for i in range(0,grid_m): ...
Python
0.998753
9a67d63650b751c7b876f248bb3d82e619b37725
Add new script to create a list of words from frequencies
frequenciesToWords.py
frequenciesToWords.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Spell corrector - http://www.chiodini.org/ # Copyright © 2015 Luca Chiodini <luca@chiodini.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Fou...
Python
0
875fd0f57b1cbead04bd60b7d8c19cd1f106595a
add example python server
Server/server.py
Server/server.py
#!/usr/bin/env python import tornado.ioloop import tornado.web import tornado.websocket from tornado.options import define, options, parse_command_line import os import json import uuid define("port", default=8888, help="run on the given port", type=int) clients = set() metadatas = dict() class DiscoveryCl...
Python
0
4535d6c41e17031b943e7016fc7de6f76b890f17
Put the test into the correct directory.
test/lib/test_inputsource.py
test/lib/test_inputsource.py
######################################################################## # test/xslt/test_inputsource.py import os from amara.lib import inputsource, iri, treecompare module_dir = os.path.dirname(os.path.abspath(__file__)) rlimit_nofile = 300 try: import resource except ImportError: pass else: rlimit_nof...
Python
0.999992
5bbb2a994397374356964b1db4c23b6b8ff5c848
Add the 'version' variable.
TODO/__init__.py
TODO/__init__.py
# The MIT License # # Copyright (c) 2016 Jeremie DECOCK (http://www.jdhp.org) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # ...
Python
0.001248
fcd96cb766f3211a185a3aadbd7c8dde795134ca
Add ILCommand class
il_commands.py
il_commands.py
"""Classes representing IL commands, including procedures to generate asm code from a given IL command. """ import spots class ILCommand: """Base interface for all IL commands""" def __init__(self): raise NotImplementedError def input_values(self): """Return set of values read by this co...
Python
0
f51bccaebdf0992a708ac96d329b3218df23c3d0
Create welcome.py
welcome.py
welcome.py
# coding=utf-8 import sys reload(sys) sys.setdefaultencoding('utf8') sys.path.append('pyBot/ext_libs') import re import ast import json import time import login import datetime import requests from urllib2 import urlopen from random import randrange from sseclient import SSEClient as EventSource minutes = 33 signUrl ...
Python
0
0cf909cce9ba47f34297e87ae800f49b7ea4e18a
Correct ci failed tests
homeassistant/components/thermostat/radiotherm.py
homeassistant/components/thermostat/radiotherm.py
""" homeassistant.components.thermostat.radiotherm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adds support for Radio Thermostat wifi-enabled home thermostats """ import logging from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, STATE_IDLE, STAT...
""" homeassistant.components.thermostat.radiotherm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adds support for Radio Thermostat wifi-enabled home thermostats """ import logging from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, STATE_IDLE, STAT...
Python
0.000001
732898dc4858ae5cfc7eac3e470069ac702f6c12
Add a command for deactivating a generation
mapit/management/commands/mapit_generation_deactivate.py
mapit/management/commands/mapit_generation_deactivate.py
# This script deactivates a particular generation from optparse import make_option from django.core.management.base import BaseCommand from mapit.models import Generation class Command(BaseCommand): help = 'Deactivate a generation' args = '<GENERATION-ID>' option_list = BaseCommand.option_list + ( ...
Python
0.000004
ffdf48c758877dd869f4fb4ce598635ff6545d5d
add script for just building the *.zip
mac/scripts/build-temp.py
mac/scripts/build-temp.py
#!/usr/bin/env python import sys import os import os.path import re import time import subprocess import stat import shutil """ Release build script designed to automate as much of the proces as possible and minimize errors. Pushing an update to mac client is involved. Files that must be changed: * Info.plist * co...
Python
0
f04d683d44507a53be39a2db54d545d2f2a1361b
Add example settings module
settings_example.py
settings_example.py
import os import re from imap import EmailCheckError, EmailServer from postgresql import DatabaseServer CSV_FOLDER = os.getcwd() # Restrict emails by sender. EMAIL_FROM = 'sender@example.com' # Restrict emails by subject. EMAIL_SUBJECT_RE = re.compile(''.join([ r'(?P<year>\d{4})', r'(?P<month>\d{2})', r'(?P<day...
Python
0
29c20a662f347e720c5228f0853eaa6ac0164379
Create ScreenSocket.py
ScreenSocket.py
ScreenSocket.py
#!/usr/bin/env python ##--Zachary Trette ##-- accepts commands for screen responses ##-- EV3- Remote - https://github.com/flyinactor91/EV3-Remote ## 2013-12-1 from socket import * import sys, os import pygame from pygame.locals import * def setup(): pygame.init() w = 640 h = 480 size=(w,h) scree...
Python
0.000001
1d02b3cf6e7656c4e93159c38a97db30522438ad
Add project selection tests
tests/test_select_project.py
tests/test_select_project.py
from unittest import TestCase from unittest.mock import MagicMock, patch from sys import modules from json import loads package_jsons_data = [""" { "name": "first-project", "nativescript": { } } ...
Python
0
d79ed2b4aa8315579688f4c6e9bfc8980e9717e3
Create chghost.py
merc/features/ircv32/chghost.py
merc/features/ircv32/chghost.py
from merc import capability from merc import feature from merc import message class ChgHostFeature(feature.Feature): NAME = __name__ install = ChgHostFeature.install @ChgHostFeature.register_user_capability class ChgHostCapability(capability.Capability): NAME = "chghost" class _ChgHost(message.Command): d...
Python
0.000003
f11f5cf946c61f45d5059ecdd828018cf0bb7a55
Add pygments based lexical output processing
cloudmonkey/lexer.py
cloudmonkey/lexer.py
# -*- coding: utf-8 -*- # 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 # "...
Python
0.000001
e5055344001b8fa313ff7bcde3284d90bb6c2d62
add preprocess program
compress.py
compress.py
#!/usr/bin/env python3 ############################################################################### # Copyright (c) 2015 Jamis Hoo # Distributed under the MIT license # (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT) # # Project: # Filename: compress.py # Version: 1.0 ...
Python
0.000001
850f50dd2ec69db25d6ed19db49e35e0a2d8248b
Add basic script to do RJ-NEQ with complex
examples/neq-switching/run_equilibrium_setup.py
examples/neq-switching/run_equilibrium_setup.py
import numpy as np import os import tqdm from openeye import oechem, oeiupac from openmmtools import integrators, states, mcmc, constants from openmoltools import forcefield_generators from perses.rjmc.topology_proposal import TopologyProposal, SystemGenerator from perses.rjmc.geometry import FFAllAngleGeometryEngine f...
Python
0
d4a7cdd400fe29458cc584455c7b082efed99e2b
Add files via upload
timedscripts/rollupwinlog.py
timedscripts/rollupwinlog.py
import requests import json import pandas as pd import sqlite3 from datetime import date from datetime import datetime from dateutil import parser import time SERVER = '10.24.25.130:8000' conn = sqlite3.connect('usersrollup.db') c = conn.cursor() def makedb(): c.execute('''Create Table users (username ...
Python
0
98fbfe6e65c4cb32ea0f4f6ce6cba77f7fadcb7b
Add test for vendor object creation
app/api/tests/test_vendor_api.py
app/api/tests/test_vendor_api.py
from django.test import Client, TestCase from .utils import obtain_api_key, create_admin_account class VendorApiTest(TestCase): """Test for Vendor API.""" def setUp(self): self.client = Client() self.endpoint = '/api' self.admin_test_credentials = ('admin', 'admin@taverna.com', 'qwer...
Python
0
2cd2d7a20f2d19221b40aac9bfa1303dbfd97459
create metashare.wsgi
metashare/apache/metashare.wsgi
metashare/apache/metashare.wsgi
import os import sys path = '/var/www/CEF-ELRC' if path not in sys.path: sys.path.insert(0, path) sys.path.insert(0, '{0}/metashare'.format(path)) sys.path.append('{0}/lib/python2.7/site-packages'.format(path)) os.environ['DJANGO_SETTINGS_MODULE'] = 'metashare.settings' import django.core.handlers.wsgi application =...
Python
0
123959bc3594299c2f1d4c54b11a996e92147347
Add missing migration
system_maintenance/migrations/0002_auto_20181214_2122.py
system_maintenance/migrations/0002_auto_20181214_2122.py
# Generated by Django 2.1.4 on 2018-12-14 21:22 from django.db import migrations import markupfield_helpers.helpers class Migration(migrations.Migration): dependencies = [ ('system_maintenance', '0001_initial'), ] operations = [ migrations.AlterField( model_name='documentati...
Python
0.0002
71b97c202373ee127d57bcdb53ef3f6f4e8d7d57
Revert "Revert "Added a wrapper script for buildOnServer that merges certain files""
busytown/doAllTheBuild.py
busytown/doAllTheBuild.py
#!/usr/bin/python import os,sys,json # SAMPLE USE CASE: python doAllTheBuild.py --no-daemon -PuseMaxDepVersions # # Runs both gradle builds, then merges the output that needs merging # Arguments to this script are passed to both gradle builds without modification # Exceptions to this policy: # if DIST_DIR=path/to/di...
Python
0.000002
b080ae154cc8e948e3f4e7b79bfbde0221a31e61
Add devices detected by ping as SOURCE_TYPE_ROUTER instead of GPS (#5625)
homeassistant/components/device_tracker/ping.py
homeassistant/components/device_tracker/ping.py
""" Tracks devices by sending a ICMP ping. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.ping/ device_tracker: - platform: ping count: 2 hosts: host_one: pc.local host_two: 192.168.2.25 """ import logging import sub...
""" Tracks devices by sending a ICMP ping. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.ping/ device_tracker: - platform: ping count: 2 hosts: host_one: pc.local host_two: 192.168.2.25 """ import logging import sub...
Python
0
cebaba60bf12b00ce267fb84cb3029eb318041c2
Flask hello world
synthia.py
synthia.py
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, world.'
Python
0.999432
7c33e8c7a386e911d835f81e637515d40dfc4e62
Add a Laplace equation solving benchmark (from Numpy)
benchmarks/bench_laplace.py
benchmarks/bench_laplace.py
""" Benchmark Laplace equation solving. From the Numpy benchmark suite, original code at https://github.com/yarikoptic/numpy-vbench/commit/a192bfd43043d413cc5d27526a9b28ad343b2499 """ import numpy as np from numba import jit dx = 0.1 dy = 0.1 dx2 = (dx * dx) dy2 = (dy * dy) @jit(nopython=True) def laplace(N, Nite...
Python
0.000031
9a3c5517446a2f26875925b1c42607ea6aa31b29
Implementing the first step of the Web App Flow.
getAuthenticationCode.py
getAuthenticationCode.py
#!/usr/bin/env python #--------------------------------------------------------------------------- # Copyright 2013 Kitware 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:/...
Python
0.998887
8956ee3bd89b12da20ebb1946d41c4133467ae79
Add py-pure-eval (#19180)
var/spack/repos/builtin/packages/py-pure-eval/package.py
var/spack/repos/builtin/packages/py-pure-eval/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 PyPureEval(PythonPackage): """This is a Python package that lets you safely evaluate certa...
Python
0.000002
6d1eda812d57c6c251fb037b005103172de886af
Update __init__.py
erpnext/__init__.py
erpnext/__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import frappe __version__ = '7.0.63' def get_default_company(user=None): '''Get default company for user''' from frappe.defaults import get_user_default_as_list if not user: user = frappe.session.user companies = get_user_default_as_list(user, 'c...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import frappe __version__ = '7.1.0-beta' def get_default_company(user=None): '''Get default company for user''' from frappe.defaults import get_user_default_as_list if not user: user = frappe.session.user companies = get_user_default_as_list(user...
Python
0.000072
f0bd64992b05b0e7edd4b1ac6e99e1cd9db213d6
Create search.py
search.py
search.py
Python
0.000001
c74a9943bbd9e7908ba884e0fea5b3390e8d668e
add migration
wastd/observations/migrations/0004_auto_20160905_1943.py
wastd/observations/migrations/0004_auto_20160905_1943.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2016-09-05 11:43 from __future__ import unicode_literals from django.db import migrations, models import wastd.observations.models class Migration(migrations.Migration): dependencies = [ ('observations', '0003_auto_20160902_1206'), ] operat...
Python
0.000001
9115628cf10e194f1975e01142d8ae08ab5c4b06
Add test for pandas dataframe loading
joommf/test_odtreader.py
joommf/test_odtreader.py
def test_odtreader_dynamics_example(): from joommf.sim import Sim from joommf.mesh import Mesh from joommf.energies.exchange import Exchange from joommf.energies.demag import Demag from joommf.energies.zeeman import FixedZeeman from joommf.drivers import evolver # Mesh specification. lx ...
Python
0.000001
64d8f45e1868fd73415e8f1fe6acc21868d45fa7
Add rfreceiver mode selector
catkin/src/appctl/scripts/rfreceiver_mode_select.py
catkin/src/appctl/scripts/rfreceiver_mode_select.py
#!/usr/bin/env python """ This node listens for keyfob button presses and changes the mode accordingly. """ import rospy from appctl.msg import Mode from std_msgs.msg import Byte class ButtonHandler: def __init__(self, modes, mode_pub): self.modes = modes self.mode_pub = mode_pub def handle...
Python
0
9e58f5507ba0a128c696bdec218d244df27feb87
add list_graspability script
jsk_arc2017_common/scripts/list_graspability.py
jsk_arc2017_common/scripts/list_graspability.py
#!/usr/bin/env python import jsk_arc2017_common graspability = jsk_arc2017_common.get_object_graspability() for obj_id, obj in enumerate(graspability): print('{:02}: {}'.format(obj_id+1, obj)) for style in graspability[obj]: print(' {}: {}'.format(style, graspability[obj][style]))
Python
0.000001