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
11bad7dcf3fa4d9fdf40eee49505fa55dc0243e8
src/collectors/users/users.py
src/collectors/users/users.py
# coding=utf-8 """ Collects the number of users logged in and shells per user #### Dependencies * [pyutmp](http://software.clapper.org/pyutmp/) """ import diamond.collector from pyutmp import UtmpFile class UsersCollector(diamond.collector.Collector): def get_default_config_help(self): """ ...
# coding=utf-8 """ Collects the number of users logged in and shells per user #### Dependencies * [pyutmp](http://software.clapper.org/pyutmp/) """ import diamond.collector from pyutmp import UtmpFile class UsersCollector(diamond.collector.Collector): def get_default_config_help(self): """ ...
Add in a way to specify the utmp file path for unit testing
Add in a way to specify the utmp file path for unit testing
Python
mit
EzyInsights/Diamond,jumping/Diamond,acquia/Diamond,datafiniti/Diamond,thardie/Diamond,hvnsweeting/Diamond,thardie/Diamond,Basis/Diamond,saucelabs/Diamond,mfriedenhagen/Diamond,Ensighten/Diamond,ceph/Diamond,Slach/Diamond,h00dy/Diamond,ceph/Diamond,saucelabs/Diamond,Clever/Diamond,Netuitive/Diamond,sebbrandt87/Diamond,z...
--- +++ @@ -32,6 +32,7 @@ config.update({ 'path': 'users', 'method': 'Threaded', + 'utmp': None, }) return config @@ -39,7 +40,7 @@ metrics = {} metrics['total'] = 0 - for utmp in UtmpFile(): + for ut...
f8f59ff7a33a0a702e04ef6fc700c14467de9adf
hardware/sense_hat/turn_off_lights.py
hardware/sense_hat/turn_off_lights.py
# based on https://www.raspberrypi.org/learning/sense-hat-marble-maze/worksheet/ from sense_hat import SenseHat from time import sleep sense = SenseHat() sense.clear()
Add script to turn off all lights on Sense Hat
Add script to turn off all lights on Sense Hat
Python
mit
claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code
--- +++ @@ -0,0 +1,8 @@ +# based on https://www.raspberrypi.org/learning/sense-hat-marble-maze/worksheet/ + +from sense_hat import SenseHat +from time import sleep + +sense = SenseHat() +sense.clear() +
b9ec3b4096fa0541a40d8f1f46b79b3726489e19
src/gensim/test/test_utils.py
src/gensim/test/test_utils.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """ Automated tests for checking various utils functions """ import logging import unittest from gensim import utils logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', ...
Add tests for isCorpus() in utils.py.
Add tests for isCorpus() in utils.py.
Python
lgpl-2.1
jaksmid/gensim,zachmayer/gensim,markroxor/gensim,zachmayer/gensim,loisaidasam/gensim,ziky90/gensim,akutuzov/gensim,tzoiker/gensim,ziky90/gensim,olavurmortensen/gensim,ziky90/gensim,tzoiker/gensim,mattilyra/gensim,manasRK/gensim,jaksmid/gensim,mattilyra/gensim,isohyt/gensim,gojomo/gensim,quole/gensim,pombredanne/gensim,...
--- +++ @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html + +""" +Automated tests for checking various utils functions +""" + + +import logging +import unittest + +from gensim import utils + + +logging.basicConfig(format='%(...
2003269e22361e201f93bb1dba1ca4b4572d2968
interestingness/diffTest.py
interestingness/diffTest.py
#!/usr/bin/env python from optparse import OptionParser import timedRun import filecmp def parseOptions(arguments): parser = OptionParser() parser.disable_interspersed_args() parser.add_option('-t', '--timeout', type='int', action='store', dest='condTimeout', default=120, ...
Add a new interesting test to check different behaviour based on command line switches.
Add a new interesting test to check different behaviour based on command line switches.
Python
mpl-2.0
nth10sd/lithium,nth10sd/lithium,MozillaSecurity/lithium,MozillaSecurity/lithium
--- +++ @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +from optparse import OptionParser + +import timedRun +import filecmp + + +def parseOptions(arguments): + parser = OptionParser() + parser.disable_interspersed_args() + parser.add_option('-t', '--timeout', type='int', action='store', dest='condTimeout', + ...
2327b809bb9ffbf53b259e374512e7868d5f17df
scripts/ensure_log_dates.py
scripts/ensure_log_dates.py
# -*- coding: utf-8 -*- import datetime import logging import sys from modularodm import Q from website.models import NodeLog from bson import ObjectId from nose.tools import * from tests.base import OsfTestCase from tests.factories import NodeLogFactory logger = logging.getLogger(__name__) logger.setLevel(loggi...
Add migration script for defective "delete wiki page" logs
Add migration script for defective "delete wiki page" logs
Python
apache-2.0
CenterForOpenScience/osf.io,sbt9uc/osf.io,jinluyuan/osf.io,zamattiac/osf.io,binoculars/osf.io,Nesiehr/osf.io,cosenal/osf.io,jeffreyliu3230/osf.io,GaryKriebel/osf.io,jmcarp/osf.io,samanehsan/osf.io,dplorimer/osf,caseyrygt/osf.io,rdhyee/osf.io,monikagrabowska/osf.io,jinluyuan/osf.io,TomHeatwole/osf.io,Nesiehr/osf.io,zkra...
--- +++ @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +import datetime +import logging +import sys + +from modularodm import Q + +from website.models import NodeLog + +from bson import ObjectId +from nose.tools import * + +from tests.base import OsfTestCase +from tests.factories import NodeLogFactory + + +logger = logg...
fdb39ca0f3aee733646e2bd4e8021b4abbedcf52
tip/algorithms/sorting/quicksort.py
tip/algorithms/sorting/quicksort.py
"""Quick Sort Algorithm. The Quick Sort is a recursive sort of order in range from O(n log n) with the best pivots, to O(n2) with the worst pivots, where n is the number of elements in the array. Quicksort, also known as partition-exchange sort, uses these steps: 1 - Choose any element of the array to be the pivo...
Add some info about Quick Sort
Add some info about Quick Sort
Python
unlicense
davidgasquez/tip
--- +++ @@ -0,0 +1,35 @@ +"""Quick Sort Algorithm. + +The Quick Sort is a recursive sort of order in range from O(n log n) with +the best pivots, to O(n2) with the worst pivots, where n is the number +of elements in the array. + +Quicksort, also known as partition-exchange sort, uses these steps: + 1 - Choose any ...
7d27c40961fa80525d73942742fbe4ff8930be9a
python_script/get_token.py
python_script/get_token.py
from keystoneauth1.identity import v3 from keystoneauth1 import session from config import * auth = v3.Password(auth_url=AUTH_URL, user_domain_name='default', username=USERNAME, password=PASSWORD, project_domain_name='default', ...
Add missing get token file
Add missing get token file
Python
mit
daikk115/openstack_upgrade_test,daikk115/openstack_upgrade_test
--- +++ @@ -0,0 +1,15 @@ +from keystoneauth1.identity import v3 +from keystoneauth1 import session + +from config import * + + +auth = v3.Password(auth_url=AUTH_URL, + user_domain_name='default', + username=USERNAME, + password=PASSWORD, + pr...
735c3378d7cb150dcf2257f737a443fff9974b1a
chapter02/fahrenheitToCelsiusTable.py
chapter02/fahrenheitToCelsiusTable.py
#!/usr/bin/env python # -*- coding: utf-8 -*- def getCelsius(f): return (f-32) * 5/ 9 for index in range(10, 130, 10): fahrenheit = index print "{0}ºF are {1}ºC".format(fahrenheit, getCelsius(fahrenheit))
Add Fahrenheit to Celsius table exercise
Add Fahrenheit to Celsius table exercise
Python
apache-2.0
MindCookin/python-exercises
--- +++ @@ -0,0 +1,9 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +def getCelsius(f): + return (f-32) * 5/ 9 + +for index in range(10, 130, 10): + fahrenheit = index + print "{0}ºF are {1}ºC".format(fahrenheit, getCelsius(fahrenheit))
8fe6c1544298128fd0487da4669c373966bdae3d
adaptive/genpython.py
adaptive/genpython.py
import sys py_reserved = set("id is class def".split()) # FIXME def py_name(name): if name in py_reserved: return name + "_" return name sdl_to_python = { "int32": "int", "int64": "int", "double": "float", "string": "basestring" } def py_Typename(name): return sdl_to_python.get(na...
Add helpers for generating Python code
Add helpers for generating Python code
Python
apache-2.0
datawire/adaptive
--- +++ @@ -0,0 +1,84 @@ +import sys + +py_reserved = set("id is class def".split()) # FIXME +def py_name(name): + if name in py_reserved: + return name + "_" + return name + +sdl_to_python = { + "int32": "int", + "int64": "int", + "double": "float", + "string": "basestring" +} +def py_Typen...
213796305b89fa0e5de001006dbd741db0e83d36
tests/backends/events_test.py
tests/backends/events_test.py
import threading import unittest from pykka.actor import ThreadingActor from pykka.registry import ActorRegistry from mopidy.backends.dummy import DummyBackend from mopidy.listeners import BackendListener from mopidy.models import Track class BackendEventsTest(unittest.TestCase): def setUp(self): self.ev...
Test that backend actually sends the events
Test that backend actually sends the events
Python
apache-2.0
vrs01/mopidy,ZenithDK/mopidy,swak/mopidy,quartz55/mopidy,bencevans/mopidy,kingosticks/mopidy,ali/mopidy,rawdlite/mopidy,vrs01/mopidy,diandiankan/mopidy,jcass77/mopidy,liamw9534/mopidy,diandiankan/mopidy,ZenithDK/mopidy,kingosticks/mopidy,jcass77/mopidy,SuperStarPL/mopidy,diandiankan/mopidy,glogiotatidis/mopidy,priestd0...
--- +++ @@ -0,0 +1,45 @@ +import threading +import unittest + +from pykka.actor import ThreadingActor +from pykka.registry import ActorRegistry + +from mopidy.backends.dummy import DummyBackend +from mopidy.listeners import BackendListener +from mopidy.models import Track + +class BackendEventsTest(unittest.TestCase)...
a034a90c16d20a75b74cc326629ed2a46d72e05c
tests/test_forgot_password.py
tests/test_forgot_password.py
from . import TheInternetTestCase from helium.api import start_chrome, S, get_driver, set_driver, write, click, \ Text, Link, kill_browser, wait_until class ForgotPasswordTest(TheInternetTestCase): def get_page(self): return "http://the-internet.herokuapp.com/forgot_password" def test_retrieve_password(self): e...
Add test case for forgot password.
Add test case for forgot password.
Python
mit
bugfree-software/the-internet-solution-python
--- +++ @@ -0,0 +1,30 @@ +from . import TheInternetTestCase +from helium.api import start_chrome, S, get_driver, set_driver, write, click, \ + Text, Link, kill_browser, wait_until + +class ForgotPasswordTest(TheInternetTestCase): + def get_page(self): + return "http://the-internet.herokuapp.com/forgot_password" + de...
ec62de0b476f931be0fc629c4634cc76ea1acfdb
scripts/separate_mlsp2013_test_files.py
scripts/separate_mlsp2013_test_files.py
import os import glob import csv allFiles = ["" + x for x in glob.glob("*.wav")]; trainFiles = [] with open("file2labels.csv", newline='') as csvfile: file2labelsReader = csv.reader(csvfile); for r in file2labelsReader: f = r[0] + ".wav" trainFiles.append(f) #print(allFiles) a = len(allFiles...
Add script which divides mlsp data into train/test
Add script which divides mlsp data into train/test
Python
mit
johnmartinsson/bird-species-classification,johnmartinsson/bird-species-classification
--- +++ @@ -0,0 +1,33 @@ +import os +import glob +import csv + +allFiles = ["" + x for x in glob.glob("*.wav")]; +trainFiles = [] + +with open("file2labels.csv", newline='') as csvfile: + file2labelsReader = csv.reader(csvfile); + for r in file2labelsReader: + f = r[0] + ".wav" + trainFiles.appen...
23ead4960cdfe5eb443ba8d624e5dfe2fb1fd9a0
feincms/module/medialibrary/fields.py
feincms/module/medialibrary/fields.py
from django.contrib.admin.widgets import ForeignKeyRawIdWidget from django.db import models from django.utils.html import escape from django.utils.text import truncate_words from django.utils.translation import ugettext_lazy as _ from feincms.admin.item_editor import FeinCMSInline from feincms.module.medialibrary.mode...
Add a MediaFileForeignKey which automatically adds thumbnail previews to the administration
Add a MediaFileForeignKey which automatically adds thumbnail previews to the administration
Python
bsd-3-clause
matthiask/django-content-editor,nickburlett/feincms,joshuajonah/feincms,feincms/feincms,mjl/feincms,joshuajonah/feincms,nickburlett/feincms,joshuajonah/feincms,mjl/feincms,matthiask/feincms2-content,pjdelport/feincms,pjdelport/feincms,nickburlett/feincms,michaelkuty/feincms,matthiask/django-content-editor,michaelkuty/f...
--- +++ @@ -0,0 +1,45 @@ +from django.contrib.admin.widgets import ForeignKeyRawIdWidget +from django.db import models +from django.utils.html import escape +from django.utils.text import truncate_words +from django.utils.translation import ugettext_lazy as _ + +from feincms.admin.item_editor import FeinCMSInline +fr...
2b63bca267794d85544218386103d9a42530293e
tests/acceptance/test_dcos_agent.py
tests/acceptance/test_dcos_agent.py
import socket from shakedown import * def test_get_public_agents(): public_agents = get_public_agents() assert isinstance(public_agents, list) try: assert socket.inet_aton(public_agents[0]) except: assert False def test_get_private_agents(): private_agents = get_private_agents...
Add tests for agent-based functions
Add tests for agent-based functions
Python
apache-2.0
dcos/shakedown
--- +++ @@ -0,0 +1,36 @@ +import socket + +from shakedown import * + + +def test_get_public_agents(): + public_agents = get_public_agents() + + assert isinstance(public_agents, list) + + try: + assert socket.inet_aton(public_agents[0]) + except: + assert False + + +def test_get_private_agent...
bb721a008c09dc0510681cdd0faa8e98a6e60cef
conf_site/api/test/test_sponsor.py
conf_site/api/test/test_sponsor.py
from django.core.urlresolvers import reverse from rest_framework import status from symposion.sponsorship.models import Sponsor from .base import TestBase class TestSponsor(TestBase): @classmethod def setUpTestData(cls): super(TestSponsor, cls).setUpTestData() cls.sponsor = Sponsor.objects....
Add tests against Sponsor viewset
Add tests against Sponsor viewset
Python
mit
pydata/conf_site,pydata/conf_site,pydata/conf_site
--- +++ @@ -0,0 +1,48 @@ +from django.core.urlresolvers import reverse + +from rest_framework import status +from symposion.sponsorship.models import Sponsor + +from .base import TestBase + + +class TestSponsor(TestBase): + + @classmethod + def setUpTestData(cls): + super(TestSponsor, cls).setUpTestData(...
6c571c88f60a761f398054ddca3d407c6010023b
docker/transform-pem.py
docker/transform-pem.py
#!/usr/bin/env python """Script to transform letsencrypt certificate files into string that can be inserted into environment variable for Tutum to pick up. Put your private key in certs/privkey.pem and your certificate in certs/fullchain.pem, then run this script in order to obtain a certificate string compatible with...
Add script for transforming letsencrypt certificate
Add script for transforming letsencrypt certificate
Python
mit
muzhack/muzhack,muzhack/muzhack,muzhack/musitechhub,muzhack/muzhack,muzhack/musitechhub,muzhack/musitechhub,muzhack/musitechhub,muzhack/muzhack
--- +++ @@ -0,0 +1,17 @@ +#!/usr/bin/env python +"""Script to transform letsencrypt certificate files into string that can be inserted into +environment variable for Tutum to pick up. + +Put your private key in certs/privkey.pem and your certificate in certs/fullchain.pem, +then run this script in order to obtain a c...
fe9758c21af1870cd8c387aaf7f706bccf4be3f0
solutions/uri/1020/1020.py
solutions/uri/1020/1020.py
import sys for t in sys.stdin: t = int(t) a = 0 m = 0 if t >= 365: a = t // 365 t %= 365 if t >= 30: m = t // 30 t %= 30 print(f"{a} ano(s)") print(f"{m} mes(es)") print(f"{t} dia(s)")
Solve Age in Days in python
Solve Age in Days 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,19 @@ +import sys + + +for t in sys.stdin: + t = int(t) + a = 0 + m = 0 + + if t >= 365: + a = t // 365 + t %= 365 + + if t >= 30: + m = t // 30 + t %= 30 + + print(f"{a} ano(s)") + print(f"{m} mes(es)") + print(f"{t} dia(s)")
a29c10fab4e1e0006eb7334f4dd0a359ca473a23
test_parameters/__init__.py
test_parameters/__init__.py
# Copyright (C) 2013 by Alex Brandt <alunduil@alunduil.com> # # parameters is freely distributable under the terms of an MIT-style license. # See COPYING or http://www.opensource.org/licenses/mit-license.php.
Add stub module for test suite.
Add stub module for test suite.
Python
mit
alunduil/crumbs
--- +++ @@ -0,0 +1,4 @@ +# Copyright (C) 2013 by Alex Brandt <alunduil@alunduil.com> +# +# parameters is freely distributable under the terms of an MIT-style license. +# See COPYING or http://www.opensource.org/licenses/mit-license.php.
9cce74337194e10beddf8f5f6daaa139e44e8d70
scripts/support/mirnas/microrna-qc.py
scripts/support/mirnas/microrna-qc.py
""" A script for checking data integrity of the Rfam-miRBase sync. """ from utils import db_utils as db def verify_thresholds(): """ Manually export a file with manually assigned thresholds for each family, then compare with the thresholds of microRNA families in the database. Example data: 60 RF...
Add a new script for checking data integrity
Add a new script for checking data integrity
Python
apache-2.0
Rfam/rfam-production,Rfam/rfam-production,Rfam/rfam-production
--- +++ @@ -0,0 +1,45 @@ +""" +A script for checking data integrity of the Rfam-miRBase sync. +""" + +from utils import db_utils as db + + +def verify_thresholds(): + """ + Manually export a file with manually assigned thresholds for each family, + then compare with the thresholds of microRNA families in the...
b0925bcdf1fc50cf41764b6eb24431661d655820
examples/pipes-reply.py
examples/pipes-reply.py
import sys import code from diesel import Application, Pipe, until def readcb(): print 'Diesel Console' while 1: sys.stdout.write('>>> ') sys.stdout.flush() input = yield until("\n") ret = code.compile_command(input) out = eval(ret) if out: print 'Ou...
Add example of using stdin pipe and creating a very simple repl
Add example of using stdin pipe and creating a very simple repl
Python
bsd-3-clause
dieseldev/diesel
--- +++ @@ -0,0 +1,19 @@ +import sys +import code + +from diesel import Application, Pipe, until + +def readcb(): + print 'Diesel Console' + while 1: + sys.stdout.write('>>> ') + sys.stdout.flush() + input = yield until("\n") + ret = code.compile_command(input) + out = eval(re...
9989744da92fe16f2bb84e3db55282eba250ad8f
web/tests/test_templates.py
web/tests/test_templates.py
from django.test import TestCase from django.template.loader import render_to_string class TestTemplates(TestCase): def test_comparecard(self): # no code and no comment rendered_template_1 = render_to_string("comparecard.html", {}).strip() self.assertEquals( rendered_template_...
Add test file for templates with initial test for comparecard.html
Add test file for templates with initial test for comparecard.html
Python
agpl-3.0
codethesaurus/codethesaur.us,codethesaurus/codethesaur.us
--- +++ @@ -0,0 +1,76 @@ +from django.test import TestCase +from django.template.loader import render_to_string + + +class TestTemplates(TestCase): + + def test_comparecard(self): + # no code and no comment + rendered_template_1 = render_to_string("comparecard.html", {}).strip() + self.assertE...
441396ff44ab816ef26816eb3f8e0ec61851e9ba
ensemble/ctf/tests/test_editor.py
ensemble/ctf/tests/test_editor.py
import unittest from enable.testing import EnableTestAssistant from enable.window import Window from ensemble.ctf.editor import CtfEditor def get_color(starting_color=None): if starting_color: return starting_color return (0.0, 1.0, 0.0) def get_filename(action='save'): return 'temp.json' cl...
Add some unit tests for CtfEditor
Add some unit tests for CtfEditor
Python
bsd-3-clause
dmsurti/ensemble
--- +++ @@ -0,0 +1,43 @@ +import unittest + +from enable.testing import EnableTestAssistant +from enable.window import Window + +from ensemble.ctf.editor import CtfEditor + + +def get_color(starting_color=None): + if starting_color: + return starting_color + return (0.0, 1.0, 0.0) + + +def get_filename(a...
a7e4a476936d47435806b9a79877653e25b2a624
tests/test_serialize.py
tests/test_serialize.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Check if pickle can serialize seabird's data objects """ import os from glob import glob import pickle import numpy as np from seabird import cnv def test_serialize_CNV(): """ Serialize CNV """ datadir = os.path.join(os.path.dirname(__file...
Test if pickle can serialize CNV/fCNV
Test if pickle can serialize CNV/fCNV This is crucial to use seabird objects in multiprocessings.
Python
bsd-3-clause
castelao/seabird
--- +++ @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" Check if pickle can serialize seabird's data objects + +""" + +import os +from glob import glob +import pickle + +import numpy as np + +from seabird import cnv + + +def test_serialize_CNV(): + """ Serialize CNV + """ + ...
77d253afd27503767958ddc2ef41b8732d04eace
apps/domain/src/main/core/manager/database_manager.py
apps/domain/src/main/core/manager/database_manager.py
from typing import Dict from typing import Type from typing import Union from typing import List from ..database import BaseModel, db class DatabaseManager: def register(self, **kwargs) -> BaseModel: """Register e new object into the database. Args: parameters : List of object paramet...
ADD Abstract Database Manager class
ADD Abstract Database Manager class
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
--- +++ @@ -0,0 +1,51 @@ +from typing import Dict +from typing import Type +from typing import Union +from typing import List +from ..database import BaseModel, db + + +class DatabaseManager: + def register(self, **kwargs) -> BaseModel: + """Register e new object into the database. + Args: + ...
0fae3ec1526e2f2c566d137389d978b566756d16
TWLight/resources/management/commands/migrate_tags_to_new_tags.py
TWLight/resources/management/commands/migrate_tags_to_new_tags.py
from django.core.management.base import BaseCommand from TWLight.resources.models import Partner class Command(BaseCommand): help = "Migrates content from the tags column to the new_tags column" def handle(self, *args, **options): partners = Partner.objects.all() for partner in partners: ...
Add management command to migrate tags to new_tags field
Add management command to migrate tags to new_tags field
Python
mit
WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight
--- +++ @@ -0,0 +1,29 @@ +from django.core.management.base import BaseCommand + +from TWLight.resources.models import Partner + + +class Command(BaseCommand): + help = "Migrates content from the tags column to the new_tags column" + + def handle(self, *args, **options): + partners = Partner.objects.all()...
2718b1accc110be6e85983c6ffc29d8aba0d72cf
analysis/sbx-patch-bug.py
analysis/sbx-patch-bug.py
#!/usr/bin/env python # vim: set sw=2 ts=2 softtabstop=2 expandtab: """ This script is designed to patch old symbooglix results where hitting speculative paths was incorrect treated as BOUND_HIT """ import argparse import os import logging import sys import yaml from br_util import FinalResultType, classifyResult try:...
Add script to patch old symbooglix results when boogie-runner classified hitting speculative paths as BOUND_HIT. This was a bad idea so this script changes those results to UNKNOWN but note we have the ``speculative_paths_nb`` attribute so that can be used to find the results where symbooglix hit speculative paths.
Add script to patch old symbooglix results when boogie-runner classified hitting speculative paths as BOUND_HIT. This was a bad idea so this script changes those results to UNKNOWN but note we have the ``speculative_paths_nb`` attribute so that can be used to find the results where symbooglix hit speculative paths.
Python
bsd-3-clause
symbooglix/boogie-runner,symbooglix/boogie-runner
--- +++ @@ -0,0 +1,91 @@ +#!/usr/bin/env python +# vim: set sw=2 ts=2 softtabstop=2 expandtab: +""" +This script is designed to patch old symbooglix +results where hitting speculative paths was incorrect +treated as BOUND_HIT +""" +import argparse +import os +import logging +import sys +import yaml +from br_util impo...
eed235542f5b53245e36d3e07857f57eba4ad136
backend/projectfiles/MavenProjectFile.py
backend/projectfiles/MavenProjectFile.py
from backend.projectfiles import GenericProjectFile from bs4 import BeautifulSoup class MavenProjectFile(GenericProjectFile): """ Maven project file implementation to extract dependencies """ def extract(self): dependencies = [] root = BeautifulSoup(self.result.text) for dependency in ...
Add project file class for Maven
Add project file class for Maven
Python
apache-2.0
karllindmark/IsYourProjectUpToDate,karllindmark/IsYourProjectUpToDate
--- +++ @@ -0,0 +1,14 @@ +from backend.projectfiles import GenericProjectFile +from bs4 import BeautifulSoup + +class MavenProjectFile(GenericProjectFile): + """ Maven project file implementation to extract dependencies """ + def extract(self): + dependencies = [] + + root = BeautifulSoup(self.res...
4162271bf3c96188c43dab98f26c216347853ead
braubuddy/tests/thermometer/test_auto.py
braubuddy/tests/thermometer/test_auto.py
""" Braubuddy Dummy thermometer unit tests. """ import unittest from mock import patch, call, MagicMock from braubuddy.thermometer import auto from braubuddy.thermometer import dummy from braubuddy.thermometer import ds18b20_gpio from braubuddy.thermometer import temper_usb from braubuddy.thermometer import Device...
Add test from dummy thermometer.
Add test from dummy thermometer.
Python
bsd-3-clause
amorphic/braubuddy,amorphic/braubuddy,amorphic/braubuddy
--- +++ @@ -0,0 +1,24 @@ +""" +Braubuddy Dummy thermometer unit tests. +""" + +import unittest +from mock import patch, call, MagicMock +from braubuddy.thermometer import auto +from braubuddy.thermometer import dummy +from braubuddy.thermometer import ds18b20_gpio +from braubuddy.thermometer import temper_usb +fr...
4cdc120fbf654a6ce43bdb455ce89f7524ef9cd4
images/demo/ipython_notebook_config.py
images/demo/ipython_notebook_config.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Configuration file for ipython-notebook. c = get_config() c.NotebookApp.ip = '*' c.NotebookApp.open_browser = False c.NotebookApp.port = 8888 # Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded- # For headerssent by the upstream reverse proxy...
Configure the IPython notebook user settings
Configure the IPython notebook user settings
Python
bsd-3-clause
marscher/tmpnb,willjharmer/tmpnb,marscher/tmpnb,ianabc/tmpnb,willjharmer/tmpnb,parente/tmpnb,betatim/tmpnb,iamjakob/tmpnb,jupyter/tmpnb,ianabc/tmpnb,iamjakob/tmpnb,captainsafia/tmpnb,cannin/tmpnb,zischwartz/tmpnb,malev/tmpnb,ianabc/tmpnb,ianabc/tmpnb,parente/tmpnb,parente/tmpnb,jupyter/tmpnb,betatim/tmpnb,rgbkrk/tmpnb,...
--- +++ @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Configuration file for ipython-notebook. + +c = get_config() +c.NotebookApp.ip = '*' +c.NotebookApp.open_browser = False +c.NotebookApp.port = 8888 + +# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded- +# For he...
86a41fd90c6eb501d44a8bdca118f32cf5a1728c
ideascube/conf/kb_nic_nicarali.py
ideascube/conf/kb_nic_nicarali.py
# -*- coding: utf-8 -*- """KoomBook conf""" from .kb import * # noqa LANGUAGE_CODE = 'es' IDEASCUBE_NAME = 'Nicarali' HOME_CARDS = STAFF_HOME_CARDS + [ { 'id': 'blog', }, { 'id': 'mediacenter', }, { 'id': 'gutenberg', 'lang': 'es', }, { 'id': 'wikipe...
Add conf file for Nicarali project
Add conf file for Nicarali project
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +"""KoomBook conf""" +from .kb import * # noqa + +LANGUAGE_CODE = 'es' +IDEASCUBE_NAME = 'Nicarali' +HOME_CARDS = STAFF_HOME_CARDS + [ + { + 'id': 'blog', + }, + { + 'id': 'mediacenter', + }, + { + 'id': 'gutenberg', + 'lang...
2ec1007160dce53b5110f85b1529d2510f601c20
sympy/simplify/tests/test_function.py
sympy/simplify/tests/test_function.py
""" Unit tests for Hyper_Function""" from sympy.core import symbols, Dummy, Tuple from sympy.functions import hyper from sympy.simplify.hyperexpand import Hyper_Function def test_attrs(): a, b = symbols('a, b', cls=Dummy) f = Hyper_Function([2, a], [b]) assert f.ap == Tuple(2, a) assert f.bq == Tuple(...
Add simple tests for Hyper_Function
Add simple tests for Hyper_Function
Python
bsd-3-clause
souravsingh/sympy,saurabhjn76/sympy,beni55/sympy,jaimahajan1997/sympy,lidavidm/sympy,Titan-C/sympy,wanglongqi/sympy,abloomston/sympy,madan96/sympy,MechCoder/sympy,Titan-C/sympy,saurabhjn76/sympy,liangjiaxing/sympy,AkademieOlympia/sympy,AkademieOlympia/sympy,cswiercz/sympy,toolforger/sympy,wyom/sympy,grevutiu-gabriel/sy...
--- +++ @@ -0,0 +1,25 @@ +""" Unit tests for Hyper_Function""" +from sympy.core import symbols, Dummy, Tuple +from sympy.functions import hyper + +from sympy.simplify.hyperexpand import Hyper_Function + +def test_attrs(): + a, b = symbols('a, b', cls=Dummy) + f = Hyper_Function([2, a], [b]) + assert f.ap == ...
42c79ec4fb98ee0964a70fa1872b674ec74e0b4e
vumi/scripts/tests/test_db_backup.py
vumi/scripts/tests/test_db_backup.py
"""Tests for vumi.scripts.db_backup.""" from twisted.trial.unittest import TestCase from vumi.tests.utils import PersistenceMixin from vumi.scripts.db_backup import ConfigHolder, Options class TestConfigHolder(ConfigHolder): def __init__(self, *args, **kwargs): self.output = [] super(TestConfig...
Test skeleton for db backup scripts.
Test skeleton for db backup scripts.
Python
bsd-3-clause
harrissoerja/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,TouK/vumi,harrissoerja/vumi
--- +++ @@ -0,0 +1,52 @@ +"""Tests for vumi.scripts.db_backup.""" + +from twisted.trial.unittest import TestCase + +from vumi.tests.utils import PersistenceMixin + +from vumi.scripts.db_backup import ConfigHolder, Options + + +class TestConfigHolder(ConfigHolder): + def __init__(self, *args, **kwargs): + se...
1b2d39169b3c1f62c444dade33a0e89bcf63edff
lfs_paypal/migrations/0002_auto_20170309_0820.py
lfs_paypal/migrations/0002_auto_20170309_0820.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-09 08:20 from __future__ import unicode_literals from django.db import migrations def update_price_calculator(apps, schema_editor): PaymentMethod = apps.get_model("payment", "PaymentMethod") for payment_method in PaymentMethod.objects.all(): ...
Add data migrations for new processor place
Add data migrations for new processor place
Python
bsd-3-clause
diefenbach/lfs-paypal
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-09 08:20 +from __future__ import unicode_literals + +from django.db import migrations + + +def update_price_calculator(apps, schema_editor): + PaymentMethod = apps.get_model("payment", "PaymentMethod") + for payment_metho...
dcee3c876c470d5a339caf36ed888fc40245f70a
altair/examples/window_rank.py
altair/examples/window_rank.py
""" Window Rank Line Chart ---------------------- This example shows the Group F rankings in the 2018 World Cup after each matchday. A window transformation is used to rank each after each match day, sorting by points and difference. """ # category: case studies import altair as alt import pandas as pd source = pd.Da...
Add example for World Cup rankings with window transformation
DOC: Add example for World Cup rankings with window transformation
Python
bsd-3-clause
jakevdp/altair,altair-viz/altair
--- +++ @@ -0,0 +1,42 @@ +""" +Window Rank Line Chart +---------------------- +This example shows the Group F rankings in the 2018 World Cup after each matchday. +A window transformation is used to rank each after each match day, sorting by points and difference. +""" +# category: case studies +import altair as alt ...
d722f788c231a8dedc6ed2a48efc97195c82d7b7
tests/test_elasticsearch_processor.py
tests/test_elasticsearch_processor.py
import utils from scrapi.linter.document import NormalizedDocument, RawDocument from scrapi.processing.elastic_search import es, ElasticsearchProcessor test_db = ElasticsearchProcessor() RAW = RawDocument(utils.RAW_DOC) NORMALIZED = NormalizedDocument(utils.RECORD) def test_process_normalized(): NORMALIZED['s...
Add tests for new elasticsearch processor
Add tests for new elasticsearch processor
Python
apache-2.0
felliott/scrapi,jeffreyliu3230/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,mehanig/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,icereval/scrapi,fabianvf/scrapi,alexgarciac/scrapi,fabianvf/scrapi,erinspace/scrapi,ostwald/scrapi
--- +++ @@ -0,0 +1,36 @@ +import utils + +from scrapi.linter.document import NormalizedDocument, RawDocument +from scrapi.processing.elastic_search import es, ElasticsearchProcessor + +test_db = ElasticsearchProcessor() + + +RAW = RawDocument(utils.RAW_DOC) +NORMALIZED = NormalizedDocument(utils.RECORD) + + +def test...
00c45c62b8b58309dd4599c5ba9ccee6062c09a0
libcloud/test/storage/test_scaleway.py
libcloud/test/storage/test_scaleway.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
Add simple test for scalewa storage driver
Add simple test for scalewa storage driver
Python
apache-2.0
apache/libcloud,apache/libcloud,apache/libcloud,mistio/libcloud,mistio/libcloud,mistio/libcloud
--- +++ @@ -0,0 +1,56 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (...
9b26f0f6a08a289882bd8f51159c265e9e499a95
test/test_notification_integration.py
test/test_notification_integration.py
import os import select import groundstation.fs_watcher as fs_watcher from groundstation.peer_socket import PeerSocket from integration_fixture import StationIntegrationFixture, \ TestListener, \ TestClient class StationFSWatcherIntegration(StationInteg...
Test that watchers send newobject requests
Test that watchers send newobject requests
Python
mit
richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation
--- +++ @@ -0,0 +1,40 @@ +import os +import select + +import groundstation.fs_watcher as fs_watcher +from groundstation.peer_socket import PeerSocket + +from integration_fixture import StationIntegrationFixture, \ + TestListener, \ + TestClient + +class St...
2937aeda6e30f3bddbd9bee660ee5390ebfebf42
app/soc/views/helper/url_patterns.py
app/soc/views/helper/url_patterns.py
#!/usr/bin/env python2.5 # # Copyright 2011 the Melange authors. # # 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 applic...
Add a url_pattern module for soc core views.
Add a url_pattern module for soc core views. This module contains the URL patters for site-wide views like Host related views. --HG-- extra : rebase_source : 3b1398c5149664d63f0d84df2040791995461152
Python
apache-2.0
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
--- +++ @@ -0,0 +1,49 @@ +#!/usr/bin/env python2.5 +# +# Copyright 2011 the Melange authors. +# +# 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/LICEN...
9f9c40a98ea058eec7b586a0e0b87acd1adf50f7
scoring/import_bucs.py
scoring/import_bucs.py
import csv from django.template.defaultfilters import slugify from core.models import Bowstyle, Club, Archer from entries.models import CompetitionEntry, SessionEntry, SessionRound, Competition, TargetAllocation competition = Competition.objects.get(slug='bucs-indoors-2012') session_rounds = SessionRound.objects.filt...
Add a csv import script (specific to BUCS)
Add a csv import script (specific to BUCS)
Python
bsd-3-clause
mjtamlyn/archery-scoring,mjtamlyn/archery-scoring,mjtamlyn/archery-scoring,mjtamlyn/archery-scoring,mjtamlyn/archery-scoring
--- +++ @@ -0,0 +1,51 @@ +import csv +from django.template.defaultfilters import slugify + +from core.models import Bowstyle, Club, Archer +from entries.models import CompetitionEntry, SessionEntry, SessionRound, Competition, TargetAllocation + +competition = Competition.objects.get(slug='bucs-indoors-2012') +session...
704d92ae4a371681254704757a01ab3c57b6b92a
oscar/templatetags/currency_filters.py
oscar/templatetags/currency_filters.py
import locale from django import template from django.conf import settings register = template.Library() @register.filter(name='currency') def currency(value): """ Return value converted to a locale currency """ try: locale.setlocale(locale.LC_ALL, settings.LOCALE) except AttributeError:...
import locale from django import template from django.conf import settings register = template.Library() @register.filter(name='currency') def currency(value): """ Format decimal value as currency """ try: locale.setlocale(locale.LC_ALL, settings.LOCALE) except AttributeError: lo...
Enhance currency filter to allow format string to be specified
Enhance currency filter to allow format string to be specified This allows the positioning of the currency symbol to be controlled. Fixes #311
Python
bsd-3-clause
nfletton/django-oscar,Idematica/django-oscar,manevant/django-oscar,nickpack/django-oscar,WillisXChen/django-oscar,ahmetdaglarbas/e-commerce,jinnykoo/christmas,bnprk/django-oscar,makielab/django-oscar,monikasulik/django-oscar,eddiep1101/django-oscar,pdonadeo/django-oscar,jinnykoo/christmas,bnprk/django-oscar,josesanch/d...
--- +++ @@ -9,20 +9,28 @@ @register.filter(name='currency') def currency(value): """ - Return value converted to a locale currency + Format decimal value as currency """ try: locale.setlocale(locale.LC_ALL, settings.LOCALE) except AttributeError: locale.setlocale(locale.L...
4395f0b6e708e7a18f1d25b0d897782e2df86d1c
migrations/versions/2439eea5b23c_.py
migrations/versions/2439eea5b23c_.py
"""empty message Revision ID: 2439eea5b23c Revises: 577ad345788e Create Date: 2015-11-23 14:04:45.572638 """ # revision identifiers, used by Alembic. revision = '2439eea5b23c' down_revision = '577ad345788e' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): ...
Add database migration for QuestionnaireResponse model
Add database migration for QuestionnaireResponse model
Python
bsd-3-clause
uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal
--- +++ @@ -0,0 +1,34 @@ +"""empty message + +Revision ID: 2439eea5b23c +Revises: 577ad345788e +Create Date: 2015-11-23 14:04:45.572638 + +""" + +# revision identifiers, used by Alembic. +revision = '2439eea5b23c' +down_revision = '577ad345788e' + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dial...
b7f3b2411085bf507d52888bc7f99f07c170a462
core/migrations/0048_helplink.py
core/migrations/0048_helplink.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0047_add_email_template'), ] operations = [ migrations.CreateModel( name='HelpLink', fields=...
Add 0048 - HelpLink migration
Add 0048 - HelpLink migration
Python
apache-2.0
CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0047_add_email_template'), + ] + + operations = [ + migrations.CreateModel( + ...
3fedc491c93f96759ee18fc8a6b212b3f788a307
python/gaming-laptop-battery-life.py
python/gaming-laptop-battery-life.py
# Problem Solving (Basic) Skill Verification Test #!/bin/python3 import math import os import random import re import sys # # Complete the 'getBattery' function below. # # The function is expected to return an INTEGER. # The function accepts INTEGER_ARRAY events as parameter. # def getBattery(events): battery_l...
Solve gaming laptop battery life
Solve gaming laptop battery life
Python
mit
rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank
--- +++ @@ -0,0 +1,48 @@ +# Problem Solving (Basic) Skill Verification Test + +#!/bin/python3 + +import math +import os +import random +import re +import sys + +# +# Complete the 'getBattery' function below. +# +# The function is expected to return an INTEGER. +# The function accepts INTEGER_ARRAY events as parameter...
7b2386f844abf8b2dcad6b540e88e065a5c091c8
scripts/consistency/fix_is_claimed.py
scripts/consistency/fix_is_claimed.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Script to migrate nodes with invalid categories.""" import sys import logging from modularodm import Q from website.app import init_app from website.models import User from scripts import utils as script_utils logger = logging.getLogger('fix_is_claimed') def main(d...
Add migration script to migrate users whose is_claimed field is None
Add migration script to migrate users whose is_claimed field is None h/t @icereval [skip ci]
Python
apache-2.0
cwisecarver/osf.io,RomanZWang/osf.io,kch8qx/osf.io,samchrisinger/osf.io,DanielSBrown/osf.io,billyhunt/osf.io,samchrisinger/osf.io,danielneis/osf.io,samchrisinger/osf.io,erinspace/osf.io,HarryRybacki/osf.io,caseyrollins/osf.io,saradbowman/osf.io,billyhunt/osf.io,SSJohns/osf.io,saradbowman/osf.io,petermalcolm/osf.io,fabi...
--- +++ @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""Script to migrate nodes with invalid categories.""" + +import sys +import logging + +from modularodm import Q + +from website.app import init_app +from website.models import User +from scripts import utils as script_utils + +logger = logging...
b1482368b19e75f1ac679ba398af31319f8beb6d
demos/benchmark/gen_benchmark.py
demos/benchmark/gen_benchmark.py
#!/usr/bin/env python # # A simple benchmark of the tornado.gen module. # Runs in two modes, testing new-style (@coroutine and Futures) # and old-style (@engine and Tasks) coroutines. from timeit import Timer from tornado import gen from tornado.options import options, define, parse_command_line define('num', defaul...
Add a benchmark for coroutine processing.
Add a benchmark for coroutine processing.
Python
apache-2.0
ZhuPeng/tornado,gwillem/tornado,wechasing/tornado,andyaguiar/tornado,Polyconseil/tornado,kevinge314gh/tornado,insflow/tornado,ZhuPeng/tornado,icejoywoo/tornado,Polyconseil/tornado,pombredanne/tornado,hzruandd/tornado,ajdavis/tornado,kaushik94/tornado,sunjeammy/tornado,jarrahwu/tornado,kevinge314gh/tornado,leekchan/torn...
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# +# A simple benchmark of the tornado.gen module. +# Runs in two modes, testing new-style (@coroutine and Futures) +# and old-style (@engine and Tasks) coroutines. + +from timeit import Timer + +from tornado import gen +from tornado.options import options, define, par...
09d267808e69217bca37089fbd8907392eaa96ab
pox/forwarding/l2_learning_tutorial.py
pox/forwarding/l2_learning_tutorial.py
# Copyright 2011 James McCauley # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # POX is distri...
Add simplest learning switch ever
forwarding: Add simplest learning switch ever
Python
apache-2.0
diogommartins/pox,pthien92/sdn,adusia/pox,diogommartins/pox,diogommartins/pox,chenyuntc/pox,adusia/pox,adusia/pox,chenyuntc/pox,denovogroup/pox,diogommartins/pox,carlye566/IoT-POX,pthien92/sdn,carlye566/IoT-POX,xAKLx/pox,jacobq/csci5221-viro-project,PrincetonUniversity/pox,adusia/pox,kavitshah8/SDNDeveloper,Vamsikrishn...
--- +++ @@ -0,0 +1,66 @@ +# Copyright 2011 James McCauley +# +# This file is part of POX. +# +# POX is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) a...
cf657b6f9744d4b53a32db51752677eaaf2ec998
migrations/versions/7791f2c862d2_.py
migrations/versions/7791f2c862d2_.py
"""Adds TimeExercisesHistory and TimeExercisesTaxonomy Tables Revision ID: 7791f2c862d2 Revises: 56630a78dca0 Create Date: 2017-07-30 20:40:17.174425 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '7791f2c862d2' down_revision = '56630a78dca0' branch_labels = N...
Upgrade to add Time based exercises tables
Upgrade to add Time based exercises tables
Python
mit
pbraunstein/trackercise,pbraunstein/trackercise,pbraunstein/trackercise,pbraunstein/trackercise,pbraunstein/trackercise
--- +++ @@ -0,0 +1,41 @@ +"""Adds TimeExercisesHistory and TimeExercisesTaxonomy Tables + +Revision ID: 7791f2c862d2 +Revises: 56630a78dca0 +Create Date: 2017-07-30 20:40:17.174425 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '7791f2c862d2' +down_re...
1f61ac74ed7a00d642fa94944cbce3ebc4690e9c
scripts/index-g6-in-elasticsearch.py
scripts/index-g6-in-elasticsearch.py
#!/usr/bin/python '''Process G6 JSON files into elasticsearch This version reads G6 JSON from disk or DM API. Usage: process-g6-into-elastic-search.py <es_endpoint> <dir_or_endpoint> [<token>] Arguments: es_endpoint Full ES index URL dir_or_endpoint Directory path to import or an API URL if token i...
Move ElasticSearch import script from buyer-frontend into search-api
Move ElasticSearch import script from buyer-frontend into search-api This script should have moved when the search-api was split off from the buyer-frontend app.
Python
mit
alphagov/digitalmarketplace-search-api,RichardKnop/digitalmarketplace-search-api,alphagov/digitalmarketplace-search-api,RichardKnop/digitalmarketplace-search-api,RichardKnop/digitalmarketplace-search-api,RichardKnop/digitalmarketplace-search-api
--- +++ @@ -0,0 +1,91 @@ +#!/usr/bin/python +'''Process G6 JSON files into elasticsearch + +This version reads G6 JSON from disk or DM API. + +Usage: + process-g6-into-elastic-search.py <es_endpoint> <dir_or_endpoint> [<token>] + +Arguments: + es_endpoint Full ES index URL + dir_or_endpoint Directory p...
c4013140720f3fd9d128c1cbaa3554436ecf360f
migrations/versions/0185_add_is_active_to_reply_tos.py
migrations/versions/0185_add_is_active_to_reply_tos.py
""" Revision ID: 0185_add_is_active_to_reply_tos Revises: 0184_alter_primary_key_1 Create Date: 2018-04-10 16:35:41.824981 """ from alembic import op import sqlalchemy as sa revision = '0185_add_is_active_to_reply_tos' down_revision = '0184_alter_primary_key_1' def upgrade(): op.add_column('service_email_repl...
Add is_active column for the 3 reply_to tables
Add is_active column for the 3 reply_to tables Added a new boolean column, `is_active` to these tables * service_email_reply_to * service_sms_senders * service_letter_contacts This has a database default of True in order to backfill the data, but this default will be replaced with a model default later.
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,25 @@ +""" + +Revision ID: 0185_add_is_active_to_reply_tos +Revises: 0184_alter_primary_key_1 +Create Date: 2018-04-10 16:35:41.824981 + +""" +from alembic import op +import sqlalchemy as sa + + +revision = '0185_add_is_active_to_reply_tos' +down_revision = '0184_alter_primary_key_1' + + +def upgra...
51256756897c1e504dab670abbe71fbb5971f9d5
src/gcf/geni/am/api_error_exception.py
src/gcf/geni/am/api_error_exception.py
#---------------------------------------------------------------------- # Copyright (c) 2012-2015 Raytheon BBN Technologies # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and/or hardware specification (the "Work") to # deal in the Work without restriction, including ...
Rework the patch to handle ApiErrorException in a generic way in AMMethodContext. Create a specific file for ApiErrorException so as to be able to import it from am3.py and am_method_context.py.
Rework the patch to handle ApiErrorException in a generic way in AMMethodContext. Create a specific file for ApiErrorException so as to be able to import it from am3.py and am_method_context.py.
Python
mit
tcmitchell/geni-tools,ahelsing/geni-tools,plantigrade/geni-tools,plantigrade/geni-tools,ahelsing/geni-tools,tcmitchell/geni-tools
--- +++ @@ -0,0 +1,38 @@ +#---------------------------------------------------------------------- +# Copyright (c) 2012-2015 Raytheon BBN Technologies +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and/or hardware specification (the "Work") to +# deal in the Wor...
00ec33f227feabbfc97230048d56ef0966f2ace5
test/python/tests/test_conversion.py
test/python/tests/test_conversion.py
import util import sys class test_conversion: def init(self): yield "a = M.arange(1);" def test_float(self, cmd): cmd += "res = float(a);" return cmd def test_int(self, cmd): cmd += "res = int(a);" return cmd if sys.version_info[0] < 3: def test_oct(se...
Test conversion (e.g. float()) works
Test conversion (e.g. float()) works
Python
apache-2.0
madsbk/bohrium,bh107/bohrium,madsbk/bohrium,madsbk/bohrium,bh107/bohrium,madsbk/bohrium,bh107/bohrium,bh107/bohrium
--- +++ @@ -0,0 +1,27 @@ +import util +import sys + +class test_conversion: + def init(self): + yield "a = M.arange(1);" + + def test_float(self, cmd): + cmd += "res = float(a);" + return cmd + + def test_int(self, cmd): + cmd += "res = int(a);" + return cmd + + if sys.v...
b6b57d4d693b1194b3606eeb9146a89dae435b6e
indra/databases/pubmed_client.py
indra/databases/pubmed_client.py
import urllib, urllib2 import xml.etree.ElementTree as ET pubmed_search = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi' pubmed_fetch = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi' def send_request(url, data): try: req = urllib2.Request(url, data) res = urllib2.urlopen(r...
Add API for searching all PubMed abstracts and downloading the abstract text.
Add API for searching all PubMed abstracts and downloading the abstract text.
Python
bsd-2-clause
johnbachman/indra,sorgerlab/indra,jmuhlich/indra,pvtodorov/indra,johnbachman/belpy,johnbachman/indra,bgyori/indra,johnbachman/indra,sorgerlab/belpy,jmuhlich/indra,sorgerlab/belpy,sorgerlab/indra,pvtodorov/indra,jmuhlich/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy...
--- +++ @@ -0,0 +1,51 @@ +import urllib, urllib2 +import xml.etree.ElementTree as ET + +pubmed_search = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi' +pubmed_fetch = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi' + +def send_request(url, data): + try: + req = urllib2.Request(url, d...
52e9c35d245184c254e088a52ba6c12f69313137
app/timetables/migrations/0008_auto_20160913_2203.py
app/timetables/migrations/0008_auto_20160913_2203.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-09-13 22:03 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependen...
Make migration file for Timetables administratorship
Make migration file for Timetables administratorship
Python
mit
teamtaverna/core
--- +++ @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-13 22:03 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = ...
5702b080695818273463667045d9622ad9b02694
apps/challenge/migrations/0051_auto_20181019_1411.py
apps/challenge/migrations/0051_auto_20181019_1411.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2018-10-19 12:11 from __future__ import unicode_literals from django.db import migrations import multiselectfield.db.fields class Migration(migrations.Migration): dependencies = [ ('challenge', '0050_historicalhelperseasonworkwish_historicalhelper...
Add missing migration for some reason
Add missing migration for some reason
Python
agpl-3.0
defivelo/db,defivelo/db,defivelo/db
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2018-10-19 12:11 +from __future__ import unicode_literals + +from django.db import migrations +import multiselectfield.db.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('challenge', '0050_historic...
ff9d6bc72673843fcdf6f7e0d866beec5bdb45f0
mezzanine/accounts/models.py
mezzanine/accounts/models.py
from django.db.models.signals import post_save from django.dispatch import receiver from mezzanine.utils.models import get_user_model from mezzanine.accounts import get_profile_model, get_profile_user_fieldname # Signal for ensuring users have a profile instance. Profile = get_profile_model() User = get_user_model()...
from django.db import connection from django.db.models.signals import post_save from django.db.utils import DatabaseError from django.dispatch import receiver from mezzanine.utils.models import get_user_model from mezzanine.accounts import get_profile_model, get_profile_user_fieldname # Signal for ensuring users ha...
Allow initial user creation in syncdb when a profile model is managed by migrations and doesn't yet exist.
Allow initial user creation in syncdb when a profile model is managed by migrations and doesn't yet exist.
Python
bsd-2-clause
jjz/mezzanine,cccs-web/mezzanine,stephenmcd/mezzanine,Kniyl/mezzanine,gradel/mezzanine,mush42/mezzanine,dekomote/mezzanine-modeltranslation-backport,eino-makitalo/mezzanine,dsanders11/mezzanine,cccs-web/mezzanine,christianwgd/mezzanine,scarcry/snm-mezzanine,theclanks/mezzanine,webounty/mezzanine,dovydas/mezzanine,nikol...
--- +++ @@ -1,4 +1,7 @@ + +from django.db import connection from django.db.models.signals import post_save +from django.db.utils import DatabaseError from django.dispatch import receiver from mezzanine.utils.models import get_user_model @@ -14,4 +17,11 @@ @receiver(post_save, sender=User) def user_sa...
f0f9df5020bfec920911ae1fecb2d480dbf8e3d5
prismriver/test/test_preprocessor.py
prismriver/test/test_preprocessor.py
from prismriver import preprocessor test_cases = [('Artist', 'Title', 'Artist', 'Title'), (' Artist', ' Title', 'Artist', 'Title'), ('Artist ', 'Title ', 'Artist', 'Title'), (' Artist ', ' Title ', 'Artist', 'Title')] def test(): for params in test_cases: yield...
Add test case for preprocessor
Add test case for preprocessor
Python
mit
anlar/prismriver-lyrics,anlar/prismriver-lyrics,anlar/prismriver,anlar/prismriver
--- +++ @@ -0,0 +1,17 @@ +from prismriver import preprocessor + +test_cases = [('Artist', 'Title', 'Artist', 'Title'), + (' Artist', ' Title', 'Artist', 'Title'), + ('Artist ', 'Title ', 'Artist', 'Title'), + (' Artist ', ' Title ', 'Artist', 'Title')] + + +def test(): + fo...
3500d3fc7aa8135dec16f3fbd63834a5e5e6958f
nuts/test/test_Evaluation.py
nuts/test/test_Evaluation.py
import pytest from src.data.Evaluation import Evaluation from src.data.EvaluationResult import EvaluationResult @pytest.fixture def example_evaluation(): evaluation = Evaluation("expected_result", "=") evaluation.evaluation_results.append(EvaluationResult("minion", "actual_result", True)) evaluation.evalu...
Add basic tests for Evaluation class
Add basic tests for Evaluation class
Python
mit
HSRNetwork/Nuts
--- +++ @@ -0,0 +1,35 @@ +import pytest +from src.data.Evaluation import Evaluation +from src.data.EvaluationResult import EvaluationResult + + +@pytest.fixture +def example_evaluation(): + evaluation = Evaluation("expected_result", "=") + evaluation.evaluation_results.append(EvaluationResult("minion", "actual_...
cff1286cfca16b75fc3b646c32277976b1c53169
data_analysis/get_model_statistics.py
data_analysis/get_model_statistics.py
# -*- coding: utf-8 -*- """Script which can be used to compare the features obtained of two different influenza models Usage: get_model_statistics.py <model> [--country=<country_name>] [--no-future] [--basedir=<directory>] [--start-year=<start_year>] [--end-year=<end_year>] [--save] [--no-graph] <baseline> ...
Add file to get some basic statistics from the prediction.
Add file to get some basic statistics from the prediction.
Python
mit
geektoni/Influenza-Like-Illness-Predictor,geektoni/Influenza-Like-Illness-Predictor
--- +++ @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +"""Script which can be used to compare the features obtained of two different influenza models + +Usage: + get_model_statistics.py <model> [--country=<country_name>] [--no-future] [--basedir=<directory>] [--start-year=<start_year>] [--end-year=<end_year>] [--save]...
3dc718866905dbcf920c2c2cb5227c52e6069782
examples/timestamp-op-ret.py
examples/timestamp-op-ret.py
#!/usr/bin/python3 # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Example of timestamping a file via OP_RETURN""" import hashlib import bitcoin.rpc import sys from bitcoin.core import * from bitcoin.core.script import *...
Add timestamp via op-return example
Add timestamp via op-return example Quick-n-dirty
Python
mit
petertodd/dust-b-gone,petertodd/stealth-addresses-ref-implementation
--- +++ @@ -0,0 +1,64 @@ +#!/usr/bin/python3 + +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +"""Example of timestamping a file via OP_RETURN""" + +import hashlib +import bitcoin.rpc +import sys + +from bitcoin.core imp...
69783b41c719940081e08071c34a037ba0ea5b90
random_selection/random_selection.py
random_selection/random_selection.py
from random import randint import sys def select(arr, order): length = len(arr) if length == 1: return arr[0] pivot_index = randint(0, length-1) pivot = arr[pivot_index] swap(arr, 0, pivot_index) i = j = 1 while j < length: if arr[j] < pivot: swap(arr, j, i) i += 1 j += 1 swap(arr, 0, i-1) ...
Add linear randomized select algorithm
Add linear randomized select algorithm Using the partitioning priciple from quicksort, linear select finds the i-th smallest element in an array. It operates by partitioning around a pivot, checking whether the pivot index matches the desired order statistic, and either returning or recursing on the appropriate part o...
Python
mit
timpel/stanford-algs,timpel/stanford-algs
--- +++ @@ -0,0 +1,60 @@ +from random import randint +import sys + + +def select(arr, order): + length = len(arr) + + if length == 1: + return arr[0] + + pivot_index = randint(0, length-1) + pivot = arr[pivot_index] + + swap(arr, 0, pivot_index) + + i = j = 1 + + while j < length: + if arr[j] < pivot: + swap(arr...
d476fbb92bf30becdbbd6b5bc8458fae09ff88a5
comrade/core/managers.py
comrade/core/managers.py
from django.db import models class QuerySetManager(models.Manager): def __getattr__(self, name, *args): if name.startswith('_'): raise AttributeError return getattr(self.get_query_set(), name, *args) def get_query_set(self): return self.model.QuerySet(self.model)
Add QuerySet manager, for implementing chainable filters.
Add QuerySet manager, for implementing chainable filters.
Python
mit
bueda/django-comrade
--- +++ @@ -0,0 +1,10 @@ +from django.db import models + +class QuerySetManager(models.Manager): + def __getattr__(self, name, *args): + if name.startswith('_'): + raise AttributeError + return getattr(self.get_query_set(), name, *args) + + def get_query_set(self): + return self....
5afae8a39345ef3d334817234177d656cf12cff3
scripts/bioinfo_project_status_update.py
scripts/bioinfo_project_status_update.py
#!/usr/bin/env python import argparse import os import yaml from genologics.lims import Lims from genologics.entities import Project from genologics.config import BASEURI, USERNAME, PASSWORD import LIMS2DB.utils as lutils from requests.exceptions import HTTPError def main(args): log = lutils.setupLog('bioinfolog...
Add script to update project closure in bioinfo_analysis db
Add script to update project closure in bioinfo_analysis db
Python
mit
SciLifeLab/LIMS2DB
--- +++ @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +import argparse +import os +import yaml +from genologics.lims import Lims +from genologics.entities import Project +from genologics.config import BASEURI, USERNAME, PASSWORD +import LIMS2DB.utils as lutils +from requests.exceptions import HTTPError + + +def main(args...
1cb0382eea48539618e1c36d7ae4ec22a0274aa5
usingnamespace/api/traversal/v1/__init__.py
usingnamespace/api/traversal/v1/__init__.py
# Package from .... import models as m class Root(object): """Root The main root object for v1 API traversal """ __name__ = None __parent__ = None def __init__(self, request): """Create the default root object :request: The Pyramid request object """ self._...
Add the new version 1 API root
Add the new version 1 API root
Python
isc
usingnamespace/usingnamespace
--- +++ @@ -0,0 +1,42 @@ +# Package + +from .... import models as m + +class Root(object): + """Root + + The main root object for v1 API traversal + """ + + __name__ = None + __parent__ = None + + def __init__(self, request): + """Create the default root object + + :request: The Pyrami...
8a5e29bf62e701b755767cfb7a31aeda434a0eac
lib/pyfrc/robotpy/boot.py
lib/pyfrc/robotpy/boot.py
import sys class RollbackImporter: def __init__(self): "Creates an instance and installs as the global importer" self.previousModules = sys.modules.copy() def uninstall(self): newmodules = sys.modules.copy() for modname in newmodules.keys(): if modname not in self.p...
Add robotpy files for uploading
Add robotpy files for uploading
Python
mit
robotpy/pyfrc
--- +++ @@ -0,0 +1,63 @@ +import sys + +class RollbackImporter: + def __init__(self): + "Creates an instance and installs as the global importer" + self.previousModules = sys.modules.copy() + + def uninstall(self): + newmodules = sys.modules.copy() + for modname in newmodules.keys():...
857a1abd601ad2f50d30dcaf3bc8fc5bafc59165
txircd/modules/extra/stats_uptime.py
txircd/modules/extra/stats_uptime.py
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import now from zope.interface import implements class StatsUptime(ModuleData): implements(IPlugin, IModuleData) name = "StatsUptime" def actions(self): return [ ("statsruntype-uptime", 10, self.disp...
Add STATS type to display server uptime
Add STATS type to display server uptime
Python
bsd-3-clause
Heufneutje/txircd
--- +++ @@ -0,0 +1,20 @@ +from twisted.plugin import IPlugin +from txircd.module_interface import IModuleData, ModuleData +from txircd.utils import now +from zope.interface import implements + +class StatsUptime(ModuleData): + implements(IPlugin, IModuleData) + + name = "StatsUptime" + + def actions(self): + return ...
038362a9965977f027ea4be6ce5bfd5ac496e04c
qtpy/tests/test_qtx11extras.py
qtpy/tests/test_qtx11extras.py
import sys import pytest from qtpy import PYQT6, PYSIDE2, PYSIDE6 from qtpy.tests.utils import using_conda # @pytest.mark.skipif( # PYQT6 or PYSIDE6, reason="Not availible on Qt6-based bindings") # @pytest.mark.skipif( # sys.platform != "win32" or using_conda(), # reason="Only available in Qt5 bindings > ...
Add placeholder test file for QtX11Extras
Add placeholder test file for QtX11Extras
Python
mit
spyder-ide/qtpy
--- +++ @@ -0,0 +1,17 @@ +import sys +import pytest + +from qtpy import PYQT6, PYSIDE2, PYSIDE6 +from qtpy.tests.utils import using_conda + +# @pytest.mark.skipif( +# PYQT6 or PYSIDE6, reason="Not availible on Qt6-based bindings") +# @pytest.mark.skipif( +# sys.platform != "win32" or using_conda(), +# rea...
5c2782ef0d6dfc292875d9a8577b6f104093fb78
peer_grading/peer_grading_service.py
peer_grading/peer_grading_service.py
def get_next_submission(student_id, location): """ Request the next submission to be peer graded. @param student_id: The student requesting to grade a peer. Must check to determine if the requesting student has submitted an answer of their own. @param location: The associated lo...
Create the service stub for peer grading This stub just has some doc and empty functions so we can discuss if the contract is reasonable, then potentially build on this frame.
Create the service stub for peer grading This stub just has some doc and empty functions so we can discuss if the contract is reasonable, then potentially build on this frame.
Python
agpl-3.0
nttks/edx-ora2,eestay/edx-ora2,Edraak/edx-ora2,nttks/edx-ora2,Lektorium-LLC/edx-ora2,ubc/edx-ora2,ubc/edx-ora2,Stanford-Online/edx-ora2,eestay/edx-ora2,EDUlib/edx-ora2,Edraak/edx-ora2,singingwolfboy/edx-ora2,edx/edx-ora2,Stanford-Online/edx-ora2,Lektorium-LLC/edx-ora2,EDUlib/edx-ora2,Stanford-Online/edx-ora2,singingwol...
--- +++ @@ -0,0 +1,34 @@ + + +def get_next_submission(student_id, location): + """ + Request the next submission to be peer graded. + @param student_id: The student requesting to grade a peer. Must check to determine if the requesting student has + submitted an answer of their own. + ...
b763ddb93c273f8641344866aa004c1798cf7234
py/minesweeper.py
py/minesweeper.py
class Solution(object): def updateBoard(self, board, click): """ :type board: List[List[str]] :type click: List[int] :rtype: List[List[str]] """ r = len(board) if r == 0: return board c = len(board[0]) if board[click[0]][click[1]] =...
Add py solution for 529. Minesweeper
Add py solution for 529. Minesweeper 529. Minesweeper: https://leetcode.com/problems/minesweeper/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,40 @@ +class Solution(object): + def updateBoard(self, board, click): + """ + :type board: List[List[str]] + :type click: List[int] + :rtype: List[List[str]] + """ + r = len(board) + if r == 0: + return board + c = len(board[0]) ...
3e2a52e27e702532ca198a815adda9a83e4b96f2
examples/test_checkboxes.py
examples/test_checkboxes.py
from seleniumbase import BaseCase class MyTestClass(BaseCase): def test_checkboxes_and_radio_buttons(self): self.open("https://www.w3schools.com/tags/tryit.asp" "?filename=tryhtml5_input_type_checkbox") self.switch_to_frame("iframeResult") checkbox = "input#vehicle2" ...
Add a test for checkboxes and radio buttons
Add a test for checkboxes and radio buttons
Python
mit
seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase
--- +++ @@ -0,0 +1,20 @@ +from seleniumbase import BaseCase + + +class MyTestClass(BaseCase): + + def test_checkboxes_and_radio_buttons(self): + self.open("https://www.w3schools.com/tags/tryit.asp" + "?filename=tryhtml5_input_type_checkbox") + self.switch_to_frame("iframeResult") + ...
704fa9ba20a0a05298eaf9146eafc158e1a5953a
temba/chatbase/tasks.py
temba/chatbase/tasks.py
from __future__ import print_function, unicode_literals import logging from celery.task import task from temba.orgs.models import Org from .models import Chatbase logger = logging.getLogger(__name__) @task(track_started=True, name='send_chatbase_event') def send_chatbase_event(org, channel, msg, contact): try...
Add task to chatbase call
Add task to chatbase call
Python
agpl-3.0
pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro
--- +++ @@ -0,0 +1,25 @@ +from __future__ import print_function, unicode_literals + +import logging + +from celery.task import task +from temba.orgs.models import Org +from .models import Chatbase + + +logger = logging.getLogger(__name__) + + +@task(track_started=True, name='send_chatbase_event') +def send_chatbase_e...
83b290b8d3da89d371ae88057472b838c5433471
cura/Settings/MaterialSettingsVisibilityHandler.py
cura/Settings/MaterialSettingsVisibilityHandler.py
# Copyright (c) 2017 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Settings.Models.SettingVisibilityHandler import SettingVisibilityHandler class MaterialSettingsVisibilityHandler(SettingVisibilityHandler): def __init__(self, parent = None, *args, **kwargs): super()...
# Copyright (c) 2017 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. import UM.Settings.Models.SettingVisibilityHandler class MaterialSettingsVisibilityHandler(UM.Settings.Models.SettingVisibilityHandler.SettingVisibilityHandler): def __init__(self, parent = None, *args, **kwargs): ...
Use full import path for parent class
Use full import path for parent class Something seems off with the build for some reason. I'm trying to fix it this way.
Python
agpl-3.0
hmflash/Cura,ynotstartups/Wanhao,ynotstartups/Wanhao,hmflash/Cura,Curahelper/Cura,fieldOfView/Cura,fieldOfView/Cura,Curahelper/Cura
--- +++ @@ -1,9 +1,9 @@ # Copyright (c) 2017 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. -from UM.Settings.Models.SettingVisibilityHandler import SettingVisibilityHandler +import UM.Settings.Models.SettingVisibilityHandler -class MaterialSettingsVisibilityHandler(SettingVisibil...
878aa1aa78b7895d2211d5cef392675512f19d6a
fullcalendar/migrations/0003_auto_20150430_2235.py
fullcalendar/migrations/0003_auto_20150430_2235.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('events', '0002_auto_20150321_1234'), ] operations = [ migrations.AlterField( model_name='eventcategory', ...
Add migration to remove the unique constraint.
Add migration to remove the unique constraint.
Python
mit
jonge-democraten/mezzanine-fullcalendar
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('events', '0002_auto_20150321_1234'), + ] + + operations = [ + migrations.AlterField( + ...
4ec2992737a256ad89ebee64885a0c6fd2bccc7b
tests/UselessSymbolsRemove/SimpleTest.py
tests/UselessSymbolsRemove/SimpleTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 17.08.2017 14:39 :Licence GNUv3 Part of grammpy-transforms """ from unittest import TestCase, main from grammpy import * from grammpy_transforms import ContextFree class S(Nonterminal): pass class A(Nonterminal): pass class B(Nonterminal): pass class RuleSt...
Create simple test for simple removing of useless symbols
Create simple test for simple removing of useless symbols
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 17.08.2017 14:39 +:Licence GNUv3 +Part of grammpy-transforms + +""" + +from unittest import TestCase, main +from grammpy import * +from grammpy_transforms import ContextFree + + +class S(Nonterminal): pass +class A(Nonterminal): p...
4340b4c1719761c7ebfbd0aba7a27a76604e6ddb
test/order/TestOrder.py
test/order/TestOrder.py
""" Test that debug symbols have the correct order as specified by the order file. """ import os, time import re import unittest import lldb import lldbtest class TestClassTypes(lldbtest.TestBase): mydir = "order" def test_order(self): """Test debug symbols follow the correct order by the order file...
Test that debug symbols have the correct order as specified by the order file.
Test that debug symbols have the correct order as specified by the order file. git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@107844 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb
--- +++ @@ -0,0 +1,39 @@ +""" +Test that debug symbols have the correct order as specified by the order file. +""" + +import os, time +import re +import unittest +import lldb +import lldbtest + +class TestClassTypes(lldbtest.TestBase): + + mydir = "order" + + def test_order(self): + """Test debug symbols...
44f5b9081fb7ce3718c879872aa73c281b0c181d
bin/extractpolygonfromgeojsonandaddtags.py
bin/extractpolygonfromgeojsonandaddtags.py
import json import sys import numpy as np from shapely.geometry import shape, Point f = open(sys.argv[1], 'r') js = json.load(f) f.close() tags = {} f = open(sys.argv[2], 'r') for line in f.readlines(): tag = line.split(': ') tags[tag[0]] = tag[1][:-1] #for feature in js['features']: feature = js['features']...
Create a geojson dedicated to the parcelle we are interested in
Create a geojson dedicated to the parcelle we are interested in
Python
agpl-3.0
24eme/cadatrava,24eme/cadatrava,24eme/cadatrava
--- +++ @@ -0,0 +1,29 @@ +import json +import sys +import numpy as np +from shapely.geometry import shape, Point + +f = open(sys.argv[1], 'r') +js = json.load(f) +f.close() + +tags = {} +f = open(sys.argv[2], 'r') +for line in f.readlines(): + tag = line.split(': ') + tags[tag[0]] = tag[1][:-1] + +#for feature ...
5486fead4457aa6b704ae1fbbffa0635a040b425
toolbox/sporo_data_preparation.py
toolbox/sporo_data_preparation.py
import vigra import argparse if __name__ == "__main__": parser = argparse.ArgumentParser(description='Take two tiff files, one for the sporozite channel and one for the nucleus channel, \ and create two files needed for further processing: a 3-channel hdf5 volume and a 1-channel nucleus HDF5.', ...
Add script to convert the sporozyte data to something ilastik and our pipeline can use
Add script to convert the sporozyte data to something ilastik and our pipeline can use
Python
mit
chaubold/hytra,chaubold/hytra,chaubold/hytra
--- +++ @@ -0,0 +1,23 @@ +import vigra +import argparse + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Take two tiff files, one for the sporozite channel and one for the nucleus channel, \ + and create two files needed for further processing: a 3-channel hdf5 volume and a 1-chan...
d3619cc31188e289f0b867bb029ff6db84cbb579
dictionary/management/commands/writeLiblouisTables.py
dictionary/management/commands/writeLiblouisTables.py
from daisyproducer.dictionary.brailleTables import writeWhiteListTables, writeLocalTables, writeWordSplitTable from daisyproducer.dictionary.models import Word from daisyproducer.documents.models import Document from django.core.management.base import BaseCommand class Command(BaseCommand): args = '' help = 'W...
Add a management command to generate the liblouis tables
Add a management command to generate the liblouis tables based on the contents of the dictionary database
Python
agpl-3.0
sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer
--- +++ @@ -0,0 +1,16 @@ +from daisyproducer.dictionary.brailleTables import writeWhiteListTables, writeLocalTables, writeWordSplitTable +from daisyproducer.dictionary.models import Word +from daisyproducer.documents.models import Document +from django.core.management.base import BaseCommand + +class Command(BaseComm...
a4492dbf7f215d605c4e171f2dfe51b3bddc715b
tests/web/test_disps.py
tests/web/test_disps.py
#!/usr/bin/env python from circuits.web import Controller from circuits.web import BaseServer from circuits.core.handlers import handler from circuits.core.components import BaseComponent from circuits.core.manager import Manager from .helpers import urlopen from circuits.web.dispatchers.dispatcher import Dispatcher ...
Test case for two web servers with different channels.
Test case for two web servers with different channels.
Python
mit
eriol/circuits,treemo/circuits,treemo/circuits,nizox/circuits,treemo/circuits,eriol/circuits,eriol/circuits
--- +++ @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +from circuits.web import Controller +from circuits.web import BaseServer + +from circuits.core.handlers import handler +from circuits.core.components import BaseComponent +from circuits.core.manager import Manager +from .helpers import urlopen +from circuits.web.disp...
307abd40d1cd78d77512ef6704ffadda79d50d94
examples/calculations/Parse_Angles.py
examples/calculations/Parse_Angles.py
# Copyright (c) 2015-2018 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Parse angles ============ Demonstrate how to convert direction strings to angles. The code below shows how to parse directional text into angles. It also demons...
Add parse_angle() example to calculations page.
Add parse_angle() example to calculations page.
Python
bsd-3-clause
jrleeman/MetPy,Unidata/MetPy,ahaberlie/MetPy,dopplershift/MetPy,Unidata/MetPy,ahaberlie/MetPy,jrleeman/MetPy,dopplershift/MetPy,ShawnMurd/MetPy
--- +++ @@ -0,0 +1,32 @@ +# Copyright (c) 2015-2018 MetPy Developers. +# Distributed under the terms of the BSD 3-Clause License. +# SPDX-License-Identifier: BSD-3-Clause +""" +Parse angles +============ + +Demonstrate how to convert direction strings to angles. + +The code below shows how to parse directional text i...
4731266a177ec1c634b7e0c6c1332ced0462fa11
tests/test_arraylist.py
tests/test_arraylist.py
from __future__ import absolute_import import unittest from jnius import autoclass class ArrayListTest(unittest.TestCase): def test_output(self): alist = autoclass('java.util.ArrayList')() args = [0, 1, 5, -1, -5, 0.0, 1.0, 5.0, -1.0, -5.0, True, False] for arg in args: alist...
Add test for Python numeric types as parameters
Add test for Python numeric types as parameters
Python
mit
kivy/pyjnius,kivy/pyjnius,kivy/pyjnius
--- +++ @@ -0,0 +1,22 @@ +from __future__ import absolute_import +import unittest +from jnius import autoclass + + +class ArrayListTest(unittest.TestCase): + + def test_output(self): + alist = autoclass('java.util.ArrayList')() + args = [0, 1, 5, -1, -5, 0.0, 1.0, 5.0, -1.0, -5.0, True, False] + + ...
54c9e64d1f45e0c81009adca2bff4f404b445799
terminal.py
terminal.py
import sys from PyQt4 import QtGui, QtCore from PyQt4.QtCore import Qt class Terminal(QtGui.QWidget): VSIZE = 25 HSIZE = 80 HEIGHT = 378 WIDTH = 644 def __init__(self): super(Terminal, self).__init__() self.buffer = [] for y in range(self.VSIZE): self.buffe...
Add Terminal class based on Qt
Add Terminal class based on Qt
Python
mit
jtauber/dcpu16py,Olical/dcpu16py,mceier/dcpu16py,n8mob/dcpu16py
--- +++ @@ -0,0 +1,43 @@ +import sys +from PyQt4 import QtGui, QtCore +from PyQt4.QtCore import Qt + + +class Terminal(QtGui.QWidget): + VSIZE = 25 + HSIZE = 80 + HEIGHT = 378 + WIDTH = 644 + + def __init__(self): + super(Terminal, self).__init__() + self.buffer = [] + for y in...
db25f3cbab70f8367aadb8c17adf342fb687f075
d1_common_python/src/d1_common/node.py
d1_common_python/src/d1_common/node.py
# -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2016 DataONE # # Licensed under the Apache License, Version 2.0 ...
Add utility module for working with the Node type
Add utility module for working with the Node type
Python
apache-2.0
DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python
--- +++ @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- + +# This work was created by participants in the DataONE project, and is +# jointly copyrighted by participating institutions in DataONE. For +# more information on DataONE, see our web site at http://dataone.org. +# +# Copyright 2009-2016 DataONE +# +# Licensed un...
9d69b5498b8fb4d983ba213edbc9ec1b5f102f92
yunity/tests/test_crossbar_authorizer.py
yunity/tests/test_crossbar_authorizer.py
from django.core.cache import cache from django.test import TestCase from utils.crossbar import YunityAuthorizer from utils.session import SharedSessionData class TestCrossbarAuthorizer(TestCase): def setUp(self): self.s = YunityAuthorizer() self.session_data = SharedSessionData(False) se...
Add Unit/Integration test for Crossbar authorizer
Add Unit/Integration test for Crossbar authorizer
Python
agpl-3.0
yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend
--- +++ @@ -0,0 +1,29 @@ +from django.core.cache import cache +from django.test import TestCase +from utils.crossbar import YunityAuthorizer +from utils.session import SharedSessionData + + +class TestCrossbarAuthorizer(TestCase): + + def setUp(self): + self.s = YunityAuthorizer() + self.session_data...
36716fe51800a19567c49e734d320b38d441054e
zerver/migrations/0003_custom_indexes.py
zerver/migrations/0003_custom_indexes.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('zerver', '0002_django_1_8'), ] operations = [ migrations.RunSQL("CREATE INDEX upper_subject_idx ON zerver_message ((upper(su...
Add remaining custom indexes that were created by South migrations
Add remaining custom indexes that were created by South migrations (imported from commit 9798afa8161af4ae6b3fa0c5f4894a3211b77cd4)
Python
apache-2.0
punchagan/zulip,yocome/zulip,bluesea/zulip,armooo/zulip,zacps/zulip,vabs22/zulip,Juanvulcano/zulip,hj3938/zulip,zwily/zulip,grave-w-grave/zulip,dxq-git/zulip,LeeRisk/zulip,so0k/zulip,jerryge/zulip,technicalpickles/zulip,guiquanz/zulip,alliejones/zulip,firstblade/zulip,Drooids/zulip,xuanhan863/zulip,praveenaki/zulip,Aps...
--- +++ @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('zerver', '0002_django_1_8'), + ] + + operations = [ + migrations.RunSQL("CREATE INDEX upper...
d7349cb444b5774b24096eec64996ff2fa334392
libnamebench/config_test.py
libnamebench/config_test.py
#!/usr/bin/env python # Copyright 2009 Google Inc. 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...
Add some tests for dns config parsing
Add some tests for dns config parsing
Python
apache-2.0
google/namebench,google/namebench,rogers0/namebench,google/namebench,protron/namebench
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# Copyright 2009 Google Inc. 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/licen...
353817ad22c5c3f1102474e573032383309545de
py/image-smoother.py
py/image-smoother.py
class Solution(object): def imageSmoother(self, M): """ :type M: List[List[int]] :rtype: List[List[int]] """ if not M or not M[0]: return M R = len(M) C = len(M[0]) subsum = [[0] * (len(M[0]) + 3) for _ in xrange(len(M) + 3)] for r ...
Add py solution for 661. Image Smoother
Add py solution for 661. Image Smoother 661. Image Smoother: https://leetcode.com/problems/image-smoother/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,20 @@ +class Solution(object): + def imageSmoother(self, M): + """ + :type M: List[List[int]] + :rtype: List[List[int]] + """ + if not M or not M[0]: + return M + R = len(M) + C = len(M[0]) + subsum = [[0] * (len(M[0]) + 3) for _...
011b97d60c6e3464a668ca525efda1f5414c0516
tests/test_recursion.py
tests/test_recursion.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest import properties class TestRecursion(unittest.TestCase): def test_basic_recursion(self): class HasHasProps(properties.HasProperties): ...
Add test for infinite recursion
Add test for infinite recursion
Python
mit
aranzgeo/properties,3ptscience/properties
--- +++ @@ -0,0 +1,69 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import unittest + +import properties + + +class TestRecursion(unittest.TestCase): + + def test_basic_recursion(self): + + class...
4e66df468b104d8e95184322082a7775838a4f87
example_lxd.py
example_lxd.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
Add basic example for using the LXDContainerDriver
Add basic example for using the LXDContainerDriver
Python
apache-2.0
Kami/libcloud,apache/libcloud,andrewsomething/libcloud,apache/libcloud,Kami/libcloud,Kami/libcloud,andrewsomething/libcloud,mistio/libcloud,mistio/libcloud,apache/libcloud,mistio/libcloud,andrewsomething/libcloud
--- +++ @@ -0,0 +1,56 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (...
317ff51fd9edbcd16f950c1f75ba07d531bc8e4b
support/update-converity-branch.py
support/update-converity-branch.py
#!/usr/bin/env python # Update the coverity branch from the master branch. # It is not done automatically because Coverity Scan limits # the number of submissions per day. from __future__ import print_function import shutil, tempfile from subprocess import check_call class Git: def __init__(self, dir): self.dir...
Add a script to update the coverity branch
Add a script to update the coverity branch
Python
bsd-2-clause
alabuzhev/fmt,dean0x7d/cppformat,lightslife/cppformat,cppformat/cppformat,Jopie64/cppformat,mojoBrendan/fmt,alabuzhev/fmt,Jopie64/cppformat,cppformat/cppformat,mojoBrendan/fmt,dean0x7d/cppformat,lightslife/cppformat,lightslife/cppformat,cppformat/cppformat,alabuzhev/fmt,mojoBrendan/fmt,Jopie64/cppformat,dean0x7d/cppfor...
--- +++ @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# Update the coverity branch from the master branch. +# It is not done automatically because Coverity Scan limits +# the number of submissions per day. + +from __future__ import print_function +import shutil, tempfile +from subprocess import check_call + +class Git: + ...
7589819fd2e2ef0c1e2ca193fbb43c858017210f
test/src/unittests/stats/test_entropy.py
test/src/unittests/stats/test_entropy.py
#!/usr/bin/env python # Copyright (C) 2006-2022 Music Technology Group - Universitat Pompeu Fabra # # This file is part of Essentia # # Essentia 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 (FSF), e...
Add test of Entropy algorithm
Add test of Entropy algorithm
Python
agpl-3.0
MTG/essentia,MTG/essentia,MTG/essentia,MTG/essentia,MTG/essentia
--- +++ @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +# Copyright (C) 2006-2022 Music Technology Group - Universitat Pompeu Fabra +# +# This file is part of Essentia +# +# Essentia 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 ...
bb527e99074db4085abda9bcf31e8eb11bcf52d9
notification/tests/test_notification_urls.py
notification/tests/test_notification_urls.py
from django.core.urlresolvers import resolve from unittest import TestCase from ..views import device_token_receive class NotificationUrlsTestCase(TestCase): def test_url_resolves_to_device_token_receive(self): found = resolve('/receive') self.assertEqual(found.func, device_token_receive)
Add notification's url test case
Add notification's url test case
Python
mit
nnsnodnb/django-ios-notifications,nnsnodnb/django-ios-notifications
--- +++ @@ -0,0 +1,10 @@ +from django.core.urlresolvers import resolve +from unittest import TestCase +from ..views import device_token_receive + + +class NotificationUrlsTestCase(TestCase): + + def test_url_resolves_to_device_token_receive(self): + found = resolve('/receive') + self.assertEqual(foun...
7c7da87ab1a703227aa0365708e6506cbd064004
py/employee-importance.py
py/employee-importance.py
""" # Employee info class Employee(object): def __init__(self, id, importance, subordinates): # It's the unique id of each node. # unique id of this employee self.id = id # the importance value of this employee self.importance = importance # the id of direct subordina...
Add py solution for 690. Employee Importance
Add py solution for 690. Employee Importance 690. Employee Importance: https://leetcode.com/problems/employee-importance/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,24 @@ +""" +# Employee info +class Employee(object): + def __init__(self, id, importance, subordinates): + # It's the unique id of each node. + # unique id of this employee + self.id = id + # the importance value of this employee + self.importance = importance ...
c504069e34eb6c932567e023d23bdd980be9daf5
tests/test_cli_parse.py
tests/test_cli_parse.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Author: Dominik Gresch <greschd@gmx.ch> import os import pytest import tempfile from click.testing import CliRunner import tbmodels from tbmodels._cli import cli from parameters import SAMPLES_DIR @pytest.mark.parametrize('prefix', ['silicon', 'bi']) def test_cli_p...
Add test for CLI parse
Add test for CLI parse
Python
apache-2.0
Z2PackDev/TBmodels,Z2PackDev/TBmodels
--- +++ @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Author: Dominik Gresch <greschd@gmx.ch> + +import os + +import pytest +import tempfile +from click.testing import CliRunner + +import tbmodels +from tbmodels._cli import cli +from parameters import SAMPLES_DIR + +@pytest.mark.parametrize(...
73b1eb250cbb263e7b7efc523fb94443fae8b7ff
pombola/nigeria/management/commands/nigeria_update_party_memberships.py
pombola/nigeria/management/commands/nigeria_update_party_memberships.py
"""Change party of everyone currently in ACN, ANPP and CPP to APC. Update Positions of every current member of ACN, ANPP, and CPP to have an end_date of 2013-07-31, and for each of them, make a new Position with that as the start date, no end date, and organisation APC. This is all very hard-coded, but might be usefu...
Add script to change party memberships from ACN, ANPP and CPC to APC.
Add script to change party memberships from ACN, ANPP and CPC to APC. This is currently a very hard-coded script for Nigeria, but could be worked on and moved later to make something more general.
Python
agpl-3.0
mysociety/pombola,geoffkilpin/pombola,patricmutwiri/pombola,patricmutwiri/pombola,hzj123/56th,hzj123/56th,ken-muturi/pombola,hzj123/56th,ken-muturi/pombola,patricmutwiri/pombola,geoffkilpin/pombola,ken-muturi/pombola,patricmutwiri/pombola,geoffkilpin/pombola,hzj123/56th,mysociety/pombola,ken-muturi/pombola,hzj123/56th,...
--- +++ @@ -0,0 +1,51 @@ +"""Change party of everyone currently in ACN, ANPP and CPP to APC. + +Update Positions of every current member of ACN, ANPP, and CPP to +have an end_date of 2013-07-31, and for each of them, make a new +Position with that as the start date, no end date, and organisation +APC. + +This is all ...
a7045df1b90b7b352541151e0de2462eb0301422
tests/test_gene_page.py
tests/test_gene_page.py
import unittest import runserver class GenePageTestCase(unittest.TestCase): def setUp(self): runserver.app.config['TESTING'] = True self.app = runserver.app.test_client() def tearDown(self): pass # import this TODO LMTW def login(self, username, password): return...
Test of TTLL5 page passes.
Test of TTLL5 page passes.
Python
mit
pontikos/phenopolis,phenopolis/phenopolis,pontikos/phenopolis,pontikos/phenopolis,logust79/phenopolis,logust79/phenopolis,Withington/phenopolis,pontikos/phenopolis,phenopolis/phenopolis,Withington/phenopolis,phenopolis/phenopolis,logust79/phenopolis,logust79/phenopolis,phenopolis/phenopolis,Withington/phenopolis,pontik...
--- +++ @@ -0,0 +1,30 @@ + +import unittest +import runserver + +class GenePageTestCase(unittest.TestCase): + + def setUp(self): + runserver.app.config['TESTING'] = True + self.app = runserver.app.test_client() + + def tearDown(self): + pass + + # import this TODO LMTW + def login...
7db7f5bd85f5702fdd9bdeba82f1faa6ced24ba3
tools/change_version.py
tools/change_version.py
"""Change version.""" import fileinput import sys VERSION = sys.argv[1] for line in fileinput.input('../PKGBUILD', inplace=True): if 'pkgver=' in line: line = 'pkgver=%s' % VERSION print line.rstrip('\n') for line in fileinput.input('../setup.py', inplace=True): if 'VERSION = ' in line: l...
Add script to change version
Add script to change version
Python
agpl-3.0
drivnal/drivnal,drivnal/drivnal,drivnal/drivnal
--- +++ @@ -0,0 +1,21 @@ +"""Change version.""" +import fileinput +import sys + +VERSION = sys.argv[1] + +for line in fileinput.input('../PKGBUILD', inplace=True): + if 'pkgver=' in line: + line = 'pkgver=%s' % VERSION + print line.rstrip('\n') + +for line in fileinput.input('../setup.py', inplace=True):...
ff0215544c8ee175c76f9bcc938dd6c4e0675109
examples/restartable.py
examples/restartable.py
import os import sys import asyncio import signal import logbook.more import saltyrtc def env(name, default=None): return os.environ.get(name, default) def require_env(name): value = env(name) if value is None: print("Missing '{}' env variable".format(name)) sys.exit(1) return valu...
Add example server that restarts on SIGHUP
Add example server that restarts on SIGHUP
Python
mit
saltyrtc/saltyrtc-server-python,saltyrtc/saltyrtc-server-python
--- +++ @@ -0,0 +1,79 @@ +import os +import sys +import asyncio +import signal + +import logbook.more + +import saltyrtc + + +def env(name, default=None): + return os.environ.get(name, default) + + +def require_env(name): + value = env(name) + if value is None: + print("Missing '{}' env variable".form...
8b0b0fb1e18dae98737a7de65ee014403da71b67
bmi_tester/bmipytest.py
bmi_tester/bmipytest.py
#! /usr/bin/env python import os import textwrap import argparse import pkg_resources import pytest def test(package, input_file=None, verbosity=None, bmi_version='1.1'): tests = [ pkg_resources.resource_filename(__name__, os.path.join('tests_pytest')) ] os.environ['BMITEST_CLASS'] = package ...
Add bmi-test command that uses pytest.
Add bmi-test command that uses pytest.
Python
mit
csdms/bmi-tester
--- +++ @@ -0,0 +1,92 @@ +#! /usr/bin/env python +import os +import textwrap +import argparse + +import pkg_resources +import pytest + + +def test(package, input_file=None, verbosity=None, bmi_version='1.1'): + tests = [ + pkg_resources.resource_filename(__name__, os.path.join('tests_pytest')) + ] + o...
25d616b6c20baa22c47becb71a6669e2982d5980
bin/filter_gtf_for_genes_in_genome.py
bin/filter_gtf_for_genes_in_genome.py
#!/usr/bin/env python from __future__ import print_function import logging from itertools import groupby import argparse # Create a logger logging.basicConfig(format='%(name)s - %(asctime)s %(levelname)s: %(message)s') logger = logging.getLogger(__file__) logger.setLevel(logging.INFO) def extract_fasta_seq_names(fas...
Add script to filter gtf on seqnames in genome fasta
Add script to filter gtf on seqnames in genome fasta
Python
mit
ewels/NGI-RNAseq,ewels/NGI-RNAseq,ewels/NGI-RNAseq,ewels/NGI-RNAseq,ewels/NGI-RNAseq
--- +++ @@ -0,0 +1,62 @@ +#!/usr/bin/env python +from __future__ import print_function +import logging +from itertools import groupby +import argparse + +# Create a logger +logging.basicConfig(format='%(name)s - %(asctime)s %(levelname)s: %(message)s') +logger = logging.getLogger(__file__) +logger.setLevel(logging.IN...
f0ef5834e8cf877a333453152b0ed567b41ef2c3
scripts/motion_sensor_log.py
scripts/motion_sensor_log.py
import os import time from datetime import datetime import RPi.GPIO as GPIO from blink2 import Blink pir_pin = 23 log = True log_file = 'motion_log' speed = 2 with open(log_file, 'w') as log: time_now = datetime.now().strftime('%d-%m-%Y | %H:%M:%S') log.write('Starting log... %s\n' % time_now) GPIO.setmode(...
Add motion sensor log script.
Add motion sensor log script.
Python
bsd-3-clause
kbsezginel/raspberry-pi,kbsezginel/raspberry-pi,kbsezginel/raspberry-pi,kbsezginel/raspberry-pi
--- +++ @@ -0,0 +1,32 @@ +import os +import time +from datetime import datetime +import RPi.GPIO as GPIO +from blink2 import Blink + + +pir_pin = 23 +log = True +log_file = 'motion_log' +speed = 2 + +with open(log_file, 'w') as log: + time_now = datetime.now().strftime('%d-%m-%Y | %H:%M:%S') + log.write('Starti...