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
45e624fe5176dd59b8f42636b777a1b6a6106dca
Add initial setuptools integration, required by click
setup.py
setup.py
# -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 from setuptools import setup setup( name='loafer', version='0.0.1', entry_points=''' [console_scripts] loafer=loafer.cli:cli ''', )
Python
0
81e7e9ed4b3b0f6840e11adc5c73648471f606ef
Add setup.py
setup.py
setup.py
# coding: utf-8 from __future__ import print_function, unicode_literals import sys from setuptools import setup install_requires = [] if sys.version_info[0] == 2: install_requires.append('statistics') setup( name='scrapy-slotstats', version='0.1', license='MIT License', description='Scrapy exte...
Python
0.000001
21380bcf76a8144d182166c3441d308af2eda417
Add first pass at setup.py
setup.py
setup.py
#!/usr/bin/python import os from distutils.core import setup, Extension ext_modules = [] packages = ['bayesdb', 'bayesdb.tests'] setup( name='BayesDB', version='0.1', author='MIT.PCP', author_email = 'bayesdb@mit.edu', url='probcomp.csail.mit.edu/bayesdb', long_descript...
Python
0
374e27087d6d432ba01a0ef65c4109be84e50dcf
Add setup.py
setup.py
setup.py
import os import sys try: from setuptools import setup except ImportError: from distutils.core import setup try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: from distutils.command.build_py import build_py path, script = os.path.split(sys.argv[0]) os.chdir(os.p...
Python
0.000001
9c05031446d0d17bdc207b00ebf47d9769f96d33
Add a setup.py for owebunit to be able to obtain ocookie via pip
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='ocookie', version='0.1', description='Comprehensive cookie library', author='Oleg Pudeyev', author_email='oleg@bsdpower.com', url='http://github.com/p/ocookie', packages=['ocookie'], )
Python
0
431acaabf7a3e77b416a57998bfadcb2d3864555
Add a setup.py
setup.py
setup.py
from setuptools import setup, find_packages import codecs import os import re setup( name="httpbin", version="0.1.0", description="HTTP Request and Response Service", # The project URL. url='https://github.com/kennethreitz/httpbin', # Author details author='Kenneth Reitz', author_emai...
Python
0
82b8651c9eed0c19224c8a7b53a0bedae81337a3
Add a setup.py.
setup.py
setup.py
from setuptools import setup, find_packages setup( name = "WebStar", version = "0.1b", author="Mike Boers", author_email="webstar@mikeboers.com", license="BSD-3" )
Python
0
d157b4e1f4709b0205d5de31df65a5308f926d49
Add setup.py
setup.py
setup.py
#!/usr/bin/env python # coding: utf-8 import re try: from setuptools import setup except ImportError: from distutils.core import setup version = "" with open("autumn.py", "r") as f: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1) ...
Python
0.000001
a2bfe07ba67e902870dd366626b23dbb5e6e2696
Create messageMode.py
messageMode.py
messageMode.py
#!/usr/bin/python #coding=utf-8 #filename: messageMode.py import telnetlib import os,sys,commands,multiprocessing import smtplib import time from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.image import MIMEImage import urllib2 #---init--- begintime = time.strfti...
Python
0.000001
3d020f09332093807f70a1bca5360e1418633bb4
Add setup.py.
setup.py
setup.py
from setuptools import setup, find_packages setup(name='Anytask', packages=find_packages(), )
Python
0
b38eb4f8a7b8e3400ea09c600e241d8c4a9d0846
Add setup so sgfs can install this to test with
setup.py
setup.py
from distutils.core import setup setup( name='sgsession', version='0.1-dev', description='Shotgun ORM/Session.', url='http://github.com/westernx/sgsession', packages=['sgsession'], author='Mike Boers', author_email='sgsession@mikeboers.com', license='BSD-3', classifie...
Python
0
5263a684d4bd111b903456a8da2c92ddb25e7811
Add migration
seriesly/series/migrations/0002_auto_20180127_0718.py
seriesly/series/migrations/0002_auto_20180127_0718.py
# Generated by Django 2.0 on 2018-01-27 13:18 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('series', '0001_initial'), ] operations = [ migrations.AlterField( model_name='show', name...
Python
0.000002
874fbb6749d60ea3fcf078d25d7911d7ac314ab1
Add a setup.py file for use with python install tools.
setup.py
setup.py
try: from setuptools import setup except ImportError: from distutils.core import setup config = { 'description': 'File validator', 'author': 'Iestyn Pryce', 'url': '', 'download_url': '', 'author_email': 'iestyn.pryce@gmail.com', 'version': '0.1', 'install_requires': ['nose'], '...
Python
0
3258a5ba8c748ce079082c34d13b231f157b1463
Add experimental top-level copy of setup.py
setup.py
setup.py
#!/usr/bin/env python # Original libphonenumber Java code: # Copyright (C) 2009-2011 The Libphonenumber Authors # # 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/li...
Python
0
58dd2d188aab1fbf30ff843307eecf5ca685527c
Add setup
setup.py
setup.py
from setuptools import find_packages, setup setup( name='ngx-task', version='0.1', description='Testimonial for candidates to show up their code-foo', author='Dmitry Shulyak', author_email='dmitri.shulyak@gmail.com', url='https://github.com/shudmi/ngx-task', classifiers=[ 'License :...
Python
0.000001
90746eba08c67c4f62462ed74d08566cafa18724
Add setup.py
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages setup( name='wrenet', version='0.1', description='Network configurations viewer in the Windows Registry', author='graypawn', author_email='choi.pawn' '@gmail.com', url='https://github.com/graypawn/wrenet', license='Apache Li...
Python
0.000001
50742b6e629e6f54a9f3784a3c1495eb9d82c238
Add start of processed package
brightway_projects/processing/processed_package.py
brightway_projects/processing/processed_package.py
from ..errors import InconsistentFields, NonUnique def greedy_set_cover(data, exclude=None): """Find unique set of attributes that uniquely identifies each element in ``data``. Feature selection is a well known problem, and is analogous to the `set cover problem <https://en.wikipedia.org/wiki/Set_cover_probl...
Python
0
c68cda0549bb9c47be0580ecd43f55966e614b31
Add Pascal's Triangle/nCr Table
mathematics/combinatorics/ncr_table/kevin.py
mathematics/combinatorics/ncr_table/kevin.py
#!/usr/bin/env python # https://www.hackerrank.com/challenges/ncr-table def get_number(): return int(input().strip()) def nCr(row_number): rows = [[1], [1, 1], [1, 2, 1]] while row_number >= len(rows): # 1 # 1 1 # 1 2 1 # 1 4 4 1 # ....... row = [(rows[-1...
Python
0.000004
842869063ead9b2e6a1e22d11c9901072f2319aa
Add script to self generate docs for recurring data types
docs/generate_spec.py
docs/generate_spec.py
# -*- encoding: utf-8 -*- # # This script is to be used to automagically generate the recurring data types # documentation based on the API specification. # # to run it just do: # # $ python generate_spec.py > outputfile.md # # :authors: Arturo Filastò # :licence: see LICENSE import inspect from globaleaks.rest.mes...
Python
0
7d23ad49da0044d83f781105cb01addb1a4aa41c
Add catalog.wsgi file
catalog.wsgi
catalog.wsgi
#!/usr/bin/python import sys sys.path.insert(0,"/var/www/html/catalog/") from catalog import app as application application.secret_key = 'super_secret_key'
Python
0
dd5ae6788b4bb3630c16ce0996b206ae5e26228f
Extract env seq
scripts/extract_paths.py
scripts/extract_paths.py
import glob import sys import avidaspatial num = sys.argv[1] env_id = sys.argv[2] filenames = glob.glob("*"+env_id+"*/lineage_locs_"+num+".dat") env = avidaspatial.parse_environment_file("../config/env"+env_id+".cfg", (60, 60)) outfile = open("paths_"+num+"_"+env_id+".dat", "w") outfile_env = open("env_seq_"+num+"_...
import glob import sys import avidaspatial num = sys.argv[1] env = sys.argv[2] filenames = glob.glob("*"+env+"*/lineage_locs_"+num+".dat") env = avidaspatial.parse_environment_file("../config/env"+env+".cfg", (60, 60)) outfile = open("paths_"+num+"_"+env+".dat", "w") outfile_env = open("env_seq_"+num+"_"+env+".dat"...
Python
0.999944
c16fae0519068e40d7b1ed988f49460198f6fd43
Create decode_diameter.py
decode_diameter.py
decode_diameter.py
#------------------------------------------------------------------------------- # Name: Decode Diameter # Purpose: # # Author: XIAO Zhen # # Created: 08/10/2014 # Copyright: (c) XIAO Zhen 2014 # Licence: MIT License #------------------------------------------------------------------------------- ...
Python
0.000327
8968251b7e1b89171b285e377d17dae299019cd0
Test that '--checks' accepts notebooks either before or after the check command (#887)
tests/test_cli_check.py
tests/test_cli_check.py
import pytest from nbformat.v4.nbbase import new_code_cell, new_notebook from jupytext import write from jupytext.cli import jupytext from .utils import requires_black @pytest.fixture def non_black_notebook(python_notebook): return new_notebook(metadata=python_notebook.metadata, cells=[new_code_cell("1+1")]) ...
Python
0
4694f6bf2405d0aae5e6c3fc393f8a839e8aac07
Add tests for converter.Line and converter.Generator.
tests/test_converter.py
tests/test_converter.py
# coding: utf-8 # Copyright (c) 2010-2012 Raphaël Barrois import unittest from confmgr import converter class LineTestCase(unittest.TestCase): def test_repr(self): self.assertEqual("Line('foo', 'bar')", repr(converter.Line('foo', 'bar'))) def test_equality(self): self.assert...
Python
0
a37640d107d1dd58ba4f9db3e043020ad76cd25d
Create cam_control.py
cam_control.py
cam_control.py
#!/usr/bin/python # -*- coding: utf-8 -*- from cv2 import * import MySQLdb as ms import time import _mysql_exceptions as M import os def get_image(): cam1 = VideoCapture(0) cam2 = VideoCapture(1) s1, img1 = cam1.read() s2, img2 = cam2.read() if s1: imwrite("test1.jpg",img) if s2: ...
Python
0.000001
d2a283856a9e2559a131c5aaa2407477be993af0
add file to help gather all the data we need
collate.py
collate.py
import csv from glob import glob def collate_from_breath_meta(cohort): """ Gets all breath_meta.csv files in our specific cohort and then gets all the data from these files and stores them in a dictionary. """ if cohort not in ["ardscohort", "controlcohort"]: raise Exception("Input must ei...
Python
0
d2667faded6dfdd1fb2992ec188b8fed12bb2723
Add ncurses 5.9
packages/ncurses.py
packages/ncurses.py
class NcursesPackage (GnuPackage): def __init__ (self): GnuPackage.__init__ (self, 'ncurses', '5.9') self.sources.extend ([ 'https://trac.macports.org/export/136235/trunk/dports/devel/ncurses/files/hex.diff', 'https://trac.macports.org/export/136235/trunk/dports/devel/ncurses/files/ungetch_guard.diff',...
Python
0.000015
00bfd02f921a42d4f288254d1accb7546d8df2c5
Add hbase consistency check throw hbase hbck command, easily can be added some checks like backups servers or region servers
check_hbase.py
check_hbase.py
#!/usr/bin/env python # vim: ts=4:sw=4:et:sts=4:ai:tw=80 from utils import krb_wrapper,StringContext import os import argparse import nagiosplugin import re import subprocess html_auth = None def parser(): version="0.1" parser = argparse.ArgumentParser(description="Checks datanode") parser.add_argument('-...
Python
0
f865bf2d7365ccecec07be7e51e8d81676f3aae2
Add check_cycles tests module
tests/plantcv/morphology/test_check_cycles.py
tests/plantcv/morphology/test_check_cycles.py
import cv2 from plantcv.plantcv import outputs from plantcv.plantcv.morphology import check_cycles def test_check_cycles(morphology_test_data): # Clear previous outputs outputs.clear() mask = cv2.imread(morphology_test_data.ps_mask, -1) _ = check_cycles(mask) assert outputs.observations['default']...
Python
0
1ab296398aaa796a9a5b620c4281d9376ada8b3e
Add short script which prints the entire CMIP6 MIP experiment list #197.
ece2cmor3/scripts/mip-experiment-list.py
ece2cmor3/scripts/mip-experiment-list.py
#!/usr/bin/env python # Thomas Reerink # # Run example: # python mip-experiment-list.py # # Looping over all MIPs and within each MIP over all its MIP experiments. # Printing the MIP experiment list with some additional info. # from dreqPy import dreq dq = dreq.loadDreq() mip_list_file= open( 'mip-experiment-list.tx...
Python
0
6d6edeb5e1acfdc3dce2660d128a0bbf05203d87
add rss module
modules/rss.py
modules/rss.py
# -*- coding: ISO-8859-15 -*- import md5, time from xml.dom import minidom from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks from twisted.web import client from core.Uusipuu import UusipuuModule class Module(UusipuuModule): def startup(self): if 'feeds' not in self.c...
Python
0.000001
97eabd4e33086c66372b0e15dd1eeda12e99f427
Create createfile.py
createfile.py
createfile.py
import os #creates file on the go on the entries of a tuple ports=[20,21,23,25,43,49,53,69,70,79,80,109,110,115,137,139,143,161,194,389,443,444,458,546,547,1080] path=raw_input('Enter the path you want to create the files: ') try: os.chdir(path) except: print "Invalid Path" try: for i in ports: for i...
Python
0.000004
6d50dc3c266f4a1b7f517935b961cfb20602011b
add benchmark.py
suite/benchmark.py
suite/benchmark.py
#!/usr/bin/python # Simple benchmark for Capstone by disassembling random code. By Nguyen Anh Quynh, 2014 from capstone import * from time import time from random import randint def random_str(size): lst = [str(randint(0, 255)) for _ in xrange(size)] return "".join(lst) def cs(md, data): insns = md.di...
Python
0.000003
95c0d34be2699ee85d23a32384d408ac25561978
Normalize to str to work around Unicode for now
base32_crockford.py
base32_crockford.py
""" base32-crockford ================ A Python module implementing the alternate base32 encoding as described by Douglas Crockford at: http://www.crockford.com/wrmg/base32.html. According to his description, the encoding is designed to: * Be human and machine readable * Be compact * Be error resistant * ...
""" base32-crockford ================ A Python module implementing the alternate base32 encoding as described by Douglas Crockford at: http://www.crockford.com/wrmg/base32.html. According to his description, the encoding is designed to: * Be human and machine readable * Be compact * Be error resistant * ...
Python
0
78aea51f508a14bb1b03b49933576c84b56a7459
Add an example for the new dropdowns
examples/views/dropdown.py
examples/views/dropdown.py
import typing import discord from discord.ext import commands # Defines a custom Select containing colour options # that the user can choose. The callback function # of this class is called when the user changes their choice class Dropdown(discord.ui.Select): def __init__(self): # Set the options that wi...
Python
0.000003
bcb6c0780aacf77069a08f8d5b44d295881d9b9d
Create solution to swap odd even characters
swapOddEvenChar.py
swapOddEvenChar.py
#Python3 word = list(input().strip()) for i in range(0,len(word),2): if(i+1>=len(word)): break word[i],word[i+1] = word[i+1],word[i] print(''.join(word))
Python
0.000001
7bde47d48f4e80b4449049a8b05767b30eb2c516
Add stupid CSV export example
utilities/export-csv.py
utilities/export-csv.py
#!/usr/bin/python import os import csv import sys sys.path.append('../pynipap') import pynipap class Export: def __init__(self, xmlrpc_uri): self.xmlrpc_uri = xmlrpc_uri def write(self, output_file, schema_name): """ """ f = open(output_file, "w+") writer = csv.writer(f, quoting=csv.QUOTE_MINIMAL) p...
Python
0
9b6eddb88f5de1b7c44d42e1d4a3dc1c90180862
Implement deck.
onirim/deck.py
onirim/deck.py
import random class Deck: def __init__(self, cards): self._undrawn = list(cards) self._discarded = [] self._limbo = [] def draw(self, n=1): """Draw n cards.""" if n > len(self._undrawn) or n < 0: raise ValueError() drawn, self._undrawn = self._undra...
Python
0
f5711401b79433f5b52e675cec67b63f6511836a
add tests file
tests.py
tests.py
#!flask/bin/python import unittest from server import app def add(a, b): return a+b class TestCase(unittest.TestCase): def setUp(self): app.config['TESTING'] = True self.app = app.test_client() def tearDown(self): pass def test_add(self): self.assertEqual(add(1, 2), 3...
Python
0.000001
d6c310043db9862dd49d35de6bea67e120e997c7
Add file to generate a series of interfaces
simulations/interface.py
simulations/interface.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2017 Malcolm Ramsay <malramsay64@gmail.com> # # Distributed under terms of the MIT license. """Set running a series of simulations.""" import itertools import os import subprocess from pathlib import Path create_file = """#!/usr/bin/env ...
Python
0
e9d87a087a0f0102157d7c718a048c72f655c54a
Store registered refs as plugin metadata
smore/ext/marshmallow.py
smore/ext/marshmallow.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from marshmallow.compat import iteritems from marshmallow import class_registry from smore import swagger from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring def schema_definition_helper(spec, name, schema, ...
# -*- coding: utf-8 -*- from __future__ import absolute_import from marshmallow.compat import iteritems from marshmallow import class_registry from smore import swagger from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring def schema_definition_helper(name, schema, **kwar...
Python
0
e4734cb85458475ad4fd2cf66db456b7924d6fe0
Add : LFI Exploit tool
exploit-lfi.py
exploit-lfi.py
#!/usr/bin/python import argparse import base64 import re import requests import sys def scrap_results (content): # regexp regexp_start = re.compile ('.*STARTSTART.*') regexp_end = re.compile ('.*ENDEND.*') # results results = list() # result start and end found_start = False found_end...
Python
0.000001
3654817845e1d22a5b0e648a79d0bf6db12c2704
add run_sql shell command
treeherder/model/management/commands/run_sql.py
treeherder/model/management/commands/run_sql.py
import MySQLdb from optparse import make_option from django.core.management.base import BaseCommand from treeherder.model.models import Datasource from django.conf import settings class Command(BaseCommand): help = ("Runs an arbitrary sql statement or file" " on a number of databases.") option_...
Python
0.000002
31924096f82954e87b33fcb4af2e7ea46a5c6336
add map estimate of gaussian case
vlgp/gmap.py
vlgp/gmap.py
import click # import jax import numpy as onp import jax.numpy as np from jax.numpy import linalg from .evaluation import timer from .gp import sekernel from .preprocess import get_config, get_params, initialize, fill_params, fill_trials from .util import cut_trials def make_prior(trials, n_factors, dt, var, scale):...
Python
0
5b20a487afa90c0d91a43d4d29526d352511316f
add utils.py with utilities
utils.py
utils.py
from csv import DictReader import re def read_csv(filename): with open(filename) as csvfile: return list(DictReader(csvfile, dialect='excel')) def split_name(string): surname, name = re.search(r'^([A-Z\'\.\s]+)\s(.+)$', string).groups() return name, surname def iterate_names(name, surname): y...
Python
0.000001
89d8e6a8a422bade352d3bf94f2c59c1d0dc601b
Create dictionary.py
dictionary.py
dictionary.py
x = {'job': 'teacher', 'color': 'blue'} // Create a dictionary, list with defination print(x['job']) // You will see 'teacher' y = {'emotion': 'happy', 'reason': {'action': 'playing game', 'platform': 'PC'}} print(y['reason']['action']) // You will see 'playing game'
Python
0.000096
b08341d2822ad266e07d4104a45604ad9d5b504a
add unit test for text_analyzer
src/text_analyzer.py
src/text_analyzer.py
import os import unittest def analyze_text(filename): lines = 0 chars = 0 with open(filename, 'r') as f: for line in f: lines += 1 chars += len(line) return (lines, chars) class TextAnalysisTests(unittest.TestCase): """Test for the ``analyze_test()`` function""" d...
Python
0.000002
e1aa02badee2951f4f4aeeb09f37be030466e711
Add pyupgrades.py
bin/pyupgrades.py
bin/pyupgrades.py
#!/usr/bin/env python import xmlrpclib import pip import argparse import re from pkg_resources import parse_version def version_number_compare(version1, version2): return cmp(parse_version(version1), parse_version(version2)) def normalize(v): return [int(x) for x in re.sub(r'(\.0+)*$','', v).spli...
Python
0.000003
7b09a44c7df8b2aa28e45c5382626c2f8c4bf61b
Add a script to convert from rst style files to markdown
bin/run_redpen.py
bin/run_redpen.py
#!/usr/bin/python import os import re import shutil from optparse import OptionParser def main(): parser = OptionParser(usage="usage: %prog [options]", version="%prog 1.0") parser.add_option("-i", "--inputdir", action="store", dest="indir",...
Python
0
30c368f1794f7bbc4121f732143ac07e7148a3ca
Create KevinAndExpectation.py
Probability/KevinAndExpectation.py
Probability/KevinAndExpectation.py
# Importing standard libraries import sys from math import sqrt # Parsing functions def parseInt(stream): return int(stream.readline().rstrip()) ''' Dynamically precomputing the summation series for N < 10^6 so that each test case is solved in constnat time for any N less than 10^6. There fore for Ta...
Python
0
53b0d93a7a29121e9d24058bfe4b7ee3bd33f7ca
Add info for version 2.16 (#3601)
var/spack/repos/builtin/packages/ack/package.py
var/spack/repos/builtin/packages/ack/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...
############################################################################## # 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
3b30e8a66ca5a3c68055696c339a44fffc98afb3
compute jaccard with numpy boradcasting
exercise/broadcast.py
exercise/broadcast.py
import numpy as np # a = np.array([1.0, 2.0, 3.0]) # b = 2.0 # print(a * b) # x = np.arange(4) # xx = x.reshape(4,1) # # y = np.ones(5) # x = np.array([1,2]).reshape((2,1)) # y =np.arange(4).reshape((1,4)) # # print(x-y) # from numpy import array, argmin, sqrt, sum # # observation = array([111.0,188.0]) # # co...
Python
0.999999
d0d182605389ec73773df35b9e06455b9f9a2923
add get_posts
facebook/get_posts.py
facebook/get_posts.py
""" A simple example script to get all posts on a user's timeline. Originally created by Mitchell Stewart. <https://gist.github.com/mylsb/10294040> """ import facebook import requests def some_action(post): """ Here you might want to do something with each post. E.g. grab the post's message (post['message']) ...
Python
0.000005
419ca7099bf47ed00ede73d9de14690a643a3943
Add data for integration testing of basic csv and crosstab formats
test/test_integration.py
test/test_integration.py
"""Integrations tests for EcoData Retriever""" import os import shutil from retriever import HOME_DIR simple_csv = {'name': 'simple_csv', 'raw_data': "a,b,c\n1,2,3\n4,5,6", 'script': "shortname: simple_csv\ntable: simple_csv, http://example.com/simple_csv.txt", 'expect_out': ...
Python
0
465fbc1657e90134323fd05ee4216da5af110ee4
add tools
pycrawler/utils/tools.py
pycrawler/utils/tools.py
__author__ = 'mengpeng' import time def gethash(string, cap=0xffffffff): return hash(string) & cap def timestamp(): return time.strftime("%H:%M:%S", time.localtime(time.time())) def datastamp(): return time.strftime("%Y-%m-%d", time.localtime(time.time())) def fullstamp(): return time.strftime("...
Python
0.000001
1983e84e41f6dfe8b54e4a7d7535d0b89f9dd58a
add an example of a client for a change
examples/parallel_client.py
examples/parallel_client.py
'''a bunch of examples of how to get a list of urls in parallel each of them uses a different greenhouse api to retrieve a list of urls in parallel and return a dictionary mapping urls to response bodies ''' import urllib2 import greenhouse # urllib2 obviously doesn't explicitly use greenhouse sockets, but we can #...
Python
0.000001
d8fc66417860e634bbb2a6d860628b645811d62c
Add WIP for Python example
examples/python/curieimu.py
examples/python/curieimu.py
#!/usr/bin/python # Author: Ron Evans (@deadprogram) # Copyright (c) 2016 Intel Corporation. # # 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 limita...
Python
0
b78fb81cba34992bb84ed3814aae04ce05ef913f
Add del-uri.py example script
examples/scripts/del-uri.py
examples/scripts/del-uri.py
#!/usr/bin/env python3 ### # (C) Copyright (2012-2015) Hewlett Packard Enterprise Development LP # # 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 limit...
Python
0.000001
5cf3ff125226ddbf2edfad9d3c0d6ea2d59618ce
add missing file
pygraphviz/tests/test.py
pygraphviz/tests/test.py
#!/usr/bin/env python import sys from os import path,getcwd def run(verbosity=1,doctest=False,numpy=True): """Run PyGraphviz tests. Parameters ---------- verbosity: integer, optional Level of detail in test reports. Higher numbers provide more detail. doctest: bool, optional True to...
Python
0.000003
2af53a39096c0eab9d95c304c802281fe3c580ae
Make JAX CompiledFunction objects pickle-able.
tests/pickle_test.py
tests/pickle_test.py
# Copyright 2021 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.000032
c4ee6bb374e07a07bac8b8f52cf94d7d474e0e33
Fix typo in test comment
tests/test_config.py
tests/test_config.py
import os from pathlib import Path from rhizo.config import load_config def check_config(config): assert config.output_path == '/foo/bar' assert config.sub_config.a == 'test' assert config.sub_config.b == 2 assert round(config.sub_config.c - 3.14, 4) == 0 def _load_test_config(filename, use_environ...
import os from pathlib import Path from rhizo.config import load_config def check_config(config): assert config.output_path == '/foo/bar' assert config.sub_config.a == 'test' assert config.sub_config.b == 2 assert round(config.sub_config.c - 3.14, 4) == 0 def _load_test_config(filename, use_environ...
Python
0.000092
8006d142a00a6dae70850b3c9d816f745f252260
create settings file with parent_separator setting
cms/settings.py
cms/settings.py
from django.conf import settings PARENT_SEPARATOR = getattr(settings, 'MINICMS_PARENT_SEPARATOR', '/')
Python
0
7c8d43b16d6b47555caeb00234590bc8d335ed71
test markup
tests/test_markup.py
tests/test_markup.py
import pytest from rich.markup import MarkupError, _parse, render from rich.text import Span def test_parse(): result = list(_parse("[foo]hello[/foo][bar]world[/][[escaped]]")) expected = [ (None, "[foo]"), ("hello", None), (None, "[/foo]"), (None, "[bar]"), ("world", ...
Python
0.000001
93b2972c41855511cddf57029ab8fce0dccd9265
add hashtable using open addressing
ds/hash.py
ds/hash.py
'''HashTable using open addressing''' class HashTable(object): def __init__(self): self.size = 11 self.keys = [None] * self.size self.data = [None] * self.size def hash(self, key): return key % self.size def rehash(self, key): return (key + 1) % self.size def...
Python
0.000001
256e1bb8dd543051fe51b3b669ab4a10c0556f40
add back pytext
tests/test_pytext.py
tests/test_pytext.py
import unittest from pytext.config.field_config import FeatureConfig from pytext.data.featurizer import InputRecord, SimpleFeaturizer class TestPyText(unittest.TestCase): def test_tokenize(self): featurizer = SimpleFeaturizer.from_config( SimpleFeaturizer.Config(), FeatureConfig() ) ...
Python
0.000001
ea0b0e3b3ca2b3ad51ae9640f7f58d9f2737f64c
Split out runner
dox/runner.py
dox/runner.py
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # # 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.015951
af75f727e5ec22020c8d91af6a0302ea0e4bda74
Support for http://docs.oasis-open.org/security/saml/Post2.0/sstc-request-initiation-cd-01.html in the metadata.
src/saml2/extension/reqinit.py
src/saml2/extension/reqinit.py
#!/usr/bin/env python # # Generated Thu May 15 13:58:36 2014 by parse_xsd.py version 0.5. # import saml2 from saml2 import md NAMESPACE = 'urn:oasis:names:tc:SAML:profiles:SSO:request-init' class RequestInitiator(md.EndpointType_): """The urn:oasis:names:tc:SAML:profiles:SSO:request-init:RequestInitiator ...
Python
0
cfa5b544c3d44a7440feca006c01bbd72ecc0286
Test arena constants
test/test_arena.py
test/test_arena.py
from support import lib,ffi from qcgc_test import QCGCTest class ArenaTestCase(QCGCTest): def test_size_calculations(self): exp = lib.QCGC_ARENA_SIZE_EXP size = 2**exp bitmap = size / 128 effective_cells = (size - 2 * bitmap) / 16 self.assertEqual(size, lib.qcgc_arena_size) ...
Python
0.000001
12270bc14b44343b4babef3b6445074685b59bd7
Create histogram.py
python/histogram.py
python/histogram.py
import sys histogram = dict() bin_width = 5 max_index = 0 for line in sys.stdin: if not line: continue number = int(line) bin_index = number / bin_width if bin_index not in histogram: histogram[bin_index] = 0 histogram[bin_index] = histogram[bin_index] + 1 if bin_index > max_...
Python
0.00286
8b6b30997816bae1255c3e035851b8e6edb5e4c7
add a test
python/test/test.py
python/test/test.py
import unittest import os import couchapp.utils class CouchAppTest(unittest.TestCase): def testInCouchApp(self): dir_, file_ = os.path.split(__file__) if dir_: os.chdir(dir_) startdir = os.getcwd() try: os.chdir("in_couchapp") os.chdir("install...
Python
0.000002
952438d97fc0c96afaf505469cc7b9cb0c9f287d
Add config file with the list of relays availables
relay_api/conf/config.py
relay_api/conf/config.py
# List of available relays relays = [ { "id": 1, "gpio": 20, "name": "relay 1" }, { "id": 2, "gpio": 21, "name": "relay 2" } ]
Python
0
b5083af1cce5fb5b9c7bb764b18edce8640bd3a1
add utilLogger.py from toLearn/ and update to v0.4
utilLogger.py
utilLogger.py
import os.path import datetime ''' v0.4 2015/11/30 - comment out test run - add from sentence to import CUtilLogger v0.3 2015/11/30 - change array declaration to those using range() - __init__() does not take saveto arg - automatically get file name based on the date v0.2 2015/11/30 - update add() to handle ...
Python
0
99f5d264ab88573e0541c529eca905b8a1d16873
Bump to 0.5.3 dev.
rbtools/__init__.py
rbtools/__init__.py
# # __init__.py -- Basic version and package information # # Copyright (c) 2007-2009 Christian Hammond # Copyright (c) 2007-2009 David Trowbridge # # 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 So...
# # __init__.py -- Basic version and package information # # Copyright (c) 2007-2009 Christian Hammond # Copyright (c) 2007-2009 David Trowbridge # # 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 So...
Python
0
90948c62d1d01800c6a75dd5f15d7fef334dc66f
Add python unittests
noticeboard/test_noticeboard.py
noticeboard/test_noticeboard.py
import os import json import tempfile import unittest from noticeboard import noticeboard class TestNoticeboard(unittest.TestCase): def setUp(self): self.fd, noticeboard.app.config["DATABASE"] = tempfile.mkstemp() noticeboard.app.config["TESTING"] = True self.app = noticeboard.app.test_cl...
Python
0.000003
17fcdd9a01be24ad9562e5a558e2dd65a84d1a19
Add missing tests/queuemock.py
tests/queuemock.py
tests/queuemock.py
# -*- coding: utf-8 -*- # # 2019-01-07 Friedrich Weber <friedrich.weber@netknights.it> # Implement queue mock # # License: AGPLv3 # contact: http://www.privacyidea.org # # This code is free software; you can redistribute it and/or # modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE # L...
Python
0.000003
6083124c110e0ce657b78f6178cd7464996a042b
add tests I want to pass
tests/test_geometries.py
tests/test_geometries.py
"""This contains a set of tests for ParaTemp.geometries""" ######################################################################## # # # This script was written by Thomas Heavey in 2017. # # theavey@bu.edu thomasjheavey...
Python
0
8c9034e91d82487ae34c592b369a3283b577acc8
Add a new test for the latest RegexLexer change, multiple new states including '#pop'.
tests/test_regexlexer.py
tests/test_regexlexer.py
# -*- coding: utf-8 -*- """ Pygments regex lexer tests ~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Georg Brandl. :license: BSD, see LICENSE for more details. """ import unittest from pygments.token import Text from pygments.lexer import RegexLexer class TestLexer(RegexLexer): """Test tuple st...
Python
0
ba0c292753355e5ff7e8e131c61e8086f31b3b76
Create src/task_2_0.py
src/task_2_0.py
src/task_2_0.py
# Раздел 1. Задача 2. Вариант 0. # Напишите программу, которая будет выводить на экран наиболее понравившееся вам высказывание, автором которого является Ф.М.Достоевский. Не забудьте о том, что автор должен быть упомянут на отдельной строке. print("Жизнь, везде жизнь, жизнь в нас самих, а не во внешнем.") print(...
Python
0.000039
6f00204ae2603063eafbd74a369e9da0864854ca
Create new monthly violence polls
poll/management/commands/create_new_violence_polls.py
poll/management/commands/create_new_violence_polls.py
#!/usr/bin/python # -*- coding: utf-8 -*- from django.core.management.base import BaseCommand import traceback from poll.models import Poll from unregister.models import Blacklist from django.conf import settings from optparse import make_option from poll.forms import NewPollForm from django.contrib.sites.models impo...
Python
0.000002
23c09555221b3f7500a4c658452c9c0cb223799c
Add evaluation using random forest
Train_SDAE/tools/evaluate_model.py
Train_SDAE/tools/evaluate_model.py
import numpy as np # import pandas as pd # import sys from scipy.special import expit from sklearn import ensemble def get_activations(exp_data, w, b): exp_data = np.transpose(exp_data) prod = exp_data.dot(w) prod_with_bias = prod + b return( expit(prod_with_bias) ) # Order of *args: first all the wei...
Python
0
009df3372804fa946b7e1bd4c0827e887b964b38
Convert blogger to simple xml
convert.py
convert.py
from bs4 import BeautifulSoup import io import markdown2 import time import codecs file = io.open("Import/blog-03-03-2013.xml") file_contents = file.read(-1) #lxml xpath doesn't seem to understand blogger export soup = BeautifulSoup(file_contents) entries = soup("entry") count = 0 def formatTime(timefield): tim...
Python
0.999999
8348ce87a68592e7108c43687ebfdf12684a1914
Add elementTypes.py file
elementTypes.py
elementTypes.py
class elementC3D10(): def __init__(self): self.name = 'C3D10' self.desc = 'Quadratic tetrahedral element' self.numNodes = 10 self.numIntPnts = 4 self.N = array(self.numNodes) self.setIpcs() def setIpcs(self): alpha = 0.177083333...
Python
0.000001
e789fb7246e7b926841f2d2912896fd0a0d14518
Create login_portal.py
login_portal.py
login_portal.py
from splinter import Browser print 'Starting...' browser = Browser('firefox') # using firefox browser.visit("http://portal.ku.edu.kw/sisapp/faces/login.jspx") browser.fill('username','xxxxx') # enter student ID browser.fill('password','yyyyy') # enter password browser.find_by_id('loginBtn').click() ...
Python
0.000001
82acd4827b2f3f426a6b97f474c54886758cfab7
add code to update fields
obztak/scratch/update-fields.py
obztak/scratch/update-fields.py
#!/usr/bin/env python """ Update survey fields """ __author__ = "Alex Drlica-Wagner" import copy import fitsio import numpy as np import pylab as plt import skymap from obztak.utils import fileio import obztak.delve from obztak.delve import DelveFieldArray import argparse parser = argparse.ArgumentParser(descriptio...
Python
0.000001
7d5dcaa0a72dbdd78e192f082bbdf261de1d8963
Delete occurrences of an element if it occurs more than n times
Codewars/DeleteOccurrencesOfElementOverNTimes.py
Codewars/DeleteOccurrencesOfElementOverNTimes.py
# implemented with list comprehension with side-effects and a global variable # there's a simpler way to do it with list appends that's probably no less efficient, since Python arrays are dynamic, but I wanted to try this out instead from collections import Counter c = Counter() # for use in list comprehensions with...
Python
0.000001
c7c7281fc964ac25aea291f18bbf29013f3f3d58
question 7.1
crack_7_1.py
crack_7_1.py
def fib_slow(number): if number == 0: return 1 elif number == 1: return 1 else: return fib_slow(number-1) + fib_slow(number-2) def fib_fast(number): if numbers[number] == 0: if number == 0 or number == 1: numbers[number] = 1 return numbers[number] else: temp = fib_fast(number-1) + fib_fast(number-2)...
Python
0.99996
895570ad25b1475c1e9ce85a78f22f268dce8dec
Add visualization script
tools/visoutput.py
tools/visoutput.py
#!/usr/bin/env python """ An animated image """ import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button import sys d_arr = [] t_arr = [] hs =[] width = 0.35 maxpressure = 0.0 for line in sys.stdin: toks = line.split(" ") t_arr.append(toks[0]) d_arr.append((float(toks...
Python
0.000001
1c4adbe07892d95ca6254dcc2e48e11eb2141fa7
Create pixelconversor.py
Art-2D/pixelconversor.py
Art-2D/pixelconversor.py
//This program rake a image an convert it in 2D pixel art.
Python
0.000003
096c8165ec2beacbc4897285b8fed439765d3e01
Add test on update document title
test/integration/ggrc/models/test_document.py
test/integration/ggrc/models/test_document.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Integration tests for Document""" from ggrc.models import all_models from integration.ggrc import TestCase from integration.ggrc.api_helper import Api from integration.ggrc.models import factories clas...
Python
0
5172dcb5edd09afce992d237bd31700251fca4bd
Remove useless optional style argument to notify()
Bindings/python/Growl.py
Bindings/python/Growl.py
""" A Python module that enables posting notifications to the Growl daemon. See <http://sourceforge.net/projects/growl/> for more information. Requires PyObjC 1.1 <http://pyobjc.sourceforge.net/> and Python 2.3 <http://www.python.org/>. Copyright 2003 Mark Rowe <bdash@users.sourceforge.net> Released under the BSD l...
""" A Python module that enables posting notifications to the Growl daemon. See <http://sourceforge.net/projects/growl/> for more information. Requires PyObjC 1.1 <http://pyobjc.sourceforge.net/> and Python 2.3 <http://www.python.org/>. Copyright 2003 Mark Rowe <bdash@users.sourceforge.net> Released under the BSD l...
Python
0
41752bfcbc0a1afdf7a0f3caa52285af08d131dd
Create get_var.py
get_var.py
get_var.py
import parse_expr variables = {} def getVar(key): if key[0] == '%': return variables[key[1:]] elif key[-1] in ('+', '-', '/', '*'): return parse_expr(key) else: return key
Python
0.000002
e42142498f2ef2b3e78d1becb024441500902a79
add corruptor
test/corrupt.py
test/corrupt.py
#!/usr/bin/env python from __future__ import print_function import os import sys import random if len(sys.argv) != 3 and not sys.argv[2]: print(''' Usage: corrupt.py filename magic_string magic_string is what you want to write to the file it can not be empty and will be randomly placed \n\n''') ...
Python
0.999262
d2f18cc0992d4d7217583cd2601bc90afaa93a04
add grain that detects SSDs
salt/grains/ssds.py
salt/grains/ssds.py
# -*- coding: utf-8 -*- ''' Detect SSDs ''' import os import salt.utils import logging log = logging.getLogger(__name__) def ssds(): ''' Return list of disk devices that are SSD (non-rotational) ''' SSDs = [] for subdir, dirs, files in os.walk('/sys/block'): for dir in dirs: ...
Python
0.000002
936c2327d6be9da48dfbef47c17167510e9c2262
Create bzip2.py
wigs/bzip2.py
wigs/bzip2.py
class bzip2(Wig): tarball_uri = 'http://www.bzip.org/1.0.6/bzip2-$RELEASE_VERSION$.tar.gz' last_release_version = 'v1.0.6'
Python
0.000007
c2ca8328835d544440fd3b87813e2768ece58685
Add new package: audacious (#16121)
var/spack/repos/builtin/packages/audacious/package.py
var/spack/repos/builtin/packages/audacious/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 Audacious(AutotoolsPackage): """A lightweight and versatile audio player.""" homepage...
Python
0.00002
4287d2290c581b907b08efabc1e6bccea4019ac6
add new package (#15743)
var/spack/repos/builtin/packages/py-pyface/package.py
var/spack/repos/builtin/packages/py-pyface/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) class PyPyface(PythonPackage): """The pyface project contains a toolkit-independent GUI abstraction layer, which ...
Python
0
be0033ac91c28f3e45eff34c84b7da59d7fcefe2
add py-ranger package (#3258)
var/spack/repos/builtin/packages/py-ranger/package.py
var/spack/repos/builtin/packages/py-ranger/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
7e4a62aa483fbadc7089144191e48948f419903b
add setup.py
py/setup.py
py/setup.py
#!/usr/bin/env python # vim: set fileencoding=utf8 shiftwidth=4 tabstop=4 textwidth=80 foldmethod=marker : # Copyright (c) 2010, Kou Man Tong. All rights reserved. # For licensing, see LICENSE file included in the package. from distutils.core import setup setup(name = "vtdb", packages=["vtdb", "net"], platforms =...
Python
0
a8f1529f6c077c0d70ccb326da6e63f3dd78ec76
move kernel sanitization to separate script
sanitize_kernels.py
sanitize_kernels.py
import glob import nbformat #sanitize kernelspec notebooks = glob.glob("notebooks/*.ipynb") old_envs = {} for nb in notebooks: tmp = nbformat.read(nb,4) old_envs[nb] = tmp['metadata']['kernelspec']['name'] tmp['metadata']['kernelspec']['name'] = 'python2' nbformat.write(tmp,nb) #revert kernelspec #for...
Python
0.000001
9b4f18dbf63a76bd2c0723677fb0d0215831324a
Create __init__.py
ext/__init__.py
ext/__init__.py
Python
0.000429