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 |
|---|---|---|---|---|---|---|---|---|---|---|
822ef2f1d182409d51da16c2b589603f1ef9e27f | tests/test_utils.py | tests/test_utils.py | from django_logutils.utils import add_items_to_message
def test_add_items_to_message():
msg = "log message"
items = {'user': 'benny', 'email': 'benny@example.com'}
msg = add_items_to_message(msg, items)
assert msg == 'log message user=benny email=benny@example.com'
| Add test fro add_items_to_message function. | Add test fro add_items_to_message function.
| Python | bsd-3-clause | jsmits/django-logutils,jsmits/django-logutils | ---
+++
@@ -0,0 +1,8 @@
+from django_logutils.utils import add_items_to_message
+
+
+def test_add_items_to_message():
+ msg = "log message"
+ items = {'user': 'benny', 'email': 'benny@example.com'}
+ msg = add_items_to_message(msg, items)
+ assert msg == 'log message user=benny email=benny@example.com' | |
0d9519527986eb2255d185ec833f7c415ad5dbd3 | migrations/versions/168_update_easuid_schema.py | migrations/versions/168_update_easuid_schema.py | """update eas schema
Revision ID: 281b07fa75bb
Revises:576f5310e8fc
Create Date: 2015-05-19 01:08:57.101681
"""
# revision identifiers, used by Alembic.
revision = '281b07fa75bb'
down_revision = '576f5310e8fc'
from alembic import op
def upgrade():
from inbox.ignition import main_engine
engine = main_engin... | Add migrations for EASUid storage format (part 1 of 3). | Add migrations for EASUid storage format (part 1 of 3).
| Python | agpl-3.0 | PriviPK/privipk-sync-engine,nylas/sync-engine,jobscore/sync-engine,jobscore/sync-engine,ErinCall/sync-engine,jobscore/sync-engine,nylas/sync-engine,gale320/sync-engine,PriviPK/privipk-sync-engine,ErinCall/sync-engine,Eagles2F/sync-engine,ErinCall/sync-engine,Eagles2F/sync-engine,nylas/sync-engine,gale320/sync-engine,Ea... | ---
+++
@@ -0,0 +1,33 @@
+"""update eas schema
+
+Revision ID: 281b07fa75bb
+Revises:576f5310e8fc
+Create Date: 2015-05-19 01:08:57.101681
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '281b07fa75bb'
+down_revision = '576f5310e8fc'
+
+from alembic import op
+
+
+def upgrade():
+ from inbox.ignitio... | |
c28127941ed88fdedc084c6227da3b921a5e15ab | jsk_apc2015_common/scripts/test_bof_object_recognition.py | jsk_apc2015_common/scripts/test_bof_object_recognition.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import cPickle as pickle
import gzip
import sys
import cv2
from imagesift import get_sift_keypoints
import numpy as np
from sklearn.datasets import load_files
from sklearn.metrics import accuracy_score, classification_report
from sklearn.preprocessing impo... | Add bof object recognition test script | [jsk_2015_apc_common] Add bof object recognition test script
| Python | bsd-3-clause | pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import argparse
+import cPickle as pickle
+import gzip
+import sys
+
+import cv2
+from imagesift import get_sift_keypoints
+import numpy as np
+from sklearn.datasets import load_files
+from sklearn.metrics import accuracy_score, classificatio... | |
8ce76a8b2e0310b0adeceef60478ad7baeceba8c | IPython/utils/tests/test_importstring.py | IPython/utils/tests/test_importstring.py | """Tests for IPython.utils.importstring."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-------... | Add proper tests to importstring. | Add proper tests to importstring.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,39 @@
+"""Tests for IPython.utils.importstring."""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2013 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, distributed ... | |
dfbff1c8e1e9acdf66da4caf7ace35fd0b2ce161 | RPxVideoConverter.py | RPxVideoConverter.py | #!/usr/bin/env python
import time
import os
import glob
import sys
import shutil
def RPxLog(severity, message):
print time.time(), severity, message
def RPxErrLog(message):
RPxLog("E", message)
def RPxInfoLog(message):
RPxLog("I", message)
def RPxDevLog(message):
RPxLog("D", message)
scriptDir = os.path.abspa... | Convert video files captured with raspivid | Convert video files captured with raspivid
| Python | apache-2.0 | RPxDrones/RPxCamera,RPxCopter/RPxCamera,RPxCopter/RPxCamera,RPxDrones/RPxCamera | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+import time
+import os
+import glob
+import sys
+import shutil
+
+def RPxLog(severity, message):
+ print time.time(), severity, message
+
+def RPxErrLog(message):
+ RPxLog("E", message)
+
+def RPxInfoLog(message):
+ RPxLog("I", message)
+
+def RPxDevLog(message):
+ R... | |
35c4696b87bd167dc9766a58391faf9b776305ad | tests/services/authorization/test_permission_to_role_assignment.py | tests/services/authorization/test_permission_to_role_assignment.py | """
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.authorization import service
from tests.base import AbstractAppTestCase
class PermissionToRoleAssignmentTestCase(AbstractAppTestCase):
def setUp(self):
super().setUp()
self.... | Test assignment of permissions to roles | Test assignment of permissions to roles
| Python | bsd-3-clause | homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps | ---
+++
@@ -0,0 +1,39 @@
+"""
+:Copyright: 2006-2017 Jochen Kupperschmidt
+:License: Modified BSD, see LICENSE for details.
+"""
+
+from byceps.services.authorization import service
+
+from tests.base import AbstractAppTestCase
+
+
+class PermissionToRoleAssignmentTestCase(AbstractAppTestCase):
+
+ def setUp(self)... | |
2459ddc77429b1a77de9e32ab551649a2abc2517 | src/plone.server/plone/server/tests/test_transactions.py | src/plone.server/plone/server/tests/test_transactions.py | # -*- coding: utf-8 -*-
from aiohttp.test_utils import make_mocked_request
from plone.server.browser import View
from plone.server.transactions import RequestAwareDB
from plone.server.transactions import RequestAwareTransactionManager
from plone.server.transactions import TransactionProxy
import pytest
import ZODB.Demo... | Add tests for transaction proxy | Add tests for transaction proxy
| Python | bsd-2-clause | plone/plone.server,plone/plone.server | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+from aiohttp.test_utils import make_mocked_request
+from plone.server.browser import View
+from plone.server.transactions import RequestAwareDB
+from plone.server.transactions import RequestAwareTransactionManager
+from plone.server.transactions import TransactionPro... | |
639aac964e1c4bc311f4b3e8dd9a0c015f3c81c3 | zerver/management/commands/populate-stream-tokens.py | zerver/management/commands/populate-stream-tokens.py | #!/usr/bin/python
from django.core.management.base import BaseCommand
from zerver.lib.utils import generate_random_token
from zerver.models import Stream
class Command(BaseCommand):
help = """Set a token for all streams that don't have one."""
def handle(self, **options):
streams_needing_tokens = St... | Add a management command to generate hashes for all streams that need them. | Add a management command to generate hashes for all streams that need them.
(imported from commit b3a05e47dfe69b44f984185e360d79bf04f7885b)
| Python | apache-2.0 | luyifan/zulip,TigorC/zulip,Vallher/zulip,jphilipsen05/zulip,xuxiao/zulip,tiansiyuan/zulip,ufosky-server/zulip,tommyip/zulip,armooo/zulip,hj3938/zulip,praveenaki/zulip,kaiyuanheshang/zulip,Qgap/zulip,vabs22/zulip,babbage/zulip,arpitpanwar/zulip,suxinde2009/zulip,johnny9/zulip,Cheppers/zulip,littledogboy/zulip,hackerkid/... | ---
+++
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+
+from django.core.management.base import BaseCommand
+
+from zerver.lib.utils import generate_random_token
+from zerver.models import Stream
+
+class Command(BaseCommand):
+ help = """Set a token for all streams that don't have one."""
+
+ def handle(self, **options... | |
7409b02842708c693695b473cca14546180a4484 | tests/unit/python/foglamp/tasks/purge/test_purge_main.py | tests/unit/python/foglamp/tasks/purge/test_purge_main.py | # -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
""" Test tasks/purge/__main__.py entry point
"""
import pytest
from unittest.mock import patch, MagicMock
from foglamp.tasks import purge
from foglamp.common import logger
from foglamp.common.storage_client.storage_client ... | Test for purge main entry point | Test for purge main entry point
| Python | apache-2.0 | foglamp/FogLAMP,foglamp/FogLAMP,foglamp/FogLAMP,foglamp/FogLAMP | ---
+++
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+
+# FOGLAMP_BEGIN
+# See: http://foglamp.readthedocs.io/
+# FOGLAMP_END
+
+""" Test tasks/purge/__main__.py entry point
+
+"""
+
+import pytest
+from unittest.mock import patch, MagicMock
+
+from foglamp.tasks import purge
+
+from foglamp.common import logger
+from f... | |
1b39f2427a1ba777968908344836fd597bcea428 | clic/web/fixtures.py | clic/web/fixtures.py | import os
from models import db, Subset
# importing from admin rather than db, because it needs app context
from admin import app
if __name__ == '__main__':
# http://stackoverflow.com/a/19008403/2115409
db.init_app(app)
with app.app_context():
# Extensions like Flask-SQLAlchemy now know what t... | Add script to populate the Subset table | Add script to populate the Subset table
| Python | mit | CentreForCorpusResearch/clic,CentreForResearchInAppliedLinguistics/clic,CentreForResearchInAppliedLinguistics/clic,CentreForCorpusResearch/clic,CentreForResearchInAppliedLinguistics/clic,CentreForCorpusResearch/clic | ---
+++
@@ -0,0 +1,36 @@
+import os
+from models import db, Subset
+# importing from admin rather than db, because it needs app context
+from admin import app
+
+
+if __name__ == '__main__':
+
+ # http://stackoverflow.com/a/19008403/2115409
+ db.init_app(app)
+ with app.app_context():
+ # Extension... | |
1536dbee308527e2b8f7a3c734e1020b20e962f0 | sx.py | sx.py | #!/usr/bin/python3
##
# Copyright (c) 2010 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import os
import sys
import semantix.shell
import semantix.utils.shell
sys.path.insert(0, os.path.dirname(__file__))
def run(argv):
return semantix.utils.shell.main(argv)
if __name__ == '__main__':... | Replace the clumsy Makefile with proper command infrastructure | Replace the clumsy Makefile with proper command infrastructure
Semantix now has a proper infrastructure for shell commands, complete
with argument passing and complex sub-commands. Every semantix-based
project (including semantix itself) will how have an executable script
'sx.py' in the root of that project that will... | Python | mit | sprymix/importkit | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/python3
+
+##
+# Copyright (c) 2010 Sprymix Inc.
+# All rights reserved.
+#
+# See LICENSE for details.
+##
+
+
+import os
+import sys
+
+import semantix.shell
+import semantix.utils.shell
+
+
+sys.path.insert(0, os.path.dirname(__file__))
+
+def run(argv):
+ return semantix.ut... | |
36924c92d91c7e29743a4a7b799c3e87a92cf38e | django_yadt/management/commands/yadt_invalidate_variant.py | django_yadt/management/commands/yadt_invalidate_variant.py | from django.core.management.base import BaseCommand, CommandError
from ...utils import get_variant
class Command(BaseCommand):
USAGE = "<app_label> <model> <field> <variant>"
def handle(self, *args, **options):
try:
app_label, model_name, field_name, variant_name = args
except Val... | Add command to invalidate all of a particular variant. | Add command to invalidate all of a particular variant.
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>
| Python | bsd-3-clause | lamby/django-yadt,thread/django-yadt | ---
+++
@@ -0,0 +1,16 @@
+from django.core.management.base import BaseCommand, CommandError
+
+from ...utils import get_variant
+
+class Command(BaseCommand):
+ USAGE = "<app_label> <model> <field> <variant>"
+
+ def handle(self, *args, **options):
+ try:
+ app_label, model_name, field_name, v... | |
4011063de1cc14fd758dd8537ebf10c8c1491149 | migrations/versions/1d8e0b3b949_add_description_to_list.py | migrations/versions/1d8e0b3b949_add_description_to_list.py | """Add description to list
Revision ID: 1d8e0b3b949
Revises: 594033d136f
Create Date: 2014-07-20 13:37:41.064387
"""
# revision identifiers, used by Alembic.
revision = '1d8e0b3b949'
down_revision = '594033d136f'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('list', sa.Column('de... | Add a description to word lists. | Add a description to word lists.
| Python | mit | gmwils/cihui | ---
+++
@@ -0,0 +1,22 @@
+"""Add description to list
+
+Revision ID: 1d8e0b3b949
+Revises: 594033d136f
+Create Date: 2014-07-20 13:37:41.064387
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '1d8e0b3b949'
+down_revision = '594033d136f'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrad... | |
92f14f351c3674531c011923443f8b3b528543d9 | binstar_client/tests/test_copy.py | binstar_client/tests/test_copy.py | from __future__ import unicode_literals
# Standard library imports
import json
import unittest
# Local imports
from binstar_client.scripts.cli import main
from binstar_client.tests.fixture import CLITestCase
from binstar_client.tests.urlmock import urlpatch
class Test(CLITestCase):
@urlpatch
def test_copy_lab... | Add test for `anaconda copy` | Add test for `anaconda copy`
| Python | bsd-3-clause | Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client | ---
+++
@@ -0,0 +1,37 @@
+from __future__ import unicode_literals
+# Standard library imports
+import json
+import unittest
+
+# Local imports
+from binstar_client.scripts.cli import main
+from binstar_client.tests.fixture import CLITestCase
+from binstar_client.tests.urlmock import urlpatch
+
+class Test(CLITestCase... | |
a9b8b3e059bdd5024fccb2efe134a3f98a89d830 | static/extension/uma_rpt_policy/UmaClientAuthzRptPolicy.py | static/extension/uma_rpt_policy/UmaClientAuthzRptPolicy.py | # oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
# Copyright (c) 2017, Gluu
#
# Author: Jose Gonzalez
# Adapted from previous 3.0.1 script of Yuriy Movchan
#
# oxConfigurationProperty required:
# allowed_clients - comma separated list of dns of allowed clients... | Add UMA 2.0 SCIM/Passport script | Add UMA 2.0 SCIM/Passport script | Python | mit | GluuFederation/community-edition-setup,GluuFederation/community-edition-setup,GluuFederation/community-edition-setup | ---
+++
@@ -0,0 +1,80 @@
+# oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
+# Copyright (c) 2017, Gluu
+#
+# Author: Jose Gonzalez
+# Adapted from previous 3.0.1 script of Yuriy Movchan
+#
+# oxConfigurationProperty required:
+# allowed_clients - comma separ... | |
fa9f9a0f76c86bfabd2e63db2add2829a749f639 | tensorflow/contrib/hadoop/python/ops/hadoop_dataset_ops.py | tensorflow/contrib/hadoop/python/ops/hadoop_dataset_ops.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Add python wrapper for tf.contrib.hadoop.SequenceFileDataset | Add python wrapper for tf.contrib.hadoop.SequenceFileDataset
Signed-off-by: Yong Tang <765086fe2e0c1f980161f127fec596800f327f62@outlook.com>
| Python | apache-2.0 | hehongliang/tensorflow,dancingdan/tensorflow,aam-at/tensorflow,arborh/tensorflow,frreiss/tensorflow-fred,alsrgv/tensorflow,alsrgv/tensorflow,tensorflow/tensorflow,Intel-Corporation/tensorflow,ageron/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,seanli9jan/tensorflow,kobejean/tensorflow,ppwwyyxx/tensorflow,davidz... | ---
+++
@@ -0,0 +1,80 @@
+# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-... | |
e3aa9d95f9b2ded1c36820c3049156fb3913a183 | src/dashboard/src/main/management/commands/update_elasticsearch_mappings.py | src/dashboard/src/main/management/commands/update_elasticsearch_mappings.py | # -*- coding: utf-8 -*-
"""Update Elasticsearch mappings for Archivematica 1.12
This command updates the Elasticsearch mappings for the aips and
aipfiles indices for Archivematica 1.12 to enable sorting on all fields
displayed in the new Archival Storage DataTable and populates the new
filePath.raw subfield in the aip... | Add management command to update ES mappings | Add management command to update ES mappings
This management command uses Put Mapping to update the mappings for the
aips and aipfiles indices, to ensure proper sorting in the Archival
Storage tab DataTable, and runs an Update By Query to populate the new
filePath.raw subfield in the aipfiles index.
This command must... | Python | agpl-3.0 | artefactual/archivematica,artefactual/archivematica,artefactual/archivematica,artefactual/archivematica | ---
+++
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+"""Update Elasticsearch mappings for Archivematica 1.12
+
+This command updates the Elasticsearch mappings for the aips and
+aipfiles indices for Archivematica 1.12 to enable sorting on all fields
+displayed in the new Archival Storage DataTable and populates the new... | |
269439513e2f9f84e89592565b20d9ff193fe210 | pyes/scriptfields.py | pyes/scriptfields.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Armando Guereca'
class ScriptFields:
_internal_name = "script_fields"
"""
This object create the script_fields definition
"""
def __init__(self, field_name, script, params = None):
self.fields={}
self.add_field(field_name,... | Add ScriptFields object used as parameter script_fields of Search object | Add ScriptFields object used as parameter script_fields of Search object
| Python | bsd-3-clause | rookdev/pyes,jayzeng/pyes,mouadino/pyes,jayzeng/pyes,mouadino/pyes,aparo/pyes,HackLinux/pyes,aparo/pyes,haiwen/pyes,Fiedzia/pyes,rookdev/pyes,mavarick/pyes,aparo/pyes,HackLinux/pyes,haiwen/pyes,HackLinux/pyes,Fiedzia/pyes,jayzeng/pyes,mavarick/pyes,haiwen/pyes,mavarick/pyes,Fiedzia/pyes | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+__author__ = 'Armando Guereca'
+
+class ScriptFields:
+ _internal_name = "script_fields"
+ """
+ This object create the script_fields definition
+ """
+ def __init__(self, field_name, script, params = None):
+ self.field... | |
e17ef12deb0d80f89f9791225f128bbad91667b2 | polyaxon/pipelines/celery_task.py | polyaxon/pipelines/celery_task.py | from pipelines.models import Operation
from polyaxon.celery_api import CeleryTask
class OperationTask(CeleryTask):
"""Base operation celery task with basic logging."""
_operation = None
def run(self, *args, **kwargs):
self._operation = Operation.objects.get(id=kwargs['query_id'])
super(Op... | Add base celery operation task | Add base celery operation task
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | ---
+++
@@ -0,0 +1,25 @@
+from pipelines.models import Operation
+from polyaxon.celery_api import CeleryTask
+
+
+class OperationTask(CeleryTask):
+ """Base operation celery task with basic logging."""
+ _operation = None
+
+ def run(self, *args, **kwargs):
+ self._operation = Operation.objects.get(id... | |
d13c21f2b0d6a0b72a3ba2f3e24d198d644737ec | sdks/python/apache_beam/runners/portability/expansion_service_main.py | sdks/python/apache_beam/runners/portability/expansion_service_main.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | Add Python expansion service entry point. | Add Python expansion service entry point.
| Python | apache-2.0 | robertwb/incubator-beam,chamikaramj/beam,chamikaramj/beam,lukecwik/incubator-beam,apache/beam,lukecwik/incubator-beam,robertwb/incubator-beam,robertwb/incubator-beam,chamikaramj/beam,apache/beam,lukecwik/incubator-beam,apache/beam,chamikaramj/beam,chamikaramj/beam,apache/beam,lukecwik/incubator-beam,robertwb/incubator-... | ---
+++
@@ -0,0 +1,72 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+... | |
c13307bb4dd28b06bc1c4bb0c8182bed41a2e608 | corehq/apps/sms/management/commands/set_backend_ids.py | corehq/apps/sms/management/commands/set_backend_ids.py | from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from corehq.apps.sms.mixin import VerifiedNumber
class Command(BaseCommand):
args = 'domain [backend_id] [--test]'
help = ('Updates the backend_id on all VerifiedNumber entries for the '
'given domain. I... | Add script for setting contact-level backend ids in bulk | Add script for setting contact-level backend ids in bulk
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq | ---
+++
@@ -0,0 +1,50 @@
+from django.core.management.base import BaseCommand, CommandError
+from optparse import make_option
+from corehq.apps.sms.mixin import VerifiedNumber
+
+
+class Command(BaseCommand):
+ args = 'domain [backend_id] [--test]'
+ help = ('Updates the backend_id on all VerifiedNumber entries... | |
0f106ca30805a3541000f5129b203882ba7cfbb9 | packages/adminrouter/extra/src/test-harness/tests/test_security.py | packages/adminrouter/extra/src/test-harness/tests/test_security.py | import pytest
import requests
class TestRedirect:
@pytest.mark.parametrize(
'path', ('/mesos_dns', '/net', '/exhibitor', '/mesos')
)
def test_redirect(self, master_ar_process, valid_user_header, path):
"""
URL's with no slash on end may redirect to the same URL with a
slas... | Add tests to demonstrate bad Host header problem | Add tests to demonstrate bad Host header problem
| Python | apache-2.0 | dcos/dcos,GoelDeepak/dcos,kensipe/dcos,mesosphere-mergebot/dcos,kensipe/dcos,kensipe/dcos,dcos/dcos,dcos/dcos,mesosphere-mergebot/mergebot-test-dcos,dcos/dcos,GoelDeepak/dcos,mesosphere-mergebot/dcos,mesosphere-mergebot/mergebot-test-dcos,mesosphere-mergebot/mergebot-test-dcos,mesosphere-mergebot/dcos,GoelDeepak/dcos,d... | ---
+++
@@ -0,0 +1,32 @@
+import pytest
+import requests
+
+
+class TestRedirect:
+
+ @pytest.mark.parametrize(
+ 'path', ('/mesos_dns', '/net', '/exhibitor', '/mesos')
+ )
+ def test_redirect(self, master_ar_process, valid_user_header, path):
+ """
+ URL's with no slash on end may redir... | |
f5a6b3f36e676bddadd0c9f04678989c8fca019a | test/unit/test_easy_click_lots.py | test/unit/test_easy_click_lots.py | import unittest
import sys
sys.path.append('../..') # TODO anybetter way?
from ebroker.EasyClickLots import EasyClickLots
class TestConfig(unittest.TestCase):
def setUp(self):
self.lots = EasyClickLots()
def test_cez_lots(self):
cez_lot = self.lots.get_ec_lot(EasyClickLots.CEZ)
... | Add test for EC lots | Add test for EC lots
| Python | mit | vjuranek/e-broker-client | ---
+++
@@ -0,0 +1,24 @@
+import unittest
+import sys
+
+sys.path.append('../..') # TODO anybetter way?
+
+from ebroker.EasyClickLots import EasyClickLots
+
+class TestConfig(unittest.TestCase):
+
+ def setUp(self):
+ self.lots = EasyClickLots()
+
+ def test_cez_lots(self):
+ cez_lot = self.l... | |
a9a3d77c3969889dafaac5b6dd1c133f9510496f | eulathingy/thingys/migrations/0004_remove_thingysection_section_name.py | eulathingy/thingys/migrations/0004_remove_thingysection_section_name.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('thingys', '0003_thingysentence'),
]
operations = [
migrations.RemoveField(
model_name='thingysection',
... | Remove section name - migrate | Remove section name - migrate
| Python | mit | DigitalMockingbird/EULAThingy,DigitalMockingbird/EULAThingy | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('thingys', '0003_thingysentence'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ ... | |
3fdd2de650c24933ae32eb07b85ede34165702fc | py/maximum-length-of-repeated-subarray.py | py/maximum-length-of-repeated-subarray.py | class Solution(object):
def findLength(self, A, B):
"""
:type A: List[int]
:type B: List[int]
:rtype: int
"""
lA, lB = len(A), len(B)
if lA > lB:
lA, lB = lB, lA
A, B = B, A
ans = 0
prev = [0] * (lA + 1)
for b in... | Add py solution for 718. Maximum Length of Repeated Subarray | Add py solution for 718. Maximum Length of Repeated Subarray
718. Maximum Length of Repeated Subarray: https://leetcode.com/problems/maximum-length-of-repeated-subarray/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,21 @@
+class Solution(object):
+ def findLength(self, A, B):
+ """
+ :type A: List[int]
+ :type B: List[int]
+ :rtype: int
+ """
+ lA, lB = len(A), len(B)
+ if lA > lB:
+ lA, lB = lB, lA
+ A, B = B, A
+ ans = 0
+ ... | |
94b7a913ca0d9ce5d4c58539954afef55d21c3a7 | components/dash-core-components/tests/integration/dropdown/test_remove_option.py | components/dash-core-components/tests/integration/dropdown/test_remove_option.py | import json
from dash import Dash, html, dcc, Output, Input
from dash.exceptions import PreventUpdate
sample_dropdown_options = [
{"label": "New York City", "value": "NYC"},
{"label": "Montreal", "value": "MTL"},
{"label": "San Francisco", "value": "SF"},
]
def test_ddro001_remove_option_single(dash_dc... | Add test dropdown remove options. | Add test dropdown remove options.
| Python | mit | plotly/dash,plotly/dash,plotly/dash,plotly/dash,plotly/dash | ---
+++
@@ -0,0 +1,92 @@
+import json
+
+from dash import Dash, html, dcc, Output, Input
+from dash.exceptions import PreventUpdate
+
+
+sample_dropdown_options = [
+ {"label": "New York City", "value": "NYC"},
+ {"label": "Montreal", "value": "MTL"},
+ {"label": "San Francisco", "value": "SF"},
+]
+
+
+def ... | |
8a72eff36b66492e17cfeb0383164a34dbf75ce0 | addons/purchase/report/__init__.py | addons/purchase/report/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Fix useless import following the removal of rml purchase reports | [FIX] Fix useless import following the removal of rml purchase reports
bzr revid: openerp-sle@openerp-sle.home-20140214150700-2zuukk4ahs4q1zhs | Python | agpl-3.0 | odoousers2014/odoo,nuncjo/odoo,markeTIC/OCB,oasiswork/odoo,andreparames/odoo,nexiles/odoo,Endika/odoo,Danisan/odoo-1,spadae22/odoo,0k/OpenUpgrade,grap/OpenUpgrade,bealdav/OpenUpgrade,abstract-open-solutions/OCB,mustafat/odoo-1,papouso/odoo,provaleks/o8,OpusVL/odoo,odooindia/odoo,sinbazhou/odoo,slevenhagen/odoo-npg,rdeh... | ---
+++
@@ -19,8 +19,6 @@
#
##############################################################################
-import order
-import request_quotation
import purchase_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
067ccc7256d258a5b7b7a57beb26ed70488d1be2 | mezzanine_slideshows/migrations/0003_auto__del_slideshow.py | mezzanine_slideshows/migrations/0003_auto__del_slideshow.py | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Slideshow'
db.delete_table('mezzanine_slideshows_slides... | Add migration for model app_name change in preceding commit | Add migration for model app_name change in preceding commit
| Python | bsd-2-clause | philipsouthwell/mezzanine-slideshows,philipsouthwell/mezzanine-slideshows,philipsouthwell/mezzanine-slideshows,adam494m/mezzanine-slideshows,adam494m/mezzanine-slideshows,adam494m/mezzanine-slideshows | ---
+++
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+from south.utils import datetime_utils as datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Deleting model 'Slideshow'
+ db.de... | |
bb8db2ef08b0431b173205f53a4431fcec3dc535 | custom/enikshay/management/commands/get_locations_for_bets.py | custom/enikshay/management/commands/get_locations_for_bets.py | import csv
from django.core.management.base import BaseCommand
from corehq.apps.locations.models import SQLLocation
from custom.enikshay.integrations.bets.repeaters import BETSLocationRepeater
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('domain')
def handle(self,... | Add first pass at BETS location dump | Add first pass at BETS location dump
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,66 @@
+import csv
+from django.core.management.base import BaseCommand
+from corehq.apps.locations.models import SQLLocation
+from custom.enikshay.integrations.bets.repeaters import BETSLocationRepeater
+
+
+class Command(BaseCommand):
+
+ def add_arguments(self, parser):
+ parser.add_arg... | |
a2f991625bc6de9895efb443175b59dfc12d1236 | src/objective-c/tests/analyze_link_map.py | src/objective-c/tests/analyze_link_map.py | #!/usr/bin/python
# Copyright 2018 gRPC 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 ag... | Add Xcode link map analyzer | Add Xcode link map analyzer
| Python | apache-2.0 | mehrdada/grpc,sreecha/grpc,muxi/grpc,vjpai/grpc,grpc/grpc,pszemus/grpc,sreecha/grpc,firebase/grpc,murgatroid99/grpc,chrisdunelm/grpc,ncteisen/grpc,ctiller/grpc,firebase/grpc,jboeuf/grpc,ejona86/grpc,jboeuf/grpc,Vizerai/grpc,nicolasnoble/grpc,grpc/grpc,stanley-cheung/grpc,grpc/grpc,pszemus/grpc,stanley-cheung/grpc,jtatt... | ---
+++
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+# Copyright 2018 gRPC 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
+#
+# Un... | |
e89997b998766a257ca9ce58b0528bd0b7504ed1 | tools/workspace_status_release.py | tools/workspace_status_release.py | import os
import sys
# As this plugin is typically only sym-linked into a gerrit checkout and both os.getcwd and
# os.path.abspath follow symbolic links, they would not allow us to find the gerrit root
# directory. So we have to resort to the PWD environment variable to find the place we're
# symlinked to.
#
# We appe... | Add custom stamp to add its-base revision to version number | Add custom stamp to add its-base revision to version number
Change-Id: I87bacf25e25e58ee4c648963912056726cd297dc
| Python | apache-2.0 | GerritCodeReview/plugins_its-phabricator,GerritCodeReview/plugins_its-phabricator | ---
+++
@@ -0,0 +1,30 @@
+import os
+import sys
+
+# As this plugin is typically only sym-linked into a gerrit checkout and both os.getcwd and
+# os.path.abspath follow symbolic links, they would not allow us to find the gerrit root
+# directory. So we have to resort to the PWD environment variable to find the place ... | |
0ff59da2bd80d28002b3a963dee5bc48ad851ad8 | migrations/versions/d03236a0cda4_add_corporation_flag.py | migrations/versions/d03236a0cda4_add_corporation_flag.py | """add corporation flag
Revision ID: d03236a0cda4
Revises: 47e567919169
Create Date: 2017-04-12 13:21:03.482000
"""
# revision identifiers, used by Alembic.
import sqlalchemy as sa
from alembic import op
from lazyblacksmith.models import Blueprint
from lazyblacksmith.models import db
revision = 'd03236a0cda4'
dow... | Add corporation flag in blueprints | Add corporation flag in blueprints
| Python | bsd-3-clause | Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith | ---
+++
@@ -0,0 +1,32 @@
+"""add corporation flag
+
+Revision ID: d03236a0cda4
+Revises: 47e567919169
+Create Date: 2017-04-12 13:21:03.482000
+
+"""
+
+# revision identifiers, used by Alembic.
+
+import sqlalchemy as sa
+
+from alembic import op
+from lazyblacksmith.models import Blueprint
+from lazyblacksmith.model... | |
7834829bf3d2d97814366ca62826c2c19fd9144e | EXAMPLE-npyscreenreactor-client.py | EXAMPLE-npyscreenreactor-client.py | #!/usr/bin/env python
import npyscreen
import curses
class EditorFormExample(npyscreen.FormMutt):
MAIN_WIDGET_CLASS = npyscreen.BufferPager
def __init__(self, *args, **keywords):
super(npyscreen.FormMutt, self).__init__(*args, **keywords)
self.wCommand.add_handlers({
curses.ascii.NL : self.do_line,
cu... | Add framework for example client | Add framework for example client
| Python | mit | mtearle/npyscreenreactor | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+import npyscreen
+import curses
+
+class EditorFormExample(npyscreen.FormMutt):
+ MAIN_WIDGET_CLASS = npyscreen.BufferPager
+
+ def __init__(self, *args, **keywords):
+ super(npyscreen.FormMutt, self).__init__(*args, **keywords)
+ self.wCommand.add_handlers({
+ ... | |
4e6028b528592a5b23ff13f40422a3d850e1fd44 | repl.py | repl.py | """A repl across hosts."""
import ast
import sys
import readline
import traceback
from io import StringIO
def read_stmt():
stmt = ''
prompt = '>>> '
indented = False
while True:
try:
line = input(prompt)
except EOFError:
print()
sys.exit(0)
s... | Add REPL that evaluates code on various Python versions | Add REPL that evaluates code on various Python versions
| Python | apache-2.0 | lordmauve/chopsticks,lordmauve/chopsticks | ---
+++
@@ -0,0 +1,86 @@
+"""A repl across hosts."""
+import ast
+import sys
+import readline
+import traceback
+from io import StringIO
+
+
+def read_stmt():
+ stmt = ''
+ prompt = '>>> '
+ indented = False
+ while True:
+ try:
+ line = input(prompt)
+ except EOFError:
+ ... | |
77a2ce5ffff72f6414fd11ea37a08048b81edf8b | test.py | test.py | # -*- coding: utf-8 -*-
from pycublas import *
from ctypes import *
#Test functions
handle = cublasHandle_t()
def Init():
status = cublasCreate(byref(handle))
print status
def Close():
status = cublasDestroy(handle)
print status
def Version():
version = c_int()
status = cublasGetVersion(han... | Test in a new file | Test in a new file
| Python | bsd-3-clause | Vrekrer/PycuBLAS | ---
+++
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+
+from pycublas import *
+from ctypes import *
+
+#Test functions
+handle = cublasHandle_t()
+
+def Init():
+ status = cublasCreate(byref(handle))
+ print status
+
+def Close():
+ status = cublasDestroy(handle)
+ print status
+
+def Version():
+ versio... | |
5f3b36bb11858a56bb6154ea5c77eff64e351386 | pombola/south_africa/management/commands/south_africa_export_constituency_offices.py | pombola/south_africa/management/commands/south_africa_export_constituency_offices.py | import csv
import sys
from django.core.management.base import BaseCommand, CommandError
from pombola.core.models import Organisation, OrganisationRelationship
MAPS_URL_TEMPLATE = 'https://www.google.com/maps/place/{lat}+{lon}/@{lat},{lon},17z'
def encode_row_values_to_utf8(row):
return {
k: unicode(v).e... | Add a command to output a CSV file of constituency offices | ZA: Add a command to output a CSV file of constituency offices
| Python | agpl-3.0 | geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,geoffkilpin/pombola,geoffkilpin/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,geoffkilpin/pombola,geoffkilpin/pombola,mysociety/pombola,mysociety/pombola | ---
+++
@@ -0,0 +1,81 @@
+import csv
+import sys
+
+from django.core.management.base import BaseCommand, CommandError
+
+from pombola.core.models import Organisation, OrganisationRelationship
+
+MAPS_URL_TEMPLATE = 'https://www.google.com/maps/place/{lat}+{lon}/@{lat},{lon},17z'
+
+def encode_row_values_to_utf8(row):... | |
247f303c2d5e60108fbd3054f012e6b24859dd26 | lintcode/Medium/029_Interleaving_String.py | lintcode/Medium/029_Interleaving_String.py | class Solution:
"""
@params s1, s2, s3: Three strings as description.
@return: return True if s3 is formed by the interleaving of
s1 and s2 or False if not.
@hint: you can use [[True] * m for i in range (n)] to allocate a n*m matrix.
"""
def isInterleave(self, s1, s2, s3):
#... | Add solution to lintcode question 29 | Add solution to lintcode question 29
| Python | mit | Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode | ---
+++
@@ -0,0 +1,56 @@
+class Solution:
+ """
+ @params s1, s2, s3: Three strings as description.
+ @return: return True if s3 is formed by the interleaving of
+ s1 and s2 or False if not.
+ @hint: you can use [[True] * m for i in range (n)] to allocate a n*m matrix.
+ """
+ def isInte... | |
8a7befd69d4a7b224e037b4eb8111853125a1105 | code_sample/python/sensor_avoid.py | code_sample/python/sensor_avoid.py | #!/usr/bin/env python
#coding: utf-8
import sys,time
j1,j2,j3,j5,j6 = 0,60,0,0,0
while True:
# $B%m%\%C%H$N3QEY$NFI$_9~$_<~4|$O(B20ms$B!J%"%P%&%H$G$9!K(B
time.sleep(0.05)
ch0 = 0
delta = 0
#$B%A%c%s%M%k(B0$B$N(BAD$B%3%s%P!<%?$NCM$rFI$_9~$`!J5wN%%;%s%5!K(B
with open("/run/shm/adconv... | Add a sensor feedback sample | Add a sensor feedback sample
| Python | mit | ryuichiueda/RobotDesign3,ryuichiueda/RobotDesign3,ryuichiueda/RobotDesign3,ryuichiueda/RobotDesign3,ryuichiueda/RobotDesign3 | ---
+++
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+#coding: utf-8
+import sys,time
+
+j1,j2,j3,j5,j6 = 0,60,0,0,0
+
+while True:
+ # $B%m%\%C%H$N3QEY$NFI$_9~$_<~4|$O(B20ms$B!J%"%P%&%H$G$9!K(B
+ time.sleep(0.05)
+
+ ch0 = 0
+ delta = 0
+
+ #$B%A%c%s%M%k(B0$B$N(BAD$B%3%s%P!<%?$NCM$rFI$_9~$`!J5wN%%... | |
c7e5a46348b48e081b122f1e0f8a578b2bfaf05a | open_humans/migrations/0008_rm_ghost_illuminauyg_table.py | open_humans/migrations/0008_rm_ghost_illuminauyg_table.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2018-01-26 00:19
from __future__ import unicode_literals
from django.db import migrations
DROP_UNUSED_TABLES = """\
DROP TABLE IF EXISTS illumina_uyg_userdata;
"""
class Migration(migrations.Migration):
dependencies = [
('open_humans', '0007_bl... | Remove obsolete table from database | Remove obsolete table from database
| Python | mit | OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.9 on 2018-01-26 00:19
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+DROP_UNUSED_TABLES = """\
+ DROP TABLE IF EXISTS illumina_uyg_userdata;
+"""
+
+
+class Migration(migrations.Migration):
+
+ dependen... | |
e080c174e4430684856d8d5877c75fd15d5e0f48 | opps/core/management/commands/update_channel_denormalization.py | opps/core/management/commands/update_channel_denormalization.py | from django.core.management.base import BaseCommand, CommandError
from opps.channels.models import Channel
from opps.containers.models import ContainerBox
from opps.articles.models import Post
class Command(BaseCommand):
def handle(self, *args, **options):
models = [Channel, Post, ContainerBox]
f... | Add management command to denormalize channel and containers | Add management command to denormalize channel and containers
| Python | mit | YACOWS/opps,jeanmask/opps,jeanmask/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps,opps/opps,YACOWS/opps,opps/opps,opps/opps,YACOWS/opps,williamroot/opps,williamroot/opps,williamroot/opps,williamroot/opps | ---
+++
@@ -0,0 +1,12 @@
+from django.core.management.base import BaseCommand, CommandError
+from opps.channels.models import Channel
+from opps.containers.models import ContainerBox
+from opps.articles.models import Post
+
+
+class Command(BaseCommand):
+
+ def handle(self, *args, **options):
+ models = [C... | |
79ee7795135f9cba31aefdf9b752da24e98c6337 | graphing/classification_method_score_meandiffbar.py | graphing/classification_method_score_meandiffbar.py | #!/usr/bin/env python
# a bar plot with errorbars
import numpy as np
import matplotlib.pyplot as plt
# extract column of the dataset
data = np.genfromtxt('../data/sens_scores_difftable.csv',delimiter=',',dtype=None)
star_category = data[0,1:6]
diffmeans = data[1,1:6]
diffstd = data[2,1:6]
# or type in the d... | Create bar charts with error bars for foj sensitivity scores. | Create bar charts with error bars for foj sensitivity scores.
| Python | mit | Nodoka/Bioquality,Nodoka/Bioquality | ---
+++
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+# a bar plot with errorbars
+import numpy as np
+import matplotlib.pyplot as plt
+
+# extract column of the dataset
+data = np.genfromtxt('../data/sens_scores_difftable.csv',delimiter=',',dtype=None)
+star_category = data[0,1:6]
+diffmeans = data[1,1:6]
+diffstd ... | |
123a58bf7d09c804eb502220278ef9e1346538cd | netbox/extras/tests/test_models.py | netbox/extras/tests/test_models.py | from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from dcim.models import Site
from extras.choices import ExportTemplateLanguageChoices
from extras.models import Graph
class GraphTest(TestCase):
def setUp(self):
self.site = Site(name='Site 1', slug='site-1')
... | Add tests for Graph rendering | Add tests for Graph rendering
| Python | apache-2.0 | digitalocean/netbox,digitalocean/netbox,digitalocean/netbox,digitalocean/netbox | ---
+++
@@ -0,0 +1,46 @@
+from django.contrib.contenttypes.models import ContentType
+from django.test import TestCase
+
+from dcim.models import Site
+from extras.choices import ExportTemplateLanguageChoices
+from extras.models import Graph
+
+
+class GraphTest(TestCase):
+
+ def setUp(self):
+
+ self.site... | |
91503c4cd8afcfdf483bf7dbd3090e2b57e7ae5c | predictions2visualization-pairs.py | predictions2visualization-pairs.py | """Generate visualization pairs (emotion label - concept type) for predicted
labels.
Input: directory containing text files with predicted heem labels.
Generates a text file containing
<text_id>\t<sentence id>\t<emotion label>\t<concept type label>
for each file in the input dir.
Usage: python predictions2visualizat... | Add script to generate visualization pairs for predicted labels | Add script to generate visualization pairs for predicted labels
| Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,48 @@
+"""Generate visualization pairs (emotion label - concept type) for predicted
+labels.
+
+Input: directory containing text files with predicted heem labels.
+
+Generates a text file containing
+<text_id>\t<sentence id>\t<emotion label>\t<concept type label>
+for each file in the input dir.
+
... | |
ea8dabdceec103fc9aa7f3da665a08340a42f931 | src/util/batstack.py | src/util/batstack.py | #!/usr/bin/env python
"""
A collection of handy functions for the BatStack project.
Largely unsorted, but each function should have a decent docstring.
Scott Livingston <slivingston@caltech.edu>
Sep 2010.
"""
import sys
def read_chanmap( fname ):
"""Read plaintext channel map file.
Supports either manual o... | Create (beginnings of a) Python module for misc BatStack related functions. | Create (beginnings of a) Python module for misc BatStack related functions.
First method, read_chanmap, for reading plaintext files that specify
channel mappings, i.e. how local numbering maps to the global of an
entire Array system.
My planned style for batstack.py is to make it available primarily for
import into o... | Python | bsd-3-clause | slivingston/BatStack,slivingston/BatStack,slivingston/BatStack,slivingston/BatStack,slivingston/BatStack | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+"""
+A collection of handy functions for the BatStack project.
+
+Largely unsorted, but each function should have a decent docstring.
+
+
+Scott Livingston <slivingston@caltech.edu>
+Sep 2010.
+"""
+
+
+import sys
+
+
+def read_chanmap( fname ):
+ """Read plaintext... | |
7d9955c85bf48e57f1ed0a0e77a89df8bf95e6aa | froide/document/migrations/0025_auto_20210505_1720.py | froide/document/migrations/0025_auto_20210505_1720.py | # Generated by Django 3.1.8 on 2021-05-05 15:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('document', '0024_auto_20210323_1404'),
]
operations = [
migrations.AddField(
model_name='document',
name='data',
... | Add data/settings fields to document/collection | Add data/settings fields to document/collection | Python | mit | fin/froide,fin/froide,fin/froide,fin/froide | ---
+++
@@ -0,0 +1,23 @@
+# Generated by Django 3.1.8 on 2021-05-05 15:20
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('document', '0024_auto_20210323_1404'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name... | |
0e2317d1b2af7b88f626cefa7a1e187c5823eef7 | kolibri/logger/migrations/0004_tidy_progress_range.py | kolibri/logger/migrations/0004_tidy_progress_range.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-28 07:50
from __future__ import unicode_literals
from django.db import migrations
def tidy_progress_range(apps, schema_editor):
"""
Tidies progress ranges because a bug had caused them to go out of range
"""
ContentSessionLog = apps.get... | Add migration for tidying up old values in progress fields | Add migration for tidying up old values in progress fields
| Python | mit | DXCanas/kolibri,jonboiser/kolibri,lyw07/kolibri,mrpau/kolibri,learningequality/kolibri,mrpau/kolibri,learningequality/kolibri,jonboiser/kolibri,DXCanas/kolibri,indirectlylit/kolibri,benjaoming/kolibri,lyw07/kolibri,christianmemije/kolibri,lyw07/kolibri,DXCanas/kolibri,DXCanas/kolibri,lyw07/kolibri,mrpau/kolibri,benjaom... | ---
+++
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2018-03-28 07:50
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def tidy_progress_range(apps, schema_editor):
+ """
+ Tidies progress ranges because a bug had caused them to go out of range
+ ... | |
4f663ff7a7ee05163e2cbd819412cfa76001dee1 | stagecraft/apps/collectors/tasks.py | stagecraft/apps/collectors/tasks.py | from celery import shared_task
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
@shared_task
def log(message):
logger.info(message)
| Add simple task to test integration of celery | Add simple task to test integration of celery
This adds a very simple logging task that just dumps and argument out to
the log. This can be used to setup a periodic task that will show that
all of the workers (worker, beat and celerycam) are working in harmony.
| Python | mit | alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft | ---
+++
@@ -0,0 +1,9 @@
+from celery import shared_task
+from celery.utils.log import get_task_logger
+
+logger = get_task_logger(__name__)
+
+
+@shared_task
+def log(message):
+ logger.info(message) | |
ab017e9bbf0ffd19d9d8e5a933989e9111f00e77 | CodeFights/countBlackCells.py | CodeFights/countBlackCells.py | #!/usr/local/bin/python
# Code Fights Count Black Cells Problem
from fractions import gcd
def countBlackCells(m, n):
# Manhattan distance plus lattice points less 2 end points
return (m + n) + gcd(n, m) - 2
def main():
tests = [
[3, 4, 6],
[3, 3, 7],
[2, 5, 6],
[1, 1, 1]... | Solve Code Fights count black cells problem | Solve Code Fights count black cells problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/local/bin/python
+# Code Fights Count Black Cells Problem
+
+from fractions import gcd
+
+
+def countBlackCells(m, n):
+ # Manhattan distance plus lattice points less 2 end points
+ return (m + n) + gcd(n, m) - 2
+
+
+def main():
+ tests = [
+ [3, 4, 6],
+ [3, 3... | |
b1c02240b8c2b291d43c70100c517a6038a91de4 | tests/dags/test_external_task_sensor_fn_multiple_execution_dates_dags.py | tests/dags/test_external_task_sensor_fn_multiple_execution_dates_dags.py | from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.sensors import ExternalTaskSensor
from tests.operators.sensors import TEST_DAG_ID, DEFAULT_DATE
from datetime import datetime, timedelta
args = {'owner': 'a... | Add ability for ExternalTaskSensor to wait on multiple runs of a task | Add ability for ExternalTaskSensor to wait on multiple runs of a task
Currently using the execution_date_fn parameter of the ExternalTaskSensor
sensors only allows to wait for the completion of one given run of the
task the ExternalTaskSensor is sensing.
However, this prevents users to have setups where dags don't ha... | Python | apache-2.0 | yati-sagade/incubator-airflow,yati-sagade/incubator-airflow,yati-sagade/incubator-airflow,yati-sagade/incubator-airflow | ---
+++
@@ -0,0 +1,69 @@
+from airflow import DAG
+from airflow.operators.bash_operator import BashOperator
+from airflow.operators.dummy_operator import DummyOperator
+from airflow.operators.sensors import ExternalTaskSensor
+from tests.operators.sensors import TEST_DAG_ID, DEFAULT_DATE
+from datetime import datetim... | |
094deed52071e74225b8196079a34bda07230d39 | accelerator/migrations/0063_update_gender_criteria_to_full_gender_spec.py | accelerator/migrations/0063_update_gender_criteria_to_full_gender_spec.py | # Generated by Django 2.2.24 on 2021-07-01 20:17
from django.db import migrations
def update_criterion_specs(apps, schema_editor):
CriterionOptionSpec = apps.get_model("CriterionOptionSpec",
"accelerator")
CriterionOptionSpec.objects.filter(option="m").update(option="... | Add migration to use full gender spec | [AC-8797] Add migration to use full gender spec
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | ---
+++
@@ -0,0 +1,30 @@
+# Generated by Django 2.2.24 on 2021-07-01 20:17
+
+from django.db import migrations
+
+
+def update_criterion_specs(apps, schema_editor):
+ CriterionOptionSpec = apps.get_model("CriterionOptionSpec",
+ "accelerator")
+ CriterionOptionSpec.object... | |
1e41ce969b3162797ed8a47a4e52d448550481ae | src/functions/exercise6.py | src/functions/exercise6.py | # Write a function that print something n times
# including relatives spaces
def pprint(wyp, ntimes):
wyp = str(wyp) + " "
print wyp * ntimes
def main():
pprint(555, 24)
exit(0)
main() | Write a function that print something n times including relatives spaces | Write a function that print something n times including relatives spaces
| Python | mit | let42/python-course | ---
+++
@@ -0,0 +1,15 @@
+# Write a function that print something n times
+# including relatives spaces
+
+
+def pprint(wyp, ntimes):
+ wyp = str(wyp) + " "
+ print wyp * ntimes
+
+def main():
+
+ pprint(555, 24)
+
+ exit(0)
+
+main() | |
906072a29277bc1727271ac121886e5158085d03 | tests/functional/test_new_resolver_errors.py | tests/functional/test_new_resolver_errors.py | from tests.lib import create_basic_wheel_for_package
def test_new_resolver_conflict_requirements_file(tmpdir, script):
create_basic_wheel_for_package(script, "base", "1.0")
create_basic_wheel_for_package(script, "base", "2.0")
create_basic_wheel_for_package(
script, "pkga", "1.0", depends=["base==... | Test for conflict message from requirements.txt | Test for conflict message from requirements.txt
| Python | mit | pfmoore/pip,sbidoul/pip,pradyunsg/pip,pfmoore/pip,sbidoul/pip,pypa/pip,pypa/pip,pradyunsg/pip | ---
+++
@@ -0,0 +1,26 @@
+from tests.lib import create_basic_wheel_for_package
+
+
+def test_new_resolver_conflict_requirements_file(tmpdir, script):
+ create_basic_wheel_for_package(script, "base", "1.0")
+ create_basic_wheel_for_package(script, "base", "2.0")
+ create_basic_wheel_for_package(
+ scri... | |
7b098f1ca44aa7b149987cd2f16280e39a7d2040 | tests/sentry/lang/javascript/test_example.py | tests/sentry/lang/javascript/test_example.py | # coding: utf-8
from __future__ import absolute_import
import os
import json
import responses
from sentry.testutils import TestCase
from sentry.models import Event
def get_fixture_path(name):
return os.path.join(os.path.dirname(__file__), 'example-project', name)
def load_fixture(name):
with open(get_fix... | Add complete test for javascript sourcemap resolving | Add complete test for javascript sourcemap resolving
| Python | bsd-3-clause | gencer/sentry,gencer/sentry,looker/sentry,beeftornado/sentry,mvaled/sentry,ifduyue/sentry,mvaled/sentry,ifduyue/sentry,looker/sentry,gencer/sentry,ifduyue/sentry,looker/sentry,mvaled/sentry,gencer/sentry,mvaled/sentry,looker/sentry,ifduyue/sentry,beeftornado/sentry,beeftornado/sentry,gencer/sentry,mvaled/sentry,looker/... | ---
+++
@@ -0,0 +1,88 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+
+import os
+import json
+import responses
+
+from sentry.testutils import TestCase
+from sentry.models import Event
+
+
+def get_fixture_path(name):
+ return os.path.join(os.path.dirname(__file__), 'example-project', name)
+
+
+d... | |
88245c20019ca92caeeb16c05583e9d60b4d7b7f | assignment2/Replicator.py | assignment2/Replicator.py | # from slave1 import Slave1
# from slave2 import Slave2
import rocksdb
import encodings
# class Replica:
# def __init__(self):
# print("Decorator")
# def decorator(self, rep):
# def wrapper():
# key, value = rep()
# #if((slave1.Slave1.get(key))!=value):
# ... | Add File with decorator functions | Add File with decorator functions
| Python | mit | rimpybharot/CMPE273 | ---
+++
@@ -0,0 +1,70 @@
+# from slave1 import Slave1
+# from slave2 import Slave2
+
+import rocksdb
+import encodings
+
+
+
+# class Replica:
+
+# def __init__(self):
+# print("Decorator")
+
+# def decorator(self, rep):
+# def wrapper():
+
+# key, value = rep()
+
+# #i... | |
348536786d6194f0f23475427f96a5f5b69c0743 | heron/tools/cli/src/python/version.py | heron/tools/cli/src/python/version.py | # Copyright 2016 Twitter. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # Copyright 2016 Twitter. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | Add back a deleted newline. | Add back a deleted newline.
| Python | apache-2.0 | tomncooper/heron,tomncooper/heron,lewiskan/heron,streamlio/heron,twitter/heron,ashvina/heron,mycFelix/heron,twitter/heron,huijunwu/heron,lucperkins/heron,tomncooper/heron,tomncooper/heron,lucperkins/heron,srkukarni/heron,objmagic/heron,lewiskan/heron,lewiskan/heron,ashvina/heron,lucperkins/heron,streamlio/heron,huijunw... | ---
+++
@@ -15,6 +15,7 @@
from heron.tools.cli.src.python.response import Response, Status
import heron.tools.cli.src.python.args as cli_args
import heron.tools.common.src.python.utils.config as config
+
def create_parser(subparsers):
''' |
477db3854ce527cb410c5814ae8dfab1e6bef35b | ceph_deploy/tests/parser/test_mds.py | ceph_deploy/tests/parser/test_mds.py | import pytest
from ceph_deploy.cli import get_parser
class TestParserMDS(object):
def setup(self):
self.parser = get_parser()
def test_mds_help(self, capsys):
with pytest.raises(SystemExit):
self.parser.parse_args('mds --help'.split())
out, err = capsys.readouterr()
... | Add argparse tests for mds | [RM-11742] Add argparse tests for mds
Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
| Python | mit | trhoden/ceph-deploy,Vicente-Cheng/ceph-deploy,shenhequnying/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,branto1/ceph-deploy,branto1/ceph-deploy,shenhequnying/ceph-deploy,isyippee/ceph-deploy,SUSE/ceph-deploy,SUSE/ceph-deploy,imzhulei/ceph-deploy,trhoden/ceph-deploy,zhouyuan/ceph-deploy,osynge/ceph-deploy,osynge/ceph-dep... | ---
+++
@@ -0,0 +1,35 @@
+import pytest
+
+from ceph_deploy.cli import get_parser
+
+
+class TestParserMDS(object):
+
+ def setup(self):
+ self.parser = get_parser()
+
+ def test_mds_help(self, capsys):
+ with pytest.raises(SystemExit):
+ self.parser.parse_args('mds --help'.split())
+ ... | |
b455d767cd8f9c57fad4f9bc4b322952512bf2c3 | sensibility/_paths.py | sensibility/_paths.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright 2017 Eddie Antonio Santos <easantos@ualberta.ca>
#
# 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/licens... | Put internal paths in one place. | Put internal paths in one place.
| Python | apache-2.0 | naturalness/sensibility,naturalness/sensibility,naturalness/sensibility,naturalness/sensibility | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+
+# Copyright 2017 Eddie Antonio Santos <easantos@ualberta.ca>
+#
+# 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... | |
8cf9dba3bafacca6fd3170f3de31d111b8e52e39 | src/Mod/TemplatePyMod/SplineSurface.py | src/Mod/TemplatePyMod/SplineSurface.py |
# http://de.wikipedia.org/wiki/Non-Uniform_Rational_B-Spline
# len(knot_u) := nNodes_u + degree_u + 1
# len(knot_v) := nNodes_v + degree_v + 1
degree_u=2
degree_v=2
nNodes_u=5
nNodes_v=5
#knot_u=[0,0,0,0.3333,0.6666,1,1,1]
#knot_v=[0,0,0,0.3333,0.6666,1,1,1]
knot_u=[0,0,0,0.2,0.7,1,1,1]
knot_v=[0,0,0,0.2,0.7,1,1,1]
... | Add python example of how to use splines | Add python example of how to use splines
| Python | lgpl-2.1 | dsbrown/FreeCAD,maurerpe/FreeCAD,yantrabuddhi/FreeCAD,jriegel/FreeCAD,mickele77/FreeCAD,cpollard1001/FreeCAD_sf_master,cypsun/FreeCAD,thdtjsdn/FreeCAD,balazs-bamer/FreeCAD-Surface,timthelion/FreeCAD,wood-galaxy/FreeCAD,mickele77/FreeCAD,kkoksvik/FreeCAD,mickele77/FreeCAD,yantrabuddhi/FreeCAD,bblacey/FreeCAD-MacOS-CI,us... | ---
+++
@@ -0,0 +1,43 @@
+
+# http://de.wikipedia.org/wiki/Non-Uniform_Rational_B-Spline
+# len(knot_u) := nNodes_u + degree_u + 1
+# len(knot_v) := nNodes_v + degree_v + 1
+
+degree_u=2
+degree_v=2
+nNodes_u=5
+nNodes_v=5
+
+#knot_u=[0,0,0,0.3333,0.6666,1,1,1]
+#knot_v=[0,0,0,0.3333,0.6666,1,1,1]
+knot_u=[0,0,0,0.2,... | |
8cb59ab74717624f1f4acbacc496f9455d90a92c | ldb.py | ldb.py | #!/usr/bin/env python
from socket import socket, AF_UNIX, SOCK_STREAM
import os
s = socket(AF_UNIX, SOCK_STREAM)
s.bind('/tmp/socket_lua_debug')
s.listen(1)
lua = s.accept()[0]
print "Connected with Lua."
lua.recv(1024)
lua.close()
os.remove("/tmp/socket_lua_debug") # I don't know why it doesn't do it by itself.
| Add a basic server to go along with. | Add a basic server to go along with.
| Python | mit | laarmen/lua_debug,laarmen/lua_debug | ---
+++
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+from socket import socket, AF_UNIX, SOCK_STREAM
+import os
+
+s = socket(AF_UNIX, SOCK_STREAM)
+s.bind('/tmp/socket_lua_debug')
+s.listen(1)
+lua = s.accept()[0]
+print "Connected with Lua."
+lua.recv(1024)
+lua.close()
+
+os.remove("/tmp/socket_lua_debug") # I don't... | |
b196d5e58c611508bbc0bf891752d6abf135b67d | generic/example/manage.py | generic/example/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Make sure sys.path is setup correctly | Make sure sys.path is setup correctly
| Python | apache-2.0 | texastribune/tt_app_templates,texastribune/tt_app_templates | ---
+++
@@ -3,6 +3,7 @@
import sys
if __name__ == "__main__":
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
from django.core.management import execute_from_command_line |
e361aadf64ea10ec337c349e182608ab3a305dcf | share/management/commands/makeprovidermigrations.py | share/management/commands/makeprovidermigrations.py | import os
from django.apps import apps
from django.db.migrations.state import ProjectState
from django.core.management.base import BaseCommand
from django.db.migrations.loader import MigrationLoader
from django.db.migrations.writer import MigrationWriter
from django.db.migrations.autodetector import MigrationAutodetec... | Add a command to create provider migrations | Add a command to create provider migrations
| Python | apache-2.0 | laurenbarker/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE,zamattiac/SHARE,CenterForOpenScience/SHARE,aaxelb/SHARE,aaxelb/SHARE,laurenbarker/SHARE,zamattiac/SHARE,CenterForOpenScience/SHARE,zamattiac/SHARE,aaxelb/SHARE | ---
+++
@@ -0,0 +1,42 @@
+import os
+
+from django.apps import apps
+from django.db.migrations.state import ProjectState
+from django.core.management.base import BaseCommand
+from django.db.migrations.loader import MigrationLoader
+from django.db.migrations.writer import MigrationWriter
+from django.db.migrations.aut... | |
f1b4309cd515ac2c689026c10f025dff92c6504e | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import inflection
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='inflection',
version=inflection.__version__,
description="A port of Ruby on Rails inflector to Python",
long_description=open('R... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import inflection
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='inflection',
version=inflection.__version__,
description="A port of Ruby on Rails inflector to Python",
long_description=open('R... | Update development status to beta | Update development status to beta
| Python | mit | ascott1/inflection,SiviVuk/inflection,willbarton/inflection,panvagenas/inflection,jpvanhal/inflection | ---
+++
@@ -22,7 +22,7 @@
py_modules=['inflection'],
zip_safe=False,
classifiers=(
- 'Development Status :: 3 - Alpha',
+ 'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: MIT License'... |
ae928afd0752c9f66b3b6701f67502013f2869ca | cla_backend/apps/legalaid/management/commands/recalculate_assigned_out_of_hours.py | cla_backend/apps/legalaid/management/commands/recalculate_assigned_out_of_hours.py | from django.conf import settings
from django.core.management import BaseCommand, CommandError
from django.utils import timezone
from legalaid.models import Case
class Command(BaseCommand):
help = "Recalculate case.assigned_out_of_hours since a given date"
def handle(self, *args, **options):
try:
... | Add management command to recalculate the field | Add management command to recalculate the field
| Python | mit | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | ---
+++
@@ -0,0 +1,50 @@
+from django.conf import settings
+from django.core.management import BaseCommand, CommandError
+from django.utils import timezone
+
+from legalaid.models import Case
+
+
+class Command(BaseCommand):
+ help = "Recalculate case.assigned_out_of_hours since a given date"
+
+ def handle(sel... | |
394bc87de8eb4903e53f1158d88471bcefc56aa9 | alembic/versions/a9ecd1c767_add_pro_field_to_user_table.py | alembic/versions/a9ecd1c767_add_pro_field_to_user_table.py | """add pro field to user table
Revision ID: a9ecd1c767
Revises: 66594a9866c
Create Date: 2014-11-05 10:31:37.734790
"""
# revision identifiers, used by Alembic.
revision = 'a9ecd1c767'
down_revision = '66594a9866c'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('user', sa.Column('... | Add migration to add pro users. | Add migration to add pro users.
| Python | agpl-3.0 | jean/pybossa,PyBossa/pybossa,geotagx/pybossa,geotagx/pybossa,jean/pybossa,stefanhahmann/pybossa,inteligencia-coletiva-lsd/pybossa,OpenNewsLabs/pybossa,stefanhahmann/pybossa,inteligencia-coletiva-lsd/pybossa,Scifabric/pybossa,Scifabric/pybossa,OpenNewsLabs/pybossa,PyBossa/pybossa | ---
+++
@@ -0,0 +1,24 @@
+"""add pro field to user table
+
+Revision ID: a9ecd1c767
+Revises: 66594a9866c
+Create Date: 2014-11-05 10:31:37.734790
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'a9ecd1c767'
+down_revision = '66594a9866c'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgr... | |
6c479cb382ec76be3910b1f8c1c71b0a8a4e26c7 | tests/continous-failure.py | tests/continous-failure.py | #!/usr/bin/env python
# Both have a very small chance of occuring
from twisted.internet import reactor
from mesh import Mesh, MeshNode, packet_type, BYE, DATA
import sys
NUMNODES = 2
DELAY = 0.1
m = Mesh()
class TestMeshNode(MeshNode):
def newNode (self, data):
MeshNode.newNode (self, data)
print data +... | Add a test continously failing one node, causing group split and reconnects | Add a test continously failing one node, causing group split and reconnects
20071126190126-93b9a-a75d8096a67cfd837b21cb9c6b20eec234993a90.gz
| Python | lgpl-2.1 | freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+# Both have a very small chance of occuring
+
+from twisted.internet import reactor
+from mesh import Mesh, MeshNode, packet_type, BYE, DATA
+import sys
+
+NUMNODES = 2
+DELAY = 0.1
+
+m = Mesh()
+
+class TestMeshNode(MeshNode):
+
+ def newNode (self, data):
+ Me... | |
dc9c71cdfdcfec88f90d83111d159a9926c2191f | tests/create_references.py | tests/create_references.py | #! /usr/bin/env python
import os
from cyclus_tools import run_cyclus
from tests_list import sim_files
def main():
"""Creates reference databases. Assumes that cyclus is included into PATH.
"""
cwd = os.getcwd()
# Run cyclus
run_cyclus("cyclus", cwd, sim_files)
if __name__ == "__main__": main()
| Add script to create reference output databases | Add script to create reference output databases
| Python | bsd-3-clause | gonuke/cycamore,jlittell/cycamore,gonuke/cycamore,rwcarlsen/cycamore,cyclus/cycaless,rwcarlsen/cycamore,Baaaaam/cyCLASS,Baaaaam/cyCLASS,rwcarlsen/cycamore,Baaaaam/cycamore,cyclus/cycaless,Baaaaam/cyBaM,jlittell/cycamore,gonuke/cycamore,Baaaaam/cyBaM,rwcarlsen/cycamore,Baaaaam/cyBaM,jlittell/cycamore,Baaaaam/cyBaM,gonuk... | ---
+++
@@ -0,0 +1,16 @@
+#! /usr/bin/env python
+
+import os
+
+from cyclus_tools import run_cyclus
+from tests_list import sim_files
+
+def main():
+ """Creates reference databases. Assumes that cyclus is included into PATH.
+ """
+ cwd = os.getcwd()
+
+ # Run cyclus
+ run_cyclus("cyclus", cwd, sim_f... | |
26450ba129b16d5a6c8a660e8df21c1d016903c4 | setup.py | setup.py | import sys
from setuptools import find_packages, setup
VERSION = '2.0.dev0'
install_requires = [
'django-local-settings>=1.0a10',
'stashward',
]
if sys.version_info[:2] < (3, 4):
install_requires.append('enum34')
setup(
name='django-arcutils',
version=VERSION,
url='https://github.com/PSU... | import sys
from setuptools import find_packages, setup
VERSION = '2.0.dev0'
install_requires = [
'django-local-settings>=1.0a10',
'stashward',
]
if sys.version_info[:2] < (3, 4):
install_requires.append('enum34')
setup(
name='django-arcutils',
version=VERSION,
url='https://github.com/PSU... | Upgrade ldap3 0.9.9.1 => 0.9.9.2 | Upgrade ldap3 0.9.9.1 => 0.9.9.2
| Python | mit | wylee/django-arcutils,PSU-OIT-ARC/django-arcutils,wylee/django-arcutils,PSU-OIT-ARC/django-arcutils | ---
+++
@@ -31,7 +31,7 @@
'django-cas-client>=1.2.0',
],
'ldap': [
- 'ldap3>=0.9.9.1',
+ 'ldap3>=0.9.9.2',
],
'dev': [
'django>=1.7', |
dfe5f213efd523891d77a8f390c690324f7bbb45 | scripts/add_all_users_to_instances.py | scripts/add_all_users_to_instances.py | #!/usr/bin/env python
"""Add all users into the instances given on the command line.
"""
import os
import sys
from argparse import ArgumentParser
from paste.deploy import appconfig
from adhocracy.config.environment import load_environment
from adhocracy import model
def load_config(filename):
conf = appconfig('c... | Add a command line script to ad all users to instances | Add a command line script to ad all users to instances
| Python | agpl-3.0 | DanielNeugebauer/adhocracy,phihag/adhocracy,liqd/adhocracy,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,alkadis/vcv,SysTheron/adhocracy,SysTheron/adhocracy,liqd/adhocracy,phihag/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,phihag/adhocracy,DanielNeugebauer/adhocracy,liqd/adhocracy,liqd/adhocracy,phihag/adh... | ---
+++
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+"""Add all users into the instances given on the command line.
+"""
+import os
+import sys
+from argparse import ArgumentParser
+
+from paste.deploy import appconfig
+from adhocracy.config.environment import load_environment
+from adhocracy import model
+
+
+def load_c... | |
0628d8df0eb59e1b47d8bc01cb9c3bd566829d6e | beetsplug/embedcoverart.py | beetsplug/embedcoverart.py | from beets.plugins import BeetsPlugin
from beets import mediafile
import os, logging
from email.mime.image import MIMEImage
log = logging.getLogger('beets')
log.addHandler(logging.StreamHandler())
class EmbedAlbumartPlugin(BeetsPlugin):
'''Allows albumart to be embedded into the actual files'''
def __init... | Add initial version of the embed coverart plugin. | Add initial version of the embed coverart plugin.
This plugin allows users to embed the cover into the audio file.
Probaly still has a few bugs but it should work in most cases right
now.
| Python | mit | ruippeixotog/beets,dfc/beets,mried/beets,arabenjamin/beets,krig/beets,ibmibmibm/beets,jackwilsdon/beets,asteven/beets,sampsyo/beets,asteven/beets,Kraymer/beets,beetbox/beets,Andypsamp/CODfinalJUNIT,jackwilsdon/beets,Wen777/beets,krig/beets,swt30/beets,YetAnotherNerd/beets,shamangeorge/beets,artemutin/beets,drm00/beets,... | ---
+++
@@ -0,0 +1,45 @@
+from beets.plugins import BeetsPlugin
+from beets import mediafile
+
+import os, logging
+
+from email.mime.image import MIMEImage
+
+log = logging.getLogger('beets')
+log.addHandler(logging.StreamHandler())
+
+
+class EmbedAlbumartPlugin(BeetsPlugin):
+ '''Allows albumart to be embedded ... | |
13fc24f18f0b86781aa96deb95d4d8fa2cfc1706 | KMeans.py | KMeans.py | import numpy as np
class KMeans(object):
def __init__(self, inputs, clusters):
self.inputs = np.array(inputs)
if self.inputs.ndim == 1:
self.inputs = self.inputs.reshape(self.inputs.shape[0], 1)
self.test_cases = self.inputs.shape[0]
self.num_clusters = clusters
self.clusters = self.inputs[np.random.cho... | Add K Means clustering algorithm | Add K Means clustering algorithm
| Python | mit | prasanna08/MachineLearning | ---
+++
@@ -0,0 +1,33 @@
+import numpy as np
+
+class KMeans(object):
+ def __init__(self, inputs, clusters):
+ self.inputs = np.array(inputs)
+ if self.inputs.ndim == 1:
+ self.inputs = self.inputs.reshape(self.inputs.shape[0], 1)
+
+ self.test_cases = self.inputs.shape[0]
+ self.num_clusters = clusters
+ sel... | |
4561811f536e887cb1fda331bee813ed313cbef8 | custom/icds/management/commands/find_cases_with_no_delivery.py | custom/icds/management/commands/find_cases_with_no_delivery.py | from __future__ import absolute_import
from __future__ import unicode_literals
import csv
from django.core.management import BaseCommand
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from corehq.form_processor.models import CommCareCaseSQL
from corehq.sql_db.util import get_db_aliases_for_pa... | Add management command to find ccs record cases without delivery form | Add management command to find ccs record cases without delivery form
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,71 @@
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
+import csv
+
+from django.core.management import BaseCommand
+
+from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
+from corehq.form_processor.models import CommCareCaseSQL
+from corehq.sql... | |
69a07d161295e217324d28948b1d565e2170e636 | app/error.py | app/error.py | import six
class AppError(Exception):
"""App exception"""
def __init__(self, reason, response=None):
self.reason = six.text_type(reason)
self.response = response
Exception.__init__(self, reason)
def __str__(self):
return self.reason
| Add class to raise app exceptions | Add class to raise app exceptions
| Python | mit | rebearteta/social-ideation,joausaga/social-ideation,rebearteta/social-ideation,rebearteta/social-ideation,joausaga/social-ideation,joausaga/social-ideation,joausaga/social-ideation,rebearteta/social-ideation | ---
+++
@@ -0,0 +1,13 @@
+import six
+
+class AppError(Exception):
+ """App exception"""
+
+ def __init__(self, reason, response=None):
+ self.reason = six.text_type(reason)
+ self.response = response
+ Exception.__init__(self, reason)
+
+ def __str__(self):
+ return self.reason
+ | |
ff0fc074972adad68173a44866343156696660f3 | microlab_instruments/base_classes.py | microlab_instruments/base_classes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import aardvark
import numpy as gpib
import scipy as serial
import socket
class Instrument(object):
def __init__(self):
pass
def write(self):
pass
def read(self):
pass
def ask(self, scpi_string):
self.write(scpi_string)
... | Add placeholders for base classes | Add placeholders for base classes
| Python | bsd-3-clause | kitmonisit/microlab-instruments | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import aardvark
+import numpy as gpib
+import scipy as serial
+import socket
+
+class Instrument(object):
+ def __init__(self):
+ pass
+
+ def write(self):
+ pass
+
+ def read(self):
+ pass
+
+ def ask(self, s... | |
c6a0fe7c4e5046154beda2e2e60fdf5a20b34f95 | Cura/plugins/pauseAtZ.py | Cura/plugins/pauseAtZ.py | #Name: Pause at height
#Info: Pause the printer at a certain height
#Depend: GCode
#Type: postprocess
#Param: pauseLevel(float:5.0) Pause height (mm)
#Param: parkX(float:190) Head park X (mm)
#Param: parkY(float:190) Head park Y (mm)
#Param: retractAmount(float:5) Retraction amount (mm)
import re
def getValue(line, k... | Add pauze at height plugin. | Add pauze at height plugin.
| Python | agpl-3.0 | MolarAmbiguity/OctoPrint,nickverschoor/OctoPrint,shohei/Octoprint,madhuni/AstroBox,ErikDeBruijn/OctoPrint,shohei/Octoprint,AstroPrint/AstroBox,Mikk36/OctoPrint,shohei/Octoprint,beeverycreative/BEEweb,CapnBry/OctoPrint,mayoff/OctoPrint,MaxOLydian/OctoPrint,EZ3-India/EZ-Remote,mcanes/OctoPrint,markwal/OctoPrint,masterhou... | ---
+++
@@ -0,0 +1,55 @@
+#Name: Pause at height
+#Info: Pause the printer at a certain height
+#Depend: GCode
+#Type: postprocess
+#Param: pauseLevel(float:5.0) Pause height (mm)
+#Param: parkX(float:190) Head park X (mm)
+#Param: parkY(float:190) Head park Y (mm)
+#Param: retractAmount(float:5) Retraction amount (m... | |
87ac04769baef5dd9e93cf72def19126012b94c7 | backend/breach/tests/test_views.py | backend/breach/tests/test_views.py | from django.test import Client, TestCase
from django.core.urlresolvers import reverse
from breach.models import Target
from breach.views import VictimListView
import json
class ViewsTestCase(TestCase):
def setUp(self):
self.client = Client()
self.target1 = Target.objects.create(
name=... | Add test for /target post | Add test for /target post
| Python | mit | dionyziz/rupture,esarafianou/rupture,dimriou/rupture,esarafianou/rupture,dionyziz/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dimriou/rupture,dionyziz/rupture,esarafianou/rupture,dimkarakostas/rupture,dimriou/rupture,dimkarakostas/rupture,dimriou/rupture,dionyziz/rupture,esarafianou/rupture,dimriou/rupture,dion... | ---
+++
@@ -0,0 +1,74 @@
+from django.test import Client, TestCase
+from django.core.urlresolvers import reverse
+from breach.models import Target
+from breach.views import VictimListView
+import json
+
+
+class ViewsTestCase(TestCase):
+ def setUp(self):
+ self.client = Client()
+
+ self.target1 = T... | |
acd5ab934394a8673439cafa01dba14b051b4250 | Lib/test/curses_tests.py | Lib/test/curses_tests.py | #!/usr/bin/env python
#
# $Id: ncurses.py 36559 2004-07-18 05:56:09Z tim_one $
#
# Interactive test suite for the curses module.
# This script displays various things and the user should verify whether
# they display correctly.
#
import curses
from curses import textpad
def test_textpad(stdscr, insert_mode=False):
... | Add an interactive test script for exercising curses | Add an interactive test script for exercising curses
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# $Id: ncurses.py 36559 2004-07-18 05:56:09Z tim_one $
+#
+# Interactive test suite for the curses module.
+# This script displays various things and the user should verify whether
+# they display correctly.
+#
+
+import curses
+from curses import textpad
+
+def tes... | |
7502d1a9b41f7c6978ace6f48577900ec1bc8a3c | Python/well_generator.py | Python/well_generator.py | #! /usr/bin/env python3
import argparse
import string
def main(args):
rows = string.ascii_uppercase[:8]
cols = range(1, 13)
if args.r:
wells = [(r, c) for r in rows for c in cols]
else:
wells = [(r, c) for c in cols for r in rows]
if args.p:
fstr = "{}{:02d}"
else:
... | Add simple script to generate plate labels | Add simple script to generate plate labels
| Python | apache-2.0 | jgruselius/misc,jgruselius/misc,jgruselius/misc,jgruselius/misc,jgruselius/misc | ---
+++
@@ -0,0 +1,36 @@
+#! /usr/bin/env python3
+
+import argparse
+import string
+
+def main(args):
+ rows = string.ascii_uppercase[:8]
+ cols = range(1, 13)
+ if args.r:
+ wells = [(r, c) for r in rows for c in cols]
+ else:
+ wells = [(r, c) for c in cols for r in rows]
+ if args.p:
... | |
2f34973ff41c868c6102f6faf6952f2ea87e7895 | server/proposal/migrations/0025_set_proposal_updated.py | server/proposal/migrations/0025_set_proposal_updated.py | from django.db import models, migrations
def set_updated(apps, schema_editor):
Proposal = apps.get_model("proposal", "Proposal")
db_alias = schema_editor.connection.alias
proposals = Proposal.objects.using(db_alias).all()
for prop in proposals:
prop.updated = prop.modified
prop.save()
... | Use 'modified' field as default for 'updated' | Use 'modified' field as default for 'updated'
| Python | mit | codeforboston/cornerwise,codeforboston/cornerwise,cityofsomerville/cornerwise,codeforboston/cornerwise,cityofsomerville/citydash,cityofsomerville/citydash,cityofsomerville/cornerwise,codeforboston/cornerwise,cityofsomerville/citydash,cityofsomerville/cornerwise,cityofsomerville/citydash,cityofsomerville/cornerwise | ---
+++
@@ -0,0 +1,22 @@
+from django.db import models, migrations
+
+def set_updated(apps, schema_editor):
+ Proposal = apps.get_model("proposal", "Proposal")
+ db_alias = schema_editor.connection.alias
+ proposals = Proposal.objects.using(db_alias).all()
+
+ for prop in proposals:
+ prop.updated ... | |
4570ce14333ebc0bae3e09a59f28d7170cfc4621 | dci/alembic/versions/b58867f72568_add_feeder_role.py | dci/alembic/versions/b58867f72568_add_feeder_role.py | #
# Copyright (C) 2017 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | Add the feeder role in the ROLES table | Feeder: Add the feeder role in the ROLES table
Change-Id: I4c09e0a5e7d08975602a683f4cecbf993cdec4ba
| Python | apache-2.0 | redhat-cip/dci-control-server,enovance/dci-control-server,redhat-cip/dci-control-server,enovance/dci-control-server | ---
+++
@@ -0,0 +1,77 @@
+#
+# Copyright (C) 2017 Red Hat, 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 ... | |
cd735fe688840c94cb92562e3b96d51ec48afe44 | openstack/tests/functional/network/v2/test_security_group_rule.py | openstack/tests/functional/network/v2/test_security_group_rule.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add functional tests for security group rule | Add functional tests for security group rule
Tests:
test_find
test_get
test_list
Change-Id: If54342ec8c57b926a5217d888a43dcd98223bd69
| Python | apache-2.0 | dudymas/python-openstacksdk,dudymas/python-openstacksdk,dtroyer/python-openstacksdk,dtroyer/python-openstacksdk,mtougeron/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-opensta... | ---
+++
@@ -0,0 +1,69 @@
+# 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... | |
43d5041c09caadd7bd67195ba7519e8ef006f506 | corehq/pillows/group.py | corehq/pillows/group.py | from corehq.apps.groups.models import Group
from corehq.pillows.mappings.group_mapping import GROUP_INDEX, GROUP_MAPPING
from dimagi.utils.decorators.memoized import memoized
from pillowtop.listener import AliasedElasticPillow
from django.conf import settings
class GroupPillow(AliasedElasticPillow):
"""
Simpl... | from corehq.apps.groups.models import Group
from corehq.pillows.mappings.group_mapping import GROUP_INDEX, GROUP_MAPPING
from dimagi.utils.decorators.memoized import memoized
from pillowtop.listener import AliasedElasticPillow
from django.conf import settings
class GroupPillow(HQPillow):
"""
Simple/Common Cas... | Switch over to extend HQPillow | Switch over to extend HQPillow
| Python | bsd-3-clause | qedsoftware/commcare-hq,puttarajubr/commcare-hq,gmimano/commcaretest,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,gmi... | ---
+++
@@ -5,63 +5,15 @@
from django.conf import settings
-class GroupPillow(AliasedElasticPillow):
+class GroupPillow(HQPillow):
"""
Simple/Common Case properties Indexer
"""
document_class = Group
couch_filter = "groups/all_groups"
- es_host = settings.ELASTICSEARCH_HOST
- es_... |
3bf3813ed03f755d7aa777fc023add5c51a54311 | tests/test_sqlalchemy_create_table.py | tests/test_sqlalchemy_create_table.py | # -*- coding: utf-8; -*-
import re
from sqlalchemy import Column, Integer, MetaData, String, Table
from sqlalchemy.sql.ddl import CreateTable
from pyathena.sqlalchemy_athena import AthenaDialect
def test_create_table():
# Given
table = Table('table_name', MetaData(), Column('column_name', String))
diale... | Add failing test showing the issue | Add failing test showing the issue
Relates to issue #258.
| Python | mit | laughingman7743/PyAthena | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8; -*-
+import re
+
+from sqlalchemy import Column, Integer, MetaData, String, Table
+from sqlalchemy.sql.ddl import CreateTable
+
+from pyathena.sqlalchemy_athena import AthenaDialect
+
+
+def test_create_table():
+ # Given
+ table = Table('table_name', MetaData(), C... | |
661647cfe4d7c1229f1f719cddf42b6c052e4b79 | scripts/write_names.py | scripts/write_names.py | import json
names = list()
with open("viruses.json", "r") as f:
names = [virus["name"] for virus in json.load(f)]
names = sorted(names)
with open("names.txt", "w") as f:
f.write("\n".join(names)) | Add script for writing virus names to txt file | Add script for writing virus names to txt file
| Python | mit | virtool/virtool-database | ---
+++
@@ -0,0 +1,12 @@
+import json
+
+names = list()
+
+with open("viruses.json", "r") as f:
+ names = [virus["name"] for virus in json.load(f)]
+
+
+names = sorted(names)
+
+with open("names.txt", "w") as f:
+ f.write("\n".join(names)) | |
ea893b3ed7c42522720cd98a0a98a397accd9e07 | scripts/test-env.py | scripts/test-env.py | """
This script tests whether the current environment works correctly or not.
"""
import sys; sys.path.insert(0, '../geoplot/')
import geoplot as gplt
from geoplot import crs as gcrs
import geopandas as gpd
# cf. https://github.com/Toblerity/Shapely/issues/435
# Fiona/Shapely/Geopandas test.
cities = gpd.read_file(... | Add test script for environment. | Add test script for environment.
| Python | mit | ResidentMario/geoplot | ---
+++
@@ -0,0 +1,19 @@
+"""
+This script tests whether the current environment works correctly or not.
+"""
+
+import sys; sys.path.insert(0, '../geoplot/')
+import geoplot as gplt
+from geoplot import crs as gcrs
+import geopandas as gpd
+
+
+# cf. https://github.com/Toblerity/Shapely/issues/435
+
+# Fiona/Shapely... | |
80a9cc1ed5bed794769a511a4c2bf0070821ab7d | tests/serio/test_messages.py | tests/serio/test_messages.py | import unittest
from meshnet.serio.messages import SerialMessage, MessageType
KEY = b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
class TestSerialMessage(unittest.TestCase):
def test_serialize(self):
message = SerialMessage(0, 1, MessageType.booted, None, 12, 1, b"jsif")
self.ass... | Add simple unittests for serio message | Add simple unittests for serio message
Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>
| Python | bsd-3-clause | janLo/automation_mesh,janLo/automation_mesh,janLo/automation_mesh | ---
+++
@@ -0,0 +1,21 @@
+import unittest
+
+from meshnet.serio.messages import SerialMessage, MessageType
+
+KEY = b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
+
+
+class TestSerialMessage(unittest.TestCase):
+ def test_serialize(self):
+ message = SerialMessage(0, 1, MessageType.booted, N... | |
889a70cd8bb9d7e063a8248bab3de958e697d9ae | tests/test_wonderful_bing.py | tests/test_wonderful_bing.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from os import path
import mock
import pytest
from wonderful_bing.wonderful_bing import WonderfulBing
def test_picture_has_be_downloaded():
with mock.patch('os.path.exists', return_value=True):
with pytest.r... | Add test for WonderfulBing class | Add test for WonderfulBing class
| Python | mit | lord63/wonderful_bing | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import absolute_import
+
+import os
+from os import path
+
+import mock
+import pytest
+
+from wonderful_bing.wonderful_bing import WonderfulBing
+
+
+def test_picture_has_be_downloaded():
+ with mock.patch('os.path.exists'... | |
9950d25a2659509c81c29f9d834dd6c39e8b4015 | scripts/blog_image_refactor.py | scripts/blog_image_refactor.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
ROOT_FOLDER = '/home/mjulian/coding/figarocorso.github.io/'
POST_FOLDER = ROOT_FOLDER + '_posts/day-by-day/'
IMAGE_FOLDER = ROOT_FOLDER + 'images/blog/'
def get_file_lines(filename):
with open(POST_FOLDER + filename) as f:
return f.readlines()
def g... | Add image url replacement script | Add image url replacement script
| Python | mit | figarocorso/figarocorso.github.io,figarocorso/figarocorso.github.io,figarocorso/figarocorso.github.io,figarocorso/figarocorso.github.io | ---
+++
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import os
+
+
+ROOT_FOLDER = '/home/mjulian/coding/figarocorso.github.io/'
+POST_FOLDER = ROOT_FOLDER + '_posts/day-by-day/'
+IMAGE_FOLDER = ROOT_FOLDER + 'images/blog/'
+
+
+def get_file_lines(filename):
+ with open(POST_FOLDER + filename) as... | |
ed7570acc307207b96e1df848edbeef104230179 | material/admin/modules.py | material/admin/modules.py | from karenina import modules
class Admin(modules.InstallableModule):
icon = "mdi-action-settings-applications"
order = 1000
@property
def label(self):
return 'Administration'
def has_perm(self, user):
return user.is_staff | Add module declaration for karenina | Add module declaration for karenina
| Python | bsd-3-clause | afifnz/django-material,2947721120/django-material,thiagoramos-luizalabs/django-material,un33k/django-material,Axelio/django-material,thiagoramos-luizalabs/django-material,Axelio/django-material,sourabhdattawad/django-material,viewflow/django-material,afifnz/django-material,MonsterKiller/django-material,koopauy/django-m... | ---
+++
@@ -0,0 +1,13 @@
+from karenina import modules
+
+
+class Admin(modules.InstallableModule):
+ icon = "mdi-action-settings-applications"
+ order = 1000
+
+ @property
+ def label(self):
+ return 'Administration'
+
+ def has_perm(self, user):
+ return user.is_staff | |
cc52901c65480a4a3662f5302b2b2a92832a3dd5 | python/reverse-a-linked-list.py | python/reverse-a-linked-list.py | #!/bin/python3
import math
import os
import random
import re
import sys
class SinglyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
class SinglyLinkedList:
def __init__(self):
self.head = None
self.tail = None
def insert_node(self, no... | Solve reverse a linked list | Solve reverse a linked list
| Python | mit | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | ---
+++
@@ -0,0 +1,79 @@
+#!/bin/python3
+
+import math
+import os
+import random
+import re
+import sys
+
+class SinglyLinkedListNode:
+ def __init__(self, node_data):
+ self.data = node_data
+ self.next = None
+
+class SinglyLinkedList:
+ def __init__(self):
+ self.head = None
+ se... | |
82e3f0d72f6d334108c4777c0e4906d258c9efc6 | apps/network/tests/test_routes/test_users.py | apps/network/tests/test_routes/test_users.py |
def test_create_user(client):
result = client.post("/users/", data={"username": "test", "password": "1234"})
assert result.status_code == 200
assert result.get_json() == {"msg": "User created succesfully!"}
def test_get_all_users(client):
result = client.get("/users/")
assert result.status_code ==... | ADD Network users unit tests | ADD Network users unit tests
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | ---
+++
@@ -0,0 +1,44 @@
+
+def test_create_user(client):
+ result = client.post("/users/", data={"username": "test", "password": "1234"})
+ assert result.status_code == 200
+ assert result.get_json() == {"msg": "User created succesfully!"}
+
+def test_get_all_users(client):
+ result = client.get("/users/... | |
58221f7915d6f22e882e2094df57aa47840b23a6 | tests/grammar_creation_test/TerminalAdding.py | tests/grammar_creation_test/TerminalAdding.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import *
class TerminalAddingTest(TestCase):
pass
if __name__ == '__main__':
main() | Create class for terminal adding test when gramar is create | Create class for terminal adding test when gramar is create
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 23.06.2017 16:39
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from unittest import TestCase, main
+from grammpy import *
+
+
+class TerminalAddingTest(TestCase):
+ pass
+
+
+if __name__ == '__main__':
+ main() | |
522918a2edd8c664771cc8dde2c4e91174ff83f7 | sympy/utilities/tests/test_exceptions.py | sympy/utilities/tests/test_exceptions.py | import warnings
from sympy.core.decorators import deprecated
from sympy.utilities.exceptions import SymPyDeprecationWarning
def test_deprecated():
@deprecated(useinstead="bar", issue=1234, deprecated_since_version="0.7.2")
def foo():
return
with warnings.catch_warnings(record=True) as w:
... | Add coverage test for "deprecated" decorater | Add coverage test for "deprecated" decorater
| Python | bsd-3-clause | diofant/diofant,skirpichev/omg | ---
+++
@@ -0,0 +1,20 @@
+import warnings
+
+from sympy.core.decorators import deprecated
+from sympy.utilities.exceptions import SymPyDeprecationWarning
+
+
+def test_deprecated():
+ @deprecated(useinstead="bar", issue=1234, deprecated_since_version="0.7.2")
+ def foo():
+ return
+
+ with warnings.ca... | |
57f20289f942489c961ccbc9f7f8c5c3f2cb8c83 | test/widgets/test_cpu.py | test/widgets/test_cpu.py | # Copyright (c) 2021 elParaguayo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | Add test for CPU widget | Add test for CPU widget
| Python | mit | qtile/qtile,qtile/qtile,ramnes/qtile,ramnes/qtile | ---
+++
@@ -0,0 +1,70 @@
+# Copyright (c) 2021 elParaguayo
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy... | |
224c7487e8f8f7b19fe81b02b60a72ce5b2cc12f | find_params.py | find_params.py | import asl
from sklearn.cross_validation import train_test_split
from sklearn.grid_search import GridSearchCV
from sklearn.metrics import classification_report
from sklearn.svm import SVC
n_samples = len(asl.data)
X = asl.data
y = asl.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5,
... | Add script to find parameters for SVC | Add script to find parameters for SVC
| Python | mit | ssaamm/sign-language-translator,ssaamm/sign-language-tutor,ssaamm/sign-language-translator,ssaamm/sign-language-tutor | ---
+++
@@ -0,0 +1,26 @@
+import asl
+
+from sklearn.cross_validation import train_test_split
+from sklearn.grid_search import GridSearchCV
+from sklearn.metrics import classification_report
+from sklearn.svm import SVC
+
+n_samples = len(asl.data)
+X = asl.data
+y = asl.target
+
+X_train, X_test, y_train, y_test = t... | |
9eb265fa2142b559b15063bc9322fc60b46a300b | mezzanine/project_template/deploy/gunicorn.conf.py | mezzanine/project_template/deploy/gunicorn.conf.py | from __future__ import unicode_literals
import os
bind = "127.0.0.1:%(gunicorn_port)s"
workers = (os.sysconf("SC_NPROCESSORS_ONLN") * 2) + 1
loglevel = "error"
proc_name = "%(proj_name)s"
| from __future__ import unicode_literals
import multiprocessing
bind = "127.0.0.1:%(gunicorn_port)s"
workers = multiprocessing.cpu_count() * 2 + 1
loglevel = "error"
proc_name = "%(proj_name)s"
| Update to use multiprocessing library | Update to use multiprocessing library | Python | bsd-2-clause | promil23/mezzanine,damnfine/mezzanine,Cajoline/mezzanine,stephenmcd/mezzanine,agepoly/mezzanine,damnfine/mezzanine,mush42/mezzanine,eino-makitalo/mezzanine,mush42/mezzanine,stephenmcd/mezzanine,stephenmcd/mezzanine,emile2016/mezzanine,frankier/mezzanine,promil23/mezzanine,readevalprint/mezzanine,webounty/mezzanine,dovy... | ---
+++
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
-import os
+import multiprocessing
bind = "127.0.0.1:%(gunicorn_port)s"
-workers = (os.sysconf("SC_NPROCESSORS_ONLN") * 2) + 1
+workers = multiprocessing.cpu_count() * 2 + 1
loglevel = "error"
proc_name = "%(proj_name)s" |
7bea4c66c6d44af743955500d31ea1f963edf013 | Snippets/fix-dflt-langsys.py | Snippets/fix-dflt-langsys.py | #!/usr/bin/env python
import argparse
import logging
import os
import sys
from fontTools.ttLib import TTFont
def ProcessTable(table):
found = set()
for rec in table.ScriptList.ScriptRecord:
if rec.ScriptTag == "DFLT" and rec.Script.LangSysCount != 0:
tags = [r.LangSysTag for r in rec.Sc... | Add a snippet to remove LangSys from DFLT script | Add a snippet to remove LangSys from DFLT script
Such fonts violate the spec and OTS rejects them, this snippet should
help quickly fixing such fonts.
| Python | mit | googlefonts/fonttools,fonttools/fonttools | ---
+++
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+
+import argparse
+import logging
+import os
+import sys
+
+from fontTools.ttLib import TTFont
+
+
+def ProcessTable(table):
+ found = set()
+
+ for rec in table.ScriptList.ScriptRecord:
+ if rec.ScriptTag == "DFLT" and rec.Script.LangSysCount != 0:
+ ... | |
493a2323187448f925abefdc63600b4deba3d95c | src/olympia/addons/migrations/0008_auto_20200604_0928.py | src/olympia/addons/migrations/0008_auto_20200604_0928.py | # Generated by Django 2.2.12 on 2020-06-04 09:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('addons', '0007_addonreviewerflags_notified_about_auto_approval_delay'),
]
operations = [
migrations.RemoveIndex(
model_name='addoncateg... | Add missing addoncategory migrations (follow-up from fd2e3b1d) | Add missing addoncategory migrations (follow-up from fd2e3b1d)
| Python | bsd-3-clause | diox/olympia,eviljeff/olympia,mozilla/olympia,diox/olympia,eviljeff/olympia,mozilla/olympia,mozilla/addons-server,eviljeff/olympia,wagnerand/addons-server,bqbn/addons-server,diox/olympia,mozilla/olympia,eviljeff/olympia,diox/olympia,mozilla/addons-server,mozilla/addons-server,wagnerand/addons-server,wagnerand/addons-se... | ---
+++
@@ -0,0 +1,25 @@
+# Generated by Django 2.2.12 on 2020-06-04 09:28
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('addons', '0007_addonreviewerflags_notified_about_auto_approval_delay'),
+ ]
+
+ operations = [
+ migrations.RemoveI... | |
a4a6901638cf2240e48bd29eb364ad54de6ba81e | tests/test-server-chain-exec-shutdown.py | tests/test-server-chain-exec-shutdown.py | #!/usr/bin/env python3
from subprocess import Popen
from test_common import *
import socket, ssl, time, os, signal
if __name__ == "__main__":
ghostunnel = None
try:
# create certs
root = RootCert('root')
root.create_signed_cert('client')
# start ghostunnel server with false as child
ghostunne... | Add test to check tunnel shuts down child | Add test to check tunnel shuts down child
| Python | apache-2.0 | square/ghostunnel,square/ghostunnel | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+
+from subprocess import Popen
+from test_common import *
+import socket, ssl, time, os, signal
+
+if __name__ == "__main__":
+ ghostunnel = None
+ try:
+ # create certs
+ root = RootCert('root')
+ root.create_signed_cert('client')
+
+ # start ghostunnel... | |
c55f4d6fd10463db590e2763f95b20d3b7004347 | tests/test_exclusions.py | tests/test_exclusions.py | from datetime import datetime
from recurrence import Recurrence, Rule
import recurrence
def test_exclusion_date():
rule = Rule(
recurrence.DAILY
)
pattern = Recurrence(
dtstart=datetime(2014, 1, 2, 0, 0, 0),
dtend=datetime(2014, 1, 4, 0, 0, 0),
rrules=[rule],
exdat... | Check occurrences for exclusion dates and patterns | Check occurrences for exclusion dates and patterns
| Python | bsd-3-clause | django-recurrence/django-recurrence,FrankSalad/django-recurrence,Nikola-K/django-recurrence,linux2400/django-recurrence,Nikola-K/django-recurrence,linux2400/django-recurrence,FrankSalad/django-recurrence,django-recurrence/django-recurrence | ---
+++
@@ -0,0 +1,83 @@
+from datetime import datetime
+from recurrence import Recurrence, Rule
+import recurrence
+
+
+def test_exclusion_date():
+ rule = Rule(
+ recurrence.DAILY
+ )
+
+ pattern = Recurrence(
+ dtstart=datetime(2014, 1, 2, 0, 0, 0),
+ dtend=datetime(2014, 1, 4, 0, 0, ... | |
7b791900202cb60746af54e63fc166dc0de3560f | tests/test_mixed_java.py | tests/test_mixed_java.py | import os
import angr
self_dir = os.path.dirname(os.path.realpath(__file__))
def test_loading_of_native_libs():
binary_dir = os.path.join(self_dir, "..", "..", "angr-doc", "examples", "java_mixed_ictf")
jar_path = os.path.join(binary_dir, "service.jar")
native_libs_path = os.path.join(binary_dir, "nativ... | Add test for loading native libraries of a Java archive. | Add test for loading native libraries of a Java archive.
| Python | bsd-2-clause | iamahuman/angr,schieb/angr,iamahuman/angr,angr/angr,angr/angr,schieb/angr,iamahuman/angr,angr/angr,schieb/angr | ---
+++
@@ -0,0 +1,30 @@
+import os
+import angr
+
+self_dir = os.path.dirname(os.path.realpath(__file__))
+
+def test_loading_of_native_libs():
+
+ binary_dir = os.path.join(self_dir, "..", "..", "angr-doc", "examples", "java_mixed_ictf")
+
+ jar_path = os.path.join(binary_dir, "service.jar")
+ native_libs_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.