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 |
|---|---|---|---|---|---|---|---|---|---|---|
bdea8195a3f06c3e69c655419b63dbcf925a6382 | test_install.py | test_install.py | # -*- coding: utf-8 -*-
import requests
import sys
from insight_reloaded.insight_settings import CROP_SIZE
def main():
args = {}
args['crop'] = CROP_SIZE
args['url'] = 'http://www.novapost.fr/emploi/ruby.pdf'
if len(sys.argv) > 1:
args['url'] = sys.argv[1]
if len(sys.argv) > 2:
a... | Add a functional test for insight. | Add a functional test for insight.
| Python | bsd-3-clause | novapost/insight-reloaded | ---
+++
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+import requests
+import sys
+
+from insight_reloaded.insight_settings import CROP_SIZE
+
+
+def main():
+ args = {}
+ args['crop'] = CROP_SIZE
+ args['url'] = 'http://www.novapost.fr/emploi/ruby.pdf'
+
+ if len(sys.argv) > 1:
+ args['url'] = sys.ar... | |
fef1191dc42a5710f14635182f59b4bc643b549e | senlinclient/tests/unit/test_sdk.py | senlinclient/tests/unit/test_sdk.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add unit test cases for sdk module | Add unit test cases for sdk module
Add unit test cases for sdk module for class ProfileAction
Still need unit tests for class Resource
Change-Id: I6328e6346bbc2e615d1824aeb223e76cb5c8adf0
Partial-Bug: #1484496
| Python | apache-2.0 | stackforge/python-senlinclient,stackforge/python-senlinclient,openstack/python-senlinclient,openstack/python-senlinclient | ---
+++
@@ -0,0 +1,56 @@
+# 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... | |
2c7b64ea22ebe7e35945550f5726a72a721213b4 | minitests/litex/src.yosys/missing_bit_report.py | minitests/litex/src.yosys/missing_bit_report.py | """ Generates a missing feature/bit report for LiteX design.
This script is fairly fragile, because it depends on the specific observation
that all of the remaining bits appear to either belong to HCLK_IOI or IOI3
tiles. A more general version of this script could be created, but that was
not the point of this scrip... | Create script for generating remaining bit report. | Create script for generating remaining bit report.
This report is fairly fragile, but works well enough for the remaining
LiteX bits.
Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com>
| Python | isc | SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray | ---
+++
@@ -0,0 +1,81 @@
+""" Generates a missing feature/bit report for LiteX design.
+
+This script is fairly fragile, because it depends on the specific observation
+that all of the remaining bits appear to either belong to HCLK_IOI or IOI3
+tiles. A more general version of this script could be created, but that... | |
e84abb1b67586d3a3620ce6a21e3314527083218 | doc/examples/plot_threshold_adaptive.py | doc/examples/plot_threshold_adaptive.py | """
=====================
Adaptive Thresholding
=====================
Thresholding is the simplest way to segment objects from a background. If that
background is relatively uniform, then you can use a global threshold value to
binarize the image by pixel-intensity. If there's large variation in the
background intensi... | Add example of adaptive thresholding. | DOC: Add example of adaptive thresholding.
| Python | bsd-3-clause | Hiyorimi/scikit-image,ofgulban/scikit-image,rjeli/scikit-image,newville/scikit-image,almarklein/scikit-image,youprofit/scikit-image,chintak/scikit-image,dpshelio/scikit-image,emon10005/scikit-image,vighneshbirodkar/scikit-image,ClinicalGraphics/scikit-image,juliusbierk/scikit-image,robintw/scikit-image,keflavich/scikit... | ---
+++
@@ -0,0 +1,48 @@
+"""
+=====================
+Adaptive Thresholding
+=====================
+
+Thresholding is the simplest way to segment objects from a background. If that
+background is relatively uniform, then you can use a global threshold value to
+binarize the image by pixel-intensity. If there's large ... | |
2f37f0ae1fc024b97de4c783c8f162c02c2c3a2d | hemresadapter.py | hemresadapter.py | # coding=utf-8
# description: functions to interact with the newsletter subscriptions in jdwebsite (Hemres),
# via Hemres management commands
import os
import subprocess
import configparser
class HemresAdapter(object):
def __init__(self):
SCRIPTDIR = os.path.dirname(os.path.realpath(__file__))
co... | Create hemres (jdwebsite newsletter) interface adapter | Create hemres (jdwebsite newsletter) interface adapter
| Python | mit | jonge-democraten/jdleden,jonge-democraten/jdleden | ---
+++
@@ -0,0 +1,45 @@
+# coding=utf-8
+# description: functions to interact with the newsletter subscriptions in jdwebsite (Hemres),
+# via Hemres management commands
+
+import os
+import subprocess
+import configparser
+
+class HemresAdapter(object):
+
+ def __init__(self):
+ SCRIPTDIR = os.path.dirname... | |
38db1be31407ecab2237c3cd75160f5ffeb59cb2 | Split_Multipoint_CZI.py | Split_Multipoint_CZI.py | # @File(label="Input file") input
# @File(label="Output folder") output
# Splits multi-point CZI files into multiple TIFFs using Bio-Formats.
#
# Stefan Helfrich (University of Konstaz), 05/09/2016
from ij import IJ
from loci.plugins import BF
from loci.plugins.in import ImporterOptions
import os
srcPath = input.get... | Add script to split multi-point CZIs | Add script to split multi-point CZIs
| Python | bsd-2-clause | bic-kn/imagej-scripts | ---
+++
@@ -0,0 +1,28 @@
+# @File(label="Input file") input
+# @File(label="Output folder") output
+
+# Splits multi-point CZI files into multiple TIFFs using Bio-Formats.
+#
+# Stefan Helfrich (University of Konstaz), 05/09/2016
+
+from ij import IJ
+from loci.plugins import BF
+from loci.plugins.in import ImporterO... | |
d8168c182efb9ca6e05c9f8fdf253cb25ff6599d | Python/Soma2Numeros.py | Python/Soma2Numeros.py |
# Problem
# Given an array/list A of n numbers and another number x, determines
# if exists two elements in A whose sum is exactly x
# Works only for different values
def solution1(values, expected):
dic = {}
for index, value in enumerate(values):
dic[value] = index
diff = expected - value
... | Add problema da soma de 2 numeros | Add problema da soma de 2 numeros | Python | mit | kelvins/Algoritmos-e-Estruturas-de-Dados,kelvins/Algoritmos-e-Estruturas-de-Dados,kelvins/Algoritmos-e-Estruturas-de-Dados,kelvins/Algoritmos-e-Estruturas-de-Dados,kelvins/Algoritmos-e-Estruturas-de-Dados,kelvins/Algoritmos-e-Estruturas-de-Dados,kelvins/Algoritmos-e-Estruturas-de-Dados,kelvins/Algoritmos-e-Estruturas-d... | ---
+++
@@ -0,0 +1,64 @@
+
+# Problem
+# Given an array/list A of n numbers and another number x, determines
+# if exists two elements in A whose sum is exactly x
+
+# Works only for different values
+def solution1(values, expected):
+ dic = {}
+ for index, value in enumerate(values):
+ dic[value] = inde... | |
5f0788be20bad0cef4a31a88b7513da58822a157 | buildbucket.py | buildbucket.py | #!/usr/bin/env python
# Copyright (c) 2015 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.
"""Tool for interacting with Buildbucket.
Usage:
$ depot-tools-auth login https://cr-buildbucket.appspot.com
$ buildbucket.py ... | Add script for triggering Buildbucket builds | Add script for triggering Buildbucket builds
BUG=493885
TESTED=See https://paste.googleplex.com/5622248052359168
Review URL: https://codereview.chromium.org/1164363003
git-svn-id: fd409f4bdeea2bb50a5d34bb4d4bfc2046a5a3dd@295569 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | duongbaoduy/gtools,mlufei/depot_tools,aleonliao/depot_tools,azunite/chrome_build,azunite/chrome_build,disigma/depot_tools,hsharsha/depot_tools,chinmaygarde/depot_tools,kaiix/depot_tools,fracting/depot_tools,disigma/depot_tools,fracting/depot_tools,mlufei/depot_tools,aleonliao/depot_tools,ajohnson23/depot_tools,mlufei/d... | ---
+++
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+# Copyright (c) 2015 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.
+
+"""Tool for interacting with Buildbucket.
+
+Usage:
+ $ depot-tools-auth login https://cr-buildb... | |
d49b23365a972931502329f47a3aa65b9170477e | openstack/common/middleware/catch_errors.py | openstack/common/middleware/catch_errors.py | # Copyright (c) 2013 NEC Corporation
# 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 requi... | # Copyright (c) 2013 NEC Corporation
# 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 requi... | Update oslo log messages with translation domains | Update oslo log messages with translation domains
Update the incubator code to use different domains for log
messages at different levels.
Update the import exceptions setting for hacking to allow
multiple functions to be imported from gettextutils on one
line.
bp log-messages-translation-domain
Change-Id: I6ce0f4a... | Python | apache-2.0 | varunarya10/oslo.middleware,openstack/oslo.middleware,chungg/oslo.middleware,JioCloud/oslo.middleware | ---
+++
@@ -22,7 +22,7 @@
import webob.dec
import webob.exc
-from openstack.common.gettextutils import _ # noqa
+from openstack.common.gettextutils import _LE
from openstack.common import log as logging
from openstack.common.middleware import base
@@ -37,7 +37,7 @@
try:
response = req.g... |
0cbce0ddc139dde1367155398d0c6a186408fab3 | hug/test.py | hug/test.py | from falcon.testing import StartResponseMock, create_environ
from falcon import HTTP_METHODS
from urllib.parse import urlencode
import json
from hug.run import server
from functools import partial
def call(method, api_module, url, body='', headers=None, **params):
api = server(api_module)
response = StartResp... | from falcon.testing import StartResponseMock, create_environ
from falcon import HTTP_METHODS
from urllib.parse import urlencode
import json
from hug.run import server
from functools import partial
def call(method, api_module, url, body='', headers=None, **params):
api = server(api_module)
response = StartResp... | Update call method to return entire response object, and work with non json data | Update call method to return entire response object, and work with non json data
| Python | mit | shaunstanislaus/hug,janusnic/hug,origingod/hug,shaunstanislaus/hug,giserh/hug,yasoob/hug,timothycrosley/hug,timothycrosley/hug,philiptzou/hug,alisaifee/hug,yasoob/hug,jean/hug,MuhammadAlkarouri/hug,gbn972/hug,giserh/hug,gbn972/hug,alisaifee/hug,MuhammadAlkarouri/hug,STANAPO/hug,janusnic/hug,jean/hug,origingod/hug,STANA... | ---
+++
@@ -9,11 +9,14 @@
def call(method, api_module, url, body='', headers=None, **params):
api = server(api_module)
response = StartResponseMock()
- result = api(create_environ(path=url, method=method, headers=headers, query_string=urlencode(params)), response)
+ result = api(create_environ(path=u... |
e388f4c982d629da12f59626440d0d88e940db8d | hug/this.py | hug/this.py | """hug/this.py.
The Zen of Hug
Copyright (C) 2019 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy... | Add initial Zen of Hug to satisfy HOPE-20 | Add initial Zen of Hug to satisfy HOPE-20
| Python | mit | timothycrosley/hug,timothycrosley/hug,timothycrosley/hug | ---
+++
@@ -0,0 +1,45 @@
+"""hug/this.py.
+
+The Zen of Hug
+
+Copyright (C) 2019 Timothy Edmund Crosley
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the Software without restriction, including without... | |
11f16de1876e76b3c52494397d5613aa80530736 | sidewinder/streaming/map_and_reduce.py | sidewinder/streaming/map_and_reduce.py | #!/usr/bin/env python2.7
# coding=utf-8
LST = [4, 2, 3, 2, 1, 1, 5]
def map_reduce(lst):
"""
Map values and reduce based on key.
:param lst: list of values.
:return: map of values.
"""
dct = {}
for num in lst:
if num in dct:
print '{} key exists. updating value'.form... | Add map and recude example. | Add map and recude example.
| Python | mit | vsamov/sidewinder,vsamov/sidewinder,vsamov/sidewinder | ---
+++
@@ -0,0 +1,26 @@
+#!/usr/bin/env python2.7
+# coding=utf-8
+
+LST = [4, 2, 3, 2, 1, 1, 5]
+
+
+def map_reduce(lst):
+ """
+ Map values and reduce based on key.
+
+ :param lst: list of values.
+ :return: map of values.
+ """
+
+ dct = {}
+ for num in lst:
+ if num in dct:
+ ... | |
f8d86e2339102232fe31aa4828f22a4338f803a0 | src/poliastro/tests/test_frames.py | src/poliastro/tests/test_frames.py | import pytest
from astropy import units as u
from astropy.coordinates import (
CartesianRepresentation,
get_body_barycentric, solar_system_ephemeris
)
from astropy.tests.helper import assert_quantity_allclose
from poliastro.constants import J2000
from poliastro.bodies import (
Sun, Mercury, Venus, Earth, ... | Add tests for ICRS frames | Add tests for ICRS frames
| Python | mit | Juanlu001/poliastro,poliastro/poliastro,newlawrence/poliastro,Juanlu001/poliastro,Juanlu001/poliastro,newlawrence/poliastro,newlawrence/poliastro | ---
+++
@@ -0,0 +1,62 @@
+import pytest
+
+from astropy import units as u
+from astropy.coordinates import (
+ CartesianRepresentation,
+ get_body_barycentric, solar_system_ephemeris
+)
+from astropy.tests.helper import assert_quantity_allclose
+
+from poliastro.constants import J2000
+from poliastro.bodies imp... | |
2648944859e4b727855eb31eb337f0d27258b472 | iatidq/dqpublishercondition.py | iatidq/dqpublishercondition.py |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | Move database functions out to iatidq | Move database functions out to iatidq
| Python | agpl-3.0 | pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality | ---
+++
@@ -0,0 +1,76 @@
+
+# IATI Data Quality, tools for Data QA on IATI-formatted publications
+# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
+#
+# Copyright (C) 2013 Publish What You Fund
+#
+# This programme is free software; you may redistribute and/or modify
+# it under the terms of the G... | |
18dfdce4307e0f678f9a46fa4bccb51e31c4ff69 | red.py | red.py | from logipy import logi_led
import time
import ctypes
logi_led.logi_led_init()
time.sleep(1) # Give the SDK a second to initialize
logi_led.logi_led_set_lighting(100, 0, 0)
logi_led.logi_led_shutdown()
| Add simple script from the logipy page | Add simple script from the logipy page
| Python | mit | louismerlin/keyboard-games,louismerlin/keyboard-games | ---
+++
@@ -0,0 +1,9 @@
+from logipy import logi_led
+import time
+import ctypes
+
+logi_led.logi_led_init()
+time.sleep(1) # Give the SDK a second to initialize
+logi_led.logi_led_set_lighting(100, 0, 0)
+logi_led.logi_led_shutdown()
+ | |
190dae03cc027e397c387294075e1a38ad8647da | migrations/versions/2017-07-14_11:37:46__df33f3613823.py | migrations/versions/2017-07-14_11:37:46__df33f3613823.py | """empty message
Revision ID: df33f3613823
Revises: 15741cc426db
Create Date: 2017-07-14 11:37:46.347709
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'df33f3613823'
down_revision = '15741cc426db'
branch_labels = None
depends_on = None
def upgrade():
# ... | Add migration for patient model | :rocket: Add migration for patient model
| Python | mit | gems-uff/labsys,gems-uff/labsys,gems-uff/labsys | ---
+++
@@ -0,0 +1,36 @@
+"""empty message
+
+Revision ID: df33f3613823
+Revises: 15741cc426db
+Create Date: 2017-07-14 11:37:46.347709
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'df33f3613823'
+down_revision = '15741cc426db'
+branch_labels = None... | |
3aa10577f292a2962f66926fb021ed4a1b6fc493 | lib/header/colors.py | lib/header/colors.py | """ANSI escape sequence objects.
This is designed to place ANSI escape sequences in format strings.
Colors and attributes are selected by using object attributes in
format strings.
For example,
'{0.red}Hello, {0.green}World!{0.reset}'.format(colors())
This prints "Hello, " in red, and "World" in green, and rese... | Add ANSI escape sequence library | Add ANSI escape sequence library
| Python | bsd-2-clause | depp/headerfix,depp/headerfix,depp/headerfix,depp/headerfix | ---
+++
@@ -0,0 +1,88 @@
+"""ANSI escape sequence objects.
+
+This is designed to place ANSI escape sequences in format strings.
+Colors and attributes are selected by using object attributes in
+format strings.
+
+For example,
+
+ '{0.red}Hello, {0.green}World!{0.reset}'.format(colors())
+
+This prints "Hello, " ... | |
6ac16fc33a6f887535a143cc7155c7ff910ca835 | control/utils.py | control/utils.py | import csv
from datetime import datetime
import itertools
from django.http import StreamingHttpResponse
from django_object_actions import DjangoObjectActions
class Echo(object):
'''An object that implements just the write method of the file-like
interface.'''
def write(self, value):
'''Write the ... | Add django admin mixin for exporting csvs | Add django admin mixin for exporting csvs
| Python | bsd-3-clause | praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control | ---
+++
@@ -0,0 +1,48 @@
+import csv
+from datetime import datetime
+import itertools
+
+from django.http import StreamingHttpResponse
+from django_object_actions import DjangoObjectActions
+
+
+class Echo(object):
+ '''An object that implements just the write method of the file-like
+ interface.'''
+ def wr... | |
e107e3b47f015523861bafaab5cacce7deff6366 | Lib/test/crashers/multithreaded_close.py | Lib/test/crashers/multithreaded_close.py | # f.close() is not thread-safe: calling it at the same time as another
# operation (or another close) on the same file, but done from another
# thread, causes crashes. The issue is more complicated than it seems,
# witness the discussions in:
#
# http://bugs.python.org/issue595601
# http://bugs.python.org/issue815646
... | Add a crasher for the long-standing issue with closing a file while another thread uses it. | Add a crasher for the long-standing issue with closing a file
while another thread uses it.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | ---
+++
@@ -0,0 +1,14 @@
+# f.close() is not thread-safe: calling it at the same time as another
+# operation (or another close) on the same file, but done from another
+# thread, causes crashes. The issue is more complicated than it seems,
+# witness the discussions in:
+#
+# http://bugs.python.org/issue595601
+# h... | |
c7a4ffbbb2023ebfb470ad79dd8b0d8217af0ff7 | pyecore/utils.py | pyecore/utils.py | """
This module gathers utility classes and functions that can ease metamodel and
model manipulation.
"""
from .ecore import EPackage, BadValueError
from .notification import EObserver, Kind
class DynamicEPackage(EObserver):
"""A DynamicEPackage gives the ability to directly handle metaclasses
from a metamode... | Add new class to ease dynamic metamodel handling | Add new class to ease dynamic metamodel handling
The dynamic metamodel manipulation is a little bit cumbersome when it
comes to extract all the existing EClass from a loaded
EPackage. Currently, a solution is to gather all the elements by hand
in dedicated variables:
>>> A = dynamic_epackage.getEClassifier('A')
>>> B... | Python | bsd-3-clause | aranega/pyecore,pyecore/pyecore | ---
+++
@@ -0,0 +1,48 @@
+"""
+This module gathers utility classes and functions that can ease metamodel and
+model manipulation.
+"""
+from .ecore import EPackage, BadValueError
+from .notification import EObserver, Kind
+
+
+class DynamicEPackage(EObserver):
+ """A DynamicEPackage gives the ability to directly h... | |
68b17dc4fa6cdf1c04922d9d4fae77252b6712cd | theanets/__init__.py | theanets/__init__.py | '''This package groups together a bunch of theano code for neural nets.'''
from .feedforward import Autoencoder, Regressor, Classifier
from .graph import Network
from .main import Experiment
from . import layers
from . import recurrent
from . import trainer
__version__ = '0.6.0pre'
| '''This package groups together a bunch of theano code for neural nets.'''
from .feedforward import Autoencoder, Regressor, Classifier
from .graph import Network
from .main import Experiment
from . import layers
from . import recurrent
from . import trainer
__version__ = '0.7.0pre'
| Fix package version for git master. | Fix package version for git master. [ci skip]
| Python | mit | chrinide/theanets,lmjohns3/theanets,devdoer/theanets | ---
+++
@@ -8,4 +8,4 @@
from . import recurrent
from . import trainer
-__version__ = '0.6.0pre'
+__version__ = '0.7.0pre' |
22cfab045c15685f18baa8fc5d8b1b9036888f41 | scrapi/harvesters/cambridge.py | scrapi/harvesters/cambridge.py | '''
Harvester for the DSpace at Cambridge (production) for the SHARE project
Example API call: https://www.repository.cam.ac.uk/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class CambridgeHarvester(OAIHarvester):
short_name =... | Add harvester for the University of Cambridge | Add harvester for the University of Cambridge
Closes [#SHARE-103]
| Python | apache-2.0 | fabianvf/scrapi,fabianvf/scrapi,felliott/scrapi,erinspace/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi | ---
+++
@@ -0,0 +1,18 @@
+'''
+Harvester for the DSpace at Cambridge (production) for the SHARE project
+
+Example API call: https://www.repository.cam.ac.uk/oai/request?verb=ListRecords&metadataPrefix=oai_dc
+'''
+from __future__ import unicode_literals
+
+from scrapi.base import OAIHarvester
+
+
+class CambridgeHar... | |
911edb36fa6810dba3264dc3ba40648aeb9d436f | sv-comp-run.py | sv-comp-run.py | #!/usr/bin/python3
import sys
import glob
import subprocess
import re
import collections
import os.path
def str2bool(s):
return {
"true": True,
"false": False
}[s]
def extract_bool(p, s):
m = re.search(p, s)
return str2bool(m.group(1)) if m else None
set_filename = sys.argv[1]
with ... | Add own SV-COMP unreach-call set runner script | Add own SV-COMP unreach-call set runner script
| Python | mit | goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/python3
+
+import sys
+import glob
+import subprocess
+import re
+import collections
+import os.path
+
+
+def str2bool(s):
+ return {
+ "true": True,
+ "false": False
+ }[s]
+
+def extract_bool(p, s):
+ m = re.search(p, s)
+ return str2bool(m.group(1)) if... | |
473ad12b2d77b00073c3712e8d7593d290976248 | technician_tests/test_timeout.py | technician_tests/test_timeout.py | # vim:ai:et:ff=unix:fileencoding=utf-8:sw=4:ts=4:
from __future__ import (absolute_import, print_function, unicode_literals)
try:
import unittest2 as unittest
except ImportError:
import unittest
import makerbot_driver
class TimeoutTest(unittest.TestCase):
def test_timeout(self):
'''Test that the... | Add technicial test for serial port timeouts. | Add technicial test for serial port timeouts.
| Python | agpl-3.0 | makerbot/s3g,Jnesselr/s3g,makerbot/s3g,makerbot/s3g,Jnesselr/s3g,makerbot/s3g | ---
+++
@@ -0,0 +1,24 @@
+# vim:ai:et:ff=unix:fileencoding=utf-8:sw=4:ts=4:
+
+from __future__ import (absolute_import, print_function, unicode_literals)
+
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+
+import makerbot_driver
+
+class TimeoutTest(unittest.TestCase):
+ def test... | |
413295160d16c99f72ed37794cc823eccdb5676f | test/test_panels/test_checker.py | test/test_panels/test_checker.py | from pyqode.core import modes
from pyqode.core import panels
from pyqode.core.api import TextHelper
from pyqode.core.qt import QtCore
from pyqode.core.qt.QtTest import QTest
from test.helpers import editor_open
def get_panel(editor):
return editor.panels.get(panels.CheckerPanel)
def get_mode(editor):
try:
... | Add basic tests for checker panel (improve coverage) | Add basic tests for checker panel (improve coverage)
| Python | mit | zwadar/pyqode.core,pyQode/pyqode.core,pyQode/pyqode.core | ---
+++
@@ -0,0 +1,63 @@
+from pyqode.core import modes
+from pyqode.core import panels
+from pyqode.core.api import TextHelper
+from pyqode.core.qt import QtCore
+from pyqode.core.qt.QtTest import QTest
+from test.helpers import editor_open
+
+
+def get_panel(editor):
+ return editor.panels.get(panels.CheckerPane... | |
d0008f639a12c384d6d9faa58e6370d834bef2de | cms/migrations_django/0002_auto_20140807_2306.py | cms/migrations_django/0002_auto_20140807_2306.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='placeholder',
name='slot'... | Add django 1.7 migration for modified slot length | Add django 1.7 migration for modified slot length
| Python | bsd-3-clause | cyberintruder/django-cms,nostalgiaz/django-cms,keimlink/django-cms,jeffreylu9/django-cms,wuzhihui1123/django-cms,frnhr/django-cms,SachaMPS/django-cms,kk9599/django-cms,sznekol/django-cms,vstoykov/django-cms,donce/django-cms,bittner/django-cms,stefanw/django-cms,takeshineshiro/django-cms,Vegasvikk/django-cms,benzkji/dja... | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('cms', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_n... | |
c4cad482f38fb4dca00d00d8374833268dbc4545 | testing/test_change_directory.py | testing/test_change_directory.py | import sys
import os
sys.path.insert(0, os.path.realpath('.'))
import pytest
from create_movie import change_directory
def test_change_directory_existing_directory(tmpdir):
newdir = tmpdir.mkdir('subdir')
with change_directory(str(newdir)):
assert os.getcwd() == os.path.realpath(str(newdir))
asse... | Add tests for change directory | Add tests for change directory
| Python | mit | NGTS/frame-movies,NGTS/frame-movies | ---
+++
@@ -0,0 +1,22 @@
+import sys
+import os
+sys.path.insert(0, os.path.realpath('.'))
+import pytest
+
+from create_movie import change_directory
+
+
+def test_change_directory_existing_directory(tmpdir):
+ newdir = tmpdir.mkdir('subdir')
+ with change_directory(str(newdir)):
+ assert os.getcwd() ==... | |
304c6cf5314ae3050ca5f47d341323c03e75aea6 | actions/cloudbolt_plugins/multi_user_approval/multi_group_approval.py | actions/cloudbolt_plugins/multi_user_approval/multi_group_approval.py | """
Multiple Group Approval
~~~~~~~~~~~~~~~~~~~~~~~
Overrides CloudBolt's standard Order Approval workflow. This Orchestration
Action requires users from two separate Groups approve an Order before it
becomes Active.
Configuration
~~~~~~~~~~~~~
If the user that submitted this Order belongs to Group_A, this plugin req... | Add Multiple Group Approval Orch Action | Add Multiple Group Approval Orch Action
[DEV-12140]
| Python | apache-2.0 | CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge | ---
+++
@@ -0,0 +1,34 @@
+"""
+Multiple Group Approval
+~~~~~~~~~~~~~~~~~~~~~~~
+Overrides CloudBolt's standard Order Approval workflow. This Orchestration
+Action requires users from two separate Groups approve an Order before it
+becomes Active.
+
+
+Configuration
+~~~~~~~~~~~~~
+If the user that submitted this Ord... | |
09f077b5bc78d5fe382fdb1b3317ee68b0f619b5 | streamz/dataframe/tests/test_dataframe_utils.py | streamz/dataframe/tests/test_dataframe_utils.py | import pytest
from streamz.dataframe.utils import is_dataframe_like, is_series_like, is_index_like, get_base_frame_type
import pandas as pd
import numpy as np
def test_utils_is_dataframe_like():
test_utils_dataframe = pytest.importorskip('dask.dataframe.tests.test_utils_dataframe')
test_utils_dataframe.test_... | Add tests for dataframe utils | Add tests for dataframe utils
| Python | bsd-3-clause | mrocklin/streams | ---
+++
@@ -0,0 +1,59 @@
+import pytest
+from streamz.dataframe.utils import is_dataframe_like, is_series_like, is_index_like, get_base_frame_type
+
+import pandas as pd
+import numpy as np
+
+
+def test_utils_is_dataframe_like():
+ test_utils_dataframe = pytest.importorskip('dask.dataframe.tests.test_utils_datafr... | |
b212d7391c07457ed23a499d6fd113e08f173999 | Algebra_Geometry/2d_homework.py | Algebra_Geometry/2d_homework.py | #!/usr/bin/python
import os
import numpy as np
import math
print "This script solves the excercises propossed in the Linear Algebra & 2D Geometry Lectures"
# --------------------------------------------------------------------------------------------------
# Length and Normalized Vector
v = np.array([4, 8, -4])
len_... | Add resolution for the 2dGeometry Homework | Add resolution for the 2dGeometry Homework
| Python | mit | nachovizzo/AUTONAVx,nachovizzo/AUTONAVx,nachovizzo/AUTONAVx | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+import os
+import numpy as np
+import math
+
+print "This script solves the excercises propossed in the Linear Algebra & 2D Geometry Lectures"
+
+# --------------------------------------------------------------------------------------------------
+# Length and Normalized... | |
8a797d3abd43a96df1d4dab8ae52cc21da3930a4 | compatibility_server/loadtest/locustfile.py | compatibility_server/loadtest/locustfile.py | # Copyright 2019 Google LLC
#
# 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, s... | Create a simple load test skeleton | Create a simple load test skeleton
| Python | apache-2.0 | GoogleCloudPlatform/cloud-opensource-python,GoogleCloudPlatform/cloud-opensource-python,GoogleCloudPlatform/cloud-opensource-python,GoogleCloudPlatform/cloud-opensource-python | ---
+++
@@ -0,0 +1,84 @@
+# Copyright 2019 Google LLC
+#
+# 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 appli... | |
55a0797aa70ef91ce1ad9d29f313fa58a1db761d | read_forms.py | read_forms.py | import csv
import argparse
import itertools
from thermo_utils import csv_row_writer, read_csv_rows
# Read input/output arguments
parser = argparse.ArgumentParser()
parser.add_argument('-ip','--inputpoints',required=True)
parser.add_argument('-ie','--inputeqns',required=True)
parser.add_argument('-v','--version',requi... | Create file to read in parameter vectors from user forms | Create file to read in parameter vectors from user forms
| Python | mit | ndebuhr/thermo-state-solver,ndebuhr/thermo-state-solver | ---
+++
@@ -0,0 +1,41 @@
+import csv
+import argparse
+import itertools
+
+from thermo_utils import csv_row_writer, read_csv_rows
+
+# Read input/output arguments
+parser = argparse.ArgumentParser()
+parser.add_argument('-ip','--inputpoints',required=True)
+parser.add_argument('-ie','--inputeqns',required=True)
+pars... | |
1a5806d2a69553d9116836cbc8819ac60756e462 | test_files_by_user.py | test_files_by_user.py | import random
from dmp import dmp
users = ["adam", "ben", "chris", "denis", "eric"]
da = dmp()
for u in users:
results = da.get_files_by_user(u)
print u, len(results)
| Test script for requesting by user | Test script for requesting by user
| Python | apache-2.0 | Multiscale-Genomics/mg-dm-api,Multiscale-Genomics/mg-dm-api | ---
+++
@@ -0,0 +1,11 @@
+import random
+
+from dmp import dmp
+
+users = ["adam", "ben", "chris", "denis", "eric"]
+
+da = dmp()
+
+for u in users:
+ results = da.get_files_by_user(u)
+ print u, len(results) | |
99b7ff50e77483f7a2ec0d3ca99b9cc74d426edf | tests/handler_test.py | tests/handler_test.py | import requests
from fixtures import test_server
def test(test_server):
response = requests.get(test_server('/'))
assert response.status_code == 200
json = response.json()
assert 'status' in json
assert json['status'] == 'ok'
| Add test for the Handler | Add test for the Handler
| Python | mit | piotrekw/tornado-pytest | ---
+++
@@ -0,0 +1,12 @@
+import requests
+
+from fixtures import test_server
+
+
+def test(test_server):
+ response = requests.get(test_server('/'))
+ assert response.status_code == 200
+
+ json = response.json()
+ assert 'status' in json
+ assert json['status'] == 'ok' | |
4473354da6d029964258996067adbd97eb06baa8 | py/degree-of-an-array.py | py/degree-of-an-array.py | from collections import Counter
class Solution(object):
def findShortestSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
first = dict()
last = dict()
c = Counter()
m = 0
possible_values = []
for i, v in enumerate(nums):
... | Add py solution for 697. Degree of an Array | Add py solution for 697. Degree of an Array
697. Degree of an Array: https://leetcode.com/problems/degree-of-an-array/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,23 @@
+from collections import Counter
+class Solution(object):
+ def findShortestSubArray(self, nums):
+ """
+ :type nums: List[int]
+ :rtype: int
+ """
+ first = dict()
+ last = dict()
+ c = Counter()
+ m = 0
+ possible_values = []... | |
35aafe82f73c32e2d3db76d2fb3b988a3c4ade01 | tests/test_project.py | tests/test_project.py | # Copyright 2015 0xc0170
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | Test project - basic template for project to be tested | Test project - basic template for project to be tested
| Python | apache-2.0 | sarahmarshy/project_generator,molejar/project_generator,hwfwgrp/project_generator,0xc0170/project_generator,project-generator/project_generator,ohagendorf/project_generator | ---
+++
@@ -0,0 +1,66 @@
+# Copyright 2015 0xc0170
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicab... | |
49539431d0e4172c5ce83c20f436b58e41d0fa02 | heavy-ion-luminosity.py | heavy-ion-luminosity.py | __author__ = 'jacob'
import ROOT
import numpy as np
import os
from root_numpy import root2array, root2rec, tree2rec
# Look at r284484 data
filename = os.path.join("data", "r284484.root")
# Convert a TTree in a ROOT file into a NumPy structured array
arr = root2array(filename)
for element in arr:
print(element)
... | Add getting data from .root file into Numpy | Add getting data from .root file into Numpy
| Python | mit | jacobbieker/ATLAS-Luminosity | ---
+++
@@ -0,0 +1,22 @@
+__author__ = 'jacob'
+import ROOT
+import numpy as np
+import os
+from root_numpy import root2array, root2rec, tree2rec
+
+# Look at r284484 data
+
+filename = os.path.join("data", "r284484.root")
+
+# Convert a TTree in a ROOT file into a NumPy structured array
+arr = root2array(filename)
+... | |
504930ad343c074d34d4e4ac1774d909d11a5a63 | tests/functional/test_admin.py | tests/functional/test_admin.py | from django.contrib.auth.models import User
from django.conf import settings
from website.models import Db
from .testcases import TestCase
def make_default_db():
db = settings.DATABASES['default']
return Db.objects.create(
name_short="default",
name_long="default",
type="MySQL",
... | Add admin test for adding a query | Add admin test for adding a query
| Python | mit | sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz,sqlviz/sqlviz | ---
+++
@@ -0,0 +1,66 @@
+from django.contrib.auth.models import User
+from django.conf import settings
+
+from website.models import Db
+
+from .testcases import TestCase
+
+
+def make_default_db():
+ db = settings.DATABASES['default']
+ return Db.objects.create(
+ name_short="default",
+ name_lo... | |
d9b3d312543268d4305b102d5f28bd7446e00da8 | tests/test_emit_movie_queue.py | tests/test_emit_movie_queue.py | from __future__ import unicode_literals, division, absolute_import
from datetime import timedelta, datetime
from flexget.manager import Session
from flexget.plugins.filter.movie_queue import queue_add, QueuedMovie
from tests import FlexGetBase
def age_last_emit(**kwargs):
session = Session()
for item in sess... | Add some unit tests for emit_movie_queue | Add some unit tests for emit_movie_queue
| Python | mit | antivirtel/Flexget,crawln45/Flexget,sean797/Flexget,LynxyssCZ/Flexget,tsnoam/Flexget,drwyrm/Flexget,tsnoam/Flexget,sean797/Flexget,offbyone/Flexget,qvazzler/Flexget,crawln45/Flexget,ianstalk/Flexget,Danfocus/Flexget,grrr2/Flexget,jacobmetrick/Flexget,vfrc2/Flexget,JorisDeRieck/Flexget,malkavi/Flexget,qk4l/Flexget,vfrc2... | ---
+++
@@ -0,0 +1,46 @@
+from __future__ import unicode_literals, division, absolute_import
+from datetime import timedelta, datetime
+
+from flexget.manager import Session
+from flexget.plugins.filter.movie_queue import queue_add, QueuedMovie
+from tests import FlexGetBase
+
+
+def age_last_emit(**kwargs):
+ ses... | |
b064392b2e357bb5725c61f6a07389290954e411 | user_test.py | user_test.py | #!/usr/bin/env python
try:
import sympy
except ImportError:
print("sympy is required")
else:
if sympy.__version__ < '0.7.5':
print("SymPy version 0.7.5 or newer is required. You have", sympy.__version__)
if sympy.__version__ != '0.7.5':
print("The stable SymPy version 0.7.5 is recomme... | Add a user test script | Add a user test script
| Python | bsd-3-clause | asmeurer/scipy-2014-tutorial,Sumith1896/scipy-2014-tutorial,leosartaj/scipy-2016-tutorial,aktech/scipy-2016-tutorial,Shekharrajak/scipy-2014-tutorial | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+try:
+ import sympy
+except ImportError:
+ print("sympy is required")
+else:
+
+ if sympy.__version__ < '0.7.5':
+ print("SymPy version 0.7.5 or newer is required. You have", sympy.__version__)
+
+ if sympy.__version__ != '0.7.5':
+ print("T... | |
ab5c755f0e8aec37e284a0a2c4eacbb2892f5b11 | jupyter_notebook_config.partial.py | jupyter_notebook_config.partial.py | # Configuration file for Jupyter-notebook.
# https://github.com/jupyter/docker-demo-images/blob/master/resources/jupyter_notebook_config.partial.py
#c = get_config()
#c.NotebookApp.ip = '*'
#c.NotebookApp.open_browser = False
#c.NotebookApp.port = 8888 #9999
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-... | Add extra notebook config to append to base-notebook config | Add extra notebook config to append to base-notebook config
| Python | bsd-3-clause | ProjectPyRhO/Prometheus,ProjectPyRhO/Prometheus,ProjectPyRhO/Prometheus,ProjectPyRhO/Prometheus | ---
+++
@@ -0,0 +1,37 @@
+# Configuration file for Jupyter-notebook.
+# https://github.com/jupyter/docker-demo-images/blob/master/resources/jupyter_notebook_config.partial.py
+
+#c = get_config()
+#c.NotebookApp.ip = '*'
+#c.NotebookApp.open_browser = False
+#c.NotebookApp.port = 8888 #9999
+
+# Whether to trust or n... | |
488c0bc477920b7be419f1bfa85be1cbda661db2 | examples/SteinerTripleSystems.py | examples/SteinerTripleSystems.py | # Steiner Triple Systems
# The ternary Steiner problem of order n consists of finding a set of n(n-1)/6
# triples of distinct integer elements in {1,...,n} such that any two triples
# have at most one common element. It is a hypergraph problem coming from
# combinatorial mathematics where n modulo 6 has to be equ... | Add example model of Steiner Triple Systems | Add example model of Steiner Triple Systems
| Python | lgpl-2.1 | eomahony/Numberjack,eomahony/Numberjack,eomahony/Numberjack,eomahony/Numberjack,eomahony/Numberjack | ---
+++
@@ -0,0 +1,57 @@
+# Steiner Triple Systems
+
+# The ternary Steiner problem of order n consists of finding a set of n(n-1)/6
+# triples of distinct integer elements in {1,...,n} such that any two triples
+# have at most one common element. It is a hypergraph problem coming from
+# combinatorial mathematics wh... | |
00f0ec1740109cc12815b9aaed88023cc91881fe | velruse/store/mongodb_store.py | velruse/store/mongodb_store.py | """MongoDB UserStore implementation"""
try:
import cPickle as pickle
except ImportError:
import pickle
import pymongo
from pymongo import Connection
from pymongo.errors import ConnectionFailure
from pymongo.binary import Binary
from pymongo.errors import OperationFailure
from velruse.store.interface import U... | Add in support for mongodb store. Add dependencies for pymongo/redis. | Add in support for mongodb store. Add dependencies for pymongo/redis.
| Python | mit | miedzinski/velruse,bbangert/velruse,bbangert/velruse,ImaginationForPeople/velruse,miedzinski/velruse,ImaginationForPeople/velruse | ---
+++
@@ -0,0 +1,72 @@
+"""MongoDB UserStore implementation"""
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
+
+import pymongo
+from pymongo import Connection
+from pymongo.errors import ConnectionFailure
+from pymongo.binary import Binary
+from pymongo.errors import OperationFailure... | |
70e4843ccb2dde8a1fa2b50dcfb10ae10c3c3d9a | utils/Layers.py | utils/Layers.py | # Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Add 1D Transpose Convolution Implementation Official implementation of transpose 1d convolution is only available in nightly build at the moment | Add 1D Transpose Convolution Implementation
Official implementation of transpose 1d convolution is only
available in nightly build at the moment
| Python | apache-2.0 | googleinterns/audio_synthesis | ---
+++
@@ -0,0 +1,45 @@
+# Copyright 2020 Google LLC
+#
+# 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
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by appl... | |
ae2e437b5bdf5202d0fc38d8f0d2dbe41bd68b11 | sleep_wake_heatmap.py | sleep_wake_heatmap.py | import plotly as py
import plotly.graph_objs as go
import datetime
from sys import argv
import names
from csvparser import parse
data_file = argv[1]
raw_data = parse(data_file)
h = 12
w = len(raw_data)
start_time = 3
grid = [[0] * w for i in range(0, h)]
#def datetime_to_coords(dt):
# x = 0 # temp
# y = round((dt.h... | Add heatmap with working ish pseudocode | Add heatmap with working ish pseudocode
| Python | mit | f-jiang/sleep-pattern-grapher | ---
+++
@@ -0,0 +1,35 @@
+import plotly as py
+import plotly.graph_objs as go
+import datetime
+from sys import argv
+
+import names
+from csvparser import parse
+
+data_file = argv[1]
+raw_data = parse(data_file)
+
+h = 12
+w = len(raw_data)
+start_time = 3
+grid = [[0] * w for i in range(0, h)]
+
+#def datetime_to_... | |
da372725ea236b971829e4a07e4c18d7d094152c | api_tests/logs/views/test_log_embeds.py | api_tests/logs/views/test_log_embeds.py | from nose.tools import * # flake8: noqa
from api.base.settings.defaults import API_BASE
from tests.base import ApiTestCase
from tests.factories import (
ProjectFactory,
AuthUserFactory,
RegistrationFactory
)
class TestLogEmbeds(ApiTestCase):
def setUp(self):
super(TestLogEmbeds, self).setU... | Add tests for testing log embeds. | Add tests for testing log embeds.
| Python | apache-2.0 | alexschiller/osf.io,samchrisinger/osf.io,mattclark/osf.io,felliott/osf.io,saradbowman/osf.io,kwierman/osf.io,emetsger/osf.io,cslzchen/osf.io,leb2dg/osf.io,caneruguz/osf.io,caneruguz/osf.io,rdhyee/osf.io,zachjanicki/osf.io,saradbowman/osf.io,adlius/osf.io,doublebits/osf.io,SSJohns/osf.io,cwisecarver/osf.io,DanielSBrown/... | ---
+++
@@ -0,0 +1,56 @@
+from nose.tools import * # flake8: noqa
+
+from api.base.settings.defaults import API_BASE
+from tests.base import ApiTestCase
+from tests.factories import (
+ ProjectFactory,
+ AuthUserFactory,
+ RegistrationFactory
+)
+
+
+class TestLogEmbeds(ApiTestCase):
+
+
+ def setUp(self... | |
3ec610d7f24aec622e13284088622c7f98b454b1 | euler025.py | euler025.py | #!/usr/bin/python
from math import ceil, log10
PHI = 1.6180339887
x = 0
i = 0
while x < 1000:
i += 1
x = ceil(i * log10(PHI) - log10(5) / 2)
print(i, x)
print(i)
| Add solution for problem 25 | Add solution for problem 25
| Python | mit | cifvts/PyEuler | ---
+++
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+
+from math import ceil, log10
+
+PHI = 1.6180339887
+x = 0
+i = 0
+while x < 1000:
+ i += 1
+ x = ceil(i * log10(PHI) - log10(5) / 2)
+ print(i, x)
+
+print(i) | |
7ee1168509ecdef6ba6cc81faeb3b6c9674ddc67 | tests/test_S3.py | tests/test_S3.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from keyring.tests.test_backend import BackendBasicTests
from keyring.tests.py30compat import unittest
from s3keyring import S3
@unittest.skipUnless(S3.supported(),
"You need to configure the AWS credentials")
class S3PlaintextKeychainTestCase(Backen... | Add tests for the backend | Add tests for the backend
| Python | mit | InnovativeTravel/s3-keyring | ---
+++
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from keyring.tests.test_backend import BackendBasicTests
+from keyring.tests.py30compat import unittest
+from s3keyring import S3
+
+
+@unittest.skipUnless(S3.supported(),
+ "You need to configure the AWS credentials")
+cl... | |
7027680e509055503c86544193d9ff46530be3d3 | indra/databases/relevance_client.py | indra/databases/relevance_client.py | import logging
from indra.databases import ndex_client
logging = logging.getLogger('relevance')
ndex_relevance = 'http://general.bigmech.ndexbio.org:8080'
def get_heat_kernel(network_id):
"""Return the identifier of a heat kernel calculated for a given network.
Parameters
----------
network_id : str... | Add relevance client based on NDEx service | Add relevance client based on NDEx service
| Python | bsd-2-clause | jmuhlich/indra,pvtodorov/indra,bgyori/indra,pvtodorov/indra,bgyori/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/belpy,johnbachman/indra,jmuhlich/indra,sorgerlab/belpy,pvtodorov/indra,jmuhlich/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,johnbachman/belpy,pvtodorov/indra... | ---
+++
@@ -0,0 +1,60 @@
+import logging
+from indra.databases import ndex_client
+
+logging = logging.getLogger('relevance')
+
+ndex_relevance = 'http://general.bigmech.ndexbio.org:8080'
+
+def get_heat_kernel(network_id):
+ """Return the identifier of a heat kernel calculated for a given network.
+
+ Paramete... | |
a0fc417f9d5abbf19ff516590b6c5cdff849cb1e | get_pose.py | get_pose.py | import csv
def get_backup_pose(filename):
p = []
r = csv.DictReader(open(filename,'r'),delimiter = ';')
for row in r:
p.append(row)
a = {}
a['CSVPath'] = p[0]["CSVPath"]
a['cursor'] = int(p[0]["cursor"])
return a
def set_backup_pose(filename,dict):
f = open(filename,'w... | Test file for backup pose | Test file for backup pose
| Python | mit | ThotAlion/FIRE,ThotAlion/FIRE,ThotAlion/FIRE | ---
+++
@@ -0,0 +1,26 @@
+import csv
+
+def get_backup_pose(filename):
+ p = []
+ r = csv.DictReader(open(filename,'r'),delimiter = ';')
+ for row in r:
+ p.append(row)
+ a = {}
+ a['CSVPath'] = p[0]["CSVPath"]
+ a['cursor'] = int(p[0]["cursor"])
+
+ return a
+
+def set_backup_pose... | |
e7e4aaa2788edcb01f3e681bc557d4c7f5ae26e1 | calm-ingest/validate_data.py | calm-ingest/validate_data.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Checks for the validity of Calm data.
This script runs a series of checks over the Calm data, looking for problems
that should be corrected in the source data.
"""
import json
from utils import read_records
WARNINGS = {}
def check_record(records):
try:
... | Add a rough script for checking validity of Calm data | Add a rough script for checking validity of Calm data
| Python | mit | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+"""Checks for the validity of Calm data.
+
+This script runs a series of checks over the Calm data, looking for problems
+that should be corrected in the source data.
+
+"""
+
+import json
+
+from utils import read_records
+
+
+WARNINGS = {}
... | |
4886f21febbc6385e6aafb990163e69e31a5b99e | scripts/generate-guidebook-sponsor-logs.py | scripts/generate-guidebook-sponsor-logs.py | #!/usr/bin/env python3
import shlex
import subprocess
import sys
import zipfile
from os import makedirs
import frontmatter
import pandas as pd
# read in the custom list template
df_sponsors = pd.read_csv('Guidebook_CL_Template.csv')
rows = []
# create the directory that will store the resized sponsor logs
outdir ... | Add script to generate sponsor info for guidebook. | Add script to generate sponsor info for guidebook.
| Python | mit | acl2017/acl2017.github.io,acl2017/acl2017.github.io,acl2017/acl2017.github.io,acl2017/acl2017.github.io | ---
+++
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+
+import shlex
+import subprocess
+import sys
+import zipfile
+
+from os import makedirs
+
+import frontmatter
+
+import pandas as pd
+
+# read in the custom list template
+df_sponsors = pd.read_csv('Guidebook_CL_Template.csv')
+rows = []
+
+# create the directory tha... | |
167e7095c0a19d8139564280b3dc3e74791bf878 | cabarchive/cli.py | cabarchive/cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 Richard Hughes <richard@hughsie.com>
#
# SPDX-License-Identifier: LGPL-2.1+
#
# pylint: disable=wrong-import-position
import sys
import os
import argparse
sys.path.append(os.path.realpath("."))
from cabarchive import CabArchive
def main():
p... | Add a CLI test program | trivial: Add a CLI test program
| Python | lgpl-2.1 | hughsie/python-cabarchive | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020 Richard Hughes <richard@hughsie.com>
+#
+# SPDX-License-Identifier: LGPL-2.1+
+#
+# pylint: disable=wrong-import-position
+
+import sys
+import os
+import argparse
+
+sys.path.append(os.path.realpath("."))
+
+from cabarc... | |
5d0c7b7d209b0487c0a12e995a11efa9d695a50e | pq/management/commands/pqcreate.py | pq/management/commands/pqcreate.py | from django.core.management.base import BaseCommand
from optparse import make_option
from django.conf import settings
from pq.queue import PQ_DEFAULT_JOB_TIMEOUT
class Command(BaseCommand):
help = "Create a queue"
args = "<queue queue ...>"
option_list = BaseCommand.option_list + (
make_option... | Add a command to pre-create queues. | Add a command to pre-create queues.
| Python | bsd-2-clause | bretth/django-pq | ---
+++
@@ -0,0 +1,45 @@
+from django.core.management.base import BaseCommand
+from optparse import make_option
+
+from django.conf import settings
+
+from pq.queue import PQ_DEFAULT_JOB_TIMEOUT
+
+
+class Command(BaseCommand):
+ help = "Create a queue"
+ args = "<queue queue ...>"
+
+
+ option_list = BaseCo... | |
8a0ee09eec5f24152babfff3882a38ca749b3cc9 | solutions/uri/1029/1029.py | solutions/uri/1029/1029.py | from functools import lru_cache
fibs = [0] * 40
calls = [0] * 40
def fibonacci(n):
global fibs, calls
if n <= 1:
fibs[n] = n
calls[n] = 0
else:
if fibs[n] != 0:
return fibs[n]
fibs[n] = fibonacci(n - 1) + fibonacci(n - 2)
calls[n] = calls[n - 1] + call... | Solve Fibonacci, How Many Calls? in python | Solve Fibonacci, How Many Calls? in python
| Python | mit | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | ---
+++
@@ -0,0 +1,28 @@
+from functools import lru_cache
+
+fibs = [0] * 40
+calls = [0] * 40
+
+
+def fibonacci(n):
+ global fibs, calls
+
+ if n <= 1:
+ fibs[n] = n
+ calls[n] = 0
+ else:
+ if fibs[n] != 0:
+ return fibs[n]
+ fibs[n] = fibonacci(n - 1) + fibonacci(n ... | |
03afe1cc090bd48e07fd71616774dc4f05247bed | migrations/usernames.py | migrations/usernames.py | import re
import pymongo
from bhs_api import create_app
if __name__ == "__main__":
app, conf = create_app(testing=True)
app.testing = True
mongo = pymongo.MongoClient(app.config['MONGODB_HOST'])
user_db = mongo[conf.user_db_name]
is_english = re.compile('^[a-zA-Z]')
for i in user_db['user'].f... | Add migration script for users with names | Add migration script for users with names
If existing users have a name we need to change the name in the user db so it
becomes a dict like: {'en': 'Yossi Levy'} if the user name was `Yossi Levy`.
If the user name is in hebrew it will add ti with the 'he' key.
| Python | agpl-3.0 | Beit-Hatfutsot/dbs-back,Beit-Hatfutsot/dbs-back,Beit-Hatfutsot/dbs-back,Beit-Hatfutsot/dbs-back | ---
+++
@@ -0,0 +1,20 @@
+import re
+import pymongo
+from bhs_api import create_app
+
+if __name__ == "__main__":
+ app, conf = create_app(testing=True)
+ app.testing = True
+ mongo = pymongo.MongoClient(app.config['MONGODB_HOST'])
+ user_db = mongo[conf.user_db_name]
+
+ is_english = re.compile('^[a-z... | |
4754771eb50cb29722b3c7b5f9bca6dc30ef3157 | noodles/sources/eiti.py | noodles/sources/eiti.py | import logging
import urllib2
import csv
import os
import traceback
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import PDFPageInterpreter
from noodles.util import stage_path
from noodles.sources.common import Source
class EITISource(Source):
LABEL = 'EITI Country Reports'
URL = 'https://ei... | Add EITI country reports as sources | Add EITI country reports as sources
NB: you need to have pdftotext installed to run this
| Python | mit | uf6/noodles,uf6/noodles | ---
+++
@@ -0,0 +1,50 @@
+import logging
+import urllib2
+import csv
+import os
+import traceback
+
+from pdfminer.pdfpage import PDFPage
+from pdfminer.pdfinterp import PDFPageInterpreter
+
+from noodles.util import stage_path
+
+from noodles.sources.common import Source
+
+class EITISource(Source):
+
+ LABEL = '... | |
f7fb296395c4193dc2f2607d3be50cca280e86dc | tests/test_player.py | tests/test_player.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from db.player import Player
def test_find_by_id():
plr = Player.find_by_id(8459469)
assert plr.name == "Rory Fitzpatrick"
def test_name_property():
plr = Player.find_by_id(8459457)
assert plr.name == " ".join((plr.first_name, plr.last_name))
| Add initial test script for player objects | Add initial test script for player objects
| Python | mit | leaffan/pynhldb | ---
+++
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from db.player import Player
+
+
+def test_find_by_id():
+ plr = Player.find_by_id(8459469)
+ assert plr.name == "Rory Fitzpatrick"
+
+
+def test_name_property():
+ plr = Player.find_by_id(8459457)
+ assert plr.name == " ".join((p... | |
2afdec4acc893628cba7179e52ca0bbb0207c49a | jsontest.py | jsontest.py | import json
from collections import OrderedDict
import netCDF4
import readNetCDF as rnc
import numpy as np
import util
from netCDF4 import Dataset
json_path = 'json_output_test.json'
nc_file = 'foam_2011-01-01.nc'
domain_type = "Grid" # Default
dset = rnc.load_netcdf(nc_file)
print(rnc.get_var_names(dset))
######... | Test nc -> covJSON v0.1 | Test nc -> covJSON v0.1
| Python | bsd-3-clause | Reading-eScience-Centre/pycovjson | ---
+++
@@ -0,0 +1,79 @@
+import json
+from collections import OrderedDict
+import netCDF4
+import readNetCDF as rnc
+import numpy as np
+
+import util
+
+from netCDF4 import Dataset
+json_path = 'json_output_test.json'
+
+nc_file = 'foam_2011-01-01.nc'
+
+domain_type = "Grid" # Default
+
+dset = rnc.load_netcdf(nc_f... | |
22ae8b04443c13a1c5e9a25a93c2c52faa996b95 | CodeFights/lateRide.py | CodeFights/lateRide.py | #!/usr/local/bin/python
# Code Fights Late Ride Problem
def lateRide(n):
h, m = divmod(n, 60)
return sum(map(int, str(h) + str(m)))
def main():
tests = [
[240, 4],
[808, 14],
[1439, 19],
[0, 0],
[23, 5],
[8, 8]
]
for t in tests:
res = late... | Solve Code Fights late ride problem | Solve Code Fights late ride problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/local/bin/python
+# Code Fights Late Ride Problem
+
+
+def lateRide(n):
+ h, m = divmod(n, 60)
+ return sum(map(int, str(h) + str(m)))
+
+
+def main():
+ tests = [
+ [240, 4],
+ [808, 14],
+ [1439, 19],
+ [0, 0],
+ [23, 5],
+ [8, 8]
+... | |
3fabbc491a106175d61ffb6a2694501972c47141 | tools/pip-extract.py | tools/pip-extract.py | #!/usr/bin/env python
from distutils.version import LooseVersion
import os
import re
import sys
import yaml
if __name__ == '__main__':
fn = sys.argv[1]
with open(sys.argv[1], 'r') as fh:
lines = fh.readlines()
entries = set()
for line in lines:
line = line.strip()
if not li... | Add little tool to help extract yaml names+versions from pip-require files | Add little tool to help extract yaml names+versions from pip-require files
| Python | apache-2.0 | stackforge/anvil,mc2014/anvil,mc2014/anvil,stackforge/anvil | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+from distutils.version import LooseVersion
+
+import os
+import re
+import sys
+import yaml
+
+
+if __name__ == '__main__':
+
+ fn = sys.argv[1]
+ with open(sys.argv[1], 'r') as fh:
+ lines = fh.readlines()
+
+ entries = set()
+ for line in lines:
... | |
797ebb71721e067140a2437810cd4923b03af3fa | homework3/game.py | homework3/game.py | from collections import OrderedDict
from random import shuffle
MAX_CONFLICTS = [-1, {
'row': -1,
'column': -1,
'conflicts': [],
}]
def print_board(board):
"""Print board."""
b = ['_'] * len(board)
for queen, position in board.items():
b[position['row']] = ['_'] * len(board)
b... | Create board and find conflicts of the whole board | Create board and find conflicts of the whole board
| Python | mit | mileto94/Data-Mining | ---
+++
@@ -0,0 +1,72 @@
+from collections import OrderedDict
+from random import shuffle
+
+
+MAX_CONFLICTS = [-1, {
+ 'row': -1,
+ 'column': -1,
+ 'conflicts': [],
+}]
+
+
+def print_board(board):
+ """Print board."""
+ b = ['_'] * len(board)
+ for queen, position in board.items():
+ b[posi... | |
c1fcf18feaafab22f32bb755cae7920d0f09cbb9 | tests/grid_2d_canvas_test.py | tests/grid_2d_canvas_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Test case for 2D grid canvas.
"""
import unittest
from matplotlib.collections import PathCollection
from catplot.grid_components.grid_canvas import Grid2DCanvas
class Grid2DCanvasTest(unittest.TestCase):
def setUp(self):
self.maxDiff = True
def t... | Add 2d grid canvas construction test. | Add 2d grid canvas construction test.
| Python | mit | PytLab/catplot | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+""" Test case for 2D grid canvas.
+"""
+
+import unittest
+
+from matplotlib.collections import PathCollection
+
+from catplot.grid_components.grid_canvas import Grid2DCanvas
+
+
+class Grid2DCanvasTest(unittest.TestCase):
+
+ def setUp(se... | |
76817a379aff0dd6968df6a6163c635f7e7b53e3 | dynd/tests/test_ndobject_basics.py | dynd/tests/test_ndobject_basics.py | import sys
import unittest
from dynd import nd, ndt
class TestBasics(unittest.TestCase):
def test_index(self):
# Test that the __index__ method/nb_index slot
# in ndobject is working
a = [1, 2, 3, 4, 5, 6]
self.assertEqual(a[nd.ndobject(0)], 1)
self.assertEqual(a[nd.ndobject... | Add some tests for the __index__/nb_index slot in ndobject | Add some tests for the __index__/nb_index slot in ndobject
| Python | bsd-2-clause | izaid/dynd-python,ContinuumIO/dynd-python,cpcloud/dynd-python,mwiebe/dynd-python,mwiebe/dynd-python,insertinterestingnamehere/dynd-python,aterrel/dynd-python,michaelpacer/dynd-python,pombredanne/dynd-python,insertinterestingnamehere/dynd-python,pombredanne/dynd-python,pombredanne/dynd-python,insertinterestingnamehere/d... | ---
+++
@@ -0,0 +1,21 @@
+import sys
+import unittest
+from dynd import nd, ndt
+
+class TestBasics(unittest.TestCase):
+ def test_index(self):
+ # Test that the __index__ method/nb_index slot
+ # in ndobject is working
+ a = [1, 2, 3, 4, 5, 6]
+ self.assertEqual(a[nd.ndobject(0)], 1)
+... | |
e1ffb7b75ff4c1b4124b9af5bdd1b00230589129 | tests/test_connect.py | tests/test_connect.py | import asyncpg
from asyncpg import _testbase as tb
class TestConnect(tb.ConnectedTestCase):
async def test_connect_1(self):
with self.assertRaisesRegex(
Exception, 'role "__does_not_exist__" does not exist'):
await asyncpg.connect(user="__does_not_exist__", loop=self.loop)
| Add user, password, dbname to connect(); suport UNIX sockets | Add user, password, dbname to connect(); suport UNIX sockets
| Python | apache-2.0 | MagicStack/asyncpg,MagicStack/asyncpg | ---
+++
@@ -0,0 +1,11 @@
+import asyncpg
+
+from asyncpg import _testbase as tb
+
+
+class TestConnect(tb.ConnectedTestCase):
+
+ async def test_connect_1(self):
+ with self.assertRaisesRegex(
+ Exception, 'role "__does_not_exist__" does not exist'):
+ await asyncpg.connect(user="_... | |
75b3357617ebd8152ebf25abcb776a252ea7389d | tests/test_leonard.py | tests/test_leonard.py | """Test garner.dates."""
from __future__ import absolute_import
from __future__ import print_function
from .check import Check
from proselint.checks.typography import exclamation
class TestCheck(Check):
"""Test class for leonard.exclamation."""
__test__ = True
def test_capitalization_and_no_exclamation... | Add new test for exclamation.leonard | Add new test for exclamation.leonard
| Python | bsd-3-clause | amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint | ---
+++
@@ -0,0 +1,27 @@
+"""Test garner.dates."""
+from __future__ import absolute_import
+from __future__ import print_function
+
+from .check import Check
+from proselint.checks.typography import exclamation
+
+
+class TestCheck(Check):
+ """Test class for leonard.exclamation."""
+
+ __test__ = True
+
+ d... | |
9fb10d8d30fbdb08e46bea3996e75098dce904e5 | fabfile/testbeds/testbed_nodec3.py | fabfile/testbeds/testbed_nodec3.py | from fabric.api import env
host1 = 'root@10.204.216.60'
ext_routers = [('mx1', '10.204.216.253')]
router_asn = 64510
public_vn_rtgt = 10003
public_vn_subnet = "10.204.219.24/29"
host_build = 'vjoshi@10.204.216.56'
env.roledefs = {
'all': [host1],
'cfgm': [host1],
'openstack': [host1],
'control': [ho... | Add testbed file for tempest node | Add testbed file for tempest node
Change-Id: Idabe51a777aa73ff7a3fa94fc0f219ebd80686fc
| Python | apache-2.0 | Juniper/contrail-fabric-utils,Juniper/contrail-fabric-utils | ---
+++
@@ -0,0 +1,39 @@
+from fabric.api import env
+
+host1 = 'root@10.204.216.60'
+
+ext_routers = [('mx1', '10.204.216.253')]
+router_asn = 64510
+public_vn_rtgt = 10003
+public_vn_subnet = "10.204.219.24/29"
+
+host_build = 'vjoshi@10.204.216.56'
+
+env.roledefs = {
+ 'all': [host1],
+ 'cfgm': [host1],
+ ... | |
ec28288b924a6378b70de3192f962bf26cf5362b | fil_finder/tests/_testing_data.py | fil_finder/tests/_testing_data.py |
'''
Load in the testing data
'''
import os
from astropy.io import fits
from astropy.table import Table
dir_path = os.path.dirname(__file__)
path1 = os.path.join(dir_path, "testing_data/test1")
path2 = os.path.join(dir_path, "testing_data/test2")
img_path = os.path.join(dir_path, "testing_data")
# Load in the fits... | Load in the saved testing data | Load in the saved testing data
| Python | mit | dcolombo/FilFinder,e-koch/FilFinder,keflavich/fil_finder | ---
+++
@@ -0,0 +1,46 @@
+
+'''
+Load in the testing data
+'''
+
+import os
+from astropy.io import fits
+from astropy.table import Table
+
+dir_path = os.path.dirname(__file__)
+
+path1 = os.path.join(dir_path, "testing_data/test1")
+path2 = os.path.join(dir_path, "testing_data/test2")
+
+img_path = os.path.join(dir... | |
845b4fe3bf708d0434cb64d37a212bc0fd6b5ac6 | ci/testsettings.py | ci/testsettings.py | # minimal django settings required to run tests
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "test.db",
}
}
# SECRET_KEY = ''
| # minimal django settings required to run tests
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "test.db",
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django_cas_ng',
'pucas',
)
# SECRET_KEY = ''
| Add installed apps configuration to test settings | Add installed apps configuration to test settings
| Python | apache-2.0 | Princeton-CDH/django-pucas,Princeton-CDH/django-pucas | ---
+++
@@ -6,4 +6,11 @@
}
}
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django_cas_ng',
+ 'pucas',
+)
+
# SECRET_KEY = '' |
0dd70c2e6e991163852e8889e0a4802e702ae68d | mea_module.py | mea_module.py | import sys
from jnius import autoclass, cast
from TripsModule import trips_module
KQMLPerformative = autoclass('TRIPS.KQML.KQMLPerformative')
KQMLList = autoclass('TRIPS.KQML.KQMLList')
KQMLObject = autoclass('TRIPS.KQML.KQMLObject')
from bioagents.mea import MEA
class MEA_Module(trips_module.TripsModule):
def _... | Add TRIPS module for MEA | Add TRIPS module for MEA
| Python | bsd-2-clause | bgyori/bioagents,sorgerlab/bioagents | ---
+++
@@ -0,0 +1,66 @@
+import sys
+from jnius import autoclass, cast
+from TripsModule import trips_module
+
+KQMLPerformative = autoclass('TRIPS.KQML.KQMLPerformative')
+KQMLList = autoclass('TRIPS.KQML.KQMLList')
+KQMLObject = autoclass('TRIPS.KQML.KQMLObject')
+
+from bioagents.mea import MEA
+
+class MEA_Modul... | |
dfa6d3b3fe148895599360d01195200b06e7583d | receiver-dump.py | receiver-dump.py | #******************************************************************************
#
# receiver-dump.py
#
#******************************************************************************
#
# Author: Werner Lane
# E-mail: laneboysrc@gmail.com
#
#*********************************************************... | Add receiver dump program, output of firmware | Add receiver dump program, output of firmware
| Python | unlicense | laneboysrc/hk310-expansion,laneboysrc/hk310-expansion,laneboysrc/hk310-expansion | ---
+++
@@ -0,0 +1,106 @@
+#******************************************************************************
+#
+# receiver-dump.py
+#
+#******************************************************************************
+#
+# Author: Werner Lane
+# E-mail: laneboysrc@gmail.com
+#
+#*******************... | |
678ba5e332b7c54cdb39d117dc443bf88da7d111 | jsontosql.py | jsontosql.py | import os
import os.path
from json import loads
import click
from vendcrawler.scripts.vendcrawlerdb import VendCrawlerDB
class JSONToSQL(object):
def __init__(self, json, user, password, database):
self.data = loads(json.read())
self.db = VendCrawlerDB(user, password, database)
... | Add json to sql conversion script. | Add json to sql conversion script.
| Python | mit | josetaas/vendcrawler,josetaas/vendcrawler,josetaas/vendcrawler | ---
+++
@@ -0,0 +1,45 @@
+import os
+import os.path
+from json import loads
+
+import click
+
+from vendcrawler.scripts.vendcrawlerdb import VendCrawlerDB
+
+class JSONToSQL(object):
+
+ def __init__(self, json, user, password, database):
+ self.data = loads(json.read())
+ self.db = VendCrawlerDB(use... | |
b0db73209cbe29bf070581fd81afc6fbf86af718 | skan/draw.py | skan/draw.py | import numpy as np
import matplotlib.pyplot as plt
from skimage import img_as_float
from skimage.color import gray2rgb
from .csr import summarise
def _normalise_image(image, *, image_cmap=None):
image = img_as_float(image)
if image.ndim == 2:
if image_cmap is None:
image = gray2rgb(image)
... | Add first draft of plotting functions | Add first draft of plotting functions
| Python | bsd-3-clause | jni/skan | ---
+++
@@ -0,0 +1,51 @@
+import numpy as np
+import matplotlib.pyplot as plt
+from skimage import img_as_float
+from skimage.color import gray2rgb
+from .csr import summarise
+
+
+def _normalise_image(image, *, image_cmap=None):
+ image = img_as_float(image)
+ if image.ndim == 2:
+ if image_cmap is None... | |
7174061ac5ae2453c3369c7bb7dd01e45ee36092 | scripts/pseudo_users_and_groups_operations.py | scripts/pseudo_users_and_groups_operations.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import os
def main(argv=None):
"""
То, с чего начинается программа
"""
if argv == None:
argv=sys.argv
parser = argparse.ArgumentParser(
description=\
"""
Данный скрипт создаёт пользоват... | Create pseudo_users and pseudo_groups. In future it will remove pseudo users and pseudo groups too. | Create pseudo_users and pseudo_groups.
In future it will remove pseudo users and pseudo groups too.
| Python | lgpl-2.1 | pseudo-cluster/pseudo-cluster,pseudo-cluster/pseudo-cluster | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import argparse
+import os
+
+def main(argv=None):
+ """
+ То, с чего начинается программа
+ """
+ if argv == None:
+ argv=sys.argv
+
+ parser = argparse.ArgumentParser(
+ description=\
+ """
+ ... | |
54c1fe598d4a8d76ae7ec0ce867f45af056c12e6 | Lab/10/Template_10_A.py | Lab/10/Template_10_A.py | palindrom (kata) :
#TODO : implementasi fungsi palindrom untuk menyelesaikan soal palindrom
checkActiveAmoeba (hariKe, amoebaAktif) :
#TODO : implementasi fungsi ini untuk menyelesaikan soal Amoeba
kataPalindrom = input("Masukkan kata : ")
#TODO : cetak keluaran sesuai permintaan soal
hari = int(input("Cek... | Add template for lab 10 class A | Add template for lab 10 class A
| Python | mit | laymonage/TarungLab,giovanism/TarungLab | ---
+++
@@ -0,0 +1,27 @@
+palindrom (kata) :
+ #TODO : implementasi fungsi palindrom untuk menyelesaikan soal palindrom
+
+
+checkActiveAmoeba (hariKe, amoebaAktif) :
+ #TODO : implementasi fungsi ini untuk menyelesaikan soal Amoeba
+
+
+kataPalindrom = input("Masukkan kata : ")
+#TODO : cetak keluaran sesuai p... | |
254930d317ab61bc85169d8c64e2c6eab2d48f5f | tests/unit/cloudant_t/design_doc_test.py | tests/unit/cloudant_t/design_doc_test.py | #!/usr/bin/env python
"""
_design_doc_test_
"""
import mock
import unittest
from cloudant.design_document import DesignDocument
from cloudant.document import Document
class DesignDocTests(unittest.TestCase):
"""
tests for design doc object
"""
@mock.patch.object(Document, 'fetch')
def test_desi... | Copy DesignDocument tests to their own module | Copy DesignDocument tests to their own module
| Python | apache-2.0 | cloudant/python-cloudant | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+"""
+_design_doc_test_
+
+"""
+import mock
+import unittest
+
+from cloudant.design_document import DesignDocument
+from cloudant.document import Document
+
+
+class DesignDocTests(unittest.TestCase):
+ """
+ tests for design doc object
+
+ """
+ @mock.patc... | |
37dd523cfb5a26cb33493ba29f99d8a97a8401e4 | inst/py/phyloxml_from_msa.py | inst/py/phyloxml_from_msa.py | """Generate a phylo.xml from a MUSCLE MSA.fasta"""
import argparse
##### PARSE ARGUMENTS #####
argparser = argparse.ArgumentParser()
argparser.add_argument("msa", help="path to the MUSCLE MSA.fasta")
argparser.add_argument("phyloxml", help="path to an output phylo.xml")
args = argparser.parse_args()
args = vars(arg... | Add Python function to build phylo.xml from MSA with Biopython | Add Python function to build phylo.xml from MSA with Biopython
| Python | bsd-2-clause | daniel0128/receptormarker,nsh87/receptormarker,nsh87/receptormarker,daniel0128/receptormarker,daniel0128/receptormarker,nsh87/receptormarker,nsh87/receptormarker,catterbu/receptormarker,daniel0128/receptormarker,daniel0128/receptormarker,catterbu/receptormarker,daniel0128/receptormarker,catterbu/receptormarker,catterbu... | ---
+++
@@ -0,0 +1,33 @@
+"""Generate a phylo.xml from a MUSCLE MSA.fasta"""
+
+
+import argparse
+
+
+##### PARSE ARGUMENTS #####
+argparser = argparse.ArgumentParser()
+argparser.add_argument("msa", help="path to the MUSCLE MSA.fasta")
+argparser.add_argument("phyloxml", help="path to an output phylo.xml")
+args = ... | |
d83be93d707ead0563f2eefc71b1f3d90e20df4a | glowing-lines.py | glowing-lines.py | from PIL import Image, ImageDraw
import random
W = 500
im = Image.new('RGB', (W, W))
NCOLORS = 19
COLORS = []
def get_origin_point():
return [random.randint(0, W-1), random.randint(0, W-1)]
def get_vector():
return [random.randint(0.3*W, 0.6*W), random.randint(0.3*W, 0.6*W)]
def draw_one_line(draw):
op = g... | Add crude script to draw glowing lines; currently the dark part hides the bright pixels of other lines, making them look physical; should be additive | Add crude script to draw glowing lines; currently the dark part hides the bright pixels of other lines, making them look physical; should be additive
| Python | mit | redpig2/pilhacks | ---
+++
@@ -0,0 +1,40 @@
+from PIL import Image, ImageDraw
+
+import random
+
+W = 500
+im = Image.new('RGB', (W, W))
+NCOLORS = 19
+COLORS = []
+
+def get_origin_point():
+ return [random.randint(0, W-1), random.randint(0, W-1)]
+
+def get_vector():
+ return [random.randint(0.3*W, 0.6*W), random.randint(0.3*W, 0... | |
d1de958daac3991bf673c4e5b10a0564a9a610d8 | var/spack/packages/libmonitor/package.py | var/spack/packages/libmonitor/package.py | ##############################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
... | Add libmonitor to spack. Still needs svn support for checkout | Add libmonitor to spack. Still needs svn support for checkout
| Python | lgpl-2.1 | matthiasdiener/spack,mfherbst/spack,TheTimmy/spack,EmreAtes/spack,TheTimmy/spack,mfherbst/spack,EmreAtes/spack,tmerrick1/spack,skosukhin/spack,lgarren/spack,lgarren/spack,TheTimmy/spack,LLNL/spack,mfherbst/spack,skosukhin/spack,mfherbst/spack,TheTimmy/spack,tmerrick1/spack,mfherbst/spack,krafczyk/spack,LLNL/spack,tmerr... | ---
+++
@@ -0,0 +1,36 @@
+##############################################################################
+# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Written by Todd Gamblin, tgamblin@llnl.gov, All rig... | |
329438288f9bf031e806020b37e3b9260e9dc07b | scripts/create_nom_prenom_unifier.py | scripts/create_nom_prenom_unifier.py | # -*- coding: utf-8 -*-
import pandas as pd
from unidecode import unidecode
df = pd.DataFrame()
from utils import Fingerprinter
def nomprenomtwice(nom):
if not pd.isnull(nom):
anom = nom.split(' ')
if anom[len(anom)/2] != anom[0]:
return nom.upper()
return ' '.join(anom[0:le... | Add script to generate a nom prenom unifier | Add script to generate a nom prenom unifier
| Python | agpl-3.0 | regardscitoyens/sunshine-data,regardscitoyens/sunshine-data,regardscitoyens/sunshine-data,regardscitoyens/sunshine-data,regardscitoyens/sunshine-data,regardscitoyens/sunshine-data | ---
+++
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+
+import pandas as pd
+from unidecode import unidecode
+
+df = pd.DataFrame()
+
+from utils import Fingerprinter
+
+
+def nomprenomtwice(nom):
+ if not pd.isnull(nom):
+ anom = nom.split(' ')
+ if anom[len(anom)/2] != anom[0]:
+ return nom... | |
9f30d2dd142116f46dd0257bcf093e8e8dc2c11a | wagtail/admin/tests/test_dismissibles.py | wagtail/admin/tests/test_dismissibles.py | from django.test import TestCase
from django.urls import reverse
from wagtail.test.utils import WagtailTestUtils
from wagtail.users.models import UserProfile
class TestDismissiblesView(TestCase, WagtailTestUtils):
def setUp(self):
self.user = self.login()
self.profile = UserProfile.get_for_user(s... | Add tests for Dismissibles view | Add tests for Dismissibles view
| Python | bsd-3-clause | rsalmaso/wagtail,thenewguy/wagtail,rsalmaso/wagtail,thenewguy/wagtail,rsalmaso/wagtail,wagtail/wagtail,wagtail/wagtail,rsalmaso/wagtail,zerolab/wagtail,wagtail/wagtail,zerolab/wagtail,zerolab/wagtail,thenewguy/wagtail,zerolab/wagtail,wagtail/wagtail,rsalmaso/wagtail,wagtail/wagtail,thenewguy/wagtail,zerolab/wagtail,the... | ---
+++
@@ -0,0 +1,65 @@
+from django.test import TestCase
+from django.urls import reverse
+
+from wagtail.test.utils import WagtailTestUtils
+from wagtail.users.models import UserProfile
+
+
+class TestDismissiblesView(TestCase, WagtailTestUtils):
+ def setUp(self):
+ self.user = self.login()
+ sel... | |
6e2b09d478d61c2ae66959b87cb58689b57436b0 | rf_train.py | rf_train.py | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.ensemble import RandomForestClassifier
from sklearn.externals import joblib
print "Grabbing data..."
training_text_collection_f = open("training_text_collection.pkl", "rb")
training_text_collection = joblib.load(training_text_collection_f)
train... | Create Random Forest vectorizer and classifier pickles | Create Random Forest vectorizer and classifier pickles
| Python | mit | npentella/CuriousCorpus,npentella/CuriousCorpus,npentella/CuriousCorpus | ---
+++
@@ -0,0 +1,36 @@
+from sklearn.feature_extraction.text import TfidfVectorizer
+from sklearn.ensemble import RandomForestClassifier
+from sklearn.externals import joblib
+
+print "Grabbing data..."
+
+training_text_collection_f = open("training_text_collection.pkl", "rb")
+training_text_collection = joblib.loa... | |
7cd00a28a0cbb152cd61c3ebbd4b72d3ab31baca | locators/tests/functional/test_latest.py | locators/tests/functional/test_latest.py | from locators import SimpleLocator
def test_latest_source():
loc = SimpleLocator()
proj = 'pip'
latest = max(loc.versions(proj))
# We want the first item in the following list
assert len(loc.get(proj, latest)['sdist']) != 0
def test_has_wheels():
loc = SimpleLocator()
proj = 'pip'
late... | Add the basis for some functional tests | Add the basis for some functional tests
| Python | mit | pfmoore/sandbox | ---
+++
@@ -0,0 +1,27 @@
+from locators import SimpleLocator
+
+def test_latest_source():
+ loc = SimpleLocator()
+ proj = 'pip'
+ latest = max(loc.versions(proj))
+ # We want the first item in the following list
+ assert len(loc.get(proj, latest)['sdist']) != 0
+
+def test_has_wheels():
+ loc = Sim... | |
921d95a432316b2b76aadabcc3fc90fbf90376aa | simphony/testing/abc_container_check.py | simphony/testing/abc_container_check.py | import abc
from functools import partial
from simphony.testing.utils import (
create_data_container, compare_data_containers)
from simphony.core.data_container import DataContainer
from simphony.core.cuba import CUBA
class ContainerCheck(object):
__metaclass__ = abc.ABCMeta
def setUp(self):
sel... | Add a basic test template for high level CUDS containers | Add a basic test template for high level CUDS containers
| Python | bsd-2-clause | simphony/simphony-common | ---
+++
@@ -0,0 +1,46 @@
+import abc
+from functools import partial
+
+from simphony.testing.utils import (
+ create_data_container, compare_data_containers)
+from simphony.core.data_container import DataContainer
+from simphony.core.cuba import CUBA
+
+
+class ContainerCheck(object):
+
+ __metaclass__ = abc.AB... | |
62ece88485b335086f76335095ccf348a123ee69 | tests/simplemeshtest.py | tests/simplemeshtest.py | #!/usr/bin/env python
from twisted.internet import reactor
from mesh import Mesh
import sys
NUMNODES = 5
NUMPACKETS = 10
nodes = []
# We're optimists
success = True
class TestMesh(Mesh):
expected = {}
done = 0
def gotOutput(self, node, data):
if self.expected.get(node) == None:
self.expected[node]... | Add a very basis test (just test if messages are output in the right order by all nodes | Add a very basis test (just test if messages are output in the right order by all nodes
20070605063752-93b9a-171c986a65ac8fcdb791ea4ab34f870f087478dc.gz
| Python | lgpl-2.1 | freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut | ---
+++
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+from twisted.internet import reactor
+from mesh import Mesh
+import sys
+
+NUMNODES = 5
+NUMPACKETS = 10
+
+
+nodes = []
+# We're optimists
+success = True
+
+class TestMesh(Mesh):
+ expected = {}
+ done = 0
+
+ def gotOutput(self, node, data):
+ if self.expect... | |
dfa257f02d14ba7757ee65d1910bf581c280607e | tests/unit/test_repr.py | tests/unit/test_repr.py | from butter.eventfd import Eventfd
from butter.fanotify import Fanotify
from butter.inotify import Inotify
from butter.signalfd import Signalfd
from butter.timerfd import Timerfd
import pytest
@pytest.fixture(params=[Eventfd, Fanotify, Inotify, Signalfd, Timerfd])
def obj(request):
Obj = request.param
o = Obj... | Test the repr() of object | Test the repr() of object
| Python | bsd-3-clause | arkaitzj/python-butter | ---
+++
@@ -0,0 +1,33 @@
+from butter.eventfd import Eventfd
+from butter.fanotify import Fanotify
+from butter.inotify import Inotify
+from butter.signalfd import Signalfd
+from butter.timerfd import Timerfd
+import pytest
+
+
+@pytest.fixture(params=[Eventfd, Fanotify, Inotify, Signalfd, Timerfd])
+def obj(request)... | |
6ee4d6a13a3fb6564e12ef8c8645a96015d39fed | seq_spot.py | seq_spot.py | from matplotlib import pyplot as plt
s=["AATTCGCGCTTACGCTAGGCTAGCTAGGCTCGATTCGAGGCTCGGGATCGATCGGTACGAGGTACGTACTGACTGACT",
"ACTGGGCTATGCGGGATATATATATCGCGACTGACATGCATGCTAGGCGCGCTATAATCGGCGCATATAGCTAGCTAG",
"ACTGACGTACGTAGCTAGCTAGGCTATATAGCGCGCATATCGCGAGTATACGTAGCTAGCTGACTGGCGATATATCGA",
"ACGTGAGCTGATGTGTGAGTACTATA... | Create dodgy vis of reads sequenced | Create dodgy vis of reads sequenced | Python | mit | Psy-Fer/seq_spot | ---
+++
@@ -0,0 +1,49 @@
+from matplotlib import pyplot as plt
+
+s=["AATTCGCGCTTACGCTAGGCTAGCTAGGCTCGATTCGAGGCTCGGGATCGATCGGTACGAGGTACGTACTGACTGACT",
+ "ACTGGGCTATGCGGGATATATATATCGCGACTGACATGCATGCTAGGCGCGCTATAATCGGCGCATATAGCTAGCTAG",
+ "ACTGACGTACGTAGCTAGCTAGGCTATATAGCGCGCATATCGCGAGTATACGTAGCTAGCTGACTGGCGATATATCGA... | |
caaabeb103879baf3179955b36e845aa878f15f6 | tools/build_tfmd_docs.py | tools/build_tfmd_docs.py | # Copyright 2022 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 api-reference generation script for TFMD. | Add api-reference generation script for TFMD.
Output listing: https://paste.googleplex.com/4777420088410112
PiperOrigin-RevId: 431509556
| Python | apache-2.0 | tensorflow/metadata,tensorflow/metadata | ---
+++
@@ -0,0 +1,70 @@
+# Copyright 2022 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-... | |
c123c8ce1094885e3a4d96573f70ebc1130627f6 | set2/2-2.py | set2/2-2.py | # This is a hack to make sure Python 2.x and 3.x behave the same
# You can ignore this bit
try:
input = raw_input
except NameError:
pass
# Real program starts here
def hash(string):
char_sum = 0
for c in string:
char_sum += ord(c)
return char_sum % 23
password_hash = 17
print("Please ent... | Add hasing on string input game | Set2: Add hasing on string input game
| Python | mit | SingingTree/WarGames | ---
+++
@@ -0,0 +1,28 @@
+# This is a hack to make sure Python 2.x and 3.x behave the same
+# You can ignore this bit
+try:
+ input = raw_input
+except NameError:
+ pass
+
+# Real program starts here
+def hash(string):
+ char_sum = 0
+ for c in string:
+ char_sum += ord(c)
+ return char_sum % 23... | |
ef4e5cd5c45735a5a82b849b7191fdb8a2a27a59 | qa/patch_profile.py | qa/patch_profile.py | import requests
import json
import time
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class PatchProfileTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 1
def run_test(self):
al... | Add test for Profile PATCH method | Add test for Profile PATCH method
| Python | mit | cpacia/openbazaar-go,jackkleeman/openbazaar-go,gubatron/openbazaar-go,yurizhykin/openbazaar-go,OpenBazaar/openbazaar-go,JustinDrake/openbazaar-go,jackkleeman/openbazaar-go,cpacia/openbazaar-go,gubatron/openbazaar-go,gubatron/openbazaar-go,duomarket/openbazaar-test-nodes,yurizhykin/openbazaar-go,hoffmabc/openbazaar-go,O... | ---
+++
@@ -0,0 +1,55 @@
+import requests
+import json
+import time
+from collections import OrderedDict
+from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
+
+
+class PatchProfileTest(OpenBazaarTestFramework):
+
+ def __init__(self):
+ super().__init__()
+ self.num_nodes ... | |
1af0151c960e084aa3d970e32af396c855e2f90a | mccurse/cli.py | mccurse/cli.py | """Command line interface to the package."""
import curses
from logging import ERROR, INFO
import click
from . import _, log
from .curse import Game
from .util import default_data_dir
@click.group()
@click.version_option()
@click.option('--refresh', is_flag=True, default=False,
help=_('Force refresh ... | Implement common group setup for CLI | Implement common group setup for CLI
| Python | agpl-3.0 | khardix/mccurse | ---
+++
@@ -0,0 +1,39 @@
+"""Command line interface to the package."""
+
+import curses
+from logging import ERROR, INFO
+
+import click
+
+from . import _, log
+from .curse import Game
+from .util import default_data_dir
+
+
+@click.group()
+@click.version_option()
+@click.option('--refresh', is_flag=True, default=F... | |
ae0ee6834feaefb77d8f6776b62c0d1b4621c84b | byceps/util/sentry.py | byceps/util/sentry.py | """
byceps.util.sentry
~~~~~~~~~~~~~~~~~~
Sentry_ integration
.. _Sentry: https://sentry.io/
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from flask import Flask
def configure_sentry_for_webapp(dsn: str, environment: str, app: Flask) -> None:
"""Initialize an... | Add utilities to integrate with Sentry | Add utilities to integrate with Sentry
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | ---
+++
@@ -0,0 +1,40 @@
+"""
+byceps.util.sentry
+~~~~~~~~~~~~~~~~~~
+
+Sentry_ integration
+
+.. _Sentry: https://sentry.io/
+
+:Copyright: 2006-2020 Jochen Kupperschmidt
+:License: Modified BSD, see LICENSE for details.
+"""
+
+from flask import Flask
+
+
+def configure_sentry_for_webapp(dsn: str, environment: str... | |
43d5c85a1b91719cabbc4a92bfd65feceb6cedfc | py/random-pick-index.py | py/random-pick-index.py | from random import random
class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
:type numsSize: int
"""
self.nums = nums
def pick(self, target):
"""
:type target: int
:rtype: int
"""
meet = 0
choice =... | Add py solution for 398. Random Pick Index | Add py solution for 398. Random Pick Index
398. Random Pick Index: https://leetcode.com/problems/random-pick-index/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,29 @@
+from random import random
+class Solution(object):
+
+ def __init__(self, nums):
+ """
+ :type nums: List[int]
+ :type numsSize: int
+ """
+ self.nums = nums
+
+ def pick(self, target):
+ """
+ :type target: int
+ :rtype: int
+ ... | |
fbc96cdd95a007bf0c1f6c7439113e8f41cef876 | py/range-addition-ii.py | py/range-addition-ii.py | from operator import itemgetter
class Solution(object):
def maxCount(self, m, n, ops):
"""
:type m: int
:type n: int
:type ops: List[List[int]]
:rtype: int
"""
if not ops:
return m * n
return min(map(itemgetter(0), ops)) * min(map(itemgette... | Add py solution for 598. Range Addition II | Add py solution for 598. Range Addition II
598. Range Addition II: https://leetcode.com/problems/range-addition-ii/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,12 @@
+from operator import itemgetter
+class Solution(object):
+ def maxCount(self, m, n, ops):
+ """
+ :type m: int
+ :type n: int
+ :type ops: List[List[int]]
+ :rtype: int
+ """
+ if not ops:
+ return m * n
+ return min(map(i... | |
a4ae7acabf37de8ef6142c7c402cd663629c4aa9 | bo5.py | bo5.py | from collections import namedtuple
import random
W = 800
H = 600
RED = 200, 0, 0
BLUE = 0, 0, 200
GREEN = 0, 200, 0
ball = Rect((W/2, H/2), (30, 30))
Direction = namedtuple('Direction', 'x y')
ball_dir = Direction(5, 5)
bat = Rect((W/2, 0.96 * H), (150, 15))
N_BLOCKS = 8
BLOCK_W = W / N_BLOCKS
BLOCK_H = BLOCK_W / 4
... | Add start of top blocks | Add start of top blocks
| Python | mit | tomviner/breakout | ---
+++
@@ -0,0 +1,59 @@
+from collections import namedtuple
+import random
+
+W = 800
+H = 600
+RED = 200, 0, 0
+BLUE = 0, 0, 200
+GREEN = 0, 200, 0
+
+ball = Rect((W/2, H/2), (30, 30))
+Direction = namedtuple('Direction', 'x y')
+ball_dir = Direction(5, 5)
+
+bat = Rect((W/2, 0.96 * H), (150, 15))
+N_BLOCKS = 8
+BL... | |
bab5a974c78a2b7042de449c6d3b01f9297809f1 | src/python/utexas/tools/generate_ddl.py | src/python/utexas/tools/generate_ddl.py | """
utexas/tools/generate_ddl.py
Print or apply the research data schema.
@author: Bryan Silverthorn <bcs@cargo-cult.org>
"""
if __name__ == "__main__":
from utexas.tools.generate_ddl import main
raise SystemExit(main())
from cargo.flags import (
Flag,
Flags,
)
module_flags = \
Flags(
... | Add a standalone DDL print/reflection tool. | Add a standalone DDL print/reflection tool.
| Python | mit | borg-project/borg | ---
+++
@@ -0,0 +1,84 @@
+"""
+utexas/tools/generate_ddl.py
+
+Print or apply the research data schema.
+
+@author: Bryan Silverthorn <bcs@cargo-cult.org>
+"""
+
+if __name__ == "__main__":
+ from utexas.tools.generate_ddl import main
+
+ raise SystemExit(main())
+
+from cargo.flags import (
+ Flag,
+ Fla... | |
f7be1ee85cc3a65c5884773995a20e12037dba4d | enqueue-repo.py | enqueue-repo.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
enqueues respos from stdin or from command line arguments
"""
import argparse
import re
import sys
from typing import Iterator
from sensibility.miner.connection import redis_client
from sensibility.miner.names import DOWNLOAD_QUEUE
from sensibility.miner.rqueue impo... | Make an easy thing to enqueue repos. | Make an easy thing to enqueue repos.
| Python | apache-2.0 | eddieantonio/ad-hoc-miner,eddieantonio/ad-hoc-miner,naturalness/sensibility,naturalness/sensibility,naturalness/sensibility,eddieantonio/ad-hoc-miner,naturalness/sensibility,eddieantonio/ad-hoc-miner | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+# -*- coding: UTF-8 -*-
+
+"""
+enqueues respos from stdin or from command line arguments
+"""
+
+import argparse
+import re
+import sys
+from typing import Iterator
+
+from sensibility.miner.connection import redis_client
+from sensibility.miner.names import DOWNLOAD... | |
7f0c6c94b9cfddd28f2ab124fffdb1850e966930 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='django-simple-history',
version='1.2.2.post1',
description='Store model history and view/revert changes from admin site.',
long_description='\n'.join((
open('README.rst').read(),
open('CHANGES.rst').read(),
)),
author='Co... | from setuptools import setup, find_packages
setup(
name='django-simple-history',
version='1.2.2.post1',
description='Store model history and view/revert changes from admin site.',
long_description='\n'.join((
open('README.rst').read(),
open('CHANGES.rst').read(),
)),
author='Co... | Include package files when installing from PyPI | Include package files when installing from PyPI
| Python | bsd-3-clause | treyhunner/django-simple-history,emergence/django-simple-history,pombredanne/django-simple-history,pombredanne/django-simple-history,treyhunner/django-simple-history,luzfcb/django-simple-history,luzfcb/django-simple-history,emergence/django-simple-history | ---
+++
@@ -25,5 +25,6 @@
"License :: OSI Approved :: BSD License",
],
tests_require=["Django>=1.3", "webtest", "django-webtest"],
+ include_package_data=True,
test_suite='runtests.main',
) |
b423a34696d8e3ef7587bed3eb61876abc923bbe | python/hardway/function_testing.py | python/hardway/function_testing.py | #!/usr/bin/python3
# some experiments with functions
def my_values(value1):
print ("Value of value1 in function my_values: %s" % value1)
print ("Value of value2 in function my_values: %s" % value2)
print ("==========================================================")
def my_values2(newvalue):
print ("Value of newv... | Test script with Python Functions | Test script with Python Functions
| Python | apache-2.0 | petervdb/eLearning,petervdb/eLearning,petervdb/eLearning,petervdb/eLearning,petervdb/eLearning | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/python3
+# some experiments with functions
+
+def my_values(value1):
+ print ("Value of value1 in function my_values: %s" % value1)
+ print ("Value of value2 in function my_values: %s" % value2)
+ print ("==========================================================")
+
+def my_value... | |
0f6913f09b61acef4e464f81558f19982f98697e | getPortfolio.py | getPortfolio.py | #!/usr/bin/env python
"""
Retrieves current list of ticker symbols that are in portfolio.
All symbols are in lower-case.
"""
#TODO: Get portfolio list from a text file.
#TODO: Handle command line parms.
import sys
def get_portfolio():
"""Return a list of ticker symbols for entire portfolio"""
# Currently t... | Make ticker symbols lower case | Make ticker symbols lower case
| Python | mit | SimonJester/portfolio | ---
+++
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+"""
+Retrieves current list of ticker symbols that are in portfolio.
+All symbols are in lower-case.
+"""
+
+#TODO: Get portfolio list from a text file.
+#TODO: Handle command line parms.
+
+import sys
+
+
+def get_portfolio():
+ """Return a list of ticker symbols... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.