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 |
|---|---|---|---|---|---|---|---|---|---|---|
51fff51aaaa5139b8cf4cc5b79dd22f568f47a90 | dynd/tests/test_numpy_compat.py | dynd/tests/test_numpy_compat.py | import sys
import unittest
from dynd import nd, ndt
class TestNumpyCompat(unittest.TestCase):
"""
Tests to validate interface intended to provide compatibility with the
NumPy interface.
"""
def setUp(self):
if sys.byteorder == 'little':
self.nonnative = '>'
else:
... | Add a test for validating numpy compatibility choices | Add a test for validating numpy compatibility choices
| Python | bsd-2-clause | ContinuumIO/dynd-python,cpcloud/dynd-python,insertinterestingnamehere/dynd-python,michaelpacer/dynd-python,insertinterestingnamehere/dynd-python,cpcloud/dynd-python,ContinuumIO/dynd-python,michaelpacer/dynd-python,pombredanne/dynd-python,cpcloud/dynd-python,mwiebe/dynd-python,ContinuumIO/dynd-python,pombredanne/dynd-py... | ---
+++
@@ -0,0 +1,28 @@
+import sys
+import unittest
+from dynd import nd, ndt
+
+class TestNumpyCompat(unittest.TestCase):
+ """
+ Tests to validate interface intended to provide compatibility with the
+ NumPy interface.
+ """
+ def setUp(self):
+ if sys.byteorder == 'little':
+ sel... | |
3d2698aa524d8b2ee617b6adcd6b346cbf71f071 | test/buildbot/ensure_webcam_is_running.py | test/buildbot/ensure_webcam_is_running.py | #!/usr/bin/env python
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. ... | Add script to ensure virtual webcam is running. | Add script to ensure virtual webcam is running.
This script will check that a webcam is running and start it if it's
not currently running.
It's tailored to the way our buildbots are currently configured.
TEST=local execution on Windows, Mac and Linux.
BUG=none
R=phoglund@webrtc.org
Review URL: https://webrtc-codere... | Python | bsd-3-clause | sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc | ---
+++
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can b... | |
b046ee48f6a9276ed4cd5a17c5accf383a7f5cc5 | tests/sentry/runner/commands/test_init.py | tests/sentry/runner/commands/test_init.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from sentry.testutils import CliTestCase
from sentry.runner.commands.init import init
class InitTest(CliTestCase):
def test_simple(self):
with self.runner.isolated_filesystem():
rv = self.runner.invoke(init, ['config'],... | Add tests for init command | Add tests for init command
| Python | bsd-3-clause | alexm92/sentry,zenefits/sentry,jean/sentry,nicholasserra/sentry,ifduyue/sentry,fotinakis/sentry,jean/sentry,jean/sentry,fotinakis/sentry,JamesMura/sentry,zenefits/sentry,JackDanger/sentry,looker/sentry,nicholasserra/sentry,gencer/sentry,daevaorn/sentry,mitsuhiko/sentry,alexm92/sentry,looker/sentry,daevaorn/sentry,ifduy... | ---
+++
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import absolute_import
+
+import os
+from sentry.testutils import CliTestCase
+from sentry.runner.commands.init import init
+
+
+class InitTest(CliTestCase):
+ def test_simple(self):
+ with self.runner.isolated_filesystem():
+ r... | |
a216d01adaae04289443343e790cfa3317863e6e | 1_boilerpipe_lib_scrapping.py | 1_boilerpipe_lib_scrapping.py | # -*- coding: UTF-8 -*-
from boilerpipe.extract import Extractor
from bs4 import BeautifulSoup
from urllib2 import urlopen
URL='http://sportv.globo.com/site/eventos/mundial-de-motovelocidade/noticia/2016/06/em-duelo-eletrizante-rossi-vence-marquez-salom-e-homenageado.html'
soup = BeautifulSoup(urlopen(URL).read(), "... | Add web scrapping example to boilerpipe lib | Add web scrapping example to boilerpipe lib
| Python | apache-2.0 | fabriciojoc/redes-sociais-web,fabriciojoc/redes-sociais-web | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: UTF-8 -*-
+
+from boilerpipe.extract import Extractor
+from bs4 import BeautifulSoup
+from urllib2 import urlopen
+
+URL='http://sportv.globo.com/site/eventos/mundial-de-motovelocidade/noticia/2016/06/em-duelo-eletrizante-rossi-vence-marquez-salom-e-homenageado.html'
+
+soup = ... | |
3335f93e42473d0f807b2f701c32c213cec857bc | app_traffic/migrations/0002_auto_20161015_1724.py | app_traffic/migrations/0002_auto_20161015_1724.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-10-15 15:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app_traffic', '0001_initial'),
]
operations = [
migrations.AlterField(
... | Add the missing app_traffic migration | Add the missing app_traffic migration
| Python | agpl-3.0 | laboiteproject/laboite-backend,laboiteproject/laboite-backend,laboiteproject/laboite-backend,bgaultier/laboitepro,bgaultier/laboitepro,bgaultier/laboitepro | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10 on 2016-10-15 15:24
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('app_traffic', '0001_initial'),
+ ]
+
+ operations ... | |
4afa357984e50834427d7c2b6ed3563500aa04f9 | get_items/load_items_into_db.py | get_items/load_items_into_db.py | #!/usr/bin/env python3
import csv
import get_db_connection
def main():
with open('items.csv', 'r', newline='') as csv_file:
csv_reader = csv.DictReader(csv_file)
with get_db_connection.connect() as conn:
with conn.cursor() as cur:
for row in csv_reader:
cur.execute(
'... | Load items into the database | Load items into the database
| Python | apache-2.0 | p99tunnel/p99tunnel,p99tunnel/p99tunnel | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+import csv
+
+import get_db_connection
+
+
+def main():
+ with open('items.csv', 'r', newline='') as csv_file:
+ csv_reader = csv.DictReader(csv_file)
+ with get_db_connection.connect() as conn:
+ with conn.cursor() as cur:
+ for row in csv_reader... | |
3f9d440d31e85f9edb509a7acd3256da820ce74f | pickle_rename.py | pickle_rename.py | import os
# Pickle files should be .p file extensions, not .txt. Add a migration script.
def rename_pickles():
pickles = ['falsePositives.txt', 'whitelistedUsers.txt', 'blacklistedUsers.txt', 'ignoredPosts.txt',
'autoIgnoredPosts.txt', 'users.txt', 'notifications.txt', 'whyData.txt', 'whyDataA... | Add pickle migration script for .txt to .p | Add pickle migration script for .txt to .p
| Python | apache-2.0 | Charcoal-SE/SmokeDetector,Charcoal-SE/SmokeDetector | ---
+++
@@ -0,0 +1,15 @@
+import os
+
+# Pickle files should be .p file extensions, not .txt. Add a migration script.
+def rename_pickles():
+ pickles = ['falsePositives.txt', 'whitelistedUsers.txt', 'blacklistedUsers.txt', 'ignoredPosts.txt',
+ 'autoIgnoredPosts.txt', 'users.txt', 'notificatio... | |
f3c0e901eaa5b56b8310bea61cc2246516097639 | ideascube/conf/kb_servir_ben.py | ideascube/conf/kb_servir_ben.py | # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .base import * # noqa
from django.utils.translation import ugettext_lazy as _
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = bool(os.environ.get('DEBUG', True))
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['.koombook.lan.', 'localhost', '127.0... | Add conf file for KoomBook SERVIR | Add conf file for KoomBook SERVIR
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+
+"""KoomBook conf"""
+
+from .base import * # noqa
+from django.utils.translation import ugettext_lazy as _
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = bool(os.environ.get('DEBUG', True))
+
+TEMPLATE_DEBUG = False
+
+ALLOWED_HOSTS ... | |
e00c9ba04abd8ceaa0999ca5ca3308455a53afc8 | prepare_images.py | prepare_images.py | import cv2
path_dataset = "h:/_diplomaData/LISA Traffic Sign Dataset/signDatabasePublicFramesOnly/"
path_file = path_dataset + "vid6/frameAnnotations-MVI_0071.MOV_annotations/pedestrian_1323896918.avi_image0.png"
img = cv2.imread(path_file, cv2.IMREAD_UNCHANGED)
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllW... | Test openCV image open end convert RGB -> HSV | Test openCV image open end convert RGB -> HSV
| Python | mit | dimmddr/roadSignsNN | ---
+++
@@ -0,0 +1,14 @@
+import cv2
+
+path_dataset = "h:/_diplomaData/LISA Traffic Sign Dataset/signDatabasePublicFramesOnly/"
+path_file = path_dataset + "vid6/frameAnnotations-MVI_0071.MOV_annotations/pedestrian_1323896918.avi_image0.png"
+
+img = cv2.imread(path_file, cv2.IMREAD_UNCHANGED)
+cv2.imshow('image', i... | |
ab96ed2917af81266397870a80784d6f83cf9d36 | examples/python/requestdata.py | examples/python/requestdata.py | from flask import request
def main():
msg = "%s %s:\n---HEADERS---\n%s\n--BODY--\n%s\n-----\n" % (request.method, request.path, request.headers, request.get_data())
return msg
| Add a python example showing how to get at request data | Add a python example showing how to get at request data
| Python | apache-2.0 | ktrance/fission,ktrance/fission,life1347/fission,life1347/fission,ktrance/fission,life1347/fission,life1347/fission,platform9/fission,fission/fission,fission/fission,ktrance/fission,life1347/fission,ktrance/fission,life1347/fission,life1347/fission,life1347/fission,ktrance/fission,life1347/fission,fission/fission,platf... | ---
+++
@@ -0,0 +1,5 @@
+from flask import request
+
+def main():
+ msg = "%s %s:\n---HEADERS---\n%s\n--BODY--\n%s\n-----\n" % (request.method, request.path, request.headers, request.get_data())
+ return msg | |
b1bea0ae2369a82a0689649fd2976b4bf23a9365 | convert_column_to_timestamp.py | convert_column_to_timestamp.py | # Title: Convert a date string column to a UNIX timestamp
import graphlab as gl
from datetime import datetime
# Requires you to 'pip install python-dateutil==1.5'
from dateutil import parser
def str_to_timestamp(the_str):
try:
dt = parser.parse(the_str)
except:
return None
# UNIX epoch is ... | Add first howto code snippet | Add first howto code snippet
| Python | cc0-1.0 | dato-code/how-to,nagyistoce/how-to-graphlab-create,srikris/how-to | ---
+++
@@ -0,0 +1,18 @@
+# Title: Convert a date string column to a UNIX timestamp
+import graphlab as gl
+from datetime import datetime
+# Requires you to 'pip install python-dateutil==1.5'
+from dateutil import parser
+
+def str_to_timestamp(the_str):
+ try:
+ dt = parser.parse(the_str)
+ except:
+ ... | |
26f2c4b11125c4b859359f3011976376165544aa | src/ggrc/migrations/versions/20140930092005_53bb0f4f6ec8_switch_fulltext_record_properties.py | src/ggrc/migrations/versions/20140930092005_53bb0f4f6ec8_switch_fulltext_record_properties.py |
"""Switch fulltext_record_properties to innodb
Revision ID: 53bb0f4f6ec8
Revises: 63fc392c91a
Create Date: 2014-09-30 09:20:05.884100
"""
# revision identifiers, used by Alembic.
revision = '53bb0f4f6ec8'
down_revision = '63fc392c91a'
from alembic import op
def upgrade():
op.drop_index('fulltext_record_propert... | Switch myisam to innodb for fulltext_record_properties | Switch myisam to innodb for fulltext_record_properties
This change was made because fulltext record properties table
crashed on grc-dev and grc-test. The issue was resolved with
REPAIR TABLE clause. Running the reindex script did not help.
Based on https://cloud.google.com/sql/faq#innodb myisam should
only be used fo... | Python | apache-2.0 | kr41/ggrc-core,plamut/ggrc-core,prasannav7/ggrc-core,vladan-m/ggrc-core,josthkko/ggrc-core,jmakov/ggrc-core,AleksNeStu/ggrc-core,prasannav7/ggrc-core,kr41/ggrc-core,VinnieJohns/ggrc-core,hasanalom/ggrc-core,vladan-m/ggrc-core,VinnieJohns/ggrc-core,vladan-m/ggrc-core,j0gurt/ggrc-core,uskudnik/ggrc-core,VinnieJohns/ggrc-... | ---
+++
@@ -0,0 +1,28 @@
+
+"""Switch fulltext_record_properties to innodb
+
+Revision ID: 53bb0f4f6ec8
+Revises: 63fc392c91a
+Create Date: 2014-09-30 09:20:05.884100
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '53bb0f4f6ec8'
+down_revision = '63fc392c91a'
+
+from alembic import op
+
+
+def upgrade... | |
0c5a26d14481a660294f4ba7a2eeea02cef42a4d | scripts/migration/migrate_prereg_schema_multiple_choice_responses.py | scripts/migration/migrate_prereg_schema_multiple_choice_responses.py | """
Small migration - Prereg challenge schema q5 mult choice responses have extra trailing space. This gets confusing when
user trying to update prereg draft via API.
"""
import sys
import logging
from modularodm import Q
from website.app import init_app
from scripts import utils as scripts_utils
from website.models... | Add migration to correct q5 responses for registrations and drafts using Prereg Challenge schema. | Add migration to correct q5 responses for registrations and drafts using Prereg Challenge schema.
| Python | apache-2.0 | emetsger/osf.io,chrisseto/osf.io,kwierman/osf.io,Johnetordoff/osf.io,DanielSBrown/osf.io,TomBaxter/osf.io,monikagrabowska/osf.io,monikagrabowska/osf.io,caseyrollins/osf.io,leb2dg/osf.io,CenterForOpenScience/osf.io,wearpants/osf.io,acshi/osf.io,acshi/osf.io,mluo613/osf.io,sloria/osf.io,icereval/osf.io,baylee-d/osf.io,ml... | ---
+++
@@ -0,0 +1,70 @@
+"""
+Small migration - Prereg challenge schema q5 mult choice responses have extra trailing space. This gets confusing when
+user trying to update prereg draft via API.
+"""
+
+import sys
+import logging
+
+from modularodm import Q
+from website.app import init_app
+from scripts import util... | |
0cca921ff11a537449e37b81dd47467eb83a7a0c | telemetry/telemetry/core/backends/chrome/ios_browser_finder_unittest.py | telemetry/telemetry/core/backends/chrome/ios_browser_finder_unittest.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry.core import browser_options
from telemetry.core.backends.chrome import ios_browser_finder
from telemetry.unittest import test
... | Add unit test for IosBrowserFinder. | Add unit test for IosBrowserFinder.
This test checks if Chrome on iOS is running. It only
runs on iOS platforms.
BUG=None
Review URL: https://codereview.chromium.org/350583002
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@279143 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | sahiljain/catapult,sahiljain/catapult,benschmaus/catapult,benschmaus/catapult,catapult-project/catapult,SummerLW/Perf-Insight-Report,sahiljain/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult-csm,SummerLW/Perf-Insight-Report,catapult-project/catapult,catapult-project/catapult,benschmaus/catapult,catapult... | ---
+++
@@ -0,0 +1,24 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import unittest
+
+from telemetry.core import browser_options
+from telemetry.core.backends.chrome import ios_browser_finder
+f... | |
68878c516c497103586cb4de38b371f02ab6bee2 | oneflow/profiles/api.py | oneflow/profiles/api.py | # -*- coding: utf-8 -*-
import logging
from django.contrib.auth import get_user_model
from tastypie.resources import ModelResource
from tastypie import fields
from ..base.api import common_authentication, UserObjectsOnlyAuthorization
from .models import UserProfile
LOGGER = logging.getLogger(__name__)
User = get_u... | # -*- coding: utf-8 -*-
import logging
from django.contrib.auth import get_user_model
from tastypie.resources import ModelResource
from tastypie import fields
from ..base.api import common_authentication, UserObjectsOnlyAuthorization
from .models import UserProfile
LOGGER = logging.getLogger(__name__)
User = get_u... | Fix the `User` not being loaded client side. | Fix the `User` not being loaded client side. | Python | agpl-3.0 | WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow | ---
+++
@@ -33,7 +33,9 @@
class UserProfileResource(ModelResource):
- user = fields.ForeignKey(UserResource, 'user')
+ # NOTE: "user" won't work because it's a OneToOne field in DJango.
+ # We need "user_id". See http://stackoverflow.com/a/15609667/654755
+ user_id = fields.ForeignKey(UserResource, '... |
b1f772c788f0c652edbd8d7134c8318e4736b2fb | src/easy-plural-list-build.py | src/easy-plural-list-build.py | #!/usr/bin/env python3
import sys
import json
import os.path
def main(argv):
list = []
if os.path.isfile("easy-plural-list.json"):
f = open("easy-plural-list.json","r",encoding="utf-8")
list = json.load(f)
f.close()
if len(argv) == 3 :
if (argv[1] == "--add") or (argv[1] == "-a") :
if a... | Manage and generate a C list of plurals | Manage and generate a C list of plurals
| Python | apache-2.0 | DIG-/easygettext,DIG-/easygettext | ---
+++
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+import sys
+import json
+import os.path
+
+def main(argv):
+ list = []
+ if os.path.isfile("easy-plural-list.json"):
+ f = open("easy-plural-list.json","r",encoding="utf-8")
+ list = json.load(f)
+ f.close()
+
+ if len(argv) == 3 :
+ if (argv[1] == ... | |
2e0e6239b690a55ed7f89c11b29621b6329a8983 | thinc/tests/unit/test_pooling.py | thinc/tests/unit/test_pooling.py | import pytest
import numpy
from numpy.testing import assert_allclose
from ...neural._classes.model import Model
from ...neural.vecs2vec import MeanPooling, MaxPooling
from ...neural.vecs2vec import MinPooling
@pytest.fixture(params=[MeanPooling, MaxPooling, MinPooling])
def PoolClass(request):
return request.par... | Add simple unit tests for max, min and mean pooling | Add simple unit tests for max, min and mean pooling
| Python | mit | explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc | ---
+++
@@ -0,0 +1,63 @@
+import pytest
+import numpy
+from numpy.testing import assert_allclose
+
+from ...neural._classes.model import Model
+from ...neural.vecs2vec import MeanPooling, MaxPooling
+from ...neural.vecs2vec import MinPooling
+
+
+@pytest.fixture(params=[MeanPooling, MaxPooling, MinPooling])
+def Pool... | |
4705eae5d233ea573da3482541fd52778cff88ef | corehq/apps/data_interfaces/migrations/0019_remove_old_rule_models.py | corehq/apps/data_interfaces/migrations/0019_remove_old_rule_models.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-09-11 15:24
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('data_interfaces', '0018_check_for_rule_migration'),
]
... | Add migration to remove old rule models | Add migration to remove old rule models
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.14 on 2018-09-11 15:24
+from __future__ import unicode_literals
+from __future__ import absolute_import
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('data_interfaces', '0018... | |
52cc08dd2df39d8b64ac1a95b6861985ca7ac487 | erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py | erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
test_records = frappe.get_test_records('BOM')
class TestBOMUpdateTool(unittest.TestCase):
def test_replace_bom(self):
... | Test case added for replacing BOM | Test case added for replacing BOM
| Python | agpl-3.0 | gsnbng/erpnext,geekroot/erpnext,geekroot/erpnext,indictranstech/erpnext,indictranstech/erpnext,gsnbng/erpnext,indictranstech/erpnext,geekroot/erpnext,gsnbng/erpnext,gsnbng/erpnext,geekroot/erpnext,indictranstech/erpnext | ---
+++
@@ -0,0 +1,25 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+
+from __future__ import unicode_literals
+import unittest
+import frappe
+
+test_records = frappe.get_test_records('BOM')
+
+class TestBOMUpdateTool(unittest.Te... | |
06d88903d5eac69d217959dedf946f31f940ea19 | datasets/migrations/0019_auto_20170621_1528.py | datasets/migrations/0019_auto_20170621_1528.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-21 13:28
from __future__ import unicode_literals
from django.db import migrations
from django.core.exceptions import ObjectDoesNotExist
def add_fs_examples(apps, schema_editor):
Sound = apps.get_model('datasets', 'Sound')
TaxonomyNode = apps.get_... | Add migration for freesound examples | Add migration for freesound examples
| Python | agpl-3.0 | MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets | ---
+++
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-06-21 13:28
+from __future__ import unicode_literals
+
+from django.db import migrations
+from django.core.exceptions import ObjectDoesNotExist
+
+def add_fs_examples(apps, schema_editor):
+ Sound = apps.get_model('datasets', '... | |
d36f0e06533f08e471981f6afee56a78a0be87fc | scripts/merge_translations.py | scripts/merge_translations.py | import sys
import yaml
def main(base_file, new_file, overwrite_language):
old = yaml.load(file(base_file).read())
new = yaml.load(file(new_file).read())
assert len(overwrite_language) == 2
for o, n in zip(old, new):
if overwrite_language in n['text']:
o['text'][overwrite_languag... | Add translation merging python script | Add translation merging python script | Python | mit | okfde/eucopyright,okfde/eucopyright,okfde/eucopyright | ---
+++
@@ -0,0 +1,23 @@
+import sys
+
+import yaml
+
+
+def main(base_file, new_file, overwrite_language):
+ old = yaml.load(file(base_file).read())
+ new = yaml.load(file(new_file).read())
+
+ assert len(overwrite_language) == 2
+
+ for o, n in zip(old, new):
+ if overwrite_language in n['text']:... | |
02cfc7a3dd310fd3da130f69a52ef76eaa8fc47c | square1.py | square1.py | # Step 1: Make all the "turtle" commands available to us.
import turtle
# Step 2: create a new turtle, we'll call him simon
simon = turtle.Turtle()
# Lets draw a square!
for loop in range(4):
simon.forward(200)
simon.left(90)
| Add script for a square | Add script for a square | Python | mit | SimonDevon/simple-python-shapes | ---
+++
@@ -0,0 +1,10 @@
+# Step 1: Make all the "turtle" commands available to us.
+import turtle
+
+# Step 2: create a new turtle, we'll call him simon
+simon = turtle.Turtle()
+
+# Lets draw a square!
+for loop in range(4):
+ simon.forward(200)
+ simon.left(90) | |
07fbb086bc13bb00d4d9d538d0739547c08a7372 | scripts/util/delete_flowpath.py | scripts/util/delete_flowpath.py | """Utility script to delete a flowpath from the database and on-disk"""
import psycopg2
import sys
import os
def do_delete(huc12, fpath, scenario):
"""Delete a flowpath from the database and on disk
Args:
huc12 (str): The HUC12 that contains the flowpath
fpath (str): The flowpath within that ... | Add util script for removal of flowpaths | Add util script for removal of flowpaths | Python | mit | akrherz/idep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/idep,akrherz/dep | ---
+++
@@ -0,0 +1,54 @@
+"""Utility script to delete a flowpath from the database and on-disk"""
+
+import psycopg2
+import sys
+import os
+
+def do_delete(huc12, fpath, scenario):
+ """Delete a flowpath from the database and on disk
+
+ Args:
+ huc12 (str): The HUC12 that contains the flowpath
+ ... | |
c8a44d0689c325491ebbc1c05bab2672731cf58d | GcodeParser.py | GcodeParser.py | #!/usr/bin/env python
# coding=UTF-8
"""Module containing Gcode parsing functions"""
__author__ = "Dylan Armitage"
__email__ = "d.armitage89@gmail.com"
####---- Imports ----####
from pygcode import Line, GCodeLinearMove
def bounding_box(gcode_file):
"""Take in file of gcode, return dict of max and min bounding ... | CREATE module to parse gcode | CREATE module to parse gcode
| Python | mit | RootAccessHackerspace/k40-laser-scripts,RootAccessHackerspace/k40-laser-scripts | ---
+++
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# coding=UTF-8
+"""Module containing Gcode parsing functions"""
+
+__author__ = "Dylan Armitage"
+__email__ = "d.armitage89@gmail.com"
+
+
+####---- Imports ----####
+from pygcode import Line, GCodeLinearMove
+
+def bounding_box(gcode_file):
+ """Take in file of gco... | |
2276d86ff451b5fd834ee9b6163c85b3a51c8a7e | dendrogenous/test/test_utils.py | dendrogenous/test/test_utils.py | import dendrogenous as dg
import dendrogenous.utils
from Bio import SeqRecord
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC
from dendrogenous.test.base import BaseTestCase
class TestReformatAccession(BaseTestCase):
def test_reformat_accession_method_for_too_long_acce... | Add unit tests for reformatting accession id | Add unit tests for reformatting accession id
| Python | bsd-3-clause | fmaguire/dendrogenous | ---
+++
@@ -0,0 +1,43 @@
+import dendrogenous as dg
+import dendrogenous.utils
+
+from Bio import SeqRecord
+from Bio.Seq import Seq
+from Bio.SeqRecord import SeqRecord
+from Bio.Alphabet import IUPAC
+
+from dendrogenous.test.base import BaseTestCase
+
+class TestReformatAccession(BaseTestCase):
+
+ def test_ref... | |
8d756379ae98576c61fee18e4964a98e2014e67d | hooks/variable_logger_hook.py | hooks/variable_logger_hook.py | # coding=utf-8
# Copyright 2019 The Tensor2Robot 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 ... | Introduce a variable logging hook which will log the values of all variables during training via a session run hook. | Introduce a variable logging hook which will log the values of all variables during training via a session run hook.
PiperOrigin-RevId: 276103839
| Python | apache-2.0 | google-research/tensor2robot | ---
+++
@@ -0,0 +1,67 @@
+# coding=utf-8
+# Copyright 2019 The Tensor2Robot 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... | |
ed7ea9e4bea8f4722b57876044d3c35570376462 | scripts/dummycanbms.py | scripts/dummycanbms.py | #!/usr/bin/env python
from dbus.mainloop.glib import DBusGMainLoop
import gobject
import argparse
import logging
import sys
import os
# our own packages
sys.path.insert(1, os.path.join(os.path.dirname(__file__), '../ext/velib_python'))
from dbusdummyservice import DbusDummyService
from logger import setup_logging
# ... | Add dummy canbus-battery service for testing. | Add dummy canbus-battery service for testing.
| Python | mit | victronenergy/dbus-systemcalc-py | ---
+++
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+from dbus.mainloop.glib import DBusGMainLoop
+import gobject
+import argparse
+import logging
+import sys
+import os
+
+# our own packages
+sys.path.insert(1, os.path.join(os.path.dirname(__file__), '../ext/velib_python'))
+from dbusdummyservice import DbusDummyServi... | |
a106e33b4d45a365aac29c87e3e657bac3539d53 | tests/test_db.py | tests/test_db.py | """Unit tests for ckanserviceprovider/db.py."""
import nose.tools
import ckanserviceprovider.db as db
def test_validate_error_with_none():
"""_validate_error() should return None if given None."""
assert db._validate_error(None) is None
def test_validate_error_with_string():
"""If given a string _valid... | Add unit tests for new _validate_error() function | Add unit tests for new _validate_error() function
| Python | agpl-3.0 | ckan/ckan-service-provider,deniszgonjanin/ckan-service-provider,ESRC-CDRC/ckan-service-provider,datawagovau/ckan-service-provider | ---
+++
@@ -0,0 +1,52 @@
+"""Unit tests for ckanserviceprovider/db.py."""
+import nose.tools
+
+import ckanserviceprovider.db as db
+
+
+def test_validate_error_with_none():
+ """_validate_error() should return None if given None."""
+ assert db._validate_error(None) is None
+
+
+def test_validate_error_with_st... | |
eaf44fe741fc3fa0224e121d1017260eb8a457a1 | src/data/0.1-kz-citibike-stations.py | src/data/0.1-kz-citibike-stations.py |
#Get Citibike station location data
#url format: https://feeds.citibikenyc.com/stations/stations.json
import json
import urllib
import codecs
import pandas as pd
import numpy as np
citibike_serviceurl = "https://feeds.citibikenyc.com/stations/stations.json"
while True:
url = citibike_serviceurl
print '... | Add Citi Bike Station Data | Add Citi Bike Station Data
python file
| Python | mit | pichot/citibike-publicspace | ---
+++
@@ -0,0 +1,68 @@
+
+#Get Citibike station location data
+
+#url format: https://feeds.citibikenyc.com/stations/stations.json
+
+
+import json
+import urllib
+import codecs
+import pandas as pd
+import numpy as np
+
+citibike_serviceurl = "https://feeds.citibikenyc.com/stations/stations.json"
+
+while True:
... | |
155249ba18980544844957e1dfed748ef51f6c53 | tests/test_cli.py | tests/test_cli.py | # -*- coding: utf-8 -*-
"""Command Line Interface test cases."""
import argparse
import os
import tempfile
import unittest
from pic2map.cli import valid_directory
class ValidDirectoryTest(unittest.TestCase):
"""Valid directory test cases."""
def test_valid_directory(self):
"""Valid directory path.... | Add valid directory test cases | Add valid directory test cases
| Python | mit | jcollado/pic2map,jcollado/pic2map,jcollado/pic2map | ---
+++
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+"""Command Line Interface test cases."""
+
+import argparse
+import os
+import tempfile
+import unittest
+
+from pic2map.cli import valid_directory
+
+
+class ValidDirectoryTest(unittest.TestCase):
+
+ """Valid directory test cases."""
+
+ def test_valid_direct... | |
67c776d209699197dd37833351c79d3599c6419c | tests/test_wkt.py | tests/test_wkt.py | from math import pi
import pytest
from shapely.geometry import LineString, Point
from shapely.wkt import dumps
@pytest.fixture(scope="module")
def pipi():
return Point((pi, -pi))
@pytest.fixture(scope="module")
def pipi4():
return Point((pi*4, -pi*4))
def test_wkt(pipi):
""".wkt and wkt.dumps() both... | Test that .wkt and wkt.dumps produce same results | Test that .wkt and wkt.dumps produce same results
| Python | bsd-3-clause | jdmcbr/Shapely,jdmcbr/Shapely | ---
+++
@@ -0,0 +1,34 @@
+from math import pi
+
+import pytest
+
+from shapely.geometry import LineString, Point
+from shapely.wkt import dumps
+
+
+@pytest.fixture(scope="module")
+def pipi():
+ return Point((pi, -pi))
+
+
+@pytest.fixture(scope="module")
+def pipi4():
+ return Point((pi*4, -pi*4))
+
+
+def te... | |
63a80b711e1be9a6047965b8d0061b676d8c50ed | cartridge/shop/management/commands/syncreshooks.py | cartridge/shop/management/commands/syncreshooks.py | from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from mezzanine.conf import settings
from cartridge.shop.models import *
class Command(BaseCommand):
help = 'Sync reservations from external hook'
def handle(self, *args, **options):
p = Reservable... | Add a manage command to sync reservations from external hook .. hard coded first product only atm | Add a manage command to sync reservations from external hook .. hard coded first product only atm
| Python | bsd-2-clause | jaywink/cartridge-reservable,jaywink/cartridge-reservable,jaywink/cartridge-reservable | ---
+++
@@ -0,0 +1,13 @@
+from django.core.management.base import BaseCommand
+from django.core.management.base import CommandError
+from mezzanine.conf import settings
+
+from cartridge.shop.models import *
+
+class Command(BaseCommand):
+ help = 'Sync reservations from external hook'
+
+ def handle(self, *arg... | |
d26a880dcc49658fa369d11d4286a3e2c9b3d487 | cloudbrain/run.py | cloudbrain/run.py | import argparse
import subprocess
import sys
import cloudbrain.publishers.sensor_publisher
def publish(args):
sys.argv = args or ['-h']
cloudbrain.publishers.sensor_publisher.main()
def subscribe(args):
return NotImplemented
def parse_args():
parser = argparse.ArgumentParser()
subparsers = parser.ad... | Add entrypoint script to support subcommands | Add entrypoint script to support subcommands
| Python | agpl-3.0 | marionleborgne/cloudbrain,singlerider/cloudbrain,alessiodm/cloudbrain,prescottprue/cloudbrain,octopicorn/cloudbrain,singlerider/cloudbrain,prescottprue/cloudbrain,andyh616/cloudbrain,alessiodm/cloudbrain,alessiodm/cloudbrain,marionleborgne/cloudbrain,singlerider/cloudbrain,lambdaloop/cloudbrain,prescottprue/cloudbrain,... | ---
+++
@@ -0,0 +1,33 @@
+import argparse
+import subprocess
+import sys
+
+import cloudbrain.publishers.sensor_publisher
+
+def publish(args):
+ sys.argv = args or ['-h']
+ cloudbrain.publishers.sensor_publisher.main()
+
+def subscribe(args):
+ return NotImplemented
+
+def parse_args():
+ parser = argparse... | |
fe82933732aed8c1a32834520f1ba244085fcb5d | tools/otter_ai_to_our_format.py | tools/otter_ai_to_our_format.py | import os
import sys
def main():
if len(sys.argv) != 2:
print("Usage: Pass the file name for the source transcript txt file.")
sys.exit(-1)
file = sys.argv[1]
out_file = os.path.expanduser(
os.path.join(
'~/Desktop',
os.path.basename(file)
)
)
... | Add a tool to convert from otter formats to what we use on the website. | Add a tool to convert from otter formats to what we use on the website.
| Python | mit | mikeckennedy/python_bytes_show_notes | ---
+++
@@ -0,0 +1,70 @@
+import os
+import sys
+
+
+def main():
+ if len(sys.argv) != 2:
+ print("Usage: Pass the file name for the source transcript txt file.")
+ sys.exit(-1)
+
+ file = sys.argv[1]
+ out_file = os.path.expanduser(
+ os.path.join(
+ '~/Desktop',
+ ... | |
a808ae6ff89290a65802769e925610ba123a99f7 | tests/auto/keras/test_constraints.py | tests/auto/keras/test_constraints.py | import unittest
import numpy as np
from theano import tensor as T
class TestConstraints(unittest.TestCase):
def setUp(self):
self.some_values = [0.1,0.5,3,8,1e-7]
self.example_array = np.random.random((100,100))*100. - 50.
self.example_array[0,0] = 0. # 0 could possibly cause trouble
d... | Add a test for the max-norm constraint | Add a test for the max-norm constraint
| Python | mit | jayhetee/keras,nzer0/keras,nebw/keras,sjuvekar/keras,Yingmin-Li/keras,cvfish/keras,nehz/keras,eulerreich/keras,harshhemani/keras,pthaike/keras,wubr2000/keras,zhmz90/keras,daviddiazvico/keras,Aureliu/keras,cheng6076/keras,dhruvparamhans/keras,dribnet/keras,tencrance/keras,DeepGnosis/keras,keras-team/keras,saurav111/kera... | ---
+++
@@ -0,0 +1,20 @@
+import unittest
+import numpy as np
+from theano import tensor as T
+
+class TestConstraints(unittest.TestCase):
+ def setUp(self):
+ self.some_values = [0.1,0.5,3,8,1e-7]
+ self.example_array = np.random.random((100,100))*100. - 50.
+ self.example_array[0,0] = 0. # 0... | |
0851752e0b2a2234f43ca8632ffd23e10118feb5 | scikits/learn/machine/manifold_learning/regression/tests/test_neighbors.py | scikits/learn/machine/manifold_learning/regression/tests/test_neighbors.py | import numpy as np
from ..neighbors import Neighbors
from numpy.testing import assert_array_equal
def test_neighbors_1D():
"""
Nearest Neighbors in a line.
"""
# some constants
n = 10
n_2 = n/2
samples = [[x] for x in range(0, n)]
labels = [0]*n_2 + [1]*n_2
zeros = np.zeros(n_2)... | Add tests for Nearest Neighbor Algorithm. | Add tests for Nearest Neighbor Algorithm.
TODO: a lot more tests are needed.
git-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@369 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
| Python | bsd-3-clause | iismd17/scikit-learn,JeanKossaifi/scikit-learn,fzalkow/scikit-learn,cauchycui/scikit-learn,florian-f/sklearn,abhishekkrthakur/scikit-learn,ZENGXH/scikit-learn,rrohan/scikit-learn,LohithBlaze/scikit-learn,yyjiang/scikit-learn,ilo10/scikit-learn,etkirsch/scikit-learn,luo66/scikit-learn,nmayorov/scikit-learn,LiaoPan/sciki... | ---
+++
@@ -0,0 +1,30 @@
+import numpy as np
+from ..neighbors import Neighbors
+
+from numpy.testing import assert_array_equal
+
+def test_neighbors_1D():
+ """
+ Nearest Neighbors in a line.
+ """
+ # some constants
+ n = 10
+ n_2 = n/2
+ samples = [[x] for x in range(0, n)]
+ labels = [0]*... | |
4fe0ea924f4cd7ac1bff718c6fc99c0e6780c803 | cache_bind.py | cache_bind.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 OpenERP - Team de Localización Argentina.
# https://launchpad.net/~openerp-l10n-ar-localization
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | Test for electronic invoice. [FIX] Change l10n_ar_wsfe to l10n_ar_wsafip_fe | [ADD] Test for electronic invoice. [FIX] Change l10n_ar_wsfe to l10n_ar_wsafip_fe | Python | agpl-3.0 | odoo-l10n-ar/l10n_ar_wsafip | ---
+++
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2012 OpenERP - Team de Localización Argentina.
+# https://launchpad.net/~openerp-l10n-ar-localization
+#
+# This program is free software: you can redistribute it and/o... | |
d2f3829ef024a663ecd82255860b0165838f8086 | BasicSequences/BlankingSweeps.py | BasicSequences/BlankingSweeps.py | """
Sequences for optimizing gating timing.
"""
from ..PulsePrimitives import *
from ..Compiler import compile_to_hardware
def sweep_gateDelay(qubit, sweepPts):
"""
Sweep the gate delay associated with a qubit channel using a simple Id, Id, X90, X90
seqeuence.
Parameters
---------
qubit : ... | Add a sequence module for optimizing gating | Add a sequence module for optimizing gating
--CAR
| Python | apache-2.0 | BBN-Q/QGL,BBN-Q/QGL | ---
+++
@@ -0,0 +1,33 @@
+"""
+Sequences for optimizing gating timing.
+"""
+from ..PulsePrimitives import *
+from ..Compiler import compile_to_hardware
+
+def sweep_gateDelay(qubit, sweepPts):
+ """
+ Sweep the gate delay associated with a qubit channel using a simple Id, Id, X90, X90
+ seqeuence.
+
+ ... | |
1ce040e0642c6dcc888b3787f7448c65ba0318f8 | logos_setup_data/__openerp__.py | logos_setup_data/__openerp__.py | # -*- coding: utf-8 -*-
{
'name': 'Logos Set Up Data',
'version': '1.0',
'category': 'Accounting',
'sequence': 14,
'summary': '',
'description': """
Logos Set Up Data
=====================
""",
'author': 'Ingenieria ADHOC',
'website': 'www.ingadhoc.com',
'images': [
],
'... | # -*- coding: utf-8 -*-
{
'name': 'Logos Set Up Data',
'version': '1.0',
'category': 'Accounting',
'sequence': 14,
'summary': '',
'description': """
Logos Set Up Data
=====================
""",
'author': 'Ingenieria ADHOC',
'website': 'www.ingadhoc.com',
'images': [
],
'... | ADD base location to logos as it is necesary for security rules | ADD base location to logos as it is necesary for security rules
| Python | agpl-3.0 | ingadhoc/odoo-personalizations,adhoc-dev/odoo-personalizations | ---
+++
@@ -19,7 +19,7 @@
'sale',
'portal_sale_distributor',
'website_sale',
- # 'base_location',
+ 'base_location',
'price_security',
'product_price_currency',
'logos_product_attributes', |
0fd252360ee340ae402ab8c9f007a673b4f330b9 | src/ggrc/migrations/versions/20160412134448_11cee57a4149_add_assessor_reminder_notification.py | src/ggrc/migrations/versions/20160412134448_11cee57a4149_add_assessor_reminder_notification.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: urban@reciprocitylabs.com
# Maintained By: urban@reciprocitylabs.com
"""
Add assessors reminder notification
Create Date: 2016-04-12 13:44:48.2651... | Add new notification type for assessors reminder | Add new notification type for assessors reminder
| Python | apache-2.0 | edofic/ggrc-core,NejcZupec/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,prasannav7/ggrc-core,jos... | ---
+++
@@ -0,0 +1,72 @@
+# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+# Created By: urban@reciprocitylabs.com
+# Maintained By: urban@reciprocitylabs.com
+
+"""
+Add assessors reminder notification
+
+C... | |
eedf9070aeca9335809b0c09597cbc67dc92e407 | plugins/CoD5_WaW.py | plugins/CoD5_WaW.py | import os
from lib.base_plugin import BasePlugin
class CoDWaWPlugin(BasePlugin):
Name = "Call of Duty: World at War"
support_os = ["Windows"]
def backup(self, _):
_.add_folder('Profile', os.path.join(os.environ['LOCALAPPDATA'], 'Activision'), 'CoDWaW')
def restore(self, _):
_.restore... | Call of Duty: World at War plugin | Call of Duty: World at War plugin
| Python | mit | Pr0Ger/SGSB | ---
+++
@@ -0,0 +1,18 @@
+import os
+from lib.base_plugin import BasePlugin
+
+
+class CoDWaWPlugin(BasePlugin):
+ Name = "Call of Duty: World at War"
+ support_os = ["Windows"]
+
+ def backup(self, _):
+ _.add_folder('Profile', os.path.join(os.environ['LOCALAPPDATA'], 'Activision'), 'CoDWaW')
+
+ ... | |
9daa2c08587d21f677e5a0461aa3a5fc7bff113b | analysis/create-jacobians.py | analysis/create-jacobians.py | import climate
import database
def main(root, pattern='*'):
for trial in database.Experiment(root).trials_matching(pattern, load=False):
trial.load()
body = database.Movement(trial.df.copy())
body.make_body_relative()
body.add_velocities()
goal = database.Movement(trial.... | Add script for computing jacobian, as a dataframe. | Add script for computing jacobian, as a dataframe.
| Python | mit | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | ---
+++
@@ -0,0 +1,28 @@
+import climate
+
+import database
+
+
+def main(root, pattern='*'):
+ for trial in database.Experiment(root).trials_matching(pattern, load=False):
+ trial.load()
+
+ body = database.Movement(trial.df.copy())
+ body.make_body_relative()
+ body.add_velocities()
+... | |
54c03cfa54f44fd9a839701a9ffcaa9c742d1dd8 | pycom/oslolog.py | pycom/oslolog.py | # coding: utf-8
"""
Use the library 'oslo.log' to configure the logging.
Applications should use oslo.log’s configuration functions to register
logging-related configuration options and configure the root and other default
loggers.
(1) Call register_options() before parsing command line options.
(2) Call set_defaults... | Add the usage of `oslo.log`. | Add the usage of `oslo.log`.
| Python | mit | xgfone/xutils,xgfone/pycom | ---
+++
@@ -0,0 +1,33 @@
+# coding: utf-8
+"""
+Use the library 'oslo.log' to configure the logging.
+
+Applications should use oslo.log’s configuration functions to register
+logging-related configuration options and configure the root and other default
+loggers.
+
+(1) Call register_options() before parsing command... | |
68273e1826ca19e508b616713093c37e4e18381c | test/geocoders/openmapquest.py | test/geocoders/openmapquest.py |
from geopy.compat import u
from geopy.geocoders import OpenMapQuest
from test.geocoders.util import GeocoderTestBase
class OpenMapQuestTestCase(GeocoderTestBase): # pylint: disable=R0904,C0111
@classmethod
def setUpClass(cls):
cls.geocoder = OpenMapQuest(scheme='http', timeout=3)
cls.delta =... |
from geopy.compat import u
from geopy.geocoders import OpenMapQuest
from test.geocoders.util import GeocoderTestBase, env
import unittest
@unittest.skipUnless( # pylint: disable=R0904,C0111
bool(env.get('OPENMAPQUEST_APIKEY')),
"No OPENMAPQUEST_APIKEY env variable set"
)
class OpenMapQuestTestCase(GeocoderT... | Make OpenMapQuest tests conditional on environment variable | Make OpenMapQuest tests conditional on environment variable | Python | mit | geopy/geopy,Vimos/geopy,mthh/geopy,magnushiie/geopy,Vimos/geopy,magnushiie/geopy,jmb/geopy,mthh/geopy | ---
+++
@@ -1,14 +1,19 @@
from geopy.compat import u
from geopy.geocoders import OpenMapQuest
-from test.geocoders.util import GeocoderTestBase
+from test.geocoders.util import GeocoderTestBase, env
+import unittest
-class OpenMapQuestTestCase(GeocoderTestBase): # pylint: disable=R0904,C0111
+@unittest.skipUn... |
7a0e8dfaa49b31876b4210b56bced77142ce7f39 | set1/challenge-5.py | set1/challenge-5.py | from __future__ import division
import math
import base64
def repeating_xor_encrypt(text, key):
padded_key = key * int(math.ceil(len(text) / len(key)))
encrypted = [chr(ord(a) ^ ord(b)) for a, b in zip(text, padded_key)]
return base64.b16encode(''.join(encrypted))
if __name__ == '__main__':
text = (... | Add solution to challenge 5. | Add solution to challenge 5.
| Python | mit | ericnorris/cryptopals-solutions | ---
+++
@@ -0,0 +1,17 @@
+from __future__ import division
+import math
+import base64
+
+def repeating_xor_encrypt(text, key):
+ padded_key = key * int(math.ceil(len(text) / len(key)))
+
+ encrypted = [chr(ord(a) ^ ord(b)) for a, b in zip(text, padded_key)]
+
+ return base64.b16encode(''.join(encrypted))
+
+... | |
2e4cdae4fd866149185a5c16a7e0e37b9b87150c | tests/thread/thread_qstr1.py | tests/thread/thread_qstr1.py | # test concurrent interning of strings
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import _thread
# function to check the interned string
def check(s, val):
assert type(s) == str
assert int(s) == val
# main thread function
def th(base, n):
for i in range(n):
# this... | Add test for concurrent interning of strings. | tests/thread: Add test for concurrent interning of strings.
Qstr code accesses global state and needs to be made thread safe.
| Python | mit | emfcamp/micropython,selste/micropython,mhoffma/micropython,AriZuu/micropython,cwyark/micropython,hiway/micropython,swegener/micropython,henriknelson/micropython,torwag/micropython,kerneltask/micropython,tuc-osg/micropython,micropython/micropython-esp32,tobbad/micropython,oopy/micropython,ganshun666/micropython,matthewe... | ---
+++
@@ -0,0 +1,34 @@
+# test concurrent interning of strings
+#
+# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+
+import _thread
+
+# function to check the interned string
+def check(s, val):
+ assert type(s) == str
+ assert int(s) == val
+
+# main thread function
+def th(base, n... | |
9877879c9a8d22a658f6c5f41b79930ff5385f05 | plugins/parking.py | plugins/parking.py | from irc3.plugins.command import command
from bytebot_config import BYTEBOT_PLUGIN_CONFIG
from irc3 import asyncio
import aiohttp
import xml.etree.ElementTree as ET
@command(permission="view")
@asyncio.coroutine
def parking(bot, mask, target, args):
"""Show the current parking lot status
%%parking
... | from irc3.plugins.command import command
from bytebot_config import BYTEBOT_PLUGIN_CONFIG
from irc3 import asyncio
import aiohttp
import xml.etree.ElementTree as ET
@command(permission="view")
@asyncio.coroutine
def parking(bot, mask, target, args):
"""Show the current parking lot status
%%parking
... | Sort by name, fix vacancy (values in api are occupancy) | Sort by name, fix vacancy (values in api are occupancy)
| Python | mit | mape2k/Bytebot,Bytespeicher/Bytebot | ---
+++
@@ -29,10 +29,19 @@
r = yield from resp.read()
root = ET.fromstring(r)
+
+ """Sort XML by element longname"""
+ root[:] = sorted(root, key=lambda key: key.findtext("longname"))
+
for lot in root.findall('ph'):
- bot.privmsg(target,
... |
219253f59314e0adf57deb238c9d888bbb984b23 | app/util/danger.py | app/util/danger.py | from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, SignatureExpired, BadTimeSignature
import os
def gen_auth_token(id,expiration=10000):
"""Generate auth token"""
s = Serializer(os.environ['API_KEY'],expires_in=expiration)
return s.dumps({'id':id})
def verify_auth_token(token):
"... | Create util file for gen and verifying auth tokens | Create util file for gen and verifying auth tokens
| Python | mit | tforrest/soda-automation,tforrest/soda-automation | ---
+++
@@ -0,0 +1,24 @@
+from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, SignatureExpired, BadTimeSignature
+
+import os
+
+def gen_auth_token(id,expiration=10000):
+ """Generate auth token"""
+ s = Serializer(os.environ['API_KEY'],expires_in=expiration)
+ return s.dumps({'id':id})
+... | |
224f977a60fc94893228f9372386de8ca0551fde | artifacts/firmware_password_status.py | artifacts/firmware_password_status.py | import subprocess
factoid = 'firmware_password_status'
def fact():
'''Returns whether or not a firmware password is set'''
result = 'None'
try:
proc = subprocess.Popen(
['/usr/sbin/firmwarepasswd', '-check'],
stdout=subprocess.PIPE,
stderr=subproce... | Add firmware password status artifact | Add firmware password status artifact
| Python | apache-2.0 | chilcote/unearth,chilcote/unearth | ---
+++
@@ -0,0 +1,26 @@
+import subprocess
+
+factoid = 'firmware_password_status'
+
+def fact():
+ '''Returns whether or not a firmware password is set'''
+
+ result = 'None'
+
+ try:
+ proc = subprocess.Popen(
+ ['/usr/sbin/firmwarepasswd', '-check'],
+ stdout=subproce... | |
eb7b230246f5756c4d164eba110e4d323bad5941 | load_db.py | load_db.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import re
import sqlite3
from collections import namedtuple
import sys
Record = namedtuple('Record', ['name', 'day_of_birth',
'month_of_birth', 'series', 'photo_url', 'important'])
def new_record(csv_line):
character_id, nam... | Load data from modified CSV file. | Load data from modified CSV file.
| Python | mit | lensvol/anibirthday | ---
+++
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import csv
+import re
+import sqlite3
+from collections import namedtuple
+import sys
+
+Record = namedtuple('Record', ['name', 'day_of_birth',
+ 'month_of_birth', 'series', 'photo_url', 'important'])
+
+
+def ne... | |
afbca5518cd7da60ddbb01d07a457a59c037c1b3 | amiconfig/lib/mountdaemon.py | amiconfig/lib/mountdaemon.py | #
# Copyright (c) SAS Institute 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 w... | Add missing library for daemonization | Add missing library for daemonization
| Python | apache-2.0 | sassoftware/amiconfig,sassoftware/amiconfig | ---
+++
@@ -0,0 +1,37 @@
+#
+# Copyright (c) SAS Institute 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 require... | |
8068428fb06a2f3dba2e3f73684f26b9838c71e4 | apps/core/tests/test_models.py | apps/core/tests/test_models.py | from django.test import TestCase
from apps.data.factories import EntryFactory
from .. import models
class SpeciesTestCase(TestCase):
def test_can_create_species(self):
name = 'Saccharomyces cerevisiae'
reference = EntryFactory()
description = 'lorem ipsum'
qs = models.Species.o... | Add unit tests for the Species model | Add unit tests for the Species model
| Python | bsd-3-clause | Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel | ---
+++
@@ -0,0 +1,56 @@
+from django.test import TestCase
+
+from apps.data.factories import EntryFactory
+from .. import models
+
+
+class SpeciesTestCase(TestCase):
+
+ def test_can_create_species(self):
+
+ name = 'Saccharomyces cerevisiae'
+ reference = EntryFactory()
+ description = 'lor... | |
1e716c71395d2df5e34fe403115d0dab630f36cf | tests/config/test_defaults.py | tests/config/test_defaults.py | from __future__ import absolute_import, unicode_literals
from mopidy import config
def test_core_schema_has_cache_dir():
assert 'cache_dir' in config._core_schema
assert isinstance(config._core_schema['cache_dir'], config.Path)
def test_core_schema_has_config_dir():
assert 'config_dir' in config._core_... | Add tests for defaults in core schema config | tests: Add tests for defaults in core schema config
Tests check if default core schema has cache_dir, config_dir, data_dir and max_tracklist_length and if they have proper type
| Python | apache-2.0 | jmarsik/mopidy,bencevans/mopidy,adamcik/mopidy,ZenithDK/mopidy,vrs01/mopidy,kingosticks/mopidy,diandiankan/mopidy,kingosticks/mopidy,ZenithDK/mopidy,bacontext/mopidy,jcass77/mopidy,ali/mopidy,SuperStarPL/mopidy,SuperStarPL/mopidy,bencevans/mopidy,adamcik/mopidy,ali/mopidy,vrs01/mopidy,hkariti/mopidy,jmarsik/mopidy,king... | ---
+++
@@ -0,0 +1,26 @@
+from __future__ import absolute_import, unicode_literals
+
+from mopidy import config
+
+
+def test_core_schema_has_cache_dir():
+ assert 'cache_dir' in config._core_schema
+ assert isinstance(config._core_schema['cache_dir'], config.Path)
+
+
+def test_core_schema_has_config_dir():
+ ... | |
8021593349e27df111429d7a8ac9d443d9b1877e | demo/amqp_clock.py | demo/amqp_clock.py | #!/usr/bin/env python
"""
AMQP Clock
Fires off simple messages at one-minute intervals to a topic
exchange named 'clock', with the topic of the message being
the local time as 'year.month.date.dow.hour.minute',
for example: '2007.11.26.1.12.33', where the dow (day of week)
is 0 for Sunday, 1 for Monday, and so on (sim... | Add another demo program, one that spits out messages at regular intervals. | Add another demo program, one that spits out messages
at regular intervals.
| Python | lgpl-2.1 | JustinTulloss/harelib,arnaudsj/py-amqplib,JustinTulloss/harelib | ---
+++
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+"""
+AMQP Clock
+
+Fires off simple messages at one-minute intervals to a topic
+exchange named 'clock', with the topic of the message being
+the local time as 'year.month.date.dow.hour.minute',
+for example: '2007.11.26.1.12.33', where the dow (day of week)
+is 0 for ... | |
ea0f9f97f4a0a8338bed30724ab92a8acc4b6efa | tests/panels/test_cache.py | tests/panels/test_cache.py | # coding: utf-8
from __future__ import absolute_import, unicode_literals
import django
from django.core import cache
from django.utils.unittest import skipIf
from ..base import BaseTestCase
class CachePanelTestCase(BaseTestCase):
def setUp(self):
super(CachePanelTestCase, self).setUp()
self.pa... | # coding: utf-8
from __future__ import absolute_import, unicode_literals
import django
from django.core import cache
from django.utils.unittest import skipIf
from ..base import BaseTestCase
class CachePanelTestCase(BaseTestCase):
def setUp(self):
super(CachePanelTestCase, self).setUp()
self.pa... | Add a test that verifies the cache has a clear method. | Add a test that verifies the cache has a clear method.
| Python | bsd-3-clause | peap/django-debug-toolbar,seperman/django-debug-toolbar,stored/django-debug-toolbar,megcunningham/django-debug-toolbar,calvinpy/django-debug-toolbar,spookylukey/django-debug-toolbar,guilhermetavares/django-debug-toolbar,megcunningham/django-debug-toolbar,tim-schilling/django-debug-toolbar,jazzband/django-debug-toolbar,... | ---
+++
@@ -25,7 +25,9 @@
cache.cache.set('foo', 'bar')
cache.cache.get('foo')
cache.cache.delete('foo')
- self.assertEqual(len(self.panel.calls), 3)
+ # Verify that the cache has a valid clear method.
+ cache.cache.clear()
+ self.assertEqual(len(self.panel.calls... |
61af21c1081e36aa6f90fc909d719e5ec0d44bd8 | dotbriefs/tests/test_clean.py | dotbriefs/tests/test_clean.py | import unittest
from clean import CleanSecret
class TestCleanSecret(unittest.TestCase):
def setUp(self):
self.secrets = []
self.secrets.append(CleanSecret('passwd',
r'password(\s*)=(\s*)(?#UpToHash)',
r'password\1=\2(?#Key)',
'Mutt passwords',
True... | Add first test case for clean | Add first test case for clean
| Python | bsd-3-clause | oohlaf/dotsecrets | ---
+++
@@ -0,0 +1,24 @@
+import unittest
+
+from clean import CleanSecret
+
+
+class TestCleanSecret(unittest.TestCase):
+
+ def setUp(self):
+ self.secrets = []
+ self.secrets.append(CleanSecret('passwd',
+ r'password(\s*)=(\s*)(?#UpToHash)',
+ r'password\1=\2(?#Key)',
+ ... | |
f2328d35a1a964f5e0c22420f054d0451c9a62aa | pindahdatalessonplantarikh.py | pindahdatalessonplantarikh.py | #!/usr/bin/python
#Created : Mon 08 Sep 2008 01:40:45 PM GMT
#Last Modified : Tue 28 Jul 2015 10:34:53 AM UTC
#qpy:2
#qpy:console
import site
import os
import sys
from time import strftime
import sqlite3
con01 = sqlite3.connect("/usb/phpmysql/lessonplan2010.db")
cur01 = con01.cursor()
con02 = sqlite3.connect("/usb/... | Add pindah lesson plan tarikh | Add pindah lesson plan tarikh
| Python | cc0-1.0 | mwbetrg/englishdb | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+#Created : Mon 08 Sep 2008 01:40:45 PM GMT
+#Last Modified : Tue 28 Jul 2015 10:34:53 AM UTC
+
+#qpy:2
+#qpy:console
+
+import site
+import os
+import sys
+from time import strftime
+import sqlite3
+
+con01 = sqlite3.connect("/usb/phpmysql/lessonplan2010.db")
+cur01 = con0... | |
92ff17745b125080f1d4cc7e46032806267936bd | comics/comics/abstrusegoose.py | comics/comics/abstrusegoose.py | from comics.aggregator.crawler import CrawlerBase, CrawlerResult
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = 'Abstruse Goose'
language = 'en'
url = 'http://www.abstrusegoose.com/'
start_date = '2008-02-01'
rights = 'lcfr, CC BY-NC 3.0 US'
class Crawler(CrawlerBase):
hist... | Add crawler for Abstruse Goose | Add crawler for Abstruse Goose
| Python | agpl-3.0 | datagutten/comics,klette/comics,jodal/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,jodal/comics,klette/comics,klette/comics,datagutten/comics | ---
+++
@@ -0,0 +1,21 @@
+from comics.aggregator.crawler import CrawlerBase, CrawlerResult
+from comics.meta.base import MetaBase
+
+class Meta(MetaBase):
+ name = 'Abstruse Goose'
+ language = 'en'
+ url = 'http://www.abstrusegoose.com/'
+ start_date = '2008-02-01'
+ rights = 'lcfr, CC BY-NC 3.0 US'
+... | |
23e24ccb8a2a5fb9ead50b1697344c79c03ef14a | traits/tests/test_dynamic_trait_definition.py | traits/tests/test_dynamic_trait_definition.py | from traits.testing.unittest_tools import unittest
from traits.api import Float, HasTraits, Int, List
class Foo(HasTraits):
x = Float
x_changes = List
y_changes = List
def _x_changed(self, new):
self.x_changes.append(new)
def _y_changed(self, new):
self.y_changes.append(new)
... | Add tests for `add_trait` and `remove_trait`. | Add tests for `add_trait` and `remove_trait`.
| Python | bsd-3-clause | burnpanck/traits,burnpanck/traits | ---
+++
@@ -0,0 +1,50 @@
+from traits.testing.unittest_tools import unittest
+
+from traits.api import Float, HasTraits, Int, List
+
+
+class Foo(HasTraits):
+ x = Float
+
+ x_changes = List
+ y_changes = List
+
+ def _x_changed(self, new):
+ self.x_changes.append(new)
+
+ def _y_changed(self, n... | |
5116cf742be887e7ed40b17714ac6a2a117ad5b8 | schema_test.py | schema_test.py | from dtest import Tester
from assertions import *
from tools import *
import time
class TestSchema(Tester):
def remove_columndef_test(self):
""" Remove a column definition while a node is dead """
cluster = self.cluster
cluster.populate(2).start()
nodes = cluster.nodelist()
... | Add test schema deletion bug | Add test schema deletion bug
| Python | apache-2.0 | krummas/cassandra-dtest,krummas/cassandra-dtest,mambocab/cassandra-dtest,stef1927/cassandra-dtest,thobbs/cassandra-dtest,iamaleksey/cassandra-dtest,tjake/cassandra-dtest,iamaleksey/cassandra-dtest,snazy/cassandra-dtest,blerer/cassandra-dtest,riptano/cassandra-dtest,pauloricardomg/cassandra-dtest,beobal/cassandra-dtest,... | ---
+++
@@ -0,0 +1,44 @@
+from dtest import Tester
+from assertions import *
+from tools import *
+import time
+
+class TestSchema(Tester):
+
+ def remove_columndef_test(self):
+ """ Remove a column definition while a node is dead """
+
+ cluster = self.cluster
+ cluster.populate(2).start()
+ ... | |
d95804836fd5f693bd70ee4d8480e0e63d98cdb7 | tests/test_utils.py | tests/test_utils.py | from fudge.patcher import with_patched_object
from functools import wraps
from nose.tools import eq_
from nose.tools import raises
from fabric.state import output
from fabric.utils import warn, indent, abort
import sys
from StringIO import StringIO
#
# Setup/teardown helpers and decorators
#
def mock_streams(*which)... | Add basic tests for utils | Add basic tests for utils
Signed-off-by: Jeff Forcier <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@bitprophet.org>
| Python | bsd-2-clause | amaniak/fabric,SamuelMarks/fabric,simon-engledew/fabric,likesxuqiang/fabric,kmonsoor/fabric,rane-hs/fabric-py3,ploxiln/fabric,StackStorm/fabric,bitprophet/fabric,bitmonk/fabric,itoed/fabric,haridsv/fabric,xLegoz/fabric,pashinin/fabric,cgvarela/fabric,cmattoon/fabric,tolbkni/fabric,raimon49/fabric,kxxoling/fabric,rbramw... | ---
+++
@@ -0,0 +1,98 @@
+from fudge.patcher import with_patched_object
+from functools import wraps
+from nose.tools import eq_
+
+from nose.tools import raises
+from fabric.state import output
+from fabric.utils import warn, indent, abort
+import sys
+from StringIO import StringIO
+
+#
+# Setup/teardown helpers and... | |
e2b5df2501571b51e4a37ee5b7c7f16ededd5995 | astm/constants.py | astm/constants.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
#: :mod:`astm.protocol` base encoding.
ENCODING = 'latin-1'
#: Message start token.
STX = b'\x02'
#: M... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
#: ASTM specification base encoding.
ENCODING = 'latin-1'
#: Message start token.
STX = b'\x02'
#: Mes... | Fix description about global ENCODING. | Fix description about global ENCODING.
| Python | bsd-3-clause | tectronics/python-astm,Iskander1b/python-astm,eddiep1101/python-astm,andrexmd/python-astm,pombreda/python-astm,kxepal/python-astm,LogicalKnight/python-astm,123412345/python-astm,tinoshot/python-astm,MarcosHaenisch/python-astm,Alwnikrotikz/python-astm,asingla87/python-astm,mhaulo/python-astm,AlanZatarain/python-astm,bri... | ---
+++
@@ -7,7 +7,7 @@
# you should have received as part of this distribution.
#
-#: :mod:`astm.protocol` base encoding.
+#: ASTM specification base encoding.
ENCODING = 'latin-1'
#: Message start token. |
8c0689decb6953f04b059f9b7838c69f6d41c8b0 | drudge/drs.py | drudge/drs.py | """Support for drudge scripts."""
import collections
from sympy import Symbol, Indexed, IndexedBase
#
# Special classes for SymPy objects
# ---------------------------------
#
class DrsSymbol(Symbol):
"""Symbols used in drudge scripts.
The drudge symbol needs to behave as similar to the actual symbol as
... | Add utility SymPy subclasses for drudge scripts | Add utility SymPy subclasses for drudge scripts
These two subclasses are going to be used for SymPy objects in drudge
scripts, especially used as the objects for unresolved names.
| Python | mit | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge | ---
+++
@@ -0,0 +1,105 @@
+"""Support for drudge scripts."""
+
+import collections
+
+from sympy import Symbol, Indexed, IndexedBase
+
+
+#
+# Special classes for SymPy objects
+# ---------------------------------
+#
+
+class DrsSymbol(Symbol):
+ """Symbols used in drudge scripts.
+
+ The drudge symbol needs to... | |
4ca362dcdc2da9ad56d837db6be9104af19dd163 | scripts/create_extra_users.py | scripts/create_extra_users.py | import requests
from requests.auth import HTTPBasicAuth
users = [
{
"firstName": "Alicja",
"lastName": "Smith",
"login": "ala123",
"email": "ala@localhost.com",
"admin": False,
"password": "password",
},
{
"firstName": "Barbara",
"lastName": "... | Add missing script for extra users | Add missing script for extra users
| Python | mit | whole-tale/girder_deploy,whole-tale/girder_deploy | ---
+++
@@ -0,0 +1,44 @@
+import requests
+from requests.auth import HTTPBasicAuth
+
+users = [
+ {
+ "firstName": "Alicja",
+ "lastName": "Smith",
+ "login": "ala123",
+ "email": "ala@localhost.com",
+ "admin": False,
+ "password": "password",
+ },
+ {
+ "fir... | |
0be39cc9f97f69d8841d0cb8bc402881858ac5d8 | migrations/versions/0144_template_service_letter.py | migrations/versions/0144_template_service_letter.py | """
Revision ID: 0144_template_service_letter
Revises: 0143_remove_reply_to
Create Date: 2017-11-17 15:42:16.401229
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0144_template_service_letter'
down_revision = '0143_remove_reply_to'
def upgrade():
op.ad... | Add a migration to add template service_letter_contact_id columns | Add a migration to add template service_letter_contact_id columns
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,33 @@
+"""
+
+Revision ID: 0144_template_service_letter
+Revises: 0143_remove_reply_to
+Create Date: 2017-11-17 15:42:16.401229
+
+"""
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects import postgresql
+
+revision = '0144_template_service_letter'
+down_revision = '0143_rem... | |
ebb9c3310fa6a1362116a040409b93c2eb756f0d | tests/test_memoty_leak.py | tests/test_memoty_leak.py | import weakref
from tests import BaseTestCase
class TestCase(BaseTestCase):
async def test_on_successful_cleanup_message(self):
rabbitmq_connection = await self.create_connection()
weakset = weakref.WeakSet()
async def f(rabbitmq_connection, weakset):
async with rabbitmq_co... | Add test on memory leak | Add test on memory leak
| Python | apache-2.0 | mosquito/aio-pika | ---
+++
@@ -0,0 +1,21 @@
+import weakref
+
+from tests import BaseTestCase
+
+
+class TestCase(BaseTestCase):
+
+ async def test_on_successful_cleanup_message(self):
+ rabbitmq_connection = await self.create_connection()
+
+ weakset = weakref.WeakSet()
+
+ async def f(rabbitmq_connection, weak... | |
8171734723ddb7203f916191253c30844757176b | setup_cuda_deps.py | setup_cuda_deps.py | #!/usr/bin/env python
from setuptools import setup
setup(
name='chainer-cuda-deps',
version='1.0.0',
description='A flexible framework of neural networks',
author='Seiya Tokui',
author_email='tokui@preferred.jp',
url='http://chainer.org/',
packages=[],
install_requires=[
'pycuda... | Add setup.py for cuda dependency | Add setup.py for cuda dependency
| Python | mit | jnishi/chainer,truongdq/chainer,keisuke-umezawa/chainer,bayerj/chainer,sinhrks/chainer,okuta/chainer,minhpqn/chainer,muupan/chainer,wkentaro/chainer,keisuke-umezawa/chainer,hvy/chainer,wkentaro/chainer,kiyukuta/chainer,ikasumi/chainer,pfnet/chainer,chainer/chainer,ktnyt/chainer,cupy/cupy,okuta/chainer,woodshop/complex-... | ---
+++
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+from setuptools import setup
+
+setup(
+ name='chainer-cuda-deps',
+ version='1.0.0',
+ description='A flexible framework of neural networks',
+ author='Seiya Tokui',
+ author_email='tokui@preferred.jp',
+ url='http://chainer.org/',
+ packages=[],
... | |
4a2456f518294ecc14088a0a5ef225002fa79058 | test/test_accuracyIndicators.py | test/test_accuracyIndicators.py | import os
import time
import pandas as pd
import numpy as np
import tsam.timeseriesaggregation as tsam
def test_accuracyIndicators():
hoursPerPeriod = 24
noTypicalPeriods = 8
raw = pd.read_csv(os.path.join(os.path.dirname(__file__),'..','examples','testdata.csv'), index_col = 0)
starttime = tim... | Test for accuracy indicators implemented | Test for accuracy indicators implemented
| Python | mit | FZJ-IEK3-VSA/tsam | ---
+++
@@ -0,0 +1,44 @@
+import os
+import time
+
+import pandas as pd
+import numpy as np
+
+import tsam.timeseriesaggregation as tsam
+
+
+
+def test_accuracyIndicators():
+
+ hoursPerPeriod = 24
+
+ noTypicalPeriods = 8
+
+ raw = pd.read_csv(os.path.join(os.path.dirname(__file__),'..','examples','testdat... | |
475b1755164f9ccd9b855447fe9f26a59bbaed99 | examples/client_json.py | examples/client_json.py | import aiohttp
import asyncio
@asyncio.coroutine
def go(session):
print('Query http://httpbin.org/get')
resp = yield from session.get(
'http://httpbin.org/get')
print(resp.status)
try:
data = yield from resp.json()
print(data)
finally:
yield from resp.release()
lo... | Add example for retrieving json data | Add example for retrieving json data
| Python | apache-2.0 | KeepSafe/aiohttp,singulared/aiohttp,mind1master/aiohttp,esaezgil/aiohttp,jettify/aiohttp,elastic-coders/aiohttp,esaezgil/aiohttp,decentfox/aiohttp,Srogozins/aiohttp,jashandeep-sohi/aiohttp,singulared/aiohttp,alex-eri/aiohttp-1,z2v/aiohttp,morgan-del/aiohttp,mind1master/aiohttp,playpauseandstop/aiohttp,vaskalas/aiohttp,... | ---
+++
@@ -0,0 +1,26 @@
+import aiohttp
+import asyncio
+
+
+@asyncio.coroutine
+def go(session):
+ print('Query http://httpbin.org/get')
+ resp = yield from session.get(
+ 'http://httpbin.org/get')
+ print(resp.status)
+ try:
+ data = yield from resp.json()
+ print(data)
+ finall... | |
b066ad2e8ceb26373b3baff67a455f10d23275ec | datastructures.py | datastructures.py | #!/usr/bin/env python3
class Triangle:
"""A class structure for storing and minipulating a triangle.
The trianlge is represented as a 3-tuple of points. Each point is
represented as a 2-tuple of floats, the first element being the
x-coordinate and the second element being the y-coordinate.
Severa... | Add Triangle and Shape data structures | Add Triangle and Shape data structures
Added classes, Triangle and Shape, to represent triangles and shapes
respectively.
| Python | mit | moyamo/polygon2square | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+
+class Triangle:
+ """A class structure for storing and minipulating a triangle.
+
+ The trianlge is represented as a 3-tuple of points. Each point is
+ represented as a 2-tuple of floats, the first element being the
+ x-coordinate and the second element ... | |
8f8caf50f51225964e09f25224bb2782bce479a1 | src/sentry/receivers/users.py | src/sentry/receivers/users.py | from __future__ import absolute_import, print_function
from django.db.models.signals import post_syncdb
from sentry.models import User
def create_first_user(app, created_models, verbosity, db, **kwargs):
if User not in created_models:
return
if not kwargs.get('interactive', True):
return
... | from __future__ import absolute_import, print_function
from django.db import router
from django.db.models.signals import post_syncdb
from sentry.models import User
def create_first_user(app, created_models, verbosity, db, **kwargs):
if User not in created_models:
return
if not router.allow_syncdb(db... | Support multi-db for user creation signal | Support multi-db for user creation signal
| Python | bsd-3-clause | BuildingLink/sentry,jean/sentry,beeftornado/sentry,BuildingLink/sentry,jean/sentry,nicholasserra/sentry,ifduyue/sentry,jean/sentry,JamesMura/sentry,ifduyue/sentry,looker/sentry,fotinakis/sentry,looker/sentry,fotinakis/sentry,JamesMura/sentry,mitsuhiko/sentry,gencer/sentry,beeftornado/sentry,nicholasserra/sentry,looker/... | ---
+++
@@ -1,5 +1,6 @@
from __future__ import absolute_import, print_function
+from django.db import router
from django.db.models.signals import post_syncdb
from sentry.models import User
@@ -7,6 +8,8 @@
def create_first_user(app, created_models, verbosity, db, **kwargs):
if User not in created_models... |
3144a6fd412a43b41a1112b1c8e91fbb8bea3f8d | google-url-shortener.py | google-url-shortener.py | import json
import requests
import argparse
import sys
class GUrlShorten():
def __init__(self, key):
self.API_KEY = key
def google_url_shorten(self, url):
req_url = 'https://www.googleapis.com/urlshortener/v1/url?key=' + self.API_KEY
payload = {'longUrl': url}
headers = {'cont... | Add google url shortener example | Add google url shortener example | Python | mit | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | ---
+++
@@ -0,0 +1,54 @@
+import json
+import requests
+import argparse
+import sys
+
+
+class GUrlShorten():
+ def __init__(self, key):
+ self.API_KEY = key
+
+ def google_url_shorten(self, url):
+ req_url = 'https://www.googleapis.com/urlshortener/v1/url?key=' + self.API_KEY
+ payload = {... | |
d892f3ac66f45816de3a9ba1f44d4a4df1bacf07 | pytube/cli.py | pytube/cli.py | import argparse
from .api import YouTube
from .utils import print_status
def _main():
parser = argparse.ArgumentParser(description='YouTube video downloader')
parser.add_argument("url", help="The URL of the Video to be downloaded")
parser.add_argument("--extension", "-e",
help="Th... | Add a command line tool. | Add a command line tool.
| Python | mit | mserjx/pytube,DomainGroupOSS/pytube,harsham05/pytube,harsham05/pytube,garg10may/pytube,garg10may/pytube,pytube/pytube,mserjx/pytube,DomainGroupOSS/pytube | ---
+++
@@ -0,0 +1,46 @@
+import argparse
+
+from .api import YouTube
+from .utils import print_status
+
+
+def _main():
+ parser = argparse.ArgumentParser(description='YouTube video downloader')
+ parser.add_argument("url", help="The URL of the Video to be downloaded")
+ parser.add_argument("--extension", "... | |
6ccaac73969815e4e195cbeb3ead850153c4da12 | mica/starcheck/tests/make_database.py | mica/starcheck/tests/make_database.py | import os
import tempfile
from Chandra.Time import DateTime
from Ska.Shell import bash
import mica.common
# Override MICA_ARCHIVE with a temporary directory
TESTDIR = tempfile.mkdtemp()
mica.common.MICA_ARCHIVE = TESTDIR
# import mica.starcheck.starcheck after setting MICA_ARCHIVE
import mica.starcheck.starcheck
# Ju... | Add a script to make a test starcheck database from recent data | Add a script to make a test starcheck database from recent data
Even on just a few weeks, this seems to take too long to be a
standard test, so I'm just putting the logic here for safekeeping.
It could also be a "long" test for ska_testr, but that wouldn't
conveniently let you check test code compatibility without a d... | Python | bsd-3-clause | sot/mica,sot/mica | ---
+++
@@ -0,0 +1,22 @@
+import os
+import tempfile
+from Chandra.Time import DateTime
+from Ska.Shell import bash
+import mica.common
+
+# Override MICA_ARCHIVE with a temporary directory
+TESTDIR = tempfile.mkdtemp()
+mica.common.MICA_ARCHIVE = TESTDIR
+# import mica.starcheck.starcheck after setting MICA_ARCHIVE
... | |
35d5b923b70acf4fe6cb0dda1466463a00296214 | tests/core/test_projectors.py | tests/core/test_projectors.py | from openfisca_core.simulations.simulation_builder import SimulationBuilder
from openfisca_core.taxbenefitsystems import TaxBenefitSystem
from openfisca_core.entities import build_entity
def test_shortcut_to_containing_entity_provided():
"""
Tests that, when an entity provides a containing entity,
the shor... | Add unit tests for projector shortcut | Add unit tests for projector shortcut
| Python | agpl-3.0 | openfisca/openfisca-core,openfisca/openfisca-core | ---
+++
@@ -0,0 +1,86 @@
+from openfisca_core.simulations.simulation_builder import SimulationBuilder
+from openfisca_core.taxbenefitsystems import TaxBenefitSystem
+from openfisca_core.entities import build_entity
+
+def test_shortcut_to_containing_entity_provided():
+ """
+ Tests that, when an entity provides... | |
cc8ae7df7918375454188f3f5c5d2df0290c0886 | pombola/interests_register/management/commands/interests_register_delete_existing.py | pombola/interests_register/management/commands/interests_register_delete_existing.py | import sys
from optparse import make_option
from django.core.management.base import NoArgsCommand
from ...models import Release, Category, Entry, EntryLineItem
class Command(NoArgsCommand):
help = 'Delete existing declarations of members interests - allows for subsequent re-importing of data.'
option_list = N... | Add members interests delete existing command | Add members interests delete existing command
| Python | agpl-3.0 | ken-muturi/pombola,mysociety/pombola,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,hzj123/56th,patricmutwiri/pombola,geoffkilpin/pombola,hzj123/56th,hzj123/56th,mysociety/pombola,patricmutwiri/pombola,ken-muturi/pombola,patricmutwiri/pombola,ken-muturi/pombola,hzj123/56th,hzj123/56th,patricmutwiri/pombola,k... | ---
+++
@@ -0,0 +1,32 @@
+import sys
+from optparse import make_option
+from django.core.management.base import NoArgsCommand
+from ...models import Release, Category, Entry, EntryLineItem
+
+class Command(NoArgsCommand):
+ help = 'Delete existing declarations of members interests - allows for subsequent re-import... | |
4a9fdb07b18e4b82d575633d52b504c1118e9843 | scripts/rf-send.py | scripts/rf-send.py | import os
import subprocess
# Enter codes for each outlet
codes = {'1': {'on': '21811', 'off': '21820'},
'2': {'on': '21955', 'off': '21964'},
'3': {'on': '22275', 'off': '22284'},
'4': {'on': '23811', 'off': '23820'},
'5': {'on': '29955', 'off': '29964'}}
num = input('Enter outlet... | Add script for sending rf signals. | Add script for sending rf signals.
| Python | bsd-3-clause | kbsezginel/raspberry-pi,kbsezginel/raspberry-pi,kbsezginel/raspberry-pi,kbsezginel/raspberry-pi | ---
+++
@@ -0,0 +1,19 @@
+import os
+import subprocess
+
+# Enter codes for each outlet
+codes = {'1': {'on': '21811', 'off': '21820'},
+ '2': {'on': '21955', 'off': '21964'},
+ '3': {'on': '22275', 'off': '22284'},
+ '4': {'on': '23811', 'off': '23820'},
+ '5': {'on': '29955', 'off': ... | |
f211ebde80454beffd7d8df9633b8b67e7ff73c1 | DataWrangling/process_json.py | DataWrangling/process_json.py | # To experiment with this code freely you will have to run this code locally.
# Take a look at the main() function for an example of how to use the code.
# We have provided example json output in the other code editor tabs for you to
# look at, but you will not be able to run any queries through our UI.
import json
imp... | Add scripts to process json files | feat: Add scripts to process json files
Reads a json files, process it, and apply some functions to get
data
| Python | mit | aguijarro/DataSciencePython | ---
+++
@@ -0,0 +1,76 @@
+# To experiment with this code freely you will have to run this code locally.
+# Take a look at the main() function for an example of how to use the code.
+# We have provided example json output in the other code editor tabs for you to
+# look at, but you will not be able to run any queries ... | |
5a46337647436b1f39562d4f5664a7833b87c269 | __init__.py | __init__.py |
import requests
# Yummly API: https://developer.yummly.com
# API URLs
URL_BASE = 'http://api.yummly.com/v1'
URL_GET = URL_BASE + '/api/recipe/'
URL_SEARCH = URL_BASE + '/api/recipes'
# API auth properties which should be set externally
api_id = None
api_key = None
# basic request config options
# @note: h... | Add yummly.recipe and yummly.search functions. | Add yummly.recipe and yummly.search functions.
| Python | mit | dgilland/yummly.py | ---
+++
@@ -0,0 +1,96 @@
+
+import requests
+
+# Yummly API: https://developer.yummly.com
+
+# API URLs
+URL_BASE = 'http://api.yummly.com/v1'
+URL_GET = URL_BASE + '/api/recipe/'
+URL_SEARCH = URL_BASE + '/api/recipes'
+
+# API auth properties which should be set externally
+api_id = None
+api_key = None
+
... | |
83dfc8b5f2e614a1b16b23c3d33f39935709d6fa | testing/ufl_fix.py | testing/ufl_fix.py | from __future__ import absolute_import, print_function, division
from firedrake import *
mesh = UnitSquareMesh(2, 2)
V = FunctionSpace(mesh, "RT", 1)
f1 = Function(V)
f2 = Function(V)
# Apply a strong condition at the top of the square domain
bc1 = DirichletBC(V, Constant((0.0, 10.0)), 4)
bc1.apply(f1)
bc2 = Diri... | Add Constant vs Expression testing | Add Constant vs Expression testing
| Python | mit | thomasgibson/firedrake-hybridization | ---
+++
@@ -0,0 +1,20 @@
+from __future__ import absolute_import, print_function, division
+
+from firedrake import *
+
+mesh = UnitSquareMesh(2, 2)
+
+V = FunctionSpace(mesh, "RT", 1)
+f1 = Function(V)
+f2 = Function(V)
+
+# Apply a strong condition at the top of the square domain
+bc1 = DirichletBC(V, Constant((0.0... | |
c0b97e072664440dcdd79a98a69536834a1e172b | rabbitmq_status.py | rabbitmq_status.py | #!/usr/bin/env python
import requests
import sys
OVERVIEW_URL = "http://localhost:55672/api/overview"
NODES_URL = "http://localhost:55672/api/nodes"
USERNAME = 'guest'
PASSWORD = 'guest'
OVERVIEW_METRICS = {"queue_totals": ("messages",
"messages_ready",
... | Return details about RabbitMQ server | Return details about RabbitMQ server
| Python | apache-2.0 | xeregin/rpc-openstack,claco/rpc-openstack,hughsaunders/rpc-openstack,busterswt/rpc-openstack,xeregin/rpc-openstack,claco/rpc-openstack,git-harry/rpc-openstack,byronmccollum/rpc-openstack,darrenchan/rpc-openstack,mattt416/rpc-openstack,sigmavirus24/rpc-openstack,mattt416/rpc-openstack,byronmccollum/rpc-openstack,shannon... | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+import requests
+import sys
+
+OVERVIEW_URL = "http://localhost:55672/api/overview"
+NODES_URL = "http://localhost:55672/api/nodes"
+USERNAME = 'guest'
+PASSWORD = 'guest'
+
+OVERVIEW_METRICS = {"queue_totals": ("messages",
+ "mess... | |
a707998d54d584cec90b17b4d34c9401ba802844 | mistral/db/sqlalchemy/migration/alembic_migrations/versions/011_add_workflow_id_for_execution.py | mistral/db/sqlalchemy/migration/alembic_migrations/versions/011_add_workflow_id_for_execution.py | # Copyright 2016 OpenStack Foundation.
#
# 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 ... | Add workflow id column to executions_v2 table | Add workflow id column to executions_v2 table
Partially implements: blueprint use-workflow-id-in-rest-api
Change-Id: Iad7f1024576b31307016c0f1b4057c794bf4e30b
| Python | apache-2.0 | openstack/mistral,StackStorm/mistral,StackStorm/mistral,openstack/mistral | ---
+++
@@ -0,0 +1,36 @@
+# Copyright 2016 OpenStack Foundation.
+#
+# 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 require... | |
1f0660579f35b1913bb4dc5f973532ec47d4de26 | DilipadTopicModelling/experiment_number_of_topics.py | DilipadTopicModelling/experiment_number_of_topics.py | import logging
import glob
from multiprocessing import Process
from CPTCorpus import CPTCorpus
from CPT_Gibbs import GibbsSampler
def run_sampler(corpus, nTopics, nIter, beta, out_dir):
sampler = GibbsSampler(corpus, nTopics=nTopics, nIter=nIter,
alpha=(50.0/n), beta=beta, beta_o=beta,... | Add script to run a series of experiments | Add script to run a series of experiments
The script does Gibbs sampling for different values of nTopics.
| Python | apache-2.0 | NLeSC/cptm,NLeSC/cptm | ---
+++
@@ -0,0 +1,55 @@
+import logging
+import glob
+from multiprocessing import Process
+
+from CPTCorpus import CPTCorpus
+from CPT_Gibbs import GibbsSampler
+
+
+def run_sampler(corpus, nTopics, nIter, beta, out_dir):
+ sampler = GibbsSampler(corpus, nTopics=nTopics, nIter=nIter,
+ a... | |
0f3dbed232e73dfa63c219402fff5c74a0f107bc | django_graphene_utils/pager.py | django_graphene_utils/pager.py | import graphene
from graphene.utils.str_converters import to_camel_case
from django.utils import six
from django.utils.functional import cached_property
__all__ = ['Pager']
class BasePager(object):
def __init__(self, data, queryset, default_size=20):
# process data
self.qs = self._process_data(da... | Add a way to handle sorts & pagination | Add a way to handle sorts & pagination
| Python | mit | amille44420/django-graphene-utils | ---
+++
@@ -0,0 +1,93 @@
+import graphene
+from graphene.utils.str_converters import to_camel_case
+from django.utils import six
+from django.utils.functional import cached_property
+
+__all__ = ['Pager']
+
+
+class BasePager(object):
+ def __init__(self, data, queryset, default_size=20):
+ # process data
+... | |
484b72439d1a6005eeb9fbab8a77bfa55e9d3228 | tests/test_tree.py | tests/test_tree.py | import milk.supervised.tree
import numpy as np
import tests.data.german.german
def test_tree():
data = tests.data.german.german.load()
features = data['data']
labels = data['label']
C = milk.supervised.tree.tree_classifier()
C.train(features,labels)
assert ((np.array([C.apply(f) for f in featur... | Test tree for >50% accuracy | Test tree for >50% accuracy
| Python | mit | pombredanne/milk,pombredanne/milk,pombredanne/milk,luispedro/milk,luispedro/milk,luispedro/milk | ---
+++
@@ -0,0 +1,12 @@
+import milk.supervised.tree
+import numpy as np
+import tests.data.german.german
+
+def test_tree():
+ data = tests.data.german.german.load()
+ features = data['data']
+ labels = data['label']
+ C = milk.supervised.tree.tree_classifier()
+ C.train(features,labels)
+ assert ... | |
ff9de1ab494ee5d48dba7aa84dfa1ce114464f09 | py/tests/global_alpha_test.py | py/tests/global_alpha_test.py | #!/usr/bin/python3
import pykms
import time
card = pykms.Card()
res = pykms.ResourceManager(card)
conn = res.reserve_connector("")
crtc = res.reserve_crtc(conn)
mode = conn.get_default_mode()
modeb = mode.to_blob(card)
format = pykms.PixelFormat.ARGB8888
plane1 = res.reserve_generic_plane(crtc, format)
plane2 = res.r... | Add globa_alpha_test.py for DRM per plane "alpha" property testing | Add globa_alpha_test.py for DRM per plane "alpha" property testing
| Python | mpl-2.0 | tomba/kmsxx,tomba/kmsxx,tomba/kmsxx,tomba/kmsxx | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/python3
+
+import pykms
+import time
+
+card = pykms.Card()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector("")
+crtc = res.reserve_crtc(conn)
+mode = conn.get_default_mode()
+modeb = mode.to_blob(card)
+format = pykms.PixelFormat.ARGB8888
+plane1 = res.reserve_ge... | |
aba7b56ecfad85b006b9159926b1458a6f39847e | pylxd/tests/test_operation.py | pylxd/tests/test_operation.py | from pylxd import operation
from pylxd.tests import testing
class TestOperation(testing.PyLXDTestCase):
"""Tests for pylxd.operation.Operation."""
def test_get(self):
"""Return an operation."""
name = 'operation-abc'
an_operation = operation.Operation.get(self.client, name)
... | Add test coverage for Operation | Add test coverage for Operation
| Python | apache-2.0 | lxc/pylxd,lxc/pylxd | ---
+++
@@ -0,0 +1,22 @@
+from pylxd import operation
+from pylxd.tests import testing
+
+
+class TestOperation(testing.PyLXDTestCase):
+ """Tests for pylxd.operation.Operation."""
+
+ def test_get(self):
+ """Return an operation."""
+ name = 'operation-abc'
+
+ an_operation = operation.Ope... | |
23ab053ff9483cef63df0c3322d3d53086a2d273 | tests/ODBPy/TestAttributes.py | tests/ODBPy/TestAttributes.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from nose.tools import assert_equal, assert_true, assert_false, raises, assert_is_none
from ODBPy.Attributes import *
class TestAttributes(object):
def test_parse_attributes_from_line(self):
assert_equal({0: 0, 2: 0}, parse_attributes_from_line(
"P... | Fix missing unit test file | Fix missing unit test file
| Python | apache-2.0 | ulikoehler/ODBPy | ---
+++
@@ -0,0 +1,11 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+from nose.tools import assert_equal, assert_true, assert_false, raises, assert_is_none
+from ODBPy.Attributes import *
+
+class TestAttributes(object):
+ def test_parse_attributes_from_line(self):
+ assert_equal({0: 0, 2: 0}, parse_a... | |
a4dfdc82749873fefac1d0a5a411e178ed9f6da9 | tests/test_core/test_utils.py | tests/test_core/test_utils.py | from __future__ import unicode_literals
import sure
from moto.core.utils import camelcase_to_underscores
def test_camelcase_to_underscores():
cases = {
"theNewAttribute": "the_new_attribute",
"attri bute With Space": "attribute_with_space",
"FirstLetterCapital": "first_letter_capital",
... | Add basic tests for moto.core.utils.camelcase_to_underscores() | Add basic tests for moto.core.utils.camelcase_to_underscores()
| Python | apache-2.0 | whummer/moto,spulec/moto,heddle317/moto,william-richard/moto,2rs2ts/moto,IlyaSukhanov/moto,gjtempleton/moto,spulec/moto,whummer/moto,braintreeps/moto,botify-labs/moto,william-richard/moto,okomestudio/moto,tootedom/moto,whummer/moto,Affirm/moto,dbfr3qs/moto,rocky4570/moto,ZuluPro/moto,botify-labs/moto,gjtempleton/moto,2... | ---
+++
@@ -0,0 +1,14 @@
+from __future__ import unicode_literals
+import sure
+
+from moto.core.utils import camelcase_to_underscores
+
+
+def test_camelcase_to_underscores():
+ cases = {
+ "theNewAttribute": "the_new_attribute",
+ "attri bute With Space": "attribute_with_space",
+ "FirstLett... | |
f3df949b52a90f4bb8a51634eb41b4f0fb196b4a | examples/comp/set_input_on_selected_loaders.py | examples/comp/set_input_on_selected_loaders.py | """Enable the 'Loop' input for all selected loaders"""
import fusionless as fu
import fusionless.context as fuCtx
c = fu.Comp()
with fuCtx.lock_and_undo_chunk(c, "Set loaders to loop"):
for tool in c.get_selected_tools(node_type="Loader"):
loop = tool.input("Loop").set_value(True)
| Add set input on selected loaders example | Add set input on selected loaders example
| Python | bsd-3-clause | BigRoy/fusionscript,BigRoy/fusionless | ---
+++
@@ -0,0 +1,10 @@
+"""Enable the 'Loop' input for all selected loaders"""
+
+import fusionless as fu
+import fusionless.context as fuCtx
+
+c = fu.Comp()
+with fuCtx.lock_and_undo_chunk(c, "Set loaders to loop"):
+
+ for tool in c.get_selected_tools(node_type="Loader"):
+ loop = tool.input("Loop").se... | |
667d6e6d0634a39daaa39145bc037f63465b8ee2 | tools/visual/show_tracking.py | tools/visual/show_tracking.py | #!/usr/bin/env python
import argparse
import os
import sys
sys.path.insert(1, 'external')
from vdetlib.vdet.dataset import imagenet_vdet_classes
from vdetlib.utils.visual import unique_colors, add_bbox
from vdetlib.utils.common import imread, imwrite
from vdetlib.utils.protocol import proto_dump, proto_load, top_detec... | Add a script to show tracking results. | Add a script to show tracking results.
| Python | mit | myfavouritekk/TPN | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+import argparse
+import os
+import sys
+sys.path.insert(1, 'external')
+from vdetlib.vdet.dataset import imagenet_vdet_classes
+from vdetlib.utils.visual import unique_colors, add_bbox
+from vdetlib.utils.common import imread, imwrite
+from vdetlib.utils.protocol imp... | |
c3dbea85b4017fe34e856bfc9dc94ecc2966b4b1 | mica/archive/tests/test_aca_l0.py | mica/archive/tests/test_aca_l0.py | from __future__ import division
from astropy.table import Table
import numpy as np
from mica.archive import aca_l0, asp_l1
from Ska.Numpy import interpolate
def test_get_l0_images():
"""
Do a validation test of get_l0_images:
- Get 20 mins of image data for slot 6 of obsid 8008 (very nice clean stars)
... | Add minimal tests for aca_l0 | Add minimal tests for aca_l0
| Python | bsd-3-clause | sot/mica,sot/mica | ---
+++
@@ -0,0 +1,53 @@
+from __future__ import division
+
+from astropy.table import Table
+import numpy as np
+from mica.archive import aca_l0, asp_l1
+from Ska.Numpy import interpolate
+
+
+def test_get_l0_images():
+ """
+ Do a validation test of get_l0_images:
+ - Get 20 mins of image data for slot 6 o... | |
bb96824958117e586919499124a550668b05f5a2 | utilities/transInputData.py | utilities/transInputData.py | #! /usr/bin/python
import sys, os
if len(sys.argv) < 3:
print('Translate input data in AAAI\'15 format to separate config, men, women files.')
print('Usage: {} <input file> <output directory>'.format(sys.argv[0]))
sys.exit(1)
infile = sys.argv[1]
outdir = sys.argv[2]
if os.path.exists(outdir):
raise... | Add utility to translate input data format. | Add utility to translate input data format.
| Python | apache-2.0 | gaomy3832/spark-smti,gaomy3832/spark-smti | ---
+++
@@ -0,0 +1,43 @@
+#! /usr/bin/python
+
+import sys, os
+
+if len(sys.argv) < 3:
+ print('Translate input data in AAAI\'15 format to separate config, men, women files.')
+ print('Usage: {} <input file> <output directory>'.format(sys.argv[0]))
+ sys.exit(1)
+
+infile = sys.argv[1]
+outdir = sys.argv[2]... | |
201d5ac1385f0800c6386e564483add3229ded2a | contrib/afl-fuzz.py | contrib/afl-fuzz.py | #!/usr/bin/python3
# SPDX-License-Identifier: LGPL-2.1+
import argparse
import sys
import subprocess
import os
def main():
parser = argparse.ArgumentParser(description='Run afl-fuzz on all cores')
parser.add_argument('--input', '-i', help='fuzzing input directory')
parser.add_argument('--output', '-o', he... | Add a parallel fuzzing script | trivial: Add a parallel fuzzing script
This approximately doubles performace of fuzzing for every two cores you have.
| Python | lgpl-2.1 | hughsie/fwupd,hughsie/fwupd,fwupd/fwupd,fwupd/fwupd,fwupd/fwupd,hughsie/fwupd,hughsie/fwupd,fwupd/fwupd | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1+
+
+import argparse
+import sys
+import subprocess
+import os
+
+def main():
+ parser = argparse.ArgumentParser(description='Run afl-fuzz on all cores')
+ parser.add_argument('--input', '-i', help='fuzzing input directory')
+ p... | |
0057ea58b488f2c92b621f1312c5088a7395987d | indexer.py | indexer.py | #-*- coding:utf-8 -*-
import redis
import simplejson
import mmseg
r = redis.Redis ("localhost")
mmseg.Dictionary.load_dictionaries()
database='database:book'
indexbase='index:book'
def rebuild_index (items):
del_index ()
build_index (items)
def del_index ():
prefixs = r.smembers (indexbase)
for prefix in p... | Build index ready for autocomplete. | Build index ready for autocomplete.
* indexer.py (rebuild_index, del_index, build_index,
add_item, del_item, prefixs_for_term, search_query,
load_items): New.
| Python | mit | fengli/autocomplete-redis | ---
+++
@@ -0,0 +1,70 @@
+#-*- coding:utf-8 -*-
+
+import redis
+import simplejson
+import mmseg
+
+r = redis.Redis ("localhost")
+mmseg.Dictionary.load_dictionaries()
+
+database='database:book'
+indexbase='index:book'
+
+def rebuild_index (items):
+ del_index ()
+ build_index (items)
+
+def del_index ():
+ prefi... | |
b0a74635399c86694b12587e91334886b434bca5 | corehq/ex-submodules/couchforms/management/commands/one_off_resave_forms.py | corehq/ex-submodules/couchforms/management/commands/one_off_resave_forms.py | """
ATTENTION!
If you see this file after the year 2015, please delete it immediately.
"""
import sys
from django.core.management.base import BaseCommand
from datetime import datetime
from corehq.apps.sofabed.models import FormData
from corehq.pillows.xform import XFormPillow
from corehq.pillows.reportxform import Repo... | Add one off mgmt cmd to resubmit some forms to ES | Add one off mgmt cmd to resubmit some forms to ES
http://manage.dimagi.com/default.asp?187526
| Python | bsd-3-clause | qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,33 @@
+"""
+ATTENTION!
+If you see this file after the year 2015, please delete it immediately.
+"""
+import sys
+from django.core.management.base import BaseCommand
+from datetime import datetime
+from corehq.apps.sofabed.models import FormData
+from corehq.pillows.xform import XFormPillow
+from c... | |
0251a4a4670ee7ae28fe58cbd313688bf20ba986 | tbmodels/_kdotp.py | tbmodels/_kdotp.py | import numpy as np
import scipy.linalg as la
from fsc.export import export
from fsc.hdf5_io import subscribe_hdf5, SimpleHDF5Mapping
@export
@subscribe_hdf5('tbmodels.model', check_on_load=False)
class KdotpModel(SimpleHDF5Mapping):
HDF5_ATTRIBUTES = ['taylor_coefficients']
def __init__(self, taylor_coeffic... | Add prototype for k.p class. | Add prototype for k.p class.
| Python | apache-2.0 | Z2PackDev/TBmodels,Z2PackDev/TBmodels | ---
+++
@@ -0,0 +1,23 @@
+import numpy as np
+import scipy.linalg as la
+
+from fsc.export import export
+from fsc.hdf5_io import subscribe_hdf5, SimpleHDF5Mapping
+
+
+@export
+@subscribe_hdf5('tbmodels.model', check_on_load=False)
+class KdotpModel(SimpleHDF5Mapping):
+ HDF5_ATTRIBUTES = ['taylor_coefficients']
... | |
f9a185fa48785b1c39d861fc13742356fe832313 | Tests/ConfTest.py | Tests/ConfTest.py | import requests
import json
CLOUD_END_POINT = "http://211.249.49.198:5000"
def test_IsHomePageWorking():
homePageRequest = requests.get(CLOUD_END_POINT)
assert homePageRequest.text == "Hello world"
def test_UploadTestData():
testUploadData = {
"Data": [20.0, 30.0, 401.0, 50.0, 60.0],
"Dat... | Test module : some test sinario added | Test module : some test sinario added
| Python | mit | I2MAX-LearningProject/Flask-server,I2MAX-LearningProject/Flask-server,I2MAX-LearningProject/Flask-server,I2MAX-LearningProject/Flask-server | ---
+++
@@ -0,0 +1,38 @@
+import requests
+import json
+
+CLOUD_END_POINT = "http://211.249.49.198:5000"
+
+def test_IsHomePageWorking():
+ homePageRequest = requests.get(CLOUD_END_POINT)
+ assert homePageRequest.text == "Hello world"
+
+def test_UploadTestData():
+ testUploadData = {
+ "Data": [20.0,... | |
ef48d9fa9b15704c0fd4be897da1e29f7e359cc7 | app/textutils.py | app/textutils.py | # Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Add utility function to split .gh file into thms | Add utility function to split .gh file into thms
This commit starts some new text utilities which will be useful for
extracting an individual thm from a .gh, for editing.
| Python | apache-2.0 | raphlinus/ghilbert,raphlinus/ghilbert,jkingdon/ghilbert,kryptine/ghilbert,raphlinus/ghilbert,kryptine/ghilbert,jkingdon/ghilbert,raphlinus/ghilbert | ---
+++
@@ -0,0 +1,80 @@
+# Copyright 2012 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by app... | |
f0d5dae0823f083dfe66caae12960ee32fc32967 | autohost_manager.py | autohost_manager.py | """
TODO Mon?: Autohost manager for AliCatFiberarts (and others).
* Have a list of high priority streams, in order (or with priorities)
* Listen for, or poll for, streams going live
* If (a) a high priority stream has just gone live, and (b) you are currently hosting, and (c) the hosted stream has lower priority
* Then... | Create a file with nothing but a TODO in it | ahm: Create a file with nothing but a TODO in it
| Python | mit | Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed | ---
+++
@@ -0,0 +1,9 @@
+"""
+TODO Mon?: Autohost manager for AliCatFiberarts (and others).
+* Have a list of high priority streams, in order (or with priorities)
+* Listen for, or poll for, streams going live
+* If (a) a high priority stream has just gone live, and (b) you are currently hosting, and (c) the hosted s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.