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
ca440877fd1b28157393c480d6fed8f5dd9e4238
run_experiment.py
run_experiment.py
#!/usr/bin/env python if __name__ == '__main__': import argparse from glob import glob import os.path from sklearn.feature_extraction.text import CountVectorizer from termcolor import cprint import method import util parser = argparse.ArgumentParser(description='Run experiment ' ...
Add script to run experiment
Add script to run experiment
Python
mit
kemskems/otdet
--- +++ @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +if __name__ == '__main__': + import argparse + from glob import glob + import os.path + + from sklearn.feature_extraction.text import CountVectorizer + from termcolor import cprint + + import method + import util + + parser = argparse.Argument...
eb4221e6f0b48b131f2009168b3b22f5a3d4dd8f
neutron/extensions/port_resource_request.py
neutron/extensions/port_resource_request.py
# Copyright (c) 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
Introduce Port resource request extension
Introduce Port resource request extension The resources needed by a port are expressed to nova via resource_request extending the port. If the port requested by nova boot has resource_request attribute, that means that placement must enforce the minimum bandwidth requirements. Change-Id: I82afa56fa784fc43fefd1ce494bf...
Python
apache-2.0
mahak/neutron,noironetworks/neutron,mahak/neutron,openstack/neutron,openstack/neutron,mahak/neutron,noironetworks/neutron,openstack/neutron
--- +++ @@ -0,0 +1,20 @@ +# Copyright (c) 2018 Ericsson +# +# 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...
fcde68e954eab9f1b158928f9d30633523d41d94
corehq/apps/userreports/management/commands/resave_couch_forms_and_cases.py
corehq/apps/userreports/management/commands/resave_couch_forms_and_cases.py
from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import csv import datetime from django.core.management.base import BaseCommand from corehq.util.couch import IterDB from corehq.util.log import with_progress_bar from couchforms.models import XFormIns...
Add mgmt cmd to re-save a list of form/case IDs
Add mgmt cmd to re-save a list of form/case IDs https://manage.dimagi.com/default.asp?263644
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,50 @@ +from __future__ import print_function +from __future__ import absolute_import +from __future__ import unicode_literals + +import csv +import datetime + +from django.core.management.base import BaseCommand + +from corehq.util.couch import IterDB +from corehq.util.log import with_progress_bar ...
dc1118525e47854d8185d4d46db5a12ec3e93aea
examples/post_body_example.py
examples/post_body_example.py
'''A simple post reading server example. To test run this server with `hug -f post_body_example` then run the following from ipython: import requests requests.post('http://localhost:8000.post_here', json={'one': 'two'}).json() This should return back the json data that you posted ''' import hug @hug.po...
Add example post body processer
Add example post body processer
Python
mit
MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug,MuhammadAlkarouri/hug
--- +++ @@ -0,0 +1,17 @@ +'''A simple post reading server example. + +To test run this server with `hug -f post_body_example` +then run the following from ipython: + import requests + + requests.post('http://localhost:8000.post_here', json={'one': 'two'}).json() + + This should return back the json data that...
e30ce1adf4e9c8504ae1816f0078c744e63c836c
scripts/save-vimt.py
scripts/save-vimt.py
import sys sys.path.append('/home/jwalker/dynamics/python/atmos-tools') sys.path.append('/home/jwalker/dynamics/python/atmos-read') import numpy as np import xray import pandas as pd import matplotlib.pyplot as plt import atmos as atm import merra # ------------------------------------------------------------------...
Save daily vertically integrated moisture transport for HOWI index
Save daily vertically integrated moisture transport for HOWI index
Python
mit
jenfly/monsoon-onset,jenfly/monsoon-onset
--- +++ @@ -0,0 +1,52 @@ +import sys +sys.path.append('/home/jwalker/dynamics/python/atmos-tools') +sys.path.append('/home/jwalker/dynamics/python/atmos-read') + +import numpy as np +import xray +import pandas as pd +import matplotlib.pyplot as plt + +import atmos as atm +import merra + + +# -------------------------...
d708b64dd45b824bada255054df3988efa0f21fe
migrations/versions/0361_new_user_bcast_permissions.py
migrations/versions/0361_new_user_bcast_permissions.py
""" Revision ID: 0361_new_user_bcast_permissions Revises: 0360_remove_sched_notifications Create Date: 2021-06-30 11:42:32.780734 """ from alembic import op revision = '0361_new_user_bcast_permissions' down_revision = '0360_remove_sched_notifications' def upgrade(): """ Delete all permissions for broadcast...
Remove original permissions from broadcast users
Remove original permissions from broadcast users The broadcast user permissions are changing, so to avoid confusion and permissions which exist in the database but don't display on the frontend we are going to remove all existing permissions for users of broadcast services. This also updates the permissions of invited...
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,32 @@ +""" + +Revision ID: 0361_new_user_bcast_permissions +Revises: 0360_remove_sched_notifications +Create Date: 2021-06-30 11:42:32.780734 + +""" +from alembic import op + +revision = '0361_new_user_bcast_permissions' +down_revision = '0360_remove_sched_notifications' + + +def upgrade(): + ""...
6b9265c96adb8ba9fc7f2d04edcb02398566e1b9
pre_commit_hooks/check_json.py
pre_commit_hooks/check_json.py
from __future__ import print_function import argparse import sys import simplejson def check_json(argv=None): parser = argparse.ArgumentParser() parser.add_argument('filenames', nargs='*', help='JSON filenames to check.') args = parser.parse_args(argv) retval = 0 for filename in args.filenames:...
from __future__ import print_function import argparse import sys import simplejson def check_json(argv=None): parser = argparse.ArgumentParser() parser.add_argument('filenames', nargs='*', help='JSON filenames to check.') args = parser.parse_args(argv) retval = 0 for filename in args.filenames:...
Fix JSON decode error message
Fix JSON decode error message
Python
mit
Harwood/pre-commit-hooks,pre-commit/pre-commit-hooks
--- +++ @@ -16,7 +16,7 @@ try: simplejson.load(open(filename)) except (simplejson.JSONDecodeError, UnicodeDecodeError) as exc: - print('{0}: Failed to json encode ({1})'.format(filename, exc)) + print('{0}: Failed to json decode ({1})'.format(filename, exc)) ...
84633246eebe20504a8660f1cf3f62c7866a2088
scripts/set-artist-streamable.py
scripts/set-artist-streamable.py
#!/usr/bin/env python import psycopg2 as ordbms import urllib, urllib2 import xml.etree.cElementTree as ElementTree class SetArtistStreamable: def __init__(self): self.conn = ordbms.connect ("dbname='librefm'") self.cursor = self.conn.cursor() def updateAll(self): """Sets artists streamable ...
Add script for updating previously imported artists with the streamable property (so we don't have to query tracks to find out who's streamable)
Add script for updating previously imported artists with the streamable property (so we don't have to query tracks to find out who's streamable)
Python
agpl-3.0
foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm
--- +++ @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import psycopg2 as ordbms +import urllib, urllib2 +import xml.etree.cElementTree as ElementTree + + +class SetArtistStreamable: + + + def __init__(self): + self.conn = ordbms.connect ("dbname='librefm'") + self.cursor = self.conn.cursor() + + + def upda...
32ea27cfa3994984d8d8f8db09522f6c31b0524f
every_election/apps/organisations/migrations/0059_add_sennedd_to_org_types.py
every_election/apps/organisations/migrations/0059_add_sennedd_to_org_types.py
# Generated by Django 2.2.16 on 2020-12-18 09:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("organisations", "0058_remove_division_organisation_fk"), ] operations = [ migrations.AlterField( model_name="organisation", ...
Add 'senedd' to choices for organisation_type
Add 'senedd' to choices for organisation_type
Python
bsd-3-clause
DemocracyClub/EveryElection,DemocracyClub/EveryElection,DemocracyClub/EveryElection
--- +++ @@ -0,0 +1,34 @@ +# Generated by Django 2.2.16 on 2020-12-18 09:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("organisations", "0058_remove_division_organisation_fk"), + ] + + operations = [ + migrations.AlterField( + ...
5d749e09eeef87ad91f2255ab80305a26dd85989
html_sanitizer/__main__.py
html_sanitizer/__main__.py
from __future__ import unicode_literals import io import sys from .sanitizer import Sanitizer sanitizer = Sanitizer() if len(sys.argv) > 1: for filename in sys.argv[1:]: with io.open(filename) as f: print(sanitizer.sanitize(f.read())) else: print(sanitizer.sanitize(sys.stdin.read()).enc...
Allow running with "python -m html_sanitizer"
Allow running with "python -m html_sanitizer"
Python
bsd-3-clause
matthiask/html-sanitizer
--- +++ @@ -0,0 +1,16 @@ +from __future__ import unicode_literals + +import io +import sys + +from .sanitizer import Sanitizer + + +sanitizer = Sanitizer() + +if len(sys.argv) > 1: + for filename in sys.argv[1:]: + with io.open(filename) as f: + print(sanitizer.sanitize(f.read())) +else: + pri...
76ced10ebc0c7ef36924ca4e123ba637a53e0784
test_server.py
test_server.py
import datetime from flask.ext.testing import TestCase import mongomock import mock from server import app, get_db class BaseTest(TestCase): def create_app(self): app.config['TESTING'] = True return app def setUp(self): self.mongo_patcher = mock.patch('pymongo.MongoClient', mongomock...
Add tests for RESTful server
Add tests for RESTful server
Python
bsd-2-clause
AAzza/geonaut,AAzza/geonaut
--- +++ @@ -0,0 +1,89 @@ +import datetime + +from flask.ext.testing import TestCase +import mongomock +import mock + +from server import app, get_db + +class BaseTest(TestCase): + def create_app(self): + app.config['TESTING'] = True + return app + + def setUp(self): + self.mongo_patcher = m...
fcf6fe09abcb448ec6071f5a92b1d44621fb2a49
st2client/tests/unit/test_client_actions.py
st2client/tests/unit/test_client_actions.py
# Copyright 2019 Extreme Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
Add unit tests for the new ActionResourceManager methods
Add unit tests for the new ActionResourceManager methods
Python
apache-2.0
nzlosh/st2,nzlosh/st2,StackStorm/st2,nzlosh/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,StackStorm/st2,Plexxi/st2,StackStorm/st2,Plexxi/st2
--- +++ @@ -0,0 +1,88 @@ +# Copyright 2019 Extreme Networks, Inc. +# +# 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 requi...
fa9b27bd8e58b17a2d072fdf2b173f14d5f15a33
tests/functional/test_response_shadowing.py
tests/functional/test_response_shadowing.py
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
Add functional test to ensure response keys are not shadowed
Add functional test to ensure response keys are not shadowed
Python
apache-2.0
boto/botocore,pplu/botocore
--- +++ @@ -0,0 +1,49 @@ +# Copyright 2020 Amazon.com, Inc. or its affiliates. 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. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +#...
ec34549e7cc0910565709540df4e2d4b81333c43
grizli/pipeline/run_MPI.py
grizli/pipeline/run_MPI.py
""" Script to run all redshift fits in parallel with OpenMPI Usage: mpiexec -n 10 python -m mpi4py.futures $GRIZLICODE/grizli/pipeline/run_MPI.py where "-n 8" indicates running 8 parallel threads. Needs 'fit_args.py' created by `auto_script.generate_fit_params`. """ import os import glob import numpy as n...
Add file for running fits with OpenMPI
Add file for running fits with OpenMPI
Python
mit
gbrammer/grizli
--- +++ @@ -0,0 +1,60 @@ +""" +Script to run all redshift fits in parallel with OpenMPI + +Usage: + + mpiexec -n 10 python -m mpi4py.futures $GRIZLICODE/grizli/pipeline/run_MPI.py + +where "-n 8" indicates running 8 parallel threads. + +Needs 'fit_args.py' created by `auto_script.generate_fit_params`. + +""" ...
fe3e93a0b74a987fa4545f75f3f6301fc15f571e
setuptools/tests/test_build.py
setuptools/tests/test_build.py
from setuptools.dist import Distribution from setuptools.command.build import build def test_distribution_gives_setuptools_build_obj(tmpdir_cwd): """ Check that the setuptools Distribution uses the setuptools specific build object. """ dist = Distribution(dict( script_name='setup.py', ...
Add a simple test for setuptools.command.build
Add a simple test for setuptools.command.build
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
--- +++ @@ -0,0 +1,16 @@ +from setuptools.dist import Distribution +from setuptools.command.build import build + + +def test_distribution_gives_setuptools_build_obj(tmpdir_cwd): + """ + Check that the setuptools Distribution uses the + setuptools specific build object. + """ + dist = Distribution(dict(...
8525b50385a8b18333ad557ab66029d467c3e915
test/test_core.py
test/test_core.py
# -*- coding: utf-8 -*- """Testing CLI module Only supports Python 3.x now""" import unittest # Resolve import problem import os os.chdir("../") from vocabtool import core class TestCoreConfig(unittest.TestCase): """Test case for the config components of core""" def setUp(self): pass def tea...
Add preliminary test suite for core.py
Add preliminary test suite for core.py
Python
mit
RihanWu/vocabtool
--- +++ @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +"""Testing CLI module + +Only supports Python 3.x now""" + +import unittest + +# Resolve import problem +import os +os.chdir("../") + +from vocabtool import core + + +class TestCoreConfig(unittest.TestCase): + """Test case for the config components of core""" + + ...
c464c509b69b4c61364b62ac584619744c4f6113
into/backends/tests/test_aws.py
into/backends/tests/test_aws.py
import pytest from into import into, resource, S3, discover, CSV, s3 import pandas as pd import pandas.util.testing as tm import datashape sa = pytest.importorskip('sqlalchemy') pytest.importorskip('psycopg2') pytest.importorskip('redshift_sqlalchemy') tips_uri = 's3://nyqpug/tips.csv' def test_s3_resource(): ...
Add aws s3 into tests
Add aws s3 into tests
Python
bsd-3-clause
blaze/odo,Dannnno/odo,quantopian/odo,cowlicks/odo,ywang007/odo,alexmojaki/odo,cowlicks/odo,quantopian/odo,blaze/odo,alexmojaki/odo,ContinuumIO/odo,Dannnno/odo,cpcloud/odo,cpcloud/odo,ContinuumIO/odo,ywang007/odo
--- +++ @@ -0,0 +1,47 @@ +import pytest +from into import into, resource, S3, discover, CSV, s3 +import pandas as pd +import pandas.util.testing as tm +import datashape + +sa = pytest.importorskip('sqlalchemy') +pytest.importorskip('psycopg2') +pytest.importorskip('redshift_sqlalchemy') + + +tips_uri = 's3://nyqpug/t...
1fb389bde5a6cd8812054046c8b76915d485e54c
tdb/utils/fix_input_file_spaces.py
tdb/utils/fix_input_file_spaces.py
import os, subprocess import re def fix_input_file_spaces(): path = '../../fludata/VIDRL-Melbourne-WHO-CC/raw-data/' for ab in os.listdir(path): ab_path = '{}{}/'.format(path, ab) for subtype in os.listdir(ab_path): subtype_path = '{}{}/'.format(ab_path, subtype) for ass...
Add name space replacement utility.
Add name space replacement utility.
Python
agpl-3.0
nextstrain/fauna,blab/nextstrain-db,nextstrain/fauna,blab/nextstrain-db
--- +++ @@ -0,0 +1,25 @@ +import os, subprocess +import re + +def fix_input_file_spaces(): + path = '../../fludata/VIDRL-Melbourne-WHO-CC/raw-data/' + for ab in os.listdir(path): + ab_path = '{}{}/'.format(path, ab) + for subtype in os.listdir(ab_path): + subtype_path = '{}{}/'.format(a...
7f01e9e622eb14db003d125bd7041671452fc9c6
hacks/gpiotesting.py
hacks/gpiotesting.py
# from www.thirdeyevis.com/pi-page-2.php import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(7, GPIO.OUT) GPIO.setup(11, GPIO.OUT) GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(13, GPIO.OUT) def blinkity(): for i in range(0,5):...
Add an early gpio testing script
Add an early gpio testing script
Python
mit
joadavis/rpi-coding
--- +++ @@ -0,0 +1,61 @@ +# from www.thirdeyevis.com/pi-page-2.php + +import RPi.GPIO as GPIO +import time + +GPIO.setmode(GPIO.BOARD) +GPIO.setup(7, GPIO.OUT) +GPIO.setup(11, GPIO.OUT) +GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) +GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP) +GPIO.setup(13, GPIO.OUT) + + ...
22dc87589131a86b4d2e38eaf67ec4601b1436ee
tests/views/test_blog_post_page.py
tests/views/test_blog_post_page.py
from tests import PMGLiveServerTestCase from tests.fixtures import dbfixture, PostData import urllib2 class TestBlogPages(PMGLiveServerTestCase): def setUp(self): super(TestBlogPages, self).setUp() self.fx = dbfixture.data(PostData) self.fx.setup() def tearDown(self): self.fx...
Add 'smoke test' for single blog post page
Add 'smoke test' for single blog post page
Python
apache-2.0
Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2
--- +++ @@ -0,0 +1,41 @@ +from tests import PMGLiveServerTestCase +from tests.fixtures import dbfixture, PostData +import urllib2 + + +class TestBlogPages(PMGLiveServerTestCase): + def setUp(self): + super(TestBlogPages, self).setUp() + + self.fx = dbfixture.data(PostData) + self.fx.setup() + ...
58bec298ac5e400c9d33f440130ad777e162b410
numba/tests/test_dyn_array.py
numba/tests/test_dyn_array.py
from __future__ import print_function, absolute_import, division import numpy as np from numba import unittest_support as unittest from numba import njit class TestDynArray(unittest.TestCase): def test_empty_1d(self): @njit def foo(n): arr = np.empty(n) for i in range(n):...
Add test for np.empty 1d case
Add test for np.empty 1d case
Python
bsd-2-clause
IntelLabs/numba,stonebig/numba,jriehl/numba,pitrou/numba,stefanseefeld/numba,IntelLabs/numba,ssarangi/numba,numba/numba,ssarangi/numba,jriehl/numba,pitrou/numba,sklam/numba,stuartarchibald/numba,jriehl/numba,pombredanne/numba,stonebig/numba,pitrou/numba,cpcloud/numba,pitrou/numba,seibert/numba,cpcloud/numba,cpcloud/num...
--- +++ @@ -0,0 +1,32 @@ +from __future__ import print_function, absolute_import, division + +import numpy as np + +from numba import unittest_support as unittest +from numba import njit + + +class TestDynArray(unittest.TestCase): + def test_empty_1d(self): + @njit + def foo(n): + arr = np...
47a11b49d79829e97ed8ca0ca4d6dde115b96d08
test/main_test.py
test/main_test.py
import theanets import numpy as np import util class TestExperiment(util.MNIST): def test_create_autoencoder(self): exp = theanets.Experiment( theanets.Autoencoder, layers=(self.DIGIT_SIZE, 2, self.DIGIT_SIZE)) assert isinstance(exp.network, theanets.Autoencoder) def test_create_...
Add a few basic tests for Experiment code.
Add a few basic tests for Experiment code.
Python
mit
lmjohns3/theanets,devdoer/theanets,chrinide/theanets
--- +++ @@ -0,0 +1,21 @@ +import theanets +import numpy as np + +import util + + +class TestExperiment(util.MNIST): + def test_create_autoencoder(self): + exp = theanets.Experiment( + theanets.Autoencoder, layers=(self.DIGIT_SIZE, 2, self.DIGIT_SIZE)) + assert isinstance(exp.network, thean...
a506d8d45d0824b9b70af35831c1bde69906617e
test/test_soft.py
test/test_soft.py
import os import base64 import struct import tempfile import unittest from u2flib_host.soft import SoftU2FDevice from u2flib_host.constants import INS_ENROLL, INS_SIGN CLIENT_PARAM = b'clientABCDEFGHIJKLMNOPQRSTUVWXYZ' # 32 bytes APP_PARAM = b'test_SoftU2FDevice0123456789ABCD' # 32 bytes class TestSoftU2FDevice(...
Add rudimentary unit test for SoftU2FDevice
Add rudimentary unit test for SoftU2FDevice
Python
bsd-2-clause
Yubico/python-u2flib-host
--- +++ @@ -0,0 +1,55 @@ + +import os +import base64 +import struct +import tempfile +import unittest + +from u2flib_host.soft import SoftU2FDevice +from u2flib_host.constants import INS_ENROLL, INS_SIGN + +CLIENT_PARAM = b'clientABCDEFGHIJKLMNOPQRSTUVWXYZ' # 32 bytes +APP_PARAM = b'test_SoftU2FDevice0123456789ABC...
3ceddeed21abe277224750764eaf10f6c8f49a60
py/statemachines/simple_state_machine_script_test.py
py/statemachines/simple_state_machine_script_test.py
#---------------------------------------------------------------------------------------- # BEGIN: READ_HEXAPOD_CURRENT_POSE # TEMPLATE: ReadTransformState # smach.StateMachine.add('READ_HEXAPOD_CURRENT_POSE', TFListenerState('ur10_1/base', 'hexapod_1/top', 'hexapod_current_pose'), ...
Add basic working prototype of SMACH/Jinja2 template-based code generation.
Add basic working prototype of SMACH/Jinja2 template-based code generation.
Python
bsd-3-clause
ReconCell/smacha,ReconCell/smacha
--- +++ @@ -0,0 +1,33 @@ +#---------------------------------------------------------------------------------------- +# BEGIN: READ_HEXAPOD_CURRENT_POSE +# TEMPLATE: ReadTransformState +# +smach.StateMachine.add('READ_HEXAPOD_CURRENT_POSE', TFListenerState('ur10_1/base', 'hexapod_1/top', 'hexapod_current_pose'), + ...
97a7fdfeff590dab0d38209d7cdb5657feb97635
examples/hv_grid.py
examples/hv_grid.py
from tools.pypsa_io import oedb_session, get_pq_sets,\ get_timerange, import_components, import_pq_sets, create_powerflow_problem,\ add_coordinates, plot_line_loading from egoio.db_tables.calc_ego_hv_powerflow import Bus, Line, Generator, Load, \ Transformer, TempResolution, GeneratorPqSet, LoadPqSet sess...
Add example for hv grid
Add example for hv grid
Python
agpl-3.0
openego/ego.powerflow
--- +++ @@ -0,0 +1,59 @@ +from tools.pypsa_io import oedb_session, get_pq_sets,\ + get_timerange, import_components, import_pq_sets, create_powerflow_problem,\ + add_coordinates, plot_line_loading + +from egoio.db_tables.calc_ego_hv_powerflow import Bus, Line, Generator, Load, \ + Transformer, TempResolution...
5923675c35a21d442860b58e04b8f3c5ba749dda
common/djangoapps/student/management/commands/set_superuser.py
common/djangoapps/student/management/commands/set_superuser.py
"""Management command to grant or revoke superuser access for one or more users""" from optparse import make_option from django.contrib.auth.models import User from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): """Management command to grant or revoke superuser access f...
Add management command for granting superuser access
Add management command for granting superuser access
Python
agpl-3.0
jamiefolsom/edx-platform,alexthered/kienhoc-platform,Ayub-Khan/edx-platform,philanthropy-u/edx-platform,gsehub/edx-platform,devs1991/test_edx_docmode,don-github/edx-platform,kursitet/edx-platform,synergeticsedx/deployment-wipro,procangroup/edx-platform,alexthered/kienhoc-platform,IndonesiaX/edx-platform,ZLLab-Mooc/edx-...
--- +++ @@ -0,0 +1,46 @@ +"""Management command to grant or revoke superuser access for one or more users""" + +from optparse import make_option +from django.contrib.auth.models import User +from django.core.management.base import BaseCommand, CommandError + + +class Command(BaseCommand): + """Management command t...
ade8079d2e455899381bba1738373f734e2d3508
parser.py
parser.py
from collections import namedtuple IRCMsg = namedtuple('IRCMsg', 'prefix cmd params postfix') def parse(line): """ Parses line and returns a named tuple IRCMsg with fields (prefix, cmd, params, postfix). - prefix is the first part starting with : (colon), without the : - cmd is the command...
Add module for parsing IRC messages
Add module for parsing IRC messages
Python
mit
aalien/mib
--- +++ @@ -0,0 +1,43 @@ +from collections import namedtuple + +IRCMsg = namedtuple('IRCMsg', 'prefix cmd params postfix') + +def parse(line): + """ Parses line and returns a named tuple IRCMsg + with fields (prefix, cmd, params, postfix). + - prefix is the first part starting with : (colon), without...
39440a6fe065f29440e6f819dedc52f1ef47774c
test/models/test_software.py
test/models/test_software.py
from test.base import ApiDBTestCase from zou.app.models.software import Software from zou.app.utils import fields class SoftwareTestCase(ApiDBTestCase): def setUp(self): super(SoftwareTestCase, self).setUp() self.generate_data(Software, 3) def test_get_softwares(self): softwares = ...
Add tests for software model crud routes
Add tests for software model crud routes
Python
agpl-3.0
cgwire/zou
--- +++ @@ -0,0 +1,55 @@ +from test.base import ApiDBTestCase + +from zou.app.models.software import Software + +from zou.app.utils import fields + + +class SoftwareTestCase(ApiDBTestCase): + + def setUp(self): + super(SoftwareTestCase, self).setUp() + self.generate_data(Software, 3) + + def test_...
726b8d169923e31e1efbd1385e9f29f5fd8793f4
tests/create-task.py
tests/create-task.py
#!/usr/bin/env python import sys, dbus, dbus.glib #import pdb # Get the D-Bus Session Bus bus = dbus.SessionBus() #Access the ICEcore Daemon Object obj = bus.get_object("org.gnome.Tasque", "/org/gnome/Tasque/RemoteControl") #Access the remote control interface tasque = dbus.Interface(obj, "org.gnome.Tasque.RemoteC...
Move python test script to tests (part 2)
Move python test script to tests (part 2)
Python
mit
mono-soc-2012/Tasque,mono-soc-2012/Tasque,mono-soc-2012/Tasque
--- +++ @@ -0,0 +1,21 @@ +#!/usr/bin/env python +import sys, dbus, dbus.glib + +#import pdb + +# Get the D-Bus Session Bus +bus = dbus.SessionBus() + +#Access the ICEcore Daemon Object +obj = bus.get_object("org.gnome.Tasque", + "/org/gnome/Tasque/RemoteControl") + +#Access the remote control interface +tasque = dbus...
9a3d3e70c193cd0dfef51d4a0d02ebc21b7933bc
final/usresident.py
final/usresident.py
## DO NOT MODIFY THE IMPLEMENTATION OF THE Person CLASS ## class Person(object): def __init__(self, name): #create a person with name name self.name = name try: firstBlank = name.rindex(' ') self.lastName = name[firstBlank+1:] except: self...
Implement two methods in the USResident class
Implement two methods in the USResident class
Python
mit
Kunal57/MIT_6.00.1x
--- +++ @@ -0,0 +1,61 @@ +## DO NOT MODIFY THE IMPLEMENTATION OF THE Person CLASS ## +class Person(object): + def __init__(self, name): + #create a person with name name + self.name = name + try: + firstBlank = name.rindex(' ') + self.lastName = name[firstBlank+1:] + ...
7aab4b3e2761209aae312512ec6582a83865c912
tests/test_logger.py
tests/test_logger.py
import pytest from mugloar import dragon, logger @pytest.fixture def log_instance(): """Returns a Logger instance""" return logger.Logger() @pytest.fixture def knight(): return {'agility': 8, 'endurance': 8, 'name': 'Sir. Stephen Mathis of Nova Scotia', 'armor': 0, 'attack': 4} @pytest.fixture def dragon...
Implement unit tests for logger class
Implement unit tests for logger class
Python
mit
reinikai/mugloar
--- +++ @@ -0,0 +1,25 @@ +import pytest +from mugloar import dragon, logger + +@pytest.fixture +def log_instance(): + """Returns a Logger instance""" + return logger.Logger() + +@pytest.fixture +def knight(): + return {'agility': 8, 'endurance': 8, 'name': 'Sir. Stephen Mathis of Nova Scotia', 'armor': 0, 'a...
d3bcd60c92939211716e82718871559c38ddc19d
tests/test_random.py
tests/test_random.py
""" Random and quasi-random generator tests. """ from __future__ import division from __future__ import absolute_import from __future__ import print_function import numpy.testing as nt from mwhutils.random import rstate from mwhutils.random import uniform, latin, sobol def test_rstate(): """Test the rstate hel...
Add test for random number generators.
Add test for random number generators.
Python
bsd-2-clause
mwhoffman/mwhutils
--- +++ @@ -0,0 +1,38 @@ +""" +Random and quasi-random generator tests. +""" + +from __future__ import division +from __future__ import absolute_import +from __future__ import print_function + +import numpy.testing as nt + +from mwhutils.random import rstate +from mwhutils.random import uniform, latin, sobol + + +def...
f6f13b4ff52fbe9346e9f60ba054b305da122d36
tests/test_server.py
tests/test_server.py
import os import time import pytest import requests import json import yaml HERE = os.path.dirname(os.path.abspath(__file__)) @pytest.fixture() def sess(): sess = requests.Session() sess.headers = { 'Content-Type': 'application/json' } return sess class TestStartProc(object): def tes...
Add some initial tests. These require the server to be running.
Add some initial tests. These require the server to be running.
Python
bsd-3-clause
ionrock/dadd,ionrock/dadd,ionrock/dadd,ionrock/dadd
--- +++ @@ -0,0 +1,68 @@ +import os +import time + +import pytest +import requests +import json +import yaml + + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +@pytest.fixture() +def sess(): + sess = requests.Session() + sess.headers = { + 'Content-Type': 'application/json' + } + return se...
76aae555aefa154ad30aec6d63669c6b0b520087
tests/test_init.py
tests/test_init.py
from flexmock import flexmock import flask_uploads from flask_uploads import Upload from . import TestCase class TestWithoutResizer(TestCase): def test_upload_class_has_correct_attributes(self): assert hasattr(Upload, 'id') assert Upload.id == ( 'column', (('integer', [], {...
Add tests for init function.
Add tests for init function.
Python
mit
FelixLoether/flask-uploads,FelixLoether/flask-image-upload-thing
--- +++ @@ -0,0 +1,78 @@ +from flexmock import flexmock +import flask_uploads +from flask_uploads import Upload +from . import TestCase + + +class TestWithoutResizer(TestCase): + def test_upload_class_has_correct_attributes(self): + assert hasattr(Upload, 'id') + assert Upload.id == ( + 'c...
a0771954902d6c4af2709d871a115680f89a0497
installer/terraform/jazz-terraform-unix-noinstances/scripts/gitlab_privatetoken.py
installer/terraform/jazz-terraform-unix-noinstances/scripts/gitlab_privatetoken.py
import requests from datetime import date from urlparse import urljoin from bs4 import BeautifulSoup def find_csrf_token(text): soup = BeautifulSoup(text, "lxml") token = soup.find(attrs={"name": u"csrf-token"}) param = soup.find(attrs={"name": u"csrf-param"}) data = {param.get("content"): token.get(u...
Add alt implementation to try and see if it works better
Add alt implementation to try and see if it works better
Python
apache-2.0
tmobile/jazz-installer,tmobile/jazz-installer,tmobile/jazz-installer,tmobile/jazz-installer
--- +++ @@ -0,0 +1,60 @@ +import requests +from datetime import date +from urlparse import urljoin +from bs4 import BeautifulSoup + + +def find_csrf_token(text): + soup = BeautifulSoup(text, "lxml") + token = soup.find(attrs={"name": u"csrf-token"}) + param = soup.find(attrs={"name": u"csrf-param"}) + dat...
c8af96f89ca218c0c49b90b39fe6ea4339e39321
tests/test_html_formatter.py
tests/test_html_formatter.py
# -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2006 by Georg Brandl. :license: BSD, see LICENSE for more details. """ import unittest import StringIO import random from pygments import lexers, formatters from pygments.token import _TokenType class...
Add a reminder to write a HTML formatter test.
[svn] Add a reminder to write a HTML formatter test.
Python
bsd-2-clause
aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygmen...
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +""" + Pygments HTML formatter tests + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: 2006 by Georg Brandl. + :license: BSD, see LICENSE for more details. +""" + +import unittest +import StringIO +import random + +from pygments import lexers, formatters +fr...
5276206be1698e9adb231e61c2686f640825f6a7
dynamicforms/utils.py
dynamicforms/utils.py
def get_class(class_string, exception=Exception): """ Convert a string version of a function name to the callable object. """ if not hasattr(class_string, '__bases__'): try: class_string = class_string.encode('ascii') mod_name, class_name = get_mod_func(class_string) ...
Add string to callable util functions
Add string to callable util functions
Python
bsd-3-clause
SheepDogInc/django-dynamicforms,SheepDogInc/django-dynamicforms
--- +++ @@ -0,0 +1,27 @@ +def get_class(class_string, exception=Exception): + """ + Convert a string version of a function name to the callable object. + """ + if not hasattr(class_string, '__bases__'): + try: + class_string = class_string.encode('ascii') + mod_name, class_nam...
bad1a775e54ab2681adbeec483a7035b1d966ded
blvd_text2svm.py
blvd_text2svm.py
import os import re import unicodedata from libshorttext.converter import * def tokenizer(text): def trim_links(input_text): input_text = re.sub(r' (http|www|t\.co).*?(?: |$)', '', input_text) return input_text def trim_char(c): if ord(c) > 127: return '' if c.is...
Add custom text2svm preprocessor with a blvd-minded tokenizer.
Add custom text2svm preprocessor with a blvd-minded tokenizer.
Python
bsd-3-clause
izimobile/libshorttext,izimobile/libshorttext,izimobile/libshorttext,izimobile/libshorttext,izimobile/libshorttext
--- +++ @@ -0,0 +1,66 @@ +import os +import re +import unicodedata + +from libshorttext.converter import * + + +def tokenizer(text): + + def trim_links(input_text): + input_text = re.sub(r' (http|www|t\.co).*?(?: |$)', '', input_text) + return input_text + + def trim_char(c): + if ord(c) > ...
96101d6158d7cf3e3e0efd287cefa27230d2f556
py/subtree-of-another-tree.py
py/subtree-of-another-tree.py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def sameTree(self, t1, t2): if t1 is None and t2 is None: return True if t1 is None or t2 is ...
Add py solution for 572. Subtree of Another Tree
Add py solution for 572. Subtree of Another Tree 572. Subtree of Another Tree: https://leetcode.com/problems/subtree-of-another-tree/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,35 @@ +# Definition for a binary tree node. +# class TreeNode(object): +# def __init__(self, x): +# self.val = x +# self.left = None +# self.right = None + +class Solution(object): + def sameTree(self, t1, t2): + if t1 is None and t2 is None: + retur...
ed78dc7ce37ebaedba5a59d80e2d8821c711a44d
nx_cx_Freeze/__init__.py
nx_cx_Freeze/__init__.py
"""cx_Freeze extension Extends the 'build' command with the 'exe-command' option to allow using a different command from 'build_exe' to build executables from Python scripts. """ import sys import distutils.command.build from cx_Freeze.dist import build as cx_build from cx_Freeze.dist import setup as cx_setup from cx...
Extend cx_Freeze build class with the exe-command option to allow using a different command from build_exe to build executables from Python scripts
NXP-13818: Extend cx_Freeze build class with the exe-command option to allow using a different command from build_exe to build executables from Python scripts
Python
lgpl-2.1
IsaacYangSLA/nuxeo-drive,arameshkumar/base-nuxeo-drive,arameshkumar/base-nuxeo-drive,rsoumyassdi/nuxeo-drive,rsoumyassdi/nuxeo-drive,arameshkumar/nuxeo-drive,IsaacYangSLA/nuxeo-drive,loopingz/nuxeo-drive,loopingz/nuxeo-drive,ssdi-drive/nuxeo-drive,rsoumyassdi/nuxeo-drive,DirkHoffmann/nuxeo-drive,DirkHoffmann/nuxeo-driv...
--- +++ @@ -0,0 +1,34 @@ +"""cx_Freeze extension + +Extends the 'build' command with the 'exe-command' option to allow using a +different command from 'build_exe' to build executables from Python scripts. +""" + +import sys +import distutils.command.build +from cx_Freeze.dist import build as cx_build +from cx_Freeze....
103090f79c30ef018be383df745998601626f918
tests/test_apiv2_controller.py
tests/test_apiv2_controller.py
import unittest2 import webtest import json import webapp2 from google.appengine.ext import testbed from controllers.api.api_event_controller import ApiEventController class TestApiController(unittest2.TestCase): def setUp(self): # Use ApiEventController as a random API controller to test on app...
Add test cases for X-TBA-App-Id
api: Add test cases for X-TBA-App-Id
Python
mit
jaredhasenklein/the-blue-alliance,synth3tk/the-blue-alliance,fangeugene/the-blue-alliance,josephbisch/the-blue-alliance,synth3tk/the-blue-alliance,1fish2/the-blue-alliance,jaredhasenklein/the-blue-alliance,1fish2/the-blue-alliance,josephbisch/the-blue-alliance,bdaroz/the-blue-alliance,bvisness/the-blue-alliance,tstewar...
--- +++ @@ -0,0 +1,56 @@ +import unittest2 +import webtest +import json +import webapp2 + +from google.appengine.ext import testbed + +from controllers.api.api_event_controller import ApiEventController + +class TestApiController(unittest2.TestCase): + + def setUp(self): + # Use ApiEventController as a rand...
26b3423fb2ff9c05f00cba6e57b47174ec248804
test/skills/scheduled_skills.py
test/skills/scheduled_skills.py
from datetime import datetime, timedelta import unittest from mycroft.skills.scheduled_skills import ScheduledSkill from mycroft.util.log import getLogger __author__ = 'eward' logger = getLogger(__name__) class ScheduledSkillTest(unittest.TestCase): skill = ScheduledSkill(name='ScheduledSkillTest') def te...
from datetime import datetime, timedelta import unittest from mycroft.skills.scheduled_skills import ScheduledSkill from mycroft.util.log import getLogger __author__ = 'eward' logger = getLogger(__name__) class ScheduledSkillTest(unittest.TestCase): skill = ScheduledSkill(name='ScheduledSkillTest') def te...
Correct test criteria for time format for scheduled skill.
Correct test criteria for time format for scheduled skill. Now matches current behaviour, previous behaviour is not a good idea since it depended on Locale.
Python
apache-2.0
linuxipho/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core,MycroftAI/mycroft-core,Dark5ide/mycroft-core,aatchison/mycroft-core,MycroftAI/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,forslund/mycroft-core
--- +++ @@ -28,4 +28,4 @@ date = datetime.now() + timedelta(days=2) self.assertEquals(self.skill. get_formatted_time(float(date.strftime('%s'))), - date.strftime("%A, %B %d, %Y at %H:%M")) + date.strftime("%d %B, %Y at %H:%...
4da778d9f0705505a6e38989ac55cf4cbc7db83a
capture_nids.py
capture_nids.py
import os import json import time, datetime import parsers import logging import csv import re import requests from sqlalchemy import types from backend.app import app, db from backend.models import * from backend.search import Search from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound from sqlalchemy im...
Add script for capturing meeting report nids from dump.
Add script for capturing meeting report nids from dump.
Python
apache-2.0
Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2
--- +++ @@ -0,0 +1,73 @@ +import os +import json +import time, datetime +import parsers +import logging +import csv +import re +import requests +from sqlalchemy import types +from backend.app import app, db +from backend.models import * +from backend.search import Search +from sqlalchemy.orm.exc import NoResultFound,...
e614115b8b31220c5d577d42fdf9ac4202874c8e
events/migrations/0008_auto_20151127_1019.py
events/migrations/0008_auto_20151127_1019.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('events', '0007_organization_admin_users'), ] operations = [ migrations.AlterField( ...
Add forgotten migration for Organization.admin_users field's blank=True.
Add forgotten migration for Organization.admin_users field's blank=True.
Python
mit
City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,tuomas777/linkedevents,tuomas777/linkedevents,aapris/linkedevents,kooditiimi/linkedevents,kooditiimi/linkedevents,kooditiimi/linkedevents,kooditiimi/linkedevents,tuomas777/linkedevents,City-of-Helsinki/linkedevents,aapris/linkedevents,aapris/linkedevents
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('events', '0007_organization_admin_users'), + ] + + operations = ...
f94f2ee4e61c683d2e05e1797ca3752d46b27a47
scripts/CalculateLocalityFDR.py
scripts/CalculateLocalityFDR.py
import camoco as co import glob import pandas as pd import os def read_FDR(glob_path): dfs = [] for x in glob.glob(glob_path): df = pd.read_table(x,sep=',') net,gwas,win,flank,*junk = os.path.basename(x).replace('.','_').split('_') if 'WindowSize' not in df.columns: df.inser...
Create scripts making downstream aggragation and stats easier.
Create scripts making downstream aggragation and stats easier.
Python
mit
schae234/Camoco,schae234/Camoco
--- +++ @@ -0,0 +1,39 @@ +import camoco as co +import glob +import pandas as pd +import os + +def read_FDR(glob_path): + dfs = [] + for x in glob.glob(glob_path): + df = pd.read_table(x,sep=',') + net,gwas,win,flank,*junk = os.path.basename(x).replace('.','_').split('_') + if 'WindowSize' n...
45d1aa0c6aa7af3f097416f0215c5629706437ca
src/reindex_all_marks.py
src/reindex_all_marks.py
#!/usr/bin/env python import convenience as c import jobs def main(): c.load_settings() logger = c.logger("reindex_all_bookmarks") db = c.db() records = db.marks.find({":": {"$exists": False}}) number = records.count() count = 1 for record in records: logger.info("{count} of {numbe...
Add admin task to reindex all marks
Add admin task to reindex all marks
Python
agpl-3.0
calpaterson/recall,calpaterson/recall,calpaterson/recall
--- +++ @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import convenience as c +import jobs + +def main(): + c.load_settings() + logger = c.logger("reindex_all_bookmarks") + db = c.db() + records = db.marks.find({":": {"$exists": False}}) + number = records.count() + count = 1 + for record in records...
8e1ebcad18ddde87cdf6a46d673f90030cfe4e26
q3/FindAllAbbreviations.py
q3/FindAllAbbreviations.py
import sys def prependAbbrev(front, abbr): if type(front) is type(abbr[0]): return [front + abbr[0]] + abbr[1:] else: return [front] + abbr def prefixAll(p, lst): return [prependAbbrev(p, l) for l in lst] def findAllAbbrev(s): if len(s) == 1: return [[s], [1]] else: ...
Add python answer to q3
Add python answer to q3
Python
mit
UW-UPL/InterviewPrepJan2016,UW-UPL/InterviewPrepJan2016,UW-UPL/InterviewPrepJan2016,UW-UPL/InterviewPrepJan2016
--- +++ @@ -0,0 +1,20 @@ +import sys + +def prependAbbrev(front, abbr): + if type(front) is type(abbr[0]): + return [front + abbr[0]] + abbr[1:] + else: + return [front] + abbr + +def prefixAll(p, lst): + return [prependAbbrev(p, l) for l in lst] + +def findAllAbbrev(s): + if len(s) == 1...
3bb0563daed1660bbede02737b1d3a38e306e9bc
build/transform-sql.py
build/transform-sql.py
#!/usr/bin/env python # # transform-sql.py -- create a header file with the appropriate SQL variables # from an SQL file # import os import re import sys def usage_and_exit(msg): if msg: sys.stderr.write("%s\n\n" % msg) sys.stderr.write("usage: %s [sqlite_file]\n" % \ os.path.basename(sys.argv[0])) sy...
Add a helper script which will transform a file full of SQL commands into a header file suitable for inclusion in a standard C file and use with the Subversion SQLite APIs. The goal here is that we can maintain our SQL schema directly as such, and let this script do the appropriate transformation as part of autogen.sh.
Add a helper script which will transform a file full of SQL commands into a header file suitable for inclusion in a standard C file and use with the Subversion SQLite APIs. The goal here is that we can maintain our SQL schema directly as such, and let this script do the appropriate transformation as part of autogen.sh...
Python
apache-2.0
jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# +# transform-sql.py -- create a header file with the appropriate SQL variables +# from an SQL file +# + + +import os +import re +import sys + + +def usage_and_exit(msg): + if msg: + sys.stderr.write("%s\n\n" % msg) + sys.stderr.write("usage: %s [sqlite_file]\n" ...
36fd334a4b7a1adbe578a680d7d79e338452ea1a
Lib/importlib/test/benchmark.py
Lib/importlib/test/benchmark.py
from . import util from .source import util as source_util import gc import decimal import imp import importlib import sys import timeit def bench_cache(import_, repeat, number): """Measure the time it takes to pull from sys.modules.""" name = '<benchmark import>' with util.uncache(name): module =...
Add simple tests for __import__ for future optimizations to importlib.
Add simple tests for __import__ for future optimizations to importlib.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -0,0 +1,82 @@ +from . import util +from .source import util as source_util +import gc +import decimal +import imp +import importlib +import sys +import timeit + + +def bench_cache(import_, repeat, number): + """Measure the time it takes to pull from sys.modules.""" + name = '<benchmark import>' + ...
4b45f50c3321dc6b79ad6fbc167a4f895aaac869
src/83_Remove_Duplicates_from_Sorted_List.py
src/83_Remove_Duplicates_from_Sorted_List.py
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode """ temp = head while te...
Remove Duplicates from Sorted List
完成了第83题: Remove Duplicates from Sorted List
Python
mit
ChuanleiGuo/AlgorithmsPlayground,ChuanleiGuo/AlgorithmsPlayground,ChuanleiGuo/AlgorithmsPlayground,ChuanleiGuo/AlgorithmsPlayground
--- +++ @@ -0,0 +1,20 @@ +# Definition for singly-linked list. +# class ListNode(object): +# def __init__(self, x): +# self.val = x +# self.next = None + + +class Solution(object): + def deleteDuplicates(self, head): + """ + :type head: ListNode + :rtype: ListNode + ...
b03d28d21f73e8f8fabab5edcb9a0317e20c19c4
lexos/views/bct_view.py
lexos/views/bct_view.py
from flask import session, render_template, Blueprint from lexos.helpers import constants from lexos.views.base_view import detect_active_docs from lexos.models.filemanager_model import FileManagerModel # this is a flask blue print # it helps us to manage groups of views # see here for more detail: # http://explorefla...
Add view for bct analysis
Add view for bct analysis
Python
mit
WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos
--- +++ @@ -0,0 +1,34 @@ +from flask import session, render_template, Blueprint +from lexos.helpers import constants +from lexos.views.base_view import detect_active_docs +from lexos.models.filemanager_model import FileManagerModel + +# this is a flask blue print +# it helps us to manage groups of views +# see here f...
48ec3105c0dafaa3595b0ee565fef24d35ed6194
scripts/shutdown_button.py
scripts/shutdown_button.py
#!/usr/bin/env python # Copyright (C) 2014 Gregory S. Meiste <http://gregmeiste.com> # # 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 # # ...
Add script to shutdown Raspberry Pi on button press
Add script to shutdown Raspberry Pi on button press Signed-off-by: Greg Meiste <8a8f45e57c045ec63dc7e56e5eda862ea8c7cd4f@gmail.com>
Python
apache-2.0
meisteg/RaspberryPiTempAlarm,meisteg/RaspberryPiTempAlarm,meisteg/RaspberryPiTempAlarm
--- +++ @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +# Copyright (C) 2014 Gregory S. Meiste <http://gregmeiste.com> +# +# 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....
f26e8927f83c3a897d4f474762bca9775467e74e
src/helpers/vyos-load-config.py
src/helpers/vyos-load-config.py
#!/usr/bin/env python3 # # Copyright (C) 2019 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as # published by the Free Software Foundation. # # This program is distributed in the hope t...
Rewrite the config load script
T1424: Rewrite the config load script Rewrite of the load functionality of vyatta-load-config.pl, removing the dependency on Vyatta::Config.
Python
lgpl-2.1
vyos/vyos-1x,vyos/vyos-1x,vyos/vyos-1x,vyos/vyos-1x
--- +++ @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2019 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later as +# published by the Free Software Foundation. +# +# This ...
218848f916ffe55bed2e914ee5aa7be459d0ff4a
openstack/tests/functional/telemetry/v2/test_alarm.py
openstack/tests/functional/telemetry/v2/test_alarm.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add functional tests for telemetry alarm crud
Add functional tests for telemetry alarm crud Change-Id: I77399eb47761c8de04095c06cd67d5d09e644df4
Python
apache-2.0
briancurtin/python-openstacksdk,stackforge/python-openstacksdk,dtroyer/python-openstacksdk,briancurtin/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-openstacksdk,dtroyer/python-openstacksdk,dudymas/python-openstacksdk,dudymas/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-opens...
--- +++ @@ -0,0 +1,52 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writi...
02664bd5fbd1581bc4817a942f690a5e6a5b9929
share/render-template.py
share/render-template.py
#!/usr/bin/env python from jinja2 import Environment, FileSystemLoader import yaml import os import sys def main(): # Check command line if len(sys.argv) != 2: print("Usage: render-template.py device") sys.exit(1) device = sys.argv[1] env = Environment(loader=FileSystemLoader( ...
Add an helper to render device conf templates
Add an helper to render device conf templates Change-Id: Ida10d2963969b12aeb04ef034fa7814ffaf2c8ed
Python
agpl-3.0
Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +from jinja2 import Environment, FileSystemLoader +import yaml + +import os +import sys + + +def main(): + # Check command line + if len(sys.argv) != 2: + print("Usage: render-template.py device") + sys.exit(1) + + device = sys.argv[1] + + env = Environment(...
bc1faaa6265f70254702709efb7f8410fbe07286
alexa-british-problems.py
alexa-british-problems.py
import json import time import requests import unidecode from flask import Flask from flask_ask import Ask, question, session, statement APP = Flask(__name__) ASK = Ask(APP, "/british_problems") def get_british_problems(): """Get the titles of the /r/britishproblems posts""" user_pass_dict = {...
Add alexa skill basic functionality
Add alexa skill basic functionality
Python
mit
Sorsby/alexa-british-problems
--- +++ @@ -0,0 +1,65 @@ +import json +import time + +import requests +import unidecode +from flask import Flask +from flask_ask import Ask, question, session, statement + +APP = Flask(__name__) +ASK = Ask(APP, "/british_problems") + + +def get_british_problems(): + """Get the titles of the /r/britishproblems post...
38a07f395ffa6bfe20cf4c205c8b4cf30411fab5
evaluation/packages/orderedSet.py
evaluation/packages/orderedSet.py
""" Code from http://code.activestate.com/recipes/576694/ """ import collections class OrderedSet(collections.MutableSet): def __init__(self, iterable=None): self.end = end = [] end += [None, end, end] # sentinel node for doubly linked list self.map = {} # key -...
Add new ordered set class
Add new ordered set class
Python
apache-2.0
amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,amonszpart/globOpt,amonszpart/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt
--- +++ @@ -0,0 +1,72 @@ +""" +Code from http://code.activestate.com/recipes/576694/ +""" + +import collections + +class OrderedSet(collections.MutableSet): + + def __init__(self, iterable=None): + self.end = end = [] + end += [None, end, end] # sentinel node for doubly linked list + ...
9a36a91a9fff8b6ce0deaf8c1aee259e2abc911e
examples/multiline_echo_server.py
examples/multiline_echo_server.py
#!/usr/bin/env python from gaidaros import * server = Gaidaros(end_request = lambda x: '\n\n' in x, split_request = lambda x: return(x[:x.find('\n\n') + 1], x[x.find('\n\n') + 1:])) server.serve()
Add multiline echo server example script
Add multiline echo server example script
Python
mit
rowanthorpe/gaidaros
--- +++ @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +from gaidaros import * +server = Gaidaros(end_request = lambda x: '\n\n' in x, split_request = lambda x: return(x[:x.find('\n\n') + 1], x[x.find('\n\n') + 1:])) +server.serve()
9ae8dcb6eca400e4d58a652a0d949087f321c307
python/misc/fizzbuzz.py
python/misc/fizzbuzz.py
#!/usr/bin/env python # pylint: disable=C0111 # pylint: disable=C0103 # pylint: disable=C0330 MAX = 31 def simple(): print ('--- SIMPLE -----') for i in range(1, MAX): output = '' if i % 3 == 0: output += 'Fizz' if i % 5 == 0: output += 'Buzz' if not out...
Add a few fizz buzz attempts
Add a few fizz buzz attempts
Python
mit
petarov/sandbox,petarov/sandbox,petarov/sandbox,petarov/sandbox,petarov/sandbox,petarov/sandbox,petarov/sandbox,petarov/sandbox,petarov/sandbox
--- +++ @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# pylint: disable=C0111 +# pylint: disable=C0103 +# pylint: disable=C0330 + +MAX = 31 + +def simple(): + print ('--- SIMPLE -----') + for i in range(1, MAX): + output = '' + if i % 3 == 0: + output += 'Fizz' + if i % 5 == 0: + ...
9cd5226f64b93d19f6af7cfd76436118b00bd781
example/amex.py
example/amex.py
# Example on how to use the ofxclient library without the # web interface. It's admittedly clunky but doable -- it's # free so get over it >=) import ofxclient from pprint import pprint # http://www.ofxhome.com/index.php/institution/view/424 # note this is NOT the FI Id. It's the ofxhome ID. ofxhome_id = '424' you...
Add an example on the library usage
Add an example on the library usage
Python
mit
jbms/ofxclient,captin411/ofxclient
--- +++ @@ -0,0 +1,42 @@ +# Example on how to use the ofxclient library without the +# web interface. It's admittedly clunky but doable -- it's +# free so get over it >=) +import ofxclient +from pprint import pprint + +# http://www.ofxhome.com/index.php/institution/view/424 +# note this is NOT the FI Id. It's the of...
f4fa2d526f6f9c8b972c20ac073ed8f0682871ea
indra/tools/disambiguate.py
indra/tools/disambiguate.py
import logging from collections import defaultdict from indra.literature.elsevier_client import logger as elsevier_logger from indra.literature import pubmed_client, pmc_client, elsevier_client logger = logging.getLogger('disambiguate') # the elsevier_client will log messages that it is safe to ignore elsevier_logge...
Add unfinished scripts that assist in deft disambiguation
Add unfinished scripts that assist in deft disambiguation git history was completley farbed through carelessness. the original deft branch was deleted and a new branch was created
Python
bsd-2-clause
bgyori/indra,pvtodorov/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,pvtodorov/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/belpy,pvtodorov/indra,bgyori/indra,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,johnbachman/indra,johnbachman/belpy,johnbachman/belpy,bgyori/indra
--- +++ @@ -0,0 +1,48 @@ +import logging +from collections import defaultdict + +from indra.literature.elsevier_client import logger as elsevier_logger +from indra.literature import pubmed_client, pmc_client, elsevier_client + +logger = logging.getLogger('disambiguate') + +# the elsevier_client will log messages that...
a4ed98ddec2afd5121f90db3ed6927c078958f81
cdf/jinja_utils.py
cdf/jinja_utils.py
from jinja2 import ( select_autoescape, Environment, FileSystemLoader, ) template_env = Environment( loader=FileSystemLoader("templates"), autoescape=select_autoescape(['html', 'xml']) )
Create a jinja2 env for rendering templates
Create a jinja2 env for rendering templates
Python
mit
ana-balica/classy-django-forms,ana-balica/classy-django-forms,ana-balica/classy-django-forms
--- +++ @@ -0,0 +1,11 @@ +from jinja2 import ( + select_autoescape, + Environment, + FileSystemLoader, +) + + +template_env = Environment( + loader=FileSystemLoader("templates"), + autoescape=select_autoescape(['html', 'xml']) +)
110445d89f230cc71bfd970845e0e63c13eeaff0
tests/test_datastore.py
tests/test_datastore.py
import pytest from web_test_base import * class TestIATIDatastore(WebTestBase): urls_to_get = [ "http://datastore.iatistandard.org/" ] def test_contains_links(self, loaded_request): """ Test that each page contains links to the defined URLs. """ result = self._get_l...
Add tests for the IATI Datastore This adds a 200 response and link checks for the IATI Datastore
Add tests for the IATI Datastore This adds a 200 response and link checks for the IATI Datastore
Python
mit
IATI/IATI-Website-Tests
--- +++ @@ -0,0 +1,15 @@ +import pytest +from web_test_base import * + +class TestIATIDatastore(WebTestBase): + urls_to_get = [ + "http://datastore.iatistandard.org/" + ] + + def test_contains_links(self, loaded_request): + """ + Test that each page contains links to the defined URLs. + ...
3e3c2357305cee7bff1ee4f6697ad78f96c7ea04
tests/test_sqlite_db.py
tests/test_sqlite_db.py
''' Module for testing the SQLite DB. Fairly similar to the test_api tests... ''' import os import sys import json import unittest CWD = os.path.dirname(os.path.abspath(__file__)) MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Allow import of sqlite_driver if os.path.join(MS_WD, 'storage') not ...
Add first unit tests for sqlite db
Add first unit tests for sqlite db
Python
mpl-2.0
awest1339/multiscanner,jmlong1027/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,awest1339/multiscanner,MITRECND/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,awest1339/multiscanner
--- +++ @@ -0,0 +1,50 @@ +''' +Module for testing the SQLite DB. +Fairly similar to the test_api tests... +''' +import os +import sys +import json +import unittest + +CWD = os.path.dirname(os.path.abspath(__file__)) +MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +# Allow import of sqlite_drive...
153618fbd1bb23d57f14e52f09dc19720df83fd4
tests/test_transform.py
tests/test_transform.py
import unittest class RoadSortKeyTest(unittest.TestCase): def _call_fut(self, props, zoom=15, shape=None, fid=None): from TileStache.Goodies.VecTiles.transform import road_sort_key _, newprops, fid = road_sort_key(shape, props, fid, zoom) sort_key = newprops['sort_key'] return sor...
Add road sort key tests
Add road sort key tests
Python
mit
mapzen/tilequeue,tilezen/tilequeue
--- +++ @@ -0,0 +1,66 @@ +import unittest + + +class RoadSortKeyTest(unittest.TestCase): + + def _call_fut(self, props, zoom=15, shape=None, fid=None): + from TileStache.Goodies.VecTiles.transform import road_sort_key + _, newprops, fid = road_sort_key(shape, props, fid, zoom) + sort_key = new...
42bb37178827669e89e9222c24f79de38c5b75b8
gen-changelog.py
gen-changelog.py
# Writes a changelog in trac WikiFormatting based on a git log from __future__ import unicode_literals, division, absolute_import import codecs from itertools import ifilter import os import re import subprocess import sys import dateutil.parser out_path = 'ChangeLog' if len(sys.argv) > 1: dir_name = os.path.dir...
Add a helper script to generate a changelog from git log
Add a helper script to generate a changelog from git log
Python
mit
tsnoam/Flexget,OmgOhnoes/Flexget,v17al/Flexget,ZefQ/Flexget,qvazzler/Flexget,ianstalk/Flexget,LynxyssCZ/Flexget,malkavi/Flexget,tarzasai/Flexget,jacobmetrick/Flexget,ibrahimkarahan/Flexget,JorisDeRieck/Flexget,jawilson/Flexget,Danfocus/Flexget,jawilson/Flexget,cvium/Flexget,Flexget/Flexget,poulpito/Flexget,vfrc2/Flexge...
--- +++ @@ -0,0 +1,36 @@ +# Writes a changelog in trac WikiFormatting based on a git log +from __future__ import unicode_literals, division, absolute_import + +import codecs +from itertools import ifilter +import os +import re +import subprocess +import sys + +import dateutil.parser + +out_path = 'ChangeLog' +if len(...
c6e15f8e66fe542c459ac75f1ef6db080249e9d0
py/test/selenium/webdriver/chrome/conftest.py
py/test/selenium/webdriver/chrome/conftest.py
# Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
Allow driver fixtures to be used in Chrome only tests
[py] Allow driver fixtures to be used in Chrome only tests
Python
apache-2.0
titusfortner/selenium,HtmlUnit/selenium,Ardesco/selenium,joshmgrant/selenium,HtmlUnit/selenium,titusfortner/selenium,SeleniumHQ/selenium,valfirst/selenium,HtmlUnit/selenium,HtmlUnit/selenium,valfirst/selenium,SeleniumHQ/selenium,Ardesco/selenium,HtmlUnit/selenium,HtmlUnit/selenium,Ardesco/selenium,Ardesco/selenium,Sele...
--- +++ @@ -0,0 +1,21 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2....
d07f0ab7f437809a2811f0f1fdab396cbcac740f
python/opencv/opencv_2/display_image.py
python/opencv/opencv_2/display_image.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) """ OpenCV - Display image: display an image given in arguments Required: opencv library (Debian: aptitude install python-opencv) See: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/...
Add a snippet (Python OpenCV).
Add a snippet (Python OpenCV).
Python
mit
jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) + +""" +OpenCV - Display image: display an image given in arguments + +Required: opencv library (Debian: aptitude install python-opencv) + +See: https://opencv-python-tutroals.readthed...
13c3190c6e89c2037c9b2bcce8a89dd43a58b53f
rummage/lib/gui/controls/time_picker.py
rummage/lib/gui/controls/time_picker.py
"""Custom time picker that allows us control of the control's color.""" from wx.lib.masked import TimeCtrl from ... util import rgba import wx class TimePickerCtrl(TimeCtrl): """Time picker that we can force proper colors on.""" def __init__(self, parent, *args, **kwargs): """ Initialize. ...
Add custom time picker control
Add custom time picker control
Python
mit
facelessuser/Rummage,facelessuser/Rummage,facelessuser/Rummage
--- +++ @@ -0,0 +1,38 @@ +"""Custom time picker that allows us control of the control's color.""" +from wx.lib.masked import TimeCtrl +from ... util import rgba +import wx + + +class TimePickerCtrl(TimeCtrl): + """Time picker that we can force proper colors on.""" + + def __init__(self, parent, *args, **kwargs)...
22102598e98371aed70866d8d8b48d96fb889708
liveplotkivy.py
liveplotkivy.py
''' kivy requires some library installation ''' import matplotlib matplotlib.use('module://kivy.garden.matplotlib.backend_kivy') import matplotlib.pyplot as plt import kivy kivy.require('1.10.0') # replace with your current kivy version ! from kivy.app import App from kivy.uix.button import Button from kivy.uix.box...
Add Kivy version of live audio stream
Add Kivy version of live audio stream
Python
bsd-3-clause
torebutlin/cued_datalogger
--- +++ @@ -0,0 +1,84 @@ +''' +kivy requires some library installation +''' + + +import matplotlib +matplotlib.use('module://kivy.garden.matplotlib.backend_kivy') + +import matplotlib.pyplot as plt +import kivy +kivy.require('1.10.0') # replace with your current kivy version ! + +from kivy.app import App +from kivy.u...
a5e05c411c229b128f56eddd027efc05230778f9
06-code-golf/tf-06-bm.py
06-code-golf/tf-06-bm.py
print (reduce(lambda string, tup: string + tup[0] + ' - ' + str(tup[1]) + '\n', sorted( filter(lambda tup: tup[0] not in open('../stop_words.txt').read().lower().split(','), reduce(lambda word_dict, word: word_dict if (word_dict.__setitem__(word, word_dict.get(word, 0) + 1) if True else None) else word_dict, filter(la...
Add a single-line code golf example
Add a single-line code golf example
Python
mit
kranthikumar/exercises-in-programming-style,kranthikumar/exercises-in-programming-style,aaron-goshine/exercises-in-programming-style,crista/exercises-in-programming-style,crista/exercises-in-programming-style,aaron-goshine/exercises-in-programming-style,crista/exercises-in-programming-style,aaron-goshine/exercises-in-p...
--- +++ @@ -0,0 +1 @@ +print (reduce(lambda string, tup: string + tup[0] + ' - ' + str(tup[1]) + '\n', sorted( filter(lambda tup: tup[0] not in open('../stop_words.txt').read().lower().split(','), reduce(lambda word_dict, word: word_dict if (word_dict.__setitem__(word, word_dict.get(word, 0) + 1) if True else None) ...
6fed44e26539e607e60acdc39aa73a69e769ec5f
tests/test_repo_not_found.py
tests/test_repo_not_found.py
# -*- coding: utf-8 -*- import pytest from cookiecutter import main, exceptions def test_should_raise_error_if_repo_does_not_exist(): with pytest.raises(exceptions.RepositoryNotFound): main.cookiecutter('definitely-not-a-valid-repo-dir')
Implement a test the RepositoryNotFound exception
Implement a test the RepositoryNotFound exception
Python
bsd-3-clause
Springerle/cookiecutter,stevepiercy/cookiecutter,willingc/cookiecutter,luzfcb/cookiecutter,luzfcb/cookiecutter,terryjbates/cookiecutter,Springerle/cookiecutter,michaeljoseph/cookiecutter,hackebrot/cookiecutter,willingc/cookiecutter,audreyr/cookiecutter,hackebrot/cookiecutter,audreyr/cookiecutter,pjbull/cookiecutter,mic...
--- +++ @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- + +import pytest + +from cookiecutter import main, exceptions + + +def test_should_raise_error_if_repo_does_not_exist(): + with pytest.raises(exceptions.RepositoryNotFound): + main.cookiecutter('definitely-not-a-valid-repo-dir')
830a17eca3550c3f4d9f4878d90405b288c10a42
official/utils/misc/callstack_sampler.py
official/utils/misc/callstack_sampler.py
"""A simple Python callstack sampler.""" import contextlib import datetime import signal import traceback class CallstackSampler(object): """A simple signal-based Python callstack sampler. """ def __init__(self, interval=None): self.stacks = [] self.interval = 0.001 if interval is None else interval ...
Add a simple signal-based Python callstack sampler for debugging
Add a simple signal-based Python callstack sampler for debugging
Python
apache-2.0
alexgorban/models,tombstone/models,tombstone/models,alexgorban/models,tombstone/models,alexgorban/models,tombstone/models,tombstone/models,tombstone/models,alexgorban/models,alexgorban/models
--- +++ @@ -0,0 +1,62 @@ +"""A simple Python callstack sampler.""" + +import contextlib +import datetime +import signal +import traceback + + +class CallstackSampler(object): + """A simple signal-based Python callstack sampler. + """ + + def __init__(self, interval=None): + self.stacks = [] + self.interval =...
ca056b16d5a39d5c8e95d8f2fe4d8678a0dfea0c
tests/test_corruption.py
tests/test_corruption.py
from io import BytesIO from unittest import TestCase import bigjson MISSING_OPEN_QUOTE_JSON_FILE = b""" { "object": { "x": y" } } """ CORRUPT_BACKSLASH_ENCODING_JSON_FILE = b""" { "string": "\qblah" } """ MISSING_DIGIT_AFTER_DOT_JSON_FILE = b""" { "number": 14. } """ class TestCorruption(...
Add tests for improved exception messages
Add tests for improved exception messages
Python
mit
henu/bigjson
--- +++ @@ -0,0 +1,56 @@ +from io import BytesIO +from unittest import TestCase + +import bigjson + + +MISSING_OPEN_QUOTE_JSON_FILE = b""" +{ + "object": { + "x": y" + } +} +""" + +CORRUPT_BACKSLASH_ENCODING_JSON_FILE = b""" +{ + "string": "\qblah" +} +""" + +MISSING_DIGIT_AFTER_DOT_JSON_FILE = b""" +...
2c41a6cf7c591de5a9e7a990ee9904c3949c3b2e
contacts/management/commands/populate_test_data.py
contacts/management/commands/populate_test_data.py
from django.core.management.base import BaseCommand from contacts.models import Book, Contact, ContactField class Command(BaseCommand): def handle(self, *args, **kwargs): book = Book.objects.get(id=1) for n in range(40): contact = Contact.objects.create( book=book, ...
Add a command to populate test data.
Add a command to populate test data.
Python
mit
phildini/logtacts,phildini/logtacts,phildini/logtacts,phildini/logtacts,phildini/logtacts
--- +++ @@ -0,0 +1,20 @@ +from django.core.management.base import BaseCommand + +from contacts.models import Book, Contact, ContactField + +class Command(BaseCommand): + + def handle(self, *args, **kwargs): + book = Book.objects.get(id=1) + for n in range(40): + contact = Contact.objects.c...
a04db731db1738b651a2cb9b5dacbe24e02e02ca
tests/test_server.py
tests/test_server.py
""" The tests provided in this module make sure that the server instance behaves as expected. """ import pytest from saltyrtc import server class TestServer: @pytest.mark.asyncio def test_repeated_permanent_keys(self, server_permanent_keys): """ Ensure the server does not accept repeated key...
Add test for repeated permanent keys on a Server class instance
Add test for repeated permanent keys on a Server class instance
Python
mit
saltyrtc/saltyrtc-server-python,saltyrtc/saltyrtc-server-python
--- +++ @@ -0,0 +1,20 @@ +""" +The tests provided in this module make sure that the server +instance behaves as expected. +""" + +import pytest + +from saltyrtc import server + + +class TestServer: + @pytest.mark.asyncio + def test_repeated_permanent_keys(self, server_permanent_keys): + """ + Ensu...
f0d1f7d5ff57b3359aa26f17297e6de9ff533eb1
examples/example_spline.py
examples/example_spline.py
""" This test file is meant for developing purposes. Providing an easy method to test the functioning of Pastas during development. """ import pandas as pd import pastas as ps ps.set_log_level("ERROR") # read observations and create the time series model obs = pd.read_csv("data/head_nb1.csv", index_col=0, parse_dat...
Add an example to compare Gamma and Spline
Add an example to compare Gamma and Spline
Python
mit
pastas/pasta,pastas/pastas
--- +++ @@ -0,0 +1,39 @@ +""" +This test file is meant for developing purposes. Providing an easy method to +test the functioning of Pastas during development. + +""" +import pandas as pd + +import pastas as ps + +ps.set_log_level("ERROR") + +# read observations and create the time series model +obs = pd.read_csv("da...
374dc84359bb41bbc94116b3a7662255fa5d147a
py/super-pow.py
py/super-pow.py
class Solution(object): def superPow(self, a, b): """ :type a: int :type b: List[int] :rtype: int """ MODULI = 1337 if a == 0: return 0 ans = 1 for n in b: ans = pow(ans, 10, MODULI) ans = (ans * pow(a, n, MO...
Add py solution for 372. Super Pow
Add py solution for 372. Super Pow 372. Super Pow: https://leetcode.com/problems/super-pow/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,15 @@ +class Solution(object): + def superPow(self, a, b): + """ + :type a: int + :type b: List[int] + :rtype: int + """ + MODULI = 1337 + if a == 0: + return 0 + ans = 1 + for n in b: + ans = pow(ans, 10, MODUL...
a69726510284bbb1b3e53de45024c0920124ecca
src/ggrc_basic_permissions/migrations/versions/20131206192611_1f865f61312_remove_delete_progra.py
src/ggrc_basic_permissions/migrations/versions/20131206192611_1f865f61312_remove_delete_progra.py
"""Remove delete program permission from ProgramEditor. Revision ID: 1f865f61312 Revises: eab1d38baee Create Date: 2013-12-06 19:26:11.875923 """ # revision identifiers, used by Alembic. revision = '1f865f61312' down_revision = 'eab1d38baee' import sqlalchemy as sa from alembic import op from datetime import datet...
Remove delete permission for Program resources from the ProgramEditor role.
Remove delete permission for Program resources from the ProgramEditor role.
Python
apache-2.0
j0gurt/ggrc-core,plamut/ggrc-core,vladan-m/ggrc-core,jmakov/ggrc-core,hyperNURb/ggrc-core,uskudnik/ggrc-core,josthkko/ggrc-core,hasanalom/ggrc-core,prasannav7/ggrc-core,hyperNURb/ggrc-core,selahssea/ggrc-core,vladan-m/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,kr41/...
--- +++ @@ -0,0 +1,47 @@ + +"""Remove delete program permission from ProgramEditor. + +Revision ID: 1f865f61312 +Revises: eab1d38baee +Create Date: 2013-12-06 19:26:11.875923 + +""" + +# revision identifiers, used by Alembic. +revision = '1f865f61312' +down_revision = 'eab1d38baee' + +import sqlalchemy as sa +from al...
3d83caa99fd861290ac21729e8ef1af1cb7a17bf
code/get_licenses.py
code/get_licenses.py
#!/usr/bin/python import requests import json import ast def parse_dataset_metadata(dataset): if 'rights' in dataset.keys(): rights = dataset['rights'] else: rights = 'not supplied' return {'dataset_key': dataset['key'], 'rights': rights} def get_gbif_datasets(limit, offset): params = {'limit': limi...
Add script to fetch licenses
Add script to fetch licenses
Python
mit
Datafable/gbif-data-licenses,Datafable/gbif-data-licenses,Datafable/gbif-data-licenses
--- +++ @@ -0,0 +1,30 @@ +#!/usr/bin/python +import requests +import json +import ast + +def parse_dataset_metadata(dataset): + if 'rights' in dataset.keys(): + rights = dataset['rights'] + else: + rights = 'not supplied' + return {'dataset_key': dataset['key'], 'rights': rights} + +def get_gbif_datasets(lim...
ab48df1df241a17c01730a368178abfbe4d94bcc
qa/rpc-tests/qtum-call-empty-contract.py
qa/rpc-tests/qtum-call-empty-contract.py
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from tes...
Add call empty contract python test
Add call empty contract python test
Python
mit
qtumproject/qtum,qtumproject/qtum,qtumproject/qtum,qtumproject/qtum,qtumproject/qtum,qtumproject/qtum,qtumproject/qtum
--- +++ @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# Copyright (c) 2015-2016 The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +from test_framework.test_framework import BitcoinTestFramework +from tes...
ef0d5ba38a8f56cb32a03aa3bacb2fe7e73c4eea
alg_tower_of_hanoi.py
alg_tower_of_hanoi.py
"""The tower of Hanoi.""" from __future__ import print_function def move_towers(height, from_pole, to_pole, with_pole): move_towers(height - 1, from_pole, with_pole, to_pole) move_disk(from_pole, to_pole) move_towers(height - 1, with_pole, to_pole, from_pole) def move_disk(from_pole, to_pole): print(...
Complete alg: tower of hanoi
Complete alg: tower of hanoi
Python
bsd-2-clause
bowen0701/algorithms_data_structures
--- +++ @@ -0,0 +1,12 @@ +"""The tower of Hanoi.""" +from __future__ import print_function + +def move_towers(height, from_pole, to_pole, with_pole): + move_towers(height - 1, from_pole, with_pole, to_pole) + move_disk(from_pole, to_pole) + move_towers(height - 1, with_pole, to_pole, from_pole) + + +def move...
b356cd07fdeb249ff91160a0961b9cc660c7ae01
app/ml_models/affect_ai_test.py
app/ml_models/affect_ai_test.py
import affect_ai # Test that an affect_AI object gets created correctly # Test that an affect_AI object can be trained, and builds vocabulary correctly # Test that an affect_AI object correctly scores samples # words: foo, bar, baz, goo, car, caz, hoo, dar, daz, ioo, ear, eaz, loo, far, faz; corpora: happiness 1, sat...
Add test file for affect_ai class
chore: Add test file for affect_ai class
Python
mit
OmegaHorizonResearch/agile-analyst
--- +++ @@ -0,0 +1,7 @@ +import affect_ai + +# Test that an affect_AI object gets created correctly +# Test that an affect_AI object can be trained, and builds vocabulary correctly +# Test that an affect_AI object correctly scores samples + +# words: foo, bar, baz, goo, car, caz, hoo, dar, daz, ioo, ear, eaz, loo, fa...
01163ce7fc43b4ab2e5b9ab1c5f94556d0509004
examples/tornado/auth_demo.py
examples/tornado/auth_demo.py
from mongrel2.config import * main = Server( uuid="f400bf85-4538-4f7a-8908-67e313d515c2", access_log="/logs/access.log", error_log="/logs/error.log", chroot="./", default_host="localhost", name="test", pid_file="/run/mongrel2.pid", port=6767, hosts = [ Host(name="localhost"...
from mongrel2.config import * main = Server( uuid="f400bf85-4538-4f7a-8908-67e313d515c2", access_log="/logs/access.log", error_log="/logs/error.log", chroot="./", default_host="localhost", name="test", pid_file="/run/mongrel2.pid", port=6767, hosts = [ Host(name="localhost"...
Add the settings to the authdemo.
Add the settings to the authdemo.
Python
bsd-3-clause
niedbalski/mongrel2,jdesgats/mongrel2,winks/mongrel2,griffordson/mongrel2,cpick/mongrel2,duaneg/mongrel2,jagguli/mongrel2,mongrel2/mongrel2,issuu/mongrel2,metadave/mongrel2,steamraven/mongrel2,cpick/mongrel2,niedbalski/mongrel2,AustinWise/mongrel2,nmandery/mongrel2,markokr/mongrel2,reshefm/mongrel2,sshirokov/mongrel2,f...
--- +++ @@ -16,6 +16,6 @@ ] ) -commit([main]) +commit([main], settings={'limits.buffer_size': 4 * 1024})
3bd1692772dd40d6321280645491d00d4f53b1ac
python2.7-src/isomorphic_strings.py
python2.7-src/isomorphic_strings.py
#!/usr/bin/python def check_isomorphic(s1, s2) : d = dict() if len(s1) != len(s2) : return False for i in range(0, len(s1)) : if s1[i] in d : if d[s1[i]] != s2[i] : return False else : if s2[i] in d.values() : return False d[s1[i]] = s2[i] return True s1 = raw_input("Enter first string : ...
Check if two strings are isomorphic
Check if two strings are isomorphic
Python
mit
diptin/dipti-coding-samples,diptin/dipti-coding-samples
--- +++ @@ -0,0 +1,24 @@ +#!/usr/bin/python + +def check_isomorphic(s1, s2) : + d = dict() + if len(s1) != len(s2) : + return False + for i in range(0, len(s1)) : + if s1[i] in d : + if d[s1[i]] != s2[i] : + return False + else : + if s2[i] in d.values() : + return False + d[s1[i]] = s2[i] + return T...
d0a06aa69bd067c52964ed374c1238fe4f1e9c3f
server/forms/db_match.py
server/forms/db_match.py
from wtforms.validators import ValidationError def db_match(model, message, *args, **kwargs): fields = kwargs.pop('match_fields', None) result = model.query.filter_by(*args, **kwargs).first() if result is None: raise ValidationError(message) if fields is not None: for key in fields: ...
Add custom validator for matching db fields
Add custom validator for matching db fields
Python
mit
ganemone/ontheside,ganemone/ontheside,ganemone/ontheside
--- +++ @@ -0,0 +1,13 @@ +from wtforms.validators import ValidationError + + +def db_match(model, message, *args, **kwargs): + fields = kwargs.pop('match_fields', None) + result = model.query.filter_by(*args, **kwargs).first() + if result is None: + raise ValidationError(message) + if fields is not...
35c4e42965ee8b4cc6735d03080b0ca69e7974d9
ddsc/generatedocs.py
ddsc/generatedocs.py
# Script to generate contents of https://github.com/Duke-GCB/DukeDSClient/wiki/All-Commands from ddsc.ddsclient import DDSClient from ddsc.versioncheck import get_internal_version_str from argparse import SUPPRESS import sys # Fix argparse to have ddsclient instead of generatedocs.py as the command sys.argv[0] = 'ddsc...
Add script to generate wiki command documentation
Add script to generate wiki command documentation Adds ddsc/generatedocs.py to generate the wiki command list. When command line argument changes are made this script will generate markdown that should be added to the wiki on the [All-Commands](https://github.com/Duke-GCB/DukeDSClient/wiki/All-Commands) page.
Python
mit
Duke-GCB/DukeDSClient,Duke-GCB/DukeDSClient
--- +++ @@ -0,0 +1,52 @@ +# Script to generate contents of https://github.com/Duke-GCB/DukeDSClient/wiki/All-Commands +from ddsc.ddsclient import DDSClient +from ddsc.versioncheck import get_internal_version_str +from argparse import SUPPRESS +import sys + +# Fix argparse to have ddsclient instead of generatedocs.py ...
dc8a01c20b3844c78dd6ffdc9e411ffe9e853b2b
server/ntb/macros/nb_NO_to_nn_NO_metadata_macro.py
server/ntb/macros/nb_NO_to_nn_NO_metadata_macro.py
""" nb-NO to nn-NO Metadata Macro will perform the following changes to current content item: - change the byline to "(NPK-NTB)" - change the body footer to "(©NPK)" - NB: copyrightsign, not @ - change the service to "NPKSisteNytt" """ def nb_NO_to_nn_NO_metadata_macro(item, **kwargs): it...
Add nb-NO to bb-NO macro(Created by Karel)
feat(translation): Add nb-NO to bb-NO macro(Created by Karel)
Python
agpl-3.0
petrjasek/superdesk-ntb,superdesk/superdesk-ntb,superdesk/superdesk-ntb,superdesk/superdesk-ntb,ioanpocol/superdesk-ntb,petrjasek/superdesk-ntb,ioanpocol/superdesk-ntb,ioanpocol/superdesk-ntb,petrjasek/superdesk-ntb,petrjasek/superdesk-ntb,superdesk/superdesk-ntb
--- +++ @@ -0,0 +1,31 @@ +""" + nb-NO to nn-NO Metadata Macro will perform the following changes to current content item: + - change the byline to "(NPK-NTB)" + - change the body footer to "(©NPK)" - NB: copyrightsign, not @ + - change the service to "NPKSisteNytt" +""" + + +def nb_NO_to_nn_NO_metadata_ma...
32a23e1b4122976685fa38f3937f28f543642d77
services/content_metrics.py
services/content_metrics.py
"""This module contains utility functions to print reports of the database contents. The need is to find examples of extreme or pathological content with either long field contents or a large amount of related objects. """ from django.db.models.functions import Length from django.db.models import Count, Sum, Case, Whe...
Add saved database queries for exploring database contents
Add saved database queries for exploring database contents
Python
agpl-3.0
City-of-Helsinki/smbackend,City-of-Helsinki/smbackend
--- +++ @@ -0,0 +1,60 @@ +"""This module contains utility functions to print reports of the +database contents. + +The need is to find examples of extreme or pathological content +with either long field contents or a large amount of related +objects. +""" +from django.db.models.functions import Length +from django.db...
ee80300bf284972b111e71bf88422e31aaa2e565
tests/test_pricing_integration.py
tests/test_pricing_integration.py
import time import unittest from selenium import webdriver from selenium.webdriver.common.by import By class TestAddproduct(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.get("http://localhost:9761/pricing_quote") time.sleep(1) def tearDown(self): ...
Test for adding products to the quote list
Test for adding products to the quote list
Python
mit
remiolsen/status,remiolsen/status,SciLifeLab/genomics-status,SciLifeLab/genomics-status,remiolsen/status,SciLifeLab/genomics-status
--- +++ @@ -0,0 +1,44 @@ +import time +import unittest +from selenium import webdriver +from selenium.webdriver.common.by import By + + +class TestAddproduct(unittest.TestCase): + def setUp(self): + self.driver = webdriver.Chrome() + self.driver.get("http://localhost:9761/pricing_quote") + tim...
a9d6067704b23170e5c623790410674b13968fc1
froide/publicbody/migrations/0004_auto_20161130_0128.py
froide/publicbody/migrations/0004_auto_20161130_0128.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-11-30 00:28 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 = [ ('publicbody', '0003_auto_20...
Add publicbody migration for on_delete
Add publicbody migration for on_delete
Python
mit
fin/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide
--- +++ @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.1 on 2016-11-30 00:28 +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 =...
c19302a9171c91dfd0bba28582253124aa4a71eb
lab/disruptors/n9k_ip_block.py
lab/disruptors/n9k_ip_block.py
def start(context, log, args): import time duration = args['duration'] period = 20 n9k1_ip, n9k2_ip, _, _ = context.n9k_creds() log.info('Blocking N9K IPs ({0},{1}) on controllers ...'.format(n9k1_ip, n9k2_ip)) start_time = time.time() for controller in context.controllers(): cont...
Add n9k IP iptables block
Add n9k IP iptables block Change-Id: Ife7168aebd5de6d017c48d3d7b6b1a0227c25f7c
Python
apache-2.0
CiscoSystems/os-sqe,CiscoSystems/os-sqe,CiscoSystems/os-sqe
--- +++ @@ -0,0 +1,21 @@ +def start(context, log, args): + import time + + duration = args['duration'] + period = 20 + + n9k1_ip, n9k2_ip, _, _ = context.n9k_creds() + log.info('Blocking N9K IPs ({0},{1}) on controllers ...'.format(n9k1_ip, n9k2_ip)) + + start_time = time.time() + for controller ...
3ca9df7a41653f6c4c8381580b104478c794564f
zou/migrations/versions/a65bdadbae2f_.py
zou/migrations/versions/a65bdadbae2f_.py
"""empty message Revision ID: a65bdadbae2f Revises: e1ef93f40d3d Create Date: 2019-01-15 12:19:59.813805 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utils from sqlalchemy.dialects import postgresql import sqlalchemy_utils import uuid # revision identifiers, used by Alembic. revision = 'a65bd...
Add migration file for metadata descriptor
Add migration file for metadata descriptor
Python
agpl-3.0
cgwire/zou
--- +++ @@ -0,0 +1,47 @@ +"""empty message + +Revision ID: a65bdadbae2f +Revises: e1ef93f40d3d +Create Date: 2019-01-15 12:19:59.813805 + +""" +from alembic import op +import sqlalchemy as sa +import sqlalchemy_utils +from sqlalchemy.dialects import postgresql +import sqlalchemy_utils +import uuid + +# revision ident...
7930d0b328fff6edef376c8b6401c5bb7c241311
tests/test_lexer.py
tests/test_lexer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2010-2012 Raphaël Barrois """Tests for token-related code.""" import re import unittest import tdparser class ParenthesizedLexerTestCase(unittest.TestCase): """Test lexing parenthesized expressions.""" def setUp(self): class RightParen...
Add tests for the lexer.
Add tests for the lexer. Signed-off-by: Raphaël Barrois <8eb3b37a023209373fcd61a2fdc08256a14fb19c@polytechnique.org>
Python
bsd-2-clause
rbarrois/tdparser,rbarrois/tdparser
--- +++ @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2010-2012 Raphaël Barrois + +"""Tests for token-related code.""" + +import re +import unittest + +import tdparser + + +class ParenthesizedLexerTestCase(unittest.TestCase): + """Test lexing parenthesized expressions.""" + + ...
e8b48ef94fbffea54ba39b6397d283b67d49ced0
cameo/visualization/sympy_ext.py
cameo/visualization/sympy_ext.py
# Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU. # 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 ...
Patch sympy to return COBRA compatible expressions on str
Patch sympy to return COBRA compatible expressions on str
Python
apache-2.0
biosustain/cameo,biosustain/cameo
--- +++ @@ -0,0 +1,27 @@ +# Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU. + +# 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/...
7980fdf9dbc31072ed2659c4d9b3392a1c31917b
tests/integration/dropdown/test_dynamic_options.py
tests/integration/dropdown/test_dynamic_options.py
import dash from dash.dependencies import Input, Output, State from dash.exceptions import PreventUpdate import dash.testing.wait as wait import dash_core_components as dcc def test_ddsv001_dynamic_options(dash_duo): options=[ {'label': 'New York City', 'value': 'NYC'}, {'label': 'Montreal', 'valu...
Add test for dynamic options from server
Add test for dynamic options from server
Python
mit
plotly/dash-core-components
--- +++ @@ -0,0 +1,54 @@ +import dash +from dash.dependencies import Input, Output, State +from dash.exceptions import PreventUpdate +import dash.testing.wait as wait +import dash_core_components as dcc + + +def test_ddsv001_dynamic_options(dash_duo): + options=[ + {'label': 'New York City', 'value': 'NYC'}...
50f440f3c7dbfaa328e6cd16e762ec41a9147f54
raggregate/rg_migrations/versions/011_Add_notify_by_mail_to_users.py
raggregate/rg_migrations/versions/011_Add_notify_by_mail_to_users.py
from sqlalchemy import * from migrate import * from raggregate.guid_recipe import GUID def upgrade(migrate_engine): meta = MetaData(bind=migrate_engine) users = Table('users', meta, autoload=True) notify_by_mailc = Column('notify_by_mail', Boolean, default=True) notify_by_mailc.create(users) def dow...
Include migration for notify_by_mail. ...
notify: Include migration for notify_by_mail. ... Required for commit 651c0f984f7c75 or later to work.
Python
apache-2.0
sjuxax/raggregate
--- +++ @@ -0,0 +1,16 @@ +from sqlalchemy import * +from migrate import * +from raggregate.guid_recipe import GUID + + +def upgrade(migrate_engine): + meta = MetaData(bind=migrate_engine) + users = Table('users', meta, autoload=True) + notify_by_mailc = Column('notify_by_mail', Boolean, default=True) + no...
d0c8c7b61906e65137057406b5b94a01f9c61b84
keepsimplecms/__init__.py
keepsimplecms/__init__.py
class ViewBase(object): """ Base class for all views and nodes. """ # database session _session = None # the scope is the dict sent to the template engine _scope = {} def __init__(self, request=None): """ Save a reference to the Pyramid request object. """ ...
Move code to the root of the main module.
Move code to the root of the main module.
Python
bsd-3-clause
cr0cK/keepsimple.cms,cr0cK/keepsimple.cms,cr0cK/keepsimple.cms
--- +++ @@ -0,0 +1,88 @@ +class ViewBase(object): + """ + Base class for all views and nodes. + """ + + # database session + _session = None + # the scope is the dict sent to the template engine + _scope = {} + + def __init__(self, request=None): + """ + Save a reference to the P...
9c60d9e5a2a2f64e9bed0a9a6223bc9c886977fd
PropertyVerification/HEmpty_IsolatedConnectedLHS.py
PropertyVerification/HEmpty_IsolatedConnectedLHS.py
from core.himesis import Himesis, HimesisPreConditionPatternLHS class HEmpty_IsolatedConnectedLHS(HimesisPreConditionPatternLHS): def __init__(self): """ Creates the himesis graph representing the AToM3 model HEmpty_IsolatedConnectedLHS. """ # Flag this instance as compiled now ...
Add empty property to property verification folder.
Add empty property to property verification folder.
Python
mit
levilucio/SyVOLT,levilucio/SyVOLT
--- +++ @@ -0,0 +1,51 @@ + + +from core.himesis import Himesis, HimesisPreConditionPatternLHS + +class HEmpty_IsolatedConnectedLHS(HimesisPreConditionPatternLHS): + def __init__(self): + """ + Creates the himesis graph representing the AToM3 model HEmpty_IsolatedConnectedLHS. + """ + # ...
864403b982f9a2cb1c4266ebe80ff3ca4d8a572a
langcodes/test_multithread.py
langcodes/test_multithread.py
""" This file implements testing ing langcodes module for multithreaded env Problem is still there if you try to acccess that module from multiple places at once """ import threading from twisted.internet import reactor from tag_parser import parse_tag def parseMe(i, tag): print i, parse_tag(tag) def startPro...
Test for multithreading with twisted framework
Test for multithreading with twisted framework
Python
mit
darkman66/langcodes
--- +++ @@ -0,0 +1,22 @@ +""" +This file implements testing ing langcodes module for multithreaded env + +Problem is still there if you try to acccess that module from multiple places at once +""" +import threading +from twisted.internet import reactor +from tag_parser import parse_tag + + +def parseMe(i, tag): + ...