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
89249f0b6663745172a6842291ffed9805f07f83
test/test_Table_class.py
test/test_Table_class.py
#!/usr/bin/env python # ScraperWiki Limited # Ian Hopkinson, 2013-07-30 # -*- coding: utf-8 -*- """ Tests the Table class which contains metadata """ import sys sys.path.append('code') from pdftables import get_tables from nose.tools import * def test_it_includes_page_numbers(): fh = open('fixtures/sample_data/...
Test for adding page numbers using Table class
Test for adding page numbers using Table class
Python
bsd-2-clause
davidastephens/pdftables,okfn/pdftables,okfn/pdftables,davidastephens/pdftables
--- +++ @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# ScraperWiki Limited +# Ian Hopkinson, 2013-07-30 +# -*- coding: utf-8 -*- + +""" +Tests the Table class which contains metadata +""" +import sys +sys.path.append('code') + +from pdftables import get_tables + +from nose.tools import * + +def test_it_includes_page_numb...
2291964afbbb8f2d896bb069bb37f24afc2fb081
snippet_parser/cs.py
snippet_parser/cs.py
from base import * class SnippetParser(SnippetParserBase): def strip_template(self, template, normalize, collapse): if self.is_citation_needed(template): # These templates often contain other information # (date/justification), so we drop it all here return CITATION_NEED...
Drop dates and comments from Czech templates.
Drop dates and comments from Czech templates.
Python
mit
Stryn/citationhunt,Stryn/citationhunt,Stryn/citationhunt,jhsoby/citationhunt,jhsoby/citationhunt,jhsoby/citationhunt,jhsoby/citationhunt,Stryn/citationhunt
--- +++ @@ -0,0 +1,9 @@ +from base import * + +class SnippetParser(SnippetParserBase): + def strip_template(self, template, normalize, collapse): + if self.is_citation_needed(template): + # These templates often contain other information + # (date/justification), so we drop it all here...
68d4b700fe1ba8e0e7324a32821e31cdc899a66f
scriptserver.py
scriptserver.py
#!/usr/bin/env python '''ZoneScriptServer A server that runs scripts for all the objects in a zone. ''' import threading from threading import Timer import sched, time s = sched.scheduler(time.time, time.sleep) from settings import CLIENT_UPDATE_FREQ class ZoneScriptRunner(object): '''This is a class that holds...
Add a rudimentary script server. Does nothing at the moment.
Add a rudimentary script server. Does nothing at the moment.
Python
agpl-3.0
cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO
--- +++ @@ -0,0 +1,82 @@ +#!/usr/bin/env python +'''ZoneScriptServer +A server that runs scripts for all the objects in a zone. +''' + +import threading +from threading import Timer + +import sched, time +s = sched.scheduler(time.time, time.sleep) + +from settings import CLIENT_UPDATE_FREQ + +class ZoneScriptRunner(o...
dfc51c72149f437d8e3f0064d2b8da65adb0ee49
migrations/versions/201608231135_5596683819c9_enable_abstract_feature_for_conferences.py
migrations/versions/201608231135_5596683819c9_enable_abstract_feature_for_conferences.py
"""Enable abstract feature for conferences Revision ID: 5596683819c9 Revises: ccd9d0858ff Create Date: 2016-08-23 11:35:26.018462 """ import json import sqlalchemy as sa from alembic import context, op # revision identifiers, used by Alembic. revision = '5596683819c9' down_revision = 'ccd9d0858ff' _update_setting...
Add alembic revision to enable abstract feature
Add alembic revision to enable abstract feature
Python
mit
DirkHoffmann/indico,pferreir/indico,OmeGak/indico,mvidalgarcia/indico,mic4ael/indico,DirkHoffmann/indico,DirkHoffmann/indico,pferreir/indico,mvidalgarcia/indico,indico/indico,ThiefMaster/indico,mvidalgarcia/indico,pferreir/indico,OmeGak/indico,pferreir/indico,DirkHoffmann/indico,ThiefMaster/indico,OmeGak/indico,mic4ael...
--- +++ @@ -0,0 +1,63 @@ +"""Enable abstract feature for conferences + +Revision ID: 5596683819c9 +Revises: ccd9d0858ff +Create Date: 2016-08-23 11:35:26.018462 +""" + +import json + +import sqlalchemy as sa +from alembic import context, op + + +# revision identifiers, used by Alembic. +revision = '5596683819c9' +dow...
0bad9bbe99296044a631780d76e390f009cb977a
setup.py
setup.py
#!/usr/bin/env python """Setup script for the kconfiglib module.""" from distutils.core import setup setup (# Distribution meta-data name = "kconfiglib", version = "0.0.1", description = "A flexible Python Kconfig parser", author = "Ulfalizer Magnusson", author_email = "kconfiglib@...
Add dist-utils support for gentoo ebuild
Add dist-utils support for gentoo ebuild
Python
isc
ulfalizer/Kconfiglib,ulfalizer/Kconfiglib
--- +++ @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +"""Setup script for the kconfiglib module.""" + +from distutils.core import setup + +setup (# Distribution meta-data + name = "kconfiglib", + version = "0.0.1", + description = "A flexible Python Kconfig parser", + author = "Ulfalizer Magnusso...
74e6406b8a7e04b5092d5673e9911b89b0861bc1
sk_lr.py
sk_lr.py
import numpy as np import pylab as pl import feature_extractor as fe from sklearn import linear_model (features, targets) = fe.extract_train() (features_test, targets_test) = fe.extract_test() classifier = linear_model.LogisticRegression(C = 1e5, tol = 0.0001) classifier.fit(features, targets) target_test_hat = clas...
Implement first version of LR classifier
Implement first version of LR classifier
Python
mit
trein/quora-classifier
--- +++ @@ -0,0 +1,16 @@ +import numpy as np +import pylab as pl +import feature_extractor as fe +from sklearn import linear_model + +(features, targets) = fe.extract_train() +(features_test, targets_test) = fe.extract_test() + +classifier = linear_model.LogisticRegression(C = 1e5, tol = 0.0001) +classifier.fit(featu...
65af5543d02ccbfb04a3137a03ed0ff3874bc0ca
app/migrations/versions/4673b3fa0d68_.py
app/migrations/versions/4673b3fa0d68_.py
"""Add geom field to zones to hold regions. Revision ID: 4673b3fa0d68 Revises: 4ef20b76cab1 Create Date: 2015-02-11 21:12:26.578588 """ # revision identifiers, used by Alembic. revision = '4673b3fa0d68' down_revision = '4ef20b76cab1' from alembic import op import sqlalchemy as sa import geoalchemy2 as geo def upg...
Add geography column to zones.
Add geography column to zones.
Python
mit
openchattanooga/cpd-zones-old,openchattanooga/cpd-zones-old
--- +++ @@ -0,0 +1,23 @@ +"""Add geom field to zones to hold regions. + +Revision ID: 4673b3fa0d68 +Revises: 4ef20b76cab1 +Create Date: 2015-02-11 21:12:26.578588 + +""" + +# revision identifiers, used by Alembic. +revision = '4673b3fa0d68' +down_revision = '4ef20b76cab1' + +from alembic import op +import sqlalchemy ...
13619ef1404ca88ba08e74e0aa2cfa7d418c4c6b
tests/rules_tests/grammarManipulation_tests/InactiveRulesTest.py
tests/rules_tests/grammarManipulation_tests/InactiveRulesTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import Grammar, Nonterminal, Rule as _R from ..grammar import * class InactiveRulesTest(TestCase): def __init__(self, *args): super().__init__(*...
Add file for inactive rules tests
Add file for inactive rules tests
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,28 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 23.06.2017 16:39 +:Licence GNUv3 +Part of grammpy + +""" + +from unittest import main, TestCase +from grammpy import Grammar, Nonterminal, Rule as _R +from ..grammar import * + + +class InactiveRulesTest(TestCase): + def __init...
4e1985a0f69da6b8e2261795d2d710d86382596a
create_ands_rif_cs_xml.py
create_ands_rif_cs_xml.py
""" Create an ANDS RIF-CS XML file. Links ----- - http://ands.org.au/guides/cpguide/cpgrifcs.html - http://services.ands.org.au/documentation/rifcs/guidelines/rif-cs.html - http://www.ands.org.au/resource/rif-cs.html """ import logging import os from settings import ( ANDS_XML_FILE_NAME, ANDS_XML_FOLDER_PATH, AN...
Add ANDS RIF-CS conversion script
Add ANDS RIF-CS conversion script
Python
mit
AustralianAntarcticDataCentre/metadata_xml_convert,AustralianAntarcticDataCentre/metadata_xml_convert
--- +++ @@ -0,0 +1,39 @@ +""" +Create an ANDS RIF-CS XML file. + +Links +----- + +- http://ands.org.au/guides/cpguide/cpgrifcs.html + +- http://services.ands.org.au/documentation/rifcs/guidelines/rif-cs.html + +- http://www.ands.org.au/resource/rif-cs.html +""" + +import logging +import os + +from settings import ( +...
fa6b42061c4aaa9354922c6942511892f3ff6386
extra/update_comments_from_spec.py
extra/update_comments_from_spec.py
import sys, os import re default_source_file = os.path.join(os.path.dirname(__file__), '../amqp/channel.py') def update_comments(comments_file, impl_file, result_file): text_file = open(impl_file, 'r') source = text_file.read() comments = get_comments(comments_file) for def_name, comment in com...
Add a script for updating comments(in methods). The script is used to sync the channnel.py comments with the AMQP spec.
Add a script for updating comments(in methods). The script is used to sync the channnel.py comments with the AMQP spec.
Python
lgpl-2.1
dims/py-amqp,yetone/py-amqp,yetone/py-amqp,jonahbull/py-amqp,dallasmarlow/py-amqp,smurfix/aio-py-amqp,dims/py-amqp,dallasmarlow/py-amqp,smurfix/aio-py-amqp,jonahbull/py-amqp
--- +++ @@ -0,0 +1,53 @@ +import sys, os +import re + +default_source_file = os.path.join(os.path.dirname(__file__), '../amqp/channel.py') + +def update_comments(comments_file, impl_file, result_file): + text_file = open(impl_file, 'r') + source = text_file.read() + + comments = get_comments(comments_f...
e81e36304412e5cd86d91e3f79a17b845ec7a90d
django/neverlate/tasks.py
django/neverlate/tasks.py
from __future__ import absolute_import from celery import shared_task from calparser.tasks import parse_ical_from_url from calparser.models import CalendarEntry from django.contrib.auth.models import User @shared_task def reload_all_user_calendars(): """Reload calendars for all users using Celery""" for use...
Integrate calparser app with neverlate
Integrate calparser app with neverlate
Python
mit
myrjola/neverlate,myrjola/neverlate,myrjola/neverlate,myrjola/neverlate
--- +++ @@ -0,0 +1,23 @@ +from __future__ import absolute_import + +from celery import shared_task + +from calparser.tasks import parse_ical_from_url +from calparser.models import CalendarEntry +from django.contrib.auth.models import User + + +@shared_task +def reload_all_user_calendars(): + """Reload calendars fo...
8da10de91645206c6e47afbc7a955f5d69efa552
tests/font/BULLET.py
tests/font/BULLET.py
#!/usr/bin/env python '''Test that font.Text horizontal alignment works. Three labels will be rendered aligned left, center and right. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: $' import unittest from pyglet import font import base_text class TEST_HALIGN(base_text.TextTestBase): font_name = ...
Test case for incorrect rendering of bullet noticed in a wydget test case.
Test case for incorrect rendering of bullet noticed in a wydget test case. git-svn-id: d4fdfcd4de20a449196f78acc655f735742cd30d@1197 14d46d22-621c-0410-bb3d-6f67920f7d95
Python
bsd-3-clause
regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations
--- +++ @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +'''Test that font.Text horizontal alignment works. + +Three labels will be rendered aligned left, center and right. +''' + +__docformat__ = 'restructuredtext' +__version__ = '$Id: $' + +import unittest + +from pyglet import font + +import base_text + +class TEST_HALI...
dbe689882ad80e68750812950082d741e097b499
ipmi_constants.py
ipmi_constants.py
payload_types = { 'ipmi': 0x0, 'sol' : 0x1, 'rmcpplusopenreq': 0x10, 'rmcpplusopenresponse': 0x11, 'rakp1': 0x12, 'rakp2': 0x13, 'rakp3': 0x14, 'rakp4': 0x15, } rmcp_codes = { 1: 'Insufficient resources to create new session (wait for existing sessions to timeout)', 2: 'Invali...
Break out constantns to a diff file
Break out constantns to a diff file
Python
apache-2.0
openstack/pyghmi,openstack/pyghmi,benoit-canet/pyghmi,stackforge/pyghmi
--- +++ @@ -0,0 +1,34 @@ + + +payload_types = { + 'ipmi': 0x0, + 'sol' : 0x1, + 'rmcpplusopenreq': 0x10, + 'rmcpplusopenresponse': 0x11, + 'rakp1': 0x12, + 'rakp2': 0x13, + 'rakp3': 0x14, + 'rakp4': 0x15, +} + +rmcp_codes = { + 1: 'Insufficient resources to create new session (wait for exis...
e3ba99b74661f1b22340394b7e2b058371a0ed0e
rst2pdf/tests/input/test_180.py
rst2pdf/tests/input/test_180.py
# -*- coding: utf-8 -*- from reportlab.platypus import SimpleDocTemplate from reportlab.platypus.paragraph import Paragraph from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.colors import Color from reportlab.platypus.flowables import _listWrapOn, _FUZZ from wordaxe.rl.NewParagraph...
Test case for wordaxe bug
Test case for wordaxe bug
Python
mit
rafaelmartins/rst2pdf,rafaelmartins/rst2pdf
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from reportlab.platypus import SimpleDocTemplate +from reportlab.platypus.paragraph import Paragraph +from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle +from reportlab.lib.colors import Color +from reportlab.platypus.flowables import _listWrapOn, _...
0b5d7edd0be2301ea6442c4537b09b9bd38957b2
string/test2.py
string/test2.py
#!/usr/local/bin/python width=input('Please input width: ') price_width=10 item_width=width-price_width header='%-*s%*s' format='%-*s%*.2f' print width*'=' print header %(item_width,'Item',price_width,'Price') print width*'-' print format%(item_width,'Apple',price_width,0.442) print format%(item_width,'Pears',price_w...
Add a string format test.
Add a string format test.
Python
apache-2.0
Vayne-Lover/Python
--- +++ @@ -0,0 +1,13 @@ +#!/usr/local/bin/python +width=input('Please input width: ') +price_width=10 +item_width=width-price_width + +header='%-*s%*s' +format='%-*s%*.2f' + +print width*'=' +print header %(item_width,'Item',price_width,'Price') +print width*'-' +print format%(item_width,'Apple',price_width,0.442) +...
824c89ff8e6276271d6df57f5df80fbebc097ddc
backend/api_calls_test.py
backend/api_calls_test.py
#!/bin/python2.7 import mock import unittest import api_calls class FakeFirebase(object): def get(self, path, item): return None def put(self, path, item, data): return None def patch(self, path, data): return None class TestApiCalls(unittest.TestCase): def setUp(self): self.db = FakeF...
Add mostly empty unit tests
Add mostly empty unit tests
Python
apache-2.0
google/playhvz,google/playhvz,google/playhvz,google/playhvz,google/playhvz,google/playhvz,google/playhvz,google/playhvz
--- +++ @@ -0,0 +1,103 @@ +#!/bin/python2.7 + +import mock +import unittest + +import api_calls + + +class FakeFirebase(object): + + def get(self, path, item): + return None + + def put(self, path, item, data): + return None + + def patch(self, path, data): + return None + + +class TestApiCalls(unittest.T...
606018600e1a6162ff343af10b706d62dba705a2
webrtc/api/android/PRESUBMIT.py
webrtc/api/android/PRESUBMIT.py
# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
Add presubmit format requirement for webrtc/api/android
Add presubmit format requirement for webrtc/api/android BUG=webrtc:6419 NOTRY=True TBR=kjellander@webrtc.org Review-Url: https://codereview.webrtc.org/2377113003 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#14435}
Python
bsd-3-clause
ShiftMediaProject/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,TimothyGu/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,ShiftMediaProject/libilbc
--- +++ @@ -0,0 +1,28 @@ +# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATE...
552289fd86446416eefec6356659a8333d091f79
util/plot_dh.py
util/plot_dh.py
#!/usr/bin/env python # # Script for plotting ECTester ECDH results. # # Example usage: # # > java -jar ECTesterReader.jar -dh 10000 -b 192 -fp -o dh.csv # ... # > ./plot_dh.py dh.csv # ... # import numpy as np import matplotlib.pyplot as plt import argparse from operator import itemgetter if __name__...
Add script to plot ECDH timing.
Add script to plot ECDH timing.
Python
mit
petrs/ECTester,petrs/ECTester,petrs/ECTester
--- +++ @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# +# Script for plotting ECTester ECDH results. +# +# Example usage: +# +# > java -jar ECTesterReader.jar -dh 10000 -b 192 -fp -o dh.csv +# ... +# > ./plot_dh.py dh.csv +# ... +# + +import numpy as np +import matplotlib.pyplot as plt +import argparse +f...
cfb7d50943a2d410d088b83b1d601305b6eb9283
i8c/tests/test_empty_function.py
i8c/tests/test_empty_function.py
from i8c.tests import TestCase SOURCE = "define test::pretty_minimal" class TestEmptyFunction(TestCase): def test_empty_function(self): """Check that empty functions can be compiled.""" tree, output = self.compile(SOURCE) self.assertEqual([], output.operations)
Check that empty functions can be compiled
Check that empty functions can be compiled
Python
lgpl-2.1
gbenson/i8c
--- +++ @@ -0,0 +1,9 @@ +from i8c.tests import TestCase + +SOURCE = "define test::pretty_minimal" + +class TestEmptyFunction(TestCase): + def test_empty_function(self): + """Check that empty functions can be compiled.""" + tree, output = self.compile(SOURCE) + self.assertEqual([], output.opera...
408ba2172deee7d775d37f22e9f7f377682940fa
heat/tests/functional/test_WordPress_With_LB.py
heat/tests/functional/test_WordPress_With_LB.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
Add test case for WordPress_With_LB.template
Add test case for WordPress_With_LB.template Change-Id: I324da126b5a775a00b97d868cbd347dd65cb16aa Signed-off-by: Steven Dake <8638f3fce5db0278cfbc239bd581dfc00c29ec9d@redhat.com>
Python
apache-2.0
jasondunsmore/heat,cryptickp/heat,maestro-hybrid-cloud/heat,citrix-openstack-build/heat,jasondunsmore/heat,steveb/heat,JioCloud/heat,srznew/heat,srznew/heat,NeCTAR-RC/heat,takeshineshiro/heat,openstack/heat,noironetworks/heat,pratikmallya/heat,Triv90/Heat,takeshineshiro/heat,miguelgrinberg/heat,rickerc/heat_audit,gonzo...
--- +++ @@ -0,0 +1,54 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +...
7824a38ee1038790adbc7209920a9112e2231bd2
src/toil/test/src/systemTest.py
src/toil/test/src/systemTest.py
import errno import multiprocessing import os import tempfile from functools import partial from toil.test import ToilTest class SystemTest(ToilTest): """ Test various assumptions about the operating system's behavior """ def testAtomicityOfNonEmptyDirectoryRenames(self): for _ in range(100):...
Add test for atomicity of renames of non-empty directories
Add test for atomicity of renames of non-empty directories
Python
apache-2.0
BD2KGenomics/slugflow,BD2KGenomics/slugflow
--- +++ @@ -0,0 +1,56 @@ +import errno +import multiprocessing +import os +import tempfile +from functools import partial + +from toil.test import ToilTest + + +class SystemTest(ToilTest): + """ + Test various assumptions about the operating system's behavior + """ + def testAtomicityOfNonEmptyDirectoryRe...
716553051e35bddfab67a28679f2a28c0a454ad3
oslo_concurrency/_i18n.py
oslo_concurrency/_i18n.py
# Copyright 2014 Mirantis Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
# Copyright 2014 Mirantis Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
Correct the translation domain for loading messages
Correct the translation domain for loading messages Change-Id: If7fa8fd1915378bda3fc6e361049c2d90cdec8af
Python
apache-2.0
varunarya10/oslo.concurrency,JioCloud/oslo.concurrency
--- +++ @@ -16,7 +16,7 @@ from oslo import i18n -_translators = i18n.TranslatorFactory(domain='oslo_concurrency') +_translators = i18n.TranslatorFactory(domain='oslo.concurrency') # The primary translation function using the well-known name "_" _ = _translators.primary
5d77e0d84e6b22c0d4accd895ae664736b7a27a5
lily/management/commands/tags.py
lily/management/commands/tags.py
from optparse import make_option from django.core.management.base import BaseCommand from lily.tags.models import Tag import difflib class Command(BaseCommand): help = """Find similar tags based on the difflib module, usefull to identify duplicates & typos.""" ratio_cut_off_default = 0.65 option_list =...
Add management script to identify similar tag names.
LILY-1099: Add management script to identify similar tag names.
Python
agpl-3.0
HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily
--- +++ @@ -0,0 +1,47 @@ +from optparse import make_option +from django.core.management.base import BaseCommand + +from lily.tags.models import Tag + +import difflib + + +class Command(BaseCommand): + help = """Find similar tags based on the difflib module, usefull to identify duplicates & typos.""" + ratio_cut...
bf0b3cb27fa2b518fcc3f5116da0e4dbde25aae8
src/django_richenum/__init__.py
src/django_richenum/__init__.py
import forms # noqa import models # noqa __all__ = ( 'forms', 'models', ) __version__ = 'unknown' try: __version__ = __import__('pkg_resources').get_distribution('django_richenum').version except Exception as e: pass
__version__ = 'unknown' try: __version__ = __import__('pkg_resources').get_distribution('django_richenum').version except Exception as e: pass
Remove unnecessary import of form submodule
Remove unnecessary import of form submodule
Python
mit
hearsaycorp/django-richenum,dhui/django-richenum,hearsaycorp/django-richenum,asherf/django-richenum,adepue/django-richenum
--- +++ @@ -1,13 +1,3 @@ -import forms # noqa -import models # noqa - - -__all__ = ( - 'forms', - 'models', -) - - __version__ = 'unknown' try: __version__ = __import__('pkg_resources').get_distribution('django_richenum').version
c833f56f70c6d539f9d01308d2e118ef0557557b
src/excel_sheet_column_title.py
src/excel_sheet_column_title.py
""" Source : https://oj.leetcode.com/problems/excel-sheet-column-number/ Author : Changxi Wu Date : 2015-01-21 Given a column title as appear in an Excel sheet, return its corresponding column number. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB """ # @return a string...
Add excel sheet column title question description
Add excel sheet column title question description
Python
mit
chancyWu/leetcode
--- +++ @@ -0,0 +1,23 @@ +""" +Source : https://oj.leetcode.com/problems/excel-sheet-column-number/ +Author : Changxi Wu +Date : 2015-01-21 + +Given a column title as appear in an Excel sheet, return its corresponding column number. + +For example: + 1 -> A + 2 -> B + 3 -> C + ... + 26 -> Z + 27 -...
c509ef35fb0ba77fbcb66dd968daa0a19a617867
tests/sim/test_skills.py
tests/sim/test_skills.py
import unittest import unittest.mock as mock from hunting.level.map import LevelMap, LevelTile from hunting.sim.entities import GameObject, Fighter from hunting.sim.skills import PowerStrike class TestPowerStrike(unittest.TestCase): def setUp(self): level = LevelMap() level.set_map([[LevelTile()]...
Add test for PowerStrike ability
Add test for PowerStrike ability
Python
mit
MoyTW/RL_Arena_Experiment
--- +++ @@ -0,0 +1,39 @@ +import unittest +import unittest.mock as mock + +from hunting.level.map import LevelMap, LevelTile +from hunting.sim.entities import GameObject, Fighter +from hunting.sim.skills import PowerStrike + + +class TestPowerStrike(unittest.TestCase): + def setUp(self): + level = LevelMap(...
9bb9894b154a7a6bd6a8725e23cea4dbe78f84e0
generate_historic_liwc.py
generate_historic_liwc.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests from bs4 import BeautifulSoup from time import sleep import json import sys def get_spelling_variants(term, categories, y_from, y_to): """Retrieve historic spelling variants from the INL Lexicon service. """ # options for service: # get_wo...
Add script for generating a historic version of the Dutch LIWC
Add script for generating a historic version of the Dutch LIWC Added the script for generating a historic version of the Dutch LIWC. This script was not yet committed in the old liwc project. The same holds for the files historic_Dutch_LIWC.dic and liwc_output.json.
Python
apache-2.0
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
--- +++ @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import requests +from bs4 import BeautifulSoup +from time import sleep +import json +import sys + +def get_spelling_variants(term, categories, y_from, y_to): + """Retrieve historic spelling variants from the INL Lexicon service. + """ ...
2ef2d15fe305ade82fc760f0cc29f530458528fe
pronto_feedback/feedback/migrations/0005_remove_feedback_last_modification_date.py
pronto_feedback/feedback/migrations/0005_remove_feedback_last_modification_date.py
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-09-01 01:27 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('feedback', '0004_auto_20160827_0453'), ] operations = [ migrations.RemoveField( ...
Add migration file that removes last_modification_date
Add migration file that removes last_modification_date
Python
mit
zkan/pronto-feedback,zkan/pronto-feedback
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-09-01 01:27 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('feedback', '0004_auto_20160827_0453'), + ] + + operations ...
b7cf20cea38f28f1f488e2667ea43ee579c0ed95
testserver.py
testserver.py
#!/usr/bin/python # Author: sc0tfree # Twitter: @sc0tfree # Email: henry@sc0tfree.com import os import socket def generate_random_hex(length): ''' Generates a hex string of arbitrary length - 1, ending in a newline. ''' hex_string = os.urandom(length - 1) hex_string += '\x0a' return hex_stri...
Add test server to demo functionality
Add test server to demo functionality
Python
mit
sc0tfree/netbyte
--- +++ @@ -0,0 +1,66 @@ +#!/usr/bin/python + +# Author: sc0tfree +# Twitter: @sc0tfree +# Email: henry@sc0tfree.com + +import os +import socket + + +def generate_random_hex(length): + ''' + Generates a hex string of arbitrary length - 1, ending in a newline. + ''' + hex_string = os.urandom(length - 1) + ...
b7887c3e2729605d50372f51178ec3f86a09b52a
tastycrust/api.py
tastycrust/api.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals from importlib import import_module from inspect import isclass, getmembers from django.conf import settings from tastypie.api import Api as VanillaApi from tastypie.resources import Resource __all__ = ['Api'] def _is_resource_cl...
Implement Api addons (not tested)
Implement Api addons (not tested)
Python
bsd-3-clause
uranusjr/django-tastypie-crust
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals +from importlib import import_module +from inspect import isclass, getmembers +from django.conf import settings +from tastypie.api import Api as VanillaApi +from tastypie.resources import Resource + + +...
9f9db6242c3bac5626caf922487209f6f9af1cd8
vultr/v1_firewall.py
vultr/v1_firewall.py
'''Partial class to handle Vultr Firewall API calls''' from .utils import VultrBase class VultrFirewall(VultrBase): '''Handles Bultr Firewall API calls''' def __init__(self, api_key): VultrBase.__init__(self, api_key) def group_list(self, params=None): ''' /v1/firewall/group_list ...
'''Partial class to handle Vultr Firewall API calls''' from .utils import VultrBase class VultrFirewall(VultrBase): '''Handles Vultr Firewall API calls''' def __init__(self, api_key): VultrBase.__init__(self, api_key) def group_list(self, params=None): ''' /v1/firewall/group_list ...
Add partial support for firewall
Add partial support for firewall
Python
mit
spry-group/python-vultr
--- +++ @@ -3,7 +3,7 @@ class VultrFirewall(VultrBase): - '''Handles Bultr Firewall API calls''' + '''Handles Vultr Firewall API calls''' def __init__(self, api_key): VultrBase.__init__(self, api_key)
2c932a14fbf6a468176af77b39360be108777389
markers/mark_error_104.py
markers/mark_error_104.py
"""Marks all fixed errors #104 on ruwiki's CheckWikipedia.""" import re import pywikibot from checkwiki import load_page_list, mark_error_done, log NUMBER = "104" REGEXP = r"<ref\s+name=\s*(.*?)\s*(?:group=.*?)?\s*/?>" FLAGS = re.I def main(): """Downloads list from server and marks relevant errors as d...
Add marker for 104th error
Add marker for 104th error
Python
mit
Facenapalm/NapalmBot
--- +++ @@ -0,0 +1,29 @@ +"""Marks all fixed errors #104 on ruwiki's CheckWikipedia.""" +import re +import pywikibot +from checkwiki import load_page_list, mark_error_done, log + +NUMBER = "104" +REGEXP = r"<ref\s+name=\s*(.*?)\s*(?:group=.*?)?\s*/?>" +FLAGS = re.I + +def main(): + """Downloads list from server an...
a0adf63c1f942f4cdbe839ea367772c5ae08fbfc
CodeFights/fixTree.py
CodeFights/fixTree.py
#!/usr/local/bin/python # Code Fights Fix Tree Problem def fixTree(tree): return [s.strip().center(len(s)) for s in tree] def main(): tests = [ [ [" * ", " * ", "*** ", " *****", " *******", "*********"...
Solve Code Fights fix tree problem
Solve Code Fights fix tree problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,103 @@ +#!/usr/local/bin/python +# Code Fights Fix Tree Problem + + +def fixTree(tree): + return [s.strip().center(len(s)) for s in tree] + + +def main(): + tests = [ + [ + [" * ", + " * ", + "*** ", + " *****", + ...
8ad29d6563fd282b18884c345451a44a71eba890
tests/test_midi_note_numbers.py
tests/test_midi_note_numbers.py
# TODO: test if method to convert Note to a MIDI note number works import pytest from music_essentials import Note def test_midi_0(): n = Note.from_note_string('C-1') mid = n.midi_note_number() assert mid == 0 def test_midi_1_sharp(): n = Note.from_note_string('C-1#') mid = n.midi_note_number() ...
Add tests for calculating MIDI numbers - octave -1.
Add tests for calculating MIDI numbers - octave -1. Signed-off-by: Charlotte Pierce <351429ca27f6e4bff2dbb77adb5046c88cd12fae@malformed-bits.com>
Python
mit
charlottepierce/music_essentials
--- +++ @@ -0,0 +1,90 @@ +# TODO: test if method to convert Note to a MIDI note number works + +import pytest + +from music_essentials import Note + +def test_midi_0(): + n = Note.from_note_string('C-1') + mid = n.midi_note_number() + assert mid == 0 + +def test_midi_1_sharp(): + n = Note.from_note_string...
f37ee7d25cd00ade44926590ae6b7feb82844b4e
scripts/update_famplex.py
scripts/update_famplex.py
import os import requests # NOTE: this URL should be updated once the reach_export branch is merged base_url = ('https://raw.githubusercontent.com/bgyori/famplex/reach_export/' 'export/') famplex_groundings = 'famplex_groundings.tsv' famplex_overrides = 'famplex_groundings_override.tsv' if __name__ == '_...
Add script to update FamPlex groundings
Add script to update FamPlex groundings
Python
apache-2.0
clulab/bioresources
--- +++ @@ -0,0 +1,21 @@ +import os +import requests + +# NOTE: this URL should be updated once the reach_export branch is merged +base_url = ('https://raw.githubusercontent.com/bgyori/famplex/reach_export/' + 'export/') +famplex_groundings = 'famplex_groundings.tsv' +famplex_overrides = 'famplex_grounding...
bafd6eb44a0bbacbf11970e21435bd91c5ae610b
suitability/get_features.py
suitability/get_features.py
#!/usr/bin/env python2 import os import pickle import caffe caffe.set_mode_cpu() caffe_root = os.path.normpath(os.path.dirname('%s/../../../../' % caffe.__file__)) import numpy as np import util def main(): extractor = FeatureExtractor() cache_features(extractor, '../datasets/Michael') cache_features(e...
Use Caffe to cache feature vectors
Use Caffe to cache feature vectors
Python
mit
swook/autocrop,swook/autocrop,swook/autocrop,swook/autocrop
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python2 + +import os +import pickle + +import caffe +caffe.set_mode_cpu() +caffe_root = os.path.normpath(os.path.dirname('%s/../../../../' % caffe.__file__)) + +import numpy as np + +import util + +def main(): + extractor = FeatureExtractor() + cache_features(extractor, ...
a03004c621e1d82edbfc6866f8f8f79483a9c1cc
test/test_number_parsing.py
test/test_number_parsing.py
from nex.tokens import PLYTokenMixin from nex.parsing import parsing import pytest class T(PLYTokenMixin): def __init__(self, type_, v=None): self.type = type_ self.value = v def __repr__(self): v = self.value if self.value is not None else '' return f'T<{self.type}>({v})' ...
Add tests for parsing numbers
Add tests for parsing numbers
Python
mit
eddiejessup/nex
--- +++ @@ -0,0 +1,67 @@ +from nex.tokens import PLYTokenMixin +from nex.parsing import parsing + + +import pytest + + +class T(PLYTokenMixin): + def __init__(self, type_, v=None): + self.type = type_ + self.value = v + + def __repr__(self): + v = self.value if self.value is not None else '...
f873c340f5121aa63117314ea9906695463d0854
numba/tests/test_typingerror.py
numba/tests/test_typingerror.py
from __future__ import print_function import unittest from numba.compiler import compile_isolated from numba import types from numba.typeinfer import TypingError def what(): pass def foo(): return what() def bar(x): return x.a class TestTypingError(unittest.TestCase): def test_unknown_function(s...
Add tests for typing errors
Add tests for typing errors
Python
bsd-2-clause
sklam/numba,cpcloud/numba,gmarkall/numba,IntelLabs/numba,seibert/numba,jriehl/numba,GaZ3ll3/numba,cpcloud/numba,numba/numba,stuartarchibald/numba,stonebig/numba,stuartarchibald/numba,pombredanne/numba,ssarangi/numba,gmarkall/numba,gdementen/numba,jriehl/numba,gmarkall/numba,ssarangi/numba,pitrou/numba,pitrou/numba,stef...
--- +++ @@ -0,0 +1,39 @@ +from __future__ import print_function +import unittest +from numba.compiler import compile_isolated +from numba import types +from numba.typeinfer import TypingError + + +def what(): + pass + + +def foo(): + return what() + + +def bar(x): + return x.a + + +class TestTypingError(unit...
c49227c3a91fa173544d23d2133a94273187ae35
num-prediction.py
num-prediction.py
# Requires sci-kit learn and matplotlib import matplotlib.pyplot as pyplot from sklearn import datasets from sklearn import svm digits = datasets.load_digits() #Gamma breaks when greater than 0.01. Maintains high accuracy at 0.001 clf = svm.SVC(gamma=0.001, C=100) x,y = digits.data[:-1], digits.target[:-1] clf.fit...
Add number guess SVM file
Add number guess SVM file
Python
mit
FrizzBolt/machine-learning-sandbox
--- +++ @@ -0,0 +1,20 @@ +# Requires sci-kit learn and matplotlib + +import matplotlib.pyplot as pyplot + +from sklearn import datasets +from sklearn import svm + +digits = datasets.load_digits() + +#Gamma breaks when greater than 0.01. Maintains high accuracy at 0.001 +clf = svm.SVC(gamma=0.001, C=100) + +x,y = digi...
b042b715aaab917073a2587db1b2eca3525422e4
platforms/m3_ctl/programming/fake_ice.py
platforms/m3_ctl/programming/fake_ice.py
#!/usr/bin/env python MAX_GPIO = 24 import serial s = serial.Serial('/tmp/com2', 115200) if not s.isOpen(): raise IOError, "Failed to open serial port" GPIO_INPUT = 0 GPIO_OUTPUT = 1 GPIO_TRISTATE = 2 event = 0 gpio_level = [False for x in xrange(MAX_GPIO)] gpio_dir = [GPIO_TRISTATE for x in xrange(MAX_...
Add a stub fake ICE peripheral
Add a stub fake ICE peripheral
Python
apache-2.0
lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator
--- +++ @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +MAX_GPIO = 24 + +import serial + +s = serial.Serial('/tmp/com2', 115200) +if not s.isOpen(): + raise IOError, "Failed to open serial port" + +GPIO_INPUT = 0 +GPIO_OUTPUT = 1 +GPIO_TRISTATE = 2 + +event = 0 +gpio_level = [False for x in xrange(MAX_GPIO)] +gpio...
696309f33320b0e45ea4a6c7577c87be23cb4462
example_config.py
example_config.py
from roland import lazy, Mode home_page = 'https://www.google.com' search_page = 'https://www.google.com/search?q=%s' commands = { 'i': lazy.set_mode(Mode.Insert), 'colon': lazy.set_mode(Mode.Command), 'b': lambda browser: browser.roland.select_window(), 'c': lazy.close(), 'o': lazy.open_or_sear...
Add my config as an example config.
Add my config as an example config.
Python
bsd-3-clause
nathan-hoad/roland,nathan-hoad/roland
--- +++ @@ -0,0 +1,58 @@ +from roland import lazy, Mode + + +home_page = 'https://www.google.com' +search_page = 'https://www.google.com/search?q=%s' + +commands = { + 'i': lazy.set_mode(Mode.Insert), + 'colon': lazy.set_mode(Mode.Command), + + 'b': lambda browser: browser.roland.select_window(), + 'c': l...
e9ba95a16530ed29e387f6197573cc688b670aa1
Python/171_ExcelSheetColumNumber.py
Python/171_ExcelSheetColumNumber.py
class Solution(object): def titleToNumber(self, s): """ :type s: str :rtype: int """ # A-Z:65-90 || a-z:97-122 # ord('A') = 65, chr(65)=A n = len(s) if n == 0: return 0 result = 0 for x in xrange(0, n): asc2 = ord(s[n...
Add solution for 171:Excel sheet column number
Add solution for 171:Excel sheet column number
Python
mit
comicxmz001/LeetCode,comicxmz001/LeetCode
--- +++ @@ -0,0 +1,24 @@ +class Solution(object): + def titleToNumber(self, s): + """ + :type s: str + :rtype: int + """ + # A-Z:65-90 || a-z:97-122 + # ord('A') = 65, chr(65)=A + n = len(s) + if n == 0: + return 0 + result = 0 + for x ...
a6cdc37e5770afb8995d9e04ef9a54b790861c3a
generate_conf.py
generate_conf.py
#!/usr/bin/env python3 RATE = 150000.00 FORMAT = 'list' PORT = '445' OUTFILE = 'internet_{0}.list'.format(PORT) BANNER = 'false' with open('internet.conf', 'w') as f: f.write('# Internet Masscan Configuration.\n') f.write('rate = {0}\n'.format(RATE)) f.write('output-format = {0}\n'.format(FORMAT)) f.w...
Create a conf file for the internet.
Create a conf file for the internet.
Python
bsd-3-clause
averagesecurityguy/research
--- +++ @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +RATE = 150000.00 +FORMAT = 'list' +PORT = '445' +OUTFILE = 'internet_{0}.list'.format(PORT) +BANNER = 'false' + +with open('internet.conf', 'w') as f: + f.write('# Internet Masscan Configuration.\n') + f.write('rate = {0}\n'.format(RATE)) + f.write('output-...
69d573d3b544a6da8dd37f7605ab95fedbe63f6e
tests/test_channelfile.py
tests/test_channelfile.py
from mock import patch, MagicMock from paramiko import Channel, ChannelFile class TestChannelFile(object): @patch("paramiko.channel.ChannelFile._set_mode") def test_defaults_to_unbuffered_reading(self, setmode): cf = ChannelFile(Channel(None)) setmode.assert_called_once_with("r", -1) @pa...
Add some basic tests for Channel(Stderr)File
Add some basic tests for Channel(Stderr)File
Python
lgpl-2.1
ameily/paramiko,paramiko/paramiko
--- +++ @@ -0,0 +1,42 @@ +from mock import patch, MagicMock + +from paramiko import Channel, ChannelFile + + +class TestChannelFile(object): + @patch("paramiko.channel.ChannelFile._set_mode") + def test_defaults_to_unbuffered_reading(self, setmode): + cf = ChannelFile(Channel(None)) + setmode.asse...
f2c6e9033b3ff33acdc0bd763a45ad6aa78b9f5e
generate_enums.py
generate_enums.py
#!/usr/bin/env python import re valgrind_home = "/usr" input = open(valgrind_home + "/include/valgrind/libvex_ir.h").read() input += open(valgrind_home + "/include/valgrind/libvex.h").read() out = """ #include <libvex.h> #include <stdio.h> #include <string.h> #include "pyvex_macros.h" #include "pyvex_logging.h" ""...
Add script for generating enums.
Add script for generating enums.
Python
bsd-2-clause
chubbymaggie/pyvex,0xbc/pyvex,0xbc/pyvex,avain/pyvex,angr/pyvex,angr/pyvex,avain/pyvex,chubbymaggie/pyvex
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +import re + +valgrind_home = "/usr" + +input = open(valgrind_home + "/include/valgrind/libvex_ir.h").read() +input += open(valgrind_home + "/include/valgrind/libvex.h").read() + +out = """ +#include <libvex.h> +#include <stdio.h> +#include <string.h> +#include "pyvex...
8fe5d28b227ad0e59561e6be210eebfaa0f38ac8
paystackapi/tests/test_subaccount.py
paystackapi/tests/test_subaccount.py
import httpretty from paystackapi.tests.base_test_case import BaseTestCase from paystackapi.subaccount import SubAccount class TestSubAccount(BaseTestCase): @httpretty.activate def test_subaccount_create(self): pass
Add initial test class for subaccount
Add initial test class for subaccount
Python
mit
andela-sjames/paystack-python
--- +++ @@ -0,0 +1,11 @@ +import httpretty + +from paystackapi.tests.base_test_case import BaseTestCase +from paystackapi.subaccount import SubAccount + + +class TestSubAccount(BaseTestCase): + + @httpretty.activate + def test_subaccount_create(self): + pass
503dd762c43f37b22407472271e9c4492827935a
pycoreutils/test/test_pycoreutils.py
pycoreutils/test/test_pycoreutils.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2009, 2010, 2011 Hans van Leeuwen. # See LICENSE.txt for details. from __future__ import unicode_literals import unittest import pycoreutils from pycoreutils.test import BaseTestCase class TestCase(BaseTestCase): def test_getcommand(self): ...
Test if all commands can import
Test if all commands can import
Python
mit
davidfischer/pycoreutils
--- +++ @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2009, 2010, 2011 Hans van Leeuwen. +# See LICENSE.txt for details. + +from __future__ import unicode_literals + +import unittest +import pycoreutils + +from pycoreutils.test import BaseTestCase + + +class TestCase(BaseTestCase...
b1149ce5e0bc639a5118432a1fdfd8af546996f7
rasterio/tests/test_blocks.py
rasterio/tests/test_blocks.py
import unittest import rasterio class RasterBlocksTest(unittest.TestCase): def test_blocks(self): with rasterio.open('rasterio/tests/data/RGB.byte.tif') as s: blocks = list(s.blocks) self.assertEqual(len(blocks), 1)
Test of access to a dataset's blocks.
Test of access to a dataset's blocks. See #6.
Python
bsd-3-clause
perrygeo/rasterio,kapadia/rasterio,johanvdw/rasterio,sgillies/rasterio,njwilson23/rasterio,clembou/rasterio,snorfalorpagus/rasterio,youngpm/rasterio,njwilson23/rasterio,johanvdw/rasterio,youngpm/rasterio,brendan-ward/rasterio,clembou/rasterio,brendan-ward/rasterio,johanvdw/rasterio,clembou/rasterio,brendan-ward/rasteri...
--- +++ @@ -0,0 +1,10 @@ +import unittest + +import rasterio + +class RasterBlocksTest(unittest.TestCase): + def test_blocks(self): + with rasterio.open('rasterio/tests/data/RGB.byte.tif') as s: + blocks = list(s.blocks) + self.assertEqual(len(blocks), 1) +
b4a700dca980ef91247a0d0b0601fcb2c5166c07
laalaa/apps/advisers/tests/test_seed.py
laalaa/apps/advisers/tests/test_seed.py
from django.core.management import call_command from django.test import TestCase from advisers import models, tasks class SeedTest(TestCase): def test_seed_loads_models_with_organisation_type(self): tasks.clear_db() call_command("seed") # OrganisationType model loaded from initial_categor...
Create test case to ensure data from initial_categories is loaded
Create test case to ensure data from initial_categories is loaded Had to run tasks.clear_db() first as one of the migration files includes importing the initial_categories.json file and saving this to the db. Tests check data from both fixture files, initial_categories.json and initial_advisers.json are both present
Python
mit
ministryofjustice/laa-legal-adviser-api,ministryofjustice/laa-legal-adviser-api,ministryofjustice/laa-legal-adviser-api
--- +++ @@ -0,0 +1,14 @@ +from django.core.management import call_command +from django.test import TestCase + +from advisers import models, tasks + +class SeedTest(TestCase): + + def test_seed_loads_models_with_organisation_type(self): + tasks.clear_db() + call_command("seed") + # Organisation...
3e339aca69a9db2ff2cc2a05d6c7f7dbc1b2bb83
bin/get_barcode_hathi_record_number.py
bin/get_barcode_hathi_record_number.py
#!/usr/bin/env python3 # Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. from argparse import ArgumentParser from urllib.request import urlopen from falcom.api.uri import URI, APIQuerier from...
Add binary script for getting HT record number
Add binary script for getting HT record number
Python
bsd-3-clause
mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +# Copyright (c) 2017 The Regents of the University of Michigan. +# All Rights Reserved. Licensed according to the terms of the Revised +# BSD License. See LICENSE.txt for details. +from argparse import ArgumentParser +from urllib.request import urlopen + +from falcom....
7a04457e8003a638f0356e18d3c424f688e40a8f
tests/cli/test_rasa_show.py
tests/cli/test_rasa_show.py
def test_show_stories_help(run): help = run("show", "stories", "--help") help_text = """usage: rasa show stories [-h] [-v] [-vv] [--quiet] [-d DOMAIN] [-s STORIES] [-c CONFIG] [--output OUTPUT] [--max-history MAX_HISTORY] [-nlu NLU_DATA]""" lines = help_te...
Test rasa show stories help
Test rasa show stories help
Python
apache-2.0
RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu
--- +++ @@ -0,0 +1,11 @@ +def test_show_stories_help(run): + help = run("show", "stories", "--help") + + help_text = """usage: rasa show stories [-h] [-v] [-vv] [--quiet] [-d DOMAIN] [-s STORIES] + [-c CONFIG] [--output OUTPUT] + [--max-history MAX_HISTORY] [-nlu ...
9d29b4c569362dcd0af9519587aab576b895e159
txt2ml.py
txt2ml.py
"""Script to convert text file to input for embem classifier. The script tokenizes the text and writes it to a new file containing: <sentence id>\t<sentence (tokens separated by space)>\tNone\n Usage: python txt2ml.py <dir in> <dir out> """ import argparse import nltk.data from nltk.tokenize import word_tokenize imp...
Add script that converts text files to input for the classifier
Add script that converts text files to input for the classifier The script tokenizes the text and writes sentences in the correct format to file. Used for the Ceneton texts.
Python
apache-2.0
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
--- +++ @@ -0,0 +1,40 @@ +"""Script to convert text file to input for embem classifier. + +The script tokenizes the text and writes it to a new file containing: +<sentence id>\t<sentence (tokens separated by space)>\tNone\n + +Usage: python txt2ml.py <dir in> <dir out> +""" + +import argparse +import nltk.data +from ...
e9207faa45368eeb341555e94bd4fb41e39067df
tests/acceptance/test_running.py
tests/acceptance/test_running.py
import pytest from tests.acceptance import ( run_gitlabform, ) class TestRunning: # noinspection PyPep8Naming def test__ALL(self, gitlab, group, project, other_project): config = f""" projects_and_groups: '*': project_settings: request_access_enabled: tr...
Test running with ALL and ALL_DEFINED
Test running with ALL and ALL_DEFINED
Python
mit
egnyte/gitlabform,egnyte/gitlabform
--- +++ @@ -0,0 +1,63 @@ +import pytest +from tests.acceptance import ( + run_gitlabform, +) + + +class TestRunning: + # noinspection PyPep8Naming + def test__ALL(self, gitlab, group, project, other_project): + config = f""" + projects_and_groups: + '*': + project_settings: ...
f86cca3b06c48f7f3270648147878de8a389cebb
thermof/simulation/initialize.py
thermof/simulation/initialize.py
# Date: September 2017 # Author: Kutay B. Sezginel """ Initialize Lammps simulation using lammps_interface """ import os from lammps_interface.lammps_main import LammpsSimulation from lammps_interface.structure_data import from_CIF def write_lammps_files(parameters): """ Write Lammps files using lammps_interf...
Add function to write Lammps files using lammps_interface.
Add function to write Lammps files using lammps_interface.
Python
mit
kbsezginel/tee_mof,kbsezginel/tee_mof
--- +++ @@ -0,0 +1,29 @@ +# Date: September 2017 +# Author: Kutay B. Sezginel +""" +Initialize Lammps simulation using lammps_interface +""" +import os +from lammps_interface.lammps_main import LammpsSimulation +from lammps_interface.structure_data import from_CIF + + +def write_lammps_files(parameters): + """ + ...
ab094c32b1bcea2978796d6118bf43365571f2b7
stacker_blueprints/security_rules.py
stacker_blueprints/security_rules.py
from troposphere.ec2 import SecurityGroupIngress, SecurityGroupEgress from stacker.blueprints.base import Blueprint CLASS_MAP = { "IngressRules": SecurityGroupIngress, "EgressRules": SecurityGroupEgress, } class SecurityGroupRules(Blueprint): """Used to add Ingress/Egress rules to existing security group...
Add new, low-level security group rule blueprint
Add new, low-level security group rule blueprint This should make it super simple to have a stack that maintains security group rules on security groups built in other stacks. Mostly useful for rules that glue two stacks together (like adding a rule to allow instances in your webserver stack to talk to your RDS databa...
Python
bsd-2-clause
remind101/stacker_blueprints,remind101/stacker_blueprints
--- +++ @@ -0,0 +1,61 @@ +from troposphere.ec2 import SecurityGroupIngress, SecurityGroupEgress +from stacker.blueprints.base import Blueprint + +CLASS_MAP = { + "IngressRules": SecurityGroupIngress, + "EgressRules": SecurityGroupEgress, +} + + +class SecurityGroupRules(Blueprint): + """Used to add Ingress/E...
dbe5a653785042c8a6051b331675235d1c7c60a2
contrib_bots/bots/help/test_help.py
contrib_bots/bots/help/test_help.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import print_function import os import sys our_dir = os.path.dirname(os.path.abspath(__file__)) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') from bots...
Add tests for help bot in contrib_bots.
testsuite: Add tests for help bot in contrib_bots. Add test file 'test_help.py'.
Python
apache-2.0
dhcrzf/zulip,Galexrt/zulip,punchagan/zulip,Galexrt/zulip,andersk/zulip,rht/zulip,andersk/zulip,brockwhittaker/zulip,mahim97/zulip,shubhamdhama/zulip,mahim97/zulip,shubhamdhama/zulip,amanharitsh123/zulip,hackerkid/zulip,hackerkid/zulip,verma-varsha/zulip,timabbott/zulip,zulip/zulip,vabs22/zulip,kou/zulip,jrowan/zulip,ko...
--- +++ @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +from __future__ import absolute_import +from __future__ import print_function + +import os +import sys + +our_dir = os.path.dirname(os.path.abspath(__file__)) +# For dev setups, we can find the API in the repo itself. +if os.path.exists(os.path.join(our_dir, '..')): ...
cd088415d0fd652c3e485fcd3b6e16032f09d707
test/client/local_recognizer_test.py
test/client/local_recognizer_test.py
import unittest import os from speech_recognition import WavFile from mycroft.client.speech.listener import RecognizerLoop __author__ = 'seanfitz' DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data") class LocalRecognizerTest(unittest.TestCase): def setUp(self): self.recognizer ...
import unittest import os from speech_recognition import WavFile from mycroft.client.speech.listener import RecognizerLoop __author__ = 'seanfitz' DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data") class LocalRecognizerTest(unittest.TestCase): def setUp(self): rl = RecognizerL...
Fix init of local recognizer
Fix init of local recognizer
Python
apache-2.0
linuxipho/mycroft-core,Dark5ide/mycroft-core,forslund/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,aatchison/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core,MycroftAI/mycroft-core,MycroftAI/mycroft-core
--- +++ @@ -12,7 +12,9 @@ class LocalRecognizerTest(unittest.TestCase): def setUp(self): - self.recognizer = RecognizerLoop.create_mycroft_recognizer(16000, + rl = RecognizerLoop() + self.recognizer = RecognizerLoop.create_mycroft_recognizer(rl, + ...
90def43806ca31e449ab70b1daa09fa354b7fd74
bin/generate_test_queries.py
bin/generate_test_queries.py
#!/usr/bin/env python import os import sys import time try: import wikipedia except ImportError: print('Queries generation requires wikipedia package. \n' 'You can install it by running "pip install wikipedia"') exit() # If user in bin directory set correct path to queries if os.getcwd().endswith...
Create script for generation test queries
Create script for generation test queries
Python
lgpl-2.1
daminisatya/loklak_server,PiotrKowalski/loklak_server,singhpratyush/loklak_server,smokingwheels/loklak_server_frontend_hdd,arashahmadi/sensemi_ai,singhpratyush/loklak_server,smsunarto/loklak_server,loklak/loklak_server,sudheesh001/loklak_server,singhpratyush/loklak_server,smsunarto/loklak_server,singhpratyush/loklak_se...
--- +++ @@ -0,0 +1,34 @@ +#!/usr/bin/env python +import os +import sys +import time +try: + import wikipedia +except ImportError: + print('Queries generation requires wikipedia package. \n' + 'You can install it by running "pip install wikipedia"') + exit() + +# If user in bin directory set correct ...
d3c5c5612c23c2ffcc103402d1f4d2acf7b81009
photutils/utils/tests/test_moments.py
photutils/utils/tests/test_moments.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from numpy.testing import assert_equal, assert_allclose import pytest from .._moments import _moments, _moments_central def ...
Add tests for new moment functions
Add tests for new moment functions
Python
bsd-3-clause
astropy/photutils,larrybradley/photutils
--- +++ @@ -0,0 +1,39 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +from __future__ import (absolute_import, division, print_function, + unicode_literals) + +import numpy as np +from numpy.testing import assert_equal, assert_allclose +import pytest + +from .._moments impo...
f217c8c6def69d8a7428c655c5d350b0c1d8deb2
dynd/tests/test_ndobject_cast.py
dynd/tests/test_ndobject_cast.py
import sys import unittest from datetime import date from dynd import nd, ndt class TestNDObjectCast(unittest.TestCase): def test_broadcast_cast(self): a = nd.ndobject(10) b = a.cast('3, int32') self.assertRaises(RuntimeError, b.eval) def test_strided_to_fixed(self): a = nd.ndo...
Test that uses the convert_dtype's get_shape
Test that uses the convert_dtype's get_shape
Python
bsd-2-clause
insertinterestingnamehere/dynd-python,cpcloud/dynd-python,pombredanne/dynd-python,ContinuumIO/dynd-python,insertinterestingnamehere/dynd-python,insertinterestingnamehere/dynd-python,ContinuumIO/dynd-python,izaid/dynd-python,aterrel/dynd-python,aterrel/dynd-python,cpcloud/dynd-python,ContinuumIO/dynd-python,michaelpacer...
--- +++ @@ -0,0 +1,19 @@ +import sys +import unittest +from datetime import date +from dynd import nd, ndt + +class TestNDObjectCast(unittest.TestCase): + def test_broadcast_cast(self): + a = nd.ndobject(10) + b = a.cast('3, int32') + self.assertRaises(RuntimeError, b.eval) + + def test_str...
9416de2b1aae97639b9a77bfb0e0f50a1c09ea6d
sierra_adapter/sierra_window_generator/src/sierra_window_generator.py
sierra_adapter/sierra_window_generator/src/sierra_window_generator.py
# -*- encoding: utf-8 -*- """ Publish a new Sierra update window to SNS. """ import os import boto3 import maya from wellcome_aws_utils.sns_utils import publish_sns_message def main(event, _): print(f'event = {event!r}') topic_arn = os.environ['TOPIC_ARN'] window_start = os.environ['WINDOW_START'] ...
Create the first Sierra window generator
Create the first Sierra window generator
Python
mit
wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api
--- +++ @@ -0,0 +1,29 @@ +# -*- encoding: utf-8 -*- +""" +Publish a new Sierra update window to SNS. +""" + +import os + +import boto3 +import maya + +from wellcome_aws_utils.sns_utils import publish_sns_message + + +def main(event, _): + print(f'event = {event!r}') + + topic_arn = os.environ['TOPIC_ARN'] + ...
fa85cd0d992b5153f9a48f3cf9d504a2b33cca1d
tempest/tests/lib/services/volume/v2/test_availability_zone_client.py
tempest/tests/lib/services/volume/v2/test_availability_zone_client.py
# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LI...
Add unit test for volume availability zone client
Add unit test for volume availability zone client This patch adds unit test for volume v2 availability zone client. Partially Implements: blueprint tempest-lib-missing-test-coverage Change-Id: I94f758307255de06fbaf8c6744912b46e15a6cb2
Python
apache-2.0
openstack/tempest,Juniper/tempest,openstack/tempest,masayukig/tempest,masayukig/tempest,Juniper/tempest,cisco-openstack/tempest,cisco-openstack/tempest
--- +++ @@ -0,0 +1,51 @@ +# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# ...
6b6f6fb8a0266b19d1edc8272d0b3f1aea8d0c1b
analysis/patch-to-timeout.py
analysis/patch-to-timeout.py
#!/usr/bin/env python # vim: set sw=2 ts=2 softtabstop=2 expandtab: """ This script is designed to take a set of results and set them all to timeouts. """ import argparse import os import logging import sys import yaml from br_util import FinalResultType, classifyResult try: # Try to use libyaml which is faster fr...
Add script to take a result set and turn them all into timeouts.
Add script to take a result set and turn them all into timeouts.
Python
bsd-3-clause
symbooglix/boogie-runner,symbooglix/boogie-runner
--- +++ @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# vim: set sw=2 ts=2 softtabstop=2 expandtab: +""" +This script is designed to take a set of results +and set them all to timeouts. +""" +import argparse +import os +import logging +import sys +import yaml +from br_util import FinalResultType, classifyResult + +try: + ...
9382b3e6cf2dacb5380d482acd6a2bd97a6dd0ce
tests/benchmarks/benchmark_transform.py
tests/benchmarks/benchmark_transform.py
from warnings import WarningMessage import pytest import subprocess import os import h5py import numpy as np import time from desc.__main__ import main from desc.grid import Grid, LinearGrid, ConcentricGrid from desc.basis import ( PowerSeries, FourierSeries, DoubleFourierSeries, ZernikePolynomial, ...
Add benchmark for building transforms (not including compilation time)
Add benchmark for building transforms (not including compilation time)
Python
mit
PlasmaControl/DESC,PlasmaControl/DESC
--- +++ @@ -0,0 +1,68 @@ +from warnings import WarningMessage +import pytest +import subprocess +import os +import h5py +import numpy as np +import time +from desc.__main__ import main + +from desc.grid import Grid, LinearGrid, ConcentricGrid +from desc.basis import ( + PowerSeries, + FourierSeries, + Double...
bf40adfe7042518c4cefc1aaf4a0929c9ce8b2a4
mta.py
mta.py
from datetime import datetime import urllib2 import xml.etree.ElementTree as ET MTA_SERVICE_STATUS_URL = 'http://web.mta.info/status/serviceStatus.txt' def service_status(): service_status_xml = urllib2.urlopen(MTA_SERVICE_STATUS_URL).read() tree = ET.fromstring(service_status_xml) return MTASubwayStatus...
Add basic functionality for using the MTA service status feed
Add basic functionality for using the MTA service status feed
Python
isc
softdev-projects/mta-smart-alerts
--- +++ @@ -0,0 +1,48 @@ +from datetime import datetime +import urllib2 +import xml.etree.ElementTree as ET + +MTA_SERVICE_STATUS_URL = 'http://web.mta.info/status/serviceStatus.txt' + + +def service_status(): + service_status_xml = urllib2.urlopen(MTA_SERVICE_STATUS_URL).read() + tree = ET.fromstring(service_s...
ffab86b081357fbd51e0c9676f03f4c39b65658b
emails/models.py
emails/models.py
from django.db import models from datetime import datetime import settings class Email(models.Model): ''' Monitor emails sent ''' to = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='emails') subject = models.CharField(max_length=150) body = models.TextField() at = models.Dat...
Add a django model to save emails and specify subscriptions.
Add a django model to save emails and specify subscriptions.
Python
bsd-3-clause
fmalina/emails,fmalina/emails
--- +++ @@ -0,0 +1,39 @@ +from django.db import models +from datetime import datetime +import settings + +class Email(models.Model): + ''' Monitor emails sent ''' + to = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='emails') + subject = models.CharField(max_length=150) + body = models....
4325bf0fc91011a263f9b27065659aca09ca3d49
tools/droplets/cleanup.py
tools/droplets/cleanup.py
import argparse import configparser import os import digitalocean def get_config() -> configparser.ConfigParser: config = configparser.ConfigParser() config.read(os.path.join(os.path.dirname(os.path.abspath(__file__)), "conf.ini")) return config parser = argparse.ArgumentParser(description="Clean up ol...
Add a tool to clean up old hostnames in DNS.
droplets: Add a tool to clean up old hostnames in DNS.
Python
apache-2.0
andersk/zulip,rht/zulip,andersk/zulip,andersk/zulip,zulip/zulip,zulip/zulip,zulip/zulip,zulip/zulip,andersk/zulip,andersk/zulip,andersk/zulip,rht/zulip,rht/zulip,rht/zulip,rht/zulip,zulip/zulip,rht/zulip,andersk/zulip,zulip/zulip,zulip/zulip,rht/zulip
--- +++ @@ -0,0 +1,49 @@ +import argparse +import configparser +import os + +import digitalocean + + +def get_config() -> configparser.ConfigParser: + config = configparser.ConfigParser() + config.read(os.path.join(os.path.dirname(os.path.abspath(__file__)), "conf.ini")) + return config + + +parser = argpars...
5fdb5e0537049d602a1bc4bfc6401e396076e333
py/ransom-note.py
py/ransom-note.py
from collections import Counter class Solution(object): def canConstruct(self, ransomNote, magazine): """ :type ransomNote: str :type magazine: str :rtype: bool """ cr = Counter(ransomNote) cm = Counter(magazine) for c, v in cr.iteritems(): ...
Add py solution for 383. Ransom Note
Add py solution for 383. Ransom Note 383. Ransom Note: https://leetcode.com/problems/ransom-note/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,14 @@ +from collections import Counter +class Solution(object): + def canConstruct(self, ransomNote, magazine): + """ + :type ransomNote: str + :type magazine: str + :rtype: bool + """ + cr = Counter(ransomNote) + cm = Counter(magazine) + f...
5cbd8ce4ef321b3c302ca731999b09abbb99db7f
hub/tests/test_globalsettings.py
hub/tests/test_globalsettings.py
# coding: utf-8 import constance from constance.test import override_config from django.urls import reverse from django.test import TestCase class GlobalSettingsTestCase(TestCase): fixtures = ['test_data'] @override_config(MFA_ENABLED=True) def test_mfa_enabled(self): self.client.login(username=...
Add test to valide MFA status in JS
Add test to valide MFA status in JS
Python
agpl-3.0
kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi
--- +++ @@ -0,0 +1,26 @@ +# coding: utf-8 +import constance +from constance.test import override_config +from django.urls import reverse +from django.test import TestCase + + +class GlobalSettingsTestCase(TestCase): + + fixtures = ['test_data'] + + @override_config(MFA_ENABLED=True) + def test_mfa_enabled(se...
8214d8b542e2da890bc6b34372de2016e98e7767
tests/services/shop/order/test_ordered_articles_service.py
tests/services/shop/order/test_ordered_articles_service.py
""" :Copyright: 2006-2017 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from itertools import count from byceps.services.shop.order import ordered_articles_service from byceps.services.shop.order.models.order import PaymentState from testfixtures.party import create_party from testfixture...
Add test for service function that counts ordered article by payment state
Add test for service function that counts ordered article by payment state
Python
bsd-3-clause
m-ober/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps
--- +++ @@ -0,0 +1,89 @@ +""" +:Copyright: 2006-2017 Jochen Kupperschmidt +:License: Modified BSD, see LICENSE for details. +""" + +from itertools import count + +from byceps.services.shop.order import ordered_articles_service +from byceps.services.shop.order.models.order import PaymentState + +from testfixtures.part...
c5faa45462ff217f4ce2ea4004de9b8c29ed3c87
bin/analyze.py
bin/analyze.py
#!/usr/bin/env python3 import math import numpy as np import sqlite3 def read(path='tests/fixtures/google.sqlite3'): connection = sqlite3.connect(path) cursor = connection.cursor() cursor.execute('SELECT time FROM arrivals ORDER BY time') data = np.diff(np.array([row[0] for row in cursor])) connec...
Add an auxiliary Python script
Add an auxiliary Python script
Python
mit
learning-on-chip/google-cluster-prediction
--- +++ @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +import math +import numpy as np +import sqlite3 + +def read(path='tests/fixtures/google.sqlite3'): + connection = sqlite3.connect(path) + cursor = connection.cursor() + cursor.execute('SELECT time FROM arrivals ORDER BY time') + data = np.diff(np.array([...
78fc07d59820db3f9992d0285bf18b27c2078ab7
choosealicense/test/test_info.py
choosealicense/test/test_info.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Tests for the `license info` function """ from click.testing import CliRunner from choosealicense.main import info def test_show_license_info(): all_the_licenses = { 'agpl-3.0': ('GNU Affero General Public License v3.0', 11), 'apache-2.0': (...
Add test for `license info` function
Add test for `license info` function
Python
mit
lord63/choosealicense-cli
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" + Tests for the `license info` function +""" + +from click.testing import CliRunner + +from choosealicense.main import info + + +def test_show_license_info(): + all_the_licenses = { + 'agpl-3.0': ('GNU Affero General Public L...
6ba394fba3786ecac9eec8896b8fa40e3ddc0612
bmi_ilamb/tests/test_package_directories.py
bmi_ilamb/tests/test_package_directories.py
"""Tests directories set in the package definition file.""" import os from nose.tools import assert_true from .. import package_dir, data_dir def test_package_dir_is_set(): assert(package_dir is not None) def test_data_dir_is_set(): assert(data_dir is not None) def test_package_dir_exists(): assert_t...
Add unit tests for package directories
Add unit tests for package directories
Python
mit
permamodel/bmi-ilamb
--- +++ @@ -0,0 +1,21 @@ +"""Tests directories set in the package definition file.""" + +import os +from nose.tools import assert_true +from .. import package_dir, data_dir + + +def test_package_dir_is_set(): + assert(package_dir is not None) + + +def test_data_dir_is_set(): + assert(data_dir is not None) + + +...
8268b050ae98180a55b9c2e5285de1af5b8ca3e5
pages/tests.py
pages/tests.py
from django.test import TestCase from pages.models import * from django.test.client import Client class PagesTestCase(TestCase): fixtures = ['tests.json'] def test_01_add_page(self): """ Test that the add admin page could be displayed correctly """ c = Client() c.login(...
from django.test import TestCase from pages.models import * from django.test.client import Client class PagesTestCase(TestCase): fixtures = ['tests.json'] def test_01_add_page(self): """ Test that the add admin page could be displayed via the admin """ c = Client() c.l...
Add a create page test
Add a create page test
Python
bsd-3-clause
PiRSquared17/django-page-cms,google-code-export/django-page-cms,google-code-export/django-page-cms,odyaka341/django-page-cms,PiRSquared17/django-page-cms,odyaka341/django-page-cms,odyaka341/django-page-cms,google-code-export/django-page-cms,Alwnikrotikz/django-page-cms,odyaka341/django-page-cms,PiRSquared17/django-page...
--- +++ @@ -1,4 +1,5 @@ from django.test import TestCase + from pages.models import * from django.test.client import Client @@ -7,10 +8,20 @@ def test_01_add_page(self): """ - Test that the add admin page could be displayed correctly + Test that the add admin page could be displayed...
eb1cd979ed232690f819def5808a91431132079c
IPython/utils/py3compat.py
IPython/utils/py3compat.py
import sys def no_code(x, encoding=None): return x def decode(s, encoding=None): encoding = encoding or sys.stdin.encoding or sys.getdefaultencoding() return s.decode(encoding, "replace") def encode(u, encoding=None): encoding = encoding or sys.stdin.encoding or sys.getdefaultencoding() return u....
Add module for Python 3 compatibility layer.
Add module for Python 3 compatibility layer.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -0,0 +1,37 @@ +import sys + +def no_code(x, encoding=None): + return x + +def decode(s, encoding=None): + encoding = encoding or sys.stdin.encoding or sys.getdefaultencoding() + return s.decode(encoding, "replace") + +def encode(u, encoding=None): + encoding = encoding or sys.stdin.encoding or ...
720e398ac6d21c2e394dda08d47d5110b3a38c40
src/config/settings/secrets_sample.py
src/config/settings/secrets_sample.py
# SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '' # Database # https://docs.djangoproject.com/en/1.7/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '', 'HOST': '127.0.0.1', 'PORT': 5432...
Add sample file with secrets (db credentials and secret_key).
Add sample file with secrets (db credentials and secret_key).
Python
mit
Alexx-G/django-project-template,Alexx-G/django-project-template
--- +++ @@ -0,0 +1,16 @@ +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '' + +# Database +# https://docs.djangoproject.com/en/1.7/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': '', + 'HO...
8908727e9c288c607572e7352abb6016d2f5a640
kboard/board/migrations/0022_auto_20161111_1044.py
kboard/board/migrations/0022_auto_20161111_1044.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-11-11 01:44 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('board', '0021_auto_20161110_2019'), ] operations = [ migrations.AlterField(...
Add migration that add blank on file field
Add migration that add blank on file field
Python
mit
kboard/kboard,kboard/kboard,guswnsxodlf/k-board,darjeeling/k-board,kboard/kboard,guswnsxodlf/k-board,cjh5414/kboard,cjh5414/kboard,hyesun03/k-board,cjh5414/kboard,hyesun03/k-board,guswnsxodlf/k-board,hyesun03/k-board
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.1 on 2016-11-11 01:44 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('board', '0021_auto_20161110_2019'), + ] + + oper...
4df8d31e638bfbab5893ded2da9350fdb9a630ba
src/main/python/scripts/train_test.py
src/main/python/scripts/train_test.py
# Copyright 2017 Rice University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Add script to split data into training and testing
Add script to split data into training and testing
Python
apache-2.0
capergroup/bayou,capergroup/bayou,capergroup/bayou
--- +++ @@ -0,0 +1,64 @@ +# Copyright 2017 Rice University +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by a...
aaae5af0570ded8cab9cb330c9c992dac62778c3
vcapp/geometry.py
vcapp/geometry.py
import math def line_magnitude (x1, y1, x2, y2): return math.sqrt(math.pow((x2 - x1), 2) + math.pow((y2 - y1), 2)) #Calc minimum distance from a point and a line segment (i.e. consecutive vertices in a polyline). def distance_point_line (px, py, x1, y1, x2, y2): #http://local.wasp.uwa.edu.au/~pbourke/geometry...
Move geometric functions into a separate file
Move geometric functions into a separate file
Python
cc0-1.0
edwinsteele/visual-commute,edwinsteele/visual-commute
--- +++ @@ -0,0 +1,33 @@ +import math + +def line_magnitude (x1, y1, x2, y2): + return math.sqrt(math.pow((x2 - x1), 2) + math.pow((y2 - y1), 2)) + +#Calc minimum distance from a point and a line segment (i.e. consecutive vertices in a polyline). +def distance_point_line (px, py, x1, y1, x2, y2): + #http://loca...
56455e27cd210f98c2cbad924bc7fdf2fc55eff0
girder_worker/docker/__init__.py
girder_worker/docker/__init__.py
from girder_worker import GirderWorkerPluginABC class DockerPlugin(GirderWorkerPluginABC): def __init__(self, app, *args, **kwargs): self.app = app def task_imports(self): return ['girder_worker.docker.tasks']
Add plugin for docker tasks
Add plugin for docker tasks
Python
apache-2.0
girder/girder_worker,girder/girder_worker,girder/girder_worker
--- +++ @@ -0,0 +1,10 @@ +from girder_worker import GirderWorkerPluginABC + + +class DockerPlugin(GirderWorkerPluginABC): + + def __init__(self, app, *args, **kwargs): + self.app = app + + def task_imports(self): + return ['girder_worker.docker.tasks']
c4520ff4d7b26eaa18ec7a30a12bba03859081d2
salt/states/status.py
salt/states/status.py
# -*- coding: utf-8 -*- ''' Minion status monitoring Maps to the `status` execution module. ''' __monitor__ = [ 'loadavg', ] def loadavg(name, maximum=None, minimum=None): ''' Return the current load average for the specified minion. Available values for name are `1-min`, `5-min` and `15...
Add monitoring state for load average
Add monitoring state for load average
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +''' +Minion status monitoring + +Maps to the `status` execution module. +''' + +__monitor__ = [ + 'loadavg', + ] + + +def loadavg(name, maximum=None, minimum=None): + ''' + Return the current load average for the specified minion. Available values...
b8a477d19c1ce5f06c8f3f0a17a8a5bb90ed9861
find_dups.py
find_dups.py
import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt import store, config try: config = config.Config(sys.argv[1], 'webui') except IndexError: print "Usage: find_dups.py config.ini" raise SystemExit store = store.Store(config) store.open() def owner_email(p): result = set() for r,u ...
Add script to email users of name-conflicting packages.
Add script to email users of name-conflicting packages.
Python
bsd-3-clause
techtonik/pydotorg.pypi,techtonik/pydotorg.pypi
--- +++ @@ -0,0 +1,46 @@ +import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt +import store, config + +try: + config = config.Config(sys.argv[1], 'webui') +except IndexError: + print "Usage: find_dups.py config.ini" + raise SystemExit + +store = store.Store(config) +store.open() + +def owner_e...
b5100e8ed538a2ffc9933efe1ef8f19e5e9f6fa8
regulations/views/notice_home.py
regulations/views/notice_home.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from operator import itemgetter import logging from django.http import Http404 from django.template.response import TemplateResponse from django.views.generic.base import View from regulations.generator.api_reader import ApiReader from regulations.vie...
Add view for notice and comment homepage.
Add view for notice and comment homepage.
Python
cc0-1.0
18F/regulations-site,eregs/regulations-site,eregs/regulations-site,eregs/regulations-site,tadhg-ohiggins/regulations-site,tadhg-ohiggins/regulations-site,18F/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site,18F/regulations-site,tadhg-ohiggins/regulations-site,18F/regulations-site
--- +++ @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals + +from operator import itemgetter + +import logging + +from django.http import Http404 +from django.template.response import TemplateResponse +from django.views.generic.base import View + +from regulations.generator.api_read...
36746f17e138efedb615eedfd672b7efb81888e2
karabo_data/tests/test_writer.py
karabo_data/tests/test_writer.py
import os.path as osp from tempfile import TemporaryDirectory from testpath import assert_isfile from karabo_data import RunDirectory, H5File def test_write_selected(mock_fxe_run): with TemporaryDirectory() as td: new_file = osp.join(td, 'test.h5') with RunDirectory(mock_fxe_run) as run: ...
Add test of writing a file
Add test of writing a file
Python
bsd-3-clause
European-XFEL/h5tools-py
--- +++ @@ -0,0 +1,25 @@ +import os.path as osp +from tempfile import TemporaryDirectory +from testpath import assert_isfile + +from karabo_data import RunDirectory, H5File + +def test_write_selected(mock_fxe_run): + with TemporaryDirectory() as td: + new_file = osp.join(td, 'test.h5') + + with RunDi...
c7d61482938dd175e6aa6d607e9275eefd02bc2b
liwc_statistics.py
liwc_statistics.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Script to generate statistics on LIWC entities. The script calculates how many LIWC words are found. This script can be used to compare the differences in numbers of words found for the modern and historic versions of LIWC. """ from bs4 import BeautifulSoup from lxml im...
Add script to generate statistics on liwc entities in texts
Add script to generate statistics on liwc entities in texts The script count the frequencies of liwc words given a liwc dictionary (modern or historic).
Python
apache-2.0
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
--- +++ @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""Script to generate statistics on LIWC entities. + +The script calculates how many LIWC words are found. This script can be used to +compare the differences in numbers of words found for the modern and historic +versions of LIWC. +""" +from b...
d67d6d70cb7504912c95c1b1c7e4bc078d9a746d
examples/shadow_root_test.py
examples/shadow_root_test.py
from seleniumbase import BaseCase class ShadowRootTest(BaseCase): def test_shadow_root(self): self.open("https://react-shadow.herokuapp.com/Patagonia") self.click("section.weather::shadow div::shadow button") self.assert_element('section.weather::shadow img[alt="Patagonia"]') ...
Add a simple Shadow DOM / Shadow Root test
Add a simple Shadow DOM / Shadow Root test
Python
mit
seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase
--- +++ @@ -0,0 +1,14 @@ +from seleniumbase import BaseCase + + +class ShadowRootTest(BaseCase): + def test_shadow_root(self): + self.open("https://react-shadow.herokuapp.com/Patagonia") + self.click("section.weather::shadow div::shadow button") + self.assert_element('section.weather::shadow i...
13c567621bd380c77ac2bb08fd736f3362996fec
designate/storage/impl_sqlalchemy/migrate_repo/versions/046_add_indices.py
designate/storage/impl_sqlalchemy/migrate_repo/versions/046_add_indices.py
# Copyright (c) 2014 Rackspace Inc. # # Author: Tim Simmons <tim.simmons@rackspace.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
Add some helpful SQL indices
Add some helpful SQL indices Adds a few SQL indices that improve performance significantly as the Designate database grows in size. Change-Id: If68b3f7883487e5379e7ab45f51a27ef7ecb2f58 Blueprint: add-indices
Python
apache-2.0
ionrock/designate,ionrock/designate,kiall/designate-py3,ramsateesh/designate,kiall/designate-py3,ramsateesh/designate,openstack/designate,ramsateesh/designate,tonyli71/designate,cneill/designate-testing,muraliselva10/designate,cneill/designate,grahamhayes/designate,muraliselva10/designate,grahamhayes/designate,cneill/d...
--- +++ @@ -0,0 +1,76 @@ +# Copyright (c) 2014 Rackspace Inc. +# +# Author: Tim Simmons <tim.simmons@rackspace.com> +# +# 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...
fd0685960b2df7632bd384634a8ddcd1cfbde606
gmn/src/d1_gmn/app/model_util.py
gmn/src/d1_gmn/app/model_util.py
# -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2016 DataONE # # Licensed under the Apache License, Version 2.0 ...
Add utilities for working with Django models
Add utilities for working with Django models
Python
apache-2.0
DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python
--- +++ @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +# This work was created by participants in the DataONE project, and is +# jointly copyrighted by participating institutions in DataONE. For +# more information on DataONE, see our web site at http://dataone.org. +# +# Copyright 2009-2016 DataONE +# +# Licensed un...
e55f72c62cefbbda7e0e213779dedb8ec51b9a5a
bottleneck/tests/memory_test.py
bottleneck/tests/memory_test.py
import numpy as np import sys import bottleneck as bn import pytest @pytest.mark.skipif( sys.platform.startswith("win"), reason="resource module not available on windows" ) def test_memory_leak(): import resource arr = np.arange(1).reshape((1, 1)) starting = resource.getrusage(resource.RUSAGE_SELF)....
Add memory leak regression test
TST: Add memory leak regression test
Python
bsd-2-clause
pydata/bottleneck,pydata/bottleneck,kwgoodman/bottleneck,kwgoodman/bottleneck,pydata/bottleneck,kwgoodman/bottleneck
--- +++ @@ -0,0 +1,35 @@ +import numpy as np +import sys +import bottleneck as bn +import pytest + + +@pytest.mark.skipif( + sys.platform.startswith("win"), reason="resource module not available on windows" +) +def test_memory_leak(): + import resource + + arr = np.arange(1).reshape((1, 1)) + + starting =...
635b8b61be67a2c0f38ec95b30d9848dcd30de58
test_primes.py
test_primes.py
#!/usr/bin/env python2 if __name__ == '__main__': from find_primes import find_primes assert find_primes(50) == [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] print 'All tests passed!'
Add a simple test of the trial division algorithm.
Add a simple test of the trial division algorithm.
Python
mit
ipqb/bootcamp-primes-activity
--- +++ @@ -0,0 +1,9 @@ +#!/usr/bin/env python2 + +if __name__ == '__main__': + from find_primes import find_primes + + assert find_primes(50) == [ + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] + + print 'All tests passed!'
dbf436758f4b55010dcea6cea4416741ce21df8a
tests/conftest.py
tests/conftest.py
# Copyright (c) 2022. The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details from typing import cast import pytest from coverage.annotate import os from sqlalchemy import event from sql...
Add `session` and `connection` fixtures
Add `session` and `connection` fixtures
Python
apache-2.0
agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft
--- +++ @@ -0,0 +1,79 @@ +# Copyright (c) 2022. The Pycroft Authors. See the AUTHORS file. +# This file is part of the Pycroft project and licensed under the terms of +# the Apache License, Version 2.0. See the LICENSE file for details +from typing import cast + +import pytest +from coverage.annotate import os +fr...
087abbfa1f45f76cc86e4fc658d231af8a949264
tests/test_env.py
tests/test_env.py
import sys from botbot import env, envchecks def test_EnvironmentChecker_constructor(): assert env.EnvironmentChecker(sys.stdout) def test_env_check_constructor_register(): ec = env.EnvironmentChecker(sys.stdout, envchecks.ALLENVCHECKS) assert ec.checks def test_env_check_register_multiple_args(): e...
Add tests for EnvironmentChecker object
Add tests for EnvironmentChecker object
Python
mit
jackstanek/BotBot,jackstanek/BotBot
--- +++ @@ -0,0 +1,20 @@ +import sys + +from botbot import env, envchecks + +def test_EnvironmentChecker_constructor(): + assert env.EnvironmentChecker(sys.stdout) + +def test_env_check_constructor_register(): + ec = env.EnvironmentChecker(sys.stdout, envchecks.ALLENVCHECKS) + assert ec.checks + +def test_en...
77cb10ac2d524c43f43387d6c62f757c3e37fbbe
py/maximum-swap.py
py/maximum-swap.py
class Solution(object): def maximumSwap(self, num): """ :type num: int :rtype: int """ counter = [0] * 10 snum = str(num) lnum = len(snum) for d in map(int, snum): counter[d] += 1 for i, d in enumerate(map(int, snum)): f...
Add py solution for 670. Maximum Swap
Add py solution for 670. Maximum Swap 670. Maximum Swap: https://leetcode.com/problems/maximum-swap/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,19 @@ +class Solution(object): + def maximumSwap(self, num): + """ + :type num: int + :rtype: int + """ + counter = [0] * 10 + snum = str(num) + lnum = len(snum) + for d in map(int, snum): + counter[d] += 1 + for i, d in e...
54749556c7c689bfd2bee85f60a69676cc74035b
capomastro_wsgi.py
capomastro_wsgi.py
""" WSGI config for capomastro project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ """ import os app_root = os.path.dirname(os.path.realpath(__file__)) activate_this = os.path.join...
Add temporary bootstrapping to get the service working with how the charm presently expects to run the app.
Add temporary bootstrapping to get the service working with how the charm presently expects to run the app.
Python
mit
timrchavez/capomastro,timrchavez/capomastro
--- +++ @@ -0,0 +1,19 @@ +""" +WSGI config for capomastro project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ +""" + +import os + +app_root = os.path.dirname(os.path.realpath(...
186e8424a16188825210b4c05656ae3b8fcc28c2
provpy/provpyexample_Elements.py
provpy/provpyexample_Elements.py
import json from provpy import * # Define your namespaces (see provpyexample_PROVURIRef_PROVNamespace.py) FOAF = PROVNamespace("http://xmlns.com/foaf/0.1/") ex = PROVNamespace("http://www.example.com/") dcterms = PROVNamespace("http://purl.org/dc/terms/") xsd = PROVNamespace('http://www.w3.org/2001/XMLSchema-datatypes...
Add an example file demonstrating defining, adding and serializing prov elements in a prov container
Add an example file demonstrating defining, adding and serializing prov elements in a prov container
Python
mit
satra/prov,krischer/prov,trungdong/prov,krischer/prov
--- +++ @@ -0,0 +1,51 @@ +import json +from provpy import * + +# Define your namespaces (see provpyexample_PROVURIRef_PROVNamespace.py) +FOAF = PROVNamespace("http://xmlns.com/foaf/0.1/") +ex = PROVNamespace("http://www.example.com/") +dcterms = PROVNamespace("http://purl.org/dc/terms/") +xsd = PROVNamespace('http://...
c44c26949b896840fe22e4f947decee1ac7b2382
examples/customizable_hotkey.py
examples/customizable_hotkey.py
import keyboard print('Press and release your desired shortcut: ') shortcut = keyboard.read_shortcut() print('Shortcut selected:', shortcut) def on_triggered(): print("Triggered!") keyboard.add_hotkey(shortcut, on_triggered) print("Press ESC to stop.") keyboard.wait('esc')
Add example for customizable hotkeys
Add example for customizable hotkeys
Python
mit
glitchassassin/keyboard,boppreh/keyboard
--- +++ @@ -0,0 +1,12 @@ +import keyboard + +print('Press and release your desired shortcut: ') +shortcut = keyboard.read_shortcut() +print('Shortcut selected:', shortcut) + +def on_triggered(): + print("Triggered!") +keyboard.add_hotkey(shortcut, on_triggered) + +print("Press ESC to stop.") +keyboard.wait('esc')
e68e9bc397d760a0d16acc695a1815141ad3658c
elmo/moon_tracker/utils.py
elmo/moon_tracker/utils.py
def user_can_view_scans(user, moon): return ( user_can_delete_scans(user, moon) or user.has_perm('eve_sde.can_view_scans', moon.planet.system) or user.has_perm('eve_sde.can_view_scans', moon.planet.system.constellation) or user.has_perm('eve_sde.can_view_scans', moon.planet.system.co...
Add helper functions for permissions.
Add helper functions for permissions.
Python
mit
StephenSwat/eve_lunar_mining_organiser,StephenSwat/eve_lunar_mining_organiser
--- +++ @@ -0,0 +1,22 @@ +def user_can_view_scans(user, moon): + return ( + user_can_delete_scans(user, moon) or + user.has_perm('eve_sde.can_view_scans', moon.planet.system) or + user.has_perm('eve_sde.can_view_scans', moon.planet.system.constellation) or + user.has_perm('eve_sde.can_v...
10f5e0585d471fdfb79181956baaa83d3dac5008
test/test_match.py
test/test_match.py
# encoding: utf-8 """ Tests for the udiskie.match module. These tests are intended to demonstrate and ensure the correct usage of the config file used by udiskie for custom device options. """ import unittest import tempfile import shutil import os.path import gc from udiskie.match import OptionFilter, FilterMatche...
Add unit tests for udiskie.match
Add unit tests for udiskie.match I hope this proves my modifications to be working.
Python
mit
coldfix/udiskie,coldfix/udiskie,khardix/udiskie,mathstuf/udiskie,pstray/udiskie,pstray/udiskie
--- +++ @@ -0,0 +1,78 @@ +# encoding: utf-8 +""" +Tests for the udiskie.match module. + +These tests are intended to demonstrate and ensure the correct usage of the +config file used by udiskie for custom device options. + +""" +import unittest + +import tempfile +import shutil +import os.path +import gc + +from udis...
c672e12779061a7999ce5802730fd2502a68a8ce
l10n_it_ipa/model/partner.py
l10n_it_ipa/model/partner.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 KTec S.r.l. # (<http://www.ktec.it>). # # Copyright (C) 2014 Associazione Odoo Italia # (<http://www.odoo-italia.org>). # # This program is free software: you can redistribute it ...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 KTec S.r.l. # (<http://www.ktec.it>). # # Copyright (C) 2014 Associazione Odoo Italia # (<http://www.odoo-italia.org>). # # This program is free software: you can redistribute it ...
Use PascaleCase notation in class
Use PascaleCase notation in class
Python
agpl-3.0
linkitspa/l10n-italy,hurrinico/l10n-italy,ApuliaSoftware/l10n-italy,linkitspa/l10n-italy,luca-vercelli/l10n-italy,linkitspa/l10n-italy,maxhome1/l10n-italy,abstract-open-solutions/l10n-italy,alessandrocamilli/l10n-italy,scigghia/l10n-italy,odoo-isa/l10n-italy
--- +++ @@ -26,9 +26,7 @@ from openerp import fields -class res_partner(models.Model): +class ResPartner(models.Model): _inherit = 'res.partner' - ipa_code = fields.Char( - 'IPA Code' - ) + ipa_code = fields.Char(string='IPA Code')
be465be9b2224eadb93203f10ad4972d1d6e5dc4
python_apps/pypo/pure.py
python_apps/pypo/pure.py
import re def version_cmp(version1, version2): def normalize(v): return [int(x) for x in re.sub(r'(\.0+)*$','', v).split(".")] return cmp(normalize(version1), normalize(version2))
Make sure Liquidsoap 1.1.1 is used
CC-5133: Make sure Liquidsoap 1.1.1 is used add missing file
Python
agpl-3.0
radiorabe/airtime,sourcefabric/Airtime,ReganDryke/airtime,radiorabe/airtime,comiconomenclaturist/libretime,radiorabe/airtime,sourcefabric/airtime,LibreTime/libretime,justvanbloom/airtime,comiconomenclaturist/libretime,thnkloud9/Airtime,Lapotor/libretime,justvanbloom/airtime,LibreTime/libretime,justvanbloom/airtime,Rega...
--- +++ @@ -0,0 +1,7 @@ +import re + + +def version_cmp(version1, version2): + def normalize(v): + return [int(x) for x in re.sub(r'(\.0+)*$','', v).split(".")] + return cmp(normalize(version1), normalize(version2))