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 |
|---|---|---|---|---|---|---|---|---|---|---|
60068d4deeba541b9518579d6d8473c4300e189d | tests/functional/test_crash.py | tests/functional/test_crash.py | import os.path
from os import unlink
from utils.launcher import Launcher
from utils.entries import Entries
from utils.loop import CounterLoop, BooleanLoop
from utils.files import generate, checksum
from utils.tempdirs import TempDirs
launcher = None
dirs = TempDirs()
rep1, rep2 = dirs.create(), dirs.create()
json_fil... | Test killing onitu during a transfer | Test killing onitu during a transfer
| Python | mit | onitu/onitu,onitu/onitu,onitu/onitu | ---
+++
@@ -0,0 +1,62 @@
+import os.path
+from os import unlink
+
+from utils.launcher import Launcher
+from utils.entries import Entries
+from utils.loop import CounterLoop, BooleanLoop
+from utils.files import generate, checksum
+from utils.tempdirs import TempDirs
+
+launcher = None
+dirs = TempDirs()
+rep1, rep2 ... | |
2a3b89f42cde7088b304a3f224eaf52894f544ec | misc/utils/LSL_Tests/RecieveAppStatistics.py | misc/utils/LSL_Tests/RecieveAppStatistics.py | """Example program to show how to read a multi-channel time series from LSL."""
from pylsl import StreamInlet, resolve_stream
import sys
# first resolve an EEG stream on the lab network
print("looking for an Unity3D.AppStatistics stream...")
streams = resolve_stream('type', 'Unity3D.FPS.FT')
# create a new inlet to r... | Add an python example for stream testing | Add an python example for stream testing
| Python | mit | xfleckx/BeMoBI,xfleckx/BeMoBI | ---
+++
@@ -0,0 +1,17 @@
+"""Example program to show how to read a multi-channel time series from LSL."""
+
+from pylsl import StreamInlet, resolve_stream
+import sys
+# first resolve an EEG stream on the lab network
+print("looking for an Unity3D.AppStatistics stream...")
+streams = resolve_stream('type', 'Unity3D.F... | |
6ad72a0c624abdda0df8d5c49366bfc597a12340 | cptm/tests/test_utils_experiment.py | cptm/tests/test_utils_experiment.py | from nose.tools import assert_equal, assert_false
from os import remove
from os.path import join
from json import dump
from cptm.utils.experiment import load_config, add_parameter, thetaFileName, \
topicFileName, opinionFileName, tarFileName, experimentName
def setup():
global jsonFile
global config
... | Add tests for utils experiment module | Add tests for utils experiment module
| Python | apache-2.0 | NLeSC/cptm,NLeSC/cptm | ---
+++
@@ -0,0 +1,93 @@
+from nose.tools import assert_equal, assert_false
+
+from os import remove
+from os.path import join
+from json import dump
+
+from cptm.utils.experiment import load_config, add_parameter, thetaFileName, \
+ topicFileName, opinionFileName, tarFileName, experimentName
+
+
+def setup():
+ ... | |
e6e5fbb671c2539f4f82c6eaca51fbf400133482 | utils/Target/ARM/analyze-match-table.py | utils/Target/ARM/analyze-match-table.py | #!/usr/bin/env python
def analyze_match_table(path):
# Extract the instruction table.
data = open(path).read()
start = data.index("static const MatchEntry MatchTable")
end = data.index("\n};\n", start)
lines = data[start:end].split("\n")[1:]
# Parse the instructions.
insns = []
for ln ... | Write a silly Python script to compute some hard coded info from the generated ARM match table, which is substantially more efficient than dealing with tblgen. | McARM: Write a silly Python script to compute some hard coded info from the
generated ARM match table, which is substantially more efficient than dealing
with tblgen.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@123252 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | GPUOpen-Drivers/llvm,chubbymaggie/asap,dslab-epfl/asap,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,dslab-epfl/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,chubbymaggie/asap,apple/swift... | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+def analyze_match_table(path):
+ # Extract the instruction table.
+ data = open(path).read()
+ start = data.index("static const MatchEntry MatchTable")
+ end = data.index("\n};\n", start)
+ lines = data[start:end].split("\n")[1:]
+
+ # Parse the ins... | |
aab833a4a267ed46e83a5968e87d357ae3a5a12b | utils/LSL_Tests/RecieveDemoStream.py | utils/LSL_Tests/RecieveDemoStream.py | """Example program to show how to read a marker time series from LSL."""
import sys
sys.path.append('./pylsl') # help python find pylsl relative to this example program
from pylsl import StreamInlet, resolve_stream
# first resolve an EEG stream on the lab network
targetStreamType = 'Unity.Quaternion'
print 'looking fo... | Add new DemoStream example corresponding to the LSL4Unity Project | Add new DemoStream example corresponding to the LSL4Unity Project
| Python | mit | xfleckx/BeMoBI_Tools,xfleckx/BeMoBI_Tools,xfleckx/BeMoBI_Tools | ---
+++
@@ -0,0 +1,27 @@
+"""Example program to show how to read a marker time series from LSL."""
+import sys
+sys.path.append('./pylsl') # help python find pylsl relative to this example program
+from pylsl import StreamInlet, resolve_stream
+
+# first resolve an EEG stream on the lab network
+targetStreamType = 'U... | |
2e0fbcb3ec1c2f0311d7ee4bbfeac33662f66089 | monitor_process.py | monitor_process.py | import subprocess
""" If the program is running "ps -ef | grep program" will return 2 or more rows
(one with the program itself and the second one with "grep program").
Otherwise, it will only return one row ("grep program")
You can trigger the alert on this if required.
"""
def monitor_process(name):
args=['ps',... | Monitor process using subprocess module | Monitor process using subprocess module | Python | apache-2.0 | PSJoshi/python_scripts | ---
+++
@@ -0,0 +1,20 @@
+import subprocess
+
+""" If the program is running "ps -ef | grep program" will return 2 or more rows
+(one with the program itself and the second one with "grep program").
+Otherwise, it will only return one row ("grep program")
+You can trigger the alert on this if required.
+"""
+
+def... | |
ca9ed2756a12a2587f5b4d021597d2229196da50 | api/common/migrations/0007_add_china_region.py | api/common/migrations/0007_add_china_region.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-24 21:52
from __future__ import unicode_literals
from django.db import migrations
def forwards(apps, schema_editor):
Region = apps.get_model('common.Region')
region_to_add = 'China'
try:
Region.objects.get(name=region_to_add)
exc... | Add migration to add china region | Add migration to add china region
| Python | apache-2.0 | prattl/teamfinder,prattl/teamfinder,prattl/teamfinder,prattl/teamfinder | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-06-24 21:52
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def forwards(apps, schema_editor):
+ Region = apps.get_model('common.Region')
+ region_to_add = 'China'
+ try:
+ Region.... | |
680b2cb1488f83aef5b45476e23bd93a90069872 | herd-code/herd-tools/herd-content-loader/herdcl/hook-otags.py | herd-code/herd-tools/herd-content-loader/herdcl/hook-otags.py | hiddenimports = [
'numpy',
'pandas._libs.tslibs.timedeltas',
'pandas._libs.tslibs.nattype',
'pandas._libs.tslibs.np_datetime',
'pandas._libs.skiplist'
]
| Create Content Loader app to Herd/DM standards - Configure Pyinstaller | DM-12166: Create Content Loader app to Herd/DM standards
- Configure Pyinstaller
| Python | apache-2.0 | FINRAOS/herd,FINRAOS/herd,FINRAOS/herd,FINRAOS/herd,FINRAOS/herd | ---
+++
@@ -0,0 +1,7 @@
+hiddenimports = [
+ 'numpy',
+ 'pandas._libs.tslibs.timedeltas',
+ 'pandas._libs.tslibs.nattype',
+ 'pandas._libs.tslibs.np_datetime',
+ 'pandas._libs.skiplist'
+] | |
56d14e7b0386588afd39f2413fafe0b9ba41806d | tests/app/soc/modules/gsoc/views/test_slot_transfer_admin.py | tests/app/soc/modules/gsoc/views/test_slot_transfer_admin.py | # Copyright 2013 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | Access checking unit tests for SlotsTransferAdminPage. | Access checking unit tests for SlotsTransferAdminPage.
| Python | apache-2.0 | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | ---
+++
@@ -0,0 +1,54 @@
+# Copyright 2013 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required ... | |
2299343d8b10658cc6682b23dbf9be9d5fd290f6 | tests/testdata.py | tests/testdata.py | import ConfigParser
import csv
import unittest
class DataTest(unittest.TestCase):
def setUp(self):
config = ConfigParser.RawConfigParser()
config.read('../app.config')
# Load the data from the csv into an array
self.data = []
with open('../data/%s' % config.get('data', ... | Add unit test for data integrity. | Add unit test for data integrity.
| Python | bsd-3-clause | c4fcm/WhatWeWatch-Analysis,c4fcm/WhatWeWatch-Analysis,c4fcm/WhatWeWatch-Analysis | ---
+++
@@ -0,0 +1,35 @@
+import ConfigParser
+import csv
+import unittest
+
+class DataTest(unittest.TestCase):
+
+ def setUp(self):
+ config = ConfigParser.RawConfigParser()
+ config.read('../app.config')
+ # Load the data from the csv into an array
+ self.data = []
+ with ... | |
422390ff7eb4d97eaf0c5c1a1b250010ee766ec7 | tools/cleanPYC.py | tools/cleanPYC.py |
import re
import os
import sys
print("%s path\n" % sys.argv[0])
path = sys.argv[1]
for root, dirs, files in os.walk(path):
for file_ in files:
if re.match(".*.pyc$", file_):
abs_file = os.path.join(root, file_)
print("Clean %s" % abs_file)
os.remove(abs_file)
| Add tool for clean pyc files | Add tool for clean pyc files
Signed-off-by: xcgspring <8f4f8d15922e4269158d45cde01dc3497961f40d@126.com>
| Python | apache-2.0 | xcgspring/AXUI,xcgspring/AXUI,xcgspring/AXUI | ---
+++
@@ -0,0 +1,15 @@
+
+import re
+import os
+import sys
+
+print("%s path\n" % sys.argv[0])
+
+path = sys.argv[1]
+
+for root, dirs, files in os.walk(path):
+ for file_ in files:
+ if re.match(".*.pyc$", file_):
+ abs_file = os.path.join(root, file_)
+ print("Clean %s" % abs_file)... | |
5ed7db70874f3ebfe9c946d38ccf12228dacac3a | tests/test_git.py | tests/test_git.py | from unittest import TestCase
from mock import MagicMock, patch
from nose.tools import raises
from pyolite.git import Git
class TestGit(TestCase):
@raises(ValueError)
def test_commit_with_no_message(self):
mock_repo = MagicMock()
mock_index = MagicMock()
mock_remotes = MagicMock()
mock_repo.in... | Test if we tried to commit with an empty message, it should raise a ValueError | Test if we tried to commit with an empty message, it should raise a ValueError
| Python | bsd-2-clause | PressLabs/pyolite,shawkinsl/pyolite | ---
+++
@@ -0,0 +1,24 @@
+from unittest import TestCase
+
+from mock import MagicMock, patch
+from nose.tools import raises
+
+from pyolite.git import Git
+
+
+class TestGit(TestCase):
+
+ @raises(ValueError)
+ def test_commit_with_no_message(self):
+ mock_repo = MagicMock()
+ mock_index = MagicMock()
+ mo... | |
fc44d4463045e458796d13b3c97b34cf6ba47f61 | bluechip/player/createpitchweights.py | bluechip/player/createpitchweights.py | import random
from player.models import Player, Pitch, PlayerPitchWeight
#TODO: Need to centralize this function call.
random.seed(123456789)
pitch_records = Pitch.objects.all().order_by('id')
pitches_count = pitch_records.count()
for p in Player.objects.all():
weights = []
sum_weights = 0
for _ in xrange(pitches_... | Add script to create the player pitch weights. | Add script to create the player pitch weights.
| Python | mit | isuraed/bluechip | ---
+++
@@ -0,0 +1,28 @@
+import random
+from player.models import Player, Pitch, PlayerPitchWeight
+
+#TODO: Need to centralize this function call.
+random.seed(123456789)
+
+pitch_records = Pitch.objects.all().order_by('id')
+pitches_count = pitch_records.count()
+for p in Player.objects.all():
+ weights = []
+ sum... | |
d3f68c385da4d2fa864ba748f41785be01c26c34 | py/student-attendance-record-i.py | py/student-attendance-record-i.py | class Solution(object):
def checkRecord(self, s):
"""
:type s: str
:rtype: bool
"""
A = False
L = 0
for c in s:
if c == 'L':
L += 1
if L > 2:
return False
else:
L = 0
... | Add py solution for 551. Student Attendance Record I | Add py solution for 551. Student Attendance Record I
551. Student Attendance Record I: https://leetcode.com/problems/student-attendance-record-i/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,22 @@
+class Solution(object):
+ def checkRecord(self, s):
+ """
+ :type s: str
+ :rtype: bool
+ """
+ A = False
+ L = 0
+ for c in s:
+ if c == 'L':
+ L += 1
+ if L > 2:
+ return False
+... | |
a7ccd7bc02476cfad85280ff1e742671453360de | migrations/versions/420_dos_is_coming.py | migrations/versions/420_dos_is_coming.py | """DOS is coming
Revision ID: 420
Revises: 410_remove_empty_drafts
Create Date: 2015-11-16 14:10:35.814066
"""
# revision identifiers, used by Alembic.
revision = '420'
down_revision = '410_remove_empty_drafts'
from alembic import op
import sqlalchemy as sa
from app.models import Framework
def upgrade():
op.e... | Add Digital Outcomes and Specialists to frameworks | Add Digital Outcomes and Specialists to frameworks
This commit checks to see if:
- the framework exists in the enum before trying to add it
- the framework exists in the table before trying to add
This means that it won’t fall over on enviroments where DOS has already been
created (eg local dev machines, preview).
T... | Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | ---
+++
@@ -0,0 +1,34 @@
+"""DOS is coming
+
+Revision ID: 420
+Revises: 410_remove_empty_drafts
+Create Date: 2015-11-16 14:10:35.814066
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '420'
+down_revision = '410_remove_empty_drafts'
+
+from alembic import op
+import sqlalchemy as sa
+from app.models ... | |
c5dfcffdf743e2c26b8dba6e3be8aee7d7aaa608 | test/test_join_bytes.py | test/test_join_bytes.py | import re
import linesep
try:
from StringIO import StringIO as BytesIO
except ImportError:
from io import BytesIO
# Based on <https://pytest.org/latest/example/parametrize.html#a-quick-port-of-testscenarios>
def pytest_generate_tests(metafunc):
idlist = []
argvalues = []
for scenario in meta... | Test `write_*` and `join_*` on bytes | Test `write_*` and `join_*` on bytes
| Python | mit | jwodder/linesep | ---
+++
@@ -0,0 +1,60 @@
+import re
+import linesep
+
+try:
+ from StringIO import StringIO as BytesIO
+except ImportError:
+ from io import BytesIO
+
+# Based on <https://pytest.org/latest/example/parametrize.html#a-quick-port-of-testscenarios>
+def pytest_generate_tests(metafunc):
+ idlist = []
+ ... | |
a30cd68e77242df4efadc75c4390dd8a3ce68612 | src/ggrc/migrations/versions/20170103101308_42b22b9ca859__fix_audit_empty_status.py | src/ggrc/migrations/versions/20170103101308_42b22b9ca859__fix_audit_empty_status.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Fix audit empty status
Create Date: 2016-12-22 13:53:24.497701
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
import sqlalchemy as sa... | Add data migration for Audit's empty status | Add data migration for Audit's empty status
| Python | apache-2.0 | AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core | ---
+++
@@ -0,0 +1,38 @@
+# Copyright (C) 2016 Google Inc.
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+
+"""
+Fix audit empty status
+
+Create Date: 2016-12-22 13:53:24.497701
+"""
+# disable Invalid constant name pylint warning for mandatory Alembic variables.
+# pylint: disable=... | |
66b5a1089ed0ce2e615f889f35b5e39db91950ae | mezzanine/core/management/commands/runserver.py | mezzanine/core/management/commands/runserver.py |
import os
from django.conf import settings
from django.contrib.staticfiles.management.commands import runserver
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.http import Http404
from django.views.static import serve
class MezzStaticFilesHandler(StaticFilesHandler):
def get_resp... |
import os
from django.conf import settings
from django.contrib.staticfiles.management.commands import runserver
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.views.static import serve
class MezzStaticFilesHandler(StaticFilesHandler):
def get_response(self, request):
res... | Fix serving uploaded files during development. | Fix serving uploaded files during development.
| Python | bsd-2-clause | SoLoHiC/mezzanine,industrydive/mezzanine,jjz/mezzanine,Kniyl/mezzanine,stephenmcd/mezzanine,adrian-the-git/mezzanine,biomassives/mezzanine,emile2016/mezzanine,dekomote/mezzanine-modeltranslation-backport,Cicero-Zhao/mezzanine,nikolas/mezzanine,industrydive/mezzanine,fusionbox/mezzanine,saintbird/mezzanine,douglaskastle... | ---
+++
@@ -4,21 +4,17 @@
from django.conf import settings
from django.contrib.staticfiles.management.commands import runserver
from django.contrib.staticfiles.handlers import StaticFilesHandler
-from django.http import Http404
from django.views.static import serve
class MezzStaticFilesHandler(StaticFilesHan... |
2ef9fce02be94f8c4e9b5c52ca04a05cce1b5ede | LiSE/LiSE/server/__main__.py | LiSE/LiSE/server/__main__.py | import cherrypy
from argparse import ArgumentParser
from . import LiSEHandleWebService
parser = ArgumentParser()
parser.add_argument('world', action='store', required=True)
parser.add_argument('-c', '--code', action='store')
args = parser.parse_args()
conf = {
'/': {
'request.dispatch': cherrypy.dispatch.M... | Allow to start server as a module | Allow to start server as a module
| Python | agpl-3.0 | LogicalDash/LiSE,LogicalDash/LiSE | ---
+++
@@ -0,0 +1,19 @@
+import cherrypy
+from argparse import ArgumentParser
+from . import LiSEHandleWebService
+
+parser = ArgumentParser()
+parser.add_argument('world', action='store', required=True)
+parser.add_argument('-c', '--code', action='store')
+args = parser.parse_args()
+conf = {
+ '/': {
+ '... | |
a0124a990b4afe0cd5fd3971bae1e43f417bc1b2 | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | from django.core.management.base import BaseCommand
from corehq.apps.domain.models import Domain
import csv
class Command(BaseCommand):
help = 'Find domains with secure submissions and image questions'
def handle(self, *args, **options):
with open('domain_results.csv', 'wb+') as csvfile:
... | Add management command to find domains impacted by 502 bug | Add management command to find domains impacted by 502 bug
| Python | bsd-3-clause | puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoft... | ---
+++
@@ -0,0 +1,31 @@
+from django.core.management.base import BaseCommand
+from corehq.apps.domain.models import Domain
+import csv
+
+
+class Command(BaseCommand):
+ help = 'Find domains with secure submissions and image questions'
+
+ def handle(self, *args, **options):
+ with open('domain_results.... | |
278cd37ada508701896c2669a215365785f5a261 | evalExp.py | evalExp.py | from keywords import *
from reg import *
from parse import parse
def evalExp():
expr = parse(fetch(EXPR)) # make dedicated fetch_expr()?
# expr = transformMacros(expr)
evalFunc = getEvalFunc(expr)
# evalFunc()
# reassign next step
def getEvalFunc(expr):
if isVar(expr):
return compVar
if isNum(expr):
retur... | Add eval dispatch (copied from compyle) | Add eval dispatch (copied from compyle)
| Python | mit | nickdrozd/ecio-lisp,nickdrozd/ecio-lisp | ---
+++
@@ -0,0 +1,45 @@
+from keywords import *
+from reg import *
+from parse import parse
+
+def evalExp():
+ expr = parse(fetch(EXPR)) # make dedicated fetch_expr()?
+ # expr = transformMacros(expr)
+ evalFunc = getEvalFunc(expr)
+ # evalFunc()
+ # reassign next step
+
+def getEvalFunc(expr):
+ if isVar(expr):
+ ... | |
9bffe981c018213b87d015a20603c092567bbdf4 | cobaltuoft/cobalt.py | cobaltuoft/cobalt.py | from .endpoints import Endpoints
from .helpers import get, scrape_filters
class Cobalt:
def __init__(self, api_key=None):
self.host = 'http://cobalt.qas.im/api/1.0'
self.headers = {
'Referer': 'Cobalt-UofT-Python'
}
if not api_key or not self._is_valid_key(api_key):
... | Initialize multiple class setup; add remaining APIs | Initialize multiple class setup; add remaining APIs
| Python | mit | kshvmdn/cobalt-uoft-python | ---
+++
@@ -0,0 +1,49 @@
+from .endpoints import Endpoints
+from .helpers import get, scrape_filters
+
+
+class Cobalt:
+ def __init__(self, api_key=None):
+ self.host = 'http://cobalt.qas.im/api/1.0'
+
+ self.headers = {
+ 'Referer': 'Cobalt-UofT-Python'
+ }
+
+ if not api_k... | |
316a82c5465a13770404b6a302348f192618cd27 | libqtile/command_interface.py | libqtile/command_interface.py | # Copyright (c) 2019, Sean Vig. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | Add an interface for eagerly evaluating command graph elements | Add an interface for eagerly evaluating command graph elements
Setup a new interface that evaluates commands on the command graph as
they are issued. This is roughly the interface of the current Client.
| Python | mit | soulchainer/qtile,zordsdavini/qtile,ramnes/qtile,qtile/qtile,tych0/qtile,soulchainer/qtile,qtile/qtile,zordsdavini/qtile,ramnes/qtile,tych0/qtile | ---
+++
@@ -0,0 +1,51 @@
+# Copyright (c) 2019, Sean Vig. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the ri... | |
dff1f9176d7ce77a242263bfc9a0760cd31f0585 | regex_proxy.py | regex_proxy.py | from regex import *
from regex import compile as raw_compile
_cache = {}
# Wrap regex.compile up so we have a global cache
def compile(s, *args, **args):
global _cache
try:
return _cache[s]
except KeyError:
r = raw_compile(s, *args, **kwargs)
_cache[s] = r
return r
| Add a prototype for cached regex.compile() | Add a prototype for cached regex.compile()
| Python | apache-2.0 | Charcoal-SE/SmokeDetector,Charcoal-SE/SmokeDetector | ---
+++
@@ -0,0 +1,16 @@
+from regex import *
+from regex import compile as raw_compile
+
+
+_cache = {}
+
+
+# Wrap regex.compile up so we have a global cache
+def compile(s, *args, **args):
+ global _cache
+ try:
+ return _cache[s]
+ except KeyError:
+ r = raw_compile(s, *args, **kwargs)
+ ... | |
09112412a4814e3727def2547765546bf44c1e7d | test/algorithms/refinement/test_cspad_refinement.py | test/algorithms/refinement/test_cspad_refinement.py | # Test multiple stills refinement.
from __future__ import absolute_import, division, print_function
import os
from dxtbx.model.experiment_list import ExperimentListFactory
import procrunner
def test1(dials_regression, run_in_tmpdir):
"""
Refinement test of 300 CSPAD images, testing auto_reduction, parameter
f... | Test joint refinement of 300 cspad images using Brewster 2018 methods. | Test joint refinement of 300 cspad images using Brewster 2018 methods.
This reproduces the last panel of Figure 3, refining the outer shell of the cspad. It tests auto_reduction, parameter fixing, constraints, SparseLevMar, and sauter_poon outlier rejection.
Test passes on Centos 6.9 and mac 10.13.6.
| Python | bsd-3-clause | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | ---
+++
@@ -0,0 +1,52 @@
+# Test multiple stills refinement.
+
+from __future__ import absolute_import, division, print_function
+
+import os
+
+from dxtbx.model.experiment_list import ExperimentListFactory
+import procrunner
+
+def test1(dials_regression, run_in_tmpdir):
+ """
+ Refinement test of 300 CSPAD images... | |
724e86e31b6584012af5afe458e0823b9a2ca7ab | myclass/class_create_spark.py | myclass/class_create_spark.py | # -*- coding: utf-8 -*-
# !/usr/bin/python
################################### PART0 DESCRIPTION #################################
# Filename: class_save_word_to_database.py
# Description:
#
# Author: Shuai Yuan
# E-mail: ysh329@sina.com
# Create: 2015-11-17 20:43:09
# Last:
__author__ = 'yuens'
####################... | Create a class named "CreateSpark", which is to solove the problem of "Cannot run multiple SparkContexts at once; existing SparkContext(app=spam-msg-classifier, master=local[8]) created by __init__" | Create a class named "CreateSpark", which is to solove the problem of "Cannot run multiple SparkContexts at once; existing SparkContext(app=spam-msg-classifier, master=local[8]) created by __init__"
| Python | apache-2.0 | ysh329/spam-msg-classifier | ---
+++
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+# !/usr/bin/python
+################################### PART0 DESCRIPTION #################################
+# Filename: class_save_word_to_database.py
+# Description:
+#
+
+
+# Author: Shuai Yuan
+# E-mail: ysh329@sina.com
+# Create: 2015-11-17 20:43:09
+# Last:
+__... | |
8632b60718fa353797ffc53281e57a37caf9452f | set_address.py | set_address.py | import zmq
import time
import sys
print sys.argv[1:]
# ZeroMQ Context
context = zmq.Context()
sock_live = context.socket(zmq.PUB)
sock_live.connect("tcp://"+sys.argv[1])
time.sleep(1)
# Send multipart only allows send byte arrays, so we convert everything to strings before sending
# [TODO] add .encode('UTF-8') when ... | Add config command for setting the address of rf sensors. | Add config command for setting the address of rf sensors.
| Python | bsd-3-clause | geekylou/sensor_net,geekylou/sensor_net,geekylou/sensor_net,geekylou/sensor_net,geekylou/sensor_net | ---
+++
@@ -0,0 +1,16 @@
+import zmq
+import time
+import sys
+print sys.argv[1:]
+
+# ZeroMQ Context
+context = zmq.Context()
+
+sock_live = context.socket(zmq.PUB)
+sock_live.connect("tcp://"+sys.argv[1])
+
+time.sleep(1)
+# Send multipart only allows send byte arrays, so we convert everything to strings before sen... | |
c5a2167a63516c23390263408fcd2c9a4f654fc8 | webcomix/tests/test_comic_spider.py | webcomix/tests/test_comic_spider.py | from webcomix.comic_spider import ComicSpider
def test_parse_yields_good_page(mocker):
mock_response = mocker.patch('scrapy.http.Response')
mock_response.urljoin.return_value = "http://xkcd.com/3/"
mock_response.url = "http://xkcd.com/2/"
mock_selector = mocker.patch('scrapy.selector.SelectorList')
... | Add tests for the parse method of the spider | Add tests for the parse method of the spider
| Python | mit | J-CPelletier/webcomix,J-CPelletier/webcomix,J-CPelletier/WebComicToCBZ | ---
+++
@@ -0,0 +1,35 @@
+from webcomix.comic_spider import ComicSpider
+
+
+def test_parse_yields_good_page(mocker):
+ mock_response = mocker.patch('scrapy.http.Response')
+ mock_response.urljoin.return_value = "http://xkcd.com/3/"
+ mock_response.url = "http://xkcd.com/2/"
+ mock_selector = mocker.patch... | |
510b90d42dbccd0aa1e3ff48ee8dbe7230b65185 | get_stats_from.py | get_stats_from.py | import argparse
import csv
from glob import glob
import re
import statistics
import sys
def get_stats_from(files_names, files_content):
for i in range(len(files_content)):
file_name = files_names[i]
file_content = files_content[i]
print("FILE : {0}".format(files_names[i]))
print("\t... | Add script to compute some stats about data from energy consumption measures | Add script to compute some stats about data from energy consumption measures
| Python | agpl-3.0 | SOMCA/hot-pepper,SOMCA/hot-pepper,SOMCA/hot-pepper,SOMCA/hot-pepper,SOMCA/hot-pepper | ---
+++
@@ -0,0 +1,66 @@
+import argparse
+import csv
+from glob import glob
+import re
+import statistics
+import sys
+
+def get_stats_from(files_names, files_content):
+ for i in range(len(files_content)):
+ file_name = files_names[i]
+ file_content = files_content[i]
+ print("FILE : {0}".fo... | |
20b450c4cd0ff9c57d894fa263056ff4cd2dbf07 | vim_turing_machine/machines/merge_business_hours/vim_merge_business_hours.py | vim_turing_machine/machines/merge_business_hours/vim_merge_business_hours.py | from vim_turing_machine.machines.merge_business_hours.merge_business_hours import merge_business_hours_transitions
from vim_turing_machine.vim_machine import VimTuringMachine
if __name__ == '__main__':
merge_business_hours = VimTuringMachine(merge_business_hours_transitions(), debug=True)
merge_business_hours... | Add a vim version of merge business hours | Add a vim version of merge business hours
| Python | mit | ealter/vim_turing_machine,ealter/vim_turing_machine | ---
+++
@@ -0,0 +1,7 @@
+from vim_turing_machine.machines.merge_business_hours.merge_business_hours import merge_business_hours_transitions
+from vim_turing_machine.vim_machine import VimTuringMachine
+
+
+if __name__ == '__main__':
+ merge_business_hours = VimTuringMachine(merge_business_hours_transitions(), debu... | |
9fdd671d9c0b91dc789ebf3b24226edb3e6a072a | sleep/migrations/0002_load_metrics.py | sleep/migrations/0002_load_metrics.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.core.management import call_command
def load_metrics():
call_command('loaddata', 'metrics.json')
class Migration(migrations.Migration):
dependencies = [
('sleep', '0001_initial'),
... | Add new migration to load metrics fixtures | Add new migration to load metrics fixtures
| Python | mit | sleepers-anonymous/zscore,sleepers-anonymous/zscore,sleepers-anonymous/zscore,sleepers-anonymous/zscore | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from django.core.management import call_command
+
+
+def load_metrics():
+ call_command('loaddata', 'metrics.json')
+
+
+class Migration(migrations.Migration):
+
+ dependencies... | |
f032556bf07b37f9544c71ecad7aed472021bc97 | sql/branch.py | sql/branch.py | import sys
from gratipay import wireup
db = wireup.db(wireup.env())
participants = db.all("""
SELECT p.*::participants
FROM participants p
WHERE (
SELECT error
FROM current_exchange_routes er
WHERE er.participant = p.id
AND network = 'braintree-cc'
) <> ''
""... | Add script to update giving and teams receiving | Add script to update giving and teams receiving
| Python | mit | gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com | ---
+++
@@ -0,0 +1,31 @@
+import sys
+
+from gratipay import wireup
+
+db = wireup.db(wireup.env())
+
+participants = db.all("""
+ SELECT p.*::participants
+ FROM participants p
+ WHERE (
+ SELECT error
+ FROM current_exchange_routes er
+ WHERE er.participant = p.id
+ AND... | |
fcf691454b8607fec9d7f5cba43579dc02c26c8b | tests/pgi_covergage.py | tests/pgi_covergage.py | """
find pgi coverage of all gi.repositorys.
you need to have access to both 'gi' and 'pgi' in the current python
environment.
In a virtualenv this works:
$ pip install pgi
$ pip install vext.gi
$ python pgi_coverage.py
"""
TYPELIB_DIR="/usr/lib/girepository-1.0"
from os.path import basename
from glob import glob
... | Check coverage of pgi, vs gi | Check coverage of pgi, vs gi
This loops through all the typelibs it can find and the methods, then tries to call them, to build a report to see coverage.
It's a fairly brute force approach but works.. not sure if this is the place to put this in the repo
Could probably extend this in various ways, maybe html ou... | Python | lgpl-2.1 | lazka/pgi,lazka/pgi | ---
+++
@@ -0,0 +1,63 @@
+"""
+find pgi coverage of all gi.repositorys.
+you need to have access to both 'gi' and 'pgi' in the current python
+environment.
+
+In a virtualenv this works:
+
+$ pip install pgi
+$ pip install vext.gi
+
+$ python pgi_coverage.py
+"""
+
+TYPELIB_DIR="/usr/lib/girepository-1.0"
+
+from os.... | |
5c602a98098bdedeffc2b7359a4b3d8407cb1449 | scripts/migrate_inconsistent_file_keys.py | scripts/migrate_inconsistent_file_keys.py | #!/usr/bin/env python
# encoding: utf-8
"""Find all nodes with different sets of keys for `files_current` and
`files_versions`, and ensure that all keys present in the former are also
present in the latter.
"""
from website.models import Node
from website.app import init_app
def find_file_mismatch_nodes():
"""Fi... | Add migration to ensure consistency on file keys. | Add migration to ensure consistency on file keys.
Resolves https://github.com/CenterForOpenScience/openscienceframework.org/issues/1119
| Python | apache-2.0 | rdhyee/osf.io,amyshi188/osf.io,sloria/osf.io,zachjanicki/osf.io,mluo613/osf.io,asanfilippo7/osf.io,brandonPurvis/osf.io,doublebits/osf.io,mfraezz/osf.io,laurenrevere/osf.io,pattisdr/osf.io,erinspace/osf.io,bdyetton/prettychart,revanthkolli/osf.io,MerlinZhang/osf.io,caseyrygt/osf.io,TomHeatwole/osf.io,cldershem/osf.io,H... | ---
+++
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+# encoding: utf-8
+"""Find all nodes with different sets of keys for `files_current` and
+`files_versions`, and ensure that all keys present in the former are also
+present in the latter.
+"""
+
+from website.models import Node
+from website.app import init_app
+
+
+d... | |
386baa36355b0e9378fff59fe768d1baa7e73fec | scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py | scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py | # Himax motion detection example.
import sensor, image, time, pyb
from pyb import Pin, ExtInt
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.set_framerate(15)
sensor.ioctl(sensor.IOCTL_HIMAX_MD_THRESHOLD, 0x01)
sensor.ioctl(sensor.IOCTL_HIMAX_MD_WINDOW, (0, 0, 320, 240... | Add Himax motion detection example. | Add Himax motion detection example.
| Python | mit | openmv/openmv,iabdalkader/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv | ---
+++
@@ -0,0 +1,35 @@
+# Himax motion detection example.
+
+import sensor, image, time, pyb
+from pyb import Pin, ExtInt
+
+sensor.reset()
+sensor.set_pixformat(sensor.GRAYSCALE)
+sensor.set_framesize(sensor.QVGA)
+sensor.set_framerate(15)
+
+sensor.ioctl(sensor.IOCTL_HIMAX_MD_THRESHOLD, 0x01)
+sensor.ioctl(sensor... | |
a801deeaa00e443b3c68c1fbcea1e6ff62d90082 | python/addusers.py | python/addusers.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Adds a sequential number of users into a test database
with username: newusern and password newusern
Not for production usage
"""
import MySQLdb
hostname = # FILL IN
username = # FILL IN
password = # FILL IN
# Simple routine to run a query on a database and prin... | Add Python script to generate users | Add Python script to generate users
| Python | mit | veekaybee/intro-to-sql,veekaybee/intro-to-sql,veekaybee/intro-to-sql | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+"""
+Adds a sequential number of users into a test database
+with username: newusern and password newusern
+
+Not for production usage
+"""
+
+import MySQLdb
+
+
+hostname = # FILL IN
+username = # FILL IN
+password = # FILL IN
+
+
+
+# Simpl... | |
ff98bdf9ce263648de784183ad5984864f9d387a | tests/api/test_refs.py | tests/api/test_refs.py | async def test_create(spawn_client, test_random_alphanumeric, static_time):
client = await spawn_client(authorize=True, permissions=["create_ref"])
data = {
"name": "Test Viruses",
"description": "A bunch of viruses used for testing",
"data_type": "genome",
"organism": "virus",
... | Add ref create api test | Add ref create api test
| Python | mit | virtool/virtool,igboyes/virtool,virtool/virtool,igboyes/virtool | ---
+++
@@ -0,0 +1,32 @@
+async def test_create(spawn_client, test_random_alphanumeric, static_time):
+ client = await spawn_client(authorize=True, permissions=["create_ref"])
+
+ data = {
+ "name": "Test Viruses",
+ "description": "A bunch of viruses used for testing",
+ "data_type": "geno... | |
c122db5ceda59d786bd550f586ea87d808595ab6 | pombola/nigeria/management/commands/nigeria_update_lga_boundaries_from_gadm.py | pombola/nigeria/management/commands/nigeria_update_lga_boundaries_from_gadm.py | from django.contrib.gis.gdal import DataSource
from django.core.management import BaseCommand
from django.db import transaction
from mapit.management.command_utils import save_polygons, fix_invalid_geos_geometry
from mapit.models import Area, Type
class Command(BaseCommand):
help = "Update the Nigeria boundaries ... | Add a script to reimport the LGA boundaries from the GADM.org data | NG: Add a script to reimport the LGA boundaries from the GADM.org data
The original import of the LGA boundaries from the GADM.org data was
missing some polygons: some LGAs were entirely without geometry. My
assumption (since I don't have the GADM ddata from that time) is that
these polygons were invalid in some way ... | Python | agpl-3.0 | mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola | ---
+++
@@ -0,0 +1,59 @@
+from django.contrib.gis.gdal import DataSource
+from django.core.management import BaseCommand
+from django.db import transaction
+
+from mapit.management.command_utils import save_polygons, fix_invalid_geos_geometry
+from mapit.models import Area, Type
+
+class Command(BaseCommand):
+ he... | |
816872186966186eb463d1fd45bea3a4c6f68e00 | demoproject/tests_demo.py | demoproject/tests_demo.py | from demoproject.urls import urlpatterns
from django.test import Client, TestCase
class DemoProject_TestCase(TestCase):
def setUp(self):
self.client = Client()
def test_all_views_load(self):
"""
A simple sanity test to make sure all views from demoproject
still continu... | Add new sanity test for demoproject views | Add new sanity test for demoproject views
helps boost test coverage but most importantly executes the code
paths that were fixed in 9d9033ecd5a8592a12872293cdf6d710cebf894f
| Python | bsd-2-clause | pgollakota/django-chartit,pgollakota/django-chartit,pgollakota/django-chartit | ---
+++
@@ -0,0 +1,21 @@
+from demoproject.urls import urlpatterns
+from django.test import Client, TestCase
+
+
+class DemoProject_TestCase(TestCase):
+ def setUp(self):
+ self.client = Client()
+
+ def test_all_views_load(self):
+ """
+ A simple sanity test to make sure all views from... | |
959aecd612f66eee22e179f985227dbb6e63202a | __init__.py | __init__.py | from abaqus_model import *
from abaqus_postproc import *
from continuum_analysis import *
from rayleighritz import RayleighRitzDiscrete
from stiffcalc import *
| Move buckling calcs to continuum_analysis | Move buckling calcs to continuum_analysis
| Python | mit | dashdotrobot/bike-wheel-calc | ---
+++
@@ -0,0 +1,5 @@
+from abaqus_model import *
+from abaqus_postproc import *
+from continuum_analysis import *
+from rayleighritz import RayleighRitzDiscrete
+from stiffcalc import * | |
736093f945ff53c4fe6d9d8d2e0c4afc28d9ace3 | chimera/py/leetcode_rotate_list.py | chimera/py/leetcode_rotate_list.py | # coding=utf-8
"""
chimera.leetcode_rotate_list
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Given a list, rotate the list to the right by k places, where k is
non-negative.
For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.
"""
# Definition for singly-linked list.
# class ListNode(object):
# def __... | Add answer to leetcode rotate list | Add answer to leetcode rotate list
| Python | mit | air-upc/chimera,air-upc/chimera | ---
+++
@@ -0,0 +1,43 @@
+# coding=utf-8
+"""
+chimera.leetcode_rotate_list
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Given a list, rotate the list to the right by k places, where k is
+non-negative.
+
+For example:
+Given 1->2->3->4->5->NULL and k = 2,
+return 4->5->1->2->3->NULL.
+
+"""
+
+
+# Definition for singly-linked l... | |
cc19cdc3430df018e3a8fa63abaf796a897a475b | Orange/tests/sql/test_naive_bayes.py | Orange/tests/sql/test_naive_bayes.py | import unittest
from numpy import array
import Orange.classification.naive_bayes as nb
from Orange.data.discretization import DiscretizeTable
from Orange.data.sql.table import SqlTable
from Orange.data.variable import DiscreteVariable
class NaiveBayesTest(unittest.TestCase):
def test_NaiveBayes(self):
t... | Add naive bayes SQL test. | Add naive bayes SQL test.
| Python | bsd-2-clause | kwikadi/orange3,kwikadi/orange3,qPCR4vir/orange3,kwikadi/orange3,cheral/orange3,qusp/orange3,marinkaz/orange3,cheral/orange3,qusp/orange3,kwikadi/orange3,kwikadi/orange3,cheral/orange3,marinkaz/orange3,qPCR4vir/orange3,qPCR4vir/orange3,kwikadi/orange3,marinkaz/orange3,cheral/orange3,qusp/orange3,qPCR4vir/orange3,qPCR4v... | ---
+++
@@ -0,0 +1,29 @@
+import unittest
+
+from numpy import array
+
+import Orange.classification.naive_bayes as nb
+from Orange.data.discretization import DiscretizeTable
+from Orange.data.sql.table import SqlTable
+from Orange.data.variable import DiscreteVariable
+
+
+class NaiveBayesTest(unittest.TestCase):
+ ... | |
f39a640a8d5bf7d4a5d80f94235d1fa7461bd4dc | s3stash/stash_single_image.py | s3stash/stash_single_image.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
import argparse
import logging
import json
from s3stash.nxstashref_image import NuxeoStashImage
def main(argv=None):
parser = argparse.ArgumentParser(description='Produce jp2 version of Nuxeo image file and stash in S3.')
parser.add_argument('path',... | Add code for stashing a single nuxeo image on s3. | Add code for stashing a single nuxeo image on s3.
| Python | bsd-3-clause | barbarahui/nuxeo-calisphere,barbarahui/nuxeo-calisphere | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import sys, os
+import argparse
+import logging
+import json
+from s3stash.nxstashref_image import NuxeoStashImage
+
+def main(argv=None):
+
+ parser = argparse.ArgumentParser(description='Produce jp2 version of Nuxeo image file and stash in... | |
9f7bd49350b0d1b8a8986b28db75a5b369bf7bb5 | py/utf-8-validation.py | py/utf-8-validation.py | class Solution(object):
def validUtf8(self, data):
"""
:type data: List[int]
:rtype: bool
"""
it = iter(data)
while True:
try:
c = it.next() & 0xff
try:
t = 0x80
n = 0
... | Add py solution for 393. UTF-8 Validation | Add py solution for 393. UTF-8 Validation
393. UTF-8 Validation: https://leetcode.com/problems/utf-8-validation/
Approach:
Observe the first item remaining in each step. The value will be added
1 << step either the remaining count is odd or it's a left-to-right
step. Hence the n | 0x55555.. is the key.
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,31 @@
+class Solution(object):
+ def validUtf8(self, data):
+ """
+ :type data: List[int]
+ :rtype: bool
+ """
+ it = iter(data)
+ while True:
+ try:
+ c = it.next() & 0xff
+ try:
+ t = 0x80
+ ... | |
100a03003adf3f425d59b69e95078bd0f1e82193 | test/reopen_screen.py | test/reopen_screen.py | #!/usr/bin/env python
# Test for bug reported by Jeremy Hill in which re-opening the screen
# would cause a segfault.
import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()
from VisionEgg.Core import Screen, Viewport, swap_buffers
import pygame
from pygame.locals import QUIT,KEYDOWN,MOUSEBU... | Add test script for segfault bug reported by Jeremy Hill. | Add test script for segfault bug reported by Jeremy Hill.
git-svn-id: 033d166fe8e629f6cbcd3c0e2b9ad0cffc79b88b@1477 3a63a0ee-37fe-0310-a504-e92b6e0a3ba7
| Python | lgpl-2.1 | visionegg/visionegg,visionegg/visionegg,visionegg/visionegg,visionegg/visionegg,visionegg/visionegg | ---
+++
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+# Test for bug reported by Jeremy Hill in which re-opening the screen
+# would cause a segfault.
+
+import VisionEgg
+VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()
+
+from VisionEgg.Core import Screen, Viewport, swap_buffers
+import pygame
+from pyg... | |
1e7421878e90949abc4f6fac5835bd27b472d2b6 | example_Knudsen.py | example_Knudsen.py | import openpnm as op
import numpy as np
import matplotlib.pyplot as plt
# Get Deff w/o including Knudsen effect
spacing = 1.0
net = op.network.Cubic(shape=[10, 10, 10], spacing=spacing)
geom = op.geometry.StickAndBall(network=net)
air = op.phases.Air(network=net)
phys = op.physics.Standard(network=net, geometry=geom,... | Add example script for the newly added mixed_diffusivity | Add example script for the newly added mixed_diffusivity | Python | mit | TomTranter/OpenPNM,PMEAL/OpenPNM | ---
+++
@@ -0,0 +1,50 @@
+import openpnm as op
+import numpy as np
+import matplotlib.pyplot as plt
+
+
+# Get Deff w/o including Knudsen effect
+spacing = 1.0
+net = op.network.Cubic(shape=[10, 10, 10], spacing=spacing)
+geom = op.geometry.StickAndBall(network=net)
+air = op.phases.Air(network=net)
+phys = op.physic... | |
e1772c008d607a2545ddaa05508b1a74473be0ec | airflow/migrations/versions/7171349d4c73_add_ti_job_id_index.py | airflow/migrations/versions/7171349d4c73_add_ti_job_id_index.py | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | Add TaskInstance index on job_id | [AIRFLOW-1495] Add TaskInstance index on job_id
Column job_id is unindexed in TaskInstance, it was
used as
default sort column in TaskInstanceView.
This commit adds the required migration to add the
index on
task_instance.job_id on future db upgrades.
Closes #2520 from edgarRd/erod-ti-jobid-index
| Python | apache-2.0 | asnir/airflow,janczak10/incubator-airflow,KL-WLCR/incubator-airflow,airbnb/airflow,Acehaidrey/incubator-airflow,jhsenjaliya/incubator-airflow,airbnb/airflow,adamhaney/airflow,mrares/incubator-airflow,Fokko/incubator-airflow,skudriashev/incubator-airflow,mistercrunch/airflow,mtagle/airflow,OpringaoDoTurno/airflow,dhuang... | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable la... | |
e3b7b9e5f8ca1be061c71c764fd62d6aeed3fd43 | tests/test_bqlmath.py | tests/test_bqlmath.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 suite for bqlmath. | Add test suite for bqlmath.
| Python | apache-2.0 | probcomp/bayeslite,probcomp/bayeslite | ---
+++
@@ -0,0 +1,79 @@
+# -*- 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... | |
6be70d01bdf58389db2a6adc4035f82669d02a61 | cms/plugins/googlemap/cms_plugins.py | cms/plugins/googlemap/cms_plugins.py | from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugins.googlemap.models import GoogleMap
from cms.plugins.googlemap.settings import GOOGLE_MAPS_API_KEY
from cms.plugins.googlemap import settings
from django.forms.widgets... | from django.conf import settings
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugins.googlemap.models import GoogleMap
from cms.plugins.googlemap.settings import GOOGLE_MAPS_API_KEY
from django.forms.widgets import Me... | Allow use of GoogleMaps plugin without Multilingual support | Allow use of GoogleMaps plugin without Multilingual support
| Python | bsd-3-clause | cyberintruder/django-cms,chmberl/django-cms,owers19856/django-cms,jproffitt/django-cms,vstoykov/django-cms,MagicSolutions/django-cms,isotoma/django-cms,jproffitt/django-cms,chkir/django-cms,stefanw/django-cms,jeffreylu9/django-cms,divio/django-cms,Vegasvikk/django-cms,jrief/django-cms,pbs/django-cms,farhaadila/django-c... | ---
+++
@@ -1,9 +1,9 @@
+from django.conf import settings
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugins.googlemap.models import GoogleMap
from cms.plugins.googlemap.settings import GOOGLE_MAPS_API_KEY
-fr... |
c15c4a663c257cad6763cf92c50b7ad706017c74 | evesrp/views/__init__.py | evesrp/views/__init__.py | from collections import OrderedDict
from urllib.parse import urlparse
import re
from flask import render_template, redirect, url_for, request, abort, jsonify,\
flash, Markup, session
from flask.views import View
from flask.ext.login import login_user, login_required, logout_user, \
current_user
from fl... | from flask import render_template
from flask.ext.login import login_required
from .. import app
@app.route('/')
@login_required
def index():
return render_template('base.html')
| Remove extraneous imports in the base view package | Remove extraneous imports in the base view package | Python | bsd-2-clause | eskwire/evesrp,eskwire/evesrp,paxswill/evesrp,eskwire/evesrp,paxswill/evesrp,paxswill/evesrp,eskwire/evesrp | ---
+++
@@ -1,26 +1,7 @@
-from collections import OrderedDict
-from urllib.parse import urlparse
-import re
+from flask import render_template
+from flask.ext.login import login_required
-from flask import render_template, redirect, url_for, request, abort, jsonify,\
- flash, Markup, session
-from flask.view... |
295823afe17cedaa1934afbcd19d955974089c63 | python/send.py | python/send.py | #!/usr/bin/env python
import pika
# Host in which RabbitMQ is running.
HOST = 'localhost'
# Name of the queue.
QUEUE = 'pages'
# The message to send.
MESSAGE = 'Hi there! This is a test message =)'
# Getting the connection using pika.
# Creating the channel.
# Declaring the queue.
connection = pika.BlockingConnecti... | Add producer written in Python | Add producer written in Python
| Python | apache-2.0 | jovannypcg/rabbitmq_usage,jovannypcg/rabbitmq_usage | ---
+++
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+import pika
+
+# Host in which RabbitMQ is running.
+HOST = 'localhost'
+
+# Name of the queue.
+QUEUE = 'pages'
+
+# The message to send.
+MESSAGE = 'Hi there! This is a test message =)'
+
+# Getting the connection using pika.
+# Creating the channel.
+# Declaring the... | |
2aa7a6260d9d5a74ee81677be2bd5f97774f9116 | calexicon/internal/tests/test_gregorian.py | calexicon/internal/tests/test_gregorian.py | import unittest
from calexicon.internal.gregorian import is_gregorian_leap_year
class TestGregorian(unittest.TestCase):
def test_is_gregorian_leap_year(self):
self.assertTrue(is_gregorian_leap_year(2000))
self.assertTrue(is_gregorian_leap_year(1984))
self.assertFalse(is_gregorian_leap_yea... | Add tests for internal gregorian functions. | Add tests for internal gregorian functions.
| Python | apache-2.0 | jwg4/calexicon,jwg4/qual | ---
+++
@@ -0,0 +1,12 @@
+import unittest
+
+from calexicon.internal.gregorian import is_gregorian_leap_year
+
+
+class TestGregorian(unittest.TestCase):
+ def test_is_gregorian_leap_year(self):
+ self.assertTrue(is_gregorian_leap_year(2000))
+ self.assertTrue(is_gregorian_leap_year(1984))
+ s... | |
db81e8ca0b0321994f188daf45211e6ae2dda4a4 | dengue/utils/make_titer_strain_control.py | dengue/utils/make_titer_strain_control.py | from Bio import SeqIO
from pprint import pprint
with open('../../data/dengue_titers.tsv', 'r') as f:
titerstrains = set([ line.split()[0] for line in f ])
with open('../../data/dengue_titers.tsv', 'r') as f:
serastrains = set([ line.split()[1] for line in f ])
autologous = titerstrains.intersection(serastrains)
pri... | Make a control dataset that only contains sequences with titer data. | Make a control dataset that only contains sequences with titer data.
| Python | agpl-3.0 | nextstrain/augur,blab/nextstrain-augur,nextstrain/augur,nextstrain/augur | ---
+++
@@ -0,0 +1,16 @@
+from Bio import SeqIO
+from pprint import pprint
+
+with open('../../data/dengue_titers.tsv', 'r') as f:
+ titerstrains = set([ line.split()[0] for line in f ])
+with open('../../data/dengue_titers.tsv', 'r') as f:
+ serastrains = set([ line.split()[1] for line in f ])
+
+autologous = titers... | |
e0b84a97e4c7ad5dcef336080657a884cff603fc | tests/gl_test_2.py | tests/gl_test_2.py | #!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import pyglet.window
from pyglet.window.event import *
import time
from pyglet.GL.VERSION_1_1 import *
from pyglet.GLU.VERSION_1_1 import *
from pyglet import clock
factory = pyglet.window.WindowFactory()
factory.config._attribut... | Test two windows drawing GL with different contexts. | Test two windows drawing GL with different contexts.
--HG--
extra : convert_revision : svn%3A14d46d22-621c-0410-bb3d-6f67920f7d95/trunk%4045
| Python | bsd-3-clause | infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore | ---
+++
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+'''
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import pyglet.window
+from pyglet.window.event import *
+import time
+
+from pyglet.GL.VERSION_1_1 import *
+from pyglet.GLU.VERSION_1_1 import *
+from pyglet import clock
+
+factory = pyglet.win... | |
8affb8e4a3744e604b88157a918ef690203cbfa8 | zerver/migrations/0375_invalid_characters_in_stream_names.py | zerver/migrations/0375_invalid_characters_in_stream_names.py | import unicodedata
from django.db import connection, migrations
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
# There are 66 Unicode non-characters; see
# https://www.unicode.org/faq/private_use.html#nonchar4
unicode_non_chars = set(
chr(x)
... | Remove disallowed characters from stream names. | migrations: Remove disallowed characters from stream names.
character_is_printable logic is taken from similar work by @madrix01
| Python | apache-2.0 | zulip/zulip,andersk/zulip,zulip/zulip,rht/zulip,rht/zulip,andersk/zulip,kou/zulip,zulip/zulip,andersk/zulip,rht/zulip,zulip/zulip,rht/zulip,andersk/zulip,andersk/zulip,zulip/zulip,zulip/zulip,rht/zulip,kou/zulip,kou/zulip,zulip/zulip,kou/zulip,kou/zulip,kou/zulip,andersk/zulip,rht/zulip,rht/zulip,kou/zulip,andersk/zuli... | ---
+++
@@ -0,0 +1,77 @@
+import unicodedata
+
+from django.db import connection, migrations
+from django.db.backends.postgresql.schema import DatabaseSchemaEditor
+from django.db.migrations.state import StateApps
+
+# There are 66 Unicode non-characters; see
+# https://www.unicode.org/faq/private_use.html#nonchar4
+... | |
12c483953f39a3bacaab6d49ba17c4920db52179 | firecares/firestation/management/commands/cleanup_phonenumbers.py | firecares/firestation/management/commands/cleanup_phonenumbers.py | from django.core.management.base import BaseCommand
from firecares.firestation.models import FireDepartment
from phonenumber_field.modelfields import PhoneNumber
import re
"""
This command is for cleaning up every phone and fax number in the
database. It removes all non-numeric characters, such as parenthesis,
hyphens... | Add script to clean up all FD phone and fax numbers. | Add script to clean up all FD phone and fax numbers.
| Python | mit | FireCARES/firecares,HunterConnelly/firecares,HunterConnelly/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,HunterConnelly/firecares,HunterConnelly/firecares | ---
+++
@@ -0,0 +1,38 @@
+from django.core.management.base import BaseCommand
+from firecares.firestation.models import FireDepartment
+from phonenumber_field.modelfields import PhoneNumber
+import re
+
+"""
+This command is for cleaning up every phone and fax number in the
+database. It removes all non-numeric chara... | |
7d128f2386fd3bbcbff1a407018f9ab9ed580810 | tests/test_path.py | tests/test_path.py | from gypsy.path import _join
def test_join():
assert _join('s3://', 'bucket', 'prefix') == 's3://bucket/prefix'
assert _join('s3://bucket', 'prefix') == 's3://bucket/prefix'
assert _join('bucket', 'prefix') == 'bucket/prefix'
| Add tests for path join | Add tests for path join
| Python | mit | tesera/pygypsy,tesera/pygypsy | ---
+++
@@ -0,0 +1,6 @@
+from gypsy.path import _join
+
+def test_join():
+ assert _join('s3://', 'bucket', 'prefix') == 's3://bucket/prefix'
+ assert _join('s3://bucket', 'prefix') == 's3://bucket/prefix'
+ assert _join('bucket', 'prefix') == 'bucket/prefix' | |
08988d19c712ad4604f0acced71a069c7c20067a | zou/app/stores/file_store.py | zou/app/stores/file_store.py | import flask_fs as fs
from zou.app import app
pictures = fs.Storage("pictures", overwrite=True)
movies = fs.Storage("movies", overwrite=True)
pictures.configure(app)
movies.configure(app)
def make_key(prefix, id):
return "%s-%s" % (prefix, id)
def add_picture(prefix, id, path):
key = make_key(prefix, id... | Add kv store for file storage | Add kv store for file storage
| Python | agpl-3.0 | cgwire/zou | ---
+++
@@ -0,0 +1,65 @@
+import flask_fs as fs
+
+from zou.app import app
+
+
+pictures = fs.Storage("pictures", overwrite=True)
+movies = fs.Storage("movies", overwrite=True)
+
+pictures.configure(app)
+movies.configure(app)
+
+
+def make_key(prefix, id):
+ return "%s-%s" % (prefix, id)
+
+
+def add_picture(pref... | |
32c5a681c7dd498204d38d5d1152aa7f67e09069 | taiga/feedback/admin.py | taiga/feedback/admin.py | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program 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 F... | Add feedback entries to the Admin panel | Add feedback entries to the Admin panel
| Python | agpl-3.0 | 19kestier/taiga-back,gauravjns/taiga-back,Zaneh-/bearded-tribble-back,jeffdwyatt/taiga-back,crr0004/taiga-back,CoolCloud/taiga-back,astagi/taiga-back,frt-arch/taiga-back,joshisa/taiga-back,coopsource/taiga-back,rajiteh/taiga-back,astronaut1712/taiga-back,coopsource/taiga-back,astronaut1712/taiga-back,gauravjns/taiga-ba... | ---
+++
@@ -0,0 +1,31 @@
+# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
+# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
+# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public... | |
c6ded12845f25e305789840e1687bfee83e82be5 | tests/test_standings.py | tests/test_standings.py | #!/usr/bin/env python
import pytest
from datetime import datetime
from mlbgame import standings
date = datetime(2017, 5, 15, 19, 4, 59, 367187)
s = standings.Standings(date)
def test_standings_url():
standings_url = 'http://mlb.mlb.com/lookup/json/named.standings_schedule_date.bam?season=2017&' \
'sche... | Add a few simple pytest tests | Add a few simple pytest tests
- These tests should eventually provide unit tests for all classes
| Python | mit | zachpanz88/mlbgame,panzarino/mlbgame | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+import pytest
+from datetime import datetime
+from mlbgame import standings
+
+
+
+date = datetime(2017, 5, 15, 19, 4, 59, 367187)
+s = standings.Standings(date)
+
+def test_standings_url():
+ standings_url = 'http://mlb.mlb.com/lookup/json/named.standings_schedule_... | |
d637cbe9c904fb0f0b67fbc10f66db299d153f4e | tests/functional/test_docs.py | tests/functional/test_docs.py | # Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | Add basic smoke tests for doc generation | Add basic smoke tests for doc generation
| Python | apache-2.0 | boto/boto3 | ---
+++
@@ -0,0 +1,39 @@
+# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
+# the License is located at
+#
+# http://aws.amazon.com/apache2.0/
+#... | |
86d8f0fd48ccb577a8300362ea9d181e63d2fa5d | tests/unit/core/test_issue.py | tests/unit/core/test_issue.py | # -*- coding:utf-8 -*-
#
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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
#
# Unl... | Add unit tests for bandit.core.issue | Add unit tests for bandit.core.issue
Brings coverage for bandit.core.issue to 100%.
Change-Id: I67dfbb64cb276d1c16b28e4bbc6b50c8254bd3f1
| Python | apache-2.0 | stackforge/bandit,chair6/bandit,pombredanne/bandit,pombredanne/bandit,stackforge/bandit | ---
+++
@@ -0,0 +1,65 @@
+# -*- coding:utf-8 -*-
+#
+# Copyright 2015 Hewlett-Packard Development Company, L.P.
+#
+# 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.apa... | |
3ce048f8c0346c30173b52a691bd18ece1cbc13d | scripts/stock_price/tough_question_tfp.py | scripts/stock_price/tough_question_tfp.py | #!/usr/bin/python3
# coding: utf-8
'''
Implementation of the article below with TensorFlow Probability
'Bayesian Methods for Hackers'
https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter2_MorePyMC/Ch2_MorePyMC_PyMC3.ipynb
Based on an example of Ten... | Add a TensorFlow Probability sample | Add a TensorFlow Probability sample
| Python | mit | zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/python3
+# coding: utf-8
+
+'''
+Implementation of the article below with TensorFlow Probability
+'Bayesian Methods for Hackers'
+https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter2_MorePyMC/Ch2_MorePyMC_PyMC3.ipynb
+... | |
2e821ab48542c89ac41ebc17036bddc164506a22 | combine_data/cartesianProductOfIDs.py | combine_data/cartesianProductOfIDs.py | import argparse
import itertools
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generate the cartesian product of two ID files')
parser.add_argument('--idFileA',required=True,type=str,help='First file of IDs')
parser.add_argument('--idFileB',required=True,type=str,help='Second file of IDS'... | Backup of some unused code | Backup of some unused code
| Python | mit | jakelever/knowledgediscovery,jakelever/knowledgediscovery,jakelever/knowledgediscovery,jakelever/knowledgediscovery | ---
+++
@@ -0,0 +1,23 @@
+import argparse
+import itertools
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser(description='Generate the cartesian product of two ID files')
+ parser.add_argument('--idFileA',required=True,type=str,help='First file of IDs')
+ parser.add_argument('--idFileB',required=True,... | |
a1820a0e5f9bd891b20f70ab68dfd4bb385047a0 | utils/multiclassification.py | utils/multiclassification.py | from __future__ import division
import numpy as np
from sklearn.multiclass import OneVsOneClassifier
from sklearn.multiclass import _fit_binary
from sklearn.externals.joblib import Parallel, delayed
from unbalanced_dataset import SMOTE
def _fit_ovo_binary(estimator, X, y, i, j, sampling=None):
"""Fit a single b... | Add utils to allow multiclass classification. | Add utils to allow multiclass classification.
| Python | mit | davidgasquez/kaggle-airbnb | ---
+++
@@ -0,0 +1,64 @@
+from __future__ import division
+
+import numpy as np
+
+from sklearn.multiclass import OneVsOneClassifier
+from sklearn.multiclass import _fit_binary
+from sklearn.externals.joblib import Parallel, delayed
+from unbalanced_dataset import SMOTE
+
+
+def _fit_ovo_binary(estimator, X, y, i, j,... | |
c9b3bd8309d3d1448823787160021a8688e8f3c1 | vv_h5_setup.py | vv_h5_setup.py | import tables
vv_desc = dict(
obsid=tables.IntCol(pos=0),
revision=tables.IntCol(pos=1),
most_recent=tables.IntCol(pos=2),
slot=tables.IntCol(pos=3),
type=tables.StringCol(10,pos=4),
n_pts=tables.IntCol(pos=5),
rad_off=tables.FloatCol(pos=6),
frac_dy_big=tables.FloatCol(pos=7),
frac_dz_big=tables.FloatCol(pos=8),
frac... | Add python to make vv h5 file | Add python to make vv h5 file
| Python | bsd-3-clause | sot/mica,sot/mica | ---
+++
@@ -0,0 +1,30 @@
+import tables
+
+vv_desc = dict(
+obsid=tables.IntCol(pos=0),
+revision=tables.IntCol(pos=1),
+most_recent=tables.IntCol(pos=2),
+slot=tables.IntCol(pos=3),
+type=tables.StringCol(10,pos=4),
+n_pts=tables.IntCol(pos=5),
+rad_off=tables.FloatCol(pos=6),
+frac_dy_big=tables.FloatCol(pos=7),
+f... | |
d48035b06b952b9ac4d95897d08de50d5977bf9f | tests/basics/ordereddict1.py | tests/basics/ordereddict1.py | try:
from collections import OrderedDict
except ImportError:
try:
from _collections import OrderedDict
except ImportError:
print("SKIP")
import sys
sys.exit()
d = OrderedDict([(10, 20), ("b", 100), (1, 2)])
print(list(d.keys()))
print(list(d.values()))
del d["b"]
print(list(... | Add basic test for OrderedDict. | tests: Add basic test for OrderedDict.
Mostly to have coverage of newly added code in map.c.
| Python | mit | selste/micropython,mgyenik/micropython,swegener/micropython,dhylands/micropython,feilongfl/micropython,neilh10/micropython,jmarcelino/pycom-micropython,paul-xxx/micropython,tdautc19841202/micropython,blmorris/micropython,ceramos/micropython,Timmenem/micropython,noahchense/micropython,tdautc19841202/micropython,emfcamp/... | ---
+++
@@ -0,0 +1,16 @@
+try:
+ from collections import OrderedDict
+except ImportError:
+ try:
+ from _collections import OrderedDict
+ except ImportError:
+ print("SKIP")
+ import sys
+ sys.exit()
+
+d = OrderedDict([(10, 20), ("b", 100), (1, 2)])
+print(list(d.keys()))
+print(... | |
645efb8ffcc3c9a3e41db2619430ffcb7a6d570f | src/ggrc/migrations/versions/20160314140338_4fd36860d196_add_finished_date_to_request_and_.py | src/ggrc/migrations/versions/20160314140338_4fd36860d196_add_finished_date_to_request_and_.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.com
"""
add finished date to request and assessment
Create Date: 2016-03-14 14:... | Migrate Req/Ass to have verified/finished date | Migrate Req/Ass to have verified/finished date
| Python | apache-2.0 | andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,prasannav7/ggrc-core,prasannav... | ---
+++
@@ -0,0 +1,52 @@
+# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+# Created By: andraz@reciprocitylabs.com
+# Maintained By: andraz@reciprocitylabs.com
+
+"""
+add finished date to request and asses... | |
37baa669ed1e00fabddd33478fa75f4047075ce3 | cs473vision/ObjectDetector.py | cs473vision/ObjectDetector.py | '''
Created on Feb 28, 2014
@author: Vance Zuo
'''
import numpy
import cv2
class ObjectDetector(object):
'''
classdocs
'''
def __init__(self, params):
'''
Constructor
'''
self.bg_img = None
self.fg_img = None
return
def load_image(self, b... | Create Python object detection script. | Create Python object detection script.
| Python | mit | vancezuo/cs473-vision | ---
+++
@@ -0,0 +1,45 @@
+'''
+Created on Feb 28, 2014
+
+@author: Vance Zuo
+'''
+
+import numpy
+import cv2
+
+class ObjectDetector(object):
+ '''
+ classdocs
+ '''
+
+
+ def __init__(self, params):
+ '''
+ Constructor
+ '''
+ self.bg_img = None
+ self.fg_img = None
+ ... | |
94d40dfcf574d61df7def99a43d5b9fa0c75e244 | py/queue-reconstruction-by-height.py | py/queue-reconstruction-by-height.py | from collections import defaultdict
class Solution(object):
def insert(self, now, p, front):
lsize = 0 if now.left is None else now.left.val[1]
if front <= lsize:
if now.left is None:
now.left = TreeNode((p, 1))
else:
self.insert(now.left, p, f... | Add py solution for 406. Queue Reconstruction by Height | Add py solution for 406. Queue Reconstruction by Height
406. Queue Reconstruction by Height: https://leetcode.com/problems/queue-reconstruction-by-height/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,37 @@
+from collections import defaultdict
+class Solution(object):
+ def insert(self, now, p, front):
+ lsize = 0 if now.left is None else now.left.val[1]
+ if front <= lsize:
+ if now.left is None:
+ now.left = TreeNode((p, 1))
+ else:
+ ... | |
76ce9117ed92a743734cd5ba7e209617a7664ad1 | benchmarks/bench_gala.py | benchmarks/bench_gala.py | import os
from gala import imio, features, agglo, classify
rundir = os.path.dirname(__file__)
dd = os.path.abspath(os.path.join(rundir, '../tests/example-data'))
em3d = features.default.paper_em()
def setup_trdata():
wstr = imio.read_h5_stack(os.path.join(dd, 'train-ws.lzf.h5'))
prtr = imio.read_h5_stack... | Add partial benchmarking file for gala | Add partial benchmarking file for gala
| Python | bsd-3-clause | janelia-flyem/gala,jni/gala | ---
+++
@@ -0,0 +1,67 @@
+import os
+
+from gala import imio, features, agglo, classify
+
+
+rundir = os.path.dirname(__file__)
+dd = os.path.abspath(os.path.join(rundir, '../tests/example-data'))
+
+
+em3d = features.default.paper_em()
+
+
+def setup_trdata():
+ wstr = imio.read_h5_stack(os.path.join(dd, 'train-w... | |
197fb6ec004c0bf47ec7e2fd25b75564a3ecf6c4 | test/audit_logs/test_audit_log.py | test/audit_logs/test_audit_log.py | import datetime
import pytest
from girder import auditLogger
@pytest.fixture
def recordModel():
from girder.plugins.audit_logs import Record
yield Record()
@pytest.fixture
def resetLog():
yield auditLogger
for handler in auditLogger.handlers:
auditLogger.removeHandler(handler)
@pytest.mar... | Add tests for logging of rest requests | Add tests for logging of rest requests
| Python | apache-2.0 | RafaelPalomar/girder,manthey/girder,manthey/girder,Kitware/girder,girder/girder,kotfic/girder,jbeezley/girder,manthey/girder,Kitware/girder,data-exp-lab/girder,jbeezley/girder,data-exp-lab/girder,Kitware/girder,RafaelPalomar/girder,kotfic/girder,girder/girder,RafaelPalomar/girder,kotfic/girder,manthey/girder,RafaelPalo... | ---
+++
@@ -0,0 +1,66 @@
+import datetime
+import pytest
+from girder import auditLogger
+
+
+@pytest.fixture
+def recordModel():
+ from girder.plugins.audit_logs import Record
+ yield Record()
+
+
+@pytest.fixture
+def resetLog():
+ yield auditLogger
+
+ for handler in auditLogger.handlers:
+ audi... | |
3ef1e39d476a8b3e41ff0b06dcd6f700c083682d | data_controller/abc.py | data_controller/abc.py | from typing import Dict, Optional
from data_controller.enums import Medium, Site
from utils.helpers import await_func
class DataController:
"""
An ABC for all classes that deals with database read write.
"""
__slots__ = ()
def get_identifier(self, query: str,
medium: Mediu... | Add an ABC for all sub classes of `DataController` | Add an ABC for all sub classes of `DataController`
| Python | mit | MaT1g3R/Roboragi | ---
+++
@@ -0,0 +1,109 @@
+from typing import Dict, Optional
+
+from data_controller.enums import Medium, Site
+from utils.helpers import await_func
+
+
+class DataController:
+ """
+ An ABC for all classes that deals with database read write.
+ """
+ __slots__ = ()
+
+ def get_identifier(self, query: ... | |
785a5767ee3482fddee37327b4bf3edeed94ff46 | db/shootout_attempt.py | db/shootout_attempt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import uuid
from db.common import Base
from db.specific_event import SpecificEvent
from db.player import Player
from db.team import Team
class ShootoutAttempt(Base, SpecificEvent):
__tablename__ = 'shootout_attempts'
__autoload__ = True
STANDARD_ATTRS = [
... | Add shootout attempt item definition | Add shootout attempt item definition
| Python | mit | leaffan/pynhldb | ---
+++
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import uuid
+
+from db.common import Base
+from db.specific_event import SpecificEvent
+from db.player import Player
+from db.team import Team
+
+
+class ShootoutAttempt(Base, SpecificEvent):
+ __tablename__ = 'shootout_attempts'
+ __au... | |
125c75ea246c2d95f0addbb31b2d82dde588f21d | tests/test_kaggle_kernel_credentials.py | tests/test_kaggle_kernel_credentials.py | import unittest
from kaggle_secrets import GcpTarget
from kaggle_gcp import KaggleKernelCredentials
class TestKaggleKernelCredentials(unittest.TestCase):
def test_default_target(self):
creds = KaggleKernelCredentials()
self.assertEqual(GcpTarget.BIGQUERY, creds.target)
| Add a unit test for KaggleKernelCredentials. | Add a unit test for KaggleKernelCredentials.
| Python | apache-2.0 | Kaggle/docker-python,Kaggle/docker-python | ---
+++
@@ -0,0 +1,10 @@
+import unittest
+
+from kaggle_secrets import GcpTarget
+from kaggle_gcp import KaggleKernelCredentials
+
+class TestKaggleKernelCredentials(unittest.TestCase):
+
+ def test_default_target(self):
+ creds = KaggleKernelCredentials()
+ self.assertEqual(GcpTarget.BIGQUERY, cred... | |
fbbaa3fc5b99eed88e039c232f129aaeab0a6f54 | tests/test_table.py | tests/test_table.py | #!/usr/bin/env python3
import nose.tools as nose
from table import Table
def test_init_default():
"""should initialize table with required parameters and default values"""
table = Table(num_cols=5, width=78)
nose.assert_equal(table.num_cols, 5)
nose.assert_equal(table.width, 78)
nose.assert_equal... | Bring table test coverage to 100% | Bring table test coverage to 100%
| Python | mit | caleb531/cache-simulator | ---
+++
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+
+import nose.tools as nose
+from table import Table
+
+
+def test_init_default():
+ """should initialize table with required parameters and default values"""
+ table = Table(num_cols=5, width=78)
+ nose.assert_equal(table.num_cols, 5)
+ nose.assert_equal(... | |
e56a9781f4e7e8042c29c9e54966659c87c5c05c | tests/test_views.py | tests/test_views.py | import pytest
from django.core.urlresolvers import reverse
def test_site_view(client):
response = client.get(reverse('site-home'))
assert response.status_code == 200
assert 'landings/home_site.html' in [template.name for template in response.templates]
| Add a test for our more general views. | Add a test for our more general views.
| Python | apache-2.0 | hello-base/web,hello-base/web,hello-base/web,hello-base/web | ---
+++
@@ -0,0 +1,9 @@
+import pytest
+
+from django.core.urlresolvers import reverse
+
+
+def test_site_view(client):
+ response = client.get(reverse('site-home'))
+ assert response.status_code == 200
+ assert 'landings/home_site.html' in [template.name for template in response.templates] | |
1043acdfe324e02bc2a8629ef8a47d6ae9befd7c | src/aiy/_drivers/_ecc608_pubkey.py | src/aiy/_drivers/_ecc608_pubkey.py | #!/usr/bin/env python3
import base64
import ctypes
import sys
CRYPTO_ADDRESS_DICT = {
'Vision Bonnet': 0x60,
'Voice Bonnet': 0x62,
}
class AtcaIfaceCfgLong(ctypes.Structure):
_fields_ = (
('iface_type', ctypes.c_ulong),
('devtype', ctypes.c_ulong),
('slave_address', ctypes.c_ubyte... | Add python script to get ECC608 Public Key | Add python script to get ECC608 Public Key
Change-Id: I0826503e9b8d1bb5de3f83b82d0083754a7e2b8f
| Python | apache-2.0 | google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+import base64
+import ctypes
+import sys
+
+CRYPTO_ADDRESS_DICT = {
+ 'Vision Bonnet': 0x60,
+ 'Voice Bonnet': 0x62,
+}
+
+
+class AtcaIfaceCfgLong(ctypes.Structure):
+ _fields_ = (
+ ('iface_type', ctypes.c_ulong),
+ ('devtype', ctypes.c_ulong)... | |
d9e11e2c5f14cee0ead87ced9afe85bdd299ab35 | extract_text.py | extract_text.py | import json
f=open('raw.json')
g=open('extracted1','a')
i=1
for s in f:
j=json.loads(s)
j=j['text']
h=json.dumps(j)
number=str(i) + ':' + ' '
g.write(h)
g.write('\n\n')
i=i+1
| Add python script to extract | Add python script to extract | Python | mit | sukanyapatra/Disatweet | ---
+++
@@ -0,0 +1,12 @@
+import json
+f=open('raw.json')
+g=open('extracted1','a')
+i=1
+for s in f:
+ j=json.loads(s)
+ j=j['text']
+ h=json.dumps(j)
+ number=str(i) + ':' + ' '
+ g.write(h)
+ g.write('\n\n')
+ i=i+1 | |
a70490e52bde05d2afc6ea59416a50e11119d060 | raggregate/rg_migrations/versions/002_Add_metadata_to_Comment_to_allow_it_to_masquerade_as_epistle.py | raggregate/rg_migrations/versions/002_Add_metadata_to_Comment_to_allow_it_to_masquerade_as_epistle.py | from sqlalchemy import *
from migrate import *
from raggregate.guid_recipe import GUID
def upgrade(migrate_engine):
meta = MetaData(bind=migrate_engine)
comments = Table('comments', meta, autoload=True)
unreadc = Column('unread', Boolean, default=True)
in_reply_toc = Column('in_reply_to', GUID, nullabl... | Add migration for Comment schema upgrade. ... | Add migration for Comment schema upgrade. ...
This allows Comment to masquerade as an epistle and is required to use
the last several commits. I forgot to push the migration out. :p
| Python | apache-2.0 | sjuxax/raggregate | ---
+++
@@ -0,0 +1,18 @@
+from sqlalchemy import *
+from migrate import *
+from raggregate.guid_recipe import GUID
+
+def upgrade(migrate_engine):
+ meta = MetaData(bind=migrate_engine)
+ comments = Table('comments', meta, autoload=True)
+ unreadc = Column('unread', Boolean, default=True)
+ in_reply_toc =... | |
6d3f6951d846c50fcc1ff011f9129a4e1e3f7de1 | testing/test_storm_bmi.py | testing/test_storm_bmi.py | #! /usr/bin/env python
#
# Tests for the BMI version of `storm`.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper (mark.piper@colorado.edu)
from nose.tools import *
import os
import shutil
from subprocess import call
# Global variables
start_dir = os.getcwd()
data_dir = os.path.join(start_dir, 'testing', 'data')
inp... | Add unit tests for BMI version of storm | Add unit tests for BMI version of storm
| Python | mit | mdpiper/storm,csdms-contrib/storm,mdpiper/storm,csdms-contrib/storm | ---
+++
@@ -0,0 +1,73 @@
+#! /usr/bin/env python
+#
+# Tests for the BMI version of `storm`.
+#
+# Call with:
+# $ nosetests -sv
+#
+# Mark Piper (mark.piper@colorado.edu)
+
+from nose.tools import *
+import os
+import shutil
+from subprocess import call
+
+# Global variables
+start_dir = os.getcwd()
+data_dir = os... | |
086371f56748da9fb68acc4aaa10094b6cf24fcb | tests/unit/returners/test_pgjsonb.py | tests/unit/returners/test_pgjsonb.py | # -*- coding: utf-8 -*-
'''
tests.unit.returners.pgjsonb_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unit tests for the PGJsonb returner (pgjsonb).
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt Testing libs
from tests.support.mixins impo... | Revert "Remove pgjsonb returner unit tests" | Revert "Remove pgjsonb returner unit tests"
This reverts commit ab4a670ff22878d5115f408baf0304a0ba3ec994.
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+'''
+tests.unit.returners.pgjsonb_test
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Unit tests for the PGJsonb returner (pgjsonb).
+'''
+
+# Import Python libs
+from __future__ import absolute_import, print_function, unicode_literals
+import logging
+
+# Import Salt Tes... | |
722b1d55c771e628ba82bbd5b8f8f5de047112af | tests/hexdumper.py | tests/hexdumper.py | # This hack by: Raymond Hettinger
class hexdumper:
"""Given a byte array, turn it into a string. hex bytes to stdout."""
def __init__(self):
self.FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' \
for x in range(256)])
def dump(self, src, length=8):
result=[]
for i in xrange(0, len(src... | Add a hex dump utility class. | Add a hex dump utility class.
| Python | bsd-3-clause | gvnn3/PCS,gvnn3/PCS | ---
+++
@@ -0,0 +1,16 @@
+# This hack by: Raymond Hettinger
+class hexdumper:
+ """Given a byte array, turn it into a string. hex bytes to stdout."""
+ def __init__(self):
+ self.FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' \
+ for x in range(256)])
+
+ def dump(self, src, length=8):
+ r... | |
8660c7fda8cc7290fadeed7a39f06218087d9401 | tests/test_linter.py | tests/test_linter.py | import logging
import pytest
from mappyfile.validator import Validator
def validate(d):
v = Validator()
return v.validate(d)
def get_from_dict(d, keys):
for k in keys:
if isinstance(k, int):
d = d[0]
else:
d = d[k]
return d
def run_tests():
pytest.main([... | Add draft test module for linter | Add draft test module for linter
| Python | mit | geographika/mappyfile,geographika/mappyfile | ---
+++
@@ -0,0 +1,27 @@
+import logging
+import pytest
+from mappyfile.validator import Validator
+
+
+def validate(d):
+ v = Validator()
+ return v.validate(d)
+
+
+def get_from_dict(d, keys):
+ for k in keys:
+ if isinstance(k, int):
+ d = d[0]
+ else:
+ d = d[k]
+ r... | |
ad7f9f785f9a4a4494127a9b2196e1fc64c9f3de | tests/test_report.py | tests/test_report.py | from django.test import TestCase
from deep_collector.core import RelatedObjectsCollector
from .factories import BaseModelFactory
class TestLogReportGeneration(TestCase):
def test_report_with_no_debug_mode(self):
obj = BaseModelFactory.create()
collector = RelatedObjectsCollector()
colle... | Add basic first tests for new report driven by "events" | Add basic first tests for new report driven by "events"
| Python | bsd-3-clause | iwoca/django-deep-collector | ---
+++
@@ -0,0 +1,33 @@
+from django.test import TestCase
+
+from deep_collector.core import RelatedObjectsCollector
+
+from .factories import BaseModelFactory
+
+
+class TestLogReportGeneration(TestCase):
+ def test_report_with_no_debug_mode(self):
+ obj = BaseModelFactory.create()
+
+ collector = ... | |
4683fc67d5171d8bb0391ac45f587fbc3e3c97fc | install_dependencies.py | install_dependencies.py | import platform
import subprocess
"""
This is a standalone script that installs the required dependencies to run. It
*should* be platform independent, and should work regardless of what platform
you are running it on.
To install dependencies, download the DevAssist source and run this script by
running "python instal... | Add dependency installer for linux and mac osx | Add dependency installer for linux and mac osx
| Python | mit | GCI-2015-GPW/DevAssist | ---
+++
@@ -0,0 +1,51 @@
+import platform
+import subprocess
+
+"""
+This is a standalone script that installs the required dependencies to run. It
+*should* be platform independent, and should work regardless of what platform
+you are running it on.
+
+To install dependencies, download the DevAssist source and run t... | |
0fd7cdee45b54551bcfc901cece2e5cc9dec4555 | test/test_setup.py | test/test_setup.py | import os
import django
os.environ['DJANGO_SETTINGS_MODULE'] = 'testsettings'
# run django setup if we are on a version of django that has it
if hasattr(django, 'setup'):
# setup doesn't like being run more than once
try:
django.setup()
except RuntimeError:
pass | Add new test setup required for py.test/django test setup | Add new test setup required for py.test/django test setup
| Python | apache-2.0 | emory-libraries/eulcommon,emory-libraries/eulcommon | ---
+++
@@ -0,0 +1,12 @@
+import os
+import django
+
+os.environ['DJANGO_SETTINGS_MODULE'] = 'testsettings'
+
+# run django setup if we are on a version of django that has it
+if hasattr(django, 'setup'):
+ # setup doesn't like being run more than once
+ try:
+ django.setup()
+ except RuntimeError:
+ ... | |
dbfa14401c0b50eb1a3cac413652cb975ee9d41f | ocw-ui/backend/tests/test_directory_helpers.py | ocw-ui/backend/tests/test_directory_helpers.py | import os
import unittest
from webtest import TestApp
from ..run_webservices import app
from ..directory_helpers import _get_clean_directory_path
test_app = TestApp(app)
class TestDirectoryPathCleaner(unittest.TestCase):
PATH_LEADER = '/tmp/foo'
VALID_CLEAN_DIR = '/tmp/foo/bar'
if not os.path.exists(PAT... | Add valid directory cleaner helper test | Add valid directory cleaner helper test
git-svn-id: https://svn.apache.org/repos/asf/incubator/climate/trunk@1563517 13f79535-47bb-0310-9956-ffa450edef68
Former-commit-id: a23ba7556854cb30faaa0dfc19fdbcc6cb67382c | Python | apache-2.0 | huikyole/climate,agoodm/climate,MJJoyce/climate,MBoustani/climate,agoodm/climate,MJJoyce/climate,kwhitehall/climate,MBoustani/climate,lewismc/climate,agoodm/climate,pwcberry/climate,MBoustani/climate,Omkar20895/climate,MJJoyce/climate,agoodm/climate,kwhitehall/climate,lewismc/climate,pwcberry/climate,huikyole/climate,r... | ---
+++
@@ -0,0 +1,19 @@
+import os
+import unittest
+from webtest import TestApp
+
+from ..run_webservices import app
+from ..directory_helpers import _get_clean_directory_path
+
+test_app = TestApp(app)
+
+class TestDirectoryPathCleaner(unittest.TestCase):
+ PATH_LEADER = '/tmp/foo'
+ VALID_CLEAN_DIR = '/tmp/... | |
f4d26567afc9185e0f9370eda43d30084437ade5 | CodeFights/makeArrayConsecutive2.py | CodeFights/makeArrayConsecutive2.py | #!/usr/local/bin/python
# Code Fights Make Array Consecutive 2 Problem
def makeArrayConsecutive2(statues):
return (len(range(min(statues), max(statues) + 1)) - len(statues))
def main():
tests = [
[[6, 2, 3, 8], 3],
[[0, 3], 2],
[[5, 4, 6], 0],
[[6, 3], 2],
[[1], 0]
... | Solve Code Fights make array consecutive 2 problem | Solve Code Fights make array consecutive 2 problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/local/bin/python
+# Code Fights Make Array Consecutive 2 Problem
+
+
+def makeArrayConsecutive2(statues):
+ return (len(range(min(statues), max(statues) + 1)) - len(statues))
+
+
+def main():
+ tests = [
+ [[6, 2, 3, 8], 3],
+ [[0, 3], 2],
+ [[5, 4, 6], 0],
... | |
aafd823069176075b4810496ee98cea3203b5652 | build_time/src/make_subset.py | build_time/src/make_subset.py | """
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... | Make a command to make subsets. Subsets are useful for testing during development. | Make a command to make subsets. Subsets are useful for testing during development.
| Python | apache-2.0 | googlei18n/TachyFont,moyogo/tachyfont,googlefonts/TachyFont,moyogo/tachyfont,googlei18n/TachyFont,moyogo/tachyfont,bstell/TachyFont,moyogo/tachyfont,googlefonts/TachyFont,moyogo/tachyfont,googlei18n/TachyFont,bstell/TachyFont,googlei18n/TachyFont,googlei18n/TachyFont,bstell/TachyFont,googlefonts/TachyFont,bstell/TachyF... | ---
+++
@@ -0,0 +1,70 @@
+"""
+ Copyright 2014 Google Inc. All rights reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ ... | |
0091af78bd191e34ecb621b20e79d6dd3d32ebb6 | tests/test_core.py | tests/test_core.py | #!/usr/bin/env python
from __future__ import division
from unittest import TestCase, main
from metasane.core import VocabularySet
class VocabularySetTests(TestCase):
def setUp(self):
"""Initialize data used in the tests."""
self.single_vocab = {'vocab_1': VOCAB_1.split('\n')}
self.multi_vo... | Add unit tests for VocabularySet | Add unit tests for VocabularySet
| Python | bsd-3-clause | clemente-lab/metasane | ---
+++
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+from __future__ import division
+
+from unittest import TestCase, main
+from metasane.core import VocabularySet
+
+class VocabularySetTests(TestCase):
+ def setUp(self):
+ """Initialize data used in the tests."""
+ self.single_vocab = {'vocab_1': VOCAB... | |
1f9240f0b954afa9f587f468872c3e1e215f2eaa | txircd/modules/cmode_s.py | txircd/modules/cmode_s.py | from txircd.modbase import Mode
class SecretMode(Mode):
def listOutput(self, command, data):
if command != "LIST":
return data
cdata = data["cdata"]
if "s" in cdata["modes"] and cdata["name"] not in data["user"].channels:
data["cdata"] = {}
# other +s stuff is hiding in other modules.
class Spawner(obje... | Implement channel mode +s (or what's left of it) | Implement channel mode +s (or what's left of it)
| Python | bsd-3-clause | Heufneutje/txircd,DesertBus/txircd,ElementalAlchemist/txircd | ---
+++
@@ -0,0 +1,29 @@
+from txircd.modbase import Mode
+
+class SecretMode(Mode):
+ def listOutput(self, command, data):
+ if command != "LIST":
+ return data
+ cdata = data["cdata"]
+ if "s" in cdata["modes"] and cdata["name"] not in data["user"].channels:
+ data["cdata"] = {}
+ # other +s stuff is hiding ... | |
d082eb41c2ccef7178d228896a7658fe52bcbdec | tests/UselessSymbolsRemove/__init__.py | tests/UselessSymbolsRemove/__init__.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 17.08.2017 14:38
:Licence GNUv3
Part of grammpy-transforms
""" | Create directory for useless symbols remove | Create directory for useless symbols remove
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 17.08.2017 14:38
+:Licence GNUv3
+Part of grammpy-transforms
+
+""" | |
fefb9a9fa5a7c6080bc52896e2d1517828b01a3d | migrations/versions/299e1d15a55f_populate_provincial_legislatures.py | migrations/versions/299e1d15a55f_populate_provincial_legislatures.py | """populate-provincial-legislatures
Revision ID: 299e1d15a55f
Revises: 1f97f799a477
Create Date: 2018-08-20 16:17:28.919476
"""
# revision identifiers, used by Alembic.
revision = '299e1d15a55f'
down_revision = '1f97f799a477'
from alembic import op
import sqlalchemy as sa
def upgrade():
"""
Ensure all pro... | Add all PLs to db | Migration: Add all PLs to db
| Python | apache-2.0 | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | ---
+++
@@ -0,0 +1,79 @@
+"""populate-provincial-legislatures
+
+Revision ID: 299e1d15a55f
+Revises: 1f97f799a477
+Create Date: 2018-08-20 16:17:28.919476
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '299e1d15a55f'
+down_revision = '1f97f799a477'
+
+from alembic import op
+import sqlalchemy as sa
+
... | |
6c9760b328716d6b2e099698293c93cba9361932 | checkserver/testchecks/check_error.py | checkserver/testchecks/check_error.py | #!/usr/bin/env python
# Copyright 2012 The greplin-nagios-utils Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | Add script for testing error reporting. | Add script for testing error reporting.
| Python | apache-2.0 | Cue/greplin-nagios-utils,Cue/greplin-nagios-utils | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+# Copyright 2012 The greplin-nagios-utils Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licen... | |
ac7c5f51e270e48d3be9363a7c65b4b2f019c90c | contrib_bots/bots/xkcd/test_xkcd.py | contrib_bots/bots/xkcd/test_xkcd.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import mock
import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..... | Add tests for xkcd bot. | contrib_bots: Add tests for xkcd bot.
| Python | apache-2.0 | shubhamdhama/zulip,shubhamdhama/zulip,verma-varsha/zulip,punchagan/zulip,vabs22/zulip,shubhamdhama/zulip,vaidap/zulip,brockwhittaker/zulip,rishig/zulip,punchagan/zulip,synicalsyntax/zulip,hackerkid/zulip,brainwane/zulip,jrowan/zulip,amanharitsh123/zulip,punchagan/zulip,brainwane/zulip,rishig/zulip,synicalsyntax/zulip,r... | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+from __future__ import absolute_import
+from __future__ import print_function
+
+import mock
+import os
+import sys
+
+our_dir = os.path.dirname(os.path.abspath(__file__))
+# For dev setups, we can find the API in the repo itself.
+if os.path.exists(os.path.join(our_... | |
280aa4c8db7b5580b73ab6980f10d21a6ef2d761 | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/PyGameOutput.py | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/PyGameOutput.py | import numpy
import Numeric
import pygame
import Axon
import time
class PyGameOutput(Axon.ThreadedComponent.threadedcomponent):
bufferSize = 1024
sampleRate = 44100
def __init__(self, **argd):
super(PyGameOutput, self).__init__(**argd)
pygame.mixer.init(self.sampleRate, -16, 1, self.bufferS... | Add an audio output using the pygame mixer. This abuses pygame to a fair extent, but works reasonably with large-ish buffer sizes. | Add an audio output using the pygame mixer. This abuses pygame to a fair extent, but works reasonably with large-ish buffer sizes.
| 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,35 @@
+import numpy
+import Numeric
+import pygame
+import Axon
+import time
+
+class PyGameOutput(Axon.ThreadedComponent.threadedcomponent):
+ bufferSize = 1024
+ sampleRate = 44100
+ def __init__(self, **argd):
+ super(PyGameOutput, self).__init__(**argd)
+ pygame.mixer.ini... | |
4433cadaa39dd84b922329c84a7e791d81cac7c6 | nettests/simpletest.py | nettests/simpletest.py | from ooni import nettest
class SimpleTest(nettest.TestCase):
inputs = range(1,100)
optParameters = [['asset', 'a', None, 'Asset file'],
['controlserver', 'c', 'google.com', 'Specify the control server'],
['resume', 'r', 0, 'Resume at this index'],
[... | Add a very simple test that *must* always pass. * Useful for testing the newstyle API | Add a very simple test that *must* always pass.
* Useful for testing the newstyle API
| Python | bsd-2-clause | Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,hackerberry/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-pr... | ---
+++
@@ -0,0 +1,19 @@
+from ooni import nettest
+class SimpleTest(nettest.TestCase):
+ inputs = range(1,100)
+ optParameters = [['asset', 'a', None, 'Asset file'],
+ ['controlserver', 'c', 'google.com', 'Specify the control server'],
+ ['resume', 'r', 0, 'Resume at thi... | |
8ccf3d937d25ec93d1ce22d60735ffbcaf776fe3 | analysis/plot-target-distance.py | analysis/plot-target-distance.py | import climate
import itertools
import lmj.plot
import numpy as np
import source as experiment
import plots
@climate.annotate(
root='plot data from this experiment subjects',
pattern=('plot data from files matching this pattern', 'option'),
markers=('plot data for these mocap markers', 'option'),
tar... | Add a script for plotting distance to target. | Add a script for plotting distance to target.
| Python | mit | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | ---
+++
@@ -0,0 +1,26 @@
+import climate
+import itertools
+import lmj.plot
+import numpy as np
+
+import source as experiment
+import plots
+
+
+@climate.annotate(
+ root='plot data from this experiment subjects',
+ pattern=('plot data from files matching this pattern', 'option'),
+ markers=('plot data for ... | |
74550ef0c76a941c473c8d024ccc0a0403631c49 | wqflask/tests/integration/test_markdown_routes.py | wqflask/tests/integration/test_markdown_routes.py | "Integration tests for markdown routes"
import unittest
from bs4 import BeautifulSoup
from wqflask import app
class TestGenMenu(unittest.TestCase):
"""Tests for glossary"""
def setUp(self):
self.app = app.test_client()
def tearDown(self):
pass
def test_glossary_page(self):
... | Add basic structure for "/glossary" routes test | Add basic structure for "/glossary" routes test
| Python | agpl-3.0 | zsloan/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2 | ---
+++
@@ -0,0 +1,21 @@
+"Integration tests for markdown routes"
+import unittest
+
+from bs4 import BeautifulSoup
+
+from wqflask import app
+
+
+class TestGenMenu(unittest.TestCase):
+ """Tests for glossary"""
+
+ def setUp(self):
+ self.app = app.test_client()
+
+ def tearDown(self):
+ pass... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.