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
ffef9ccb5b7aa4c4ef8e06879c3ab7fd8030c882
corehq/apps/users/management/commands/accept_invite.py
corehq/apps/users/management/commands/accept_invite.py
from django.core.management.base import BaseCommand from corehq.apps.users.models import WebUser from corehq.apps.users.models import Invitation, CouchUser class Command(BaseCommand): help = "Accepts an invite into a domain for an existing web user" def add_arguments(self, parser): parser.add_argum...
Add a management command for accepting invites
Add a management command for accepting invites
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,33 @@ +from django.core.management.base import BaseCommand + +from corehq.apps.users.models import WebUser + +from corehq.apps.users.models import Invitation, CouchUser + + +class Command(BaseCommand): + help = "Accepts an invite into a domain for an existing web user" + + def add_arguments(s...
d92b757a3cd1ad56da4207740732d16076ce561c
comics/crawler/crawlers/gunshow.py
comics/crawler/crawlers/gunshow.py
from comics.crawler.base import BaseComicCrawler from comics.crawler.meta import BaseComicMeta class ComicMeta(BaseComicMeta): name = 'Gun Show' language = 'en' url = 'http://www.gunshowcomic.com/' start_date = '2008-09-04' history_capable_date = '2008-09-04' schedule = 'Mo,Tu,We,Th,Fr' rig...
Add crawler for 'Gun show'
Add crawler for 'Gun show'
Python
agpl-3.0
klette/comics,datagutten/comics,datagutten/comics,jodal/comics,jodal/comics,klette/comics,datagutten/comics,jodal/comics,klette/comics,datagutten/comics,jodal/comics
--- +++ @@ -0,0 +1,23 @@ +from comics.crawler.base import BaseComicCrawler +from comics.crawler.meta import BaseComicMeta + +class ComicMeta(BaseComicMeta): + name = 'Gun Show' + language = 'en' + url = 'http://www.gunshowcomic.com/' + start_date = '2008-09-04' + history_capable_date = '2008-09-04' + ...
5f6dfb8d6cf37bf6237e18423799c94dd2741ee3
ideascube/conf/kb_ifb_bdi.py
ideascube/conf/kb_ifb_bdi.py
# -*- coding: utf-8 -*- """KoomBook conf""" from .base import * # noqa from django.utils.translation import ugettext_lazy as _ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = bool(os.environ.get('DEBUG', True)) TEMPLATE_DEBUG = False ALLOWED_HOSTS = ['.koombook.lan.', 'localhost', '127.0...
Add conf file for ifb burundi
Add conf file for ifb burundi
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
--- +++ @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +"""KoomBook conf""" + +from .base import * # noqa +from django.utils.translation import ugettext_lazy as _ + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = bool(os.environ.get('DEBUG', True)) + +TEMPLATE_DEBUG = False + +ALLOWED_HOSTS ...
8f2f89129d24cdaa6bc37e4fec885ac78aa30ce4
test/automl/test_models.py
test/automl/test_models.py
# -*- encoding: utf-8 -*- from __future__ import print_function import unittest import mock from autosklearn.automl import AutoML from autosklearn.util.backend import Backend class AutoMLStub(object): def __init__(self): self.__class__ = AutoML class AutoMlModelsTest(unittest.TestCase): def setUp(...
Test AutoML usage of Backend to load models
Test AutoML usage of Backend to load models
Python
bsd-3-clause
automl/auto-sklearn,automl/auto-sklearn
--- +++ @@ -0,0 +1,49 @@ +# -*- encoding: utf-8 -*- +from __future__ import print_function +import unittest +import mock +from autosklearn.automl import AutoML +from autosklearn.util.backend import Backend + + +class AutoMLStub(object): + + def __init__(self): + self.__class__ = AutoML + + +class AutoMlMode...
05e95158055e869be3bf4e98af8521afc8321ec4
lintcode/Medium/116_Jump_Game.py
lintcode/Medium/116_Jump_Game.py
class Solution: # @param A, a list of integers # @return a boolean def canJump(self, A): # write your code here # Brute Force jumpable = [False] * len(A) jumpable[0] = True for i in range(len(A)): if (jumpable[i]): for j in range(1, A[i] +...
Add solution to lintcode question 116
Add solution to lintcode question 116
Python
mit
Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode
--- +++ @@ -0,0 +1,15 @@ +class Solution: + # @param A, a list of integers + # @return a boolean + def canJump(self, A): + # write your code here + + # Brute Force + jumpable = [False] * len(A) + jumpable[0] = True + for i in range(len(A)): + if (jumpable[i]): + ...
4a817aff14ca6bc9717bd617d5bc49d15e698272
teuthology/orchestra/test/test_console.py
teuthology/orchestra/test/test_console.py
from teuthology.config import config as teuth_config from .. import console class TestConsole(object): pass class TestPhysicalConsole(TestConsole): klass = console.PhysicalConsole def setup(self): teuth_config.ipmi_domain = 'ipmi_domain' teuth_config.ipmi_user = 'ipmi_user' teu...
Add some tests for the console module
Add some tests for the console module ... better late than never? Signed-off-by: Zack Cerza <d7cdf09fc0f0426e98c9978ee42da5d61fa54986@redhat.com>
Python
mit
ceph/teuthology,dmick/teuthology,SUSE/teuthology,dmick/teuthology,SUSE/teuthology,ktdreyer/teuthology,dmick/teuthology,ktdreyer/teuthology,ceph/teuthology,SUSE/teuthology
--- +++ @@ -0,0 +1,37 @@ +from teuthology.config import config as teuth_config + +from .. import console + + +class TestConsole(object): + pass + + +class TestPhysicalConsole(TestConsole): + klass = console.PhysicalConsole + + def setup(self): + teuth_config.ipmi_domain = 'ipmi_domain' + teuth_...
f55f555e4df4cc7423a76b1c73160250a1a279ab
migrations/versions/0165_another_letter_org.py
migrations/versions/0165_another_letter_org.py
"""empty message Revision ID: 0165_another_letter_org Revises: 0164_add_organisation_to_service Create Date: 2017-06-29 12:44:16.815039 """ # revision identifiers, used by Alembic. revision = '0165_another_letter_org' down_revision = '0164_add_organisation_to_service' from alembic import op NEW_ORGANISATIONS = [ ...
Add letter logo for Welsh Revenue Authority
Add letter logo for Welsh Revenue Authority Depends on: - [ ] https://github.com/alphagov/notifications-template-preview/pull/94
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,36 @@ +"""empty message + +Revision ID: 0165_another_letter_org +Revises: 0164_add_organisation_to_service +Create Date: 2017-06-29 12:44:16.815039 + +""" + +# revision identifiers, used by Alembic. +revision = '0165_another_letter_org' +down_revision = '0164_add_organisation_to_service' + +from al...
66cfc30621c7a2bc5ed8685cd25ec4973a21e6c5
migrations/versions/410_remove_empty_drafts.py
migrations/versions/410_remove_empty_drafts.py
"""Remove empty drafts Revision ID: 410_remove_empty_drafts Revises: 400_drop_agreement_returned Create Date: 2015-11-09 11:41:00.000000 """ # revision identifiers, used by Alembic. revision = '410_remove_empty_drafts' down_revision = '400_drop_agreement_returned' from alembic import op def upgrade(): op.exec...
Remove drafts with no serviceName
Remove drafts with no serviceName In production we have 1237 draft services from 806 suppliers that only have a lot selected but no other data. These have never been counted or shown to suppliers, but with the new lot changes for DOS they will be counted in G-7 draft services. This removes these lot-only drafts so t...
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
--- +++ @@ -0,0 +1,23 @@ +"""Remove empty drafts + +Revision ID: 410_remove_empty_drafts +Revises: 400_drop_agreement_returned +Create Date: 2015-11-09 11:41:00.000000 + +""" + +# revision identifiers, used by Alembic. +revision = '410_remove_empty_drafts' +down_revision = '400_drop_agreement_returned' + +from alembi...
449089dc4a62ca73c1f5022535e5cbd6a92445f4
build-cutline-map.py
build-cutline-map.py
#!/usr/bin/env python from osgeo import ogr from osgeo import osr from glob import glob import os.path driver = ogr.GetDriverByName("ESRI Shapefile") ds = driver.CreateDataSource("cutline-map.shp") srs = osr.SpatialReference() srs.ImportFromEPSG(4326) layer = ds.CreateLayer("tiles", srs, ogr.wkbPolygon) field_name ...
Add script to build cutline map
Add script to build cutline map
Python
mit
simonsonc/mn-glo-mosaic,simonsonc/mn-glo-mosaic,simonsonc/mn-glo-mosaic
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python +from osgeo import ogr +from osgeo import osr +from glob import glob +import os.path + +driver = ogr.GetDriverByName("ESRI Shapefile") +ds = driver.CreateDataSource("cutline-map.shp") + +srs = osr.SpatialReference() +srs.ImportFromEPSG(4326) + +layer = ds.CreateLayer("t...
2d951505dd210357921ee65004e24b33dbf47c43
examples/membership/counting_bloom_filter.py
examples/membership/counting_bloom_filter.py
"""Example how to use Counting Bloom Filter.""" from pdsa.membership.counting_bloom_filter import CountingBloomFilter LOREM_IPSUM = ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit." " Mauris consequat leo ut vehicula placerat. In lacinia, nisl" " id maximus auctor, sem elit interdum urna, at e...
Create example for Counting Bloom Filter
Create example for Counting Bloom Filter
Python
mit
gakhov/pdsa,gakhov/pdsa,gakhov/pdsa
--- +++ @@ -0,0 +1,41 @@ +"""Example how to use Counting Bloom Filter.""" + +from pdsa.membership.counting_bloom_filter import CountingBloomFilter + + +LOREM_IPSUM = ( + "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + " Mauris consequat leo ut vehicula placerat. In lacinia, nisl" + " id maximus ...
7db4c411c75fc8bbae5ac357c1fe28291d06bcb5
UM/Settings/ProfileReader.py
UM/Settings/ProfileReader.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.PluginObject import PluginObject class ProfileReader(PluginObject): def __init__(self): super().__init__() ## Read profile data from a file and return a filled profile. # # \return no...
Add profile reader plugin base class
Add profile reader plugin base class This class is identical to the mesh reader base class. It simply defines a read() function that will give an exception if the plugin is not implemented properly. Contributes to issue CURA-34.
Python
agpl-3.0
onitake/Uranium,onitake/Uranium
--- +++ @@ -0,0 +1,14 @@ +# Copyright (c) 2015 Ultimaker B.V. +# Uranium is released under the terms of the AGPLv3 or higher. + +from UM.PluginObject import PluginObject + +class ProfileReader(PluginObject): + def __init__(self): + super().__init__() + + ## Read profile data from a file and return a fil...
0e91d401848918043b23a3921de54c0eda618d00
createStateDecoded.py
createStateDecoded.py
settings = { "mappings": { "law": { "properties": { "text": { "type": "string", "term_vector": "with_positions_offsets_payloads" } } } }, "settings": { "index" : { "number_of_shards" : 1, "number_of_repli...
Add script to create statedecoded index
Add script to create statedecoded index
Python
apache-2.0
o19s/semantic-search-course
--- +++ @@ -0,0 +1,29 @@ + + +settings = { + "mappings": { + "law": { + "properties": { + "text": { + "type": "string", + "term_vector": "with_positions_offsets_payloads" + } + } + } + }, + "settings": { + "index" : { + "numb...
88d2b3f21b318559172e1595ba9209bd9d2a373f
mclearn/tests/test_aggregators.py
mclearn/tests/test_aggregators.py
from mclearn.aggregators import schulze_method class TestAggregators: @classmethod def setup_class(cls): cls.voters = \ [['A', 'C', 'B', 'E', 'D']] * 5 + \ [['A', 'D', 'E', 'C', 'B']] * 5 + \ [['B', 'E', 'D', 'A', 'C']] * 8 + \ [['C', 'A', 'B', 'E', 'D']...
Add test case for Schulze method
Add test case for Schulze method
Python
bsd-3-clause
chengsoonong/mclass-sky,chengsoonong/mclass-sky,alasdairtran/mclearn,alasdairtran/mclearn,chengsoonong/mclass-sky,chengsoonong/mclass-sky,alasdairtran/mclearn,alasdairtran/mclearn
--- +++ @@ -0,0 +1,21 @@ +from mclearn.aggregators import schulze_method + + +class TestAggregators: + @classmethod + def setup_class(cls): + cls.voters = \ + [['A', 'C', 'B', 'E', 'D']] * 5 + \ + [['A', 'D', 'E', 'C', 'B']] * 5 + \ + [['B', 'E', 'D', 'A', 'C']] * 8 + \ +...
1c54ef090dddb67e52dda00a6fd816807b33b5a3
migrations/versions/0203_fix_old_incomplete_jobs.py
migrations/versions/0203_fix_old_incomplete_jobs.py
"""empty message Revision ID: 0203_fix_old_incomplete_jobs Revises: 0202_new_letter_pricing Create Date: 2017-06-29 12:44:16.815039 """ # revision identifiers, used by Alembic. revision = '0203_fix_old_incomplete_jobs' down_revision = '0202_new_letter_pricing' from alembic import op def upgrade(): op.execute(...
Clean up old, incomplete jobs
Clean up old, incomplete jobs
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,30 @@ +"""empty message + +Revision ID: 0203_fix_old_incomplete_jobs +Revises: 0202_new_letter_pricing +Create Date: 2017-06-29 12:44:16.815039 + +""" + +# revision identifiers, used by Alembic. +revision = '0203_fix_old_incomplete_jobs' +down_revision = '0202_new_letter_pricing' + +from alembic im...
85cc8916012d9ba53c46ee827d16d08fd06d39ac
tools/enumerate-runners.py
tools/enumerate-runners.py
#!/usr/bin/env python # Licensed to the StackStorm, Inc ('StackStorm') 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...
Add script for listing available / installed action runners.
Add script for listing available / installed action runners.
Python
apache-2.0
nzlosh/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2,StackStorm/st2,Plexxi/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2
--- +++ @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# Licensed to the StackStorm, Inc ('StackStorm') 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 Lice...
048f5b9d8abc9c768db5714d343718e283dc4d4b
tempest/tests/services/compute/test_certificates_client.py
tempest/tests/services/compute/test_certificates_client.py
# Copyright 2015 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
Add unit tests for certificates_client
Add unit tests for certificates_client This patch adds unit tests for certificates_client module Change-Id: If5427832a7446590c3a4b5d62bfe61d70bd1d112
Python
apache-2.0
sebrandon1/tempest,xbezdick/tempest,vedujoshi/tempest,xbezdick/tempest,cisco-openstack/tempest,zsoltdudas/lis-tempest,bigswitch/tempest,pczerkas/tempest,bigswitch/tempest,izadorozhna/tempest,masayukig/tempest,pczerkas/tempest,zsoltdudas/lis-tempest,sebrandon1/tempest,rakeshmi/tempest,cisco-openstack/tempest,Tesora/teso...
--- +++ @@ -0,0 +1,77 @@ +# Copyright 2015 NEC Corporation. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/L...
4580851cf8531ace086af6b2649d7467defa6cf7
tests/PluginRegistry/OldTestPlugin/__init__.py
tests/PluginRegistry/OldTestPlugin/__init__.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. def getMetaData(): return { "name": "OldTestPlugin" } def register(app): app.registerTestPlugin("OldTestPlugin")
Add missing OldTestPlugin for PluginRegistry test
Add missing OldTestPlugin for PluginRegistry test
Python
agpl-3.0
onitake/Uranium,onitake/Uranium
--- +++ @@ -0,0 +1,8 @@ +# Copyright (c) 2015 Ultimaker B.V. +# Uranium is released under the terms of the AGPLv3 or higher. + +def getMetaData(): + return { "name": "OldTestPlugin" } + +def register(app): + app.registerTestPlugin("OldTestPlugin")
3d937a2438a3ae7b417561031de2bfe632802720
brew/utilities/efficiency.py
brew/utilities/efficiency.py
# -*- coding: utf-8 -*- from .sugar import sg_to_gu __all__ = [ u'calculate_brew_house_yield', ] def calculate_brew_house_yield(wort_volume, sg, grain_additions): gravity_units = 0.0 for grain_add in grain_additions: gravity_units += grain_add.grain.ppg * grain_add.weight return sg_to_gu(sg...
Add a brew house yield calculator
Add a brew house yield calculator
Python
mit
chrisgilmerproj/brewday,chrisgilmerproj/brewday
--- +++ @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from .sugar import sg_to_gu + +__all__ = [ + u'calculate_brew_house_yield', +] + + +def calculate_brew_house_yield(wort_volume, sg, grain_additions): + + gravity_units = 0.0 + for grain_add in grain_additions: + gravity_units += grain_add.grain.ppg ...
653bf95527724393c8b18409fbf8addc20484072
mnist.py
mnist.py
# this file defines function for parsing the MNIST dataset as available to # download here: # http://yann.lecun.com/exdb/mnist/index.html # The extracted files are expected to reside in a subfolder called Data/MNIST/ import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np import os ...
Add functions for reading MNIST dataset int numpy arrays.
Add functions for reading MNIST dataset int numpy arrays.
Python
mit
drsstein/PyRat
--- +++ @@ -0,0 +1,57 @@ +# this file defines function for parsing the MNIST dataset as available to +# download here: +# http://yann.lecun.com/exdb/mnist/index.html +# The extracted files are expected to reside in a subfolder called Data/MNIST/ + +import matplotlib.pyplot as plt +import matplotlib.animation as anima...
13480e3aeb9955d82db742030b85b1621a2ecb7c
propalyzer_site/propalyzer_app/pdf_render.py
propalyzer_site/propalyzer_app/pdf_render.py
from io import BytesIO from django.http import HttpResponse from django.template.loader import get_template import xhtml2pdf.pisa as pisa class Render: @staticmethod def render(path: str, params: dict): template = get_template(path) html = template.render(params) response = BytesIO()...
Add pdf render file to VCS
Add pdf render file to VCS
Python
mit
toms3t/Propalyzer,toms3t/Propalyzer,toms3t/Propalyzer
--- +++ @@ -0,0 +1,20 @@ +from io import BytesIO +from django.http import HttpResponse +from django.template.loader import get_template +import xhtml2pdf.pisa as pisa + + +class Render: + + @staticmethod + def render(path: str, params: dict): + + template = get_template(path) + html = template.ren...
5fccb7cb7059847dbac5f78ee438a8f31ab78430
CodeFights/primarySchool.py
CodeFights/primarySchool.py
#!/usr/local/bin/python # Code Fights Primary School Problem class Rectangle(object): def __init__(self, height, width): self.height = height self.width = width def __str__(self): return '{} x {} = {}'.format(self.height, self.width, self.area) @property def area(self): ...
Solve Code Fights primary school problem
Solve Code Fights primary school problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,47 @@ +#!/usr/local/bin/python +# Code Fights Primary School Problem + + +class Rectangle(object): + def __init__(self, height, width): + self.height = height + self.width = width + + def __str__(self): + return '{} x {} = {}'.format(self.height, self.width, self.area) + ...
a3332387eea89daaecd9400c5555657132a2cd9c
IPython/terminal/ptshell.py
IPython/terminal/ptshell.py
raise DeprecationWarning("""DEPRECATED: After Popular request and decision from the BDFL: `IPython.terminal.ptshell` has been moved back to `IPython.terminal.interactiveshell` during the beta cycle (after IPython 5.0.beta3) Sorry about that. This file will be removed in 5.0 rc or final. """)
Add a warning things have been moved back.
Add a warning things have been moved back.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -0,0 +1,8 @@ +raise DeprecationWarning("""DEPRECATED: + +After Popular request and decision from the BDFL: +`IPython.terminal.ptshell` has been moved back to `IPython.terminal.interactiveshell` +during the beta cycle (after IPython 5.0.beta3) Sorry about that. + +This file will be removed in 5.0 rc or fin...
9b730bf54c807fbdc71d56fb1758b27cee6a13a9
fuel_test/openstack_swift_compact/prepare_for_tempest.py
fuel_test/openstack_swift_compact/prepare_for_tempest.py
import unittest from devops.helpers import ssh from fuel_test.helpers import safety_revert_nodes, tempest_write_config, make_tempest_objects, tempest_build_config_essex from fuel_test.openstack_swift_compact.openstack_swift_compact_test_case import OpenStackSwiftCompactTestCase class PrepareOpenStackSwiftForTempest(O...
Add tempest config for swift compact environment
Add tempest config for swift compact environment
Python
apache-2.0
eayunstack/fuel-library,ddepaoli3/fuel-library-dev,ddepaoli3/fuel-library-dev,SmartInfrastructures/fuel-library-dev,huntxu/fuel-library,Metaswitch/fuel-library,zhaochao/fuel-library,eayunstack/fuel-library,huntxu/fuel-library,xarses/fuel-library,huntxu/fuel-library,ddepaoli3/fuel-library-dev,slystopad/fuel-lib,ddepaoli...
--- +++ @@ -0,0 +1,21 @@ +import unittest +from devops.helpers import ssh +from fuel_test.helpers import safety_revert_nodes, tempest_write_config, make_tempest_objects, tempest_build_config_essex +from fuel_test.openstack_swift_compact.openstack_swift_compact_test_case import OpenStackSwiftCompactTestCase + + +class...
450c79939e20f6d9d49729f6c941e7fc8e06950b
examples/ultracoldNeutralPlasma.py
examples/ultracoldNeutralPlasma.py
import ucilib.Sim as Sim import ucilib.BorisUpdater as BorisUpdater import numpy as np # Some helpful constants. fund_charge = 1.602176565e-19 # Mass of Be^+ ions. ion_mass = 8.9465 * 1.673e-27 # Create a simulation with n particles. n = 10000 s = Sim.Sim() s.ptcls.set_nptcls(n) # 1/e radius of cloud. s.ptcls.r...
Add an example simulation setup for an ultracold neutral plasma.
Add an example simulation setup for an ultracold neutral plasma.
Python
mit
Tech-XCorp/ultracold-ions,hosseinsadeghi/ultracold-ions,hosseinsadeghi/ultracold-ions,Tech-XCorp/ultracold-ions
--- +++ @@ -0,0 +1,34 @@ +import ucilib.Sim as Sim +import ucilib.BorisUpdater as BorisUpdater +import numpy as np + + +# Some helpful constants. +fund_charge = 1.602176565e-19 + + +# Mass of Be^+ ions. +ion_mass = 8.9465 * 1.673e-27 + + +# Create a simulation with n particles. +n = 10000 +s = Sim.Sim() +s.ptcls.set_...
d5347701e21bf13a2bca15978a8f5a81e2d2061a
go/base/management/commands/go_list_opt_outs.py
go/base/management/commands/go_list_opt_outs.py
from optparse import make_option from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User from go.base.utils import vumi_api_for_user from go.vumitools.opt_out import OptOutStore class Command(BaseCommand): help = "List opt-outs from a particular account" ...
Add management command for listing opt outs.
Add management command for listing opt outs.
Python
bsd-3-clause
praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go
--- +++ @@ -0,0 +1,47 @@ +from optparse import make_option + +from django.core.management.base import BaseCommand, CommandError +from django.contrib.auth.models import User + +from go.base.utils import vumi_api_for_user +from go.vumitools.opt_out import OptOutStore + + +class Command(BaseCommand): + help = "List o...
1e6d657611eeb3b4bb025954bd1478c6888e38d1
python/examples/submit_survey.py
python/examples/submit_survey.py
#!/usr/bin/env python import sys sys.path += ['..'] try: import json except ImportError: import simplejson as json from epidb.client import EpiDBClient api_key = 'your-epidb-api-key-here' data = { 'user_id': '1c66bb91-33fd-4c6c-9c11-8ddd94164ae8', 'date': '2009-09-09 09:09:09', 'answers': { ...
Add example: submit survey result.
[python] Add example: submit survey result.
Python
agpl-3.0
ISIFoundation/influenzanet-epidb-client
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +import sys +sys.path += ['..'] + +try: + import json +except ImportError: + import simplejson as json + +from epidb.client import EpiDBClient + +api_key = 'your-epidb-api-key-here' +data = { + 'user_id': '1c66bb91-33fd-4c6c-9c11-8ddd94164ae8', + 'date': '...
b452683c2324b2ca7a1b43dbc8dc83354530d04a
scripts/migrate_zendeley_provider_names.py
scripts/migrate_zendeley_provider_names.py
# -*- coding: utf-8 -*- """Migration to add the correct provider_name for Zotero and Mendeley ExternalAccounts that are missing it. """ import sys import logging from scripts import utils as scripts_utils from modularodm import Q from website.app import init_app from website.models import ExternalAccount logger = lo...
Add migration to add correct provider_name
Add migration to add correct provider_name
Python
apache-2.0
DanielSBrown/osf.io,jeffreyliu3230/osf.io,bdyetton/prettychart,mfraezz/osf.io,lamdnhan/osf.io,kch8qx/osf.io,GaryKriebel/osf.io,MerlinZhang/osf.io,jinluyuan/osf.io,lyndsysimon/osf.io,emetsger/osf.io,cldershem/osf.io,caneruguz/osf.io,MerlinZhang/osf.io,SSJohns/osf.io,felliott/osf.io,GageGaskins/osf.io,cldershem/osf.io,To...
--- +++ @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +"""Migration to add the correct provider_name for Zotero and Mendeley ExternalAccounts that +are missing it. +""" +import sys +import logging +from scripts import utils as scripts_utils + +from modularodm import Q + +from website.app import init_app +from website.mod...
ac9d7c4af5221aac94b0d599e77abd8738b63611
distarray/apps/dacluster.py
distarray/apps/dacluster.py
#!/usr/bin/env python import argparse import sys import ipcluster_tools import purge_cluster class ArgumentParser(argparse.ArgumentParser): def error(self, message): # We failed parsing the args, pass them directly to ipcluster # to see if it can handle them. ipcluster_tools.run_ipcluste...
Add CLI entry point for cluster management.
Add CLI entry point for cluster management.
Python
bsd-3-clause
RaoUmer/distarray,enthought/distarray,enthought/distarray,RaoUmer/distarray
--- +++ @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import argparse +import sys + +import ipcluster_tools +import purge_cluster + + +class ArgumentParser(argparse.ArgumentParser): + def error(self, message): + # We failed parsing the args, pass them directly to ipcluster + # to see if it can handle th...
1d9746cc1fc6b0885aa721748c0dbc97cea88b2d
scripts/create_blitzermi_pivots.py
scripts/create_blitzermi_pivots.py
#!/usr/bin/env python import sys from sklearn.datasets import load_svmlight_file from sklearn.feature_selection import mutual_info_classif as mi import numpy as np import scipy.sparse from os.path import dirname, join from uda_common import read_feature_groups def main(args): if len(args) < 2: sys.stderr....
Add script for doing MI pivots the original blitzer way.
Add script for doing MI pivots the original blitzer way.
Python
apache-2.0
tmills/uda,tmills/uda
--- +++ @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +import sys +from sklearn.datasets import load_svmlight_file +from sklearn.feature_selection import mutual_info_classif as mi +import numpy as np +import scipy.sparse +from os.path import dirname, join +from uda_common import read_feature_groups + +def main(args): + ...
fc6c7a743d4f177e76caa282c31c4cf11f2fb0bc
edgedb/lang/schema/quote.py
edgedb/lang/schema/quote.py
## # Copyright (c) 2016 MagicStack Inc. # All rights reserved. # # See LICENSE for details. ## import re from .parser.grammar import keywords _re_ident = re.compile(r'(?:[^\W\d]|\$)(?:\w|\$)*') def quote_literal(text): return "'" + text.replace("'", R"\'") + "'" def dollar_quote_literal(text): quote = ...
Fix missing quoting module for schema.
Fix missing quoting module for schema.
Python
apache-2.0
edgedb/edgedb,edgedb/edgedb,edgedb/edgedb
--- +++ @@ -0,0 +1,40 @@ +## +# Copyright (c) 2016 MagicStack Inc. +# All rights reserved. +# +# See LICENSE for details. +## + + +import re + +from .parser.grammar import keywords + + +_re_ident = re.compile(r'(?:[^\W\d]|\$)(?:\w|\$)*') + + +def quote_literal(text): + return "'" + text.replace("'", R"\'") + "'" +...
3e364fa31d7659692ed3c6a2c4bd3387a336524e
nettests/examples/example_dnst.py
nettests/examples/example_dnst.py
from ooni.templates.dnst import DNSTest class ExampleDNSTest(DNSTest): def test_a_lookup(self): def gotResult(result): # Result is an array containing all the A record lookup results print result d = self.performALookup('torproject.org', ('8.8.8.8', 53)) d.addCallba...
Add example usage of DNS Test Template
Add example usage of DNS Test Template
Python
bsd-2-clause
Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,kdmurray91/...
--- +++ @@ -0,0 +1,11 @@ +from ooni.templates.dnst import DNSTest + +class ExampleDNSTest(DNSTest): + def test_a_lookup(self): + def gotResult(result): + # Result is an array containing all the A record lookup results + print result + + d = self.performALookup('torproject.org', ...
4428fb8dc8e81d9b3ff32c5d93e79c431434e4d3
utils/nflc-get-categories.py
utils/nflc-get-categories.py
#!/usr/bin/env python3 import argparse import json from urllib.request import urlopen def get_data(domain): response = urlopen('http://{}/media/nflc-playlist-video.json'.format(domain)).read() return json.loads(response.decode('utf-8')) def main(): parser = argparse.ArgumentParser(description='Get the ...
Add utility to get categories and their IDs from NFLC sites
Add utility to get categories and their IDs from NFLC sites
Python
mit
Tenzer/plugin.video.nfl-teams
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 + +import argparse +import json +from urllib.request import urlopen + + +def get_data(domain): + response = urlopen('http://{}/media/nflc-playlist-video.json'.format(domain)).read() + return json.loads(response.decode('utf-8')) + + +def main(): + parser = argp...
7d52ef0136a3984da8d14db133220c1d4d1ab16e
zmq_io/in_pifacedigitalio.py
zmq_io/in_pifacedigitalio.py
import argparse import json from datetime import datetime import pifacedigitalio as pfdio from twisted.internet import reactor from txzmq import ZmqEndpoint, ZmqFactory, ZmqPullConnection gpio = pfdio.PiFaceDigital() def parse_args(): """ Specify and parse command line arguments. """ p = argparse.A...
Add inbound pifacedigitalio module which uses twisted
Add inbound pifacedigitalio module which uses twisted
Python
unlicense
flyte/zmq-io-modules,flyte/zmq-io-modules
--- +++ @@ -0,0 +1,48 @@ +import argparse +import json +from datetime import datetime + +import pifacedigitalio as pfdio +from twisted.internet import reactor +from txzmq import ZmqEndpoint, ZmqFactory, ZmqPullConnection + + +gpio = pfdio.PiFaceDigital() + + +def parse_args(): + """ + Specify and parse command ...
30dbded69a535d4730fe8bb9c8706f809f841e9c
src/keybar/tests/web/test_views.py
src/keybar/tests/web/test_views.py
import pytest @pytest.mark.django_db class TestIndexView(object): def test_index(self, client): response = client.get('/') assert response.template_name == ['keybar/web/index.html']
Add test for index view
Add test for index view
Python
bsd-3-clause
keybar/keybar
--- +++ @@ -0,0 +1,9 @@ +import pytest + + +@pytest.mark.django_db +class TestIndexView(object): + + def test_index(self, client): + response = client.get('/') + assert response.template_name == ['keybar/web/index.html']
017ed0c2e8edf0599fa27dcc281b2c93e3ddd67a
tests/test_utils.py
tests/test_utils.py
import unittest class TestCoordsByParent(unittest.TestCase): def test_empty(self): from tilequeue.utils import CoordsByParent cbp = CoordsByParent(10) count = 0 for key, coords in cbp: count += 1 self.assertEquals(0, count) def test_lower_zooms_not_grou...
Add test for parent grouping function.
Add test for parent grouping function.
Python
mit
tilezen/tilequeue,mapzen/tilequeue
--- +++ @@ -0,0 +1,76 @@ +import unittest + + +class TestCoordsByParent(unittest.TestCase): + + def test_empty(self): + from tilequeue.utils import CoordsByParent + + cbp = CoordsByParent(10) + + count = 0 + for key, coords in cbp: + count += 1 + + self.assertEquals(0,...
0deb3f006746d86ed4ed56ccfa2a93ac53d0d968
centerpoints/iterated_tverberg.py
centerpoints/iterated_tverberg.py
# -*- coding: utf-8 -*- import numpy as np from .interfaces import CenterpointAlgo class IteratedTverberg(CenterpointAlgo): def centerpoint(self, points): pass def _prune(alphas, hull): # @see http://www.math.cornell.edu/~eranevo/homepage/ConvNote.pdf # http://en.wikipedia.org/wiki/Carath%C3%...
Add incomplete _pruning function for IteratedTverberg.
Add incomplete _pruning function for IteratedTverberg.
Python
mit
fu-berlin-swp-2014/center-points,fu-berlin-swp-2014/center-points
--- +++ @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +import numpy as np + +from .interfaces import CenterpointAlgo + + +class IteratedTverberg(CenterpointAlgo): + + def centerpoint(self, points): + pass + + +def _prune(alphas, hull): + # @see http://www.math.cornell.edu/~eranevo/homepage/ConvNote.pdf + ...
0f0a23268368d5313f041e649fe58e3d123ccc64
pyslang/tests/test_extractcomments.py
pyslang/tests/test_extractcomments.py
from pyslang import * testfile = """ //! Module description //! ***this is code*** sample //! | Tables | Are | Cool | //! |----------|:------------:|------:| //! | col 1 is | left-aligned | $1600 | module gray_counter ( out , // counter out clk , //! clock clk1 , //! clock sample r...
Add simple example for extracting comments via pyslang
Add simple example for extracting comments via pyslang
Python
mit
MikePopoloski/slang,MikePopoloski/slang
--- +++ @@ -0,0 +1,71 @@ +from pyslang import * + +testfile = """ +//! Module description +//! ***this is code*** sample +//! | Tables | Are | Cool | +//! |----------|:------------:|------:| +//! | col 1 is | left-aligned | $1600 | + +module gray_counter ( + out , // counter out + clk , //! cl...
22a5515b9bf3e684706d3dab98f19402ee651c4c
src/nyc_trees/apps/core/migrations/0018_auto_20150318_1233.py
src/nyc_trees/apps/core/migrations/0018_auto_20150318_1233.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import apps.core.models class Migration(migrations.Migration): dependencies = [ ('core', '0017_group_affiliation'), ] operations = [ migrations.AlterField( model_name='gr...
Add missing migrations for changed image field
Add missing migrations for changed image field Commit fda90cf modified the image field of Group, but neglected to inlude migrations.
Python
agpl-3.0
kdeloach/nyc-trees,RickMohr/nyc-trees,azavea/nyc-trees,RickMohr/nyc-trees,maurizi/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,kdeloach/nyc-trees,RickMohr/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,RickMohr/nyc-trees,azavea/ny...
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import apps.core.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0017_group_affiliation'), + ] + + operations = [ + migrati...
9f82e6b96bf4702901f86374e8a05c3d550091e7
app/soc/logic/helper/convert_db.py
app/soc/logic/helper/convert_db.py
#!/usr/bin/python2.5 # # Copyright 2008 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
Add a script to normalize user accounts
Add a script to normalize user accounts Patch by: Sverre Rabbelier
Python
apache-2.0
MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging
--- +++ @@ -0,0 +1,46 @@ +#!/usr/bin/python2.5 +# +# Copyright 2008 the Melange authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2...
736412dc51711b41ea45f993d80d5ae3895306e9
tests/sentry/digests/test_notifications.py
tests/sentry/digests/test_notifications.py
from __future__ import absolute_import from collections import OrderedDict from exam import fixture from sentry.digests import Record from sentry.digests.notifications import ( Notification, event_to_record, rewrite_record, group_records, sort_groups, ) from sentry.testutils import TestCase cla...
Test some of the digest building functions.
Test some of the digest building functions.
Python
bsd-3-clause
zenefits/sentry,daevaorn/sentry,BuildingLink/sentry,beeftornado/sentry,jean/sentry,BuildingLink/sentry,zenefits/sentry,nicholasserra/sentry,JackDanger/sentry,JamesMura/sentry,fotinakis/sentry,zenefits/sentry,daevaorn/sentry,gencer/sentry,alexm92/sentry,ifduyue/sentry,gencer/sentry,ifduyue/sentry,BuildingLink/sentry,mva...
--- +++ @@ -0,0 +1,120 @@ +from __future__ import absolute_import + +from collections import OrderedDict + +from exam import fixture + +from sentry.digests import Record +from sentry.digests.notifications import ( + Notification, + event_to_record, + rewrite_record, + group_records, + sort_groups, +) +...
210695ab755a9c1d1d863eec0fedb4ac63931fda
utest/resources/robotdata/datagenerator.py
utest/resources/robotdata/datagenerator.py
#!/usr/bin/env python from getopt import getopt, GetoptError from random import randint import os SUITE=\ """*** Settings *** Resource resource.txt *** Test Cases *** %TESTCASES% *** Keywords *** %KEYWORDS% """ RESOURCE=\ """*** Variables *** @{Resource Var} MOI *** Keywords *** %KEYWORDS% """ KEYWORD_TEMPLA...
Add test data generator tool
Add test data generator tool
Python
apache-2.0
HelioGuilherme66/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE,fingeronthebutton/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,robotframework/RIDE,caio2k/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE,fingeronthebutton/RIDE,robotframework/RIDE
--- +++ @@ -0,0 +1,89 @@ +#!/usr/bin/env python + +from getopt import getopt, GetoptError +from random import randint +import os + +SUITE=\ +"""*** Settings *** +Resource resource.txt + +*** Test Cases *** +%TESTCASES% + +*** Keywords *** +%KEYWORDS% +""" + +RESOURCE=\ +"""*** Variables *** +@{Resource Var} MOI +...
9f68956abafd93c109f7304e393dd7424916b8bb
scripts/tools/morphlength_from_annotations.py
scripts/tools/morphlength_from_annotations.py
from __future__ import division import fileinput def main(): tot_morph_count = 0 tot_length = 0 for line in fileinput.input(): word, segm = line.strip().split(None, 1) segmentations = segm.split(',') num_morphs = [len([x for x in s.split(None) if x.strip().strip("~") != ""]) for s...
Create tool to count morph length from annotation file
Create tool to count morph length from annotation file Small bit a quick hack at the moment, should be tranformed to a real script maybe?
Python
bsd-2-clause
aalto-speech/morfessor
--- +++ @@ -0,0 +1,21 @@ +from __future__ import division +import fileinput + + +def main(): + tot_morph_count = 0 + tot_length = 0 + + for line in fileinput.input(): + word, segm = line.strip().split(None, 1) + segmentations = segm.split(',') + num_morphs = [len([x for x in s.split(None...
c7c2be0f2edc47e88d1dcc6169098b8018c8b108
tests/formats_test/device_test.py
tests/formats_test/device_test.py
#!/usr/bin/python import unittest import blivet class DeviceFormatTestCase(unittest.TestCase): def testFormats(self): absolute_path = "/abs/path" host_path = "host:path" garbage = "abc#<def>" for fclass in blivet.formats.device_formats.values(): an_fs = fclass() ...
Add a test to check properties of device paths assigned to formats.
Add a test to check properties of device paths assigned to formats. Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
Python
lgpl-2.1
AdamWill/blivet,AdamWill/blivet,rvykydal/blivet,vojtechtrefny/blivet,vpodzime/blivet,rhinstaller/blivet,vpodzime/blivet,jkonecny12/blivet,vojtechtrefny/blivet,dwlehman/blivet,rvykydal/blivet,jkonecny12/blivet,rhinstaller/blivet,dwlehman/blivet
--- +++ @@ -0,0 +1,83 @@ +#!/usr/bin/python +import unittest + +import blivet + +class DeviceFormatTestCase(unittest.TestCase): + + def testFormats(self): + absolute_path = "/abs/path" + host_path = "host:path" + garbage = "abc#<def>" + for fclass in blivet.formats.device_formats.values...
611852c39f23bc3117c17df5ba911617605fa60f
pyglab/apirequest.py
pyglab/apirequest.py
import enum import requests _defaults = { 'page': 1, 'per_page': 20, } @enum.unique class RequestType(Enum): GET = 1 POST = 2 PUT = 3 DELETE = 4 class ApiRequest: request_creators = { RequestType.GET: requests.get, RequestType.POST: requests.post, RequestType.PUT: ...
Add initial (non-working) ApiRequest class.
Add initial (non-working) ApiRequest class.
Python
mit
sloede/pyglab,sloede/pyglab
--- +++ @@ -0,0 +1,39 @@ +import enum +import requests + +_defaults = { + 'page': 1, + 'per_page': 20, +} + +@enum.unique +class RequestType(Enum): + GET = 1 + POST = 2 + PUT = 3 + DELETE = 4 + +class ApiRequest: + request_creators = { + RequestType.GET: requests.get, + RequestType....
ff61653ff66123eb6e445f400855825e0aeb5882
examples/test_contains_selector.py
examples/test_contains_selector.py
from seleniumbase import BaseCase class MyTestClass(BaseCase): def test_contains_selector(self): self.open("https://xkcd.com/2207/") self.assert_text("Math Work", "#ctitle") self.click('a:contains("Next")') self.assert_text("Drone Fishing", "#ctitle")
Add an example test for the ":contains()" selector
Add an example test for the ":contains()" selector
Python
mit
seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase
--- +++ @@ -0,0 +1,10 @@ +from seleniumbase import BaseCase + + +class MyTestClass(BaseCase): + + def test_contains_selector(self): + self.open("https://xkcd.com/2207/") + self.assert_text("Math Work", "#ctitle") + self.click('a:contains("Next")') + self.assert_text("Drone Fishing", "#c...
9e975d97a45022d8e18cb67c33af2f8f03ce94de
exponent/test/auth/test_session.py
exponent/test/auth/test_session.py
""" Tests for session-based authentication. """ from axiom import store from exponent.auth import errors, session, user from twisted.trial import unittest from txampext import commandtests class RequestSesssionTests(unittest.TestCase, commandtests.CommandTestMixin): """ Tests for the AMP command to request a ...
Add some tests for session authentication
Add some tests for session authentication
Python
isc
lvh/exponent
--- +++ @@ -0,0 +1,83 @@ +""" +Tests for session-based authentication. +""" +from axiom import store +from exponent.auth import errors, session, user +from twisted.trial import unittest +from txampext import commandtests + + +class RequestSesssionTests(unittest.TestCase, commandtests.CommandTestMixin): + """ + ...
cf8897e28024171e94e0d83f2026166ab9537f0b
salt/cli/__init__.py
salt/cli/__init__.py
''' The management of salt command line utilities are stored in here ''' # Import python libs import optparse import os import sys # Import salt components import salt.client class SaltCMD(object): ''' The execution of a salt command happens here ''' def __init__(self): ''' Cretae a Sa...
Set up cli executor for salt command lin
Set up cli executor for salt command lin
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,54 @@ +''' +The management of salt command line utilities are stored in here +''' +# Import python libs +import optparse +import os +import sys + +# Import salt components +import salt.client + +class SaltCMD(object): + ''' + The execution of a salt command happens here + ''' + def __in...
c73fc2993ab3af594812ae901ff8439b4eddf187
numpy/linalg/tests/test_linalg.py
numpy/linalg/tests/test_linalg.py
""" Test functions for linalg module """ from numpy.testing import * set_package_path() from numpy import array, single, double, csingle, cdouble, dot, identity, \ multiply from numpy import linalg restore_path() old_assert_almost_equal = assert_almost_equal def assert_almost_equal(a, b, **kw): if a.dtype...
Add test cases for linalg
Add test cases for linalg git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@2818 94b884b6-d6fd-0310-90d3-974f1d3f35e1
Python
bsd-3-clause
Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,jasonmccampbell/numpy-refactor-sprint,efiring/numpy-work,Ademan/NumPy-GSoC,chadnetzer/numpy-gaurdro,illume/numpy3k,chadnetzer/numpy-gaurdro,teoliphant/numpy-refactor,efiring/numpy-wo...
--- +++ @@ -0,0 +1,80 @@ +""" Test functions for linalg module +""" + +from numpy.testing import * +set_package_path() +from numpy import array, single, double, csingle, cdouble, dot, identity, \ + multiply +from numpy import linalg +restore_path() + +old_assert_almost_equal = assert_almost_equal +def assert_a...
77ef603520652ab894128bf55f1f435bc17927c5
memcached_status.py
memcached_status.py
#!/usr/bin/env python import os import socket import subprocess import telnetlib def can_connect(host, port): """Check that we can make a connection to Memcached.""" try: c = telnetlib.Telnet(host, port) except socket.error: return False c.close() return True def main(): if n...
Add rudimentary status check for memcached
Add rudimentary status check for memcached
Python
apache-2.0
prometheanfire/rpc-openstack,jpmontez/rpc-openstack,andymcc/rpc-openstack,xeregin/rpc-openstack,robb-romans/rpc-openstack,stevelle/rpc-openstack,nrb/rpc-openstack,byronmccollum/rpc-openstack,briancurtin/rpc-maas,cloudnull/rpc-maas,nrb/rpc-openstack,cloudnull/rpc-maas,darrenchan/rpc-openstack,briancurtin/rpc-maas,stevel...
--- +++ @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import os +import socket +import subprocess +import telnetlib + + +def can_connect(host, port): + """Check that we can make a connection to Memcached.""" + try: + c = telnetlib.Telnet(host, port) + except socket.error: + return False + c.close...
883f1b1c28e76ade6632f762391cbb4a97918e12
direct/src/extensions_native/HTTPChannel_extensions.py
direct/src/extensions_native/HTTPChannel_extensions.py
#################################################################### #Dtool_funcToMethod(func, class) #del func ##################################################################### from panda3d.core import HTTPChannel from .extension_native_helpers import Dtool_funcToMethod """ HTTPChannel-extensions module:...
#################################################################### #Dtool_funcToMethod(func, class) #del func ##################################################################### from panda3d import core from .extension_native_helpers import Dtool_funcToMethod """ HTTPChannel-extensions module: contains me...
Fix import error when compiling without OpenSSL support
Fix import error when compiling without OpenSSL support
Python
bsd-3-clause
brakhane/panda3d,grimfang/panda3d,chandler14362/panda3d,grimfang/panda3d,brakhane/panda3d,mgracer48/panda3d,grimfang/panda3d,brakhane/panda3d,mgracer48/panda3d,chandler14362/panda3d,chandler14362/panda3d,tobspr/panda3d,tobspr/panda3d,brakhane/panda3d,grimfang/panda3d,tobspr/panda3d,chandler14362/panda3d,brakhane/panda3...
--- +++ @@ -3,7 +3,7 @@ #del func ##################################################################### -from panda3d.core import HTTPChannel +from panda3d import core from .extension_native_helpers import Dtool_funcToMethod """ @@ -26,8 +26,10 @@ task = Task.Task(self.doTask) task.callback ...
49ffec0b634990a99d60326dbe9a1f2583300b5d
analysis/plot-trial-progress.py
analysis/plot-trial-progress.py
import climate import lmj.plot import source def main(subject): subj = source.Subject(subject) ax = lmj.plot.axes(111, projection='3d', aspect='equal') for i, block in enumerate(subj.blocks): trial = block.trials[0] trial.load() x, y, z = trial.marker('r-fing-index') ax.plo...
Add a short script for plotting successive trials.
Add a short script for plotting successive trials.
Python
mit
lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment
--- +++ @@ -0,0 +1,20 @@ +import climate +import lmj.plot +import source + + +def main(subject): + subj = source.Subject(subject) + ax = lmj.plot.axes(111, projection='3d', aspect='equal') + for i, block in enumerate(subj.blocks): + trial = block.trials[0] + trial.load() + x, y, z = tria...
44fb076a04388b57e8d517eb4835fe7b4b6720d5
aiopg/sa/__init__.py
aiopg/sa/__init__.py
"""Optional support for sqlalchemy.sql dynamic query generation.""" from .engine import create_engine, dialect from .connection import SAConnection from .exc import (Error, ArgumentError, InvalidRequestError, NoSuchColumnError, ResourceClosedError) __all__ = ('dialect', 'create_engine', 'SAConnecti...
"""Optional support for sqlalchemy.sql dynamic query generation.""" from .engine import create_engine, dialect, Engine from .connection import SAConnection from .exc import (Error, ArgumentError, InvalidRequestError, NoSuchColumnError, ResourceClosedError) __all__ = ('dialect', 'create_engine', 'SA...
Make Engine public importable name
Make Engine public importable name
Python
bsd-2-clause
luhn/aiopg,nerandell/aiopg,eirnym/aiopg,graingert/aiopg,aio-libs/aiopg,hyzhak/aiopg
--- +++ @@ -1,6 +1,6 @@ """Optional support for sqlalchemy.sql dynamic query generation.""" -from .engine import create_engine, dialect +from .engine import create_engine, dialect, Engine from .connection import SAConnection from .exc import (Error, ArgumentError, InvalidRequestError, NoSuchCo...
2ec6da5fbb69d322d89b972210d3a521cd17b275
pyQuantuccia/tests/test_module.py
pyQuantuccia/tests/test_module.py
import pyQuantuccia def test_not_a_real_test(): _dir = str(pyQuantuccia.__dir__()) _dict = str(pyQuantuccia.__dict__) s = " ".join([_dict, _dir]) print(s) assert(s == "")
Add a test which lets us see what's in our module.
Add a test which lets us see what's in our module.
Python
bsd-3-clause
jwg4/pyQuantuccia,jwg4/pyQuantuccia
--- +++ @@ -0,0 +1,9 @@ +import pyQuantuccia + + +def test_not_a_real_test(): + _dir = str(pyQuantuccia.__dir__()) + _dict = str(pyQuantuccia.__dict__) + s = " ".join([_dict, _dir]) + print(s) + assert(s == "")
2a34dd198110401bd485552ad857c3d4f26c7b8c
csunplugged/tests/resources/views/test_generate_resource.py
csunplugged/tests/resources/views/test_generate_resource.py
import os from django.test import tag from django.urls import reverse from tests.BaseTestWithDB import BaseTestWithDB from tests.resources.ResourcesTestDataGenerator import ResourcesTestDataGenerator from utils.create_query_string import query_string @tag("resource") class GenerateResourceTest(BaseTestWithDB): d...
Add tests for generate resource view
Add tests for generate resource view
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
--- +++ @@ -0,0 +1,92 @@ +import os +from django.test import tag +from django.urls import reverse +from tests.BaseTestWithDB import BaseTestWithDB +from tests.resources.ResourcesTestDataGenerator import ResourcesTestDataGenerator +from utils.create_query_string import query_string + + +@tag("resource") +class Generat...
303076c230123d6d9f0e8479f90057666de8db76
datasets/management/commands/remove_non_leaf_annotations.py
datasets/management/commands/remove_non_leaf_annotations.py
from django.core.management.base import BaseCommand from datasets.models import * import json from datasets.models import Annotation, Dataset class Command(BaseCommand): help = 'Remove annotations associated with audio clips having a children from which it propagates its ground truth'\ 'Use it as pytho...
Add command remove non leaf annotations
Add command remove non leaf annotations
Python
agpl-3.0
MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets
--- +++ @@ -0,0 +1,64 @@ +from django.core.management.base import BaseCommand +from datasets.models import * +import json +from datasets.models import Annotation, Dataset + + +class Command(BaseCommand): + help = 'Remove annotations associated with audio clips having a children from which it propagates its ground ...
fa6c2c43289eeee1c0efab45101149b49be1b5cb
scrapi/processing/osf/__init__.py
scrapi/processing/osf/__init__.py
from scrapi.processing.osf import crud from scrapi.processing.osf import collision from scrapi.processing.base import BaseProcessor class OSFProcessor(BaseProcessor): NAME = 'osf' def process_normalized(self, raw_doc, normalized): if crud.is_event(normalized): crud.dump_metdata(normalized...
from scrapi.processing.osf import crud from scrapi.processing.osf import collision from scrapi.processing.base import BaseProcessor class OSFProcessor(BaseProcessor): NAME = 'osf' def process_normalized(self, raw_doc, normalized): found, _hash = collision.already_processed(raw_doc) if found:...
Update dumping to osf logic
Update dumping to osf logic
Python
apache-2.0
ostwald/scrapi,mehanig/scrapi,felliott/scrapi,alexgarciac/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,icereval/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,jeffreyliu3230/scrapi,fabianvf/scrapi,erinspace/scrapi,mehanig/scrapi
--- +++ @@ -7,6 +7,15 @@ NAME = 'osf' def process_normalized(self, raw_doc, normalized): + found, _hash = collision.already_processed(raw_doc) + + if found: + return + + normalized['meta'] = { + 'docHash': _hash + } + if crud.is_event(normalized):...
0155a9b005a5b62b8245b29ac49cd5766f12b218
examples/python/disassembly_mode.py
examples/python/disassembly_mode.py
""" Adds the 'toggle-disassembly' command to switch you into a disassembly only mode """ import lldb class DisassemblyMode: def __init__(self, debugger, unused): self.dbg = debugger self.interp = debugger.GetCommandInterpreter() self.store_state() self.mode_off = True d...
Add an example command to toggle between disassembly-only and source mode.
Add an example command to toggle between disassembly-only and source mode. Sometimes you are debugging in source, but you really only want to see the disassembly. That's easy to do but you have to set a few variables. This command toggles between your old values, and a disassembly only mode. git-svn-id: 4c4cc70b1ef...
Python
apache-2.0
llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb
--- +++ @@ -0,0 +1,48 @@ +""" Adds the 'toggle-disassembly' command to switch you into a disassembly only mode """ +import lldb + +class DisassemblyMode: + def __init__(self, debugger, unused): + self.dbg = debugger + self.interp = debugger.GetCommandInterpreter() + self.store_state() + ...
6fcfd8d09db54996a9651f1ed8b82222e36d0673
project/apps/api/migrations/0011_auto_20160518_1522.py
project/apps/api/migrations/0011_auto_20160518_1522.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-18 22:22 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('api', '0010_remove_song_chart'), ] operations = [ migrations.RemoveField( ...
Remove dixon and asterisk test
Remove dixon and asterisk test
Python
bsd-2-clause
dbinetti/barberscore,dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django,barberscore/barberscore-api,dbinetti/barberscore
--- +++ @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-18 22:22 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0010_remove_song_chart'), + ] + + operations = [ +...
7fb8b719a89adae9f4d094983fc4c0e946580389
tests/sample_smart_tools/shasum.py
tests/sample_smart_tools/shasum.py
import argparse from dtoolcore import DataSet def main(dataset_path, identifier, output_path): dataset = DataSet.from_path(dataset_path) fpath = dataset.abspath_from_identifier(identifier) with open(output_path, "w") as fh: shasum_string = "{} {}\n".format(identifier, fpath) fh.write(shasu...
Add sample smart tool for testing purposes
Add sample smart tool for testing purposes
Python
mit
JIC-CSB/jobarchitect,JIC-CSB/jobarchitect
--- +++ @@ -0,0 +1,19 @@ +import argparse + +from dtoolcore import DataSet + +def main(dataset_path, identifier, output_path): + dataset = DataSet.from_path(dataset_path) + fpath = dataset.abspath_from_identifier(identifier) + with open(output_path, "w") as fh: + shasum_string = "{} {}\n".format(ident...
e9d5143b8751bee1d74a5cfebeca848225426d68
tests/test_special_tokens.py
tests/test_special_tokens.py
from tests import TestCase class SignedIntegerTokenTestCase(TestCase): def setup_method(self, method): TestCase.setup_method(self, method) self.session.add( self.TextItem(name=u'index', content=u'some 12-14') ) self.session.commit() class TestSignedIntegersWithRemoveH...
Add test case for special tokens
Add test case for special tokens
Python
bsd-3-clause
cristen/sqlalchemy-searchable
--- +++ @@ -0,0 +1,28 @@ +from tests import TestCase + + +class SignedIntegerTokenTestCase(TestCase): + def setup_method(self, method): + TestCase.setup_method(self, method) + self.session.add( + self.TextItem(name=u'index', content=u'some 12-14') + ) + self.session.commit() ...
3742545d6b2c13198bd1ecb3f7c675a8e6dad948
premium_and_date.py
premium_and_date.py
from datetime import date def get_first_payment_date(signup_date, previous_premium): raise NotImplementedError() def get_end_date(sign_up_date, cancel_date): raise NotImplementedError() def get_billing_day(signup_date): raise NotImplementedError()
Add file with premium dates task
Add file with premium dates task
Python
mit
coolshop-com/coolshop-application-assignment
--- +++ @@ -0,0 +1,13 @@ +from datetime import date + + +def get_first_payment_date(signup_date, previous_premium): + raise NotImplementedError() + + +def get_end_date(sign_up_date, cancel_date): + raise NotImplementedError() + + +def get_billing_day(signup_date): + raise NotImplementedError()
a1a74dc33ef90dbb833e8490b2bd8cfc33915dce
satchless/contrib/pricing/field/__init__.py
satchless/contrib/pricing/field/__init__.py
from django.db.models import Min, Max from ...pricing import Price class FieldGetter(object): def __init__(self, field_name='price', currency=None): self.currency = currency self.field_name = field_name class ProductFieldGetter(FieldGetter): def get_variant_price(self, variant, currency, quan...
Add trivial pricing handler - Product/Variant field getter
Add trivial pricing handler - Product/Variant field getter
Python
bsd-3-clause
fusionbox/satchless,taedori81/satchless,fusionbox/satchless,fusionbox/satchless
--- +++ @@ -0,0 +1,52 @@ +from django.db.models import Min, Max +from ...pricing import Price + +class FieldGetter(object): + def __init__(self, field_name='price', currency=None): + self.currency = currency + self.field_name = field_name + + +class ProductFieldGetter(FieldGetter): + def get_varia...
c418536827c523bb87dcdc893458e08ddba18102
support/jenkins/buildNoModules.py
support/jenkins/buildNoModules.py
import os from subprocess import call # To be called from the build folder in the OpenSpace modules = os.listdir("../modules") cmd = ["cmake"] cmd.append("-DGHOUL_USE_DEVIL=OFF") for m in modules: cmd.append("-DOPENSPACE_MODULE_" + m.upper() + "=OFF") cmd.append("..") call(cmd)
Add script to build OpenSpace with no modules enabled
Add script to build OpenSpace with no modules enabled
Python
mit
OpenSpace/OpenSpace,OpenSpace/OpenSpace,OpenSpace/OpenSpace,OpenSpace/OpenSpace
--- +++ @@ -0,0 +1,13 @@ +import os +from subprocess import call + +# To be called from the build folder in the OpenSpace +modules = os.listdir("../modules") + +cmd = ["cmake"] +cmd.append("-DGHOUL_USE_DEVIL=OFF") +for m in modules: + cmd.append("-DOPENSPACE_MODULE_" + m.upper() + "=OFF") + +cmd.append("..") +call...
6fc69f735aa075aad15e066c5a2d1c0cb7df722a
site/api/migrations/0013_auto_20150317_1053.py
site/api/migrations/0013_auto_20150317_1053.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.contrib.gis.db.models.fields class Migration(migrations.Migration): dependencies = [ ('api', '0012_auto_20150313_1631'), ] operations = [ migrations.RemoveField( ...
Add migration file to reflect use of db_column in models
Add migration file to reflect use of db_column in models
Python
mit
LitPalimpsest/parser-api-search,LitPalimpsest/parser-api-search,LitPalimpsest/parser-api-search
--- +++ @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.contrib.gis.db.models.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0012_auto_20150313_1631'), + ] + + operations =...
e2c9f4bba4ebe80b15026ccb1bb35ef1bf1f199d
migrations/versions/299d2746edd_removed_deadline_column_pimpy.py
migrations/versions/299d2746edd_removed_deadline_column_pimpy.py
"""removed deadline column pimpy Revision ID: 299d2746edd Revises: 40f1fd0d52 Create Date: 2015-07-18 13:21:16.172796 """ # revision identifiers, used by Alembic. revision = '299d2746edd' down_revision = '40f1fd0d52' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql def upgrade()...
Add migration for removing deadline
Add migration for removing deadline
Python
mit
viaict/viaduct,viaict/viaduct,viaict/viaduct,viaict/viaduct,viaict/viaduct
--- +++ @@ -0,0 +1,26 @@ +"""removed deadline column pimpy + +Revision ID: 299d2746edd +Revises: 40f1fd0d52 +Create Date: 2015-07-18 13:21:16.172796 + +""" + +# revision identifiers, used by Alembic. +revision = '299d2746edd' +down_revision = '40f1fd0d52' + +from alembic import op +import sqlalchemy as sa +from sqlal...
de57228d38d9a95953ffc90f70e03cbfda806774
networkx/algorithms/tests/test_betweenness_centrality.py
networkx/algorithms/tests/test_betweenness_centrality.py
#!/usr/bin/env python from nose.tools import * import networkx class TestBetweennessCentrality: def setUp(self): G=networkx.Graph(); G.add_edge(0,1,3) G.add_edge(0,2,2) G.add_edge(0,3,6) G.add_edge(0,4,4) G.add_edge(1,3,5) G.add_edge(1,5,5) G.add_ed...
Add betweeness centrality and load centrality test.
Add betweeness centrality and load centrality test. --HG-- extra : convert_revision : svn%3A3ed01bd8-26fb-0310-9e4c-ca1a4053419f/networkx/trunk%401110
Python
bsd-3-clause
chrisnatali/networkx,tmilicic/networkx,bzero/networkx,farhaanbukhsh/networkx,jtorrents/networkx,RMKD/networkx,ionanrozenfeld/networkx,debsankha/networkx,jfinkels/networkx,wasade/networkx,ghdk/networkx,ionanrozenfeld/networkx,jni/networkx,jakevdp/networkx,harlowja/networkx,kernc/networkx,jcurbelo/networkx,SanketDG/netwo...
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/env python +from nose.tools import * +import networkx + +class TestBetweennessCentrality: + + def setUp(self): + + G=networkx.Graph(); + G.add_edge(0,1,3) + G.add_edge(0,2,2) + G.add_edge(0,3,6) + G.add_edge(0,4,4) + G.add_edge(1,3,5) +...
15c589b6b186865faf0dcec10b75d54d8ed9200e
test/test_util.py
test/test_util.py
import mock import unittest from .models import B from json import dumps from sir import util from sir.schema import searchentities class VersionCheckerTest(unittest.TestCase): def setUp(self): urlopen = mock.patch("sir.util.urllib2.urlopen") urlopenmock = urlopen.start() self.addCleanup(...
Add an uncommitted test file
Add an uncommitted test file
Python
mit
jeffweeksio/sir
--- +++ @@ -0,0 +1,49 @@ +import mock +import unittest + +from .models import B +from json import dumps +from sir import util +from sir.schema import searchentities + + +class VersionCheckerTest(unittest.TestCase): + def setUp(self): + urlopen = mock.patch("sir.util.urllib2.urlopen") + urlopenmock = ...
bb5d89ca793cfbdeaf4dea3a4791f675ecf9039f
order-flights/flights-recursion.py
order-flights/flights-recursion.py
def next_leg(flights, source): """Find and append next flight to trip""" for leg in flights: if leg[0] == source: trip.append(leg) source = leg[1] flights.remove(leg) next_leg(flights, source) def previous_leg(flights, destination): """Find and prepen...
Order legs of a flight trip using recursion
Order legs of a flight trip using recursion
Python
mit
zedfoxus/stackoverflow-answers,zedfoxus/stackoverflow-answers,zedfoxus/stackoverflow-answers
--- +++ @@ -0,0 +1,33 @@ +def next_leg(flights, source): + """Find and append next flight to trip""" + for leg in flights: + if leg[0] == source: + trip.append(leg) + source = leg[1] + flights.remove(leg) + next_leg(flights, source) + +def previous_leg(flights,...
f7aeb4fa5bafa5218bed14e5b19c0fb9409e6700
examples/python/readMCParticles.py
examples/python/readMCParticles.py
#!/usr/bin/env python # # This is just a simple test script to check whether the python bindings are # actually working as intended from __future__ import print_function, absolute_import, unicode_literals import pyLCIO as lcio import sys reader = lcio.IOIMPL.LCFactory.getInstance().createLCReader() reader.open(sys.a...
Add small test script for python bindings
Add small test script for python bindings
Python
bsd-3-clause
iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO
--- +++ @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# +# This is just a simple test script to check whether the python bindings are +# actually working as intended + +from __future__ import print_function, absolute_import, unicode_literals + +import pyLCIO as lcio +import sys + +reader = lcio.IOIMPL.LCFactory.getInstanc...
478d8331e03e00365beafff455e8dc7ed2562af4
intake_bluesky/tests/test_dask_filler.py
intake_bluesky/tests/test_dask_filler.py
import event_model from bluesky.plans import count import numpy from ophyd.sim import NumpySeqHandler from ..core import DaskFiller def test_fill_event(RE, hw): docs = [] def callback(name, doc): docs.append((name, doc)) RE(count([hw.img]), callback) docs dask_filler = DaskFiller({'NPY_...
Add basic smoke tests for dask.
TST: Add basic smoke tests for dask.
Python
bsd-3-clause
ericdill/databroker,ericdill/databroker
--- +++ @@ -0,0 +1,48 @@ +import event_model +from bluesky.plans import count +import numpy +from ophyd.sim import NumpySeqHandler + +from ..core import DaskFiller + + +def test_fill_event(RE, hw): + docs = [] + + def callback(name, doc): + docs.append((name, doc)) + + RE(count([hw.img]), callback) + ...
c1b090a8774030d4898a02b41cdbd9f199e2c1b8
packager/core/test/test_flavor.py
packager/core/test/test_flavor.py
#! /usr/bin/python from packager.core.flavor import debian_check from nose.tools import * from subprocess import call def test_debian_check(): ret = call(["test", "-f", "/etc/debian_version"]) == 0 assert debian_check() == ret
Add unit test for packager.core.flavor.py
Add unit test for packager.core.flavor.py
Python
mit
csdms/packagebuilder
--- +++ @@ -0,0 +1,9 @@ +#! /usr/bin/python + +from packager.core.flavor import debian_check +from nose.tools import * +from subprocess import call + +def test_debian_check(): + ret = call(["test", "-f", "/etc/debian_version"]) == 0 + assert debian_check() == ret
b8121d15e59d08cd93ada94b69b37c8942308ede
scrapi/harvesters/huskiecommons.py
scrapi/harvesters/huskiecommons.py
''' Harvester for the Huskie Commons for the SHARE project Example API call: http://commons.lib.niu.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester class HuskiecommonsHarvester(OAIHarvester): short_name = 'huskiecommons' ...
Add harvester for Huskie Commons
Add harvester for Huskie Commons Closes [#SHARE-114]
Python
apache-2.0
fabianvf/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,erinspace/scrapi,fabianvf/scrapi,erinspace/scrapi,felliott/scrapi,CenterForOpenScience/scrapi
--- +++ @@ -0,0 +1,18 @@ +''' +Harvester for the Huskie Commons for the SHARE project + +Example API call: http://commons.lib.niu.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc +''' +from __future__ import unicode_literals + +from scrapi.base import OAIHarvester + + +class HuskiecommonsHarvester(OAIHarvester)...
70587b40766a3c5ab3bfad9639790d332508fb76
dn1/revolver_test.py
dn1/revolver_test.py
__author__ = 'Nino Bašić <nino.basic@fmf.uni-lj.si>' import unittest from revolver import Revolver class RevolverTest(unittest.TestCase): def test_iter(self): r = Revolver([[1], [20, 10], [300, 200, 100]]) self.assertIs(r, iter(r)) def test_revolver_1(self): r = Revolver([[1], [20, ...
Add unittest for Task 3
Add unittest for Task 3
Python
mit
nbasic/racunalnistvo-1
--- +++ @@ -0,0 +1,60 @@ +__author__ = 'Nino Bašić <nino.basic@fmf.uni-lj.si>' + +import unittest +from revolver import Revolver + + +class RevolverTest(unittest.TestCase): + + def test_iter(self): + r = Revolver([[1], [20, 10], [300, 200, 100]]) + self.assertIs(r, iter(r)) + + def test_revolver_1...
7a1981ef9499b12e16d9f7851b76e36a8b8a7f52
Utilities/Maintenance/JREUpdate.py
Utilities/Maintenance/JREUpdate.py
#!/usr/bin/env python description = """ Update the JRE tarballs to be bundled with the SCIFIOImageIO plugin. The OpenJDK JRE (but no the JDK) can be redistributed. It is downloaded at build time from Midas and shipped with the SCIFIOImageIO plugin so that the plugin "just works". The Fiji fellows maintain Git repos...
Add utility script to create JRE tarballs.
ENH: Add utility script to create JRE tarballs. These tarballs will be uploaded to the Midas server to be used by the SCIFIOImageIO module. Change-Id: I180cf0957221762ddf62b14e3712b70fe19e03bb
Python
apache-2.0
PlutoniumHeart/ITK,vfonov/ITK,hendradarwin/ITK,stnava/ITK,fbudin69500/ITK,hjmjohnson/ITK,heimdali/ITK,BlueBrain/ITK,ajjl/ITK,spinicist/ITK,vfonov/ITK,msmolens/ITK,vfonov/ITK,hendradarwin/ITK,stnava/ITK,atsnyder/ITK,richardbeare/ITK,stnava/ITK,LucHermitte/ITK,GEHC-Surgery/ITK,biotrump/ITK,BRAINSia/ITK,hinerm/ITK,spinici...
--- +++ @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +description = """ +Update the JRE tarballs to be bundled with the SCIFIOImageIO plugin. + +The OpenJDK JRE (but no the JDK) can be redistributed. It is downloaded at +build time from Midas and shipped with the SCIFIOImageIO plugin so that the +plugin "just works". +...
91b99d08892e8fc758c21a2ddec13ba6f83f4f8b
hackerrank/linked-list/position-from-tail.py
hackerrank/linked-list/position-from-tail.py
# https://www.hackerrank.com/challenges/get-the-value-of-the-node-at-a-specific-position-from-the-tail/forum def GetNode(head, position): curr = head tail = head for i in range(position): tail = tail.next while tail.next is not None: curr = curr.next tail = tail.next return ...
Solve hackerrank linked list problem
[algorithm] Solve hackerrank linked list problem This is the solution of "get-the-value-of-the-node-at-a-specific-position-from-the-tail" problem.
Python
mit
honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice
--- +++ @@ -0,0 +1,11 @@ +# https://www.hackerrank.com/challenges/get-the-value-of-the-node-at-a-specific-position-from-the-tail/forum + +def GetNode(head, position): + curr = head + tail = head + for i in range(position): + tail = tail.next + while tail.next is not None: + curr = curr.next ...
52f6f1450299aee86730bb430228bf2ed6bb9774
social/apps/django_app/default/migrations/0002_add_related_name.py
social/apps/django_app/default/migrations/0002_add_related_name.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('default', '0001_initial'), ] operations = [ migrations.AlterField( model_name='...
Add missing migration for Django app
Add missing migration for Django app
Python
bsd-3-clause
daniula/python-social-auth,python-social-auth/social-app-django,python-social-auth/social-app-django,mrwags/python-social-auth,muhammad-ammar/python-social-auth,clef/python-social-auth,jameslittle/python-social-auth,msampathkumar/python-social-auth,DhiaEddineSaidi/python-social-auth,S01780/python-social-auth,MSOpenTech...
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('default', '0001_initial'), + ] + + operations = [ + migra...
c25b54976a0250863fbf05419d9944e6d337251b
tests/group_test.py
tests/group_test.py
"""Tests for the permutation group class.""" import pickle from drudge import Perm, Group def test_s3_group_correct_and_serializable(): """Test the S3 group. Since the permutation group objects are mostly opaque, here it is tested by its new arguments, which is also further verified to work with pickle...
Add tests for permutation group class
Add tests for permutation group class The permutation group class is tested with the S3 group. This also tests the correctness of the Schreier-Sims algorithm in libcanon. The picklability is also tested.
Python
mit
tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge
--- +++ @@ -0,0 +1,51 @@ +"""Tests for the permutation group class.""" + +import pickle + +from drudge import Perm, Group + + +def test_s3_group_correct_and_serializable(): + """Test the S3 group. + + Since the permutation group objects are mostly opaque, here it is tested + by its new arguments, which is al...
515dd6c5e21c8911d6c9ed21f438b39706bcf99a
tests/images/test_image_widgets.py
tests/images/test_image_widgets.py
from django.core.files.uploadedfile import SimpleUploadedFile from adhocracy4.images import widgets def test_image_input_delete_presedence(): input = widgets.ImageInputWidget() jpeg_file = SimpleUploadedFile('test.jpg', b'file content', content_type='image/jpeg') data ...
Add test for image upload widget
Add test for image upload widget
Python
agpl-3.0
liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4
--- +++ @@ -0,0 +1,17 @@ +from django.core.files.uploadedfile import SimpleUploadedFile + +from adhocracy4.images import widgets + + +def test_image_input_delete_presedence(): + input = widgets.ImageInputWidget() + jpeg_file = SimpleUploadedFile('test.jpg', b'file content', + c...
d5106925d90ac5c0454279c31535381b45958a95
print_liwc_cat.py
print_liwc_cat.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Script to print all words in a LIWC category. Usage: python print_liwc_cat.py <dictionary file> <category> 2014-11-18 j.vanderzwaan@esciencecenter.nl """ import argparse import codecs if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_ar...
Add script to print words for LIWC categories
Add script to print words for LIWC categories Given a LIWC dictionary and a category, the script prints the words in the category.
Python
apache-2.0
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
--- +++ @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""Script to print all words in a LIWC category. + +Usage: python print_liwc_cat.py <dictionary file> <category> + +2014-11-18 j.vanderzwaan@esciencecenter.nl +""" +import argparse +import codecs + + +if __name__ == '__main__': + parser = ar...
e5ffed089fe5727e7711a685a62100a779f80fd7
tests/test_commands/test_clean.py
tests/test_commands/test_clean.py
# Copyright 2015 0xc0170 # # 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, soft...
Test commands clean - addition
Test commands clean - addition
Python
apache-2.0
molejar/project_generator,project-generator/project_generator,ohagendorf/project_generator,sarahmarshy/project_generator,0xc0170/project_generator,hwfwgrp/project_generator
--- +++ @@ -0,0 +1,68 @@ +# Copyright 2015 0xc0170 +# +# 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 applicab...
7a2b962012067d509a07d00dfd55319c428585ff
osf/migrations/0174_add_ab_testing_home_page_version_b_flag.py
osf/migrations/0174_add_ab_testing_home_page_version_b_flag.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2019-07-23 14:26 from __future__ import unicode_literals from django.db import migrations from osf import features from osf.utils.migrations import AddWaffleFlags class Migration(migrations.Migration): dependencies = [ ('osf', '0173_ensure_schemas'...
Rename migration and fix dependency
Rename migration and fix dependency
Python
apache-2.0
mfraezz/osf.io,saradbowman/osf.io,cslzchen/osf.io,aaxelb/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,felliott/osf.io,mattclark/osf.io,CenterForOpenScience/osf.io,mattclark/osf.io,adlius/osf.io,baylee-d/osf...
--- +++ @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.13 on 2019-07-23 14:26 +from __future__ import unicode_literals +from django.db import migrations + +from osf import features +from osf.utils.migrations import AddWaffleFlags + +class Migration(migrations.Migration): + + dependencies = [...
fbc4646c791d37e3360cac30ef590e5a242312d9
tests/PlanetPopulation/test_EarthTwinHabZone.py
tests/PlanetPopulation/test_EarthTwinHabZone.py
r"""Test code for modules EarthTwinHabZone1 and EarthTwinHabZone2 within EXOSIMS PlanetPopulation. Cate Liu, IPAC, 2016""" import unittest import EXOSIMS from EXOSIMS import MissionSim from EXOSIMS.Prototypes.PlanetPopulation import PlanetPopulation from EXOSIMS.PlanetPopulation.EarthTwinHabZone1 import EarthTwinHabZ...
Put EarthTwinHabZone tests in same new file/class
Put EarthTwinHabZone tests in same new file/class
Python
bsd-3-clause
dsavransky/EXOSIMS,dsavransky/EXOSIMS
--- +++ @@ -0,0 +1,66 @@ +r"""Test code for modules EarthTwinHabZone1 and EarthTwinHabZone2 within EXOSIMS PlanetPopulation. + +Cate Liu, IPAC, 2016""" + +import unittest +import EXOSIMS +from EXOSIMS import MissionSim +from EXOSIMS.Prototypes.PlanetPopulation import PlanetPopulation +from EXOSIMS.PlanetPopulation.Ea...
684c208bfec727cd66bd4a2eccedbfeea1c59d0a
alembic/versions/32ccd6db0955_add_quantity_to_shopping_items.py
alembic/versions/32ccd6db0955_add_quantity_to_shopping_items.py
"""Add quantity to shopping items Revision ID: 32ccd6db0955 Revises: 430dc4ed6dd6 Create Date: 2015-01-06 21:59:03.761529 """ # revision identifiers, used by Alembic. revision = '32ccd6db0955' down_revision = '430dc4ed6dd6' from alembic import op import sqlalchemy as sa def upgrade(): pass def downgrade(): ...
Add quantity to shopping items
Add quantity to shopping items
Python
mit
jlutz777/FreeStore,jlutz777/FreeStore,jlutz777/FreeStore
--- +++ @@ -0,0 +1,22 @@ +"""Add quantity to shopping items + +Revision ID: 32ccd6db0955 +Revises: 430dc4ed6dd6 +Create Date: 2015-01-06 21:59:03.761529 + +""" + +# revision identifiers, used by Alembic. +revision = '32ccd6db0955' +down_revision = '430dc4ed6dd6' + +from alembic import op +import sqlalchemy as sa + + ...
0915d71c8d243cd2a7c8c231461458d961a510bf
zou/migrations/versions/a23682ccc1f1_.py
zou/migrations/versions/a23682ccc1f1_.py
"""empty message Revision ID: a23682ccc1f1 Revises: 9bd17364fc18 Create Date: 2018-04-20 10:39:31.976959 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utils # revision identifiers, used by Alembic. revision = 'a23682ccc1f1' down_revision = '9bd17364fc18' branch_labels = None depends_on = None...
Add migration scripts for DB schema
Add migration scripts for DB schema * Add table to log desktop logins * Add active field for asset instance
Python
agpl-3.0
cgwire/zou
--- +++ @@ -0,0 +1,41 @@ +"""empty message + +Revision ID: a23682ccc1f1 +Revises: 9bd17364fc18 +Create Date: 2018-04-20 10:39:31.976959 + +""" +from alembic import op +import sqlalchemy as sa +import sqlalchemy_utils + + +# revision identifiers, used by Alembic. +revision = 'a23682ccc1f1' +down_revision = '9bd17364fc...
466622e95e5243a2d5a9d6a12f1b7735c4fb5637
test/test_automated_analysis.py
test/test_automated_analysis.py
"""This directory is setup with configurations to run the main functional test. It exercises a full analysis pipeline on a smaller subset of data. """ import os import subprocess import unittest import shutil import contextlib import collections import functools from nose import SkipTest from nose.plugins.attrib impo...
Add automated test inspared in bcbio-nextgen code
Add automated test inspared in bcbio-nextgen code
Python
mit
lpantano/seqcluster,lpantano/seqcluster,lpantano/seqcluster,lpantano/seqcluster,lpantano/seqcluster
--- +++ @@ -0,0 +1,81 @@ +"""This directory is setup with configurations to run the main functional test. + +It exercises a full analysis pipeline on a smaller subset of data. +""" +import os +import subprocess +import unittest +import shutil +import contextlib +import collections +import functools + +from nose impor...
69aeb3afafc79bd9f7f85231f25ca198d4e23367
AutoTheBoringStuffProjects/Chp6Password/pw.py
AutoTheBoringStuffProjects/Chp6Password/pw.py
#!/urs/local/bin/python # pw.py - an insecure password locker program import sys import pyperclip PASSWORDS = {'email': 'F7minlBDDuvMJuxESSKHFhTxFtjVB6', 'blog': 'VmALvQyKAxiVH5G8v01if1MLZF3sdt', 'luggage': '12345'} if len(sys.argv) < 2: print('Usage: python pw.py [account] - copy acco...
Add project for chapter 6 Automate the Boring Stuff
Add project for chapter 6 Automate the Boring Stuff
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,22 @@ +#!/urs/local/bin/python +# pw.py - an insecure password locker program + +import sys +import pyperclip + +PASSWORDS = {'email': 'F7minlBDDuvMJuxESSKHFhTxFtjVB6', + 'blog': 'VmALvQyKAxiVH5G8v01if1MLZF3sdt', + 'luggage': '12345'} + + +if len(sys.argv) < 2: + print('U...
8d5b0bd8f50d7b0489ebbafd22c66cf5304d308f
auth0/v3/test/management/test_branding.py
auth0/v3/test/management/test_branding.py
import unittest import mock from ...management.branding import Branding class TestBranding(unittest.TestCase): def test_init_with_optionals(self): branding = Branding( domain="domain", token="jwttoken", telemetry=False, timeout=(10, 2) ) self.assertEqual(branding.client.options...
Add tests for new endpoints
Add tests for new endpoints
Python
mit
auth0/auth0-python,auth0/auth0-python
--- +++ @@ -0,0 +1,73 @@ +import unittest +import mock +from ...management.branding import Branding + + +class TestBranding(unittest.TestCase): + def test_init_with_optionals(self): + branding = Branding( + domain="domain", token="jwttoken", telemetry=False, timeout=(10, 2) + ) + se...
a06cd308c9aaa908386d2a1390817049723f28af
contrib/trigger_rtd_build.py
contrib/trigger_rtd_build.py
#!/usr/bin/env python # 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 "Licen...
Add script for triggering rtf build (curl is not available on build slave).
Add script for triggering rtf build (curl is not available on build slave).
Python
apache-2.0
Cloud-Elasticity-Services/as-libcloud,pquentin/libcloud,wido/libcloud,schaubl/libcloud,atsaki/libcloud,marcinzaremba/libcloud,mbrukman/libcloud,marcinzaremba/libcloud,carletes/libcloud,thesquelched/libcloud,Itxaka/libcloud,vongazman/libcloud,t-tran/libcloud,jerryblakley/libcloud,munkiat/libcloud,sgammon/libcloud,iPlant...
--- +++ @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# 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 Li...
7bf47ceb1872db834a91cbcc2193366bff1abb58
dask/array/tests/test_fft.py
dask/array/tests/test_fft.py
import unittest import numpy as np import numpy.fft as npfft import dask from dask.array.core import Array from dask.utils import raises import dask.array as da from dask.array.fft import fft, ifft def eq(a, b): if isinstance(a, Array): adt = a._dtype a = a.compute(get=dask.get) else: ...
Add tests for fft and ifft
Add tests for fft and ifft
Python
bsd-3-clause
ssanderson/dask,mrocklin/dask,chrisbarber/dask,cowlicks/dask,PhE/dask,mrocklin/dask,mikegraham/dask,gameduell/dask,dask/dask,jcrist/dask,jakirkham/dask,vikhyat/dask,ssanderson/dask,wiso/dask,ContinuumIO/dask,ContinuumIO/dask,blaze/dask,pombredanne/dask,wiso/dask,mraspaud/dask,clarkfitzg/dask,vikhyat/dask,dask/dask,PhE/...
--- +++ @@ -0,0 +1,80 @@ +import unittest + +import numpy as np +import numpy.fft as npfft + +import dask +from dask.array.core import Array +from dask.utils import raises +import dask.array as da +from dask.array.fft import fft, ifft + + +def eq(a, b): + if isinstance(a, Array): + adt = a._dtype + a...
ebc1c3ddb2adca3205d1976cf0def5145a31a6dc
bliski_publikator/contrib/sites/migrations/0003_auto_20160414_0903.py
bliski_publikator/contrib/sites/migrations/0003_auto_20160414_0903.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-14 09:03 from __future__ import unicode_literals import django.contrib.sites.models from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sites', '0002_set_site_domain_and_name'), ] opera...
Add standard migrations to contrib.sites
Add standard migrations to contrib.sites
Python
mit
watchdogpolska/bliski_publikator,watchdogpolska/bliski_publikator,watchdogpolska/bliski_publikator,watchdogpolska/bliski_publikator
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-04-14 09:03 +from __future__ import unicode_literals + +import django.contrib.sites.models +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sites', '0002_set_s...
4ae97e9d15b28dd2eba5c5e404b071ee87773f77
coverage_score_viewer/migrations/0001_initial.py
coverage_score_viewer/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='CoverageBoundary', fields=[ ('id', models.Integ...
Add migration script for coverage scores.
Add migration script for coverage scores.
Python
mit
thomaskonrad/osm_austria_building_coverage,thomaskonrad/osm_austria_building_coverage,thomaskonrad/osm-austria-building-coverage,thomaskonrad/osm_austria_building_coverage,thomaskonrad/osm-austria-building-coverage,thomaskonrad/osm_austria_building_coverage,thomaskonrad/osm-austria-building-coverage,thomaskonrad/osm-au...
--- +++ @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='CoverageBoundary', + fi...
e10a5979bc4cbe5b6ff89ae7af6ea726eb1a0000
functional/tests/compute/v2/test_server_group.py
functional/tests/compute/v2/test_server_group.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Add functional tests for server group in ComputeV2
Add functional tests for server group in ComputeV2 Change-Id: I43a6ce3a6d976f3d1bd68c0483c929977b660f0d
Python
apache-2.0
dtroyer/python-openstackclient,redhat-openstack/python-openstackclient,dtroyer/python-openstackclient,openstack/python-openstackclient,openstack/python-openstackclient,redhat-openstack/python-openstackclient
--- +++ @@ -0,0 +1,46 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agr...
cb7631303a73e69ffa62811be2ea79e2d4a6d64b
src/main/resources/script_templates/Python/Process_Folder.py
src/main/resources/script_templates/Python/Process_Folder.py
import os from ij import IJ, ImagePlus from ij.gui import GenericDialog def run(): srcDir = IJ.getDirectory("Input_directory") if not srcDir: return dstDir = IJ.getDirectory("Output_directory") if not dstDir: return gd = GenericDialog("Process Folder") gd.addStringField("File_extension", ".tif") ...
Add python template to process a folder of images
Add python template to process a folder of images
Python
bsd-2-clause
imagej/imagej-legacy,imagej/imagej-legacy,imagej/imagej-legacy,imagej/imagej-legacy
--- +++ @@ -0,0 +1,49 @@ +import os +from ij import IJ, ImagePlus +from ij.gui import GenericDialog + +def run(): + srcDir = IJ.getDirectory("Input_directory") + if not srcDir: + return + dstDir = IJ.getDirectory("Output_directory") + if not dstDir: + return + gd = GenericDialog("Process Folder") + gd.a...
a558b9efe5f20af2b5b4e588add8648bfba22c2c
app/scripts/benchmark_match_accuracy.py
app/scripts/benchmark_match_accuracy.py
from tabulate import tabulate import csv import yaml import sys import os.path as path base_directory = path.dirname(path.dirname(path.abspath(__file__))) sys.path.append(base_directory) import deparse from segment import Segment def load_segments(filename): '''Load a segment feature matrix from a CSV file, ret...
Add match accuracy benchmark script
Add match accuracy benchmark script
Python
mit
kdelwat/LangEvolve,kdelwat/LangEvolve,kdelwat/LangEvolve
--- +++ @@ -0,0 +1,98 @@ +from tabulate import tabulate +import csv +import yaml +import sys +import os.path as path + +base_directory = path.dirname(path.dirname(path.abspath(__file__))) +sys.path.append(base_directory) + +import deparse +from segment import Segment + + +def load_segments(filename): + '''Load a s...
d627397fa4c7544a39c6be648ffaf82536ac06f0
tests/rules_tests/clearAfterNonTermRemove/WithEpsilonTest.py
tests/rules_tests/clearAfterNonTermRemove/WithEpsilonTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 19.08.2017 17:25 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy import * class A(Nonterminal): pass class B(Nonterminal): pass class C(Nonterminal): pass class Rules(Rule): rules = [ ([A], [B, C]), ([...
Add test of rules with EPS
Add test of rules with EPS
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 19.08.2017 17:25 +:Licence GNUv3 +Part of grammpy + +""" + + +from unittest import TestCase, main +from grammpy import * + +class A(Nonterminal): pass +class B(Nonterminal): pass +class C(Nonterminal): pass +class Rules(Rule): + ...
6dd95098cd65fc31e07ae6339d9c86ec3028cf5e
examples/load_save.py
examples/load_save.py
from __future__ import print_function import numpy from molml.features import CoulombMatrix from molml.crystal import GenerallizedCrystal from molml.utils import load_json # Define some base data H2_ELES = ['H', 'H'] H2_COORDS = [ [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], ] H2_UNIT = numpy.array([ [2., .5, 0.],...
Add a script to show loading/saving models
Add a script to show loading/saving models
Python
mit
crcollins/molml
--- +++ @@ -0,0 +1,56 @@ +from __future__ import print_function + +import numpy + +from molml.features import CoulombMatrix +from molml.crystal import GenerallizedCrystal +from molml.utils import load_json + + +# Define some base data +H2_ELES = ['H', 'H'] +H2_COORDS = [ + [0.0, 0.0, 0.0], + [1.0, 0.0, 0.0], +]...
10e9fd1dd93cee2fd96fcb50f9a5ec1607fb9c66
jacquard/directory/django.py
jacquard/directory/django.py
import sqlalchemy from .base import Directory, User class DjangoDirectory(Directory): query = """ SELECT auth_user.id, auth_user.date_joined, auth_user.is_superuser FROM auth_user """ def __init__(self, url): self.engine = sqlalchemy.create_engine(url) ...
Add base Django user directory
Add base Django user directory
Python
mit
prophile/jacquard,prophile/jacquard
--- +++ @@ -0,0 +1,41 @@ +import sqlalchemy + +from .base import Directory, User + +class DjangoDirectory(Directory): + query = """ + SELECT + auth_user.id, + auth_user.date_joined, + auth_user.is_superuser + FROM + auth_user + """ + + def __init__(self, url): + self....
38eafc8a4a78da04b0260d2bad6a38addb82ee4a
admin_honeypot/migrations/0002_add_field_LoginAttempt_path.py
admin_honeypot/migrations/0002_add_field_LoginAttempt_path.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'LoginAttempt.path' db.add_column('admin_honeypot_loginattempt', 'path', ...
Add South migration for LoginAttempt.path
Add South migration for LoginAttempt.path
Python
mit
wujuguang/django-admin-honeypot,ajostergaard/django-admin-honeypot,dmpayton/django-admin-honeypot,Samael500/django-admin-honeypot,Samael500/django-admin-honeypot,ajostergaard/django-admin-honeypot,wujuguang/django-admin-honeypot,javierchavez/django-admin-honeypot,javierchavez/django-admin-honeypot,dmpayton/django-admin...
--- +++ @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'LoginAttempt.path' + db.add_column('admin_honeypot_logi...
121e63c069a83411f15c66d42a9ade871ad9afab
dosagelib/plugins/studiokhimera.py
dosagelib/plugins/studiokhimera.py
# -*- coding: utf-8 -*- # Copyright (C) 2019-2020 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function from ..scraper import _ParserScraper class StudioKhimera(_ParserScraper): imageSearch = '//figure[@class="gallery-item"]//img/@data-src' prevSearch = '//a[@rel="prev"]' ...
Add site engine for StudioKhimera
Add site engine for StudioKhimera
Python
mit
webcomics/dosage,peterjanes/dosage,webcomics/dosage,peterjanes/dosage
--- +++ @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2019-2020 Tobias Gruetzmacher + +from __future__ import absolute_import, division, print_function + +from ..scraper import _ParserScraper + + +class StudioKhimera(_ParserScraper): + imageSearch = '//figure[@class="gallery-item"]//img/@data-src' + ...
8e870ebb5d55207d45cc2b583291d6d5e0f2d4c1
set_1/challenge_2.py
set_1/challenge_2.py
def buffers_xor(buffer1, buffer2): """buffer1, buffer2: byte-like objects.""" try: return bytes(b1 ^ b2 for b1, b2 in zip(buffer1, buffer2)) except TypeError: print("Function 'buffers_xor' takes byte-like" "objects as an arguments.") if __name__ == '__main__': print(buffe...
Set 1 / Challenge 2 done.
Set 1 / Challenge 2 done.
Python
mit
vitkarpenko/cryptopals
--- +++ @@ -0,0 +1,13 @@ +def buffers_xor(buffer1, buffer2): + """buffer1, buffer2: byte-like objects.""" + try: + return bytes(b1 ^ b2 for b1, b2 in zip(buffer1, buffer2)) + except TypeError: + print("Function 'buffers_xor' takes byte-like" + "objects as an arguments.") + + +if __...