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 |
|---|---|---|---|---|---|---|---|---|---|---|
c90d7ae2a407f626342786101eed4159dfbfe730 | infra/bots/assets/go_deps/create.py | infra/bots/assets/go_deps/create.py | #!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Create the asset."""
import argparse
import os
import subprocess
def create_asset(target_dir):
"""Create the asset."""
env = {}
env.update(os.enviro... | #!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Create the asset."""
import argparse
import os
import subprocess
def create_asset(target_dir):
"""Create the asset."""
env = {}
env.update(os.enviro... | Add missing symlink target in go_deps asset | [infra] Add missing symlink target in go_deps asset
Bug: skia:
Change-Id: Ic806bddcdc1130e9b96158c19dbff9e16900020c
Reviewed-on: https://skia-review.googlesource.com/157565
Reviewed-by: Ravi Mistry <9fa2e7438b8cb730f96b74865492597170561628@google.com>
Commit-Queue: Eric Boren <0e499112533c8544f0505ea0d08394fb5ad7d8fa@... | Python | bsd-3-clause | HalCanary/skia-hc,aosp-mirror/platform_external_skia,rubenvb/skia,HalCanary/skia-hc,google/skia,rubenvb/skia,aosp-mirror/platform_external_skia,Hikari-no-Tenshi/android_external_skia,rubenvb/skia,google/skia,rubenvb/skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,google/skia,HalCanary/skia-hc,google/skia,aosp... | ---
+++
@@ -22,6 +22,11 @@
subprocess.check_call(
['go', 'get', '-u', '-t', 'go.skia.org/infra/...'],
env=env)
+ # There's a broken symlink which causes a lot of problems. Create the dir it
+ # points to.
+ missing_dir = os.path.join(target_dir, 'src', 'go.chromium.org', 'luci',
+ ... |
8431eaf1f7d4e966694c14be2130b91190df140e | supermega/tests/test_session.py | supermega/tests/test_session.py | import unittest
import hashlib
from .. import Session
class TestSession(unittest.TestCase):
def setUp(self):
self.sess = Session()
def test_public_file_download(self):
url = 'https://mega.co.nz/#!2ctGgQAI!AkJMowjRiXVcSrRLn3d-e1vl47ZxZEK0CbrHGIKFY-E'
sha256 = '9431103cb989f2913cbc503767015ca22c0ae40942932186c... | Add test for downloading a public file | Add test for downloading a public file
| Python | bsd-3-clause | lmb/Supermega | ---
+++
@@ -0,0 +1,22 @@
+import unittest
+import hashlib
+
+from .. import Session
+
+class TestSession(unittest.TestCase):
+ def setUp(self):
+ self.sess = Session()
+
+ def test_public_file_download(self):
+ url = 'https://mega.co.nz/#!2ctGgQAI!AkJMowjRiXVcSrRLn3d-e1vl47ZxZEK0CbrHGIKFY-E'
+ sha256 = '9431103cb9... | |
a38e194961f4f1d675b9e0397b0c8a5fc2500b08 | python_scripts/mc_solr.py | python_scripts/mc_solr.py | import requests
import ipdb
import mc_config
import psycopg2
import psycopg2.extras
import time
def get_solr_location():
##TODO -- get this from the yaml file
return 'http://localhost:8983'
def get_solr_collection_url_prefix():
return get_solr_location + '/solr/collection1'
def solr_request( path, params... | Create a wrapper library around Solr requests. | Create a wrapper library around Solr requests.
| Python | agpl-3.0 | AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT... | ---
+++
@@ -0,0 +1,49 @@
+import requests
+import ipdb
+import mc_config
+import psycopg2
+import psycopg2.extras
+import time
+
+def get_solr_location():
+ ##TODO -- get this from the yaml file
+ return 'http://localhost:8983'
+
+def get_solr_collection_url_prefix():
+ return get_solr_location + '/solr/coll... | |
896c287ad6a5d927febaca4fa957708f783fd51a | shinken/modules/logstore_null.py | shinken/modules/logstore_null.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | Add a null LogStore backend for livestatus broker | Add a null LogStore backend for livestatus broker
| Python | agpl-3.0 | claneys/shinken,KerkhoffTechnologies/shinken,Simage/shinken,Simage/shinken,claneys/shinken,dfranco/shinken,gst/alignak,h4wkmoon/shinken,mohierf/shinken,geektophe/shinken,KerkhoffTechnologies/shinken,geektophe/shinken,mohierf/shinken,titilambert/alignak,tal-nino/shinken,staute/shinken_package,lets-software/shinken,geekt... | ---
+++
@@ -0,0 +1,103 @@
+#!/usr/bin/python
+
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2009-2012:
+# Gabes Jean, naparuba@gmail.com
+# Gerhard Lausser, Gerhard.Lausser@consol.de
+# Gregory Starck, g.starck@gmail.com
+# Hartmut Goebel, h.goebel@goebel-consult.de
+#
+# This file is part of Shinken.
+#
+... | |
3c7c9e9ecd5d91b81b28737aa5557437297f6548 | src/4-MedianOfTwoSortedArrays.py | src/4-MedianOfTwoSortedArrays.py | class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
m, n = len(nums1), len(nums2)
if m > n:
nums1, nums2, m, n = nums2, nums1, n, m
if n == 0:
... | Revert "Revert "Your runtime beats 53.69% of pythonsubmissions."" | Revert "Revert "Your runtime beats 53.69% of pythonsubmissions.""
This reverts commit 8f36076e50ed375246c1fd23ed9f0e6ed7152e88.
| Python | apache-2.0 | zhuxiang/LeetCode-Python | ---
+++
@@ -0,0 +1,39 @@
+class Solution(object):
+ def findMedianSortedArrays(self, nums1, nums2):
+ """
+ :type nums1: List[int]
+ :type nums2: List[int]
+ :rtype: float
+ """
+ m, n = len(nums1), len(nums2)
+ if m > n:
+ nums1, nums2, m, n = nums2, num... | |
8fd2f0fe7835da72fd230f48ff34cf0c4723babf | personalized_content_filter/main.py | personalized_content_filter/main.py | import csv
import indicoio
from indicoio.custom import Collection
# insert your API key
indicoio.config.api_key = "YOUR_API_KEY"
def clean_article(article):
return article.replace("\n", " ").decode('cp1252').encode('utf-8', 'replace')
def test_model(test_list):
cleaned_test = [clean_article(text) for row... | Create script for Personalized Content Filter post | Create script for Personalized Content Filter post | Python | mit | IndicoDataSolutions/SuperCell | ---
+++
@@ -0,0 +1,23 @@
+import csv
+import indicoio
+from indicoio.custom import Collection
+
+# insert your API key
+indicoio.config.api_key = "YOUR_API_KEY"
+
+def clean_article(article):
+ return article.replace("\n", " ").decode('cp1252').encode('utf-8', 'replace')
+
+def test_model(test_list):
+ clea... | |
a501b99fa60ca5118d2a0e0be4e8c2dff5bd385d | ci/check-benchmark.py | ci/check-benchmark.py | #!/usr/bin/env python3
import json
import sys
def run_compare(report):
with open(report) as f:
doc = json.load(f)
for testcase in doc:
measurements = testcase['measurements']
time = float(measurements[0]["time"])
if time < 0:
continue
if time > 0.05:
... | Add a script to process benchmark comparisons | CI: Add a script to process benchmark comparisons
| Python | lgpl-2.1 | chouquette/medialibrary,chouquette/medialibrary,chouquette/medialibrary,chouquette/medialibrary | ---
+++
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+import json
+import sys
+
+def run_compare(report):
+ with open(report) as f:
+ doc = json.load(f)
+
+ for testcase in doc:
+ measurements = testcase['measurements']
+ time = float(measurements[0]["time"])
+ if time < 0:
+ ... | |
9edb1098aa7a4993d801550d03399fd85450b0c0 | regscrape/regs_common/commands/mark_searchable_entities.py | regscrape/regs_common/commands/mark_searchable_entities.py | GEVENT = False
def run():
from regs_models import Entity
print "Updating entity search index..."
# mark the ones that should be searchable but aren't as searchable
Entity.objects(__raw__={
'td_type': 'organization',
'stats.count': {'$gt': 0},
'searchable': False
}).update(... | Add a tiny bit of infrastructure to make Mongo-based search work for entities. | Add a tiny bit of infrastructure to make Mongo-based search work for entities.
| Python | bsd-3-clause | sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper | ---
+++
@@ -0,0 +1,24 @@
+GEVENT = False
+
+def run():
+ from regs_models import Entity
+
+ print "Updating entity search index..."
+
+ # mark the ones that should be searchable but aren't as searchable
+ Entity.objects(__raw__={
+ 'td_type': 'organization',
+ 'stats.count': {'$gt': 0},
+ ... | |
bdb30f79722b5111a240f2724cdd12ac353493a7 | kpi/tests/api/v1/test_api_exports.py | kpi/tests/api/v1/test_api_exports.py | # coding: utf-8
from collections import defaultdict
from rest_framework import status
from rest_framework.reverse import reverse
from kpi.models import Asset, ExportTask
from kpi.tests.base_test_case import BaseTestCase
from kpi.tests.test_mock_data_exports import MockDataExports
class AssetExportTaskTest(MockDataE... | Add (failing) test for uid export filter | Add (failing) test for uid export filter
| Python | agpl-3.0 | kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi | ---
+++
@@ -0,0 +1,51 @@
+# coding: utf-8
+from collections import defaultdict
+
+from rest_framework import status
+from rest_framework.reverse import reverse
+
+from kpi.models import Asset, ExportTask
+from kpi.tests.base_test_case import BaseTestCase
+from kpi.tests.test_mock_data_exports import MockDataExports
+... | |
c67c2fa38512cad8aa8c20c7c57f2639d6882a8a | server/src/test/util/experiments.py | server/src/test/util/experiments.py | import json
import weblab.core.coordinator.coordinator as Coordinator
import weblab.experiment.level as level
from weblab.experiment.experiment import Experiment
class StorageExperiment(Experiment):
def __init__(self, coord_address, locator, config, *args, **kwargs):
super(StorageExperiment, self).__init... | Add dummy experiment for testing | Add dummy experiment for testing
| Python | bsd-2-clause | zstars/weblabdeusto,zstars/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,zstars/weblabdeusto,zstars/weblabdeusto,morelab/weblabdeusto,weblabdeusto/weblabdeusto,morelab/weblabdeusto,morelab/weblabdeusto,zstars/weblabdeusto,zstars/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,zstars... | ---
+++
@@ -0,0 +1,29 @@
+import json
+
+import weblab.core.coordinator.coordinator as Coordinator
+import weblab.experiment.level as level
+
+from weblab.experiment.experiment import Experiment
+
+class StorageExperiment(Experiment):
+ def __init__(self, coord_address, locator, config, *args, **kwargs):
+ ... | |
5371af1ff5aae6f9db51698f1a09dbf50dec4027 | maediprojects/views/users.py | maediprojects/views/users.py | from flask import Flask, render_template, flash, request, Markup, \
session, redirect, url_for, escape, Response, abort, send_file, \
current_app
from flask.ext.login import (LoginManager, current_user, login_required,
login_user, logout_user, UserMixin,
c... | Add views on to user management functions | Add views on to user management functions
| Python | agpl-3.0 | markbrough/maedi-projects,markbrough/maedi-projects,markbrough/maedi-projects | ---
+++
@@ -0,0 +1,86 @@
+from flask import Flask, render_template, flash, request, Markup, \
+ session, redirect, url_for, escape, Response, abort, send_file, \
+ current_app
+from flask.ext.login import (LoginManager, current_user, login_required,
+ login_user, logout_user, UserMixi... | |
e0cd375fbd7085a989f73da1259fe70a1c50bd36 | src/test_functions.py | src/test_functions.py | def k_to_c(temp):
return temp - 273.15
def f_to_k(temp):
return ((temp - 32) * (5 / 9)) + 273.15
def f_to_c(temp):
temp_k = f_to_k(temp)
result = k_to_c(temp_k)
return result
| Add a test python function | Add a test python function
| Python | mit | xykang/2015-05-12-BUSM-git,xykang/2015-05-12-BUSM-git | ---
+++
@@ -0,0 +1,10 @@
+def k_to_c(temp):
+ return temp - 273.15
+
+def f_to_k(temp):
+ return ((temp - 32) * (5 / 9)) + 273.15
+
+def f_to_c(temp):
+ temp_k = f_to_k(temp)
+ result = k_to_c(temp_k)
+ return result | |
6be9586a81ef426620ea33e61d8ad1137746d6f8 | webtool/server/migrations/0029_auto_20181216_1323.py | webtool/server/migrations/0029_auto_20181216_1323.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-12-16 12:23
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('server', '0028_auto_20181211_1333'),
]
oper... | Improve member_id field (We need the possibility of meber_id = NULL) | Improve member_id field (We need the possibility of meber_id = NULL)
| Python | bsd-2-clause | wodo/WebTool3,wodo/WebTool3,wodo/WebTool3,wodo/WebTool3 | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.6 on 2018-12-16 12:23
+from __future__ import unicode_literals
+
+import django.core.validators
+from django.db import migrations, models
+import re
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('server', '00... | |
d91085396ec4b61e678c32f90dc3f40f44bad121 | test/benchmarks/frame_variable/TestFrameVariableResponse.py | test/benchmarks/frame_variable/TestFrameVariableResponse.py | """Test lldb's response time for 'frame variable' command."""
import os, sys
import unittest2
import lldb
import pexpect
from lldbbench import *
class FrameVariableResponseBench(BenchBase):
mydir = os.path.join("benchmarks", "frame_variable")
def setUp(self):
BenchBase.setUp(self)
if lldb.bm... | Add a benchmark for measuring the response time of the 'frame variable' command. Example (start the lldb inferior, break at the Driver::MainLoop() function, and issue 'frame variable'): | Add a benchmark for measuring the response time of the 'frame variable' command.
Example (start the lldb inferior, break at the Driver::MainLoop() function, and
issue 'frame variable'):
$ ./dotest.py -v +b -x '-F Driver::MainLoop()' -n -p TestFrameVariableResponse.py
--------------------------------------------------... | Python | apache-2.0 | apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb | ---
+++
@@ -0,0 +1,79 @@
+"""Test lldb's response time for 'frame variable' command."""
+
+import os, sys
+import unittest2
+import lldb
+import pexpect
+from lldbbench import *
+
+class FrameVariableResponseBench(BenchBase):
+
+ mydir = os.path.join("benchmarks", "frame_variable")
+
+ def setUp(self):
+ ... | |
dea65af465b8ffab2a0e85eb0823157253986de7 | tests/grid_3d_canvas_test.py | tests/grid_3d_canvas_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Test case for 3D grid canvas.
"""
import unittest
from matplotlib.collections import PathCollection
from catplot.grid_components.grid_canvas import Grid3DCanvas
from catplot.grid_components.nodes import Node3D
class Grid3DCanvasTest(unittest.TestCase):
def se... | Add 3d grid canvas test. | Add 3d grid canvas test.
| Python | mit | PytLab/catplot | ---
+++
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+""" Test case for 3D grid canvas.
+"""
+
+import unittest
+
+from matplotlib.collections import PathCollection
+
+from catplot.grid_components.grid_canvas import Grid3DCanvas
+from catplot.grid_components.nodes import Node3D
+
+
+class Grid3D... | |
03f7fa8196d07be89f5ebf6a86c349db035ba82c | tests/test_symbol_caching.py | tests/test_symbol_caching.py | import numpy as np
from devito import DenseData, clear_cache
from devito.interfaces import _SymbolCache
@pytest.mark.xfail(reason="Known symbol caching bug due to false aliasing")
def test_symbol_cache_aliasing():
"""Test to assert that our aiasing cache isn't defeated by sympys
non-aliasing symbol cache.
... | Add test for symbol cache aliasing | SymbolCache: Add test for symbol cache aliasing
| Python | mit | opesci/devito,opesci/devito | ---
+++
@@ -0,0 +1,43 @@
+import numpy as np
+
+from devito import DenseData, clear_cache
+from devito.interfaces import _SymbolCache
+
+
+@pytest.mark.xfail(reason="Known symbol caching bug due to false aliasing")
+def test_symbol_cache_aliasing():
+ """Test to assert that our aiasing cache isn't defeated by symp... | |
79895e372459b98c610640232d0f6d616cb86f82 | tests/utils/test_strptime.py | tests/utils/test_strptime.py | import datetime as dt
from pytest import raises
from gitfs.utils import strptime
class TestDateTimeUtils(object):
def test_strptime(self):
date = dt.date(2014, 8, 21)
datetime = dt.datetime(2014, 8, 21, 1, 2, 3)
assert strptime("2014-08-21 01:02:03", "%Y-%m-%d %H:%M:%S") == date
... | Add test for the strptime util | Add test for the strptime util
| Python | apache-2.0 | rowhit/gitfs,PressLabs/gitfs,PressLabs/gitfs,bussiere/gitfs,ksmaheshkumar/gitfs | ---
+++
@@ -0,0 +1,27 @@
+import datetime as dt
+from pytest import raises
+
+from gitfs.utils import strptime
+
+
+class TestDateTimeUtils(object):
+
+ def test_strptime(self):
+ date = dt.date(2014, 8, 21)
+ datetime = dt.datetime(2014, 8, 21, 1, 2, 3)
+ assert strptime("2014-08-21 01:02:03"... | |
14f83b8eeaa53b45d243d9c5279749653ed83394 | tests/test_commands/test_init.py | tests/test_commands/test_init.py | # Copyright 2015 0xc0170
#
# 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, soft... | Test init commands - addition | Test init commands - addition
| Python | apache-2.0 | 0xc0170/project_generator,sarahmarshy/project_generator,ohagendorf/project_generator,project-generator/project_generator,hwfwgrp/project_generator,molejar/project_generator | ---
+++
@@ -0,0 +1,58 @@
+# Copyright 2015 0xc0170
+#
+# 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 applicab... | |
7b65f56121f5bc7627890a057d377d6073ecf8d3 | lms/djangoapps/open_ended_grading/controller_query_service.py | lms/djangoapps/open_ended_grading/controller_query_service.py | import json
import logging
import requests
from requests.exceptions import RequestException, ConnectionError, HTTPError
import sys
from grading_service import GradingService
from grading_service import GradingServiceError
from django.conf import settings
from django.http import HttpResponse, Http404
log = logging.get... | Add service to query controller for eta of submission and to check if name is unique | Add service to query controller for eta of submission and to check if name is unique
| Python | agpl-3.0 | Edraak/edx-platform,halvertoluke/edx-platform,BehavioralInsightsTeam/edx-platform,fly19890211/edx-platform,prarthitm/edxplatform,B-MOOC/edx-platform,xingyepei/edx-platform,jjmiranda/edx-platform,jruiperezv/ANALYSE,amir-qayyum-khan/edx-platform,mitocw/edx-platform,arbrandes/edx-platform,IITBinterns13/edx-platform-dev,10... | ---
+++
@@ -0,0 +1,37 @@
+import json
+import logging
+import requests
+from requests.exceptions import RequestException, ConnectionError, HTTPError
+import sys
+from grading_service import GradingService
+from grading_service import GradingServiceError
+
+from django.conf import settings
+from django.http import Htt... | |
84ac53d9b6070bc82259c6f099a7044eda2510f7 | scripts/oneoff/fix-pricing.py | scripts/oneoff/fix-pricing.py | #!/usr/bin/env python
"""Fix G5 and G6 price fields to be strings rather than numbers
Usage:
fix-pricing.py <api_endpoint> <api_access_token>
"""
from multiprocessing.pool import ThreadPool
from docopt import docopt
from dmutils import apiclient
def update(client):
def do_update(data):
i, service = ... | Add a script to fix G5 and G6 service prices | Add a script to fix G5 and G6 service prices
This script converts G5 and G6 price fields to from numbers to strings.
It doesn't make any attempt to format them nicely, however, neither
would the frontend when displaying them.
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+"""Fix G5 and G6 price fields to be strings rather than numbers
+
+Usage:
+ fix-pricing.py <api_endpoint> <api_access_token>
+"""
+from multiprocessing.pool import ThreadPool
+
+from docopt import docopt
+from dmutils import apiclient
+
+
+def update(client):
+ d... | |
619533b0cc5426e2680626fdeb2f33a98b8fec89 | scripts/trello-description.py | scripts/trello-description.py | import requests
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('-k', '--key', dest='key',
help='trello api key', required=True)
parser.add_argument('-t', '--token', dest='token',
help='trello api token', required=True)
parser.add_argument('-b'... | Create script to fetch trello name from a list of trello ids | Create script to fetch trello name from a list of trello ids
| Python | mit | uktrade/data-hub-fe-beta2,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-frontend | ---
+++
@@ -0,0 +1,44 @@
+import requests
+from argparse import ArgumentParser
+
+
+parser = ArgumentParser()
+parser.add_argument('-k', '--key', dest='key',
+ help='trello api key', required=True)
+parser.add_argument('-t', '--token', dest='token',
+ help='trello api token', req... | |
49e79f41542702dd2409d4a5fbbad28a2c88341b | copy_labels.py | copy_labels.py | #!/usr/bin/env python
"""Copy tags from one repo to others."""
from __future__ import print_function
import json
import requests
import yaml
from helpers import paginated_get
LABELS_URL = "https://api.github.com/repos/{owner_repo}/labels"
def get_labels(owner_repo):
url = LABELS_URL.format(owner_repo=owner_r... | Copy labels from edx-platform to all the other repos | Copy labels from edx-platform to all the other repos
| Python | apache-2.0 | edx/repo-tools,edx/repo-tools | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+"""Copy tags from one repo to others."""
+
+from __future__ import print_function
+
+import json
+
+import requests
+import yaml
+
+from helpers import paginated_get
+
+
+LABELS_URL = "https://api.github.com/repos/{owner_repo}/labels"
+
+def get_labels(owner_repo):
+ ... | |
5859a9fe249025e9175bfc1cbd845adaa371d590 | backend/generateGeotiff.py | backend/generateGeotiff.py |
# TODO almost everything
src_ds = gdal.Open( src_filename )
dst_ds = driver.CreateCopy( dst_filename, src_ds, 0 )
# Once we're done, close properly the dataset
dst_ds = None
src_ds = None
| Add script for generating Geotiff | Add script for generating Geotiff
| Python | mit | lukefi/missamustikka,lukefi/missamustikka,lukefi/missamustikka | ---
+++
@@ -0,0 +1,8 @@
+
+# TODO almost everything
+
+src_ds = gdal.Open( src_filename )
+dst_ds = driver.CreateCopy( dst_filename, src_ds, 0 )
+# Once we're done, close properly the dataset
+dst_ds = None
+src_ds = None | |
c5a027748275d9b9065fd89be60d6b97a27fd3ed | Simulation/InterpretBatchParamsXML.py | Simulation/InterpretBatchParamsXML.py | from xml.etree.ElementTree import ElementTree, parse
from itertools import product
from collections import OrderedDict
# TODO: Add a feature to map certain variables onto other; so that r_mitosis 1 2 and 3 are synced, for example
# TODO: add custom processing of certain variables, like r_grow
def params_dict_for_batc... | Add beta ability to load params from xml | Add beta ability to load params from xml
| Python | mit | ram8647/tcseg,ram8647/tcseg,ram8647/tcseg | ---
+++
@@ -0,0 +1,56 @@
+from xml.etree.ElementTree import ElementTree, parse
+from itertools import product
+from collections import OrderedDict
+
+# TODO: Add a feature to map certain variables onto other; so that r_mitosis 1 2 and 3 are synced, for example
+# TODO: add custom processing of certain variables, like... | |
3caef811ab9f60988dd06bc2161f373b61bb9c8d | mangaki/mangaki/migrations/0013_auto_20150616_0919.py | mangaki/mangaki/migrations/0013_auto_20150616_0919.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mangaki', '0012_auto_20150616_0832'),
]
operations = [
migrations.AddField(
model_name='anime',
name... | Add attributes to Anime migration | Add attributes to Anime migration
| Python | agpl-3.0 | RaitoBezarius/mangaki,Mako-kun/mangaki,Elarnon/mangaki,RaitoBezarius/mangaki,Elarnon/mangaki,Mako-kun/mangaki,Mako-kun/mangaki,Elarnon/mangaki,RaitoBezarius/mangaki | ---
+++
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('mangaki', '0012_auto_20150616_0832'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ ... | |
1b3bc233591c0165df234f5f822a60017b2c8e69 | server.py | server.py | import sys
import socket
import threading
import subprocess
bind_ip = "0.0.0.0"
bind_port = 9999
if(len(sys.argv) > 1):
try:
bind_ip = sys.argv[1]
bind_port = int(sys.argv[2])
except Exception:
pass #lazy
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bin... | Add the script to be run on target machine | Add the script to be run on target machine | Python | mit | Laserbear/PypeBomb | ---
+++
@@ -0,0 +1,54 @@
+import sys
+import socket
+import threading
+import subprocess
+
+bind_ip = "0.0.0.0"
+bind_port = 9999
+
+if(len(sys.argv) > 1):
+ try:
+ bind_ip = sys.argv[1]
+ bind_port = int(sys.argv[2])
+ except Exception:
+ pass #lazy
+
+
+
+server = socket.socket(so... | |
275305e39c072bdc105c10799d5e3ea5345b2d1c | examples/example-bulb-hsv.py | examples/example-bulb-hsv.py | """
Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
Licensed under MIT. All rights reserved.
"""
import time
from pymystrom import bulb
bulb = bulb.MyStromBulb('192.168.0.51', '5CCF7FA0AFB0')
bulb.set_color_hex('000000FF')
# Get the details of the bulb
print("Current color details:", bulb.... | Add a simple HSV example | Add a simple HSV example
| Python | mit | fabaff/python-mystrom | ---
+++
@@ -0,0 +1,22 @@
+"""
+Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
+
+Licensed under MIT. All rights reserved.
+"""
+import time
+
+from pymystrom import bulb
+
+bulb = bulb.MyStromBulb('192.168.0.51', '5CCF7FA0AFB0')
+
+bulb.set_color_hex('000000FF')
+
+# Get the details of the b... | |
2bf5d88f368b7d3de67b419d1ef12ddaa573e79d | tests/conftest.py | tests/conftest.py | from distutils import dir_util
from pytest import fixture
import os
# Adapted from http://stackoverflow.com/a/29631801/2043465
@fixture(scope="function")
def datadir(tmpdir, request):
'''
Fixture responsible for searching a folder with the same name of test
module and, if available, moving all contents to... | Add pytest fixture for copying files to tmpdir | Add pytest fixture for copying files to tmpdir
| Python | mit | ZedThree/fort_depend.py,ZedThree/fort_depend.py | ---
+++
@@ -0,0 +1,20 @@
+from distutils import dir_util
+from pytest import fixture
+import os
+
+
+# Adapted from http://stackoverflow.com/a/29631801/2043465
+@fixture(scope="function")
+def datadir(tmpdir, request):
+ '''
+ Fixture responsible for searching a folder with the same name of test
+ module and... | |
db3e824660330dd504a221f033ba8af510836091 | acme/jax/imitation_learning_types.py | acme/jax/imitation_learning_types.py | # python3
# Copyright 2018 DeepMind Technologies Limited. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | Define common TypeVars for IL/AL algorithms. | Define common TypeVars for IL/AL algorithms.
PiperOrigin-RevId: 387357896
Change-Id: I09f467e2ef1b38831c429fe6f5fa79e38609d053
| Python | apache-2.0 | deepmind/acme,deepmind/acme | ---
+++
@@ -0,0 +1,23 @@
+# python3
+# Copyright 2018 DeepMind Technologies Limited. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org... | |
b97cf9b38a51d26e60257785db0b443177f35ed6 | general/python/es_reindex.py | general/python/es_reindex.py | #!/usr/bin/env python
# Copyright 2015 University of Chicago
# Available under Apache 2.0 License
import argparse
import sys
import logging
import elasticsearch
import elasticsearch.helpers
ES_NODES = 'uct2-es-door.mwt2.org'
VERSION = '0.1'
def get_es_client(nodes):
""" Instantiate DB client and pass connect... | Add script to reindex indices | Add script to reindex indices
| Python | apache-2.0 | DHTC-Tools/logstash-confs,DHTC-Tools/logstash-confs,DHTC-Tools/logstash-confs | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+
+# Copyright 2015 University of Chicago
+# Available under Apache 2.0 License
+
+import argparse
+import sys
+import logging
+
+import elasticsearch
+import elasticsearch.helpers
+
+
+ES_NODES = 'uct2-es-door.mwt2.org'
+VERSION = '0.1'
+
+def get_es_client(nodes):
+... | |
e4824f3357c6329e84e0d3f1ad206300c43d62c5 | src/h5_to_tif_dir.py | src/h5_to_tif_dir.py | #!/usr/bin/python
"""
T Macrina
160314
Make TIF images of all H5 files in directory
**All H5 files must have "img" group
Args:
sys.argv[1]: full path to the H5 image directory
Returns:
TIF files (extension changed to .tif) saved in the same directory
"""
from PIL import Image
import numpy as np
import h5py
import... | Include Python script to convert 3D stack into dir of tif images | Include Python script to convert 3D stack into dir of tif images
| Python | mit | seung-lab/Julimaps,seung-lab/Julimaps | ---
+++
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+"""
+T Macrina
+160314
+
+Make TIF images of all H5 files in directory
+**All H5 files must have "img" group
+
+Args:
+ sys.argv[1]: full path to the H5 image directory
+
+Returns:
+ TIF files (extension changed to .tif) saved in the same directory
+"""
+
+from PIL import ... | |
3daedd2bc822465d17f1d7ea47f313dfb7486841 | tests/integration/test_demo_build.py | tests/integration/test_demo_build.py | """Test that a default build of --demo works."""
import io
import os
import shutil
import sys
import pytest
import nikola.plugins.command.init
from nikola import __main__
from nikola.utils import LocaleBorg
from ..base import cd
LOCALE_DEFAULT = os.environ.get('NIKOLA_LOCALE_DEFAULT', 'en')
def test_index_in_sit... | Make the demo build available with pytest. | Make the demo build available with pytest.
This is useful on it's own and for porting further tests.
| Python | mit | getnikola/nikola,getnikola/nikola,okin/nikola,getnikola/nikola,okin/nikola,okin/nikola,okin/nikola,getnikola/nikola | ---
+++
@@ -0,0 +1,96 @@
+"""Test that a default build of --demo works."""
+
+import io
+import os
+import shutil
+import sys
+
+import pytest
+
+import nikola.plugins.command.init
+from nikola import __main__
+from nikola.utils import LocaleBorg
+
+from ..base import cd
+
+LOCALE_DEFAULT = os.environ.get('NIKOLA_LOC... | |
559f89d49690fb74219c6de9c7f492cfa40ff9bb | TCCC2001Round2/Syntax.py | TCCC2001Round2/Syntax.py | openingParen = '('
closingParen = ')'
openingBrace = '{'
closingBrace = '}'
openingBracket = '['
closingBracket = ']'
class Syntax():
def match( self, string ):
stack = []
for i in range( len( string ) ):
if self.isOpening( string[ i ] ):
stack.append( string[ i ] )
... | Check if brackets are balanced | Check if brackets are balanced
| Python | mit | crisron/Topcoder,crisron/Topcoder,crisron/Topcoder | ---
+++
@@ -0,0 +1,36 @@
+openingParen = '('
+closingParen = ')'
+openingBrace = '{'
+closingBrace = '}'
+openingBracket = '['
+closingBracket = ']'
+
+class Syntax():
+ def match( self, string ):
+ stack = []
+ for i in range( len( string ) ):
+ if self.isOpening( string[ i ] ):
+ ... | |
7bce727470d3671f50e0c38fab1681eced89323a | cluster_viz/transform_pro_anti.py | cluster_viz/transform_pro_anti.py | import json, sys, re
colors = {'PRO': ["#0f8c79", "#074a3f"], 'ANTI': ['#bd2d28', '#5e1614'], '???': ['#978F80', '#5B564D']}
j = json.load(open(sys.argv[1]))
# count
from collections import Counter
from colour import Color
pa_count = Counter()
for item in j:
pa_count[item['pro_anti']] += 1
for pa, count in pa_co... | Add code for colorizing the pro/anti bubbles. | Add code for colorizing the pro/anti bubbles.
| Python | mit | sunlightlabs/fcc-net-neutrality-comments,sunlightlabs/fcc-net-neutrality-comments,sunlightlabs/fcc-net-neutrality-comments,sunlightlabs/fcc-net-neutrality-comments | ---
+++
@@ -0,0 +1,23 @@
+import json, sys, re
+colors = {'PRO': ["#0f8c79", "#074a3f"], 'ANTI': ['#bd2d28', '#5e1614'], '???': ['#978F80', '#5B564D']}
+j = json.load(open(sys.argv[1]))
+
+# count
+from collections import Counter
+from colour import Color
+
+pa_count = Counter()
+for item in j:
+ pa_count[item['pr... | |
8f79049d204235d7571ca2a83ffdc81db402db25 | examples/image_test.py | examples/image_test.py | """
Pull an image from a website and save it as a PNG file.
"""
from seleniumbase import BaseCase
class ImageTest(BaseCase):
def test_pull_image_from_website(self):
self.open("https://xkcd.com/1117/")
selector = "#comic"
file_name = "comic.png"
folder = "images_exported"
... | Add image test to save an element screenshot to a file | Add image test to save an element screenshot to a file
| Python | mit | seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase | ---
+++
@@ -0,0 +1,16 @@
+"""
+Pull an image from a website and save it as a PNG file.
+"""
+
+from seleniumbase import BaseCase
+
+
+class ImageTest(BaseCase):
+
+ def test_pull_image_from_website(self):
+ self.open("https://xkcd.com/1117/")
+ selector = "#comic"
+ file_name = "comic.png"
+ ... | |
8d9da9022a7cf16b746fd6d0b9a83723fc78bff8 | apps/domain/tests/test_routes/test_setup.py | apps/domain/tests/test_routes/test_setup.py |
def test_initial_setup(client):
result = client.post("/setup/", data={"setup": "setup_configs_sample"})
assert result.status_code == 200
assert result.get_json() == {"msg": "Running initial setup!"}
def test_get_setup(client):
result = client.get("/setup/")
assert result.status_code == 200
as... | ADD Domain setup unit tests | ADD Domain setup unit tests
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | ---
+++
@@ -0,0 +1,11 @@
+
+
+def test_initial_setup(client):
+ result = client.post("/setup/", data={"setup": "setup_configs_sample"})
+ assert result.status_code == 200
+ assert result.get_json() == {"msg": "Running initial setup!"}
+
+def test_get_setup(client):
+ result = client.get("/setup/")
+ as... | |
5d896ff27b2bd3f8c8c6b6af58b2b9aa3f1a6695 | packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py | packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py | import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
class InvalidArgsExpressionTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
TestBase.setUp(self)
@no_debug_info_test
def test_invalid_lang(self):
self.expect("expres... | Add test for invalid expression command args | [lldb][NFC] Add test for invalid expression command args
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@370618 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb | ---
+++
@@ -0,0 +1,48 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+class InvalidArgsExpressionTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+
+ @no_debug_info_test
+ def test_invalid... | |
4c39c3785499bd9973007bd6ad9044a28accd063 | djangae/tests/test_mail.py | djangae/tests/test_mail.py | # THIRD PARTY
from django.core.mail import send_mail
from django.test import override_settings
from google.appengine.api.app_identity import get_application_id
# DJANGAE
from djangae.contrib import sleuth
from djangae.test import TestCase
class EmailBackendTests(TestCase):
def _get_valid_sender_address(self):
... | Add some basic tests for the Djangae email backends. | Add some basic tests for the Djangae email backends.
| Python | bsd-3-clause | potatolondon/djangae,potatolondon/djangae,grzes/djangae,grzes/djangae,grzes/djangae | ---
+++
@@ -0,0 +1,36 @@
+# THIRD PARTY
+from django.core.mail import send_mail
+from django.test import override_settings
+from google.appengine.api.app_identity import get_application_id
+
+# DJANGAE
+from djangae.contrib import sleuth
+from djangae.test import TestCase
+
+
+class EmailBackendTests(TestCase):
+
+ ... | |
fc338d9095299ad5394ff92c6a50a50af960d3f2 | genome_designer/variants/tests/test_materialized_view_manager.py | genome_designer/variants/tests/test_materialized_view_manager.py | """
Tests for materialized_view_manager.py.
"""
from django.test import TestCase
from variants.materialized_view_manager import MATERIALIZED_TABLE_QUERYABLE_FIELDS_MAP
class TestMaterializedViewSchema(TestCase):
def test_queryable_fields_map(self):
"""Make sure the schema builds without errors.
... | Add test that goes with last commit. | Add test that goes with last commit.
| Python | mit | woodymit/millstone,churchlab/millstone,churchlab/millstone,woodymit/millstone,woodymit/millstone,woodymit/millstone_accidental_source,woodymit/millstone,woodymit/millstone_accidental_source,churchlab/millstone,churchlab/millstone,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source | ---
+++
@@ -0,0 +1,17 @@
+"""
+Tests for materialized_view_manager.py.
+"""
+
+from django.test import TestCase
+
+from variants.materialized_view_manager import MATERIALIZED_TABLE_QUERYABLE_FIELDS_MAP
+
+
+class TestMaterializedViewSchema(TestCase):
+
+ def test_queryable_fields_map(self):
+ """Make sure t... | |
83b0a8e394f281ac41abe0be52c7560e285e0967 | scripts/example_parser.py | scripts/example_parser.py | # This is an example of how to parse ooniprobe reports
import yaml
import sys
print "Opening %s" % sys.argv[1]
f = open(sys.argv[1])
yamloo = yaml.safe_load_all(f)
report_header = yamloo.next()
print "ASN: %s" % report_header['probe_asn']
print "CC: %s" % report_header['probe_cc']
print "IP: %s" % report_header['prob... | Add a very simple example on how to securely parse the ooniprobe reports | Add a very simple example on how to securely parse the ooniprobe reports
| Python | bsd-2-clause | Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,0x... | ---
+++
@@ -0,0 +1,22 @@
+# This is an example of how to parse ooniprobe reports
+
+import yaml
+import sys
+print "Opening %s" % sys.argv[1]
+f = open(sys.argv[1])
+yamloo = yaml.safe_load_all(f)
+
+report_header = yamloo.next()
+print "ASN: %s" % report_header['probe_asn']
+print "CC: %s" % report_header['probe_cc'... | |
88e61467702e517d0db4ae11d584bcde0b7b0366 | batch_eg.py | batch_eg.py | """Example of using nbparameterise API to substitute variables in 'batch mode'
"""
from nbparameterise import code
from IPython.nbformat import current as nbformat
from IPython.nbconvert.preprocessors.execute import ExecutePreprocessor
from IPython.nbconvert.exporters.notebook import NotebookExporter
from IPython.nbco... | Add example of using API in batch mode | Add example of using API in batch mode
| Python | mit | takluyver/nbparameterise | ---
+++
@@ -0,0 +1,37 @@
+"""Example of using nbparameterise API to substitute variables in 'batch mode'
+"""
+
+from nbparameterise import code
+from IPython.nbformat import current as nbformat
+from IPython.nbconvert.preprocessors.execute import ExecutePreprocessor
+from IPython.nbconvert.exporters.notebook import ... | |
b560ac3bacab29c22ea1ed9ddc698d918e39e0dd | ml-proto/runtests.py | ml-proto/runtests.py | #!/usr/bin/env python
import os.path
import unittest
import subprocess
import glob
class RunTests(unittest.TestCase):
def _runTestFile(self, shortName, fileName):
absRunner = os.path.abspath("src/main.native")
print("\n// %s" % shortName)
exitCode = subprocess.call([absRunner, fileName])
self.asse... | Add a simple automated test runner for all the .wasm files in the test directory | Add a simple automated test runner for all the .wasm files in the test directory
| Python | apache-2.0 | kg/spec,pjuftring/spec,maurer/spec,binji/spec,AndrewScheidecker/WebAssembly-spec,AugustusHuang/spec,incrediblesound/spec,eminemix/spec,marianoguerra/spec,naturaltransformation/spec,binji/spec,marianoguerra/spec,AndrewScheidecker/WebAssembly-spec,m4b/spec,d3spis3d/spec,AugustusHuang/spec,lindig/spec,maurer/spec,naturalt... | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+import os.path
+import unittest
+import subprocess
+import glob
+
+class RunTests(unittest.TestCase):
+ def _runTestFile(self, shortName, fileName):
+ absRunner = os.path.abspath("src/main.native")
+ print("\n// %s" % shortName)
+ exitCode = subprocess.ca... | |
332def912a107c2e8d281c3101f32cc5e846bc17 | massmedia/widgets.py | massmedia/widgets.py | from django.utils.text import truncate_words
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
class ForeignKeyRawIdImageWidget(ForeignKeyRawIdWidget):
"""
A Widget for displaying ForeignKeys in the "raw_id" interface and a thumbnail
rather than in a <select> box.
"""
def label_for_va... | Add a rawIdImageWidget that can easily be used in admin. This widget will display a thumbnail of the selected image. | Add a rawIdImageWidget that can easily be used in admin. This widget will display a thumbnail of the selected image. | Python | apache-2.0 | uclastudentmedia/django-massmedia,uclastudentmedia/django-massmedia | ---
+++
@@ -0,0 +1,13 @@
+from django.utils.text import truncate_words
+from django.contrib.admin.widgets import ForeignKeyRawIdWidget
+
+class ForeignKeyRawIdImageWidget(ForeignKeyRawIdWidget):
+ """
+ A Widget for displaying ForeignKeys in the "raw_id" interface and a thumbnail
+ rather than in a <select> ... | |
58712fe5669704b10927a6e9dc3ed560aed0b260 | candidates/tests/test_get_data_for_popit.py | candidates/tests/test_get_data_for_popit.py | from django.test import TestCase
from candidates.models import get_person_data_from_dict
# All these are essentially tests for get_person_data_from_dict
class TestGetDataForPopIt(TestCase):
def test_get_person_data_from_dict(self):
form_data = {
'name': 'John Doe',
'email': 'john... | Add tests for the current behaviour of get_person_data_from_dict | Add tests for the current behaviour of get_person_data_from_dict
| Python | agpl-3.0 | datamade/yournextmp-popit,mysociety/yournextmp-popit,datamade/yournextmp-popit,mysociety/yournextmp-popit,YoQuieroSaber/yournextrepresentative,YoQuieroSaber/yournextrepresentative,DemocracyClub/yournextrepresentative,datamade/yournextmp-popit,openstate/yournextrepresentative,openstate/yournextrepresentative,DemocracyCl... | ---
+++
@@ -0,0 +1,72 @@
+from django.test import TestCase
+
+from candidates.models import get_person_data_from_dict
+
+# All these are essentially tests for get_person_data_from_dict
+
+class TestGetDataForPopIt(TestCase):
+
+ def test_get_person_data_from_dict(self):
+ form_data = {
+ 'name': ... | |
1d02a8526abf8dfd9f76bbec7fac26a58ff0b25b | nodeconductor/quotas/management/commands/initglobalquotashistory.py | nodeconductor/quotas/management/commands/initglobalquotashistory.py | from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.core import serializers as django_serializers
from django.core.management.base import BaseCommand
from reversion.models import Version, Revision
from nodeconductor.quotas import models
from nodeconductor.quo... | Implement command for quotas history population | Implement command for quotas history population
- itacloud-5296
| Python | mit | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | ---
+++
@@ -0,0 +1,36 @@
+from __future__ import unicode_literals
+
+from django.contrib.contenttypes.models import ContentType
+from django.core import serializers as django_serializers
+from django.core.management.base import BaseCommand
+from reversion.models import Version, Revision
+
+from nodeconductor.quotas i... | |
44f0ea9879ec05c7dca7f345d17ade07593f706b | tests/test_gerrit.py | tests/test_gerrit.py | import unittest
from pprint import pprint
from openstack_gerrit.collector import main
class GerritIntegrationTestCase(unittest.TestCase):
def test_query_change(self):
gs = main.GerritSession()
change = gs.query_change('423782')
# check if we have some expected keys
self.assert... | Add quick tests for GerritSession | Add quick tests for GerritSession
| Python | apache-2.0 | marshallford/ndsu-ibm-capstone,marshallford/ndsu-ibm-capstone | ---
+++
@@ -0,0 +1,19 @@
+import unittest
+
+from pprint import pprint
+
+from openstack_gerrit.collector import main
+
+
+class GerritIntegrationTestCase(unittest.TestCase):
+
+ def test_query_change(self):
+ gs = main.GerritSession()
+
+ change = gs.query_change('423782')
+
+ # check if we h... | |
8d906e55da3f87206b3ba6b2cea4cc1cf97a7321 | indra/sources/hypothesis/processor.py | indra/sources/hypothesis/processor.py | import re
from indra.statements import BioContext, RefContext
from indra.preassembler.grounding_mapper.standardize import \
standardize_db_refs, name_from_grounding
class HypothesisProcessor:
def __init__(self, annotations, reader=None, grounder=None):
self.annotations = annotations
self.state... | Add initial Statement and context extraction | Add initial Statement and context extraction
| Python | bsd-2-clause | johnbachman/indra,johnbachman/belpy,bgyori/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/belpy,bgyori/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,bgyori/indra | ---
+++
@@ -0,0 +1,46 @@
+import re
+from indra.statements import BioContext, RefContext
+from indra.preassembler.grounding_mapper.standardize import \
+ standardize_db_refs, name_from_grounding
+
+
+class HypothesisProcessor:
+ def __init__(self, annotations, reader=None, grounder=None):
+ self.annotati... | |
b073e1294837b9776ea25d46c908b148ab404f21 | calvin/actor/actorstate.py | calvin/actor/actorstate.py |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Ericsson AB
#
# 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... | Add missed file for actor state manipulation during replication. | Add missed file for actor state manipulation during replication.
| Python | apache-2.0 | EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base | ---
+++
@@ -0,0 +1,46 @@
+
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2016 Ericsson AB
+#
+# 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-... | |
56d9482598d14b243f7e8d1cf0e167969e8fac4e | mezzanine/blog/management/commands/import_posterous.py | mezzanine/blog/management/commands/import_posterous.py | from mezzanine.blog.management.base import BaseImporterCommand
from optparse import make_option
from urllib import urlopen, urlencode
import requests
import json
import time
from datetime import datetime
import sys
# import requests_cache
# requests_cache.configure('demo_cache')
class PosterousImportException(Exceptio... | Add initial support for importing blog posts from posterous. | Add initial support for importing blog posts from posterous.
| Python | bsd-2-clause | sjdines/mezzanine,dsanders11/mezzanine,readevalprint/mezzanine,damnfine/mezzanine,Skytorn86/mezzanine,sjdines/mezzanine,cccs-web/mezzanine,industrydive/mezzanine,biomassives/mezzanine,dovydas/mezzanine,damnfine/mezzanine,viaregio/mezzanine,wyzex/mezzanine,sjuxax/mezzanine,orlenko/sfpirg,guibernardino/mezzanine,Cajoline... | ---
+++
@@ -0,0 +1,86 @@
+from mezzanine.blog.management.base import BaseImporterCommand
+from optparse import make_option
+from urllib import urlopen, urlencode
+import requests
+import json
+import time
+from datetime import datetime
+import sys
+# import requests_cache
+# requests_cache.configure('demo_cache')
+
+... | |
ac80535f35f42f22e85606c00deae7c0329367d9 | RainbowGenerator.py | RainbowGenerator.py | # Generate 2 colour combos from R-O-Y-G-B-Purple
# Implementation (c) 2017 Brig Young (github.com/Sonophoto)
# License: BSD-2c, i.e. Cite.
warm_colours = ["red", "orange", "yellow"]
cool_colours = ["green", "blue", "purple"]
list_of_colours = []
number_of_colours = 0
# Generate a set of colour tuples and output
for ... | Make the world a happier place with a Rainbow! | Make the world a happier place with a Rainbow!
| Python | bsd-2-clause | Sonophoto/PythonNotes,Sonophoto/PythonNotes | ---
+++
@@ -0,0 +1,22 @@
+# Generate 2 colour combos from R-O-Y-G-B-Purple
+# Implementation (c) 2017 Brig Young (github.com/Sonophoto)
+# License: BSD-2c, i.e. Cite.
+
+warm_colours = ["red", "orange", "yellow"]
+cool_colours = ["green", "blue", "purple"]
+
+list_of_colours = []
+number_of_colours = 0
+
+# Generate ... | |
51943abe4c5dc072d5e4e4f938f0d66aade93d57 | pombola/settings/nigeria_base.py | pombola/settings/nigeria_base.py | COUNTRY_APP = 'nigeria'
OPTIONAL_APPS = []
TWITTER_USERNAME = 'NGShineyoureye'
TWITTER_WIDGET_ID = '354909651910918144'
BLOG_RSS_FEED = 'http://eienigeria.org/rss.xml'
MAP_BOUNDING_BOX_NORTH = 14.1
MAP_BOUNDING_BOX_EAST = 14.7
MAP_BOUNDING_BOX_SOUTH = 4
MAP_BOUNDING_BOX_WEST = 2.5
MAPIT_COUNTRY = 'NG'
| COUNTRY_APP = 'nigeria'
OPTIONAL_APPS = ['pombola.spinner']
TWITTER_USERNAME = 'NGShineyoureye'
TWITTER_WIDGET_ID = '354909651910918144'
BLOG_RSS_FEED = 'http://eienigeria.org/rss.xml'
MAP_BOUNDING_BOX_NORTH = 14.1
MAP_BOUNDING_BOX_EAST = 14.7
MAP_BOUNDING_BOX_SOUTH = 4
MAP_BOUNDING_BOX_WEST = 2.5
MAPIT_COUNTRY = ... | Add pombola.spinner to OPTIONAL_APPS in the new settings modules | Add pombola.spinner to OPTIONAL_APPS in the new settings modules
| Python | agpl-3.0 | geoffkilpin/pombola,patricmutwiri/pombola,ken-muturi/pombola,mysociety/pombola,ken-muturi/pombola,patricmutwiri/pombola,hzj123/56th,mysociety/pombola,mysociety/pombola,patricmutwiri/pombola,mysociety/pombola,hzj123/56th,ken-muturi/pombola,ken-muturi/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/... | ---
+++
@@ -1,6 +1,6 @@
COUNTRY_APP = 'nigeria'
-OPTIONAL_APPS = []
+OPTIONAL_APPS = ['pombola.spinner']
TWITTER_USERNAME = 'NGShineyoureye'
TWITTER_WIDGET_ID = '354909651910918144' |
00f3ce70966a202ced03720c9ada0443820e52d3 | app/soc/modules/gci/views/winners.py | app/soc/modules/gci/views/winners.py | #!/usr/bin/env python2.5
#
# Copyright 2012 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Implement the view for GCI Winners page. | Implement the view for GCI Winners page.
| Python | apache-2.0 | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/env python2.5
+#
+# Copyright 2012 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICEN... | |
678a3e2fbe54fc1f7e15074383db290cb198b837 | code/loader/dblploader/dblpcontent.py | code/loader/dblploader/dblpcontent.py | class DBLPContentHandler(ContentHandler):
"""Handle xml database content"""
inPublication = True
currentPubName = ''
attrs = {}
value = ''
def __init__(self, queue=''):
super()
self.authorFilter = loadAuthorFilter()
#self.authorFilter = loadAuthor()
self.queue = ... | Split loader and xml handler | Split loader and xml handler
| Python | mit | arcosta/sci-synergy,arcosta/sci-synergy,arcosta/sci-synergy | ---
+++
@@ -0,0 +1,52 @@
+class DBLPContentHandler(ContentHandler):
+ """Handle xml database content"""
+ inPublication = True
+ currentPubName = ''
+ attrs = {}
+ value = ''
+
+ def __init__(self, queue=''):
+ super()
+ self.authorFilter = loadAuthorFilter()
+ #self.authorFilte... | |
e04609d6ac992c6ff06b7e907901dbfa3bfa4e38 | folia2visualizaton.py | folia2visualizaton.py | """Create data set for visualization assignment
The data set consists of:
<sentence id>\t<label>\t<tagged words>
Usage: python folia2visualizaton.py <file in> <output dir>
Or: ./batch_do_python.sh folia2visualizaton.py <dir in> <output dir>
(for a directory containing folia files)
"""
from lxml import etree
from bs4 i... | Add script to generate input data for the visualization assignment | Add script to generate input data for the visualization assignment
Added a script that generates input files for the visualization
assignment. The script generates text files containing all annotations
in the form:
<sentence id> <label> <tagged words>
| Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,64 @@
+"""Create data set for visualization assignment
+The data set consists of:
+<sentence id>\t<label>\t<tagged words>
+
+Usage: python folia2visualizaton.py <file in> <output dir>
+Or: ./batch_do_python.sh folia2visualizaton.py <dir in> <output dir>
+(for a directory containing folia files)
+""... | |
e447666860730039eb1a3fa040f79d6b8a852fd5 | cliff/tests/test_formatters_shell.py | cliff/tests/test_formatters_shell.py | #!/usr/bin/env python
from six import StringIO
from cliff.formatters import shell
import mock
def test_shell_formatter():
sf = shell.ShellFormatter()
c = ('a', 'b', 'c')
d = ('A', 'B', 'C')
expected = 'a="A"\nb="B"\n'
output = StringIO()
args = mock.Mock()
args.variables = ['a', 'b']
... | Add unit test for shell formatter | Add unit test for shell formatter
This is in prepration for changing the behavior to escape double quotes.
Change-Id: Ib82511d066d70a1603b80ba8680b005e00113483
Related-Bug: #1269908
| Python | apache-2.0 | citrix-openstack-build/cliff,citrix-openstack-build/cliff,idjaw/cliff,idjaw/cliff,openstack/cliff,openstack/cliff,dtroyer/cliff,enzochiau/cliff,varunarya10/cliff,varunarya10/cliff,enzochiau/cliff,dtroyer/cliff | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+from six import StringIO
+
+from cliff.formatters import shell
+
+import mock
+
+
+def test_shell_formatter():
+ sf = shell.ShellFormatter()
+ c = ('a', 'b', 'c')
+ d = ('A', 'B', 'C')
+ expected = 'a="A"\nb="B"\n'
+ output = StringIO()
+ args = mock.... | |
1d2d865cd2843924993003b579f336c48bbef127 | score_classifiers.py | score_classifiers.py | from sklearn import svm
from sklearn.naive_bayes import GaussianNB, BernoulliNB
from sklearn.externals import joblib
import asl
threshold = int(len(asl.data) * 0.8)
training_data = asl.data[:threshold]
training_target = asl.target[:threshold]
test_data = asl.data[threshold:]
test_target = asl.target[threshold:]
cla... | Add script to score different classifiers | Add script to score different classifiers
| Python | mit | ssaamm/sign-language-translator,ssaamm/sign-language-tutor,ssaamm/sign-language-translator,ssaamm/sign-language-tutor | ---
+++
@@ -0,0 +1,22 @@
+from sklearn import svm
+from sklearn.naive_bayes import GaussianNB, BernoulliNB
+from sklearn.externals import joblib
+
+import asl
+
+threshold = int(len(asl.data) * 0.8)
+training_data = asl.data[:threshold]
+training_target = asl.target[:threshold]
+
+test_data = asl.data[threshold:]
+te... | |
be6194a27e3410c2393e6c4b70fb6e16d0a078b8 | maplin2emoncms.py | maplin2emoncms.py | import serial
import struct
import datetime
import time
import urllib2
# Replace this with your emoncms Write API Key from the user account page
writeApiKey = 'WRITE API KEY GOES HERE'
# Change this if you use a different host or SSL (a must if not on a LAN)
baseAddress = 'http://localhost/emoncms'
ser = serial.Seri... | Add support for pushing data to emoncms | Add support for pushing data to emoncms
| Python | mit | jpsingleton/Raspberry-Pi-Electricity-Monitor,jpsingleton/Raspberry-Pi-Electricity-Monitor | ---
+++
@@ -0,0 +1,31 @@
+import serial
+import struct
+import datetime
+import time
+import urllib2
+
+# Replace this with your emoncms Write API Key from the user account page
+writeApiKey = 'WRITE API KEY GOES HERE'
+
+# Change this if you use a different host or SSL (a must if not on a LAN)
+baseAddress = 'http:/... | |
99d790a76e83185cc9c1dc000b3161e346fbebc1 | alembic/versions/59ee93c4bf71_add_the_oneshot_column.py | alembic/versions/59ee93c4bf71_add_the_oneshot_column.py | """Add the oneshot column.
Revision ID: 59ee93c4bf71
Revises: 3de9ad66862f
Create Date: 2015-03-20 13:38:03.081566
"""
# revision identifiers, used by Alembic.
revision = '59ee93c4bf71'
down_revision = '3de9ad66862f'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('filters', sa.Col... | Add forgotten alembic upgrade script. | Add forgotten alembic upgrade script.
| Python | lgpl-2.1 | jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | ---
+++
@@ -0,0 +1,22 @@
+"""Add the oneshot column.
+
+Revision ID: 59ee93c4bf71
+Revises: 3de9ad66862f
+Create Date: 2015-03-20 13:38:03.081566
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '59ee93c4bf71'
+down_revision = '3de9ad66862f'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def up... | |
fbb79398a9a6ddf5ffd850b2594b44066329bd98 | python/yaml_tester.py | python/yaml_tester.py | import sys
import pprint
import time
import yaml
import ygp
try:
from yaml import CSafeLoader as SafeLoader
except:
from yaml import SafeLoader
path = sys.argv[1]
ygp_time = 0
yaml_time = 0
for path in sys.argv[1:]:
print 'checking', path
src = open(path).read()
start = time.time()
yaml_ve... | Add script to validate files are yamelot compatible | Add script to validate files are yamelot compatible
| Python | mit | gnprice/yamelot,gnprice/yamelot,gnprice/yamelot,gnprice/yamelot,gnprice/yamelot,gnprice/yamelot | ---
+++
@@ -0,0 +1,33 @@
+import sys
+
+import pprint
+import time
+import yaml
+import ygp
+
+try:
+ from yaml import CSafeLoader as SafeLoader
+except:
+ from yaml import SafeLoader
+
+path = sys.argv[1]
+ygp_time = 0
+yaml_time = 0
+
+for path in sys.argv[1:]:
+ print 'checking', path
+
+ src = open(pa... | |
75bcef02660da492bcbaa1bad4a15a55f64a6df9 | stdnum/iso9362.py | stdnum/iso9362.py | # iso9362.py - functions for handling ISO 9362 Business identifier codes
#
# Copyright (C) 2015 Lifealike Ltd
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the... | Add ISO 9362 (BIC) support | Add ISO 9362 (BIC) support
| Python | lgpl-2.1 | arthurdejong/python-stdnum,holvi/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum,dchoruzy/python-stdnum,t0mk/python-stdnum | ---
+++
@@ -0,0 +1,86 @@
+# iso9362.py - functions for handling ISO 9362 Business identifier codes
+#
+# Copyright (C) 2015 Lifealike Ltd
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Found... | |
a74f20b573f98fb213ded92f4447140ac1f00e31 | euler028.py | euler028.py | #!/usr/bin/python
count = 1
target = 3
step = 2
LIMIT = 1001
while step < LIMIT:
for i in range(4):
count += target
target += step
target += 2
step += 2
print(count)
| Add solution for problem 28 | Add solution for problem 28
| Python | mit | cifvts/PyEuler | ---
+++
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+
+count = 1
+target = 3
+step = 2
+LIMIT = 1001
+
+while step < LIMIT:
+ for i in range(4):
+ count += target
+ target += step
+ target += 2
+ step += 2
+
+print(count) | |
d656978e96489d7ce6cd0d91f90807ff2dc1f1ef | heat/tests/functional/test_WordPress_Single_Instance_With_EIP.py | heat/tests/functional/test_WordPress_Single_Instance_With_EIP.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | Add new functional test for WordPress_Single_Instance_With_EIP | Add new functional test for WordPress_Single_Instance_With_EIP
Change-Id: I483c5c32b9c29dc966bd154d760108292fcdbf5f
Signed-off-by: Jeff Peeler <d776211e63e47e40d00501ffdb86a800e0782fea@redhat.com>
| Python | apache-2.0 | cwolferh/heat-scratch,rh-s/heat,redhat-openstack/heat,steveb/heat,Triv90/Heat,citrix-openstack-build/heat,steveb/heat,miguelgrinberg/heat,takeshineshiro/heat,rh-s/heat,Triv90/Heat,pshchelo/heat,JioCloud/heat,pshchelo/heat,dims/heat,pratikmallya/heat,cryptickp/heat,cwolferh/heat-scratch,dims/heat,takeshineshiro/heat,dra... | ---
+++
@@ -0,0 +1,61 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# 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
+... | |
f3da7964fbdef7241d25dde2fd1489a64f710c36 | test/test_reply.py | test/test_reply.py | import unittest
import mock
import settings
from soa.tiquets import GestioTiquets
from soa.identitat import GestioIdentitat
from filtres.reply import FiltreReply
from mailticket import MailTicket
class TestReply(unittest.TestCase):
def setUp(self):
self.tickets = mock.create_autospec(GestioTi... | Test per comprovar la nova funcionalitat | Test per comprovar la nova funcionalitat | Python | agpl-3.0 | UPC/mailtoticket,alexm/mailtoticket,UPC/mailtoticket,alexm/mailtoticket,aaguilera/mailtoticket,aaguilera/mailtoticket,jaumemoral/mailtoticket,jaumemoral/mailtoticket | ---
+++
@@ -0,0 +1,47 @@
+import unittest
+import mock
+import settings
+from soa.tiquets import GestioTiquets
+from soa.identitat import GestioIdentitat
+from filtres.reply import FiltreReply
+from mailticket import MailTicket
+
+
+class TestReply(unittest.TestCase):
+
+ def setUp(self):
+ self.tickets = m... | |
2660658a556d9f9bf511f18173b009db460b774b | tests/test_log.py | tests/test_log.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import io
from logging import StreamHandler
from unittest import TestCase
from logger import log
class TestLog(TestCase):
def test_set_level(self):
out = io.StringIO()
log.logger.addHandler(StreamHandler(stream=out))
log.set_level(log.Level.W... | Add test case for log.py. | Add test case for log.py.
| Python | mit | ujiro99/auto_logger,ujiro99/auto_logger | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+import io
+from logging import StreamHandler
+from unittest import TestCase
+
+from logger import log
+
+
+class TestLog(TestCase):
+ def test_set_level(self):
+ out = io.StringIO()
+ log.logger.addHandler(StreamHandler(stream... | |
7aa378e269d7c72cd36e79ab0fcfcda67e4dd261 | polyaxon/auditor/events/experiment_group.py | polyaxon/auditor/events/experiment_group.py | import auditor
from libs.event_manager import event_types
from libs.event_manager.event import Event
class ExperimentGroupCreatedEvent(Event):
type = event_types.EXPERIMENT_GROUP_CREATED
class ExperimentGroupUpdatedEvent(Event):
type = event_types.EXPERIMENT_GROUP_UPDATED
class ExperimentGroupDeletedEvent... | Add auditor experiment group's events | Add auditor experiment group's events
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | ---
+++
@@ -0,0 +1,70 @@
+import auditor
+from libs.event_manager import event_types
+from libs.event_manager.event import Event
+
+
+class ExperimentGroupCreatedEvent(Event):
+ type = event_types.EXPERIMENT_GROUP_CREATED
+
+
+class ExperimentGroupUpdatedEvent(Event):
+ type = event_types.EXPERIMENT_GROUP_UPDAT... | |
d58f249191f3e7746d68317c9fccc5a92601b8d0 | metaopt/optimizer/randomsearch.py | metaopt/optimizer/randomsearch.py | # -*- coding: utf-8 -*-
# Future
from __future__ import absolute_import, division, print_function, \
unicode_literals, with_statement
# First Party
from metaopt.core.arg.util.creator import ArgsCreator
from metaopt.core.stoppable.util.exception import StoppedError
from metaopt.optimizer.optimizer import Optimizer
... | Add first version of a random search optimizer | Add first version of a random search optimizer
| Python | bsd-3-clause | cigroup-ol/metaopt,cigroup-ol/metaopt,cigroup-ol/metaopt | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+# Future
+from __future__ import absolute_import, division, print_function, \
+ unicode_literals, with_statement
+
+# First Party
+from metaopt.core.arg.util.creator import ArgsCreator
+from metaopt.core.stoppable.util.exception import StoppedError
+from metaopt.o... | |
53c4ab4ae1d463994f4b730295450b3297ecd094 | tools/regenerate_yamls.py | tools/regenerate_yamls.py | import os
import yaml
import girder_client
rsl_page_root = os.environ.get(
'RSL_PAGE_ROOT', '/home/xarth/codes/rensimlab/rensimlab.github.io')
collectionPath = '/collection/Renaissance Simulations'
gc = girder_client.GirderClient(apiUrl='https://girder.rensimlab.xyz/api/v1')
server_paths = yaml.load(
open(os... | Add script for regenerating yaml files | Add script for regenerating yaml files
| Python | mit | rensimlab/rensimlab.github.io,rensimlab/rensimlab.github.io,rensimlab/rensimlab.github.io | ---
+++
@@ -0,0 +1,37 @@
+import os
+import yaml
+import girder_client
+
+rsl_page_root = os.environ.get(
+ 'RSL_PAGE_ROOT', '/home/xarth/codes/rensimlab/rensimlab.github.io')
+
+collectionPath = '/collection/Renaissance Simulations'
+gc = girder_client.GirderClient(apiUrl='https://girder.rensimlab.xyz/api/v1')
+
... | |
4d16656304b9702c124721e82ea0dcda3c40ae44 | wqflask/tests/wqflask/test_collect.py | wqflask/tests/wqflask/test_collect.py | """Test cases for some methods in collect.py"""
import unittest
import mock
from flask import Flask
from wqflask.collect import process_traits
app = Flask(__name__)
class MockSession:
"""Helper class for mocking wqflask.collect.g.user_session.logged_in"""
def __init__(self, is_logged_in=False):
sel... | Add test for process_traits from collections.py | Add test for process_traits from collections.py
* wqflask/tests/wqflask/test_collect.py: Add it.
| Python | agpl-3.0 | zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2 | ---
+++
@@ -0,0 +1,57 @@
+"""Test cases for some methods in collect.py"""
+
+import unittest
+import mock
+
+from flask import Flask
+from wqflask.collect import process_traits
+
+app = Flask(__name__)
+
+
+class MockSession:
+ """Helper class for mocking wqflask.collect.g.user_session.logged_in"""
+ def __init... | |
6fcbdd225b3f7f47bd481ea63d7487b08c549625 | src/apps/dive_log/migrations/0003_auto_20150131_0946.py | src/apps/dive_log/migrations/0003_auto_20150131_0946.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('dive_log', '0002_datapoint'),
]
operations = [
migrations.AlterModelOptions(
name='datapoint',
optio... | Migrate sort order of datapoints | Migrate sort order of datapoints
| Python | mit | GotlingSystem/apnea,GotlingSystem/apnea | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('dive_log', '0002_datapoint'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ ... | |
e5a6329d5be5d570d43feabe2c3e58a0b86ae9b3 | tests/tests_tags/tests_electronic.py | tests/tests_tags/tests_electronic.py | """
SkCode electronic tag test code.
"""
import unittest
from skcode import (parse_skcode,
render_to_html,
render_to_text,
render_to_skcode)
from skcode.tags import (NotNotationTagOptions,
DEFAULT_RECOGNIZED_TAGS)
class NotNotation... | Add tests suite for electronic NOT tag. | Add tests suite for electronic NOT tag.
| Python | agpl-3.0 | TamiaLab/PySkCode | ---
+++
@@ -0,0 +1,61 @@
+"""
+SkCode electronic tag test code.
+"""
+
+import unittest
+
+from skcode import (parse_skcode,
+ render_to_html,
+ render_to_text,
+ render_to_skcode)
+from skcode.tags import (NotNotationTagOptions,
+ DEFAU... | |
f04fe3f19efc7fb01c7b2dc9cd09f329ca404c12 | utils/csv-to-json.py | utils/csv-to-json.py | import argparse
import csv
import json
import sys
from decimal import Decimal
from re import sub
parser = argparse.ArgumentParser(description='Convert Octavia Street Hilton expenses spreadsheet data to JSON.')
parser.add_argument('--csv', dest='csv_file', metavar='c', type=str, nargs=1,
help='an in... | Convert OSH expense data CSV to JSON | Convert OSH expense data CSV to JSON
| Python | apache-2.0 | cartland/octavia-street-hilton,cartland/octavia-street-hilton,cartland/octavia-street-hilton | ---
+++
@@ -0,0 +1,51 @@
+import argparse
+import csv
+import json
+import sys
+
+from decimal import Decimal
+from re import sub
+
+parser = argparse.ArgumentParser(description='Convert Octavia Street Hilton expenses spreadsheet data to JSON.')
+parser.add_argument('--csv', dest='csv_file', metavar='c', type=str, na... | |
37f22e55abf84c39846245fde53baf441dde7bff | tests/filter/test_paged_filterset.py | tests/filter/test_paged_filterset.py | from tests.apps.questions import models as question_models
from adhocracy4.filters.filters import PagedFilterSet
class TextFilter(PagedFilterSet):
class Meta:
model = question_models.Question
fields = ['text']
def test_page_clean_query(rf):
request = rf.get('/questions', {
'page': ... | Test to ensure GET data is cleaned from page arg | Test to ensure GET data is cleaned from page arg
| Python | agpl-3.0 | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | ---
+++
@@ -0,0 +1,19 @@
+from tests.apps.questions import models as question_models
+
+from adhocracy4.filters.filters import PagedFilterSet
+
+
+class TextFilter(PagedFilterSet):
+
+ class Meta:
+ model = question_models.Question
+ fields = ['text']
+
+
+def test_page_clean_query(rf):
+ request ... | |
f24fb7c26fd64d1039fc02318d42c89064c57cfc | tests/integration/shell/arguments.py | tests/integration/shell/arguments.py | # -*- coding: utf-8 -*-
'''
Test Salt's argument parser
'''
# Import Salt Testing libs
from salttesting import TestCase
from salttesting.helpers import ensure_in_syspath, requires_salt_modules
ensure_in_syspath('../../')
# Import Salt libs
from salt.exceptions import SaltInvocationError
import integration
@req... | Add test for unsupported kwarg | Add test for unsupported kwarg
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+'''
+ Test Salt's argument parser
+'''
+
+# Import Salt Testing libs
+from salttesting import TestCase
+from salttesting.helpers import ensure_in_syspath, requires_salt_modules
+
+ensure_in_syspath('../../')
+
+# Import Salt libs
+from salt.exceptions import SaltI... | |
3b53634f1888db8bc25e3b0bcf4eeb3b837ae370 | playerAction.py | playerAction.py | import mcpi.minecraft as minecraft
import time
mc = minecraft.Minecraft.create()
while True:
pos = mc.player.getPos()
x = pos.x
y = pos.y
z = pos.z
# Display position
#print x, y, z
time.sleep(2)
if x >= 343.300 and y <= 344.700 and z <= -301.300 and z >= -302.700 and y == 4:... | Add player position action script | Add player position action script
| Python | mit | Nekrofage/MinecraftPython | ---
+++
@@ -0,0 +1,18 @@
+import mcpi.minecraft as minecraft
+import time
+mc = minecraft.Minecraft.create()
+
+while True:
+ pos = mc.player.getPos()
+ x = pos.x
+ y = pos.y
+ z = pos.z
+
+ # Display position
+ #print x, y, z
+
+ time.sleep(2)
+
+ if x >= 343.300 and y <= 344.700 and ... | |
97942a6a79ddc269adeb761cc6e2a4aadb94dc65 | samples/prepare_samples.py | samples/prepare_samples.py | #!/usr/bin/env python
"""
Prepares for running samples.
It just generates maf.py and copies maf.py and waf to each sample directory.
Please run this script before trying these samples.
"""
import glob
import os
import shutil
import subprocess
if __name__ == '__main__':
os.chdir('..')
subprocess.check_call('.... | Add script to copy maf.py and waf | Add script to copy maf.py and waf
| Python | bsd-2-clause | pfi/maf,pfi/maf | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+"""
+Prepares for running samples.
+It just generates maf.py and copies maf.py and waf to each sample directory.
+Please run this script before trying these samples.
+"""
+
+import glob
+import os
+import shutil
+import subprocess
+
+if __name__ == '__main__':
+ o... | |
2de13254866d829089670135ac5844ceaff8994f | prefix_sums/min_impact_in_dna_sequence.py | prefix_sums/min_impact_in_dna_sequence.py | def get_prefix_sum(A):
result = [0] * (len(A) + 1)
for i in xrange(1, len(A) + 1):
result[i] = result[i - 1] + A[i -1]
return result
def solution(S, P, Q):
hasA = get_prefix_sum([s == 'A' for s in S])
hasC = get_prefix_sum([s == 'C' for s in S])
hasG = get_prefix_sum([s == 'G' for s in ... | Add algorithm for min impact calculation of DNA seq. | Add algorithm for min impact calculation of DNA seq.
| Python | apache-2.0 | isendel/algorithms | ---
+++
@@ -0,0 +1,25 @@
+def get_prefix_sum(A):
+ result = [0] * (len(A) + 1)
+ for i in xrange(1, len(A) + 1):
+ result[i] = result[i - 1] + A[i -1]
+ return result
+
+def solution(S, P, Q):
+ hasA = get_prefix_sum([s == 'A' for s in S])
+ hasC = get_prefix_sum([s == 'C' for s in S])
+ hasG... | |
9e024eec337a4d1fabdf570d65cd841eac204a6f | project_euler/021.amicable_numbers.py | project_euler/021.amicable_numbers.py | '''
Problem 021
Let d(n) be defined as the sum of proper divisors of n (numbers less than n
which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and
each of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, ... | Solve amicable numbers with cache | Solve amicable numbers with cache
| Python | mit | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various | ---
+++
@@ -0,0 +1,74 @@
+'''
+Problem 021
+
+Let d(n) be defined as the sum of proper divisors of n (numbers less than n
+ which divide evenly into n).
+
+If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and
+ each of a and b are called amicable numbers.
+
+For example, the proper divisor... | |
513b64423999f85f0cbc9cc0a44d6ef5962dd171 | examples/mdct_synth.py | examples/mdct_synth.py | import featureflow as ff
import zounds
from random import choice
samplerate = zounds.SR11025()
BaseDocument = zounds.stft(resample_to=samplerate)
@zounds.simple_lmdb_settings('mdct_synth', map_size=1e10)
class Document(BaseDocument):
mdct = zounds.TimeFrequencyRepresentationFeature(
zounds.MDCT,
... | Add new example for a simple k-means encoded MDCT synthesizer | Add new example for a simple k-means encoded MDCT synthesizer
| Python | mit | JohnVinyard/zounds,JohnVinyard/zounds,JohnVinyard/zounds,JohnVinyard/zounds | ---
+++
@@ -0,0 +1,99 @@
+import featureflow as ff
+import zounds
+from random import choice
+
+samplerate = zounds.SR11025()
+BaseDocument = zounds.stft(resample_to=samplerate)
+
+
+@zounds.simple_lmdb_settings('mdct_synth', map_size=1e10)
+class Document(BaseDocument):
+ mdct = zounds.TimeFrequencyRepresentation... | |
2137970240a9524990d55d711951fb7358621275 | dedup_xspf.py | dedup_xspf.py | import xml.etree.ElementTree as ET
from urllib.parse import unquote, urlparse
import os
import sys
from fuzzywuzzy import process, fuzz # ImportError? pip install 'fuzzywuzzy[speedup]'
import re
files = [unquote(urlparse(el.text).path)
for el in ET.parse(sys.argv[1]).getroot()
.findall(".//*/{http://xspf.org/ns/0... | Create a little dedup script, probably not very general | Create a little dedup script, probably not very general
| Python | mit | Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed | ---
+++
@@ -0,0 +1,22 @@
+import xml.etree.ElementTree as ET
+from urllib.parse import unquote, urlparse
+import os
+import sys
+from fuzzywuzzy import process, fuzz # ImportError? pip install 'fuzzywuzzy[speedup]'
+import re
+
+files = [unquote(urlparse(el.text).path)
+ for el in ET.parse(sys.argv[1]).getroot()
+ ... | |
6acb354fff4aafcdc006a13d947721d7dcfff5c5 | sample/src/app/app.py | sample/src/app/app.py | #!/usr/bin/env python
import os
import json
from flask import jsonify
from flask import Flask
app = Flask(__name__)
@app.route("/env")
def environment():
properties = []
for k,v in sorted(os.environ.iteritems()):
properties.append(k + "=" + v)
return json.dumps(properties, indent=4)
if __name__ == "__main__":
... | #!/usr/bin/env python
import os
import json
from flask import jsonify
from flask import Flask
app = Flask(__name__)
@app.route("/env")
def environment():
return json.dumps(dict(os.environ), indent=4)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=int(os.getenv('PORT', '8080')))
| Return env as dict rather than array of properties | Return env as dict rather than array of properties
| Python | apache-2.0 | cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,alex-slynko/tile-generator,alex-slynko/tile-generator,alex-slynko/tile-generator,alex-slynko/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator | ---
+++
@@ -9,10 +9,7 @@
@app.route("/env")
def environment():
- properties = []
- for k,v in sorted(os.environ.iteritems()):
- properties.append(k + "=" + v)
- return json.dumps(properties, indent=4)
+ return json.dumps(dict(os.environ), indent=4)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=int... |
84fe4ef3b99990afba49a5943c9523797cdb5a7a | network_plugin/security_group.py | network_plugin/security_group.py | from cloudify import ctx
from cloudify import exceptions as cfy_exc
from cloudify.decorators import operation
from vcloud_plugin_common import with_vcd_client, wait_for_task
from network_operations import ProxyVCD
from network_plugin import check_ip, get_vm_ip
valid_protocols = ["Tcp", "Udp", "Icmp", "Any"]
CREATE_RU... | Add new security group operation source code | Add new security group operation source code
| Python | apache-2.0 | nmishkin/tosca-vcloud-plugin,cloudify-cosmo/tosca-vcloud-plugin,kemiz/tosca-vcloud-plugin,denismakogon/tosca-vcloud-plugin,vmware/tosca-vcloud-plugin,geokala/tosca-vcloud-plugin | ---
+++
@@ -0,0 +1,56 @@
+from cloudify import ctx
+from cloudify import exceptions as cfy_exc
+from cloudify.decorators import operation
+from vcloud_plugin_common import with_vcd_client, wait_for_task
+from network_operations import ProxyVCD
+from network_plugin import check_ip, get_vm_ip
+
+valid_protocols = ["Tcp... | |
aacbfc7039456f66139b3d2f9789b0edbc36428d | neurokernel/tools/graph_utils.py | neurokernel/tools/graph_utils.py | #!/usr/bin/env python
"""
Graph manipulation and visualization tools
"""
import tempfile
import os
import matplotlib.pyplot as plt
import networkx as nx
def imdisp(f):
"""
Display the specified image file using matplotlib.
"""
im = plt.imread(f)
plt.imshow(im)
plt.axis('off')
plt.dr... | Add networkx graph display utilities. | Add networkx graph display utilities.
| Python | bsd-3-clause | cerrno/neurokernel | ---
+++
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+"""
+Graph manipulation and visualization tools
+"""
+
+import tempfile
+import os
+
+import matplotlib.pyplot as plt
+import networkx as nx
+
+def imdisp(f):
+ """
+ Display the specified image file using matplotlib.
+ """
+
+ im = plt.imread(f)
+ ... | |
91fa4f5079f463b3a1f90e0c40daa8d5a529439a | exp/alto/tools/filter_lines.py | exp/alto/tools/filter_lines.py | #!/usr/bin/env python
import sys
from sets import Set
#Should be used on IRTGs with multiple language preterms/terminals
def filter_lines(fn):
seen = Set()
skip = False
is_empty = True
file_lines = open(fn, "r").readlines()
for line in file_lines:
line = line.strip()
if line == ""... | Add script for filtering lines of IRTGs with multiple language preterms/terminals | Add script for filtering lines of IRTGs with multiple language preterms/terminals
| Python | mit | kornai/4lang,kornai/4lang,kornai/4lang,kornai/4lang | ---
+++
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+import sys
+from sets import Set
+
+#Should be used on IRTGs with multiple language preterms/terminals
+def filter_lines(fn):
+ seen = Set()
+ skip = False
+ is_empty = True
+ file_lines = open(fn, "r").readlines()
+ for line in file_lines:
+ li... | |
82ccee8813beea3fd2fb7a410ca341efc2133f07 | tests/test_config.py | tests/test_config.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from unittest import TestCase
from spdx import config
from spdx.version import Version
class TestLicenseList(TestCase):
def test_load_license_list(self):
version, licenses... | Add tests for config.py functions and constants. | Add tests for config.py functions and constants.
Signed-off-by: Xavier Figueroa <2556c6f4facc1e5829d3394b9ce7316a84702c26@gmail.com>
| Python | apache-2.0 | spdx/tools-python | ---
+++
@@ -0,0 +1,29 @@
+from __future__ import absolute_import
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import unittest
+from unittest import TestCase
+
+from spdx import config
+from spdx.version import Version
+
+class TestLicenseList(TestCase):
+
+ def test_load_licen... | |
cb6105f837c4d5ca3cd06306a7b978905e89cb40 | scripts/export_db.py | scripts/export_db.py | #!/usr/bin/env python
import os
from datetime import datetime
# Config
dbs = ["F_ST_ETIENNE_CMPP", "F_ST_ETIENNE_CAMSP", "F_ST_ETIENNE_SESSAD", "F_ST_ETIENNE_SESSAD_TED"]
tables = ["actes", "actes_non_factures", "ev"]
export_path = os.path.join("C:\\", "export", datetime.now().strftime("%Y%m%d-%H%M%S"))
os.mkdir(e... | Add a script to export Flaure DB | Add a script to export Flaure DB
| Python | agpl-3.0 | ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+import os
+
+from datetime import datetime
+
+# Config
+dbs = ["F_ST_ETIENNE_CMPP", "F_ST_ETIENNE_CAMSP", "F_ST_ETIENNE_SESSAD", "F_ST_ETIENNE_SESSAD_TED"]
+tables = ["actes", "actes_non_factures", "ev"]
+export_path = os.path.join("C:\\", "export", datetime.now().st... | |
14604c214b5117ad8fce4b92fd2bc911cb1a56b6 | flexget/plugins/input_find.py | flexget/plugins/input_find.py | import logging
from flexget.plugin import register_plugin
log = logging.getLogger('find')
class InputFind:
"""
Uses local path content as an input, recurses through directories and creates entries for files that match mask.
You can specify either the mask key, in shell file matching fo... | Add the find input plugin, which will produce entries from a local directory that match a mask. | Add the find input plugin, which will produce entries from a local directory that match a mask.
git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1616 3942dd89-8c5d-46d7-aeed-044bccf3e60c
| Python | mit | voriux/Flexget,spencerjanssen/Flexget,thalamus/Flexget,Pretagonist/Flexget,sean797/Flexget,qk4l/Flexget,Flexget/Flexget,thalamus/Flexget,jacobmetrick/Flexget,crawln45/Flexget,cvium/Flexget,jacobmetrick/Flexget,vfrc2/Flexget,Danfocus/Flexget,poulpito/Flexget,offbyone/Flexget,oxc/Flexget,LynxyssCZ/Flexget,grrr2/Flexget,v... | ---
+++
@@ -0,0 +1,76 @@
+import logging
+from flexget.plugin import register_plugin
+
+log = logging.getLogger('find')
+
+
+class InputFind:
+ """
+ Uses local path content as an input, recurses through directories and creates entries for files that match mask.
+
+ You can specify either the mask ke... | |
769228b6ecf29112c1880802404152822687bb8e | backend/data_controller.py | backend/data_controller.py | from google.protobuf.json_format import MessageToDict
from grpc.messages import data_pb2
import config
from flask_restful import Resource
from flask import request, Flask
import csv
from google.protobuf.timestamp_pb2 import Timestamp
from datetime import datetime
saved_data = {}
app = Flask(__name__)
class Data(Reso... | Create Data resource for sending data from the server | Create Data resource for sending data from the server
| Python | apache-2.0 | googleinterns/inventory-visualizer,googleinterns/inventory-visualizer,googleinterns/inventory-visualizer,googleinterns/inventory-visualizer,googleinterns/inventory-visualizer | ---
+++
@@ -0,0 +1,46 @@
+from google.protobuf.json_format import MessageToDict
+from grpc.messages import data_pb2
+import config
+from flask_restful import Resource
+from flask import request, Flask
+import csv
+from google.protobuf.timestamp_pb2 import Timestamp
+from datetime import datetime
+
+saved_data = {}
+a... | |
21820105c0986cf24b294ef26e70feac81caba5b | examples/web_flask.py | examples/web_flask.py | #!/usr/bin/env python3
# Install dependencies with:
# pip install flask requests requests_oauth2
import os
import logging
import requests
from requests_oauth2.services import GoogleClient
from requests_oauth2 import OAuth2BearerToken
from flask import Flask, request, redirect, session
app = Flask(__name__)
app.secre... | Add an example Flask app | Add an example Flask app
| Python | bsd-3-clause | maraujop/requests-oauth2 | ---
+++
@@ -0,0 +1,63 @@
+#!/usr/bin/env python3
+# Install dependencies with:
+# pip install flask requests requests_oauth2
+import os
+import logging
+import requests
+
+from requests_oauth2.services import GoogleClient
+from requests_oauth2 import OAuth2BearerToken
+from flask import Flask, request, redirect, sess... | |
33ddbe6adc266bfaaf1b89c5780a94a325d51277 | tests/UselessSymbolsRemove/EpsilonTest.py | tests/UselessSymbolsRemove/EpsilonTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 19.08.2017 16:34
:Licence GNUv3
Part of grammpy-transforms
"""
from unittest import TestCase, main
from grammpy import *
from grammpy_transforms import *
class S(Nonterminal): pass
class A(Nonterminal): pass
class B(Nonterminal): pass
class C(Nonterminal): p... | Add test with epsilon rules | Add test with epsilon rules
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 19.08.2017 16:34
+:Licence GNUv3
+Part of grammpy-transforms
+
+"""
+
+from unittest import TestCase, main
+from grammpy import *
+from grammpy_transforms import *
+
+class S(Nonterminal): pass
+class A(Nonterminal): pass
+class B... | |
a2ebaa051573e72470da241b341d82a89316a796 | tests/test_utils.py | tests/test_utils.py | # -*- coding: utf-8 -*-
import unittest
from quantized_mesh_tile.utils import octDecode, octEncode
class TestUtils(unittest.TestCase):
def testOctDecode(self):
vec3 = octDecode(0, 0)
self.assertEqual(vec3[0], 0.0)
self.assertEqual(vec3[1], 0.0)
self.assertEqual(vec3[2], -1.0)
... | Add tests for oct enc/dec | Add tests for oct enc/dec
| Python | mit | loicgasser/quantized-mesh-tile | ---
+++
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+import unittest
+from quantized_mesh_tile.utils import octDecode, octEncode
+
+
+class TestUtils(unittest.TestCase):
+
+ def testOctDecode(self):
+ vec3 = octDecode(0, 0)
+ self.assertEqual(vec3[0], 0.0)
+ self.assertEqual(vec3[1], 0.0)
+ ... | |
49d847cfc6381dc6df41447eba650a5bf265a163 | tests/test_geometry.py | tests/test_geometry.py | from gaphas.geometry import (
distance_rectangle_point,
intersect_line_line,
point_on_rectangle,
)
def test_distance_rectangle_point():
assert distance_rectangle_point((2, 0, 2, 2), (0, 0)) == 2
def test_distance_point_in_rectangle():
assert distance_rectangle_point((0, 0, 2, 2), (1, 1)) == 0
... | Add tests for geometry module | Add tests for geometry module
| Python | lgpl-2.1 | amolenaar/gaphas | ---
+++
@@ -0,0 +1,30 @@
+from gaphas.geometry import (
+ distance_rectangle_point,
+ intersect_line_line,
+ point_on_rectangle,
+)
+
+
+def test_distance_rectangle_point():
+ assert distance_rectangle_point((2, 0, 2, 2), (0, 0)) == 2
+
+
+def test_distance_point_in_rectangle():
+ assert distance_recta... | |
8ccdd028347a73fc4706b0d34c4ee90eb9777336 | run.py | run.py | # -*- coding: utf-8 -*-
"""
Eve Demo
~~~~~~~~
A demostration of a simple API powered by Eve REST API.
The live demo is available at eve-demo.herokuapp.com. Please keep in mind
that the it is running on Heroku's free tier using a free MongoHQ
sandbox, which means that the first request to the ... | # -*- coding: utf-8 -*-
"""
Eve Demo
~~~~~~~~
A demostration of a simple API powered by Eve REST API.
The live demo is available at eve-demo.herokuapp.com. Please keep in mind
that the it is running on Heroku's free tier using a free MongoHQ
sandbox, which means that the first request to the ... | Use '0.0.0.0' to ensure your API is reachable outside localhost. | Use '0.0.0.0' to ensure your API is reachable outside localhost.
| Python | bsd-3-clause | nicolaiarocci/eve-demo,kidaa/eve-demo | ---
+++
@@ -22,6 +22,8 @@
# Heroku support: bind to PORT if defined, otherwise default to 5000.
if 'PORT' in os.environ:
port = int(os.environ.get('PORT'))
+ # use '0.0.0.0' to ensure your REST API is reachable from all your
+ # network (and not only your computer).
host = '0... |
e1634155d24be11d9f6648dd8983d76d4da78419 | base/model_utils.py | base/model_utils.py | from django.db import models
class TimeStampedModel(models.Model):
"""
An abstract base class model that provides self-updating
``created`` and ``modified`` fields
"""
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
class Meta:
abst... | Move 'TimeStampedModel' to 'base' so it can be used in other apps | Move 'TimeStampedModel' to 'base' so it can be used in other apps
| Python | apache-2.0 | pkimber/base,pkimber/base,pkimber/base,pkimber/base | ---
+++
@@ -0,0 +1,13 @@
+from django.db import models
+
+
+class TimeStampedModel(models.Model):
+ """
+ An abstract base class model that provides self-updating
+ ``created`` and ``modified`` fields
+ """
+ created = models.DateTimeField(auto_now_add=True)
+ modified = models.DateTimeField(auto_no... | |
ae70dff0fddd580c82f744b0a450e489092014ac | fjord/base/tests/test_urlresolvers.py | fjord/base/tests/test_urlresolvers.py | from nose.tools import eq_
from fjord.base.tests import TestCase
from fjord.base.urlresolvers import reverse
class TestReverse(TestCase):
def test_no_locale(self):
# Note: This depends on the 'about' view. If we change that,
# then it breaks this test. But it seems silly to do a bunch
# o... | Add tests for new reverse | Add tests for new reverse
This adds the tests that should have gone with commit 16250bf.
| Python | bsd-3-clause | rlr/fjord,mozilla/fjord,hoosteeno/fjord,mozilla/fjord,mozilla/fjord,DESHRAJ/fjord,staranjeet/fjord,Ritsyy/fjord,rlr/fjord,staranjeet/fjord,lgp171188/fjord,Ritsyy/fjord,Ritsyy/fjord,Ritsyy/fjord,staranjeet/fjord,lgp171188/fjord,rlr/fjord,hoosteeno/fjord,staranjeet/fjord,mozilla/fjord,hoosteeno/fjord,rlr/fjord,lgp171188/... | ---
+++
@@ -0,0 +1,18 @@
+from nose.tools import eq_
+
+from fjord.base.tests import TestCase
+from fjord.base.urlresolvers import reverse
+
+
+class TestReverse(TestCase):
+ def test_no_locale(self):
+ # Note: This depends on the 'about' view. If we change that,
+ # then it breaks this test. But it ... | |
bdc3fab8c4da9bd64de46cedc600fcf1c771aada | tests/functional/test_create_space.py | tests/functional/test_create_space.py | #/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010-2012 Cidadania S. Coop. Galega
#
# This file is part of e-cidadania.
#
# e-cidadania 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 v... | Add functional tests for create a space. | Add functional tests for create a space.
| Python | apache-2.0 | cidadania/e-cidadania,cidadania/e-cidadania | ---
+++
@@ -0,0 +1,75 @@
+#/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2010-2012 Cidadania S. Coop. Galega
+#
+# This file is part of e-cidadania.
+#
+# e-cidadania is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# t... | |
4c875e312b35e19392c395da1bfe75bf61137b0b | marco/marco/wsgi_web468.py | marco/marco/wsgi_web468.py | """WSGI File for Web468
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marco.settings")
activate_this = '/home/point97/env/marco_portal2/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
| Add wsgi file for 468 | Add wsgi file for 468
| Python | isc | MidAtlanticPortal/marco-portal2,MidAtlanticPortal/marco-portal2,MidAtlanticPortal/marco-portal2,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,MidAtlanticPortal/marco-portal2,Ecotrust/marineplanner-core | ---
+++
@@ -0,0 +1,11 @@
+"""WSGI File for Web468
+"""
+
+import os
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marco.settings")
+activate_this = '/home/point97/env/marco_portal2/bin/activate_this.py'
+execfile(activate_this, dict(__file__=activate_this))
+
+from django.core.wsgi import get_wsgi_application
+... | |
e184f5fea6425bc90ed1077fdd9cbacbaa12383e | django_select2/__init__.py | django_select2/__init__.py | # -*- coding: utf-8 -*-
"""
This is a Django_ integration of Select2_.
The app includes Select2 driven Django Widgets and Form Fields.
.. _Django: https://www.djangoproject.com/
.. _Select2: http://ivaynberg.github.com/select2/
"""
__version__ = "5.0.0"
| # -*- coding: utf-8 -*-
"""
This is a Django_ integration of Select2_.
The app includes Select2 driven Django Widgets and Form Fields.
.. _Django: https://www.djangoproject.com/
.. _Select2: http://ivaynberg.github.com/select2/
"""
__version__ = "5.0.1"
| Bump version number because v5.0.0 was taken on pypi due to mistake | Bump version number because v5.0.0 was taken on pypi due to mistake
| Python | apache-2.0 | DMOJ/django-select2,DMOJ/django-select2,anneFly/django-select2,anneFly/django-select2,applegrew/django-select2,rizumu/django-select2,anneFly/django-select2,applegrew/django-select2,rizumu/django-select2,rizumu/django-select2,applegrew/django-select2,DMOJ/django-select2 | ---
+++
@@ -9,4 +9,4 @@
"""
-__version__ = "5.0.0"
+__version__ = "5.0.1" |
06ba899aaaf5b8ff47c8ed6f317076c43d3351a0 | chainer/__init__.py | chainer/__init__.py | from chainer import function
from chainer import function_set
from chainer.functions import basic_math
from chainer import optimizer
from chainer import variable
Variable = variable.Variable
Function = function.Function
FunctionSet = function_set.FunctionSet
Optimizer = optimizer.Optimizer
basic_math.install_variable... | import pkg_resources
from chainer import function
from chainer import function_set
from chainer.functions import basic_math
from chainer import optimizer
from chainer import variable
__version__ = pkg_resources.get_distribution('chainer').version
Variable = variable.Variable
Function = function.Function
FunctionSet... | Add version number to chainer module | Add version number to chainer module
| Python | mit | t-abe/chainer,umitanuki/chainer,masia02/chainer,1986ks/chainer,benob/chainer,jnishi/chainer,ktnyt/chainer,AlpacaDB/chainer,sou81821/chainer,tscohen/chainer,okuta/chainer,Kaisuke5/chainer,keisuke-umezawa/chainer,pfnet/chainer,benob/chainer,hvy/chainer,kiyukuta/chainer,chainer/chainer,chainer/chainer,elviswf/chainer,kuwa... | ---
+++
@@ -1,8 +1,13 @@
+import pkg_resources
+
from chainer import function
from chainer import function_set
from chainer.functions import basic_math
from chainer import optimizer
from chainer import variable
+
+
+__version__ = pkg_resources.get_distribution('chainer').version
Variable = variable.Variable
... |
d7beafc221bbd54038654a87c680577b251d93de | extract_khan_assessment.py | extract_khan_assessment.py | """
extract_khan_assessment
Creates a khan_assessment.zip, fully compatible with KA Lite 0.15.x and below,
from a full content pack.
Usage:
extract_khan_assessment.py <content-pack-path> [<out-path>]
"""
import logging
import zipfile
from docopt import docopt
from pathlib import Path
ASSESSMENT_FOLDER_IN_ZIP = "... | Create a script to extract khan assessment resources. | Create a script to extract khan assessment resources.
And place them into their own zip file. New zip file is compatible with
khan_assessment.zip from KA Lite releases 0.15.x and below.
| Python | bsd-2-clause | fle-internal/content-pack-maker | ---
+++
@@ -0,0 +1,54 @@
+"""
+extract_khan_assessment
+
+Creates a khan_assessment.zip, fully compatible with KA Lite 0.15.x and below,
+from a full content pack.
+
+Usage:
+ extract_khan_assessment.py <content-pack-path> [<out-path>]
+
+"""
+import logging
+import zipfile
+from docopt import docopt
+from pathlib i... | |
f755060a8999a1d6ba007f24dda9d00b9bb9d5dd | UI/sunc_menu.py | UI/sunc_menu.py | # -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
from qt_interfaces.sync_menu_ui import Ui_SyncMenu
# Synchronization menu section #
class SyncMenuUI(QtGui.QMainWindow):
def __init__(self, parent=None,):
QtGui.QWidget.__init__(self, parent)
self.sync_menu_ui = Ui_SyncMenu()
self.sy... | Add sync menu backend init | Add sync menu backend init | Python | mit | lakewik/storj-gui-client | ---
+++
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+
+from PyQt4 import QtCore, QtGui
+from qt_interfaces.sync_menu_ui import Ui_SyncMenu
+
+# Synchronization menu section #
+class SyncMenuUI(QtGui.QMainWindow):
+
+ def __init__(self, parent=None,):
+ QtGui.QWidget.__init__(self, parent)
+ self.sync_m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.