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 |
|---|---|---|---|---|---|---|---|---|---|---|
41beca23fff6eab718550d0ce8d22769653c3109 | sauce_test/test_suite.py | sauce_test/test_suite.py | # This contain a list of individual test and will be run from Jenkins.
import unittest
import access_dvn
# This is a list of testFileName.testClass
def suite():
return unittest.TestSuite((\
unittest.makeSuite(access_dvn.AccessDVN),
))
if __name__ == "__main__":
result = unittest.TextTestRunne... | # This contain a list of individual test and will be run from Jenkins.
import unittest
import access_dvn
import test_dataverse
import test_dataset
# This is a list of testFileName.testClass
def suite():
return unittest.TestSuite((\
unittest.makeSuite(access_dvn.AccessDVN),
unittest.makeSuite(test_... | Update test suite to include dataverse and dataset tests. | Update test suite to include dataverse and dataset tests. | Python | apache-2.0 | ekoi/DANS-DVN-4.6.1,ekoi/DANS-DVN-4.6.1,quarian/dataverse,leeper/dataverse-1,leeper/dataverse-1,bmckinney/dataverse-canonical,bmckinney/dataverse-canonical,JayanthyChengan/dataverse,quarian/dataverse,quarian/dataverse,leeper/dataverse-1,leeper/dataverse-1,JayanthyChengan/dataverse,JayanthyChengan/dataverse,quarian/data... | ---
+++
@@ -2,11 +2,15 @@
import unittest
import access_dvn
+import test_dataverse
+import test_dataset
# This is a list of testFileName.testClass
def suite():
return unittest.TestSuite((\
unittest.makeSuite(access_dvn.AccessDVN),
+ unittest.makeSuite(test_dataverse.TestDataverseFunctions... |
a13f23b5f1b11b40db3325c46add3508f43cf649 | python/qilinguist/test/test_qilinguist_list.py | python/qilinguist/test/test_qilinguist_list.py | ## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
from qibuild.test.conftest import TestBuildWorkTree
def test_simple(qilinguist_action, record_messages):
build_worktree = TestBuildWorkTree()
... | Add a test for `qilinguist list` | Add a test for `qilinguist list`
Change-Id: Ia2b2e937732e80a231df9ca57a9d9f39d337da1f
Reviewed-on: http://gerrit.aldebaran.lan/62796
Tested-by: gerrit
Reviewed-by: vbarbaresi <371b46c96c99af52f4f920034e4fcb63ece5bdb5@aldebaran-robotics.com>
| Python | bsd-3-clause | aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild | ---
+++
@@ -0,0 +1,12 @@
+## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
+## Use of this source code is governed by a BSD-style license that can be
+## found in the COPYING file.
+
+from qibuild.test.conftest import TestBuildWorkTree
+
+def test_simple(qilinguist_action, record_messages):
+ bu... | |
f3e0664c4b062587badaa86ddfc9e75711ecf631 | coding-practice/Trie/count_using_wildcards.py | coding-practice/Trie/count_using_wildcards.py | class Trie:
def __init__(self):
self.root = {}
self.end = '*'
def insert(self, word):
cur = self.root
for c in word:
if c in cur:
cur = cur[c]
else:
cur[c] = {}
cur = cur[c]
cur[self.end] = True
... | Use Trie to find no of words matching pattern | Use Trie to find no of words matching pattern
| Python | mit | sayak1711/coding_solutions,sayak1711/coding_solutions,sayak1711/coding_solutions,sayak1711/coding_solutions | ---
+++
@@ -0,0 +1,53 @@
+class Trie:
+ def __init__(self):
+ self.root = {}
+ self.end = '*'
+
+ def insert(self, word):
+ cur = self.root
+ for c in word:
+ if c in cur:
+ cur = cur[c]
+ else:
+ cur[c] = {}
+ cu... | |
e66c6289a7986048329e86162fa59441df7b9a0a | studies/migrations/0003_auto_20170615_1404.py | studies/migrations/0003_auto_20170615_1404.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-15 14:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('studies', '0002_auto_20170607_1800'),
]
operations = [
migrations.RenameFie... | Add migration for changes to study model. | Add migration for changes to study model.
| Python | apache-2.0 | CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,pattisdr/lookit-api,pattisdr/lookit-api,pattisdr/lookit-api | ---
+++
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.1 on 2017-06-15 14:04
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('studies', '0002_auto_20170607_1800'),
+ ]
+
+ op... | |
ef72df34a42eb32409a4928346382f6b5e670000 | core/migrations/0007_pin_private.py | core/migrations/0007_pin_private.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2020-02-11 05:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_remove_pin_origin'),
]
operations = [
migrations.AddField(
... | Add migrations for private property of pin | Feature: Add migrations for private property of pin
| Python | bsd-2-clause | lapo-luchini/pinry,lapo-luchini/pinry,pinry/pinry,pinry/pinry,pinry/pinry,lapo-luchini/pinry,pinry/pinry,lapo-luchini/pinry | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.26 on 2020-02-11 05:32
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0006_remove_pin_origin'),
+ ]
+
+ opera... | |
48dbaf596ee8af826d7e9dec96fee0c626005281 | examples/web_cookies.py | examples/web_cookies.py | #!/usr/bin/env python3
"""Example for aiohttp.web basic server with cookies.
"""
import asyncio
from aiohttp import web
tmpl = '''\
<html>
<body>
<a href="/login">Login</a><br/>
<a href="/logout">Logout</a><br/>
{}
</body>
</html>'''
@asyncio.coroutine
def root(request):
resp = ... | Add example for server-side cookies | Add example for server-side cookies
| Python | apache-2.0 | z2v/aiohttp,avanov/aiohttp,singulared/aiohttp,alunduil/aiohttp,danielnelson/aiohttp,hellysmile/aiohttp,pfreixes/aiohttp,pathcl/aiohttp,morgan-del/aiohttp,alexsdutton/aiohttp,decentfox/aiohttp,panda73111/aiohttp,alex-eri/aiohttp-1,AraHaanOrg/aiohttp,elastic-coders/aiohttp,pfreixes/aiohttp,elastic-coders/aiohttp,mind1mas... | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/env python3
+"""Example for aiohttp.web basic server with cookies.
+"""
+
+import asyncio
+from aiohttp import web
+
+
+tmpl = '''\
+<html>
+ <body>
+ <a href="/login">Login</a><br/>
+ <a href="/logout">Logout</a><br/>
+ {}
+ </body>
+</html>'''
+
+
+@as... | |
dca99dab5e09e6767708e92f9bf92e54a9aa9ed4 | hecuba_py/tests/storage_api_tests.py | hecuba_py/tests/storage_api_tests.py | import unittest
from storage.api import getByID
from hecuba.hdict import StorageDict
class ApiTestSDict(StorageDict):
'''
@TypeSpec <<key:int>, value:double>
'''
class StorageApi_Tests(unittest.TestCase):
def setUp(self):
pass
def class_type_test(self):
base_dict = ApiTestSDict(... | Test build remotely SDict wrong class | Test build remotely SDict wrong class
| Python | apache-2.0 | bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba | ---
+++
@@ -0,0 +1,22 @@
+import unittest
+
+from storage.api import getByID
+from hecuba.hdict import StorageDict
+
+
+class ApiTestSDict(StorageDict):
+ '''
+ @TypeSpec <<key:int>, value:double>
+ '''
+
+class StorageApi_Tests(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def class_type_te... | |
b28d544167dcee75ff7476ae3d43d51191aca717 | reservation_gap.py | reservation_gap.py | from collections import Counter
from boto.ec2 import connect_to_region
REGION = 'us-east-1'
COUNTER_KEY_FMT = '{availability_zone},{instance_type}'
ec2 = connect_to_region(REGION)
running_instance_counter = Counter()
current_reservations_counter = Counter()
def get_instances(ec2):
reservations = ec2.get_all_... | Add script to find gaps between on-demand instances and reservations. | Add script to find gaps between on-demand instances and reservations.
| Python | mit | kjoconnor/aws | ---
+++
@@ -0,0 +1,66 @@
+from collections import Counter
+
+from boto.ec2 import connect_to_region
+
+REGION = 'us-east-1'
+
+COUNTER_KEY_FMT = '{availability_zone},{instance_type}'
+
+ec2 = connect_to_region(REGION)
+
+running_instance_counter = Counter()
+current_reservations_counter = Counter()
+
+
+def get_insta... | |
22e4430a55c17a5b2f77c90f8862530a3ae7f0d6 | accounts/migrations/0005_auto_20170621_1843.py | accounts/migrations/0005_auto_20170621_1843.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-21 18:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0004_auto_20170607_1800'),
]
operations = [
migrations.AlterFie... | Add migration for verbose name. | Add migration for verbose name.
| Python | apache-2.0 | pattisdr/lookit-api,CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,pattisdr/lookit-api,pattisdr/lookit-api | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.1 on 2017-06-21 18:43
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('accounts', '0004_auto_20170607_1800'),
+ ]
+
+ o... | |
5e229787c013cc66fe202964ffb733a2d8f5aa6a | webauthn2/scripts/globus_test_client.py | webauthn2/scripts/globus_test_client.py | from globus_sdk import ConfidentialAppAuthClient
import json
import sys
import pprint
CLIENT_CRED_FILE='/home/secrets/oauth2/client_secret_globus.json'
if __name__ == '__main__':
if len(sys.argv) != 2:
print("Usage: {me} access_token".format(me=sys.argv[0]))
sys.exit(1)
token = sys.argv[1]
... | Add utility to examine depedent tokens retrieved from Globus. | Add utility to examine depedent tokens retrieved from Globus.
| Python | apache-2.0 | informatics-isi-edu/webauthn,informatics-isi-edu/webauthn,informatics-isi-edu/webauthn | ---
+++
@@ -0,0 +1,27 @@
+from globus_sdk import ConfidentialAppAuthClient
+import json
+import sys
+import pprint
+
+CLIENT_CRED_FILE='/home/secrets/oauth2/client_secret_globus.json'
+
+if __name__ == '__main__':
+ if len(sys.argv) != 2:
+ print("Usage: {me} access_token".format(me=sys.argv[0]))
+ s... | |
6364ce646e06d1168b8b96f27c8a7df2e2f0f23b | neutron/pecan_wsgi/hooks/translation.py | neutron/pecan_wsgi/hooks/translation.py | # Copyright (c) 2015 Mirantis, 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 applicabl... | # Copyright (c) 2015 Mirantis, 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 applicabl... | Fix the bug of "Spelling error of a word" | Fix the bug of "Spelling error of a word"
The word "occured" should be spelled as "occurred".
So it is changed.
Change-Id: Ice5212dc8565edb0c5b5c55f979b27440eeeb9aa
Closes-Bug: #1505043
| Python | apache-2.0 | chitr/neutron,asgard-lab/neutron,eayunstack/neutron,noironetworks/neutron,chitr/neutron,mahak/neutron,yanheven/neutron,openstack/neutron,cloudbase/neutron,sebrandon1/neutron,bigswitch/neutron,bigswitch/neutron,huntxu/neutron,MaximNevrov/neutron,asgard-lab/neutron,dims/neutron,wolverineav/neutron,wolverineav/neutron,mah... | ---
+++
@@ -35,4 +35,4 @@
# hide message from user in case it contained sensitive details
LOG.exception(_("An unexpected exception was caught: %s") % e)
raise webob.exc.HTTPInternalServerError(
- _("An unexpected internal error occured."))
+ _("An unexpected internal e... |
01b84f1b2a73ba31d6304baa0e08415657c72dca | website/tests/models/test_cancer.py | website/tests/models/test_cancer.py | from database import db
from model_testing import ModelTest
from models import Cancer
from sqlalchemy.exc import IntegrityError
import pytest
class CancerTest(ModelTest):
def test_init(self):
cancer = Cancer(name='Bladder Urothelial Carcinoma', code='BLCA')
assert cancer.name == 'Bladder Uroth... | Add tests for cancer model init | Add tests for cancer model init
| Python | lgpl-2.1 | reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-... | ---
+++
@@ -0,0 +1,32 @@
+from database import db
+from model_testing import ModelTest
+from models import Cancer
+from sqlalchemy.exc import IntegrityError
+import pytest
+
+
+class CancerTest(ModelTest):
+
+ def test_init(self):
+
+ cancer = Cancer(name='Bladder Urothelial Carcinoma', code='BLCA')
+
+ ... | |
c625c9d8918eab3e86ac14abd674b6232c2fa8e9 | django/sierra/base/migrations/0002_auto_20170602_1115.py | django/sierra/base/migrations/0002_auto_20170602_1115.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from utils.load_data import load_data
class Migration(migrations.Migration):
dependencies = [
('base', '0001_squashed_0009_auto_20170602_1057'),
]
operations = [
migrations.RunPython... | Add data migrations for base app | Add data migrations for base app
| Python | bsd-3-clause | unt-libraries/catalog-api,unt-libraries/catalog-api,unt-libraries/catalog-api,unt-libraries/catalog-api | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from utils.load_data import load_data
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('base', '0001_squashed_0009_auto_20170602_1057'),
+ ]
+
+ op... | |
25417369765087482f0d02b06913b3cffe9f43ad | tests/unit/test_secret.py | tests/unit/test_secret.py | # Import libnacl libs
import libnacl.secret
# Import python libs
import unittest
class TestSecret(unittest.TestCase):
'''
'''
def test_secret(self):
msg = 'But then of course African swallows are not migratory.'
box = libnacl.secret.SecretBox()
ctxt = box.encrypt(msg)
self.a... | Add high level secret tests | Add high level secret tests
| Python | apache-2.0 | johnttan/libnacl,cachedout/libnacl,mindw/libnacl,saltstack/libnacl,coinkite/libnacl,RaetProtocol/libnacl | ---
+++
@@ -0,0 +1,22 @@
+# Import libnacl libs
+import libnacl.secret
+# Import python libs
+import unittest
+
+class TestSecret(unittest.TestCase):
+ '''
+ '''
+ def test_secret(self):
+ msg = 'But then of course African swallows are not migratory.'
+ box = libnacl.secret.SecretBox()
+ ... | |
57a58893a2ba94b174b06e7f5f63478dff1e879e | providers/popularity/netflix.py | providers/popularity/netflix.py | from providers.popularity.provider import PopularityProvider
from utils.torrent_util import remove_bad_torrent_matches, torrent_to_movie
IDENTIFIER = "netflix"
class Provider(PopularityProvider):
def get_popular(self):
country = "se"
url = f"https://www.finder.com/{country}/netflix-movies"
... | Add provider for (Swedish) Netflix. | Add provider for (Swedish) Netflix.
Change "country" inside the provider for the movies available in a different country.
| Python | mit | EmilStenstrom/nephele | ---
+++
@@ -0,0 +1,20 @@
+from providers.popularity.provider import PopularityProvider
+from utils.torrent_util import remove_bad_torrent_matches, torrent_to_movie
+
+IDENTIFIER = "netflix"
+
+class Provider(PopularityProvider):
+ def get_popular(self):
+ country = "se"
+ url = f"https://www.finder.c... | |
96526df63b2d45f08c7f007b45ee793e3ccc97a3 | array/rotate-image.py | array/rotate-image.py | # You are given an n x n 2D matrix that represents an image. Rotate the image by 90 degrees clockwise
# solve with O(1) additional memory
def rotate_image(a):
n = len(a)
if a is None or n < 1:
return a
else:
for i in range(n/2):
for j in range(n-i-1):
temp = a[i][j]
a[i][j] = a[n-1-j][i]
a[n-1-j... | Write rotate 90 degrees nxn 2d matrix algorithm: currently debugging | Write rotate 90 degrees nxn 2d matrix algorithm: currently debugging
| Python | mit | derekmpham/interview-prep,derekmpham/interview-prep | ---
+++
@@ -0,0 +1,17 @@
+# You are given an n x n 2D matrix that represents an image. Rotate the image by 90 degrees clockwise
+# solve with O(1) additional memory
+
+def rotate_image(a):
+ n = len(a)
+
+ if a is None or n < 1:
+ return a
+ else:
+ for i in range(n/2):
+ for j in range(n-i-1):
+ temp = a[i][j... | |
6e1f1d900d77f1352eb941f7ac569a0c681c8dc1 | loop_write.py | loop_write.py | #! /usr/bin/env python
# -*- coding:utf-8 -*-
import random
import time
from automaton_client import AutomatonClient
SERVER_HOST = "localhost"
SERVER_PORT = 1502
SLEEP_INTERVAL = 5
# sets on only 6 randomly chosen panels
def random6():
regs_values = [0] * 23
indices = []
while len(indices) < 6:
... | Add new script to loop on randomly writing registers | Add new script to loop on randomly writing registers
| Python | mit | vandaele/light-automation,vandaele/light-automation | ---
+++
@@ -0,0 +1,48 @@
+#! /usr/bin/env python
+# -*- coding:utf-8 -*-
+
+import random
+import time
+
+from automaton_client import AutomatonClient
+
+SERVER_HOST = "localhost"
+SERVER_PORT = 1502
+SLEEP_INTERVAL = 5
+
+# sets on only 6 randomly chosen panels
+def random6():
+ regs_values = [0] * 23
+ indice... | |
a3b72336c5f04dfdc91b4d296adf669c9e3bf355 | txircd/modules/umode_s.py | txircd/modules/umode_s.py | from txircd.modbase import Mode
class ServerNoticeMode(Mode):
pass
class Spawner(object):
def __init__(self, ircd):
self.ircd = ircd
def spawn(self):
return {
"modes": {
"uns": ServerNoticeMode()
}
}
def cleanup(self):
self.ircd.removeMode("uns") | Implement usermode +s (currently doesn't do anything) | Implement usermode +s (currently doesn't do anything)
| Python | bsd-3-clause | ElementalAlchemist/txircd,Heufneutje/txircd,DesertBus/txircd | ---
+++
@@ -0,0 +1,18 @@
+from txircd.modbase import Mode
+
+class ServerNoticeMode(Mode):
+ pass
+
+class Spawner(object):
+ def __init__(self, ircd):
+ self.ircd = ircd
+
+ def spawn(self):
+ return {
+ "modes": {
+ "uns": ServerNoticeMode()
+ }
+ }
+
+ def cleanup(self):
+ self.ircd.removeMode("uns") | |
af9ec9b12f5111cf6b2352ca9efc147c86093024 | Problems/compressString.py | Problems/compressString.py | #!/Applications/anaconda/envs/Python3/bin
def main():
# Test suite
tests = [None, '', 'AABBCC', 'AAABCCDDDD']
results = [None, '', 'AABBCC', 'A3BCCD4']
for i in range(len(tests)):
temp_result = compress_string(tests[i])
if temp_result == results[i]:
print('PASS: {} return... | Add string compression problem and tests. | Add string compression problem and tests.
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,66 @@
+#!/Applications/anaconda/envs/Python3/bin
+
+
+def main():
+ # Test suite
+ tests = [None, '', 'AABBCC', 'AAABCCDDDD']
+ results = [None, '', 'AABBCC', 'A3BCCD4']
+
+ for i in range(len(tests)):
+ temp_result = compress_string(tests[i])
+ if temp_result == results[... | |
3061099d72364eb6d6aa36613b2a425fc3f99915 | furl/__init__.py | furl/__init__.py | #
# furl - URL manipulation made simple.
#
# Arthur Grunseid
# grunseid.com
# grunseid@gmail.com
#
# License: Build Amazing Things (Unlicense)
__title__ = 'furl'
__version__ = '0.3.9'
__license__ = 'Unlicense'
__author__ = 'Arthur Grunseid'
__contact__ = 'grunseid@gmail.com'
__url__ = 'https://github.com/gruns/furl'
... | #
# furl - URL manipulation made simple.
#
# Arthur Grunseid
# grunseid.com
# grunseid@gmail.com
#
# License: Build Amazing Things (Unlicense)
__title__ = 'furl'
__version__ = '0.3.91'
__license__ = 'Unlicense'
__author__ = 'Arthur Grunseid'
__contact__ = 'grunseid@gmail.com'
__url__ = 'https://github.com/gruns/furl'
... | Increment version to v0.3.91 for PyPi. | Increment version to v0.3.91 for PyPi.
| Python | unlicense | Gerhut/furl,lastfm/furl,penyatree/furl,guiquanz/furl | ---
+++
@@ -8,7 +8,7 @@
# License: Build Amazing Things (Unlicense)
__title__ = 'furl'
-__version__ = '0.3.9'
+__version__ = '0.3.91'
__license__ = 'Unlicense'
__author__ = 'Arthur Grunseid'
__contact__ = 'grunseid@gmail.com' |
55eb1c81f02a715adfe70c188985924fbeb340fd | demos/_videos_index_duration.py | demos/_videos_index_duration.py | import sys
from Ziggeo import Ziggeo
if(len(sys.argv) < 3):
print ("Error\n")
print ("Usage: $>python _videos_index_duration.py YOUR_API_TOKEN YOUR_PRIVATE_KEY\n")
sys.exit()
api_token = sys.argv[1]
private_key = sys.argv[2]
total_duration = 0.0
count_duration = 0.0
ziggeo = Ziggeo(api_token, private_key)
def ind... | Add script to get average duration based on video list data | Add script to get average duration based on video list data
| Python | apache-2.0 | Ziggeo/ZiggeoPythonSdk,Ziggeo/ZiggeoPythonSdk | ---
+++
@@ -0,0 +1,28 @@
+import sys
+
+from Ziggeo import Ziggeo
+
+if(len(sys.argv) < 3):
+ print ("Error\n")
+ print ("Usage: $>python _videos_index_duration.py YOUR_API_TOKEN YOUR_PRIVATE_KEY\n")
+ sys.exit()
+
+api_token = sys.argv[1]
+private_key = sys.argv[2]
+total_duration = 0.0
+count_duration = 0.0
+ziggeo... | |
3154ef23b48a42e274417a28953c55b98ac3fec3 | filters/png2jpg.py | filters/png2jpg.py | """
Change image extensions from .png to .jpg
EXAMPLE:
>>>> echo An  | pandoc -F png2jpg.py
"""
import panflute as pf
def action(elem, doc):
if isinstance(elem, pf.Image):
elem.url = elem.url.replace('.png', '.j... | Convert .png endings to .jpg | Convert .png endings to .jpg
| Python | bsd-3-clause | sergiocorreia/panflute-filters | ---
+++
@@ -0,0 +1,20 @@
+"""
+Change image extensions from .png to .jpg
+
+EXAMPLE:
+ >>>> echo An  | pandoc -F png2jpg.py
+"""
+
+import panflute as pf
+
+
+def action(elem, doc):
+ if isinstance(elem, pf.Image):
+ ... | |
59f9e977ee343082b9ad3e815c662d1425549e83 | tests/test_binned_likelihood.py | tests/test_binned_likelihood.py | # from blueice.test_helpers import *
# from blueice.likelihood import BinnedLogLikelihood
#
# from scipy import stats
#
#
# def test_single_bin():
# conf = test_conf()
# conf['sources'][0]['events_per_day'] = 1
# conf['analysis_space'] = [['x', [-10, 10]]]
#
# lf = BinnedLogLikelihood(conf)
# lf.add... | Add new tests (don't yet work) | Add new tests (don't yet work) | Python | bsd-3-clause | JelleAalbers/blueice | ---
+++
@@ -0,0 +1,20 @@
+# from blueice.test_helpers import *
+# from blueice.likelihood import BinnedLogLikelihood
+#
+# from scipy import stats
+#
+#
+# def test_single_bin():
+# conf = test_conf()
+# conf['sources'][0]['events_per_day'] = 1
+# conf['analysis_space'] = [['x', [-10, 10]]]
+#
+# lf =... | |
7df6010f1dd4cfa00b48f2fe646d3bb0bd02f8ec | tests/fd_remote.py | tests/fd_remote.py | from __future__ import absolute_import
from filedes.test.base import BaseFDTestCase
from filedes.subprocess import Popen
from filedes import get_open_fds, FD
from subprocess import PIPE, STDOUT
import unittest2
import filedes
import socket
import tempfile
class RemoteFDTests(BaseFDTestCase):
def testPipe(self):
... | Add unittest to verify remote stat on misc fd types | Add unittest to verify remote stat on misc fd types
Fixes #8
| Python | isc | fmoo/python-filedes,fmoo/python-filedes | ---
+++
@@ -0,0 +1,79 @@
+from __future__ import absolute_import
+
+from filedes.test.base import BaseFDTestCase
+from filedes.subprocess import Popen
+from filedes import get_open_fds, FD
+from subprocess import PIPE, STDOUT
+import unittest2
+import filedes
+import socket
+import tempfile
+
+
+class RemoteFDTests(B... | |
c2506fdc71f1dcff2e3455c668e78ad6b7d5d94b | scripts/fenix/fenix_download.py | scripts/fenix/fenix_download.py | # python fenix_download login_file <url> -e <file_extension> (DEFAULT = pdf) -d <download_directory>
#
#
from fenix import Fenix
import argparse
if __name__ == '__main__':
# TODO: argparse
parser = argparse.ArgumentParser(description='Download files from Fenix Edu pages')
parser.add_argument('login', type... | Add inital structure for fenix downloader | Add inital structure for fenix downloader
| Python | mit | iluxonchik/python-general-repo | ---
+++
@@ -0,0 +1,14 @@
+# python fenix_download login_file <url> -e <file_extension> (DEFAULT = pdf) -d <download_directory>
+#
+#
+
+from fenix import Fenix
+import argparse
+
+if __name__ == '__main__':
+ # TODO: argparse
+ parser = argparse.ArgumentParser(description='Download files from Fenix Edu pages')
... | |
a5f0544bf0ce88ecfca515f0db344fffb90c8d8e | altair/vegalite/v2/examples/percentage_of_total.py | altair/vegalite/v2/examples/percentage_of_total.py | """
Calculating Percentage of Total
-------------------------------
This chart demonstrates how to use a window transform to display data values
as a percentage of total values.
"""
import altair as alt
import pandas as pd
activities = pd.DataFrame({'Activity': ['Sleeping', 'Eating', 'TV', 'Work', 'Exercise'],
... | Add simple window transform example | Add simple window transform example
| Python | bsd-3-clause | altair-viz/altair,ellisonbg/altair,jakevdp/altair | ---
+++
@@ -0,0 +1,22 @@
+"""
+Calculating Percentage of Total
+-------------------------------
+This chart demonstrates how to use a window transform to display data values
+as a percentage of total values.
+"""
+
+import altair as alt
+import pandas as pd
+
+activities = pd.DataFrame({'Activity': ['Sleeping', 'Eati... | |
9f27cf9f0669f98694e7751eb9d22064d24bdb3f | services/tests/test_indexing.py | services/tests/test_indexing.py | from django.test import TestCase
from services.tests.factories import ServiceFactory
from services.models import Service
from services.search_indexes import ServiceIndex
class IndexingTest(TestCase):
def setUp(self):
self.service_ar = ServiceFactory(
name_ar='Arabic', name_en='', name_fr='',... | Add testcase for search indexing of Service | Add testcase for search indexing of Service
| Python | bsd-3-clause | theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo | ---
+++
@@ -0,0 +1,50 @@
+from django.test import TestCase
+
+from services.tests.factories import ServiceFactory
+from services.models import Service
+from services.search_indexes import ServiceIndex
+
+
+class IndexingTest(TestCase):
+
+ def setUp(self):
+ self.service_ar = ServiceFactory(
+ na... | |
729cdbfc9013bbc34bb44cc10f0f8443d604f1be | time_series_rnn.py | time_series_rnn.py | # Predict time series
import tensorflow as tf
import numpy as np
# Create time series
t_min, t_max = 0, 30
resolution = 0.1
def time_series(t):
return t * np.sin(t) / 3 + 2 * np.sin(t * 5)
def next_batch(batch_size, n_steps):
t0 = np.random.rand(batch_size, 1) * (t_max - t_min - n_steps * resolution)
Ts... | Add code for RNN time series analysis | Add code for RNN time series analysis
Uses OutputProjectionWrapper
| Python | mit | KT12/hands_on_machine_learning | ---
+++
@@ -0,0 +1,61 @@
+# Predict time series
+
+import tensorflow as tf
+import numpy as np
+
+# Create time series
+t_min, t_max = 0, 30
+resolution = 0.1
+
+def time_series(t):
+ return t * np.sin(t) / 3 + 2 * np.sin(t * 5)
+
+def next_batch(batch_size, n_steps):
+ t0 = np.random.rand(batch_size, 1) * (t_m... | |
1ec1bede9f5451aeef09d250ad4542bfb0cedb3d | tests/pytests/functional/modules/test_user.py | tests/pytests/functional/modules/test_user.py | import pathlib
import pytest
from saltfactories.utils import random_string
pytestmark = [
pytest.mark.skip_if_not_root,
pytest.mark.destructive_test,
pytest.mark.windows_whitelisted,
]
@pytest.fixture(scope="module")
def user(modules):
return modules.user
@pytest.fixture
def username(user):
_u... | Add functional tests for the salt user module | Add functional tests for the salt user module
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,59 @@
+import pathlib
+
+import pytest
+from saltfactories.utils import random_string
+
+pytestmark = [
+ pytest.mark.skip_if_not_root,
+ pytest.mark.destructive_test,
+ pytest.mark.windows_whitelisted,
+]
+
+
+@pytest.fixture(scope="module")
+def user(modules):
+ return modules.user
+
... | |
a2ab40bd7da2131ff6b9d502cc3dde1f6a8531e6 | src/legacy_data_export.py | src/legacy_data_export.py | import json
import sys
import database as db
from database.model import Team
from geotools import simple_distance
from geotools.routing import MapPoint
from webapp.cfg.config import DB_CONNECTION
if len(sys.argv) == 2:
MAX_TEAMS = sys.argv[1]
else:
MAX_TEAMS = 9
print "init db..."
db.init_session(connection_... | Build a legacy distance export | Build a legacy distance export
| Python | bsd-3-clause | janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system | ---
+++
@@ -0,0 +1,38 @@
+import json
+import sys
+import database as db
+from database.model import Team
+from geotools import simple_distance
+from geotools.routing import MapPoint
+from webapp.cfg.config import DB_CONNECTION
+
+
+if len(sys.argv) == 2:
+ MAX_TEAMS = sys.argv[1]
+else:
+ MAX_TEAMS = 9
+
+prin... | |
43b4d63f8587bcc7078635a099f1acf48264303c | spacy/tests/serialize/test_serialize_tagger.py | spacy/tests/serialize/test_serialize_tagger.py | # coding: utf-8
from __future__ import unicode_literals
from ..util import make_tempdir
from ...pipeline import NeuralTagger as Tagger
import pytest
@pytest.fixture
def taggers(en_vocab):
tagger1 = Tagger(en_vocab, True)
tagger2 = Tagger(en_vocab, True)
tagger1.model = tagger1.Model(None, None)
tagg... | Add serialization tests for tagger | Add serialization tests for tagger
| Python | mit | honnibal/spaCy,recognai/spaCy,spacy-io/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,explosion/spaCy,recognai/spaCy,honnibal/spaCy,honnibal/spaCy,recognai/spaCy,recognai/spaCy,aikramer2/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,recognai/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spa... | ---
+++
@@ -0,0 +1,39 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..util import make_tempdir
+from ...pipeline import NeuralTagger as Tagger
+
+import pytest
+
+
+@pytest.fixture
+def taggers(en_vocab):
+ tagger1 = Tagger(en_vocab, True)
+ tagger2 = Tagger(en_vocab, True)
+ tagger1.m... | |
81728590b09270e4e32af61cdb5855bb814f683c | test/unit/sorting/test_quick_sort.py | test/unit/sorting/test_quick_sort.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
from helper.read_data_file import read_int_array
from sorting.quick_sort import sort
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class InsertionSortTester(unittest.TestCase):
# Test sort in default order, i.e., in ascending ord... | Add unit test for quick sort implementation. | Add unit test for quick sort implementation.
| Python | mit | weichen2046/algorithm-study,weichen2046/algorithm-study | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import unittest
+
+from helper.read_data_file import read_int_array
+from sorting.quick_sort import sort
+
+
+BASE_DIR = os.path.dirname(os.path.abspath(__file__))
+
+
+class InsertionSortTester(unittest.TestCase):
+
+ # Test so... | |
5995fb29869e828ae7dd6bcca9eb30bfe00a959d | __init__.py | __init__.py | bl_info = {
"name": "Booltron",
"author": "Mikhail Rachinskiy (jewelcourses.com)",
"version": (2000,),
"blender": (2,7,4),
"location": "3D View → Tool Shelf",
"description": "Booltron—super add-on for super fast booleans.",
"wiki_url": "https://github.com/mrachinskiy/blender-addon-booltron",
"tracker_url": "htt... | bl_info = {
"name": "Booltron",
"author": "Mikhail Rachinskiy (jewelcourses.com)",
"version": (2000,),
"blender": (2,74,0),
"location": "3D View → Tool Shelf",
"description": "Booltron—super add-on for super fast booleans.",
"wiki_url": "https://github.com/mrachinskiy/blender-addon-booltron",
"tracker_url": "ht... | Fix for Blender version check | Fix for Blender version check
| Python | mit | mrachinskiy/blender-addon-booltron | ---
+++
@@ -2,12 +2,12 @@
"name": "Booltron",
"author": "Mikhail Rachinskiy (jewelcourses.com)",
"version": (2000,),
- "blender": (2,7,4),
+ "blender": (2,74,0),
"location": "3D View → Tool Shelf",
"description": "Booltron—super add-on for super fast booleans.",
"wiki_url": "https://github.com/mrachinskiy... |
560228cbc2e95fd24f994e0a78465a031f6e0eef | crmapp/contacts/forms.py | crmapp/contacts/forms.py | from django import forms
from .models import Contact
class ContactForm(forms.ModelForm):
class Meta:
model = Contact
fields = ('first_name', 'last_name',
'role', 'phone', 'email', 'account',
)
widgets = {
'first_name': forms.TextInput(
... | Create the Contacts App - Part II > New Contact - Create Form | Create the Contacts App - Part II > New Contact - Create Form
| Python | mit | deenaariff/Django,tabdon/crmeasyapp,tabdon/crmeasyapp | ---
+++
@@ -0,0 +1,28 @@
+from django import forms
+
+from .models import Contact
+
+
+class ContactForm(forms.ModelForm):
+ class Meta:
+ model = Contact
+ fields = ('first_name', 'last_name',
+ 'role', 'phone', 'email', 'account',
+ )
+ widgets = {
+ 'first... | |
b273248f1c33abfe355657e8b0e4e85492efb10d | designate/tests/test_api/test_v1/test_limits.py | designate/tests/test_api/test_v1/test_limits.py | # coding=utf-8
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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... | Add tests for limits api in V1 api | Add tests for limits api in V1 api
Change-Id: Id05520acf5e3a62647915829d72ca7afd3916337
| Python | apache-2.0 | cneill/designate-testing,muraliselva10/designate,ionrock/designate,grahamhayes/designate,ramsateesh/designate,tonyli71/designate,cneill/designate-testing,grahamhayes/designate,tonyli71/designate,ramsateesh/designate,openstack/designate,grahamhayes/designate,muraliselva10/designate,cneill/designate-testing,ionrock/desig... | ---
+++
@@ -0,0 +1,39 @@
+# coding=utf-8
+# Copyright 2012 Managed I.T.
+#
+# Author: Kiall Mac Innes <kiall@managedit.ie>
+#
+# 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
+#
+# htt... | |
52b62e2bfd5bef7ad1047259d0516539c20a2442 | scifight_proj/management/commands/changepassword_quiet.py | scifight_proj/management/commands/changepassword_quiet.py | from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS
class Command(BaseCommand):
help = "Quietly change a user's password for django.contrib.auth."
requires_system_checks = False
def add_arguments(self, pa... | Add 'manage.py' command for unattended password setup | Add 'manage.py' command for unattended password setup
Unfortunately, there is no standard way to non-interactively create
superuser account, neither in Django, nor in django-extensions. All the
following commands require manual pasword-typing:
- createsuperuser
- changepassword
- passwd
- set_fake_passwords (work... | Python | agpl-3.0 | turboj55/scifight,turboj55/scifight,scifight/scifight,scifight/scifight,turboj55/scifight,scifight/scifight | ---
+++
@@ -0,0 +1,37 @@
+from django.contrib.auth import get_user_model
+from django.core.management.base import BaseCommand, CommandError
+from django.db import DEFAULT_DB_ALIAS
+
+
+class Command(BaseCommand):
+ help = "Quietly change a user's password for django.contrib.auth."
+
+ requires_system_checks = F... | |
7f4d21ad84dc12165ea65abd1606d4aa3689e3cb | headers/cpp/nonvirtual_dtors.py | headers/cpp/nonvirtual_dtors.py | #!/usr/bin/env python
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Add script to find destructors which are not virtual, but should be | Add script to find destructors which are not virtual, but should be
git-svn-id: b0ea89ea3bf41df64b6a046736e217d0ae4a0fba@66 806ff5bb-693f-0410-b502-81bc3482ff28
| Python | apache-2.0 | myint/cppclean,myint/cppclean,myint/cppclean,myint/cppclean | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+#
+# Copyright 2008 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#... | |
50886a39d3cda7b487ed3862626d565c80737add | calaccess_processed/migrations/0011_auto_20171023_1620.py | calaccess_processed/migrations/0011_auto_20171023_1620.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-10-23 16:20
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('calaccess_processed', '0010_auto_20171013_1838'),
]
operations = [
migrations.Alter... | Add migrations for verbose name changes | Add migrations for verbose name changes
| Python | mit | california-civic-data-coalition/django-calaccess-processed-data,california-civic-data-coalition/django-calaccess-processed-data | ---
+++
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-10-23 16:20
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('calaccess_processed', '0010_auto_20171013_1838'),
+ ]
+
+ ... | |
d388709d1c7d52cf1f2552bcfdbfd6b83b578675 | tools/perf/benchmarks/robohornet_pro.py | tools/perf/benchmarks/robohornet_pro.py | # Copyright (c) 2012 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.
"""Runs Microsoft's RoboHornet Pro benchmark."""
import os
from telemetry import test
from telemetry.core import util
from telemetry.page import page_m... | # Copyright (c) 2012 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.
"""Runs Microsoft's RoboHornet Pro benchmark."""
import os
from telemetry import test
from telemetry.core import util
from telemetry.page import page_m... | Raise robohornetpro timeout. Is it timing out on cros. | [Telemetry] Raise robohornetpro timeout. Is it timing out on cros.
BUG=266129
Review URL: https://chromiumcodereview.appspot.com/21297004
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@214925 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | ChromiumWebApps/chromium,ChromiumWebApps/chromium,anirudhSK/chromium,dushu1203/chromium.src,crosswalk-project/chromium-crosswalk-efl,Jonekee/chromium.src,ondra-novak/chromium.src,dednal/chromium.src,markYoungH/chromium.src,ondra-novak/chromium.src,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,bright-spar... | ---
+++
@@ -19,7 +19,7 @@
done = 'document.getElementById("results").innerHTML.indexOf("Total") != -1'
def _IsDone():
return tab.EvaluateJavaScript(done)
- util.WaitFor(_IsDone, 60)
+ util.WaitFor(_IsDone, 120)
result = int(tab.EvaluateJavaScript('stopTime - startTime'))
results.Add... |
5c1fad9e6a75ee43d3a3b7bce6c9249cf601b4b9 | tendrl/commons/objects/cluster_tendrl_context/__init__.py | tendrl/commons/objects/cluster_tendrl_context/__init__.py | import json
import logging
import os
import socket
import uuid
from tendrl.commons.etcdobj import EtcdObj
from tendrl.commons.utils import cmd_utils
from tendrl.commons import objects
LOG = logging.getLogger(__name__)
class ClusterTendrlContext(objects.BaseObject):
def __init__(
self,
integra... | import json
import logging
import os
import socket
import uuid
from tendrl.commons.etcdobj import EtcdObj
from tendrl.commons.utils import cmd_utils
from tendrl.commons import objects
LOG = logging.getLogger(__name__)
class ClusterTendrlContext(objects.BaseObject):
def __init__(
self,
integra... | Write cluster_tendrl_context to proper location | Write cluster_tendrl_context to proper location
Currently it is written to clusters/<node-id>/TendrlContext
This is fixed in this PR
tendrl-bug-id: Tendrl/commons#302
Signed-off-by: nnDarshan <d2c6d450ab98b078f2f1942c995e6d92dd504bc8@gmail.com>
| Python | lgpl-2.1 | r0h4n/commons,Tendrl/commons,rishubhjain/commons | ---
+++
@@ -45,5 +45,5 @@
_tendrl_cls = ClusterTendrlContext
def render(self):
- self.__name__ = self.__name__ % NS.node_context.node_id
+ self.__name__ = self.__name__ % NS.tendrl_context.integration_id
return super(_ClusterTendrlContextEtcd, self).render() |
9a3695316f469bb70161d50665697ab248b0d7f1 | vistrails/tests/resources/console_mode_test.py | vistrails/tests/resources/console_mode_test.py | ############################################################################
##
## Copyright (C) 2006-2007 University of Utah. All rights reserved.
##
## This file is part of VisTrails.
##
## This file may be used under the terms of the GNU General Public
## License version 2.0 as published by the Free Software Foundat... | Package for console_mode test suite. | Package for console_mode test suite.
| Python | bsd-3-clause | Nikea/VisTrails,Nikea/VisTrails,minesense/VisTrails,VisTrails/VisTrails,minesense/VisTrails,hjanime/VisTrails,minesense/VisTrails,Nikea/VisTrails,celiafish/VisTrails,VisTrails/VisTrails,celiafish/VisTrails,hjanime/VisTrails,hjanime/VisTrails,minesense/VisTrails,celiafish/VisTrails,hjanime/VisTrails,VisTrails/VisTrails,... | ---
+++
@@ -0,0 +1,46 @@
+############################################################################
+##
+## Copyright (C) 2006-2007 University of Utah. All rights reserved.
+##
+## This file is part of VisTrails.
+##
+## This file may be used under the terms of the GNU General Public
+## License version 2.0 as pub... | |
8efab0283613dd09b09b1771fe35732c9cbc5cea | common/config.py | common/config.py | import imp
module = imp.new_module('config')
module.__file__ = 'config.py'
config = {}
config_file = open(module.__file__)
exec(compile(config_file.read(), 'config.py', 'exec'), module.__dict__)
for key in dir(module):
if key.isupper():
config[key] = getattr(module, key)
| Add missing file for last commit | Add missing file for last commit
| Python | isc | tobbez/lys-reader | ---
+++
@@ -0,0 +1,13 @@
+import imp
+
+module = imp.new_module('config')
+module.__file__ = 'config.py'
+config = {}
+config_file = open(module.__file__)
+
+exec(compile(config_file.read(), 'config.py', 'exec'), module.__dict__)
+
+for key in dir(module):
+ if key.isupper():
+ config[key] = getattr(module,... | |
ab9fed3a9a9152ed266d40eab2f16b12c77349fd | tests/test_vcs_bazaar.py | tests/test_vcs_bazaar.py | from tests.test_pip import pyversion
from pip.vcs.bazaar import Bazaar
if pyversion >= '3':
VERBOSE_FALSE = False
else:
VERBOSE_FALSE = 0
def test_bazaar_simple_urls():
"""
Test bzr url support.
SSH and launchpad have special handling.
"""
http_bzr_repo = Bazaar(url='bzr+http://bzr.mypro... | Add unit tests for bazaar URL handling | Add unit tests for bazaar URL handling
Tested on 2.4.4, 2.7.1 and 3.2
nosetests tests.test_vcs_bazaar passes in each, full setup.py test gives:
2.4:
----------------------------------------------------------------------
Ran 107 tests in 167.345s
OK
2.7 fails 1 on Test freezing a mercurial clone
Script result: py... | Python | mit | pypa/pip,willingc/pip,jythontools/pip,blarghmatey/pip,patricklaw/pip,domenkozar/pip,rouge8/pip,squidsoup/pip,zorosteven/pip,benesch/pip,pjdelport/pip,zvezdan/pip,dstufft/pip,supriyantomaftuh/pip,sbidoul/pip,caosmo/pip,natefoo/pip,h4ck3rm1k3/pip,techtonik/pip,minrk/pip,jasonkying/pip,sigmavirus24/pip,RonnyPfannschmidt/p... | ---
+++
@@ -0,0 +1,29 @@
+from tests.test_pip import pyversion
+from pip.vcs.bazaar import Bazaar
+
+if pyversion >= '3':
+ VERBOSE_FALSE = False
+else:
+ VERBOSE_FALSE = 0
+
+
+def test_bazaar_simple_urls():
+ """
+ Test bzr url support.
+
+ SSH and launchpad have special handling.
+ """
+ http_... | |
a1a552857498206b6684681eb457978dd5adf710 | nap/rest/mapper.py | nap/rest/mapper.py | '''
Mixins for using Mappers with Publisher
'''
from django.core.exceptions import ValidationError
from nap import http
from nap.utils import flatten_errors
class MapperListMixin(object):
def list_get_default(self, request, action, object_id):
'''
Replace the default list handler with one that r... | Add Publisher mixins for using Mappers | Add Publisher mixins for using Mappers
| Python | bsd-3-clause | limbera/django-nap,MarkusH/django-nap | ---
+++
@@ -0,0 +1,111 @@
+'''
+Mixins for using Mappers with Publisher
+'''
+from django.core.exceptions import ValidationError
+
+from nap import http
+from nap.utils import flatten_errors
+
+
+class MapperListMixin(object):
+
+ def list_get_default(self, request, action, object_id):
+ '''
+ Replac... | |
ff50744e2dd1f04959e4f7f63ff3a08d21ef9839 | pint-numpy-type.py | pint-numpy-type.py | # A variable imbued with pint unit mutates its state when touched by Numpy.
# Source https://github.com/hgrecco/pint/blob/master/pint/quantity.py#L1165-L1167
# Since https://github.com/hgrecco/pint/commit/53d5fca35948a5bb80cb900e8e692e8206b1512a
import pint # 0.7.2
import numpy as np # 1.11.1
units = pint.UnitRegist... | Add pint numpy type snippet | Add pint numpy type snippet
| Python | mit | cmey/surprising-snippets,cmey/surprising-snippets | ---
+++
@@ -0,0 +1,16 @@
+# A variable imbued with pint unit mutates its state when touched by Numpy.
+# Source https://github.com/hgrecco/pint/blob/master/pint/quantity.py#L1165-L1167
+# Since https://github.com/hgrecco/pint/commit/53d5fca35948a5bb80cb900e8e692e8206b1512a
+import pint # 0.7.2
+import numpy as np #... | |
bf8c008742dd921865f18f10b1c925c485406343 | django_lightweight_queue/management/commands/queue_configuration.py | django_lightweight_queue/management/commands/queue_configuration.py | from django.core.management.base import NoArgsCommand
from ... import app_settings
class Command(NoArgsCommand):
def handle_noargs(self, **options):
print "django-lightweight-queue"
print "========================"
print
print "{0:<15} {1:>5}".format("Queue name", "Concurrency")
... | Add a quick way to show the current queue configuration. | Add a quick way to show the current queue configuration.
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>
| Python | bsd-3-clause | prophile/django-lightweight-queue,prophile/django-lightweight-queue,thread/django-lightweight-queue,lamby/django-lightweight-queue,thread/django-lightweight-queue | ---
+++
@@ -0,0 +1,22 @@
+from django.core.management.base import NoArgsCommand
+
+from ... import app_settings
+
+class Command(NoArgsCommand):
+ def handle_noargs(self, **options):
+ print "django-lightweight-queue"
+ print "========================"
+ print
+ print "{0:<15} {1:>5}".f... | |
f54f1cea9a839e97b27103638530fb030ca81a6a | app/utils/scripts/update-defconfig.py | app/utils/scripts/update-defconfig.py | #!/usr/bin/python
#
# 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 version.
#
# This program is distributed in the hope t... | Add utility script to convert/update builds. | Add utility script to convert/update builds.
* Moving to mass-rename everything into build, the script is
used to convert defconfig_id fields into build_id.
* Add "kernel" type to build documents.
| Python | lgpl-2.1 | kernelci/kernelci-backend,kernelci/kernelci-backend | ---
+++
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+#
+# 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 version.
+#
+# This p... | |
6708fd75eb7272701e8e333e4940e47d5b6a05af | plugin_tests/web_client_test.py | plugin_tests/web_client_test.py | from tests import web_client_test
setUpModule = web_client_test.setUpModule
tearDownModule = web_client_test.tearDownModule
class WebClientTestCase(web_client_test.WebClientTestCase):
def setUp(self):
super(WebClientTestCase, self).setUp()
self.model('user').createUser(
login='mine... | Add a custom client side test runner | Add a custom client side test runner
| Python | apache-2.0 | Kitware/minerva,Kitware/minerva,Kitware/minerva | ---
+++
@@ -0,0 +1,20 @@
+from tests import web_client_test
+
+
+setUpModule = web_client_test.setUpModule
+tearDownModule = web_client_test.tearDownModule
+
+
+class WebClientTestCase(web_client_test.WebClientTestCase):
+
+ def setUp(self):
+ super(WebClientTestCase, self).setUp()
+
+ self.model('us... | |
e77957398f78f905c6b8ac881b621c67c1352d0a | py/target-sum.py | py/target-sum.py | from collections import Counter
class Solution(object):
def findTargetSumWays(self, nums, S):
"""
:type nums: List[int]
:type S: int
:rtype: int
"""
c = Counter()
c[0] = 1
for n in nums:
nc = Counter()
for k, v in c.iteritems():... | Add py solution for 494. Target Sum | Add py solution for 494. Target Sum
494. Target Sum: https://leetcode.com/problems/target-sum/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,18 @@
+from collections import Counter
+class Solution(object):
+ def findTargetSumWays(self, nums, S):
+ """
+ :type nums: List[int]
+ :type S: int
+ :rtype: int
+ """
+ c = Counter()
+ c[0] = 1
+ for n in nums:
+ nc = Counter()... | |
cbf29ea21179dcf3cf9c5f0a7eacd664f025f5db | tools/scripts/remove_package.py | tools/scripts/remove_package.py | import fnmatch
import os
import re
re_reference = re.compile(r'\<Reference Include=\"([\w\.]+)\,.*?\<\/Reference\>', re.DOTALL | re.MULTILINE)
def process_csproj(file, delete_package):
proj = open(file).read()
def repl(mo):
if mo.group(1) == delete_package:
return ""
else:
... | Add small utility for removing package references | Add small utility for removing package references
| Python | mit | SaladLab/Akka.Interfaced,SaladbowlCreative/Akka.Interfaced,SaladbowlCreative/Akka.Interfaced,SaladLab/Akka.Interfaced | ---
+++
@@ -0,0 +1,45 @@
+import fnmatch
+import os
+import re
+
+re_reference = re.compile(r'\<Reference Include=\"([\w\.]+)\,.*?\<\/Reference\>', re.DOTALL | re.MULTILINE)
+
+def process_csproj(file, delete_package):
+ proj = open(file).read()
+ def repl(mo):
+ if mo.group(1) == delete_package:
+ ... | |
f7fd11d657f10b2cb29000a29fcf839da6dea921 | test/python/topology/test2_submission_params.py | test/python/topology/test2_submission_params.py | # coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
from __future__ import print_function
import unittest
import sys
import itertools
from enum import IntEnum
import datetime
import decimal
import test_vers
from streamsx.topology.schema import StreamSchema
from streamsx.topology.topology ... | Add initial Python submission parameter test | Add initial Python submission parameter test
| Python | apache-2.0 | ddebrunner/streamsx.topology,ddebrunner/streamsx.topology,IBMStreams/streamsx.topology,ddebrunner/streamsx.topology,IBMStreams/streamsx.topology,ddebrunner/streamsx.topology,IBMStreams/streamsx.topology,ddebrunner/streamsx.topology,ddebrunner/streamsx.topology,ddebrunner/streamsx.topology,IBMStreams/streamsx.topology,I... | ---
+++
@@ -0,0 +1,56 @@
+# coding=utf-8
+# Licensed Materials - Property of IBM
+# Copyright IBM Corp. 2016
+from __future__ import print_function
+import unittest
+import sys
+import itertools
+from enum import IntEnum
+import datetime
+import decimal
+
+import test_vers
+
+from streamsx.topology.schema import Stre... | |
0fa5e9944d573d053633b1ea81497bc20598abee | CodeFights/longestWord.py | CodeFights/longestWord.py | #!/usr/local/bin/python
# Code Fights Longest Word Problem
import re
def longestWord(text):
m = re.findall(r'\b[a-z]+?\b', text, flags=re.I)
return max(m, key=len)
def main():
tests = [
["Ready, steady, go!", "steady"],
["Ready[[[, steady, go!", "steady"],
["ABCd", "ABCd"]
]... | Solve Code Fights longest word problem | Solve Code Fights longest word problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/local/bin/python
+# Code Fights Longest Word Problem
+
+import re
+
+
+def longestWord(text):
+ m = re.findall(r'\b[a-z]+?\b', text, flags=re.I)
+ return max(m, key=len)
+
+
+def main():
+ tests = [
+ ["Ready, steady, go!", "steady"],
+ ["Ready[[[, steady, go!",... | |
31b46f0ab99b945a97e3dd08d7e8d6a9a63ad75a | array/922.py | array/922.py | class Solution:
def sortArrayByParityII(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
if not A:
return A
size = len(A)
even = 0
odd = 1
while even < size - 1 and odd < size:
while even < size -... | Sort Array By Parity II | Sort Array By Parity II
| Python | apache-2.0 | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | ---
+++
@@ -0,0 +1,27 @@
+class Solution:
+ def sortArrayByParityII(self, A):
+ """
+ :type A: List[int]
+ :rtype: List[int]
+ """
+
+ if not A:
+ return A
+
+ size = len(A)
+ even = 0
+ odd = 1
+ while even < size - 1 and od... | |
eade3fa4f4d53574f359b9006b4d36b1bf428d49 | tests/pluginregistry.py | tests/pluginregistry.py | #!/usr/bin/env python2
import Cura.PluginRegistry
p = Cura.PluginRegistry.PluginRegistry()
p.addPluginLocation("plugins")
p._populateMetaData()
#p.loadPlugin("ExamplePlugin")
print(p.getMetaData("ExamplePlugin"))
| Add a tiny test application for testing the plugin registry | Add a tiny test application for testing the plugin registry
| Python | agpl-3.0 | onitake/Uranium,onitake/Uranium | ---
+++
@@ -0,0 +1,12 @@
+#!/usr/bin/env python2
+
+import Cura.PluginRegistry
+
+p = Cura.PluginRegistry.PluginRegistry()
+p.addPluginLocation("plugins")
+
+p._populateMetaData()
+#p.loadPlugin("ExamplePlugin")
+
+print(p.getMetaData("ExamplePlugin"))
+ | |
c6fbba9da9d1cf2a5a0007a56d192e267d19fcff | flexget/utils/database.py | flexget/utils/database.py | from flexget.manager import Session
def with_session(func):
""""Creates a session if one was not passed via keyword argument to the function"""
def wrapper(*args, **kwargs):
passed_session = kwargs.get('session')
if not passed_session:
session = Session(autoflush=True)
... | from flexget.manager import Session
def with_session(func):
""""Creates a session if one was not passed via keyword argument to the function"""
def wrapper(*args, **kwargs):
if not kwargs.get('session'):
kwargs['session'] = Session(autoflush=True)
try:
... | Fix with_session decorator for python 2.5 | Fix with_session decorator for python 2.5
git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1957 3942dd89-8c5d-46d7-aeed-044bccf3e60c
| Python | mit | vfrc2/Flexget,tobinjt/Flexget,Pretagonist/Flexget,oxc/Flexget,Danfocus/Flexget,jacobmetrick/Flexget,Flexget/Flexget,spencerjanssen/Flexget,ianstalk/Flexget,xfouloux/Flexget,malkavi/Flexget,asm0dey/Flexget,v17al/Flexget,camon/Flexget,ZefQ/Flexget,cvium/Flexget,jacobmetrick/Flexget,crawln45/Flexget,camon/Flexget,OmgOhnoe... | ---
+++
@@ -5,13 +5,12 @@
""""Creates a session if one was not passed via keyword argument to the function"""
def wrapper(*args, **kwargs):
- passed_session = kwargs.get('session')
- if not passed_session:
- session = Session(autoflush=True)
+ if not kwargs.get('session'):
... |
544857a7a3cdb40fd793fed8e33694d551cc695f | pomodoro_calculator/main.py | pomodoro_calculator/main.py | """Calculate the number of Pomodori available within a time period.
Usage:
get-pomodori [--from=<time>] [--break=<minutes>] [--long-break=<minutes>] <end-time>
get-pomodori (-h | --help | --version)
Options:
--version show program's version number and exit.
-h, --help show t... | Add initial version of the commandline tool | Add initial version of the commandline tool
| Python | mit | Matt-Deacalion/Pomodoro-Calculator | ---
+++
@@ -0,0 +1,21 @@
+"""Calculate the number of Pomodori available within a time period.
+
+Usage:
+ get-pomodori [--from=<time>] [--break=<minutes>] [--long-break=<minutes>] <end-time>
+ get-pomodori (-h | --help | --version)
+
+Options:
+ --version show program's version number and exit.
+... | |
08573c7c6eb20c7cf168d38a6566757b08fed6d9 | python/opencv/opencv_2/videos/capture_video_from_camera.py | python/opencv/opencv_2/videos/capture_video_from_camera.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
"""
OpenCV - Read image: read an image given in arguments
Required: opencv library (Debian: aptitude install python-opencv)
See: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_vid... | Add a snippet (Python OpenCV). | Add a snippet (Python OpenCV).
| Python | mit | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
+
+"""
+OpenCV - Read image: read an image given in arguments
+
+Required: opencv library (Debian: aptitude install python-opencv)
+
+See: https://opencv-python-tutroals.readthedocs.or... | |
e0d631b4aab431c31689ccd7aa6ac92d95e32e80 | tests/test_frontend.py | tests/test_frontend.py | import os
from tvrenamr.cli import helpers
from .base import BaseTest
class TestFrontEnd(BaseTest):
def setup(self):
super(TestFrontEnd, self).setup()
self.config = helpers.get_config()
def test_passing_current_dir_makes_file_list_a_list(self):
assert isinstance(helpers.build_file_l... | import collections
import os
import sys
from tvrenamr.cli import helpers
from .utils import random_files
def test_passing_current_dir_makes_file_list_a_list(files):
file_list = helpers.build_file_list([files])
assert isinstance(file_list, collections.Iterable)
PY3 = sys.version_info[0] == 3
string... | Move to function only tests & fix test for generator based build_file_list | Move to function only tests & fix test for generator based build_file_list
build_file_list is a generator now so we need to make sure it returns an
iterable but not a string.
| Python | mit | wintersandroid/tvrenamr,ghickman/tvrenamr | ---
+++
@@ -1,36 +1,42 @@
+import collections
import os
+import sys
from tvrenamr.cli import helpers
-from .base import BaseTest
+from .utils import random_files
-class TestFrontEnd(BaseTest):
- def setup(self):
- super(TestFrontEnd, self).setup()
- self.config = helpers.get_config()
+def t... |
d47d7931f5531c4fe28598d15c305592e446af2b | tests/test_settings.py | tests/test_settings.py |
def test_settings_group(plex):
assert plex.settings.group('general')
def test_settings_get(plex):
# This is the value since it we havnt set any friendlyname
# plex just default to computer name but it NOT in the settings.
assert plex.settings.get('FriendlyName').value == ''
def test_settings_get(pl... | Add some test for settings. TODO fix save. | Add some test for settings. TODO fix save.
| Python | bsd-3-clause | pkkid/python-plexapi,mjs7231/python-plexapi | ---
+++
@@ -0,0 +1,17 @@
+
+def test_settings_group(plex):
+ assert plex.settings.group('general')
+
+
+def test_settings_get(plex):
+ # This is the value since it we havnt set any friendlyname
+ # plex just default to computer name but it NOT in the settings.
+ assert plex.settings.get('FriendlyName').va... | |
0db38995d9cb7733d5dcc7bd88234c4a356fc9fb | util/merge_coop_nwsli.py | util/merge_coop_nwsli.py | # Need to check the log files for shef parser and create new sites
# within database based on what we find
import re, iemdb, os
MESOSITE = iemdb.connect('mesosite', bypass=False)
# Load up our database
sites = {}
for line in open('coop_nwsli.txt'):
tokens = line.split("|")
if len(tokens) < 9:
contin... | Add tool for adding COOP IDs | Add tool for adding COOP IDs
| Python | mit | akrherz/pyWWA,akrherz/pyWWA | ---
+++
@@ -0,0 +1,51 @@
+# Need to check the log files for shef parser and create new sites
+# within database based on what we find
+
+import re, iemdb, os
+MESOSITE = iemdb.connect('mesosite', bypass=False)
+
+
+# Load up our database
+sites = {}
+for line in open('coop_nwsli.txt'):
+ tokens = line.split("|")
... | |
fd9547f088b2ed15c289235c329be04590689855 | host-test/stateless-test.py | host-test/stateless-test.py | import json
import subprocess
import struct
import sys
import unittest
import uuid
exe = None
# The protocol datagram is described here:
# https://developer.chrome.com/extensions/nativeMessaging#native-messaging-host-protocol
#
# The protocol itself is described here:
# https://github.com/open-eid/chrome-token-signin... | Add foundation for native component testing | Add foundation for native component testing
| Python | lgpl-2.1 | metsma/chrome-token-signing,cristiano-andrade/chrome-token-signing,fabiorusso/chrome-token-signing,open-eid/chrome-token-signing,open-eid/chrome-token-signing,fabiorusso/chrome-token-signing,open-eid/chrome-token-signing,open-eid/chrome-token-signing,metsma/chrome-token-signing,fabiorusso/chrome-token-signing,metsma/ch... | ---
+++
@@ -0,0 +1,76 @@
+import json
+import subprocess
+import struct
+import sys
+import unittest
+import uuid
+
+exe = None
+
+# The protocol datagram is described here:
+# https://developer.chrome.com/extensions/nativeMessaging#native-messaging-host-protocol
+#
+# The protocol itself is described here:
+# https:... | |
333ae389c14593421d01bd0c8f6904d1688dfa7e | ixxy_admin_utils/dashboard_modules.py | ixxy_admin_utils/dashboard_modules.py | from admin_tools.dashboard.modules import LinkList
from django.core.urlresolvers import reverse
from linkcheck.views import get_status_message
class PermCheckingLinkList(LinkList):
def __init__(self, title=None, **kwargs):
self.required_perms = kwargs.pop('required_perms', [])
super(PermCheckingL... | Add our custom dashboard modules | Add our custom dashboard modules
| Python | mit | DjangoAdminHackers/ixxy-admin-utils,DjangoAdminHackers/ixxy-admin-utils | ---
+++
@@ -0,0 +1,46 @@
+from admin_tools.dashboard.modules import LinkList
+from django.core.urlresolvers import reverse
+from linkcheck.views import get_status_message
+
+
+class PermCheckingLinkList(LinkList):
+
+ def __init__(self, title=None, **kwargs):
+ self.required_perms = kwargs.pop('required_per... | |
62ec4eca706bbb521d02ec597c0c18a949b37e52 | sysctl/tests/test_sysctl_setvalue.py | sysctl/tests/test_sysctl_setvalue.py | import os
import sysctl
from sysctl.tests import SysctlTestBase
class TestSysctlANum(SysctlTestBase):
def test_sysctl_setvalue(self):
dummy = sysctl.filter('kern.dummy')[0]
try:
self.command("/sbin/sysctl kern.dummy=0")
except:
if os.getuid() == 0:
... | Add test to set a sysctl value | Add test to set a sysctl value
| Python | bsd-2-clause | williambr/py-sysctl,williambr/py-sysctl | ---
+++
@@ -0,0 +1,25 @@
+import os
+import sysctl
+from sysctl.tests import SysctlTestBase
+
+
+class TestSysctlANum(SysctlTestBase):
+
+ def test_sysctl_setvalue(self):
+ dummy = sysctl.filter('kern.dummy')[0]
+ try:
+ self.command("/sbin/sysctl kern.dummy=0")
+ except:
+ ... | |
490d5110b46afe5210bf2da4489854561e1bb259 | bsd2/vagrant-ansible/provisioning/getrstudio.py | bsd2/vagrant-ansible/provisioning/getrstudio.py | #!/usr/bin/python
#
# RStudio does not provide a "-latest" download link so we deduce it from
# their S3 bucket listing and save the download to /tmp/rstudio-latest.deb.
#
# Test this script by running:
# wget -O /tmp/somefile.xml http://download1.rstudio.org
# python thisscript.py /tmp/somefile.xml
import sys
import ... | Add a utility to retrieve the latest version of RStudio. | Add a utility to retrieve the latest version of RStudio.
| Python | apache-2.0 | dlab-berkeley/collaboratool-archive,dlab-berkeley/collaboratool-archive,dlab-berkeley/collaboratool-archive,dlab-berkeley/collaboratool-archive,dlab-berkeley/collaboratool-archive | ---
+++
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+#
+# RStudio does not provide a "-latest" download link so we deduce it from
+# their S3 bucket listing and save the download to /tmp/rstudio-latest.deb.
+#
+# Test this script by running:
+# wget -O /tmp/somefile.xml http://download1.rstudio.org
+# python thisscript.py /t... | |
30e33acc50725ea5f8bb4a094e60dbeadaa6d1f8 | CodeFights/cyclicName.py | CodeFights/cyclicName.py | #!/usr/local/bin/python
# Code Fights Cyclic Name Problem
from itertools import cycle
def cyclicName(name, n):
gen = cycle(name)
res = [next(gen) for _ in range(n)]
return ''.join(res)
def main():
tests = [
["nicecoder", 15, "nicecoderniceco"],
["codefights", 50, "codefightscodefigh... | Solve Code Fights cyclic name problem | Solve Code Fights cyclic name problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/local/bin/python
+# Code Fights Cyclic Name Problem
+
+from itertools import cycle
+
+
+def cyclicName(name, n):
+ gen = cycle(name)
+ res = [next(gen) for _ in range(n)]
+ return ''.join(res)
+
+
+def main():
+ tests = [
+ ["nicecoder", 15, "nicecoderniceco"],
+ ... | |
92c8b146783c807b143a60419efd88f2da11d065 | gaphor/C4Model/tests/test_propertypages.py | gaphor/C4Model/tests/test_propertypages.py | from gaphor import C4Model
from gaphor.C4Model.propertypages import DescriptionPropertyPage, TechnologyPropertyPage
from gaphor.diagram.tests.fixtures import find
def test_description_property_page(element_factory):
subject = element_factory.create(C4Model.c4model.C4Container)
property_page = DescriptionPrope... | Add tests for C4 model property pages | Add tests for C4 model property pages
| Python | lgpl-2.1 | amolenaar/gaphor,amolenaar/gaphor | ---
+++
@@ -0,0 +1,25 @@
+from gaphor import C4Model
+from gaphor.C4Model.propertypages import DescriptionPropertyPage, TechnologyPropertyPage
+from gaphor.diagram.tests.fixtures import find
+
+
+def test_description_property_page(element_factory):
+ subject = element_factory.create(C4Model.c4model.C4Container)
+ ... | |
1c4429759a3e89ed952b1a025b1470a9e187537f | tests/test_spatial_reference.py | tests/test_spatial_reference.py | # -*- coding: utf-8 -*-
import rasterio
import pytest
from math import pi
from numpy import array
from numpy.testing import assert_array_almost_equal
from gdal2mbtiles.constants import EPSG_WEB_MERCATOR
from gdal2mbtiles.gdal import SpatialReference
# SEMI_MAJOR is a constant referring to the WGS84 Semi Major Ax... | Add test for the EPSG-3857 spatial reference. | Add test for the EPSG-3857 spatial reference.
| Python | apache-2.0 | ecometrica/gdal2mbtiles | ---
+++
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+
+
+import rasterio
+import pytest
+from math import pi
+
+from numpy import array
+from numpy.testing import assert_array_almost_equal
+
+from gdal2mbtiles.constants import EPSG_WEB_MERCATOR
+
+from gdal2mbtiles.gdal import SpatialReference
+
+
+# SEMI_MAJOR is a co... | |
0d92340f2b1cab932f14e376dc776a7c11e3e42f | tests/batch_fetch/test_generic_relationship.py | tests/batch_fetch/test_generic_relationship.py | from __future__ import unicode_literals
import sqlalchemy as sa
from tests import TestCase
from sqlalchemy_utils import batch_fetch, generic_relationship
class TestBatchFetchGenericRelationship(TestCase):
def create_models(self):
class Building(self.Base):
__tablename__ = 'building'
... | Add tests for generic relationship batch fetching | Add tests for generic relationship batch fetching
| Python | bsd-3-clause | konstantinoskostis/sqlalchemy-utils,tonyseek/sqlalchemy-utils,joshfriend/sqlalchemy-utils,cheungpat/sqlalchemy-utils,tonyseek/sqlalchemy-utils,joshfriend/sqlalchemy-utils,spoqa/sqlalchemy-utils,rmoorman/sqlalchemy-utils,marrybird/sqlalchemy-utils,JackWink/sqlalchemy-utils | ---
+++
@@ -0,0 +1,44 @@
+from __future__ import unicode_literals
+import sqlalchemy as sa
+from tests import TestCase
+from sqlalchemy_utils import batch_fetch, generic_relationship
+
+
+class TestBatchFetchGenericRelationship(TestCase):
+ def create_models(self):
+ class Building(self.Base):
+ ... | |
fb3766204cbb25ccf8ee73ab4f480ba34251542c | nagios/check_hads_ingest.py | nagios/check_hads_ingest.py | """
Check how much HADSA data we have
"""
import os
import sys
import stat
import iemdb
HADS = iemdb.connect('iem', bypass=True)
hcursor = HADS.cursor()
def check():
hcursor.execute("""SELECT count(*) from current_shef
WHERE valid > now() - '1 hour'::interval""")
row = hcursor.fetchone()
return row[... | Add check on HADS ingest | Add check on HADS ingest | Python | mit | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | ---
+++
@@ -0,0 +1,28 @@
+"""
+ Check how much HADSA data we have
+"""
+import os
+import sys
+import stat
+import iemdb
+HADS = iemdb.connect('iem', bypass=True)
+hcursor = HADS.cursor()
+
+def check():
+ hcursor.execute("""SELECT count(*) from current_shef
+ WHERE valid > now() - '1 hour'::interval""")
+ ... | |
a7529057f590f8b5185a77b3ff62889b1357a0e7 | data/word_embeddings/create_graph_from_corpus.py | data/word_embeddings/create_graph_from_corpus.py | from __future__ import print_function
import sys
from random import shuffle
DISTANCE = 10
with open(sys.argv[1], 'r') as corpus:
text = corpus.read()
text = text[:1000000]
words_list = list(set(text.split()))
word_to_id = {}
# Write word id mappings
for index, word in enumerate(list(set(word... | Add w2v create graph from corpus | Add w2v create graph from corpus
| Python | apache-2.0 | agnusmaximus/cyclades,agnusmaximus/cyclades,agnusmaximus/cyclades,agnusmaximus/cyclades | ---
+++
@@ -0,0 +1,46 @@
+from __future__ import print_function
+import sys
+from random import shuffle
+
+DISTANCE = 10
+
+with open(sys.argv[1], 'r') as corpus:
+ text = corpus.read()
+ text = text[:1000000]
+
+ words_list = list(set(text.split()))
+ word_to_id = {}
+
+ # Write word id mappings
+ ... | |
bcb73da9d30d6737fdbdb4ba2378a612851ec9b9 | lc0336_palindrome_pairs.py | lc0336_palindrome_pairs.py | """336. Palindrome Pairs
Hard
URL: https://leetcode.com/problems/palindrome-pairs/
Given a list of unique words, find all pairs of distinct indices (i, j) in the given
list, so that the concatenation of the two words, i.e. words[i] + words[j] is a
palindrome.
Example 1:
Input: ["abcd","dcba","lls","s","sssll"]
Outpu... | Complete word idx dict + prefix/suffix pal sol | Complete word idx dict + prefix/suffix pal sol
| Python | bsd-2-clause | bowen0701/algorithms_data_structures | ---
+++
@@ -0,0 +1,82 @@
+"""336. Palindrome Pairs
+Hard
+
+URL: https://leetcode.com/problems/palindrome-pairs/
+
+Given a list of unique words, find all pairs of distinct indices (i, j) in the given
+list, so that the concatenation of the two words, i.e. words[i] + words[j] is a
+palindrome.
+
+Example 1:
+Input: [... | |
74dab4e4e7c87e247659bff6cfd4e333b7cd71f7 | chapter03/triangleArea.py | chapter03/triangleArea.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
print 'Insert one points, separated with commas: '
xy = input('Insert first point: ')
x2y2 = input('Insert second point: ')
def substractVectors(a, b):
return (a[0] - b[0], a[1] - b[1])
def normalize(x, y):
return math.sqrt(x**2 + y**2)
print normalize(... | Add normalize and Vector substraction functions | Add normalize and Vector substraction functions
| Python | apache-2.0 | MindCookin/python-exercises | ---
+++
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import math
+
+print 'Insert one points, separated with commas: '
+xy = input('Insert first point: ')
+x2y2 = input('Insert second point: ')
+
+def substractVectors(a, b):
+ return (a[0] - b[0], a[1] - b[1])
+
+def normalize(x, y):
+ return... | |
e21d3a1da1d20a341ae165c0fa3605248744ce7e | altair/examples/cumulative_count_chart.py | altair/examples/cumulative_count_chart.py | """
Cumulative Count Chart
----------------------
This example shows an area chart with cumulative count.
Adapted from https://vega.github.io/vega-lite/examples/area_cumulative_freq.html
"""
# category: area charts
import altair as alt
from vega_datasets import data
source = data.movies.url
alt.Chart(source).transf... | Add example - Cumulative count | Add example - Cumulative count
| Python | bsd-3-clause | altair-viz/altair,jakevdp/altair | ---
+++
@@ -0,0 +1,21 @@
+"""
+Cumulative Count Chart
+----------------------
+This example shows an area chart with cumulative count.
+Adapted from https://vega.github.io/vega-lite/examples/area_cumulative_freq.html
+
+"""
+# category: area charts
+
+import altair as alt
+from vega_datasets import data
+
+source = d... | |
1a1a8c00e3dc4101be78a69b3bae7d27fbb51b39 | ghpythonremote/examples/CPython_to_GH_manual.py | ghpythonremote/examples/CPython_to_GH_manual.py | import rpyc
c = rpyc.utils.factory.connect(
"localhost",
18871,
service=rpyc.core.service.ClassicService,
config={"sync_request_timeout": None},
ipv6=False,
keepalive=True,
)
rghcomp = c.root.get_component
rgh = c
Rhino = rgh.modules.Rhino
rs = rgh.modules.rhinoscriptsyntax
readopt = Rhino.Fi... | Add a debugging file connecting Python to GH | Add a debugging file connecting Python to GH
| Python | mit | pilcru/ghpythonremote,Digital-Structures/ghpythonremote | ---
+++
@@ -0,0 +1,61 @@
+import rpyc
+
+c = rpyc.utils.factory.connect(
+ "localhost",
+ 18871,
+ service=rpyc.core.service.ClassicService,
+ config={"sync_request_timeout": None},
+ ipv6=False,
+ keepalive=True,
+)
+
+rghcomp = c.root.get_component
+rgh = c
+Rhino = rgh.modules.Rhino
+rs = rgh.mod... | |
d9db8056450528f10b9bfaa9f6226486108ac37d | creation/lib/cgWConsts.py | creation/lib/cgWConsts.py | ####################################
#
# Keep all the constants used to
# create glidein entries in this
# module
#
# Author: Igor Sfiligoi
#
####################################
import time
start_time_tuple=time.localtime()
TIMESTR=(string.printable[start_time_tuple[0]-2000]+ #year, will work until ~2060
st... | Put constants into a dedicated module | Put constants into a dedicated module
| Python | bsd-3-clause | bbockelm/glideinWMS,holzman/glideinwms-old,holzman/glideinwms-old,bbockelm/glideinWMS,bbockelm/glideinWMS,bbockelm/glideinWMS,holzman/glideinwms-old | ---
+++
@@ -0,0 +1,65 @@
+####################################
+#
+# Keep all the constants used to
+# create glidein entries in this
+# module
+#
+# Author: Igor Sfiligoi
+#
+####################################
+
+import time
+
+start_time_tuple=time.localtime()
+TIMESTR=(string.printable[start_time_tuple[0]-2000]+... | |
3756fa9cef258e91ebd8d344f6773cfc2ac537dd | benchmarks/bench_misc.py | benchmarks/bench_misc.py | """
Miscellaneous benchmarks.
"""
import subprocess
import sys
import time
from numba import jit
class InitializationTime:
# Measure wall clock time, not CPU time of calling process
timer = time.time
number = 1
repeat = 10
def time_new_process_import_numba(self):
subprocess.check_call([... | Add a benchmark of import time | Add a benchmark of import time
| Python | bsd-2-clause | numba/numba-benchmark,gmarkall/numba-benchmark | ---
+++
@@ -0,0 +1,19 @@
+"""
+Miscellaneous benchmarks.
+"""
+
+import subprocess
+import sys
+import time
+
+from numba import jit
+
+
+class InitializationTime:
+ # Measure wall clock time, not CPU time of calling process
+ timer = time.time
+ number = 1
+ repeat = 10
+
+ def time_new_process_import... | |
39039b8a6584984d6778b271a4b9c8a181198cd3 | corehq/apps/hqcase/tests/test_bulk.py | corehq/apps/hqcase/tests/test_bulk.py | import uuid
from unittest import mock
from django.test import TestCase
from casexml.apps.case.mock import CaseBlock
from corehq.apps.hqcase.bulk import CaseBulkDB
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from corehq.form_processor.models import XFormInstance
from corehq.form_processor.t... | Add basic test for CaseBulkDB | Add basic test for CaseBulkDB
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,36 @@
+import uuid
+from unittest import mock
+
+from django.test import TestCase
+
+from casexml.apps.case.mock import CaseBlock
+
+from corehq.apps.hqcase.bulk import CaseBulkDB
+from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
+from corehq.form_processor.models import XForm... | |
e3845e03ea1f3dd393cd077f7c2b3d2ce31b86a9 | mysite/scripts/remove_numbers_from_locations.py | mysite/scripts/remove_numbers_from_locations.py | import re
import mysite
Person = mysite.profile.models.Person
people_with_weird_locations = Person.objects.filter(location_display_name__regex=', [0-9][0-9],')
for p in people_with_weird_locations:
location_pieces = re.split(r', \d\d', p.location_display_name)
unweirded_location = "".join(location_pieces)
... | Add script to remove unnecessary numbers from people's locations. | Add script to remove unnecessary numbers from people's locations.
| Python | agpl-3.0 | SnappleCap/oh-mainline,ehashman/oh-mainline,mzdaniel/oh-mainline,jledbetter/openhatch,sudheesh001/oh-mainline,openhatch/oh-mainline,jledbetter/openhatch,SnappleCap/oh-mainline,openhatch/oh-mainline,ehashman/oh-mainline,waseem18/oh-mainline,vipul-sharma20/oh-mainline,jledbetter/openhatch,ojengwa/oh-mainline,waseem18/oh-... | ---
+++
@@ -0,0 +1,11 @@
+import re
+import mysite
+Person = mysite.profile.models.Person
+
+people_with_weird_locations = Person.objects.filter(location_display_name__regex=', [0-9][0-9],')
+
+for p in people_with_weird_locations:
+ location_pieces = re.split(r', \d\d', p.location_display_name)
+ unweirded_loc... | |
642b777f5eabc02abd54208e3895c0b1898401db | edit-cosine-cluster.py | edit-cosine-cluster.py | #!/usr/bin/env python2.7
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "... | Convert csv to json for clusters | Convert csv to json for clusters
Convert csv to json for cluster-d3.html(or dynamic-cluster.html) | Python | apache-2.0 | YongchaoShang/tika-img-similarity,chrismattmann/tika-similarity,harsham05/tika-similarity,chrismattmann/tika-similarity,chrismattmann/tika-img-similarity,YongchaoShang/tika-img-similarity,harsham05/tika-similarity,chrismattmann/tika-img-similarity | ---
+++
@@ -0,0 +1,64 @@
+#!/usr/bin/env python2.7
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apa... | |
6fb6829c6ac0f755b468393042f538c5073c76ff | tools/rename_by_timestamp/rename_by_timestamp.py | tools/rename_by_timestamp/rename_by_timestamp.py | import os, os.path
import shutil
from datetime import datetime
import sys
def do_folder(src_folder):
assert os.path.isdir(src_folder)
dst_folder = os.path.join(src_folder, 'timestamp_prefixed')
print 'Input dir: %s'%src_folder
print 'Output dir: %s'%dst_folder
if not os.path.exists(dst_folder):
... | Add script to create copies of PNG files w/ filenames prefixed with their creation time (Windows only) | Add script to create copies of PNG files w/ filenames prefixed with their creation time (Windows only)
| Python | mit | joymachinegames/joymachine-public,joymachinegames/joymachine-public,joymachinegames/joymachine-public,joymachinegames/joymachine-public,joymachinegames/joymachine-public,joymachinegames/joymachine-public | ---
+++
@@ -0,0 +1,31 @@
+import os, os.path
+import shutil
+from datetime import datetime
+import sys
+
+def do_folder(src_folder):
+ assert os.path.isdir(src_folder)
+ dst_folder = os.path.join(src_folder, 'timestamp_prefixed')
+ print 'Input dir: %s'%src_folder
+ print 'Output dir: %s'%dst_folder
+ ... | |
1b971b32d57df48919e0c45372237d858996e3d9 | tests/test_gmeu/test_a_C.py | tests/test_gmeu/test_a_C.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test GMEU entry 'a', part C.
This entry is about pronunciation of the word 'a' and is unlikely to be
relevant to usage in written language.
"""
| Add test for GMEU entry "a", part C | Add test for GMEU entry "a", part C
| Python | bsd-3-clause | amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint | ---
+++
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Test GMEU entry 'a', part C.
+
+This entry is about pronunciation of the word 'a' and is unlikely to be
+relevant to usage in written language.
+""" | |
cea54800ae2ac13b830984aa368125faf02ba429 | examples/cli_object.py | examples/cli_object.py | import hug
@hug.cli_object(name='git', version='1.0.0')
class GIT(object):
"""An example of command like calls via an Object"""
@hug.cli_object()
def push(self, branch='master'):
return 'Pushing {}'.format(branch)
@hug.cli_object()
def pull(self, branch='master'):
return 'Pulling... | Add example for CLI object | Add example for CLI object
| Python | mit | MuhammadAlkarouri/hug,timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug | ---
+++
@@ -0,0 +1,18 @@
+import hug
+
+
+@hug.cli_object(name='git', version='1.0.0')
+class GIT(object):
+ """An example of command like calls via an Object"""
+
+ @hug.cli_object()
+ def push(self, branch='master'):
+ return 'Pushing {}'.format(branch)
+
+ @hug.cli_object()
+ def pull(self, b... | |
fd48746e8d1d2d94a7453a4a976ffbf362711f63 | tools/setbyte.py | tools/setbyte.py | #!/usr/bin/env python3
import sys
import ast
try:
file_name, location, new_byte = sys.argv[1:]
except:
print("Usage: ./{} file location newbyte".format(sys.argv[0]))
sys.exit(1)
addr = int(ast.literal_eval(location))
byte = int(ast.literal_eval(new_byte))
assert 0 <= addr
assert 0 <= byte < 2**8
with op... | Add new tool to set bytes in file | Add new tool to set bytes in file
| Python | mit | Dentosal/rust_os,Dentosal/rust_os,Dentosal/rust_os | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+import sys
+import ast
+
+try:
+ file_name, location, new_byte = sys.argv[1:]
+except:
+ print("Usage: ./{} file location newbyte".format(sys.argv[0]))
+ sys.exit(1)
+
+addr = int(ast.literal_eval(location))
+byte = int(ast.literal_eval(new_byte))
+
+assert 0... | |
47c4043dfecd95686b1520c93717fa4c512c4e74 | tlsenum/hello_constructs.py | tlsenum/hello_constructs.py | from construct import Array, Bytes, Struct, UBInt16, UBInt32, UBInt8
ProtocolVersion = Struct(
"version",
UBInt8("major"),
UBInt8("minor")
)
Random = Struct(
"random",
UBInt32("gmt_unix_time"),
Bytes("random_bytes", 28)
)
SessionID = Struct(
"session_id",
UBInt8("length"),
Bytes(... | Add tentative construct format for ClientHello messages. | Add tentative construct format for ClientHello messages.
| Python | mit | Ayrx/tlsenum,Ayrx/tlsenum | ---
+++
@@ -0,0 +1,43 @@
+from construct import Array, Bytes, Struct, UBInt16, UBInt32, UBInt8
+
+
+ProtocolVersion = Struct(
+ "version",
+ UBInt8("major"),
+ UBInt8("minor")
+)
+
+Random = Struct(
+ "random",
+ UBInt32("gmt_unix_time"),
+ Bytes("random_bytes", 28)
+)
+
+SessionID = Struct(
+ "s... | |
5a12137c3e766451d83e6598ba93d16e0a8cbde8 | tests/basics/subclass-native3.py | tests/basics/subclass-native3.py | class MyExc(Exception):
pass
e = MyExc(100, "Some error")
print(e)
# TODO: Prints native base class name
#print(repr(e))
print(e.args)
| Add test for accessing attribute of inherited native type. | tests: Add test for accessing attribute of inherited native type.
| Python | mit | noahchense/micropython,matthewelse/micropython,micropython/micropython-esp32,Vogtinator/micropython,danicampora/micropython,adafruit/micropython,warner83/micropython,emfcamp/micropython,MrSurly/micropython-esp32,noahwilliamsson/micropython,mpalomer/micropython,kostyll/micropython,EcmaXp/micropython,drrk/micropython,MrS... | ---
+++
@@ -0,0 +1,8 @@
+class MyExc(Exception):
+ pass
+
+e = MyExc(100, "Some error")
+print(e)
+# TODO: Prints native base class name
+#print(repr(e))
+print(e.args) | |
c963310123765baddf638c8d08b8fdb2f73b6ba6 | tests/basics/subclass-native4.py | tests/basics/subclass-native4.py | # Test calling non-special method inherited from native type
class mylist(list):
pass
l = mylist([1, 2, 3])
print(l)
l.append(10)
print(l)
| Add test for calling inherited native method on subclass. | tests: Add test for calling inherited native method on subclass.
| Python | mit | drrk/micropython,ryannathans/micropython,MrSurly/micropython-esp32,warner83/micropython,redbear/micropython,noahchense/micropython,AriZuu/micropython,martinribelotta/micropython,toolmacher/micropython,martinribelotta/micropython,jlillest/micropython,oopy/micropython,feilongfl/micropython,mhoffma/micropython,vitiral/mic... | ---
+++
@@ -0,0 +1,9 @@
+# Test calling non-special method inherited from native type
+
+class mylist(list):
+ pass
+
+l = mylist([1, 2, 3])
+print(l)
+l.append(10)
+print(l) | |
15a655e490b0f0d035edd4f772f126146959e531 | examples/plot_dom_hits.py | examples/plot_dom_hits.py | """
==================
DOM hits.
==================
This example shows how to create DOM hits statistics to estimate track
distances.
"""
from collections import defaultdict, Counter
import km3pipe as kp
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from km3modules impor... | Add example to show how to create dom hit statistics | Add example to show how to create dom hit statistics
| Python | mit | tamasgal/km3pipe,tamasgal/km3pipe | ---
+++
@@ -0,0 +1,76 @@
+"""
+==================
+DOM hits.
+==================
+
+This example shows how to create DOM hits statistics to estimate track
+distances.
+"""
+
+from collections import defaultdict, Counter
+
+import km3pipe as kp
+import pandas as pd
+
+import matplotlib.pyplot as plt
+from matplotlib.c... | |
b3cbf179371c289121126d0cb66d9873d740f202 | utils/helpers.py | utils/helpers.py | from django.http import HttpResponseNotAllowed
def post_only(func):
def decorated(request, *args, **kwargs):
if request.method != 'POST':
return HttpResponseNotAllowed(['GET'])
return func(request, *args, **kwargs)
return decorated
def get_only(func):
def decorated(request, *ar... | Add post_only and get_only decorators | Add post_only and get_only decorators
| Python | apache-2.0 | Nikola-K/django_reddit,Nikola-K/django_reddit,Nikola-K/django_reddit | ---
+++
@@ -0,0 +1,15 @@
+from django.http import HttpResponseNotAllowed
+
+def post_only(func):
+ def decorated(request, *args, **kwargs):
+ if request.method != 'POST':
+ return HttpResponseNotAllowed(['GET'])
+ return func(request, *args, **kwargs)
+ return decorated
+
+def get_only(... | |
c5723be490b5baf953de71a6af778fe5663c70ed | scripts/slave/recipe_modules/raw_io/test_api.py | scripts/slave/recipe_modules/raw_io/test_api.py | from slave import recipe_test_api
class RawIOTestApi(recipe_test_api.RecipeTestApi): # pragma: no cover
@recipe_test_api.placeholder_step_data
@staticmethod
def output(data, retcode=None):
return data, retcode
| Add the API available inside GenTests method for the raw_io module. | Add the API available inside GenTests method for the raw_io module.
This CL makes the raw_io module ready to have its output mocked
in GenTests.
R=agable@chromium.org
Review URL: https://codereview.chromium.org/160143003
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@250773 0039d316-1c4b-4281-b951-d872f2087c9... | Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | ---
+++
@@ -0,0 +1,7 @@
+from slave import recipe_test_api
+
+class RawIOTestApi(recipe_test_api.RecipeTestApi): # pragma: no cover
+ @recipe_test_api.placeholder_step_data
+ @staticmethod
+ def output(data, retcode=None):
+ return data, retcode | |
f93a801a7951f2ee1a59b536608e13928aa60102 | yithlibraryserver/scripts/tests/test_createdb.py | yithlibraryserver/scripts/tests/test_createdb.py | # Yith Library Server is a password storage server.
# Copyright (C) 2015 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of Yith Library Server.
#
# Yith Library Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publ... | Add simple test for the createdb script | Add simple test for the createdb script
| Python | agpl-3.0 | lorenzogil/yith-library-server,lorenzogil/yith-library-server,lorenzogil/yith-library-server | ---
+++
@@ -0,0 +1,60 @@
+# Yith Library Server is a password storage server.
+# Copyright (C) 2015 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
+#
+# This file is part of Yith Library Server.
+#
+# Yith Library Server is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Aff... | |
836f23046a25edbdeafcbe487fa9f918a9bae5cb | Sketches/JT/Jam/application/trunk/setup_py2exe.py | Sketches/JT/Jam/application/trunk/setup_py2exe.py | #!/usr/bin/env python
#
# (C) 2008 British Broadcasting Corporation and Kamaelia Contributors(1)
# All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesser General Pub... | Add py2exe setup file for creating windows executables | Add py2exe setup file for creating windows executables
| Python | apache-2.0 | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+#
+# (C) 2008 British Broadcasting Corporation and Kamaelia Contributors(1)
+# All Rights Reserved.
+#
+# You may only modify and redistribute this under the terms of any of the
+# following licenses(2): Mozilla Public License, V1.1, GNU General
+# Public License, ... | |
fecbaf30cadcf02b44f920116edea3c5de94ba4e | crackingcointsolutions/chapter4/exercisethree.py | crackingcointsolutions/chapter4/exercisethree.py | '''
Created on 30 Aug 2017
@author: igoroya
'''
import collections
from chapter4 import utils
def make_lists(root_node):
stack = collections.deque()
node_i = 1
lists = []
node = root_node
stack.append(node)
while len(stack) > 0:
node = stack.pop()
add_list(lists, node_i, nod... | Add solution for exercise 4.3 | Add solution for exercise 4.3 | Python | mit | igoroya/igor-oya-solutions-cracking-coding-interview | ---
+++
@@ -0,0 +1,67 @@
+'''
+Created on 30 Aug 2017
+
+@author: igoroya
+'''
+import collections
+from chapter4 import utils
+
+def make_lists(root_node):
+ stack = collections.deque()
+
+ node_i = 1
+ lists = []
+
+ node = root_node
+ stack.append(node)
+
+ while len(stack) > 0:
+ node = s... | |
fad392fd67aa858f92659ab94ca1c190898d4951 | add_csp_header.py | add_csp_header.py | # Burp extension to add CSP headers to responses
__author__ = 'jay.kelath'
# setup Imports
from burp import IBurpExtender
from burp import IHttpListener
from burp import IHttpRequestResponse
from burp import IResponseInfo
# Class BurpExtender (Required) contaning all functions used to interact with Burp Suite API
cla... | Add a header to burp response | Add a header to burp response | Python | mit | kelath/Burp-Extensions | ---
+++
@@ -0,0 +1,38 @@
+# Burp extension to add CSP headers to responses
+__author__ = 'jay.kelath'
+
+# setup Imports
+from burp import IBurpExtender
+from burp import IHttpListener
+from burp import IHttpRequestResponse
+from burp import IResponseInfo
+
+# Class BurpExtender (Required) contaning all functions use... | |
e142d7ec83d9b5896a741a84ff5148f300254d89 | test/util/test_cubic_interpolation.py | test/util/test_cubic_interpolation.py | import torch
from gpytorch.utils.interpolation import Interpolation
from gpytorch import utils
def test_interpolation():
x = torch.linspace(0.01, 1, 100)
grid = torch.linspace(-0.05, 1.05, 50)
J, C = Interpolation().interpolate(grid, x)
W = utils.index_coef_to_sparse(J, C, len(grid))
test_func_gri... | Add basic unit test for cubic interpolation | Add basic unit test for cubic interpolation
| Python | mit | jrg365/gpytorch,jrg365/gpytorch,jrg365/gpytorch | ---
+++
@@ -0,0 +1,16 @@
+import torch
+from gpytorch.utils.interpolation import Interpolation
+from gpytorch import utils
+
+
+def test_interpolation():
+ x = torch.linspace(0.01, 1, 100)
+ grid = torch.linspace(-0.05, 1.05, 50)
+ J, C = Interpolation().interpolate(grid, x)
+ W = utils.index_coef_to_spar... | |
014096616d8263ea96b5b8a2b7926b498f02b425 | setupdefaults.py | setupdefaults.py | #! /usr/bin/python
# Encoding: utf-8
import json
import os
import re
import subprocess
import sys
class TypeMapping:
def __init__(self, py_types, type_string, value_transformer):
self.py_types = py_types
self.type_string = type_string
self.value_transformer = value_transformer
def map_type(value):
# Unsuppor... | Add script for writing defaults from a directory of patch dictionaries. | Add script for writing defaults from a directory of patch dictionaries.
| Python | mit | douglashill/OS-X-setup,douglashill/OS-X-setup | ---
+++
@@ -0,0 +1,65 @@
+#! /usr/bin/python
+# Encoding: utf-8
+
+import json
+import os
+import re
+import subprocess
+import sys
+
+class TypeMapping:
+ def __init__(self, py_types, type_string, value_transformer):
+ self.py_types = py_types
+ self.type_string = type_string
+ self.value_transformer = value_tran... | |
99ee6ecfa4bafbfd66a3cb2c2315a8daeeff3023 | Lib/extractor/formats/ufo.py | Lib/extractor/formats/ufo.py | import os
from robofab.ufoLib import UFOReader
# ----------------
# Public Functions
# ----------------
def isUFO(pathOrFile):
if not isinstance(pathOrFile, basestring):
return False
if os.path.splitext(pathOrFile)[-1].lower() != ".ufo":
return False
if not os.path.isdir(pathOrFile):
... | Add support for extracting a UFO from a UFO. It sounds silly, but it is useful. | Add support for extracting a UFO from a UFO. It sounds silly, but it is useful.
| Python | mit | typesupply/extractor,typemytype/extractor,anthrotype/extractor | ---
+++
@@ -0,0 +1,45 @@
+import os
+from robofab.ufoLib import UFOReader
+
+# ----------------
+# Public Functions
+# ----------------
+
+def isUFO(pathOrFile):
+ if not isinstance(pathOrFile, basestring):
+ return False
+ if os.path.splitext(pathOrFile)[-1].lower() != ".ufo":
+ return False
+ ... | |
5a6759b131e4a61f9e7e4aaebb190a7e04b28b00 | create-colormaps.py | create-colormaps.py | """
Export colormaps from Python / matplotlib to JavaScript.
"""
# -----------------------------------------------------------------------------
# IMPORTS
# -----------------------------------------------------------------------------
import json
from matplotlib.colors import Colormap
import matplotlib.cm as cm
imp... | Update script to export colormaps | Update script to export colormaps
| Python | mit | derherrg/js-colormaps,derherrg/js-colormaps | ---
+++
@@ -0,0 +1,64 @@
+"""
+Export colormaps from Python / matplotlib to JavaScript.
+"""
+
+# -----------------------------------------------------------------------------
+# IMPORTS
+# -----------------------------------------------------------------------------
+
+import json
+
+from matplotlib.colors import Co... | |
974651717968885fd766f17ce942e77a15011253 | go/apps/dialogue/tests/test_dialogue_api.py | go/apps/dialogue/tests/test_dialogue_api.py | """Tests for go.apps.dialogue.dialogue_api."""
from twisted.internet.defer import inlineCallbacks
from twisted.trial.unittest import TestCase
from go.apps.dialogue.dialogue_api import DialogueActionDispatcher
from go.vumitools.api import VumiApi
from go.vumitools.tests.utils import GoAppWorkerTestMixin
class Dialog... | Add tests for get_poll and save_poll. | Add tests for get_poll and save_poll.
| Python | bsd-3-clause | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | ---
+++
@@ -0,0 +1,46 @@
+"""Tests for go.apps.dialogue.dialogue_api."""
+
+from twisted.internet.defer import inlineCallbacks
+from twisted.trial.unittest import TestCase
+
+from go.apps.dialogue.dialogue_api import DialogueActionDispatcher
+from go.vumitools.api import VumiApi
+from go.vumitools.tests.utils import ... | |
e274c17ac8bc61d5e96fcab579b8ad07c3a48403 | queueing/resources.py | queueing/resources.py | """
queueing.resources
==================
Utilities and resources for queueing.
:author: Michael Browning
:copyright: (c) 2013 by Michael Browning.
:license: BSD, see LICENSE for more details.
"""
import threading
class StoppableThread(threading.Thread):
"""A thread that exposes a stop ... | Allow stopping of all queueing threads and respond to keyboard interrupt in main | Allow stopping of all queueing threads and respond to keyboard interrupt in main
| Python | bsd-3-clause | mrbrowning/queueing | ---
+++
@@ -0,0 +1,28 @@
+"""
+ queueing.resources
+ ==================
+
+ Utilities and resources for queueing.
+
+ :author: Michael Browning
+ :copyright: (c) 2013 by Michael Browning.
+ :license: BSD, see LICENSE for more details.
+"""
+
+import threading
+
+
+class StoppableThread(threading.Thr... | |
475a573731de50695a12b8376d6f01ab155f5893 | api/sonetworks/migrations/0029_post_published.py | api/sonetworks/migrations/0029_post_published.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-10 23:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sonetworks', '0028_auto_20170509_0231'),
]
operations = [
migrations.AddFie... | UPDATE Post model, published boolea field added | UPDATE Post model, published boolea field added
| Python | mit | semitki/semitki,semitki/semitki,semitki/semitki,semitki/semitki | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-05-10 23:46
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sonetworks', '0028_auto_20170509_0231'),
+ ]
+
+ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.