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 |
|---|---|---|---|---|---|---|---|---|---|---|
4e73cc77f8353bf18b15d704fe58336018cb68a8 | tests/test_lc.py | tests/test_lc.py | from __future__ import division, print_function
import cPickle as pickle
import sys
import matplotlib.pyplot as plt
print('Loading lc file...')
lcdata = pickle.load(open(sys.argv[1]))
time = lcdata['time']
lc = lcdata['lc']
gti = lcdata['gti']
plt.plot(time, lc, drawstyle='steps-mid', color='k')
for g in gti:
p... | Test if light curves are extracted correctly | Test if light curves are extracted correctly
| Python | bsd-3-clause | matteobachetti/MaLTPyNT | ---
+++
@@ -0,0 +1,18 @@
+from __future__ import division, print_function
+import cPickle as pickle
+import sys
+import matplotlib.pyplot as plt
+
+print('Loading lc file...')
+lcdata = pickle.load(open(sys.argv[1]))
+
+time = lcdata['time']
+lc = lcdata['lc']
+gti = lcdata['gti']
+
+plt.plot(time, lc, drawstyle='ste... | |
3a27fd06b182966a03c6ed92ed9b5e17e804fb24 | src/sentry/management/commands/check_notifications.py | src/sentry/management/commands/check_notifications.py | """
sentry.management.commands.check_notifications
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.core.management.base import BaseC... | Add management command to check who gets email notifications | Add management command to check who gets email notifications
| Python | bsd-3-clause | ifduyue/sentry,alexm92/sentry,ifduyue/sentry,zenefits/sentry,jean/sentry,mvaled/sentry,ifduyue/sentry,mvaled/sentry,JackDanger/sentry,gencer/sentry,fotinakis/sentry,zenefits/sentry,mvaled/sentry,looker/sentry,beeftornado/sentry,JamesMura/sentry,nicholasserra/sentry,looker/sentry,fotinakis/sentry,mvaled/sentry,looker/se... | ---
+++
@@ -0,0 +1,65 @@
+"""
+sentry.management.commands.check_notifications
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
+:license: BSD, see LICENSE for more details.
+"""
+from __future__ import absolute_import, print_function
+
+from dja... | |
8a6e47c3e9412c29cb709fdba2026724246a30e2 | scripts/patches/appflow.py | scripts/patches/appflow.py | patches = [
{
"op": "add",
"path": "/PropertyTypes/AWS::AppFlow::ConnectorProfile.CustomAuthCredentials/Properties/CredentialsMap/PrimitiveType",
"value": "Json",
},
{
"op": "remove",
"path": "/PropertyTypes/AWS::AppFlow::ConnectorProfile.CustomAuthCredentials/Propert... | Add spec patch for AppFlow | Add spec patch for AppFlow
| Python | bsd-2-clause | cloudtools/troposphere,cloudtools/troposphere | ---
+++
@@ -0,0 +1,47 @@
+patches = [
+ {
+ "op": "add",
+ "path": "/PropertyTypes/AWS::AppFlow::ConnectorProfile.CustomAuthCredentials/Properties/CredentialsMap/PrimitiveType",
+ "value": "Json",
+ },
+ {
+ "op": "remove",
+ "path": "/PropertyTypes/AWS::AppFlow::ConnectorP... | |
f6b8cf05b025bec12e8fe82f8bfdb56558ca1b14 | tools/test/toolchains/api.py | tools/test/toolchains/api.py | import sys
import os
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
sys.path.insert(0, ROOT)
from tools.toolchains import TOOLCHAIN_CLASSES, LEGACY_TOOLCHAIN_NAMES
from tools.targets import TARGET_MAP
def test_instantiation():
for name, Class in TOOLCHAIN_CLASSES.items():
... | Add a test that exercises the abstract base class checking | Add a test that exercises the abstract base class checking
The test simply tries to instantiate each class exposed as part of the
TOOLCHAIN_CLASSES map. This is a test that each toolchain class
implements the required API, as the mbedToolchain will not allow the
instantiation of a subclass without a part of that API.
| Python | apache-2.0 | NXPmicro/mbed,karsev/mbed-os,screamerbg/mbed,nRFMesh/mbed-os,netzimme/mbed-os,netzimme/mbed-os,ryankurte/mbed-os,nRFMesh/mbed-os,YarivCol/mbed-os,infinnovation/mbed-os,fvincenzo/mbed-os,RonEld/mbed,bcostm/mbed-os,adustm/mbed,infinnovation/mbed-os,theotherjimmy/mbed,cvtsi2sd/mbed-os,tung7970/mbed-os,fahhem/mbed-os,svogl... | ---
+++
@@ -0,0 +1,13 @@
+import sys
+import os
+
+ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
+sys.path.insert(0, ROOT)
+
+from tools.toolchains import TOOLCHAIN_CLASSES, LEGACY_TOOLCHAIN_NAMES
+from tools.targets import TARGET_MAP
+
+def test_instantiation():
+ for name, Cla... | |
420319884771cd12e3c2034bdf5d9308144ffc0c | tests/ldap_sync/test_db_fetch.py | tests/ldap_sync/test_db_fetch.py | # Copyright (c) 2022. The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details
import pytest
from ldap_sync.db import fetch_users_to_sync, UserProxyType
from tests import factories
@pyt... | Add rudimentary tests for `fetch_users_to_sync` | Add rudimentary tests for `fetch_users_to_sync`
| Python | apache-2.0 | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | ---
+++
@@ -0,0 +1,54 @@
+# Copyright (c) 2022. The Pycroft Authors. See the AUTHORS file.
+# This file is part of the Pycroft project and licensed under the terms of
+# the Apache License, Version 2.0. See the LICENSE file for details
+import pytest
+
+from ldap_sync.db import fetch_users_to_sync, UserProxyType
+... | |
e1a132dce80a530051abc4c51edc36901dbf5e85 | tests/pytests/unit/modules/test_dpkg_lowpkg.py | tests/pytests/unit/modules/test_dpkg_lowpkg.py | import os
import salt.modules.dpkg_lowpkg as dpkg
from tests.support.mock import MagicMock, mock_open, patch
def test_get_pkg_license():
"""
Test _get_pkg_license for ignore errors on reading license from copyright files
"""
license_read_mock = mock_open(read_data="")
with patch.object(os.path, "... | Add test for license reading with dpkg_lowpkg | Add test for license reading with dpkg_lowpkg
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,18 @@
+import os
+
+import salt.modules.dpkg_lowpkg as dpkg
+from tests.support.mock import MagicMock, mock_open, patch
+
+
+def test_get_pkg_license():
+ """
+ Test _get_pkg_license for ignore errors on reading license from copyright files
+ """
+ license_read_mock = mock_open(read_dat... | |
fff9bb1bd61e43124d1de7ef1b6e004758c38a7f | tests/system/python/api/test_authentication.py | tests/system/python/api/test_authentication.py | # -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
""" Test authentication REST API """
import http.client
import json
import time
import pytest
__author__ = "Vaibhav Singhal"
__copyright__ = "Copyright (c) 2019 Dianomic Systems"
__license__ = "Apache 2.0"
__version__ = "${... | Test added for login/logout pwd | Test added for login/logout pwd
| Python | apache-2.0 | foglamp/FogLAMP,foglamp/FogLAMP,foglamp/FogLAMP,foglamp/FogLAMP | ---
+++
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+
+# FOGLAMP_BEGIN
+# See: http://foglamp.readthedocs.io/
+# FOGLAMP_END
+
+""" Test authentication REST API """
+
+import http.client
+import json
+import time
+import pytest
+
+
+__author__ = "Vaibhav Singhal"
+__copyright__ = "Copyright (c) 2019 Dianomic Systems"
+... | |
2698d0d846f061e3560d6e87f43c57ed10517006 | zou/migrations/versions/3d5c93bafb9d_.py | zou/migrations/versions/3d5c93bafb9d_.py | """empty message
Revision ID: 3d5c93bafb9d
Revises: 7dc79d4ed7cd
Create Date: 2018-05-30 20:04:38.461178
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = '3d5c93bafb9d'
down_revision = '7dc79d4ed7cd'
branch_labels = None
depends_on = None... | Add has avatar column to project table | Add has avatar column to project table
| Python | agpl-3.0 | cgwire/zou | ---
+++
@@ -0,0 +1,29 @@
+"""empty message
+
+Revision ID: 3d5c93bafb9d
+Revises: 7dc79d4ed7cd
+Create Date: 2018-05-30 20:04:38.461178
+
+"""
+from alembic import op
+import sqlalchemy as sa
+import sqlalchemy_utils
+
+
+# revision identifiers, used by Alembic.
+revision = '3d5c93bafb9d'
+down_revision = '7dc79d4ed7... | |
8a6995d4ff89554325144115ea199d0e02086824 | Graphs/inorder_and_preorder.py | Graphs/inorder_and_preorder.py | import unittest
"""
Construct tree from given inorder and preorder traversals.
Input:
Inorder: D B E A F C
Preorder: A B D E C F
In a preorder sequence, leftmost element is root of tree. So, we know 'A' is root from given preorder sequence.
By searching 'A' in inorder sequence, we can find out all elements on left side... | Build a tree from inorder and preorder traversals | Build a tree from inorder and preorder traversals
| Python | mit | prathamtandon/g4gproblems | ---
+++
@@ -0,0 +1,64 @@
+import unittest
+"""
+Construct tree from given inorder and preorder traversals.
+Input:
+Inorder: D B E A F C
+Preorder: A B D E C F
+In a preorder sequence, leftmost element is root of tree. So, we know 'A' is root from given preorder sequence.
+By searching 'A' in inorder sequence, we can... | |
55d9a2067dbb8875638ad2ea6bd340272a51c432 | test/command_line/test_cosym.py | test/command_line/test_cosym.py | from __future__ import absolute_import, division, print_function
import os
import pytest
import procrunner
def test_cosym(regression_data, run_in_tmpdir):
reg_path = regression_data("multi_crystal_proteinase_k").strpath
command = ['dials.cosym']
for i in [1, 2, 3, 4, 5, 7, 8, 10]:
command.append(os.path.j... | Add command line test for cosym.py | Add command line test for cosym.py
| Python | bsd-3-clause | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | ---
+++
@@ -0,0 +1,20 @@
+from __future__ import absolute_import, division, print_function
+
+import os
+import pytest
+import procrunner
+
+def test_cosym(regression_data, run_in_tmpdir):
+
+ reg_path = regression_data("multi_crystal_proteinase_k").strpath
+
+ command = ['dials.cosym']
+ for i in [1, 2, 3, 4, 5, ... | |
35185be5f28e70f510954bc0352ec6ee625d8e98 | genmake/tests/config_test.py | genmake/tests/config_test.py | #!/usr/bin/env python3
"""
Unit testing suite for config module.
"""
# --------------------------------- MODULES -----------------------------------
import unittest
# Avoid import globbing: each function is imported separately instead.
import genmake
# --------------------------------- MODULES -----------------------... | Add unit test module template for 'config' module | Add unit test module template for 'config' module
| Python | bsd-2-clause | jhxie/skaff,jhxie/skaff,jhxie/skaff,jhxie/genmake | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+"""
+Unit testing suite for config module.
+"""
+# --------------------------------- MODULES -----------------------------------
+import unittest
+
+# Avoid import globbing: each function is imported separately instead.
+import genmake
+# ---------------------------... | |
d162d77611be23b55c2efd9c902765467c1162fe | plyer/tests/test_cpu.py | plyer/tests/test_cpu.py | '''
TestCPU
=======
Tested platforms:
* Linux - nproc
'''
import unittest
from plyer.tests.common import PlatformTest, platform_import
class MockedNProc(object):
'''
Mocked object used instead of 'nproc' binary in the Linux specific API
plyer.platforms.linux.cpu. The same output structure is tested fo... | Add test for GNU/Linux CPU logical cores | Add test for GNU/Linux CPU logical cores
| Python | mit | kivy/plyer,KeyWeeUsr/plyer,KeyWeeUsr/plyer,kivy/plyer,KeyWeeUsr/plyer,kivy/plyer | ---
+++
@@ -0,0 +1,79 @@
+'''
+TestCPU
+=======
+
+Tested platforms:
+
+* Linux - nproc
+'''
+
+import unittest
+
+from plyer.tests.common import PlatformTest, platform_import
+
+
+class MockedNProc(object):
+ '''
+ Mocked object used instead of 'nproc' binary in the Linux specific API
+ plyer.platforms.linu... | |
5c24579621efbf9f95f32b2feb86d507e112c26c | aids/sorting_and_searching/intersection_sorted_arrays.py | aids/sorting_and_searching/intersection_sorted_arrays.py | '''
In this module, we implement a function which gets the intersection
of two sorted arrays.
'''
def intersection_sorted_arrays(arr_1, arr_2):
'''
Return the intersection of two sorted arrays
'''
result = []
i,j = 0,0
while i < len(arr_1) and j < len(arr_2):
if arr_1[i] == arr_2[j]:
result.append(arr_1[... | Return intersection of two sorted arrays | Return intersection of two sorted arrays
| Python | mit | ueg1990/aids | ---
+++
@@ -0,0 +1,23 @@
+'''
+In this module, we implement a function which gets the intersection
+of two sorted arrays.
+
+'''
+
+def intersection_sorted_arrays(arr_1, arr_2):
+ '''
+ Return the intersection of two sorted arrays
+
+ '''
+ result = []
+ i,j = 0,0
+ while i < len(arr_1) and j < len(arr_2):
+ if arr... | |
2d08ba191396a5e18142adb3131791d6b19373eb | nagios/check_n0q.py | nagios/check_n0q.py | """
Check the production of N0Q data!
"""
import json
import datetime
import sys
j = json.load( open('/home/ldm/data/gis/images/4326/USCOMP/n0q_0.json') )
prodtime = datetime.datetime.strptime(j['meta']['valid'], '%Y-%m-%dT%H:%M:%SZ')
radarson = int(j['meta']['radar_quorum'].split("/")[0])
gentime = j['meta']['process... | Add N0Q check for iem21 to run | Add N0Q check for iem21 to run | Python | mit | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | ---
+++
@@ -0,0 +1,29 @@
+"""
+Check the production of N0Q data!
+"""
+import json
+import datetime
+import sys
+
+j = json.load( open('/home/ldm/data/gis/images/4326/USCOMP/n0q_0.json') )
+prodtime = datetime.datetime.strptime(j['meta']['valid'], '%Y-%m-%dT%H:%M:%SZ')
+radarson = int(j['meta']['radar_quorum'].split(... | |
63ec9d509b301b69737e95517de30af70e13a51d | cycle_context.py | cycle_context.py | import sublime, sublime_plugin
values = {}
class CycleContextTracker(sublime_plugin.EventListener):
def on_query_context(self, view, key, operator, operand, match_all):
prefix = "cycle_"
if key.startswith(prefix):
number = int(key[len(prefix):len(prefix)+1])
actual_key = ke... | Add a convenience way to have a context key to cycle between values | Add a convenience way to have a context key to cycle between values
| Python | mit | ktuan89/sublimeplugins | ---
+++
@@ -0,0 +1,18 @@
+import sublime, sublime_plugin
+
+values = {}
+
+class CycleContextTracker(sublime_plugin.EventListener):
+ def on_query_context(self, view, key, operator, operand, match_all):
+ prefix = "cycle_"
+ if key.startswith(prefix):
+ number = int(key[len(prefix):len(pre... | |
bd4f8f67283a8b5a9dc5a83e943e7a59b85999e0 | corehq/messaging/management/commands/resync_case_type.py | corehq/messaging/management/commands/resync_case_type.py | from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from corehq.messaging.tasks import sync_case_for_messaging
from corehq.util.log import with_progress_bar
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = "Sync messaging models for cases"
... | Add command for resyncing cases for messaging | Add command for resyncing cases for messaging
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,25 @@
+from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
+from corehq.messaging.tasks import sync_case_for_messaging
+from corehq.util.log import with_progress_bar
+from django.core.management.base import BaseCommand, CommandError
+
+
+class Command(BaseCommand):
+ help = "S... | |
99bcf23c86c3ba2a1b06e5c0dc90f5c3111f5c92 | data_collection/social_media/twitter/sentiment_analysis/stanford_nlp.py | data_collection/social_media/twitter/sentiment_analysis/stanford_nlp.py | #!/usr/bin/env python2
import re
import os
import time
import subprocess as s
tweet_file = "../tweets.csv"
# Change it!!!
stanford_nlp_dir = "/home/tonyo/EPFL/big_data/sentiment_analysis/stanford-corenlp-full-2014-01-04"
def process_tweets(tweets):
os.chdir(stanford_nlp_dir)
cmd_str = 'java -cp "*" -mx5g e... | Test sentiment analysis with Stanford NLP | Test sentiment analysis with Stanford NLP
| Python | bsd-3-clause | FAB4D/humanitas,FAB4D/humanitas,FAB4D/humanitas | ---
+++
@@ -0,0 +1,69 @@
+#!/usr/bin/env python2
+
+import re
+import os
+import time
+import subprocess as s
+
+tweet_file = "../tweets.csv"
+
+# Change it!!!
+stanford_nlp_dir = "/home/tonyo/EPFL/big_data/sentiment_analysis/stanford-corenlp-full-2014-01-04"
+
+def process_tweets(tweets):
+ os.chdir(stanford_nlp_... | |
aed52fd9cbb489548457cb65f135e64370ea8229 | tests/test_config.py | tests/test_config.py | import httpretty
from zipa import test_com as t
def test_config_zipa():
t.config.host = 'random'
t.config.prefix = 'prefix'
t.config.append_slash = True
t.config.secure = False
t.config.headers = {
'x-custom-header': 'custom-value'
}
assert t.config['host'] == 'random'
assert... | Add tests for custom headers | Add tests for custom headers
| Python | apache-2.0 | PressLabs/zipa | ---
+++
@@ -0,0 +1,25 @@
+import httpretty
+
+from zipa import test_com as t
+
+
+def test_config_zipa():
+ t.config.host = 'random'
+ t.config.prefix = 'prefix'
+ t.config.append_slash = True
+ t.config.secure = False
+ t.config.headers = {
+ 'x-custom-header': 'custom-value'
+ }
+
+ asse... | |
451a0773da3aafc525e60e2a222fd4d1613589f6 | tests/test_splits.py | tests/test_splits.py | from tests.base import IntegrationTest
class TestBurndown(IntegrationTest):
def execute(self):
self.command("TaskWikiBurndownDaily")
assert self.command(":py print vim.current.buffer", silent=False).startswith("<buffer burndown.daily")
assert "Daily Burndown" in self.read_buffer()[0]
| import re
from tests.base import IntegrationTest
from tasklib.task import local_zone
from datetime import datetime
class TestBurndownDailySimple(IntegrationTest):
def execute(self):
self.command("TaskWikiBurndownDaily")
assert self.command(":py print vim.current.buffer", silent=False).startswith... | Add simple tests for burndown, calendar and ghistory commands | tests: Add simple tests for burndown, calendar and ghistory commands
| Python | mit | Spirotot/taskwiki,phha/taskwiki | ---
+++
@@ -1,9 +1,67 @@
+import re
+
from tests.base import IntegrationTest
+from tasklib.task import local_zone
+from datetime import datetime
-class TestBurndown(IntegrationTest):
+class TestBurndownDailySimple(IntegrationTest):
def execute(self):
self.command("TaskWikiBurndownDaily")
... |
f5629d4fde2b2fddd84cce281443b8aa9dd5da76 | python-practice/arrays.py | python-practice/arrays.py | def reverse_array(input_array):
left = 0
right = len(input_array) - 1 # Array is 0 indexed
tmp_array = input_array
while right > left:
tmp_array[left], tmp_array[right] = tmp_array[right], tmp_array[left]
left += 1
right -= 1
return tmp_array
def binary_search(input_arr... | Create file - reverse in place, binary search | Create file - reverse in place, binary search | Python | mit | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various | ---
+++
@@ -0,0 +1,52 @@
+def reverse_array(input_array):
+ left = 0
+ right = len(input_array) - 1 # Array is 0 indexed
+ tmp_array = input_array
+
+ while right > left:
+ tmp_array[left], tmp_array[right] = tmp_array[right], tmp_array[left]
+ left += 1
+ right -= 1
+
+ return t... | |
0d80c81bbc6280e13d1702a9df210980e5852174 | utils/clear_redis.py | utils/clear_redis.py | """Utility for clearing all keys out of redis -- do not use in production!"""
import sys
from optparse import OptionParser
import redis
def option_parser():
parser = OptionParser()
parser.add_option("-f", "--force",
action="store_true", dest="force", default=False,
... | Add utility for clearing out redis keys from tests. | Add utility for clearing out redis keys from tests.
| Python | bsd-3-clause | harrissoerja/vumi,TouK/vumi,harrissoerja/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix | ---
+++
@@ -0,0 +1,36 @@
+"""Utility for clearing all keys out of redis -- do not use in production!"""
+
+import sys
+from optparse import OptionParser
+
+import redis
+
+
+def option_parser():
+ parser = OptionParser()
+ parser.add_option("-f", "--force",
+ action="store_true", dest="forc... | |
fb8c9def3c2de6af29bf98a2cecf13c9da48d65b | components/breakpad/tools/dmp2minidump.py | components/breakpad/tools/dmp2minidump.py | #!/usr/bin/env python
# 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.
"""A tool to extract minidumps from dmp crash dumps."""
import os
import sys
from cgi import parse_multipart
def ProcessDump(dump_fi... | Add a script to extract a minidump from a crash dump | Add a script to extract a minidump from a crash dump
minidump_stackwalk doesn't know how to read dmp files generated by our
breakpad implementation. This tool makes it easier to analyze local
crashes.
BUG=247431
R=bauerb@chromium.org
NOTRY=true
Review URL: https://codereview.chromium.org/40153002
git-svn-id: de016e... | Python | bsd-3-clause | chuan9/chromium-crosswalk,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,dednal/chromium.src,markYoungH/chromium.src,ChromiumWebApps/chromium,krieger-od/nwjs_chromium.src,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,patrickm/chromium.src,anirudhSK/chromium,M4sse/chromium.src,Chilledheart/chromium,... | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# 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.
+
+"""A tool to extract minidumps from dmp crash dumps."""
+
+import os
+import sys
+from cgi import pars... | |
6aa0627b35dfa46c0b5c777ef1fd111ea263bcb2 | PunchCard-test.py | PunchCard-test.py | import unittest
import PunchCard
class CaclWorkTimeTests(unittest.TestCase):
def test_returnsTwo_givenEightAndTenOclock(self):
self.assertEqual(PunchCard.calcWorkTime('8:00', '10:00'), 2)
def test_returnsZero_givenEightAndEightOclock(self):
self.assertEqual(PunchCard.calcWorkTime('8:00', '8:... | Add test file with tests using unittest module | Add test file with tests using unittest module
Test calcWorkTime method. Test calculateDay method.
| Python | mit | NLSteveO/PunchCard,NLSteveO/PunchCard | ---
+++
@@ -0,0 +1,45 @@
+import unittest
+import PunchCard
+
+
+class CaclWorkTimeTests(unittest.TestCase):
+
+ def test_returnsTwo_givenEightAndTenOclock(self):
+ self.assertEqual(PunchCard.calcWorkTime('8:00', '10:00'), 2)
+
+ def test_returnsZero_givenEightAndEightOclock(self):
+ self.assertEq... | |
93f385349d0adfd145eeb0ee72a0b6b132286900 | lib/tarSupport.py | lib/tarSupport.py | import os
import sys
import tarfile
import cStringIO
class GlideinTar:
"""
potential exception needs to be caught by calling routine
"""
def __init__(self):
self.strings = {}
self.files = []
def add_file(self, filename, arc_dirname):
if os.path.exists(filename):
... | Add the ability to create Tar files | Add the ability to create Tar files
| Python | bsd-3-clause | holzman/glideinwms-old,holzman/glideinwms-old,holzman/glideinwms-old | ---
+++
@@ -0,0 +1,50 @@
+import os
+import sys
+import tarfile
+import cStringIO
+
+class GlideinTar:
+ """
+ potential exception needs to be caught by calling routine
+ """
+ def __init__(self):
+ self.strings = {}
+ self.files = []
+
+ def add_file(self, filename, arc_dirname):
+ ... | |
04b4594054dd2cb2161ce52947e0f29d97320cf2 | scripts/check_finished.py | scripts/check_finished.py | import os
import sys
def check_finished(sim_dir, file_name='lammps_out.txt'):
dir_list = os.listdir(sim_dir)
if file_name in dir_list:
with open(os.path.join(sim_dir, file_name), 'r') as lout:
lammps_lines = lout.readlines()
if len(lammps_lines) > 0:
if 'Total wall time... | Add script to check if cluster jobs are finished. | Add script to check if cluster jobs are finished.
| Python | mit | kbsezginel/tee_mof,kbsezginel/tee_mof | ---
+++
@@ -0,0 +1,25 @@
+import os
+import sys
+
+
+def check_finished(sim_dir, file_name='lammps_out.txt'):
+ dir_list = os.listdir(sim_dir)
+ if file_name in dir_list:
+ with open(os.path.join(sim_dir, file_name), 'r') as lout:
+ lammps_lines = lout.readlines()
+ if len(lammps_lines)... | |
88fb394d69214fea35a5c68cb0497c45e7b1987f | tests/test_request_handler.py | tests/test_request_handler.py | from fake_webapp import EXAMPLE_APP
from nose.tools import assert_equals
from splinter.request_handler.request_handler import RequestHandler
class RequestHandlerTest(object):
def setUp(self):
self.request_handler = RequestHandler(EXAMPLE_APP)
def test_should_receive_an_url_and_get_an_200_response(self... | Test file for created package | Test file for created package
| Python | bsd-3-clause | bubenkoff/splinter,cobrateam/splinter,bmcculley/splinter,bmcculley/splinter,lrowe/splinter,gjvis/splinter,myself659/splinter,nikolas/splinter,nikolas/splinter,underdogio/splinter,myself659/splinter,drptbl/splinter,myself659/splinter,objarni/splinter,objarni/splinter,drptbl/splinter,bubenkoff/splinter,objarni/splinter,u... | ---
+++
@@ -0,0 +1,13 @@
+from fake_webapp import EXAMPLE_APP
+from nose.tools import assert_equals
+from splinter.request_handler.request_handler import RequestHandler
+
+class RequestHandlerTest(object):
+ def setUp(self):
+ self.request_handler = RequestHandler(EXAMPLE_APP)
+
+ def test_should_receive... | |
64b76d0ee7fa28d5338048a9eff7d62e3713e9ca | 2017/bfjit/plots/plot-runtime.py | 2017/bfjit/plots/plot-runtime.py | import numpy as np
import matplotlib.pyplot as plt
import seaborn
mandelbrot_runtime = (38.6, 18.4)
factor_runtime = (16.5, 6.7)
N = len(mandelbrot_runtime)
ind = np.arange(N) # the x locations for the groups
width = 0.25 # the width of the bars
fig, ax = plt.subplots()
rects1 = ax.bar(ind, mandelbrot_runtim... | Add a script to plot runtimes with matplotlib | Add a script to plot runtimes with matplotlib
| Python | unlicense | eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog | ---
+++
@@ -0,0 +1,31 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import seaborn
+
+mandelbrot_runtime = (38.6, 18.4)
+factor_runtime = (16.5, 6.7)
+
+N = len(mandelbrot_runtime)
+
+ind = np.arange(N) # the x locations for the groups
+width = 0.25 # the width of the bars
+
+fig, ax = plt.subplots(... | |
fcf7dce14ae430fd6710aa55d37523386ace6489 | CASA_functions/extract_from_ms.py | CASA_functions/extract_from_ms.py |
import numpy as np
from taskinit import mstool
def extract_ms_data(vis, columns, field="", **kwargs):
'''
Extract data points from an MS.
'''
myms = mstool()
myms.open(vis)
myms.selectinit(0)
selection_dict = dict(field=field)
selection_dict.update(kwargs)
assert myms.msselect(s... | Save data in an MS into a numpy file | Save data in an MS into a numpy file
| Python | mit | e-koch/VLA_Lband,e-koch/VLA_Lband | ---
+++
@@ -0,0 +1,27 @@
+
+import numpy as np
+from taskinit import mstool
+
+
+def extract_ms_data(vis, columns, field="", **kwargs):
+ '''
+ Extract data points from an MS.
+ '''
+
+ myms = mstool()
+
+ myms.open(vis)
+ myms.selectinit(0)
+ selection_dict = dict(field=field)
+ selection_dic... | |
894c05c24de3e4b1d47b97f42c39389fdb73d2ed | alembic/versions/542cdf68faa5_salt_passwords.py | alembic/versions/542cdf68faa5_salt_passwords.py | """Salt passwords
Revision ID: 542cdf68faa5
Revises: 26745016c3ce
Create Date: 2014-04-16 15:15:05.393213
"""
import string
import random
from hashlib import new as new_hash
# revision identifiers, used by Alembic.
revision = '542cdf68faa5'
down_revision = '26745016c3ce'
from alembic import op
import sqlalchemy as... | Add script for salting the existing passwords | Add script for salting the existing passwords
| Python | bsd-2-clause | go-lab/appcomposer,porduna/appcomposer,porduna/appcomposer,morelab/appcomposer,go-lab/appcomposer,morelab/appcomposer,morelab/appcomposer,porduna/appcomposer,morelab/appcomposer,go-lab/appcomposer,go-lab/appcomposer,porduna/appcomposer | ---
+++
@@ -0,0 +1,51 @@
+"""Salt passwords
+
+Revision ID: 542cdf68faa5
+Revises: 26745016c3ce
+Create Date: 2014-04-16 15:15:05.393213
+
+"""
+
+import string
+import random
+from hashlib import new as new_hash
+
+# revision identifiers, used by Alembic.
+revision = '542cdf68faa5'
+down_revision = '26745016c3ce'
+
... | |
9011e9e7e85804b532cb9e5ccbaa64425798c018 | anillo/utils/structures.py | anillo/utils/structures.py | import collections
class CaseInsensitiveDict(collections.MutableMapping):
"""
A case-insensitive ``dict``-like object.
Implements all methods and operations of
``collections.MutableMapping`` as well as dict's ``copy``. Also
provides ``lower_items``.
All keys are expected to be strings. The s... | Add case insensitive dict implementation into utils package. | Add case insensitive dict implementation into utils package.
| Python | bsd-2-clause | hirunatan/anillo,niwinz/anillo,hirunatan/anillo,jespino/anillo,niwinz/anillo,jespino/anillo | ---
+++
@@ -0,0 +1,76 @@
+import collections
+
+
+class CaseInsensitiveDict(collections.MutableMapping):
+ """
+ A case-insensitive ``dict``-like object.
+
+ Implements all methods and operations of
+ ``collections.MutableMapping`` as well as dict's ``copy``. Also
+ provides ``lower_items``.
+
+ All... | |
ebec193c624ef9db69d8ea260e13c41459f6fa57 | Week01/Problem05/cyu_05.py | Week01/Problem05/cyu_05.py | #!/usr/bin/env python3
"""This script is written by Chuanping Yu, on Jul 24, 2017,
for the Assignment#1 in IDEaS workshop"""
#Problem 5
from fractions import gcd
def lcm(int1, int2):
"""Calculate the least common multiple of two integers, a and b."""
return int(int1*int2/gcd(int1, int2))
from functools import... | Add Chuanping Yu's solutions to Problem05 | Add Chuanping Yu's solutions to Problem05 | Python | bsd-3-clause | GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017 | ---
+++
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+"""This script is written by Chuanping Yu, on Jul 24, 2017,
+for the Assignment#1 in IDEaS workshop"""
+
+#Problem 5
+from fractions import gcd
+def lcm(int1, int2):
+ """Calculate the least common multiple of two integers, a and b."""
+ return int(int1*int2/g... | |
9e218caa6c9c65e89079c3e0c2f3ff8834389832 | st2common/tests/unit/test_transport.py | st2common/tests/unit/test_transport.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Add tests for st2common.transport.utils._get_ssl_kwargs function. | Add tests for st2common.transport.utils._get_ssl_kwargs function.
| Python | apache-2.0 | nzlosh/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,Plexxi/st2,StackStorm/st2,StackStorm/st2,nzlosh/st2 | ---
+++
@@ -0,0 +1,80 @@
+# Licensed to the StackStorm, Inc ('StackStorm') under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (th... | |
ca0037e4e7d5983017c169a3d8ae0a5d7a31cddf | tests/tasks/thrift/test_multiplexed.py | tests/tasks/thrift/test_multiplexed.py | # Copyright (c) 2014, Facebook, Inc. All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
from __future__ import absolute_... | Add a test case to verify Multiplexed server/client functionality | Add a test case to verify Multiplexed server/client functionality
| Python | bsd-3-clause | facebook/sparts,djipko/sparts,fmoo/sparts,djipko/sparts,fmoo/sparts,facebook/sparts | ---
+++
@@ -0,0 +1,93 @@
+# Copyright (c) 2014, Facebook, Inc. All rights reserved.
+#
+# This source code is licensed under the BSD-style license found in the
+# LICENSE file in the root directory of this source tree. An additional grant
+# of patent rights can be found in the PATENTS file in the same directory.
+#... | |
31ccca324d87badba17d46d66868d86a6ca684e9 | Gui/find_files_with_no_license.py | Gui/find_files_with_no_license.py |
import os
for dirpath, dirnames, filenames in os.walk('./opensim'):
for fname in filenames:
if fname.endswith('.java'):
fpath = os.path.join(dirpath, fname)
filecontents = ""
with open(fpath, 'r') as f:
filecontents = f.read()
if ('LGPL' in fi... | Add python script for finding licenses. | Add python script for finding licenses.
| Python | apache-2.0 | opensim-org/opensim-gui,opensim-org/opensim-gui,opensim-org/opensim-gui,opensim-org/opensim-gui | ---
+++
@@ -0,0 +1,29 @@
+
+import os
+for dirpath, dirnames, filenames in os.walk('./opensim'):
+ for fname in filenames:
+ if fname.endswith('.java'):
+ fpath = os.path.join(dirpath, fname)
+ filecontents = ""
+ with open(fpath, 'r') as f:
+ filecontents = f... | |
cf02ad4621412fec5a1d6d999d7ec12a52683cf1 | custom/enikshay/management/commands/get_patients_for_bets.py | custom/enikshay/management/commands/get_patients_for_bets.py | import csv
from django.core.management.base import BaseCommand
from corehq.apps.locations.models import SQLLocation
from corehq.util.log import with_progress_bar
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from custom.enikshay.const import ENROLLED_IN_PRIVATE
from custom.enikshay.case_utils i... | Add skeleton of Patient dump command | Add skeleton of Patient dump command
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,36 @@
+import csv
+from django.core.management.base import BaseCommand
+from corehq.apps.locations.models import SQLLocation
+from corehq.util.log import with_progress_bar
+from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
+from custom.enikshay.const import ENROLLED_IN_PRIVATE
... | |
d66cdb7b1171abd96fa92c89535c3785df5d0a43 | packages/syft/src/syft/core/node/common/node_table/ledger.py | packages/syft/src/syft/core/node/common/node_table/ledger.py | # stdlib
from typing import Any
# third party
from sqlalchemy import Column
from sqlalchemy import LargeBinary
from sqlalchemy import String
from sqlalchemy import Float
# syft absolute
from syft import deserialize
from syft import serialize
# relative
from . import Base
class Ledger(Base):
__tablename__ = "le... | Create new database table: Ledger | Create new database table: Ledger
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | ---
+++
@@ -0,0 +1,43 @@
+# stdlib
+from typing import Any
+
+# third party
+from sqlalchemy import Column
+from sqlalchemy import LargeBinary
+from sqlalchemy import String
+from sqlalchemy import Float
+
+# syft absolute
+from syft import deserialize
+from syft import serialize
+
+# relative
+from . import Base
+
+... | |
5d3559fed567f14cf0efa09f7077154eb61ccee0 | glowing-lines2.py | glowing-lines2.py | from PIL import Image, ImageDraw
import random
W = 500
im = Image.new('RGB', (W, W))
NCOLORS = 19
NLINES = 15
def make_line_mask(im):
mask = Image.new('L', im.size, color=0)
grays = []
v = 255.0
for i in range(NCOLORS):
grays.append(int(v))
v *= 0.91
grays.reverse()
draw=ImageDraw.Draw(mask)
... | Add better glowing line script; uses alpha to create the line out of solid green; handles intersections well | Add better glowing line script; uses alpha to create the line out of solid green; handles intersections well
| Python | mit | redpig2/pilhacks | ---
+++
@@ -0,0 +1,50 @@
+from PIL import Image, ImageDraw
+
+import random
+
+W = 500
+im = Image.new('RGB', (W, W))
+NCOLORS = 19
+NLINES = 15
+
+def make_line_mask(im):
+ mask = Image.new('L', im.size, color=0)
+
+ grays = []
+ v = 255.0
+ for i in range(NCOLORS):
+ grays.append(int(v))
+ v *= 0.91
+ gr... | |
8ca7478ceb377374dd824a9e112b9a943b8d6e0c | firmware/test_serial.py | firmware/test_serial.py | from tamproxy import Sketch, Timer
class SerialConnect(Sketch):
def setup(self):
self.timer = Timer()
def loop(self):
if (self.timer.millis() > 5000):
self.stop()
if __name__ == "__main__":
sketch = SerialConnect()
sketch.run()
| Test whether or not the tablet is connected to the teensy. | Test whether or not the tablet is connected to the teensy.
| Python | mit | pravinas/et-maslab-2016 | ---
+++
@@ -0,0 +1,14 @@
+from tamproxy import Sketch, Timer
+
+class SerialConnect(Sketch):
+
+ def setup(self):
+ self.timer = Timer()
+
+ def loop(self):
+ if (self.timer.millis() > 5000):
+ self.stop()
+
+if __name__ == "__main__":
+ sketch = SerialConnect()
+ sketch.run() | |
e85190dc3d17f24678d04563dc0d402bb6b330a6 | conman/routes/migrations/0002_remove_slug_parent.py | conman/routes/migrations/0002_remove_slug_parent.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('routes', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='route',
name='url',
... | Add migration for slug and parent removal | Add migration for slug and parent removal
| Python | bsd-2-clause | meshy/django-conman,meshy/django-conman,Ian-Foote/django-conman | ---
+++
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('routes', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ mode... | |
2a939a567990b9fe8efce1430c5686fb008ffb4c | cineapp/slack.py | cineapp/slack.py | from slackclient import SlackClient
import json
class SlackChannel:
"""Class describing a slack channel on which one we can send some notifications """
def __init__(self,slack_token,channel_name):
self.channel_id = None
self.channel_name = None
self.slack_token = None
... | Add communication layer with Slack API | Add communication layer with Slack API
- New class SlackChannel : Allows to send message on a specific channel using
Slack Web API
- New method : Wraps SlackChannel objets and generates a Cineapp notification
which sends a notification containing the movie, the mark and the comment by
the logged user.
Related t... | Python | mit | ptitoliv/cineapp,ptitoliv/cineapp,ptitoliv/cineapp | ---
+++
@@ -0,0 +1,77 @@
+from slackclient import SlackClient
+import json
+
+class SlackChannel:
+
+ """Class describing a slack channel on which one we can send some notifications """
+
+ def __init__(self,slack_token,channel_name):
+
+ self.channel_id = None
+ self.channel_name = None... | |
f7c2d3891164ad365061a0df3c89bdced6a95b24 | flexget/plugins/search_btn.py | flexget/plugins/search_btn.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import validator
from flexget.entry import Entry
from flexget.plugin import register_plugin
from flexget.utils import requests, json
from flexget.utils.search import torrent_availability
session = requests.Session()
log = l... | Add preliminary btn search plugin | Add preliminary btn search plugin
| Python | mit | Pretagonist/Flexget,ZefQ/Flexget,asm0dey/Flexget,qk4l/Flexget,Danfocus/Flexget,jawilson/Flexget,tobinjt/Flexget,ibrahimkarahan/Flexget,tarzasai/Flexget,tvcsantos/Flexget,qk4l/Flexget,ZefQ/Flexget,patsissons/Flexget,ianstalk/Flexget,offbyone/Flexget,patsissons/Flexget,antivirtel/Flexget,sean797/Flexget,ratoaq2/Flexget,t... | ---
+++
@@ -0,0 +1,58 @@
+from __future__ import unicode_literals, division, absolute_import
+import logging
+
+from flexget import validator
+from flexget.entry import Entry
+from flexget.plugin import register_plugin
+from flexget.utils import requests, json
+from flexget.utils.search import torrent_availability
+
... | |
3a05589a6b423ed27dd4c3a10fdc0f7cc2cd8387 | usr/examples/09-Feature-Detection/lines.py | usr/examples/09-Feature-Detection/lines.py | # Hough Transform Example:
#
# This example demonstrates using the Hough transform to find lines in an image.
import sensor, image, time
kernel_size = 1 # kernel width = (size*2)+1, kernel height = (size*2)+1
kernel = [-1, -1, -1,\
-1, +8, -1,\
-1, -1, -1]
# This is a high pass filter ke... | Add Hough Transform example script. | Add Hough Transform example script.
| Python | mit | kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,kwagyeman/openmv,kwagyeman/openmv,iabdalkader/openmv,iabdalkader/openmv,openmv/openmv,iabdalkader/openmv,openmv/openmv,iabdalkader/openmv,openmv/openmv | ---
+++
@@ -0,0 +1,49 @@
+# Hough Transform Example:
+#
+# This example demonstrates using the Hough transform to find lines in an image.
+import sensor, image, time
+
+kernel_size = 1 # kernel width = (size*2)+1, kernel height = (size*2)+1
+kernel = [-1, -1, -1,\
+ -1, +8, -1,\
+ -1, -1, -1]
+ ... | |
8986051aa3dd292af60fe652a639e63092337d4b | scripts/start_baxter.py | scripts/start_baxter.py | #!/usr/bin/python
from baxter_myo.ArmController import ArmController
def main():
s = ArmController()
s.loop()
if __name__ == "__main__":
main()
| Create starting scripts for the baxter | Create starting scripts for the baxter
| Python | mit | ipab-rad/myo_baxter_pc,ipab-rad/myo_baxter_pc,ipab-rad/baxter_myo,ipab-rad/baxter_myo | ---
+++
@@ -0,0 +1,11 @@
+#!/usr/bin/python
+
+from baxter_myo.ArmController import ArmController
+
+
+def main():
+ s = ArmController()
+ s.loop()
+
+if __name__ == "__main__":
+ main() | |
255f2e95954682f20c9ab2383d769ff1a656cbdd | CodeFights/differentSquares.py | CodeFights/differentSquares.py | #!/usr/local/bin/python
# Code Fights Different D Problem
def differentSquares(matrix):
rows, cols = len(matrix), len(matrix[0])
if rows < 2 or cols < 2:
return 0
s = [[matrix[r + i][c + j] for i in [0, 1] for j in [0, 1]] for r in
range(rows - 1) for c in range(cols - 1)]
return len(... | Solve Code Fights different squares problem | Solve Code Fights different squares problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/local/bin/python
+# Code Fights Different D Problem
+
+
+def differentSquares(matrix):
+ rows, cols = len(matrix), len(matrix[0])
+ if rows < 2 or cols < 2:
+ return 0
+ s = [[matrix[r + i][c + j] for i in [0, 1] for j in [0, 1]] for r in
+ range(rows - 1) for ... | |
56cccfa2b7a351f38edee805406085caeee65707 | src/icp/apps/modeling/migrations/0021_clear_old_results.py | src/icp/apps/modeling/migrations/0021_clear_old_results.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def clear_old_results(apps, schema_editor):
Scenario = apps.get_model('modeling', 'Scenario')
Scenario.objects.all().update(
results='[]',
modification_hash='',
inputmod_hash='',
)
... | Clear old Pollination Mapper results | Clear old Pollination Mapper results
Since we upgraded to the 2017 CDL in #410 and 598ed284,
the current stored results in the database are out of date.
By clearing them out, we ensure they will be recalculated
when those scenarios are revisited.
| Python | apache-2.0 | project-icp/bee-pollinator-app,project-icp/bee-pollinator-app,project-icp/bee-pollinator-app,project-icp/bee-pollinator-app | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def clear_old_results(apps, schema_editor):
+ Scenario = apps.get_model('modeling', 'Scenario')
+
+ Scenario.objects.all().update(
+ results='[]',
+ modification_hash... | |
db9c1affcfda4122b3ebc708581900048af59424 | django_project/realtime/management/commands/rerunlasthazard.py | django_project/realtime/management/commands/rerunlasthazard.py | # coding=utf-8
import logging
from django.core.management.base import BaseCommand
from realtime.models.ash import Ash
from realtime.models.earthquake import Earthquake
from realtime.models.flood import Flood
__author__ = 'Rizky Maulana Nugraha "lucernae" <lana.pcfre@gmail.com>'
LOGGER = logging.getLogger(__name__)... | Add management command to rerun last analysis for testing | Add management command to rerun last analysis for testing
| Python | bsd-2-clause | AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django | ---
+++
@@ -0,0 +1,62 @@
+# coding=utf-8
+import logging
+
+from django.core.management.base import BaseCommand
+
+from realtime.models.ash import Ash
+from realtime.models.earthquake import Earthquake
+from realtime.models.flood import Flood
+
+__author__ = 'Rizky Maulana Nugraha "lucernae" <lana.pcfre@gmail.com>'
+... | |
9cb93b712c931754c81ec9c89d61d85bf986c6ed | tests/bouncer/app_test.py | tests/bouncer/app_test.py | from unittest import mock
import pytest
from pyramid.config import Configurator
from bouncer.app import app
def test_the_default_settings(config, pyramid):
app()
pyramid.config.Configurator.assert_called_once_with(
settings={
"chrome_extension_id": "bjfhmglciegochdpefhhlphglcehbmek",
... | Add the beginnings of app.py tests | Add the beginnings of app.py tests
This doesn't test everything in app.py but it's a start.
| Python | bsd-2-clause | hypothesis/bouncer,hypothesis/bouncer,hypothesis/bouncer | ---
+++
@@ -0,0 +1,42 @@
+from unittest import mock
+
+import pytest
+from pyramid.config import Configurator
+
+from bouncer.app import app
+
+
+def test_the_default_settings(config, pyramid):
+ app()
+
+ pyramid.config.Configurator.assert_called_once_with(
+ settings={
+ "chrome_extension_id... | |
b490ca24c7f9a3f2f0a645be75b0f70d6fd15471 | openfisca_france/scripts/parameters/reduce_parameters_paths.py | openfisca_france/scripts/parameters/reduce_parameters_paths.py | # -*- coding: utf-8 -*-
import os
PARENT_DIRECTORY = os.path.realpath('../..')
PATH_LENGTH_TO_IGNORE = len(PARENT_DIRECTORY)
PARAMETERS_DIRECTORY = os.path.join(PARENT_DIRECTORY, 'parameters')
PATH_MAX_LENGTH = 150
CLEANED_PARAMETERS_DIRECTORY = os.path.join(PARENT_DIRECTORY, 'new_parameters')
def list_long_paths... | Add script detection of long parameters files' paths | Add script detection of long parameters files' paths | Python | agpl-3.0 | sgmap/openfisca-france,antoinearnoud/openfisca-france,antoinearnoud/openfisca-france,sgmap/openfisca-france | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+
+import os
+
+PARENT_DIRECTORY = os.path.realpath('../..')
+PATH_LENGTH_TO_IGNORE = len(PARENT_DIRECTORY)
+
+PARAMETERS_DIRECTORY = os.path.join(PARENT_DIRECTORY, 'parameters')
+PATH_MAX_LENGTH = 150
+
+CLEANED_PARAMETERS_DIRECTORY = os.path.join(PARENT_DIRECTORY, '... | |
b382a6568131dfec818a284fbb805df6efc2748d | examples/network_wordcount.py | examples/network_wordcount.py | #! /usr/env python
""" a recreation of spark-streaming's network_wordcount
https://spark.apache.org/docs/2.2.0/streaming-programming-guide.html#a-quick-example
Run this within an interactive session, or with
> python -i -network_wordcount.py
so that python won't exit before producing output.
"""
from streamz import ... | Add wordcount example from spark | Add wordcount example from spark
| Python | bsd-3-clause | mrocklin/streams | ---
+++
@@ -0,0 +1,24 @@
+#! /usr/env python
+""" a recreation of spark-streaming's network_wordcount
+
+https://spark.apache.org/docs/2.2.0/streaming-programming-guide.html#a-quick-example
+
+Run this within an interactive session, or with
+> python -i -network_wordcount.py
+so that python won't exit before producin... | |
974c52a13df6c9c53ea46140a7496d7c774d277e | osf/migrations/0144_add_preprint_contenttype_to_collections.py | osf/migrations/0144_add_preprint_contenttype_to_collections.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-08 16:56
from __future__ import unicode_literals
from django.db import migrations
from osf.models import Collection
from django.contrib.contenttypes.models import ContentType
def reverse_func(state, schema):
preprint_content_type = ContentType.obje... | Add data migration so preprints can be added to existing collections. | Add data migration so preprints can be added to existing collections.
| Python | apache-2.0 | mfraezz/osf.io,baylee-d/osf.io,cslzchen/osf.io,saradbowman/osf.io,aaxelb/osf.io,saradbowman/osf.io,mattclark/osf.io,Johnetordoff/osf.io,brianjgeiger/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,felliott/osf.io,cslzchen/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,mattclark/osf.io,pattisdr/osf.io,C... | ---
+++
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.15 on 2018-11-08 16:56
+from __future__ import unicode_literals
+
+from django.db import migrations
+from osf.models import Collection
+from django.contrib.contenttypes.models import ContentType
+
+
+def reverse_func(state, schema):
+ pr... | |
74e1dad9a639233be379574e6abebf02dff323ef | tests/test_approxest.py | tests/test_approxest.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | Add test for approximate estimator of dependence probability by MI. | Add test for approximate estimator of dependence probability by MI.
| Python | apache-2.0 | probcomp/bayeslite,probcomp/bayeslite | ---
+++
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
+#
+# 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
+#
+# h... | |
a4d3ace2079fd5c6da707525864d865cc52e777c | ynr/apps/utils/db.py | ynr/apps/utils/db.py | from django.db.models import Transform
class LastWord(Transform):
"""
Split a field on space and get the last element
"""
function = "LastWord"
template = """
(regexp_split_to_array(%(field)s, ' '))[
array_upper(regexp_split_to_array(%(field)s, ' '), 1)
]
"""
def __init__(s... | Add LastWord DB tranformation until | Add LastWord DB tranformation until
This is useful when used as an annotation, for example:
`qs.annotate(last_name=LastWord('full_name')).order_by('last_name')`
| Python | agpl-3.0 | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ---
+++
@@ -0,0 +1,20 @@
+from django.db.models import Transform
+
+
+class LastWord(Transform):
+ """
+ Split a field on space and get the last element
+ """
+
+ function = "LastWord"
+ template = """
+ (regexp_split_to_array(%(field)s, ' '))[
+ array_upper(regexp_split_to_array(%(field)s, ' '... | |
58fff9a7b0abd525f495b44c86521b8240ed3276 | instruments/bbn.py | instruments/bbn.py | from .instrument import Instrument, VisaInterface
from types import MethodType
class Attenuator(Instrument):
NUM_CHANNELS = 3
"""BBN 3 Channel Instrument"""
def __init__(self, name, resource_name):
super(Attenuator, self).__init__(name, resource_name, interface_type="VISA")
self.name = nam... | Add BBN digital attenuator driver | Add BBN digital attenuator driver
--CAR and GER
| Python | apache-2.0 | BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex | ---
+++
@@ -0,0 +1,34 @@
+from .instrument import Instrument, VisaInterface
+from types import MethodType
+
+class Attenuator(Instrument):
+ NUM_CHANNELS = 3
+
+ """BBN 3 Channel Instrument"""
+ def __init__(self, name, resource_name):
+ super(Attenuator, self).__init__(name, resource_name, interface_... | |
727cea8fd531b680625a5dba4928a6658b74545f | olympiad/name.py | olympiad/name.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 Fabian M.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | Add solution for problem A3 | Add solution for problem A3
| Python | apache-2.0 | fabianm/olympiad,fabianm/olympiad,fabianm/olympiad | ---
+++
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright 2014 Fabian M.
+#
+# 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/lic... | |
c0f0f685adc66f772921618d37474002634974a7 | locations/spiders/ey.py | locations/spiders/ey.py | # -*- coding: utf-8 -*-
import json
import re
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class EySpider(scrapy.Spider):
name = "ey"
allowed_domains = []
start_urls = [
'https://www.ey.com/eydff/services/officeLocations.json',
]
de... | Add spider for Ernst & Young | Add spider for Ernst & Young
| Python | mit | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | ---
+++
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+import json
+import re
+
+import scrapy
+
+from locations.items import GeojsonPointItem
+from locations.hours import OpeningHours
+
+
+class EySpider(scrapy.Spider):
+ name = "ey"
+ allowed_domains = []
+ start_urls = [
+ 'https://www.ey.com/eydff/ser... | |
4dcc520d0b1c14980e56d732f25523c2bca795da | altair/examples/scatter_with_minimap.py | altair/examples/scatter_with_minimap.py | """
Scatter Plot with Minimap
-------------------------
This example shows how to create a miniature version of a plot
such that creating a selection in the miniature version
adjusts the axis limits in another, more detailed view.
"""
# category: scatter plots
import altair as alt
from vega_datasets import data
sourc... | Add an example showing how to create a minimap | Add an example showing how to create a minimap
Discussed here: https://github.com/altair-viz/altair/issues/2037
| Python | bsd-3-clause | altair-viz/altair,jakevdp/altair | ---
+++
@@ -0,0 +1,49 @@
+"""
+Scatter Plot with Minimap
+-------------------------
+This example shows how to create a miniature version of a plot
+such that creating a selection in the miniature version
+adjusts the axis limits in another, more detailed view.
+"""
+# category: scatter plots
+
+import altair as alt
... | |
d4ebf0d1792be8b74a5c51d4275c7ee6fbc3d7d2 | pvs_si.py | pvs_si.py | #!/usr/bin/env python3
import sirius
record_names = sirius.si.record_names.get_record_names()
pvs_list = list(record_names.keys())
pvs_string = ' '.join(pvs_list)
print(pvs_string)
| Add python script that returns string with PVs | Add python script that returns string with PVs
| Python | mit | lnls-fac/scripts,lnls-fac/scripts | ---
+++
@@ -0,0 +1,8 @@
+#!/usr/bin/env python3
+
+import sirius
+
+record_names = sirius.si.record_names.get_record_names()
+pvs_list = list(record_names.keys())
+pvs_string = ' '.join(pvs_list)
+print(pvs_string) | |
44d820daf3a56284f3204f4e1d586ddd5938a29f | bin/physicsforum_scraper.py | bin/physicsforum_scraper.py | #!/usr/bin/env python
import argparse
import os
import os.path
from bs4 import BeautifulSoup
import requests
def post_filter(tag):
if tag.name != 'blockquote':
return False
if not tag.has_attr('class'):
return False
return isinstance(tag['class'], list) and 'messageText' in tag['class']
... | Write scraper script for Physicsforum forum | Write scraper script for Physicsforum forum
| Python | mit | kemskems/otdet | ---
+++
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+import argparse
+import os
+import os.path
+
+from bs4 import BeautifulSoup
+import requests
+
+
+def post_filter(tag):
+ if tag.name != 'blockquote':
+ return False
+ if not tag.has_attr('class'):
+ return False
+ return isinstance(tag['class'... | |
c571601a2970c9c06b8274f5ad6d1b9b9405569c | confluent_server/confluent/forwarder.py | confluent_server/confluent/forwarder.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2017 Lenovo
#
# 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 ... | Add utility library to do port forwarding | Add utility library to do port forwarding
This will be useful for creating forwarding for
users.
| Python | apache-2.0 | jjohnson42/confluent,xcat2/confluent,xcat2/confluent,jjohnson42/confluent,whowutwut/confluent,whowutwut/confluent,whowutwut/confluent,whowutwut/confluent,xcat2/confluent,jjohnson42/confluent,xcat2/confluent,xcat2/confluent,jjohnson42/confluent,jjohnson42/confluent | ---
+++
@@ -0,0 +1,78 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2017 Lenovo
+#
+# 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... | |
cd78318ccb3f54d01dc936eef82ce4757f5fc706 | ichnaea/tests/test_util.py | ichnaea/tests/test_util.py | from unittest import TestCase
from ichnaea.util import _is_true
class TestUtils(TestCase):
def test_is_true(self):
self.assertTrue(_is_true('1'))
self.assertTrue(_is_true('true'))
self.assertTrue(_is_true('True'))
self.assertTrue(_is_true(True))
self.assertFalse(_is_true(F... | Add a test for the util module. | Add a test for the util module.
| Python | apache-2.0 | mozilla/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea | ---
+++
@@ -0,0 +1,13 @@
+from unittest import TestCase
+from ichnaea.util import _is_true
+
+
+class TestUtils(TestCase):
+
+ def test_is_true(self):
+ self.assertTrue(_is_true('1'))
+ self.assertTrue(_is_true('true'))
+ self.assertTrue(_is_true('True'))
+ self.assertTrue(_is_true(True... | |
0385ec6f12124ca6e76d35f0c94b67a4fb9edbdd | initial-embryo-segmentation.py | initial-embryo-segmentation.py | # IPython log file
droso = io.imread('/Users/jni/Dropbox/data1/drosophila-embryo/E_z2_512_1um_CONTROL.tif') / 4096
sys.path.append('/Users/jni/projects/mpl-volume-viewer/')
import slice_view as sv
nuclei = droso[..., 0]
nuclei_smooth = filters.gaussian(nuclei, sigma=[0.6, 3, 3])
centroids = feature.peak_local_max(nuc... | Add embryo segmentation basic analysis | Add embryo segmentation basic analysis
| Python | bsd-3-clause | jni/useful-histories | ---
+++
@@ -0,0 +1,16 @@
+# IPython log file
+
+
+droso = io.imread('/Users/jni/Dropbox/data1/drosophila-embryo/E_z2_512_1um_CONTROL.tif') / 4096
+sys.path.append('/Users/jni/projects/mpl-volume-viewer/')
+import slice_view as sv
+nuclei = droso[..., 0]
+nuclei_smooth = filters.gaussian(nuclei, sigma=[0.6, 3, 3])
+ce... | |
1c7a308b77f81f965a69ceead00b096375cca271 | lava_server/bread_crumbs.py | lava_server/bread_crumbs.py | # Copyright (C) 2010, 2011 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
# This file is part of LAVA Server.
#
# LAVA Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software F... | Add bread crumb helpers from lava-dashboard | Add bread crumb helpers from lava-dashboard
| Python | agpl-3.0 | OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server | ---
+++
@@ -0,0 +1,90 @@
+# Copyright (C) 2010, 2011 Linaro Limited
+#
+# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
+#
+# This file is part of LAVA Server.
+#
+# LAVA Server is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License version 3
+#... | |
9214c09de7d4f9420e77098d2ace87db3191d480 | apps/challenge/management/commands/find_challengeset_home.py | apps/challenge/management/commands/find_challengeset_home.py | from optparse import make_option
import sys
from django.core.management.base import BaseCommand
from challenge.models import Challenge, ChallengeSet
class Command(BaseCommand):
args = ""
help = "Update concept total_question counts (post db import)"
def handle(self, *args, **options):
for chal... | Add management function for challengeset migration | Add management function for challengeset migration
| Python | bsd-3-clause | mfitzp/smrtr,mfitzp/smrtr | ---
+++
@@ -0,0 +1,19 @@
+from optparse import make_option
+import sys
+from django.core.management.base import BaseCommand
+from challenge.models import Challenge, ChallengeSet
+
+class Command(BaseCommand):
+ args = ""
+ help = "Update concept total_question counts (post db import)"
+
+ def handle(self... | |
a69004d4db2038fe24ee629f43327a9a3b5ad6e4 | vtk_simple.py | vtk_simple.py | import vtk
def setup():
# create a rendering window and renderer
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# create a renderwindowinteractor
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
return ren,renWin,iren
def create... | Add simple VTK example (to be put inside an event driver) | Add simple VTK example (to be put inside an event driver)
| Python | mit | martindurant/misc | ---
+++
@@ -0,0 +1,34 @@
+import vtk
+
+def setup():
+ # create a rendering window and renderer
+ ren = vtk.vtkRenderer()
+ renWin = vtk.vtkRenderWindow()
+ renWin.AddRenderer(ren)
+
+ # create a renderwindowinteractor
+ iren = vtk.vtkRenderWindowInteractor()
+ iren.SetRenderWindow(renWin)
... | |
bfe111a760aa88046c0f3d0b70daf7c2f1e88b35 | third_party/__init__.py | third_party/__init__.py | import os
import sys
try:
__file__
except NameError:
__file__ = sys.argv[0]
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
| Allow third_party modules to be imported at the top-level. | Allow third_party modules to be imported at the top-level.
import third_party
import dns
git-svn-id: abd770af2affaf62930f25b244f6edafe8ddae5b@11 164481a5-15cb-f69f-4b93-856c5b7754c5
| Python | apache-2.0 | bpsinc-native/src_third_party_webpagereplay,andrey-malets/web-page-replay,chromium/web-page-replay,snorp/web-page-replay,snorp/web-page-replay,colin-scott/web-page-replay,chromium/web-page-replay,bpsinc-native/src_third_party_webpagereplay,colin-scott/web-page-replay,bpsinc-native/src_third_party_webpagereplay,andrey-m... | ---
+++
@@ -0,0 +1,8 @@
+import os
+import sys
+
+try:
+ __file__
+except NameError:
+ __file__ = sys.argv[0]
+sys.path.append(os.path.dirname(os.path.abspath(__file__))) | |
c4ed17ff345ee59f284a2f6d1ec18034eeb311a9 | tests/cpydiff/module_array_constructor.py | tests/cpydiff/module_array_constructor.py | """
categories: Modules,array
description: Overflow checking is not implemented
cause: MicroPython implements implicit truncation in order to reduce code size and execution time
workaround: If CPython compatibility is needed then mask the value explicitly
"""
import array
a = array.array("b", [257])
print(a)
| Add test for array constructor with overflowing value. | tests/cpydiff: Add test for array constructor with overflowing value.
| Python | mit | bvernoux/micropython,bvernoux/micropython,bvernoux/micropython,bvernoux/micropython,adafruit/circuitpython,adafruit/circuitpython,adafruit/circuitpython,adafruit/circuitpython,adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython | ---
+++
@@ -0,0 +1,10 @@
+"""
+categories: Modules,array
+description: Overflow checking is not implemented
+cause: MicroPython implements implicit truncation in order to reduce code size and execution time
+workaround: If CPython compatibility is needed then mask the value explicitly
+"""
+import array
+
+a = array.... | |
1f06a9e66ebc74a171d4cde7a15f40454f4f2199 | calvin/actorstore/systemactors/data/Sink.py | calvin/actorstore/systemactors/data/Sink.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018 Ericsson AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | Add generic data sink actor | Actors: Add generic data sink actor
| Python | apache-2.0 | EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2018 Ericsson AB
+#
+# 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.... | |
035fa5877a05bb70b8207693c547c97cfd104db3 | libqtile/widget/textbox.py | libqtile/widget/textbox.py | from .. import bar, manager
import base
class TextBox(base._TextBox):
"""
A flexible textbox that can be updated from bound keys, scripts and
qsh.
"""
defaults = manager.Defaults(
("font", "Arial", "Text font"),
("fontsize", None, "Font pixel size. Calculated if None."),
... | from .. import bar, manager
import base
class TextBox(base._TextBox):
"""
A flexible textbox that can be updated from bound keys, scripts and
qsh.
"""
defaults = manager.Defaults(
("font", "Arial", "Text font"),
("fontsize", None, "Font pixel size. Calculated if None."),
... | Remove positional argument "name" from Textbox | Remove positional argument "name" from Textbox
Users should just use the kwarg name; no sense in having both.
Closes #239
| Python | mit | andrewyoung1991/qtile,StephenBarnes/qtile,de-vri-es/qtile,tych0/qtile,apinsard/qtile,nxnfufunezn/qtile,soulchainer/qtile,encukou/qtile,ramnes/qtile,jdowner/qtile,jdowner/qtile,soulchainer/qtile,de-vri-es/qtile,kopchik/qtile,tych0/qtile,qtile/qtile,kiniou/qtile,kynikos/qtile,kiniou/qtile,EndPointCorp/qtile,himaaaatti/qt... | ---
+++
@@ -17,14 +17,11 @@
("foreground", "#ffffff", "Foreground colour.")
)
- def __init__(self, name, text=" ", width=bar.CALCULATED, **config):
+ def __init__(self, text=" ", width=bar.CALCULATED, **config):
"""
- - name: Name for this widget. Used to address the widget f... |
91ba03f978d61063c93da381c253992759ba26ad | portal/migrations/versions/d0b40bc8d7e6_.py | portal/migrations/versions/d0b40bc8d7e6_.py | from alembic import op
import sqlalchemy as sa
"""empty message
Revision ID: d0b40bc8d7e6
Revises: 8ffec90e68a7
Create Date: 2017-09-20 05:59:45.168324
"""
# revision identifiers, used by Alembic.
revision = 'd0b40bc8d7e6'
down_revision = '8ffec90e68a7'
def upgrade():
# Work around site_persistence fragility... | Work around site_persistence fragility. Replace a couple names as delete and recreate on these fails due to FK constraints | Work around site_persistence fragility. Replace a couple names
as delete and recreate on these fails due to FK constraints
| Python | bsd-3-clause | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | ---
+++
@@ -0,0 +1,30 @@
+from alembic import op
+import sqlalchemy as sa
+
+
+"""empty message
+
+Revision ID: d0b40bc8d7e6
+Revises: 8ffec90e68a7
+Create Date: 2017-09-20 05:59:45.168324
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'd0b40bc8d7e6'
+down_revision = '8ffec90e68a7'
+
+
+def upgrade():... | |
ebebbd7a066863bc9ed19672e2a302920102254d | modules/msm_backup_restore/files/bin/msm-update-auth-lists.py | modules/msm_backup_restore/files/bin/msm-update-auth-lists.py | #!/usr/bin/env python
import os
import re
import requests
import sys
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
# Convert from Heroku style DATABASE_URL to Sqlalchemy style, if necessary
db_url = os.environ.get('DATABASE_URL')... | Write 'white-list.txt' and 'ops.txt' auth files. | Write 'white-list.txt' and 'ops.txt' auth files.
* Add msm-update-auth-lists.py.
* Django admins (is_superuser) are Minecraft ops.
* Django users (is_active) are white-listed players.
| Python | mit | toffer/minecloud-ami,toffer/minecloud-ami | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+import os
+import re
+import requests
+import sys
+
+from sqlalchemy import create_engine
+from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.orm import sessionmaker
+
+# Convert from Heroku style DATABASE_URL to Sqlalchemy style, if necessary
... | |
d22d3aebf818632de832adfba684e44603623e5b | raiden/network/transport/matrix/__init__.py | raiden/network/transport/matrix/__init__.py | from raiden.network.transport.matrix.transport import ( # noqa
MatrixTransport,
UserPresence,
_RetryQueue,
)
from raiden.network.transport.matrix.utils import ( # noqa
join_global_room,
login_or_register,
validate_userid_signature,
)
| Move matrix transport to own module, pull in raiden_libs matrix classes | Move matrix transport to own module, pull in raiden_libs matrix classes
| Python | mit | hackaugusto/raiden,hackaugusto/raiden | ---
+++
@@ -0,0 +1,10 @@
+from raiden.network.transport.matrix.transport import ( # noqa
+ MatrixTransport,
+ UserPresence,
+ _RetryQueue,
+)
+from raiden.network.transport.matrix.utils import ( # noqa
+ join_global_room,
+ login_or_register,
+ validate_userid_signature,
+) | |
e73f621792db820a4d96ef63e53f63aa223133e8 | modules/tests/test_twitter.py | modules/tests/test_twitter.py | import modules
import pytest
def test_twitter():
assert('twitter' == modules.process_query('twitter')[0])
assert('twitter' == modules.process_query('twitter hotnews')[0])
assert('twitter' == modules.process_query('paris twitter')[0])
assert('twitter' != modules.process_query('something random')[0])
... | Add tests for twitter module | Add tests for twitter module
| Python | mit | ZuZuD/JARVIS-on-Messenger | ---
+++
@@ -0,0 +1,31 @@
+import modules
+import pytest
+
+def test_twitter():
+ assert('twitter' == modules.process_query('twitter')[0])
+ assert('twitter' == modules.process_query('twitter hotnews')[0])
+ assert('twitter' == modules.process_query('paris twitter')[0])
+ assert('twitter' != modules.proces... | |
dde66a8f4a03400fbf292c1ddf03cf7c63e517b3 | Clean_Energy_Outlook/Ridge_pred_nuclear.py | Clean_Energy_Outlook/Ridge_pred_nuclear.py | # import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model
from sklearn.model_selection import train_test_split
# define the function to predict nuclear data in the future
def pred_nuclear(samplefile, filelist):
# read data
data = pd.read_csv(samplefi... | Add ridge prediction code for nuclear | Add ridge prediction code for nuclear
| Python | mit | uwkejia/Clean-Energy-Outlook | ---
+++
@@ -0,0 +1,47 @@
+# import libraries
+import numpy as np
+import pandas as pd
+import matplotlib.pyplot as plt
+from sklearn import linear_model
+from sklearn.model_selection import train_test_split
+
+# define the function to predict nuclear data in the future
+def pred_nuclear(samplefile, filelist):
+ # re... | |
eb6b595c854192c085f635a5e489210a29dc335a | bin/data/gigaword_summarization.py | bin/data/gigaword_summarization.py | #! /usr/bin/env python
"""Processes the Gigaword Corpus (https://catalog.ldc.upenn.edu/LDC2011T07).
Generates source and target files where sources correspond to the first N
sentences of each article, and targets corresponds to article headlines.
Usage:
bin/data/gigaword_summary < GIGAWORD \
-f gigaword_data
-o ... | Add Gigaword summarization preprocessing script | Add Gigaword summarization preprocessing script
| Python | apache-2.0 | google/seq2seq,shashankrajput/seq2seq,liyi193328/seq2seq,liyi193328/seq2seq,kontact-chan/seq2seq,google/seq2seq,shashankrajput/seq2seq,shashankrajput/seq2seq,shashankrajput/seq2seq,chunfengh/seq2seq,chunfengh/seq2seq,liyi193328/seq2seq,kontact-chan/seq2seq,chunfengh/seq2seq,liyi193328/seq2seq,google/seq2seq,kontact-cha... | ---
+++
@@ -0,0 +1,78 @@
+#! /usr/bin/env python
+
+"""Processes the Gigaword Corpus (https://catalog.ldc.upenn.edu/LDC2011T07).
+Generates source and target files where sources correspond to the first N
+sentences of each article, and targets corresponds to article headlines.
+
+Usage:
+
+bin/data/gigaword_summary <... | |
33d0129be8c82b9d3a114591a6055d972a342a7a | test/functionalities/abbreviation/TestCommonShortSpellings.py | test/functionalities/abbreviation/TestCommonShortSpellings.py | """
Test some lldb command abbreviations to make sure the common short spellings of
many commands remain available even after we add/delte commands in the future.
"""
import os, time
import unittest2
import lldb
from lldbtest import *
class CommonShortSpellingsTestCase(TestBase):
mydir = os.path.join("functi... | Test some lldb command abbreviations to make sure the common short spellings of many commands remain available even after we add/delte commands in the future. | Test some lldb command abbreviations to make sure the common short spellings of
many commands remain available even after we add/delte commands in the future.
git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@142857 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb | ---
+++
@@ -0,0 +1,63 @@
+"""
+Test some lldb command abbreviations to make sure the common short spellings of
+many commands remain available even after we add/delte commands in the future.
+"""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+
+class CommonShortSpellingsTestCase(TestBase):... | |
bb7a78662545312660dbddff806d58db8a393bf8 | tools/ipython.py | tools/ipython.py | #!/usr/bin/env python
# encoding: utf-8
from __future__ import division, print_function
from time import sleep
import progressbar as pb
from IPython.utils.io import rprint
def wait_interactive(job):
"""Same as IPython.parallel.client.view.LoadBalancedView.wait_interactive
but prints a Progressbar to both, ... | Implement progress bar for parallel jobs | Implement progress bar for parallel jobs
| Python | unlicense | dseuss/pythonlibs | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from __future__ import division, print_function
+
+from time import sleep
+
+import progressbar as pb
+from IPython.utils.io import rprint
+
+
+def wait_interactive(job):
+ """Same as IPython.parallel.client.view.LoadBalancedView.wait_interactiv... | |
36f81bbe28a9bf018aded659cbe2d59e200a25ca | nipap-cli/tests/cli-test.py | nipap-cli/tests/cli-test.py | #!/usr/bin/python
import unittest
import sys
sys.path.append('../')
from nipap_cli import nipap_cli
from nipap_cli.command import Command
class CliCheck(unittest.TestCase):
def cli_test(self, command):
"""
"""
cmd = Command(nipap_cli.cmds, command)
comp = cmd.complete()
r... | Add a very basic unittest for the CLI lib | Add a very basic unittest for the CLI lib
| Python | mit | fredsod/NIPAP,garberg/NIPAP,bbaja42/NIPAP,SoundGoof/NIPAP,SoundGoof/NIPAP,plajjan/NIPAP,garberg/NIPAP,plajjan/NIPAP,bbaja42/NIPAP,SoundGoof/NIPAP,garberg/NIPAP,plajjan/NIPAP,plajjan/NIPAP,garberg/NIPAP,SpriteLink/NIPAP,bbaja42/NIPAP,ettrig/NIPAP,fredsod/NIPAP,bbaja42/NIPAP,garberg/NIPAP,SoundGoof/NIPAP,SpriteLink/NIPAP... | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+
+import unittest
+
+import sys
+sys.path.append('../')
+from nipap_cli import nipap_cli
+from nipap_cli.command import Command
+
+class CliCheck(unittest.TestCase):
+ def cli_test(self, command):
+ """
+ """
+ cmd = Command(nipap_cli.cmds, command)... | |
6f882f92ad99376ddf147d9637d298601e4d1abf | Sketches/MPS/VideoRecorder/SimpleDiracPlayer.py | Sketches/MPS/VideoRecorder/SimpleDiracPlayer.py | #!/usr/bin/python
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.Codec.Dirac import DiracDecoder
from Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor
from Kamaelia.Util.RateFilter import MessageRateLimit
from Kamaelia.UI.Pygame.VideoOverlay import VideoOverlay
import sys
if len(sys.argv) != 2:
... | Copy of the player for convenience of testing | Copy of the player for convenience of testing | Python | apache-2.0 | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | ---
+++
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+from Kamaelia.Chassis.Pipeline import Pipeline
+from Kamaelia.Codec.Dirac import DiracDecoder
+from Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor
+from Kamaelia.Util.RateFilter import MessageRateLimit
+from Kamaelia.UI.Pygame.VideoOverlay import VideoOverlay
+
+im... | |
4cd4db39976ae0695a202951b9db75cfc6b9b6b5 | openquake/commands/webui.py | openquake/commands/webui.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2016, GEM Foundation
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | Add a command to start the WebUI using oq | Add a command to start the WebUI using oq
The django development server is started in foreground
on localhost:8800. Meant to be used with multi_user = false
but works also if true.
Former-commit-id: 5df6e6b3ec523376906abeb8a52eb6c5dc5d46ec [formerly 5df6e6b3ec523376906abeb8a52eb6c5dc5d46ec [formerly bbfc5549fb632d53... | Python | agpl-3.0 | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | ---
+++
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (c) 2016, GEM Foundation
+
+# OpenQuake is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Founda... | |
cc19d21489ce0cea805b226f3f8122be321b5bf8 | pylua/tests/test_repeat.py | pylua/tests/test_repeat.py | from .helpers import codetest
class TestRepeat(object):
"""
tests for the lua if then else and various comparisons
"""
def test_simple_repeat(self):
ret = codetest("""
x = 0
repeat
x = x + 1
until x == 10
retu... | Add tests for Lua repeat until loop | Add tests for Lua repeat until loop
| Python | bsd-3-clause | fhahn/luna,fhahn/luna | ---
+++
@@ -0,0 +1,44 @@
+from .helpers import codetest
+
+
+class TestRepeat(object):
+ """
+ tests for the lua if then else and various comparisons
+ """
+
+ def test_simple_repeat(self):
+ ret = codetest("""
+ x = 0
+ repeat
+ x = x + 1
+ ... | |
5ac8e4619473275f2f0b26b8a9b64049d793a4ed | rmqid/__init__.py | rmqid/__init__.py | __version__ = '0.3.0'
from rmqid.connection import Connection
from rmqid.exchange import Exchange
from rmqid.message import Message
from rmqid.queue import Queue
from rmqid.tx import Tx
from rmqid.simple import consumer
from rmqid.simple import get
from rmqid.simple import publish
| __version__ = '0.3.0'
from rmqid.connection import Connection
from rmqid.exchange import Exchange
from rmqid.message import Message
from rmqid.queue import Queue
from rmqid.tx import Tx
from rmqid.simple import consumer
from rmqid.simple import get
from rmqid.simple import publish
import logging
try:
from loggi... | Add a NullHandler so logging warnings are not emitted if no logger is setup | Add a NullHandler so logging warnings are not emitted if no logger is setup
| Python | bsd-3-clause | jonahbull/rabbitpy,gmr/rabbitpy,gmr/rabbitpy | ---
+++
@@ -9,3 +9,15 @@
from rmqid.simple import consumer
from rmqid.simple import get
from rmqid.simple import publish
+
+import logging
+
+try:
+ from logging import NullHandler
+except ImportError:
+ # Python 2.6 does not have a NullHandler
+ class NullHandler(logging.Handler):
+ def emit(self,... |
cc7ea622542337df088ffdb1960bcecc7c4508f1 | darkopt/integration/xgboost.py | darkopt/integration/xgboost.py | import numpy as np
import xgboost.core
from darkopt import learning_curve
class XGBoostCallback(object):
def __init__(self, known_best_score, score_key=None,
pruning_prob_thresh=0.05,
maximize=False, learning_curve_predictor=None,
min_iters_before_prune=10, tes... | Add XGBoost callback class for pruning | Add XGBoost callback class for pruning
| Python | mit | iwiwi/darkopt | ---
+++
@@ -0,0 +1,55 @@
+import numpy as np
+import xgboost.core
+
+from darkopt import learning_curve
+
+
+class XGBoostCallback(object):
+
+ def __init__(self, known_best_score, score_key=None,
+ pruning_prob_thresh=0.05,
+ maximize=False, learning_curve_predictor=None,
+ ... | |
ba4a3caef1f361992aa7887d1f434510060d434f | hackingignores.py | hackingignores.py | #!/usr/bin/python3
import collections
import glob
# Run from openstack git org directory
# Format
# Rule: [repo]
result = collections.defaultdict(list)
for file in glob.glob("*/tox.ini"):
repo = file.split('/')[0]
with open(file) as f:
for line in f.readlines():
if line.startswith("igno... | Add code to track which hacking rules are ignored | Add code to track which hacking rules are ignored
| Python | apache-2.0 | jogo/hackingignores | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+
+import collections
+import glob
+
+
+# Run from openstack git org directory
+
+# Format
+# Rule: [repo]
+result = collections.defaultdict(list)
+
+for file in glob.glob("*/tox.ini"):
+ repo = file.split('/')[0]
+ with open(file) as f:
+ for line in f.readli... | |
c74426fc72f521bfcaa0e06922856a111e738a42 | onadata/apps/logger/migrations/0019_purge_deleted_instances.py | onadata/apps/logger/migrations/0019_purge_deleted_instances.py | # Generated by Django 2.2.14 on 2021-06-30 19:00
from django.conf import settings
from django.db import migrations
def purge_deleted_instances(apps, schema_editor):
"""
Remove all submissions that have been already marked as deleted from both
PostgreSQL and MongoDB. If this is too slow, revert to a previo... | Add data migration to purge deleted submissions | Add data migration to purge deleted submissions
WARNING: may be slow on large databases. Mention this in release notes.
Closes #733.
| Python | bsd-2-clause | kobotoolbox/kobocat,kobotoolbox/kobocat,kobotoolbox/kobocat,kobotoolbox/kobocat | ---
+++
@@ -0,0 +1,42 @@
+# Generated by Django 2.2.14 on 2021-06-30 19:00
+from django.conf import settings
+from django.db import migrations
+
+
+def purge_deleted_instances(apps, schema_editor):
+ """
+ Remove all submissions that have been already marked as deleted from both
+ PostgreSQL and MongoDB. If ... | |
5487bc28d09ef9628cc192083f4e4dab3742e857 | ehriportal/portal/templatetags/langname.py | ehriportal/portal/templatetags/langname.py | from urllib import quote
from django.template import Library
register = Library()
from ehriportal.portal import utils
@register.filter
def langname(code):
"""Creates a haystack facet parameter in format:
&selected_facets=<name>_exact:<value>"""
return utils.language_name_from_code(code)
| Add a templatetag to convert language code to language name | Add a templatetag to convert language code to language name
| Python | mit | mikesname/ehri-collections,mikesname/ehri-collections,mikesname/ehri-collections | ---
+++
@@ -0,0 +1,13 @@
+from urllib import quote
+from django.template import Library
+
+register = Library()
+
+from ehriportal.portal import utils
+
+@register.filter
+def langname(code):
+ """Creates a haystack facet parameter in format:
+ &selected_facets=<name>_exact:<value>"""
+ return utils.lang... | |
62d6568dc058f14a518516999dc3a22888593d0d | beatles/data/beatles/normalize_audio_cd_paths.py | beatles/data/beatles/normalize_audio_cd_paths.py | # Change the directory structure and file names of audio CD files so that they
# correspond to the naming in the isophonics annotation dataset.
import glob
import shutil
mkdir -p audio-cd/The_Beatles
echo mv audio-cd-raw/*/*/* audio-cd/The_Beatles
with open('album-mapping.csv', 'r') as file:
album_mapping = [lin... | Add a script to normalize file names to match between isophonics annotations and audio CD. | Add a script to normalize file names to match between isophonics annotations and audio CD.
| Python | mit | bzamecnik/ml-playground,bzamecnik/ml-playground,bzamecnik/ml,bzamecnik/ml,bzamecnik/ml | ---
+++
@@ -0,0 +1,20 @@
+# Change the directory structure and file names of audio CD files so that they
+# correspond to the naming in the isophonics annotation dataset.
+
+import glob
+import shutil
+
+mkdir -p audio-cd/The_Beatles
+echo mv audio-cd-raw/*/*/* audio-cd/The_Beatles
+
+with open('album-mapping.csv', '... | |
bcc69f77d8754161d5edd7ff35d583fb83c82b6b | samklang_utils/managers.py | samklang_utils/managers.py | from django.db.models import Manager
from django.db.models.query_utils import Q
class PermissionManager(Manager):
def for_user(self, user=None):
if user and user.is_authenticated():
return self.get_query_set().filter(Q(group=None) | Q(group__user=user))
else:
return self.ge... | Add new PermissionsManager that will be used by most Samklang modules | Add new PermissionsManager that will be used by most Samklang modules
| Python | agpl-3.0 | sigurdga/samklang-utils,sigurdga/samklang-utils | ---
+++
@@ -0,0 +1,10 @@
+from django.db.models import Manager
+from django.db.models.query_utils import Q
+
+class PermissionManager(Manager):
+
+ def for_user(self, user=None):
+ if user and user.is_authenticated():
+ return self.get_query_set().filter(Q(group=None) | Q(group__user=user))
+ ... | |
15bd37c9042e2f5734e1123d28ec1544780c7f8f | Scripts/Make_Load_Maps/project_nodal_load.py | Scripts/Make_Load_Maps/project_nodal_load.py | import numpy as np
import scipy.sparse as sparse
import argparse, os
from itertools import izip as zip
# Uses the output of nodal_projection_matrix.py to aggregate signals
# into the nodal domain.
parser = argparse.ArgumentParser(description='Wind conversion options')
parser.add_argument('-r', '--indir', help='Input ... | Add projection to nodal load | Add projection to nodal load
| Python | apache-2.0 | DTU-ELMA/European_Dataset,DTU-ELMA/European_Dataset | ---
+++
@@ -0,0 +1,44 @@
+import numpy as np
+import scipy.sparse as sparse
+import argparse, os
+from itertools import izip as zip
+
+# Uses the output of nodal_projection_matrix.py to aggregate signals
+# into the nodal domain.
+
+parser = argparse.ArgumentParser(description='Wind conversion options')
+parser.add_a... | |
65fa05e6646487180c02b2628b53138a24fabf32 | benchexec/tools/testcov.py | benchexec/tools/testcov.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2019 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
... | Add tool-info module for TestCov | Add tool-info module for TestCov
| Python | apache-2.0 | dbeyer/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,dbeyer/benchexec | ---
+++
@@ -0,0 +1,83 @@
+"""
+BenchExec is a framework for reliable benchmarking.
+This file is part of BenchExec.
+
+Copyright (C) 2007-2019 Dirk Beyer
+All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may... | |
fde618591d6c3ac3503583da07f8be82f8d85793 | scratchpad/captureFrame.py | scratchpad/captureFrame.py | import cv2
import time
import optparse
parser = optparse.OptionParser()
parser.add_option("-y", "--yPos", action="store", type="int", dest="yPos")
parser.add_option("-x", "--xPos", action="store", type="int", dest="xPos")
parser.add_option("-s", "--scale", action="store", type="int", dest="scale")
parser.add_option("-... | Add script found on roboRIO | Add script found on roboRIO
| Python | apache-2.0 | CarterFendley/2015-vision,CarterFendley/2015-vision,frc1418/2015-vision,frc1418/2015-vision | ---
+++
@@ -0,0 +1,57 @@
+import cv2
+import time
+import optparse
+
+parser = optparse.OptionParser()
+parser.add_option("-y", "--yPos", action="store", type="int", dest="yPos")
+parser.add_option("-x", "--xPos", action="store", type="int", dest="xPos")
+parser.add_option("-s", "--scale", action="store", type="int",... | |
8d84f59ae4ac2fd88b32f6059451652494556201 | scripts/delete_restored_trashedfilenodes.py | scripts/delete_restored_trashedfilenodes.py | # -*- coding: utf-8 -*-
"""Restore a deleted StoredFileNode. If the file was reuploaded, renames the file
to <filename> (restored).<ext>. For example, README.rst would be renamed to README (restored).rst.
python -m scripts.restore_file 123ab --dry
python -m scripts.restore_file 123ab
"""
import sys
import log... | Add migration script to delete restored trashedfilenodes | Add migration script to delete restored trashedfilenodes
| Python | apache-2.0 | adlius/osf.io,mattclark/osf.io,laurenrevere/osf.io,saradbowman/osf.io,chennan47/osf.io,sloria/osf.io,binoculars/osf.io,erinspace/osf.io,cwisecarver/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,brianjgeiger/osf.io,chennan47/osf.io,cslzchen/osf.io,aaxelb/osf.io,Nesiehr/osf.io,baylee-d/os... | ---
+++
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""Restore a deleted StoredFileNode. If the file was reuploaded, renames the file
+to <filename> (restored).<ext>. For example, README.rst would be renamed to README (restored).rst.
+
+ python -m scripts.restore_file 123ab --dry
+ python -m scripts.restore_file... | |
17f4e610e272d24c9178e43caa79a6f7c17a568b | tests/test_orderbook.py | tests/test_orderbook.py | from src import orderbook as ob
def test_create_msg_incrementing_message_id():
first_message = ob.create_msg()
second_message = ob.create_msg()
assert first_message['message-id'] == 0, 'Expected 0, got {}'.format(first_message['message-id'])
assert second_message['message-id'] == 1, 'Expected 1, got ... | Add some basic testing for orderbook.create_msg. | Add some basic testing for orderbook.create_msg.
| Python | mit | Tribler/decentral-market | ---
+++
@@ -0,0 +1,43 @@
+from src import orderbook as ob
+
+
+def test_create_msg_incrementing_message_id():
+ first_message = ob.create_msg()
+ second_message = ob.create_msg()
+
+ assert first_message['message-id'] == 0, 'Expected 0, got {}'.format(first_message['message-id'])
+ assert second_message['... | |
f5e9ab08d252c9a135a5b96ec157b74e92565f60 | evalset/multiopt_test_funcs.py | evalset/multiopt_test_funcs.py | from evalset.test_funcs import TestFunction, lzip
import numpy
class MultioptTestFunction(TestFunction):
def __init__(self, dim):
super(MultioptTestFunction, self).__init__(dim)
self.local_minima = [] # Sorted in increasing order of function value at the local minima
class LowDMixtureOfGaussians(MultioptTe... | Add multiopt class for evalset | Add multiopt class for evalset
| Python | mit | sigopt/evalset | ---
+++
@@ -0,0 +1,25 @@
+from evalset.test_funcs import TestFunction, lzip
+import numpy
+
+class MultioptTestFunction(TestFunction):
+
+ def __init__(self, dim):
+ super(MultioptTestFunction, self).__init__(dim)
+ self.local_minima = [] # Sorted in increasing order of function value at the local minima
+
+cl... | |
402315309ae576059014b8340db66477f9f1b0c5 | app/grandchallenge/cases/migrations/0011_auto_20190311_1350.py | app/grandchallenge/cases/migrations/0011_auto_20190311_1350.py | # Generated by Django 2.1.7 on 2019-03-11 13:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cases', '0010_auto_20190219_1301'),
]
operations = [
migrations.AddField(
model_name='image',
name='field_of_view',
... | Add migration for new attributes | Add migration for new attributes
| Python | apache-2.0 | comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django | ---
+++
@@ -0,0 +1,23 @@
+# Generated by Django 2.1.7 on 2019-03-11 13:50
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('cases', '0010_auto_20190219_1301'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='i... | |
78bf7e2af689f189ae1e77007014421fd865c949 | bin/clean_unused_headers.py | bin/clean_unused_headers.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import os
import re
from subprocess import check_output
IMAGE_PATTERN = re.compile(
'linux-image-(?P<version>[0-9\.]+)-(?P<rev>[0-9]{2})-generic')
HEADER_PATTERN = re.compile(
'linux-headers-(?P<version>[0-9\.]+)-(?P<rev>[0-9]{2})-generic'... | Add script to clean unused linux-headers packages | Add script to clean unused linux-headers packages
| Python | apache-2.0 | elleryq/oh-my-home,elleryq/oh-my-home,elleryq/oh-my-home | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+from __future__ import print_function
+import sys
+import os
+import re
+from subprocess import check_output
+
+
+IMAGE_PATTERN = re.compile(
+ 'linux-image-(?P<version>[0-9\.]+)-(?P<rev>[0-9]{2})-generic')
+HEADER_PATTERN = re.compile(
+ 'linux-headers-(?P<versi... | |
559e24c1ec397c07bcbc02b395d70cb0383ed291 | moksha/tests/test_entity.py | moksha/tests/test_entity.py | # -*- coding: utf-8 -*-
"""Test Moksha's Entity/Fact model"""
from datetime import datetime
from nose.tools import eq_, assert_true
from sqlalchemy import *
from moksha.model import DBSession, Entity, Fact, with_characteristic
from moksha.tests.test_models import TestModel
class TestEntity(TestModel):
"""Test cas... | Add test cases for our entity/fact model | Add test cases for our entity/fact model
| Python | apache-2.0 | lmacken/moksha,mokshaproject/moksha,pombredanne/moksha,mokshaproject/moksha,pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha,ralphbean/moksha,pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha | ---
+++
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+"""Test Moksha's Entity/Fact model"""
+
+from datetime import datetime
+from nose.tools import eq_, assert_true
+from sqlalchemy import *
+from moksha.model import DBSession, Entity, Fact, with_characteristic
+from moksha.tests.test_models import TestModel
+
+class T... | |
7c1c53fc63866e0832d39236f04d0675505d4518 | corehq/apps/reminders/management/commands/find_unsubscribed_projects_with_reminders.py | corehq/apps/reminders/management/commands/find_unsubscribed_projects_with_reminders.py | from django.core.management.base import BaseCommand
from corehq.apps.domain.models import Domain
from corehq import privileges
from corehq.apps.accounting.utils import domain_has_privilege
from corehq.apps.reminders.models import (CaseReminderHandler,
REMINDER_TYPE_DEFAULT)
class Command(BaseCommand):
args = ... | Add script to find projects with active reminders but without appropriate subscription | Add script to find projects with active reminders but without appropriate subscription
| Python | bsd-3-clause | dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | ---
+++
@@ -0,0 +1,28 @@
+from django.core.management.base import BaseCommand
+from corehq.apps.domain.models import Domain
+from corehq import privileges
+from corehq.apps.accounting.utils import domain_has_privilege
+from corehq.apps.reminders.models import (CaseReminderHandler,
+ REMINDER_TYPE_DEFAULT)
+
+
+cla... | |
b864a173a0fa863042bd21b6251d1e7aafa4ba29 | kazoo/tests/test_exceptions.py | kazoo/tests/test_exceptions.py | import unittest
from nose.tools import eq_
import zookeeper
class TestExceptions(unittest.TestCase):
def _makeOne(self, *args, **kwargs):
from kazoo.exceptions import err_to_exception
return err_to_exception(*args, **kwargs)
def test_error_translate(self):
exc = self._makeOne(zookeep... | Add complete exception unit tests. | Add complete exception unit tests.
| Python | apache-2.0 | pombredanne/kazoo,rockerbox/kazoo,python-zk/kazoo,harlowja/kazoo,rackerlabs/kazoo,harlowja/kazoo,jacksontj/kazoo,rockerbox/kazoo,rgs1/kazoo,jacksontj/kazoo,AlexanderplUs/kazoo,rackerlabs/kazoo,rgs1/kazoo,pombredanne/kazoo,tempbottle/kazoo,bsanders/kazoo,kormat/kazoo,bsanders/kazoo,python-zk/kazoo,Asana/kazoo,max0d41/ka... | ---
+++
@@ -0,0 +1,31 @@
+import unittest
+
+from nose.tools import eq_
+import zookeeper
+
+
+class TestExceptions(unittest.TestCase):
+ def _makeOne(self, *args, **kwargs):
+ from kazoo.exceptions import err_to_exception
+ return err_to_exception(*args, **kwargs)
+
+ def test_error_translate(sel... | |
268d825eb603fd6107fd663ac1e0df9e7037f0e9 | dbaas/dbaas/management/commands/filer_migrate_by_infra_name.py | dbaas/dbaas/management/commands/filer_migrate_by_infra_name.py | # coding: utf-8
from django.core.management.base import BaseCommand
from maintenance.scripts.filer_migrate import FilerMigrate
from logical.models import Database
class Command(BaseCommand):
'''Migrate filer'''
def handle(self, *args, **options):
names = filter(lambda s: s, map(lambda s: s.strip(), ... | Create command for migrate filer | Create command for migrate filer
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | ---
+++
@@ -0,0 +1,22 @@
+# coding: utf-8
+from django.core.management.base import BaseCommand
+from maintenance.scripts.filer_migrate import FilerMigrate
+from logical.models import Database
+
+
+class Command(BaseCommand):
+ '''Migrate filer'''
+
+ def handle(self, *args, **options):
+
+ names = filter... | |
890f4a225d783c410de80eca7e2b6988c92d63c6 | src/spot_test.py | src/spot_test.py | """Spot Resolver Test"""
import spot
def test_to_msw_id() -> None:
"""Test if spot resolving works as expected"""
res = spot.to_msw_id("Carcavelos")
assert res == 912, \
"to_msw_id() return expected {} but returned {}".format(912, res)
def test_to_msw_id_case_insensitive() -> None:
"""Test ... | Add tests for spot module | Add tests for spot module
| Python | mit | Smotko/surfbot,Smotko/surfbot | ---
+++
@@ -0,0 +1,17 @@
+"""Spot Resolver Test"""
+
+import spot
+
+
+def test_to_msw_id() -> None:
+ """Test if spot resolving works as expected"""
+ res = spot.to_msw_id("Carcavelos")
+ assert res == 912, \
+ "to_msw_id() return expected {} but returned {}".format(912, res)
+
+
+def test_to_msw_id_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.