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 |
|---|---|---|---|---|---|---|---|---|---|---|
986e1283eacdca354ac56e590f6613b5f323758a | spec/integrations_spec.py | spec/integrations_spec.py | from expects import expect, be
from doublex import Spy
from doublex_expects import have_been_called
from pysellus import integrations
from pysellus.integrations import on_failure
with description('the integrations module'):
with context('exposes an `on_failure` decorator which'):
with before.each:
... | Add two basic tests for `on_failure`. | Add two basic tests for `on_failure`.
| Python | mit | angelsanz/pysellus,Pysellus/pysellus,cgvarela/pysellus,ergl/pysellus | ---
+++
@@ -0,0 +1,27 @@
+from expects import expect, be
+from doublex import Spy
+from doublex_expects import have_been_called
+
+from pysellus import integrations
+from pysellus.integrations import on_failure
+
+
+with description('the integrations module'):
+ with context('exposes an `on_failure` decorator whic... | |
d6019cc60cf90d57a4804d8942a8fd1ccc7431f2 | openfisca_senegal/survey_scenarios.py | openfisca_senegal/survey_scenarios.py | # -*- coding: utf-8 -*-
from openfisca_senegal import CountryTaxBenefitSystem as SenegalTaxBenefitSystem
from openfisca_survey_manager.scenarios import AbstractSurveyScenario
class SenegalSurveyScenario(AbstractSurveyScenario):
id_variable_by_entity_key = dict(
famille = 'id_famille',
)
role... | Add SurveyScenario adapted to SenegalTaxBenFitSystem | Add SurveyScenario adapted to SenegalTaxBenFitSystem
| Python | agpl-3.0 | openfisca/senegal | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+from openfisca_senegal import CountryTaxBenefitSystem as SenegalTaxBenefitSystem
+
+from openfisca_survey_manager.scenarios import AbstractSurveyScenario
+
+
+class SenegalSurveyScenario(AbstractSurveyScenario):
+ id_variable_by_entity_key = dict(
+ famil... | |
4088b0b3f4c5bf9887bdbe7fd43c5944dc1bceb7 | tests/python_tests/test_array_index.py | tests/python_tests/test_array_index.py | import pytest
import xchainer
def test_newaxis():
assert xchainer.newaxis is None
def test_broadcastable():
assert xchainer.broadcastable is xchainer.broadcastable
| Add simple tests of newaxis and broadcastable python binding | Add simple tests of newaxis and broadcastable python binding
| Python | mit | okuta/chainer,niboshi/chainer,hvy/chainer,jnishi/chainer,jnishi/chainer,niboshi/chainer,tkerola/chainer,hvy/chainer,chainer/chainer,wkentaro/chainer,keisuke-umezawa/chainer,chainer/chainer,ktnyt/chainer,okuta/chainer,hvy/chainer,wkentaro/chainer,keisuke-umezawa/chainer,niboshi/chainer,okuta/chainer,jnishi/chainer,jnish... | ---
+++
@@ -0,0 +1,11 @@
+import pytest
+
+import xchainer
+
+
+def test_newaxis():
+ assert xchainer.newaxis is None
+
+
+def test_broadcastable():
+ assert xchainer.broadcastable is xchainer.broadcastable | |
7378250087986dfeb1194b063d7b17e902d6bdcb | backend/breach/migrations/0001_initial.py | backend/breach/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-27 11:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations... | Add migration to first version of BREACH models | Add migration to first version of BREACH models
| Python | mit | esarafianou/rupture,esarafianou/rupture,dionyziz/rupture,esarafianou/rupture,dionyziz/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dimriou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dimriou/rupture,dimriou/rupture,dionyziz/rupture,dimriou/rupture,dimriou/rupture,dionyziz/rupture,di... | ---
+++
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.2 on 2016-02-27 11:55
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ ... | |
af35c0cbf26b848dbc09813102a88c82f3d61280 | src/main/python/combine_tlda_result.py | src/main/python/combine_tlda_result.py | # -*- coding: utf-8 -*-
__author__ = 'stefanie & DJ'
'''
'''
import sys, os, re, shutil
def analyzeTopics(inputTopic):
str = inputTopic.read()
strwithoutEnter = str.replace("\n", "")
#In this case, '' should be in the beginning since it's before Topic 0
lineTopics = strwithoutEnter.split("Topic")
p... | Revert "Revert "the util to combine message"" | Revert "Revert "the util to combine message""
This reverts commit 91537f48ebd3af6e5d74f14be8bcf12b225f7c81.
| Python | apache-2.0 | anphoenix/demo_nlp_im,anphoenix/demo_nlp_im | ---
+++
@@ -0,0 +1,85 @@
+# -*- coding: utf-8 -*-
+__author__ = 'stefanie & DJ'
+
+
+'''
+
+'''
+
+import sys, os, re, shutil
+
+def analyzeTopics(inputTopic):
+ str = inputTopic.read()
+ strwithoutEnter = str.replace("\n", "")
+#In this case, '' should be in the beginning since it's before Topic 0
+ lineTop... | |
5c946b79b5060c7b1dbab3d86ba13cd8e2243add | 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... | Create the User & UserProfile API resources (probably needs restrictions to avoid anyone getting all entries in the DB…). | Create the User & UserProfile API resources (probably needs restrictions to avoid anyone getting all entries in the DB…). | Python | agpl-3.0 | 1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow | ---
+++
@@ -0,0 +1,40 @@
+# -*- 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 = ... | |
bb9d02276db7b753837119797c6a61fc4128d20e | tests/test_metrics.py | tests/test_metrics.py | from husc import metrics
import numpy as np
import os
import pandas as pd
from pymongo import MongoClient
import subprocess as sp
abspath = os.path.dirname(__file__)
def string2tuple(string_tuple):
# TODO add docstring
string_values = string_tuple.split(', ')
coords = (int(string_values[0][1:]), string_va... | Add tests for metrics functions | Add tests for metrics functions
| Python | bsd-3-clause | jni/microscopium,microscopium/microscopium,Don86/microscopium,Don86/microscopium,jni/microscopium,starcalibre/microscopium,microscopium/microscopium | ---
+++
@@ -0,0 +1,47 @@
+from husc import metrics
+import numpy as np
+import os
+import pandas as pd
+from pymongo import MongoClient
+import subprocess as sp
+
+abspath = os.path.dirname(__file__)
+
+def string2tuple(string_tuple):
+ # TODO add docstring
+ string_values = string_tuple.split(', ')
+ coords... | |
074e9d6328cb8e699c9afe717f70e15e884dd3d6 | test_goodRqst_sockserver.py | test_goodRqst_sockserver.py | #!/usr/bin/env python
import socket_server, pytest, socket
address= ('127.0.0.1', 50000)
tester_client= socket.socket(
socket.AF_INET,
socket.SOCK_STREAM,
socket.IPPROTO_IP)
def test_good_request():
request= "GET www.wombatlyfe.com HTTP/1.1\r\n"
tester_client.connect(address)
tester_client.sen... | Add test to ensure that a proper output is recieved by client when proper request is made | Add test to ensure that a proper output is recieved by client when proper request is made
| Python | mit | charlieRode/network_tools | ---
+++
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+import socket_server, pytest, socket
+
+address= ('127.0.0.1', 50000)
+tester_client= socket.socket(
+ socket.AF_INET,
+ socket.SOCK_STREAM,
+ socket.IPPROTO_IP)
+
+def test_good_request():
+ request= "GET www.wombatlyfe.com HTTP/1.1\r\n"
+ tester_client... | |
01fc606eabef14dca0b3e7f6b2a5e5a52c360fba | condor/python/resync_dashboards.py | condor/python/resync_dashboards.py | #!/usr/bin/env python
import argparse
import sys
import logging
import elasticsearch
import elasticsearch.helpers
ES_NODES = 'uct2-es-door.mwt2.org'
VERSION = '0.1'
SOURCE_INDEX = '.kibana'
TARGET_INDEX = 'osg-connect-kibana'
def get_es_client():
""" Instantiate DB client and pass connection back """
retur... | Add script to sync dashboards | Add script to sync dashboards
| Python | apache-2.0 | DHTC-Tools/logstash-confs,DHTC-Tools/logstash-confs,DHTC-Tools/logstash-confs | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+import argparse
+import sys
+import logging
+
+import elasticsearch
+import elasticsearch.helpers
+
+
+ES_NODES = 'uct2-es-door.mwt2.org'
+VERSION = '0.1'
+SOURCE_INDEX = '.kibana'
+TARGET_INDEX = 'osg-connect-kibana'
+
+def get_es_client():
+ """ Instantiate DB c... | |
8038e55e93b7e307d02c1f88527e06202801579e | notebooks/Model_Output/solutions/map.py | notebooks/Model_Output/solutions/map.py | import numpy as np
# Set up an NCSS query from thredds using siphon
query = ncss.query()
query.accept('netcdf4')
query.variables('Temperature_isobaric', 'Geopotential_height_isobaric')
query.vertical_level(50000)
now = datetime.utcnow()
query.time_range(now, now + timedelta(days=1))
query.lonlat_box(west=-110, east=-4... | Add solutions script for ModelOutput | Add solutions script for ModelOutput
| Python | mit | julienchastang/unidata-python-workshop,Unidata/unidata-python-workshop,julienchastang/unidata-python-workshop | ---
+++
@@ -0,0 +1,39 @@
+import numpy as np
+
+# Set up an NCSS query from thredds using siphon
+query = ncss.query()
+query.accept('netcdf4')
+query.variables('Temperature_isobaric', 'Geopotential_height_isobaric')
+query.vertical_level(50000)
+now = datetime.utcnow()
+query.time_range(now, now + timedelta(days=1))... | |
aca9fde589adba08fe335b2441c73e3f3769cf67 | paasta_tools/contrib/shared_ip_check.py | paasta_tools/contrib/shared_ip_check.py | import sys
from collections import defaultdict
from paasta_tools.utils import get_docker_client
def main():
docker_client = get_docker_client()
ip_to_containers = defaultdict(list)
for container in docker_client.containers():
networks = container['NetworkSettings']['Networks']
if 'bridge... | Add script to monitor for containers sharing an IP | Add script to monitor for containers sharing an IP
| Python | apache-2.0 | somic/paasta,Yelp/paasta,somic/paasta,Yelp/paasta | ---
+++
@@ -0,0 +1,40 @@
+import sys
+from collections import defaultdict
+
+from paasta_tools.utils import get_docker_client
+
+
+def main():
+ docker_client = get_docker_client()
+ ip_to_containers = defaultdict(list)
+
+ for container in docker_client.containers():
+ networks = container['NetworkSe... | |
671825d63458712ca06dbcd1fe2028d64aa48e7d | jarn/mkrelease/tests/test_defaults.py | jarn/mkrelease/tests/test_defaults.py | import unittest
from jarn.mkrelease.mkrelease import Defaults
from jarn.mkrelease.testing import JailSetup
class DefaultsTests(JailSetup):
def test_defaults_defaults(self):
self.mkfile('my.cfg', """
[mkrelease]
""")
defaults = Defaults('my.cfg')
self.assertEqual(defaults.distbase, '')
... | Add tests for new defaults. | Add tests for new defaults.
| Python | bsd-2-clause | Jarn/jarn.mkrelease | ---
+++
@@ -0,0 +1,67 @@
+import unittest
+
+from jarn.mkrelease.mkrelease import Defaults
+
+from jarn.mkrelease.testing import JailSetup
+
+
+class DefaultsTests(JailSetup):
+
+ def test_defaults_defaults(self):
+ self.mkfile('my.cfg', """
+[mkrelease]
+""")
+ defaults = Defaults('my.cfg')
+ ... | |
d65182338acfc58bc4b87c1b9c506dd2b2c80a38 | project2/stepwise_forward_selection.py | project2/stepwise_forward_selection.py | """ Created by Max Robinson 9/20/2017 """
class SFS:
pass
"""
Pseudo code
function SFS(Features, D_train, D_valid, Learn()):
F_0 = <>
basePerf = -inf
do:
bestPerf = - inf
for all Features in FeatureSpace do:
F_0 = F_0 + F
h = Learn(F_0, D_train)
... | Add skeleton for SFS algorithm | Add skeleton for SFS algorithm
| Python | apache-2.0 | MaxRobinson/CS449,MaxRobinson/CS449,MaxRobinson/CS449 | ---
+++
@@ -0,0 +1,36 @@
+""" Created by Max Robinson 9/20/2017 """
+
+
+class SFS:
+ pass
+
+
+"""
+Pseudo code
+
+function SFS(Features, D_train, D_valid, Learn()):
+ F_0 = <>
+ basePerf = -inf
+ do:
+ bestPerf = - inf
+ for all Features in FeatureSpace do:
+ F_0 = F_0 + F
+ ... | |
b365e5132a819e357bd960721fd7506fe538bbbf | corehq/apps/es/fake/forms_fake.py | corehq/apps/es/fake/forms_fake.py | from copy import deepcopy
from dateutil import parser
from corehq.pillows.xform import transform_xform_for_elasticsearch
from corehq.apps.es.fake.es_query_fake import HQESQueryFake
class FormESFake(HQESQueryFake):
_all_docs = []
def domain(self, domain):
return self._filtered(
lambda doc:... | Add a fake es forms orm | Add a fake es forms orm
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,29 @@
+from copy import deepcopy
+from dateutil import parser
+from corehq.pillows.xform import transform_xform_for_elasticsearch
+from corehq.apps.es.fake.es_query_fake import HQESQueryFake
+
+
+class FormESFake(HQESQueryFake):
+ _all_docs = []
+
+ def domain(self, domain):
+ return s... | |
c179aaeacd8d2b9c78831e6e3cce965b2eb58210 | spectral_cube/tests/test_cube_utils.py | spectral_cube/tests/test_cube_utils.py | import pytest
import numpy as np
from astropy import units as u
from astropy import convolution
from astropy.wcs import WCS
from astropy import wcs
from .test_spectral_cube import cube_and_raw
from ..cube_utils import largest_beam, smallest_beam
try:
from radio_beam import beam, Beam
RADIO_BEAM_INSTALLED = Tr... | Add tests for largest and smallest beams | Add tests for largest and smallest beams
| Python | bsd-3-clause | jzuhone/spectral-cube,radio-astro-tools/spectral-cube,keflavich/spectral-cube,low-sky/spectral-cube,e-koch/spectral-cube | ---
+++
@@ -0,0 +1,41 @@
+import pytest
+import numpy as np
+from astropy import units as u
+from astropy import convolution
+from astropy.wcs import WCS
+from astropy import wcs
+
+from .test_spectral_cube import cube_and_raw
+from ..cube_utils import largest_beam, smallest_beam
+
+try:
+ from radio_beam import b... | |
0c53edae37f87c8ef7cd46f5f9ecbf7c3ab3612d | scripts/cache_manager.py | scripts/cache_manager.py | #!/usr/bin/python2
# -*- coding: utf-8 -*-
import os
import cPickle
class CacheManager(object):
"""Manage cache saving and loading for a project"""
def __init__(self, home, tag):
"""Initialize the CacheManager
Args:
home: The home where data to be cached
tag: The tag... | Manage cache in an elegent way | Manage cache in an elegent way
| Python | mit | Cysu/Person-Reid,Cysu/Person-Reid,Cysu/Person-Reid,Cysu/Person-Reid,Cysu/Person-Reid | ---
+++
@@ -0,0 +1,64 @@
+#!/usr/bin/python2
+# -*- coding: utf-8 -*-
+
+import os
+import cPickle
+
+
+class CacheManager(object):
+ """Manage cache saving and loading for a project"""
+
+ def __init__(self, home, tag):
+ """Initialize the CacheManager
+
+ Args:
+ home: The home where ... | |
be10f2588f128d1a15dd6121aa806a98f1f96bf1 | tests/test_result.py | tests/test_result.py | import unittest
from performance_testing.result import Result, File
import os
import shutil
class ResultTestCase(unittest.TestCase):
def setUp(self):
self.current_directory = os.path.dirname(os.path.abspath(__file__))
self.result_directory = os.path.join(self.current_directory, 'assets/test_result... | Create tests for result class | Create tests for result class
| Python | mit | BakeCode/performance-testing,BakeCode/performance-testing | ---
+++
@@ -0,0 +1,18 @@
+import unittest
+from performance_testing.result import Result, File
+import os
+import shutil
+
+
+class ResultTestCase(unittest.TestCase):
+ def setUp(self):
+ self.current_directory = os.path.dirname(os.path.abspath(__file__))
+ self.result_directory = os.path.join(self.c... | |
7f8285b8f92b217d00872dbd1a527d25768fa21c | apps/submission/tests/test_views.py | apps/submission/tests/test_views.py | from django.test import TestCase
from django.urls import reverse
from apps.core.factories import PIXELER_PASSWORD, PixelerFactory
class DownloadXLSXTemplateViewTestCase(TestCase):
def setUp(self):
self.url = reverse('submission:download')
self.template = 'submission/download_xlsx_template.html'... | Add tests for the DownloadXLSXTemplateView | Add tests for the DownloadXLSXTemplateView
| Python | bsd-3-clause | Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel | ---
+++
@@ -0,0 +1,47 @@
+from django.test import TestCase
+from django.urls import reverse
+
+from apps.core.factories import PIXELER_PASSWORD, PixelerFactory
+
+
+class DownloadXLSXTemplateViewTestCase(TestCase):
+
+ def setUp(self):
+
+ self.url = reverse('submission:download')
+ self.template = '... | |
8be12a3a28779cf3ad91f732f5dc45bc0843fba1 | cla_backend/apps/knowledgebase/management/commands/general_and_government_addition.py | cla_backend/apps/knowledgebase/management/commands/general_and_government_addition.py | from django.core.management.base import BaseCommand
from knowledgebase.models import ArticleCategory
class Command(BaseCommand):
def handle(self, *args, **options):
self.stdout.write("Getting or creating General Article Category")
ArticleCategory.objects.get_or_create(name="General")
self.... | Add General and Government article categories | Add General and Government article categories
| Python | mit | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | ---
+++
@@ -0,0 +1,10 @@
+from django.core.management.base import BaseCommand
+from knowledgebase.models import ArticleCategory
+
+
+class Command(BaseCommand):
+ def handle(self, *args, **options):
+ self.stdout.write("Getting or creating General Article Category")
+ ArticleCategory.objects.get_or_c... | |
ca7fc022df2ce3554a241554ae8da72016a2b015 | src/helloWorld.py | src/helloWorld.py | import cv2
cam = cv2.VideoCapture(0)
running = True
while running:
running, frame = cam.read()
if running:
# draw rectangle
cv2.rectangle(frame,(100, 100), (200, 200), (255,0,0), 2)
# write text
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(frame,'Press Escape to exit...'... | Add HelloWorld.py to test correct setup | Add HelloWorld.py to test correct setup
| Python | mit | FroeMic/CDTM-Deep-Learning-Drones,FroeMic/CDTM-Deep-Learning-Drones | ---
+++
@@ -0,0 +1,21 @@
+import cv2
+
+cam = cv2.VideoCapture(0)
+running = True
+
+while running:
+ running, frame = cam.read()
+ if running:
+ # draw rectangle
+ cv2.rectangle(frame,(100, 100), (200, 200), (255,0,0), 2)
+ # write text
+ font = cv2.FONT_HERSHEY_SIMPLEX
+ cv2... | |
21eb7e06f175a08b4d90146d1bfb48670577e59b | bin/analysis/create_static_model.py | bin/analysis/create_static_model.py | # The old seed pipeline
import logging
import emission.analysis.classification.inference.mode.seed.pipeline as pipeline
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
seed_pipeline = pipeline.ModeInferencePipelineMovesFormat()
seed_pipeline.runPipeline()
| Check in a simple script to create and save a model based on old-style data | Check in a simple script to create and save a model based on old-style data
Since the analysis pipeline has already been defined, this was pretty easy.
And it is even tested.
Testing done: Ran it, there was a json file created.
| Python | bsd-3-clause | shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server | ---
+++
@@ -0,0 +1,8 @@
+# The old seed pipeline
+import logging
+import emission.analysis.classification.inference.mode.seed.pipeline as pipeline
+
+if __name__ == '__main__':
+ logging.basicConfig(level=logging.DEBUG)
+ seed_pipeline = pipeline.ModeInferencePipelineMovesFormat()
+ seed_pipeline.runPipeline... | |
c2a8863d579830ae63131bef5fdd4320720e05c7 | services/mixins/utils.py | services/mixins/utils.py | from services.mixins.constants import LICENSE_UNKNOWN, LICENSE_CC0, LICENSE_CC_BY, LICENSE_CC_BY_NC, \
LICENSE_CC_BY_NC_ND, LICENSE_CC_BY_NC_SA, LICENSE_CC_BY_ND, LICENSE_CC_BY_SA, LICENSE_CC_SAMPLING_PLUS
def translate_cc_license_url(url):
# TODO: this does not include license versioning (3.0, 4.0...)
if... | Add util function to translate from cc license urls | Add util function to translate from cc license urls
| Python | apache-2.0 | AudioCommons/ac-mediator,AudioCommons/ac-mediator,AudioCommons/ac-mediator | ---
+++
@@ -0,0 +1,16 @@
+from services.mixins.constants import LICENSE_UNKNOWN, LICENSE_CC0, LICENSE_CC_BY, LICENSE_CC_BY_NC, \
+ LICENSE_CC_BY_NC_ND, LICENSE_CC_BY_NC_SA, LICENSE_CC_BY_ND, LICENSE_CC_BY_SA, LICENSE_CC_SAMPLING_PLUS
+
+
+def translate_cc_license_url(url):
+ # TODO: this does not include licens... | |
9ce809a4067d311c23dd1fa4f39b5808c885afdc | scripts/analytics/run_keen_snapshots.py | scripts/analytics/run_keen_snapshots.py | import logging
from datetime import datetime
from keen.client import KeenClient
from website.app import init_app
from website.settings import KEEN as keen_settings
from scripts.analytics.addon_snapshot import get_events as addon_events
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
d... | Add other base script that will run addon and other snapshot scripts | Add other base script that will run addon and other snapshot scripts
| Python | apache-2.0 | chennan47/osf.io,acshi/osf.io,Nesiehr/osf.io,Johnetordoff/osf.io,felliott/osf.io,mattclark/osf.io,hmoco/osf.io,pattisdr/osf.io,CenterForOpenScience/osf.io,monikagrabowska/osf.io,acshi/osf.io,alexschiller/osf.io,mfraezz/osf.io,mluo613/osf.io,mfraezz/osf.io,erinspace/osf.io,mattclark/osf.io,chrisseto/osf.io,hmoco/osf.io,... | ---
+++
@@ -0,0 +1,44 @@
+import logging
+from datetime import datetime
+
+from keen.client import KeenClient
+
+from website.app import init_app
+from website.settings import KEEN as keen_settings
+from scripts.analytics.addon_snapshot import get_events as addon_events
+
+logger = logging.getLogger(__name__)
+loggin... | |
c2ded8bea952162ba38e9378c5d3ddaace9bea20 | tests/test_toggle_livesync_command.py | tests/test_toggle_livesync_command.py | from unittest import TestCase
from unittest.mock import MagicMock, patch
from sys import modules
class TestLiveSync(TestCase):
@patch('nativescript-plugin.toggle_livesync_command.ToggleLiveSyncNsCommand.on_finished', side_effect=lambda succeded: None)
def test_toggle_livesync_command_when_project_is_none_shou... | Add tests for Toggle LiveSync command | Add tests for Toggle LiveSync command
| Python | apache-2.0 | Mitko-Kerezov/ns-sublime-plugin,Mitko-Kerezov/ns-sublime-plugin | ---
+++
@@ -0,0 +1,56 @@
+from unittest import TestCase
+from unittest.mock import MagicMock, patch
+from sys import modules
+
+
+class TestLiveSync(TestCase):
+ @patch('nativescript-plugin.toggle_livesync_command.ToggleLiveSyncNsCommand.on_finished', side_effect=lambda succeded: None)
+ def test_toggle_livesyn... | |
f1fc7e4f2200863535ffbc3cb47b1b0f7375b943 | analysis/check_serum_strain_serum_id_match.py | analysis/check_serum_strain_serum_id_match.py | # Open downloaded titer table and check matches between serum_strain and serum_id
# There should only be a single serum_strain for each serum_id
# There can be multiple serum_ids for each serum_strain
import argparse
import csv
parser = argparse.ArgumentParser()
parser.add_argument('infile', default=None, type=str, h... | Include analysis script to test for broken serum_id / serum_strain matches | Include analysis script to test for broken serum_id / serum_strain matches
| Python | agpl-3.0 | nextstrain/fauna,blab/nextstrain-db,blab/nextstrain-db,nextstrain/fauna | ---
+++
@@ -0,0 +1,35 @@
+# Open downloaded titer table and check matches between serum_strain and serum_id
+# There should only be a single serum_strain for each serum_id
+# There can be multiple serum_ids for each serum_strain
+
+import argparse
+import csv
+
+parser = argparse.ArgumentParser()
+parser.add_argument... | |
3d7707d20c299358476cca01babf14c7cacddb50 | smaug/tests/fullstack/test_providers.py | smaug/tests/fullstack/test_providers.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add fullstack tests of the resource providers | Add fullstack tests of the resource providers
Change-Id: Ie4f769de3060fdb279320637ba965d5b452e2a2d
Closes-Bug: #1578889
| Python | apache-2.0 | openstack/smaug,openstack/smaug | ---
+++
@@ -0,0 +1,27 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writi... | |
522e71e1fd210994c6745aa012c6663f34d3a397 | randlov1998/analysis.py | randlov1998/analysis.py | """Functions for plotting results, etc.
"""
import numpy as np
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import pylab as pl
from scipy import r_
from pybrain.tools.customxml.networkreader import NetworkReader
from pybrain.utilities import one_to_n
def plot_nfq_action_value_history(netw... | Add file to visualize nfq network evolution. | Add file to visualize nfq network evolution.
| Python | mit | chrisdembia/agent-bicycle,chrisdembia/agent-bicycle | ---
+++
@@ -0,0 +1,71 @@
+"""Functions for plotting results, etc.
+
+"""
+
+import numpy as np
+from mpl_toolkits.mplot3d import axes3d
+import matplotlib.pyplot as plt
+import pylab as pl
+from scipy import r_
+from pybrain.tools.customxml.networkreader import NetworkReader
+from pybrain.utilities import one_to_n
+
... | |
00fc7eff1f9c1d1ddcc61210c1a80f966e085d1f | course_discovery/apps/course_metadata/migrations/0191_add_microbachelors_program_type.py | course_discovery/apps/course_metadata/migrations/0191_add_microbachelors_program_type.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-07-26 18:14
from __future__ import unicode_literals
from django.db import migrations
SEAT_TYPES = ('audit', 'verified',)
PROGRAM_TYPES = ('MicroBachelors',)
def add_program_types(apps, schema_editor): # pylint: disable=unused-argument
SeatType = app... | Add MicroBachelors program_type Co-authored-by: Lise <albemarle> | MICROB-3: Add MicroBachelors program_type
Co-authored-by: Lise <albemarle>
| Python | agpl-3.0 | edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery | ---
+++
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.11 on 2018-07-26 18:14
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+SEAT_TYPES = ('audit', 'verified',)
+PROGRAM_TYPES = ('MicroBachelors',)
+
+
+def add_program_types(apps, schema_editor): # pylint: disa... | |
175114bb680fae35a1248e41e15a2e82a5cbdc3f | feed_sources/AlbanyNy.py | feed_sources/AlbanyNy.py | """Fetch Capital District Transportation Authority (Albany, New York) feed."""
import logging
from FeedSource import FeedSource
URL = 'http://www.cdta.org/schedules/google_transit.zip'
LOG = logging.getLogger(__name__)
class AlbanyNy(FeedSource):
"""Fetch CDTA feed."""
def __init__(self):
super(Alb... | Add CDTA (for Albany, NY) | Add CDTA (for Albany, NY)
| Python | mit | azavea/gtfs-feed-fetcher,flibbertigibbet/gtfs-feed-fetcher | ---
+++
@@ -0,0 +1,15 @@
+"""Fetch Capital District Transportation Authority (Albany, New York) feed."""
+import logging
+
+from FeedSource import FeedSource
+
+URL = 'http://www.cdta.org/schedules/google_transit.zip'
+
+LOG = logging.getLogger(__name__)
+
+
+class AlbanyNy(FeedSource):
+ """Fetch CDTA feed."""
+ ... | |
3ad4d95f0a886e5722717bd6b9b91a09dfcb9194 | src/dbus_python_client_gen/_gmoreaders.py | src/dbus_python_client_gen/_gmoreaders.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Code for generating classes suitable for invoking dbus-python methods.
"""
from ._errors import DPClientGenerationE... | Add a method for generating GetManagedObjects() data wrappers | Add a method for generating GetManagedObjects() data wrappers
Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
| Python | mpl-2.0 | mulkieran/dbus-python-client-gen | ---
+++
@@ -0,0 +1,72 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+"""
+Code for generating classes suitable for invoking dbus-python methods.
+"""
+
+from... | |
43c112c07c4a990b16276eebded2e33bf92ca174 | src/trajectory/lemniscate_trajectory.py | src/trajectory/lemniscate_trajectory.py | #!/usr/bin/env python
from math import sqrt, cos, pi, sin
from .trajectory import Trajectory
class LemniscateTrajectory(object, Trajectory):
def __init__(self, radius, period):
Trajectory.__init__(self)
self.radius = radius
self. period = period
def get_position_at(self, t):
... | Implement Lemniscate of Bernoulli trajectory | feat: Implement Lemniscate of Bernoulli trajectory
| Python | mit | bit0001/trajectory_tracking,bit0001/trajectory_tracking | ---
+++
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+from math import sqrt, cos, pi, sin
+
+from .trajectory import Trajectory
+
+
+class LemniscateTrajectory(object, Trajectory):
+ def __init__(self, radius, period):
+ Trajectory.__init__(self)
+ self.radius = radius
+ self. period = period
+
+ ... | |
fca96bc38abdfbc075b4dd0e85d3cd48be30f9bc | CodeFights/circleOfNumbers.py | CodeFights/circleOfNumbers.py | #!/usr/local/bin/python
# Code Fights Circle of Numbers Problem
def circleOfNumbers(n, firstNumber):
pass
def main():
tests = [
["crazy", "dsbaz"],
["z", "a"]
]
for t in tests:
res = circleOfNumbers(t[0], t[1])
if t[2] == res:
print("PASSED: circleOfNumbe... | Set up Code Fights circle of numbers problem | Set up Code Fights circle of numbers problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,26 @@
+#!/usr/local/bin/python
+# Code Fights Circle of Numbers Problem
+
+
+def circleOfNumbers(n, firstNumber):
+ pass
+
+
+def main():
+ tests = [
+ ["crazy", "dsbaz"],
+ ["z", "a"]
+ ]
+
+ for t in tests:
+ res = circleOfNumbers(t[0], t[1])
+ if t[2] == r... | |
221f949958e3ec0a73a90f3db9a451b743797761 | tests/client/test_encryption_client.py | tests/client/test_encryption_client.py | from __future__ import unicode_literals
import os
import unittest
from qingstor.sdk.client.encryption_client import EncryptionClient
RIGHT_OUT_KWARGS = {
"content_type": "video",
"x_qs_encryption_customer_algorithm": "AES256",
"x_qs_encryption_customer_key":
"MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM... | Create test class for encryption client | Create test class for encryption client
| Python | apache-2.0 | yunify/qingstor-sdk-python | ---
+++
@@ -0,0 +1,28 @@
+from __future__ import unicode_literals
+
+import os
+import unittest
+
+from qingstor.sdk.client.encryption_client import EncryptionClient
+
+RIGHT_OUT_KWARGS = {
+ "content_type": "video",
+ "x_qs_encryption_customer_algorithm": "AES256",
+ "x_qs_encryption_customer_key":
+ "MD... | |
5012e2b28920ff96f8ed14911866818a0ba032fa | tests/test_dft.py | tests/test_dft.py | import unittest
import numpy as np
from pyquante2.dft.functionals import xs,cvwn
from pyquante2.dft.reference import data
class test_dft(unittest.TestCase):
def test_xs(self):
na = data['xs'][:,0]
nb = data['xs'][:,1]
fa,dfa = xs(na)
fb,dfb = xs(nb)
max_f = np.max(fa+fb-data... | Test suite for lda functionals | Test suite for lda functionals
| Python | bsd-3-clause | Konjkov/pyquante2,Konjkov/pyquante2,Konjkov/pyquante2 | ---
+++
@@ -0,0 +1,52 @@
+import unittest
+import numpy as np
+from pyquante2.dft.functionals import xs,cvwn
+from pyquante2.dft.reference import data
+
+class test_dft(unittest.TestCase):
+ def test_xs(self):
+ na = data['xs'][:,0]
+ nb = data['xs'][:,1]
+ fa,dfa = xs(na)
+ fb,dfb = xs... | |
98877b442080c1a653192da71e6c582a67643e97 | tools/data/box_proto_from_proposals.py | tools/data/box_proto_from_proposals.py | #!/usr/bin/env python
import os, sys
import pdb
import argparse
import scipy.io as sio
import h5py
sys.path.insert(1, '.')
from vdetlib.utils.protocol import proto_dump, path_to_index, proto_load
def save_if_not_exist(proto, path):
if not os.path.isfile(path):
proto_dump(box_proto, path)
if __name__ == '... | Add script to generate box proto files from proposal mat files. | Add script to generate box proto files from proposal mat files.
| Python | mit | myfavouritekk/TPN | ---
+++
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+import os, sys
+import pdb
+import argparse
+import scipy.io as sio
+import h5py
+sys.path.insert(1, '.')
+from vdetlib.utils.protocol import proto_dump, path_to_index, proto_load
+
+def save_if_not_exist(proto, path):
+ if not os.path.isfile(path):
+ proto... | |
ebb07da268eb57d1b8145eb2f7312b412c817217 | tests/unit/asyncio/test_asyncio_repr.py | tests/unit/asyncio/test_asyncio_repr.py | from butter.asyncio.eventfd import Eventfd_async
from butter.asyncio.fanotify import Fanotify_async
from butter.asyncio.inotify import Inotify_async
from butter.asyncio.signalfd import Signalfd_async
from butter.asyncio.timerfd import Timerfd_async
from collections import namedtuple
import pytest
import sys
class Mock... | Test async objects for __repr__ as well | Test async objects for __repr__ as well
| Python | bsd-3-clause | dasSOZO/python-butter,wdv4758h/butter | ---
+++
@@ -0,0 +1,64 @@
+from butter.asyncio.eventfd import Eventfd_async
+from butter.asyncio.fanotify import Fanotify_async
+from butter.asyncio.inotify import Inotify_async
+from butter.asyncio.signalfd import Signalfd_async
+from butter.asyncio.timerfd import Timerfd_async
+from collections import namedtuple
+im... | |
70cad3e6f9b2ceac0ab7082843e6902e1934afe0 | tohu/v5/extras.py | tohu/v5/extras.py | from .base import TohuBaseGenerator
from .primitive_generators import Constant
__all__ = ['as_tohu_generator']
def as_tohu_generator(g):
"""
If g is a tohu generator return it unchanged,
otherwise wrap it in a Constant generator.
"""
if isinstance(g, TohuBaseGenerator):
return g
else... | Add helper function to ensure an input value is a tohu generator | Add helper function to ensure an input value is a tohu generator
| Python | mit | maxalbert/tohu | ---
+++
@@ -0,0 +1,16 @@
+from .base import TohuBaseGenerator
+from .primitive_generators import Constant
+
+__all__ = ['as_tohu_generator']
+
+
+def as_tohu_generator(g):
+ """
+ If g is a tohu generator return it unchanged,
+ otherwise wrap it in a Constant generator.
+ """
+
+ if isinstance(g, TohuB... | |
2e2c5d394e57837386d17d24e219cadbd625aa09 | nbs/utils.py | nbs/utils.py | # -*- coding: utf-8 -*-
from werkzeug.routing import BaseConverter
class ListConverter(BaseConverter):
_subtypes = {
'int': int,
'str': str,
'u': unicode,
}
def __init__(self, url_map, subtype=None, mutable=False):
super(ListConverter, self).__init__(url_map)
sel... | Add ListConverter to url parser | Add ListConverter to url parser
| Python | mit | coyotevz/nobix-app | ---
+++
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+
+from werkzeug.routing import BaseConverter
+
+
+class ListConverter(BaseConverter):
+
+ _subtypes = {
+ 'int': int,
+ 'str': str,
+ 'u': unicode,
+ }
+
+ def __init__(self, url_map, subtype=None, mutable=False):
+ super(ListConv... | |
ee2a83e26fc1319e97fe02109bc28a7b061e7a2a | tests/test_gen_sql.py | tests/test_gen_sql.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class TestGenSql:
def test_gen_drop_statement(self):
pass
def test_create_statement(self):
pass
| Add tests placeholder for pg_bawler.gen_sql | Add tests placeholder for pg_bawler.gen_sql
| Python | bsd-3-clause | beezz/pg_bawler,beezz/pg_bawler | ---
+++
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+class TestGenSql:
+
+ def test_gen_drop_statement(self):
+ pass
+
+ def test_create_statement(self):
+ pass | |
4da185d2902c9a83db1c7022f2e9c65b39957384 | aerodynamics_2d.py | aerodynamics_2d.py | """
This module enables XLFR5 data to numpy.array.
"""
import numpy as np
# import matplotlib.pyplot as plt
def read_xflr5_data(wing_foil_name):
reynolds_numbers = np.arange(0, 1.01, 0.1)
headers = ["alpha", "CL", "CD", "CDp", "Cm", "Top Xtr", "Bot Xtr", "Cpmin", "Chinge", "XCp"]
tmpdict = {i: [] for i i... | Add 2D wing foil reader | Add 2D wing foil reader
| Python | mit | salamann/fpadesigner | ---
+++
@@ -0,0 +1,24 @@
+"""
+This module enables XLFR5 data to numpy.array.
+"""
+
+import numpy as np
+# import matplotlib.pyplot as plt
+
+
+def read_xflr5_data(wing_foil_name):
+ reynolds_numbers = np.arange(0, 1.01, 0.1)
+ headers = ["alpha", "CL", "CD", "CDp", "Cm", "Top Xtr", "Bot Xtr", "Cpmin", "Chinge... | |
b0360709bd80df9756a41089ac0c6a4eb19109df | glance/db/sqlalchemy/migrate_repo/versions/018_add_image_locations_table.py | glance/db/sqlalchemy/migrate_repo/versions/018_add_image_locations_table.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | Add migration 18 - create the image_locations table | Add migration 18 - create the image_locations table
This migration simply creates the new image_locations table. It does
not yet use the table for anything.
Related to bp multiple-image-locations
Change-Id: I1536c9276bc807aac26849e37556b465e8b5c9eb
| Python | apache-2.0 | rajalokan/glance,rickerc/glance_audit,ntt-sic/glance,kfwang/Glance-OVA-OVF,sigmavirus24/glance,wkoathp/glance,JioCloud/glance,vuntz/glance,citrix-openstack-build/glance,takeshineshiro/glance,cloudbau/glance,redhat-openstack/glance,tanglei528/glance,ntt-sic/glance,stevelle/glance,saeki-masaki/glance,dims/glance,saeki-ma... | ---
+++
@@ -0,0 +1,64 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the Lice... | |
8e773cb6df43c697e0d088813cf143fff9453624 | pyQuantuccia/tests/test_quantuccia.py | pyQuantuccia/tests/test_quantuccia.py | import pytest
from pyQuantuccia import quantuccia
def test_function_fails_correctly_on_bad_input():
"""
If we send in something which isn't three
appropriate ints, something reasonable should
happen.
"""
with pytest.raises(Exception):
quantuccia.united_kingdom_is_business_day(1, 2, 3... | Add a test which directly calls the c function. | Add a test which directly calls the c function.
| Python | bsd-3-clause | jwg4/pyQuantuccia,jwg4/pyQuantuccia | ---
+++
@@ -0,0 +1,13 @@
+import pytest
+
+from pyQuantuccia import quantuccia
+
+
+def test_function_fails_correctly_on_bad_input():
+ """
+ If we send in something which isn't three
+ appropriate ints, something reasonable should
+ happen.
+ """
+ with pytest.raises(Exception):
+ quantucci... | |
84ffbc997ae289eba1c8cb0666f05c54c37e5704 | dmrx_most_heard_n0gsg.py | dmrx_most_heard_n0gsg.py | #!/usr/bin/env python2
import csv
# dmrx.net uses SSL SNI, which urllib2 doesn't support
import requests
from dmr_marc_users_cs750 import get_groups
MOST_HEARD_URL = 'https://dmrx.net/csvfiles/MostHeard.csv'
# Neither of these formats uses a header row
COLUMNS_N0GSG = ('Call ID', 'Call Alias', 'Call Type', 'Receive... | Add support for N0GSG csv and DMRX MostHeard.csv | Add support for N0GSG csv and DMRX MostHeard.csv
| Python | apache-2.0 | ajorg/DMR_contacts | ---
+++
@@ -0,0 +1,54 @@
+#!/usr/bin/env python2
+import csv
+
+# dmrx.net uses SSL SNI, which urllib2 doesn't support
+import requests
+
+from dmr_marc_users_cs750 import get_groups
+
+MOST_HEARD_URL = 'https://dmrx.net/csvfiles/MostHeard.csv'
+
+# Neither of these formats uses a header row
+COLUMNS_N0GSG = ('Call I... | |
a684564eace2185b40acf3413c8f75587195ff46 | unitary/examples/tictactoe/ascii_board.py | unitary/examples/tictactoe/ascii_board.py | # Copyright 2022 Google
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | Add ASCII board for Quantum TicTacToe board | Add ASCII board for Quantum TicTacToe board
- Add preliminary ASCII board for Quantum TicTacToe
- Displays probability for blank (.) and X and O.
| Python | apache-2.0 | quantumlib/unitary,quantumlib/unitary | ---
+++
@@ -0,0 +1,41 @@
+# Copyright 2022 Google
+#
+# 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
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicab... | |
a176d05ec1481ab3892b4d4768e6bad1fdbd4868 | tools/update_whatsnew.py | tools/update_whatsnew.py | """Update the What's New doc (development version)
This collects the snippets from whatsnew/pr/, moves their content into
whatsnew/development.rst (chronologically ordered), and deletes the snippets.
"""
import io
import os
from os.path import dirname, basename, abspath, join as pjoin
from subprocess import check_cal... | Add script to update whatsnew file from PR snippets | Add script to update whatsnew file from PR snippets
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,74 @@
+"""Update the What's New doc (development version)
+
+This collects the snippets from whatsnew/pr/, moves their content into
+whatsnew/development.rst (chronologically ordered), and deletes the snippets.
+"""
+
+import io
+import os
+from os.path import dirname, basename, abspath, join as pj... | |
ad301e03c4c1109b7caf3371fe64f638dfc1349b | NeedForCryptography/Tools/discretelog.py | NeedForCryptography/Tools/discretelog.py | def log(base, value, modulo):
for power in range(0, modulo + 1):
if value == base ** power % modulo:
return power
raise ValueError('log{}({}) does not have discrete logarithm in {}'
.format(base, value, modulo))
| Add brute-force algorithm for discrete logarithm. | Add brute-force algorithm for discrete logarithm.
| Python | mit | Veselin-Genadiev/NeedForCryptography | ---
+++
@@ -0,0 +1,7 @@
+def log(base, value, modulo):
+ for power in range(0, modulo + 1):
+ if value == base ** power % modulo:
+ return power
+
+ raise ValueError('log{}({}) does not have discrete logarithm in {}'
+ .format(base, value, modulo)) | |
7b1dfeab79040e03aa7a9e247028d5da4e37cf4f | examples/test_cycle_elements.py | examples/test_cycle_elements.py | from seleniumbase import BaseCase
class CycleTests(BaseCase):
def test_cycle_elements_with_tab_and_press_enter(self):
""" Test pressing the tab key to cycle through elements.
Then click on the active element and verify actions.
This can all be performed by using a single com... | Add test that tabs through and clicks the active element | Add test that tabs through and clicks the active element
| Python | mit | seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase | ---
+++
@@ -0,0 +1,13 @@
+from seleniumbase import BaseCase
+
+
+class CycleTests(BaseCase):
+ def test_cycle_elements_with_tab_and_press_enter(self):
+ """ Test pressing the tab key to cycle through elements.
+ Then click on the active element and verify actions.
+ This can all be per... | |
f3a4a21b7e8c4b9d2c1983aec77c91f5193146a2 | exp/recommendexp/SparsityExp.py | exp/recommendexp/SparsityExp.py |
#Test if we can easily get the SVD of a set of matrices with low rank but under
#a fixed structure
import numpy
import scipy.sparse
from exp.util.SparseUtils import SparseUtils
numpy.set_printoptions(suppress=True, precision=3, linewidth=150)
shape = (15, 20)
r = 10
k = 50
X, U, s, V = SparseUtils.generateSpar... | Test SVD of sparse matrix | Test SVD of sparse matrix | Python | bsd-3-clause | charanpald/APGL | ---
+++
@@ -0,0 +1,29 @@
+
+#Test if we can easily get the SVD of a set of matrices with low rank but under
+#a fixed structure
+
+import numpy
+import scipy.sparse
+from exp.util.SparseUtils import SparseUtils
+
+numpy.set_printoptions(suppress=True, precision=3, linewidth=150)
+
+shape = (15, 20)
+r = 10
+k = ... | |
76aa34e0bad66e8bf0e4864b4654acbc57101441 | elpiwear/ads1015_demo.py | elpiwear/ads1015_demo.py | #Demo code for the Adafruit ADS1015 board using the Raspberry Pi
#The driver can also be used with the Ready pin using a GPIO to
#be used in an interrupt mode.
import Rpi.spi as SPI
import ads1015
DEVICE_ADDRESS = 0x48
SPI_PORT = 1
spi = SPI.spi(SPI_PORT,DEVICE_ADDRESS)
adc = ads1015.ads1015(spi)
adc.setchannel(0, T... | Add a simple demo code to use the ADS1015 driver | Add a simple demo code to use the ADS1015 driver
| Python | mit | fjacob21/pycon2015 | ---
+++
@@ -0,0 +1,15 @@
+#Demo code for the Adafruit ADS1015 board using the Raspberry Pi
+#The driver can also be used with the Ready pin using a GPIO to
+#be used in an interrupt mode.
+
+import Rpi.spi as SPI
+import ads1015
+
+DEVICE_ADDRESS = 0x48
+SPI_PORT = 1
+
+spi = SPI.spi(SPI_PORT,DEVICE_ADDRESS)
+adc = a... | |
5f1d0836ca81b5d043de09c9dd6d76d797a3dcd6 | dev/templates/python/python_unittest.py | dev/templates/python/python_unittest.py | #!/usr/bin/env python
# encoding: utf-8
"""
${TM_NEW_FILE_BASENAME}.py
Created by ${TM_FULLNAME} on ${TM_DATE}.
Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved.
"""
import unittest
class ${TM_NEW_FILE_BASENAME}(unittest.TestCase):
def setUp(self):
pass
if __name__ == '__main__':
unittest... | Add python unittest template from TextMate | Add python unittest template from TextMate
| Python | isc | rcuza/init,rcuza/init | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# encoding: utf-8
+"""
+${TM_NEW_FILE_BASENAME}.py
+
+Created by ${TM_FULLNAME} on ${TM_DATE}.
+Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved.
+"""
+
+import unittest
+
+
+class ${TM_NEW_FILE_BASENAME}(unittest.TestCase):
+ def setUp(self):
+ p... | |
0fb1c8ff1a7bba91d27303b7abfc37f460c97c86 | scripts/print_schema.py | scripts/print_schema.py | #!/usr/bin/env python3
import argparse
from sqlalchemy import MetaData
from sqlalchemy_schemadisplay import create_schema_graph
def plot_schema(fn):
graph = create_schema_graph(
metadata=MetaData('sqlite:///'+fn),
show_datatypes=False,
show_indexes=False,
rankdir='LR',
con... | Add script from printing the DB schema | Add script from printing the DB schema
| Python | bsd-3-clause | chrisburr/lhcb-talky,chrisburr/lhcb-talky | ---
+++
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+import argparse
+
+from sqlalchemy import MetaData
+from sqlalchemy_schemadisplay import create_schema_graph
+
+
+def plot_schema(fn):
+ graph = create_schema_graph(
+ metadata=MetaData('sqlite:///'+fn),
+ show_datatypes=False,
+ show_indexes=F... | |
5c277a958f2ce8e97ff539870d13a28181c8ea65 | task_01.py | task_01.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This is a module gets today's date."""
import datetime
CURDATE = None
def get_current_date():
"""Return today's date
Args:
(int): Current day
Returns:
date: the year, month, day
Examples:
>>> import task_01
... | Use datetime.date.today() and then if__name__ = '__main__': to make CURDATE available. | Use datetime.date.today() and then if__name__ = '__main__': to make CURDATE available.
| Python | mpl-2.0 | gracehyemin/is210-week-05-synthesizing,gracehyemin/is210-week-05-synthesizing | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""This is a module gets today's date."""
+
+import datetime
+
+CURDATE = None
+
+
+def get_current_date():
+ """Return today's date
+
+ Args:
+ (int): Current day
+
+ Returns:
+ date: the year, month, day
+ ... | |
edba490c7274bf1afb3f13dbb9f82351aab03495 | migrations/versions/0125_remove_unique_constraint.py | migrations/versions/0125_remove_unique_constraint.py | """
Revision ID: 0125_remove_unique_constraint
Revises: 0124_add_free_sms_fragment_limit
Create Date: 2017-10-17 16:47:37.826333
"""
from alembic import op
import sqlalchemy as sa
revision = '0125_remove_unique_constraint'
down_revision = '0124_add_free_sms_fragment_limit'
def upgrade():
# ### commands auto ge... | Remove unique constraint for ServiceSmsSenders. This will allow a service to have multiple sms senders. | Remove unique constraint for ServiceSmsSenders.
This will allow a service to have multiple sms senders.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,25 @@
+"""
+
+Revision ID: 0125_remove_unique_constraint
+Revises: 0124_add_free_sms_fragment_limit
+Create Date: 2017-10-17 16:47:37.826333
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+revision = '0125_remove_unique_constraint'
+down_revision = '0124_add_free_sms_fragment_limit'
+
+
... | |
24c757ee86ce121e5cfa27a66ee7d13d167c7f9d | tools/subset_symbols.py | tools/subset_symbols.py | #!/usr/bin/python
#
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Add tool for subsetting symbols. | Add tool for subsetting symbols.
git-svn-id: ed1ad396822b1b6daf934b380f36d983ac38e44f@276 37e447bf-a746-2f79-0798-35135ca55e94
| Python | apache-2.0 | yannisl/noto-monolithic,yannisl/noto-monolithic,yannisl/noto-monolithic,wskplho/noto-monolithic,yannisl/noto-monolithic,wskplho/noto-monolithic,wskplho/noto-monolithic,wskplho/noto-monolithic | ---
+++
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+#
+# Copyright 2014 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/license... | |
537d2787b92b5ab3246c853a33030378c7fe15f0 | tests/test_load_tool.py | tests/test_load_tool.py | from cwltool.load_tool import load_tool
from cwltool.context import LoadingContext, RuntimeContext
from cwltool.errors import WorkflowException
import pytest
from .util import (get_data, get_main_output,
get_windows_safe_factory,
needs_docker, working_directory,
... | Add tests for version check and metadata behavior | Add tests for version check and metadata behavior
| Python | apache-2.0 | common-workflow-language/cwltool,common-workflow-language/cwltool,common-workflow-language/cwltool | ---
+++
@@ -0,0 +1,44 @@
+from cwltool.load_tool import load_tool
+from cwltool.context import LoadingContext, RuntimeContext
+from cwltool.errors import WorkflowException
+import pytest
+from .util import (get_data, get_main_output,
+ get_windows_safe_factory,
+ needs_docker, work... | |
b5ae3a97fde4421307e6cd86dba188cbf7999435 | chrome/browser/extensions/PRESUBMIT.py | chrome/browser/extensions/PRESUBMIT.py | # Copyright (c) 2011 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.
"""Chromium presubmit script for src/chrome/browser/extensions.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more det... | Add aura compile testing by default to likely areas (4). | Add aura compile testing by default to likely areas (4).
BUG=chromium:107599
TEST=None
Review URL: http://codereview.chromium.org/8907044
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@114847 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | Fireblend/chromium-crosswalk,jaruba/chromium.src,dednal/chromium.src,jaruba/chromium.src,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,zcbenz/cefode-chromium,M4sse/chromium.src,chuan9/chromium-crosswalk,Just-D/chromium-1,markYoungH/chromium.src,fujunwei/chromium-crosswalk,hgl888/chro... | ---
+++
@@ -0,0 +1,12 @@
+# Copyright (c) 2011 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.
+
+"""Chromium presubmit script for src/chrome/browser/extensions.
+
+See http://dev.chromium.org/developers/how-tos/depotto... | |
cb4167278d3d342cbbb3ea185d0bbff7ff72ff4d | python/example_code/s3/s3-python-example-upload-file.py | python/example_code/s3/s3-python-example-upload-file.py | # Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This f... | Revert "Delete duplicate Python example" | Revert "Delete duplicate Python example"
| Python | apache-2.0 | awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,a... | ---
+++
@@ -0,0 +1,38 @@
+# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+#
+# This file is licensed under the Apache License, Version 2.0 (the "License").
+# You may not use this file except in compliance with the License. A copy of the
+# License is located at
+#
+# http://aws.amazon... | |
1fead9006e75aa9ea3933f5f24ff7c8042225a8a | version.py | version.py | ZULIP_VERSION = "1.6.0+git"
PROVISION_VERSION = '5.7'
| ZULIP_VERSION = "1.6.0+git"
PROVISION_VERSION = '5.8'
| Bump PROVISION_VERSION for recent package upgrades. | Bump PROVISION_VERSION for recent package upgrades.
| Python | apache-2.0 | kou/zulip,dhcrzf/zulip,jrowan/zulip,tommyip/zulip,brockwhittaker/zulip,rht/zulip,jackrzhang/zulip,Galexrt/zulip,brainwane/zulip,brainwane/zulip,zulip/zulip,kou/zulip,zulip/zulip,rishig/zulip,andersk/zulip,andersk/zulip,dhcrzf/zulip,vabs22/zulip,rishig/zulip,brockwhittaker/zulip,eeshangarg/zulip,timabbott/zulip,amanhari... | ---
+++
@@ -1,2 +1,2 @@
ZULIP_VERSION = "1.6.0+git"
-PROVISION_VERSION = '5.7'
+PROVISION_VERSION = '5.8' |
bac6fb1d5287452bdda0dc9d6b730ebd092ae3ab | codingame/power_of_thor.py | codingame/power_of_thor.py | # LX: the X position of the light of power
# LY: the Y position of the light of power
# x: Thor's starting X position
# y: Thor's starting Y position
LX, LY, x, y = [int(i) for i in raw_input().split()]
# Game loop
while True:
E = int(raw_input()) # The level of Thor's remaining energy, representing the number of mov... | Add CodinGame Power of Thor | Add CodinGame Power of Thor
| Python | mit | AntoineAugusti/katas,AntoineAugusti/katas,AntoineAugusti/katas | ---
+++
@@ -0,0 +1,25 @@
+# LX: the X position of the light of power
+# LY: the Y position of the light of power
+# x: Thor's starting X position
+# y: Thor's starting Y position
+LX, LY, x, y = [int(i) for i in raw_input().split()]
+
+# Game loop
+while True:
+ E = int(raw_input()) # The level of Thor's remaining en... | |
d47abe23bf1c88520ee6ecf954dadaae42142366 | src/engine/SCons/Tool/javacTests.py | src/engine/SCons/Tool/javacTests.py | #
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicen... | Add unit tests for SCons.Tool.javac (pathopt class only). This carefully avoids known bugs in order to have passing tests. | Add unit tests for SCons.Tool.javac (pathopt class only).
This carefully avoids known bugs in order to have passing tests.
| Python | mit | Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons | ---
+++
@@ -0,0 +1,67 @@
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merg... | |
0664983f6182fca7147d97fd2350bba3655da22a | CodeFights/weakNumbers.py | CodeFights/weakNumbers.py | #!/usr/local/bin/python
# Code Fights Weak Numbers Problem
def weakNumbers(n):
def get_divisors(n):
divs = []
for i in range(1, n + 1):
count = 0
for d in range(1, i + 1):
if i % d == 0:
count += 1
divs.append(count)
r... | Set up Code Fights weak numbers problem | Set up Code Fights weak numbers problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,42 @@
+#!/usr/local/bin/python
+# Code Fights Weak Numbers Problem
+
+
+def weakNumbers(n):
+ def get_divisors(n):
+ divs = []
+ for i in range(1, n + 1):
+ count = 0
+ for d in range(1, i + 1):
+ if i % d == 0:
+ count += 1
+... | |
beb3882b89b41ca104dbb9f2fb97f609f45ce106 | corehq/apps/users/decorators.py | corehq/apps/users/decorators.py | from django.http import HttpResponseForbidden
from corehq.apps.domain.decorators import login_and_domain_required
def require_permission(permission, data=None, login_decorator=login_and_domain_required):
try:
permission = permission.name
except AttributeError:
try:
permission = perm... | from django.http import HttpResponseForbidden
from corehq.apps.domain.decorators import login_and_domain_required
def require_permission(permission, data=None, login_decorator=login_and_domain_required):
try:
permission = permission.name
except AttributeError:
try:
permission = perm... | Apply login decorator before permissions check; less 403s, more 302s | Apply login decorator before permissions check; less 403s, more 302s
| Python | bsd-3-clause | puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,gmimano/commcaretest,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftwar... | ---
+++
@@ -12,11 +12,13 @@
def decorator(view_func):
def _inner(request, domain, *args, **kwargs):
if hasattr(request, "couch_user") and (request.user.is_superuser or request.couch_user.has_permission(domain, permission, data=data)):
- if login_decorator:
- ... |
743f999217fa2e87abe9d512a3e71d54386fe151 | carepoint/tests/models/cph/test_phone.py | carepoint/tests/models/cph/test_phone.py | # -*- coding: utf-8 -*-
# © 2015-TODAY LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import unittest
from sqlalchemy.schema import Table
from carepoint.tests.db.db import DatabaseTest
from carepoint.models.cph.phone import Phone
class TestModelsCphPhone(DatabaseTest):
def tes... | Add missing phone model test in carepoint cph | Add missing phone model test in carepoint cph
| Python | mit | laslabs/Python-Carepoint | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+# © 2015-TODAY LasLabs Inc.
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+import unittest
+from sqlalchemy.schema import Table
+from carepoint.tests.db.db import DatabaseTest
+from carepoint.models.cph.phone import Phone
+
+
+class TestMode... | |
eec8b527b54efd516eebfbc056d35158316fc222 | client/examples/update_image_metadata.py | client/examples/update_image_metadata.py | # -*- coding: utf-8 -*-
#
# * Copyright (c) 2009-2015. Authors: see NOTICE file.
# *
# * 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... | Update image metadata in a project | Update image metadata in a project
| Python | apache-2.0 | cytomine/Cytomine-python-client,cytomine/Cytomine-python-client | ---
+++
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+#
+# * Copyright (c) 2009-2015. Authors: see NOTICE file.
+# *
+# * 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
+# *
+# * htt... | |
35f779cb56e4c710fb5321bd22d8187670993f62 | sci_lib.py | sci_lib.py | #!/usr/bin/python
#Author: Scott T. Salesky
#Created: 12.6.2014
#Purpose: Collection of functions, routines to use
#Python for scientific work
#----------------------------------------------
| Add function to read 3d direct access Fortran binary files into NumPy arrays. | Add function to read 3d direct access Fortran binary files into NumPy arrays.
| Python | mit | ssalesky/Science-Library | ---
+++
@@ -0,0 +1,6 @@
+#!/usr/bin/python
+#Author: Scott T. Salesky
+#Created: 12.6.2014
+#Purpose: Collection of functions, routines to use
+#Python for scientific work
+#---------------------------------------------- | |
0eda613c7aafb974b1314c93d749b8ceb31a8459 | court_bulk_task_creator.py | court_bulk_task_creator.py | from courtreader import readers
from courtutils.database import Database
from courtutils.logger import get_logger
from datetime import datetime, timedelta
import csv
import pymongo
import os
import sys
import time
def get_db_connection():
return pymongo.MongoClient(os.environ['MONGO_DB'])['va_court_search']
start... | Add bulk collection task creator | Add bulk collection task creator
| Python | mit | bschoenfeld/va-court-scraper,bschoenfeld/va-court-scraper | ---
+++
@@ -0,0 +1,29 @@
+from courtreader import readers
+from courtutils.database import Database
+from courtutils.logger import get_logger
+from datetime import datetime, timedelta
+import csv
+import pymongo
+import os
+import sys
+import time
+
+def get_db_connection():
+ return pymongo.MongoClient(os.environ... | |
d5ce5e325839d6094d163a58fc417bf4ee2a573f | tests/regression/test_f468afef89d1.py | tests/regression/test_f468afef89d1.py | #!/usr/bin/env python
"""when seconds or nano_seconds was set to 0 rather than None (the default) the
value would not be reset to 0 but instead the previous value would remain in
place
this was only visible if a user had previously set a value
"""
from butter.timerfd import Timer
from select import select
def test_f... | Put a regression test in place for commit f468afef89d1 | Put a regression test in place for commit f468afef89d1
| Python | bsd-3-clause | dasSOZO/python-butter,wdv4758h/butter | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+"""when seconds or nano_seconds was set to 0 rather than None (the default) the
+value would not be reset to 0 but instead the previous value would remain in
+place
+
+this was only visible if a user had previously set a value
+"""
+from butter.timerfd import Timer
+f... | |
8eab4037cef2490b99758554c3d4a17603f19d75 | bookmarks/feeds.py | bookmarks/feeds.py | from atomformat import Feed
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from bookmarks.models import Bookmark
from django.template.defaultfilters impo... | Add feed support for bookmarks by ericfo | Add feed support for bookmarks by ericfo
git-svn-id: e32780fd4e06e3e07c0119d454e1aebcae894468@13 413268e4-d34f-0410-bd0d-61523dc7b0b6
| Python | mit | incuna/incuna-bookmarks,pinax/django-bookmarks,incuna/incuna-bookmarks | ---
+++
@@ -0,0 +1,59 @@
+from atomformat import Feed
+from django.core.urlresolvers import reverse
+from django.conf import settings
+from django.contrib.sites.models import Site
+from django.contrib.auth.models import User
+from django.shortcuts import get_object_or_404
+from bookmarks.models import Bookmark
+from ... | |
07f46255120fd2dc6c33e2c6ed8b215fce9f01c5 | microdrop/bin/create_portable_config.py | microdrop/bin/create_portable_config.py | import os
import sys
import pkg_resources
from path_helpers import path
import jinja2
config_template = '''
data_dir = .
[plugins]
# directory containing microdrop plugins
directory = plugins
[microdrop.gui.experiment_log_controller]
notebook_directory = notebooks
[microdrop.gui.dmf_device_co... | Add script to create init portable settings | [NB] Add script to create init portable settings
Usage:
python -m microdrop.bin.create_portable_config [-h] output_dir
Create portable MicroDrop settings directory.
positional arguments:
output_dir
optional arguments:
-h, --help show this help message and exit
| Python | bsd-3-clause | wheeler-microfluidics/microdrop | ---
+++
@@ -0,0 +1,70 @@
+import os
+import sys
+import pkg_resources
+
+from path_helpers import path
+import jinja2
+
+
+config_template = '''
+data_dir = .
+[plugins]
+ # directory containing microdrop plugins
+ directory = plugins
+[microdrop.gui.experiment_log_controller]
+ notebook_director... | |
ee0abfe77086737ad4471d09e5f55536874132ab | ideascube/conf/idb_fra_grandesynthe.py | ideascube/conf/idb_fra_grandesynthe.py | # -*- coding: utf-8 -*-
"""Ideaxbox for Grande Synthe, France"""
from .idb import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_NAME = u"Grande-Synthe"
IDEASCUBE_PLACE_NAME = _("city")
COUNTRIES_FIRST = ['FR']
TIME_ZONE = None
LANGUAGE_CODE = 'fr'
LOAN_DURATION = 14
MONITORING_ENTRY_EXPOR... | Add config file for Grande Synthe France | Add config file for Grande Synthe France
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+"""Ideaxbox for Grande Synthe, France"""
+from .idb import * # noqa
+from django.utils.translation import ugettext_lazy as _
+
+IDEASCUBE_NAME = u"Grande-Synthe"
+IDEASCUBE_PLACE_NAME = _("city")
+COUNTRIES_FIRST = ['FR']
+TIME_ZONE = None
+LANGUAGE_CODE = 'fr'
+LOA... | |
f43a44f56ff965e772c2e8de0a7b485da05065a2 | ovp_projects/tests/test_serializers.py | ovp_projects/tests/test_serializers.py | from django.test import TestCase
from django.test import RequestFactory
from ovp_projects.models import Project
from ovp_projects.serializers.project import ProjectRetrieveSerializer
from ovp_projects.serializers.project import ProjectSearchSerializer
from ovp_users.models import User
from ovp_core.models import Goog... | Add tests for hidden address on ProjectRetrieveSerializer and ProjectSearchSerializer | Add tests for hidden address on ProjectRetrieveSerializer and ProjectSearchSerializer
| Python | agpl-3.0 | OpenVolunteeringPlatform/django-ovp-projects,OpenVolunteeringPlatform/django-ovp-projects | ---
+++
@@ -0,0 +1,55 @@
+from django.test import TestCase
+from django.test import RequestFactory
+
+from ovp_projects.models import Project
+from ovp_projects.serializers.project import ProjectRetrieveSerializer
+from ovp_projects.serializers.project import ProjectSearchSerializer
+
+from ovp_users.models import Us... | |
985e9167bdfa857c5148ee0431fdd13d50ba787e | viewflow/migrations/0002_fsmchange.py | viewflow/migrations/0002_fsmchange.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def update_status(apps, schema_editor):
Process = apps.get_model("viewflow", "Process")
Process.objects.filter(status='STR').update(status='STARTED')
Process.objects.filter(status='FNS').update(status... | Fix migrations for 0.8 -> 0.9 upgrade | Fix migrations for 0.8 -> 0.9 upgrade
| Python | agpl-3.0 | pombredanne/viewflow,viewflow/viewflow,viewflow/viewflow,ribeiro-ucl/viewflow,ribeiro-ucl/viewflow,codingjoe/viewflow,codingjoe/viewflow,codingjoe/viewflow,pombredanne/viewflow,viewflow/viewflow,ribeiro-ucl/viewflow | ---
+++
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+def update_status(apps, schema_editor):
+ Process = apps.get_model("viewflow", "Process")
+ Process.objects.filter(status='STR').update(status='STARTED')
+ Process.objec... | |
3237345bdc725fc631b208ea705cb41b722bcd1f | exercises/chapter_03/exercise_03_01.py | exercises/chapter_03/exercise_03_01.py | # 3-1 Names
friend_names = ["Albert Einstein", "Isac Newton", "Marie Curie", "Galileo Galilei"]
print(friend_names[0])
print(friend_names[1])
print(friend_names[2])
print(friend_names[3])
| Add solution to exercise 3.1. | Add solution to exercise 3.1.
| Python | mit | HenrikSamuelsson/python-crash-course | ---
+++
@@ -0,0 +1,8 @@
+# 3-1 Names
+
+friend_names = ["Albert Einstein", "Isac Newton", "Marie Curie", "Galileo Galilei"]
+
+print(friend_names[0])
+print(friend_names[1])
+print(friend_names[2])
+print(friend_names[3]) | |
455806aa0a25f2c632c62f00de21b5d3768135cb | cherrypy/test/test_wsgi_unix_socket.py | cherrypy/test/test_wsgi_unix_socket.py | import os
import sys
import socket
import atexit
import cherrypy
from cherrypy.test import helper
from cherrypy._cpcompat import HTTPConnection
USOCKET_PATH = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'cp_test.sock'
)
class USocketHTTPConnection(HTTPConnection):
"""
HTTPConnection ... | Add a basic test case for the unix socket support in cherrypy. | Add a basic test case for the unix socket support in cherrypy.
| Python | bsd-3-clause | Safihre/cherrypy,cherrypy/cherrypy,Safihre/cherrypy,cherrypy/cherrypy,cherrypy/cheroot | ---
+++
@@ -0,0 +1,104 @@
+import os
+import sys
+import socket
+import atexit
+
+import cherrypy
+from cherrypy.test import helper
+from cherrypy._cpcompat import HTTPConnection
+
+
+USOCKET_PATH = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ 'cp_test.sock'
+)
+
+
+class USocketHTTPConnection... | |
f48ebff1ba0bb8fd3c1335db5bec101032d0d31b | scripts/make-gaps-for-missing-layers.py | scripts/make-gaps-for-missing-layers.py | #!/usr/bin/python
# This script renames the directories in a CATMAID stack's image root
# to take into account missing layers corresponding to particular
# z-values. This can occur when exporting the data from TrakEM2.
import glob, os, re, sys, subprocess
layers_missing_z = [
4950.0,
9450.0,
17500.0,
17550.... | Add a script to rename CATMAID image directories to take account of missing layers | Add a script to rename CATMAID image directories to take account of missing layers
| Python | agpl-3.0 | fzadow/CATMAID,htem/CATMAID,fzadow/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+
+# This script renames the directories in a CATMAID stack's image root
+# to take into account missing layers corresponding to particular
+# z-values. This can occur when exporting the data from TrakEM2.
+
+import glob, os, re, sys, subprocess
+
+layers_missing_z = [
+ ... | |
69738f5b8e9604b75ad49a72e86f322a7300e7c9 | tests/test_automaton.py | tests/test_automaton.py | #!/usr/bin/env python3
"""Functions for testing the Automaton abstract base class."""
import nose.tools as nose
from automata.base.automaton import Automaton
def test_abstract_methods_not_implemented():
"""Should raise NotImplementedError when calling abstract methods."""
with nose.assert_raises(NotImplemen... | Add tests for abstract method NotImplementedError | Add tests for abstract method NotImplementedError
| Python | mit | caleb531/automata | ---
+++
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+"""Functions for testing the Automaton abstract base class."""
+
+import nose.tools as nose
+
+from automata.base.automaton import Automaton
+
+
+def test_abstract_methods_not_implemented():
+ """Should raise NotImplementedError when calling abstract methods."""
+ ... | |
07867356f110026a2249d49fe5e583c42fc2a048 | tests/test_singleton.py | tests/test_singleton.py | import unittest
from nose.tools import *
import mock
from gargoyle.settings import manager
import gargoyle.models
class TestGargoyle(unittest.TestCase):
def test_gargoyle_global_is_a_switch_manager(self):
reload(gargoyle.singleton)
self.assertIsInstance(gargoyle.singleton.gargoyle,
... | import unittest
from nose.tools import *
import mock
from gargoyle.settings import manager
import gargoyle.models
class TestGargoyle(unittest.TestCase):
other_engine = dict()
def test_gargoyle_global_is_a_switch_manager(self):
reload(gargoyle.singleton)
self.assertIsInstance(gargoyle.single... | Add another test to make sure you can import settings and change them before importing the singleton | Add another test to make sure you can import settings and change them before importing the singleton
| Python | apache-2.0 | kalail/gutter,disqus/gutter,kalail/gutter,kalail/gutter,disqus/gutter | ---
+++
@@ -7,6 +7,8 @@
class TestGargoyle(unittest.TestCase):
+
+ other_engine = dict()
def test_gargoyle_global_is_a_switch_manager(self):
reload(gargoyle.singleton)
@@ -19,3 +21,11 @@
reload(gargoyle.singleton)
expected = ((), {'storage': manager.storage_engine})
... |
ac8ec32258652deefb39b8d29e05e52ca28bf1b4 | 14B-088/HI/HI_correct_mask_model.py | 14B-088/HI/HI_correct_mask_model.py |
'''
Swap the spatial axes. Swap the spectral and stokes axes.
'''
import sys
from astropy.io import fits
hdu = fits.open(sys.argv[1], mode='update')
hdu[0].data = hdu[0].data.swapaxes(0, 1)
hdu[0].data = hdu[0].data[:, :, ::-1, ::-1]
hdu.flush()
execfile("~/Dropbox/code_development/ewky_scripts/header_swap_axis... | Correct regridded mask and model | Correct regridded mask and model
| Python | mit | e-koch/VLA_Lband,e-koch/VLA_Lband | ---
+++
@@ -0,0 +1,24 @@
+
+'''
+Swap the spatial axes. Swap the spectral and stokes axes.
+'''
+
+import sys
+from astropy.io import fits
+
+
+hdu = fits.open(sys.argv[1], mode='update')
+
+hdu[0].data = hdu[0].data.swapaxes(0, 1)
+
+hdu[0].data = hdu[0].data[:, :, ::-1, ::-1]
+
+hdu.flush()
+
+execfile("~/Dropbox/c... | |
b0d13f4f6332e18390a1d8e0152e55b8fb2e780e | sdntest/examples/customtopo/triangle.py | sdntest/examples/customtopo/triangle.py | """Custom topology example
s1---s2
| /
| /
| /
s3
Consist of three fixed core switches, and each core switches will connect to m hosts through n switches.
"""
from mininet.topo import Topo
from optparse import OptionParser
class MyTopo( Topo ):
"Simple topology example."
# def __init__( self ):
def ... | Add a custom topology example | Add a custom topology example
| Python | mit | snlab-freedom/sdntest,snlab-freedom/sdntest | ---
+++
@@ -0,0 +1,65 @@
+"""Custom topology example
+s1---s2
+| /
+| /
+| /
+s3
+
+Consist of three fixed core switches, and each core switches will connect to m hosts through n switches.
+
+"""
+
+from mininet.topo import Topo
+from optparse import OptionParser
+
+class MyTopo( Topo ):
+ "Simple topology exa... | |
bdbd262be925e318a6096606884af793aca158f7 | Lib/fontbakery/profiles/iso15008.py | Lib/fontbakery/profiles/iso15008.py | """
Checks for suitability for in-car displays (ISO 15008).
"""
from fontbakery.callable import check
from fontbakery.section import Section
from fontbakery.status import PASS, FAIL, WARN
from fontbakery.fonts_profile import profile_factory
from fontbakery.message import Message
from fontTools.pens.boundsPen import Bo... | Add new ISO15008 profile and proportion check | Add new ISO15008 profile and proportion check | Python | apache-2.0 | moyogo/fontbakery,googlefonts/fontbakery,moyogo/fontbakery,googlefonts/fontbakery,moyogo/fontbakery,googlefonts/fontbakery | ---
+++
@@ -0,0 +1,56 @@
+"""
+Checks for suitability for in-car displays (ISO 15008).
+"""
+
+from fontbakery.callable import check
+from fontbakery.section import Section
+from fontbakery.status import PASS, FAIL, WARN
+from fontbakery.fonts_profile import profile_factory
+from fontbakery.message import Message
+fr... | |
655d7777342b8446d94d0f81dda293740c574d3d | strategy/artifacting.py | strategy/artifacting.py | # Copyright 2017, Rackspace US, 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 a new strategy filtering tasks | Add a new strategy filtering tasks
Ideally Ansible should allow (from a playbook) to run only part
of a role thanks to its tags (like the --skip-tags or --tags from
the cli). But it's not possible now.
This code is a PoC code for introducing a kind of filtering,
which basically skips tasks containing the word "config... | Python | apache-2.0 | os-cloud/openstack-ansible-plugins,openstack/openstack-ansible-plugins,os-cloud/openstack-ansible-plugins,openstack/openstack-ansible-plugins | ---
+++
@@ -0,0 +1,35 @@
+# Copyright 2017, Rackspace US, 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... | |
2da56c5bd7b5f33eb8e7769cb76c29a64058c96e | flexget/plugins/est_released_series.py | flexget/plugins/est_released_series.py | from __future__ import unicode_literals, division, absolute_import
import logging
from sqlalchemy import desc, func
from flexget.manager import Session
from flexget.plugin import register_plugin, priority
from flexget.plugins.filter.series import SeriesDatabase, Series, Episode
from flexget.utils.tools import multipl... | from __future__ import unicode_literals, division, absolute_import
import logging
from sqlalchemy import desc, func
from flexget.manager import Session
from flexget.plugin import register_plugin, priority, DependencyError
from flexget.utils.tools import multiply_timedelta
try:
from flexget.plugins.filter.series i... | Raise DependencyError when series plugin is missing | Raise DependencyError when series plugin is missing
| Python | mit | vfrc2/Flexget,dsemi/Flexget,Danfocus/Flexget,thalamus/Flexget,JorisDeRieck/Flexget,crawln45/Flexget,antivirtel/Flexget,ibrahimkarahan/Flexget,poulpito/Flexget,voriux/Flexget,drwyrm/Flexget,Pretagonist/Flexget,qk4l/Flexget,patsissons/Flexget,JorisDeRieck/Flexget,malkavi/Flexget,X-dark/Flexget,JorisDeRieck/Flexget,tsnoam... | ---
+++
@@ -4,14 +4,17 @@
from sqlalchemy import desc, func
from flexget.manager import Session
-from flexget.plugin import register_plugin, priority
-from flexget.plugins.filter.series import SeriesDatabase, Series, Episode
+from flexget.plugin import register_plugin, priority, DependencyError
from flexget.util... |
04a8da721f246382967c4e834ffac8a54506ae94 | test/test_text_utils.py | test/test_text_utils.py | """
Tests for text_utils.py
part of https://github.com/evil-mad/plotink
"""
import unittest
from plotink import text_utils
# python -m unittest discover in top-level package dir
# pylint: disable=too-many-public-methods
class TextUtilsTestCase(unittest.TestCase):
"""
Unit tests for text_utils.py
"""... | Add unit tests for text_utils | Add unit tests for text_utils
| Python | mit | evil-mad/plotink | ---
+++
@@ -0,0 +1,60 @@
+"""
+Tests for text_utils.py
+
+part of https://github.com/evil-mad/plotink
+
+"""
+
+import unittest
+
+from plotink import text_utils
+
+# python -m unittest discover in top-level package dir
+
+# pylint: disable=too-many-public-methods
+
+
+class TextUtilsTestCase(unittest.TestCase):
+ ... | |
7b0d2caf4b2a0ed5074d847166b0868a4a2d5d7c | scripts/split_indexed.py | scripts/split_indexed.py | import argparse
import os
import struct
import tqdm
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--input', required=True)
parser.add_argument('--num-pieces', required=True, type=int)
args = parser.parse_args()
root, ext = os.path.splitext(args.input)
ind... | Add script to split indexed files | Add script to split indexed files
| Python | apache-2.0 | nearai/program_synthesis,nearai/program_synthesis | ---
+++
@@ -0,0 +1,57 @@
+import argparse
+import os
+import struct
+
+import tqdm
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--input', required=True)
+ parser.add_argument('--num-pieces', required=True, type=int)
+ args = parser.parse_args()
+
+ root, ext... | |
a42c4423748171c5611d82a101f3b70741ff75db | tests/test_increment.py | tests/test_increment.py | from gypsy import increment
def test_increment_basal_area_pl():
args = []
expected = None
result = increment.increment_basal_area_pl(*args)
assert result == expected
# TODO: known value
# TODO: 0 as an input
# TODO: negative as an input
def test_increment_basal_area_aw():
args = []
... | Add boilerplate for increment tests | Add boilerplate for increment tests
These would have been very helpful when introducing cython for increment
functions. It is a lot easier to debug at this fine grained level than
in wrapping functions.
| Python | mit | tesera/pygypsy,tesera/pygypsy | ---
+++
@@ -0,0 +1,41 @@
+from gypsy import increment
+
+def test_increment_basal_area_pl():
+ args = []
+ expected = None
+ result = increment.increment_basal_area_pl(*args)
+ assert result == expected
+ # TODO: known value
+ # TODO: 0 as an input
+ # TODO: negative as an input
+
+
+def test_inc... | |
885abeff9859320a59d3afeb297b8138f9c7fa51 | tools/audio_in_cards.py | tools/audio_in_cards.py | #!/usr/bin/env python
#
# Licensed under the BSD license. See full license in LICENSE file.
# http://www.lightshowpi.com/
#
# Author: Todd Giles (todd@lightshowpi.com)
"""Trivial wrapper around alsaaduio.cards() for getting a list of your audio cards.
Helpful in determining the list of USB audio cards in advanced aud... | Update some comments on audio-in mode, including links to new wiki page. Also add tool wrapper around alsaaudio.cards() | Update some comments on audio-in mode, including links to new wiki page. Also add tool wrapper around alsaaudio.cards()
| Python | bsd-2-clause | Cerberus98/lightshowpi,Cerberus98/lightshowpi,bradowen2011/lightshowpi,wheeldog515/lightshowPi,bradowen2011/lightshowpi,wheeldog515/lightshowPi | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+#
+# Licensed under the BSD license. See full license in LICENSE file.
+# http://www.lightshowpi.com/
+#
+# Author: Todd Giles (todd@lightshowpi.com)
+"""Trivial wrapper around alsaaduio.cards() for getting a list of your audio cards.
+
+Helpful in determining the lis... | |
eada7c5b0a82f870fa4a0850481b28bc34eb25bd | ms2ldaviz/debug_motifdb.py | ms2ldaviz/debug_motifdb.py | import requests
server_url = 'http://ms2lda.org/motifdb/'
# server_url = 'http://localhost:8000/motifdb/'
"""Grabbing the latest Motifs from MS2LDA"""
motifset_dict = requests.get(server_url + 'list_motifsets/', verify=False).json()
db_list = []
db_list.append(2)
db_list.append(4)
db_list.append(1)
db_list.append(3)
... | Add a motifdb debug script | Add a motifdb debug script
| Python | mit | sdrogers/ms2ldaviz,sdrogers/ms2ldaviz,sdrogers/ms2ldaviz,sdrogers/ms2ldaviz | ---
+++
@@ -0,0 +1,31 @@
+import requests
+
+server_url = 'http://ms2lda.org/motifdb/'
+# server_url = 'http://localhost:8000/motifdb/'
+
+"""Grabbing the latest Motifs from MS2LDA"""
+motifset_dict = requests.get(server_url + 'list_motifsets/', verify=False).json()
+db_list = []
+db_list.append(2)
+db_list.append(4)... | |
012ea594d171041a9ff064783b7c0a392a827d4c | spacy/tests/test_misc.py | spacy/tests/test_misc.py | # coding: utf-8
from __future__ import unicode_literals
from ..util import ensure_path
from pathlib import Path
import pytest
@pytest.mark.parametrize('text', ['hello/world', 'hello world'])
def test_util_ensure_path_succeeds(text):
path = ensure_path(text)
assert isinstance(path, Path)
@pytest.mark.param... | Add file for misc tests | Add file for misc tests
| Python | mit | honnibal/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,raphael0202/spaCy,aikramer2/spaCy,raphael0202/spaCy,spacy-io/spaCy,aikramer2/spaCy,explosion/spaCy,honnibal/spaCy,recognai/spaCy,spacy-io/spaCy,spacy-io/spaCy,recognai/spaCy,honnibal/spaCy,aikramer2/spaCy,explosion/spaCy,Gregory-Howard/spaCy,Gregory-Howard/s... | ---
+++
@@ -0,0 +1,19 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..util import ensure_path
+
+from pathlib import Path
+import pytest
+
+
+@pytest.mark.parametrize('text', ['hello/world', 'hello world'])
+def test_util_ensure_path_succeeds(text):
+ path = ensure_path(text)
+ assert isi... | |
5ecaed42c8f4389a6d12851d41c22dad22e2a2d8 | storm/src/py/resources/morelikethis.py | storm/src/py/resources/morelikethis.py | # -*- coding: utf-8 -*-
"""
zeit.recommend.morelikethis
~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module has no description.
Copyright: (c) 2013 by Nicolas Drebenstedt.
License: BSD, see LICENSE for more details.
"""
from elasticsearch import Elasticsearch
from storm import Bolt
from storm import log
fro... | Add barebone content-based, Solr-powered recommender | Add barebone content-based, Solr-powered recommender
| Python | bsd-2-clause | cutoffthetop/recommender,cutoffthetop/recommender,cutoffthetop/recommender | ---
+++
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+
+"""
+ zeit.recommend.morelikethis
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ This module has no description.
+
+ Copyright: (c) 2013 by Nicolas Drebenstedt.
+ License: BSD, see LICENSE for more details.
+"""
+
+from elasticsearch import Elasticsearch
+from st... | |
3174797eea1bd7ae131a355ab020ad26274b379a | vispy/scene/cameras/tests/test_link.py | vispy/scene/cameras/tests/test_link.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
f... | Add tests for camera linking | Add tests for camera linking
| Python | bsd-3-clause | Eric89GXL/vispy,Eric89GXL/vispy,Eric89GXL/vispy | ---
+++
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+# -----------------------------------------------------------------------------
+# Copyright (c) Vispy Development Team. All Rights Reserved.
+# Distributed under the (new) BSD License. See LICENSE.txt for more info.
+# -----------------------------------------------... | |
a2ff7e03da07f75b4ce8e67e9e2ef065f45e3338 | messenger/make_octave.py | messenger/make_octave.py | #!/usr/bin/python
from __future__ import print_function
import os
import sys
import shutil
import subprocess
# Check the system platform first
platform = sys.platform
print("This is a " + platform + " system")
if platform.startswith('linux'):
messenger_dir = 'mexa64'
elif platform.startswith('darwin'):
messen... | Add an octave build script | Add an octave build script
| Python | bsd-3-clause | jjangsangy/python-matlab-bridge,jjangsangy/python-matlab-bridge,arokem/python-matlab-bridge,arokem/python-matlab-bridge,blink1073/python-matlab-bridge,arokem/python-matlab-bridge,blink1073/python-matlab-bridge,jjangsangy/python-matlab-bridge,blink1073/python-matlab-bridge | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+from __future__ import print_function
+import os
+import sys
+import shutil
+import subprocess
+
+# Check the system platform first
+platform = sys.platform
+print("This is a " + platform + " system")
+
+if platform.startswith('linux'):
+ messenger_dir = 'mexa64'
+elif ... | |
3ccd2e71b314ba63c3df9f43635c92d996b5fed8 | libcloud/test/common/test_base_driver.py | libcloud/test/common/test_base_driver.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | Add failing regression test case for timeout argument preservation on the BaseDriver class. | Add failing regression test case for timeout argument preservation on the
BaseDriver class.
| Python | apache-2.0 | watermelo/libcloud,Scalr/libcloud,Scalr/libcloud,Kami/libcloud,lochiiconnectivity/libcloud,iPlantCollaborativeOpenSource/libcloud,ByteInternet/libcloud,Kami/libcloud,supertom/libcloud,t-tran/libcloud,DimensionDataCBUSydney/libcloud,mgogoulos/libcloud,illfelder/libcloud,StackPointCloud/libcloud,apache/libcloud,StackPoin... | ---
+++
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (... | |
bf771afb7b6cdef86d6c310882299e31102425c9 | examples/test_get_pdf_text.py | examples/test_get_pdf_text.py | from seleniumbase import BaseCase
class PdfTestClass(BaseCase):
def test_get_pdf_text(self):
pdf = ("https://nostarch.com/download/"
"Automate_the_Boring_Stuff_sample_ch17.pdf")
pdf_text = self.get_pdf_text(pdf, page=1)
print(pdf_text)
| Add an example test for get_pdf_text(pdf, page) | Add an example test for get_pdf_text(pdf, page)
| Python | mit | seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase | ---
+++
@@ -0,0 +1,10 @@
+from seleniumbase import BaseCase
+
+
+class PdfTestClass(BaseCase):
+
+ def test_get_pdf_text(self):
+ pdf = ("https://nostarch.com/download/"
+ "Automate_the_Boring_Stuff_sample_ch17.pdf")
+ pdf_text = self.get_pdf_text(pdf, page=1)
+ print(pdf_text) | |
f9c40170e545e851a8cf6c0f861aa590f1a6078e | tests/unit/modules/inspect_fsdb_test.py | tests/unit/modules/inspect_fsdb_test.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 SUSE LLC
#
# 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 agr... | Add initial tests for fsdb | Add initial tests for fsdb
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,93 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright 2016 SUSE LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Un... | |
8e065cb164b4ec1a9aafd7f448555707a875fab9 | aggregator/espn_fc.py | aggregator/espn_fc.py | import datetime
from aggregator import exceptions
from aggregator.base import Aggregator, Article, InvalidArticle, make_soup
EXCLUDE_IF_IN_TITLE = ['LIVE:', 'WATCH:', 'LISTEN:']
class ESPNFC(Aggregator):
base_url = 'http://www.espnfc.com/?country-view=www&lang-view=en'
source = 'ESPN FC'
def extract(se... | Implement web scraping functionality for ESPN FC | Implement web scraping functionality for ESPN FC
| Python | apache-2.0 | footynews/fn_backend | ---
+++
@@ -0,0 +1,67 @@
+import datetime
+
+from aggregator import exceptions
+from aggregator.base import Aggregator, Article, InvalidArticle, make_soup
+
+EXCLUDE_IF_IN_TITLE = ['LIVE:', 'WATCH:', 'LISTEN:']
+
+class ESPNFC(Aggregator):
+
+ base_url = 'http://www.espnfc.com/?country-view=www&lang-view=en'
+ ... | |
1ec2cac94d7f98d651df32b21971039bddfbb996 | tempest/tests/lib/services/volume/v2/test_extensions_client.py | tempest/tests/lib/services/volume/v2/test_extensions_client.py | # Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LI... | Add unit test for volume extensions client | Add unit test for volume extensions client
This patch adds unit test for volume v2 extensions client.
Partially Implements: blueprint tempest-lib-missing-test-coverage
Change-Id: I5a614fb92f44f5960610dc39299c6effb979be9a
| Python | apache-2.0 | masayukig/tempest,openstack/tempest,cisco-openstack/tempest,openstack/tempest,cisco-openstack/tempest,vedujoshi/tempest,Juniper/tempest,Juniper/tempest,vedujoshi/tempest,masayukig/tempest | ---
+++
@@ -0,0 +1,70 @@
+# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# ... | |
9ef706517a0ee3b460881d99d667fa5ba2829a12 | admin/mailu/dockercli.py | admin/mailu/dockercli.py | from mailu import app
import docker
import signal
# Connect to the Docker socket
cli = docker.Client(base_url=app.config['DOCKER_SOCKET'])
def get(*names):
result = {}
all_containers = cli.containers(all=True)
for brief in all_containers:
if brief['Image'].startswith('mailu/'):
cont... | Add the Docker client helper | Add the Docker client helper
| Python | mit | kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io | ---
+++
@@ -0,0 +1,26 @@
+from mailu import app
+
+import docker
+import signal
+
+
+# Connect to the Docker socket
+cli = docker.Client(base_url=app.config['DOCKER_SOCKET'])
+
+
+def get(*names):
+ result = {}
+ all_containers = cli.containers(all=True)
+ for brief in all_containers:
+ if brief['Imag... | |
d9c59ed8556c02d612eeb55fdfc3fc6ceef8844c | setup.py | setup.py | from setuptools import setup, find_packages
def get_long_description():
with open('./README.rst', 'r') as readme:
return readme.read()
setup(
name='django-email-tracker',
version='0.2',
description='Email Tracker for Django',
author='Venelina Yanakieva',
author_email='vili@magicsoluti... | from setuptools import setup, find_packages
def get_long_description():
with open('./README.rst', 'r') as readme:
return readme.read()
setup(
name='django-email-tracker',
version='0.2',
description='Email Tracker for Django',
author='Venelina Yanakieva',
author_email='vili@magicsoluti... | Add maintainer and download URL | Add maintainer and download URL | Python | mit | MagicSolutions/django-email-tracker,IndustriaTech/django-email-tracker | ---
+++
@@ -11,7 +11,10 @@
description='Email Tracker for Django',
author='Venelina Yanakieva',
author_email='vili@magicsolutions.bg',
+ maintainer='Venelin Stoykov',
+ maintainer_email='venelin@magicsolutions.bg',
url='https://github.com/MagicSolutions/django-email-tracker',
+ download_u... |
1ef6ec49377eee80c33f37ca7db5133404df9ce6 | setup.py | setup.py | from setuptools import setup
setup(
name='PyHunter',
packages=['PyHunter'],
version='0.2',
description='An (unofficial) Python wrapper for the Hunter.io API',
author='Quentin Durantay',
author_email='quentin.durantay@gmail.com',
url='https://github.com/VonStruddle/PyHunter',
download_u... | from setuptools import setup
setup(
name='pyhunter',
packages=['pyhunter'],
version='0.2',
description='An (unofficial) Python wrapper for the Hunter.io API',
author='Quentin Durantay',
author_email='quentin.durantay@gmail.com',
url='https://github.com/VonStruddle/PyHunter',
download_u... | Use lowercase name for library | Use lowercase name for library
| Python | mit | VonStruddle/PyHunter | ---
+++
@@ -2,8 +2,8 @@
setup(
- name='PyHunter',
- packages=['PyHunter'],
+ name='pyhunter',
+ packages=['pyhunter'],
version='0.2',
description='An (unofficial) Python wrapper for the Hunter.io API',
author='Quentin Durantay', |
be5ccf56a43732ca799ebd9197af98f0175f0b7f | CodeFights/floatRange.py | CodeFights/floatRange.py | #!/usr/local/bin/python
# Code Fights Float Range Problem
from itertools import count, takewhile
def floatRange(start, stop, step):
gen = takewhile(lambda x: x < stop, count(start, step))
return list(gen)
def main():
tests = [
[-0.9, 0.45, 0.2, [-0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3]],
... | Solve Code Fights float range problem | Solve Code Fights float range problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/local/bin/python
+# Code Fights Float Range Problem
+
+from itertools import count, takewhile
+
+
+def floatRange(start, stop, step):
+ gen = takewhile(lambda x: x < stop, count(start, step))
+ return list(gen)
+
+
+def main():
+ tests = [
+ [-0.9, 0.45, 0.2, [-0.9, -0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.