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
3bb9be0dd508a33d9063c8919d471ec39255aefb
Load and plot python script
jameskeaveney/ArduinoDUE-Data-Logger,jameskeaveney/ArduinoDUE-Data-Logger
load_and_plot.py
load_and_plot.py
import SixChannelReader as SCR import matplotlib.pyplot as plt import numpy as np def main(): """ open previously saved data and plot it. Convert raw 12-bit ADC data to voltage """ filename = "TestData-2015-05-15-1306.pkl" SR = SCR.SerialDataLogger() t, C1, C2, C3, C4, C5, C6 = SR.load_data(filename) fig = p...
mit
Python
e62dfd4d7ddd414299c54314e2f52e0f9f658b75
Fix up some tests
grzes/djangae,wangjun/djangae,martinogden/djangae,potatolondon/djangae,b-cannon/my_djae,jscissr/djangae,asendecka/djangae,SiPiggles/djangae,kirberich/djangae,leekchan/djangae,trik/djangae,asendecka/djangae,pablorecio/djangae,jscissr/djangae,stucox/djangae,nealedj/djangae,leekchan/djangae,stucox/djangae,wangjun/djangae,...
djangae/tests.py
djangae/tests.py
from django.test import TestCase from django.contrib.auth.models import User class EdgeCaseTests(TestCase): def setUp(self): User.objects.create(username="A", email="test@example.com") User.objects.create(username="B", email="test@example.com") User.objects.create(username="C", email="test2@example.com") Use...
from django.test import TestCase from django.contrib.auth.models import User class EdgeCaseTests(TestCase): def setUp(self): User.objects.create(username="A", email="test@example.com") User.objects.create(username="B", email="test@example.com") User.objects.create(username="C", email="test2@example.com") Use...
bsd-3-clause
Python
208aa2a2de8013bff9d885ba6c677f8b4faad987
Add tests for get_pack_common_libs_path
nzlosh/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,nzlosh/st2,Plexxi/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,Plexxi/st2,StackStorm/st2,Plexxi/st2
st2common/tests/unit/test_util_pack.py
st2common/tests/unit/test_util_pack.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
apache-2.0
Python
4917765d42f65a817d0fe8c36cc47009d85f7547
add API urls
chhantyal/referly,chhantyal/referly,chhantyal/referly
referly/apiv1/urls.py
referly/apiv1/urls.py
from django.conf.urls import patterns, include, url from .views import (UserRetriveAPIView, ReferralListCreateAPIView, ReferralRetriveUpdateDestroyAPIView) from rest_framework.authtoken.views import obtain_auth_token urlpatterns = patterns('', # authentication url(r'^toke...
bsd-3-clause
Python
aa87a57b9a8501ed7e7e413aec6c26408e651e29
Update create_gluster_cluster_sample_job.py
Tendrl/node-agent,Tendrl/node_agent,r0h4n/node-agent,Tendrl/node-agent,r0h4n/node-agent,r0h4n/node-agent,Tendrl/node_agent,Tendrl/node-agent
etc/create_gluster_cluster_sample_job.py
etc/create_gluster_cluster_sample_job.py
payload = { "integration_id": "89604c6b-2eff-4221-96b4-e41319240240", "run": "tendrl.flows.CreateCluster", "type": "node", "created_from": "API", "created_at": "2017-03-09T14:15:14Z", "username": "admin", "parameters": { "Node[]": ["81720b6c-6732-49dd-ad32-15845f199c79", ...
payload = { "integration_id": "89604c6b-2eff-4221-96b4-e41319240240", "run": "tendrl.flows.CreateCluster", "type": "node", "created_from": "API", "created_at": "2017-03-09T14:15:14Z", "username": "admin", "parameters": { "Node[]": ["81720b6c-6732-49dd-ad32-15845f199c79", ...
lgpl-2.1
Python
79e6111b83042caf1c867cf9c6fb611be374b9cd
make it work
ddsc/ddsc-worker
ddsc_worker/management/commands/redo_leftover.py
ddsc_worker/management/commands/redo_leftover.py
from os import listdir from os.path import isfile from django.core.management.base import BaseCommand from ddsc_worker.celery import celery class Command(BaseCommand): help = 'Scan a file directory to reschedule the tasks' def handle(self, *args, **options): filePath_file = args[0] ...
mit
Python
4f8b34521c94a4270f2f37d2e03c06e76a999e06
Add test_copyspecial.py
beepscore/google-python-exercises,beepscore/google-python-exercises
copyspecial/test_copyspecial.py
copyspecial/test_copyspecial.py
#!/usr/bin/env python3 import unittest import copyspecial class TestCopySpecial(unittest.TestCase): def setUp(self): pass def test_get_special_paths(self): test_dir = '/Users/stevebaker/Documents/projects/pythonProjects/google-python-exercises/copyspecial' result = copyspecial.get_sp...
apache-2.0
Python
d8d40f1d4d1bab1f2c3d02cc06393eab5a5d189d
Add simple browser-test - check relevant fields exist
Shrulik/Open-Knesset,noamelf/Open-Knesset,jspan/Open-Knesset,DanaOshri/Open-Knesset,otadmor/Open-Knesset,MeirKriheli/Open-Knesset,alonisser/Open-Knesset,daonb/Open-Knesset,DanaOshri/Open-Knesset,daonb/Open-Knesset,habeanf/Open-Knesset,jspan/Open-Knesset,DanaOshri/Open-Knesset,MeirKriheli/Open-Knesset,jspan/Open-Knesset...
laws/browser_cases.py
laws/browser_cases.py
# encoding: utf-8 from datetime import time, datetime from django.contrib.auth.models import User from selenium.webdriver.common.keys import Keys from knesset.browser_test_case import BrowserTestCase, on_platforms from models import Vote, Bill # All browser test cases must inherit from BrowserTestCase which initial...
bsd-3-clause
Python
7800e7f02b4a36b39817a74625ed1ef8a8621574
Create gui.py
Groupe24/CodeInSpace
src/gui.py
src/gui.py
mit
Python
f246d33b9c12a23824cbdd74a08a14d8ef710efe
Add WikiDownloads.py
Pythonsgo/DP-Tutorial
WikiDownloads.py
WikiDownloads.py
# Author: Selma Gomez Orr <selmagomezorr@gmail.com> Copyright (C) July 5, 2015 ########################################################################## ## Imports ########################################################################## import os import csv from BeautifulSoup import BeautifulSoup import urllib2 ...
mit
Python
82db6bbaefc7fde788803db25ff6ce72441f5151
Create clean_dict.py
nevmenandr/thai-language
dictionary/clean_dict.py
dictionary/clean_dict.py
# Delete one of the duplicate meanings of a word from the dictionary import codecs from collections import Counter import json import re f = codecs.open('slovar.json', 'r', 'utf-8') text = f.read() f.close() slovar = json.loads(text) def clean(slovar): for s in slovar: meanings = {} for l in slov...
cc0-1.0
Python
3eaed933c409c56ce75cbd3feaff3ff5b714aa4f
Implement VoteManager
muffins-on-dope/bakery,muffins-on-dope/bakery,muffins-on-dope/bakery
bakery/socialize/managers.py
bakery/socialize/managers.py
# -*- coding: utf-8 -*- from django.db.models import Manager from django.db.models.query import QuerySet class VoteQuerySet(QuerySet): def get_for_cookie(self, cookie): return self.filter(cookie=cookie) def get_for_user(self, user): return self.filter(user=user) def has_voted(self, use...
bsd-3-clause
Python
b5bf9bf643e237194cc87e53d6149ff0ffae7bd8
test for UNet added
analysiscenter/dataset
batchflow/tests/unet_test.py
batchflow/tests/unet_test.py
""" Test for EncoderDecoder model architecture. First of all, we define possible types of encoders, embeddings and decoders. Later every combination of encoder, embedding, decoder is combined into one model and we initialize it. """ # pylint: disable=import-error, no-name-in-module # pylint: disable=redefined-outer-nam...
apache-2.0
Python
8ee65cbf390d5caae04498397f74cd8a64e7903e
Add a necessary migration for email_auth
divio/django-shop,rfleschenberg/django-shop,jrief/django-shop,khchine5/django-shop,awesto/django-shop,rfleschenberg/django-shop,jrief/django-shop,awesto/django-shop,jrief/django-shop,divio/django-shop,divio/django-shop,nimbis/django-shop,khchine5/django-shop,rfleschenberg/django-shop,khchine5/django-shop,jrief/django-s...
email_auth/migrations/0003_auto_20151209_0746.py
email_auth/migrations/0003_auto_20151209_0746.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import email_auth.models class Migration(migrations.Migration): dependencies = [ ('email_auth', '0002_auto_20151011_1652'), ] operations = [ migrations.AlterModelManagers( ...
bsd-3-clause
Python
2da04cccf32e5280e36966b2d9c93a643e7458e7
Add migration to add some ember waffle flags to the db for waffle pages with a default value of False. Can be changed in django app when ready.
adlius/osf.io,mfraezz/osf.io,mattclark/osf.io,chennan47/osf.io,CenterForOpenScience/osf.io,felliott/osf.io,caseyrollins/osf.io,sloria/osf.io,HalcyonChimera/osf.io,mattclark/osf.io,adlius/osf.io,brianjgeiger/osf.io,binoculars/osf.io,cslzchen/osf.io,saradbowman/osf.io,Johnetordoff/osf.io,felliott/osf.io,chennan47/osf.io,...
osf/migrations/0083_add_ember_waffle_flags.py
osf/migrations/0083_add_ember_waffle_flags.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-03-02 17:45 from __future__ import unicode_literals from waffle.models import Flag from django.db import migrations, IntegrityError, transaction EMBER_WAFFLE_PAGES = [ 'completed_registration_form_detail', 'dashboard', 'draft_registration_form', ...
apache-2.0
Python
90b28b7cf084f9a75b0f1a9eda677dfd05c6ec32
add a command line interface to mc3020
keithbrown/mc,lwriemen/mc,rmulvey/mc,xtuml/mc,leviathan747/mc,leviathan747/mc,rmulvey/mc,xtuml/mc,cortlandstarrett/mc,keithbrown/mc,cortlandstarrett/mc,rmulvey/mc,leviathan747/mc,leviathan747/mc,rmulvey/mc,lwriemen/mc,rmulvey/mc,rmulvey/mc,lwriemen/mc,cortlandstarrett/mc,lwriemen/mc,keithbrown/mc,xtuml/mc,cortlandstarr...
bin/mc3020.py
bin/mc3020.py
#!/usr/bin/env python # encoding: utf-8 # Copyright (C) 2017 John Törnblom ''' MC3020 is a model compiler for xtUML that emits ANCI C and SystemC code. User guide is available at http://roxsoftware.com/ug ''' import optparse import logging import sys import os # use pyxtuml and pyrsl bundled in gen_erate.pyz sys.path...
apache-2.0
Python
e181ff03f51b5c6fd4004fab6b6a025c953f9a0a
Create bullet.py
APikielny/ggame-tutorials,APikielny/Final-Project-Tanks
bullet.py
bullet.py
from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame class Bullet(Sprite): asset = ImageAsset("images/300px-BM_Grenade.png", Frame(100,20,100,115), 1, 'vertical') def __init__(self, position): super().__init__(Bullet.asset, position) self.vx=1 self.vy=-.5 ...
mit
Python
fa386ebf8719f25914e6d6c8e8444fe5c0f01c04
update a set of configurations
michaelgichia/Twezana,michaelgichia/Twezana
config.py
config.py
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config: SECRET_KEY = os.environ.get('SECRET_KEY') or 'lkkjuy6786764565wsrguijopo090788676tgjhyijkhjohk' SQLALCHEMY_COMMIT_ON_TEARDOWN = True SQLALCHEMY_TRACK_MODIFICATIONS = True FLASKY_ADMIN = os.environ.get('TWEZANA_ADMIN') @staticmethod def...
mit
Python
97b48bd97cc1c3b6537bea33a32d376e2ca5092a
add launcher.
ya790206/takeBreak,ya790206/takeBreak
main.py
main.py
#! /usr/bin/python import os import os.path from lib import get_base_path os.system("python " + get_base_path() + "/takeBreak.py & disown")
mit
Python
737e5640d8096cd4e6352c8389be1f03a4195274
add example with params
mweb/python,N-Parsons/exercism-python,mweb/python,jmluy/xpython,smalley/python,jmluy/xpython,exercism/xpython,pheanex/xpython,behrtam/xpython,N-Parsons/exercism-python,exercism/python,behrtam/xpython,smalley/python,pheanex/xpython,exercism/python,exercism/xpython
exercises/all-your-base/all_your_base.py
exercises/all-your-base/all_your_base.py
def rebase(from_base, digits, to_base): pass
mit
Python
3c7fab5a8883720698e4646acbd40b07d1acbd59
Add pyramid_keystone specific AuthPolicy
bertjwregeer/pyramid_keystone
pyramid_keystone/authentication.py
pyramid_keystone/authentication.py
import logging log = logging.getLogger(__name__) import string import hashlib from os import urandom from zope.interface import implementer from pyramid.interfaces import ( IAuthenticationPolicy, IDebugLogger, ) from pyramid.security import ( Authenticated, Everyone, ) def _clean_principal...
isc
Python
b5d5f377cf3d3b2b4459c36ba47e2e0f4a3125f4
Add module for putting color in our text output
EliRibble/mothermayi
mothermayi/colors.py
mothermayi/colors.py
BLUE = '\033[94m' GREEN = '\033[92m' YELLOW = '\033[93m' RED = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def green(text): return GREEN + text + ENDC def red(text): return RED + text + ENDC
mit
Python
ef7eb21590bcea5556d6d248d439dfa62e14738c
add undo_run.py script
SuLab/scheduled-bots,SuLab/scheduled-bots,SuLab/scheduled-bots
scheduled_bots/scripts/undo_run.py
scheduled_bots/scripts/undo_run.py
# undo bad things from a log file, or a list of revids import pandas as pd from tqdm import tqdm import requests from wikidataintegrator.wdi_login import WDLogin from wikidataintegrator.wdi_core import WDItemEngine from scheduled_bots.local import GREGUSER, GREGPASS login = WDLogin(GREGUSER, GREGPASS) log_path = "/ho...
mit
Python
b9c385c40273be261c99fcda32c14a824995f1a6
update to latest master
credp/lisa,ARM-software/lisa,ARM-software/lisa,ARM-software/lisa,credp/lisa,credp/lisa,credp/lisa,ARM-software/lisa
external/trappy/trappy/function_graph.py
external/trappy/trappy/function_graph.py
# Copyright 2019 ARM 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 writin...
apache-2.0
Python
a5d99e43b1936bf8b16f75c74f8481ca59d56fda
make a random (binary) file generator
zenja/benchmarking-cloud-storage-systems
file_generators/random_file_generator.py
file_generators/random_file_generator.py
import os from file_generator import FileGenerator class RandomFileGenerator(FileGenerator): def __init__(self, directory, prefix='', suffix='', filename_length=10): super(RandomFileGenerator, self).__init__(directory=directory, prefix=prefix, ...
apache-2.0
Python
0e6080332f32831c77cb04cf2d1b0b094afe4adb
add install_lib command to distutils compat layer.
cournape/Bento,cournape/Bento,abadger/Bento,abadger/Bento,cournape/Bento,abadger/Bento,cournape/Bento,abadger/Bento
bento/distutils/commands/install_lib.py
bento/distutils/commands/install_lib.py
import os import sys from bento.distutils.utils \ import \ _is_setuptools_activated if _is_setuptools_activated(): from setuptools.command.install_lib \ import \ install_lib as old_install_lib else: from distutils.command.install_lib \ import \ install_lib as...
bsd-3-clause
Python
90bcc0d9374aff23b64877f44256446d43c94cb1
add nagios script to monitor HRRR latency
akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem
nagios/check_hrrr.py
nagios/check_hrrr.py
''' Check to make sure we have HRRR model data flowing to the IEM archives ''' import os import sys import stat import datetime def check(): ''' Do the chec please ''' now = datetime.datetime.utcnow() diff = None for hr in range(4): now = now - datetime.timedelta(hours=1) fn = now.strf...
mit
Python
4d49e72f6e29a01249bd486e043ec6ac2e9dd9f7
Add an app_settings file.
damonkelley/django-name,unt-libraries/django-name,damonkelley/django-name,unt-libraries/django-name,damonkelley/django-name,unt-libraries/django-name
name/app_settings.py
name/app_settings.py
from django.conf import settings NAME_FEED_AUTHOR_NAME = getattr(settings, 'NAME_FEED_AUTHOR_NAME', None) NAME_FEED_AUTHOR_EMAIL = getattr(settings, 'NAME_FEED_AUTHOR_EMAIL', None) NAME_FEED_AUTHOR_LINK = getattr(settings, 'NAME_FEED_AUTHOR_LINK', None)
bsd-3-clause
Python
80160cdb34dc51ad5bf33f10dc4a191801b03c68
Work in progress.
nasfarley88/bslparlour-utils
bslparlour_utils/__init__.py
bslparlour_utils/__init__.py
from vimeo import VimeoClient import myconf vimeo_client = VimeoClient(myconf.ACCESS_TOKEN, myconf.CLIENT_ID, myconf.CLIENT_SECRET) def upload_list_to_vimeo(filename_list): """A simple function to upload all files in a list to Vimeo. """ for i in filename...
cc0-1.0
Python
15ac2938d94e3e6c689df5770525b66ed29d6f67
Use ujson instead of json
ratpack/FrameworkBenchmarks,sanjoydesk/FrameworkBenchmarks,zdanek/FrameworkBenchmarks,s-ludwig/FrameworkBenchmarks,kbrock/FrameworkBenchmarks,hamiltont/FrameworkBenchmarks,zloster/FrameworkBenchmarks,methane/FrameworkBenchmarks,zane-techempower/FrameworkBenchmarks,PermeAgility/FrameworkBenchmarks,kostya-sh/FrameworkBen...
bottle/app.py
bottle/app.py
from bottle import Bottle, route, request, run from bottle.ext import sqlalchemy from sqlalchemy import create_engine, Column, Integer from sqlalchemy.ext.declarative import declarative_base from random import randint import ujson app = Bottle() app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://benchmarkdbuser:benchma...
from bottle import Bottle, route, request, run from bottle.ext import sqlalchemy from sqlalchemy import create_engine, Column, Integer from sqlalchemy.ext.declarative import declarative_base from random import randint import json app = Bottle() app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://benchmarkdbuser:benchmar...
bsd-3-clause
Python
41b07d232b7b3344fe81efb0c4c20568e2b7500b
Add missing query.py to repo
pinax/pinax-models,angvp/django-logical-delete,angvp/django-logicaldelete,pombredanne/django-logicaldelete,Ubiwhere/pinax-models,naringas/pinax-models,angvp/django-logical-delete,angvp/django-logicaldelete
logicaldelete/query.py
logicaldelete/query.py
from django.db.models.query import QuerySet class LogicalDeleteQuerySet(QuerySet): def delete(self): assert self.query.can_filter(), \ "Cannot use 'limit' or 'offset' with delete." for obj in self.all(): obj.delete() self._result_cache = None delete.alt...
mit
Python
889969f94bd45e2b67e25ff46452378351ca5186
add brief example on how to use the lib to query SUMO ontologies
pySUMO/pysumo,pySUMO/pysumo
examples/simple.py
examples/simple.py
#!/usr/bin/env python3 import sys sys.path.append('../src') from tempfile import mkdtemp import pysumo from pysumo import parser from pysumo.indexabstractor import * from pysumo.syntaxcontroller import Ontology sumo = Ontology('../src/pysumo/data/Merge.kif', name='SUMO') with open(sumo.path) as f: mergeKif = par...
bsd-2-clause
Python
173b867929201b80983b2f3e31feb5d34e69885d
Add bismark.py
percyfal/snakemakelib,percyfal/snakemakelib
snakemakelib/bio/ngs/methylseq/bismark.py
snakemakelib/bio/ngs/methylseq/bismark.py
# Copyright (C) 2014 by Per Unneberg from snakemakelib.config import get_sml_config sml_config = get_sml_config() def ref(): """Get the reference sequence""" return sml_config['bio.ngs.settings']['db']['ref']
mit
Python
49af9c14d62cab8d0da4f34b7dcebdd8d7535f58
Add rudimentary weather module
tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status
bumblebee/modules/weather.py
bumblebee/modules/weather.py
# pylint: disable=C0111,R0903 """Displays the temperature on the current location based on the ip Requires the following python packages: * urllib """ import bumblebee.input import bumblebee.output import bumblebee.engine import json from urllib.request import urlopen class Module(bumblebee.engine.Module): ...
mit
Python
298c3a73911d0f71b2163bd11387cc35a62c349b
Remove debug statement
Azulinho/flocker,beni55/flocker,LaynePeng/flocker,beni55/flocker,Azulinho/flocker,mbrukman/flocker,agonzalezro/flocker,jml/flocker,jml/flocker,lukemarsden/flocker,beni55/flocker,moypray/flocker,LaynePeng/flocker,achanda/flocker,Azulinho/flocker,runcom/flocker,LaynePeng/flocker,adamtheturtle/flocker,jml/flocker,1d4Nf6/f...
flocker/volume/functional/test_script.py
flocker/volume/functional/test_script.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """Functional tests for the ``flocker-volume`` command line tool.""" from subprocess import check_output, Popen, PIPE import json from unittest import skipUnless from twisted.trial.unittest import TestCase from twisted.python.filepath import FilePath from ...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """Functional tests for the ``flocker-volume`` command line tool.""" from subprocess import check_output, Popen, PIPE import json from unittest import skipUnless from twisted.trial.unittest import TestCase from twisted.python.filepath import FilePath from ...
apache-2.0
Python
540e43cf4cc4657f6b494839371c311d2eccf6c1
Add python example
xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet
snippet/example/python/password.py
snippet/example/python/password.py
# -*- coding: utf-8 -*- import random # Default symbols to use for passwords. Avoids visually confusing characters. # ~6 bits per symbol DEFAULT_PASSWORD_SYMBOLS = ('23456789', # Removed: 0,1 'ABCDEFGHJKLMNPQRSTUVWXYZ', # Removed: I, O 'abcdefghijkmnopqrstuv...
mit
Python
60b37c16b263ea8bba03f843ace592b3f22ea123
Create go_fixup_inline_strings.py
williballenthin/idawilli
scripts/go_fixup_inline_strings.py
scripts/go_fixup_inline_strings.py
""" create and annotate references to strings in 64-bit Windows Go executables. expect to see the assembly pattern: lea reg, $string mov [stack], reg mov [stack], $size """ import idc import ida_ua import ida_name import ida_bytes import idautils def enum_segments(): for segstart in idautils.Segments(): ...
apache-2.0
Python
250cf786d36f5374dee4d73749c13a8b162aeafa
add simulator super class
KEHANG/AutoFragmentModeling
afm/simulator.py
afm/simulator.py
# one iteration of the Monte Carlo simulation # consists of the following steps # s1: decide the time step to choose, # need k, count of the related fragments import rmgpy.constants import afm.loader class Simulator(object): def __init__(self, chemkin_path, dictionary_path): self.load_fragment_chemistry(chemkin...
mit
Python
ec67dc532ac3b6f4d811e0611ba0f0d454ca9704
Add movie recorder
nknytk/home-recorder,nknytk/home-recorder
lib/recorder/movie.py
lib/recorder/movie.py
# coding: utf-8 import os import sys import shutil import shlex from subprocess import call from threading import Thread from .recorderthread import RecorderThread sys.path.append(os.path.join(os.path.dirname(__file__), '../util')) from webcam import avail_cameras class Movie(RecorderThread): base_command = 'a...
apache-2.0
Python
aff2f439506991de2d3b35a9883d62ae867c6d5d
Add script that translates kaf to folia
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
kaf2folia.py
kaf2folia.py
"""Insert KAF annotations into a FoLiA file. Usage: python kaf2folia.py <kaf tags file> <folia file> The folia file is the FoLiA XML file used to generate the KAF input files. """ import argparse import codecs class Annotation: def __init__(self, level, label, annotation_id, word_id): self.level = level ...
apache-2.0
Python
600c9444e9090c3709076ac7fe9133c5fb57cde5
Create solution.py
lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges
hackerrank/algorithms/implementation/easy/bon_appetit/py/solution.py
hackerrank/algorithms/implementation/easy/bon_appetit/py/solution.py
def computeAnnaBill(k, costs): return sum(cost / 2.0 if index != k else 0.0 for index, cost in enumerate(costs)) eps = 1e-12 n, k = map(int, input().split()) costs = [int(cost) for cost in input().split()] charged = int(input()) actual = computeAnnaBill(k, costs) diff = charged - actual if abs(diff...
mit
Python
a3d95711741a4647bc30874d4d59d77ca356a3c9
add simple example
jettify/aiomonitor,aio-libs/aiomonitor
examples/simple_aiohttp_srv.py
examples/simple_aiohttp_srv.py
import asyncio from aiohttp import web from aiomonitor import Monitor async def simple(request): loop = request.app.loop print('Start sleeping') await asyncio.sleep(100, loop=loop) return web.Response(text="Simple answer") async def init(loop): app = web.Application(loop=loop) app.router.ad...
apache-2.0
Python
9f0a17351ced32c74cf20ac046c5597c0676d0c8
Test DatafeedUsfirstMatches
josephbisch/the-blue-alliance,bvisness/the-blue-alliance,1fish2/the-blue-alliance,phil-lopreiato/the-blue-alliance,bdaroz/the-blue-alliance,synth3tk/the-blue-alliance,bdaroz/the-blue-alliance,1fish2/the-blue-alliance,nwalters512/the-blue-alliance,phil-lopreiato/the-blue-alliance,fangeugene/the-blue-alliance,1fish2/the-...
tests/test_datafeed_usfirst_matches.py
tests/test_datafeed_usfirst_matches.py
import unittest2 import datetime from google.appengine.ext import db from google.appengine.ext import testbed from datafeeds.datafeed_usfirst_matches import DatafeedUsfirstMatches from models import Event class TestDatafeedUsfirstMatches(unittest2.TestCase): def setUp(self): self.testbed = testbed.Testbe...
mit
Python
e2118aba88cf348ead60be11e45e7402b17638fd
Add tests for __unicode__ functions in model. (#1017)
taranjeet/EvalAI,taranjeet/EvalAI,taranjeet/EvalAI,taranjeet/EvalAI
tests/unit/participants/test_models.py
tests/unit/participants/test_models.py
from django.test import TestCase from django.contrib.auth.models import User from participants.models import Participant, ParticipantTeam class BaseTestCase(TestCase): def setUp(self): self.user = User.objects.create( username='user', email='user@test.com', password='...
bsd-3-clause
Python
0f64efaae2c71198cd06195da9fad566cefcbdd4
create a status controller for system health
ceph/ceph-installer,ceph/mariner-installer,ceph/ceph-installer,ceph/ceph-installer
ceph_installer/controllers/status.py
ceph_installer/controllers/status.py
from pecan import response, expose from ceph_installer.hooks import system_checks, SystemCheckError class StatusController(object): @expose('json') def index(self): for check in system_checks: try: check() except SystemCheckError as system_error: ...
mit
Python
b6295e797baacf1be81e6c4c70299513eb0e03ee
Test for Hard vs. Soft in GoByMajority
bootandy/Axelrod,risicle/Axelrod,emmagordon/Axelrod,mojones/Axelrod,kathryncrouch/Axelrod,uglyfruitcake/Axelrod,bootandy/Axelrod,risicle/Axelrod,kathryncrouch/Axelrod,mojones/Axelrod,uglyfruitcake/Axelrod,emmagordon/Axelrod
axelrod/tests/unit/test_gobymajority.py
axelrod/tests/unit/test_gobymajority.py
"""Test for the go by majority strategy.""" import axelrod from .test_player import TestPlayer C, D = 'C', 'D' class TestGoByMajority(TestPlayer): name = "Soft Go By Majority" player = axelrod.GoByMajority stochastic = False def test_initial_strategy(self): """Starts by cooperating """ ...
"""Test for the go by majority strategy.""" import axelrod from .test_player import TestPlayer C, D = 'C', 'D' class TestGoByMajority(TestPlayer): name = "Soft Go By Majority" player = axelrod.GoByMajority stochastic = False def test_initial_strategy(self): """Starts by cooperating """ ...
mit
Python
ad6acde421cde89b3cf18ca73bea8902d2bfc03b
Create a j2cl_gen_tests macro. Similar to third_party/bazel_common/testing/test_defs.bzl -> gen_java_tests
google/j2cl,google/j2cl,google/j2cl,google/j2cl,google/j2cl
build_def/gen_j2cl_tests.bzl
build_def/gen_j2cl_tests.bzl
"""Macro for generating j2cl_test targets for multiple test files. Similar to third_party/bazel_common/testing/test_defs.bzl -> gen_java_tests This macro generates a j2cl_test rule for each test in test_files using the specified deps. Example usage: load("//third_party/java/j2cl:gen_j2cl_tests.bzl", "gen_j2cl_tests...
apache-2.0
Python
ef1b7cd2157148eb7d9f67dc42d8094e31a64a6a
Add celerymon management command to celery (shows installation instructions if celerymon is not installed)
ask/celery,WoLpH/celery,mitsuhiko/celery,frac/celery,frac/celery,WoLpH/celery,ask/celery,cbrepo/celery,mitsuhiko/celery,cbrepo/celery
celery/management/commands/celerymon.py
celery/management/commands/celerymon.py
""" Start the celery clock service from the Django management command. """ import sys from django.core.management.base import BaseCommand #try: from celerymonitor.bin.celerymond import run_monitor, OPTION_LIST #except ImportError: # OPTION_LIST = () # run_monitor = None MISSING = """ You don't have celerymon ...
bsd-3-clause
Python
e48fe09d47f5d8d6360053f67e2b2d30d0a3dc40
Add controller tests
conwetlab/ckanext-oauth2,conwetlab/ckanext-oauth2,conwetlab/ckanext-oauth2,conwetlab/ckanext-oauth2
ckanext/oauth2/tests/test_controller.py
ckanext/oauth2/tests/test_controller.py
import unittest import ckanext.oauth2.controller as controller import json from base64 import b64decode, b64encode from mock import MagicMock from nose_parameterized import parameterized RETURNED_STATUS = 301 DEFAULT_MESSAGE = 'It was impossible to log in you using the OAuth2 Service' EXAMPLE_FLASH = 'This is a test'...
agpl-3.0
Python
ea7218ee11ca0db2d691f3689ad99da06ebc1fcf
Add main function with basic prompt
ElliotPenson/nameless
nameless/main.py
nameless/main.py
#!/usr/bin/python # -*- coding: UTF-8 -*- """ main.py @author ejnp """ def main(): """Begins an interactive lambda calculus interpreter""" print "nameless!\nType 'quit' to exit." while True: read = raw_input('> ').decode('utf-8') if read == 'quit': break if read != '':...
mit
Python
89f03da4319fa55894973a340ac1a679aded35c7
add test for decorators in a Pool
mathieudesro/pathos,mathieudesro/pathos
tests/test_decorate.py
tests/test_decorate.py
#!/usr/bin/env python # # Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 1997-2015 California Institute of Technology. # License: 3-clause BSD. The full license text is available at: # - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/pathos/LICENSE """ demonstrates pickle/sourc...
bsd-3-clause
Python
4f4512698f74e6a21a651ca469b4ad78e79c8ffa
Add missing migration
groveco/django-sql-explorer,epantry/django-sql-explorer,groveco/django-sql-explorer,enstrategic/django-sql-explorer,dsanders11/django-sql-explorer,dsanders11/django-sql-explorer,dsanders11/django-sql-explorer,epantry/django-sql-explorer,enstrategic/django-sql-explorer,enstrategic/django-sql-explorer,enstrategic/django-...
explorer/migrations/0005_auto_20160105_2052.py
explorer/migrations/0005_auto_20160105_2052.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-01-05 20:52 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('explorer', '0004_querylog_duration'), ] operations = [ migrations.AlterField( ...
mit
Python
e510d8400298b9bfd048560f1925cf77840a3ee1
add a check for coldevents specific indices checks
yieldbot/sensu-yieldbot-plugins,yieldbot/sensu-yieldbot-plugins,yieldbot/sensu-yieldbot-plugins
plugins/elasticsearch/check-es-indexstatus.py
plugins/elasticsearch/check-es-indexstatus.py
#!/usr/bin/env python """Sensu check script: to see if any index is in non-green state. This is a special check script to be executed only on the coldevents cluster. We want to exclude indices for day-2 , since they are in the process of being restored nightly in coldevents cluster. During this process the cluster sta...
mit
Python
9bf11f13ab5672038fba9e7b674030fc211880e1
Create __init__.py
thegreathippo/geo2
geo2/__init__.py
geo2/__init__.py
mit
Python
09c560daf6f1bd9261a17a8155e2a4f366f37820
add setup
nguy/artview,jjhelmus/artview,gamaanderson/artview
artview/setup.py
artview/setup.py
def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('artview', parent_package, top_path) config.add_subpackage('core') config.add_subpackage('components') config.add_subpackage('plugins') config.add_subpackage('scripts'...
bsd-3-clause
Python
ee5b38c649b1a5b46ce5b53c179bde57b3a6e6f2
Add a custom server example implementation. This is fully compatible with the client example.
alekratz/pythinclient
examples/customserverexample.py
examples/customserverexample.py
#!/usr/bin/env python3 from pythinclient.server import ThinServer class CustomThinServer(BasicThinServer): def __init__(self, port=65000, is_daemon=False): super(BasicThinServer, self).__init__(port, is_daemon=is_daemon) # add custom server hooks self.add_hook('help', self.__server_help) self.add_ho...
bsd-3-clause
Python
986bbc0de06bcee23e9c747e767c1118f3c8aece
Make the editor build callable from tools/build.py Review URL: https://codereview.chromium.org//11343027
dart-lang/sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/...
tools/create_editor.py
tools/create_editor.py
#!/usr/bin/env python # # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. # # A script which will be invoked from gyp to create a build of the editor. # # T...
bsd-3-clause
Python
56a253e9e9199c85f544a51d7c8f23d10b4b6d38
Implement ComparerManager and ComparerWorker This module spawns workers for massive optimality comparison between TSP solving methods.
lucasdavid/edge
edge/comparer.py
edge/comparer.py
import multiprocessing import threading import time from edge import base, generator, algorithms class ComparerManager: edge_weight_range = (10, 100) number_of_concurrent_graphs = multiprocessing.cpu_count() algorithms = { algorithms.NearestNeighbor, algorithms.EdgeScore, algorith...
mit
Python
be17ca1bd589115d821c1e26c489e2e75103333c
document sentiment matcher
kapil1garg/eecs338-chris-jones,kapil1garg/eecs338-chris-jones
es_seniment_selection.py
es_seniment_selection.py
""" This module is used to find key words and phrases in the articles index and map the text to sentiment values in the googles index """ import json import elastic class ElasticSentimentSelection(object): """ Conducts a search on an index and then finds a matching document in another index where sentimen...
mit
Python
fe6d7b11ab87d9ea3a2b99aee17b9a371c55f162
Add a very basic yt plotting example
SWAT-Sheffield/pysac,Cadair/pysac
examples/mhs_atmosphere_plot.py
examples/mhs_atmosphere_plot.py
# -*- coding: utf-8 -*- """ Created on Fri Jan 9 12:52:31 2015 @author: stuart """ import os import glob import yt model = 'spruit' datadir = os.path.expanduser('~/mhs_atmosphere/'+model+'/') files = glob.glob(datadir+'/*') files.sort() print(files) ds = yt.load(files[0]) slc = yt.SlicePlot(ds, fields='density...
bsd-2-clause
Python
8ce30a72aff5c0e7e3b3395159bc03b1797cc552
Add new command dev.dials.test_failure_reasons
dials/dials,dials/dials,dials/dials,dials/dials,dials/dials
command_line/test_failure_reasons.py
command_line/test_failure_reasons.py
# LIBTBX_SET_DISPATCHER_NAME dev.dials.test_failure_reasons from __future__ import absolute_import, division, print_function import re import xml.etree.ElementTree as ET try: tree = ET.parse("output.xml") except IOError: exit( "generate output.xml with:\n" "pytest --regression -n auto --runxf...
bsd-3-clause
Python
444f97b96b58c7c3ca5942c98b1832046ed5b08c
add thermistor fit file
madcowswe/ODrive,madcowswe/ODrive,madcowswe/ODriveFirmware,madcowswe/ODriveFirmware,madcowswe/ODriveFirmware,madcowswe/ODrive,madcowswe/ODrive,madcowswe/ODrive,madcowswe/ODriveFirmware
analysis/thermistors.py
analysis/thermistors.py
#%% import matplotlib.pyplot as plt import numpy as np Rload = 3300 R_25 = 10000 T_25 = 25 + 273.15 #Kelvin Beta = 3380 Tmin = 0 Tmax = 140 temps = np.linspace(Tmin, Tmax, 1000) tempsK = temps + 273.15 # https://en.wikipedia.org/wiki/Thermistor#B_or_%CE%B2_parameter_equation r_inf = R_25 * np.exp(-Beta/T_25) R_temps...
mit
Python
c9c40df61f89d71edfbe8ce23499000d34cacb40
Add Ada example
jrajath94/RockStar,varunparkhe/rockstar,gokaygurcan/rockstar,haosdent/rockstar,yask123/rockstar,ActuallyACat/rockstar,avinassh/rockstar,monsterwater/rockstar,jehb/rockstar,Endika/rockstar
examples/ada_rockstar.py
examples/ada_rockstar.py
from rockstar import RockStar ada_code = """with Ada.Text_IO; procedure Hello_World is use Ada.Text_IO; begin Put_Line("Hello, world!"); end;""" rock_it_bro = RockStar(days=400, file_name='helloworld.ada', code=ada_code) rock_it_bro.make_me_a_rockstar()
mit
Python
d6d321fa99b9def1d85ff849fc13bbe17fa58510
Add test for text dictionaries.
tyarkoni/featureX,tyarkoni/pliers
featurex/tests/test_datasets.py
featurex/tests/test_datasets.py
from featurex.datasets.text import _load_datasets, fetch_dictionary from unittest import TestCase from pandas import DataFrame import urllib2 class TestDatasets(TestCase): def test_dicts(self): """ Check that all text dictionaries download successfully. """ datasets = _load_da...
bsd-3-clause
Python
45f87e80dff6d1d3d04ceeb2e3d4e430c6995a2b
Add experimental hyperlinks plugin to collect links to a specific domain
commonsearch/cosr-back,commonsearch/cosr-back,commonsearch/cosr-back,commonsearch/cosr-back,commonsearch/cosr-back
plugins/hyperlinks.py
plugins/hyperlinks.py
from pyspark.sql import types as SparkTypes from cosrlib.plugins import Plugin from cosrlib.spark import sql class MostExternallyLinkedPages(Plugin): """ Saves a list of most externally linked pages on a domain """ hooks = frozenset(["document_post_index", "spark_pipeline_action", "spark_pipeline_init"]) ...
apache-2.0
Python
18c40bdc02c5cd27c69edb394e040a3db3d75e05
Add filtering for bogus output
ScienceStacks/BaseStack,ScienceStacks/BaseStack,ScienceStacks/BaseStack
bin/filter_pycapsule.py
bin/filter_pycapsule.py
#!/usr/bin/python3 """Filters Pycapsule error""" import fileinput import sys STRING = "RuntimeError: Object of type <class 'NamedArray'>" NUM_AFTER = 5 # How many lines after to delete NUM_BEFORE = 4 # How far before to delete output_lines = [] delete_count = 0 for line in fileinput.input(): if delete_count > ...
apache-2.0
Python
b7652280bcb2db3640b904d5e91fb86a437f8391
Add dict_renderer
njvack/markdown-to-json
bids_writer/dict_renderer.py
bids_writer/dict_renderer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from collections import OrderedDict import string import re def I(s): # Return s unchanged return s def camelize(s): # Change "Foo bar baz's" to "FooBarBazs" return re.sub(r'\W', '', string.capwords(s)) def underscore(s): # Change "Foo bar baz's"...
mit
Python
99742ea7a741d1f32694fceed771c22f59b24e1f
add connection class
mockingbird2/EPIC-ness,mockingbird2/EPIC-ness,mockingbird2/EPIC-ness
flask_app/database_connection.py
flask_app/database_connection.py
from credentials_hana import db_HOST, db_PORT, db_USER, db_PASSWORD, flask_user, flask_password import pyhdb class DatabaseConnection: def __init__(self, queryName): self.queryName = queryName @property def connector(self): connector = pyhdb.connect( host = db_HOST, port = db_PORT, user = db_USER, ...
mit
Python
d0aa398a0df17540c7d9160dadd48d3ab60e230e
Test home page as anonymous and logged user
hbuyse/VBTournaments,hbuyse/VBTournaments,hbuyse/VBTournaments
core/tests/tests_client_home_page.py
core/tests/tests_client_home_page.py
#! /usr/bin/env python __author__ = "Henri Buyse" import pytest from django.test import Client def test_client_get_home_page(): c = Client() response = c.get('/') assert response.status_code == 200 @pytest.mark.django_db def test_logged_client_get_home_page(): c = Client() c.login(username='te...
mit
Python
3cf623aa41f429b5e5e83829a7c74634908d97d1
Add UserVoice
foauth/foauth.org,foauth/foauth.org,foauth/foauth.org
services/uservoice.py
services/uservoice.py
import foauth.providers class UserVoice(foauth.providers.OAuth1): # General info about the provider name = 'UserVoice' provider_url = 'http://uservoice.com/' favicon_url = 'http://uservoice.com/favicon.ico' docs_url = 'http://developer.uservoice.com/docs/api/reference/' # URLs to interact wit...
bsd-3-clause
Python
e9859583e53ac25f6fb0ecfba95e3d0c8de726d3
add neighbors/tools to commit
waterponey/scikit-learn,chrisburr/scikit-learn,dsquareindia/scikit-learn,voxlol/scikit-learn,0asa/scikit-learn,etkirsch/scikit-learn,chrisburr/scikit-learn,siutanwong/scikit-learn,krez13/scikit-learn,vortex-ape/scikit-learn,MatthieuBizien/scikit-learn,jm-begon/scikit-learn,sumspr/scikit-learn,wanggang3333/scikit-learn,...
sklearn/neighbors/tools.py
sklearn/neighbors/tools.py
import numpy as np def weighted_mode(a, w, axis): """Returns an array of the weighted modal (most common) value in the passed array. If there is more than one such value, only the first is returned. The bin-count for the modal bins is also returned. This is an extension of the algorithm in scipy....
bsd-3-clause
Python
c76b21e0105c1fb2e6a0f90943e6f92498aedab0
Create q_interp.py
aaroncnb/comic_dust,aaroncnb/comic_dust,aaroncnb/comic_dust,aaroncnb/comic_dust
q_interp.py
q_interp.py
import pyfits import numpy as np ## After applying 'q_badpix' to a map with a very generous threshold (only extremely $ ## we multiply the mask (the output from q_badpix) by the original image. ## This gives us an image where all of the 'really bad' pixels are set to 0. ## Then, we do a "first-pass# of interpolation:...
apache-2.0
Python
8c9423359823b61d8f14867e4b68b0862a2f93f7
add imghash python implementation
FlorianLudwig/imghash,FlorianLudwig/imghash,FlorianLudwig/imghash
imghash/__init__.py
imghash/__init__.py
import hashlib import struct from PIL import Image def remove_transparent_pixels(img): pixels = img.getdata() new_data = [] for item in pixels: if item[3] == 0: new_data.append((0, 0, 0, 0)) else: new_data.append(item) img.putdata(new_data) def get_hash(path...
apache-2.0
Python
b49371bbcb756371296bfe309071f2b9579e5b99
Add test suite for demoing pytest markers
mdmintz/seleniumspot,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/seleniumspot,seleniumbase/SeleniumBase,mdmintz/SeleniumBase
examples/test_markers.py
examples/test_markers.py
""" These tests demonstrate pytest marker use for finding and running tests. Usage examples from this file: pytest -v -m marker_test_suite # Runs A, B, C, D pytest -v -m marker1 # Runs A pytest -v -m marker2 # Runs B, C ...
mit
Python
4e67706bcd3f39388f7f05bec9ece3232fb06585
Create run.py
qobilidop/srcnn,qobilidop/srcnn
experiments/espcn/run.py
experiments/espcn/run.py
from functools import partial from toolbox.data import load_set from toolbox.models import compile_espcn from toolbox.experiment import Experiment from toolbox.preprocessing import bicubic_resize # Model scale = 3 model = compile_espcn(c=1, f1=9, f2=1, f3=5, n1=64, n2=32) model.summary() # Data train_set = '91-imag...
mit
Python
ec8d1968acda71bc87d09c6c64366fbf1cc75fda
Create tests models sensitivity
makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin
geotrek/sensitivity/tests/test_models.py
geotrek/sensitivity/tests/test_models.py
# -*- coding: utf-8 -*- from django.test import TestCase from django.conf import settings from geotrek.sensitivity.factories import SensitiveAreaFactory, SpeciesFactory class SensitiveAreaModelTest(TestCase): def test_specific_radius(self): specie = SpeciesFactory.create(radius=50) sensitive_are...
bsd-2-clause
Python
a2ee1f86b0791c1b3eea1a645a1ff7960a44a66c
Add ss test
mph-/lcapy
lcapy/tests/test_ss.py
lcapy/tests/test_ss.py
from lcapy import Circuit, expr import unittest import sympy as sym class LcapyTester(unittest.TestCase): """Unit tests for lcapy state space analysis """ def assertEqual2(self, ans1, ans2, comment): ans1 = ans1.canonical() ans2 = ans2.canonical() print(ans1, ans2) try...
lgpl-2.1
Python
272f90da644cc1e13e8491d49c7aecb2dfe7dd4a
add notes for exceptions
mcxiaoke/python-labs,mcxiaoke/python-labs,mcxiaoke/python-labs,mcxiaoke/python-labs,mcxiaoke/python-labs
modules/exceptions.py
modules/exceptions.py
# -*- coding: UTF-8 -*- # Created by mcxiaoke on 15/7/5 10:19. __author__ = 'mcxiaoke' ''' BaseException +-- SystemExit +-- KeyboardInterrupt +-- GeneratorExit +-- Exception +-- StopIteration +-- StandardError | +-- BufferError | +-- ArithmeticError | | +-- FloatingPointEr...
apache-2.0
Python
c0561f5d006a7dbcc3893192e91a78c05e6eb960
Add a pkgdb submodule to handle interactions with pkgdb
jeremycline/fmn,jeremycline/fmn,jeremycline/fmn
fmn/lib/pkgdb.py
fmn/lib/pkgdb.py
""" fedmsg-notifications pkgdb client """ import json import logging import requests log = logging.getLogger(__name__) PKGDB_API_URL = 'http://209.132.184.188/api/' def get_package_of_user(username, acl='commit', branch=None): """ Retrieve the list of packages where the specified user has the specified acl o...
lgpl-2.1
Python
e06a766e082f168e0b89776355b622b980a0a735
Add The Learning Experience spider
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
locations/spiders/learning_experience.py
locations/spiders/learning_experience.py
# -*- coding: utf-8 -*- import scrapy import re from locations.items import GeojsonPointItem class TheLearningExperienceSpider(scrapy.Spider): name = "learning_experience" allowed_domains = ["thelearningexperience.com"] start_urls = ( 'https://thelearningexperience.com/our-centers/directory', ...
mit
Python
ab1bcee9045ec1a4f2e68df925f94194ad5ef4e2
Change __init__.py file
ClearCorp-dev/odoo-clearcorp,ClearCorp-dev/odoo-clearcorp,ClearCorp-dev/odoo-clearcorp,sysadminmatmoz/odoo-clearcorp,ClearCorp-dev/odoo-clearcorp,ClearCorp/odoo-clearcorp,sysadminmatmoz/odoo-clearcorp,ClearCorp/odoo-clearcorp,ClearCorp/odoo-clearcorp,ClearCorp/odoo-clearcorp,sysadminmatmoz/odoo-clearcorp,sysadminmatmoz...
hr_personnel_actions/__init__.py
hr_personnel_actions/__init__.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Addons modules by CLEARCORP S.A. # Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). # # This program is free software: you can redistribute...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Addons modules by CLEARCORP S.A. # Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). # # This program is free software: you can redistribute...
agpl-3.0
Python
28e8f43746bf2dc2290b49546a031b889dc6360b
Create scripty.py
arccoder/arccoder.github.io,arccoder/arccoder.github.io
favicon/scripty.py
favicon/scripty.py
mit
Python
444161b2ed50610f011743d1e323a2b463b37656
Add resources.py
LuqueDaniel/pybooru,LuqueDaniel/pybooru,buzzbyte/pybooru,buzzbyte/pybooru
pybooru/resources.py
pybooru/resources.py
# -*- coding: utf-8 -*- #http_status_codes http_status_codes = { 200: ('OK', 'Request was successful'), 403: ('Forbidden', 'Access denied'), 404: ('Not Found', 'Not found'), 420: ('Invalid Record', 'Record could not be saved'), 421: ('User Throttled', 'User is throttled, try again later'), 422:...
mit
Python
1e1b677fa932611fc67566c2ea20fcd204914756
Bring in bloomfilter.py from pycoinnet.
shivaenigma/pycoin,mperklin/pycoin,richardkiss/pycoin,richardkiss/pycoin,shivaenigma/pycoin,pycoin/pycoin,mperklin/pycoin,pycoin/pycoin,zsulocal/pycoin,zsulocal/pycoin,XertroV/pycoin,XertroV/pycoin
pycoin/bloomfilter.py
pycoin/bloomfilter.py
import math import struct from pycoin.encoding import bitcoin_address_to_hash160_sec LOG_2 = math.log(2) def filter_size_required(element_count, false_positive_probability): # The size S of the filter in bytes is given by # (-1 / pow(log(2), 2) * N * log(P)) / 8 # Of course you must ensure it does not g...
mit
Python
f647dca86e308efbfb1885a46e7414c60d1b70fa
add dummy test so jenkins does not cry ):
tamasgal/km3pipe,tamasgal/km3pipe
km3modules/tests/test_dummy.py
km3modules/tests/test_dummy.py
# coding=utf-8 # Filename: test_core.py # pylint: disable=C0111,E1003,R0904,C0103,R0201,C0102 """Make a dummy test so jenkins won't cry ): """ from __future__ import division, absolute_import, print_function from km3pipe.testing import TestCase __author__ = "Moritz Lotze" __copyright__ = "Copyright 2016, and the KM3N...
mit
Python
46ed4e85fb41dded03a5fd8fdd544202bec2b56f
allow override of sieve's ignorebots in config
TeamPeggle/ppp-helpdesk,rmmh/skybot,Jeebeevee/DouweBot_JJ15,SophosBlitz/glacon,parkrrr/skybot,olslash/skybot,Teino1978-Corp/Teino1978-Corp-skybot,ddwo/nhl-bot,crisisking/skybot,elitan/mybot,Jeebeevee/DouweBot,callumhogsden/ausbot,df-5/skybot,jmgao/skybot
plugins/sieve.py
plugins/sieve.py
import re from util import hook @hook.sieve def sieve_suite(bot, input, func, kind, args): if input.command == 'PRIVMSG' and \ bot.config.get('ignorebots', True) and \ input.nick.lower()[-3:] == 'bot' and args.get('ignorebots', True): return None if kind == "command": if in...
import re from util import hook @hook.sieve def sieve_suite(bot, input, func, kind, args): if input.command == 'PRIVMSG' and \ input.nick.lower()[-3:] == 'bot' and args.get('ignorebots', True): return None if kind == "command": if input.trigger in bot.config.get('disabled_commands...
unlicense
Python
6675632b3d7ec05ec9eccaa4def33839fbeda7ac
Create readfile.py
CodersClan/full-contact-api-python
readfile.py
readfile.py
import csv from get import FullContactAdaptiveClient api = FullContactAdaptiveClient() open_file = open('sample.txt', 'r') emails = map(lambda s: s.strip(), open_file.readlines()) fieldnames = ['email', 'name', 'role', 'company', 'location', 'gender', 'linkedin', 'twitter', 'facebook'] def csv_dict_writer(path, ...
apache-2.0
Python
e61907e2a5923430dfc7f00441e6d8db217dd5d9
move methods to a class needs tidying up
jfecroft/count-fuzzy-repetitions
rep_funcs.py
rep_funcs.py
""" classes and methods related to repition counting in text """ from itertools import tee, izip, islice import yaml from collections import defaultdict def nwise(iterable, npairs=2): """ return a iterator which return consecutive npairs """ iters = tee(iterable, npairs) for i, iterator in enumera...
mit
Python
c44448e6e2fa846d4eea8b6d7d907168becdd1ad
Remove coverage options from default test run
faratro/django-oscar,WadeYuChen/django-oscar,django-oscar/django-oscar,jmt4/django-oscar,okfish/django-oscar,manevant/django-oscar,john-parton/django-oscar,jinnykoo/wuyisj,rocopartners/django-oscar,itbabu/django-oscar,makielab/django-oscar,saadatqadri/django-oscar,solarissmoke/django-oscar,sonofatailor/django-oscar,pdo...
runtests.py
runtests.py
#!/usr/bin/env python import sys import logging from optparse import OptionParser from tests.config import configure logging.disable(logging.CRITICAL) def run_tests(*test_args): from django_nose import NoseTestSuiteRunner test_runner = NoseTestSuiteRunner() if not test_args: test_args = ['tests'...
#!/usr/bin/env python import sys import logging from optparse import OptionParser from tests.config import configure logging.disable(logging.CRITICAL) def run_tests(*test_args): from django_nose import NoseTestSuiteRunner test_runner = NoseTestSuiteRunner() if not test_args: test_args = ['tests'...
bsd-3-clause
Python
0713a45552242722d8243f0ccc35e59e1f61fdf8
add problem 12
kulapard/projecteuler.net
python/problem_12.py
python/problem_12.py
# -*- coding: utf-8 -*- """ Highly divisible triangular number https://projecteuler.net/problem=12 """ import math def triangle_numbers(): x = t = 1 while True: yield t x += 1 t += x def divisors(n): for i in xrange(1, int(math.sqrt(n)) + 1): if n % i == 0: yi...
mit
Python
97b19e6f3705fc0b320f33b44476f7139833de9e
Add crude script to draw glowing lines; currently the dark part hides other lines, making them look physical; should be additive
redpig2/pilhacks
glowing-lines.py
glowing-lines.py
from PIL import Image, ImageDraw import random W = 500 im = Image.new('RGB', (W, W)) NCOLORS = 19 COLORS = [] def get_origin_point(): return [random.randint(0, W-1), random.randint(0, W-1)] def get_vector(): return [random.randint(0.3*W, 0.6*W), random.randint(0.3*W, 0.6*W)] def draw_one_line(draw): op = g...
mit
Python
50d87f596b515093b230ba4ed6475444b27bd503
Create server.py
belmih/simpleworks
python/yar1/server.py
python/yar1/server.py
mit
Python
f0922bade498bcadf587c4b756060cf062fe68d4
Add initial tests for the rand module
thatch45/sorbic,s0undt3ch/sorbic
tests/unit/test_rand.py
tests/unit/test_rand.py
''' Test sorbic.utils.rand ''' # import sorbic libs import sorbic.utils.rand # Import python libs import unittest class TestRand(unittest.TestCase): ''' Cover db funcs ''' def test_rand_hex_strs(self): ''' Test database creation ''' rands = [] for _ in range(0,1...
apache-2.0
Python
2faff1a11f233958b4c33071675e88e2daf26181
Add ensure2dColumn test.
ryanorendorff/pyop
tests/utilities_test.py
tests/utilities_test.py
#pylint: disable=W0104,W0108 import pytest import pyop import numpy as np ####################################################################### # Tests # ####################################################################### def testEnsure2dColumn(cap...
bsd-3-clause
Python
3dfda644efef83640e80876e4fe7da10e87b5990
Add missing coverage for ipv6 network utils (#555)
jstasiak/python-zeroconf
tests/utils/test_net.py
tests/utils/test_net.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Unit tests for zeroconf.utils.net.""" from unittest.mock import Mock, patch import ifaddr import pytest from zeroconf.utils import net as netutils def _generate_mock_adapters(): mock_lo0 = Mock(spec=ifaddr.Adapter) mock_lo0.nice_name = "lo0" mock_lo0.ip...
lgpl-2.1
Python
f74b1615567d5cbf2cb00572cc14450ffd4b0c1c
Create parametrized superclass for tests
DannyArends/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,DannyArends/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,DannyArends/genenetwork2,...
test/requests/parametrized_test.py
test/requests/parametrized_test.py
import logging import unittest from elasticsearch import Elasticsearch, TransportError class ParametrizedTest(unittest.TestCase): def __init__(self, methodName='runTest', gn2_url="http://localhost:5003", es_url="localhost:9200"): super(ParametrizedTest, self).__init__(methodName=methodName) self.g...
agpl-3.0
Python
bfce13e25ef569c985bab26a2f7e3bc1af9b6378
add profiler helper function
funginstitute/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor
lib/util/profile.py
lib/util/profile.py
import cProfile def profile_this(fn): def profiled_fn(*args, **kwargs): fpath = fn.__name__ + '.profile' prof = cProfile.Profile() ret = prof.runcall(fn, *args, **kwargs) prof.dump_stats(fpath) return ret return profiled_fn # Just use the following decorator to get a ps...
bsd-2-clause
Python
f708748f2fe573ea37e4344e0624c9628c1b1077
add custom argument parser for reuse in multiple projects
FunTimeCoding/python-utility,FunTimeCoding/python-utility
python_utility/custom_argument_parser.py
python_utility/custom_argument_parser.py
import sys from argparse import ArgumentParser class CustomArgumentParser(ArgumentParser): def error(self, message): sys.stderr.write('Error: %s\n' % message) sys.exit(1)
mit
Python
2c065b5f48106db964062d76ac12b44fa71657ae
Add files via upload
SeanBeseler/data-structures
src/dque.py
src/dque.py
class dque(object): def __init__(self): self.head = None self.tail = None self.next_node = None self.pre_node = None self.value = None self.len = 0 def append(self,val): new_dque = dque() temp_node = self.tail if self.len == 0: ...
mit
Python
274e550cb2534911b2d863974769d68aa77ec1fd
add sample
gatakaba/kalmanfilter
src/hoge.py
src/hoge.py
import numpy as np from kalmanfilter import KalmanFilter from kalmansmoother import KalmanSmoother A = np.array([[1, 0.01], [0, 1]]) C = np.atleast_2d([1, 0]) Q = np.array([[0.01, 0], [0, 0.01]]) R = np.eye(1) ks = KalmanSmoother(A, C, Q, R) kf = KalmanFilter(A, C, Q, R) t = np.linspace(0, 1, 1000) ...
mit
Python