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
2b9df0394285f601c80de2b6e7c5c39006caa3ed
add deployment script for OMS PDS, see ./doc/INSTALL.rst for more details on the deployment
fabfile.py
fabfile.py
''' Install PDS ----------- details at oms-deploy! https://github.com/IDCubed/oms-deploy ''' from oms_fabric.webapp import Webapp PDS = Webapp() PDS.repo_url = 'https://github.com/IDCubed/OMS-PDS' PDS.repo_name = 'OMS-PDS' def deploy_project(instance='pds', branch='master', con...
Python
0
5f6a76180a43ffa1d4fda905e7d4cd856111da79
Add Product selenium unit test
tests/product_selenium_unittest.py
tests/product_selenium_unittest.py
from selenium import webdriver from selenium.webdriver.support.ui import Select import unittest import re import sys import os class ProductTest(unittest.TestCase): def setUp(self): # Initialize the driver self.driver = webdriver.Chrome('chromedriver') # Allow a little time for the driver ...
Python
0
1214755d5023331a432a2cea3224a6d117622393
Create odrive.py
odrive.py
odrive.py
#!/usr/bin/env python import glob import os import re ''' # tool for MoMA O drive migration # will create "artist level" folders and move object level folders inside Pseudo code 1. crawl folders 2 levels deep 2. for folder: if folder matches *---*---*---* pattern: a. if artist level folder already exists aa....
Python
0.000002
10bd939290f4a9195ff582addb17beed5ba08f67
Add some examples of situations the leak detector detects.
examples.py
examples.py
""" Some examples of what nose leak detector can detect. """ try: from unittest import mock except ImportError: from mock import mock new_global_mock = None def test_with_leaked_new_global_mock(): global new_global_mock new_global_mock = mock.Mock() called_global_mock = mock.Mock() def test_with...
Python
0
cc6322683b0f98f666f0bef130fab4e7c45e07a6
Add auxiliary python file
la/oblas/data/auxiliary.py
la/oblas/data/auxiliary.py
# Copyright 2016 The Gosl Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. def vprint(name, v): l = '%s := []float64{' % name for i in range(len(v)): if i > 0: l += ',' l += '%23.15e' % v[i] l += '}' prin...
Python
0.000001
e39ffc74a2386d58d62e1302ea0b0f2e8550cf84
Create genetic algorithm engine: genetic.py
genetic.py
genetic.py
import random import statistics import sys import time def _generate_parent(length, geneSet, get_fitness): genes = [] while len(genes) < length: sampleSize = min(length - len(genes), len(geneSet)) genes.extend(random.sample(geneSet, sampleSize)) genes = ''.join(genes) fitness = get_fi...
Python
0.999995
8588624502c88b89426619640acee0077332906d
Create getImgs.py
getImgs.py
getImgs.py
#在猫扑网上爬取一些好看的~图片 #-*-coding:utf-8-*- import urllib2, re, urllib from bs4 import BeautifulSoup def getHtml(url): header = {'User-Agent':'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0'} request = urllib2.Request(url, headers=header) response = urllib2.urlopen(request) html ...
Python
0
a6eab0de0a7b681d13462528edd0fec212452341
Create pset1.py
pset1.py
pset1.py
# PROBLEM 1 : Counting Vowels count=0 for char in s: if char=='a' or char=='e' or char=='i' or char=='o' or char=='u': count+=1 print count # PROBLEM 2 : Counting Bobs count=0 for i in range(0,len(s)-2): if s[i]=='b' and s[i+1]=='o' and s[i+2]=='b': count+=1 print count # PROBLEM 3 : Count...
Python
0.000001
7107149104424959f989b9bfaef48dd09391d7cc
Add lc0819_most_common_word.py
lc0819_most_common_word.py
lc0819_most_common_word.py
"""Leetcode 819. Most Common Word Easy URL: https://leetcode.com/problems/most-common-word/ Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at least one word that isn't banned, and that the answer is unique. Words in the l...
Python
0.013247
35331ade3a1cdd86bfb437a335cd5487cf5c7a7a
package creation for Debian
create_package_debian.py
create_package_debian.py
#!/usr/bin/env python # # Create package for Debian (Linux) with appropriate version number. # # Author: Julien Cohen-Adad, Benjamin De Leener # import os import sys from numpy import loadtxt sys.path.append('./scripts') import sct_utils as sct # get version version = str(loadtxt("version.txt", comments="#", delimite...
Python
0.000001
034aaea2e8e56d24d709669f9992b0806b638621
create a new python file test_cut_milestone.py
test/unit_test/test_cut_milestone2.py
test/unit_test/test_cut_milestone2.py
from lexos.processors.prepare.cutter import cut_by_milestone class TestMileStone: def test_milestone_regular(self): text_content = "The bobcat slept all day.." milestone = "bobcat" assert cut_by_milestone(text_content, milestone) == ["The ", ...
Python
0.000011
6b9a0fe7181a3d80a4a88d32e895dda51923a96b
fix bug 984562 - track b2g 1.3 builds
alembic/versions/224f0fda6ecb_bug_984562-track-b2g-1_3.py
alembic/versions/224f0fda6ecb_bug_984562-track-b2g-1_3.py
"""bug 984562 - track b2g 1.3 Revision ID: 224f0fda6ecb Revises: 4c279bec76d8 Create Date: 2014-03-28 10:54:59.521434 """ # revision identifiers, used by Alembic. revision = '224f0fda6ecb' down_revision = '4c279bec76d8' from alembic import op from socorro.lib import citexttype, jsontype, buildtype from socorro.lib....
Python
0
e0786c5798b35b911193de1b4e3694b7ad8cad76
Add unit test for generate_admin_metadata helper function
tests/test_generate_admin_metadata.py
tests/test_generate_admin_metadata.py
"""Test the generate_admin_metadata helper function.""" def test_generate_admin_metadata(): import dtoolcore from dtoolcore import generate_admin_metadata admin_metadata = generate_admin_metadata("ds-name", "creator-name") assert len(admin_metadata["uuid"]) == 36 assert admin_metadata["dtoolcore_ve...
Python
0.000001
1db200b51d05e799b1016cdf1ed04726a3377635
Add basic structure of rules.
rules.py
rules.py
# -*- coding: utf-8 -*- class RuleDoesNotExistError(Exception): def __init__(self, rulename): self.value = rulename def __str__(self): return 'rule "{0}" is not implemented'.format(self.value) def __unicode__(self): return str(self).decode('utf-8') class RuleSet(object)...
Python
0.000002
724dc6ff77e9494e9519cb507cf43644034d5ca6
Integrate switch 10 and introduce couplings.
run_2.py
run_2.py
#!/usr/bin/python3 # # start pytrain # import os import sys MYDIR = os.path.dirname(sys.argv[0]) os.system(MYDIR+"/run.sh") if len(sys.argv)==1: sys.argv.append("10.0.0.6") os.system("chromium http://%s:8000/index.html"%(sys.argv[1]))
Python
0
73cb99538aa48e43cfc3b2833ecf0ececee1dc42
Add timers example
timers.py
timers.py
import asyncio @asyncio.coroutine def coro(loop): yield from asyncio.sleep(0.5, loop=loop) print("Called coro") loop = asyncio.get_event_loop() def cb(arg): print("Called", arg) loop.create_task(coro(loop)) loop.call_soon(cb, 1) loop.call_later(0.4, cb, 2) loop.call_at(loop.time() + 0.6, cb, 3) loop...
Python
0.000001
17af81742f5bf6473155837c655506f4509a4273
Add buildlet/__init__.py
buildlet/__init__.py
buildlet/__init__.py
# [[[cog import cog; cog.outl('"""\n%s\n"""' % file('../README.rst').read())]]] """ Buildlet - build tool like functionality as a Python module =========================================================== """ # [[[end]]] __author__ = "Takafumi Arakaki" __version__ = "0.0.1.dev0" __license__ = 'BSD License'
Python
0.000021
1ed0bc1eb37b42845f42659ae00ccfbe444b0bfe
add first game
game-timeout.py
game-timeout.py
# -*- coding: utf-8 -*- from mcpi import minecraft, block import time def buildGame(mc, y): mc.postToChat("Begin") mc.setting("world_immutable", True) putDestination(mc, -5,y-1,5) putPoint(mc, -5, y, 5) putPoint(mc, -5, y, -5) putPoint(mc, 5, y, 5) putPoint(mc, 5, y, -5) def putPoint(...
Python
0
9c939cca65e3fbf0318e34f94021f3fa7ddb4f2d
add setup script for downloading dependencies
setup.py
setup.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 30 16:09:27 2017 Setup script for downloading all dependencies @author: duc """ import pip import nltk dependencies = [ 'certifi==2017.7.27.1', 'chardet==3.0.4', 'cycler==0.10.0', 'idna==2.6', 'matplotlib==2.0.2', 'nltk==...
Python
0
4f024a5da95d7a55e055fcde89981cefcc48a9b4
Add setup script
setup.py
setup.py
"""Setup script of zinnia-spam-checker-mollom""" from setuptools import setup from setuptools import find_packages setup( name='zinnia-spam-checker-akismet', version='1.0.dev', description='Anti-spam protections for django-blog-zinnia with Mollom', long_description=open('README.rst').read(), keywo...
Python
0.000001
cbac3a73c628aed66800e993e3931fcb43f76dd0
This is 0.18
setup.py
setup.py
import os import sys from setuptools import setup, Extension, Feature from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError # fail safe compilation shamelessly stolen from the simplejson # setup.py file. Original author: Bob Ip...
import os import sys from setuptools import setup, Extension, Feature from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError # fail safe compilation shamelessly stolen from the simplejson # setup.py file. Original author: Bob Ip...
Python
0.999997
6c4bbb599900644055c200cfdd3a6fd2cd02a295
add setup
setup.py
setup.py
from setuptools import setup, Command class PyTest(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): import sys,subprocess errno = subprocess.call([sys.executable, 'runtests.py']) raise SystemExit(er...
Python
0.000001
9d406dc943a3a135ad8386255bd312b0412e9fe6
Add files via upload
Definitief/timer.py
Definitief/timer.py
import pygame screen = pygame.display.set_mode((800, 600)) clock = pygame.time.Clock() counter, text = 10, '10'.rjust(3) pygame.time.set_timer(pygame.USEREVENT, 1000) font = pygame.font.SysFont('timer', 30) event = pygame.USEREVENT while True: for e in pygame.event.get(): if e.type == pygame.even...
Python
0
61b007c4e79edd98f076ed2873d4cdca601b6202
Add setup.py
setup.py
setup.py
# Copyright (c) 2017 Luiz Menezes # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distri...
Python
0.000001
87276fa207278f232c5f2544f36ec7560f42a407
Add a "Guess My Number" demo game.
demos/guess_my_number.py
demos/guess_my_number.py
#!/usr/bin/env python3 import kxg import random import pyglet # Use decorators to subscribe to several messages. class World (kxg.World): """ Keep track of the secret number and the range of numbers that haven't been eliminated yet. """ def __init__(self): super().__init__() sel...
Python
0
83fd46732d473132cf51f551608689e2ac4fc4c9
Add poodle main file
poodle.py
poodle.py
import http.server import http.client import socketserver import ssl import argparse import socket import sys import threading sys.path.append('tests/') from testClient import open_ssl from pprint import pprint CRLF = "\r\n\r\n" class MyTCPHandler(socketserver.BaseRequestHandler): """ The RequestHandler class...
Python
0.000001
063bf860b8a6b043e982d9db0f6c5cb524590752
Create gate-puzzles.py
CiO/gate-puzzles.py
CiO/gate-puzzles.py
from string import punctuation def find_word(message): msg = ''.join(l for l in message.lower() if not l in punctuation).split() lMessage = len(msg) scores = msg[:] for i, word in enumerate(msg): lWord = len(word) likeness = 0 for each in msg: likeness += word[0] ==...
Python
0.000729
7e5e310f0a4bd4aa3fa4313624136f52146c9bbd
add setup.py
setup.py
setup.py
import os from setuptools import setup, find_packages import tickets def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='django-tickets', version=tickets.__version__, description='Reusable django application providing a generic support ticket system', ...
Python
0.000001
6953c04104eb4cc3eb908026f2420e3978371616
Move working view.cwl script to doc folder
doc/viewcwl-json.py
doc/viewcwl-json.py
#!/usr/bin/env python import fnmatch import requests import time import os import glob # You can alternatively define these in travis.yml as env vars or arguments BASE_URL = 'https://view.commonwl.org/workflows' #get the cwl in l7g/cwl-version matches = [] for root, dirnames, filenames in os.walk('cwl-version'): ...
Python
0
c43a2af36172faca15d24c858fdb27c88ba6e76a
Add the main setup config file
setup.py
setup.py
from setuptools import setup setup( name='scrapy-corenlp', version='0.1', description='Scrapy spider middleware :: Stanford CoreNLP Named Entity Recognition', url='https://github.com/vu3jej/scrapy-corenlp', author='Jithesh E J', author_email='mail@jithesh.net', license='BSD', packages=...
Python
0.000001
d177935aab000e0c909f85a6162d64438f009301
add setup script
setup.py
setup.py
#!/usr/bin/env python try: from setuptools import setup except ImportError: from distutils.core import setup setup( name="file2py", packages=['file2py'], version="0.2.0", author="Krzysztof Warunek", author_email="kalmaceta@gmail.com", description="Allows to include/manage binary files ...
Python
0.000001
df00bcd0fbf94b35162e02a2776ee7d089a4193c
update version string
setup.py
setup.py
import sys from distutils.core import setup, Extension version = '0.6.0.dev' ext_kwds = dict( name = "pycosat", sources = ["pycosat.c"], define_macros = [] ) if sys.platform != 'win32': ext_kwds['define_macros'].append(('PYCOSAT_VERSION', '"%s"' % version)) if '--inplace' in sys.argv: ext_kwds['...
import sys from distutils.core import setup, Extension version = '0.6.0' ext_kwds = dict( name = "pycosat", sources = ["pycosat.c"], define_macros = [] ) if sys.platform != 'win32': ext_kwds['define_macros'].append(('PYCOSAT_VERSION', '"%s"' % version)) if '--inplace' in sys.argv: ext_kwds['defi...
Python
0.000001
39fd3d75dd6dc60fb2f4fdc1cf5cf4096eade93d
Create setup.py
setup.py
setup.py
""".""" from setuptools import setup setup( name="data-structures", description="Implementations of various data structures in Python", version=0.1, author="Matt Favoino, Allan Liebold", licence="MIT", py_modules=['linked-list'], package_dir={'': 'src'}, install_requires=[], extras_...
Python
0.000001
91a851dd6516bcdd451ba187c72fe2d3eef6a3ce
make fileoperate module
utilfunc/fileoperate.py
utilfunc/fileoperate.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode:nil -*- # vi: set ft=python sts=4 sw=4 et: import os import shutil verbose = True class DeleteFile(object): """ Delete file/directory -------------------------------- Parameters: path: path for deleting >>> m = DeleteFile()...
Python
0.000001
5a6af2cb6925adfe392c870c23c9e8dfcedccd06
extract text from image
reader.py
reader.py
import http.client, urllib.request, urllib.parse, urllib.error, base64, json def transcribe(url): subscription_key = 'a48ce7ca33e746349ab4b33a2fe054c7' uri_base = 'westeurope.api.cognitive.microsoft.com' headers = { # Request headers. 'Content-Type': 'application/json', 'Ocp-Apim...
Python
0.999999
4f6900033dc8bbba5f85369565ce17aa850c230c
Add an egg-ified setup
setup.py
setup.py
try: from setuptools import setup except: from distutils.core import setup import forms setup( name='forms', version=forms.version, description='HTML forms framework for Nevow', author='Matt Goodall', author_email='matt@pollenation.net', packages=['forms', 'forms.test'], )
Python
0.000071
5e153bf16e25f3ab5039531be61c3d7ee09137bb
add test (#35568)
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_tile.py
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_tile.py
# Copyright (c) 2021 PaddlePaddle 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 ap...
Python
0
aee2363f6c6995a124b3c0ad358e83dc815ea808
Remove redundant subscription fields from user model.
alembic/versions/3fc4c97dc6bd_remove_redundant_user_subscription_.py
alembic/versions/3fc4c97dc6bd_remove_redundant_user_subscription_.py
"""remove redundant user subscription fields Revision ID: 3fc4c97dc6bd Revises: 3d723944025f Create Date: 2015-01-27 18:11:15.822193 """ # revision identifiers, used by Alembic. revision = '3fc4c97dc6bd' down_revision = '3d723944025f' branch_labels = None depends_on = None from alembic import op import sqlalchemy a...
Python
0
a3e70bdd8146d4e70dc8f34396f7c537dbd4784c
add setup.py
setup.py
setup.py
from distutils.core import setup setup(name='m', version='0.1.0', packages=['m', 'm.security'], install_requires=['WebOb>=1.6.1'], author = "comyn", author_email = "me@xueming.li", description = "This is a very light web framework", license = "Apache License 2.0", )
Python
0.000001
76d2386bfa9e61ac17bca396384772ae70fb4563
Add one liner to add ability to print a normal distribution with mean zero and varience one
gauss.py
gauss.py
#!/usr/bin/env python3 #Copyright 2015 BRendan Perrine import random random.seed() print (random.gauss(0,1), "Is a normal distribution with mean zero and standard deviation and varience of one")
Python
0
5653330769630c8f4f8ed88753b3886d063f9e3d
Add web example
web.py
web.py
# -*- coding: utf-8 -*- import asyncio import os from flask import Flask flask_app = Flask(__name__) @flask_app.route('/') def hello(): return 'Hello World!' async def main(): port = int(os.environ.get('PORT', 5000)) future_tasks = [ asyncio.ensure_future(flask_app.run(host='0.0.0.0', port=por...
Python
0.000002
4a89b6e085f363a6e848a13e857872165a781d61
add a base setup.py
setup.py
setup.py
from distutils.core import setup import os # Borrowed and modified from django-registration # Compile the list of packages available, because distutils doesn't have # an easy way to do this. packages, data_files = [], [] root_dir = os.path.dirname(__file__) if root_dir: os.chdir(root_dir) def build_package(dirpat...
Python
0.000001
9fb6d0ea74aacc77f06d36805760270854e53eba
Add missing django_libs test requirement
setup.py
setup.py
import os from setuptools import setup, find_packages import calendarium def read(fname): try: return open(os.path.join(os.path.dirname(__file__), fname)).read() except IOError: return '' setup( name="django-calendarium", version=calendarium.__version__, description=read('DESCRIP...
import os from setuptools import setup, find_packages import calendarium def read(fname): try: return open(os.path.join(os.path.dirname(__file__), fname)).read() except IOError: return '' setup( name="django-calendarium", version=calendarium.__version__, description=read('DESCRIP...
Python
0.000003
ff000972d386b001d75cb36b161acd59a1626917
Correct Path to PyPi Readme
setup.py
setup.py
#!/usr/bin/env python #------------------------------------------------------------------------- # Copyright (c) Microsoft. 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...
#!/usr/bin/env python #------------------------------------------------------------------------- # Copyright (c) Microsoft. 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...
Python
0.000002
e611dda17f64b0d1355fbe85589b2c790db40158
Create hello.py
hello.py
hello.py
def main(): print("hello") if __name__=='__main__': main()
Python
0.999503
bd0f6328bcb0aeae69568fab203f97e155fe406f
add the lexicon preprocess script demo
PPDB.py
PPDB.py
import numpy as np import os.path import cPickle as pickle import sys class PPDB_2(object): def __init__(self, vocab="vocab.txt", ppdb="ppdb-2.0-tldr", output="ppdb2.txt"): self.vocab = vocab self.ppdb_paraphrases = ppdb_paraphrases = {} self.word_hash = {} self.output = output ...
Python
0.000001
23ccab0a6d4107de250fb5e609538bb86a3aef24
add main script runner
runner.py
runner.py
import json import urllib2 from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC drupal_site = "http://url.toyourdrupalsite.com" data_path = "/api/v1/resource" # ...
Python
0.000001
4e503a060023da75153438d73902d19a07e90be3
Add the source file
PyBF.py
PyBF.py
# -*- coding: utf-8 -*- import sys array = [0] # array of bytes ptr = 0 # data pointer def readNoLoop(char): global ptr # Increment/Decrement the byte at the data pointer if char=='+': array[ptr] += 1 elif char=='-': array[ptr] -= 1 if array[ptr] < 0: raise ValueError("Negative value in arr...
Python
0.000004
7d3a1eb991e6678e8227ea7778688a0458ad5843
Add package distribution files
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='GCJCore', version='1.0', description='AppState reader for python scripts', author='Yves Stadler', author_email='yves.stadler@gmail.com', url='', packages=['gcjcore'], )
Python
0.000001
5d5806ed7b490ab79a882e8b3f966d5309db648b
Create setup.py
setup.py
setup.py
import sys try: from setuptools import setup except ImportError: if sys.version_info > (3,): raise RuntimeError("python3 support requires setuptools") from distutils.core import setup info = {} src = open("lxmlmate.py") lines = [] for ln in src: lines.append(ln) if "__version__" in ln: ...
Python
0.000001
addc7e79920afbef5a936b0df536bb8d5f71af99
Add a setup script.
setup.py
setup.py
#!/usr/bin/python from distutils.core import setup setup(name='discuss', version='1.0', description='Python client for Project Athena forum system', author='Victor Vasiliev', packages=['discuss'] )
Python
0
06eea20e9db69879bec2657e73c95d452774acf9
Create blynk_ctrl.py
scripts/blynk_ctrl.py
scripts/blynk_ctrl.py
#!/usr/bin/env python ''' This script uses Bridge feature to control another device from the command line. Examples: python blynk_ctrl.py --token=b168ccc8c8734fad98323247afbc1113 write D0 1 python blynk_ctrl.py --token=b168ccc8c8734fad98323247afbc1113 write A0 123 python blynk_ctrl.py --token=b168ccc8c8734f...
Python
0
3edc58673e21c7bbbfa5db07d7c6a92c76470dfc
add setup script
setup.py
setup.py
# -*- coding: utf-8 -*- from setuptools import setup setup( name='sphinx-git-lowdown', version='0.0.1', url='https://github.com/yamahigashi/sphinx-git-lowdown', # download_url='http://pypi.python.org/pypi/sphinx-git-lowdown', license='Apache', author='yamahigashi', author_email='yamahigas...
Python
0.000001
0741cd665592dc18a7880622fad83aec92093907
add setup.py
setup.py
setup.py
from setuptools import setup, find_packages import hedgehog_light setup( name="stm32flasher", description="STM32 USART Flasher", version=hedgehog_light.__version__, license="AGPLv3", url="https://github.com/PRIArobotics/STM32Flasher", author="Clemens Koza", author_email="koza@pria.at", ...
Python
0.000001
845660721ddcbefa4b52fe4a5f3fd3bba75c10bc
Add setup.py
setup.py
setup.py
import os from setuptools import setup # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): """Utility function to read the REA...
Python
0.000001
d98c66ee6a0e27485980fd336ef2ee7a2f08462c
Add setup.py for Read the Docs
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='coffeestats', version='0.2.1', description='Coffeestats.org', author='Jan Dittberner', author_email='jan@dittberner.info', url='https://github.com/coffeestats/coffeestats-django', package_dir = {'': 'coffeestats'}, ...
Python
0
2c11575e5414cca19698cc500844e7553dcc9aa8
Add setup.py
setup.py
setup.py
from distutils.core import setup setup(name='s3viewport', version='20120930', description='A FUSE filesystem for viewing S3 buckets', author='Brendan MacDonell', author_email='brendan@macdonell.net', url='https://github.com/bremac/s3viewport', packages=['s3viewport'], package...
Python
0.000001
02f984f7efe9481dbaa2517cfc11ec826421925f
update the version of jinja needed, 2.6 is out
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup requires = ['feedgenerator', 'jinja2 >= 2.6', 'pygments', 'docutils', 'pytz', 'blinker', 'unidecode'] try: import argparse # NOQA except ImportError: requires.append('argparse') entry_points = { 'console_scripts': [ 'pelican = pelica...
#!/usr/bin/env python from setuptools import setup requires = ['feedgenerator', 'jinja2 >= 2.4', 'pygments', 'docutils', 'pytz', 'blinker', 'unidecode'] try: import argparse # NOQA except ImportError: requires.append('argparse') entry_points = { 'console_scripts': [ 'pelican = pelica...
Python
0
2e2ae8f42c46a09224fdd4d39ab317f23c96d465
Create setup.py
setup.py
setup.py
import os from setuptools import setup, find_packages this_dir = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(this_dir, 'README.md'), 'r') as f: long_description = f.read() setup(name='boa', version='0.1', author='Bounouar Colin', maintainer='Bounouar Colin', url='http...
Python
0.000001
67c508d132f1ec40768a7488bc1e08e62d2208fe
Add DatabaselessTestRunner class
zc_common/databaseless_test_runner.py
zc_common/databaseless_test_runner.py
from django.test.runner import DiscoverRunner class DatabaselessTestRunner(DiscoverRunner): """A test suite runner that does not set up and tear down a database.""" def setup_databases(self): """Overrides DjangoTestSuiteRunner""" pass def teardown_databases(self, *args): """Overr...
Python
0
15112cbf19478ff966e2946977b25a2cb0042cb6
Add D2 PvE stats model
cogs/models/pve_stats.py
cogs/models/pve_stats.py
class PvEStats: """This class represents the general PvE stats for a Destiny 2 character (or set of characters) Args: pve_stats: The 'response' portion of the JSON returned from the D2 'GetHistoricalStats' endpoint with modes 7,4,16,17,18,46,47 (given as a dictionary). """ ...
Python
0
28fd3e9305872593a9d8167afa11ce3190b43903
add uncollectible object sample code
profiling/snippet/uncollectible.py
profiling/snippet/uncollectible.py
from __future__ import print_function import gc ''' This snippet shows how to create a uncollectible object: It is an object in a cycle reference chain, in which there is an object with __del__ defined. The simpliest is an object that refers to itself and with a __del__ defined. ''' def dd(*mes): for m in mes: ...
Python
0.000012
55637514e578421e749f90f1ae8bd782831abffb
Add ClientMesh Decoder
malwareconfig/decoders/clientmesh.py
malwareconfig/decoders/clientmesh.py
from base64 import b64decode from malwareconfig.common import Decoder from malwareconfig.common import string_printable class ClientMesh(Decoder): decoder_name = "ClientMesh" decoder__version = 1 decoder_author = "@kevthehermit" decoder_description = "ClientMesh Decoder" def __init__(self): ...
Python
0
0018765068ed533bed6adaa33a7634c104850034
Create RomanToInt_001.py
leetcode/013-Roman-to-Integer/RomanToInt_001.py
leetcode/013-Roman-to-Integer/RomanToInt_001.py
class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ r2i = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000} res = 0 for i in range(len(s)): if i == len(s) - 1 or r2i[s[i]] >= r2i[s[i + 1]]: ...
Python
0.002185
709229c8126a532ca6813298b0d90515a5c1ad9d
test to submit file to databank
test/FileShare/tests/OXDSDataset.py
test/FileShare/tests/OXDSDataset.py
# --------------------------------------------------------------------- # # Copyright (c) 2012 University of Oxford # # 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, incl...
Python
0
180cae4ec364cf1b2bf9d1f733999a538c5f516f
Create test-events.py
test/python/test-events.py
test/python/test-events.py
import datetime import time from tibrv.tport import * from tibrv.status import * from tibrv.tport import * from tibrv.events import * from tibrv.disp import * import unittest class EventTest(unittest.TestCase, TibrvMsgCallback): @classmethod def setUpClass(cls): status = Tibrv.open() if status...
Python
0.000007
95fdd1f96ad4d54fb75ea134ea2195808d4c1116
Add python script to check big-O notation
bigO.py
bigO.py
import timeit import random for i in range (10000, 100000, 20000): t = timeit.Timer("random.randrange(%d) in x"%i, "from __main__ import random, x") x = list(range(i)) list_time = t.timeit(number = 1000) x = {j:None for j in range(i)} dict_time = t.timeit(number = 1000) print "Counter: " + str(i) + " L...
Python
0.000001
af4449eb8d2987e93ae97213d0deee57b937b5c6
add deptable for serverside
conary/repository/netrepos/deptable.py
conary/repository/netrepos/deptable.py
# Copyright (c) 2004-2007 rPath, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http://www.rpath.com/permane...
Python
0
a0ae12ddf581eb77af5ce5c6498c26745bd2cfcb
Add script to extract code/data size after make examples.
stats.py
stats.py
#!/usr/bin/python # encoding: utf-8 from __future__ import with_statement import argparse, re, sys def filter(args): bytes_extractor = re.compile(r"([0-9]+) bytes") with args.output: with args.input: for line in args.input: if line.startswith("avr-size"): ...
Python
0
23080dfea3ce6997c1cbd784da674902aa8a8cbe
test looping from Ingenico format, through pBER and back to Ingenico
test/test_loop_ingenico.py
test/test_loop_ingenico.py
from pyemvtlv.codec.ingenico import decoder as ingdec from pyemvtlv.codec.ingenico import encoder as ingenc from pyemvtlv.codec.binary import decoder as berdec from pyemvtlv.codec.binary import encoder as berenc from binascii import hexlify import unittest class RecodeTestCase(unittest.TestCase): def testFull(s...
Python
0
31e7415f29d22d3ecf709fc0a447c95232b0e294
Create server.py
server.py
server.py
#!/usr/bin/env python # LGS SimSuite Server #Copyright (c) 2015 Filip Marinic from time import sleep, gmtime, strftime import socket import math import sys TCP_S_IP = '0.0.0.0' BUFFER_SIZE = 10 FRAME_ID = 1000000000 frames_sent = 0 MESSAGE = "_9HXuFd6BoQGA0t5nvoLfOBUhP9rKGCFKPUG6JvFfBr6zJZDwzHlgTyCoBk04sxPQEaQ20Poey...
Python
0.000001
151a5a64aa5d0e3a2b4e63c7f07916efa087b8a2
Create car-fleet.py
Python/car-fleet.py
Python/car-fleet.py
# Time: O(nlogn) # Space: O(n) # N cars are going to the same destination along a one lane road. # The destination is target miles away. # # Each car i has a constant speed speed[i] (in miles per hour), # and initial position position[i] miles towards the target along the road. # # A car can never pass another car ah...
Python
0.000038
67d7f3fc03c6bc031f73b53348b140e7f24567c1
Add opennurbs package (#6570)
var/spack/repos/builtin/packages/opennurbs/package.py
var/spack/repos/builtin/packages/opennurbs/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
d7eaf7c3010b7cec0ef53f033badaa11748224e7
add link test
tests/acceptance/mapping/link_at.py
tests/acceptance/mapping/link_at.py
# Ariane CLI Python 3 # Link acceptance tests # # Copyright (C) 2015 echinopsii # # 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 Foundation, either version 3 of the # License, or (at your option) an...
Python
0
aa2ddd886cc344889b53eed2ca8102fe5dc0aed4
Make tf_saved_model/debug_info.py a bit more strict.
tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/debug_info.py
tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/debug_info.py
# Copyright 2019 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...
# Copyright 2019 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.001932
7b0005eb7d2b2e05a9fd833a2771573aec69c199
Add script for comparing test vectors.
tests/compare_test_data.py
tests/compare_test_data.py
import os import sys import glob import h5py from QGL import * import QGL BASE_AWG_DIR = QGL.config.AWGDir BASE_TEST_DIR = './test_data/awg/' def compare_sequences(): test_subdirs = ['TestAPS1', 'TestAPS2'] for subdir in test_subdirs: testdirs = glob.glob(os.path.join(BASE_TEST_DIR, subdir, '*')) ...
Python
0
bf9a5c6f14cfbafe544fcc27f146410afcc84fea
Add migrations for number_of_streams.
migrations/versions/19b7fe1331be_.py
migrations/versions/19b7fe1331be_.py
"""Add number_of_streams to movies. Revision ID: 19b7fe1331be Revises: 2c76677d803f Create Date: 2013-11-16 22:11:44.560000 """ # revision identifiers, used by Alembic. revision = '19b7fe1331be' down_revision = '2c76677d803f' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto gene...
Python
0
692f8ab50f4ecf8d40605d535e85077b8e79c510
Add client test for test_pods
magnumclient/tests/v1/test_pods.py
magnumclient/tests/v1/test_pods.py
# Copyright 2015 IBM Corp. # # 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 t...
Python
0.000001
3d10dd8b18096ba51ed4b837f8b297d015258a96
Add conftest for UI testing
tests/dash_app/conftest.py
tests/dash_app/conftest.py
from pytest import fixture from selenium.webdriver.chrome.options import Options from dash_app import app def pytest_setup_options(): options = Options() options.add_argument('--disable-gpu') options.add_argument('--headless') options.add_argument("--no-sandbox") options.add_argument("--disable-e...
Python
0
98213db5448f73edb039912bbdf6dd2f69ce26a4
Add the migration. Oops.
migrations/versions/c3500625bed8_.py
migrations/versions/c3500625bed8_.py
"""empty message Revision ID: c3500625bed8 Revises: 3dcc171e7253 Create Date: 2017-02-21 16:08:43.397517 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = 'c3500625bed8' down_revision = '3dcc171e7253' branch_labels = None depe...
Python
0
514f744bc39129a241e704e4ea282befcd31b1b7
Add about page functional test
tests/functional/test_about_page.py
tests/functional/test_about_page.py
from .base import FunctionalTest class AboutPageTest(FunctionalTest): def test_about_page_navigation(self): self.browser.get(self.live_server_url) self.browser.set_window_size(1024, 768) about_link = self.browser.find_element_by_link_text('ABOUT US') about_link.click() ...
Python
0
0e877e6124d370a0d628d12e387d5614ab4c6a6a
Create hacktorial.py
hacktorial.py
hacktorial.py
#!/usr/bin/env python # I got really excited about the recursive functions that come with Python # Factorial def factorial(z): return reduce((lambda a, b: a*b), xrange(1, z+1)) # Some narrow functions as reference for broader functions: ''' A. The sum of squares is limited to only getting sums with exponent of ...
Python
0.000001
fb5a0d0cf9e3e14e418b06c373f26a2e6e2a7c1e
Read data from csv
script.py
script.py
import numpy as np import pandas def main(): data = pandas.read_csv('sarcasm_v2.csv').as_matrix() # print(data.shape) data[:, 0] = np.array([find_category(x) for x in data[:, 0]]) data[:, 1] = np.array([sarcasm(x) for x in data[:, 1]]) # print(data[0,1]) # should be 1 for sarcasm def find_category(category): re...
Python
0
350ea09999002935178bf6569411e56455167ff8
add script to clean cells
drop_ipynb_output.py
drop_ipynb_output.py
#!/usr/bin/env python """ Suppress output and prompt numbers for IPython notebooks included in git repositories. By default, this script will tell git to ignore prompt numbers and cell output when adding ipynb files to git repositories. Note that the notebook files themselves are *not* changed, this script just filte...
Python
0
0bd974c21f42f7c2e0162b92ea1cde5ee5ff8060
add wrapper to get all bootstrapped preds
analysis/get_all_bootstrapped_model_predictions.py
analysis/get_all_bootstrapped_model_predictions.py
from __future__ import division import os import numpy as np import pandas as pd import analysis_helpers as h ''' Wrapper around bootstrap_model_predictions.py. It will spawn several threads to get bootstrap vectors from all splits and models. Estimate uncertainty in estimates of key variables of interest that are d...
Python
0
89464b86d3c94c5aea5aac15e0dc5b581ed2ac3f
Save olass/models/crud_mixin.py needs refactoring in order to have access to the `session`
olass/models/crud_mixin.py
olass/models/crud_mixin.py
""" Goal: simplify the code when interacting with entities """ import sqlalchemy as db class CRUDMixin(): """ Helper class sqlalchemy entities """ __table_args__ = {'extend_existing': True} id = db.Column(db.Integer, primary_key=True) @classmethod def get_by_id(cls, id): if any( ...
Python
0
d445b65414325b9281ad6fcdc59ab4a2290d0bdc
Add missing migration
website/jdpages/migrations/0015_auto_20171209_1040.py
website/jdpages/migrations/0015_auto_20171209_1040.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('jdpages', '0014_organisationmember_email'), ] operations = [ migrations.AlterModelOptions( name='blogcategorypag...
Python
0.0002
59e909afcb5dc5e44703c25d183b9edce60882b6
add comment
controller/addComment.py
controller/addComment.py
#!/usr/local/bin/python3 """ created_by: Aninda Manocha created_date: 3/5/2015 last_modified_by: Aninda Manocha last_modified date: 3/5/2015 """ # imports import constants import utils import json from sql.session import Session from sql.user import User from sql.comment import Comment #Format of com...
Python
0
a46f3dd56b716cf2c9c918e4135d2248388ba030
Change template debugging back to False
{{cookiecutter.project_slug}}/config/settings/test.py
{{cookiecutter.project_slug}}/config/settings/test.py
# -*- coding: utf-8 -*- ''' Test settings - Used to run tests fast on the continuous integration server and locally ''' from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ # Turn debug off so tests run faster DEBUG = False TEMPLATES[0]['OPTIONS']['d...
# -*- coding: utf-8 -*- ''' Test settings - Used to run tests fast on the continuous integration server and locally ''' from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ # Turn debug off so tests run faster DEBUG = False # But template debugging m...
Python
0
d52448938292dfefefd3dd8afa6465504ef5371b
Split out rational function support to ratfun.py
lcapy/ratfun.py
lcapy/ratfun.py
""" This module provides support for rational functions Copyright 2016 Michael Hayes, UCECE """ from __future__ import division import sympy as sym from sympy.core.mul import _unevaluated_Mul as uMul def _zp2tf(zeros, poles, K=1, var=None): """Create a transfer function from lists of zeros and poles, and fr...
Python
0.999369
e9b057d13e99dbcbbcf77467de49c6472f042b42
Add files via upload
Struts2_Shell001.py
Struts2_Shell001.py
#!/usr/bin/python import urllib2 import os, sys, time __Author__="Rvbk" RED = '\033[1;31m' BLUE = '\033[94m' BOLD = '\033[1m' GREEN = '\033[32m' OTRO = '\033[36m' YELLOW = '\033[33m' ENDC = '\033[0m' def cls(): os.system(['clear', 'cls'][os.name == 'nt']) cls() logo = BLUE+''' ...
Python
0
a45b62ab76324db2ae4a0842b901fec8e463e2f0
Add tests for the constructor
tests/test_vector2_ctor.py
tests/test_vector2_ctor.py
import pytest # type: ignore from hypothesis import given from utils import floats, vectors, vector_likes from ppb_vector import Vector2 class V(Vector2): pass @pytest.mark.parametrize('cls', [Vector2, V]) @given(x=vectors()) def test_ctor_vector_like(cls, x: Vector2): for x_like in vector_likes(x): v...
Python
0.000001
b18732173a22aa431165fa321abac7924f66b1e1
Require Python to build Julia
var/spack/packages/julia/package.py
var/spack/packages/julia/package.py
from spack import * import os class Julia(Package): """The Julia Language: A fresh approach to technical computing""" homepage = "http://julialang.org" url = "http://github.com/JuliaLang/julia/releases/download/v0.4.2/julia-0.4.2.tar.gz" version('0.4.2', 'ccfeb4f4090c8b31083f5e1ccb03eb06') #...
from spack import * import os class Julia(Package): """The Julia Language: A fresh approach to technical computing""" homepage = "http://julialang.org" url = "http://github.com/JuliaLang/julia/releases/download/v0.4.2/julia-0.4.2.tar.gz" version('0.4.2', 'ccfeb4f4090c8b31083f5e1ccb03eb06') #...
Python
0.999042
221621e88496805fbee7849e376cce40e0d45f03
Add test for #305 (thanks to @bfredl)
numba/tests/issues/test_issue_305.py
numba/tests/issues/test_issue_305.py
from __future__ import print_function, division, absolute_import import tempfile import textwrap from numba import jit, autojit # Thanks to @bfredl def test_fetch_latest_source(): """ When reloading new versions of the same module into the same session (i.e. an interactive ipython session), numba sometim...
Python
0
618340e7dfd21c54ac713140079c53b205aae73e
Create tuples.py
hacker_rank/python/basic_data_types/tuples.py
hacker_rank/python/basic_data_types/tuples.py
if __name__ == '__main__': n = int(input()) integer_list = map(int, input().split()) t = (tuple(integer_list)) print(hash(t))
Python
0.008361
d3b99620a4794376f4319516af65aa0f5c433354
Create really terrible demo
demo.py
demo.py
import document pre = document.getElementById('edoutput') pre.innerHTML = ''' <button onclick="var a=new XMLHttpRequest();a.open('GET','https://raw.githubusercontent.com/Zirientis/skulpt-canvas/master/core.js', false);a.send();console.log(a.response);">Run</button> <span id="evaltext" style="display:none"> </span> '''...
Python
0.000001
12d075d7d93d6dd1aed72c18595b2931f5e14721
use six instead of io
astropy_helpers/sphinx/ext/autodoc_enhancements.py
astropy_helpers/sphinx/ext/autodoc_enhancements.py
""" Miscellaneous enhancements to help autodoc along. """ import inspect import sys import types from sphinx.ext.autodoc import AttributeDocumenter, ModuleDocumenter from sphinx.util.inspect import isdescriptor if sys.version_info[0] == 3: class_types = (type,) else: class_types = (type, types.ClassType) M...
""" Miscellaneous enhancements to help autodoc along. """ import inspect import sys import types from io import StringIO from sphinx.ext.autodoc import AttributeDocumenter, ModuleDocumenter from sphinx.util.inspect import isdescriptor if sys.version_info[0] == 3: class_types = (type,) else: class_types = (t...
Python
0.000044
6af0081721acd4b6258b97c02424b2ccba80a303
Create scale.py
docs/learning-by-doing/week06-mesos-and-marathon/scale.py
docs/learning-by-doing/week06-mesos-and-marathon/scale.py
import http.client import json URI = 'localhost:8080' header = {'Content-type': 'application/json'} data = '"instances": "3"' json_data = json.dumps(data) method = 'PUT' link = '/v2/apps/basic-0?force=true' con = http.client.HTTPConnection(URI) con.request(method,link,json_data,header) response = con.getresponse() p...
Python
0.000002
93a2c523383fd1903e2912c783efdd1d27dc81ee
add tests for inserting rows with missing key columns
test/cql-pytest/test_null.py
test/cql-pytest/test_null.py
# Copyright 2020 ScyllaDB # # This file is part of Scylla. # # Scylla is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Scylla...
Python
0.000087
2b095ad646f1e8d4280190c9a1c2ccbed512d43c
Create __init__.py
pythainlp/romanization/__init__.py
pythainlp/romanization/__init__.py
from pythainlp.romanization.royin import *
Python
0.000429