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
41af5deac1332302b478b57376053d03721bade7
Add the missing legend module
jaj42/dyngraph,jaj42/GraPhysio,jaj42/GraPhysio
dyngraph/legend.py
dyngraph/legend.py
import pyqtgraph as pg __all__ = ['MyLegendItem'] class MyLegendItem(pg.LegendItem): def __init__(self, size=None, offset=(40,5)): super().__init__(size, offset) def paint(self, p, *args): p.setPen(pg.mkPen(0,0,0,255)) p.setBrush(pg.mkBrush(255,255,255,255)) p.drawRect(...
isc
Python
3c057dcf61292bc4c268e430aa7a11b2fc0a56f8
Create generate_cloud.py
prakhar21/SocialCops,prakhar21/SocialCops
generate_cloud.py
generate_cloud.py
''' Author: Prakhar Mishra Date: 11/01/2016 ''' # Importing packages import sys import matplotlib.pyplot as plt from wordcloud import WordCloud, STOPWORDS from scipy.misc import imread import csv # Opening and getting marker for input file data = open(str(sys.argv[1]), 'r') data_reader = csv.reader(data) # Reads o...
apache-2.0
Python
74388ceaacb7eedf98eb03f1263ea2ec6db596e1
Add initial script to export feed downloads.
AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter...
python_scripts/media_export_through_api.py
python_scripts/media_export_through_api.py
# -*- coding: utf-8 -*- import psycopg2 import psycopg2.extras import requests import json import mc_database import mediacloud def get_download_from_api( mc_api_url, api_key, downloads_id ): r = requests.get( mc_api_url +'/api/v2/downloads/single/' + str( downloads_id) , params = { 'k...
agpl-3.0
Python
b9f464491a6131940ff2b88586ccdd44431ce992
add fpga-bit-to-bin.py
pavel-demin/red-pitaya-notes,pavel-demin/red-pitaya-notes,fbalakirev/red-pitaya-notes,pavel-demin/red-pitaya-notes,pavel-demin/red-pitaya-notes,pavel-demin/red-pitaya-notes,pavel-demin/red-pitaya-notes,fbalakirev/red-pitaya-notes,pavel-demin/red-pitaya-notes,fbalakirev/red-pitaya-notes,fbalakirev/red-pitaya-notes,fbala...
scripts/fpga-bit-to-bin.py
scripts/fpga-bit-to-bin.py
#!/usr/bin/python # copied from https://github.com/topic-embedded-products/meta-topic/blob/master/recipes-bsp/fpga/fpga-bit-to-bin/fpga-bit-to-bin.py import sys import os import struct def flip32(data): sl = struct.Struct('<I') sb = struct.Struct('>I') b = buffer(data) d = bytearray(len(data)) for offset in xra...
mit
Python
1359a099e7019767cfd904eee0c510c3b33a7d03
add script to generate pcap files
usi-systems/p4paxos,usi-systems/p4paxos,usi-systems/p4paxos,usi-systems/p4paxos,usi-systems/p4paxos
generate_pcap_files.py
generate_pcap_files.py
#!/usr/bin/env python from scapy.all import * import sys import argparse class Paxos(Packet): name ="PaxosPacket " fields_desc =[ XByteField("msgtype", 0x3), XShortField("instance", 0x1), XByteField("round", 0x1), XByteField("vr...
apache-2.0
Python
8b834db0b7632c31c06a2958799fa7e29b505aaf
add robust kinematic example
hungpham2511/toppra,hungpham2511/toppra,hungpham2511/toppra
examples/robust_kinematics.py
examples/robust_kinematics.py
import toppra as ta import toppra.constraint as constraint import toppra.algorithm as algo import numpy as np import matplotlib.pyplot as plt import argparse def main(): parser = argparse.ArgumentParser(description="An example showcasing the usage of robust constraints." ...
mit
Python
d82d66e7210a3f628d47a1a5463d6ac244d8f1c8
Gather product infomation
sdgdsffdsfff/Cmdb_Puppet,henry-zhang/Cmdb_Puppet
gethostinfo/product.py
gethostinfo/product.py
#!/home/python/bin/python # -*- coding:utf-8 -*- from subprocess import PIPE,Popen import urllib, urllib2 def getDMI(): p = Popen('dmidecode',shell=True,stdout=PIPE) stdout, stderr = p.communicate() return stdout def parserDMI(dmidata): pd = {} fd = {} line_in = False for line in dmidata...
epl-1.0
Python
f82998254b5b93c6fafc36fa23fa4c1566d42125
Add interpreter stump
zmbc/shakespearelang,zmbc/shakespearelang,zmbc/shakespearelang
shakespeare_interpreter.py
shakespeare_interpreter.py
from shakespeare_parser import shakespeareParser import argparse argparser = argparse.ArgumentParser(description = "Run files in Shakespeare Programming Language.") argparser.add_argument('filename', type=str, help="SPL file location") args = argparser.parse_args() if(args.filename): with open(args.filename, 'r'...
mit
Python
a11155e5df71370e2153b9ac34e34ece8c5603fd
Create separate supervisor for running under the GUI
OrganDonor/Organelle,OrganDonor/Organelle
gui-supervisor.py
gui-supervisor.py
#!/usr/bin/env python """Master program for the Organ Donor "Organelle" This program is mainly responsible for monitoring the physical rotary switch that allows users to select a major mode of operation for the Organelle. When it detects that the switch has been moved, it asks the current program to clean up and exit ...
cc0-1.0
Python
d5435f2b0548f762985652b07ef047b68552b069
add guided backprop relu
diogo149/treeano,jagill/treeano,jagill/treeano,diogo149/treeano,nsauder/treeano,nsauder/treeano,jagill/treeano,nsauder/treeano,diogo149/treeano
treeano/sandbox/nodes/guided_backprop.py
treeano/sandbox/nodes/guided_backprop.py
""" from "Striving for Simplicity - The All Convolutional Net" http://arxiv.org/abs/1412.6806 """ import treeano import treeano.sandbox.utils class _GuidedBackprop(treeano.sandbox.utils.OverwriteGrad): """ based on Lasagne Recipes on Guided Backpropagation """ def grad(self, inputs, out_grads): ...
apache-2.0
Python
91396ed246166f610e9cfc4519862f061af4e6b2
Enable Django Admin for some of our data
uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam
cat/admin.py
cat/admin.py
from django.contrib import admin from models import MuseumObject,FunctionalCategory class MOAdmin(admin.ModelAdmin): fields = ('registration_number','country','description','comment') list_display = ('registration_number','country','description','comment') list_filter = ('country','functional_category') ...
bsd-3-clause
Python
d44edfbb3561c136c9bf53dfafa42e34f96e476b
Add tests for rhs_reuse
cgranade/qutip,qutip/qutip,cgranade/qutip,qutip/qutip
qutip/tests/test_rhs_reuse.py
qutip/tests/test_rhs_reuse.py
# This file is part of QuTiP: Quantum Toolbox in Python. # # Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: ...
bsd-3-clause
Python
1541259e885ee498f05e42633d1bad3bac9d054d
Implement the LOADMODULE command
Heufneutje/txircd,ElementalAlchemist/txircd
txircd/modules/core/cmd_loadmodule.py
txircd/modules/core/cmd_loadmodule.py
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.ircd import ModuleLoadError from txircd.module_interface import Command, ICommand, IModuleData, ModuleData from zope.interface import implements # We're using the InspIRCd numerics, as they seem to be the only ones to actually use n...
bsd-3-clause
Python
edc982bdfaece6aaf23b3e7f9c967de800eacbd6
Implement links server notice type
Heufneutje/txircd
txircd/modules/extra/snotice_links.py
txircd/modules/extra/snotice_links.py
from twisted.plugin import IPlugin from txircd.modbase import IModuleData, ModuleData from zope.interface import implements class SnoLinks(ModuleData): implements(IPlugin, IModuleData) name = "ServerNoticeLinks" def actions(self): return [ ("serverconnect", 1, self.announceConnect), ("serverquit", ...
bsd-3-clause
Python
c65f59c6a6048807d29e5ce123447afd006ce05f
Add missing migration for username length
mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo
users/migrations/0007_username_length.py
users/migrations/0007_username_length.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-11-02 11:53 from __future__ import unicode_literals import django.contrib.auth.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0006_auto_20160508_1407'), ] operati...
mit
Python
50f33b1ae3b3ce6c1fb00a53145a7fe2fe822680
Add redis tests
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
dbaas/drivers/tests/test_driver_redis.py
dbaas/drivers/tests/test_driver_redis.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import mock import logging from django.test import TestCase from drivers import DriverFactory from physical.tests import factory as factory_physical from logical.tests import factory as factory_logical from logical.models import Database f...
bsd-3-clause
Python
e175cfda1e54586823e6bf0ad78145d175929b83
add entrypoints analysis module
bat-serjo/vivisect,cmaruti/vivisect,bat-serjo/vivisect,atlas0fd00m/vivisect,bat-serjo/vivisect,cmaruti/vivisect,atlas0fd00m/vivisect,vivisect/vivisect,vivisect/vivisect,vivisect/vivisect,cmaruti/vivisect,atlas0fd00m/vivisect
vivisect/analysis/generic/entrypoints.py
vivisect/analysis/generic/entrypoints.py
def analyze(vw): ''' Analysis module which processes entries in VaSet "EntryPoints" as Functions This is a vital analysis module, only made into a module to allow for control over when in the process it gets executed. ''' vw.processEntryPoints()
apache-2.0
Python
68e675f4531bf07cdc484837b02121941d4c8ad0
add engine_config.py
tmthyjames/SQLCell
engine_config.py
engine_config.py
# default connection string info here driver = 'postgresql' username = 'tdobbins' password = 'tdobbins' host = 'localhost' port = '5432' default_db = 'bls'
mit
Python
e32e4500676f043ca137bf5f8af04848f149e067
Add contribution.py
AwesomeTickets/Dashboard
script/contribution.py
script/contribution.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import urllib.request import json import sys OWNERS = ['AwesomeTickets'] REPOS = ['Dashboard', 'Integration', 'ServiceServer', 'StaticPageServer', 'DatabaseServer', 'CacheServer'] URL = 'https://api.github.com/repos/%s/%s/stats/contributors' def create_req(url): re...
mit
Python
cbf3c6140aafefbaef7186e0cb97d0758b1d38b2
add the dna algorithm (#6323)
TheAlgorithms/Python
strings/dna.py
strings/dna.py
import re def dna(dna: str) -> str: """ https://en.wikipedia.org/wiki/DNA Returns the second side of a DNA strand >>> dna("GCTA") 'CGAT' >>> dna("ATGC") 'TACG' >>> dna("CTGA") 'GACT' >>> dna("GFGG") 'Invalid Strand' """ r = len(re.findall("[ATCG]", dna)) != len(d...
mit
Python
1ef84c24c60cf802aeb4bf6084f9b7fc7696f79a
Add a script to print the scheduling times of albums
barrucadu/lainonlife,barrucadu/lainonlife,barrucadu/lainonlife,barrucadu/lainonlife
scripts/album_times.py
scripts/album_times.py
#!/usr/bin/env python3 """Radio scheduling program. Usage: album_times.py [--host=HOST] PORT Options: --host=HOST Hostname of MPD [default: localhost] -h --help Show this text Prints out the last scheduling time of every album. """ from datetime import datetime from docopt import docopt from mpd import M...
mit
Python
bab9866d6e255cfe74a5eaf325f8cc8a16648621
Add migration
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
lowfat/migrations/0089_auto_20170301_2349.py
lowfat/migrations/0089_auto_20170301_2349.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-01 23:49 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lowfat', '0088_auto_20170301_1411'), ] operations = [ migrations.AddField( ...
bsd-3-clause
Python
c0aa01adcf6385bb4d0b6ddd13299b6b0c3af566
Remove accidental leftovers
toolforger/sympy,emon10005/sympy,shikil/sympy,skidzo/sympy,rahuldan/sympy,ChristinaZografou/sympy,yukoba/sympy,rahuldan/sympy,saurabhjn76/sympy,souravsingh/sympy,Arafatk/sympy,mcdaniel67/sympy,wanglongqi/sympy,sahmed95/sympy,jerli/sympy,Titan-C/sympy,Curious72/sympy,kaichogami/sympy,farhaanbukhsh/sympy,Gadal/sympy,yuko...
sympy/geometry/__init__.py
sympy/geometry/__init__.py
""" A geometry module for the SymPy library. This module contains all of the entities and functions needed to construct basic geometrical data and to perform simple informational queries. Usage: ====== Notes: ====== Currently the geometry module supports 2-dimensional and 3 -dimensional Euclidean space. Exa...
""" A geometry module for the SymPy library. This module contains all of the entities and functions needed to construct basic geometrical data and to perform simple informational queries. Usage: ====== Notes: ====== Currently the geometry module supports 2-dimensional and 3 -dimensional Euclidean space. Exa...
bsd-3-clause
Python
2fadb52dae11ad0910c33f689074f65e8651a005
add script to sniff for prohibited files
AlanCoding/Ansible-inventory-file-examples,AlanCoding/Ansible-inventory-file-examples
scripts/prohibited/general.py
scripts/prohibited/general.py
#!/usr/bin/env python import os import json import re errors = list() my_file = __file__ my_dir = os.path.dirname(my_file) my_filename = my_file.rsplit(os.path.sep, 1)[1] # assert that only one tempfile is visible for tmpdir in ('/tmp', '/var/tmp'): for files in os.listdir(tmpdir): matches = [f for f in...
mit
Python
25561dab146c3bcd8b2ea8f0d7b3dfcf9cf0b8cc
add test with one null status coverage
stifoon/navitia,fueghan/navitia,fueghan/navitia,francois-vincent/navitia,djludo/navitia,thiphariel/navitia,Tisseo/navitia,thiphariel/navitia,Tisseo/navitia,datanel/navitia,antoine-de/navitia,antoine-de/navitia,stifoon/navitia,prhod/navitia,CanalTP/navitia,TeXitoi/navitia,prhod/navitia,is06/navitia,CanalTP/navitia,pboug...
source/jormungandr/tests/coverage_tests.py
source/jormungandr/tests/coverage_tests.py
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public tr...
agpl-3.0
Python
f64183528d4a44d4ac0f3d97e7847f8895d58039
implement the receiver
WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos
lexos/receivers/rolling_windows_receiver.py
lexos/receivers/rolling_windows_receiver.py
from enum import Enum from typing import NamedTuple, Optional from lexos.receivers.base_receiver import BaseReceiver class RWACountType(Enum): average = "average" ratio = "ratio" class RWATokenType(Enum): string = "string" regex = "regex" word = "word" class WindowUnitType(Enum): letter =...
mit
Python
408a541fc1cdd5198444db7703e0baffda493d82
Create mp3test.py
MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,mecax/pyrobotlab,MyRobotLab/pyrobotlab,mecax/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab
home/Markus/mp3test.py
home/Markus/mp3test.py
# this is a test script # i have a folder with the mp3 files named from music1 to music8. # it random choses the files . no problem # but i want to change the sleep(120) so the next starts when the previous is finished from java.lang import String from org.myrobotlab.service import Speech from org.myrobotlab.servi...
apache-2.0
Python
bda42a4630e8b9e720443b6785ff2e3435bfdfa6
Add code for getting team schedule and game outcomes
jldbc/pybaseball
pybaseball/team_results.py
pybaseball/team_results.py
import pandas as pd import requests from bs4 import BeautifulSoup # TODO: raise error if year > current year or < first year of a team's existence # TODO: team validation. return error if team does not exist. # TODO: sanitize team inputs (force to all caps) def get_soup(season, team): # get most recent year's sched...
mit
Python
0cf3d1d145c4ec8aa8e5c5917d610ee37776d26f
add positve and negative particle efficiency calculation options
tuos/RpPb2015Analysis,tuos/RpPb2015Analysis,tuos/RpPb2015Analysis,tuos/RpPb2015Analysis
eff/pPb/testppchargeDepEff/run_pp_cfg.py
eff/pPb/testppchargeDepEff/run_pp_cfg.py
import FWCore.ParameterSet.Config as cms process = cms.Process('TRACKANA') process.load('Configuration.StandardSequences.Services_cff') process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.StandardSequences.GeometryRecoDB_cff') proc...
mit
Python
30d0ca9fa2c76463569362eb0f640dbbe0079068
Add builder to compile coffeescript to javascript files
ZzCalvinzZ/ludumdare26,ZzCalvinzZ/ludumdare26
buildGame.py
buildGame.py
#!/usr/bin/env python import fnmatch import os from subprocess import call rootPath = 'ludumdare26' pattern = '*.coffee' for root, dirs, files in os.walk(rootPath): for filename in fnmatch.filter(files, pattern): print( os.path.join(root, filename)) call( [ 'coffee', '-c', os.path.join(root, fi...
apache-2.0
Python
054cfe232cd7672788e8b2b4e4af44b7cfbe99be
solve 1 problem
Shuailong/Leetcode
solutions/single-number-ii.py
solutions/single-number-ii.py
#!/usr/bin/env python # encoding: utf-8 """ single-number-ii.py Created by Shuailong on 2016-03-23. https://leetcode.com/problems/single-number-ii/. """ class Solution(object): def singleNumber(self, nums): """ O(n) time and O(1) space, but slower than Solution1 and Solution2. :type nu...
mit
Python
5e377f926e964f5d6d74ba713947f11b72534b70
Add namelizer.py to normalize feature names for Events
nickwbarber/HILT-annotations
namelizer.py
namelizer.py
import itertools import os from lxml import etree as ET import gate conversations_path = "/home/nick/hilt/pes/conversations" files = list( itertools.chain.from_iterable( ( [ os.path.join( results[0], x, ) ...
mit
Python
9a878c96ccf2fb7316dc6e9d330840a78ffd303b
Create second_degree_equation_solver.py
V3sth4cks153/Python-Programs
second_degree_equation_solver.py
second_degree_equation_solver.py
# -*- coding: utf-8 -*- import sys import math print " _____ _ _ _____ _ ___ " print "| __|___ _ _ ___| |_|_|___ ___ | __|___| |_ _ ___ ___ _ _ |_ | " print "| __| . | | | .'| _| | . | | |__ | . | | | | -_| _| | | |_ _| |_ " print "|_____|_ |__...
mit
Python
2c223297fa64acc853994d6970d422253ce033bd
fix http3 channel
hansroh/skitai,hansroh/skitai,hansroh/skitai
skitai/http3_server.py
skitai/http3_server.py
#!/usr/bin/env python from . import http_server from .counter import counter import socket, time from rs4 import asyncore import ssl from skitai import lifetime import os, sys, errno import skitai from errno import EWOULDBLOCK class http3_channel (https_server.https_channel): def __init__ (self, server, data, addr):...
mit
Python
4f865a4249ea3e5b349f2ab57d8b50c5582bf848
add git script
probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml
scripts/git_colab.py
scripts/git_colab.py
# test script def git_command(cmd): print('git command', cmd)
mit
Python
54c22e1f6cb129d24f4b611cfef00ef66ecff356
Create API for batch
ikinsella/squall,ikinsella/squall,ikinsella/squall,ikinsella/squall
flaskapp/appname/controllers/batchAPI.py
flaskapp/appname/controllers/batchAPI.py
from flask import Flask, jsonify, abort, request, session, Blueprint from flask_restful import Resource, Api from appname.models import (db, Batch) from flask.ext.restless import APIManager from flask.ext.sqlalchemy import SQLAlchemy batchAPI = Blueprint('batchAPI', __name__) @batchAPI.route('/addBatch', methods = ['...
bsd-3-clause
Python
7bcbd81ece25f5967248c650ee61e85e52c67203
Add ComparisonOperator to enums
suutari/shoop,suutari/shoop,suutari-ai/shoop,suutari-ai/shoop,suutari-ai/shoop,shoopio/shoop,shoopio/shoop,shoopio/shoop,suutari/shoop
shuup/utils/enums.py
shuup/utils/enums.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from django.utils.translation import ugettext_lazy as _ from enumfi...
agpl-3.0
Python
c58de5a29fb324b9fcd661319e4b6df9b5f189c0
fix an error in appeaser.py
ranjinidas/Axelrod,marcharper/Axelrod,ranjinidas/Axelrod,marcharper/Axelrod
axelrod/strategies/appeaser.py
axelrod/strategies/appeaser.py
from axelrod import Player class Appeaser(Player): """ A player who tries to guess what the opponent wants, switching his behaviour every time the opponent plays 'D'. """ def strategy(self, opponent): """ Start with 'C', switch between 'C' and 'D' when opponent plays 'D'. "...
from axelrod import Player class Appeaser(Player): """ A player who tries to guess what the opponent wants, switching his behaviour every time the opponent plays 'D'. """ def strategy(self, opponent): """ Start with 'C', switch between 'C' and 'D' when opponent plays 'D'. "...
mit
Python
86041833c9db3a7b6aa764a6bd449be563c2ede8
Add mocked tests
demisto/demisto-py,demisto/demisto-py
mock_tests.py
mock_tests.py
from urllib3_mock import Responses import demisto_client responses = Responses('requests.packages.urllib3') api_key = 'sample_api_key' host = 'http://localhost:8080' @responses.activate def test_get_docker_images(): body = '{ "images": [{"id": "aae7b8aaba8c", "repository": ' \ '"openapitools/openapi-...
apache-2.0
Python
1ddadaab8086569fe4f13612710d8a47442a4bfd
Read data in pickles
alfredolainez/deep-nlp
data_handling.py
data_handling.py
import json import pickle import random DEFAULT_REVIEWS_FILE = "data/yelp_academic_dataset_review.json" DEFAULT_REVIEWS_PICKLE = "data/reviews.pickle" def pickles_from_json(json_file=DEFAULT_REVIEWS_FILE, pickle_name=DEFAULT_REVIEWS_PICKLE, num_partitions=100): """ Dumps a json into a number of pickle partiti...
apache-2.0
Python
d26cc02d4ea3f625eee8deed67a42555245b977f
Implement KeOps MaternKernel
jrg365/gpytorch,jrg365/gpytorch,jrg365/gpytorch
gpytorch/kernels/keops/matern_kernel.py
gpytorch/kernels/keops/matern_kernel.py
#!/usr/bin/env python3 import torch import math from pykeops.torch import LazyTensor as KEOLazyTensor from ..kernel import Kernel from gpytorch.lazy import KeOpsLazyTensor class MaternKernel(Kernel): def __init__(self, nu=2.5, **kwargs): if nu not in {0.5, 1.5, 2.5}: raise RuntimeError("nu exp...
mit
Python
e6a7cafd95abb80b3bd235fd391c34685b4b5603
Add preprocessor for Leipzig Corpus
KshitijKarthick/tvecs,KshitijKarthick/tvecs,KshitijKarthick/tvecs
modules/preprocessor/leipzig_preprocessor.py
modules/preprocessor/leipzig_preprocessor.py
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- """Leipzig Preprocessor which inherits from BasePreprocessor.""" import os import codecs import regex as re from collections import defaultdict from base_preprocessor import BasePreprocessor class LeipzigPreprocessor(BasePreprocessor): """Leipzig Preprocessor whic...
mit
Python
c724e6f825c801c864c4498f6b35f2b0bb041b47
add item shop
ivoryhuang/LOL_simple_text_version
games/Item_Shop.py
games/Item_Shop.py
from items import * class Item_Shop(): def __init__(self): self.items = [] def prepare_items(self): pass
mit
Python
28d07102411cbd019bdac97ce6e1251af3bffd35
Add migration for Image
ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit
icekit/migrations/0006_image_imageitem.py
icekit/migrations/0006_image_imageitem.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('fluent_contents', '0001_initial'), ('icekit', '0005_remove_layout_key'), ] operations = [ migrations.CreateModel( ...
mit
Python
8f3b0928a7d12da534d18e14d29f504eb432de97
Create beta_password_generator.py
Orange9000/Codewars,Orange9000/Codewars
Solutions/beta/beta_password_generator.py
Solutions/beta/beta_password_generator.py
from random import randint import re ABC = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789" def password_gen(): password = ''.join(ABC[randint(0,81)] for i in range(0, randint(6, 20))) return password if re.fullmatch('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{6,20}', pas...
mit
Python
47bb7c90b657f4f9704e354b7fc03cb126b24d75
FIx git mv fail
tamasgal/km3pipe,tamasgal/km3pipe
examples/stats/guess_the_dist.py
examples/stats/guess_the_dist.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Guess the distribution! ======================= Fit several distributions to angular residuals. Note: to fit the landau distribution, you need to have ROOT and the ``rootpy`` package installed. """ import h5py import matplotlib.pyplot as plt import numpy as np from ...
mit
Python
df03481fd9b52e17bc637dacefd15bead4f07f23
Add initial version of membership fee updater
HelsinkiHacklab/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum
project/creditor/management/commands/update_membershipfees.py
project/creditor/management/commands/update_membershipfees.py
# -*- coding: utf-8 -*- import datetime import dateutil.parser from creditor.models import RecurringTransaction, TransactionTag from creditor.tests.fixtures.recurring import MembershipfeeFactory from django.core.management.base import BaseCommand, CommandError from members.models import Member class Command(BaseComm...
mit
Python
d38007954c927e38112c5500ba6f8328f8d4a66d
add command `manage.py drop [user_id]`
perGENIE/pergenie,perGENIE/pergenie,knmkr/perGENIE,knmkr/perGENIE,perGENIE/pergenie-web,knmkr/perGENIE,perGENIE/pergenie-web,knmkr/perGENIE,perGENIE/pergenie-web,perGENIE/pergenie-web,perGENIE/pergenie,perGENIE/pergenie,knmkr/perGENIE,perGENIE/pergenie-web,perGENIE/pergenie-web,perGENIE/pergenie,knmkr/perGENIE
pergenie/apps/db/management/commands/drop.py
pergenie/apps/db/management/commands/drop.py
# -*- coding: utf-8 -*- import sys, os import glob import shutil from pprint import pprint from optparse import make_option from pymongo import MongoClient # from termcolor import colored from django.core.management.base import BaseCommand from django.conf import settings from lib.api.genomes import Genomes genomes =...
agpl-3.0
Python
4e8ff1f7e524d8dc843816c714e86d11e21a8562
Add script to upload files to carto db
alejandro-mc/BDM-DDD,alejandro-mc/BDM-DDD
uploadtoCDB.py
uploadtoCDB.py
#uploadtoCDB.py #Written By: Alejandro Morejon Cortina (Apr 2016) #usage:python uploadtoCDB.py <username> <filecontainingkey.txt> <upload.csv> import sys import requests import csv import json import time #sys.argv[1] is the your cartodb user name #sys.argv[2] is the text file containing your api key #sys.argv[3] is ...
mit
Python
701d8ef1c4d97d7c58adca892992cc38bee321d5
Update app/helpers/marshmallow/__init__.py
apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl
app/helpers/marshmallow/__init__.py
app/helpers/marshmallow/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from .schema import ( TableSchemaOpts, ModelSchemaOpts, TableSchema, ModelSchema, ) from .convert import ( ModelConverter, fields_for_model, property2field, column2field, field_for, ) from .exceptions import ModelConver...
mit
Python
fa88245727ec8dbf5ed341bb9d5d0816a33e9415
Create Calendar.py
kejrp23/Python
Calendar.py
Calendar.py
""" Created on 3/26/27 Created for Codeacademy Training exersize. Written by: Jason R. Pittman Note: All comments are my own for information purpose and future building ideas. Note: They reflect my ideas and my ideas alone This is a calendar program for Command Line. The program should behave in the following way: P...
artistic-2.0
Python
45d097a2ac0bcc1dffaa3e13a7bfe0a7af266fd9
Create crawl-twitter.py
JosPolfliet/snippets
crawl-twitter.py
crawl-twitter.py
# coding: utf-8 # In[18]: import csv, codecs, cStringIO class UnicodeWriter: """ A CSV writer which will write rows to CSV file "f", which is encoded in the given encoding. """ def __init__(self, f, dialect=csv.excel, encoding="utf-8", **kwds): # Redirect output to a queue self....
mit
Python
bd312a1fd7a9633316b03d1473de84979120ae5f
Add sentiment generator
reinarduswindy/rojak,CodeRiderz/rojak,pyk/rojak,reinarduswindy/rojak,reinarduswindy/rojak,bobbypriambodo/rojak,CodeRiderz/rojak,bobbypriambodo/rojak,bobbypriambodo/rojak,rawgni/rojak,rawgni/rojak,bobbypriambodo/rojak,reinarduswindy/rojak,CodeRiderz/rojak,CodeRiderz/rojak,bobbypriambodo/rojak,bobbypriambodo/rojak,pyk/ro...
rojak-database/generate_sentiment_data.py
rojak-database/generate_sentiment_data.py
import MySQLdb as mysql from faker import Factory # Open database connection db = mysql.connect('localhost', 'root', 'rojak', 'rojak_database') # Create new db cursor cursor = db.cursor() sql = ''' INSERT INTO `sentiment`(`name`) VALUES ('{}'); ''' MAX_SENTIMENT=10 for i in xrange(MAX_SENTIMENT): # Generate ran...
bsd-3-clause
Python
46de363a67bc1bf7bd403625618bfd4b319c230b
Add dein/log source
Shougo/dein.vim,Shougo/dein.vim,Shougo/dein.vim
rplugin/python3/denite/source/dein_log.py
rplugin/python3/denite/source/dein_log.py
# ============================================================================ # FILE: dein.py # AUTHOR: delphinus <delphinus@remora.cx> # License: MIT license # ============================================================================ import re from denite.source.base import Base HEADER_RE = re.compile(r'^\s*[a-z...
mit
Python
06290c7ddd164ab508207713e5dff304a1907986
Create Pedidolistar.py
AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb
backend/Models/Grau/Pedidolistar.py
backend/Models/Grau/Pedidolistar.py
from Framework.Pedido import Pedido from Framework.ErroNoHTTP import ErroNoHTTP class PedidoListar(Pedido): def __init__(self,variaveis_do_ambiente): super(PedidoListar, self).__init__(variaveis_do_ambiente) try: self.nome = self.corpo['nome'] except: raise ErroNoHTTP(400) def getNome(self): ...
mit
Python
deb1987bcfb04a773cbc2e826a6d61790a95759b
Create KeepHorizontalHand.py
MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/juerg/KeepHorizontalHand.py
home/juerg/KeepHorizontalHand.py
i01 = Runtime.start("i01", "InMoov") hand = i01.startRightHand("COM15") arduino = Runtime.getService("i01.right") keepHorizontalOutPin = 13 boolean keepHorizontal = False def keepHorizontalStart(): arduino.digitalWrite(keepHorizontalOutPin, 1) keepHorizontal = True; i01.rightHand.wrist.detach() def keepHoriz...
apache-2.0
Python
cd44a9c7157f637ebeb289af11067d6c0d217fe9
add errors and debugging example
nsone/nsone-python,ns1/nsone-python
examples/errors-and-debugging.py
examples/errors-and-debugging.py
# # Copyright (c) 2014 NSONE, Inc. # # License under The MIT License (MIT). See LICENSE in project root. # from nsone import NSONE, Config # to enable verbose logging, set 'verbosity' in the config and use # the standard python logging system config = Config() config.createFromAPIKey('qACMD09OJXBxT7XOwv9v') config['...
mit
Python
70cec0f09d35c2ad202a3adc3d15bc7597de1b7a
Add monkey-patch test
reclosedev/requests-cache,YetAnotherNerd/requests-cache,femtotrader/requests-cache
tests/test_monkey_patch.py
tests/test_monkey_patch.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Path hack import os, sys sys.path.insert(0, os.path.abspath('..')) import unittest import time import json from collections import defaultdict import requests from requests import Request import requests_cache from requests_cache import CachedSession from requests_cach...
bsd-2-clause
Python
0e725b43caae9c0f14cdc2292c6110267afaa755
Add tests for session helpers
Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel
apps/explorer/tests/views/test_helpers.py
apps/explorer/tests/views/test_helpers.py
from apps.explorer.views.helpers import ( get_omics_units_from_session, get_selected_pixel_sets_from_session, set_omics_units_to_session, set_selected_pixel_sets_to_session, ) def test_get_omics_units_from_session_returns_empty_list(): empty_session = dict() omics_units = get_omics_units_from_sessio...
bsd-3-clause
Python
7c41770adac83bcb00424649d7d248e996363e9b
add 1st test
simpeg/simpeg
tests/em/nsem/forward/test_Recursive1D_VsAnalyticHalfspace.py
tests/em/nsem/forward/test_Recursive1D_VsAnalyticHalfspace.py
import unittest from SimPEG.electromagnetics import natural_source as nsem from SimPEG import maps import numpy as np from scipy.constants import mu_0 def create_survey(freq): receivers_list = [ nsem.receivers.AnalyticReceiver1D(component='real'), nsem.receivers.AnalyticReceiver1D(component='imag...
mit
Python
d1ca69d9b84fbcd034ee53e50de30fe48a0869a8
add migration to grandfather odata feed privileges to advanced and above plans
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
corehq/apps/accounting/migrations/0044_grandfather_odata_privs.py
corehq/apps/accounting/migrations/0044_grandfather_odata_privs.py
# Generated by Django 1.11.21 on 2019-10-07 13:21 from django.core.management import call_command from django.db import migrations from corehq.privileges import ODATA_FEED from corehq.util.django_migrations import skip_on_fresh_install @skip_on_fresh_install def _grandfather_odata_privs(apps, schema_editor): ca...
bsd-3-clause
Python
c2be8321712c46e1f94dae42f5003e960e8330c3
Create hp.py
OpM3TA/Python-Change-HP-Printer-Display
hp.py
hp.py
import os,sys,socket printer = socket.socket() """ Perl stuff -> \e%-12345X\@PJL JOB \@PJL RDYMSG DISPLAY="Hello" \@PJL EOJ \e%-12345X UEL = chr(0x1B)+chr(0x25)+chr(0x2D)+chr(0x31)+chr(0x32)+chr(0x33)+chr(0x34)+chr(0x35)+chr(0x58) buf = UEL + '...@PJL RDYMSG DISPLAY = "%s"\n' % (message) + UEL + "\n" """ def create...
unlicense
Python
bee511bc002395b3c55e7bd7664947857fd402da
Add bst.py
kentsommer/bst-amortized-analysis
bst.py
bst.py
import random from tabulate import tabulate class Node: def __init__(self, value, parent=None): self.value = value self.left = None self.right = None self.parent = parent class BST: def __init__(self): self.root = None def insert(self, value): if self.roo...
mit
Python
5244eaa269118036b255edfb51a3bd72dc9b0320
Add migration for reviews subscriptions (#10)
laurenrevere/osf.io,baylee-d/osf.io,binoculars/osf.io,sloria/osf.io,crcresearch/osf.io,leb2dg/osf.io,erinspace/osf.io,cslzchen/osf.io,crcresearch/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,mattclark/osf.io,laurenrevere/osf.io,adlius/osf.io,adlius/osf.io,leb2dg/osf.io,binoculars/osf.io,adlius/osf.io,aaxelb...
osf/migrations/0061_auto_20171002_1438.py
osf/migrations/0061_auto_20171002_1438.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-10-02 19:38 from __future__ import unicode_literals import logging from django.db import migrations from osf.models import OSFUser from osf.models import NotificationSubscription from website.notifications.utils import to_subscription_key logger = logging...
apache-2.0
Python
8955c00cdf3715b0f6403e9d049c0e221f77f7ac
Add helper script for testing
niklasf/lila-openingexplorer,niklasf/lila-openingexplorer
client.py
client.py
#!/usr/bin/env python import chess import chess.pgn import requests import random game = chess.pgn.Game() node = game board = game.board() while not board.is_game_over(claim_draw=True): move = random.choice(list(board.legal_moves)) node = node.add_variation(move) board.push(move) game.headers["Result"]...
agpl-3.0
Python
78bc3e4cb460a7f8e7f2164418744c7ca90fd2f3
Add a superclass for mapping with hawaii as a subclass.
ocefpaf/seapy,dalepartridge/seapy,powellb/seapy
map.py
map.py
#!/usr/bin/env python """ map.py State Estimation and Analysis for PYthon Utilities for dealing with basemap plotting. These routnes are simply abstractions over the existing basemap to make it quicker for generating basemap plots and figures. Written by Brian Powell on 9/4/14 Copyright (c)2013 Unive...
mit
Python
92840c5dc58e78bd41d4a3c7eaec58097f166585
add spider example, crawls entry titles
margelatu/czl-scrape,lbogdan/czl-scrape,code4romania/czl-scrape,lbogdan/czl-scrape,costibleotu/czl-scrape,lbogdan/czl-scrape,lbogdan/czl-scrape,margelatu/czl-scrape,mgax/czl-scrape,margelatu/czl-scrape,code4romania/czl-scrape,mgax/czl-scrape,mgax/czl-scrape,code4romania/czl-scrape,costibleotu/czl-scrape,costibleotu/czl...
justitie/just/spiders/test.py
justitie/just/spiders/test.py
# -*- coding: utf-8 -*- import scrapy from scrapy.loader import ItemLoader from items import JustPublication class TestSpider(scrapy.Spider): name = "test" def start_requests(self): yield scrapy.Request( url="http://www.just.ro/transparenta-decizionala/acte-normative/proiecte-in-dezbatere...
mpl-2.0
Python
1f476db6a86831b2b1462cdd3b27e8f2ae3d2187
Drop old_content table
Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2
alembic/versions/3d9034ad2d7d_really_drop_old_content.py
alembic/versions/3d9034ad2d7d_really_drop_old_content.py
"""really drop old content Revision ID: 3d9034ad2d7d Revises: 1dd2771cbf39 Create Date: 2015-03-29 12:01:54.276288 """ # revision identifiers, used by Alembic. revision = '3d9034ad2d7d' down_revision = '1dd2771cbf39' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa def upgrade...
apache-2.0
Python
380acef9c27a2445366eaec88acdf9672bdeb3c1
test class for FeedbackFeedTimelineBuilder
devilry/devilry-django,devilry/devilry-django,devilry/devilry-django,devilry/devilry-django
devilry/devilry_group/tests/test_feedbackfeed_timeline_builder.py
devilry/devilry_group/tests/test_feedbackfeed_timeline_builder.py
import devilry from django.test import RequestFactory, TestCase from django.utils import timezone import htmls import mock from model_mommy import mommy from devilry.devilry_group.views.feedbackfeed_student import StudentFeedbackFeedView from devilry.devilry_group.views.feedbackfeed_timeline_builder import FeedbackFeed...
bsd-3-clause
Python
80a1cc839abc23a80b511c99e6a6c03b044eaf35
Add downloader for per-polling-station data
akx/yle-kuntavaalit-2017-data
ext_download.py
ext_download.py
import argparse import glob import json from kvd_utils import download_json, get_session ext_url_template = 'https://vaalit.yle.fi/content/kv2017/{version}/electorates/{electorate}/municipalities/{municipality}/pollingDistricts/{district}/partyAndCandidateResults.json' def download_ext_data(version): sess = get...
mit
Python
c47ace2e77f87a2a249b8e43c4611c80e63bbe03
add verification for util/hosts.py
alfredodeza/ceph-doctor
ceph_medic/tests/util/test_hosts.py
ceph_medic/tests/util/test_hosts.py
import pytest from ceph_medic.util import hosts, configuration import ceph_medic from textwrap import dedent class TestContainerPlatform(object): def test_unable_to_retrieve_pods(self, stub_check): stub_check(([], ['error from command'], 1)) with pytest.raises(SystemExit) as error: h...
mit
Python
574b069363f74de35b75b6b28ca66976e6af45bb
Fix situation where session id is an int
dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq
corehq/apps/smsforms/management/commands/migrate_sms_sessions_to_sql.py
corehq/apps/smsforms/management/commands/migrate_sms_sessions_to_sql.py
import logging from django.core.management.base import BaseCommand from corehq.apps.smsforms.models import XFormsSession, sync_sql_session_from_couch_session, SQLXFormsSession from dimagi.utils.couch.database import iter_docs class Command(BaseCommand): args = "" help = "" def handle(self, *args, **optio...
import logging from django.core.management.base import BaseCommand from corehq.apps.smsforms.models import XFormsSession, sync_sql_session_from_couch_session, SQLXFormsSession from dimagi.utils.couch.database import iter_docs class Command(BaseCommand): args = "" help = "" def handle(self, *args, **optio...
bsd-3-clause
Python
36c31f33818c04e9122c8a5dcd325420bef94e56
add simplisitc test for demumble
nico/demumble,nico/demumble
demumble_test.py
demumble_test.py
from __future__ import print_function tests = [ ('demumble', ''), ('demumble hello', 'hello\n'), ('demumble _Z4funcPci', 'func(char*, int)\n'), ('demumble ?Fx_i@@YAHP6AHH@Z@Z', 'int __cdecl Fx_i(int (__cdecl*)(int))\n'), ] import os, subprocess for t in tests: cmd = t[0].split() # Assume that ...
apache-2.0
Python
803d62323c85cd9e29176f32b1094c5daca3c2dd
add wrapper for CHOLMOD cholesky factor object
Evfro/polara
polara/lib/cholesky.py
polara/lib/cholesky.py
class CholeskyFactor: def __init__(self, factor): self._factor = factor self._L = None self._transposed = False @property def L(self): if self._L is None: self._L = self._factor.L() return self._L @property def T(self): self._transposed =...
mit
Python
1fff1dba9ac1d2fa1a825e87d36d46ce0ddec894
Add distributions.py
ibab/python-mle
distributions.py
distributions.py
import theano.tensor as T from numpy import inf from math import pi def alltrue(vals): ret = 1 for c in vals: ret = ret * (1 * c) return ret def bound(logp, *conditions): return T.switch(alltrue(conditions), logp, -inf) class Distribution: def __init__(self): pass class Uniform(...
mit
Python
1323086d7d948253cd26e186af7fc16752b642a9
Add main app
seguri/json-beautifier,seguri/json-beautifier,seguri/json-beautifier
json-beautifier.py
json-beautifier.py
from google.appengine.api import memcache from webapp2_extras.security import generate_random_string import jinja2 import json import os import webapp2 MEMCACHE_EXPIRE = 5 * 60 # seconds JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), ) def is_json(s): try:...
mit
Python
c0aa90403183b47cd3c40afba5267d0e305cf1ca
add new module
albertbup/DeepBeliefNet,albertbup/DeepBeliefNetwork,albertbup/deep-belief-network
dbn/utils.py
dbn/utils.py
import numpy as np def batch_generator(batch_size, data, labels=None): """ Generates batches of samples :param data: array-like, shape = (n_samples, n_features) :param labels: array-like, shape = (n_samples, ) :return: """ n_batches = int(np.ceil(len(data) / float(batch_size))) idx = n...
mit
Python
c39aec0ae76868299fbbd72f145b4b27a5bc2d67
Create Annual_emissions.py
architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst
cea/plots/comparisons/Annual_emissions.py
cea/plots/comparisons/Annual_emissions.py
from __future__ import division from __future__ import print_function import plotly.graph_objs as go import cea.plots.comparisons from cea.plots.variable_naming import NAMING, COLOR __author__ = "Jimeno Fonseca" __copyright__ = "Copyright 2019, Architecture and Building Systems - ETH Zurich" __credits__ = ["Jimeno A...
mit
Python
4136eca2c09fcd3d12b147b2d1d7a11a12fbd94d
Add logcatPkg
androidyue/DroidPy
logcatPkg.py
logcatPkg.py
#!/usr/bin/env python #coding:utf-8 #author:andrewallanwallace@gmail.com #This script is aimed to grep logs by application(User should input a packageName and then we look up for the process ids then separate logs by process ids). import os import sys packageName=str(sys.argv[1]) command = "adb shell ps | grep %s | ...
apache-2.0
Python
03735a85521f43ce7af9db7bb1762e3e395bc154
Solve knowit2017/dec15
matslindh/codingchallenges,matslindh/codingchallenges
knowit2017/15.py
knowit2017/15.py
def cut_trees(trees): cut = [] while trees: cut.append(len(trees)) lowest = min(trees) trees = [tree - lowest for tree in trees if (tree - lowest) > 0] return cut def test_cut_trees(): assert [6, 4, 2, 1] == cut_trees([5, 4, 4, 2, 2, 8]) if __name__ == "__main__...
mit
Python
28a2ee23218ee767e2e0ed0e9cc7228813bbfc33
Fix docstring lies and minor code cleanup, no functional change
AlanZatarain/py-lepton,tectronics/py-lepton,jmichelsen/py-lepton,Alwnikrotikz/py-lepton,jmichelsen/py-lepton,tectronics/py-lepton,Alwnikrotikz/py-lepton,AlanZatarain/py-lepton
lepton/system.py
lepton/system.py
############################################################################# # # Copyright (c) 2008 by Casey Duncan and contributors # All Rights Reserved. # # This software is subject to the provisions of the MIT License # A copy of the license should accompany this distribution. # THE SOFTWARE IS PROVIDED "AS IS", W...
############################################################################# # # Copyright (c) 2008 by Casey Duncan and contributors # All Rights Reserved. # # This software is subject to the provisions of the MIT License # A copy of the license should accompany this distribution. # THE SOFTWARE IS PROVIDED "AS IS", W...
mit
Python
a330a2a2d2a0706815c274e5a19409e0306ef26d
add script to generate a readkey
buildtimetrend/python-lib
get_read_key.py
get_read_key.py
#!/usr/bin/env python # vim: set expandtab sw=4 ts=4: # Generate a read key for Keen.io trends # # Copyright (C) 2014 Dieter Adriaenssens <ruleant@users.sourceforge.net> # # This file is part of buildtime-trend # <https://github.com/ruleant/buildtime-trend/> # # This program is free software: you can redistribute it an...
agpl-3.0
Python
884f2d1620ae4eefe555ed9523a4e5504cd804ed
add test for MICE
eltonlaw/impyute
test/imputations/cs/test_mice.py
test/imputations/cs/test_mice.py
"""test_mice.py""" import unittest import numpy as np from impyute.datasets import test_data from impyute.imputations.cs import mice class TestEM(unittest.TestCase): """ Tests for Multivariate Imputation by Chained Equations""" def setUp(self): """ self.data_c: Complete dataset/No missing valu...
mit
Python
0e2cd05c8a7b876fedcb80e0ee26e9ae1c21f607
Create extras.py
nevrrmind/VRS-Display-1024x600
extras.py
extras.py
# -*- coding: utf-8 -*- warnlist =["7500","7600","7700","0020","0037"] sqkinfo = { "7500":"ENTFÜHRUNG", "7600":"FUNKAUSFALL", "7700":"NOTFALL", "7000":"VFR-zivil", "0037":"BPO mit Restlicht", "1000":"IFR", "0020":"Hubschrauber-Rettungsflüge", }
mit
Python
df258636e65cce98ac0213cdf6f7f830f9cd7656
Add sfp_instagram
smicallef/spiderfoot,smicallef/spiderfoot,smicallef/spiderfoot
modules/sfp_instagram.py
modules/sfp_instagram.py
#------------------------------------------------------------------------------- # Name: sfp_instagram # Purpose: Gather information from Instagram profiles. # # Author: <bcoles@gmail.com> # # Created: 2019-07-11 # Copyright: (c) bcoles 2019 # Licence: GPL #------------------------------------...
mit
Python
978f9c92f159b687c7238cfdd3ab30b8a15f5b9e
Add the multiprocessing example
jctanner/python-examples
multiprocessing_subprocess.py
multiprocessing_subprocess.py
#!/usr/bin/env python import os import sys import subprocess from multiprocessing import Process, Queue def run_command_live(args, cwd=None, shell=True, checkrc=False, workerid=None): """ Show realtime output for a subprocess """ p = subprocess.Popen(args, stdout=subprocess.PIPE, std...
apache-2.0
Python
429bb8998cebe672774dd4b5b8b1188941227568
add craftr/libs/opencl module
creator-build/craftr
src/libs/opencl/__init__.py
src/libs/opencl/__init__.py
namespace = 'craftr/libs/opencl' import os, sys import craftr, {path} from 'craftr' import cxx from 'craftr/lang/cxx' vendor = craftr.options.get('opencl.vendor', None) if not vendor: raise EnvironmentError('option not set: opencl.vendor') if vendor == 'intel': sdk_dir = craftr.options.get('opencl.intel_sdk', N...
mit
Python
d03938dfbab4301c0a302df6ae8418927049b8f5
add types.py
st-tech/zr-obp
obp/types.py
obp/types.py
# Copyright (c) ZOZO Technologies, Inc. All rights reserved. # Licensed under the Apache 2.0 License. """Types.""" from typing import Union, Dict import numpy as np from .policy import BaseContextFreePolicy, BaseContextualPolicy # dataset BanditFeedback = Dict[str, Union[str, np.ndarray]] # policy BanditPolicy = Un...
apache-2.0
Python
faeb52d76b4dd66a60d34598a79becee26dc121e
Add the page handler for static routing.
yiyangyi/cc98-tornado
handler/page.py
handler/page.py
class AboutHandler(BaseHandler): class FaqHandler(BaseHandler): class RobotsHandler(BaseHandler): class ApiHandler(BaseHandler):
mit
Python
f61a63888f42e2e3e89c3a9c6fb26d68f0870004
Create generate_struct.py
vnpy/vnpy,bigdig/vnpy,bigdig/vnpy,vnpy/vnpy,bigdig/vnpy,bigdig/vnpy
vnpy/api/sgit/generator/generate_struct.py
vnpy/api/sgit/generator/generate_struct.py
"""""" import importlib class StructGenerator: """Struct生成器""" def __init__(self, filename: str, prefix: str): """Constructor""" self.filename = filename self.prefix = prefix self.typedefs = {} self.load_constant() def load_constant(self): """""" ...
mit
Python
814e041dc91c76da03b30d0c5e48e9a146fe6850
add a custom decorator to implement two legged API authentication
IRI-Research/django-chunked-uploads,IRI-Research/django-chunked-uploads,IRI-Research/django-chunked-uploads
chunked_uploads/utils/decorators.py
chunked_uploads/utils/decorators.py
from django.http import HttpResponse from django.conf import settings import oauth2 from django.contrib.sites.models import Site try: from functools import wraps except ImportError: from django.utils.functional import wraps # Python 2.4 fallback. def oauth_required(view_func): """ Decorator for views to ensure...
bsd-3-clause
Python
82d24f4712c0c3c6bb5ffcbdcc61addd8fb66f75
test chewie interface
faucetsdn/faucet,anarkiwi/faucet,trentindav/faucet,anarkiwi/faucet,REANNZ/faucet,trentindav/faucet,shivarammysore/faucet,shivarammysore/faucet,trungdtbk/faucet,mwutzke/faucet,mwutzke/faucet,REANNZ/faucet,trungdtbk/faucet,gizmoguy/faucet,gizmoguy/faucet,faucetsdn/faucet
tests/unit/faucet/test_chewie.py
tests/unit/faucet/test_chewie.py
#!/usr/bin/env python """Unit tests run as PYTHONPATH=.. python3 ./test_chewie.py.""" import unittest from chewie.mac_address import MacAddress from tests.unit.faucet import test_valve DP1_CONFIG = """ dp_id: 1 dot1x: nfv_intf: abcdef""" CONFIG = """ acls: eapol_to_nfv: - r...
apache-2.0
Python
3f0f00a0767a6f169fed57e1c21cff7b85239464
Create hooke_jeeves.py
bradling/direct-search-opt
hooke_jeeves.py
hooke_jeeves.py
def hooke_jeeves(evalf, x0, s, a=1, r=0.5, kmax=1e5, smin=1e-6): import numpy as np import scipy as sp # Hooke and Jeeves k = 0 # function evaulation counter n = x0.size # first step xb = x0 fxb = evalf(xb); k += 1 x, fx = pattern_search(xb, fxb, s); k += (2*n) ...
mit
Python
acbaafaaeb7fa7e10bc39e0cc8dc4f7ad808b35b
tidy up
lsaffre/lino,khchine5/lino,lino-framework/lino,khchine5/lino,lsaffre/lino,lino-framework/lino,lsaffre/lino,lsaffre/lino,lino-framework/lino,khchine5/lino,khchine5/lino,lino-framework/lino,khchine5/lino,lino-framework/lino,lsaffre/lino
src/lino/tools/mail.py
src/lino/tools/mail.py
## Copyright Luc Saffre 2003-2004. ## This file is part of the Lino project. ## Lino 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 2 of the License, or ## (at your option) any later...
unknown
Python
bfc968f953ca643813214adbea1301f5fcfc0533
Create maze_wiki
peterhogan/python,peterhogan/python
maze_wiki.py
maze_wiki.py
# Code by Erik Sweet and Bill Basener import random import numpy as np from matplotlib import pyplot as plt import matplotlib.cm as cm num_rows = int(input("Rows: ")) # number of rows num_cols = int(input("Columns: ")) # number of columns M = np.zeros((num_rows,num_cols,5), dtype=np.uint8) # The array M is going to ...
mit
Python
c963adc2237a6cec7b0b14034d9b802b4ba57324
add CLI stub for realtime service
quantrocket-llc/quantrocket-client,quantrocket-llc/quantrocket-client
quantrocket/cli/subcommands/realtime.py
quantrocket/cli/subcommands/realtime.py
# Copyright 2017 QuantRocket - All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
apache-2.0
Python
312c55f41e818c8df155c97eabcde1d7ca262961
add a beamdyn case execution script
OpenFAST/OpenFAST,OpenFAST/OpenFAST,OpenFAST/OpenFAST
reg_tests/lib/executeBeamdynCase.py
reg_tests/lib/executeBeamdynCase.py
# # Copyright 2017 National Renewable Energy Laboratory # # 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 la...
apache-2.0
Python
102e8c17ca25a8fbd55212482be572ec32bfefd7
check in a second test client
r-barnes/waterviz,r-barnes/waterviz,r-barnes/waterviz,HydroLogic/waterviz,NelsonMinar/vector-river-map,NelsonMinar/vector-river-map,NelsonMinar/vector-river-map,r-barnes/waterviz,HydroLogic/waterviz,NelsonMinar/vector-river-map,HydroLogic/waterviz,HydroLogic/waterviz
slowTiles.py
slowTiles.py
#!/usr/bin/env python """Test times and sizes of some particularly large or difficult tiles.""" import requests, time, grequests urlbase = 'http://127.0.0.1:8000' for spot in ('7/25/49', '6/13/23', '5/6/11', '5/7/12', '4/3/6'): url = "{}/mergedRivers/{}.json".format(urlbase, spot); start = time.time() r ...
bsd-3-clause
Python
c5c7f416e5722fade968c9c65032d7f88759a08d
add model of a subject
mapix/WebHello
model/subject.py
model/subject.py
# coding: utf-8 from datetime import datetime class Subject(object): def __init__(self, id, text, create_time=None, update_time=None): self.subject_id = str(id) self.subject_text = text self.create_time = create_time self.update_time = update_time @classmethod def new(cl...
bsd-3-clause
Python
92f49298f22f412a11ad7e51c630107b0e191ff5
Add CAN_DETECT info
madhukar01/coala-bears,Vamshi99/coala-bears,Asnelchristian/coala-bears,dosarudaniel/coala-bears,naveentata/coala-bears,srisankethu/coala-bears,gs0510/coala-bears,shreyans800755/coala-bears,coala-analyzer/coala-bears,SanketDG/coala-bears,chriscoyfish/coala-bears,srisankethu/coala-bears,mr-karan/coala-bears,shreyans80075...
bears/configfiles/DockerfileLintBear.py
bears/configfiles/DockerfileLintBear.py
import json from coalib.bearlib.abstractions.Linter import linter from coalib.bears.requirements.NpmRequirement import NpmRequirement from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY from coalib.results.Result import Result @linter(executable='dockerfile_lint') class DockerfileLintBear: """ Check f...
import json from coalib.bearlib.abstractions.Linter import linter from coalib.bears.requirements.NpmRequirement import NpmRequirement from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY from coalib.results.Result import Result @linter(executable='dockerfile_lint') class DockerfileLintBear: """ Check f...
agpl-3.0
Python