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
b7a78e1b63588412945f24d86b53697eed3fc93d
app/handlers/boot_trigger.py
app/handlers/boot_trigger.py
# 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, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be usefu...
Add stub boot trigger handler.
Add stub boot trigger handler.
Python
lgpl-2.1
kernelci/kernelci-backend,kernelci/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend
--- +++ @@ -0,0 +1,44 @@ +# 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, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed ...
553660f2c67c7d3032b20a937b93262fbbb5e9f5
fastq/split_fastq_files.py
fastq/split_fastq_files.py
""" Split paired end fastq files into different files """ import os import sys import argparse from roblib import stream_fastq, message __author__ = 'Rob Edwards' if __name__ == "__main__": parser = argparse.ArgumentParser(description='Split PE fastq files into multiple files') parser.add_argument('-l', h...
Split some fastq files into smaller files
Split some fastq files into smaller files
Python
mit
linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab
--- +++ @@ -0,0 +1,60 @@ +""" +Split paired end fastq files into different files +""" + +import os +import sys +import argparse +from roblib import stream_fastq, message + +__author__ = 'Rob Edwards' + + + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Split PE fastq files into multi...
aca1f53bc42915e8994c76607c86f486fb314a7a
py/island-perimeter.py
py/island-perimeter.py
class Solution(object): def islandPerimeter(self, grid): """ :type grid: List[List[int]] :rtype: int """ r = len(grid) c = len(grid[0]) perimeter = 0 for i in xrange(r): for j in xrange(c): if grid[i][j] == 1: ...
Add py solution for 463. Island Perimeter
Add py solution for 463. Island Perimeter 463. Island Perimeter: https://leetcode.com/problems/island-perimeter/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,22 @@ +class Solution(object): + def islandPerimeter(self, grid): + """ + :type grid: List[List[int]] + :rtype: int + """ + r = len(grid) + c = len(grid[0]) + perimeter = 0 + for i in xrange(r): + for j in xrange(c): + ...
b1128cd47160ce977bc9c6d90e94cb7a4ca873b5
scripts/grant_board_access.py
scripts/grant_board_access.py
#!/usr/bin/env python """Grant access to a board to a user. :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import click from byceps.services.board import access_control_service, board_service from byceps.services.board.transfer.models import Board from byceps.util.sy...
Add script to grant board access to user
Add script to grant board access to user
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps
--- +++ @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +"""Grant access to a board to a user. + +:Copyright: 2006-2019 Jochen Kupperschmidt +:License: Modified BSD, see LICENSE for details. +""" + +import click + +from byceps.services.board import access_control_service, board_service +from byceps.services.board.transfer....
b7c6b9b2a5b7e5d7d8ebc78c53f156d4c53c7bbf
models/cuberun.py
models/cuberun.py
from keras.models import Sequential from keras.layers import Dense, Activation, Dropout, Flatten from keras.layers import Convolution2D, MaxPooling2D from keras.optimizers import SGD model = Sequential() # conv (64 5x5 kernels, stride size 2x1) # TODO : 1 channel? model.add(Convolution2D(64, 5, 5, input_shape=(1, 128...
Add baseline convolutional neural network model.
Add baseline convolutional neural network model.
Python
mit
johnmartinsson/bird-species-classification,johnmartinsson/bird-species-classification
--- +++ @@ -0,0 +1,39 @@ +from keras.models import Sequential +from keras.layers import Dense, Activation, Dropout, Flatten +from keras.layers import Convolution2D, MaxPooling2D +from keras.optimizers import SGD + +model = Sequential() + +# conv (64 5x5 kernels, stride size 2x1) +# TODO : 1 channel? +model.add(Convol...
3a5a228e25996e2acf39ea1ae5966542f4b27123
eve_neo4j/utils.py
eve_neo4j/utils.py
# -*- coding: utf-8 -*- from copy import copy from datetime import datetime from eve.utils import config def node_to_dict(node): node = dict(node) if config.DATE_CREATED in node: node[config.DATE_CREATED] = datetime.fromtimestamp( node[config.DATE_CREATED]) if config.LAST_UPDATED in n...
Convert nodes to dicts and count results of query
Convert nodes to dicts and count results of query
Python
mit
Grupo-Abraxas/eve-neo4j,Abraxas-Biosystems/eve-neo4j
--- +++ @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from copy import copy +from datetime import datetime +from eve.utils import config + + +def node_to_dict(node): + node = dict(node) + if config.DATE_CREATED in node: + node[config.DATE_CREATED] = datetime.fromtimestamp( + node[config.DATE_CREA...
09311a99d37c8623a644acb30daf8523a5e7a196
django_auth_policy/validators.py
django_auth_policy/validators.py
from django.core.exceptions import ValidationError from django_auth_policy import settings as dap_settings def password_min_length(value): if dap_settings.PASSWORD_MIN_LENGTH_TEXT is None: return if len(value) < dap_settings.PASSWORD_MIN_LENGTH: msg = dap_settings.PASSWORD_MIN_LENGTH_TEXT.fo...
from django.core.exceptions import ValidationError from django.utils.translation import ugettext as _ from django_auth_policy import settings as dap_settings def password_min_length(value): if dap_settings.PASSWORD_MIN_LENGTH_TEXT is None: return if len(value) < dap_settings.PASSWORD_MIN_LENGTH: ...
Fix translatability of validation messages when defined in custom settings
Fix translatability of validation messages when defined in custom settings
Python
bsd-3-clause
mcella/django-auth-policy,mcella/django-auth-policy,Dreamsolution/django-auth-policy,Dreamsolution/django-auth-policy
--- +++ @@ -1,4 +1,5 @@ from django.core.exceptions import ValidationError +from django.utils.translation import ugettext as _ from django_auth_policy import settings as dap_settings @@ -8,7 +9,7 @@ return if len(value) < dap_settings.PASSWORD_MIN_LENGTH: - msg = dap_settings.PASSWORD_MIN...
11ec7ed43fbd5d6dae786f8320d1540080a55d57
tools/secret_key_generator.py
tools/secret_key_generator.py
#!/usr/bin/env python # encoding: utf-8 from hashlib import md5, sha1 from base64 import urlsafe_b64encode as b64encode import random random.seed() def random_string(): """ Generate a random string (currently a random number as a string) """ return str(random.randint(0,100000)) def generate_key(max_l...
#!/usr/bin/env python # encoding: utf-8 import sys from hashlib import md5, sha1 from base64 import urlsafe_b64encode as b64encode import random random.seed() def random_string(): """ Generate a random string (currently a random number as a string) """ return str(random.randint(0,100000)) def generat...
Update script for init seahub_settings.py in Windows
Update script for init seahub_settings.py in Windows
Python
apache-2.0
madflow/seahub,madflow/seahub,miurahr/seahub,cloudcopy/seahub,miurahr/seahub,miurahr/seahub,Chilledheart/seahub,Chilledheart/seahub,miurahr/seahub,madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,Chilledheart/seahub,madflow/seahub,cloudcopy/seahub,cloudcopy/seahub,Chilledheart/seahub,madflow/seahub
--- +++ @@ -1,6 +1,7 @@ #!/usr/bin/env python # encoding: utf-8 +import sys from hashlib import md5, sha1 from base64 import urlsafe_b64encode as b64encode import random @@ -25,4 +26,10 @@ return key[:max_length] if __name__ == "__main__": - print generate_key(40, (random_string(),)) + key = gene...
34b78a3bed13613394b8655b51ec46933cc9746e
py/find_intersection.py
py/find_intersection.py
""" Find the intersection of two sorted arrays. """ def find_intersection(list_a, list_b): """ Assumes that both lists are sorted. """ # Initialize result list intersection = [] # Initialize indecies for list_a and list_b idx_a = 0 idx_b = 0 # Loop while the two indecies are withi...
Add find intersection between two sorted lists
Add find intersection between two sorted lists
Python
mit
tdeh/quickies,tdeh/quickies
--- +++ @@ -0,0 +1,66 @@ +""" +Find the intersection of two sorted arrays. +""" + +def find_intersection(list_a, list_b): + """ + Assumes that both lists are sorted. + """ + # Initialize result list + intersection = [] + + # Initialize indecies for list_a and list_b + idx_a = 0 + idx_b = 0 + +...
5be9df0eece36d4f5ea29447edec309991f443c1
telethon/entity_database.py
telethon/entity_database.py
from . import utils from .tl import TLObject class EntityDatabase: def __init__(self, enabled=True): self.enabled = enabled self._entities = {} # marked_id: user|chat|channel # TODO Allow disabling some extra mappings self._username_id = {} # username: marked_id def add(se...
Add a basic EntityDatabase class
Add a basic EntityDatabase class
Python
mit
LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,expectocode/Telethon,andr-04/Telethon
--- +++ @@ -0,0 +1,75 @@ +from . import utils +from .tl import TLObject + + +class EntityDatabase: + def __init__(self, enabled=True): + self.enabled = enabled + + self._entities = {} # marked_id: user|chat|channel + + # TODO Allow disabling some extra mappings + self._username_id = {}...
75fcb95c04bc56729a1521177ac0e2cb4462bbba
packs/st2/actions/chatops_format_list_result.py
packs/st2/actions/chatops_format_list_result.py
from st2actions.runners.pythonrunner import Action from prettytable import PrettyTable __all__ = [ 'St2ChatOpsFormatListResult' ] class St2ChatOpsFormatListResult(Action): def run(self, result, attributes): table = PrettyTable() if not result: return 'No results.' # Add...
from st2actions.runners.pythonrunner import Action from prettytable import PrettyTable __all__ = [ 'St2ChatOpsFormatListResult' ] class St2ChatOpsFormatListResult(Action): def run(self, result, attributes): table = PrettyTable() if not result: return 'No results.' # Add...
Add support for nested attribute lookup and formatting.
Add support for nested attribute lookup and formatting.
Python
apache-2.0
dennybaa/st2contrib,pearsontechnology/st2contrib,lmEshoo/st2contrib,meirwah/st2contrib,meirwah/st2contrib,tonybaloney/st2contrib,armab/st2contrib,armab/st2contrib,pidah/st2contrib,dennybaa/st2contrib,psychopenguin/st2contrib,digideskio/st2contrib,StackStorm/st2contrib,digideskio/st2contrib,lmEshoo/st2contrib,tonybalone...
--- +++ @@ -17,7 +17,7 @@ # Add headers header = [] for attribute in attributes: - name = attribute.title() + name = self._get_header_attribute_name(attribute=attribute) header.append(name) table.field_names = header @@ -25,10 +25,34 @@ ...
d6daa56be204c6ab481756ea49ac97d89bc4ac3d
test/test_state_machines.py
test/test_state_machines.py
# -*- coding: utf-8 -*- """ test_state_machines ~~~~~~~~~~~~~~~~~~~ These tests validate the state machines directly. Writing meaningful tests for this case can be tricky, so the majority of these tests use Hypothesis to try to talk about general behaviours rather than specific cases """ import h2.connection import h2...
Add Hypothesis-based state machine tests.
Add Hypothesis-based state machine tests.
Python
mit
python-hyper/hyper-h2,vladmunteanu/hyper-h2,Kriechi/hyper-h2,Kriechi/hyper-h2,bhavishyagopesh/hyper-h2,python-hyper/hyper-h2,mhils/hyper-h2,vladmunteanu/hyper-h2
--- +++ @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" +test_state_machines +~~~~~~~~~~~~~~~~~~~ + +These tests validate the state machines directly. Writing meaningful tests for +this case can be tricky, so the majority of these tests use Hypothesis to try +to talk about general behaviours rather than specific cases...
9fafe695e139e512ec9bd4d181ed0151ab5d7265
miniskripts/rescale_mark.py
miniskripts/rescale_mark.py
#!/usr/bin/env python3 """ Calculates rescaled mark using hardcoded intervals Usage example: $ ./rescale_mark.py 50 Your mark should be 65.0 """ import sys if len(sys.argv) != 2: print("Please use your mark as the only argument") sys.exit() else: try: old_mark = int(sys.argv[1]) exce...
Add short script to calculate rescaling of marks
Add short script to calculate rescaling of marks
Python
mit
liviu-/miniskripts,liviu-/miniskripts
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 + +""" +Calculates rescaled mark using hardcoded intervals + +Usage example: + $ ./rescale_mark.py 50 + Your mark should be 65.0 +""" + +import sys + +if len(sys.argv) != 2: + print("Please use your mark as the only argument") + sys.exit() +else: + try: ...
974efc82d723d18790e7b759e643c2352ad13325
content/3.introduction-crawler/download_page.py
content/3.introduction-crawler/download_page.py
import requests def download(method='GET', url=None, tries_num=2, user_agent=None): print('Download:', url) try: headers = {'User-Agent': user_agent} req = requests.request(method=method, url=url, headers=headers) print(req.headers) html = req.text except requests.Timeout a...
Add download page py file.
Add download page py file.
Python
mit
EscapeLife/web_crawler
--- +++ @@ -0,0 +1,23 @@ +import requests + + +def download(method='GET', url=None, tries_num=2, user_agent=None): + print('Download:', url) + try: + headers = {'User-Agent': user_agent} + req = requests.request(method=method, url=url, headers=headers) + print(req.headers) + html = r...
0f43bbb5033e85fdfcd678aba670c1b56582c092
scripts/make_db_ndex.py
scripts/make_db_ndex.py
import glob import pickle from indra.db import get_primary_db from indra.db.util import make_stmts_from_db_list from indra.assemblers import CxAssembler data_path = '/pmc/data/db_ndex' def dump_statement_batch(stmts, fname): print('Dumping into %s' % fname) with open(fname, 'wb') as fh: pickle.dump(s...
Add script to generate DB NDEx network
Add script to generate DB NDEx network
Python
bsd-2-clause
sorgerlab/bioagents,bgyori/bioagents
--- +++ @@ -0,0 +1,41 @@ +import glob +import pickle +from indra.db import get_primary_db +from indra.db.util import make_stmts_from_db_list +from indra.assemblers import CxAssembler + +data_path = '/pmc/data/db_ndex' + + +def dump_statement_batch(stmts, fname): + print('Dumping into %s' % fname) + with open(fn...
17401f8fad648cbe4258f257fdc288b327aed9ab
integration/simple_test_module.py
integration/simple_test_module.py
import sys import argparse import operator import threading import time from jnius import autoclass, cast from TripsModule.trips_module import TripsModule # Declare KQML java classes KQMLPerformative = autoclass('TRIPS.KQML.KQMLPerformative') KQMLList = autoclass('TRIPS.KQML.KQMLList') KQMLObject = autoclass('TRIPS.K...
Add simple test module for integration testing
Add simple test module for integration testing
Python
bsd-2-clause
sorgerlab/bioagents,bgyori/bioagents
--- +++ @@ -0,0 +1,90 @@ +import sys +import argparse +import operator +import threading +import time + +from jnius import autoclass, cast +from TripsModule.trips_module import TripsModule + +# Declare KQML java classes +KQMLPerformative = autoclass('TRIPS.KQML.KQMLPerformative') +KQMLList = autoclass('TRIPS.KQML.KQM...
e56f42b17e96145d5e4ee5238ca16c4fe1d06df5
salt/utils/entrypoints.py
salt/utils/entrypoints.py
import logging import sys import types USE_IMPORTLIB_METADATA_STDLIB = USE_IMPORTLIB_METADATA = USE_PKG_RESOURCES = False if sys.version_info >= (3, 10): # Python 3.10 will include a fix in importlib.metadata which allows us to # get the distribution of a loaded entry-point import importlib.metadata # py...
Add an utility module to load entry-points with whatever lib is available
Add an utility module to load entry-points with whatever lib is available
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,81 @@ +import logging +import sys +import types + +USE_IMPORTLIB_METADATA_STDLIB = USE_IMPORTLIB_METADATA = USE_PKG_RESOURCES = False + +if sys.version_info >= (3, 10): + # Python 3.10 will include a fix in importlib.metadata which allows us to + # get the distribution of a loaded entry-point...
43b46f1e3ded3972dede7226cf0255b904d028bd
django/notejam/pads/tests.py
django/notejam/pads/tests.py
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): """ Tests that 1 + 1 a...
from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase class PadTest(TestCase): def setUp(self): user_data = { 'email': 'user@example.com', 'password': 'secure_password' } user = User.objects.create(...
Test improvementes. Empty Pad test class added.
Django: Test improvementes. Empty Pad test class added.
Python
mit
hstaugaard/notejam,nadavge/notejam,lefloh/notejam,lefloh/notejam,williamn/notejam,hstaugaard/notejam,nadavge/notejam,williamn/notejam,hstaugaard/notejam,hstaugaard/notejam,lefloh/notejam,lefloh/notejam,williamn/notejam,nadavge/notejam,lefloh/notejam,hstaugaard/notejam,williamn/notejam,shikhardb/notejam,williamn/notejam...
--- +++ @@ -1,16 +1,22 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - +from django.contrib.auth.models import User +from django.core.urlresolvers import reverse from djan...
a245a8861eb35af77bb5387a7945f07af8cef017
learntools/computer_vision/ex4.py
learntools/computer_vision/ex4.py
from learntools.core import * import tensorflow as tf class Q1(ThoughtExperiment): _solution = "" class Q2(ThoughtExperiment): _solution = "" class Q3A(ThoughtExperiment): _hint = "" _solution = "" class Q3B(ThoughtExperiment): _hint = "" _solution = "" class Q3C(ThoughtExperiment): ...
Add exercise 4 checking code
Add exercise 4 checking code
Python
apache-2.0
Kaggle/learntools,Kaggle/learntools
--- +++ @@ -0,0 +1,40 @@ +from learntools.core import * +import tensorflow as tf + + +class Q1(ThoughtExperiment): + _solution = "" + + +class Q2(ThoughtExperiment): + _solution = "" + + +class Q3A(ThoughtExperiment): + _hint = "" + _solution = "" + +class Q3B(ThoughtExperiment): + _hint = "" + _sol...
94e1944d160f242ebebe9614395bb795e5074d6d
examples/codepage_tables.py
examples/codepage_tables.py
"""Prints code page tables. """ import six import sys from escpos import printer from escpos.constants import * def main(): dummy = printer.Dummy() dummy.hw('init') for codepage in sys.argv[1:] or ['USA']: dummy.set(height=2, width=2) dummy._raw(codepage+"\n\n\n") print_codepag...
Add script to output codepage tables.
Add script to output codepage tables.
Python
mit
python-escpos/python-escpos,belono/python-escpos,braveheuel/python-escpos
--- +++ @@ -0,0 +1,59 @@ +"""Prints code page tables. +""" + +import six +import sys + +from escpos import printer +from escpos.constants import * + + +def main(): + dummy = printer.Dummy() + + dummy.hw('init') + + for codepage in sys.argv[1:] or ['USA']: + dummy.set(height=2, width=2) + dummy....
eacb6e0ce160e2b29f7be2f50ae05969ec31543d
grovekit/ip_lcd.py
grovekit/ip_lcd.py
#!/usr/bin/env python # # Copyright (c) 2015 Max Vilimpoc # # References: # http://stackoverflow.com/questions/24196932/how-can-i-get-the-ip-address-of-eth0-in-python # https://github.com/intel-iot-devkit/upm/blob/master/examples/python/rgb-lcd.py # Permission is hereby granted, free of charge, to any person obtainin...
Add WiFi IP to LCD
Add WiFi IP to LCD
Python
bsd-2-clause
ktkirk/HSSI,ktkirk/HSSI,ktkirk/HSSI
--- +++ @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# +# Copyright (c) 2015 Max Vilimpoc +# +# References: +# http://stackoverflow.com/questions/24196932/how-can-i-get-the-ip-address-of-eth0-in-python + +# https://github.com/intel-iot-devkit/upm/blob/master/examples/python/rgb-lcd.py + +# Permission is hereby granted, f...
42498b014c2ffcd4a507511aa62c4d49250d2a8c
tests/test_config.py
tests/test_config.py
from time import sleep from tests.base import IntegrationTest, MultipleSourceTest class TestSimpleColorAssigment(IntegrationTest): def configure_global_varialbes(self): super(TestSimpleColorAssigment, self).configure_global_varialbes() self.command('let g:taskwiki_source_tw_colors="yes"') ...
Add test to test automatic color assigment from TW
tests: Add test to test automatic color assigment from TW
Python
mit
Spirotot/taskwiki,phha/taskwiki
--- +++ @@ -0,0 +1,15 @@ +from time import sleep +from tests.base import IntegrationTest, MultipleSourceTest + + +class TestSimpleColorAssigment(IntegrationTest): + + def configure_global_varialbes(self): + super(TestSimpleColorAssigment, self).configure_global_varialbes() + self.command('let g:taskw...
29cc044b50cf0fdc8bfad97f194ea7fa993e08e6
tests/test_worker.py
tests/test_worker.py
from twisted.trial import unittest from ooni.plugoo import work, tests class WorkerTestCase(unittest.TestCase): def testWorkGenerator(self): class DummyTest: assets = {} dummytest = DummyTest() asset = [] for i in range(10): asset.append(i) dummytest...
Write test case for worker
Write test case for worker
Python
bsd-2-clause
kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,hackerberry/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,hackerberry/ooni-p...
--- +++ @@ -0,0 +1,18 @@ +from twisted.trial import unittest + +from ooni.plugoo import work, tests + +class WorkerTestCase(unittest.TestCase): + def testWorkGenerator(self): + class DummyTest: + assets = {} + dummytest = DummyTest() + asset = [] + for i in range(10): + ...
0bb35201c93fb364b6521f8b6ef1693e64034f74
illumstats.py
illumstats.py
import h5py import re import numpy as np from image_toolbox.util import regex_from_format_string class Illumstats: '''Utility class for an illumination correction statistics file. The class provides the mean and standard deviation image, which were precalculated across all images acquired in the same chan...
Add new class for illumination statistics files
Add new class for illumination statistics files
Python
agpl-3.0
TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary
--- +++ @@ -0,0 +1,73 @@ +import h5py +import re +import numpy as np +from image_toolbox.util import regex_from_format_string + + +class Illumstats: + '''Utility class for an illumination correction statistics file. + The class provides the mean and standard deviation image, + which were precalculated across...
2db27459ce1e102038a610e0d432ac5090097d27
hdltools/codegen/__init__.py
hdltools/codegen/__init__.py
"""Code generation primitives.""" import hdltools.verilog.codegen import hdltools.specc.codegen BUILTIN_CODE_GENERATORS = { "verilog": hdltools.verilog.codegen.VerilogCodeGenerator, "specc": hdltools.specc.codegen.SpecCCodeGenerator, }
Add list of builtin codegenerators
Add list of builtin codegenerators
Python
mit
brunosmmm/hdltools,brunosmmm/hdltools
--- +++ @@ -0,0 +1,9 @@ +"""Code generation primitives.""" + +import hdltools.verilog.codegen +import hdltools.specc.codegen + +BUILTIN_CODE_GENERATORS = { + "verilog": hdltools.verilog.codegen.VerilogCodeGenerator, + "specc": hdltools.specc.codegen.SpecCCodeGenerator, +}
ef1d65282771c806f68d717d57172597184db26c
rest_framework/tests/test_urlizer.py
rest_framework/tests/test_urlizer.py
from __future__ import unicode_literals from django.test import TestCase from rest_framework.templatetags.rest_framework import urlize_quoted_links import sys class URLizerTests(TestCase): """ Test if both JSON and YAML URLs are transformed into links well """ def _urlize_dict_check(self, data): ...
Introduce tests for urlize_quoted_links() function
Introduce tests for urlize_quoted_links() function
Python
bsd-2-clause
yiyocx/django-rest-framework,buptlsl/django-rest-framework,arpheno/django-rest-framework,jness/django-rest-framework,kylefox/django-rest-framework,jerryhebert/django-rest-framework,jpadilla/django-rest-framework,justanr/django-rest-framework,abdulhaq-e/django-rest-framework,wwj718/django-rest-framework,wwj718/django-re...
--- +++ @@ -0,0 +1,38 @@ +from __future__ import unicode_literals +from django.test import TestCase +from rest_framework.templatetags.rest_framework import urlize_quoted_links +import sys + + +class URLizerTests(TestCase): + """ + Test if both JSON and YAML URLs are transformed into links well + """ + def...
a24c6c66642060bf948023462a75fbc25ce6bc64
core/migrations/0030_email_flags.py
core/migrations/0030_email_flags.py
# Generated by Django 1.10.5 on 2017-01-07 17:29 from __future__ import unicode_literals import datetime from django.db import migrations from django.utils import timezone def add_timestamps_to_event(event): """ This will: add a thank-you-email-sent timestamp to all events in the past add a sub...
Add a data migration to make sure we don’t send a lot of emails to old events
Add a data migration to make sure we don’t send a lot of emails to old events
Python
bsd-3-clause
patjouk/djangogirls,patjouk/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls,DjangoGirls/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls
--- +++ @@ -0,0 +1,46 @@ +# Generated by Django 1.10.5 on 2017-01-07 17:29 +from __future__ import unicode_literals + +import datetime + +from django.db import migrations +from django.utils import timezone + + +def add_timestamps_to_event(event): + """ This will: + + add a thank-you-email-sent timestamp to ...
9f74ebb88ea2eef623849b4e954f086caea306e3
andalusian/migrations/0006_auto_20190725_1407.py
andalusian/migrations/0006_auto_20190725_1407.py
# Generated by Django 2.2.1 on 2019-07-25 14:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('andalusian', '0005_auto_20190717_1211'), ] operations = [ migrations.AlterField( model_name='form', name='name', ...
Add new andalusian migration file
Add new andalusian migration file
Python
agpl-3.0
MTG/dunya,MTG/dunya,MTG/dunya,MTG/dunya
--- +++ @@ -0,0 +1,58 @@ +# Generated by Django 2.2.1 on 2019-07-25 14:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('andalusian', '0005_auto_20190717_1211'), + ] + + operations = [ + migrations.AlterField( + model_...
ebb0916a7c63c1aaf383c696c203199ca79f70ac
nereid/backend.py
nereid/backend.py
# -*- coding: UTF-8 -*- ''' nereid.backend Backed - Tryton specific features :copyright: (c) 2010-2012 by Openlabs Technologies & Consulting (P) Ltd. :license: GPLv3, see LICENSE for more details ''' class TransactionManager(object): def __init__(self, database_name, user, context=None): ...
# -*- coding: UTF-8 -*- ''' nereid.backend Backed - Tryton specific features :copyright: (c) 2010-2012 by Openlabs Technologies & Consulting (P) Ltd. :license: GPLv3, see LICENSE for more details ''' class TransactionManager(object): def __init__(self, database_name, user, context=None): ...
Change the way transaction is initiated as readonly support was introduced in version 2.4
Change the way transaction is initiated as readonly support was introduced in version 2.4
Python
bsd-3-clause
riteshshrv/nereid,usudaysingh/nereid,usudaysingh/nereid,riteshshrv/nereid,fulfilio/nereid,fulfilio/nereid,prakashpp/nereid,prakashpp/nereid
--- +++ @@ -16,7 +16,10 @@ def __enter__(self): from trytond.transaction import Transaction - Transaction().start(self.database_name, self.user, self.context.copy()) + Transaction().start( + self.database_name, self.user, + readonly=False, context=self.context.copy(...
cc109dee42d9a221ebba9caae8cc5c8b6bba4351
test/test_normalizedString.py
test/test_normalizedString.py
from rdflib import * import unittest class test_normalisedString(unittest.TestCase): def test1(self): lit2 = Literal("\two\nw", datatype=XSD.normalizedString) lit = Literal("\two\nw", datatype=XSD.string) self.assertEqual(lit == lit2, False) def test2(self): lit = Literal("\tBe...
Test cases for normalized string
Test cases for normalized string
Python
bsd-3-clause
RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib
--- +++ @@ -0,0 +1,23 @@ +from rdflib import * +import unittest + +class test_normalisedString(unittest.TestCase): + def test1(self): + lit2 = Literal("\two\nw", datatype=XSD.normalizedString) + lit = Literal("\two\nw", datatype=XSD.string) + self.assertEqual(lit == lit2, False) + + def tes...
fc43f8e71854aee1ac786bdb8555e8eba1510cd1
salt/modules/philips_hue.py
salt/modules/philips_hue.py
# -*- coding: utf-8 -*- ''' Philips HUE lamps module for proxy. ''' from __future__ import absolute_import import sys __virtualname__ = 'hue' __proxyenabled__ = ['philips_hue'] def _proxy(): ''' Get proxy. ''' return __opts__['proxymodule'] def __virtual__(): ''' Start the Philips HUE only...
Implement Philips HUE wrapper caller for Minion Proxy
Implement Philips HUE wrapper caller for Minion Proxy
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +''' +Philips HUE lamps module for proxy. +''' + +from __future__ import absolute_import +import sys + +__virtualname__ = 'hue' +__proxyenabled__ = ['philips_hue'] + + +def _proxy(): + ''' + Get proxy. + ''' + return __opts__['proxymodule'] + + +def __virt...
30672f8800edec0191835303077e93b0110189e2
distributionviewer/api/migrations/0006_on_delete_cascade_dataset.py
distributionviewer/api/migrations/0006_on_delete_cascade_dataset.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.11 on 2016-12-02 19:20 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('api', '0005_dataset_display'), ] operations = [ migrations.RunSQL( [ ...
Add ON DELETE CASCADE to more easily remove bad datasets
Add ON DELETE CASCADE to more easily remove bad datasets
Python
mpl-2.0
openjck/distribution-viewer,openjck/distribution-viewer,openjck/distribution-viewer,openjck/distribution-viewer
--- +++ @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.11 on 2016-12-02 19:20 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0005_dataset_display'), + ] + + operations = [ + ...
9258bdf23f0019826c007cdf63ed956ad178ddbd
app/deparse.py
app/deparse.py
feature_order = ['syllabic', 'stress', 'long', 'consonantal', 'sonorant', 'continuant', 'delayedrelease', 'approximant', 'tap', 'trill', 'nasal', ...
Add segment conversion to feature string
Add segment conversion to feature string
Python
mit
kdelwat/LangEvolve,kdelwat/LangEvolve,kdelwat/LangEvolve
--- +++ @@ -0,0 +1,47 @@ +feature_order = ['syllabic', + 'stress', + 'long', + 'consonantal', + 'sonorant', + 'continuant', + 'delayedrelease', + 'approximant', + 'tap', + 't...
e52a45901e3a062d4b55c0f3050f2bd4b6b4d08c
mies_nwb_viewer.py
mies_nwb_viewer.py
import acq4 from neuroanalysis.nwb_viewer import MiesNwbViewer, MiesNwb acq4.pyqtgraph.dbg() m = acq4.Manager.Manager(argv=['-D', '-n', '-m', 'Data Manager']) dm = m.getModule('Data Manager') v = MiesNwbViewer() v.show() def load_from_dm(): v.set_nwb(MiesNwb(m.currentFile.name())) btn = acq4.pyqtgraph.Qt.QtGui.Q...
Add entry script for mies/acq4 analysis
Add entry script for mies/acq4 analysis
Python
mit
campagnola/neuroanalysis
--- +++ @@ -0,0 +1,15 @@ +import acq4 +from neuroanalysis.nwb_viewer import MiesNwbViewer, MiesNwb +acq4.pyqtgraph.dbg() + +m = acq4.Manager.Manager(argv=['-D', '-n', '-m', 'Data Manager']) +dm = m.getModule('Data Manager') +v = MiesNwbViewer() +v.show() + +def load_from_dm(): + v.set_nwb(MiesNwb(m.currentFile.nam...
80ee01e15ec62b4286b98ecc85c13c398154d7ac
py/redundant-connection.py
py/redundant-connection.py
from collections import defaultdict class Solution(object): def findRedundantConnection(self, edges): """ :type edges: List[List[int]] :rtype: List[int] """ visited = set() parent = dict() neighbors = defaultdict(list) edge_idx = {tuple(sorted(e)): i f...
Add py solution for 684. Redundant Connection
Add py solution for 684. Redundant Connection 684. Redundant Connection: https://leetcode.com/problems/redundant-connection/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,39 @@ +from collections import defaultdict +class Solution(object): + def findRedundantConnection(self, edges): + """ + :type edges: List[List[int]] + :rtype: List[int] + """ + visited = set() + parent = dict() + neighbors = defaultdict(list) + ...
72b3ffe2ca7f735991aca304d42d495484ee3f3d
meshnet/serial/connection.py
meshnet/serial/connection.py
import asyncio import logging from meshnet.serial.messages import SerialMessageConsumer logger = logging.getLogger(__name__) class SerialBuffer(object): def __init__(self): self._buff = bytearray() def put(self, data): self._buff.append(data) def read(self, max_bytes): ret = s...
Add some async protocol handling code
Add some async protocol handling code Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>
Python
bsd-3-clause
janLo/automation_mesh,janLo/automation_mesh,janLo/automation_mesh
--- +++ @@ -0,0 +1,56 @@ +import asyncio + +import logging + +from meshnet.serial.messages import SerialMessageConsumer + +logger = logging.getLogger(__name__) + + +class SerialBuffer(object): + def __init__(self): + self._buff = bytearray() + + def put(self, data): + self._buff.append(data) + + ...
657f9f8c4997b6a9e7021830a229178e0881afba
shoop/notify/migrations/0002_notification_identifier.py
shoop/notify/migrations/0002_notification_identifier.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import shoop.core.fields class Migration(migrations.Migration): dependencies = [ ('shoop_notify', '0001_initial'), ] operations = [ migrations.AlterField( model_name='not...
Add migration to make notification identifier not unique
Notify: Add migration to make notification identifier not unique Refs SHOOP-1282
Python
agpl-3.0
suutari/shoop,shoopio/shoop,shoopio/shoop,shawnadelic/shuup,hrayr-artunyan/shuup,hrayr-artunyan/shuup,suutari/shoop,shawnadelic/shuup,taedori81/shoop,suutari-ai/shoop,jorge-marques/shoop,suutari-ai/shoop,jorge-marques/shoop,suutari/shoop,shawnadelic/shuup,lawzou/shoop,taedori81/shoop,jorge-marques/shoop,lawzou/shoop,sh...
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import shoop.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('shoop_notify', '0001_initial'), + ] + + operations = [ + migratio...
5de41a702f819fca3cea68470912b68dd82b2888
alembic/versions/a3fe8c8a344_associate_groups_wit.py
alembic/versions/a3fe8c8a344_associate_groups_wit.py
"""Associate groups with files. Revision ID: a3fe8c8a344 Revises: 525162a280bd Create Date: 2013-11-05 13:55:04.498181 """ # revision identifiers, used by Alembic. revision = 'a3fe8c8a344' down_revision = '525162a280bd' from alembic import op from collections import defaultdict from sqlalchemy.sql import table, col...
Write migration to associate group users with the group's files.
Write migration to associate group users with the group's files.
Python
bsd-2-clause
ucsb-cs/submit,ucsb-cs/submit,ucsb-cs/submit,ucsb-cs/submit
--- +++ @@ -0,0 +1,73 @@ +"""Associate groups with files. + +Revision ID: a3fe8c8a344 +Revises: 525162a280bd +Create Date: 2013-11-05 13:55:04.498181 + +""" + +# revision identifiers, used by Alembic. +revision = 'a3fe8c8a344' +down_revision = '525162a280bd' + +from alembic import op +from collections import defaultd...
cc57a70be1e5b9da6aca69f4728291214c353469
self-post-stream/stream.py
self-post-stream/stream.py
import praw r = praw.Reddit(user_agent='stream only self posts from a sub by /u/km97') posts = [post for post in r.get_subreddit('all').get_hot(limit=50) if post.is_self] # print(dir(posts[0])) for post in posts: print("Title:", post.title) print("Score: {}, Comments: {}".format(post.score, post.num_comments...
Add praw with post generator for selfposts
Add praw with post generator for selfposts
Python
mit
kshvmdn/reddit-bots
--- +++ @@ -0,0 +1,15 @@ +import praw + +r = praw.Reddit(user_agent='stream only self posts from a sub by /u/km97') +posts = [post for post in r.get_subreddit('all').get_hot(limit=50) if post.is_self] + +# print(dir(posts[0])) + +for post in posts: + print("Title:", post.title) + print("Score: {}, Comments: {}"...
c0f5554e2259055c423098f6f6a83fc99e4d0789
solutions/uri/1015/1015.py
solutions/uri/1015/1015.py
from math import pow, sqrt x1, y1 = map(float, input().split()) x2, y2 = map(float, input().split()) distance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) print(f"{distance:.4f}")
Solve Distance Between Two Points in python
Solve Distance Between Two Points in python
Python
mit
deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr...
--- +++ @@ -0,0 +1,8 @@ +from math import pow, sqrt + +x1, y1 = map(float, input().split()) +x2, y2 = map(float, input().split()) + +distance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) + +print(f"{distance:.4f}")
907caa83f4aed45ba31c6aa796e7bcb589521abc
tests/test_docker_stream_adapter.py
tests/test_docker_stream_adapter.py
import unittest from girder_worker.docker.stream_adapter import DockerStreamPushAdapter class CaptureAdapter(object): def __init__(self): self._captured = '' def write(self, data): self._captured += data def captured(self): return self._captured class TestDemultiplexerPushAdapt...
Move docker_stream_adapter tests from plugins/ into modern testsuite
Move docker_stream_adapter tests from plugins/ into modern testsuite
Python
apache-2.0
girder/girder_worker,girder/girder_worker,girder/girder_worker
--- +++ @@ -0,0 +1,69 @@ +import unittest +from girder_worker.docker.stream_adapter import DockerStreamPushAdapter + + +class CaptureAdapter(object): + def __init__(self): + self._captured = '' + + def write(self, data): + self._captured += data + + def captured(self): + return self._cap...
733d0ed4b39c2632129d7604474995badfe0321d
solutions/uri/1025/1025.py
solutions/uri/1025/1025.py
import sys def binary_search(marbles, query): begin = 0 end = len(marbles) - 1 middle = end // 2 while begin <= end: if marbles[middle] < query: begin = middle + 1 middle = (end + begin) // 2 elif marbles[middle] > query or ( middle > 0 and marbles[...
Solve Where is the Marble? in python
Solve Where is the Marble? in python
Python
mit
deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr...
--- +++ @@ -0,0 +1,56 @@ +import sys + + +def binary_search(marbles, query): + begin = 0 + end = len(marbles) - 1 + middle = end // 2 + + while begin <= end: + if marbles[middle] < query: + begin = middle + 1 + middle = (end + begin) // 2 + elif marbles[middle] > query ...
c5852893e3b3dccf94e4c2845d5cb773b07d084f
gtkmvco/tests/container_observation.py
gtkmvco/tests/container_observation.py
# This tests the observation of observables into lists and maps. # This test should be converted to unittest import _importer from gtkmvc import Model, Observer, Observable # ---------------------------------------------------------------------- # An ad-hoc class which has a chaging method 'change' class MyObservabl...
TEST (Still not automatic, to be converted eventually.)
TEST (Still not automatic, to be converted eventually.) Test/example for experimental feature introduced in r283
Python
lgpl-2.1
roboogle/gtkmvc3,roboogle/gtkmvc3
--- +++ @@ -0,0 +1,97 @@ +# This tests the observation of observables into lists and maps. +# This test should be converted to unittest + +import _importer +from gtkmvc import Model, Observer, Observable + + +# ---------------------------------------------------------------------- +# An ad-hoc class which has a chagi...
1759446be100c94bee19bfb0c7e1ea800adbb7c4
node-test.py
node-test.py
#!/usr/bin/python from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium import webdriver driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', DesiredCapabilities.FIREFOX) driver.quit()
Add a simple node testing script in Python
Add a simple node testing script in Python
Python
mit
saikrishna321/selenium-video-node,saikrishna321/selenium-video-node,saikrishna321/selenium-video-node
--- +++ @@ -0,0 +1,8 @@ +#!/usr/bin/python + +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities +from selenium import webdriver + +driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', DesiredCapabilities.FIREFOX) + +driver.quit()
d666e4f79e6646dc2f084a61b70c6cee3bf90d13
tests/health_checks/test_per_gene_AND_ld_snp.py
tests/health_checks/test_per_gene_AND_ld_snp.py
# ------------------------------------------------ # built-ins import unittest # local from .base import TestPostgapBase # ------------------------------------------------ class TestPostgapPerGeneANDLdSnp(TestPostgapBase): def setUp(self): self.per_gene_and_ld_snp = self.pg.groupby(['gene_id', 'ld_snp_rs...
Add tests for gene and ld snp pairs
Add tests for gene and ld snp pairs
Python
apache-2.0
Ensembl/cttv024,Ensembl/cttv024
--- +++ @@ -0,0 +1,56 @@ +# ------------------------------------------------ +# built-ins +import unittest + +# local +from .base import TestPostgapBase +# ------------------------------------------------ + +class TestPostgapPerGeneANDLdSnp(TestPostgapBase): + + def setUp(self): + self.per_gene_and_ld_snp =...
52e4e2d7511b672ee022fe62ea726fbf2511185f
src/testing/drawVtkObject.py
src/testing/drawVtkObject.py
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException import unittest, time, re class DrawTest(unittest.TestCase): def setUp(self): ...
Add simple selenium test for vtkObject.
Add simple selenium test for vtkObject.
Python
apache-2.0
OpenGeoscience/vgl,OpenGeoscience/vgl,OpenGeoscience/vgl,OpenGeoscience/vgl
--- +++ @@ -0,0 +1,48 @@ +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.support.ui import Select +from selenium.common.exceptions import NoSuchElementException +import unittest, time, re + +class DrawTest(unittest....
8aedd861032d0bf73c5ea397b73827398d278dda
tests/test_equivalency.py
tests/test_equivalency.py
import numpy as np import pytest from hypothesis import given # To test the equivalence of code to check if it does the same thing: def test_convolution_indexing(): """ To test equivalence of code to repalce for speed""" wav_extended = np.arange(100, 200) flux_extended = np.random.random(size=wav_extende...
Test mask resulted in the same value as comprehension list
Test mask resulted in the same value as comprehension list Former-commit-id: f1e3c2e5a3ddeab54e47746398620c57931170d6
Python
mit
jason-neal/eniric,jason-neal/eniric
--- +++ @@ -0,0 +1,32 @@ + +import numpy as np +import pytest +from hypothesis import given +# To test the equivalence of code to check if it does the same thing: + + +def test_convolution_indexing(): + """ To test equivalence of code to repalce for speed""" + wav_extended = np.arange(100, 200) + flux_extend...
0ae8934d4d1e1a6e57c73eebd85ede01326e8ca1
scripts/run_on_swarming_bots/apt-full-upgrade.py
scripts/run_on_swarming_bots/apt-full-upgrade.py
#!/usr/bin/env python # # Copyright 2017 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Upgrade a bot via apt-get, then reboot. Aborts on error.""" import subprocess # Copied from # https://skia.googlesource.com/buildbot/+/d864d83d992f2968cf4d...
Add script to upgrade Debian/Ubuntu bots.
Add script to upgrade Debian/Ubuntu bots. Bug: skia:6890 Change-Id: I30eea5d64c502ac7ef51cf2d8f6ef3c583e60b3e Reviewed-on: https://skia-review.googlesource.com/28840 Commit-Queue: Ben Wagner <3ef7217be91069877d94f7907ce5479000772cd3@google.com> Reviewed-by: Eric Boren <0e499112533c8544f0505ea0d08394fb5ad7d8fa@google.c...
Python
bsd-3-clause
google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot
--- +++ @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Upgrade a bot via apt-get, then reboot. Aborts on error.""" + + +import subprocess + +# Copied from +# https://skia.google...
eda1d37c697956c92cf930c640a9d8d1a382bea5
tests/matchers/test_contain.py
tests/matchers/test_contain.py
import unittest from robber import expect from robber.matchers.contain import Contain class TestAbove(unittest.TestCase): def test_matches(self): expect(Contain({'key': 'value'}, 'key').matches()) == True expect(Contain({1, 2, 3}, 1).matches()) == True expect(Contain([1, 2, 3], 2).matches()...
Add tests for 'contain' matcher
Add tests for 'contain' matcher
Python
mit
vesln/robber.py,taoenator/robber.py
--- +++ @@ -0,0 +1,22 @@ +import unittest +from robber import expect +from robber.matchers.contain import Contain + +class TestAbove(unittest.TestCase): + def test_matches(self): + expect(Contain({'key': 'value'}, 'key').matches()) == True + expect(Contain({1, 2, 3}, 1).matches()) == True + ex...
b53adea2d02458e20bb165c18c856b6816ab1983
nova/db/sqlalchemy/migrate_repo/versions/234_add_expire_reservations_index.py
nova/db/sqlalchemy/migrate_repo/versions/234_add_expire_reservations_index.py
# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
Add expire reservations in backport position.
Add expire reservations in backport position. Change-Id: If0e58da50ebe9b50b414737a9bd81d93752506e2 Related-bug: #1348720 (cherry picked from commit f4454f4c6962dd2c57c08dc7fecfcdebe7924e3b)
Python
apache-2.0
luogangyi/bcec-nova,leilihh/novaha,leilihh/novaha,luogangyi/bcec-nova,leilihh/nova,leilihh/nova
--- +++ @@ -0,0 +1,59 @@ +# 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 requir...
282d6ae5911e4fcf4625a7e82e7024c5dc0722d8
tests/test_simple_persistence.py
tests/test_simple_persistence.py
from __future__ import unicode_literals, division, absolute_import from tests import FlexGetBase class TestSimplePersistence(FlexGetBase): __yaml__ = """ tasks: test: mock: - {title: 'irrelevant'} """ def test_setdefault(self): self.execute_task('test'...
from __future__ import unicode_literals, division, absolute_import from flexget.manager import Session from flexget.utils.simple_persistence import SimplePersistence from tests import FlexGetBase class TestSimplePersistence(FlexGetBase): __yaml__ = """ tasks: test: mock: ...
Add some more tests for simple_persistence
Add some more tests for simple_persistence
Python
mit
cvium/Flexget,OmgOhnoes/Flexget,jawilson/Flexget,patsissons/Flexget,ZefQ/Flexget,tarzasai/Flexget,X-dark/Flexget,qk4l/Flexget,tsnoam/Flexget,Danfocus/Flexget,spencerjanssen/Flexget,crawln45/Flexget,oxc/Flexget,tvcsantos/Flexget,Flexget/Flexget,tarzasai/Flexget,tobinjt/Flexget,qvazzler/Flexget,Pretagonist/Flexget,Lynxys...
--- +++ @@ -1,4 +1,7 @@ from __future__ import unicode_literals, division, absolute_import + +from flexget.manager import Session +from flexget.utils.simple_persistence import SimplePersistence from tests import FlexGetBase @@ -20,3 +23,20 @@ value2 = task.simple_persistence.setdefault('test', 'def') ...
0c0ae76c33800951e718611a3c5b84518b43589d
repeatWordAThousandTimes.py
repeatWordAThousandTimes.py
#!/usr/bin/env python def main(): word = raw_input("Say a word and I will repeat it a thousand times: ").strip() if (word.count(" ") > 0): print "More than one word!! Please try again." main() return print " ".join([word for x in range(0, 100)]) main()
Add repeat a word a thousand times exercise
Add repeat a word a thousand times exercise
Python
apache-2.0
MindCookin/python-exercises
--- +++ @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +def main(): + word = raw_input("Say a word and I will repeat it a thousand times: ").strip() + + if (word.count(" ") > 0): + print "More than one word!! Please try again." + main() + return + + print " ".join([word for x in range(0, 100)]) + +main()
3b35b313fad8e1faf3a2eaa3ca03f64eb31ed421
web/management/commands/fixcardsfamily.py
web/management/commands/fixcardsfamily.py
from django.core.management.base import BaseCommand, CommandError from web import models class Command(BaseCommand): can_import_settings = True def handle(self, *args, **options): cards = models.Card.objects.filter(parent__isnull=False) for card in cards: card.rarity = card.parent....
Duplicate info in parent and children
Duplicate info in parent and children
Python
apache-2.0
SchoolIdolTomodachi/frgl,SchoolIdolTomodachi/frgl,SchoolIdolTomodachi/frgl
--- +++ @@ -0,0 +1,14 @@ +from django.core.management.base import BaseCommand, CommandError +from web import models + +class Command(BaseCommand): + can_import_settings = True + + def handle(self, *args, **options): + cards = models.Card.objects.filter(parent__isnull=False) + for card in cards: + ...
a1e7a7cff8ee6d15dac1dee67a5ea5bd932252de
nemubot/message/printer/test_socket.py
nemubot/message/printer/test_socket.py
# Nemubot is a smart and modulable IM bot. # Copyright (C) 2012-2015 Mercier Pierre-Olivier # # 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, either version 3 of the License, or # (at yo...
Add test for socket printer
Add test for socket printer
Python
agpl-3.0
nemunaire/nemubot,nbr23/nemubot
--- +++ @@ -0,0 +1,86 @@ +# Nemubot is a smart and modulable IM bot. +# Copyright (C) 2012-2015 Mercier Pierre-Olivier +# +# 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, either vers...
abd359086c9ad99becfe1f61c8e22212c76bcc58
teuthology/test/test_repo_utils.py
teuthology/test/test_repo_utils.py
import logging import os.path from pytest import raises import shutil from .. import repo_utils repo_utils.log.setLevel(logging.WARNING) class TestRepoUtils(object): empty_repo = 'https://github.com/ceph/empty' local_dir = '/tmp/empty' def setup(self): assert not os.path.exists(self.local_dir) ...
Add unit tests for repo_utils
Add unit tests for repo_utils Signed-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com>
Python
mit
robbat2/teuthology,robbat2/teuthology,caibo2014/teuthology,tchaikov/teuthology,ktdreyer/teuthology,t-miyamae/teuthology,tchaikov/teuthology,SUSE/teuthology,zhouyuan/teuthology,yghannam/teuthology,dreamhost/teuthology,michaelsevilla/teuthology,ivotron/teuthology,ceph/teuthology,ivotron/teuthology,ktdreyer/teuthology,dre...
--- +++ @@ -0,0 +1,49 @@ +import logging +import os.path +from pytest import raises +import shutil + +from .. import repo_utils +repo_utils.log.setLevel(logging.WARNING) + + +class TestRepoUtils(object): + empty_repo = 'https://github.com/ceph/empty' + local_dir = '/tmp/empty' + + def setup(self): + a...
7143075a6150134bb61655ca9bef8b9a4092eeab
tests/test_skip_comments.py
tests/test_skip_comments.py
# import pytest from nodev.specs.generic import FlatContainer # # possible evolution of a ``skip_comments`` function # def skip_comments_v0(stream): return [line.partition('#')[0] for line in stream] def skip_comments_v1(stream): for line in stream: yield line.partition('#')[0] def skip_comments_...
Add the nodev.specs example code.
Add the nodev.specs example code.
Python
mit
nodev-io/nodev-starter-kit,nodev-io/nodev-tutorial,nodev-io/nodev-starter-kit
--- +++ @@ -0,0 +1,51 @@ + +# import pytest + +from nodev.specs.generic import FlatContainer + +# +# possible evolution of a ``skip_comments`` function +# +def skip_comments_v0(stream): + return [line.partition('#')[0] for line in stream] + + +def skip_comments_v1(stream): + for line in stream: + yield l...
85340b0453fff6b78a0f8c5aec98eaf359ce0b09
tests/test_uploader.py
tests/test_uploader.py
"""Tests for the uploader module""" from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from os.path import join from datapackage import DataPackage ...
Add a test for the payload generator of the Uploader class.
Add a test for the payload generator of the Uploader class.
Python
mit
openspending/gobble
--- +++ @@ -0,0 +1,37 @@ +"""Tests for the uploader module""" +from __future__ import unicode_literals +from __future__ import print_function +from __future__ import division +from __future__ import absolute_import + +from future import standard_library + +standard_library.install_aliases() + +from os.path import joi...
1f55c424c96dd06f21762bbe730bb4302e954539
tracking-id-injector.py
tracking-id-injector.py
#!/usr/bin/python import sys if len(sys.argv) < 3: print('usage: python {} input_filename output_filename'.format(sys.argv[0])) exit(1) with open(sys.argv[1], 'r') as infile: with open(sys.argv[2], 'w') as outfile: outfile.write(infile.read())
Copy input without modification to begin with
Copy input without modification to begin with
Python
apache-2.0
msufa/tracking-id-injector,msufa/tracking-id-injector
--- +++ @@ -0,0 +1,11 @@ +#!/usr/bin/python + +import sys + +if len(sys.argv) < 3: + print('usage: python {} input_filename output_filename'.format(sys.argv[0])) + exit(1) + +with open(sys.argv[1], 'r') as infile: + with open(sys.argv[2], 'w') as outfile: + outfile.write(infile.read())
c01a771e577994bffcbe79f84195f2ea35470c97
benchmarks/bench_gameoflife.py
benchmarks/bench_gameoflife.py
""" Benchmark a game of life implementation. """ import numpy as np from numba import jit @jit(nopython=True) def wrap(k, max_k): if k == -1: return max_k - 1 elif k == max_k: return 0 else: return k @jit(nopython=True) def increment_neighbors(i, j, neighbors): ni, nj = neig...
Add a game of life benchmark
Add a game of life benchmark
Python
bsd-2-clause
gmarkall/numba-benchmark,numba/numba-benchmark
--- +++ @@ -0,0 +1,61 @@ +""" +Benchmark a game of life implementation. +""" + +import numpy as np + +from numba import jit + + +@jit(nopython=True) +def wrap(k, max_k): + if k == -1: + return max_k - 1 + elif k == max_k: + return 0 + else: + return k + +@jit(nopython=True) +def incremen...
7334de5358ba1efb942c6f7725114ddddd52af83
apps/polls/migrations/0002_auto_20170503_1524.py
apps/polls/migrations/0002_auto_20170503_1524.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('meinberlin_polls', '0001_initial'), ] operations = [ migrations.AlterUniqueTogether( name='vote', un...
Remove falsy unique together constraint
Remove falsy unique together constraint
Python
agpl-3.0
liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin
--- +++ @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('meinberlin_polls', '0001_initial'), + ] + + operations = [ + migrations.AlterUniqueTogether...
04d19c4a97836f725d602896aa00a08040660e72
python/format_string_precedence.py
python/format_string_precedence.py
#!/usr/bin/env python """Format string precedence""" class Foo(object): def __str__(self): return "i am a __str__" def __repr__(self): return "representation of F" def __format__(self, str_): # wtf is this argument? return "serious formatting brah %s" % str_ def foo(sel...
Create python example on formatting string
Create python example on formatting string
Python
mit
brycepg/how-to
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +"""Format string precedence""" + +class Foo(object): + def __str__(self): + return "i am a __str__" + def __repr__(self): + return "representation of F" + def __format__(self, str_): + # wtf is this argument? + return "serious for...
e3d9a92ac816b3406033d30d29eecf4c606e1e54
update_snapshot_version.py
update_snapshot_version.py
from sys import argv from tempfile import mkstemp from shutil import move from os import remove, close # import os, fileinput services = ["alchemy", "conversation", "dialog", "discovery", \ "document-conversion", "language-translation", "language-translator",\ "natural-language-classifier", "p...
Add script to update snapshot version.
Add script to update snapshot version.
Python
apache-2.0
JoshSharpe/java-sdk,JoshSharpe/java-sdk,JoshSharpe/java-sdk
--- +++ @@ -0,0 +1,43 @@ +from sys import argv +from tempfile import mkstemp +from shutil import move +from os import remove, close +# import os, fileinput + +services = ["alchemy", "conversation", "dialog", "discovery", \ + "document-conversion", "language-translation", "language-translator",\ + ...
86a92e78634ca259daa9f7cc681fd8ffbf67aed6
miso-tables.py
miso-tables.py
""" write MISO summary tables out to tidy format """ from argparse import ArgumentParser import pandas as pd import os import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s %(name)s %(levelname)s %(message)s', datefmt='%m-%d-%y %H:%M:%S') logger = logging.ge...
Make a tidy file of all miso summaries.
Make a tidy file of all miso summaries.
Python
mit
roryk/junkdrawer,roryk/junkdrawer
--- +++ @@ -0,0 +1,40 @@ +""" +write MISO summary tables out to tidy format +""" + +from argparse import ArgumentParser +import pandas as pd +import os +import logging +logging.basicConfig(level=logging.INFO, + format='%(asctime)s %(name)s %(levelname)s %(message)s', + datefmt='%...
10695f2ce7488184f8c0c306cf33e35533708ef4
games/management/commands/populate_popularity.py
games/management/commands/populate_popularity.py
"""Updates the popularity of all games""" from django.core.management.base import BaseCommand from django.db.models import Count from games.models import Game class Command(BaseCommand): """Command to update the popularity""" help = "My shiny new management command." def handle(self, *args, **options): ...
Add command to update popularity of games
Add command to update popularity of games
Python
agpl-3.0
lutris/website,lutris/website,lutris/website,lutris/website
--- +++ @@ -0,0 +1,15 @@ +"""Updates the popularity of all games""" +from django.core.management.base import BaseCommand +from django.db.models import Count + +from games.models import Game + + +class Command(BaseCommand): + """Command to update the popularity""" + help = "My shiny new management command." + + ...
dab3b241552734d6810013f53d55c2fec3e1e512
CodeFights/createDie.py
CodeFights/createDie.py
#!/usr/local/bin/python # Code Fights Create Die Problem import random def createDie(seed, n): class Die(object): pass class Game(object): die = Die(seed, n) return Game.die def main(): tests = [ [37237, 5, 3], [36706, 12, 9], [21498, 10, 10], [2998...
Set up Code Fights create die problem
Set up Code Fights create die problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,38 @@ +#!/usr/local/bin/python +# Code Fights Create Die Problem + +import random + + +def createDie(seed, n): + class Die(object): + pass + + class Game(object): + die = Die(seed, n) + + return Game.die + + +def main(): + tests = [ + [37237, 5, 3], + [36706,...
ca32188cf154ed3f32aeb82ef15d42aee472cc77
tests/test_data_generator.py
tests/test_data_generator.py
from chai import Chai from datetime import datetime from dfaker.data_generator import dfaker class Test_Pump_Settings(Chai): def test_smoke(self): pass #def test_type(self): #start_time = datetime(2015, 1, 1, 0, 0, 0) #zone_name = 'US/Pacific' #pump_name = 'Medtronic' ...
Add test for last commit
Add test for last commit
Python
bsd-2-clause
tidepool-org/dfaker
--- +++ @@ -0,0 +1,17 @@ +from chai import Chai +from datetime import datetime + +from dfaker.data_generator import dfaker + + +class Test_Pump_Settings(Chai): + def test_smoke(self): + pass + #def test_type(self): + #start_time = datetime(2015, 1, 1, 0, 0, 0) + #zone_name = 'US/Pacific' ...
af83fd1f043696f5408c878306d4cc4928af97ba
tests/test_iterable_event.py
tests/test_iterable_event.py
from unittest import TestCase import numpy as np import numpy.testing as npt from nimble import Events class TestClassIterable(TestCase): def setUp(self): conditional_array = np.array([0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1]) condition = (conditional_array > 0) self.events = Events(condition...
Add unit tests for class as iterable
Add unit tests for class as iterable
Python
mit
rwhitt2049/nimble,rwhitt2049/trouve
--- +++ @@ -0,0 +1,32 @@ +from unittest import TestCase + +import numpy as np +import numpy.testing as npt + +from nimble import Events + + +class TestClassIterable(TestCase): + def setUp(self): + conditional_array = np.array([0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1]) + condition = (conditional_array > 0)...
0eb9e9731e8f998abe8364fab25f6da01d57e93a
tests/test_util.py
tests/test_util.py
from lib import util def test_cachedproperty(): class Target: def __init__(self): self.call_count = 0 @util.cachedproperty def prop(self): self.call_count += 1 return self.call_count t = Target() assert t.prop == t.prop == 1 def test_deep_get...
Add unit tests for the methods in util
Add unit tests for the methods in util
Python
mit
bauerj/electrumx,bauerj/electrumx,Groestlcoin/electrumx-grs,shsmith/electrumx,Crowndev/electrumx,erasmospunk/electrumx,Groestlcoin/electrumx-grs,thelazier/electrumx,shsmith/electrumx,thelazier/electrumx,Crowndev/electrumx,erasmospunk/electrumx
--- +++ @@ -0,0 +1,48 @@ +from lib import util + + +def test_cachedproperty(): + class Target: + def __init__(self): + self.call_count = 0 + + @util.cachedproperty + def prop(self): + self.call_count += 1 + return self.call_count + + t = Target() + assert...
461c008ebb5b1c048fc8117ee1730e84ee3d2a93
osf/migrations/0169_merge_20190618_1429.py
osf/migrations/0169_merge_20190618_1429.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-06-18 14:29 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0163_populate_conference_submissions'), ('osf', '0168_merge_20190610_2308'), ] ...
Add merge migration - submissions migrations with develop (guardian).
Add merge migration - submissions migrations with develop (guardian).
Python
apache-2.0
Johnetordoff/osf.io,CenterForOpenScience/osf.io,felliott/osf.io,felliott/osf.io,mfraezz/osf.io,felliott/osf.io,cslzchen/osf.io,mfraezz/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,cslzchen/osf.io,mattclark/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,adlius/osf.io,baylee-d/osf.io,mfraezz/osf.io,baylee-d/osf.io,aaxelb/osf.i...
--- +++ @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2019-06-18 14:29 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('osf', '0163_populate_conference_submissions'), + ('osf...
63a161f596ab166d54e525eaa6185067ea76c891
tornado/test/run_pyversion_tests.py
tornado/test/run_pyversion_tests.py
#!/usr/bin/env python """Runs the tornado test suite with all supported python interpreters.""" import os import subprocess import sys INTERPRETERS = [ "python2.5", "python2.6", "python2.7", "auto2to3", "pypy", ] def exists_on_path(filename): for dir in os.environ["PATH"].split(":"): ...
Add script to run test suite with multiple python versions at once
Add script to run test suite with multiple python versions at once
Python
apache-2.0
djt5019/tornado,fengshao0907/tornado,QuanZag/tornado,bywbilly/tornado,frtmelody/tornado,ovidiucp/tornado,ifduyue/tornado,cyrilMargaria/tornado,liqueur/tornado,allenl203/tornado,gitchs/tornado,AlphaStaxLLC/tornado,zguangyu/tornado,ListFranz/tornado,tornadoweb/tornado,kevinge314gh/tornado,icejoywoo/tornado,0xkag/tornado,...
--- +++ @@ -0,0 +1,36 @@ +#!/usr/bin/env python +"""Runs the tornado test suite with all supported python interpreters.""" + +import os +import subprocess +import sys + +INTERPRETERS = [ + "python2.5", + "python2.6", + "python2.7", + "auto2to3", + "pypy", + ] + +def exists_on_path(filename): + fo...
6cc9f6b7bcb77ca8dc4a0904bf2cafd01d60028b
turbustat/simulator/threeD_pspec.py
turbustat/simulator/threeD_pspec.py
import numpy as np def threeD_pspec(arr): ''' Return a 1D power spectrum from a 3D array. Parameters ---------- arr : `~numpy.ndarray` Three dimensional array. Returns ------- freq_bins : `~numpy.ndarray` Radial frequency bins. ps1D : `~numpy.ndarray` One...
Add 3D power spectrum for comparing with generated fields
Add 3D power spectrum for comparing with generated fields
Python
mit
e-koch/TurbuStat,Astroua/TurbuStat
--- +++ @@ -0,0 +1,52 @@ + +import numpy as np + + +def threeD_pspec(arr): + ''' + Return a 1D power spectrum from a 3D array. + + Parameters + ---------- + arr : `~numpy.ndarray` + Three dimensional array. + + Returns + ------- + freq_bins : `~numpy.ndarray` + Radial frequency b...
04cbabc2ca4d36ea35ec564bd48927dea7919190
virtool/tests/api/test_protected.py
virtool/tests/api/test_protected.py
import pytest parameters = [ ("post", ("/api/viruses", {})), ("patch", ("/api/viruses/foobar", {})), ("delete", ("/api/viruses/foobar",)), ("post", ("/api/viruses/foobar/isolates", {})), ("patch", ("/api/viruses/foobar/isolates/test", {})), ("delete", ("/api/viruses/foobar/isolates/test",)), ...
Use parametrize to test authorization and permissions
Use parametrize to test authorization and permissions
Python
mit
igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool
--- +++ @@ -0,0 +1,57 @@ +import pytest + + +parameters = [ + ("post", ("/api/viruses", {})), + ("patch", ("/api/viruses/foobar", {})), + ("delete", ("/api/viruses/foobar",)), + ("post", ("/api/viruses/foobar/isolates", {})), + ("patch", ("/api/viruses/foobar/isolates/test", {})), + ("delete", ("/ap...
1f141791c31525d16d5281790612d7e8f162f394
app/tests/test_models.py
app/tests/test_models.py
import pytest from app.models import Submission, Comment MOCK_SUBMISSION = { 'permalink': (u'https://www.reddit.com/r/fake/comments' u'/000000/submission_title/' ), 'score': 100, 'author': u'fakeuser1', 'num_comments': 500, 'downs': 0, 'title': u'Submission...
Add test for Submission model
Add test for Submission model
Python
mit
PsyBorgs/redditanalyser,PsyBorgs/redditanalyser
--- +++ @@ -0,0 +1,34 @@ +import pytest + +from app.models import Submission, Comment + + +MOCK_SUBMISSION = { + 'permalink': (u'https://www.reddit.com/r/fake/comments' + u'/000000/submission_title/' + ), + 'score': 100, + 'author': u'fakeuser1', + 'num_comments': 500, + ...
44bd7e7b5932754c83d987af473479568ae62a16
epitran/test/test_malayalam.py
epitran/test/test_malayalam.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest import unicodedata import epitran class TestMalayalamGeneral(unittest.TestCase): def setUp(self): self.epi = epitran.Epitran(u'mal-Mlym') def _assert_trans(self, src, tar): trans = self.epi.transliterate(src) ...
Add test cases for Malayalam transliteration
Add test cases for Malayalam transliteration
Python
mit
dmort27/epitran,dmort27/epitran
--- +++ @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals + +import unittest +import unicodedata + +import epitran + + +class TestMalayalamGeneral(unittest.TestCase): + def setUp(self): + self.epi = epitran.Epitran(u'mal-Mlym') + + def _assert_trans(self, src, tar): + ...
a8aef6de4876cceb53da1335ada9163eaa184c6e
plugins/plugin_secure_check.py
plugins/plugin_secure_check.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import sys sys.path.insert(0, "..") import re from libs.manager import Plugin from libs.mail import send_mail class SecureCheck(Plugin): def __init__(self, **kwargs): self.keywords = ['secure', 'check'] self.result = {} def __process_doc(self, **...
Add example plugin for parser secure logs
Add example plugin for parser secure logs
Python
apache-2.0
keepzero/fluent-mongo-parser
--- +++ @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +import sys +sys.path.insert(0, "..") +import re + +from libs.manager import Plugin +from libs.mail import send_mail + +class SecureCheck(Plugin): + + def __init__(self, **kwargs): + self.keywords = ['secure', 'check'] + self.r...
fe79933c028d55a6ad2d8f203d33c9ca7939afbe
py/total-hamming-distance.py
py/total-hamming-distance.py
from collections import Counter class Solution(object): def totalHammingDistance(self, nums): """ :type nums: List[int] :rtype: int """ c = Counter() for n in nums: for i in xrange(n.bit_length()): if n & (1 << i): c[i] ...
Add py solution for 477. Total Hamming Distance
Add py solution for 477. Total Hamming Distance 477. Total Hamming Distance: https://leetcode.com/problems/total-hamming-distance/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,17 @@ +from collections import Counter +class Solution(object): + def totalHammingDistance(self, nums): + """ + :type nums: List[int] + :rtype: int + """ + c = Counter() + for n in nums: + for i in xrange(n.bit_length()): + if n...
ff36ab7972220940a8e4d5396b591cd02c045380
south/signals.py
south/signals.py
""" South-specific signals """ from django.dispatch import Signal from django.conf import settings # Sent at the start of the migration of an app pre_migrate = Signal(providing_args=["app"]) # Sent after each successful migration of an app post_migrate = Signal(providing_args=["app"]) # Sent after each run of a par...
""" South-specific signals """ from django.dispatch import Signal from django.conf import settings # Sent at the start of the migration of an app pre_migrate = Signal(providing_args=["app"]) # Sent after each successful migration of an app post_migrate = Signal(providing_args=["app"]) # Sent after each run of a par...
Remove the auth contenttypes thing for now, needs improvement
Remove the auth contenttypes thing for now, needs improvement
Python
apache-2.0
RaD/django-south,philipn/django-south,philipn/django-south,RaD/django-south,nimnull/django-south,RaD/django-south,nimnull/django-south
--- +++ @@ -15,9 +15,10 @@ ran_migration = Signal(providing_args=["app","migration","method"]) # Compatibility code for django.contrib.auth -if 'django.contrib.auth' in settings.INSTALLED_APPS: - def create_permissions_compat(app, **kwargs): - from django.db.models import get_app - from django.co...
874794156b60caef3d6b944835ef11671b9b8c86
benchmarks/bench_sets.py
benchmarks/bench_sets.py
""" Benchmark various operations on sets. """ from __future__ import division import numpy as np from numba import jit # Set benchmarks # Notes: # - unless we want to benchmark marshalling a set or list back to Python, # we return a single value to avoid conversion costs @jit(nopython=True) def unique(seq): ...
Add a couple set benchmarks
Add a couple set benchmarks
Python
bsd-2-clause
numba/numba-benchmark
--- +++ @@ -0,0 +1,74 @@ +""" +Benchmark various operations on sets. +""" + +from __future__ import division + +import numpy as np + +from numba import jit + + +# Set benchmarks +# Notes: +# - unless we want to benchmark marshalling a set or list back to Python, +# we return a single value to avoid conversion costs...
d2a1d906b863dcf57eea228282a1badd5274d3b2
test/integration/test_node_ping.py
test/integration/test_node_ping.py
import uuid from kitten.server import KittenServer from kitten.request import KittenRequest from mock import MagicMock import gevent class TestPropagation(object): def setup_method(self, method): self.local_port = 9812 self.remote_port = 9813 self.request = { 'id': { ...
Add disabled Ping integration test
Add disabled Ping integration test
Python
mit
thiderman/network-kitten
--- +++ @@ -0,0 +1,53 @@ +import uuid + +from kitten.server import KittenServer +from kitten.request import KittenRequest + +from mock import MagicMock +import gevent + + +class TestPropagation(object): + def setup_method(self, method): + self.local_port = 9812 + self.remote_port = 9813 + self...
993025327f83e47c0b996690f661d4b54f8d2146
scripts/checkpoints/average.py
scripts/checkpoints/average.py
#!/usr/bin/env python from __future__ import print_function import os import sys import argparse import numpy as np # Parse arguments parser = argparse.ArgumentParser() parser.add_argument('-m', '--model', nargs='+', required=True, help="models to average") parser.add_argument('-o', '--output', ...
Add script for checkpoint averaging
Add script for checkpoint averaging
Python
mit
emjotde/amunn,emjotde/amunn,emjotde/Marian,emjotde/amunn,emjotde/amunmt,marian-nmt/marian-train,emjotde/Marian,emjotde/amunmt,marian-nmt/marian-train,emjotde/amunmt,marian-nmt/marian-train,emjotde/amunn,emjotde/amunmt,marian-nmt/marian-train,marian-nmt/marian-train
--- +++ @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import os +import sys +import argparse + +import numpy as np + +# Parse arguments +parser = argparse.ArgumentParser() +parser.add_argument('-m', '--model', nargs='+', required=True, + help="models to average...
144738aecf4e593ebd8cbbc60f53692d783b1799
pronto_feedback/feedback/migrations/0003_feedback_tags.py
pronto_feedback/feedback/migrations/0003_feedback_tags.py
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-08-27 01:39 from __future__ import unicode_literals from django.db import migrations import taggit.managers class Migration(migrations.Migration): dependencies = [ ('taggit', '0002_auto_20150616_2121'), ('feedback', '0002_auto_20160826_2...
Add migration for feedback tags
Add migration for feedback tags
Python
mit
zkan/pronto-feedback,zkan/pronto-feedback
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-08-27 01:39 +from __future__ import unicode_literals + +from django.db import migrations +import taggit.managers + + +class Migration(migrations.Migration): + + dependencies = [ + ('taggit', '0002_auto_20150616_2121'), + ...
dbafa0d69c5c13282ed5f4c41ccb7550f1575c74
example/run_example_cad.py
example/run_example_cad.py
#!/usr/bin/env python # 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. """Runs hello_world.py, through hello_world.isolate, locally in a temporary directory with the files fetched from the remote Conten...
Add example of running an isolated step without using Swarm
Add example of running an isolated step without using Swarm TBR=csharp@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/11070006 git-svn-id: d5a9b8648c52d490875de6588c8ee7ca688f9ed1@160586 0039d316-1c4b-4281-b951-d872f2087c98
Python
apache-2.0
luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py
--- +++ @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# 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. + +"""Runs hello_world.py, through hello_world.isolate, locally in a temporary +directory with the fi...
0e88b500e3412b86696c892abe8207f14fb73b3a
tensorflow_datasets/scripts/print_num_configs.py
tensorflow_datasets/scripts/print_num_configs.py
# coding=utf-8 # Copyright 2019 The TensorFlow Datasets 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 appl...
Add script to print num configs
Add script to print num configs PiperOrigin-RevId: 240189946
Python
apache-2.0
tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets
--- +++ @@ -0,0 +1,37 @@ +# coding=utf-8 +# Copyright 2019 The TensorFlow Datasets 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/LICE...
d83f702a6cf0ec86c457edf8668078a53ae86579
restlib2/params.py
restlib2/params.py
def clean_bool(value, allow_none=False): if isinstance(value, bool): return value if isinstance(value, basestring): value = value.lower() if value in ('t', 'true', '1', 'yes'): return True if value in ('f', 'false', '0', 'no'): return False if allow_n...
Implement Parametizer class for defining and cleaning GET parameters
Implement Parametizer class for defining and cleaning GET parameters A subclass can define class-level variables and clean_* methods for cleaning input parameter values
Python
bsd-2-clause
bruth/restlib2
--- +++ @@ -0,0 +1,68 @@ +def clean_bool(value, allow_none=False): + if isinstance(value, bool): + return value + + if isinstance(value, basestring): + value = value.lower() + if value in ('t', 'true', '1', 'yes'): + return True + if value in ('f', 'false', '0', 'no'): + ...
60753aae90e1cba2e4dcb2dec94f9da530db5542
contrib/queue_monitor.py
contrib/queue_monitor.py
import logging logger = logging.getLogger(__name__) from arke.collect import Collect class queue_monitor(Collect): default_config = {'interval': 60, } def gather_data(self): logger.info("persist_queue: %i, collect_pool: %i" % (self.persist_queue.qsize(), len(self._pool)))
Add a debugging plugin to log the size of the queue.
Add a debugging plugin to log the size of the queue.
Python
apache-2.0
geodelic/arke,geodelic/arke
--- +++ @@ -0,0 +1,14 @@ + +import logging + +logger = logging.getLogger(__name__) + +from arke.collect import Collect + +class queue_monitor(Collect): + default_config = {'interval': 60, + } + + def gather_data(self): + logger.info("persist_queue: %i, collect_pool: %i" % (self.persis...
f0413bbd3798361c6602deacb27a9da25d0c20d6
examples/plot_random_vs_gp.py
examples/plot_random_vs_gp.py
from time import time import numpy as np import matplotlib.pyplot as plt from sklearn.base import clone from sklearn.datasets import load_digits from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import GridSearchCV from sklearn.model_selection import StratifiedKFold from skopt.dummy_op...
Add example to show random search vs gp
Add example to show random search vs gp
Python
bsd-3-clause
glouppe/scikit-optimize,ccauet/scikit-optimize,betatim/BlackBox,scikit-optimize/scikit-optimize,betatim/BlackBox,scikit-optimize/scikit-optimize,glouppe/scikit-optimize
--- +++ @@ -0,0 +1,60 @@ +from time import time + +import numpy as np +import matplotlib.pyplot as plt + +from sklearn.base import clone +from sklearn.datasets import load_digits +from sklearn.ensemble import RandomForestClassifier +from sklearn.model_selection import GridSearchCV +from sklearn.model_selection import...
4850f232528f797539ce444a11dc248ae7696842
numpy/core/tests/test_print.py
numpy/core/tests/test_print.py
import numpy as np from numpy.testing import * class TestPrint(TestCase): def test_float_types(self) : """ Check formatting. This is only for the str function, and only for simple types. The precision of np.float and np.longdouble aren't the same as the python float pr...
Add basic tests of number str() formatting.
Add basic tests of number str() formatting. git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@5396 94b884b6-d6fd-0310-90d3-974f1d3f35e1
Python
bsd-3-clause
illume/numpy3k,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,illume/numpy3k,jasonmccampbell/numpy-refactor-sprint,illume/numpy3k,teoliphant/numpy-refactor,efiring/numpy-work,illume/numpy3k,chadnetzer/numpy-gaurdro,Ademan/NumPy-GSoC,chadnetzer/numpy-gaurdro,efiring/numpy-work,Ademan/NumPy-GSoC,jasonmccampbell/...
--- +++ @@ -0,0 +1,36 @@ +import numpy as np +from numpy.testing import * + +class TestPrint(TestCase): + + def test_float_types(self) : + """ Check formatting. + + This is only for the str function, and only for simple types. + The precision of np.float and np.longdouble aren't the sa...
acd14b9239b60ab27ae38a95bd6a832bce1c4af4
pontoon/base/migrations/0021_auto_20150904_1007.py
pontoon/base/migrations/0021_auto_20150904_1007.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def remove_pa_fy(apps, schema_editor): Locale = apps.get_model('base', 'Locale') for code in ['pa', 'fy']: l = Locale.objects.get(code=code) l.delete() class Migration(migrations.Migrat...
Remove obsolete locales, pa and fy
Remove obsolete locales, pa and fy
Python
bsd-3-clause
mathjazz/pontoon,participedia/pontoon,m8ttyB/pontoon,vivekanand1101/pontoon,yfdyh000/pontoon,sudheesh001/pontoon,mastizada/pontoon,mozilla/pontoon,yfdyh000/pontoon,mastizada/pontoon,mathjazz/pontoon,jotes/pontoon,mozilla/pontoon,sudheesh001/pontoon,mathjazz/pontoon,jotes/pontoon,mozilla/pontoon,mastizada/pontoon,partic...
--- +++ @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +def remove_pa_fy(apps, schema_editor): + Locale = apps.get_model('base', 'Locale') + + for code in ['pa', 'fy']: + l = Locale.objects.get(code=code) + l.delet...
486613951ac8b1584720b23c2a03d427bdf38162
apps/core/tests/test_admin.py
apps/core/tests/test_admin.py
from django.contrib.admin.sites import AdminSite from django.test import TestCase from .. import admin from .. import factories from .. import models class UUIDModelAdminMixinTestCase(TestCase): def test_get_short_uuid(self): omics_unit = factories.OmicsUnitFactory() mixin = admin.UUIDModelAdmi...
Add example tests for core ModelAdmin
Add example tests for core ModelAdmin
Python
bsd-3-clause
Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel
--- +++ @@ -0,0 +1,38 @@ +from django.contrib.admin.sites import AdminSite +from django.test import TestCase + +from .. import admin +from .. import factories +from .. import models + + +class UUIDModelAdminMixinTestCase(TestCase): + + def test_get_short_uuid(self): + + omics_unit = factories.OmicsUnitFacto...
400d2b85e1b50405539ae7f1e12db484f8545353
src/main/fsize.py
src/main/fsize.py
fp=open("qdisksync.cache") fsize_all=0 for line in fp: items=line.split("\t") fsize_all+=int(items[1]) fp.close() print("Size:"+str(fsize_all/1024.0/1024.0)+"MB")
Add a files total size scriptwq
Add a files total size scriptwq
Python
apache-2.0
jemygraw/qdiskbundle,jemygraw/qdiskbundle,jemygraw/qdisksync,jemygraw/qdisksync,jemygraw/qdisksync
--- +++ @@ -0,0 +1,7 @@ +fp=open("qdisksync.cache") +fsize_all=0 +for line in fp: + items=line.split("\t") + fsize_all+=int(items[1]) +fp.close() +print("Size:"+str(fsize_all/1024.0/1024.0)+"MB")
23a626124adb9882e78744a81d13996fe1d2f5aa
tests/functional/test_utils.py
tests/functional/test_utils.py
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
Add functional test for OSUtils
Add functional test for OSUtils Test involved detecting special UNIX files
Python
apache-2.0
boto/s3transfer
--- +++ @@ -0,0 +1,44 @@ +# Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +#...
e45cbf1dcaf6ba6e142e7674d3a869f1492d43c7
tests/unit/utils/cloud_test.py
tests/unit/utils/cloud_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` :copyright: © 2013 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. tests.unit.utils.cloud_test ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Test the salt-cloud utilitie...
Add unit test for the ssh password regex matching
Add unit test for the ssh password regex matching
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +''' + :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` + :copyright: © 2013 by the SaltStack Team, see AUTHORS for more details. + :license: Apache 2.0, see LICENSE for more details. + + + tests.unit.utils.cloud_test + ~~~~~~~~~~~~~~~~~~~~~~~~~...
e4a50aece7071091f5801c3e3239382b4b70256c
tools/state_updates.py
tools/state_updates.py
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt def update_accu_one(U, X): U = 1*U + l*(u - 1*X) X = (1*U) return (U, X) def update_accu_both(U, X): U = (1-l)*U + l*(u - 1*X) X = (1-l)*X + l*(1*U) return (U, X) def update_interp_both(U, X): U = (1-l)*U + l*(u -...
Add a simple script for plotting iteration behaviors
Add a simple script for plotting iteration behaviors
Python
mit
arasmus/eca
--- +++ @@ -0,0 +1,51 @@ +#!/usr/bin/env python +import numpy as np +import matplotlib.pyplot as plt + + +def update_accu_one(U, X): + U = 1*U + l*(u - 1*X) + X = (1*U) + return (U, X) + + +def update_accu_both(U, X): + U = (1-l)*U + l*(u - 1*X) + X = (1-l)*X + l*(1*U) + return (U, X) + + +def updat...
750f9c3d243ad024d54b6f4903657ab35aa6feb9
learntools/computer_vision/ex6.py
learntools/computer_vision/ex6.py
from learntools.core import * import tensorflow as tf # Free class Q1(CodingProblem): _solution = "" _hint = "" def check(self): pass class Q2A(ThoughtExperiment): _hint = "Remember that whatever transformation you apply needs at least to keep the classes distinct, but otherwise should more ...
Add exercise 6 checking code
Add exercise 6 checking code
Python
apache-2.0
Kaggle/learntools,Kaggle/learntools
--- +++ @@ -0,0 +1,33 @@ +from learntools.core import * +import tensorflow as tf + + +# Free +class Q1(CodingProblem): + _solution = "" + _hint = "" + def check(self): + pass + + +class Q2A(ThoughtExperiment): + _hint = "Remember that whatever transformation you apply needs at least to keep the cla...
b4ab495f5addc50b885d07150de9ce3d6309c1bd
breadcrumbs/default_config.py
breadcrumbs/default_config.py
# Copy this file to config.py and fill in your own values SECRET_KEY = 'Genjric Noguchen' DEBUG = True FACEBOOK_APP_ID = '1234567890' FACEBOOK_APP_SECRET = '10abef0bc0'
Add a default configuration with instructions
Add a default configuration with instructions
Python
isc
breadcrumbs-app/breadcrumbs,breadcrumbs-app/breadcrumbs,breadcrumbs-app/breadcrumbs
--- +++ @@ -0,0 +1,5 @@ +# Copy this file to config.py and fill in your own values +SECRET_KEY = 'Genjric Noguchen' +DEBUG = True +FACEBOOK_APP_ID = '1234567890' +FACEBOOK_APP_SECRET = '10abef0bc0'
86c41ea896031cbcdf3894835f2bd5c8a91de079
test/rigid/cubes/create_restart.py
test/rigid/cubes/create_restart.py
from hoomd_script import * init.read_xml('cubes.xml') lj = pair.lj(r_cut=2**(1.0/6.0)); lj.pair_coeff.set('A', 'A', sigma=1.0, epsilon=1.0) lj.set_params(mode='shift') nlist.reset_exclusions(exclusions=['body']) integrate.mode_standard(dt=0.005) bdnvt = integrate.bdnvt_rigid(group=group.all(), T=1.2) dcd = dump.dcd...
Test script to create an xml restart file
Test script to create an xml restart file git-svn-id: 5cda8128732f5b679951344c24659131be7d2dfc@2733 fa922fa7-2fde-0310-acd8-f43f465a7996
Python
bsd-3-clause
joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue
--- +++ @@ -0,0 +1,29 @@ +from hoomd_script import * + +init.read_xml('cubes.xml') + +lj = pair.lj(r_cut=2**(1.0/6.0)); +lj.pair_coeff.set('A', 'A', sigma=1.0, epsilon=1.0) +lj.set_params(mode='shift') +nlist.reset_exclusions(exclusions=['body']) + +integrate.mode_standard(dt=0.005) +bdnvt = integrate.bdnvt_rigid(gro...
ac5696eb25063a753ac608c5765a5f7b804e95a2
locations/spiders/merrilllynch.py
locations/spiders/merrilllynch.py
# -*- coding: utf-8 -*- import scrapy from locations.items import GeojsonPointItem import json class MerrillLynchSpider(scrapy.Spider): name = 'merrilllynch' allowed_domains = ['ml.com'] start_urls = ('https://fa.ml.com/',) def parse_branch(self, response): data = json.loads(response.body_as...
Add spider for Merrill Lynch offices
Add spider for Merrill Lynch offices
Python
mit
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
--- +++ @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +import scrapy +from locations.items import GeojsonPointItem +import json + + +class MerrillLynchSpider(scrapy.Spider): + name = 'merrilllynch' + allowed_domains = ['ml.com'] + start_urls = ('https://fa.ml.com/',) + + def parse_branch(self, response): + + ...
50618c1f5cce31612d1278e7be0bfd14a670736a
facilities/migrations/set_facility_code_sequence_min_value.py
facilities/migrations/set_facility_code_sequence_min_value.py
# -*- coding: utf-8 -*- from django.db import models, migrations from facilities.models import Facility def set_min_code_value(apps, schema_editor): from django.db import connection cursor = connection.cursor() sql = """ ALTER SEQUENCE facilities_facility_code_seq restart 100000 start 100000 minv...
Add back facility code sequence migrations
Add back facility code sequence migrations
Python
mit
MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from django.db import models, migrations +from facilities.models import Facility + +def set_min_code_value(apps, schema_editor): + from django.db import connection + cursor = connection.cursor() + sql = """ + ALTER SEQUENCE facilities_facility_code_...
9a5c959bc8d83b0b5c93666d66111b3337e937fc
orchestra/test/test_integration.py
orchestra/test/test_integration.py
from .. import monkey; monkey.patch_all() from nose.tools import eq_ as eq import os import nose from .. import connection, run from .util import assert_raises def setup(): try: host = os.environ['ORCHESTRA_TEST_HOST'] except KeyError: raise nose.SkipTest( 'To run integration te...
Add integration tests for signals and connection loss.
Add integration tests for signals and connection loss.
Python
mit
ivotron/teuthology,robbat2/teuthology,dreamhost/teuthology,SUSE/teuthology,yghannam/teuthology,ktdreyer/teuthology,tchaikov/teuthology,caibo2014/teuthology,ktdreyer/teuthology,dmick/teuthology,dreamhost/teuthology,dmick/teuthology,t-miyamae/teuthology,SUSE/teuthology,tchaikov/teuthology,ceph/teuthology,robbat2/teutholo...
--- +++ @@ -0,0 +1,43 @@ +from .. import monkey; monkey.patch_all() + +from nose.tools import eq_ as eq + +import os +import nose + +from .. import connection, run + +from .util import assert_raises + +def setup(): + try: + host = os.environ['ORCHESTRA_TEST_HOST'] + except KeyError: + raise nose.S...
877406927bc4754daeab10b9bfb0f7879e8f6092
perftest.py
perftest.py
""" Simple peformance tests. """ import sys import time import couchdb def main(): print 'sys.version : %r' % (sys.version,) print 'sys.platform : %r' % (sys.platform,) tests = [create_doc, create_bulk_docs] if len(sys.argv) > 1: tests = [test for test in tests if test.__name__ in sys.argv...
Add a very simple performance testing tool.
Add a very simple performance testing tool.
Python
bsd-3-clause
infinit/couchdb-python,djc/couchdb-python,djc/couchdb-python,Roger/couchdb-python
--- +++ @@ -0,0 +1,59 @@ +""" +Simple peformance tests. +""" + +import sys +import time + +import couchdb + + +def main(): + + print 'sys.version : %r' % (sys.version,) + print 'sys.platform : %r' % (sys.platform,) + + tests = [create_doc, create_bulk_docs] + if len(sys.argv) > 1: + tests = [test f...