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
66f2f1caf8b9f7e5325111a995b993d61df9aed1
raft/store.py
raft/store.py
import os import errno import uuid import msgpack # we're using it anyway... def read_state(): sfile = '/tmp/raft-state' try: with open(sfile) as r: return msgpack.unpackb(r.read()) except IOError as e: if not e.errno == errno.ENOENT: raise # no state file exis...
Save and load persistent state.
Save and load persistent state.
Python
unlicense
kurin/py-raft
--- +++ @@ -0,0 +1,21 @@ +import os +import errno +import uuid + +import msgpack # we're using it anyway... + +def read_state(): + sfile = '/tmp/raft-state' + try: + with open(sfile) as r: + return msgpack.unpackb(r.read()) + except IOError as e: + if not e.errno == errno.ENOENT: + ...
1049ee1d79d5c4aa80f44011d0ee21df1226c5fc
tests/test_identifying_headers.py
tests/test_identifying_headers.py
import datetime import os import unittest from tigershark.facade.common import IdentifyingHeaders from tigershark.parsers import IdentifyingParser class TestIdentifyingHeaders(unittest.TestCase): def parse_file(self, name): with open(os.path.join('tests', name)) as f: parsed = IdentifyingPar...
Add 5010 generic ISA facade tests.
Add 5010 generic ISA facade tests.
Python
bsd-3-clause
jdavisp3/TigerShark,jdavisp3/TigerShark,jdavisp3/TigerShark,jdavisp3/TigerShark
--- +++ @@ -0,0 +1,43 @@ +import datetime +import os +import unittest + +from tigershark.facade.common import IdentifyingHeaders +from tigershark.parsers import IdentifyingParser + + +class TestIdentifyingHeaders(unittest.TestCase): + + def parse_file(self, name): + with open(os.path.join('tests', name)) as...
6599f8ab3bc99e5d2cdb222856b725972c4b4d16
scripts/anonscrobbles.py
scripts/anonscrobbles.py
#!/usr/bin/env python import random s = open("scrobbledump.sql", "r") o = open("scrobbles.anonymous.sql", "w") datasection = False usermap = {} #track, artist, "time", mbid, album, source, rating, length, stid, userid, track_tsv, artist_tsv for line in s.readlines(): if line.rstrip() == "\.": datasection = False ...
Add hacky script for anonymising dumps of the Scrobbles table whilst still maintaining internal consistency
Add hacky script for anonymising dumps of the Scrobbles table whilst still maintaining internal consistency
Python
agpl-3.0
foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python +import random + +s = open("scrobbledump.sql", "r") +o = open("scrobbles.anonymous.sql", "w") + +datasection = False +usermap = {} +#track, artist, "time", mbid, album, source, rating, length, stid, userid, track_tsv, artist_tsv +for line in s.readlines(): + if line.rst...
44da0c97ac662375dd45d201cce88c32896ca361
scripts/list-checkins.py
scripts/list-checkins.py
#!/usr/bin/env python # This script retrieves a detailed list of the currently running checkins import argparse import concurrent.futures import datetime import json import sys import boto3 SFN = boto3.client('stepfunctions') def format_date_fields(obj): for key in obj: if isinstance(obj[key], datetime...
Add script to list scheduled checkins
Add script to list scheduled checkins
Python
mit
DavidWittman/serverless-southwest-check-in
--- +++ @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +# This script retrieves a detailed list of the currently running checkins + +import argparse +import concurrent.futures +import datetime +import json +import sys + +import boto3 + +SFN = boto3.client('stepfunctions') + +def format_date_fields(obj): + for key in ob...
bda3fa5dfea480f8db5393602616d6a4b430175e
scripts/renumber_ants.py
scripts/renumber_ants.py
#!/usr/bin/env python """ A command-line script for renumbering antenna numbers > 255 if possible in uvfits files. """ import numpy as np import os import argparse from pyuvdata import UVData # setup argparse a = argparse.ArgumentParser(description="A command-line script for renumbering antenna numbers > 255 if possib...
Add a script to renumber antennas to below 256 in uvfits files
Add a script to renumber antennas to below 256 in uvfits files
Python
bsd-2-clause
HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +""" +A command-line script for renumbering antenna numbers > 255 if possible in uvfits files. +""" +import numpy as np +import os +import argparse +from pyuvdata import UVData + +# setup argparse +a = argparse.ArgumentParser(description="A command-line script for renum...
fcb9d55dd5bdaae2ec088b576f9ee78ac81a4b1a
tests/fail_arguments_test.py
tests/fail_arguments_test.py
#!/usr/bin/env python # encoding: utf-8 """Fail commands because of arguments test for vimiv's test suite.""" from unittest import main from vimiv_testcase import VimivTestCase class FailingArgTest(VimivTestCase): """Failing Argument Tests.""" @classmethod def setUpClass(cls): cls.init_test(cls)...
Add test for failing commands because of n_args
Add test for failing commands because of n_args
Python
mit
karlch/vimiv,karlch/vimiv,karlch/vimiv
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# encoding: utf-8 +"""Fail commands because of arguments test for vimiv's test suite.""" + +from unittest import main +from vimiv_testcase import VimivTestCase + + +class FailingArgTest(VimivTestCase): + """Failing Argument Tests.""" + + @classmethod + def set...
99bf15563d495f5772d82dae4bf6511b88c2c45b
Algebra_Geometry/linear_algebra.py
Algebra_Geometry/linear_algebra.py
#!/usr/bin/python # Linear Algebra with Python import numpy as np def numpy_show(): # create a column vector col_vec = np.array([[1], [2]]) print "column vector" print col_vec # create a row vector row_vec = np.array([[1, 2]]) print "row vector" print row_vec # create a matrix ...
Add Linear Algebra python Example
Add Linear Algebra python Example
Python
mit
nachovizzo/AUTONAVx,nachovizzo/AUTONAVx,nachovizzo/AUTONAVx
--- +++ @@ -0,0 +1,76 @@ +#!/usr/bin/python +# Linear Algebra with Python +import numpy as np + +def numpy_show(): + # create a column vector + col_vec = np.array([[1], [2]]) + print "column vector" + print col_vec + + # create a row vector + row_vec = np.array([[1, 2]]) + print "row vector" + ...
7f22d9687563660852926333a9c8bacaa31df591
open_humans/management/commands/stats_new.py
open_humans/management/commands/stats_new.py
# -*- coding: utf-8 -*- import arrow from django.contrib.auth import get_user_model from django.core.management.base import BaseCommand from django.db.models import Count from termcolor import colored from data_import.models import DataFile from open_humans.models import Member from private_sharing.models import Da...
Add new stats management command
Add new stats management command
Python
mit
PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans
--- +++ @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +import arrow + +from django.contrib.auth import get_user_model +from django.core.management.base import BaseCommand +from django.db.models import Count + +from termcolor import colored + +from data_import.models import DataFile +from open_humans.models import Membe...
8a1ba0d7200ea72e20ab1db5a62c3e36ce7f8489
zephyr/management/commands/print_initial_password.py
zephyr/management/commands/print_initial_password.py
from django.core.management.base import BaseCommand from zephyr.lib.initial_password import initial_password class Command(BaseCommand): help = "Print the initial password for accounts as created by populate_db" def handle(self, *args, **options): print for email in args: if '@' no...
Add a management command to print the initial password for an account
Add a management command to print the initial password for an account (imported from commit 0a2b7d8215961801dbd24d9af89785e857b9ba14)
Python
apache-2.0
souravbadami/zulip,tbutter/zulip,PaulPetring/zulip,he15his/zulip,avastu/zulip,littledogboy/zulip,glovebx/zulip,hafeez3000/zulip,DazWorrall/zulip,littledogboy/zulip,tdr130/zulip,zwily/zulip,mdavid/zulip,MayB/zulip,tommyip/zulip,ashwinirudrappa/zulip,niftynei/zulip,jackrzhang/zulip,MariaFaBella85/zulip,brockwhittaker/zul...
--- +++ @@ -0,0 +1,13 @@ +from django.core.management.base import BaseCommand +from zephyr.lib.initial_password import initial_password + +class Command(BaseCommand): + help = "Print the initial password for accounts as created by populate_db" + + def handle(self, *args, **options): + print + for ...
fd4f4a061a5dade9ed918ce40d3a09d78ed7cea3
snippets/base/migrations/0019_auto_20170726_0635.py
snippets/base/migrations/0019_auto_20170726_0635.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('base', '0018_auto_20170614_0925'), ] operations = [ migrations.AlterField( model_name='snippet', nam...
Add snippet.campaign field migration for help_text change.
Add snippet.campaign field migration for help_text change.
Python
mpl-2.0
mozilla/snippets-service,mozmar/snippets-service,glogiotatidis/snippets-service,glogiotatidis/snippets-service,mozilla/snippets-service,mozmar/snippets-service,mozmar/snippets-service,glogiotatidis/snippets-service,glogiotatidis/snippets-service,mozmar/snippets-service,mozilla/snippets-service,mozilla/snippets-service
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0018_auto_20170614_0925'), + ] + + operations = [ + migrations.AlterField( + ...
3771d3165d4873592f53d8b2401806297fe2989f
door/models.py
door/models.py
from django.db import models from django.utils import timezone from datetime import datetime # Create your models here. class DoorStatus(models.Model): datetime = models.DateTimeField(default=timezone.now) status = models.BooleanField(default=False) name = models.CharField(max_length=20) def __str__...
from django.db import models from django.utils import timezone from datetime import datetime # Create your models here. class DoorStatus(models.Model): datetime = models.DateTimeField() status = models.BooleanField(default=False) name = models.CharField(max_length=20) def __str__(self): retu...
Remove default datetime in door
Remove default datetime in door
Python
mit
hackerspace-ntnu/website,hackerspace-ntnu/website,hackerspace-ntnu/website
--- +++ @@ -6,7 +6,7 @@ class DoorStatus(models.Model): - datetime = models.DateTimeField(default=timezone.now) + datetime = models.DateTimeField() status = models.BooleanField(default=False) name = models.CharField(max_length=20) @@ -15,8 +15,8 @@ class OpenData(models.Model): - opened...
f290b8e93dc8e833f9cfa684b6cdb9420e8bf3d6
adhocracy4/projects/migrations/0011_fix_copyright_field_desc.py
adhocracy4/projects/migrations/0011_fix_copyright_field_desc.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-09-18 14:44 from __future__ import unicode_literals import adhocracy4.images.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('a4projects', '0010_image_copyrights'), ] operations = [ ...
Add migration with fixed copyright field descriptions
Add migration with fixed copyright field descriptions
Python
agpl-3.0
liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-18 14:44 +from __future__ import unicode_literals + +import adhocracy4.images.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('a4projects', '0010_image_copy...
78cf46620600998af834c9a99df07e18f302a282
test/factory/test_text_loader_factory.py
test/factory/test_text_loader_factory.py
""" .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ import pytest import pytablereader as ptr class Test_TableTextLoaderFactory: @pytest.mark.parametrize(["value", "expected"], [[None, ValueError]]) def test_exception(self, value, expected): with pytest.raises(expected): ...
Add test cases for TableTextLoaderFactory
Add test cases for TableTextLoaderFactory
Python
mit
thombashi/pytablereader,thombashi/pytablereader,thombashi/pytablereader
--- +++ @@ -0,0 +1,55 @@ +""" +.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> +""" + +import pytest + +import pytablereader as ptr + + +class Test_TableTextLoaderFactory: + @pytest.mark.parametrize(["value", "expected"], [[None, ValueError]]) + def test_exception(self, value, expected): + ...
b81540972a24ee3146c6035ebeaacb7fbc785f13
dev/docs/build_api_docs.py
dev/docs/build_api_docs.py
# Copyright 2021 Google LLC # 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 script to build API docs.
Add script to build API docs.
Python
apache-2.0
quantumlib/OpenFermion-FQE,quantumlib/OpenFermion-FQE,quantumlib/OpenFermion-FQE
--- +++ @@ -0,0 +1,58 @@ +# Copyright 2021 Google LLC + +# 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...
f8c597e5318501ad84a0332a62c02a446685dd26
unyt/tests/test_unyt_testing.py
unyt/tests/test_unyt_testing.py
""" Test unyt.testing module that contains utilities for writing tests. """ # ---------------------------------------------------------------------------- # Copyright (c) 2013, yt Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distribute...
Add tests for unyt.testing module
Add tests for unyt.testing module
Python
bsd-3-clause
yt-project/unyt
--- +++ @@ -0,0 +1,58 @@ +""" +Test unyt.testing module that contains utilities for writing tests. + +""" + +# ---------------------------------------------------------------------------- +# Copyright (c) 2013, yt Development Team. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license ...
26e9ccea2d7970a1ed9c18f61c03f09e3629cc6c
gaphor/UML/interactions/tests/test_interactionspropertypages.py
gaphor/UML/interactions/tests/test_interactionspropertypages.py
from gaphor import UML from gaphor.diagram.tests.fixtures import find from gaphor.UML.interactions.interactionspropertypages import MessagePropertyPage def test_message_property_page(diagram, element_factory): item = diagram.create( UML.interactions.MessageItem, subject=element_factory.create(UML.Message)...
Add tests for message property page
Add tests for message property page
Python
lgpl-2.1
amolenaar/gaphor,amolenaar/gaphor
--- +++ @@ -0,0 +1,16 @@ +from gaphor import UML +from gaphor.diagram.tests.fixtures import find +from gaphor.UML.interactions.interactionspropertypages import MessagePropertyPage + + +def test_message_property_page(diagram, element_factory): + item = diagram.create( + UML.interactions.MessageItem, subject=...
45d1dd90b1794897d72b25d9090bed785387560f
spacy/tests/doc/test_pickle_doc.py
spacy/tests/doc/test_pickle_doc.py
from __future__ import unicode_literals import pickle from ...language import Language def test_pickle_single_doc(): nlp = Language() doc = nlp(u'pickle roundtrip') data = pickle.dumps(doc, 1) doc2 = pickle.loads(data) assert doc2.text == 'pickle roundtrip' def test_list_of_docs_pickles_effici...
Add tests for pickling doc
Add tests for pickling doc
Python
mit
explosion/spaCy,aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,aikramer2/spaCy,recognai/spaCy,spacy-io/spaCy,honnibal/spaCy,aikramer2/spaCy,explosion/spaCy,recognai/spaCy,honnibal/spaCy,aikramer2/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,aikramer2/spaCy,honnibal/spaCy,recognai...
--- +++ @@ -0,0 +1,25 @@ +from __future__ import unicode_literals + +import pickle + +from ...language import Language + + +def test_pickle_single_doc(): + nlp = Language() + doc = nlp(u'pickle roundtrip') + data = pickle.dumps(doc, 1) + doc2 = pickle.loads(data) + assert doc2.text == 'pickle roundtrip...
a18da9856a95f7206f2ee49f728b8e8ba5f12814
CLI/convSH.py
CLI/convSH.py
#!/usr/bin/python import sys, subprocess, os, re if len(sys.argv) < 3: print('Incorrect usage') exit(1) if not os.path.isfile(sys.argv[1]): print('File does not exist') exit(1) od = subprocess.check_output(['/usr/bin/objdump', '-d', sys.argv[1]]) od = od.split('\n') code = [] rx = re.compile(r'^ ([...
Add convert to shellcode tool
Add convert to shellcode tool
Python
mit
reykjalin/tools,reykjalin/tools
--- +++ @@ -0,0 +1,36 @@ +#!/usr/bin/python +import sys, subprocess, os, re + +if len(sys.argv) < 3: + print('Incorrect usage') + exit(1) + +if not os.path.isfile(sys.argv[1]): + print('File does not exist') + exit(1) + +od = subprocess.check_output(['/usr/bin/objdump', '-d', sys.argv[1]]) + +od = od.spli...
94d808cf8c353a49161ac6b1ff9c40671e82f9bd
modules/testing/test_literature_reference.py
modules/testing/test_literature_reference.py
#!/usr/bin/env python """ Created by: Lee Bergstrand (2017) Description: A simple unittest for testing the literature reference module. """ import unittest from modules.literature_reference import parse_literature_references class TestLiteratureReference(unittest.TestCase): """A unit testing class for testing ...
Add automated tests for literature reference module.
Add automated tests for literature reference module.
Python
apache-2.0
LeeBergstrand/pygenprop
--- +++ @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +""" +Created by: Lee Bergstrand (2017) + +Description: A simple unittest for testing the literature reference module. +""" + +import unittest +from modules.literature_reference import parse_literature_references + + +class TestLiteratureReference(unittest.TestCase): ...
354fcdbe045e80119b1edd4b322589e56df09c39
examples/buffer_results.py
examples/buffer_results.py
""" Process 20 lines of output at a time. Example runs: python buffer_results.py """ import sys import time import drainers # fake this def setup_cruncher(): time.sleep(1) def do_something_expensive(file): time.sleep(0.005) def destroy_cruncher(): time.sleep(0.8) files = [] def crunch(files): prin...
Add result buffering/batch processing example.
Add result buffering/batch processing example.
Python
bsd-3-clause
nvie/python-drainers,nvie/python-drainers
--- +++ @@ -0,0 +1,44 @@ +""" +Process 20 lines of output at a time. + +Example runs: +python buffer_results.py +""" +import sys +import time +import drainers + +# fake this +def setup_cruncher(): + time.sleep(1) + +def do_something_expensive(file): + time.sleep(0.005) + +def destroy_cruncher(): + time.sleep...
61af01f79158dffeb9e4649cbaa98a9cb77cfd99
examples/example01.py
examples/example01.py
from strip_recipes import RecipeFile recipe = RecipeFile() recipe.record_start('example01') recipe.sbs_on() for cur_gate in (10.0, 20.0, 50.0): recipe.bias_set('HA1_Vg', cur_gate) recipe.wait(10.0) recipe.sbs_off() recipe.record_stop() with open('out.txt', 'wt') as fout: recipe.write_to_file(fout)
Add a new, simpler example
Add a new, simpler example
Python
mit
lspestrip/strip_recipes
--- +++ @@ -0,0 +1,16 @@ +from strip_recipes import RecipeFile + +recipe = RecipeFile() +recipe.record_start('example01') +recipe.sbs_on() + +for cur_gate in (10.0, 20.0, 50.0): + recipe.bias_set('HA1_Vg', cur_gate) + + recipe.wait(10.0) + +recipe.sbs_off() +recipe.record_stop() + +with open('out.txt', 'wt') as fout...
9d91e0dd2d6175fe1a45d1a556a33c08133185b3
cc/license/tests/test_rdfa.py
cc/license/tests/test_rdfa.py
"""Unit tests utilizing RDFa parsing. Primarily cc.license.formatter.""" import cc.license import rdfadict import rdflib class TestHtmlFormatter: def __init__(self): self.parser = rdfadict.RdfaParser() self.base = 'FOOBAR' self.lic = cc.license.by_code('by') self.fmtr = cc.license...
Create initial RDFa tests as their own top-level test module.
Create initial RDFa tests as their own top-level test module.
Python
mit
creativecommons/cc.license,creativecommons/cc.license
--- +++ @@ -0,0 +1,23 @@ +"""Unit tests utilizing RDFa parsing. Primarily cc.license.formatter.""" + +import cc.license +import rdfadict +import rdflib + +class TestHtmlFormatter: + + def __init__(self): + self.parser = rdfadict.RdfaParser() + self.base = 'FOOBAR' + self.lic = cc.license.by_co...
61b36218cc0cf74e90ac7ee8d7f02b1ffffe3890
blues/wkhtmltopdf.py
blues/wkhtmltopdf.py
""" wkhtmltopdf Blueprint blueprints: - blues.wkhtmltopdf """ from fabric.decorators import task from refabric.context_managers import sudo from refabric.contrib import blueprints from . import debian __all__ = ['setup', 'configure'] blueprint = blueprints.get(__name__) @task def setup(): """ Install...
""" wkhtmltopdf Blueprint .. code-block:: yaml blueprints: - blues.wkhtmltopdf settings: wkhtmltopdf: # wkhtmltopdf_version: 0.12.2.1 """ from fabric.decorators import task from refabric.context_managers import sudo, settings from refabric.contrib import blueprints from refabric...
Install wkhtmltox from the pkgs on sourceforge
Install wkhtmltox from the pkgs on sourceforge They're compiled with patched QT. This version doesn't need X/Xvfb to run.
Python
mit
gelbander/blues,andreif/blues,chrippa/blues,5monkeys/blues,adisbladis/blues,5monkeys/blues,Sportamore/blues,adisbladis/blues,andreif/blues,gelbander/blues,chrippa/blues,Sportamore/blues,jocke-l/blues,jocke-l/blues,andreif/blues,Sportamore/blues,adisbladis/blues,gelbander/blues,chrippa/blues,5monkeys/blues,jocke-l/blues
--- +++ @@ -1,14 +1,21 @@ """ wkhtmltopdf Blueprint -blueprints: - - blues.wkhtmltopdf +.. code-block:: yaml + + blueprints: + - blues.wkhtmltopdf + + settings: + wkhtmltopdf: + # wkhtmltopdf_version: 0.12.2.1 """ from fabric.decorators import task -from refabric.context_mana...
68693163fc4bcc7432a9890a37721cac3641ca51
livetests.py
livetests.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # The MIT License # # Copyright 2018 David Pursehouse. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restrictio...
Add basic tests running against a live Gerrit server
Add basic tests running against a live Gerrit server Change-Id: I313a9132d2de7a87b3257af7846febb64b3873ee
Python
mit
dpursehouse/pygerrit2
--- +++ @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# The MIT License +# +# Copyright 2018 David Pursehouse. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal ...
cb8977ed160933701dd6588150ee0f00d14511b6
books/migrations/0002_auto_20151116_2351.py
books/migrations/0002_auto_20151116_2351.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import datetime from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('books', '0001_initial'), ] operations = [ migrations.AddField( ...
Add migration for Receipt created field
Add migration for Receipt created field
Python
mit
trimailov/finance,trimailov/finance,trimailov/finance
--- +++ @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import datetime +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('books', '0001_initial'), + ] + + operation...
d4f53913c2e3aee61fe59e42a66e0ac279b186a1
data-structures/queue/queue_tests.py
data-structures/queue/queue_tests.py
import unittest from queue import Queue class TestStringMethods(unittest.TestCase): def test_enqueue_to_empty_queue(self): queue = Queue() self.assertEqual(queue.size, 0, "Queue should be empty") queue.enqueue(1) self.assertEqual(queue.size, 1, "Queue should contain one element") ...
Add tests for queue implementation
Add tests for queue implementation
Python
mit
julianespinel/trainning,julianespinel/training,julianespinel/training,julianespinel/training,julianespinel/training,julianespinel/trainning
--- +++ @@ -0,0 +1,70 @@ +import unittest +from queue import Queue + + +class TestStringMethods(unittest.TestCase): + + def test_enqueue_to_empty_queue(self): + queue = Queue() + self.assertEqual(queue.size, 0, "Queue should be empty") + queue.enqueue(1) + self.assertEqual(queue.size, 1...
5147674980d3d81314bbe3e5ddbad4c01e9ffc21
makepanda/test_wheel.py
makepanda/test_wheel.py
#!/usr/bin/env python """ Tests a .whl file by installing it and pytest into a virtual environment and running the test suite. Requires pip to be installed, as well as 'virtualenv' on Python 2. """ import os import sys import shutil import subprocess import tempfile from optparse import OptionParser def test_wheel(...
Add script to run test suite on a wheel in a virtualenv
Add script to run test suite on a wheel in a virtualenv [skip ci]
Python
bsd-3-clause
chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/env python +""" +Tests a .whl file by installing it and pytest into a virtual environment and +running the test suite. + +Requires pip to be installed, as well as 'virtualenv' on Python 2. +""" + +import os +import sys +import shutil +import subprocess +import tempfile +from optpa...
4e2e9ba9336d2e60084cda9623e7573785f4f0e0
computing_frequencies_with_mismatches.py
computing_frequencies_with_mismatches.py
from neighbors import neighbors from pattern_to_number import pattern_to_number def computing_frequencies_with_mismatches(text, k, d): frequency_array = [0] * 4**k for i in range(0, len(text) - k): pattern = text[i:k] neighborhood = neighbors(pattern, d) for approximate_pattern in neighborhood: j...
Add computing frequencies with mismatches
Add computing frequencies with mismatches
Python
mit
dennis95stumm/bioinformatics_algorithms,dennis95stumm/bioinformatics_algorithms
--- +++ @@ -0,0 +1,18 @@ +from neighbors import neighbors +from pattern_to_number import pattern_to_number + +def computing_frequencies_with_mismatches(text, k, d): + frequency_array = [0] * 4**k + for i in range(0, len(text) - k): + pattern = text[i:k] + neighborhood = neighbors(pattern, d) + for approxim...
3f6fe2658fef0f0a27f58e67da7cc64c2fba7371
chnnlsdmo/chnnlsdmo/admin.py
chnnlsdmo/chnnlsdmo/admin.py
from django.contrib import admin from .models import Voter, Flag, Vote admin.site.register(Voter) admin.site.register(Flag) admin.site.register(Vote)
Make all models visible in Admin
Make all models visible in Admin
Python
bsd-3-clause
shearichard/django-channels-demo,shearichard/django-channels-demo,shearichard/django-channels-demo
--- +++ @@ -0,0 +1,7 @@ +from django.contrib import admin + +from .models import Voter, Flag, Vote + +admin.site.register(Voter) +admin.site.register(Flag) +admin.site.register(Vote)
d549285e2269f0078fefdb054d542c2cbb26dc89
integrated_tests/test_interactions.py
integrated_tests/test_interactions.py
from unittest import TestCase import pygtop class InteractionPropertyTests(TestCase): def test_can_get_gtop_pdbs(self): target = pygtop.get_target_by_id(2) interaction = target.get_interaction_by_id(143) pdbs = interaction.gtop_pdbs() self.assertIn("4IAQ", pdbs) def test_can_...
Add integrated tests for interaction PDBs
Add integrated tests for interaction PDBs
Python
mit
samirelanduk/pygtop
--- +++ @@ -0,0 +1,24 @@ +from unittest import TestCase +import pygtop + +class InteractionPropertyTests(TestCase): + + def test_can_get_gtop_pdbs(self): + target = pygtop.get_target_by_id(2) + interaction = target.get_interaction_by_id(143) + pdbs = interaction.gtop_pdbs() + self.asser...
ca1a8434fd16100509c6ab0c197e562ff767fa06
basics/read_input.py
basics/read_input.py
foo = input("Try to type eval(2+2), if the result is '4' this is unsafe: ") print("You typed the following: \"",foo,"\".") input("Press [Enter] to exit") # Result: seems to be safe with Python 3.1 # Found original tip here: http://www.daniweb.com/forums/thread12326.html # It's from back in 2004, might have been unsafe ...
Check to see if input is executed
Check to see if input is executed
Python
mit
RobertGresdal/python
--- +++ @@ -0,0 +1,6 @@ +foo = input("Try to type eval(2+2), if the result is '4' this is unsafe: ") +print("You typed the following: \"",foo,"\".") +input("Press [Enter] to exit") +# Result: seems to be safe with Python 3.1 +# Found original tip here: http://www.daniweb.com/forums/thread12326.html +# It's from back ...
76bf2bd2a3a570b8ab7632c709deb6fcd9bc20a4
custom/enikshay/management/commands/resolve_duplicate_persons.py
custom/enikshay/management/commands/resolve_duplicate_persons.py
from __future__ import absolute_import from __future__ import print_function from collections import defaultdict import csv import datetime from django.core.management.base import BaseCommand from dimagi.utils.decorators.memoized import memoized from corehq.apps.locations.models import SQLLocation from corehq.apps.hq...
Add basic duplicate resolution cmd with log info
Add basic duplicate resolution cmd with log info
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,78 @@ +from __future__ import absolute_import +from __future__ import print_function +from collections import defaultdict +import csv +import datetime +from django.core.management.base import BaseCommand + +from dimagi.utils.decorators.memoized import memoized + +from corehq.apps.locations.models i...
63ff6313c1200910b749dc8d8488d6c7f2cd9c5f
axelrod/tests/unit/test_classification.py
axelrod/tests/unit/test_classification.py
"""Tests for the classification""" import unittest import axelrod class TestClassification(unittest.TestCase): def test_known_classifiers(self): # Grabbing all the strategies: this will be changed to just be `axelrod.strategies` strategies = axelrod.basic_strategies strategies += axelrod...
"""Tests for the classification""" import unittest import axelrod class TestClassification(unittest.TestCase): def test_known_classifiers(self): # Grabbing all the strategies: this will be changed to just be # `axelrod.strategies` strategies = axelrod.basic_strategies strategies ...
Add a test that checks that different instances can have different behaviour.
Add a test that checks that different instances can have different behaviour.
Python
mit
emmagordon/Axelrod,emmagordon/Axelrod,risicle/Axelrod,kathryncrouch/Axelrod,bootandy/Axelrod,uglyfruitcake/Axelrod,mojones/Axelrod,uglyfruitcake/Axelrod,bootandy/Axelrod,mojones/Axelrod,kathryncrouch/Axelrod,risicle/Axelrod
--- +++ @@ -7,7 +7,8 @@ class TestClassification(unittest.TestCase): def test_known_classifiers(self): - # Grabbing all the strategies: this will be changed to just be `axelrod.strategies` + # Grabbing all the strategies: this will be changed to just be + # `axelrod.strategies` s...
1f9df27041dc9a48b7f74840fa6a7248beb55b62
web/problems/migrations/0002_add_secret_validator.py
web/problems/migrations/0002_add_secret_validator.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import utils class Migration(migrations.Migration): dependencies = [ ('problems', '0001_initial'), ] operations = [ migrations.AlterField( model_name='part', ...
Add a missing migration for the secret validator
Add a missing migration for the secret validator
Python
agpl-3.0
ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import utils + + +class Migration(migrations.Migration): + + dependencies = [ + ('problems', '0001_initial'), + ] + + operations = [ + migrations.AlterField( +...
0e8c93177aff661ec7ec37f0a3175f670faefa45
openstack/tests/functional/compute/v2/test_server.py
openstack/tests/functional/compute/v2/test_server.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add functional tests for servers
Add functional tests for servers Change-Id: Iff4101b3d45e04d7f6e25b5f599a7647c8cd2a80
Python
apache-2.0
stackforge/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,dtroyer/python-openstacksdk,dudymas/python-openstacksdk,dudymas/python-openstacksdk,mtougeron/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-ope...
--- +++ @@ -0,0 +1,61 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writi...
b50a1859d09a9172225a21a96748bfdf9a13515f
indra/tests/test_uniprot_client.py
indra/tests/test_uniprot_client.py
from indra.databases import uniprot_client def test_query_protein_exists(): g = uniprot_client.query_protein('P00533') assert(g is not None) def test_query_protein_nonexist(): g = uniprot_client.query_protein('XXXX') assert(g is None) def test_get_family_members(): members = uniprot_client.get_fa...
Add tests for UniProt client
Add tests for UniProt client
Python
bsd-2-clause
johnbachman/belpy,jmuhlich/indra,johnbachman/belpy,pvtodorov/indra,jmuhlich/indra,sorgerlab/belpy,pvtodorov/indra,bgyori/indra,jmuhlich/indra,sorgerlab/indra,bgyori/indra,johnbachman/indra,sorgerlab/indra,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,pvtodorov/indra,johnbachman/indra,sorgerlab/belpy,johnbachman/indra,pv...
--- +++ @@ -0,0 +1,53 @@ +from indra.databases import uniprot_client + +def test_query_protein_exists(): + g = uniprot_client.query_protein('P00533') + assert(g is not None) + +def test_query_protein_nonexist(): + g = uniprot_client.query_protein('XXXX') + assert(g is None) + +def test_get_family_members(...
f7f19b5074fa28431f8d5fc4d3284f61542423fd
scripts/migration/migrate_index_for_existing_files.py
scripts/migration/migrate_index_for_existing_files.py
""" Saves every file to have new save() logic index those files. """ import sys import logging from website.app import init_app from website.files.models.osfstorage import OsfStorageFile logger = logging.getLogger(__name__) def main(): init_app(routes=False) dry_run = 'dry' in sys.argv logger.warn('Curr...
Add migration to save every file so that it can be indexed
Add migration to save every file so that it can be indexed
Python
apache-2.0
pattisdr/osf.io,zamattiac/osf.io,mluo613/osf.io,ZobairAlijan/osf.io,CenterForOpenScience/osf.io,asanfilippo7/osf.io,chrisseto/osf.io,saradbowman/osf.io,aaxelb/osf.io,zachjanicki/osf.io,wearpants/osf.io,zachjanicki/osf.io,mfraezz/osf.io,kwierman/osf.io,TomHeatwole/osf.io,laurenrevere/osf.io,caseyrollins/osf.io,Johnetord...
--- +++ @@ -0,0 +1,25 @@ +""" +Saves every file to have new save() logic index those files. +""" +import sys +import logging + +from website.app import init_app +from website.files.models.osfstorage import OsfStorageFile + +logger = logging.getLogger(__name__) + + +def main(): + init_app(routes=False) + dry_run...
2ba2d08804280cfdfa2c2ae6ca516fb68dd98ea7
marco/marco/wsgi_web410.py
marco/marco/wsgi_web410.py
"""WSGI File for Web410 """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marco.settings") activate_this = '/home/point97/env/marco_portal2/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
Add wsgi file for web410
MP-795: Add wsgi file for web410
Python
isc
Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,MidAtlanticPortal/marco-portal2,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,MidAtlanticPortal/marco-portal2,MidAtlanticPortal/marco-portal2,MidAtlanticPortal/marco-portal2
--- +++ @@ -0,0 +1,11 @@ +"""WSGI File for Web410 +""" + +import os + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marco.settings") +activate_this = '/home/point97/env/marco_portal2/bin/activate_this.py' +execfile(activate_this, dict(__file__=activate_this)) + +from django.core.wsgi import get_wsgi_application +...
213665bceffad8919986e889882e6ebab1dedafc
temba/flows/migrations/0096_populate_flownodecount.py
temba/flows/migrations/0096_populate_flownodecount.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-30 12:50 from __future__ import unicode_literals from django.db import migrations def do_populate(FlowStep, FlowNodeCount): nodes = list(FlowStep.objects.filter(left_on=None, run__is_active=True).distinct('step_uuid').values_list('run__flow_id', 'st...
Add migration to populate FlowNodeCount
Add migration to populate FlowNodeCount
Python
agpl-3.0
pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro
--- +++ @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-30 12:50 +from __future__ import unicode_literals + +from django.db import migrations + + +def do_populate(FlowStep, FlowNodeCount): + nodes = list(FlowStep.objects.filter(left_on=None, run__is_active=True).distinct('step_uu...
f40a03747fd50afaa13c35cf5623540cb22517ec
timeside/server/migrations/0007_auto_20160705_1342.py
timeside/server/migrations/0007_auto_20160705_1342.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-05 11:42 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('server', '0006_analysistrack'), ] operations = [ ...
Add missing migrations corresponding to 5468b2e57366bc0
Add missing migrations corresponding to 5468b2e57366bc0
Python
agpl-3.0
Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide
--- +++ @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-05 11:42 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('server', '0006_analys...
140f0da41966db7e4a932ee917961c9d27eab87f
src/ggrc/migrations/versions/20160203143912_6bed0575a0b_migrate_assessment_to_assignable_mixin.py
src/ggrc/migrations/versions/20160203143912_6bed0575a0b_migrate_assessment_to_assignable_mixin.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: anze@reciprocitylabs.com # Maintained By: anze@reciprocitylabs.com """Migrate Assessment to Assignable mixin Revision ID: 6bed0575a0b Revises: 262...
Add migration for assignable mixin
Add migration for assignable mixin
Python
apache-2.0
AleksNeStu/ggrc-core,prasannav7/ggrc-core,josthkko/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,andrei-karalionak/ggrc-core,prasannav7/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core...
--- +++ @@ -0,0 +1,58 @@ +# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> +# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> +# Created By: anze@reciprocitylabs.com +# Maintained By: anze@reciprocitylabs.com + +"""Migrate Assessment to Assignable mixin + +Re...
2e173a0d8503a152eba1a99ee66a7a81127496a8
fluentcheck/tests/test_type_hierarchy.py
fluentcheck/tests/test_type_hierarchy.py
import unittest from fluentcheck.check import Check, CheckError class ParentA: def __init__(self): pass class Child(ParentA): def __init__(self): pass class GrandChild(Child): def __init__(self): pass class ParentB: def __init__(self): pass class ChildOfMultipleParen...
Add tests for type hierarchy
Add tests for type hierarchy
Python
mit
csparpa/check
--- +++ @@ -0,0 +1,78 @@ +import unittest +from fluentcheck.check import Check, CheckError + +class ParentA: + def __init__(self): + pass + +class Child(ParentA): + def __init__(self): + pass + +class GrandChild(Child): + def __init__(self): + pass + +class ParentB: + def __init__(sel...
6789fbc32400dd3b32a39881ffdacfd1a3729fa0
gmn/src/d1_gmn/tests/test_mgmt_import.py
gmn/src/d1_gmn/tests/test_mgmt_import.py
# -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2016 DataONE # # Licensed under the Apache License, Version 2.0 ...
Add tests for bulk importer
Add tests for bulk importer
Python
apache-2.0
DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python
--- +++ @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- + +# This work was created by participants in the DataONE project, and is +# jointly copyrighted by participating institutions in DataONE. For +# more information on DataONE, see our web site at http://dataone.org. +# +# Copyright 2009-2016 DataONE +# +# Licensed un...
2ad1c276a96a77d2088f996ebc32fa74206d1cef
osf/migrations/0036_ensure_schemas.py
osf/migrations/0036_ensure_schemas.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-24 19:33 from __future__ import unicode_literals import logging from django.db import migrations from osf.models import MetaSchema from website.project.metadata.schemas import OSF_META_SCHEMAS logger = logging.getLogger(__file__) def add_schemas(*args...
Add migration for ensure schemas
Add migration for ensure schemas
Python
apache-2.0
CenterForOpenScience/osf.io,mattclark/osf.io,pattisdr/osf.io,caseyrollins/osf.io,crcresearch/osf.io,adlius/osf.io,erinspace/osf.io,baylee-d/osf.io,cslzchen/osf.io,laurenrevere/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,binoculars/osf.io,mattclark/osf.io,pattisdr/osf.io,sloria/osf.io,brianjgeiger...
--- +++ @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-05-24 19:33 +from __future__ import unicode_literals + +import logging + +from django.db import migrations + +from osf.models import MetaSchema +from website.project.metadata.schemas import OSF_META_SCHEMAS + + +logger = logging.get...
ae7b39075f3dde712e50f09a388ccbf9e187eab9
saleor/product/migrations/0117_auto_20200423_0737.py
saleor/product/migrations/0117_auto_20200423_0737.py
# Generated by Django 3.0.5 on 2020-04-23 12:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('product', '0116_auto_20200225_0237'), ] operations = [ migrations.AlterField( model_name='producttranslation', name=...
Add auto django migration for ProductTranslation alter name operation
Add auto django migration for ProductTranslation alter name operation
Python
bsd-3-clause
mociepka/saleor,mociepka/saleor,mociepka/saleor
--- +++ @@ -0,0 +1,18 @@ +# Generated by Django 3.0.5 on 2020-04-23 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('product', '0116_auto_20200225_0237'), + ] + + operations = [ + migrations.AlterField( + model_nam...
2f5bf2a03a8115240690af7fa43244ade5a285a5
plugins/models/__init__.py
plugins/models/__init__.py
# __init__.py ## This module is so that all plugins can have custom models.py files in ## their own folders and have them picked up with ## $ python manage.py syncdb import inspect import os from django.conf import settings from django.db import models ### Import all the model modules from plugins/ ### __all__ = [...
Allow plugins to have models.py files in their own plugin folders
Allow plugins to have models.py files in their own plugin folders
Python
apache-2.0
kiwiheretic/logos-v2,kiwiheretic/logos-v2,kiwiheretic/logos-v2,kiwiheretic/logos-v2
--- +++ @@ -0,0 +1,47 @@ +# __init__.py + +## This module is so that all plugins can have custom models.py files in +## their own folders and have them picked up with +## $ python manage.py syncdb + +import inspect +import os +from django.conf import settings +from django.db import models + +### Import all the model...
55c1aaa740724661d58f17b9be818e91a04fde9c
pythran/tests/cases/comp_unrolling.py
pythran/tests/cases/comp_unrolling.py
#pythran export list_comp(int list list) #runas list_comp([[], [], [1]]) def foo(cc, x, y): for a in cc: if a: return True return False def list_comp(cc): return [(x,y) for x in range(1) for y in range(2) if foo(cc, x, y)]
Add new test case for unrolled list comprehension comprehension
Add new test case for unrolled list comprehension comprehension
Python
bsd-3-clause
pbrunet/pythran,serge-sans-paille/pythran,pombredanne/pythran,pombredanne/pythran,hainm/pythran,artas360/pythran,artas360/pythran,serge-sans-paille/pythran,hainm/pythran,pbrunet/pythran,artas360/pythran,hainm/pythran,pombredanne/pythran,pbrunet/pythran
--- +++ @@ -0,0 +1,11 @@ +#pythran export list_comp(int list list) +#runas list_comp([[], [], [1]]) + +def foo(cc, x, y): + for a in cc: + if a: + return True + return False + +def list_comp(cc): + return [(x,y) for x in range(1) for y in range(2) if foo(cc, x, y)]
29bc58359f2468ef488563abb4f2d1974e848b1c
py/second-minimum-node-in-a-binary-tree.py
py/second-minimum-node-in-a-binary-tree.py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def dfs(self, cur): if cur: if self.smallest is None: self.smallest = cur.val ...
Add py solution for 671. Second Minimum Node In a Binary Tree
Add py solution for 671. Second Minimum Node In a Binary Tree 671. Second Minimum Node In a Binary Tree: https://leetcode.com/problems/second-minimum-node-in-a-binary-tree/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,32 @@ +# Definition for a binary tree node. +# class TreeNode(object): +# def __init__(self, x): +# self.val = x +# self.left = None +# self.right = None + +class Solution(object): + def dfs(self, cur): + if cur: + if self.smallest is None: + ...
b4db8160e18ceedb3d7946c180fa8963d9e9755d
test/compute/test_backward_compatibility.py
test/compute/test_backward_compatibility.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
Add some basic tests for backward compatibility.
Add some basic tests for backward compatibility. git-svn-id: 353d90d4d8d13dcb4e0402680a9155a727f61a5a@1082028 13f79535-47bb-0310-9956-ffa450edef68
Python
apache-2.0
aleGpereira/libcloud,wido/libcloud,ClusterHQ/libcloud,cryptickp/libcloud,sfriesel/libcloud,Kami/libcloud,supertom/libcloud,ZuluPro/libcloud,carletes/libcloud,mistio/libcloud,techhat/libcloud,aleGpereira/libcloud,andrewsomething/libcloud,lochiiconnectivity/libcloud,ninefold/libcloud,Cloud-Elasticity-Services/as-libcloud...
--- +++ @@ -0,0 +1,53 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (...
f6ef0ebbd71e684f803c0d5c0f1a3da0c65a13d6
migrations/versions/0158_remove_rate_limit_default.py
migrations/versions/0158_remove_rate_limit_default.py
""" Revision ID: 0158_remove_rate_limit_default Revises: 0157_add_rate_limit_to_service Create Date: 2018-01-09 14:33:08.313893 """ from alembic import op import sqlalchemy as sa revision = '0158_remove_rate_limit_default' down_revision = '0157_add_rate_limit_to_service' def upgrade(): op.execute("ALTER TABLE...
Remove database default on rate_limit column
Remove database default on rate_limit column The default for the rate_limit column in the services and services_history model is now set in the model, so we can remove the default from the database. Pivotal story: https://www.pivotaltracker.com/story/show/153992529
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,22 @@ +""" + +Revision ID: 0158_remove_rate_limit_default +Revises: 0157_add_rate_limit_to_service +Create Date: 2018-01-09 14:33:08.313893 + +""" +from alembic import op +import sqlalchemy as sa + + +revision = '0158_remove_rate_limit_default' +down_revision = '0157_add_rate_limit_to_service' + + ...
422488c1bd9f54f6899ca51806b6b072ba45d18b
mediacloud/mediawords/db/export/test_export_tables.py
mediacloud/mediawords/db/export/test_export_tables.py
from io import StringIO from mediawords.db import connect_to_db from mediawords.db.export.export_tables import * def test_export_tables_to_backup_crawler(): # Basic sanity test to make sure something gets printed out to STDOUT # FIXME it would be better to try importing the resulting dump somewhere db = ...
Add basic sanity test for export_tables_to_backup_crawler()
Add basic sanity test for export_tables_to_backup_crawler()
Python
agpl-3.0
berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud
--- +++ @@ -0,0 +1,26 @@ +from io import StringIO + +from mediawords.db import connect_to_db +from mediawords.db.export.export_tables import * + + +def test_export_tables_to_backup_crawler(): + # Basic sanity test to make sure something gets printed out to STDOUT + # FIXME it would be better to try importing th...
5484e1acb69d8a7238bbfa1056551867f9d52525
webtool/server/migrations/0013_auto_20171111_0435.py
webtool/server/migrations/0013_auto_20171111_0435.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-11-11 03:35 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('server', '0012_auto_20171109_...
Improve category filter for activities
Improve category filter for activities
Python
bsd-2-clause
wodo/WebTool3,wodo/WebTool3,wodo/WebTool3,wodo/WebTool3
--- +++ @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-11-11 03:35 +from __future__ import unicode_literals + +import django.core.validators +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ ...
3a28809b5a642d14d7174c8a309b130822d30e72
skan/test/test_csr.py
skan/test/test_csr.py
import os, sys import numpy as np from numpy.testing import assert_equal, assert_almost_equal from skan import csr rundir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(rundir) from skan._testdata import tinycycle, skeleton1 def test_tiny_cycle(): g, idxs, degimg = csr.skeleton_to_csgraph(tinycycl...
Add incomplete test file for CSR
Add incomplete test file for CSR
Python
bsd-3-clause
jni/skan
--- +++ @@ -0,0 +1,30 @@ +import os, sys +import numpy as np +from numpy.testing import assert_equal, assert_almost_equal +from skan import csr + +rundir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(rundir) + +from skan._testdata import tinycycle, skeleton1 + + +def test_tiny_cycle(): + g, idxs, d...
087d33b85381c0096be583bbae67ab0030a90f4f
python/tkinter/python3/keyboard_events.py
python/tkinter/python3/keyboard_events.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including witho...
Add a snippet (Python physics).
Add a snippet (Python physics).
Python
mit
jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets
--- +++ @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software w...
493f6ccfe05bd2b06c21f2a70c552a79be2a3f67
py/guess-number-higher-or-lower.py
py/guess-number-higher-or-lower.py
# The guess API is already defined for you. # @param num, your guess # @return -1 if my number is lower, 1 if my number is higher, otherwise return 0 # def guess(num): class Solution(object): def guessNumber(self, n): """ :type n: int :rtype: int """ L, U = 0, n + 1 ...
Add py solution for 374. Guess Number Higher or Lower
Add py solution for 374. Guess Number Higher or Lower 374. Guess Number Higher or Lower: https://leetcode.com/problems/guess-number-higher-or-lower/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,21 @@ +# The guess API is already defined for you. +# @param num, your guess +# @return -1 if my number is lower, 1 if my number is higher, otherwise return 0 +# def guess(num): + +class Solution(object): + def guessNumber(self, n): + """ + :type n: int + :rtype: int + ...
89fa1ce2fbf16a65d78a8d7bf0f0600240500630
html/cli-html-tag-stripper.py
html/cli-html-tag-stripper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import urllib2 from HTMLParser import HTMLParser # HTML Tag Stripper class class HTMLTagStripper(HTMLParser): def __init__(self): self.reset() self.data = [] self.isScriptTag = False self.isStyleTag = False def handle_starttag(sel...
Add HTML tag stripper/remover (also remove <script> and <style> contents)
Add HTML tag stripper/remover (also remove <script> and <style> contents)
Python
mit
rawswift/python-collections
--- +++ @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import urllib2 +from HTMLParser import HTMLParser + +# HTML Tag Stripper class +class HTMLTagStripper(HTMLParser): + + def __init__(self): + self.reset() + self.data = [] + self.isScriptTag = False + self.isStyl...
2f5c0a9ee004c4ba48724a987b9f8fa93fbbab2e
src/ecu.py
src/ecu.py
#!/usr/bin/env python3 # coding=utf-8 import serial class EcuCollector(): SENTINEL = b'X' RESPONSE_LENGTH = 91 def __init__(self, port, baudrate=9600): self.port = port self.serial_conn = serial.Serial(port, baudrate) def get_data(self): """ Reads data from the ECU...
Add collection class for stealing data from the ECU
Add collection class for stealing data from the ECU
Python
epl-1.0
MSOE-Supermileage/datacollector,MSOE-Supermileage/datacollector,MSOE-Supermileage/datacollector
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +# coding=utf-8 + +import serial + + +class EcuCollector(): + SENTINEL = b'X' + RESPONSE_LENGTH = 91 + + + def __init__(self, port, baudrate=9600): + self.port = port + self.serial_conn = serial.Serial(port, baudrate) + + + def get_data(self):...
31822d7cdc77647bf06d2b3d32c6e72c80f55815
opal/management/commands/create_singletons.py
opal/management/commands/create_singletons.py
""" Create singletons that may have been dropped """ import collections import json from optparse import make_option from django.contrib.contenttypes.models import ContentType from django.core.management.base import BaseCommand from opal.models import Patient, Episode, PatientSubrecord, EpisodeSubrecord class Comman...
Add a management command to create trailing singletons.
Add a management command to create trailing singletons.
Python
agpl-3.0
khchine5/opal,khchine5/opal,khchine5/opal
--- +++ @@ -0,0 +1,31 @@ +""" +Create singletons that may have been dropped +""" +import collections +import json +from optparse import make_option + +from django.contrib.contenttypes.models import ContentType +from django.core.management.base import BaseCommand + +from opal.models import Patient, Episode, PatientSub...
d6d4601a5a1238cf7d2f0a6bdf782a77318d28a3
tests_django/integration_tests/test_output_adapter_integration.py
tests_django/integration_tests/test_output_adapter_integration.py
from django.test import TestCase from chatterbot.ext.django_chatterbot.models import Statement class OutputIntegrationTestCase(TestCase): """ Tests to make sure that output adapters function correctly when using Django. """ def test_output_format_adapter(self): from chatterbot.output impo...
Test that the output format adapter works with Django
Test that the output format adapter works with Django
Python
bsd-3-clause
vkosuri/ChatterBot,Reinaesaya/OUIRL-ChatBot,maclogan/VirtualPenPal,gunthercox/ChatterBot,davizucon/ChatterBot,Gustavo6046/ChatterBot,Reinaesaya/OUIRL-ChatBot
--- +++ @@ -0,0 +1,19 @@ +from django.test import TestCase +from chatterbot.ext.django_chatterbot.models import Statement + + +class OutputIntegrationTestCase(TestCase): + """ + Tests to make sure that output adapters + function correctly when using Django. + """ + + def test_output_format_adapter(self...
bb70a98437c87fa5b9677716acbcbd948d93f982
tests/syft/grid/messages/setup_msg_test.py
tests/syft/grid/messages/setup_msg_test.py
# syft absolute import syft as sy from syft.core.io.address import Address from syft.grid.messages.setup_messages import CreateInitialSetUpMessage from syft.grid.messages.setup_messages import CreateInitialSetUpResponse from syft.grid.messages.setup_messages import GetSetUpMessage from syft.grid.messages.setup_messages...
ADD PyGrid SetupService message tests
ADD PyGrid SetupService message tests
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
--- +++ @@ -0,0 +1,106 @@ +# syft absolute +import syft as sy +from syft.core.io.address import Address +from syft.grid.messages.setup_messages import CreateInitialSetUpMessage +from syft.grid.messages.setup_messages import CreateInitialSetUpResponse +from syft.grid.messages.setup_messages import GetSetUpMessage +fro...
039afd96fd66844e3d0ac031458c976d74aca325
infra/bots/recipe_modules/flavor/__init__.py
infra/bots/recipe_modules/flavor/__init__.py
# Copyright 2016 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. DEPS = [ 'builder_name_schema', 'depot_tools/bot_update', 'depot_tools/cipd', 'depot_tools/gclient', 'depot_tools/git', 'docker', 'env', 'inf...
# Copyright 2016 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. DEPS = [ 'builder_name_schema', 'docker', 'env', 'infra', 'recipe_engine/context', 'recipe_engine/file', 'recipe_engine/json', 'recipe_engine...
Remove unnecessary depot_tools dependency in flavor module
[recipes] Remove unnecessary depot_tools dependency in flavor module Change-Id: Ic1f3896a450bd81bb8c4859d3998c9873af821f6 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263016 Reviewed-by: Ravi Mistry <9fa2e7438b8cb730f96b74865492597170561628@google.com> Commit-Queue: Eric Boren <0e499112533c8544f0505ea0d0...
Python
bsd-3-clause
HalCanary/skia-hc,google/skia,aosp-mirror/platform_external_skia,HalCanary/skia-hc,google/skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,google/skia,HalCanary/skia-hc,google/skia,aosp-mirror/platform_external_skia,HalCanary/ski...
--- +++ @@ -4,10 +4,6 @@ DEPS = [ 'builder_name_schema', - 'depot_tools/bot_update', - 'depot_tools/cipd', - 'depot_tools/gclient', - 'depot_tools/git', 'docker', 'env', 'infra',
8aa36c52a2a2e3e24b5d36251416ecd4a9aba0f1
utils/logstats.py
utils/logstats.py
import re import sys from collections import Counter def oneof(strs): return "(?:%s)" % "|".join(strs) BRIDGE_REGEX = r"# bridge out of Guard (0x[0-9a-fA-f]*) with \d* ops" bridge_regex = re.compile(BRIDGE_REGEX) def main(args): for fname in sorted(args): with open(fname, 'r') as infile: ...
Add trace log stats extractor
Add trace log stats extractor
Python
mit
samth/pycket,magnusmorton/pycket,magnusmorton/pycket,magnusmorton/pycket,pycket/pycket,pycket/pycket,pycket/pycket,cderici/pycket,cderici/pycket,samth/pycket,cderici/pycket,samth/pycket
--- +++ @@ -0,0 +1,35 @@ + +import re +import sys + +from collections import Counter + +def oneof(strs): + return "(?:%s)" % "|".join(strs) + +BRIDGE_REGEX = r"# bridge out of Guard (0x[0-9a-fA-f]*) with \d* ops" +bridge_regex = re.compile(BRIDGE_REGEX) + +def main(args): + for fname in sorted(args): + + ...
7279b4f4a96472cd78bfb645b8c6d0aac4290fd7
Exscript/protocols/drivers/cienasaos.py
Exscript/protocols/drivers/cienasaos.py
""" A driver for Ciena SAOS carrier ethernet devices """ import re from Exscript.protocols.drivers.driver import Driver _user_re = [re.compile(r'[^:]* login: ?$', re.I)] _password_re = [re.compile(r'Password: ?$')] _prompt_re = [re.compile(r'[\r\n][\-\w+\.:/]+[>#] ?$')] _error_re = [re.compile(r'SHELL PARSER FAILURE')...
Add a driver for Ciena SAOS devices
Add a driver for Ciena SAOS devices Ciena carrier ethernet devices - previous Worldwide Packets
Python
mit
knipknap/exscript,maximumG/exscript,knipknap/exscript,maximumG/exscript
--- +++ @@ -0,0 +1,32 @@ +""" +A driver for Ciena SAOS carrier ethernet devices +""" +import re +from Exscript.protocols.drivers.driver import Driver + +_user_re = [re.compile(r'[^:]* login: ?$', re.I)] +_password_re = [re.compile(r'Password: ?$')] +_prompt_re = [re.compile(r'[\r\n][\-\w+\.:/]+[>#] ?$')] +_error_re =...
60edb041e6096f37cc451acb77a44f421c37d910
tests/cupy_tests/core_tests/test_core.py
tests/cupy_tests/core_tests/test_core.py
import unittest import cupy from cupy.core import core class TestGetSize(unittest.TestCase): def test_none(self): self.assertEqual(core.get_size(None), ()) def test_list(self): self.assertEqual(core.get_size([1, 2]), (1, 2)) def test_tuple(self): self.assertEqual(core.get_size(...
Write test for core module of cupy
Write test for core module of cupy
Python
mit
delta2323/chainer,AlpacaDB/chainer,benob/chainer,okuta/chainer,niboshi/chainer,benob/chainer,muupan/chainer,hvy/chainer,t-abe/chainer,chainer/chainer,kiyukuta/chainer,cupy/cupy,muupan/chainer,AlpacaDB/chainer,ktnyt/chainer,anaruse/chainer,jnishi/chainer,ysekky/chainer,wkentaro/chainer,t-abe/chainer,chainer/chainer,jnis...
--- +++ @@ -0,0 +1,93 @@ +import unittest + +import cupy +from cupy.core import core + + +class TestGetSize(unittest.TestCase): + + def test_none(self): + self.assertEqual(core.get_size(None), ()) + + def test_list(self): + self.assertEqual(core.get_size([1, 2]), (1, 2)) + + def test_tuple(self...
44023406197bd9271afd60405e323503ce6963a1
tests/test_nova_api_docs_tracker.py
tests/test_nova_api_docs_tracker.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_nova_api_docs_tracker ---------------------------------- Tests for `nova_api_docs_tracker` module. """ import unittest from nova_api_docs_tracker import nova_api_docs_tracker class TestNova_api_docs_tracker(unittest.TestCase): def setUp(self): pa...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_nova_api_docs_tracker ---------------------------------- Tests for `nova_api_docs_tracker` module. """ import unittest from nova_api_docs_tracker import main class TestNova_api_docs_tracker(unittest.TestCase): def setUp(self): pass def tearD...
Fix stub unit test for main.py rename
Fix stub unit test for main.py rename
Python
apache-2.0
missaugustina/nova-api-docs-tracker,missaugustina/nova-api-docs-tracker,missaugustina/nova-api-docs-tracker,missaugustina/nova-api-docs-tracker
--- +++ @@ -10,7 +10,7 @@ import unittest -from nova_api_docs_tracker import nova_api_docs_tracker +from nova_api_docs_tracker import main class TestNova_api_docs_tracker(unittest.TestCase):
06804a64167ee09a7cf9c1681267223b2ce187e2
tests/test_core/test_wsservercomms.py
tests/test_core/test_wsservercomms.py
import unittest from pkg_resources import require from malcolm.core.wscomms.wsservercomms import WSServerComms require("mock") from mock import MagicMock class TestWSServerComms(unittest.TestCase): def test_send_to_client(self): process = MagicMock() ws = WSServerComms("Socket", process, objec...
Remove context from Request to_dict, add Request from_dict
Remove context from Request to_dict, add Request from_dict
Python
apache-2.0
dls-controls/pymalcolm,dls-controls/pymalcolm,dls-controls/pymalcolm
--- +++ @@ -0,0 +1,17 @@ +import unittest + +from pkg_resources import require + +from malcolm.core.wscomms.wsservercomms import WSServerComms + +require("mock") +from mock import MagicMock + + +class TestWSServerComms(unittest.TestCase): + + def test_send_to_client(self): + process = MagicMock() + w...
b612c3703a3b1581bfc7826f1e29a3b6053f0f4e
pal/services/joke_service.py
pal/services/joke_service.py
import re from os import path from pal.services.service import Service from pal.services.service import wrap_response def get_jokes(): file_path = path.realpath(path.join(path.dirname(__file__), "jokes.txt")) with open(file_path, 'rb') as joke_file: for line in...
import re from os import path from pal.services.service import Service from pal.services.service import wrap_response def get_jokes(): file_path = path.realpath(path.join(path.dirname(__file__), "jokes.txt")) with open(file_path, 'rb') as joke_file: for line in...
Make joke parsing more robust
Make joke parsing more robust
Python
bsd-3-clause
Machyne/pal,Machyne/pal,Machyne/pal,Machyne/pal
--- +++ @@ -12,7 +12,8 @@ for line in joke_file.readlines(): if line.startswith("#"): continue - yield line.strip().split(" :: ", 1) + prompt, response = map(str.strip, line.split("::", 1)) + yield prompt, response.replace("\\n", "\n") class...
5b9d718cd02581659a8ab65c399ecf02884ae28c
scorecard/tests/indicators/test_income_adjustments.py
scorecard/tests/indicators/test_income_adjustments.py
from django.test import SimpleTestCase from ...profile_data.indicators import ( IncomeAdjustments, ) from collections import defaultdict class MockAPIData: references = defaultdict(lambda: "foobar") def __init__(self, results, years): self.results = results self.years = years class Revenu...
Add working test for minimal income adjustment functionality
Add working test for minimal income adjustment functionality
Python
mit
Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data
--- +++ @@ -0,0 +1,67 @@ +from django.test import SimpleTestCase +from ...profile_data.indicators import ( + IncomeAdjustments, +) +from collections import defaultdict + +class MockAPIData: + references = defaultdict(lambda: "foobar") + def __init__(self, results, years): + self.results = results + ...
f65eb2c5e3b07775285c231e5c211ef6739ac51a
nose2/tests/unit/test_options.py
nose2/tests/unit/test_options.py
from nose2 import options from nose2.compat import unittest class TestMultipassOptionParser(unittest.TestCase): def setUp(self): self.p = options.MultipassOptionParser() def test_parser_leaves_unhandled_arguments(self): args, argv = self.p.parse_args(['-x', 'foo', 'bar', '--this=that']) ...
Add unit tests for options module
Add unit tests for options module
Python
bsd-2-clause
little-dude/nose2,leth/nose2,ezigman/nose2,ptthiem/nose2,little-dude/nose2,leth/nose2,ojengwa/nose2,ojengwa/nose2,ptthiem/nose2,ezigman/nose2
--- +++ @@ -0,0 +1,45 @@ +from nose2 import options +from nose2.compat import unittest + + +class TestMultipassOptionParser(unittest.TestCase): + + def setUp(self): + self.p = options.MultipassOptionParser() + + def test_parser_leaves_unhandled_arguments(self): + args, argv = self.p.parse_args(['-...
b8598cf14e2c9d0be404082c0761b4abecf7f97d
bioagents/resources/make_trips_ontology.py
bioagents/resources/make_trips_ontology.py
import os import sys import xml.etree.ElementTree as ET from rdflib import Graph, Namespace, Literal trips_ns = Namespace('http://trips.ihmc.us/concepts/') isa_rel = Namespace('http://trips.ihmc.us/relations/').term('isa') def save_hierarchy(g, path): with open(path, 'wb') as out_file: g_bytes = g.seria...
Implement script to make TRIPS ontology
Implement script to make TRIPS ontology
Python
bsd-2-clause
sorgerlab/bioagents,bgyori/bioagents
--- +++ @@ -0,0 +1,47 @@ +import os +import sys +import xml.etree.ElementTree as ET +from rdflib import Graph, Namespace, Literal + + +trips_ns = Namespace('http://trips.ihmc.us/concepts/') +isa_rel = Namespace('http://trips.ihmc.us/relations/').term('isa') + + +def save_hierarchy(g, path): + with open(path, 'wb')...
b13c4be2c839618a91d199ad941411d70214e9bd
audio_pipeline/tb_ui/model/MoveFiles.py
audio_pipeline/tb_ui/model/MoveFiles.py
import os import subprocess class MoveFiles: def __init__(self, rule, copy): """ Move audiofiles to the appropriate destination directories, as determined by the 'rule' function passed to rule :param rule: :return: """ self.rule = rule self.copy = co...
Add script to move files (move this out of MetaControl)
Add script to move files (move this out of MetaControl)
Python
mit
hidat/audio_pipeline
--- +++ @@ -0,0 +1,74 @@ +import os +import subprocess + +class MoveFiles: + + def __init__(self, rule, copy): + """ + Move audiofiles to the appropriate destination directories, + as determined by the 'rule' function passed to rule + :param rule: + :return: + """ + ...
7a09d36448d646e29c8d0aeeb7c39df2d20885ab
test/unit/ggrc/models/test_states.py
test/unit/ggrc/models/test_states.py
"""Test Object State Module""" import unittest import ggrc.app # noqa pylint: disable=unused-import from ggrc.models import all_models class TestStates(unittest.TestCase): """Test Object State main Test Case class""" def _assert_states(self, models, expected_states, default): # pylint: disable=no-self-use ...
Add unit test for object state
Add unit test for object state
Python
apache-2.0
selahssea/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core
--- +++ @@ -0,0 +1,53 @@ +"""Test Object State Module""" + +import unittest +import ggrc.app # noqa pylint: disable=unused-import +from ggrc.models import all_models + + +class TestStates(unittest.TestCase): + """Test Object State main Test Case class""" + + def _assert_states(self, models, expected_states, defaul...
fadde85c5dac5509e1497aeaee97100cc9f5b3bd
tests/integration/test_with_ssl.py
tests/integration/test_with_ssl.py
from . import base class SSLTestCase(base.IntegrationTestCase): '''RabbitMQ integration test case.''' CTXT = { 'plugin.activemq.pool.1.port': 61614, 'plugin.activemq.pool.1.password': 'marionette', 'plugin.ssl_server_public': 'tests/fixtures/server-public.pem', 'plugin.ssl_clie...
Add integration tests for SSL security provider
Add integration tests for SSL security provider
Python
bsd-3-clause
rafaduran/python-mcollective,rafaduran/python-mcollective,rafaduran/python-mcollective,rafaduran/python-mcollective
--- +++ @@ -0,0 +1,24 @@ +from . import base + + +class SSLTestCase(base.IntegrationTestCase): + '''RabbitMQ integration test case.''' + CTXT = { + 'plugin.activemq.pool.1.port': 61614, + 'plugin.activemq.pool.1.password': 'marionette', + 'plugin.ssl_server_public': 'tests/fixtures/server-p...
5980d3bbff67d060a1a1b15372293ced972dbe8b
tests/test_pipelines.py
tests/test_pipelines.py
from twisted.internet import defer from twisted.internet.defer import Deferred from twisted.trial import unittest from scrapy import Spider, signals, Request from scrapy.utils.test import get_crawler from tests.mockserver import MockServer class SimplePipeline: def process_item(self, item, spider): item...
Add simple tests for pipelines.
Add simple tests for pipelines.
Python
bsd-3-clause
pawelmhm/scrapy,scrapy/scrapy,pawelmhm/scrapy,scrapy/scrapy,elacuesta/scrapy,dangra/scrapy,eLRuLL/scrapy,eLRuLL/scrapy,elacuesta/scrapy,eLRuLL/scrapy,elacuesta/scrapy,pablohoffman/scrapy,starrify/scrapy,dangra/scrapy,pawelmhm/scrapy,starrify/scrapy,scrapy/scrapy,dangra/scrapy,pablohoffman/scrapy,pablohoffman/scrapy,sta...
--- +++ @@ -0,0 +1,71 @@ +from twisted.internet import defer +from twisted.internet.defer import Deferred +from twisted.trial import unittest + +from scrapy import Spider, signals, Request +from scrapy.utils.test import get_crawler + +from tests.mockserver import MockServer + + +class SimplePipeline: + def process...
c4f1a3dd38e83c799dcd505f81b9b14308331cb6
gpi/BNI2BART_Traj_GPI.py
gpi/BNI2BART_Traj_GPI.py
# Author: Ashley Anderson III <aganders3@gmail.com> # Date: 2016-01-25 13:58 import numpy as np import gpi class ExternalNode(gpi.NodeAPI): """Transform coordinates from BNI conventions to BART conventions. INPUT: in - a numpy arrary of k-space coordinates in the BNI convention i.e. (-0.5...
Add node to convert BNI trajectories (e.g. from SpiralCoords) to BART trajectories.
Add node to convert BNI trajectories (e.g. from SpiralCoords) to BART trajectories.
Python
bsd-3-clause
nckz/bart,nckz/bart,nckz/bart,nckz/bart,nckz/bart
--- +++ @@ -0,0 +1,77 @@ +# Author: Ashley Anderson III <aganders3@gmail.com> +# Date: 2016-01-25 13:58 + +import numpy as np +import gpi + +class ExternalNode(gpi.NodeAPI): + """Transform coordinates from BNI conventions to BART conventions. + + INPUT: + in - a numpy arrary of k-space coordinates in the...
8e31bc9e750ac0f6b9bf4fd816ad3270e2f46d90
teamworkApp/lib/dbCalls.py
teamworkApp/lib/dbCalls.py
# muddersOnRails() # Sara McAllister November 5, 2-17 # Last updated: 11-5-2017 # library for SQLite database calls for teamwork analysis app import contextlib import sqlite3 DB = 'db/development.sqlite3' def connect(sqlite_file): """ Make connection to an SQLite database file """ conn = sqlite3.connect(sql...
Set up contextmanager for db cals
Set up contextmanager for db cals
Python
mit
nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis
--- +++ @@ -0,0 +1,35 @@ +# muddersOnRails() +# Sara McAllister November 5, 2-17 +# Last updated: 11-5-2017 + +# library for SQLite database calls for teamwork analysis app + +import contextlib +import sqlite3 + +DB = 'db/development.sqlite3' + +def connect(sqlite_file): + """ Make connection to an SQLite database...
66cdb36231ff1192a8a2e6b15c4b8d524cfbff6d
powerline/renderers/pango_markup.py
powerline/renderers/pango_markup.py
# vim:fileencoding=utf-8:noet from powerline.renderer import Renderer from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE from xmlrpclib import escape as _escape class PangoMarkupRenderer(Renderer): '''Powerline Pango markup segment renderer.''' @staticmethod def hlstyle(*args, **kwargs): ...
# vim:fileencoding=utf-8:noet from powerline.renderer import Renderer from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE from xml.sax.saxutils import escape as _escape class PangoMarkupRenderer(Renderer): '''Powerline Pango markup segment renderer.''' @staticmethod def hlstyle(*args, **kwa...
Use xml.sax.saxutils.escape in place of xmlrpclib.escape
Use xml.sax.saxutils.escape in place of xmlrpclib.escape The latter is not available in python 3
Python
mit
dragon788/powerline,xxxhycl2010/powerline,cyrixhero/powerline,s0undt3ch/powerline,S0lll0s/powerline,EricSB/powerline,prvnkumar/powerline,blindFS/powerline,QuLogic/powerline,lukw00/powerline,dragon788/powerline,firebitsbr/powerline,Liangjianghao/powerline,DoctorJellyface/powerline,wfscheper/powerline,wfscheper/powerline...
--- +++ @@ -3,7 +3,7 @@ from powerline.renderer import Renderer from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE -from xmlrpclib import escape as _escape +from xml.sax.saxutils import escape as _escape class PangoMarkupRenderer(Renderer):
2cc323c72d296c3264ed90f3f404c1e9d04f5575
ci/management/commands/update_event.py
ci/management/commands/update_event.py
from django.core.management.base import BaseCommand from ci import models from optparse import make_option import json, random from ci import event from django.conf import settings from django.core.urlresolvers import reverse import requests def get_rand(): return str(random.randint(1, 10000000000)) def do_post(jso...
Add a small utility for testing to update an event
Add a small utility for testing to update an event
Python
apache-2.0
idaholab/civet,brianmoose/civet,idaholab/civet,idaholab/civet,brianmoose/civet,brianmoose/civet,brianmoose/civet,idaholab/civet
--- +++ @@ -0,0 +1,52 @@ +from django.core.management.base import BaseCommand +from ci import models +from optparse import make_option +import json, random +from ci import event +from django.conf import settings +from django.core.urlresolvers import reverse +import requests + +def get_rand(): + return str(random.ran...
11c8b8c7e7e6a57148533ec6f9af138c4164d518
performance/us/kbase/workspace/performance/workspace/get_from_shock.py
performance/us/kbase/workspace/performance/workspace/get_from_shock.py
#!/usr/bin/env python import requests import time import sys from pymongo.mongo_client import MongoClient MONGO_DB = 'ws_test' SHOCK_HOST = 'http://localhost:7044' def main(): token = sys.argv[1] mcli = MongoClient() db = mcli[MONGO_DB] ws = -1 md5s = [] for ver in db.workspaceObjVersions.fi...
Add small script for calculating shock retrieval times
Add small script for calculating shock retrieval times
Python
mit
kbase/workspace_deluxe,MrCreosote/workspace_deluxe,kbase/workspace_deluxe,MrCreosote/workspace_deluxe,MrCreosote/workspace_deluxe,kbase/workspace_deluxe,MrCreosote/workspace_deluxe,kbase/workspace_deluxe,kbase/workspace_deluxe,kbase/workspace_deluxe,kbase/workspace_deluxe,MrCreosote/workspace_deluxe,MrCreosote/workspac...
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +import requests +import time +import sys +from pymongo.mongo_client import MongoClient + + +MONGO_DB = 'ws_test' +SHOCK_HOST = 'http://localhost:7044' + +def main(): + token = sys.argv[1] + mcli = MongoClient() + db = mcli[MONGO_DB] + ws = -1 + md5s = ...
dd9b7efa6e1255a26ae05ccab8e7ed19ac83961b
colour/examples/volume/examples_rgb.py
colour/examples/volume/examples_rgb.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Showcases RGB colourspace volume computations. """ from __future__ import division, unicode_literals import colour from colour.utilities.verbose import message_box message_box('RGB Colourspace Volume Computations') message_box('Computing "ProPhoto RGB" RGB coloursp...
Add "RGB" colorspace volume computation example.
Add "RGB" colorspace volume computation example.
Python
bsd-3-clause
colour-science/colour
--- +++ @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Showcases RGB colourspace volume computations. +""" + +from __future__ import division, unicode_literals + +import colour +from colour.utilities.verbose import message_box + +message_box('RGB Colourspace Volume Computations') + +message_...
29bbbc8ded596b19e5c090fc4264333126b9a995
datasets/management/commands/clear_store.py
datasets/management/commands/clear_store.py
from django.core.management.base import BaseCommand from utils.redis_store import store class Command(BaseCommand): help = 'Remove all keys stored in Redis Store. Use it as python manage.py clear_store' def add_arguments(self, parser): pass def handle(self, *args, **options): count = sto...
Add command to clear redis store contents
Add command to clear redis store contents
Python
agpl-3.0
MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets
--- +++ @@ -0,0 +1,13 @@ +from django.core.management.base import BaseCommand +from utils.redis_store import store + + +class Command(BaseCommand): + help = 'Remove all keys stored in Redis Store. Use it as python manage.py clear_store' + + def add_arguments(self, parser): + pass + + def handle(self, ...
295772657e61edf0dc10b3c5206248c6bfb6273f
py_naca0020_3d_openfoam/plotting.py
py_naca0020_3d_openfoam/plotting.py
""" Plotting functions. """ import matplotlib.pyplot as plt from .processing import * def plot_spanwise_pressure(ax=None): """Plot spanwise pressure, normalized and inverted.""" df = load_sampled_set("spanwise", "p") df["p_norm"] = -df.p df.p_norm -= df.p_norm.min() df.p_norm /= df.p_norm.max() ...
Add function to plot spanwise pressure
Add function to plot spanwise pressure
Python
mit
petebachant/actuatorLine-3D-turbinesFoam,petebachant/actuatorLine-3D-turbinesFoam,petebachant/actuatorLine-3D-turbinesFoam,petebachant/NACA0020-3D-OpenFOAM,petebachant/NACA0020-3D-OpenFOAM,petebachant/NACA0020-3D-OpenFOAM
--- +++ @@ -0,0 +1,19 @@ +""" +Plotting functions. +""" + +import matplotlib.pyplot as plt +from .processing import * + + +def plot_spanwise_pressure(ax=None): + """Plot spanwise pressure, normalized and inverted.""" + df = load_sampled_set("spanwise", "p") + df["p_norm"] = -df.p + df.p_norm -= df.p_norm....
ef2507008bfc9e1adc3d4926a587e562a3eb8129
django/website/logframe/tests/test_admin.py
django/website/logframe/tests/test_admin.py
from mock import Mock from ..admin import SubIndicatorAdmin from ..models import SubIndicator def test_sub_indicator_admin_rsult_returns_indicator_result(): sub_indicator = Mock(indicator=Mock(result='result')) admin = SubIndicatorAdmin(SubIndicator, None) assert sub_indicator.indicator.result == admin....
Add test for SubIndicatorAdmin result method
Add test for SubIndicatorAdmin result method
Python
agpl-3.0
aptivate/kashana,aptivate/kashana,aptivate/alfie,daniell/kashana,daniell/kashana,aptivate/alfie,aptivate/kashana,daniell/kashana,daniell/kashana,aptivate/alfie,aptivate/kashana,aptivate/alfie
--- +++ @@ -0,0 +1,11 @@ +from mock import Mock + +from ..admin import SubIndicatorAdmin +from ..models import SubIndicator + + +def test_sub_indicator_admin_rsult_returns_indicator_result(): + sub_indicator = Mock(indicator=Mock(result='result')) + + admin = SubIndicatorAdmin(SubIndicator, None) + assert su...
8b847215c2ae071a4a2e402167e20fdd641b222d
xenserver/destroy_cached_images.py
xenserver/destroy_cached_images.py
""" destroy_cached_images.py This script is used to clean up Glance images that are cached in the SR. By default, this script will only cleanup unused cached images. Options: --dry_run - Don't actually destroy the VDIs --all_cached - Destroy all cached images instead of just unused cached ...
Add script to destroy cached images.
XenAPI: Add script to destroy cached images. Operations will want the ability to clear out cached images when disk-space becomes an issue. This script allows ops to clear out all cached images or just cached images that aren't in current use. Change-Id: If87bd10ef3f893c416d2f0615358ba65aef17a2d
Python
apache-2.0
emonty/oslo-hacking,zancas/hacking,zancas/hacking,emonty/oslo-hacking,hyakuhei/cleantox,hyakuhei/cleantox,openstack-dev/hacking,openstack-dev/hacking
--- +++ @@ -0,0 +1,68 @@ +""" +destroy_cached_images.py + +This script is used to clean up Glance images that are cached in the SR. By +default, this script will only cleanup unused cached images. + +Options: + + --dry_run - Don't actually destroy the VDIs + --all_cached - Destroy all cached images instead of j...
e2caa28af50b5c053b8da248c3b05b3a3bb33be0
shapely/tests/test_collection.py
shapely/tests/test_collection.py
import unittest from shapely.geometry.collection import GeometryCollection class CollectionTestCase(unittest.TestCase): def test_array_interface(self): m = GeometryCollection() self.failUnlessEqual(len(m), 0) def test_suite(): return unittest.TestLoader().loadTestsFromTestCase(CollectionTestCa...
Add test of empty geometry collection creation.
Add test of empty geometry collection creation. git-svn-id: 1a8067f95329a7fca9bad502d13a880b95ac544b@1599 b426a367-1105-0410-b9ff-cdf4ab011145
Python
bsd-3-clause
mindw/shapely,mouadino/Shapely,mouadino/Shapely,mindw/shapely,abali96/Shapely,jdmcbr/Shapely,jdmcbr/Shapely,abali96/Shapely
--- +++ @@ -0,0 +1,10 @@ +import unittest +from shapely.geometry.collection import GeometryCollection + +class CollectionTestCase(unittest.TestCase): + def test_array_interface(self): + m = GeometryCollection() + self.failUnlessEqual(len(m), 0) + +def test_suite(): + return unittest.TestLoader().l...
57c55df6e848b7e43cc306ae9ae05363de766df9
pymt/framework/tests/test_bmi_time_units.py
pymt/framework/tests/test_bmi_time_units.py
from nose.tools import assert_equal from pymt.framework.bmi_bridge import _BmiCap class SimpleTimeBmi(): def get_time_units(self): return 0, 'h' def get_start_time(self): return 0, 1. def get_current_time(self): return 0, 10.5 def get_end_time(self): return 0, 72 ...
Add tests for time units methods.
Add tests for time units methods.
Python
mit
csdms/pymt,csdms/coupling,csdms/coupling
--- +++ @@ -0,0 +1,60 @@ +from nose.tools import assert_equal + +from pymt.framework.bmi_bridge import _BmiCap + + +class SimpleTimeBmi(): + def get_time_units(self): + return 0, 'h' + + def get_start_time(self): + return 0, 1. + + def get_current_time(self): + return 0, 10.5 + + def ...
8a48b9517a844a426319f584ea27ba341d79c8b0
tests/pytests/unit/runners/test_spacewalk.py
tests/pytests/unit/runners/test_spacewalk.py
""" Unit tests for Spacewalk runner """ import salt.runners.spacewalk as spacewalk from tests.support.mock import Mock, call, patch def test_api_command_must_have_namespace(): _get_session_mock = Mock(return_value=(None, None)) with patch.object(spacewalk, "_get_session", _get_session_mock): result =...
Add spacewalk runner command parsing tests
Add spacewalk runner command parsing tests
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,47 @@ +""" +Unit tests for Spacewalk runner +""" +import salt.runners.spacewalk as spacewalk +from tests.support.mock import Mock, call, patch + + +def test_api_command_must_have_namespace(): + _get_session_mock = Mock(return_value=(None, None)) + + with patch.object(spacewalk, "_get_session"...
58f8c6b28014122fc8dcd8ec41e3dd817de2e017
openstack/tests/functional/network/v2/test_router_add_remove_interface.py
openstack/tests/functional/network/v2/test_router_add_remove_interface.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add functional tests for add & remove router interface
Add functional tests for add & remove router interface Change-Id: If0616ebd088d3840ca09fbc95494f455b85c1967
Python
apache-2.0
stackforge/python-openstacksdk,briancurtin/python-openstacksdk,dudymas/python-openstacksdk,dudymas/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,dtroyer/python-openstacksdk,mtougeron/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-openstacksdk,openstack/python-opensta...
--- +++ @@ -0,0 +1,73 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writi...
c426e8845632d13f27b1cbc71d2c13292cc88711
buildbucket.py
buildbucket.py
#!/usr/bin/env python # Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Tool for interacting with Buildbucket. Usage: $ depot-tools-auth login https://cr-buildbucket.appspot.com $ buildbucket.py ...
Add script for triggering Buildbucket builds
Add script for triggering Buildbucket builds BUG=493885 TESTED=See https://paste.googleplex.com/5622248052359168 Review URL: https://codereview.chromium.org/1164363003 git-svn-id: bd64dd6fa6f3f0ed0c0666d1018379882b742947@295569 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Python
bsd-3-clause
svn2github/chromium-depot-tools,svn2github/chromium-depot-tools,svn2github/chromium-depot-tools
--- +++ @@ -0,0 +1,103 @@ +#!/usr/bin/env python +# Copyright (c) 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Tool for interacting with Buildbucket. + +Usage: + $ depot-tools-auth login https://cr-buildb...
9790c81d5b1d0a265c75f191320cb4cb22dfbd27
addons/hw_drivers/drivers/KeyboardUSBDriver.py
addons/hw_drivers/drivers/KeyboardUSBDriver.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import evdev import logging from usb import util from odoo import _ from odoo.addons.hw_drivers.controllers.driver import event_manager, Driver _logger = logging.getLogger(__name__) class KeyboardUSBDriver(Driver): ...
Move Keyboard driver to Community
[IMP] hw_drivers: Move Keyboard driver to Community The KeyboardUSBDriver will be transformed to integrate barcode scanners. The barcode scanners will be used in Community so we move the driver in Community. TaskID: 1961025
Python
agpl-3.0
ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo
--- +++ @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import evdev +import logging +from usb import util + +from odoo import _ +from odoo.addons.hw_drivers.controllers.driver import event_manager, Driver + +_logger = logging.getLogger(__name__...
8a58e8052c2873181278100de575a24392fe0299
CodeFights/depositProfit.py
CodeFights/depositProfit.py
#!/usr/local/bin/python # Code Fights Deposit Profit Problem def depositProfit(deposit, rate, threshold): years = 0 while deposit < threshold: deposit *= 1 + rate / 100 years += 1 return years def main(): tests = [ [100, 20, 170, 3], [100, 1, 101, 1], [1, 100...
Solve Code Fights deposit profit problem
Solve Code Fights deposit profit problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,32 @@ +#!/usr/local/bin/python +# Code Fights Deposit Profit Problem + + +def depositProfit(deposit, rate, threshold): + years = 0 + while deposit < threshold: + deposit *= 1 + rate / 100 + years += 1 + + return years + + +def main(): + tests = [ + [100, 20, 170, 3]...
b8b1347ef623507f0a8bf6753535d0b3bad217bb
pombola/south_africa/management/commands/south_africa_export_na_members.py
pombola/south_africa/management/commands/south_africa_export_na_members.py
"""Export a CSV listing National Assembly members with term dates.""" import unicodecsv as csv import os import collections from pombola.core.models import Person, Organisation from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): args = 'destination' help = 'Export ...
Add script to export NA members and their position start/end dates
Add script to export NA members and their position start/end dates
Python
agpl-3.0
mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola
--- +++ @@ -0,0 +1,58 @@ +"""Export a CSV listing National Assembly members with term dates.""" + +import unicodecsv as csv +import os +import collections + +from pombola.core.models import Person, Organisation + +from django.core.management.base import BaseCommand, CommandError + + +class Command(BaseCommand): + ...
0d9656bf5031f3a4d393bf81f8322909ba48110b
radio/migrations/0026_auto_20170305_1336.py
radio/migrations/0026_auto_20170305_1336.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2017-03-05 21:36 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('radio', '0025_unit_slug'), ] operations = [ migrations.AlterField( ...
Add DB migration to remove unique on TalkGroup dec_id
Add DB migration to remove unique on TalkGroup dec_id
Python
mit
ScanOC/trunk-player,ScanOC/trunk-player,ScanOC/trunk-player,ScanOC/trunk-player
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2017-03-05 21:36 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('radio', '0025_unit_slug'), + ] + + operations = [...
696c9f81590eff6a127eed91257517cb0e37c81c
CodeFights/primeSum.py
CodeFights/primeSum.py
#!/usr/local/bin/python # Code Fights Prime Sum Problem def primeSum(a, b): return sum(filter(lambda p: p > 1 and all(p % n for n in range(2, int(p**0.5) + 1)), range(a, b + 1))) def main(): tests = [ [10, 20, 60], [1, 7, 17], [5, 10, 12], [24, 28, 0], ...
Solve Code Fights prime sum problem
Solve Code Fights prime sum problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,31 @@ +#!/usr/local/bin/python +# Code Fights Prime Sum Problem + + +def primeSum(a, b): + return sum(filter(lambda p: p > 1 and all(p % n for n in + range(2, int(p**0.5) + 1)), range(a, b + 1))) + + +def main(): + tests = [ + [10, 20, 60], + [1, 7, 17], + [...
33282c65743c86cbad38160b801e7155ab16c60f
tests/data_checks/test_gwas_catalog_coverage.py
tests/data_checks/test_gwas_catalog_coverage.py
# ------------------------------------------------ # built-ins import unittest # local from utils.base import TestPostgapBase # ------------------------------------------------ class TestGWASCatalogCoverage(TestPostgapBase): def test_each_gwas_efo_covered(self): self.skipTest('EACH GWAS EFO ID COVERED IN...
Add placeholder for gwas catalog coverage
Add placeholder for gwas catalog coverage
Python
apache-2.0
Ensembl/cttv024,Ensembl/cttv024
--- +++ @@ -0,0 +1,19 @@ +# ------------------------------------------------ +# built-ins +import unittest + +# local +from utils.base import TestPostgapBase +# ------------------------------------------------ + +class TestGWASCatalogCoverage(TestPostgapBase): + + def test_each_gwas_efo_covered(self): + sel...
197c0fc802bd6936790500339fa64cbded18ab46
letsmeet/main/templatetags/rich_text.py
letsmeet/main/templatetags/rich_text.py
import bleach import markdown from django import template from django.utils.safestring import mark_safe register = template.Library() ALLOWED_TAGS = [ 'a', 'abbr', 'acronym', 'b', 'blockquote', 'code', 'em', 'i', 'li', 'ol', 'strong', 'ul', 'p', 'table', 'tb...
Add a templatetag to display markdown
Add a templatetag to display markdown
Python
mit
letsmeet-click/letsmeet.click,letsmeet-click/letsmeet.click,letsmeet-click/letsmeet.click,letsmeet-click/letsmeet.click
--- +++ @@ -0,0 +1,54 @@ +import bleach +import markdown +from django import template +from django.utils.safestring import mark_safe + +register = template.Library() + +ALLOWED_TAGS = [ + 'a', + 'abbr', + 'acronym', + 'b', + 'blockquote', + 'code', + 'em', + 'i', + 'li', + 'ol', + 'st...
c9c230c2da15fcef5352a67018f43a445caa5c35
zerver/migrations/0409_set_default_for_can_remove_subscribers_group.py
zerver/migrations/0409_set_default_for_can_remove_subscribers_group.py
# Generated by Django 3.2.13 on 2022-06-28 12:02 from django.db import migrations from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def set_default_value_for_can_remove_subscribers_group( apps: StateApps, schema_editor: BaseDatabaseSchemaEd...
Add migration to set default of can_remove_subscribers_group.
migrations: Add migration to set default of can_remove_subscribers_group. This migration sets can_remove_subscribers_group value to admins system group for all the existing streams. In further commit we would change can_remove_subscribers_group to be not null and thus we add this migration to ensure all existing strea...
Python
apache-2.0
rht/zulip,zulip/zulip,rht/zulip,andersk/zulip,andersk/zulip,zulip/zulip,andersk/zulip,rht/zulip,andersk/zulip,rht/zulip,rht/zulip,rht/zulip,zulip/zulip,zulip/zulip,zulip/zulip,rht/zulip,andersk/zulip,zulip/zulip,zulip/zulip,andersk/zulip,andersk/zulip
--- +++ @@ -0,0 +1,36 @@ +# Generated by Django 3.2.13 on 2022-06-28 12:02 + +from django.db import migrations +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor +from django.db.migrations.state import StateApps + + +def set_default_value_for_can_remove_subscribers_group( + apps: StateApps,...
950246b331c74700e01dc48a86f84bf47d528af3
var/spack/repos/builtin/packages/hdf/package.py
var/spack/repos/builtin/packages/hdf/package.py
from spack import * class Hdf(Package): """HDF4 (also known as HDF) is a library and multi-object file format for storing and managing data between machines.""" homepage = "https://www.hdfgroup.org/products/hdf4/" url = "https://www.hdfgroup.org/ftp/HDF/releases/HDF4.2.11/src/hdf-4.2.11.tar.gz" ...
from spack import * class Hdf(Package): """HDF4 (also known as HDF) is a library and multi-object file format for storing and managing data between machines.""" homepage = "https://www.hdfgroup.org/products/hdf4/" url = "https://www.hdfgroup.org/ftp/HDF/releases/HDF4.2.11/src/hdf-4.2.11.tar.gz" ...
Remove constraint on dependency version
Remove constraint on dependency version
Python
lgpl-2.1
TheTimmy/spack,EmreAtes/spack,lgarren/spack,TheTimmy/spack,LLNL/spack,krafczyk/spack,TheTimmy/spack,lgarren/spack,LLNL/spack,LLNL/spack,lgarren/spack,skosukhin/spack,TheTimmy/spack,mfherbst/spack,skosukhin/spack,iulian787/spack,skosukhin/spack,TheTimmy/spack,iulian787/spack,lgarren/spack,skosukhin/spack,matthiasdiener/...
--- +++ @@ -12,7 +12,7 @@ version('4.2.11', '063f9928f3a19cc21367b71c3b8bbf19') depends_on("jpeg") - depends_on("szip@2.1") + depends_on("szip") depends_on("zlib")
3dd7ba37476322a68a5488aab0eabe8f2cf88ec6
project/utility/alter.py
project/utility/alter.py
import jpype import jpype.imports jpype.startJVM() from java.util.jar import JarOutputStream from java.util.jar import JarInputStream from java.util.jar import JarFile from java.util.zip import CRC32 from java.io import File from java.io import FileInputStream from java.io import FileOutputStream jar = JarInputStream...
Remove PyPy 2 as well.
Remove PyPy 2 as well.
Python
apache-2.0
originell/jpype,originell/jpype,originell/jpype,originell/jpype,originell/jpype
--- +++ @@ -0,0 +1,46 @@ +import jpype +import jpype.imports +jpype.startJVM() + +from java.util.jar import JarOutputStream +from java.util.jar import JarInputStream +from java.util.jar import JarFile +from java.util.zip import CRC32 +from java.io import File +from java.io import FileInputStream +from java.io import ...
c98c9f11d886885110bf6a832595f5a814fa65b9
py/reshape-the-matrix.py
py/reshape-the-matrix.py
from operator import add class Solution(object): def matrixReshape(self, nums, r, c): """ :type nums: List[List[int]] :type r: int :type c: int :rtype: List[List[int]] """ if len(nums) == 0: return nums origR = len(nums) origC = len...
Add py solution for 566. Reshape the Matrix
Add py solution for 566. Reshape the Matrix 566. Reshape the Matrix: https://leetcode.com/problems/reshape-the-matrix/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,17 @@ +from operator import add +class Solution(object): + def matrixReshape(self, nums, r, c): + """ + :type nums: List[List[int]] + :type r: int + :type c: int + :rtype: List[List[int]] + """ + if len(nums) == 0: + return nums + ...