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 |
|---|---|---|---|---|---|---|---|---|
c9d852041ed99964560c9f071a9c927911583a62 | Add Mediator pattern | jackaljack/design-patterns | mediator.py | mediator.py | """Mediator pattern
"""
import random
import time
class ControlTower(object):
def __init__(self):
self.available_runways = list()
self.engaged_runways = list()
def authorize_landing(self):
if not self.available_runways:
print('Request denied. No available runways')
... | mit | Python | |
31b81e3f901da0a06f5a949dbc55a00aa8b0a407 | Add auditor repo's events | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/auditor/events/repo.py | polyaxon/auditor/events/repo.py | import auditor
from libs.event_manager import event_types
from libs.event_manager.event import Event
class RepoCreatedEvent(Event):
type = event_types.REPO_CREATED
class RepoNewCommitEvent(Event):
type = event_types.REPO_NEW_COMMIT
auditor.register(RepoCreatedEvent)
auditor.register(RepoNewCommit)
| apache-2.0 | Python | |
ffd3b3367f7bb932505a6312c6370a7d30c3d1fe | Implement account-notify | Heufneutje/txircd,ElementalAlchemist/txircd | txircd/modules/ircv3/accountnotify.py | txircd/modules/ircv3/accountnotify.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class AccountNotify(ModuleData):
implements(IPlugin, IModuleData)
name = "AccountNotify"
def actions(self):
return [ ("usermetadataupdate", 10, self.sendAccountNotice),
... | bsd-3-clause | Python | |
1ea465856739169aadd90b27fc8ad1cf42dcb665 | add 120 | zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler | vol3/120.py | vol3/120.py | def calc(a):
s = set([2])
for n in range(1, 2 * a + 1, 2):
r = (2 * n * a) % (a * a)
s.add(r)
return max(s)
if __name__ == "__main__":
print sum([calc(a) for a in range(3, 1001)])
| mit | Python | |
94f621255ffb7b90f6233e45b658d9e73113cec4 | add 121 | EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,zeyuanxy/project-euler | vol3/121.py | vol3/121.py | if __name__ == "__main__":
LIMIT = 15
res = [0] * (LIMIT + 1)
res[LIMIT - 1] = res[LIMIT] = 1
for i in range(2, LIMIT + 1):
for j in range(0, LIMIT):
res[j] = res[j + 1]
res[LIMIT] = 0
for j in range(LIMIT, 0, -1):
res[j] += res[j - 1] * i
pos = 0
... | mit | Python | |
ac9f76d210776a322953ce838e4a8f3a0ff49795 | add basic mongo testing connection | meyersj/geotweet,meyersj/geotweet,meyersj/geotweet | tests/mongo/mongo_tests.py | tests/mongo/mongo_tests.py | import unittest
import os
from os.path import dirname
import sys
root = dirname(dirname(dirname(os.path.abspath(__file__))))
sys.path.append(root)
from geotweet.mongo import MongoGeo, MongoQuery
from pymongo import MongoClient
from pymongo.errors import ServerSelectionTimeoutError
MONGODB_URI = os.getenv('GEOTWEET_... | mit | Python | |
6361e766de14508342cc87f1b26dd99f43b02fc9 | Add script to calculate statistics about liwc categories | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | liwc2csv.py | liwc2csv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to generate statistics on LIWC entities.
The script calculates how many LIWC words are found. This script can be used to
compare the differences in numbers of words found for the modern and historic
versions of LIWC.
"""
from bs4 import BeautifulSoup
from lxml im... | apache-2.0 | Python | |
c788ff97a48d54d2b2c2cb181a1a0a95d100b850 | Add flip tests module | danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv | tests/plantcv/test_flip.py | tests/plantcv/test_flip.py | import pytest
import cv2
from plantcv.plantcv import flip
def test_flip(test_data):
# Read in test data
img = cv2.imread(test_data.small_rgb_img)
flipped_img = flip(img=img, direction="horizontal")
assert img.shape == flipped_img.shape
def test_flip_grayscale(test_data):
# Read in test data
... | mit | Python | |
7b7ead5fb9814ba1d25d73c9dea50db86a2a827f | add a script to update jar only. So we don't need to reingest data. | uwescience/myria,bsalimi/myria,bsalimi/myria,uwescience/myria,uwescience/myria,jamesmarva/myria,jamesmarva/myria,bsalimi/myria,jamesmarva/myria | myriadeploy/update_myria_jar_only.py | myriadeploy/update_myria_jar_only.py | #!/usr/bin/env python
import myriadeploy
import subprocess
import sys
def host_port_list(workers):
return [str(x) + ':' + str(y) for (x, y) in workers]
def copy_distribution(config):
"Copy the distribution (jar and libs and conf) to compute nodes."
nodes = config['nodes']
description = config['descr... | bsd-3-clause | Python | |
cdbd7b4ebb2190dc7e7067378d6b009d773c6537 | Create reverseCompliment.py | mikejthomas/biote100_pset2 | reverseCompliment.py | reverseCompliment.py | #Python Problem 1
#reverseComplement.py
#Introduction to Bioinformatics Assignment 2
#Purpose: Reverse Compliment
#Your Name: Michael Thomas
#Date: 10/10/15
#s1 is the string you should use to generate a reverse complement sequence
#Note that your result needs to be presented in the 5' to 3' direction
s1 = "AAAAACCC... | mit | Python | |
54c5f4f476cebec063652f5e4c6acd30bf2dee2e | Add test for nova-compute and nova-network main database blocks | klmitch/nova,gooddata/openstack-nova,hanlind/nova,mahak/nova,Juniper/nova,phenoxim/nova,vmturbo/nova,phenoxim/nova,mahak/nova,vmturbo/nova,rajalokan/nova,rajalokan/nova,openstack/nova,mikalstill/nova,gooddata/openstack-nova,mikalstill/nova,alaski/nova,sebrandon1/nova,sebrandon1/nova,openstack/nova,alaski/nova,mahak/nov... | nova/tests/unit/cmd/test_cmd_db_blocks.py | nova/tests/unit/cmd/test_cmd_db_blocks.py | # Copyright 2016 Red Hat
#
# 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 writing, soft... | apache-2.0 | Python | |
86c13905a616fe74ea1264b3e462ada3ca7b4e04 | Add a test for clickthrough | mpkato/openliveq | tests/test_clickthrough.py | tests/test_clickthrough.py | import openliveq as olq
import os
class TestClickthrough(object):
def test_load(self):
filepath = os.path.join(os.path.dirname(__file__),
"fixtures", "sample_clickthrough.tsv")
cs = []
with open(filepath) as f:
for line in f:
c = olq.Clickthrough.rea... | mit | Python | |
731e102ed1faee07128979655f4eaca9bd4818ba | Create analyse.py | KitWallace/terrain | analyse.py | analyse.py | """
analysis of an array
"""
import sys, math
from numpy import *
missing_value = -9999
elev = loadtxt(sys.stdin)
maxi = elev.shape[0]
maxj = elev.shape[1]
missing = 0
min = 999999999999
max = -99999999999
for i in range(0, maxi-1) :
for j in range(0, maxj-1) :
e = elev[i,j]
if (e == missing_v... | cc0-1.0 | Python | |
3f1b477c7e51fdafa44f090104fbf0f2ae10ccdf | Create Train.py | LauritsSkov/Introgression-detection | Train.py | Train.py | from templates import *
# Parameters (path to observations file, output file, model, weights file)
_, infile, outprefix, model, weights_file = sys.argv
# Load data
state_names, transitions, emissions, starting_probabilities, weights = make_hmm_from_file(model, weights_file)
obs = read_observations_from_file(infile)
... | mit | Python | |
39ceccd8fe3d3a91c2975dac33e3c70dd07ce10e | add example deafult_reprocess_summaries_func | mit-probabilistic-computing-project/crosscat,probcomp/crosscat,fivejjs/crosscat,fivejjs/crosscat,probcomp/crosscat,fivejjs/crosscat,fivejjs/crosscat,probcomp/crosscat,probcomp/crosscat,fivejjs/crosscat,mit-probabilistic-computing-project/crosscat,probcomp/crosscat,probcomp/crosscat,probcomp/crosscat,fivejjs/crosscat,fi... | crosscat/utils/summary_utils.py | crosscat/utils/summary_utils.py | import numpy
#
import crosscat.utils.convergence_test_utils
def get_logscore(p_State):
return p_State.get_marginal_logp()
def get_num_views(p_State):
return len(p_State.get_X_D())
def get_column_crp_alpha(p_State):
return p_State.get_column_crp_alpha()
def get_ari(p_State):
# requires environment: ... | apache-2.0 | Python | |
866daca6e25e41ef35aee0539e737e33e8275645 | Create photoTweet.py | Semyonic/RaspberryPi-Projects,Semyonic/RaspberryPi-Projects,Semyonic/RaspberryPi-Projects | Twitter/photoTweet.py | Twitter/photoTweet.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python2.7
import tweepy
from subprocess import call
from datetime import datetime
# Date-Time stamps
tm = datetime.now()
now = tm.strftime('%Y%m%d-%H%M%S')
photo_name = now + '.jpg'
cmd = 'sudo raspistill -v -vf -mm spot -q 100 -w 1024 -h 768 -o /ho... | mit | Python | |
a9a4befe88b35a50470c5c48062c8f56c643203d | Create metatest.py | yan123/QABox,yan123/BitBox,yan123/QABox | metatest.py | metatest.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest import TestCase
import itertools
import sys
def mix_params(args_kwargs):
args, kwargs = args_kwargs
args_len = len(args)
for i in itertools.product(*itertools.chain(args, kwargs.values())):
yield tuple(i[:args_len]), dict(zip(kwargs.keys(... | bsd-2-clause | Python | |
e351b88ecbc0a75f6945abf5e1f745760b22ea2b | Delete non-primary images | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ynr/apps/people/migrations/0036_delete_non_primary_images.py | ynr/apps/people/migrations/0036_delete_non_primary_images.py | # Generated by Django 3.2.4 on 2022-02-15 10:51
from django.db import migrations
def delete_non_primary_images(apps, schema_editor):
PersonImage = apps.get_model("people", "PersonImage")
PersonImage.objects.filter(is_primary=False).delete()
class Migration(migrations.Migration):
dependencies = [("peop... | agpl-3.0 | Python | |
c0271aa4812ba0c3a77d415aefed4a52b50952c3 | Convert to/from marble strings | dbrattli/RxPY,ReactiveX/RxPY,ReactiveX/RxPY | rx/testing/stringify.py | rx/testing/stringify.py | from six import add_metaclass
from rx import AnonymousObservable, Observable
from rx.concurrency import timeout_scheduler
from rx.internal import ExtensionMethod
from .coldobservable import ColdObservable
from .reactivetest import ReactiveTest
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
o... | mit | Python | |
5607b6fe168f4142dc2c1f343e782f232206ddee | Create apps.py | etianen/django-reversion,etianen/django-reversion | reversion/apps.py | reversion/apps.py | from django.apps import AppConfig
class ReversionConfig(AppConfig):
name = 'reversion'
default_auto_field = 'django.db.models.BigAutoField'
| bsd-3-clause | Python | |
905aba6e79e5ec0d2087b30b60002f475234cfe4 | Make `sat.ext` a package | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/ext/__init__.py | salt/ext/__init__.py | # coding: utf-8 -*-
| apache-2.0 | Python | |
8c4e58fac4d1d020ac2da38441067959100690a5 | Add expectation that all Python code is correct | yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core | yunity/tests/integration/test_python.py | yunity/tests/integration/test_python.py | from importlib import import_module, reload
from os.path import join as join_path, dirname
from os import walk
from sys import modules
from yunity.utils.tests.abc import BaseTestCase
import yunity
def _path_to_module(path, root_module_path, pysuffix='.py'):
path = path[len(dirname(root_module_path)) + 1:-len(pys... | agpl-3.0 | Python | |
a7cc097497164b36513874c74828d00fc1d42b0b | Add stack example | b-ritter/python-notes,b-ritter/python-notes | data-structures/stacks/stack.py | data-structures/stacks/stack.py | ex_strs = [
"(())",
"([[]])",
"(]",
"(((())))[",
"()"
]
def check_balanced(s):
stack = []
for char in s:
if char in ['(', '[']:
stack.append(char)
else:
if len(stack) == 0:
return False
top = stack.pop()
if ... | mit | Python | |
e349f976de289219978afa807e2f177e404a1182 | add mdbsi distributions | dit/dit,Autoplectic/dit,dit/dit,dit/dit,dit/dit,Autoplectic/dit,Autoplectic/dit,Autoplectic/dit,dit/dit,Autoplectic/dit | dit/example_dists/mdbsi.py | dit/example_dists/mdbsi.py | """
The two distributions studied in Multivariate Dependencies Beyond Shannon Information.
"""
from ..distconst import uniform
__all__ = ['dyadic', 'triadic']
dyadic = uniform(['000', '021', '102', '123', '210', '231', '312', '333'])
dyadic.set_rv_names('XYZ')
triadic = uniform(['000', '111', '022', '133', '202', '... | bsd-3-clause | Python | |
95d23d7c68ff03acc7d854cd91fa3eaabfaf1a4f | add a unit tests | tcc-unb-fga/debile,mdimjasevic/debile,lucaskanashiro/debile,opencollab/debile,lucaskanashiro/debile,mdimjasevic/debile,opencollab/debile,tcc-unb-fga/debile | tests/test_utils.py | tests/test_utils.py | from debile.utils.commands import run_command
from debile.utils.commands import safe_run
from debile.utils.deb822 import Changes
def test_run_command():
run_command("ls")
run_command("cat","foo")
(output, output_stderr, exit_status) = run_command("ls2")
assert exit_status != 0
def test_safe_run():
... | mit | Python | |
50803718c2629c53503ca6831dc97e2b263fe526 | add login script | parrt/msan692,parrt/msan692,parrt/msan692 | notes/code/selenium/login.py | notes/code/selenium/login.py | from Tkinter import *
master = Tk()
Label(master, text="Username").grid(row=0)
Label(master, text="Password").grid(row=1)
user = Entry(master)
password = Entry(master, show="*")
user.grid(row=0, column=1)
password.grid(row=1, column=1)
def login():
print "hi"
master.quit()
Button(master, text='Login', comm... | mit | Python | |
87fdc8ab59baa989d57c482085d67fb139573313 | Test - Trigger AttributeError with an get_name call in daemonlinks | titilambert/alignak,Alignak-monitoring/alignak,gst/alignak,titilambert/alignak,Alignak-monitoring/alignak,gst/alignak,gst/alignak,titilambert/alignak,titilambert/alignak,gst/alignak | test/test_get_name.py | test/test_get_name.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free So... | agpl-3.0 | Python | |
5fd7164238281c23ea89999687bde7b6b2d179ce | Create bisect_search.py | Navuchodonosor/octo-turtle,Navuchodonosor/octo-turtle,Navuchodonosor/octo-turtle | bisect_search.py | bisect_search.py | x=int(raw_input('Enter your integer number(!not negative!):'))
epsilon=0.01
low=0.0
high=x
ans=(high+low)/2.0
while abs(ans**2-x)>=epsilon:
if ans**2 < x:
low=ans
else:
high=ans
ans=(high+low)/2.0
print (str(ans) + ' is close to square root of ' + str(x))
| mit | Python | |
0e642c373a67997041664e51d0c867b1af4583fb | add missing file from last commit | blablacar/exabgp,earies/exabgp,benagricola/exabgp,earies/exabgp,blablacar/exabgp,fugitifduck/exabgp,fugitifduck/exabgp,dneiter/exabgp,blablacar/exabgp,PowerDNS/exabgp,fugitifduck/exabgp,dneiter/exabgp,chrisy/exabgp,earies/exabgp,chrisy/exabgp,lochiiconnectivity/exabgp,PowerDNS/exabgp,dneiter/exabgp,benagricola/exabgp,b... | dev/apitest/operational-send.py | dev/apitest/operational-send.py | #!/usr/bin/env python
import os
import sys
import time
# When the parent dies we are seeing continual newlines, so we only access so many before stopping
counter = 1
while True:
try:
time.sleep(1)
if counter % 2:
print 'operational adm "this is dynamic message #%d"' % counter
sys.stdout.flush()
print >... | bsd-3-clause | Python | |
51947adcc02d6a5ae20494f577e6402f2f263fcf | Add the arrayfns compatibility library -- not finished. | teoliphant/numpy-refactor,Ademan/NumPy-GSoC,chadnetzer/numpy-gaurdro,Ademan/NumPy-GSoC,efiring/numpy-work,chadnetzer/numpy-gaurdro,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,illume/numpy3k,illume/numpy3k,efiring/numpy-work,jasonmccampbell/numpy-refactor-sprint,ch... | numpy/oldnumeric/arrayfns.py | numpy/oldnumeric/arrayfns.py | """Backward compatible with arrayfns from Numeric
"""
__all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask', 'histogram', 'index_sort',
'interp', 'nz', 'reverse', 'span', 'to_corners', 'zmin_zmax']
import numpy as nx
from numpy import asarray
class error(Exception):
pass
def array_se... | bsd-3-clause | Python | |
f52e033c433cba6de6611b123b1c075f34fe96bf | add tools/simple_gen.py | buganini/bsdconv,buganini/bsdconv,buganini/bsdconv,buganini/bsdconv | tools/simple_gen.py | tools/simple_gen.py | # simple_gen.py from_column to_column file
import sys
import re
def bsdconv01(dt):
dt=dt.strip().lstrip("0").upper()
if len(dt) & 1:
return "010"+dt
else:
return "01"+dt
stp = re.compile(r"^(U\+|0X)")
sep = re.compile(r"\s+")
vld = re.compile(r"^[a-fA-F0-9,]+$")
from_column = int(sys.argv[1])
to_column = int(... | bsd-2-clause | Python | |
003378314b8e11f6b67d155348708964ec184292 | add XML validation utility | benhowell/pycsw,ingenieroariel/pycsw,tomkralidis/pycsw,ricardogsilva/pycsw,kalxas/pycsw,geopython/pycsw,kevinpdavies/pycsw,mwengren/pycsw,ocefpaf/pycsw,PublicaMundi/pycsw,geopython/pycsw,ckan-fcd/pycsw-fcd,kevinpdavies/pycsw,ckan-fcd/pycsw-fcd,tomkralidis/pycsw,ocefpaf/pycsw,bukun/pycsw,ingenieroariel/pycsw,ricardogsil... | sbin/validate_xml.py | sbin/validate_xml.py | #!/usr/bin/python
# -*- coding: ISO-8859-15 -*-
# =================================================================
#
# $Id$
#
# Authors: Angelos Tzotsos <tzotsos@gmail.com>
#
# Copyright (c) 2011 Angelos Tzotsos
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and ass... | mit | Python | |
1aaf19e369033c9baf198b0ab1ee43067dd2669d | Add Base Bot | fisadev/choppycamp | bots/base_bot.py | bots/base_bot.py | import choppycamp.constants as constants
class BaseBot(object):
def __init__(self, name, map_, enemy):
self.name = name
self.map = map_
self.enemy = enemy
def act(self, map_):
return constants.DANCE
| mit | Python | |
fcf567669ac3cee053928ef7b2da0eead2e017a1 | Add initial tests for the helpers module. | wulczer/flvlib | test/test_helpers.py | test/test_helpers.py | import unittest
import datetime
from flvlib import helpers
class TestFixedOffsetTimezone(unittest.TestCase):
def test_utcoffset(self):
fo = helpers.FixedOffset(30, "Fixed")
self.assertEquals(fo.utcoffset(True), datetime.timedelta(minutes=30))
self.assertEquals(fo.utcoffset(False), dateti... | mit | Python | |
d0f92caf504e78a3fd7257ac9fab1fbd9c039212 | Add simple tests for DAP validator wrappers. | enthought/distarray,RaoUmer/distarray,enthought/distarray,RaoUmer/distarray | distarray/tests/test_testing.py | distarray/tests/test_testing.py | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
imp... | bsd-3-clause | Python | |
c977c382d49403f7856f1d3cb8398412a8212034 | Add script to update bio processes | clulab/bioresources | scripts/update_go.py | scripts/update_go.py | """This script updates bio_processes.tsv based on names and synonyms from GO.
It also incorporates old, presumably manually collected GO and MeSH entries
some of which provide synonyms that the official GO download doesn't.
This script therefore adds these, as long as they are not redundant.
"""
import os
import re
imp... | apache-2.0 | Python | |
987f8325b32c468ab2aa134bed35314e0170def1 | implement most of repl module | sammdot/circa | modules/repl.py | modules/repl.py | import code
import sys
from util.nick import nickeq, nicklower
class Repl(code.InteractiveConsole):
def __init__(self, circa, channel):
code.InteractiveConsole.__init__(self, {"circa": circa})
self.circa = circa
self.channel = channel
self.buf = ""
def write(self, data):
self.buf += data
def flush(se... | bsd-3-clause | Python | |
89d25a460fd805a53bdfbced459c78a24f3b7da0 | Add yamtbx.ipython command | keitaroyam/yamtbx,keitaroyam/yamtbx,keitaroyam/yamtbx,keitaroyam/yamtbx | yamtbx/command_line/yamtbx_ipython.py | yamtbx/command_line/yamtbx_ipython.py | # LIBTBX_SET_DISPATCHER_NAME yamtbx.ipython
import sys
from IPython import start_ipython
if __name__ == '__main__':
sys.exit(start_ipython())
| bsd-3-clause | Python | |
3f7e08443e6c5a00b9df9831fad0a13f7c516dd0 | add simple test for login | opmuse/opmuse,opmuse/opmuse,opmuse/opmuse,opmuse/opmuse | opmuse/test/test_security.py | opmuse/test/test_security.py | from . import setup_db, teardown_db
from nose.tools import with_setup
from opmuse.security import User, hash_password
@with_setup(setup_db, teardown_db)
class TestSecurity:
def test_login(self):
user = self.session.query(User).filter_by(login="admin").one()
hashed = hash_password("admin", user.sa... | agpl-3.0 | Python | |
6dfa189bdab536ecfa2c14e4893017363923ee6a | Implement Naive Bayes Classifier builder method | ah450/ObjectRecognizer | bayes.py | bayes.py | import numpy as np
import cv2
# pos and neg are positive and negative instances
# each is a list of files of nparray dumps,
# nparray of BoW histograms; shape = (n, 101)
# of the class to be trained for
def build_trained_classifier(pos_files, neg_files):
total = len(pos_files) + len(neg_files)
samples = np.emp... | mit | Python | |
e90fb0e3ca17f15a5058a3f1d1e08be376b1863b | Add Asset Instance model | cgwire/zou | zou/app/models/asset_instance.py | zou/app/models/asset_instance.py | from sqlalchemy_utils import UUIDType
from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin
class AssetInstance(db.Model, BaseMixin, SerializerMixin):
asset_id = db.Column(UUIDType(binary=False), db.ForeignKey('entity.id'))
shot_id = db.Column(... | agpl-3.0 | Python | |
6b215d2dd3c6915b4d1c5a46b2a890b14cae7d75 | Add test for Issue #1537 | aikramer2/spaCy,recognai/spaCy,spacy-io/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,recognai/spaCy,recognai/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,spacy-io/spaCy,honnibal/spaCy,recognai/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaC... | spacy/tests/regression/test_issue1537.py | spacy/tests/regression/test_issue1537.py | '''Test Span.as_doc() doesn't segfault'''
from ...tokens import Doc
from ...vocab import Vocab
from ... import load as load_spacy
def test_issue1537():
string = 'The sky is blue . The man is pink . The dog is purple .'
doc = Doc(Vocab(), words=string.split())
doc[0].sent_start = True
for word in doc[... | mit | Python | |
358ea3780ea5cbb165357f8089c4aa23aab7de73 | test route53. | jonhadfield/acli,jonhadfield/acli | tests/test_route53.py | tests/test_route53.py | from __future__ import (absolute_import, print_function, unicode_literals)
from acli.output.route53 import (output_route53_list, output_route53_info)
from acli.services.route53 import (route53_list, route53_info)
from acli.config import Config
from moto import mock_route53
import pytest
from boto3.session import Sessi... | mit | Python | |
b6b239cf16849890434a31755f3f3d2b8e510a95 | add benchmark comparing to SQLAlchemy, only 12x faster for simple select :) | mahmoud/_norm,mahmoud/_norm | benchmark.py | benchmark.py | import time
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
from sqlalchemy.sql import select
from norm import SELECT
metadata = MetaData()
users = Table(
'users', metadata,
Column('id', Integer, primary_key=True),
Column('name', String),
Column('fullname', String))
addre... | bsd-3-clause | Python | |
28801ac8f38e8560c17b2da57559762ecd5e06ca | copy babel.plural doctests as unit tests | jmagnusson/babel,lepistone/babel,iamshubh22/babel,mitsuhiko/babel,gutsy/babel,masklinn/babel,hanteng/babel,iamshubh22/babel,mbirtwell/babel,mitsuhiko/babel,nickretallack/babel,srisankethu/babel,jespino/babel,javacruft/babel,python-babel/babel,xlevus/babel,srisankethu/babel,prmtl/babel,xlevus/babel,yoloseem/babel,felixo... | tests/test_plural.py | tests/test_plural.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | bsd-3-clause | Python |
e3636bd897fbd7af4aab5b501269a55a89de29a0 | Add public view tests | nickfrostatx/corral,nickfrostatx/corral,nickfrostatx/corral | tests/test_public.py | tests/test_public.py | # -*- coding: utf-8 -*-
"""Test the public routes."""
from corral.app import create_app
def test_root():
app = create_app()
app.config['AUTH_KEY'] = 'secretpassword'
with app.test_client() as c:
rv = c.get('/')
assert b'<h1>Login</h1>' in rv.data
assert rv.status_code == 200
... | mit | Python | |
71b6246dda3e4812490a5c2936eac44e063806c0 | Add tests for sonify submodule | faroit/mir_eval,faroit/mir_eval,bmcfee/mir_eval,craffel/mir_eval,bmcfee/mir_eval,rabitt/mir_eval,craffel/mir_eval,rabitt/mir_eval | tests/test_sonify.py | tests/test_sonify.py | """ Unit tests for sonification methods """
import mir_eval
import numpy as np
def test_clicks():
# Test output length for a variety of parameter settings
for times in [np.array([1.]), np.arange(10)*1.]:
for fs in [8000, 44100]:
click_signal = mir_eval.sonify.clicks(times, fs)
... | mit | Python | |
894aeb1485614f5676410f99b02ef4cb8e9ef8e3 | create NLP toolset | agbs2k8/toolbelt_dev | toolbelt/nlp_tools.py | toolbelt/nlp_tools.py | # -*- coding: utf-8 -*-
import string
import re
import nltk
from nltk.corpus import stopwords
from .utils import validate_str
my_stopwords = stopwords.words('english')
stemmer = nltk.stem.porter.SnowballStemmer()
def remove_punctuation(text):
"""
Simple function that will take a string or list of strings,... | mit | Python | |
0050d1ca6f0fa15462231cf5531d494277c1f8ca | move events from claw to claw-scripts | dankilman/claw-scripts,ChenRoth/claw-scripts | scripts/events.py | scripts/events.py | #! /usr/bin/env claw
########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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/L... | apache-2.0 | Python | |
c3fd15307b20a891ef194221c51ec1897355fd29 | Use built-in print() instead of print statement | openstack/tempest,citrix-openstack-build/tempest,vedujoshi/tempest,itskewpie/tempest,Tesora/tesora-tempest,izadorozhna/tempest,Vaidyanath/tempest,cisco-openstack/tempest,BeenzSyed/tempest,Juraci/tempest,armando-migliaccio/tempest,eggmaster/tempest,jaspreetw/tempest,redhat-cip/tempest,afaheem88/tempest,manasi24/jiocloud... | tools/install_venv.py | tools/install_venv.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# flake8: noqa
# Copyright 2010 OpenStack, LLC
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Ve... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# flake8: noqa
# Copyright 2010 OpenStack, LLC
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Ve... | apache-2.0 | Python |
74e3e5a8fdbc5f9a6ee71f2ad1de4fd8a8807b5a | Add migration for default last polled date. | nirmeshk/oh-mainline,eeshangarg/oh-mainline,willingc/oh-mainline,Changaco/oh-mainline,openhatch/oh-mainline,ojengwa/oh-mainline,sudheesh001/oh-mainline,nirmeshk/oh-mainline,vipul-sharma20/oh-mainline,heeraj123/oh-mainline,ojengwa/oh-mainline,nirmeshk/oh-mainline,heeraj123/oh-mainline,eeshangarg/oh-mainline,onceuponatim... | mysite/search/migrations/0034_default_last_polled_date.py | mysite/search/migrations/0034_default_last_polled_date.py |
from south.db import db
from django.db import models
from mysite.search.models import *
class Migration:
def forwards(self, orm):
# Changing field 'Bug.last_polled'
# (to signature: django.db.models.fields.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0)))
db.alter_c... | agpl-3.0 | Python | |
c76775b244ccd07a73ec0d894f5e940ae673dd73 | implement ordereddict | DragonRoman/ovirt-engine-sdk,DragonRoman/ovirt-engine-sdk,DragonRoman/ovirt-engine-sdk | src/ovirtsdk/utils/ordereddict.py | src/ovirtsdk/utils/ordereddict.py |
from UserDict import UserDict
import thread
class OrderedDict(UserDict):
"""A dictionary preserving insert order"""
def __init__(self, dict=None):
self._keys = []
UserDict.__init__(self, dict)
self.__plock = thread.allocate_lock()
self.__rlock = thread.allocate_lock()
def ... | apache-2.0 | Python | |
1f225b06eed8e7c3266c9d9c48e7b5e86ee677a0 | Test ssh | cindithompson/Clique-Finding-With-Patterns | run_time2.py | run_time2.py | import cProfile
cProfile.run("core_alg.process_from_file('/Users/cat/data/maxmal-cliques/turan30_10')") | mit | Python | |
f46361d1009665e87543b56d69212b04b9b14993 | Add scripts which Define a function to compute color histogram features | aguijarro/SelfDrivingCar | VehicleDetectionTracking/histo_colors.py | VehicleDetectionTracking/histo_colors.py | # Code given by Udacity, complete by Andres Guijarro
# Purpose: Define a function to compute color histogram features
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
image = mpimg.imread('cutout1.jpg')
# Define a function to compute color histogram features
def color_hist(img, n... | mit | Python | |
ea8bafeb9a48ebaf8da9d69e107089cd26383e66 | patch handler redesigned | MaxMorais/frappe,rohitwaghchaure/vestasi-frappe,deveninfotech/deven-frappe,gangadharkadam/smrtfrappe,gangadharkadam/letzfrappe,gangadharkadam/smrtfrappe,rmehta/frappe,mbauskar/frappe,indictranstech/ebuy-now-frappe,pombredanne/frappe,indictranstech/reciphergroup-frappe,indictranstech/omnitech-frappe,StrellaGroup/frappe,... | py/webnotes/modules/patch_handler.py | py/webnotes/modules/patch_handler.py | # patch manager
#---------------
import webnotes
def run(patch_list, overwrite = 0, log_exception=1, conn = '', db_name = '', root_pwd = ''):
# db connection
if not conn:
connect_db(db_name, root_pwd)
else:
webnotes.conn = conn
# session
if not webnotes.session:
webnotes.session = {'user':'Administrator'... | mit | Python | |
428670421c60305c7c89579fe81419bfc0a920fa | Create facebook.py | Asyncode/ACR2.0,GluuIO/ACR2.0 | ACR/components/facebook.py | ACR/components/facebook.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Asyncode Runtime - enabling non-tech people to develop internet software.
# Copyright (C) 2014-2015 Asyncode Ltd.
# PROPRIETARY component
from ACR.components import *
from ACR.utils import generateID, replaceVars
from ACR.utils.interpreter import makeTree
from ACR impo... | agpl-3.0 | Python | |
ff19fd40ea90da1b47bdaa26522f0a30ca18e73f | make all mysql tables explicitly innodb | isyippee/nova,Triv90/Nova,tianweizhang/nova,belmiromoreira/nova,noironetworks/nova,devendermishrajio/nova,usc-isi/extra-specs,JianyuWang/nova,CiscoSystems/nova,openstack/nova,redhat-openstack/nova,sacharya/nova,tudorvio/nova,houshengbo/nova_vmware_compute_driver,cernops/nova,silenceli/nova,takeshineshiro/nova,savi-dev/... | nova/db/sqlalchemy/migrate_repo/versions/086_set_engine_mysql_innodb.py | nova/db/sqlalchemy/migrate_repo/versions/086_set_engine_mysql_innodb.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | apache-2.0 | Python | |
19297efacbc15434e13854aff9c204520ce45179 | Create example_uncertainty.py | gwtsa/gwtsa,pastas/pasta,pastas/pastas | examples/example_uncertainty.py | examples/example_uncertainty.py | import matplotlib.pyplot as plt
import pandas as pd
import pastas as ps
ps.set_log_level("ERROR")
# read observations and create the time series model
obs = pd.read_csv("data/head_nb1.csv", index_col=0, parse_dates=True,
squeeze=True)
ml = ps.Model(obs, name="groundwater head")
# read weather data... | mit | Python | |
9b099f9b9fb51d5bc1983e68f8267b2fca0ddfec | Create close.py | kellogg76/ArduinoTelescopeDustCover | close.py | close.py | ## Open a serial connection with Arduino.
import time
import serial
ser = serial.Serial("COM9", 9600) # Open serial port that Arduino is using
time.sleep(3) # Wait 3 seconds for Arduino to reset
print ser # Print serial config
print "Sending serial command to CLOSE th... | mit | Python | |
b303eccd4b3ec902f90c0e4bfb18314b37dd763b | print using future example | ET-CS/python-patterns | examples/python2/basic/print.py | examples/python2/basic/print.py | #!/usr/bin/env python
# to change to python 3 print syntax (reommended!)
from __future__ import print_function
print('o' 'n' "e")
# >>> one
| apache-2.0 | Python | |
7eb21d4cb05dd26835e10cb17ff1ef399b228067 | Add api tests | njbbaer/unicorn-remote,njbbaer/unicorn-remote,njbbaer/unicorn-remote | app/tests/test_api.py | app/tests/test_api.py | import unittest
from app import app, state
class TestAPI(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
def tearDown(self):
state.stop_program()
def test_start_all(self):
programs= ["ascii_text", "cheertree", "cross", "demo", "dna",
"game_of_... | mit | Python | |
a2e18f9b10e5e6bbcad6c13cdc5c76047d319fc2 | Add fake limited composite example | Kitware/tonic-data-generator,Kitware/tonic-data-generator | python/tests/test_pv_composite_wavelet.py | python/tests/test_pv_composite_wavelet.py | # -----------------------------------------------------------------------------
# User configuration
# -----------------------------------------------------------------------------
outputDir = '/Users/seb/Desktop/float-image/'
# -----------------------------------------------------------------------------
from paravie... | bsd-3-clause | Python | |
3e85c471765f03151d0f6d11680b16c6eccedbec | Add Django admin for browsers, browser versions | mdn/browsercompat,jwhitlock/web-platform-compat,renoirb/browsercompat,renoirb/browsercompat,jwhitlock/web-platform-compat,mdn/browsercompat,renoirb/browsercompat,jwhitlock/web-platform-compat,mdn/browsercompat | webplatformcompat/admin.py | webplatformcompat/admin.py | from django.contrib import admin
from simple_history.admin import SimpleHistoryAdmin
from .models import Browser, BrowserVersion
class BrowserAdmin(SimpleHistoryAdmin):
pass
class BrowserVersionAdmin(SimpleHistoryAdmin):
pass
admin.site.register(Browser, BrowserAdmin)
admin.site.register(BrowserVersion, ... | mpl-2.0 | Python | |
503179f2ed6416a719c1caea90a7882519bedfa9 | Add py23 compat layer | fonttools/fonttools,googlefonts/fonttools | Lib/fontTools/misc/py23.py | Lib/fontTools/misc/py23.py | """Python 2/3 compat layer."""
try:
basestring
except NameError:
basestring = str
try:
unicode
except NameError:
unicode = str
try:
unichr
bytechr = chr
except:
unichr = chr
def bytechr(n):
return bytes([n])
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
| mit | Python | |
96897b01ef1fa8ff33d6831ba01e7d1c6fc02b67 | Add ufo2ft.preProcessor module | jamesgk/ufo2ft,googlei18n/ufo2ft,moyogo/ufo2ft,googlefonts/ufo2ft,jamesgk/ufo2fdk | Lib/ufo2ft/preProcessor.py | Lib/ufo2ft/preProcessor.py | from __future__ import (
print_function, division, absolute_import, unicode_literals)
from ufo2ft.filters import loadFilters
from ufo2ft.filters.decomposeComponents import DecomposeComponentsFilter
from copy import deepcopy
class BasePreProcessor(object):
"""Base class for objects that performs pre-processi... | mit | Python | |
5fa27287c37dd77ebcabf7759e4bb96693b86d8d | Create Africa2010_A.py | Pouf/CodingCompetition,Pouf/CodingCompetition | GoogleCodeJam/Africa2010_A.py | GoogleCodeJam/Africa2010_A.py | def solve(i, d):
C, I, prices = d
C = int(C)
prices = list(map(int, prices.split()))
for p1, P1 in enumerate(prices[:-1]):
remains = C-P1
left = prices[p1+1:]
if remains in left:
result = [p1+1, p1+left.index(remains)+2]
return i, ' '.join(map(str, result)... | mit | Python | |
e1e7922efac2b7fdfab7555baaf784edb345c222 | Add circle sort implementation (#5548) | TheAlgorithms/Python | sorts/circle_sort.py | sorts/circle_sort.py | """
This is a Python implementation of the circle sort algorithm
For doctests run following command:
python3 -m doctest -v circle_sort.py
For manual testing run:
python3 circle_sort.py
"""
def circle_sort(collection: list) -> list:
"""A pure Python implementation of circle sort algorithm
:param collection:... | mit | Python | |
fff27fd33a4139c7d22b086364ab483819081adf | Create costs.py | evanscottgray/parse_rax_email_invoices,evanscottgray/parse_rax_email_invoices | costs.py | costs.py | #!/usr/bin/env python
import re
import sys
import json
def get_stdin():
stdin_lines = []
for line in sys.stdin:
stdin_lines.append(line)
return ''.join(stdin_lines)
def get_domains(text):
# NOTE(evanscottgray) YES I KNOW THAT THIS IS NOT PEP8
rgx = re.compile(r'(([a-zA-Z]{1})|([a-zA-Z]{1... | mit | Python | |
0899700549466f27748b8ac907c0d582aaad5556 | add the python file to test cntk and GPU | LingyuMa/kaggle_planet | test_cntk.py | test_cntk.py | # -*- coding: utf-8 -*-
"""
Created on Wed May 31 22:46:43 2017
@author: Lingyu
"""
from cntk.device import try_set_default_device, gpu
print('Use GPU: {}'.format(try_set_default_device(gpu(0))))
import numpy as np
import cntk as C
from cntk.learners import sgd, learning_rate_schedule, UnitType
from cntk.logging imp... | mit | Python | |
6a2bd578cc22231bce66a4d110b4ff1536743097 | Add index to the `created_at` column in `published_award_financial_assistance` and the `updated_at` column in `detached_award_procurement` | fedspendingtransparency/data-act-broker-backend,fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/7597deb348fb_fabs_created_at_and_fpds_updated_at_.py | dataactcore/migrations/versions/7597deb348fb_fabs_created_at_and_fpds_updated_at_.py | """FABS created_at and FPDS updated_at indexes
Revision ID: 7597deb348fb
Revises: b168f0cdc5a8
Create Date: 2018-02-06 16:08:20.985202
"""
# revision identifiers, used by Alembic.
revision = '7597deb348fb'
down_revision = 'b168f0cdc5a8'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy... | cc0-1.0 | Python | |
847aef794f77ed036c77d7334263434a7d4c0084 | Add pad.py: pad file to given size using given byte. | S010/misc,S010/misc,S010/misc,S010/misc,S010/misc,S010/misc,S010/misc,S010/misc,S010/misc | tools/pad.py | tools/pad.py | #!/usr/bin/python3
#
# Read a file from standard input and if it's size is less the specified size
# pad it writing the result to standard output.
#
# Example:
# echo -n 'abc' | ./pad.py 16 0x50 | hexdump -C
# 00000000 61 62 63 50 50 50 50 50 50 50 50 50 50 50 50 50 |abcPPPPPPPPPPPPP|
# 00000010
#
import s... | isc | Python | |
80889986cd4742d7c63be46447b0097eac5bd745 | Update letter-case-permutation.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode | Python/letter-case-permutation.py | Python/letter-case-permutation.py | # Time: O(n * 2^n)
# Space: O(n * 2^n)
# Given a string S, we can transform every letter individually to be lowercase
# or uppercase to create another string. Return a list of all possible strings we could create.
#
# Examples:
# Input: S = "a1b2"
# Output: ["a1b2", "a1B2", "A1b2", "A1B2"]
#
# Input: S = "3z4"
# Out... | # Time: O(n * 2^n)
# Space: O(n * 2^n)
# Given a string S, we can transform every letter individually to be lowercase
# or uppercase to create another string. Return a list of all possible strings we could create.
#
# Examples:
# Input: S = "a1b2"
# Output: ["a1b2", "a1B2", "A1b2", "A1B2"]
#
# Input: S = "3z4"
# Out... | mit | Python |
af530c45d11a22d53a25150583299b6137e70fe4 | add reddcoin overrides | neocogent/sqlchain,neocogent/sqlchain,neocogent/sqlchain,neocogent/sqlchain | sqlchain/reddcoin.py | sqlchain/reddcoin.py | #
# Override Block and Tx decoding for Reddcoin (Proof of Stake)
#
# Changes as per reddcoin source core.h
#
# CTransaction - if version > POW_TX_VERSION then unsigned int nTime follows nLockTime
# CBlock - if version > POW_BLOCK_VERSION then BlockSig string follows tx array
# Transactions can be CoinStake, t... | mit | Python | |
9c17b5eada0c9830c6b6a9a8fe20bfe2ec6e8728 | Create conflict_test.py | MSU-CS-Software-Engineering/habitgame,MSU-CS-Software-Engineering/habitgame | conflict_test.py | conflict_test.py | """The point of this exercise is to create a merging conflict.
Accomplish this by deleting the line containing the if statement
above your name. Only modify the one if statement with your name"""
## BEFORE
## if("name"):
## print "name"
##
## AFTER
## print "name"
def print_name():
if("Timothy"):
... | mit | Python | |
8e98b8d884b53eaeb43c03548a32520e34fb340e | Add pID | panoptes/POCS,AstroHuntsman/POCS,panoptes/POCS,AstroHuntsman/POCS,panoptes/POCS,panoptes/environmental-analysis-system,AstroHuntsman/POCS,AstroHuntsman/POCS,panoptes/POCS,panoptes/PEAS | peas/PID.py | peas/PID.py | from datetime import datetime
class PID:
'''
Pseudocode from Wikipedia:
previous_error = 0
integral = 0
start:
error = setpoint - measured_value
integral = integral + error*dt
derivative = (error - previous_error)/dt
output = Kp*error + Ki*integral + Kd*derivative
p... | mit | Python | |
29d0797540461f8c021ecad6e5d1e724dcc3e378 | Make a simple infinite while loop to run tests. | orbitfold/tardis,kaushik94/tardis,kaushik94/tardis,orbitfold/tardis,orbitfold/tardis,orbitfold/tardis,kaushik94/tardis,kaushik94/tardis | tardis/tests/tests_slow/runner.py | tardis/tests/tests_slow/runner.py | import time
import subprocess
if __name__ == "__main__":
while True:
subprocess.call([
"python", "setup.py", "test", "--test-path=tardis/tests/test_util.py",
])
time.sleep(20)
| bsd-3-clause | Python | |
04cebfba4c7ee5bf4b05bab811a944724224e3c3 | add 0000 file | Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2 | Drake-Z/0000/0000.py | Drake-Z/0000/0000.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果'
__author__ = 'Drake-Z'
from PIL import Image, ImageDraw, ImageFont
def add_num(filname, text = '4', fillcolor = (255, 0, 0)):
img = Image.open(filname)
width, height = img.size
myfont = Image... | mit | Python | |
a11ac7235e448aeed145cc7b98e43180e1428155 | Create __openerp__.py | OdooCommunityWidgets/website_navigation_megamenu | __openerp__.py | __openerp__.py | {
'name': 'Website MegaMenu [Bootstrap]',
'description': 'This module will implement MegaMenu functionality to improve on the default built-in Odoo menu for use with both the E-commerce and CMS modules.',
'category': 'Website',
'version': '1.0',
'author': 'Luke Branch',
'website': 'https://githu... | mit | Python | |
ec82be36659443c66d72f6cbd09055e572628cec | Create storj_login.py | lakewik/storj-gui-client | UI/qt_interfaces/design/storj_login.py | UI/qt_interfaces/design/storj_login.py | <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Login</class>
<widget class="QDialog" name="Login">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>428</height>
</rect>
</property>
<property name="windowTitle">
<string>Login to your Storj ... | mit | Python | |
9013f072a8b82ab65ad2c599fe331f7835ebee47 | Test users app URL patterns | hackebrot/cookiecutter-django,topwebmaster/cookiecutter-django,trungdong/cookiecutter-django,thisjustin/cookiecutter-django,luzfcb/cookiecutter-django,webyneter/cookiecutter-django,aleprovencio/cookiecutter-django,hackebrot/cookiecutter-django,hairychris/cookiecutter-django,gappsexperts/cookiecutter-django,asyncee/cook... | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py | from django.core.urlresolvers import reverse, resolve
from test_plus.test import TestCase
class TestUserURLs(TestCase):
"""Test URL patterns for users app."""
def setUp(self):
self.user = self.make_user()
def test_list_reverse(self):
"""users:list should reverse to /users/."""
s... | bsd-3-clause | Python | |
9a0806560ee3cc5d6baa2c17c7b8c9bc0dfbffca | add script to identify and count all the unique words in our titles | paregorios/awol-utils | ParseAndCountTitleWords.py | ParseAndCountTitleWords.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from collections import Counter
import glob
import logging as l
import os
import re
import sys
import traceback
import xml.etree.ElementTree as xmlParser
import codecs
SCRIPT_DESC = 'parse and count all unique words in AWOL blog titles'
DEFA... | bsd-3-clause | Python | |
c960f88cc1f8c15bf20a426d8e1e5f2b34799a13 | Create calc.py | WebShark025/TheZigZagProject,WebShark025/TheZigZagProject | plugins/calc.py | plugins/calc.py | @bot.message_handler(commands=['calc'])
def clac(m):
userid = m.from_user.id
banlist = redisserver.sismember('zigzag_banlist', '{}'.format(userid))
if banlist:
return
if len(m.text.split()) < 2:
bot.reply_to(m, "How can i calculate null?")
return
text = m.text.replace("/calc ","")
res = urllib.u... | mit | Python | |
96e1b85370f363c9ddda01c6052a94d6a78e2528 | Add VoltageTrace class in traces module | bryanwweber/UConnRCMPy | uconnrcmpy/traces.py | uconnrcmpy/traces.py | """All of the kinds of traces in UConnRCMPy"""
# System imports
# Third-party imports
import numpy as np
from scipy import signal as sig
# Local imports
class VoltageTrace(object):
"""Class for the voltage trace of an experiment"""
def __init__(self, file_path):
self.signal = np.genfromtxt(str(sel... | bsd-3-clause | Python | |
0b5dfb1c421998884afd59a37da3c8eaef389471 | Create makedict.py | oguzdag/oguzdag.github.io,oguzdag/oguzdag.github.io | projects/ansible/makedict.py | projects/ansible/makedict.py | from collections import defaultdict
class FilterModule(object):
def filters(self):
return {
'createmylist': self.createlistfunction
}
def createlistfunction(self, instancelist, clustervars, hostvars_tmp,playhost_tmp, startindex, endindex):
retval = []
clu... | mit | Python | |
d9f1b68ab9e3090289e2720937c051eb020dcc7c | Add new simulation. | ssh0/growing-string,ssh0/growing-string | triangular_lattice/correlation.py | triangular_lattice/correlation.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by Shotaro Fujimoto
# 2016-10-07
"""頂点間距離とベクトルの向きの相関
"""
from growing_string import Main
import matplotlib.pyplot as plt
import numpy as np
import random
from tqdm import tqdm
import time
def choose_indexes(_list, num, L):
"""Choose the index pairs whose w... | mit | Python | |
9d48ac6d4d9f48d7b51e67bfe351c20ba0d259c7 | add class to show all item_req, inherits from ItemsListWidget | develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms | trunk/editor/itemreqlistwidget.py | trunk/editor/itemreqlistwidget.py | #!/usr/bin/env python
from itemslistwidget import ItemsListWidget
class ItemReqListWidget(ItemsListWidget):
"""
classe utilizzata per la visualizzazione degli item_req
"""
def changeSelection(self, row, column):
selection = self.table.selectedRanges()
for sel in selection:
... | mit | Python | |
4c2125a440d06963aa5ea52d805bd021efcafb17 | Add : dash class to be the interface between the Flask views and the localization/parsing APIs. | nocternology/fail2dash,nocternology/fail2dash | core/dash.py | core/dash.py | from parser import Parser
from geoloc import Geoloc
class Dasher(object):
"""
Dasher class definition.
Simply the middleware between the raw datalog and the view functions.
Takes the raw lists of usefull info and does all the counting and preparing
for view by Flask.
"""
def __init__(sel... | mit | Python | |
8b0b42dcf0402fff4dee1b7a452977e25776a514 | Create Search_for_a_range.py | UmassJin/Leetcode | Array/Search_for_a_range.py | Array/Search_for_a_range.py | Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in the array, return [-1, -1].
For example,
Given [5, 7, 7, 8, 8, 10] and target value 8,
return [3, 4].
class Solution:
... | mit | Python | |
ff7755dbf7e5eee1dfaee60eb061479cca823cff | Create portscan.py | 7base/portscan | portscan.py | portscan.py | #!/usr/bin/python
import os
import sys
import socket
import string
import multiprocessing
from multiprocessing import Lock
def PORTscanner(IP, PORT, proc, lock):
openPorts = []
socket.setdefaulttimeout(2)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex((IP, PORT)... | apache-2.0 | Python | |
18facb30efeffb88e3b96d1d899f249bfd00f776 | Create problem4.py | ryanseys/project-euler,ryanseys/project-euler | problem4.py | problem4.py | # Pretty brute force-ish way of attacking this problem.
# Just wanted to keep it simple stupid, plus python can handle it ;)
# Answer: 906609
def problem4():
results = []
for i in reversed(range(999)):
for j in reversed(range(999)):
result = str(i*j)
if result == result[::-1]:
results.append... | mit | Python | |
e7685951e1d271b07df0e4a0681a2404806f4028 | Add (simple) test cases for Stock API | SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,inventree/InvenTree | InvenTree/stock/test_api.py | InvenTree/stock/test_api.py | from rest_framework.test import APITestCase
from rest_framework import status
from django.urls import reverse
from django.contrib.auth import get_user_model
from .models import StockLocation, StockItem
class StockLocationTest(APITestCase):
"""
Series of API tests for the StockLocation API
"""
list_u... | mit | Python | |
a676dfce887129c196d94bb3289c7bab8081368b | Remove get_internal_type and let the parent class handle it. | apokinsocha/django-push-notifications,rmoorman/django-push-notifications,azevakin/django-push-notifications,leonmu/django-push-notifications,dilvane/django-push-notifications,Tictrac/django-push-notifications,Ubiwhere/django-push-notifications,nnseva/django-push-notifications,CustomerSupport/django-push-notifications,g... | push_notifications/fields.py | push_notifications/fields.py | import re
import struct
from django import forms
from django.core.validators import RegexValidator
from django.db import models, connection
from django.utils.six import with_metaclass
from django.utils.translation import ugettext_lazy as _
__all__ = ["HexadecimalField", "HexIntegerField"]
hex_re = re.compile(r"^0x[0... | import re
import struct
from django import forms
from django.core.validators import RegexValidator
from django.db import models, connection
from django.utils.six import with_metaclass
from django.utils.translation import ugettext_lazy as _
__all__ = ["HexadecimalField", "HexIntegerField"]
hex_re = re.compile(r"^0x[0... | mit | Python |
4c5f51e49ed5bfa12e0c784457c46f8d0e1cb041 | Update regression test | recognai/spaCy,explosion/spaCy,oroszgy/spaCy.hu,honnibal/spaCy,recognai/spaCy,explosion/spaCy,oroszgy/spaCy.hu,honnibal/spaCy,raphael0202/spaCy,recognai/spaCy,aikramer2/spaCy,spacy-io/spaCy,spacy-io/spaCy,Gregory-Howard/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,Gregory-Howard/spaCy,aikramer2/spaCy,recognai/sp... | spacy/tests/regression/test_issue636.py | spacy/tests/regression/test_issue636.py | # coding: utf8
from __future__ import unicode_literals
from ...tokens.doc import Doc
import pytest
@pytest.mark.xfail
@pytest.mark.models
@pytest.mark.parametrize('text', ["I cant do this."])
def test_issue636(EN, text):
"""Test that to_bytes and from_bytes don't change the token lemma."""
doc1 = EN(text)
... | mit | Python | |
06877818a354face257852bfc03eef8d70cd0b0a | add VIN query example | commaai/panda,commaai/panda,commaai/panda,commaai/panda | examples/query_vin.py | examples/query_vin.py | #!/usr/bin/env python
def msg(x):
print "S:",x.encode("hex")
if len(x) <= 7:
ret = chr(len(x)) + x
else:
assert False
return ret.ljust(8, "\x00")
def isotp_send(panda, x, addr, bus=0):
if len(x) <= 7:
panda.can_send(addr, msg(x), bus)
else:
ss = chr(0x10 + (len(x)>>8)) + chr(len(x)&0xFF) + ... | mit | Python | |
5c142d7e7a311013dd940a6d6900b5d9984dc0fe | Create dynamic image & draw some text on it | symisc/pixlab,symisc/pixlab,symisc/pixlab | python/dynamic_image_meme.py | python/dynamic_image_meme.py | import requests
import json
# Dynamically create a 300x300 PNG image with a yellow background and draw some text on the center of it later.
# Refer to https://pixlab.io/#/cmd?id=newimage && https://pixlab.io/#/cmd?id=drawtext for additional information.
req = requests.get('https://api.pixlab.io/newimage',params={
'k... | bsd-2-clause | Python | |
88877163201ce32d28633b833e1ec17cd3429650 | Add script for cleaning up old SMS/MMS text messages | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | python/misc/clean-sms-mms.py | python/misc/clean-sms-mms.py | #!/usr/bin/env python3
''' Deletes old messages from a backup file created by Titanium Backup Pro
'''
import datetime
import lxml.etree
import shutil
import sys
MAXIMUM_MESSAGE_AGE_IN_DAYS = 365
if len(sys.argv) < 2:
sys.exit('USAGE: %s /path/to/com.keramidas.virtual.XML_MESSAGES-XXXXXXXX-XXXXXX.xml' % (sys.arg... | mit | Python | |
7977b18aa4028e83515076bacb1260b61f0a5192 | add collector | yfsuse/Necromancer | yeahmobi/collector.py | yeahmobi/collector.py | #! /usr/bin/env python
import time
import thread
import os
import urllib2
import urllib
import time
import sys
from random import choice
from string import letters,digits
count = 0
def mutiChoice(maxCount):
returnStr = ''
selectLetters = letters + digits
for i in range(maxCount):
returnStr += ch... | apache-2.0 | Python | |
c8ec6825e8e5cbf465b06f426324d481249c61d6 | Create octree.py | gameplex/game | pysrc/octree.py | pysrc/octree.py | class Address(object):
def __init__(self, x, y, z, depth):
self.x = x
self.y = y
self.z = z
self.depth = depth
def get_address_at_depth(depth):
mask = 1 << depth
x_bit = (mask & self.x) >> depth
y_bit = (mask & self.y) >> depth
z_bit = (ma... | agpl-3.0 | Python | |
ba907a0c12c5bf90fa796d36fe18218df12281ae | Add GDB pretty-printer for short_vector<T,N> | devinamatthews/marray,devinamatthews/marray,devinamatthews/marray | printers.py | printers.py | import gdb
import re
class ShortVectorPrinter:
def __init__(self, val):
self.val = val
def to_string(self):
size = int(self.val['_size'])
N = int(self.val.type.template_argument(1))
cap = N if size <= N else int(self.val['_capacity'])
return 'MArray::short_vector<%d> o... | bsd-3-clause | Python | |
abee38d119cf49388081d01dc2484b58775333a8 | fix image URLs | danvk/oldnyc,luster/oldnyc,luster/oldnyc,danvk/oldnyc,danvk/oldnyc,nypl-spacetime/oldnyc,nypl-spacetime/oldnyc,luster/oldnyc,nypl-spacetime/oldnyc,danvk/oldnyc,luster/oldnyc,nypl-spacetime/oldnyc,luster/oldnyc,nypl-spacetime/oldnyc | record_fixer.py | record_fixer.py | #!/usr/bin/python
# This fixes some of the image URLs in records.pickle.
import record
import re
import cPickle
rs = record.AllRecords()
for idx, r in enumerate(rs):
url = r.photo_url
# Some images have thumbnails but are missing the full photo URL.
# Convert
# http://webbie1.sfpl.org/multimedia/thumbnails... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.