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
0c7a2dfa1890f6332021dd77c6dc119f9fdf6f31
nova/tests/test_sqlalchemy.py
nova/tests/test_sqlalchemy.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2012 Rackspace Hosting # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apach...
Add eventlet db_pool use for mysql
Add eventlet db_pool use for mysql This adds the use of eventlet's db_pool module so that we can make mysql calls without blocking the whole process. New config options are introduced: sql_dbpool_enable -- Enables the use of eventlet's db_pool sql_min_pool_size -- Set the minimum number of SQL connections The defau...
Python
apache-2.0
n0ano/ganttclient
--- +++ @@ -0,0 +1,66 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# Copyright (c) 2012 Rackspace Hosting +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the Licen...
fa830a7a8f7a2b34df311b8d85788ccd5531bb30
gen_noise.py
gen_noise.py
#!/usr/bin/env python3 """Generates smooth noise images.""" import argparse import numpy as np from PIL import Image from num_utils import resize def main(): parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) p...
Add noise image generator script
Add noise image generator script
Python
mit
crowsonkb/style_transfer,crowsonkb/style_transfer,crowsonkb/style_transfer,crowsonkb/style_transfer
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +"""Generates smooth noise images.""" + +import argparse + +import numpy as np +from PIL import Image + +from num_utils import resize + + +def main(): + parser = argparse.ArgumentParser(description=__doc__, + formatter_class=arg...
af1d2e6e3e5df1ad08f977e83208de29d22cd391
experiments/func_from_partial_order/func_from_partial_order.py
experiments/func_from_partial_order/func_from_partial_order.py
# Goal: # # Given: # - a set of samples (S) # - an unknown evaluation function f of S (f: S -> [0; 1]) # - a partial order c of f over S: # - comparisons of pairs of samples (C(i, j) in {-1,0,1}): # c(i,j) = -1 iff f(S_i) < f(S_j) # c(i,j) = 0 iff f(S_i) = f(S_j) # c(i,j) = 1 iff f(S_i) > f(S_j) # ie. c(i, ...
Make an experiment for reconstructing a function from partial ordering of its values at samples points.
Make an experiment for reconstructing a function from partial ordering of its values at samples points.
Python
mit
bzamecnik/tfr,bzamecnik/tfr
--- +++ @@ -0,0 +1,57 @@ +# Goal: +# +# Given: +# - a set of samples (S) +# - an unknown evaluation function f of S (f: S -> [0; 1]) +# - a partial order c of f over S: +# - comparisons of pairs of samples (C(i, j) in {-1,0,1}): +# c(i,j) = -1 iff f(S_i) < f(S_j) +# c(i,j) = 0 iff f(S_i) = f(S_j) +# c(i,j) =...
8389b23b3eefa3a4eeb84fa58837271ea1548514
validate.py
validate.py
import sys import torch import visdom import argparse import numpy as np import torch.nn as nn import torch.nn.functional as F import torchvision.models as models from torch.autograd import Variable from torch.utils import data from tqdm import tqdm from ptsemseg.loader import get_loader, get_data_path from ptsemseg....
Make validation and test separate scripts
Make validation and test separate scripts
Python
mit
meetshah1995/pytorch-semseg,hzh8311/project,ibadami/pytorch-semseg
--- +++ @@ -0,0 +1,72 @@ +import sys +import torch +import visdom +import argparse +import numpy as np +import torch.nn as nn +import torch.nn.functional as F +import torchvision.models as models + +from torch.autograd import Variable +from torch.utils import data +from tqdm import tqdm + +from ptsemseg.loader import...
e5cd42bf40ae66e22aa6ce486e84cf8f833ed338
opentreemap/treemap/migrations/0037_fix_plot_add_delete_permission_labels.py
opentreemap/treemap/migrations/0037_fix_plot_add_delete_permission_labels.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def change_labels(apps, term): Permission = apps.get_model('auth', 'Permission') add_plot = Permission.objects.filter(codename='add_plot') delete_plot = Permission.objects.filter(codename='delete_plot') a...
Apply model permissions - plot permission name
Apply model permissions - plot permission name Data migration to fix plot permissions to say can add or delete **planting site**, rather than **plot**.
Python
agpl-3.0
maurizi/otm-core,maurizi/otm-core,maurizi/otm-core,maurizi/otm-core
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +def change_labels(apps, term): + Permission = apps.get_model('auth', 'Permission') + add_plot = Permission.objects.filter(codename='add_plot') + delete_plot = Permission.objects...
f0c0edcbb6d88cb9f7215c16128dd2471ee16789
imagersite/imager_images/migrations/0004_auto_20150728_1555.py
imagersite/imager_images/migrations/0004_auto_20150728_1555.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('imager_images', '0003_auto_20150726_1224'), ] operations = [ migrations.AlterField( model_name='album', ...
Update photo and album models for non-required fields
Update photo and album models for non-required fields
Python
mit
jesseklein406/django-imager,jesseklein406/django-imager,jesseklein406/django-imager
--- +++ @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('imager_images', '0003_auto_20150726_1224'), + ] + + operations = [ + migrations.AlterField(...
7e7817fc5a90adf7b2fa4b8947dd46a75bc6e818
pystereovisiontoolkit.py
pystereovisiontoolkit.py
#! /usr/bin/env python # -*- coding:utf-8 -*- # # Application to capture, and calibrate stereo cameras # # # External dependencies # import argparse import Calibration import CvViewer # # Command line argument parser # parser = argparse.ArgumentParser( description='Camera calibration toolkit.' ) parser.add_argum...
Introduce a single program to rule them all...
Introduce a single program to rule them all...
Python
mit
microy/VisionToolkit,microy/VisionToolkit,microy/StereoVision,microy/PyStereoVisionToolkit,microy/StereoVision,microy/PyStereoVisionToolkit
--- +++ @@ -0,0 +1,55 @@ +#! /usr/bin/env python +# -*- coding:utf-8 -*- + + +# +# Application to capture, and calibrate stereo cameras +# + + +# +# External dependencies +# +import argparse +import Calibration +import CvViewer + + +# +# Command line argument parser +# +parser = argparse.ArgumentParser( description=...
384e6ffcef5844b451dccd2fedbfdaef38851e1e
accelerator/migrations/0029_add_help_text_on_image_field.py
accelerator/migrations/0029_add_help_text_on_image_field.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2018-12-17 21:05 from __future__ import unicode_literals from django.db import migrations import sorl.thumbnail.fields class Migration(migrations.Migration): dependencies = [ ('accelerator', '0028_change_profile_help_texts'), ] operations ...
Add migration for image field
[AC-6187] Add migration for image field
Python
mit
masschallenge/django-accelerator,masschallenge/django-accelerator
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.8 on 2018-12-17 21:05 +from __future__ import unicode_literals + +from django.db import migrations +import sorl.thumbnail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('accelerator', '0028_change_profi...
6e278c7e621b0bf1aa580cac128d6698dece7c93
vida/vida/migrations/0011_personlocationhistory.py
vida/vida/migrations/0011_personlocationhistory.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion import django.contrib.gis.db.models.fields class Migration(migrations.Migration): dependencies = [ ('vida', '0010_person_geom'), ] operations = [ mig...
Revert "Revert "Created the model and migration for person_location_history table""
Revert "Revert "Created the model and migration for person_location_history table"" This reverts commit baf53bd5b1fdcb0c1b39c60a2337d3f3d58cad95. oops
Python
mit
ROGUE-JCTD/vida,ROGUE-JCTD/vida,ROGUE-JCTD/vida,ROGUE-JCTD/vida,ROGUE-JCTD/vida
--- +++ @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.db.models.deletion +import django.contrib.gis.db.models.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('vida', '0010_person_geom')...
68f6f74dd439eabaa80fc107adcd3dc04ebf477d
tests/test_now.py
tests/test_now.py
# -*- coding: utf-8 -*- import pytest from jinja2 import Environment @pytest.fixture(scope='session') def environment(): return Environment(extensions=['jinja2_time.TimeExtension']) def test_foobar(environment): assert environment
Create a new test module along with a session scoped env fixture
Create a new test module along with a session scoped env fixture
Python
mit
hackebrot/jinja2-time
--- +++ @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +import pytest + +from jinja2 import Environment + + +@pytest.fixture(scope='session') +def environment(): + return Environment(extensions=['jinja2_time.TimeExtension']) + + +def test_foobar(environment): + assert environment
ba1a80d866748426a06785a2efaa4b6aad3c95a5
turing_machine.py
turing_machine.py
class State(): def __init__(self, ??): self.end_of_tape = ?? self.write_false = ?? self.move_false = ?? self.write_true = ?? self.move_true = ?? class TuringMachine(): def __init__(self, n): # ?? Magic that translates int n into a starting tape and a collection o...
Add Turing machine class before integer-to-TM conversion.
Add Turing machine class before integer-to-TM conversion.
Python
mit
alexaltair/solomonoff-induction
--- +++ @@ -0,0 +1,59 @@ +class State(): + def __init__(self, ??): + self.end_of_tape = ?? + self.write_false = ?? + self.move_false = ?? + self.write_true = ?? + self.move_true = ?? + +class TuringMachine(): + def __init__(self, n): + # ?? Magic that translates int n i...
a2a7197834dab6cbdd1d402f10382a6a3514af8f
dev/scripts/inject_InChI.py
dev/scripts/inject_InChI.py
import CoolProp from chemspipy import ChemSpider from chemspipy_key import key # private file with the key (DO NOT COMMIT!!) import glob, json cs = ChemSpider(key) # Map from name to Chemspider ID backup_map = { 'Propyne': 6095, 'R236EA': 71342, 'R245ca': 62827, 'trans-2-Butene': 56442, 'Oxygen': 9...
Add script for injecting InChI keys and string (and others)
Add script for injecting InChI keys and string (and others)
Python
mit
JonWel/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,dcprojects/CoolProp,JonWel/CoolProp,DANA-Laboratory/CoolProp,JonWel/CoolProp,JonWel/CoolProp,CoolProp/CoolProp,DANA-Laboratory/CoolProp,henningjp/CoolProp,CoolProp/CoolProp,DANA-Laboratory/CoolProp,JonWel/CoolProp,dcprojects/CoolProp,henningjp/CoolProp,JonWel/CoolProp...
--- +++ @@ -0,0 +1,62 @@ +import CoolProp +from chemspipy import ChemSpider +from chemspipy_key import key # private file with the key (DO NOT COMMIT!!) +import glob, json +cs = ChemSpider(key) + +# Map from name to Chemspider ID +backup_map = { + 'Propyne': 6095, + 'R236EA': 71342, + 'R245ca': 62827, + '...
1652d1c425ae85a356fe78f71d3942351b983f58
altair/vegalite/v2/examples/scatter_linked_brush.py
altair/vegalite/v2/examples/scatter_linked_brush.py
""" Faceted Scatter Plot with Linked Brushing ----------------------------------------- This is an example of using an interval selection to control the color of points across multiple facets. """ import altair as alt from vega_datasets import data cars = data.cars() brush = alt.selection(type='interval', resolve='g...
Add scatter linked-brush selection example
Add scatter linked-brush selection example
Python
bsd-3-clause
ellisonbg/altair,altair-viz/altair,jakevdp/altair
--- +++ @@ -0,0 +1,25 @@ +""" +Faceted Scatter Plot with Linked Brushing +----------------------------------------- +This is an example of using an interval selection to control the color of +points across multiple facets. +""" + +import altair as alt +from vega_datasets import data + +cars = data.cars() + +brush = a...
12281dbedc0bd43ef4b85b936cb662f5092d8a72
cum60.py
cum60.py
#!/usr/bin/env python3 import json import zmq import zconfig import zutils def main(): logger = zutils.getLogger(__name__) ctx = zmq.Context() subsock = ctx.socket(zmq.SUB) subsock.connect("tcp://{}:{}".format(zconfig.IP_ADDR, zconfig.PROXY_PUB_PORT)) sub...
Add cumulative 60 module (L2)
Add cumulative 60 module (L2)
Python
mit
mangalaman93/pstickle
--- +++ @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 + +import json +import zmq +import zconfig +import zutils + + +def main(): + logger = zutils.getLogger(__name__) + + ctx = zmq.Context() + subsock = ctx.socket(zmq.SUB) + subsock.connect("tcp://{}:{}".format(zconfig.IP_ADDR, + ...
aace23c5cd0d420f05affab431c71ff9b384154f
jobmon/test/test_command_server.py
jobmon/test/test_command_server.py
import os import select import socket import time import unittest from jobmon.protocol import * from jobmon import command_server, protocol, transport PORT = 9999 class CommandServerRecorder: def __init__(self): self.commands = [] def start_job(self, job): self.commands.append(('start', job)...
Write tests for the command server
Write tests for the command server
Python
bsd-2-clause
adamnew123456/jobmon
--- +++ @@ -0,0 +1,75 @@ +import os +import select +import socket +import time +import unittest + +from jobmon.protocol import * +from jobmon import command_server, protocol, transport + +PORT = 9999 + +class CommandServerRecorder: + def __init__(self): + self.commands = [] + + def start_job(self, job): ...
d4f6de5bf5fc7ccf2d50d90f7e3b9b43b2715aff
python/misc/toutv-rename.py
python/misc/toutv-rename.py
#!/usr/bin/env python # coding=utf8 from enum import Enum import os import os.path import re import sys def main(): VideoTypes = Enum('VideoType', 'emission film miniserie') filename_chars = 'àÀâÂçÇéÉèÈêÊëîÎôÔ\w\-\'\.\(\)' pattern = re.compile('([{0}]+)\.(S([\d]+)E[\d]+)\.([{0}]+)\.[\d]+kbps\.ts'.format(f...
Add random script for renaming toutv files
Add random script for renaming toutv files
Python
mit
bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile
--- +++ @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# coding=utf8 + +from enum import Enum +import os +import os.path +import re +import sys + +def main(): + VideoTypes = Enum('VideoType', 'emission film miniserie') + filename_chars = 'àÀâÂçÇéÉèÈêÊëîÎôÔ\w\-\'\.\(\)' + pattern = re.compile('([{0}]+)\.(S([\d]+)E[...
04919ac67c187380c43e9f1f557167e5eb6d02e4
tests/test_html_formatter.py
tests/test_html_formatter.py
# -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2006 by Georg Brandl. :license: BSD, see LICENSE for more details. """ import unittest import StringIO import random from pygments import lexers, formatters from pygments.token import _TokenType class...
Add a reminder to write a HTML formatter test.
[svn] Add a reminder to write a HTML formatter test. --HG-- branch : trunk
Python
bsd-2-clause
Khan/pygments,dbrgn/pygments-mirror,dbrgn/pygments-mirror,nsfmc/pygments,nsfmc/pygments,nex3/pygments,dbrgn/pygments-mirror,Khan/pygments,kirbyfan64/pygments-unofficial,Khan/pygments,kirbyfan64/pygments-unofficial,dbrgn/pygments-mirror,dbrgn/pygments-mirror,dbrgn/pygments-mirror,nex3/pygments,nsfmc/pygments,kirbyfan64/...
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +""" + Pygments HTML formatter tests + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: 2006 by Georg Brandl. + :license: BSD, see LICENSE for more details. +""" + +import unittest +import StringIO +import random + +from pygments import lexers, formatters +fr...
ca9a19f721b06b619ffdab5bda1814667294d505
tests/test_librato_uptime.py
tests/test_librato_uptime.py
import os import sys import unittest import json sys.path.insert(0, os.path.abspath('./situation')) sys.path.insert(0, os.path.abspath('./')) from situation.librato_uptime import Calculator from google.appengine.ext import testbed import mock UPTIME_CFG = { 'root_uri': 'https://metrics-api.librato.com/v1/metric...
Add test for librato uptime
Add test for librato uptime
Python
mit
balanced/status.balancedpayments.com,chriskuehl/kloudless-status,chriskuehl/kloudless-status,balanced/status.balancedpayments.com,balanced/status.balancedpayments.com,chriskuehl/kloudless-status
--- +++ @@ -0,0 +1,111 @@ +import os +import sys +import unittest +import json + +sys.path.insert(0, os.path.abspath('./situation')) +sys.path.insert(0, os.path.abspath('./')) + +from situation.librato_uptime import Calculator +from google.appengine.ext import testbed +import mock + + +UPTIME_CFG = { + 'root_uri':...
204f195891fa8f071009f0015fb81c280c3c5cbe
userconf.py
userconf.py
# Additional configuration # User defined global variables # Snack calling method # Choices are 'exe', 'python', 'tcl' # Setting it to None, uses the default for your operating system user_default_snack_method = None
Add config file for global user-defined variables
Add config file for global user-defined variables
Python
apache-2.0
voicesauce/opensauce-python,voicesauce/opensauce-python,voicesauce/opensauce-python
--- +++ @@ -0,0 +1,8 @@ +# Additional configuration + +# User defined global variables + +# Snack calling method +# Choices are 'exe', 'python', 'tcl' +# Setting it to None, uses the default for your operating system +user_default_snack_method = None
f5d418c229ea240b097c091ceb00d5d07275b56a
dakota/tests/test_dakota_utils.py
dakota/tests/test_dakota_utils.py
#!/usr/bin/env python # # Tests for dakota.dakota_utils module. # # Call with: # $ nosetests -sv # # Mark Piper (mark.piper@colorado.edu) import os from nose.tools import * from dakota.dakota_utils import * # Global variables start_dir = os.getcwd() data_dir = os.path.join(start_dir, 'dakota', 'tests', 'data') para...
Add unit tests for dakota.dakota_utils
Add unit tests for dakota.dakota_utils
Python
mit
csdms/dakota,csdms/dakota
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# +# Tests for dakota.dakota_utils module. +# +# Call with: +# $ nosetests -sv +# +# Mark Piper (mark.piper@colorado.edu) + +import os +from nose.tools import * +from dakota.dakota_utils import * + +# Global variables +start_dir = os.getcwd() +data_dir = os.path.join...
cc744124bafd3b26cec54d8ef8dc5b08ad7e0f9f
olympiad/christmas_tree.py
olympiad/christmas_tree.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2014 Fabian M. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
Add solution for problem 1a
Add solution for problem 1a
Python
apache-2.0
fabianm/olympiad,fabianm/olympiad,fabianm/olympiad
--- +++ @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2014 Fabian M. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.a...
93cee311a2044f52e41596c0e581a7d30926f46c
sahara/tests/unit/utils/test_configs.py
sahara/tests/unit/utils/test_configs.py
# Copyright (c) 2015 Intel Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Add configs unit test case
Add configs unit test case Change-Id: I9a9bb85226059cf6421282d72e4f6b8fd4df7d7f
Python
apache-2.0
egafford/sahara,crobby/sahara,openstack/sahara,crobby/sahara,openstack/sahara,crobby/sahara,tellesnobrega/sahara,zhangjunli177/sahara,egafford/sahara,ekasitk/sahara,ekasitk/sahara,tellesnobrega/sahara,zhangjunli177/sahara,ekasitk/sahara,zhangjunli177/sahara
--- +++ @@ -0,0 +1,51 @@ +# Copyright (c) 2015 Intel Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by a...
8c9cd95e473ded8f9716705a6ef27c420c8f7b8d
monitors/migrations/0003_certificatesubscription.py
monitors/migrations/0003_certificatesubscription.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('monitors...
Add migration file to generate certificatesubscription table
Add migration file to generate certificatesubscription table
Python
mit
gdit-cnd/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID
--- +++ @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settin...
2f1eb9eda871cd2b7cd0f9300d15cdedab609248
scripts/generate_bus_ranking.py
scripts/generate_bus_ranking.py
from collections import defaultdict import sys import django django.setup() from busshaming.models import RouteDate, Feed FEED_SLUG = 'nsw-buses' MIN_TRIPS = 500 MIN_RT_ENTRIES = 0 def main(is_best, verylate): feed = Feed.objects.get(slug=FEED_SLUG) routedates = defaultdict(list) for rd in RouteDate.o...
Add script to aggregate RouteDates and display ranked lists of routes.
Add script to aggregate RouteDates and display ranked lists of routes.
Python
mit
katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming
--- +++ @@ -0,0 +1,63 @@ +from collections import defaultdict +import sys +import django +django.setup() + +from busshaming.models import RouteDate, Feed + +FEED_SLUG = 'nsw-buses' + + +MIN_TRIPS = 500 +MIN_RT_ENTRIES = 0 + + +def main(is_best, verylate): + feed = Feed.objects.get(slug=FEED_SLUG) + routedates =...
67e0765e3bc98720fbda5febffdd5d4c3b9865ef
opps/article/urls.py
opps/article/urls.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # from django.conf.urls.defaults import patterns, url from django.conf.urls import include from opps.article.views import OppsDetail urlpatterns = patterns('', url(r'^redactor/', include('redactor.urls')), url(r'^(?P<channel__slug_name>[0-9A-Za-z-_.//]+)...
Create basic url on opps article
Create basic url on opps article
Python
mit
williamroot/opps,williamroot/opps,opps/opps,opps/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps
--- +++ @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +from django.conf.urls.defaults import patterns, url +from django.conf.urls import include + +from opps.article.views import OppsDetail + + + +urlpatterns = patterns('', + url(r'^redactor/', include('redactor.urls')), + url(r'^(...
411e42feab4d5102cb7f7c591afaa3404fe76912
ironicclient/tests/functional/osc/v1/test_baremetal_node_create_negative.py
ironicclient/tests/functional/osc/v1/test_baremetal_node_create_negative.py
# Copyright (c) 2016 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
Add negative test-cases for openstack node create command
Add negative test-cases for openstack node create command Change-Id: Icf7afa131f3cc07c19df88bd254b4aa823c6bef4 Partial-Bug: #1630288
Python
apache-2.0
openstack/python-ironicclient,openstack/python-ironicclient
--- +++ @@ -0,0 +1,55 @@ +# Copyright (c) 2016 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required...
9701566d43905d858ab01d82aa414d5b5a93f8f6
test/test_text_api.py
test/test_text_api.py
""" This module tests the text api module (pyqode.core.text) """ import os from PyQt4 import QtGui from PyQt4.QtTest import QTest import sys from pyqode.core.editor import QCodeEdit from pyqode.core import client from pyqode.core import text from .helpers import cwd_at app = None editor = None window = None def p...
Add a test for goto_line
Add a test for goto_line
Python
mit
pyQode/pyqode.core,pyQode/pyqode.core,zwadar/pyqode.core
--- +++ @@ -0,0 +1,68 @@ +""" +This module tests the text api module (pyqode.core.text) +""" +import os +from PyQt4 import QtGui +from PyQt4.QtTest import QTest +import sys + +from pyqode.core.editor import QCodeEdit +from pyqode.core import client +from pyqode.core import text + +from .helpers import cwd_at + + +app...
501a52ae39a63f58e2de2f7f31c6eb82e49f2e0a
comics/comics/hagarthehorrible.py
comics/comics/hagarthehorrible.py
# encoding: utf-8 from comics.aggregator.crawler import ComicsKingdomCrawlerBase from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = 'Hägar the Horrible' language = 'en' url = 'https://www.comicskingdom.com/hagar-the-horrible' rights = 'Chris Browne' class Crawler...
Add crawler for "Hägar the Horrible"
Add crawler for "Hägar the Horrible"
Python
agpl-3.0
datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics
--- +++ @@ -0,0 +1,19 @@ +# encoding: utf-8 +from comics.aggregator.crawler import ComicsKingdomCrawlerBase +from comics.core.comic_data import ComicDataBase + + +class ComicData(ComicDataBase): + name = 'Hägar the Horrible' + language = 'en' + url = 'https://www.comicskingdom.com/hagar-the-horrible' + ri...
11a471ae01b1ad80f090d952a744679aac6d5d15
polymorphic/utils.py
polymorphic/utils.py
from django.contrib.contenttypes.models import ContentType def reset_polymorphic_ctype(*models, **filters): """ Set the polymorphic content-type ID field to the proper model Sort the ``*models`` from base class to descending class, to make sure the content types are properly assigned. Add ``prese...
Add reset_polymorphic_ctype() function to assist with migration to polymorphic
Add reset_polymorphic_ctype() function to assist with migration to polymorphic
Python
bsd-3-clause
chrisglass/django_polymorphic,skirsdeda/django_polymorphic,chrisglass/django_polymorphic,skirsdeda/django_polymorphic,skirsdeda/django_polymorphic
--- +++ @@ -0,0 +1,22 @@ +from django.contrib.contenttypes.models import ContentType + + +def reset_polymorphic_ctype(*models, **filters): + """ + Set the polymorphic content-type ID field to the proper model + Sort the ``*models`` from base class to descending class, + to make sure the content types are ...
368980d3286237baaaf811e17c2681496ec00f8a
tests/v3/test_auth.py
tests/v3/test_auth.py
import puresnmp.auth as auth def test_password_to_key(): from hashlib import md5 hasher = auth.password_to_key(md5, 16) result = hasher(b"foo", b"bar") expected = b"x\xf4\xdf-#\x19\x95\xe0\x8f\xcd\x1f{\xa87\x99\x06" assert result == expected
Add tests for v3 auth
Add tests for v3 auth
Python
mit
exhuma/puresnmp,exhuma/puresnmp
--- +++ @@ -0,0 +1,10 @@ +import puresnmp.auth as auth + + +def test_password_to_key(): + from hashlib import md5 + + hasher = auth.password_to_key(md5, 16) + result = hasher(b"foo", b"bar") + expected = b"x\xf4\xdf-#\x19\x95\xe0\x8f\xcd\x1f{\xa87\x99\x06" + assert result == expected
69469033bf1e87230ec00850d8644f56f6ae66cb
opentreemap/otm1_migrator/migration_rules/sandiego.py
opentreemap/otm1_migrator/migration_rules/sandiego.py
from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES udfs = { 'plot': { 'type': 'udf:Plot Type', 'powerline_conflict_potential': 'udf:Powerlines Overhead', 'sidewalk_damage': 'udf:Sidewalk Damage' }, 'tree': { 'condition': 'udf:Tree Condition', 's...
Add rules for San Diego
Add rules for San Diego
Python
agpl-3.0
recklessromeo/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,maurizi/otm-core,RickMohr/otm-core,maurizi/otm-core,clever-crow-consulting/otm-core,RickMohr/otm-core,RickMohr/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,maurizi/otm-core,RickMohr/otm-core,maurizi/otm-core,recklessromeo/o...
--- +++ @@ -0,0 +1,67 @@ +from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES + +udfs = { + 'plot': { + 'type': 'udf:Plot Type', + 'powerline_conflict_potential': 'udf:Powerlines Overhead', + 'sidewalk_damage': 'udf:Sidewalk Damage' + }, + + 'tree': { + 'condit...
7101b30622f0b1586e6e8a7b6209b2689568fa0a
plyer/platforms/ios/storagepath.py
plyer/platforms/ios/storagepath.py
''' iOS Storage Path -------------------- ''' from plyer.facades import StoragePath from pyobjus import autoclass import os NSFileManager = autoclass('NSFileManager') # Directory constants (NSSearchPathDirectory enumeration) NSApplicationDirectory = 1 NSDocumentDirectory = 9 NSDownloadsDirectory = 15 NSMoviesDirecto...
Add iOS api for storage path
Add iOS api for storage path
Python
mit
KeyWeeUsr/plyer,kivy/plyer,KeyWeeUsr/plyer,KeyWeeUsr/plyer,kivy/plyer,kivy/plyer
--- +++ @@ -0,0 +1,61 @@ +''' +iOS Storage Path +-------------------- +''' + +from plyer.facades import StoragePath +from pyobjus import autoclass +import os + +NSFileManager = autoclass('NSFileManager') + +# Directory constants (NSSearchPathDirectory enumeration) +NSApplicationDirectory = 1 +NSDocumentDirectory = 9 ...
6a4fb5556a03df7863a8ccf5b91f9b0103c0d9bd
admin_extend/form_mixins.py
admin_extend/form_mixins.py
from django.forms import ModelForm class BidirectionalM2MForm(ModelForm): bi_m2m_fields = [] def _get_m2m_attr_name(self, m2m_field): return '%s_set' % m2m_field def __init__(self, *args, **kwargs): super(BidirectionalM2MForm, self).__init__(*args, **kwargs) if self.instance.pk ...
Add a mixin form that provides bidirectional m2m fields in the admin
Add a mixin form that provides bidirectional m2m fields in the admin
Python
mit
kux/django-admin-extend
--- +++ @@ -0,0 +1,30 @@ +from django.forms import ModelForm + + +class BidirectionalM2MForm(ModelForm): + + bi_m2m_fields = [] + + def _get_m2m_attr_name(self, m2m_field): + return '%s_set' % m2m_field + + def __init__(self, *args, **kwargs): + super(BidirectionalM2MForm, self).__init__(*args,...
2ac066511fb7febe0a0dd2f54845e945c639f810
py/maximum-width-of-binary-tree.py
py/maximum-width-of-binary-tree.py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def widthOfBinaryTree(self, root): """ :type root: TreeNode :rtype: int """ start...
Add py solution for 662. Maximum Width of Binary Tree
Add py solution for 662. Maximum Width of Binary Tree 662. Maximum Width of Binary Tree: https://leetcode.com/problems/maximum-width-of-binary-tree/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,30 @@ +# Definition for a binary tree node. +# class TreeNode(object): +# def __init__(self, x): +# self.val = x +# self.left = None +# self.right = None + +class Solution(object): + def widthOfBinaryTree(self, root): + """ + :type root: TreeNode + ...
725ada91ff4b15aa97784a21e6cebd02fa2dd55c
split_dataset.py
split_dataset.py
import os import numpy as np data_dir = "data/dataset/" jpg_filenames = list(filter(lambda x: x[-3:] == "jpg", os.listdir(data_dir))) # Randomly select the test dataset test_percentage = 0.1 n_test = round(len(jpg_filenames) * test_percentage) if n_test == 0: n_test = 1 # Randomly select the images for testing test...
Add script to split the dataset
Add script to split the dataset
Python
mit
SetaSouto/license-plate-detection
--- +++ @@ -0,0 +1,28 @@ +import os + +import numpy as np + +data_dir = "data/dataset/" +jpg_filenames = list(filter(lambda x: x[-3:] == "jpg", os.listdir(data_dir))) + +# Randomly select the test dataset +test_percentage = 0.1 +n_test = round(len(jpg_filenames) * test_percentage) +if n_test == 0: n_test = 1 + +# Ran...
76d1330c2ebe47e3818139e7eaa2bd1dd906c8f5
papermill/tests/test_parameterize.py
papermill/tests/test_parameterize.py
import unittest from ..api import read_notebook from ..execute import _parameterize_notebook from . import get_notebook_path class TestNotebookHelpers(unittest.TestCase): def test_preserving_tags(self): # test that other tags on the parameter cell are preserved test_nb = read_notebook(get_noteboo...
Add tests for tagging of parameter cells
Add tests for tagging of parameter cells
Python
bsd-3-clause
nteract/papermill,nteract/papermill
--- +++ @@ -0,0 +1,33 @@ +import unittest + +from ..api import read_notebook +from ..execute import _parameterize_notebook +from . import get_notebook_path + + +class TestNotebookHelpers(unittest.TestCase): + def test_preserving_tags(self): + # test that other tags on the parameter cell are preserved + ...
102846c941f2faa229db841ffe5031fa779923f3
indico/migrations/versions/201704191202_2963fba57558_fix_future_paper_revisions.py
indico/migrations/versions/201704191202_2963fba57558_fix_future_paper_revisions.py
"""Fix future paper revisions Revision ID: 2963fba57558 Revises: 098311458f37 Create Date: 2017-04-19 12:02:16.187401 """ from collections import Counter from datetime import timedelta from alembic import context, op # revision identifiers, used by Alembic. revision = '2963fba57558' down_revision = '098311458f37' b...
Fix paper revisions with same submitted dt
Fix paper revisions with same submitted dt
Python
mit
pferreir/indico,DirkHoffmann/indico,OmeGak/indico,indico/indico,indico/indico,indico/indico,DirkHoffmann/indico,ThiefMaster/indico,ThiefMaster/indico,mvidalgarcia/indico,mic4ael/indico,mic4ael/indico,mvidalgarcia/indico,mvidalgarcia/indico,ThiefMaster/indico,pferreir/indico,mic4ael/indico,pferreir/indico,mvidalgarcia/i...
--- +++ @@ -0,0 +1,66 @@ +"""Fix future paper revisions + +Revision ID: 2963fba57558 +Revises: 098311458f37 +Create Date: 2017-04-19 12:02:16.187401 +""" + +from collections import Counter +from datetime import timedelta + +from alembic import context, op + +# revision identifiers, used by Alembic. +revision = '2963f...
bb543c6f53983d59edbc6a522ca10d64efd9c42e
aids/sorting_and_searching/union_sorted_arrays.py
aids/sorting_and_searching/union_sorted_arrays.py
''' In this module, we implement a function which gets the union of two sorted arrays. ''' def union_sorted_arrays(arr_1, arr_2): ''' Return the union of two sorted arrays ''' result = [] i,j = 0,0 while i < len(arr_1) and j < len(arr_2): if arr_1[i] == arr_2[j]: result.append(arr_1[i]) i += 1 j+=1...
Return union of two sorted arrays
Return union of two sorted arrays
Python
mit
ueg1990/aids
--- +++ @@ -0,0 +1,27 @@ +''' +In this module, we implement a function which gets the union +of two sorted arrays. + +''' + +def union_sorted_arrays(arr_1, arr_2): + ''' + Return the union of two sorted arrays + + ''' + result = [] + i,j = 0,0 + while i < len(arr_1) and j < len(arr_2): + if arr_1[i] == arr_2[j]: + ...
fdf1954e677b6a7b1a76ba7dabe1eb2c79e54744
run_analyses_bootstrap.py
run_analyses_bootstrap.py
"""Run bootstrap analyses""" from working_functions import * import multiprocessing # Datasets not included: Cocoli, Sherman, Luquillo, Shiramaki dat_list = ['FERP', 'ACA', 'WesternGhats', 'BCI', 'BVSF', 'Lahei', 'LaSelva', 'NC', 'Oosting', 'Serimbu'] # The following analyses assume that analyses in r...
Add script to run Monte Carlo and bootstrap analyses
Add script to run Monte Carlo and bootstrap analyses
Python
mit
weecology/mete-energy,weecology/mete-energy
--- +++ @@ -0,0 +1,40 @@ +"""Run bootstrap analyses""" + +from working_functions import * +import multiprocessing + +# Datasets not included: Cocoli, Sherman, Luquillo, Shiramaki +dat_list = ['FERP', 'ACA', 'WesternGhats', 'BCI', 'BVSF', 'Lahei', + 'LaSelva', 'NC', 'Oosting', 'Serimbu'] + +# The followi...
f576fc39cd3083cd0a4d441e48dd2942aead9b1b
salt/states/salt_proxy.py
salt/states/salt_proxy.py
# -*- coding: utf-8 -*- import os import logging log = logging.getLogger(__name__) def _proxy_conf_file(proxyfile): changes = [] success = True if not os.path.exists(proxyfile): __salt__['salt_proxy.write_proxy_conf'](path=proxyfile) try: msg = 'Salt Proxy: Wrote proxy conf {...
Add state for salt proxy
Add state for salt proxy
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +import os +import logging + +log = logging.getLogger(__name__) + + +def _proxy_conf_file(proxyfile): + changes = [] + success = True + if not os.path.exists(proxyfile): + __salt__['salt_proxy.write_proxy_conf'](path=proxyfile) + try: + ...
095a04c051f966c74909c4e2d3a5cd4aea2e124f
docs/source/examples/test_no_depends_fails.py
docs/source/examples/test_no_depends_fails.py
from __future__ import print_function from pych.extern import Chapel @Chapel(sfile="users.onlyonce.chpl") def useTwoModules(x=int, y=int): return int if __name__ == "__main__": print(useTwoModules(2, 4)) import testcase # contains the general testing method, which allows us to gather output import os.path d...
from __future__ import print_function from pych.extern import Chapel @Chapel(sfile="users.onlyonce.chpl") def useTwoModules(x=int, y=int): return int if __name__ == "__main__": print(useTwoModules(2, 4)) import testcase # contains the general testing method, which allows us to gather output import os.path d...
Update expected error message for this test
Update expected error message for this test PR 6370 on the chapel repository caused a change to the error message output when a Chapel module or enum can't be found in a use statement, resulting in the failure of this test to match expected output. Update accordingly.
Python
apache-2.0
russel/pychapel,russel/pychapel,chapel-lang/pychapel,chapel-lang/pychapel,russel/pychapel,chapel-lang/pychapel
--- +++ @@ -16,4 +16,4 @@ out = testcase.runpy(os.path.realpath(__file__)) # Ensure that when a used module is nowhere near the exported function, we # get an error message to that effect. - assert "error: Cannot find module or enum \'M1\'" in out + assert "error: Cannot find module or enum" in o...
81778bb866ca54f8a138c1f8493d7f98799f3dad
9_Palindrome_Number.py
9_Palindrome_Number.py
import math class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ flag = 0 if x < 0: return False elif 0 <= x <= 9: return True digits = int(math.log10(abs(x)))+1 for i in rang...
Add prob9, night in 9.18
Add prob9, night in 9.18
Python
apache-2.0
lzhbrian/Leetcode-Python
--- +++ @@ -0,0 +1,25 @@ +import math +class Solution(object): + def isPalindrome(self, x): + """ + :type x: int + :rtype: bool + """ + flag = 0 + if x < 0: + return False + elif 0 <= x <= 9: + return True + + digits = int(ma...
f64ce86d1dcf402b68f55c2d6f54a00dbba8a1f5
examples/colorbars.py
examples/colorbars.py
""" This example demonstrates how to make colorful bars. """ from rich.block_bar import BlockBar from rich.console import Console from rich.table import Table table = Table() table.add_column("Score") table.add_row(BlockBar(size=100, begin=0, end=5, width=30, color="bright_red")) table.add_row(BlockBar(size=100, b...
Add example for block bar
Add example for block bar
Python
mit
willmcgugan/rich
--- +++ @@ -0,0 +1,19 @@ +""" + +This example demonstrates how to make colorful bars. + +""" + +from rich.block_bar import BlockBar +from rich.console import Console +from rich.table import Table + +table = Table() +table.add_column("Score") + +table.add_row(BlockBar(size=100, begin=0, end=5, width=30, color="bright_...
445d8e2065389990962146acd48955d2f28fd712
clowder_server/migrations/0007_alert_expire_at.py
clowder_server/migrations/0007_alert_expire_at.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-08-09 19:48 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('clowder_server', '0006_auto_20170504_1834'), ] operations = [ migrations.AddF...
Add migration for expire at
CLOWDER: Add migration for expire at
Python
agpl-3.0
keithhackbarth/clowder_server,keithhackbarth/clowder_server,keithhackbarth/clowder_server,keithhackbarth/clowder_server
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-08-09 19:48 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('clowder_server', '0006_auto_20170504_1834'), + ] + + ...
a7e96f68ad2c222a360ad51d9826268ba2620c9b
morse_trainer/test_audio.py
morse_trainer/test_audio.py
import math import numpy import pyaudio def sine(frequency, length, rate): length = int(length * rate) factor = float(frequency) * (math.pi * 2) / rate return numpy.sin(numpy.arange(length) * factor) def play_tone(stream, frequency=440, length=1, rate=44100): chunks = [] chunks.append(sine(frequ...
Test codie to get sound duration right
Test codie to get sound duration right
Python
mit
rzzzwilson/morse,rzzzwilson/morse
--- +++ @@ -0,0 +1,29 @@ +import math +import numpy +import pyaudio + + +def sine(frequency, length, rate): + length = int(length * rate) + factor = float(frequency) * (math.pi * 2) / rate + return numpy.sin(numpy.arange(length) * factor) + + +def play_tone(stream, frequency=440, length=1, rate=44100): + ...
adb2b9d8457756bb4484d06b36b8f5b620d2a34c
indra/tools/mechlinker_queries.py
indra/tools/mechlinker_queries.py
import pickle from indra.tools.incremental_model import IncrementalModel from indra.mechlinker import MechLinker from indra.assemblers import EnglishAssembler def print_linked_stmt(stmt): source_txts = [] for source_stmt in stmt.source_stmts: source_txt = EnglishAssembler([source_stmt]).make_model() ...
Add English assembled mechanism linking questions
Add English assembled mechanism linking questions
Python
bsd-2-clause
jmuhlich/indra,bgyori/indra,pvtodorov/indra,johnbachman/belpy,johnbachman/belpy,sorgerlab/belpy,johnbachman/indra,bgyori/indra,bgyori/indra,jmuhlich/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,pvtodorov/indra,pvtodorov/indra,pvtodorov/indra,sorgerlab/belpy,jmuhlich/indra,sorgerlab/indra,johnbachman/indra,so...
--- +++ @@ -0,0 +1,30 @@ +import pickle +from indra.tools.incremental_model import IncrementalModel +from indra.mechlinker import MechLinker +from indra.assemblers import EnglishAssembler + + +def print_linked_stmt(stmt): + source_txts = [] + for source_stmt in stmt.source_stmts: + source_txt = EnglishAs...
a5503cc64a1ef44048c8aa10e36344508076201c
src/python/grpcio_tests/tests_aio/unit/channel_ready_test.py
src/python/grpcio_tests/tests_aio/unit/channel_ready_test.py
# Copyright 2020 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Add unit test for channel ready
Add unit test for channel ready
Python
apache-2.0
jtattermusch/grpc,ctiller/grpc,grpc/grpc,jboeuf/grpc,firebase/grpc,ejona86/grpc,firebase/grpc,jboeuf/grpc,vjpai/grpc,jtattermusch/grpc,jtattermusch/grpc,jboeuf/grpc,firebase/grpc,nicolasnoble/grpc,firebase/grpc,nicolasnoble/grpc,vjpai/grpc,firebase/grpc,vjpai/grpc,ejona86/grpc,grpc/grpc,vjpai/grpc,vjpai/grpc,jtattermus...
--- +++ @@ -0,0 +1,68 @@ +# Copyright 2020 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by...
98ae7ef4cdb51252733535d2314664333957eda3
tests/test_features.py
tests/test_features.py
import numpy as np import pytest from microscopium import features @pytest.fixture(scope="module", params=[np.uint8, np.float]) def haralick_image(request): haralick_image = np.array([[0, 0, 1, 1], [0, 0, 1, 1], [0, 2, 2, 2], ...
Add unit test for haralick_features()
Add unit test for haralick_features()
Python
bsd-3-clause
jni/microscopium,jni/microscopium,microscopium/microscopium,microscopium/microscopium
--- +++ @@ -0,0 +1,29 @@ +import numpy as np +import pytest + +from microscopium import features + + +@pytest.fixture(scope="module", params=[np.uint8, np.float]) +def haralick_image(request): + haralick_image = np.array([[0, 0, 1, 1], + [0, 0, 1, 1], + [...
b8500132def1f7df0daa9b8abb070ae9d49d1a4e
tests/test_int_case.py
tests/test_int_case.py
from test_util import * from funkyyak import grad def test_int_case(): check_equivalent((lambda x:x*x)(2.0), 4.0) check_equivalent((lambda x:x*x)(2) + 0.0, 4.0) check_equivalent(grad(lambda x:x*x)(2.0), 4.0) check_equivalent(grad(lambda x:x*x)(2) + 0.0, 4.0)
Test that an int arg to grad is okay
Test that an int arg to grad is okay
Python
mit
barak/autograd
--- +++ @@ -0,0 +1,8 @@ +from test_util import * +from funkyyak import grad + +def test_int_case(): + check_equivalent((lambda x:x*x)(2.0), 4.0) + check_equivalent((lambda x:x*x)(2) + 0.0, 4.0) + check_equivalent(grad(lambda x:x*x)(2.0), 4.0) + check_equivalent(grad(lambda x:x*x)(2) + 0.0,...
e641a19f16b99425aa1b15bd8524f2612b0d6bab
tests/test_registry.py
tests/test_registry.py
import pytest from web_test_base import * class TestIATIRegistry(WebTestBase): urls_to_get = [ "http://iatiregistry.org/" , "http://www.iatiregistry.org/" , "https://iatiregistry.org/" , "https://www.iatiregistry.org/" ] def test_contains_links(self, loaded_request): ...
Add tests for the IATI Registry This adds a 200 response and link checks for the IATI Registry
Add tests for the IATI Registry This adds a 200 response and link checks for the IATI Registry
Python
mit
IATI/IATI-Website-Tests
--- +++ @@ -0,0 +1,19 @@ +import pytest +from web_test_base import * + +class TestIATIRegistry(WebTestBase): + urls_to_get = [ + "http://iatiregistry.org/" + , "http://www.iatiregistry.org/" + , "https://iatiregistry.org/" + , "https://www.iatiregistry.org/" + ] + + def test_conta...
da9e0365369e647c6bd386e53fff11715c6d957a
libnamebench/config_test.py
libnamebench/config_test.py
#!/usr/bin/env python # Copyright 2009 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
Add some tests for dns config parsing
Add some tests for dns config parsing
Python
apache-2.0
HerlonNascimento/namebench,benklaasen/namebench,21winner/namebench,souzainf3/namebench,lukasfenix/namebench,kiseok7/namebench,dimazalfrianz/namebench,PyroShark/namebench,RomanHargrave/namebench,jackjshin/namebench,mspringett/namebench,ItsAGeekThing/namebench,ZuluPro/namebench,MarnuLombard/namebench,pombreda/namebench,s...
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# Copyright 2009 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licen...
9da74729bd2d48d2bf4e78f342c6eb04bc4f9c69
ideascube/conf/idc.py
ideascube/conf/idc.py
from .base import * # pragma: no flakes from tzlocal import get_localzone TIME_ZONE = get_localzone().zone BACKUP_FORMAT = 'gztar' STAFF_HOME_CARDS = [c for c in STAFF_HOME_CARDS # pragma: no flakes if c['url'] in ['user_list', 'server:settings']] BUILTIN_APP_CARDS = ['dropcube', 'blog', 'medi...
Add configuration for ideascube hw
Add configuration for ideascube hw
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
--- +++ @@ -0,0 +1,12 @@ +from .base import * # pragma: no flakes + +from tzlocal import get_localzone + + +TIME_ZONE = get_localzone().zone +BACKUP_FORMAT = 'gztar' +STAFF_HOME_CARDS = [c for c in STAFF_HOME_CARDS # pragma: no flakes + if c['url'] in ['user_list', 'server:settings']] + +BUILTIN_...
5d4e8bb02dd78f8ba6eb386478f25a6e60c80240
atoman/slowtests/test_filtering.py
atoman/slowtests/test_filtering.py
""" Slow tests for filtering systems """ import os import tempfile import shutil import numpy as np from . import base from ..gui import mainWindow from ..system.lattice import Lattice def path_to_file(path): return os.path.join(os.path.dirname(__file__), "..", "..", "testing", path) class TestFilterin...
Add file for running gui filtering tests.
Add file for running gui filtering tests.
Python
mit
chrisdjscott/Atoman,chrisdjscott/Atoman,chrisdjscott/Atoman,chrisdjscott/Atoman,chrisdjscott/Atoman
--- +++ @@ -0,0 +1,95 @@ + +""" +Slow tests for filtering systems + +""" +import os +import tempfile +import shutil + +import numpy as np + +from . import base +from ..gui import mainWindow +from ..system.lattice import Lattice + + +def path_to_file(path): + return os.path.join(os.path.dirname(__file__), ".."...
c44eb565d167f3c91350da825005067784428440
bin/debug/extract_timeline_for_day_range_and_user.py
bin/debug/extract_timeline_for_day_range_and_user.py
# Exports all data for the particular user for the particular day # Used for debugging issues with trip and section generation import sys import logging logging.basicConfig(level=logging.DEBUG) import uuid import datetime as pydt import json import bson.json_util as bju import arrow import emission.storage.timeserie...
Add a new script that downloads data for a date range
Add a new script that downloads data for a date range Because this is a date range, we can no longer use localdate (which is a filtering technique). Instead we convert to a timestamp and use timestamps instead. We also query using the timeseries, so we get both raw and analysed data. We need to include multiple time q...
Python
bsd-3-clause
shankari/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server
--- +++ @@ -0,0 +1,44 @@ +# Exports all data for the particular user for the particular day +# Used for debugging issues with trip and section generation +import sys +import logging +logging.basicConfig(level=logging.DEBUG) + +import uuid +import datetime as pydt +import json +import bson.json_util as bju +import ar...
6cc0dba8901f97a4cc5103c57fbeba9d46a7a514
trac/api.py
trac/api.py
# -*- coding: utf-8 -*- # # Copyright (C) 2003-2016 Edgewall Software # Copyright (C) 2003-2016 Jonas Borgström <jonas@edgewall.com> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at htt...
Add missing file from r15148
1.3.1dev: Add missing file from r15148 Refs #12496. git-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@15149 af82e41b-90c4-0310-8c96-b1721e28e2e2
Python
bsd-3-clause
rbaumg/trac,rbaumg/trac,rbaumg/trac,rbaumg/trac
--- +++ @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2003-2016 Edgewall Software +# Copyright (C) 2003-2016 Jonas Borgström <jonas@edgewall.com> +# All rights reserved. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. Th...
c2d4c53b384a4f621ac69a813cf5d1090d6e61bd
members/crm/migrations/0028_auto_20200114_0921.py
members/crm/migrations/0028_auto_20200114_0921.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.23 on 2020-01-14 09:21 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('crm', '0027_auto_20190920_0824'), ] operations = [ migrations.AlterField( ...
Add Consortia Org as new membership type
Add Consortia Org as new membership type
Python
mit
ocwc/ocwc-members,ocwc/ocwc-members,ocwc/ocwc-members,ocwc/ocwc-members
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.23 on 2020-01-14 09:21 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('crm', '0027_auto_20190920_0824'), + ] + + opera...
b9609a25c80d3f0c28c173bf31fb7968c0474fbe
pelops/datasets/featuredataset.py
pelops/datasets/featuredataset.py
import abc import json import datetime import h5py import numpy as np from pelops.datasets.chip import ChipDataset class FeatureDataset(ChipDataset): def __init__(self, filename): # TODO: Call super self.chips, self.feats = self.load(filename) @staticmethod def load(filename): ...
Create new FeatureDataset class to be used by experiment
Create new FeatureDataset class to be used by experiment
Python
apache-2.0
dave-lab41/pelops,Lab41/pelops,d-grossman/pelops,dave-lab41/pelops,d-grossman/pelops,Lab41/pelops
--- +++ @@ -0,0 +1,56 @@ +import abc +import json +import datetime +import h5py +import numpy as np +from pelops.datasets.chip import ChipDataset + +class FeatureDataset(ChipDataset): + def __init__(self, filename): + # TODO: Call super + self.chips, self.feats = self.load(filename) + + @stati...
2d626519e669563c655b885783f9b02946640d21
refstack/db/migrations/alembic/versions/434be17a6ec3_fix_openids_with_space.py
refstack/db/migrations/alembic/versions/434be17a6ec3_fix_openids_with_space.py
"""Fix openids with spaces. A change in the openstackid naming made is so IDs with spaces are trimmed, so %20 are no longer in the openid url. This migration will replace any '%20' with a '.' in each openid. Revision ID: 434be17a6ec3 Revises: 59df512e82f Create Date: 2017-03-23 12:20:08.219294 """ # revision identi...
Add openid fix migration script
Add openid fix migration script Users who previously had a '%20' in their openstackids currently aren't able to access their data on RefStack. This is because a '.' has taken the place of '%20' in a recent openstack id update. This migration will reflect this change in the database. Reference: https://review.openstac...
Python
apache-2.0
openstack/refstack,openstack/refstack,stackforge/refstack,stackforge/refstack,stackforge/refstack,openstack/refstack,openstack/refstack,stackforge/refstack
--- +++ @@ -0,0 +1,64 @@ +"""Fix openids with spaces. + +A change in the openstackid naming made is so IDs with spaces +are trimmed, so %20 are no longer in the openid url. This migration +will replace any '%20' with a '.' in each openid. + +Revision ID: 434be17a6ec3 +Revises: 59df512e82f +Create Date: 2017-03-23 12:...
b2b40ee243b24a39cf9958736d0b2d18dd78417a
python/stepper.py
python/stepper.py
#!/usr/bin/env python # http://www.youtube.com/watch?v=Dc16mKFA7Fo import time, sys, exceptions import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) ControlPin = [18,22,24,26] for pin in ControlPin: GPIO.setup(pin,GPIO.OUT) GPIO.output(pin, 0) seq = [ [1,0,0,0], [1,1,0,0], ...
Call the python script which is MUCH faster than php gpio
Call the python script which is MUCH faster than php gpio
Python
mit
theapi/CctvBlindfoldBundle,theapi/CctvBlindfoldBundle,theapi/CctvBlindfoldBundle,theapi/CctvBlindfoldBundle
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +# http://www.youtube.com/watch?v=Dc16mKFA7Fo + +import time, sys, exceptions +import RPi.GPIO as GPIO + + +GPIO.setmode(GPIO.BOARD) +GPIO.setwarnings(False) + +ControlPin = [18,22,24,26] + +for pin in ControlPin: + GPIO.setup(pin,GPIO.OUT) + GPIO.output(pin, 0) + +...
7991e4bdcc31137ff4634144acd1469dbe09eb07
POST_TEST.py
POST_TEST.py
from posts.nc import * import posts.iso output('POST_TEST.txt') program_begin(123, 'Test program') absolute() metric() set_plane(0) feedrate(420) rapid(100,120) rapid(z=50) feed(z=0) rapid(z=50) rapid_home() program_end()
Test for ISO NC creator
Test for ISO NC creator
Python
bsd-3-clause
JamieFBousfield/heekscnc,sangit/heekscnc,dnevels/heekscnc,hackendless/heekscnc,pyrotron/heekscnc,pyrotron/heekscnc,gaziel/heekscnc,JamieFBousfield/heekscnc,AlanZheng/heekscnc,FluffyMortain/heekscnc,BbiKkuMi/heekscnc,Nurb432/heekscnc,gaziel/heekscnc,singwina/heekscnc,blakelyc/heekscnc,tbinias/heekscnc,ant-t/heekscnc,ant...
--- +++ @@ -0,0 +1,19 @@ +from posts.nc import * +import posts.iso + +output('POST_TEST.txt') + +program_begin(123, 'Test program') +absolute() +metric() +set_plane(0) + +feedrate(420) +rapid(100,120) +rapid(z=50) +feed(z=0) +rapid(z=50) + +rapid_home() + +program_end()
fbdf7e53dba142cf45270e63623aea59a4ffecf6
test_add_group.py
test_add_group.py
# -*- coding: utf-8 -*- from selenium.webdriver.firefox.webdriver import WebDriver from selenium.webdriver.common.action_chains import ActionChains import time, unittest def is_alert_present(wd): try: wd.switch_to_alert().text return True except: return False class test_add_group(uni...
Test scenario written by SeleniumBuilder
Test scenario written by SeleniumBuilder
Python
apache-2.0
figharo54/python_training
--- +++ @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +from selenium.webdriver.firefox.webdriver import WebDriver +from selenium.webdriver.common.action_chains import ActionChains +import time, unittest + + +def is_alert_present(wd): + try: + wd.switch_to_alert().text + return True + except: + ...
1b7f846d096d1b8c36213666b49f2075d3f5fac1
tools/abandon_gerrit_cls.py
tools/abandon_gerrit_cls.py
#!/usr/bin/env python # # Copyright 2020 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Bulk abandon Gerrit CLs.""" import argparse import os import re import subprocess import sys from infra import git from infra import go def run_abandon_c...
Add wrapper script to call tool to bulk abandon Gerrit CLs
Add wrapper script to call tool to bulk abandon Gerrit CLs Makes it easy to invoke https://skia-review.googlesource.com/c/buildbot/+/275096 from the Skia repo Change-Id: If94d506d86a2b4319c7e0a7c830d5dab27916c10 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275693 Commit-Queue: Ravi Mistry <9fa2e7438b8cb...
Python
bsd-3-clause
google/skia,google/skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/platform_external_skia,google/skia,google/skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/pl...
--- +++ @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# +# Copyright 2020 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Bulk abandon Gerrit CLs.""" + + +import argparse +import os +import re +import subprocess +import sys + +from infra import...
620db37e867b25af25e6e93b90c78c1bd7ce19c3
server/auvsi_suas/migrations/0006_target_blank.py
server/auvsi_suas/migrations/0006_target_blank.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [('auvsi_suas', '0005_target'), ] operations = [ migrations.AlterField( model_name='target', name='alphanumeric', ...
Add missing blank field migration
Add missing blank field migration I forgot to create this migration when adding blank attributes to Target fields.
Python
apache-2.0
transformation/utatuav-interop,justineaster/interop,transformation/utatuav-interop,auvsi-suas/interop,justineaster/interop,transformation/utatuav-interop,auvsi-suas/interop,justineaster/interop,transformation/utatuav-interop,justineaster/interop,auvsi-suas/interop,auvsi-suas/interop,transformation/utatuav-interop,trans...
--- +++ @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [('auvsi_suas', '0005_target'), ] + + operations = [ + migrations.AlterField( + model_name='targ...
aca86345382a3b8d2fd8822e25d44cde4859cb17
IPython/core/tests/test_hooks.py
IPython/core/tests/test_hooks.py
# -*- coding: utf-8 -*- """Tests for CommandChainDispatcher.""" from __future__ import absolute_import #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- import nose.tools as nt from IPython.core.erro...
Add basic tests for CommandChainDispatcher
Add basic tests for CommandChainDispatcher
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +"""Tests for CommandChainDispatcher.""" + +from __future__ import absolute_import + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +import no...
caa85643122dfbc0337d1f0cae414707d93ebd90
comics/crawlers/supereffective.py
comics/crawlers/supereffective.py
import datetime as dt from comics.crawler.base import BaseComicCrawler from comics.crawler.meta import BaseComicMeta class ComicMeta(BaseComicMeta): name = 'Super Effective' language = 'en' url = 'http://www.vgcats.com/super/' start_date = '2008-04-23' history_capable_date = '2008-04-23' time_...
Add crawler for 'Super Effective'
Add crawler for 'Super Effective'
Python
agpl-3.0
klette/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics,datagutten/comics,klette/comics,datagutten/comics,klette/comics,datagutten/comics,jodal/comics
--- +++ @@ -0,0 +1,19 @@ +import datetime as dt + +from comics.crawler.base import BaseComicCrawler +from comics.crawler.meta import BaseComicMeta + +class ComicMeta(BaseComicMeta): + name = 'Super Effective' + language = 'en' + url = 'http://www.vgcats.com/super/' + start_date = '2008-04-23' + history...
82fa78c397d428742883ec8e1cdc94bcd3491ad3
salt/auth/rest.py
salt/auth/rest.py
# -*- coding: utf-8 -*- ''' Provide authentication using a REST call Django auth can be defined like any other eauth module: .. code-block:: yaml external_auth: rest: ^url: https://url/for/rest/call fred: - .* - '@runner' If there are entries underneath the ^url entry t...
Add simple eauth via REST
Add simple eauth via REST
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +''' +Provide authentication using a REST call + +Django auth can be defined like any other eauth module: + +.. code-block:: yaml + + external_auth: + rest: + ^url: https://url/for/rest/call + fred: + - .* + - '@runner' + +If th...
5364966528139d4f0b4d51db9c72f168547a19c5
construct/tests/test_repeaters.py
construct/tests/test_repeaters.py
import unittest from construct import OptionalGreedyRepeater, UBInt8 class TestOptionalGreedyRepeater(unittest.TestCase): def setUp(self): self.c = OptionalGreedyRepeater(UBInt8("foo")) def test_trivial(self): pass def test_empty_parse(self): self.assertEqual(self.c.parse(""), [...
Add tests for example from OGR docs.
tests: Add tests for example from OGR docs.
Python
mit
MostAwesomeDude/construct,gkonstantyno/construct,0000-bigtree/construct,mosquito/construct,gkonstantyno/construct,riggs/construct,mosquito/construct,MostAwesomeDude/construct,riggs/construct,0000-bigtree/construct
--- +++ @@ -0,0 +1,23 @@ +import unittest + +from construct import OptionalGreedyRepeater, UBInt8 + +class TestOptionalGreedyRepeater(unittest.TestCase): + + def setUp(self): + self.c = OptionalGreedyRepeater(UBInt8("foo")) + + def test_trivial(self): + pass + + def test_empty_parse(self): + ...
b3258a47ef9fa657be12687d6e8892360c27ade1
test/test_usage.py
test/test_usage.py
from ccs.icd9 import ICD9 from clinvoc.icd9 import ICD9CM, ICD9PCS from nose.tools import assert_equals def test_icd9(): codesets = ICD9() dx_vocab = ICD9CM() px_vocab = ICD9PCS() for k, v in codesets.dx_single_level_codes: assert isinstance(k, basestring) assert isinstance(v, set) # F...
Add usage test. Currently failing because expects sets and gets lists.
Add usage test. Currently failing because expects sets and gets lists.
Python
mit
mattlewissf/ccs
--- +++ @@ -0,0 +1,29 @@ +from ccs.icd9 import ICD9 +from clinvoc.icd9 import ICD9CM, ICD9PCS +from nose.tools import assert_equals + + +def test_icd9(): + codesets = ICD9() + dx_vocab = ICD9CM() + px_vocab = ICD9PCS() + for k, v in codesets.dx_single_level_codes: + assert isinstance(k, basestring)...
f75ece646685ee5f4e876d3dce962dca4859b33a
tests/integration/services/authentication/test_authenticate.py
tests/integration/services/authentication/test_authenticate.py
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from pytest import raises from byceps.services.authentication.exceptions import AuthenticationFailed from byceps.services.authentication import service as authn_service CORRECT_PASSWORD = 'opensesame' WRONG_PAS...
Test user authentication against service
Test user authentication against service
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
--- +++ @@ -0,0 +1,69 @@ +""" +:Copyright: 2006-2021 Jochen Kupperschmidt +:License: Revised BSD (see `LICENSE` file for details) +""" + +from pytest import raises + +from byceps.services.authentication.exceptions import AuthenticationFailed +from byceps.services.authentication import service as authn_service + + +CO...
92049964c334f9367016ed55bdb94d844fd2425d
python/switch_test.py
python/switch_test.py
#!/usr/bin/env python """ Test buttons by switching LED colors """ import time from octo import Octo from listener import ButtonListener def main(): octo = Octo('/dev/ttyACM0') octo.reset() handler = ButtonHandler(octo) listener = ButtonListener(octo, handler) print "Press any of the Octo butto...
Add test script for switching LEDs with Teensy buttons
Add test script for switching LEDs with Teensy buttons
Python
mit
anroots/teensy-moonica
--- +++ @@ -0,0 +1,71 @@ +#!/usr/bin/env python +""" +Test buttons by switching LED colors +""" +import time + +from octo import Octo +from listener import ButtonListener + + +def main(): + octo = Octo('/dev/ttyACM0') + octo.reset() + + handler = ButtonHandler(octo) + listener = ButtonListener(octo, handl...
24456b31fc68bf7d8b90c424951eb092ecb72d66
client.py
client.py
""" This module defines the main interface for running dlex experiments. """ import db # pylint: disable=unused-import class Client(object): """An object for executing CLI commands.""" def __init__(self, db_name='test.db'): self.ddb = db.DLEXDB(db_name) def close(self): # type: () -> () ...
Add class for running CLI commands
Add class for running CLI commands This commit adds a module which contains a class for running commands which will be invoked by the command-line interface.
Python
apache-2.0
sagelywizard/dlex
--- +++ @@ -0,0 +1,68 @@ +""" +This module defines the main interface for running dlex experiments. +""" +import db # pylint: disable=unused-import + +class Client(object): + """An object for executing CLI commands.""" + def __init__(self, db_name='test.db'): + self.ddb = db.DLEXDB(db_name) + + def cl...
cf2db79a4f1d93ea6015931cdcf58c9e09cc8bfb
imap_cli/tests/test_search.py
imap_cli/tests/test_search.py
# -*- coding: utf-8 -*- """Test helpers""" import imaplib import unittest from imap_cli import config from imap_cli import list_mail from imap_cli import tests class HelpersTest(unittest.TestCase): def setUp(self): self.ctx = config.new_context_from_file('~/.config/imap-cli') imaplib.IMAP4_SS...
Add test for basic search
Add test for basic search
Python
mit
Gentux/imap-cli,Gentux/imap-cli
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + + +"""Test helpers""" + + +import imaplib +import unittest + +from imap_cli import config +from imap_cli import list_mail +from imap_cli import tests + + +class HelpersTest(unittest.TestCase): + def setUp(self): + self.ctx = config.new_context_from_file('~...
1a67e1a5b1e6830df0667689a832dea0b9460656
CodeFights/evenDigitsOnly.py
CodeFights/evenDigitsOnly.py
#!/usr/local/bin/python # Code Fights Add Border Problem def evenDigitsOnly(n): return sum(map(lambda d: int(d) % 2, str(n))) == 0 # Alternative solution # return all([int(i) % 2 == 0 for i in str(n)]) def main(): tests = [ [248622, True], [642386, False], [248842, True], ...
Solve Code Fights even digits only problem
Solve Code Fights even digits only problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,36 @@ +#!/usr/local/bin/python +# Code Fights Add Border Problem + + +def evenDigitsOnly(n): + return sum(map(lambda d: int(d) % 2, str(n))) == 0 + # Alternative solution + # return all([int(i) % 2 == 0 for i in str(n)]) + + +def main(): + tests = [ + [248622, True], + [64...
da66d477986b2ddc6c80f7fb0e59c93b2182c576
visualize_trajectories.py
visualize_trajectories.py
import argparse import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from gui.grid_image_visualizer import GridImageVisualizer from gui.arrow_plotter import ArrowPlotter import utils def main(): parser = argparse.ArgumentParser() parser.add_argument('data_fname', type=str, help='file name of...
Add script to visualize trajectories images and actions
Add script to visualize trajectories images and actions
Python
mit
alexlee-gk/visual_dynamics
--- +++ @@ -0,0 +1,49 @@ +import argparse +import matplotlib.pyplot as plt +import matplotlib.gridspec as gridspec +from gui.grid_image_visualizer import GridImageVisualizer +from gui.arrow_plotter import ArrowPlotter +import utils + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('dat...
1a534acf6038b35c8bba125c277d349ec967d5bd
lc0246_strobogrammatic_number.py
lc0246_strobogrammatic_number.py
"""Leetcode 246. Strobogrammatic Number Easy URL: https://leetcode.com/problems/strobogrammatic-number/A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a number is strobogrammatic. The number is represented as a string. Exampl...
"""Leetcode 246. Strobogrammatic Number Easy URL: https://leetcode.com/problems/strobogrammatic-number/A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a number is strobogrammatic. The number is represented as a string. Exampl...
Complete map dict sol w/ time/space complexity
Complete map dict sol w/ time/space complexity
Python
bsd-2-clause
bowen0701/algorithms_data_structures
--- +++ @@ -20,27 +20,55 @@ """ -class Solution(object): +class SolutionMapDictIter(object): def isStrobogrammatic(self, num): """ :type num: str :rtype: bool + + Time complexity: O(n). + Space complexity: O(n). """ - pass + # Reverse num. + ...
77f4c96b4ee2a3964fb41396cd230b5a35b8ba00
dipy/utils/tests/test_tripwire.py
dipy/utils/tests/test_tripwire.py
""" Testing tripwire module. """ from ..tripwire import TripWire, is_tripwire, TripWireError from nose import SkipTest from nose.tools import (assert_true, assert_false, assert_raises, assert_equal, assert_not_equal) def test_is_tripwire(): assert_false(is_tripwire(object())) assert_...
Add a test for TripWire.
TST: Add a test for TripWire.
Python
bsd-3-clause
nilgoyyou/dipy,FrancoisRheaultUS/dipy,villalonreina/dipy,matthieudumont/dipy,FrancoisRheaultUS/dipy,villalonreina/dipy,StongeEtienne/dipy,matthieudumont/dipy,nilgoyyou/dipy,StongeEtienne/dipy
--- +++ @@ -0,0 +1,29 @@ +""" Testing tripwire module. +""" + +from ..tripwire import TripWire, is_tripwire, TripWireError + +from nose import SkipTest +from nose.tools import (assert_true, assert_false, assert_raises, + assert_equal, assert_not_equal) + + +def test_is_tripwire(): + assert_f...
b4292176e1bed76a24a9d1d83a6781c85adea069
diet_gtfs.py
diet_gtfs.py
import csv import sys def clean_agency_file(*agencies): with open('agency.txt', 'r') as f: reader = csv.reader(f) next(f) for row in reader: if row[0] in agencies: print(row) def main(): agencies = sys.argv[1:] clean_agency_file(*agencies) if __name_...
Add initial code to open agency.txt
Add initial code to open agency.txt
Python
bsd-2-clause
sensiblecodeio/diet-gtfs
--- +++ @@ -0,0 +1,20 @@ +import csv +import sys + + +def clean_agency_file(*agencies): + with open('agency.txt', 'r') as f: + reader = csv.reader(f) + next(f) + for row in reader: + if row[0] in agencies: + print(row) + + +def main(): + agencies = sys.argv[1:] + ...
a45dbf6720292ea5052a1da022aece11b3523c1e
channels/r_slimerancher/app.py
channels/r_slimerancher/app.py
#encoding:utf-8 from utils import get_url # Subreddit that will be a source of content subreddit = 'slimerancher' # Telegram channel with @reddit2telegram_bot as an admin t_channel = '@r_slimerancher' def send_post(submission, r2t): what, url, ext = get_url(submission) # If this func returns: # False –...
Add script to handle posts from r_slimerancher
Add script to handle posts from r_slimerancher Based on various app.py fom other channels Don't know if that's correct cause I've never done anything in python before xD
Python
mit
Fillll/reddit2telegram,nsiregar/reddit2telegram,nsiregar/reddit2telegram,Fillll/reddit2telegram
--- +++ @@ -0,0 +1,43 @@ +#encoding:utf-8 + +from utils import get_url + +# Subreddit that will be a source of content +subreddit = 'slimerancher' +# Telegram channel with @reddit2telegram_bot as an admin +t_channel = '@r_slimerancher' + + +def send_post(submission, r2t): + what, url, ext = get_url(submission) + +...
ac0fa1df1569f81b0a469f8439cf7f9e916bb208
tests/unit/test_compress.py
tests/unit/test_compress.py
# -*- coding: utf-8 -*- ''' Test database compression functions ''' # Import sorbic libs import sorbic.db # Import python libs import os import shutil import unittest import tempfile class TestCompress(unittest.TestCase): ''' Cover compression possibilities ''' def test_compress_no_changes(self): ...
Add initial basic test for compression
Add initial basic test for compression
Python
apache-2.0
s0undt3ch/sorbic,thatch45/sorbic
--- +++ @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +''' +Test database compression functions +''' +# Import sorbic libs +import sorbic.db + +# Import python libs +import os +import shutil +import unittest +import tempfile + + +class TestCompress(unittest.TestCase): + ''' + Cover compression possibilities + ''...
8793c14aee7e2fb482a173a8650e2a961ea6cc46
scripts/generate_agency_ranking.py
scripts/generate_agency_ranking.py
from collections import defaultdict import sys import django django.setup() from busshaming.models import Agency, RouteDate, Feed FEED_SLUG = 'nsw-buses' MIN_TRIPS = 500 MIN_RT_ENTRIES = 0 def main(is_best, verylate): feed = Feed.objects.get(slug=FEED_SLUG) routedates = defaultdict(list) for rd in Rou...
Add script to show agency rankings.
Add script to show agency rankings.
Python
mit
katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming
--- +++ @@ -0,0 +1,58 @@ +from collections import defaultdict +import sys +import django +django.setup() + +from busshaming.models import Agency, RouteDate, Feed + +FEED_SLUG = 'nsw-buses' + + +MIN_TRIPS = 500 +MIN_RT_ENTRIES = 0 + + +def main(is_best, verylate): + feed = Feed.objects.get(slug=FEED_SLUG) + rout...
149ce526143265d1d265761a9fb57bb66ee7a75a
functional/tests/volume/v1/test_volume_type.py
functional/tests/volume/v1/test_volume_type.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Add functional tests for volume type list
Add functional tests for volume type list add tests for `os volume type list` Change-Id: Icd874b9cfac9376cc410041806fac64f1ff0c59d
Python
apache-2.0
dtroyer/python-openstackclient,dtroyer/python-openstackclient,BjoernT/python-openstackclient,openstack/python-openstackclient,openstack/python-openstackclient,redhat-openstack/python-openstackclient,redhat-openstack/python-openstackclient,BjoernT/python-openstackclient
--- +++ @@ -0,0 +1,40 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agr...
bbf34e5fc3f1728f889065c252b32f175d63cbe1
nn_patterns/utils/fileio.py
nn_patterns/utils/fileio.py
# Begin: Python 2/3 compatibility header small # Get Python 3 functionality: from __future__ import\ absolute_import, print_function, division, unicode_literals from future.utils import raise_with_traceback, raise_from # catch exception with: except Exception as e from builtins import range, map, zip, filter from i...
Add simple interface to store parameters and patterns across python 2 and 3.
Add simple interface to store parameters and patterns across python 2 and 3.
Python
mit
pikinder/nn-patterns
--- +++ @@ -0,0 +1,43 @@ +# Begin: Python 2/3 compatibility header small +# Get Python 3 functionality: +from __future__ import\ + absolute_import, print_function, division, unicode_literals +from future.utils import raise_with_traceback, raise_from +# catch exception with: except Exception as e +from builtins imp...
c395da80c02b6c39514fcc46a7b951c71ae2c12b
usingnamespace/api/views/v1/root.py
usingnamespace/api/views/v1/root.py
from pyramid.view import view_config from ....views.finalisecontext import FinaliseContext class APIV1(FinaliseContext): @view_config(context='...traversal.v1.Root', route_name='api', renderer='json') def main(self): sites = [] for site in self.context.sites: sites.append( ...
Add view for API v1 Root
Add view for API v1 Root This sends back a JSON response contain sites with ID's as well as title/tagline.
Python
isc
usingnamespace/usingnamespace
--- +++ @@ -0,0 +1,21 @@ +from pyramid.view import view_config + + +from ....views.finalisecontext import FinaliseContext + +class APIV1(FinaliseContext): + @view_config(context='...traversal.v1.Root', route_name='api', renderer='json') + def main(self): + sites = [] + for site in self.context.sit...
da16bec07e245e440acea629ad953e4a56085f7e
scripts/util.py
scripts/util.py
import time import logging from cassandra.cqlengine.query import Token from scrapi.database import _manager from scrapi.processing.cassandra import DocumentModel _manager.setup() logger = logging.getLogger(__name__) def documents(*sources): q = DocumentModel.objects.timeout(500).allow_filtering().all().limit(1...
import time import logging from cassandra.cqlengine.query import Token from scrapi.database import _manager from scrapi.processing.cassandra import DocumentModel, DocumentModelV2 _manager.setup() logger = logging.getLogger(__name__) def ModelIteratorFactory(model, next_page): def model_iterator(*sources): ...
Add ability to iterate over old document model and new document model for migrations
Add ability to iterate over old document model and new document model for migrations
Python
apache-2.0
CenterForOpenScience/scrapi,ostwald/scrapi,fabianvf/scrapi,mehanig/scrapi,alexgarciac/scrapi,felliott/scrapi,icereval/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,mehanig/scrapi,erinspace/scrapi,felliott/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi
--- +++ @@ -4,25 +4,34 @@ from cassandra.cqlengine.query import Token from scrapi.database import _manager -from scrapi.processing.cassandra import DocumentModel +from scrapi.processing.cassandra import DocumentModel, DocumentModelV2 _manager.setup() logger = logging.getLogger(__name__) -def documents(*so...
c1bec6e99e04785e102d4de1e1a82d8a78d2b9ff
config/fuzz_pox_proactive.py
config/fuzz_pox_proactive.py
from config.experiment_config_lib import ControllerConfig from sts.topology import FatTree from sts.control_flow import Fuzzer from sts.input_traces.input_logger import InputLogger from sts.simulation_state import SimulationConfig from sts.util.convenience import backtick def get_additional_metadata(): path = "dart...
Add config for fuzzing POX proactive mode
Add config for fuzzing POX proactive mode
Python
apache-2.0
ucb-sts/sts,jmiserez/sts,jmiserez/sts,ucb-sts/sts
--- +++ @@ -0,0 +1,38 @@ + +from config.experiment_config_lib import ControllerConfig +from sts.topology import FatTree +from sts.control_flow import Fuzzer +from sts.input_traces.input_logger import InputLogger +from sts.simulation_state import SimulationConfig +from sts.util.convenience import backtick + +def get_a...
1293197f86e85d346b65f5fb065ce6099031a5d3
src/ggrc_basic_permissions/migrations/versions/20131210004352_1a22bb208258_auditors_have_docume.py
src/ggrc_basic_permissions/migrations/versions/20131210004352_1a22bb208258_auditors_have_docume.py
"""Auditors have document and meeting permissions in audit context. Revision ID: 1a22bb208258 Revises: 1f865f61312 Create Date: 2013-12-10 00:43:52.151598 """ # revision identifiers, used by Alembic. revision = '1a22bb208258' down_revision = '1f865f61312' import sqlalchemy as sa from alembic import op from datetim...
Add permission to read Document and Meeting resources in the Audit context for Auditor role.
Add permission to read Document and Meeting resources in the Audit context for Auditor role.
Python
apache-2.0
uskudnik/ggrc-core,andrei-karalionak/ggrc-core,hyperNURb/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,selahssea/ggrc-core,vladan-m/ggrc-core,vladan-m/ggrc-core,hasanalom/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,hyperNURb/ggrc-core,josthkko/ggrc-core,uskudnik/ggrc-core,vladan-m/ggrc-c...
--- +++ @@ -0,0 +1,48 @@ + +"""Auditors have document and meeting permissions in audit context. + +Revision ID: 1a22bb208258 +Revises: 1f865f61312 +Create Date: 2013-12-10 00:43:52.151598 + +""" + +# revision identifiers, used by Alembic. +revision = '1a22bb208258' +down_revision = '1f865f61312' + +import sqlalchemy ...
c7bbec07e9b1bd87a48bdae87071b59c0a575153
test/test_conn.py
test/test_conn.py
# pylint: skip-file from __future__ import absolute_import from errno import EALREADY, EINPROGRESS, EISCONN, ECONNRESET import socket import time import pytest from kafka.conn import BrokerConnection, ConnectionStates @pytest.fixture def socket(mocker): socket = mocker.MagicMock() socket.connect_ex.return_...
Add basic unit test coverage for BrokerConnection
Add basic unit test coverage for BrokerConnection
Python
apache-2.0
mumrah/kafka-python,scrapinghub/kafka-python,Yelp/kafka-python,dpkp/kafka-python,wikimedia/operations-debs-python-kafka,DataDog/kafka-python,scrapinghub/kafka-python,wikimedia/operations-debs-python-kafka,ohmu/kafka-python,Aloomaio/kafka-python,zackdever/kafka-python,mumrah/kafka-python,Yelp/kafka-python,dpkp/kafka-pyt...
--- +++ @@ -0,0 +1,82 @@ +# pylint: skip-file +from __future__ import absolute_import + +from errno import EALREADY, EINPROGRESS, EISCONN, ECONNRESET +import socket +import time + +import pytest + +from kafka.conn import BrokerConnection, ConnectionStates + + +@pytest.fixture +def socket(mocker): + socket = mocker...
8fe3932189d483efc72e0d34a9417ffbb34f5809
test/test_sync.py
test/test_sync.py
import unittest import canopen class TestSync(unittest.TestCase): def test_sync_producer(self): network = canopen.Network() network.connect(bustype="virtual", receive_own_messages=True) producer = canopen.sync.SyncProducer(network) producer.transmit() msg = network.bus.rec...
Add unit test for SYNC producer
Add unit test for SYNC producer Test one-shot SYNC transmission with and without counter value.
Python
mit
christiansandberg/canopen,christiansandberg/canopen
--- +++ @@ -0,0 +1,29 @@ +import unittest +import canopen + + +class TestSync(unittest.TestCase): + + def test_sync_producer(self): + network = canopen.Network() + network.connect(bustype="virtual", receive_own_messages=True) + producer = canopen.sync.SyncProducer(network) + producer.tr...
32e66fe95a60becdb3e15152f2cea1bad0ac8460
artists/migrations/0001_initial.py
artists/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import model_utils.fields import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Artist', ...
Add migrations for artists app
Add migrations for artists app
Python
bsd-3-clause
FreeMusicNinja/api.freemusic.ninja
--- +++ @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import model_utils.fields +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateMod...
9008062fc37dcc2f4aefe570daf94018b7e76223
hiora_cartpole/fourier_fa_int.py
hiora_cartpole/fourier_fa_int.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import itertools import numpy as np import sympy as sp def dot(es1, es2): return sum([e[0]*e[1] for e in zip(es1, es2)]) # Copied from hiora_cartpole.fourier_fa def c_matrix(order, n_dims): """ Generates the parameter (C) vectors for all ...
Add module symbolic Fourier FA integration
Add module symbolic Fourier FA integration
Python
mit
rmoehn/cartpole
--- +++ @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals + +import itertools + +import numpy as np +import sympy as sp + +def dot(es1, es2): + return sum([e[0]*e[1] for e in zip(es1, es2)]) + + +# Copied from hiora_cartpole.fourier_fa +def c_matrix(order, n_dims): + """ + ...
0ffe004cdb15296db20edc0c5bbebe761cad387a
tests/test_cmi.py
tests/test_cmi.py
# -*- coding: utf-8 -*- # Copyright (c) 2010-2016, MIT Probabilistic Computing Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
Add barebones bql query test cases.
Add barebones bql query test cases.
Python
apache-2.0
probcomp/bayeslite,probcomp/bayeslite
--- +++ @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2010-2016, MIT Probabilistic Computing Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# h...
908f61e4cc19f0ee1586480389afe494c900154a
test/test_commands.py
test/test_commands.py
import os import pytest TEST_URL = str(os.environ.get('TEST_URL')) if TEST_URL != 'None' and TEST_URL.strip(): pass else: TEST_URL="https://192.168.10.10:8443/api" @pytest.mark.parametrize("command", [ ("curl -k " + TEST_URL + " | grep 'kind.*:.*APIVersions'"), ("oc get node | grep '10.0.2.15.*Ready'"), ("o...
Add test for command output
Add test for command output
Python
mit
wicksy/vagrant-openshift,wicksy/vagrant-openshift,wicksy/vagrant-openshift
--- +++ @@ -0,0 +1,19 @@ +import os +import pytest + +TEST_URL = str(os.environ.get('TEST_URL')) +if TEST_URL != 'None' and TEST_URL.strip(): + pass +else: + TEST_URL="https://192.168.10.10:8443/api" + +@pytest.mark.parametrize("command", [ + ("curl -k " + TEST_URL + " | grep 'kind.*:.*APIVersions'"), + ("oc get ...
d566acfc2d7f4ac33b64c1c950d4ec7d32199d86
tests/test_helpers.py
tests/test_helpers.py
from api.search import helpers def test_reverse_complement(): seq = "ATGCCCTGA" rc_seq = "TCAGGGCAT" assert helpers.reverse_completement(seq) == rc_seq def test_calculate_sequence(): seq = "ATGCCCTGA" assert helpers.calculate_sequence('+', seq) == seq assert helpers.calculate_sequence('-', ...
Increase test coverage for helper functions
search: Increase test coverage for helper functions Signed-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>
Python
agpl-3.0
antismash/db-api,antismash/db-api
--- +++ @@ -0,0 +1,14 @@ +from api.search import helpers + + +def test_reverse_complement(): + seq = "ATGCCCTGA" + rc_seq = "TCAGGGCAT" + + assert helpers.reverse_completement(seq) == rc_seq + + +def test_calculate_sequence(): + seq = "ATGCCCTGA" + assert helpers.calculate_sequence('+', seq) == seq + ...
0958e53a8132b168d0adcfad30b56251fb9e7132
jobmon/test/test_event_server.py
jobmon/test/test_event_server.py
import os import select import socket import time import unittest from jobmon.protocol import * from jobmon import event_server, transport PORT = 9999 class TestEventServer(unittest.TestCase): def test_event_server(self): event_srv = event_server.EventServer(PORT) event_srv.start() time.s...
Add a test for the event server
Add a test for the event server
Python
bsd-2-clause
adamnew123456/jobmon
--- +++ @@ -0,0 +1,40 @@ +import os +import select +import socket +import time +import unittest + +from jobmon.protocol import * +from jobmon import event_server, transport + +PORT = 9999 + +class TestEventServer(unittest.TestCase): + def test_event_server(self): + event_srv = event_server.EventServer(PORT)...
e52b58e823e803c0cce47a1e24e41577088a25a0
future/tests/test_imports_urllib.py
future/tests/test_imports_urllib.py
import unittest import sys print([m for m in sys.modules if m.startswith('urllib')]) class MyTest(unittest.TestCase): def test_urllib(self): import urllib print(urllib.__file__) from future import standard_library with standard_library.hooks(): import urllib.response ...
Add a new little urllib import test
Add a new little urllib import test
Python
mit
michaelpacer/python-future,michaelpacer/python-future,QuLogic/python-future,krischer/python-future,krischer/python-future,PythonCharmers/python-future,PythonCharmers/python-future,QuLogic/python-future
--- +++ @@ -0,0 +1,15 @@ +import unittest +import sys +print([m for m in sys.modules if m.startswith('urllib')]) + +class MyTest(unittest.TestCase): + def test_urllib(self): + import urllib + print(urllib.__file__) + from future import standard_library + with standard_library.hooks(): +...
91c36cd8cccae258dc9dfd51415b328eac9bdbbe
scripts/OpenFOAM/plotCFL.py
scripts/OpenFOAM/plotCFL.py
import numpy as np from matplotlib.pyplot import * CFL = [] inFile = open('./log_0_20','r') for line in inFile: if ('Courant Number mean' in str(line)): field = line.split() CFL.append(float(field[len(field)-1])) inFile.close() inFile = open('./log_20_30','r') for line in inFile: if ('Courant Number mean' in s...
Add script to plot CFL - needs to be modified
Add script to plot CFL - needs to be modified
Python
mit
mesnardo/snake
--- +++ @@ -0,0 +1,29 @@ +import numpy as np +from matplotlib.pyplot import * + +CFL = [] +inFile = open('./log_0_20','r') +for line in inFile: + if ('Courant Number mean' in str(line)): + field = line.split() + CFL.append(float(field[len(field)-1])) +inFile.close() + +inFile = open('./log_20_30','r') +for line in...
06fc94beb1f0e557be11010eaaf9635350940865
insertion_sort.py
insertion_sort.py
def insertion_sort(un_list): for idx in range(1, len(un_list)): current = un_list[idx] position = idx while position > 0 and un_list[position-1] > current: un_list[position] = un_list[position-1] position = position - 1 un_list[position] = current if __name...
Add insertion sort method to module.
Add insertion sort method to module.
Python
mit
jonathanstallings/data-structures
--- +++ @@ -0,0 +1,13 @@ +def insertion_sort(un_list): + for idx in range(1, len(un_list)): + current = un_list[idx] + position = idx + + while position > 0 and un_list[position-1] > current: + un_list[position] = un_list[position-1] + position = position - 1 + + u...
facf99d88c09dbc1661bfd9a5151d15756ffb901
__init__.py
__init__.py
import httplib2 import simplejson import logging from urlparse import urljoin import types # TODO configurable? BASE_URL = 'http://127.0.0.1:8080/' class RemoteObject(object): fields = () objects = {} def __init__(self, **kwargs): # create object properties for all desired fields for fiel...
Move typepad module into a directory so it can be externals-ed
Move typepad module into a directory so it can be externals-ed
Python
bsd-3-clause
typepad/python-typepad-api
--- +++ @@ -0,0 +1,84 @@ +import httplib2 +import simplejson +import logging +from urlparse import urljoin +import types + +# TODO configurable? +BASE_URL = 'http://127.0.0.1:8080/' + +class RemoteObject(object): + fields = () + objects = {} + + def __init__(self, **kwargs): + # create object properti...
4a5bfa4113a25ba128c0ee8d2a75b12e3f0c3e18
scripts/gtr-pages.py
scripts/gtr-pages.py
from __future__ import print_function import json, os, sys if __name__ == '__main__': if len(sys.argv) < 3: print('Usage: gtr-pages.py <input directory> <output directory>', file=sys.stderr) exit(1) indir = sys.argv[1] outdir = sys.argv[2] os.mkdir(outdir) for file in os.listdir(os....
Add script to write cluster HTML files for GtR.
Add script to write cluster HTML files for GtR.
Python
apache-2.0
ViralTexts/vt-passim,ViralTexts/vt-passim,ViralTexts/vt-passim
--- +++ @@ -0,0 +1,18 @@ +from __future__ import print_function +import json, os, sys + +if __name__ == '__main__': + if len(sys.argv) < 3: + print('Usage: gtr-pages.py <input directory> <output directory>', file=sys.stderr) + exit(1) + indir = sys.argv[1] + outdir = sys.argv[2] + os.mkdir(o...
3b047ef48ae89d49d98675a0720a856cee829deb
scripts/read_kest.py
scripts/read_kest.py
""" Reads thermal conductivity and statistics for a list of trials and saves results to a yaml file """ import os import yaml from thermof.parameters import k_parameters from thermof.read import read_run_info, read_trial # --------------------------------------------------- main = '' ...
Add script for reading k for list of trials
Add script for reading k for list of trials
Python
mit
kbsezginel/tee_mof,kbsezginel/tee_mof
--- +++ @@ -0,0 +1,44 @@ +""" +Reads thermal conductivity and statistics for a list of trials and saves results to a yaml file +""" +import os +import yaml +from thermof.parameters import k_parameters +from thermof.read import read_run_info, read_trial + +# --------------------------------------------------- +main = ...