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
764958cd46ecc0f40e609eab2deb1e7be5696617
tests/formatter/test_csver.py
tests/formatter/test_csver.py
import unittest, argparse from echolalia.formatter.csver import Formatter class CsverTestCase(unittest.TestCase): def setUp(self): self.parser = argparse.ArgumentParser() self.data = [{'char': chr(i), 'order': i - 96} for i in xrange(97, 100)] self.formatter = Formatter() def test_add_args(self): ...
Add tests for formatter csv
Add tests for formatter csv
Python
mit
eiri/echolalia-prototype
--- +++ @@ -0,0 +1,31 @@ +import unittest, argparse +from echolalia.formatter.csver import Formatter + +class CsverTestCase(unittest.TestCase): + + def setUp(self): + self.parser = argparse.ArgumentParser() + self.data = [{'char': chr(i), 'order': i - 96} for i in xrange(97, 100)] + self.formatter = Formatt...
e1d09aad308aabd76f2be808806c5ed024f31d14
dartcms/apps/modules/migrations/0004_insert_modules.py
dartcms/apps/modules/migrations/0004_insert_modules.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-20 02:26 from __future__ import unicode_literals from django.db import migrations from dartcms.apps.modules.models import Module, ModuleGroup MODULE_GROUPS = [ { 'sort': 4, 'description': '', 'fa': 'fa-rocket', 'slug':...
Add migration for Ads modules
Add migration for Ads modules
Python
mit
astrikov-d/dartcms,astrikov-d/dartcms,astrikov-d/dartcms
--- +++ @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-05-20 02:26 +from __future__ import unicode_literals + +from django.db import migrations + +from dartcms.apps.modules.models import Module, ModuleGroup + +MODULE_GROUPS = [ + { + 'sort': 4, + 'description': '', + ...
f1c482f659311b5471dfde17a7b61251f33bf1e4
examples/demoproject/demoapp/views.py
examples/demoproject/demoapp/views.py
# Create your views here. from tasks import add from django.http import HttpResponse def foo(request): r = add.delay(2, 2) return HttpResponse(r.task_id)
# Create your views here. from demoapp import tasks from django.http import HttpResponse def foo(request): r = tasks.add.delay(2, 2) return HttpResponse(r.task_id)
Use from demoapp import tasks instead
Use from demoapp import tasks instead
Python
bsd-3-clause
digimarc/django-celery,nadios/django-celery,nadios/django-celery,tkanemoto/django-celery,celery/django-celery,Amanit/django-celery,CloudNcodeInc/django-celery,georgewhewell/django-celery,kanemra/django-celery,ask/django-celery,planorama/django-celery,axiom-data-science/django-celery,alexhayes/django-celery,georgewhewel...
--- +++ @@ -1,9 +1,9 @@ # Create your views here. -from tasks import add +from demoapp import tasks from django.http import HttpResponse def foo(request): - r = add.delay(2, 2) + r = tasks.add.delay(2, 2) return HttpResponse(r.task_id)
7af4ec5f01af042b1a98401837a50b97af33a6f3
accounting/apps/books/managers.py
accounting/apps/books/managers.py
from datetime import date from django.db import models from django.db.models import Sum class TotalQuerySetMixin(object): def _get_total(self, prop): return self.aggregate(sum=Sum(prop))["sum"] def total_paid(self): return self._get_total('payments__amount') class InvoiceQuerySetMixin(obj...
from datetime import date from django.db import models from django.db.models import Sum class TotalQuerySetMixin(object): def _get_total(self, prop): return self.aggregate(sum=Sum(prop))["sum"] def total_paid(self): return self._get_total('payments__amount') class InvoiceQuerySetMixin(obj...
Fix the dued queryset filter
Fix the dued queryset filter
Python
mit
dulaccc/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting,kenjhim/django-accounting,kenjhim/django-accounting
--- +++ @@ -16,7 +16,7 @@ class InvoiceQuerySetMixin(object): def dued(self): - return self.filter(date_issued__lte=date.today()) + return self.filter(date_dued__lte=date.today()) class EstimateQuerySet(TotalQuerySetMixin, models.QuerySet):
e807b17fe1c981f7ff50926358cdfebd563758b2
jsk_arc2017_common/node_scripts/and_scale_rosserial.py
jsk_arc2017_common/node_scripts/and_scale_rosserial.py
#!/usr/bin/env python import serial import rospy from std_msgs.msg import Float32 class ANDScaleRosserial(object): """Read data from AND scale. Data Sheet: https://www.aandd.co.jp/adhome/pdf/manual/balance/ekew-i.pdf """ def __init__(self): super(ANDScaleRosserial, self).__init__() ...
Read weight data from AND scale
Read weight data from AND scale - new file: and_scale_rosserial.py
Python
bsd-3-clause
pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +import serial + +import rospy +from std_msgs.msg import Float32 + + +class ANDScaleRosserial(object): + + """Read data from AND scale. + + Data Sheet: https://www.aandd.co.jp/adhome/pdf/manual/balance/ekew-i.pdf + """ + + def __init__(self): + supe...
648f22bae2ed11e5387417d22c47ee0c9ab5e053
tests/convergence_tests/run_convergence_tests_lspr.py
tests/convergence_tests/run_convergence_tests_lspr.py
import os import time import subprocess import datetime from check_for_meshes import check_mesh # tests to run tests = ['sphere_lspr.py', 'sphere_multiple_lspr.py'] # specify CUDA device to use CUDA_DEVICE = '0' ENV = os.environ.copy() ENV['CUDA_DEVICE'] = CUDA_DEVICE mesh_file = '' folder_name = 'lspr_convergence...
Add script to run all lspr convergence tests
Add script to run all lspr convergence tests
Python
bsd-3-clause
barbagroup/pygbe,barbagroup/pygbe,barbagroup/pygbe
--- +++ @@ -0,0 +1,32 @@ +import os +import time +import subprocess +import datetime + +from check_for_meshes import check_mesh + +# tests to run +tests = ['sphere_lspr.py', 'sphere_multiple_lspr.py'] + +# specify CUDA device to use +CUDA_DEVICE = '0' + +ENV = os.environ.copy() +ENV['CUDA_DEVICE'] = CUDA_DEVICE + +me...
589ae271909b3b5e8a5d153b143725f7d4a10491
tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.py
tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.py
#!/usr/bin/env python from __future__ import print_function from .common.spiders import BaseDocumentationSpider class HelpDocumentationSpider(BaseDocumentationSpider): name = "help_documentation_crawler" start_urls = ['http://localhost:9981/help'] deny_domains = [] # type: List[str] def _is_external...
#!/usr/bin/env python from __future__ import print_function from .common.spiders import BaseDocumentationSpider class HelpDocumentationSpider(BaseDocumentationSpider): name = "help_documentation_crawler" start_urls = ['http://localhost:9981/help'] deny_domains = [] # type: List[str] deny = ['/privacy...
Exclude privacy page from documentation checking
documentation-crawler: Exclude privacy page from documentation checking
Python
apache-2.0
isht3/zulip,vaidap/zulip,sonali0901/zulip,rht/zulip,shubhamdhama/zulip,amyliu345/zulip,Galexrt/zulip,souravbadami/zulip,jainayush975/zulip,shubhamdhama/zulip,christi3k/zulip,jrowan/zulip,samatdav/zulip,PhilSk/zulip,cosmicAsymmetry/zulip,vabs22/zulip,KingxBanana/zulip,niftynei/zulip,Diptanshu8/zulip,isht3/zulip,dawran6/...
--- +++ @@ -8,6 +8,7 @@ name = "help_documentation_crawler" start_urls = ['http://localhost:9981/help'] deny_domains = [] # type: List[str] + deny = ['/privacy'] def _is_external_url(self, url): # type: (str) -> bool
6afbf916dd5a721ae8779fb3f01a8c153b6bbc96
git-ignore.py
git-ignore.py
#! /usr/bin/env python2 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2014 Ciel <imwithye@gmail.com> # # Distributed under terms of the MIT license. import sys # print version def version(): print "git ignore, version 0.1." print print "http://github.com/imwithye/git-ignore" print "git ignore, copyrigh...
Add usage, version, and command router.
Add usage, version, and command router.
Python
mit
imwithye/git-ignore,imwithye/git-ignore
--- +++ @@ -0,0 +1,51 @@ +#! /usr/bin/env python2 +# -*- coding: utf-8 -*- +# vim:fenc=utf-8 +# +# Copyright © 2014 Ciel <imwithye@gmail.com> +# +# Distributed under terms of the MIT license. + +import sys + +# print version +def version(): + print "git ignore, version 0.1." + print + print "http://github.com/imwithy...
1946b2730b9a934c3b3fb2204581fe82f5b4af04
events/management/commands/assign_abstract_to_user.py
events/management/commands/assign_abstract_to_user.py
from __future__ import unicode_literals from django.contrib.auth.models import User from django.core.management.base import BaseCommand from django.db.models import Count from django.utils import timezone from events.models import Event, Abstract import math class Command(BaseCommand): help = "Assign abstract to...
Add command to assign more abstracts to a specific user
Add command to assign more abstracts to a specific user
Python
agpl-3.0
enjaz/enjaz,enjaz/enjaz,enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal
--- +++ @@ -0,0 +1,66 @@ +from __future__ import unicode_literals +from django.contrib.auth.models import User +from django.core.management.base import BaseCommand +from django.db.models import Count +from django.utils import timezone +from events.models import Event, Abstract + +import math + + +class Command(BaseCo...
b99c4005056487ffb37c2bd2cfdd0d9082c746c1
data_structures/Tree/Binary-tree/python/BinaryTree.py
data_structures/Tree/Binary-tree/python/BinaryTree.py
class Node: def __init__(self, key): self.right = None self.left = None self.key = key def addLeftChild(self, node): self.left = node def addRightChild(self, node): self.right = node class BinaryTree: def getRootOfTree(self): root = Node(1) nod...
Add binary tree in python
Add binary tree in python
Python
cc0-1.0
ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs...
--- +++ @@ -0,0 +1,45 @@ +class Node: + def __init__(self, key): + self.right = None + self.left = None + self.key = key + + def addLeftChild(self, node): + self.left = node + + def addRightChild(self, node): + self.right = node + + +class BinaryTree: + def getRootOfTree...
55fb9752311f79c5aa2ecd85c4264ae6821f52da
django_summernote/migrations/0002_update-help_text.py
django_summernote/migrations/0002_update-help_text.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-09-11 07:47 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('django_summernote', '0001_initial'), ] operations = [ migrations.AlterField...
Add a migration for updating help_text
Add a migration for updating help_text
Python
mit
lqez/django-summernote,summernote/django-summernote,lqez/django-summernote,summernote/django-summernote,summernote/django-summernote,lqez/django-summernote
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-11 07:47 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('django_summernote', '0001_initial'), + ] + + ope...
50bd003fce6ccc6545f610c6600852dcf6ebd05f
ansible/modules/hashivault/hashivault_leader.py
ansible/modules/hashivault/hashivault_leader.py
#!/usr/bin/env python from ansible.module_utils.hashivault import hashivault_argspec from ansible.module_utils.hashivault import hashivault_client from ansible.module_utils.hashivault import hashivault_init from ansible.module_utils.hashivault import hashiwrapper ANSIBLE_METADATA = {'status': ['stableinterface'], 'sup...
Add a module to fetch leader information cluster
Add a module to fetch leader information cluster
Python
mit
TerryHowe/ansible-modules-hashivault,TerryHowe/ansible-modules-hashivault
--- +++ @@ -0,0 +1,86 @@ +#!/usr/bin/env python +from ansible.module_utils.hashivault import hashivault_argspec +from ansible.module_utils.hashivault import hashivault_client +from ansible.module_utils.hashivault import hashivault_init +from ansible.module_utils.hashivault import hashiwrapper + +ANSIBLE_METADATA = {'...
bb60309dc207f388c3f84837041d1f0115521049
py/increasing-subsequences.py
py/increasing-subsequences.py
class Solution(object): def findSubsequences(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ lnums = len(nums) def dfs(idx, cur): if idx == lnums: if len(cur) > 1: yield tuple(cur) else: ...
Add py solution for 491. Increasing Subsequences
Add py solution for 491. Increasing Subsequences 491. Increasing Subsequences: https://leetcode.com/problems/increasing-subsequences/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,20 @@ +class Solution(object): + def findSubsequences(self, nums): + """ + :type nums: List[int] + :rtype: List[List[int]] + """ + lnums = len(nums) + def dfs(idx, cur): + if idx == lnums: + if len(cur) > 1: + ...
8f79afd448f0234eab82eb1d3e3d48e0f657bcc7
nova/tests/functional/regressions/test_bug_1902925.py
nova/tests/functional/regressions/test_bug_1902925.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add a regression test for 5.12 compute API issue
Add a regression test for 5.12 compute API issue In I147bf4d95e6d86ff1f967a8ce37260730f21d236 we wrote a breaking RPC change for the 5.12 version as the accel_uuids parameter is not optional. Adding a regression test to check the issue. Change-Id: I1f3914e16294c99a625b3984ca0098d835cd9b92 Related-Bug: #1902925
Python
apache-2.0
klmitch/nova,mahak/nova,mahak/nova,klmitch/nova,openstack/nova,mahak/nova,openstack/nova,klmitch/nova,klmitch/nova,openstack/nova
--- +++ @@ -0,0 +1,52 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writi...
b6cc76f1599620bee0b7f478c447588b965e960f
jal_stats/stats/migrations/0002_auto_20151027_0223.py
jal_stats/stats/migrations/0002_auto_20151027_0223.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('stats', '0001_initial'), ] operations = [ migrations.AlterField( model_name='datapoint', name='times...
Remove now() constraint on DateTimeField
Remove now() constraint on DateTimeField
Python
mit
jal-stats/django
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stats', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model...
ae83756e8874b30681d336fded42866d81a7b919
scripts/data_download/rais/download_manager_rais.py
scripts/data_download/rais/download_manager_rais.py
import os import commands import time import logging import sys if len(sys.argv) != 5 or (sys.argv[1:][0] not in ['pt', 'en']): print "ERROR! use :\n python scripts/data_download/rais/download_manager_rais.py en/pt output_path year time(seconds)\n" exit() files = ["i", "lo", "lio"] type_location = ["regions",...
Add mananger of files download.
Add mananger of files download.
Python
mit
DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site
--- +++ @@ -0,0 +1,34 @@ +import os +import commands +import time +import logging +import sys + +if len(sys.argv) != 5 or (sys.argv[1:][0] not in ['pt', 'en']): + print "ERROR! use :\n python scripts/data_download/rais/download_manager_rais.py en/pt output_path year time(seconds)\n" + exit() + +files = ["i", "l...
25abc6eb0498e629160543d37d43a8dfa665397a
waftools/configure_appinfo.py
waftools/configure_appinfo.py
import json from waflib.Configure import conf @conf def configure_appinfo(ctx, transforms): with open('appinfo.json', 'r') as appinfo_file: appinfo_json = json.load(appinfo_file) for transform in transforms: transform(appinfo_json) with open('appinfo.json', 'w') as appinfo_file: ...
Add configure appinfo waftool for transforming the appinfo
Add configure appinfo waftool for transforming the appinfo
Python
mit
youtux/PebbleShows,carlo-colombo/dublin-bus-pebble,jiangege/pebblejs-project,sunshineyyy/CatchOneBus,carlo-colombo/dublin-bus-pebble,sunshineyyy/CatchOneBus,youtux/PebbleShows,daduke/LMSController,jiangege/pebblejs-project,bkbilly/Tvheadend-EPG,fletchto99/pebblejs,jsfi/pebblejs,fletchto99/pebblejs,daduke/LMSController,...
--- +++ @@ -0,0 +1,15 @@ +import json + +from waflib.Configure import conf + + +@conf +def configure_appinfo(ctx, transforms): + with open('appinfo.json', 'r') as appinfo_file: + appinfo_json = json.load(appinfo_file) + + for transform in transforms: + transform(appinfo_json) + + with open('app...
9c3e6fbd762acae29fe71668e5c4faa28d8749a3
keyform/migrations/0014_auto_20180305_1627.py
keyform/migrations/0014_auto_20180305_1627.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-03-05 16:27 from __future__ import unicode_literals from django.db import migrations def convert_names(apps, schema_editor): contacts = apps.get_model('keyform', 'Contact') for contact in contacts.objects.all(): contact.email = contact.email....
Make a data migration that makes all contacts emails lowercase
Make a data migration that makes all contacts emails lowercase
Python
mit
mostateresnet/keyformproject,mostateresnet/keyformproject,mostateresnet/keyformproject
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2018-03-05 16:27 +from __future__ import unicode_literals + +from django.db import migrations + +def convert_names(apps, schema_editor): + contacts = apps.get_model('keyform', 'Contact') + + for contact in contacts.objects.all(): +...
b941f17d80b19f905cc15a350fc3d9a4f083baf9
tools/invocation-info-info.py
tools/invocation-info-info.py
#!/usr/bin/env python # Copyright (c) 2016, Daniel Liew # This file is covered by the license in LICENSE-SVCB.txt """ Read an invocation info files and display information about it. """ from load_klee_runner import add_KleeRunner_to_module_search_path add_KleeRunner_to_module_search_path() from KleeRunner import Invoca...
Add tool to display information about an invocation info file.
Add tool to display information about an invocation info file.
Python
mit
delcypher/klee-runner,delcypher/klee-runner
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# Copyright (c) 2016, Daniel Liew +# This file is covered by the license in LICENSE-SVCB.txt +""" +Read an invocation info files and display information +about it. +""" +from load_klee_runner import add_KleeRunner_to_module_search_path +add_KleeRunner_to_module_search_...
0aafbfe14ff9889c496ec2a4de382e113cb9c4a4
PynamoDB/util.py
PynamoDB/util.py
""" util.py ~~~~~~~~~~~~ contains utility functions. """ import hashlib from datetime import datetime # Classes def get_timestamp(): return datetime.utcnow() class Key(object): """ A simple object for adding aditional properties to keys """ def __init__(self, key=None, node_hash=None): ...
Add Key, Value, ErrorCode classes.
Add Key, Value, ErrorCode classes.
Python
mit
samuelwu90/PynamoDB
--- +++ @@ -0,0 +1,60 @@ +""" + util.py + ~~~~~~~~~~~~ + contains utility functions. +""" + +import hashlib +from datetime import datetime + + +# Classes + +def get_timestamp(): + return datetime.utcnow() + +class Key(object): + """ A simple object for adding aditional properties to keys """ + + def...
0d6a0b592c3d137c39cbc17f159d81a037a12730
sideloader/tests/test_utils.py
sideloader/tests/test_utils.py
from sideloader.utils import args_str, create_venv_paths def test_args_str_string_list(): """ args_str should join a list of strings. """ assert args_str(['a', 'b']) == 'a b' def test_args_str_mixed_list(): """ args_str should join a list of objects, converting each to a string. """ assert a...
Add some tests for utils
Add some tests for utils
Python
mit
praekelt/sideloader2,praekelt/sideloader2,praekelt/sideloader2
--- +++ @@ -0,0 +1,42 @@ +from sideloader.utils import args_str, create_venv_paths + + +def test_args_str_string_list(): + """ args_str should join a list of strings. """ + assert args_str(['a', 'b']) == 'a b' + + +def test_args_str_mixed_list(): + """ + args_str should join a list of objects, converting ...
989d83eba8a3207d614486693fa33cf85def6515
src/collectors/PowerDNSCollector/PowerDNSCollector.py
src/collectors/PowerDNSCollector/PowerDNSCollector.py
import diamond.collector import subprocess class PowerDNSCollector(diamond.collector.Collector): """ Collects all metrics exported by the powerdns nameserver using the pdns_control binary. """ def get_default_config(self): """ Returns the default collector settings """ ...
Add a collector for powerdns statistics
Add a collector for powerdns statistics
Python
mit
dcsquared13/Diamond,Ensighten/Diamond,MichaelDoyle/Diamond,Nihn/Diamond-1,eMerzh/Diamond-1,jumping/Diamond,jriguera/Diamond,socialwareinc/Diamond,Clever/Diamond,Ormod/Diamond,TinLe/Diamond,disqus/Diamond,Slach/Diamond,tellapart/Diamond,skbkontur/Diamond,CYBERBUGJR/Diamond,jaingaurav/Diamond,saucelabs/Diamond,datafiniti...
--- +++ @@ -0,0 +1,25 @@ +import diamond.collector +import subprocess + +class PowerDNSCollector(diamond.collector.Collector): + """ + Collects all metrics exported by the powerdns nameserver using the + pdns_control binary. + """ + def get_default_config(self): + """ + Returns the defa...
f9accb1320daeabef68dc9f78e5748c1fd498bce
anthemav/tools.py
anthemav/tools.py
import argparse import asyncio import anthemav import logging log = logging.getLogger(__name__) @asyncio.coroutine def console(loop): parser = argparse.ArgumentParser(description=console.__doc__) parser.add_argument('--host', default='127.0.0.1', help='IP or FQDN of AVR') parser.add_argument('--port', def...
Set up console monitor as a tool
Set up console monitor as a tool
Python
mit
nugget/python-anthemav
--- +++ @@ -0,0 +1,46 @@ +import argparse +import asyncio +import anthemav +import logging + +log = logging.getLogger(__name__) + +@asyncio.coroutine +def console(loop): + parser = argparse.ArgumentParser(description=console.__doc__) + parser.add_argument('--host', default='127.0.0.1', help='IP or FQDN of AVR')...
dd481b5aac131be2987364408c41c0dab835f6af
vumi/scripts/model_migrator.py
vumi/scripts/model_migrator.py
# -*- test-case-name: vumi.scripts.tests.test_model_migrator -*- import sys from twisted.python import usage from vumi.utils import load_class_by_string from vumi.persist.riak_manager import RiakManager class Options(usage.Options): optParameters = [ ["model", "m", None, "Full Python name of th...
Add start of migrator script.
Add start of migrator script.
Python
bsd-3-clause
vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,harrissoerja/vumi,TouK/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi
--- +++ @@ -0,0 +1,61 @@ +# -*- test-case-name: vumi.scripts.tests.test_model_migrator -*- +import sys + +from twisted.python import usage + +from vumi.utils import load_class_by_string +from vumi.persist.riak_manager import RiakManager + + +class Options(usage.Options): + optParameters = [ + ["model", "m",...
5119d396b67e732646545e50fedac80e5a663475
tests/test_meta.py
tests/test_meta.py
""" Tests for this repository. """ from pathlib import Path def test_init_files() -> None: """ ``__init__`` files exist where they should do. If ``__init__`` files are missing, linters may not run on all files that they should run on. """ directories = (Path('src'), Path('tests')) for d...
Add meta test for __init__ file
Add meta test for __init__ file
Python
mit
adamtheturtle/vws-python,adamtheturtle/vws-python
--- +++ @@ -0,0 +1,22 @@ +""" +Tests for this repository. +""" + +from pathlib import Path + + +def test_init_files() -> None: + """ + ``__init__`` files exist where they should do. + + If ``__init__`` files are missing, linters may not run on all files that + they should run on. + """ + directories...
9fc4c61e251f3f0657c5905bc031b307861ac679
ckanext/nhm/tests/test_helpers.py
ckanext/nhm/tests/test_helpers.py
#!/usr/bin/env python # encoding: utf-8 import unittest from ckanext.nhm.lib.helpers import dataset_author_truncate class AuthorTruncateTest(unittest.TestCase): ''' Tests for the dataset_author_truncate helper function. ''' def test_untruncated_author(self): ''' dataset_author_trunc...
Add tests for unicode usage in author truncation
Add tests for unicode usage in author truncation
Python
mit
NaturalHistoryMuseum/ckanext-nhm,NaturalHistoryMuseum/ckanext-nhm,NaturalHistoryMuseum/ckanext-nhm
--- +++ @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# encoding: utf-8 + +import unittest + +from ckanext.nhm.lib.helpers import dataset_author_truncate + + +class AuthorTruncateTest(unittest.TestCase): + ''' + Tests for the dataset_author_truncate helper function. + ''' + + def test_untruncated_author(self):...
b01f024cabc3649467dd3b42961225e035b032a7
camera_filters.py
camera_filters.py
""" Apply different filters here """ import cv2 # import OpenCV 3 module camera = cv2.VideoCapture(0) # get default camera mode = 2 # default mode, apply Canny edge detection while True: ok, frame = camera.read() # read frame if ok: # frame is read correctly if mode == 2: frame = cv2....
Apply different filters for web camera image
Apply different filters for web camera image
Python
mit
foobar167/junkyard,foobar167/junkyard,foobar167/junkyard,foobar167/junkyard,foobar167/junkyard,foobar167/junkyard
--- +++ @@ -0,0 +1,19 @@ +""" Apply different filters here """ + +import cv2 # import OpenCV 3 module + +camera = cv2.VideoCapture(0) # get default camera +mode = 2 # default mode, apply Canny edge detection +while True: + ok, frame = camera.read() # read frame + if ok: # frame is read correctly + i...
1b6853b7036025330d9055144fbd22f6fbe95de6
senlin/tests/tempest/api/policies/test_policy_show.py
senlin/tests/tempest/api/policies/test_policy_show.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add API test for policy show
Add API test for policy show Change-Id: I14aea48e014dda3850430b334afbb1f7b188a171
Python
apache-2.0
openstack/senlin,stackforge/senlin,stackforge/senlin,openstack/senlin,openstack/senlin
--- +++ @@ -0,0 +1,51 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writi...
aa1c2880dc85228d9a8d534858c1cfe70428cbde
src/ggrc/migrations/versions/20160510122526_44ebc240800b_remove_response_relationships.py
src/ggrc/migrations/versions/20160510122526_44ebc240800b_remove_response_relationships.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: goodson@google.com # Maintained By: goodson@google.com """ Remove relationships related to deleted response objects Create Date: 2016-05-10 12:25:...
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: goodson@google.com # Maintained By: goodson@google.com """ Remove relationships related to deleted response objects Create Date: 2016-05-10 12:25:...
Remove responses references in object_documents
Remove responses references in object_documents
Python
apache-2.0
selahssea/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,andrei-...
--- +++ @@ -30,6 +30,13 @@ ("Response", "DocumentationResponse", "InterviewResponse", "PopulationSampleResponse") """) + op.execute( + """ + DELETE FROM object_documents + WHERE documentable_type IN + ("Response", "DocumentationResponse", "InterviewResponse", + ...
4672c7bc0036c9bfb478f8483ca2dcffe0644b0e
apps/authentication/migrations/0014_auto_20170916_0124.py
apps/authentication/migrations/0014_auto_20170916_0124.py
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-09-16 01:24 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('authentication', '0013_auto_20161209_1447'), ] operations = [ migrations.Alte...
Add migrations that fixes pre 1.10 behavior
Add migrations that fixes pre 1.10 behavior
Python
mit
CasualGaming/studlan,dotKom/studlan,dotKom/studlan,dotKom/studlan,CasualGaming/studlan,dotKom/studlan,CasualGaming/studlan,CasualGaming/studlan
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2017-09-16 01:24 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('authentication', '0013_auto_20161209_1447'), + ] + + ...
1ae72b244dd867240ca23415faa2771f97d57569
astropy/io/misc/asdf/tags/time/tests/test_timedelta.py
astropy/io/misc/asdf/tags/time/tests/test_timedelta.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest from asdf.tests.helpers import assert_roundtrip_tree from astropy.time import Time @pytest.mark.parametrize('fmt', Time.FORMATS.keys()) def test_timedelta(fmt, tmpdir): t1 = Time(Time.now(), format=fmt) t...
Add test for serializing TimeDelta using ASDF
Add test for serializing TimeDelta using ASDF
Python
bsd-3-clause
aleksandr-bakanov/astropy,bsipocz/astropy,StuartLittlefair/astropy,saimn/astropy,pllim/astropy,MSeifert04/astropy,larrybradley/astropy,dhomeier/astropy,lpsinger/astropy,saimn/astropy,StuartLittlefair/astropy,mhvk/astropy,saimn/astropy,bsipocz/astropy,stargaser/astropy,bsipocz/astropy,mhvk/astropy,stargaser/astropy,lpsi...
--- +++ @@ -0,0 +1,19 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +# -*- coding: utf-8 -*- + +import pytest + +from asdf.tests.helpers import assert_roundtrip_tree + +from astropy.time import Time + + +@pytest.mark.parametrize('fmt', Time.FORMATS.keys()) +def test_timedelta(fmt, tmpdir): + + ...
bee2e32aae26721d687e81838718fe5458fa0504
create_tables.py
create_tables.py
# Copyright 2013 Pau Haro Negre # based on C++ code by Carl Staelin Copyright 2009-2011 # # See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with...
Add script to recreate the tables in the book
Add script to recreate the tables in the book
Python
apache-2.0
pauh/neuron
--- +++ @@ -0,0 +1,54 @@ +# Copyright 2013 Pau Haro Negre +# based on C++ code by Carl Staelin Copyright 2009-2011 +# +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use ...
24b3bd5c7f2ad5138bbf74dbdce571b4235404af
tests/test_user_management.py
tests/test_user_management.py
from __future__ import print_function # Use print() instead of print from app.core.models import User from app import db from app.startup.create_users import find_or_create_user def test_user_management(client): # allows user to register user = find_or_create_user(u'User2', u'Example', u'Mr', u'user2@example.com',...
Add test cases for user management
Add test cases for user management
Python
bsd-2-clause
UCL-CS35/incdb-user,UCL-CS35/incdb-user,UCL-CS35/incdb-user
--- +++ @@ -0,0 +1,33 @@ +from __future__ import print_function # Use print() instead of print +from app.core.models import User +from app import db +from app.startup.create_users import find_or_create_user + +def test_user_management(client): + + # allows user to register + user = find_or_create_user(u'User2', u'Ex...
a291e92f65d291f48281f131bd385976da65b12f
migrations/versions/3e6c454a6fc7_add_older_g_cloud_framewoks.py
migrations/versions/3e6c454a6fc7_add_older_g_cloud_framewoks.py
"""Add older G-Cloud Framewoks Revision ID: 3e6c454a6fc7 Revises: 3acf60608a7d Create Date: 2015-04-02 15:31:57.243449 """ # revision identifiers, used by Alembic. revision = '3e6c454a6fc7' down_revision = '3acf60608a7d' from alembic import op from sqlalchemy.sql import table, column from sqlalchemy import String, ...
Add G4 and G5 frameworks to database
Add G4 and G5 frameworks to database
Python
mit
alphagov/digitalmarketplace-api,mtekel/digitalmarketplace-api,alphagov/digitalmarketplace-api,mtekel/digitalmarketplace-api,mtekel/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,alphagov/digitalmarketplace-api,mtekel/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,RichardKnop/digitalmarketplace-api...
--- +++ @@ -0,0 +1,41 @@ +"""Add older G-Cloud Framewoks + +Revision ID: 3e6c454a6fc7 +Revises: 3acf60608a7d +Create Date: 2015-04-02 15:31:57.243449 + +""" + +# revision identifiers, used by Alembic. +revision = '3e6c454a6fc7' +down_revision = '3acf60608a7d' + +from alembic import op +from sqlalchemy.sql import tabl...
d2419fc5a232a7775f444a805abcf74dbfd76299
marketpulse/main/migrations/0009_auto_20150224_1356.py
marketpulse/main/migrations/0009_auto_20150224_1356.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django_countries import countries CARRIERS = { 'Telefonica Digital': [{'Movistar': ['Spain', 'Colombia', 'Venezuela', 'Peru', 'Uruguay', 'Mexico', 'Chile', 'El Sa...
Add a list of carriers in the app.
Add a list of carriers in the app.
Python
mpl-2.0
johngian/marketpulse,mozilla/marketpulse,akatsoulas/marketpulse,johngian/marketpulse,akatsoulas/marketpulse,mozilla/marketpulse,akatsoulas/marketpulse,mozilla/marketpulse,johngian/marketpulse,mozilla/marketpulse,akatsoulas/marketpulse,johngian/marketpulse
--- +++ @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +from django_countries import countries + +CARRIERS = { + 'Telefonica Digital': [{'Movistar': ['Spain', 'Colombia', 'Venezuela', 'Peru', + ...
ad7187dc6b24be4f41df2b8750dbe450fa597550
migrations/versions/530c22761e27_fix_column_lengths.py
migrations/versions/530c22761e27_fix_column_lengths.py
# -*- coding: utf-8 -*- """Fix column lengths Revision ID: 530c22761e27 Revises: e2b28adfa135 Create Date: 2020-04-20 16:19:22.597712 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '530c22761e27' down_revision = 'e2b28adfa135' branch_labels = None depends_on =...
Fix column lengths to match schema
Fix column lengths to match schema
Python
agpl-3.0
hasgeek/funnel,hasgeek/funnel,hasgeek/funnel,hasgeek/funnel,hasgeek/funnel
--- +++ @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +"""Fix column lengths + +Revision ID: 530c22761e27 +Revises: e2b28adfa135 +Create Date: 2020-04-20 16:19:22.597712 + +""" + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = '530c22761e27' +down_revision = 'e2b28...
60a228c8d530e11b10d44747c87d6585e45d8ab6
play.py
play.py
#!/usr/bin/env python3 import os import csv import cv2 import numpy as np import sklearn import copy import random import keras import tensorflow as tf from keras.preprocessing import image from keras.models import Model, Sequential from keras.layers import Flatten, Dense, Dropout from keras.layers.convolutional import...
Add initial start - doesn't work
Add initial start - doesn't work
Python
mit
johnflux/deep-learning-tictactoe
--- +++ @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +import os +import csv +import cv2 +import numpy as np +import sklearn +import copy +import random +import keras +import tensorflow as tf +from keras.preprocessing import image +from keras.models import Model, Sequential +from keras.layers import Flatten, Dense, Dropou...
4ce3502e1623ca24e43e01e4c580ee327e6192fa
django_extensions/management/commands/generate_secret_key.py
django_extensions/management/commands/generate_secret_key.py
# -*- coding: utf-8 -*- from random import choice from django.core.management.base import BaseCommand from django_extensions.management.utils import signalcommand class Command(BaseCommand): help = "Generates a new SECRET_KEY that can be used in a project settings file." requires_system_checks = False ...
# -*- coding: utf-8 -*- from random import choice from django.core.management.base import BaseCommand from django.core.management.utils import get_random_secret_key from django_extensions.management.utils import signalcommand class Command(BaseCommand): help = "Generates a new SECRET_KEY that can be used in a p...
Use same algo to generate SECRET_KEY as Django
Use same algo to generate SECRET_KEY as Django Using random from standard library is not cryptographically secure.
Python
mit
haakenlid/django-extensions,haakenlid/django-extensions,django-extensions/django-extensions,linuxmaniac/django-extensions,linuxmaniac/django-extensions,django-extensions/django-extensions,haakenlid/django-extensions,django-extensions/django-extensions,linuxmaniac/django-extensions
--- +++ @@ -2,6 +2,7 @@ from random import choice from django.core.management.base import BaseCommand +from django.core.management.utils import get_random_secret_key from django_extensions.management.utils import signalcommand @@ -13,4 +14,4 @@ @signalcommand def handle(self, *args, **options): -...
6fcffc327b641381ee960343adebb80688e90892
examples/svm/plot_weighted_classes.py
examples/svm/plot_weighted_classes.py
""" ================================================ SVM: Separating hyperplane with weighted classes ================================================ """ import numpy as np import pylab as pl from scikits.learn import svm # we create 40 separable points np.random.seed(0) nsamples_1 = 1000 nsamples_2 = 100 X = np.r_...
Add an exmple of svm using weighted classes
Add an exmple of svm using weighted classes
Python
bsd-3-clause
davidgbe/scikit-learn,xuewei4d/scikit-learn,UNR-AERIAL/scikit-learn,siutanwong/scikit-learn,florian-f/sklearn,tmhm/scikit-learn,aminert/scikit-learn,gotomypc/scikit-learn,arjoly/scikit-learn,thientu/scikit-learn,cwu2011/scikit-learn,untom/scikit-learn,JPFrancoia/scikit-learn,thilbern/scikit-learn,mehdidc/scikit-learn,t...
--- +++ @@ -0,0 +1,45 @@ +""" +================================================ +SVM: Separating hyperplane with weighted classes +================================================ + +""" + +import numpy as np +import pylab as pl +from scikits.learn import svm + +# we create 40 separable points +np.random.seed(0) +nsa...
b7b2d59cfb05f06b8ce4e64db90528753a003c8c
astroquery/tests/test_fermi.py
astroquery/tests/test_fermi.py
from astroquery import fermi def test_query(): query = fermi.FermiLAT_Query() result = query('M31') print result if __name__ == '__main__': test_query()
Add a test for the Fermi query
Add a test for the Fermi query
Python
bsd-3-clause
imbasimba/astroquery,imbasimba/astroquery,ceb8/astroquery,ceb8/astroquery
--- +++ @@ -0,0 +1,10 @@ +from astroquery import fermi + +def test_query(): + + query = fermi.FermiLAT_Query() + result = query('M31') + print result + +if __name__ == '__main__': + test_query()
b210ca7692f9aad908b9ebe9558964bcfc0f6d4d
cfp/migrations/0049_use_correct_uk_country_code.py
cfp/migrations/0049_use_correct_uk_country_code.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def fix_conference_country_code(apps, schema_editor): Conference = apps.get_model("cfp", "Conference") for conference in Conference.objects.all(): if conference.country == "UK": confer...
Add a migration to patch up old 'UK'-coded conferences
Add a migration to patch up old 'UK'-coded conferences
Python
mit
kyleconroy/speakers,kyleconroy/speakers,kyleconroy/speakers
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +def fix_conference_country_code(apps, schema_editor): + Conference = apps.get_model("cfp", "Conference") + + for conference in Conference.objects.all(): + if conferenc...
707897dce2221a41292353eb127cc4d6b05bec4f
solutions/uri/1028/1028.py
solutions/uri/1028/1028.py
import sys def gcd(a, b): while b > 0: a, b = b, a % b return a n = int(input()) for line in range(n): a, b = map(int, input().split()) print(gcd(a, b))
Solve Collectable Cards in python
Solve Collectable Cards in python
Python
mit
deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr...
--- +++ @@ -0,0 +1,13 @@ +import sys + +def gcd(a, b): + while b > 0: + a, b = b, a % b + + return a + +n = int(input()) + +for line in range(n): + a, b = map(int, input().split()) + print(gcd(a, b))
edd8c163c4fc45cd77b89bf86cf13f9f9518ebec
pytac/lattice_length.py
pytac/lattice_length.py
import pytac.load_csv import pytac.epics def main(): lattice = pytac.load_csv.load('VMX', pytac.epics.EpicsControlSystem()) print lattice.get_length() if __name__=='__main__': main()
Print the length of the lattice
Print the length of the lattice
Python
apache-2.0
razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects
--- +++ @@ -0,0 +1,10 @@ +import pytac.load_csv +import pytac.epics + +def main(): + lattice = pytac.load_csv.load('VMX', pytac.epics.EpicsControlSystem()) + print lattice.get_length() + + +if __name__=='__main__': + main()
15d248dfe94a69605deb8c3ab11af55213129f8e
capture_audio.py
capture_audio.py
import pyaudio FORMAT = pyaudio.paInt16 CHANNELS = 1 def capture_buffers(num_buffers, chunk, rate, skip=None): if skip == None: skip = rate / 2 p = pyaudio.PyAudio() stream = p.open(format=FORMAT, channels=CHANNELS, rate=rate, input=True, frames_per_buffer=chunk) # ignore some data at th...
Revert "Removes unused capture audio helper."
Revert "Removes unused capture audio helper." This reverts commit 2996177950985a96e4fb4c4179cd43bd6ea53f6c.
Python
mit
Katee/quietnet,richo/quietnet
--- +++ @@ -0,0 +1,29 @@ +import pyaudio + +FORMAT = pyaudio.paInt16 +CHANNELS = 1 + +def capture_buffers(num_buffers, chunk, rate, skip=None): + if skip == None: + skip = rate / 2 + + p = pyaudio.PyAudio() + stream = p.open(format=FORMAT, channels=CHANNELS, rate=rate, input=True, frames_per_buffer=ch...
3cbd8125028cca7ad18388f8c07202865847f242
qual/tests/test_date.py
qual/tests/test_date.py
import unittest from datetime import date from qual.calendars import DateWithCalendar class TestDateWtihCalendar(unittest.TestCase): def setUp(self): date_dt = date(2010, 8, 1) self.date_wc = DateWithCalendar(None, date_dt) def test_comparisons(self): self.assertTrue(self.date_wc < ...
Add test for date comparison.
Add test for date comparison.
Python
apache-2.0
jwg4/qual,jwg4/calexicon
--- +++ @@ -0,0 +1,17 @@ +import unittest + +from datetime import date + +from qual.calendars import DateWithCalendar + +class TestDateWtihCalendar(unittest.TestCase): + def setUp(self): + date_dt = date(2010, 8, 1) + self.date_wc = DateWithCalendar(None, date_dt) + + def test_comparisons(self): ...
4f0415f5cb7f8322a0738cb1d55c7102464d3aef
openedx/core/djangoapps/discussions/tests/test_views.py
openedx/core/djangoapps/discussions/tests/test_views.py
""" Test app view logic """ # pylint: disable=test-inherits-tests import unittest from django.conf import settings from django.urls import reverse from opaque_keys.edx.keys import CourseKey from rest_framework import status from rest_framework.test import APITestCase from common.djangoapps.student.tests.factories imp...
Add tests for discussions API access
test: Add tests for discussions API access This checks for expected API access [1]; data integrity will be checked later [2]. This work exposes that the code currently does _not_ grant access to _course_ staff, only _global_ staff. This is being addressed next [3]. Fix: TNL-8229 [1] - [1] https://openedx.atlassian....
Python
agpl-3.0
edx/edx-platform,angelapper/edx-platform,eduNEXT/edx-platform,arbrandes/edx-platform,eduNEXT/edx-platform,angelapper/edx-platform,arbrandes/edx-platform,angelapper/edx-platform,arbrandes/edx-platform,edx/edx-platform,arbrandes/edx-platform,eduNEXT/edx-platform,eduNEXT/edx-platform,edx/edx-platform,edx/edx-platform,ange...
--- +++ @@ -0,0 +1,93 @@ +""" +Test app view logic +""" +# pylint: disable=test-inherits-tests +import unittest + +from django.conf import settings +from django.urls import reverse +from opaque_keys.edx.keys import CourseKey +from rest_framework import status +from rest_framework.test import APITestCase + +from commo...
5d9d89577e34612bcdcee6b48fad3a6d615d2316
scripts/nplm-training/reduce_ngrams.py
scripts/nplm-training/reduce_ngrams.py
#!/usr/bin/env python3 """Reduces an ngrams file for training nplm to a smaller version of it with less ngrams""" from sys import argv if len(argv) != 5: print("Wrong number of args, got: " + str(len(argv) - 1) + " expected 4.") print("Usage: reduce_ngrams.py INFILE OUTFILE START_IDX NGRAMS") exit() INFI...
Add option to reduce the ngrams from already prepared .ngrams file to train a model with smaller number of ngrams
Add option to reduce the ngrams from already prepared .ngrams file to train a model with smaller number of ngrams
Python
lgpl-2.1
hychyc07/mosesdecoder,KonceptGeek/mosesdecoder,alvations/mosesdecoder,KonceptGeek/mosesdecoder,alvations/mosesdecoder,moses-smt/mosesdecoder,alvations/mosesdecoder,alvations/mosesdecoder,alvations/mosesdecoder,hychyc07/mosesdecoder,moses-smt/mosesdecoder,alvations/mosesdecoder,alvations/mosesdecoder,tofula/mosesdecoder...
--- +++ @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +"""Reduces an ngrams file for training nplm to a smaller version of it with less ngrams""" +from sys import argv + +if len(argv) != 5: + print("Wrong number of args, got: " + str(len(argv) - 1) + " expected 4.") + print("Usage: reduce_ngrams.py INFILE OUTFILE ...
a0b1bd7c43ab6d8683fd7cb18c5a9ca692ee5e19
busstops/management/commands/update_search_indexes.py
busstops/management/commands/update_search_indexes.py
from django.core.management.base import BaseCommand from ...search_indexes import ServiceIndex from ...models import Service class Command(BaseCommand): def handle(self, *args, **options): service_index = ServiceIndex() for service in Service.objects.filter(current=False): service_inde...
Add command to remove archived services from search index
Add command to remove archived services from search index
Python
mpl-2.0
stev-0/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk
--- +++ @@ -0,0 +1,10 @@ +from django.core.management.base import BaseCommand +from ...search_indexes import ServiceIndex +from ...models import Service + + +class Command(BaseCommand): + def handle(self, *args, **options): + service_index = ServiceIndex() + for service in Service.objects.filter(curr...
41c1d4a829aa47e5403757d8670e1ed9e5b3d1f6
cityhallmonitor/migrations/0020_auto_20151214_1329.py
cityhallmonitor/migrations/0020_auto_20151214_1329.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import connection, models, migrations import cityhallmonitor.models def add_document_gin_index_wt(apps, schema_editor): Document = apps.get_model('cityhallmonitor', 'Document') db_table = Document._meta.db_table with connecti...
Add migration command to create index on weighted vector field
Add migration command to create index on weighted vector field
Python
mit
NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import connection, models, migrations +import cityhallmonitor.models + + +def add_document_gin_index_wt(apps, schema_editor): + Document = apps.get_model('cityhallmonitor', 'Document') + db_table = Docum...
dd9411db392df3c7f5026fe3695e2ec9fc9b6dbe
FlaskMedia/forms.py
FlaskMedia/forms.py
from flask_wtf import FlaskForm as Form from wtforms import StringField, BooleanField, TextAreaField from wtforms.validators import DataRequired, Length class EditMovieForm(Form): title = StringField('title', validators=[DataRequired()]) plot = TextAreaField('plot', validators=[Length(min=0, max=2047)])
Edit movie form, title and plot only
Edit movie form, title and plot only
Python
mit
samcheck/PyMedia,samcheck/PyMedia,samcheck/PyMedia
--- +++ @@ -0,0 +1,7 @@ +from flask_wtf import FlaskForm as Form +from wtforms import StringField, BooleanField, TextAreaField +from wtforms.validators import DataRequired, Length + +class EditMovieForm(Form): + title = StringField('title', validators=[DataRequired()]) + plot = TextAreaField('plot', validators=...
9dfd925f049df7ecbecdf848d1f0758f885909a3
deleteSnapshotSize8GWeekago.py
deleteSnapshotSize8GWeekago.py
import boto import datetime import dateutil from dateutil import parser from boto import ec2 connection=ec2.connect_to_region("ap-southeast-1") snapshotsID=connection.get_all_snapshots(filters={'owner-id':611762388050,'volume-size':8}) timeLimit=datetime.datetime.now() - datetime.timedelta(days=7) count=0 fo...
Delete Snapshot having Size 8 GiB and a week older
Delete Snapshot having Size 8 GiB and a week older
Python
apache-2.0
hiteshBhatia/aws-boto-scripts
--- +++ @@ -0,0 +1,32 @@ +import boto +import datetime +import dateutil +from dateutil import parser +from boto import ec2 + + +connection=ec2.connect_to_region("ap-southeast-1") + + +snapshotsID=connection.get_all_snapshots(filters={'owner-id':611762388050,'volume-size':8}) + + + +timeLimit=datetime.datetime.now() ...
9e63413e040f0e10327651bb2d54edc2df438de5
salt/states/ssh_auth.py
salt/states/ssh_auth.py
''' Allows for state management of ssh authorized keys ''' def present( name, user, enc='ssh-rsa', comment='', options=[], config='.ssh/authorized_keys'): ''' Verifies that the specified ssh key is present for the specified user ''' ret = {'name': name, ...
Add the ssh authorized key state, still needs absent state
Add the ssh authorized key state, still needs absent state
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,37 @@ +''' +Allows for state management of ssh authorized keys +''' + +def present( + name, + user, + enc='ssh-rsa', + comment='', + options=[], + config='.ssh/authorized_keys'): + ''' + Verifies that the specified ssh key is present for the specified...
ba814b1f519d1a1ceb19e5fe88c6fe11737a07be
dci/alembic/versions/980e18983453_sync_database.py
dci/alembic/versions/980e18983453_sync_database.py
# # Copyright (C) 2022 Red Hat, Inc # # 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 writin...
Set etag and updated_at components fields not nullable
Set etag and updated_at components fields not nullable Today in production database updated_at and etag are nullable. Table "public.components" Column | Type | Modifiers ------------------------+-----------------------------+----------- updated_at ...
Python
apache-2.0
redhat-cip/dci-control-server,redhat-cip/dci-control-server
--- +++ @@ -0,0 +1,50 @@ +# +# Copyright (C) 2022 Red Hat, Inc +# +# 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 ...
76edf4ea679ca3c117c7cff21e05f18044b5f51a
education/management/commands/schedule_all_scripts.py
education/management/commands/schedule_all_scripts.py
from django.core.management.base import BaseCommand from education.scheduling import schedule_script from script.models import Script class Command(BaseCommand): def handle(self, **options): for script in Script.objects.all(): schedule_script(script) self.stdout.write('Done!\n')
Add a command for scheduling all scripts.
Add a command for scheduling all scripts.
Python
bsd-3-clause
unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac
--- +++ @@ -0,0 +1,10 @@ +from django.core.management.base import BaseCommand +from education.scheduling import schedule_script +from script.models import Script + +class Command(BaseCommand): + + def handle(self, **options): + for script in Script.objects.all(): + schedule_script(script) + ...
806f64880b7eb9ff72026f4ee2ebd12cf1ef723d
infcommon/generic_factory_test.py
infcommon/generic_factory_test.py
# -*- coding: utf-8 -*- import sys import types import importlib import traceback import os import fnmatch import re from datetime import datetime TOTALS_TESTS_PASSED = 0 LAST_CALL = None GREEN_COLOR = "\033[0;32m" WHITE_COLOR = "\033[0;39m" RED_COLOR = "\033[91m" def find_and_call_functions_from(): global TOT...
Add generic factory test runner
Add generic factory test runner
Python
mit
aleasoluciones/infcommon,aleasoluciones/infcommon
--- +++ @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +import sys +import types +import importlib +import traceback +import os +import fnmatch +import re +from datetime import datetime + + +TOTALS_TESTS_PASSED = 0 +LAST_CALL = None +GREEN_COLOR = "\033[0;32m" +WHITE_COLOR = "\033[0;39m" +RED_COLOR = "\033[91m" + + +def...
517e8f16dbc24af3371a287e69c4d1361c1744f6
python_scripts/azure_sense.py
python_scripts/azure_sense.py
#!/usr/bin/env python """ sends temperature, humidity and pressure gathered from Sense Hat on Raspberry Pi2 to Azure Table Storage only python works with Azure , not python3, sudo pip install azure-storage invoke (no sudo required): python azure_sense.py """ import time from sense_hat import SenseHat from datet...
Add script for sending sense info to azure table storage
Add script for sending sense info to azure table storage
Python
mit
mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +""" + sends temperature, humidity and pressure + gathered from Sense Hat on Raspberry Pi2 to Azure Table Storage + only python works with Azure , not python3, + sudo pip install azure-storage + invoke (no sudo required): python azure_sense.py +""" + +import time +fr...
40b8b6baaab21aa294eea0ffe07a6bfbd85d1a5c
create_black_square_picture.py
create_black_square_picture.py
# Create plain black square picture from PIL import Image img = Image.new('RGB', (225, 225), color='black') img.save('temp/black_square.png')
Create plain black square picture
Create plain black square picture
Python
mit
foobar167/junkyard,foobar167/junkyard,foobar167/junkyard,foobar167/junkyard,foobar167/junkyard,foobar167/junkyard
--- +++ @@ -0,0 +1,5 @@ +# Create plain black square picture +from PIL import Image + +img = Image.new('RGB', (225, 225), color='black') +img.save('temp/black_square.png')
29f8849f74b10490561177668ef30dd267445ffb
test/test_speed.py
test/test_speed.py
from nose.tools import assert_greater, assert_less import collections import time import cProfile import pstats import pandas as pd import numpy as np from numpy.random import normal from phip import hit_calling def test_speed(profile=False): starts = collections.OrderedDict() timings = collections.Ordere...
Add speed test for hit calling
Add speed test for hit calling
Python
apache-2.0
laserson/phip-stat,lasersonlab/phip-stat
--- +++ @@ -0,0 +1,87 @@ +from nose.tools import assert_greater, assert_less + +import collections +import time +import cProfile +import pstats + +import pandas as pd +import numpy as np +from numpy.random import normal + + +from phip import hit_calling + + +def test_speed(profile=False): + starts = collections.Or...
2202662b311ae8e1e21b9f5816debc40fefa85a1
bulb/migrations/0027_readathon_team.py
bulb/migrations/0027_readathon_team.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def add_teams(apps, schema_editor): Team = apps.get_model('clubs', 'Team') Club = apps.get_model('clubs', 'Club') StudentClubYear = apps.get_model('core', 'StudentClubYear') year_2016_2017 = Studen...
Add migrations to add readathon teams
Add migrations to add readathon teams
Python
agpl-3.0
enjaz/enjaz,enjaz/enjaz,osamak/student-portal,osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,enjaz/enjaz,enjaz/enjaz,osamak/student-portal
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + +def add_teams(apps, schema_editor): + Team = apps.get_model('clubs', 'Team') + Club = apps.get_model('clubs', 'Club') + StudentClubYear = apps.get_model('core', 'StudentCl...
1378c45ba1d3f2f3291c71390798e70abb52b87a
migrations/versions/0144_add_notification_reply_to.py
migrations/versions/0144_add_notification_reply_to.py
""" Revision ID: 0144_add_notification_reply_to Revises: 0143_remove_reply_to Create Date: 2017-11-22 14:23:48.806781 """ from alembic import op import sqlalchemy as sa revision = '0144_add_notification_reply_to' down_revision = '0143_remove_reply_to' def upgrade(): op.add_column('notifications', sa.Column('r...
Add a column to Notifications to store the reply_to_text. This is text value of the sender_id, depending on the channel this will be a SMS sender, email reply to address or a letter contact block. This is the first PR in a series to refactor how we send the "reply_to" the provider, eventually we can eliminate the notif...
Add a column to Notifications to store the reply_to_text. This is text value of the sender_id, depending on the channel this will be a SMS sender, email reply to address or a letter contact block. This is the first PR in a series to refactor how we send the "reply_to" the provider, eventually we can eliminate the notif...
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,21 @@ +""" + +Revision ID: 0144_add_notification_reply_to +Revises: 0143_remove_reply_to +Create Date: 2017-11-22 14:23:48.806781 + +""" +from alembic import op +import sqlalchemy as sa + + +revision = '0144_add_notification_reply_to' +down_revision = '0143_remove_reply_to' + + +def upgrade(): + ...
1475a740f122f915127ed283ec25f0d48e2cc211
tests/integration/templatetags/test_currency_filters.py
tests/integration/templatetags/test_currency_filters.py
# -*- coding: utf-8 -*- from decimal import Decimal as D from django.utils import translation from django.test import TestCase from django import template def render(template_string, ctx): tpl = template.Template(template_string) return tpl.render(template.Context(ctx)) class TestCurrencyFilter(TestCase): ...
# -*- coding: utf-8 -*- from decimal import Decimal as D from django.utils import translation from django.test import TestCase from django import template def render(template_string, ctx): tpl = template.Template(template_string) return tpl.render(template.Context(ctx)) class TestCurrencyFilter(TestCase): ...
Use translation.override as a context manager instead of a decorator.
Use translation.override as a context manager instead of a decorator.
Python
bsd-3-clause
kapari/django-oscar,MatthewWilkes/django-oscar,WillisXChen/django-oscar,taedori81/django-oscar,solarissmoke/django-oscar,WillisXChen/django-oscar,WadeYuChen/django-oscar,MatthewWilkes/django-oscar,taedori81/django-oscar,django-oscar/django-oscar,anentropic/django-oscar,okfish/django-oscar,jlmadurga/django-oscar,saadatq...
--- +++ @@ -35,8 +35,8 @@ 'price': '' })) - @translation.override(None, deactivate=True) def test_handles_no_translation(self): - self.template.render(template.Context({ - 'price': D('10.23'), - })) + with translation.override(None, deactivate=True): + ...
6ff3506b94789cde6772efa097253ceda4729db4
tests/spec/test_spec_schema.py
tests/spec/test_spec_schema.py
import pytest from aiohttp import hdrs from aiohttp_json_api.common import JSONAPI_CONTENT_TYPE @pytest.mark.parametrize( 'resource_type', ('authors', 'books', 'chapters', 'photos', 'stores') ) async def test_spec_schema(test_client, fantasy_app, jsonapi_validator, resource_type): ...
Add tests for JSON API schema and content type negotiation
Add tests for JSON API schema and content type negotiation
Python
mit
vovanbo/aiohttp_json_api
--- +++ @@ -0,0 +1,38 @@ +import pytest +from aiohttp import hdrs + +from aiohttp_json_api.common import JSONAPI_CONTENT_TYPE + + +@pytest.mark.parametrize( + 'resource_type', + ('authors', 'books', 'chapters', 'photos', 'stores') +) +async def test_spec_schema(test_client, fantasy_app, jsonapi_validator, + ...
dbdda8bbb60807f7b3e55728ce0d61c1b8fed8a9
tests/test_global_arguments.py
tests/test_global_arguments.py
from glob import glob from importlib import import_module from inspect import getargspec, getmembers from os import path from types import FunctionType from unittest import TestCase from pyinfra import operations from pyinfra.api.operation_kwargs import OPERATION_KWARGS def _is_pyinfra_operation(module, key, value):...
Add tests for operation arguments clashing with global arguments.
Add tests for operation arguments clashing with global arguments. This makes it possible to expand the global argument list with confidence. It's worth noting this shouldn't be done lightly, as it prevents any argument keys being used elsewhere.
Python
mit
Fizzadar/pyinfra,Fizzadar/pyinfra
--- +++ @@ -0,0 +1,47 @@ +from glob import glob +from importlib import import_module +from inspect import getargspec, getmembers +from os import path +from types import FunctionType +from unittest import TestCase + +from pyinfra import operations +from pyinfra.api.operation_kwargs import OPERATION_KWARGS + + +def _is...
4defc023eddc8ccd2f324e5971412c14b931c346
apps/network/tests/test_routes/test_infrastructure.py
apps/network/tests/test_routes/test_infrastructure.py
def test_create_network(client): result = client.post("/networks/", data={"name": "test_network"}) assert result.status_code == 200 assert result.get_json() == {"msg": "Network created succesfully!"} def test_get_all_network(client): result = client.get("/networks/") assert result.status_code ==...
ADD Network infrastructure unit tests
ADD Network infrastructure unit tests
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
--- +++ @@ -0,0 +1,55 @@ + + + +def test_create_network(client): + result = client.post("/networks/", data={"name": "test_network"}) + assert result.status_code == 200 + assert result.get_json() == {"msg": "Network created succesfully!"} + +def test_get_all_network(client): + result = client.get("/network...
0a4b52a0aaa4c244139d31d0ac96b877995d800c
examples/manage_node_labels.py
examples/manage_node_labels.py
# Copyright 2016 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
Add example about node label management
Add example about node label management Show how to add/remove/change node labels. Signed-off-by: Flavio Castelli <d1035a58d87d0b7918844ad2fd699273faf2f5d5@suse.com>
Python
apache-2.0
mbohlool/client-python,sebgoa/client-python,mbohlool/client-python,kubernetes-client/python,sebgoa/client-python,kubernetes-client/python,djkonro/client-python,djkonro/client-python
--- +++ @@ -0,0 +1,46 @@ +# Copyright 2016 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless requ...
3052ea9df56c9a501685b6ccb7d820e96c119d15
easycrud/urls.py
easycrud/urls.py
from django.conf.urls import patterns, url from django.db.models.loading import get_models from .models import EasyCrudModel from .views import ListView, CreateView, DetailView, UpdateView, DeleteView def easycrud_urlpatterns(): model_list = [m for m in get_models() if issubclass(m, EasyCrudModel)] pattern_l...
Add function to compute url patterns
Add function to compute url patterns
Python
bsd-2-clause
dekkers/django-easycrud,dekkers/django-easycrud
--- +++ @@ -0,0 +1,27 @@ +from django.conf.urls import patterns, url +from django.db.models.loading import get_models + +from .models import EasyCrudModel +from .views import ListView, CreateView, DetailView, UpdateView, DeleteView + + +def easycrud_urlpatterns(): + model_list = [m for m in get_models() if issubcl...
0568cefa17975c3f70f78cc1815262aa62c586e6
json_readable.py
json_readable.py
#!/usr/bin/env python import json, os for filename in os.listdir('.'): if os.path.isfile(filename) and os.path.splitext(filename)[1].lower() == '.json': with open(filename) as in_file: data = json.load(in_file) with open(filename, 'w') as out_file: json.dump(data, out_file,...
Reformat all local .json files to be human readable
Reformat all local .json files to be human readable
Python
apache-2.0
cclauss/Ten-lines-or-less
--- +++ @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import json, os + +for filename in os.listdir('.'): + if os.path.isfile(filename) and os.path.splitext(filename)[1].lower() == '.json': + with open(filename) as in_file: + data = json.load(in_file) + with open(filename, 'w') as out_file: +...
9928136681629b6d3e49bdd15839d1caad3feaf2
wooey/migrations/0009_wooeyjob_uuid.py
wooey/migrations/0009_wooeyjob_uuid.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import uuid, os def gen_uuid(apps, schema_editor): WooeyJob = apps.get_model('wooey', 'WooeyJob') for obj in WooeyJob.objects.all(): obj.uuid = uuid.uuid4() obj.save() class Migration(mig...
Add migration for UUID (pre-fill)
Add migration for UUID (pre-fill)
Python
bsd-3-clause
wooey/Wooey,hottwaj/Wooey,alexkolar/Wooey,waytai/Wooey,waytai/Wooey,waytai/Wooey,wooey/Wooey,wooey/Wooey,hottwaj/Wooey,alexkolar/Wooey,hottwaj/Wooey,alexkolar/Wooey,wooey/Wooey
--- +++ @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import uuid, os + +def gen_uuid(apps, schema_editor): + WooeyJob = apps.get_model('wooey', 'WooeyJob') + for obj in WooeyJob.objects.all(): + obj.uuid = uuid.uuid4() + ...
0ceb2f6dfb7fd4e34ca2f8f286f2eb9d3d22cd57
bagpipe/bgp/vpn/rd_allocator.py
bagpipe/bgp/vpn/rd_allocator.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # encoding: utf-8 # Copyright 2014 Orange # # 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 # # Un...
Add an allocator for Route Distinguishers
Add an allocator for Route Distinguishers
Python
apache-2.0
openstack/networking-bagpipe-l2,openstack/networking-bagpipe,openstack/networking-bagpipe-l2,openstack/networking-bagpipe,stackforge/networking-bagpipe-l2,stackforge/networking-bagpipe-l2
--- +++ @@ -0,0 +1,69 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# encoding: utf-8 + +# Copyright 2014 Orange +# +# 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.a...
9a475c84e66abc7acadcb9fca1be755597093190
corehq/apps/reports/tests/test_message_event_display.py
corehq/apps/reports/tests/test_message_event_display.py
from testil import eq from corehq.apps.sms.models import MessagingEvent from ..standard.message_event_display import get_status_display def test_get_status_display_escapes_error_message(): class fake_event: status = MessagingEvent.STATUS_ERROR error_code = None additional_error_text = "<&...
Add test for message status escaping
Add test for message status escaping
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,14 @@ +from testil import eq + +from corehq.apps.sms.models import MessagingEvent +from ..standard.message_event_display import get_status_display + + +def test_get_status_display_escapes_error_message(): + class fake_event: + status = MessagingEvent.STATUS_ERROR + error_code = Non...
aa572e1a1e40e091882a565a9200e3242453cf22
green/test/test_integration.py
green/test/test_integration.py
import multiprocessing import os from pathlib import PurePath import subprocess import sys import tempfile from textwrap import dedent import unittest try: from unittest.mock import MagicMock except: from mock import MagicMock from green import cmdline class TestFinalizer(unittest.TestCase): def setUp(s...
Add test for finalizer, which broke in 3.8 due to underlying change in Pool._repopulate_pool, which also manifests as a hang in long-running tests that manage to kill all the worker processes.
Add test for finalizer, which broke in 3.8 due to underlying change in Pool._repopulate_pool, which also manifests as a hang in long-running tests that manage to kill all the worker processes.
Python
mit
CleanCut/green,CleanCut/green
--- +++ @@ -0,0 +1,60 @@ +import multiprocessing +import os +from pathlib import PurePath +import subprocess +import sys +import tempfile +from textwrap import dedent +import unittest + +try: + from unittest.mock import MagicMock +except: + from mock import MagicMock + +from green import cmdline + + +class Test...
6a9d0d1b75cf9fa53b54964ba5d55d4534a7f3b1
tests/test_lexer.py
tests/test_lexer.py
import unittest import sure import lexer class TestLexer(unittest.TestCase): def _lex_data(self, data): lex = lexer.Lexer() lex.input(data) token_list = list(lex) return token_list def _assert_individual_token(self, input, expected_token_type, expected_token_value): l ...
Add very basic lexer test that passes
Add very basic lexer test that passes
Python
mit
Renelvon/llama,dionyziz/llama,dionyziz/llama,Renelvon/llama
--- +++ @@ -0,0 +1,40 @@ +import unittest +import sure +import lexer + +class TestLexer(unittest.TestCase): + def _lex_data(self, data): + lex = lexer.Lexer() + lex.input(data) + token_list = list(lex) + return token_list + + def _assert_individual_token(self, input, expected_token_...
bbdb59b9f94e4c0fa887e4ddb4cf3df3413f27fe
test/test_controller.py
test/test_controller.py
import mock from libmproxy import controller class TestMaster: def test_default_handler(self): m = controller.Master(None) msg = mock.MagicMock() m.handle(msg) assert msg.reply.call_count == 1
Test controller message default reply.
Test controller message default reply.
Python
mit
mhils/mitmproxy,mhils/mitmproxy,bazzinotti/mitmproxy,xbzbing/mitmproxy,scriptmediala/mitmproxy,gzzhanghao/mitmproxy,sethp-jive/mitmproxy,jvillacorta/mitmproxy,xaxa89/mitmproxy,devasia1000/mitmproxy,mosajjal/mitmproxy,sethp-jive/mitmproxy,ikoz/mitmproxy,Kriechi/mitmproxy,xtso520ok/mitmproxy,jvillacorta/mitmproxy,meizhou...
--- +++ @@ -0,0 +1,12 @@ +import mock +from libmproxy import controller + + +class TestMaster: + def test_default_handler(self): + m = controller.Master(None) + msg = mock.MagicMock() + m.handle(msg) + assert msg.reply.call_count == 1 + +
b3470f055f666c928839489e93945fc932abe19e
tests/test_compounds.py
tests/test_compounds.py
import unittest import inflect class test(unittest.TestCase): def test_compound_1(self): self.assertEqual(p.singular_noun('hello-out-there'),'hello-out-there') def test_compound_2(self): self.assertEqual(p.singular_noun('hello out there'),'hello out there') def test_compound_3(self): self.assertEqua...
Test Case for testing COMPOUNDS for singular_noun
Test Case for testing COMPOUNDS for singular_noun
Python
mit
jazzband/inflect,hugovk/inflect.py,pwdyson/inflect.py
--- +++ @@ -0,0 +1,17 @@ +import unittest +import inflect + +class test(unittest.TestCase): + def test_compound_1(self): + self.assertEqual(p.singular_noun('hello-out-there'),'hello-out-there') + def test_compound_2(self): + self.assertEqual(p.singular_noun('hello out there'),'hello out there') + def test_compound...
0641c1fba12ac7e59d28654ed4e9bf16816101c5
opps/__init__.py
opps/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- VERSION = (0, 0, 1) __version__ = ".".join(map(str, VERSION)) __status__ = "Development" __description__ = u"Opps CMS websites magazines and high-traffic" __author__ = u"Thiago Avelino" __credits__ = [] __email__ = u"opps-developers@googlegroups.com" __license__ = u"BSD"...
Add init var opps package
Add init var opps package
Python
mit
williamroot/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,opps/opps,williamroot/opps,opps/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,opps/opps
--- +++ @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +VERSION = (0, 0, 1) + +__version__ = ".".join(map(str, VERSION)) +__status__ = "Development" +__description__ = u"Opps CMS websites magazines and high-traffic" + +__author__ = u"Thiago Avelino" +__credits__ = [] +__email__ = u"opps-developers...
afb541d39ae13526372c7480dcf775ce0480086c
oslo/__init__.py
oslo/__init__.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # 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...
# 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...
Remove extraneous vim editor configuration comments
Remove extraneous vim editor configuration comments Change-Id: I2fb6d6174cf8b73ee663efa6718f4358be673869 Partial-Bug: #1229324
Python
apache-2.0
JioCloud/oslo.middleware,openstack/oslo.middleware,varunarya10/oslo.middleware
--- +++ @@ -1,5 +1,3 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - # 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
43eff2f524ed372134e6f50effb69c05a1df0b58
tools/crosstalk-test.py
tools/crosstalk-test.py
#!/usr/bin/env python # Open Pixel Control client: Test crosstalk between LED strips; # send each strip a different pattern, use a lot of low-brightness # pixels so that glitches show up clearly. import opc, time client = opc.Client('localhost:7890') while True: for strip in range(8): pixels = [ (40,40,40) ] * 5...
Add a tool for provoking crosstalk glitches between channels
Add a tool for provoking crosstalk glitches between channels
Python
mit
jsestrich/fadecandy,pixelmatix/fadecandy,Protoneer/fadecandy,piers7/fadecandy,Jorgen-VikingGod/fadecandy,lincomatic/fadecandy,Protoneer/fadecandy,fragmede/fadecandy,nomis52/fadecandy,pixelmatix/fadecandy,scanlime/fadecandy,lincomatic/fadecandy,Jorgen-VikingGod/fadecandy,hakan42/fadecandy,pixelmatix/fadecandy,piers7/fad...
--- +++ @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +# Open Pixel Control client: Test crosstalk between LED strips; +# send each strip a different pattern, use a lot of low-brightness +# pixels so that glitches show up clearly. + +import opc, time + +client = opc.Client('localhost:7890') + +while True: + for strip in ...
4f26177ef1bd75478be911462cfa28d23ffa6b7d
dbaas/workflow/tests/test_host_provider/test_provider.py
dbaas/workflow/tests/test_host_provider/test_provider.py
from mock import patch, MagicMock from workflow.steps.util.host_provider import Provider from physical.tests import factory as physical_factory from workflow.tests.test_host_provider import BaseCreateVirtualMachineTestCase from dbaas_credentials.tests import factory as credential_factory from dbaas_credentials.models i...
Add test for provider(not finished)
Add test for provider(not finished)
Python
bsd-3-clause
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
--- +++ @@ -0,0 +1,74 @@ +from mock import patch, MagicMock +from workflow.steps.util.host_provider import Provider +from physical.tests import factory as physical_factory +from workflow.tests.test_host_provider import BaseCreateVirtualMachineTestCase +from dbaas_credentials.tests import factory as credential_factory...
769c1d808efa7940b3890f37b3f422b2194ab269
ehrcorral/herd.py
ehrcorral/herd.py
"""Base class for a herd - a group of records""" class Herd(): """You need: - validate names (check for commas, weird chars, convert to unicode/ascii?) * remove Mrs, PhD, Ms., etc. * check for commas, weird chars * convert to unicode/ascii? - validate that you only have certain fie...
Add skeleton file for Herd class
Add skeleton file for Herd class
Python
isc
nsh87/ehrcorral
--- +++ @@ -0,0 +1,13 @@ +"""Base class for a herd - a group of records""" + + +class Herd(): + """You need: + - validate names (check for commas, weird chars, convert to unicode/ascii?) + * remove Mrs, PhD, Ms., etc. + * check for commas, weird chars + * convert to unicode/ascii? + - va...
ecf16ee24b076d93475d212ca1fd7efdca6f2c19
openstack/tests/functional/telemetry/v2/test_meter.py
openstack/tests/functional/telemetry/v2/test_meter.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add functional tests for telemetry meter
Add functional tests for telemetry meter Change-Id: I409e92761a400e12558338e7cba9edacf0b57f13
Python
apache-2.0
mtougeron/python-openstacksdk,mtougeron/python-openstacksdk,briancurtin/python-openstacksdk,dudymas/python-openstacksdk,dudymas/python-openstacksdk,dtroyer/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-opens...
--- +++ @@ -0,0 +1,20 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writi...
5f6616ba17a44552e31bdda4028336a3f23bb44d
scripts/analyze-project-deps.py
scripts/analyze-project-deps.py
import os import re from use_lldb_suite import lldb_root src_dir = os.path.join(lldb_root, "source") inc_dir = os.path.join(lldb_root, "include") src_map = {} include_regex = re.compile('#include \"(lldb(.*/)+).*\"') def scan_deps(this_dir, file): includes = set() with open(file) as f: ...
Add a script to dump out all project inter-dependencies.
Add a script to dump out all project inter-dependencies. git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@296920 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb
--- +++ @@ -0,0 +1,65 @@ +import os +import re + +from use_lldb_suite import lldb_root + +src_dir = os.path.join(lldb_root, "source") +inc_dir = os.path.join(lldb_root, "include") + +src_map = {} + +include_regex = re.compile('#include \"(lldb(.*/)+).*\"') + +def scan_deps(this_dir, file): + includes = set() + ...
670ef725528e474f9ee89695999bf127d81c94aa
fellowms/migrations/0007_auto_20160414_1411.py
fellowms/migrations/0007_auto_20160414_1411.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-14 14:11 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fellowms', '0006_auto_20160414_1132'), ] operations = [ migrations.RenameFie...
Add migration for update on fellow model
Add migration for update on fellow model
Python
bsd-3-clause
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
--- +++ @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-04-14 14:11 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fellowms', '0006_auto_20160414_1132'), + ] + + op...
4838b59bb3ab30ab7641308c2de4e1ce989f663f
config/sublime-text-3/Packages/User/disable_minimap.py
config/sublime-text-3/Packages/User/disable_minimap.py
# -*- encoding: utf-8 -*- import sublime import sublime_plugin class DisableMinimap(sublime_plugin.EventListener): def on_activated(self, view): view.window().set_minimap_visible(False)
Disable minimap in Sublime Text 3.
Disable minimap in Sublime Text 3.
Python
apache-2.0
mikelward/conf,mikelward/conf
--- +++ @@ -0,0 +1,9 @@ +# -*- encoding: utf-8 -*- + +import sublime +import sublime_plugin + +class DisableMinimap(sublime_plugin.EventListener): + + def on_activated(self, view): + view.window().set_minimap_visible(False)
0980736fbefd8b7bbf881108bc021058335624e4
edm/mathtypes.py
edm/mathtypes.py
try: from mathutils import Matrix, Vector except ImportError: # We don't have mathutils. Make some very basic replacements. class Vector(tuple): def __repr__(self): return "Vector({})".format(super(Vector, self).__repr__()) class Matrix(tuple): def transposed(self): cols = [[self[j][i] for ...
Add previously-missed placeholder Vector/Matrix code
Add previously-missed placeholder Vector/Matrix code This lets us use the read.py script without having to import the Blender module, at the moment. Importing should probably be kept separate from reading into blender, but it's convenient to share math structures if possible.
Python
mit
ndevenish/Blender_ioEDM,ndevenish/Blender_ioEDM
--- +++ @@ -0,0 +1,14 @@ + +try: + from mathutils import Matrix, Vector +except ImportError: + # We don't have mathutils. Make some very basic replacements. + class Vector(tuple): + def __repr__(self): + return "Vector({})".format(super(Vector, self).__repr__()) + class Matrix(tuple): + def transposed(...
9fba9934c9b47881ee468f295a3710f2c184fab1
tendrl/node_agent/__init__.py
tendrl/node_agent/__init__.py
try: from gevent import monkey except ImportError: pass else: monkey.patch_all() from tendrl.commons import CommonNS from tendrl.node_agent.objects.definition import Definition from tendrl.node_agent.objects.config import Config from tendrl.node_agent.objects.node_context import NodeContext from tendrl.no...
try: from gevent import monkey except ImportError: pass else: monkey.patch_all() from tendrl.commons import CommonNS from tendrl.node_agent.objects.definition import Definition from tendrl.node_agent.objects.config import Config from tendrl.node_agent.objects.node_context import NodeContext from tendrl.no...
Fix greenlet and essential objects startup order
Fix greenlet and essential objects startup order
Python
lgpl-2.1
Tendrl/node_agent,Tendrl/node-agent,r0h4n/node-agent,Tendrl/node_agent,Tendrl/node-agent,Tendrl/node-agent,r0h4n/node-agent,r0h4n/node-agent
--- +++ @@ -33,5 +33,4 @@ self.type = 'node' super(NodeAgentNS, self).__init__() -import __builtin__ -__builtin__.tendrl_ns = NodeAgentNS() +NodeAgentNS()
f3b4de822bee52e103ff2ba4543f941cceed420f
zerver/management/commands/generate_multiuse_invite_link.py
zerver/management/commands/generate_multiuse_invite_link.py
from __future__ import absolute_import from __future__ import print_function from typing import Any from argparse import ArgumentParser from confirmation.models import Confirmation, create_confirmation_link from zerver.lib.management import ZulipBaseCommand from zerver.lib.actions import create_stream_if_needed from ...
Create multiuse user invite generation command.
command: Create multiuse user invite generation command.
Python
apache-2.0
showell/zulip,shubhamdhama/zulip,eeshangarg/zulip,hackerkid/zulip,eeshangarg/zulip,shubhamdhama/zulip,hackerkid/zulip,jackrzhang/zulip,shubhamdhama/zulip,verma-varsha/zulip,dhcrzf/zulip,rht/zulip,punchagan/zulip,timabbott/zulip,jackrzhang/zulip,Galexrt/zulip,synicalsyntax/zulip,timabbott/zulip,zulip/zulip,amanharitsh12...
--- +++ @@ -0,0 +1,53 @@ +from __future__ import absolute_import +from __future__ import print_function + +from typing import Any + +from argparse import ArgumentParser +from confirmation.models import Confirmation, create_confirmation_link +from zerver.lib.management import ZulipBaseCommand +from zerver.lib.actions ...
3dd761611c8458f4df31fd8fb925c2758dbe9685
_python/main/migrations/0014_auto_20191219_1744.py
_python/main/migrations/0014_auto_20191219_1744.py
# Generated by Django 2.2.9 on 2019-12-19 17:44 from django.db import migrations def delete_courts_without_cases(apps, schema_editor): CaseCourt = apps.get_model('main', 'CaseCourt') CaseCourt.objects.filter(cases__isnull=True).delete() class Migration(migrations.Migration): dependencies = [ (...
Delete courts with no cases.
Delete courts with no cases.
Python
agpl-3.0
harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o
--- +++ @@ -0,0 +1,19 @@ +# Generated by Django 2.2.9 on 2019-12-19 17:44 + +from django.db import migrations + + +def delete_courts_without_cases(apps, schema_editor): + CaseCourt = apps.get_model('main', 'CaseCourt') + CaseCourt.objects.filter(cases__isnull=True).delete() + + +class Migration(migrations.Migra...
650126e0007dfda5cc8091ef8ee42991433b742f
product_sale_price_by_margin/migrations/8.0.0.3.0/pre-migration.py
product_sale_price_by_margin/migrations/8.0.0.3.0/pre-migration.py
# -*- encoding: utf-8 -*- from openerp import SUPERUSER_ID from openerp.modules.registry import RegistryManager def copy_column(cr, model, table, target_field, source_field, condition): print 'Making copy of columne %s to column %s' % ( source_field, target_field) cr.execute('SELECT id, %(field)s ' ...
ADD prod sale price by margin migration scripts
ADD prod sale price by margin migration scripts
Python
agpl-3.0
ingadhoc/product,ingadhoc/product
--- +++ @@ -0,0 +1,38 @@ +# -*- encoding: utf-8 -*- +from openerp import SUPERUSER_ID +from openerp.modules.registry import RegistryManager + + +def copy_column(cr, model, table, target_field, source_field, condition): + print 'Making copy of columne %s to column %s' % ( + source_field, target_field) + c...
383560e40268eedb56d5030f654f660465957a47
examples/subch/subch_forward.py
examples/subch/subch_forward.py
# C-burning with A=23 URCA rate module generator import pynucastro as pyna from pynucastro.networks import StarKillerNetwork library_file = "20180228default2" mylibrary = pyna.rates.Library(library_file) all_nuclei = ["he4", "c12", "o16", "n14", "f18", "ne21", "p", "n13", "ne20"] subCh = mylibrary.linking_nuclei(al...
Add example building a subch network using the Library.linking_nuclei feature.
Add example building a subch network using the Library.linking_nuclei feature.
Python
bsd-3-clause
pyreaclib/pyreaclib
--- +++ @@ -0,0 +1,19 @@ +# C-burning with A=23 URCA rate module generator + +import pynucastro as pyna +from pynucastro.networks import StarKillerNetwork + +library_file = "20180228default2" +mylibrary = pyna.rates.Library(library_file) + +all_nuclei = ["he4", "c12", "o16", "n14", "f18", "ne21", "p", "n13", "ne20"] ...
97054c3ccac35100dace5df43dcd3b70a15836a6
peeringdb/management/commands/index_peer_records.py
peeringdb/management/commands/index_peer_records.py
from __future__ import unicode_literals import logging from django.core.management.base import BaseCommand from peeringdb.api import PeeringDB class Command(BaseCommand): help = 'Index peer records based on PeeringDB.' logger = logging.getLogger('peering.manager.peeringdb') def handle(self, *args, **o...
Add a command to index peer records.
Add a command to index peer records.
Python
apache-2.0
respawner/peering-manager,respawner/peering-manager,respawner/peering-manager,respawner/peering-manager
--- +++ @@ -0,0 +1,18 @@ +from __future__ import unicode_literals + +import logging + +from django.core.management.base import BaseCommand + +from peeringdb.api import PeeringDB + + +class Command(BaseCommand): + help = 'Index peer records based on PeeringDB.' + logger = logging.getLogger('peering.manager.peeri...
92622b83b1b191fec22655fa727fbd87c5af211f
spelling_ru.py
spelling_ru.py
def pl_1(order): """2, 3, 4""" return (order == 'тысяча') and 'тысячи' or order + 'а' def pl_2(order): """5 и больше""" return (order == 'тысяча') and 'тысяч' or order + 'ов' RU_PASSES = """ ^ 1 <order> = <order> 1 <thousand> = одна тысяча 2 <thousand> = две тысячи <2_to_4> <order> = <order, pl_1> <n...
Add preliminary Russian spelling definitions
Add preliminary Russian spelling definitions
Python
mit
alco/numspell,alco/numspell
--- +++ @@ -0,0 +1,17 @@ + +def pl_1(order): + """2, 3, 4""" + return (order == 'тысяча') and 'тысячи' or order + 'а' + +def pl_2(order): + """5 и больше""" + return (order == 'тысяча') and 'тысяч' or order + 'ов' + +RU_PASSES = """ +^ 1 <order> = <order> +1 <thousand> = одна тысяча +2 <thousand> = две ты...
1b88cbcb7a0b7aef7c41d6eedc632394b5d915c4
examples/gegl.py
examples/gegl.py
# from gi.repository import Gegl, GeglGtk3 from gi.repository import MyPaint, MyPaintGegl if __name__ == '__main__': # Create a brush, load from disk brush = MyPaint.Brush() brush_def = open("brushes/classic/brush.myb").read() brush.from_string(brush_def) # List all settings # TODO: Is there...
Add start of a Python/GI/GEGL-based example
brushlib: Add start of a Python/GI/GEGL-based example
Python
isc
achadwick/libmypaint,achadwick/libmypaint,b3sigma/libmypaint,achadwick/libmypaint,achadwick/libmypaint,b3sigma/libmypaint,b3sigma/libmypaint
--- +++ @@ -0,0 +1,53 @@ + +# from gi.repository import Gegl, GeglGtk3 +from gi.repository import MyPaint, MyPaintGegl + +if __name__ == '__main__': + + # Create a brush, load from disk + brush = MyPaint.Brush() + brush_def = open("brushes/classic/brush.myb").read() + brush.from_string(brush_def) + + #...
940cf693dcde58677630b7757701317c5cf4bbc3
filestore/test/test_handlers.py
filestore/test/test_handlers.py
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import numpy as np import h5py import tempfile import uuid import mongoengine import mongoengine.connection from filestore.api import (insert_resource, insert_datum, retrieve, ...
Add test of AD_HDF5 handler.
ENH: Add test of AD_HDF5 handler.
Python
bsd-3-clause
ericdill/fileStore,danielballan/filestore,ericdill/databroker,tacaswell/filestore,ericdill/fileStore,ericdill/databroker,stuwilkins/filestore,NSLS-II/filestore,danielballan/filestore,stuwilkins/filestore
--- +++ @@ -0,0 +1,64 @@ +from __future__ import (absolute_import, division, print_function, + unicode_literals) + +import six +import numpy as np +import h5py +import tempfile +import uuid +import mongoengine +import mongoengine.connection +from filestore.api import (insert_resource, insert_da...
5fc2c62ff47d7483701d5677357f06e7d9169f60
gennotes_server/serializers.py
gennotes_server/serializers.py
from rest_framework import serializers from .models import Relation, Variant class VariantSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Variant fields = ["tags"] class RelationSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Relation ...
from rest_framework import serializers from .models import Relation, Variant class VariantSerializer(serializers.HyperlinkedModelSerializer): """ Serialize a Variant object. """ b37_id = serializers.SerializerMethodField() class Meta: model = Variant fields = ['b37_id', 'tags'] ...
Return the variant ID in the API
Return the variant ID in the API
Python
mit
usajusaj/gennotes,PersonalGenomesOrg/gennotes,PersonalGenomesOrg/gennotes,PersonalGenomesOrg/gennotes,usajusaj/gennotes,usajusaj/gennotes
--- +++ @@ -3,12 +3,34 @@ class VariantSerializer(serializers.HyperlinkedModelSerializer): + """ + Serialize a Variant object. + """ + + b37_id = serializers.SerializerMethodField() + class Meta: model = Variant - fields = ["tags"] + fields = ['b37_id', 'tags'] + + @sta...
6b51bb8e62ca8bb43c93c2c58b65b5b4fb5c1a06
src/ggrc/settings/app_engine.py
src/ggrc/settings/app_engine.py
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: dan@reciprocitylabs.com # Maintained By: dan@reciprocitylabs.com APP_ENGINE = True ENABLE_JASMINE = False LOGIN_MANAGER = 'ggrc.login.appengine' FU...
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: dan@reciprocitylabs.com # Maintained By: dan@reciprocitylabs.com APP_ENGINE = True ENABLE_JASMINE = False LOGIN_MANAGER = 'ggrc.login.appengine' FU...
Disable SQL logging in appengine
Disable SQL logging in appengine
Python
apache-2.0
uskudnik/ggrc-core,uskudnik/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,jmakov/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,VinnieJohns/ggrc-core,vladan-m/ggrc-core,j0gurt/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,prasannav7/ggrc-core,NejcZupec/ggrc-core,jmakov/ggrc-core,vlad...
--- +++ @@ -9,6 +9,6 @@ FULLTEXT_INDEXER = 'ggrc.fulltext.mysql.MysqlIndexer' # Cannot access filesystem on AppEngine or when using SDK AUTOBUILD_ASSETS = False -SQLALCHEMY_RECORD_QUERIES = True +SQLALCHEMY_RECORD_QUERIES = False MEMCACHE_MECHANISM = True CALENDAR_MECHANISM = False
a20daba8cb21b1513e9f81b9dc6fc2090512c270
infra/utils/delete-projects.py
infra/utils/delete-projects.py
#!/usr/bin/env python3 # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Add script for deleting all projects within a folder
Add script for deleting all projects within a folder
Python
apache-2.0
GoogleCloudPlatform/cloud-foundation-toolkit,GoogleCloudPlatform/cloud-foundation-toolkit,GoogleCloudPlatform/cloud-foundation-toolkit,GoogleCloudPlatform/cloud-foundation-toolkit,GoogleCloudPlatform/cloud-foundation-toolkit
--- +++ @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 + +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# ...
d4dd2dd454858686e9b4ef8f7fe6c9f3b267101a
migrations/versions/610_change_numberofsuppliers_to_integer.py
migrations/versions/610_change_numberofsuppliers_to_integer.py
"""Change numberOfSuppliers to integer Revision ID: 610 Revises: 600 Create Date: 2016-05-06 11:37:59.204714 """ # revision identifiers, used by Alembic. revision = '610' down_revision = '600' import re from alembic import op import sqlalchemy as sa from sqlalchemy.sql import table, column from sqlalchemy.dialects...
Add a migration to change brief numberOfSuppliers to integer
Add a migration to change brief numberOfSuppliers to integer If 'numberOfSuppliers' is a string parse the last number from the value and convert it to integer.
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
--- +++ @@ -0,0 +1,61 @@ +"""Change numberOfSuppliers to integer + +Revision ID: 610 +Revises: 600 +Create Date: 2016-05-06 11:37:59.204714 + +""" + +# revision identifiers, used by Alembic. +revision = '610' +down_revision = '600' + +import re + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.sql i...
e1b2898c9201d8735797ad626843e448a8791773
conf_site/proposals/tests/test_presentation_connection.py
conf_site/proposals/tests/test_presentation_connection.py
from symposion.conference.models import Section from symposion.proposals.models import ProposalBase from symposion.schedule.models import Presentation from conf_site.proposals.tests import ProposalTestCase class PresentationProposalConnectionTestCase(ProposalTestCase): def test_presentation_proposal_model(self):...
Add test case for Presentation-Proposal connection.
Add test case for Presentation-Proposal connection. Presentation.proposal should return the specific class (Proposal) and not ProposalBase.
Python
mit
pydata/conf_site,pydata/conf_site,pydata/conf_site
--- +++ @@ -0,0 +1,27 @@ +from symposion.conference.models import Section +from symposion.proposals.models import ProposalBase +from symposion.schedule.models import Presentation + +from conf_site.proposals.tests import ProposalTestCase + + +class PresentationProposalConnectionTestCase(ProposalTestCase): + def tes...
82237f41c5d1a79378a90d3463cc04a67a5b8088
tests/APIs/python/functional/load/load_pascal_voc_2012.py
tests/APIs/python/functional/load/load_pascal_voc_2012.py
#!/usr/bin/env python3 """ Test loading Pascal VOC 2012. """ from __future__ import print_function import os import dbcollection.manager as dbc # storage dir data_dir = os.path.join(os.path.expanduser("~"), 'tmp', 'download_data') # delete all cache data + dir print('\n==> dbcollection: config_cache()') dbc.confi...
Add load test for the pascal voc 2012 dataset
tests: Add load test for the pascal voc 2012 dataset
Python
mit
dbcollection/dbcollection,farrajota/dbcollection
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 + +""" +Test loading Pascal VOC 2012. +""" + + +from __future__ import print_function +import os +import dbcollection.manager as dbc + +# storage dir +data_dir = os.path.join(os.path.expanduser("~"), 'tmp', 'download_data') + + +# delete all cache data + dir +print('\n...
2e25b2d8f149106be3635fcf7f195bde1614e00b
plugin/core/test_transports.py
plugin/core/test_transports.py
import unittest import io from .transports import StdioTransport import time def json_rpc_message(payload: str) -> bytes: content_length = len(payload) return b'Content-Length: ' + bytes( str(content_length), 'utf-8') + b'\r\n\r\n' + bytes(payload, 'utf-8') class FakeProcess(object): def __init_...
Add test for stdio transport
Add test for stdio transport
Python
mit
tomv564/LSP
--- +++ @@ -0,0 +1,45 @@ +import unittest +import io +from .transports import StdioTransport +import time + + +def json_rpc_message(payload: str) -> bytes: + content_length = len(payload) + return b'Content-Length: ' + bytes( + str(content_length), 'utf-8') + b'\r\n\r\n' + bytes(payload, 'utf-8') + + +cl...