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
a5aadd892df181a8e4a48ceebedff48211d5d22c
Add paver file.
pavement.py
pavement.py
import os import subprocess import sphinx import setuptools import numpy.distutils import paver import paver.doctools import common from setup import configuration options( setup=Bunch( name=common.DISTNAME, namespace_packages=['scikits'], packages=setuptools.find_packag...
Python
0
91d83745d94ba0eeb06d6d12eb32d5950963ad2a
move backend definition
ldapdb/backends/ldap/base.py
ldapdb/backends/ldap/base.py
# -*- coding: utf-8 -*- # # django-ldapdb # Copyright (c) 2009-2010, Bolloré telecom # All rights reserved. # # See AUTHORS file for a full list of contributors. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # ...
Python
0.000002
f3eb1c8efbcd3695dba0037faa4f90328625f547
Add script for creating numeric passwordlists using permutation & combination.
permcomb.py
permcomb.py
#!/usr/bin/python import itertools import sys def combination(elements,items): for combination in itertools.product(xrange(elements), repeat=items): print ''.join(map(str, combination)) if len(sys.argv) == 3: allSet = int(sys.argv[1]) setItems = int(sys.argv[2]) if allSet >= setItems: ...
Python
0
b01076381ebc91f20c527f1632c7b3f2aa82d39a
Add a very simple performance testing tool.
perftest.py
perftest.py
""" Simple peformance tests. """ import sys import time import couchdb def main(): print 'sys.version : %r' % (sys.version,) print 'sys.platform : %r' % (sys.platform,) tests = [create_doc, create_bulk_docs] if len(sys.argv) > 1: tests = [test for test in tests if test.__name__ in sys.argv...
Python
0.000001
29c59fcbe8b15e37e96fec43e613d6f537727ea2
Create Base64_Demo.py
Base64_Demo/Base64_Demo.py
Base64_Demo/Base64_Demo.py
# -*- coding: utf8 -*- ''' @brief 用base64加密,解密(必须为ascii) ''' import base64 ''' @brief 编码加密 @params content 要编码加密的内容(必须为ascii) ''' def encrypt_base64(content): return base64.b64encode(content) ''' @brief 解码解密 @params secretContent 要解密的内容 ''' def decrypt_base64(secretContent): return base64.b64decode(secretC...
Python
0.000002
ff7292352b7d4b1609f077c3650d94a3c83051fc
Add property.py.
ibus/property.py
ibus/property.py
import dbus PROP_TYPE_NORMAL = 0 PROP_TYPE_TOGGLE = 1 PROP_TYPE_RADIO = 2 PROP_TYPE_SEPARATOR = 3 PROP_STATE_UNCHECKED = 0 PROP_STATE_CHECKED = 1 PROP_STATE_INCONSISTENT = 2 class Property: def __init__ (self, name, type = PROP_TYPE_NORMAL, label = "", icon = "", tip = "", sensitive =...
Python
0
55ee2e14a173ea68f3ed02edbd525a6538dd0c0c
add deploy.py script
improv/deploy.py
improv/deploy.py
import os, shutil, zipfile AppName = 'ImprovAlpha4.app' def mkdir(path): if os.path.exists(path): return os.mkdir(path) def rmdir(path): if not os.path.exists(path): return if os.path.isdir(path): shutil.rmtree(path) else: os.remove(path) def copy(path, dest): ...
Python
0.000002
fbf91352da4cf16be8462f57c71aa9f86f21746f
Add class balance checking code
amaranth/data_analysis/class_balance.py
amaranth/data_analysis/class_balance.py
# Lint as: python3 """This script checks the balance of classes in the FDC dataset. Classes are split based on LOW_CALORIE_THRESHOLD and HIGH_CALORIE_THRESHOLD in the amaranth module. """ import os import pandas as pd import amaranth from amaranth.ml import lib FDC_DATA_DIR = '../../data/fdc/' def main(): # Rea...
Python
0
85bd9515a92b3e603c2113919230d37729a0bd44
add Python3LexerBase.py
python/python3/Python/Python3LexerBase.py
python/python3/Python/Python3LexerBase.py
from typing import TextIO from antlr4 import * from antlr4.Token import CommonToken from .Python3Parser import Python3Parser import sys from typing import TextIO import re class Python3LexerBase(Lexer): NEW_LINE_PATTERN = re.compile('[^\r\n\f]+') SPACES_PATTERN = re.compile('[\r\n\f]+') def __init__(sel...
Python
0.000001
7432e7fb9ad5199ef3f55e7c85e542eaef4237da
Add pelicanconf_sample.py
pelicanconf_sample.py
pelicanconf_sample.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals # The followings are recommanded to set them up. AUTHOR = '' SITENAME = '' SITEURL = '' SITE_DESCRIPTION = '' SELF_INTRO = 'A brief introduction about yourself.' PATH = 'content' DEFAULT_LANG = '' THEME = '' TIMEZONE = '' LI...
Python
0.000002
7eab5ef84db52800912b8cfcc9d631655c002a3f
read pg_hba.conf and resolve DNS names to addresses
pg/pg_hba_resolver.py
pg/pg_hba_resolver.py
#!/usr/bin/python """ pg_hba_resolver - read pg_hba.conf and resolve DNS names to addresses Copyright (C) 2016, https://aiven.io/ This file is under the Apache License, Version 2.0. See http://www.apache.org/licenses/LICENSE-2.0 for details. Read pg_hba.conf and look for comment lines ending with a '# RESOLVE' tag: ...
Python
0
93b2d93098c395d866f18e51b6ac42a9ba81a9b5
Test if C changes with more examples.
exp/modelselect/RealDataSVMExp.py
exp/modelselect/RealDataSVMExp.py
""" Observe if C varies when we use more examples """ import logging import numpy import sys import multiprocessing from apgl.util.PathDefaults import PathDefaults from apgl.predictors.AbstractPredictor import computeTestError from exp.modelselect.ModelSelectUtils import ModelSelectUtils from apgl.util.Sampling...
Python
0
d8e0104c92d9457ba60285cb856d8f435e0e08bd
Add initial setup script
initial-setup.py
initial-setup.py
import pickle from pathlib import Path import joseconfig as jcfg # touch files Path(jcfg.jcoin_path).touch() Path('db/jose-data.txt').touch() def initialize_db(path): with open(path, 'wb') as f: pickle.dump({}, f) # initialize databases initialize_db(jcfg.jcoin_path) initialize_db('ext/josememes.db')
Python
0.000001
40d8cf13bd91b2da43c5cecedcabc8e794f7febd
Add __init__.py to suite/wrappers directory.
dm_control/suite/wrappers/__init__.py
dm_control/suite/wrappers/__init__.py
# Copyright 2018 The dm_control 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/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
Python
0.000005
7515f9de3e1aab11eb6ffae93cbff7290557c6af
Make functions visible
maediprojects/views/codelists.py
maediprojects/views/codelists.py
from flask import Flask, render_template, flash, request, Markup, \ session, redirect, url_for, escape, Response, abort, send_file, jsonify from flask.ext.login import login_required, current_user from maediprojects import app, db, models from maediprojects.query import activity as qact...
Python
0.000013
50e4d81b034c930784df2cab36ba3f7ff726d6d8
Add ETCD implementation for NB API
dragonflow/db/drivers/etcd_nb_impl.py
dragonflow/db/drivers/etcd_nb_impl.py
# Copyright (c) 2015 OpenStack Foundation. # # 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 # # Unle...
Python
0.000002
254a9b90f72addbe518e81a269fa66abefd4609d
Add files via upload
dataset_generator.py
dataset_generator.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import csv import tables alphabet = "abcdefghijklmnopqrstuvwxyz0123456789-,;.!?:'\"/\\|_@#$%^&*~`+-=<>()[]{} " sequence_max_length = 1024 num_classes = 14 def pad_sentence(char_seq, padding_char=" "): num_padding = sequence_max_length - len(cha...
Python
0
9d490a562577a8391d673d20d6a5f84b86affa5d
basic language supporting framework
src/arena/language.py
src/arena/language.py
from arena.cmd import Cmd class Language(object): def __init__(self, cmd: str, run_switch: str): self._cmd = cmd self._run_switch = run_switch @property def cmd(self): return self._cmd @property def run_switch(self): return self._run_switch class Compile(Cmd): ...
Python
0.998859
476ccea37c0509f55be1bbeb90fdd999e3b3f3b4
Create bip-0070-payment-protocol.py
examples/bip-0070-payment-protocol.py
examples/bip-0070-payment-protocol.py
#!/usr/bin/python2.7 # # bip-0070-payment-protocol.py # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # """Bip-0070-related functionality Handles incoming serialized string data in the form of a http request and returns an...
Python
0.000006
5a471d778a8affea5552923a8fbd74a61bcc81f1
add radiometric_normalization.py - need to test on remote server
radiometric_normalization/radiometric_normalization.py
radiometric_normalization/radiometric_normalization.py
import numpy from radiometric_normalization.time_stack import time_stack from radiometric_normalization.pif import pif from radiometric_normalization.transformation import transformation from radiometric_normalization.validation import validation from radiometric_normalization import gimage def generate_luts(candida...
Python
0
08493dd851a5023057c6f5b3439d3e965b256bf8
add aux script
genomes/scripts/other/fix_hg19_exons.py
genomes/scripts/other/fix_hg19_exons.py
#!/usr/bin/env python import numpy as np import sys import re fin = open("genes.hg19.out", 'r') fout = open("genes.hg19.exons.temp", 'w') line=fin.readline() for line in fin: fields = line.strip().split() chr = fields[2] strand = fields[3] gene = fields[1] exon_start = fields[9].split(',')[:-1] exon_end...
Python
0.000001
7997d02e52172b8ad0e96a845f953f90a6e739b7
Add VSYNC GPIO output example.
scripts/examples/02-Board-Control/vsync_gpio_output.py
scripts/examples/02-Board-Control/vsync_gpio_output.py
# VSYNC GPIO output example. # # This example shows how to toggle the IR LED pin on VSYNC interrupt. import sensor, image, time from pyb import Pin sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesiz...
Python
0
7d88a914cba0141a0f1b0b35a84e2d82aa7b080e
Create code_3.py
MPI_Practice_Examples/code_3.py
MPI_Practice_Examples/code_3.py
import numpy import sys from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() randNum = numpy.zeros(1) rank = 1 a=input("number of processes ?? \n") while(rank<a): randNum = numpy.random.random_sample(1) print "Process", rank, "draw the number", randNum[0] comm.Send(rand...
Python
0.001391
4d4a862aa81218b788e961916115667a212f42e0
Add conftest.py to allow skipping slow test.
conftest.py
conftest.py
import pytest def pytest_addoption(parser): parser.addoption("--runslow", action="store_true", help="run slow tests") def pytest_runtest_setup(item): if 'slow' in item.keywords and not item.config.getoption("--runslow"): pytest.skip("need --runslow option to run")
Python
0
4d0e0a4c7fb70838427212180bb213061f0b67ea
Create config11.py
config11.py
config11.py
provider "aws" { access_key = "AKIAJCJUB35JFIDR5XWW" secret_key = "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" region = "${var.region} }
Python
0.000002
1e79c1580055d2279b1a8523a2b382d98fe6cad3
Configure minimal django settings
conftest.py
conftest.py
from django.conf import settings def pytest_configure(): settings.configure( INSTALLED_APPS = ( 'caspy', 'rest_framework', ), ROOT_URLCONF = 'caspy.urls', DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', ...
Python
0
7d29d96385ec9a3274f5e6409e04635e89f8c8c9
Create find-anagram-mappings.py
Python/find-anagram-mappings.py
Python/find-anagram-mappings.py
# Time: O(n) # Space: O(n) class Solution(object): def anagramMappings(self, A, B): """ :type A: List[int] :type B: List[int] :rtype: List[int] """ lookup = collections.defaultdict(collections.deque) for i, n in enumerate(B): lookup[n].append(i) ...
Python
0.000096
da9ed4dacbeaf7f8ec3873b658547a215f9d6920
Create __init__.py
anemoi/io/__init__.py
anemoi/io/__init__.py
Python
0.000429
a228f5874d6d419a6333b91abceaf2c50843f92e
Create multObjShapeUpdate.py
af_scripts/tmp/multObjShapeUpdate.py
af_scripts/tmp/multObjShapeUpdate.py
import maya.cmds as cmds def multObjShapeImport(): files_to_import = cmds.fileDialog2(fileFilter = '*.obj', dialogStyle = 2, caption = 'import multiple object files', fileMode = 4,okc="Import") for file_to_import in files_to_import: object_name = file_to_import.split('/')[-1].split('.obj')[0] ...
Python
0
8056aa34ac52a09952e3588605ce0e1a8642e29a
Create Final-Project.py
Final-Project.py
Final-Project.py
Python
0
4a1644452b7ddf8e18a57e6520bf7be8b060b7f7
Add Sorting Comparator solution
algorithms/sorting/sorting_comparator.py
algorithms/sorting/sorting_comparator.py
# https://www.hackerrank.com/challenges/ctci-comparator-sorting/problem from functools import cmp_to_key class Player: def __init__(self, name, score): self.name = name self.score = score def comparator(a, b): if a.score == b.score: if a.name >= b.name: r...
Python
0
15d21e8ce24e8058db26035e192ee2ba240c7184
Update clusters tasks
api/clusters/tasks.py
api/clusters/tasks.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import logging from polyaxon_k8s.manager import K8SManager from api.settings import CeleryTasks, CeleryRoutedTasks from api.celery_api import app as celery_app logger = logging.getLogger('polyaxon.tasks.clusters') @celery_app...
Python
0.000001
ffed6fb5b853f621af0e242abf00d97defc2a4a8
add audio setup routine
audio.py
audio.py
# # Set Up Audio Pairing with Alexa from a Pi # import os import sys import secrets as s from pulsectl import Pulse def run(cmd): print("Executing:"+cmd) os.system(cmd) def btctl(cmd): print("Sending "+cmd+" to bluetoothctl...") os.system('echo -e "'+cmd+'\nquit\n"|bluetoothctl') try: p=Pulse() ...
Python
0
b2a4709eae73786b40b4d0f58b1e02075ce023b3
Create blink.py
blink.py
blink.py
import RPi.GPIO as GPIO import time # blinking function def blink(pin): GPIO.output(pin,GPIO.HIGH) time.sleep(1) GPIO.output(pin,GPIO.LOW) time.sleep(1) return # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # set up GPIO output channel GP...
Python
0.000024
bae50ccc70a077944c92738faf2009df28ae75a7
Add Python boilerplate
bp/bp.py
bp/bp.py
# Python 3.6.1 with open('input.txt', 'r') as f: puzzle_input = f.read().split() # Code here
Python
0.000189
2585b44484b175bb116c228496069cc4269440c0
Add python tests for cosine squared angles
hoomd/md/test-py/test_angle_cosinesq.py
hoomd/md/test-py/test_angle_cosinesq.py
# -*- coding: iso-8859-1 -*- # Maintainer: joaander from hoomd import * from hoomd import md context.initialize() import unittest import os import numpy # tests md.angle.cosinesq class angle_cosinesq_tests (unittest.TestCase): def setUp(self): print snap = data.make_snapshot(N=40, ...
Python
0.000015
cbbe6f4709763c44ca0185f7e9127a0737525aff
add test_iterator_example.py
tests/test_iterator_example.py
tests/test_iterator_example.py
#!/usr/bin/env python import alphatwirl import unittest ##____________________________________________________________________________|| def genFunc(): yield 101 yield 102 yield 103 ##____________________________________________________________________________|| class IteClass(object): def __init__(se...
Python
0.00003
ea4e0742317b2b26dc8fa9ddca79b1179f301329
Add protocol module
protocol.py
protocol.py
#Copyright (C) 2017 Oscar Triano 'dotoscat' <dotoscat (at) gmail (dot) com> #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) any later ...
Python
0.000001
9912b5a8fd981bae9ab003eb8386643661918cde
fix name OUtsideBrightness Sensor
all_module/OutsideBrightnessSensor.py
all_module/OutsideBrightnessSensor.py
from twisted.internet import reactor import core.module import core.fields import core.fields.io import core.fields.persistant import time class OutsideBrightness(core.module.Base): update_rate = 10 class Brightness( core.fields.sensor.Light, core.fields.io.Readable, core.fi...
Python
0.999776
6b142bc64f5966c695907692c29f52fce808a78d
add poll demo for linux platform
network/echo-server/echo-poll/lnx_poll.py
network/echo-server/echo-poll/lnx_poll.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # Copyright (c) 2016 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright...
Python
0.000001
d168256dd4b75375770b3391f716ceaba2cf722e
Add scrapper of Bureau of Labor Statistis Employment status
cpsScrap.py
cpsScrap.py
#user/local/bin/python #uses python3 import urllib.request from bs4 import BeautifulSoup url = "http://www.bls.gov/cps/cpsaat01.htm" #access the search term through website page = urllib.request.urlopen(url).read() soup = BeautifulSoup(page) tables = soup.findAll('table') #find all tables #print(tables) mainTable = so...
Python
0
cbbd59ad8714bb7ed05f5ffa01bc0728fdbe23e6
Move test_power_governor into separate python test file
integration/test/test_power_governor.py
integration/test/test_power_governor.py
#!/usr/bin/env python # # Copyright (c) 2015, 2016, 2017, 2018, 2019, 2020, Intel Corporation # # 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 copyrig...
Python
0
7bdfc081cee0326d54c667bed8f870427fe2eeb6
Add new file createDB.py
createDB.py
createDB.py
#!/usr/bin/python #coding=utf-8 import MySQLdb db = MySQLdb.connect("localhost", "root", "soeasy", "free_time") cursor = db.cursor(); cursor.execute("drop table lib"); cursor.execute(''' create table lib ( id char(8) not null, name varchar(10) not null, Mon_m1 bool, Mon_m2 bool, Mon_a1 bool, Mon_a2 bool, Mon_e boo...
Python
0.000002
eebe75ffbe39e7f8f91c3e3a425c7058f7bd8f01
Write some preliminary code for undersampling component
projects/component.py
projects/component.py
from tfx import v1 as tfx from tfx.types import artifact_utils from tfx.utils import io_utils from tfx.components.util import tfxio_utils from tfx.dsl.component.experimental.decorators import component import apache_beam as beam import random @component def UndersamplingComponent( examples: tfx.dsl.components.Inpu...
Python
0.000002
d377867ea501c4d9dae1f5c3ce1efc02f0a9639b
check Python version
pympler/sizer/__init__.py
pympler/sizer/__init__.py
# check supported Python version import sys if getattr(sys, 'hexversion', 0) < 0x2020000: raise NotImplementedError('sizer requires Python 2.2 or newer') from asizeof import *
from asizeof import *
Python
0.000001
39de01462baf3db60c5a0f5d8a3b529f798730ab
Add script to check the performance
pygraphc/bin/Check.py
pygraphc/bin/Check.py
import csv from os import listdir from pygraphc.evaluation.ExternalEvaluation import ExternalEvaluation # read result and ground truth result_dir = '/home/hudan/Git/pygraphc/result/improved_majorclust/Kippo/per_day/' groundtruth_dir = '/home/hudan/Git/labeled-authlog/dataset/Kippo/attack/' result_files = listdir(resul...
Python
0
477d310ca2add1a5fd539159592f36ca626502f0
add way to read geotiffs
python/geotiffgrid.py
python/geotiffgrid.py
import gdal from spacegrid import SpatialGrid class GeotiffGrid(SpatialGrid): def __init__(self, filepath): ds = gdal.Open(filepath) x0_corner, sizex, zero1, y0_corner, zero2, sizey = ds.GetGeoTransform() band = ds.GetRasterBand(1) array = band.ReadAsArray() self.array = ar...
Python
0
771e764618cc6bf7c9eba6d3c897b778504cdb3e
Add DB migration script for #13
migrations/versions/2bac10743c4e_use_single_table_for_course_entities.py
migrations/versions/2bac10743c4e_use_single_table_for_course_entities.py
"""Use single table for course entities Revision ID: 2bac10743c4e Revises: 5225efebb497 Create Date: 2016-01-01 21:46:48.053759 """ # revision identifiers, used by Alembic. revision = '2bac10743c4e' down_revision = '5225efebb497' from alembic import op from sqlalchemy.sql import table, column, select, null import s...
Python
0
8da927a0a196301ce5fb2ef2224e556b4d414729
Add solution for counting DNA nucleotides
problem1.py
problem1.py
from collections import Counter if __name__ == '__main__': with open('data/rosalind_dna.txt', mode='r') as f: sequence = f.read() counts = Counter(sequence) print '%d %d %d %d' % (counts['A'], counts['C'], counts['G'], counts['T'])
Python
0.00001
572c8bdc1b18620857db9f61386fed5234bce957
Create searchBook.py
searchBook.py
searchBook.py
# sudo apt install python-lxml,python-requests from lxml import html import requests urlPrefix = 'https://book.douban.com/subject/' candidateBookNums = [] candidateBookNums.append('3633461') selectedBooks = {} # i = 1 while candidateBookNums: bookNum = candidateBookNums.pop(0) bookUrl = urlPrefix + str(bookNum) ...
Python
0
a2f6a399c643b89c73aca2335b938f584cd572d5
create Page object to better organize Links
page.py
page.py
from bs4 import BeautifulSoup, SoupStrainer from link import Link import requests class Page(object): def __init__(self, full_hyperlink, links=None): self.full_hyperlink = full_hyperlink self.links = links # This doesn't feel great, maybe pull root_url creation method out of Link? ...
Python
0
5178b104993401f47b1c4d8e3c796bef379e389e
Add migration for `communities` app.
letsmeet/communities/migrations/0011_auto_20160318_2240.py
letsmeet/communities/migrations/0011_auto_20160318_2240.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-03-18 21:40 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('communities', '0010_auto_20160108_1618'), ] operations = [ migrations.AlterModelManager...
Python
0
bb04b6771ccc39d86ea099f595d64c64ee2974f8
Add a cookbook recipe for DipoleMagDir class
cookbook/gravmag_magdir_dipolemagdir.py
cookbook/gravmag_magdir_dipolemagdir.py
""" GravMag: Use the DipoleMagDir class to estimate the magnetization direction of dipoles with known centers """ import numpy from fatiando import mesher, gridder from fatiando.utils import ang2vec, contaminate from fatiando.gravmag import sphere from fatiando.vis import mpl from fatiando.gravmag.magdir import Dipol...
Python
0.000001
5c0b2d662b08f49b5de1393c7db9826203e842e8
add tool for count words
putils/tools/words_length.py
putils/tools/words_length.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # count how much word in one line, get the statistics result # # @Author : Jasonwbw@yahoo.com import sys des = '<input file name> [-p parts] [-c threshold]' + \ '\n\tcompute average word count for each line, default will print out int average length, standard varian...
Python
0.000001
3b00a03240ba4c19c1b6a0dc03e22616ae3fda80
Make grip import optional so that grip installation is optional.
py/generate_rest_api_docs.py
py/generate_rest_api_docs.py
# TODO: ugh: import sys, pprint, argparse, string, errno sys.path.extend(['.','py']) import h2o, h2o_util import os # print "ARGV is:", sys.argv here=os.path.dirname(os.path.realpath(__file__)) parser = argparse.ArgumentParser( description='Attach to an H2O instance and call its REST API to generate the REST AP...
# TODO: ugh: import sys, pprint, argparse, string, errno sys.path.extend(['.','py']) import h2o, h2o_util import os # https://github.com/joeyespo/grip # Transform GitHub-flavored Markdown to HTML from grip import export # print "ARGV is:", sys.argv here=os.path.dirname(os.path.realpath(__file__)) parser = argparse...
Python
0
eee85e5157d69cee515c01fa0f638b064de74a6e
Add a script to graph problem reports over time by transport mode
script/graph-reports-by-transport-mode.py
script/graph-reports-by-transport-mode.py
#!/usr/bin/python # A script to draw graphs showing the number of reports by transport # type each month. This script expects to find a file called # 'problems.csv' in the current directory which should be generated # by: # DIR=`pwd` rake data:create_problem_spreadsheet import csv import datetime from collecti...
Python
0
bdbf5f538ea15360004a4efe769b629c3032b4bb
add admin view for eventschedule
lib/rapidsms/contrib/scheduler/admin.py
lib/rapidsms/contrib/scheduler/admin.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 from django.contrib import admin from .models import EventSchedule class EventScheduleAdmin(admin.ModelAdmin): model = EventSchedule admin.site.register(EventSchedule, EventScheduleAdmin)
Python
0
7bfd677d1f4fce45b657e201ea5dfc639974cd16
add script to generate color space matrices
tools/convert-rgb-space-xyz.py
tools/convert-rgb-space-xyz.py
#!/usr/bin/env python # # This program allows to generate matrices to convert between RGB spaces and XYZ # All hardcoded values are directly taken from the ITU-R documents # # NOTE: When trying to convert from one space to another, make sure the whitepoint is the same, # otherwise math gets more complicated (see Bradfo...
Python
0.000001
26d56afb094db4b471ec6bd6d5e496e0f9b547d0
check all dataset shapes
pygam/tests/test_datasets.py
pygam/tests/test_datasets.py
# -*- coding: utf-8 -*- import numpy as np import pytest from pygam.datasets import cake from pygam.datasets import coal from pygam.datasets import default from pygam.datasets import faithful from pygam.datasets import hepatitis from pygam.datasets import mcycle from pygam.datasets import trees from pygam.datasets im...
Python
0.000001
0e9647f120d96e729f09a1bfc3f2eeee887ca6d4
Add test for periodic task
custom/icds/tests/test_periodic_task.py
custom/icds/tests/test_periodic_task.py
import pytz from corehq.apps.es.fake.users_fake import UserESFake from corehq.apps.domain.shortcuts import create_domain from corehq.apps.locations.tests.util import ( LocationStructure, LocationTypeStructure, setup_location_types_with_structure, setup_locations_with_structure, ) from corehq.apps.users....
Python
0.003626
255a7e7e15eec5b20dda416bc269a468fcd9c7c5
test of new getStudyIngestMessagesForNexSON treemachine service... the rest of the commit.
test_gols_get_study_ingest_messages.py
test_gols_get_study_ingest_messages.py
#!/usr/bin/env python import sys import requests import json from opentreetesting import config, summarize_json_response DOMAIN = config('host', 'golshost') p = '/ext/GoLS/graphdb/getStudyIngestMessagesForNexSON' if DOMAIN.startswith('http://127.0.0.1'): p = '/db/data' + p SUBMIT_URI = DOMAIN + p payload = { 'n...
Python
0
796dd87582c5327865602fdeeac74f8e35407ccf
Add compiler file
compiler.py
compiler.py
from lex_1 import generate_lex from parser_2 import generate_parser from semantic_3 import generate_semantic from generator_4 import generate_output if __name__ == "__main__": import os test_dir = "./tests/compiling/" for file in os.listdir(test_dir): prog = open(test_dir+file).read() gener...
Python
0.000002
b75de39ae75b3780988673ffbab869dec20c1521
Add uwsgi conf file for star and shadow
serverconfig/toolkit_uwsgi_star_shadow.py
serverconfig/toolkit_uwsgi_star_shadow.py
# mysite_uwsgi.ini file # http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html [uwsgi] # Django-related settings # the base directory (full path) chdir = /home/users/starandshadow/star_site # Django's wsgi file module = wsgi # the virtualenv (full path) home = /home...
Python
0
4bfc3f650bd5560f2e2e469252ea1166496a4b6b
Add dodgy NetCDF creation example
example1.py
example1.py
from __future__ import print_function from datacube.api.model import DatasetType, Satellite, Ls57Arg25Bands, Fc25Bands, Pq25Bands from datacube.api.query import list_tiles_as_list from datacube.api.utils import get_dataset_metadata from datacube.api.utils import get_dataset_data from geotiff_to_netcdf import BandAsDim...
Python
0
168480c9f11e2db0c1b0a40eb0a901133e05cb4a
add model criterion
fairseq/criterions/model_criterion.py
fairseq/criterions/model_criterion.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass, field import logging from typing import Dict, List from fairseq import metrics, utils from fairseq.criteri...
Python
0
f12500c836d2d5f04d3ad68b2b227f11b68af136
Add python script to send example task to the queue to test it
bin/send.py
bin/send.py
#!/usr/bin/env python import pika import json msg = { 'url':'http://www.google.co.uk', 'site': 'gtk', 'account': 'me', 'type': 'har' } connection = pika.BlockingConnection(pika.ConnectionParameters( 'localhost')) channel = connection.channel() channel.exchange_declare(exchange='perfmonit...
Python
0
c4b084dab7e343d2fa33c229716525096450e568
Correct import style for SleekXMPP
flexget/plugins/output/notify_xmpp.py
flexget/plugins/output/notify_xmpp.py
from __future__ import unicode_literals, division, absolute_import import logging from flexget.plugin import register_plugin, DependencyError from flexget.utils.template import RenderError, render_from_task log = logging.getLogger('notify_xmpp') try: import sleekxmpp class SendMsgBot(sleekxmpp.ClientXM...
from __future__ import unicode_literals, division, absolute_import import logging import sleekxmpp from flexget.plugin import register_plugin from flexget.utils.template import RenderError, render_from_task log = logging.getLogger('notify_xmpp') class SendMsgBot(sleekxmpp.ClientXMPP): def __init__(self, jid, p...
Python
0
bbf28b1c7fa3fb9f9074b9d4879c30e810ab3f31
Add premise of Bench Manager
ktbs_bench/utils/bench_manager.py
ktbs_bench/utils/bench_manager.py
from contextlib import contextmanager from ktbs_bench.utils.decorators import bench as util_bench class BenchManager: def __init__(self): self._contexts = [] self._bench_funcs = [] def bench(self, func): """Prepare a function to be benched and add it to the list to be run later.""" ...
Python
0.000169
cbb182ff0e999954c7a5c8fd19097a441762666b
Add sdb driver for etcd
salt/sdb/etcd_db.py
salt/sdb/etcd_db.py
# -*- coding: utf-8 -*- ''' etcd Database Module :maintainer: SaltStack :maturity: New :depends: python-etcd :platform: all This module allows access to the etcd database using an ``sdb://`` URI. This package is located at ``https://pypi.python.org/pypi/python-etcd``. Like all sdb modules, the etc...
Python
0
23bb5deda2f6217ceab6a6e60e26234919a1f24e
Add buildbot.py
buildbot.py
buildbot.py
#!/usr/bin/env python # encoding: utf-8 import os import sys import json import subprocess project_name = 'kw' def run_command(args): print("Running: {}".format(args)) sys.stdout.flush() subprocess.check_call(args) def get_tool_options(properties): options = "" if 'tool_options' in properties...
Python
0.000001
916c453d2ba939fb7eb15f4d87557c37bfc57a21
Add test for shell command
tests/components/test_shell_command.py
tests/components/test_shell_command.py
""" tests.test_shell_command ~~~~~~~~~~~~~~~~~~~~~~~~ Tests demo component. """ import os import tempfile import unittest from homeassistant import core from homeassistant.components import shell_command class TestShellCommand(unittest.TestCase): """ Test the demo module. """ def setUp(self): # pylint: di...
Python
0.000001
029de4a3a10f31b2d300e100db7767722698f00a
Test for newly refactored literal rule
tests/core/parse/test_parse_literal.py
tests/core/parse/test_parse_literal.py
import unittest from mygrations.core.parse.rule_literal import rule_literal class test_parse_regexp( unittest.TestCase ): def get_rule( self, name, literal ): return rule_literal( False, { 'name': name, 'value': literal }, {} ) def test_name_not_required( self ): rule = self.get_rule( '', ...
Python
0
d64ade91c9670e4d6e03732cc927cdfce35e1d73
Implemented similarity task
similarity.py
similarity.py
__author__ = 'rwechsler' import codecs from collections import defaultdict import gensim import re def load_word2vecmodel(file_name): return gensim.models.Word2Vec.load_word2vec_format(file_name, binary=True) def load_prototypes(file_name): prototypes = dict() infile = codecs.open(file_name, "r", "utf-8")...
Python
0.99918
9bcd540b4ba9e9e38f674b02b47e42eb29a1cf2f
add gender choices data migration
accelerator/migrations/0029_add_gender_choices_data.py
accelerator/migrations/0029_add_gender_choices_data.py
# Generated by Django 2.2.10 on 2020-12-01 19:01 from django.db import migrations from accelerator_abstract.models.base_gender_choices import GENDER_CHOICES def add_gender_choices(apps, schema_editor): GenderChoices = apps.get_model('accelerator', 'GenderChoices') db_gender_choices = GenderChoices.objects.al...
Python
0.000013
795bd9bca8779b32b1e48e420ab42fefbb73fdfc
add Driver migration
migrations/0001_initial.py
migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-23 15:48 from __future__ import unicode_literals from django.db import migrations, models import django_countries.fields class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Create...
Python
0
82301349226ec43dcec53d5ceceaa952d8d4b9b5
Test the use_plus_uconst optimizer
i8c/tests/test_opt_use_plus_uconst.py
i8c/tests/test_opt_use_plus_uconst.py
from i8c.tests import TestCase SOURCE = """\ define test::optimize_use_plus_uconst returns int argument int x load %s add """ class TestOptimizeUsePlusUconst(TestCase): def test_optimize_use_plus_uconst(self): """Check that DW_OP_plus_uconst is used where possible.""" for value in ("T...
Python
0.000035
b583bf5dbd4a375df7824463dda0789ddc980f2e
Create lasagne-script.py
lasagne-script.py
lasagne-script.py
import numpy as np import pandas as pd from lasagne.init import Orthogonal, Constant from lasagne.layers import DenseLayer, MergeLayer from lasagne.layers import DropoutLayer from lasagne.layers import InputLayer from lasagne.nonlinearities import softmax, rectify, sigmoid from lasagne.objectives import categorical_cro...
Python
0.000002
a72516f4faae6993d55b7a542ef9b686c6e659fb
Add NoCommandAction to only continue execution when a non-command text event is received
bot/action/core/command/no_command.py
bot/action/core/command/no_command.py
from bot.action.core.action import IntermediateAction from bot.action.core.command import CommandAction class NoCommandAction(IntermediateAction): def process(self, event): for entity in self.get_entities(event): if self.is_valid_command(entity): break else: ...
Python
0
6f1ae7faec0d24142b4986bdbb187004d71ddb3f
return feature set and transformations
features.py
features.py
def features(feature_set_name): '''Return dictionary[column_name] = transformation for the feature set. feature_set_name in [act, actLog, ct, ctLog, t, tLog, bestNN, pcaNN, id, prices best15{census|city|zip}] See Features.R for or...
Python
0.000002
c0fd273ff11f4953024e0a7b2fc8346b62ec8ac2
Use Django's six instead of global six
src/oscar/__init__.py
src/oscar/__init__.py
import os # Use 'dev', 'beta', or 'final' as the 4th element to indicate release type. VERSION = (1, 1, 0, 'dev') def get_short_version(): return '%s.%s' % (VERSION[0], VERSION[1]) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) # Append 3rd digit if > 0 if VERSION[2]: versi...
import os import six # Use 'dev', 'beta', or 'final' as the 4th element to indicate release type. VERSION = (1, 1, 0, 'dev') def get_short_version(): return '%s.%s' % (VERSION[0], VERSION[1]) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) # Append 3rd digit if > 0 if VERSION[2]: ...
Python
0.004818
31717dc26912aedd42ca475b4e3d1a406523e44a
add to connect mysql with pymysql
base100/crawler/data_store.py
base100/crawler/data_store.py
#!/usr/bin/python # --*-- UTF8 --*-- import pymysql def db_connect(): ''' 数据库配置 :return: con ''' con = pymysql.connect( host='172.16.223.10', user='root', passwd='123456', db='crawler', charset='utf8' ) return con def execute_query_sql(sql): ...
Python
0.000001
b5b329af74f66443d33062f8a17a99b98833e7bb
add UiBench workload
libs/utils/android/workloads/uibench.py
libs/utils/android/workloads/uibench.py
# SPDX-License-Identifier: Apache-2.0 # # Copyright (C) 2015, ARM Limited and contributors. # # 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 # # ...
Python
0
bc3ded5eda2cb31523dfaf9bf7eec4fbe1030a0b
add find_pcs.py, but only with some prep code and eline masking
find_pcs.py
find_pcs.py
import numpy as np from astropy import constants as c, units as u class StellarPop_PCA(object): ''' class for determining PCs of a library of synthetic spectra ''' def __init__(self, l, spectra, dlogl=None): ''' params: - l: length-n array-like defining the wavelength bin cente...
Python
0
2e20d0bb09234f36b5d43fc1f4b99cdb1da0e7f8
Add unsigned-workup utility script.
scripts/check_unsigned.py
scripts/check_unsigned.py
from datetime import date from pttrack.models import Provider, Workup unsigned_workups = Workup.objects.filter(signer=None) print unsigned_workups for wu in unsigned_workups: d = wu.clinic_day.clinic_date providers = Provider.objects.filter( signed_workups__in=Workup.objects.filter( clini...
Python
0
ffefdb6e9ac678d0b7e1f65a7712e01a874507fb
ADD script to collect nemo results
scripts/collect_result.py
scripts/collect_result.py
import numpy as np import pandas as pd from _collections import OrderedDict data = {} flat_data = OrderedDict() scens = ["SPEAR-SWV","SPEAR-IBM","CPLEX-RCW","CPLEX-REG","CPLEX-CORLAT"] models = ["DNN", "RF"] EVA_BUDGETs = [1]#,3600] WC_BUDGET = 86400 # sec RUNS = 3 for scen in scens: for model in models: ...
Python
0
e41ce4338334794466ba6918fc3b8a1f118d6b41
Add first example test of using h2o python API to gradle build regression suite.
py/testdir_multi_jvm/test_gbm_prostate.py
py/testdir_multi_jvm/test_gbm_prostate.py
import sys sys.path.insert(1, '../../h2o-py/src/main/py') from h2o import H2OConnection from h2o import H2OFrame from h2o import H2OGBM from tabulate import tabulate ###################################################### # Parse command-line args. # # usage: python test_name.py --usecloud ipaddr:port # ip_port = sy...
Python
0
c27685da10c85cb9876b4c73012da3ebff1915dc
Add exercise horse racing duals
codingame/easy/horse-racing_duals.py
codingame/easy/horse-racing_duals.py
N = int(raw_input()) lst = [] # Read the list for i in xrange(N): lst.append(int(raw_input())) # Sort the list, ascending order a = sorted(lst) # Find the min difference print min(y-x for x,y in zip(a, a[1:]))
Python
0.000001
cf592b24b0cc8e8944f32e1389379d57c8b9d96a
add list of universities
scripts/make_unis_list.py
scripts/make_unis_list.py
import re import json def make_country_key_to_iso_code_dict(country_lines): country_key_to_iso_code = {} for line in country_lines: m = re.match("\((\d+),", line) if m is not None: country_key = int(m.group(1)) iso_code = line.split(",")[1].replace("'", "").strip() ...
Python
0.000005
c1894e280f7d4b8d2afac6b4febaae451894306c
Add command to view exons in the database
scout/commands/view/exons.py
scout/commands/view/exons.py
import logging import click from pprint import pprint as pp from flask.cli import with_appcontext from scout.server.extensions import store LOG = logging.getLogger(__name__) @click.command('exons', short_help='Display exons') @click.option('-b', '--build', default='37', type=click.Choice(['37', '38'])) @click.opti...
Python
0
685e9cc5f285bb6fadddea8d94d5a9820ace39e6
Initialize manager module for server
src/server/manager.py
src/server/manager.py
class Event: def __init__(self, t, hz): self.t = t self.hz = hz class Layer: def __init__(self): self.events = [] def addEvent(self, e): self.events.append(e) class Client: def __init__(self, connection): self.connection = connection class Manager: def __i...
Python
0
6be3900d26a25495101de2a14a9f62b59d9b776a
use posixpath to generate thumbnail-src
seahub/thumbnail/utils.py
seahub/thumbnail/utils.py
import posixpath from seahub.utils import get_service_url def get_thumbnail_src(repo_id, obj_id, size): return posixpath.join(get_service_url(), "thumbnail", repo_id, obj_id, size)
import os from seahub.utils import get_service_url def get_thumbnail_src(repo_id, obj_id, size): return os.path.join(get_service_url(), "thumbnail", repo_id, obj_id, size, '')
Python
0.000002
ccadcfe891871032ea5e4c1974db67ed1b69a0e8
add undocumented function to display new messages.
rtv/docs.py
rtv/docs.py
from .__version__ import __version__ __all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE', 'SUBMISSION_FILE', 'COMMENT_EDIT_FILE'] AGENT = """\ desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\ """.format(__version__) SUMMARY = """ Reddit Terminal Viewer is...
from .__version__ import __version__ __all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE', 'SUBMISSION_FILE', 'COMMENT_EDIT_FILE'] AGENT = """\ desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\ """.format(__version__) SUMMARY = """ Reddit Terminal Viewer is...
Python
0
9ffcadf3a79459b6685cf64a6a77d5186f8fc691
add main file, data base connection and one simple insertion test
main.py
main.py
from users_handler import UsersHandler import pymongo import logging import sys logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG) try: client = pymongo.MongoClient("mongodb://root:chat1234@ds135797.mlab.com:35797/chat") logging.info("Connected to the data base: {}".format(client.ad...
Python
0
7ca529e9afe68033c5f6f552aae6f5316a406555
check for peru file before running
main.py
main.py
#! /usr/bin/env python3 import os import sys import runtime import module def main(): peru_file_name = os.getenv("PERU_FILE_NAME") or "peru" if not os.path.isfile(peru_file_name): print("no peru file found") sys.exit(1) r = runtime.Runtime() m = module.parse(r, peru_file_name) if ...
#! /usr/bin/env python3 import os import sys import runtime import module def main(): r = runtime.Runtime() peru_file_name = os.getenv("PERU_FILE_NAME") or "peru" m = module.parse(r, peru_file_name) if len(sys.argv) > 1: target = sys.argv[1].split('.') else: target = [] m.buil...
Python
0
a7ba6c3872103bf46d838202da37e1426e285525
Add example skeleton
main.py
main.py
from random import random from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.graphics import Color, Ellipse, Line class MyPaintWidget(Widget): def on_touch_down(self, touch): color = (random(), 1, 1) with self.canvas: Color(*color,...
Python
0.000002
b627cccbd77dbb4f8d87189d7d85cb66d2324b2e
add helpers.py file to notebooks folder for common helper functions for notebooks to use
notebooks/helpers.py
notebooks/helpers.py
import itertools import numpy as np import matplotlib.pyplot as plt def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): """ This function prints and plots the confusion matrix. No...
Python
0
59ba6d2db5fa27878653f000cb1e6f8cfd6ccc89
Check ptavi.p3
check-p3.py
check-p3.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Script de comprobación de entrega de práctica Para ejecutarlo, desde la shell: $ python check-p3.py login_github """ import os import random import sys if len(sys.argv) != 2: print() sys.exit("Usage : $ python3 check-p3.py login_github") repo_git = "http://...
Python
0
ffbe50f523fe43cafa6e37c6a0f99e08cf04ae92
add eupstag.EupsTag class
codekit/eups.py
codekit/eups.py
"""EUPS distrib tag related utility functions.""" from codekit.codetools import debug from public import public import logging import re import requests import textwrap default_pkgroot = 'https://eups.lsst.codes/stack/src' @public def setup_logging(verbosity=0): # enable requests debugging # based on http:/...
Python
0
db689744216f19ed425e3155dd8d57d792497f4a
create VersionList module and class to manage the list of blender version installed on user system
settingMod/VersionList.py
settingMod/VersionList.py
#!/usr/bin/python3.4 # -*-coding:Utf-8 -* '''module to manage list of all know version of Blender in the system''' import xml.etree.ElementTree as xmlMod class VersionList: '''class dedicated to Blender version managing''' def __init__(self, xml= None): '''initialize Blender version list with default value or...
Python
0
56e48a414b1145e4955aeea58e409cebd0b4d9d0
Add serialize tests
sqlalchemy_mixins/tests/test_serialize.py
sqlalchemy_mixins/tests/test_serialize.py
import unittest import sqlalchemy as sa from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import Session from sqlalchemy_mixins import SerializeMixin Base = declarative_base() class BaseModel(Base, SerializeMixin): __abstract__ = True pass cl...
Python
0.000001