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 |
|---|---|---|---|---|---|---|---|---|---|---|
c187f77d3cc05f35613f3355f1df56e11d012463 | bluebottle/payments_docdata/tests/test_gateway.py | bluebottle/payments_docdata/tests/test_gateway.py | from bluebottle.payments_docdata.gateway import DocdataClient, Amount, Shopper, Name, Destination, Address, Merchant
from bunch import bunchify
from mock import patch, Mock
from bluebottle.test.utils import BluebottleTestCase
class DocdataClientMock():
class service():
@staticmethod
def create(*... | Add test for Docdata gateway | Add test for Docdata gateway
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,56 @@
+from bluebottle.payments_docdata.gateway import DocdataClient, Amount, Shopper, Name, Destination, Address, Merchant
+
+from bunch import bunchify
+from mock import patch, Mock
+
+from bluebottle.test.utils import BluebottleTestCase
+
+
+class DocdataClientMock():
+ class service():
+ ... | |
faf9dfd9f1b1218ad58c281734b2af4074d0fd1f | tests/rules_tests/grammarManipulation_tests/InvalidAddTest.py | tests/rules_tests/grammarManipulation_tests/InvalidAddTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import Rule as _R, Grammar, Nonterminal as _N
class InvalidAddTest(TestCase):
pass
if __name__ == '__main__':
main()
| Add file for tests of rule invalid add | Add file for tests of rule invalid add
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 23.06.2017 16:39
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from unittest import TestCase, main
+from grammpy import Rule as _R, Grammar, Nonterminal as _N
+
+
+class InvalidAddTest(TestCase):
+ pass
+
+
+if __name__ == '__main... | |
79facb190017c156915c24d1ca6bd10c6b2021bb | apps/accounts/management/commands/fix_import_ggm.py | apps/accounts/management/commands/fix_import_ggm.py | import MySQLdb
from django.core.management.base import NoArgsCommand, BaseCommand
from django.db import transaction
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from apps.reminder.models import UserReminderInfo
from apps.survey.models import SurveyUser
class Command(NoArg... | Fix on ggm user import script | Fix on ggm user import script
| Python | agpl-3.0 | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website | ---
+++
@@ -0,0 +1,35 @@
+import MySQLdb
+
+from django.core.management.base import NoArgsCommand, BaseCommand
+from django.db import transaction
+from django.contrib.auth.models import User
+from django.contrib.auth import authenticate
+
+from apps.reminder.models import UserReminderInfo
+from apps.survey.models im... | |
7fb3df28b9fc9222e44ae48d8b2fd3c2a6b9fbfa | powerline/ext/vim/__init__.py | powerline/ext/vim/__init__.py | # -*- coding: utf-8 -*-
def source_plugin():
import os
import vim
vim.command('source ' + vim.eval('fnameescape("' + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'powerline.vim') + '")'))
| # -*- coding: utf-8 -*-
def source_plugin():
import os
import vim
from bindings import vim_get_func
fnameescape = vim_get_func('fnameescape')
vim.command('source ' + fnameescape(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'powerline.vim')))
| Change code to use vim_get_func('fnameescape') | Change code to use vim_get_func('fnameescape')
Previous version had problems with paths containing backslashes and/or
double quotes.
| Python | mit | junix/powerline,lukw00/powerline,S0lll0s/powerline,kenrachynski/powerline,EricSB/powerline,bezhermoso/powerline,bezhermoso/powerline,lukw00/powerline,prvnkumar/powerline,EricSB/powerline,blindFS/powerline,EricSB/powerline,xxxhycl2010/powerline,magus424/powerline,xfumihiro/powerline,dragon788/powerline,prvnkumar/powerli... | ---
+++
@@ -4,5 +4,8 @@
def source_plugin():
import os
import vim
+ from bindings import vim_get_func
- vim.command('source ' + vim.eval('fnameescape("' + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'powerline.vim') + '")'))
+ fnameescape = vim_get_func('fnameescape')
+
+ vim.command('source ' + f... |
e1d3befa79e30846dc905eb7225f51e9e374f21a | psyrun/tests/test_splitter.py | psyrun/tests/test_splitter.py | import os
import os.path
import pytest
from psyrun.core import load_infile, load_results, save_outfile
from psyrun.pspace import Param
from psyrun.split import Splitter
@pytest.mark.parametrize(
'pspace_size,max_splits,min_items,n_splits', [
(7, 4, 4, 2), (8, 4, 4, 2), (9, 4, 4, 3),
(15, 4, 4, 4... | Add unit test for Splitter. | Add unit test for Splitter.
| Python | mit | jgosmann/psyrun | ---
+++
@@ -0,0 +1,39 @@
+import os
+import os.path
+
+import pytest
+
+from psyrun.core import load_infile, load_results, save_outfile
+from psyrun.pspace import Param
+from psyrun.split import Splitter
+
+
+@pytest.mark.parametrize(
+ 'pspace_size,max_splits,min_items,n_splits', [
+ (7, 4, 4, 2), (8, 4, 4... | |
ce483720321097d982888f6dcb673b9348daad4e | doc/book/book-dist.py | doc/book/book-dist.py | #!/usr/bin/env python2
import sys
import os
import shutil
def die(msg):
sys.stderr.write('ERROR: ' + msg)
sys.exit(1)
cwd = os.getcwd()
if not os.path.exists('book') \
or not os.path.exists('Makefile'):
die('Please run this from the Subversion book source directory\n')
if not os.getenv('JAVA_HOME'):
... | Add a little package-em-up script for the Subversion book. | Add a little package-em-up script for the Subversion book.
git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@849264 13f79535-47bb-0310-9956-ffa450edef68
| Python | apache-2.0 | YueLinHo/Subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/env python2
+
+import sys
+import os
+import shutil
+
+def die(msg):
+ sys.stderr.write('ERROR: ' + msg)
+ sys.exit(1)
+
+cwd = os.getcwd()
+if not os.path.exists('book') \
+ or not os.path.exists('Makefile'):
+ die('Please run this from the Subversion book source directory... | |
21080583ce8f5b1ec7d3f45c21f4781f539fa2dd | gtkmvco/examples/observable/value.py | gtkmvco/examples/observable/value.py | # Author: Roberto Cavada <cavada@fbk.eu>
#
# Copyright (c) 2006 by Roberto Cavada
#
# pygtkmvc 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 of the License, or (at your option... | TEST New test/example for the new feature supporting custom getter/setter for properties | TEST
New test/example for the new feature supporting custom getter/setter for
properties
[RC]
| Python | lgpl-2.1 | roboogle/gtkmvc3,roboogle/gtkmvc3 | ---
+++
@@ -0,0 +1,82 @@
+# Author: Roberto Cavada <cavada@fbk.eu>
+#
+# Copyright (c) 2006 by Roberto Cavada
+#
+# pygtkmvc 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... | |
6d54528c74a5e0074bbddaabb7db803b655d06c3 | array/merge-sort.py | array/merge-sort.py | # python implementation of merge sort
def merge_sort(arr):
if len(arr) > 1:
middle = len(arr)/2
left = arr[:middle]
right = arr[middle:]
merge_sort(left)
merge_sort(right)
i = 0
j = 0
k = 0
while i < len(left) and j < len(right):
if left[i] < right[j]:
arr[k] = left[i]
i = i + 1
els... | Add python implementation for merge sort method | Add python implementation for merge sort method
| Python | mit | derekmpham/interview-prep,derekmpham/interview-prep | ---
+++
@@ -0,0 +1,38 @@
+# python implementation of merge sort
+
+def merge_sort(arr):
+ if len(arr) > 1:
+ middle = len(arr)/2
+ left = arr[:middle]
+ right = arr[middle:]
+
+ merge_sort(left)
+ merge_sort(right)
+
+ i = 0
+ j = 0
+ k = 0
+
+ while i < len(left) and j < len(right):
+ if left[i] < right[j... | |
896286d2e031c621c0a93e30dac152b606453c4c | celery/run_carrizo.py | celery/run_carrizo.py | import dem
import tasks
from celery import *
carrizo = dem.DEMGrid('tests/data/carrizo.tif')
d = 100
max_age = 10**3.5
age_step = 1
num_ages = max_age/age_step
num_angles = 180
ages = np.linspace(0, max_age, num=num_ages)
angles = np.linspace(-np.pi/2, np.pi/2, num=num_angles)
template_fits = [tasks.match_template.s... | Add test script using Carrizo data | Add test script using Carrizo data
| Python | mit | rmsare/scarplet,stgl/scarplet | ---
+++
@@ -0,0 +1,20 @@
+import dem
+import tasks
+from celery import *
+
+carrizo = dem.DEMGrid('tests/data/carrizo.tif')
+
+d = 100
+max_age = 10**3.5
+age_step = 1
+num_ages = max_age/age_step
+num_angles = 180
+ages = np.linspace(0, max_age, num=num_ages)
+angles = np.linspace(-np.pi/2, np.pi/2, num=num_angles)
... | |
108b7f7943a8338758ae55063d9eb21440c6297e | tests/utils_test.py | tests/utils_test.py | from utils import reverse_complement, gc_content, distance
def test_reverse_complement():
assert reverse_complement('ATCG') == 'CGAT'
assert reverse_complement('AAAA') == 'TTTT'
assert reverse_complement('GACT') == 'AGTC'
def test_gc_content():
assert gc_content('ACGT') == 0.5
assert gc_content(... | Add tests for utility methods | Add tests for utility methods
| Python | mit | MichaelAquilina/rosalind-solutions | ---
+++
@@ -0,0 +1,23 @@
+from utils import reverse_complement, gc_content, distance
+
+
+def test_reverse_complement():
+ assert reverse_complement('ATCG') == 'CGAT'
+ assert reverse_complement('AAAA') == 'TTTT'
+ assert reverse_complement('GACT') == 'AGTC'
+
+
+def test_gc_content():
+ assert gc_content... | |
5737213ab2bc2ed041c71dd4e6d698ff00820038 | source/harmony/schema/processor.py | source/harmony/schema/processor.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
from abc import ABCMeta, abstractmethod
class Processor(object):
'''Process schemas.'''
__metaclass__ = ABCMeta
@abstractmethod
def process(self, schemas):
'''Process *schemas*
:p... | Add Processor interface for post processing of schemas. | Add Processor interface for post processing of schemas.
| Python | apache-2.0 | 4degrees/harmony | ---
+++
@@ -0,0 +1,22 @@
+# :coding: utf-8
+# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
+# :license: See LICENSE.txt.
+
+from abc import ABCMeta, abstractmethod
+
+
+class Processor(object):
+ '''Process schemas.'''
+
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def process(self, schemas)... | |
4e3e14e5d916c229876fb2faae03082ed65d0918 | test/test_sparql_base_ref.py | test/test_sparql_base_ref.py | from rdflib import ConjunctiveGraph, Literal
from StringIO import StringIO
import unittest
test_data = """
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://example.org/alice> a foaf:Person;
foaf:name "Alice";
foaf:knows <http://exa... | Test for use of BASE <..> | Test for use of BASE <..>
| Python | bsd-3-clause | Letractively/rdflib,Letractively/rdflib,Letractively/rdflib | ---
+++
@@ -0,0 +1,32 @@
+from rdflib import ConjunctiveGraph, Literal
+from StringIO import StringIO
+import unittest
+
+
+test_data = """
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+<http://example.org/alice> a foaf:Person;
+ foaf:na... | |
45cd0fa6cfaff7d82cedde85a90a20f64bb13a30 | PRESUBMIT.py | PRESUBMIT.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
_EXCLUDED_PATHS = (
)
def _CommonChecks(input_api, output_api):
results = []
results.extend(input_api.canned_checks.PanProjectChecks(
input_api... | Add a basic presubmit script. | Add a basic presubmit script. | Python | bsd-3-clause | sahiljain/catapult,scottmcmaster/catapult,zeptonaut/catapult,SummerLW/Perf-Insight-Report,scottmcmaster/catapult,danbeam/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult-csm,benschmaus/catapult,scottmcmaster/catapult,SummerLW/Perf-Insight-Report,benschmaus/catapult,modulexcite/catapult,catapult-project/c... | ---
+++
@@ -0,0 +1,21 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+_EXCLUDED_PATHS = (
+)
+
+def _CommonChecks(input_api, output_api):
+ results = []
+ results.extend(input_api.canned_chec... | |
e9720a993332f4d08a76f49828ad87378c58abd2 | tests/unit/cli/test_utils.py | tests/unit/cli/test_utils.py | from awscfncli2.cli.utils.colormaps import STACK_STATUS_TO_COLOR
def test_stack_status_to_color():
assert STACK_STATUS_TO_COLOR['UPDATE_COMPLETE'] == {'fg': 'green'}
assert STACK_STATUS_TO_COLOR['CREATE_FAILED'] == {'fg': 'red'}
assert STACK_STATUS_TO_COLOR['IMPORT_IN_PROGRESS'] == {'fg': 'yellow'}
# ... | Add a test case for colormap behavior change. | Add a test case for colormap behavior change.
| Python | mit | Kotaimen/awscfncli,Kotaimen/awscfncli | ---
+++
@@ -0,0 +1,9 @@
+from awscfncli2.cli.utils.colormaps import STACK_STATUS_TO_COLOR
+
+
+def test_stack_status_to_color():
+ assert STACK_STATUS_TO_COLOR['UPDATE_COMPLETE'] == {'fg': 'green'}
+ assert STACK_STATUS_TO_COLOR['CREATE_FAILED'] == {'fg': 'red'}
+ assert STACK_STATUS_TO_COLOR['IMPORT_IN_PROG... | |
d4be0acb6a33989cdb487ac98efe79af60bb87fb | tests/conftest.py | tests/conftest.py | import pytest
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true",
help="run slow tests")
def pytest_runtest_setup(item):
if 'slow' in item.keywords and not item.config.getoption("--runslow"):
pytest.skip("need --runslow option to run")
| Add pytest config file for slow tests. | Add pytest config file for slow tests.
Added a pytest config file in the tests folder, so that I could define a
--runslow option to some tests. This way, I don't have to run them all
the time if not necessary.
| Python | bsd-3-clause | achabotl/pambox | ---
+++
@@ -0,0 +1,10 @@
+import pytest
+
+
+def pytest_addoption(parser):
+ parser.addoption("--runslow", action="store_true",
+ help="run slow tests")
+
+def pytest_runtest_setup(item):
+ if 'slow' in item.keywords and not item.config.getoption("--runslow"):
+ pytest.skip("need --runslow option ... | |
e3cad9bfa134900218bb8502698f8bcf147ff474 | tools/DICOM_constant_filter.py | tools/DICOM_constant_filter.py | # DICOM_constant_filter.py
# Strip out a list of all constant names from the list of source files in the location provided
# and output C source of an array of {char*,int}
from __future__ import print_function
import re
import os
InstallDir = os.path.join("C:\\", "lib")
DICOMBase = os.path.join(InstallDir, "D... | Add a python script to filter out all DICOM constants. | Add a python script to filter out all DICOM constants.
| Python | mit | jimbo00000/Rift-Volume,jimbo00000/Rift-Volume | ---
+++
@@ -0,0 +1,22 @@
+# DICOM_constant_filter.py
+# Strip out a list of all constant names from the list of source files in the location provided
+# and output C source of an array of {char*,int}
+from __future__ import print_function
+import re
+import os
+
+InstallDir = os.path.join("C:\\", "lib")
+DICOMBase =... | |
80c1af071c0942060a00de40f14c5ab5fec36e0d | problem35.py | problem35.py | #!/usr/bin/env python
"""
A solution for problem 35 from Project Euler.
https://projecteuler.net/problem=35
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and
719, are themselves prime.
There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 3... | Add a solution for problem 35. | Add a solution for problem 35.
| Python | mit | smillet15/project-euler | ---
+++
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+"""
+ A solution for problem 35 from Project Euler.
+ https://projecteuler.net/problem=35
+
+ The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and
+ 719, are themselves prime.
+
+ There are thirteen such primes... | |
f2fa55c8d2f94bd186fc6c47b8ce00fb87c22aaf | tensorflow/contrib/autograph/converters/__init__.py | tensorflow/contrib/autograph/converters/__init__.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Add a few naming guidelines for the converter library. | Add a few naming guidelines for the converter library.
PiperOrigin-RevId: 204199604
| Python | apache-2.0 | alsrgv/tensorflow,annarev/tensorflow,sarvex/tensorflow,ppwwyyxx/tensorflow,chemelnucfin/tensorflow,jalexvig/tensorflow,ageron/tensorflow,gunan/tensorflow,gautam1858/tensorflow,seanli9jan/tensorflow,girving/tensorflow,jart/tensorflow,tensorflow/tensorflow-pywrap_saved_model,sarvex/tensorflow,xzturn/tensorflow,aldian/ten... | ---
+++
@@ -18,5 +18,15 @@
from __future__ import division
from __future__ import print_function
-# TODO(mdan): Define a base transformer class that can recognize skip_processing
-# TODO(mdan): All converters are incomplete, especially those that change blocks
+# Naming conventions:
+# * each converter should sp... |
e2b3934dfa9793759802afb2204d5068f21fc2d1 | websockets/test_handshake.py | websockets/test_handshake.py | import unittest
from .handshake import *
from .handshake import accept # private API
class HandshakeTests(unittest.TestCase):
def test_accept(self):
# Test vector from RFC 6455
key = "dGhlIHNhbXBsZSBub25jZQ=="
acc = "s3pPLMBiTxaQ9kYGzzhZRbK+xOo="
self.assertEqual(accept(key... | Add tests for the handshake functions. | Add tests for the handshake functions.
| Python | bsd-3-clause | aaugustin/websockets,aaugustin/websockets,aaugustin/websockets,dommert/pywebsockets,aaugustin/websockets,andrewyoung1991/websockets,biddyweb/websockets | ---
+++
@@ -0,0 +1,36 @@
+import unittest
+
+from .handshake import *
+from .handshake import accept # private API
+
+
+class HandshakeTests(unittest.TestCase):
+
+ def test_accept(self):
+ # Test vector from RFC 6455
+ key = "dGhlIHNhbXBsZSBub25jZQ=="
+ acc = "s3pPLMBiTxaQ9kYGzzhZRbK+xO... | |
bae805afa67bbced9a968b12c38e1b22e05f8f61 | Findminn.py | Findminn.py | __author__ = "Claytonbat"
from random import randrange
import time
def findMin(alist):
overallmin = alist[0]
for i in alist:
issmallest = True
for j in alist :
if i > j:
issmallest = False
if issmallest:
overallmin = i
return overallmin
d... | Add FindMinn.py file, which contains O(n) and O(n**2) methods in finding the minimum number in a random list. | Add FindMinn.py file, which contains O(n) and O(n**2) methods in finding the minimum number in a random list.
Add author and email.
| Python | mit | mcsoo/Exercises | ---
+++
@@ -0,0 +1,31 @@
+__author__ = "Claytonbat"
+from random import randrange
+import time
+def findMin(alist):
+ overallmin = alist[0]
+ for i in alist:
+ issmallest = True
+ for j in alist :
+ if i > j:
+ issmallest = False
+ if issmallest:
+ ... | |
cd74d2af4d0d09f8ba2b6aefffde14cc233740b7 | samples/python/chlauth_set.py | samples/python/chlauth_set.py | '''
This sample will create a new local queue.
MQWeb runs on localhost and is listening on port 8081.
'''
import sys
import json
import httplib
import socket
import argparse
parser = argparse.ArgumentParser(
description='MQWeb - Python sample - Set Channel Authentication Record',
epilog="For more information: http... | Add sample for set chlauth | Add sample for set chlauth
| Python | mit | fbraem/mqweb,fbraem/mqweb,fbraem/mqweb | ---
+++
@@ -0,0 +1,57 @@
+'''
+ This sample will create a new local queue.
+ MQWeb runs on localhost and is listening on port 8081.
+'''
+import sys
+import json
+import httplib
+import socket
+import argparse
+
+parser = argparse.ArgumentParser(
+ description='MQWeb - Python sample - Set Channel Authentication Recor... | |
d56da91c5613b281ebd90a7391429ebac0d83159 | scripts/process_results.py | scripts/process_results.py |
import os
import pandas as pd
import sqlite3
import json
input_path=''
input_filenames = ["0101000000.sql", "1000000000.sql"]
def sql_query(input_path, input_filename, report_name, table_name, row_name, column_name):
sql_query = 'SELECT Value from TabularDataWithStrings WHERE ReportName=\'' + report_name + '\... | Add script to process EnergyPlus SQL and create json result files. | Add script to process EnergyPlus SQL and create json result files.
| Python | mit | design-generator/data,design-generator/data | ---
+++
@@ -0,0 +1,44 @@
+
+import os
+import pandas as pd
+import sqlite3
+import json
+
+
+input_path=''
+input_filenames = ["0101000000.sql", "1000000000.sql"]
+
+
+
+def sql_query(input_path, input_filename, report_name, table_name, row_name, column_name):
+ sql_query = 'SELECT Value from TabularDataWithString... | |
f83cc3e33bf8fe3e80502e39768483db2f78a63f | addons/sale/__terp__.py | addons/sale/__terp__.py | {
"name" : "Sales Management",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_sale.html",
"depends" : ["product", "stock", "mrp"],
"category" : "Generic Modules/Sales & Purchases",
"init_xml" : [],
"demo_xml" : ["sale_demo.xml", "sale_unit_test.xml"],
"description": """
The base ... | {
"name" : "Sales Management",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_sale.html",
"depends" : ["product", "stock", "mrp"],
"category" : "Generic Modules/Sales & Purchases",
"init_xml" : [],
"demo_xml" : ["sale_demo.xml", "sale_unit_test.xml"],
"description": """
The base ... | Add sale_security.xml file entry in update_xml section | Add sale_security.xml file entry in update_xml section
bzr revid: mga@tinyerp.com-b44d9932402c4941921f83487b823e7359d324c0 | Python | agpl-3.0 | naousse/odoo,slevenhagen/odoo,rahuldhote/odoo,Drooids/odoo,gorjuce/odoo,jiachenning/odoo,cpyou/odoo,glovebx/odoo,acshan/odoo,joshuajan/odoo,Maspear/odoo,gsmartway/odoo,OpusVL/odoo,apanju/odoo,kifcaliph/odoo,Codefans-fan/odoo,luiseduardohdbackup/odoo,hbrunn/OpenUpgrade,grap/OCB,abenzbiria/clients_odoo,BT-rmartin/odoo,lu... | ---
+++
@@ -30,7 +30,8 @@
"sale_view.xml",
"sale_report.xml",
"sale_wizard.xml",
- "stock_view.xml"
+ "stock_view.xml",
+ "sale_security.xml"
],
"active": False,
"installable": True |
3ae053008cc8ab7b8bac2a392cd95a12fc38974e | examples/io.py | examples/io.py |
import fiona
# This module contains examples of opening files to get feature collections in
# different ways.
#
# It is meant to be run from the distribution root, the directory containing
# setup.py.
#
# A ``path`` is always the ``open()`` function's first argument. It can be
# absolute or relative to the working di... | Add module of IO examples. | Add module of IO examples.
Getting this into the manual is the next step.
| Python | bsd-3-clause | perrygeo/Fiona,Toblerity/Fiona,Toblerity/Fiona,rbuffat/Fiona,perrygeo/Fiona,rbuffat/Fiona,johanvdw/Fiona | ---
+++
@@ -0,0 +1,73 @@
+
+import fiona
+
+# This module contains examples of opening files to get feature collections in
+# different ways.
+#
+# It is meant to be run from the distribution root, the directory containing
+# setup.py.
+#
+# A ``path`` is always the ``open()`` function's first argument. It can be
+# ... | |
92a9cf771a60d377ee2f7dce5f50bf5be9033b19 | src/qinfer/test_tomography_qubit.py | src/qinfer/test_tomography_qubit.py | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 29 18:53:24 2012
@author: csferrie
"""
## FEATURES ####################################################################
from __future__ import division
## IMPORTS #####################################################################
import getpass
impo... | Add testing code for tomography module | Add testing code for tomography module
| Python | agpl-3.0 | Alan-Robertson/python-qinfer,csferrie/python-qinfer,QInfer/python-qinfer,whitewhim2718/python-qinfer,MichalKononenko/python-qinfer,ihincks/python-qinfer | ---
+++
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Wed Aug 29 18:53:24 2012
+
+@author: csferrie
+"""
+
+## FEATURES ####################################################################
+
+from __future__ import division
+
+## IMPORTS ###################################################################... | |
69277650b4f1f118a76a7be74f14a71a74849d0c | CodeFights/buildPalindrome.py | CodeFights/buildPalindrome.py | #!/usr/local/bin/python
# Code Fights Build Palindrome Problem
def buildPalindrome(st):
if st == st[::-1]:
return st
for i in range(len(st)):
s = st + st[i::-1]
if s == s[::-1]:
return s
def main():
tests = [
["abcdc", "abcdcba"],
["ababab", "abababa"]... | Solve Code Fights build palindrome problem | Solve Code Fights build palindrome problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/local/bin/python
+# Code Fights Build Palindrome Problem
+
+
+def buildPalindrome(st):
+ if st == st[::-1]:
+ return st
+ for i in range(len(st)):
+ s = st + st[i::-1]
+ if s == s[::-1]:
+ return s
+
+
+def main():
+ tests = [
+ ["abcdc"... | |
4e9ec5bd0219d4fdda55113f16471bab5d7e41d7 | string/bm.py | string/bm.py | # -*- coding:utf-8 -*-
def build_bad_char_map(pattern_s, sz=256):
bcmap = [-1] * sz
for i,s in enumerate(pattern_s):
bcmap[ord(s)] = i
return bcmap
def build_good_suffix_prefix_map(pattern_s):
m = len(pattern_s)
prefix, suffix = [False] * m, [-1] * m
for i in range(m - 1):
j =... | Add BM string search algorithm implementation | Add BM string search algorithm implementation
| Python | apache-2.0 | free-free/algorithm,free-free/algorithm | ---
+++
@@ -0,0 +1,61 @@
+# -*- coding:utf-8 -*-
+
+
+def build_bad_char_map(pattern_s, sz=256):
+ bcmap = [-1] * sz
+ for i,s in enumerate(pattern_s):
+ bcmap[ord(s)] = i
+ return bcmap
+
+def build_good_suffix_prefix_map(pattern_s):
+ m = len(pattern_s)
+ prefix, suffix = [False] * m, [-1] * m... | |
cc8e9b9576cf08d7a91508e8f629104f5fef0c54 | lib/repo/git_hooks/update.d/02-block_change_top_level_folders.py | lib/repo/git_hooks/update.d/02-block_change_top_level_folders.py | #!/usr/bin/env python3
import subprocess
import sys
if __name__ == '__main__':
ref_name = sys.argv[1]
old_commit = sys.argv[2]
new_commit = sys.argv[3]
old_ls = subprocess.run(['git', 'ls-tree', '--name-only', old_commit], stdout=subprocess.PIPE,
universal_newlines=True)
... | Add hook to prevent student changes to top level files/dirs | git: Add hook to prevent student changes to top level files/dirs
| Python | mit | MarkUsProject/Markus,benjaminvialle/Markus,benjaminvialle/Markus,benjaminvialle/Markus,MarkUsProject/Markus,MarkUsProject/Markus,MarkUsProject/Markus,benjaminvialle/Markus,MarkUsProject/Markus,benjaminvialle/Markus,benjaminvialle/Markus,MarkUsProject/Markus,benjaminvialle/Markus,MarkUsProject/Markus,MarkUsProject/Marku... | ---
+++
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+
+import subprocess
+import sys
+
+if __name__ == '__main__':
+
+ ref_name = sys.argv[1]
+ old_commit = sys.argv[2]
+ new_commit = sys.argv[3]
+ old_ls = subprocess.run(['git', 'ls-tree', '--name-only', old_commit], stdout=subprocess.PIPE,
+ ... | |
1785b211a017b25b2b180a042b58a15ae0ff7d7a | neutron/tests/unit/conf/policies/test_network_ip_availability.py | neutron/tests/unit/conf/policies/test_network_ip_availability.py | # Copyright (c) 2021 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | Add tests for Network IP availability API's new policy rules | Add tests for Network IP availability API's new policy rules
Related-blueprint: bp/secure-rbac-roles
Change-Id: I21a016a6aa58dc78fc67af093933caaf94991fbd
| Python | apache-2.0 | openstack/neutron,openstack/neutron,mahak/neutron,mahak/neutron,openstack/neutron,mahak/neutron | ---
+++
@@ -0,0 +1,79 @@
+# Copyright (c) 2021 Red Hat Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by ... | |
914cb7d5eac4598474c3473568ec9705f5485dae | split-training.py | split-training.py | import os
import random
import shutil
train_split_percent, validation_split_percent, test_split_percentage = 70, 20, 10
dataset_dir = '/Users/tom/projects-workspace/set-game/data/train-v2/labelled'
target_dir = '/Users/tom/tmp/set'
dirs = []
for (dirpath, dirnames, filenames) in os.walk(dataset_dir):
dirs.extend(... | Add script to split data into train/validation/test datasets | Add script to split data into train/validation/test datasets
| Python | apache-2.0 | tomwhite/set-game,tomwhite/set-game,tomwhite/set-game | ---
+++
@@ -0,0 +1,42 @@
+import os
+import random
+import shutil
+
+train_split_percent, validation_split_percent, test_split_percentage = 70, 20, 10
+
+dataset_dir = '/Users/tom/projects-workspace/set-game/data/train-v2/labelled'
+target_dir = '/Users/tom/tmp/set'
+dirs = []
+for (dirpath, dirnames, filenames) in o... | |
152f9a2410bc3714ca8c9395295ff67f30ebd548 | test_SR1d.py | test_SR1d.py | import eos_defns
import SR1d
from numpy.testing import assert_allclose
def test_standard_sod():
"""
Relativistic Sod test.
Numbers are taken from the General Matlab code, so accuracy isn't perfect.
"""
eos = eos_defns.eos_gamma_law(5.0/3.0)
w_left = SR1d.State(1.0, 0.0, 1.5, eos, label="L"... | Add the start of a test of the RP class. | Add the start of a test of the RP class.
| Python | mit | harpolea/r3d2 | ---
+++
@@ -0,0 +1,20 @@
+import eos_defns
+import SR1d
+from numpy.testing import assert_allclose
+
+def test_standard_sod():
+ """
+ Relativistic Sod test.
+
+ Numbers are taken from the General Matlab code, so accuracy isn't perfect.
+ """
+ eos = eos_defns.eos_gamma_law(5.0/3.0)
+ w_left = S... | |
5244c06403aa82c920b742cf22e60adc34c72295 | Scripts/get-my-ip.py | Scripts/get-my-ip.py | #!/usr/bin/env python
"""Get your public IP address from a UDP socket connection
"""
import socket as _socket
def get_my_ip(host, port=80):
s = _socket.socket(_socket.AF_INET, _socket.SOCK_DGRAM)
try:
s.connect((host, port))
return s.getsockname()[0]
finally:
s.close()
if __nam... | Add small script to get public ip | Add small script to get public ip
| Python | bsd-3-clause | eddiejessup/ciabatta | ---
+++
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+"""Get your public IP address from a UDP socket connection
+"""
+
+import socket as _socket
+
+
+def get_my_ip(host, port=80):
+ s = _socket.socket(_socket.AF_INET, _socket.SOCK_DGRAM)
+ try:
+ s.connect((host, port))
+ return s.getsockname()[0]
+... | |
b8572aa26114bd9792b83dfb9187e466537303fa | stickord/commands/games.py | stickord/commands/games.py | import discord
from stickord.registry import Command
@Command(['tellen', 'tel'])
async def counting(cont, mesg, client, *args, **kwargs):
count, auth, when = (0, discord.User, None)
if cont:
try:
num = int(cont[0])
if num != count + 1:
return f'Whoops, you done g... | Add framework for counting command | Add framework for counting command
| Python | mit | RobinSikkens/Sticky-discord | ---
+++
@@ -0,0 +1,21 @@
+import discord
+from stickord.registry import Command
+
+@Command(['tellen', 'tel'])
+async def counting(cont, mesg, client, *args, **kwargs):
+ count, auth, when = (0, discord.User, None)
+ if cont:
+ try:
+ num = int(cont[0])
+ if num != count + 1:
+ ... | |
d18b86de344ea720451feece2ebbaee8b0eb3d1e | scripts/download_archive.py | scripts/download_archive.py | """A script to download slack archives."""
from os.path import abspath, dirname, join
from splinter import Browser
from splinter.exceptions import ElementDoesNotExist
import yaml
HERE = dirname(abspath(__file__))
CONFIG_PATH = join(HERE, '..', 'parktain', 'config.yaml')
with open(CONFIG_PATH, 'r') as ymlfile:
sl... | Add script to download slack archives | Add script to download slack archives
| Python | bsd-3-clause | punchagan/parktain,punchagan/parktain,punchagan/parktain | ---
+++
@@ -0,0 +1,42 @@
+"""A script to download slack archives."""
+
+from os.path import abspath, dirname, join
+
+from splinter import Browser
+from splinter.exceptions import ElementDoesNotExist
+import yaml
+
+HERE = dirname(abspath(__file__))
+CONFIG_PATH = join(HERE, '..', 'parktain', 'config.yaml')
+with ope... | |
3545caa05b5ef9a123b438884c2a32989fa47319 | plugins/BidirectionalSynapseCleanup.py | plugins/BidirectionalSynapseCleanup.py | from tulip import *
import tulipplugins
import tulippaths as tp
from FileOutputPlugin import FileOutputPlugin
class BidirectionalSynapseCleanup(FileOutputPlugin):
def __init__(self, context):
FileOutputPlugin.__init__(self, context)
self._edgeTypeLabel = "Edge type"
self.addStringParamete... | Add plugin for finding bidirecitonal sypanses missing edges. | Add plugin for finding bidirecitonal sypanses missing edges.
| Python | mit | visdesignlab/TulipPaths,visdesignlab/TulipPaths | ---
+++
@@ -0,0 +1,61 @@
+from tulip import *
+import tulipplugins
+import tulippaths as tp
+from FileOutputPlugin import FileOutputPlugin
+
+
+class BidirectionalSynapseCleanup(FileOutputPlugin):
+ def __init__(self, context):
+ FileOutputPlugin.__init__(self, context)
+ self._edgeTypeLabel = "Edge ... | |
aa2983686245f79e39aff81f88834375ca2a1b7b | client/test_feedback_proxy.py | client/test_feedback_proxy.py | #!/usr/bin/env python
#import httplib
import json
import os
import sys
import time
import urllib2
import ipaddr
nb_ip = 250
#nb_ip = 20
nb_test = 500
server = "iconnect2.iro.umontreal.ca"
port = 80
print sys.argv
if len(sys.argv) > 1:
server = sys.argv[1]
if len(sys.argv) > 2:
port = int(sys.argv[2])
print s... | Add a script to speed test the feedback. | Add a script to speed test the feedback.
| Python | bsd-3-clause | lisa-lab/pings,lisa-lab/pings,lisa-lab/pings,lisa-lab/pings | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#import httplib
+import json
+import os
+import sys
+import time
+import urllib2
+
+import ipaddr
+
+nb_ip = 250
+#nb_ip = 20
+nb_test = 500
+server = "iconnect2.iro.umontreal.ca"
+port = 80
+
+print sys.argv
+if len(sys.argv) > 1:
+ server = sys.argv[1]
+if len(sys... | |
c389c560cda1d4a3bc9a13dafb006e89d4cafa8f | timelaps.py | timelaps.py | import time
import picamera
VIDEO_DAYS = 1
FRAMES_PER_HOUR = 60
FRAMES = FRAMES_PER_HOUR * 24 * VIDEO_DAYS
def capture_frame(frame):
with picamera.PiCamera() as cam:
time.sleep(2)
cam.capture('/home/pi/Desktop/frame%03d.jpg' % frame)
# Capture the images
for frame in range(FRAMES)... | Add Time Laps python file | Add Time Laps python file
Add Time Laps python file, exciting. Reference:
http://www.makeuseof.com/tag/raspberry-pi-camera-module/
| Python | mit | RoelofZA/WeatherStation | ---
+++
@@ -0,0 +1,45 @@
+import time
+
+import picamera
+
+
+
+VIDEO_DAYS = 1
+
+FRAMES_PER_HOUR = 60
+
+FRAMES = FRAMES_PER_HOUR * 24 * VIDEO_DAYS
+
+
+
+def capture_frame(frame):
+
+ with picamera.PiCamera() as cam:
+
+ time.sleep(2)
+
+ cam.capture('/home/pi/Desktop/frame%03d.jpg' % frame)
+
+ ... | |
2dc2b301edd7fa6451399a726f8ba7328865a4c5 | django/website/contacts/migrations/0006_auto_20160713_1115.py | django/website/contacts/migrations/0006_auto_20160713_1115.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contacts', '0005_auto_20160621_1456'),
]
operations = [
migrations.RemoveField(
model_name='user',
n... | Add migration to remove fields from contacts | Add migration to remove fields from contacts | Python | agpl-3.0 | aptivate/alfie,aptivate/kashana,aptivate/alfie,aptivate/kashana,aptivate/kashana,aptivate/alfie,aptivate/alfie,daniell/kashana,daniell/kashana,aptivate/kashana,daniell/kashana,daniell/kashana | ---
+++
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('contacts', '0005_auto_20160621_1456'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ ... | |
0bef2f3c6307ccdc8222e68d224d7c9aac215237 | code/run_predictions.py | code/run_predictions.py | import synthetic_data_experiments as sde
import logging
if __name__ == "__main__":
args = sde.get_integrous_arguments_values()
for repeat_idx in xrange(args.num_repeats) :
resu_dir = "%s/repeat_%d" % (args.resu_dir, repeat_idx)
data_dir = '%s/repeat_%d' % (args.data_dir, repeat_... | Create script runing predictions for each rep and each fold | Create script runing predictions for each rep and each fold
| Python | mit | chagaz/sfan,chagaz/sfan,chagaz/sfan,chagaz/sfan,chagaz/sfan | ---
+++
@@ -0,0 +1,28 @@
+import synthetic_data_experiments as sde
+
+import logging
+
+if __name__ == "__main__":
+ args = sde.get_integrous_arguments_values()
+
+ for repeat_idx in xrange(args.num_repeats) :
+
+ resu_dir = "%s/repeat_%d" % (args.resu_dir, repeat_idx)
+ data_dir = '%... | |
56da9b10abcc94a341488e5032e5617d0def9d56 | mongo_stats.py | mongo_stats.py | #!/usr/bin/env python
# Dump stats for raw and queue.
import os
import time
import pymongo
import json
conn = pymongo.Connection()
# db -> collections
dbs = {
'raw' : ['commits', 'repos', 'users'],
'queue' : ['commits', 'repos', 'users']
}
for db, collections in dbs.iteritems():
for collection in ... | Add small script to print out db stats | Add small script to print out db stats
| Python | mit | emarschner/gothub,emarschner/gothub,emarschner/gothub,emarschner/gothub | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# Dump stats for raw and queue.
+
+import os
+import time
+import pymongo
+import json
+
+conn = pymongo.Connection()
+
+# db -> collections
+dbs = {
+ 'raw' : ['commits', 'repos', 'users'],
+ 'queue' : ['commits', 'repos', 'users']
+}
+
+for db, collection... | |
32912c8c5c02d1922f56bac4b8c97f4e53eccb81 | muffin_peewee/debugtoolbar.py | muffin_peewee/debugtoolbar.py | import logging
import jinja2
import datetime as dt
from muffin_debugtoolbar.panels import DebugPanel
from muffin_debugtoolbar.utils import LoggingTrackingHandler
LOGGER = logging.getLogger('peewee')
class PeeweeDebugPanel(DebugPanel):
name = 'Peewee queries'
template = jinja2.Template("""
<table c... | Add debugpanel for Muffin Debugtoolbar | Add debugpanel for Muffin Debugtoolbar
| Python | mit | klen/muffin-peewee | ---
+++
@@ -0,0 +1,60 @@
+import logging
+import jinja2
+import datetime as dt
+
+from muffin_debugtoolbar.panels import DebugPanel
+from muffin_debugtoolbar.utils import LoggingTrackingHandler
+
+
+LOGGER = logging.getLogger('peewee')
+
+
+class PeeweeDebugPanel(DebugPanel):
+
+ name = 'Peewee queries'
+ templ... | |
9232d69874ae5d1b2b7ae86476aa690a1bb89029 | distarray/core/tests/test_distributed_array_protocol.py | distarray/core/tests/test_distributed_array_protocol.py | import unittest
import distarray as da
from distarray.mpi.mpibase import create_comm_of_size, InvalidCommSizeError
class TestDistributedArrayProtocol(unittest.TestCase):
def setUp(self):
try:
comm = create_comm_of_size(4)
except InvalidCommSizeError:
raise unittest.SkipTes... | Add stub test file for Distributed Array Protocol. | Add stub test file for Distributed Array Protocol. | Python | bsd-3-clause | enthought/distarray,RaoUmer/distarray,enthought/distarray,RaoUmer/distarray | ---
+++
@@ -0,0 +1,26 @@
+import unittest
+import distarray as da
+from distarray.mpi.mpibase import create_comm_of_size, InvalidCommSizeError
+
+
+class TestDistributedArrayProtocol(unittest.TestCase):
+
+ def setUp(self):
+ try:
+ comm = create_comm_of_size(4)
+ except InvalidCommSizeErr... | |
577d13a232b426960dae0b28c63ecac7c33b2643 | nose2/tests/functional/test_main.py | nose2/tests/functional/test_main.py | from nose2.tests._common import FunctionalTestCase
class TestPluggableTestProgram(FunctionalTestCase):
def test_run_in_empty_dir_succeeds(self):
proc = self.runIn('scenario/no_tests')
stdout, stderr = proc.communicate()
self.assertEqual(proc.poll(), 0, stderr)
| from nose2.tests._common import FunctionalTestCase
class TestPluggableTestProgram(FunctionalTestCase):
def test_run_in_empty_dir_succeeds(self):
proc = self.runIn('scenario/no_tests')
stdout, stderr = proc.communicate()
self.assertEqual(proc.poll(), 0, stderr)
def test_extra_hooks(sel... | Add test for hooks kwarg to PluggableTestProgram | Add test for hooks kwarg to PluggableTestProgram
| Python | bsd-2-clause | ojengwa/nose2,ezigman/nose2,leth/nose2,little-dude/nose2,ptthiem/nose2,leth/nose2,ezigman/nose2,ojengwa/nose2,ptthiem/nose2,little-dude/nose2 | ---
+++
@@ -6,3 +6,15 @@
proc = self.runIn('scenario/no_tests')
stdout, stderr = proc.communicate()
self.assertEqual(proc.poll(), 0, stderr)
+
+ def test_extra_hooks(self):
+ class Check(object):
+ ran = False
+ def startTestRun(self, event):
+ ... |
d3c95eb39a7fbaa2028b00176e71b192bf6d6e1b | app/soc/modules/gci/models/static_content.py | app/soc/modules/gci/models/static_content.py | # Copyright 2013 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 applicable law or agreed to in wr... | Implement a model to store references to program's static content. | Implement a model to store references to program's static content.
| Python | apache-2.0 | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | ---
+++
@@ -0,0 +1,50 @@
+# Copyright 2013 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 ... | |
9cb23fe24ddf244b3e2569ce1760202995ab035d | tohu/v3/derived_generators.py | tohu/v3/derived_generators.py | from .base import TohuBaseGenerator
class Apply(TohuBaseGenerator):
def __init__(self, func, *arg_gens, **kwarg_gens):
self.func = func
self.orig_arg_gens = arg_gens
self.orig_kwarg_gens = kwarg_gens
self.arg_gens = [g.clone() for g in arg_gens]
self.kwarg_gens = {name: g... | Add derived generator Apply which allows to apply a function to a set of input generators | Add derived generator Apply which allows to apply a function to a set of input generators
| Python | mit | maxalbert/tohu | ---
+++
@@ -0,0 +1,17 @@
+from .base import TohuBaseGenerator
+
+
+class Apply(TohuBaseGenerator):
+
+ def __init__(self, func, *arg_gens, **kwarg_gens):
+ self.func = func
+ self.orig_arg_gens = arg_gens
+ self.orig_kwarg_gens = kwarg_gens
+
+ self.arg_gens = [g.clone() for g in arg_ge... | |
60c70bf439d35238c0331b665ece60cf9718cf0f | src/swap-cname.py | src/swap-cname.py | #!/usr/bin/env python
import os
import sys
import httplib
import json
if len(sys.argv) != 3:
print """ERROR: wrong number of arguments.
Usage: tsuru swap-cname app1-name app2-name
Swap cname between two apps."""
sys.exit(1)
def get_cname(app):
headers = {"Authorization" : "bearer " + token}
conn = httplib.... | Allow came swap between two applications. | Allow came swap between two applications. | Python | mit | emerleite/tsuru-swap-cname | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import httplib
+import json
+
+if len(sys.argv) != 3:
+ print """ERROR: wrong number of arguments.
+
+Usage: tsuru swap-cname app1-name app2-name
+
+Swap cname between two apps."""
+ sys.exit(1)
+
+def get_cname(app):
+ headers = {"Authoriza... | |
fecd1e39592ea420039be37717f2b641249b5458 | examples/plot_2d.py | examples/plot_2d.py | """Visualizes batch ('population') optimizers as 2D plots."""
import numpy as np
from heuristic_optimization.optimizers import ParticleSwarmOptimizer
try:
import matplotlib.pyplot as plt
except ImportError:
print("This requires matplotlib (despite not being in the dependencies), but it was not found. Exiting.... | Add 2d plot example for batch iteration optimizers | Add 2d plot example for batch iteration optimizers
| Python | mit | tjanson/heuristic_optimization | ---
+++
@@ -0,0 +1,65 @@
+"""Visualizes batch ('population') optimizers as 2D plots."""
+
+import numpy as np
+from heuristic_optimization.optimizers import ParticleSwarmOptimizer
+
+try:
+ import matplotlib.pyplot as plt
+except ImportError:
+ print("This requires matplotlib (despite not being in the dependenc... | |
c10ace67fcb209955647426ac776fd1821fb6f86 | read_serial.py | read_serial.py | __author__ = 'miahi'
## Serial logger for APC Smart UPS
import serial
import csv
import time
import datetime
PORT = 'COM2'
BAUDRATE = 2400
SLEEP_SECONDS = 3
class APCSerial(object):
def __init__(self, port, baudrate=2400):
# todo: check that port exists & init errors
self.serial = serial.Serial... | Read from serial, write to CVS | Read from serial, write to CVS
| Python | mit | miahi/python.apcserial | ---
+++
@@ -0,0 +1,82 @@
+__author__ = 'miahi'
+
+## Serial logger for APC Smart UPS
+
+import serial
+import csv
+import time
+import datetime
+
+PORT = 'COM2'
+BAUDRATE = 2400
+SLEEP_SECONDS = 3
+
+
+class APCSerial(object):
+ def __init__(self, port, baudrate=2400):
+ # todo: check that port exists & ini... | |
dc136bb96455944436b56e39ce6929799036bfa8 | neuroanalysis/stimuli.py | neuroanalysis/stimuli.py | import numpy as np
def square_pulses(trace, baseline=None):
"""Return a list of (start, stop, amp) tuples describing square pulses
in the stimulus.
A pulse is defined as any contiguous region of the stimulus waveform
that has a constant value other than the baseline. If no baseline is
specifi... | Add module for analyzing stimulus waveforms | Add module for analyzing stimulus waveforms
| Python | mit | campagnola/neuroanalysis | ---
+++
@@ -0,0 +1,31 @@
+import numpy as np
+
+
+def square_pulses(trace, baseline=None):
+ """Return a list of (start, stop, amp) tuples describing square pulses
+ in the stimulus.
+
+ A pulse is defined as any contiguous region of the stimulus waveform
+ that has a constant value other than the bas... | |
adf46f5b90d04ce8e26701810b6c23bc230ddc37 | nova/conf/consoleauth.py | nova/conf/consoleauth.py | # Copyright (c) 2016 Intel, Inc.
# Copyright (c) 2013 OpenStack Foundation
# 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/li... | # Copyright (c) 2016 Intel, Inc.
# Copyright (c) 2013 OpenStack Foundation
# 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/li... | Add an additional description for 'token_ttl' | Add an additional description for 'token_ttl'
The unit of 'token_ttl' is not clear
in the help text in nova/conf/consoleauth.py.
So add the unit (in seconds) in the help text.
TrivialFix
Change-Id: Id6506b7462c303223bac8586e664e187cb52abd6
| Python | apache-2.0 | openstack/nova,klmitch/nova,klmitch/nova,mahak/nova,phenoxim/nova,gooddata/openstack-nova,mikalstill/nova,gooddata/openstack-nova,mahak/nova,rahulunair/nova,klmitch/nova,klmitch/nova,rahulunair/nova,mikalstill/nova,gooddata/openstack-nova,mikalstill/nova,rahulunair/nova,openstack/nova,phenoxim/nova,openstack/nova,mahak... | ---
+++
@@ -27,7 +27,7 @@
deprecated_name='console_token_ttl',
deprecated_group='DEFAULT',
help="""
-The lifetime of a console auth token.
+The lifetime of a console auth token (in seconds).
A console auth token is used in authorizing console access for a user.
Once the auth token time ... |
a4a25587edbfef824b131c22f8fb6c17ccce6abe | openfda-1/get_drug.py | openfda-1/get_drug.py | import http.client
import json
headers = {'User-Agent': 'http-client'}
conn = http.client.HTTPSConnection("api.fda.gov")
# Get a https://api.fda.gov/drug/label.json drug label from this URL and extract what is the id,
# the purpose of the drug and the manufacturer_name
conn.request("GET", "/drug/label.json", None... | Add openfda1 get drugs practice | Add openfda1 get drugs practice
| Python | apache-2.0 | acs-test/openfda,acs-test/openfda | ---
+++
@@ -0,0 +1,40 @@
+import http.client
+import json
+
+headers = {'User-Agent': 'http-client'}
+
+
+conn = http.client.HTTPSConnection("api.fda.gov")
+
+# Get a https://api.fda.gov/drug/label.json drug label from this URL and extract what is the id,
+# the purpose of the drug and the manufacturer_name
+
+conn.... | |
64806d4b3a0fb277ffe07e9d9670c4e80563f56b | text_to_speech.py | text_to_speech.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Asks for coffee using different Python modules.
Requires macspeechX module:
* https://pypi.python.org/pypi/macspeechX/
* http://old.nabble.com/Re:-py-access-to-speech-synth--p18845607.html
"""
from macspeechX import SpeakString
import pyttsx
# Using macspeechX
# Note:... | Add text to speech example. | Add text to speech example.
| Python | bsd-3-clause | audreyr/useful | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""Asks for coffee using different Python modules.
+
+Requires macspeechX module:
+* https://pypi.python.org/pypi/macspeechX/
+* http://old.nabble.com/Re:-py-access-to-speech-synth--p18845607.html
+"""
+
+from macspeechX import SpeakString
+imp... | |
118fc8570b15700a62e5cb5aa7c3d1bfe70c9dc6 | Python/concurrency/furutes_prot.py | Python/concurrency/furutes_prot.py | # concurrent.futures - Launch parallel tasks
import concurrent.futures as ft
def main():
with ft.ThreadPoolExecutor(max_workers=1) as executor:
future = executor.submit(fnc, 323, 4)
print(future.result())
#future = executor.map(fnc, (33, 22))
#print(future.result())
def fnc(x, y):... | Add concurrent.future ti Python prototypes | Add concurrent.future ti Python prototypes
| Python | apache-2.0 | yuriyshapovalov/Prototypes,yuriyshapovalov/Prototypes,yuriyshapovalov/Prototypes | ---
+++
@@ -0,0 +1,16 @@
+# concurrent.futures - Launch parallel tasks
+import concurrent.futures as ft
+
+def main():
+ with ft.ThreadPoolExecutor(max_workers=1) as executor:
+ future = executor.submit(fnc, 323, 4)
+ print(future.result())
+
+ #future = executor.map(fnc, (33, 22))
+ #p... | |
18e14ba67c245f2a9ec24b05d5c504452a1f299d | robo/test/test_json_dump.py | robo/test/test_json_dump.py | '''
Created on: June 5th, 2016
@author: Numair Mansur (numair.mansur@gmail.com)
'''
import unittest
class TestJsonMethods(unittest.TestCase):
def test_json_base_solver(self):
assert True
def test_json_base_model(self):
assert True
def test_json_base_task(self):
assert True
... | Create Json unit test file | Create Json unit test file
| Python | bsd-3-clause | aaronkl/RoBO,aaronkl/RoBO,aaronkl/RoBO,automl/RoBO,numairmansur/RoBO,automl/RoBO,numairmansur/RoBO | ---
+++
@@ -0,0 +1,22 @@
+'''
+
+Created on: June 5th, 2016
+@author: Numair Mansur (numair.mansur@gmail.com)
+
+'''
+
+
+import unittest
+class TestJsonMethods(unittest.TestCase):
+
+ def test_json_base_solver(self):
+ assert True
+
+ def test_json_base_model(self):
+ assert True
+
+ def test_... | |
9d0f386d419097e68f1a2155333236e1c4ed3108 | config/migrations/0003_auto_20181031_2340.py | config/migrations/0003_auto_20181031_2340.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2018-10-31 23:40
from __future__ import unicode_literals
from django.db import migrations
from config.restype import RESTYPE
def updatesdstorageaddress(apps, schema_editor):
ConfResource = apps.get_model('config', 'ConfResource')
applied = ConfResource.ob... | Add automatic SDAddress migration to new version. | Add automatic SDAddress migration to new version.
| Python | agpl-3.0 | inteos/IBAdmin,inteos/IBAdmin,inteos/IBAdmin,inteos/IBAdmin,inteos/IBAdmin,inteos/IBAdmin | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10 on 2018-10-31 23:40
+from __future__ import unicode_literals
+
+from django.db import migrations
+from config.restype import RESTYPE
+
+
+def updatesdstorageaddress(apps, schema_editor):
+ ConfResource = apps.get_model('config', 'ConfRes... | |
4fe2cd2bbb83fff577bab7811a5ba5ba634d9146 | towel/managers.py | towel/managers.py | import re
from django.db import models
from django.db.models import Q
def normalize_query(query_string,
findterms=re.compile(r'"([^"]+)"|(\S+)').findall,
normspace=re.compile(r'\s{2,}').sub):
''' Splits the query string in invidual keywords, getting rid of unecessary space... | Add search manager from metronom | Add search manager from metronom
| Python | bsd-3-clause | matthiask/towel,matthiask/towel,matthiask/towel,matthiask/towel | ---
+++
@@ -0,0 +1,50 @@
+import re
+
+from django.db import models
+from django.db.models import Q
+
+
+def normalize_query(query_string,
+ findterms=re.compile(r'"([^"]+)"|(\S+)').findall,
+ normspace=re.compile(r'\s{2,}').sub):
+ ''' Splits the query string in invidual keyw... | |
449c48db23a76ec1d2f04045d111d968b6df469e | thinc/api.py | thinc/api.py | def layerize(begin_update=None, **kwargs):
'''Wrap a function into a layer'''
if begin_update is not None:
return FunctionLayer(begin_update, *args, **kwargs)
def wrapper(begin_update):
return FunctionLayer(begin_update, *args, **kwargs)
return wrapper
def metalayerize(user_func):
... | Work on parts of functional API | Work on parts of functional API
| Python | mit | explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc | ---
+++
@@ -0,0 +1,61 @@
+def layerize(begin_update=None, **kwargs):
+ '''Wrap a function into a layer'''
+ if begin_update is not None:
+ return FunctionLayer(begin_update, *args, **kwargs)
+ def wrapper(begin_update):
+ return FunctionLayer(begin_update, *args, **kwargs)
+ return wrapper
+... | |
9f4905d7e3f42002209d8ce46435d3b9447de588 | zerver/migrations/0261_pregistrationuser_clear_invited_as_admin.py | zerver/migrations/0261_pregistrationuser_clear_invited_as_admin.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2020-06-16 22:26
from __future__ import unicode_literals
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def clear_preregistrationuser_invited_as_a... | Add migration to clear INVITED_AS_REALM_ADMIN. | CVE-2020-14215: Add migration to clear INVITED_AS_REALM_ADMIN.
This migration fixes any PreregistrationUser objects that might have
been already corrupted to have the administrator role by the buggy
original version of migration 0198_preregistrationuser_invited_as.
Since invitations that create new users as administr... | Python | apache-2.0 | hackerkid/zulip,punchagan/zulip,shubhamdhama/zulip,shubhamdhama/zulip,shubhamdhama/zulip,rht/zulip,shubhamdhama/zulip,kou/zulip,brainwane/zulip,brainwane/zulip,hackerkid/zulip,brainwane/zulip,showell/zulip,punchagan/zulip,timabbott/zulip,rht/zulip,kou/zulip,zulip/zulip,zulip/zulip,kou/zulip,brainwane/zulip,showell/zuli... | ---
+++
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.26 on 2020-06-16 22:26
+from __future__ import unicode_literals
+
+from django.db import migrations
+from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
+from django.db.migrations.state import StateApps
+
+
+def c... | |
edcde8ed3562e19b7bde43632965c2902a8e7f25 | troposphere/sns.py | troposphere/sns.py | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .compat import policytypes
from .validators import boolean
class Subscription(AWSProperty):
props = {
'Endpoint': (basestring, True),
'Proto... | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
from .compat import policytypes
from .validators import boolean
class Subscription(AWSProperty):
props = {
'Endpoint': (basestring, True),
... | Add Tags to SNS::Topic per 2019-11-31 changes | Add Tags to SNS::Topic per 2019-11-31 changes
| Python | bsd-2-clause | cloudtools/troposphere,cloudtools/troposphere,ikben/troposphere,ikben/troposphere | ---
+++
@@ -3,7 +3,7 @@
#
# See LICENSE file for full license.
-from . import AWSObject, AWSProperty
+from . import AWSObject, AWSProperty, Tags
from .compat import policytypes
from .validators import boolean
@@ -45,5 +45,6 @@
'DisplayName': (basestring, False),
'KmsMasterKeyId': (basestring... |
f2bbd5bd1eca7906d7d09bc595abd67af02b23ea | utils/sleepTest.py | utils/sleepTest.py | #!/usr/bin/python
"""Puts sensor to sleep and waits for it to wakeup"""
import minimalmodbus
import serial
from time import sleep
from sys import exit
ADDRESS = 1
SLEEPTIME = 33
minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL = True
minimalmodbus.PARITY=serial.PARITY_NONE
minimalmodbus.STOPBITS = 2
minimalmodbus.BAUDRATE=1... | Add sleep functionality testing code | Add sleep functionality testing code
| Python | apache-2.0 | Miceuz/rs485-moist-sensor,Miceuz/rs485-moist-sensor | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+
+"""Puts sensor to sleep and waits for it to wakeup"""
+
+import minimalmodbus
+import serial
+from time import sleep
+from sys import exit
+
+ADDRESS = 1
+SLEEPTIME = 33
+minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL = True
+minimalmodbus.PARITY=serial.PARITY_NONE
+minimalmod... | |
346188fe171b98aca87f3e5f96d6e41b1eb46fd1 | tests/test_types.py | tests/test_types.py | from crosscompute.exceptions import DataTypeError
from crosscompute.types import DataType
from pytest import raises
class ADataType(DataType):
@classmethod
def load(Class, path):
if path == 'x':
raise Exception
instance = Class()
instance.path = path
return instanc... | Add tests for load_for_view_safely and parse_safely | Add tests for load_for_view_safely and parse_safely
| Python | mit | crosscompute/crosscompute,crosscompute/crosscompute,crosscompute/crosscompute,crosscompute/crosscompute | ---
+++
@@ -0,0 +1,65 @@
+from crosscompute.exceptions import DataTypeError
+from crosscompute.types import DataType
+from pytest import raises
+
+
+class ADataType(DataType):
+
+ @classmethod
+ def load(Class, path):
+ if path == 'x':
+ raise Exception
+ instance = Class()
+ ins... | |
f605c6918f0868fc46a15c08650e5406453451c5 | tools/key-update.py | tools/key-update.py | #!/usr/bin/env python
import os
import sys
from optparse import OptionParser
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir,
... | Add a helper tool for updating keystone | Add a helper tool for updating keystone
| Python | apache-2.0 | stackforge/anvil,mc2014/anvil,stackforge/anvil,mc2014/anvil | ---
+++
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+
+import os
+import sys
+
+from optparse import OptionParser
+
+possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
+ os.pardir,
+ os.pardir))
+if os.path.exists(os.path.join(... | |
a452eedc5f5a7e5f59776ba66a18f57c72bca3c4 | tests/test_jit.py | tests/test_jit.py | import afnumpy
from asserts import *
def test_conditionals():
a = afnumpy.arange(10, dtype="float32") - 5.
b = afnumpy.ones((10), dtype="float32")
afnumpy.arrayfire.backend.get().af_eval(a.d_array.arr)
a_mask = a < 0.
a_sum = a_mask.sum()
a -= b
assert(a_sum == a_mask.sum())
| Add a file to test JIT related issues | Add a file to test JIT related issues
| Python | bsd-2-clause | FilipeMaia/afnumpy,daurer/afnumpy | ---
+++
@@ -0,0 +1,11 @@
+import afnumpy
+from asserts import *
+
+def test_conditionals():
+ a = afnumpy.arange(10, dtype="float32") - 5.
+ b = afnumpy.ones((10), dtype="float32")
+ afnumpy.arrayfire.backend.get().af_eval(a.d_array.arr)
+ a_mask = a < 0.
+ a_sum = a_mask.sum()
+ a -= b
+ assert(... | |
3bcafade7e9a611d073a2baf3d66f46caee9b4aa | flexget/plugins/operate/feed_priority.py | flexget/plugins/operate/feed_priority.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('priority')
# TODO: 1.2 figure out replacement for this
class TaskPriority(object):
"""Set task priorities"""
schema = {'type': 'integer'}
... | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('priority')
# TODO: 1.2 figure out replacement for this
# Currently the manager reads this value directly out of the config when the 'execute' command ... | Add some notes on current state of priority plugin | Add some notes on current state of priority plugin
| Python | mit | X-dark/Flexget,ianstalk/Flexget,JorisDeRieck/Flexget,Pretagonist/Flexget,ratoaq2/Flexget,X-dark/Flexget,qk4l/Flexget,tsnoam/Flexget,drwyrm/Flexget,crawln45/Flexget,cvium/Flexget,jawilson/Flexget,ratoaq2/Flexget,v17al/Flexget,grrr2/Flexget,patsissons/Flexget,LynxyssCZ/Flexget,tobinjt/Flexget,tarzasai/Flexget,qvazzler/Fl... | ---
+++
@@ -8,14 +8,14 @@
# TODO: 1.2 figure out replacement for this
+# Currently the manager reads this value directly out of the config when the 'execute' command is run, and this plugin
+# does nothing but make the config key valid.
+# In daemon mode, schedules should be made which run tasks in the proper or... |
743ae5270d2ba24da652110a967f15b5fa526e3d | plugins/plugin_nginx_error.py | plugins/plugin_nginx_error.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import re
from manager import Plugin
class NginxError(Plugin):
def __init__(self, **kwargs):
self.keywords = ['nginx', 'error']
self.total_line = 0
self.level_dict = {"error": 0, "notice": 0, "info": 0}
self.client_dict = {}
def pr... | Add plugin for parse nginx error | Add plugin for parse nginx error
| Python | apache-2.0 | keepzero/fluent-mongo-parser | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# -*- coding:utf-8 -*-
+
+import re
+from manager import Plugin
+
+class NginxError(Plugin):
+
+ def __init__(self, **kwargs):
+ self.keywords = ['nginx', 'error']
+ self.total_line = 0
+ self.level_dict = {"error": 0, "notice": 0, "info": 0}
+ ... | |
df438a82cb78ecb0404b39182b7a4e049fbac2f9 | pdc/apps/osbs/migrations/0002_auto_20151001_1115.py | pdc/apps/osbs/migrations/0002_auto_20151001_1115.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('osbs', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='osbsrecord',
name='compo... | Add forgotten migration to OSBS app | Add forgotten migration to OSBS app
| Python | mit | pombredanne/product-definition-center,xychu/product-definition-center,product-definition-center/product-definition-center,pombredanne/product-definition-center,product-definition-center/product-definition-center,tzhaoredhat/automation,xychu/product-definition-center,pombredanne/product-definition-center,lao605/product-... | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('osbs', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_... | |
981e8bb1898ef186e646beab98a637a2bcf8c9a0 | src/examples/gpiozero/led_chaser.py | src/examples/gpiozero/led_chaser.py | #!/usr/bin/env python3
"""Demonstrates on board LED support with correct polarity.
Implements simple LED chaser.
"""
from time import sleep
from gpiozero import LED
from aiy.pins import (PIN_A, PIN_B, PIN_C, PIN_D)
leds = (LED(PIN_A), LED(PIN_B), LED(PIN_C), LED(PIN_D))
while True:
for led in leds:
led.o... | Add simple led chaser example. | Add simple led chaser example.
Change-Id: I18a5dc49d115d9f222ea2445a086fc9994adce06
| Python | apache-2.0 | google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian | ---
+++
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+"""Demonstrates on board LED support with correct polarity.
+
+Implements simple LED chaser.
+"""
+
+from time import sleep
+from gpiozero import LED
+from aiy.pins import (PIN_A, PIN_B, PIN_C, PIN_D)
+
+leds = (LED(PIN_A), LED(PIN_B), LED(PIN_C), LED(PIN_D))
+while T... | |
6d1439e39a2970eaa7c98cb0ee69b9b954fd1c16 | migrations/versions/0168_hidden_templates.py | migrations/versions/0168_hidden_templates.py | """
Revision ID: 0168_hidden_templates
Revises: 0167_add_precomp_letter_svc_perm
Create Date: 2018-02-21 14:05:04.448977
"""
from alembic import op
import sqlalchemy as sa
revision = '0168_hidden_templates'
down_revision = '0167_add_precomp_letter_svc_perm'
def upgrade():
op.add_column('templates', sa.Column(... | Add a DB migration to create Templates.hidden column | Add a DB migration to create Templates.hidden column
Creates the column as nullable, sets the value to false for all
existing templates and template versions and then applies a
not-nullable constraint.
All future Templates are created with `False` as the default set
in SQLAlchemy.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,29 @@
+"""
+
+Revision ID: 0168_hidden_templates
+Revises: 0167_add_precomp_letter_svc_perm
+Create Date: 2018-02-21 14:05:04.448977
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+revision = '0168_hidden_templates'
+down_revision = '0167_add_precomp_letter_svc_perm'
+
+
+def upgrade()... | |
8b410e8876835133b7f18e42754da7c793ce950f | migrations/versions/0226_new_letter_rates.py | migrations/versions/0226_new_letter_rates.py | """empty message
Revision ID: 0226_new_letter_rates
Revises: 0225_another_letter_org
"""
revision = '0226_new_letter_rates'
down_revision = '0225_another_letter_org'
import uuid
from datetime import datetime
from alembic import op
start = datetime(2018, 10, 1, 0, 0, tzinfo=timezone.utc)
NEW_RATES = [
(uuid.u... | Add new letter rates from 1st of October 2018 | Add new letter rates from 1st of October 2018
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,53 @@
+"""empty message
+
+Revision ID: 0226_new_letter_rates
+Revises: 0225_another_letter_org
+
+"""
+
+revision = '0226_new_letter_rates'
+down_revision = '0225_another_letter_org'
+
+import uuid
+from datetime import datetime
+from alembic import op
+
+
+start = datetime(2018, 10, 1, 0, 0, tzin... | |
d7c2fdca488761aecc2ba1cfd80e44af3de2ea2b | go/vumitools/opt_out/utils.py | go/vumitools/opt_out/utils.py | from vumi.config import Config, ConfigBool, ConfigList
class OptOutHelperConfig(Config):
case_sensitive = ConfigBool(
"Whether case sensitivity should be enforced when checking message "
"content for opt outs",
default=False, static=True)
optout_keywords = ConfigList(
"List of... | Add a config class for an opt out helper | Add a config class for an opt out helper
| Python | bsd-3-clause | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | ---
+++
@@ -0,0 +1,12 @@
+from vumi.config import Config, ConfigBool, ConfigList
+
+
+class OptOutHelperConfig(Config):
+ case_sensitive = ConfigBool(
+ "Whether case sensitivity should be enforced when checking message "
+ "content for opt outs",
+ default=False, static=True)
+
+ optout_ke... | |
7d55f2a8fc5db6092abe1965da6c5ad0046a8d1e | populate_rango.py | populate_rango.py | import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tango_with_django_project.settings')
import django
django.setup()
from rango.models import Category, Page
def populate():
suits_cat = add_cat('Suits')
add_page(cat=suits_cat,
title = "Blue suit")
add_page(cat=suits_cat,
title = "Georgio Arm... | Complete population script and seeding | Complete population script and seeding
| Python | mit | dnestoff/Tango-With-Django,dnestoff/Tango-With-Django | ---
+++
@@ -0,0 +1,40 @@
+import os
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tango_with_django_project.settings')
+
+import django
+django.setup()
+
+from rango.models import Category, Page
+
+def populate():
+ suits_cat = add_cat('Suits')
+
+ add_page(cat=suits_cat,
+ title = "Blue suit")
+
+ add_pa... | |
00a52ec4453ee0bcd498c439e411bfcaad41a4fc | scripts/update-alfred.py | scripts/update-alfred.py | from __future__ import unicode_literals
import binascii
import json
import os
import plistlib
import sys
import unicodedata
import zipfile
def make_random_uid():
return binascii.b2a_hex(os.urandom(15))
def titlecase_phrase(phrase):
return ' '.join([word.title() for word in phrase])
def make_emoji_name(em... | Add Python script to create .alfredsnippets file from plist. | Add Python script to create .alfredsnippets file from plist.
| Python | mit | warpling/Macmoji,warpling/Macmoji | ---
+++
@@ -0,0 +1,52 @@
+from __future__ import unicode_literals
+
+import binascii
+import json
+import os
+import plistlib
+import sys
+import unicodedata
+import zipfile
+
+
+def make_random_uid():
+ return binascii.b2a_hex(os.urandom(15))
+
+
+def titlecase_phrase(phrase):
+ return ' '.join([word.title() f... | |
b1eba723dbdc068558ab34cc226c32bcb8bfa2ef | intake_bluesky/tests/test_core.py | intake_bluesky/tests/test_core.py | import event_model
from intake_bluesky.core import documents_to_xarray
def test_no_descriptors():
run_bundle = event_model.compose_run()
start_doc = run_bundle.start_doc
stop_doc = run_bundle.compose_stop()
documents_to_xarray(start_doc=start_doc, stop_doc=stop_doc,
descriptor_docs=[],
... | Test runs with no descriptors or no events. | TST: Test runs with no descriptors or no events.
| Python | bsd-3-clause | ericdill/databroker,ericdill/databroker | ---
+++
@@ -0,0 +1,32 @@
+import event_model
+from intake_bluesky.core import documents_to_xarray
+
+
+def test_no_descriptors():
+ run_bundle = event_model.compose_run()
+ start_doc = run_bundle.start_doc
+ stop_doc = run_bundle.compose_stop()
+ documents_to_xarray(start_doc=start_doc, stop_doc=stop_doc,... | |
16956e0d482e871ba2ff6800a107bd57ea0fdd9b | estimators/admin.py | estimators/admin.py | from django.contrib import admin
from estimators.models import DataSet, Estimator, EvaluationResult
admin.site.register(Estimator)
admin.site.register(DataSet)
admin.site.register(EvaluationResult)
| Add Basic Admin Functionality for Estimators, EvaluationResult and DataSet | Add Basic Admin Functionality for Estimators, EvaluationResult and DataSet
| Python | mit | fridiculous/django-estimators | ---
+++
@@ -0,0 +1,7 @@
+from django.contrib import admin
+
+from estimators.models import DataSet, Estimator, EvaluationResult
+
+admin.site.register(Estimator)
+admin.site.register(DataSet)
+admin.site.register(EvaluationResult) | |
ae1304041915592eb4ef20e3633b97aa30034bd7 | examples/lvm_thin.py | examples/lvm_thin.py | import os
import blivet
from blivet.size import Size
from blivet.util import set_up_logging, create_sparse_tempfile
set_up_logging()
b = blivet.Blivet() # create an instance of Blivet (don't add system devices)
# create a disk image file on which to create new devices
disk1_file = create_sparse_tempfile("disk1", S... | Add example for LVM thin provisioning | Add example for LVM thin provisioning
| Python | lgpl-2.1 | vojtechtrefny/blivet,vojtechtrefny/blivet,rvykydal/blivet,rvykydal/blivet | ---
+++
@@ -0,0 +1,49 @@
+import os
+
+import blivet
+from blivet.size import Size
+from blivet.util import set_up_logging, create_sparse_tempfile
+
+set_up_logging()
+b = blivet.Blivet() # create an instance of Blivet (don't add system devices)
+
+# create a disk image file on which to create new devices
+disk1_fi... | |
87acd24224a648407bd0ee538db3c2a1f925a7b1 | bluebottle/tasks/migrations/0024_auto_20170602_2304.py | bluebottle/tasks/migrations/0024_auto_20170602_2304.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-06-02 21:04
from __future__ import unicode_literals
from django.db import migrations
def add_phaselogs_to_old_tasks(apps, schema_editor):
Task = apps.get_model('tasks', 'Task')
TaskStatusLog = apps.get_model('tasks', 'TaskStatusLog')
for task ... | Fix old tasks for stats too | Fix old tasks for stats too
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.2 on 2017-06-02 21:04
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def add_phaselogs_to_old_tasks(apps, schema_editor):
+ Task = apps.get_model('tasks', 'Task')
+ TaskStatusLog = apps.get_model('ta... | |
dcfa7bfa11bea86d831959a217b558d704ece078 | ensemble/ctf/tests/test_manager.py | ensemble/ctf/tests/test_manager.py | from contextlib import contextmanager
from os.path import isfile, join
import shutil
import tempfile
from numpy.testing import assert_allclose
from ensemble.ctf.editor import ALPHA_DEFAULT, COLOR_DEFAULT, create_function
from ensemble.ctf.manager import CTF_EXTENSION, CtfManager
@contextmanager
def temp_directory()... | Add unit tests for CtfManager. | Add unit tests for CtfManager.
| Python | bsd-3-clause | dmsurti/ensemble | ---
+++
@@ -0,0 +1,57 @@
+from contextlib import contextmanager
+from os.path import isfile, join
+import shutil
+import tempfile
+
+from numpy.testing import assert_allclose
+
+from ensemble.ctf.editor import ALPHA_DEFAULT, COLOR_DEFAULT, create_function
+from ensemble.ctf.manager import CTF_EXTENSION, CtfManager
+
... | |
6b148c2fb003c46d2cf1eec6b81a4720bc3adcd6 | src/web/views/api/v1/cve.py | src/web/views/api/v1/cve.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Freshermeat - An open source software directory and release tracker.
# Copyright (C) 2017-2019 Cédric Bonhomme - https://www.cedricbonhomme.org
#
# For more information : https://gitlab.com/cedric/Freshermeat
#
# This program is free software: you can redistribute it a... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Freshermeat - An open source software directory and release tracker.
# Copyright (C) 2017-2019 Cédric Bonhomme - https://www.cedricbonhomme.org
#
# For more information : https://gitlab.com/cedric/Freshermeat
#
# This program is free software: you can redistribute it a... | Sort CVE by published_at attribute. | [API] Sort CVE by published_at attribute.
| Python | agpl-3.0 | cedricbonhomme/services,cedricbonhomme/services,cedricbonhomme/services,cedricbonhomme/services | ---
+++
@@ -25,8 +25,15 @@
from web.views.api.v1 import processors
from web.views.api.v1.common import url_prefix
+def pre_get_many(search_params=None, **kw):
+ order_by = [{"field":"published_at", "direction":"desc"}]
+ if 'order_by' not in search_params:
+ search_params['order_by'] = []
+ search... |
143e76eaf220e5200150653627642dc2bc3a645e | examples/network_correlations.py | examples/network_correlations.py | """
Cortical networks correlation matrix
====================================
"""
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(context="paper", font="monospace")
df = sns.load_dataset("brain_networks", header=[0, 1, 2], index_col=0)
corrmat = df.corr()
f, ax = plt.subplots(figsize=(12, 9))
sns.heatm... | Add correlation matrix heatmap example | Add correlation matrix heatmap example
| Python | bsd-3-clause | oesteban/seaborn,gef756/seaborn,arokem/seaborn,anntzer/seaborn,drewokane/seaborn,ischwabacher/seaborn,phobson/seaborn,ebothmann/seaborn,cwu2011/seaborn,sinhrks/seaborn,q1ang/seaborn,aashish24/seaborn,ashhher3/seaborn,dimarkov/seaborn,lypzln/seaborn,mwaskom/seaborn,JWarmenhoven/seaborn,olgabot/seaborn,dotsdl/seaborn,luk... | ---
+++
@@ -0,0 +1,30 @@
+"""
+Cortical networks correlation matrix
+====================================
+
+"""
+import seaborn as sns
+import matplotlib.pyplot as plt
+sns.set(context="paper", font="monospace")
+
+df = sns.load_dataset("brain_networks", header=[0, 1, 2], index_col=0)
+corrmat = df.corr()
+
+f, ax =... | |
cf09d16ca8c6852f39e9cc347e4d726a79d6c1cf | examples/python/helloworld/greeter_client_with_options.py | examples/python/helloworld/greeter_client_with_options.py | # Copyright 2018 gRPC 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 applicable law or agreed to in writing... | Add python example - channel options | Add python example - channel options
| Python | apache-2.0 | ejona86/grpc,grpc/grpc,carl-mastrangelo/grpc,ejona86/grpc,grpc/grpc,mehrdada/grpc,carl-mastrangelo/grpc,vjpai/grpc,carl-mastrangelo/grpc,ctiller/grpc,ejona86/grpc,donnadionne/grpc,grpc/grpc,nicolasnoble/grpc,vjpai/grpc,stanley-cheung/grpc,nicolasnoble/grpc,donnadionne/grpc,pszemus/grpc,muxi/grpc,vjpai/grpc,pszemus/grpc... | ---
+++
@@ -0,0 +1,50 @@
+# Copyright 2018 gRPC 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 ap... | |
36d597c38537e68b648fb9c85e8ec448e324c41e | mrequests/examples/get_save_file.py | mrequests/examples/get_save_file.py | import mrequests
host = 'http://httpbin.org/'
#host = "http://localhost/"
url = host + "image"
filename = "image.png"
r = mrequests.get(url, headers={b"accept": b"image/png"})
if r.status_code == 200:
r.save(filename)
print("Image saved to '{}'.".format(filename))
else:
print("Request failed. Status: {}".... | Add example for saving request data to file | Add example for saving request data to file
Signed-off-by: Christopher Arndt <711c73f64afdce07b7e38039a96d2224209e9a6c@chrisarndt.de>
| Python | mit | SpotlightKid/micropython-stm-lib | ---
+++
@@ -0,0 +1,15 @@
+import mrequests
+
+host = 'http://httpbin.org/'
+#host = "http://localhost/"
+url = host + "image"
+filename = "image.png"
+r = mrequests.get(url, headers={b"accept": b"image/png"})
+
+if r.status_code == 200:
+ r.save(filename)
+ print("Image saved to '{}'.".format(filename))
+else:
... | |
081612c1a07422cfa5292482c409e46346d15dc5 | domm/tests/test_crossref.py | domm/tests/test_crossref.py | ##############################################################################
# Name: test_crossref.py
# Purpose: Test for verifying output the semantic verification of cross-refs
# Author: Daniel Fath <daniel DOT fath7 AT gmail DOT com>
# Copyright: (c) 2014 Daniel Fath <daniel DOT fath7 AT gmail DOT com>
# License: ... | Add test stub for crossref | Add test stub for crossref
| Python | mit | Ygg01/master | ---
+++
@@ -0,0 +1,12 @@
+##############################################################################
+# Name: test_crossref.py
+# Purpose: Test for verifying output the semantic verification of cross-refs
+# Author: Daniel Fath <daniel DOT fath7 AT gmail DOT com>
+# Copyright: (c) 2014 Daniel Fath <daniel DOT fat... | |
2204ff556bf6257dcfeb39447b04607729d6b4d2 | py/counting-bits.py | py/counting-bits.py | class Solution(object):
def count_bits(self, n):
c = (n - ((n >> 1) & 0o33333333333) - ((n >> 2) & 0o11111111111))
return ((c + (c >> 3)) & 0o30707070707) % 63
def countBits(self, num):
"""
:type num: int
:rtype: List[int]
"""
return map(self.count_bits, x... | Add py solution for 338. Counting Bits | Add py solution for 338. Counting Bits
338. Counting Bits: https://leetcode.com/problems/counting-bits/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,10 @@
+class Solution(object):
+ def count_bits(self, n):
+ c = (n - ((n >> 1) & 0o33333333333) - ((n >> 2) & 0o11111111111))
+ return ((c + (c >> 3)) & 0o30707070707) % 63
+ def countBits(self, num):
+ """
+ :type num: int
+ :rtype: List[int]
+ """
+... | |
b6920055ca0498bc621da51e5296a001415166dd | tests/test_Cubie.py | tests/test_Cubie.py | import src.Cubie as Cubie
import unittest
class TestSticker(unittest.TestCase):
def test_init(self):
not_allowed_chars = 'acdefhijklmnpqstuvxz'
allowed_chars = 'rgbywo.'
for c in not_allowed_chars:
self.assertRaises(ValueError, Cubie.Sticker, c)
for c in allowed_chars:... | Rename tests file to test_* | Rename tests file to test_*
| Python | mit | Wiston999/python-rubik | ---
+++
@@ -0,0 +1,19 @@
+import src.Cubie as Cubie
+import unittest
+
+class TestSticker(unittest.TestCase):
+ def test_init(self):
+ not_allowed_chars = 'acdefhijklmnpqstuvxz'
+ allowed_chars = 'rgbywo.'
+
+ for c in not_allowed_chars:
+ self.assertRaises(ValueError, Cubie.Sticker... | |
315858ae41722442668e289f2c1492a591526f0f | chmvh_website/common/tests/templatetags/test_phone_number_tag.py | chmvh_website/common/tests/templatetags/test_phone_number_tag.py | from common.templatetags.common import phone_number
class TestPhoneNumberTag(object):
"""Test cases for the phone number tag"""
def test_multi_whitespace(self):
"""Test passing in a string with lots of whitespace.
Whitespace more than 1 character wide should be condensed down
to one ... | Add tests for phone number template tag. | Add tests for phone number template tag.
| Python | mit | cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website | ---
+++
@@ -0,0 +1,26 @@
+from common.templatetags.common import phone_number
+
+
+class TestPhoneNumberTag(object):
+ """Test cases for the phone number tag"""
+
+ def test_multi_whitespace(self):
+ """Test passing in a string with lots of whitespace.
+
+ Whitespace more than 1 character wide sho... | |
3a82bf4d0597c79a41029004b1a5622ad70268a9 | all_builds.py | all_builds.py | #!/usr/bin/python
import subprocess
import sys
def RunCommand(command):
run = subprocess.Popen(command, shell=True)
output = run.communicate()
if run.returncode:
print "Non-zero return code: " + str(run.returncode) + " => exiting!"
sys.exit(1)
def list_of_experiments():
experiments = []
configure_f... | Add script to test all builds. | Add script to test all builds.
Change-Id: I6bbed8bcb2dfa3458ffc59179dfba66c92e18125
| Python | bsd-3-clause | jmvalin/aom,ittiamvpx/libvpx,smarter/aom,shacklettbp/aom,mwgoldsmith/libvpx,Laknot/libvpx,altogother/webm.libvpx,Distrotech/libvpx,altogother/webm.libvpx,running770/libvpx,hsueceumd/test_hui,matanbs/vp982,Topopiccione/libvpx,zofuthan/libvpx,Laknot/libvpx,reimaginemedia/webm.libvpx,webmproject/libvpx,shareefalis/libvpx,... | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+import subprocess
+import sys
+
+def RunCommand(command):
+ run = subprocess.Popen(command, shell=True)
+ output = run.communicate()
+ if run.returncode:
+ print "Non-zero return code: " + str(run.returncode) + " => exiting!"
+ sys.exit(1)
+
+def list_of_experim... | |
12311fff64dba06b24c66dd0523e52f3cd8927b9 | lib/bridgedb/test/test_Bucket.py | lib/bridgedb/test/test_Bucket.py | # -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :copyright: (c) 2007-2014, The Tor Project, Inc.
# (c) 2007-2014, all entities within the AUTHORS file
# :license: 3-Clause BSD, see LICENSE for licensing information
"""Unittests for the :mod:`bridgedb.Bucket`... | Add a test for Buckets | Add a test for Buckets
The others will require mocking a DB connection.
| Python | bsd-3-clause | pagea/bridgedb,pagea/bridgedb | ---
+++
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+#
+# This file is part of BridgeDB, a Tor bridge distribution system.
+#
+# :copyright: (c) 2007-2014, The Tor Project, Inc.
+# (c) 2007-2014, all entities within the AUTHORS file
+# :license: 3-Clause BSD, see LICENSE for licensing information
+
+"""Unit... | |
3eb614d8c0edd1d52509c1ec7b48bba983600c35 | examples/uart/txmod_test.py | examples/uart/txmod_test.py | import fault
import magma
from txmod import TXMOD
import random
def get_random(port):
if isinstance(port, magma.BitType):
return random.choice((0, 1))
N = type(port).N
return random.randint(0, 2 ** N - 1)
if __name__ == "__main__":
random.seed(0)
#TXMOD_v = magma.DefineFromVerilogFile("... | Add test for uart magma impl | Add test for uart magma impl
| Python | mit | phanrahan/magmathon,phanrahan/magmathon | ---
+++
@@ -0,0 +1,46 @@
+import fault
+import magma
+from txmod import TXMOD
+import random
+
+
+def get_random(port):
+ if isinstance(port, magma.BitType):
+ return random.choice((0, 1))
+ N = type(port).N
+ return random.randint(0, 2 ** N - 1)
+
+
+if __name__ == "__main__":
+ random.seed(0)
+
+... | |
0a33ea9c108693e94405dbd964b9361bb2ae7e2a | hyperiontests/test_kibana.py | hyperiontests/test_kibana.py | # Copyright (C) 2014 Nicolas Lamirault <nicolas.lamirault@gmail.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | Add unit tests for Kibana | Add unit tests for Kibana
| Python | apache-2.0 | portefaix/hyperion-k8s,portefaix/hyperion,nlamirault/hyperion | ---
+++
@@ -0,0 +1,24 @@
+# Copyright (C) 2014 Nicolas Lamirault <nicolas.lamirault@gmail.com>
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at ... | |
2b3fcfbd9b497d3a162cb36af4eb28e619648258 | project/commands/create_db.py | project/commands/create_db.py | # !/usr/bin/python
# -*- coding: utf-8 -*-
from flask import current_app as app
from flask_script import Command
from project.database import init_db, drop_db
class CreateDBCommand(Command):
"""
Creates all tables from registered models
"""
def run(self, **kwargs):
app.logger.info("Running {} ... | Add command to create new database with all tables | Add command to create new database with all tables
| Python | mit | andreffs18/flask-template-project,andreffs18/flask-template-project,andreffs18/flask-template-project | ---
+++
@@ -0,0 +1,16 @@
+# !/usr/bin/python
+# -*- coding: utf-8 -*-
+from flask import current_app as app
+from flask_script import Command
+from project.database import init_db, drop_db
+
+
+class CreateDBCommand(Command):
+ """
+ Creates all tables from registered models
+ """
+ def run(self, **kwargs... | |
a2400b6980089803b38121e20e2d24ee2f463eb1 | keyring/tests/backends/test_chainer.py | keyring/tests/backends/test_chainer.py | import pytest
import keyring.backends.chainer
from keyring import backend
@pytest.fixture
def two_keyrings(monkeypatch):
def get_two():
class Keyring1(backend.KeyringBackend):
priority = 1
def get_password(self, system, user):
return 'ring1-{system}-{user}'.format... | Add a test for the chainer. | Add a test for the chainer.
| Python | mit | jaraco/keyring | ---
+++
@@ -0,0 +1,37 @@
+import pytest
+
+import keyring.backends.chainer
+from keyring import backend
+
+
+@pytest.fixture
+def two_keyrings(monkeypatch):
+ def get_two():
+ class Keyring1(backend.KeyringBackend):
+ priority = 1
+
+ def get_password(self, system, user):
+ ... | |
000266aed1f4c1106c791105427a7238add90a01 | nodeconductor/core/management/commands/removestalect.py | nodeconductor/core/management/commands/removestalect.py | from django.contrib.admin.models import LogEntry
from django.core.management.base import BaseCommand
from nodeconductor.cost_tracking import models as cost_tracking_models
class Command(BaseCommand):
help = "Remove instances that have FK to stale content types."
def handle(self, *args, **options):
f... | Add command that deletes stale content types | Add command that deletes stale content types
- nc-1511
| Python | mit | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | ---
+++
@@ -0,0 +1,18 @@
+from django.contrib.admin.models import LogEntry
+from django.core.management.base import BaseCommand
+
+from nodeconductor.cost_tracking import models as cost_tracking_models
+
+
+class Command(BaseCommand):
+ help = "Remove instances that have FK to stale content types."
+
+ def hand... | |
5c0c8451f3975ae98be33e0f47dde73cb5a2e3ac | nodeconductor/structure/tests/unittests/test_filters.py | nodeconductor/structure/tests/unittests/test_filters.py | import mock
from django.test import TestCase
from nodeconductor.logging import models as logging_models
from nodeconductor.logging.tests import factories as logging_factories
from nodeconductor.structure.filters import AggregateFilter
from nodeconductor.structure.tests import factories
class AggregateFilterTest(Test... | Cover AggregateFilter with unit tests | Cover AggregateFilter with unit tests [WAL-397]
| Python | mit | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | ---
+++
@@ -0,0 +1,70 @@
+import mock
+from django.test import TestCase
+
+from nodeconductor.logging import models as logging_models
+from nodeconductor.logging.tests import factories as logging_factories
+from nodeconductor.structure.filters import AggregateFilter
+from nodeconductor.structure.tests import factorie... | |
acb985cf87917d7b29be517a5c5e2fd5285bebe1 | py/count-binary-substrings.py | py/count-binary-substrings.py | from itertools import groupby
class Solution(object):
def countBinarySubstrings(self, s):
"""
:type s: str
:rtype: int
"""
prev = 0
ans = 0
for k, g in groupby(s):
l = len(list(g))
ans += min(l, prev)
prev = l
return... | Add py solution for 696. Count Binary Substrings | Add py solution for 696. Count Binary Substrings
696. Count Binary Substrings: https://leetcode.com/problems/count-binary-substrings/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,14 @@
+from itertools import groupby
+class Solution(object):
+ def countBinarySubstrings(self, s):
+ """
+ :type s: str
+ :rtype: int
+ """
+ prev = 0
+ ans = 0
+ for k, g in groupby(s):
+ l = len(list(g))
+ ans += min(l, pr... | |
48cd3380c23cc7a41917d281084c74420cd7b4f1 | tests/test_pipeline_mnaseseq.py | tests/test_pipeline_mnaseseq.py | """
.. Copyright 2017 EMBL-European Bioinformatics Institute
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... | Test the pipeline code for the MNase-seq pipeline | Test the pipeline code for the MNase-seq pipeline
| Python | apache-2.0 | Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq | ---
+++
@@ -0,0 +1,75 @@
+"""
+.. Copyright 2017 EMBL-European Bioinformatics Institute
+
+ 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/LICENS... | |
558d3e45e8e7c81ab46b560e6c1beb791f1e935f | derrida/__init__.py | derrida/__init__.py | __version_info__ = (1, 3, 0, 'dev')
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join([str(i) for i in __version_info__[:-1]])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
# context processor to add version to the template environ... | __version_info__ = (1, 3, 0, None)
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join([str(i) for i in __version_info__[:-1]])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
# context processor to add version to the template environm... | Remove dev suffix from version | Remove dev suffix from version
| Python | apache-2.0 | Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django | ---
+++
@@ -1,4 +1,4 @@
-__version_info__ = (1, 3, 0, 'dev')
+__version_info__ = (1, 3, 0, None)
# Dot-connect all but the last. Last is dash-connected if not None. |
7aa7d6222256b20fd256c27479e54594fc646405 | tests/test_cli.py | tests/test_cli.py | from tomso import cli
import unittest
tmpfile = 'data/tmpfile'
class TestCLIFunctions(unittest.TestCase):
def setUp(self):
self.parser = cli.get_parser()
def test_info_guess_format(self):
filenames = ['data/mesa.%s' % ext for ext in
['amdl', 'fgong', 'gyre', 'history', '... | Add some basic tests of command-line interface | Add some basic tests of command-line interface
| Python | mit | warrickball/tomso | ---
+++
@@ -0,0 +1,40 @@
+from tomso import cli
+import unittest
+
+tmpfile = 'data/tmpfile'
+
+class TestCLIFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.parser = cli.get_parser()
+
+ def test_info_guess_format(self):
+ filenames = ['data/mesa.%s' % ext for ext in
+ ... | |
12c4b353f4f4ae4fb52a1c05862057f1ef36314b | addons/membership/wizard/__init__.py | addons/membership/wizard/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Remove unpaid inovice import from init file | [FIX] membership: Remove unpaid inovice import from init file
bzr revid: mra@mra-laptop-20101006072219-twq77xlem3d69rg7 | Python | agpl-3.0 | ShineFan/odoo,optima-ict/odoo,Ernesto99/odoo,papouso/odoo,avoinsystems/odoo,BT-ojossen/odoo,joariasl/odoo,Ernesto99/odoo,numerigraphe/odoo,JGarcia-Panach/odoo,fgesora/odoo,bplancher/odoo,tvibliani/odoo,cedk/odoo,OpusVL/odoo,Endika/OpenUpgrade,codekaki/odoo,mszewczy/odoo,OSSESAC/odoopubarquiluz,storm-computers/odoo,Endi... | ---
+++
@@ -20,5 +20,4 @@
##############################################################################
import membership_invoice
-import membership_unpaid_invoice
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
ba7548816106c652b8c85a9aa703b7d40b5c2307 | slave/skia_slave_scripts/valgrind_run_decoding_tests.py | slave/skia_slave_scripts/valgrind_run_decoding_tests.py | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia skimage executable. """
from build_step import BuildStep
from valgrind_build_step import ValgrindBuildStep
from r... | Add missing skimage script for valgrind | Add missing skimage script for valgrind
Unreviewed.
(RunBuilders:Test-Ubuntu12-ShuttleA-HD2000-x86_64-Release-Valgrind)
Review URL: https://codereview.chromium.org/18301004
git-svn-id: 32fc27f4dcfb6c0385cd9719852b95fe6680452d@9894 2bbb7eff-a529-9590-31e7-b0007b416f81
| Python | bsd-3-clause | Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Ti... | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+""" Run the Skia skimage executable. """
+
+from build_step import BuildStep
+from valgrind_build_... | |
f5915cf24dc7e6fed96700e00a3bbc6ccb6bc552 | core/utils.py | core/utils.py | from __future__ import division
from django.utils.duration import _get_duration_components
from datetime import timedelta
from decimal import Decimal
def parse_duration(duration):
hours = None
minutes = None
if duration.isdigit():
hours = int(duration)
elif ':' in duration:
duratio... | from __future__ import division
from django.utils.duration import _get_duration_components
from datetime import timedelta
from decimal import Decimal
def parse_duration(duration):
hours = None
minutes = None
if duration.isdigit():
hours = int(duration)
elif ':' in duration:
duratio... | Fix bug that caused error when nothing is before a decimal duration input | Fix bug that caused error when nothing is before a decimal duration input
| Python | bsd-2-clause | cdubz/timestrap,overshard/timestrap,overshard/timestrap,cdubz/timestrap,muhleder/timestrap,cdubz/timestrap,overshard/timestrap,muhleder/timestrap,muhleder/timestrap | ---
+++
@@ -18,6 +18,8 @@
hours = int(duration_split[0])
minutes = int(duration_split[1])
elif '.' in duration:
+ if duration.index('.') == 0:
+ duration = '0' + duration
duration_split = duration.split('.')
# TODO: Fix error here when not appending a 0, ex .... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.