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
ce3af1f615b0979f8fcaf0fcec2efb1d73c13a36
api/tests/v2/test_token_update.py
api/tests/v2/test_token_update.py
from django.core.urlresolvers import reverse from rest_framework.test import APITestCase, APIRequestFactory, force_authenticate from api.tests.factories import UserFactory, AnonymousUserFactory, ProviderFactory from api.v2.views import TokenUpdateViewSet, IdentityViewSet, CredentialViewSet class TokenUpdateTests(APITe...
Include test file for token_update API
Include test file for token_update API
Python
apache-2.0
CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend
--- +++ @@ -0,0 +1,61 @@ +from django.core.urlresolvers import reverse +from rest_framework.test import APITestCase, APIRequestFactory, force_authenticate +from api.tests.factories import UserFactory, AnonymousUserFactory, ProviderFactory +from api.v2.views import TokenUpdateViewSet, IdentityViewSet, CredentialViewSe...
3c5d21b41c78b87e1567453b4a6f15ca3d97c966
pyblogit/blog_model.py
pyblogit/blog_model.py
""" pyblogit.blog_model ~~~~~~~~~~~~~~~~~~~ This module contains the data model to represent a blog and methods to manipulate it. """ class blog(object): """The blog data model""" def __init__(self, blog_id, name, url, desc, posts, pages): self._blog_id = blog_id self._name = name sel...
Add class to represent a blog
Add class to represent a blog
Python
mit
jamalmoir/pyblogit
--- +++ @@ -0,0 +1,42 @@ +""" +pyblogit.blog_model +~~~~~~~~~~~~~~~~~~~ + +This module contains the data model to represent a blog and methods to +manipulate it. +""" + +class blog(object): + """The blog data model""" + + def __init__(self, blog_id, name, url, desc, posts, pages): + self._blog_id = blog_...
9a80f30acc2b57c37726d765977ff471b0033e1a
ideascube/conf/idb_jor_zaatari.py
ideascube/conf/idb_jor_zaatari.py
# -*- coding: utf-8 -*- """Ideaxbox for Zaatari, Jordan""" from .idb import * # noqa from django.utils.translation import ugettext_lazy as _ IDEASCUBE_NAME = u"Zaatari" IDEASCUBE_PLACE_NAME = _("city") COUNTRIES_FIRST = ['SY', 'JO'] TIME_ZONE = 'Asia/Amman' LANGUAGE_CODE = 'ar' LOAN_DURATION = 14 MONITORING_ENTRY_EXP...
Add configuration for Zaatari, Jordan.
Add configuration for Zaatari, Jordan.
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
--- +++ @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +"""Ideaxbox for Zaatari, Jordan""" +from .idb import * # noqa +from django.utils.translation import ugettext_lazy as _ + +IDEASCUBE_NAME = u"Zaatari" +IDEASCUBE_PLACE_NAME = _("city") +COUNTRIES_FIRST = ['SY', 'JO'] +TIME_ZONE = 'Asia/Amman' +LANGUAGE_CODE = 'ar' +L...
b0e6556a908c1c520b060ea868fb18ea00bea4d9
moderation/migrations/0007_auto_20141207_1025.py
moderation/migrations/0007_auto_20141207_1025.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('moderation', '0006_auto_20141104_1434'), ] operations = [ migr...
Add migration for translation cleanup
Add migration for translation cleanup
Python
bsd-3-clause
f3r3nc/connect,nlhkabu/connect,f3r3nc/connect,nlhkabu/connect,f3r3nc/connect,nlhkabu/connect,nlhkabu/connect,f3r3nc/connect
--- +++ @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('moderation', '0006_auto_20141104_1434'),...
50ed5c6566fb684bfea125d7084a5972edbe5c2a
test/unit/test_log.py
test/unit/test_log.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import pytest from bark.log import Log def test_create(): '''Test creating a Log instance.''' log = Log(name='bark.test.log') assert log.items() == [('name', 'bark.test.log')] def test_string_repres...
Add basic unit tests for Log.
Add basic unit tests for Log.
Python
apache-2.0
4degrees/mill,4degrees/sawmill
--- +++ @@ -0,0 +1,51 @@ +# :coding: utf-8 +# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips +# :license: See LICENSE.txt. + +import pytest + +from bark.log import Log + + +def test_create(): + '''Test creating a Log instance.''' + log = Log(name='bark.test.log') + assert log.items() == [('name', 'b...
b5a5f381d69260df65248d0e2ff99b9a7c47ffe7
tests/test_general.py
tests/test_general.py
import os import unittest from mpower.opr import OPR from mpower.store import Store from . import MP_ACCESS_TOKENS class TestGeneral(unittest.TestCase): """General/Miscellaneous tests""" def setUp(self): # Your MPower developer tokens self.store = Store({"name":"FooBar store"}) self.op...
Add a 'general' unit tests file
Add a 'general' unit tests file This 'general' unit tests is responsible for all miscellaneous/general functionalities
Python
mit
mawuli/mpower-python,rpip/mpower-python
--- +++ @@ -0,0 +1,46 @@ +import os +import unittest +from mpower.opr import OPR +from mpower.store import Store +from . import MP_ACCESS_TOKENS + + +class TestGeneral(unittest.TestCase): + """General/Miscellaneous tests""" + def setUp(self): + # Your MPower developer tokens + self.store = Store({...
5ae52b9e16b073322550f0a7ed9d560f5f823847
tests/test_hackage.py
tests/test_hackage.py
from tests.helper import ExternalVersionTestCase class HackageTest(ExternalVersionTestCase): def test_hackage(self): self.assertEqual(self.sync_get_version("sessions", {"hackage": None}), "2008.7.18")
Add a testcase for Hackage
Add a testcase for Hackage
Python
mit
lilydjwg/nvchecker
--- +++ @@ -0,0 +1,6 @@ +from tests.helper import ExternalVersionTestCase + + +class HackageTest(ExternalVersionTestCase): + def test_hackage(self): + self.assertEqual(self.sync_get_version("sessions", {"hackage": None}), "2008.7.18")
9320338b7edebdf864bfe8d3dd6cfb1a5c2f868d
util/calc_ir_table.py
util/calc_ir_table.py
#! /usr/bin/env python import sys it = iter(l) for i,j in zip(it, it): aij.append(i/2**39+j/2**32), for i in range(0, len(aij)): sys.stdout.write("{0:.10e}f, ".format(aij[i])) if (i+1)%8==0: print()
Add MLX IR table generator.
Add MLX IR table generator.
Python
mit
iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv,openmv/openmv,openmv/openmv,kwagyeman/openmv,iabdalkader/openmv,kwagyeman/openmv,iabdalkader/openmv
--- +++ @@ -0,0 +1,12 @@ +#! /usr/bin/env python +import sys + +it = iter(l) + +for i,j in zip(it, it): + aij.append(i/2**39+j/2**32), + +for i in range(0, len(aij)): + sys.stdout.write("{0:.10e}f, ".format(aij[i])) + if (i+1)%8==0: + print()
e29dc1788292930d4d9585b5ef764ffdf567ade3
show_usbcamera.py
show_usbcamera.py
#! /usr/bin/env python # # Show the USB camera # # # External dependencies # import sys from PySide import QtGui import VisionToolkit as vtk # # Main application # if __name__ == '__main__' : application = QtGui.QApplication( sys.argv ) widget = vtk.UsbCameraWidget() widget.show() sys.exit( appli...
Add a script to display a USB camera.
Add a script to display a USB camera.
Python
mit
microy/VisionToolkit,microy/PyStereoVisionToolkit,microy/VisionToolkit,microy/StereoVision,microy/StereoVision,microy/PyStereoVisionToolkit
--- +++ @@ -0,0 +1,25 @@ +#! /usr/bin/env python + + +# +# Show the USB camera +# + + +# +# External dependencies +# +import sys +from PySide import QtGui +import VisionToolkit as vtk + + +# +# Main application +# +if __name__ == '__main__' : + + application = QtGui.QApplication( sys.argv ) + widget = vtk.UsbCa...
db9772f5cd856f4fa66625d229982e2546574f59
avalonstar/apps/subscribers/migrations/0005_count.py
avalonstar/apps/subscribers/migrations/0005_count.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('subscribers', '0004_auto_20150224_1454'), ] operations = [ migrations....
Add a migration for Count.
Add a migration for Count.
Python
apache-2.0
bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv
--- +++ @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import datetime +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('subscribers', '0004_auto_20150224_1454'), + ]...
1d94290cdf5b0a111924ff9aa73d69b9e0f41165
scripts/update_thanks.py
scripts/update_thanks.py
#!/usr/bin/env python # Usage: git log --format="%an <%ae>" | python update_thanks.py # You will get a result.txt file, you can work with the file (update, remove, ...) # # Install # ======= # pip install validate_email pyDNS # from __future__ import print_function import os import sys from validate_email import valid...
Add the script for the THANKS file
Add the script for the THANKS file
Python
mit
prezi/gunicorn,malept/gunicorn,jamesblunt/gunicorn,mvaled/gunicorn,prezi/gunicorn,harrisonfeng/gunicorn,GitHublong/gunicorn,keakon/gunicorn,zhoucen/gunicorn,malept/gunicorn,zhoucen/gunicorn,ccl0326/gunicorn,jamesblunt/gunicorn,mvaled/gunicorn,ccl0326/gunicorn,gtrdotmcs/gunicorn,1stvamp/gunicorn,WSDC-NITWarangal/gunicor...
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# Usage: git log --format="%an <%ae>" | python update_thanks.py +# You will get a result.txt file, you can work with the file (update, remove, ...) +# +# Install +# ======= +# pip install validate_email pyDNS +# +from __future__ import print_function +import os +import...
d766bfc19ce627e5141e6ab355957eb1fa5d716d
sii/utils.py
sii/utils.py
import ssl def fix_ssl_verify(): try: _create_unverified_https_context = ssl._create_unverified_context except AttributeError: # Legacy Python that doesn't verify HTTPS certificates by default pass else: # Handle target environment that doesn't support HTTPS verification ...
Add function to not verify ssl
Add function to not verify ssl
Python
mit
gisce/sii
--- +++ @@ -0,0 +1,12 @@ +import ssl + + +def fix_ssl_verify(): + try: + _create_unverified_https_context = ssl._create_unverified_context + except AttributeError: + # Legacy Python that doesn't verify HTTPS certificates by default + pass + else: + # Handle target environment that...
964a0f848786cdbbf0b41c46cb66d3ec1a255120
hacks.py
hacks.py
import ConfigParser import requests import urllib def get_settings(_config_cache=[]): config = ConfigParser.RawConfigParser() config.read(['settings.ini']) return config def meetup_urls(method='groups.json'): base_url = 'http://api.meetup.com/' url = (base_url + method) return (url, {'key': ge...
Add minimal script to get top 200 Python-related Meetup groups
Add minimal script to get top 200 Python-related Meetup groups
Python
apache-2.0
paulproteus/pug-meta-organizing
--- +++ @@ -0,0 +1,21 @@ +import ConfigParser +import requests +import urllib + +def get_settings(_config_cache=[]): + config = ConfigParser.RawConfigParser() + config.read(['settings.ini']) + return config + +def meetup_urls(method='groups.json'): + base_url = 'http://api.meetup.com/' + url = (base_ur...
1bef42bceaa3b188f3f54d97d6927dc9c86a8598
text-and-point.py
text-and-point.py
# On some systems, need to import like this: # import Image # import ImageDraw # On others, import like this: from PIL import Image, ImageDraw im = Image.new('RGB', (100, 100)) draw = ImageDraw.Draw(im) red = (255, 0, 0) draw.text((5,5), 'Hello', red) draw.point((50, 50), red) im.save('f.png')
Add simple script to print text and a point
Add simple script to print text and a point
Python
mit
redpig2/pilhacks
--- +++ @@ -0,0 +1,16 @@ +# On some systems, need to import like this: +# import Image +# import ImageDraw + +# On others, import like this: +from PIL import Image, ImageDraw + +im = Image.new('RGB', (100, 100)) + +draw = ImageDraw.Draw(im) +red = (255, 0, 0) +draw.text((5,5), 'Hello', red) +draw.point((50, 50), red)...
8e3f9cdc55fae71634559c83637e8ab3d69b732d
src/main/resources/script_templates/Hadim_Scripts/ROI/Circle_ROI_Builder.py
src/main/resources/script_templates/Hadim_Scripts/ROI/Circle_ROI_Builder.py
# @Float(label="Diameter of the circle ROI (pixel)", value=7) circle_diam from ij.plugin.frame import RoiManager from ij.gui import OvalRoi rm = RoiManager.getInstance() new_rois = [] for roi in rm.getRoisAsArray(): assert roi.getTypeAsString() == 'Point', "ROI needs to be a point" x_center = roi.getContainedPoint...
Add circle roi builder script
Add circle roi builder script
Python
bsd-3-clause
hadim/fiji_scripts,hadim/fiji_tools,hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_tools
--- +++ @@ -0,0 +1,21 @@ +# @Float(label="Diameter of the circle ROI (pixel)", value=7) circle_diam + +from ij.plugin.frame import RoiManager +from ij.gui import OvalRoi + +rm = RoiManager.getInstance() + +new_rois = [] +for roi in rm.getRoisAsArray(): + assert roi.getTypeAsString() == 'Point', "ROI needs to be a poi...
43eddc3663f64e92a673c09ce52ddcd50b935842
ipywidgets/widgets/tests/test_widget_float.py
ipywidgets/widgets/tests/test_widget_float.py
from unittest import TestCase from traitlets import TraitError from ipywidgets import FloatSlider class TestFloatSlider(TestCase): def test_construction(self): FloatSlider() def test_construction_readout_format(self): slider = FloatSlider(readout_format='$.1f') assert slider.get_s...
Test that the float slider uses the NumberFormat traitlet
Test that the float slider uses the NumberFormat traitlet
Python
bsd-3-clause
ipython/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets
--- +++ @@ -0,0 +1,20 @@ + +from unittest import TestCase + +from traitlets import TraitError + +from ipywidgets import FloatSlider + + +class TestFloatSlider(TestCase): + + def test_construction(self): + FloatSlider() + + def test_construction_readout_format(self): + slider = FloatSlider(readout_...
db3749beefb5d8d33dae2044aa4ac09b1d3a0d80
tests/test_movingfiles.py
tests/test_movingfiles.py
#!/usr/bin/env python #encoding:utf-8 #author:dbr/Ben #project:tvnamer #repository:http://github.com/dbr/tvnamer #license:Creative Commons GNU GPL v2 # http://creativecommons.org/licenses/GPL/2.0/ """Tests moving renamed files """ from functional_runner import run_tvnamer, verify_out_data def test_simple_realtive_m...
Add (currently failing) test for file moving
Add (currently failing) test for file moving
Python
unlicense
dbr/tvnamer,lahwaacz/tvnamer,m42e/tvnamer
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/env python +#encoding:utf-8 +#author:dbr/Ben +#project:tvnamer +#repository:http://github.com/dbr/tvnamer +#license:Creative Commons GNU GPL v2 +# http://creativecommons.org/licenses/GPL/2.0/ + +"""Tests moving renamed files +""" + +from functional_runner import run_tvnamer, verif...
f4f6b1af7c11389666cf5ec562fef874388eb5a3
loess.py
loess.py
from pylab import * def loessInternal( x, h, xp, yp ): w = exp( -0.5*( ((x-xp)/(2*h))**2 )/sqrt(2*pi*h**2) ) b = sum(w*xp)*sum(w*yp) - sum(w)*sum(w*xp*yp) b /= sum(w*xp)**2 - sum(w)*sum(w*xp**2) a = ( sum(w*yp) - b*sum(w*xp) )/sum(w) return a + b*x def loess(x,y,h): """LOESS model free bandw...
Add LOESS module for model free bandwidth reduction.
Add LOESS module for model free bandwidth reduction.
Python
mit
bennomeier/pyNMR,kourk0am/pyNMR
--- +++ @@ -0,0 +1,23 @@ +from pylab import * + +def loessInternal( x, h, xp, yp ): + w = exp( -0.5*( ((x-xp)/(2*h))**2 )/sqrt(2*pi*h**2) ) + b = sum(w*xp)*sum(w*yp) - sum(w)*sum(w*xp*yp) + + b /= sum(w*xp)**2 - sum(w)*sum(w*xp**2) + a = ( sum(w*yp) - b*sum(w*xp) )/sum(w) + + return a + b*x + +def loes...
eb25f8bd1ab344d951f78cfe1e655e4f755bebd6
bin/verify-identity.py
bin/verify-identity.py
"""verify-identity.py <participant_id>, <country_code> """ from __future__ import absolute_import, division, print_function, unicode_literals import sys from gratipay import wireup from gratipay.models.participant import Participant from gratipay.models.country import Country wireup.db(wireup.env()) participant = P...
Write a script to verify identity
Write a script to verify identity
Python
mit
gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com
--- +++ @@ -0,0 +1,15 @@ +"""verify-identity.py <participant_id>, <country_code> +""" +from __future__ import absolute_import, division, print_function, unicode_literals + +import sys + +from gratipay import wireup +from gratipay.models.participant import Participant +from gratipay.models.country import Country + +wi...
0eddc59a97fca233b5979d61a19f58179c57bc08
CodeFights/twoLines.py
CodeFights/twoLines.py
#!/usr/local/bin/python # Code Fights Two Lines Problem from functools import partial def line_y(m, b, x): return m * x + b def twoLines(line1, line2, l, r): line1_y = partial(line_y, *line1) line2_y = partial(line_y, *line2) balance = 0 for x in range(l, r + 1): y1 = line1_y(x) ...
Solve Code Fights two lines problem
Solve Code Fights two lines problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,51 @@ +#!/usr/local/bin/python +# Code Fights Two Lines Problem + +from functools import partial + + +def line_y(m, b, x): + return m * x + b + + +def twoLines(line1, line2, l, r): + line1_y = partial(line_y, *line1) + line2_y = partial(line_y, *line2) + balance = 0 + for x in range(...
2594b559722efa75322e669792cf8b9ba14f5014
Data-Structures/Trees/Binary_Trees/binary_tree.py
Data-Structures/Trees/Binary_Trees/binary_tree.py
"""Implementation of a Binary Tree in Python.""" class BinaryTree: def __init__(self, root_node): self.key = root_node self.left_node = None self.right_node = None def insert_left(self, new_node): if self.left_node == None: self.left_node = BinaryTree(new_node) ...
Add python binary tree data structure
Add python binary tree data structure
Python
mit
salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook
--- +++ @@ -0,0 +1,35 @@ +"""Implementation of a Binary Tree in Python.""" + +class BinaryTree: + def __init__(self, root_node): + self.key = root_node + self.left_node = None + self.right_node = None + + def insert_left(self, new_node): + if self.left_node == None: + self...
ff81d21d5e68e916282b61b3c65bf0af41a1bad8
app/scripts/po_stats.py
app/scripts/po_stats.py
#! /usr/bin/env python import argparse import glob import json import os import subprocess import sys # Import local libraries library_path = os.path.abspath(os.path.join( os.path.dirname(__file__), os.pardir, 'libraries')) # Polib library (https://bitbucket.org/izi/polib) polib_path = os.path.join(library_path,...
Create script using polib to generate stats for gettext file
Create script using polib to generate stats for gettext file
Python
mpl-2.0
flodolo/webstatus,mozilla-l10n/webstatus,mozilla-l10n/webstatus,flodolo/webstatus,flodolo/webstatus,mozilla-l10n/webstatus,mozilla-l10n/webstatus,flodolo/webstatus,mozilla-l10n/webstatus,flodolo/webstatus
--- +++ @@ -0,0 +1,99 @@ +#! /usr/bin/env python + +import argparse +import glob +import json +import os +import subprocess +import sys + +# Import local libraries +library_path = os.path.abspath(os.path.join( + os.path.dirname(__file__), os.pardir, 'libraries')) + +# Polib library (https://bitbucket.org/izi/polib...
20b3b6415f68a25de82e5f6a3e2a3ded93d1620f
cal_pipe/plot_scans.py
cal_pipe/plot_scans.py
import numpy as np import re ms_active = raw_input("MS? : ") field_str = raw_input("Field? : ") tb.open(vis+"/FIELD") names = tb.getcol('NAME') matches = [string for string in names if re.match(field_str, string)] posn_matches = \ [i for i, string in enumerate(names) if re.match(field_str, string)] if len(mat...
Save plots of amp vs time for each scan
Save plots of amp vs time for each scan
Python
mit
e-koch/canfar_scripts,e-koch/canfar_scripts
--- +++ @@ -0,0 +1,55 @@ + +import numpy as np +import re + + +ms_active = raw_input("MS? : ") +field_str = raw_input("Field? : ") + + +tb.open(vis+"/FIELD") +names = tb.getcol('NAME') +matches = [string for string in names if re.match(field_str, string)] +posn_matches = \ + [i for i, string in enumerate(names) if...
9b46d66f89dba1f5bd2507f0a3dcddfd2758fe2b
cluster/update_jobs.py
cluster/update_jobs.py
from django.contrib.auth.models import User from models import Job from interface import get_all_jobs def run_all(): for user in User.objects.all(): creds = user.credentials.all() for i, cluster in enumerate(get_all_jobs(user)): cred = creds[i] jobs = {} for jo...
Add start for the job status updater
Add start for the job status updater
Python
mit
crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp
--- +++ @@ -0,0 +1,24 @@ +from django.contrib.auth.models import User + +from models import Job +from interface import get_all_jobs + + +def run_all(): + for user in User.objects.all(): + creds = user.credentials.all() + for i, cluster in enumerate(get_all_jobs(user)): + cred = creds[i] + ...
013f2e526c862ed8e2c9b79aba43618b381d4bd3
test/test_session_getchatserver.py
test/test_session_getchatserver.py
import mock import pytest import requests from pytwitcherapi import session @pytest.fixture(scope="function") def ts(mock_session): """Return a :class:`session.TwitchSession` and mock the request of :class:`Session` """ return session.TwitchSession() @pytest.fixture(scope='function') def mock_chatp...
Add missing test for getchatserver
Add missing test for getchatserver Forgot to track it -.-
Python
bsd-3-clause
Pytwitcher/pytwitcherapi,Pytwitcher/pytwitcherapi
--- +++ @@ -0,0 +1,71 @@ +import mock +import pytest +import requests + +from pytwitcherapi import session + + +@pytest.fixture(scope="function") +def ts(mock_session): + """Return a :class:`session.TwitchSession` + and mock the request of :class:`Session` + """ + return session.TwitchSession() + + +@pyte...
aaea0100aed4ff33c4f67518d7859b78baffd2b6
setup.py
setup.py
# -*- coding: utf-8 -*- import os from setuptools import setup def read(fname): try: return open(os.path.join(os.path.dirname(__file__), fname)).read() except: return '' setup( name='todoist-python', version='0.2.10', packages=['todoist', 'todoist.managers'], author='Doist Team...
# -*- coding: utf-8 -*- import os from setuptools import setup def read(fname): try: return open(os.path.join(os.path.dirname(__file__), fname)).read() except: return '' setup( name='todoist-python', version='0.2.11', packages=['todoist', 'todoist.managers'], author='Doist Team...
Update the PyPI version to 0.2.11
Update the PyPI version to 0.2.11
Python
mit
electronick1/todoist-python,Doist/todoist-python
--- +++ @@ -10,7 +10,7 @@ setup( name='todoist-python', - version='0.2.10', + version='0.2.11', packages=['todoist', 'todoist.managers'], author='Doist Team', author_email='info@todoist.com',
a99b2cb06acf5e4018f203c4298c62dc69655281
setup.py
setup.py
from setuptools import setup setup( name='XBlock', version='0.1', description='XBlock Core Library', packages=['xblock'], entry_points={ 'xblock.v1': [ 'helloworld = xblock.content:HelloWorldBlock', 'html = xblock.content:HtmlBlock', 'sequence = xblock.st...
from setuptools import setup setup( name='XBlock', version='0.1', description='XBlock Core Library', packages=['xblock'], requires=[ 'webob', ], entry_points={ 'xblock.v1': [ 'helloworld = xblock.content:HelloWorldBlock', 'html = xblock.content:HtmlBl...
Add webob as a requirement.
Add webob as a requirement.
Python
apache-2.0
open-craft/XBlock,Lyla-Fischer/xblock-sdk,nagyistoce/edx-xblock-sdk,cpennington/XBlock,nagyistoce/edx-XBlock,4eek/XBlock,edx/XBlock,Lyla-Fischer/xblock-sdk,stvstnfrd/xblock-sdk,edx-solutions/xblock-sdk,edx-solutions/XBlock,dcadams/xblock-sdk,stvstnfrd/xblock-sdk,Pilou81715/hackathon_edX,edx-solutions/XBlock,cpennington...
--- +++ @@ -5,6 +5,9 @@ version='0.1', description='XBlock Core Library', packages=['xblock'], + requires=[ + 'webob', + ], entry_points={ 'xblock.v1': [ 'helloworld = xblock.content:HelloWorldBlock',
955c4584a304c3b6a6dbbcf12eae3eed5e9a4cf5
scripts/python/cleanSimulation.py
scripts/python/cleanSimulation.py
#!/usr/bin/env/ python # file: cleanSimulation.py # author: Olivier Mesnard (mesnardo@gwu.edu) # description: Clean a cuIBM simulation. import os import argparse def read_inputs(): """Parses the command-line.""" # create parser parser = argparse.ArgumentParser(description='Clean PetIBM case', ...
Add script to clean a simulation
Add script to clean a simulation
Python
mit
barbagroup/cuIBM,barbagroup/cuIBM,barbagroup/cuIBM
--- +++ @@ -0,0 +1,64 @@ +#!/usr/bin/env/ python + +# file: cleanSimulation.py +# author: Olivier Mesnard (mesnardo@gwu.edu) +# description: Clean a cuIBM simulation. + + +import os +import argparse + + +def read_inputs(): + """Parses the command-line.""" + # create parser + parser = argparse.ArgumentParser(descri...
048939778e5637eff997d674395d0f6df860a3eb
tests/integration/test_debugger.py
tests/integration/test_debugger.py
# -*- coding: utf8 -*- from __future__ import unicode_literals from future.standard_library import install_aliases install_aliases() import sys import time import threading from urllib import parse as urlparse import pytest from bugbuzz import BugBuzz from bugbuzz.packages import requests # just a dummy unicode st...
Add test to reproduce bug
Add test to reproduce bug
Python
mit
victorlin/bugbuzz-python,victorlin/bugbuzz-python
--- +++ @@ -0,0 +1,57 @@ +# -*- coding: utf8 -*- +from __future__ import unicode_literals + +from future.standard_library import install_aliases +install_aliases() + +import sys +import time +import threading +from urllib import parse as urlparse + +import pytest + +from bugbuzz import BugBuzz +from bugbuzz.packages ...
d7ab04186f3b8c7c58b654a7372b1d4f3ffad64e
tests/unit/test_domain_commands.py
tests/unit/test_domain_commands.py
from caspy.domain import command, models class TestBook: def test_prepare_new_book(self): empty_book = models.Book() result = command.prepare_book(empty_book, 'now') assert isinstance(result, models.Book) assert result.created_at == 'now' def test_prepare_old_book(self): ...
Add unit tests for prepare_book
Add unit tests for prepare_book
Python
bsd-3-clause
altaurog/django-caspy,altaurog/django-caspy,altaurog/django-caspy
--- +++ @@ -0,0 +1,14 @@ +from caspy.domain import command, models + +class TestBook: + def test_prepare_new_book(self): + empty_book = models.Book() + result = command.prepare_book(empty_book, 'now') + assert isinstance(result, models.Book) + assert result.created_at == 'now' + + de...
eac5962530542e1732326c1c0173294682d6256b
models/ras_220_genes/pmc_ids_venn.py
models/ras_220_genes/pmc_ids_venn.py
"""Plot a Venn diagram showing the IDs associated with articles in PMC.""" import matplotlib_venn as mv import csv from matplotlib import pyplot as plt import plot_formatting as pf pf.set_fig_params() all_pmcids = set([]) has_doi = set([]) has_pmid = set([]) with open('PMC-ids.csv') as f: csvreader = csv.reader...
Make Venn diagram of IDs in PMC
Make Venn diagram of IDs in PMC
Python
bsd-2-clause
jmuhlich/indra,johnbachman/belpy,pvtodorov/indra,sorgerlab/indra,pvtodorov/indra,johnbachman/indra,sorgerlab/indra,johnbachman/belpy,pvtodorov/indra,bgyori/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/belpy,jmuhlich/indra,sorgerlab/belpy,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,bgyori/indra,jmuhlich/indra...
--- +++ @@ -0,0 +1,51 @@ +"""Plot a Venn diagram showing the IDs associated with articles in PMC.""" + +import matplotlib_venn as mv +import csv +from matplotlib import pyplot as plt +import plot_formatting as pf + +pf.set_fig_params() + +all_pmcids = set([]) +has_doi = set([]) +has_pmid = set([]) + +with open('PMC-i...
2ca84d16ff355a3e5a271ba800acb7c3cf4f8441
librisxl-tools/scripts/split_auth_source.py
librisxl-tools/scripts/split_auth_source.py
#!/usr/bin/env python from __future__ import unicode_literals, print_function import re from os import makedirs, path as P find_token = re.compile(r'{"(100|110|111|130|148|150|151|155|162|180|181|182|185)":').findall def split_auth_source(sourcefile, outdir): name_parts = P.basename(sourcefile).split('.', 1) ...
Add script for splitting an auth dump on primary field presence
Add script for splitting an auth dump on primary field presence
Python
apache-2.0
libris/librisxl,libris/librisxl,libris/librisxl
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env python +from __future__ import unicode_literals, print_function +import re +from os import makedirs, path as P + +find_token = re.compile(r'{"(100|110|111|130|148|150|151|155|162|180|181|182|185)":').findall + +def split_auth_source(sourcefile, outdir): + name_parts = P.bas...
d55b5aa49d2ba1c98d568660b1a91b4b552872f0
numpy/core/tests/test_scalarprint.py
numpy/core/tests/test_scalarprint.py
# -*- coding: utf-8 -*- """ Test printing of scalar types. """ import numpy as np from numpy.testing import TestCase, assert_, run_module_suite class TestRealScalars(TestCase): def test_str(self): svals = [0.0, -0.0, 1, -1, np.inf, -np.inf, np.nan] styps = [np.float16, np.float32, np.float64, np...
Add test for printing of scalar values.
TST: Add test for printing of scalar values.
Python
bsd-3-clause
ViralLeadership/numpy,githubmlai/numpy,bringingheavendown/numpy,sigma-random/numpy,groutr/numpy,anntzer/numpy,drasmuss/numpy,chatcannon/numpy,pdebuyl/numpy,ChristopherHogan/numpy,dato-code/numpy,ViralLeadership/numpy,tacaswell/numpy,tdsmith/numpy,rudimeier/numpy,leifdenby/numpy,jakirkham/numpy,solarjoe/numpy,mwiebe/num...
--- +++ @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +""" Test printing of scalar types. + +""" + +import numpy as np +from numpy.testing import TestCase, assert_, run_module_suite + + +class TestRealScalars(TestCase): + def test_str(self): + svals = [0.0, -0.0, 1, -1, np.inf, -np.inf, np.nan] + styps =...
f293d3d6aff79f424ab290347f99b85ca993e196
obfsproxy/common/transport_config.py
obfsproxy/common/transport_config.py
# -*- coding: utf-8 -*- """ Provides a class which represents a pluggable transport's configuration. """ class TransportConfig( object ): """ This class embeds configuration options for pluggable transport modules. The options are set by obfsproxy and then passed to the transport's class constructor...
Add a `TransportConfig' class which should contain configuration options (such as the state location) meant for pluggable transport modules.
Add a `TransportConfig' class which should contain configuration options (such as the state location) meant for pluggable transport modules.
Python
bsd-3-clause
david415/obfsproxy,catinred2/obfsproxy,infinity0/obfsproxy,Yawning/obfsproxy-wfpadtools,sunsong/obfsproxy,isislovecruft/obfsproxy,qdzheng/obfsproxy,masterkorp/obfsproxy,Yawning/obfsproxy,NullHypothesis/obfsproxy
--- +++ @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +""" +Provides a class which represents a pluggable transport's configuration. +""" + +class TransportConfig( object ): + + """ + This class embeds configuration options for pluggable transport modules. + + The options are set by obfsproxy and then passed t...
1ddae2ddab2f0681d52f46baf2f0ec3926508d1b
bin/cwtv_json_to_srt.py
bin/cwtv_json_to_srt.py
#!/usr/bin/env python3 # encoding: utf-8 ''' This script will convert a close captioning subtitle .json file as found on the CWTV streaming website, to a regular .srt for use in common media players. .json example: { "endTime": 10.04, "guid": "ffffffff-0000-1111-2222-aaaaaaaaaaaa", "hitType": "tag", ...
Add CWTV .json to .srt script.
Add CWTV .json to .srt script.
Python
mit
alimony/dotfiles,alimony/dotfiles
--- +++ @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +# encoding: utf-8 + +''' +This script will convert a close captioning subtitle .json file as found on the +CWTV streaming website, to a regular .srt for use in common media players. + +.json example: + +{ + "endTime": 10.04, + "guid": "ffffffff-0000-1111-2222-aa...
9502c0e816097cf65fa92c6dd255c3356cf20964
test/api_class_repr_test.py
test/api_class_repr_test.py
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT # All rights reserved. This work is under a BSD license, see LICENSE.TXT. from __future__ import print_function import pytest from .. import jenkins_api from .framework import api_select from .cfg import ApiType @pytest.mark.not_apis(ApiType.MOCK, ApiT...
Test jenkis_api ApiJob and Invocation classes __repr__ methods
Test jenkis_api ApiJob and Invocation classes __repr__ methods
Python
bsd-3-clause
lhupfeldt/jenkinsflow,lhupfeldt/jenkinsflow,lechat/jenkinsflow,lhupfeldt/jenkinsflow,lechat/jenkinsflow,lechat/jenkinsflow,lechat/jenkinsflow,lhupfeldt/jenkinsflow
--- +++ @@ -0,0 +1,23 @@ +# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT +# All rights reserved. This work is under a BSD license, see LICENSE.TXT. + +from __future__ import print_function + +import pytest + +from .. import jenkins_api +from .framework import api_select +from .cfg import ApiType + + +...
9655b7349f48fe57a72897800d353aa1df4d5783
Problems/fibMemoization.py
Problems/fibMemoization.py
#!/usr/local/bin/python3 def main(): # Test suite tests = [ [None, None], # Should throw a TypeError [4, 3], [7, 13] ] for item in tests: try: temp_result = fib_memoization(item[0]) if temp_result == item[1]: print('PASSED: fib_m...
Add memoization version to find nth Fibonacci number
Add memoization version to find nth Fibonacci number
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,47 @@ +#!/usr/local/bin/python3 + + +def main(): + # Test suite + tests = [ + [None, None], # Should throw a TypeError + [4, 3], + [7, 13] + ] + + for item in tests: + try: + temp_result = fib_memoization(item[0]) + if temp_result == ite...
8f117d62a60699b3d6b87e15962fca43339616a6
new_src/plot_multi_curves.py
new_src/plot_multi_curves.py
from __future__ import print_function import os import numpy as np import pandas as pd import matplotlib.pyplot as plt parent_dir = os.path.dirname(os.getcwd()) models_dir = os.path.join(parent_dir, "models") csv_name = "learning_curve.csv" def plot_multi_curves(dfs, labels, figure_name="learn...
Add script to plot metrics of dataset
Add script to plot metrics of dataset
Python
mit
quqixun/BrainTumorClassification,quqixun/BrainTumorClassification
--- +++ @@ -0,0 +1,65 @@ +from __future__ import print_function +import os +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt + + +parent_dir = os.path.dirname(os.getcwd()) +models_dir = os.path.join(parent_dir, "models") +csv_name = "learning_curve.csv" + + +def plot_multi_curves(dfs, labels, ...
43bba1633233a03be5d585a2341ba56860b93c6b
tests/test_finance_model.py
tests/test_finance_model.py
# Copyright (c) 2012 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. import unittest from pycroft import model from pycroft.model import session, user, finance, _all class Test_0...
Add a test to assert that transactions are balanced
Add a test to assert that transactions are balanced
Python
apache-2.0
lukasjuhrich/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft
--- +++ @@ -0,0 +1,49 @@ +# Copyright (c) 2012 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. +import unittest + +from pycroft import model +from pycroft.model import session, ...
0507bf58c7d73f91e645d64c69fcccb35542703a
VolumeUtilities.py
VolumeUtilities.py
#!/usr/bin/python from snappy import * from math import log # Global constants: PARI_PRECISION = 100 LINDEP_PRECISION = 50 EPSILON = 1e-12 # *** ATTENTION USER *** # If you want to dynamicallly change the above constants for all sessions, # or just want to keep the default values so you can revert, # do so here! Tha...
Add a new file for constants and other utilities to be thrown into.
Add a new file for constants and other utilities to be thrown into.
Python
mit
s-gilles/maps-reu-code
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/python + +from snappy import * +from math import log + +# Global constants: +PARI_PRECISION = 100 +LINDEP_PRECISION = 50 +EPSILON = 1e-12 + +# *** ATTENTION USER *** +# If you want to dynamicallly change the above constants for all sessions, +# or just want to keep the default val...
26a847a9b5f9db3279849c6cc7505d41653887c9
setup.py
setup.py
from setuptools import setup, find_packages setup( name='typesystem', version='0.1', description="An abstract type system", long_description="", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", ...
Make it a python package
Make it a python package
Python
mit
pudo/typecast,influencemapping/typesystem
--- +++ @@ -0,0 +1,34 @@ +from setuptools import setup, find_packages + + +setup( + name='typesystem', + version='0.1', + description="An abstract type system", + long_description="", + classifiers=[ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Licen...
f698ca84bf01ea36dafa11a9e4937d733737c08b
fmn/lib/tests/test_regexes.py
fmn/lib/tests/test_regexes.py
import fmn.lib class MockContext(object): def __init__(self, name): self.name = name email = MockContext('email') irc = MockContext('irc') class TestRegexes(fmn.lib.tests.Base): def test_valid_emails(self): values = [ 'awesome@fedoraproject.org', 'foo+fedora.org@bar...
Add some tests for our detail value validator(s).
Add some tests for our detail value validator(s).
Python
lgpl-2.1
jeremycline/fmn,jeremycline/fmn,jeremycline/fmn
--- +++ @@ -0,0 +1,61 @@ +import fmn.lib + + +class MockContext(object): + def __init__(self, name): + self.name = name + + +email = MockContext('email') +irc = MockContext('irc') + + +class TestRegexes(fmn.lib.tests.Base): + def test_valid_emails(self): + values = [ + 'awesome@fedorapr...
96c4e54ed7bde9e41c6c235ff1654f47da2e23f3
cms_lab_data/cms_app.py
cms_lab_data/cms_app.py
from cms.app_base import CMSApp from cms.apphook_pool import apphook_pool class DataApp(CMSApp): name = 'Data App' urls = ['cms_lab_data.urls'] app_name = 'cms_lab_data' apphook_pool.register(DataApp)
Create DataApp app hook for CMS
Create DataApp app hook for CMS
Python
bsd-3-clause
mfcovington/djangocms-lab-data,mfcovington/djangocms-lab-data,mfcovington/djangocms-lab-data
--- +++ @@ -0,0 +1,10 @@ +from cms.app_base import CMSApp +from cms.apphook_pool import apphook_pool + + +class DataApp(CMSApp): + name = 'Data App' + urls = ['cms_lab_data.urls'] + app_name = 'cms_lab_data' + +apphook_pool.register(DataApp)
9801764a4b60a4ca6630936cdc1e8f85beb6020b
cea/tests/test_inputs_setup_workflow.py
cea/tests/test_inputs_setup_workflow.py
import os import unittest import cea.config from cea.utilities import create_polygon from cea.datamanagement import zone_helper, surroundings_helper, terrain_helper, streets_helper, data_initializer, \ archetypes_mapper # Zug site coordinates POLYGON_COORDINATES = [(8.513465734818856, 47.178027239429234), (8.5154...
Add test for input setup workflow
Add test for input setup workflow
Python
mit
architecture-building-systems/CEAforArcGIS,architecture-building-systems/CEAforArcGIS
--- +++ @@ -0,0 +1,35 @@ +import os +import unittest + +import cea.config +from cea.utilities import create_polygon +from cea.datamanagement import zone_helper, surroundings_helper, terrain_helper, streets_helper, data_initializer, \ + archetypes_mapper + +# Zug site coordinates +POLYGON_COORDINATES = [(8.51346573...
4fe20a71ef3a432a8e53bf498d847d9a66b099e9
migrations/002_add_month_start.py
migrations/002_add_month_start.py
""" Add _week_start_at field to all documents in all collections """ from backdrop.core.bucket import utc from backdrop.core.records import Record import logging log = logging.getLogger(__name__) def up(db): for name in db.collection_names(): log.info("Migrating collection: {0}".format(name)) col...
Add migration for monthly data
Add migration for monthly data
Python
mit
alphagov/backdrop,alphagov/backdrop,alphagov/backdrop
--- +++ @@ -0,0 +1,23 @@ +""" +Add _week_start_at field to all documents in all collections +""" +from backdrop.core.bucket import utc +from backdrop.core.records import Record +import logging + +log = logging.getLogger(__name__) + + +def up(db): + for name in db.collection_names(): + log.info("Migrating co...
b737cbbd3425d2c661ffa73bff39b18b30d8f914
cwappy/libcwap_test.py
cwappy/libcwap_test.py
#!/usr/bin/env python import libcwap def reader(size): print "Got read" return 'T' * size def callback(name): def actual_callback(*args, **kwargs): print name, 'got args', args, 'and kwargs', kwargs return actual_callback actions = ( callback("time_request_function"), callback("speak...
Add file for testing libcwap from the python side
Add file for testing libcwap from the python side
Python
mit
xim/tsoc,xim/tsoc,xim/tsoc,xim/tsoc
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import libcwap + +def reader(size): + print "Got read" + return 'T' * size + +def callback(name): + def actual_callback(*args, **kwargs): + print name, 'got args', args, 'and kwargs', kwargs + return actual_callback + +actions = ( + callback("ti...
8533068444eacf4a7731d3543b9308cd6d41b51d
Core/Color.py
Core/Color.py
# -*- coding:utf-8 -*- # *************************************************************************** # Color.py # ------------------- # update : 2013-11-21 # copyright : (C) 2013 by Michaël Roy # email : mic...
Add some color utility functions.
Add some color utility functions.
Python
mit
microy/MeshToolkit,microy/PyMeshToolkit,microy/MeshToolkit,microy/PyMeshToolkit
--- +++ @@ -0,0 +1,81 @@ +# -*- coding:utf-8 -*- + +# *************************************************************************** +# Color.py +# ------------------- +# update : 2013-11-21 +# copyright : (C) 2013 by Michaël R...
70294b332920d23f97c93c720e6078e6358b7272
prjxray/xyaml.py
prjxray/xyaml.py
#!/usr/bin/env python3 import io import re import yaml import json import unittest def load(f): data = f.read() # Strip out of !<tags> data = re.sub("!<[^>]*>", "", data) return yaml.load(io.StringIO(data)) def tojson(f): d = load(f) return json.dumps(d, sort_keys=True, indent=4) class XYa...
Add wrapper to allow easy loading of yaml files.
Add wrapper to allow easy loading of yaml files. Fixes #327. Signed-off-by: Tim 'mithro' Ansell <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@mith.ro>
Python
isc
SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray
--- +++ @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +import io +import re +import yaml +import json +import unittest + + +def load(f): + data = f.read() + # Strip out of !<tags> + data = re.sub("!<[^>]*>", "", data) + return yaml.load(io.StringIO(data)) + + +def tojson(f): + d = load(f) + return json.d...
8479da007990d561147951440f1f520ebbcfdadc
spyder_unittest/tests/test_unittestplugin.py
spyder_unittest/tests/test_unittestplugin.py
# -*- coding: utf-8 -*- # # Copyright © 2017 Spyder Project Contributors # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """Tests for unittestplugin.py""" # Third party imports from qtpy.QtWidgets import QWidget import pytest # Local imports from spyder_unittest.unittestplugin import Uni...
Add baseline test for initializing plugin
Add baseline test for initializing plugin
Python
mit
jitseniesen/spyder-unittest
--- +++ @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# +# Copyright © 2017 Spyder Project Contributors +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) +"""Tests for unittestplugin.py""" + +# Third party imports +from qtpy.QtWidgets import QWidget +import pytest + +# Local imports +from s...
fbb07f1448d7759c13db735f34d30a86938b8bf4
tests/test_postgresql.py
tests/test_postgresql.py
import pytest from mock import MagicMock import zmon_aws_agent.postgresql as postgresql def test_get_databases_from_clusters(): pgclusters = [ { 'id': 'test-1', 'dnsname': 'test-1.db.zalan.do' } ] acc = '1234567890' region = 'eu-xxx-1' postgresql.list_post...
Add minimal test for new postgresql.py module
Add minimal test for new postgresql.py module
Python
apache-2.0
zalando/zmon-aws-agent,zalando/zmon-aws-agent
--- +++ @@ -0,0 +1,47 @@ +import pytest +from mock import MagicMock + +import zmon_aws_agent.postgresql as postgresql + + +def test_get_databases_from_clusters(): + pgclusters = [ + { + 'id': 'test-1', + 'dnsname': 'test-1.db.zalan.do' + } + ] + acc = '1234567890' + reg...
2bbffd5eec2e42897969e504551c16d4abbf5ba9
tests/test_test_utils.py
tests/test_test_utils.py
from django.test import TestCase from constance import config from constance.test import override_config class OverrideConfigFunctionDecoratorTestCase(TestCase): """Test that the override_config decorator works correctly. Test usage of override_config on test method and as context manager. """ def t...
Add test cases for override_config
Add test cases for override_config Test usage of override_config in different forms Ensure flexibility between decorator and context manager
Python
bsd-3-clause
pombredanne/django-constance,winzard/django-constance,jonzlin95/django-constance,pombredanne/django-constance,jonzlin95/django-constance,jazzband/django-constance,dmugtasimov/django-constance,jezdez/django-constance,APSL/django-constance,jazzband/django-constance,dmugtasimov/django-constance,winzard/django-constance,th...
--- +++ @@ -0,0 +1,34 @@ +from django.test import TestCase + +from constance import config +from constance.test import override_config + + +class OverrideConfigFunctionDecoratorTestCase(TestCase): + """Test that the override_config decorator works correctly. + + Test usage of override_config on test method and ...
bc69916b71a04a4f54ef7c8ca2fb7142260634f2
tests/test_validators.py
tests/test_validators.py
""" test_validators ~~~~~~~~~~~~~~ Unittests for bundled validators. :copyright: 2007-2008 by James Crasta, Thomas Johansson. :license: MIT, see LICENSE.txt for details. """ from py.test import raises from wtforms.validators import ValidationError, length, url, not_empty, email, ip_addres...
Add first basic unittests using py.test
Add first basic unittests using py.test
Python
bsd-3-clause
jmagnusson/wtforms,cklein/wtforms,pawl/wtforms,pawl/wtforms,subyraman/wtforms,crast/wtforms,Aaron1992/wtforms,Xender/wtforms,wtforms/wtforms,hsum/wtforms,Aaron1992/wtforms,skytreader/wtforms
--- +++ @@ -0,0 +1,60 @@ +""" + test_validators + ~~~~~~~~~~~~~~ + + Unittests for bundled validators. + + :copyright: 2007-2008 by James Crasta, Thomas Johansson. + :license: MIT, see LICENSE.txt for details. +""" + +from py.test import raises +from wtforms.validators import ValidationError, l...
b189e7043115f788093b129815ff0bde5895ee0b
glanguage/__init__.py
glanguage/__init__.py
import httplib2 try: import simplejson as json except: import json from googleapiclient import discovery from oauth2client.client import GoogleCredentials OAUTH_SCOPE = 'https://www.googleapis.com/auth/cloud-platform' DISCOVERY_URL = 'https://{api}.googleapis.com/$discovery/rest?version={apiVersion}...
Add Natural Language API wrapper.
Add Natural Language API wrapper.
Python
apache-2.0
alexcchan/google
--- +++ @@ -0,0 +1,36 @@ +import httplib2 +try: + import simplejson as json +except: + import json + + +from googleapiclient import discovery +from oauth2client.client import GoogleCredentials + + +OAUTH_SCOPE = 'https://www.googleapis.com/auth/cloud-platform' +DISCOVERY_URL = 'https://{api}.googleapis....
809781cc832d79e1f746df385317ce4dae6223b3
tests/test_GetCalls.py
tests/test_GetCalls.py
#!/usr/bin/env python3 import codecs, json from PokeFacts import RedditBot from PokeFacts import DataPulls def getDataPullsObject(): store = DataPulls.ItemStore({'term_property': 'term'}) with codecs.open('tests/test_data.json', "r", "utf-8") as data_file: store.addItems(json.load(data_file)) re...
Add unit test for get_calls
Add unit test for get_calls
Python
mit
rpokemon/PokeFacts
--- +++ @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import codecs, json +from PokeFacts import RedditBot +from PokeFacts import DataPulls + +def getDataPullsObject(): + store = DataPulls.ItemStore({'term_property': 'term'}) + + with codecs.open('tests/test_data.json', "r", "utf-8") as data_file: + store....
47f4e738cc11ec40d3410332106163b0235f5da4
tests/python/tests/test_result.py
tests/python/tests/test_result.py
import unittest import librepo from librepo import LibrepoException class TestCaseResult(unittest.TestCase): def test_result_getinfo(self): r = librepo.Result() self.assertTrue(r) self.assertRaises(ValueError, r.getinfo, 99999999) self.assertFalse(r.getinfo(librepo.LRR_YUM_REPO)) ...
Add tests for Result object
Tests: Add tests for Result object
Python
lgpl-2.1
Conan-Kudo/librepo,bgamari/librepo,Tojaj/librepo,rholy/librepo,rholy/librepo,cgwalters/librepo,rpm-software-management/librepo,Tojaj/librepo,Conan-Kudo/librepo,rholy/librepo,cgwalters/librepo,cgwalters/librepo,rholy/librepo,Conan-Kudo/librepo,cgwalters/librepo,rpm-software-management/librepo,Tojaj/librepo,rpm-software-...
--- +++ @@ -0,0 +1,27 @@ +import unittest +import librepo +from librepo import LibrepoException + +class TestCaseResult(unittest.TestCase): + + def test_result_getinfo(self): + r = librepo.Result() + self.assertTrue(r) + + self.assertRaises(ValueError, r.getinfo, 99999999) + self.assert...
4736ed07ea8b83ca8c32c2d675f67883050b8c26
tests/test_provider_lawrenceks.py
tests/test_provider_lawrenceks.py
import busbus from busbus.provider.lawrenceks import LawrenceTransitProvider import arrow import pytest @pytest.fixture(scope='module') def lawrenceks_provider(): return LawrenceTransitProvider() def test_43_to_eaton_hall(lawrenceks_provider): stop = lawrenceks_provider.get(busbus.Stop, u'15TH_SPAHR_WB') ...
Add a simple test case for LawrenceTransitProvider
Add a simple test case for LawrenceTransitProvider
Python
mit
spaceboats/busbus
--- +++ @@ -0,0 +1,19 @@ +import busbus +from busbus.provider.lawrenceks import LawrenceTransitProvider + +import arrow +import pytest + + +@pytest.fixture(scope='module') +def lawrenceks_provider(): + return LawrenceTransitProvider() + + +def test_43_to_eaton_hall(lawrenceks_provider): + stop = lawrenceks_prov...
15d782aaddf1e8a4215df2fa3ef60b8801fe382a
tests_tf/test_utils.py
tests_tf/test_utils.py
from __future__ import absolute_import, division, print_function import unittest import numpy as np from cleverhans.utils_tf import kl_with_logits, l2_batch_normalize def numpy_kl_with_logits(q_logits, p_logits): def numpy_softmax(logits): exp_logits = np.exp(logits) return exp_logits / np.sum(...
Add tests for vat utils functions
Add tests for vat utils functions
Python
mit
fartashf/cleverhans,carlini/cleverhans,openai/cleverhans,cleverhans-lab/cleverhans,cleverhans-lab/cleverhans,cihangxie/cleverhans,carlini/cleverhans,cleverhans-lab/cleverhans
--- +++ @@ -0,0 +1,44 @@ +from __future__ import absolute_import, division, print_function + +import unittest + +import numpy as np + +from cleverhans.utils_tf import kl_with_logits, l2_batch_normalize + + +def numpy_kl_with_logits(q_logits, p_logits): + def numpy_softmax(logits): + exp_logits = np.exp(logi...
810eeddaff32f9b608b0b61cfcb48826ec1b15bf
various/Crop_Big_ROIs.py
various/Crop_Big_ROIs.py
# @DatasetService datasetservice # @ImageDisplayService displayservice # @ImageJ ij # @AbstractLogService log # @DefaultLegacyService legacyservice from ij import IJ from ij import Macro from ij.plugin.frame import RoiManager from io.scif.img import ImgSaver from net.imagej import DefaultDataset from loci.plugins im...
Add crop multi roi alternative script
Add crop multi roi alternative script
Python
bsd-3-clause
hadim/fiji_tools,hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_tools
--- +++ @@ -0,0 +1,97 @@ +# @DatasetService datasetservice +# @ImageDisplayService displayservice +# @ImageJ ij +# @AbstractLogService log +# @DefaultLegacyService legacyservice + +from ij import IJ +from ij import Macro +from ij.plugin.frame import RoiManager + +from io.scif.img import ImgSaver +from net.imagej impo...
8f1e94f79ddd398112ed33485bfc3d735e1edda2
maint/scripts/download_wheels.py
maint/scripts/download_wheels.py
#!/usr/bin/env python3 import asyncio import json import pathlib import sys from tornado.httpclient import AsyncHTTPClient BASE_URL = "https://ci.appveyor.com/api" async def fetch_job(directory, job): http = AsyncHTTPClient() artifacts = await http.fetch(f"{BASE_URL}/buildjobs/{job}/artifacts") paths = ...
Add script to download wheels from appveyor
Add script to download wheels from appveyor
Python
apache-2.0
mivade/tornado,tornadoweb/tornado,bdarnell/tornado,mivade/tornado,dongpinglai/my_tornado,mivade/tornado,dongpinglai/my_tornado,tornadoweb/tornado,NoyaInRain/tornado,NoyaInRain/tornado,NoyaInRain/tornado,allenl203/tornado,bdarnell/tornado,dongpinglai/my_tornado,lilydjwg/tornado,tornadoweb/tornado,dongpinglai/my_tornado,...
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +import asyncio +import json +import pathlib +import sys +from tornado.httpclient import AsyncHTTPClient + +BASE_URL = "https://ci.appveyor.com/api" + + +async def fetch_job(directory, job): + http = AsyncHTTPClient() + artifacts = await http.fetch(f"{BASE_URL}...
1846e6fe7f6b6a31f7921303556393e7f6fd9845
dev_tools/src/d1_dev/src-print-redbaron-tree.py
dev_tools/src/d1_dev/src-print-redbaron-tree.py
#!/usr/bin/env python # -*- 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...
Add command to print the syntax tree for a script
Add command to print the syntax tree for a script
Python
apache-2.0
DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- 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 Da...
e9f30ec92520f8caa4f5d08fdf43b08ced84fd6b
CodeFights/leastFactorial.py
CodeFights/leastFactorial.py
#!/usr/local/bin/python # Code Fights Least Factorial (Core) Problem def leastFactorial(n): def factGen(): m, res = 1, 1 while True: res *= m yield res m += 1 for f in factGen(): if f >= n: return f def main(): tests = [ [1...
Solve Code Fights least factorial problem
Solve Code Fights least factorial problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,36 @@ +#!/usr/local/bin/python +# Code Fights Least Factorial (Core) Problem + + +def leastFactorial(n): + def factGen(): + m, res = 1, 1 + while True: + res *= m + yield res + m += 1 + + for f in factGen(): + if f >= n: + retur...
77b6e4995743bca4036e5b5dc498cfcdd4e2908e
jarviscli/tests/test_wifi_password_getter.py
jarviscli/tests/test_wifi_password_getter.py
import unittest from tests import PluginTest from plugins import wifi_password_getter from colorama import Fore class TestWifiPasswordGetter(PluginTest): """ A test class that contains test cases for the methods of the wifi_password_getter plugin for Windows. """ def setUp(self): self.tes...
Create test cases for the wifi_password_getter plugin
Create test cases for the wifi_password_getter plugin
Python
mit
sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis
--- +++ @@ -0,0 +1,66 @@ +import unittest +from tests import PluginTest +from plugins import wifi_password_getter +from colorama import Fore + + +class TestWifiPasswordGetter(PluginTest): + """ + A test class that contains test cases for the methods of + the wifi_password_getter plugin for Windows. + """ ...
374f32a1d5feaf2e912d901b9398f50f00e7d481
scripts/most_recent.py
scripts/most_recent.py
from datetime import datetime from optparse import OptionParser from urllib2 import urlopen from BeautifulSoup import BeautifulSoup if __name__ == '__main__': usage = "%prog <USERNAME> <WEB SERVER>" parser = OptionParser(usage=usage) opts,args = parser.parse_args() if len(args) != 2: parser.e...
Add script to print time of most recent gobble.
Add script to print time of most recent gobble.
Python
agpl-3.0
foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm
--- +++ @@ -0,0 +1,22 @@ +from datetime import datetime +from optparse import OptionParser +from urllib2 import urlopen + +from BeautifulSoup import BeautifulSoup + + +if __name__ == '__main__': + usage = "%prog <USERNAME> <WEB SERVER>" + parser = OptionParser(usage=usage) + opts,args = parser.parse_args() +...
b47dbd6b6f2e19632e90036f14cd85bbf3f8cbd1
utils/get_collection_object_count.py
utils/get_collection_object_count.py
#!/usr/bin/env python # -*- coding: utf8 -*- import sys, os import argparse from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo def main(argv=None): parser = argparse.ArgumentParser(description='Print count of objects for a given collection.') parser.add_argument('path', help="Nuxeo path to collection...
Add script to get count of objects in a collection.
Add script to get count of objects in a collection.
Python
bsd-3-clause
barbarahui/nuxeo-calisphere,barbarahui/nuxeo-calisphere
--- +++ @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- + +import sys, os +import argparse +from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo + +def main(argv=None): + + parser = argparse.ArgumentParser(description='Print count of objects for a given collection.') + parser.add_argument(...
0798e457957b3db8f5de1891900d639961d78a0f
emgapimetadata/management/commands/test-data.py
emgapimetadata/management/commands/test-data.py
#!/usr/bin/python # -*- coding: utf-8 -*- import os import csv from django.core.management.base import BaseCommand from emgapimetadata import models as m_models class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('importpath', type=str) def handle(self, *args, **optio...
Add command line tool to import metadata
Add command line tool to import metadata
Python
apache-2.0
EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi
--- +++ @@ -0,0 +1,57 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import os +import csv + +from django.core.management.base import BaseCommand + +from emgapimetadata import models as m_models + + +class Command(BaseCommand): + + def add_arguments(self, parser): + parser.add_argument('importpath', type...
b3f185033ee758e9407240243e263e07c8a28e35
services/imu-logger.py
services/imu-logger.py
#!/usr/bin/env python3 from sense_hat import SenseHat from pymongo import MongoClient import time DELAY = 1 # in seconds sense = SenseHat() client = MongoClient("mongodb://192.168.0.128:27017") db = client.g2x while True: orientation = sense.get_orientation_degrees() print(orientation) acceleration =...
Create script to log imu values
Create script to log imu values
Python
bsd-3-clause
gizmo-cda/g2x-submarine-v2,gizmo-cda/g2x-submarine-v2,gizmo-cda/g2x-submarine-v2,gizmo-cda/g2x-submarine-v2
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +from sense_hat import SenseHat +from pymongo import MongoClient +import time + + +DELAY = 1 # in seconds + +sense = SenseHat() +client = MongoClient("mongodb://192.168.0.128:27017") +db = client.g2x + +while True: + orientation = sense.get_orientation_degrees()...
a24b3122176b7435469b5275264dd6f53ff78165
demo_a3c_continuous.py
demo_a3c_continuous.py
import argparse import chainer from chainer import serializers import gym import numpy as np import random_seed from train_a3c_continuous import phi, A3CLSTMGaussian import env_modifiers def eval_single_run(env, model, phi): model.reset_state() test_r = 0 obs = env.reset() done = False while not...
Add a demo script for gym continous tasks
Add a demo script for gym continous tasks
Python
mit
toslunar/chainerrl,toslunar/chainerrl
--- +++ @@ -0,0 +1,66 @@ +import argparse + +import chainer +from chainer import serializers +import gym +import numpy as np + +import random_seed +from train_a3c_continuous import phi, A3CLSTMGaussian +import env_modifiers + + +def eval_single_run(env, model, phi): + model.reset_state() + test_r = 0 + obs =...
50e16f8212c87ceb1f3fd1c896149b626e6e4178
indra/util/__init__.py
indra/util/__init__.py
def has_str(obj): if type(obj) == str: return True # Check for an iterable if hasattr(obj, '__iter__'): for item in obj: item_has_str = has_str(item) if item_has_str: return True if hasattr(obj, '__dict__'): for item in obj.__dict__.values(...
Test for objs with strs rather than unicode
Test for objs with strs rather than unicode
Python
bsd-2-clause
jmuhlich/indra,sorgerlab/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,pvtodorov/indra,bgyori/indra,pvtodorov/indra,sorgerlab/indra,jmuhlich/indra,johnbachman/belpy,johnbachman/indra,jmuhlich/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,bgyori/indra,bgyori/indra,jo...
--- +++ @@ -0,0 +1,17 @@ +def has_str(obj): + if type(obj) == str: + return True + # Check for an iterable + if hasattr(obj, '__iter__'): + for item in obj: + item_has_str = has_str(item) + if item_has_str: + return True + if hasattr(obj, '__dict__'): + ...
9bce480b245e20f6c6ef93d34e92c27cea9f6d77
tests/test_settings.py
tests/test_settings.py
import pytest from isort import exceptions from isort.settings import Config class TestConfig: def test_init(self): assert Config() def test_invalid_pyversion(self): with pytest.raises(ValueError): Config(py_version=10) def test_invalid_profile(self): with pytest.rai...
Add initial settings test file
Add initial settings test file
Python
mit
PyCQA/isort,PyCQA/isort
--- +++ @@ -0,0 +1,17 @@ +import pytest + +from isort import exceptions +from isort.settings import Config + + +class TestConfig: + def test_init(self): + assert Config() + + def test_invalid_pyversion(self): + with pytest.raises(ValueError): + Config(py_version=10) + + def test_inva...
be70b1528f51385c8221b7337cdc8669f53fa1c6
textblob/decorators.py
textblob/decorators.py
# -*- coding: utf-8 -*- '''Custom decorators.''' from __future__ import absolute_import from textblob.exceptions import MissingCorpusException class cached_property(object): '''A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute reset...
# -*- coding: utf-8 -*- '''Custom decorators.''' from __future__ import absolute_import from functools import wraps from textblob.exceptions import MissingCorpusException class cached_property(object): '''A property that is only computed once per instance and then replaces itself with an ordinary attribute. ...
Use wraps decorator for requires_nltk_corpus
Use wraps decorator for requires_nltk_corpus
Python
mit
jcalbert/TextBlob,freakynit/TextBlob,nvoron23/TextBlob,IrisSteenhout/TextBlob,adelq/TextBlob,beni55/TextBlob,jonmcoe/TextBlob,dipeshtech/TextBlob,sargam111/python,sloria/TextBlob,Windy-Ground/TextBlob,laugustyniak/TextBlob
--- +++ @@ -2,6 +2,7 @@ '''Custom decorators.''' from __future__ import absolute_import +from functools import wraps from textblob.exceptions import MissingCorpusException @@ -28,6 +29,7 @@ '''Wraps a function that requires an NLTK corpus. If the corpus isn't found, raise a MissingCorpusException. ...
a86525047658bf5adcd2133f71fe392a11883916
tools/unicode_tests.py
tools/unicode_tests.py
# coding: utf-8 """These tests have to be run separately from the main test suite (iptest), because that sets the default encoding to utf-8, and it cannot be changed after the interpreter is up and running. The default encoding in a Python 2.x environment is ASCII.""" import unittest, sys from IPython.core import com...
Test case for the failure to compile code including unicode characters.
Test case for the failure to compile code including unicode characters.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -0,0 +1,18 @@ +# coding: utf-8 +"""These tests have to be run separately from the main test suite (iptest), +because that sets the default encoding to utf-8, and it cannot be changed after +the interpreter is up and running. The default encoding in a Python 2.x +environment is ASCII.""" +import unittest, ...
eb1daa3edfaa72cad2cb39507b2db0bf95204561
markitup/renderers.py
markitup/renderers.py
from __future__ import unicode_literals try: from docutils.core import publish_parts def render_rest(markup, **docutils_settings): parts = publish_parts(source=markup, writer_name="html4css1", settings_overrides=docutils_settings) return parts["html_body"] except ImportError: pass
from __future__ import unicode_literals try: from docutils.core import publish_parts def render_rest(markup, **docutils_settings): docutils_settings.update({ 'raw_enabled': False, 'file_insertion_enabled': False, }) parts = publish_parts( source=mar...
Enforce better security in sample ReST renderer.
Enforce better security in sample ReST renderer.
Python
bsd-3-clause
WimpyAnalytics/django-markitup,carljm/django-markitup,WimpyAnalytics/django-markitup,zsiciarz/django-markitup,zsiciarz/django-markitup,carljm/django-markitup,WimpyAnalytics/django-markitup,carljm/django-markitup,zsiciarz/django-markitup
--- +++ @@ -2,8 +2,18 @@ try: from docutils.core import publish_parts + def render_rest(markup, **docutils_settings): - parts = publish_parts(source=markup, writer_name="html4css1", settings_overrides=docutils_settings) + docutils_settings.update({ + 'raw_enabled': False, + ...
c332b83cc543f8e43405cf72e6e7c80b0cafba80
datasets/online_products_dataset.py
datasets/online_products_dataset.py
# -*- coding: utf-8 -*- """ Created on Tue Feb 14 17:30:49 2017 @author: sakurai """ from fuel.datasets import H5PYDataset from fuel.utils import find_in_data_path from fuel.schemes import SequentialScheme from fuel.streams import DataStream class OnlineProductsDataset(H5PYDataset): _filename = 'online_product...
Add the dataset for online products dataset
Add the dataset for online products dataset
Python
mit
ronekko/deep_metric_learning
--- +++ @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Feb 14 17:30:49 2017 + +@author: sakurai +""" + +from fuel.datasets import H5PYDataset +from fuel.utils import find_in_data_path +from fuel.schemes import SequentialScheme +from fuel.streams import DataStream + + +class OnlineProductsDataset(H5PYD...
f82c43f3cc1fc74cd23b7ae4b957c464e09fe179
AttributeExploration.py
AttributeExploration.py
#------------------------------------------------------------------------------- # Name: AttributeExploration.py # Purpose: class for attribute exploration # # Author: Jakob Kogler #------------------------------------------------------------------------------- class AttributeExploration: def __ini...
ADD attributeExploration algorithm wrapped in a class
ADD attributeExploration algorithm wrapped in a class
Python
mit
jakobkogler/AttributeExploration,jakobkogler/AttributeExploration
--- +++ @@ -0,0 +1,69 @@ +#------------------------------------------------------------------------------- +# Name: AttributeExploration.py +# Purpose: class for attribute exploration +# +# Author: Jakob Kogler +#------------------------------------------------------------------------------- + +class ...
6eb358fbbe7351c65885d63726d895335832cf3c
tests/inheritance/test_multi_level_inheritance.py
tests/inheritance/test_multi_level_inheritance.py
import sqlalchemy as sa from sqlalchemy_continuum import version_class from tests import TestCase class TestCommonBaseClass(TestCase): def create_models(self): class BaseModel(self.Model): __tablename__ = 'base_model' __versioned__ = {} id = sa.Column(sa.Integer, prima...
Add test for inheritance case.
Add test for inheritance case.
Python
bsd-3-clause
kvesteri/sqlalchemy-continuum
--- +++ @@ -0,0 +1,47 @@ +import sqlalchemy as sa +from sqlalchemy_continuum import version_class +from tests import TestCase + + +class TestCommonBaseClass(TestCase): + def create_models(self): + class BaseModel(self.Model): + __tablename__ = 'base_model' + __versioned__ = {} + + ...
c7b57a9fcff6741869394ee2e6619db684e3d522
scripts/fix_weather_timestamp_errors.py
scripts/fix_weather_timestamp_errors.py
#!/usr/bin/env python3 """This is a script for fixing odd weather timestamp values in the database. Sometimes the timestamp is off by many hours from the previous and this script fixes those.""" from datetime import timedelta import psycopg def main(): """Module main function.""" # pylint: disable=invalid-...
Add FMI weather table timestamp fixing script
Add FMI weather table timestamp fixing script
Python
mit
terop/env-logger,terop/env-logger,terop/env-logger,terop/env-logger,terop/env-logger,terop/env-logger,terop/env-logger
--- +++ @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 + +"""This is a script for fixing odd weather timestamp values in the database. Sometimes +the timestamp is off by many hours from the previous and this script fixes those.""" + +from datetime import timedelta + +import psycopg + + +def main(): + """Module main func...
31d67e804ba44645b701c2624ee30c31023e994e
changed_options.py
changed_options.py
#!/usr/bin/env python3 # file: changed_options.py # vim:fileencoding=utf-8:fdm=marker:ft=python # # Author: R.F. Smith <rsmith@xs4all.nl> # Created: 2018-03-26 20:53:13 +0200 # Last modified: 2018-03-26 23:03:02 +0200 """ Get a list of installed packages. For each package, determine if the options have been changed com...
Add script to detect changed options.
Add script to detect changed options.
Python
mit
rsmith-nl/scripts,rsmith-nl/scripts
--- +++ @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +# file: changed_options.py +# vim:fileencoding=utf-8:fdm=marker:ft=python +# +# Author: R.F. Smith <rsmith@xs4all.nl> +# Created: 2018-03-26 20:53:13 +0200 +# Last modified: 2018-03-26 23:03:02 +0200 +""" +Get a list of installed packages. For each package, determine ...
bfe5ebae0261e49045e468bc183f54bcd7fbeafc
openfisca_core/scripts/xml_to_json/xml_to_json_extension_template.py
openfisca_core/scripts/xml_to_json/xml_to_json_extension_template.py
# -*- coding: utf-8 -*- ''' xml_to_json_extension_template.py : Parse XML parameter files for Extension-Template and convert them to YAML files. Comments are NOT transformed. Usage : `python xml_to_json_extension_template.py output_dir` or just (output is written in a directory called `yaml_parameters`): `python ...
Add script to transform ExtensionTemplate legilation
Add script to transform ExtensionTemplate legilation
Python
agpl-3.0
openfisca/openfisca-core,openfisca/openfisca-core
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +''' xml_to_json_extension_template.py : Parse XML parameter files for Extension-Template and convert them to YAML files. Comments are NOT transformed. + +Usage : + `python xml_to_json_extension_template.py output_dir` +or just (output is written in a directory cal...
18f983cf035704588f904d966f8bf10ca4a16b01
src/mmw/apps/modeling/migrations/0040_clear_nlcd2019_tr55_results.py
src/mmw/apps/modeling/migrations/0040_clear_nlcd2019_tr55_results.py
# Generated by Django 3.2.13 on 2022-04-20 23:35 from django.db import migrations def clear_nlcd2019_tr55_results(apps, schema_editor): """ Clear the results For all scenarios belonging to TR-55 projects made after the release of 1.33.0, which switched NLCD19 2019 to be the default on 2022-01-17: ...
Clear all NLCD19 2019 TR-55 results
Clear all NLCD19 2019 TR-55 results Since we're switching TR-55 projects back to NLCD11 2011, this migration clears the results for all TR-55 projects made since 1.33.0, which switched the default to NLCD19 2019. These results will be recalculated with NLCD11 2011 whenever they are opened next in the UI.
Python
apache-2.0
WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed
--- +++ @@ -0,0 +1,34 @@ +# Generated by Django 3.2.13 on 2022-04-20 23:35 + +from django.db import migrations + + +def clear_nlcd2019_tr55_results(apps, schema_editor): + """ + Clear the results For all scenarios belonging to TR-55 projects made after + the release of 1.33.0, which switched NLCD19 2019 to b...
727e57b8f639a471423c4b5a87af594632ae609d
scripts/tools/make_manhole.py
scripts/tools/make_manhole.py
#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Generate a .manhole for all masters.""" import getpass import os import optparse import subprocess import sys def check_outpu...
Add tool to generate .manhole files.
Add tool to generate .manhole files. This is cleaner than creating them one by one. R=cmp@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/8347006 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@106120 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Generate a .manhole for all masters.""" + +import getpass +import os +import optparse +import s...
e471fa49409d45b2b76b12ac63fb6487466be174
csunplugged/utils/retrieve_query_parameter.py
csunplugged/utils/retrieve_query_parameter.py
"""Module for retrieving a GET request query parameter.""" from django.http import Http404 def retrieve_query_parameter(request, parameter, valid_options=None): """Retrieve the query parameter. If the parameter cannot be found, or is not found in the list of valid options, then a 404 error is raised. ...
Add utility function for retrieving get parameters
Add utility function for retrieving get parameters
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
--- +++ @@ -0,0 +1,25 @@ +"""Module for retrieving a GET request query parameter.""" + +from django.http import Http404 + + +def retrieve_query_parameter(request, parameter, valid_options=None): + """Retrieve the query parameter. + + If the parameter cannot be found, or is not found in the list of + valid op...
2865af9eba55f1b3bbf14d26fd9691925fde8f5e
py/reconstruct-original-digits-from-english.py
py/reconstruct-original-digits-from-english.py
from collections import Counter class Solution(object): def originalDigits(self, s): """ :type s: str :rtype: str """ phase1 = dict( g=(8, 'eight'), u=(4, 'four'), w=(2, 'two'), x=(6, 'six'), z=(0...
Add py solution for 423. Reconstruct Original Digits from English
Add py solution for 423. Reconstruct Original Digits from English 423. Reconstruct Original Digits from English: https://leetcode.com/problems/reconstruct-original-digits-from-english/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,46 @@ +from collections import Counter +class Solution(object): + def originalDigits(self, s): + """ + :type s: str + :rtype: str + """ + phase1 = dict( + g=(8, 'eight'), + u=(4, 'four'), + w=(2, 'two'), + ...
09911a0fe8135fa2534c9d6e708e688fcfe54ca7
analysis/check_calls.py
analysis/check_calls.py
import os import click import cv2 from AppKit import NSScreen def check_image(filename, height): image = cv2.imread(filename) image_name = os.path.basename(filename) is_positive = _check(image, image_name, height) return image_name, is_positive def _check(image, image_name, target_height): cv2.n...
Add a small script for rapidly verifyinh IGV screenshots
Add a small script for rapidly verifyinh IGV screenshots
Python
mit
bardin-lab/readtagger,bardin-lab/readtagger
--- +++ @@ -0,0 +1,54 @@ +import os +import click +import cv2 +from AppKit import NSScreen + + +def check_image(filename, height): + image = cv2.imread(filename) + image_name = os.path.basename(filename) + is_positive = _check(image, image_name, height) + return image_name, is_positive + + +def _check(ima...
10782310cfee0d2c2938748056f6549b5918b969
src/sentry/debug/utils/patch_context.py
src/sentry/debug/utils/patch_context.py
from __future__ import absolute_import from sentry.utils.imports import import_string class PatchContext(object): def __init__(self, target, callback): target, attr = target.rsplit('.', 1) target = import_string(target) self.func = getattr(target, attr) self.target = target ...
from __future__ import absolute_import from threading import Lock from sentry.utils.imports import import_string class PatchContext(object): def __init__(self, target, callback): target, attr = target.rsplit('.', 1) target = import_string(target) self.target = target self.attr = a...
Use a thread lock to patch contexts.
Use a thread lock to patch contexts. This fixes #3185
Python
bsd-3-clause
looker/sentry,zenefits/sentry,mvaled/sentry,alexm92/sentry,alexm92/sentry,looker/sentry,gencer/sentry,ifduyue/sentry,jean/sentry,JackDanger/sentry,JackDanger/sentry,ifduyue/sentry,BuildingLink/sentry,gencer/sentry,beeftornado/sentry,BuildingLink/sentry,mvaled/sentry,JamesMura/sentry,jean/sentry,zenefits/sentry,zenefits...
--- +++ @@ -1,5 +1,6 @@ from __future__ import absolute_import +from threading import Lock from sentry.utils.imports import import_string @@ -7,10 +8,12 @@ def __init__(self, target, callback): target, attr = target.rsplit('.', 1) target = import_string(target) - self.func = geta...
a353ad76774c44004256fef8b076f74b6b639ca4
tests/remove_stale_string.py
tests/remove_stale_string.py
import re import json import glob from collections import OrderedDict locale_folder = "../locales/" locale_files = glob.glob(locale_folder + "*.json") locale_files = [filename.split("/")[-1] for filename in locale_files] locale_files.remove("en.json") reference = json.loads(open(locale_folder + "en.json").read()) fo...
Add script to remove stale i18n strings
Add script to remove stale i18n strings
Python
agpl-3.0
YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost
--- +++ @@ -0,0 +1,19 @@ +import re +import json +import glob +from collections import OrderedDict + +locale_folder = "../locales/" +locale_files = glob.glob(locale_folder + "*.json") +locale_files = [filename.split("/")[-1] for filename in locale_files] +locale_files.remove("en.json") + +reference = json.loads(open(...
4cc2861ed79d54c5f59a29b5d56dde5aae9c0c81
examples/ex_rofi.py
examples/ex_rofi.py
#!/usr/bin/env python import string from dynmen import Menu rofi = Menu(command=('rofi', '-fullscreen', '-dmenu', '-i')) d_string = vars(string) d_string = {k:v for k,v in d_string.items() if not k.startswith('_')} print('Launching rofi - given a dict') output = rofi(d_string) print(output, '\n') print('Launching ro...
Add a script showing usage in examples
Add a script showing usage in examples
Python
mit
frostidaho/dynmen
--- +++ @@ -0,0 +1,19 @@ +#!/usr/bin/env python +import string +from dynmen import Menu +rofi = Menu(command=('rofi', '-fullscreen', '-dmenu', '-i')) + +d_string = vars(string) +d_string = {k:v for k,v in d_string.items() if not k.startswith('_')} + +print('Launching rofi - given a dict') +output = rofi(d_string) +pr...
00596dbc602a3e555cef0a3453d83d475c28fc52
tests/test_azure_publish_tools.py
tests/test_azure_publish_tools.py
from argparse import Namespace from unittest import TestCase from azure_publish_tools import ( DELETE, get_option_parser, LIST, PUBLISH, ) class TestOptionParser(TestCase): def parse_args(self, args): parser = get_option_parser() return parser.parse_args(args) def test_li...
Add tests for current arg parsing.
Add tests for current arg parsing.
Python
agpl-3.0
mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju
--- +++ @@ -0,0 +1,65 @@ +from argparse import Namespace +from unittest import TestCase + +from azure_publish_tools import ( + DELETE, + get_option_parser, + LIST, + PUBLISH, + ) + +class TestOptionParser(TestCase): + + def parse_args(self, args): + parser = get_option_parser() + retur...
8a9329a5c2b97d32a1fd32ae16c21222fb10b6b2
cms_lab_carousel/migrations/0003_auto_20150417_1240.py
cms_lab_carousel/migrations/0003_auto_20150417_1240.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.utils.timezone import utc import django.core.validators import datetime class Migration(migrations.Migration): dependencies = [ ('cms_lab_carousel', '0002_auto_20150417_1219'), ] ...
Make migrations for changes to models
Make migrations for changes to models
Python
bsd-3-clause
mfcovington/djangocms-lab-carousel,mfcovington/djangocms-lab-carousel
--- +++ @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.utils.timezone import utc +import django.core.validators +import datetime + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms_lab_carousel'...
3eefb913a11a91cfe543b5efe926e233953e6b0c
tests/test_usfirst_event_type_parser.py
tests/test_usfirst_event_type_parser.py
import unittest2 from models.event import Event from helpers.event_helper import EventHelper class TestUsfirstEventTypeParser(unittest2.TestCase): def test_parse(self): self.assertEqual(EventHelper.parseEventType("Regional"), Event.REGIONAL) self.assertEqual(EventHelper.parseEventType("regional"),...
Add test for event type parser
Add test for event type parser
Python
mit
josephbisch/the-blue-alliance,synth3tk/the-blue-alliance,verycumbersome/the-blue-alliance,fangeugene/the-blue-alliance,bdaroz/the-blue-alliance,fangeugene/the-blue-alliance,1fish2/the-blue-alliance,phil-lopreiato/the-blue-alliance,phil-lopreiato/the-blue-alliance,tsteward/the-blue-alliance,tsteward/the-blue-alliance,1f...
--- +++ @@ -0,0 +1,26 @@ +import unittest2 + +from models.event import Event +from helpers.event_helper import EventHelper + +class TestUsfirstEventTypeParser(unittest2.TestCase): + def test_parse(self): + self.assertEqual(EventHelper.parseEventType("Regional"), Event.REGIONAL) + self.assertEqual(Eve...
bc6a9324c00909a62dc26477224bbfc58def9eb2
external_tools/src/main/python/omero56/scripts/omerok8s_impc_config.py
external_tools/src/main/python/omero56/scripts/omerok8s_impc_config.py
"""Configure Omero on a k8s server for the way it is used in IMPC """ import sys import argparse import omero.cli # For some reason if I do not do this next line throws error from omero import ApiUsageException from omero.cli import NonZeroReturnCode from omeroservice import OmeroService from utils import get_proper...
Add script to configure omerok8s for public_group and public_user
Add script to configure omerok8s for public_group and public_user
Python
apache-2.0
mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData
--- +++ @@ -0,0 +1,61 @@ +"""Configure Omero on a k8s server for the way it is used in IMPC + +""" +import sys +import argparse + +import omero.cli # For some reason if I do not do this next line throws error +from omero import ApiUsageException +from omero.cli import NonZeroReturnCode + +from omeroservice import Ome...
9cd5678fbeb3ad5a26bf9578a1f562c46a2de26e
example_iterator_with_custom_order.py
example_iterator_with_custom_order.py
# -*- coding: utf-8 -*- """ Created on Sat Jan 21 21:16:43 2017 @author: ryuhei """ import numpy as np from chainer.datasets import TupleDataset from sklearn.preprocessing import LabelEncoder from my_iterators import SerialIterator class NPairMCIndexesSampler(object): def __init__(self, labels, batch_size, num...
Implement an example of the modified SerialIterator
Implement an example of the modified SerialIterator
Python
mit
ronekko/deep_metric_learning
--- +++ @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +""" +Created on Sat Jan 21 21:16:43 2017 + +@author: ryuhei +""" + +import numpy as np + +from chainer.datasets import TupleDataset +from sklearn.preprocessing import LabelEncoder +from my_iterators import SerialIterator + + +class NPairMCIndexesSampler(object): + ...
8768b66ae982d19964f85feb325a1b0f35ed1c87
odo/backends/dask_array.py
odo/backends/dask_array.py
from __future__ import absolute_import, division, print_function import numpy as np from datashape import discover from toolz import merge, accumulate from datashape.dispatch import dispatch from datashape import DataShape from operator import add import itertools from dask.array.core import rec_concatenate, Array, g...
Migrate dask array odo backend from dask.
Migrate dask array odo backend from dask.
Python
bsd-3-clause
cpcloud/odo,ContinuumIO/odo,ywang007/odo,cpcloud/odo,alexmojaki/odo,quantopian/odo,ContinuumIO/odo,Dannnno/odo,cowlicks/odo,quantopian/odo,blaze/odo,cowlicks/odo,alexmojaki/odo,Dannnno/odo,ywang007/odo,blaze/odo
--- +++ @@ -0,0 +1,74 @@ +from __future__ import absolute_import, division, print_function + +import numpy as np +from datashape import discover +from toolz import merge, accumulate +from datashape.dispatch import dispatch +from datashape import DataShape +from operator import add +import itertools + +from dask.array...
63ffa531eebfba19344dee67b3f417072012a7f4
CodeFights/rangeBitCount.py
CodeFights/rangeBitCount.py
#!/usr/local/bin/python # Code Fights Range Bit Count (Core) Problem def rangeBitCount(a, b): return (''.join([bin(n) for n in range(a, b + 1)])).count('1') def main(): tests = [ [2, 7, 11], [0, 1, 1], [1, 10, 17], [8, 9, 3], [9, 10, 4] ] for t in tests: ...
Solve Code Fights range bit count problem
Solve Code Fights range bit count problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,29 @@ +#!/usr/local/bin/python +# Code Fights Range Bit Count (Core) Problem + + +def rangeBitCount(a, b): + return (''.join([bin(n) for n in range(a, b + 1)])).count('1') + + +def main(): + tests = [ + [2, 7, 11], + [0, 1, 1], + [1, 10, 17], + [8, 9, 3], + ...
cca072b6cf5b0162e1cf10d6873739d762a7a05e
examples/console_logger_signals.py
examples/console_logger_signals.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Log radiation hits or noise signals to the console. Released under MIT License. See LICENSE file. By Yoan Tournade <y@yoantournade.com> """ import time from PiPocketGeiger import RadiationWatch def example_run_context(): example_run_context.hit_flag = False ...
Add example using callbacks/IRQs for easier debug
Add example using callbacks/IRQs for easier debug
Python
mit
MonsieurV/PiPocketGeiger
--- +++ @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Log radiation hits or noise signals to the console. + +Released under MIT License. See LICENSE file. + +By Yoan Tournade <y@yoantournade.com> +""" +import time +from PiPocketGeiger import RadiationWatch + +def example_run_context(): + e...
fe3f7ae8eb9390a4fe3f59e6244d4bbd6af7a9cd
mojo/services/html_viewer/view_url.py
mojo/services/html_viewer/view_url.py
#!/usr/bin/env python # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import os import subprocess import sys root_path = os.path.realpath( os.path.join( os.path.dirname( ...
Add script to view URL in HTMLViewer
Add script to view URL in HTMLViewer This script takes advantage of the fact that Mojo binaries are published in the cloud to add functionality for viewing a URL in HTMLViewer embedded in the kiosk window manager. Review URL: https://codereview.chromium.org/982523004 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e...
Python
bsd-3-clause
TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,chuan9/chromium-crosswalk,Chilledheart/chromium,ltilve/chromium,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk,fujunwei/chromium-crosswalk,Fireblend/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,Just-D/chromium-1,Just-D/chro...
--- +++ @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import argparse +import os +import subprocess +import sys + +root_path = os.path.realpath( + os.pat...
6a835fd8913cdd3a9dc76530230ae2c73d88b48f
tests/name_injection_test.py
tests/name_injection_test.py
"""Test for the name inject utility.""" from drudge import Drudge def test_drudge_injects_names(): """Test the name injection method of drudge.""" dr = Drudge(None) # Dummy drudge. string_name = 'string_name' dr.set_name(string_name) dr.set_name(1, 'one') dr.inject_names(suffix='_') a...
Add tests for name injection
Add tests for name injection Since the name injection facility could taint the entire global namespace of the module, its test is put into a separate module.
Python
mit
tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge
--- +++ @@ -0,0 +1,17 @@ +"""Test for the name inject utility.""" + +from drudge import Drudge + + +def test_drudge_injects_names(): + """Test the name injection method of drudge.""" + + dr = Drudge(None) # Dummy drudge. + string_name = 'string_name' + dr.set_name(string_name) + dr.set_name(1, 'one') ...
69aa2be4eca4ecfa9a73ad38c34bb7a4e46bef97
tests/test_epsilon_greedy.py
tests/test_epsilon_greedy.py
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() import logging import unittest from explorers import epsilon_greedy class TestEpsilonGreedy(unit...
Add tests for epsilon greedy explorers
Add tests for epsilon greedy explorers
Python
mit
toslunar/chainerrl,toslunar/chainerrl
--- +++ @@ -0,0 +1,66 @@ +from __future__ import unicode_literals +from __future__ import print_function +from __future__ import division +from __future__ import absolute_import +from future import standard_library +standard_library.install_aliases() + +import logging +import unittest + +from explorers import epsilon...
86da129dd4d9665dc15218c1d5b4673ee33780f4
factory/tools/cat_logs.py
factory/tools/cat_logs.py
#!/bin/env python # # cat_logs.py # # Print out the logs for a certain date # # Usage: cat_logs.py <factory> YY/MM/DD [hh:mm:ss] # import sys,os,os.path,time sys.path.append("lib") sys.path.append("..") sys.path.append("../../lib") import gWftArgsHelper,gWftLogParser import glideFactoryConfig USAGE="Usage: cat_logs.p...
Print the logs for a certain date
Print the logs for a certain date
Python
bsd-3-clause
holzman/glideinwms-old,bbockelm/glideinWMS,holzman/glideinwms-old,bbockelm/glideinWMS,bbockelm/glideinWMS,holzman/glideinwms-old,bbockelm/glideinWMS
--- +++ @@ -0,0 +1,62 @@ +#!/bin/env python +# +# cat_logs.py +# +# Print out the logs for a certain date +# +# Usage: cat_logs.py <factory> YY/MM/DD [hh:mm:ss] +# + +import sys,os,os.path,time +sys.path.append("lib") +sys.path.append("..") +sys.path.append("../../lib") +import gWftArgsHelper,gWftLogParser +import gl...
6b0673334d14dca0e64ab9a760d8652b29e26b07
fs/test/test_mkdir.py
fs/test/test_mkdir.py
from __future__ import with_statement from nose.tools import ( eq_ as eq, ) from fs.test.util import ( maketemp, assert_raises, ) import errno import os import fs def test_mkdir(): tmp = maketemp() fs.path(tmp).child('foo').mkdir() foo = os.path.join(tmp, 'foo') assert os.path.i...
Add more tests for mkdir.
Add more tests for mkdir.
Python
mit
tv42/fs,nailor/filesystem
--- +++ @@ -0,0 +1,32 @@ +from __future__ import with_statement + +from nose.tools import ( + eq_ as eq, + ) + +from fs.test.util import ( + maketemp, + assert_raises, + ) + +import errno +import os + +import fs + +def test_mkdir(): + tmp = maketemp() + fs.path(tmp).child('foo').mkdir() + foo ...
e3afe5628d42abb109f7e2b3be735ef02941051d
data/forms.py
data/forms.py
from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Div class JobTemplateForm(forms.Form): name = forms.CharField(max_length=400) template = forms.CharField( widget=forms.Textarea( attrs={ 'cols': 50, '...
Create a form for the JobTemplate
Create a form for the JobTemplate
Python
mit
crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp,crcollins/chemtools-webapp
--- +++ @@ -0,0 +1,24 @@ +from django import forms +from crispy_forms.helper import FormHelper +from crispy_forms.layout import Layout, Div + + +class JobTemplateForm(forms.Form): + name = forms.CharField(max_length=400) + template = forms.CharField( + widget=forms.Textarea( + attrs={ + ...