commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
60f13bdfb97e83ac1bf2f72e3eec2e2c2b88cbb3 | add tests for potential density computation | adrn/Biff,adrn/Biff,adrn/Biff | biff/tests/test_bfe.py | biff/tests/test_bfe.py | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import astropy.units as u
from astropy.constants import G as _G
G = _G.decompose([u.kpc,u.Myr,u.Msun]).value
import numpy as np
# Project
from .._bfe import density
# Check that we get A000=1... | mit | Python | |
1e808aa70882cd30cd0ac7a567d12efde99b5e61 | Create runserver.py | DanielKoehler/pyucwa | runserver.py | runserver.py | from ucwa.http import app
app.run(debug=True)
| isc | Python | |
f737a8be41111f65944b00eb85a76687653fc8c0 | Create sort_fpkm.py | iandriver/RNA-sequence-tools,idbedead/RNA-sequence-tools,idbedead/RNA-sequence-tools,iandriver/RNA-sequence-tools,idbedead/RNA-sequence-tools,iandriver/RNA-sequence-tools | sort_fpkm.py | sort_fpkm.py | import os
import fnmatch
import sys, csv ,operator
for root, dirnames, filenames in os.walk('/Users/idriver/RockLab-files/test'):
for filename in fnmatch.filter(filenames, '*.fpkm_tracking'):
if filename =='isoforms.fpkm_tracking':
data = csv.reader(open(os.path.join(root, filename), 'rU'),delimiter='\t')
... | mit | Python | |
d42aad6a15dfe9cc5a63dbb19efe112534b91a5e | Add autoexec script for reference (already bundled in config) | UMDSpaceSystemsLab/DisplayBoards,UMDSpaceSystemsLab/DisplayBoards | resources/autoexec.py | resources/autoexec.py | # place at ~/.kodi/userdata/autoexec.py
import xbmc
import time
xbmc.executebuiltin("XBMC.ReplaceWindow(1234)")
time.sleep(0.1)
xbmc.executebuiltin('PlayMedia("/storage/videos/SSL","isdir")')
xbmc.executebuiltin('xbmc.PlayerControl(repeatall)')
xbmc.executebuiltin("Action(Fullscreen)")
| mit | Python | |
159ed7dd9dd5ade6c4310d2aa106b13bf94aa903 | Add empty cloner | mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge | stoneridge_cloner.py | stoneridge_cloner.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
# TODO - This will run on the central server, and download releases from ftp.m.o
# to a local dire... | mpl-2.0 | Python | |
d9710fa2af26ab4ab5fef62adc5be670437bea68 | Create logistics_regression.py | gu-yan/mlAlgorithms | logistics_regression.py | logistics_regression.py | #!/usr/bin/python
# -*-coding:utf-8 -*-
from math import exp
import random
import data_tool
#y = x1*a1 + x2*a2 + x3*a3 + ... + xn*an + b
def predict(data,
coef,
bias):
pred = 0.0
for index in range(len(coef)):
pred += (data[index] * coef[index] + bias)
return sigmoid(pred)
... | apache-2.0 | Python | |
8ee7798af73f374485c1a97e82a98fd5ff8b3c48 | Add module for loading specific classes | n0ano/gantt,n0ano/gantt | nova/loadables.py | nova/loadables.py | # Copyright (c) 2011-2012 OpenStack, LLC.
# 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 ... | apache-2.0 | Python | |
5211117033f596bd506e81e8825ddfb08634c25e | Create battery.py | cclauss/In-Harms-Way,cclauss/In-Harms-Way,cclauss/In-Harms-Way | client/iOS/battery.py | client/iOS/battery.py | # coding: utf-8
import collections, objc_util
battery_info = collections.namedtuple('battery_info', 'level state')
def get_battery_info():
device = objc_util.ObjCClass('UIDevice').currentDevice()
device.setBatteryMonitoringEnabled_(True)
try:
return battery_info(int(device.batteryLevel() * 100),
... | apache-2.0 | Python | |
840d4d555b7b2858ca593251f1593943b10b135b | Add setup_egg.py | wanderine/nipype,rameshvs/nipype,sgiavasis/nipype,rameshvs/nipype,dgellis90/nipype,mick-d/nipype,christianbrodbeck/nipype,carolFrohlich/nipype,glatard/nipype,gerddie/nipype,fprados/nipype,JohnGriffiths/nipype,wanderine/nipype,grlee77/nipype,JohnGriffiths/nipype,mick-d/nipype,christianbrodbeck/nipype,blakedewey/nipype,c... | setup_egg.py | setup_egg.py | #!/usr/bin/env python
"""Wrapper to run setup.py using setuptools."""
from setuptools import setup
################################################################################
# Call the setup.py script, injecting the setuptools-specific arguments.
extra_setuptools_args = dict(
tests... | bsd-3-clause | Python | |
71a6c671f802e3b1c123b083ef34f81efeb55750 | Create MakeMaskfiles.py | LauritsSkov/Introgression-detection | MakeMaskfiles.py | MakeMaskfiles.py | import gzip
import sys
from collections import defaultdict
def readFasta(infile):
sequence = ''
if '.gz' in infile:
with gzip.open(infile) as data:
for line in data:
if '>' in line:
seqname = line.strip().replace('>','')
else:
sequence += line.strip().replace(' ','')
else:
with open(infil... | mit | Python | |
8e4cbd3dd09aac90cf2d71adb5ad841274b60575 | Create convolution_digit_recognition.py | rupertsmall/machine-learning,rupertsmall/machine-learning | Convolution_Neural_Networks/convolution_digit_recognition.py | Convolution_Neural_Networks/convolution_digit_recognition.py | # Optimise a neural network
import threading
from Queue import Queue
from numpy import *
from create_MEGA_THETA import *
from RLU_forward_backward import *
from get_overlaps import *
# get data from csv file into array
data = genfromtxt('train2.csv', delimiter=',')
# get a subset for testing
num_cpus = 4
N = 5*num_... | mit | Python | |
675de92e16e268badd8c6f5de992c3901cc8f2ce | Update Category Model | samitnuk/online_shop,samitnuk/online_shop,samitnuk/online_shop | apps/shop/migrations/0004_category_parent_category.py | apps/shop/migrations/0004_category_parent_category.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-11 19:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('shop', '0003_product_model_name'),
]
operations = ... | mit | Python | |
f2d1421555f00f7bcb77f43cd010c221045c6bfd | Add tests for nd-shifty | mjoblin/netdumplings,mjoblin/netdumplings,mjoblin/netdumplings | tests/console/test_shifty.py | tests/console/test_shifty.py | import click.testing
from netdumplings.console.shifty import shifty
from netdumplings.exceptions import NetDumplingsError
class TestShifty:
"""
Test the nd-shifty commandline tool.
"""
def test_shifty(self, mocker):
"""
Test that the DumplingHub is instantiated as expected and that ru... | mit | Python | |
dd983ae232829559766bcdf4d2ea58861b8a47ad | Bring your own daemon. | bearstech/varnishstatd | varnish_statd.py | varnish_statd.py | #!/usr/bin/env python
import time
import os
from pprint import pprint
import varnishapi
def stat(name=None):
if name is None:
vsc = varnishapi.VarnishStat()
else:
vsc = varnishapi.VarnishStat(opt=["-n", name])
r = vsc.getStats()
values = dict(((k, v['val']) for k, v in r.iteritems())... | bsd-2-clause | Python | |
c1d4525d5f43a5c2bfbfd88ab0dd943eb2452574 | add 127 | EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler | vol3/127.py | vol3/127.py | from fractions import gcd
if __name__ == "__main__":
LIMIT = 120000
rad = [1] * LIMIT
for i in range(2, LIMIT):
if rad[i] == 1:
for j in range(i, LIMIT, i):
rad[j] *= i
ele = []
for i in range(1, LIMIT):
ele.append([rad[i], i])
ele = sorted(ele)
... | mit | Python | |
8e7b57c8bc7be6a061d0c841700291a7d85df989 | add 174 | zeyuanxy/project-euler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler | vol4/174.py | vol4/174.py | if __name__ == "__main__":
L = 10 ** 6
count = [0] * (L + 1)
for inner in range(1, L / 4 + 1):
outer = inner + 2
used = outer * outer - inner * inner
while used <= L:
count[used] += 1
outer += 2
used = outer * outer - inner * inner
print sum(ma... | mit | Python | |
a5b4fa261750fa79d61fc16b6061d449aa7e3523 | Add missing block.py | brendan-ward/rasterio,brendan-ward/rasterio,brendan-ward/rasterio | rasterio/block.py | rasterio/block.py | """Raster Blocks"""
from collections import namedtuple
BlockInfo = namedtuple('BlockInfo', ['row', 'col', 'window', 'size'])
| bsd-3-clause | Python | |
65843b537e45b98068566c6cc57e4a3ad139d607 | add variant.py | AndersenLab/cegwas-web,AndersenLab/CeNDR,AndersenLab/cegwas-web,AndersenLab/cegwas-web,AndersenLab/CeNDR,AndersenLab/CeNDR,AndersenLab/CeNDR,AndersenLab/cegwas-web | cendr/views/api/variant.py | cendr/views/api/variant.py | # NEW API
from cendr import api, cache, app
from cyvcf2 import VCF
from flask import jsonify
import re
import sys
from subprocess import Popen, PIPE
def get_region(region):
m = re.match("^([0-9A-Za-z]+):([0-9]+)-([0-9]+)$", region)
if not m:
return msg(None, "Invalid region", 400)
chrom = m.grou... | mit | Python | |
d2bcba204d36a8ffd1e6a1ed79b89fcb6f1c88c5 | Add file to test out kmc approach. Dump training k-mers to fasta file | dkoslicki/CMash,dkoslicki/CMash | ideas/test_kmc.py | ideas/test_kmc.py | # This code will test out the idea of using kmc to
# 1. quickly enumerate the k-mers
# 2. intersect these with the training database, output as fasta
# 3. use that reduced fasta of intersecting kmers as the query to CMash
####################################################################
# First, I will need to dump... | bsd-3-clause | Python | |
c584bca2f9ac7bc005128d22b4e81a6b4885724c | allow Fabric to infrastructure config from YAML data files | kamiljsokolowski/LAB,kamiljsokolowski/LAB,kamiljsokolowski/LAB | templates/fabfile.py | templates/fabfile.py | import yaml
from fabric.api import env, run
def import_inf(data='web_app_basic.yml'):
inf_data = open(data, 'r')
inf = yaml.load(inf_data)
# for box in inf:
# print '\n'
# for parameter in box:
# print parameter, ':', box[parameter]
return inf
inf_data.close()
inf = import_... | mit | Python | |
f657a02a560af1a5860f9a532052f54330018620 | Build "shell" target with chromium_code set. | Jonekee/chromium.src,Just-D/chromium-1,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,crosswalk-project/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,bright-sparks/chromium-spacew... | ui/shell/shell.gyp | ui/shell/shell.gyp | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'shell',
'type': 'static_library',
'dependencies': [
... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'shell',
'type': 'static_library',
'dependencies': [
'../aura/aura.gyp:aura',
'../vie... | bsd-3-clause | Python |
bddfeeec193d9fb61d99c70be68093c854e541f7 | Add initial check thorium state | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/thorium/check.py | salt/thorium/check.py | '''
The check Thorium state is used to create gateways to commands, the checks
make it easy to make states that watch registers for changes and then just
succeed or fail based on the state of the register, this creates the pattern
of having a command execution get gated by a check state via a requisite.
'''
def gt(na... | apache-2.0 | Python | |
6c08a3d795f9bd2f2d0850fb4c2b7f20474908a9 | Add test for scrunch block | ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost | test/test_scrunch.py | test/test_scrunch.py | # Copyright (c) 2016, The Bifrost Authors. All rights reserved.
# Copyright (c) 2016, NVIDIA CORPORATION. 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 re... | bsd-3-clause | Python | |
0b0647a0537c3c325f5cf57cae933e06f7997ea9 | add "_" prefix to plot names | probcomp/crosscat,fivejjs/crosscat,probcomp/crosscat,probcomp/crosscat,mit-probabilistic-computing-project/crosscat,probcomp/crosscat,mit-probabilistic-computing-project/crosscat,mit-probabilistic-computing-project/crosscat,mit-probabilistic-computing-project/crosscat,probcomp/crosscat,probcomp/crosscat,mit-probabilist... | crosscat/tests/timing_analysis.py | crosscat/tests/timing_analysis.py | import argparse
def _generate_parser():
default_num_rows = [100, 400, 1000, 4000]
default_num_cols = [8, 16, 32]
default_num_clusters = [1, 2]
default_num_views = [1, 2]
#
parser = argparse.ArgumentParser()
parser.add_argument('--dirname', default='timing_analysis', type=str)
parser.ad... | import argparse
def _generate_parser():
default_num_rows = [100, 400, 1000, 4000]
default_num_cols = [8, 16, 32]
default_num_clusters = [1, 2]
default_num_views = [1, 2]
#
parser = argparse.ArgumentParser()
parser.add_argument('--dirname', default='timing_analysis', type=str)
parser.ad... | apache-2.0 | Python |
42e0504933d6b9e55cdb6edb9931ba080baab136 | add 408, replace print in test cases into assert | ufjfeng/leetcode-jf-soln,ufjfeng/leetcode-jf-soln | python/408_valid_word_abbreviation.py | python/408_valid_word_abbreviation.py | """
Given a non-empty string s and an abbreviation abbr, return whether the string
matches with the given abbreviation.
A string such as "word" contains only the following valid abbreviations:
["word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d", "1or1",
"w1r1", "1o2", "2r1", "3d", "w3", "4"]
Notice... | mit | Python | |
5e91e3b2c7e4cbc9f14067a832b87c336c0811e7 | update add test for c4 | enixdark/im-r-e-d-i-s,enixdark/im-r-e-d-i-s,enixdark/im-r-e-d-i-s,enixdark/im-r-e-d-i-s | redis_i_action/c4-process-log-and-replication/test.py | redis_i_action/c4-process-log-and-replication/test.py | class TestCh04(unittest.TestCase):
def setUp(self):
import redis
self.conn = redis.Redis(db=15)
self.conn.flushdb()
def tearDown(self):
self.conn.flushdb()
del self.conn
print
print
def test_list_item(self):
import pprint
conn = self.conn
print "We need to set up just enough state so that a user c... | mit | Python | |
5fd556bc01fdd5d3c9690a56a70557fbd6eb73f8 | print the to calc statistical test | jadsonjs/DataScience,jadsonjs/DataScience | MachineLearning/print_ensemble_precisions.py | MachineLearning/print_ensemble_precisions.py | #
# This program is distributed without any warranty and it
# can be freely redistributed for research, classes or private studies,
# since the copyright notices are not removed.
#
# This file just read the data to calculate the statistical test
#
# Jadson Santos - jadsonjs@gmail.com
#
# to run this exemple install py... | apache-2.0 | Python | |
88d2ad776518d62a66fa3b8f7dd7520cff3debfc | Create bulk_parse.py | haruka-YNU/email_parser | scripts/bulk_parse.py | scripts/bulk_parse.py | mit | Python | ||
10d71b1208175eac4af0a20d7ee0a8176c7829ef | add new rename script to prepend to *.c files | sg-/scripts,sg-/scripts | rename/prepend.py | rename/prepend.py | import os
import sys
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'usage: <path> <prepend>'
sys.exit()
exts=['.c']
change_count = 0
for root, dirs, files in os.walk(sys.argv[1]):
for filename in files:
if any(filename.lower().endswith(ext) for ext in exts):
if sys... | apache-2.0 | Python | |
b20b8bc06b6141fad1fbab9befa184644821351f | add joblib02.py | devlights/try-python | trypython/extlib/joblib02.py | trypython/extlib/joblib02.py | # coding: utf-8
"""
joblibモジュールについてのサンプルです。
joblib.Parallel の利用にて joblib側のログを出力する方法について。
"""
import datetime
import os
import random
import time
import joblib as job
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr, hr
NOW = datetime.datetime.now
RND = random.Random()
CPU... | mit | Python | |
02ad029840b2e770bc802fd7f8504498cb0f756d | Add `issubset` and `issuperset` tests | thaim/ansible,thaim/ansible | lib/ansible/plugins/test/mathstuff.py | lib/ansible/plugins/test/mathstuff.py | # (c) 2016, Ansible, Inc
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is di... | mit | Python | |
adede4415e36830485429f49b8476f655f3d4929 | Add environment.py | vrutkovs/mysql,vrutkovs/mysql | tests/environment.py | tests/environment.py | # -*- coding: UTF-8 -*-
import shutil
from steps.common_steps.common_environment import docker_setup
def before_all(context):
docker_setup(context)
context.build_or_pull_image(skip_pull=True, skip_build=True)
def after_scenario(context, scenario):
if 'KEEP_CONTAINER_AFTER_TEST' in context.config.userdat... | apache-2.0 | Python | |
bf86584829f56f91b363f251d77f3157f952db0f | Add tests for masking of data based on being within a range of values | ceholden/yatsm,c11/yatsm,jmorton/yatsm,valpasq/yatsm,ceholden/yatsm,valpasq/yatsm,jmorton/yatsm,c11/yatsm,jmorton/yatsm | tests/test_cyprep.py | tests/test_cyprep.py | import unittest
import numpy as np
import yatsm._cyprep
class TestCyPrep(unittest.TestCase):
@classmethod
def setUpClass(cls):
# Test data
n_band = 7
n_mask = 50
n_images = 1000
cls.data = np.random.randint(
0, 10000, size=(n_band, n_images)).astype(np.i... | mit | Python | |
9c249d3f9d202632b7fd2241d39dfc2e180fd358 | Add ledger tests | Storj/accounts | tests/test_ledger.py | tests/test_ledger.py | # -*- coding: utf-8 -*-
import pytest
from accounts.ledger import Ledger
# Database migrations run for each test in this module.
# See `conftest.pytest_runtest*`.
DB_MIGRATIONS = ['0003-create-balances', '0004-create-movements']
# Fixtures ###
@pytest.fixture
def ledger(db):
return Ledger(db.connection)
# Test... | mit | Python | |
65f6b1101aba2086654f2ff0ff3e942f69d584b2 | Add an application that returns spaCy similarity query | paopow/word_similarity_api,paopow/word_similarity_api | app/app.py | app/app.py | from flask import Flask, jsonify
import spacy.en
from numpy import dot
from numpy.linalg import norm
app = Flask(__name__)
nlp = spacy.en.English()
def cossim(a, b):
return dot(a, b) / (norm(a) * norm(b))
@app.route('/')
def index():
return "Hello, World!"
@app.route('/spaCy/api/similarity/<word1>/<word2>'... | mit | Python | |
ddd4473f8edc4e7cfc503fc6cdbb570f33f224a4 | Add Preprocessor module Edges to generate possible edges between two entities given the relation type | Rostlab/nalaf | nala/preprocessing/edges.py | nala/preprocessing/edges.py | import abc
from nala.structures.data import Edge
class EdgeGenerator:
"""
Abstract class for generating edges between two entities. Each edge represents
a possible relationship between the two entities
Subclasses that inherit this class should:
* Be named [Name]EdgeGenerator
* Implement the abs... | apache-2.0 | Python | |
0377cf9cc3c2460c2936ec9153edbdb196cff5bf | Add zdt agent | wairton/zephyrus-mas | zephyrus/examples/zdt/agent.py | zephyrus/examples/zdt/agent.py | import sys
from itertools import islice
from math import sqrt
from zephyrus.agent import Agent
from zephyrus.message import Message
class ZDTAgent(Agent):
def mainloop(self):
msg = self.socket_receive.recv()
action = self.perceive(msg.content)
self.socket_send(str(action))
def act(se... | mit | Python | |
bc812daf7c99b34a3952d933666f240597eb835d | add a spider for Xin Shi Dai board, Ya Zhou catagory. | Nymphet/t66y-spider | t66ySpider/t66ySpider/spiders/t66yXinshidaiYazhouSpider.py | t66ySpider/t66ySpider/spiders/t66yXinshidaiYazhouSpider.py | # -*- coding: utf-8 -*-
import scrapy
from t66ySpider.items import T66YspiderXinshidaiItem
class t66yDagaierSpider(scrapy.Spider):
name = 'XinShiDaiYaZhou'
allowed_domains = ['t66y.com']
start_urls = ["http://t66y.com/thread0806.php?fid=8&type=1"]
unicode_next_page = u'\u4e0b\u4e00\u9801'
def p... | apache-2.0 | Python | |
25d8cbfd4b59166ba748d5cd42fbcd7ffe925f0e | Allow using exogenous data in hierachical models #124 | antoinecarme/pyaf,antoinecarme/pyaf,antoinecarme/pyaf | tests/hierarchical/test_hierarchy_AU_AllMethods_Exogenous_all_nodes.py | tests/hierarchical/test_hierarchy_AU_AllMethods_Exogenous_all_nodes.py | import pandas as pd
import numpy as np
import pyaf.HierarchicalForecastEngine as hautof
import pyaf.Bench.TS_datasets as tsds
import datetime
#get_ipython().magic('matplotlib inline')
def create_exog_data(b1):
# fake exog data based on date variable
lDate1 = b1.mPastData['Date']
lDate2 = b1.mFutureData['... | bsd-3-clause | Python | |
b135e8e473837909c6847f8a52711527409b5224 | Add windows build tools | yuvipanda/mwparserfromhell,wikimedia/operations-debs-python-mwparserfromhell,gencer/mwparserfromhell,earwig/mwparserfromhell,gencer/mwparserfromhell,jayvdb/mwparserfromhell,SunghanKim/mwparserfromhell,earwig/mwparserfromhell,yuvipanda/mwparserfromhell,earwig/mwparserfromhell,jayvdb/mwparserfromhell,kumasento/mwparserfr... | tools/build_mwpfh.py | tools/build_mwpfh.py | from __future__ import print_function
import subprocess
import sys
import os
path = os.path.split(__file__)[0]
if path:
os.chdir(path)
environments = ['26', '27', '32', '33', '34']
target = "pypi" if "--push" in sys.argv else "test"
returnvalues = {}
def run(pyver, cmds, target=None):
cmd = [r"C:\Python%s\Pytho... | mit | Python | |
012acdc7a280b307bbb110449dcfee5d05a77e38 | Create new package (#6379) | iulian787/spack,matthiasdiener/spack,LLNL/spack,matthiasdiener/spack,tmerrick1/spack,EmreAtes/spack,matthiasdiener/spack,mfherbst/spack,LLNL/spack,mfherbst/spack,krafczyk/spack,krafczyk/spack,krafczyk/spack,tmerrick1/spack,EmreAtes/spack,tmerrick1/spack,mfherbst/spack,krafczyk/spack,matthiasdiener/spack,mfherbst/spack,... | var/spack/repos/builtin/packages/r-chemometrics/package.py | var/spack/repos/builtin/packages/r-chemometrics/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... | lgpl-2.1 | Python | |
aa78a2670766b0a5e093a1876cb402ed513573bd | Add script to explore parameters units | antoinearnoud/openfisca-france,antoinearnoud/openfisca-france,sgmap/openfisca-france,sgmap/openfisca-france | openfisca_france/scripts/parameters/explore_parameters_unit.py | openfisca_france/scripts/parameters/explore_parameters_unit.py | # -*- coding: utf-8 -*-
from openfisca_core.parameters import ParameterNode, Scale
from openfisca_france import FranceTaxBenefitSystem
tax_benefit_system = FranceTaxBenefitSystem()
parameters = tax_benefit_system.parameters
def get_parameters_by_unit(parameter, parameters_by_unit = None):
if parameters_by_uni... | agpl-3.0 | Python | |
e095b6a76ac36255983d8c69d4899d64178e0ef3 | Add segment_euclidean_length tests module | danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv | tests/plantcv/morphology/test_segment_euclidean_length.py | tests/plantcv/morphology/test_segment_euclidean_length.py | import pytest
import cv2
import numpy as np
from plantcv.plantcv import outputs
from plantcv.plantcv.morphology import segment_euclidean_length
def test_segment_euclidean_length(morphology_test_data):
# Clear previous outputs
outputs.clear()
skeleton = cv2.imread(morphology_test_data.skel_img, -1)
_ =... | mit | Python | |
26ab37868e67b5b815cf8df67cc04876ff44c148 | Add file for Nongrammar entities tests | PatrikValkovic/grammpy | tests/rules_tests/isValid_tests/NongrammarEntitiesTest.py | tests/rules_tests/isValid_tests/NongrammarEntitiesTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import Rule
from .grammar import *
class NongrammarEntitiesTest(TestCase):
pass
if __name__ == '__main__':
main() | mit | Python | |
e80ec7adc6fe71310e1c2adba720be9640a49d0f | test code for midiGenerator | anassinator/beethoven | src/test4.py | src/test4.py | import midiGenerator
generator = midiGenerator.MidiGenerator(200,1)
channel = midiGenerator.Channel()
note = midiGenerator.Note(43,100,200)
channel.addNote(note)
channel.addNote(midiGenerator.Note(45,200,300))
channel.addNote(midiGenerator.Note(57,300,400))
channel.addNote(midiGenerator.Note(38,400,500))
channel.addNot... | mit | Python | |
63065390fca52045db0665bbb8f2b4df7a7b57d4 | Implement pivoted Cholesky decomposition and code to do Woodbury solves with them. | jrg365/gpytorch,jrg365/gpytorch,jrg365/gpytorch | gpytorch/utils/pivoted_cholesky.py | gpytorch/utils/pivoted_cholesky.py | import torch
def pivoted_cholesky(matrix, max_iter, error_tol=1e-5):
matrix_size = matrix.size(-1)
matrix_diag = matrix.diag()
# TODO: This check won't be necessary in PyTorch 0.4
if isinstance(matrix_diag, torch.autograd.Variable):
matrix_diag = matrix_diag.data
error = torch.norm(matri... | mit | Python | |
e195aef0fa870bf0f471be99a0144a59fdcc5b97 | Create norm_distri_of_proj_valu.py | vi3k6i5/AV_H3_Benchmark_RF_1 | norm_distri_of_proj_valu.py | norm_distri_of_proj_valu.py | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import math
x_train = pd.read_csv("Train.csv")
x_test = pd.read_csv("Test.csv")
def log_method(x):
if x == 0:
return 0
return math.log(x,2)
test = x_train["Project_Valuation"].order()
test = test.apply(lambda x... | mit | Python | |
3724e828ea7c0aa2a910db16c1392390f7c9f7a8 | add a simple schema building tool | arskom/spyne,arskom/spyne,arskom/spyne | spyne/test/interface/build_schema.py | spyne/test/interface/build_schema.py | #!/usr/bin/env python
# This can be used to debug invalid Xml Schema documents.
import sys
from lxml import etree
if len(sys.argv) != 2:
print "Usage: %s <path_to_xsd_file>" % sys.argv[0]
sys.exit(1)
f = open(sys.argv[1])
etree.XMLSchema(etree.parse(f))
| lgpl-2.1 | Python | |
0a5167807d615f59808195aed6114cfa9b293eda | Update migrations to work with Django 1.9. | webu/pybbm,hovel/pybbm,webu/pybbm,hovel/pybbm,artfinder/pybbm,webu/pybbm,hovel/pybbm,artfinder/pybbm,artfinder/pybbm | pybb/migrations/0005_auto_20151108_1528.py | pybb/migrations/0005_auto_20151108_1528.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9b1 on 2015-11-08 23:28
from __future__ import unicode_literals
from django.db import migrations, models
import pybb.util
class Migration(migrations.Migration):
dependencies = [
('pybb', '0004_slugs_required'),
]
operations = [
migrations.... | bsd-2-clause | Python | |
56a8250baa197285a5727dfbca12adaab81238ab | Add a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/tkinter/python3/menu_checkbutton.py | python/tkinter/python3/menu_checkbutton.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including witho... | mit | Python | |
fa3a02e6660ce556defc2f2c6008c6eb24eb71c1 | Add a simple sampler for playing wav files triggered by note on messages | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/Sampler.py | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/Sampler.py | import time
import wave
import pygame
import numpy
import Axon
from Axon.SchedulingComponent import SchedulingComponent
class WavVoice(SchedulingComponent):
bufferSize = 1024
def __init__(self, fileName, **argd):
super(WavVoice, self).__init__(**argd)
self.on = False
self.wavFile = wa... | apache-2.0 | Python | |
bff1e954213fb7592505c94294eb3800a8b199c3 | Update patternMatch.py | christieewen/Algorithms,christieewen/Algorithms | TechInterviews/Python/patternMatch.py | TechInterviews/Python/patternMatch.py | import sys
import re
# Strip only the beginning and ending slashes
def stripSlashes(path):
if path.startswith('/'):
path = path[1:]
if path.endswith('/'):
path = path[:-1]
return path
def findBestWildCardMatch(patterns):
#The best match is wildcards that are rightmost
#Get the posi... | import sys
import re
def stripSlashes(path):
if path.startswith('/'):
path = path[1:]
if path.endswith('/'):
path = path[:-1]
return path
def findBestWildCardMatch(patterns):
pass
def getRePattern(pattern):
return pattern.replace(',', '/').replace('*', '[a-zA-Z0-9_]*')
def findBe... | mit | Python |
bbe0cf1666b4706973bfba73ed77126581026057 | add new test case to test add image from local file system. | zstackio/zstack-woodpecker,zstackorg/zstack-woodpecker,zstackio/zstack-woodpecker,zstackorg/zstack-woodpecker,quarkonics/zstack-woodpecker,quarkonics/zstack-woodpecker,zstackio/zstack-woodpecker,zstackorg/zstack-woodpecker | integrationtest/vm/virt_plus/other/test_add_local_image.py | integrationtest/vm/virt_plus/other/test_add_local_image.py | '''
New Integration Test for add image from MN local URI.
The file should be placed in MN.
@author: Youyk
'''
import os
import time
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.opera... | apache-2.0 | Python | |
bfdcebfb287b6c3495e74888ace0409f47b530c9 | add testGroup script | USC-ACTLab/crazyswarm,USC-ACTLab/crazyswarm,USC-ACTLab/crazyswarm,USC-ACTLab/crazyswarm | ros_ws/src/crazyswarm/scripts/testGroup.py | ros_ws/src/crazyswarm/scripts/testGroup.py | #!/usr/bin/env python
import numpy as np
from pycrazyswarm import *
Z = 1.5
if __name__ == "__main__":
swarm = Crazyswarm()
timeHelper = swarm.timeHelper
allcfs = swarm.allcfs
allcfs.crazyfliesById[9].setGroup(1)
allcfs.crazyfliesById[10].setGroup(2)
allcfs.takeoff(targetHeight=Z, duration=... | mit | Python | |
ae3374305bad49c358a173e26490c5c90b219208 | test for multiple open-read-close cycle | yandex-load/volta,yandex-load/volta,yandex-load/volta,yandex-load/volta | tests/multiple_readings.py | tests/multiple_readings.py | import serial
import struct
import time
import pandas as pd
import numpy as np
def measure():
start_time = time.time()
with serial.Serial('/dev/cu.usbmodem14121', 1000000, timeout=1) as inport:
open_time = time.time()
data = inport.read(100)
read_time = time.time()
close_time = tim... | mpl-2.0 | Python | |
4e3644234fab9cb14a3d511b24bce3ed8a1446e0 | Add in a minor testcase. | paultag/python-muse | tests/scales/test_minor.py | tests/scales/test_minor.py | # Copyright (c) Paul R. Tagliamonte <tag@pault.ag>, 2015
#
# 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,... | mit | Python | |
e98065e04cfd52bb369d3b07d29f37fb458baa91 | add solution for Merge Intervals | zhyu/leetcode,zhyu/leetcode | src/mergeIntervals.py | src/mergeIntervals.py | # Definition for an interval.
# class Interval:
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution:
# @param intervals, a list of Interval
# @return a list of Interval
def merge(self, intervals):
if not intervals:
return []
res =... | mit | Python | |
6f8c64ed6f99493811cab54137a1eed44d851260 | Add python script to get group and module given a class name | InsightSoftwareConsortium/ITKExamples,InsightSoftwareConsortium/ITKExamples,InsightSoftwareConsortium/ITKExamples,InsightSoftwareConsortium/ITKExamples,InsightSoftwareConsortium/ITKExamples | scripts/GetGroupAndModuleFromClassName.py | scripts/GetGroupAndModuleFromClassName.py | #!/usr/bin/env python
""" Given the path to the ITK Source Dir
print group and module of a given class
for instance, try:
./GetGroupAndModuleFromClassName /path/to/ITK Image
"""
import sys
import os
itk_dir = sys.argv[1]
cmakefile = os.path.join( itk_dir, 'CMake', 'UseITK.cmake' )
if not os.path.exists( cmakefi... | apache-2.0 | Python | |
3ff18745a561ab28e04d9218e00fc0aa367631f5 | add `solution` module | scott-maddox/obpds | src/obpds/solution.py | src/obpds/solution.py | #
# Copyright (c) 2015, Scott J Maddox
#
# This file is part of Open Band Parameters Device Simulator (OBPDS).
#
# OBPDS 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... | agpl-3.0 | Python | |
9a2f68d14ae2d576c59035c67ffa12c96b4f748a | Add provider tests | Mause/statistical_atlas_of_au | test_saau.py | test_saau.py | from saau.loading import load_image_providers, load_service_providers
def test_load_service_providers():
assert load_service_providers(None)
def test_load_image_providers():
assert load_image_providers(None) | mit | Python | |
018be657ea3e088b3116e8a78fe81713a2a30e29 | Add tifftopdf, a frontend for tiff2pdf and tiffinfo. | rsmith-nl/scripts,rsmith-nl/scripts | tifftopdf.py | tifftopdf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: R.F. Smith <rsmith@xs4all.nl>
# 2012-06-29
#
# To the extent possible under law, Roland Smith has waived all copyright and
# related or neighboring rights to NAME. This work is published from the
# Netherlands. See http://creativecommons.org/publicdomain/zero/1.... | mit | Python | |
6dcbb2004271860b7d2e8bf0d12da46c925f151c | add a utility to show/set/clear software write protect on a lun | rosjat/python-scsi,AHelper/python-scsi,AHelper/python-scsi | tools/swp.py | tools/swp.py | #!/usr/bin/env python
# coding: utf-8
#
# A simple example to show/set/clear the software write protect flag SWP
#
import sys
from pyscsi.pyscsi.scsi import SCSI
from pyscsi.pyscsi.scsi_device import SCSIDevice
from pyscsi.pyscsi import scsi_enum_modesense6 as MODESENSE6
def usage():
print 'Usage: swp.py [--hel... | lgpl-2.1 | Python | |
80d2fa29185e9c3c54ed1e173122bbe5a78624a4 | Create tutorial4.py | mcfey/ggame-tutorials | tutorial4.py | tutorial4.py | mit | Python | ||
f8d4596db159f143d51c62ea2a097a72f9877ee6 | Add test for clusqmgr | fbraem/mqweb,fbraem/mqweb,fbraem/mqweb | test/clusqmgr.py | test/clusqmgr.py | import unittest
from testbase import MQWebTest
class TestQueueActions(MQWebTest):
def testInquire(self):
data = self.getJSON('/api/clusqmgr/inquire/' + self.qmgr)
self.assertFalse('mqweb' not in data, 'No mqweb data returned')
if 'error' in data:
self.assertFalse(True, 'Received a WebSphere MQ error:' ... | mit | Python | |
e21e04436f0596f25ca3fb75a9fe15916687c955 | Add utils.py tests | openstack/monasca-persister,stackforge/monasca-persister,stackforge/monasca-persister,openstack/monasca-persister,openstack/monasca-persister,stackforge/monasca-persister | monasca_persister/tests/test_utils.py | monasca_persister/tests/test_utils.py | # (C) Copyright 2019 Fujitsu Limited
#
# 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 in w... | apache-2.0 | Python | |
66443f49c932fba9203b878b7be5f8c1a99a4e9e | make pacbio like names | jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public | iron/utilities/rename_to_pacbio.py | iron/utilities/rename_to_pacbio.py | #!/usr/bin/python
import sys,argparse
from SequenceBasics import FastaHandleReader, FastqHandleReader
def main():
parser = argparse.ArgumentParser()
parser.add_argument('input',help="Use - for STDIN")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--fasta',action='store_true')
... | apache-2.0 | Python | |
b3633655ce700adfe3bd5390735edf799fd56624 | add missing migration | senkal/gunnery,gunnery/gunnery,gunnery/gunnery,senkal/gunnery,gunnery/gunnery,senkal/gunnery,senkal/gunnery,gunnery/gunnery | gunnery/core/migrations/0003_auto__add_field_server_port.py | gunnery/core/migrations/0003_auto__add_field_server_port.py | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Server.port'
db.add_column(u'core_server', 'port',
... | apache-2.0 | Python | |
dddac1090fae15edb9a8d2a2781bb80989a0bc84 | add eventrange control | mlassnig/pilot2,mlassnig/pilot2,PalNilsson/pilot2,PalNilsson/pilot2 | pilot/control/eventrange.py | pilot/control/eventrange.py | #!/usr/bin/env python
# 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
#
# Authors:
# - Wen Guan, wen.guan@cern.ch, 2018
import json
import Queue
im... | apache-2.0 | Python | |
42d6f1d17ea0f0117a82eb1933a5150b5eb1e29a | add missing is_context_manager | enthought/pikos,enthought/pikos,enthought/pikos | pikos/_internal/util.py | pikos/_internal/util.py | import inspect
def is_context_manager(obj):
""" Check if the obj is a context manager """
# FIXME: this should work for now.
return hasattr(obj, '__enter__') and hasattr(obj, '__exit__')
| bsd-3-clause | Python | |
ec2310dc42ccdeaafc74c232fad3199dcd22e252 | Create EPICLocSearch_parse-intron.py | RetelC/PDra_Phylogeography,RetelC/PDra_Phylogeography | EPICLocSearch_parse-intron.py | EPICLocSearch_parse-intron.py | " " " this file was created in november 2014
as part of a de novo search for EPIC loci in
the chaetognath species Pterosagitta draco
property of dr. Ferdinand Marlétaz
" " "
#!/usr/bin/env python
import sys
import re
from collections import defaultdict
def reverse(ali,taxa,clust):
alen=len(ali[taxa[0]])
#p... | mit | Python | |
c0a809ff79d90712a5074d208193ac9fd2af9901 | Add haproxy parser | jiasir/playback,nofdev/playback | playback/cli/haproxy.py | playback/cli/haproxy.py | import sys
from playback.api import HaproxyInstall
from playback.api import HaproxyConfig
from playback.templates.haproxy_cfg import conf_haproxy_cfg
from playback.cliutil import priority
def install(args):
try:
target = HaproxyInstall(user=args.user, hosts=args.hosts.split(','), key_filename=args.key_file... | mit | Python | |
acc5c52011db4c8edc615ae3e0cad9cea4fe58b8 | Add basic test for filesystem observer source | znerol/spreadflow-observer-fs,spreadflow/spreadflow-observer-fs | spreadflow_observer_fs/test/test_source.py | spreadflow_observer_fs/test/test_source.py | # -*- coding: utf-8 -*-
# pylint: disable=too-many-public-methods
"""
Integration tests for spreadflow filesystem observer source.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import copy
from bson import BSON
from datetime import datetime
from t... | mit | Python | |
4d1c81af1d028b2d0fd58f8bab7e7e0246c04f3b | Create alternative_matching.py | JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking | hacker_rank/regex/grouping_and_capturing/alternative_matching.py | hacker_rank/regex/grouping_and_capturing/alternative_matching.py | Regex_Pattern = r'^(Mr\.|Mrs\.|Ms\.|Dr\.|Er\.)[a-zA-Z]{1,}$' # Do not delete 'r'.
| mit | Python | |
8033f8a033ddc38c3f1e2276c8c2b4f50c8360fb | Add Python template | nathanielng/code-templates,nathanielng/code-templates,nathanielng/code-templates | src/template.py | src/template.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import argparse
def main(filename=None):
print("Hello world!")
if os.path.isfile(filename) is not True:
... | apache-2.0 | Python | |
11603040c58e27ebb109275bd4454a54e0c61d42 | Test examples | miniworld-project/miniworld_core,miniworld-project/miniworld_core | tests/acceptance/test_examples.py | tests/acceptance/test_examples.py | from typing import Dict
from miniworld.util import JSONConfig
# TODO: examples/batman_adv.json, problem is configurator
def test_snapshot_boot_single_scenario(image_path, runner):
with runner() as r:
for _ in range(5):
scenario = JSONConfig.read_json_config('examples/nb_bridged_lan.json') # ... | mit | Python | |
d2c5462c5677d7674921f02687017f4128f219f7 | Create while_loop_else.py | joshavenue/python_notebook | while_loop_else.py | while_loop_else.py | // You can actually do a while loop that ends with an else //
while True:
...
...
...
...
else:
| unlicense | Python | |
0322e1c51fe07cc9707a687ab309a00ca374a1af | Add a cleanup_test_data management command to remove old test data from dev and stage | mozilla/moztrap,mozilla/moztrap,mccarrmb/moztrap,mccarrmb/moztrap,mccarrmb/moztrap,mozilla/moztrap,mccarrmb/moztrap,mccarrmb/moztrap,mozilla/moztrap,mozilla/moztrap | moztrap/model/core/management/commands/cleanup_test_data.py | moztrap/model/core/management/commands/cleanup_test_data.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from datetime import datetime
from optparse import make_option
from django.core.management.base import BaseCommand
fro... | bsd-2-clause | Python | |
e2004076b1e04df21d9122d94e8ac00776542483 | Create new package. (#6044) | LLNL/spack,skosukhin/spack,skosukhin/spack,EmreAtes/spack,tmerrick1/spack,EmreAtes/spack,mfherbst/spack,iulian787/spack,LLNL/spack,LLNL/spack,matthiasdiener/spack,iulian787/spack,matthiasdiener/spack,EmreAtes/spack,matthiasdiener/spack,skosukhin/spack,krafczyk/spack,tmerrick1/spack,LLNL/spack,EmreAtes/spack,EmreAtes/sp... | var/spack/repos/builtin/packages/r-allelicimbalance/package.py | var/spack/repos/builtin/packages/r-allelicimbalance/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... | lgpl-2.1 | Python | |
483cdf6b4dd846d9da11788ae98d86d373fb5c49 | add analyze script | petuum/public,petuum/public,petuum/public,petuum/public,petuum/public | app/lda/scripts/analyze.py | app/lda/scripts/analyze.py | from __future__ import print_function
import numpy as np
import sys
import pandas as pd
phi_path = '/users/wdai/bosen/app/lda/output/lda.S0.M4.T32/lda_out.phi'
num_topics = 100
num_words = 52210
top_k = 10
dict_path = '/users/wdai/bosen/app/lda/datasets/words_freq.tsv'
topk_file = '/users/wdai/bosen/app/lda/output/top... | bsd-3-clause | Python | |
fcb02edeb8fafa8c297d48edc8ebf6b389321430 | add test | fukatani/stacked_generalization | test_iris.py | test_iris.py | import unittest
from sklearn import datasets
from sklearn.utils.validation import check_random_state
from stacked_generalization import StackedClassifier, FWLSClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.ensemble import GradientBoostingCla... | apache-2.0 | Python | |
2d0f76538f8927a85a2c51b0b6c34f54c775b883 | Add kmeans receiver | WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos | lexos/receivers/kmeans_receiver.py | lexos/receivers/kmeans_receiver.py | from lexos.receivers.base_receiver import BaseReceiver
class KmeansOption:
def __init__(self,):
class KmeansReceiver(BaseReceiver):
def options_from_front_end(self) -> KmeansOption:
"""Get the Kmeans option from front end.
:return: a KmeansOption object to hold all the options.
"""
| mit | Python | |
ab87f960ecb6f330f4574d2e8dc6b3d4cc96c40f | add solution for Spiral Matrix II | zhyu/leetcode,zhyu/leetcode | src/spiralMatrixII.py | src/spiralMatrixII.py | class Solution:
# @return a list of lists of integer
def generateMatrix(self, n):
if n == 0:
return []
dirs = [[0, 1], [1, 0], [0, -1], [-1, 0]]
cur = cur_d = 0
cur_x = cur_y = 0
matrix = [[0 for col in xrange(n)] for row in xrange(n)]
while cur != n*... | mit | Python | |
69a031db7d83254291349804ee5f59fe9972f181 | Add simple jitclass example | sklam/numba,gmarkall/numba,gmarkall/numba,stonebig/numba,stuartarchibald/numba,seibert/numba,stonebig/numba,numba/numba,stuartarchibald/numba,seibert/numba,sklam/numba,gmarkall/numba,jriehl/numba,sklam/numba,jriehl/numba,IntelLabs/numba,IntelLabs/numba,stefanseefeld/numba,numba/numba,seibert/numba,sklam/numba,numba/num... | examples/jitclass.py | examples/jitclass.py | """
A simple jitclass example.
"""
import numpy as np
from numba import jitclass # import the decorator
from numba import int32, float32 # import the types
spec = [
('value', int32), # a simple scalar field
('array', float32[:]), # an array field
]
@jitclass(spec)
class Ba... | bsd-2-clause | Python | |
5273a97ab1da4b809573617d3fc01705c322992f | Add tests for form mixin. | thecut/thecut-authorship | thecut/authorship/tests/test_forms.py | thecut/authorship/tests/test_forms.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.test import TestCase
from django import forms
from mock import patch
from test_app.models import AuthorshipModel
from thecut.authorship.factories import UserFactory
from thecut.authorship.forms import AuthorshipMixin
class Au... | apache-2.0 | Python | |
e838b6d53f131badfbb7b51b4eb268ebb5d7c450 | Add tests for using the new Entity ID tracking in the rule matcher | banglakit/spaCy,spacy-io/spaCy,recognai/spaCy,explosion/spaCy,raphael0202/spaCy,aikramer2/spaCy,oroszgy/spaCy.hu,Gregory-Howard/spaCy,Gregory-Howard/spaCy,aikramer2/spaCy,banglakit/spaCy,raphael0202/spaCy,honnibal/spaCy,banglakit/spaCy,raphael0202/spaCy,recognai/spaCy,spacy-io/spaCy,oroszgy/spaCy.hu,raphael0202/spaCy,b... | spacy/tests/matcher/test_entity_id.py | spacy/tests/matcher/test_entity_id.py | from __future__ import unicode_literals
import spacy
from spacy.vocab import Vocab
from spacy.matcher import Matcher
from spacy.tokens.doc import Doc
from spacy.attrs import *
import pytest
@pytest.fixture
def en_vocab():
return spacy.get_lang_class('en').Defaults.create_vocab()
def test_init_matcher(en_vocab)... | mit | Python | |
2cf812ba2015bfcc392a2f401c253850b31060c7 | Make sure all tags are alphanumeric | 0x90sled/catapult,dstockwell/catapult,catapult-project/catapult,sahiljain/catapult,benschmaus/catapult,dstockwell/catapult,SummerLW/Perf-Insight-Report,SummerLW/Perf-Insight-Report,danbeam/catapult,catapult-project/catapult-csm,danbeam/catapult,modulexcite/catapult,sahiljain/catapult,zeptonaut/catapult,catapult-project... | perf_insights/perf_insights/upload.py | perf_insights/perf_insights/upload.py | # Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
import sys
import webapp2
import uuid
from perf_insights import trace_info
sys.path.append('third_party')
import cloudstorage as gc... | # Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import webapp2
import uuid
from perf_insights import trace_info
sys.path.append('third_party')
import cloudstorage as gcs
default... | bsd-3-clause | Python |
084f9bb8333a7cfb3f4247afbcae62375060fa2b | Add rude graphics mode tester | Jartza/octapentaveega,Jartza/octapentaveega,Jartza/attiny85-vga,Jartza/attiny85-vga | tests/testpic.py | tests/testpic.py | import serial
import time
import random
import sys
# Give port name of your UART as first argument. No error checking
# here, sorry.
#
ser = serial.Serial(sys.argv[1], 9600, timeout = 1)
serwrite = lambda x: ser.write(bytearray(map(ord, x)))
move_to = lambda x, y: serwrite("\x1B[{0};{1}H".format(y, x))
serwrite("xx... | apache-2.0 | Python | |
a1eff713339d528720ed5999d05a85066018f070 | Add visualise.py | rstebbing/bspline-regression | visualise.py | visualise.py | # visualise.py
# Imports
import argparse
import json
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from uniform_bspline import Contour
# main
def main():
parser = argparse.ArgumentParser()
parser.add_argument('input_path')
parser.add_argument(... | mit | Python | |
ee5089a6a16c5a6142444a0ad312fdb641aa845c | Fix tests | neizod/argcomplete,neizod/argcomplete,lisongmin/argcomplete,kislyuk/argcomplete,lisongmin/argcomplete,douglas-larocca/argcomplete,landonb/argcomplete,landonb/argcomplete,douglas-larocca/argcomplete,kislyuk/argcomplete | test/test.py | test/test.py | #!/usr/bin/env python
import locale
import os
import sys
import unittest
from tempfile import TemporaryFile
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from argparse import ArgumentParser
from argcomplete import *
IFS = '\013'
class TestArgcomplete(unittest.TestCase):
@cla... | #!/usr/bin/env python
import locale
import os
import sys
import unittest
from tempfile import TemporaryFile
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from argparse import ArgumentParser
from argcomplete import *
IFS = '\013'
class TestArgcomplete(unittest.TestCase):
@cla... | apache-2.0 | Python |
a10648569bbd5dca44adc3cfd5a128703325932b | Create dihedral_tent.py | msmbuilder/mdentropy,msmbuilder/mdentropy | dihedral_tent.py | dihedral_tent.py | import numpy as np
import mdtraj as md
import argparse, cPickle
from multiprocessing import Pool
from itertools import product
from itertools import combinations_with_replacement as combinations
from contextlib import closing
def rbins(n=30):
return np.linspace(-np.pi, np.pi, n+3)[1:-1]
def ent(H):
H /= H... | mit | Python | |
13e45a8578e57e2cb55b29980b0f3326dd393a20 | Create sump_monitor.py | danodemano/monitoring-scripts,danodemano/monitoring-scripts | sump_monitor.py | sump_monitor.py | #Import the required modules
import RPi.GPIO as GPIO
import time
import requests
import math
#Setup the GPIO
GPIO.setmode(GPIO.BCM)
#Define the TRIG and ECO pins - these are labeled on the sensor
TRIG = 23
ECHO = 24
#Number of readings we are going to take to avoid issues
numreadings = 7
#Alert that we are starting... | mit | Python | |
9a6ca54f7cca0bd5f21f0bc590a034e7e3e05b6e | Add migration to add userprofiles to existing users | project-icp/bee-pollinator-app,project-icp/bee-pollinator-app,project-icp/bee-pollinator-app,project-icp/bee-pollinator-app | src/icp/apps/user/migrations/0002_add_userprofiles_to_existing_users.py | src/icp/apps/user/migrations/0002_add_userprofiles_to_existing_users.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.contrib.postgres.fields
from django.conf import settings
def create_user_profiles_for_existing_users(apps, schema_editor):
User = apps.get_model('auth', 'User')
UserProfile = apps.get_model('... | apache-2.0 | Python | |
a47d2654a5e23417c9e23f2ad19ed1b150524337 | add new mtc script | legoktm/legobot-old,legoktm/legobot-old | trunk/mtc.py | trunk/mtc.py | #!/usr/bin/python
"""
(C) Legoktm, 2008
Distributed under the terms of the MIT license.
__version__ = '$Id: $'
"""
import urllib, re, time
import os, sys
sys.path.append(os.environ['HOME'] + '/stuffs/pywiki/pylegoktm')
import wikipedia, pagegenerators, catlib
from image import *
from upload import UploadRobot
def... | mit | Python | |
c2d658ed1caa91eb963a3df850b5cf9b99633f69 | Add missing transpose.py | ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost | python/bifrost/transpose.py | python/bifrost/transpose.py |
# Copyright (c) 2016, The Bifrost Authors. All rights reserved.
# Copyright (c) 2016, NVIDIA CORPORATION. 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 r... | bsd-3-clause | Python | |
f46b08ce3d45b44d3f71759705e8045322c6155d | Create __init__.py | PyThaiNLP/pythainlp | pythainlp/spell/__init__.py | pythainlp/spell/__init__.py | # TODO
| apache-2.0 | Python | |
1d70b3600ed7e56ad610787d1d5f8c7980121b8f | Add lzyf compreesion | madhuri2k/fantastic-spoon,madhuri2k/fantastic-spoon,madhuri2k/fantastic-spoon | yay0/lzyf.py | yay0/lzyf.py | # Compressor for LZYF
import yay0, logging, struct
maxOffsets = [16, 32, 1024]
maxLengths = {16: 513, 32: 4, 1024: 17}
log = logging.getLogger("lzyf")
def compress(src):
src_size = len(src)
dst_size = 0
dst = bytearray()
src_pos = 0
rl = 0
ctrl_byte = 0
buf = bytearray()
# Start a co... | mit | Python | |
82069f44f8b8bcb9f7b4df9a267a8641c54b0442 | convert dwt_idwt doctests to nose tests. | kwohlfahrt/pywt,kwohlfahrt/pywt,PyWavelets/pywt,aaren/pywt,rgommers/pywt,grlee77/pywt,aaren/pywt,michelp/pywt,eriol/pywt,grlee77/pywt,PyWavelets/pywt,michelp/pywt,rgommers/pywt,ThomasA/pywt,eriol/pywt,rgommers/pywt,rgommers/pywt,ThomasA/pywt,Dapid/pywt,michelp/pywt,kwohlfahrt/pywt,aaren/pywt,eriol/pywt,Dapid/pywt,Thoma... | pywt/tests/test_dwt_idwt.py | pywt/tests/test_dwt_idwt.py | #!/usr/bin/env python
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (run_module_suite, assert_allclose, assert_,
assert_raises, dec)
import pywt
def test_dwt_idwt_basic():
x = [3, 7, 1, 1, -2, 5, 4, 6]
cA, cD = pywt.dwt(x, 'db2')
cA_exp... | mit | Python | |
34001081c2cfaa86d85f7a5b51925dca4a6e1a9f | Use Python 3 type syntax in `zerver/webhooks/yo/view.py`. | tommyip/zulip,synicalsyntax/zulip,eeshangarg/zulip,rht/zulip,andersk/zulip,showell/zulip,kou/zulip,zulip/zulip,punchagan/zulip,eeshangarg/zulip,kou/zulip,andersk/zulip,rht/zulip,punchagan/zulip,rht/zulip,jackrzhang/zulip,andersk/zulip,shubhamdhama/zulip,kou/zulip,rishig/zulip,andersk/zulip,shubhamdhama/zulip,rishig/zul... | zerver/webhooks/yo/view.py | zerver/webhooks/yo/view.py | # Webhooks for external integrations.
from typing import Optional
import ujson
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.actions import check_send_private_message
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.re... | # Webhooks for external integrations.
from typing import Optional
import ujson
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.actions import check_send_private_message
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.re... | apache-2.0 | Python |
8c98d12a08617b9a1ab1a264b826f5e9046eca05 | Add getHWND/getAllWindows utility functions for bots. | brainbots/assistant | assisstant/bots/utility.py | assisstant/bots/utility.py | import subprocess
# criteria: dictionary that has key/values to match against.
# e.g. {"wm_class": "Navigator.Firefox"}
def getHWND(criteria):
windows = getAllWindows()
for window in windows:
if criteria.items() <= window.items():
return window
return None
def getAllWindows():
windows = []
with s... | apache-2.0 | Python | |
4912c8261dba456e8e4a62051afdf01565f20ae9 | Add first iteration of raw_to_average_jpegs.py. | nth10sd/raw-images-to-average-jpegs | raw_to_average_jpegs.py | raw_to_average_jpegs.py | #! /usr/bin/env python
#
# Tested on Macs. First run `brew install ufraw exiftool`
import argparse
import glob
import multiprocessing as mp
import os
import subprocess
def parseArgs():
desc = 'Auto-white-balance raw images and create average-sized JPEG files with their EXIF info.'
parser = argparse.ArgumentP... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.