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
6a0efd80ab081bc0056bc7ec346320f03fdcc503
migrations/versions/0071_add_job_error_state.py
migrations/versions/0071_add_job_error_state.py
"""empty message Revision ID: 0071_add_job_error_state Revises: 0070_fix_notify_user_email Create Date: 2017-03-10 16:15:22.153948 """ # revision identifiers, used by Alembic. revision = '0071_add_job_error_state' down_revision = '0070_fix_notify_user_email' from alembic import op import sqlalchemy as sa def upgr...
Add a new status to the job statuses to handle errors.
Add a new status to the job statuses to handle errors.
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,22 @@ +"""empty message + +Revision ID: 0071_add_job_error_state +Revises: 0070_fix_notify_user_email +Create Date: 2017-03-10 16:15:22.153948 + +""" + +# revision identifiers, used by Alembic. +revision = '0071_add_job_error_state' +down_revision = '0070_fix_notify_user_email' + +from alembic impo...
4117649358d34bc6f18868d19f1e0e1f4b38f699
sara_flexbe_states/src/sara_flexbe_states/TF_transform.py
sara_flexbe_states/src/sara_flexbe_states/TF_transform.py
#!/usr/bin/env python import rospy import tf class TF_transformation: """ Transformation from a reference to another --in_ref frame_id first reference --out_ref frame_id second reference ># in_pos Point point in in_pos <= done Did all the transformat...
Add State to transform between references
Add State to transform between references
Python
bsd-3-clause
WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +import rospy +import tf + + +class TF_transformation: + """ + Transformation from a reference to another + + --in_ref frame_id first reference + --out_ref frame_id second reference + + ># in_pos Point point in in_pos + + <= do...
90f94d18f6ce4d165ad67ccfdc93c0eefdcb0c69
kolibri/core/tasks/validation.py
kolibri/core/tasks/validation.py
from rest_framework import serializers class JobValidator(serializers.Serializer): """ A serializer class for validating and deserializing job data. Task is included for completeness of documentation of expected fields. But we will validate the existence of this before we get to this point. """ ...
Implement a base job validator using DRF serializers.
Implement a base job validator using DRF serializers.
Python
mit
learningequality/kolibri,learningequality/kolibri,learningequality/kolibri,learningequality/kolibri
--- +++ @@ -0,0 +1,38 @@ +from rest_framework import serializers + + +class JobValidator(serializers.Serializer): + """ + A serializer class for validating and deserializing job data. + Task is included for completeness of documentation of expected fields. + But we will validate the existence of this befo...
3c613bc1b729904883bca77924d892012b93cdc3
powerline/renderers/pango_markup.py
powerline/renderers/pango_markup.py
# vim:fileencoding=utf-8:noet from powerline.renderer import Renderer from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE class PangoMarkupRenderer(Renderer): '''Powerline Pango markup segment renderer.''' @staticmethod def hlstyle(*args, **kwargs): # We don't need to explicitly reset attr...
# vim:fileencoding=utf-8:noet from powerline.renderer import Renderer from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE from xmlrpclib import escape as _escape class PangoMarkupRenderer(Renderer): '''Powerline Pango markup segment renderer.''' @staticmethod def hlstyle(*args, **kwargs): ...
Use xmlrpclib.escape for escaping in PangoMarkupRenderer
Use xmlrpclib.escape for escaping in PangoMarkupRenderer
Python
mit
dragon788/powerline,cyrixhero/powerline,blindFS/powerline,QuLogic/powerline,magus424/powerline,areteix/powerline,dragon788/powerline,keelerm84/powerline,lukw00/powerline,xfumihiro/powerline,prvnkumar/powerline,magus424/powerline,s0undt3ch/powerline,dragon788/powerline,bartvm/powerline,bezhermoso/powerline,wfscheper/pow...
--- +++ @@ -2,6 +2,8 @@ from powerline.renderer import Renderer from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE + +from xmlrpclib import escape as _escape class PangoMarkupRenderer(Renderer): @@ -30,5 +32,7 @@ awesome_attr += ['underline="single"'] return '<span ' + ' '.join(...
0c537c9cb0d6899557fd0cce125bf35a626493cf
migrations/versions/21b7c3b2ce88_index_build_project_.py
migrations/versions/21b7c3b2ce88_index_build_project_.py
"""Index Build.project_id,patch_id,date_created Revision ID: 21b7c3b2ce88 Revises: 4134b4818694 Create Date: 2013-12-03 16:19:11.794912 """ # revision identifiers, used by Alembic. revision = '21b7c3b2ce88' down_revision = '4134b4818694' from alembic import op def upgrade(): op.create_index('idx_build_project...
Index Build (project_id, patch_id, date_created)
Index Build (project_id, patch_id, date_created)
Python
apache-2.0
dropbox/changes,bowlofstew/changes,dropbox/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,dropbox/changes
--- +++ @@ -0,0 +1,21 @@ +"""Index Build.project_id,patch_id,date_created + +Revision ID: 21b7c3b2ce88 +Revises: 4134b4818694 +Create Date: 2013-12-03 16:19:11.794912 + +""" + +# revision identifiers, used by Alembic. +revision = '21b7c3b2ce88' +down_revision = '4134b4818694' + +from alembic import op + + +def upgrad...
2adff23b1c9f6eef00c4e21449911098107d36e6
tests/test_available.py
tests/test_available.py
from api.search import available def test_available_term_by_category_invalid(): assert available.available_term_by_category('foo', 'bar') == [] def test_available_term_by_category_taxonomy(): tests = [ (('superkingdom', 'b'), [{'val': 'Bacteria', 'desc': None}]), (('phylum', 'f'), [{'val': '...
Add tests for 'available' module
search: Add tests for 'available' module Signed-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>
Python
agpl-3.0
antismash/db-api,antismash/db-api
--- +++ @@ -0,0 +1,38 @@ +from api.search import available + + +def test_available_term_by_category_invalid(): + assert available.available_term_by_category('foo', 'bar') == [] + + +def test_available_term_by_category_taxonomy(): + tests = [ + (('superkingdom', 'b'), [{'val': 'Bacteria', 'desc': None}]),...
13e07eac9c69ed49210695a8465679c3df480d50
build.py
build.py
""" Build (freeze) the versionhero program. """ import os def main(): """ Run this main function if this script is called directly. :return: None """ os.system('pyinstaller --onefile versionhero.py') if __name__ == "__main__": main()
Add a script that will use pyinstaller to create an exe.
Add a script that will use pyinstaller to create an exe.
Python
apache-2.0
chadgra/versionhero
--- +++ @@ -0,0 +1,16 @@ +""" +Build (freeze) the versionhero program. +""" +import os + + +def main(): + """ + Run this main function if this script is called directly. + :return: None + """ + os.system('pyinstaller --onefile versionhero.py') + + +if __name__ == "__main__": + main()
318656f44d4f987e912229f83192c2d8adf97142
ibis/pandas/tests/test_core.py
ibis/pandas/tests/test_core.py
import pytest pytest.importorskip('multipledispatch') from ibis.pandas.execution import execute, execute_node # noqa: E402 from multipledispatch.conflict import ambiguities # noqa: E402 @pytest.mark.parametrize('func', [execute, execute_node]) def test_no_execute_ambiguities(func): assert not ambiguities(func...
Test that there are no ambiguous dispatch definitions
TST: Test that there are no ambiguous dispatch definitions Author: Phillip Cloud <cpcloud@gmail.com> Closes #1026 from cpcloud/test-amb and squashes the following commits: 073d7b8 [Phillip Cloud] TST: Test that there are no ambiguous dispatch definitions
Python
apache-2.0
ibis-project/ibis,deepfield/ibis,cpcloud/ibis,cpcloud/ibis,deepfield/ibis,ibis-project/ibis,deepfield/ibis,cloudera/ibis,cpcloud/ibis,cpcloud/ibis,cloudera/ibis,deepfield/ibis,ibis-project/ibis,ibis-project/ibis,cloudera/ibis
--- +++ @@ -0,0 +1,11 @@ +import pytest + +pytest.importorskip('multipledispatch') + +from ibis.pandas.execution import execute, execute_node # noqa: E402 +from multipledispatch.conflict import ambiguities # noqa: E402 + + +@pytest.mark.parametrize('func', [execute, execute_node]) +def test_no_execute_ambiguities(f...
c87e206d524137e9e76166faf20d5b1e10419220
senlin/tests/tempest/api/profiles/test_profile_delete.py
senlin/tests/tempest/api/profiles/test_profile_delete.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add API tests for profile delete
Add API tests for profile delete Add API tests for profile delete Change-Id: I47a733ce203ba76fc57080a1b086661720e83930
Python
apache-2.0
openstack/senlin,openstack/senlin,stackforge/senlin,openstack/senlin,stackforge/senlin
--- +++ @@ -0,0 +1,32 @@ +# 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...
8ef4bb66c77fd0643b5d5a0b99290da05bcdce47
senlin/tests/tempest/api/receivers/test_receiver_list.py
senlin/tests/tempest/api/receivers/test_receiver_list.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add API test for receiver list
Add API test for receiver list Add API test for receiver list Change-Id: I45d63410dc3a8cf361fe2ca446439abd0e9c2cec
Python
apache-2.0
openstack/senlin,openstack/senlin,stackforge/senlin,openstack/senlin,stackforge/senlin
--- +++ @@ -0,0 +1,58 @@ +# 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...
795d22c113951e45803baadde2c4c95ba05de4c9
s2protocol/compat.py
s2protocol/compat.py
from six import PY3, binary_type __all__ = 'byte_to_int', def byte_to_int(x): if PY3 and isinstance(x, binary_type): return x else: return ord(x)
Replace `ord` depends on Python version
Replace `ord` depends on Python version
Python
mit
Blizzard/s2protocol
--- +++ @@ -0,0 +1,10 @@ +from six import PY3, binary_type + +__all__ = 'byte_to_int', + + +def byte_to_int(x): + if PY3 and isinstance(x, binary_type): + return x + else: + return ord(x)
0086ac0d96e2093fa56b9a6ccc26b38d9fe30497
chassis/test/services/data_context_test.py
chassis/test/services/data_context_test.py
import unittest from chassis.services import data_context from chassis.test.services.foo_context import FooContext class UnextendedDatasourceContextTest(unittest.TestCase): """Unit test that an unextended DatasourceContext methods raise NotImplementedErrors """ def test_insert_raises_error(self): ...
Add unit test for DatasourceContext
Add unit test for DatasourceContext
Python
mit
refinery29/chassis,refinery29/chassis
--- +++ @@ -0,0 +1,35 @@ +import unittest + +from chassis.services import data_context +from chassis.test.services.foo_context import FooContext + + +class UnextendedDatasourceContextTest(unittest.TestCase): + """Unit test that an unextended DatasourceContext + methods raise NotImplementedErrors + + """ + ...
61f93dabbf740572b2e7a415198a68e6a165cdeb
src/pybel_tools/assess_completeness.py
src/pybel_tools/assess_completeness.py
# -*- coding: utf-8 -*- """Assess the completeness of a graph. Run on CONIB with ``python -m pybel_tools.assess_completeness [PMID]``. """ import logging import click from indra.sources.indra_db_rest.api import get_statements_for_paper from indra.sources.indra_db_rest.util import logger as indra_logger from pybel ...
Add outline of INDRA-based graph completeness checker
Add outline of INDRA-based graph completeness checker This is what we talked about @sgebel. This can be modified to give name-based checking instead of node-based checking as well as relation-level checking between nodes
Python
mit
pybel/pybel-tools,pybel/pybel-tools,pybel/pybel-tools
--- +++ @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- + +"""Assess the completeness of a graph. + +Run on CONIB with ``python -m pybel_tools.assess_completeness [PMID]``. +""" + +import logging + +import click +from indra.sources.indra_db_rest.api import get_statements_for_paper +from indra.sources.indra_db_rest.util imp...
3e6a321ff92c138bf901e7511ecbb166e74b3007
apps/blog/license_urls.py
apps/blog/license_urls.py
""" URLCONF for the blog app. """ from django.conf.urls import url from . import views, feeds # URL patterns configuration urlpatterns = ( # License index page url(r'^(?P<slug>[-a-zA-Z0-9_]+)/$', views.license_detail, name='license_detail'), # Related articles feed url(r'^(?P<slug>[-a-zA-Z0-9_]+)/...
Add special urls for license (add-on)
Add special urls for license (add-on)
Python
agpl-3.0
TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker
--- +++ @@ -0,0 +1,19 @@ +""" +URLCONF for the blog app. +""" + +from django.conf.urls import url + +from . import views, feeds + + +# URL patterns configuration +urlpatterns = ( + + # License index page + url(r'^(?P<slug>[-a-zA-Z0-9_]+)/$', views.license_detail, name='license_detail'), + + # Related article...
76f037ee6aa4fb54cf483f44f0a8dfa098d1f57c
tests/test_grid_sampling.py
tests/test_grid_sampling.py
from parcels import Grid import numpy as np import pytest @pytest.fixture def grid(xdim=200, ydim=100): """ Standard grid spanning the earth's coordinates with U and V equivalent to longitude and latitude. """ lon = np.linspace(-180, 180, xdim, dtype=np.float32) lat = np.linspace(-90, 90, ydim...
Add a simple set of tests for explicit grid sampling
Grid: Add a simple set of tests for explicit grid sampling
Python
mit
OceanPARCELS/parcels,OceanPARCELS/parcels
--- +++ @@ -0,0 +1,38 @@ +from parcels import Grid +import numpy as np +import pytest + + +@pytest.fixture +def grid(xdim=200, ydim=100): + """ Standard grid spanning the earth's coordinates with U and V + equivalent to longitude and latitude. + """ + lon = np.linspace(-180, 180, xdim, dtype=np.float3...
91e9e5a38a0466721de4027e6578c228e4efe799
lily/deals/migrations/0021_auto_20160222_1513.py
lily/deals/migrations/0021_auto_20160222_1513.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('deals', '0020_auto_20160211_1039'), ] operations = [ migrations.AlterField( model_name='deal', name=...
Add migration to deals to add new currency
Add migration to deals to add new currency
Python
agpl-3.0
HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('deals', '0020_auto_20160211_1039'), + ] + + operations = [ + migrations.AlterField( + ...
28407c8761d22c46c302342d2bcd2bf2a1c274b9
leetcode/q994/solution.py
leetcode/q994/solution.py
""" In a given grid, each cell can have one of three values: the value 0 representing an empty cell; the value 1 representing a fresh orange; the value 2 representing a rotten orange. Every minute, any fresh orange that is adjacent (4-directionally) to a rotten orange becomes rotten. Return the minimum number...
Add iterative approach that changes to quickly
Add iterative approach that changes to quickly
Python
mit
lemming52/white_pawn,lemming52/white_pawn
--- +++ @@ -0,0 +1,44 @@ +""" +In a given grid, each cell can have one of three values: + +the value 0 representing an empty cell; +the value 1 representing a fresh orange; +the value 2 representing a rotten orange. +Every minute, any fresh orange that is adjacent (4-directionally) to a rotten orange becomes rotten. ...
62c24f6edaa91834d4a7b2a3f9b99b8b96322230
nova/policies/hide_server_addresses.py
nova/policies/hide_server_addresses.py
# Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
# Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
Add policy description for 'os-hide-server-addresses'
Add policy description for 'os-hide-server-addresses' This commit adds policy doc for 'os-hide-server-addresses' policies. Partial implement blueprint policy-docs Change-Id: I98edbd8579f052c74283bde2ec4f85d301a0807a
Python
apache-2.0
rahulunair/nova,gooddata/openstack-nova,mikalstill/nova,mahak/nova,Juniper/nova,mahak/nova,mikalstill/nova,Juniper/nova,rahulunair/nova,gooddata/openstack-nova,vmturbo/nova,openstack/nova,Juniper/nova,jianghuaw/nova,openstack/nova,gooddata/openstack-nova,klmitch/nova,gooddata/openstack-nova,jianghuaw/nova,klmitch/nova,...
--- +++ @@ -13,16 +13,32 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_policy import policy - +from nova.policies import base BASE_POLICY_NAME = 'os_compute_api:os-hide-server-addresses' hide_server_addresses_policies = [ - policy.Rul...
b846a96e10eaac0bb9e90086198ce1175758adb6
cla_backend/apps/cla_eventlog/tests/test_find_and_delete_old_cases.py
cla_backend/apps/cla_eventlog/tests/test_find_and_delete_old_cases.py
from django.test import TestCase from django.utils import timezone from dateutil.relativedelta import relativedelta from freezegun import freeze_time from core.tests.mommy_utils import make_recipe from cla_eventlog.models import Log from legalaid.models import Case class FindAndDeleteOldCases(TestCase): def crea...
Create and find cases that were viewed two years ago
Create and find cases that were viewed two years ago Steps: 1. Create 3 case: one new case and two cases with their 'created' property set to 3 years ago 2. Create an event log for each case with code property 'CASE_VIEWED' 3. The new case and one of the old cases will have the 'created' property for the event log set...
Python
mit
ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend
--- +++ @@ -0,0 +1,41 @@ +from django.test import TestCase +from django.utils import timezone +from dateutil.relativedelta import relativedelta +from freezegun import freeze_time + +from core.tests.mommy_utils import make_recipe +from cla_eventlog.models import Log +from legalaid.models import Case + + +class FindAnd...
4e6f834056141667fdbbe4e5a1101f65d5cb61a8
66_split_file_in_list.py
66_split_file_in_list.py
openFile = open("sample.txt") for line in openFile: line = line.rstrip() if not line.startswith("From "): continue words = line.split() #print type(words) print words[2]
Read data from file and split the data nad print
Read data from file and split the data nad print
Python
mit
rahulbohra/Python-Basic
--- +++ @@ -0,0 +1,8 @@ +openFile = open("sample.txt") +for line in openFile: + line = line.rstrip() + if not line.startswith("From "): + continue + words = line.split() + #print type(words) + print words[2]
bf90cd6fd3966eb2d96a9357593f8cfc13daab12
hearthstone/hslog/tests/test_main.py
hearthstone/hslog/tests/test_main.py
import pytest from io import StringIO from hearthstone.enums import PowerType from hearthstone.hslog import LogParser EMPTY_GAME = """ D 02:59:14.6088620 GameState.DebugPrintPower() - CREATE_GAME D 02:59:14.6149420 GameState.DebugPrintPower() - GameEntity EntityID=1 D 02:59:14.6446530 GameState.DebugPrintPower() ...
Add some tests for an empty game
hslog: Add some tests for an empty game
Python
mit
HearthSim/python-hearthstone
--- +++ @@ -0,0 +1,62 @@ +import pytest +from io import StringIO +from hearthstone.enums import PowerType +from hearthstone.hslog import LogParser + + +EMPTY_GAME = """ +D 02:59:14.6088620 GameState.DebugPrintPower() - CREATE_GAME +D 02:59:14.6149420 GameState.DebugPrintPower() - GameEntity EntityID=1 +D 02:59:14...
44e0336db0af70acc0ff890e6dd512bb3ce01065
keystone/tests/test_v2_controller.py
keystone/tests/test_v2_controller.py
# -*- coding: utf-8 -*- # Copyright 2014 IBM Corp. # # 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 o...
Add test for list project users when no user
Add test for list project users when no user There was no test that shows what happens when you list project users (GET /v2.0/tenants/{tenant_id}/users) and a user with a role on the project doesn't exist. The server returns a 404 Not Found for the user. bp no-check-id Change-Id: Iba8836200c22eb5d744b42114cc8c6e864c...
Python
apache-2.0
cernops/keystone,reeshupatel/demo,promptworks/keystone,nuxeh/keystone,idjaw/keystone,mahak/keystone,blueboxgroup/keystone,ilay09/keystone,openstack/keystone,ilay09/keystone,vivekdhayaal/keystone,nuxeh/keystone,reeshupatel/demo,jamielennox/keystone,UTSA-ICS/keystone-kerberos,jumpstarter-io/keystone,ilay09/keystone,klmit...
--- +++ @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +# Copyright 2014 IBM Corp. +# +# 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 +# ...
0de96828c959ef2dd3c007618c81e1b8f8a42f77
open_humans/management/commands/suspend_users.py
open_humans/management/commands/suspend_users.py
from django.contrib.auth import get_user_model from django.core.management.base import BaseCommand, CommandError UserModel = get_user_model() class Command(BaseCommand): """ A management command for suspending one or more users. """ help = 'Suspend users by username' def add_arguments(self, par...
Add management command to suspend users
Add management command to suspend users
Python
mit
PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans
--- +++ @@ -0,0 +1,50 @@ +from django.contrib.auth import get_user_model +from django.core.management.base import BaseCommand, CommandError + +UserModel = get_user_model() + + +class Command(BaseCommand): + """ + A management command for suspending one or more users. + """ + + help = 'Suspend users by use...
8e1f5fbcb50b31f32b6de5ea76f46222156fda72
admin_panel/forms.py
admin_panel/forms.py
from django import forms from blog_posting import models class CreatePost(forms.ModelForm): class Meta: model = models.Post exclude = ("created_at", "modified_at", "published")
Create an object for create post request
Create an object for create post request
Python
mpl-2.0
Apo11onian/Apollo-Blog,Apo11onian/Apollo-Blog,Apo11onian/Apollo-Blog
--- +++ @@ -0,0 +1,11 @@ +from django import forms +from blog_posting import models + + +class CreatePost(forms.ModelForm): + class Meta: + model = models.Post + exclude = ("created_at", "modified_at", "published") + + +
6ff83af42d87ca8b36574b4c71ffeb02d51356ad
tests/test_assess_cloud.py
tests/test_assess_cloud.py
from mock import call, Mock, patch from assess_cloud import assess_cloud_combined from deploy_stack import BootstrapManager from fakejuju import fake_juju_client from tests import ( FakeHomeTestCase, observable_temp_file, ) class TestAssessCloudCombined(FakeHomeTestCase): def backend_call(self, cli...
Add initial test of assess_cloud_combined.
Add initial test of assess_cloud_combined.
Python
agpl-3.0
mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju
--- +++ @@ -0,0 +1,45 @@ + +from mock import call, Mock, patch + +from assess_cloud import assess_cloud_combined +from deploy_stack import BootstrapManager +from fakejuju import fake_juju_client +from tests import ( + FakeHomeTestCase, + observable_temp_file, + ) + + +class TestAssessCloudCombined(FakeHomeTe...
f328e60bf62e7bee662113f9f2fdb41f69b3ee24
tests/test_visualise.py
tests/test_visualise.py
"""test_visualise.py Unit testing for the pointcloud.visualise module """ import pytest from simulocloud.visualise import scatter from simulocloud.exceptions import BadAxes, InvalidAxesDims from test_pointcloud import pc_las def test_scatter_rejects_wrong_axes_type(pc_las): """Is an error raised when axes argument...
Write basic unit tests for scatter argument checks
Write basic unit tests for scatter argument checks
Python
mit
stainbank/simulocloud
--- +++ @@ -0,0 +1,17 @@ +"""test_visualise.py +Unit testing for the pointcloud.visualise module +""" +import pytest +from simulocloud.visualise import scatter +from simulocloud.exceptions import BadAxes, InvalidAxesDims +from test_pointcloud import pc_las + +def test_scatter_rejects_wrong_axes_type(pc_las): + """...
440675022f5fbdc3dc009cb009e80ceb388990df
andalusian/migrations/0005_auto_20190717_1211.py
andalusian/migrations/0005_auto_20190717_1211.py
# Generated by Django 2.1.7 on 2019-07-17 10:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('andalusian', '0004_auto_20190122_1554'), ] operations = [ migrations.RemoveField( model_name='instrument', name='ori...
Add migration file for the addition of andalusian instruments
Add migration file for the addition of andalusian instruments
Python
agpl-3.0
MTG/dunya,MTG/dunya,MTG/dunya,MTG/dunya
--- +++ @@ -0,0 +1,22 @@ +# Generated by Django 2.1.7 on 2019-07-17 10:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('andalusian', '0004_auto_20190122_1554'), + ] + + operations = [ + migrations.RemoveField( + model...
a2e16379067b37a12e147ee2b35fbebdadc17451
custom/icds/management/commands/copy_icds_app.py
custom/icds/management/commands/copy_icds_app.py
from __future__ import absolute_import, print_function, unicode_literals from django.core.management import BaseCommand from corehq.apps.app_manager.dbaccessors import get_build_doc_by_version, wrap_app from corehq.apps.app_manager.models import import_app class Command(BaseCommand): help = "Make a copy of a sp...
Add basic "copy_app" mgmt cmd
Add basic "copy_app" mgmt cmd
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,25 @@ +from __future__ import absolute_import, print_function, unicode_literals + +from django.core.management import BaseCommand + +from corehq.apps.app_manager.dbaccessors import get_build_doc_by_version, wrap_app +from corehq.apps.app_manager.models import import_app + + +class Command(BaseComma...
86ba77f9aa26ccc70d45596745b6532b5eeeff52
tools/security/check_message_owners.py
tools/security/check_message_owners.py
#!/usr/bin/env python # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Make sure all of the per-file *_messages.h OWNERS are consistent""" import os import re import sys def main(): file_path = os.pa...
Add script to tools/security to check consistency of message file owners.
Add script to tools/security to check consistency of message file owners. Periodic use of this script will show places where the OWNERS files have become inconsistent. This poses a problem for CL authors when the reviewer they have selected doesn't cover all message files, so they would have to add another. I've sto...
Python
bsd-3-clause
hgl888/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,ondra-novak/chromium.src,markYoungH/chromium.src,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,dushu1203/chromium.src,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,Fireblend/chromium-crosswalk,chuan9/chromium-c...
--- +++ @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Make sure all of the per-file *_messages.h OWNERS are consistent""" + +import os +import re +import...
4887243e578e175ee97740cc275a69f32fedd669
test_display.py
test_display.py
# -*- coding: utf-8 -*- """ Tests for board display engine """ import pytest from fen import Position from display import render_ascii_board @pytest.fixture def samples(): board_samples = [ [ 'rnbqkbnr', 'pppppppp', ' ', ' ', ' ...
Add test for display module.
Add test for display module.
Python
mit
gisraptor/fen-parser
--- +++ @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" +Tests for board display engine +""" +import pytest +from fen import Position +from display import render_ascii_board + +@pytest.fixture +def samples(): + board_samples = [ + [ + 'rnbqkbnr', + 'pppppppp', + ' ', +...
cdc40da26edfcb00a1da3125a925232fc947d143
test_fractal.py
test_fractal.py
#!/usr/bin/env py.test # -*- coding: utf-8 -*- # Created on Fri Apr 25 02:33:04 2014 # License is MIT, see COPYING.txt for more details. # @author: Danilo de Jesus da Silva Bellini import os, re, pytest from fractal import generate_fractal, call_kw, cli_parse_args from io import BytesIO from pylab import imread, imsav...
Test with each example image in the repository
Test with each example image in the repository
Python
mit
danilobellini/fractals
--- +++ @@ -0,0 +1,46 @@ +#!/usr/bin/env py.test +# -*- coding: utf-8 -*- +# Created on Fri Apr 25 02:33:04 2014 +# License is MIT, see COPYING.txt for more details. +# @author: Danilo de Jesus da Silva Bellini + +import os, re, pytest +from fractal import generate_fractal, call_kw, cli_parse_args +from io import Byt...
00a312cd7e4928d859dbe7cfc68719d814439b1f
thinglang/tl.py
thinglang/tl.py
import click from thinglang import run @click.command() @click.argument('file', type=click.File('r')) def thinglang(file): source = file.read() run(source) if __name__ == '__main__': thinglang()
Add simple wrapper script for command line usage
Add simple wrapper script for command line usage
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
--- +++ @@ -0,0 +1,13 @@ +import click + +from thinglang import run + + +@click.command() +@click.argument('file', type=click.File('r')) +def thinglang(file): + source = file.read() + run(source) + +if __name__ == '__main__': + thinglang()
74798cdc6a68e30fcb0583f69fd9dd361608988b
tests/rules_tests/isValid_tests/ValidRulesTest.py
tests/rules_tests/isValid_tests/ValidRulesTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import Rule class ValidRulesTest(TestCase): pass if __name__ == '__main__': main()
Create file for positive is_valid tests
Create file for positive is_valid tests
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,20 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 23.06.2017 16:39 +:Licence GNUv3 +Part of grammpy + +""" + +from unittest import main, TestCase +from grammpy import Rule + + +class ValidRulesTest(TestCase): + pass + + + +if __name__ == '__main__': + main()
bb3e67e317eb97929f8dcb79184afee767b4caae
genealogio/migrations/0005_auto_20150223_2319.py
genealogio/migrations/0005_auto_20150223_2319.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import partialdate.fields class Migration(migrations.Migration): dependencies = [ ('genealogio', '0004_auto_20150220_1242'), ] operations = [ migrations.AlterField( model...
Add migration (only changes verbose names).
Add migration (only changes verbose names).
Python
bsd-3-clause
ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio
--- +++ @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import partialdate.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('genealogio', '0004_auto_20150220_1242'), + ] + + operations = [ + ...
8e328a265e624c3dad6ea702d61475308bbce1ff
examples/heap_snapshot.py
examples/heap_snapshot.py
#!/usr/bin/env python3 # https://chromedevtools.github.io/debugger-protocol-viewer/tot/HeapProfiler/ import json import requests import selenium import websocket from devtools.proxy import CHROME_WRAPPER_PATH from selenium.webdriver.common.desired_capabilities import DesiredCapabilities if __name__ == '__main__': ...
Add example for taking heap snapshot
Add example for taking heap snapshot
Python
mit
bayandin/devtools-proxy,bayandin/devtools-proxy
--- +++ @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +# https://chromedevtools.github.io/debugger-protocol-viewer/tot/HeapProfiler/ + +import json + +import requests +import selenium +import websocket +from devtools.proxy import CHROME_WRAPPER_PATH +from selenium.webdriver.common.desired_capabilities import DesiredCapa...
30bb17a94cb6c5c31b3e6f87a9b6f17fc86012ba
non-edx-people.py
non-edx-people.py
"""Produce a list of the emails of all non-edX people in people.yaml""" import yaml with open("people.yaml") as people_yaml: people = yaml.load(people_yaml) non_edx = (e for e in people.itervalues() if e.get('institution') != 'edX') emails = (e['authors_entry'].partition('<')[2].strip(">") for e in non_edx) print ...
Make a list of all non-edX people from people.yaml
Make a list of all non-edX people from people.yaml
Python
apache-2.0
edx/repo-tools,edx/repo-tools
--- +++ @@ -0,0 +1,9 @@ +"""Produce a list of the emails of all non-edX people in people.yaml""" + +import yaml + +with open("people.yaml") as people_yaml: + people = yaml.load(people_yaml) +non_edx = (e for e in people.itervalues() if e.get('institution') != 'edX') +emails = (e['authors_entry'].partition('<')[2].s...
3ceac19fb4321669e9b0129f84a4da418c62bb2e
temba/msgs/migrations/0048_auto_20160308_2131.py
temba/msgs/migrations/0048_auto_20160308_2131.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models INDEX_SQL = """ DO $$ BEGIN IF NOT EXISTS ( SELECT 1 FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relname = 'msgs_msg_responded_to_not_null' AND n.nspname = 'public') THEN ...
Use partial index for responded_to_id
Use partial index for responded_to_id
Python
agpl-3.0
pulilab/rapidpro,tsotetsi/textily-web,ewheeler/rapidpro,pulilab/rapidpro,ewheeler/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web,ewheeler/rapidpro,pulilab/rapidpro,ewheeler/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + +INDEX_SQL = """ + DO $$ + BEGIN + + IF NOT EXISTS ( + SELECT 1 FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relname = 'msgs_msg_responded_to_not_...
dffb641b91e8f02750b4b925a7e2eb0d30a2e96d
plexus/.ycm_extra_conf.py
plexus/.ycm_extra_conf.py
def Settings(**kwargs): return { 'flags': [ '-pthread', '-DNDEBUG', '-g', '-fwrapv', '-02', '-Wall', '-g', '-fstack-protector-strong', '-Wformat', '-Werror=format-security', '-...
Add a YouCompleteMe configuration file that contains C-family compilations tags specific to Plexus
Add a YouCompleteMe configuration file that contains C-family compilations tags specific to Plexus
Python
mit
mertyildiran/Plexus,mertyildiran/Plexus
--- +++ @@ -0,0 +1,20 @@ +def Settings(**kwargs): + return { + 'flags': [ + '-pthread', + '-DNDEBUG', + '-g', + '-fwrapv', + '-02', + '-Wall', + '-g', + '-fstack-protector-strong', + '-Wformat', + '...
ae558a68765cd884f1d702ebe613c173faaff062
st2common/tests/unit/test_json_schema.py
st2common/tests/unit/test_json_schema.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Add test case for "use_default".
Add test case for "use_default".
Python
apache-2.0
Itxaka/st2,tonybaloney/st2,Itxaka/st2,StackStorm/st2,pinterb/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,grengojbo/st2,grengojbo/st2,jtopjian/st2,peak6/st2,emedvedev/st2,alfasin/st2,emedvedev/st2,nzlosh/st2,Plexxi/st2,nzlosh/st2,lakshmi-kannan/st2,emedvedev/st2,StackStorm/st2,pixelrebel/st2,denny...
--- +++ @@ -0,0 +1,77 @@ +# Licensed to the StackStorm, Inc ('StackStorm') under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (th...
4d547c1ed3c5d28770b75f183e9c34c0083e0f7e
tempest/api/compute/volumes/test_attach_volume_negative.py
tempest/api/compute/volumes/test_attach_volume_negative.py
# Copyright 2016 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
Add negative tests for deleting attached volume
Add negative tests for deleting attached volume Due to lack of an error handling, Nova's delete-volume API returns HTTP500 error when deleting an attached volume. This patch adds the corresponding test for reproducing the problem on the gate and blocking the same issue in the future. Change-Id: Idb6267be770bcf2541595...
Python
apache-2.0
openstack/tempest,Juniper/tempest,vedujoshi/tempest,Tesora/tesora-tempest,openstack/tempest,vedujoshi/tempest,sebrandon1/tempest,Tesora/tesora-tempest,masayukig/tempest,sebrandon1/tempest,cisco-openstack/tempest,cisco-openstack/tempest,masayukig/tempest,Juniper/tempest
--- +++ @@ -0,0 +1,41 @@ +# Copyright 2016 NEC Corporation. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/L...
6c293b42bdae81082c73754b8cf2d8616cbf1ec2
test/integration/ggrc/converters/test_base_block.py
test/integration/ggrc/converters/test_base_block.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> import mock from collections import defaultdict from ddt import data, ddt from ggrc.converters import base_block from ggrc import models from integration.ggrc import TestCase from integration.ggrc.models...
Add export mapping cache tests
Add export mapping cache tests
Python
apache-2.0
AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core
--- +++ @@ -0,0 +1,55 @@ +# Copyright (C) 2017 Google Inc. +# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> + + +import mock +from collections import defaultdict + +from ddt import data, ddt + +from ggrc.converters import base_block +from ggrc import models + +from integration.ggrc impo...
3e509b8350c79d1f65dee45faac025e3942fa80f
test/test_builder.py
test/test_builder.py
""" test.test_builder ~~~~~~~~~~~~~~~~~ This is the unit test file for site builder. :Copyright: Copyright 2014 Yang LIU <zesikliu@gmail.com> :License: BSD, see LICENSE for details. """ import unittest import datetime import io from zkb.builder import FileProcessor, SiteBuilder from zkb.config import SiteConfig c...
Add a skeleton of builder test.
Add a skeleton of builder test.
Python
bsd-3-clause
zesik/zkb
--- +++ @@ -0,0 +1,72 @@ +""" +test.test_builder +~~~~~~~~~~~~~~~~~ + +This is the unit test file for site builder. + +:Copyright: Copyright 2014 Yang LIU <zesikliu@gmail.com> +:License: BSD, see LICENSE for details. +""" + +import unittest +import datetime +import io + +from zkb.builder import FileProcessor, SiteBui...
76b62e4be81ec06f9b0b5611abb3f49ba2a41dae
analysis/print_reward.py
analysis/print_reward.py
import numpy as np import common def print_reward(inpaths, legend, budget=1e6, last=1e5, sort=False): runs = common.load_runs(inpaths, budget) if not legend: methods = sorted(set(run['method'] for run in runs)) legend = {x: x.replace('_', ' ').title() for x in methods} seeds = sorted({x['seed'] for x i...
Add script to print reward table.
Add script to print reward table.
Python
mit
danijar/crafter
--- +++ @@ -0,0 +1,53 @@ +import numpy as np + +import common + + +def print_reward(inpaths, legend, budget=1e6, last=1e5, sort=False): + runs = common.load_runs(inpaths, budget) + if not legend: + methods = sorted(set(run['method'] for run in runs)) + legend = {x: x.replace('_', ' ').title() for x in methods...
32ec67c2a4fa0e225e9edef03cd59b4f1a509db8
cheroot/test/test_server.py
cheroot/test/test_server.py
"""Tests for the HTTP server.""" # -*- coding: utf-8 -*- # vim: set fileencoding=utf-8 : import os import tempfile import threading import time import pytest import cheroot.server from cheroot.testing import ( ANY_INTERFACE_IPV4, ANY_INTERFACE_IPV6, EPHEMERAL_PORT, ) def make_http_server(bind_addr): ...
Add basic tests for server.HTTPServer.bind_addr
Add basic tests for server.HTTPServer.bind_addr
Python
bsd-3-clause
cherrypy/cheroot
--- +++ @@ -0,0 +1,96 @@ +"""Tests for the HTTP server.""" +# -*- coding: utf-8 -*- +# vim: set fileencoding=utf-8 : + +import os +import tempfile +import threading +import time + +import pytest + +import cheroot.server + +from cheroot.testing import ( + ANY_INTERFACE_IPV4, + ANY_INTERFACE_IPV6, + EPHEMERAL_...
241f4bb835c3335819f66a25367336470d7e3583
bin/result_updater.py
bin/result_updater.py
#!/usr/bin/python2.4 # # Copyright 2009 Google 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 ...
Add a client to migrate from ResultParent.user_agent_list to ResultParent.user_agent_pretty
Add a client to migrate from ResultParent.user_agent_list to ResultParent.user_agent_pretty
Python
apache-2.0
elsigh/browserscope,elsigh/browserscope,elsigh/browserscope,elsigh/browserscope
--- +++ @@ -0,0 +1,81 @@ +#!/usr/bin/python2.4 +# +# Copyright 2009 Google 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 +# +#...
f9b87b08db621fe0f2c39ba7f03b586b09e521bd
api/sonetworks/migrations/0002_auto_20170202_0207.py
api/sonetworks/migrations/0002_auto_20170202_0207.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-02 02:07 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('sonetworks', '0001_initial'), ] operations = [ migrations.RenameField( ...
ADD Django migration for change in Post model
ADD Django migration for change in Post model
Python
mit
semitki/semitki,semitki/semitki,semitki/semitki,semitki/semitki
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-02-02 02:07 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('sonetworks', '0001_initial'), + ] + + operations = [ + ...
43d038920a7e4e0b352c42675646a19285c1fb60
app/soc/modules/gci/views/moderate_delete_account.py
app/soc/modules/gci/views/moderate_delete_account.py
# Copyright 2011 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
Implement the view class required to moderate account deletion requests.
Implement the view class required to moderate account deletion requests.
Python
apache-2.0
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
--- +++ @@ -0,0 +1,60 @@ +# Copyright 2011 the Melange authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required ...
0a0ed8d26f930d80bf38164d5010b96007e17bfd
casepro/statistics/migrations/0015_populate_is_squashed.py
casepro/statistics/migrations/0015_populate_is_squashed.py
# Generated by Django 2.2.8 on 2019-12-09 21:03 from django.db import migrations BATCH_SIZE = 2500 def populate_is_squashed(apps, schema_editor): DailyCount = apps.get_model("statistics", "DailyCount") DailySecondTotalCount = apps.get_model("statistics", "DailySecondTotalCount") TotalCount = apps.get_mo...
Add migration to backfill is_squashed on squashable models
Add migration to backfill is_squashed on squashable models
Python
bsd-3-clause
rapidpro/casepro,rapidpro/casepro,rapidpro/casepro
--- +++ @@ -0,0 +1,41 @@ +# Generated by Django 2.2.8 on 2019-12-09 21:03 + +from django.db import migrations + +BATCH_SIZE = 2500 + + +def populate_is_squashed(apps, schema_editor): + DailyCount = apps.get_model("statistics", "DailyCount") + DailySecondTotalCount = apps.get_model("statistics", "DailySecondTota...
0b1a4a57a9e8f9e7038fb4330cbac68596f5960c
tests/plugins/test_property_mod_tracker.py
tests/plugins/test_property_mod_tracker.py
import sqlalchemy as sa from sqlalchemy_continuum.plugins import PropertyModTrackerPlugin from tests import TestCase class TestPropertyModificationsTracking(TestCase): plugins = [PropertyModTrackerPlugin] def create_models(self): class User(self.Model): __tablename__ = 'text_item' ...
Add tests for PropertyModTracker plugin
Add tests for PropertyModTracker plugin
Python
bsd-3-clause
avilaton/sqlalchemy-continuum,piotr-dobrogost/sqlalchemy-continuum,rmoorman/sqlalchemy-continuum,kvesteri/sqlalchemy-continuum
--- +++ @@ -0,0 +1,40 @@ +import sqlalchemy as sa +from sqlalchemy_continuum.plugins import PropertyModTrackerPlugin +from tests import TestCase + + +class TestPropertyModificationsTracking(TestCase): + plugins = [PropertyModTrackerPlugin] + + def create_models(self): + class User(self.Model): + ...
63c2d7536d37113b78fce22c7db94b17a8450b27
ureport/stats/migrations/0010_add_index.py
ureport/stats/migrations/0010_add_index.py
# Generated by Django 2.2.20 on 2021-05-26 16:49 from django.db import migrations INDEX_SQL = """ CREATE INDEX IF NOT EXISTS stats_pollstats_org_question on stats_pollstats (org_id, question_id) WHERE question_id IS NOT NULL; """ class Migration(migrations.Migration): dependencies = [ ("stats", "0009_a...
Add index on poll stats org and question
Add index on poll stats org and question
Python
agpl-3.0
Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,rapidpro/ureport
--- +++ @@ -0,0 +1,16 @@ +# Generated by Django 2.2.20 on 2021-05-26 16:49 + +from django.db import migrations + +INDEX_SQL = """ +CREATE INDEX IF NOT EXISTS stats_pollstats_org_question on stats_pollstats (org_id, question_id) WHERE question_id IS NOT NULL; +""" + + +class Migration(migrations.Migration): + + dep...
5aebcc61f12087b4f2e594b28264b8601722af93
tests/test_fields.py
tests/test_fields.py
import unittest from decimal import Decimal as D from oscar_vat_moss.fields import * # noqa from django.core.exceptions import ValidationError class VATINValidatorTest(unittest.TestCase): VALID_VATINS = ( # VATIN # Company name ('ATU66688202', 'hastexo Professional Services GmbH'), ...
Add unit tests for VATINField, VATINValidator
Add unit tests for VATINField, VATINValidator
Python
bsd-3-clause
hastexo/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss,fghaas/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss,hastexo/django-oscar-vat_moss,fghaas/django-oscar-vat_moss
--- +++ @@ -0,0 +1,53 @@ +import unittest +from decimal import Decimal as D +from oscar_vat_moss.fields import * # noqa +from django.core.exceptions import ValidationError + + +class VATINValidatorTest(unittest.TestCase): + VALID_VATINS = ( + # VATIN # Company name + ('ATU66688202', 'hastexo...
6c1815e30a66478b3534c42847b088a08ad71c90
tests/test_routes.py
tests/test_routes.py
import pytest import msgpack from falcon import API, testing from pianodb.routes import ValidatorComponent, SongFinish TOKEN = 'CB80CB12CC0F41FC87CA6F2AC989E27E' API_PREFIX = '/api/v1' SONGFINISH_ROUTE = "{API_PREFIX}/songfinish".format(API_PREFIX=API_PREFIX) @pytest.fixture(scope='module') def client(): api ...
Add initial Falcon API tests
Add initial Falcon API tests
Python
isc
reillysiemens/pianodb
--- +++ @@ -0,0 +1,82 @@ +import pytest +import msgpack +from falcon import API, testing + +from pianodb.routes import ValidatorComponent, SongFinish + + +TOKEN = 'CB80CB12CC0F41FC87CA6F2AC989E27E' +API_PREFIX = '/api/v1' +SONGFINISH_ROUTE = "{API_PREFIX}/songfinish".format(API_PREFIX=API_PREFIX) + + +@pytest.fixture...
fbb6fee97a668e716028f4cecefb698824cb2933
tests/test_search.py
tests/test_search.py
from .helpers import BaseApplicationTest class TestApplication(BaseApplicationTest): def test_search_with_query(self): response = self.client.get('/search?q=email') assert 200 == response.status_code def test_search_with_query_and_lot(self): response = self.client.get('/search?q=email...
Add tests for response codes for /search route
Add tests for response codes for /search route
Python
mit
alphagov/digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,mtekel/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,mtekel/digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,mtekel/digitalmar...
--- +++ @@ -0,0 +1,15 @@ +from .helpers import BaseApplicationTest + + +class TestApplication(BaseApplicationTest): + def test_search_with_query(self): + response = self.client.get('/search?q=email') + assert 200 == response.status_code + + def test_search_with_query_and_lot(self): + respon...
41a4a37dae64813b6e6c2e1b78dc75cd0847a587
plyer/platforms/ios/spatialorientation.py
plyer/platforms/ios/spatialorientation.py
''' iOS Spatial Orientation ----------------------- ''' from plyer.facades import SpatialOrientation from pyobjus import autoclass class iOSSpatialOrientation(SpatialOrientation): def __init__(self): self.bridge = autoclass('bridge').alloc().init() self.bridge.motionManager.setdeviceMotionUpdat...
Add iOS api for spatial orientation
Add iOS api for spatial orientation
Python
mit
kivy/plyer,KeyWeeUsr/plyer,KeyWeeUsr/plyer,kivy/plyer,KeyWeeUsr/plyer,kivy/plyer
--- +++ @@ -0,0 +1,31 @@ +''' +iOS Spatial Orientation +----------------------- + +''' + +from plyer.facades import SpatialOrientation +from pyobjus import autoclass + + +class iOSSpatialOrientation(SpatialOrientation): + + def __init__(self): + self.bridge = autoclass('bridge').alloc().init() + self...
d69138b8570a13063a5a44eee5cbf932513d3e3c
alembic/versions/bbba2255e00_add_email_validation_column.py
alembic/versions/bbba2255e00_add_email_validation_column.py
"""add email validation column Revision ID: bbba2255e00 Revises: 38a8a6299086 Create Date: 2014-12-16 14:18:45.290836 """ # revision identifiers, used by Alembic. revision = 'bbba2255e00' down_revision = '38a8a6299086' from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('user', sa.Colu...
Add validation column for email address.
Add validation column for email address.
Python
agpl-3.0
jean/pybossa,geotagx/pybossa,jean/pybossa,geotagx/pybossa,PyBossa/pybossa,OpenNewsLabs/pybossa,OpenNewsLabs/pybossa,stefanhahmann/pybossa,PyBossa/pybossa,inteligencia-coletiva-lsd/pybossa,Scifabric/pybossa,stefanhahmann/pybossa,inteligencia-coletiva-lsd/pybossa,Scifabric/pybossa
--- +++ @@ -0,0 +1,24 @@ +"""add email validation column + +Revision ID: bbba2255e00 +Revises: 38a8a6299086 +Create Date: 2014-12-16 14:18:45.290836 + +""" + +# revision identifiers, used by Alembic. +revision = 'bbba2255e00' +down_revision = '38a8a6299086' + +from alembic import op +import sqlalchemy as sa + + +def ...
64216937d00f7a5437da022eeff0a543059e89ed
code/supervise_gene_mentions.py
code/supervise_gene_mentions.py
#! /usr/bin/env python3 # # Perform distant supervision on gene mentions # # Each input row contains a mention and the sentence it is from # import fileinput import json from dstruct.Sentence import Sentence from dstruct.Mention import Mention from helper.dictionaries import load_dict # Perform the supervision def s...
Add script to supervise gene mentions
Add script to supervise gene mentions
Python
apache-2.0
rionda/dd-genomics,amwenger/dd-genomics,amwenger/dd-genomics,amwenger/dd-genomics,rionda/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics
--- +++ @@ -0,0 +1,60 @@ +#! /usr/bin/env python3 +# +# Perform distant supervision on gene mentions +# +# Each input row contains a mention and the sentence it is from +# + +import fileinput +import json + +from dstruct.Sentence import Sentence +from dstruct.Mention import Mention +from helper.dictionaries import lo...
630e9796a2cdeb4d2b6d132bef362b5bf6cd1ff0
databaker/tutorial_loader.py
databaker/tutorial_loader.py
# Based on altair tutorial loader: # https://github.com/altair-viz/altair/blob/273a1fcf9cec1956474af755d5fe32f0e3f0aee8/altair/tutorial.py # Copyright (c) 2015, Brian E. Granger and Jake Vanderplas # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
Add tutorial loader script based on one in altair
Add tutorial loader script based on one in altair List tutorials from within Jupyter.
Python
agpl-3.0
scraperwiki/databaker,scraperwiki/databaker
--- +++ @@ -0,0 +1,60 @@ +# Based on altair tutorial loader: +# https://github.com/altair-viz/altair/blob/273a1fcf9cec1956474af755d5fe32f0e3f0aee8/altair/tutorial.py + +# Copyright (c) 2015, Brian E. Granger and Jake Vanderplas +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or w...
11abd1c48968e0fd14eb8879fd64af35af9e1e20
pyfwk/struc/dbrow.py
pyfwk/struc/dbrow.py
#!/usr/bin/env python """ dbcol.py: DBCol is a struct describing an sqlite database table column """ from dbcol import * # ----------------------------DATABASE-COLUMN-----------------------------# class DBRow: @staticmethod def dict(columns, values): if (values is not None): if (len(co...
Create database row class (DBRow)
Create database row class (DBRow)
Python
mit
rlinguri/pyfwk
--- +++ @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +""" + dbcol.py: DBCol is a struct describing an sqlite database table column +""" + +from dbcol import * + + +# ----------------------------DATABASE-COLUMN-----------------------------# +class DBRow: + @staticmethod + def dict(columns, values): + if (va...
f64e2f17f2e4b69790d6dccf3279c36659d499a0
strToCamelCase.py
strToCamelCase.py
# python3 # # Sample Input: min value array # Sample Output: minValueArray # inputString = input().strip().split(' ') result = inputString[0] for i in range(1,len(inputString)): result += inputString[i][0].upper() + inputString[i][1:] print (result)
Create a program to Convert String to Camel Case
Create a program to Convert String to Camel Case
Python
mit
laxmena/CodeKata,laxmena/CodeKata
--- +++ @@ -0,0 +1,13 @@ +# python3 +# +# Sample Input: min value array +# Sample Output: minValueArray +# +inputString = input().strip().split(' ') + +result = inputString[0] + +for i in range(1,len(inputString)): + result += inputString[i][0].upper() + inputString[i][1:] + +print (result)
9f4978ff189c6fc8a2f4c263d43b10644c1e978e
easy_bake.py
easy_bake.py
import RPi.GPIO as gpio #use board numbering on the pi gpio.setmode(gpio.BOARD) gpio.setup(40, gpio.OUT) gpio.setup(38, gpio.IN) #true and 1 are the same gpio.output(40, True) gpio.output(38, 1)
Add initial gpio commands to python file
Add initial gpio commands to python file
Python
mit
emgreen33/easy_bake,emgreen33/easy_bake
--- +++ @@ -0,0 +1,12 @@ +import RPi.GPIO as gpio + +#use board numbering on the pi + +gpio.setmode(gpio.BOARD) + +gpio.setup(40, gpio.OUT) +gpio.setup(38, gpio.IN) + +#true and 1 are the same +gpio.output(40, True) +gpio.output(38, 1)
91e7a4f36637e7706dd17f1e093fe029f031bc3d
API/chat/migrations/0001_squashed_0002_auto_20150707_1647.py
API/chat/migrations/0001_squashed_0002_auto_20150707_1647.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): replaces = [(b'chat', '0001_squashed_0008_auto_20150702_1437'), (b'chat', '0002_auto_20150707_1647')] dependencies = [ ] operations = [ migrations...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Channel', fields=[ ('id', models.AutoField(verb...
Remove replaces line on 0001_squashed
[HOTFIX] Remove replaces line on 0001_squashed
Python
mit
gtklocker/ting,sirodoht/ting,gtklocker/ting,odyvarv/ting-1,VitSalis/ting,mbalamat/ting,VitSalis/ting,gtklocker/ting,sirodoht/ting,odyvarv/ting-1,gtklocker/ting,dionyziz/ting,mbalamat/ting,VitSalis/ting,odyvarv/ting-1,dionyziz/ting,mbalamat/ting,VitSalis/ting,odyvarv/ting-1,dionyziz/ting,mbalamat/ting,sirodoht/ting,dion...
--- +++ @@ -5,8 +5,6 @@ class Migration(migrations.Migration): - - replaces = [(b'chat', '0001_squashed_0008_auto_20150702_1437'), (b'chat', '0002_auto_20150707_1647')] dependencies = [ ]
21f1f9ea6abbf5b2fc7f851224821d8e94864372
data_analysis/parse_pagerank.py
data_analysis/parse_pagerank.py
import pandas as pd import argparse import glob import os if __name__ == "__main__": parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('--dir', type=str, default="it", help="directory where the files are stored") parser.add_argument('--top', type=int, default=100) ...
Add script to parse pagerank results.
Add script to parse pagerank results.
Python
mit
geektoni/Influenza-Like-Illness-Predictor,geektoni/Influenza-Like-Illness-Predictor
--- +++ @@ -0,0 +1,50 @@ +import pandas as pd +import argparse +import glob +import os + +if __name__ == "__main__": + + parser = argparse.ArgumentParser(description='Process some integers.') + parser.add_argument('--dir', type=str, default="it", help="directory where the files are stored") + parser.add_argu...
d0c1ce9ece3f2c901090a3a232bfd73dd34d28e3
zou/migrations/versions/a66508788c53_add_nb_assets_ready.py
zou/migrations/versions/a66508788c53_add_nb_assets_ready.py
"""Add nb assets ready column Revision ID: a66508788c53 Revises: 1e150c2cea4d Create Date: 2021-11-23 00:07:43.717653 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utils # revision identifiers, used by Alembic. revision = 'a66508788c53' down_revision = '1e150c2cea4d' branch_labels = None depe...
Add missing column for tasks
[breakdown] Add missing column for tasks
Python
agpl-3.0
cgwire/zou
--- +++ @@ -0,0 +1,29 @@ +"""Add nb assets ready column + +Revision ID: a66508788c53 +Revises: 1e150c2cea4d +Create Date: 2021-11-23 00:07:43.717653 + +""" +from alembic import op +import sqlalchemy as sa +import sqlalchemy_utils + + +# revision identifiers, used by Alembic. +revision = 'a66508788c53' +down_revision ...
8eb2c02f4a30f7b1a3d54550d027139687481bd2
temba/channels/migrations/0033_auto_20160718_2045.py
temba/channels/migrations/0033_auto_20160718_2045.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('channels', '0032_channelevent'), ] operations = [ migrations.AlterField( model_name='channel', name=...
Add migration for globe channel type
Add migration for globe channel type
Python
agpl-3.0
tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web,ewheeler/rapidpro,ewheeler/rapidpro,ewheeler/rapidpro,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,ewheeler/rapidpro
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('channels', '0032_channelevent'), + ] + + operations = [ + migrations.AlterField( + ...
09854094677961d6833a793584d2098264900ab5
tests/generate_urls.py
tests/generate_urls.py
from urllib.parse import urljoin, urlparse from itertools import product import csv import posixpath def resolveComponents(url): """ >>> resolveComponents('http://www.example.com/foo/bar/../../baz/bux/') 'http://www.example.com/baz/bux/' >>> resolveComponents('http://www.example.com/some/path/../file....
Add script used to generate urls test file.
Add script used to generate urls test file. Thank you @woxcab for the script.
Python
unlicense
zachborboa/php-curl-class,php-curl-class/php-curl-class,zachborboa/php-curl-class,php-curl-class/php-curl-class,zachborboa/php-curl-class,php-curl-class/php-curl-class
--- +++ @@ -0,0 +1,50 @@ +from urllib.parse import urljoin, urlparse +from itertools import product +import csv +import posixpath + + +def resolveComponents(url): + """ + >>> resolveComponents('http://www.example.com/foo/bar/../../baz/bux/') + 'http://www.example.com/baz/bux/' + >>> resolveComponents('htt...
1124da4ea6c30f0c36854ec938aa9ea60cca73d4
djangoappengine/db/expressions.py
djangoappengine/db/expressions.py
from django.db.models.sql.expressions import SQLEvaluator from django.db.models.expressions import ExpressionNode OPERATION_MAP = { ExpressionNode.ADD: lambda x, y: x + y, ExpressionNode.SUB: lambda x, y: x - y, ExpressionNode.MUL: lambda x, y: x * y, ExpressionNode.DIV: lambda x, y: x / y, Expres...
from django.db.models.sql.expressions import SQLEvaluator from django.db.models.expressions import ExpressionNode OPERATION_MAP = { ExpressionNode.ADD: lambda x, y: x + y, ExpressionNode.SUB: lambda x, y: x - y, ExpressionNode.MUL: lambda x, y: x * y, ExpressionNode.DIV: lambda x, y: x / y, Expres...
Fix ExpressionEvalutator for Django 1.5 changes to cols property
Fix ExpressionEvalutator for Django 1.5 changes to cols property
Python
bsd-3-clause
django-nonrel/djangoappengine,Implisit/djangoappengine,dwdraju/djangoappengine
--- +++ @@ -38,4 +38,11 @@ return OPERATION_MAP[node.connector](*values) def evaluate_leaf(self, node, qn, connection): - return self.entity[qn(self.cols[node][1])] + col = None + for n, c in self.cols: + if n is node: + col = c + break + ...
08834282a5b3aec366d594bbd6d1f866876a7cb1
examples/basic_masterqa_test.py
examples/basic_masterqa_test.py
from seleniumbase import MasterQA class MasterQATests(MasterQA): def test_masterqa(self): self.open("http://xkcd.com/1700/") self.verify("Do you see a webcomic?") self.click_link_text('Store') self.verify("Do you see items for sale?") self.update_text("input#top-search-inp...
Add a more simple MasterQA example
Add a more simple MasterQA example
Python
mit
possoumous/Watchers,ktp420/SeleniumBase,mdmintz/seleniumspot,ktp420/SeleniumBase,mdmintz/SeleniumBase,ktp420/SeleniumBase,possoumous/Watchers,mdmintz/seleniumspot,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,possoumous/Watchers,possoumous/Watchers,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,ktp420/SeleniumBas...
--- +++ @@ -0,0 +1,12 @@ +from seleniumbase import MasterQA + + +class MasterQATests(MasterQA): + + def test_masterqa(self): + self.open("http://xkcd.com/1700/") + self.verify("Do you see a webcomic?") + self.click_link_text('Store') + self.verify("Do you see items for sale?") + ...
43322576a7a74f668a86cc0c4601c719c4fb2646
candidates/tests/test_autocomplete.py
candidates/tests/test_autocomplete.py
from mock import patch, Mock from django_webtest import WebTest @patch('candidates.views.PopIt') @patch('candidates.views.requests') class TestAutocompletePartyView(WebTest): def test_autocomplete(self, mock_requests, mock_popit): fake_search_result = { "total": 9, "page": 1, ...
Add a test for the party autocomplete view
Add a test for the party autocomplete view
Python
agpl-3.0
mhl/yournextmp-popit,YoQuieroSaber/yournextrepresentative,mysociety/yournextrepresentative,datamade/yournextmp-popit,datamade/yournextmp-popit,DemocracyClub/yournextrepresentative,neavouli/yournextrepresentative,mhl/yournextmp-popit,openstate/yournextrepresentative,YoQuieroSaber/yournextrepresentative,mysociety/yournex...
--- +++ @@ -0,0 +1,45 @@ +from mock import patch, Mock + +from django_webtest import WebTest + +@patch('candidates.views.PopIt') +@patch('candidates.views.requests') +class TestAutocompletePartyView(WebTest): + + def test_autocomplete(self, mock_requests, mock_popit): + fake_search_result = { + "...
46f3909e6f50d7832db1331a74916e47d656d459
examples/polymorphic_inheritance.py
examples/polymorphic_inheritance.py
"""Example of using polymorphic inheritance features to keep multiple related models in a single collection""" import uuid from modularodm import InheritableStoredObject, fields from modularodm.storage import EphemeralStorage class Car(InheritableStoredObject): _id = fields.StringField(primary=True, default=uui...
Add example for polymorphic inheritance
Add example for polymorphic inheritance
Python
apache-2.0
CenterForOpenScience/modular-odm,sloria/modular-odm,icereval/modular-odm,chrisseto/modular-odm
--- +++ @@ -0,0 +1,52 @@ +"""Example of using polymorphic inheritance features to keep multiple related +models in a single collection""" + +import uuid + +from modularodm import InheritableStoredObject, fields +from modularodm.storage import EphemeralStorage + + +class Car(InheritableStoredObject): + _id = fields...
3b8326b8f0fc2ab9fec2bc25f1e05ad3ca4928bb
indra/tests/test_bioregistry.py
indra/tests/test_bioregistry.py
from indra.databases import bioregistry def test_get_ns_from_bioregistry(): assert bioregistry.get_ns_from_bioregistry('xxxx') is None assert bioregistry.get_ns_from_bioregistry('noncodev4.rna') == 'NONCODE' assert bioregistry.get_ns_from_bioregistry('chebi') == 'CHEBI' def test_get_ns_id_from_bioregist...
Add tests for Bioregistry module
Add tests for Bioregistry module
Python
bsd-2-clause
johnbachman/indra,bgyori/indra,sorgerlab/indra,bgyori/indra,bgyori/indra,johnbachman/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra
--- +++ @@ -0,0 +1,44 @@ +from indra.databases import bioregistry + + +def test_get_ns_from_bioregistry(): + assert bioregistry.get_ns_from_bioregistry('xxxx') is None + assert bioregistry.get_ns_from_bioregistry('noncodev4.rna') == 'NONCODE' + assert bioregistry.get_ns_from_bioregistry('chebi') == 'CHEBI' +...
1e6eab50744e77c31918929c8ff825a59b41d292
frigg/builds/migrations/0008_auto_20150216_0959.py
frigg/builds/migrations/0008_auto_20150216_0959.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 = [ ('builds', '0007_build_message'), ] operations = [ migrations.AlterModelOptions( ...
Add migration for ordering of projects
Add migration for ordering of projects
Python
mit
frigg/frigg-hq,frigg/frigg-hq,frigg/frigg-hq
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('builds', '0007_build_message'), + ] + + operations = [ + ...
e7ced56f3776d78920caa28b6ced3e74b0738de9
hardware/explorer_phat/has_explorer_phat_or_hat.py
hardware/explorer_phat/has_explorer_phat_or_hat.py
#!/usr/bin/env python # coding: Latin-1 from explorerhat import motor # If ImportError raised, the library is not installed # If python exits with the following, then the device is not connected: # Warning, could not find Analog or Touch... # Please check your i2c settings! # On exit: # $? is 0 if library and devic...
Add a script to tell if an Explorer PHAT or HAT is available
Add a script to tell if an Explorer PHAT or HAT is available
Python
mit
claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code
--- +++ @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# coding: Latin-1 + +from explorerhat import motor + +# If ImportError raised, the library is not installed +# If python exits with the following, then the device is not connected: +# Warning, could not find Analog or Touch... +# Please check your i2c settings! + +# O...
6ab078562b946ef87a8a4262ff29be25fbf23e40
src/test/test_ipfgraph.py
src/test/test_ipfgraph.py
#!/usr/bin/python # -*- coding: utf-8 -*- import unittest import os, sys cmd_folder, f = os.path.split(os.path.dirname(os.path.abspath(__file__))) if cmd_folder not in sys.path: sys.path.insert(0, cmd_folder) import ipf.ipf import ipf.ipfblock.rgb2gray import cv class TestIPFGraph(unittest.TestCase): def...
Add test module for IPFGraph
Add test module for IPFGraph
Python
lgpl-2.1
anton-golubkov/Garland,anton-golubkov/Garland
--- +++ @@ -0,0 +1,36 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import unittest + + +import os, sys +cmd_folder, f = os.path.split(os.path.dirname(os.path.abspath(__file__))) +if cmd_folder not in sys.path: + sys.path.insert(0, cmd_folder) + + +import ipf.ipf +import ipf.ipfblock.rgb2gray +import cv + +cla...
062a7beae15fbea11286b4c3266eae16ceb46a3d
tests/logic/email_test.py
tests/logic/email_test.py
# -*- coding: utf-8 -*- import mock import unittest import logic.email class EmailTest(unittest.TestCase): """We really just want to test that configuration is honored here.""" sender = 'test@example.com' recipient = 'test@example.com' subject = 'test subject' html = '<p>hello test</p>' text...
Add test for email logic (just config)
Add test for email logic (just config)
Python
mit
Yelp/love,Yelp/love,Yelp/love
--- +++ @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +import mock +import unittest + +import logic.email + + +class EmailTest(unittest.TestCase): + """We really just want to test that configuration is honored here.""" + + sender = 'test@example.com' + recipient = 'test@example.com' + subject = 'test subject'...
7c4cf25868a907eb3ac718b2d4dbef2966fbe806
ext/dcos-installer/dcos_installer/util/__init__.py
ext/dcos-installer/dcos_installer/util/__init__.py
import logging import os CONFIG_PATH = '/genconf/config.yaml' SSH_KEY_PATH = '/genconf/ssh_key' IP_DETECT_PATH = '/genconf/ip-detect' SERVE_DIR = '/genconf/serve' STATE_DIR = '/genconf/state' GENCONF_DIR = '/genconf' log = logging.getLogger(__name__) def write_file(data, path): try: with open(path, 'w')...
CONFIG_PATH = '/genconf/config.yaml' SSH_KEY_PATH = '/genconf/ssh_key' IP_DETECT_PATH = '/genconf/ip-detect' SERVE_DIR = '/genconf/serve' STATE_DIR = '/genconf/state' GENCONF_DIR = '/genconf'
Remove dead code in dcos_installer.util
Remove dead code in dcos_installer.util
Python
apache-2.0
lingmann/dcos,xinxian0458/dcos,amitaekbote/dcos,branden/dcos,dcos/dcos,xinxian0458/dcos,surdy/dcos,lingmann/dcos,mesosphere-mergebot/dcos,jeid64/dcos,surdy/dcos,mesosphere-mergebot/mergebot-test-dcos,darkonie/dcos,mnaboka/dcos,mnaboka/dcos,dcos/dcos,jeid64/dcos,vishnu2kmohan/dcos,GoelDeepak/dcos,darkonie/dcos,asridhara...
--- +++ @@ -1,51 +1,6 @@ -import logging -import os - CONFIG_PATH = '/genconf/config.yaml' SSH_KEY_PATH = '/genconf/ssh_key' IP_DETECT_PATH = '/genconf/ip-detect' SERVE_DIR = '/genconf/serve' STATE_DIR = '/genconf/state' GENCONF_DIR = '/genconf' - -log = logging.getLogger(__name__) - - -def write_file(data, pat...
e6bbf8e84cf27080e62716a72d0a9fb622d39d8b
python_apps/pypo/cloud_storage_downloader.py
python_apps/pypo/cloud_storage_downloader.py
import os import logging import ConfigParser import urllib2 from libcloud.storage.types import Provider, ContainerDoesNotExistError, ObjectDoesNotExistError from libcloud.storage.providers import get_driver CONFIG_PATH = '/etc/airtime/airtime.conf' class CloudStorageDownloader: def __init__(self): config...
Modify Pypo -> Download files from cloud storage
CC-5884: Modify Pypo -> Download files from cloud storage
Python
agpl-3.0
Lapotor/libretime,comiconomenclaturist/libretime,LibreTime/libretime,LibreTime/libretime,comiconomenclaturist/libretime,comiconomenclaturist/libretime,LibreTime/libretime,LibreTime/libretime,Lapotor/libretime,comiconomenclaturist/libretime,LibreTime/libretime,comiconomenclaturist/libretime,LibreTime/libretime,Lapotor/l...
--- +++ @@ -0,0 +1,45 @@ +import os +import logging +import ConfigParser +import urllib2 + +from libcloud.storage.types import Provider, ContainerDoesNotExistError, ObjectDoesNotExistError +from libcloud.storage.providers import get_driver + +CONFIG_PATH = '/etc/airtime/airtime.conf' + +class CloudStorageDownloader: ...
e032e8156843109931c1f66e9deb64c580348ebf
lintcode/Easy/096_Partition_List.py
lintcode/Easy/096_Partition_List.py
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param head: The first node of linked list. @param x: an integer @return: a ListNode """ def partition(self, head, x): # wri...
Add solution to lintcode question 96
Add solution to lintcode question 96
Python
mit
Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode
--- +++ @@ -0,0 +1,29 @@ +""" +Definition of ListNode +class ListNode(object): + + def __init__(self, val, next=None): + self.val = val + self.next = next +""" +class Solution: + """ + @param head: The first node of linked list. + @param x: an integer + @return: a ListNode + """ + d...
b682339c19702e01de228d0ff982ca086ef9906f
aleph/migrate/versions/a8849e4e6784_match_table.py
aleph/migrate/versions/a8849e4e6784_match_table.py
"""Remove the match table. Revision ID: a8849e4e6784 Revises: 2979a1322381 Create Date: 2020-03-14 20:16:35.882396 """ from alembic import op # revision identifiers, used by Alembic. revision = 'a8849e4e6784' down_revision = '2979a1322381' def upgrade(): op.drop_index('ix_match_collection_id', table_name='matc...
Drop the old xref table
Drop the old xref table
Python
mit
pudo/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph
--- +++ @@ -0,0 +1,22 @@ +"""Remove the match table. + +Revision ID: a8849e4e6784 +Revises: 2979a1322381 +Create Date: 2020-03-14 20:16:35.882396 + +""" +from alembic import op + +# revision identifiers, used by Alembic. +revision = 'a8849e4e6784' +down_revision = '2979a1322381' + + +def upgrade(): + op.drop_index...
cafa02b22a5b3600f9c46331bf73fa3a4bf75ed1
api/migrations/0098_userpreferences_default_tab.py
api/migrations/0098_userpreferences_default_tab.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('api', '0097_auto_20160210_0814'), ] operations = [ migrations.AddField( model_name='userpreferences', ...
Choose default tab on homepage in settings (following or all)
Choose default tab on homepage in settings (following or all)
Python
apache-2.0
rdsathene/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI,dburr/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0097_auto_20160210_0814'), + ] + + operations = [ + migrations.AddField( + ...
71267c56b3dbe1fafc953d676ee68da7a31aaa89
UI/flask_ownstorj/ownstorj/models/backend_engine.py
UI/flask_ownstorj/ownstorj/models/backend_engine.py
from UI.utilities import account_manager from UI.engine import StorjEngine from ownstorj_config_manager import OwnStorjConfigManager # OwnStorj backend enging storj_engine = StorjEngine() # init StorjEngine ownstorj_config_manager = OwnStorjConfigManager() class OwnStorjBuckets: def __init__(self): prin...
Create OwnStorj backend engine module
Create OwnStorj backend engine module
Python
mit
lakewik/storj-gui-client
--- +++ @@ -0,0 +1,24 @@ +from UI.utilities import account_manager +from UI.engine import StorjEngine +from ownstorj_config_manager import OwnStorjConfigManager + +# OwnStorj backend enging + +storj_engine = StorjEngine() # init StorjEngine +ownstorj_config_manager = OwnStorjConfigManager() + +class OwnStorjBuckets:...
7d828d3715e2cca4e3a073c1f71bf16a5e4d8c38
symposion/speakers/migrations/0007_add_biography_help_text.py
symposion/speakers/migrations/0007_add_biography_help_text.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.13 on 2018-01-26 18:57 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('symposion_speakers', '0006_add_photo_help_text'), ] operations = [ migratio...
Add missing migration for Speaker.biography.
Add missing migration for Speaker.biography. See 370690e.
Python
bsd-3-clause
pydata/symposion,pydata/symposion
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.13 on 2018-01-26 18:57 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('symposion_speakers', '0006_add_photo_help_text'), + ...
5dce9c5438b4fcb63c2b7a4a4f481cba331836ed
wger/exercises/management/commands/exercises-health-check.py
wger/exercises/management/commands/exercises-health-check.py
# -*- coding: utf-8 *-* # This file is part of wger Workout Manager. # # wger Workout Manager is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any ...
Add script to check the current exercise translations
Add script to check the current exercise translations
Python
agpl-3.0
wger-project/wger,wger-project/wger,wger-project/wger,wger-project/wger
--- +++ @@ -0,0 +1,94 @@ +# -*- coding: utf-8 *-* + +# This file is part of wger Workout Manager. +# +# wger Workout Manager is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the L...
4faadfd42bc44542423e3ca73ad659fa4f372a22
shuup_tests/notify/test_action_send_mail.py
shuup_tests/notify/test_action_send_mail.py
import pytest from shuup.notify.base import Action from shuup.notify.script import Step, Context TEST_STEP_ACTIONS = [ { "identifier": "send_email", "language": { "constant": "fi" }, "recipient": { "variable": "customer_email" }, "template_da...
Add a test proving a bug in the notify app
Add a test proving a bug in the notify app Add a test that reproduces a failure seen in a production environment Leaving the actual fix for the people who know how they want it done No refs
Python
agpl-3.0
shoopio/shoop,suutari-ai/shoop,suutari-ai/shoop,shoopio/shoop,suutari-ai/shoop,shoopio/shoop
--- +++ @@ -0,0 +1,54 @@ +import pytest + +from shuup.notify.base import Action +from shuup.notify.script import Step, Context + +TEST_STEP_ACTIONS = [ + { + "identifier": "send_email", + "language": { + "constant": "fi" + }, + "recipient": { + "variable": "custome...
ebfdc2e87a6798cfd0e3aae1e974069c828fbc4d
kufpybio/goxmlparser.py
kufpybio/goxmlparser.py
import xml.etree.ElementTree as ElementTree class GOXMLParser(object): def go_term_information(self, xml): tree = ElementTree.fromstring(xml) return{ "name" : tree.findtext("./term/name"), "namespace" : tree.findtext("./term/namespace"), "def" : tree.findtext("....
Add a XML pareser for GO OBO XML
Add a XML pareser for GO OBO XML
Python
isc
konrad/kufpybio
--- +++ @@ -0,0 +1,10 @@ +import xml.etree.ElementTree as ElementTree + +class GOXMLParser(object): + + def go_term_information(self, xml): + tree = ElementTree.fromstring(xml) + return{ + "name" : tree.findtext("./term/name"), + "namespace" : tree.findtext("./term/namespace"), ...
f3b32a91e2f7ae5a04b19f2c5918f24e443033ad
appengine/swarming/tools/health_check.py
appengine/swarming/tools/health_check.py
#!/usr/bin/env python # Copyright 2018 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Check the health of a Swarming version.""" import argparse import os import subprocess import sys HERE = os.path.dirnam...
Add a health check tool for use by the deployment tools.
Add a health check tool for use by the deployment tools. Bug: 812965 Change-Id: I3edcc8830f186c6b02e3d2071a8d7c73b54a4193 Reviewed-on: https://chromium-review.googlesource.com/940382 Reviewed-by: Marc-Antoine Ruel <d2bf0fc09b08f7b0888b3ddab32b3e89c7122c8b@chromium.org> Commit-Queue: Marc-Antoine Ruel <d2bf0fc09b08f7b0...
Python
apache-2.0
luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# Copyright 2018 The LUCI Authors. All rights reserved. +# Use of this source code is governed under the Apache License, Version 2.0 +# that can be found in the LICENSE file. + +"""Check the health of a Swarming version.""" + +import argparse +import os +import subproc...
2f4be8ad7234ab59fc6e98b8353a40195dd08ffb
scripts/video/get_stream.py
scripts/video/get_stream.py
#!/usr/bin/env python3 import requests frames = [] data = b"" found_first = False response = requests.get("http://navigation.local:8080/stream/video.h264", stream=True) for chunk in response.iter_content(chunk_size=1024): if chunk: starting_offset = len(data) if starting_offset >= 2: ...
Add script to stream h264 frames from uv4l
Add script to stream h264 frames from uv4l
Python
bsd-3-clause
gizmo-cda/g2x-submarine-v2,gizmo-cda/g2x-submarine-v2,gizmo-cda/g2x-submarine-v2,gizmo-cda/g2x-submarine-v2
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +import requests + +frames = [] +data = b"" +found_first = False +response = requests.get("http://navigation.local:8080/stream/video.h264", stream=True) + +for chunk in response.iter_content(chunk_size=1024): + if chunk: + starting_offset = len(data) + + ...
e50edbfa98d3138836f7f4845e682817538a3e8a
akvo/rsr/management/commands/announcement_open_rate.py
akvo/rsr/management/commands/announcement_open_rate.py
#!/usr/bin/env python3 # Akvo Reporting is covered by the GNU Affero General Public License. # See more details in the license.txt file located at the root folder of the Akvo RSR module. # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >. """ Calculate the open rate for a...
Add command to compute the announcement open rate
Add command to compute the announcement open rate
Python
agpl-3.0
akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr
--- +++ @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +# Akvo Reporting is covered by the GNU Affero General Public License. +# See more details in the license.txt file located at the root folder of the Akvo RSR module. +# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >. + ...
bf51bd060eaaa139851300bf9deed9096afc23e1
numscons/checkers/new/perflib_checkers.py
numscons/checkers/new/perflib_checkers.py
from numscons.checkers.new.common import \ save_and_set, restore, get_initialized_perflib_config # Performance library checks def _check_perflib(context, autoadd, info): context.Message("Checking for %s ... " % info._msg_name) if info.disabled(): context.Result('no - disabled from user environment...
Add Atlas and Mkl checkers.
Add Atlas and Mkl checkers.
Python
bsd-3-clause
cournape/numscons,cournape/numscons,cournape/numscons
--- +++ @@ -0,0 +1,26 @@ +from numscons.checkers.new.common import \ + save_and_set, restore, get_initialized_perflib_config + +# Performance library checks +def _check_perflib(context, autoadd, info): + context.Message("Checking for %s ... " % info._msg_name) + + if info.disabled(): + context.Result(...
15a69fb84ba928dba4d56ce447d16cdd2346e3ef
src/nyc_trees/apps/event/migrations/0015_auto_20150730_1735.py
src/nyc_trees/apps/event/migrations/0015_auto_20150730_1735.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def clear_event_pdfs(apps, schema_editor): Event = apps.get_model("event", "Event") for event in Event.objects.all(): event.map_pdf_filename = '' event.save() def no_op(*args, **kwargs): ...
Add data migration causing all event map PDFs to be regenerated
Add data migration causing all event map PDFs to be regenerated Note we did this before this is copied from `src\nyc_trees\apps\event\migrations\0012_auto_20150424_1705.py` Connects #1787
Python
agpl-3.0
maurizi/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,kdeloach/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +def clear_event_pdfs(apps, schema_editor): + Event = apps.get_model("event", "Event") + for event in Event.objects.all(): + event.map_pdf_filename = '' + even...
388e77bcbc45d88394932e02229c569397ffa12b
ynr/apps/candidates/management/commands/candidates_create_party_descriptions_csv.py
ynr/apps/candidates/management/commands/candidates_create_party_descriptions_csv.py
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals from compat import BufferDictWriter from django.core.management.base import BaseCommand from official_documents.models import OfficialDocument from popolo.models import Organization, Identifier class Command(BaseCommand): help = ...
Add management comand to export party dewcriptions
Add management comand to export party dewcriptions
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
--- +++ @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +from __future__ import print_function, unicode_literals + +from compat import BufferDictWriter + +from django.core.management.base import BaseCommand + +from official_documents.models import OfficialDocument +from popolo.models import Organization, Identifier + + + +...
7476d0695b0c39ddf2d55988daaf838c8ba3003e
py/valid-parenthesis-string.py
py/valid-parenthesis-string.py
from collections import Counter class Solution(object): def dfs(self, s, pos, stack): if stack + self.min_possible_opening[-1] - self.min_possible_opening[pos] > self.max_possible_closing[-1] - self.max_possible_closing[pos]: return False if stack + self.max_possible_opening[-1] - self.m...
Add py solution for 678. Valid Parenthesis String
Add py solution for 678. Valid Parenthesis String 678. Valid Parenthesis String: https://leetcode.com/problems/valid-parenthesis-string/ Approach1: DFS with cutting
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,58 @@ +from collections import Counter +class Solution(object): + def dfs(self, s, pos, stack): + if stack + self.min_possible_opening[-1] - self.min_possible_opening[pos] > self.max_possible_closing[-1] - self.max_possible_closing[pos]: + return False + if stack + self....
68ed2a5c2dfa24551ea936aa52e98525acbe9d42
django_project/realtime/migrations/0035_ash_impact_file_path.py
django_project/realtime/migrations/0035_ash_impact_file_path.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('realtime', '0034_auto_20180208_1327'), ] operations = [ migrations.AddField( model_name='ash', name=...
Add migration file for ash impact file path.
Add migration file for ash impact file path.
Python
bsd-2-clause
AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('realtime', '0034_auto_20180208_1327'), + ] + + operations = [ + migrations.AddField( + ...
c339c54d44963ece2ef3a29787f4475e8736824e
tests/compiler/test_parametrized_usage.py
tests/compiler/test_parametrized_usage.py
import pytest from tests.compiler import compile_snippet from thinglang.compiler.errors import UnfilledGenericParameters def test_both_parameters_unfilled(): with pytest.raises(UnfilledGenericParameters): compile_snippet('list my_lst = list()') def test_right_parameter_unfilled(): with pytest.raise...
Add test for invalid parametrized usage cases
Add test for invalid parametrized usage cases
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
--- +++ @@ -0,0 +1,28 @@ +import pytest + +from tests.compiler import compile_snippet +from thinglang.compiler.errors import UnfilledGenericParameters + + +def test_both_parameters_unfilled(): + with pytest.raises(UnfilledGenericParameters): + compile_snippet('list my_lst = list()') + + +def test_right_para...
531d11ea10064fdbbad85b482bcdf075529c977d
tests/test_utils.py
tests/test_utils.py
import unittest import os, sys sys.path.append(os.path.join(os.path.dirname(__file__), "..\\")) from app import create_app, db from app.utils import get_or_create from app.models import User class TestUtils(unittest.TestCase): def setUp(self): self.app = create_app("testing") self.app_ctx = self...
Add test case for get_or_create util
Add test case for get_or_create util
Python
mit
Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary
--- +++ @@ -0,0 +1,30 @@ +import unittest +import os, sys + +sys.path.append(os.path.join(os.path.dirname(__file__), "..\\")) + +from app import create_app, db +from app.utils import get_or_create +from app.models import User + + +class TestUtils(unittest.TestCase): + def setUp(self): + self.app = create_ap...
a7f4a0395848fa96b584d24576c13a0533c1296d
merge_sort.py
merge_sort.py
#!/usr/bin/env python3 def merge_sorted_list(alist, blist): """ Use merge sort to sort sorted alist and blist, and return merged sorted list of alist. """ if not isinstance(alist, list): raise TypeError("{} should be of type list".format(alist)) if not isinstance(blist, list): raise Type...
Add merge sort practice of python int list.
Add merge sort practice of python int list.
Python
apache-2.0
sjh/python
--- +++ @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 + + +def merge_sorted_list(alist, blist): + """ Use merge sort to sort sorted alist and blist, and return merged sorted list of alist. """ + + if not isinstance(alist, list): + raise TypeError("{} should be of type list".format(alist)) + + if not isinst...
e3c6bc1a8ac54fa4613fdd96f9e5aeebfed32c68
src/main/translator-xml/PMLToXML.py
src/main/translator-xml/PMLToXML.py
#!/usr/bin/env/python import sys import os.path import subprocess # Read in a pml file and save to an xml file def translate_pml_file(xml_file, pml_file): pml_path = os.path.abspath(pml_file.name) xml_path = os.path.abspath(xml_file.name) # Call XML generator return_code = subprocess.call("Pmlxml %...
Add program to convert from PML to XML
Add program to convert from PML to XML
Python
mit
CS4098/GroupProject,CS4098/GroupProject,CS4098/GroupProject
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env/python + +import sys +import os.path +import subprocess + + +# Read in a pml file and save to an xml file +def translate_pml_file(xml_file, pml_file): + + pml_path = os.path.abspath(pml_file.name) + xml_path = os.path.abspath(xml_file.name) + + # Call XML generator + ...
b3466bc6ce36383eba573457cba34087fd54c84a
touchdown/tests/test_aws_waf_rule.py
touchdown/tests/test_aws_waf_rule.py
# Copyright 2015 Isotoma Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
Test 'annotate_object' for a WAF rule
Test 'annotate_object' for a WAF rule
Python
apache-2.0
yaybu/touchdown
--- +++ @@ -0,0 +1,56 @@ +# Copyright 2015 Isotoma Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by ap...
394dfe501ea20d0b4437c99eb856cf024a9ec0d8
volunteers/management/commands/import_init_data.py
volunteers/management/commands/import_init_data.py
from django.core.management.base import BaseCommand #, CommandError from volunteers.models import Edition class Command(BaseCommand): def handle(self, *args, **options): Edition.init_generic_tasks()
Add management command for init data import
Add management command for init data import
Python
agpl-3.0
FOSDEM/volunteers,jrial/fosdem-volunteers,jrial/fosdem-volunteers,FOSDEM/volunteers,FOSDEM/volunteers,jrial/fosdem-volunteers,FOSDEM/volunteers,jrial/fosdem-volunteers
--- +++ @@ -0,0 +1,8 @@ +from django.core.management.base import BaseCommand #, CommandError +from volunteers.models import Edition + + +class Command(BaseCommand): + + def handle(self, *args, **options): + Edition.init_generic_tasks()
f02132a0d60bfe37febe4dd42fb17a5dd96c4698
test/functional/abc_mining_basic.py
test/functional/abc_mining_basic.py
#!/usr/bin/env python3 # Copyright (c) 2020 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Tests for Bitcoin ABC mining RPCs """ from test_framework.messages import ( COIN, ) from test_framework.tes...
Add a test for ABC-specific getblocktemplate behavior
Add a test for ABC-specific getblocktemplate behavior Summary: First step in T1014 As we modify behavior in getblocktemplate, we really need better test coverage. D7201 (f8360b5e981) is one such change. This patch tests that behavior specifically but this test can be expanded to cover other changes that we may have m...
Python
mit
Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc
--- +++ @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +# Copyright (c) 2020 The Bitcoin developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +""" +Tests for Bitcoin ABC mining RPCs +""" + +from test_framework.messages import (...
01a27d35b6d14d6e5c59646442c22e0d1f98c0cf
examples/ultracoldNeutralPlasma.py
examples/ultracoldNeutralPlasma.py
import ucilib.Sim as Sim import ucilib.BorisUpdater as BorisUpdater import numpy as np # Some helpful constants. fund_charge = 1.602176565e-19 # Mass of Be^+ ions. ion_mass = 8.9465 * 1.673e-27 # Create a simulation with n particles. n = 10000 s = Sim.Sim() s.ptcls.set_nptcls(n) # 1/e radius of cloud. s.ptcls.r...
Add an example simulation setup for an ultracold neutral plasma.
Add an example simulation setup for an ultracold neutral plasma.
Python
mit
Tech-XCorp/ultracold-ions,Tech-XCorp/ultracold-ions,hosseinsadeghi/ultracold-ions,hosseinsadeghi/ultracold-ions
--- +++ @@ -0,0 +1,34 @@ +import ucilib.Sim as Sim +import ucilib.BorisUpdater as BorisUpdater +import numpy as np + + +# Some helpful constants. +fund_charge = 1.602176565e-19 + + +# Mass of Be^+ ions. +ion_mass = 8.9465 * 1.673e-27 + + +# Create a simulation with n particles. +n = 10000 +s = Sim.Sim() +s.ptcls.set_...