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 |
|---|---|---|---|---|---|---|---|---|---|---|
e4efa5a447e85c11723991870bd6fc632bc97ed5 | us_ignite/common/templatetags/common_markdown.py | us_ignite/common/templatetags/common_markdown.py | from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from us_ignite.common import output
register = template.Library()
@register.filter(is_safe=True)
@stringfilter
def markdown(value):
return mark_safe(output.to_html(value))
| Add template tag to render ``markdown``. | Add template tag to render ``markdown``.
| Python | bsd-3-clause | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite | ---
+++
@@ -0,0 +1,13 @@
+from django import template
+from django.template.defaultfilters import stringfilter
+from django.utils.safestring import mark_safe
+
+from us_ignite.common import output
+
+register = template.Library()
+
+
+@register.filter(is_safe=True)
+@stringfilter
+def markdown(value):
+ return mar... | |
2cdc649d810e49c3879ec055741b1bdd909c55e0 | feincms/management/commands/rebuild_mptt.py | feincms/management/commands/rebuild_mptt.py | # ------------------------------------------------------------------------
# coding=utf-8
# $Id$
# ------------------------------------------------------------------------
from django.core.management.base import NoArgsCommand
from django.db import transaction
from feincms.module.page.models import Page
class Command... | Add a command to rebuild the mptt tree. | Add a command to rebuild the mptt tree.
Only for emergencies to get your tree back in useable state should anything happen to the node indexes.
| Python | bsd-3-clause | mjl/feincms,matthiask/django-content-editor,michaelkuty/feincms,matthiask/feincms2-content,nickburlett/feincms,matthiask/feincms2-content,michaelkuty/feincms,joshuajonah/feincms,joshuajonah/feincms,hgrimelid/feincms,hgrimelid/feincms,michaelkuty/feincms,feincms/feincms,pjdelport/feincms,nickburlett/feincms,matthiask/dj... | ---
+++
@@ -0,0 +1,45 @@
+# ------------------------------------------------------------------------
+# coding=utf-8
+# $Id$
+# ------------------------------------------------------------------------
+
+from django.core.management.base import NoArgsCommand
+from django.db import transaction
+
+from feincms.module.pa... | |
92fd6c4785523a6891aa02eed460451552fb186e | scripts/tag_lyrics.py | scripts/tag_lyrics.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# needs mutagen
# grabbed from: http://code.activestate.com/recipes/577138-embed-lyrics-into-mp3-files-using-mutagen-uslt-tag/
# simplified to only work on one file and get lyrics from stdin
import os
import sys
import codecs
from mutagen.mp3 import MP3
from mutagen.id3 ... | Add a little script to create test files with lyrics. | Add a little script to create test files with lyrics.
git-svn-id: 793bb72743a407948e3701719c462b6a765bc435@3088 35dc7657-300d-0410-a2e5-dc2837fedb53
| Python | lgpl-2.1 | Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123 | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# needs mutagen
+# grabbed from: http://code.activestate.com/recipes/577138-embed-lyrics-into-mp3-files-using-mutagen-uslt-tag/
+# simplified to only work on one file and get lyrics from stdin
+
+import os
+import sys
+import codecs
+from mu... | |
ac3ef2ed9d8fd5418a5f7365dde78afc7a9ae29c | getMoisture.py | getMoisture.py | #!/usr/bin/python
import spidev
import time
import RPi.GPIO as GPIO
import datetime
import time
#je potreba nastavit SPI na raspberry
#GPIO
GPIO.setmode(GPIO.BOARD)
pin = 11
GPIO.setup(pin,GPIO.OUT)
GPIO.output(pin,True)
# Open SPI bus
spi = spidev.SpiDev()
spi.open(0,0)
# Function to read SPI data from MCP3008 ... | Add script for soil moisture sensors. | Add script for soil moisture sensors.
| Python | lgpl-2.1 | TomasBedrnik/Meteo-Backend,TomasBedrnik/Meteo-Backend,TomasBedrnik/Meteo-Backend | ---
+++
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+
+import spidev
+import time
+import RPi.GPIO as GPIO
+import datetime
+import time
+
+#je potreba nastavit SPI na raspberry
+
+#GPIO
+GPIO.setmode(GPIO.BOARD)
+pin = 11
+GPIO.setup(pin,GPIO.OUT)
+GPIO.output(pin,True)
+
+# Open SPI bus
+spi = spidev.SpiDev()
+spi.open(0,... | |
6abdfdd5f33aaaf05df4821ae14f594cb5b826a7 | src/test/swarm_test.py | src/test/swarm_test.py | import unittest
import pyoptima as opt
class SwarmTest(unittest.TestCase):
def test_swarm_with_parabola(self):
hyper_params = {'phi_local': 1, 'phi_global': 1, 'omega': 0.01}
params = {'x0': (-1, 1), 'x1': (-1, 1)}
num_particles = 100
s = opt.Swarm(params, hyper_params, num_parti... | Add python test for swarm optimisation | Add python test for swarm optimisation
This will still need to be hooked into the main build system
| Python | mit | samueljackson92/optima,samueljackson92/metaopt,samueljackson92/optima,samueljackson92/metaopt | ---
+++
@@ -0,0 +1,34 @@
+import unittest
+import pyoptima as opt
+
+
+class SwarmTest(unittest.TestCase):
+
+ def test_swarm_with_parabola(self):
+ hyper_params = {'phi_local': 1, 'phi_global': 1, 'omega': 0.01}
+ params = {'x0': (-1, 1), 'x1': (-1, 1)}
+ num_particles = 100
+
+ s = op... | |
b0c8a5b114837ae9b6f4d7e81fc587ac0d1fc3a4 | test/test_hpack_structures.py | test/test_hpack_structures.py | # -*- coding: utf-8 -*-
from hyper.http20.hpack_structures import Reference
class TestReference(object):
"""
Tests of the HPACK reference structure.
"""
def test_references_can_be_created(self):
r = Reference(None)
assert r
def test_two_references_to_the_same_object_compare_equal(s... | Test the HPACK reference structure. | Test the HPACK reference structure.
| Python | mit | fredthomsen/hyper,jdecuyper/hyper,plucury/hyper,jdecuyper/hyper,lawnmowerlatte/hyper,plucury/hyper,fredthomsen/hyper,irvind/hyper,masaori335/hyper,masaori335/hyper,Lukasa/hyper,lawnmowerlatte/hyper,irvind/hyper,Lukasa/hyper | ---
+++
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+from hyper.http20.hpack_structures import Reference
+
+class TestReference(object):
+ """
+ Tests of the HPACK reference structure.
+ """
+ def test_references_can_be_created(self):
+ r = Reference(None)
+ assert r
+
+ def test_two_refere... | |
a233f685f6cb514420fd534388d51ee92459d886 | src/diamond/__init__.py | src/diamond/__init__.py | # coding=utf-8
import os
import sys
import string
import logging
import time
import traceback
import configobj
import socket
import re
import os
import sys
import re
import logging
import time
import datetime
import random
import urllib2
import base64
import csv
import platform
import string
import traceback
import co... | # coding=utf-8
"""
Diamond module init code
"""
import os
import sys
import logging
import time
import traceback
import configobj
import socket
import re
import datetime
import random
import urllib2
import base64
import csv
import platform
from urlparse import urlparse
| Remove duplicate imports and remove entirly unused string | Remove duplicate imports and remove entirly unused string
| Python | mit | szibis/Diamond,russss/Diamond,TAKEALOT/Diamond,szibis/Diamond,signalfx/Diamond,dcsquared13/Diamond,python-diamond/Diamond,eMerzh/Diamond-1,jumping/Diamond,codepython/Diamond,socialwareinc/Diamond,actmd/Diamond,cannium/Diamond,Slach/Diamond,eMerzh/Diamond-1,saucelabs/Diamond,zoidbergwill/Diamond,disqus/Diamond,bmhatfiel... | ---
+++
@@ -1,28 +1,22 @@
# coding=utf-8
+
+"""
+Diamond module init code
+"""
import os
import sys
-import string
import logging
import time
import traceback
import configobj
import socket
import re
-import os
-import sys
-import re
-import logging
-import time
import datetime
import random
import urll... |
ce1f05c9943b365e35758502a38122ffe02c0d85 | prefix_sums/min_slice.py | prefix_sums/min_slice.py | # It is required to find the position of a slice with min avg in the
# numerical sequence. There is a mathematical proof for such problem
# where only slices of 2 and 3 elements are taken into account.
# Having that, solution become really simple.
def get_prefix_sum(A):
result = [0] * (len(A) + 1)
for i in xr... | Add min avg slice solution. | Add min avg slice solution.
| Python | apache-2.0 | isendel/algorithms | ---
+++
@@ -0,0 +1,26 @@
+# It is required to find the position of a slice with min avg in the
+# numerical sequence. There is a mathematical proof for such problem
+# where only slices of 2 and 3 elements are taken into account.
+# Having that, solution become really simple.
+def get_prefix_sum(A):
+ result = [... | |
05864894b876a679726f1063832f70cfecb4325e | py/print-binary-tree.py | py/print-binary-tree.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def printTree(self, root):
"""
:type root: TreeNode
:rtype: List[List[str]]
"""
q... | Add py solution for 655. Print Binary Tree | Add py solution for 655. Print Binary Tree
655. Print Binary Tree: https://leetcode.com/problems/print-binary-tree/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,31 @@
+# Definition for a binary tree node.
+# class TreeNode(object):
+# def __init__(self, x):
+# self.val = x
+# self.left = None
+# self.right = None
+
+class Solution(object):
+ def printTree(self, root):
+ """
+ :type root: TreeNode
+ :rtype... | |
9645b58b73e689efafd50ee2681beb813f3e410d | tests/test_complex_dtypes.py | tests/test_complex_dtypes.py | import logging
import sys
import uuid
import numpy as np
import pytest
import rasterio
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
@pytest.fixture(scope='function')
def tempfile():
"""A temporary filename in the GDAL '/vsimem' filesystem"""
return '/vsimem/{}'.format(uuid.uuid4())
def co... | Add test of complex types | Add test of complex types
| Python | bsd-3-clause | brendan-ward/rasterio,brendan-ward/rasterio,brendan-ward/rasterio | ---
+++
@@ -0,0 +1,38 @@
+import logging
+import sys
+import uuid
+
+import numpy as np
+import pytest
+
+import rasterio
+
+
+logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
+
+
+@pytest.fixture(scope='function')
+def tempfile():
+ """A temporary filename in the GDAL '/vsimem' filesystem"""
+ retur... | |
f888799f4c88952f3ee77578fc1aface8eb4b067 | olympiad/bestfit.py | olympiad/bestfit.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 Fabian M.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | Add solution for problem C1 | Add solution for problem C1
| Python | apache-2.0 | fabianm/olympiad,fabianm/olympiad,fabianm/olympiad | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright 2014 Fabian M.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/lic... | |
726cae5bfbb4a53ba979babc87e681b19562112e | lib/reinteract/format_escaped.py | lib/reinteract/format_escaped.py | #
# Very, very partial implementation of g_markup_printf_escaped(). Doesn't
# handling things like a %c with an integer argument that evaluates to
# a markup special character, or special characters in the repr() or str()
# of an object. It also doesn't handle %(name)s type arguments with
# keyword arguments.
#
# To do... | Add a simple implementation of functionality like g_markup_printf_escaped() | Add a simple implementation of functionality like
g_markup_printf_escaped()
| Python | bsd-2-clause | rschroll/reinteract,johnrizzo1/reinteract,jbaayen/reinteract,alexey4petrov/reinteract,alexey4petrov/reinteract,rschroll/reinteract,alexey4petrov/reinteract,jbaayen/reinteract,rschroll/reinteract,jbaayen/reinteract,johnrizzo1/reinteract,johnrizzo1/reinteract | ---
+++
@@ -0,0 +1,30 @@
+#
+# Very, very partial implementation of g_markup_printf_escaped(). Doesn't
+# handling things like a %c with an integer argument that evaluates to
+# a markup special character, or special characters in the repr() or str()
+# of an object. It also doesn't handle %(name)s type arguments wit... | |
fbace843f6febaea28f35511035c8c997ba0fdab | queues/priority_queue.py | queues/priority_queue.py | """
Implementation of priority queue
"""
class PriorityQueueNode:
def __init__(self, data, priority):
self.data = data
self.priority = priority
def __repr__(self):
return str(self.data) + ": " + str(self.priority)
class PriorityQueue:
def __init__(self):
self.priority_queue_list = []
def size(self):
... | Add priority queue implementation using lists | Add priority queue implementation using lists
| Python | mit | keon/algorithms,amaozhao/algorithms | ---
+++
@@ -0,0 +1,41 @@
+"""
+Implementation of priority queue
+"""
+
+class PriorityQueueNode:
+ def __init__(self, data, priority):
+ self.data = data
+ self.priority = priority
+
+ def __repr__(self):
+ return str(self.data) + ": " + str(self.priority)
+
+class PriorityQueue:
+ def __init__(self):
+ self.pri... | |
d662bf8ddcdd78b6cc75ea7b6731f5ac2379645d | rflink1.py | rflink1.py | import serial
import time
import logging
import re
logging.basicConfig(filename='debug.log',level=logging.DEBUG)
def readlineCR(port):
rv = ""
while True:
ch = port.read().decode()
rv += ch
if ch=='\r':
rv = rv.strip('\r').strip('\n')
return rv
def sendData(data,p... | Test python script to get data from Rflink. | Test python script to get data from Rflink.
| Python | apache-2.0 | matt2005/pyrflink | ---
+++
@@ -0,0 +1,54 @@
+import serial
+import time
+import logging
+import re
+logging.basicConfig(filename='debug.log',level=logging.DEBUG)
+def readlineCR(port):
+ rv = ""
+ while True:
+ ch = port.read().decode()
+ rv += ch
+ if ch=='\r':
+ rv = rv.strip('\r').strip('\n')
+ ... | |
4e0af69b8803e798fe1a90ea8c261cbcd85d149d | languages/python/talking-clock.py | languages/python/talking-clock.py | #!/usr/bin/env python3
#
# Talking clock, using my Google Home device as a media player.
#
import pychromecast, uuid, time, datetime
#
# Get list of all Chromecast devices.
# The local computer must be in the same Wi-Fi network.
#
def print_all_chromecasts():
all_cast_devices = pychromecast.get_chromecasts()
p... | Add talking clock via Chromecast. | Add talking clock via Chromecast.
| Python | apache-2.0 | sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-o... | ---
+++
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3
+#
+# Talking clock, using my Google Home device as a media player.
+#
+import pychromecast, uuid, time, datetime
+
+#
+# Get list of all Chromecast devices.
+# The local computer must be in the same Wi-Fi network.
+#
+def print_all_chromecasts():
+ all_cast_devices... | |
69978f33eb1b7fb7c24d06da33cec1ee48667bef | train/labs/acp-workshop/scripts/centos.py | train/labs/acp-workshop/scripts/centos.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
PRIMARY_OS = 'CENTOS-7.0'
CS_ENGINE = '''#!/bin/sh
#
FQDN="{fqdn}"
export DEBIAN_FRONTEND=noninteractive
# locale
sudo locale-gen en_US.UTF-8
# /etc/hostname - /etc/hosts
sed -i "1 c\\127.0.0.1 $FQDN localhost" /etc/hosts
echo $FQDN > /etc/hostname
service hostname rest... | Add CentOS config for acp-workshop | Add CentOS config for acp-workshop
Signed-off-by: Jerry Baker <aaf88dc49a82ab24b325ac267fdcf59a36abcb76@docker.com>
| Python | apache-2.0 | curtisz/train,curtisz/train,anokun7/train,kizbitz/train,kizbitz/train,danielpalstra/train,danielpalstra/train,anokun7/train | ---
+++
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+PRIMARY_OS = 'CENTOS-7.0'
+CS_ENGINE = '''#!/bin/sh
+#
+FQDN="{fqdn}"
+
+export DEBIAN_FRONTEND=noninteractive
+
+# locale
+sudo locale-gen en_US.UTF-8
+
+# /etc/hostname - /etc/hosts
+sed -i "1 c\\127.0.0.1 $FQDN localhost" /etc/hosts
+echo ... | |
d03d4bf0ca7ec4d66868f384d6864c9fb456cb84 | src/test_io.py | src/test_io.py | import RPi.GPIO as GPIO
import time
# This test is made for a quick check of the gpios
# List of the in channels to test. When pressed they output a message.
in_chanels = []
# A list of output channels to test. These whill be switched on and off in a pattern.
out_chanels = []
def switch_called(channel):
print 'Edg... | Test for rudimentary io tests added | Test for rudimentary io tests added
| Python | apache-2.0 | baumartig/vpn_switcher,baumartig/vpn_switcher | ---
+++
@@ -0,0 +1,29 @@
+import RPi.GPIO as GPIO
+import time
+
+# This test is made for a quick check of the gpios
+
+# List of the in channels to test. When pressed they output a message.
+in_chanels = []
+
+# A list of output channels to test. These whill be switched on and off in a pattern.
+out_chanels = []
+
+... | |
089208e4cb85da5b85c20242097cbe7f0c0e0ece | fabfile.py | fabfile.py | #!/usr/bin/env python2
#-*- coding: utf-8 -*-
import os
from fabric.api import local, task
from pylua.settings import LOG_CONFIG
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
SRC_DIR = 'pylua'
TESTS_DIR = os.path.join(SRC_DIR, 'test')
LOG_CONFIG_PATH = os.path.join(ROOT_DIR, SRC_DIR, LOG_CONFIG)
@task
def ... | Add fab file with two tasks: test_all, run_test | Add fab file with two tasks: test_all, run_test
| Python | mit | malirod/pylua,malirod/pylua | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python2
+#-*- coding: utf-8 -*-
+
+import os
+from fabric.api import local, task
+from pylua.settings import LOG_CONFIG
+
+ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
+SRC_DIR = 'pylua'
+TESTS_DIR = os.path.join(SRC_DIR, 'test')
+LOG_CONFIG_PATH = os.path.join(ROOT_... | |
d38751f466f2b76f71dc716b85cdd1ffbabd481d | cpro/migrations/0015_auto_20170217_0801.py | cpro/migrations/0015_auto_20170217_0801.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import cpro.models
class Migration(migrations.Migration):
dependencies = [
('cpro', '0014_auto_20170129_2236'),
]
operations = [
migrations.AlterField(
model_name='card',... | Add 2 new skills: concentration and all round, with sentences in English and Japanese | Add 2 new skills: concentration and all round, with sentences in English and Japanese
| Python | apache-2.0 | SchoolIdolTomodachi/CinderellaProducers,SchoolIdolTomodachi/CinderellaProducers | ---
+++
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import cpro.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('cpro', '0014_auto_20170129_2236'),
+ ]
+
+ operations = [
+ migrations.... | |
1875c5f1a813abda0ecf52b5b2604011fe2f2c15 | Examples/Scripting/PostJob/Sample/Sample.py | Examples/Scripting/PostJob/Sample/Sample.py | #Python.NET
###############################################################
# This is an Python.net/CPython script. #
# To use IronPython, remove "#Python.NET" from the first #
# line of this file. Make sure you don't use the quotes. #
####################################################... | Add a sample Pre/Post job | Add a sample Pre/Post job
| Python | apache-2.0 | ThinkboxSoftware/Deadline,ThinkboxSoftware/Deadline,ThinkboxSoftware/Deadline | ---
+++
@@ -0,0 +1,22 @@
+#Python.NET
+###############################################################
+# This is an Python.net/CPython script. #
+# To use IronPython, remove "#Python.NET" from the first #
+# line of this file. Make sure you don't use the quotes. #
+###################... | |
8bebea72536a8a6fc480631d737f2426f52a356c | Lib/fontTools/ttLib/tables/_k_e_r_n_test.py | Lib/fontTools/ttLib/tables/_k_e_r_n_test.py | from __future__ import print_function, absolute_import
from fontTools.misc.py23 import *
from fontTools import ttLib
import unittest
from ._k_e_r_n import KernTable_format_0
class MockFont(object):
def getGlyphOrder(self):
return ["glyph00000", "glyph00001", "glyph00002", "glyph00003"]
... | Test for load a kern table with a bad glyph id. | Test for load a kern table with a bad glyph id.
| Python | mit | googlefonts/fonttools,fonttools/fonttools | ---
+++
@@ -0,0 +1,29 @@
+from __future__ import print_function, absolute_import
+from fontTools.misc.py23 import *
+from fontTools import ttLib
+import unittest
+from ._k_e_r_n import KernTable_format_0
+
+class MockFont(object):
+
+ def getGlyphOrder(self):
+ return ["glyph00000", "glyph00001"... | |
7d89303fddd12fc88fd04bcf27826c3c801b1eff | scripts/import_submissions.py | scripts/import_submissions.py | #!/usr/bin/env python
# Copyright (C) 2012 Lukas Lalinsky
# Distributed under the MIT license, see the LICENSE file for details.
import json
from acoustid.script import run_script
from acoustid.data.submission import import_queued_submissions
logger = logging.getLogger(__name__)
def main(script, opts, args):
c... | Add a dummy script for continuous submission importing | Add a dummy script for continuous submission importing
| Python | mit | lalinsky/acoustid-server,lalinsky/acoustid-server,lalinsky/acoustid-server,lalinsky/acoustid-server | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2012 Lukas Lalinsky
+# Distributed under the MIT license, see the LICENSE file for details.
+
+import json
+from acoustid.script import run_script
+from acoustid.data.submission import import_queued_submissions
+
+logger = logging.getLogger(__name__)
... | |
206454788c6d054f8c562d4d5d13a737d9cb6d27 | tests/sentry/api/serializers/test_project.py | tests/sentry/api/serializers/test_project.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import six
from sentry.api.serializers import serialize
from sentry.api.serializers.models.project import (
ProjectWithOrganizationSerializer, ProjectWithTeamSerializer
)
from sentry.testutils import TestCase
class ProjectSerializerTest(TestCase):
... | Add tests for project serializer | test(projects): Add tests for project serializer
| Python | bsd-3-clause | beeftornado/sentry,ifduyue/sentry,gencer/sentry,ifduyue/sentry,beeftornado/sentry,gencer/sentry,mvaled/sentry,mvaled/sentry,gencer/sentry,looker/sentry,gencer/sentry,beeftornado/sentry,gencer/sentry,mvaled/sentry,looker/sentry,ifduyue/sentry,ifduyue/sentry,mvaled/sentry,looker/sentry,mvaled/sentry,looker/sentry,ifduyue... | ---
+++
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import absolute_import
+
+import six
+
+from sentry.api.serializers import serialize
+from sentry.api.serializers.models.project import (
+ ProjectWithOrganizationSerializer, ProjectWithTeamSerializer
+)
+from sentry.testutils import TestCase
+
+... | |
f5b185fa2bba29efe3c1db2cd6c6a50188be24e3 | tests/test_unlocking.py | tests/test_unlocking.py | # Tests for SecretStorage
# Author: Dmitry Shachnev, 2018
# License: BSD
import unittest
from secretstorage import dbus_init, get_any_collection
from secretstorage.util import BUS_NAME
from secretstorage.exceptions import LockedException
@unittest.skipIf(BUS_NAME == "org.freedesktop.secrets",
"This... | Add a basic test for locking and unlocking | Add a basic test for locking and unlocking
To improve test coverage.
| Python | bsd-3-clause | mitya57/secretstorage | ---
+++
@@ -0,0 +1,24 @@
+# Tests for SecretStorage
+# Author: Dmitry Shachnev, 2018
+# License: BSD
+
+import unittest
+
+from secretstorage import dbus_init, get_any_collection
+from secretstorage.util import BUS_NAME
+from secretstorage.exceptions import LockedException
+
+
+@unittest.skipIf(BUS_NAME == "org.freed... | |
085efb9bfe476232695cb66ddf28d6c1a6f84c2f | core/migrations/0005_auto_20170506_1026.py | core/migrations/0005_auto_20170506_1026.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-06 14:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20170426_1717'),
]
operations = [
... | Add migration for Model changes. | Add migration for Model changes.
| Python | bsd-2-clause | cdubz/timestrap,cdubz/timestrap,cdubz/timestrap,muhleder/timestrap,Leahelisabeth/timestrap,muhleder/timestrap,Leahelisabeth/timestrap,muhleder/timestrap,overshard/timestrap,overshard/timestrap,Leahelisabeth/timestrap,overshard/timestrap,Leahelisabeth/timestrap | ---
+++
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11 on 2017-05-06 14:26
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0004_auto_2017... | |
3bc86ca5bd302103a57b6e2829d549aa1e243766 | go/apps/jsbox/tests/test_forms.py | go/apps/jsbox/tests/test_forms.py | from django.test import TestCase
from go.apps.jsbox.forms import JsboxForm
class JsboxFormTestCase(TestCase):
def test_to_metdata(self):
form = JsboxForm(data={
'javascript': 'x = 1;',
})
self.assertTrue(form.is_valid())
metadata = form.to_metadata()
self.asser... | Add basic test for jsbox forms. | Add basic test for jsbox forms.
| Python | bsd-3-clause | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | ---
+++
@@ -0,0 +1,16 @@
+from django.test import TestCase
+
+from go.apps.jsbox.forms import JsboxForm
+
+
+class JsboxFormTestCase(TestCase):
+ def test_to_metdata(self):
+ form = JsboxForm(data={
+ 'javascript': 'x = 1;',
+ })
+ self.assertTrue(form.is_valid())
+ metadata ... | |
a6712ce13b0c6e62488adf0ae13fabf986a1b890 | imgsort.py | imgsort.py | #!/usr/bin/env python3
import os
import shutil
from PIL import Image
whitelist = (
(1366, 768),
(1600, 900),
(1680, 1050),
(1920, 1080),
(1920, 1200),
)
def split(directory):
filemap = {dimensions: set() for dimensions in whitelist}
filemap['others'] = set()
makepath = lambda filena... | Add simple script to sort images | Add simple script to sort images
| Python | mit | ranisalt/imgsort | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+import os
+import shutil
+from PIL import Image
+
+
+whitelist = (
+ (1366, 768),
+ (1600, 900),
+ (1680, 1050),
+ (1920, 1080),
+ (1920, 1200),
+)
+
+
+def split(directory):
+ filemap = {dimensions: set() for dimensions in whitelist}
+ filemap['o... | |
004d8fc6edae142cff7d26e53a79183b1ca29a5b | src/greplin/defer/wait.py | src/greplin/defer/wait.py | # Copyright 2010 Greplin, Inc. All Rights Reserved.
"""Mixin for waiting on deferreds, and cancelling them if needed."""
class WaitMixin(object):
"""Mixin for waiting on deferreds, and cancelling them if needed."""
__currentWait = None
def _wait(self, deferred):
"""Waits for the given deferred."""
... | Migrate greplin.defer's remaining used code to greplin-twisted-utils | Migrate greplin.defer's remaining used code to greplin-twisted-utils
| Python | apache-2.0 | Cue/greplin-twisted-utils | ---
+++
@@ -0,0 +1,28 @@
+# Copyright 2010 Greplin, Inc. All Rights Reserved.
+
+"""Mixin for waiting on deferreds, and cancelling them if needed."""
+
+
+
+class WaitMixin(object):
+ """Mixin for waiting on deferreds, and cancelling them if needed."""
+
+ __currentWait = None
+
+
+ def _wait(self, deferred):
+ ... | |
6a08dc8ae70ebb7d759514991033a54e35ef0a93 | bin/desi_make_bricks.py | bin/desi_make_bricks.py | #!/usr/bin/env python
#
# See top-level LICENSE file for Copyright information
#
# -*- coding: utf-8 -*-
import argparse
import desispec.io
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--fibermap', default = None, metavar = 'FILE',... | #!/usr/bin/env python
#
# See top-level LICENSE file for Copyright information
#
# -*- coding: utf-8 -*-
import argparse
import os.path
import glob
import desispec.io
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--verbose', action ... | Update brick maker to use new meta functionality | Update brick maker to use new meta functionality
| Python | bsd-3-clause | profxj/desispec,timahutchinson/desispec,profxj/desispec,gdhungana/desispec,desihub/desispec,gdhungana/desispec,timahutchinson/desispec,desihub/desispec | ---
+++
@@ -5,22 +5,47 @@
# -*- coding: utf-8 -*-
import argparse
+import os.path
+import glob
import desispec.io
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
- parser.add_argument('--fibermap', default = None, metavar = 'FILE',
- help... |
af127fa56d2ce9304034e19ed2e0a598d10bebba | tests/tests_cyclus.py | tests/tests_cyclus.py | #! /usr/bin/env python
import os
from tests_list import sim_files
from cyclus_tools import run_cyclus, db_comparator
"""Tests"""
def test_cyclus():
"""Test for all inputs in sim_files. Checks if reference and current cyclus
output is the same.
WARNING: the tests require cyclus executable to be included... | Add main regression test file for cyclus | Add main regression test file for cyclus
| Python | bsd-3-clause | Baaaaam/cyBaM,gonuke/cycamore,gonuke/cycamore,cyclus/cycaless,Baaaaam/cyCLASS,gonuke/cycamore,rwcarlsen/cycamore,gonuke/cycamore,jlittell/cycamore,rwcarlsen/cycamore,Baaaaam/cyBaM,Baaaaam/cycamore,Baaaaam/cyBaM,jlittell/cycamore,Baaaaam/cycamore,jlittell/cycamore,Baaaaam/cycamore,Baaaaam/cyCLASS,jlittell/cycamore,cyclu... | ---
+++
@@ -0,0 +1,24 @@
+#! /usr/bin/env python
+
+import os
+
+from tests_list import sim_files
+from cyclus_tools import run_cyclus, db_comparator
+
+"""Tests"""
+def test_cyclus():
+ """Test for all inputs in sim_files. Checks if reference and current cyclus
+ output is the same.
+
+ WARNING: the tests ... | |
ad5f851b7959f7bf09d7cd669d8db126fa962982 | pymatgen/symmetry/tests/test_spacegroup.py | pymatgen/symmetry/tests/test_spacegroup.py | #!/usr/bin/env python
'''
Created on Mar 12, 2012
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Mar 12, 2012"
import unittest
import os
from pymatg... | Add a unittest for spacegroup. Still very basic. | Add a unittest for spacegroup. Still very basic.
| Python | mit | migueldiascosta/pymatgen,yanikou19/pymatgen,sonium0/pymatgen,migueldiascosta/pymatgen,ctoher/pymatgen,sonium0/pymatgen,Dioptas/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,yanikou19/pymatgen,Bismarrck/pymatgen,sonium0/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,Dioptas/pymatgen,Bismarrck/pymatgen,ctoher/pymatgen,mig... | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+'''
+Created on Mar 12, 2012
+'''
+
+from __future__ import division
+
+__author__="Shyue Ping Ong"
+__copyright__ = "Copyright 2012, The Materials Project"
+__version__ = "0.1"
+__maintainer__ = "Shyue Ping Ong"
+__email__ = "shyue@mit.edu"
+__date__ = "Mar 12, 2012... | |
e1e90a8d704666613e6f2f6aaf839724af05cc19 | tools/create_token.py | tools/create_token.py | #!/usr/bin/env python
import argparse
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.backends import default_backend
import scitokens
# Arguments:
def add_args():
parser = argparse.ArgumentParser(description='Create a new SciToken')
parser.add_argument('claims', meta... | Add CLI tool for creating SciTokens. | Add CLI tool for creating SciTokens.
| Python | apache-2.0 | scitokens/scitokens,scitokens/scitokens | ---
+++
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+import argparse
+
+from cryptography.hazmat.primitives import serialization
+from cryptography.hazmat.backends import default_backend
+
+import scitokens
+
+# Arguments:
+
+def add_args():
+
+ parser = argparse.ArgumentParser(description='Create a new SciToken... | |
29f32ec5cc3b050d6307688995907d094966b369 | indra/sources/sofia/make_sofia_ontology.py | indra/sources/sofia/make_sofia_ontology.py | import sys
import json
from os.path import join, dirname, abspath
from rdflib import Graph, Namespace, Literal
from indra.sources import sofia
# Note that this is just a placeholder, it doesn't resolve as a URL
sofia_ns = Namespace('http://cs.cmu.edu/sofia/')
indra_ns = 'http://sorger.med.harvard.edu/indra/'
indra_re... | Add script to make SOFIA ontology | Add script to make SOFIA ontology
| Python | bsd-2-clause | sorgerlab/indra,bgyori/indra,sorgerlab/belpy,pvtodorov/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/indra,bgyori/indra,johnbachman/belpy,pvtodorov/indra,johnbachman/belpy,sorgerlab/indra,pvtodorov/indra,johnbachman/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/indra,bgyori/indra | ---
+++
@@ -0,0 +1,47 @@
+import sys
+import json
+from os.path import join, dirname, abspath
+from rdflib import Graph, Namespace, Literal
+from indra.sources import sofia
+
+
+# Note that this is just a placeholder, it doesn't resolve as a URL
+sofia_ns = Namespace('http://cs.cmu.edu/sofia/')
+indra_ns = 'http://so... | |
7a01615d50ec374687a5676e53e103eff9082b3e | kivy/core/clipboard/clipboard_xsel.py | kivy/core/clipboard/clipboard_xsel.py | '''
Clipboard xsel: an implementation of the Clipboard using xsel command line tool.
'''
__all__ = ('ClipboardXsel', )
from kivy.utils import platform
from kivy.core.clipboard import ClipboardBase
if platform != 'linux':
raise SystemError('unsupported platform for xsel clipboard')
try:
import subprocess
... | '''
Clipboard xsel: an implementation of the Clipboard using xsel command line tool.
'''
__all__ = ('ClipboardXsel', )
from kivy.utils import platform
from kivy.core.clipboard import ClipboardBase
if platform != 'linux':
raise SystemError('unsupported platform for xsel clipboard')
try:
import subprocess
... | Fix return get_types for ClipboardXsel | Fix return get_types for ClipboardXsel | Python | mit | gonzafirewall/kivy,LogicalDash/kivy,aron-bordin/kivy,jffernandez/kivy,VinGarcia/kivy,vipulroxx/kivy,jehutting/kivy,rafalo1333/kivy,matham/kivy,matham/kivy,MiyamotoAkira/kivy,mSenyor/kivy,kivy/kivy,thezawad/kivy,bionoid/kivy,LogicalDash/kivy,aron-bordin/kivy,bionoid/kivy,bionoid/kivy,KeyWeeUsr/kivy,arlowhite/kivy,Farkal... | ---
+++
@@ -30,4 +30,4 @@
p.communicate(data)
def get_types(self):
- return list('text/plain',)
+ return [u'text/plain'] |
a71807789bd09181369fff8b18b3ab5544ba58dd | locations/spiders/sunloan.py | locations/spiders/sunloan.py | # -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
DAYS={
'Monday':'Mo',
'Tuesday':'Tu',
'Wednesday':'We',
'Friday':'Fr',
'Thursday':'Th',
'Saturday':'Sa',
'Sunday':'Su',
}
class SunLoanSpider(scrapy.Spider):
name = "sunloan"
a... | Add spider for Sun Loan Company | Add spider for Sun Loan Company
| Python | mit | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | ---
+++
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+import re
+
+from locations.items import GeojsonPointItem
+
+DAYS={
+ 'Monday':'Mo',
+ 'Tuesday':'Tu',
+ 'Wednesday':'We',
+ 'Friday':'Fr',
+ 'Thursday':'Th',
+ 'Saturday':'Sa',
+ 'Sunday':'Su',
+}
+
+class SunLoanSpid... | |
66a0622ba63d89b6cfcfa74f7b342f4df55c5045 | src/sponsors/migrations/0004_auto_20160501_1632.py | src/sponsors/migrations/0004_auto_20160501_1632.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-05-01 16:32
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0003_auto_20160427_0722'),
]
operations = [
migrations.AlterModelOptions... | Add missing migration for sponsors | Add missing migration for sponsors
| Python | mit | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.3 on 2016-05-01 16:32
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sponsors', '0003_auto_20160427_0722'),
+ ]
+
+ operations... | |
df8e3a2b6f7c8dbb0b93e06e204e802104aad70f | faker/providers/date_time/ru_RU/__init__.py | faker/providers/date_time/ru_RU/__init__.py | # coding: utf-8
from __future__ import unicode_literals
from .. import Provider as DateTimeProvider
class Provider(DateTimeProvider):
@classmethod
def day_of_week(cls):
day = cls.date('%w')
DAY_NAMES = {
"0": "Воскресенье",
"1": "Понедельник",
"2": "Вторни... | Add russian words for date_time | Add russian words for date_time
| Python | mit | joke2k/faker,joke2k/faker,danhuss/faker,trtd/faker | ---
+++
@@ -0,0 +1,41 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .. import Provider as DateTimeProvider
+
+
+class Provider(DateTimeProvider):
+
+ @classmethod
+ def day_of_week(cls):
+ day = cls.date('%w')
+ DAY_NAMES = {
+ "0": "Воскресенье",
+ "1"... | |
d6cf9df23e8c9e3b6a8d261ea79dfe16cfa1dbb1 | numba/tests/test_redefine.py | numba/tests/test_redefine.py | from numba import *
import unittest
class TestRedefine(unittest.TestCase):
def test_redefine(self):
def foo(x):
return x + 1
jfoo = jit(int32(int32))(foo)
# Test original function
self.assertTrue(jfoo(1), 2)
jfoo = jit(int32(int32))(foo)
# Test re-c... | Add test for function re-definition | Add test for function re-definition
| Python | bsd-2-clause | IntelLabs/numba,GaZ3ll3/numba,stuartarchibald/numba,pitrou/numba,seibert/numba,stefanseefeld/numba,ssarangi/numba,jriehl/numba,seibert/numba,gdementen/numba,pombredanne/numba,sklam/numba,stefanseefeld/numba,jriehl/numba,IntelLabs/numba,stefanseefeld/numba,pombredanne/numba,seibert/numba,stonebig/numba,GaZ3ll3/numba,skl... | ---
+++
@@ -0,0 +1,27 @@
+from numba import *
+import unittest
+
+class TestRedefine(unittest.TestCase):
+ def test_redefine(self):
+
+ def foo(x):
+ return x + 1
+
+ jfoo = jit(int32(int32))(foo)
+
+ # Test original function
+ self.assertTrue(jfoo(1), 2)
+
+
+ jfoo = ... | |
956d524a8694bb63532ac5f4a8121f57d75b7ad1 | test/BuildDir/guess-subdir.py | test/BuildDir/guess-subdir.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, merge, publish,
... | Add a test case for guessing the BuildDir associated with a subdirectory argument. | Add a test case for guessing the BuildDir associated with a subdirectory argument.
| Python | mit | Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons | ---
+++
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# 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 ... | |
654d2070dc25a288f680b5d93e5eb4662da403eb | planner/scrapers/virginia.py | planner/scrapers/virginia.py | from lxml import etree
from planner.scrapers.base import Scraper
class UVAScraper(Scraper):
"""Scraper for the University of Virginia"""
def scrape(self):
with open('/home/matt/lcp/uva.html', 'r') as f:
text = f.read()
html = etree.HTML(text)
# Filter to a closer div to... | Add the start of the UVA scraper. | Add the start of the UVA scraper.
| Python | bsd-2-clause | mblayman/lcp,mblayman/lcp,mblayman/lcp | ---
+++
@@ -0,0 +1,27 @@
+from lxml import etree
+
+from planner.scrapers.base import Scraper
+
+
+class UVAScraper(Scraper):
+ """Scraper for the University of Virginia"""
+
+ def scrape(self):
+ with open('/home/matt/lcp/uva.html', 'r') as f:
+ text = f.read()
+
+ html = etree.HTML(te... | |
7a8488327ba41275d4b569fc73da617140e64aea | sedlex/AddGitHubArticleLinkVisitor.py | sedlex/AddGitHubArticleLinkVisitor.py | # -*- coding: utf-8 -*-
from AbstractVisitor import AbstractVisitor
class AddGitHubArticleLinkVisitor(AbstractVisitor):
def __init__(self, args):
self.repo = args.github_repository
self.law_id = None
super(AddGitHubArticleLinkVisitor, self).__init__()
def visit_law_reference_node(sel... | Add a visitor to generate the github history link. | Add a visitor to generate the github history link.
| Python | agpl-3.0 | Legilibre/SedLex | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+
+from AbstractVisitor import AbstractVisitor
+
+class AddGitHubArticleLinkVisitor(AbstractVisitor):
+ def __init__(self, args):
+ self.repo = args.github_repository
+ self.law_id = None
+
+ super(AddGitHubArticleLinkVisitor, self).__init__()
... | |
6200630904db2452ecfb551d54974acfad978d17 | synapse/crypto/context_factory.py | synapse/crypto/context_factory.py | from twisted.internet import reactor, ssl
from OpenSSL import SSL
class ServerContextFactory(ssl.ContextFactory):
"""Factory for PyOpenSSL SSL contexts that are used to handle incoming
connections and to make connections to remote servers."""
def __init__(self, config):
self._context = SSL.Contex... | Add server TLS context factory | Add server TLS context factory
| Python | apache-2.0 | illicitonion/synapse,illicitonion/synapse,howethomas/synapse,TribeMedia/synapse,iot-factory/synapse,matrix-org/synapse,illicitonion/synapse,iot-factory/synapse,iot-factory/synapse,iot-factory/synapse,rzr/synapse,illicitonion/synapse,TribeMedia/synapse,matrix-org/synapse,rzr/synapse,howethomas/synapse,rzr/synapse,howeth... | ---
+++
@@ -0,0 +1,23 @@
+from twisted.internet import reactor, ssl
+from OpenSSL import SSL
+
+
+class ServerContextFactory(ssl.ContextFactory):
+ """Factory for PyOpenSSL SSL contexts that are used to handle incoming
+ connections and to make connections to remote servers."""
+
+ def __init__(self, config)... | |
c7daf4548580b0de2aa9ec02cffc17ef3e796b28 | vertex/test/test_q2qclient.py | vertex/test/test_q2qclient.py | # Copyright 2005-2008 Divmod, Inc. See LICENSE file for details
# -*- vertex.test.test_q2q.UDPConnection -*-
"""
Tests for L{vertex.q2qclient}.
"""
from twisted.trial import unittest
from twisted.internet.protocol import Factory
from twisted.protocols.amp import Command, AMP, AmpBox
from vertex import q2q, q2qclie... | Add a silly test for vertex.q2qclient.enregister. | Add a silly test for vertex.q2qclient.enregister.
| Python | mit | insequent/vertex,twisted/vertex,glyph/vertex,insequent/vertex,twisted/vertex | ---
+++
@@ -0,0 +1,39 @@
+# Copyright 2005-2008 Divmod, Inc. See LICENSE file for details
+# -*- vertex.test.test_q2q.UDPConnection -*-
+
+"""
+Tests for L{vertex.q2qclient}.
+"""
+
+from twisted.trial import unittest
+from twisted.internet.protocol import Factory
+
+from twisted.protocols.amp import Command, AMP, A... | |
b447470e8f4e8826d87f712c6726bf8855216330 | ureport/jobs/migrations/0005_add_photos.py | ureport/jobs/migrations/0005_add_photos.py | # Generated by Django 2.2.5 on 2019-09-26 23:07
from django.db import migrations
def generate_job_block_types(apps, schema_editor):
User = apps.get_model("auth", "User")
root = User.objects.filter(username="root").first()
if not root:
root = User.objects.create(username="root")
DashBlockTyp... | Add migration to add photo blocks type | Add migration to add photo blocks type
| Python | agpl-3.0 | Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,Ilhasoft/ureport,rapidpro/ureport | ---
+++
@@ -0,0 +1,37 @@
+# Generated by Django 2.2.5 on 2019-09-26 23:07
+
+from django.db import migrations
+
+
+def generate_job_block_types(apps, schema_editor):
+ User = apps.get_model("auth", "User")
+ root = User.objects.filter(username="root").first()
+
+ if not root:
+ root = User.objects.cre... | |
3c01ff0ecee7abdd25a5812c5d3a9bfcb1df732d | tests/test_units/test_route_escapes.py | tests/test_units/test_route_escapes.py | import unittest
from routes.route import Route
class TestRouteEscape(unittest.TestCase):
def test_normal_route(self):
r = Route('test', '/foo/bar')
self.assertEqual(r.routelist, ['/foo/bar'])
def test_route_with_backslash(self):
r = Route('test', '/foo\\\\bar')
self.assertEqua... | Add tests for backslash escapes in route paths | Add tests for backslash escapes in route paths
Co-Authored-By: Stephen Finucane <06fa905d7f2aaced6dc72e9511c71a2a51e8aead@that.guru>
| Python | mit | bbangert/routes,webknjaz/routes | ---
+++
@@ -0,0 +1,38 @@
+import unittest
+from routes.route import Route
+
+
+class TestRouteEscape(unittest.TestCase):
+ def test_normal_route(self):
+ r = Route('test', '/foo/bar')
+ self.assertEqual(r.routelist, ['/foo/bar'])
+
+ def test_route_with_backslash(self):
+ r = Route('test', ... | |
52c34e5cd6222de35ab750e6feb88be4ef8498f1 | vumi/middleware/session_length.py | vumi/middleware/session_length.py | # -*- test-case-name: vumi.middleware.tests.test_provider_setter -*-
from twisted.internet.defer import inlineCallbacks
from vumi.middleware.base import BaseMiddleware
from vumi.persist.txredis_manager import TxRedisManager
class SessionLengthMiddleware(BaseMiddleware):
""" Middleware for storing the session le... | Add basic framework for middleware. | Add basic framework for middleware.
| Python | bsd-3-clause | TouK/vumi,TouK/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix | ---
+++
@@ -0,0 +1,26 @@
+# -*- test-case-name: vumi.middleware.tests.test_provider_setter -*-
+
+from twisted.internet.defer import inlineCallbacks
+
+from vumi.middleware.base import BaseMiddleware
+from vumi.persist.txredis_manager import TxRedisManager
+
+
+class SessionLengthMiddleware(BaseMiddleware):
+ """ ... | |
8eb21692d01f474b2dd8f0d7e05cb0713dbb0475 | CodeFights/growingPlant.py | CodeFights/growingPlant.py | #!/usr/local/bin/python
# Code Fights Growing Plant Problem
def growingPlant(upSpeed, downSpeed, desiredHeight):
if upSpeed >= desiredHeight:
return 1
else:
return (desiredHeight // (upSpeed - downSpeed))
def main():
tests = [
[100, 10, 910, 10],
[10, 9, 4, 1]
]
... | Solve Code Fights growing plant problem | Solve Code Fights growing plant problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/local/bin/python
+# Code Fights Growing Plant Problem
+
+
+def growingPlant(upSpeed, downSpeed, desiredHeight):
+ if upSpeed >= desiredHeight:
+ return 1
+ else:
+ return (desiredHeight // (upSpeed - downSpeed))
+
+
+def main():
+ tests = [
+ [100, 10, 91... | |
824eea86b5166bce428c466c867708a9c8b15fb0 | tests/lows_and_highs.py | tests/lows_and_highs.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from vector import cb, plot_peaks
import peakutils.peak
def plot_peaks_lows_highs(x, highs, lows, algorithm=None, mph=None, mpd=None):
"""Plot results of the peak dectection."""
try:
import matplotlib.pyplot as plt
except ImportError:... | Add example for high and low peak detection | Add example for high and low peak detection
| Python | mit | MonsieurV/py-findpeaks,MonsieurV/py-findpeaks | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import numpy as np
+from vector import cb, plot_peaks
+import peakutils.peak
+
+def plot_peaks_lows_highs(x, highs, lows, algorithm=None, mph=None, mpd=None):
+ """Plot results of the peak dectection."""
+ try:
+ import matplotlib.... | |
73f891d7eebb5d524cee2da606bc0d195aeea890 | tests/test_checkinfo.py | tests/test_checkinfo.py | from itertools import combinations
from string import ascii_lowercase
from botbot import checkinfo as ci
def test_bidirectional_problem_serialization(tmpdir):
info = ci.CheckResult(tmpdir.strpath)
for probs in combinations(ascii_lowercase, 3):
info.add_problem(''.join(probs))
old_probs = info.pro... | Add new test for CheckResult | Add new test for CheckResult
| Python | mit | jackstanek/BotBot,jackstanek/BotBot | ---
+++
@@ -0,0 +1,15 @@
+from itertools import combinations
+from string import ascii_lowercase
+
+from botbot import checkinfo as ci
+
+def test_bidirectional_problem_serialization(tmpdir):
+ info = ci.CheckResult(tmpdir.strpath)
+ for probs in combinations(ascii_lowercase, 3):
+ info.add_problem(''.jo... | |
9a2a8100b566d2332db958979b776a10ac59f38a | alexa_parser.py | alexa_parser.py | import csv
import requests
import zipfile
import os
import pika
from os.path import expanduser
BASEPATH = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
ALEXA_FILE = BASEPATH + "/alexa.zip"
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
chann... | Add Alexa top 1 Million fetcher to push into RabbitMQ | Add Alexa top 1 Million fetcher to push into RabbitMQ
| Python | mpl-2.0 | seiflotfy/compatipede,seiflotfy/compatipede,seiflotfy/compatipede,seiflotfy/compatipede | ---
+++
@@ -0,0 +1,33 @@
+import csv
+import requests
+import zipfile
+import os
+import pika
+from os.path import expanduser
+
+
+BASEPATH = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
+ALEXA_FILE = BASEPATH + "/alexa.zip"
+
+
+connection = pika.BlockingConnection(pika.ConnectionParameters('localhost... | |
8510d648730059518ca6953aa716d59cc9f853ca | pybug/matlab/__init__.py | pybug/matlab/__init__.py | from numpy import gradient as np_gradient, reshape as np_reshape
def gradient(f, *varargs):
"""
Return the gradient of an N-dimensional array.
The gradient is computed using central differences in the interior and first differences at
the boundaries. The returned gradient hence has the same shape as ... | Add gradient and reshape functions to match Matlab | Add gradient and reshape functions to match Matlab
| Python | bsd-3-clause | jabooth/menpo-archive,yuxiang-zhou/menpo,grigorisg9gr/menpo,jabooth/menpo-archive,mozata/menpo,patricksnape/menpo,grigorisg9gr/menpo,jabooth/menpo-archive,patricksnape/menpo,mozata/menpo,grigorisg9gr/menpo,menpo/menpo,menpo/menpo,mozata/menpo,yuxiang-zhou/menpo,menpo/menpo,jabooth/menpo-archive,patricksnape/menpo,yuxia... | ---
+++
@@ -0,0 +1,48 @@
+from numpy import gradient as np_gradient, reshape as np_reshape
+
+
+def gradient(f, *varargs):
+ """
+ Return the gradient of an N-dimensional array.
+
+ The gradient is computed using central differences in the interior and first differences at
+ the boundaries. The returned g... | |
80966a18fbe92839370c90271d1118a0ac621501 | examples/check_equal.py | examples/check_equal.py | #!/usr/bin/env python3
from segpy.reader import create_reader
from segpy.trace_header import TraceHeaderRev1
from segpy.types import Int16
from segpy.writer import write_segy
from segpy.header import are_equal, field
class CustomTraceHeader(TraceHeaderRev1):
unassigned_1 = field(
Int16, offset=2... | Add a small program for checking whether SEG Y files roundtrip through the data structure flawlessly. | Add a small program for checking whether SEG Y files roundtrip through the data structure flawlessly.
| Python | agpl-3.0 | hohogpb/segpy,Kramer477/segpy,kwinkunks/segpy,abingham/segpy,kjellkongsvik/segpy,asbjorn/segpy | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+
+from segpy.reader import create_reader
+from segpy.trace_header import TraceHeaderRev1
+from segpy.types import Int16
+from segpy.writer import write_segy
+from segpy.header import are_equal, field
+
+
+class CustomTraceHeader(TraceHeaderRev1):
+
+ unassigned... | |
68c3ee25d505c680a08ef53de24c4b920099e081 | scripts/clear_invalid_unclaimed_records.py | scripts/clear_invalid_unclaimed_records.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to remove unclaimed records for confirmed users. Once a user has
confirmed their email address, all their unclaimed records should be cleared
so that their full name shows up correctly on all projects.
To run: ::
$ python -m scripts.clear_invalid_unclaimed_r... | Add migration script to clear invalid unclaimed records | Add migration script to clear invalid unclaimed records
Confirmed users should not have unclaimed records
| Python | apache-2.0 | danielneis/osf.io,bdyetton/prettychart,petermalcolm/osf.io,CenterForOpenScience/osf.io,jnayak1/osf.io,lamdnhan/osf.io,icereval/osf.io,icereval/osf.io,zkraime/osf.io,icereval/osf.io,cldershem/osf.io,chrisseto/osf.io,dplorimer/osf,doublebits/osf.io,MerlinZhang/osf.io,DanielSBrown/osf.io,kwierman/osf.io,hmoco/osf.io,lynds... | ---
+++
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""Script to remove unclaimed records for confirmed users. Once a user has
+confirmed their email address, all their unclaimed records should be cleared
+so that their full name shows up correctly on all projects.
+
+To run: ::
+
+ $ python ... | |
1073485bc5ceadf771b09501e3302b792de75691 | portal/migrations/versions/9ebdfeb28bef_.py | portal/migrations/versions/9ebdfeb28bef_.py | """Correct rank of CRV baseline
Revision ID: 9ebdfeb28bef
Revises: a679f493bcdd
Create Date: 2017-10-09 10:16:40.584279
"""
from alembic import op
from sqlalchemy.orm import sessionmaker
from portal.models.questionnaire_bank import QuestionnaireBank
# revision identifiers, used by Alembic.
revision = '9ebdfeb28bef'... | Correct crv baseline questionnaire rank w/ migration (FKs prevent site_persistence fix from working) | Correct crv baseline questionnaire rank w/ migration
(FKs prevent site_persistence fix from working)
| Python | bsd-3-clause | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | ---
+++
@@ -0,0 +1,67 @@
+"""Correct rank of CRV baseline
+
+Revision ID: 9ebdfeb28bef
+Revises: a679f493bcdd
+Create Date: 2017-10-09 10:16:40.584279
+
+"""
+from alembic import op
+from sqlalchemy.orm import sessionmaker
+
+from portal.models.questionnaire_bank import QuestionnaireBank
+
+# revision identifiers, us... | |
91abe26fd0b06339b3283d1dbe096edfdc52dadb | numpy-array-of-tuple.py | numpy-array-of-tuple.py | # Numpy converts a list of tuples *not* into an array of tuples, but into a 2D
# array instead.
list_of_tuples = [(1, 2), (3, 4)]
import numpy as np
print('list of tuples:', list_of_tuples, 'type:', type(list_of_tuples))
A = np.array(list_of_tuples)
print('numpy array of tuples:', A, 'type:', type(A))
# It makes comp... | Add numpy array of tuples | Add numpy array of tuples
| Python | mit | cmey/surprising-snippets,cmey/surprising-snippets | ---
+++
@@ -0,0 +1,18 @@
+# Numpy converts a list of tuples *not* into an array of tuples, but into a 2D
+# array instead.
+list_of_tuples = [(1, 2), (3, 4)]
+import numpy as np
+print('list of tuples:', list_of_tuples, 'type:', type(list_of_tuples))
+A = np.array(list_of_tuples)
+print('numpy array of tuples:', A, '... | |
45c4b092a7753c3a5dd7c36baf2bcfc17b32a871 | blink_strip/python_example/flash_example.py | blink_strip/python_example/flash_example.py | import serial
import time
class blinkyBoard:
def init(self, port, baud):
self.serial = serial.Serial(port, baud)
self.serial.open()
def sendPixel(self,r,g,b):
data = bytearray()
data.append(0x80 | (r>>1))
data.append(0x80 | (g>>1))
data.append(0x80 | (b>>1))
self.serial.write(data)
... | Add python data transmission example. | Add python data transmission example.
| Python | apache-2.0 | Blinkinlabs/BlinkyTape,Blinkinlabs/BlinkyTape,Blinkinlabs/BlinkyTape | ---
+++
@@ -0,0 +1,41 @@
+import serial
+import time
+
+class blinkyBoard:
+ def init(self, port, baud):
+ self.serial = serial.Serial(port, baud)
+ self.serial.open()
+
+ def sendPixel(self,r,g,b):
+ data = bytearray()
+ data.append(0x80 | (r>>1))
+ data.append(0x80 | (g>>1))
+ data.append(0x80 |... | |
4bf03eaf81f8d4c28e3b3b89c7442a787361eb5e | scripts/structure_mlsp2013_dataset.py | scripts/structure_mlsp2013_dataset.py | import csv
def test():
with open("CVfolds_2.txt", newline='') as id2set, open("rec_id2filename.txt", newline='') as id2file, open("rec_labels_test_hidden.txt", newline='') as id2label:
with open("file2label.csv", 'w', newline='') as file2label:
readId2Label = csv.reader(id2label)
re... | Add a script which structures the mlsp2013 data | Add a script which structures the mlsp2013 data
- creates a csv file which maps a file name to a label set
| Python | mit | johnmartinsson/bird-species-classification,johnmartinsson/bird-species-classification | ---
+++
@@ -0,0 +1,39 @@
+import csv
+
+def test():
+ with open("CVfolds_2.txt", newline='') as id2set, open("rec_id2filename.txt", newline='') as id2file, open("rec_labels_test_hidden.txt", newline='') as id2label:
+ with open("file2label.csv", 'w', newline='') as file2label:
+ readId2Label = cs... | |
dc399c7834b918ea99baa92d1cdededa43623d87 | ovp_projects/migrations/0033_auto_20170208_2118.py | ovp_projects/migrations/0033_auto_20170208_2118.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-08 21:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ovp_projects', '0032_auto_20170206_1905'),
]
operations = [
migrations.Alte... | Add missing migrations for last commit | Add missing migrations for last commit
| Python | agpl-3.0 | OpenVolunteeringPlatform/django-ovp-projects,OpenVolunteeringPlatform/django-ovp-projects | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-02-08 21:18
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ovp_projects', '0032_auto_20170206_1905'),
+ ]
+
+ ... | |
f320ff11f74de4df9933fc25db6e9fabbcb89f81 | api/bots/followup/test_followup.py | api/bots/followup/test_followup.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.... | Add tests for followup bot. | bots: Add tests for followup bot.
'followup' bot has different message handling behavior for
different messages.
For usual messages it calls 'send_message' function of
'BotHandlerApi' class.
For empty messages it calls 'send_reply' function of
'BotHandlerApi' class.
| Python | apache-2.0 | verma-varsha/zulip,eeshangarg/zulip,vabs22/zulip,punchagan/zulip,tommyip/zulip,vaidap/zulip,synicalsyntax/zulip,vabs22/zulip,punchagan/zulip,kou/zulip,vabs22/zulip,timabbott/zulip,vaidap/zulip,amanharitsh123/zulip,andersk/zulip,shubhamdhama/zulip,jrowan/zulip,rht/zulip,Galexrt/zulip,rht/zulip,rht/zulip,andersk/zulip,br... | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+from __future__ import absolute_import
+from __future__ import print_function
+
+import os
+import sys
+
+our_dir = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
+# For dev setups, we can find the API in the r... | |
0f9697c94c75e86edacfaa7982a5128779ee82e7 | ideascube/search/migrations/0002_reindex.py | ideascube/search/migrations/0002_reindex.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from ideascube.search.utils import create_index_table
reindex = lambda *args: create_index_table(force=True)
class Migration(migrations.Migration):
dependencies = [('search', '0001_initial')]
operations = [
... | Add a migration script that reindex the contents | Add a migration script that reindex the contents
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations
+from ideascube.search.utils import create_index_table
+
+reindex = lambda *args: create_index_table(force=True)
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [('search', ... | |
93642ed71a2a0ec8fe96858b20c319c061706f39 | cleanup_repo.py | cleanup_repo.py | #!/usr/bin/env python
import subprocess
import os.path
import sys
import re
from contextlib import contextmanager
TAGS_RE = re.compile('.+/tags/(.+)')
def git(*args):
p = subprocess.Popen(['git'] + list(args), stdout=subprocess.PIPE)
output = p.communicate()[0]
if p.returncode != 0:
raise Exce... | Add little script to do basic cleanup after git svn clone | Add little script to do basic cleanup after git svn clone
| Python | mit | develersrl/git-externals,develersrl/git-externals,develersrl/git-externals | ---
+++
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+
+import subprocess
+import os.path
+import sys
+import re
+
+from contextlib import contextmanager
+
+TAGS_RE = re.compile('.+/tags/(.+)')
+
+
+def git(*args):
+ p = subprocess.Popen(['git'] + list(args), stdout=subprocess.PIPE)
+ output = p.communicate()[0]
+
+... | |
3055bc1e261c4f3eef7eb24d704cb9c19a8d4723 | sfepy/discrete/dg/dg_conditions.py | sfepy/discrete/dg/dg_conditions.py | from __future__ import absolute_import
import numpy as nm
from sfepy.base.base import basestr, Container, Struct
from sfepy.discrete.functions import Function
from sfepy.discrete.conditions import Condition, PeriodicBC, EssentialBC
import six
class DGPeriodicBC(PeriodicBC):
...
class DGEssentialBC(EssentialBC)... | Reformat source files, add some docstrings. | Reformat source files, add some docstrings.
| Python | bsd-3-clause | sfepy/sfepy,sfepy/sfepy,vlukes/sfepy,BubuLK/sfepy,BubuLK/sfepy,vlukes/sfepy,sfepy/sfepy,BubuLK/sfepy,rc/sfepy,rc/sfepy,vlukes/sfepy,rc/sfepy | ---
+++
@@ -0,0 +1,15 @@
+from __future__ import absolute_import
+import numpy as nm
+
+from sfepy.base.base import basestr, Container, Struct
+from sfepy.discrete.functions import Function
+
+from sfepy.discrete.conditions import Condition, PeriodicBC, EssentialBC
+import six
+
+
+class DGPeriodicBC(PeriodicBC):
+ ... | |
10fc0e0b85edb04c676fd75e95ab539084063d13 | python/lisa_workbook.py | python/lisa_workbook.py | chapters, problems_per_page = list(map(int, input().strip().split(' ')))
problems_per_chapter = list(map(int, input().strip().split(' ')))
pages = [[]]
special_problems = 0
for chapter, problems in enumerate(problems_per_chapter):
current_problem = 1
if len(pages[-1]) != 0:
pages.append([])
while ... | Solve lisa workbook w/ too many nested loops | Solve lisa workbook w/ too many nested loops
| Python | mit | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | ---
+++
@@ -0,0 +1,19 @@
+chapters, problems_per_page = list(map(int, input().strip().split(' ')))
+problems_per_chapter = list(map(int, input().strip().split(' ')))
+
+pages = [[]]
+special_problems = 0
+
+for chapter, problems in enumerate(problems_per_chapter):
+ current_problem = 1
+ if len(pages[-1]) != 0:... | |
f88e5b7438617fdd10a25951fc442f59a8def1ca | zerver/migrations/0018_realm_emoji_message.py | zerver/migrations/0018_realm_emoji_message.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('zerver', '0017_userprofile_bot_type'),
]
operations = [
migrations.AlterField(
mod... | Add missing no-op migration for realm_emoji. | Add missing no-op migration for realm_emoji.
Because of how Django's migration system works, changing the error
message attached to a model field's validator results in an extra
migration.
| Python | apache-2.0 | joyhchen/zulip,sharmaeklavya2/zulip,vaidap/zulip,timabbott/zulip,ahmadassaf/zulip,mohsenSy/zulip,arpith/zulip,AZtheAsian/zulip,zulip/zulip,niftynei/zulip,rht/zulip,dhcrzf/zulip,vabs22/zulip,vaidap/zulip,calvinleenyc/zulip,calvinleenyc/zulip,umkay/zulip,synicalsyntax/zulip,SmartPeople/zulip,KingxBanana/zulip,niftynei/zu... | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import django.core.validators
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('zerver', '0017_userprofile_bot_type'),
+ ]
+
+ operations = [
+ ... | |
5968c21c2c2b0e8305229fe5976d9d13786390e5 | notifications/schedule_posted.py | notifications/schedule_posted.py | from consts.notification_type import NotificationType
from notifications.base_notification import BaseNotification
class SchedulePostedNotification(BaseNotification):
def __init__(self, event):
self.event = event
def _build_dict(self):
data = {}
data['message_type'] = NotificationTyp... | Add notification for schedule being posted | Add notification for schedule being posted
| Python | mit | fangeugene/the-blue-alliance,phil-lopreiato/the-blue-alliance,nwalters512/the-blue-alliance,synth3tk/the-blue-alliance,verycumbersome/the-blue-alliance,the-blue-alliance/the-blue-alliance,verycumbersome/the-blue-alliance,1fish2/the-blue-alliance,josephbisch/the-blue-alliance,tsteward/the-blue-alliance,tsteward/the-blue... | ---
+++
@@ -0,0 +1,17 @@
+from consts.notification_type import NotificationType
+from notifications.base_notification import BaseNotification
+
+
+class SchedulePostedNotification(BaseNotification):
+
+ def __init__(self, event):
+ self.event = event
+
+ def _build_dict(self):
+ data = {}
+ ... | |
4aa37bafa437614542c58f6d8ad40d9d8670df95 | test/test_logger.py | test/test_logger.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
from __future__ import unicode_literals
import logbook
from pytablewriter import (
set_logger,
set_log_level,
)
import pytest
class Test_set_logger(object):
@pytest.mark.para... | Add test cases for the logger | Add test cases for the logger
| Python | mit | thombashi/pytablewriter | ---
+++
@@ -0,0 +1,49 @@
+# encoding: utf-8
+
+"""
+.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
+"""
+
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import logbook
+from pytablewriter import (
+ set_logger,
+ set_log_level,
+)
+import pytest
+
+
+class Te... | |
71cd3709ba08bf87825816099e203eae57c05752 | dictionaries/scripts/create_english_superset_addendum.py | dictionaries/scripts/create_english_superset_addendum.py | import optparse
import os
optparser = optparse.OptionParser()
optparser.add_option("-n", "--new_files", dest="new_files", default="", help="Comma separated list of new files")
optparser.add_option("-d", "--directory", dest="directory", default="dictionaries/", help="Directory with dictionaries")
optparser.add_option("... | Add script that creates an addendum to the english superset, to account for new dictionaries being added. Ensures we don't already have the english words in the existing set before adding them in | Add script that creates an addendum to the english superset, to account for new dictionaries being added. Ensures we don't already have the english words in the existing set before adding them in
| Python | mit | brendandc/multilingual-google-image-scraper | ---
+++
@@ -0,0 +1,45 @@
+import optparse
+import os
+
+optparser = optparse.OptionParser()
+optparser.add_option("-n", "--new_files", dest="new_files", default="", help="Comma separated list of new files")
+optparser.add_option("-d", "--directory", dest="directory", default="dictionaries/", help="Directory with dict... | |
a68699fbea88b541c6ce8bd519c3886b0fa8f197 | scripts/etherbone_perf.py | scripts/etherbone_perf.py | import time
import cProfile
import argparse
from utils import memread, memwrite
def run(wb, rw, n, *, burst, profile=True):
datas = list(range(n))
ctx = locals()
ctx['wb'] = wb
ctx['memread'] = memread
ctx['memwrite'] = memwrite
fname = 'tmp/profiling/{}_0x{:x}_b{}.profile'.format(rw, n, bu... | Add a script for EtherBone transfers profiling | Add a script for EtherBone transfers profiling
| Python | apache-2.0 | antmicro/litex-rowhammer-tester,antmicro/litex-rowhammer-tester,antmicro/litex-rowhammer-tester | ---
+++
@@ -0,0 +1,68 @@
+import time
+import cProfile
+
+import argparse
+
+from utils import memread, memwrite
+
+def run(wb, rw, n, *, burst, profile=True):
+ datas = list(range(n))
+
+ ctx = locals()
+ ctx['wb'] = wb
+ ctx['memread'] = memread
+ ctx['memwrite'] = memwrite
+
+ fname = 'tmp/profil... | |
0a75aa4bbb9396c448b4cef58a42068d30933a95 | tests/formatter/test_rawer.py | tests/formatter/test_rawer.py | import unittest, argparse
from echolalia.formatter.rawer import Formatter
class RawerTestCase(unittest.TestCase):
def setUp(self):
self.parser = argparse.ArgumentParser()
self.data = [{chr(i): i - 96} for i in xrange(97, 123)]
self.formatter = Formatter()
def test_add_args(self):
self.assertEqual... | Add tests for formatter raw | Add tests for formatter raw
| Python | mit | eiri/echolalia-prototype | ---
+++
@@ -0,0 +1,17 @@
+import unittest, argparse
+from echolalia.formatter.rawer import Formatter
+
+class RawerTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.parser = argparse.ArgumentParser()
+ self.data = [{chr(i): i - 96} for i in xrange(97, 123)]
+ self.formatter = Formatter()
+
+ def tes... | |
546bc7ffab0a0ca287550d97946d3e8b12b6c59a | tools/distribute.py | tools/distribute.py | #!/usr/bin/python2
# Copyright (c) 2015 Kenneth Henderick <kenneth@ketronic.be>
#
# 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
... | Add script to copy the files to their correct location (e.g. during testing) | Add script to copy the files to their correct location (e.g. during testing)
| Python | mit | khenderick/zfs-snap-manager,tylerjl/zfs-snap-manager | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/python2
+# Copyright (c) 2015 Kenneth Henderick <kenneth@ketronic.be>
+#
+# 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, includi... | |
60125c0852780d88ec29757c8a11a5846a4e1bba | portal/migrations/versions/63262fe95b9c_.py | portal/migrations/versions/63262fe95b9c_.py | from alembic import op
import sqlalchemy as sa
"""empty message
Revision ID: 63262fe95b9c
Revises: 13a45e9375d7
Create Date: 2018-02-28 13:17:47.248361
"""
# revision identifiers, used by Alembic.
revision = '63262fe95b9c'
down_revision = '13a45e9375d7'
def upgrade():
# ### commands auto generated by Alembic... | Upgrade script to add many:many relationship between orgs and rps. | Upgrade script to add many:many relationship between orgs and rps.
| Python | bsd-3-clause | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | ---
+++
@@ -0,0 +1,40 @@
+from alembic import op
+import sqlalchemy as sa
+
+
+"""empty message
+
+Revision ID: 63262fe95b9c
+Revises: 13a45e9375d7
+Create Date: 2018-02-28 13:17:47.248361
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '63262fe95b9c'
+down_revision = '13a45e9375d7'
+
+
+def upgrade():... | |
d61862b138858721d6baf06ab2ad29ebb566f09b | tests/t_bad_acceptor_name.py | tests/t_bad_acceptor_name.py | #!/usr/bin/python
# Copyright (C) 2015 - mod_auth_gssapi contributors, see COPYING for license.
import os
import requests
from stat import ST_MODE
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
if __name__ == '__main__':
sess = requests.Session()
url = 'http://%s/bad_acceptor_name/' % os.environ['N... | Add test to check when an acceptor name is bad | Add test to check when an acceptor name is bad
Had this in my tree but forgot to add to the commit.
Related to #131
Signed-off-by: Simo Sorce <65f99581a93cf30dafc32b5c178edc6b0294a07f@redhat.com>
| Python | mit | frenche/mod_auth_gssapi,frenche/mod_auth_gssapi,frenche/mod_auth_gssapi,frenche/mod_auth_gssapi | ---
+++
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+# Copyright (C) 2015 - mod_auth_gssapi contributors, see COPYING for license.
+
+import os
+import requests
+from stat import ST_MODE
+from requests_kerberos import HTTPKerberosAuth, OPTIONAL
+
+
+if __name__ == '__main__':
+ sess = requests.Session()
+ url = 'http:/... | |
1870cc1f25426bee9b1b4a66f2167c5cd474cd23 | openstack/tests/functional/network/v2/test_dvr_router.py | openstack/tests/functional/network/v2/test_dvr_router.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add functional tests for DVR router. | Add functional tests for DVR router.
Change-Id: Iafa10dc02626a40a90c48f74c363d977ac4f512f
| Python | apache-2.0 | stackforge/python-openstacksdk,dtroyer/python-openstacksdk,dtroyer/python-openstacksdk,briancurtin/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-openstacksdk | ---
+++
@@ -0,0 +1,56 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writi... | |
f27382d63224f55998320e496a82aea32d82319b | 04/test_sum_sector_ids.py | 04/test_sum_sector_ids.py | import unittest
from sum_sector_ids import (extract_checksum,
create_checksum,
is_valid_checksum,
extract_sector_id,
sum_sector_ids)
class TestSumSectorIds(unittest.TestCase):
def setUp(self):
s... | Add tests for summing sector ids. | Add tests for summing sector ids.
| Python | mit | machinelearningdeveloper/aoc_2016 | ---
+++
@@ -0,0 +1,36 @@
+import unittest
+
+from sum_sector_ids import (extract_checksum,
+ create_checksum,
+ is_valid_checksum,
+ extract_sector_id,
+ sum_sector_ids)
+
+class TestSumSectorIds(unittest.TestC... | |
238c550d8131f3b35dae437182c924191ff08b72 | tools/find_scan_roots.py | tools/find_scan_roots.py | #!/usr/bin/env python
# Copyright (C) 2018 The Android Open Source 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/LICENSE-2.0
#
# Unless requi... | Add tool to find scan roots. | Add tool to find scan roots.
Bug: 73625480
Change-Id: I93b405feb999aaed9675d2ea52712663fa83c9e0 | Python | apache-2.0 | google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto | ---
+++
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# Copyright (C) 2018 The Android Open Source 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/li... | |
7eac12bb8fe31b397c8598af14973f2337ca8c53 | cla_public/apps/contact/tests/test_notes.py | cla_public/apps/contact/tests/test_notes.py | import unittest
from werkzeug.datastructures import MultiDict
from cla_public.app import create_app
from cla_public.apps.contact.forms import ContactForm
def submit(**kwargs):
return ContactForm(MultiDict(kwargs), csrf_enabled=False)
class NotesTest(unittest.TestCase):
def setUp(self):
app = crea... | Add python test for notes length validation | Add python test for notes length validation
| Python | mit | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | ---
+++
@@ -0,0 +1,31 @@
+import unittest
+
+from werkzeug.datastructures import MultiDict
+
+from cla_public.app import create_app
+from cla_public.apps.contact.forms import ContactForm
+
+
+def submit(**kwargs):
+ return ContactForm(MultiDict(kwargs), csrf_enabled=False)
+
+
+class NotesTest(unittest.TestCase):
... | |
7f4de89928de1580dceedff3c1a581660e70f954 | tests/sentry/utils/test_cursors.py | tests/sentry/utils/test_cursors.py | from __future__ import absolute_import
from mock import Mock
from sentry.utils.cursors import build_cursor, Cursor
def build_mock(**attrs):
obj = Mock()
for key, value in attrs.items():
setattr(obj, key, value)
obj.__repr__ = lambda x: repr(attrs)
return obj
def test_build_cursor():
ev... | Add test exhibiting cursor failure | Add test exhibiting cursor failure
| Python | bsd-3-clause | BayanGroup/sentry,kevinlondon/sentry,imankulov/sentry,fotinakis/sentry,BuildingLink/sentry,BuildingLink/sentry,mvaled/sentry,fuziontech/sentry,nicholasserra/sentry,fotinakis/sentry,jean/sentry,kevinlondon/sentry,ngonzalvez/sentry,mitsuhiko/sentry,ifduyue/sentry,fotinakis/sentry,alexm92/sentry,zenefits/sentry,alexm92/se... | ---
+++
@@ -0,0 +1,42 @@
+from __future__ import absolute_import
+
+from mock import Mock
+
+from sentry.utils.cursors import build_cursor, Cursor
+
+
+def build_mock(**attrs):
+ obj = Mock()
+ for key, value in attrs.items():
+ setattr(obj, key, value)
+ obj.__repr__ = lambda x: repr(attrs)
+ retu... | |
dd287c4edfb29e848eaaba93c769ebfaab0db58c | tests/non_nose_tests/test_interop_client.py | tests/non_nose_tests/test_interop_client.py | from time import sleep
from SUASSystem import InteropClientConverter
if __name__ == '__main__':
interop_client = InteropClientConverter()
while True:
print(interop_client.get_obstacles())
sleep(1)
| Add test for communicating with the interoperability server. This will allow us to verify we can make connection with the judges' server at competition | Add test for communicating with the interoperability server. This will allow us to verify we can make connection with the judges' server at competition
| Python | mit | FlintHill/SUAS-Competition,FlintHill/SUAS-Competition,FlintHill/SUAS-Competition,FlintHill/SUAS-Competition,FlintHill/SUAS-Competition | ---
+++
@@ -0,0 +1,10 @@
+from time import sleep
+from SUASSystem import InteropClientConverter
+
+if __name__ == '__main__':
+ interop_client = InteropClientConverter()
+
+ while True:
+ print(interop_client.get_obstacles())
+
+ sleep(1) | |
3592cd622e61ee689b096c99d46b6d936109e383 | tests/qtcore/qstring_buffer_protocol_test.py | tests/qtcore/qstring_buffer_protocol_test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''Tests QString implementation of Python buffer protocol'''
import unittest
from os.path import isdir
from PySide.QtCore import QString
class QStringBufferProtocolTest(unittest.TestCase):
'''Tests QString implementation of Python buffer protocol'''
def testQStringB... | Revert "We do not support character buffer protocol on QStrings." | Revert "We do not support character buffer protocol on QStrings."
This reverts commit 1a7cbb2473327abad936447c47818ee13df2992c.
| Python | lgpl-2.1 | M4rtinK/pyside-bb10,gbaty/pyside2,qtproject/pyside-pyside,M4rtinK/pyside-android,M4rtinK/pyside-bb10,PySide/PySide,qtproject/pyside-pyside,M4rtinK/pyside-android,IronManMark20/pyside2,pankajp/pyside,pankajp/pyside,IronManMark20/pyside2,enthought/pyside,M4rtinK/pyside-bb10,enthought/pyside,qtproject/pyside-pyside,enthou... | ---
+++
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+'''Tests QString implementation of Python buffer protocol'''
+
+import unittest
+
+from os.path import isdir
+from PySide.QtCore import QString
+
+class QStringBufferProtocolTest(unittest.TestCase):
+ '''Tests QString implementation of Python bu... | |
64f13a006412112830e1d7cc2ff71ea32cb4c1b6 | migrations/versions/0150_another_letter_org.py | migrations/versions/0150_another_letter_org.py | """empty message
Revision ID: 0150_another_letter_org
Revises: 0149_add_crown_to_services
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0150_another_letter_org'
down_revision = '0149_add_crown_to_services'
from alembic import op
NEW_ORGANISATIONS = [
('006', ... | Add a new organisation for letter branding | Add a new organisation for letter branding
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,38 @@
+"""empty message
+
+Revision ID: 0150_another_letter_org
+Revises: 0149_add_crown_to_services
+Create Date: 2017-06-29 12:44:16.815039
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0150_another_letter_org'
+down_revision = '0149_add_crown_to_services'
+
+from alembic import... | |
cb87c6e2c58593d5ef5710c4d7db0c18831e354c | tools/clear_zk.py | tools/clear_zk.py | #!/usr/bin/env python
import contextlib
import os
import re
import sys
top_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),
os.pardir))
sys.path.insert(0, top_dir)
from taskflow.utils import kazoo_utils
@contextlib.contextmanager
def finalize_client(client):
... | Add a helper tool which clears zookeeper test dirs | Add a helper tool which clears zookeeper test dirs
Create a tool that can clear any leftover garbage left
by the testing of taskflow unit tests with zookeeper for
when this is needed (for example, a test does not clean up
correctly on its own).
Change-Id: Icfaf28273b76a6ca27683d174f111fba2858f055
| Python | apache-2.0 | openstack/taskflow,pombredanne/taskflow-1,junneyang/taskflow,junneyang/taskflow,jimbobhickville/taskflow,openstack/taskflow,jimbobhickville/taskflow,pombredanne/taskflow-1 | ---
+++
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+import contextlib
+import os
+import re
+import sys
+
+top_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),
+ os.pardir))
+sys.path.insert(0, top_dir)
+
+from taskflow.utils import kazoo_utils
+
+
+@contextlib.contex... | |
b1bf21e7331ef4c6191ac27a7621deb04b086ffc | tests/test_tileutils.py | tests/test_tileutils.py | import pytest
import numpy as np
from pytilemap.tileutils import posFromLonLat, lonLatFromPos
LATITUDES = np.arange(-90, 90).astype(np.float64)
LONGITUDES = np.arange(-180, 180).astype(np.float64)
ZOOMS = np.arange(1, 20).astype(np.int64)
def referencePosFromLonLat(lon, lat, zoom, tileSize):
tx = (lon + 180.0)... | Add tests for tileutils module | Add tests for tileutils module
| Python | mit | allebacco/PyTileMap | ---
+++
@@ -0,0 +1,45 @@
+import pytest
+import numpy as np
+
+from pytilemap.tileutils import posFromLonLat, lonLatFromPos
+
+
+LATITUDES = np.arange(-90, 90).astype(np.float64)
+LONGITUDES = np.arange(-180, 180).astype(np.float64)
+ZOOMS = np.arange(1, 20).astype(np.int64)
+
+
+def referencePosFromLonLat(lon, lat, ... | |
cfe5f9240c2ccbb41c1dd3e0ea7b22ffddf80a09 | app/api_v1/serializers.py | app/api_v1/serializers.py | """This module defines the format used by marshall to map the models."""
from flask_restful import fields
bucketlistitem_serializer = {
'id': fields.Integer,
'item_name': fields.String,
'priority': fields.String,
'done': fields.Boolean,
'date_created': fields.DateTime,
'date_modified': fields.D... | Add marshal fields to map with models. | [Feature] Add marshal fields to map with models.
| Python | mit | andela-akiura/bucketlist | ---
+++
@@ -0,0 +1,24 @@
+"""This module defines the format used by marshall to map the models."""
+from flask_restful import fields
+
+bucketlistitem_serializer = {
+ 'id': fields.Integer,
+ 'item_name': fields.String,
+ 'priority': fields.String,
+ 'done': fields.Boolean,
+ 'date_created': fields.Dat... | |
779f4323636d2476b3e51b6e57f2c130e9d4d466 | src/tools/make_dates.py | src/tools/make_dates.py | #!/usr/bin/env python
# coding: utf-8
"""Make dates on second Tuesday of the month for full year"""
import datetime
import sys
def second_tuesday(year, month):
"""Find the second Tuesday in a month."""
date = datetime.date(year, month, 1)
seen = 0
day = datetime.timedelta(days=1)
while True:
... | Add tool to make dates for second Tuesday in a month | Add tool to make dates for second Tuesday in a month
| Python | mit | LPUG/LPUG.github.io,LPUG/LPUG.github.io | ---
+++
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# coding: utf-8
+"""Make dates on second Tuesday of the month for full year"""
+
+
+import datetime
+import sys
+
+
+def second_tuesday(year, month):
+ """Find the second Tuesday in a month."""
+ date = datetime.date(year, month, 1)
+ seen = 0
+ day = datet... | |
af9bf2a6db96b069ef62054a4ab09f66f2dd048a | plugin_manager.py | plugin_manager.py | """
Copyright 2011 Ryan Fobel
This file is part of dmf_control_board.
Microdrop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... | Add PluginManager class and IPlugin interface | Add PluginManager class and IPlugin interface
This file should have been included in commit 46c1c31a2bf3c3d953d35195667ccc1af7df3c04
References #4
| Python | bsd-3-clause | wheeler-microfluidics/microdrop | ---
+++
@@ -0,0 +1,79 @@
+"""
+Copyright 2011 Ryan Fobel
+
+This file is part of dmf_control_board.
+
+Microdrop is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your op... | |
c3eba3d5983472da3434d4c6acb4a7ab15036ee6 | python/generators/fibonacci.py | python/generators/fibonacci.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
# 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 withou... | Add a new snippet 'python/generators' (Fibonacci). | Add a new snippet 'python/generators' (Fibonacci).
| Python | mit | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | ---
+++
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
+
+# 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 wi... | |
50dd055975732755f2bcb9424bd2d5df9e1ae87a | kboard/core/tests/test_context_processors.py | kboard/core/tests/test_context_processors.py | from django.test import TestCase
from django.http import HttpRequest
from core.context_processors import navbar
from board.models import Board
class TestNavbarContextProcessor(TestCase):
def test_return_board_list_correctly(self):
test_board = Board.objects.create(
slug='slug',
na... | Add unit test of navbar context processor | Add unit test of navbar context processor
| Python | mit | guswnsxodlf/k-board,hyesun03/k-board,darjeeling/k-board,cjh5414/kboard,hyesun03/k-board,guswnsxodlf/k-board,cjh5414/kboard,cjh5414/kboard,kboard/kboard,guswnsxodlf/k-board,kboard/kboard,kboard/kboard,hyesun03/k-board | ---
+++
@@ -0,0 +1,19 @@
+from django.test import TestCase
+from django.http import HttpRequest
+
+from core.context_processors import navbar
+from board.models import Board
+
+
+class TestNavbarContextProcessor(TestCase):
+ def test_return_board_list_correctly(self):
+ test_board = Board.objects.create(
+ ... | |
b0a4a44d7c69875dc5890a8c62a25a8ae3c7900f | openfisca_core/scripts/find_placeholders.py | openfisca_core/scripts/find_placeholders.py | # -*- coding: utf-8 -*-
import os
import fnmatch
import sys
from bs4 import BeautifulSoup
def find_param_files(input_dir):
param_files = []
for root, dirnames, filenames in os.walk(input_dir):
for filename in fnmatch.filter(filenames, '*.xml'):
param_files.append(os.path.join(root, filen... | Add a script to find placeholers in legislation | Add a script to find placeholers in legislation
This script requires BeautifulSoup (bs4)
| Python | agpl-3.0 | openfisca/openfisca-core,openfisca/openfisca-core | ---
+++
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+
+import os
+import fnmatch
+import sys
+
+from bs4 import BeautifulSoup
+
+
+def find_param_files(input_dir):
+ param_files = []
+ for root, dirnames, filenames in os.walk(input_dir):
+ for filename in fnmatch.filter(filenames, '*.xml'):
+ pa... | |
31a453c2fe3a668f4c826a2b5bced7ee50f58f2e | samples/http2/simple_server.py | samples/http2/simple_server.py | """A simple HTTP/2 file server."""
import asyncio
import logging
import sys
from concurrent.futures.thread import ThreadPoolExecutor
import os.path
import urllib.parse
from http import HTTPStatus
from http2 import HttpError, Protocol
LOG = logging.getLogger(__name__)
class Handler:
def __init__(self, root_p... | Add a simple HTTP/2 file server for testing | Add a simple HTTP/2 file server for testing
| Python | mit | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | ---
+++
@@ -0,0 +1,83 @@
+"""A simple HTTP/2 file server."""
+
+import asyncio
+import logging
+import sys
+from concurrent.futures.thread import ThreadPoolExecutor
+
+import os.path
+import urllib.parse
+from http import HTTPStatus
+
+from http2 import HttpError, Protocol
+
+
+LOG = logging.getLogger(__name__)
+
+
+... | |
bfe38efc63ead69eb57c74b882f4072dd80cd469 | alert.py | alert.py | class Alert:
def __init__(self, description, rule, action):
self.description = description
self.rule = rule
self.action = action
self.exchange = None
def connect(self, exchange):
self.exchange = exchange
dependent_stocks = self.rule.depends_on()
for stock... | Add Alert class as well as connect and check_rule methods. | Add Alert class as well as connect and check_rule methods.
| Python | mit | bsmukasa/stock_alerter | ---
+++
@@ -0,0 +1,16 @@
+class Alert:
+ def __init__(self, description, rule, action):
+ self.description = description
+ self.rule = rule
+ self.action = action
+ self.exchange = None
+
+ def connect(self, exchange):
+ self.exchange = exchange
+ dependent_stocks = sel... | |
52467da69ebab6f2884bfd791d7e18bd4e593266 | aovek.py | aovek.py | import argparse
import json
import tensorflow as tf
from aovek.preprocess.download_dataset import download_dataset
from aovek.preprocess.data_processing import DataProcessing
from aovek.training.train import Train
from aovek.visualization.predict import Predict
from aovek.validate.eval_metrics import EvalMetrics
pars... | Add file for control person detection | Add file for control person detection
| Python | mit | nikolaystanishev/traffic-sign-recognition | ---
+++
@@ -0,0 +1,81 @@
+import argparse
+import json
+import tensorflow as tf
+
+from aovek.preprocess.download_dataset import download_dataset
+from aovek.preprocess.data_processing import DataProcessing
+from aovek.training.train import Train
+from aovek.visualization.predict import Predict
+from aovek.validate.e... | |
a694c8449f63cbe37ceadc98a5836cfaff8fa992 | tests/RemoveEpsilonRules/Reverse/OverTwoRuleTest.py | tests/RemoveEpsilonRules/Reverse/OverTwoRuleTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 20.08.2017 16:01
:Licence GNUv3
Part of grammpy-transforms
"""
from unittest import TestCase, main
from grammpy import *
from grammpy_transforms import ContextFree, InverseContextFree
from pyparsers import cyk
class S(Nonterminal): pass
class A(Nonterminal):... | Add more complicated test of epsilon rules restoration | Add more complicated test of epsilon rules restoration
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 20.08.2017 16:01
+:Licence GNUv3
+Part of grammpy-transforms
+
+"""
+
+from unittest import TestCase, main
+from grammpy import *
+from grammpy_transforms import ContextFree, InverseContextFree
+from pyparsers import cyk
+
+class ... | |
a6e92e2464a50a7c4159958e1b60c0aa2dea96a9 | res/os_x_app_creation.py | res/os_x_app_creation.py | #! /usr/bin/env python
import os
import shutil
import subprocess
MAIN_WINDOW_UI_FILE = 'src/opencmiss/neon/ui/ui_mainwindow.py'
def remove_parent_of_menubar():
with open(MAIN_WINDOW_UI_FILE, 'r+') as f:
s = f.read()
f.seek(0)
c = s.replace('self.menubar = QtGui.QMenuBar(MainWindow)', 'sel... | Add script to automate the creation of the Neon app. | Add script to automate the creation of the Neon app.
| Python | apache-2.0 | alan-wu/neon | ---
+++
@@ -0,0 +1,84 @@
+#! /usr/bin/env python
+import os
+import shutil
+import subprocess
+
+MAIN_WINDOW_UI_FILE = 'src/opencmiss/neon/ui/ui_mainwindow.py'
+
+
+def remove_parent_of_menubar():
+ with open(MAIN_WINDOW_UI_FILE, 'r+') as f:
+ s = f.read()
+ f.seek(0)
+ c = s.replace('self.men... | |
519cb3ebf56c7841240779e170fb3bc657d87830 | tempest/tests/test_list_tests.py | tempest/tests/test_list_tests.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM Corp.
#
# 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
#
# ... | Add tempest unit test to verify the test list | Add tempest unit test to verify the test list
If there is an error in a test file it could potentially not get run
in the tox jobs used for gating. This commit adds a test which looks
for ImportFailures in the test list to ensure that all the test files
will get run in the gate.
Change-Id: Ia0a5831810d04f2201bd856039... | Python | apache-2.0 | FujitsuEnablingSoftwareTechnologyGmbH/tempest,hayderimran7/tempest,tonyli71/tempest,alinbalutoiu/tempest,xbezdick/tempest,danielmellado/tempest,openstack/tempest,eggmaster/tempest,FujitsuEnablingSoftwareTechnologyGmbH/tempest,xbezdick/tempest,bigswitch/tempest,afaheem88/tempest,eggmaster/tempest,pczerkas/tempest,redhat... | ---
+++
@@ -0,0 +1,38 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 IBM Corp.
+#
+# 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... | |
0aee93c8730625ea0efa5a6ff1e48b29f0161dd5 | buhmm/tests/test_misc.py | buhmm/tests/test_misc.py | from nose.tools import *
import numpy as np
import buhmm.misc as module
def test_logspace_int_smoke():
# Smoke test
x = module.logspace_int(2000, 50)
y = np.array([
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11,
13, 14, 17, 19, 22, 25, 29, 33, 38, 43, ... | Add unit tests for logspace_int. | Add unit tests for logspace_int.
| Python | mit | chebee7i/buhmm | ---
+++
@@ -0,0 +1,29 @@
+from nose.tools import *
+
+import numpy as np
+
+import buhmm.misc as module
+
+def test_logspace_int_smoke():
+ # Smoke test
+ x = module.logspace_int(2000, 50)
+ y = np.array([
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11,
+ 13, 14, 17, 1... | |
9a811ffcd7bb743b4c739667187d31f32429338a | tests/test_exception_wrapping.py | tests/test_exception_wrapping.py | import safe
def test_simple_exception():
class MockReponse(object):
def json(self):
return {'status': False,
'method': 'synchronize',
'module': 'cluster',
'error': {'message': 'Example error'}}
exception = safe.library.raise_from... | Add a very simple test | Add a very simple test
| Python | mpl-2.0 | sangoma/safepy2,leonardolang/safepy2 | ---
+++
@@ -0,0 +1,13 @@
+import safe
+
+
+def test_simple_exception():
+ class MockReponse(object):
+ def json(self):
+ return {'status': False,
+ 'method': 'synchronize',
+ 'module': 'cluster',
+ 'error': {'message': 'Example error'}}
+
+... | |
8ef0f8058854b2ef55d2d42bbe84487a9aadae12 | .ycm_extra_conf.py | .ycm_extra_conf.py | def FlagsForFile(filename, **kwargs):
return {
'flags': [
'-x', 'c',
'-g', '-Wall', '-Wextra',
'-D_REENTRANT', '-D__NO_MATH_INLINES', '-fsigned-char'
],
}
| Add build flags for YouCompleteMe. | Add build flags for YouCompleteMe.
Add a .ycm_extra.conf.py script to return the same CFLAGS
we pass for `make debug`. These are passed to libclang
so symbol lookup works correctly.
Note this doesn't pick up changes to the build config,
including non-default locations for the ogg headers,
but it's better than nothing... | Python | bsd-3-clause | ShiftMediaProject/vorbis,ShiftMediaProject/vorbis,ShiftMediaProject/vorbis,ShiftMediaProject/vorbis,ShiftMediaProject/vorbis,ShiftMediaProject/vorbis | ---
+++
@@ -0,0 +1,8 @@
+def FlagsForFile(filename, **kwargs):
+ return {
+ 'flags': [
+ '-x', 'c',
+ '-g', '-Wall', '-Wextra',
+ '-D_REENTRANT', '-D__NO_MATH_INLINES', '-fsigned-char'
+ ],
+ } | |
ae7a2a3809ebe54c13a9ced4da5bbd48cc8d0e3a | Apollonian/main.py | Apollonian/main.py | # Circle Inversion Fractals (Apollonian Gasket) (Escape-time Algorithm)
# FB36 - 20131031
import math
import random
from collections import deque
from PIL import Image
imgx = 512 * 2
imgy = 512 * 2
image = Image.new("RGB", (imgx, imgy))
pixels = image.load()
#n = random.randint(3, 6) # of main circles
n = 3
a = math.pi... | Add "Circle Inversion Fractals (Apollonian Gasket)" | Add "Circle Inversion Fractals (Apollonian Gasket)"
| Python | mit | leovp/graphics | ---
+++
@@ -0,0 +1,43 @@
+# Circle Inversion Fractals (Apollonian Gasket) (Escape-time Algorithm)
+# FB36 - 20131031
+import math
+import random
+from collections import deque
+from PIL import Image
+imgx = 512 * 2
+imgy = 512 * 2
+image = Image.new("RGB", (imgx, imgy))
+pixels = image.load()
+#n = random.randint(3, ... | |
59ca3b5e97e2186f439f3f2fc82259ba56a3b78f | numpy/typing/tests/data/pass/modules.py | numpy/typing/tests/data/pass/modules.py | import numpy as np
np.char
np.ctypeslib
np.emath
np.fft
np.lib
np.linalg
np.ma
np.matrixlib
np.polynomial
np.random
np.rec
np.testing
np.version
np.__all__
np.__path__
np.__version__
np.__git_version__
np.__NUMPY_SETUP__
np.__deprecated_attrs__
np.__expired_functions__
| Add module-based tests to the `pass` tests | TST: Add module-based tests to the `pass` tests
| Python | bsd-3-clause | endolith/numpy,jakirkham/numpy,anntzer/numpy,simongibbons/numpy,anntzer/numpy,numpy/numpy,numpy/numpy,seberg/numpy,mattip/numpy,charris/numpy,seberg/numpy,jakirkham/numpy,simongibbons/numpy,mhvk/numpy,mhvk/numpy,pdebuyl/numpy,pbrod/numpy,pbrod/numpy,pdebuyl/numpy,endolith/numpy,seberg/numpy,pdebuyl/numpy,charris/numpy,... | ---
+++
@@ -0,0 +1,23 @@
+import numpy as np
+
+np.char
+np.ctypeslib
+np.emath
+np.fft
+np.lib
+np.linalg
+np.ma
+np.matrixlib
+np.polynomial
+np.random
+np.rec
+np.testing
+np.version
+
+np.__all__
+np.__path__
+np.__version__
+np.__git_version__
+np.__NUMPY_SETUP__
+np.__deprecated_attrs__
+np.__expired_functions_... | |
8ff7becc414e2969cf89468c6af95c0356abebae | src/axe-shrink.py | src/axe-shrink.py | #!/usr/bin/env python
# Given an axe trace that fails a given consistency model, try to find
# the smallest subset of the trace that also fails the model. This
# makes it easier to determine *why* a trace does not satisfy a model.
# This simple shrinker is only really effective when each store of a
# value to an add... | Add a rudimentary trace shrinker, implemented in python | Add a rudimentary trace shrinker, implemented in python
| Python | apache-2.0 | CTSRD-CHERI/axe,CTSRD-CHERI/axe,CTSRD-CHERI/axe,CTSRD-CHERI/axe | ---
+++
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+# Given an axe trace that fails a given consistency model, try to find
+# the smallest subset of the trace that also fails the model. This
+# makes it easier to determine *why* a trace does not satisfy a model.
+
+# This simple shrinker is only really effective when... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.