commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
426f90ba500aa5d213a8b130e1841806e2dae388
solver/operators.py
solver/operators.py
import random import bisect def select(population): """Roulette wheel selection. Each individual is selected to reproduce, with probability directly proportional to its fitness score. :params population: Collection of the individuals for selecting. Usage:: >>> from operators import sele...
Implement roulette wheel selection algorithm
Implement roulette wheel selection algorithm
Python
mit
nemanja-m/gaps,nemanja-m/genetic-jigsaw-solver
--- +++ @@ -0,0 +1,28 @@ +import random +import bisect + +def select(population): + """Roulette wheel selection. + + Each individual is selected to reproduce, with probability directly + proportional to its fitness score. + + :params population: Collection of the individuals for selecting. + + Usage:: ...
31fe72931d29d81088f23c7609aa612d4735814b
python3-py/examples/new_features.py
python3-py/examples/new_features.py
def ls(self, msg, match): """ A sample function to test the parsing of ** resolution """ langs = list(map(lambda x: x.lower(), match.group(1).split())) bears = client.list.bears.get().json() bears = [{**{'name': bear}, **content} for bear, content in bears.items()] # Asyncio examp...
Add new sample files for Python3-py grammar
Add new sample files for Python3-py grammar
Python
mit
antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4
--- +++ @@ -0,0 +1,20 @@ +def ls(self, msg, match): + """ + A sample function to test the parsing of ** resolution + """ + langs = list(map(lambda x: x.lower(), match.group(1).split())) + + bears = client.list.bears.get().json() + bears = [{**{'name': bear}, **content} + for bear, conten...
fac97130396057802f1ebf21928667a971395ba9
examples/ex_tabler.py
examples/ex_tabler.py
from tabler import Tabler table = """<table> <thead> <tr> <th>Number</th> <th>First Name</th> <th>Last Name</th> <th>Phone Number</th> </tr> <tr> <td>1</td> <td>Bob</td> <td>Evans</td> <td>(847) 332-0461</td> </tr> <tr> <td>2</td> <td>Mary</td> <td>Newell</td> ...
Add a basic example of the Tabler API.
Add a basic example of the Tabler API.
Python
bsd-3-clause
bschmeck/tabler
--- +++ @@ -0,0 +1,30 @@ +from tabler import Tabler + +table = """<table> +<thead> + <tr> + <th>Number</th> + <th>First Name</th> + <th>Last Name</th> + <th>Phone Number</th> + </tr> + <tr> + <td>1</td> + <td>Bob</td> + <td>Evans</td> + <td>(847) 332-0461</td> + </tr> + <tr> + <td>2</t...
e279f8a046d2d9b985df2b01abe23dbe154da188
cinspect/tests/test_version.py
cinspect/tests/test_version.py
from __future__ import absolute_import, print_function # Standard library import unittest # Local library from cinspect.index.serialize import _get_most_similar class TestVersions(unittest.TestCase): def test_most_similar(self): # Given names = ['index-2.7.3.json', 'index-3.4.json'] ver...
Add a simple test for version finder.
Add a simple test for version finder.
Python
bsd-3-clause
punchagan/cinspect,punchagan/cinspect
--- +++ @@ -0,0 +1,21 @@ +from __future__ import absolute_import, print_function + +# Standard library +import unittest + +# Local library +from cinspect.index.serialize import _get_most_similar + + +class TestVersions(unittest.TestCase): + + def test_most_similar(self): + # Given + names = ['index-2...
fcbfaded67747984899dbbabb2cdcdefe00002df
examples/download1.py
examples/download1.py
import subprocess from simpleflow.download import with_binaries @with_binaries({ "how-is-simpleflow": "s3://botify-labs-simpleflow/binaries/latest/how_is_simpleflow", }) def a_task(): print "command: which how-is-simpleflow" print subprocess.check_output(["which", "how-is-simpleflow"]) print "comman...
Add example script for 'simpleflow.download.with_binaries' decorator
Add example script for 'simpleflow.download.with_binaries' decorator
Python
mit
botify-labs/simpleflow,botify-labs/simpleflow
--- +++ @@ -0,0 +1,17 @@ +import subprocess + +from simpleflow.download import with_binaries + + +@with_binaries({ + "how-is-simpleflow": "s3://botify-labs-simpleflow/binaries/latest/how_is_simpleflow", +}) +def a_task(): + print "command: which how-is-simpleflow" + print subprocess.check_output(["which", "h...
639143e3145682d776251f39f0a791f0c77e5169
apps/domain/tests/test_routes/test_association_requests.py
apps/domain/tests/test_routes/test_association_requests.py
def test_send_association_request(client): result = client.post("/association-requests/request", data={"id": "54623156", "address": "159.15.223.162"}) assert result.status_code == 200 assert result.get_json() == {"msg": "Association request sent!"} def test_receive_association_request(client): result ...
ADD Domain association_requests unit tests
ADD Domain association_requests unit tests
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
--- +++ @@ -0,0 +1,35 @@ + +def test_send_association_request(client): + result = client.post("/association-requests/request", data={"id": "54623156", "address": "159.15.223.162"}) + assert result.status_code == 200 + assert result.get_json() == {"msg": "Association request sent!"} + +def test_receive_associ...
1d7d86ba12fd00d388b939206abf305a6db569db
reid/train_siamese.py
reid/train_siamese.py
from __future__ import print_function import time from torch.autograd import Variable from .evaluation import accuracy from .utils.meters import AverageMeter class Trainer(object): def __init__(self, model, criterion, args): super(Trainer, self).__init__() self.model = model self.criteri...
Add trainer for siamese models
Add trainer for siamese models
Python
mit
Flowerfan524/TriClustering,Flowerfan524/TriClustering,zydou/open-reid,Cysu/open-reid
--- +++ @@ -0,0 +1,60 @@ +from __future__ import print_function +import time + +from torch.autograd import Variable + +from .evaluation import accuracy +from .utils.meters import AverageMeter + + +class Trainer(object): + def __init__(self, model, criterion, args): + super(Trainer, self).__init__() + ...
528afdc0f00b958f6920bd6e66c3bac841b3a8b8
server/kcaa/kcsapi/mission_test.py
server/kcaa/kcsapi/mission_test.py
#!/usr/bin/env python import pytest import mission class TestMissionList(object): def pytest_funcarg__mission_list(self): mission_list = mission.MissionList() mission_list.missions.extend([ mission.Mission( id=1, name=u'Mission1', mapa...
Add a test for mission.
Add a test for mission.
Python
apache-2.0
kcaa/kcaa,kcaa/kcaa,kcaa/kcaa,kcaa/kcaa
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +import pytest + +import mission + + +class TestMissionList(object): + + def pytest_funcarg__mission_list(self): + mission_list = mission.MissionList() + mission_list.missions.extend([ + mission.Mission( + id=1, + ...
38e294e7d8e8053ac604fdbcdcaeed59fecae1e9
tests/test_ewf.py
tests/test_ewf.py
from os import path from digestive.ewf import EWFSource, format_supported, list_ewf_files here = path.dirname(path.abspath(__file__)) def test_format_supported(): supported = ['file.S01', 'file.E01', 'file.e01', 'file.L01', 'file.Ex01', 'file.Lx01', 'file.tar.E01'] not_supported = ['file.dd', 'file.raw', '...
Test libewf-less calls in ewf module
Test libewf-less calls in ewf module
Python
isc
akaIDIOT/Digestive
--- +++ @@ -0,0 +1,30 @@ +from os import path + +from digestive.ewf import EWFSource, format_supported, list_ewf_files + + +here = path.dirname(path.abspath(__file__)) + + +def test_format_supported(): + supported = ['file.S01', 'file.E01', 'file.e01', 'file.L01', 'file.Ex01', 'file.Lx01', 'file.tar.E01'] + not...
fbc375a51aca560554f3dd28fa212d6d877449f2
source/tests/core/test_observer.py
source/tests/core/test_observer.py
from copy import copy from pytest import fixture from vistas.core.observers.interface import * @fixture(scope='session') def observer(): class TestObserver(Observer): def __init__(self): self.x = 5 def update(self, observable): self.x **= 2 obs = TestObserver() yi...
Add tests for observers and observable.
Add tests for observers and observable.
Python
bsd-3-clause
VISTAS-IVES/pyvistas
--- +++ @@ -0,0 +1,52 @@ +from copy import copy +from pytest import fixture + +from vistas.core.observers.interface import * + + +@fixture(scope='session') +def observer(): + class TestObserver(Observer): + def __init__(self): + self.x = 5 + + def update(self, observable): + sel...
3c5116f3a26fb93ab85fd973462a582a0fa5d877
bin/validate-presets.py
bin/validate-presets.py
#!/usr/bin/python import json import sys def validate_presets(presets_file): with open(presets_file) as jsonfile: presets_dict = json.load(jsonfile) for handler in presets_dict.iterkeys(): for entry in presets_dict.get(handler).get("presets"): value = entry.get("value") ...
Add script to validate web/db/handlerpresets.json file
Add script to validate web/db/handlerpresets.json file Simple validation for `web/db/handlerpresets.json` file. It prints error if handler's name is not same as beginning of value's string. Catches problems like this in handlerpresets.json: ```json "slack:": { "presets": [ { "description": "O...
Python
mit
nkapu/handlers,ouspg/urlhandlers,ouspg/urlhandlers,nkapu/handlers,nkapu/handlers,nkapu/handlers,ouspg/urlhandlers,ouspg/urlhandlers
--- +++ @@ -0,0 +1,25 @@ +#!/usr/bin/python + +import json +import sys + + +def validate_presets(presets_file): + with open(presets_file) as jsonfile: + presets_dict = json.load(jsonfile) + + for handler in presets_dict.iterkeys(): + for entry in presets_dict.get(handler).get("presets"): + ...
24b6126871a5378faa2e8f9848c279999e50cb96
ooo.py
ooo.py
#!/usr/bin/python import os import sys import re from collections import defaultdict COMIC_RE = re.compile(r'^\d+ +([^#]+)#(\d+)') def lines(todofile): with open(todofile) as todolines: for line in todolines: title_match = COMIC_RE.match(line) if title_match: # (title, issue) yield ...
Check issue numbers to find out of order listings
Check issue numbers to find out of order listings
Python
mit
xchewtoyx/comicmgt,xchewtoyx/comicmgt
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/python + +import os +import sys +import re +from collections import defaultdict + +COMIC_RE = re.compile(r'^\d+ +([^#]+)#(\d+)') + +def lines(todofile): + with open(todofile) as todolines: + for line in todolines: + title_match = COMIC_RE.match(line) + if title_match...
94d7a3b01b7360001817ef3ed3ad2003f0722b14
tests/script_parser/test_parsing_complex.py
tests/script_parser/test_parsing_complex.py
from script_parser import parser import os def test_environ_init(): """ Set up variables in environment and check parser uses them to init properly. """ os.environ['client_id'] = 'x' os.environ['client_secret'] = 'y' os.environ['refresh_token'] = 'z' p = parser.Parser(['chrome.init ${env.client_...
Add complex parse scenario - environment variables and init
Add complex parse scenario - environment variables and init
Python
mit
melkamar/webstore-manager,melkamar/webstore-manager
--- +++ @@ -0,0 +1,17 @@ +from script_parser import parser +import os + + +def test_environ_init(): + """ Set up variables in environment and check parser uses them to init properly. """ + + os.environ['client_id'] = 'x' + os.environ['client_secret'] = 'y' + os.environ['refresh_token'] = 'z' + + p = pa...
d9720f1fcc3013324c9ea58620df9c458a2e314e
test/test_awc.py
test/test_awc.py
import pytest import FIAT import finat import numpy as np from gem.interpreter import evaluate from fiat_mapping import MyMapping def test_morley(): ref_cell = FIAT.ufc_simplex(2) ref_element = finat.ArnoldWinther(ref_cell, 3) ref_pts = finat.point_set.PointSet(ref_cell.make_points(2, 0, 3)) phys_cel...
Add (broken) AWc test for debugging purposes
Add (broken) AWc test for debugging purposes
Python
mit
FInAT/FInAT
--- +++ @@ -0,0 +1,27 @@ +import pytest +import FIAT +import finat +import numpy as np +from gem.interpreter import evaluate +from fiat_mapping import MyMapping + + +def test_morley(): + ref_cell = FIAT.ufc_simplex(2) + ref_element = finat.ArnoldWinther(ref_cell, 3) + ref_pts = finat.point_set.PointSet(ref_c...
18c93f4c70a2247bcce8a853c30038097cb9f7b2
cms/apps/pages/tests/test_admin_destructive.py
cms/apps/pages/tests/test_admin_destructive.py
from django.conf import settings from django.contrib import admin from django.test import TestCase from ..models import Country, CountryGroup, Page import sys class TestArticleAdminBase(TestCase): def test_article_admin(self): NEW_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES + ( 'cms.mi...
Add test for optional page admin registrations for Country and CountryGroup.
Add test for optional page admin registrations for Country and CountryGroup.
Python
bsd-3-clause
jamesfoley/cms,jamesfoley/cms,danielsamuels/cms,lewiscollard/cms,jamesfoley/cms,dan-gamble/cms,lewiscollard/cms,danielsamuels/cms,danielsamuels/cms,lewiscollard/cms,dan-gamble/cms,jamesfoley/cms,dan-gamble/cms
--- +++ @@ -0,0 +1,32 @@ +from django.conf import settings +from django.contrib import admin +from django.test import TestCase + +from ..models import Country, CountryGroup, Page + +import sys + + +class TestArticleAdminBase(TestCase): + + def test_article_admin(self): + NEW_MIDDLEWARE_CLASSES = settings.MI...
d34ad4b0b969dd6c10fc7c1646f934016ba8ddd7
tools/distrib/c-ish/check_documentation.py
tools/distrib/c-ish/check_documentation.py
#!/usr/bin/env python2.7 # Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this li...
Add a script to list undocumented files and directories
Add a script to list undocumented files and directories
Python
apache-2.0
makdharma/grpc,yugui/grpc,simonkuang/grpc,dklempner/grpc,matt-kwong/grpc,apolcyn/grpc,kumaralokgithub/grpc,geffzhang/grpc,ctiller/grpc,thinkerou/grpc,chrisdunelm/grpc,ejona86/grpc,donnadionne/grpc,yugui/grpc,nicolasnoble/grpc,dgquintas/grpc,adelez/grpc,PeterFaiman/ruby-grpc-minimal,kpayson64/grpc,grani/grpc,makdharma/g...
--- +++ @@ -0,0 +1,78 @@ +#!/usr/bin/env python2.7 + +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain ...
b363b20440e564b2909736c64cb543cd632b4ae4
custom/covid/management/commands/fetch_form_case_counts.py
custom/covid/management/commands/fetch_form_case_counts.py
import itertools from datetime import date, datetime, timedelta from django.core.management.base import BaseCommand from corehq.apps.enterprise.models import EnterprisePermissions from corehq.apps.es import CaseES, FormES class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument(...
Print daily form submission counts
Print daily form submission counts
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,63 @@ +import itertools +from datetime import date, datetime, timedelta + +from django.core.management.base import BaseCommand + +from corehq.apps.enterprise.models import EnterprisePermissions +from corehq.apps.es import CaseES, FormES + + +class Command(BaseCommand): + + def add_arguments(self...
d3e90e4dca1cce2f27ccf9c24c1bb944f9d708b9
test/test_message_directory.py
test/test_message_directory.py
""" Created on 18 May 2018. @author: Greg Corbett """ import shutil import tempfile import unittest from ssm.message_directory import MessageDirectory class TestMessageDirectory(unittest.TestCase): """Class used for testing the MessageDirectory class.""" def setUp(self): """Create a MessageDirecto...
Add a unit test file for MessageDirectory
Add a unit test file for MessageDirectory
Python
apache-2.0
tofu-rocketry/ssm,apel/ssm,tofu-rocketry/ssm,stfc/ssm,apel/ssm,stfc/ssm
--- +++ @@ -0,0 +1,100 @@ +""" +Created on 18 May 2018. + +@author: Greg Corbett +""" + +import shutil +import tempfile +import unittest + +from ssm.message_directory import MessageDirectory + + +class TestMessageDirectory(unittest.TestCase): + """Class used for testing the MessageDirectory class.""" + + def se...
7fd09bd791661ab0b12921dfd977591690d9c01a
accounts/tests/test_forms.py
accounts/tests/test_forms.py
"""accounts app unittests for views """ from django.test import TestCase from accounts.forms import LoginForm class LoginFormTest(TestCase): """Tests the form which validates the email used for login. """ def test_valid_email_accepted(self): form = LoginForm({'email': 'newvisitor@example.com'})...
Add form tests for LoginForm
Add form tests for LoginForm
Python
mit
randomic/aniauth-tdd,randomic/aniauth-tdd
--- +++ @@ -0,0 +1,19 @@ +"""accounts app unittests for views + +""" +from django.test import TestCase + +from accounts.forms import LoginForm + + +class LoginFormTest(TestCase): + """Tests the form which validates the email used for login. + + """ + def test_valid_email_accepted(self): + form = Login...
28a7077b7f05f52d0bff7a849f8b50f82f73dbdb
idx2md5.py
idx2md5.py
#! /usr/bin/python from __future__ import print_function import sys import photo.index idx = photo.index.Index(idxfile=sys.argv[1]) for i in idx: print("%s %s" % (i.md5, i.filename))
Add a script to convert an index to a md5 file.
Add a script to convert an index to a md5 file.
Python
apache-2.0
RKrahl/photo-tools
--- +++ @@ -0,0 +1,9 @@ +#! /usr/bin/python + +from __future__ import print_function +import sys +import photo.index + +idx = photo.index.Index(idxfile=sys.argv[1]) +for i in idx: + print("%s %s" % (i.md5, i.filename))
05e2b100512a9c9b06c5d7d2701867f155c5e3f0
senlin/tests/tempest/api/profiles/test_profile_validate.py
senlin/tests/tempest/api/profiles/test_profile_validate.py
# 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, software # distributed under t...
Add API tests for profile validation
Add API tests for profile validation Add positive API tests for profile validation, add missing tests. Change-Id: I3bed44af9b90e317a0d1d76b883182db9338d40d
Python
apache-2.0
openstack/senlin,openstack/senlin,stackforge/senlin,openstack/senlin,stackforge/senlin
--- +++ @@ -0,0 +1,39 @@ +# 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 writi...
861a5fcda82fefbe10c844fda4075688dc6baf8e
mzalendo/votematch/views.py
mzalendo/votematch/views.py
import models from django.shortcuts import render_to_response, get_object_or_404, redirect from django.template import RequestContext def quiz_detail (request, slug): quiz = get_object_or_404( models.Quiz, slug=slug ) return render_to_response( 'votematch/quiz_detail.html',...
import models from django.shortcuts import render_to_response, get_object_or_404, redirect from django.template import RequestContext def quiz_detail (request, slug): quiz = get_object_or_404( models.Quiz, slug=slug ) # If this is a POST then extract all the answers if reques...
Save submissions, and redirect user to the submission detail page after completing form.
Save submissions, and redirect user to the submission detail page after completing form.
Python
agpl-3.0
patricmutwiri/pombola,hzj123/56th,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,mysociety/pombola,ken-muturi/pombola,patricmutwiri/pombola,hzj123/56th,geoffkilpin/pombola,geoffkilpin/pombola,mysociety/pombola,patricmutwiri/pombola,patricmutwiri/pombola,ken-muturi/pombola,patricmutwiri/pombola,geoffkilpin/pombo...
--- +++ @@ -3,12 +3,39 @@ from django.shortcuts import render_to_response, get_object_or_404, redirect from django.template import RequestContext + def quiz_detail (request, slug): + quiz = get_object_or_404( models.Quiz, slug=slug ) + # If this is a POST then extract all ...
c4e6b2b68e6acd8f83091fc055897628b8df05bb
lowfat/migrations/0105_auto_20170615_1400.py
lowfat/migrations/0105_auto_20170615_1400.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-15 14:00 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lowfat', '0104_auto_20170607_1428'), ] operations = [ migrations.AddField( ...
Add migration for django-simple-history == 1.9.0
Add migration for django-simple-history == 1.9.0
Python
bsd-3-clause
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
--- +++ @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.2 on 2017-06-15 14:00 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('lowfat', '0104_auto_20170607_1428'), + ] + + ope...
22946180e9e5e660be14d453ddf5bb37564ddf33
build-tile-map.py
build-tile-map.py
#!/usr/bin/env python from osgeo import ogr from osgeo import osr from glob import glob import os driver = ogr.GetDriverByName("ESRI Shapefile") ds = driver.CreateDataSource("tile-map.shp") srs = osr.SpatialReference() srs.ImportFromEPSG(26915) layer = ds.CreateLayer("tiles", srs, ogr.wkbPolygon) field_name = ogr.F...
Add a script to build a map of all the tiles
Add a script to build a map of all the tiles
Python
mit
simonsonc/mn-glo-mosaic,simonsonc/mn-glo-mosaic,simonsonc/mn-glo-mosaic
--- +++ @@ -0,0 +1,46 @@ +#!/usr/bin/env python +from osgeo import ogr +from osgeo import osr +from glob import glob +import os + +driver = ogr.GetDriverByName("ESRI Shapefile") +ds = driver.CreateDataSource("tile-map.shp") + +srs = osr.SpatialReference() +srs.ImportFromEPSG(26915) + +layer = ds.CreateLayer("tiles", ...
c0b37b879b2e20ee71663e64be76ad11c1e1794c
async/3.7/basic/compsleep.py
async/3.7/basic/compsleep.py
#!/usr/bin/env python """https://docs.python.org/3.7/library/asyncio-task.html 変奏版 Features: - asyncio.gather() - asyncio.sleep() - asyncio.run() """ import asyncio import logging import time concurrent = 3 delay = 5 # PYTHONASYNCIODEBUG=1 logging.basicConfig(level=logging.DEBUG) async def async_pause(): awai...
Add a script that can be used to compare asyncio.sleep to time.sleep
Add a script that can be used to compare asyncio.sleep to time.sleep
Python
mit
showa-yojyo/bin,showa-yojyo/bin
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +"""https://docs.python.org/3.7/library/asyncio-task.html 変奏版 + +Features: +- asyncio.gather() +- asyncio.sleep() +- asyncio.run() +""" + +import asyncio +import logging +import time + +concurrent = 3 +delay = 5 + +# PYTHONASYNCIODEBUG=1 +logging.basicConfig(level=log...
ee1df360979ec24fd8233210372eedd3071cee87
tests/test_argspec.py
tests/test_argspec.py
"""Make sure that arguments of open/read/write don't diverge""" import pysoundfile as sf from inspect import getargspec open = getargspec(sf.open) init = getargspec(sf.SoundFile.__init__) read_function = getargspec(sf.read) read_method = getargspec(sf.SoundFile.read) write_function = getargspec(sf.write) def defau...
Add test file to check consistent use of default arguments
Add test file to check consistent use of default arguments
Python
bsd-3-clause
mgeier/PySoundFile
--- +++ @@ -0,0 +1,59 @@ +"""Make sure that arguments of open/read/write don't diverge""" + +import pysoundfile as sf +from inspect import getargspec + + +open = getargspec(sf.open) +init = getargspec(sf.SoundFile.__init__) +read_function = getargspec(sf.read) +read_method = getargspec(sf.SoundFile.read) +write_funct...
2b99781e67e1e2e0bb3863c08e81b3cf57a5e296
tests/test_bouncer.py
tests/test_bouncer.py
from rest_framework import status from rest_framework.test import APITestCase from django.contrib.auth import get_user_model from api_bouncer.models import Api User = get_user_model() class BouncerTests(APITestCase): def setUp(self): self.superuser = User.objects.create_superuser( 'john', ...
Add request bouncer test cases
Add request bouncer test cases
Python
apache-2.0
menecio/django-api-bouncer
--- +++ @@ -0,0 +1,42 @@ +from rest_framework import status +from rest_framework.test import APITestCase +from django.contrib.auth import get_user_model + +from api_bouncer.models import Api + +User = get_user_model() + + +class BouncerTests(APITestCase): + def setUp(self): + self.superuser = User.objects.c...
ab1bc996d477c84187df381ec77e7aaab299783b
tests/test_utils.py
tests/test_utils.py
from mws.mws import calc_md5 def test_calc_md5(): assert calc_md5(b'mws') == b'mA5nPbh1CSx9M3dbkr3Cyg=='
Add test for calc_md5() function
Add test for calc_md5() function
Python
unlicense
bpipat/mws,jameshiew/mws,Bobspadger/python-amazon-mws,GriceTurrble/python-amazon-mws
--- +++ @@ -0,0 +1,5 @@ +from mws.mws import calc_md5 + + +def test_calc_md5(): + assert calc_md5(b'mws') == b'mA5nPbh1CSx9M3dbkr3Cyg=='
13b3320399e51bbbb4018ea5fb3ff6d63c8864c7
celexRunScript.py
celexRunScript.py
from celex import Celex ''' - Allows for a quick run of a desired size pulled from any evolution file. - Automatically loads the best chromosome from the evolution to test. - Useful for running large-scale tests of a chromosome that appears to be performing well. - For small tests to ensure system functionality, run th...
Add quick run script for celex fullscale tests
Add quick run script for celex fullscale tests
Python
mit
jacobkrantz/ProbSyllabifier
--- +++ @@ -0,0 +1,27 @@ +from celex import Celex +''' +- Allows for a quick run of a desired size pulled from any evolution file. +- Automatically loads the best chromosome from the evolution to test. +- Useful for running large-scale tests of a chromosome that appears +to be performing well. +- For small tests to e...
25a4c9ba978aef7f648904c654fcc044f429acd4
custom/openclinica/models.py
custom/openclinica/models.py
from collections import defaultdict from corehq.apps.users.models import CouchUser from custom.openclinica.const import AUDIT_LOGS from custom.openclinica.utils import ( OpenClinicaIntegrationError, is_item_group_repeating, is_study_event_repeating, get_item_measurement_unit, get_question_item, ...
Add Subjects model, methods for report and export
Add Subjects model, methods for report and export
Python
bsd-3-clause
qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,79 @@ +from collections import defaultdict +from corehq.apps.users.models import CouchUser +from custom.openclinica.const import AUDIT_LOGS +from custom.openclinica.utils import ( + OpenClinicaIntegrationError, + is_item_group_repeating, + is_study_event_repeating, + get_item_measuremen...
9d2a2b0e1f066b2606e62ec019b56d4659ed86b1
pygraphc/clustering/ClusterEvaluation.py
pygraphc/clustering/ClusterEvaluation.py
from sklearn import metrics class ClusterEvaluation(object): @staticmethod def get_evaluated(evaluated_file): with open(evaluated_file, 'r') as ef: evaluations = ef.readlines() evaluation_labels = [evaluation.split(';')[0] for evaluation in evaluations] return evaluation_l...
Add cluster evaluation: adjusted rand index
Add cluster evaluation: adjusted rand index
Python
mit
studiawan/pygraphc
--- +++ @@ -0,0 +1,18 @@ +from sklearn import metrics + + +class ClusterEvaluation(object): + @staticmethod + def get_evaluated(evaluated_file): + with open(evaluated_file, 'r') as ef: + evaluations = ef.readlines() + + evaluation_labels = [evaluation.split(';')[0] for evaluation in eva...
f06e5a8c701f06d40597cd268a6739988c2fff56
corehq/apps/cleanup/tasks.py
corehq/apps/cleanup/tasks.py
import os from collections import defaultdict from django.conf import settings from django.core.management import call_command from celery.schedules import crontab from celery.task import periodic_task from datetime import datetime from corehq.apps.cleanup.management.commands.fix_xforms_with_undefined_xmlns import \...
Add functions for parsing log file
Add functions for parsing log file
Python
bsd-3-clause
dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,59 @@ +import os +from collections import defaultdict + +from django.conf import settings +from django.core.management import call_command + +from celery.schedules import crontab +from celery.task import periodic_task +from datetime import datetime + +from corehq.apps.cleanup.management.commands.fi...
095b9cc5f2e9a87220e6f40f88bf6ecd598ca681
vistrails/packages/componentSearch/init.py
vistrails/packages/componentSearch/init.py
#Copied imports from HTTP package init.py file from PyQt4 import QtGui from core.modules.vistrails_module import ModuleError from core.configuration import get_vistrails_persistent_configuration from gui.utils import show_warning import core.modules.vistrails_module import core.modules import core.modules.basic_modules...
Add abstract box for ComponentSearch so users can drag it into their workflows.
Add abstract box for ComponentSearch so users can drag it into their workflows.
Python
bsd-3-clause
CMUSV-VisTrails/WorkflowRecommendation,CMUSV-VisTrails/WorkflowRecommendation,CMUSV-VisTrails/WorkflowRecommendation
--- +++ @@ -0,0 +1,22 @@ +#Copied imports from HTTP package init.py file +from PyQt4 import QtGui +from core.modules.vistrails_module import ModuleError +from core.configuration import get_vistrails_persistent_configuration +from gui.utils import show_warning +import core.modules.vistrails_module +import core.modules...
c3a9d78ca3ffbad0e11192e896db8cd0c2758154
vote/migrations/0002_auto_20160315_0006.py
vote/migrations/0002_auto_20160315_0006.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('vote', '0001_initial'), ] operations = [ migrations.AlterField( model_name='multiquestion', name='gr...
UPDATE - add migration file
UPDATE - add migration file
Python
mit
mingkim/QuesCheetah,mingkim/QuesCheetah,mingkim/QuesCheetah,mingkim/QuesCheetah
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('vote', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_...
9a9ee99129cee92c93fbc9e2cc24b7b933d51aac
confirmation/migrations/0001_initial.py
confirmation/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0001_initial'), ] operations = [ migrations.CreateModel( name='Confirmation', fields...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0001_initial'), ] operations = [ migrations.CreateModel( name='...
Add on_delete in foreign keys.
confirmation: Add on_delete in foreign keys. on_delete will be a required arg for ForeignKey in Django 2.0. Set it to models.CASCADE on models and in existing migrations if you want to maintain the current default behavior. See https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.ForeignKey.on_de...
Python
apache-2.0
hackerkid/zulip,dhcrzf/zulip,Galexrt/zulip,showell/zulip,amanharitsh123/zulip,zulip/zulip,vabs22/zulip,vaidap/zulip,jackrzhang/zulip,jrowan/zulip,hackerkid/zulip,zulip/zulip,tommyip/zulip,kou/zulip,jackrzhang/zulip,brockwhittaker/zulip,brockwhittaker/zulip,tommyip/zulip,shubhamdhama/zulip,eeshangarg/zulip,shubhamdhama/...
--- +++ @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion class Migration(migrations.Migration): @@ -18,7 +19,7 @@ ('object_id', models.PositiveIntegerField()), ('date_sent', models.DateTimeFiel...
7ab0cc93703abf6716b353f38a009897ab154ce4
nova/tests/test_plugin_api_extensions.py
nova/tests/test_plugin_api_extensions.py
# Copyright 2011 OpenStack LLC. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
Add the plugin framework from common; use and test.
Add the plugin framework from common; use and test. For blueprint novaplugins. Change-Id: Id4a5ae3ebb91f941956e2f73ecfd9ea1d290a235
Python
apache-2.0
n0ano/ganttclient
--- +++ @@ -0,0 +1,90 @@ +# Copyright 2011 OpenStack LLC. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/L...
285236e1045915706b0cf2c6137273be7f9eb5d6
modules/module.py
modules/module.py
# module.py # Author: Sébastien Combéfis # Version: May 25, 2016 from abc import * class Module(metaclass=ABCMeta): '''Abstract class representing a generic module.''' def __init__(self, name): self.__name = name @property def name(self): return self.__name @abstractmetho...
Add generic abstract Module class
Modules: Add generic abstract Module class
Python
agpl-3.0
ECAM-Brussels/ECAMTV,ECAM-Brussels/ECAMTV,ECAM-Brussels/ECAMTV
--- +++ @@ -0,0 +1,34 @@ +# module.py +# Author: Sébastien Combéfis +# Version: May 25, 2016 + +from abc import * + +class Module(metaclass=ABCMeta): + '''Abstract class representing a generic module.''' + def __init__(self, name): + self.__name = name + + @property + def name(self): + r...
e110c968ece35e41c467aeb5fceb9274023e7e82
pyplaybulb/rainbow.py
pyplaybulb/rainbow.py
from pyplaybulb.playbulb import Playbulb EFFECT_FLASH = '00' EFFECT_PULSE = '01' EFFECT_RAINBOW = '02' EFFECT_RAINBOW_FADE = '03' class Rainbow(Playbulb): hexa_set_colour = '0x001b' hexa_effect = '0x0019' hexa_get_colour = '0x0019' def set_colour(self, colour): self.connection.char_write(self...
Create child class for Rainbow bulb
Create child class for Rainbow bulb
Python
mit
litobro/PyPlaybulb
--- +++ @@ -0,0 +1,20 @@ +from pyplaybulb.playbulb import Playbulb + +EFFECT_FLASH = '00' +EFFECT_PULSE = '01' +EFFECT_RAINBOW = '02' +EFFECT_RAINBOW_FADE = '03' + +class Rainbow(Playbulb): + hexa_set_colour = '0x001b' + hexa_effect = '0x0019' + hexa_get_colour = '0x0019' + + def set_colour(self, colour):...
e233352d5016c2b57ec4edbc4366ca4347bc1d98
demo/start_servers.py
demo/start_servers.py
""" start_servers.py <Purpose> A simple script to start the three cloud-side Uptane servers: the Director (including its per-vehicle repositories) the Image Repository the Timeserver To run the demo services in non-interactive mode, run: python start_servers.py To run the demo services in inter...
Create a single script to run the three demo services
DEMO: Create a single script to run the three demo services (image repo, director, and timeserver)
Python
mit
uptane/uptane,awwad/uptane,awwad/uptane,uptane/uptane
--- +++ @@ -0,0 +1,46 @@ +""" +start_servers.py + +<Purpose> + A simple script to start the three cloud-side Uptane servers: + the Director (including its per-vehicle repositories) + the Image Repository + the Timeserver + + To run the demo services in non-interactive mode, run: + python start_servers.p...
1058ed0847d151246299f73b325004fc04946fa0
Basics/challenge_2.py
Basics/challenge_2.py
#!/usr/bin/env python if __name__ == '__main__': s1 = 0x1c0111001f010100061a024b53535009181c s2 = 0x686974207468652062756c6c277320657965 print(hex(s1 ^ s2))
Set 1 - Challenge 2
Set 1 - Challenge 2
Python
apache-2.0
Scythe14/Crypto
--- +++ @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +if __name__ == '__main__': + s1 = 0x1c0111001f010100061a024b53535009181c + s2 = 0x686974207468652062756c6c277320657965 + + print(hex(s1 ^ s2))
37704a2e905342bf867225fb5a8a3fec0c55a9fd
Problems/stringDiff.py
Problems/stringDiff.py
#!/Applications/anaconda/envs/Python3/bin def main(): # Test suite tests = [ [None, None, None], # Should throw a TypeError ['abcd', 'abcde', 'e'], ['aaabbcdd', 'abdbacade', 'e'], ['abdbacade', 'aaabbcdd', 'e'] ] for item in tests: try: temp_result ...
Add strDiff problem and tests. Minor tweak to setup.py
Add strDiff problem and tests. Minor tweak to setup.py
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,47 @@ +#!/Applications/anaconda/envs/Python3/bin + + +def main(): + # Test suite + tests = [ + [None, None, None], # Should throw a TypeError + ['abcd', 'abcde', 'e'], + ['aaabbcdd', 'abdbacade', 'e'], + ['abdbacade', 'aaabbcdd', 'e'] + ] + + for item in test...
e120f5fac68e2daf7cdf6e9d7b17b1f63a330595
djangoappengine/db/expressions.py
djangoappengine/db/expressions.py
from django.db.models.sql.expressions import SQLEvaluator from django.db.models.expressions import ExpressionNode OPERATION_MAP = { ExpressionNode.ADD: lambda x, y: x + y, ExpressionNode.SUB: lambda x, y: x - y, ExpressionNode.MUL: lambda x, y: x * y, ExpressionNode.DIV: lambda x, y: x / y, Expres...
from django.db.models.sql.expressions import SQLEvaluator from django.db.models.expressions import ExpressionNode OPERATION_MAP = { ExpressionNode.ADD: lambda x, y: x + y, ExpressionNode.SUB: lambda x, y: x - y, ExpressionNode.MUL: lambda x, y: x * y, ExpressionNode.DIV: lambda x, y: x / y, Expres...
Fix ExpressionNode names that changed in django 1.5
Fix ExpressionNode names that changed in django 1.5
Python
bsd-3-clause
django-nonrel/djangoappengine,Implisit/djangoappengine,dwdraju/djangoappengine
--- +++ @@ -8,8 +8,8 @@ ExpressionNode.MUL: lambda x, y: x * y, ExpressionNode.DIV: lambda x, y: x / y, ExpressionNode.MOD: lambda x, y: x % y, - ExpressionNode.AND: lambda x, y: x & y, - ExpressionNode.OR: lambda x, y: x | y, + ExpressionNode.BITAND: lambda x, y: x & y, + ExpressionNode.BI...
31f16844dd98516b1f57e3913d0fdba3e5715aa8
logicaldelete/models.py
logicaldelete/models.py
import datetime from django.db import models from logicaldelete import managers class Model(models.Model): """ This base model provides date fields and functionality to enable logical delete functionality in derived models. """ date_created = models.DateTimeField(default=datetime.datetime....
import datetime from django.db import models from logicaldelete import managers class Model(models.Model): """ This base model provides date fields and functionality to enable logical delete functionality in derived models. """ date_created = models.DateTimeField(default=datetime.datetime.now) ...
Delete method now softdeletep's all FK related objects
Delete method now softdeletep's all FK related objects
Python
mit
pinax/pinax-models,angvp/django-logical-delete,Ubiwhere/pinax-models,angvp/django-logical-delete,naringas/pinax-models
--- +++ @@ -10,20 +10,40 @@ This base model provides date fields and functionality to enable logical delete functionality in derived models. """ - - date_created = models.DateTimeField(default=datetime.datetime.now) + + date_created = models.DateTimeField(default=datetime.datetime.now) ...
3dfc4bfbb71d1e97a6b8213f338df487fbae5fcc
topics/migrations/0016_auto_20151221_0923.py
topics/migrations/0016_auto_20151221_0923.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('topics', '0015_auto_20151218_1823'), ] operations = [ migrations.AlterField( model_...
Add auto migration for minor model changes
Add auto migration for minor model changes
Python
mit
andychase/codebook,andychase/codebook
--- +++ @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('topics', '0015_auto_20151218_1823'), + ] + + operations = [ + ...
2207351e805f11c39f843ca0e0eff261a7a5bde8
python/010_summation_of_primes/primes.py
python/010_summation_of_primes/primes.py
from math import sqrt from typing import Generator def prime_generator(limit: int) -> Generator[int, None, int]: if limit < 2: return else: yield 2 primes = [2] for x in range(3, limit + 1, 2): if any(map(lambda divisor: x % divisor == 0, primes[: int(sqrt(x))])): c...
Add half-naive solution to problem 10
Add half-naive solution to problem 10
Python
bsd-3-clause
gidj/euler,gidj/euler
--- +++ @@ -0,0 +1,22 @@ +from math import sqrt +from typing import Generator + + +def prime_generator(limit: int) -> Generator[int, None, int]: + if limit < 2: + return + else: + yield 2 + primes = [2] + for x in range(3, limit + 1, 2): + if any(map(lambda divisor: x % divisor == 0, ...
747ff2fbaf9e6216ba932f446418819723611174
euler/solutions/solution_12.py
euler/solutions/solution_12.py
"""Highly divisible triangular number The sequence of triangle numbers is generated by adding the natural numbers. The 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... Let us list the factors of the first seven triangle numbers: 1:...
Add solution for problem 12
Add solution for problem 12 Highly divisible triangular number
Python
mit
rlucioni/project-euler
--- +++ @@ -0,0 +1,85 @@ +"""Highly divisible triangular number + +The sequence of triangle numbers is generated by adding the natural numbers. + +The 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. + +The first ten terms would be: + +1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... + +Let us list the factors of...
65aee742ea0e95b200152f8a90d9ad5ee86b2512
scripts/locustfile.py
scripts/locustfile.py
from locust import HttpLocust, TaskSet, task import urllib from faker import Faker fake = Faker() class SPARQLQueryTasks(TaskSet): @task def query_simple(self): self.client.get("/sparql/?query=select+%2A+where+%7B+%3Fs+%3Fp+%3Fo+%7D+limit+0") @task def query_realistic(self): self.clie...
Add a Locust load testing script
Add a Locust load testing script This isn't quite doing everything I want but it's a nice way to check some performance characteristics
Python
apache-2.0
ec-geolink/d1lod,ec-geolink/d1lod,ec-geolink/d1lod,ec-geolink/d1lod
--- +++ @@ -0,0 +1,31 @@ +from locust import HttpLocust, TaskSet, task +import urllib +from faker import Faker + +fake = Faker() + +class SPARQLQueryTasks(TaskSet): + @task + def query_simple(self): + self.client.get("/sparql/?query=select+%2A+where+%7B+%3Fs+%3Fp+%3Fo+%7D+limit+0") + + @task + def ...
e84d811f13347da3625e3a30d200e836f6393e9d
scripts/obo_to_sql.py
scripts/obo_to_sql.py
# Note: based on - http://blog.adimian.com/2014/10/cte-and-closure-tables/ import sqlite3 conn = sqlite3.connect('test.db') cursor = conn.cursor() def create_tables(): ''' Creates the two tables used to store the ontology concepts and terms. - 'nodes' stores the .obo content. - 'closure' stor...
Store OBO data into a suitable queryable format
Store OBO data into a suitable queryable format Achieved using transitive closures, which allows a hierarchy structure (OBO ontology) to be stored in a SQL format.
Python
mit
jawrainey/healthchat,jawrainey/healthchat
--- +++ @@ -0,0 +1,67 @@ +# Note: based on - http://blog.adimian.com/2014/10/cte-and-closure-tables/ +import sqlite3 + +conn = sqlite3.connect('test.db') +cursor = conn.cursor() + + +def create_tables(): + ''' + Creates the two tables used to store the ontology concepts and terms. + - 'nodes' stores the ...
9b48cb18980ae2e55ce02a84576f65f0bd8a27bb
FacebookPlugins.py
FacebookPlugins.py
""" @note: enable X """ from trac.core import Component from trac.wiki.macros import WikiMacroBase class FacebookPlugins(Component): """ Support for Facebook plugins. """ revision = "$Rev$" url = "$URL$" class LikeButton(WikiMacroBase): """ The [http://developers.facebook.com/docs/...
Add wiki macro for the Like button.
Add wiki macro for the Like button.
Python
mit
thijstriemstra/trac-facebook-plugins
--- +++ @@ -0,0 +1,59 @@ +""" +@note: enable X +""" + +from trac.core import Component +from trac.wiki.macros import WikiMacroBase + + +class FacebookPlugins(Component): + """ + Support for Facebook plugins. + """ + + revision = "$Rev$" + url = "$URL$" + + +class LikeButton(WikiMacroBase): + """...
fc72ca537e6eaf5f4bf04ed4511ec1acdd9eae11
checks/check_deprecation_warning.py
checks/check_deprecation_warning.py
from __future__ import print_function, absolute_import, division import imgaug as ia class Dummy1(object): @ia.deprecated(alt_func="Foo") def __init__(self): pass class Dummy2(object): @ia.deprecated(alt_func="Foo", comment="Some example comment.") def __init__(self): pass class D...
Add check script to test 'deprecated' decorator
Add check script to test 'deprecated' decorator
Python
mit
aleju/imgaug,aleju/imgaug,aleju/ImageAugmenter
--- +++ @@ -0,0 +1,41 @@ +from __future__ import print_function, absolute_import, division + +import imgaug as ia + + +class Dummy1(object): + @ia.deprecated(alt_func="Foo") + def __init__(self): + pass + + +class Dummy2(object): + @ia.deprecated(alt_func="Foo", comment="Some example comment.") + d...
c97ab456f22dca6a69e3775cc1353dbf3957389a
homeassistant/components/light/limitlessled.py
homeassistant/components/light/limitlessled.py
""" homeassistant.components.light.limitlessled ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support for LimitlessLED bulbs, also known as... EasyBulb AppLight AppLamp MiLight LEDme dekolight iLight """ import random import logging from homeassistant.helpers.entity import ToggleEntity from homeassistant.const import STATE_O...
Add basic support for LimitlessLED
Add basic support for LimitlessLED
Python
apache-2.0
sfam/home-assistant,ErykB2000/home-assistant,open-homeautomation/home-assistant,Danielhiversen/home-assistant,toddeye/home-assistant,nugget/home-assistant,open-homeautomation/home-assistant,deisi/home-assistant,EricRho/home-assistant,tboyce021/home-assistant,theolind/home-assistant,mKeRix/home-assistant,Duoxilian/home-...
--- +++ @@ -0,0 +1,102 @@ +""" +homeassistant.components.light.limitlessled +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Support for LimitlessLED bulbs, also known as... + +EasyBulb +AppLight +AppLamp +MiLight +LEDme +dekolight +iLight + +""" +import random +import logging + +from homeassistant.helpers.entity import Toggl...
10318a11dded5e69c3d9c98325613700c9b3db63
lib/spack/spack/cmd/dependents.py
lib/spack/spack/cmd/dependents.py
############################################################################## # Copyright (c) 2013, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 ...
Fix for dependent package detection.
Fix for dependent package detection.
Python
lgpl-2.1
lgarren/spack,lgarren/spack,iulian787/spack,mfherbst/spack,skosukhin/spack,LLNL/spack,LLNL/spack,EmreAtes/spack,iulian787/spack,tmerrick1/spack,TheTimmy/spack,mfherbst/spack,mfherbst/spack,tmerrick1/spack,lgarren/spack,krafczyk/spack,iulian787/spack,krafczyk/spack,skosukhin/spack,matthiasdiener/spack,lgarren/spack,Emre...
--- +++ @@ -0,0 +1,46 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rig...
8d1016437e87794fb39b447b51427bae98a51bc2
classes/jsonip.py
classes/jsonip.py
from json import load from urllib2 import urlopen class JsonIp: def __init__(self): url = 'https://jsonip.com/' uri = urlopen(url) response = load(uri) self.ip = response["ip"] # self.ip = '1.1.1.1'
Add one public IP provider
Add one public IP provider
Python
mit
Saphyel/ipteller,Saphyel/ipteller
--- +++ @@ -0,0 +1,11 @@ +from json import load +from urllib2 import urlopen + +class JsonIp: + + def __init__(self): + url = 'https://jsonip.com/' + uri = urlopen(url) + response = load(uri) + self.ip = response["ip"] + # self.ip = '1.1.1.1'
ef1fa03d753f5d8a0b32831320a1b3e076ace363
moksha/apps/demo/MokshaJQPlotDemo/run_tests.py
moksha/apps/demo/MokshaJQPlotDemo/run_tests.py
#!/usr/bin/env python """ nose runner script. """ __requires__ = 'moksha' import pkg_resources import nose if __name__ == '__main__': nose.main()
Add a test runner for our jqplot demo too
Add a test runner for our jqplot demo too
Python
apache-2.0
ralphbean/moksha,mokshaproject/moksha,lmacken/moksha,mokshaproject/moksha,pombredanne/moksha,mokshaproject/moksha,pombredanne/moksha,ralphbean/moksha,lmacken/moksha,lmacken/moksha,ralphbean/moksha,pombredanne/moksha,pombredanne/moksha,mokshaproject/moksha
--- +++ @@ -0,0 +1,11 @@ +#!/usr/bin/env python +""" +nose runner script. +""" +__requires__ = 'moksha' + +import pkg_resources +import nose + +if __name__ == '__main__': + nose.main()
c8ec0689950a5fea0aff98afe54b172bd84e2ce9
examples/coregister.py
examples/coregister.py
"""Example using Tom's registration code from scipy. """ from os import path from glob import glob import scipy.ndimage._registration as reg # Data files basedir = '/Users/cburns/data/twaite' anatfile = path.join(basedir, 'ANAT1_V0001.img') funcdir = path.join(basedir, 'fMRIData') fileglob = path.join(funcdir, 'FUN...
Add example using Tom's registration code in scipy.
Add example using Tom's registration code in scipy.
Python
bsd-3-clause
yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD
--- +++ @@ -0,0 +1,23 @@ +"""Example using Tom's registration code from scipy. + +""" + +from os import path +from glob import glob + +import scipy.ndimage._registration as reg + +# Data files +basedir = '/Users/cburns/data/twaite' +anatfile = path.join(basedir, 'ANAT1_V0001.img') +funcdir = path.join(basedir, 'fMRID...
62b01c3c1614d5719cc69be951b2f6c660e40faa
pyldap/libldap/tools.py
pyldap/libldap/tools.py
def iterate_array(arr, f=None): i = 0 while True: if not arr[i]: break yield arr[i] if f is None else f(arr[i]) i += 1
Add generic function for iterating arrays.
Add generic function for iterating arrays.
Python
bsd-3-clause
matusvalo/python-easyldap
--- +++ @@ -0,0 +1,7 @@ +def iterate_array(arr, f=None): + i = 0 + while True: + if not arr[i]: + break + yield arr[i] if f is None else f(arr[i]) + i += 1
b9759f60c9f107c3d2c319f53ed2985ee58dc319
src/tests/test_mock_pose.py
src/tests/test_mock_pose.py
try: from unittest.mock import patch, MagicMock except ImportError: from mock import patch, MagicMock import pytest import rospy MockTf2 = MagicMock() modules = {"tf2_ros": MockTf2} patcher = patch.dict("sys.modules", modules) patcher.start() try: rospy.init_node("pytest", anonymous=True) except rospy....
Write test for mock_pose generator.
Write test for mock_pose generator.
Python
mit
masasin/spirit,masasin/spirit
--- +++ @@ -0,0 +1,42 @@ +try: + from unittest.mock import patch, MagicMock +except ImportError: + from mock import patch, MagicMock + +import pytest + +import rospy + +MockTf2 = MagicMock() +modules = {"tf2_ros": MockTf2} +patcher = patch.dict("sys.modules", modules) +patcher.start() + + +try: + rospy.init_...
b3dcbe95d766d902d22a0c4c171cbbe5ce207571
python/tests/stress_test.py
python/tests/stress_test.py
#!/usr/bin/env python import time import sys import os from random import randint # Hack to import from a parent dir # http://stackoverflow.com/a/11158224/401554 parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, parentdir) from octo import Octo octo = Octo('/dev/ttyACM0') oct...
Add test for longitivity-testing: both LED-s ON at the same time for extended periods of time
Add test for longitivity-testing: both LED-s ON at the same time for extended periods of time
Python
mit
anroots/teensy-moonica
--- +++ @@ -0,0 +1,27 @@ +#!/usr/bin/env python +import time +import sys +import os +from random import randint + +# Hack to import from a parent dir +# http://stackoverflow.com/a/11158224/401554 +parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +sys.path.insert(0, parentdir) + +from octo impor...
407c08899eccea60a2ae534ab0c1b000c58708ab
tests/test_agent_api.py
tests/test_agent_api.py
# No shebang line, this module is meant to be imported # # Copyright 2013 Oliver Palmer # Copyright 2013 Ambient Entertainment GmbH & Co. KG # # 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 # ...
Implement some tests for AgentAPI
Implement some tests for AgentAPI
Python
apache-2.0
pyfarm/pyfarm-master,pyfarm/pyfarm-master,pyfarm/pyfarm-master
--- +++ @@ -0,0 +1,77 @@ +# No shebang line, this module is meant to be imported +# +# Copyright 2013 Oliver Palmer +# Copyright 2013 Ambient Entertainment GmbH & Co. KG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may...
33448340d278da7e0653701d78cbab317893279d
AG/datasets/analyze.py
AG/datasets/analyze.py
#!/usr/bin/python import os import sys import lxml from lxml import etree import math class StatsCounter(object): prefixes = {} cur_tag = None def start( self, tag, attrib ): self.cur_tag = tag def end( self, tag ): pass #self.cur_tag = None def data( self, _data ): ...
Add a simple analysis tool to get some structural properties about an AG's specfile.
Add a simple analysis tool to get some structural properties about an AG's specfile.
Python
apache-2.0
jcnelson/syndicate,iychoi/syndicate,iychoi/syndicate,jcnelson/syndicate,iychoi/syndicate,iychoi/syndicate,iychoi/syndicate,iychoi/syndicate,iychoi/syndicate,jcnelson/syndicate,jcnelson/syndicate,jcnelson/syndicate,jcnelson/syndicate,iychoi/syndicate,jcnelson/syndicate,jcnelson/syndicate
--- +++ @@ -0,0 +1,89 @@ +#!/usr/bin/python + +import os +import sys +import lxml +from lxml import etree +import math + +class StatsCounter(object): + + prefixes = {} + cur_tag = None + + def start( self, tag, attrib ): + self.cur_tag = tag + + def end( self, tag ): + pass + #self....
a9ca7f2f22551256213ecd32047022048c72db5c
scripts/convert_svgs.py
scripts/convert_svgs.py
import cairosvg import os # MUST RUN IN PYTHON 3 and pip install cairosvg file_dir = '../data/hough_test/Test_Set_1/' svgs = os.listdir(os.path.join(file_dir, 'SVGs')) for svg in svgs: name = svg.split('.svg')[0] cairosvg.svg2png(url=os.path.join(file_dir, 'SVGs', svg), write_to=os.path...
Add Python 3 Script for Converting Image Types
Add Python 3 Script for Converting Image Types
Python
mit
Molecular-Image-Recognition/Molecular-Image-Recognition
--- +++ @@ -0,0 +1,15 @@ +import cairosvg +import os + +# MUST RUN IN PYTHON 3 and pip install cairosvg + +file_dir = '../data/hough_test/Test_Set_1/' + +svgs = os.listdir(os.path.join(file_dir, 'SVGs')) + +for svg in svgs: + name = svg.split('.svg')[0] + cairosvg.svg2png(url=os.path.join(file_dir, 'SVGs', svg)...
30a0b17d028f279a9877150ac4eb60b1ce135fa2
checks/check_multiply_hue_and_saturation.py
checks/check_multiply_hue_and_saturation.py
from __future__ import print_function, division import numpy as np import imgaug as ia from imgaug import augmenters as iaa def main(): image = ia.quokka_square((128, 128)) images_aug = [] for mul in np.linspace(0.0, 2.0, 10): aug = iaa.MultiplyHueAndSaturation(mul) image_aug = aug.augm...
Add check script for MultiplyHueAndSaturation
Add check script for MultiplyHueAndSaturation
Python
mit
aleju/imgaug,aleju/imgaug,aleju/ImageAugmenter
--- +++ @@ -0,0 +1,37 @@ +from __future__ import print_function, division + +import numpy as np + +import imgaug as ia +from imgaug import augmenters as iaa + + +def main(): + image = ia.quokka_square((128, 128)) + images_aug = [] + + for mul in np.linspace(0.0, 2.0, 10): + aug = iaa.MultiplyHueAndSat...
242479ace03928b20dc86806f7592ec1148b615b
service/test/integration/test_draft_service.py
service/test/integration/test_draft_service.py
# # Copyright (c) 2014 ThoughtWorks, Inc. # # Pixelated is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Pixelated is distrib...
Add integration test for DraftService.
Add integration test for DraftService.
Python
agpl-3.0
pixelated-project/pixelated-user-agent,torquemad/pixelated-user-agent,torquemad/pixelated-user-agent,PuZZleDucK/pixelated-user-agent,PuZZleDucK/pixelated-user-agent,kaeff/pixelated-user-agent,SamuelToh/pixelated-user-agent,pixelated-project/pixelated-user-agent,PuZZleDucK/pixelated-user-agent,torquemad/pixelated-user-a...
--- +++ @@ -0,0 +1,32 @@ +# +# Copyright (c) 2014 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later...
d85442d5961602ae91c385a65e9503c409316b3f
bin/scrub_stale_lists.py
bin/scrub_stale_lists.py
#!/usr/bin/env python import sys import os import time import redis import requests import logging from urlparse import urlparse from datetime import timedelta def main(rds): pf = "coalesce.v1." tasks_removed = 0 lists_removed = 0 list_keys = rds.smembers(pf + "list_keys") for key in list_keys:...
Scrub stale data from redis
Scrub stale data from redis
Python
mpl-2.0
mozilla/tc-coalesce,dividehex/tc-coalesce
--- +++ @@ -0,0 +1,72 @@ +#!/usr/bin/env python + +import sys +import os +import time +import redis +import requests +import logging +from urlparse import urlparse +from datetime import timedelta + + +def main(rds): + pf = "coalesce.v1." + + tasks_removed = 0 + lists_removed = 0 + + list_keys = rds.smembe...
9870fdd4b0996254216ff85a4dc0f9706843ca50
tests/basics/while_nest_exc.py
tests/basics/while_nest_exc.py
# test nested whiles within a try-except while 1: print(1) try: print(2) while 1: print(3) break except: print(4) print(5) break
Add test for nested while with exc and break.
tests: Add test for nested while with exc and break.
Python
mit
ruffy91/micropython,jmarcelino/pycom-micropython,henriknelson/micropython,puuu/micropython,neilh10/micropython,xuxiaoxin/micropython,utopiaprince/micropython,cwyark/micropython,aethaniel/micropython,tuc-osg/micropython,vitiral/micropython,orionrobots/micropython,noahchense/micropython,paul-xxx/micropython,ganshun666/mi...
--- +++ @@ -0,0 +1,13 @@ +# test nested whiles within a try-except + +while 1: + print(1) + try: + print(2) + while 1: + print(3) + break + except: + print(4) + print(5) + break
e61dcb055fb4767e6e662648c89cbdfda4422c97
docs/source/examples/test_no_depends_fails.py
docs/source/examples/test_no_depends_fails.py
from pych.extern import Chapel @Chapel(sfile="users.onlyonce.chpl") def useTwoModules(x=int, y=int): return int if __name__ == "__main__": print(useTwoModules(2, 4)) import testcase # contains the general testing method, which allows us to gather output import os.path def test_using_multiple_modules(): ...
from pych.extern import Chapel @Chapel(sfile="users.onlyonce.chpl") def useTwoModules(x=int, y=int): return int if __name__ == "__main__": print(useTwoModules(2, 4)) import testcase # contains the general testing method, which allows us to gather output import os.path def test_using_multiple_modules(): ...
Update expected error message in this test
Update expected error message in this test With the new ability to "use" enums, the error message for failing to find a module had been updated to indicate that we didn't find a module or an enum, making this test's expected output fail to match. Update the expected error message to reflect this new functionality.
Python
apache-2.0
chapel-lang/pychapel,russel/pychapel,chapel-lang/pychapel,russel/pychapel,russel/pychapel,chapel-lang/pychapel
--- +++ @@ -15,4 +15,4 @@ out = testcase.runpy(os.path.realpath(__file__)) # Ensure that when a used module is nowhere near the exported function, we # get an error message to that effect. - assert "error: Cannot find module \'M1\'" in out + assert "error: Cannot find module or enum \'M1\'" in ou...
77f812f76966b90c27131fd65968f548afcdcace
svir/dialogs/load_basic_csv_as_layer_dialog.py
svir/dialogs/load_basic_csv_as_layer_dialog.py
# -*- coding: utf-8 -*- # /*************************************************************************** # Irmt # A QGIS plugin # OpenQuake Integrated Risk Modelling Toolkit # ------------------- # begin : 2013-10-24 # copyright ...
Add loader for basic csv layers without geoms
Add loader for basic csv layers without geoms
Python
agpl-3.0
gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis
--- +++ @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# /*************************************************************************** +# Irmt +# A QGIS plugin +# OpenQuake Integrated Risk Modelling Toolkit +# ------------------- +# begin :...
8c7fa4e16805dc9e8adbd5615c610be8ba92c444
ceph_deploy/tests/parser/test_gatherkeys.py
ceph_deploy/tests/parser/test_gatherkeys.py
import pytest from ceph_deploy.cli import get_parser class TestParserGatherKeys(object): def setup(self): self.parser = get_parser() def test_gather_help(self, capsys): with pytest.raises(SystemExit): self.parser.parse_args('gatherkeys --help'.split()) out, err = capsys....
Add argparse tests for gatherkeys
[RM-11742] Add argparse tests for gatherkeys Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
Python
mit
SUSE/ceph-deploy,zhouyuan/ceph-deploy,shenhequnying/ceph-deploy,ghxandsky/ceph-deploy,zhouyuan/ceph-deploy,ceph/ceph-deploy,SUSE/ceph-deploy,branto1/ceph-deploy,isyippee/ceph-deploy,osynge/ceph-deploy,Vicente-Cheng/ceph-deploy,isyippee/ceph-deploy,ceph/ceph-deploy,trhoden/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,SUSE...
--- +++ @@ -0,0 +1,32 @@ +import pytest + +from ceph_deploy.cli import get_parser + + +class TestParserGatherKeys(object): + + def setup(self): + self.parser = get_parser() + + def test_gather_help(self, capsys): + with pytest.raises(SystemExit): + self.parser.parse_args('gatherkeys --h...
f24fe32329625ec037a9afc8d3bdeed5f41e69a0
scripts/diff_incar.py
scripts/diff_incar.py
#!/usr/bin/env python ''' Created on Nov 12, 2011 ''' __author__="Shyue Ping Ong" __copyright__ = "Copyright 2011, The Materials Project" __version__ = "0.1" __maintainer__ = "Shyue Ping Ong" __email__ = "shyue@mit.edu" __date__ = "Nov 12, 2011" import sys import itertools from pymatgen.io.vaspio import Incar from p...
Add a script for easy diffing of two Incars.
Add a script for easy diffing of two Incars. Former-commit-id: 998a47c0b96b3024abd82b196f431926cc50847d [formerly 927396038d147b633bee31988cf1e016258c5320] Former-commit-id: 4a8c6bb9cfef4a3a3f6cc211b7ef558a06f523c3
Python
mit
gpetretto/pymatgen,aykol/pymatgen,Bismarrck/pymatgen,czhengsci/pymatgen,johnson1228/pymatgen,Bismarrck/pymatgen,gVallverdu/pymatgen,richardtran415/pymatgen,blondegeek/pymatgen,czhengsci/pymatgen,dongsenfo/pymatgen,montoyjh/pymatgen,czhengsci/pymatgen,fraricci/pymatgen,nisse3000/pymatgen,nisse3000/pymatgen,blondegeek/py...
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +''' +Created on Nov 12, 2011 +''' + +__author__="Shyue Ping Ong" +__copyright__ = "Copyright 2011, The Materials Project" +__version__ = "0.1" +__maintainer__ = "Shyue Ping Ong" +__email__ = "shyue@mit.edu" +__date__ = "Nov 12, 2011" + +import sys +import itertools +...
bb940826d78e44a4098023e83d788b3d915b9b1f
grip/constants.py
grip/constants.py
# The supported extensions, as defined by https://github.com/github/markup supported_extensions = [ '.markdown', '.mdown', '.mkdn', '.md', '.textile', '.rdoc', '.org', '.creole', '.mediawiki', '.wiki', '.rst', '.asciidoc', '.adoc', '.asc', '.pod', ] # The default filenames when no ...
# The supported extensions, as defined by https://github.com/github/markup supported_extensions = ['.md', '.markdown'] # The default filenames when no file is provided default_filenames = map(lambda ext: 'README' + ext, supported_extensions)
Revert "Add the GitHub-supported format extensions."
Revert "Add the GitHub-supported format extensions." This reverts commit 4f67141cfabe99af99434364e13fec91bef291a7.
Python
mit
jbarreras/grip,joeyespo/grip,mgoddard-pivotal/grip,joeyespo/grip,mgoddard-pivotal/grip,ssundarraj/grip,jbarreras/grip,ssundarraj/grip
--- +++ @@ -1,16 +1,5 @@ # The supported extensions, as defined by https://github.com/github/markup -supported_extensions = [ - '.markdown', '.mdown', '.mkdn', '.md', - '.textile', - '.rdoc', - '.org', - '.creole', - '.mediawiki', '.wiki', - '.rst', - '.asciidoc', '.adoc', '.asc', - '.pod'...
b333d95f3f4187b9d9b480ba8ff4985a62d65f41
tests/pytests/unit/modules/test_nginx.py
tests/pytests/unit/modules/test_nginx.py
import pytest import salt.modules.nginx as nginx from tests.support.mock import patch @pytest.fixture def configure_loader_modules(): return {nginx: {}} @pytest.mark.parametrize( "expected_version,nginx_output", [ ("1.2.3", "nginx version: nginx/1.2.3"), ("1", "nginx version: nginx/1"), ...
Add tests for nginx version
Add tests for nginx version I had considered doing something with regex like `\d+(\.\d+)*`, then I realized that there are other valid version strings that perhaps do not contain numerics separated by `.`, so this option is a bit more flexible as far as what versions nginx can return. The major weakness here is that ...
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,25 @@ +import pytest +import salt.modules.nginx as nginx +from tests.support.mock import patch + + +@pytest.fixture +def configure_loader_modules(): + return {nginx: {}} + + +@pytest.mark.parametrize( + "expected_version,nginx_output", + [ + ("1.2.3", "nginx version: nginx/1.2.3"), ...
f9b38f675df9752a4b5309df059c6d15a1e1b3c2
ex_range.py
ex_range.py
from collections import namedtuple from vintage_ex import EX_RANGE_REGEXP import location EX_RANGE = namedtuple('ex_range', 'left left_offset separator right right_offset') def get_range_parts(range): parts = EX_RANGE_REGEXP.search(range).groups() return EX_RANGE( left=parts[1], ...
Add module for range support.
Add module for range support.
Python
mit
SublimeText/VintageEx
--- +++ @@ -0,0 +1,43 @@ +from collections import namedtuple + +from vintage_ex import EX_RANGE_REGEXP +import location + + +EX_RANGE = namedtuple('ex_range', 'left left_offset separator right right_offset') + + +def get_range_parts(range): + parts = EX_RANGE_REGEXP.search(range).groups() + return EX_RANGE( + ...
58ac46511964ca1dd3de25d2b6053eb785e3e281
util/detect-outliers.py
util/detect-outliers.py
#!/usr/bin/env python2 # # Detect outlier faces (not of the same person) in a directory # of aligned images. # Brandon Amos # 2016/02/14 # # Copyright 2015-2016 Carnegie Mellon University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
Add outlier detection util script.
Add outlier detection util script.
Python
apache-2.0
Alexx-G/openface,nmabhi/Webface,Alexx-G/openface,nmabhi/Webface,xinfang/face-recognize,francisleunggie/openface,cmusatyalab/openface,nmabhi/Webface,Alexx-G/openface,francisleunggie/openface,nhzandi/openface,xinfang/face-recognize,Alexx-G/openface,nmabhi/Webface,xinfang/face-recognize,cmusatyalab/openface,francisleunggi...
--- +++ @@ -0,0 +1,77 @@ +#!/usr/bin/env python2 +# +# Detect outlier faces (not of the same person) in a directory +# of aligned images. +# Brandon Amos +# 2016/02/14 +# +# Copyright 2015-2016 Carnegie Mellon University +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this fil...
964d1f97df600308b23b6a91b9de8811795509a4
sympy/core/tests/test_cache.py
sympy/core/tests/test_cache.py
from sympy.core.cache import cacheit def test_cacheit_doc(): @cacheit def testfn(): "test docstring" pass assert testfn.__doc__ == "test docstring" assert testfn.__name__ == "testfn"
Add a test for the @cachit decorator.
Add a test for the @cachit decorator. Make sure that the caching decorator correctly copies over the function docstring and function name. This fixes issue #744 from the issue tracker. Signed-off-by: Jochen Voss <1dcd5c846f3eb4984f0655fb5407be7c9e0c9079@seehuhn.de> Signed-off-by: Ondrej Certik <b816faa87b7d35274d2e5...
Python
bsd-3-clause
cccfran/sympy,shipci/sympy,wyom/sympy,Titan-C/sympy,ahhda/sympy,meghana1995/sympy,wanglongqi/sympy,pandeyadarsh/sympy,vipulroxx/sympy,jbbskinny/sympy,jaimahajan1997/sympy,Arafatk/sympy,grevutiu-gabriel/sympy,Gadal/sympy,jerli/sympy,mcdaniel67/sympy,Mitchkoens/sympy,wyom/sympy,oliverlee/sympy,ga7g08/sympy,tovrstra/sympy...
--- +++ @@ -0,0 +1,10 @@ +from sympy.core.cache import cacheit + +def test_cacheit_doc(): + @cacheit + def testfn(): + "test docstring" + pass + + assert testfn.__doc__ == "test docstring" + assert testfn.__name__ == "testfn"
0f1cf524c2b90d77e17d516a30d62632ebb5ed2f
datathon/datathon_etl_pipelines/generic_imagining/untar_gcs.py
datathon/datathon_etl_pipelines/generic_imagining/untar_gcs.py
r"""Untar .tar and .tar.gz GCS files.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import apache_beam as beam from apache_beam.options.pipeline_options import PipelineOptions from apache_beam.options.pipeline_options import SetupOption...
Add pipeline for untar'ing GCS blobs.
Add pipeline for untar'ing GCS blobs. PiperOrigin-RevId: 247210932
Python
apache-2.0
GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare
--- +++ @@ -0,0 +1,63 @@ +r"""Untar .tar and .tar.gz GCS files.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import argparse +import apache_beam as beam +from apache_beam.options.pipeline_options import PipelineOptions +from apache_beam.option...
80ccffb269b04af02224c1121c41d4e7c503bc30
tests/util/test_intersperse.py
tests/util/test_intersperse.py
# This file is part of rinohtype, the Python document preparation system. # # Copyright (c) Brecht Machiels. # # Use of this source code is subject to the terms of the GNU Affero General # Public License v3. See the LICENSE file or http://www.gnu.org/licenses/. from rinoh.util import intersperse def test_interspers...
Add unit test for intersperse
Add unit test for intersperse
Python
agpl-3.0
brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype
--- +++ @@ -0,0 +1,16 @@ +# This file is part of rinohtype, the Python document preparation system. +# +# Copyright (c) Brecht Machiels. +# +# Use of this source code is subject to the terms of the GNU Affero General +# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/. + + +from rinoh.util impo...
1e9980aff2370b96171011f7fa50d4517957fa86
tilepack/check_toi.py
tilepack/check_toi.py
import mercantile import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('min_lon', type=float, help='Bounding box minimum longitude/left') parser.add_argument('min_lat', type=float, help='Bounding box minimum latitude/bottom') parser.add_argu...
Add a script to check TOI coverage for a bbox and zoom range
Add a script to check TOI coverage for a bbox and zoom range
Python
mit
tilezen/tilepacks
--- +++ @@ -0,0 +1,51 @@ +import mercantile +import argparse + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('min_lon', + type=float, + help='Bounding box minimum longitude/left') + parser.add_argument('min_lat', + type=float, + help='Bounding box minimum...
3ae0ea21cc6b1afadb0dd72e29016385d18167ab
DebianDevelChangesBot/utils/fiforeader.py
DebianDevelChangesBot/utils/fiforeader.py
# -*- coding: utf-8 -*- # # Debian Changes Bot # Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the...
Add FifoReader class to utils
Add FifoReader class to utils Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>
Python
agpl-3.0
xtaran/debian-devel-changes-bot,lamby/debian-devel-changes-bot,lamby/debian-devel-changes-bot,xtaran/debian-devel-changes-bot,sebastinas/debian-devel-changes-bot,lamby/debian-devel-changes-bot
--- +++ @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +# +# Debian Changes Bot +# Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software ...
7e600a791bec2f8639aae417a1ea052ca94cf7b9
testgen/mc-bundling-x86-gen.py
testgen/mc-bundling-x86-gen.py
#!/usr/bin/python # Auto-generates an exhaustive and repetitive test for correct bundle-locked # alignment on x86. # For every possible offset in an aligned bundle, a bundle-locked group of every # size in the inclusive range [1, bundle_size] is inserted. An appropriate CHECK # is added to verify that NOP padding occu...
Add a largish auto-generated test for the aligned bundling feature, along with the script generating it. The test should never be modified manually. If anyone needs to change it, please change the script and re-run it.
Add a largish auto-generated test for the aligned bundling feature, along with the script generating it. The test should never be modified manually. If anyone needs to change it, please change the script and re-run it. The script is placed into utils/testgen - I couldn't think of a better place, and after some discuss...
Python
bsd-3-clause
lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/python + +# Auto-generates an exhaustive and repetitive test for correct bundle-locked +# alignment on x86. +# For every possible offset in an aligned bundle, a bundle-locked group of every +# size in the inclusive range [1, bundle_size] is inserted. An appropriate CHECK +# is add...
3a19187e8116e8dc20166786fb1ca4d14b527950
ppapi/generators/idl_visitor.py
ppapi/generators/idl_visitor.py
#!/usr/bin/python # # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Visitor Object for traversing AST """ # # IDLVisitor # # The IDLVisitor class will traverse an AST truncating portions of the tr...
Add missing IDL Visistor class
Add missing IDL Visistor class This class provides a simple mechanism for recursively traversing the AST for both simple and version aware traversal. TBR= sehr@google.com BUG= http://code.google.com/p/chromium/issues/detail?id=87684 TEST= python idl_c_header.py Review URL: http://codereview.chromium.org/7448001 git-...
Python
bsd-3-clause
yitian134/chromium,adobe/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,adobe/chromium,adobe/chromium,adobe/chromium...
--- +++ @@ -0,0 +1,81 @@ +#!/usr/bin/python +# +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Visitor Object for traversing AST """ + +# +# IDLVisitor +# +# The IDLVisitor class will traver...
bbed7b813b6c809ee9615eabf2fcf4d3156b1c36
tools/convert_release_notes.py
tools/convert_release_notes.py
import sys import mistune print(sys.argv[1]) with open(sys.argv[1], "r") as source_file: source = source_file.read() html = mistune.Markdown() print() print("HTML") print("=====================================") print("From the <a href=\"\">GitHub release page</a>:\n<blockquote>") print(html(source)) print("</b...
Add script to convert release notes from Markdown
Add script to convert release notes from Markdown
Python
mit
adafruit/micropython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython
--- +++ @@ -0,0 +1,57 @@ +import sys +import mistune + +print(sys.argv[1]) + +with open(sys.argv[1], "r") as source_file: + source = source_file.read() + +html = mistune.Markdown() + +print() +print("HTML") +print("=====================================") +print("From the <a href=\"\">GitHub release page</a>:\n<blo...
80580b8667558e3a4034b31ac08773de70ef3b39
display_control_consumer/run.py
display_control_consumer/run.py
from setproctitle import setproctitle import json import redis import subprocess import time class DisplayControlConsumer(object): STEP = 0.05 def __init__(self): self.redis_instance = redis.StrictRedis() self.env = {"DISPLAY": ":0"} def get_brightness(self): p = subprocess.Popen...
Implement consumer for adjusting screen brightness.
Implement consumer for adjusting screen brightness. This script polls "display-control-destination-brightness" redis key and slowly adjusts screen brightness towards the value. Key is automatically deleted when destination is reached.
Python
bsd-3-clause
ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display
--- +++ @@ -0,0 +1,73 @@ +from setproctitle import setproctitle +import json +import redis +import subprocess +import time + +class DisplayControlConsumer(object): + STEP = 0.05 + + def __init__(self): + self.redis_instance = redis.StrictRedis() + self.env = {"DISPLAY": ":0"} + + + def get_brig...
3fbf2c29a54225e7d4dd882637e68cfe3a4d0101
src/cobwebs/tests/test_mq.py
src/cobwebs/tests/test_mq.py
from cobwebs.mq.core import RPCLink, TopicsLink from cobwebs.mq.backends.rabbitmq import driver import pytest import spider import json from unittest import mock HOST = "127.0.0.1" def test_driver_instance(): assert isinstance(driver.rpc, RPCLink) assert isinstance(driver.topics, TopicsLink) @mock.patch("c...
Add some tests for Message Queue
Add some tests for Message Queue
Python
apache-2.0
asteroide/immo_spider,asteroide/immo_spider,asteroide/immo_spider,asteroide/immo_spider
--- +++ @@ -0,0 +1,29 @@ +from cobwebs.mq.core import RPCLink, TopicsLink +from cobwebs.mq.backends.rabbitmq import driver +import pytest +import spider +import json +from unittest import mock + +HOST = "127.0.0.1" + + +def test_driver_instance(): + assert isinstance(driver.rpc, RPCLink) + assert isinstance(dri...
081b5aabae205ad7c23c512be15ee26276dc8a29
perfkitbenchmarker/providers/azure/util.py
perfkitbenchmarker/providers/azure/util.py
# Copyright 2016 PerfKitBenchmarker Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Check whether Azure CLI is in ARM mode
Check whether Azure CLI is in ARM mode This can prevent some hard-to-debug error messages later on.
Python
apache-2.0
GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,meteorfox/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,meteorfox/PerfKitBenchmarker
--- +++ @@ -0,0 +1,38 @@ +# Copyright 2016 PerfKitBenchmarker Authors. 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/LICENS...
6705e0e23d13a94726556714e11dfbb7a916877d
zinnia_wymeditor/admin.py
zinnia_wymeditor/admin.py
"""EntryAdmin for zinnia-wymeditor""" from django.contrib import admin from zinnia.models import Entry from zinnia.admin.entry import EntryAdmin class EntryAdminWYMEditorMixin(object): """ Mixin adding WYMeditor for editing Entry.content field. """ pass class EntryAdminWYMEditor(EntryAdminWYMEditor...
Add basic mechanism to override the default EntryAdmin
Add basic mechanism to override the default EntryAdmin
Python
bsd-3-clause
django-blog-zinnia/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor
--- +++ @@ -0,0 +1,23 @@ +"""EntryAdmin for zinnia-wymeditor""" +from django.contrib import admin + +from zinnia.models import Entry +from zinnia.admin.entry import EntryAdmin + + +class EntryAdminWYMEditorMixin(object): + """ + Mixin adding WYMeditor for editing Entry.content field. + """ + pass + + +cla...
389adca1fd52747814f370de2d066a1743544469
solutions/beecrowd/1046/1046.py
solutions/beecrowd/1046/1046.py
start, end = map(int, input().split()) if start == end: result = 24 elif end - start >= 0: result = end - start else: result = 24 + end - start print(f'O JOGO DUROU {result} HORA(S)')
Solve Game Time in python
Solve Game Time in python
Python
mit
deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr...
--- +++ @@ -0,0 +1,10 @@ +start, end = map(int, input().split()) + +if start == end: + result = 24 +elif end - start >= 0: + result = end - start +else: + result = 24 + end - start + +print(f'O JOGO DUROU {result} HORA(S)')
2199f4c5ed563200d555315b9a8575e00486e667
script/confirmed-fixed-monthly-breakdown.py
script/confirmed-fixed-monthly-breakdown.py
#!/usr/bin/python # A script to draw graphs showing the number of confirmed reports # created each month, and those of which that have been fixed. This # script expects to find a file called 'problems.csv' in the current # directory which should be generated by: # # DIR=`pwd` rake data:create_problem_spreadshee...
Add a simple script to generate monthly confirmed / fixed counts
Add a simple script to generate monthly confirmed / fixed counts This is a simple dumbing-down of graph-reports-by-transport-mode.py so there's some repeated code which should be factored out.
Python
agpl-3.0
mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport
--- +++ @@ -0,0 +1,69 @@ +#!/usr/bin/python + +# A script to draw graphs showing the number of confirmed reports +# created each month, and those of which that have been fixed. This +# script expects to find a file called 'problems.csv' in the current +# directory which should be generated by: +# +# DIR=`pwd` ...
6454548da01dbc2b9f772a5c0ffb11a03dc933e7
draw_shape.py
draw_shape.py
import pygame pygame.init() #-- SCREEN CHARACTERISTICS ------------------------->>> background_color = (255,255,255) (width, height) = (300, 200) #-- RENDER SCREEN ---------------------------------->>> screen = pygame.display.set_mode((width, height)) screen.fill(background_color) #pygame.draw.circle(canvas, color...
Add module capable of rendering a circle when ran
Add module capable of rendering a circle when ran
Python
mit
withtwoemms/pygame-explorations
--- +++ @@ -0,0 +1,24 @@ +import pygame + + +pygame.init() + +#-- SCREEN CHARACTERISTICS ------------------------->>> +background_color = (255,255,255) +(width, height) = (300, 200) + +#-- RENDER SCREEN ---------------------------------->>> +screen = pygame.display.set_mode((width, height)) +screen.fill(background_co...
5a857703de5fc1e67e958afb41a10db07b98bfa1
scripts/migrate_unconfirmed_valid_users.py
scripts/migrate_unconfirmed_valid_users.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Script to migrate users with a valid date_last_login but no date_confirmed.""" import sys import logging from website.app import init_app from website.models import User from scripts import utils as script_utils from tests.base import OsfTestCase from tests.factories i...
Add migration script to fix valid users with date_confirmed==None
Add migration script to fix valid users with date_confirmed==None
Python
apache-2.0
laurenrevere/osf.io,doublebits/osf.io,kch8qx/osf.io,mluo613/osf.io,petermalcolm/osf.io,GageGaskins/osf.io,ZobairAlijan/osf.io,caneruguz/osf.io,njantrania/osf.io,asanfilippo7/osf.io,zkraime/osf.io,petermalcolm/osf.io,himanshuo/osf.io,hmoco/osf.io,GaryKriebel/osf.io,jmcarp/osf.io,rdhyee/osf.io,monikagrabowska/osf.io,haoy...
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""Script to migrate users with a valid date_last_login but no date_confirmed.""" + +import sys +import logging + +from website.app import init_app +from website.models import User +from scripts import utils as script_utils +from tests.base imp...
edeffbcbe8fb239553c73fa37e73c0188ffc2479
tests/test_cli.py
tests/test_cli.py
import sys import fixtures import imgurpython import testtools import imgur_cli.cli as cli FAKE_ENV = {'IMGUR_CLIENT_ID': 'client_id', 'IMGUR_CLIENT_SECRET': 'client_secret', 'IMGUR_ACCESS_TOKEN': 'access_token', 'IMGUR_REFRESH_TOKEN': 'refresh_token', 'IMGUR_MASHAPE_K...
Add unit test for retrieving credentials from environment variables
Add unit test for retrieving credentials from environment variables
Python
mit
ueg1990/imgur-cli
--- +++ @@ -0,0 +1,40 @@ +import sys + +import fixtures +import imgurpython +import testtools + +import imgur_cli.cli as cli + +FAKE_ENV = {'IMGUR_CLIENT_ID': 'client_id', + 'IMGUR_CLIENT_SECRET': 'client_secret', + 'IMGUR_ACCESS_TOKEN': 'access_token', + 'IMGUR_REFRESH_TOKEN': 'refre...
aa4f1df448c6d01875ed667e37afe68c114892ed
api/mastercoin_verify.py
api/mastercoin_verify.py
import os import glob from flask import Flask, request, jsonify, abort, json data_dir_root = os.environ.get('DATADIR') app = Flask(__name__) app.debug = True @app.route('/addresses') def addresses(): currency_id = request.args.get('currency_id') print currency_id response = [] addr_glob = glob.glob(data_dir...
Add initial verification endpoint. Add all balance endpoint
Add initial verification endpoint. Add all balance endpoint
Python
agpl-3.0
Nevtep/omniwallet,VukDukic/omniwallet,Nevtep/omniwallet,habibmasuro/omniwallet,habibmasuro/omniwallet,OmniLayer/omniwallet,OmniLayer/omniwallet,OmniLayer/omniwallet,Nevtep/omniwallet,VukDukic/omniwallet,habibmasuro/omniwallet,Nevtep/omniwallet,achamely/omniwallet,achamely/omniwallet,achamely/omniwallet,OmniLayer/omniwa...
--- +++ @@ -0,0 +1,45 @@ +import os +import glob +from flask import Flask, request, jsonify, abort, json + +data_dir_root = os.environ.get('DATADIR') + +app = Flask(__name__) +app.debug = True + + +@app.route('/addresses') +def addresses(): + currency_id = request.args.get('currency_id') + print currency_id + resp...
26bc11340590b0b863527fa12da03cea528feb46
pygerrit/client.py
pygerrit/client.py
""" Gerrit client interface. """ from Queue import Queue, Empty, Full from pygerrit.error import GerritError from pygerrit.events import GerritEventFactory class GerritClient(object): """ Gerrit client interface. """ def __init__(self, host): self._factory = GerritEventFactory() self._host...
Add initial stub of GerritClient class
Add initial stub of GerritClient class The Gerrit client class will be used as an interface to the Gerrit events stream and query functionality. This is the intial stub. More functionality will be added, and existing stream functionality refactored, in later commits. Change-Id: If4ef838c2d3f3e5afaad2a553af49b1c66ad...
Python
mit
morucci/pygerrit,sonyxperiadev/pygerrit,dpursehouse/pygerrit,benjiii/pygerrit,gferon/pygerrit2,markon/pygerrit2,dpursehouse/pygerrit2
--- +++ @@ -0,0 +1,43 @@ +""" Gerrit client interface. """ + +from Queue import Queue, Empty, Full + +from pygerrit.error import GerritError +from pygerrit.events import GerritEventFactory + + +class GerritClient(object): + + """ Gerrit client interface. """ + + def __init__(self, host): + self._factory ...
10f99acc11051b37595751b9b9b84e11dd133a64
kolibri/core/content/utils/file_availability.py
kolibri/core/content/utils/file_availability.py
import json import os import re import requests from django.core.cache import cache from kolibri.core.content.models import LocalFile from kolibri.core.content.utils.paths import get_content_storage_dir_path from kolibri.core.content.utils.paths import get_file_checksums_url checksum_regex = re.compile("^([a-f0-9]{...
Add functions for getting available checksums for a channel from remote and disk.
Add functions for getting available checksums for a channel from remote and disk.
Python
mit
mrpau/kolibri,mrpau/kolibri,learningequality/kolibri,indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri,mrpau/kolibri,indirectlylit/kolibri,mrpau/kolibri,indirectlylit/kolibri,learningequality/kolibri,learningequality/kolibri
--- +++ @@ -0,0 +1,73 @@ +import json +import os +import re + +import requests +from django.core.cache import cache + +from kolibri.core.content.models import LocalFile +from kolibri.core.content.utils.paths import get_content_storage_dir_path +from kolibri.core.content.utils.paths import get_file_checksums_url + + +...
27d37833663842405f159127f30c6351958fcb10
bench_examples/bench_dec_insert.py
bench_examples/bench_dec_insert.py
from csv import DictWriter from ktbs_bench.utils.decorators import bench @bench def batch_insert(graph, file): """Insert triples in batch.""" print(graph, file) if __name__ == '__main__': # Define some graph/store to use graph_list = ['g1', 'g2'] # Define some files to get the triples from ...
Add draft of example using the new @bench
Add draft of example using the new @bench
Python
mit
ktbs/ktbs-bench,ktbs/ktbs-bench
--- +++ @@ -0,0 +1,32 @@ +from csv import DictWriter + +from ktbs_bench.utils.decorators import bench + + +@bench +def batch_insert(graph, file): + """Insert triples in batch.""" + print(graph, file) + + +if __name__ == '__main__': + # Define some graph/store to use + graph_list = ['g1', 'g2'] + + # De...
d4a7bbe27b285e455a3beafefd22fc493edeb161
test/test_config_eventlogger.py
test/test_config_eventlogger.py
#!/usr/bin/env python2 import unittest import subprocess import threading import tempfile import os from testdc import * DAEMON_PATH = './astrond' TERMINATED = -15 EXITED = 1 class ConfigTest(object): def __init__(self, config): self.config = config self.process = None def run(self, timeout)...
Add unittest for eventlogger config validation.
Tests: Add unittest for eventlogger config validation.
Python
bsd-3-clause
ketoo/Astron,pizcogirl/Astron,ketoo/Astron,blindsighttf2/Astron,blindsighttf2/Astron,ketoo/Astron,pizcogirl/Astron,pizcogirl/Astron,ketoo/Astron,blindsighttf2/Astron,pizcogirl/Astron,blindsighttf2/Astron
--- +++ @@ -0,0 +1,71 @@ +#!/usr/bin/env python2 +import unittest +import subprocess +import threading +import tempfile +import os + +from testdc import * + +DAEMON_PATH = './astrond' +TERMINATED = -15 +EXITED = 1 + +class ConfigTest(object): + def __init__(self, config): + self.config = config + sel...
2c0ce3c64720122bf2fdd80aeb2ff8359873ac83
municipal_finance/tests/test_analytics.py
municipal_finance/tests/test_analytics.py
from django.test import TestCase from django.conf import settings class TestAnalytics(TestCase): def test_noindex_flag(self): response = self.client.get('/') self.assertEqual(response.status_code, 200) self.assertTrue('<meta name="robots" content="noindex">' not in str(response.content)) ...
Test that noindex flag will only show robots metatag when set
Test that noindex flag will only show robots metatag when set
Python
mit
Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data
--- +++ @@ -0,0 +1,15 @@ +from django.test import TestCase +from django.conf import settings + + +class TestAnalytics(TestCase): + + def test_noindex_flag(self): + response = self.client.get('/') + self.assertEqual(response.status_code, 200) + self.assertTrue('<meta name="robots" content="noin...
bac06acb1e6255040f371232776f3da75fb9247a
osf/migrations/0069_auto_20171127_1119.py
osf/migrations/0069_auto_20171127_1119.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-11-27 17:19 from __future__ import unicode_literals import logging from django.db import migrations from osf.models import PreprintService logger = logging.getLogger(__name__) def add_preprint_doi_created(apps, schema_editor): """ Data migration tha...
Add data migration to populate preprint_doi_created field on existing published preprints where DOI identifier exists. Set to preprint date_published field.
Add data migration to populate preprint_doi_created field on existing published preprints where DOI identifier exists. Set to preprint date_published field.
Python
apache-2.0
baylee-d/osf.io,baylee-d/osf.io,erinspace/osf.io,cslzchen/osf.io,mattclark/osf.io,mfraezz/osf.io,cslzchen/osf.io,caseyrollins/osf.io,CenterForOpenScience/osf.io,laurenrevere/osf.io,Johnetordoff/osf.io,saradbowman/osf.io,icereval/osf.io,brianjgeiger/osf.io,felliott/osf.io,cslzchen/osf.io,TomBaxter/osf.io,felliott/osf.io...
--- +++ @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.7 on 2017-11-27 17:19 +from __future__ import unicode_literals +import logging + +from django.db import migrations +from osf.models import PreprintService +logger = logging.getLogger(__name__) + +def add_preprint_doi_created(apps, schema_ed...
167a6497d79a4a18badd5ea85a87e7eefcd02696
test/acceptance/__init__.py
test/acceptance/__init__.py
# -*- coding: utf-8 -*- """ Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U This file is part of fiware-orion-pep fiware-orion-pep is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either versio...
Add init file to the root acceptance tests folder
Add init file to the root acceptance tests folder
Python
agpl-3.0
telefonicaid/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,telefonicaid/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,telefonicaid/fiware-pep-steelskin,telefonicaid/fiware-pep-steelskin
--- +++ @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +""" +Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U + +This file is part of fiware-orion-pep + +fiware-orion-pep 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 Fre...
b171eb0c77f2d68051b48145f4e49275ed6860b9
account/tests/test_models.py
account/tests/test_models.py
from django.conf import settings from django.core import mail from django.core.urlresolvers import reverse from django.test import TestCase, override_settings from django.contrib.auth.models import User from account.models import SignupCode class SignupCodeModelTestCase(TestCase): def test_exists_no_match(self)...
Add tests for signup code exists method
Add tests for signup code exists method
Python
mit
pinax/django-user-accounts,pinax/django-user-accounts
--- +++ @@ -0,0 +1,50 @@ +from django.conf import settings +from django.core import mail +from django.core.urlresolvers import reverse +from django.test import TestCase, override_settings + +from django.contrib.auth.models import User + +from account.models import SignupCode + + +class SignupCodeModelTestCase(TestCas...
95874a5e06ff70d1cbea49321549beee5cc5abba
examples/store_and_retrieve_units_example.py
examples/store_and_retrieve_units_example.py
""" Author: Daniel Berke, berke.daniel@gmail.com Date: October 27, 2019 Requirements: h5py>=2.10.0, unyt>=v2.4.0 Notes: This short example script shows how to save unit information attached to a `unyt_array` using `attrs` in HDF5, and recover it upon reading the file. It uses the Unyt package (https://github.com/yt-pro...
Create an example of storing units in HDF5
Create an example of storing units in HDF5 This example script demonstrates how to store unit information attached to an array of numbers using HDF5 in such a way that the original data can be recovered upon reading the file. It uses the Unyt package (https://github.com/yt-project/unyt) for handling units, but presuma...
Python
bsd-3-clause
h5py/h5py,h5py/h5py,h5py/h5py
--- +++ @@ -0,0 +1,40 @@ +""" +Author: Daniel Berke, berke.daniel@gmail.com +Date: October 27, 2019 +Requirements: h5py>=2.10.0, unyt>=v2.4.0 +Notes: This short example script shows how to save unit information attached +to a `unyt_array` using `attrs` in HDF5, and recover it upon reading the file. +It uses the Unyt ...