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
02181601597e203777412b9377af47525eee77f4
custom/enikshay/management/commands/update_enikshay_custom_data.py
custom/enikshay/management/commands/update_enikshay_custom_data.py
from django.core.management.base import BaseCommand from corehq.apps.custom_data_fields.models import CustomDataFieldsDefinition, CustomDataField from corehq.apps.locations.views import LocationFieldsView from corehq.apps.users.views.mobile.custom_data_fields import UserFieldsView # pcp -> MBBS # pac -> AYUSH/other # ...
Add mgmt command to auto-add new fields
Add mgmt command to auto-add new fields
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,77 @@ +from django.core.management.base import BaseCommand +from corehq.apps.custom_data_fields.models import CustomDataFieldsDefinition, CustomDataField +from corehq.apps.locations.views import LocationFieldsView +from corehq.apps.users.views.mobile.custom_data_fields import UserFieldsView + +# pc...
4db57a5fa786e9e209b428d4215b6033d15f1315
functest/tests/unit/features/test_copper.py
functest/tests/unit/features/test_copper.py
#!/usr/bin/env python # Copyright (c) 2017 Orange and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 # pylint: d...
Add unit tests for copper
Add unit tests for copper Change-Id: Ia4e53e2aee5b93071b3acd3d75c7e42841321a0a Signed-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>
Python
apache-2.0
opnfv/functest,mywulin/functest,mywulin/functest,opnfv/functest
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Orange and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.or...
04b85be1ddc9bc32aba0129ea89b1779be598489
bot/multithreading/worker/pool/workers/limited_lifespan.py
bot/multithreading/worker/pool/workers/limited_lifespan.py
import queue from bot.multithreading.worker import QueueWorker class LimitedLifespanQueueWorker(QueueWorker): def __init__(self, name: str, work_queue: queue.Queue, error_handler: callable, max_seconds_idle: int, end_notify: callable): """ :param max_seconds_idle: Max seconds to ...
Create a temporal worker that is running only when there is work to do, waiting max_seconds_idle before ending
Create a temporal worker that is running only when there is work to do, waiting max_seconds_idle before ending
Python
agpl-3.0
alvarogzp/telegram-bot,alvarogzp/telegram-bot
--- +++ @@ -0,0 +1,34 @@ +import queue + +from bot.multithreading.worker import QueueWorker + + +class LimitedLifespanQueueWorker(QueueWorker): + def __init__(self, name: str, work_queue: queue.Queue, error_handler: callable, max_seconds_idle: int, + end_notify: callable): + """ + :pa...
9556916a2732da3681c044f5c7f5a78cda6ee25d
sigma_core/migrations/0008_auto_20160108_1618.py
sigma_core/migrations/0008_auto_20160108_1618.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-01-08 15:18 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('sigma_core', '0007_auto_20160...
Add migrations for custom fields / groups custom fields
Add migrations for custom fields / groups custom fields
Python
agpl-3.0
ProjetSigma/backend,ProjetSigma/backend
--- +++ @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-01-08 15:18 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ ...
bd16a5ccb8e0cc9b68ebd9ee2285c466e8fff32e
candidates/migrations/0016_migrate_data_to_extra_fields.py
candidates/migrations/0016_migrate_data_to_extra_fields.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings def from_person_extra_to_generic_fields(apps, schema_editor): ExtraField = apps.get_model('candidates', 'ExtraField') PersonExtraFieldValue = apps.get_model('candidates', '...
Add a data migration for extra fields for BF and CR
Add a data migration for extra fields for BF and CR
Python
agpl-3.0
datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit
--- +++ @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + +def from_person_extra_to_generic_fields(apps, schema_editor): + ExtraField = apps.get_model('candidates', 'ExtraField') + PersonExtraFieldVa...
b20fbe03717183cb45da81179fd0b6886f2b6b2a
alembic/versions/96ca40f7c6c2_add_creator.py
alembic/versions/96ca40f7c6c2_add_creator.py
"""add creator Revision ID: 96ca40f7c6c2 Revises: ef6fef5147b2 Create Date: 2016-10-27 15:14:18.031571 """ # revision identifiers, used by Alembic. revision = '96ca40f7c6c2' down_revision = 'ef6fef5147b2' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa from sqlalchemy.dialects ...
Add missing kingdom/user foreign key
Add missing kingdom/user foreign key
Python
mit
EliRibble/dominus,EliRibble/dominus,EliRibble/dominus,EliRibble/dominus
--- +++ @@ -0,0 +1,24 @@ +"""add creator + +Revision ID: 96ca40f7c6c2 +Revises: ef6fef5147b2 +Create Date: 2016-10-27 15:14:18.031571 + +""" + +# revision identifiers, used by Alembic. +revision = '96ca40f7c6c2' +down_revision = 'ef6fef5147b2' +branch_labels = None +depends_on = None + +from alembic import op +import...
808c00dd295fce89a5c8bde7b20bd558e7c674a2
grammpy-transforms/ChomskyHiearchy/__init__.py
grammpy-transforms/ChomskyHiearchy/__init__.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy-transforms """
Add package for transforming context-free grammar into Chomskey hiearchy
Add package for transforming context-free grammar into Chomskey hiearchy
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,8 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 23.06.2017 16:39 +:Licence GNUv3 +Part of grammpy-transforms + +"""
77eb463bde029956557a1e9abedbef22ec21f647
examples/list_windows_updates.py
examples/list_windows_updates.py
""" Example script for listing installed updates on Windows 10 Requirements: - Windows 10 (may work on Win7+) - pywinauto 0.6.1+ This example opens "Control Panel", navigates to "Installed Updates" page and lists all updates (for all apps) as well as OS Windows updates only. """ from __future__ import print_func...
Add an example listing installed Windows updates.
Add an example listing installed Windows updates.
Python
bsd-3-clause
airelil/pywinauto,vasily-v-ryabov/pywinauto,cetygamer/pywinauto,pywinauto/pywinauto,drinkertea/pywinauto
--- +++ @@ -0,0 +1,40 @@ +""" +Example script for listing installed updates on Windows 10 + +Requirements: + - Windows 10 (may work on Win7+) + - pywinauto 0.6.1+ + +This example opens "Control Panel", navigates to "Installed Updates" page +and lists all updates (for all apps) as well as OS Windows updates only. +"...
f499f58c765cbd83e77e44be1dfbccc3aed772c6
mozillians/users/management/commands/reindex_mozillians.py
mozillians/users/management/commands/reindex_mozillians.py
from django.core.management.base import BaseCommand from mozillians.users.tasks import index_all_profiles class Command(BaseCommand): def handle(self, *args, **options): index_all_profiles()
Add management command to reindex mozillians ES.
Add management command to reindex mozillians ES.
Python
bsd-3-clause
akatsoulas/mozillians,mozilla/mozillians,johngian/mozillians,mozilla/mozillians,mozilla/mozillians,johngian/mozillians,akatsoulas/mozillians,johngian/mozillians,akatsoulas/mozillians,mozilla/mozillians,akatsoulas/mozillians,johngian/mozillians
--- +++ @@ -0,0 +1,8 @@ +from django.core.management.base import BaseCommand + +from mozillians.users.tasks import index_all_profiles + + +class Command(BaseCommand): + def handle(self, *args, **options): + index_all_profiles()
e727f062fff4f8b522a5637dc617ac57b1850021
ghidra_plugin_ioncube_decrypt.py
ghidra_plugin_ioncube_decrypt.py
# Decrypts "encrypted" strings from ioncube's loaders #@author ss23 #@category _NEW_ #@keybinding #@menupath #@toolbar encryption_key = [0x25,0x68,0xd3,0xc2,0x28,0xf2,0x59,0x2e,0x94,0xee,0xf2,0x91,0xac,0x13,0x96,0x95] def attemptDecrypt(addr): tmplength = getByte(addr) if tmplength < 0: length = tmplength + 25...
Add a Ghidra pluglin for decrypting strings
Add a Ghidra pluglin for decrypting strings
Python
bsd-2-clause
ss23/ioncube-string-decoder,ss23/ioncube-string-decoder
--- +++ @@ -0,0 +1,70 @@ +# Decrypts "encrypted" strings from ioncube's loaders +#@author ss23 +#@category _NEW_ +#@keybinding +#@menupath +#@toolbar + +encryption_key = [0x25,0x68,0xd3,0xc2,0x28,0xf2,0x59,0x2e,0x94,0xee,0xf2,0x91,0xac,0x13,0x96,0x95] + +def attemptDecrypt(addr): + tmplength = getByte(addr) + if t...
7408c08e8550dddbdf02681fcf5c376a24f8f1f8
zinnia_twitter/__init__.py
zinnia_twitter/__init__.py
"""Twitter plugin for Django-blog-zinnia""" __version__ = '1.0' __license__ = 'BSD License' __author__ = 'Fantomas42' __email__ = 'fantomas42@gmail.com' __url__ = 'https://github.com/Fantomas42/zinnia-twitter'
Create zinnia_twitter module and add metadatas
Create zinnia_twitter module and add metadatas
Python
bsd-3-clause
django-blog-zinnia/zinnia-twitter
--- +++ @@ -0,0 +1,8 @@ +"""Twitter plugin for Django-blog-zinnia""" +__version__ = '1.0' +__license__ = 'BSD License' + +__author__ = 'Fantomas42' +__email__ = 'fantomas42@gmail.com' + +__url__ = 'https://github.com/Fantomas42/zinnia-twitter'
e215dc670cc258d3ec0d559f06e6fdfb7f37f845
Underline.py
Underline.py
# -*- coding: utf-8 -*- import re import sublime, sublime_plugin class UnderlineCommand(sublime_plugin.TextCommand): def run(self, edit): sel = self.view.sel()[0] line = self.view.substr(self.view.line(sel)) underline = "\n" + ("-" * len(line)) insertPos = sel while(self.view.substr(sublime.Re...
Create an underline for the selected text
Create an underline for the selected text
Python
mit
RichardHyde/SublimeText.Packages
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +import re +import sublime, sublime_plugin + +class UnderlineCommand(sublime_plugin.TextCommand): + def run(self, edit): + sel = self.view.sel()[0] + line = self.view.substr(self.view.line(sel)) + + underline = "\n" + ("-" * len(line)) + + insertPos = se...
433b2284ab8150a5c8c27b295b34324c7a87e905
tests/test_email_client.py
tests/test_email_client.py
from mock import call, patch from unittest import TestCase from keteparaha import GmailImapClient @patch('keteparaha.email_client.IMAPClient') class GmailClientTest(TestCase): def test_init_setups_and_logs_in(self, mock_imap_client): client = GmailImapClient('email', 'password') self.assertEqua...
Test for the gmail client class
Test for the gmail client class
Python
mit
aychedee/keteparaha,tomdottom/keteparaha
--- +++ @@ -0,0 +1,58 @@ +from mock import call, patch +from unittest import TestCase + +from keteparaha import GmailImapClient + + +@patch('keteparaha.email_client.IMAPClient') +class GmailClientTest(TestCase): + + def test_init_setups_and_logs_in(self, mock_imap_client): + client = GmailImapClient('email'...
b307df3b2b45e5ab003903b8ed5cf341506965fd
tests/test_model_object.py
tests/test_model_object.py
# encoding: utf-8 from marathon.models.base import MarathonObject import unittest class MarathonObjectTest(unittest.TestCase): def test_hashable(self): """ Regression test for issue #203 MarathonObject defined __eq__ but not __hash__, meaning that in in Python2.7 MarathonObjects...
Add a regression test showing hashing error
Add a regression test showing hashing error
Python
mit
thefactory/marathon-python,thefactory/marathon-python
--- +++ @@ -0,0 +1,21 @@ +# encoding: utf-8 + +from marathon.models.base import MarathonObject +import unittest + + +class MarathonObjectTest(unittest.TestCase): + + def test_hashable(self): + """ + Regression test for issue #203 + + MarathonObject defined __eq__ but not __hash__, meaning that...
310a7fd5024e49f82504410bf40647b7c8d14207
tricircle/tests/unit/common/test_utils.py
tricircle/tests/unit/common/test_utils.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # 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...
Add utils's check_string_length test case
Add utils's check_string_length test case 1. What is the problem Tricircle does not have utils module's test case 2. What is the solution to the problem Implement related test case 3. What the features need to be implemented to the Tricircle No new features Change-Id: I42e54cfe310349578ae0605789249acbc349f5e4
Python
apache-2.0
stackforge/tricircle,openstack/tricircle,openstack/tricircle,stackforge/tricircle
--- +++ @@ -0,0 +1,36 @@ + +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with ...
46d7e6f8dcf9b7cd4c9de913f05d4e86ed16b497
migrations/versions/70c7d046881_.py
migrations/versions/70c7d046881_.py
"""Add user model Revision ID: 70c7d046881 Revises: 19b7fe1331be Create Date: 2013-12-07 15:30:26.169000 """ # revision identifiers, used by Alembic. revision = '70c7d046881' down_revision = '19b7fe1331be' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - p...
Add db migration for user table
Add db migration for user table
Python
mit
streamr/marvin,streamr/marvin,streamr/marvin
--- +++ @@ -0,0 +1,34 @@ +"""Add user model + +Revision ID: 70c7d046881 +Revises: 19b7fe1331be +Create Date: 2013-12-07 15:30:26.169000 + +""" + +# revision identifiers, used by Alembic. +revision = '70c7d046881' +down_revision = '19b7fe1331be' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ...
fa88f6b332d14084f89aec99c0c436ae4c36dd58
setup.py
setup.py
import os from setuptools import setup from nvpy import nvpy # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(o...
import os from setuptools import setup from nvpy import nvpy # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(o...
Add docutils to the list of requirements.
Add docutils to the list of requirements. Install docutils during a pip install so that rendering reStructuredText (CTRL-r) works out of the box.
Python
bsd-3-clause
n8henrie/nvpy,dwu/nvpy,trankmichael/nvpy,khornberg/nvpy-gtk,yuuki0xff/nvpy,dwu/nvpy,bwillistower/nvpy,yuuki0xff/nvpy
--- +++ @@ -20,7 +20,7 @@ url = "https://github.com/cpbotha/nvpy", packages=['nvpy'], long_description=read('README.rst'), - install_requires = ['Markdown'], + install_requires = ['Markdown', 'docutils'], entry_points = { 'gui_scripts' : ['nvpy = nvpy.nvpy:main'] },
b75205319bc28f53c22fea34499d34aef279df9b
examples/microblog.py
examples/microblog.py
from dynamic_api_client import BaseClient class MicroBlogApi(BaseClient): available_paths = ['POST account/signin', 'GET posts/all'] separator = '/' def __init__(self, base_url='https://micro.blog', path='', token=''): self.token = token super(self.__class__, self).__init__(base_url, path, token=token) # ov...
Include a (very) simple example
Include a (very) simple example
Python
mit
andymitchhank/bessie
--- +++ @@ -0,0 +1,23 @@ +from dynamic_api_client import BaseClient + +class MicroBlogApi(BaseClient): + + available_paths = ['POST account/signin', 'GET posts/all'] + separator = '/' + + def __init__(self, base_url='https://micro.blog', path='', token=''): + self.token = token + super(self.__class__, self).__init_...
6f76a9735cd8208137e91782b233f98b406d401d
tests/test_simulator_main.py
tests/test_simulator_main.py
#!/usr/bin/env python3 import contextlib import io import nose.tools as nose import src.simulator as sim from unittest.mock import patch @patch('sys.argv', [ sim.__file__, '--cache-size', '4', '--num-blocks-per-set', '1', '--num-words-per-block', '1', '--word-addrs', '0', '8', '0', '6', '8']) def test_main()...
Add test for main function; bring coverage to 100%
Add test for main function; bring coverage to 100%
Python
mit
caleb531/cache-simulator
--- +++ @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +import contextlib +import io +import nose.tools as nose +import src.simulator as sim +from unittest.mock import patch + + +@patch('sys.argv', [ + sim.__file__, '--cache-size', '4', '--num-blocks-per-set', '1', + '--num-words-per-block', '1', '--word-addrs', '0...
c11e14296848ccfbaab36d540da79afc86c83b92
bvspca/core/migrations/0025_auto_20180202_1351.py
bvspca/core/migrations/0025_auto_20180202_1351.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-02-02 20:51 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0024_contentindexpage_empty_message'), ] operations = [ migrations....
Add default message for list pages
Add default message for list pages
Python
mit
nfletton/bvspca,nfletton/bvspca,nfletton/bvspca,nfletton/bvspca
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.9 on 2018-02-02 20:51 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0024_contentindexpage_empty_message'), + ] ...
ddd110081d4b21da88d947702ba2e37f87bf8cb0
tests/food/test_suggest_restaurant.py
tests/food/test_suggest_restaurant.py
import unittest from click.testing import CliRunner import yoda class TestSuggestRestaurant(unittest.TestCase): """ Test for the following commands: | Module: food | command: suggest_restaurant """ def __init__(self, methodName="runTest"): super(TestSuggestRestaurant, self)...
Add unit test for suggest_restaurant command.
Add unit test for suggest_restaurant command.
Python
mit
dude-pa/dude
--- +++ @@ -0,0 +1,24 @@ +import unittest + +from click.testing import CliRunner + +import yoda + + +class TestSuggestRestaurant(unittest.TestCase): + """ + Test for the following commands: + + | Module: food + | command: suggest_restaurant + """ + + def __init__(self, methodName="runTest"):...
a59cfbbbfd0732c58b9e2373d45118d01f7fcb90
website/tests/test_jobs.py
website/tests/test_jobs.py
import time from database import update, utc_now, db from database_testing import DatabaseTest from jobs import hard_delete_expired_datasets from models import User, UsersMutationsDataset from test_models.test_dataset import create_test_dataset class JobTest(DatabaseTest): def test_hard_delete_dataset(self): ...
Add test for hard delete job
Add test for hard delete job
Python
lgpl-2.1
reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome...
--- +++ @@ -0,0 +1,31 @@ +import time + +from database import update, utc_now, db +from database_testing import DatabaseTest +from jobs import hard_delete_expired_datasets +from models import User, UsersMutationsDataset +from test_models.test_dataset import create_test_dataset + + +class JobTest(DatabaseTest): + + ...
ec2861e077ec4b4084b60df085baf41caf9e15d4
readthedocs/rtd_tests/tests/test_oauth.py
readthedocs/rtd_tests/tests/test_oauth.py
from django.test import TestCase from django.contrib.auth.models import User from allauth.socialaccount.models import SocialToken from projects.models import Project from oauth.utils import make_github_project, make_github_organization, import_github from oauth.models import GithubOrganization, GithubProject cla...
Test for make_github_projec and make_github_organization
Test for make_github_projec and make_github_organization
Python
mit
wanghaven/readthedocs.org,asampat3090/readthedocs.org,davidfischer/readthedocs.org,sunnyzwh/readthedocs.org,nikolas/readthedocs.org,laplaceliu/readthedocs.org,hach-que/readthedocs.org,nikolas/readthedocs.org,raven47git/readthedocs.org,hach-que/readthedocs.org,cgourlay/readthedocs.org,royalwang/readthedocs.org,laplaceli...
--- +++ @@ -0,0 +1,61 @@ +from django.test import TestCase + +from django.contrib.auth.models import User +from allauth.socialaccount.models import SocialToken + +from projects.models import Project + +from oauth.utils import make_github_project, make_github_organization, import_github +from oauth.models import Gith...
73509b5cc07bbf4610b9860cadd1d09e529b710d
create_dummy_data.py
create_dummy_data.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # EXPLANATION: # This file fills the folder /data with dummy files (necessary for development # purposes while we don't have real data yet) # ---------------------------------------------------...
Create dummy files for /data
Create dummy files for /data
Python
mit
MartinThoma/akademie-graph,MartinThoma/akademie-graph,MartinThoma/akademie-graph
--- +++ @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# ----------------------------------------------------------------------------- +# EXPLANATION: +# This file fills the folder /data with dummy files (necessary for development +# purposes while we don't have real data yet) +# ----------------...
462205a8dde700b4d5f36225bbe5f9d15b59832b
Climate_Police/tests/test_pollution_map.py
Climate_Police/tests/test_pollution_map.py
#run the test with default values of df, state and year import unittest from pollution_map import pollution_map import pandas as pd df = pd.read_csv("../data/pollution_us_2000_2016.csv") source = 'CO' # options: NO2, O3, SO2 and CO year = '2008' # options: 2000 - 2016 option = 'Mean' # options: Mean, AQI, 1st Max...
Add unit test for pollution_map
Add unit test for pollution_map
Python
mit
abhisheksugam/Climate_Police
--- +++ @@ -0,0 +1,24 @@ +#run the test with default values of df, state and year + + +import unittest +from pollution_map import pollution_map +import pandas as pd + + +df = pd.read_csv("../data/pollution_us_2000_2016.csv") + +source = 'CO' # options: NO2, O3, SO2 and CO +year = '2008' # options: 2000 - 2016 +optio...
4392e56f520cd50454a4a8e804f7382276ee3c3d
valid_options/asset_class.py
valid_options/asset_class.py
from enum import Enum class AssetClass(Enum): CASH_EQUIVALENTS = "Cash Equivalents" COMMODITIES = "Commodities" EQUITIES = "Equities" FIXED_INCOME = "Fixed Income" REAL_ESTATE = "Real Estate" NONE = "None"
Create enum for asset classes
Create enum for asset classes
Python
mit
cmvandrevala/finance_scripts,cmvandrevala/finance_scripts,cmvandrevala/finance_scripts
--- +++ @@ -0,0 +1,9 @@ +from enum import Enum + +class AssetClass(Enum): + CASH_EQUIVALENTS = "Cash Equivalents" + COMMODITIES = "Commodities" + EQUITIES = "Equities" + FIXED_INCOME = "Fixed Income" + REAL_ESTATE = "Real Estate" + NONE = "None"
dd10599a0625e3ab53d2e84612f9162a7e9dbbaf
scripts/numba_cuda.py
scripts/numba_cuda.py
# install nvidia-cuda-toolkit into the OS # conda install numba # conda install cudatoolkit -- otherwise will error out import numpy as np from numba import vectorize from time import perf_counter @vectorize(['float32(float32, float32)'], target='cuda') def add_by_gpu(a, b): return a + b @vectorize(['float32(flo...
Add script to test cuda via numba
Add script to test cuda via numba
Python
mit
neurite/debian-setup,neurite/debian-setup
--- +++ @@ -0,0 +1,37 @@ +# install nvidia-cuda-toolkit into the OS +# conda install numba +# conda install cudatoolkit -- otherwise will error out + +import numpy as np +from numba import vectorize +from time import perf_counter + +@vectorize(['float32(float32, float32)'], target='cuda') +def add_by_gpu(a, b): + ...
90b3e60e52ff2f442b2e77e1a8cdf941127a09e0
candidates/migrations/0003_create_user_terms_agreements.py
candidates/migrations/0003_create_user_terms_agreements.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def create_user_terms_agreements(apps, schema_editor): User = apps.get_model('auth', 'User') UserTermsAgreement = apps.get_model('candidates', 'UserTermsAgreement') for u in User.objects.all(): ...
Create a UserTermsAgreement object for every existing User
Create a UserTermsAgreement object for every existing User
Python
agpl-3.0
neavouli/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextrepresentative,datamade/yournextmp-popit,neavouli/yournextrepresentative,mysociety/yournextrepresentative,openstate/yournextrepresentative,mysociety/yournextmp-popit,YoQuieroSaber/yournextrepresentative,neavouli/yournextrepresentative,op...
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +def create_user_terms_agreements(apps, schema_editor): + User = apps.get_model('auth', 'User') + UserTermsAgreement = apps.get_model('candidates', 'UserTermsAgreement') + ...
6b2896c9d31da924eb4f371e1f477b384056bd58
log-importer.py
log-importer.py
# Copyright (c) Weasyl LLC # See COPYING for details. import argparse import datetime import os.path import re import elastirc from whoosh import index line_pattern = re.compile( r'(?P<time>[0-9:]{8}) (?P<formatted>' r'\(-\) (?P<actor>[^ ]+?) ' r'(?P<action>joined|parted|quit' r'|was kick...
Add a log importer for logs that need indexing.
Add a log importer for logs that need indexing.
Python
isc
Weasyl/elastirc
--- +++ @@ -0,0 +1,71 @@ +# Copyright (c) Weasyl LLC +# See COPYING for details. + +import argparse +import datetime +import os.path +import re + +import elastirc + +from whoosh import index + + +line_pattern = re.compile( + r'(?P<time>[0-9:]{8}) (?P<formatted>' + r'\(-\) (?P<actor>[^ ]+?) ' + r'(?P<ac...
96aee303e9fcc3ef92d176418879089ad4f328a6
indexing/src/ldsImporter.py
indexing/src/ldsImporter.py
from collections import namedtuple # BoundingBox: # top (int) Top of the box # bottom (int) Bottom of the box # left (int) Left of the box # right (int) Right of the box BoundingBox = namedtuple('BoundingBox', 'top bottom left right') # Record: # line (int) Line number on the image for the reco...
Add empty implementation of the importer
src: Add empty implementation of the importer
Python
mit
mikebentley15/cs6350_project_ml
--- +++ @@ -0,0 +1,82 @@ +from collections import namedtuple + +# BoundingBox: +# top (int) Top of the box +# bottom (int) Bottom of the box +# left (int) Left of the box +# right (int) Right of the box +BoundingBox = namedtuple('BoundingBox', 'top bottom left right') + +# Record: +# line (int)...
4e1dd595631949e7c4ccea62e58e60f7736ecefd
test/test_benchmarks.py
test/test_benchmarks.py
"""Tests of time-series prediction benchmarking functions""" from pandas import DataFrame from pandas.util.testing import assert_frame_equal from bbs_benchmarks import * def test_benchmark_predictions(): time = [1, 2, 3] value = [4, 5, 6] preds = benchmark_predictions(time, value, lag=1) assert preds...
Add initial tests for bbs_benchmarks.py
Add initial tests for bbs_benchmarks.py
Python
mit
davharris/bbs-forecasting,davharris/bbs-forecasting,davharris/bbs-forecasting
--- +++ @@ -0,0 +1,27 @@ +"""Tests of time-series prediction benchmarking functions""" + +from pandas import DataFrame +from pandas.util.testing import assert_frame_equal + +from bbs_benchmarks import * + +def test_benchmark_predictions(): + time = [1, 2, 3] + value = [4, 5, 6] + preds = benchmark_prediction...
6183f2c177092b625ce3b86fdc4097ea92ed7699
stdnum/at/zvr_zahl.py
stdnum/at/zvr_zahl.py
# zvr_zahl.py - functions for handling Austrian association register numbers # coding: utf-8 # # Copyright (C) 2017 Holvi Payment Services Oy # Copyright (C) 2017 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as pu...
Implement validator for Austrian association register number
Implement validator for Austrian association register number
Python
lgpl-2.1
holvi/python-stdnum,holvi/python-stdnum,holvi/python-stdnum
--- +++ @@ -0,0 +1,72 @@ +# zvr_zahl.py - functions for handling Austrian association register numbers +# coding: utf-8 +# +# Copyright (C) 2017 Holvi Payment Services Oy +# Copyright (C) 2017 Arthur de Jong +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Le...
1615fafde907488c9af7b40ea2f4ee02b4e05507
saleor/dashboard/discount/forms.py
saleor/dashboard/discount/forms.py
from django import forms from django.utils.translation import pgettext_lazy from ...product.models import Discount class DiscountForm(forms.ModelForm): class Meta: model = Discount exclude = [] def clean(self): cleaned_data = super(DiscountForm, self).clean() type = cleaned_d...
from django import forms from django.core.exceptions import NON_FIELD_ERRORS from django.utils.translation import pgettext_lazy from ...product.models import Discount class DiscountForm(forms.ModelForm): class Meta: model = Discount exclude = [] def clean(self): cleaned_data = super(...
Add more detailed validation in dashboard
Add more detailed validation in dashboard
Python
bsd-3-clause
UITools/saleor,laosunhust/saleor,UITools/saleor,itbabu/saleor,jreigel/saleor,KenMutemi/saleor,laosunhust/saleor,laosunhust/saleor,car3oon/saleor,spartonia/saleor,UITools/saleor,maferelo/saleor,jreigel/saleor,rchav/vinerack,car3oon/saleor,UITools/saleor,rodrigozn/CW-Shop,maferelo/saleor,rchav/vinerack,laosunhust/saleor,...
--- +++ @@ -1,4 +1,5 @@ from django import forms +from django.core.exceptions import NON_FIELD_ERRORS from django.utils.translation import pgettext_lazy from ...product.models import Discount @@ -11,11 +12,23 @@ def clean(self): cleaned_data = super(DiscountForm, self).clean() - type = cle...
34625c7e8817c6e979b59c8f8f3e37f0aaad56a2
dead_code_elim.py
dead_code_elim.py
"""Removes unused instructions. The definition of "unused instruction" is an instruction having a return ID that is not used by any non-debug and non-decoration instruction, and does not have side effects.""" import spirv def remove_debug_if_dead(module, inst): """Remove debug instruction if it is not used.""" ...
Add a dead code elimination optimization pass.
Add a dead code elimination optimization pass.
Python
mit
kristerw/spirv-tools
--- +++ @@ -0,0 +1,47 @@ +"""Removes unused instructions. + +The definition of "unused instruction" is an instruction having a return +ID that is not used by any non-debug and non-decoration instruction, and +does not have side effects.""" +import spirv + + +def remove_debug_if_dead(module, inst): + """Remove debu...
eb40246064d5185edf1d620dcf7270ffe9d7c074
tools/test-generator.py
tools/test-generator.py
#!/usr/bin/python import sys import math import urllib import urllib2 import time id = '123456789012345' server = 'http://localhost:5055' period = 1 step = 0.001 waypoints = [ (40.722412, -74.006288), (40.728592, -74.005258), (40.728348, -74.002822), (40.725437, -73.996750), (40.721778, -73.99981...
Create test data generator script
Create test data generator script
Python
apache-2.0
orcoliver/traccar,stalien/traccar_test,5of9/traccar,tsmgeek/traccar,ninioe/traccar,tsmgeek/traccar,jssenyange/traccar,vipien/traccar,stalien/traccar_test,renaudallard/traccar,AnshulJain1985/Roadcast-Tracker,orcoliver/traccar,duke2906/traccar,ninioe/traccar,tananaev/traccar,tsmgeek/traccar,renaudallard/traccar,joseant/t...
--- +++ @@ -0,0 +1,55 @@ +#!/usr/bin/python + +import sys +import math +import urllib +import urllib2 +import time + +id = '123456789012345' +server = 'http://localhost:5055' +period = 1 +step = 0.001 + +waypoints = [ + (40.722412, -74.006288), + (40.728592, -74.005258), + (40.728348, -74.002822), + (40.7...
7b6975e8bfa35ca211f407db1b9399bc8bb766da
test_accelerometer.py
test_accelerometer.py
from microbit import accelerometer as acc, sleep tx = 10 ty = 10 tz = 40 x = y = z = 0 while True: nx, ny, nz = acc.get_values() if abs(nx - x) >= tx or abs(ny - y) >= ty or abs(nz - z) >= tz: x, y, z = nx, ny, nz print(x, y, z) sleep(50)
Add small script to test micro:bit accelerometer
Add small script to test micro:bit accelerometer
Python
mit
SpotlightKid/microbit-worldtour-monifa
--- +++ @@ -0,0 +1,15 @@ +from microbit import accelerometer as acc, sleep + +tx = 10 +ty = 10 +tz = 40 +x = y = z = 0 + +while True: + nx, ny, nz = acc.get_values() + + if abs(nx - x) >= tx or abs(ny - y) >= ty or abs(nz - z) >= tz: + x, y, z = nx, ny, nz + print(x, y, z) + + sleep(50)
4f246ae37b060e677c3c3cd7f6dcdc2f21337cf6
dakota/dakota_utils.py
dakota/dakota_utils.py
#! /usr/bin/env python """Helper functions for processing Dakota parameter and results files.""" import re def get_response_descriptors(params_file): """Extract response descriptors from a Dakota parameters file. Parameters ---------- params_file : str The path to a Dakota parameters file. ...
Break off helper functions from dakota.py
Break off helper functions from dakota.py
Python
mit
csdms/dakota,csdms/dakota
--- +++ @@ -0,0 +1,88 @@ +#! /usr/bin/env python +"""Helper functions for processing Dakota parameter and results files.""" + +import re + + +def get_response_descriptors(params_file): + """Extract response descriptors from a Dakota parameters file. + + Parameters + ---------- + params_file : str + T...
548d3a3d2c1d853298628772643340bb6d96ee7a
tools/create_files.py
tools/create_files.py
import sys import os from random import choice from random import seed import string def random_word(): return "".join([choice(string.lowercase) for _ in range(choice(range(4, 10)))]) def random_line(n_words=10): return " ".join([random_word() for _ in range(n_words)]) def random_text(...
Add utility script to create a lot of files with random content inside a folder
NXP-16101: Add utility script to create a lot of files with random content inside a folder
Python
lgpl-2.1
arameshkumar/base-nuxeo-drive,IsaacYangSLA/nuxeo-drive,DirkHoffmann/nuxeo-drive,DirkHoffmann/nuxeo-drive,rsoumyassdi/nuxeo-drive,arameshkumar/nuxeo-drive,DirkHoffmann/nuxeo-drive,ssdi-drive/nuxeo-drive,DirkHoffmann/nuxeo-drive,rsoumyassdi/nuxeo-drive,arameshkumar/base-nuxeo-drive,arameshkumar/base-nuxeo-drive,DirkHoffm...
--- +++ @@ -0,0 +1,36 @@ +import sys +import os +from random import choice +from random import seed +import string + + +def random_word(): + return "".join([choice(string.lowercase) + for _ in range(choice(range(4, 10)))]) + + +def random_line(n_words=10): + return " ".join([random_word() for...
2e53b59e2466e121f27236c12b21f731ac18745c
scripts/crypto/cryptography_demo.py
scripts/crypto/cryptography_demo.py
from cryptography.fernet import Fernet import sys msg = sys.argv[1].encode("utf-8") key = Fernet.generate_key() print("Key: " + key.decode("ascii")) f = Fernet(key) token = f.encrypt(msg) print("Encrypted: " + token.decode("utf-8")) msg = f.decrypt(token) print("Decrypted: " + msg.decode("utf-8"))
Add demo Fernet encryption demo
Add demo Fernet encryption demo
Python
mit
iluxonchik/python-general-repo
--- +++ @@ -0,0 +1,11 @@ +from cryptography.fernet import Fernet +import sys + +msg = sys.argv[1].encode("utf-8") +key = Fernet.generate_key() +print("Key: " + key.decode("ascii")) +f = Fernet(key) +token = f.encrypt(msg) +print("Encrypted: " + token.decode("utf-8")) +msg = f.decrypt(token) +print("Decrypted: " + msg...
c732496e054956898f414cf90b15b1fcf9b45b4f
pysovo/comms/comet.py
pysovo/comms/comet.py
# largely transplanted from comet-sendvo script: # https://github.com/jdswinbank/Comet/blob/release-1.0/scripts/comet-sendvo # Should track updates. from __future__ import absolute_import import logging # Twisted from twisted.python import usage from twisted.internet import reactor from twisted.internet.endpoints imp...
Send VOEvents by direct use of the Comet module.
Send VOEvents by direct use of the Comet module. This works, but a more 'decoupled' approach via command line might be more sensible - more robust to internal Comet interface changes, better direct testing against manual command line entries.
Python
bsd-2-clause
timstaley/pysovo
--- +++ @@ -0,0 +1,60 @@ +# largely transplanted from comet-sendvo script: +# https://github.com/jdswinbank/Comet/blob/release-1.0/scripts/comet-sendvo +# Should track updates. + +from __future__ import absolute_import +import logging + +# Twisted +from twisted.python import usage +from twisted.internet import reacto...
ef38a5fea94b6e824b8df87fa8a3370767151317
migrations/versions/0033.py
migrations/versions/0033.py
"""empty message Revision ID: 0033 drop tickets.old_event_id Revises: 0032 orders,tickets,ticket_types Create Date: 2019-09-25 01:01:37.092066 """ # revision identifiers, used by Alembic. revision = '0033 drop tickets.old_event_id' down_revision = '0032 orders,tickets,ticket_types' from alembic import op import sql...
Update tickets to drop old_event_id
Update tickets to drop old_event_id
Python
mit
NewAcropolis/api,NewAcropolis/api,NewAcropolis/api
--- +++ @@ -0,0 +1,26 @@ +"""empty message + +Revision ID: 0033 drop tickets.old_event_id +Revises: 0032 orders,tickets,ticket_types +Create Date: 2019-09-25 01:01:37.092066 + +""" + +# revision identifiers, used by Alembic. +revision = '0033 drop tickets.old_event_id' +down_revision = '0032 orders,tickets,ticket_typ...
c8b8f7897bd4eb26f65480f90e0f6d71394f8971
sendcmd.py
sendcmd.py
#!/usr/bin/env python import sys import getmetric def main(): output = getmetric.sshcmd(sys.argv[1], sys.argv[2]) print output if __name__ == '__main__': sys.exit(main())
Add utility for sending commands for testing
Add utility for sending commands for testing
Python
bsd-3-clause
ekollof/pymetrics
--- +++ @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +import sys +import getmetric + + +def main(): + output = getmetric.sshcmd(sys.argv[1], sys.argv[2]) + print output + +if __name__ == '__main__': + sys.exit(main())
761ae0d762324ef1eba93ab1b9cf2cf28d2fa30e
python/snippets/find_if_program_installed.py
python/snippets/find_if_program_installed.py
def which(program): """From: http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python""" import os def is_exe(fpath): return os.path.isfile(fpath) and os.access(fpath, os.X_OK) fpath, fname = os.path.split(program) if fpath: if is_exe(program): ...
Add snippet for python -> find if program is installed in system
Add snippet for python -> find if program is installed in system
Python
mit
thescouser89/snippets,thescouser89/snippets,thescouser89/snippets,thescouser89/snippets,thescouser89/snippets,thescouser89/snippets
--- +++ @@ -0,0 +1,21 @@ +def which(program): + """From: + http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python""" + import os + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname = os.path.split(program) + if fpath: +...
d24da0e339a0470b94fe79016a5343755640ba0f
deploy_prebuilt.py
deploy_prebuilt.py
#!/usr/bin/env python import os import shutil script_dir = os.path.dirname(os.path.realpath(__file__)) chromium_dir = os.path.abspath(os.path.join(script_dir, 'src')) # Solution root directory. root_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) base_libs = [ 'base', 'base_i18n', 'base_prefs', 'b...
Add prebuilt libraries deployment helper script.
Add prebuilt libraries deployment helper script.
Python
mit
cybertk/libchromium,cybertk/libchromium,cybertk/libchromium,cybertk/libchromium
--- +++ @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +import os +import shutil + +script_dir = os.path.dirname(os.path.realpath(__file__)) +chromium_dir = os.path.abspath(os.path.join(script_dir, 'src')) +# Solution root directory. +root_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) + +base_libs = [ + 'bas...
cedd86b6ad54319ad44a961bc51c13f78e209c76
backend/globaleaks/tests/jobs/test_base.py
backend/globaleaks/tests/jobs/test_base.py
# -*- coding: utf-8 -*- from twisted.internet.defer import inlineCallbacks from globaleaks.tests import helpers from globaleaks.jobs import base class TestGLJob(helpers.TestGLWithPopulatedDB): @inlineCallbacks def test_base_scheduler(self): yield base.GLJob()._operation()
Implement unit testing of the schedulers base class
Implement unit testing of the schedulers base class
Python
agpl-3.0
vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks
--- +++ @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from twisted.internet.defer import inlineCallbacks + +from globaleaks.tests import helpers + +from globaleaks.jobs import base + +class TestGLJob(helpers.TestGLWithPopulatedDB): + @inlineCallbacks + def test_base_scheduler(self): + yield base.GLJob()._op...
815a9c802440375cc283179c15d3b1a371863418
tests/test_class_based.py
tests/test_class_based.py
"""tests/test_decorators.py. Tests that class based hug routes interact as expected Copyright (C) 2015 Timothy Edmund Crosley 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,...
Add test for desired support of class based routers
Add test for desired support of class based routers
Python
mit
timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,timothycrosley/hug
--- +++ @@ -0,0 +1,90 @@ +"""tests/test_decorators.py. + +Tests that class based hug routes interact as expected + +Copyright (C) 2015 Timothy Edmund Crosley + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal i...
1a8fea9c752845247c592f0a0bd6ffd8e8f259e2
eodatasets/__main__.py
eodatasets/__main__.py
import click import os from pathlib import Path import logging from eodatasets.package import package_ortho, package_nbar, package_raw, get_dataset _DATASET_PACKAGERS = { 'ortho': package_ortho, 'nbar': package_nbar, 'raw': package_raw } @click.command() @click.option('--ancestor', type=click.Path(exist...
Add simple initial command line interface.
Add simple initial command line interface.
Python
apache-2.0
jeremyh/eo-datasets,GeoscienceAustralia/eo-datasets,GeoscienceAustralia/eo-datasets,jeremyh/eo-datasets
--- +++ @@ -0,0 +1,47 @@ +import click +import os +from pathlib import Path +import logging + +from eodatasets.package import package_ortho, package_nbar, package_raw, get_dataset + + +_DATASET_PACKAGERS = { + 'ortho': package_ortho, + 'nbar': package_nbar, + 'raw': package_raw +} + +@click.command() +@click...
e3d90957c4fa78a85bb250a6ec82eff43ec5be7d
tests/test_losses.py
tests/test_losses.py
import keras_retinanet.losses import keras import numpy as np import pytest def test_smooth_l1(): regression = np.array([ [ [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], ] ], dtype=keras.backend.floatx()) regression = keras.backend...
Add unit test for smooth_l1.
Add unit test for smooth_l1.
Python
apache-2.0
delftrobotics/keras-retinanet
--- +++ @@ -0,0 +1,32 @@ +import keras_retinanet.losses +import keras + +import numpy as np + +import pytest + +def test_smooth_l1(): + regression = np.array([ + [ + [0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0], + ] + ], dtype=keras.backe...
ea0f2a6566ed6d4770d6f5f5b59550c54579a6b8
tests/test_others.py
tests/test_others.py
from typing import Optional import typer from typer.main import solve_typer_info_defaults, solve_typer_info_help from typer.models import TyperInfo from typer.testing import CliRunner runner = CliRunner() def test_optional(): app = typer.Typer() @app.command() def opt(user: Optional[str] = None): ...
Add extra tests for edge cases that don't belong on docs
:white_check_mark: Add extra tests for edge cases that don't belong on docs
Python
mit
tiangolo/typer,tiangolo/typer
--- +++ @@ -0,0 +1,51 @@ +from typing import Optional + +import typer +from typer.main import solve_typer_info_defaults, solve_typer_info_help +from typer.models import TyperInfo +from typer.testing import CliRunner + +runner = CliRunner() + + +def test_optional(): + app = typer.Typer() + + @app.command() + ...
c97d77f058c73e5c8da4c108681870ff8f0abd71
examples/no-minimum.py
examples/no-minimum.py
from simplex.algorithm import NelderMeadSimplex import numpy as np import matplotlib.pyplot as plt from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) ## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) rc('text', usetex=True) # Defin...
Add example with no minimum.
Add example with no minimum.
Python
mit
kubkon/simplex
--- +++ @@ -0,0 +1,58 @@ +from simplex.algorithm import NelderMeadSimplex + +import numpy as np +import matplotlib.pyplot as plt + +from matplotlib import rc +rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) +## for Palatino and other serif fonts use: +#rc('font',**{'family':'serif','serif':['Palatino'...
4b58d8153bcf7612a2d3ab360df941089e45ed3e
trim.py
trim.py
"""Create a new folder of images that consist of only the cell chamber Name of save folder is specified in commandline""" import sys import os import cv2 import numpy as np if __name__ == '__main__': # might want to add options for other arguments assert len(sys.argv) == 2 saveFolderName = sys.argv[1] ...
Add initial; most methods not implemented
Add initial; most methods not implemented
Python
mit
justinjoh/get-ROI
--- +++ @@ -0,0 +1,41 @@ +"""Create a new folder of images that consist of only the cell chamber +Name of save folder is specified in commandline""" +import sys +import os +import cv2 +import numpy as np + +if __name__ == '__main__': + # might want to add options for other arguments + assert len(sys.argv) == 2 ...
23a5417e2f870a88d88aaf0683d57cc4177f020c
ci/deployment-tests/app5_deploymenttest.py
ci/deployment-tests/app5_deploymenttest.py
# tile-generator # # Copyright (c) 2015-Present Pivotal Software, 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 #...
Add deployment test to verify job resource config.
Add deployment test to verify job resource config.
Python
apache-2.0
cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator
--- +++ @@ -0,0 +1,56 @@ +# tile-generator +# +# Copyright (c) 2015-Present Pivotal Software, 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://w...
6cd920e088d0a755644e380807db61a472a03eae
spacy/tests/regression/test_issue2772.py
spacy/tests/regression/test_issue2772.py
'''Test that deprojectivization doesn't mess up sentence boundaries.''' import pytest from ...syntax.nonproj import projectivize, deprojectivize from ..util import get_doc @pytest.mark.xfail def test_issue2772(en_vocab): words = 'When we write or communicate virtually , we can hide our true feelings .'.split() ...
Add xfail test for deprojectivization SBD bug
Add xfail test for deprojectivization SBD bug
Python
mit
honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy
--- +++ @@ -0,0 +1,19 @@ +'''Test that deprojectivization doesn't mess up sentence boundaries.''' +import pytest +from ...syntax.nonproj import projectivize, deprojectivize +from ..util import get_doc + +@pytest.mark.xfail +def test_issue2772(en_vocab): + words = 'When we write or communicate virtually , we can hi...
2e570988c4be84a6bdbe7bc252feb553d59c4ef2
wsgi.py
wsgi.py
import os import sys here = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(here, 'demonstrare')) config = os.path.join(here, 'production.ini') from pyramid.paster import get_app application = get_app(config, 'main')
Create WSGI file for deployment
Create WSGI file for deployment
Python
mit
josuemontano/pyramid-angularjs-starter,josuemontano/api-starter,josuemontano/pyramid-angularjs-starter,josuemontano/API-platform,josuemontano/API-platform,josuemontano/API-platform,josuemontano/api-starter,josuemontano/api-starter,josuemontano/pyramid-angularjs-starter,josuemontano/API-platform
--- +++ @@ -0,0 +1,9 @@ +import os +import sys + +here = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.join(here, 'demonstrare')) +config = os.path.join(here, 'production.ini') + +from pyramid.paster import get_app +application = get_app(config, 'main')
4b2d23abbb5ef3267eae2b53bf70dfa9c62c868b
tests/test/xie/graphics/drawing.py
tests/test/xie/graphics/drawing.py
import unittest from xie.graphics.drawing import DrawingSystem from xie.graphics.canvas import EncodedTextCanvasController from xie.graphics.factory import ShapeFactory class DrawingSystemTestCase(unittest.TestCase): def setUp(self): self.controller = EncodedTextCanvasController() self.ds = DrawingSystem(self.co...
Add test cases for DrawingSystem
[Test] Add test cases for DrawingSystem
Python
apache-2.0
xrloong/Xie
--- +++ @@ -0,0 +1,51 @@ +import unittest +from xie.graphics.drawing import DrawingSystem +from xie.graphics.canvas import EncodedTextCanvasController + +from xie.graphics.factory import ShapeFactory + +class DrawingSystemTestCase(unittest.TestCase): + def setUp(self): + self.controller = EncodedTextCanvasController...
b61ac879fb2869acf84bb30386b08789e618aed0
utilities/make_agasc_supplement.py
utilities/make_agasc_supplement.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Create the initial version of agasc_supplement.h5. This file is a supplement to the stable AGASC to inform star selection and star catalog checking. This script simply creates the initial file that has only bad stars from two sources: - starcheck b...
Add utility script to create initial agasc_supplement.h5
Add utility script to create initial agasc_supplement.h5
Python
bsd-3-clause
sot/mica,sot/mica
--- +++ @@ -0,0 +1,49 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst + +""" +Create the initial version of agasc_supplement.h5. + +This file is a supplement to the stable AGASC to inform star selection +and star catalog checking. + +This script simply creates the initial file that has only bad +s...
01dbfc5617c094913832302383410f19a2cde088
toggle_cap_letters.py
toggle_cap_letters.py
import sublime, sublime_plugin import re def toggle(pattern, word, transformer): for match in pattern.finditer(word): substr = match.group() word = word.replace(substr, transformer(substr)) return word def mixed_to_underscore(word): return '_' + word.lower() def underscore_to_mixed(word): return word...
Add a plugin that toggles mixed cap letters to underscore styles.
Add a plugin that toggles mixed cap letters to underscore styles.
Python
mit
shaochuan/sublime-plugins
--- +++ @@ -0,0 +1,38 @@ +import sublime, sublime_plugin +import re + +def toggle(pattern, word, transformer): + for match in pattern.finditer(word): + substr = match.group() + word = word.replace(substr, transformer(substr)) + return word + +def mixed_to_underscore(word): + return '_' + word.lower() + +def ...
644de5b5ed459e38cd073ec35943154cfe204e4f
tools/run_coverage.py
tools/run_coverage.py
#!/usr/bin/env python """Generate coverage reports""" import os print('Running code coverage. This will take a minute or two to run the tests.') os.system("coverage run --rcfile=.coveragerc manage.py test -v1") print('Tests completed.') print('Generating code coverage report') os.system("coverage report") print('Ge...
Add tool to run coverage and reports
Add tool to run coverage and reports
Python
agpl-3.0
sudheesh001/oh-mainline,vipul-sharma20/oh-mainline,campbe13/openhatch,onceuponatimeforever/oh-mainline,openhatch/oh-mainline,moijes12/oh-mainline,ojengwa/oh-mainline,waseem18/oh-mainline,heeraj123/oh-mainline,openhatch/oh-mainline,willingc/oh-mainline,ehashman/oh-mainline,vipul-sharma20/oh-mainline,ehashman/oh-mainline...
--- +++ @@ -0,0 +1,15 @@ +#!/usr/bin/env python +"""Generate coverage reports""" + +import os + +print('Running code coverage. This will take a minute or two to run the tests.') +os.system("coverage run --rcfile=.coveragerc manage.py test -v1") +print('Tests completed.') + +print('Generating code coverage report') +o...
97c25703904a0f2508238d4268259692f9e7a665
test/integration/ggrc/converters/test_import_automappings.py
test/integration/ggrc/converters/test_import_automappings.py
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from ggrc.models import Relationship from ggrc.converters import errors from integration.ggrc.converters import TestCase from integration.ggrc.generator import ObjectGenerator class TestBasicCsvImport(Test...
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from integration.ggrc.converters import TestCase from integration.ggrc.generator import ObjectGenerator class TestBasicCsvImport(TestCase): def setUp(self): TestCase.setUp(self) self.generator =...
Clean up import auto mappings tests
Clean up import auto mappings tests
Python
apache-2.0
edofic/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,josthkko/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,edofi...
--- +++ @@ -1,8 +1,6 @@ # Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> -from ggrc.models import Relationship -from ggrc.converters import errors from integration.ggrc.converters import TestCase from integration.ggrc.generator import ObjectGenerato...
27f162e8eafbc456c63043bd48bf6f09cc6ab318
igcollect/pf_labels.py
igcollect/pf_labels.py
#!/usr/bin/env python """igcollect - FreeBSD Packet Filter Copyright (c) 2018 InnoGames GmbH """ from __future__ import print_function from argparse import ArgumentParser from socket import gethostname from subprocess import check_output import re import time def parse_args(): parser = ArgumentParser() pars...
Add script for getting pf label counters
Add script for getting pf label counters
Python
mit
innogames/igcollect
--- +++ @@ -0,0 +1,73 @@ +#!/usr/bin/env python +"""igcollect - FreeBSD Packet Filter + +Copyright (c) 2018 InnoGames GmbH +""" + +from __future__ import print_function +from argparse import ArgumentParser +from socket import gethostname +from subprocess import check_output +import re +import time + + +def parse_args...
a841ff9195448529d988227a3cfc744d88c7682d
scripts/local_filestore_to_s3.py
scripts/local_filestore_to_s3.py
''' This script copies all resource files from a local FileStore directory to a remote S3 bucket. **It will not work for group images** It requires SQLalchemy and Boto. Please update the configuration details, all keys are mandatory except AWS_STORAGE_PATH. ''' import os from sqlalchemy import create_engine from s...
Add script for migrating local filestore to s3
Add script for migrating local filestore to s3
Python
agpl-3.0
okfn/ckanext-s3filestore,okfn/ckanext-s3filestore
--- +++ @@ -0,0 +1,80 @@ +''' +This script copies all resource files from a local FileStore directory +to a remote S3 bucket. + +**It will not work for group images** + +It requires SQLalchemy and Boto. + +Please update the configuration details, all keys are mandatory except +AWS_STORAGE_PATH. + +''' + +import os +f...
b68596cc80ac13544744004338602245d17bf6b2
Tests/feaLib/ast_test.py
Tests/feaLib/ast_test.py
from __future__ import print_function, division, absolute_import from __future__ import unicode_literals from fontTools.feaLib import ast import unittest class AstTest(unittest.TestCase): def test_glyphname_escape(self): statement = ast.GlyphClass() for name in ("BASE", "NULL", "foo", "a"): ...
Add an ast test for the previous commit
[feaLib] Add an ast test for the previous commit
Python
mit
googlefonts/fonttools,fonttools/fonttools
--- +++ @@ -0,0 +1,17 @@ +from __future__ import print_function, division, absolute_import +from __future__ import unicode_literals +from fontTools.feaLib import ast +import unittest + + +class AstTest(unittest.TestCase): + def test_glyphname_escape(self): + statement = ast.GlyphClass() + for name in...
05454d3a00b85ab21a16eb324546be102d85f778
osf/migrations/0103_set_osf_storage_node_settings_region.py
osf/migrations/0103_set_osf_storage_node_settings_region.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-04-30 18:34 from __future__ import unicode_literals import logging from django.apps import apps from django.db import connection, migrations, models from addons.osfstorage.models import NodeSettings, Region from addons.osfstorage.settings import DEFAULT_R...
Add migration to set region on existing NodeSettings
Add migration to set region on existing NodeSettings
Python
apache-2.0
brianjgeiger/osf.io,mfraezz/osf.io,caseyrollins/osf.io,cslzchen/osf.io,CenterForOpenScience/osf.io,sloria/osf.io,HalcyonChimera/osf.io,pattisdr/osf.io,brianjgeiger/osf.io,aaxelb/osf.io,felliott/osf.io,icereval/osf.io,sloria/osf.io,adlius/osf.io,Johnetordoff/osf.io,sloria/osf.io,erinspace/osf.io,felliott/osf.io,adlius/o...
--- +++ @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.11 on 2018-04-30 18:34 +from __future__ import unicode_literals + +import logging + +from django.apps import apps +from django.db import connection, migrations, models + +from addons.osfstorage.models import NodeSettings, Region +from addon...
24a90be97f04cdc52c6a72e835c903c7de297465
src/algorithms/tests/change_file_formats.py
src/algorithms/tests/change_file_formats.py
from unittest import TestCase from algorithms.tests import TEST_FILE_PATH from os.path import join class ChangeFileFormatTests(TestCase): def test_convert_arff_to_csv(self): source = join(TEST_FILE_PATH, 'pauksciai.arff') expected = join(TEST_FILE_PATH, 'pauksciai.csv') def test_convert_csv_t...
Add empty tests for file format changing.
Add empty tests for file format changing.
Python
agpl-3.0
InScience/DAMIS-old,InScience/DAMIS-old
--- +++ @@ -0,0 +1,18 @@ +from unittest import TestCase +from algorithms.tests import TEST_FILE_PATH +from os.path import join + + +class ChangeFileFormatTests(TestCase): + def test_convert_arff_to_csv(self): + source = join(TEST_FILE_PATH, 'pauksciai.arff') + expected = join(TEST_FILE_PATH, 'pauksci...
59097ff3523926d70ec267bb96e015232d6d74c0
jqm-all/checkHeader.py
jqm-all/checkHeader.py
#!/usr/bin/env python2 # coding:utf-8 import os import re import shutil JQM_ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) tmpFilePath = os.path.join(JQM_ROOT_DIR, "__tmp_file.java") HEADER = """/** * Copyright © 2013 enioka. All rights reserved %s * * Licensed under the Apache License, Version 2.0 (the "Lic...
Add script that define java source code standard header
Add script that define java source code standard header
Python
apache-2.0
enioka/jqm,enioka/jqm,enioka/jqm,enioka/jqm,enioka/jqm
--- +++ @@ -0,0 +1,55 @@ +#!/usr/bin/env python2 +# coding:utf-8 +import os +import re +import shutil + +JQM_ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) +tmpFilePath = os.path.join(JQM_ROOT_DIR, "__tmp_file.java") + +HEADER = """/** + * Copyright © 2013 enioka. All rights reserved +%s * + * Licensed under t...
513d8a37d612253b87f0d30d3cab42ba25e98dcf
migrations/versions/8cf43589ca8b_add_email_address_in_account_table.py
migrations/versions/8cf43589ca8b_add_email_address_in_account_table.py
"""Add email address in Account Table for sending mailers. Revision ID: 8cf43589ca8b Revises: 3828e380de20 Create Date: 2018-08-28 12:47:31.858127 """ # revision identifiers, used by Alembic. revision = '8cf43589ca8b' down_revision = '3828e380de20' from alembic import op import sqlalchemy as sa def upgrade(): ...
Add db migration for adding email address field in Account Table
Add db migration for adding email address field in Account Table
Python
apache-2.0
stackArmor/security_monkey,stackArmor/security_monkey,stackArmor/security_monkey,stackArmor/security_monkey,stackArmor/security_monkey
--- +++ @@ -0,0 +1,26 @@ +"""Add email address in Account Table for sending mailers. + +Revision ID: 8cf43589ca8b +Revises: 3828e380de20 +Create Date: 2018-08-28 12:47:31.858127 + +""" + +# revision identifiers, used by Alembic. +revision = '8cf43589ca8b' +down_revision = '3828e380de20' + +from alembic import op +imp...
c967c86e9dd4ae6ec85049a062cd3155a905268a
rest_framework_social_oauth2/management/commands/createapp.py
rest_framework_social_oauth2/management/commands/createapp.py
from django.core.management.base import BaseCommand, CommandError from oauth2_provider.models import Application from django.contrib.auth.models import User from oauth2_provider.generators import generate_client_id, generate_client_secret class Command(BaseCommand): help = "Create a Django OAuth Toolkit applicati...
Create manage.py command to create an application
Create manage.py command to create an application
Python
mit
PhilipGarnero/django-rest-framework-social-oauth2
--- +++ @@ -0,0 +1,33 @@ +from django.core.management.base import BaseCommand, CommandError +from oauth2_provider.models import Application +from django.contrib.auth.models import User +from oauth2_provider.generators import generate_client_id, generate_client_secret + + +class Command(BaseCommand): + help = "Crea...
05ce8e0ff96b0d283cedfc0058a06234bb4d0630
scripts/py36-blake2.py
scripts/py36-blake2.py
""" This script checks compatibility of crypto.blake2b_256 against hashlib.blake2b in CPython 3.6. """ import hashlib import sys def test_b2(b2_input, b2_output): digest = hashlib.blake2b(b2_input, digest_size=32).digest() identical = b2_output == digest print('Input: ', b2_input.hex()) print('...
Add test script for blake2b_256 against CPython 3.6 hashlib
Add test script for blake2b_256 against CPython 3.6 hashlib
Python
bsd-3-clause
edgewood/borg,RonnyPfannschmidt/borg,raxenak/borg,edgimar/borg,RonnyPfannschmidt/borg,edgewood/borg,RonnyPfannschmidt/borg,edgewood/borg,raxenak/borg,RonnyPfannschmidt/borg,edgimar/borg,edgimar/borg,RonnyPfannschmidt/borg,edgewood/borg,raxenak/borg,raxenak/borg,edgimar/borg
--- +++ @@ -0,0 +1,36 @@ + +""" +This script checks compatibility of crypto.blake2b_256 against hashlib.blake2b in CPython 3.6. +""" + +import hashlib +import sys + + +def test_b2(b2_input, b2_output): + digest = hashlib.blake2b(b2_input, digest_size=32).digest() + identical = b2_output == digest + + print('...
6baa4144bd7fadf0cb09fb404b2d0aad87b944ec
alembic/versions/537db2979434_add_category_constraint_to_app_project.py
alembic/versions/537db2979434_add_category_constraint_to_app_project.py
"""Add category constraint to app/project Revision ID: 537db2979434 Revises: 7927d63d556 Create Date: 2014-09-25 10:39:57.300726 """ # revision identifiers, used by Alembic. revision = '537db2979434' down_revision = '7927d63d556' from alembic import op import sqlalchemy as sa def upgrade(): query = 'UPDATE ap...
Add alembic revision for category constraint in project
Add alembic revision for category constraint in project
Python
agpl-3.0
jean/pybossa,inteligencia-coletiva-lsd/pybossa,geotagx/pybossa,Scifabric/pybossa,harihpr/tweetclickers,inteligencia-coletiva-lsd/pybossa,stefanhahmann/pybossa,PyBossa/pybossa,OpenNewsLabs/pybossa,geotagx/pybossa,PyBossa/pybossa,jean/pybossa,stefanhahmann/pybossa,harihpr/tweetclickers,Scifabric/pybossa,OpenNewsLabs/pybo...
--- +++ @@ -0,0 +1,24 @@ +"""Add category constraint to app/project + +Revision ID: 537db2979434 +Revises: 7927d63d556 +Create Date: 2014-09-25 10:39:57.300726 + +""" + +# revision identifiers, used by Alembic. +revision = '537db2979434' +down_revision = '7927d63d556' + +from alembic import op +import sqlalchemy as s...
ed1a2c227ca7e83418d5741116e34962ce9c0039
data/visualizations.py
data/visualizations.py
import csv import matplotlib.pyplot as plt from datetime import datetime import sys import numpy as np import pandas as pd from pandas import Series, DataFrame, Panel from scipy.interpolate import spline def list_str_to_int(input): str_hold = "".join(input) return int(str_hold) def time_series_avg_wind_spee...
Add initial matploblib average plots for wind speed.
Add initial matploblib average plots for wind speed.
Python
mit
avishek1013/windly
--- +++ @@ -0,0 +1,52 @@ +import csv +import matplotlib.pyplot as plt +from datetime import datetime +import sys +import numpy as np +import pandas as pd +from pandas import Series, DataFrame, Panel +from scipy.interpolate import spline + + +def list_str_to_int(input): + str_hold = "".join(input) + return int(...
1b4962c62e9fad96fa1282823bd3adac4030abb4
ny_to_chi_test.py
ny_to_chi_test.py
from matplotlib import pyplot as plt from greengraph import Greengraph mygraph=Greengraph('New York','Chicago') data = mygraph.green_between(20) plt.plot(data) plt.show()
Include test to see if the package can be imported and used.
Include test to see if the package can be imported and used.
Python
apache-2.0
paulsbrookes/greengraph
--- +++ @@ -0,0 +1,7 @@ +from matplotlib import pyplot as plt +from greengraph import Greengraph + +mygraph=Greengraph('New York','Chicago') +data = mygraph.green_between(20) +plt.plot(data) +plt.show()
52d4e1e3b962963de9c17c12106bdf957434a62e
subsample_signals.py
subsample_signals.py
""" Subsample the signals files to demultipliate the number of training samples. Just indicate the input and output directory. Use python 3 (but should be working with python 2) """ import os, sys import random import numpy as np import utils # Set directories root = os.getcwd() dirInSignals = root + '/../Data/Test...
Add script to subsample signals
Add script to subsample signals
Python
apache-2.0
Conchylicultor/DeepLearningOnGraph,Conchylicultor/DeepLearningOnGraph,Conchylicultor/DeepLearningOnGraph
--- +++ @@ -0,0 +1,46 @@ +""" +Subsample the signals files to demultipliate the number of +training samples. + +Just indicate the input and output directory. + +Use python 3 (but should be working with python 2) +""" + +import os, sys +import random +import numpy as np +import utils + +# Set directories +root = os.ge...
58a9c449c59767129fe75f6efecb44eb3fa6f3e4
Graphs/depthFirstSearch.py
Graphs/depthFirstSearch.py
#!/usr/local/bin/python # edX Intro to Computational Thinking and Data Science # Graphs - Depth First Search to find shortest path lecture code import graphs def printPath(path): """Assumes path is a list of nodes""" result = '' for i in range(len(path)): result += str(path[i]) if i != le...
Add depth first search for graphs
Add depth first search for graphs
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,88 @@ +#!/usr/local/bin/python +# edX Intro to Computational Thinking and Data Science +# Graphs - Depth First Search to find shortest path lecture code + +import graphs + + +def printPath(path): + """Assumes path is a list of nodes""" + result = '' + for i in range(len(path)): + re...
c568189313f96af68fdca93ffc65b528e3964e06
src/tests/test_api_users.py
src/tests/test_api_users.py
#!/usr/bin/python # # Copyright Friday Film Club. All Rights Reserved. """Users API unit tests.""" __author__ = 'adamjmcgrath@gmail.com (Adam McGrath)' import unittest from google.appengine.ext import ndb import base import helpers class ApiTestCase(base.TestCase): def setUp(self): super(ApiTestCase, sel...
Add tests for users api
Add tests for users api
Python
mpl-2.0
adamjmcgrath/fridayfilmclub,adamjmcgrath/fridayfilmclub,adamjmcgrath/fridayfilmclub,adamjmcgrath/fridayfilmclub
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/python +# +# Copyright Friday Film Club. All Rights Reserved. + +"""Users API unit tests.""" + + +__author__ = 'adamjmcgrath@gmail.com (Adam McGrath)' + +import unittest + +from google.appengine.ext import ndb + +import base +import helpers + + +class ApiTestCase(base.TestCase): +...
ec14651411d3489e85cabc323bb6fa90eeb7041a
third_party/gpus/compress_find_cuda_config.py
third_party/gpus/compress_find_cuda_config.py
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Remove .oss from find_cuda_config in compression script.
Remove .oss from find_cuda_config in compression script. See https://github.com/tensorflow/tensorflow/pull/40759 PiperOrigin-RevId: 318452377 Change-Id: I04f3ad1c8cf9cac5446d0a1196ebbf66660bf312
Python
apache-2.0
freedomtan/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,davidzchen/tensorflow,karllessard/tensorflow,Intel-Corporation/tensorflow,cxxgtxy/tensorflow,annarev/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred,te...
--- +++ @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Compresses the contents of find_cuda_config.py.oss. +"""Compresses the contents of 'find_cuda.py'. ...
4cb361b8d6402392c5b4922f2f6793eb38c82c8e
test/RS485/readFromRS485.py
test/RS485/readFromRS485.py
#!/usr/bin/env python # # Python sample application that reads from the raspicomm's RS-485 Port # # Thanks to Acmesystems, program edited by Giovanni Manzoni @ HardElettroSoft # # 9600 8N1 flow control Xon/Xoff # import array import serial maxReadCount=10 readBuffer = array.array('c') print('this sample application...
Add an example in Python for read from RS485
Add an example in Python for read from RS485
Python
cc0-1.0
hardelettrosoft/project2,hardelettrosoft/project2,giovannimanzoni/project2,giovannimanzoni/project2,hardelettrosoft/project2,giovannimanzoni/project2
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +# +# Python sample application that reads from the raspicomm's RS-485 Port +# +# Thanks to Acmesystems, program edited by Giovanni Manzoni @ HardElettroSoft +# +# 9600 8N1 flow control Xon/Xoff +# + +import array +import serial + +maxReadCount=10 +readBuffer = array....
d09b36eb6aec1f7ffa20113495c24989f46709e5
tests/test_pooling.py
tests/test_pooling.py
import Queue import pylibmc from nose.tools import eq_, ok_ from tests import PylibmcTestCase class PoolTestCase(PylibmcTestCase): pass class ClientPoolTests(PoolTestCase): def test_simple(self): p = pylibmc.ClientPool(self.mc, 2) with p.reserve() as smc: ok_(smc) ok_(s...
Add unit tests for pooling
Add unit tests for pooling
Python
bsd-3-clause
lericson/pylibmc,lericson/pylibmc,lericson/pylibmc
--- +++ @@ -0,0 +1,23 @@ +import Queue +import pylibmc +from nose.tools import eq_, ok_ +from tests import PylibmcTestCase + +class PoolTestCase(PylibmcTestCase): + pass + +class ClientPoolTests(PoolTestCase): + def test_simple(self): + p = pylibmc.ClientPool(self.mc, 2) + with p.reserve() as smc:...
d48975e826dd7adac508f28618a06439a8cf50f4
queries-limits.py
queries-limits.py
#!/usr/bin/env python from avocado import main from sdcm.tester import ClusterTester from sdcm.tester import clean_aws_resources class GrowClusterTest(ClusterTester): """ Test scylla cluster growth (adding nodes after an initial cluster size). :avocado: enable """ @clean_aws_resources def...
Add the queries limits test.
limits: Add the queries limits test. Use a C++ payload to check if the queries limitation works. Fixes #180. Signed-off-by: Benoît Canet <ecd1f14f7c1c6dc7a40210bdcc3810e0107ecbc8@scylladb.com>
Python
agpl-3.0
scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-longevity-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,amoskong/scylla-cluster-tests,amoskong/scylla-cluster-tests,scylladb/scylla-longevity-tests,scylladb/scylla-cluster-tests,amoskong/scylla-cluster-tests,amoskong/scylla-...
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +from avocado import main + +from sdcm.tester import ClusterTester +from sdcm.tester import clean_aws_resources + + +class GrowClusterTest(ClusterTester): + + """ + Test scylla cluster growth (adding nodes after an initial cluster size). + + :avocado: enable ...
b8ea919b0b7f7f4b9cb2ddf548f0e674f73e5411
tests/forcing_single_position/heat_flux.py
tests/forcing_single_position/heat_flux.py
import os import sys import vtktools import math import numpy from numpy import finfo def flux(file,x,y): u=vtktools.vtu(file) flux = u.GetScalarField('HeatFlux') pos = u.GetLocations() f = finfo(float) for i in range(0,len(flux)): if( abs(pos[i,0] - x) < f.eps and abs(pos[i,1] - y) < f....
Add the one that got away
Add the one that got away
Python
lgpl-2.1
iakovos-panourgias/fluidity,jrper/fluidity,jrper/fluidity,iakovos-panourgias/fluidity,jrper/fluidity,jjo31/ATHAM-Fluidity,rjferrier/fluidity,rjferrier/fluidity,iakovos-panourgias/fluidity,jjo31/ATHAM-Fluidity,iakovos-panourgias/fluidity,rjferrier/fluidity,jrper/fluidity,jjo31/ATHAM-Fluidity,jrper/fluidity,jjo31/ATHAM-F...
--- +++ @@ -0,0 +1,25 @@ +import os +import sys +import vtktools +import math +import numpy +from numpy import finfo + + +def flux(file,x,y): + + u=vtktools.vtu(file) + flux = u.GetScalarField('HeatFlux') + pos = u.GetLocations() + f = finfo(float) + + for i in range(0,len(flux)): + if( abs(pos[...
a93f81b18262b1e29d11bd101691162b2b5face3
MozillaPage1.py
MozillaPage1.py
from selenium import webdriver driver = webdriver.Firefox() driver.get("https://marketplace-dev.allizom.org/") driver.find_element_by_class_name("header--search-togle").click() driver.implicitly_wait(2) driver.find_element_by_id("search-q").send_keys("Hello") driver.find.send_keys(Keys.RETURN) assert "Hello | Firefo...
Test Mozilla Marketplace with simple python
Test Mozilla Marketplace with simple python Search Text "Hello"
Python
mit
bishnucit/Python-Preludes
--- +++ @@ -0,0 +1,13 @@ +from selenium import webdriver + + + +driver = webdriver.Firefox() +driver.get("https://marketplace-dev.allizom.org/") +driver.find_element_by_class_name("header--search-togle").click() +driver.implicitly_wait(2) +driver.find_element_by_id("search-q").send_keys("Hello") +driver.find.send_key...
988a55aa42e04c57dc58b04d631c30a899bba664
bench_runtime.py
bench_runtime.py
import time import math import matplotlib.pyplot as plt from dgim.dgim import Dgim from dgim.utils import generate_random_stream def measure_update_time(N, iterations): dgim = Dgim(N) # initialization for elt in generate_random_stream(N): dgim.update(elt) time_start = time.time() bucket_co...
Add dummy script to benchmark operation times()
Add dummy script to benchmark operation times()
Python
bsd-3-clause
simondolle/dgim,simondolle/dgim
--- +++ @@ -0,0 +1,34 @@ +import time +import math +import matplotlib.pyplot as plt + +from dgim.dgim import Dgim +from dgim.utils import generate_random_stream + +def measure_update_time(N, iterations): + dgim = Dgim(N) + # initialization + for elt in generate_random_stream(N): + dgim.update(elt) + ...
fd85068b56d4a01bd5ade5773ae1299f0ac1b5e8
test/unit/test_sorted_set.py
test/unit/test_sorted_set.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import pytest from clique.sorted_set import SortedSet @pytest.fixture def standard_set(request): '''Return sorted set.''' return SortedSet([4, 5, 6, 7, 2, 1, 1]) @pytest.mark.parametrize(('item', 'expec...
Add initial unit tests for SortedSet.
Add initial unit tests for SortedSet.
Python
apache-2.0
4degrees/clique
--- +++ @@ -0,0 +1,78 @@ +# :coding: utf-8 +# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips +# :license: See LICENSE.txt. + +import pytest + +from clique.sorted_set import SortedSet + + +@pytest.fixture +def standard_set(request): + '''Return sorted set.''' + return SortedSet([4, 5, 6, 7, 2, 1, 1]) + ...
cf439f01f8370971799182abc0e0c635037d2b2f
tests/test_helpers.py
tests/test_helpers.py
from sanic.helpers import has_message_body def test_has_message_body(): tests = ( (100, False), (102, False), (204, False), (200, True), (304, False), (400, True), ) for status_code, expected in tests: assert has_message_body(status_code) is expected...
Add test for has_message_body helper function.
Add test for has_message_body helper function.
Python
mit
yunstanford/sanic,lixxu/sanic,yunstanford/sanic,channelcat/sanic,lixxu/sanic,channelcat/sanic,lixxu/sanic,ashleysommer/sanic,yunstanford/sanic,yunstanford/sanic,channelcat/sanic,ashleysommer/sanic,ashleysommer/sanic,lixxu/sanic,channelcat/sanic
--- +++ @@ -0,0 +1,14 @@ +from sanic.helpers import has_message_body + + +def test_has_message_body(): + tests = ( + (100, False), + (102, False), + (204, False), + (200, True), + (304, False), + (400, True), + ) + for status_code, expected in tests: + assert ...
21b25852f7b1b9457c5d233c9b5ef14d2a33a9a5
src/test_client.py
src/test_client.py
#!/usr/bin/python import traffic import argparse from datetime import datetime, timedelta parser = argparse.ArgumentParser() parser.add_argument("--connect", type=str, help="hostname:port") parser.add_argument("--interval", type=int, help="summary interval") parser.add_argument("clients", type=str, nargs="+", metavar...
Add a script for simple summary query testing
Add a script for simple summary query testing Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>
Python
bsd-3-clause
agdsn/traffic-service-client,agdsn/traffic-service-client
--- +++ @@ -0,0 +1,22 @@ +#!/usr/bin/python + +import traffic +import argparse +from datetime import datetime, timedelta + +parser = argparse.ArgumentParser() +parser.add_argument("--connect", type=str, help="hostname:port") +parser.add_argument("--interval", type=int, help="summary interval") +parser.add_argument("c...
8c77b20a33917d7536e21574cc9a9e592f3f6ae7
test_saferedisqueue.py
test_saferedisqueue.py
from uuid import uuid1 import time from saferedisqueue import SafeRedisQueue def test_autocleanup(): queue = SafeRedisQueue( name='saferedisqueue-test-%s' % uuid1().hex, autoclean_interval=1) queue.push('bad') queue.push('good') assert queue._redis.llen(queue.QUEUE_KEY) == 2 asse...
Add mini test suite. First for autoclean.
Add mini test suite. First for autoclean.
Python
bsd-3-clause
hellp/saferedisqueue
--- +++ @@ -0,0 +1,52 @@ + +from uuid import uuid1 +import time + +from saferedisqueue import SafeRedisQueue + + +def test_autocleanup(): + queue = SafeRedisQueue( + name='saferedisqueue-test-%s' % uuid1().hex, + autoclean_interval=1) + queue.push('bad') + queue.push('good') + assert queue._...
3cabac8174f9616b3a3c44b7e014d4b716e8873e
etalage/scripts/retrieve_piwik_custom_vars_and_export_to_csv.py
etalage/scripts/retrieve_piwik_custom_vars_and_export_to_csv.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # Retrieve Piwik custom vars # By: Sébastien Chauvel <schauvel@easter-eggs.com> # # Copyright (C) 2011, 2012 Easter-eggs # http://gitorious.org/infos-pratiques/etalage # # This file is part of Etalage. # # Etalage is free software; you can redistribute it and/or modify #...
Add a script to retrieve Piwik custom variables and export some pieces of information to CSV
Add a script to retrieve Piwik custom variables and export some pieces of information to CSV
Python
agpl-3.0
Gentux/etalage,Gentux/etalage,Gentux/etalage
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- + + +# Retrieve Piwik custom vars +# By: Sébastien Chauvel <schauvel@easter-eggs.com> +# +# Copyright (C) 2011, 2012 Easter-eggs +# http://gitorious.org/infos-pratiques/etalage +# +# This file is part of Etalage. +# +# Etalage is free software;...
2cb03e58454083293a97f9f5f95285cead046c05
pyopenapi/scanner/v2_0/upgrade/parameter_context.py
pyopenapi/scanner/v2_0/upgrade/parameter_context.py
from __future__ import absolute_import class ParameterContext(object): """ A parameter object in swagger 2.0 might be converted to 'part of' a requestBody of a single parameter object in Open API 3.0. It's relatively complex when doing this. Need a context object to pass information from top converte...
Add ParameterContext object to pass information in a top-down favor
Add ParameterContext object to pass information in a top-down favor
Python
mit
mission-liao/pyopenapi
--- +++ @@ -0,0 +1,29 @@ +from __future__ import absolute_import + + +class ParameterContext(object): + """ A parameter object in swagger 2.0 might be converted + to 'part of' a requestBody of a single parameter object + in Open API 3.0. It's relatively complex when doing this. + + Need a context object t...
9fb5e95e54f126a967a17a5f27cbf3539e3dc970
driver27/migrations/0007_auto_20170529_2211.py
driver27/migrations/0007_auto_20170529_2211.py
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-05-29 22:11 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('driver27', '0006_auto_20170529_2209'), ] operations ...
Add "driver" field in Seat and then delete "contender". (migration)
Add "driver" field in Seat and then delete "contender". (migration)
Python
mit
SRJ9/django-driver27,SRJ9/django-driver27,SRJ9/django-driver27
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2017-05-29 22:11 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('driver27', '0006_auto_...
7252c754f20cbf825c23476778637b5d6d81f8be
examples/python/dynamicsComputationTutorial.py
examples/python/dynamicsComputationTutorial.py
# -*- coding: utf-8 -*- """ Created on Tue Jun 23 11:35:46 2015 @author: adelpret """ import iDynTree from iDynTree import DynamicsComputations URDF_FILE = '/home/username/path/robot.urdf'; dynComp = DynamicsComputations(); dynComp.loadRobotModelFromFile(URDF_FILE); print "The loaded model has", dynComp.getNrOfDegr...
Add python example (same code of c++ DynamicsComputation tutorial)
Add python example (same code of c++ DynamicsComputation tutorial)
Python
lgpl-2.1
robotology/idyntree,robotology/idyntree,robotology/idyntree,robotology/idyntree,robotology/idyntree
--- +++ @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Jun 23 11:35:46 2015 + +@author: adelpret +""" + +import iDynTree +from iDynTree import DynamicsComputations + +URDF_FILE = '/home/username/path/robot.urdf'; + +dynComp = DynamicsComputations(); +dynComp.loadRobotModelFromFile(URDF_FILE); +print "...
27e6a713ff082139785c214d7f9a4cc86fcc823a
tools/MergeGeocodes.py
tools/MergeGeocodes.py
#!/usr/bin/env python3 ############################################################################ # # File: MergeGeocodes.py # Last Edit: 2015-02-26 # Author: Alexander Grüneberg <alexander.grueneberg@googlemail.com> # Purpose: Merge geocoded locations with original CSV input file. # ################################...
Add script to merge geocodes with accident data.
Add script to merge geocodes with accident data.
Python
unlicense
CodeforBirmingham/traffic-accident-reports,CodeforBirmingham/traffic-accident-reports
--- +++ @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 + +############################################################################ +# +# File: MergeGeocodes.py +# Last Edit: 2015-02-26 +# Author: Alexander Grüneberg <alexander.grueneberg@googlemail.com> +# Purpose: Merge geocoded locations with original CSV input file....
ab82983418c4c104e741c70b797057b9c424c647
Testing/test_PiecewiseDynamics.py
Testing/test_PiecewiseDynamics.py
import unittest from SloppyCell.ReactionNetworks import * import TestNetwork class test_PiecewiseDynamics(unittest.TestCase): #XXX: Assignment rules currently not supported. To do so, add a vector # version of piecewise to Trajectory_mod.py #def test_assignment(self): # net = TestNetwork.net.c...
Add basic test for piecewise in dynamical equations
Add basic test for piecewise in dynamical equations
Python
bsd-3-clause
GutenkunstLab/SloppyCell,GutenkunstLab/SloppyCell
--- +++ @@ -0,0 +1,32 @@ +import unittest + +from SloppyCell.ReactionNetworks import * + +import TestNetwork + +class test_PiecewiseDynamics(unittest.TestCase): + #XXX: Assignment rules currently not supported. To do so, add a vector + # version of piecewise to Trajectory_mod.py + #def test_assignment(se...
183c02d56848035e4ec162776317df82d5b43d4d
test_merge_sort.py
test_merge_sort.py
# -*- coding: utf-8 -*- from merge_sort import merge_sort def test_sorted(): my_list = list(range(100)) merge_sort(my_list) assert my_list == list(range(100)) def test_reverse(): my_list = list(range(100))[::-1] merge_sort(my_list) assert my_list == list(range(100)) def test_empty(): m...
Add tests for merge sort
Add tests for merge sort
Python
mit
nbeck90/data_structures_2
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +from merge_sort import merge_sort + + +def test_sorted(): + my_list = list(range(100)) + merge_sort(my_list) + assert my_list == list(range(100)) + + +def test_reverse(): + my_list = list(range(100))[::-1] + merge_sort(my_list) + assert my_list == l...
5cc3ae018c09a3d642fd83c890ef137681e07bdc
tests/test_lspr.py
tests/test_lspr.py
import os import pickle import pytest import functools try: import pycuda except ImportError: ans = input('PyCUDA not found. Regression tests will take forever. Do you want to continue? [y/n] ') if ans in ['Y', 'y']: pass else: sys.exit() from pygbe.main import main @pytest.mark.pa...
Add lspr example regression test
Add lspr example regression test
Python
bsd-3-clause
barbagroup/pygbe,barbagroup/pygbe,barbagroup/pygbe
--- +++ @@ -0,0 +1,53 @@ +import os +import pickle +import pytest +import functools + +try: + import pycuda +except ImportError: + ans = input('PyCUDA not found. Regression tests will take forever. Do you want to continue? [y/n] ') + if ans in ['Y', 'y']: + pass + else: + sys.exit() + +fro...
e928094c43c076c72841efb1cc477f92d6a3281f
set1/stringlib.py
set1/stringlib.py
import base64 import unittest def decode_hex(string): return base64.b16decode(string, casefold=True) def encode_hex(string): return base64.b16encode(string) def decode_base64(string): return base64.standard_b64decode(string, validate=True) def encode_base64(string): return base64.standard_b64enc...
Refactor encoding in string library.
Refactor encoding in string library.
Python
mit
Renelvon/matasano
--- +++ @@ -0,0 +1,23 @@ +import base64 +import unittest + + +def decode_hex(string): + return base64.b16decode(string, casefold=True) + + +def encode_hex(string): + return base64.b16encode(string) + + +def decode_base64(string): + return base64.standard_b64decode(string, validate=True) + + +def encode_base6...
d0c00a73d9dc5b4bde076fce3c06dff34c9d48f6
test/test_pix_to_np.py
test/test_pix_to_np.py
#!/usr/bin/env python # # Test program to ensure that the Pix to/from numpy conversion routines are # actually functioning as we think they're functioning # import tesseract_sip as tesseract import numpy as np def np_from_pix(pix): ''' Converts a leptonica Pix object into a numpy array suitab...
Add unit test to check pix conversion routines
Add unit test to check pix conversion routines
Python
apache-2.0
virtuald/python-tesseract-sip,cookbrite/python-tesseract-sip,cookbrite/python-tesseract-sip,virtuald/python-tesseract-sip
--- +++ @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# +# Test program to ensure that the Pix to/from numpy conversion routines are +# actually functioning as we think they're functioning +# + +import tesseract_sip as tesseract +import numpy as np + + +def np_from_pix(pix): + ''' + Converts a leptonica Pix obje...
66ee31b1cc8d3921eb9c34725e91c08297f33cf0
tests/functional/registration/test_version.py
tests/functional/registration/test_version.py
""" Test `version` command. """ import os import re from pkg_resources import parse_version from textx.cli import textx from click.testing import CliRunner def test_version_command(): runner = CliRunner() result = runner.invoke(textx, ['version']) assert result.exit_code == 0 assert result.output.star...
Add test for `version` command
Add test for `version` command
Python
mit
igordejanovic/textX,igordejanovic/textX,igordejanovic/textX
--- +++ @@ -0,0 +1,18 @@ +""" +Test `version` command. +""" +import os +import re +from pkg_resources import parse_version +from textx.cli import textx +from click.testing import CliRunner + + +def test_version_command(): + runner = CliRunner() + result = runner.invoke(textx, ['version']) + assert result.exi...
cd97e8d8f8578abef246f3780b4c0ec10eebc8fa
tests/test_WListBox.py
tests/test_WListBox.py
import unittest from picotui.widgets import WListBox from picotui.defs import KEY_DOWN from picotui.context import Context class User: def __init__(self, name, age): self.name = name self.age = age class UserListBox(WListBox): def __init__(self, width, height, items): super().__init_...
Add test for rendering WListBox in case of non-str content.
tests: Add test for rendering WListBox in case of non-str content.
Python
mit
pfalcon/picotui
--- +++ @@ -0,0 +1,26 @@ +import unittest +from picotui.widgets import WListBox +from picotui.defs import KEY_DOWN +from picotui.context import Context + + +class User: + def __init__(self, name, age): + self.name = name + self.age = age + + +class UserListBox(WListBox): + def __init__(self, width...
8c93e873a71d19f390c69c6774b92f28dc0110de
tests/test_defaults.py
tests/test_defaults.py
from logstapo import defaults def test_defaults(): # in case you wonder why there's a test for this: # changing the default config file path would break invocations # where the config file path is not specified so it should be # considered immutable assert defaults.CONFIG_FILE_PATH == '/etc/logsta...
Cover default.py with a test
Cover default.py with a test
Python
mit
ThiefMaster/logstapo
--- +++ @@ -0,0 +1,9 @@ +from logstapo import defaults + + +def test_defaults(): + # in case you wonder why there's a test for this: + # changing the default config file path would break invocations + # where the config file path is not specified so it should be + # considered immutable + assert defaul...
1889e03c139e0fb66d4241aa10b29345ef3bde5b
python_src/SerialUDPBridge.py
python_src/SerialUDPBridge.py
import serial #Serial port API http://pyserial.sourceforge.net/pyserial_api.html import socket import time from threading import Thread def recvUDP(sock,SerialIOArduino): while True: data, addr = sock.recvfrom(1280) # Max recieve size is 1280 bytes print "UDP received message:", data.strip() ...
Send the messages from the serial port as UDP messages to port 9050 Recieves UDP messages on port 9050 and sends them over the serial line
Send the messages from the serial port as UDP messages to port 9050 Recieves UDP messages on port 9050 and sends them over the serial line
Python
mit
rlangoy/socLabWeek43
--- +++ @@ -0,0 +1,38 @@ +import serial #Serial port API http://pyserial.sourceforge.net/pyserial_api.html +import socket +import time +from threading import Thread + + +def recvUDP(sock,SerialIOArduino): + while True: + data, addr = sock.recvfrom(1280) # Max recieve size is 1280 bytes + print "UDP r...
a60e7b34a5c2f0a80f30ae7fa61efe507cd66161
tests.py
tests.py
# -*- coding: utf-8 -*- import os import unittest import tempfile from datetime import datetime from flask.ext.sqlalchemy import SQLAlchemy from app import app, db, Pass, Registration class PassbookTestCase(unittest.TestCase): def setUp(self): temp = tempfile.mkstemp() self.temp = temp ...
Add a basic test case.
Add a basic test case.
Python
mit
renstrom/passbook_flask_example
--- +++ @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +import os +import unittest +import tempfile +from datetime import datetime + +from flask.ext.sqlalchemy import SQLAlchemy + +from app import app, db, Pass, Registration + + +class PassbookTestCase(unittest.TestCase): + + def setUp(self): + temp = tempfile.m...