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
526560178f93894f19ed6d99557254eea78653ea
services/migrations/0002_add_initial_servicetypes.py
services/migrations/0002_add_initial_servicetypes.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): def add_servicetypes(apps, schema_editor): ServiceType = apps.get_model('services', 'ServiceType') for st in SERVICE_TYPES: ServiceType.obj...
Add ServiceTypes as a data migration instead of fixtures
Add ServiceTypes as a data migration instead of fixtures
Python
mit
AriMartti/sikteeri,kapsiry/sikteeri,kapsiry/sikteeri,joneskoo/sikteeri,joneskoo/sikteeri,kapsiry/sikteeri,annttu/sikteeri,annttu/sikteeri,annttu/sikteeri,joneskoo/sikteeri,annttu/sikteeri,AriMartti/sikteeri,AriMartti/sikteeri,joneskoo/sikteeri,AriMartti/sikteeri,kapsiry/sikteeri
--- +++ @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + def add_servicetypes(apps, schema_editor): + ServiceType = apps.get_model('services', 'ServiceType') + + for st in SE...
690dc62ae000d7608da72b2372828b1d91659e4f
test/test_functions.py
test/test_functions.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) __author__ = "Yuji Ikeda" import unittest import numpy as np from ph_unfolder.analysis.functions import lorentzian_unnormalized class TestFunctions(unittest.Test...
Add the test for functions.py
Add the test for functions.py
Python
mit
yuzie007/upho,yuzie007/ph_unfolder
--- +++ @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from __future__ import (absolute_import, division, + print_function, unicode_literals) + +__author__ = "Yuji Ikeda" + +import unittest +import numpy as np +from ph_unfolder.analysis.functions import lorentzian_unnormalize...
0ac153e6e3b9432aac2bd5bbbe119480e5c1677c
tests/calculate_test.py
tests/calculate_test.py
from calculate import calculate def test_calculate(): assert calculate('5+5') == 10 assert calculate('5*5') == 25 assert calculate('10/2') == 5 assert calculate('10-4') == 6 assert calculate('7/3') == 2 assert calculate('5-10') == -5 assert calculate('2+7*2') == 16
Add test cases for calculate
Add test cases for calculate
Python
mit
MichaelAquilina/Simple-Calculator
--- +++ @@ -0,0 +1,13 @@ +from calculate import calculate + + +def test_calculate(): + assert calculate('5+5') == 10 + assert calculate('5*5') == 25 + assert calculate('10/2') == 5 + assert calculate('10-4') == 6 + + assert calculate('7/3') == 2 + assert calculate('5-10') == -5 + + assert calcula...
3e75626ee72dee59d2aec01b4dd4278cd7fed3fe
tests/test_alternate.py
tests/test_alternate.py
from dtest import * from dtest.util import * class TestAlternate(DTestCase): alternate = None def setUp(self): assert_is_none(self.alternate) self.alternate = False def tearDown(self): assert_false(self.alternate) def test1(self): assert_false(self.alternate) @i...
Add tests to ensure the setUp and tearDown decorators work
Add tests to ensure the setUp and tearDown decorators work
Python
apache-2.0
klmitch/dtest,klmitch/dtest
--- +++ @@ -0,0 +1,29 @@ +from dtest import * +from dtest.util import * + + +class TestAlternate(DTestCase): + alternate = None + + def setUp(self): + assert_is_none(self.alternate) + self.alternate = False + + def tearDown(self): + assert_false(self.alternate) + + def test1(self): + ...
60cfcca427337881eb611fb85456ed4dee104992
TP1/Sources/instance_info_script.py
TP1/Sources/instance_info_script.py
#!/usr/bin/env python import subprocess import argparse # inspired by https://www.cyberciti.biz/faq/linux-ram-info-command/ and https://en.wikipedia.org/wiki/Hdparm def main(): parser = argparse.ArgumentParser() parser.add_argument('--output', dest='path', help='Path for the output file') parser.add_argu...
Add script to get machine characteristics
Add script to get machine characteristics
Python
mit
PrincessMadMath/LOG8415-Advanced_Cloud,PrincessMadMath/LOG8415-Advanced_Cloud,PrincessMadMath/LOG8415-Advanced_Cloud
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +import subprocess +import argparse + +# inspired by https://www.cyberciti.biz/faq/linux-ram-info-command/ and https://en.wikipedia.org/wiki/Hdparm + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--output', dest='path', help='Path for ...
9dfe9061f6294918c0c52594617db595bd0baf17
ancillary_data/IRAM30m_CO21/14B-088/make_14B-088_HI_smoothed_output.py
ancillary_data/IRAM30m_CO21/14B-088/make_14B-088_HI_smoothed_output.py
''' Make a version of the CO(2-1) data at the resolution of the 14B-088 HI data ''' from spectral_cube import SpectralCube, Projection from spectral_cube.cube_utils import largest_beam from astropy.io import fits import os from cube_analysis import run_pipeline from paths import fourteenB_HI_file_dict, iram_co21_da...
Add making a signal mask and moment arrays for the CO smoothed cube
Add making a signal mask and moment arrays for the CO smoothed cube
Python
mit
e-koch/VLA_Lband,e-koch/VLA_Lband
--- +++ @@ -0,0 +1,48 @@ + +''' +Make a version of the CO(2-1) data at the resolution of the 14B-088 HI data +''' + +from spectral_cube import SpectralCube, Projection +from spectral_cube.cube_utils import largest_beam +from astropy.io import fits +import os + +from cube_analysis import run_pipeline + +from paths imp...
e9607bbacb1e2775bbda6010b51a076a57b5ad09
make_body_part_mapping.py
make_body_part_mapping.py
"""Make a mapping from body part words to categories. Make mapping <body part word> -> [historic words] based on Inger Leemans' clustering. Usage: python make_body_part_mapping.py Requires files body_part_clusters_renaissance.csv, body_part_clusters_classisism.csv, and body_part_clusters_enlightenment.csv to be in ...
Add script to save a mapping for body parts to categories
Add script to save a mapping for body parts to categories The script creates a json file containing categories->(Dutch) words for body parts. The mapping is based on Inger Leemans' division.
Python
apache-2.0
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
--- +++ @@ -0,0 +1,57 @@ +"""Make a mapping from body part words to categories. + +Make mapping <body part word> -> [historic words] based on Inger Leemans' +clustering. + +Usage: python make_body_part_mapping.py + +Requires files body_part_clusters_renaissance.csv, +body_part_clusters_classisism.csv, and body_part_c...
b03805dbbae36743f57797026beeb6def96436a4
apps/explorer/tests/test_apps.py
apps/explorer/tests/test_apps.py
from django.apps import apps from django.test import TestCase from ..apps import ExplorerConfig class ExplorerConfigTestCase(TestCase): def test_config(self): expected = 'explorer' self.assertEqual(ExplorerConfig.name, expected) expected = 'apps.explorer' self.assertEqual(apps....
Add tests for the explorer app
Add tests for the explorer app
Python
bsd-3-clause
Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel
--- +++ @@ -0,0 +1,15 @@ +from django.apps import apps +from django.test import TestCase + +from ..apps import ExplorerConfig + + +class ExplorerConfigTestCase(TestCase): + + def test_config(self): + + expected = 'explorer' + self.assertEqual(ExplorerConfig.name, expected) + + expected = 'apps...
45bdb3cce8e8417362a19ac9427b06c68910aa1f
profile_xf28id1/startup/80-areadetector.py
profile_xf28id1/startup/80-areadetector.py
from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5, AreaDetectorFileStoreTIFF) shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1') shctl2 = EpicsSignal('XF:28IDC-ES:1{Det:PE2}cam1:ShutterMode', name='shctl2') pe1 = AreaDetectorFileSt...
Add PE detectors pe1, pe2
Add PE detectors pe1, pe2
Python
bsd-2-clause
NSLS-II-XPD/ipython_ophyd,NSLS-II-XPD/ipython_ophyd,pavoljuhas/ipython_ophyd,pavoljuhas/ipython_ophyd
--- +++ @@ -0,0 +1,21 @@ +from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5, + AreaDetectorFileStoreTIFF) + +shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1') +shctl2 = EpicsSignal('XF:28IDC-ES:1{Det:PE2}cam1:ShutterMode', name='sh...
03791f4768866b199f0ef840a0ac64849def85e3
scripts/ingestors/awos/parse_monthly_maint.py
scripts/ingestors/awos/parse_monthly_maint.py
""" Parse the monthly maint file I get from the DOT id | integer | not null default nextval('iem_calibrati on_id_seq'::regclass) station | character varying(10) | portfolio | character varying(10) | valid | timestamp with time zone | parameter | character varying(10)...
Add tool to parse AWOS maint records provided monthly
Add tool to parse AWOS maint records provided monthly
Python
mit
akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem
--- +++ @@ -0,0 +1,71 @@ +""" + Parse the monthly maint file I get from the DOT + + id | integer | not null default nextval('iem_calibrati +on_id_seq'::regclass) + station | character varying(10) | + portfolio | character varying(10) | + valid | timestamp with time zone | ...
b5468138da2947d582e37da8bd5e3d4aa5838eac
taggert/imagemarker.py
taggert/imagemarker.py
from gi.repository import Champlain class ImageMarker(Champlain.Point): def __init__(self, treeiter, filename, lat, lon, clicked): Champlain.Point.__init__(self) self.filename = filename self.treeiter = treeiter self.set_location(lat, lon) self.set_selectable(True) ...
Add ImageMarker class, overriding Champlain.Point
Add ImageMarker class, overriding Champlain.Point
Python
apache-2.0
tinuzz/taggert
--- +++ @@ -0,0 +1,13 @@ +from gi.repository import Champlain + +class ImageMarker(Champlain.Point): + + def __init__(self, treeiter, filename, lat, lon, clicked): + Champlain.Point.__init__(self) + self.filename = filename + self.treeiter = treeiter + self.set_location(lat, lon) + ...
3c707036b8c7d0f85e13f7d8294051cf6f04819f
dump_data.py
dump_data.py
from pmg_backend import db from pmg_backend.models import * import json import os bills = Bill.query.filter_by(is_deleted=False).all() print len(bills) out = [] for bill in bills: tmp_bill = { 'name': bill.name, 'code': bill.code, 'bill_type': bill.bill_type, 'year': bill.year, ...
Add script for dumping database to txt.
Add script for dumping database to txt.
Python
apache-2.0
Code4SA/pmgbilltracker,Code4SA/pmgbilltracker
--- +++ @@ -0,0 +1,42 @@ +from pmg_backend import db +from pmg_backend.models import * +import json +import os + +bills = Bill.query.filter_by(is_deleted=False).all() + +print len(bills) + +out = [] +for bill in bills: + tmp_bill = { + 'name': bill.name, + 'code': bill.code, + 'bill_type': bil...
dbd1708c562c698dd6ea53fb8276ceaf9820045b
test_project/test_app/tests/test_models.py
test_project/test_app/tests/test_models.py
from django.contrib.gis.geos import Point from django.test import TestCase from cities import models class SlugModelTest(object): """ Common tests for SlugModel subclasses. """ def instantiate(self): """ Implement this to return a valid instance of the model under test. """ ...
Add regression tests for saving with force_insert
Add regression tests for saving with force_insert
Python
mit
coderholic/django-cities,coderholic/django-cities,coderholic/django-cities
--- +++ @@ -0,0 +1,122 @@ +from django.contrib.gis.geos import Point +from django.test import TestCase + +from cities import models + + +class SlugModelTest(object): + """ + Common tests for SlugModel subclasses. + """ + + def instantiate(self): + """ + Implement this to return a valid insta...
3906f5465ac8420a86c9dc918abc61b20886718b
test.py
test.py
__author__ = 'adam' import pv import serial import sys pv.debug() pv.debug_color() port = serial.Serial('/dev/tty.usbserial') #port.open() from pv import cms inv = cms.Inverter(port) inv.reset() sn = inv.discover() if sn is None: print "Inverter is not connected." sys.exit(1) ok = inv.register(sn) # Associates ...
Test script based on README file
Test script based on README file
Python
mit
blebo/pv
--- +++ @@ -0,0 +1,38 @@ +__author__ = 'adam' + +import pv +import serial +import sys + +pv.debug() +pv.debug_color() + +port = serial.Serial('/dev/tty.usbserial') +#port.open() + +from pv import cms +inv = cms.Inverter(port) + +inv.reset() +sn = inv.discover() +if sn is None: + print "Inverter is not connected." + s...
9616e572537fd469a5fd448287fc58e558217f3c
Lib/test/test_getargs.py
Lib/test/test_getargs.py
"""Test the internal getargs.c implementation PyArg_ParseTuple() is defined here. The test here is not intended to test all of the module, just the single case that failed between 2.1 and 2.2a2. """ # marshal.loads() uses PyArg_ParseTuple(args, "s#:loads") # The s code will cause a Unicode conversion to occur. Thi...
Test the failed-unicode-decoding bug in PyArg_ParseTuple().
Test the failed-unicode-decoding bug in PyArg_ParseTuple().
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -0,0 +1,24 @@ +"""Test the internal getargs.c implementation + + PyArg_ParseTuple() is defined here. + +The test here is not intended to test all of the module, just the +single case that failed between 2.1 and 2.2a2. +""" + +# marshal.loads() uses PyArg_ParseTuple(args, "s#:loads") +# The s code will caus...
97de5c8c4ff9516bfa0b9daedd74aee708470433
numba/cuda/tests/cudapy/test_multithreads.py
numba/cuda/tests/cudapy/test_multithreads.py
from numba import cuda import numpy as np from numba import unittest_support as unittest from numba.cuda.testing import skip_on_cudasim try: from concurrent.futures import ThreadPoolExecutor, as_completed except ImportError: has_thread_pool = False else: has_thread_pool = True @skip_on_cudasim('disabled ...
Add test for concurrent compilation of cuda.jit kernels
Add test for concurrent compilation of cuda.jit kernels
Python
bsd-2-clause
stonebig/numba,stefanseefeld/numba,jriehl/numba,IntelLabs/numba,cpcloud/numba,stefanseefeld/numba,stuartarchibald/numba,jriehl/numba,gmarkall/numba,sklam/numba,stonebig/numba,cpcloud/numba,numba/numba,IntelLabs/numba,cpcloud/numba,seibert/numba,sklam/numba,gmarkall/numba,numba/numba,IntelLabs/numba,IntelLabs/numba,skla...
--- +++ @@ -0,0 +1,36 @@ +from numba import cuda +import numpy as np +from numba import unittest_support as unittest +from numba.cuda.testing import skip_on_cudasim + +try: + from concurrent.futures import ThreadPoolExecutor, as_completed +except ImportError: + has_thread_pool = False +else: + has_thread_poo...
0e675a64a47df075aa0c334e3a85a45d9581401b
tests/test_shot.py
tests/test_shot.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from db.shot import Shot def test_find_by_event_id(): shot = Shot.find_by_event_id(20160207550053) assert shot.team_id == 15 assert shot.player_id == 8471702 assert shot.zone == "Off" assert shot.goalie_team_id == 6 assert shot.goalie_id == 847169...
Add test script for shot items
Add test script for shot items
Python
mit
leaffan/pynhldb
--- +++ @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from db.shot import Shot + + +def test_find_by_event_id(): + shot = Shot.find_by_event_id(20160207550053) + assert shot.team_id == 15 + assert shot.player_id == 8471702 + assert shot.zone == "Off" + assert shot.goalie_team_id =...
c3fdfe911444071c4e6c0f12252c1b3322bf99f0
toxiproxy/utils.py
toxiproxy/utils.py
import socket from contextlib import closing def test_connection(host, port): """ Test a connection to a host/port """ with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: return bool(sock.connect_ex((host, port)) == 0)
Add a function to test socket connections
Add a function to test socket connections
Python
mit
douglas/toxiproxy-python,douglas/toxiproxy-python
--- +++ @@ -0,0 +1,9 @@ +import socket + +from contextlib import closing + +def test_connection(host, port): + """ Test a connection to a host/port """ + + with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: + return bool(sock.connect_ex((host, port)) == 0)
5a975c3c4f48609a57e3eb69c5bd25116097f0ee
htmltocsv.py
htmltocsv.py
#!/usr/bin/env python import sys import re import csv from bs4 import BeautifulSoup def row_to_dict(row): date_str = row.find(id = re.compile(r'transactionView\.output\.transactionDate\d+')).get_text() date = " ".join(date_str.split()[0:3]) ref_str = row.find(id = re.compile(r'transactionView\.output\.re...
Add simple HTML scraper that generates CSVs
Add simple HTML scraper that generates CSVs
Python
mit
mdmoss/load-and-go
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +import sys +import re +import csv +from bs4 import BeautifulSoup + +def row_to_dict(row): + date_str = row.find(id = re.compile(r'transactionView\.output\.transactionDate\d+')).get_text() + date = " ".join(date_str.split()[0:3]) + + ref_str = row.find(id = r...
5c7400a2e70e5d9ee7f8a73e43abbf0f7b992152
ibei/main.py
ibei/main.py
# -*- coding: utf-8 -*- import numpy as np from astropy import constants from astropy import units from sympy.mpmath import polylog def uibei(order, energy_lo, temp, chem_potential): """ Upper incomplete Bose-Einstein integral. """ kT = temp * constants.k_B reduced_energy_lo = energy_lo / kT ...
Add first draft of upper incomplete Bose-Einstein integral
Add first draft of upper incomplete Bose-Einstein integral
Python
mit
jrsmith3/tec,jrsmith3/tec,jrsmith3/ibei
--- +++ @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +import numpy as np +from astropy import constants +from astropy import units +from sympy.mpmath import polylog + + +def uibei(order, energy_lo, temp, chem_potential): + """ + Upper incomplete Bose-Einstein integral. + """ + kT = temp * constants.k_B + +...
39310b46e9f2c963572001d8a4d0e110540584bf
app/soc/modules/gsoc/models/slot_transfer.py
app/soc/modules/gsoc/models/slot_transfer.py
#!/usr/bin/env python2.5 # # Copyright 2009 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
Define the slot transfer data model.
Define the slot transfer data model.
Python
apache-2.0
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python2.5 +# +# Copyright 2009 the Melange authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICEN...
25fff03be8cfef6534b4876e81f7c9fd036d2248
tools/generator/raw-data-extractor/extract-nrf.py
tools/generator/raw-data-extractor/extract-nrf.py
from pathlib import Path import urllib.request import zipfile import shutil import io import os packurl = "https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-MDK/sw/8-33-0/nRF_MDK_8_33_0_GCC_BSDLicense.zip" shutil.rmtree("../raw-device-data/nrf-devices", ignore_errors=True) Path("../...
Add NRF device data extractor
[dfg] Add NRF device data extractor
Python
mpl-2.0
modm-io/modm-devices
--- +++ @@ -0,0 +1,28 @@ +from pathlib import Path +import urllib.request +import zipfile +import shutil +import io +import os + +packurl = "https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-MDK/sw/8-33-0/nRF_MDK_8_33_0_GCC_BSDLicense.zip" + +shutil.rmtree("../raw-device-data/nrf-de...
71ad5c15602d6aeeea0b1ab72b244b47d634618d
DjangoApplication/complaint_system/forms.py
DjangoApplication/complaint_system/forms.py
from django import forms from django.forms.widgets import CheckboxSelectMultiple from complaint_system.models import Complaint class AddComplaint(forms.ModelForm): address = forms.CharField(max_length=250, required = True) city = forms.CharField(max_length=250, required = True) province = forms.CharField(...
Add more fields to Form and Database and have complaint_sytem page reflect that. Change 'categories' from dropdown to checkboxes.
Add more fields to Form and Database and have complaint_sytem page reflect that. Change 'categories' from dropdown to checkboxes.
Python
mit
CSC301H-Fall2013/healthyhome,CSC301H-Fall2013/healthyhome
--- +++ @@ -0,0 +1,23 @@ +from django import forms +from django.forms.widgets import CheckboxSelectMultiple + +from complaint_system.models import Complaint + +class AddComplaint(forms.ModelForm): + address = forms.CharField(max_length=250, required = True) + city = forms.CharField(max_length=250, required = Tr...
e80941a4bb0a3eea4bbbde883128d586d3a13946
tests/cli/test_quick.py
tests/cli/test_quick.py
import os import subprocess as sp import base64 def test_crash(): CLI_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../cli.py") # Test that commands don't crash crashes assert 0 == sp.call([CLI_FILE, "help"], stdout=sp.DEVNULL, stderr=sp.DEVNULL) assert 0 == sp.call([CLI_FILE, "...
Add quick test for finding crashes and errors
Add quick test for finding crashes and errors
Python
mit
haihala/modman
--- +++ @@ -0,0 +1,27 @@ +import os +import subprocess as sp +import base64 + + +def test_crash(): + CLI_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../cli.py") + + # Test that commands don't crash crashes + assert 0 == sp.call([CLI_FILE, "help"], stdout=sp.DEVNULL, stderr=sp.DEVNULL)...
9c52955c7e18987be6131afeb83093060afb4f98
q_learning/main.py
q_learning/main.py
# coding: utf-8 import random import gym import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # noqa env = gym.make('FrozenLake-v0') class Agent(object): def __init__(self, action_space, eps=0.01, alpha=0.1, gamma=0.9): self.action_space = action_space self.eps = eps ...
Add an agent of q-learning
Add an agent of q-learning
Python
apache-2.0
nel215/reinforcement-learning
--- +++ @@ -0,0 +1,76 @@ +# coding: utf-8 +import random +import gym +import pandas as pd +import matplotlib.pyplot as plt +import seaborn as sns # noqa +env = gym.make('FrozenLake-v0') + + +class Agent(object): + + def __init__(self, action_space, eps=0.01, alpha=0.1, gamma=0.9): + self.action_space = act...
694a62f94391e0ce89a5ba52aa4616d41dac59e2
scripts/file_counts.py
scripts/file_counts.py
#!/usr/bin/env python import hashlib import os import os.path import stat import sys """ A script for counting file popularity information in given directory. Usage: ./file_counts.py DIRECTORY The popularity data will be written to stdout. Each line contains information about a single file in the following form...
Add the script used to collect file popularity and size information
Add the script used to collect file popularity and size information
Python
apache-2.0
sjakthol/dedup-simulator,sjakthol/dedup-simulator
--- +++ @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +import hashlib +import os +import os.path +import stat +import sys + +""" +A script for counting file popularity information in given directory. + +Usage: + ./file_counts.py DIRECTORY + +The popularity data will be written to stdout. Each line contains information...
79c7720fcc7302d498bd81106361bae126218648
lab/07/template_07_c.py
lab/07/template_07_c.py
def main(): matkul = #buat sebuah dictionary while #buat agar meminta input terus : masukkan = input(">>> ") ###### #buat agar program berhenti saat masukkan adalah "selesai" ###### masukkan_split = masukkan.split(" ") if (masukkan_split[0] == "tamba...
Add lab 07 template for class C
Add lab 07 template for class C
Python
mit
laymonage/TarungLab,giovanism/TarungLab
--- +++ @@ -0,0 +1,45 @@ +def main(): + matkul = #buat sebuah dictionary + + while #buat agar meminta input terus : + masukkan = input(">>> ") + + ###### + + #buat agar program berhenti saat masukkan adalah "selesai" + + ###### + + masukkan_split = masukkan.split(" ") ...
45091c5bd93c3e6c40da9e1987eb22be61d33956
aospy/test/test_timedate.py
aospy/test/test_timedate.py
#!/usr/bin/env python """Test suite for aospy.utils module.""" import sys import unittest import numpy as np import xarray as xr from datetime import datetime from aospy.timedate import TimeManager class AospyTimeManagerTestCase(unittest.TestCase): def setUp(self): # self.tm = TimeManager() pass ...
TEST Added tests of TimeManager
TEST Added tests of TimeManager
Python
apache-2.0
spencerkclark/aospy,spencerahill/aospy
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/env python +"""Test suite for aospy.utils module.""" +import sys +import unittest + +import numpy as np +import xarray as xr +from datetime import datetime + +from aospy.timedate import TimeManager + + +class AospyTimeManagerTestCase(unittest.TestCase): + def setUp(self): +# ...
4cd919e5301880895d1c05ac1bb19cee2c2443ec
py/string-compression.py
py/string-compression.py
class Solution(object): def compress(self, chars): """ :type chars: List[str] :rtype: int """ idx = 0 prev = None cnt = 0 for c in chars: if c == prev: cnt += 1 else: if prev is not None: ...
Add py solution for 443. String Compression
Add py solution for 443. String Compression 443. String Compression: https://leetcode.com/problems/string-compression/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,31 @@ +class Solution(object): + def compress(self, chars): + """ + :type chars: List[str] + :rtype: int + """ + idx = 0 + prev = None + cnt = 0 + for c in chars: + if c == prev: + cnt += 1 + else: + ...
c67cf282f4b74e44cb0df11e4ab72ef8214f62d6
lightning/types/utils.py
lightning/types/utils.py
from numpy import asarray, vstack, newaxis, zeros, nonzero, concatenate, transpose, atleast_2d def check_colors(clrs): clrs = asarray(clrs) if clrs.ndim == 2 and clrs.shape[1] == 1: clrs = clrs.flatten() if clrs.ndim == 2 and clrs.shape[0] == 1: clrs = clrs.flatten() if clrs.ndim =...
Move parsing utilities to separate module
Move parsing utilities to separate module
Python
mit
peterkshultz/lightning-python,peterkshultz/lightning-python,lightning-viz/lightning-python,peterkshultz/lightning-python,garretstuber/lightning-python,garretstuber/lightning-python,lightning-viz/lightning-python,garretstuber/lightning-python
--- +++ @@ -0,0 +1,74 @@ +from numpy import asarray, vstack, newaxis, zeros, nonzero, concatenate, transpose, atleast_2d + +def check_colors(clrs): + + clrs = asarray(clrs) + if clrs.ndim == 2 and clrs.shape[1] == 1: + clrs = clrs.flatten() + if clrs.ndim == 2 and clrs.shape[0] == 1: + clrs...
62daab10b3c0edfc10367e4f08f0501c487915d0
recipe_engine/unittests/test_env.py
recipe_engine/unittests/test_env.py
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Script to setup the environment to run unit tests. Modifies PYTHONPATH to automatically include parent, common and pylibs directories. """ import os...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Script to setup the environment to run unit tests. Modifies PYTHONPATH to automatically include parent, common and pylibs directories. """ import os...
Remove forgotten bits of buildbot 0.7.12 compatibility code.
Remove forgotten bits of buildbot 0.7.12 compatibility code. A second take of https://chromiumcodereview.appspot.com/13560017 but should work now. R=iannucci@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/20481003 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@217592 0039d316-1c4b-4281-b...
Python
apache-2.0
luci/recipes-py,shishkander/recipes-py,luci/recipes-py,shishkander/recipes-py
--- +++ @@ -18,7 +18,7 @@ sys.path.insert(0, os.path.join(BASE_DIR, 'scripts')) sys.path.insert(0, os.path.join(BASE_DIR, 'site_config')) sys.path.insert(0, os.path.join(BASE_DIR, 'third_party')) -sys.path.insert(0, os.path.join(BASE_DIR, 'third_party', 'buildbot_8_4p1')) +sys.path.insert(0, os.path.join(BASE_DIR,...
d4927b00ec95029b0995f5a6c64ecd0cb2398079
examples/tic_ql_mlp_selfplay_all.py
examples/tic_ql_mlp_selfplay_all.py
''' The Q-learning algorithm is used to learn the state-action values for all Tic-Tac-Toe positions by playing games against itself (self-play). ''' from capstone.game.games import TicTacToe from capstone.game.players import RandPlayer from capstone.rl import Environment, GameMDP from capstone.rl.learners import Approx...
Add example for Tic-Tac-Toe with a Q-Network via Self-play
Add example for Tic-Tac-Toe with a Q-Network via Self-play
Python
mit
davidrobles/mlnd-capstone-code
--- +++ @@ -0,0 +1,34 @@ +''' +The Q-learning algorithm is used to learn the state-action values for all +Tic-Tac-Toe positions by playing games against itself (self-play). +''' +from capstone.game.games import TicTacToe +from capstone.game.players import RandPlayer +from capstone.rl import Environment, GameMDP +from...
491ddec4c429993b9149eb61139fe71d691f697f
mysite/search/models.py
mysite/search/models.py
from django.db import models # Create your models here. class Project(models.Model): name = models.CharField(max_length=200) language = models.CharField(max_length=200) icon_url = models.URLField(max_length=200) class Bug(models.Model): project = models.ForeignKey(Project) title = models.CharField...
from django.db import models # Create your models here. class Project(models.Model): name = models.CharField(max_length=200) language = models.CharField(max_length=200) icon_url = models.URLField(max_length=200) class Bug(models.Model): project = models.ForeignKey(Project) title = models.CharField...
Add a bug link field
Add a bug link field
Python
agpl-3.0
onceuponatimeforever/oh-mainline,nirmeshk/oh-mainline,moijes12/oh-mainline,SnappleCap/oh-mainline,openhatch/oh-mainline,nirmeshk/oh-mainline,SnappleCap/oh-mainline,Changaco/oh-mainline,ehashman/oh-mainline,mzdaniel/oh-mainline,Changaco/oh-mainline,vipul-sharma20/oh-mainline,nirmeshk/oh-mainline,ojengwa/oh-mainline,Chan...
--- +++ @@ -18,4 +18,4 @@ last_polled = models.DateTimeField() submitter_username = models.CharField(max_length=200) submitter_realname = models.CharField(max_length=200) - + canonical_bug_link = models.URLField(max_length=200)
815f7feb1d0dfae944f43e12086ade31d62afcdc
handover_api/migrations/0014_auto_20160616_1500.py
handover_api/migrations/0014_auto_20160616_1500.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-06-16 15:00 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('handover_api', '0013_auto_20160614_2010'), ] operat...
Add migration that cascades deletion of handover/draft on delete
Add migration that cascades deletion of handover/draft on delete
Python
mit
Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService
--- +++ @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-06-16 15:00 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('handover_api', '0013_...
ff3779f3c482f57182f4855ae09cff3d95ca1304
talempd/zest/skype/ValidateBinarySearchTree.py
talempd/zest/skype/ValidateBinarySearchTree.py
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: The root of binary tree. @return: True if the binary tree is BST, or false """ def isValidBST(self, root): # write...
Add ValBST for Zest Skype
Add ValBST for Zest Skype
Python
mit
cc13ny/Allin,cc13ny/algo,cc13ny/algo,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/cod,Chasego/cod,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/cod,Chasego/codirit,cc13ny/Allin,Chasego/codi,Chasego/cod,Chasego/codirit,Chasego/codi,Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/codirit,Chasego/codi,Chaseg...
--- +++ @@ -0,0 +1,26 @@ +""" +Definition of TreeNode: +class TreeNode: + def __init__(self, val): + self.val = val + self.left, self.right = None, None +""" +class Solution: + """ + @param root: The root of binary tree. + @return: True if the binary tree is BST, or false + """ + def...
08392cf690ba8f8025ddee7eb494810de5c94bcc
pattsgui/aboutdialog.py
pattsgui/aboutdialog.py
## ## patts-qt - Qt GUI client for PATTS ## Copyright (C) 2015 Delwink, LLC ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU Affero General Public License as published by ## the Free Software Foundation, version 3 only. ## ## This program is distributed i...
Add file for info dialog
Add file for info dialog
Python
agpl-3.0
delwink/patts-qt
--- +++ @@ -0,0 +1,16 @@ +## +## patts-qt - Qt GUI client for PATTS +## Copyright (C) 2015 Delwink, LLC +## +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU Affero General Public License as published by +## the Free Software Foundation, version 3 only. +#...
70b1313fe9528a72fab966ab69e7d784e40653d5
functest/tests/unit/features/test_netready.py
functest/tests/unit/features/test_netready.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 netready
Add unit tests for netready Change-Id: I45f9209c55bd65c9538fc3b1181ccbcfbdd23a40 Signed-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>
Python
apache-2.0
mywulin/functest,mywulin/functest,opnfv/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...
956e363d41b21ab85d2c64bbc81db1d9becab43f
java/graveyard/support/scripts/copy-string.py
java/graveyard/support/scripts/copy-string.py
#!/usr/bin/env python import os import os.path import sys import lxml.etree source_path = os.path.expanduser('~/workspace/git/android/platform/packages/apps/Mms') dest_path = os.path.expanduser('~/workspace/git/android-sms-merge/android_sms_merge') def main(): if len(sys.argv) < 2: sys.exit('Error: STRI...
Add script for copying strings from one project/app to another
Add script for copying strings from one project/app to another
Python
mit
bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile
--- +++ @@ -0,0 +1,84 @@ +#!/usr/bin/env python + +import os +import os.path +import sys + +import lxml.etree + +source_path = os.path.expanduser('~/workspace/git/android/platform/packages/apps/Mms') +dest_path = os.path.expanduser('~/workspace/git/android-sms-merge/android_sms_merge') + +def main(): + if len(sys....
cbb4a2c3b23571cbbbe4e7316e4ce651e8422856
migrations/versions/0241_another_letter_org.py
migrations/versions/0241_another_letter_org.py
"""empty message Revision ID: 0241_another_letter_org Revises: 0240_dvla_org_non_nullable """ # revision identifiers, used by Alembic. revision = '0241_another_letter_org' down_revision = '0240_dvla_org_non_nullable' from alembic import op NEW_ORGANISATIONS = [ ('515', 'ACAS', 'acas'), ] def upgrade(): ...
Add ACAS to dvla_org_id table
Add ACAS to dvla_org_id table
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,35 @@ +"""empty message + +Revision ID: 0241_another_letter_org +Revises: 0240_dvla_org_non_nullable + +""" + +# revision identifiers, used by Alembic. +revision = '0241_another_letter_org' +down_revision = '0240_dvla_org_non_nullable' + +from alembic import op + + +NEW_ORGANISATIONS = [ + ('515...
add75a5c4222485a1b8a5266f8a1c26ec9600fb0
mygpo/podcasts/migrations/0036_related_podcasts.py
mygpo/podcasts/migrations/0036_related_podcasts.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-02-07 17:10 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('podcasts', '0035_django_uuidfield'), ] operations = [ migrations.AlterField(...
Add migration for related podcasts
Add migration for related podcasts Change was discovered by makemigrations, even though no change was made in the source.
Python
agpl-3.0
gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-02-07 17:10 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('podcasts', '0035_django_uuidfield'), + ] + + oper...
23343f0040f319f59991192636cadfd74af187af
oslo_concurrency/_i18n.py
oslo_concurrency/_i18n.py
# Copyright 2014 Mirantis Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
# Copyright 2014 Mirantis Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
Drop use of namespaced oslo.i18n
Drop use of namespaced oslo.i18n Related-blueprint: drop-namespace-packages Change-Id: Ic8247cb896ba6337932d7a74618debd698584fa0
Python
apache-2.0
varunarya10/oslo.concurrency,JioCloud/oslo.concurrency
--- +++ @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo import i18n +import oslo_i18n -_translators = i18n.TranslatorFactory(domain='oslo.concurrency') +_translators = oslo_i18n.TranslatorFactory(domain='oslo.concurrency') # Th...
68b8725500ae0d8d9260f36dc4478b146cacdcc0
tests/unit/modules/test_nilrt_ip.py
tests/unit/modules/test_nilrt_ip.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt Libs import salt.modules.nilrt_ip as nilrt_ip # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.unit import TestCase from tests.suppor...
Add nilrt_ip module unit tests
Add nilrt_ip module unit tests
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +# Import python libs +from __future__ import absolute_import, print_function, unicode_literals + +# Import Salt Libs +import salt.modules.nilrt_ip as nilrt_ip + +# Import Salt Testing Libs +from tests.support.mixins import LoaderModuleMockMixin +from tests.support....
a161197020a120a81ba8c59f58be77cfcfb8b426
rest_test.py
rest_test.py
# Copyright 2017 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
Add unitest for restclient PoolManager and http proxy
Add unitest for restclient PoolManager and http proxy
Python
apache-2.0
kubernetes-client/python,mbohlool/python-base,kubernetes-client/python,mbohlool/python-base
--- +++ @@ -0,0 +1,42 @@ +# Copyright 2017 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless requ...
733ff0f3bd9f36cf0a50e4319b613da2726960f8
python/query_spatial.py
python/query_spatial.py
from pprint import pprint from amigocloud import AmigoCloud # Use amigocloud version 1.0.5 or higher to login with tokens # This will raise an AmigoCloudError if the API token is invalid or has expired ac = AmigoCloud(token='<your token>') # For examples of how to get these values, see simple_example2.py PROJECT_OWNE...
Add example of spatial query
Add example of spatial query
Python
mit
amigocloud/amigocloud_samples,amigocloud/amigocloud_samples,amigocloud/amigocloud_samples,amigocloud/amigocloud_samples,amigocloud/amigocloud_samples
--- +++ @@ -0,0 +1,33 @@ +from pprint import pprint +from amigocloud import AmigoCloud + +# Use amigocloud version 1.0.5 or higher to login with tokens +# This will raise an AmigoCloudError if the API token is invalid or has expired +ac = AmigoCloud(token='<your token>') + +# For examples of how to get these values, ...
fdf7daf8abc4f8e1bfb8b729fd9ffc4d0c95c509
apps/xformmanager/management/commands/generate_xforms.py
apps/xformmanager/management/commands/generate_xforms.py
""" This script generates all the necessary data to synchronize with a remote CommCareHQ server on that server. This is only really useful if you intend to manually scp/rsync data to your local server, which requires a login to the remote server. So this is not the standard synchronization workflow (but is necessary f...
Add a command to generate xform archives on the remote server (without downloading)
Add a command to generate xform archives on the remote server (without downloading)
Python
bsd-3-clause
SEL-Columbia/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,puttarajubr/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,gmimano/commcaretest,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,dimag...
--- +++ @@ -0,0 +1,77 @@ +""" This script generates all the necessary data to +synchronize with a remote CommCareHQ server on that server. +This is only really useful if you intend to manually +scp/rsync data to your local server, which requires a +login to the remote server. So this is not the standard +synchroniza...
165548d4f7a9e7af634c6e2f3eb7bfe70dbd0b53
custom/icds/management/commands/rebuild_for_migration.py
custom/icds/management/commands/rebuild_for_migration.py
from django.core.management.base import BaseCommand from collections import namedtuple from corehq.apps.userreports.models import AsyncIndicator, get_datasource_config from corehq.apps.userreports.util import get_indicator_adapter DOMAIN = 'icds-cas' DATA_SOURCES = ( 'static-icds-cas-static-child_cases_monthly_t...
Add one-off to recalculate migrated cases
Add one-off to recalculate migrated cases
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,58 @@ +from django.core.management.base import BaseCommand +from collections import namedtuple + +from corehq.apps.userreports.models import AsyncIndicator, get_datasource_config +from corehq.apps.userreports.util import get_indicator_adapter + + +DOMAIN = 'icds-cas' +DATA_SOURCES = ( + 'static-...
12e9814d0225960450bb7cf0fc80502cef13195b
rewind/test/test_code.py
rewind/test/test_code.py
"""Test code format and coding standards.""" import importlib import inspect import pkgutil import unittest def setUpModule(): global modules modules = [name for _, name, ispkg in pkgutil.walk_packages(['rewind'], 'rewind.') if not...
Test that asserts all public classes have pydoc
Test that asserts all public classes have pydoc
Python
agpl-3.0
JensRantil/rewind,JensRantil/rewind-client
--- +++ @@ -0,0 +1,56 @@ +"""Test code format and coding standards.""" +import importlib +import inspect +import pkgutil +import unittest + + +def setUpModule(): + global modules + modules = [name for _, name, ispkg in pkgutil.walk_packages(['rewind'], + ...
447f19638c43cf273b6922796a203d33407bc29e
test/util.py
test/util.py
'''Helper code for theanets unit tests.''' import numpy as np class MNIST(object): NUM_DIGITS = 100 DIGIT_SIZE = 784 def setUp(self): # we just create some random "mnist digit" data of the right shape. np.random.seed(3) self.images = np.random.randn(NUM_DIGITS, DIGIT_SIZE).astype...
'''Helper code for theanets unit tests.''' import numpy as np class MNIST(object): NUM_DIGITS = 100 DIGIT_SIZE = 784 def setUp(self): # we just create some random "mnist digit" data of the right shape. np.random.seed(3) self.images = np.random.randn(MNIST.NUM_DIGITS, MNIST.DIGIT_...
Use proper namespace for constants.
Use proper namespace for constants.
Python
mit
chrinide/theanets,devdoer/theanets,lmjohns3/theanets
--- +++ @@ -10,5 +10,5 @@ def setUp(self): # we just create some random "mnist digit" data of the right shape. np.random.seed(3) - self.images = np.random.randn(NUM_DIGITS, DIGIT_SIZE).astype('f') - self.labels = np.random.randint(0, 10, NUM_DIGITS).astype('i') + self.image...
bfeb07b70237dfae49eb18cc44c7150360c06fbd
PRESUBMIT.py
PRESUBMIT.py
# Copyright (c) 2012, 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. """Top-level presubmit script for Dart. See http://dev.chromium.org/developers/how-tos/depottools/presubm...
Add gcl presubmit script to the dart src tree.
Add gcl presubmit script to the dart src tree. Currently I just added a tree status check but we can extend this over time. Review URL: https://chromiumcodereview.appspot.com//10891021 git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@11575 260f80e4-7a28-3924-810f-c04153c831b5
Python
bsd-3-clause
dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-archive/dar...
--- +++ @@ -0,0 +1,18 @@ +# Copyright (c) 2012, 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. + +"""Top-level presubmit script for Dart. + +See http://dev.chromium.org/dev...
8db65c9f6ec67e188dd6cd11f7a7933d371e323d
feed/tests/test_contactview.py
feed/tests/test_contactview.py
from django.contrib.auth.models import User from django.test import TestCase from rest_framework.test import APIRequestFactory from feed.views import ContactViewSet from workflow.models import Contact, Country, Organization, TolaUser, \ WorkflowLevel1, WorkflowTeam class ContactViewsTest(TestCase): def setUp...
Add unit test for Contact view
Add unit test for Contact view
Python
apache-2.0
toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity
--- +++ @@ -0,0 +1,67 @@ +from django.contrib.auth.models import User +from django.test import TestCase +from rest_framework.test import APIRequestFactory + +from feed.views import ContactViewSet +from workflow.models import Contact, Country, Organization, TolaUser, \ + WorkflowLevel1, WorkflowTeam + + +class Cont...
f609654c78fb547d8de7545350f59562499d9397
ycml/scripts/partition_instances.py
ycml/scripts/partition_instances.py
""" This script is different from `ycml.scripts.partition_lines` because it takes labels into account and produces stratified partitions. """ from argparse import ArgumentParser import json import logging from sklearn.model_selection import train_test_split from ycml.utils import load_instances from ycml.utils impor...
Add script for stratified partitioning instances
Add script for stratified partitioning instances
Python
apache-2.0
skylander86/ycml
--- +++ @@ -0,0 +1,45 @@ +""" +This script is different from `ycml.scripts.partition_lines` because it takes labels into account and produces stratified partitions. +""" + +from argparse import ArgumentParser +import json +import logging + +from sklearn.model_selection import train_test_split + +from ycml.utils impor...
76a4f530d433dac0bc409963384891abaa45bbbf
python/robotics/sensors/mcp3008_spi_reader.py
python/robotics/sensors/mcp3008_spi_reader.py
import spidev class MCP3008SpiReader(object): def __init__(self, device_id): self.device = spidev.SpiDev() self.device.open(0, device_id) self.device.max_speed_hz = 1000000 def read(self, adc_id): raw_data = self.device.xfer2([1, 8 + adc_id << 4, 0]) adc_out = ((raw_data[1] & 3) << 8) + raw_...
Add MCP3008 spi interface implementation
Add MCP3008 spi interface implementation
Python
mit
asydorchuk/robotics,asydorchuk/robotics
--- +++ @@ -0,0 +1,14 @@ +import spidev + + +class MCP3008SpiReader(object): + + def __init__(self, device_id): + self.device = spidev.SpiDev() + self.device.open(0, device_id) + self.device.max_speed_hz = 1000000 + + def read(self, adc_id): + raw_data = self.device.xfer2([1, 8 + adc_id << 4, 0]) + a...
e1a799a5379a10336b73891b2f59bd9fe18f7a91
test/field/test_period.py
test/field/test_period.py
# encoding: utf-8 from __future__ import unicode_literals from datetime import timedelta from common import FieldExam from marrow.mongo.field import Period class TestHourPeriodField(FieldExam): __field__ = Period __kwargs__ = {'hours': 1} def test_delta(self, Sample): assert Sample.field.delta == timedelta(...
Add Period delta extraction test.
Add Period delta extraction test.
Python
mit
marrow/mongo
--- +++ @@ -0,0 +1,32 @@ +# encoding: utf-8 + +from __future__ import unicode_literals + +from datetime import timedelta + +from common import FieldExam +from marrow.mongo.field import Period + + +class TestHourPeriodField(FieldExam): + __field__ = Period + __kwargs__ = {'hours': 1} + + def test_delta(self, Sample):...
2bdadadbfc50aa1a99752705f96358a1076e1951
openstack/tests/functional/telemetry/v2/test_resource.py
openstack/tests/functional/telemetry/v2/test_resource.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add functional tests for telementry resource
Add functional tests for telementry resource Change-Id: I8192452971a0f04fbd6a040c3c048f9284d58bb3
Python
apache-2.0
stackforge/python-openstacksdk,mtougeron/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,briancurtin/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-openstacksdk,dudymas/python-openstacksdk,dudymas/python-openstacksdk,stackforge/python-openstacksdk,dtroyer/python-ope...
--- +++ @@ -0,0 +1,20 @@ +# 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 writi...
d621f68444ac9a8fb3bdffb86065297af0cb20ca
examples/plots/US_Counties.py
examples/plots/US_Counties.py
# Copyright (c) 2018 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ US Counties =========== Demonstrate how to plot US counties at all three available resolutions. """ import cartopy.crs as ccrs import matplotlib.pyplot as plt from metpy.plots ...
Add example of using counties with different resolutions.
Add example of using counties with different resolutions.
Python
bsd-3-clause
jrleeman/MetPy,dopplershift/MetPy,dopplershift/MetPy,ahaberlie/MetPy,ahaberlie/MetPy,jrleeman/MetPy,Unidata/MetPy,Unidata/MetPy,ShawnMurd/MetPy
--- +++ @@ -0,0 +1,26 @@ +# Copyright (c) 2018 MetPy Developers. +# Distributed under the terms of the BSD 3-Clause License. +# SPDX-License-Identifier: BSD-3-Clause +""" +US Counties +=========== + +Demonstrate how to plot US counties at all three available resolutions. +""" +import cartopy.crs as ccrs +import matpl...
4cf369610a00b9c04727bfa61e83ae2961adc480
scripts/missing-layer-was-really-a-duplicate.py
scripts/missing-layer-was-really-a-duplicate.py
#!/usr/bin/python # One missing layer was really a duplicate - so: # # - Remove that missing layer image directory # - Rename all the higher directories down one # # You also need to remove references to that layer from the # broken_slice table, and decrease all (location.location).z values # that are greater than o...
Add a script to rename directories if a missing layer was really a removed duplicate
Add a script to rename directories if a missing layer was really a removed duplicate This is quite specific to a situation we encountered, where a layer that I regarded as missing was really a duplicated layer that was removed without adjusting the z coordinates. This script contains in comments at the top the corresp...
Python
agpl-3.0
fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/python + +# One missing layer was really a duplicate - so: +# +# - Remove that missing layer image directory +# - Rename all the higher directories down one +# +# You also need to remove references to that layer from the +# broken_slice table, and decrease all (location.location...
e52a5864a651605a73a30f5a34708a7faa04343d
pivoteer/migrations/0003_migrate_pivoteer_indicator.py
pivoteer/migrations/0003_migrate_pivoteer_indicator.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.db.models import Q import datetime def populate_pivoteer_indicator(apps, schema_editor): print("entering populate_pivoteer_indicator") IndicatorRecord = apps.get_model("pivoteer","IndicatorRec...
Add migration script to update indicators
Add migration script to update indicators
Python
mit
gdit-cnd/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals +from django.db import models, migrations +from django.db.models import Q + +import datetime + +def populate_pivoteer_indicator(apps, schema_editor): + print("entering populate_pivoteer_indicator") + IndicatorRecord = a...
215f71b95911a579df919e9b81ae75feac208259
spraakbanken/s5/spr_local/make_count_files.py
spraakbanken/s5/spr_local/make_count_files.py
#!/usr/bin/env python3 import argparse import collections import os from fractions import Fraction def main(countfile, origcount, order, outdir): vocab = {"<s>": 0, "</s>": 1} counters = [None] for _ in range(order+1): counters.append(collections.Counter()) def map_vocab(line): fo...
Make count files which works correctly for words, but not yet for morphed count files
Make count files which works correctly for words, but not yet for morphed count files
Python
apache-2.0
psmit/kaldi-recipes,phsmit/kaldi-recipes,psmit/kaldi-recipes,phsmit/kaldi-recipes,psmit/kaldi-recipes
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 + +import argparse + +import collections +import os +from fractions import Fraction + + +def main(countfile, origcount, order, outdir): + vocab = {"<s>": 0, "</s>": 1} + + counters = [None] + for _ in range(order+1): + counters.append(collections.Counte...
3f61c9a552720db462ecfdecc652caac469754b4
add-alias.py
add-alias.py
#!/usr/bin/python import MySQLdb # Ask for root password in mysql passwd = raw_input("Enter password for user root in mysql: ") # Open database connection db = MySQLdb.connect("localhost","root", passwd,"servermail" ) # Input file to read from filename = raw_input("Enter file to read for entries: ") fh = open(filen...
Add script for adding addresses from file to mailing list on server
Add script for adding addresses from file to mailing list on server
Python
mit
svenpruefer/scripts,svenpruefer/scripts
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/python + +import MySQLdb + +# Ask for root password in mysql +passwd = raw_input("Enter password for user root in mysql: ") + +# Open database connection +db = MySQLdb.connect("localhost","root", passwd,"servermail" ) + +# Input file to read from +filename = raw_input("Enter file ...
545f3e613d759483e0dc87f58e915da903209861
distance_to_camera.py
distance_to_camera.py
# Import image library necessary for file import SimpleCV import sys from SimpleCV import Image def check_image(image_path): #Find file by path and import. File currently resides in same directory. image = Image(image_path) # grey = image.grayscale() instruction = "go" array_bounds_possible_widths = [image.wi...
Add distance to camera document
Add distance to camera document
Python
mit
jwarshaw/RaspberryDrive
--- +++ @@ -0,0 +1,48 @@ +# Import image library necessary for file +import SimpleCV +import sys +from SimpleCV import Image + +def check_image(image_path): + #Find file by path and import. File currently resides in same directory. + image = Image(image_path) + # grey = image.grayscale() + + instruction = "go" + a...
7cd93733913d4f221afed7c437f5e6ce9c0d8986
test/run_tests.py
test/run_tests.py
#!/usr/bin/python from common import * from test_cpu_collector import * from test_disk import * from test_disk_space_collector import * from test_disk_usage_collector import * from test_filestat_collector import * from test_load_average_collector import * from test_memory_collector import * from test_network_collecto...
Add a way to run all the tests at once
Add a way to run all the tests at once
Python
mit
mfriedenhagen/Diamond,MediaMath/Diamond,skbkontur/Diamond,rtoma/Diamond,zoidbergwill/Diamond,disqus/Diamond,jriguera/Diamond,hamelg/Diamond,szibis/Diamond,skbkontur/Diamond,rtoma/Diamond,bmhatfield/Diamond,hamelg/Diamond,tusharmakkar08/Diamond,datafiniti/Diamond,MichaelDoyle/Diamond,timchenxiaoyu/Diamond,TAKEALOT/Diamo...
--- +++ @@ -0,0 +1,20 @@ +#!/usr/bin/python + +from common import * + +from test_cpu_collector import * +from test_disk import * +from test_disk_space_collector import * +from test_disk_usage_collector import * +from test_filestat_collector import * +from test_load_average_collector import * +from test_memory_collect...
6eedc6c949a4c9abfe2cbe72370788f3955daa8e
scripts/set_turbines.py
scripts/set_turbines.py
#!/usr/bin/env python """ Generate fvOptions and topoSetDict for turbines """ from __future__ import division, print_function import numpy as np import os import sys import argparse def make_fvOptions(args): """Create `fvOptions` for turbines from template.""" print("Generating fvOptions with:") for k, v ...
Add script to set fvOptions
Add script to set fvOptions
Python
mit
petebachant/NTNU-HAWT-turbinesFoam,petebachant/NTNU-HAWT-turbinesFoam,petebachant/NTNU-HAWT-turbinesFoam
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env python +""" +Generate fvOptions and topoSetDict for turbines +""" +from __future__ import division, print_function +import numpy as np +import os +import sys +import argparse + + +def make_fvOptions(args): + """Create `fvOptions` for turbines from template.""" + print("G...
917a5e4385d7ec58fe6e867d581bfde0a8cfe174
tools/pip-scan.py
tools/pip-scan.py
import os import sys import re possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)) if os.path.exists(os.path.join(possible_topdir, 'anvil', ...
Add a pip scanning tool that can compare whats in a distro yaml against what source pip/test-requires may desire
Add a pip scanning tool that can compare whats in a distro yaml against what source pip/test-requires may desire
Python
apache-2.0
stackforge/anvil,mc2014/anvil,mc2014/anvil,stackforge/anvil
--- +++ @@ -0,0 +1,69 @@ +import os +import sys +import re + +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), + os.pardir, + os.pardir)) + +if os.path.exists(os.path.join(possible_topdir, + ...
dd296e1de08e512d5f308736e9f5767c7034d457
support/compute-powers.py
support/compute-powers.py
#!/usr/bin/env python # Compute 10 ** exp with exp in the range [min_exponent, max_exponent] and print # normalized (with most-significant bit equal to 1) significands in hexadecimal. from __future__ import print_function min_exponent = -348 max_exponent = 340 step = 8 significand_size = 64 for exp in range(min_expon...
Add a script to compute powers of 10
Add a script to compute powers of 10
Python
bsd-2-clause
alabuzhev/fmt,alabuzhev/fmt,alabuzhev/fmt,cppformat/cppformat,cppformat/cppformat,cppformat/cppformat
--- +++ @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# Compute 10 ** exp with exp in the range [min_exponent, max_exponent] and print +# normalized (with most-significant bit equal to 1) significands in hexadecimal. + +from __future__ import print_function + +min_exponent = -348 +max_exponent = 340 +step = 8 +significand...
02b661fda99e5fb44f07fd139f138b2534454b2e
tests/test_sorting_and_searching/test_counting_sort.py
tests/test_sorting_and_searching/test_counting_sort.py
import unittest from aids.sorting_and_searching.counting_sort import counting_sort class CountingSortTestCase(unittest.TestCase): ''' Unit tests for counting sort ''' def setUp(self): self.example = [4,3,2,1,4,3,2,4,3,4] def test_selection_sort(self): self.assertEqual(counting_s...
Add unit tests for counting sort
Add unit tests for counting sort
Python
mit
ueg1990/aids
--- +++ @@ -0,0 +1,21 @@ +import unittest + +from aids.sorting_and_searching.counting_sort import counting_sort + +class CountingSortTestCase(unittest.TestCase): + ''' + Unit tests for counting sort + + ''' + + def setUp(self): + self.example = [4,3,2,1,4,3,2,4,3,4] + + def test_selection_sort(s...
1b639f98af0070e9b5ba0bc12d536be22a219402
chrome/PRESUBMIT.py
chrome/PRESUBMIT.py
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Makes sure that the chrome/ code is cpplint clean.""" INCLUDE_CPP_FILES_ONLY = ( r'.*\.cc$', r'.*\.h$' ) EXCLUDE = ( # Objective C confuses ever...
Call the new presubmit checks from chrome/ code, with a blacklist.
Call the new presubmit checks from chrome/ code, with a blacklist. Review URL: http://codereview.chromium.org/400014 git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@32190 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Python
bsd-3-clause
wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser
--- +++ @@ -0,0 +1,51 @@ +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Makes sure that the chrome/ code is cpplint clean.""" + +INCLUDE_CPP_FILES_ONLY = ( + r'.*\.cc$', r'.*\.h$' +) + +EXC...
de0cd54000878638ea88a48b4c8b7dcc6ecfe04d
pySDC/projects/PinTSimE/switch_estimator.py
pySDC/projects/PinTSimE/switch_estimator.py
import numpy as np import scipy as sp from pySDC.core.ConvergenceController import ConvergenceController from pySDC.core.Lagrange import LagrangeApproximation class SwitchEstimator(ConvergenceController): """ Method to estimate a discrete event (switch) """ def setup(self, controller, params, de...
Change interpolation using TL's LagrangeApproximation
Change interpolation using TL's LagrangeApproximation
Python
bsd-2-clause
Parallel-in-Time/pySDC,Parallel-in-Time/pySDC
--- +++ @@ -0,0 +1,60 @@ +import numpy as np +import scipy as sp + +from pySDC.core.ConvergenceController import ConvergenceController +from pySDC.core.Lagrange import LagrangeApproximation + + +class SwitchEstimator(ConvergenceController): + """ + Method to estimate a discrete event (switch) + """ + + ...
09647b8726e95c84cee4ed4e35e14c514b145577
Utils/py/BallDetection/Evaluation/evaluate_image_log.py
Utils/py/BallDetection/Evaluation/evaluate_image_log.py
import os import cppyy def get_naoth_dir(): script_path = os.path.abspath(__file__) return os.path.abspath(os.path.join(script_path, "../../../../../")) def init_simulator(): naoth_dir = get_naoth_dir() # load shared library: all depending libraries should be found automatically cppyy.load_librar...
Add initial code for whole image evaluation script
Add initial code for whole image evaluation script
Python
apache-2.0
BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH
--- +++ @@ -0,0 +1,33 @@ +import os +import cppyy + +def get_naoth_dir(): + script_path = os.path.abspath(__file__) + return os.path.abspath(os.path.join(script_path, "../../../../../")) + +def init_simulator(): + naoth_dir = get_naoth_dir() + + # load shared library: all depending libraries should be fou...
4dc9c81a5a1917310a8fa0da688c1c6c94e746f3
dbconnect.py
dbconnect.py
import os from shutil import copyfile from datetime import datetime from infi.clickhouse_orm import models, fields, engines from infi.clickhouse_orm.database import Database if not os.path.isfile("settings.py"): copyfile("settings.py.example", "settings.py") from settings import (CLICKHOUSEIP, CLICKHOUSEPORT, ...
Add db connector and insert function
Add db connector and insert function
Python
mit
Zloool/manyfaced-honeypot
--- +++ @@ -0,0 +1,56 @@ +import os +from shutil import copyfile +from datetime import datetime + +from infi.clickhouse_orm import models, fields, engines +from infi.clickhouse_orm.database import Database + +if not os.path.isfile("settings.py"): + copyfile("settings.py.example", "settings.py") +from settings impo...
830496bda1f6ba196471ae2b848d756effc2d02b
apps/feedback/migrations/0002_auto_20150429_1759.py
apps/feedback/migrations/0002_auto_20150429_1759.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('feedback', '0001_initial'), ] operations = [ migrations.AlterField( model_name='ratinganswer', name=...
Add auto migration for responsive images
Add auto migration for responsive images
Python
mit
dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('feedback', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + mo...
a48c6a0edaa4b64cb0f93ab5c95f635318b8fc72
iotendpoints/endpoints/plugins/platecamera.py
iotendpoints/endpoints/plugins/platecamera.py
""" PLATECAMERA endpoint. You must declare environment variable PLATECAMERA_URL to activate this plugin. If you are running development server (`python manage.py runserver`), you can `export PLATECAMERA_URL=path_without_leading_slash` before starting runserver. If you use supervisord to keep gunicorn or similar runn...
Add register plate camera endpoint placeholder
Add register plate camera endpoint placeholder
Python
mit
aapris/IoT-Web-Experiments
--- +++ @@ -0,0 +1,58 @@ +""" +PLATECAMERA endpoint. + +You must declare environment variable PLATECAMERA_URL to activate this plugin. + +If you are running development server (`python manage.py runserver`), you can +`export PLATECAMERA_URL=path_without_leading_slash` +before starting runserver. + +If you use supervi...
34f032df44ee34779dae7f9876b6ca80a935de55
bedrock/mozorg/models.py
bedrock/mozorg/models.py
from django.core.cache import cache from django.db import models from django.db.utils import DatabaseError from picklefield import PickledObjectField from django_extensions.db.fields import ModificationDateTimeField class TwitterCacheManager(models.Manager): def get_tweets_for(self, account): cache_key =...
from django.core.cache import cache from django.db import models from django.db.utils import DatabaseError from picklefield import PickledObjectField from django_extensions.db.fields import ModificationDateTimeField class TwitterCacheManager(models.Manager): def get_tweets_for(self, account): cache_key =...
Fix a potential error in the TwitterCacheManager.
Fix a potential error in the TwitterCacheManager. This looks like it would fail at some point. Python magic is keeping it going I guess. Referencing the manager instance from the manager class seems bad though.
Python
mpl-2.0
TheoChevalier/bedrock,jacshfr/mozilla-bedrock,gerv/bedrock,dudepare/bedrock,jgmize/bedrock,Jobava/bedrock,glogiotatidis/bedrock,mermi/bedrock,malena/bedrock,schalkneethling/bedrock,jgmize/bedrock,kyoshino/bedrock,CSCI-462-01-2017/bedrock,davehunt/bedrock,TheJJ100100/bedrock,bensternthal/bedrock,malena/bedrock,mermi/bed...
--- +++ @@ -12,7 +12,7 @@ tweets = cache.get(cache_key) if tweets is None: try: - tweets = TwitterCache.objects.get(account=account).tweets + tweets = self.get(account=account).tweets except (TwitterCache.DoesNotExist, DatabaseError): ...
84246e5a9e05b582f822b32789e3a05455556b00
py/testdir_single_jvm/test_rf_VA_simple_example.py
py/testdir_single_jvm/test_rf_VA_simple_example.py
import sys import json sys.path.extend(['.','..','py']) import h2o, h2o_cmd, h2o_import as h2i # # This is intended to be the simplest possible RF example. # Look at sandbox/commands.log for REST API requests to H2O. # print "--------------------------------------------------------------------------------" print "...
Add simple python RF example.
Add simple python RF example.
Python
apache-2.0
h2oai/h2o-2,calvingit21/h2o-2,h2oai/h2o-2,calvingit21/h2o-2,elkingtonmcb/h2o-2,eg-zhang/h2o-2,calvingit21/h2o-2,eg-zhang/h2o-2,vbelakov/h2o,100star/h2o,rowhit/h2o-2,100star/h2o,eg-zhang/h2o-2,111t8e/h2o-2,h2oai/h2o,elkingtonmcb/h2o-2,111t8e/h2o-2,rowhit/h2o-2,111t8e/h2o-2,100star/h2o,100star/h2o,elkingtonmcb/h2o-2,elki...
--- +++ @@ -0,0 +1,57 @@ +import sys +import json + +sys.path.extend(['.','..','py']) +import h2o, h2o_cmd, h2o_import as h2i + + +# +# This is intended to be the simplest possible RF example. +# Look at sandbox/commands.log for REST API requests to H2O. +# + + +print "------------------------------------------------...
a4369afae529297fd684eafbb75654f2bd27b780
python/check_arch_api.py
python/check_arch_api.py
""" Script to do Arch API sanity checking. This python script can be used to do some sanity checking of either wire to wire connectivity or bel pin wire connectivity. Wire to wire connectivity is tested by supplying a source and destination wire and verifing that a pip exists that connects those wires. Bel pin wire ...
Add simple python file for doing Arch API sanity checks.
Add simple python file for doing Arch API sanity checks. Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com>
Python
isc
YosysHQ/nextpnr,SymbiFlow/nextpnr,YosysHQ/nextpnr,YosysHQ/nextpnr,SymbiFlow/nextpnr,YosysHQ/nextpnr,SymbiFlow/nextpnr,SymbiFlow/nextpnr
--- +++ @@ -0,0 +1,57 @@ +""" Script to do Arch API sanity checking. + +This python script can be used to do some sanity checking of either wire to +wire connectivity or bel pin wire connectivity. + +Wire to wire connectivity is tested by supplying a source and destination wire +and verifing that a pip exists that co...
49da24fcd637735311810ffc531da757bb3f8666
scripts/monitoring/cron-send-node-taints-status.py
scripts/monitoring/cron-send-node-taints-status.py
#!/usr/bin/env python """ Node taints check for OpenShift V3 """ # Adding the ignore because it does not like the naming of the script # to be different than the class name # pylint: disable=invalid-name # pylint: disable=wrong-import-position # pylint: disable=broad-except # pylint: disable=line-too-long import arg...
Add monitor script for taints
Add monitor script for taints
Python
apache-2.0
drewandersonnz/openshift-tools,openshift/openshift-tools,blrm/openshift-tools,drewandersonnz/openshift-tools,blrm/openshift-tools,blrm/openshift-tools,drewandersonnz/openshift-tools,blrm/openshift-tools,openshift/openshift-tools,drewandersonnz/openshift-tools,drewandersonnz/openshift-tools,blrm/openshift-tools,openshif...
--- +++ @@ -0,0 +1,83 @@ +#!/usr/bin/env python +""" Node taints check for OpenShift V3 """ + +# Adding the ignore because it does not like the naming of the script +# to be different than the class name +# pylint: disable=invalid-name + +# pylint: disable=wrong-import-position +# pylint: disable=broad-except +# pyli...
f263fc11503fd774eff63d8ebd716fe3c2b61218
iatidataquality/users.py
iatidataquality/users.py
# IATI Data Quality, tools for Data QA on IATI-formatted publications # by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith # # Copyright (C) 2013 Publish What You Fund # # This programme is free software; you may redistribute and/or modify # it under the terms of the GNU Affero General Public License v3...
Add basic user management controller
Add basic user management controller
Python
agpl-3.0
pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality
--- +++ @@ -0,0 +1,62 @@ + +# IATI Data Quality, tools for Data QA on IATI-formatted publications +# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith +# +# Copyright (C) 2013 Publish What You Fund +# +# This programme is free software; you may redistribute and/or modify +# it under the terms of the G...
1dab0e7ae96dcf14ee5edfcb88d1af08d327345e
jacquard/experiments/tests/test_specialise_constraints.py
jacquard/experiments/tests/test_specialise_constraints.py
from unittest.mock import Mock from jacquard.cli import main from jacquard.storage import DummyStore DUMMY_DATA_PRE_LAUNCH = { 'experiments/foo': { 'branches': [ {'id': 'bar', 'settings': {'key': 'value'}}, ], 'constraints': { 'era': 'new', }, }, } de...
Add a test that proves that constraints are not specialised
Add a test that proves that constraints are not specialised
Python
mit
prophile/jacquard,prophile/jacquard
--- +++ @@ -0,0 +1,28 @@ +from unittest.mock import Mock + +from jacquard.cli import main +from jacquard.storage import DummyStore + + +DUMMY_DATA_PRE_LAUNCH = { + 'experiments/foo': { + 'branches': [ + {'id': 'bar', 'settings': {'key': 'value'}}, + ], + 'constraints': { + ...
b84c137c131ad309997bd77e47b929cfdcf2eb3c
Week01/Problem03/cyu_03.py
Week01/Problem03/cyu_03.py
#!/usr/bin/env python3 """This script is written by Chuanping Yu, on Jul 24, 2017, for the Assignment#1 in IDEaS workshop""" #Problem 3 I = 3 N = 600851475143 F = [] while I*I <= N: if N%I == 0: N = int(N/I) F.append(I) else: I = I + 1 if N > 1: F.append(N) print(F)
Add Chuanping Yu's solutions to Problem03
Add Chuanping Yu's solutions to Problem03
Python
bsd-3-clause
GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017
--- +++ @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +"""This script is written by Chuanping Yu, on Jul 24, 2017, +for the Assignment#1 in IDEaS workshop""" + +#Problem 3 +I = 3 +N = 600851475143 +F = [] +while I*I <= N: + if N%I == 0: + N = int(N/I) + F.append(I) + else: + I = I + 1 +if N > ...
9f47f2174215eb49f3060669db66c7145e2ee7e5
tests/qtgui/qgraphicsitem_isblocked_test.py
tests/qtgui/qgraphicsitem_isblocked_test.py
#!/usr/bin/python import unittest from PySide import QtGui, QtCore from helper import UsesQApplication class Item(QtGui.QGraphicsItem): def __init__(self): QtGui.QGraphicsItem.__init__(self) def boundingRect(self): return QtCore.QRectF(0, 0, 100, 100) def paint(self, painter, o...
Add unit test for QGraphicsItem.isBlockedByModalPanel()
Add unit test for QGraphicsItem.isBlockedByModalPanel()
Python
lgpl-2.1
gbaty/pyside2,qtproject/pyside-pyside,pankajp/pyside,RobinD42/pyside,enthought/pyside,BadSingleton/pyside2,pankajp/pyside,M4rtinK/pyside-bb10,BadSingleton/pyside2,M4rtinK/pyside-android,PySide/PySide,gbaty/pyside2,RobinD42/pyside,qtproject/pyside-pyside,M4rtinK/pyside-bb10,IronManMark20/pyside2,BadSingleton/pyside2,M4r...
--- +++ @@ -0,0 +1,28 @@ +#!/usr/bin/python + +import unittest + +from PySide import QtGui, QtCore +from helper import UsesQApplication + +class Item(QtGui.QGraphicsItem): + + def __init__(self): + QtGui.QGraphicsItem.__init__(self) + + def boundingRect(self): + return QtCore.QRectF(0, 0, 100,...
348171aa88ff4c7117613491bb98368dd0053778
tests/test_dockerizer/test_docker_images.py
tests/test_dockerizer/test_docker_images.py
import pytest from django.conf import settings from docker_images.image_info import get_image_name, get_image_info, get_tagged_image from factories.factory_build_jobs import BuildJobFactory from tests.utils import BaseTest @pytest.mark.dockerizer_mark class TestDockerImageInfo(BaseTest): def setUp(self): ...
Add docker image info tests
Add docker image info tests
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
--- +++ @@ -0,0 +1,29 @@ +import pytest + +from django.conf import settings + +from docker_images.image_info import get_image_name, get_image_info, get_tagged_image +from factories.factory_build_jobs import BuildJobFactory +from tests.utils import BaseTest + + +@pytest.mark.dockerizer_mark +class TestDockerImageInfo(...
46a88692a4e90ae2fa40a71243c49f0530067bed
thinc/tests/integration/test_roundtrip_bytes.py
thinc/tests/integration/test_roundtrip_bytes.py
from ...neural import Maxout from ...api import chain def test_simple_model_roundtrip_bytes(): model = Maxout(5, 10, pieces=2) model.b += 1 data = model.to_bytes() model.b -= 1 model = model.from_bytes(data) assert model.b[0, 0] == 1 def test_multi_model_roundtrip_bytes(): model = chain(...
Add test for byte serialisation
Add test for byte serialisation
Python
mit
explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc
--- +++ @@ -0,0 +1,35 @@ +from ...neural import Maxout +from ...api import chain + + +def test_simple_model_roundtrip_bytes(): + model = Maxout(5, 10, pieces=2) + model.b += 1 + data = model.to_bytes() + model.b -= 1 + model = model.from_bytes(data) + assert model.b[0, 0] == 1 + + +def test_multi_mo...
871ec80a78ef2caaaea8882e9c2846b064eb7b96
trytond_nereid/tests/__init__.py
trytond_nereid/tests/__init__.py
# -*- coding: utf-8 -*- """ __init__ Nereid Tryton module test cases :copyright: (c) 2011 by Openlabs Technologies & Consulting (P) Limited :license: BSD, see LICENSE for more details. """ from unittest import TestSuite from .configuration import suite as configuration_test_suite from .test_currency ...
Add a consolidated test suite which could be imported by the tryton test suite
Add a consolidated test suite which could be imported by the tryton test suite
Python
bsd-3-clause
fulfilio/nereid,usudaysingh/nereid,prakashpp/nereid,riteshshrv/nereid,riteshshrv/nereid,usudaysingh/nereid,fulfilio/nereid,prakashpp/nereid
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +""" + __init__ + + Nereid Tryton module test cases + + :copyright: (c) 2011 by Openlabs Technologies & Consulting (P) Limited + :license: BSD, see LICENSE for more details. +""" +from unittest import TestSuite + +from .configuration import suite as config...
07ecc937e0dec60fa39f614826b985bb90d3cf77
brukerTitleScanner.py
brukerTitleScanner.py
import glob import sys import os #directory = input("Enter Directory: ") #print("Directory: ", directory) folder = "/home/benno/Dropbox/RESEARCH/bullet/experiments/H2O17atC60/20170510/H2OC60ODCB20170408/" #folder = askdirectory() subdirectories = [x[0] for x in os.walk(folder)] experiments = set() for i in subdi...
Add tool for inspection of bruker directories
Add tool for inspection of bruker directories
Python
mit
bennomeier/pyNMR,kourk0am/pyNMR
--- +++ @@ -0,0 +1,34 @@ +import glob +import sys +import os + +#directory = input("Enter Directory: ") +#print("Directory: ", directory) + + + +folder = "/home/benno/Dropbox/RESEARCH/bullet/experiments/H2O17atC60/20170510/H2OC60ODCB20170408/" +#folder = askdirectory() + +subdirectories = [x[0] for x in os.walk(folde...
bad78ce8eaddb26cf4e9ffc30851ff5e58513f17
scripts/compare_wave_and_flac_reads.py
scripts/compare_wave_and_flac_reads.py
from pathlib import Path import random import time import soundfile as sf DIR_PATH = Path('/Users/harold/Desktop/NFC/FLAC Test') # DIR_PATH = Path('/Volumes/Recordings1/FLAC Test') FILE_NAME_STEM = 'FLOOD-21C_20180901_194500' CLIP_COUNT = 10000 CLIP_DURATION = .6 SAMPLE_RATE = 24000 CLIP_LENGTH = int(round(CLIP_DUR...
Add script that compares WAVE and FLAC reads.
Add script that compares WAVE and FLAC reads.
Python
mit
HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper
--- +++ @@ -0,0 +1,66 @@ +from pathlib import Path +import random +import time + +import soundfile as sf + + +DIR_PATH = Path('/Users/harold/Desktop/NFC/FLAC Test') +# DIR_PATH = Path('/Volumes/Recordings1/FLAC Test') +FILE_NAME_STEM = 'FLOOD-21C_20180901_194500' + +CLIP_COUNT = 10000 +CLIP_DURATION = .6 +SAMPLE_RATE...
c1f888e30651867933ad1e38bebeec2a597ef96d
support/infernal2rfam.py
support/infernal2rfam.py
""" Copyright [2009-2019] EMBL-European Bioinformatics Institute 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 a...
Add script to convert infernal output to full_region
Add script to convert infernal output to full_region
Python
apache-2.0
Rfam/rfam-production,Rfam/rfam-production,Rfam/rfam-production
--- +++ @@ -0,0 +1,40 @@ +""" +Copyright [2009-2019] EMBL-European Bioinformatics Institute +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 +Unle...
2bb893673be54286baec3bf11039ccc636ffe6f4
tests/test_converters.py
tests/test_converters.py
import unittest from werkzeug.routing import ValidationError from app import create_app, db from app.models import Noun, Verb from app.converters import WordClassConverter class TestUtils(unittest.TestCase): def setUp(self): self.app = create_app("testing") self.app_ctx = self.app.app_context() ...
Add test for word class converter
Add test for word class converter
Python
mit
Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary
--- +++ @@ -0,0 +1,25 @@ +import unittest +from werkzeug.routing import ValidationError + +from app import create_app, db +from app.models import Noun, Verb +from app.converters import WordClassConverter + + +class TestUtils(unittest.TestCase): + def setUp(self): + self.app = create_app("testing") + ...
cb9a3e5b17eb0049e0e9318c92b4e37b505df058
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup install_requires = ['Django>=1.5'] try: from collections import OrderedDict except ImportError: install_requires.append('ordereddict>=1.1') setup( name='django-auth-policy', version='0.9.4', zip_safe=False, description='Enforces a couple of...
#!/usr/bin/env python from setuptools import setup, find_packages install_requires = ['Django>=1.5'] try: from collections import OrderedDict except ImportError: install_requires.append('ordereddict>=1.1') setup( name='django-auth-policy', version='0.9.5', zip_safe=False, description='Enforc...
Use find_packages to find migrations and management commands
Use find_packages to find migrations and management commands
Python
bsd-3-clause
mcella/django-auth-policy,mcella/django-auth-policy,Dreamsolution/django-auth-policy,Dreamsolution/django-auth-policy
--- +++ @@ -1,6 +1,6 @@ #!/usr/bin/env python -from setuptools import setup +from setuptools import setup, find_packages install_requires = ['Django>=1.5'] @@ -9,10 +9,9 @@ except ImportError: install_requires.append('ordereddict>=1.1') - setup( name='django-auth-policy', - version='0.9.4', +...
c0b15483dc9f08cd203242e55cadf1101e98f692
helpers/graph_creator.py
helpers/graph_creator.py
import os from alpha_vantage.timeseries import TimesSeries from alpha_vantage.techindicators import TechIndicators import matplotlib.pyplot as plt if __name__ == '__main__': """ Simple script to create the reference pictures """ ts = TimesSeries(key=os.environ['API_KEY'], output_format='pandas') ...
Add helpers for creating images
chore: Add helpers for creating images
Python
mit
RomelTorres/alpha_vantage
--- +++ @@ -0,0 +1,17 @@ +import os +from alpha_vantage.timeseries import TimesSeries +from alpha_vantage.techindicators import TechIndicators +import matplotlib.pyplot as plt + +if __name__ == '__main__': + """ + Simple script to create the reference pictures + """ + ts = TimesSeries(key=os.environ['...
6f1578156f3fea396374a1d833fc8014ca07eaf0
websockets/test_client_server.py
websockets/test_client_server.py
import unittest import tulip from .client import * from .server import * @tulip.coroutine def echo(ws, uri): ws.send((yield from ws.recv())) class ClientServerTests(unittest.TestCase): def setUp(self): self.loop = tulip.new_event_loop() tulip.set_event_loop(self.loop) server_task...
Add basic test for the client and server APIs.
Add basic test for the client and server APIs.
Python
bsd-3-clause
aaugustin/websockets,aaugustin/websockets,biddyweb/websockets,aaugustin/websockets,dommert/pywebsockets,aaugustin/websockets,andrewyoung1991/websockets
--- +++ @@ -0,0 +1,37 @@ +import unittest + +import tulip + +from .client import * +from .server import * + + +@tulip.coroutine +def echo(ws, uri): + ws.send((yield from ws.recv())) + + +class ClientServerTests(unittest.TestCase): + + def setUp(self): + self.loop = tulip.new_event_loop() + tulip.s...
173bc64a3322402a9b06dbba2e618013e1204bc8
tests/test_ghostscript.py
tests/test_ghostscript.py
import subprocess import unittest class GhostscriptTest(unittest.TestCase): def test_installed(self): process = subprocess.Popen( ['gs', '--version'], stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) stdout, stderr = process.com...
Add a test to check that ghostscript is installed.
Add a test to check that ghostscript is installed.
Python
mit
YPlan/treepoem
--- +++ @@ -0,0 +1,18 @@ +import subprocess +import unittest + + +class GhostscriptTest(unittest.TestCase): + + def test_installed(self): + process = subprocess.Popen( + ['gs', '--version'], + stdin=None, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ...
468edaf50f1cbad52a61c5d5cd160de0fa128cbc
tests.py
tests.py
import unittest from app import app class TestScorepy(unittest.TestCase): def setUp(self): self.app = app.test_client() self.app.testing = True def tearDown(self): pass def test_index_response(self): response = self.app.get('/') self.assertEqual(response.status_cod...
Add basic unit test for index status code
Add basic unit test for index status code
Python
mit
rtfoley/scorepy,rtfoley/scorepy,rtfoley/scorepy
--- +++ @@ -0,0 +1,17 @@ +import unittest +from app import app + +class TestScorepy(unittest.TestCase): + def setUp(self): + self.app = app.test_client() + self.app.testing = True + + def tearDown(self): + pass + + def test_index_response(self): + response = self.app.get('/') + ...
5743f3e2a895c913dee0d4ff784970cd5c25a945
tools/perf/perf_tools/pica.py
tools/perf/perf_tools/pica.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os from telemetry.core import util from telemetry.page import page_measurement from telemetry.page import page_set class Pica(page_measurement.PageM...
Add Telemetry measurement for Polymer demo app
Add Telemetry measurement for Polymer demo app This is a rough first version that simply measures time until first full layout. Current timing of ten runs: *RESULT Total: Total= [2828,2292,2477,2454,2491,2463,2515,2501,2484,2595] ms Avg Total: 2510.000000ms Sd Total: 134.763167ms R=tonyg Review URL: https://chrom...
Python
bsd-3-clause
fujunwei/chromium-crosswalk,anirudhSK/chromium,mohamed--abdel-maksoud/chromium.src,anirudhSK/chromium,hgl888/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,patrickm/chromium.src,dushu1203/chromium.src,TheTypoMaster/chromium-crosswalk,dushu1203/chromium.src,ltilve/chromium,M4sse/chromium.src,PeterWangIntel/chr...
--- +++ @@ -0,0 +1,42 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os + +from telemetry.core import util +from telemetry.page import page_measurement +from telemetry.page import page_se...
d7a031b7c701b01f646ea60966f9cab34a076db7
tests/test_ensure_ind.py
tests/test_ensure_ind.py
# -*- coding: utf-8 -*- # The MIT License (MIT) # Copyright (c) 2015-2016 MIT Probabilistic Computing Project # Lead Developer: Feras Saad <fsaad@mit.edu> # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal ...
Add test for ENSURE INDEPENDENT. Depdendent is disabled for now, pending conditional models.
Add test for ENSURE INDEPENDENT. Depdendent is disabled for now, pending conditional models.
Python
apache-2.0
probcomp/cgpm,probcomp/cgpm
--- +++ @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +# The MIT License (MIT) + +# Copyright (c) 2015-2016 MIT Probabilistic Computing Project + +# Lead Developer: Feras Saad <fsaad@mit.edu> + +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentati...
0911e03350962214867918ae8ad16b42ca0cae77
tests/test_repository.py
tests/test_repository.py
# Copyright 2015 Ian Cordasco # # 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, sof...
Add tests for GPG signature handling
Add tests for GPG signature handling This will ideally prevent #137 from regressing.
Python
apache-2.0
pypa/twine,sigmavirus24/twine
--- +++ @@ -0,0 +1,49 @@ +# Copyright 2015 Ian Cordasco +# +# 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 applica...
6970a747a002503e8cefb71f178631e74eb110f2
thinc/neural/tests/unit/Model/test_properties.py
thinc/neural/tests/unit/Model/test_properties.py
import pytest from ....base import Model from ....ops import NumpyOps @pytest.fixture def model(): model = Model(ops=NumpyOps()) return model def test_can_get_describe_params(model): describe_params = list(model.describe_params) def test_cant_set_describe_params(model): with pytest.raises(Attribute...
Add tests for Model properties
Add tests for Model properties
Python
mit
spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc
--- +++ @@ -0,0 +1,36 @@ +import pytest + +from ....base import Model +from ....ops import NumpyOps + + +@pytest.fixture +def model(): + model = Model(ops=NumpyOps()) + return model + +def test_can_get_describe_params(model): + describe_params = list(model.describe_params) + +def test_cant_set_describe_param...
d2341921c16d60de2999a428add3f5bb3cf134fd
tests/functional/test_cli_verify.py
tests/functional/test_cli_verify.py
# Copyright 2014: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
Add functional tests for rally verify
Add functional tests for rally verify Functional tests for: - launch verification for "image" set - launch verification for "smoke" set Change-Id: Ia7073e1ed57fb3efd18800a51289316a922b9d19
Python
apache-2.0
afaheem88/rally,eayunstack/rally,go-bears/rally,gluke77/rally,vefimova/rally,eayunstack/rally,amit0701/rally,paboldin/rally,pandeyop/rally,vganapath/rally,eonpatapon/rally,pyKun/rally,redhat-openstack/rally,openstack/rally,group-policy/rally,amit0701/rally,openstack/rally,yeming233/rally,eonpatapon/rally,openstack/rall...
--- +++ @@ -0,0 +1,50 @@ +# Copyright 2014: Mirantis Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/L...
f78109b5afb8972b2e5b3115e7d892c50f775040
others/HideAndSeek/solve.py
others/HideAndSeek/solve.py
#! /usr/bin/env python # -*- coding: utf-8 -*- from itertools import permutations, chain # Board Empty = 1 Elephant = 2 Lion = 3 Zebra = 5 Gazelle = 7 Rhino = 11 # E L | G L # Z G Z | Z E # R L E | L R G # ------------- # R E Z | # G G | R L # L R | G E Z board = [Elephant, Empty, Lion, Zebra, Gazell...
Add a Python solution for Hide&Seek game
Add a Python solution for Hide&Seek game
Python
cc0-1.0
boltomli/PicatEuler
--- +++ @@ -0,0 +1,91 @@ +#! /usr/bin/env python + +# -*- coding: utf-8 -*- + +from itertools import permutations, chain + +# Board + +Empty = 1 +Elephant = 2 +Lion = 3 +Zebra = 5 +Gazelle = 7 +Rhino = 11 + +# E L | G L +# Z G Z | Z E +# R L E | L R G +# ------------- +# R E Z | +# G G | R L +# L R | G E ...
908e901f7e5b737b5a363b0f817dbf46b45267a0
SessionTools/feature_usage_jsons_shuffler.py
SessionTools/feature_usage_jsons_shuffler.py
# Condenses all the feature files into a single location, # Split by the names of the features import sys from os.path import isfile import os import json path = sys.argv[1] out_path = sys.argv[2] paths = [] i = 0 skipped = 0 pretty_print_json_output = False feature_versions_map = {} known_files = set() def flu...
Add out persistent storage backed shuffler
Add out persistent storage backed shuffler
Python
mit
DynamoDS/Coulomb,DynamoDS/Coulomb,DynamoDS/Coulomb
--- +++ @@ -0,0 +1,96 @@ +# Condenses all the feature files into a single location, +# Split by the names of the features + + +import sys +from os.path import isfile +import os +import json + +path = sys.argv[1] +out_path = sys.argv[2] +paths = [] + +i = 0 +skipped = 0 + +pretty_print_json_output = False + +feature_v...
7f0914167c438b51245e6a55333e5eaa7994b27c
generate_lm_trie.py
generate_lm_trie.py
import pytorch_ctc import json import argparse parser = argparse.ArgumentParser(description='LM Trie Generation') parser.add_argument('--labels', help='path to label json file', default='labels.json') parser.add_argument('--dictionary', help='path to text dictionary (one word per line)', default='vocab.txt') parser.ad...
Add utility script for creating LM trie
Add utility script for creating LM trie
Python
mit
mit456/deepspeech.pytorch,SeanNaren/deepspeech.pytorch
--- +++ @@ -0,0 +1,21 @@ +import pytorch_ctc +import json +import argparse + +parser = argparse.ArgumentParser(description='LM Trie Generation') +parser.add_argument('--labels', help='path to label json file', default='labels.json') +parser.add_argument('--dictionary', help='path to text dictionary (one word per line...
99085b623faa8045d24d3be231fe941f192fbcb2
scripts/elastic_stats.py
scripts/elastic_stats.py
import json def packaged(data): for o in data.values(): for mtype, typemapping in o.items(): props = typemapping['properties'] if 'unknown' not in props: continue unknown = props['unknown']['properties'] def get_fields(): for f...
Make script for parsing elastic mappings and generating statistics
Make script for parsing elastic mappings and generating statistics
Python
apache-2.0
libris/librisxl,libris/librisxl,libris/librisxl
--- +++ @@ -0,0 +1,46 @@ +import json + +def packaged(data): + for o in data.values(): + for mtype, typemapping in o.items(): + props = typemapping['properties'] + if 'unknown' not in props: + continue + unknown = props['unknown']['properties'] + de...