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
fb5f6bf999b2cd8b674bc2c89f74f1413fc8ee1e
command_line_tic_tac_toe.py
command_line_tic_tac_toe.py
#!/usr/bin/env python3 import cmd from tictactoe.ai_player import AIPlayer from tictactoe.human_player import HumanPlayer from tictactoe.game_controller import GameController from tictactoe.board_stringification import BoardStringification class CommandLineTicTacToe(cmd.Cmd): def __init__(self, i...
Add command line interface to play
Add command line interface to play
Python
mit
rickerbh/tictactoe_py
--- +++ @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 + +import cmd +from tictactoe.ai_player import AIPlayer +from tictactoe.human_player import HumanPlayer +from tictactoe.game_controller import GameController +from tictactoe.board_stringification import BoardStringification + +class CommandLineTicTacToe(cmd.Cmd): + ...
b1ef133904540b7f49e22ac52a0f844963be829e
nose2/tests/functional/test_discovery_loader.py
nose2/tests/functional/test_discovery_loader.py
from nose2.tests._common import FunctionalTestCase, support_file from nose2 import events, loader, session from nose2.plugins.loader.discovery import DiscoveryLoader class Watcher(events.Plugin): def __init__(self): self.called = [] def loadTestsFromModule(self, event): self.called.append(eve...
Add basic test for discovery loader
Add basic test for discovery loader
Python
bsd-2-clause
ojengwa/nose2,ezigman/nose2,little-dude/nose2,ojengwa/nose2,leth/nose2,ptthiem/nose2,ptthiem/nose2,little-dude/nose2,leth/nose2,ezigman/nose2
--- +++ @@ -0,0 +1,28 @@ +from nose2.tests._common import FunctionalTestCase, support_file +from nose2 import events, loader, session +from nose2.plugins.loader.discovery import DiscoveryLoader + + +class Watcher(events.Plugin): + def __init__(self): + self.called = [] + + def loadTestsFromModule(self, e...
681cc0a4160373fe82de59946b52e0e21611af84
linkLister.py
linkLister.py
import requests import re url = raw_input("Enter URL with http or https prefix : " ) print url website= requests.get(url) html = website.text print html linklist = re.findall('"((http|ftp)s?://.*?)"',html) print linklist for link in linklist: print link[0]
Print out all links on a page
Print out all links on a page
Python
mit
NilanjanaLodh/PyScripts,NilanjanaLodh/PyScripts
--- +++ @@ -0,0 +1,13 @@ +import requests +import re + +url = raw_input("Enter URL with http or https prefix : " ) +print url +website= requests.get(url) + +html = website.text +print html +linklist = re.findall('"((http|ftp)s?://.*?)"',html) +print linklist +for link in linklist: + print link[0]
27622185e04bb652284597783287262e23bafa7d
plenum/test/node_request/test_apply_stashed_partially_ordered.py
plenum/test/node_request/test_apply_stashed_partially_ordered.py
import pytest from plenum.common.constants import DOMAIN_LEDGER_ID from plenum.common.startable import Mode from plenum.common.txn_util import reqToTxn from plenum.test.delayers import cDelay from plenum.test.helper import sdk_get_and_check_replies, sdk_send_random_requests, logger from plenum.test.node_catchup.helper...
Add minimal test case (failing)
INDY-1405: Add minimal test case (failing) Signed-off-by: Sergey Khoroshavin <b770466c7a06c5fe47531d5f0e31684f1131354d@dsr-corporation.com>
Python
apache-2.0
evernym/zeno,evernym/plenum
--- +++ @@ -0,0 +1,63 @@ +import pytest + +from plenum.common.constants import DOMAIN_LEDGER_ID +from plenum.common.startable import Mode +from plenum.common.txn_util import reqToTxn +from plenum.test.delayers import cDelay +from plenum.test.helper import sdk_get_and_check_replies, sdk_send_random_requests, logger +f...
e8a6c0adc3aa77f8e0b1399fe076b43720acb823
tests/test_api.py
tests/test_api.py
# -*- coding: utf-8 -*- import subprocess import requests from unittest import TestCase from nose.tools import assert_equal class Test(TestCase): def setUp(self): self.process = subprocess.Popen("openfisca-serve") def tearDown(self): self.process.terminate() def test_response(self): ...
Test the API can run
Test the API can run
Python
agpl-3.0
antoinearnoud/openfisca-france,antoinearnoud/openfisca-france,sgmap/openfisca-france,sgmap/openfisca-france
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +import subprocess +import requests +from unittest import TestCase +from nose.tools import assert_equal + + +class Test(TestCase): + + def setUp(self): + self.process = subprocess.Popen("openfisca-serve") + + def tearDown(self): + self.process.te...
690c08b2b35df2d81dc0977d8bd593c45806e1c2
tests/test_log.py
tests/test_log.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from flask import url_for def test_view_build_log(test_client): test_client.get(url_for('log.build_log', sha='123456')) def test_view_lint_log(test_client): test_client.get(url_for('log.lint_log', sha='123456'))
Add dumb log view test cases
Add dumb log view test cases
Python
mit
bosondata/badwolf,bosondata/badwolf,bosondata/badwolf
--- +++ @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, unicode_literals +from flask import url_for + + +def test_view_build_log(test_client): + test_client.get(url_for('log.build_log', sha='123456')) + + +def test_view_lint_log(test_client): + test_client.get(url_for('log.lin...
4d500d9abe2da28cdd9bd95019048de445aac265
docs/source/tutorial/v5/history_demo.py
docs/source/tutorial/v5/history_demo.py
# coding: utf-8 from deprecated.history import deprecated from deprecated.history import versionadded from deprecated.history import versionchanged @deprecated( reason=""" This is deprecated, really. So you need to use another function. But I don\'t know which one. - The first, - The se...
Add a history demo in documentation.
Add a history demo in documentation.
Python
mit
tantale/deprecated
--- +++ @@ -0,0 +1,36 @@ +# coding: utf-8 +from deprecated.history import deprecated +from deprecated.history import versionadded +from deprecated.history import versionchanged + + +@deprecated( + reason=""" + This is deprecated, really. So you need to use another function. + But I don\'t know which one. + ...
c39c086f51963678769c1066637ca573c721e827
static_gallery.py
static_gallery.py
from . import flag #from go import html from go import os from go import path/filepath def ReadAlbumDirs(input_dir): f = os.Open(input_dir) with defer f.Close(): names = f.Readdirnames(-1) for name in names: stat = os.Stat(filepath.Join(input_dir, name)) if stat.IsDir(): yield name def...
Create a simple static gallery script.
Create a simple static gallery script.
Python
mit
strickyak/aphid,strickyak/aphid,strickyak/aphid,strickyak/aphid,strickyak/aphid,strickyak/aphid,strickyak/aphid
--- +++ @@ -0,0 +1,61 @@ +from . import flag +#from go import html +from go import os +from go import path/filepath + +def ReadAlbumDirs(input_dir): + f = os.Open(input_dir) + with defer f.Close(): + names = f.Readdirnames(-1) + for name in names: + stat = os.Stat(filepath.Join(input_dir, name)) + i...
8139dc9e04025da001323122521951f5ed2c391b
users/migrations/0010_users-profile-encoding.py
users/migrations/0010_users-profile-encoding.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2016-09-25 01:43 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('users', '0009_remove_profile_active'), ] operations = [ migrations.RunSQL("ALTER DAT...
Fix mysql encoding for users.profile.reason
Fix mysql encoding for users.profile.reason
Python
mit
sbuss/voteswap,sbuss/voteswap,sbuss/voteswap,sbuss/voteswap
--- +++ @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.9 on 2016-09-25 01:43 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0009_remove_profile_active'), + ] + + operations...
328901c74d1ee103a1ee5b2f26aa391ddeda465b
tests/test_web.py
tests/test_web.py
"""Test the AutoCMS web reporting functionality.""" import os import shutil import unittest import re from autocms.core import load_configuration from autocms.web import ( produce_default_webpage ) class TestWebPageCreation(unittest.TestCase): """Test the accurate creation of test webpages.""" def setU...
Add unit test for webpage creation and description
Add unit test for webpage creation and description
Python
mit
appeltel/AutoCMS,appeltel/AutoCMS,appeltel/AutoCMS
--- +++ @@ -0,0 +1,48 @@ +"""Test the AutoCMS web reporting functionality.""" + +import os +import shutil +import unittest +import re + +from autocms.core import load_configuration +from autocms.web import ( + produce_default_webpage +) + + +class TestWebPageCreation(unittest.TestCase): + """Test the accurate c...
3133bbfcb5ee56c88ea20be21778519bffe77299
literotica.py
literotica.py
from common import * from sys import argv from urlgrab import Cache from re import compile, DOTALL, MULTILINE cache = Cache() url = argv[1] titlePattern = compile("<h1>([^<]+)</h1>") contentPattern = compile("<div class=\"b-story-body-x x-r15\">(.+?)</div><div class=\"b-story-stats-block\">" , DOTALL|MULTILINE) nextP...
Add another different type of book
Add another different type of book
Python
agpl-3.0
palfrey/book-blog
--- +++ @@ -0,0 +1,39 @@ +from common import * +from sys import argv +from urlgrab import Cache +from re import compile, DOTALL, MULTILINE + +cache = Cache() +url = argv[1] + +titlePattern = compile("<h1>([^<]+)</h1>") +contentPattern = compile("<div class=\"b-story-body-x x-r15\">(.+?)</div><div class=\"b-story-stat...
893679baff0367538bdf3b52b04f8bae72732be8
zerver/migrations/0031_remove_system_avatar_source.py
zerver/migrations/0031_remove_system_avatar_source.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('zerver', '0030_realm_org_type'), ] operations = [ migrations.AlterField( model_name='userprofile', n...
Add migration to remove system avatar source.
Add migration to remove system avatar source. Fixes the last commit having broken master.
Python
apache-2.0
sharmaeklavya2/zulip,isht3/zulip,joyhchen/zulip,susansls/zulip,zulip/zulip,punchagan/zulip,blaze225/zulip,PhilSk/zulip,samatdav/zulip,hackerkid/zulip,christi3k/zulip,brainwane/zulip,mahim97/zulip,kou/zulip,jackrzhang/zulip,amyliu345/zulip,paxapy/zulip,niftynei/zulip,samatdav/zulip,vikas-parashar/zulip,shubhamdhama/zuli...
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('zerver', '0030_realm_org_type'), + ] + + operations = [ + migrations.AlterField( + ...
b51398d602a157ce55fd7e08eedd953051f716a1
backend/scripts/updatedf.py
backend/scripts/updatedf.py
#!/usr/bin/env python #import hashlib import os def main(): for root, dirs, files in os.walk("/mcfs/data/materialscommons"): for f in files: print f if __name__ == "__main__": main()
Add script to update uploaded files.
Add script to update uploaded files.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +#import hashlib +import os + +def main(): + for root, dirs, files in os.walk("/mcfs/data/materialscommons"): + for f in files: + print f + +if __name__ == "__main__": + main()
fbf36a2fb52b5ed1aceaec4c1d1075448584a97d
tests/test_imports.py
tests/test_imports.py
"""Test that all modules/packages in the lektor tree are importable in any order Here we import each module by itself, one at a time, each in a new python interpreter. """ import pkgutil import sys from subprocess import run import pytest import lektor def iter_lektor_modules(): for module in pkgutil.walk_pac...
Test that modules can be imported in any order
Test that modules can be imported in any order This excercises an tricky import cycle introduced in: 7c68f3f78 more imports at top level
Python
bsd-3-clause
lektor/lektor,lektor/lektor,lektor/lektor,lektor/lektor
--- +++ @@ -0,0 +1,28 @@ +"""Test that all modules/packages in the lektor tree are importable in any order + +Here we import each module by itself, one at a time, each in a new +python interpreter. + +""" +import pkgutil +import sys +from subprocess import run + +import pytest + +import lektor + + +def iter_lektor_mo...
85202173cf120caad603315cd57fa66857a88b0b
feder/institutions/migrations/0013_auto_20170810_2118.py
feder/institutions/migrations/0013_auto_20170810_2118.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-08-10 21:18 from __future__ import unicode_literals from django.db import migrations import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('institutions', '0012_auto_20170808_0309'), ] operations = [ ...
Add missing migrations for institutions
Add missing migrations for institutions
Python
mit
watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.2 on 2017-08-10 21:18 +from __future__ import unicode_literals + +from django.db import migrations +import jsonfield.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('institutions', '0012_auto_20170808_03...
c95234c130435ddd116784ad1829f7bdaa9182c5
100_to_199/euler_138.py
100_to_199/euler_138.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Problem 138 Consider the isosceles triangle with base length, b = 16, and legs, L = 17. By using the Pythagorean theorem it can be seen that the height of the triangle, h = √(172 − 82) = 15, which is one less than the base length. With b = 272 and L = 305, we get h ...
ADD 138 solutions with A195615(OEIS)
ADD 138 solutions with A195615(OEIS)
Python
mit
byung-u/ProjectEuler
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +''' +Problem 138 +Consider the isosceles triangle with base length, b = 16, and legs, L = 17. + + +By using the Pythagorean theorem it can be seen that the height of the triangle, h = √(172 − 82) = 15, which is one less than the base length....
b01bd1b21f1b12c9120845ec8a85355b038d6b20
inventory_control/storage.py
inventory_control/storage.py
""" This is the Storage engine. It's how everything should talk to the database layer that sits on the inside of the inventory-control system. """ import MySQLdb class StorageEngine(object): """ Instantiate a DB access object, create all the necessary hooks and then the accessors to a SQL database. ...
Add a basic Storage engine to talk to the DB
Add a basic Storage engine to talk to the DB
Python
mit
codeforsanjose/inventory-control,worldcomputerxchange/inventory-control
--- +++ @@ -0,0 +1,22 @@ +""" +This is the Storage engine. It's how everything should talk to the database +layer that sits on the inside of the inventory-control system. +""" + +import MySQLdb + + +class StorageEngine(object): + """ + Instantiate a DB access object, create all the necessary hooks and + then...
399daa8ebec14bc4d7ee6c08135e525190e1eb6f
collections/show-test/print-divs.py
collections/show-test/print-divs.py
# print-divs.py def printDivs(num): for i in range(num): print('<div class="item">Item ' + str(i+1) + '</div>') printDivs(20)
Add short Python script that prints as many dummy divs as needed.
Add short Python script that prints as many dummy divs as needed. Used for idea testing; tracking rather than deleting b/c may still need to populate a layout with dozens of test divs, since many collections have 50+ items.
Python
apache-2.0
scholarslab/takeback,scholarslab/takeback,scholarslab/takeback,scholarslab/takeback,scholarslab/takeback
--- +++ @@ -0,0 +1,7 @@ +# print-divs.py + +def printDivs(num): + for i in range(num): + print('<div class="item">Item ' + str(i+1) + '</div>') + +printDivs(20)
2b80b358edd5bcf914d0c709369dbbcfd748772b
common/djangoapps/mitxmako/tests.py
common/djangoapps/mitxmako/tests.py
from django.test import TestCase from django.test.utils import override_settings from django.core.urlresolvers import reverse from django.conf import settings from mitxmako.shortcuts import marketing_link from mock import patch class ShortcutsTests(TestCase): """ Test the mitxmako shortcuts file """ ...
Add in a test for the marketing_link function in mitxmako
Add in a test for the marketing_link function in mitxmako
Python
agpl-3.0
polimediaupv/edx-platform,praveen-pal/edx-platform,pdehaye/theming-edx-platform,raccoongang/edx-platform,defance/edx-platform,atsolakid/edx-platform,Softmotions/edx-platform,IONISx/edx-platform,ampax/edx-platform,LICEF/edx-platform,IndonesiaX/edx-platform,abdoosh00/edraak,chudaol/edx-platform,morpheby/levelup-by,raccoo...
--- +++ @@ -0,0 +1,26 @@ +from django.test import TestCase +from django.test.utils import override_settings +from django.core.urlresolvers import reverse +from django.conf import settings +from mitxmako.shortcuts import marketing_link +from mock import patch + + +class ShortcutsTests(TestCase): + """ + Test the...
e9f2e966361d8a23c83fbbbb4a4b3d4046203a16
CERR_core/Contouring/models/heart/test/test.py
CERR_core/Contouring/models/heart/test/test.py
#Test script for heart container testing if all the imports are successful import sys import os import numpy as np import h5py import fnmatch from modeling.sync_batchnorm.replicate import patch_replication_callback from modeling.deeplab import * from torchvision.utils import make_grid from dataloaders.utils import dec...
Test script for the heart container
Test script for the heart container
Python
lgpl-2.1
cerr/CERR,cerr/CERR,cerr/CERR,aditiiyer/CERR,aditiiyer/CERR,aditiiyer/CERR,aditiiyer/CERR,cerr/CERR,cerr/CERR,cerr/CERR,aditiiyer/CERR,cerr/CERR,aditiiyer/CERR,cerr/CERR,aditiiyer/CERR,cerr/CERR,aditiiyer/CERR
--- +++ @@ -0,0 +1,24 @@ +#Test script for heart container testing if all the imports are successful + +import sys +import os +import numpy as np +import h5py +import fnmatch +from modeling.sync_batchnorm.replicate import patch_replication_callback +from modeling.deeplab import * +from torchvision.utils import make_g...
b223c8be2bcb11d529a07997c05a9c5ab2b183b2
csunplugged/tests/resources/generators/test_run_length_encoding.py
csunplugged/tests/resources/generators/test_run_length_encoding.py
from unittest import mock from django.http import QueryDict from django.test import tag from resources.generators.RunLengthEncodingResourceGenerator import RunLengthEncodingResourceGenerator from tests.resources.generators.utils import BaseGeneratorTest @tag("resource") class RunLengthEncodingResourceGeneratorTest(Ba...
Add basic tests for run length encoding printable
Add basic tests for run length encoding printable
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
--- +++ @@ -0,0 +1,82 @@ +from unittest import mock +from django.http import QueryDict +from django.test import tag +from resources.generators.RunLengthEncodingResourceGenerator import RunLengthEncodingResourceGenerator +from tests.resources.generators.utils import BaseGeneratorTest + + +@tag("resource") +class RunLe...
4569c22d2d0245641e0c2696f798f273405c6bee
test_add_group.py
test_add_group.py
# -*- coding: utf-8 -*- from selenium.webdriver.firefox.webdriver import WebDriver from selenium.webdriver.common.action_chains import ActionChains import time, unittest def is_alert_present(wd): try: wd.switch_to_alert().text return True except: return False class test_add_group(unitt...
Test recorded and exported to the project
Test recorded and exported to the project
Python
mit
spcartman/python_qa
--- +++ @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +from selenium.webdriver.firefox.webdriver import WebDriver +from selenium.webdriver.common.action_chains import ActionChains +import time, unittest + +def is_alert_present(wd): + try: + wd.switch_to_alert().text + return True + except: + re...
c16620dffd2cd6396eb6b7db76a9c29849a16500
components/lie_structures/lie_structures/cheminfo_descriptors.py
components/lie_structures/lie_structures/cheminfo_descriptors.py
# -*- coding: utf-8 -*- """ file: cheminfo_molhandle.py Cinfony driven cheminformatics fingerprint functions """ import logging from twisted.logger import Logger from . import toolkits logging = Logger() def available_descriptors(): """ List available molecular descriptors for all active cheminformatics...
Add support for cheminformatics descriptors
Add support for cheminformatics descriptors
Python
apache-2.0
MD-Studio/MDStudio,MD-Studio/MDStudio,MD-Studio/MDStudio,MD-Studio/MDStudio,MD-Studio/MDStudio
--- +++ @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +""" +file: cheminfo_molhandle.py + +Cinfony driven cheminformatics fingerprint functions +""" + +import logging + +from twisted.logger import Logger + +from . import toolkits + +logging = Logger() + + +def available_descriptors(): + """ + List available molec...
ee3e04d32e39d6ac7ef4ac7abc2363a1ac9b8917
example_music.py
example_music.py
from screenfactory import create_screen from modules.music import Music import config import time import pygame screen = create_screen() music = Music(screen) music.start() while True: if config.virtual_hardware: pygame.time.wait(10) for event in pygame.event.get(): pass else: time.sleep(0.01)
Add an example for the music module
Add an example for the music module
Python
mit
derblub/pixelpi,marian42/pixelpi,derblub/pixelpi,derblub/pixelpi,marian42/pixelpi
--- +++ @@ -0,0 +1,18 @@ +from screenfactory import create_screen +from modules.music import Music +import config +import time +import pygame + +screen = create_screen() + +music = Music(screen) +music.start() + +while True: + if config.virtual_hardware: + pygame.time.wait(10) + for event in pygame.event.get(): + ...
05c7d62e0e26000440e72d0700c9806d7a409744
games/migrations/0023_auto_20171104_2246.py
games/migrations/0023_auto_20171104_2246.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-11-04 21:46 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('games', '0022_installer_reason'), ] operations = [...
Add migrations for game change suggestions
Add migrations for game change suggestions
Python
agpl-3.0
lutris/website,lutris/website,lutris/website,lutris/website
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.2 on 2017-11-04 21:46 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('games', '0022_instal...
db41bce3d90cfada9916baa8f9267cd9e6160a94
examples/open_file.py
examples/open_file.py
import numpy as np import pyh5md f = pyh5md.H5MD_File('poc.h5', 'r') at = f.trajectory('atoms') at_pos = at.data('position') r = at_pos.v.value print r f.f.close()
Add an example for opening a file.
Add an example for opening a file.
Python
bsd-3-clause
MrTheodor/pyh5md,khinsen/pyh5md
--- +++ @@ -0,0 +1,14 @@ +import numpy as np +import pyh5md + +f = pyh5md.H5MD_File('poc.h5', 'r') + +at = f.trajectory('atoms') + +at_pos = at.data('position') + +r = at_pos.v.value + +print r + +f.f.close()
10eb703867fd10df543a141837c2a57d1052ba2c
ideascube/conf/kb_civ_babylab.py
ideascube/conf/kb_civ_babylab.py
# -*- coding: utf-8 -*- """KoomBook conf""" from .kb import * # noqa from django.utils.translation import ugettext_lazy as _ LANGUAGE_CODE = 'fr' IDEASCUBE_NAME = 'BabyLab' HOME_CARDS = STAFF_HOME_CARDS + [ { 'id': 'blog', }, { 'id': 'mediacenter', }, { 'id': 'bsfcampus', ...
Rename file with correct pattern
Rename file with correct pattern
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
--- +++ @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +"""KoomBook conf""" +from .kb import * # noqa +from django.utils.translation import ugettext_lazy as _ + +LANGUAGE_CODE = 'fr' +IDEASCUBE_NAME = 'BabyLab' +HOME_CARDS = STAFF_HOME_CARDS + [ + { + 'id': 'blog', + }, + { + 'id': 'mediacenter', +...
35317e778b2fe1d238e21954df1eac0c5380b00b
generate_horoscope.py
generate_horoscope.py
#!/usr/bin/env python3 # encoding: utf-8 import argparse import sqlite3 import sys """generate_horoscope.py: Generates horoscopes based provided corpuses""" __author__ = "Project Zodiacy" __copyright__ = "Copyright 2015, Project Zodiacy" _parser = argparse.ArgumentParser(description="Awesome SQLite importer") _pars...
Add corpus fetch from database
Add corpus fetch from database Former-commit-id: 2241247b60e2829003059f8c9d7d7c72b3e49951
Python
mit
greenify/zodiacy,greenify/zodiacy
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +# encoding: utf-8 + +import argparse +import sqlite3 +import sys + +"""generate_horoscope.py: Generates horoscopes based provided corpuses""" + +__author__ = "Project Zodiacy" +__copyright__ = "Copyright 2015, Project Zodiacy" + +_parser = argparse.ArgumentParser(desc...
c0ab9b755b4906129988348b2247452b6dfc157f
plugins/modules/dedicated_server_display_name.py
plugins/modules/dedicated_server_display_name.py
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function) from ansible.module_utils.basic import AnsibleModule __metaclass__ = type DOCUMENTATION = ''' --- module: dedicated_server_display_name short_description: Modify the server display name in ovh manager descri...
Add a module to set the "display name" of a dedicated server
INFRA-6896: Add a module to set the "display name" of a dedicated server - Change the "display name" in ovh manager, so you can use your internal naming for example - No need to set internal names in reverse dns anymore - Change is only visible in OVH manager (and API, of course)
Python
mit
synthesio/infra-ovh-ansible-module
--- +++ @@ -0,0 +1,93 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +from __future__ import (absolute_import, division, print_function) + +from ansible.module_utils.basic import AnsibleModule + +__metaclass__ = type + +DOCUMENTATION = ''' +--- +module: dedicated_server_display_name +short_description: Modify the s...
8fbc5877fa97b6b8df621ff7afe7515b501660fc
LeetCode/ConvertStringToCamelCase.py
LeetCode/ConvertStringToCamelCase.py
def to_camel_case(text): if len(text) < 2: return text capped_camel = "".join([word.title() for word in text.replace('-','_').split('_')]) return capped_camel if text[0].isupper() else capped_camel[0].lower()+capped_camel[1:]
Convert string to camel case
Codewars: Convert string to camel case
Python
unlicense
SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive
--- +++ @@ -0,0 +1,5 @@ +def to_camel_case(text): + if len(text) < 2: + return text + capped_camel = "".join([word.title() for word in text.replace('-','_').split('_')]) + return capped_camel if text[0].isupper() else capped_camel[0].lower()+capped_camel[1:]
4fbb9ca1b055b040214c82dc307f69793947b800
api/sync_wallet.py
api/sync_wallet.py
import urlparse import os, sys import json tools_dir = os.environ.get('TOOLSDIR') lib_path = os.path.abspath(tools_dir) sys.path.append(lib_path) from msc_apps import * data_dir_root = os.environ.get('DATADIR') def sync_wallet_response(request_dict): if not request_dict.has_key('type'): return (None, 'No field ...
Add handler for syncing wallets to server
Add handler for syncing wallets to server
Python
agpl-3.0
habibmasuro/omniwallet,VukDukic/omniwallet,dexX7/omniwallet,FuzzyBearBTC/omniwallet,Nevtep/omniwallet,OmniLayer/omniwallet,arowser/omniwallet,FuzzyBearBTC/omniwallet,ripper234/omniwallet,achamely/omniwallet,FuzzyBearBTC/omniwallet,arowser/omniwallet,OmniLayer/omniwallet,OmniLayer/omniwallet,maran/omniwallet,maran/omniw...
--- +++ @@ -0,0 +1,39 @@ +import urlparse +import os, sys +import json +tools_dir = os.environ.get('TOOLSDIR') +lib_path = os.path.abspath(tools_dir) +sys.path.append(lib_path) +from msc_apps import * + +data_dir_root = os.environ.get('DATADIR') + +def sync_wallet_response(request_dict): + if not request_dict.has_ke...
613a0056e12a28232542aaf561831d276868e413
programs/kinbody-creator/openraveMapGenerator.py
programs/kinbody-creator/openraveMapGenerator.py
#!/usr/bin/python #import lxml.etree #import lxml.builder from lxml import etree #E = lxml.builder.ElementMaker() #KINBODY=E.KinBody #BODY=E.Body #GEOM=E.Geom #EXTENTS=E.Extents #TRANSLATION=E.Translation #DIFUSSECOLOR=E.diffuseColor # User variables nX = 3 nY = 2 boxHeight = 1.0 resolution = 2.0 # Just to make s...
Add parametric map generator, good for wrinkles
Add parametric map generator, good for wrinkles
Python
lgpl-2.1
roboticslab-uc3m/xgnitive,roboticslab-uc3m/xgnitive,roboticslab-uc3m/xgnitive
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/python + +#import lxml.etree +#import lxml.builder +from lxml import etree + +#E = lxml.builder.ElementMaker() + +#KINBODY=E.KinBody +#BODY=E.Body +#GEOM=E.Geom +#EXTENTS=E.Extents +#TRANSLATION=E.Translation +#DIFUSSECOLOR=E.diffuseColor + +# User variables +nX = 3 +nY = 2 +boxHe...
e262d176ecd7d8871a9e06ebc542cf473acf0925
reports/migrations/0004_transnational_weights.py
reports/migrations/0004_transnational_weights.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from django_countries import countries def populate_weights(apps, schema_editor): Weights = apps.get_model("reports", "Weights") db_alias = schema_editor.connection.alias for item in COUNTRY_WEIGHTS: ...
Add migration for transnational weights
Add migration for transnational weights
Python
apache-2.0
Code4SA/gmmp,Code4SA/gmmp,Code4SA/gmmp
--- +++ @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations +from django_countries import countries + +def populate_weights(apps, schema_editor): + Weights = apps.get_model("reports", "Weights") + db_alias = schema_editor.connection.alias + + ...
b0577ce3b8b162ce3702430b189905f9beaae8d5
firecares/firestation/management/commands/cleanup_phonenumbers.py
firecares/firestation/management/commands/cleanup_phonenumbers.py
from django.core.management.base import BaseCommand from firecares.firestation.models import FireDepartment from phonenumber_field.modelfields import PhoneNumber import re """ This command is for cleaning up every phone and fax number in the database. It removes all non-numeric characters, such as parenthesis, hyphens...
Add script to clean up all FD phone and fax numbers.
Add script to clean up all FD phone and fax numbers.
Python
mit
FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares
--- +++ @@ -0,0 +1,38 @@ +from django.core.management.base import BaseCommand +from firecares.firestation.models import FireDepartment +from phonenumber_field.modelfields import PhoneNumber +import re + +""" +This command is for cleaning up every phone and fax number in the +database. It removes all non-numeric chara...
d5d3fcfb331c1486acbfb004705b94b1923a0db8
Codes/SuperEdge/SuperEdge/dump_libsvm.py
Codes/SuperEdge/SuperEdge/dump_libsvm.py
import numpy as np from datetime import datetime from sklearn.datasets import dump_svmlight_file import os.path as path def main(): cache_path = 'largecache/' feat_name = 'feat.dat' lbl_name = 'lbl.dat' feat_len = 4224 #1088 now = datetime.now() lbl_memmap = np.memmap(path.join(cache_path, lbl_...
Add code to dump features into libsvm file format
[Code] Add code to dump features into libsvm file format
Python
mit
erfannoury/SuperEdge,erfannoury/SuperEdge,erfannoury/SuperEdge,erfannoury/SuperEdge,erfannoury/SuperEdge
--- +++ @@ -0,0 +1,20 @@ +import numpy as np +from datetime import datetime +from sklearn.datasets import dump_svmlight_file +import os.path as path + +def main(): + cache_path = 'largecache/' + feat_name = 'feat.dat' + lbl_name = 'lbl.dat' + feat_len = 4224 #1088 + now = datetime.now() + lbl_memmap...
a2516d28c86fd23efcb893e59de42b33526bfe6f
swig/tkgui.py
swig/tkgui.py
#!/usr/bin/env python import Tkinter import sys import mapper def on_gui_change(x): # print 'on_gui_change',x,x.__class__ sig_out.update_scalar(int(x)) def on_mapper_change(sig, x): # print 'on_mapper_change', x, x.__class__ w.set(int(x)) dev = mapper.device("tkgui", 9000) sig_in = mapper.signal(1, "...
Add a Python Tkinter example showing how to map a scale widget.
swig: Add a Python Tkinter example showing how to map a scale widget.
Python
lgpl-2.1
davidhernon/libmapper,johnty/libmapper,davidhernon/libmapper,radarsat1/libmapper,malloch/libmapper,malloch/libmapper,radarsat1/libmapper,libmapper/libmapper,radarsat1/libmapper,davidhernon/libmapper-admin2,johnty/libmapper,johnty/libmapper,malloch/libmapper,johnty/libmapper,radarsat1/libmapper,radarsat1/libmapper,libma...
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +import Tkinter +import sys +import mapper + +def on_gui_change(x): +# print 'on_gui_change',x,x.__class__ + sig_out.update_scalar(int(x)) + +def on_mapper_change(sig, x): +# print 'on_mapper_change', x, x.__class__ + w.set(int(x)) + +dev = mapper.device("...
4c3c9c6929ebc3f439ccf3bb7d3696f484b154bc
karspexet/ticket/migrations/0017_positive_integers_20180322_2056.py
karspexet/ticket/migrations/0017_positive_integers_20180322_2056.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2018-03-22 19:56 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ticket', '0016_add_voucher_note_20180213_2307'), ] op...
Add missing noop-migrations for PositiveIntegerField
Add missing noop-migrations for PositiveIntegerField
Python
mit
Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.1 on 2018-03-22 19:56 +from __future__ import unicode_literals + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ticket', '0016_add_vouc...
af508daaf016b824c7518a36f9b92f571f0f65af
nodeconductor/structure/management/commands/init_balance_history.py
nodeconductor/structure/management/commands/init_balance_history.py
from datetime import timedelta from django.core.management.base import BaseCommand from django.utils import timezone from nodeconductor.structure.models import BalanceHistory from nodeconductor.structure.models import Customer class Command(BaseCommand): help = """ Initialize demo records of balance history """...
Implement management command for creating demo records of balance history (NC-842)
Implement management command for creating demo records of balance history (NC-842)
Python
mit
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
--- +++ @@ -0,0 +1,21 @@ +from datetime import timedelta + +from django.core.management.base import BaseCommand +from django.utils import timezone + +from nodeconductor.structure.models import BalanceHistory +from nodeconductor.structure.models import Customer + + +class Command(BaseCommand): + help = """ Initiali...
1765ac3a12ea2a56b4e25e05cf1f1b531de5b2cf
pyexternal.py
pyexternal.py
#!/usr/bin/env python # Get External Temperature from OpenWeatherMap # External informations are : # - temperature # - humidity # - pressure # - precipitation volume (each 3h) import urllib.request import json import pyowm from datetime import datetime from pyserial import pySerial from imports.pyTemperature import p...
Add External Temperature Probe from OpenWeather
Add External Temperature Probe from OpenWeather
Python
mit
mattcongy/piprobe
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# Get External Temperature from OpenWeatherMap +# External informations are : +# - temperature +# - humidity +# - pressure +# - precipitation volume (each 3h) + +import urllib.request +import json +import pyowm +from datetime import datetime + +from pyserial import pyS...
decf4b1916a421fe996a31feb131b7ed9e4e3c36
numpy-benchmark-one.py
numpy-benchmark-one.py
import timeit normal_py_sec = timeit.timeit('sum (x*x for x in xrange(1000))',number = 10000) naive_np_sec = timeit.timeit('sum(na*na)',setup='import numpy as np; na=np.arange(1000)', number = 10000) good_np_sec = timeit.timeit('na.dot(na)',setup='import numpy as np; na=np.arange(1000)', number = 10000) print("Normal...
Add a simple benchmark script
Add a simple benchmark script
Python
unlicense
abhimanyuma/ml-with-py
--- +++ @@ -0,0 +1,11 @@ +import timeit + +normal_py_sec = timeit.timeit('sum (x*x for x in xrange(1000))',number = 10000) +naive_np_sec = timeit.timeit('sum(na*na)',setup='import numpy as np; na=np.arange(1000)', number = 10000) +good_np_sec = timeit.timeit('na.dot(na)',setup='import numpy as np; na=np.arange(1000)'...
98aee2af9aa3f7dcc75969f1ec3118c40539793e
pandoc-include-code.py
pandoc-include-code.py
#! /usr/bin/env python3 from sys import stdout, stderr, exit import json def walktransform(tree): if isinstance(tree, list): return [walktransform(subtree) for subtree in tree] elif not isinstance(tree, dict): exit('Unsupported AST node', type(tree)) elif i...
Add clone of Haskell version
pandoc-include-clone.py: Add clone of Haskell version This at least doesn't require linking against anything, waiting for a long compilation and installation with `cabal`, complaining about the Pandoc API version in the latest GitHub release as of this writing, or using up a gigabyte more disk space.
Python
isc
pilona/Utils,pilona/Utils,pilona/Utils
--- +++ @@ -0,0 +1,60 @@ +#! /usr/bin/env python3 + +from sys import stdout, stderr, exit +import json + + +def walktransform(tree): + if isinstance(tree, list): + return [walktransform(subtree) + for subtree + in tree] + elif not isinstance(tree, dict): + exit('Unsup...
70a6553d9323b3522e492c414b67e76111519368
scripts/data_download/school_census/create_all_files.py
scripts/data_download/school_census/create_all_files.py
import os import commands import time import logging import sys if len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']): print "ERROR! Use:\n python scripts/data_download/school_census/create_files.py en/pt output_path\n" exit() logging.basicConfig(filename=os.path.abspath(os.path.join(sys.argv[2],str(...
Add file to create all files to school census.
Add file to create all files to school census.
Python
mit
DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site
--- +++ @@ -0,0 +1,16 @@ +import os +import commands +import time +import logging +import sys + +if len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']): + print "ERROR! Use:\n python scripts/data_download/school_census/create_files.py en/pt output_path\n" + exit() + +logging.basicConfig(filename=os.path...
638ee09f0f2958a955fbad42368ffc6bb2a2688a
pipeline/scripts/bb_pipeline_api.py
pipeline/scripts/bb_pipeline_api.py
#!/usr/bin/env python3 from tempfile import NamedTemporaryFile import json from threading import Lock import numpy as np from flask import Flask, request from scipy.misc import imread from pipeline import Pipeline from pipeline.objects import Image, Candidates, Saliencies, IDs from pipeline.pipeline import get_auto_c...
Add minimal REST API script based on flask
Add minimal REST API script based on flask
Python
apache-2.0
BioroboticsLab/deeppipeline,BioroboticsLab/bb_pipeline,BioroboticsLab/deeppipeline
--- +++ @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +from tempfile import NamedTemporaryFile +import json +from threading import Lock + +import numpy as np +from flask import Flask, request +from scipy.misc import imread +from pipeline import Pipeline +from pipeline.objects import Image, Candidates, Saliencies, IDs +f...
70e14187ecd2567894e5e8183341a63835d6839c
data/pldm_variables.py
data/pldm_variables.py
#!/usr/bin/python r""" Contains PLDM-related constants. """ PLDM_TYPE_BASE = '00' PLDM_TYPE_PLATFORM = '02' PLDM_TYPE_BIOS = '03' PLDM_TYPE_OEM = '3F' PLDM_BASE_CMD = { 'GET_TID': '2', 'GET_PLDM_VERSION': '3', 'GET_PLDM_TYPES': '4', 'GET_PLDM_COMMANDS': '5'} PLDM_SUCCESS = '00' PLDM_ERROR = '01' PL...
Create pldm related specific constants file.
Create pldm related specific constants file. Change-Id: I3eda08d7ec1c0113931511f2d3539f2c658f7ad0 Signed-off-by: Sridevi Ramesh <cb5e1f81dd390dfc3a9afc08ab7298b7ab4296f5@in.ibm.com>
Python
apache-2.0
openbmc/openbmc-test-automation,openbmc/openbmc-test-automation
--- +++ @@ -0,0 +1,58 @@ +#!/usr/bin/python + +r""" +Contains PLDM-related constants. +""" + + +PLDM_TYPE_BASE = '00' +PLDM_TYPE_PLATFORM = '02' +PLDM_TYPE_BIOS = '03' +PLDM_TYPE_OEM = '3F' + +PLDM_BASE_CMD = { + 'GET_TID': '2', + 'GET_PLDM_VERSION': '3', + 'GET_PLDM_TYPES': '4', + 'GET_PLDM_COMMANDS': '5...
8b42b0825d5cbb6becef9669b43a2c8229ea8642
remove_unpaired_fasta_entries.py
remove_unpaired_fasta_entries.py
#!/usr/bin/env python """ Remove unpaired reads from a fasta file. This script can be used for the case that unpaired reads (e.g. as reads were removed during quality trimming) in a pair of fasta files from paired-end sequencing need to be removed. """ import argparse from Bio import SeqIO from Bio.SeqIO.FastaIO im...
Add script to remove unpaired fasta entries.
Add script to remove unpaired fasta entries.
Python
isc
konrad/kuf_bio_scripts
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +""" +Remove unpaired reads from a fasta file. + +This script can be used for the case that unpaired reads (e.g. as +reads were removed during quality trimming) in a pair of fasta files +from paired-end sequencing need to be removed. + +""" + +import argparse +from Bi...
ccbb7e11edc63a128b7006e015539fdabd8f3a7f
bitHopper/LongPoll.py
bitHopper/LongPoll.py
from gevent.event import AsyncResult _event = AsyncResult() def wait(): """ Gets the New Block work unit to send to clients """ return _event.get() def trigger(work): """ Call to trigger a LP """ old = self._event self._event = event.AsyncResult() old.set(work)
Set up frontend for longpolling
Set up frontend for longpolling
Python
mit
c00w/bitHopper,c00w/bitHopper
--- +++ @@ -0,0 +1,18 @@ +from gevent.event import AsyncResult + +_event = AsyncResult() + +def wait(): + """ + Gets the New Block work unit to send to clients + """ + return _event.get() + +def trigger(work): + """ + Call to trigger a LP + """ + + old = self._event + self._event = event.As...
324243dfd61afd8ce244a9a02ffc800c5c73ce55
charts/daniels_designing_great_beers/appendix_two_course_grind_potential_extract_modified.py
charts/daniels_designing_great_beers/appendix_two_course_grind_potential_extract_modified.py
from brew.utilities import sg_from_dry_basis """ Ray Daniels Designing Great Beers Appendix 2: Course Grind Potential Extract (modified) Notes: The chart appears to have been developed with the moisture content set to zero (0.0) and the Brew House Efficiency set to 100% (1.0). This is not typical and ...
Add modified chart with better values
Add modified chart with better values
Python
mit
chrisgilmerproj/brewday,chrisgilmerproj/brewday
--- +++ @@ -0,0 +1,50 @@ + +from brew.utilities import sg_from_dry_basis + + +""" +Ray Daniels +Designing Great Beers + +Appendix 2: Course Grind Potential Extract (modified) + +Notes: + The chart appears to have been developed with the moisture content set + to zero (0.0) and the Brew House Efficiency set to 1...
cb454d310431700e5ac9883a32f0b36e2e50e0fe
sensu/plugins/check-keystone-expired-tokens.py
sensu/plugins/check-keystone-expired-tokens.py
#!/opt/openstack/current/keystone/bin/python # # Copyright 2015, Jesse Keating <jlk@bluebox.net> # # 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...
Add a check for keystone expired tokens buildup.
Add a check for keystone expired tokens buildup. More than 1K is too many when cleaning every 5 minutes, so warn about it. The admin may have to go in and more aggressively clean or figure out why the cleaning isn't completing as expected. This uses a lot of keystone-manage code to interact with the database, and mon...
Python
apache-2.0
aacole/ursula-monitoring,sivakom/ursula-monitoring,sivakom/ursula-monitoring,blueboxgroup/ursula-monitoring,blueboxgroup/ursula-monitoring,sivakom/ursula-monitoring,aacole/ursula-monitoring,aacole/ursula-monitoring,aacole/ursula-monitoring,sivakom/ursula-monitoring,blueboxgroup/ursula-monitoring,blueboxgroup/ursula-mon...
--- +++ @@ -0,0 +1,86 @@ +#!/opt/openstack/current/keystone/bin/python +# +# Copyright 2015, Jesse Keating <jlk@bluebox.net> +# +# 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 +# +# ht...
ac40e54d22717fbf1a2444a67198cdba66506df8
cea/tests/test_inputs_setup_workflow.py
cea/tests/test_inputs_setup_workflow.py
import os import unittest import cea.config from cea.utilities import create_polygon from cea.datamanagement import zone_helper, surroundings_helper, terrain_helper, streets_helper, data_initializer, \ archetypes_mapper # Zug site coordinates POLYGON_COORDINATES = [(8.513465734818856, 47.178027239429234), (8.5154...
Add test for input setup workflow
Add test for input setup workflow
Python
mit
architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst
--- +++ @@ -0,0 +1,35 @@ +import os +import unittest + +import cea.config +from cea.utilities import create_polygon +from cea.datamanagement import zone_helper, surroundings_helper, terrain_helper, streets_helper, data_initializer, \ + archetypes_mapper + +# Zug site coordinates +POLYGON_COORDINATES = [(8.51346573...
582b5c598da5b35032447f0eb7888051b84f844c
alembic/versions/20860ffde766_add_datetime_to_fastcache.py
alembic/versions/20860ffde766_add_datetime_to_fastcache.py
"""Add datetime to fastcache Revision ID: 20860ffde766 Revises: 471e6f7722a7 Create Date: 2015-04-14 07:44:36.507406 """ # revision identifiers, used by Alembic. revision = '20860ffde766' down_revision = '471e6f7722a7' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated b...
Add datetime to fast cache
Add datetime to fast cache
Python
bsd-2-clause
porduna/appcomposer,morelab/appcomposer,porduna/appcomposer,morelab/appcomposer,morelab/appcomposer,go-lab/appcomposer,go-lab/appcomposer,porduna/appcomposer,morelab/appcomposer,porduna/appcomposer,go-lab/appcomposer,go-lab/appcomposer
--- +++ @@ -0,0 +1,28 @@ +"""Add datetime to fastcache + +Revision ID: 20860ffde766 +Revises: 471e6f7722a7 +Create Date: 2015-04-14 07:44:36.507406 + +""" + +# revision identifiers, used by Alembic. +revision = '20860ffde766' +down_revision = '471e6f7722a7' + +from alembic import op +import sqlalchemy as sa + + +def ...
65b362985d502440b12efc8a6a49ab0603354fd2
liwc_emotional_sentences.py
liwc_emotional_sentences.py
"""Count the numbers of annotated entities and emotional sentences in the corpus that was manually annotated. Usage: python annotation_statistics.py <dir containing the folia files with EmbodiedEmotions annotations> """ from lxml import etree from bs4 import BeautifulSoup from emotools.bs4_helpers import sentence, not...
Add script to count emotional sentences according to LIWC
Add script to count emotional sentences according to LIWC Added a script that counts the number of emotional sentences in titles in the corpus. A sentence is considered emotional if it contains at least one Posemo or Negemo term. The statistical results are written to standard out.
Python
apache-2.0
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
--- +++ @@ -0,0 +1,94 @@ +"""Count the numbers of annotated entities and emotional sentences in the +corpus that was manually annotated. + +Usage: python annotation_statistics.py <dir containing the folia files with +EmbodiedEmotions annotations> +""" +from lxml import etree +from bs4 import BeautifulSoup +from emoto...
cc89c5222ec7f6d6f95b5efdce3958b3ca33814e
mica/archive/tests/test_aca_dark_cal.py
mica/archive/tests/test_aca_dark_cal.py
""" Basic functionality and regression tests for ACA dark cal module. """ import numpy as np from ..aca_dark import dark_cal def test_date_to_dark_id(): assert dark_cal.date_to_dark_id('2011-01-15T12:00:00') == '2011015' def test_dark_id_to_date(): assert dark_cal.dark_id_to_date('2011015') == '2011:015' ...
Add basic functionality and regression tests for ACA dark cal module
Add basic functionality and regression tests for ACA dark cal module
Python
bsd-3-clause
sot/mica,sot/mica
--- +++ @@ -0,0 +1,47 @@ +""" +Basic functionality and regression tests for ACA dark cal module. +""" + +import numpy as np + +from ..aca_dark import dark_cal + + +def test_date_to_dark_id(): + assert dark_cal.date_to_dark_id('2011-01-15T12:00:00') == '2011015' + + +def test_dark_id_to_date(): + assert dark_cal...
5eefc407b8f51c017a3f4193c88f6dc188a88601
src/CLAHE_dir.py
src/CLAHE_dir.py
from PIL import Image import numpy as np import h5py import os import sys import cv2 # Maybe consider implemeting more involved auto-balancing # http://wiki.cmci.info/documents/120206pyip_cooking/python_imagej_cookbook#automatic_brightnesscontrast_button def apply_clahe_to_H5(fn, clahe): f = h5py.File(fn, "r+") img...
Include OpenCV based Python CLAHE script
Include OpenCV based Python CLAHE script
Python
mit
seung-lab/Julimaps,seung-lab/Julimaps
--- +++ @@ -0,0 +1,45 @@ +from PIL import Image +import numpy as np +import h5py +import os +import sys +import cv2 + +# Maybe consider implemeting more involved auto-balancing +# http://wiki.cmci.info/documents/120206pyip_cooking/python_imagej_cookbook#automatic_brightnesscontrast_button + +def apply_clahe_to_H5(fn,...
f0af14b8fcd420b63a47e18938664e14cf9ea968
subiquity/utils.py
subiquity/utils.py
# Copyright 2015 Canonical, Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
Add generic asynchronous/synchronous run command
Add generic asynchronous/synchronous run command Signed-off-by: Adam Stokes <0a364f4bf549cc82d725fa7fd7ed34404be64079@ubuntu.com>
Python
agpl-3.0
CanonicalLtd/subiquity,CanonicalLtd/subiquity
--- +++ @@ -0,0 +1,96 @@ +# Copyright 2015 Canonical, Ltd. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later versio...
5a21b66f7ab77f419245d8c07d7473a6e1600fc4
comics/crawler/crawlers/harkavagrant.py
comics/crawler/crawlers/harkavagrant.py
from comics.crawler.base import BaseComicCrawler from comics.crawler.meta import BaseComicMeta class ComicMeta(BaseComicMeta): name = 'Hark, A Vagrant!' language = 'en' url = 'http://www.harkavagrant.com/' start_date = '2008-05-01' history_capable_days = 120 schedule = 'Mo,Tu,We,Th,Fr,Sa,Su' ...
Add crawler for 'Hark, A Vagrant'
Add crawler for 'Hark, A Vagrant'
Python
agpl-3.0
jodal/comics,jodal/comics,klette/comics,datagutten/comics,datagutten/comics,datagutten/comics,klette/comics,klette/comics,jodal/comics,jodal/comics,datagutten/comics
--- +++ @@ -0,0 +1,27 @@ +from comics.crawler.base import BaseComicCrawler +from comics.crawler.meta import BaseComicMeta + +class ComicMeta(BaseComicMeta): + name = 'Hark, A Vagrant!' + language = 'en' + url = 'http://www.harkavagrant.com/' + start_date = '2008-05-01' + history_capable_days = 120 + ...
63143c94cef353d7bae13f7b13650801bb901c94
tests/unicode/unicode_pos.py
tests/unicode/unicode_pos.py
# str methods with explicit start/end pos print("Привет".startswith("П")) print("Привет".startswith("р", 1)) print("абвба".find("а", 1)) print("абвба".find("а", 1, -1))
Test for explicit start/end args to str methods for unicode.
tests: Test for explicit start/end args to str methods for unicode.
Python
mit
hiway/micropython,martinribelotta/micropython,tdautc19841202/micropython,supergis/micropython,torwag/micropython,pfalcon/micropython,galenhz/micropython,TDAbboud/micropython,kerneltask/micropython,heisewangluo/micropython,kerneltask/micropython,pozetroninc/micropython,ericsnowcurrently/micropython,ernesto-g/micropython...
--- +++ @@ -0,0 +1,5 @@ +# str methods with explicit start/end pos +print("Привет".startswith("П")) +print("Привет".startswith("р", 1)) +print("абвба".find("а", 1)) +print("абвба".find("а", 1, -1))
f6f75172b1b8a41fc5ae025416ea665258d4ff4c
favicon-update.py
favicon-update.py
from PIL import Image import requests from io import BytesIO # This whole script was done using Google and StackOverflow # How to generate ico files # https://stackoverflow.com/a/36168447/1697953 # How to get GitHub avatar location from username # https://stackoverflow.com/a/36380674/1697953 # How to read image data f...
Add script for updating favicon from gh avatar
Add script for updating favicon from gh avatar
Python
mit
Sorashi/sorashi.github.io
--- +++ @@ -0,0 +1,22 @@ +from PIL import Image +import requests +from io import BytesIO + +# This whole script was done using Google and StackOverflow +# How to generate ico files +# https://stackoverflow.com/a/36168447/1697953 +# How to get GitHub avatar location from username +# https://stackoverflow.com/a/3638067...
70d912bfb1ccec03edfe92b9b2c87610346c8f42
corehq/doctypemigrations/migrations/0006_domain_migration_20151118.py
corehq/doctypemigrations/migrations/0006_domain_migration_20151118.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from corehq.doctypemigrations.djangomigrations import assert_initial_complete from corehq.doctypemigrations.migrator_instances import domains_migration class Migration(migrations.Migration): dependencies = [ ...
Add blocking migration for new domain db
Add blocking migration for new domain db
Python
bsd-3-clause
dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations +from corehq.doctypemigrations.djangomigrations import assert_initial_complete +from corehq.doctypemigrations.migrator_instances import domains_migration + + +class Migration(migrations.Migra...
d0e5ea752912b10e473b2a05da9196800eb6ca86
examples/redis_lock.py
examples/redis_lock.py
import random from diesel import fork, quickstop, quickstart, sleep from diesel.protocols.redis import RedisClient, RedisTransactionError, RedisLock, LockNotAcquired """Implement the Redis INCR command using a lock. Obviously this is inefficient, but it's a good example of how to use the RedisLock class""" key = 't...
Add an example for the RedisLock
Add an example for the RedisLock
Python
bsd-3-clause
dieseldev/diesel
--- +++ @@ -0,0 +1,47 @@ +import random + +from diesel import fork, quickstop, quickstart, sleep +from diesel.protocols.redis import RedisClient, RedisTransactionError, RedisLock, LockNotAcquired + + +"""Implement the Redis INCR command using a lock. Obviously this is inefficient, but it's a good +example of how to u...
d0b8c68ae3c8acbc3d5dfe13842e3c41a198b978
fix_notions_db.py
fix_notions_db.py
from alignements_backend.db import DB from alignements_backend.notion import Notion for notion in DB.scan_iter(match='notion:*'): n = Notion(list(DB.sscan_iter(notion)))
Add script to fix all notions
Add script to fix all notions
Python
mit
l-vincent-l/alignements_backend
--- +++ @@ -0,0 +1,6 @@ +from alignements_backend.db import DB +from alignements_backend.notion import Notion + +for notion in DB.scan_iter(match='notion:*'): + n = Notion(list(DB.sscan_iter(notion))) +
550469032843eb2af3b4a9faaed34d9754f00700
geotrek/common/management/commands/test_managers_emails.py
geotrek/common/management/commands/test_managers_emails.py
from django.core.mail import mail_managers from django.core.management.base import BaseCommand class Command(BaseCommand): help = "Test if email settings are OK by sending mail to site managers" def execute(self, *args, **options): subject = u'Test email for managers' message = u'If you rece...
Add command to test managers emails
Add command to test managers emails
Python
bsd-2-clause
mabhub/Geotrek,camillemonchicourt/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,makinacorpus/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,Anaethelion/Geotrek,Anaethelion/Geotrek,camillemonchicourt/Geotrek,johan--/Geotrek,GeotrekCE/Geot...
--- +++ @@ -0,0 +1,13 @@ +from django.core.mail import mail_managers +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + help = "Test if email settings are OK by sending mail to site managers" + + def execute(self, *args, **options): + + subject = u'Test email for mana...
edb9500824faffd9f1d0d1b59ca29966e3b18282
modules/formatter_record.py
modules/formatter_record.py
from behave.formatter.json import PrettyJSONFormatter from pprint import pprint class RecordFormatter(PrettyJSONFormatter): name = "super" description = "Formatter for adding REST calls to JSON output." jsteps = {} # Contains an array of features, that contains array of steps in each feature # Overrid...
Customize behave formatter to output json
Customize behave formatter to output json
Python
mit
avidas/reliability-demo
--- +++ @@ -0,0 +1,64 @@ +from behave.formatter.json import PrettyJSONFormatter +from pprint import pprint + +class RecordFormatter(PrettyJSONFormatter): + name = "super" + description = "Formatter for adding REST calls to JSON output." + jsteps = {} # Contains an array of features, that contains array of st...
1f48fee7ffcef3eefa6aaedb5ca963c10bb7c58c
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/test_forms.py
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/test_forms.py
from django.test import TestCase from users.forms import ZionsUserCreationForm from users.models import User class {{cookiecutter.project_camel_name}}UserCreationTestCase(TestCase): def setUp(self): self.test_user = User.objects.create( username='testuser', email='test@test.com', ...
Add test case for user creation form
Add test case for user creation form
Python
bsd-3-clause
wldcordeiro/cookiecutter-django-essentials,wldcordeiro/cookiecutter-django-essentials,wldcordeiro/cookiecutter-django-essentials
--- +++ @@ -0,0 +1,31 @@ +from django.test import TestCase + +from users.forms import ZionsUserCreationForm +from users.models import User + + +class {{cookiecutter.project_camel_name}}UserCreationTestCase(TestCase): + def setUp(self): + self.test_user = User.objects.create( + username='testuser'...
4d85702561c000824083544de98693e244c8aab7
tests/test_decoding_stack.py
tests/test_decoding_stack.py
#! /usr/bin/env python from __future__ import division from timeside.decoder import FileDecoder from timeside.analyzer import AubioPitch from timeside.core import ProcessPipe import numpy as np from unit_timeside import * import os.path #from glib import GError as GST_IOError # HINT : to use later with Gnonlin only...
Add test for decoder stack
Add test for decoder stack
Python
agpl-3.0
Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide
--- +++ @@ -0,0 +1,88 @@ +#! /usr/bin/env python + +from __future__ import division + +from timeside.decoder import FileDecoder +from timeside.analyzer import AubioPitch +from timeside.core import ProcessPipe +import numpy as np +from unit_timeside import * + +import os.path + +#from glib import GError as GST_IOError...
84153b0be78998ab8ec6914df8623c99255457b5
locust/test/mock_locustfile.py
locust/test/mock_locustfile.py
import os import random import time from contextlib import contextmanager MOCK_LOUCSTFILE_CONTENT = ''' """This is a mock locust file for unit testing""" from locust import HttpLocust, TaskSet, task, between def index(l): l.client.get("/") def stats(l): l.client.get("/stats/requests") class UserTasks(T...
Improve code for creating temporary locustfiles that can be used in tests
Improve code for creating temporary locustfiles that can be used in tests
Python
mit
mbeacom/locust,locustio/locust,locustio/locust,mbeacom/locust,mbeacom/locust,locustio/locust,mbeacom/locust,locustio/locust
--- +++ @@ -0,0 +1,55 @@ +import os +import random +import time + +from contextlib import contextmanager + + +MOCK_LOUCSTFILE_CONTENT = ''' +"""This is a mock locust file for unit testing""" + +from locust import HttpLocust, TaskSet, task, between + + +def index(l): + l.client.get("/") + +def stats(l): + l.clie...
595c8fad76696240f96e61d9a2299de3d6cda16a
skcode/utility/walketree.py
skcode/utility/walketree.py
""" SkCode utility for walking across a document tree. """ def walk_tree_for_cls(tree_node, opts_cls): """ Walk the tree and yield any tree node matching the given options class. :param tree_node: The current tree node instance. :param opts_cls: The options class to search for. """ # Check th...
Add utility for walking etree and yielding nodes if options class type match.
Add utility for walking etree and yielding nodes if options class type match.
Python
agpl-3.0
TamiaLab/PySkCode
--- +++ @@ -0,0 +1,20 @@ +""" +SkCode utility for walking across a document tree. +""" + + +def walk_tree_for_cls(tree_node, opts_cls): + """ + Walk the tree and yield any tree node matching the given options class. + :param tree_node: The current tree node instance. + :param opts_cls: The options class t...
427a95f0c56facc138448cde7e7b9da1bcdc8ea4
add_example.py
add_example.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Unit Tests def test_add_zero(): assert 0 + 1 == 1 + 0 def test_add_single_digits(): assert 1 + 2 == 2 + 1 def test_add_double_digits(): assert 10 + 12 == 12 + 10 # Property-based Test from hypothesis import given import hypothesis.strategies as st @giv...
Add super basic Hypothesis example
Add super basic Hypothesis example
Python
mit
dkua/pyconca16-talk
--- +++ @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Unit Tests + +def test_add_zero(): + assert 0 + 1 == 1 + 0 + +def test_add_single_digits(): + assert 1 + 2 == 2 + 1 + +def test_add_double_digits(): + assert 10 + 12 == 12 + 10 + + +# Property-based Test + +from hypothesis import g...
21a504dce25a1b22bda27cd74a443af98b24ad14
filters/extract_urls.py
filters/extract_urls.py
import io import pypandoc import panflute def prepare(doc): doc.images = [] doc.links = [] def action(elem, doc): if isinstance(elem, panflute.Image): doc.images.append(elem) elif isinstance(elem, panflute.Link): doc.links.append(elem) if __name__ == '__main__': data = pyp...
Add pseudo filter combining pypandoc and panflute
Add pseudo filter combining pypandoc and panflute This is a prototype (filename is hardcoded) but should be easy to extend
Python
bsd-3-clause
sergiocorreia/panflute-filters
--- +++ @@ -0,0 +1,31 @@ +import io + +import pypandoc +import panflute + + +def prepare(doc): + doc.images = [] + doc.links = [] + + +def action(elem, doc): + if isinstance(elem, panflute.Image): + doc.images.append(elem) + elif isinstance(elem, panflute.Link): + doc.links.append(elem) + + +if __name__...
04287120372a6fdb906ed9f27ead4c5f91d5690e
tota/heroes/lenovo.py
tota/heroes/lenovo.py
from tota.utils import closest, distance, sort_by_distance, possible_moves from tota import settings __author__ = "angvp" def create(): def lenovo_hero_logic(self, things, t): # some useful data about the enemies I can see in the map enemy_team = settings.ENEMY_TEAMS[self.team] enemies =...
Add a modified version of simple bot
Add a modified version of simple bot
Python
mit
fisadev/tota
--- +++ @@ -0,0 +1,61 @@ +from tota.utils import closest, distance, sort_by_distance, possible_moves +from tota import settings + +__author__ = "angvp" + + +def create(): + + def lenovo_hero_logic(self, things, t): + # some useful data about the enemies I can see in the map + enemy_team = settings.EN...
6b4733c213046c7a16bf255cfbc92408e2f01423
tests/models/test_authenticated_registry_model.py
tests/models/test_authenticated_registry_model.py
import pytest from dockci.models.auth import AuthenticatedRegistry BASE_AUTHENTICATED_REGISTRY = dict( id=1, display_name='Display name', base_name='Base name', username='Username', password='Password', email='Email', insecure=False, ) class TestHash(object): """ Test ``Authenticate...
Add test for registry model hash
Add test for registry model hash
Python
isc
RickyCook/DockCI,sprucedev/DockCI-Agent,RickyCook/DockCI,sprucedev/DockCI,sprucedev/DockCI,sprucedev/DockCI,sprucedev/DockCI,sprucedev/DockCI-Agent,RickyCook/DockCI,RickyCook/DockCI
--- +++ @@ -0,0 +1,42 @@ +import pytest + +from dockci.models.auth import AuthenticatedRegistry + + +BASE_AUTHENTICATED_REGISTRY = dict( + id=1, + display_name='Display name', + base_name='Base name', + username='Username', + password='Password', + email='Email', + insecure=False, +) + + +class T...
d3d6a6018d55581bf081c93386f6676c8bb105ce
simulate.py
simulate.py
import genetic import sys output = sys.stdout def setOutput(out): output = out genetic.setOutput(output) # Test data for a XOR gate testData = ( (0.1, 0.1, 0.9), (0.1, 0.9, 0.9), (0.9, 0.1, 0.9), (0.9, 0.9, 0.1) ) def simulate(): sim = genetic.Simulation(2, 1, testData, 100) sim.simu...
Add module for running the main simulation
Add module for running the main simulation
Python
mit
JoshuaBrockschmidt/ideal_ANN
--- +++ @@ -0,0 +1,20 @@ +import genetic +import sys + +output = sys.stdout + +def setOutput(out): + output = out + genetic.setOutput(output) + +# Test data for a XOR gate +testData = ( + (0.1, 0.1, 0.9), + (0.1, 0.9, 0.9), + (0.9, 0.1, 0.9), + (0.9, 0.9, 0.1) +) + +def simulate(): + sim = geneti...
2cd1e7fcdf53c312c3db8e6f1d257084a87cccbb
recipe-server/normandy/recipes/migrations/0045_update_action_hashes.py
recipe-server/normandy/recipes/migrations/0045_update_action_hashes.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import hashlib from base64 import b64encode, urlsafe_b64encode from django.db import migrations def make_hashes_urlsafe_sri(apps, schema_editor): Action = apps.get_model('recipes', 'Action') for action in Action.objects.all(): data = a...
Add migration to update action implementation hashes.
Add migration to update action implementation hashes.
Python
mpl-2.0
mozilla/normandy,mozilla/normandy,mozilla/normandy,mozilla/normandy
--- +++ @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import hashlib +from base64 import b64encode, urlsafe_b64encode + +from django.db import migrations + + +def make_hashes_urlsafe_sri(apps, schema_editor): + Action = apps.get_model('recipes', 'Action') + + for action i...
8fa7120606e206d08acbad198e253ea428eef584
tests/compiler/test_inline_list_compilation.py
tests/compiler/test_inline_list_compilation.py
import pytest from tests.compiler import compile_snippet, internal_call, STATIC_START, LOCAL_START from thinglang.compiler.errors import NoMatchingOverload, InvalidReference from thinglang.compiler.opcodes import OpcodePopLocal, OpcodePushStatic def test_inline_list_compilation(): assert compile_snippet('list<...
Add tests for inline list compilation
Add tests for inline list compilation
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
--- +++ @@ -0,0 +1,34 @@ +import pytest + +from tests.compiler import compile_snippet, internal_call, STATIC_START, LOCAL_START +from thinglang.compiler.errors import NoMatchingOverload, InvalidReference +from thinglang.compiler.opcodes import OpcodePopLocal, OpcodePushStatic + + +def test_inline_list_compilation():...
3ddf0f0fead6018b5c313253a0df2165452cfb6e
src/eduid_common/api/translation.py
src/eduid_common/api/translation.py
# -*- coding: utf-8 -*- from flask import request from flask_babel import Babel __author__ = 'lundberg' def init_babel(app): babel = Babel(app) app.babel = babel @babel.localeselector def get_locale(): # if a user is logged in, use the locale from the user settings # XXX: TODO ...
Add shared babel init code
Add shared babel init code
Python
bsd-3-clause
SUNET/eduid-common
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +from flask import request +from flask_babel import Babel + +__author__ = 'lundberg' + + +def init_babel(app): + babel = Babel(app) + app.babel = babel + + @babel.localeselector + def get_locale(): + # if a user is logged in, use the locale from t...
30bca45e1ac9fc6953728950695135b491403215
tests/basics/logic_constfolding.py
tests/basics/logic_constfolding.py
# tests logical constant folding in parser def f_true(): print('f_true') return True def f_false(): print('f_false') return False print(0 or False) print(1 or foo) print(f_false() or 1 or foo) print(f_false() or 1 or f_true()) print(0 and foo) print(1 and True) print(f_true() and 0 and foo) print(f_...
Add test for logical constant folding.
tests/basics: Add test for logical constant folding.
Python
mit
mhoffma/micropython,blazewicz/micropython,tobbad/micropython,oopy/micropython,pozetroninc/micropython,swegener/micropython,tralamazza/micropython,tobbad/micropython,mhoffma/micropython,kerneltask/micropython,MrSurly/micropython,Peetz0r/micropython-esp32,tobbad/micropython,dmazzella/micropython,HenrikSolver/micropython,...
--- +++ @@ -0,0 +1,26 @@ +# tests logical constant folding in parser + +def f_true(): + print('f_true') + return True + +def f_false(): + print('f_false') + return False + +print(0 or False) +print(1 or foo) +print(f_false() or 1 or foo) +print(f_false() or 1 or f_true()) + +print(0 and foo) +print(1 and ...
be17cf90b06a118d579c0211dd3bc2d45433fb2d
tests/test_handle_long_response.py
tests/test_handle_long_response.py
import context class TestHandleLongResponse(context.slouch.testing.CommandTestCase): bot_class = context.TimerBot config = {'start_fmt': '{:%Y}', 'stop_fmt': '{.days}'} normal_text = "@genericmention: this is generic mention message contains a URL <http://foo.com/>\n@genericmention: this generic mention me...
Write unit tests for _handle_long_response
Write unit tests for _handle_long_response
Python
mit
venmo/slouch
--- +++ @@ -0,0 +1,46 @@ +import context + +class TestHandleLongResponse(context.slouch.testing.CommandTestCase): + bot_class = context.TimerBot + config = {'start_fmt': '{:%Y}', 'stop_fmt': '{.days}'} + normal_text = "@genericmention: this is generic mention message contains a URL <http://foo.com/>\n@generi...
063899021158fe872745b335595b3094db9834d8
pycket/test/test_version.py
pycket/test/test_version.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Test the version here. # import pytest from pycket.test.testhelper import check_equal EXPECTED_VERSION='6.1.1.8' def test_version(): check_equal('(version)', '"%s"' % EXPECTED_VERSION) # EOF
Add a test for 'version.
Add a test for 'version. ! needs updating with every nightly, currentl
Python
mit
samth/pycket,krono/pycket,vishesh/pycket,magnusmorton/pycket,vishesh/pycket,vishesh/pycket,magnusmorton/pycket,cderici/pycket,pycket/pycket,pycket/pycket,cderici/pycket,krono/pycket,magnusmorton/pycket,krono/pycket,pycket/pycket,cderici/pycket,samth/pycket,samth/pycket
--- +++ @@ -0,0 +1,16 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# +# Test the version here. +# + +import pytest +from pycket.test.testhelper import check_equal + +EXPECTED_VERSION='6.1.1.8' + + +def test_version(): + check_equal('(version)', '"%s"' % EXPECTED_VERSION) + +# EOF
fe37335645993ad10c9902aaaaf0ca2c53912d49
movies_avg_etl.py
movies_avg_etl.py
import pyspark spark = ( pyspark.sql.SparkSession.builder.appName("FromDatabase") .config("spark.driver.extraClassPath", "<driver_location>/postgresql-42.2.18.jar") .getOrCreate() ) # Read table from db using Spark JDBC def extract_movies_to_df(): movies_df = ( spark.read.format("jdbc") ...
Create Average Movies rating etl
Feat: Create Average Movies rating etl Extracts data from 2 tables in the database, transforms the data and writes the result into another table in the same database
Python
mit
searchs/bigdatabox,searchs/bigdatabox
--- +++ @@ -0,0 +1,66 @@ +import pyspark + +spark = ( + pyspark.sql.SparkSession.builder.appName("FromDatabase") + .config("spark.driver.extraClassPath", "<driver_location>/postgresql-42.2.18.jar") + .getOrCreate() +) + + +# Read table from db using Spark JDBC +def extract_movies_to_df(): + movies_df = ( ...
7d198f3eaca6a91b731b3e25c0285cd46e72935a
swh/web/common/migrations/0005_remove_duplicated_authorized_origins.py
swh/web/common/migrations/0005_remove_duplicated_authorized_origins.py
# Copyright (C) 2019 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information from __future__ import unicode_literals from django.db import mig...
Remove duplicates in authorized origins table
common/migrations: Remove duplicates in authorized origins table
Python
agpl-3.0
SoftwareHeritage/swh-web-ui,SoftwareHeritage/swh-web-ui,SoftwareHeritage/swh-web-ui
--- +++ @@ -0,0 +1,28 @@ +# Copyright (C) 2019 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU Affero General Public License version 3, or any later version +# See top-level LICENSE file for more information + +from __future__ import unicode_li...
91541cf82f435cb261d9debc85a2a8ae6dd74ab1
xutils/init_logging.py
xutils/init_logging.py
# encoding: utf-8 from __future__ import print_function, absolute_import, unicode_literals, division import logging def init_logging(logger=None, level="DEBUG", log_file="", file_config=None, dict_config=None): # Initialize the argument logger with the arguments, level and log_file. if logger: fmt = "...
Add a function to initialize the logging.
Add a function to initialize the logging.
Python
mit
xgfone/xutils,xgfone/pycom
--- +++ @@ -0,0 +1,32 @@ +# encoding: utf-8 +from __future__ import print_function, absolute_import, unicode_literals, division +import logging + + +def init_logging(logger=None, level="DEBUG", log_file="", file_config=None, dict_config=None): + # Initialize the argument logger with the arguments, level and log_fi...
507e3bad4e877330eea29675dafb8210ab6bada5
tests/test_agent.py
tests/test_agent.py
""" Tests for a agent. """ import io import os import pytest from onirim import action from onirim import agent from onirim import component def file_agent(in_str): return agent.File(io.StringIO(in_str), open(os.devnull, "w")) def content(): return component.Content([]) @pytest.mark.parametrize( "in_...
Add tests for file agent
Add tests for file agent
Python
mit
cwahbong/onirim-py
--- +++ @@ -0,0 +1,65 @@ +""" +Tests for a agent. +""" + +import io +import os + +import pytest + +from onirim import action +from onirim import agent +from onirim import component + +def file_agent(in_str): + return agent.File(io.StringIO(in_str), open(os.devnull, "w")) + +def content(): + return component.Con...
c67e1af4f765f143cb1b8420e053c1a9f00edd05
course_discovery/apps/course_metadata/migrations/0168_auto_20190404_1733.py
course_discovery/apps/course_metadata/migrations/0168_auto_20190404_1733.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-04-04 17:33 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.manager import djchoices.choices class Migration(migrations.Migration): dependencies = [ ('course_metadata', '0167_auto_20190...
Add migrations for new statuses.
Add migrations for new statuses.
Python
agpl-3.0
edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery
--- +++ @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2019-04-04 17:33 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.manager +import djchoices.choices + + +class Migration(migrations.Migration): + + dependencies = [ + ...
d308874989667f36da1638f22d6b2d7e823b5ebd
extract-barcode.py
extract-barcode.py
""" code to extract a single cell from a set of alignments or reads marked via Valentine's umis repository: https://github.com/vals/umis """ import regex as re import sys from argparse import ArgumentParser from pysam import AlignmentFile def extract_barcode(sam, barcode): parser_re = re.compile('.*:CELL_(?P<CB>...
Add script to extract reads or alignments matching a barcode.
Add script to extract reads or alignments matching a barcode.
Python
mit
roryk/junkdrawer,roryk/junkdrawer
--- +++ @@ -0,0 +1,50 @@ +""" +code to extract a single cell from a set of alignments or reads marked via Valentine's umis +repository: +https://github.com/vals/umis +""" +import regex as re +import sys +from argparse import ArgumentParser +from pysam import AlignmentFile + +def extract_barcode(sam, barcode): + + ...
048d0d7ce30b66af8bf48bcb0cb7f8bfb90fff0c
tests/test_iters.py
tests/test_iters.py
import pytest from skidl import * from .setup_teardown import * def test_iters_1(): """Test bus iterator.""" b_size = 4 b = Bus('chplx', b_size) for hi in b: for lo in b: if hi != lo: led = Part('device','LED') hi += led['A'] lo += led...
Add tests for Part, Pin, Bus and Net iterators.
Add tests for Part, Pin, Bus and Net iterators.
Python
mit
xesscorp/skidl,xesscorp/skidl
--- +++ @@ -0,0 +1,38 @@ +import pytest +from skidl import * +from .setup_teardown import * + +def test_iters_1(): + """Test bus iterator.""" + b_size = 4 + b = Bus('chplx', b_size) + for hi in b: + for lo in b: + if hi != lo: + led = Part('device','LED') + ...
3d027df005725cbc5dfbba0262b0c52c5392d7f0
app/resources/check_token.py
app/resources/check_token.py
from flask import make_response, jsonify from flask_restful import Resource, reqparse, marshal, fields from app.models import User from app.common.auth.token import JWT user_fields = { "id": fields.Integer, "username": fields.String, "created_at": fields.DateTime } class WhoAmIResource(Resource): """...
Add whoami resource which decodes token and returns user info from token
[CHORE] Add whoami resource which decodes token and returns user info from token
Python
mit
brayoh/bucket-list-api
--- +++ @@ -0,0 +1,37 @@ +from flask import make_response, jsonify +from flask_restful import Resource, reqparse, marshal, fields +from app.models import User +from app.common.auth.token import JWT + +user_fields = { + "id": fields.Integer, + "username": fields.String, + "created_at": fields.DateTime +} + +...
f34dabd23faa7d50e507b829e576c1968bdc2d52
src/iterations/exercise3.py
src/iterations/exercise3.py
# Print The Message "Happy new Year" followed by the name of a person # taken from a list for all people mentioned in the list. def print_Happy_New_Year_to( listOfPeople ): for user in listOfPeople: print 'Happy New Year, ', user print 'Done!' def main( ): listOfPeople=['John', 'Mary', 'Luke'] print_Happy_N...
Print The Message Happy New Year
Print The Message Happy New Year #Print The Message "Happy new Year" followed by the name of a person taken from a list for all people mentioned in the list.
Python
mit
let42/python-course
--- +++ @@ -0,0 +1,17 @@ +# Print The Message "Happy new Year" followed by the name of a person +# taken from a list for all people mentioned in the list. + +def print_Happy_New_Year_to( listOfPeople ): + + for user in listOfPeople: + print 'Happy New Year, ', user + + print 'Done!' + +def main( ): + + listOfPeople...
ce28c5642c3ab543fc48e2f4f1f0b2f2a62890a2
src/misc/parse_tool_playbook_yaml.py
src/misc/parse_tool_playbook_yaml.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import argparse import re import yaml def get_revision_number(yaml_content, tool_name): for tool in yaml_content['tools']: if tool["name"] == tool_name: if tool.has_key("revision"): print tool["revision"][0] de...
Add script to extract information for playbook files
Add script to extract information for playbook files
Python
apache-2.0
ASaiM/framework,ASaiM/framework
--- +++ @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +import os +import argparse +import re +import yaml + +def get_revision_number(yaml_content, tool_name): + for tool in yaml_content['tools']: + if tool["name"] == tool_name: + if tool.has_key("revision"): + ...
24c763ead7af8a669ff1055b3f352f513274a47f
all-domains/data-structures/linked-lists/insert-a-node-at-a-specific-positin-in-a-linked-list/solution.py
all-domains/data-structures/linked-lists/insert-a-node-at-a-specific-positin-in-a-linked-list/solution.py
# https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list # Python 2 """ Insert Node at a specific position in a linked list head input could be None as well for empty list Node is defined as class Node(object): def __init__(self, data=None, next_node=None): self.dat...
Insert a note at a specific position in a linked list
Insert a note at a specific position in a linked list
Python
mit
arvinsim/hackerrank-solutions
--- +++ @@ -0,0 +1,59 @@ +# https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list +# Python 2 + +""" + Insert Node at a specific position in a linked list + head input could be None as well for empty list + Node is defined as + + class Node(object): + + def __init__(self, data=...
c9e90ef5413bd560422e915d213df73ad88dffd7
tests/integration/test_apigateway.py
tests/integration/test_apigateway.py
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
Add apigateway integration test for PutIntegration
Add apigateway integration test for PutIntegration
Python
apache-2.0
boto/botocore,pplu/botocore
--- +++ @@ -0,0 +1,53 @@ +# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +#...
98c1ff71d57749168f0ca35d97dbe77a8a67e082
mltils/xgboost/utils.py
mltils/xgboost/utils.py
xgb_to_sklearn = { 'eta': 'learning_rate', 'num_boost_round': 'n_estimators', 'alpha': 'reg_alpha', 'lambda': 'reg_lambda', 'seed': 'random_state', } def to_sklearn_api(params): return { xgb_to_sklearn.get(key, key): value for key, value in params.items() }
Add module for utilities related to xgboost
Add module for utilities related to xgboost
Python
mit
rladeira/mltils
--- +++ @@ -0,0 +1,14 @@ + +xgb_to_sklearn = { + 'eta': 'learning_rate', + 'num_boost_round': 'n_estimators', + 'alpha': 'reg_alpha', + 'lambda': 'reg_lambda', + 'seed': 'random_state', +} + +def to_sklearn_api(params): + return { + xgb_to_sklearn.get(key, key): value + for key, value ...
ecc8a93ddda784102311ebfd4c3c93624f356778
cnxarchive/sql/migrations/20160723123620_add_sql_function_strip_html.py
cnxarchive/sql/migrations/20160723123620_add_sql_function_strip_html.py
# -*- coding: utf-8 -*- def up(cursor): cursor.execute("""\ CREATE OR REPLACE FUNCTION strip_html(html_text TEXT) RETURNS text AS $$ import re return re.sub('<[^>]*?>', '', html_text, re.MULTILINE) $$ LANGUAGE plpythonu IMMUTABLE; """) def down(cursor): cursor.execute("DROP FUNCTION IF EXISTS stri...
Add migration to add strip_html sql function
Add migration to add strip_html sql function Used for stripping html from modules.name (title)
Python
agpl-3.0
Connexions/cnx-archive,Connexions/cnx-archive
--- +++ @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + + +def up(cursor): + cursor.execute("""\ +CREATE OR REPLACE FUNCTION strip_html(html_text TEXT) + RETURNS text +AS $$ + import re + return re.sub('<[^>]*?>', '', html_text, re.MULTILINE) +$$ LANGUAGE plpythonu IMMUTABLE; + """) + + +def down(cursor): + c...
62c70b301ffc1e178c3bd54bd81291876b3883ea
analysis/03-fill-dropouts-linear.py
analysis/03-fill-dropouts-linear.py
#!/usr/bin/env python from __future__ import division import climate import lmj.cubes import lmj.cubes.fill import numpy as np import pandas as pd logging = climate.get_logger('fill') def fill(dfs, window): '''Complete missing marker data using linear interpolation. This method alters the given `dfs` in-pl...
Add simple linear interpolation filling.
Add simple linear interpolation filling.
Python
mit
lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment
--- +++ @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +from __future__ import division + +import climate +import lmj.cubes +import lmj.cubes.fill +import numpy as np +import pandas as pd + +logging = climate.get_logger('fill') + +def fill(dfs, window): + '''Complete missing marker data using linear interpolation. + + ...
55f2325354724cfe8b90324038daf2c1acaa916a
teuthology/openstack/test/test_config.py
teuthology/openstack/test/test_config.py
from teuthology.config import config class TestOpenStack(object): def setup(self): self.openstack_config = config['openstack'] def test_config_clone(self): assert 'clone' in self.openstack_config def test_config_user_data(self): os_type = 'rhel' os_version = '7.0' ...
Add unit tests for OpenStack config defaults
Add unit tests for OpenStack config defaults Signed-off-by: Zack Cerza <d7cdf09fc0f0426e98c9978ee42da5d61fa54986@redhat.com>
Python
mit
SUSE/teuthology,dmick/teuthology,ceph/teuthology,SUSE/teuthology,dmick/teuthology,robbat2/teuthology,ktdreyer/teuthology,dmick/teuthology,caibo2014/teuthology,robbat2/teuthology,ktdreyer/teuthology,dreamhost/teuthology,SUSE/teuthology,caibo2014/teuthology,ceph/teuthology,dreamhost/teuthology
--- +++ @@ -0,0 +1,35 @@ +from teuthology.config import config + + +class TestOpenStack(object): + + def setup(self): + self.openstack_config = config['openstack'] + + def test_config_clone(self): + assert 'clone' in self.openstack_config + + def test_config_user_data(self): + os_type = ...
67f5e754a5f90903e09a6a876d858d002c513f8a
abcpy/posteriors.py
abcpy/posteriors.py
import scipy as sp from .utils import stochastic_optimization class BolfiPosterior(): def __init__(self, model, threshold, priors=None): self.threshold = threshold self.model = model self.priors = [None] * model.n_var self.ML, ML_val = stochastic_optimization(self._neg_unnormalize...
Add initial draft of posterior models
Add initial draft of posterior models
Python
bsd-3-clause
lintusj1/elfi,lintusj1/elfi,elfi-dev/elfi,HIIT/elfi,elfi-dev/elfi
--- +++ @@ -0,0 +1,49 @@ +import scipy as sp + +from .utils import stochastic_optimization + +class BolfiPosterior(): + + def __init__(self, model, threshold, priors=None): + self.threshold = threshold + self.model = model + self.priors = [None] * model.n_var + self.ML, ML_val = stochas...
b7dd7f75f655f4fbcb34d8f9ec260a6f18e8f617
backend/scripts/adminuser.py
backend/scripts/adminuser.py
#!/usr/bin/env python import rethinkdb as r from optparse import OptionParser import sys def create_group(conn): group = {} group['name'] = "Admin Group" group['description'] = "Administration Group for Materials Commons" group['id'] = 'admin' group['owner'] = 'admin@materialscommons.org' grou...
Add utility to create administrative users.
Add utility to create administrative users.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/env python +import rethinkdb as r +from optparse import OptionParser +import sys + + +def create_group(conn): + group = {} + group['name'] = "Admin Group" + group['description'] = "Administration Group for Materials Commons" + group['id'] = 'admin' + group['owner'] ...
0c17398f68597eae175ad6a37945cf37e95e1809
nodeconductor/structure/migrations/0050_reset_cloud_spl_quota_limits.py
nodeconductor/structure/migrations/0050_reset_cloud_spl_quota_limits.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.contenttypes import models as ct_models from django.db import migrations, models from nodeconductor.quotas.models import Quota from nodeconductor.structure.models import CloudServiceProjectLink def reset_cloud_spl_quota_limits(apps,...
Reset invalid default quotas for CloudServiceProjectLink
Reset invalid default quotas for CloudServiceProjectLink [WAL-814]
Python
mit
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
--- +++ @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.contrib.contenttypes import models as ct_models +from django.db import migrations, models + +from nodeconductor.quotas.models import Quota +from nodeconductor.structure.models import CloudServiceProjectLink + + +...
15d3692aee84432b6b7f8306505b3f59649fd6f9
cnxarchive/sql/migrations/20160128111115_mimetype_removal_from_module_files.py
cnxarchive/sql/migrations/20160128111115_mimetype_removal_from_module_files.py
# -*- coding: utf-8 -*- """\ - Move the mimetype value from ``module_files`` to ``files``. - Remove the ``mimetype`` column from the ``module_files`` table. """ from __future__ import print_function import sys def up(cursor): # Move the mimetype value from ``module_files`` to ``files``. cursor.execute("UPDAT...
Remove mimetype from the module_files table
Remove mimetype from the module_files table
Python
agpl-3.0
Connexions/cnx-archive,Connexions/cnx-archive
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +"""\ +- Move the mimetype value from ``module_files`` to ``files``. +- Remove the ``mimetype`` column from the ``module_files`` table. + +""" +from __future__ import print_function +import sys + + +def up(cursor): + # Move the mimetype value from ``module_files`` ...
abe40e3c82ef1f351275a59b2e537f43530caa0c
app/cleanup_stories.py
app/cleanup_stories.py
from pymongo import MongoClient from fetch_stories import get_mongo_client, close_mongo_client from bson import ObjectId from datetime import datetime, timedelta def remove_old_stories(): client = get_mongo_client() db = client.get_default_database() article_collection = db['articles'] two_days_ag...
Clean up db script (remove articles older than two days).
Clean up db script (remove articles older than two days).
Python
mit
hw3jung/Gucci,hw3jung/Gucci
--- +++ @@ -0,0 +1,25 @@ +from pymongo import MongoClient +from fetch_stories import get_mongo_client, close_mongo_client +from bson import ObjectId +from datetime import datetime, timedelta + +def remove_old_stories(): + client = get_mongo_client() + db = client.get_default_database() + article_collecti...
372f4a988411e48a0c50cdc74fb2a7f4e5abf052
tests/server-identity.py
tests/server-identity.py
import nose import requests import fixture @nose.with_setup(fixture.start_tangelo, fixture.stop_tangelo) def test_server_identity(): response = requests.get(fixture.url("/")) assert response.headers["server"] == "Tangelo"
Add a server identity test
Add a server identity test
Python
apache-2.0
Kitware/tangelo,Kitware/tangelo,Kitware/tangelo
--- +++ @@ -0,0 +1,10 @@ +import nose +import requests + +import fixture + + +@nose.with_setup(fixture.start_tangelo, fixture.stop_tangelo) +def test_server_identity(): + response = requests.get(fixture.url("/")) + assert response.headers["server"] == "Tangelo"
19db4647257617992e9b195828baf39907cc5db1
tests/test_exit_codes.py
tests/test_exit_codes.py
"""Check that the CLI returns the appropriate exit code.""" import subprocess def test_exit_code_demo(): """Ensure that linting the demo returns an exit code of 1.""" try: subprocess.check_output("proselint --demo", shell=True) except subprocess.CalledProcessError as grepexc: assert(grep...
Add tests for exit codes
Add tests for exit codes
Python
bsd-3-clause
amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint
--- +++ @@ -0,0 +1,21 @@ +"""Check that the CLI returns the appropriate exit code.""" + +import subprocess + + +def test_exit_code_demo(): + """Ensure that linting the demo returns an exit code of 1.""" + try: + subprocess.check_output("proselint --demo", shell=True) + + except subprocess.CalledProces...