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 |
|---|---|---|---|---|---|---|---|---|---|---|
ff1ed506bba57de35424362a1661cac5236b2f4b | tools/add_model.py | tools/add_model.py | #! /usr/bin/env python
import os
import sys
import json
import clstm
import shutil
from kraken.lib.models import load_clstm
rnn = load_clstm(sys.argv[1])
alphabet = []
cls = clstm.Classes()
cls.resize(1)
for i in range(1, rnn.rnn.noutput()):
cls[0] = i
alphabet.append(rnn.rnn.decode(cls))
s = {}
s['summary... | Add simple tools for creating metadata | Add simple tools for creating metadata
| Python | apache-2.0 | mittagessen/kraken-models | ---
+++
@@ -0,0 +1,40 @@
+#! /usr/bin/env python
+
+import os
+import sys
+import json
+import clstm
+import shutil
+
+from kraken.lib.models import load_clstm
+
+rnn = load_clstm(sys.argv[1])
+
+alphabet = []
+cls = clstm.Classes()
+cls.resize(1)
+for i in range(1, rnn.rnn.noutput()):
+ cls[0] = i
+ alphabet.a... | |
0eb5f0f5e971a9e3bb74c774f8582c0fb8b82378 | kubernetes/test/test_api_client.py | kubernetes/test/test_api_client.py | # coding: utf-8
import atexit
import weakref
import unittest
import kubernetes
class TestApiClient(unittest.TestCase):
def test_context_manager_closes_threadpool(self):
with kubernetes.client.ApiClient() as client:
self.assertIsNotNone(client.pool)
pool_ref = weakref.ref(client... | Add test to ensure kubernetes client threadpool is cleaned up | Add test to ensure kubernetes client threadpool is cleaned up
| Python | apache-2.0 | kubernetes-client/python,kubernetes-client/python | ---
+++
@@ -0,0 +1,25 @@
+# coding: utf-8
+
+
+import atexit
+import weakref
+import unittest
+
+import kubernetes
+
+
+class TestApiClient(unittest.TestCase):
+
+ def test_context_manager_closes_threadpool(self):
+ with kubernetes.client.ApiClient() as client:
+ self.assertIsNotNone(client.pool)... | |
8e4da46443d9766bc4cdc22f49d55daf4837c5e6 | Basics/challenge_1.py | Basics/challenge_1.py | #!/usr/bin/env python
import codecs
def hex_2_b64(s):
return codecs.encode(codecs.decode(s, 'hex'), 'base64').decode()
if __name__ == '__main__':
print(hex_2_b64("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d")),
| Set 1 - Challenge 1 | Set 1 - Challenge 1
| Python | apache-2.0 | Scythe14/Crypto | ---
+++
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+import codecs
+
+
+def hex_2_b64(s):
+ return codecs.encode(codecs.decode(s, 'hex'), 'base64').decode()
+
+
+if __name__ == '__main__':
+ print(hex_2_b64("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d")), | |
32996b01b0689cccb5ea12e4c6171b2880688684 | watchdog_kj_kultura/organizations_requests/migrations/0004_template_description.py | watchdog_kj_kultura/organizations_requests/migrations/0004_template_description.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-29 20:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organizations_requests', '0003_template_introduction'),
]
operations = [
mi... | Add missing migration for Template | Add missing migration for Template
| Python | mit | watchdogpolska/watchdog-kj-kultura,watchdogpolska/watchdog-kj-kultura,watchdogpolska/watchdog-kj-kultura | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.4 on 2016-12-29 20:36
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organizations_requests', '0003_template_introduction')... | |
20924798362dee42c4de75057d3eb257fe507e72 | CvViewer.py | CvViewer.py | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# Test application to display live images from an Allied Vision camera using OpenCV 3
#
# External dependencies
import cv2
import Vimba
# Initialize Vimba
Vimba.VmbStartup()
# Initialize the camera
camera = Vimba.VmbCamera( '50-0503323406' )
# Open the camera
camera.Op... | Add a viewer for the Allied Vision camera using OpenCV. | Add a viewer for the Allied Vision camera using OpenCV.
| Python | mit | microy/Vimba | ---
+++
@@ -0,0 +1,46 @@
+#! /usr/bin/env python
+# -*- coding:utf-8 -*-
+
+#
+# Test application to display live images from an Allied Vision camera using OpenCV 3
+#
+
+# External dependencies
+import cv2
+import Vimba
+
+# Initialize Vimba
+Vimba.VmbStartup()
+# Initialize the camera
+camera = Vimba.VmbCamera( '50... | |
e52d780b15e43ce7bade0b662284fad28f0fba83 | setup.py | setup.py | #!/usr/bin/python
from os.path import isfile, join
import glob
import os
import re
from setuptools import setup
if isfile("MANIFEST"):
os.unlink("MANIFEST")
VERSION = re.search('__version__ = "([^"]+)"',
open("dateutil/__init__.py").read()).group(1)
setup(name="python-dateutil",
ver... | #!/usr/bin/python
from os.path import isfile, join
import glob
import os
import re
from setuptools import setup
if isfile("MANIFEST"):
os.unlink("MANIFEST")
VERSION = re.search('__version__ = "([^"]+)"',
open("dateutil/__init__.py").read()).group(1)
setup(name="python-dateutil",
ver... | Use zip_safe=False, as suggested by Stephan Richter. | Use zip_safe=False, as suggested by Stephan Richter.
| Python | bsd-3-clause | adamgreig/python-dateutil,sprymix/dateutil,pganssle/dateutil-test-codecov,emsoftware/python-dateutil,Bachmann1234/dateutil,jenshnielsen/dateutil,pganssle/dateutil-test-codecov,sprymix/python-dateutil,abalkin/dateutil,mjschultz/dateutil,abalkin/dateutil | ---
+++
@@ -30,4 +30,5 @@
packages = ["dateutil", "dateutil.zoneinfo"],
package_data={"": ["*.tar.gz"]},
include_package_data=True,
+ zip_safe=False,
) |
281bbe58981dea111a432bbd98ff5e32a7107b66 | models.py | models.py | from sqlalchemy import Column, Integer, Float, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class NbaGame(Base):
__tablename__ = 'nba_game'
id = Column(Integer, primary_key=True)
date = Column(String)
opp = Column(String)
score = Column(String)
minu... | Install sqlalchemy, add nba game model | Install sqlalchemy, add nba game model
| Python | mit | arosenberg01/asdata | ---
+++
@@ -0,0 +1,32 @@
+from sqlalchemy import Column, Integer, Float, String
+from sqlalchemy.ext.declarative import declarative_base
+
+Base = declarative_base()
+
+class NbaGame(Base):
+ __tablename__ = 'nba_game'
+
+ id = Column(Integer, primary_key=True)
+ date = Column(String)
+ opp = Column(Strin... | |
cb484a45562e14d2cb25f53c839973c6a99549a1 | tests/nts/conftest.py | tests/nts/conftest.py | # -*- coding: utf-8 -*-
"""
tests.nts.conftest
~~~~~~~~~~~~~~~~~~
"""
import pathlib
import pytest
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import TestCase
NTS_TEST_SUITE_PATH = pathlib.Path(__file__).parent
@pytest.hookimpl(hookwrapper=True, trylast=True)
def pytest_collectio... | Enforce non TestCase usage under `tests/nts` | Enforce non TestCase usage under `tests/nts`
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+"""
+ tests.nts.conftest
+ ~~~~~~~~~~~~~~~~~~
+"""
+import pathlib
+
+import pytest
+from tests.support.runtests import RUNTIME_VARS
+from tests.support.unit import TestCase
+
+NTS_TEST_SUITE_PATH = pathlib.Path(__file__).parent
+
+
+@pytest.hookimpl(hookwrappe... | |
b59e2bc59a0c8a648189e01047cf729c82aadfe0 | tests/currencycloud/test_resource.py | tests/currencycloud/test_resource.py | import pytest
from mock import patch
from currencycloud import Client, Config
from currencycloud.http import Http
from currencycloud.resources.resource import Resource
from currencycloud.resources.actions import UpdateMixin, DeleteMixin
class TestResource:
class PersonClient(Http):
def delete(self, resou... | Test update and delete actions | Test update and delete actions
| Python | mit | CurrencyCloud/currencycloud-python | ---
+++
@@ -0,0 +1,47 @@
+import pytest
+from mock import patch
+
+from currencycloud import Client, Config
+from currencycloud.http import Http
+from currencycloud.resources.resource import Resource
+from currencycloud.resources.actions import UpdateMixin, DeleteMixin
+
+
+class TestResource:
+ class PersonClient... | |
7a03f8012518ce56f214242c97fe3ce958f098e4 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='facebook-sdk',
version='0.3.2',
description='This client library is designed to support the Facebook '
'Graph API and the o... | #!/usr/bin/env python
from distutils.core import setup
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='facebook-sdk',
version='0.3.2',
description='This client library is designed to support the Facebook '
'Graph API and the o... | Use HTTPS URL for repository. | Use HTTPS URL for repository.
| Python | apache-2.0 | Aloomaio/facebook-sdk,mobolic/facebook-sdk | ---
+++
@@ -13,7 +13,7 @@
'Graph API and the official Facebook JavaScript SDK, which '
'is the canonical way to implement Facebook authentication.',
author='Facebook',
- url='http://github.com/pythonforfacebook/facebook-sdk',
+ url='https://github.com/pythonforfacebook/fac... |
bb0e8faf73298d3b5ce78853b9a70cb8c34b9965 | trace_viewer/trace_viewer_project.py | trace_viewer/trace_viewer_project.py | # Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import os
from tvcm import project as project_module
class TraceViewerProject(project_module.Project):
trace_viewer_path = os.path.abspat... | # Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import os
from tvcm import project as project_module
class TraceViewerProject(project_module.Project):
trace_viewer_path = os.path.abspat... | Allow other_paths to be passed into TraceViewerProject | Allow other_paths to be passed into TraceViewerProject
This allows external embedders to subclass TraceViewerProject and thus
use trace viewer. | Python | bsd-3-clause | catapult-project/catapult-csm,sahiljain/catapult,catapult-project/catapult-csm,sahiljain/catapult,catapult-project/catapult-csm,dstockwell/catapult,danbeam/catapult,catapult-project/catapult-csm,0x90sled/catapult,dstockwell/catapult,catapult-project/catapult,scottmcmaster/catapult,sahiljain/catapult,sahiljain/catapult,... | ---
+++
@@ -24,6 +24,9 @@
test_data_path = os.path.join(trace_viewer_path, 'test_data')
skp_data_path = os.path.join(trace_viewer_path, 'skp_data')
- def __init__(self):
+ def __init__(self, other_paths=None):
+ paths = [self.src_path, self.jszip_path]
+ if other_paths:
+ paths.extend(other_paths... |
b5dec2c004e380da6214bffdd3761b0e46dab3a0 | tests/test_archive.py | tests/test_archive.py | from json import load
from django_archive import __version__
from .base import BaseArchiveTestCase
from .sample.models import Sample
class ArchiveTestCase(BaseArchiveTestCase):
"""
Test that the archive command includes correct data in the archive
"""
def setUp(self):
Sample().save()
... | Add test for verifying archive contents. | Add test for verifying archive contents.
| Python | mit | nathan-osman/django-archive,nathan-osman/django-archive | ---
+++
@@ -0,0 +1,33 @@
+from json import load
+
+from django_archive import __version__
+
+from .base import BaseArchiveTestCase
+from .sample.models import Sample
+
+
+class ArchiveTestCase(BaseArchiveTestCase):
+ """
+ Test that the archive command includes correct data in the archive
+ """
+
+ def se... | |
6d65637dec129863ac4a96bb28b476f032bbff84 | nova/db/sqlalchemy/migrate_repo/versions/143_rename_instance_info_cache_sequence.py | nova/db/sqlalchemy/migrate_repo/versions/143_rename_instance_info_cache_sequence.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 Red Hat, 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.o... | Rename instance_info_cache unique key constraints. | Rename instance_info_cache unique key constraints.
Rename (via drop and recreate) the instance_uuid unique
constraints on the instance_info_cache table so they reflect
the column change name (UUID conversion) we complete in Folsom.
Fixes LP Bug #1080837.
Change-Id: I9dd01ebc896c1d7b51c212980e48db16bad18dec
| Python | apache-2.0 | plumgrid/plumgrid-nova,redhat-openstack/nova,yrobla/nova,gooddata/openstack-nova,orbitfp7/nova,edulramirez/nova,imsplitbit/nova,leilihh/novaha,cernops/nova,cloudbase/nova,shahar-stratoscale/nova,akash1808/nova,zaina/nova,orbitfp7/nova,jianghuaw/nova,whitepages/nova,hanlind/nova,cloudbase/nova,spring-week-topos/nova-wee... | ---
+++
@@ -0,0 +1,65 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (c) 2012 Red Hat, 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... | |
41ab8dbe59cc3ffb41b352cf228fb62e00612d1b | test_bvg_cli.py | test_bvg_cli.py | import httpretty
from bvg_cli import BVG_URL
from bvg_cli import request_departures, request_station_ids
from html_dumps import DEPARTURE_HTML, STATION_HTML
@httpretty.activate
def test_request_station_server_error():
httpretty.register_uri(httpretty.GET, BVG_URL, status=500)
_, ok = request_station_ids('an... | Add tests with mocked http responses | Add tests with mocked http responses
| Python | mit | behrtam/bvg-cli,behrtam/bvg-cli | ---
+++
@@ -0,0 +1,55 @@
+import httpretty
+
+from bvg_cli import BVG_URL
+from bvg_cli import request_departures, request_station_ids
+
+from html_dumps import DEPARTURE_HTML, STATION_HTML
+
+
+@httpretty.activate
+def test_request_station_server_error():
+ httpretty.register_uri(httpretty.GET, BVG_URL, status=50... | |
ae02408361b2f6c426138799da756af56ada67f0 | utils.py | utils.py | """
Utility classes and funcitons for template mathcing framework.
"""
class BoundingBox(object):
def __init__(self, lr, ul):
self.lrx = lr[0]
self.lry = lr[1]
self.lr = lr
self.ulx = ul[0]
self.uly = ul[1]
self.ul = ul
self.llx = ul[0]
self.lly =... | Move utilities to separate file | Move utilities to separate file
| Python | mit | rmsare/scarplet,stgl/scarplet | ---
+++
@@ -0,0 +1,41 @@
+"""
+Utility classes and funcitons for template mathcing framework.
+"""
+
+class BoundingBox(object):
+
+ def __init__(self, lr, ul):
+
+ self.lrx = lr[0]
+ self.lry = lr[1]
+ self.lr = lr
+
+ self.ulx = ul[0]
+ self.uly = ul[1]
+ self.ul = ul
+
... | |
f9988a1419e6adefa163ef0dd92c9f33f2ccf562 | anchorhub/tests/test_main.py | anchorhub/tests/test_main.py | """
test_main.py - Tests for main.py
main.py:
http://www.github.com/samjabrahams/anchorhub/main.py
"""
import anchorhub.main as main
def test_one():
"""
main.py: Test defaults with local directory as input.
"""
main.main(['.'])
| Add basic tests for main.py | Add basic tests for main.py
Needs to be updated as main.py becomes complete.
| Python | apache-2.0 | samjabrahams/anchorhub | ---
+++
@@ -0,0 +1,15 @@
+"""
+test_main.py - Tests for main.py
+
+main.py:
+http://www.github.com/samjabrahams/anchorhub/main.py
+"""
+
+import anchorhub.main as main
+
+
+def test_one():
+ """
+ main.py: Test defaults with local directory as input.
+ """
+ main.main(['.']) | |
bc781453ac14c58fa64f51b5ab91e78dd300621a | tests/devices_test/size_test.py | tests/devices_test/size_test.py |
import unittest
from blivet.devices import StorageDevice
from blivet import errors
from blivet.formats import getFormat
from blivet.size import Size
class StorageDeviceSizeTest(unittest.TestCase):
def _getDevice(self, *args, **kwargs):
return StorageDevice(*args, **kwargs)
def testSizeSetter(self):
... | Add unit tests for device size setters and getters. | Add unit tests for device size setters and getters.
| Python | lgpl-2.1 | rvykydal/blivet,rvykydal/blivet,vojtechtrefny/blivet,vpodzime/blivet,vojtechtrefny/blivet,jkonecny12/blivet,AdamWill/blivet,rhinstaller/blivet,vpodzime/blivet,AdamWill/blivet,jkonecny12/blivet,rhinstaller/blivet | ---
+++
@@ -0,0 +1,99 @@
+
+import unittest
+
+from blivet.devices import StorageDevice
+from blivet import errors
+from blivet.formats import getFormat
+from blivet.size import Size
+
+class StorageDeviceSizeTest(unittest.TestCase):
+ def _getDevice(self, *args, **kwargs):
+ return StorageDevice(*args, **k... | |
685e2c52e2e8cd7c2f691cd3c9a25704a65fbc5b | tools/git_hooks/find_duplicates.py | tools/git_hooks/find_duplicates.py | from os import walk
from os.path import join
from argparse import ArgumentParser
if __name__ == "__main__":
parser = ArgumentParser("Find duplicate file names within a directory structure")
parser.add_argument("dirs", help="Directories to search for duplicate file names"
, nargs="*")
... | Add a git hook script that will list all duplicate files within the directories specified | Add a git hook script that will list all duplicate files within the directories specified
| Python | apache-2.0 | cvtsi2sd/mbed-os,mazimkhan/mbed-os,pradeep-gr/mbed-os5-onsemi,c1728p9/mbed-os,fanghuaqi/mbed,kjbracey-arm/mbed,mikaleppanen/mbed-os,NXPmicro/mbed,mbedmicro/mbed,adamgreen/mbed,bcostm/mbed-os,nvlsianpu/mbed,Archcady/mbed-os,svogl/mbed-os,adamgreen/mbed,arostm/mbed-os,mmorenobarm/mbed-os,screamerbg/mbed,mikaleppanen/mbed... | ---
+++
@@ -0,0 +1,30 @@
+from os import walk
+from os.path import join
+from argparse import ArgumentParser
+
+if __name__ == "__main__":
+ parser = ArgumentParser("Find duplicate file names within a directory structure")
+ parser.add_argument("dirs", help="Directories to search for duplicate file names"
+ ... | |
0da1fe90725bdb1729ee8835886e86756a4a91f8 | win/data/tools/make-portable-python.py | win/data/tools/make-portable-python.py | '''Module that when called from the command line will go through all
files in the Scripts directory of the current python and will change the
python path hardcoded in these files from a full python path, to just
python.exe.
'''
import sys
import os
from os import listdir, remove, rename
from os.path import dirname, jo... | Add make python portable script. | Add make python portable script.
| Python | mit | kivy/kivy-sdk-packager,kivy/kivy-sdk-packager | ---
+++
@@ -0,0 +1,48 @@
+'''Module that when called from the command line will go through all
+files in the Scripts directory of the current python and will change the
+python path hardcoded in these files from a full python path, to just
+python.exe.
+'''
+
+import sys
+import os
+from os import listdir, remove, re... | |
a5e244b630fdd8220ebb1f5228aab20e3d44ca41 | monty/fnmatch.py | monty/fnmatch.py | # coding: utf-8
"""This module provides support for Unix shell-style wildcards"""
from __future__ import unicode_literals, absolute_import
import fnmatch
from monty.string import list_strings
class WildCard(object):
"""
This object provides an easy-to-use interface for filename matching with
shell patte... | Revert "Remove WildCard module. Functionality is already available in glob. Not sure why" | Revert "Remove WildCard module. Functionality is already available in glob. Not sure why"
This reverts commit 44502648df007fd32d5818f2ac0d1df98d9b4550.
| Python | mit | gmatteo/monty,gmatteo/monty,materialsvirtuallab/monty,davidwaroquiers/monty,davidwaroquiers/monty,materialsvirtuallab/monty | ---
+++
@@ -0,0 +1,60 @@
+# coding: utf-8
+"""This module provides support for Unix shell-style wildcards"""
+from __future__ import unicode_literals, absolute_import
+
+import fnmatch
+
+from monty.string import list_strings
+
+
+class WildCard(object):
+ """
+ This object provides an easy-to-use interface for... | |
4ca382fa691ae91f531a238df9ba13234b311b55 | utils/remove_limit.py | utils/remove_limit.py | #!/usr/bin/env python
"""
Utility to remove limit warnings from Filter API output.
If --warnings was used, you will have the following in output:
{"limit": {"track": 2530, "timestamp_ms": "1482168932301"}}
This utility removes any limit warnings from output.
Usage:
remove_limit.py aleppo.json > aleppo_no_warnin... | Add utility to remove limit warnings. | Add utility to remove limit warnings.
| Python | cc0-1.0 | remagio/twarc,DocNow/twarc,remagio/twarc,edsu/twarc,hugovk/twarc | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+"""
+Utility to remove limit warnings from Filter API output.
+
+If --warnings was used, you will have the following in output:
+{"limit": {"track": 2530, "timestamp_ms": "1482168932301"}}
+
+This utility removes any limit warnings from output.
+
+Usage:
+ remove_... | |
6b8f84e3feab1cb4c08f3ca52269db9f2c86d36f | examples/endless_turn.py | examples/endless_turn.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# PyAX-12
# The MIT License
#
# Copyright (c) 2010,2015,2017 Jeremie DECOCK (http://www.jdhp.org)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Sof... | Add an endless turn demo. | Add an endless turn demo.
| Python | mit | jeremiedecock/pyax12,jeremiedecock/pyax12 | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# PyAX-12
+
+# The MIT License
+#
+# Copyright (c) 2010,2015,2017 Jeremie DECOCK (http://www.jdhp.org)
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files ... | |
755f3f3f8e39a338ea9f56fdb2c8f39787180c49 | tests/import_tests.py | tests/import_tests.py | from nose.tools import ok_
import oemof.db as oemofdb
def test_oemofdb_imports():
ok_(oemofdb.connection)
ok_(oemofdb.engine)
ok_(oemofdb.url)
| Test minimal package import functionality | Test minimal package import functionality
Ok, it's not really minimal, but it's one way to be sure, that the
package actually exists, is importable and some of it's exported things
are accessible.
| Python | mit | oemof/oemof.db | ---
+++
@@ -0,0 +1,9 @@
+from nose.tools import ok_
+
+import oemof.db as oemofdb
+
+def test_oemofdb_imports():
+ ok_(oemofdb.connection)
+ ok_(oemofdb.engine)
+ ok_(oemofdb.url)
+ | |
5df72de23fe87d0fe20df02007db79ec5bb8f843 | write.py | write.py | #!/usr/bin/env blender
import sys
import os
import bpy
import addon_utils
def _main(args):
print("Writing", args)
default, state = addon_utils.check("io_EDM")
if not state:
import io_EDM
io_EDM.register()
# Call the import operator
bpy.ops.export_mesh.edm(filepath="test.edm")
if __name__ == "__m... | Add a very simple test writing script | Add a very simple test writing script
| Python | mit | ndevenish/Blender_ioEDM,ndevenish/Blender_ioEDM | ---
+++
@@ -0,0 +1,22 @@
+#!/usr/bin/env blender
+
+import sys
+import os
+
+import bpy
+import addon_utils
+
+def _main(args):
+ print("Writing", args)
+
+ default, state = addon_utils.check("io_EDM")
+ if not state:
+ import io_EDM
+ io_EDM.register()
+
+ # Call the import operator
+ bpy.ops.export_mesh.... | |
2c301d7f0d52188893c0e83326003dbf84a7424a | fix_movies.py | fix_movies.py | #!/usr/bin/python
# we've been outputting stuff to text so now I get to wedge it into a database
# funtimes
# set up the database with `sqlite3 netflix_genres.sqlite < create_tables.sql`
import codecs
import sqlite3
import sys
conn = sqlite3.connect('netflix_genres.sqlite')
c = conn.cursor()
# for row in c.execute... | Document work in fixing movies table | Document work in fixing movies table
| Python | unlicense | george08/netflix-o-matic | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+# we've been outputting stuff to text so now I get to wedge it into a database
+# funtimes
+
+# set up the database with `sqlite3 netflix_genres.sqlite < create_tables.sql`
+
+import codecs
+import sqlite3
+import sys
+
+conn = sqlite3.connect('netflix_genres.sqlite')
+c... | |
836eb50eae358cd077b58ba0d5c884f8c83919dc | main/readability_graph_brown.py | main/readability_graph_brown.py | from feature import simple
import graph
from nltk.corpus import brown
def calc_readability(corpus):
texts = []
results = []
for fileid in corpus.fileids():
sentlist = brown.sents(fileids=[fileid])
text = ' '.join([ ' '.join(ss) for ss in sentlist ])
texts.append(text)
for text... | Add readability grapher for brown corpus | Add readability grapher for brown corpus
| Python | mit | worldwise001/stylometry | ---
+++
@@ -0,0 +1,66 @@
+from feature import simple
+import graph
+
+from nltk.corpus import brown
+
+
+def calc_readability(corpus):
+ texts = []
+ results = []
+ for fileid in corpus.fileids():
+ sentlist = brown.sents(fileids=[fileid])
+ text = ' '.join([ ' '.join(ss) for ss in sentlist ])
... | |
5aa9fd6b9c30fc4861596c2efed456e01ab49f22 | python/decrypt_img.py | python/decrypt_img.py | import requests
import json
# Decrypt a previously encrypted image using the passphrase 'superpass'
# https://pixlab.io/#/cmd?id=encrypt && https://pixlab.io/#/cmd?id=decrypt
# Password used for decryption
pwd = 'superpass'
req = requests.get('https://api.pixlab.io/decrypt',params={'img':'https://pixlab.xyz/wxfnq588... | Decrypt a previously encrypted image | Decrypt a previously encrypted image | Python | bsd-2-clause | symisc/pixlab,symisc/pixlab,symisc/pixlab | ---
+++
@@ -0,0 +1,15 @@
+import requests
+import json
+
+# Decrypt a previously encrypted image using the passphrase 'superpass'
+# https://pixlab.io/#/cmd?id=encrypt && https://pixlab.io/#/cmd?id=decrypt
+
+# Password used for decryption
+pwd = 'superpass'
+
+req = requests.get('https://api.pixlab.io/decrypt',param... | |
182afef414d6ae9cd1ebd7d38be56cd77aaad663 | tests/test_Levitt1971_Fig4.py | tests/test_Levitt1971_Fig4.py | from UpDownMethods import CORRECT, INCORRECT
import UpDownMethods as ud
import numpy as np
import matplotlib.pyplot as plt
import unittest
#
# Simulation parameters
#
responses = [CORRECT, CORRECT, INCORRECT, INCORRECT, INCORRECT, INCORRECT,
CORRECT, CORRECT, INCORRECT, INCORRECT, INCORRECT, CORRECT,
... | Include Levitt figure 4 test | Include Levitt figure 4 test
| Python | mit | codles/UpDownMethods | ---
+++
@@ -0,0 +1,64 @@
+from UpDownMethods import CORRECT, INCORRECT
+import UpDownMethods as ud
+import numpy as np
+import matplotlib.pyplot as plt
+import unittest
+
+
+#
+# Simulation parameters
+#
+
+responses = [CORRECT, CORRECT, INCORRECT, INCORRECT, INCORRECT, INCORRECT,
+ CORRECT, CORRECT, INCO... | |
f2b334c0238e6b3bc37169a7e5681451da9ce424 | Python/155_MinStack.py | Python/155_MinStack.py | class MinStack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self._s = []
self.t = len(self._s)-1
self.curMin = 2147483647
def push(self, x):
"""
:type x: int
:rtype: nothing
"""
self.curMin = x i... | Add solution for 155 min stack. (tooooooo slow) | Add solution for 155 min stack. (tooooooo slow)
| Python | mit | comicxmz001/LeetCode,comicxmz001/LeetCode | ---
+++
@@ -0,0 +1,63 @@
+class MinStack(object):
+ def __init__(self):
+ """
+ initialize your data structure here.
+ """
+ self._s = []
+ self.t = len(self._s)-1
+ self.curMin = 2147483647
+ def push(self, x):
+ """
+ :type x: int
+ :rtype: nothin... | |
d989180c24ef7bd114f4138935a35b73e05036c4 | senlin/tests/tempest/api/policies/test_policy_type.py | senlin/tests/tempest/api/policies/test_policy_type.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add API tests for policy type list/show | Add API tests for policy type list/show
Add API tests for policy type list/show
Change-Id: I0d14727264491bbb6a9a668246fc267ab2245611
| Python | apache-2.0 | openstack/senlin,stackforge/senlin,openstack/senlin,stackforge/senlin,openstack/senlin | ---
+++
@@ -0,0 +1,41 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writi... | |
642f513a181f8d4b14b6ecf784002d3010d4e98c | create_master.py | create_master.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Program: Create Master
Programmer: Michael Fryar, Training Analytics Associate, EPoD
Date created: February 16, 2018
Purpose: Create a master file of engagement data and append previous enagement
records to this file. Going forward, new data will be appended to this fi... | Create master engagement data file and append old engagement records | Create master engagement data file and append old engagement records
Going forward, learner engagement downloads will be appended to a master
file. This commit adds a script I wrote to create a master file for each
course and append existing engagement records.
| Python | mit | mefryar/epodx-dashboards,mefryar/epodx-dashboards | ---
+++
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Program: Create Master
+Programmer: Michael Fryar, Training Analytics Associate, EPoD
+Date created: February 16, 2018
+
+Purpose: Create a master file of engagement data and append previous enagement
+records to this file. Going forward, ... | |
254ca39eb2c70d1468854de18954121c9b399810 | data_prep.py | data_prep.py | __author__ = 'jacob'
import tarfile
import glob
import os
atlas_filenames = glob.iglob(os.path.join("data", "atlas", "*.tgz"))
cms_filenames = glob.iglob(os.path.join("data", "cms", "*.tgz"))
for fname in atlas_filenames:
tar = tarfile.open(fname, "r:gz")
tar.extractall(path=os.path.join("data", "atlas"))
... | Add simple data extraction for the ATLAS and CMS compressed files | Add simple data extraction for the ATLAS and CMS compressed files
| Python | mit | jacobbieker/ATLAS-Luminosity | ---
+++
@@ -0,0 +1,17 @@
+__author__ = 'jacob'
+import tarfile
+import glob
+import os
+
+atlas_filenames = glob.iglob(os.path.join("data", "atlas", "*.tgz"))
+cms_filenames = glob.iglob(os.path.join("data", "cms", "*.tgz"))
+
+for fname in atlas_filenames:
+ tar = tarfile.open(fname, "r:gz")
+ tar.extractall(p... | |
ca892587c46070c7e59ee7e893992785ac64965b | kufpybio/restapi.py | kufpybio/restapi.py | import os
import urllib.request
class RESTAPI(object):
"""A general class that handles the local file access or the
retrival of tha file.
"""
def _get_data(self, path_template, url_template, entity_id):
file_path = self._file_path(path_template, entity_id)
if not os.path.exists(file_... | Add a general REST API class | Add a general REST API class
| Python | isc | konrad/kufpybio | ---
+++
@@ -0,0 +1,28 @@
+import os
+import urllib.request
+
+class RESTAPI(object):
+
+ """A general class that handles the local file access or the
+ retrival of tha file.
+
+ """
+
+ def _get_data(self, path_template, url_template, entity_id):
+ file_path = self._file_path(path_template, entity_... | |
3c1cbe7d701e1c465bdb70a570b905a44e3df73f | tests/view/results/test_finders.py | tests/view/results/test_finders.py | # Case Conductor is a Test Case Management system.
# Copyright (C) 2011-12 Mozilla
#
# This file is part of Case Conductor.
#
# Case Conductor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 o... | Add tests for results finder. | Add tests for results finder.
| Python | bsd-2-clause | mozilla/moztrap,mccarrmb/moztrap,bobsilverberg/moztrap,shinglyu/moztrap,shinglyu/moztrap,mccarrmb/moztrap,shinglyu/moztrap,mozilla/moztrap,bobsilverberg/moztrap,mozilla/moztrap,shinglyu/moztrap,mccarrmb/moztrap,bobsilverberg/moztrap,mccarrmb/moztrap,mccarrmb/moztrap,mozilla/moztrap,mozilla/moztrap,bobsilverberg/moztrap... | ---
+++
@@ -0,0 +1,62 @@
+# Case Conductor is a Test Case Management system.
+# Copyright (C) 2011-12 Mozilla
+#
+# This file is part of Case Conductor.
+#
+# Case Conductor is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Soft... | |
fd47b9235a95146fc0ccbaf10f4b5c2c217fe401 | libsrc/test/TestXdmfPythonArray.py | libsrc/test/TestXdmfPythonArray.py | import Xdmf
from Xdmf import *
if __name__ == '__main__':
array = Xdmf.XdmfArray()
array.SetNumberType(Xdmf.XDMF_INT64_TYPE)
assert(array.GetNumberType() == Xdmf.XDMF_INT64_TYPE)
array.SetShapeFromString("3 3")
assert(array.GetShapeAsString() == "3 3")
assert(array.GetNumberOfElements() == 9... | Add Xdmf Python Test that writes values to an XdmfArray | ENH: Add Xdmf Python Test that writes values to an XdmfArray
| Python | bsd-3-clause | cjh1/Xdmf2,cjh1/Xdmf2,cjh1/Xdmf2 | ---
+++
@@ -0,0 +1,23 @@
+import Xdmf
+from Xdmf import *
+
+if __name__ == '__main__':
+ array = Xdmf.XdmfArray()
+ array.SetNumberType(Xdmf.XDMF_INT64_TYPE)
+ assert(array.GetNumberType() == Xdmf.XDMF_INT64_TYPE)
+ array.SetShapeFromString("3 3")
+ assert(array.GetShapeAsString() == "3 3")
+ as... | |
35ff343d39dec11909bfffee86b4d467178f5fe8 | acq4/util/threadrun.py | acq4/util/threadrun.py | try:
import queue
except ImportError:
import Queue as queue
from .future import Future
from . import Qt
def runInThread(thread, func, *args, **kwds):
"""Run a function in another thread and return the result.
The remote thread must be running a Qt event loop.
"""
return ThreadCallFuture(threa... | Add utility for calling functions across threads directly | Add utility for calling functions across threads directly
| Python | mit | acq4/acq4,pbmanis/acq4,pbmanis/acq4,pbmanis/acq4,campagnola/acq4,pbmanis/acq4,acq4/acq4,campagnola/acq4,campagnola/acq4,acq4/acq4,campagnola/acq4,acq4/acq4 | ---
+++
@@ -0,0 +1,53 @@
+try:
+ import queue
+except ImportError:
+ import Queue as queue
+from .future import Future
+from . import Qt
+
+
+def runInThread(thread, func, *args, **kwds):
+ """Run a function in another thread and return the result.
+
+ The remote thread must be running a Qt event loop.
+ ... | |
b55918ee959d8b168b940f44236b9bbab6daed1c | src/hack4lt/models.py | src/hack4lt/models.py | import re
from django.conf import settings
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, UserManager
from django.core import validators
from django.core.mail import send_mail
from django.db import models
from django.template.loader import render_to_string
from django.utils import timezone
f... | Add CustomUser user model named Hacker. | Add CustomUser user model named Hacker.
| Python | bsd-3-clause | niekas/Hack4LT | ---
+++
@@ -0,0 +1,66 @@
+import re
+from django.conf import settings
+from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, UserManager
+from django.core import validators
+from django.core.mail import send_mail
+from django.db import models
+from django.template.loader import render_to_string
+... | |
c9d352b6dbb5d094e97d578d6dd3696c31d02217 | hyper/http20/error_code_registry.py | hyper/http20/error_code_registry.py | # -*- coding: utf-8 -*-
"""
hyper/http20/error_code_registry
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Global error code registry containing the established HTTP/2 error codes.
The registry is based on a 32-bit space so we use the error code to index into
the array.
The current registry is available at:
https://tools.ietf.org... | Add HTTP2 error code registry | Add HTTP2 error code registry
| Python | mit | irvind/hyper,lawnmowerlatte/hyper,irvind/hyper,Lukasa/hyper,jdecuyper/hyper,fredthomsen/hyper,jdecuyper/hyper,lawnmowerlatte/hyper,Lukasa/hyper,plucury/hyper,masaori335/hyper,masaori335/hyper,plucury/hyper,fredthomsen/hyper | ---
+++
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+"""
+hyper/http20/error_code_registry
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Global error code registry containing the established HTTP/2 error codes.
+The registry is based on a 32-bit space so we use the error code to index into
+the array.
+
+The current registry is... | |
0979da2fa3fdb59029c1e1e9f12a84388ab4f711 | templatetags/uuid.py | templatetags/uuid.py | # -*- coding: utf-8 -*-
#
# File: uuid.py
# Author: Kenson Man <kenosn.idv.hk@gmail.com>
# Desc: The template-tag used to generate a uuid into output.
# Sample:
# {%uuid%} # Generate a UUID and output
# {%uuid as abc%} # Generate a UUID and store into abc
#
from django.template import Library, Node, Templ... | Add the UUID template-tag that generate the UUID | Add the UUID template-tag that generate the UUID
| Python | apache-2.0 | kensonman/webframe,kensonman/webframe,kensonman/webframe | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+# File: uuid.py
+# Author: Kenson Man <kenosn.idv.hk@gmail.com>
+# Desc: The template-tag used to generate a uuid into output.
+# Sample:
+# {%uuid%} # Generate a UUID and output
+# {%uuid as abc%} # Generate a UUID and store into abc
+#
+from django... | |
eb98ff894b15068291c22fcfb87356e4af193646 | alembic/versions/fa7e12c88c5_add_filter_field_to_users.py | alembic/versions/fa7e12c88c5_add_filter_field_to_users.py | """Add filter field to users.
Revision ID: fa7e12c88c5
Revises: 2325abc7de81
Create Date: 2015-10-13 21:06:15.875359
"""
# revision identifiers, used by Alembic.
revision = 'fa7e12c88c5'
down_revision = '2325abc7de81'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalch... | Add filter field to users (migration). | Add filter field to users (migration).
| Python | agpl-3.0 | MSPARP/newparp,MSPARP/newparp,MSPARP/newparp | ---
+++
@@ -0,0 +1,28 @@
+"""Add filter field to users.
+
+Revision ID: fa7e12c88c5
+Revises: 2325abc7de81
+Create Date: 2015-10-13 21:06:15.875359
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'fa7e12c88c5'
+down_revision = '2325abc7de81'
+branch_labels = None
+depends_on = None
+
+from alembic impo... | |
eff1cc5dabd366ca4cbf6e8c97b97727327f29d5 | test/option--.py | test/option--.py | #!/usr/bin/env python
__revision__ = "test/option-n.py __REVISION__ __DATE__ __DEVELOPER__"
import TestCmd
import os.path
import string
import sys
test = TestCmd.TestCmd(program = 'scons.py',
workdir = '',
interpreter = 'python')
test.write('build.py', r"""
import sys
f... | Add a test for -- terminating option processing. | Add a test for -- terminating option processing.
| Python | mit | azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+__revision__ = "test/option-n.py __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestCmd
+import os.path
+import string
+import sys
+
+test = TestCmd.TestCmd(program = 'scons.py',
+ workdir = '',
+ interpreter = 'python')
+
... | |
53edb67dd3a7a88d9133a85cd2fe1a9d22a3a436 | doc/examples/plot_piecewise_affine.py | doc/examples/plot_piecewise_affine.py | """
===============================
Piecewise Affine Transformation
===============================
This example shows how to use the Piecewise Affine Transformation.
"""
import numpy as np
import matplotlib.pyplot as plt
from skimage.transform import PiecewiseAffineTransform, warp
from skimage import data
image = ... | Add example script for piecewise affine transform | Add example script for piecewise affine transform
| Python | bsd-3-clause | jwiggins/scikit-image,jwiggins/scikit-image,ofgulban/scikit-image,SamHames/scikit-image,chintak/scikit-image,rjeli/scikit-image,newville/scikit-image,ofgulban/scikit-image,juliusbierk/scikit-image,oew1v07/scikit-image,almarklein/scikit-image,chriscrosscutler/scikit-image,pratapvardhan/scikit-image,chintak/scikit-image,... | ---
+++
@@ -0,0 +1,38 @@
+"""
+===============================
+Piecewise Affine Transformation
+===============================
+
+This example shows how to use the Piecewise Affine Transformation.
+"""
+
+import numpy as np
+import matplotlib.pyplot as plt
+from skimage.transform import PiecewiseAffineTransform, wa... | |
e85dd9773b6c76a0b437bee182d2aafedd3ead8d | cenaming/us_states.py | cenaming/us_states.py |
STATE_NAMES = (
'Alabama',
'Alaska',
'Arizona',
'Arkansas',
'California',
'Colorado',
'Connecticut',
'Delaware',
'Florida',
'Georgia',
'Hawaii',
'Idaho',
'Illinois',
'Indiana',
'Iowa',
'Kansas',
'Kentucky',
'Louisiana',
'Maine',
'Maryland'... | Add list of US state names. | Add list of US state names.
| Python | mit | portfoliome/cenaming | ---
+++
@@ -0,0 +1,53 @@
+
+STATE_NAMES = (
+ 'Alabama',
+ 'Alaska',
+ 'Arizona',
+ 'Arkansas',
+ 'California',
+ 'Colorado',
+ 'Connecticut',
+ 'Delaware',
+ 'Florida',
+ 'Georgia',
+ 'Hawaii',
+ 'Idaho',
+ 'Illinois',
+ 'Indiana',
+ 'Iowa',
+ 'Kansas',
+ 'Kentucky'... | |
03edf22323d78989210a4cbefda7597158d33b42 | fire_rs/planning/front_observation.py | fire_rs/planning/front_observation.py | import logging
import numpy as np
import matplotlib.pyplot as plt
from fire_rs.geodata import environment
import fire_rs.firemodel.propagation as propagation
import fire_rs.display
import fire_rs.planning.observation_path_search
def burn(area_bounds, ignition_point, wind):
"""Burn some area from an ignition point... | Test the regression path planning on simulated fire fronts | Test the regression path planning on simulated fire fronts
| Python | bsd-2-clause | fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop | ---
+++
@@ -0,0 +1,59 @@
+import logging
+import numpy as np
+import matplotlib.pyplot as plt
+from fire_rs.geodata import environment
+import fire_rs.firemodel.propagation as propagation
+import fire_rs.display
+import fire_rs.planning.observation_path_search
+
+
+def burn(area_bounds, ignition_point, wind):
+ ""... | |
6e5460b61f0b12e913b12d609c87df3f8e3e8afb | froide/foirequest/migrations/0041_auto_20191024_2025.py | froide/foirequest/migrations/0041_auto_20191024_2025.py | # Generated by Django 2.2.2 on 2019-10-24 18:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('foirequest', '0040_auto_20190718_1815'),
]
operations = [
migrations.AlterField(
model_name='foimessage',
name='kind... | Add upload to foimessage kind choices | Add upload to foimessage kind choices | Python | mit | fin/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide,stefanw/froide | ---
+++
@@ -0,0 +1,18 @@
+# Generated by Django 2.2.2 on 2019-10-24 18:25
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('foirequest', '0040_auto_20190718_1815'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_... | |
9f05f7f9367c89d5fd2073adb3969f2b010bdf1f | tools/id4glossary.py | tools/id4glossary.py | #!/usr/bin/env python
"""Pandoc filter to convert add ids to glossary entries.
Usage:
pandoc source.md --filter=id4glossary.py --output=output.html
"""
import pandocfilters as pf
def normalize_keyword(keyword):
"""Normalize keyword for became id
- Replace white space with '-'
- Convert to lowercase"... | Add id to glossary entry | Add id to glossary entry
This is needed to enable users jump to glossary entries.
| Python | mit | RobIsaTeam/courses,easyreporting/fmri_reporting,easyreporting/fmri_reporting,easyreporting/fmri_reporting,RobIsaTeam/courses,easyreporting/fmri_reporting,easyreporting/fmri_reporting,easyreporting/fmri_reporting | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+"""Pandoc filter to convert add ids to glossary entries.
+
+Usage:
+
+ pandoc source.md --filter=id4glossary.py --output=output.html
+"""
+import pandocfilters as pf
+
+def normalize_keyword(keyword):
+ """Normalize keyword for became id
+
+ - Replace white sp... | |
655a18258d13c00e39e1f0cbf9369215d5d084ae | parse_setup_data.py | parse_setup_data.py | #!/usr/bin/env python
# Copyright (C) 2014 Instituto Nokia de Tecnologia - INdT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any... | Add initial script for parsing Setup Data packets | Add initial script for parsing Setup Data packets
| Python | mit | lizardo/nrf8001,lizardo/nrf8001,lizardo/nrf8001 | ---
+++
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# Copyright (C) 2014 Instituto Nokia de Tecnologia - INdT
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the Li... | |
6ce12955861c1f586d69dedffc014a1d5bab5432 | util/item_name_gen.py | util/item_name_gen.py | '''Script to help generate item names.'''
def int_to_str(num, alphabet):
'''Convert integer to string.'''
# http://stackoverflow.com/a/1119769/1524507
if (num == 0):
return alphabet[0]
arr = []
base = len(alphabet)
while num:
rem = num % base
num = num // base
a... | Add item name gen script | Add item name gen script
| Python | unlicense | ArchiveTeam/twitpic-grab2,ArchiveTeam/twitpic-grab2 | ---
+++
@@ -0,0 +1,41 @@
+'''Script to help generate item names.'''
+
+
+def int_to_str(num, alphabet):
+ '''Convert integer to string.'''
+ # http://stackoverflow.com/a/1119769/1524507
+ if (num == 0):
+ return alphabet[0]
+ arr = []
+ base = len(alphabet)
+ while num:
+ rem = num % b... | |
65f8b529af8672ac074d4c45684d8e0f7baaab2c | ideascube/conf/kb_jor_croixrouge.py | ideascube/conf/kb_jor_croixrouge.py | # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .kb import * # noqa
LANGUAGE_CODE = 'ar'
IDEASCUBE_NAME = 'Red Cross'
HOME_CARDS = STAFF_HOME_CARDS + [
{
'id': 'blog',
},
{
'id': 'mediacenter',
},
{
'id': 'wikipedia',
'languages': ['ar', 'en']
},
{
... | Add conf for Red Cross Jordanie | Add conf for Red Cross Jordanie
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+"""KoomBook conf"""
+from .kb import * # noqa
+
+LANGUAGE_CODE = 'ar'
+IDEASCUBE_NAME = 'Red Cross'
+HOME_CARDS = STAFF_HOME_CARDS + [
+ {
+ 'id': 'blog',
+ },
+ {
+ 'id': 'mediacenter',
+ },
+ {
+ 'id': 'wikipedia',
+ 'lan... | |
6d255990983405fe7eb1322c9d02414c859d1e96 | tests/app/test_openid_listener.py | tests/app/test_openid_listener.py | # -*- coding: utf-8 -*-
# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Add tests for the openid lister for FederationReaderServer | Add tests for the openid lister for FederationReaderServer
Check all possible variants of openid and federation listener on/off
possibilities.
Signed-off-by: Jason Robinson <73c4b53c33b2f03b4e26d9578bea93e0ed8e16b0@matrix.org>
| Python | apache-2.0 | matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse | ---
+++
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+# Copyright 2018 New Vector Ltd
+#
+# 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
+... | |
a24d0fce91f3f7a261a410d859ecd4250276fa28 | python/smqtk/tests/utils/test_image_utils.py | python/smqtk/tests/utils/test_image_utils.py | import os
import unittest
import nose.tools as ntools
from smqtk.representation.data_element.file_element import DataFileElement
from smqtk.tests import TEST_DATA_DIR
from smqtk.utils.image_utils import is_loadable_image, is_valid_element
class TestIsLoadableImage(unittest.TestCase):
def setUp(self):
s... | Add unit tests for image_utils | Add unit tests for image_utils
| Python | bsd-3-clause | Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK | ---
+++
@@ -0,0 +1,61 @@
+import os
+import unittest
+
+import nose.tools as ntools
+
+from smqtk.representation.data_element.file_element import DataFileElement
+from smqtk.tests import TEST_DATA_DIR
+from smqtk.utils.image_utils import is_loadable_image, is_valid_element
+
+
+class TestIsLoadableImage(unittest.Test... | |
4a89c8c136f4af1ec699a53211a9423efe33c3be | libbmc/papers/tearpages.py | libbmc/papers/tearpages.py | """
This file contains the necessary functions to determine whether we should tear
the first page from a PDF file, and actually tear it.
"""
import tearpages
# List of bad publishers which adds an extra useless first page, which can be
# teared. Please, submit a PR to include new ones which I may not be aware of!
BAD... | Add some functions to tear first pages from a PDF | Add some functions to tear first pages from a PDF
| Python | mit | Phyks/libbmc | ---
+++
@@ -0,0 +1,45 @@
+"""
+This file contains the necessary functions to determine whether we should tear
+the first page from a PDF file, and actually tear it.
+"""
+import tearpages
+
+
+# List of bad publishers which adds an extra useless first page, which can be
+# teared. Please, submit a PR to include new o... | |
69fe4ba3cc0338b4cd962e0571b9ae1d54e139ee | website/addons/base/serializer.py | website/addons/base/serializer.py | import abc
from website.util import web_url_for
class AddonSerializer(object):
__metaclass__ = abc.ABCMeta
def __init__(self, addon_node_settings, user):
self.addon_node_settings = addon_node_settings
self.user = user
@abc.abstractproperty
def serialized_urls(self):
pass
... | Add base class for serializing addons. | Add base class for serializing addons.
| Python | apache-2.0 | SSJohns/osf.io,chrisseto/osf.io,aaxelb/osf.io,Nesiehr/osf.io,petermalcolm/osf.io,kwierman/osf.io,MerlinZhang/osf.io,ZobairAlijan/osf.io,SSJohns/osf.io,caseyrygt/osf.io,DanielSBrown/osf.io,baylee-d/osf.io,jmcarp/osf.io,ticklemepierce/osf.io,CenterForOpenScience/osf.io,njantrania/osf.io,asanfilippo7/osf.io,HarryRybacki/o... | ---
+++
@@ -0,0 +1,72 @@
+import abc
+
+from website.util import web_url_for
+
+class AddonSerializer(object):
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self, addon_node_settings, user):
+ self.addon_node_settings = addon_node_settings
+ self.user = user
+
+ @abc.abstractproperty
+ def ... | |
0d897c469d168d0362e71c26d039163fd0d3bdd2 | zerver/management/commands/client-activity.py | zerver/management/commands/client-activity.py | from __future__ import absolute_import
from django.core.management.base import BaseCommand
from django.db.models import Count
from zerver.models import UserActivity, UserProfile, Realm, \
get_realm, get_user_profile_by_email
import datetime
class Command(BaseCommand):
help = """Report rough client activity ... | Add a utility to report some rough recent client activity metrics. | Add a utility to report some rough recent client activity metrics.
(imported from commit 27b4a70871939b2728fcbe0ce5824326ff4decc2)
| Python | apache-2.0 | pradiptad/zulip,esander91/zulip,JPJPJPOPOP/zulip,hustlzp/zulip,MayB/zulip,AZtheAsian/zulip,ApsOps/zulip,MayB/zulip,amallia/zulip,bowlofstew/zulip,ufosky-server/zulip,showell/zulip,vabs22/zulip,qq1012803704/zulip,mohsenSy/zulip,he15his/zulip,atomic-labs/zulip,andersk/zulip,johnnygaddarr/zulip,tiansiyuan/zulip,AZtheAsian... | ---
+++
@@ -0,0 +1,69 @@
+from __future__ import absolute_import
+
+from django.core.management.base import BaseCommand
+from django.db.models import Count
+
+from zerver.models import UserActivity, UserProfile, Realm, \
+ get_realm, get_user_profile_by_email
+
+import datetime
+
+class Command(BaseCommand):
+ ... | |
582ceb3f429415251c06f576712a3b2ddbf4496a | src/ggrc/migrations/versions/20161109010604_4afe69ce3c38_remove_invalid_person_objects.py | src/ggrc/migrations/versions/20161109010604_4afe69ce3c38_remove_invalid_person_objects.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Remove invalid person objects
Create Date: 2016-11-09 01:06:04.745331
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
from alembic imp... | Remove bad data form object_people table | Remove bad data form object_people table
The InterviewResponse object was not properly removed from all tables
when the model was deleted. Memcache then tried to remove this non
existent model, which resulted in an exception. This migration makes
sure that such bad data is properly purged from our database.
| Python | apache-2.0 | AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core... | ---
+++
@@ -0,0 +1,31 @@
+# Copyright (C) 2016 Google Inc.
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+
+"""
+Remove invalid person objects
+
+Create Date: 2016-11-09 01:06:04.745331
+"""
+# disable Invalid constant name pylint warning for mandatory Alembic variables.
+# pylint: d... | |
61625103a328f3377afd5565d246d3bc43bee766 | murano/db/migration/alembic_migrations/versions/016_increase_task_description_text_size.py | murano/db/migration/alembic_migrations/versions/016_increase_task_description_text_size.py | # Copyright 2016 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | Increase description column length in task table | Increase description column length in task table
Previously we changed description column in environment
table from TEXT to LONGTEXT but forgot to do the same
for similar column in the task task table
Change-Id: I3a2bd0204a9fac2d583d8742ca72868bd20c49b4
Closes-Bug: #1616997
| Python | apache-2.0 | DavidPurcell/murano_temp,DavidPurcell/murano_temp,openstack/murano,DavidPurcell/murano_temp,DavidPurcell/murano_temp,openstack/murano | ---
+++
@@ -0,0 +1,49 @@
+# Copyright 2016 OpenStack Foundation.
+#
+# 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 require... | |
8999ac7e9808a47a5f751edb2fed6d421357112c | aurorawatchuk/examples/get_status.py | aurorawatchuk/examples/get_status.py | #!/usr/bin/env python
import aurorawatchuk
import datetime
import logging
import os
import time
logger = logging.getLogger(__name__)
# Set logging level to debug to that HTTP GETs are indicated
logging.basicConfig(level=logging.DEBUG)
# If desired set user agent string. Must be set before first use.
aurorawatchuk.u... | Add example to show basic usage | Add example to show basic usage
| Python | mit | stevemarple/python-aurorawatchuk | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+import aurorawatchuk
+import datetime
+import logging
+import os
+import time
+
+
+logger = logging.getLogger(__name__)
+# Set logging level to debug to that HTTP GETs are indicated
+logging.basicConfig(level=logging.DEBUG)
+
+# If desired set user agent string. Must... | |
3ca5a70286974457bce38a52cce81c8e076f0a0c | python/hashlib_md5_sha/md5sum_string.py | python/hashlib_md5_sha/md5sum_string.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including withou... | Add a snippet in 'python/hashlib_md5_sha'. | Add a snippet in 'python/hashlib_md5_sha'.
| 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,39 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software wi... | |
b5d8303f4def7de4814f73d02d5e143cbeb2baa7 | code/ex3.2-aio_multiple_requests.py | code/ex3.2-aio_multiple_requests.py | import asyncio
import aiohttp
import time
URLS = [
'http://127.0.0.1:8000',
'http://127.0.0.1:8000',
'http://127.0.0.1:8000',
]
@asyncio.coroutine
def request_greetings():
response_tasks = yield from asyncio.wait([aiohttp.get(url) for url in URLS])
text_tasks = yield from asyncio.wait(
[ta... | Add ex3.2: multiple aiohttp requests | Add ex3.2: multiple aiohttp requests
| Python | mit | MA3STR0/PythonAsyncWorkshop | ---
+++
@@ -0,0 +1,26 @@
+import asyncio
+import aiohttp
+import time
+
+URLS = [
+ 'http://127.0.0.1:8000',
+ 'http://127.0.0.1:8000',
+ 'http://127.0.0.1:8000',
+]
+
+@asyncio.coroutine
+def request_greetings():
+ response_tasks = yield from asyncio.wait([aiohttp.get(url) for url in URLS])
+ text_tas... | |
d491c60d089e5c6872cb0e0abf8cdd0e0a4e3bee | migrations/0002_auto_20190327_1951.py | migrations/0002_auto_20190327_1951.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-03-27 19:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('downloads', '0001_initial'),
]
operations = [
migrations.AlterField(
... | Update migrations for Django 1.11 and Python 3 | Update migrations for Django 1.11 and Python 3
| Python | mit | mback2k/django-app-downloads,mback2k/django-app-downloads | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-03-27 19:51
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('downloads', '0001_initial'),
+ ]
+
+ operations... | |
586c83a2c72637af611b4a9855e7a057c48163e2 | scripts/delete_sqs_queues.py | scripts/delete_sqs_queues.py | import boto3
import csv
from datetime import datetime
from pprint import pprint
import os
client = boto3.client('sqs', region_name=os.getenv('AWS_REGION'))
def _formatted_date_from_timestamp(timestamp):
return datetime.fromtimestamp(
int(timestamp)
).strftime('%Y-%m-%d %H:%M:%S')
def get_queues():
... | Add a script to delete sqs queues: * Uses boto to retrieve/delete queues * Additional functions to output/read from csv | Add a script to delete sqs queues:
* Uses boto to retrieve/delete queues
* Additional functions to output/read from csv
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,84 @@
+import boto3
+import csv
+from datetime import datetime
+from pprint import pprint
+import os
+
+client = boto3.client('sqs', region_name=os.getenv('AWS_REGION'))
+
+
+def _formatted_date_from_timestamp(timestamp):
+ return datetime.fromtimestamp(
+ int(timestamp)
+ ).strftime('... | |
5921c252cc25eca91c637ed69e0a53719274b42c | day4-2.py | day4-2.py | """Module to find real rooms in data and sum their sector IDs."""
def main():
"""Run the main function."""
with open('data/day4data.txt', 'r') as f:
dataList = f.readlines()
realRoomList = []
roomNames = []
sum = 0
for line in dataList:
data = line.strip("\n").split('-')
... | Add day 4 part 2. | Add day 4 part 2.
| Python | mit | SayWhat1/adventofcode2016 | ---
+++
@@ -0,0 +1,54 @@
+"""Module to find real rooms in data and sum their sector IDs."""
+
+
+def main():
+ """Run the main function."""
+ with open('data/day4data.txt', 'r') as f:
+ dataList = f.readlines()
+
+ realRoomList = []
+ roomNames = []
+ sum = 0
+
+ for line in dataList:
+ ... | |
ad74be9696d54d1c50f83d54791cff8e00db86da | python/takepicture.py | python/takepicture.py | import os
#from pathlib import Path
#import path
import picamera
from time import sleep
from threading import Thread
def takePictureGlobal(picturetaken_callback, peripheral_id):
camera = picamera.PiCamera()
try:
camera.sharpness = 0
camera.contrast = 0
camera.brightness = 70
camera.satu... | Add support of event and camera | Add support of event and camera
| Python | mit | dmayrand/DivAE-client-beta,dmayrand/DivAE-client-beta,dmayrand/Clients-for-actionKATA,dmayrand/Clients-for-actionKATA | ---
+++
@@ -0,0 +1,57 @@
+import os
+#from pathlib import Path
+#import path
+import picamera
+from time import sleep
+from threading import Thread
+
+def takePictureGlobal(picturetaken_callback, peripheral_id):
+ camera = picamera.PiCamera()
+ try:
+ camera.sharpness = 0
+ camera.contrast = 0
+ ... | |
8eaad95972f5ae67d658ad017de466815376f9f0 | remove_nth_node_from_end_of_list.py | remove_nth_node_from_end_of_list.py | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @return a ListNode
def removeNthFromEnd(self, head, n):
if n < 0 or head == None:
return head
d = {}
current = head
l = ... | Remove Nth Node From End of List 58ms should be more optimal | Remove Nth Node From End of List 58ms
should be more optimal
| Python | mit | zhiyelee/leetcode,zhiyelee/leetcode,zhiyelee/leetcode | ---
+++
@@ -0,0 +1,37 @@
+# Definition for singly-linked list.
+class ListNode:
+ def __init__(self, x):
+ self.val = x
+ self.next = None
+
+class Solution:
+ # @return a ListNode
+ def removeNthFromEnd(self, head, n):
+ if n < 0 or head == None:
+ return head
+
+ d = ... | |
c935f85d62d0375d07685eeff14859e5a5a9b161 | tests/test_spotifile.py | tests/test_spotifile.py | import unittest
import os
from subprocess import check_call
from sh import ls
mountpoint = '/tmp/spotifile_test_mount'
class SpotifileTestClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not os.path.exists(mountpoint):
os.mkdir(mountpoint)
@classmethod
def tearDownClass(cls):
if os.path.exis... | Add simple test to check that we populate the root as expected | tests: Add simple test to check that we populate the root as expected
Signed-off-by: Anton Lofgren <64e2cb85477d4abaea4b354af986fde12a3e64f3@op5.com>
| Python | bsd-3-clause | catharsis/spotifile,raoulh/spotifile,chelmertz/spotifile,raoulh/spotifile,raoulh/spotifile,chelmertz/spotifile,chelmertz/spotifile,catharsis/spotifile,catharsis/spotifile | ---
+++
@@ -0,0 +1,26 @@
+import unittest
+import os
+from subprocess import check_call
+from sh import ls
+
+
+mountpoint = '/tmp/spotifile_test_mount'
+class SpotifileTestClass(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ if not os.path.exists(mountpoint):
+ os.mkdir(mountpoint)
+
+ @classmethod
+... | |
959e30bed3dcaee03df929f8ec2848d07c745dc9 | tests/webcam_read_qr.py | tests/webcam_read_qr.py | #!/usr/bin/env python
"""
This module sets up a video stream from internal or connected webcam using Gstreamer.
You can then take snapshots.
import qrtools
qr = qrtools.QR()
qr.decode("cam.jpg")
print qr.data
"""
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0')
from gi.repository import Gt... | Put gst code into Avocado test format. Needs to be edited to take a snapshot and read the qr code. | Put gst code into Avocado test format. Needs to be edited to take a snapshot and read the qr code.
| Python | mit | daveol/Fedora-Test-Laptop,daveol/Fedora-Test-Laptop | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+"""
+This module sets up a video stream from internal or connected webcam using Gstreamer.
+You can then take snapshots.
+
+import qrtools
+qr = qrtools.QR()
+qr.decode("cam.jpg")
+print qr.data
+
+"""
+import gi
+gi.require_version('Gtk', '3.0')
+gi.require_version(... | |
84cf7b425c58a6c1b9c08fb1605cd3b3dfd24b21 | tests/test_utils.py | tests/test_utils.py | from edx_shopify.utils import hmac_is_valid
from django.test import TestCase
class SignatureVerificationTest(TestCase):
def test_hmac_is_valid(self):
correct_hmac = [
('hello', 'world', '8ayXAutfryPKKRpNxG3t3u4qeMza8KQSvtdxTP/7HMQ='),
('bye', 'bye', 'HHfaL+C4HxPTexmlKO9pwEHuAXkErA... | Add a test for signature checking | Add a test for signature checking
| Python | agpl-3.0 | hastexo/edx-shopify,fghaas/edx-shopify | ---
+++
@@ -0,0 +1,24 @@
+from edx_shopify.utils import hmac_is_valid
+from django.test import TestCase
+
+
+class SignatureVerificationTest(TestCase):
+
+ def test_hmac_is_valid(self):
+ correct_hmac = [
+ ('hello', 'world', '8ayXAutfryPKKRpNxG3t3u4qeMza8KQSvtdxTP/7HMQ='),
+ ('bye', '... | |
8a79cf5235bebd514b8eb0a788e4b491e01feea9 | verdenskart/src/utils/data_fetcher.py | verdenskart/src/utils/data_fetcher.py | import logging
import requests
def get_world_topology():
ans = requests.get("https://restcountries.eu/rest/v2/all?fields=name;capital;region;subregion;latlng;alpha3Code;borders")
if ans.status_code != 200:
raise RuntimeError("Unable to get country data")
countries = {country.pop("alpha3Code"): cou... | Read country topology from restcountries.eu | Read country topology from restcountries.eu
| Python | bsd-2-clause | expertanalytics/fagkveld | ---
+++
@@ -0,0 +1,13 @@
+import logging
+import requests
+
+
+def get_world_topology():
+ ans = requests.get("https://restcountries.eu/rest/v2/all?fields=name;capital;region;subregion;latlng;alpha3Code;borders")
+ if ans.status_code != 200:
+ raise RuntimeError("Unable to get country data")
+ countri... | |
dc3bc21e8cf7c0a0244dd7d2584a206656bc8444 | tests/Settings/TestContainerRegistry.py | tests/Settings/TestContainerRegistry.py | # Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import pytest
import os.path
import UM.Settings
from UM.Resources import Resources
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
@pytest.fixture
def container_registry():
Resources.addSearchPath(os.pa... | Add a test for ContainerRegistry | Add a test for ContainerRegistry
| Python | agpl-3.0 | onitake/Uranium,onitake/Uranium | ---
+++
@@ -0,0 +1,36 @@
+# Copyright (c) 2016 Ultimaker B.V.
+# Uranium is released under the terms of the AGPLv3 or higher.
+
+import pytest
+import os.path
+
+import UM.Settings
+
+from UM.Resources import Resources
+from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
+
+@pytest.fixture
+def container_regis... | |
7fe7b751ef61fffd59a751df99a4bfc6715f10f8 | globaleaks/tests/test_storm.py | globaleaks/tests/test_storm.py | from twisted.internet import defer
from twisted.trial import unittest
from storm.twisted.testing import FakeThreadPool
from storm.twisted.transact import transact, Transactor
from storm.locals import *
from storm.databases.sqlite import SQLite
from storm.uri import URI
from globaleaks.db.models import TXModel
from g... | Add unittest for storm to illustrate it's usage. Also useful to understand when and if they break our usage of it. | Add unittest for storm to illustrate it's usage.
Also useful to understand when and if they break our usage of it.
| Python | agpl-3.0 | vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks | ---
+++
@@ -0,0 +1,57 @@
+from twisted.internet import defer
+from twisted.trial import unittest
+
+from storm.twisted.testing import FakeThreadPool
+from storm.twisted.transact import transact, Transactor
+
+from storm.locals import *
+from storm.databases.sqlite import SQLite
+from storm.uri import URI
+
+from glob... | |
b98fee0ccb127dbca6f1c20bb1c1025a20cb1e7c | teknologr/members/migrations/0015_auto_20181119_2256.py | teknologr/members/migrations/0015_auto_20181119_2256.py | # Generated by Django 2.1.2 on 2018-11-19 20:56
from django.db import migrations
def move_phone_numbers(apps, schema_editor):
Member = apps.get_model('members', 'Member')
for member in Member.objects.all():
if member.mobile_phone:
member.phone = member.mobile_phone
member.save... | Add data migrations for moving phone numbers to phone field | Add data migrations for moving phone numbers to phone field
| Python | mit | Teknologforeningen/teknologr.io,Teknologforeningen/teknologr.io,Teknologforeningen/teknologr.io,Teknologforeningen/teknologr.io | ---
+++
@@ -0,0 +1,21 @@
+# Generated by Django 2.1.2 on 2018-11-19 20:56
+
+from django.db import migrations
+
+def move_phone_numbers(apps, schema_editor):
+ Member = apps.get_model('members', 'Member')
+
+ for member in Member.objects.all():
+ if member.mobile_phone:
+ member.phone = member... | |
a7ab2de6b55e02e3946cb16e2fabecad92731ebd | src/sample_image.py | src/sample_image.py | __author__ = 'team-entaku'
import cv2
import sys
if __name__ == "__main__":
file_name = sys.argv[1]
im = cv2.imread(file_name, 0)
cv2.imshow('im', im)
cv2.waitKey(0)
cv2.destroyAllWindows()
| Add a sample for a reading image | Add a sample for a reading image
| Python | mit | entaku/kusarigama | ---
+++
@@ -0,0 +1,11 @@
+__author__ = 'team-entaku'
+
+import cv2
+import sys
+
+if __name__ == "__main__":
+ file_name = sys.argv[1]
+ im = cv2.imread(file_name, 0)
+ cv2.imshow('im', im)
+ cv2.waitKey(0)
+ cv2.destroyAllWindows() | |
92a42c693cc5c38c0d02174722a87217fdd2eb3b | oweb/libs/shortcuts.py | oweb/libs/shortcuts.py | # app imports
from oweb.exceptions import OWebDoesNotExist
def get_object_or_404(klass, *args, **kwargs):
"""
Uses get() to return an object, or raises a Http404 exception if the object
does not exist.
klass may be a Model, Manager, or QuerySet object. All other passed
arguments and keyword argume... | Make our own version of get_object_or_404 and get_list_or_404 | Make our own version of get_object_or_404 and get_list_or_404
| Python | mit | Mischback/django-oweb,Mischback/django-oweb | ---
+++
@@ -0,0 +1,33 @@
+# app imports
+from oweb.exceptions import OWebDoesNotExist
+
+def get_object_or_404(klass, *args, **kwargs):
+ """
+ Uses get() to return an object, or raises a Http404 exception if the object
+ does not exist.
+
+ klass may be a Model, Manager, or QuerySet object. All other pas... | |
e32ace92c94e83b82bddf1ad348621c408b47a24 | tests/test_overlap.py | tests/test_overlap.py | import nose
import cle
import os
class MockBackend(cle.backends.Backend):
def __init__(self, requested_base, size, **kwargs):
super(MockBackend, self).__init__('/dev/zero', **kwargs)
self.requested_base = requested_base
self.size = size
def get_max_addr(self):
return self.rebas... | Add test case for object overlapping and requested base addresses | Add test case for object overlapping and requested base addresses
| Python | bsd-2-clause | angr/cle | ---
+++
@@ -0,0 +1,30 @@
+import nose
+import cle
+import os
+
+class MockBackend(cle.backends.Backend):
+ def __init__(self, requested_base, size, **kwargs):
+ super(MockBackend, self).__init__('/dev/zero', **kwargs)
+ self.requested_base = requested_base
+ self.size = size
+
+ def get_max... | |
1d2dcd5a777119cbfb98274d73ee14c9190f1c24 | tests/test_scraper.py | tests/test_scraper.py | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2013 Bastian Kleineidam
from unittest import TestCase
from dosagelib import scraper
class ScraperTester(TestCase):
"""Test scraper module functions."""
def test_get_scraperclasses(self):
for scraperclass in scraper.get_scraperclasses():
scraper... | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2013 Bastian Kleineidam
from unittest import TestCase
from dosagelib import scraper
class ScraperTester(TestCase):
"""Test scraper module functions."""
def test_get_scraperclasses(self):
for scraperclass in scraper.get_scraperclasses():
scraper... | Test for URL in every scraper. | Test for URL in every scraper.
| Python | mit | peterjanes/dosage,webcomics/dosage,Freestila/dosage,mbrandis/dosage,blade2005/dosage,webcomics/dosage,peterjanes/dosage,mbrandis/dosage,Freestila/dosage,wummel/dosage,wummel/dosage,blade2005/dosage | ---
+++
@@ -9,8 +9,10 @@
def test_get_scraperclasses(self):
for scraperclass in scraper.get_scraperclasses():
- scraperclass()
- scraperclass(indexes=["bla"])
+ scraperobj = scraperclass()
+ scraperobj = scraperclass(indexes=["bla"])
+ self.assert... |
cad64c150479adcd9db07a8d3fb65d81f49b6d1e | locations/spiders/superonefoods.py | locations/spiders/superonefoods.py | # -*- coding: utf-8 -*-
import json
import scrapy
import re
from locations.items import GeojsonPointItem
class SuperonefoodsSpider(scrapy.Spider):
name = "superonefoods"
allowed_domains = ["www.superonefoods.com"]
start_urls = (
'https://www.superonefoods.com/store-finder',
)
def parse(self, response):
# re... | Add Spider to Wilco Fram Stores | Add Spider to Wilco Fram Stores
| Python | mit | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | ---
+++
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+import json
+import scrapy
+import re
+
+from locations.items import GeojsonPointItem
+
+class SuperonefoodsSpider(scrapy.Spider):
+ name = "superonefoods"
+ allowed_domains = ["www.superonefoods.com"]
+ start_urls = (
+ 'https://www.superonefoods.com/store-finder',... | |
4f6488cbb42e552daa67ee04159072fb9669a75e | tests/unit/test_packaging.py | tests/unit/test_packaging.py | import pytest
from pip._vendor.packaging import specifiers
from pip._internal.utils.packaging import check_requires_python
@pytest.mark.parametrize('version_info, requires_python, expected', [
((3, 6, 5), '== 3.6.4', False),
((3, 6, 5), '== 3.6.5', True),
((3, 6, 5), None, True),
])
def test_check_requir... | Add some tests for check_requires_python(). | Add some tests for check_requires_python().
| Python | mit | rouge8/pip,rouge8/pip,sbidoul/pip,pradyunsg/pip,pfmoore/pip,xavfernandez/pip,pradyunsg/pip,xavfernandez/pip,pfmoore/pip,pypa/pip,xavfernandez/pip,sbidoul/pip,rouge8/pip,pypa/pip | ---
+++
@@ -0,0 +1,22 @@
+import pytest
+from pip._vendor.packaging import specifiers
+
+from pip._internal.utils.packaging import check_requires_python
+
+
+@pytest.mark.parametrize('version_info, requires_python, expected', [
+ ((3, 6, 5), '== 3.6.4', False),
+ ((3, 6, 5), '== 3.6.5', True),
+ ((3, 6, 5), ... | |
d218b92cb598801a6fbca5421f216860107d7956 | apps/curia_vista/management/commands/update_departments.py | apps/curia_vista/management/commands/update_departments.py | from xml.etree import ElementTree
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
import requests
from apps.curia_vista.models import *
class Command(BaseCommand):
help = 'Import departments from parlament.ch'
@transaction.atomic
def handle(self, *args... | Add import script for department data | Add import script for department data
| Python | agpl-3.0 | rettichschnidi/politkarma,rettichschnidi/politkarma,rettichschnidi/politkarma,rettichschnidi/politkarma | ---
+++
@@ -0,0 +1,38 @@
+from xml.etree import ElementTree
+from django.core.management.base import BaseCommand, CommandError
+from django.db import transaction
+import requests
+
+from apps.curia_vista.models import *
+
+
+class Command(BaseCommand):
+ help = 'Import departments from parlament.ch'
+
+ @transa... | |
5806153edfde7d6e27b628c38eb0f9333642711d | sydent/http/servlets/getvalidated3pidservlet.py | sydent/http/servlets/getvalidated3pidservlet.py | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright 2014 matrix.org
#
# 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 req... | Add the file for the new servlet | Add the file for the new servlet
| Python | apache-2.0 | matrix-org/sydent,matrix-org/sydent,matrix-org/sydent | ---
+++
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+
+# -*- coding: utf-8 -*-
+
+# Copyright 2014 matrix.org
+#
+# 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.o... | |
814f2aafebc04d75d4f3d99fa42b09c6054a2b16 | domainchecks/tests/test_commands.py | domainchecks/tests/test_commands.py | from datetime import timedelta
from io import StringIO
from unittest.mock import Mock, patch
from django.core.management import call_command
from django.test import TestCase
from . import factories
class CheckDomainsCommandTestCase(TestCase):
"""Management command for running the domain checks."""
def call... | Add tests for the checkdomains command. | Add tests for the checkdomains command.
| Python | bsd-2-clause | mlavin/video-examples,mlavin/video-examples,mlavin/video-examples | ---
+++
@@ -0,0 +1,71 @@
+from datetime import timedelta
+from io import StringIO
+from unittest.mock import Mock, patch
+
+from django.core.management import call_command
+from django.test import TestCase
+
+from . import factories
+
+
+class CheckDomainsCommandTestCase(TestCase):
+ """Management command for runn... | |
2dc179a309dd4152193de8b2d34a3c25150b1128 | deposit/osf/migrations/0001_initial.py | deposit/osf/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-08-28 11:43
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... | Add migration for OSF model | Add migration for OSF model
| Python | agpl-3.0 | wetneb/dissemin,wetneb/dissemin,wetneb/dissemin,dissemin/dissemin,dissemin/dissemin,dissemin/dissemin,wetneb/dissemin,dissemin/dissemin,dissemin/dissemin | ---
+++
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10 on 2017-08-28 11:43
+from __future__ import unicode_literals
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+... | |
7a17603060c488875109ec1bee42eeafbf11bdcf | exercises/test_stack_balanced_parents.py | exercises/test_stack_balanced_parents.py | #!/usr/local/bin/python3
"""
Unittest for stack_balanced_parens.py
"""
import stack_balanced_parens
import unittest
class TestStackParens(unittest.TestCase):
def test_balanced(self):
expression = "{[()]}"
self.assertTrue(stack_balanced_parens.isBalanced(expression))
def test_unbalanced(self):
... | Add unit test for stack_balanced_parens.py | Add unit test for stack_balanced_parens.py
| Python | mit | myleneh/code | ---
+++
@@ -0,0 +1,26 @@
+#!/usr/local/bin/python3
+"""
+Unittest for stack_balanced_parens.py
+"""
+import stack_balanced_parens
+import unittest
+
+class TestStackParens(unittest.TestCase):
+ def test_balanced(self):
+ expression = "{[()]}"
+ self.assertTrue(stack_balanced_parens.isBalanced(express... | |
385e7194e8cf7db736001e50023cc13fbba27366 | py/bulb-switcher-ii.py | py/bulb-switcher-ii.py | from itertools import combinations, cycle, islice
class Solution(object):
def flipLights(self, n, m):
"""
:type n: int
:type m: int
:rtype: int
"""
if m > 4:
return self.flipLights(n, 4 - m % 2)
if n > 6:
return self.flipLights(6, m)
... | Add py solution for 672. Bulb Switcher II | Add py solution for 672. Bulb Switcher II
672. Bulb Switcher II: https://leetcode.com/problems/bulb-switcher-ii/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,28 @@
+from itertools import combinations, cycle, islice
+class Solution(object):
+ def flipLights(self, n, m):
+ """
+ :type n: int
+ :type m: int
+ :rtype: int
+ """
+ if m > 4:
+ return self.flipLights(n, 4 - m % 2)
+ if n > 6:
+ ... | |
d818cabe31867de6b23035b309d15ba0ba12117b | dockci/migrations/0005.py | dockci/migrations/0005.py | """
Rename "build" models to "job" models
"""
import py.path
import yaml
from yaml import safe_load as yaml_load
builds_path = py.path.local().join('data', 'builds')
jobs_path = py.path.local().join('data', 'jobs')
for project_path in builds_path.listdir():
build_files = project_path.listdir(
lambda fil... | Add build -> job migration | Add build -> job migration
| Python | isc | RickyCook/DockCI,sprucedev/DockCI,RickyCook/DockCI,sprucedev/DockCI,RickyCook/DockCI,sprucedev/DockCI-Agent,RickyCook/DockCI,sprucedev/DockCI-Agent,sprucedev/DockCI,sprucedev/DockCI | ---
+++
@@ -0,0 +1,28 @@
+"""
+Rename "build" models to "job" models
+"""
+import py.path
+import yaml
+
+from yaml import safe_load as yaml_load
+
+
+builds_path = py.path.local().join('data', 'builds')
+jobs_path = py.path.local().join('data', 'jobs')
+
+for project_path in builds_path.listdir():
+ build_files =... | |
da590cef665abf8898ab056bb8048c3541df181f | src/server/RemoteFunctionCaller.py | src/server/RemoteFunctionCaller.py | import time
class TimeoutError(Exception):
pass
class RemoteError(Exception):
pass
class RemoteFunction:
def __init__(self, sender, seq, name, timeout=5, timeoutCb = None):
self.sender = sender
self.seq = seq
self.name = name
self.timeout = timeout
self.timeoutCb =... | Add class for transparently calling functions over a socket | Add class for transparently calling functions over a socket
| Python | mit | cnlohr/bridgesim,cnlohr/bridgesim,cnlohr/bridgesim,cnlohr/bridgesim | ---
+++
@@ -0,0 +1,70 @@
+import time
+
+class TimeoutError(Exception):
+ pass
+
+class RemoteError(Exception):
+ pass
+
+class RemoteFunction:
+ def __init__(self, sender, seq, name, timeout=5, timeoutCb = None):
+ self.sender = sender
+ self.seq = seq
+ self.name = name
+ self.t... | |
2c3c073298d134e13d100f84877c5065c3d60fdd | batdisplay.py | batdisplay.py | #!/usr/bin/python
import os # for instance management
from gi.repository import Gtk, Gdk, GObject
# milliseconds of window getting displayed
DISPLAY_DURATION = 4000
# this will get set in order to keep this obj. alive while
LIVING_ID = False
# path to a temporary file for a pid.
MY_BAT_WARNING_PATH = "/tmp/battery... | Add gtk window containing some warning text, very similar to former display classes. | Add gtk window containing some warning text, very similar to former display classes.
| Python | mit | 0ortmann/SysDisplays | ---
+++
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+
+import os # for instance management
+from gi.repository import Gtk, Gdk, GObject
+
+# milliseconds of window getting displayed
+DISPLAY_DURATION = 4000
+
+# this will get set in order to keep this obj. alive while
+LIVING_ID = False
+
+# path to a temporary file for a p... | |
d960d614be9ddbdad997e57458b4634f591d79ad | pony_stable/build-testutils.py | pony_stable/build-testutils.py | import sys
from base_django import DjangoBuild
from pony_build import client as pony
class TestUtilsBuild(DjangoBuild):
def __init__(self):
super(TestUtilsBuild, self).__init__()
self.repo_url = "git://github.com/ericholscher/django-test-utils"
self.name = "django-test-utils"
self.... | Add a build for Django Test Utils. | Add a build for Django Test Utils.
| Python | mit | ericholscher/pony_barn,ericholscher/pony_barn | ---
+++
@@ -0,0 +1,25 @@
+import sys
+from base_django import DjangoBuild
+from pony_build import client as pony
+
+class TestUtilsBuild(DjangoBuild):
+
+ def __init__(self):
+ super(TestUtilsBuild, self).__init__()
+ self.repo_url = "git://github.com/ericholscher/django-test-utils"
+ self.nam... | |
59db12020433e4787555cfeccaeae65f872f59b6 | tests/test_html_formatter.py | tests/test_html_formatter.py | # -*- coding: utf-8 -*-
"""
Pygments HTML formatter tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2006 by Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
import unittest
import StringIO
import random
from pygments import lexers, formatters
from pygments.token import _TokenType
class... | Add a reminder to write a HTML formatter test. | [svn] Add a reminder to write a HTML formatter test.
| Python | bsd-2-clause | tomstuart/pygments,spencerlyon2/pygments,erickt/pygments,tomstuart/pygments,erickt/pygments,tomstuart/pygments,spencerlyon2/pygments,tomstuart/pygments,spencerlyon2/pygments,erickt/pygments,tomstuart/pygments,erickt/pygments,erickt/pygments,erickt/pygments,tomstuart/pygments,erickt/pygments,erickt/pygments,erickt/pygme... | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+"""
+ Pygments HTML formatter tests
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ :copyright: 2006 by Georg Brandl.
+ :license: BSD, see LICENSE for more details.
+"""
+
+import unittest
+import StringIO
+import random
+
+from pygments import lexers, formatters
+fr... | |
fe4bf332628b104865ca79a218800c0182c9faaa | teuthology/test/test_lock.py | teuthology/test/test_lock.py | from .. import lock
class TestLock(object):
def test_canonicalize_hostname(self):
host_base = 'box1'
result = lock.canonicalize_hostname(host_base)
assert result == 'ubuntu@box1.front.sepia.ceph.com'
def test_decanonicalize_hostname(self):
host = 'ubuntu@box1.front.sepia.ceph... | Add unit tests for (de)canonicalize_hostname() | Add unit tests for (de)canonicalize_hostname()
Signed-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com>
| Python | mit | dmick/teuthology,caibo2014/teuthology,ivotron/teuthology,ceph/teuthology,tchaikov/teuthology,michaelsevilla/teuthology,dreamhost/teuthology,yghannam/teuthology,SUSE/teuthology,ktdreyer/teuthology,t-miyamae/teuthology,t-miyamae/teuthology,SUSE/teuthology,robbat2/teuthology,SUSE/teuthology,robbat2/teuthology,tchaikov/teu... | ---
+++
@@ -0,0 +1,14 @@
+from .. import lock
+
+
+class TestLock(object):
+
+ def test_canonicalize_hostname(self):
+ host_base = 'box1'
+ result = lock.canonicalize_hostname(host_base)
+ assert result == 'ubuntu@box1.front.sepia.ceph.com'
+
+ def test_decanonicalize_hostname(self):
+ ... | |
f782fe44d7a27e01a7529922040768a657432a4b | app.py | app.py | from flask import Flask, jsonify, Response
app = Flask(__name__)
@app.route('/')
def api_root():
message = {
'status': 200,
'message': 'Hello World'
}
resp = jsonify(message)
resp.status_code = 200
return resp
@app.errorhandler(404)
def not_found(error=None):
message =... | Add basic Hello World example | Add basic Hello World example
| Python | apache-2.0 | apache/cloudstack-gcestack | ---
+++
@@ -0,0 +1,27 @@
+from flask import Flask, jsonify, Response
+app = Flask(__name__)
+
+@app.route('/')
+def api_root():
+ message = {
+ 'status': 200,
+ 'message': 'Hello World'
+ }
+ resp = jsonify(message)
+ resp.status_code = 200
+
+ return resp
+
+@app.errorhandler(404... | |
cfb190ea86ea64f23a882a6e8b4212388c351d21 | scripts/clean_array.py | scripts/clean_array.py | import glob
import os
import shutil
import sys
ample_root="/home/jmht/ample-dev1"
sys.path.insert(0,os.path.join(ample_root,"python"))
import clusterize
pdb_codes=["1MIX", "1P9G", "1UCS", "1XKR", "2BL2", "2EFR", "2FM9", "2JKU", "2QIH", "2QSK", "2UUI", "2XFD", "2YKT", "3CI9", "3CVF", "3GD8", "3GHF", "3HAP", "3HFE"]
#... | CLean up crashed array jobs | CLean up crashed array jobs
| Python | bsd-3-clause | rigdenlab/ample,rigdenlab/ample,linucks/ample,linucks/ample | ---
+++
@@ -0,0 +1,21 @@
+import glob
+import os
+import shutil
+import sys
+
+ample_root="/home/jmht/ample-dev1"
+sys.path.insert(0,os.path.join(ample_root,"python"))
+
+import clusterize
+
+pdb_codes=["1MIX", "1P9G", "1UCS", "1XKR", "2BL2", "2EFR", "2FM9", "2JKU", "2QIH", "2QSK", "2UUI", "2XFD", "2YKT", "3CI9", "3C... | |
dfd4396d616c07b69be4acb1f974bf5b4c3e4ffb | scripts/create-user.py | scripts/create-user.py | #!/usr/bin/python
# This is a small helper script to create a CATMAID user.
# You may need to install psycopg2, e.g. with:
# sudo apt-get install python-psycopg2
# Requires the file .catmaid-db to be present in your
# home directory, with the following format:
#
# host: localhost
# database: catmaid
# username: ca... | Add a script for creating a new user | Add a script for creating a new user
| Python | agpl-3.0 | htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+# This is a small helper script to create a CATMAID user.
+
+# You may need to install psycopg2, e.g. with:
+# sudo apt-get install python-psycopg2
+
+# Requires the file .catmaid-db to be present in your
+# home directory, with the following format:
+#
+# host: localh... | |
eb5f4c24965a60c36656118da92aeb0ca9736608 | altair/examples/airport_connections.py | altair/examples/airport_connections.py | """
Connections Among U.S. Airports Interactive
-------------------------------------------
This example shows all the connections between major U.S. airports. Lookup transformations
are used to find the coordinates of each airport and connecting airports. Connections
are displayed on mouseover via a single selection... | Add example for Connections Among U.S. Airports Interactive | DOC: Add example for Connections Among U.S. Airports Interactive
| Python | bsd-3-clause | jakevdp/altair,altair-viz/altair | ---
+++
@@ -0,0 +1,69 @@
+"""
+Connections Among U.S. Airports Interactive
+-------------------------------------------
+This example shows all the connections between major U.S. airports. Lookup transformations
+are used to find the coordinates of each airport and connecting airports. Connections
+are displayed on... | |
e956e2258037e698adcf86a57085bdb2aa7576e5 | competitions/urls.py | competitions/urls.py | from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from .views import CompetitionRegistrationView, SeasonDetailView
urlpatterns = patterns('',
url(r'^$', CompetitionRegistrationView.as_view(),
name='competitions_competition_register'),
url(r'^registration/successf... | from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from .views import CompetitionRegistrationView, SeasonDetailView
urlpatterns = patterns('',
url(r'^$', CompetitionRegistrationView.as_view(),
name='competitions_competition_register'),
url(r'^registration/successf... | Correct url of the SeasonDetailView | competitions: Correct url of the SeasonDetailView
| Python | mit | rtrembecky/roots,rtrembecky/roots,tbabej/roots,matus-stehlik/roots,matus-stehlik/roots,matus-stehlik/roots,matus-stehlik/glowing-batman,tbabej/roots,tbabej/roots,matus-stehlik/glowing-batman,rtrembecky/roots | ---
+++
@@ -9,6 +9,6 @@
url(r'^registration/successful/', TemplateView.as_view(
template_name='competitions/competition_registration_successful.html'),
name='competitions_competition_register_success'),
- url(r'^series/(?P<pk>\d+)$', SeasonDetailView.as_view(),
+ url(r'^season/(?P<pk>\d+)... |
e2627f3c98c45791a23fd80fcdc80f5aaf8acf4c | terminus/tests/city_visitor_test.py | terminus/tests/city_visitor_test.py | import unittest
import mock
from generators.city_visitor import CityVisitor
class CityVisitorTest(unittest.TestCase):
def test_city_visitor(self):
city = mock.Mock()
visitor = CityVisitor(city)
visitor.run()
city.accept.assert_called()
| Add test for city visitor. | Add test for city visitor.
| Python | apache-2.0 | ekumenlabs/terminus,ekumenlabs/terminus | ---
+++
@@ -0,0 +1,13 @@
+import unittest
+import mock
+
+from generators.city_visitor import CityVisitor
+
+
+class CityVisitorTest(unittest.TestCase):
+
+ def test_city_visitor(self):
+ city = mock.Mock()
+ visitor = CityVisitor(city)
+ visitor.run()
+ city.accept.assert_called() | |
a3c55d151a1a358f04d431b28e8512b68337825a | kremlin/forms.py | kremlin/forms.py | """
# # #### ##### # # ##### # # # #
# # # # # ## ## # # # ## # #
### #### #### # # # # # # # # #####
# # # # # # # # ## # # #
# # # ##### # # # # # # # #
Kremlin Mag... | Add WTForms version of upload form, WTForms is miles better. | Add WTForms version of upload form, WTForms is miles better.
| Python | bsd-2-clause | glasnost/kremlin,glasnost/kremlin,glasnost/kremlin | ---
+++
@@ -0,0 +1,38 @@
+"""
+ # # #### ##### # # ##### # # # #
+ # # # # # ## ## # # # ## # #
+ ### #### #### # # # # # # # # #####
+ # # # # # # # # ## # # #
+ # # # ##### # # # # # # # ... | |
ae46fab579822b0aaffeca271b50b2a2d89e3909 | tests/app/main/test_application.py | tests/app/main/test_application.py | import mock
from nose.tools import assert_equal, assert_true
from ..helpers import BaseApplicationTest
class TestApplication(BaseApplicationTest):
def setup(self):
super(TestApplication, self).setup()
def test_analytics_code_should_be_in_javascript(self):
res = self.client.get('/suppliers/sta... | Add test for analytics JavaScript | Add test for analytics JavaScript
| Python | mit | alphagov/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,alphag... | ---
+++
@@ -0,0 +1,15 @@
+import mock
+from nose.tools import assert_equal, assert_true
+from ..helpers import BaseApplicationTest
+
+
+class TestApplication(BaseApplicationTest):
+ def setup(self):
+ super(TestApplication, self).setup()
+
+ def test_analytics_code_should_be_in_javascript(self):
+ ... | |
b1fc5436ecf69d1fe5852568fb1e8e551c7bd9b3 | pfile_tools/scripts/dump_pfile_header.py | pfile_tools/scripts/dump_pfile_header.py | #!/usr/bin/env python
import sys
import optparse
from pfile_tools import headers, struct_utils
def known_revisions():
return sorted(headers.REVISIONS().keys())
def build_option_parser():
revision_opt_strs = ", ".join([str(r) for r in known_revisions()])
p = optparse.OptionParser(
usage="usage: ... | Add friendly header dumper program. | Add friendly header dumper program. | Python | bsd-3-clause | njvack/pfile-tools | ---
+++
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+import sys
+import optparse
+
+from pfile_tools import headers, struct_utils
+
+def known_revisions():
+ return sorted(headers.REVISIONS().keys())
+
+
+def build_option_parser():
+ revision_opt_strs = ", ".join([str(r) for r in known_revisions()])
+ p = optp... | |
352fa259d439a9be5c299470868e2fa82ecd835f | client/python/tests/unittest_runner.py | client/python/tests/unittest_runner.py | #!/usr/bin/env python
import os
import re
import sys
import shutil
import subprocess
__author__ = "Christopher Choi <chutsu@gmail.com>"
# SETTINGS
keep_unittest_logs = False
unittests_bin_dir = "tests"
unittests_log_dir = "unittests_log"
unittests_file_pattern = "^[a-zA-Z0-9_]*_tests.*$"
class TC:
HEADER = '\0... | Add test folder for python | Add test folder for python
| Python | apache-2.0 | wallarelvo/backfire,wallarelvo/backfire | ---
+++
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+import os
+import re
+import sys
+import shutil
+import subprocess
+
+
+__author__ = "Christopher Choi <chutsu@gmail.com>"
+
+
+# SETTINGS
+keep_unittest_logs = False
+unittests_bin_dir = "tests"
+unittests_log_dir = "unittests_log"
+unittests_file_pattern = "^[a-zA-Z0... | |
d62201e3be36c1dff0276800d2c0f765572a1abb | src/WaveBlocksND/Quadrature.py | src/WaveBlocksND/Quadrature.py | """The WaveBlocks Project
@author: R. Bourquin
@copyright: Copyright (C) 2013 R. Bourquin
@license: Modified BSD License
"""
__all__ = ["Quadrature"]
class Quadrature(object):
r"""This class is an abstract interface to quadratures in general.
"""
def __init__(self):
r"""General interface for q... | Define interface for quadrature evaluator (first try) | Define interface for quadrature evaluator (first try)
| Python | bsd-3-clause | WaveBlocks/WaveBlocksND,WaveBlocks/WaveBlocksND | ---
+++
@@ -0,0 +1,79 @@
+"""The WaveBlocks Project
+
+
+@author: R. Bourquin
+@copyright: Copyright (C) 2013 R. Bourquin
+@license: Modified BSD License
+"""
+
+__all__ = ["Quadrature"]
+
+
+class Quadrature(object):
+ r"""This class is an abstract interface to quadratures in general.
+ """
+
+ def __init__... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.