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 |
|---|---|---|---|---|---|---|---|---|---|---|
b72a4bb06fda18ebca91649808cd2f2c531b392e | migrations/versions/0060.py | migrations/versions/0060.py | """empty message
Revision ID: 0060 set all show_banner_text
Revises: 0059 add show_banner_text
Create Date: 2021-10-03 00:31:22.285217
"""
# revision identifiers, used by Alembic.
revision = '0060 set all show_banner_text'
down_revision = '0059 add show_banner_text'
from alembic import op
def upgrade():
op.ex... | Set all events to show banner text | Set all events to show banner text
| Python | mit | NewAcropolis/api,NewAcropolis/api,NewAcropolis/api | ---
+++
@@ -0,0 +1,20 @@
+"""empty message
+
+Revision ID: 0060 set all show_banner_text
+Revises: 0059 add show_banner_text
+Create Date: 2021-10-03 00:31:22.285217
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0060 set all show_banner_text'
+down_revision = '0059 add show_banner_text'
+
+from alem... | |
79637efbdda03cea88fa6a59b24a27f1d393c79f | corehq/util/tests/test_es_interface.py | corehq/util/tests/test_es_interface.py | from django.test import SimpleTestCase
from mock import ANY, patch
from corehq.apps.es.tests.utils import es_test
from corehq.elastic import SerializationError, get_es_new
from corehq.util.es.interface import ElasticsearchInterface
@es_test
class TestESInterface(SimpleTestCase):
@classmethod
def setUpClass(... | Add tests for previous commit | Add tests for previous commit
inb4 this is backwards
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,53 @@
+from django.test import SimpleTestCase
+from mock import ANY, patch
+
+from corehq.apps.es.tests.utils import es_test
+from corehq.elastic import SerializationError, get_es_new
+from corehq.util.es.interface import ElasticsearchInterface
+
+
+@es_test
+class TestESInterface(SimpleTestCase):
... | |
fd3eaa3810ce82db864b3fcafe61d16ab53d85e5 | perftest/scripts/webserver.py | perftest/scripts/webserver.py | from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class Handler(BaseHTTPRequestHandler):
def do(self):
self.send_response(200)
self.wfile.write('{"headers":{"type":"type"},"content":{"b":2}}')
def do_GET(self):
self.do()
def do_POST(self):
self.do()
def main():
try:
server = ... | Add simple Python web server for performance testing | perftest: Add simple Python web server for performance testing
In order to profile bottlenecks in CCF's HTTP communication, a simple
Python webserver comes very handy. One can reason that the existing HTTP
server in CCF does not meet the performance requirements, if the
perftest client is clearly faster against the Py... | Python | apache-2.0 | akisaarinen/ccf,akisaarinen/ccf | ---
+++
@@ -0,0 +1,25 @@
+from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
+
+class Handler(BaseHTTPRequestHandler):
+ def do(self):
+ self.send_response(200)
+ self.wfile.write('{"headers":{"type":"type"},"content":{"b":2}}')
+
+ def do_GET(self):
+ self.do()
+
+ def do_POST(self):
+ self... | |
72be8a8fd8345542096ba31e3f1428ea25ea9498 | ex6.py | ex6.py | end1 = "C"
end2 = "H"
end3 = "E"
end4 = "E"
end5 = "S"
end6 = "E"
end7 = "B"
end8 = "U"
end9 = "R"
end10 = "G"
end11 = "E"
end12 = "R"
# Printing without a comma
print end1 + end2 + end3 + end4 + end5 + end6
print end7 + end8 + end9 + end10 + end11 + end12
# Printing with a comma
print end1 + end2 + end3 + end4 + end5 ... | Print with vs without a comma | Print with vs without a comma
| Python | mit | nguyennam9696/Learn_Python_The_Hard_Way | ---
+++
@@ -0,0 +1,18 @@
+end1 = "C"
+end2 = "H"
+end3 = "E"
+end4 = "E"
+end5 = "S"
+end6 = "E"
+end7 = "B"
+end8 = "U"
+end9 = "R"
+end10 = "G"
+end11 = "E"
+end12 = "R"
+# Printing without a comma
+print end1 + end2 + end3 + end4 + end5 + end6
+print end7 + end8 + end9 + end10 + end11 + end12
+# Printing with a co... | |
96035f6bb2a298cea859b1e5e9812e2dd83982d2 | dnanexus/shell/resources/home/dnanexus/upload_file.py | dnanexus/shell/resources/home/dnanexus/upload_file.py | #!/usr/bin/env python
# -*- coding: latin-1 -*-
import os, sys, time, subprocess, json, requests
HEADERS = {
'Content-type': 'application/json',
'Accept': 'application/json',
}
path = 'test.fastq'
FILE_URL = 'http://test.encodedcc.org/TSTFF867178/upload/'
ENCODED_KEY = '...'
ENCODED_SECRET_KEY = '...'
respo... | Add script to upload files to shell applet | Add script to upload files to shell applet
| Python | mit | ENCODE-DCC/chip-seq-pipeline,ENCODE-DCC/chip-seq-pipeline,ENCODE-DCC/chip-seq-pipeline,ENCODE-DCC/chip-seq-pipeline | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# -*- coding: latin-1 -*-
+
+import os, sys, time, subprocess, json, requests
+
+HEADERS = {
+ 'Content-type': 'application/json',
+ 'Accept': 'application/json',
+}
+
+path = 'test.fastq'
+FILE_URL = 'http://test.encodedcc.org/TSTFF867178/upload/'
+ENCODED_KEY =... | |
85f6b2437b57c6e33ff56422b15aaab690704218 | ckanext/doi/tests/test_schema.py | ckanext/doi/tests/test_schema.py | #!/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-doi
# Created by the Natural History Museum in London, UK
import ckanext.doi.api as doi_api
import ckanext.doi.lib as doi_lib
import mock
import requests
from ckantest.factories import DataConstants
from ckantest.models import TestBase
from lxml ... | Add test to validate against schema | Add test to validate against schema
| Python | mit | NaturalHistoryMuseum/ckanext-doi,NaturalHistoryMuseum/ckanext-doi,NaturalHistoryMuseum/ckanext-doi | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+# This file is part of ckanext-doi
+# Created by the Natural History Museum in London, UK
+
+import ckanext.doi.api as doi_api
+import ckanext.doi.lib as doi_lib
+import mock
+import requests
+from ckantest.factories import DataConstants
+from cka... | |
a7629ef3acedaa688a455c01afb65c40a53c14b0 | tests/test_draw.py | tests/test_draw.py | import batoid
import time
import os
import yaml
import numpy as np
import pytest
from test_helpers import timer
# Use matplotlib with a non-interactive backend.
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
@timer
def initialize(ngrid=25, theta_x=1.):... | Add unit test for drawing routines | Add unit test for drawing routines
| Python | bsd-2-clause | jmeyers314/jtrace,jmeyers314/batoid,jmeyers314/jtrace,jmeyers314/batoid,jmeyers314/jtrace | ---
+++
@@ -0,0 +1,62 @@
+import batoid
+import time
+import os
+import yaml
+import numpy as np
+import pytest
+from test_helpers import timer
+
+# Use matplotlib with a non-interactive backend.
+import matplotlib as mpl
+mpl.use('Agg')
+import matplotlib.pyplot as plt
+from mpl_toolkits.mplot3d import Axes3D
+
+
+@... | |
41f0533edc9ebe788722711af95e040d4f06abb9 | lglass/bird.py | lglass/bird.py | # coding: utf-8
import subprocess
import netaddr
import lglass.route
class BirdClient(object):
def __init__(self, executable="birdc"):
self.executable = executable
def send(self, command, raw=False):
argv = [self.executable]
if raw:
argv.append("-v")
if isinstance(command, str):
argv.extend(comman... | Add simple BIRD client class | Add simple BIRD client class
| Python | mit | fritz0705/lglass | ---
+++
@@ -0,0 +1,92 @@
+# coding: utf-8
+
+import subprocess
+
+import netaddr
+
+import lglass.route
+
+class BirdClient(object):
+ def __init__(self, executable="birdc"):
+ self.executable = executable
+
+ def send(self, command, raw=False):
+ argv = [self.executable]
+ if raw:
+ argv.append("-v")
+ if isi... | |
064386acbe509f872e40f3f577e7b6189ed91434 | src/test/ed/lang/python/thread2_test.py | src/test/ed/lang/python/thread2_test.py | import _10gen
import ed.appserver.AppContext
import ed.lang.python.Python
import java.io.File
# FIXME: this test produces a lot of output
_10gen.__instance__ = ed.lang.python.Python.toPython(ed.appserver.AppContext(java.io.File('.')))
import test.test_thread
import test.test_threading
| Test threading in app server rather than in serverTest. | Test threading in app server rather than in serverTest.
| Python | apache-2.0 | babble/babble,babble/babble,babble/babble,babble/babble,babble/babble,babble/babble | ---
+++
@@ -0,0 +1,10 @@
+import _10gen
+import ed.appserver.AppContext
+import ed.lang.python.Python
+import java.io.File
+
+# FIXME: this test produces a lot of output
+_10gen.__instance__ = ed.lang.python.Python.toPython(ed.appserver.AppContext(java.io.File('.')))
+
+import test.test_thread
+import test.test_threa... | |
3b5234a370db18fc51d8ad8573981c85544abb47 | test/frameworks/lib/fix_auth_failure.py | test/frameworks/lib/fix_auth_failure.py | #!/usr/bin/env python
# $Id: fix_auth_failure.py,v 1.1 2011-02-15 20:28:38 barry409 Exp $
# Copyright (c) 2011 Board of Trustees of Leland Stanford Jr. University,
# all rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation fi... | Add code to fix the python 2.6.6 auth failure issue. | Add code to fix the python 2.6.6 auth failure issue.
git-svn-id: 293778eaa97c8c94097d610b1bd5133a8f478f36@10708 4f837ed2-42f5-46e7-a7a5-fa17313484d4
| Python | bsd-3-clause | edina/lockss-daemon,lockss/lockss-daemon,edina/lockss-daemon,edina/lockss-daemon,lockss/lockss-daemon,edina/lockss-daemon,edina/lockss-daemon,edina/lockss-daemon,edina/lockss-daemon,lockss/lockss-daemon,lockss/lockss-daemon,lockss/lockss-daemon,lockss/lockss-daemon,lockss/lockss-daemon | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+# $Id: fix_auth_failure.py,v 1.1 2011-02-15 20:28:38 barry409 Exp $
+
+# Copyright (c) 2011 Board of Trustees of Leland Stanford Jr. University,
+# all rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this soft... | |
a8bd9defcf3359296acf7633041b036213868075 | install.py | install.py | #!/usr/bin/env python
import subprocess
def sudo(command_text):
parts = ['sudo']
parts.extend(command_text.split(command_text))
subprocess.call(parts)
def apt_get_install(package_name):
command_text = "apt-get -y install {0}".format(package_name)
sudo(command_text)
def main():
# Install s... | Make getting started easier with a handy script | Make getting started easier with a handy script
| Python | mit | projectweekend/Pi-Camera-Time-Lapse,projectweekend/Pi-Camera-Time-Lapse | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+import subprocess
+
+
+def sudo(command_text):
+ parts = ['sudo']
+ parts.extend(command_text.split(command_text))
+ subprocess.call(parts)
+
+
+def apt_get_install(package_name):
+ command_text = "apt-get -y install {0}".format(package_name)
+ sudo(co... | |
6f3579e6ac32211779481307f8e508469dde7605 | externalNMEA.py | externalNMEA.py | from __future__ import print_function
import requests
import argparse
import time
import logging
import sys
import serial
import pynmea2
log = logging.getLogger()
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
def set_position_master(url, latitude, longitude, orientation):
payload = di... | Add example of how to read from a external GPS outputting NMEA messages. | Add example of how to read from a external GPS outputting NMEA messages.
Parsing using pynmea2
| Python | mit | waterlinked/examples | ---
+++
@@ -0,0 +1,69 @@
+from __future__ import print_function
+import requests
+import argparse
+import time
+import logging
+import sys
+import serial
+import pynmea2
+
+
+log = logging.getLogger()
+logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
+
+def set_position_master(url, latitude, ... | |
ac0d0b78b7b4eef913460894fca3af1ace222c7f | tests/test_damage.py | tests/test_damage.py | import unittest
from damage import Damage
class DamageTests(unittest.TestCase):
def test_init(self):
dmg = Damage(phys_dmg=1.34, magic_dmg=1.49391)
expected_phys_dmg = 1.3
expected_m_dmg = 1.5
expected_absorbed = 0
# it should round the magic/phys dmg to 1 point after the ... | Test template for the Damage class | Test template for the Damage class
| Python | mit | Enether/python_wow | ---
+++
@@ -0,0 +1,20 @@
+import unittest
+from damage import Damage
+
+
+class DamageTests(unittest.TestCase):
+ def test_init(self):
+ dmg = Damage(phys_dmg=1.34, magic_dmg=1.49391)
+ expected_phys_dmg = 1.3
+ expected_m_dmg = 1.5
+ expected_absorbed = 0
+
+ # it should round t... | |
9349adb2efa5f0242cf9250d74d714a7e6aea1e9 | ordination/__init__.py | ordination/__init__.py | from .base import CA, RDA, CCA
__all__ = ['CA', 'RDA', 'CCA']
#
#from numpy.testing import Tester
#test = Tester().test
__version__ = '0.1-dev'
| from .base import CA, RDA, CCA
__all__ = ['CA', 'RDA', 'CCA']
#
#from numpy.testing import Tester
#test = Tester().test
# Compatible with PEP386
__version__ = '0.1.dev'
| Make version compatible with PEP386 | MAINT: Make version compatible with PEP386
| Python | bsd-3-clause | xguse/scikit-bio,wdwvt1/scikit-bio,johnchase/scikit-bio,xguse/scikit-bio,colinbrislawn/scikit-bio,Achuth17/scikit-bio,Achuth17/scikit-bio,jdrudolph/scikit-bio,Kleptobismol/scikit-bio,jensreeder/scikit-bio,Jorge-C/bipy,jairideout/scikit-bio,kdmurray91/scikit-bio,averagehat/scikit-bio,wdwvt1/scikit-bio,Kleptobismol/sciki... | ---
+++
@@ -6,4 +6,5 @@
#from numpy.testing import Tester
#test = Tester().test
-__version__ = '0.1-dev'
+# Compatible with PEP386
+__version__ = '0.1.dev' |
c5e047ff0e1cfe35692838365b907db8c3746c4b | doc/examples/plot_join_segmentations.py | doc/examples/plot_join_segmentations.py | """
==========================================
Find the intersection of two segmentations
==========================================
When segmenting an image, you may want to combine multiple alternative
segmentations. The `skimage.segmentation.join_segmentations` function
computes the join of two segmentations, in wh... | Add join_segmentations example to the gallery | Add join_segmentations example to the gallery
| Python | bsd-3-clause | Midafi/scikit-image,rjeli/scikit-image,youprofit/scikit-image,GaZ3ll3/scikit-image,keflavich/scikit-image,michaelaye/scikit-image,chintak/scikit-image,rjeli/scikit-image,youprofit/scikit-image,vighneshbirodkar/scikit-image,newville/scikit-image,almarklein/scikit-image,ClinicalGraphics/scikit-image,Britefury/scikit-imag... | ---
+++
@@ -0,0 +1,68 @@
+"""
+==========================================
+Find the intersection of two segmentations
+==========================================
+
+When segmenting an image, you may want to combine multiple alternative
+segmentations. The `skimage.segmentation.join_segmentations` function
+computes t... | |
2b146388d1804ca4cb069fa07ea5e614a8ee1d14 | tools/send_to_fcm.py | tools/send_to_fcm.py | import requests
url = 'https://fcm.googleapis.com/fcm/send'
headers = {'Content-Type': 'application/json',
'Authorization': 'key=AIza...(copy code here)...'}
payload = """
{
"to": "/topics/all",
"notification": {
"title": "Hello world",
"body": "You are beautiful"
}
}
"""
resp = requests.po... | Add example of sending push notification via Firebase Cloud Messaging | Add example of sending push notification via Firebase Cloud Messaging
| Python | apache-2.0 | sth-larp/deus-mobile,sth-larp/deus-mobile,sth-larp/deus-mobile,sth-larp/deus-mobile,sth-larp/deus-mobile | ---
+++
@@ -0,0 +1,18 @@
+import requests
+
+url = 'https://fcm.googleapis.com/fcm/send'
+headers = {'Content-Type': 'application/json',
+ 'Authorization': 'key=AIza...(copy code here)...'}
+
+payload = """
+{
+ "to": "/topics/all",
+ "notification": {
+ "title": "Hello world",
+ "body": "You are b... | |
a3e9097247f4abe660696e5bd19f06e7e5756249 | python/day9.py | python/day9.py | #!/usr/local/bin/python3
def parse_input(text):
"""Parse a list of destinations and weights
Returns a list of tuples (source, dest, weight).
Edges in this graph and undirected.
The input contains multiple rows appearing like so:
A to B = W
Where A and B are strings and W is the weight t... | Add start of Python solution for day 9 (parsing only) | Add start of Python solution for day 9 (parsing only)
| Python | mit | robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/local/bin/python3
+
+
+def parse_input(text):
+ """Parse a list of destinations and weights
+
+ Returns a list of tuples (source, dest, weight).
+
+ Edges in this graph and undirected.
+
+ The input contains multiple rows appearing like so:
+ A to B = W
+ Where A... | |
b95e5cd706a1cf81e41debae30422345cef3a1ee | tests/committerparser.py | tests/committerparser.py | #!/usr/bin/python
import sys
import getopt
import re
import email.utils
import datetime
class Usage(Exception):
def __init__(self, msg):
self.msg = msg
def parse_date(datestr):
d = email.utils.parsedate(datestr)
return datetime.datetime(d[0],d[1],d[2],d[3],d[4],d[5],d[6])
def parse_gitlog(filena... | Add simple parser to return some activity numbers from our git log. | Add simple parser to return some activity numbers from our git log.
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,104 @@
+#!/usr/bin/python
+import sys
+import getopt
+import re
+import email.utils
+import datetime
+
+class Usage(Exception):
+ def __init__(self, msg):
+ self.msg = msg
+
+def parse_date(datestr):
+ d = email.utils.parsedate(datestr)
+
+ return datetime.datetime(d[0],d[1],d[2],d[... | |
3020b2084b24f1e00f0b9fc1d06186b1e697647e | tests/unit/utils/args.py | tests/unit/utils/args.py | # -*- coding: utf-8 -*-
# Import Salt Libs
from salt.utils import args
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import NO_MOCK, NO_MOCK_REASON
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
@skipIf(NO_MOCK, NO_MOCK_REASON)
class ArgsTes... | Test long jid passed on CLI | Test long jid passed on CLI
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+
+# Import Salt Libs
+from salt.utils import args
+
+# Import Salt Testing Libs
+from salttesting import TestCase, skipIf
+from salttesting.mock import NO_MOCK, NO_MOCK_REASON
+from salttesting.helpers import ensure_in_syspath
+
+ensure_in_syspath('../../')
+
+@skipI... | |
8f597e766e9ef8014da4391a7109d9b77daf127e | tests/user_utils_test.py | tests/user_utils_test.py | """Tests for user utility functions."""
from drudge import Vec, sum_, prod_
from drudge.term import parse_terms
def test_sum_prod_utility():
"""Test the summation and product utility."""
v = Vec('v')
vecs = [v[i] for i in range(3)]
v0, v1, v2 = vecs
# The proxy object cannot be directly compare... | Add tests for user utilities sum_ and prod_ | Add tests for user utilities sum_ and prod_
| Python | mit | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge | ---
+++
@@ -0,0 +1,19 @@
+"""Tests for user utility functions."""
+
+from drudge import Vec, sum_, prod_
+from drudge.term import parse_terms
+
+
+def test_sum_prod_utility():
+ """Test the summation and product utility."""
+
+ v = Vec('v')
+ vecs = [v[i] for i in range(3)]
+ v0, v1, v2 = vecs
+
+ # Th... | |
06c3a417f0270d76a7fcc9e94fdb40f9952b9d12 | src/wirecloud/fiware/views.py | src/wirecloud/fiware/views.py | # -*- coding: utf-8 -*-
# Copyright (c) 2012-2013 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either v... | Add a login view that automatically starts the oauth2 flow for authenticating using the IdM server | Add a login view that automatically starts the oauth2 flow for authenticating using the IdM server
| Python | agpl-3.0 | jpajuelo/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud | ---
+++
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2012-2013 CoNWeT Lab., Universidad Politécnica de Madrid
+
+# This file is part of Wirecloud.
+
+# Wirecloud is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# th... | |
c51bb87714ade403aeabc9b4b4c62b4ee3a7a8c5 | scripts/test-scrobble.py | scripts/test-scrobble.py | #!/usr/bin/env python
##### CONFIG #####
SERVER = "turtle.libre.fm"
USER = "testuser"
PASSWORD = "password"
##################
import gobble, datetime
print "Handshaking..."
gs = gobble.GobbleServer(SERVER, USER, PASSWORD, 'tst')
time = datetime.datetime.now() - datetime.timedelta(days=1) # Yesterday
track = gobb... | Add test script for checking to see if scrobbling works on new installs | Add test script for checking to see if scrobbling works on new installs
| Python | agpl-3.0 | foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+##### CONFIG #####
+
+SERVER = "turtle.libre.fm"
+USER = "testuser"
+PASSWORD = "password"
+
+
+##################
+
+import gobble, datetime
+
+print "Handshaking..."
+gs = gobble.GobbleServer(SERVER, USER, PASSWORD, 'tst')
+time = datetime.datetime.now() - datetime... | |
97b9ee00277fa35c92886b1ed39864eba3707dce | bluebottle/activities/migrations/0020_auto_20200224_1005.py | bluebottle/activities/migrations/0020_auto_20200224_1005.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-11-11 12:19
from __future__ import unicode_literals
from django.db import migrations
from bluebottle.utils.utils import update_group_permissions
def add_group_permissions(apps, schema_editor):
group_perms = {
'Staff': {
'perms': (
... | Add organizer permissions to staff group | Add organizer permissions to staff group
BB-16555 #resolve
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.15 on 2019-11-11 12:19
+from __future__ import unicode_literals
+
+from django.db import migrations
+from bluebottle.utils.utils import update_group_permissions
+
+
+def add_group_permissions(apps, schema_editor):
+ group_perms = {
+ ... | |
efbf98235b82c954364f35cb09f63006e23346e2 | tests/test_lang_javascript.py | tests/test_lang_javascript.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import pytest # type: ignore
from sensibility.language import Language
from sensibility.language.javascript import javascript
from sensibility.token_utils import Position
from location_factory import LocationFactory
test_file = r"""#!/usr/bin/env node
/*!
* This is a... | Create tests for JavaScript parser. | Create tests for JavaScript parser.
| Python | apache-2.0 | eddieantonio/ad-hoc-miner,naturalness/sensibility,naturalness/sensibility,eddieantonio/ad-hoc-miner,naturalness/sensibility,eddieantonio/ad-hoc-miner,eddieantonio/ad-hoc-miner,naturalness/sensibility | ---
+++
@@ -0,0 +1,50 @@
+#!/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+
+import pytest # type: ignore
+
+from sensibility.language import Language
+from sensibility.language.javascript import javascript
+from sensibility.token_utils import Position
+
+from location_factory import LocationFactory
+
+test_file = r... | |
09ee7c5972f3a508355f6dfd49ff05d8de482cd9 | shs_example.py | shs_example.py | import numpy as np
import matplotlib.pyplot as plt
import rsf
model = rsf.RateState()
# Set model initial conditions
model.mu0 = 0.6 # Friction initial (at the reference velocity)
model.a = 0.005 # Empirical coefficient for the direct effect
model.b = 0.01 # Empirical coefficient for the evolution effect
model.dc = 1... | Add example of slide-hold-slide test | Add example of slide-hold-slide test
| Python | mit | jrleeman/rsfmodel | ---
+++
@@ -0,0 +1,37 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import rsf
+
+model = rsf.RateState()
+
+# Set model initial conditions
+model.mu0 = 0.6 # Friction initial (at the reference velocity)
+model.a = 0.005 # Empirical coefficient for the direct effect
+model.b = 0.01 # Empirical coefficient ... | |
4f7b103d6c5fa3b07abb23e346caa995a7f803ef | tests/completion.py | tests/completion.py | from _utils import _output_eq, IntegrationSpec
class ShellCompletion(IntegrationSpec):
"""
Shell tab-completion behavior
"""
def no_input_means_just_task_names(self):
_output_eq('-c simple_ns_list --complete', "z_toplevel\na.b.subtask\n")
def no_input_with_no_tasks_yields_empty_response(... | import sys
from nose.tools import ok_
from _utils import _output_eq, IntegrationSpec, _dispatch, trap, expect_exit
class ShellCompletion(IntegrationSpec):
"""
Shell tab-completion behavior
"""
def no_input_means_just_task_names(self):
_output_eq('-c simple_ns_list --complete', "z_toplevel\n... | Make new test fail correctlyish | Make new test fail correctlyish
| Python | bsd-2-clause | mkusz/invoke,kejbaly2/invoke,mkusz/invoke,pyinvoke/invoke,mattrobenolt/invoke,kejbaly2/invoke,tyewang/invoke,frol/invoke,singingwolfboy/invoke,pyinvoke/invoke,frol/invoke,pfmoore/invoke,pfmoore/invoke,mattrobenolt/invoke | ---
+++
@@ -1,4 +1,8 @@
-from _utils import _output_eq, IntegrationSpec
+import sys
+
+from nose.tools import ok_
+
+from _utils import _output_eq, IntegrationSpec, _dispatch, trap, expect_exit
class ShellCompletion(IntegrationSpec):
@@ -12,5 +16,11 @@
def no_input_with_no_tasks_yields_empty_response(self):... |
661943403b9a4b7c28bf9e0a59ba937dc2298fef | netmiko/ssh_autodetect.py | netmiko/ssh_autodetect.py | """
This module is used to auto-detect the type of a device in order to automatically create a
Netmiko connection.
The will avoid to hard coding the 'device_type' when using the ConnectHandler factory function
from Netmiko.
"""
from netmiko.ssh_dispatcher import CLASS_MAPPER_BASE, ConnectHandler
SSH_MAPPER_BASE = {}... | Add SSH auto detect feature | Add SSH auto detect feature
| Python | mit | isidroamv/netmiko,ktbyers/netmiko,fooelisa/netmiko,ktbyers/netmiko,isidroamv/netmiko,fooelisa/netmiko | ---
+++
@@ -0,0 +1,74 @@
+"""
+This module is used to auto-detect the type of a device in order to automatically create a
+Netmiko connection.
+
+The will avoid to hard coding the 'device_type' when using the ConnectHandler factory function
+from Netmiko.
+"""
+
+from netmiko.ssh_dispatcher import CLASS_MAPPER_BASE, ... | |
0d32800fec1419eac39711fd8c94ce07896cddaf | sknn/tests/test_gaussian.py | sknn/tests/test_gaussian.py | import unittest
from nose.tools import (assert_is_not_none, assert_raises, assert_equal)
from sknn.mlp import MultiLayerPerceptronRegressor as MLPR
from . import test_linear
class TestGaussianOutput(test_linear.TestLinearNetwork):
def setUp(self):
self.nn = MLPR(layers=[("LinearGaussian",)])
| Test for the gaussian output layer, going through all same fit() and predict() tests as the linear output. | Test for the gaussian output layer, going through all same fit() and predict() tests as the linear output.
| Python | bsd-3-clause | gticket/scikit-neuralnetwork,IndraVikas/scikit-neuralnetwork,capitancambio/scikit-neuralnetwork,agomariz/scikit-neuralnetwork,freakynit/scikit-neuralnetwork,KhanSuleyman/scikit-neuralnetwork,aigamedev/scikit-neuralnetwork | ---
+++
@@ -0,0 +1,12 @@
+import unittest
+from nose.tools import (assert_is_not_none, assert_raises, assert_equal)
+
+from sknn.mlp import MultiLayerPerceptronRegressor as MLPR
+
+from . import test_linear
+
+
+class TestGaussianOutput(test_linear.TestLinearNetwork):
+
+ def setUp(self):
+ self.nn = MLPR(l... | |
74ffdab0c54f332b8787aea04582ee7312a34b4c | src/ggrc/migrations/versions/20161123124848_1f5c3e0025da_remove_control_id_column_from_.py | src/ggrc/migrations/versions/20161123124848_1f5c3e0025da_remove_control_id_column_from_.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Remove control_id column from assessments table
Create Date: 2016-11-23 12:48:48.942528
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name... | Remove control_id column from assessments table | Remove control_id column from assessments table
| Python | apache-2.0 | selahssea/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,se... | ---
+++
@@ -0,0 +1,82 @@
+# Copyright (C) 2016 Google Inc.
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+
+"""
+Remove control_id column from assessments table
+
+Create Date: 2016-11-23 12:48:48.942528
+"""
+# disable Invalid constant name pylint warning for mandatory Alembic varia... | |
372bd768acae6fbf425271b193d1734e5001c71a | 4/Solution.py | 4/Solution.py | class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
nums1.extend(nums2)
merged = sorted(nums1)
length = len(merged)
if length % 2 != 0:
return ... | Add initial working solution 4 | Add initial working solution 4
| Python | mit | xliiauo/leetcode,xliiauo/leetcode,xiao0720/leetcode,xliiauo/leetcode,xiao0720/leetcode | ---
+++
@@ -0,0 +1,20 @@
+class Solution(object):
+ def findMedianSortedArrays(self, nums1, nums2):
+ """
+ :type nums1: List[int]
+ :type nums2: List[int]
+ :rtype: float
+ """
+ nums1.extend(nums2)
+ merged = sorted(nums1)
+
+ length = len(merged)
+ ... | |
b66ad576230fb7c96a8f5c6c7b6af8a8e4c8d0b5 | vmf/games/source.py | vmf/games/source.py | """
Helper classes for creating maps in any Source Engine game.
"""
from vmf.vmf import Entity
from vmf.types import Origin
class LogicAuto(Entity):
"""Sets up certain game logic. Fires some useful map events.
https://developer.valvesoftware.com/wiki/Logic_auto
"""
def __init__(self):
... | Add module for Source Engine game logic entities | Add module for Source Engine game logic entities
| Python | bsd-2-clause | BHSPitMonkey/vmflib | ---
+++
@@ -0,0 +1,20 @@
+"""
+
+Helper classes for creating maps in any Source Engine game.
+
+"""
+
+from vmf.vmf import Entity
+from vmf.types import Origin
+
+class LogicAuto(Entity):
+
+ """Sets up certain game logic. Fires some useful map events.
+
+ https://developer.valvesoftware.com/wiki/Logic_auto... | |
a9388f7d4c4747e6710d20d618b57f19360cb69c | tests/adapters/compliance_tests/remove_vlan_test.py | tests/adapters/compliance_tests/remove_vlan_test.py | # Copyright 2019 Internap.
#
# 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, so... | Add remove vlan compliance test | Add remove vlan compliance test
| Python | apache-2.0 | lindycoder/netman,internaphosting/netman,internap/netman | ---
+++
@@ -0,0 +1,47 @@
+# Copyright 2019 Internap.
+#
+# 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 applic... | |
9ffe40aaf5ece521020258c4b31fbdb514e02b69 | manager/utilities.py | manager/utilities.py | from typing import Optional
from manager.models import Package, Build
def get_latest_build(package: Package) -> Optional[Build]:
try:
return Build.objects.filter(package=package, status=Build.SUCCESS).order_by('-id')[0]
except IndexError:
return None
| Add utility function for get latest Build | Add utility function for get latest Build
| Python | mit | colajam93/aurpackager,colajam93/aurpackager,colajam93/aurpackager,colajam93/aurpackager | ---
+++
@@ -0,0 +1,10 @@
+from typing import Optional
+
+from manager.models import Package, Build
+
+
+def get_latest_build(package: Package) -> Optional[Build]:
+ try:
+ return Build.objects.filter(package=package, status=Build.SUCCESS).order_by('-id')[0]
+ except IndexError:
+ return None | |
0b55d97573fcd196a318b3c901f6dcac1b0a4eef | chrome/test/functional/test_basic.py | chrome/test/functional/test_basic.py | #!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from pyauto import PyUITest
class SimpleTest(PyUITest):
def testCanOpenGoogle(self):
self.NavigateToURL("http... | Create a placeholder for pyauto test scripts. | Create a placeholder for pyauto test scripts.
Including a hello world script.
Review URL: http://codereview.chromium.org/668004
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@40579 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | ropik/chromium,adobe/chromium,ropik/chromium,gavinp/chromium,yitian134/chromium,adobe/chromium,adobe/chromium,ropik/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromi... | ---
+++
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+from pyauto import PyUITest
+
+
+class SimpleTest(PyUITest):
+
+ def testCanOpenGo... | |
6906f574fad033f0b68fe7a5a35f4fcef1207ee0 | Get_Webpage_Source.py | Get_Webpage_Source.py | import sublime
import sublime_plugin
import urllib
class GetWebpageSourceCommand(sublime_plugin.TextCommand):
def run(self, edit):
url = self.view.substr(self.view.sel()[0])
if len(url) == 0:
return
output = ""
r = urllib.request.urlopen(url)
output = str(r.read(), encoding='utf8')
... | Load the source from a highlighted URL into a new window | Load the source from a highlighted URL into a new window | Python | mit | RichardHyde/SublimeText.Packages | ---
+++
@@ -0,0 +1,20 @@
+import sublime
+import sublime_plugin
+import urllib
+
+class GetWebpageSourceCommand(sublime_plugin.TextCommand):
+ def run(self, edit):
+ url = self.view.substr(self.view.sel()[0])
+
+ if len(url) == 0:
+ return
+
+ output = ""
+
+ r = urllib.request.urlopen(url)
+
+ o... | |
93d80604003e1b3b21498df01f7647e7cea69a5f | cybox/test/objects/win_event_test.py | cybox/test/objects/win_event_test.py | # Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.objects.win_event_object import WinEvent
from cybox.test.objects import ObjectTestCase
class TestWinThread(ObjectTestCase, unittest.TestCase):
object_type = "WindowsEventObjectType"... | Add basic WinEvent object tests. | Add basic WinEvent object tests.
| Python | bsd-3-clause | CybOXProject/python-cybox | ---
+++
@@ -0,0 +1,27 @@
+# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
+# See LICENSE.txt for complete terms.
+
+import unittest
+
+from cybox.objects.win_event_object import WinEvent
+from cybox.test.objects import ObjectTestCase
+
+
+class TestWinThread(ObjectTestCase, unittest.TestCase):
+ ... | |
89d4c1420805a6f2e491f1ab250722cdcf950bd8 | ndtable/engine/mv.py | ndtable/engine/mv.py | import sys
import time
import numpy as np
from minivect import miniast
from minivect import specializers
from minivect import minitypes
from minivect.ctypes_conversion import get_data_pointer, \
get_pointer, convert_to_ctypes
from ndtable.datashape.coretypes import var_generator
from ndtable.expr.visitor import ... | Work towards integration NDTable <-> Minivect | Work towards integration NDTable <-> Minivect
| Python | bsd-2-clause | seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core | ---
+++
@@ -0,0 +1,84 @@
+import sys
+import time
+
+import numpy as np
+
+from minivect import miniast
+from minivect import specializers
+from minivect import minitypes
+from minivect.ctypes_conversion import get_data_pointer, \
+ get_pointer, convert_to_ctypes
+from ndtable.datashape.coretypes import var_genera... | |
1146ab654c8b0d6f982f19bafed91f18edb877f3 | tests/rules/test_dirty_unzip.py | tests/rules/test_dirty_unzip.py | import os
import pytest
import zipfile
from thefuck.rules.dirty_unzip import match, get_new_command, side_effect
from tests.utils import Command
@pytest.fixture
def zip_error(tmpdir):
path = os.path.join(str(tmpdir), 'foo.zip')
def reset(path):
with zipfile.ZipFile(path, 'w') as archive:
... | Add tests for the `dirty_unzip` rule | Add tests for the `dirty_unzip` rule
| Python | mit | gogobebe2/thefuck,bigplus/thefuck,Aeron/thefuck,manashmndl/thefuck,subajat1/thefuck,PLNech/thefuck,princeofdarkness76/thefuck,mcarton/thefuck,lawrencebenson/thefuck,thinkerchan/thefuck,Clpsplug/thefuck,vanita5/thefuck,levythu/thefuck,BertieJim/thefuck,hxddh/thefuck,Clpsplug/thefuck,zhangzhishan/thefuck,barneyElDinosaur... | ---
+++
@@ -0,0 +1,45 @@
+import os
+import pytest
+import zipfile
+from thefuck.rules.dirty_unzip import match, get_new_command, side_effect
+from tests.utils import Command
+
+
+@pytest.fixture
+def zip_error(tmpdir):
+ path = os.path.join(str(tmpdir), 'foo.zip')
+
+ def reset(path):
+ with zipfile.Zip... | |
0749111442c638569b6e42a11adee70e71e50813 | test/lldbpexpect.py | test/lldbpexpect.py | import lldb
from lldbtest import *
import lldbutil
import os
import unittest2
import sys
import pexpect
class PExpectTest(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
def doTest(self):
# put your commands he... | Add an helper class to write pexpect-based test cases Over time, we should improve this class and port all pexpect based testing over to using this | Add an helper class to write pexpect-based test cases
Over time, we should improve this class and port all pexpect based testing over to using this
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@227875 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb | ---
+++
@@ -0,0 +1,48 @@
+import lldb
+from lldbtest import *
+import lldbutil
+import os
+import unittest2
+import sys
+import pexpect
+
+class PExpectTest(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ def ... | |
305c3e0ce2705dd23e00ec801f5588ec1dbcc3a8 | py/two-sum-ii-input-array-is-sorted.py | py/two-sum-ii-input-array-is-sorted.py | class Solution(object):
def twoSum(self, numbers, target):
"""
:type numbers: List[int]
:type target: int
:rtype: List[int]
"""
head, tail = 0, len(numbers) - 1
while head < tail:
s = numbers[head] + numbers[tail]
if s == target:
... | Add py solution for 167. Two Sum II - Input array is sorted | Add py solution for 167. Two Sum II - Input array is sorted
167. Two Sum II - Input array is sorted: https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,17 @@
+class Solution(object):
+ def twoSum(self, numbers, target):
+ """
+ :type numbers: List[int]
+ :type target: int
+ :rtype: List[int]
+ """
+ head, tail = 0, len(numbers) - 1
+ while head < tail:
+ s = numbers[head] + numbers[tai... | |
f8e24bf955eb70535b989aad6ab8666ddd013da1 | tests/test_basic.py | tests/test_basic.py | import pytest
import subprocess
import os
import sys
prefix = '.'
for i in range(0,3):
if os.path.exists(os.path.join(prefix, 'pyiso.py')):
sys.path.insert(0, prefix)
break
else:
prefix = '../' + prefix
import pyiso
def test_nofiles(tmpdir):
# First set things up, and generate the... | Add in first py.test tests. | Add in first py.test tests.
Signed-off-by: Chris Lalancette <281cd07d7578d97c83271fbbf2faddb83ab3791c@gmail.com>
| Python | lgpl-2.1 | clalancette/pycdlib,clalancette/pyiso | ---
+++
@@ -0,0 +1,29 @@
+import pytest
+import subprocess
+import os
+import sys
+
+prefix = '.'
+for i in range(0,3):
+ if os.path.exists(os.path.join(prefix, 'pyiso.py')):
+ sys.path.insert(0, prefix)
+ break
+ else:
+ prefix = '../' + prefix
+
+import pyiso
+
+def test_nofiles(tmpdir):
... | |
9c6f0cf829f4f0c7ff71ad65bed36269425dae13 | social_core/tests/backends/test_zoom.py | social_core/tests/backends/test_zoom.py | import json
from .oauth import OAuth2Test
class ZoomOAuth2Test(OAuth2Test):
backend_path = 'social_core.backends.zoom.ZoomOAuth2'
user_data_url = 'https://api.zoom.us/v2/users/me'
expected_username = 'foobar'
access_token_body = json.dumps({
'access_token': 'foobar-token',
'token_type... | Add test for zoom backend | Add test for zoom backend
| Python | bsd-3-clause | python-social-auth/social-core,python-social-auth/social-core | ---
+++
@@ -0,0 +1,63 @@
+import json
+
+from .oauth import OAuth2Test
+
+
+class ZoomOAuth2Test(OAuth2Test):
+ backend_path = 'social_core.backends.zoom.ZoomOAuth2'
+ user_data_url = 'https://api.zoom.us/v2/users/me'
+ expected_username = 'foobar'
+ access_token_body = json.dumps({
+ 'access_token... | |
6824c741c455339eaaff5481f6e84c42fe1e26cf | susanplay/mainSusan.py | susanplay/mainSusan.py |
"""
This is a template top level script.
Please don't edit this file. Instead, copy it to
youname_main.py, then run and edit that file.
"""
import dave.pipeline.pipeline as dpp
import dave.pipeline.clipboard as clipboard
def main():
"""A bare bones main program"""
cfg = loadMyConfiguration()
epicList ... | Copy of main.py from fergal, reworked | Copy of main.py from fergal, reworked
| Python | mit | barentsen/dave,barentsen/dave,barentsen/dave,barentsen/dave | ---
+++
@@ -0,0 +1,84 @@
+
+"""
+This is a template top level script.
+
+Please don't edit this file. Instead, copy it to
+youname_main.py, then run and edit that file.
+
+"""
+
+import dave.pipeline.pipeline as dpp
+import dave.pipeline.clipboard as clipboard
+
+def main():
+ """A bare bones main program"""
+ ... | |
a4a956899008102b993d2268fbf6ae92d191ee6a | ifttt/ifttt-tests.py | ifttt/ifttt-tests.py | # -*- coding: utf-8 -*-
"""
Wikipedia channel for IFTTT
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copyright 2015 Ori Livneh <ori@wikimedia.org>
Stephen LaPorte <stephen.laporte@gmail.com>
Alangi Derick <alangiderick@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");... | Test suite for Wikipedia triggers | Test suite for Wikipedia triggers
* This marks the start of the test cases for
Wikipedia IFTTT triggers.
| Python | apache-2.0 | ch3nkula/ifttt,ch3nkula/ifttt,ch3nkula/ifttt | ---
+++
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+"""
+ Wikipedia channel for IFTTT
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Copyright 2015 Ori Livneh <ori@wikimedia.org>
+ Stephen LaPorte <stephen.laporte@gmail.com>
+ Alangi Derick <alangiderick@gmail.com>
+
+ Licensed under the Apache ... | |
4a8c3043962efa7e2a443a10a0ad13d025699730 | support/get_lsf_job_info.py | support/get_lsf_job_info.py | import os
import sys
from subprocess import Popen, PIPE
# --------------------------------------------------------------------------------------------------
def get_job_run_time(lsf_output_file, time='s'):
"""
"""
fp = open(lsf_output_file, 'r')
process = Popen(['grep', 'Run time', lsf_output_file], stdin=PIPE, ... | Add script to extract useful lsf job information | Add script to extract useful lsf job information
| Python | apache-2.0 | Rfam/rfam-production,Rfam/rfam-production,Rfam/rfam-production | ---
+++
@@ -0,0 +1,49 @@
+import os
+import sys
+from subprocess import Popen, PIPE
+
+# --------------------------------------------------------------------------------------------------
+
+def get_job_run_time(lsf_output_file, time='s'):
+ """
+ """
+
+ fp = open(lsf_output_file, 'r')
+ process = Popen(['grep', 'Ru... | |
52d947daa8ea6642472660d0c16c2b05e34bea41 | src/users/migrations/0010_cocrecord.py | src/users/migrations/0010_cocrecord.py | # Generated by Django 3.0.2 on 2020-02-23 11:12
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0009_auto_20160227_1656'),
]
operations = [... | Add migration file for the model of CoC record | Add migration file for the model of CoC record
| Python | mit | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | ---
+++
@@ -0,0 +1,23 @@
+# Generated by Django 3.0.2 on 2020-02-23 11:12
+
+from django.conf import settings
+import django.core.validators
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('users', '0009_auto_201... | |
b7bc68872a45396358ce20a215e3a3a2c3734b8a | py3status/modules/pretend_ram.py | py3status/modules/pretend_ram.py | # -*- coding: utf-8 -*-
from __future__ import division
import random
class Py3status:
"""
"""
format = "{bar}"
thresholds = [(0, "good"), (40, "degraded"), (75, "bad")]
cache_timeout = 1
middle_char = '|'
middle_color = None
left_char = '|'
left_color = None
right_char = '|'
... | Add pretend ram module to try out the progress bar | Add pretend ram module to try out the progress bar
| Python | bsd-3-clause | guiniol/py3status,guiniol/py3status | ---
+++
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import division
+import random
+
+
+class Py3status:
+ """
+ """
+ format = "{bar}"
+ thresholds = [(0, "good"), (40, "degraded"), (75, "bad")]
+ cache_timeout = 1
+ middle_char = '|'
+ middle_color = None
+ left_char = '|'
+... | |
abc155280052ab2f216342acd7933db3e090d94e | test/test_export_flow.py | test/test_export_flow.py | import netlib.tutils
from libmproxy import flow_export
from . import tutils
req_get = netlib.tutils.treq(
method='GET',
headers=None,
content=None,
)
req_post = netlib.tutils.treq(
method='POST',
headers=None,
)
def test_request_simple():
flow = tutils.tflow(req=req_get)
assert flow_expo... | Add some basic tests for flow_exports | Add some basic tests for flow_exports
| Python | mit | mitmproxy/mitmproxy,StevenVanAcker/mitmproxy,mitmproxy/mitmproxy,xaxa89/mitmproxy,zlorb/mitmproxy,dwfreed/mitmproxy,dwfreed/mitmproxy,ddworken/mitmproxy,jvillacorta/mitmproxy,ddworken/mitmproxy,mhils/mitmproxy,mhils/mitmproxy,mitmproxy/mitmproxy,gzzhanghao/mitmproxy,laurmurclar/mitmproxy,ddworken/mitmproxy,mosajjal/mit... | ---
+++
@@ -0,0 +1,22 @@
+import netlib.tutils
+from libmproxy import flow_export
+from . import tutils
+
+req_get = netlib.tutils.treq(
+ method='GET',
+ headers=None,
+ content=None,
+)
+
+req_post = netlib.tutils.treq(
+ method='POST',
+ headers=None,
+)
+
+
+def test_request_simple():
+ flow = t... | |
5c0ef34788202abefbc36f80899f9b9b54ba17be | fabfile.py | fabfile.py | # -*- coding: utf-8 -*
"""
Simple fabric file to test oinspect output
"""
from __future__ import print_function
import webbrowser
import oinspect.sphinxify as oi
def test_basic():
"""Test with an empty context"""
docstring = 'A test'
content = oi.sphinxify(docstring, oi.generate_context())
page_nam... | Add a fabric file to test the generated output | Add a fabric file to test the generated output
| Python | bsd-3-clause | spyder-ide/docrepr,spyder-ide/docrepr,techtonik/docrepr,spyder-ide/docrepr,techtonik/docrepr,techtonik/docrepr | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*
+
+"""
+Simple fabric file to test oinspect output
+"""
+
+from __future__ import print_function
+
+import webbrowser
+
+import oinspect.sphinxify as oi
+
+def test_basic():
+ """Test with an empty context"""
+ docstring = 'A test'
+ content = oi.sphinxify(doc... | |
c5da3ee962a05c05d55fd98149c1095a57f03e36 | test/shots/test_task_types_for_shot.py | test/shots/test_task_types_for_shot.py | from test.base import ApiDBTestCase
class ShotTaskTypesTestCase(ApiDBTestCase):
def setUp(self):
super(ShotTaskTypesTestCase, self).setUp()
self.generate_fixture_project_status()
self.generate_fixture_project()
self.generate_fixture_entity_type()
self.generate_fixture_sequ... | Add tests for task types for shot route | Add tests for task types for shot route
| Python | agpl-3.0 | cgwire/zou | ---
+++
@@ -0,0 +1,27 @@
+from test.base import ApiDBTestCase
+
+
+class ShotTaskTypesTestCase(ApiDBTestCase):
+
+ def setUp(self):
+ super(ShotTaskTypesTestCase, self).setUp()
+ self.generate_fixture_project_status()
+ self.generate_fixture_project()
+ self.generate_fixture_entity_type... | |
0942d2ccf68b88db2616f9839c1ca1ebfacb8ad9 | migration/versions/013_dataset_serp.py | migration/versions/013_dataset_serp.py | from sqlalchemy import *
from migrate import *
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
dataset = Table('dataset', meta, autoload=True)
serp_title = Column('serp_title', Unicode())
serp_title.create(dataset)
serp_teaser = Column('serp_teaser', Unicode())
serp... | Migrate in domain model changes | Migrate in domain model changes | Python | agpl-3.0 | johnjohndoe/spendb,CivicVision/datahub,USStateDept/FPA_Core,USStateDept/FPA_Core,spendb/spendb,openspending/spendb,pudo/spendb,johnjohndoe/spendb,nathanhilbert/FPA_Core,spendb/spendb,nathanhilbert/FPA_Core,CivicVision/datahub,spendb/spendb,nathanhilbert/FPA_Core,CivicVision/datahub,openspending/spendb,openspending/spen... | ---
+++
@@ -0,0 +1,15 @@
+from sqlalchemy import *
+from migrate import *
+
+meta = MetaData()
+
+def upgrade(migrate_engine):
+ meta.bind = migrate_engine
+ dataset = Table('dataset', meta, autoload=True)
+
+ serp_title = Column('serp_title', Unicode())
+ serp_title.create(dataset)
+
+ serp_teaser = C... | |
51faed84f4d56fe3455a6568bdadbc9b16196175 | day5-1.py | day5-1.py | """Module to find the passowrd on a bunny door."""
import hashlib
def main():
"""Run the main function."""
id = 'cxdnnyjw'
password = []
begin = '00000'
index = 0
while len(password) < 8:
test = id + str(index)
if begin == hashlib.md5(test).hexdigest()[0:5]:
pass... | Add day 5 part 1. | Add day 5 part 1.
| Python | mit | SayWhat1/adventofcode2016 | ---
+++
@@ -0,0 +1,23 @@
+"""Module to find the passowrd on a bunny door."""
+
+
+import hashlib
+
+
+def main():
+ """Run the main function."""
+ id = 'cxdnnyjw'
+ password = []
+ begin = '00000'
+ index = 0
+
+ while len(password) < 8:
+ test = id + str(index)
+ if begin == hashlib.m... | |
76ccb3e14da170000c8071203e931eeb8bc7c642 | tests/test_deepcopy.py | tests/test_deepcopy.py | from tests.models import (
Cat,
Location,
)
import copy
from rest_framework.test import APITestCase
class DeepcopyTestCase(APITestCase):
def test_cat(self):
home = Location(name='Home', blob='ILUVU')
papa = Cat(name='Papa')
kitkat = Cat(name='KitKat', home=home, parent=papa)
... | Add a test case for deepcopy | Add a test case for deepcopy
| Python | mit | AltSchool/dynamic-rest-client | ---
+++
@@ -0,0 +1,19 @@
+from tests.models import (
+ Cat,
+ Location,
+)
+import copy
+
+from rest_framework.test import APITestCase
+
+
+class DeepcopyTestCase(APITestCase):
+ def test_cat(self):
+ home = Location(name='Home', blob='ILUVU')
+ papa = Cat(name='Papa')
+ kitkat = Cat(nam... | |
47d770c6008116dd72c6c6b4572a0a92faa39e66 | test/test_update.py | test/test_update.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import logging
basedir = os.path.realpath('..')
if basedir not in sys.path:
sys.path.append(basedir)
import update as up
# logging
LOGFORMAT_STDOUT = {
logging.DEBUG: '%(module)s:%(funcName)s:%(lineno)s - '
'%(levelname)-... | Add test file for update.py | Add test file for update.py
| Python | mit | CristianCantoro/sbntoolkit,CristianCantoro/sbntoolkit | ---
+++
@@ -0,0 +1,42 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import logging
+
+basedir = os.path.realpath('..')
+if basedir not in sys.path:
+ sys.path.append(basedir)
+
+import update as up
+
+# logging
+LOGFORMAT_STDOUT = {
+ logging.DEBUG: '%(module)s:%(funcName)s:%(lin... | |
97b933815dcbc179e25bc9c1c16cfa1153036ae1 | performance_tests/epsilon_convolution.py | performance_tests/epsilon_convolution.py | #!/usr/bin/python3
'''
Convolution
'''
from __future__ import print_function
import numpy as np
import cProfile
import random
import matplotlib.pyplot as plt
def eps(s, t_membran):
return np.exp(-s / t_membran)
def small_spiketrain():
# 1000 timesteps
# With 10 random spikes
s = np.array([0]*1000)
... | Add performance test for epsilon convolution | Add performance test for epsilon convolution
| Python | bsd-2-clause | timqian/neurons,johannesmik/neurons | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/python3
+
+'''
+Convolution
+'''
+
+from __future__ import print_function
+
+import numpy as np
+import cProfile
+import random
+import matplotlib.pyplot as plt
+
+def eps(s, t_membran):
+ return np.exp(-s / t_membran)
+
+def small_spiketrain():
+ # 1000 timesteps
+ # Wit... | |
2e7252fab4667047c04b540040d5ad2287a73299 | parrainage/app/management/commands/import_geoloc.py | parrainage/app/management/commands/import_geoloc.py | # Copyright 2017 Raphaël Hertzog
#
# This file is subject to the license terms in the LICENSE file found in
# the top-level directory of this distribution.
import argparse
from datetime import datetime
import csv
import logging
import sys
from django.core.management.base import BaseCommand
from django.db import trans... | Add management command to import geolocation data | Add management command to import geolocation data
| Python | mit | rhertzog/parrainage,rhertzog/parrainage,rhertzog/parrainage | ---
+++
@@ -0,0 +1,40 @@
+# Copyright 2017 Raphaël Hertzog
+#
+# This file is subject to the license terms in the LICENSE file found in
+# the top-level directory of this distribution.
+
+import argparse
+from datetime import datetime
+import csv
+import logging
+import sys
+
+from django.core.management.base import ... | |
be4abd8d3b54ab66f89c88e56cb948d5bf5f5725 | stoneridge_info_gatherer.py | stoneridge_info_gatherer.py | #!/usr/bin/env python
try:
import configparser
except ImportError:
import ConfigParser as configparser
import json
import os
import platform
import stoneridge
class StoneRidgeInfoGatherer(object):
def run(self):
info_file = os.path.join(stoneridge.bindir, 'application.ini')
cp = configpa... | Add the static info gatherer | Add the static info gatherer
| Python | mpl-2.0 | mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+try:
+ import configparser
+except ImportError:
+ import ConfigParser as configparser
+
+import json
+import os
+import platform
+
+import stoneridge
+
+class StoneRidgeInfoGatherer(object):
+ def run(self):
+ info_file = os.path.join(stoneridge.bindi... | |
5a2394f8445350387adc30dd5bc818971aefc91d | lpthw/ex25.py | lpthw/ex25.py | def break_words(stuff):
"""This function will brea up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
"""Sorts the words."""
return sorted(words)
def print_first_word(words):
"""Prints the first word after popping it off."""
word = words.pop(0)
print word
... | Add work for Exercise 25. | Add work for Exercise 25.
| Python | mit | jaredmanning/learning,jaredmanning/learning | ---
+++
@@ -0,0 +1,35 @@
+def break_words(stuff):
+ """This function will brea up words for us."""
+ words = stuff.split(' ')
+ return words
+
+def sort_words(words):
+ """Sorts the words."""
+ return sorted(words)
+
+def print_first_word(words):
+ """Prints the first word after popping it off."""
+... | |
bdd532cccf504dc9fbf21a9e72b8185dc910ec94 | thezombies/management/commands/validate_all_data_catalogs.py | thezombies/management/commands/validate_all_data_catalogs.py | from django.core.management.base import NoArgsCommand
from thezombies.tasks.main import validate_data_catalogs
class Command(NoArgsCommand):
"""Validate all of the agency data catalogs"""
def handle_noargs(self):
validator_group = validate_data_catalogs.delay()
self.stdout.write(u"\nSpawned d... | Add management command for running the task for validating all data catalogs. | Add management command for running the task for validating all data catalogs.
| Python | bsd-3-clause | sunlightlabs/thezombies,sunlightlabs/thezombies,sunlightlabs/thezombies,sunlightlabs/thezombies | ---
+++
@@ -0,0 +1,10 @@
+from django.core.management.base import NoArgsCommand
+from thezombies.tasks.main import validate_data_catalogs
+
+
+class Command(NoArgsCommand):
+ """Validate all of the agency data catalogs"""
+
+ def handle_noargs(self):
+ validator_group = validate_data_catalogs.delay()
+ ... | |
24e14b7d53e43f1574971ff5b6eee6d0185df23a | rest_framework/tests/nested_relations.py | rest_framework/tests/nested_relations.py | from copy import deepcopy
from django.db import models
from django.test import TestCase
from rest_framework import serializers
# ForeignKey
class ForeignKeyTarget(models.Model):
name = models.CharField(max_length=100)
class ForeignKeySource(models.Model):
name = models.CharField(max_length=100)
target ... | Add tests for retrieving/updating reverse fks | Add tests for retrieving/updating reverse fks
| Python | bsd-2-clause | sehmaschine/django-rest-framework,qsorix/django-rest-framework,lubomir/django-rest-framework,nhorelik/django-rest-framework,James1345/django-rest-framework,canassa/django-rest-framework,yiyocx/django-rest-framework,thedrow/django-rest-framework-1,vstoykov/django-rest-framework,qsorix/django-rest-framework,jpulec/django... | ---
+++
@@ -0,0 +1,68 @@
+from copy import deepcopy
+from django.db import models
+from django.test import TestCase
+from rest_framework import serializers
+
+
+# ForeignKey
+
+class ForeignKeyTarget(models.Model):
+ name = models.CharField(max_length=100)
+
+
+class ForeignKeySource(models.Model):
+ name = mod... | |
13fd2335eb8b8b93e5330fe9bcc125557bffb198 | ecommerce/extensions/payment/migrations/0012_auto_20161109_1456.py | ecommerce/extensions/payment/migrations/0012_auto_20161109_1456.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payment', '0011_paypalprocessorconfiguration'),
]
operations = [
migrations.AlterField(
model_name='paypalproces... | Add missing migration for verbose_name alter | Add missing migration for verbose_name alter
| Python | agpl-3.0 | edx/ecommerce,edx/ecommerce,eduNEXT/edunext-ecommerce,eduNEXT/edunext-ecommerce,eduNEXT/edunext-ecommerce,edx/ecommerce,edx/ecommerce,eduNEXT/edunext-ecommerce | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('payment', '0011_paypalprocessorconfiguration'),
+ ]
+
+ operations = [
+ migrations.AlterFi... | |
0d7706db887bb5d1522f3de39b9fe1533f80fd8d | dota2parser.py | dota2parser.py | from bs4 import BeautifulSoup
import urllib.request
import MySQLdb
db = MySQLdb.connect(user="", passwd="", db="")
c = db.cursor()
c.execute("SELECT id, name FROM heroes WHERE active=1")
heroes = c.fetchall()
for hero_id, hero_name in heroes:
hero_url = 'https://www.dota2.com/hero/'+str(hero_name).replace(' ', '_').... | Add original script version, still not fit for general use | Add original script version, still not fit for general use
| Python | mit | Vilkku/Dota-2-Hero-Parser | ---
+++
@@ -0,0 +1,24 @@
+from bs4 import BeautifulSoup
+import urllib.request
+import MySQLdb
+
+db = MySQLdb.connect(user="", passwd="", db="")
+c = db.cursor()
+c.execute("SELECT id, name FROM heroes WHERE active=1")
+heroes = c.fetchall()
+
+for hero_id, hero_name in heroes:
+ hero_url = 'https://www.dota2.com/he... | |
0f84eb57024bb856c10a6326a3827cb91e4d20c2 | pyui_to_clipboard.py | pyui_to_clipboard.py | import clipboard
filename = 'put_your_filename_here.pyui' # edit this line before running
with open(filename) as in_file:
clipboard.set(in_file.read())
print('The contents of {} are now on the clipboard.'.format(filename))
| Put the contents of a pyui file onto the clipboard | Put the contents of a pyui file onto the clipboard
For pasting up to GitHub, etc. | Python | apache-2.0 | cclauss/Ten-lines-or-less | ---
+++
@@ -0,0 +1,5 @@
+import clipboard
+filename = 'put_your_filename_here.pyui' # edit this line before running
+with open(filename) as in_file:
+ clipboard.set(in_file.read())
+print('The contents of {} are now on the clipboard.'.format(filename)) | |
a3706e1c743ef7ec7f38375b116538a71ccb8455 | rasterfairy/utils.py | rasterfairy/utils.py | def cmp_to_key(mycmp):
"""
Convert `sorted` function from python2 to python3.
This function is used to convert `cmp` parameter of python2 sorted
function into `key` parameter of python3 sorted function.
This code is taken from here:
https://docs.python.org/2/howto/sorting.html#the-old-way-usin... | Add utilities to convert from python2 to python3. | Add utilities to convert from python2 to python3.
This commit only has one utility that allows to convert sorted()
function with custom elements comparison from parameter cmp (python2)
to parameter key (python3).
| Python | bsd-3-clause | Quasimondo/RasterFairy | ---
+++
@@ -0,0 +1,37 @@
+def cmp_to_key(mycmp):
+ """
+ Convert `sorted` function from python2 to python3.
+
+ This function is used to convert `cmp` parameter of python2 sorted
+ function into `key` parameter of python3 sorted function.
+
+ This code is taken from here:
+ https://docs.python.org/2... | |
d26034963c0332346ea1b6b50b9ad3d637da7e36 | spiff/payment/management/commands/attempt_payment.py | spiff/payment/management/commands/attempt_payment.py | from django.core.management import BaseCommand
from spiff.payment.models import Invoice
import stripe
class Command(BaseCommand):
help = 'Attempts to process an invoice via stripe'
def handle(self, *args, **options):
for invoice in Invoice.objects.unpaid().all():
print invoice
try:
unpaid ... | Add script to try and push stripe payment of unpaid invoices | Add script to try and push stripe payment of unpaid invoices
| Python | agpl-3.0 | SYNHAK/spiff,SYNHAK/spiff,SYNHAK/spiff | ---
+++
@@ -0,0 +1,16 @@
+from django.core.management import BaseCommand
+from spiff.payment.models import Invoice
+import stripe
+
+class Command(BaseCommand):
+ help = 'Attempts to process an invoice via stripe'
+
+ def handle(self, *args, **options):
+ for invoice in Invoice.objects.unpaid().all():
+ pri... | |
c5ed01ce81b1c0e459d93bf26bf96cdeb80a0344 | Lib/defconAppKit/representationFactories/__init__.py | Lib/defconAppKit/representationFactories/__init__.py | from defcon import Glyph, Image, registerRepresentationFactory
from defconAppKit.representationFactories.nsBezierPathFactory import NSBezierPathFactory
from defconAppKit.representationFactories.glyphCellFactory import GlyphCellFactory
from defconAppKit.representationFactories.glyphCellDetailFactory import GlyphCellDeta... | from defcon import Glyph, Image, registerRepresentationFactory
from defconAppKit.representationFactories.nsBezierPathFactory import NSBezierPathFactory
from defconAppKit.representationFactories.glyphCellFactory import GlyphCellFactory
from defconAppKit.representationFactories.glyphCellDetailFactory import GlyphCellDeta... | Use specific notifications when possible. | Use specific notifications when possible.
| Python | mit | typesupply/defconAppKit,typemytype/defconAppKit | ---
+++
@@ -7,21 +7,21 @@
from defconAppKit.representationFactories.menuImageFactory import MenuImageRepresentationFactory
_glyphFactories = {
- "defconAppKit.NSBezierPath" : NSBezierPathFactory,
- "defconAppKit.NoComponentsNSBezierPath" : NoComponentsNSBezierPathFactory,
- "defconAppKit.OnlyComponentsNS... |
b68244965b4f69711f0c4d9d42f24e6b3f5742f4 | update-images.py | update-images.py | #!/usr/bin/env python
import urllib
def img2base64(img):
return open(img, "rb").read().encode("base64").replace('\n', '')
disabled_base64 = img2base64("assets/no-js.png")
enabled_base64 = img2base64("assets/jsenabled.png")
data = open('bootstrap.js')
output = []
for line in data.readlines():
if line.starts... | Add script to update images in the js code | Add script to update images in the js code
| Python | bsd-2-clause | richq/toggle-js-addon | ---
+++
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+import urllib
+
+def img2base64(img):
+ return open(img, "rb").read().encode("base64").replace('\n', '')
+
+disabled_base64 = img2base64("assets/no-js.png")
+enabled_base64 = img2base64("assets/jsenabled.png")
+
+
+data = open('bootstrap.js')
+output = []
+for lin... | |
c168efd883bcc1fc5ed8fe3c80de95db905bb468 | tests/grammar_creation_test/NonterminalAddingTest.py | tests/grammar_creation_test/NonterminalAddingTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import *
class NonterminalAddingTest(TestCase):
pass
if __name__ == '__main__':
main()
| Add file for nontermianl adding when grammar is create | Add file for nontermianl adding when grammar is create
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 23.06.2017 16:39
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from unittest import TestCase, main
+from grammpy import *
+
+
+class NonterminalAddingTest(TestCase):
+ pass
+
+
+if __name__ == '__main__':
+ main() | |
307e4fda61f92e344bfd90c1a43f5a9076e7b832 | tests/rules_tests/isValid_tests/InvalidSyntaxTest.py | tests/rules_tests/isValid_tests/InvalidSyntaxTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import Rule
class InvalidSyntaxTest(TestCase):
pass
if __name__ == '__main__':
main() | Add files for rule's invalid syntax validation | Add files for rule's invalid syntax validation
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 23.06.2017 16:39
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from unittest import main, TestCase
+from grammpy import Rule
+
+
+class InvalidSyntaxTest(TestCase):
+ pass
+
+
+if __name__ == '__main__':
+ main() | |
01710f18efbe29dc5cf187726d5c686beec7e6e7 | utils/add_plaso_timeline.py | utils/add_plaso_timeline.py | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Add helper script for getting plaso timeline in to timesketch | Add helper script for getting plaso timeline in to timesketch
| Python | apache-2.0 | armuk/timesketch,armuk/timesketch,google/timesketch,armuk/timesketch,google/timesketch,armuk/timesketch,google/timesketch,lockhy/timesketch,google/timesketch,lockhy/timesketch,lockhy/timesketch,lockhy/timesketch | ---
+++
@@ -0,0 +1,47 @@
+# Copyright 2014 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Un... | |
2c0fc3387a6dbd54bbcd4c47952ce8739d0b2152 | dedup_worker.py | dedup_worker.py | # Pull URL
# Strip query string
# Query exists
# IFN save to sqlite
# IFN push to queue
# IFY do nothing
seen = {}
if __name__ == '__main__':
from helpers import client
ingest = client.queue('ingest')
scrape = client.queue('scrape')
while True:
claimed = ingest.claim(ttl=180, grace=60)
... | Add super-simple deduplication filter that uses a dictionary | Add super-simple deduplication filter that uses a dictionary
| Python | mit | ryansb/zaqar-webscraper-demo | ---
+++
@@ -0,0 +1,27 @@
+# Pull URL
+# Strip query string
+# Query exists
+# IFN save to sqlite
+# IFN push to queue
+# IFY do nothing
+
+seen = {}
+
+if __name__ == '__main__':
+ from helpers import client
+ ingest = client.queue('ingest')
+ scrape = client.queue('scrape')
+
+ while True:
+ claim... | |
9d30c51aac7ca00b4f191270a82f24372687163c | svg2pdf.py | svg2pdf.py | #!/usr/bin/env python
"""
Pandoc filter to convert svg files to pdf as suggested at:
https://github.com/jgm/pandoc/issues/265#issuecomment-27317316
"""
__author__ = "Jerome Robert"
import mimetypes
import subprocess
import os
import sys
from pandocfilters import toJSONFilter, Image
fmt_to_option = {
"sile": ("--... | Add Pandoc filter to convert SVG illustrations to PDF | Add Pandoc filter to convert SVG illustrations to PDF
| Python | agpl-3.0 | alerque/casile,alerque/casile,alerque/casile,alerque/casile,alerque/casile | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+"""
+Pandoc filter to convert svg files to pdf as suggested at:
+https://github.com/jgm/pandoc/issues/265#issuecomment-27317316
+"""
+
+__author__ = "Jerome Robert"
+
+import mimetypes
+import subprocess
+import os
+import sys
+from pandocfilters import toJSONFilter, I... | |
b7c6b5115ce5aec129af64d6b85c672901a435d3 | gpmcc/experiments/particle_engine.py | gpmcc/experiments/particle_engine.py | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | Add a multiprocessor for particle learning. | Add a multiprocessor for particle learning.
| Python | apache-2.0 | probcomp/cgpm,probcomp/cgpm | ---
+++
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by ... | |
3a9807fd14257c49490ec429d7365c902209508c | gumbo_stats.py | gumbo_stats.py | import ctypes
import sys
def parse_warc(filename):
pass
def parse_file(filename):
with open(filename) as infile:
text = infile.read()
print(text)
if __name__ == '__main__':
filename = sys.argv[1]
if filename.endswith('.warc.gz'):
parse_warc(filename)
else:
parse_file(filename)
| Add beginnings of a Python driver. Currently just prints out input file. | Add beginnings of a Python driver. Currently just prints out input file.
| Python | apache-2.0 | nostrademons/GumboStats,nostrademons/GumboStats | ---
+++
@@ -0,0 +1,17 @@
+import ctypes
+import sys
+
+def parse_warc(filename):
+ pass
+
+def parse_file(filename):
+ with open(filename) as infile:
+ text = infile.read()
+ print(text)
+
+if __name__ == '__main__':
+ filename = sys.argv[1]
+ if filename.endswith('.warc.gz'):
+ parse_warc(filename)
+ e... | |
36d7bc4719490b046d8782465ddeba6e8240233e | tools/xml_split_images_locale.py | tools/xml_split_images_locale.py | #! /usr/bin/python3
import sys
import argparse
import xml_utils as u
import datetime
from argparse import RawTextHelpFormatter
from collections import defaultdict
##------------------------------------------------------------
## can be called with:
##
## write bc and bf face images to separate files
##--------... | Split images into bf and bc bears. Defaults to images. | Split images into bf and bc bears. Defaults to images.
| Python | mit | hypraptive/bearid,hypraptive/bearid,hypraptive/bearid | ---
+++
@@ -0,0 +1,35 @@
+#! /usr/bin/python3
+
+import sys
+import argparse
+import xml_utils as u
+import datetime
+from argparse import RawTextHelpFormatter
+from collections import defaultdict
+
+##------------------------------------------------------------
+## can be called with:
+##
+## write bc and bf ... | |
1dbfcfd6558a3148ea2726898d65e1e8ef9115fc | mysite/customs/management/commands/import_bugimporter_data.py | mysite/customs/management/commands/import_bugimporter_data.py | # This file is part of OpenHatch.
# Copyright (C) 2012 OpenHatch, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... | Add a management command that imports bug data from YAML files | Add a management command that imports bug data from YAML files
| Python | agpl-3.0 | vipul-sharma20/oh-mainline,Changaco/oh-mainline,openhatch/oh-mainline,SnappleCap/oh-mainline,nirmeshk/oh-mainline,heeraj123/oh-mainline,SnappleCap/oh-mainline,campbe13/openhatch,heeraj123/oh-mainline,eeshangarg/oh-mainline,ehashman/oh-mainline,Changaco/oh-mainline,SnappleCap/oh-mainline,willingc/oh-mainline,sudheesh001... | ---
+++
@@ -0,0 +1,31 @@
+# This file is part of OpenHatch.
+# Copyright (C) 2012 OpenHatch, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, ... | |
1314da3ffbaa42aca4a917aef8a230478a22be68 | scripts/order-symlinks.py | scripts/order-symlinks.py | #!/usr/bin/env python
# Copyright (C) 2013 Tobias Gruetzmacher
"""
This script takes the JSON file created by 'dosage -o json' and uses the
metadata to build a symlink farm in the deduced order of the comic. It created
those in a subdirectory called 'inorder'.
"""
from __future__ import print_function
import sys
import... | Add a script that uses the JSON metadata to create ordered symlinks. | Add a script that uses the JSON metadata to create ordered symlinks.
| Python | mit | webcomics/dosage,mbrandis/dosage,peterjanes/dosage,Freestila/dosage,wummel/dosage,wummel/dosage,blade2005/dosage,Freestila/dosage,mbrandis/dosage,peterjanes/dosage,webcomics/dosage,blade2005/dosage | ---
+++
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+# Copyright (C) 2013 Tobias Gruetzmacher
+"""
+This script takes the JSON file created by 'dosage -o json' and uses the
+metadata to build a symlink farm in the deduced order of the comic. It created
+those in a subdirectory called 'inorder'.
+"""
+from __future__ impo... | |
8180c84a98bec11308afca884a4d7fed4738403b | spacy/tests/test_align.py | spacy/tests/test_align.py | import pytest
from .._align import align
@pytest.mark.parametrize('string1,string2,cost', [
(b'hello', b'hell', 1),
(b'rat', b'cat', 1),
(b'rat', b'rat', 0),
(b'rat', b'catsie', 4),
(b't', b'catsie', 5),
])
def test_align_costs(string1, string2, cost):
output_cost, i2j, j2i, matrix = align(str... | Add tests for new Levenshtein alignment | Add tests for new Levenshtein alignment
| Python | mit | explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,recognai/spaCy,recognai/spaCy,honnibal/spaCy,recognai/spaCy,spacy-io/spaCy,recognai/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,recognai/spaCy,honnibal/spaCy,aikramer2/spaCy,spacy-io/spaCy,spacy-io/spaC... | ---
+++
@@ -0,0 +1,38 @@
+import pytest
+from .._align import align
+
+
+@pytest.mark.parametrize('string1,string2,cost', [
+ (b'hello', b'hell', 1),
+ (b'rat', b'cat', 1),
+ (b'rat', b'rat', 0),
+ (b'rat', b'catsie', 4),
+ (b't', b'catsie', 5),
+])
+def test_align_costs(string1, string2, cost):
+ o... | |
1a6818d4829c3da42750f6d0f042df203434595c | Carkinos/probes/migrations/0002_auto_20160106_2307.py | Carkinos/probes/migrations/0002_auto_20160106_2307.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-06 15:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('probes', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Add a little to models | Add a little to models
Add a little to models
(Should I upload migrations?)
| Python | mit | LeeYiFang/Carkinos,LeeYiFang/Carkinos,LeeYiFang/Carkinos,LeeYiFang/Carkinos | ---
+++
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2016-01-06 15:07
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('probes', '0001_initial'),
+ ]
+
+ operations = [
+ ... | |
4fe62ac1211e68f1d9c656453bdf71d6849c3daf | migrations/versions/0101_een_logo.py | migrations/versions/0101_een_logo.py | """empty message
Revision ID: 0101_een_logo
Revises: 0100_notification_created_by
Create Date: 2017-06-26 11:43:30.374723
"""
from alembic import op
revision = '0101_een_logo'
down_revision = '0100_notification_created_by'
ENTERPRISE_EUROPE_NETWORK_ID = '89ce468b-fb29-4d5d-bd3f-d468fb6f7c36'
def upgrade():
... | Add organisation values for the Enterprise Europe Network. | Add organisation values for the Enterprise Europe Network.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,30 @@
+"""empty message
+
+Revision ID: 0101_een_logo
+Revises: 0100_notification_created_by
+Create Date: 2017-06-26 11:43:30.374723
+
+"""
+
+from alembic import op
+
+revision = '0101_een_logo'
+down_revision = '0100_notification_created_by'
+
+
+ENTERPRISE_EUROPE_NETWORK_ID = '89ce468b-fb29-4d5... | |
845615f2a34c5680ed22a2f4eafa5febe7cd7246 | alembic/versions/20087beff9ea_added_date_updated_t.py | alembic/versions/20087beff9ea_added_date_updated_t.py | """Added date updated to Owner
Revision ID: 20087beff9ea
Revises: 2dc72d16c188
Create Date: 2014-03-09 01:43:00.648013
"""
# revision identifiers, used by Alembic.
revision = '20087beff9ea'
down_revision = '2dc72d16c188'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated ... | Add date updated to Owner | Add date updated to Owner
| Python | apache-2.0 | CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords | ---
+++
@@ -0,0 +1,25 @@
+"""Added date updated to Owner
+
+Revision ID: 20087beff9ea
+Revises: 2dc72d16c188
+Create Date: 2014-03-09 01:43:00.648013
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '20087beff9ea'
+down_revision = '2dc72d16c188'
+
+from alembic import op
+import sqlalchemy as sa
+
+def ... | |
0781d105e4182bdd8abf1a8c7185311a48273c28 | salt/beacons/smartos_imgadm.py | salt/beacons/smartos_imgadm.py | # -*- coding: utf-8 -*-
'''
Beacon that fires events on image import/delete.
.. code-block:: yaml
## minimal
# - check for new images every 1 second (salt default)
# - does not send events at startup
beacons:
imgadm: []
## standard
# - check for new images every 60 seconds
# - send ... | Add imgadm beacons for SmartOS | Add imgadm beacons for SmartOS
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+'''
+Beacon that fires events on image import/delete.
+
+.. code-block:: yaml
+
+ ## minimal
+ # - check for new images every 1 second (salt default)
+ # - does not send events at startup
+ beacons:
+ imgadm: []
+
+ ## standard
+ # - check for... | |
8b63dc73b4e3303d1b86faf42f635f3ce01e9da4 | run.py | run.py | #!/usr/bin/env python
# encoding: utf-8
import argparse
import subprocess as sub
### Parse command line arguments
parser = argparse.ArgumentParser(description="M/M/1 queue simulation -- Helper script")
parser.add_argument('reps', metavar='repetitions',
type=int, help='number of repetitions')
pars... | Create helper script providing multiprocessing support. | Create helper script providing multiprocessing support.
| Python | mit | kubkon/des-in-python | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+import argparse
+import subprocess as sub
+
+
+### Parse command line arguments
+parser = argparse.ArgumentParser(description="M/M/1 queue simulation -- Helper script")
+parser.add_argument('reps', metavar='repetitions',
+ type=i... | |
e0c82bec30568eb845c71fb0335d6ac5edef18e9 | corehq/apps/translations/migrations/0002_transifexblacklist.py | corehq/apps/translations/migrations/0002_transifexblacklist.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-09 19:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('translations', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Add migration that had conflict from merge with master | Add migration that had conflict from merge with master
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.18 on 2019-01-09 19:35
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('translations', '0001_initial'),
+ ]
+
+ operati... | |
5be91f4e7b3607090e94fbf221628a359063823d | data/bag-brk/create_db.py | data/bag-brk/create_db.py | import csv
import sqlite3
conn = sqlite3.connect('processed-lines.db')
c = conn.cursor()
# c.execute('CREATE TABLE processed (cadastral_designation text, bag_pand_id text, match_type text, parcel_uri text, '
# 'dummy text, mother_parcel_match text, parcel_error text, timestamp timestamp default CURRENT_TIMES... | Use indexed text with sqlite | Use indexed text with sqlite
| Python | mit | PDOK/data.labs.pdok.nl,PDOK/data.labs.pdok.nl,PDOK/data.labs.pdok.nl,PDOK/data.labs.pdok.nl,PDOK/data.labs.pdok.nl | ---
+++
@@ -0,0 +1,26 @@
+import csv
+import sqlite3
+
+conn = sqlite3.connect('processed-lines.db')
+c = conn.cursor()
+# c.execute('CREATE TABLE processed (cadastral_designation text, bag_pand_id text, match_type text, parcel_uri text, '
+# 'dummy text, mother_parcel_match text, parcel_error text, timesta... | |
134dbd68cc4630442f1dddb9426207de93c1498b | web/courses/migrations/0005_update_solution_visibility_text.py | web/courses/migrations/0005_update_solution_visibility_text.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0004_course_institution'),
]
operations = [
migrations.AlterField(
model_name='problemset',
... | Add a missing migration for Course.solution_visibility description | Add a missing migration for Course.solution_visibility description
| Python | agpl-3.0 | matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('courses', '0004_course_institution'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
64fce7c67849f44492d55ccf8a745b252bf1368b | numpy/polynomial/tests/test_printing.py | numpy/polynomial/tests/test_printing.py | import numpy.polynomial as poly
from numpy.testing import TestCase, run_module_suite, assert_
class test_str(TestCase):
def test_polynomial_str(self):
res = str(poly.Polynomial([0,1]))
tgt = 'poly([0., 1.])'
assert_(res, tgt)
def test_chebyshev_str(self):
res = str(poly.Chebys... | Add some tests for polynomial printing. | ENH: Add some tests for polynomial printing.
| Python | bsd-3-clause | jakirkham/numpy,bertrand-l/numpy,githubmlai/numpy,SiccarPoint/numpy,jorisvandenbossche/numpy,ChristopherHogan/numpy,GrimDerp/numpy,simongibbons/numpy,pizzathief/numpy,ahaldane/numpy,argriffing/numpy,sigma-random/numpy,kirillzhuravlev/numpy,MSeifert04/numpy,NextThought/pypy-numpy,matthew-brett/numpy,astrofrog/numpy,ogri... | ---
+++
@@ -0,0 +1,81 @@
+import numpy.polynomial as poly
+from numpy.testing import TestCase, run_module_suite, assert_
+
+class test_str(TestCase):
+ def test_polynomial_str(self):
+ res = str(poly.Polynomial([0,1]))
+ tgt = 'poly([0., 1.])'
+ assert_(res, tgt)
+
+
+ def test_chebyshev_st... | |
d251a2b2cd449ed5078b41b09f50003786f3bbde | seq_pad.py | seq_pad.py | #!/usr/bin/python
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__author__= 'Allison MacLeay'
import sys
import os
import argparse
import glob
import gzip
#-----------------------------------------
# MAIN
# run umitag.py for all files in a directo... | Create script to pad and trim fastq reads to one length | Create script to pad and trim fastq reads to one length
| Python | mit | alliemacleay/misc | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+__author__= 'Allison MacLeay'
+
+import sys
+import os
+import argparse
+import glob
+import gzip
+
+#-----------------------------------------
+# MAIN
+... | |
d25af87006ac21f55706c3a5579aec3c961b88e8 | download_mdcs_data.py | download_mdcs_data.py | """Fetch images from MDCS.
"""
import json
import requests
import xmltodict
def download_mdcs_data():
user = "dwheeler"
password = "12345"
mdcs_url = "http://129.6.153.123:8000"
schema_title = 'SemImage'
url = mdcs_url + "/rest/templates/select/all"
allSchemas = json.loads(requests.get(url, ... | Add script to download data from MDCS | Add script to download data from MDCS
| Python | mit | wd15/sem-image-stats | ---
+++
@@ -0,0 +1,43 @@
+"""Fetch images from MDCS.
+"""
+
+import json
+import requests
+import xmltodict
+
+
+def download_mdcs_data():
+ user = "dwheeler"
+ password = "12345"
+ mdcs_url = "http://129.6.153.123:8000"
+ schema_title = 'SemImage'
+ url = mdcs_url + "/rest/templates/select/all"
+
+ ... | |
b35e780364ca2d06902302b165ce2261ec6795a1 | ona_migration_script/test_migrate_toilet_codes.py | ona_migration_script/test_migrate_toilet_codes.py | import json
import requests
from requests_testadapter import TestAdapter
import unittest
import migrate_toilet_codes
class TestCreateSession(unittest.TestCase):
def test_create_session(self):
username = 'testuser'
password = 'testpass'
s = migrate_toilet_codes.create_session(username, pas... | Add tests for getting all toilets | Add tests for getting all toilets
| Python | bsd-3-clause | praekelt/go-imali-yethu-js,praekelt/go-imali-yethu-js,praekelt/go-imali-yethu-js | ---
+++
@@ -0,0 +1,56 @@
+import json
+import requests
+from requests_testadapter import TestAdapter
+import unittest
+
+import migrate_toilet_codes
+
+
+class TestCreateSession(unittest.TestCase):
+ def test_create_session(self):
+ username = 'testuser'
+ password = 'testpass'
+ s = migrate_t... | |
d782809746cfb403358bdfb10215b70c96498264 | QtViewer.py | QtViewer.py | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# Qt interface to display AVT cameras
#
#
# External dependencies
#
from PyQt4 import QtGui, QtCore
#
# Window to display a camera
#
class QtViewer( QtGui.QWidget ) :
#
# Initialisation
#
def __init__( self, camera ) :
# Initialize parent class
QtGui.QWid... | Introduce a live camera viewer with Qt. | Introduce a live camera viewer with Qt.
| Python | mit | microy/PyStereoVisionToolkit,microy/VisionToolkit,microy/VisionToolkit,microy/StereoVision,microy/StereoVision,microy/PyStereoVisionToolkit | ---
+++
@@ -0,0 +1,49 @@
+#! /usr/bin/env python
+# -*- coding:utf-8 -*-
+
+
+#
+# Qt interface to display AVT cameras
+#
+
+
+#
+# External dependencies
+#
+from PyQt4 import QtGui, QtCore
+
+
+#
+# Window to display a camera
+#
+class QtViewer( QtGui.QWidget ) :
+
+ #
+ # Initialisation
+ #
+ def __init__( self, c... | |
02d7e423416ab90bdc4db6428c51efaf6f33a4c6 | dbaas/dbaas/templatetags/settings_tags.py | dbaas/dbaas/templatetags/settings_tags.py | from django import template
from django.conf import settings
register = template.Library()
@register.assignment_tag()
def setting(var_name):
"""
Get a var from settings
"""
return getattr(settings, var_name)
| Create templatetag for put a settings var into context | Create templatetag for put a settings var into context
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | ---
+++
@@ -0,0 +1,12 @@
+from django import template
+from django.conf import settings
+
+register = template.Library()
+
+
+@register.assignment_tag()
+def setting(var_name):
+ """
+ Get a var from settings
+ """
+ return getattr(settings, var_name) | |
2c651b7083ec368ebf226364a1a1aba5f5ec147e | fjord/feedback/migrations/0003_auto__chg_field_simple_created.py | fjord/feedback/migrations/0003_auto__chg_field_simple_created.py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Simple.created'
db.alter_column('feedback_simple', 'created', self.gf('django.db.models.f... | Add migration for datetime change. | Add migration for datetime change.
This should have been done when we changed this in the model, but it
wasn't.
| Python | bsd-3-clause | hoosteeno/fjord,DESHRAJ/fjord,staranjeet/fjord,hoosteeno/fjord,lgp171188/fjord,DESHRAJ/fjord,hoosteeno/fjord,Ritsyy/fjord,staranjeet/fjord,lgp171188/fjord,rlr/fjord,rlr/fjord,staranjeet/fjord,hoosteeno/fjord,lgp171188/fjord,staranjeet/fjord,rlr/fjord,mozilla/fjord,mozilla/fjord,lgp171188/fjord,Ritsyy/fjord,Ritsyy/fjord... | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Changing field 'Simple.created'
+ db.alter_column('feedback_simple'... | |
635ed78543b3e3e8fe7c52fa91ee8516d617249d | data-travel/test_client.py | data-travel/test_client.py | from socket import *
host = '127.0.0.1'
port = 1234
bufsize = 1024
addr = (host, port)
client = socket(AF_INET, SOCK_STREAM)
client.connect(addr)
while True:
data = client.recv(bufsize)
if not data:
break
print data.strip()
client.close() | Add client sample for test - Connect to server - Receive data from server - Strip the data and print | Add client sample for test
- Connect to server
- Receive data from server
- Strip the data and print
| Python | apache-2.0 | peitaosu/motion-tools | ---
+++
@@ -0,0 +1,16 @@
+from socket import *
+
+host = '127.0.0.1'
+port = 1234
+bufsize = 1024
+addr = (host, port)
+
+client = socket(AF_INET, SOCK_STREAM)
+client.connect(addr)
+
+while True:
+ data = client.recv(bufsize)
+ if not data:
+ break
+ print data.strip()
+client.close() | |
313e9cae068192fe11ad10ea0b5c05061b0e5c60 | tests/unit/cloud/clouds/ec2_test.py | tests/unit/cloud/clouds/ec2_test.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
import os
import tempfile
# Import Salt Libs
from salt.cloud.clouds import ec2
from salt.exceptions import SaltCloudSystemExit
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import MagicMock... | Add unit test for _validate_key_file_permissions in ec2 module | Add unit test for _validate_key_file_permissions in ec2 module
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+
+# Import Python libs
+from __future__ import absolute_import
+import os
+import tempfile
+
+# Import Salt Libs
+from salt.cloud.clouds import ec2
+from salt.exceptions import SaltCloudSystemExit
+
+# Import Salt Testing Libs
+from salttesting import TestCase, skipI... | |
0202f0bd4358d68917af19910bb4e1f0a3dda602 | scripts/avalon-usb2iic-test.py | scripts/avalon-usb2iic-test.py | #!/usr/bin/env python2.7
# This script aim to make a loopback test on cdc or hid.
# The statics is used for comparison, it is not accurate.
from serial import Serial
from optparse import OptionParser
import time
import binascii
import usb.core
import usb.util
import sys
parser = OptionParser()
parser.add_option("-M"... | Add usb bridge test(CDC & HID) | Add usb bridge test(CDC & HID)
| Python | unlicense | archangdcc/avalon-extras,archangdcc/avalon-extras,Canaan-Creative/Avalon-extras,archangdcc/avalon-extras,Canaan-Creative/Avalon-extras,qinfengling/Avalon-extras,qinfengling/Avalon-extras,qinfengling/Avalon-extras,Canaan-Creative/Avalon-extras,archangdcc/avalon-extras,Canaan-Creative/Avalon-extras,qinfengling/Avalon-ext... | ---
+++
@@ -0,0 +1,82 @@
+#!/usr/bin/env python2.7
+
+# This script aim to make a loopback test on cdc or hid.
+# The statics is used for comparison, it is not accurate.
+
+from serial import Serial
+from optparse import OptionParser
+import time
+import binascii
+import usb.core
+import usb.util
+import sys
+
+parse... | |
162e7dd6595b0d9303ecb1da66893ee353ba413b | tracker.py | tracker.py | import os
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from watchdog.events import FileModifiedEvent
class GamificationHandler(FileSystemEventHandler):
def __init__(self, filename):
FileSystemEventHandler.__init__(self)
self.fi... | Add a first small file watcher that counts words | Add a first small file watcher that counts words
- Requires installing python watchdog framework
| Python | mit | Kadrian/paper-gamification | ---
+++
@@ -0,0 +1,58 @@
+import os
+import sys
+import time
+import logging
+from watchdog.observers import Observer
+from watchdog.events import FileSystemEventHandler
+from watchdog.events import FileModifiedEvent
+
+class GamificationHandler(FileSystemEventHandler):
+
+ def __init__(self, filename):
+ FileSyste... | |
c4c52c98f4c8596b4f19c88fb64e1b0af4f9c4cd | tests/test_monitor_progress.py | tests/test_monitor_progress.py | pytest_plugins = "pytester"
def test_simple_example(testdir):
""" Run the simple example code in a python subprocess and then compare its
stderr to what we expect to see from it. We run it in a subprocess to
best capture its stderr. We expect to see match_lines in order in the
output. Th... | Add New Test Which Monitors Output | Add New Test Which Monitors Output
This test monitors STDERR to detect progress of the progressbar
| Python | bsd-3-clause | WoLpH/python-progressbar | ---
+++
@@ -0,0 +1,61 @@
+pytest_plugins = "pytester"
+
+
+def test_simple_example(testdir):
+ """ Run the simple example code in a python subprocess and then compare its
+ stderr to what we expect to see from it. We run it in a subprocess to
+ best capture its stderr. We expect to see match_lines i... | |
d680d6a20890d3bbce96792fa1e86df28956a859 | helpers/threading.py | helpers/threading.py | from threading import Thread, Lock
list_lock = Lock()
def run_in_thread(app):
def wrapper(fn):
def run(*args, **kwargs):
app.logger.info('Starting thread: {}'.format(fn.__name__))
t = Thread(target=fn,
args=args,
kwargs=kwargs)
t.start()
return t
r... | Add a thread helper module | Add a thread helper module
| Python | mit | finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is | ---
+++
@@ -0,0 +1,18 @@
+from threading import Thread, Lock
+
+list_lock = Lock()
+
+def run_in_thread(app):
+ def wrapper(fn):
+ def run(*args, **kwargs):
+ app.logger.info('Starting thread: {}'.format(fn.__name__))
+ t = Thread(target=fn,
+ args=args,
+ kwargs=kwargs)
... | |
0cf2ce2331120c20de0cab384c5fdec763c25c68 | min-char-rnn/markov-model.py | min-char-rnn/markov-model.py | # Simple Markov chain model for character-based text generation.
#
# Only tested with Python 3.6+
#
# Eli Bendersky (http://eli.thegreenplace.net)
# This code is in the public domain
from __future__ import print_function
from collections import defaultdict, Counter
import random
import sys
STATE_LEN = 4
def weight... | Add a simple markov chain to compare output with RNN | Add a simple markov chain to compare output with RNN
| Python | unlicense | eliben/deep-learning-samples,eliben/deep-learning-samples | ---
+++
@@ -0,0 +1,58 @@
+# Simple Markov chain model for character-based text generation.
+#
+# Only tested with Python 3.6+
+#
+# Eli Bendersky (http://eli.thegreenplace.net)
+# This code is in the public domain
+from __future__ import print_function
+
+from collections import defaultdict, Counter
+import random
+i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.