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
d4ed2619bb7f1d49df7a6add98309de5f2201a8d
tests/destination_finder_test.py
tests/destination_finder_test.py
import unittest import datetime import json import sys sys.path.append('..') import sabre_dev_studio import sabre_dev_studio.sabre_exceptions as sabre_exceptions ''' requires config.json in the same directory for api authentication { "sabre_client_id": -----, "sabre_client_secret": ----- } ''' class TestBasicDest...
Fix destination finder test to actually produce results
Fix destination finder test to actually produce results
Python
mit
Jamil/sabre_dev_studio
--- +++ @@ -0,0 +1,58 @@ +import unittest +import datetime +import json +import sys + +sys.path.append('..') +import sabre_dev_studio +import sabre_dev_studio.sabre_exceptions as sabre_exceptions + +''' +requires config.json in the same directory for api authentication + +{ + "sabre_client_id": -----, + "sabre_client...
0448c74dd655dcc871fd870c6785295973ba4139
examples/kiwilist.py
examples/kiwilist.py
import gtk from kiwi.ui.widgets.list import Column, List, SequentialColumn class Person: """The parameters need to be of the same name of the column headers""" def __init__(self, name, age, city, present): (self.name, self.age, self.city, self.present) = name, age, city, present def __re...
Add a small kiwi list example
Add a small kiwi list example
Python
lgpl-2.1
Schevo/kiwi,Schevo/kiwi,Schevo/kiwi
--- +++ @@ -0,0 +1,50 @@ +import gtk + +from kiwi.ui.widgets.list import Column, List, SequentialColumn + +class Person: + """The parameters need to be of the same name of the column headers""" + def __init__(self, name, age, city, present): + (self.name, self.age, + self.city, self.present) = na...
feebfc2d084227a015521de2fe4eea31db1fb09d
examples/list_dir.py
examples/list_dir.py
import asyncio import ampdclient MPD_HOST = '192.168.1.5' MPD_PORT = 6600 def onchange(message): print('Message received ' + str(message)) @asyncio.coroutine def start(): mpd_client = yield from ampdclient.connect(MPD_HOST, MPD_PORT) mpd_client.cb_onchange = onchange resp = yield from mpd_client....
Add example for listing directory
Add example for listing directory
Python
apache-2.0
PierreRust/ampdclient
--- +++ @@ -0,0 +1,36 @@ +import asyncio +import ampdclient + + +MPD_HOST = '192.168.1.5' +MPD_PORT = 6600 + + +def onchange(message): + print('Message received ' + str(message)) + + +@asyncio.coroutine +def start(): + mpd_client = yield from ampdclient.connect(MPD_HOST, MPD_PORT) + mpd_client.cb_onchange = ...
ad5181b36a51a0ac2ab4aaec829359711afdeda9
tests/test_executors.py
tests/test_executors.py
import asyncio import concurrent.futures from uvloop import _testbase as tb def fib(n): if n < 2: return 1 return fib(n - 2) + fib(n - 1) class _TestExecutors: def run_pool_test(self, pool_factory): async def run(): pool = pool_factory() with pool: ...
Add tests for process/thread pool executors
tests: Add tests for process/thread pool executors
Python
apache-2.0
1st1/uvloop,MagicStack/uvloop,MagicStack/uvloop
--- +++ @@ -0,0 +1,40 @@ +import asyncio +import concurrent.futures + +from uvloop import _testbase as tb + + +def fib(n): + if n < 2: + return 1 + return fib(n - 2) + fib(n - 1) + + +class _TestExecutors: + + def run_pool_test(self, pool_factory): + async def run(): + pool = pool_fa...
3e483c2dcfd89227d9a2c56578a6532439b8fca4
core/data/DataTransformer.py
core/data/DataTransformer.py
""" DataTransformer :Authors: Berend Klein Haneveld """ from vtk import vtkImageReslice class DataTransformer(object): """DataTransformer is a class that can transform a given dataset""" def __init__(self): super(DataTransformer, self).__init__() def TransformImageData(self, imageData, transform): """ :t...
Add a simple transform helper class.
Add a simple transform helper class.
Python
mit
berendkleinhaneveld/Registrationshop,berendkleinhaneveld/Registrationshop
--- +++ @@ -0,0 +1,28 @@ +""" +DataTransformer + +:Authors: + Berend Klein Haneveld +""" + +from vtk import vtkImageReslice + + +class DataTransformer(object): + """DataTransformer is a class that can transform a given dataset""" + def __init__(self): + super(DataTransformer, self).__init__() + + def TransformImageD...
1b1bc020f3e37c10072ed45271e92348a8e2fcad
pi/plot_temperature.py
pi/plot_temperature.py
import datetime import matplotlib.pyplot as pyplot import os import re import sys def main(): """Main.""" if sys.version_info.major <= 2: print('Use Python 3') return lines = [] for file_name in sorted(os.listdir('.{}temperatures'.format(os.sep))): if file_name.endswith('csv')...
Add script to plot temperatures
Add script to plot temperatures
Python
mit
bskari/eclipse-2017-hab,bskari/eclipse-2017-hab
--- +++ @@ -0,0 +1,49 @@ +import datetime +import matplotlib.pyplot as pyplot +import os +import re +import sys + + +def main(): + """Main.""" + if sys.version_info.major <= 2: + print('Use Python 3') + return + + lines = [] + for file_name in sorted(os.listdir('.{}temperatures'.format(os.se...
90aebb2fe3c4605798148adbff57deedba0ad175
test_user_operations.py
test_user_operations.py
import unittest import user from users import UserDatabase class FakeDatabaseSession: def __init__(self): self.didCommit = False self.things = [ ] def commit(self): self.didCommit = True def add(self, thingToAdd): self.things.append(thingToAdd) class FakeDatabase: def _...
Add some unit tests for common user operations
Add some unit tests for common user operations
Python
bsd-2-clause
peterhajas/LivingDex,peterhajas/LivingDex,peterhajas/LivingDex,peterhajas/LivingDex
--- +++ @@ -0,0 +1,66 @@ +import unittest +import user +from users import UserDatabase + +class FakeDatabaseSession: + def __init__(self): + self.didCommit = False + self.things = [ ] + def commit(self): + self.didCommit = True + def add(self, thingToAdd): + self.things.append(thi...
4ff2635c54d59b4dbeaff87f369c0046f35e159a
tests.py
tests.py
from django.core.exceptions import ImproperlyConfigured from django_mailgun import MailgunBackend from pytest import raises def test_configuration(): with raises(ImproperlyConfigured): MailgunBackend()
Add super simple test case
Add super simple test case
Python
mit
vangale/django-mailgun,rollokb/django-mailgun,BradWhittington/django-mailgun
--- +++ @@ -0,0 +1,9 @@ +from django.core.exceptions import ImproperlyConfigured + +from django_mailgun import MailgunBackend +from pytest import raises + + +def test_configuration(): + with raises(ImproperlyConfigured): + MailgunBackend()
328525f8435f8c97545f8d4fea85173e480f11f2
setup.py
setup.py
# -*- coding: utf-8 -*- import os from setuptools import setup def read(fname): try: return open(os.path.join(os.path.dirname(__file__), fname)).read() except: return '' setup( name='todoist-python', version='0.2.4', packages=['todoist', 'todoist.managers'], author='Doist Team'...
# -*- coding: utf-8 -*- import os from setuptools import setup def read(fname): try: return open(os.path.join(os.path.dirname(__file__), fname)).read() except: return '' setup( name='todoist-python', version='0.2.5', packages=['todoist', 'todoist.managers'], author='Doist Team'...
Update the PyPI version to 0.2.5.
Update the PyPI version to 0.2.5.
Python
mit
electronick1/todoist-python,Doist/todoist-python
--- +++ @@ -10,7 +10,7 @@ setup( name='todoist-python', - version='0.2.4', + version='0.2.5', packages=['todoist', 'todoist.managers'], author='Doist Team', author_email='info@todoist.com',
b00fef938e2fac4599bb22ef110038d76dc88f79
setup.py
setup.py
from setuptools import setup setup( name='tox-travis', description='Seamless integration of Tox into Travis CI', long_description=open('README.rst', 'rb').read().decode('utf-8'), author='Ryan Hiebert', author_email='ryan@ryanhiebert.com', url='https://github.com/ryanhiebert/tox-travis', lic...
from setuptools import setup def fread(fn): return open(fn, 'rb').read().decode('utf-8') setup( name='tox-travis', description='Seamless integration of Tox into Travis CI', long_description=fread('README.rst') + '\n\n' + fread('HISTORY.rst'), author='Ryan Hiebert', author_email='ryan@ryanhieb...
Append HISTORY to long description on PyPI
Append HISTORY to long description on PyPI
Python
mit
rpkilby/tox-travis,ryanhiebert/tox-travis,tox-dev/tox-travis
--- +++ @@ -1,9 +1,13 @@ from setuptools import setup + + +def fread(fn): + return open(fn, 'rb').read().decode('utf-8') setup( name='tox-travis', description='Seamless integration of Tox into Travis CI', - long_description=open('README.rst', 'rb').read().decode('utf-8'), + long_description=fre...
daa7273b00056d5748687eba525a8715e6228a6a
test/dataset_test.py
test/dataset_test.py
import numpy as np import theanets class TestDataset: def setUp(self): self.dataset = theanets.dataset.Dataset( np.arange(101)[:, None], label='foo', batches=4, size=10, ) def test_setup(self): assert self.dataset.label == 'foo' ...
Add tests for dataset class.
Add tests for dataset class.
Python
mit
chrinide/theanets,lmjohns3/theanets,devdoer/theanets
--- +++ @@ -0,0 +1,32 @@ +import numpy as np +import theanets + + +class TestDataset: + def setUp(self): + self.dataset = theanets.dataset.Dataset( + np.arange(101)[:, None], + label='foo', + batches=4, + size=10, + ) + + def test_setup(self): + a...
5f0e8dccb11f889cbc217ab7ce1408b978da8ef0
bin/deskew-and-unpaper.py
bin/deskew-and-unpaper.py
#!/usr/bin/env python # This script walks through all files under the current directory, # looking for those called page-001.png, page-002.png, etc. (If a # version called page-001.rotated.png, etc. is also present, that us # used as in put in preference.) For each page the script uses # "convert -deskew '40%'" and ...
Add a helper script to deskew and unpaper scanned pages
Add a helper script to deskew and unpaper scanned pages
Python
agpl-3.0
ken-muturi/pombola,hzj123/56th,mysociety/pombola,geoffkilpin/pombola,ken-muturi/pombola,mysociety/pombola,hzj123/56th,geoffkilpin/pombola,ken-muturi/pombola,patricmutwiri/pombola,patricmutwiri/pombola,hzj123/56th,geoffkilpin/pombola,patricmutwiri/pombola,ken-muturi/pombola,mysociety/pombola,hzj123/56th,mysociety/pombol...
--- +++ @@ -0,0 +1,72 @@ +#!/usr/bin/env python + +# This script walks through all files under the current directory, +# looking for those called page-001.png, page-002.png, etc. (If a +# version called page-001.rotated.png, etc. is also present, that us +# used as in put in preference.) For each page the script us...
632bc12fee8a709f1bc0600085001c4e91c077ac
storage/test/test_kv_storages_read_only.py
storage/test/test_kv_storages_read_only.py
import pytest from storage.kv_store_leveldb import KeyValueStorageLeveldb from storage.kv_store_rocksdb import KeyValueStorageRocksdb from storage.kv_store import KeyValueStorage i = 0 @pytest.yield_fixture(scope="function", params=['rocksdb', 'leveldb']) def kv(request, tempdir) -> KeyValueStorage: global i ...
Add test of read-only mode for key-value DB storages.
Add test of read-only mode for key-value DB storages. Signed-off-by: Sergey Shilov <064bbdfaeb89a0bebebfe7b388747a73c8941704@dsr-company.com>
Python
apache-2.0
evernym/zeno,evernym/plenum
--- +++ @@ -0,0 +1,59 @@ +import pytest +from storage.kv_store_leveldb import KeyValueStorageLeveldb +from storage.kv_store_rocksdb import KeyValueStorageRocksdb +from storage.kv_store import KeyValueStorage + +i = 0 + + +@pytest.yield_fixture(scope="function", params=['rocksdb', 'leveldb']) +def kv(request, tempdir)...
a6293fd84b1b393f5a2ed00f07131dc13371554b
viewer_examples/plugins/collection_plugin.py
viewer_examples/plugins/collection_plugin.py
""" ================= Collection plugin ================= Demo of a CollectionViewer for viewing collections of images with the `autolevel` rank filter connected as a plugin. """ from skimage import data from skimage.filter import rank from skimage.morphology import disk from skimage.viewer import CollectionViewer f...
Add example of connecting plugins to CollectionViewer
Add example of connecting plugins to CollectionViewer
Python
bsd-3-clause
juliusbierk/scikit-image,rjeli/scikit-image,Hiyorimi/scikit-image,michaelaye/scikit-image,ofgulban/scikit-image,chintak/scikit-image,vighneshbirodkar/scikit-image,jwiggins/scikit-image,vighneshbirodkar/scikit-image,dpshelio/scikit-image,robintw/scikit-image,ClinicalGraphics/scikit-image,michaelpacer/scikit-image,almark...
--- +++ @@ -0,0 +1,33 @@ +""" +================= +Collection plugin +================= + +Demo of a CollectionViewer for viewing collections of images with the +`autolevel` rank filter connected as a plugin. + +""" +from skimage import data +from skimage.filter import rank +from skimage.morphology import disk + +from...
09472f2cffb5fdd8481508d5a434ef9f1b1cd1a8
code/python/knub/thesis/word2vec_converter.py
code/python/knub/thesis/word2vec_converter.py
import argparse import logging from gensim.models import Word2Vec logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) if __name__ == "__main__": parser = argparse.ArgumentParser("Convert word2vec model from binary to txt") parser.add_argument("model", type=str) arg...
Add word2vec binary to txt format converter
Add word2vec binary to txt format converter
Python
apache-2.0
knub/master-thesis,knub/master-thesis,knub/master-thesis,knub/master-thesis
--- +++ @@ -0,0 +1,19 @@ +import argparse +import logging + +from gensim.models import Word2Vec + +logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) + +if __name__ == "__main__": + parser = argparse.ArgumentParser("Convert word2vec model from binary to txt") + parser.ad...
d6f2ee46ea9b56eae5769b51cff48b1c434b829c
tests/unit/sts/god_scheduler_test.py
tests/unit/sts/god_scheduler_test.py
# Copyright 2011-2013 Colin Scott # # 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 wri...
Add simple test for GodScheduler
Add simple test for GodScheduler
Python
apache-2.0
jmiserez/sts,ucb-sts/sts,ucb-sts/sts,jmiserez/sts
--- +++ @@ -0,0 +1,44 @@ +# Copyright 2011-2013 Colin Scott +# +# 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 b...
b635112d3613d47247ac22390786aaaffcd2a3fd
examples/upsidedownternet.py
examples/upsidedownternet.py
import Image, cStringIO def response(context, flow): if flow.response.headers["content-type"] == ["image/png"]: s = cStringIO.StringIO(flow.response.content) img = Image.open(s) img = img.rotate(180) s2 = cStringIO.StringIO() img.save(s2, "png") flow.response.content ...
Add an example script that turns all PNGs upside down.
Add an example script that turns all PNGs upside down.
Python
mit
dxq-git/mitmproxy,Kriechi/mitmproxy,tekii/mitmproxy,gzzhanghao/mitmproxy,ADemonisis/mitmproxy,ParthGanatra/mitmproxy,ZeYt/mitmproxy,vhaupert/mitmproxy,scriptmediala/mitmproxy,cortesi/mitmproxy,jvillacorta/mitmproxy,syjzwjj/mitmproxy,azureplus/mitmproxy,StevenVanAcker/mitmproxy,mitmproxy/mitmproxy,ccccccccccc/mitmproxy,...
--- +++ @@ -0,0 +1,9 @@ +import Image, cStringIO +def response(context, flow): + if flow.response.headers["content-type"] == ["image/png"]: + s = cStringIO.StringIO(flow.response.content) + img = Image.open(s) + img = img.rotate(180) + s2 = cStringIO.StringIO() + img.save(s2, "pn...
c145b2cc08b3bbf0d2506afb58116e1a0c2dc4fc
tests/core_tests.py
tests/core_tests.py
from graffiti import core from graffiti import util def test_schema(): assert "fn" in core.schema(1) fn = lambda x: 1 assert core.schema(fn) == util.fninfo(fn) def t(): return 1 t._schema = { "schema": 1 } assert core.schema(t) == { "schema": 1 } def test_dependencies(): g = { ...
Add tests for core graph functions
Add tests for core graph functions
Python
mit
SegFaultAX/graffiti
--- +++ @@ -0,0 +1,52 @@ +from graffiti import core +from graffiti import util + +def test_schema(): + assert "fn" in core.schema(1) + + fn = lambda x: 1 + assert core.schema(fn) == util.fninfo(fn) + + def t(): + return 1 + t._schema = { "schema": 1 } + assert core.schema(t) == { "schema": 1 ...
41f6c1c27fb8d3c63d8bb51471a24dcf9d59c1fb
tests/test_api.py
tests/test_api.py
import unittest from flask import current_app, request, abort, jsonify, g, url_for from api.api import * from api.models import User class TestApi(unittest.TestCase): def setUp(self): pass @unittest.skip("") def test_login(self): pass @unittest.skip("") def test_register(self):...
Add test methods for api end point methods
Add test methods for api end point methods
Python
mit
EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list
--- +++ @@ -0,0 +1,55 @@ +import unittest +from flask import current_app, request, abort, jsonify, g, url_for + +from api.api import * +from api.models import User + + +class TestApi(unittest.TestCase): + + def setUp(self): + pass + + @unittest.skip("") + def test_login(self): + pass + + @un...
954c92db789cf5bde4752c9b46b2c3a549820d75
tests/test_api.py
tests/test_api.py
import mock import unittest from testrail.api import API from testrail.helper import TestRailError import copy import ast class TestHTTPMethod(unittest.TestCase): def setUp(self): self.client = API() @mock.patch('testrail.api.requests.get') def test_get_ok(self, mock_get): mock_response =...
Add basic low level HTTP get tests.
Add basic low level HTTP get tests.
Python
mit
travispavek/testrail-python,travispavek/testrail
--- +++ @@ -0,0 +1,61 @@ +import mock +import unittest +from testrail.api import API +from testrail.helper import TestRailError +import copy +import ast + + +class TestHTTPMethod(unittest.TestCase): + def setUp(self): + self.client = API() + + @mock.patch('testrail.api.requests.get') + def test_get_ok...
503f651e8d0e6aa8ffeabfa0108fe21b4fa73787
udpPinger.py
udpPinger.py
#!/usr/bin/env python import sys, socket, time s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) if len(sys.argv) > 1: interval = float(eval(sys.argv[1])) else: interval = 1.0 if len(sys.argv) > 2: size = int(eval(sys.argv[2])) else: size = 1420 s.settimeout(interval) try: while True: ...
Add python script for testing with.
Add python script for testing with.
Python
bsd-3-clause
DanielCasner/esp8266-udp-throughput-test,DanielCasner/esp8266-udp-throughput-test,DanielCasner/esp8266-udp-throughput-test
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +import sys, socket, time + +s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + +if len(sys.argv) > 1: + interval = float(eval(sys.argv[1])) +else: + interval = 1.0 +if len(sys.argv) > 2: + size = int(eval(sys.argv[2])) +else: + size = 1420 + +s.settim...
4e6773000326076f13f5d9eaa0c95103fe8511e4
scripts/process_logs.py
scripts/process_logs.py
#!/usr/bin/python3 import sys import collections sums = collections.defaultdict(lambda: 0) lens = collections.defaultdict(lambda: 0) def mva(n_a, s_lb, s_a, avg_len, clients, z): n_centers = n_a + 2 V = [2] + [1 / n_a] * n_a + [1] S = [s_lb] + [s_a] * n_a + [z] is_delay = [False] * (n_centers - 1) + ...
Add script to process log outputs and do Mean Value Analysis (MVA).
Add script to process log outputs and do Mean Value Analysis (MVA).
Python
mit
gpoesia/autocomplete,gpoesia/autocomplete,gpoesia/autocomplete,gpoesia/autocomplete
--- +++ @@ -0,0 +1,51 @@ +#!/usr/bin/python3 + +import sys +import collections + +sums = collections.defaultdict(lambda: 0) +lens = collections.defaultdict(lambda: 0) + +def mva(n_a, s_lb, s_a, avg_len, clients, z): + n_centers = n_a + 2 + V = [2] + [1 / n_a] * n_a + [1] + S = [s_lb] + [s_a] * n_a + [z] + ...
f6303b46ee4b7a648bef01f8c6a171c4e1573cee
Scripts/process_files.py
Scripts/process_files.py
import os from subprocess import call inputpath = 'originals' outputpath = 'segmentations' for filename in os.listdir(inputpath): current = os.path.join(inputpath, filename) if os.path.isfile(current): call([segment_exe, current, result])
Add skeleton of python script to process multiple images.
Add skeleton of python script to process multiple images.
Python
apache-2.0
HackTheStacks/darwin-notes-image-processing,HackTheStacks/darwin-notes-image-processing
--- +++ @@ -0,0 +1,11 @@ +import os +from subprocess import call + +inputpath = 'originals' +outputpath = 'segmentations' + +for filename in os.listdir(inputpath): + current = os.path.join(inputpath, filename) + if os.path.isfile(current): + call([segment_exe, current, result]) +
a06c38b486264477e2dd741badd4a2936e80299f
tests/io/open_append.py
tests/io/open_append.py
import sys try: import _os as os except ImportError: import os if not hasattr(os, "unlink"): print("SKIP") sys.exit() try: os.unlink("testfile") except OSError: pass # Should create a file f = open("testfile", "a") f.write("foo") f.close() f = open("testfile") print(f.read()) f.close() f = ...
Add testcase for open(..., "a").
tests: Add testcase for open(..., "a").
Python
mit
orionrobots/micropython,ChuckM/micropython,adafruit/circuitpython,martinribelotta/micropython,Peetz0r/micropython-esp32,mpalomer/micropython,Peetz0r/micropython-esp32,tuc-osg/micropython,SHA2017-badge/micropython-esp32,ceramos/micropython,deshipu/micropython,TDAbboud/micropython,puuu/micropython,hiway/micropython,first...
--- +++ @@ -0,0 +1,31 @@ +import sys +try: + import _os as os +except ImportError: + import os + +if not hasattr(os, "unlink"): + print("SKIP") + sys.exit() + +try: + os.unlink("testfile") +except OSError: + pass + +# Should create a file +f = open("testfile", "a") +f.write("foo") +f.close() + +f = ...
0336f446393618ba6ab30f4d6ee8f8295e97a87e
csunplugged/resources/migrations/0010_auto_20171121_2304.py
csunplugged/resources/migrations/0010_auto_20171121_2304.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-11-21 23:04 from __future__ import unicode_literals import django.contrib.postgres.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('resources', '0009_auto_20171020_1005'), ] ope...
Update Resource migrations to reflect model changes
Update Resource migrations to reflect model changes
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
--- +++ @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-11-21 23:04 +from __future__ import unicode_literals + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('resources', '00...
962ae6e810964a00f825d6f29ec9caa1a2996d3c
tests/test_bot_support.py
tests/test_bot_support.py
import pytest from .test_bot import TestBot class TestBotSupport(TestBot): @pytest.mark.parametrize('url,result', [ ('https://google.com', ['https://google.com']), ('google.com', ['google.com']), ('google.com/search?q=instabot', ['google.com/search?q=instabot']), ('https://google...
Add test on extract urls method
Add test on extract urls method
Python
apache-2.0
ohld/instabot,instagrambot/instabot,instagrambot/instabot
--- +++ @@ -0,0 +1,19 @@ +import pytest + +from .test_bot import TestBot + + +class TestBotSupport(TestBot): + + @pytest.mark.parametrize('url,result', [ + ('https://google.com', ['https://google.com']), + ('google.com', ['google.com']), + ('google.com/search?q=instabot', ['google.com/search?q...
1b7341748cc98fcb0505cf03081b92f955279d79
tests/test_mako_engine.py
tests/test_mako_engine.py
#!/usr/bin/env python from __future__ import print_function import unittest import engines HANDLE = 'mako' class TestStringTemplate(unittest.TestCase): def setUp(self): try: import mako except ImportError: self.skipTest("mako module not available") def test_vali...
Add tests to mako engine.
Add tests to mako engine.
Python
mit
blubberdiblub/eztemplate
--- +++ @@ -0,0 +1,123 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import unittest + + +import engines + + +HANDLE = 'mako' + + +class TestStringTemplate(unittest.TestCase): + + def setUp(self): + try: + import mako + except ImportError: + self.skipTest...
c349f9a1e199b3909f7f071f25d7c3d8e6d1347d
tests/unit/test_public.py
tests/unit/test_public.py
# Import libnacl libs import libnacl.public # Import python libs import unittest class TestPublic(unittest.TestCase): ''' ''' def test_secretkey(self): ''' ''' msg = 'You\'ve got two empty halves of coconut and you\'re bangin\' \'em together.' bob = libnacl.public.SecretKey...
Add high level tests for public key encryption
Add high level tests for public key encryption
Python
apache-2.0
RaetProtocol/libnacl,coinkite/libnacl,saltstack/libnacl,johnttan/libnacl,cachedout/libnacl,mindw/libnacl
--- +++ @@ -0,0 +1,41 @@ +# Import libnacl libs +import libnacl.public + +# Import python libs +import unittest + +class TestPublic(unittest.TestCase): + ''' + ''' + def test_secretkey(self): + ''' + ''' + msg = 'You\'ve got two empty halves of coconut and you\'re bangin\' \'em together....
3f5d30b3dd47336be009091e47c20dca265414bf
find-non-ascii-char.py
find-non-ascii-char.py
#!/usr/bin/python3 import string import sys import io asciichars = string.whitespace + string.ascii_letters + string.digits + string.punctuation reset = '\x1b[0m' txt_black_bold = '\x1b[30m' on_yellow = '\x1b[43m' def print_line(line): in_non_ascii = False o = '' for c in line: if c not in ascii...
Add script to find none ASCII char in file.
Add script to find none ASCII char in file.
Python
mit
shoma/python.tools
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/python3 +import string +import sys +import io + +asciichars = string.whitespace + string.ascii_letters + string.digits + string.punctuation + +reset = '\x1b[0m' +txt_black_bold = '\x1b[30m' +on_yellow = '\x1b[43m' + + +def print_line(line): + in_non_ascii = False + o = '' + ...
c5ca7990aa3eb1abbc14e69e6a7a849db508968e
tools/virtualizer_diff.py
tools/virtualizer_diff.py
#!/usr/bin/env python # Copyright 2017 Janos Czentye <czentye@tmit.bme.hu> # # 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 helper script to create virtualizer diff
Add helper script to create virtualizer diff
Python
apache-2.0
hsnlab/escape,5GExchange/escape,5GExchange/escape,5GExchange/escape,hsnlab/escape,hsnlab/escape,5GExchange/escape,5GExchange/escape,hsnlab/escape,hsnlab/escape,5GExchange/escape,hsnlab/escape
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# Copyright 2017 Janos Czentye <czentye@tmit.bme.hu> +# +# 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/licens...
96a93627d6e72e2e04bfc2e7f6fdc67f53623288
mikrotik_config_parser.py
mikrotik_config_parser.py
import ConfigParser from mikrotik_device import MtDevice class Config(object): def __init__(self): self.config = ConfigParser.ConfigParser() self.config.read('config.ini') def get_ftp(self): ftp = {'host' : self.config.get('ftp', 'host'), 'port' : self.config.get('ftp...
Add ini file parser and fill up backup commands
Add ini file parser and fill up backup commands
Python
mit
voronovim/mikrotik-api-tools
--- +++ @@ -0,0 +1,27 @@ +import ConfigParser + +from mikrotik_device import MtDevice + + +class Config(object): + + def __init__(self): + self.config = ConfigParser.ConfigParser() + self.config.read('config.ini') + + def get_ftp(self): + ftp = {'host' : self.config.get('ftp', 'host'), + ...
be5f12fcafe2e382ec65fef864340ae8c13fa4ea
tests/unit/modules/inspect_collector_test.py
tests/unit/modules/inspect_collector_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Bo Maryniuk <bo@suse.de>` ''' # Import Python Libs from __future__ import absolute_import # Import Salt Testing Libs from salttesting import TestCase, skipIf from salttesting.mock import ( MagicMock, patch, NO_MOCK, NO_MOCK_REASON ) from salt.module...
Add initial unit test for inspectlib.collector.Inspector
Add initial unit test for inspectlib.collector.Inspector
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +''' + :codeauthor: :email:`Bo Maryniuk <bo@suse.de>` +''' +# Import Python Libs +from __future__ import absolute_import + +# Import Salt Testing Libs +from salttesting import TestCase, skipIf +from salttesting.mock import ( + MagicMock, + patch, + NO_MOCK...
4f2743ed845185de718763df6d26db390ee2eb48
test_putget.py
test_putget.py
from multiprocessing import Process, Queue q = Queue() iterations = 10000000 def produce(q): for i in range(iterations): q.put(i) if __name__ == "__main__": t = Process(target=produce, args=(q,)) t.start() previous = -1 for i in range(iterations): m = q.get() if m !...
Add equivalent put/get test in python.
Add equivalent put/get test in python.
Python
mit
abwilson/L3,abwilson/L3,tempbottle/L3,tempbottle/L3
--- +++ @@ -0,0 +1,23 @@ +from multiprocessing import Process, Queue + +q = Queue() + +iterations = 10000000 + +def produce(q): + for i in range(iterations): + q.put(i) + +if __name__ == "__main__": + t = Process(target=produce, args=(q,)) + t.start() + + previous = -1 + for i in range(iter...
5f912542a555621cd259265a5029ee4da15de972
tests/utils.py
tests/utils.py
from django.contrib.sessions.middleware import SessionMiddleware def add_session_to_request(request): # Annotate a request object with a session. middleware = SessionMiddleware() middleware.process_request(request) request.session.save() return request def setup_view(view, request, *args, **kwar...
Add test helpers! Yes, we've gotten this deep into it.
Add test helpers! Yes, we've gotten this deep into it.
Python
apache-2.0
hello-base/web,hello-base/web,hello-base/web,hello-base/web
--- +++ @@ -0,0 +1,18 @@ +from django.contrib.sessions.middleware import SessionMiddleware + + +def add_session_to_request(request): + # Annotate a request object with a session. + middleware = SessionMiddleware() + middleware.process_request(request) + request.session.save() + return request + + +def ...
f305a445b0e018a4140d5e28cd0a68ba450e7d87
tests/unit/test_default_semantic_action.py
tests/unit/test_default_semantic_action.py
# -*- coding: utf-8 -*- ####################################################################### # Name: test_default_semantic_action # Purpose: Default semantic action is applied during semantic analysis # if no action is given for node type. Default action converts # terminals to strings, remove St...
Test for default semantic action
Test for default semantic action
Python
mit
leiyangyou/Arpeggio,leiyangyou/Arpeggio
--- +++ @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +####################################################################### +# Name: test_default_semantic_action +# Purpose: Default semantic action is applied during semantic analysis +# if no action is given for node type. Default action converts +# ...
46fa2821f988dded52ca6086db2beada3ea5eea3
examples/set_explore_group_configuration.py
examples/set_explore_group_configuration.py
#!/usr/bin/env python # # Set the group configuration in explore. # import os import sys sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..')) from sdcclient import SdcClient # # Parse arguments # if len(sys.argv) != 2: print 'usage: %s <sysdig-token>' % sys.argv[0] print 'You...
Set default explore group configuration for a user
Set default explore group configuration for a user
Python
mit
draios/python-sdc-client,draios/python-sdc-client
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# +# Set the group configuration in explore. +# + +import os +import sys +sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..')) +from sdcclient import SdcClient + +# +# Parse arguments +# +if len(sys.argv) != 2: + print 'usage: %s <s...
e9e4d4af705c2c6785ddd63f5e6e94ef2e675a83
tests/integration/modules/test_autoruns.py
tests/integration/modules/test_autoruns.py
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.unit import skipIf # Import Salt libs import salt.utils @skipIf(not salt.utils.is_windows(), 'windows tests only') class AutoRunsModuleTest(Mod...
Add autoruns.list integration test for Windows
Add autoruns.list integration test for Windows
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# Import Python libs +from __future__ import absolute_import + +# Import Salt Testing libs +from tests.support.case import ModuleCase +from tests.support.unit import skipIf + +# Import Salt libs +import salt.utils + + +@skipIf(not salt.utils.is_windows(), 'windows ...
4f66b1662f3b4513bc3ea2eb3d684fc9b60fa9b3
bidb/utils/subprocess.py
bidb/utils/subprocess.py
from __future__ import absolute_import import subprocess def check_output2(args, stdin=None): p = subprocess.Popen( args, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, ) out, _ = p.communicate(input=stdin) retcode = p.wait() if retcode:...
Add our own check_output2 wrapper
Add our own check_output2 wrapper Signed-off-by: Chris Lamb <29e6d179a8d73471df7861382db6dd7e64138033@debian.org>
Python
agpl-3.0
lamby/buildinfo.debian.net,lamby/buildinfo.debian.net
--- +++ @@ -0,0 +1,20 @@ +from __future__ import absolute_import + +import subprocess + +def check_output2(args, stdin=None): + p = subprocess.Popen( + args, + stdout=subprocess.PIPE, + stdin=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + + out, _ = p.communicate(input=stdin) ...
e262a10e9a0027e8126032551cae8b6c0816ff22
build/extra_gitignore.py
build/extra_gitignore.py
#!/usr/bin/env python # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All c...
Add script for appending entries to .gitignore.
Add script for appending entries to .gitignore. TBR=kjellander Review URL: https://webrtc-codereview.appspot.com/1629004 Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc Cr-Mirrored-Commit: b69cc15467456a070333ff00f886f27ca391b85b
Python
bsd-3-clause
sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be fo...
ea4a77d171e818dede62978ced6a4f1b1b5a2d51
mzalendo/core/kenya_import_scripts/import_constituency_county_map.py
mzalendo/core/kenya_import_scripts/import_constituency_county_map.py
# Takes Paul's Excel file of constituencies to counties and # imports this into the db. import sys import os os.environ['DJANGO_SETTINGS_MODULE'] = 'mzalendo.settings' import csv from django.template.defaultfilters import slugify # Horrible boilerplate - there must be a better way :) sys.path.append( os.path.a...
Add script to sort out counties as constituency parent places.
Add script to sort out counties as constituency parent places.
Python
agpl-3.0
mysociety/pombola,geoffkilpin/pombola,Hutspace/odekro,hzj123/56th,mysociety/pombola,hzj123/56th,ken-muturi/pombola,hzj123/56th,patricmutwiri/pombola,geoffkilpin/pombola,Hutspace/odekro,patricmutwiri/pombola,mysociety/pombola,patricmutwiri/pombola,ken-muturi/pombola,patricmutwiri/pombola,Hutspace/odekro,geoffkilpin/pomb...
--- +++ @@ -0,0 +1,70 @@ +# Takes Paul's Excel file of constituencies to counties and +# imports this into the db. + +import sys +import os + +os.environ['DJANGO_SETTINGS_MODULE'] = 'mzalendo.settings' + +import csv + +from django.template.defaultfilters import slugify + +# Horrible boilerplate - there must be a bett...
b7e2391e6627d7884be7def6af9f78a2184ec484
Snippets/cmap-format.py
Snippets/cmap-format.py
#! /usr/bin/env python # Sample script to convert legacy cmap subtables to format-4 # subtables. Note that this is rarely what one needs. You # probably need to just drop the legacy subtables if the font # already has a format-4 subtable. # # Other times, you would need to convert a non-Unicode cmap # legacy subtabl...
Add script for cmap subtable format conversion
[Snippets] Add script for cmap subtable format conversion Fixes https://github.com/behdad/fonttools/issues/340
Python
mit
fonttools/fonttools,googlefonts/fonttools
--- +++ @@ -0,0 +1,40 @@ +#! /usr/bin/env python + +# Sample script to convert legacy cmap subtables to format-4 +# subtables. Note that this is rarely what one needs. You +# probably need to just drop the legacy subtables if the font +# already has a format-4 subtable. +# +# Other times, you would need to convert ...
721565636b84a1a2bf7d2c89cca2b8206b6530a2
recipe-server/normandy/recipes/migrations/0046_reset_signatures.py
recipe-server/normandy/recipes/migrations/0046_reset_signatures.py
""" Removes signatures, so they can be easily recreated during deployment. This migration is intended to be used between "eras" of signatures. As the serialization format of recipes changes, the signatures need to also change. This could be handled automatically, but it is easier to deploy if we just remove everything...
Add another signature reset migration.
recipe-server: Add another signature reset migration.
Python
mpl-2.0
mozilla/normandy,mozilla/normandy,mozilla/normandy,mozilla/normandy
--- +++ @@ -0,0 +1,47 @@ +""" +Removes signatures, so they can be easily recreated during deployment. + +This migration is intended to be used between "eras" of signatures. As +the serialization format of recipes changes, the signatures need to +also change. This could be handled automatically, but it is easier to +d...
d98d4b41c2ecab5a61f975e1b23b8e06709d4d3f
registries/serializers.py
registries/serializers.py
from rest_framework import serializers from registries.models import Organization from gwells.models import ProvinceState class DrillerListSerializer(serializers.ModelSerializer): province_state = serializers.ReadOnlyField() class Meta: model = Organization # Using all fields for now ...
Add simple driller list serializer
Add simple driller list serializer
Python
apache-2.0
rstens/gwells,bcgov/gwells,rstens/gwells,rstens/gwells,rstens/gwells,bcgov/gwells,bcgov/gwells,bcgov/gwells
--- +++ @@ -0,0 +1,26 @@ +from rest_framework import serializers +from registries.models import Organization +from gwells.models import ProvinceState + +class DrillerListSerializer(serializers.ModelSerializer): + province_state = serializers.ReadOnlyField() + + class Meta: + model = Organization + + ...
452282391f356366d208bd408e5d9b7315b6d98d
polygraph/types/tests/test_input_object.py
polygraph/types/tests/test_input_object.py
from unittest import TestCase from polygraph.exceptions import PolygraphSchemaError from polygraph.types.input_object import ( InputObject, InputValue, validate_input_object_schema, ) from polygraph.types.lazy_type import LazyType from polygraph.types.scalar import String from polygraph.types.tests.helper ...
Add unit tests around InputObject
Add unit tests around InputObject
Python
mit
polygraph-python/polygraph
--- +++ @@ -0,0 +1,40 @@ +from unittest import TestCase + +from polygraph.exceptions import PolygraphSchemaError +from polygraph.types.input_object import ( + InputObject, + InputValue, + validate_input_object_schema, +) +from polygraph.types.lazy_type import LazyType +from polygraph.types.scalar import Stri...
10ddce342da23c3702c1c0def4534d37cf6769b7
tests/test_threading.py
tests/test_threading.py
from unittest import TestCase from pydatajson.threading_helper import apply_threading class ThreadingTests(TestCase): def test_threading(self): elements = [1, 2, 3, 4] def function(x): return x ** 2 result = apply_threading(elements, function, 3) self.assertEqual(r...
Test case que pase por threading
Test case que pase por threading
Python
mit
datosgobar/pydatajson,datosgobar/pydatajson
--- +++ @@ -0,0 +1,16 @@ +from unittest import TestCase + +from pydatajson.threading_helper import apply_threading + + +class ThreadingTests(TestCase): + + def test_threading(self): + elements = [1, 2, 3, 4] + + def function(x): + return x ** 2 + + result = apply_threading(elements,...
4871896765889576eb0ef2c97d94810f50ffe9d4
datasciencebox/tests/salt/test_mesos.py
datasciencebox/tests/salt/test_mesos.py
import pytest import requests import utils def setup_module(module): utils.invoke('install', 'mesos') @utils.vagranttest def test_salt_formulas(): project = utils.get_test_project() kwargs = {'test': 'true', '--out': 'json', '--out-indent': '-1'} out = project.salt('state.sls', args=['cdh5.zookee...
Add basic tests for mesos
Add basic tests for mesos
Python
apache-2.0
danielfrg/datasciencebox,danielfrg/datasciencebox,danielfrg/datasciencebox,danielfrg/datasciencebox
--- +++ @@ -0,0 +1,38 @@ +import pytest + +import requests + +import utils + + +def setup_module(module): + utils.invoke('install', 'mesos') + + +@utils.vagranttest +def test_salt_formulas(): + project = utils.get_test_project() + + kwargs = {'test': 'true', '--out': 'json', '--out-indent': '-1'} + out = ...
a6a701778d615f57be78db494c6adfed10d55c9f
tools/dartium/download_multivm.py
tools/dartium/download_multivm.py
#!/usr/bin/python # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. """Download archived multivm or dartium builds. Usage: download_multivm.py revision ...
Add multivm archive download script for buildbot use.
Add multivm archive download script for buildbot use. BUG= R=ricow@google.com Review URL: https://codereview.chromium.org//291153010 git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@36513 260f80e4-7a28-3924-810f-c04153c831b5
Python
bsd-3-clause
dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dartino/dart-sdk,da...
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/python + +# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +"""Download archived multivm or dartium builds. + + ...
8b5163b3048f73af86b736f2285408d39698923f
create_output_folders.py
create_output_folders.py
import logging import os from settings import CONVERSIONS, LOGGING_FORMAT, OUTPUT_PATH logger = logging.getLogger(__name__) def main(): """ Create the output folder for each of the conversion types. """ for xsl_file_name, output_folder, checker in CONVERSIONS: # Get the conversion output folder. output_pa...
Add output folder creation script
Add output folder creation script
Python
mit
AustralianAntarcticDataCentre/metadata_xml_convert,AustralianAntarcticDataCentre/metadata_xml_convert
--- +++ @@ -0,0 +1,42 @@ +import logging +import os + +from settings import CONVERSIONS, LOGGING_FORMAT, OUTPUT_PATH + + +logger = logging.getLogger(__name__) + + +def main(): + """ + Create the output folder for each of the conversion types. + """ + + for xsl_file_name, output_folder, checker in CONVERSIONS: + # Ge...
cc201158ebaa2d3e6fc75bc3e9a56ef10ba5a28a
test/time_relight.py
test/time_relight.py
import mclevel from timeit import timeit #import logging #logging.basicConfig(level=logging.INFO) path = "testfiles\\AnvilWorld" world = mclevel.fromFile(path) print "Relight: %d chunks in %.02f seconds" % (world.chunkCount, timeit(lambda: world.generateLights(world.allChunks), number=1))
Add test to measure time taken for level.generateLights
Debug: Add test to measure time taken for level.generateLights
Python
isc
mcedit/pymclevel,mcedit/pymclevel,ahh2131/mchisel,ahh2131/mchisel,arruda/pymclevel,arruda/pymclevel
--- +++ @@ -0,0 +1,13 @@ +import mclevel +from timeit import timeit + +#import logging +#logging.basicConfig(level=logging.INFO) + +path = "testfiles\\AnvilWorld" +world = mclevel.fromFile(path) + +print "Relight: %d chunks in %.02f seconds" % (world.chunkCount, timeit(lambda: world.generateLights(world.allChunks), n...
e6168d3c73c6de591d2f7646c71cde27f66578ac
a3/visualize.py
a3/visualize.py
import seaborn as sns from .utils import get_path class Visualizer(object): """ Visualize training and validation loss """ @classmethod def visualize_training(cls, tr, savefig=None, show=False): sns.plt.plot(tr.data.Epoch.tolist(), tr.data["Training Loss"].tolist(), label="Training Loss") ...
Add barebones visualization of loss
Add barebones visualization of loss
Python
apache-2.0
arizona-phonological-imaging-lab/autotres,arizona-phonological-imaging-lab/autotres
--- +++ @@ -0,0 +1,19 @@ +import seaborn as sns +from .utils import get_path + + +class Visualizer(object): + """ + Visualize training and validation loss + """ + @classmethod + def visualize_training(cls, tr, savefig=None, show=False): + sns.plt.plot(tr.data.Epoch.tolist(), tr.data["Training Lo...
9124f1cf2bc02e39cd215a465d1680f6a4fdd696
ObjectTracking/streamer.py
ObjectTracking/streamer.py
from SimpleCV import * import time import serial cam = JpegStreamCamera('http://192.168.1.6:8080/videofeed') disp=Display() ser=serial.Serial('/dev/ttyACM2', 9600) alpha = 0.8 time.sleep(1) previous_z = 200; while True: img = cam.getImage() myLayer = DrawingLayer((img.width,img.height)) disk_img = img.hueD...
Use to make close loop test on single axis
Use to make close loop test on single axis
Python
mit
baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite
--- +++ @@ -0,0 +1,26 @@ +from SimpleCV import * +import time +import serial +cam = JpegStreamCamera('http://192.168.1.6:8080/videofeed') +disp=Display() + +ser=serial.Serial('/dev/ttyACM2', 9600) +alpha = 0.8 +time.sleep(1) +previous_z = 200; +while True: + img = cam.getImage() + myLayer = DrawingLayer((img.wi...
8bdc8418b0093c44947022d3649593f77c471fea
tests/test_compat.py
tests/test_compat.py
from auth_tkt import compat from unittest import TestCase class Base64DecodeTestCase(TestCase): def test_returns_decoded_string(self): self.assertEqual( compat.base64decode('ZGVjb2RlZA=='), 'decoded') class Base64EncodeTestCase(TestCase): def test_encodes_passed_string(self): s...
Add tests for compat module
Add tests for compat module
Python
mit
yola/auth_tkt
--- +++ @@ -0,0 +1,27 @@ +from auth_tkt import compat +from unittest import TestCase + + +class Base64DecodeTestCase(TestCase): + + def test_returns_decoded_string(self): + self.assertEqual( + compat.base64decode('ZGVjb2RlZA=='), 'decoded') + + +class Base64EncodeTestCase(TestCase): + + def te...
8509659e77b63f2467b0b98064433e083ac32187
tinman/transforms.py
tinman/transforms.py
""" Tornado Output Transforming Classes """ from tornado import web class StripBlankLines(web.OutputTransform): def transform_first_chunk(self, status_code, headers, chunk, finishing): content_type = headers.get("Content-Type", "").split(";")[0] if content_type.split('/')[0] == 'text': ...
Add a blank line stripping transform
Add a blank line stripping transform
Python
bsd-3-clause
gmr/tinman,lucius-feng/tinman,lucius-feng/tinman,lucius-feng/tinman,gmr/tinman
--- +++ @@ -0,0 +1,19 @@ +""" +Tornado Output Transforming Classes + +""" +from tornado import web + + +class StripBlankLines(web.OutputTransform): + + def transform_first_chunk(self, status_code, headers, chunk, finishing): + content_type = headers.get("Content-Type", "").split(";")[0] + if content_...
d2546864c9c0579b68050ade87a440f392aa6e27
class_hierarchy.py
class_hierarchy.py
SIZES = {'small', 'medium', 'insanely massive'} class PhysicalThing(object): """ Base class for physical object """ def __init__(self, *args, **kwargs): """ Validate and set attrs """ size = kwargs.pop('size', None) if size and size not in SIZES: raise ValueError('Invalid size!') sel...
Add class hierarchy w multiple inheritance
Add class hierarchy w multiple inheritance
Python
mit
oldhill/halloween,oldhill/halloween,oldhill/halloween,oldhill/halloween
--- +++ @@ -0,0 +1,45 @@ + + +SIZES = {'small', 'medium', 'insanely massive'} + + +class PhysicalThing(object): + """ Base class for physical object + """ + def __init__(self, *args, **kwargs): + """ Validate and set attrs + """ + size = kwargs.pop('size', None) + if size and size not in SIZES: + ...
df7c5c2def8341d73a109426d5289b2e705995ca
ceph_deploy/tests/parser/test_calamari.py
ceph_deploy/tests/parser/test_calamari.py
import pytest from ceph_deploy.cli import get_parser class TestParserCalamari(object): def setup(self): self.parser = get_parser() def test_calamari_help(self, capsys): with pytest.raises(SystemExit): self.parser.parse_args('calamari --help'.split()) out, err = capsys.re...
Add argparse tests for ceph-deploy calamari
[RM-11742] Add argparse tests for ceph-deploy calamari Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
Python
mit
osynge/ceph-deploy,shenhequnying/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,isyippee/ceph-deploy,ghxandsky/ceph-deploy,shenhequnying/ceph-deploy,imzhulei/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,imzhulei/ceph-deploy,Vicente-Cheng/ceph-deploy,ceph/ceph-deploy,osynge/ceph-deploy,zhouyuan/ceph-deploy,branto1/ceph-deploy...
--- +++ @@ -0,0 +1,40 @@ +import pytest + +from ceph_deploy.cli import get_parser + + +class TestParserCalamari(object): + + def setup(self): + self.parser = get_parser() + + def test_calamari_help(self, capsys): + with pytest.raises(SystemExit): + self.parser.parse_args('calamari --hel...
d40fe9a9739ed7da4a47492124715bf6b720ae1d
rally-jobs/plugins/test_relative_import/zzz.py
rally-jobs/plugins/test_relative_import/zzz.py
# This module is used just for test that relative imports work well def some_very_important_function(): return 42
# 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 # distributed u...
Add Apache 2.0 license to source file
Add Apache 2.0 license to source file As per OpenStack licensing guide lines [1]: [H102 H103] Newly contributed Source Code should be licensed under the Apache 2.0 license. [H104] Files with no code shouldn't contain any license header nor comments, and must be left completely empty. [1] http://docs.openstack.org/dev...
Python
apache-2.0
openstack/rally,openstack/rally,openstack/rally,yeming233/rally,yeming233/rally,openstack/rally
--- +++ @@ -1,3 +1,15 @@ +# 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 ...
7dbbef88fedc07ee8cddf690b8c42785ee7241bd
astropy_helpers/sphinx/setup_package.py
astropy_helpers/sphinx/setup_package.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): # Install the theme files return { 'astropy_helpers.sphinx': [ 'ext/templates/*/*', 'themes/bootstrap-astropy/*.*', 'themes/bootstrap-astropy/static/*.*']}
# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): # Install the theme files return { 'astropy_helpers.sphinx': [ 'ext/templates/*/*', 'local/*.inv', 'themes/bootstrap-astropy/*.*', 'themes/bootstrap-astropy/static/*.*...
Make sure .inv file gets installed
Make sure .inv file gets installed
Python
bsd-3-clause
Cadair/astropy-helpers,bsipocz/astropy-helpers,embray/astropy_helpers,Cadair/astropy-helpers,embray/astropy_helpers,dpshelio/astropy-helpers,larrybradley/astropy-helpers,astropy/astropy-helpers,embray/astropy_helpers,astropy/astropy-helpers,bsipocz/astropy-helpers,larrybradley/astropy-helpers,embray/astropy_helpers,bsi...
--- +++ @@ -5,5 +5,6 @@ return { 'astropy_helpers.sphinx': [ 'ext/templates/*/*', + 'local/*.inv', 'themes/bootstrap-astropy/*.*', 'themes/bootstrap-astropy/static/*.*']}
4ae27811595ce3c53670df441429bcf4cace4e15
StockIndicators/StockIndicators.py
StockIndicators/StockIndicators.py
#!flask/bin/python from flask import Blueprint, jsonify api_si = Blueprint('api_si', __name__) @api_si.route("/stock_indicators") def get_stock_indicators(): return jsonify(stock_indicators=[ {"username": "alice", "user_id": 1}, {"username": "bob", "user_id": 2} ])
Implement blueprints on stock indicators
Implement blueprints on stock indicators
Python
mit
z0rkuM/stockbros,z0rkuM/stockbros,z0rkuM/stockbros,z0rkuM/stockbros
--- +++ @@ -0,0 +1,11 @@ +#!flask/bin/python +from flask import Blueprint, jsonify + +api_si = Blueprint('api_si', __name__) + +@api_si.route("/stock_indicators") +def get_stock_indicators(): + return jsonify(stock_indicators=[ + {"username": "alice", "user_id": 1}, + {"username": "bob", "user_id": 2...
7d17358e514ad988b2619b8c364338a2058b400b
flocker/volume/script.py
flocker/volume/script.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """The command-line ``flocker-volume`` tool.""" import sys from twisted.python.usage import Options from twisted.python.filepath import FilePath from twisted.internet.task import react from twisted.internet.defer import succeed from .service import Volume...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """The command-line ``flocker-volume`` tool.""" import sys from twisted.python.usage import Options from twisted.python.filepath import FilePath from twisted.internet.task import react from twisted.internet.defer import succeed from .service import Volume...
Address review comment: More useful help output.
Address review comment: More useful help output.
Python
apache-2.0
wallnerryan/flocker-profiles,mbrukman/flocker,adamtheturtle/flocker,jml/flocker,mbrukman/flocker,Azulinho/flocker,lukemarsden/flocker,adamtheturtle/flocker,w4ngyi/flocker,lukemarsden/flocker,runcom/flocker,agonzalezro/flocker,1d4Nf6/flocker,AndyHuu/flocker,w4ngyi/flocker,moypray/flocker,achanda/flocker,w4ngyi/flocker,h...
--- +++ @@ -14,7 +14,13 @@ class FlockerVolumeOptions(Options): - """flocker-volume - volume management.""" + """Command line options for ``flocker-volume`` volume management tool.""" + + longdesc = """flocker-volume allows you to manage volumes, filesystems + that can be attached to Docker container...
a2a73049c03f6144e68c4eca36bb70fdb929ac04
grab/spider/data/shortcut.py
grab/spider/data/shortcut.py
import os from .base import Data from grab.tools.files import hashed_path from .. import Task class MongoObjectImageData(Data): def handler(self, url, collection, obj, path_field): path = hashed_path(url, base_dir='media/post_image') if os.path.exists(path): if path != getattr(obj, p...
Add MongoObjectImageData shourt to handle specific cases when you need to download image and assign its local path to some field of object stored in the mongo database
Add MongoObjectImageData shourt to handle specific cases when you need to download image and assign its local path to some field of object stored in the mongo database
Python
mit
codevlabs/grab,pombredanne/grab-1,lorien/grab,liorvh/grab,giserh/grab,kevinlondon/grab,DDShadoww/grab,subeax/grab,giserh/grab,codevlabs/grab,shaunstanislaus/grab,pombredanne/grab-1,maurobaraldi/grab,alihalabyah/grab,raybuhr/grab,huiyi1990/grab,kevinlondon/grab,istinspring/grab,lorien/grab,alihalabyah/grab,huiyi1990/gra...
--- +++ @@ -0,0 +1,30 @@ +import os + +from .base import Data +from grab.tools.files import hashed_path +from .. import Task + +class MongoObjectImageData(Data): + def handler(self, url, collection, obj, path_field): + + + path = hashed_path(url, base_dir='media/post_image') + if os.path.exists(path)...
d790a9e1a83d4a7bc1555c23235c2b0a31a5b69a
functest/tests/unit/features/test_domino.py
functest/tests/unit/features/test_domino.py
#!/usr/bin/env python # Copyright (c) 2017 Orange and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 # pylint: d...
Add unit tests for domino
Add unit tests for domino Change-Id: Ie6671080a3d38a17da0ee608a362605a6d9df9db Signed-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>
Python
apache-2.0
opnfv/functest,mywulin/functest,opnfv/functest,mywulin/functest
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Orange and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.or...
88d936f6df9b609e7d6bdfc7d637d860b92da7a7
scripts/export_sequences_data.py
scripts/export_sequences_data.py
import argparse import csv import gevent.monkey gevent.monkey.patch_all() from closeio_api import Client as CloseIO_API from gevent.pool import Pool parser = argparse.ArgumentParser(description='Download a CSV of email sequences and their subscription counts (number of active/paused/finished subscriptions)') parser...
Add a script that exports email sequences stats
Add a script that exports email sequences stats
Python
mit
closeio/closeio-api-scripts
--- +++ @@ -0,0 +1,62 @@ +import argparse +import csv + +import gevent.monkey + +gevent.monkey.patch_all() +from closeio_api import Client as CloseIO_API +from gevent.pool import Pool + +parser = argparse.ArgumentParser(description='Download a CSV of email sequences and their subscription counts (number of active/pau...
f68b51409b5a2f0ec3ad8720b32cdd1e9174dbd6
scripts/linearmodel.py
scripts/linearmodel.py
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("data/", one_hot=True) image_dim = 28 * 28 label_count = 10 graph = tf.Graph() with graph.as_default(): x = tf.placeholder("float", shape=[None, image_dim]) y_ = tf.placeholder("float", shape=[None...
Add a linear sample for mnist in python.
Add a linear sample for mnist in python.
Python
apache-2.0
LaurentMazare/tensorflow-ocaml,hhugo/tensorflow-ocaml,LaurentMazare/tensorflow-ocaml,hhugo/tensorflow-ocaml
--- +++ @@ -0,0 +1,25 @@ +import tensorflow as tf +from tensorflow.examples.tutorials.mnist import input_data + +mnist = input_data.read_data_sets("data/", one_hot=True) + +image_dim = 28 * 28 +label_count = 10 +graph = tf.Graph() +with graph.as_default(): + x = tf.placeholder("float", shape=[None, image_dim]) + y_...
6a06cbcb6b3ee52a85dc4bb0eeb952234e05b6d5
nototools/drop_hints.py
nototools/drop_hints.py
#!/usr/bin/python # # Copyright 2014 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 by...
Add script to drop hints.
[nototools] Add script to drop hints.
Python
apache-2.0
dougfelt/nototools,googlei18n/nototools,pahans/nototools,dougfelt/nototools,googlefonts/nototools,googlei18n/nototools,googlefonts/nototools,anthrotype/nototools,dougfelt/nototools,pathumego/nototools,anthrotype/nototools,pahans/nototools,davelab6/nototools,namemealrady/nototools,googlei18n/nototools,pathumego/nototool...
--- +++ @@ -0,0 +1,56 @@ +#!/usr/bin/python +# +# Copyright 2014 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/license...
620b7afd50e93847dc6d9fa08751fd69bec35d95
barython/events/__init__.py
barython/events/__init__.py
#!/usr/bin/env python3 import logging import threading logger = logging.getLogger("barython") class _Hook(threading.Thread): #: list of callbacks callbacks = None def notify(self, *args, **kwargs): for c in self.callbacks: try: threading.Thread(target=c, args=args,...
Add the abstract class _Hook
Add the abstract class _Hook Related to #2 Should be used by the panel to handle events and spread it through the widgets.
Python
bsd-3-clause
Anthony25/barython
--- +++ @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + + +import logging +import threading + + +logger = logging.getLogger("barython") + + +class _Hook(threading.Thread): + #: list of callbacks + callbacks = None + + def notify(self, *args, **kwargs): + for c in self.callbacks: + try: + ...
ef754c3bb0fd4d026b898fd259632d98f2688ab0
test.py
test.py
#!/usr/bin/env python import ystockquote as y x = 'SYK' a = y.get_all(x) # 'fifty_two_week_low', 'fifty_day_moving_avg', 'price', 'price_book_ratio', 'volume', 'market_cap', 'dividend_yield', 'ebitda', 'change', 'dividend_per_share', 'stock_exchange', 'two_hundred_day_moving_avg', 'fifty_two_week_high', 'price_sales_...
Print more stock stuff in small space.
Print more stock stuff in small space.
Python
mit
zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie
--- +++ @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import ystockquote as y + +x = 'SYK' +a = y.get_all(x) + +# 'fifty_two_week_low', 'fifty_day_moving_avg', 'price', 'price_book_ratio', 'volume', 'market_cap', 'dividend_yield', 'ebitda', 'change', 'dividend_per_share', 'stock_exchange', 'two_hundred_day_moving_avg', 'f...
22c6455ce5e05e5ec532d17210ef60fed4bb6aba
tests/chainer_tests/training_tests/extensions_tests/test_print_report.py
tests/chainer_tests/training_tests/extensions_tests/test_print_report.py
import sys import unittest from chainer import testing from chainer.training import extensions class TestPrintReport(unittest.TestCase): def test_stream_typecheck(self): report = extensions.PrintReport(['epoch'], out=sys.stderr) self.assertIsInstance(report, extensions.PrintReport) with...
Test typechecking for an output stream
Test typechecking for an output stream
Python
mit
keisuke-umezawa/chainer,hvy/chainer,okuta/chainer,rezoo/chainer,wkentaro/chainer,tkerola/chainer,keisuke-umezawa/chainer,niboshi/chainer,ktnyt/chainer,ktnyt/chainer,niboshi/chainer,jnishi/chainer,pfnet/chainer,chainer/chainer,ktnyt/chainer,hvy/chainer,okuta/chainer,keisuke-umezawa/chainer,niboshi/chainer,jnishi/chainer...
--- +++ @@ -0,0 +1,18 @@ +import sys +import unittest + +from chainer import testing +from chainer.training import extensions + + +class TestPrintReport(unittest.TestCase): + + def test_stream_typecheck(self): + report = extensions.PrintReport(['epoch'], out=sys.stderr) + self.assertIsInstance(report...
c4cfacfb8038b104ff91baf664ef1359a8ebb128
games/migrations/0010_auto_20160615_0436.py
games/migrations/0010_auto_20160615_0436.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-06-15 02:36 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('games', '0009_installer_rating'), ] operations = [ migrations.AlterField( ...
Add migration for rating choices modification
Add migration for rating choices modification
Python
agpl-3.0
lutris/website,Turupawn/website,Turupawn/website,lutris/website,Turupawn/website,Turupawn/website,lutris/website,lutris/website
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-06-15 02:36 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('games', '0009_installer_rating'), + ] + + operati...
7e307fb6eb8246fdec9fe9f3249f8dff9c89ccd3
librisxl-tools/blazegraph/lddb-to-import.py
librisxl-tools/blazegraph/lddb-to-import.py
from __future__ import unicode_literals, print_function import sys import os import re CONTEXT_PATH = 'context.jsonld' args = sys.argv[1:] basepath = args.pop(0) if args else 'data' chunksize = int(args.pop(0)) if args else 100 * 1000 outfile = None def next_outfile(i): global outfile fpath = "{}-{}.jsonld...
Add script for turning lines of JSON-LD records into chunked datasets
Add script for turning lines of JSON-LD records into chunked datasets This creates a bunch of "reasonably sized" JSON-LD dataset files with a given count of named graphs. It also fixes some things for BlazeGraph to be able to parse the data.
Python
apache-2.0
libris/librisxl,libris/librisxl,libris/librisxl
--- +++ @@ -0,0 +1,74 @@ +from __future__ import unicode_literals, print_function +import sys +import os +import re + +CONTEXT_PATH = 'context.jsonld' + +args = sys.argv[1:] + +basepath = args.pop(0) if args else 'data' +chunksize = int(args.pop(0)) if args else 100 * 1000 + +outfile = None + +def next_outfile(i): + ...
25d53a43576753f1aa0cc6fbaf05ae94dcdec564
tmp/cacd2000_split_identities.py
tmp/cacd2000_split_identities.py
import shutil import argparse import os import sys def main(args): src_path_exp = os.path.expanduser(args.src_path) dst_path_exp = os.path.expanduser(args.dst_path) if not os.path.exists(dst_path_exp): os.makedirs(dst_path_exp) files = os.listdir(src_path_exp) for f in files: file_n...
Split CACD2000 dataset into one directory per identity
Split CACD2000 dataset into one directory per identity
Python
mit
davidsandberg/facenet,wangxianliang/facenet,wangxianliang/facenet,liuzz1983/open_vision,davidsandberg/facenet
--- +++ @@ -0,0 +1,32 @@ +import shutil +import argparse +import os +import sys + +def main(args): + src_path_exp = os.path.expanduser(args.src_path) + dst_path_exp = os.path.expanduser(args.dst_path) + if not os.path.exists(dst_path_exp): + os.makedirs(dst_path_exp) + files = os.listdir(src_path_e...
c55d917b28c41d363e2dea8ecaf750a431f016da
migrations/versions/0364_drop_old_column.py
migrations/versions/0364_drop_old_column.py
""" Revision ID: 0364_drop_old_column Revises: 0363_cancelled_by_api_key Create Date: 2022-01-25 18:05:27.750234 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql revision = '0364_drop_old_column' down_revision = '0363_cancelled_by_api_key' def upgrade(): # move data...
Drop api_key_id column from broadcast_message table
Drop api_key_id column from broadcast_message table This column has been superseded by a new column named created_by_api_key_id. Also create constraint checking that we know who created broadcast Also move data so that constraint is met before instatiating it.
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,33 @@ +""" + +Revision ID: 0364_drop_old_column +Revises: 0363_cancelled_by_api_key +Create Date: 2022-01-25 18:05:27.750234 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +revision = '0364_drop_old_column' +down_revision = '0363_cancelled_by_a...
2b9830d89fd1c7aef5deb5bd16a7f6a26ea8e682
data/mongorandomgraph.py
data/mongorandomgraph.py
import bson.json_util from bson.objectid import ObjectId import itertools import random import string import sys def emit_node(name): oid = ObjectId() print bson.json_util.dumps({"_id": oid, "type": "node", "data": {"name": name}}) return o...
Add script to generate test mongo data
Add script to generate test mongo data
Python
apache-2.0
XDATA-Year-3/clique,XDATA-Year-3/clique,Kitware/clique,Kitware/clique,Kitware/clique,XDATA-Year-3/clique
--- +++ @@ -0,0 +1,47 @@ +import bson.json_util +from bson.objectid import ObjectId +import itertools +import random +import string +import sys + + +def emit_node(name): + oid = ObjectId() + + print bson.json_util.dumps({"_id": oid, + "type": "node", + ...
6dba942d41c38d301f225627aae318910d139eb0
scripts/create_pca_component_overlay.py
scripts/create_pca_component_overlay.py
# Generate overlay corresponding to 2nd PCA component # which serves as a proxy for senescence import csv from collections import defaultdict import dtoolcore import click import numpy as np def calc_pca_components(all_entries): rgb_matrix = np.transpose(np.array( [ map(float, [entry['R'...
Add script to create overlay on individual plots for senescence
Add script to create overlay on individual plots for senescence
Python
mit
JIC-Image-Analysis/senescence-in-field,JIC-Image-Analysis/senescence-in-field,JIC-Image-Analysis/senescence-in-field
--- +++ @@ -0,0 +1,102 @@ +# Generate overlay corresponding to 2nd PCA component +# which serves as a proxy for senescence + +import csv + +from collections import defaultdict + +import dtoolcore + +import click + +import numpy as np + + +def calc_pca_components(all_entries): + + rgb_matrix = np.transpose(np.array...
4c0273b38437302526457c90a142efd465d8addd
tests/algebra/test_abstract_quantum_algebra.py
tests/algebra/test_abstract_quantum_algebra.py
from qnet import ( One, Zero, ZeroOperator, IdentityOperator, ZeroSuperOperator, IdentitySuperOperator, ZeroKet, TrivialKet, FullSpace, TrivialSpace, CIdentity, CircuitZero) def test_neutral_elements(): """test the properties of the neutral elements in the quantum algebras. This tests the resoluti...
Test equality and hashing of neutral elements
Test equality and hashing of neutral elements With the implementation of the scalar algebra it turns out that the way to go is to have only the scalar Zero and One equal to 0 and 1. In every other algebra, the neutral elements have no relation to the scalar 0 and 1, or to the neutral elements of other algebras. Hoeve...
Python
mit
mabuchilab/QNET
--- +++ @@ -0,0 +1,51 @@ +from qnet import ( + One, Zero, ZeroOperator, IdentityOperator, ZeroSuperOperator, + IdentitySuperOperator, ZeroKet, TrivialKet, FullSpace, TrivialSpace, + CIdentity, CircuitZero) + + +def test_neutral_elements(): + """test the properties of the neutral elements in the quantum al...
768f98a2b873833b5029f587c869a39697e7683f
plenum/test/requests/test_send_audit_txn.py
plenum/test/requests/test_send_audit_txn.py
import json import time import pytest from plenum.test.helper import sdk_get_and_check_replies from plenum.test.pool_transactions.helper import sdk_sign_and_send_prepared_request from plenum.common.exceptions import RequestNackedException from plenum.common.constants import TXN_TYPE, AUDIT, CURRENT_PROTOCOL_VERSION f...
Test for audit txn sending
Test for audit txn sending Signed-off-by: ArtObr <24870ba6726087be7be3af8a7040487294fd73a9@gmail.com>
Python
apache-2.0
evernym/plenum,evernym/zeno
--- +++ @@ -0,0 +1,27 @@ +import json +import time +import pytest + +from plenum.test.helper import sdk_get_and_check_replies +from plenum.test.pool_transactions.helper import sdk_sign_and_send_prepared_request + +from plenum.common.exceptions import RequestNackedException +from plenum.common.constants import TXN_TYP...
3e5193f6dee511a8fd082da7e58705d4c825e079
utilities/data_migration/sms_import/sms-recovery.py
utilities/data_migration/sms_import/sms-recovery.py
#!/usr/bin/env python # encoding: utf-8 """ sms-recovery.py Created by Brian DeRenzi on 2010-04-27. Copyright (c) 2010 __MyCompanyName__. All rights reserved. """ import sys import os import MySQLdb from datetime import datetime, timedelta DB_HOST = "localhost" DB_USER = "changeme" DB_PASSWORD = "changeme" DB_NAME =...
Add brian's sms import scripts + test data
Add brian's sms import scripts + test data
Python
bsd-3-clause
puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,gmimano/commcaretest,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,SEL-Colum...
--- +++ @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# encoding: utf-8 +""" +sms-recovery.py + +Created by Brian DeRenzi on 2010-04-27. +Copyright (c) 2010 __MyCompanyName__. All rights reserved. +""" + +import sys +import os +import MySQLdb +from datetime import datetime, timedelta + +DB_HOST = "localhost" +DB_USER = "c...
5974e5a1518e26ffd1c0d77d8ca1ba1427319567
tests/integration/customer/test_dispatcher.py
tests/integration/customer/test_dispatcher.py
from django.test import TestCase from django.core import mail from oscar.core.compat import get_user_model from oscar.apps.customer.utils import Dispatcher from oscar.apps.customer.models import CommunicationEventType from oscar.test.factories import create_order User = get_user_model() class TestDispatcher(TestCa...
from django.test import TestCase from django.core import mail from oscar.core.compat import get_user_model from oscar.apps.customer.utils import Dispatcher from oscar.apps.customer.models import CommunicationEventType from oscar.test.factories import create_order User = get_user_model() class TestDispatcher(TestCa...
Use empty message instead None.
Use empty message instead None.
Python
bsd-3-clause
solarissmoke/django-oscar,sasha0/django-oscar,sonofatailor/django-oscar,django-oscar/django-oscar,solarissmoke/django-oscar,sonofatailor/django-oscar,django-oscar/django-oscar,solarissmoke/django-oscar,okfish/django-oscar,okfish/django-oscar,sonofatailor/django-oscar,okfish/django-oscar,sasha0/django-oscar,sonofatailor...
--- +++ @@ -40,6 +40,6 @@ self.assertIn(order_number, message.body) # test sending messages to emails without account and text body - messages['body'] = None + messages['body'] = '' dispatcher.dispatch_direct_messages(email, messages) self.assertEqual(len(mail.outbo...
810aee1682f16f8697943baf622abead57c707eb
portal/migrations/versions/d0b40bc8d7e6_.py
portal/migrations/versions/d0b40bc8d7e6_.py
from alembic import op import sqlalchemy as sa """empty message Revision ID: d0b40bc8d7e6 Revises: 8ffec90e68a7 Create Date: 2017-09-20 05:59:45.168324 """ # revision identifiers, used by Alembic. revision = 'd0b40bc8d7e6' down_revision = '8ffec90e68a7' def upgrade(): # Work around site_persistence fragility...
Work around site_persistence fragility. Replace a couple names as delete and recreate on these fails due to FK constraints
Work around site_persistence fragility. Replace a couple names as delete and recreate on these fails due to FK constraints
Python
bsd-3-clause
uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal
--- +++ @@ -0,0 +1,30 @@ +from alembic import op +import sqlalchemy as sa + + +"""empty message + +Revision ID: d0b40bc8d7e6 +Revises: 8ffec90e68a7 +Create Date: 2017-09-20 05:59:45.168324 + +""" + +# revision identifiers, used by Alembic. +revision = 'd0b40bc8d7e6' +down_revision = '8ffec90e68a7' + + +def upgrade():...
8c2eb34d1a1f70150b3f3e7c9bc7255e5178bda6
accounts/migrations/0003_migrate_api_keys.py
accounts/migrations/0003_migrate_api_keys.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def migrate_keys(apps, schema_editor): Token = apps.get_model("authtoken", "Token") ApiKey = apps.get_model("tastypie", "ApiKey") for key in ApiKey.objects.all(): Token.objects.create( use...
Write migration for API keys
Write migration for API keys
Python
agpl-3.0
lutris/website,Turupawn/website,lutris/website,Turupawn/website,Turupawn/website,lutris/website,Turupawn/website,lutris/website
--- +++ @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +def migrate_keys(apps, schema_editor): + Token = apps.get_model("authtoken", "Token") + ApiKey = apps.get_model("tastypie", "ApiKey") + for key in ApiKey.objects.all(): + ...
1e83e4a47d0f97e0f20ab64b465c23483503d598
samples/magicbot_simple/tests/pyfrc_test.py
samples/magicbot_simple/tests/pyfrc_test.py
''' This test module imports tests that come with pyfrc, and can be used to test basic functionality of just about any robot. ''' from pyfrc.tests import * from magicbot.magicbot_tests import *
Add tests to magicbot example
Add tests to magicbot example
Python
bsd-3-clause
Twinters007/robotpy-wpilib-utilities,robotpy/robotpy-wpilib-utilities,robotpy/robotpy-wpilib-utilities,Twinters007/robotpy-wpilib-utilities
--- +++ @@ -0,0 +1,7 @@ +''' + This test module imports tests that come with pyfrc, and can be used + to test basic functionality of just about any robot. +''' + +from pyfrc.tests import * +from magicbot.magicbot_tests import *
4460aee67c1d95fd896d131add5c99151b24573e
fileapi/tests/test_qunit.py
fileapi/tests/test_qunit.py
import os from django.conf import settings from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.test.utils import override_settings from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions from selenium.webdriv...
Add Django testcase to load QUnit test suite and assert there are no failures.
Add Django testcase to load QUnit test suite and assert there are no failures.
Python
bsd-2-clause
mlavin/fileapi,mlavin/fileapi,mlavin/fileapi
--- +++ @@ -0,0 +1,35 @@ +import os + +from django.conf import settings +from django.contrib.staticfiles.testing import StaticLiveServerTestCase +from django.test.utils import override_settings + +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.support import expec...
e406c876e0668b1b2e6a0531d68249b579831d9b
apps/pyjob_check_finished_jobs.py
apps/pyjob_check_finished_jobs.py
#!/usr/bin/env python3 import os def find_rms_dirs(dirpath): dirs = [x for x in os.walk(dirpath)]; for i in range(len(dirs)): if any('rms' in x for x in dirs[i][1]): par_dir = dirs[i][0] rms_dirs = [os.path.join(par_dir, x) for x in dirs[i][1] if 'rms' in x] return...
Add script to check finished jobs
Add script to check finished jobs
Python
mit
lnls-fac/job_manager
--- +++ @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import os + +def find_rms_dirs(dirpath): + dirs = [x for x in os.walk(dirpath)]; + for i in range(len(dirs)): + if any('rms' in x for x in dirs[i][1]): + par_dir = dirs[i][0] + rms_dirs = [os.path.join(par_dir, x) for x in dirs[i]...
ff1b5a3bbfb1deb92d2b34d0951db35a48c1d630
cifar.py
cifar.py
import cProfile import data_loader import data_manipulator import data_saver import neural_net def main(): test_batch, train_batch = data_loader.load_data() data_manipulator.categorize(train_batch, test_batch) model = neural_net.get_trained_model(train_batches=train_batch, ...
Add main module for solving CIFAR-10 classification problem
Add main module for solving CIFAR-10 classification problem
Python
mit
maciewar/AGH-Deep-Learning-CIFAR10
--- +++ @@ -0,0 +1,26 @@ +import cProfile +import data_loader +import data_manipulator +import data_saver +import neural_net + + +def main(): + test_batch, train_batch = data_loader.load_data() + data_manipulator.categorize(train_batch, test_batch) + + model = neural_net.get_trained_model(train_batches=train...
2df69f87e92a9795aaf6095448e6222db485430d
automation/KMeansDataGenerator.py
automation/KMeansDataGenerator.py
import numpy as np import sys import random def get_next(x): i = 0 new_x = np.copy(x) while new_x[i] == 1: i = i + 1 new_x[i] = 1 for j in range(i): new_x[j] = 0 return new_x D = int(sys.argv[1]) K = int(sys.argv[2]) num = int(sys.argv[3]) point_file = open(sys.argv[4], "w") center_file = open(sys.argv[5],...
Add Multi-Dimension KMeans data generator
Add Multi-Dimension KMeans data generator
Python
apache-2.0
mjsax/performance,dataArtisans/performance,mxm/flink-perf,project-flink/flink-perf,dataArtisans/performance,project-flink/flink-perf,mjsax/performance,mxm/flink-perf,mjsax/performance,dataArtisans/performance,mxm/flink-perf,project-flink/flink-perf
--- +++ @@ -0,0 +1,45 @@ +import numpy as np +import sys +import random + +def get_next(x): + i = 0 + new_x = np.copy(x) + while new_x[i] == 1: + i = i + 1 + new_x[i] = 1 + for j in range(i): + new_x[j] = 0 + return new_x + +D = int(sys.argv[1]) +K = int(sys.argv[2]) +num = int(sys.argv[3]) + +point_file = open(sys...
85eaf8ead07e91187b1f52c86dec14395e6cd974
tdclient/test/server_status_api_test.py
tdclient/test/server_status_api_test.py
#!/usr/bin/env python from __future__ import print_function from __future__ import unicode_literals from __future__ import with_statement import functools import os from tdclient import api from tdclient import version def setup_function(function): try: del os.environ["TD_API_SERVER"] except KeyErro...
Add test for `GET /v3/system/server_status`
Add test for `GET /v3/system/server_status`
Python
apache-2.0
treasure-data/td-client-python
--- +++ @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +from __future__ import print_function +from __future__ import unicode_literals +from __future__ import with_statement + +import functools +import os + +from tdclient import api +from tdclient import version + +def setup_function(function): + try: + del os.e...
8fce09979271c721586ecd4de94fed3bad712ce8
girder/utility/resource.py
girder/utility/resource.py
import cherrypy import six from girder.api.rest import Resource def _walk_tree(node, path=[]): route_map = {} for k, v in six.iteritems(vars(node)): if isinstance(v, Resource): full_path = list(path) full_path.append(k) route_map[v] = full_path path = [...
Add utility function to walk cherrypy tree
Add utility function to walk cherrypy tree This function generates a map of Resource to mounted path.
Python
apache-2.0
Kitware/girder,jbeezley/girder,manthey/girder,data-exp-lab/girder,girder/girder,manthey/girder,Kitware/girder,Xarthisius/girder,data-exp-lab/girder,kotfic/girder,Kitware/girder,data-exp-lab/girder,kotfic/girder,data-exp-lab/girder,Xarthisius/girder,kotfic/girder,RafaelPalomar/girder,girder/girder,kotfic/girder,RafaelPa...
--- +++ @@ -0,0 +1,36 @@ +import cherrypy +import six + +from girder.api.rest import Resource + + +def _walk_tree(node, path=[]): + route_map = {} + for k, v in six.iteritems(vars(node)): + if isinstance(v, Resource): + full_path = list(path) + full_path.append(k) + route...
09d559f8eaa4b65c480d48a4459c5a38c3dc7fd4
katalogss/utils.py
katalogss/utils.py
import numpy as np def centroid(x, flux): mu = np.sum(x*flux)/np.sum(flux) sd = np.sqrt(np.sum(flux * (x-mu)**2)/np.sum(flux)) return mu,sd def approx_stokes_i(Axx,Ayy): try: a = np.sqrt((Axx**2 + Ayy**2)/2.) except TypeError: a = type(Axx)() a.header = Axx.header ...
Add module with utility functions.
Add module with utility functions.
Python
bsd-2-clause
EoRImaging/katalogss
--- +++ @@ -0,0 +1,72 @@ +import numpy as np + + +def centroid(x, flux): + mu = np.sum(x*flux)/np.sum(flux) + sd = np.sqrt(np.sum(flux * (x-mu)**2)/np.sum(flux)) + return mu,sd + + +def approx_stokes_i(Axx,Ayy): + try: a = np.sqrt((Axx**2 + Ayy**2)/2.) + except TypeError: + a = type(Axx...
7c60724a93aa44e7afac3a59848f1abfa3598623
updater.py
updater.py
import sys import argparse from ceterach.api import MediaWiki from difflib import Differ from parse_equipment import AUTOGEN_HEADER, AUTOGEN_FOOTER parser = argparse.ArgumentParser() parser.add_argument('infile', nargs='?', type=argparse.FileType('r'), default=sys.stdin, help='The file to read t...
Add a script to automatically update an autogenerated table.
Add a script to automatically update an autogenerated table.
Python
mit
rcfox/DragonsDogmaWikiParser
--- +++ @@ -0,0 +1,59 @@ +import sys +import argparse + +from ceterach.api import MediaWiki + +from difflib import Differ + +from parse_equipment import AUTOGEN_HEADER, AUTOGEN_FOOTER + +parser = argparse.ArgumentParser() +parser.add_argument('infile', nargs='?', type=argparse.FileType('r'), default=sys.stdin, + ...
d8d5ce4d1dd2228d70cc90025995a30dca7b075d
s2v3.py
s2v3.py
from s2v2 import * def calculate_sum(data_sample): total = 0 for row in data_sample[1:]: # slice to start at row two, but I think we should only skip row 1 if we're importing the full csv (data_from_csv), but if we use the data w/ the header (my_csv) we'll be skipping a row that we're not supposed to skip (the actu...
Define function for determining the sum of price rows
Define function for determining the sum of price rows
Python
mit
alexmilesyounger/ds_basics
--- +++ @@ -0,0 +1,10 @@ +from s2v2 import * + +def calculate_sum(data_sample): + total = 0 + for row in data_sample[1:]: # slice to start at row two, but I think we should only skip row 1 if we're importing the full csv (data_from_csv), but if we use the data w/ the header (my_csv) we'll be skipping a row that we'r...
1d76b22bc0090580e4ccbfb43e2f5d88d86f2bc7
tests/app/main/test_placeholder_form.py
tests/app/main/test_placeholder_form.py
from app.main.forms import get_placeholder_form_instance from wtforms import Label def test_form_class_not_mutated(app_): with app_.test_request_context( method='POST', data={'placeholder_value': ''} ) as req: form1 = get_placeholder_form_instance('name', {}, optional_placeholder=Fals...
Add extra tests to make sure that the form is safe
Add extra tests to make sure that the form is safe Previous implementations of this functionality mutated the base form class, which broke a bunch of stuff. I want to make sure that getting this form for one placeholder doesn’t change other forms that have already been instantiated for other placeholders. Mutation i...
Python
mit
gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin
--- +++ @@ -0,0 +1,18 @@ +from app.main.forms import get_placeholder_form_instance +from wtforms import Label + + +def test_form_class_not_mutated(app_): + + with app_.test_request_context( + method='POST', + data={'placeholder_value': ''} + ) as req: + form1 = get_placeholder_form_instance...
f335f0032b9eb0847de4fd1261f063012bc4d2f5
functest/tests/unit/features/test_promise.py
functest/tests/unit/features/test_promise.py
#!/usr/bin/env python # Copyright (c) 2017 Orange and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 # pylint: d...
Add unit tests for promise
Add unit tests for promise Change-Id: I538fcedbfbef46ae36b8eff5a20acaa28a8bfb85 Signed-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>
Python
apache-2.0
mywulin/functest,opnfv/functest,mywulin/functest,opnfv/functest
--- +++ @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Orange and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.or...
0c20abe4420b92b25acb28e67cd344f6b45d28ef
flake8diff/vcs/hg.py
flake8diff/vcs/hg.py
from __future__ import unicode_literals, print_function import logging import subprocess from ..utils import _execute from .base import VCSBase logger = logging.getLogger(__name__) class HgVCS(VCSBase): """ Mercurial support implementation """ name = 'hg' def get_vcs(self): """ ...
Introduce HgVCS, check for extdiff extension enabled
Introduce HgVCS, check for extdiff extension enabled
Python
mit
dealertrack/flake8-diff,miki725/flake8-diff
--- +++ @@ -0,0 +1,45 @@ +from __future__ import unicode_literals, print_function + +import logging +import subprocess + +from ..utils import _execute +from .base import VCSBase + + +logger = logging.getLogger(__name__) + + +class HgVCS(VCSBase): + """ + Mercurial support implementation + """ + name = 'hg...
1b3c0e108fed7eb33edc2ee3646819e75267de69
bot/action/standard/info/formatter/__init__.py
bot/action/standard/info/formatter/__init__.py
from typing import List from bot.action.util.format import DateFormatter from bot.action.util.textformat import FormattedText from bot.api.api import Api from bot.api.domain import ApiObject class ApiObjectInfoFormatter: def __init__(self, api: Api, api_object: ApiObject): self.api = api self.api...
Create info.formatter subpackage, and add ApiObjectInfoFormatter base class
Create info.formatter subpackage, and add ApiObjectInfoFormatter base class
Python
agpl-3.0
alvarogzp/telegram-bot,alvarogzp/telegram-bot
--- +++ @@ -0,0 +1,77 @@ +from typing import List + +from bot.action.util.format import DateFormatter +from bot.action.util.textformat import FormattedText +from bot.api.api import Api +from bot.api.domain import ApiObject + + +class ApiObjectInfoFormatter: + def __init__(self, api: Api, api_object: ApiObject): + ...
7ff3a40d5cdc9fe8d7a960377a7d2f4ea2fb411d
Ratings-Counter.py
Ratings-Counter.py
from pyspark import SparkConf, SparkContext import collections conf = SparkConf().setMaster("local").setAppName("RatingsHistogram") sc = SparkContext(conf = conf) lines = sc.textFile("ml-100k/u.data") ratings = lines.map(lambda x: x.split()[2]) result = ratings.countByValue() sortedResults = collections.Or...
Add a test for running spark
Add a test for running spark We're using data from http://grouplens.org/datasets/movielens/ For this test we're using the MovieLens 100K Dataset
Python
mit
tonirilix/apache-spark-hands-on
--- +++ @@ -0,0 +1,13 @@ +from pyspark import SparkConf, SparkContext +import collections + +conf = SparkConf().setMaster("local").setAppName("RatingsHistogram") +sc = SparkContext(conf = conf) + +lines = sc.textFile("ml-100k/u.data") +ratings = lines.map(lambda x: x.split()[2]) +result = ratings.countByValue() + +so...
717bafb43870b45d49bfc9d89408544feecb1a78
hooks/update-nrpe.py
hooks/update-nrpe.py
#!/usr/bin/env python import sys from charmhelpers.contrib.charmsupport import nrpe def update_nrpe_checks(): nrpe_compat = nrpe.NRPE() # The use of port 80 assumes the 'secure' charm configuration # value is false, which is the scenario for our deployment on # staging and production. If testing this...
Update description of the nagios port for check_http.
Update description of the nagios port for check_http.
Python
agpl-3.0
juju/juju-gui-charm,juju/juju-gui-charm
--- +++ @@ -0,0 +1,36 @@ +#!/usr/bin/env python +import sys + +from charmhelpers.contrib.charmsupport import nrpe + + +def update_nrpe_checks(): + nrpe_compat = nrpe.NRPE() + # The use of port 80 assumes the 'secure' charm configuration + # value is false, which is the scenario for our deployment on + # s...
8bdd32b41b1a89aac50eb25ed5bd32c3c15b49c7
leetcode/171-Excel-Sheet-Column-Number/ExcelSheetColNum_001.py
leetcode/171-Excel-Sheet-Column-Number/ExcelSheetColNum_001.py
class Solution(object): def titleToNumber(self, s): """ :type s: str :rtype: int """ res = 0 for i in range(len(s) - 1, -1, -1): res += (ord(s[i]) - ord('A') + 1) * 26 ** (len(s) - 1 - i) return res
Create Simplified ExcelSheetColNum for Leetcode
Create Simplified ExcelSheetColNum for Leetcode
Python
mit
cc13ny/Allin,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/cod,cc13ny/Allin,Chasego/codi,cc13ny/algo,Chasego/codirit,cc13ny/Allin,Chasego/codi,Chasego/codi,Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/cod,cc13ny/algo,Chasego/cod,Chasego/codirit,Chasego/codi,Chasego/cod,cc13ny/algo,Chasego/codirit,Chaseg...
--- +++ @@ -0,0 +1,11 @@ +class Solution(object): + def titleToNumber(self, s): + """ + :type s: str + :rtype: int + """ + res = 0 + for i in range(len(s) - 1, -1, -1): + res += (ord(s[i]) - ord('A') + 1) * 26 ** (len(s) - 1 - i) + + return res
7b5de280562f5984b04c63432de8f28e03b57cbd
firecares/firestation/migrations/0020_update_greeley_headquarters_location.py
firecares/firestation/migrations/0020_update_greeley_headquarters_location.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.gis.geos import Point from django.db import models, migrations from genericm2m.utils import monkey_patch class Migration(migrations.Migration): dependencies = [ ('firestation', '0019_assign-station-number-2'), ('...
Move Union Colony Fire rescue authority to correct location
Move Union Colony Fire rescue authority to correct location
Python
mit
HunterConnelly/firecares,HunterConnelly/firecares,HunterConnelly/firecares,meilinger/firecares,FireCARES/firecares,FireCARES/firecares,HunterConnelly/firecares,FireCARES/firecares,FireCARES/firecares,meilinger/firecares,meilinger/firecares,meilinger/firecares,FireCARES/firecares
--- +++ @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.contrib.gis.geos import Point +from django.db import models, migrations +from genericm2m.utils import monkey_patch + + +class Migration(migrations.Migration): + + dependencies = [ + ('firestation', '001...
27b43a8e46ad7a47415942587ab23e391c72b269
tests/functional/core/test_brocker.py
tests/functional/core/test_brocker.py
from circus.client import CircusClient from onitu.utils import get_circusctl_endpoint from tests.utils.testdriver import TestDriver from tests.utils.loop import BooleanLoop def test_abort_if_no_source(setup, launcher): A = TestDriver('A', speed_bump=True) B = TestDriver('B', speed_bump=True) setup.add(...
Add some tests for the brocker
Add some tests for the brocker
Python
mit
onitu/onitu,onitu/onitu,onitu/onitu
--- +++ @@ -0,0 +1,80 @@ +from circus.client import CircusClient + +from onitu.utils import get_circusctl_endpoint + +from tests.utils.testdriver import TestDriver +from tests.utils.loop import BooleanLoop + + +def test_abort_if_no_source(setup, launcher): + A = TestDriver('A', speed_bump=True) + B = TestDriver...
72ea0dc2c55ac139e006eebc0fed29a20d3900ad
tests/test_django_default_settings.py
tests/test_django_default_settings.py
import unittest from django.conf import global_settings as default import cbs class MySettings: @property def INSTALLED_APPS(self): # Customize an empty global setting. return list(default.INSTALLED_APPS) + ['test'] @property def CACHES(self): # Customize a non-empty global...
Add a test demonstrating how to use the django global settings.
Add a test demonstrating how to use the django global settings.
Python
bsd-2-clause
funkybob/django-classy-settings
--- +++ @@ -0,0 +1,36 @@ +import unittest + +from django.conf import global_settings as default + +import cbs + + +class MySettings: + + @property + def INSTALLED_APPS(self): + # Customize an empty global setting. + return list(default.INSTALLED_APPS) + ['test'] + + @property + def CACHES(se...
a142dfd0ec94785df58d766abc97df837106a736
tests/test_50_xarray_to_grib_regular_ll.py
tests/test_50_xarray_to_grib_regular_ll.py
import numpy as np import pytest import xarray as xr from cfgrib import xarray_store @pytest.fixture() def canonic_dataarray(): da = xr.DataArray( np.arange(20.).reshape((4, 5)), coords=[np.linspace(90., -90., 4), np.linspace(0., 360., 5, endpoint=False)], dims=['latitude', 'longitude'],...
Add some simple tests for grib_keys auto-detection and user definition.
Add some simple tests for grib_keys auto-detection and user definition.
Python
apache-2.0
ecmwf/cfgrib
--- +++ @@ -0,0 +1,42 @@ + +import numpy as np +import pytest +import xarray as xr + +from cfgrib import xarray_store + + +@pytest.fixture() +def canonic_dataarray(): + da = xr.DataArray( + np.arange(20.).reshape((4, 5)), + coords=[np.linspace(90., -90., 4), np.linspace(0., 360., 5, endpoint=False)],...