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
3b182032ae092560b2423e77f657ec0794ce38e6
planetstack/model_policies/model_policy_User.py
planetstack/model_policies/model_policy_User.py
from core.models import * def handle(user): deployments = Deployment.objects.all() site_deployments = SiteDeployments.objects.all() site_deploy_lookup = defaultdict(list) for site_deployment in site_deployments: site_deploy_lookup[site_deployment.site].append(site_deployment.deployment) user_deploy_lookup = de...
Add new users to all deployments
Policy: Add new users to all deployments
Python
apache-2.0
cboling/xos,wathsalav/xos,cboling/xos,open-cloud/xos,opencord/xos,xmaruto/mcord,open-cloud/xos,wathsalav/xos,opencord/xos,wathsalav/xos,opencord/xos,zdw/xos,jermowery/xos,jermowery/xos,zdw/xos,zdw/xos,cboling/xos,wathsalav/xos,open-cloud/xos,xmaruto/mcord,zdw/xos,jermowery/xos,xmaruto/mcord,xmaruto/mcord,cboling/xos,cb...
--- +++ @@ -0,0 +1,30 @@ +from core.models import * + +def handle(user): + deployments = Deployment.objects.all() + site_deployments = SiteDeployments.objects.all() + site_deploy_lookup = defaultdict(list) + for site_deployment in site_deployments: + site_deploy_lookup[site_deployment.site].append(site_deployment.de...
7e7bd440a1e3f585464df3458070528d0100d456
pyseidon/handlers/__init__.py
pyseidon/handlers/__init__.py
import pyseidon import sys def handle_script(): import runpy """ Allow the client to run an arbitrary Python script. Here's sample usage: ``` def expensive_setup(): ... if __name__ == '__main__': expensive_setup() import pyseidon.handlers pyseidon.handlers.handle_script() ``` """ def handler():...
Add helper to run requested Python script
Add helper to run requested Python script
Python
mit
gdb/pyseidon,gdb/pyseidon
--- +++ @@ -0,0 +1,28 @@ +import pyseidon +import sys + +def handle_script(): + import runpy + """ +Allow the client to run an arbitrary Python script. + +Here's sample usage: + +``` +def expensive_setup(): + ... + +if __name__ == '__main__': + expensive_setup() + + import pyseidon.handlers + pyseidon.handl...
87172e2b9e0143cf164dc34c26c69fc4eda7dd1e
seleniumbase/config/ad_block_list.py
seleniumbase/config/ad_block_list.py
""" For use with SeleniumBase ad_block functionality. Usage: On the command line: "pytest SOME_TEST.py --ad_block" From inside a test: self.ad_block() If using the command line version, the ad_block functionality gets activated after "self.wait_for_ready_state_complete()" is called, which is always r...
Add initial block list for ad_block functionality
Add initial block list for ad_block functionality
Python
mit
seleniumbase/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase
--- +++ @@ -0,0 +1,53 @@ +""" +For use with SeleniumBase ad_block functionality. + +Usage: + On the command line: + "pytest SOME_TEST.py --ad_block" + + From inside a test: + self.ad_block() + +If using the command line version, the ad_block functionality gets +activated after "self.wait_for_ready_state_c...
2d4f09fe8c31aa2b996e71565292d5ef249986c7
tools/gyp-explain.py
tools/gyp-explain.py
#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Prints paths between gyp targets. """ import json import os import sys import time from collections import deque def usage():...
Add a small tool to answer questions like "Why does target A depend on target B".
Add a small tool to answer questions like "Why does target A depend on target B". BUG=none TEST=none Review URL: http://codereview.chromium.org/8672006 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@111430 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
yitian134/chromium,yitian134/chromium,ropik/chromium,ropik/chromium,ropik/chromium,ropik/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,adobe/chromium,adobe/chromium,gavinp/chromium,ropik/chromium,yitian134/chromium,ropik/...
--- +++ @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Prints paths between gyp targets. +""" + +import json +import os +import sys +import time + +fr...
5e32d890fe0762163f1edab6672df91e7d461d8f
check-if-a-given-sequence-of-moves-for-a-robot-is-circular-or-not.py
check-if-a-given-sequence-of-moves-for-a-robot-is-circular-or-not.py
from operator import add import math moves = raw_input("Enter the moves: ") start_position = [0,0] current_position = [0,0] ''' heading = [1,90] - 1 step North [1, -90] - 1 step South [1,0] - East [1,360] - West ''' heading = [1,0] for move in moves: if move.upper() == "G": angle = heading[1] ste...
Check if a given sequence of moves for a robot is circular or not (py)
[New] :: Check if a given sequence of moves for a robot is circular or not (py)
Python
apache-2.0
MayankAgarwal/GeeksForGeeks
--- +++ @@ -0,0 +1,36 @@ +from operator import add +import math + +moves = raw_input("Enter the moves: ") + +start_position = [0,0] +current_position = [0,0] + +''' +heading = [1,90] - 1 step North + [1, -90] - 1 step South + [1,0] - East + [1,360] - West +''' + +heading = [1,0] + +for move in moves: + if mo...
72af391ec00facfbabc8ac89ff3bea1b54799d97
htdocs/plotting/auto/scripts/p50.py
htdocs/plotting/auto/scripts/p50.py
import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt import psycopg2.extras import pyiem.nws.vtec as vtec from pyiem.network import Table as NetworkTable import numpy as np import pytz PDICT = { "hadgem=a1b": "HADGEM A1B", "cnrm=a1b" : "CNRM A1B", "echam5=a1b" : "ECHAM5 A1B", "ec...
Add plot of days per year with precip
Add plot of days per year with precip
Python
mit
akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem
--- +++ @@ -0,0 +1,68 @@ +import matplotlib +matplotlib.use('agg') +import matplotlib.pyplot as plt +import psycopg2.extras +import pyiem.nws.vtec as vtec +from pyiem.network import Table as NetworkTable +import numpy as np +import pytz + +PDICT = { + "hadgem=a1b": "HADGEM A1B", + "cnrm=a1b" : "CNRM A1B", + ...
6e601d9720139bbb04c1fd30dc6552730270ba0a
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages from billy import __version__ long_description = open('README.rst').read() setup(name='billy', version=__version__, packages=find_packages(), package_data={'billy': ['schemas/*.json', 'schemas/api/*.json'...
#!/usr/bin/env python from setuptools import setup, find_packages from billy import __version__ long_description = open('README.rst').read() setup(name='billy', version=__version__, packages=find_packages(), package_data={'billy': ['schemas/*.json', 'schemas/api/*.json'...
Fix the versioned Django, we're grabbing 1.4.1 off the requirements.txt
Fix the versioned Django, we're grabbing 1.4.1 off the requirements.txt
Python
bsd-3-clause
sunlightlabs/billy,loandy/billy,mileswwatkins/billy,sunlightlabs/billy,openstates/billy,loandy/billy,loandy/billy,openstates/billy,mileswwatkins/billy,mileswwatkins/billy,sunlightlabs/billy,openstates/billy
--- +++ @@ -26,7 +26,7 @@ billy-util = billy.bin.util:main """, install_requires=[ - "Django==1.4", + "Django>=1.4", "argparse==1.1", "boto", "django-piston",
cec3eebace1ad5f236761bdd98bef0d5ac52d3ba
cura/Settings/MaterialSettingsVisibilityHandler.py
cura/Settings/MaterialSettingsVisibilityHandler.py
# Copyright (c) 2016 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Settings.Models.SettingVisibilityHandler import SettingVisibilityHandler class MaterialSettingsVisibilityHandler(SettingVisibilityHandler): def __init__(self, parent = None, *args, **kwargs): super()...
# Copyright (c) 2017 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Settings.Models.SettingVisibilityHandler import SettingVisibilityHandler class MaterialSettingsVisibilityHandler(SettingVisibilityHandler): def __init__(self, parent = None, *args, **kwargs): super()...
Replace list-to-set cast with normal set literal
Replace list-to-set cast with normal set literal Don't know who did this but he did wrong, yo.
Python
agpl-3.0
hmflash/Cura,fieldOfView/Cura,Curahelper/Cura,ynotstartups/Wanhao,ynotstartups/Wanhao,Curahelper/Cura,fieldOfView/Cura,hmflash/Cura
--- +++ @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Ultimaker B.V. +# Copyright (c) 2017 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Settings.Models.SettingVisibilityHandler import SettingVisibilityHandler @@ -7,13 +7,13 @@ def __init__(self, parent = None, *args, **kwargs...
4c46b7b86171b89f0c85f6d48eaf6d24e702c6f9
samples/service_account/tasks.py
samples/service_account/tasks.py
#!/usr/bin/python2.4 # -*- coding: utf-8 -*- # # Copyright (C) 2012 Google 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 ...
Add a Tasks sample that demonstrates Service accounts.
Add a Tasks sample that demonstrates Service accounts. Reviewed in http://codereview.appspot.com/5685068/. Index: samples/service_account/books.py =================================================================== new file mode 100644
Python
apache-2.0
jonparrott/oauth2client,clancychilds/oauth2client,googleapis/oauth2client,jonparrott/oauth2client,clancychilds/oauth2client,googleapis/google-api-python-client,googleapis/google-api-python-client,googleapis/oauth2client,google/oauth2client,google/oauth2client
--- +++ @@ -0,0 +1,65 @@ +#!/usr/bin/python2.4 +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 Google 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...
a3f23b804265bd59473873c2aa071188a73a9a9e
slumba/tests/test_numbaext.py
slumba/tests/test_numbaext.py
import pytest from numba import boolean, njit, int64, TypingError from slumba.numbaext import not_null, sizeof, unsafe_cast def test_sizeof_invalid(): dec = njit(int64(int64)) with pytest.raises(TypingError): @dec def bad_sizeof(x): return sizeof(x) def test_not_null_invalid():...
Test fail cases for custom codegen
Test fail cases for custom codegen
Python
apache-2.0
cpcloud/slumba,cpcloud/slumba
--- +++ @@ -0,0 +1,31 @@ +import pytest + +from numba import boolean, njit, int64, TypingError +from slumba.numbaext import not_null, sizeof, unsafe_cast + + +def test_sizeof_invalid(): + dec = njit(int64(int64)) + + with pytest.raises(TypingError): + @dec + def bad_sizeof(x): + return ...
a1ae01bada1d500bd7f9f7f0f2deb458bfa6d2d1
bin/serial_test.py
bin/serial_test.py
#!/usr/bin/env python from serial import Serial from time import sleep ser = Serial('/dev/ttyUSB0', 9600) sleep(3) # wait for the board to reset print "start" print "write" ser.write("hello\n") print "read" line = ser.readline() print "GOT %s"%line print "write world..." ser.write("world\n") print "read" line = ser...
Add the serial python test
Add the serial python test
Python
apache-2.0
Pitchless/arceye,Pitchless/arceye
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +from serial import Serial +from time import sleep + +ser = Serial('/dev/ttyUSB0', 9600) +sleep(3) # wait for the board to reset + +print "start" +print "write" +ser.write("hello\n") +print "read" +line = ser.readline() +print "GOT %s"%line + +print "write world..." +...
1f043dd959fa1e1d243a3278abeb66838a2f9305
server/auvsi_suas/migrations/0013_remove_ir_as_target_type.py
server/auvsi_suas/migrations/0013_remove_ir_as_target_type.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [('auvsi_suas', '0012_missionclockevent'), ] operations = [ migrations.AlterField( model_name='target', name='target...
Remove the IR target type in migration.
Remove the IR target type in migration.
Python
apache-2.0
justineaster/interop,auvsi-suas/interop,justineaster/interop,justineaster/interop,auvsi-suas/interop,justineaster/interop,auvsi-suas/interop,auvsi-suas/interop,justineaster/interop
--- +++ @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [('auvsi_suas', '0012_missionclockevent'), ] + + operations = [ + migrations.AlterField( + model...
f301dd2366f53a6cf4b0949942b8520502f54351
boxsdk/__init__.py
boxsdk/__init__.py
# coding: utf-8 from __future__ import unicode_literals from .auth.jwt_auth import JWTAuth from .auth.oauth2 import OAuth2 from .client import Client from .object import * # pylint:disable=wildcard-import,redefined-builtin
# coding: utf-8 from __future__ import unicode_literals try: from .auth.jwt_auth import JWTAuth except ImportError: JWTAuth = None # If extras are not installed, JWTAuth won't be available. from .auth.oauth2 import OAuth2 from .client import Client from .object import * # pylint:disable=wildcard-import,rede...
Fix import error when [jwt] not installed.
Fix import error when [jwt] not installed.
Python
apache-2.0
Tusky/box-python-sdk,sanketdjain/box-python-sdk,sanketdjain/box-python-sdk,Frencil/box-python-sdk,samkuehn/box-python-sdk,lkabongoVC/box-python-sdk,Frencil/box-python-sdk,box/box-python-sdk,lkabongoVC/box-python-sdk,samkuehn/box-python-sdk
--- +++ @@ -2,7 +2,10 @@ from __future__ import unicode_literals -from .auth.jwt_auth import JWTAuth +try: + from .auth.jwt_auth import JWTAuth +except ImportError: + JWTAuth = None # If extras are not installed, JWTAuth won't be available. from .auth.oauth2 import OAuth2 from .client import Client fro...
334961054d875641d150eec4d6938f6f824ea655
_gcloud_vendor/__init__.py
_gcloud_vendor/__init__.py
"""Dependencies "vendored in", due to dependencies, Python versions, etc. Current set ----------- ``apitools`` (pending release to PyPI, plus acceptable Python version support for its dependencies). Review before M2. """
Add initializer for top-level '_gcloud_vendor' package.
Add initializer for top-level '_gcloud_vendor' package.
Python
apache-2.0
optimizely/gcloud-python,jgeewax/gcloud-python,lucemia/gcloud-python,tseaver/google-cloud-python,dhermes/google-cloud-python,elibixby/gcloud-python,tseaver/gcloud-python,daspecster/google-cloud-python,GrimDerp/gcloud-python,blowmage/gcloud-python,jonparrott/google-cloud-python,tseaver/google-cloud-python,GoogleCloudPla...
--- +++ @@ -0,0 +1,8 @@ +"""Dependencies "vendored in", due to dependencies, Python versions, etc. + +Current set +----------- + +``apitools`` (pending release to PyPI, plus acceptable Python version + support for its dependencies). Review before M2. +"""
0f9f4f1ee325d72d09625850ba6a153ae5616ab0
nose2/tests/functional/test_collect_plugin.py
nose2/tests/functional/test_collect_plugin.py
import re from nose2.tests._common import FunctionalTestCase class CollectOnlyFunctionalTest(FunctionalTestCase): def test_collect_tests_in_package(self): self.assertTestRunOutputMatches( self.runIn('scenario/tests_in_package', '-v', '--collect-only'), stderr=EXPECT_LAYOUT1) # e...
import re from nose2.tests._common import FunctionalTestCase class CollectOnlyFunctionalTest(FunctionalTestCase): def test_collect_tests_in_package(self): self.assertTestRunOutputMatches( self.runIn('scenario/tests_in_package', '-v', '--collect-only', '--plugin=nose2.plu...
Update test to load plugin
Update test to load plugin collectonly no longer loaded by default
Python
bsd-2-clause
ptthiem/nose2,little-dude/nose2,little-dude/nose2,leth/nose2,ojengwa/nose2,ezigman/nose2,ojengwa/nose2,ezigman/nose2,leth/nose2,ptthiem/nose2
--- +++ @@ -5,7 +5,8 @@ class CollectOnlyFunctionalTest(FunctionalTestCase): def test_collect_tests_in_package(self): self.assertTestRunOutputMatches( - self.runIn('scenario/tests_in_package', '-v', '--collect-only'), + self.runIn('scenario/tests_in_package', '-v', '--collect-only...
dc3ee951363116b235ec96bef34b06a661fc4795
examples/fail_if_old_driver_test.py
examples/fail_if_old_driver_test.py
from seleniumbase import BaseCase class ChromedriverTests(BaseCase): def test_fail_if_using_an_old_chromedriver(self): if self.browser != "chrome": print("\n This test is only for Chrome!") print(" (Run with: '--browser=chrome')") self.skip("This test is only for Chr...
Add a test that fails if using an old version of chromedriver
Add a test that fails if using an old version of chromedriver
Python
mit
mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase
--- +++ @@ -0,0 +1,28 @@ +from seleniumbase import BaseCase + + +class ChromedriverTests(BaseCase): + + def test_fail_if_using_an_old_chromedriver(self): + if self.browser != "chrome": + print("\n This test is only for Chrome!") + print(" (Run with: '--browser=chrome')") + ...
30f704c3e767462fefb5086bbf6b5f190cec7c1b
search/fibonacci_search/python/fibonacci_search.py
search/fibonacci_search/python/fibonacci_search.py
#Fibonacci search for sorted algorithm def fibSearch(arr,x): #fibonacci numbers initialization fib2 = 0 fib1 = 1 fib = fib2 + fib1 n = len(arr) #find the smallest fibonacci greater than or equal to array length while (fib < n): fib2 = fib1 fib1 = fib fib = fib2 + fi...
Add fibonacci search in python
Add fibonacci search 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,51 @@ +#Fibonacci search for sorted algorithm +def fibSearch(arr,x): + + #fibonacci numbers initialization + fib2 = 0 + fib1 = 1 + fib = fib2 + fib1 + + n = len(arr) + #find the smallest fibonacci greater than or equal to array length + while (fib < n): + fib2 = fib1 + ...
54eca489024d3d8f354a44d161797edb8e916600
tests/test_saw.py
tests/test_saw.py
import unittest from saw.saw import Saw class Test_Saw(unittest.TestCase): def setUp(self): text = "Starting right this second, it's way easier to merge Pull Requests! \ We usually merge them from the comfortable glow of our computers, but with the\ new mobile site we're comfortabl...
Add tests - now very simple and primitive
Add tests - now very simple and primitive
Python
mit
diNard/Saw
--- +++ @@ -0,0 +1,18 @@ +import unittest +from saw.saw import Saw + +class Test_Saw(unittest.TestCase): + + def setUp(self): + text = "Starting right this second, it's way easier to merge Pull Requests! \ + We usually merge them from the comfortable glow of our computers, but with the\ + ...
1bd21c7b35a100e0f72f03bd9e0d783dc136c41e
cla_backend/apps/cla_butler/management/commands/monitor_multiple_outcome_codes.py
cla_backend/apps/cla_butler/management/commands/monitor_multiple_outcome_codes.py
# coding=utf-8 import logging from django.core.management.base import BaseCommand from django.db.models import Count, Max, Min from django.utils.timezone import now from cla_butler.stack import is_first_instance, InstanceNotInAsgException, StackException from cla_eventlog.models import Log logger = logging.getLogger(_...
Check for multiple outcome codes occurring today
Check for multiple outcome codes occurring today
Python
mit
ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend
--- +++ @@ -0,0 +1,54 @@ +# coding=utf-8 +import logging +from django.core.management.base import BaseCommand +from django.db.models import Count, Max, Min +from django.utils.timezone import now +from cla_butler.stack import is_first_instance, InstanceNotInAsgException, StackException +from cla_eventlog.models import...
ff151c8ea04268d2060cf8d281294a0d500ecbba
tests/integration/resilience_test.py
tests/integration/resilience_test.py
from __future__ import unicode_literals from __future__ import absolute_import import mock from compose.project import Project from .testcases import DockerClientTestCase class ResilienceTest(DockerClientTestCase): def test_recreate_fails(self): db = self.create_service('db', volumes=['/var/db'], comman...
Test that data volumes now survive a crash when recreating
Test that data volumes now survive a crash when recreating Signed-off-by: Aanand Prasad <94fc4f3e3d0be608b3ed7b8529ff28d2a445cce1@gmail.com>
Python
apache-2.0
marcusmartins/compose,alexandrev/compose,alunduil/fig,sanscontext/docker.github.io,dopry/compose,aanand/fig,tangkun75/compose,danix800/docker.github.io,cclauss/compose,tiry/compose,joaofnfernandes/docker.github.io,Yelp/docker-compose,BSWANG/denverdino.github.io,twitherspoon/compose,alunduil/fig,rillig/docker.github.io,...
--- +++ @@ -0,0 +1,37 @@ +from __future__ import unicode_literals +from __future__ import absolute_import + +import mock + +from compose.project import Project +from .testcases import DockerClientTestCase + + +class ResilienceTest(DockerClientTestCase): + def test_recreate_fails(self): + db = self.create_se...
8e175782c3b79e64d543fb478b146d308d2a2ad8
bin/oneoffs/cas_statistic.py
bin/oneoffs/cas_statistic.py
import os import pymongo from collections import Counter db_uri = os.getenv('SCITRAN_PERSISTENT_DB_URI', 'localhost:9001') db = pymongo.MongoClient(db_uri).get_database('scitran') COLLECTIONS = ['projects', 'acquisitions', 'analyses'] COLLECTIONS_WITH_EMBEDDED = [('sessions', 'subject')] def files_of_collection(col...
Add small python script which calculates how much disk space we save by using CAS
Add small python script which calculates how much disk space we save by using CAS
Python
mit
scitran/api,scitran/core,scitran/core,scitran/core,scitran/core,scitran/api
--- +++ @@ -0,0 +1,62 @@ +import os +import pymongo +from collections import Counter + +db_uri = os.getenv('SCITRAN_PERSISTENT_DB_URI', 'localhost:9001') +db = pymongo.MongoClient(db_uri).get_database('scitran') + +COLLECTIONS = ['projects', 'acquisitions', 'analyses'] +COLLECTIONS_WITH_EMBEDDED = [('sessions', 'subj...
61677566ce685379456e7853c69a78ea32353422
static_precompiler/tests/conftest.py
static_precompiler/tests/conftest.py
from static_precompiler.settings import ROOT, OUTPUT_DIR import shutil import os import pytest @pytest.fixture(autouse=True) def _no_output_dir(request): """ Make sure that output dir does not exists. """ path = os.path.join(ROOT, OUTPUT_DIR) if os.path.exists(path): shutil.rmtree(path) def...
Add auto fixture to make sure that output dir does not exists when tests are run
Add auto fixture to make sure that output dir does not exists when tests are run
Python
mit
liumengjun/django-static-precompiler,liumengjun/django-static-precompiler,paera/django-static-precompiler,jaheba/django-static-precompiler,paera/django-static-precompiler,jaheba/django-static-precompiler,paera/django-static-precompiler,jaheba/django-static-precompiler,paera/django-static-precompiler,jaheba/django-stati...
--- +++ @@ -0,0 +1,20 @@ +from static_precompiler.settings import ROOT, OUTPUT_DIR +import shutil +import os +import pytest + + +@pytest.fixture(autouse=True) +def _no_output_dir(request): + """ Make sure that output dir does not exists. """ + + path = os.path.join(ROOT, OUTPUT_DIR) + + if os.path.exists(pat...
422b9458d26866b9f6692ddb0ccf2305c3ac6ea7
dev/surrogates/plots.py
dev/surrogates/plots.py
import darch.search_logging as sl import darch.visualization as vi import numpy as np import seaborn as sns; sns.set() # checking these across time. log_lst = sl.read_search_folder('./logs/cifar10_medium/run-0') xkey = 'epoch_number' ykey = 'validation_accuracy' num_lines = 8 time_plotter = vi.LinePlot(xlabel='time_in...
Add an extra file to the surrogates experiments.
Add an extra file to the surrogates experiments.
Python
mit
negrinho/deep_architect,negrinho/deep_architect
--- +++ @@ -0,0 +1,18 @@ +import darch.search_logging as sl +import darch.visualization as vi +import numpy as np +import seaborn as sns; sns.set() + +# checking these across time. +log_lst = sl.read_search_folder('./logs/cifar10_medium/run-0') +xkey = 'epoch_number' +ykey = 'validation_accuracy' +num_lines = 8 +time...
660e0955979b7d11b7442a00747673700413bf1d
scipy/ndimage/tests/test_splines.py
scipy/ndimage/tests/test_splines.py
"""Tests for spline filtering.""" from __future__ import division, print_function, absolute_import import numpy as np import pytest from numpy.testing import assert_almost_equal from scipy import ndimage def get_spline_knot_values(order): """Knot values to the right of a B-spline's center.""" knot_values =...
Add a test of spline filtering vs. matrix solving.
TST: Add a test of spline filtering vs. matrix solving.
Python
bsd-3-clause
mdhaber/scipy,rgommers/scipy,andyfaff/scipy,lhilt/scipy,mdhaber/scipy,jamestwebber/scipy,grlee77/scipy,jamestwebber/scipy,aeklant/scipy,perimosocordiae/scipy,perimosocordiae/scipy,person142/scipy,zerothi/scipy,WarrenWeckesser/scipy,anntzer/scipy,perimosocordiae/scipy,Stefan-Endres/scipy,andyfaff/scipy,vigna/scipy,jor-/...
--- +++ @@ -0,0 +1,64 @@ +"""Tests for spline filtering.""" +from __future__ import division, print_function, absolute_import + +import numpy as np +import pytest + +from numpy.testing import assert_almost_equal + +from scipy import ndimage + + +def get_spline_knot_values(order): + """Knot values to the right of a...
48fc7cad7eb4cec0b928aba3daca7e934d46d87c
functest/tests/unit/features/test_sdnvpn.py
functest/tests/unit/features/test_sdnvpn.py
#!/usr/bin/env python # Copyright (c) 2017 Orange and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 # pylint: d...
Add unit tests for sdnvpn
Add unit tests for sdnvpn Change-Id: Ie4ebc4e2bc6f2e66f5f567f45f44c073cd9d313d Signed-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>
Python
apache-2.0
opnfv/functest,mywulin/functest,mywulin/functest,opnfv/functest
--- +++ @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Orange and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.or...
a91b633ba88a01b12305fdfafd570c0b3776b42d
utils/print_num_errors.py
utils/print_num_errors.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Make statistics on score files (stored in JSON files). """ import argparse import json import numpy as np def parse_json_file(json_file_path): with open(json_file_path, "r") as fd: json_data = json.load(fd) return json_data def extract_data_list(j...
Add a tool script to print errors statistics in output JSON files.
Add a tool script to print errors statistics in output JSON files.
Python
mit
jdhp-sap/sap-cta-data-pipeline,jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/data-pipeline-standalone-scripts
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Make statistics on score files (stored in JSON files). +""" + +import argparse +import json +import numpy as np + + +def parse_json_file(json_file_path): + with open(json_file_path, "r") as fd: + json_data = json.load(fd) + ...
0b47397b91fec94910f18ea1711184ecfd0f6bf0
jacquard/storage/tests/test_file.py
jacquard/storage/tests/test_file.py
from jacquard.storage.file import FileStore def test_get_nonexistent_key(): # Just test this works without errors store = FileStore(':memory:') assert store.get('test') is None def test_simple_write(): storage = FileStore(':memory:') with storage.transaction() as store: store['test'] = "...
Add tests for file storage engine
Add tests for file storage engine
Python
mit
prophile/jacquard,prophile/jacquard
--- +++ @@ -0,0 +1,66 @@ +from jacquard.storage.file import FileStore + + +def test_get_nonexistent_key(): + # Just test this works without errors + store = FileStore(':memory:') + assert store.get('test') is None + + +def test_simple_write(): + storage = FileStore(':memory:') + with storage.transactio...
dc1d43acb5730bd9b555b63aa589b0eeceb14e52
test/stop-hook/TestStopHookCmd.py
test/stop-hook/TestStopHookCmd.py
""" Test lldb target stop-hook command. """ import os import unittest2 import lldb import pexpect from lldbtest import * class StopHookCmdTestCase(TestBase): mydir = "stop-hook" @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsym(self): """Test a sequen...
Add a test case to exercise the 'target stop-hook add' command without relying on pexpect to spawn an lldb child command. The test is not "correct" in that the '** Stop Hooks **' message emitted by the Target implementation is invoked asynchronously and is using a separate:
Add a test case to exercise the 'target stop-hook add' command without relying on pexpect to spawn an lldb child command. The test is not "correct" in that the '** Stop Hooks **' message emitted by the Target implementation is invoked asynchronously and is using a separate: CommandReturnObject result; command re...
Python
apache-2.0
apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb
--- +++ @@ -0,0 +1,71 @@ +""" +Test lldb target stop-hook command. +""" + +import os +import unittest2 +import lldb +import pexpect +from lldbtest import * + +class StopHookCmdTestCase(TestBase): + + mydir = "stop-hook" + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + def tes...
250e0d2d0e2264b83a82548df3b30dbc784a4fe5
docker-registry-show.py
docker-registry-show.py
""" Copyright 2015 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 writing, software d...
Add some example client code
Add some example client code
Python
apache-2.0
twaugh/docker-registry-client,yodle/docker-registry-client
--- +++ @@ -0,0 +1,95 @@ +""" +Copyright 2015 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 la...
83bcb62c98c406e2aa6ce6a9a98750d0b565f750
tests/unit/test_raw_generichash.py
tests/unit/test_raw_generichash.py
# Import nacl libs import libnacl # Import python libs import unittest class TestGenericHash(unittest.TestCase): ''' Test sign functions ''' def test_keyless_generichash(self): msg1 = b'Are you suggesting coconuts migrate?' msg2 = b'Not at all, they could be carried.' chash1 =...
Add tests for generic hash
Add tests for generic hash
Python
apache-2.0
mindw/libnacl,johnttan/libnacl,cachedout/libnacl,coinkite/libnacl,saltstack/libnacl,RaetProtocol/libnacl
--- +++ @@ -0,0 +1,19 @@ +# Import nacl libs +import libnacl + +# Import python libs +import unittest + + +class TestGenericHash(unittest.TestCase): + ''' + Test sign functions + ''' + def test_keyless_generichash(self): + msg1 = b'Are you suggesting coconuts migrate?' + msg2 = b'Not at all,...
064124d09973dc58a444d22aa7c47acf94f8fa81
data/bigramfreq.py
data/bigramfreq.py
import json import lxml.html from lxml.cssselect import CSSSelector import requests import sys def main(): raw = requests.get("http://norvig.com/mayzner.html") if not raw: print >>sys.stderr, "Request failed with code %d" % (raw.status_code) return 1 tree = lxml.html.fromstring(raw.text) ...
Add a script to generate JSON bigram frequencies for English
Add a script to generate JSON bigram frequencies for English
Python
apache-2.0
Kitware/clique,Kitware/clique,XDATA-Year-3/clique,XDATA-Year-3/clique,Kitware/clique,XDATA-Year-3/clique
--- +++ @@ -0,0 +1,24 @@ +import json +import lxml.html +from lxml.cssselect import CSSSelector +import requests +import sys + + +def main(): + raw = requests.get("http://norvig.com/mayzner.html") + if not raw: + print >>sys.stderr, "Request failed with code %d" % (raw.status_code) + return 1 + + ...
75131bdf806c56970f3160de3e6d476d9ecbc3a7
python/deleteNodeInALinkedList.py
python/deleteNodeInALinkedList.py
# https://leetcode.com/problems/delete-node-in-a-linked-list/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def deleteNode(self, node): """ :type node: ListNode :rtype: v...
Add problem delete note in a linked list
Add problem delete note in a linked list
Python
mit
guozengxin/myleetcode,guozengxin/myleetcode
--- +++ @@ -0,0 +1,21 @@ +# https://leetcode.com/problems/delete-node-in-a-linked-list/ + +# Definition for singly-linked list. +# class ListNode(object): +# def __init__(self, x): +# self.val = x +# self.next = None + +class Solution(object): + def deleteNode(self, node): + """ + ...
1ede9bd211cd8ea6aac4db6f8818804cb778a022
dinosaurs/views.py
dinosaurs/views.py
import os import tornado.web import tornado.ioloop class SingleStatic(tornado.web.StaticFileHandler): def initialize(self, path): self.dirname, self.filename = os.path.split(path) super(SingleStatic, self).initialize(self.dirname) def get(self, path=None, include_body=True): super(Si...
Add a view that serves a single static file
Add a view that serves a single static file
Python
mit
chrisseto/dinosaurs.sexy,chrisseto/dinosaurs.sexy
--- +++ @@ -0,0 +1,13 @@ +import os + +import tornado.web +import tornado.ioloop + + +class SingleStatic(tornado.web.StaticFileHandler): + def initialize(self, path): + self.dirname, self.filename = os.path.split(path) + super(SingleStatic, self).initialize(self.dirname) + + def get(self, path=Non...
06e7dd815a77739089b2ad0aed5cb9f01a194967
Normalize_Image.py
Normalize_Image.py
# @Dataset data # @OpService ops # @OUTPUT Img normalized # Create normalized image to the [0, 1] range. # # Stefan Helfrich (University of Konstanz), 03/10/2016 from net.imglib2.type.numeric.real import FloatType from net.imglib2.type.numeric.integer import ByteType from net.imagej.ops import Ops normalized = ops.c...
Add script to normalize image using Ops
Add script to normalize image using Ops
Python
bsd-2-clause
bic-kn/imagej-scripts
--- +++ @@ -0,0 +1,17 @@ +# @Dataset data +# @OpService ops +# @OUTPUT Img normalized + +# Create normalized image to the [0, 1] range. +# +# Stefan Helfrich (University of Konstanz), 03/10/2016 + +from net.imglib2.type.numeric.real import FloatType +from net.imglib2.type.numeric.integer import ByteType +from net.ima...
6d4efa0bd1199bbe900a8913b829ca7201dde6ab
openedx/core/djangoapps/appsembler/sites/migrations/0003_add_juniper_new_sass_vars.py
openedx/core/djangoapps/appsembler/sites/migrations/0003_add_juniper_new_sass_vars.py
# -*- coding: utf-8 -*- import json from django.db import migrations, models def add_juniper_new_sass_vars(apps, schema_editor): """ This migration adds all the new SASS variabled added during the initial pass of the Tahoe Juniper release upgrade. """ new_sass_var_keys = { "$base-contain...
Add migration to add new Juniper SASS vars to sites
Add migration to add new Juniper SASS vars to sites fix bug
Python
agpl-3.0
appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform
--- +++ @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- + + +import json +from django.db import migrations, models + + +def add_juniper_new_sass_vars(apps, schema_editor): + """ + This migration adds all the new SASS variabled added during the initial + pass of the Tahoe Juniper release upgrade. + """ + new_...
190df1378844c6294c6f48ad6cb0272f2146fc48
examples/force_https.py
examples/force_https.py
"""An example of using a middleware to require HTTPS connections. requires https://github.com/falconry/falcon-require-https to be installed via pip install falcon-require-https """ import hug from falcon_require_https import RequireHTTPS hug.API(__name__).http.add_middleware(RequireHTTPS()) @hug.get() def my...
Add example of force https
Add example of force https
Python
mit
timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug
--- +++ @@ -0,0 +1,13 @@ +"""An example of using a middleware to require HTTPS connections. + requires https://github.com/falconry/falcon-require-https to be installed via + pip install falcon-require-https +""" +import hug +from falcon_require_https import RequireHTTPS + +hug.API(__name__).http.add_middleware(...
876365a7f19a3786db15dc7debbd2686fa5d02ef
wmata.py
wmata.py
import datetime import urllib import json class WmataError(Exception): pass class Wmata(object): base_url = 'http://api.wmata.com/%(svc)s.svc/json/%(endpoint)s' # By default, we'll use the WMATA demonstration key api_key = 'kfgpmgvfgacx98de9q3xazww' def __init__(self, api_key=None): if ...
Add WmataError class and start of Wmata class.
Add WmataError class and start of Wmata class. Starts module code. Error class is added, and the main class, Wmata, is added, with the default class variables and the init function added.
Python
mit
ExperimentMonty/py3-wmata
--- +++ @@ -0,0 +1,16 @@ +import datetime +import urllib +import json + +class WmataError(Exception): + pass + +class Wmata(object): + + base_url = 'http://api.wmata.com/%(svc)s.svc/json/%(endpoint)s' + # By default, we'll use the WMATA demonstration key + api_key = 'kfgpmgvfgacx98de9q3xazww' + + def ...
a4ab01d64c505b786e6fef217829fb56c3d6b6ce
mzalendo/scorecards/management/commands/scorecard_update_person_hansard_appearances.py
mzalendo/scorecards/management/commands/scorecard_update_person_hansard_appearances.py
import datetime from django.core.management.base import NoArgsCommand from django.core.exceptions import ImproperlyConfigured class Command(NoArgsCommand): help = 'Create/update hansard scorecard entry for all mps' args = '' def handle_noargs(self, **options): # Imports are here to avoid an impor...
Add management script to generate hansard appearance scores.
Add management script to generate hansard appearance scores.
Python
agpl-3.0
geoffkilpin/pombola,patricmutwiri/pombola,patricmutwiri/pombola,ken-muturi/pombola,Hutspace/odekro,mysociety/pombola,geoffkilpin/pombola,hzj123/56th,mysociety/pombola,hzj123/56th,patricmutwiri/pombola,hzj123/56th,hzj123/56th,Hutspace/odekro,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,Hutspace/odekro,hzj12...
--- +++ @@ -0,0 +1,52 @@ +import datetime + +from django.core.management.base import NoArgsCommand +from django.core.exceptions import ImproperlyConfigured + +class Command(NoArgsCommand): + help = 'Create/update hansard scorecard entry for all mps' + args = '' + + def handle_noargs(self, **options): + ...
4a404709081515fa0cc91683b5a9ad8f6a68eae6
migrations/versions/630_remove_mandatory_assessment_methods_.py
migrations/versions/630_remove_mandatory_assessment_methods_.py
"""Remove mandatory assessment methods from briefs Revision ID: 630 Revises: 620 Create Date: 2016-06-03 15:26:53.890401 """ # revision identifiers, used by Alembic. revision = '630' down_revision = '620' from alembic import op import sqlalchemy as sa from sqlalchemy.sql import table, column from sqlalchemy.dialect...
Add a migration to drop mandatory assessment methods from brief data
Add a migration to drop mandatory assessment methods from brief data Removes work history and written proposal from all briefs, since they're no longer a valid option for evaluationType and are added automatically to all briefs. Downgrade will add the options to all briefs based on lot. Since we don't know if the bri...
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
--- +++ @@ -0,0 +1,61 @@ +"""Remove mandatory assessment methods from briefs + +Revision ID: 630 +Revises: 620 +Create Date: 2016-06-03 15:26:53.890401 + +""" + +# revision identifiers, used by Alembic. +revision = '630' +down_revision = '620' + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.sql im...
6fdf7cc68e05ce6e8e18306eca7d8e36d1a166ea
hotline/db/db_client.py
hotline/db/db_client.py
import importlib import os class DBClient: db_defaults = {'mongo': 'mongodb://localhost:27017/', 'redis': 'redis://localhost:6379', 'postgresql': 'postgresql://localhost:5432' } def __init__(self, url=None, db_type=None, db_name=None): self.db_ty...
Add Client class to abstract from different datbase clients
Add Client class to abstract from different datbase clients
Python
mit
wearhacks/hackathon_hotline
--- +++ @@ -0,0 +1,22 @@ +import importlib +import os + +class DBClient: + + db_defaults = {'mongo': 'mongodb://localhost:27017/', + 'redis': 'redis://localhost:6379', + 'postgresql': 'postgresql://localhost:5432' + } + + def __init__(self, url=None, db_type=...
ecbc691307c43ad06d7f539f008fccbff690d538
unit_tests/test_precomputed_io.py
unit_tests/test_precomputed_io.py
# Copyright (c) 2018 CEA # Author: Yann Leprince <yann.leprince@cea.fr> # # This software is made available under the MIT licence, see LICENCE.txt. import numpy as np import pytest from neuroglancer_scripts.accessor import get_accessor_for_url from neuroglancer_scripts.chunk_encoding import InvalidInfoError from neur...
Add unit tests for the precomputed_io module
Add unit tests for the precomputed_io module
Python
mit
HumanBrainProject/neuroglancer-scripts
--- +++ @@ -0,0 +1,63 @@ +# Copyright (c) 2018 CEA +# Author: Yann Leprince <yann.leprince@cea.fr> +# +# This software is made available under the MIT licence, see LICENCE.txt. + +import numpy as np +import pytest + +from neuroglancer_scripts.accessor import get_accessor_for_url +from neuroglancer_scripts.chunk_encod...
885ed1e8e3256352d2fde771bef57997809c3c1e
migrations/versions/0209_remove_monthly_billing_.py
migrations/versions/0209_remove_monthly_billing_.py
""" Revision ID: 0209_remove_monthly_billing Revises: 84c3b6eb16b3 Create Date: 2018-07-27 14:46:30.109811 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql revision = '0209_remove_monthly_billing' down_revision = '84c3b6eb16b3' def upgrade(): # ### commands auto gen...
Remove monthly_billing table from the database
Remove monthly_billing table from the database
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,38 @@ +""" + +Revision ID: 0209_remove_monthly_billing +Revises: 84c3b6eb16b3 +Create Date: 2018-07-27 14:46:30.109811 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +revision = '0209_remove_monthly_billing' +down_revision = '84c3b6eb16b3' + + ...
84ae279c0044e63e00c7d21823c3159e34c73d03
scripts/uvfits_memtest.py
scripts/uvfits_memtest.py
#!/usr/bin/env python2.7 # -*- mode: python; coding: utf-8 -*- from __future__ import print_function, division, absolute_import from memory_profiler import profile import numpy as np from astropy import constants as const from astropy.io import fits from pyuvdata import UVData @profile def read_uvfits(): filena...
Add a memory test script
Add a memory test script
Python
bsd-2-clause
HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata
--- +++ @@ -0,0 +1,56 @@ +#!/usr/bin/env python2.7 +# -*- mode: python; coding: utf-8 -*- + +from __future__ import print_function, division, absolute_import + +from memory_profiler import profile +import numpy as np +from astropy import constants as const +from astropy.io import fits +from pyuvdata import UVData + +...
4c60f8f643fe05b69ca475242d8c46b02697d5d4
examples/howto/type_chain.py
examples/howto/type_chain.py
from thinc.api import chain, ReLu, MaxPool, Softmax, chain # This example should be run with mypy. This is an example of type-level checking # for network validity. # # We first define an invalid network. # It's invalid because MaxPool expects Floats3d as input, while ReLu produces # Floats2d as output. chain has typ...
Add example for type-checking chain
Add example for type-checking chain
Python
mit
spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc
--- +++ @@ -0,0 +1,19 @@ +from thinc.api import chain, ReLu, MaxPool, Softmax, chain + +# This example should be run with mypy. This is an example of type-level checking +# for network validity. +# +# We first define an invalid network. +# It's invalid because MaxPool expects Floats3d as input, while ReLu produces +...
c4ee87fa4398eca3193331888086cb437436722e
test/hil_client_test.py
test/hil_client_test.py
""" General info about these tests The tests assusme that the nodes are in the <from_project> which is set to be the "slurm" project, since that is what we are testing here. If all tests pass successfully, then nodes are back in their original state. Class TestHILReserve moves nodes out of the slurm project and into...
Add some tests for hil_client
Add some tests for hil_client
Python
mit
mghpcc-projects/user_level_slurm_reservations,mghpcc-projects/user_level_slurm_reservations
--- +++ @@ -0,0 +1,72 @@ +""" +General info about these tests + +The tests assusme that the nodes are in the <from_project> which is set to be the +"slurm" project, since that is what we are testing here. + +If all tests pass successfully, then nodes are back in their original state. + +Class TestHILReserve moves nod...
15eb41ba9ac22eb2ecc60b82807ca7f333f578b9
iatidq/dqusers.py
iatidq/dqusers.py
# IATI Data Quality, tools for Data QA on IATI-formatted publications # by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith # # Copyright (C) 2013 Publish What You Fund # # This programme is free software; you may redistribute and/or modify # it under the terms of the GNU Affero General Public License v3...
Add basic methods for accessing user data
Add basic methods for accessing user data
Python
agpl-3.0
pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality
--- +++ @@ -0,0 +1,42 @@ + +# IATI Data Quality, tools for Data QA on IATI-formatted publications +# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith +# +# Copyright (C) 2013 Publish What You Fund +# +# This programme is free software; you may redistribute and/or modify +# it under the terms of the G...
287cd795c92a86ee16a623230d0c59732a2f767d
examples/vtk-unstructured-points.py
examples/vtk-unstructured-points.py
import numpy as np from pyvisfile.vtk import ( UnstructuredGrid, DataArray, AppendedDataXMLGenerator, VTK_VERTEX, VF_LIST_OF_VECTORS, VF_LIST_OF_COMPONENTS) n = 5000 points = np.random.randn(n, 3) data = [ ("p", np.random.randn(n)), ("vel", np.random.randn(3, n)), ] file_name = "points.vt...
Add demo on how to write unstructured point meshes in Vtk.
Add demo on how to write unstructured point meshes in Vtk.
Python
mit
inducer/pyvisfile,inducer/pyvisfile,inducer/pyvisfile
--- +++ @@ -0,0 +1,33 @@ +import numpy as np +from pyvisfile.vtk import ( + UnstructuredGrid, DataArray, + AppendedDataXMLGenerator, + VTK_VERTEX, VF_LIST_OF_VECTORS, VF_LIST_OF_COMPONENTS) + +n = 5000 +points = np.random.randn(n, 3) + +data = [ + ("p", np.random.randn(n)), + ("vel", np.random...
11111351f67afd3dc8ee2ec904a9cea595d68fb3
DilipadTopicModelling/experiment_calculate_perplexity.py
DilipadTopicModelling/experiment_calculate_perplexity.py
import pandas as pd import logging from CPTCorpus import CPTCorpus from CPT_Gibbs import GibbsSampler logger = logging.getLogger(__name__) logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO) # load corpus data_dir = '/home/jvdzwaan/data/tmp/generated/test_exp/' corpus = CPTCorpus.load('{}c...
Add script to calculate perplexity results
Add script to calculate perplexity results Added a script that calculates perplexity at intervals for different configurations of nTopics and save the results to csv
Python
apache-2.0
NLeSC/cptm,NLeSC/cptm
--- +++ @@ -0,0 +1,46 @@ +import pandas as pd +import logging + +from CPTCorpus import CPTCorpus +from CPT_Gibbs import GibbsSampler + + +logger = logging.getLogger(__name__) +logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO) + +# load corpus +data_dir = '/home/jvdzwaan/data/tmp/generated/...
71a55a1252ef87629f10e48c1041416c34742ea7
modules/juliet_input.py
modules/juliet_input.py
from threading import Thread class Juliet_Input (Thread): def __init(self): Thread.__init(self) def run(self): while True: char = raw_input() if char == 'q': break
Add input handling for ssh connections
Add input handling for ssh connections
Python
bsd-2-clause
halfbro/juliet
--- +++ @@ -0,0 +1,12 @@ +from threading import Thread + +class Juliet_Input (Thread): + def __init(self): + Thread.__init(self) + + def run(self): + while True: + char = raw_input() + if char == 'q': + break +
0115d088061595fe6c6f8589d0599d1b8e970813
scripts/lwtnn-build-dummy-inputs.py
scripts/lwtnn-build-dummy-inputs.py
#!/usr/bin/env python3 """Generate fake NN files to test the lightweight classes""" import argparse import json import h5py import numpy as np def _run(): args = _get_args() _build_keras_arch("arch.json") _build_keras_inputs_file("inputs.json") _build_keras_weights("weights.h5", verbose=args.verbose)...
Add dummy Keras inputs builder
Add dummy Keras inputs builder
Python
mit
lwtnn/lwtnn,jwsmithers/lwtnn,jwsmithers/lwtnn,jwsmithers/lwtnn,lwtnn/lwtnn,lwtnn/lwtnn
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 + +"""Generate fake NN files to test the lightweight classes""" + +import argparse +import json +import h5py +import numpy as np + +def _run(): + args = _get_args() + _build_keras_arch("arch.json") + _build_keras_inputs_file("inputs.json") + _build_keras_we...
cb98b4a1580e4976de375722012483bf51ef9254
scripts/get_mendeley_papers.py
scripts/get_mendeley_papers.py
### # Copyright 2015-2020, Institute for Systems Biology # # 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 la...
Add interactive script to get papers from Mendeley API
Add interactive script to get papers from Mendeley API
Python
apache-2.0
isb-cgc/ISB-CGC-Webapp,isb-cgc/ISB-CGC-Webapp,isb-cgc/ISB-CGC-Webapp,isb-cgc/ISB-CGC-Webapp
--- +++ @@ -0,0 +1,77 @@ +### +# Copyright 2015-2020, Institute for Systems Biology +# +# 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 +...
731bc1308e94cdb341511618ba5739f6fd37b0b7
regressions/__init__.py
regressions/__init__.py
# regressions """A package which implements various forms of regression.""" import numpy as np try: import scipy.linalg as linalg linalg_source = 'scipy' except ImportError: import numpy.linalg as linalg linalg_source = 'numpy' class ParameterError(Exception): """Parameters passed to a regression...
Add a base regressions package
Add a base regressions package This contains only various imports / definitions that will be useful in the child modules and should be able to be used via 'from .. import *' without issues.
Python
isc
jhumphry/regressions
--- +++ @@ -0,0 +1,23 @@ +# regressions + +"""A package which implements various forms of regression.""" + +import numpy as np +try: + import scipy.linalg as linalg + linalg_source = 'scipy' +except ImportError: + import numpy.linalg as linalg + linalg_source = 'numpy' + +class ParameterError(Exception): ...
c6c87e1aafa6b8a4f7929c491398574921417bd4
tests/webcam_framerate.py
tests/webcam_framerate.py
#!/usr/bin/env python import qrtools, gi, os gi.require_version('Gtk', '3.0') gi.require_version('Gst', '1.0') from gi.repository import Gtk, Gst from avocado import Test from utils import webcam class WebcamReadQR(Test): """ Uses the camera selected by v4l2src by default (/dev/video0) to get the framerat...
Add initial framerate webcam test structure
Add initial framerate webcam test structure
Python
mit
daveol/Fedora-Test-Laptop,daveol/Fedora-Test-Laptop
--- +++ @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +import qrtools, gi, os +gi.require_version('Gtk', '3.0') +gi.require_version('Gst', '1.0') +from gi.repository import Gtk, Gst +from avocado import Test +from utils import webcam + +class WebcamReadQR(Test): + """ + Uses the camera selected by v4l2src by defaul...
b522fed0a1ca2570b8652ddb64b8c847d5964d11
list_all_codes.py
list_all_codes.py
#!/usr/bin/env python import lsi_decode_loginfo as loginfo def generate_values(data): title = data[0] mask = data[1] sub = data[2] for key in sub.keys(): v = sub[key] key_name = v[0] key_sub = v[1] key_detail = v[2] if key_sub is None: yield [(title...
Add a script to generate all known codes and their decoding
Add a script to generate all known codes and their decoding
Python
mit
baruch/lsi_decode_loginfo
--- +++ @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import lsi_decode_loginfo as loginfo + +def generate_values(data): + title = data[0] + mask = data[1] + sub = data[2] + + for key in sub.keys(): + v = sub[key] + key_name = v[0] + key_sub = v[1] + key_detail = v[2] + if ...
985f23ee5e107c647d5f5e5b245c3fb7ff2d411b
bin/to_expected.py
bin/to_expected.py
#!/usr/bin/env python import argparse import numpy as np import pandas as pd if __name__ == '__main__': parser = argparse.ArgumentParser(description='Convert result from PMF' ' to expected value') parser.add_argument('file', type=str, help='Result...
Write script to convert PMF-based result to expected value
Write script to convert PMF-based result to expected value
Python
mit
kemskems/otdet
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +import argparse + +import numpy as np +import pandas as pd + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Convert result from PMF' + ' to expected value') + parser.add_argument('file', type=st...
3f6ec1a3e9bcdd2dee714e74fac7215b19ae432f
blocking_socket.py
blocking_socket.py
""" A Simple example for testing the SimpleServer Class. A simple telnet server. It is for studying purposes only. """ from server import SimpleServer __author__ = "Facundo Victor" __license__ = "MIT" __email__ = "facundovt@gmail.com" def handle_message(sockets=None): """ Handle a simple TCP connection. ...
Add an example of a blocking tcp server
Add an example of a blocking tcp server The example implements a basic telnet server.
Python
mit
facundovictor/non-blocking-socket-samples
--- +++ @@ -0,0 +1,36 @@ +""" +A Simple example for testing the SimpleServer Class. A simple telnet server. +It is for studying purposes only. +""" + +from server import SimpleServer + + +__author__ = "Facundo Victor" +__license__ = "MIT" +__email__ = "facundovt@gmail.com" + + +def handle_message(sockets=None): + ...
cc3b29aaa2c0ffa3cde6b901bf4bdf3ce3fb4345
pybaseball/league_pitching_stats.py
pybaseball/league_pitching_stats.py
import requests import pandas as pd from bs4 import BeautifulSoup def get_soup(start_dt, end_dt): # get most recent standings if date not specified if((start_dt is None) or (end_dt is None)): print('Error: a date range needs to be specified') return None url = "http://www.baseball-reference.com/leagues/daily.cg...
Add code for pulling pitcher stats for specified date range
Add code for pulling pitcher stats for specified date range
Python
mit
jldbc/pybaseball
--- +++ @@ -0,0 +1,36 @@ +import requests +import pandas as pd +from bs4 import BeautifulSoup + +def get_soup(start_dt, end_dt): + # get most recent standings if date not specified + if((start_dt is None) or (end_dt is None)): + print('Error: a date range needs to be specified') + return None + url = "http://www.ba...
701f6a06b8405620905a67b47c5702c100a1447a
scripts/check_sorted.py
scripts/check_sorted.py
import sys prev_val = 0 prev_val2 = 0 counter = 0 for line in sys.stdin: parts = line.split() curr_val = int(parts[0]) curr_val2 = int(parts[1]) val1 = int(parts[0]) val2 = int(parts[1]) if val1 > val2: print >>sys.stderr, "Not triangular:", counter sys.exit(1) if curr_v...
Check to make sure the input file is sorted
Check to make sure the input file is sorted
Python
mit
hms-dbmi/clodius,hms-dbmi/clodius
--- +++ @@ -0,0 +1,32 @@ +import sys + +prev_val = 0 +prev_val2 = 0 +counter = 0 + +for line in sys.stdin: + parts = line.split() + curr_val = int(parts[0]) + curr_val2 = int(parts[1]) + + val1 = int(parts[0]) + val2 = int(parts[1]) + + if val1 > val2: + print >>sys.stderr, "Not triangular:",...
bdf5cfb2a7b716d897dabd62e591caad8144a029
utils/populate-funding.py
utils/populate-funding.py
#!/usr/bin/python import os import sys import csv from optparse import OptionParser from django.core.management import setup_environ my_path = os.path.abspath(os.path.dirname(__file__)) app_path = os.path.normpath(my_path + '/..') app_base = app_path + '/' # We need a path like '<app_path>/utils:<app_path>:<app_pat...
Add election funding parsing script
Add election funding parsing script
Python
agpl-3.0
kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu
--- +++ @@ -0,0 +1,72 @@ +#!/usr/bin/python + +import os +import sys +import csv +from optparse import OptionParser + +from django.core.management import setup_environ + +my_path = os.path.abspath(os.path.dirname(__file__)) +app_path = os.path.normpath(my_path + '/..') +app_base = app_path + '/' + +# We need a path l...
03de607d14805779ed9653b65a5bd5cee3525903
server/ifttt_on_campaign_success.py
server/ifttt_on_campaign_success.py
import collections import king_phisher.plugins as plugin_opts import king_phisher.server.plugins as plugins import king_phisher.server.signals as signals import requests class Plugin(plugins.ServerPlugin): authors = ['Spencer McIntyre'] title = 'IFTTT Campaign Success Notification' description = """ A plugin tha...
Add the IFTTT campaign success server plugin
Add the IFTTT campaign success server plugin
Python
bsd-3-clause
securestate/king-phisher-plugins,zeroSteiner/king-phisher-plugins,securestate/king-phisher-plugins,wolfthefallen/king-phisher-plugins,zeroSteiner/king-phisher-plugins,wolfthefallen/king-phisher-plugins
--- +++ @@ -0,0 +1,76 @@ +import collections + +import king_phisher.plugins as plugin_opts +import king_phisher.server.plugins as plugins +import king_phisher.server.signals as signals + +import requests + +class Plugin(plugins.ServerPlugin): + authors = ['Spencer McIntyre'] + title = 'IFTTT Campaign Success Notifica...
b647416b719c9f0b2534c13a67d3396fefaada47
p001_multiples_of_3_and_5.py
p001_multiples_of_3_and_5.py
# ''' Project Euler - Problem 1 - Multiples of 3 and 5 https://projecteuler.net/problem=1 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. ''' import sys def main(): '''Sum t...
Add problem 1 sum muliples of 3 or 5 python solution
Add problem 1 sum muliples of 3 or 5 python solution
Python
mit
ChrisFreeman/project-euler
--- +++ @@ -0,0 +1,39 @@ +# +''' +Project Euler - Problem 1 - Multiples of 3 and 5 +https://projecteuler.net/problem=1 + +If we list all the natural numbers below 10 that are multiples of 3 or 5, we +get 3, 5, 6 and 9. The sum of these multiples is 23. + +Find the sum of all the multiples of 3 or 5 below 1000. +''' +...
0c2f07fabb94698b8cf1b42a4f671ad0cd5e365f
src/ggrc/migrations/versions/20160321011353_3914dbf78dc1_add_comment_notification_type.py
src/ggrc/migrations/versions/20160321011353_3914dbf78dc1_add_comment_notification_type.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: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """ Add comment notification type Create Date: 2016-03-21 01:13:53.293580 """ #...
Add migration for comment notification type
Add migration for comment notification type
Python
apache-2.0
edofic/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,prasannav7/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,kr41/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core...
--- +++ @@ -0,0 +1,61 @@ +# 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: miha@reciprocitylabs.com +# Maintained By: miha@reciprocitylabs.com + +""" +Add comment notification type + +Create Da...
6f7ed6f3b082c7f6399ab456a6f6b291219c910f
product_uom_prices/migrations/8.0.0.5.0/pre-migration.py
product_uom_prices/migrations/8.0.0.5.0/pre-migration.py
# -*- encoding: utf-8 -*- from openerp import SUPERUSER_ID from openerp.modules.registry import RegistryManager def set_value(cr, model, table, field, value, condition): print 'Set value %s on field %s on table %s' % ( value, field, table) cr.execute('SELECT id ' 'FROM %(table)s ' ...
ADD migration scripts for uom prices
ADD migration scripts for uom prices
Python
agpl-3.0
ingadhoc/product,ingadhoc/product
--- +++ @@ -0,0 +1,36 @@ +# -*- encoding: utf-8 -*- +from openerp import SUPERUSER_ID +from openerp.modules.registry import RegistryManager + + +def set_value(cr, model, table, field, value, condition): + print 'Set value %s on field %s on table %s' % ( + value, field, table) + cr.execute('SELECT id ' + ...
121a80669b4b50665a7baafd3434cb3e574087f4
bluebottle/bb_projects/migrations/0004_adjust_phases.py
bluebottle/bb_projects/migrations/0004_adjust_phases.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models from bluebottle.utils.model_dispatcher import get_model_mapping MODEL_MAP = get_model_mapping() class Migration(DataMigration): def forwards(self, orm): "Write your forwards me...
Adjust phases to make campaign non-editable
Adjust phases to make campaign non-editable
Python
bsd-3-clause
jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import DataMigration +from django.db import models + +from bluebottle.utils.model_dispatcher import get_model_mapping + +MODEL_MAP = get_model_mapping() + +class Migration(DataMigration): + + def forwards(sel...
1b36f7e837f6c15cab838edfaf6464bef0c88c6d
src/ggrc/migrations/versions/20160304124523_50c374901d42_add_request_notification_types.py
src/ggrc/migrations/versions/20160304124523_50c374901d42_add_request_notification_types.py
"""Add request notification types Revision ID: 50c374901d42 Revises: 4e989ef86619 Create Date: 2016-03-04 12:45:23.024224 """ import sqlalchemy as sa from alembic import op from sqlalchemy.sql import column from sqlalchemy.sql import table # revision identifiers, used by Alembic. revision = '50c374901d42' down_rev...
Add migration for request notification types
Add migration for request notification types
Python
apache-2.0
NejcZupec/ggrc-core,prasannav7/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,prasannav7/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,prasannav...
--- +++ @@ -0,0 +1,70 @@ + +"""Add request notification types + +Revision ID: 50c374901d42 +Revises: 4e989ef86619 +Create Date: 2016-03-04 12:45:23.024224 + +""" + +import sqlalchemy as sa +from alembic import op +from sqlalchemy.sql import column +from sqlalchemy.sql import table + +# revision identifiers, used by A...
72b701652271178e08d9cccd088d24177d4a2fc6
pyblogit/database_handler.py
pyblogit/database_handler.py
""" pyblogit.database_handler ~~~~~~~~~~~~~~~~~~~~~~~~~ This module handles the connection and manipulation of the local database. """ import sqlite3 def get_cursor(blog_id): """Connects to a local sqlite database""" conn = sqlite3.connect(blog_id) c = conn.cursor() return c def add_blog(blog_id, ...
Add functions for storing/getting blogs and posts
Add functions for storing/getting blogs and posts
Python
mit
jamalmoir/pyblogit
--- +++ @@ -0,0 +1,87 @@ +""" +pyblogit.database_handler +~~~~~~~~~~~~~~~~~~~~~~~~~ + +This module handles the connection and manipulation of the local database. +""" +import sqlite3 + + +def get_cursor(blog_id): + """Connects to a local sqlite database""" + conn = sqlite3.connect(blog_id) + c = conn.cursor(...
726316b50209dfc5f6a8f6373cd7e3f53e267bb3
geodj/genre_parser.py
geodj/genre_parser.py
import re from django.utils.encoding import smart_str class GenreParser: @staticmethod def parse(genre): genre = smart_str(genre).lower() if re.search(r"\b(jazz|blues)\b", genre): return "jazz" if re.search(r"\b(ska|reggae|ragga|dub)\b", genre): return "ska" ...
Implement a genre string parser
Implement a genre string parser
Python
mit
6/GeoDJ,6/GeoDJ
--- +++ @@ -0,0 +1,27 @@ +import re +from django.utils.encoding import smart_str + +class GenreParser: + @staticmethod + def parse(genre): + genre = smart_str(genre).lower() + if re.search(r"\b(jazz|blues)\b", genre): + return "jazz" + if re.search(r"\b(ska|reggae|ragga|dub)\b", ...
d5c7d429be93a2b2de4a1c09bd73f72c02664499
experimental/directshow.py
experimental/directshow.py
#!/usr/bin/python # $Id:$ # Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU. # Caveats: # - Requires a filename (not from memory or stream yet). Looks like we need # to manually implement a filter which provides an output IPin. Lot of # work. # - Theoretically can traverse the ...
Move win32 audio experiment to trunk.
Move win32 audio experiment to trunk.
Python
bsd-3-clause
adamlwgriffiths/Pyglet,adamlwgriffiths/Pyglet,seeminglee/pyglet64,niklaskorz/pyglet,niklaskorz/pyglet,niklaskorz/pyglet,adamlwgriffiths/Pyglet,seeminglee/pyglet64,adamlwgriffiths/Pyglet,seeminglee/pyglet64,niklaskorz/pyglet
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/python +# $Id:$ + +# Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU. +# Caveats: +# - Requires a filename (not from memory or stream yet). Looks like we need +# to manually implement a filter which provides an output IPin. Lot of +# work. +# - The...
0a0d31077746e69bf5acc7d90fa388e121544339
script_skeleton.py
script_skeleton.py
#!/usr/bin/python """Usage: <SCRIPT_NAME> [--log-level=<log-level>] -h --help Show this message. -v --version Show version. --log-level=<log-level> Set logging level (one of {log_level_vals}) [default: info]. """ import docopt import ordutils.log as log import ordutils.options as opt import schema im...
Add skeleton for new python scripts.
Add skeleton for new python scripts.
Python
mit
lweasel/misc_bioinf,lweasel/misc_bioinf,lweasel/misc_bioinf
--- +++ @@ -0,0 +1,45 @@ +#!/usr/bin/python + +"""Usage: + <SCRIPT_NAME> [--log-level=<log-level>] + +-h --help + Show this message. +-v --version + Show version. +--log-level=<log-level> + Set logging level (one of {log_level_vals}) [default: info]. +""" + +import docopt +import ordutils.log as log +impo...
73f75483156056b61f3b6bec4fe2f09522c2c34a
test/integration/ggrc/models/test_eager_query.py
test/integration/ggrc/models/test_eager_query.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: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """Tests for making sure eager queries are working on all mixins.""" from ggrc....
Add tests for mixin order
Add tests for mixin order Test that mixin order on models does not hide any eager queries.
Python
apache-2.0
AleksNeStu/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,josthkko/ggrc-core,sel...
--- +++ @@ -0,0 +1,37 @@ +# 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: miha@reciprocitylabs.com +# Maintained By: miha@reciprocitylabs.com + +"""Tests for making sure eager queries are work...
6ed99163b10209566a0575a9a67d1ab2ad552fd9
tests/views/test_committee_subscriptions_page.py
tests/views/test_committee_subscriptions_page.py
import datetime from tests import PMGLiveServerTestCase from tests.fixtures import dbfixture, HouseData, CommitteeData THIS_YEAR = datetime.datetime.today().year class TestCommitteeSubscriptionsPage(PMGLiveServerTestCase): def test_committee_subscriptions_page(self): """ Test committee subscripti...
Add test for committee subscriptions page
Add test for committee subscriptions page
Python
apache-2.0
Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2
--- +++ @@ -0,0 +1,19 @@ +import datetime +from tests import PMGLiveServerTestCase +from tests.fixtures import dbfixture, HouseData, CommitteeData + +THIS_YEAR = datetime.datetime.today().year + + +class TestCommitteeSubscriptionsPage(PMGLiveServerTestCase): + def test_committee_subscriptions_page(self): + ...
d94123ba898032e7837aa8a2fd0fe585ed81e2d5
scrapi/processing/storage.py
scrapi/processing/storage.py
import os import json from scrapi.processing.base import BaseProcessor class StorageProcessor(BaseProcessor): NAME = 'storage' def process_raw(self, raw): filename = 'archive/{}/{}/raw.{}'.format(raw['source'], raw['docID'], raw['filetype']) if not os.path.exists(os.path.dirname(filename)): ...
Add back a filesystem backend for testing and development
Add back a filesystem backend for testing and development
Python
apache-2.0
ostwald/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,fabianvf/scrapi,icereval/scrapi,erinspace/scrapi,felliott/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,fabianvf/scrapi,alexgarciac/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi
--- +++ @@ -0,0 +1,24 @@ +import os +import json + +from scrapi.processing.base import BaseProcessor + + +class StorageProcessor(BaseProcessor): + NAME = 'storage' + + def process_raw(self, raw): + filename = 'archive/{}/{}/raw.{}'.format(raw['source'], raw['docID'], raw['filetype']) + if not os.p...
b2d60408688cc1bf27842d8744d1048a64b00e94
scripts/staff_public_regs.py
scripts/staff_public_regs.py
# -*- coding: utf-8 -*- """Get public registrations for staff members. python -m scripts.staff_public_regs """ from collections import defaultdict import logging from modularodm import Q from website.models import Node, User from website.app import init_app logger = logging.getLogger('staff_public_regs') STAFF...
Add script to get public registrations for staff members
Add script to get public registrations for staff members [skip ci]
Python
apache-2.0
KAsante95/osf.io,jolene-esposito/osf.io,HarryRybacki/osf.io,jinluyuan/osf.io,leb2dg/osf.io,HalcyonChimera/osf.io,brianjgeiger/osf.io,amyshi188/osf.io,caseyrygt/osf.io,haoyuchen1992/osf.io,jinluyuan/osf.io,laurenrevere/osf.io,SSJohns/osf.io,lyndsysimon/osf.io,HalcyonChimera/osf.io,amyshi188/osf.io,cslzchen/osf.io,zamatt...
--- +++ @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +"""Get public registrations for staff members. + + python -m scripts.staff_public_regs +""" +from collections import defaultdict +import logging + +from modularodm import Q + +from website.models import Node, User +from website.app import init_app + +logger = logg...
f9bdf777a13404ba25e0e8cdf99a3554320529c9
tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py
tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry import benchmark from telemetry.unittest import tab_test_case class InspectorMemoryTest(tab_test_case.TabTestCase): @benchmark.Enabled('h...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry import benchmark from telemetry.unittest import tab_test_case class InspectorMemoryTest(tab_test_case.TabTestCase): @benchmark.Enabled('h...
Add warnings to inspector DOM count unittest baselines.
Add warnings to inspector DOM count unittest baselines. The unit test failure indicates a serious Document leak, where all WebCore::Document loaded in Chrome is leaking. This CL adds warning comments to the baseline to avoid regressions. BUG=392121 NOTRY=true Review URL: https://codereview.chromium.org/393123003 gi...
Python
bsd-3-clause
jaruba/chromium.src,Chilledheart/chromium,dednal/chromium.src,dednal/chromium.src,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Fireblend/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,dushu120...
--- +++ @@ -16,7 +16,15 @@ self.Navigate('dom_counter_sample.html') + # Document_count > 1 indicates that WebCore::Document loaded in Chrome + # is leaking! The baseline should exactly match the numbers on: + # unittest_data/dom_counter_sample.html + # Please contact kouhei@, hajimehoshi@ when re...
46be255fd0cfaeb2352f2f49b4ec5996a804768d
test/unit/handler/test_base.py
test/unit/handler/test_base.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. from mock import Mock from bark.log import Log from bark.handler.base import Handler from bark.formatter.base import Formatter class Concrete(Handler): '''Concrete subclass of abstract base for testing.''' ...
Add unit test for base Handler.
Add unit test for base Handler.
Python
apache-2.0
4degrees/sawmill,4degrees/mill
--- +++ @@ -0,0 +1,63 @@ +# :coding: utf-8 +# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips +# :license: See LICENSE.txt. + +from mock import Mock + +from bark.log import Log +from bark.handler.base import Handler +from bark.formatter.base import Formatter + + +class Concrete(Handler): + '''Concrete subc...
dcc5065c7cc4cc167affcbf906eaf81e73fa6d3e
py/set-mismatch.py
py/set-mismatch.py
class Solution(object): def findErrorNums(self, nums): """ :type nums: List[int] :rtype: List[int] """ for i, n in enumerate(nums, 1): while i != n and nums[n - 1] != n: nums[i - 1], nums[n - 1] = nums[n - 1], nums[i - 1] n = nums[i...
Add py solution for 645. Set Mismatch
Add py solution for 645. Set Mismatch 645. Set Mismatch: https://leetcode.com/problems/set-mismatch/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,13 @@ +class Solution(object): + def findErrorNums(self, nums): + """ + :type nums: List[int] + :rtype: List[int] + """ + for i, n in enumerate(nums, 1): + while i != n and nums[n - 1] != n: + nums[i - 1], nums[n - 1] = nums[n - 1], nu...
1b4bf232b9fd348a94b8bc4e9c851ed5b6d8e801
tests/config/test_room_directory.py
tests/config/test_room_directory.py
# -*- coding: utf-8 -*- # Copyright 2018 New Vector Ltd # # 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 la...
Add tests for config generation
Add tests for config generation
Python
apache-2.0
matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse
--- +++ @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 New Vector Ltd +# +# 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 +...
fefcc9ab57b5dc818690c4febc4250fffb0f9543
subs/modify_acl.py
subs/modify_acl.py
# Copyright 2016 Netfishers # # 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...
Add a new sub example regarding custom ACL modification
Add a new sub example regarding custom ACL modification
Python
apache-2.0
AlainMoretti/cli-wrapper
--- +++ @@ -0,0 +1,69 @@ +# Copyright 2016 Netfishers +# +# 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 ap...
8cc020949f1d7eb9c66121a7d3a762738cb44c2c
src/station_map.py
src/station_map.py
station_map = { '12th': '12th St. Oakland City Center', '16th': '16th St. Mission (SF)', '19th': '19th St. Oakland', '24th': '24th St. Mission (SF)', 'ashb': 'Ashby (Berkeley)', 'balb': 'Balboa Park (SF)', 'bayf': 'Bay Fair (San Leandro)', 'cast': 'Castro Valley', 'civc': 'Civic Cent...
Add dictionary mapping abbreviations to station names
Add dictionary mapping abbreviations to station names
Python
mit
ganemone/SublimeBart,ganemone/SublimeBart,ganemone/SublimeBart,ganemone/SublimeBart
--- +++ @@ -0,0 +1,46 @@ +station_map = { + '12th': '12th St. Oakland City Center', + '16th': '16th St. Mission (SF)', + '19th': '19th St. Oakland', + '24th': '24th St. Mission (SF)', + 'ashb': 'Ashby (Berkeley)', + 'balb': 'Balboa Park (SF)', + 'bayf': 'Bay Fair (San Leandro)', + 'cast': 'Cas...
45dc85ded5a766191cd58d76a16470fc063d6e70
tests/test_httperror.py
tests/test_httperror.py
import unittest from fleece import httperror class HTTPErrorTests(unittest.TestCase): """Tests for :class:`fleece.httperror.HTTPError`.""" def test_error_msg_format(self): with self.assertRaises(httperror.HTTPError) as err: raise httperror.HTTPError(status=404) self.assertEqual('...
Add error formatting tests for httperror
Add error formatting tests for httperror
Python
apache-2.0
racker/fleece,racker/fleece
--- +++ @@ -0,0 +1,19 @@ +import unittest + +from fleece import httperror + + +class HTTPErrorTests(unittest.TestCase): + """Tests for :class:`fleece.httperror.HTTPError`.""" + + def test_error_msg_format(self): + with self.assertRaises(httperror.HTTPError) as err: + raise httperror.HTTPError(...
a627fa4c681bdd9de323750c3ab3f2cb0d5fca86
server/hoot/app.py
server/hoot/app.py
#!../env/bin/python from flask import Flask, jsonify app = Flask(__name__) @app.route('/hoot/api/v1.0/', methods=['GET']) def index(): return jsonify({'hello': 'Hello World!'}) if __name__ == '__main__': app.run(debug=True)
Add basic infrastructure for rest API
Add basic infrastructure for rest API
Python
mit
CatalystOfNostalgia/hoot,CatalystOfNostalgia/hoot
--- +++ @@ -0,0 +1,14 @@ +#!../env/bin/python +from flask import Flask, jsonify + +app = Flask(__name__) + +@app.route('/hoot/api/v1.0/', methods=['GET']) +def index(): + return jsonify({'hello': 'Hello World!'}) + + +if __name__ == '__main__': + app.run(debug=True) + +
500df3f340d7782c759634529ae40ce56f7bec3e
plag.py
plag.py
from docx import Document if __name__ == "__main__": if sys.args[0] == 0: print("Must specify file!") return #open the docx (and docx only) document = Document(sys.args[0]) #for each paragraph on the docx for parag in document.paragraphs: #extract the string text = p...
Add first file Only read a .docx until now
Add first file Only read a .docx until now
Python
apache-2.0
Psidium/NTL
--- +++ @@ -0,0 +1,18 @@ +from docx import Document + +if __name__ == "__main__": + if sys.args[0] == 0: + print("Must specify file!") + return + #open the docx (and docx only) + document = Document(sys.args[0]) + #for each paragraph on the docx + for parag in document.paragraphs: + ...
882de02df3131cf19eed5750428bcb79ce7f30c1
netprofile_access/migrations/f2d2359b923a_link_bindings_to_access_entities.py
netprofile_access/migrations/f2d2359b923a_link_bindings_to_access_entities.py
"""link bindings to access entities Revision ID: f2d2359b923a Revises: b32a4bf96447 Create Date: 2018-01-09 16:59:13.885801 """ # revision identifiers, used by Alembic. revision = 'f2d2359b923a' down_revision = 'b32a4bf96447' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa from...
Add DB migration for netdev bindings
Add DB migration for netdev bindings
Python
agpl-3.0
unikmhz/npui,unikmhz/npui,unikmhz/npui,unikmhz/npui
--- +++ @@ -0,0 +1,41 @@ +"""link bindings to access entities + +Revision ID: f2d2359b923a +Revises: b32a4bf96447 +Create Date: 2018-01-09 16:59:13.885801 + +""" + +# revision identifiers, used by Alembic. +revision = 'f2d2359b923a' +down_revision = 'b32a4bf96447' +branch_labels = None +depends_on = None + +from alem...
5c269bfeb517b70cfcb8fd730bf3eb983a5515dc
markov_batch_learn.py
markov_batch_learn.py
from __future__ import unicode_literals import argparse import os from cobe.brain import Brain if __name__ == "__main__": bots = ["ames", "bojii", "diderobot", "ekimbot", "harbot", "hubbot", "nopebot", "memebot", "pyheufybot", "re_heufybot", "heufybot", "pymoronbot", "moronbot", "robobo", "safebot", "...
Create a quick script to train a COBE brain from a folder of formatted IRC logs
[Core] Create a quick script to train a COBE brain from a folder of formatted IRC logs
Python
mit
HubbeKing/Hubbot_Twisted
--- +++ @@ -0,0 +1,31 @@ +from __future__ import unicode_literals +import argparse +import os +from cobe.brain import Brain + +if __name__ == "__main__": + + bots = ["ames", "bojii", "diderobot", "ekimbot", "harbot", "hubbot", "nopebot", "memebot", + "pyheufybot", "re_heufybot", "heufybot", "pymoronbot"...
ddc3e45f5f84e5574090ee79875039e401864a49
IPython/core/tests/test_extension.py
IPython/core/tests/test_extension.py
import os.path import nose.tools as nt import IPython.testing.tools as tt from IPython.utils.syspathcontext import prepended_to_syspath from IPython.utils.tempdir import TemporaryDirectory ext1_content = """ def load_ipython_extension(ip): print("Running ext1 load") def unload_ipython_extension(ip): print("...
Add test for extension loading and unloading
Add test for extension loading and unloading
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -0,0 +1,69 @@ +import os.path + +import nose.tools as nt + +import IPython.testing.tools as tt +from IPython.utils.syspathcontext import prepended_to_syspath +from IPython.utils.tempdir import TemporaryDirectory + +ext1_content = """ +def load_ipython_extension(ip): + print("Running ext1 load") + +def u...
fc97a838d54417cb063a7757040ff279f298d0bb
cookie_skel.py
cookie_skel.py
# -*- coding: utf-8 -*- """ Created on Wed Sep 14 20:49:34 2016 @author: troon """ import BaseHTTPServer, SimpleHTTPServer from http.cookies import SimpleCookie as cookie class ApplicationRequestHandler(SimpleHTTPServer.BaseHTTPRequestHandler): sessioncookies = {} def __init__(self,*args,**kwargs): self.sessi...
Add snip code for http.cookies
Add snip code for http.cookies
Python
cc0-1.0
JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology
--- +++ @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Sep 14 20:49:34 2016 + +@author: troon +""" + +import BaseHTTPServer, SimpleHTTPServer +from http.cookies import SimpleCookie as cookie + +class ApplicationRequestHandler(SimpleHTTPServer.BaseHTTPRequestHandler): + + sessioncookies = {} + + def _...
08636c9740b3103fd05c81791f43faeb29920305
test/test_utils.py
test/test_utils.py
# -*- coding: utf-8 -*- # Licensed to the Apache Software Foundation (ASF) under one or more§ # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Li...
Add tests for some util functions.
Add tests for some util functions. git-svn-id: 353d90d4d8d13dcb4e0402680a9155a727f61a5a@1082063 13f79535-47bb-0310-9956-ffa450edef68
Python
apache-2.0
aleGpereira/libcloud,sahildua2305/libcloud,pquentin/libcloud,Verizon/libcloud,wuyuewen/libcloud,aleGpereira/libcloud,iPlantCollaborativeOpenSource/libcloud,Verizon/libcloud,Jc2k/libcloud,Cloud-Elasticity-Services/as-libcloud,aviweit/libcloud,vongazman/libcloud,techhat/libcloud,ZuluPro/libcloud,pquentin/libcloud,illfeld...
--- +++ @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +# Licensed to the Apache Software Foundation (ASF) under one or more§ +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache...
04740a33ab8b4d43cda71668ff7027ac7e5982d5
tests/test_cdav.py
tests/test_cdav.py
import datetime import pytz import tzlocal from caldav.elements.cdav import _to_utc_date_string SOMEWHERE_REMOTE = pytz.timezone('Brazil/DeNoronha') # UTC-2 and no DST def test_to_utc_date_string_date(): input = datetime.date(2019, 5, 14) res = _to_utc_date_string(input) assert res == '20190514T000000...
Add test. This continues to need pytz and tzlocal.
Add test. This continues to need pytz and tzlocal.
Python
apache-2.0
python-caldav/caldav
--- +++ @@ -0,0 +1,42 @@ +import datetime + +import pytz +import tzlocal + +from caldav.elements.cdav import _to_utc_date_string + +SOMEWHERE_REMOTE = pytz.timezone('Brazil/DeNoronha') # UTC-2 and no DST + + +def test_to_utc_date_string_date(): + input = datetime.date(2019, 5, 14) + res = _to_utc_date_string(i...
7a70d230d3ceb3c37d718f138e80b132b9a05fae
edwin/teams/migrations/0005_auto_20150811_2236.py
edwin/teams/migrations/0005_auto_20150811_2236.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('teams', '0004_auto_20150516_0009'), ] operations = [ migrations.AlterField( model_name='team', name=...
Add migration for multiple repos per team.
Add migration for multiple repos per team.
Python
mpl-2.0
mythmon/edwin,mythmon/edwin,mythmon/edwin,mythmon/edwin
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('teams', '0004_auto_20150516_0009'), + ] + + operations = [ + migrations.AlterField( + ...
4c4891f24c0e5b093d3a9fcb0de86609b01a69c3
fellowms/migrations/0053_auto_20160804_1447.py
fellowms/migrations/0053_auto_20160804_1447.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-08-04 14:47 from __future__ import unicode_literals from django.db import migrations import django_countries.fields class Migration(migrations.Migration): dependencies = [ ('fellowms', '0052_merge'), ] operations = [ migrations...
Add migration for replace location with country and city
Add migration for replace location with country and city
Python
bsd-3-clause
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
--- +++ @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-08-04 14:47 +from __future__ import unicode_literals + +from django.db import migrations +import django_countries.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('fellowms', '0052_merge'), + ...
d1b7ed5f705c8e0935778636ade00a7452e2ea7f
project/holviapp/management/commands/import_holvidata.py
project/holviapp/management/commands/import_holvidata.py
# -*- coding: utf-8 -*- import datetime import itertools import dateutil.parser from django.core.management.base import BaseCommand, CommandError from holviapp.importer import HolviImporter from holviapp.utils import list_invoices, list_orders def yesterday_proxy(): now_yesterday = datetime.datetime.now() - date...
Add management command for importing Holvi Invoices and Orders
Add management command for importing Holvi Invoices and Orders Invoices may have multiple payments, abstracttransaction is generated for each payment line. Orders are paid in one go (they're from the webshop), one transaction is generated from an Order.
Python
mit
rambo/asylum,rambo/asylum,hacklab-fi/asylum,jautero/asylum,HelsinkiHacklab/asylum,jautero/asylum,rambo/asylum,rambo/asylum,jautero/asylum,HelsinkiHacklab/asylum,hacklab-fi/asylum,hacklab-fi/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum,jautero/asylum,hacklab-fi/asylum
--- +++ @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +import datetime +import itertools + +import dateutil.parser +from django.core.management.base import BaseCommand, CommandError +from holviapp.importer import HolviImporter +from holviapp.utils import list_invoices, list_orders + + +def yesterday_proxy(): + now_yes...
d942340fb5cfe8aa9aade11b3117b9848097c8a1
alerts/geomodel/journal.py
alerts/geomodel/journal.py
'''To make GeoModel code more testable, we abstract interaction with ElasticSearch away via a "journal interface". This is just a function that, called with an ES index and a list of `Entry`, stores the contained locality state data in ElasticSearch. ''' from typing import Callable, List, NamedTuple from mozdef_util...
Write an abstraction for storing locality state in ES
Write an abstraction for storing locality state in ES
Python
mpl-2.0
jeffbryner/MozDef,mozilla/MozDef,mpurzynski/MozDef,jeffbryner/MozDef,mozilla/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,mozilla/MozDef,mozilla/MozDef,jeffbryner/MozDef,jeffbryner/MozDef
--- +++ @@ -0,0 +1,39 @@ +'''To make GeoModel code more testable, we abstract interaction with +ElasticSearch away via a "journal interface". This is just a function that, +called with an ES index and a list of `Entry`, stores the contained locality +state data in ElasticSearch. +''' + +from typing import Callable, ...
b1f964e9725a18014de17d454bb733b7ad43cd38
pytac/write_to_file_readback_pvs.py
pytac/write_to_file_readback_pvs.py
import pytac.load_csv import pytac.epics def write_data_to_file(file_name, data): fin = open(file_name, 'w') for row in data: fin.write('{0}\n'.format(row)) fin.close() def get_readback_pvs(mode): lattice = pytac.load_csv.load(mode, pytac.epics.EpicsControlSystem()) elements = lattice.ge...
Write Pytac script to write all readback pvs to file
Write Pytac script to write all readback pvs to file
Python
apache-2.0
razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects
--- +++ @@ -0,0 +1,33 @@ +import pytac.load_csv +import pytac.epics + + +def write_data_to_file(file_name, data): + fin = open(file_name, 'w') + for row in data: + fin.write('{0}\n'.format(row)) + fin.close() + + +def get_readback_pvs(mode): + lattice = pytac.load_csv.load(mode, pytac.epics.EpicsCo...
0083a6fadad8bb0f202bab2af183a10f09e19459
piglow/demo_piglow.py
piglow/demo_piglow.py
from piglow import PiGlow import time def brighten_arm( arm ): for i in range( 1, 10 ): piglow.arm( arm, i ) time.sleep( 0.11 ) time.sleep( 0.5 ) piglow.arm( arm, 0 ) piglow = PiGlow() piglow.all(0) brighten_arm( 1 ) brighten_arm( 2 ) brighten_arm( 3 )
Add simple demo of piglow - lighting arms
Add simple demo of piglow - lighting arms
Python
mit
claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code
--- +++ @@ -0,0 +1,20 @@ +from piglow import PiGlow +import time + +def brighten_arm( arm ): + + for i in range( 1, 10 ): + piglow.arm( arm, i ) + time.sleep( 0.11 ) + + time.sleep( 0.5 ) + piglow.arm( arm, 0 ) + +piglow = PiGlow() + +piglow.all(0) + +brighten_arm( 1 ) +brighten_arm( 2 ) +brigh...
b3f8be5b6ab7e4e713004447a3cfbda743d80394
rules/management/commands/CorpusLogicUpdate.py
rules/management/commands/CorpusLogicUpdate.py
import logging from django.core.management.base import BaseCommand, CommandError from plyara import YaraParser from rules.models import YaraRule # Configure Logging logging.basicConfig(level=logging.INFO) class Command(BaseCommand): help = 'Recalculate the logic hashes of the entire rule corpus' def handl...
Add management command to update corpus logic hashes
Add management command to update corpus logic hashes
Python
apache-2.0
PUNCH-Cyber/YaraGuardian,PUNCH-Cyber/YaraGuardian,PUNCH-Cyber/YaraGuardian,PUNCH-Cyber/YaraGuardian
--- +++ @@ -0,0 +1,28 @@ +import logging +from django.core.management.base import BaseCommand, CommandError + +from plyara import YaraParser +from rules.models import YaraRule + +# Configure Logging +logging.basicConfig(level=logging.INFO) + + +class Command(BaseCommand): + + help = 'Recalculate the logic hashes o...
16f29bfc832a64accd6ef67c2140f70ea07f2f05
h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater_feature_extraction.py
h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater_feature_extraction.py
from __future__ import print_function import sys, os sys.path.insert(1, os.path.join("..","..","..")) import h2o from tests import pyunit_utils from h2o.estimators.deepwater import H2ODeepWaterEstimator def deepwater_lenet(): if not H2ODeepWaterEstimator.available(): return frame = h2o.import_file(pyunit_utils.lo...
Add PyUnit for deep feature extraction of a LeNet model with mxnet.
Add PyUnit for deep feature extraction of a LeNet model with mxnet.
Python
apache-2.0
michalkurka/h2o-3,mathemage/h2o-3,h2oai/h2o-3,h2oai/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,spennihana/h2o-3,h2oai/h2o-dev,h2oai/h2o-dev,h2oai/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,spennihana/h2o-3,mathemage...
--- +++ @@ -0,0 +1,31 @@ +from __future__ import print_function +import sys, os +sys.path.insert(1, os.path.join("..","..","..")) +import h2o +from tests import pyunit_utils +from h2o.estimators.deepwater import H2ODeepWaterEstimator + +def deepwater_lenet(): + if not H2ODeepWaterEstimator.available(): return + + f...
5ee78767ebaa5c1bbceb7ce2c82fa6687169b0c2
codingame/medium/paranoid_android.py
codingame/medium/paranoid_android.py
class Elevator(object): def __init__(self, floor, pos): super(Elevator, self).__init__() self.floor = floor self.pos = pos self.direction = None def __str__(self): return 'Elevator on floor %i (pos %i) with dir %s' % (self.floor, self.pos, self.direction) class Game(ob...
Add exercice The Paranoid Android
Add exercice The Paranoid Android
Python
mit
AntoineAugusti/katas,AntoineAugusti/katas,AntoineAugusti/katas
--- +++ @@ -0,0 +1,76 @@ +class Elevator(object): + def __init__(self, floor, pos): + super(Elevator, self).__init__() + self.floor = floor + self.pos = pos + self.direction = None + + def __str__(self): + return 'Elevator on floor %i (pos %i) with dir %s' % (self.floor, self....
114ea6c10658d2c199c68637d04bdd968fcc4452
voyager_tasks/test/test_info_files.py
voyager_tasks/test/test_info_files.py
import os import sys import glob import json import unittest sys.path.append(os.path.dirname(os.path.dirname(__file__))) import voyager_tasks class TestInfoFiles(unittest.TestCase): """Test case for checking info files exist for each task and have a valid structure. """ @classmethod def setUpClass...
Test case for task.info.json files
Test case for task.info.json files Ensures all tasks have .info.json file and have a valid structure.
Python
apache-2.0
voyagersearch/voyager-py,voyagersearch/voyager-py
--- +++ @@ -0,0 +1,47 @@ +import os +import sys +import glob +import json +import unittest +sys.path.append(os.path.dirname(os.path.dirname(__file__))) +import voyager_tasks + + +class TestInfoFiles(unittest.TestCase): + """Test case for checking info files exist + for each task and have a valid structure. + ...
ce9ac96a6f1e57ebbce162b7e097675c23f1f2f4
projects/jakub/gaussian_processes/gaussian_process_regression.py
projects/jakub/gaussian_processes/gaussian_process_regression.py
import csv import sys import matplotlib.pyplot as plt import numpy as np import sklearn import sklearn.gaussian_process.kernels kernel = (sklearn.gaussian_process.kernels.ConstantKernel() + sklearn.gaussian_process.kernels.Matern(length_scale=2, nu=3/2) + sklearn.gaussian_process.kernels.WhiteKer...
Implement simple gaussian process regression.
Implement simple gaussian process regression.
Python
bsd-3-clause
alasdairtran/mclearn,chengsoonong/mclass-sky,alasdairtran/mclearn,alasdairtran/mclearn,chengsoonong/mclass-sky,chengsoonong/mclass-sky,alasdairtran/mclearn,chengsoonong/mclass-sky
--- +++ @@ -0,0 +1,72 @@ +import csv +import sys + +import matplotlib.pyplot as plt +import numpy as np +import sklearn +import sklearn.gaussian_process.kernels + + +kernel = (sklearn.gaussian_process.kernels.ConstantKernel() + + sklearn.gaussian_process.kernels.Matern(length_scale=2, nu=3/2) + + sk...
6c4edaefe30905f62b885b931a1c5ca6d65cd220
server/tests/models/test_project.py
server/tests/models/test_project.py
from server.models import Project from server.tests.helpers import fixtures, FlaskTestCase class TestProject(FlaskTestCase): @fixtures('single_project.json') def test_get_single_owner(self): """Test getting single project owner """ with self.flaskapp.test_request_context(): ...
Add tests for project model
Add tests for project model
Python
mit
ganemone/ontheside,ganemone/ontheside,ganemone/ontheside
--- +++ @@ -0,0 +1,59 @@ +from server.models import Project +from server.tests.helpers import fixtures, FlaskTestCase + + +class TestProject(FlaskTestCase): + @fixtures('single_project.json') + def test_get_single_owner(self): + """Test getting single project owner + """ + with self.flaskap...