commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
5b45d4996de8c15dfc09905b0e63651fdbb2fcc6 | angr/engines/soot/expressions/phi.py | angr/engines/soot/expressions/phi.py |
from .base import SimSootExpr
class SimSootExpr_Phi(SimSootExpr):
def __init__(self, expr, state):
super(SimSootExpr_Phi, self).__init__(expr, state)
def _execute(self):
if len(self.expr.values) != 2:
import ipdb; ipdb.set_trace();
v1, v2 = [self._translate_value(v) for... |
from .base import SimSootExpr
import logging
l = logging.getLogger('angr.engines.soot.expressions.phi')
class SimSootExpr_Phi(SimSootExpr):
def __init__(self, expr, state):
super(SimSootExpr_Phi, self).__init__(expr, state)
def _execute(self):
locals_option = [self._translate_value(v) for v ... | Extend Phi expression to work with more than 2 values | Extend Phi expression to work with more than 2 values
| Python | bsd-2-clause | schieb/angr,iamahuman/angr,angr/angr,schieb/angr,angr/angr,angr/angr,iamahuman/angr,schieb/angr,iamahuman/angr |
e0cb864f19f05f4ddfed0fa90c8b9895bde9b8df | caminae/core/management/__init__.py | caminae/core/management/__init__.py | """
http://djangosnippets.org/snippets/2311/
Ensure South will update our custom SQL during a call to `migrate`.
"""
import logging
import traceback
from south.signals import post_migrate
logger = logging.getLogger(__name__)
def run_initial_sql(sender, **kwargs):
app_label = kwargs.get('app')
import... | """
http://djangosnippets.org/snippets/2311/
Ensure South will update our custom SQL during a call to `migrate`.
"""
import logging
import traceback
from south.signals import post_migrate
logger = logging.getLogger(__name__)
def run_initial_sql(sender, **kwargs):
import os
import re
from django.... | Enable loading of SQL scripts with arbitrary name | Enable loading of SQL scripts with arbitrary name
| Python | bsd-2-clause | Anaethelion/Geotrek,makinacorpus/Geotrek,johan--/Geotrek,makinacorpus/Geotrek,camillemonchicourt/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,Anaethelion/Geotrek,Anaethelion/Geotrek,johan--/Geotrek,mabhub/Geotrek,camillemonchicourt/Geotrek,makinacorpus/Geotrek,johan--/Geotrek,GeotrekCE/Geotrek-admin,makinaco... |
2834a22489ebe801743434dcf26e727448355756 | corehq/messaging/scheduling/scheduling_partitioned/migrations/0009_update_custom_recipient_ids.py | corehq/messaging/scheduling/scheduling_partitioned/migrations/0009_update_custom_recipient_ids.py | # Generated by Django 2.2.24 on 2021-11-19 14:36
from django.db import migrations
from corehq.messaging.scheduling.scheduling_partitioned.models import CaseTimedScheduleInstance
from corehq.sql_db.util import get_db_aliases_for_partitioned_query
def update_custom_recipient_ids(*args, **kwargs):
for db in get_db_... | from django.db import migrations
from corehq.messaging.scheduling.scheduling_partitioned.models import CaseTimedScheduleInstance
from corehq.sql_db.util import get_db_aliases_for_partitioned_query
def update_custom_recipient_ids(*args, **kwargs):
for db in get_db_aliases_for_partitioned_query():
CaseTimed... | Remove date from migration since this one is copied and edited | Remove date from migration since this one is copied and edited
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq |
2cecc2e197e4a4089e29b350179103e323136268 | ddb_ngsflow/variation/sv/itdseek.py | ddb_ngsflow/variation/sv/itdseek.py | """
.. module:: freebayes
:platform: Unix, OSX
:synopsis: A wrapper module for calling ScanIndel.
.. moduleauthor:: Daniel Gaston <daniel.gaston@dal.ca>
"""
from ddb_ngsflow import pipeline
def run_flt3_itdseek(job, config, name, samples):
"""Run ITDseek without a matched normal sample
:param config: ... | """
.. module:: freebayes
:platform: Unix, OSX
:synopsis: A wrapper module for calling ScanIndel.
.. moduleauthor:: Daniel Gaston <daniel.gaston@dal.ca>
"""
from ddb_ngsflow import pipeline
def run_flt3_itdseek(job, config, name):
"""Run ITDseek without a matched normal sample
:param config: The confi... | Remove unneeded samples config passing | Remove unneeded samples config passing
| Python | mit | dgaston/ddb-ngsflow,dgaston/ddbio-ngsflow |
e59f187f2e4557114e534be57dc078ddf112b87c | completions_dev.py | completions_dev.py | import sublime_plugin
from sublime_lib.path import root_at_packages, get_package_name
PLUGIN_NAME = get_package_name()
COMPLETIONS_SYNTAX_DEF = "Packages/%s/Syntax Definitions/Sublime Completions.tmLanguage" % PLUGIN_NAME
TPL = """{
"scope": "source.${1:off}",
"completions": [
{ "trigger"... | import sublime_plugin
from sublime_lib.path import root_at_packages, get_package_name
PLUGIN_NAME = get_package_name()
COMPLETIONS_SYNTAX_DEF = "Packages/%s/Syntax Definitions/Sublime Completions.tmLanguage" % PLUGIN_NAME
TPL = """{
"scope": "source.${1:off}",
"completions": [
{ "trigger"... | Use tabs in new completions file snippet | Use tabs in new completions file snippet
Respects the user's indentation configuration.
| Python | mit | SublimeText/PackageDev,SublimeText/AAAPackageDev,SublimeText/AAAPackageDev |
62b74e6d6452012f8ad68810446a3648749a3fee | collections/show-test/print-divs.py | collections/show-test/print-divs.py | # print-divs.py
def printDivs(num):
for i in range(num):
print('<div class="item">Item ' + str(i+1) + '</div>')
printDivs(20) | # print-divs.py
def printDivs(num):
for i in range(num):
print('<div class="item">Item ' + str(i+1) + ': Lorem ipsum dolor sic amet</div>')
printDivs(20) | Add dummy text to divs. | Add dummy text to divs.
| Python | apache-2.0 | scholarslab/takeback,scholarslab/takeback,scholarslab/takeback,scholarslab/takeback,scholarslab/takeback |
02f18e2ec6788f4cf92e8a2f78898f6861f2f395 | gofast/gpio.py | gofast/gpio.py |
import cffi
ffi = cffi.FFI()
ffi.cdef("""
int setup(void);
void setup_gpio(int gpio, int direction, int pud);
int gpio_function(int gpio);
void output_gpio(int gpio, int value);
int input_gpio(int gpio);
void set_rising_event(int gpio, int enable);
void set_falling_event(int gpio, int enable);
void set_high_event(in... |
import cffi
ffi = cffi.FFI()
ffi.cdef("""
int setup(void);
void setup_gpio(int gpio, int direction, int pud);
int gpio_function(int gpio);
void output_gpio(int gpio, int value);
int input_gpio(int gpio);
void set_rising_event(int gpio, int enable);
void set_falling_event(int gpio, int enable);
void set_high_event(in... | Make GPIO importable, but not usable, as non-root | Make GPIO importable, but not usable, as non-root
| Python | bsd-2-clause | cg123/computernetworks,cg123/computernetworks,cg123/computernetworks |
132f91c5f3f193ca3b1a246b9ef5b20b4e03609f | core/validators.py | core/validators.py | from datetime import datetime, timedelta
from django.core.exceptions import ValidationError
def validate_approximatedate(date):
if date.month == 0:
raise ValidationError(
'Event date can\'t be a year only. '
'Please, provide at least a month and a year.'
)
def validate_e... | from datetime import date, datetime, timedelta
from django.core.exceptions import ValidationError
def validate_approximatedate(date):
if date.month == 0:
raise ValidationError(
'Event date can\'t be a year only. '
'Please, provide at least a month and a year.'
)
def vali... | Apply suggested changes on date | Apply suggested changes on date
| Python | bsd-3-clause | DjangoGirls/djangogirls,DjangoGirls/djangogirls,DjangoGirls/djangogirls |
e0276f6c86e07fa82f19c5f895b6e513d38255c0 | server/management/commands/friendly_model_name.py | server/management/commands/friendly_model_name.py | '''
Retrieves the firendly model name for machines that don't have one yet.
'''
from django.core.management.base import BaseCommand, CommandError
from server.models import Machine
from django.db.models import Q
import server.utils as utils
class Command(BaseCommand):
help = 'Retrieves friendly model names for ma... | """Retrieves the friendly model name for machines that don't have one yet."""
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
import server.utils as utils
from server.models import Machine
class Command(BaseCommand):
help = 'Retrieves friendly model names for mac... | Fix missing paren, imports, spelling. | Fix missing paren, imports, spelling.
| Python | apache-2.0 | sheagcraig/sal,sheagcraig/sal,salopensource/sal,salopensource/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,salopensource/sal |
14cdf6b7a82e49f1860aee41e4b1a5b20cf179b2 | quickstats/signals.py | quickstats/signals.py | import logging
from . import tasks
from django.db.models.signals import post_save
from django.dispatch import receiver
logger = logging.getLogger(__name__)
@receiver(post_save, sender="quickstats.Sample", dispatch_uid="quickstats-refresh-chart")
def hook_update_data(sender, instance, *args, **kwargs):
... | import logging
from . import tasks
from django.db.models.signals import post_save
from django.dispatch import receiver
logger = logging.getLogger(__name__)
@receiver(post_save, sender="quickstats.Sample", dispatch_uid="quickstats-refresh-chart")
def hook_update_chart(sender, instance, *args, **kwargs):
... | Make unique names for signal functions | Make unique names for signal functions
| Python | mit | kfdm/django-simplestats,kfdm/django-simplestats |
171974ab9c069abe14c25ef220f683d4905d1454 | socorro/external/rabbitmq/rmq_new_crash_source.py | socorro/external/rabbitmq/rmq_new_crash_source.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from configman import Namespace, RequiredConfig
from configman.converters import class_converter
from functools import ... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from configman import Namespace, RequiredConfig
from configman.converters import class_converter
from functools import ... | Correct docs on RabbitMQ crash source. | Correct docs on RabbitMQ crash source.
| Python | mpl-2.0 | linearregression/socorro,linearregression/socorro,Serg09/socorro,Serg09/socorro,linearregression/socorro,m8ttyB/socorro,Serg09/socorro,luser/socorro,twobraids/socorro,lonnen/socorro,bsmedberg/socorro,AdrianGaudebert/socorro,cliqz/socorro,yglazko/socorro,pcabido/socorro,lonnen/socorro,twobraids/socorro,bsmedberg/socorro... |
5a2673366224751e675b894c13a2152c50d28e87 | fileupload/urls.py | fileupload/urls.py | # encoding: utf-8
from django.conf.urls import patterns, url
from fileupload.views import (
BasicVersionCreateView, BasicPlusVersionCreateView,
jQueryVersionCreateView, AngularVersionCreateView,
PictureCreateView, PictureDeleteView, PictureListView,
)
urlpatterns = patterns('',
url(... | # encoding: utf-8
from django.conf.urls import patterns, url
from fileupload.views import (
BasicVersionCreateView, BasicPlusVersionCreateView,
jQueryVersionCreateView, AngularVersionCreateView,
PictureCreateView, PictureDeleteView, PictureListView,
)
from django.http import HttpResponse... | Update to redirect /upload/ to /upload/basic/plus/ | Update to redirect /upload/ to /upload/basic/plus/
| Python | bsd-2-clause | ankeshanand/benchmark,ankeshanand/benchmark,ankeshanand/benchmark,ankeshanand/benchmark |
b627efe0675b2b1965eeac7104cf3a8f2d675539 | rhcephcompose/main.py | rhcephcompose/main.py | """ rhcephcompose CLI """
from argparse import ArgumentParser
import kobo.conf
from rhcephcompose.compose import Compose
class RHCephCompose(object):
""" Main class for rhcephcompose CLI. """
def __init__(self):
parser = ArgumentParser(description='Generate a compose for RHCS.')
parser.add_... | """ rhcephcompose CLI """
from argparse import ArgumentParser
import kobo.conf
from rhcephcompose.compose import Compose
class RHCephCompose(object):
""" Main class for rhcephcompose CLI. """
def __init__(self):
parser = ArgumentParser(description='Generate a compose for RHCS.')
parser.add_... | Add --insecure option to command line to disable SSL certificate verification when communicating with chacra | Add --insecure option to command line to disable SSL certificate verification when communicating with chacra
| Python | mit | red-hat-storage/rhcephcompose,red-hat-storage/rhcephcompose |
ffce8ea9bda95945e335fef75ba93b1066c795ac | doc/quickstart/testlibs/LoginLibrary.py | doc/quickstart/testlibs/LoginLibrary.py | import os
import sys
class LoginLibrary:
def __init__(self):
self._sut_path = os.path.join(os.path.dirname(__file__),
'..', 'sut', 'login.py')
self._status = ''
def create_user(self, username, password):
self._run_command('create', username, pass... | import os
import sys
import subprocess
class LoginLibrary:
def __init__(self):
self._sut_path = os.path.join(os.path.dirname(__file__),
'..', 'sut', 'login.py')
self._status = ''
def create_user(self, username, password):
self._run_command('creat... | Use subprocess isntead of popen to get Jython working too | Use subprocess isntead of popen to get Jython working too
--HG--
extra : convert_revision : svn%3A79c32731-664e-0410-8185-e51b9e89f9fb/trunk%403645
| Python | apache-2.0 | Senseg/robotframework,userzimmermann/robotframework-python3,Senseg/robotframework,userzimmermann/robotframework-python3,Senseg/robotframework,userzimmermann/robotframework-python3,userzimmermann/robotframework-python3,userzimmermann/robotframework-python3,Senseg/robotframework,Senseg/robotframework |
9d759bc8f7980ad4fa9707b2d6425ceac616460a | backend/post_handler/__init__.py | backend/post_handler/__init__.py | from flask import Flask
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def hello():
from flask import request
# print dir(request)
print request.values
print request.form.get('sdp')
return 'ok'
if __name__ == "__main__":
app.run('0.0.0.0')
| from flask import Flask
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def hello():
from flask import request
# print dir(request)
# print request.values
sdp_headers = request.form.get('sdp')
with open('./stream.sdp', 'w') as f:
f.write(sdp_headers)
cmd = "ffmpeg -i s... | Add handling of incoming requests to post_handler | Add handling of incoming requests to post_handler
| Python | mit | optimus-team/optimus-video,optimus-team/optimus-video,optimus-team/optimus-video,optimus-team/optimus-video |
2ccb6b1d1beddede7e98eabeeef0219bff293638 | calvin/calvinsys/sensors/distance.py | calvin/calvinsys/sensors/distance.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Ericsson AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Ericsson AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | Add default value to _has_data | Add default value to _has_data
| Python | apache-2.0 | EricssonResearch/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,les69/calvin-base,les69/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base |
552283714c329e3a304cd8a8bc14e5370fa6a879 | cosmo_tester/framework/constants.py | cosmo_tester/framework/constants.py | CLOUDIFY_TENANT_HEADER = 'Tenant'
SUPPORTED_RELEASES = [
'5.0.5',
'5.1.0',
'5.1.1',
'5.1.2',
'5.1.3',
'5.1.4',
'5.2.0',
'5.2.1',
'6.0.0',
'master',
]
SUPPORTED_FOR_RPM_UPGRADE = [
version + '-ga'
for version in SUPPORTED_RELEASES
if version not in ('master', '5.0.5'... | CLOUDIFY_TENANT_HEADER = 'Tenant'
SUPPORTED_RELEASES = [
'5.0.5',
'5.1.0',
'5.1.1',
'5.1.2',
'5.1.3',
'5.1.4',
'5.2.0',
'5.2.1',
'5.2.2',
'6.0.0',
'master',
]
SUPPORTED_FOR_RPM_UPGRADE = [
version + '-ga'
for version in SUPPORTED_RELEASES
if version not in ('mas... | Add 5.2.2 to supported versions | Add 5.2.2 to supported versions
| Python | apache-2.0 | cloudify-cosmo/cloudify-system-tests,cloudify-cosmo/cloudify-system-tests |
7848338fd8c1a73c8371617fc4b72a139380cc50 | blaze/expr/tests/test_strings.py | blaze/expr/tests/test_strings.py | import datashape
from blaze.expr import TableSymbol, like, Like
def test_like():
t = TableSymbol('t', '{name: string, amount: int, city: string}')
expr = like(t, name='Alice*')
assert eval(str(expr)).isidentical(expr)
assert expr.schema == t.schema
assert expr.dshape[0] == datashape.var
| import datashape
import pytest
from datashape import dshape
from blaze import symbol
@pytest.mark.parametrize(
'ds',
[
'var * {name: string}',
'var * {name: ?string}',
'var * string',
'var * ?string',
'string',
]
)
def test_like(ds):
t = symbol('t', ds)
exp... | Test for new like expression | Test for new like expression
| Python | bsd-3-clause | ContinuumIO/blaze,cpcloud/blaze,ContinuumIO/blaze,cpcloud/blaze,cowlicks/blaze,cowlicks/blaze |
de31fba90a541f272868d5868b402af3d2902ecc | labonneboite/common/maps/constants.py | labonneboite/common/maps/constants.py | ISOCHRONE_DURATIONS_MINUTES = (15, 30, 45)
CAR_MODE = 'car'
PUBLIC_MODE = 'public'
DEFAULT_TRAVEL_MODE = CAR_MODE
TRAVEL_MODES = (
PUBLIC_MODE,
CAR_MODE,
)
TRAVEL_MODES_FRENCH = {
CAR_MODE: 'Voiture',
PUBLIC_MODE: 'Transports en commun',
}
| ENABLE_CAR_MODE = True
ENABLE_PUBLIC_MODE = True
ISOCHRONE_DURATIONS_MINUTES = (15, 30, 45)
CAR_MODE = 'car'
PUBLIC_MODE = 'public'
TRAVEL_MODES = ()
if ENABLE_PUBLIC_MODE:
TRAVEL_MODES += (PUBLIC_MODE,)
if ENABLE_CAR_MODE:
TRAVEL_MODES += (CAR_MODE,)
if ENABLE_CAR_MODE:
DEFAULT_TRAVEL_MODE = CAR_MODE
e... | Add option to enable/disable each travel_mode | Add option to enable/disable each travel_mode
| Python | agpl-3.0 | StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite |
597451a5c33fb9f18f599627fb4a1e72daf08b90 | django/__init__.py | django/__init__.py | VERSION = (1, 0, 'post-release-SVN')
def get_version():
"Returns the version as a human-format string."
v = '.'.join([str(i) for i in VERSION[:-1]])
if VERSION[-1]:
from django.utils.version import get_svn_revision
v = '%s-%s-%s' % (v, VERSION[-1], get_svn_revision())
return v
| VERSION = (1, 1, 0, 'alpha', 0)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
version = '%s %s' % (version, VERSION[3])
if ... | Update django.VERSION in trunk per previous discussion | Update django.VERSION in trunk per previous discussion
git-svn-id: 554f83ef17aa7291f84efa897c1acfc5d0035373@9103 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| Python | bsd-3-clause | svn2github/django,svn2github/django,svn2github/django |
7ca12bb0d2b687c41f9e3b304cc2d7be37ca7a8d | tests/_test_mau_a_vs_an.py | tests/_test_mau_a_vs_an.py | """Unit tests for MAU101."""
from check import Check
from proselint.checks.garner import a_vs_an as chk
class TestCheck(Check):
"""Test garner.a_vs_n."""
__test__ = True
@property
def this_check(self):
"""Boilerplate."""
return chk
def test(self):
"""Ensure the test wo... | """Unit tests for MAU101."""
from check import Check
from proselint.checks.garner import a_vs_an as chk
class TestCheck(Check):
"""Test garner.a_vs_n."""
__test__ = True
@property
def this_check(self):
"""Boilerplate."""
return chk
def test(self):
"""Ensure the test wo... | Change 'check' to 'passes' in a vs. an check | Change 'check' to 'passes' in a vs. an check
| Python | bsd-3-clause | amperser/proselint,jstewmon/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint |
482c215fc28785c53d252df95709fdd51c1c6679 | tests/frontend/conftest.py | tests/frontend/conftest.py | import pytest
import config
from skylines import model, create_frontend_app
from skylines.app import SkyLines
from tests import setup_app, setup_db, teardown_db, clean_db
from tests.data.bootstrap import bootstrap
@pytest.yield_fixture(scope="session")
def frontend_app():
"""Set up global front-end app for funct... | import pytest
import config
from skylines import model, create_frontend_app
from skylines.app import SkyLines
from tests import setup_app, setup_db, teardown_db, clean_db
from tests.data.bootstrap import bootstrap
@pytest.yield_fixture(scope="session")
def app():
"""Set up global front-end app for functional tes... | Rename frontend_app fixture to app | tests/frontend: Rename frontend_app fixture to app
| Python | agpl-3.0 | snip/skylines,Turbo87/skylines,shadowoneau/skylines,shadowoneau/skylines,Harry-R/skylines,Harry-R/skylines,RBE-Avionik/skylines,skylines-project/skylines,shadowoneau/skylines,RBE-Avionik/skylines,Turbo87/skylines,kerel-fs/skylines,snip/skylines,TobiasLohner/SkyLines,skylines-project/skylines,TobiasLohner/SkyLines,RBE-A... |
18cd04d24965d173a98ebb4e7425344a1992bcce | tests/test_ecdsa.py | tests/test_ecdsa.py | import pytest
import unittest
from graphenebase.ecdsa import (
sign_message,
verify_message
)
wif = "5J4KCbg1G3my9b9hCaQXnHSm6vrwW9xQTJS6ZciW2Kek7cCkCEk"
class Testcases(unittest.TestCase):
# Ignore warning:
# https://www.reddit.com/r/joinmarket/comments/5crhfh/userwarning_implicit_cast_from_char_t... | import pytest
import unittest
from binascii import hexlify, unhexlify
import graphenebase.ecdsa as ecdsa
from graphenebase.account import PrivateKey, PublicKey, Address
wif = "5J4KCbg1G3my9b9hCaQXnHSm6vrwW9xQTJS6ZciW2Kek7cCkCEk"
class Testcases(unittest.TestCase):
# Ignore warning:
# https://www.reddit.com/... | Add unit test for cryptography and secp256k1 | Add unit test for cryptography and secp256k1
| Python | mit | xeroc/python-graphenelib |
832fecfe5bfc8951c0d302c2f913a81acfbc657c | solarnmf_main_ts.py | solarnmf_main_ts.py | #solarnmf_main_ts.py
#Will Barnes
#31 March 2015
#Import needed modules
import solarnmf_functions as snf
import solarnmf_plot_routines as spr
#Read in and format the time series
results = snf.make_t_matrix("simulation",format="timeseries",filename='/home/wtb2/Desktop/gaussian_test.dat')
#Get the dimensions of the T... | #solarnmf_main_ts.py
#Will Barnes
#31 March 2015
#Import needed modules
import solarnmf_functions as snf
import solarnmf_plot_routines as spr
#Read in and format the time series
results = snf.make_t_matrix("simulation",format="timeseries",nx=100,ny=100,p=10,filename='/home/wtb2/Desktop/gaussian_test.dat')
#Get the ... | Fix for input options in make_t_matrix function | Fix for input options in make_t_matrix function
| Python | mit | wtbarnes/solarnmf |
311dfdc28bda253e20d09c84a3ba739f5e9be7ef | tests/utils_test.py | tests/utils_test.py | import datetime
import json
import unittest
from clippings.utils import DatetimeJSONEncoder
DATE = datetime.datetime(2016, 1, 2, 3, 4, 5)
DATE_STRING = "2016-01-02T03:04:05"
class DatetimeJSONEncoderTest(unittest.TestCase):
def test_datetime_encoder_format(self):
dictionary = {"now": DATE}
exp... | import datetime
import json
import pytest
from clippings.utils import DatetimeJSONEncoder
DATE = datetime.datetime(2016, 1, 2, 3, 4, 5)
DATE_STRING = "2016-01-02T03:04:05"
def test_datetime_encoder_format():
dictionary = {"now": DATE}
expected_json_string = json.dumps({"now": DATE_STRING})
json_string... | Convert parser tests to pytest | Convert parser tests to pytest
| Python | mit | samueldg/clippings |
2f9c912c9071a498feb8d9cca69e447ffec397be | polygamy/pygit2_git.py | polygamy/pygit2_git.py | from __future__ import absolute_import
import pygit2
from .base_git import NoSuchRemote
from .plain_git import PlainGit
class Pygit2Git(PlainGit):
@staticmethod
def is_on_branch(path):
repo = pygit2.Repository(path)
return not (repo.head_is_detached or repo.head_is_unborn)
@staticmetho... | from __future__ import absolute_import
import pygit2
from .base_git import NoSuchRemote
from .plain_git import PlainGit
class Pygit2Git(PlainGit):
@staticmethod
def _find_remote(repo, remote_name):
for remote in repo.remotes:
if remote.name == remote_name:
return remote
... | Implement set_remote_url in pygit2 implementation | Implement set_remote_url in pygit2 implementation
| Python | bsd-3-clause | solarnz/polygamy,solarnz/polygamy |
cc51f18f0c123ed9ef68b35264f0e1f53ae22588 | index_addresses.py | index_addresses.py | import csv
import re
from elasticsearch import Elasticsearch
es = Elasticsearch({'host': ELASTICSEARCH_URL})
with open('data/ParcelCentroids.csv', 'r') as csvfile:
print "open file"
csv_reader = csv.DictReader(csvfile, fieldnames=[], restkey='undefined-fieldnames', delimiter=',')
current_row = 0
for row in c... | import csv
import re
import os
from elasticsearch import Elasticsearch
es = Elasticsearch({'host': os.environ['ELASTICSEARCH_URL']})
with open('data/ParcelCentroids.csv', 'r') as csvfile:
print "open file"
csv_reader = csv.DictReader(csvfile, fieldnames=[], restkey='undefined-fieldnames', delimiter=',')
curren... | Add correct syntax for environment variable | Add correct syntax for environment variable
| Python | mit | codeforamerica/streetscope,codeforamerica/streetscope |
57318652ba9aacc0456334a1d6466734f35ab84d | e2etest/e2etest.py | e2etest/e2etest.py | #!/usr/bin/env python
# coding: utf-8
"""Run the end to end tests of the project."""
__author__ = "Martha Brennich"
__license__ = "MIT"
__copyright__ = "2020"
__date__ = "11/07/2020"
import sys
import unittest
import e2etest_freesas, e2etest_guinier_apps, e2etest_bift
def suite():
"""Creates suite for e2e test... | #!/usr/bin/env python
# coding: utf-8
"""Run the end to end tests of the project."""
__author__ = "Martha Brennich"
__license__ = "MIT"
__copyright__ = "2020"
__date__ = "11/07/2020"
import sys
import unittest
import e2etest_freesas, e2etest_guinier_apps, e2etest_bift, e2etest_cormap
def suite():
"""Creates su... | Add cormapy test suite to e2e test suite | Add cormapy test suite to e2e test suite
| Python | mit | kif/freesas,kif/freesas,kif/freesas |
d0703be1d6adf6466f8c2120334a703210697176 | GCodeWriter.py | GCodeWriter.py | from UM.Mesh.MeshWriter import MeshWriter
from UM.Logger import Logger
import io
class GCodeWriter(MeshWriter):
def __init__(self):
super().__init__()
self._gcode = None
def write(self, file_name, storage_device, mesh_data):
if 'gcode' in file_name:
gcode = getattr(mesh_dat... | from UM.Mesh.MeshWriter import MeshWriter
from UM.Logger import Logger
from UM.Application import Application
import io
class GCodeWriter(MeshWriter):
def __init__(self):
super().__init__()
self._gcode = None
def write(self, file_name, storage_device, mesh_data):
if 'gcode' in file_na... | Use the new CuraEngine GCode protocol instead of temp files. | Use the new CuraEngine GCode protocol instead of temp files.
| Python | agpl-3.0 | ynotstartups/Wanhao,lo0ol/Ultimaker-Cura,senttech/Cura,ad1217/Cura,lo0ol/Ultimaker-Cura,Curahelper/Cura,quillford/Cura,derekhe/Cura,totalretribution/Cura,quillford/Cura,ynotstartups/Wanhao,fieldOfView/Cura,fieldOfView/Cura,ad1217/Cura,markwal/Cura,bq/Ultimaker-Cura,fxtentacle/Cura,fxtentacle/Cura,hmflash/Cura,derekhe/C... |
6ee261309f4492994b52403d485bdfd08739a072 | kolibri/utils/tests/test_handler.py | kolibri/utils/tests/test_handler.py | import os
from time import sleep
from django.conf import settings
from django.test import TestCase
from kolibri.utils import cli
class KolibriTimedRotatingFileHandlerTestCase(TestCase):
def test_do_rollover(self):
archive_dir = os.path.join(os.environ["KOLIBRI_HOME"], "logs", "archive")
orig_val... | import os
from time import sleep
from django.conf import settings
from django.test import TestCase
from kolibri.utils import cli
class KolibriTimedRotatingFileHandlerTestCase(TestCase):
def test_do_rollover(self):
archive_dir = os.path.join(os.environ["KOLIBRI_HOME"], "logs", "archive")
orig_val... | Fix argument ordering in log handler test. | Fix argument ordering in log handler test.
| Python | mit | indirectlylit/kolibri,indirectlylit/kolibri,mrpau/kolibri,learningequality/kolibri,mrpau/kolibri,indirectlylit/kolibri,learningequality/kolibri,learningequality/kolibri,mrpau/kolibri,learningequality/kolibri,mrpau/kolibri,indirectlylit/kolibri |
dc4511324bcd518dfceb828eacd72b64a5442468 | tests/test_wolfram_alpha.py | tests/test_wolfram_alpha.py | # -*- coding: utf-8 -*-
from nose.tools import eq_
import bot_mock
from pyfibot.modules import module_wolfram_alpha
config = {"module_wolfram_alpha":
{"appid": "3EYA3R-WVR6GJQWLH"}} # unit-test only APPID, do not abuse kthxbai
bot = bot_mock.BotMock(config)
def test_simple():
module_wolfram_alpha.in... | # -*- coding: utf-8 -*-
from nose.tools import eq_
import bot_mock
from pyfibot.modules import module_wolfram_alpha
config = {"module_wolfram_alpha":
{"appid": "3EYA3R-WVR6GJQWLH"}} # unit-test only APPID, do not abuse kthxbai
bot = bot_mock.BotMock(config)
def test_simple():
module_wolfram_alpha.in... | Change complex test to one that doesn't have a localizable response | Change complex test to one that doesn't have a localizable response
| Python | bsd-3-clause | lepinkainen/pyfibot,rnyberg/pyfibot,lepinkainen/pyfibot,EArmour/pyfibot,aapa/pyfibot,aapa/pyfibot,huqa/pyfibot,huqa/pyfibot,rnyberg/pyfibot,EArmour/pyfibot |
292ee86bb7c21c3bc99ff04176592b74aa5b1e85 | docs/config/all.py | docs/config/all.py | # -*- coding: utf-8 -*-
#
# Phinx documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 14 17:39:42 2012.
#
# Import the base theme configuration
from cakephpsphinx.config.all import *
# The full version, including alpha/beta/rc tags.
release = '0.12.x'
# The search index version.
search_... | # -*- coding: utf-8 -*-
#
# Phinx documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 14 17:39:42 2012.
#
# Import the base theme configuration
from cakephpsphinx.config.all import *
# The full version, including alpha/beta/rc tags.
release = '0.12.x'
# The search index version.
search_... | Update docs config for 0.12 | Update docs config for 0.12 | Python | mit | robmorgan/phinx |
d191a947e34e4d6eee1965f4896a44efc8c7ae91 | feedback/views.py | feedback/views.py | from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from feedback.forms import FeedbackForm
def leave_feedback(request):
form = FeedbackForm(request.POST or None)
if form.is_valid():
feedback = form.save(commit=False)
... | from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from feedback.forms import FeedbackForm
def leave_feedback(request, template_name='feedback/feedback_form.html'):
form = FeedbackForm(request.POST or None)
if form.is_valid()... | Allow passing of template_name to view | Allow passing of template_name to view
| Python | bsd-3-clause | girasquid/django-feedback |
8074fca48f6a7246f26471ecdc14633d78475d8c | opps/articles/utils.py | opps/articles/utils.py | # -*- coding: utf-8 -*-
from opps.articles.models import ArticleBox
def set_context_data(self, SUPER, **kwargs):
context = super(SUPER, self).get_context_data(**kwargs)
context['articleboxes'] = ArticleBox.objects.filter(
channel__long_slug=self.long_slug)
if self.slug:
context['articlebo... | # -*- coding: utf-8 -*-
from opps.articles.models import ArticleBox
def set_context_data(self, SUPER, **kwargs):
context = super(SUPER, self).get_context_data(**kwargs)
context['channel_long_slug'] = self.long_slug
context['articleboxes'] = ArticleBox.objects.filter(
channel__long_slug=self.long_... | Add context channel_long_slug on articles | Add context channel_long_slug on articles
| Python | mit | opps/opps,williamroot/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,opps/opps,williamroot/opps,opps/opps,williamroot/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps |
4ce3685ec4aab479a4d8c7a1d41d7028285c1656 | laalaa/apps/advisers/healthchecks.py | laalaa/apps/advisers/healthchecks.py | from django.conf import settings
from moj_irat.healthchecks import HealthcheckResponse, UrlHealthcheck, registry
def get_stats():
from celery import Celery
app = Celery("laalaa")
app.config_from_object("django.conf:settings")
return app.control.inspect().stats()
class CeleryWorkersHealthcheck(objec... | from django.conf import settings
from moj_irat.healthchecks import HealthcheckResponse, UrlHealthcheck, registry
def get_stats():
from celery import Celery
app = Celery("laalaa")
app.config_from_object("django.conf:settings", namespace="CELERY")
return app.control.inspect().stats()
class CeleryWork... | Load namespaced Celery configuration in healthcheck | Load namespaced Celery configuration in healthcheck
In bed52d9c60b00be751a6a9a6fc78b333fc5bccf6, I had to change the
configuration to be compatible with Django. I completely missed this
part.
Unfortunately, the test for this module starts with mocking the
`get_stats()` function, where this code exists, so I am at los... | Python | mit | ministryofjustice/laa-legal-adviser-api,ministryofjustice/laa-legal-adviser-api,ministryofjustice/laa-legal-adviser-api |
4a4da808289ad2edd6549cca921fbfd8fa4049c9 | corehq/apps/es/tests/test_sms.py | corehq/apps/es/tests/test_sms.py | from django.test.testcases import SimpleTestCase
from corehq.apps.es.sms import SMSES
from corehq.apps.es.tests.utils import ElasticTestMixin
from corehq.elastic import SIZE_LIMIT
class TestSMSES(ElasticTestMixin, SimpleTestCase):
def test_processed_or_incoming(self):
json_output = {
"query":... | from django.test.testcases import SimpleTestCase
from corehq.apps.es.sms import SMSES
from corehq.apps.es.tests.utils import ElasticTestMixin
from corehq.elastic import SIZE_LIMIT
class TestSMSES(ElasticTestMixin, SimpleTestCase):
def test_processed_or_incoming(self):
json_output = {
"query":... | Fix SMS ES test after not-and rewrite | Fix SMS ES test after not-and rewrite
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq |
257e8d2e6d1dc3c10eb7fc26c3deacaf4133bd9b | enactiveagents/view/agentevents.py | enactiveagents/view/agentevents.py | """
Prints a history of agent events to file.
"""
import events
class AgentEvents(events.EventListener):
"""
View class
"""
def __init__(self, file_path):
"""
:param file_path: The path of the file to output the history to.
"""
self.file_path = file_path
self.p... | """
Prints a history of agent events to file.
"""
import events
import json
class AgentEvents(events.EventListener):
"""
View class
"""
def __init__(self, file_path):
"""
:param file_path: The path of the file to output the history to.
"""
self.file_path = file_path
... | Write agent events to a traces history file for the website. | Write agent events to a traces history file for the website.
| Python | mit | Beskhue/enactive-agents,Beskhue/enactive-agents,Beskhue/enactive-agents |
709bdf06c38ccd9713fb1e92be3102e9b1b1ae59 | nodeconductor/server/test_runner.py | nodeconductor/server/test_runner.py | # This file mainly exists to allow python setup.py test to work.
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'nodeconductor.server.test_settings'
test_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), '..'))
sys.path.insert(0, test_dir)
from django.test.utils import get_ru... | # This file mainly exists to allow python setup.py test to work.
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'nodeconductor.server.test_settings'
test_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), '..'))
sys.path.insert(0, test_dir)
from django.test.utils import get_ru... | Make setup.py test honor migrations | Make setup.py test honor migrations
Kudos to django-setuptest project
| Python | mit | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor |
d562756f6b48366508db6ef9ffb27e3d5c707845 | root/main.py | root/main.py | from .webdriver_util import init
def query_google(keywords):
print("Loading Firefox driver...")
driver, waiter, selector = init()
print("Fetching google front page...")
driver.get("http://google.com")
print("Taking a screenshot...")
waiter.shoot("frontpage")
print("Typing query string..... | from .webdriver_util import init
def query_google(keywords):
print("Loading Firefox driver...")
driver, waiter, selector, datapath = init()
print("Fetching google front page...")
driver.get("http://google.com")
print("Taking a screenshot...")
waiter.shoot("frontpage")
print("Typing quer... | Fix bug in example code | Fix bug in example code
Fixes:
line 6, in query_google
driver, waiter, selector = init()
ValueError: too many values to unpack (expected 3) | Python | apache-2.0 | weihanwang/webdriver-python,weihanwang/webdriver-python |
f0c590ef5d8ae98ee10e9c985cf14e626a9ca835 | zou/app/models/task_type.py | zou/app/models/task_type.py | from sqlalchemy_utils import UUIDType
from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin
class TaskType(db.Model, BaseMixin, SerializerMixin):
"""
Categorize tasks in domain areas: modeling, animation, etc.
"""
name = db.Column(db.St... | from sqlalchemy_utils import UUIDType
from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin
class TaskType(db.Model, BaseMixin, SerializerMixin):
"""
Categorize tasks in domain areas: modeling, animation, etc.
"""
name = db.Column(db.St... | Add allow_timelog to task type model | Add allow_timelog to task type model
| Python | agpl-3.0 | cgwire/zou |
ae70502f910c85f6a4528b487eea3b535cec6c39 | frappe/desk/doctype/tag/test_tag.py | frappe/desk/doctype/tag/test_tag.py | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
# import frappe
import unittest
class TestTag(unittest.TestCase):
pass
| import unittest
import frappe
from frappe.desk.reportview import get_stats
from frappe.desk.doctype.tag.tag import add_tag
class TestTag(unittest.TestCase):
def setUp(self) -> None:
frappe.db.sql("DELETE from `tabTag`")
frappe.db.sql("UPDATE `tabDocType` set _user_tags=''")
def test_tag_count_query(self):
se... | Add test case to validate tag count query | test: Add test case to validate tag count query
| Python | mit | mhbu50/frappe,almeidapaulopt/frappe,yashodhank/frappe,almeidapaulopt/frappe,mhbu50/frappe,almeidapaulopt/frappe,yashodhank/frappe,StrellaGroup/frappe,frappe/frappe,frappe/frappe,StrellaGroup/frappe,yashodhank/frappe,frappe/frappe,almeidapaulopt/frappe,yashodhank/frappe,StrellaGroup/frappe,mhbu50/frappe,mhbu50/frappe |
a7c210a68a8671137681c55324341c60b256a92b | symantecssl/core.py | symantecssl/core.py | from __future__ import absolute_import, division, print_function
from .auth import SymantecAuth
from .session import SymantecSession
class Symantec(object):
def __init__(self, username, password,
url="https://api.geotrust.com/webtrust/partner"):
self.url = url
self.session = Sym... | from __future__ import absolute_import, division, print_function
from .auth import SymantecAuth
from .order import Order
from .session import SymantecSession
class Symantec(object):
def __init__(self, username, password,
url="https://api.geotrust.com/webtrust/partner"):
self.url = url
... | Add a slightly higher level API for submitting an order | Add a slightly higher level API for submitting an order
| Python | apache-2.0 | glyph/symantecssl,chelseawinfree/symantecssl,cloudkeep/symantecssl,grigouze/symantecssl,jmvrbanac/symantecssl |
1062ef4daf124f0dcc056c1e95b7a234642fb36d | mopidy/backends/__init__.py | mopidy/backends/__init__.py | import logging
import time
from mopidy.exceptions import MpdNotImplemented
from mopidy.models import Playlist
logger = logging.getLogger('backends.base')
class BaseBackend(object):
current_playlist = None
library = None
playback = None
stored_playlists = None
uri_handlers = []
class BaseCurrentP... | import logging
import time
from mopidy.exceptions import MpdNotImplemented
from mopidy.models import Playlist
logger = logging.getLogger('backends.base')
class BaseBackend(object):
current_playlist = None
library = None
playback = None
stored_playlists = None
uri_handlers = []
class BaseCurrentP... | Add playlist attribute to playlist controller | Add playlist attribute to playlist controller
| Python | apache-2.0 | vrs01/mopidy,dbrgn/mopidy,pacificIT/mopidy,kingosticks/mopidy,bacontext/mopidy,hkariti/mopidy,liamw9534/mopidy,rawdlite/mopidy,quartz55/mopidy,pacificIT/mopidy,tkem/mopidy,bacontext/mopidy,mopidy/mopidy,ZenithDK/mopidy,glogiotatidis/mopidy,rawdlite/mopidy,jmarsik/mopidy,jmarsik/mopidy,jcass77/mopidy,woutervanwijk/mopid... |
3a8a7661c0aad111dbaace178062352b30f7fac5 | numcodecs/tests/__init__.py | numcodecs/tests/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
| # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import pytest
pytest.register_assert_rewrite('numcodecs.tests.common')
| Enable pytest rewriting in test helper functions. | Enable pytest rewriting in test helper functions.
| Python | mit | alimanfoo/numcodecs,zarr-developers/numcodecs,alimanfoo/numcodecs |
535d1f1ea3f229a0831830c4d19e7547e2b2ddab | cosmic/__init__.py | cosmic/__init__.py | from werkzeug.local import LocalProxy, LocalStack
from flask import request
from .models import _ctx_stack, Cosmos
_global_cosmos = Cosmos()
def _get_current_cosmos():
if _ctx_stack.top != None:
return _ctx_stack.top
else:
return _global_cosmos
cosmos = LocalProxy(_get_current_cosmos)
| from werkzeug.local import LocalProxy, LocalStack
from flask import request
from .models import _ctx_stack, Cosmos
import teleport
_global_cosmos = Cosmos()
# Temporary hack.
teleport._global_map = _global_cosmos
def _get_current_cosmos():
if _ctx_stack.top != None:
return _ctx_stack.top
else:
... | Add temporary hack to make teleport work with global Cosmos context | Add temporary hack to make teleport work with global Cosmos context
| Python | mit | cosmic-api/cosmic.py |
e1043bfb410740ab3429ff659e78197b44fefb74 | extract_options.py | extract_options.py | from pymongo import MongoClient
def main():
client = MongoClient()
db = client.cityhotspots
db.drop_collection('dineroptions')
diners_collection = db.diners
doc = {}
diner_options_collection = db.dineroptions
doc['categories'] = diners_collection.distinct('category')
doc['categories']... | from pymongo import MongoClient
def main():
client = MongoClient()
db = client.cityhotspots
db.drop_collection('dineroptions')
diners_collection = db.diners
doc = {}
diner_options_collection = db.dineroptions
doc['categories'] = diners_collection.distinct('category')
doc['categories']... | Change get min, max value method | Change get min, max value method
| Python | mit | earlwlkr/POICrawler |
bf0990f1e5dda5e78c859dd625638357da5b1ef4 | sir/schema/modelext.py | sir/schema/modelext.py | # Copyright (c) 2014 Lukas Lalinsky, Wieland Hoffmann
# License: MIT, see LICENSE for details
from mbdata.models import Area, Artist, Label, Recording, ReleaseGroup, Work
from sqlalchemy import exc as sa_exc
from sqlalchemy.orm import relationship
from warnings import simplefilter
# Ignore SQLAlchemys warnings that we... | # Copyright (c) 2014 Lukas Lalinsky, Wieland Hoffmann
# License: MIT, see LICENSE for details
from mbdata.models import Area, Artist, Label, LinkAttribute, Recording, ReleaseGroup, Work
from sqlalchemy import exc as sa_exc
from sqlalchemy.orm import relationship
from warnings import simplefilter
# Ignore SQLAlchemys w... | Add a backref from Link to LinkAttribute | Add a backref from Link to LinkAttribute
| Python | mit | jeffweeksio/sir |
d6bfac0ac2bc27c8d809467ed6071c5c9a7f5579 | client_test_run.py | client_test_run.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
import unittest
import argparse
"""
Use this script either without arguments to run all tests:
python client_test_run.py
or with specific module/test to run on... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
import unittest
import argparse
import sys
"""
Use this script either without arguments to run all tests:
python client_test_run.py
or with specific module/tes... | Exit with 1 if client tests fail | Exit with 1 if client tests fail
| Python | mit | lao605/product-definition-center,xychu/product-definition-center,product-definition-center/product-definition-center,release-engineering/product-definition-center,product-definition-center/product-definition-center,pombredanne/product-definition-center,lao605/product-definition-center,pombredanne/product-definition-cen... |
10dc45d8e5fea60066b6719b2588fb65566a012f | dakis/api/views.py | dakis/api/views.py | from rest_framework import serializers, viewsets
from rest_framework import filters
from django.contrib.auth.models import User
from dakis.core.models import Experiment, Task
class ExperimentSerializer(serializers.HyperlinkedModelSerializer):
id = serializers.IntegerField(label='ID', read_only=True)
class ... | from rest_framework import serializers, viewsets
from rest_framework import filters
from django.contrib.auth.models import User
from dakis.core.models import Experiment, Task
class ExperimentSerializer(serializers.HyperlinkedModelSerializer):
id = serializers.IntegerField(label='ID', read_only=True)
class ... | Remove deprecated experiment details field from api | Remove deprecated experiment details field from api
| Python | agpl-3.0 | niekas/dakis,niekas/dakis,niekas/dakis |
19952d7f437270065a693dc886c867329ec7c4a0 | startzone.py | startzone.py | import xmlrpclib
from supervisor.xmlrpc import SupervisorTransport
def start_zone(port=1300, zoneid="defaultzone", processgroup='zones', autorestart=False):
s = xmlrpclib.ServerProxy('http://localhost:9001')
import socket
try:
version = s.twiddler.getAPIVersion()
except(socket.error), exc:
... | import xmlrpclib
from supervisor.xmlrpc import SupervisorTransport
def start_zone(port=1300, zoneid="defaultzone", processgroup='zones', autorestart=False):
s = xmlrpclib.ServerProxy('http://localhost:9001')
import socket
try:
version = s.twiddler.getAPIVersion()
except(socket.error), exc:
... | Fix up some settings for start_zone() | Fix up some settings for start_zone()
| Python | agpl-3.0 | cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO |
e85d0b100bd907ddf82f4c5e132690000d8cb4a0 | smart_open/__init__.py | smart_open/__init__.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
#
"""
Utilities for streaming to/from several file-like data storages: S3 / HDFS / local
filesystem / compressed files, and many more, using a sim... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
#
"""
Utilities for streaming to/from several file-like data storages: S3 / HDFS / local
filesystem / compressed files, and many more, using a sim... | Revert "Configure logging handlers before submodule imports" | Revert "Configure logging handlers before submodule imports"
This reverts commit d9ce6cc440019ecfc73f1c82e41da4e9ce02a234.
| Python | mit | RaRe-Technologies/smart_open,RaRe-Technologies/smart_open,piskvorky/smart_open |
4bc34f0b8adfc22037475cbdafbb149b7ea88421 | tests/test_utils.py | tests/test_utils.py | import sys
from girder_worker.utils import TeeStdOutCustomWrite, TeeStdErrCustomWrite, JobManager
def test_TeeStdOutCustomeWrite(capfd):
_nonlocal = {'data': ''}
def _append_to_data(message, **kwargs):
_nonlocal['data'] += message
with TeeStdOutCustomWrite(_append_to_data):
sys.stdout.wr... | import sys
from girder_worker.utils import TeeStdOutCustomWrite
def test_TeeStdOutCustomWrite(capfd):
nonlocal_ = {'data': ''}
def _append_to_data(message, **kwargs):
nonlocal_['data'] += message
with TeeStdOutCustomWrite(_append_to_data):
sys.stdout.write('Test String')
sys.stdo... | Test TeeStdOutCustomWrite writes through to stdout | Test TeeStdOutCustomWrite writes through to stdout
| Python | apache-2.0 | girder/girder_worker,girder/girder_worker,girder/girder_worker |
ff6502fd8ecc4ee28cb05cb7ee8f11f75240ce47 | mini_project.py | mini_project.py | # Load the machine
import pkg_resources
pkg_resources.require('aphla')
import aphla as ap
# Other stuff
from cothread.catools import caget, caput, ca_nothing
# Load the machine
ap.machines.load('SRI21')
# First task
BPMS = ap.getElements('BPM')
print('There are {} BPM elements in the machine.'.format(len(BPMS)))
# S... | # Load the machine
import pkg_resources
pkg_resources.require('aphla')
import aphla as ap
# Other stuff
from cothread.catools import caget, caput, ca_nothing
# Load the machine
ap.machines.load('SRI21')
# First task
BPMS = ap.getElements('BPM')
print('There are {} BPM elements in the machine.'.format(len(BPMS)))
# S... | Make the difference between PV names and values clearer. | Make the difference between PV names and values clearer.
| Python | apache-2.0 | razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects |
c1c66caa31506190944c8bd37df6fe056b60c0e2 | vote.py | vote.py | import enki
import json
e = enki.Enki('key', 'http://localhost:5001', 'translations')
e.get_all()
tasks = []
for t in e.tasks:
options = dict()
i = 0
for k in e.task_runs_df[t.id]['msgid'].keys():
options[k] = e.task_runs_df[t.id]['msgid'][k]
t.info['msgid_options'] = options
tasks.appen... | import enki
import json
e = enki.Enki('key', 'http://localhost:5001', 'translations')
e.get_all()
tasks = []
for t in e.tasks:
options = []
i = 0
for k in e.task_runs_df[t.id]['msgid'].keys():
option = dict(task_run_id=None, msgid=None)
option['task_run_id'] = k
option['msgid'] ... | Save the tasks in the proper way. | Save the tasks in the proper way.
| Python | agpl-3.0 | PyBossa/app-translations |
01c5a8d0f7e6540995817fecfee124f1859fa448 | mistraldashboard/executions/views.py | mistraldashboard/executions/views.py | # -*- coding: utf-8 -*-
#
# Copyright 2014 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | # -*- coding: utf-8 -*-
#
# Copyright 2014 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | Fix errors when user click execution id | Fix errors when user click execution id
Missing request argument when calling task list
Change-Id: Idc282c267fc99513dd96a80f6f4a745bfefec2c8
Closes-Bug: #1471778
| Python | apache-2.0 | openstack/mistral-dashboard,openstack/mistral-dashboard,openstack/mistral-dashboard |
10360cc4d956faac194c58eb3b52fae2b348b356 | links/functions.py | links/functions.py | from uuid import uuid4
from random import randint
from basic_http import BasicHttp
def random_pk(length=8):
s = uuid4().hex
f = randint(0, (len(s) - length))
t = f + length
return s[f:t]
def get_url_info(url):
print url
req = BasicHttp(url)
print req
res = req.HEAD()
data = {
... | from uuid import uuid4
from random import randint
from basic_http import BasicHttp
def random_pk(length=8):
s = uuid4().hex
f = randint(0, (len(s) - length))
t = f + length
return s[f:t]
def get_url_info(url):
req = BasicHttp(url)
res = req.HEAD()
data = {
'file_name': url.split... | Remove of debug prints. Fix of invalid key name. | Remove of debug prints.
Fix of invalid key name.
| Python | bsd-3-clause | nachopro/followlink,nachopro/followlink |
72384b3f06d4c68a94805e101f6cf4f820157834 | process.py | process.py | # encoding: utf-8
import sys
lines = sys.stdin.readlines()
# Contact details are expected to begin on the fourth line, following the
# header and a blank line, and extend until the next blank line. Lines with
# bullets (•) will be split into separate lines.
contact_lines = []
for line in lines[3:]:
lines.remove... | # encoding: utf-8
import sys
lines = sys.stdin.readlines()
# Contact details are expected to begin on the fourth line, following the
# header and a blank line, and extend until the next blank line. Lines with
# bullets (•) will be split into separate lines.
contact_lines = []
for line in lines[3:]:
lines.remove... | Fix display of tildes in PDF output. | Fix display of tildes in PDF output. | Python | apache-2.0 | davidbradway/resume,davidbradway/resume |
4581f05e937800b0541c219fd82390fdfef7644f | opal/tests/test_updates_from_dict.py | opal/tests/test_updates_from_dict.py | from django.test import TestCase
from django.db import models as djangomodels
from opal.models import UpdatesFromDictMixin
class UpdatesFromDictMixinTest(TestCase):
class TestDiagnosis(UpdatesFromDictMixin, djangomodels.Model):
condition = djangomodels.CharField(max_length=255, blank=True, null=True)
... | from django.test import TestCase
from django.db import models as djangomodels
from opal.models import UpdatesFromDictMixin
class UpdatesFromDictMixinTest(TestCase):
class TestDiagnosis(UpdatesFromDictMixin, djangomodels.Model):
condition = djangomodels.CharField(max_length=255, blank=True, null=True)
... | Add a specific test for the updatesfromdict hard coded foreignkey fields | Add a specific test for the updatesfromdict hard coded foreignkey fields
| Python | agpl-3.0 | khchine5/opal,khchine5/opal,khchine5/opal |
3520217e38849ad18b11245c6cac51d79db8422d | pytablereader/loadermanager/_base.py | pytablereader/loadermanager/_base.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
from ..interface import TableLoaderInterface
class TableLoaderManager(TableLoaderInterface):
def __init__(self, loader):
self.__loader = loader
@property
def loader... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
from ..interface import TableLoaderInterface
class TableLoaderManager(TableLoaderInterface):
def __init__(self, loader):
self.__loader = loader
@property
def loader... | Add an interface to change table_name | Add an interface to change table_name
| Python | mit | thombashi/pytablereader,thombashi/pytablereader,thombashi/pytablereader |
d518c4f8fa7b657c735d5a2b4f653d5c0cad529e | gnotty/templatetags/gnotty_tags.py | gnotty/templatetags/gnotty_tags.py |
from django import template
from django.db.models import Min, Max
from gnotty.models import IRCMessage
from gnotty.conf import settings
register = template.Library()
@register.inclusion_tag("gnotty/includes/nav.html", takes_context=True)
def gnotty_nav(context):
min_max = IRCMessage.objects.aggregate(Min("mes... |
from django import template
from django.db.models import Min, Max
from gnotty.models import IRCMessage
from gnotty.conf import settings
register = template.Library()
@register.inclusion_tag("gnotty/includes/nav.html", takes_context=True)
def gnotty_nav(context):
min_max = IRCMessage.objects.aggregate(Min("mes... | Fix check for empty min/max years. | Fix check for empty min/max years.
| Python | bsd-2-clause | spaceone/gnotty,stephenmcd/gnotty,stephenmcd/gnotty,spaceone/gnotty,stephenmcd/gnotty,spaceone/gnotty |
087b6a623e4a48b76fa3ce62a14298d9744afd2a | go/apps/bulk_message/definition.py | go/apps/bulk_message/definition.py | from go.vumitools.conversation.definition import (
ConversationDefinitionBase, ConversationAction)
class BulkSendAction(ConversationAction):
action_name = 'bulk_send'
action_display_name = 'Write and send bulk message'
action_display_verb = 'Send message'
needs_confirmation = True
needs_grou... | from go.scheduler.models import Task
from go.vumitools.conversation.definition import (
ConversationDefinitionBase, ConversationAction)
class BulkSendAction(ConversationAction):
action_name = 'bulk_send'
action_display_name = 'Write and send bulk message'
action_display_verb = 'Send message now'
a... | Add handling for creating scheduled action for bulk send | Add handling for creating scheduled action for bulk send
| Python | bsd-3-clause | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go |
c38fb74a71b3471f5363cf1aa95fecdd8ac9180f | picoCTF-shell/tests/test_problems.py | picoCTF-shell/tests/test_problems.py | import pytest
from os.path import dirname, join, realpath
import hacksport.deploy
from hacksport.deploy import deploy_problem
from shell_manager.util import default_config
PATH = dirname(realpath(__file__))
hacksport.deploy.deploy_config = default_config
@pytest.mark.skip("Broken tests/not working")
class TestProb... | import pytest
from os.path import dirname, join, realpath
import hacksport.deploy
from hacksport.deploy import deploy_problem
PATH = dirname(realpath(__file__))
@pytest.mark.skip("Broken tests/not working")
class TestProblems:
"""
Regression tests for compiled problems.
"""
def test_compiled_sourc... | Remove broken import in skipped tests | Remove broken import in skipped tests
| Python | mit | royragsdale/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF |
224478e0d69197feb19f2f89c21e884a2e5cb77d | organizer/views.py | organizer/views.py | from django.shortcuts import (
get_object_or_404, render)
from .models import Startup, Tag
def startup_detail(request, slug):
startup = get_object_or_404(
Startup, slug__iexact=slug)
return render(
request,
'organizer/startup_detail.html',
{'startup': startup})
def start... | from django.shortcuts import (
get_object_or_404, render)
from .models import Startup, Tag
def startup_detail(request, slug):
startup = get_object_or_404(
Startup, slug__iexact=slug)
return render(
request,
'organizer/startup_detail.html',
{'startup': startup})
def start... | Add HTTP method condition to tag_create(). | Ch09: Add HTTP method condition to tag_create().
| Python | bsd-2-clause | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 |
271c91a607797bbd9d1a1e179745aedf580e8209 | user/models.py | user/models.py | from django.conf import settings
from django.contrib.auth.models import (
AbstractBaseUser, PermissionsMixin)
from django.core.urlresolvers import reverse
from django.db import models
class Profile(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL)
slug = models.SlugField(
... | from django.conf import settings
from django.contrib.auth.models import (
AbstractBaseUser, PermissionsMixin)
from django.core.urlresolvers import reverse
from django.db import models
class Profile(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL)
name = models.CharField(
... | Add name and joined date field to Profile. | Ch22: Add name and joined date field to Profile.
| Python | bsd-2-clause | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 |
5a05b1cbe258ef18607aabbc276aaccd5f2eb14c | admin_crud/router.py | admin_crud/router.py | from django.apps import apps as dj_apps
from django.conf.urls import include, url
from django.template.response import TemplateResponse
from django.utils.text import capfirst
class Router(object):
def __init__(self):
self.registry = []
self._urls = [
url(r'^$', self.index_view, name='i... | from django.apps import apps as dj_apps
from django.conf.urls import include, url
from django.template.response import TemplateResponse
from django.utils.text import capfirst
class Router(object):
def __init__(self):
self.registry = []
self._urls = [
url(r'^$', self.index_view, name='i... | Rename models to groups for corresponding with method name | Rename models to groups for corresponding with method name
| Python | mit | raizanshine/django-admin-crud,raizanshine/django-admin-crud |
6caca3259f4ec8f298b1d35f15e4492efbcff6b1 | tests/basics/dict1.py | tests/basics/dict1.py | # basic dictionary
d = {}
print(d)
d[2] = 123
print(d)
d = {1:2}
d[3] = 3
print(len(d), d[1], d[3])
d[1] = 0
print(len(d), d[1], d[3])
print(str(d) == '{1: 0, 3: 3}' or str(d) == '{3: 3, 1: 0}')
x = 1
while x < 100:
d[x] = x
x += 1
print(d[50])
# equality operator on dicts of different size
print({} == {1:1}... | # basic dictionary
d = {}
print(d)
d[2] = 123
print(d)
d = {1:2}
d[3] = 3
print(len(d), d[1], d[3])
d[1] = 0
print(len(d), d[1], d[3])
print(str(d) == '{1: 0, 3: 3}' or str(d) == '{3: 3, 1: 0}')
x = 1
while x < 100:
d[x] = x
x += 1
print(d[50])
# equality operator on dicts of different size
print({} == {1:1}... | Add test to print full KeyError exc from failed dict lookup. | tests: Add test to print full KeyError exc from failed dict lookup.
| Python | mit | jmarcelino/pycom-micropython,alex-march/micropython,hiway/micropython,AriZuu/micropython,chrisdearman/micropython,kerneltask/micropython,jmarcelino/pycom-micropython,selste/micropython,tuc-osg/micropython,blazewicz/micropython,oopy/micropython,ryannathans/micropython,micropython/micropython-esp32,trezor/micropython,inf... |
ad346d73a27c021de131ec871dc19da2e17854ee | armstrong/dev/virtualdjango/base.py | armstrong/dev/virtualdjango/base.py | import os, sys
DEFAULT_SETTINGS = {
'DATABASE_ENGINE': 'sqlite3',
'DATABASES': {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'mydatabase'
}
},
}
class VirtualDjango(object):
def __init__(self,
caller=sys.modules['__main__'],
... | import django
import os, sys
DEFAULT_SETTINGS = {
'DATABASE_ENGINE': 'sqlite3',
'DATABASES': {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'mydatabase'
}
},
}
class VirtualDjango(object):
def __init__(self,
caller=sys.modules['_... | Adjust the settings reset to work with Django 1.4 | Adjust the settings reset to work with Django 1.4
Django changed the `settings._wrapped` value from `None` to the special
`empty` object. This change maintains backwards compatibility for
1.3.X, while using the new method for all other versions of Django.
| Python | apache-2.0 | armstrong/armstrong.dev |
1e4bdeeb1156c4ff65d261ba261f594be57bc30f | tests/test_appinfo.py | tests/test_appinfo.py | import io
import os
import pickle
import pytest
from steamfiles import appinfo
test_file_name = os.path.join(os.path.dirname(__file__), 'test_data/appinfo.vdf')
@pytest.yield_fixture
def vdf_data():
with open(test_file_name, 'rb') as f:
yield f.read()
@pytest.mark.usefixtures('vdf_data')
def test_load_... | import io
import os
import pickle
import pytest
from steamfiles import appinfo
test_file_name = os.path.join(os.path.dirname(__file__), 'test_data/appinfo.vdf')
@pytest.yield_fixture
def vdf_data():
with open(test_file_name, 'rb') as f:
yield f.read()
@pytest.mark.usefixtures('vdf_data')
def test_loads... | Add loads-dumps test for Appinfo | Add loads-dumps test for Appinfo
| Python | mit | leovp/steamfiles |
331f776eef9acd0509c7534040ef225869305d7f | tests/test_cookies.py | tests/test_cookies.py | # -*- coding: utf-8 -*-
def test_cookies_fixture(testdir):
"""Make sure that pytest accepts the `cookies` fixture."""
# create a temporary pytest test module
testdir.makepyfile("""
def test_valid_fixture(cookies):
assert hasattr(cookies, 'bake')
assert callable(cookies.bak... | # -*- coding: utf-8 -*-
def test_cookies_fixture(testdir):
"""Make sure that pytest accepts the `cookies` fixture."""
# create a temporary pytest test module
testdir.makepyfile("""
def test_valid_fixture(cookies):
assert hasattr(cookies, 'bake')
assert callable(cookies.bak... | Update test for cookies fixture | Update test for cookies fixture
| Python | mit | hackebrot/pytest-cookies |
e8bb81a8be7c76c2e1839d8315bd29f381fea4ae | enable/__init__.py | enable/__init__.py | # Copyright (c) 2007-2013 by Enthought, Inc.
# All rights reserved.
""" A multi-platform object drawing library.
Part of the Enable project of the Enthought Tool Suite.
"""
__version__ = '4.3.0'
__requires__ = [
'traitsui',
'PIL',
]
| # Copyright (c) 2007-2013 by Enthought, Inc.
# All rights reserved.
""" A multi-platform object drawing library.
Part of the Enable project of the Enthought Tool Suite.
"""
__version__ = '4.3.0'
__requires__ = [
'traitsui',
'PIL',
'casuarius',
]
| Add casuarius to the list of required packages. | Add casuarius to the list of required packages.
| Python | bsd-3-clause | tommy-u/enable,tommy-u/enable,tommy-u/enable,tommy-u/enable |
f9ba5e64f73c3fa3fed62655c846fb4435d627cc | node/multi_var.py | node/multi_var.py |
from nodes import Node
class MultiVar(Node):
char = "'"
args = 0
results = None
contents = -1
def __init__(self, node_1: Node.NodeSingle, node_2: Node.NodeSingle):
self.node_1 = node_1
self.node_2 = node_2
self.args = max([node_1.args, node_2.args])
def pr... |
from nodes import Node
class MultiVar(Node):
char = "'"
args = 0
results = None
contents = -1
def __init__(self, node_1: Node.NodeSingle, node_2: Node.NodeSingle):
self.node_1 = node_1
self.node_2 = node_2
def prepare(self, stack):
self.node_1.prepare(stac... | Fix multivar for nodes with variable lenght stacks | Fix multivar for nodes with variable lenght stacks
| Python | mit | muddyfish/PYKE,muddyfish/PYKE |
5c04957ca44fc43eae034fe389d39b879ec000ae | slideshow/event.py | slideshow/event.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import types
_subscribers = {}
class func:
def __init__(self, inst, method):
self._inst = inst
self._method = method
def __call__(self, *args, **kwargs):
# bind method to class instance
types.MethodType(self._method, self._ins... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import types
import cherrypy
_subscribers = {}
class func:
def __init__(self, inst, method, cls):
self._inst = inst
self._method = method
self._cls = cls
def __call__(self, *args, **kwargs):
# bind method to class instance
... | Add logging and some minor error handling. | Add logging and some minor error handling.
| Python | agpl-3.0 | ext/slideshow-frontend,ext/slideshow,ext/slideshow-frontend,ext/slideshow,ext/slideshow,ext/slideshow,ext/slideshow-frontend,ext/slideshow,ext/slideshow |
ea8f2c3b036ff62ea2fa7faea6eefc86ac5471c7 | redis_sessions_fork/settings.py | redis_sessions_fork/settings.py | import os
from django.conf import settings
SESSION_REDIS_HOST = getattr(
settings,
'SESSION_REDIS_HOST',
'127.0.0.1'
)
SESSION_REDIS_PORT = getattr(
settings,
'SESSION_REDIS_PORT',
6379
)
SESSION_REDIS_DB = getattr(
settings,
'SESSION_REDIS_DB',
0
)
SESSION_REDIS_PREFIX = getattr(... | import os
from django.conf import settings
SESSION_REDIS_HOST = getattr(
settings,
'SESSION_REDIS_HOST',
'127.0.0.1'
)
SESSION_REDIS_PORT = getattr(
settings,
'SESSION_REDIS_PORT',
6379
)
SESSION_REDIS_DB = getattr(
settings,
'SESSION_REDIS_DB',
0
)
SESSION_REDIS_PREFIX = getattr(... | Reorder ENV urls redis providers. | Reorder ENV urls redis providers.
| Python | bsd-3-clause | ProDG/django-redis-sessions-fork,hellysmile/django-redis-sessions-fork |
5082354efec86bb0ebb111e51c8e5a039ab7ae88 | pypika/dialects.py | pypika/dialects.py | from .enums import Dialects
from .queries import (
Query,
QueryBuilder,
)
class MySQLQuery(Query):
"""
Defines a query class for use with MySQL.
"""
@classmethod
def _builder(cls):
return QueryBuilder(quote_char='`', dialect=Dialects.MYSQL, wrap_union_queries=False)
class Vertic... | from .enums import Dialects
from .queries import (
Query,
QueryBuilder,
)
class MySQLQuery(Query):
"""
Defines a query class for use with MySQL.
"""
@classmethod
def _builder(cls):
return QueryBuilder(quote_char='`', dialect=Dialects.MYSQL, wrap_union_queries=False)
class Vertic... | Disable union wrap for clickhouse | Disable union wrap for clickhouse
| Python | apache-2.0 | kayak/pypika |
b3a9a4a1e451815f15dc35c9b6ec9f7b67387260 | scipy/misc/tests/test_common.py | scipy/misc/tests/test_common.py | from __future__ import division, print_function, absolute_import
import pytest
from numpy.testing import assert_equal, assert_allclose
from scipy._lib._numpy_compat import suppress_warnings
from scipy.misc import pade, logsumexp, face, ascent, electrocardiogram
from scipy.special import logsumexp as sc_logsumexp
de... | from __future__ import division, print_function, absolute_import
import pytest
from numpy.testing import assert_equal, assert_allclose, assert_almost_equal
from scipy._lib._numpy_compat import suppress_warnings
from scipy.misc import pade, logsumexp, face, ascent, electrocardiogram
from scipy.special import logsumexp... | Check mean and STD of returned ECG signal | TST: Check mean and STD of returned ECG signal
| Python | bsd-3-clause | Eric89GXL/scipy,jor-/scipy,andyfaff/scipy,ilayn/scipy,andyfaff/scipy,tylerjereddy/scipy,grlee77/scipy,aarchiba/scipy,arokem/scipy,lhilt/scipy,perimosocordiae/scipy,mdhaber/scipy,rgommers/scipy,matthew-brett/scipy,aeklant/scipy,endolith/scipy,rgommers/scipy,person142/scipy,ilayn/scipy,WarrenWeckesser/scipy,matthew-brett... |
1ee41f5439f80af139e612591d48cdac5ecfda39 | hiapi/hi.py | hiapi/hi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hi!\n'
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-b', '--bind-address',
dest='bind', default='127.0.0.1... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import flask
RESPONSE_CODE = 200
app = flask.Flask(__name__)
@app.route('/')
def hello():
global RESPONSE_CODE
if RESPONSE_CODE == 200:
return 'Hi!\n'
else:
flask.abort(RESPONSE_CODE)
def parse_args():
parser = argparse.A... | Remove uwsgi support, add support for simple alternative responses | Remove uwsgi support, add support for simple alternative responses
| Python | apache-2.0 | GradysGhost/pyhiapi |
403bd1cdea0a8d1fae25710a48dc3148fc21ddd9 | bell.py | bell.py | #!/usr/bin/env python
from time import sleep
import subprocess
import httplib, urllib
import RPi.GPIO as GPIO
import config
import logger
GPIO.setmode(GPIO.BCM)
GPIO.setup(config.bell_pin, GPIO.IN)
LOW_PRIORITY = -1
MEDIUM_PRIORITY = 0
HIGH_PRIORITY = 1
log = logger.get(__name__)
def notifyPhones(message, priority... | #!/usr/bin/env python
import logging
import RPi.GPIO as GPIO
from application import logsetup, button, pushover
GPIO.setmode(GPIO.BCM)
GPIO.setup(config.bell_pin, GPIO.IN)
log = logging.getLogger(__name__)
log.info('Doorbell listener Started')
pushover.send('Listener started', pushover.LOW_PRIORITY)
while True:
... | Convert Pi version to use application modules | Convert Pi version to use application modules
| Python | mit | viv/pibell |
dde6e451a9e434b980d1ebac84626ec7515485c5 | instruments/bbn.py | instruments/bbn.py | from .instrument import Instrument, VisaInterface
from types import MethodType
class Attenuator(Instrument):
NUM_CHANNELS = 3
"""BBN 3 Channel Instrument"""
def __init__(self, name, resource_name):
super(Attenuator, self).__init__(name, resource_name, interface_type="VISA")
self.interface.... | from .instrument import Instrument, VisaInterface
from types import MethodType
class Attenuator(Instrument):
"""BBN 3 Channel Instrument"""
NUM_CHANNELS = 3
def __init__(self, name, resource_name):
super(Attenuator, self).__init__(name, resource_name, interface_type="VISA")
self.interfac... | Add some channel validity checking to digital attenuator | Add some channel validity checking to digital attenuator
--CAR
| Python | apache-2.0 | BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex |
3a21d7d174dd8a9cbf76cbf149666337a8352c61 | h5py/_hl/compat.py | h5py/_hl/compat.py | """
Compatibility module for high-level h5py
"""
import sys
from os import fspath, fsencode, fsdecode
WINDOWS_ENCODING = "mbcs"
def filename_encode(filename):
"""
Encode filename for use in the HDF5 library.
Due to how HDF5 handles filenames on different systems, this should be
called on any filenam... | """
Compatibility module for high-level h5py
"""
import sys
from os import fspath, fsencode, fsdecode
from ..version import hdf5_built_version_tuple
WINDOWS_ENCODING = "utf-8" if hdf5_built_version_tuple >= (1, 10, 6) else "mbcs"
def filename_encode(filename):
"""
Encode filename for use in the HDF5 library.... | Use UTF-8 on windows where HDF5 >= 1.10.6 | Use UTF-8 on windows where HDF5 >= 1.10.6
| Python | bsd-3-clause | h5py/h5py,h5py/h5py,h5py/h5py |
35fcaad0474df3352ccdf0545fc34cf2c431761c | tweet_s3_images.py | tweet_s3_images.py | import exifread
import os
class TweetS3Images(object):
def __init__(self, twitter, s3_client):
self._twitter = twitter
self._s3_client = s3_client
self._file = None
def send_image(self, bucket, image_name, cleanup=False):
temp_file = '/tmp/{}'.format(image_name)
self._... | import exifread
import os
class TweetS3Images(object):
def __init__(self, twitter, s3_client):
self._twitter = twitter
self._s3_client = s3_client
self._file = None
def send_image(self, bucket, image_name, cleanup=False):
temp_file = '/tmp/{}'.format(image_name)
self._... | Update class to get image description if available and use it as the update message. | Update class to get image description if available and use it as the update message.
| Python | mit | onema/lambda-tweet |
b096d91564366392c4003b26bafd1e6c3fff47d3 | trayapp.py | trayapp.py |
# Github Tray App
import rumps
import config
import contribs
username = config.get_username()
class GithubTrayApp(rumps.App):
@rumps.timer(60*5)
def timer(self, sender):
count = contribs.get_contribs(username)
self.title = str(count)
@rumps.clicked('Update')
def onoff(self, sender)... |
# Github Tray App
import rumps
import config
import contribs
class GithubTrayApp(rumps.App):
def __init__(self):
super(GithubTrayApp, self).__init__('Github')
self.count = rumps.MenuItem('commits')
self.username = config.get_username()
self.icon = 'github.png'
self.menu =... | Restructure app and display commit count as a disabled menu item | Restructure app and display commit count as a disabled menu item
| Python | mit | chrisfosterelli/commitwatch |
b8d3e62bae3559b24a2a135c921ccc9879fab339 | src/py65/memory.py | src/py65/memory.py |
class ObservableMemory:
def __init__(self, subject=None):
if subject is None:
subject = 0x10000 * [0x00]
self._subject = subject
self._read_subscribers = {}
self._write_subscribers = {}
def __setitem__(self, address, value):
callbacks = self._write... |
class ObservableMemory:
def __init__(self, subject=None):
if subject is None:
subject = 0x10000 * [0x00]
self._subject = subject
self._read_subscribers = {}
self._write_subscribers = {}
def __setitem__(self, address, value):
callbacks = self._write... | Use get() instead of setdefault(). | Use get() instead of setdefault().
| Python | bsd-3-clause | mkeller0815/py65,mnaberez/py65 |
87c99c6839d7f74201393066651f3d69a5a2edce | nodeconductor/logging/middleware.py | nodeconductor/logging/middleware.py | from __future__ import unicode_literals
import threading
_locals = threading.local()
def get_event_context():
return getattr(_locals, 'context', None)
def set_event_context(context):
_locals.context = context
def reset_event_context():
if hasattr(_locals, 'context'):
del _locals.context
de... | from __future__ import unicode_literals
import threading
_locals = threading.local()
def get_event_context():
return getattr(_locals, 'context', None)
def set_event_context(context):
_locals.context = context
def reset_event_context():
if hasattr(_locals, 'context'):
del _locals.context
de... | Implement set_current_user for CapturingAuthentication (NC-529) | Implement set_current_user for CapturingAuthentication (NC-529)
| Python | mit | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor |
3da6393345cca10d44c0823ef6c224a5ceaa4fcd | src/engine/SCons/Platform/darwin.py | src/engine/SCons/Platform/darwin.py | """engine.SCons.Platform.darwin
Platform-specific initialization for Mac OS X systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004 Steven Knight
#
# Permi... | """engine.SCons.Platform.darwin
Platform-specific initialization for Mac OS X systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of char... | Fix __COPYRIGHT__ and __REVISION__ in new Darwin module. | Fix __COPYRIGHT__ and __REVISION__ in new Darwin module.
| Python | mit | azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons |
6480e801de5f21486d99444c25006b70329e580e | luigi/tasks/release/process_data.py | luigi/tasks/release/process_data.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | Add RGD as part of the regular update pipeline | Add RGD as part of the regular update pipeline
I'm not sure if this will always be part of the update, but it is for at
least for this release.
| Python | apache-2.0 | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline |
08d8f2c30c810cda75961e5bf6025f1bf348fc02 | api.py | api.py | from os import environ
from eve import Eve
from settings import API_NAME
api = Eve(API_NAME)
if __name__ == '__main__':
# Heroku support: bind to PORT if defined, otherwise default to 5000.
if 'PORT' in environ:
port = int(environ.get('PORT'))
host = '0.0.0.0'
else:
port = 5000
... | import json
from os import environ
from eve import Eve
from settings import API_NAME, URL_PREFIX
api = Eve(API_NAME)
def add_document(resource, document):
"Add a new document to the given resource."
return api.test_client().post('/' + URL_PREFIX + '/' + resource,
data=json... | Add utility method to add documents | Add utility method to add documents
| Python | apache-2.0 | gwob/Maarifa,gwob/Maarifa,gwob/Maarifa,gwob/Maarifa,gwob/Maarifa |
dd9161c772e3c345fd21f742b09a62d43f7fa069 | scripts/c19.py | scripts/c19.py | from __future__ import print_function
import sys
from pyspark.sql import SparkSession
from pyspark.sql.functions import lit, col
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: c19.py <input> <output>", file=sys.stderr)
exit(-1)
spark = SparkSession.builder.appName('Select c19... | from __future__ import print_function
import sys
from pyspark.sql import SparkSession
from pyspark.sql.functions import lit, col, datediff
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: c19.py <input> <output>", file=sys.stderr)
exit(-1)
spark = SparkSession.builder.appName('... | Add numeric time column (hour) that respects editions. | Add numeric time column (hour) that respects editions.
| Python | apache-2.0 | ViralTexts/vt-passim,ViralTexts/vt-passim,ViralTexts/vt-passim |
fa67de4900be765a5ea4194b1a786cd237934a33 | displacy_service_tests/test_server.py | displacy_service_tests/test_server.py | import falcon.testing
import json
from displacy_service.server import APP
class TestAPI(falcon.testing.TestCase):
def __init__(self):
self.api = APP
def test_deps():
test_api = TestAPI()
result = test_api.simulate_post(path='/dep',
body='''{"text": "This is a... | import falcon.testing
import json
from displacy_service.server import APP
class TestAPI(falcon.testing.TestCase):
def __init__(self):
self.api = APP
def test_deps():
test_api = TestAPI()
result = test_api.simulate_post(
path='/dep',
body='''{"text": "This is a test.", "model": "... | Make test file PEP8 compliant. | Make test file PEP8 compliant.
| Python | mit | jgontrum/spacy-api-docker,jgontrum/spacy-api-docker,jgontrum/spacy-api-docker,jgontrum/spacy-api-docker |
5db0af8fcf83519a44ed59d14bb00bc08e2a5131 | django_seo_js/middleware/useragent.py | django_seo_js/middleware/useragent.py | import re
from django_seo_js import settings
from django_seo_js.backends import SelectedBackend
from django_seo_js.helpers import request_should_be_ignored
import logging
logger = logging.getLogger(__name__)
class UserAgentMiddleware(SelectedBackend):
def __init__(self, *args, **kwargs):
super(UserAgentM... | import re
from django_seo_js import settings
from django_seo_js.backends import SelectedBackend
from django_seo_js.helpers import request_should_be_ignored
import logging
logger = logging.getLogger(__name__)
class UserAgentMiddleware(SelectedBackend):
def __init__(self, *args, **kwargs):
super(UserAgentM... | Change from request.ENABLED to settings.ENABLED | Change from request.ENABLED to settings.ENABLED | Python | mit | skoczen/django-seo-js |
9826c49225a3d8aac5ab5432e261babaa2585c1e | PRESUBMIT.py | PRESUBMIT.py | # Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
"""Presubmit script for dart_ci repository.
See http://dev.chromium.org/developers/how-tos/depottools/pres... | # Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
"""Presubmit script for dart_ci repository.
See http://dev.chromium.org/developers/how-tos/depottools/pres... | Update presubmit to use 'dart format' command | Update presubmit to use 'dart format' command
The presubmit checks will then work with the Flutter SDK in the path.
This is the case when working on the Flutter web app current_results_ui.
Change-Id: I8a8d5db4454b57bc7936197032460e877037b386
Reviewed-on: https://dart-review.googlesource.com/c/dart_ci/+/191921
Reviewe... | Python | bsd-3-clause | dart-lang/dart_ci,dart-lang/dart_ci,dart-lang/dart_ci,dart-lang/dart_ci |
f64fabb83cf57e70f938f803ee0a50599f3ab83a | src/odin/fields/future.py | src/odin/fields/future.py | from __future__ import absolute_import
from enum import Enum
from typing import TypeVar, Optional, Any, Type # noqa
from odin.exceptions import ValidationError
from . import Field
__all__ = ("EnumField",)
ET = TypeVar("ET", Enum, Enum)
class EnumField(Field):
"""
Field for handling Python enums.
"""... | from __future__ import absolute_import
from enum import Enum
from typing import TypeVar, Optional, Any, Type # noqa
from odin.exceptions import ValidationError
from . import Field
__all__ = ("EnumField",)
ET = TypeVar("ET", Enum, Enum)
class EnumField(Field):
"""
Field for handling Python enums.
"""... | Update enum value to an is-instance check | Update enum value to an is-instance check
| Python | bsd-3-clause | python-odin/odin |
c3cf9adc2428c4058817daa1aeefca300363e21f | glanerbeard/server.py | glanerbeard/server.py | import requests
import json
import logging
from glanerbeard import show
log = logging.getLogger(__name__)
class Server:
def __init__(self, name, url, apikey):
self.name = name
self.url = url
self.apikey = apikey
def requestJson(self, path):
url = '{url}/api/{apikey}{path}'.format(url=self.url,apikey=self.ap... | import requests
import logging
from glanerbeard import show
log = logging.getLogger(__name__)
class Server:
def __init__(self, name, url, apikey):
self.name = name
self.url = url
self.apikey = apikey
def requestJson(self, path):
url = '{url}/api/{apikey}{path}'.format(url=self.url,apikey=self.apikey,path=pa... | Use requests built-in .json(), pass verify=False. | Use requests built-in .json(), pass verify=False.
| Python | apache-2.0 | daenney/glanerbeard |
321924fff843896fc67d3a4594d635546cf90bec | mycli/packages/expanded.py | mycli/packages/expanded.py | from .tabulate import _text_type
def pad(field, total, char=u" "):
return field + (char * (total - len(field)))
def get_separator(num, header_len, data_len):
sep = u"***************************[ %d. row ]***************************\n" % (num + 1)
return sep
def expanded_table(rows, headers):
header_... | from .tabulate import _text_type
def pad(field, total, char=u" "):
return field + (char * (total - len(field)))
def get_separator(num, header_len, data_len):
sep = u"***************************[ %d. row ]***************************\n" % (num + 1)
return sep
def expanded_table(rows, headers):
header_... | Make the null value consistent between vertical and tabular output. | Make the null value consistent between vertical and tabular output.
| Python | bsd-3-clause | MnO2/rediscli,martijnengler/mycli,qbdsoft/mycli,j-bennet/mycli,D-e-e-m-o/mycli,mdsrosa/mycli,martijnengler/mycli,mattn/mycli,jinstrive/mycli,webwlsong/mycli,brewneaux/mycli,danieljwest/mycli,thanatoskira/mycli,ksmaheshkumar/mycli,brewneaux/mycli,MnO2/rediscli,evook/mycli,webwlsong/mycli,j-bennet/mycli,evook/mycli,suzuk... |
495a368098357c94ccec2f9f84c077fd5b27bde7 | tests/PushoverAPI/test_PushoverAPI.py | tests/PushoverAPI/test_PushoverAPI.py | from urllib.parse import urljoin, parse_qs
import responses
from tests.constants import *
from tests.fixtures import PushoverAPI
from tests.util import messages_callback
@responses.activate
def test_PushoverAPI_sends_message(PushoverAPI):
responses.add_callback(
responses.POST,
urljoin(PUSHOVER_... | from urllib.parse import urljoin, parse_qs
import responses
from tests.constants import *
from tests.fixtures import PushoverAPI
from tests.util import messages_callback
@responses.activate
def test_PushoverAPI_sends_message(PushoverAPI):
responses.add_callback(
responses.POST,
urljoin(PUSHOVER_... | Add a test for a proper response, not just proper request | Add a test for a proper response, not just proper request
| Python | mit | scolby33/pushover_complete |
dc86283bb517c56eec177804801f66227477a097 | networkx/generators/ego.py | networkx/generators/ego.py | """
Ego graph.
"""
# Copyright (C) 2010 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
__author__ = """\n""".join(['Drew Conway <drew.conway@nyu.edu>',
'Aric Hagberg <hagberg@la... | """
Ego graph.
"""
# Copyright (C) 2010 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
__author__ = """\n""".join(['Drew Conway <drew.conway@nyu.edu>',
'Aric Hagberg <hagberg@la... | Add note about directed graphs | Add note about directed graphs
--HG--
extra : convert_revision : svn%3A3ed01bd8-26fb-0310-9e4c-ca1a4053419f/networkx/trunk%401776
| Python | bsd-3-clause | ghdk/networkx,farhaanbukhsh/networkx,yashu-seth/networkx,bzero/networkx,nathania/networkx,jakevdp/networkx,goulu/networkx,Sixshaman/networkx,ionanrozenfeld/networkx,chrisnatali/networkx,jcurbelo/networkx,tmilicic/networkx,chrisnatali/networkx,RMKD/networkx,ionanrozenfeld/networkx,sharifulgeo/networkx,sharifulgeo/networ... |
21f7d85d5f22834e04a25ea23eabfd07b279bfe6 | openedx/features/badging/constants.py | openedx/features/badging/constants.py | CONVERSATIONALIST = ('conversationalist', 'Conversationalist')
TEAM_PLAYER = ('team', 'Team player')
BADGES_KEY = 'badges'
BADGE_NOT_FOUND_ERROR = 'There exists no badge with id {badge_id}'
BADGE_TYPE_ERROR = 'Cannot assign badge {badge_id} of unknown type {badge_type}'
FILTER_BADGES_ERROR = 'Unable to get badges for ... | CONVERSATIONALIST = ('conversationalist', 'Conversationalist')
TEAM_PLAYER = ('team', 'Team player')
BADGES_KEY = 'badges'
BADGE_NOT_FOUND_ERROR = 'There exists no badge with id {badge_id}'
BADGE_TYPE_ERROR = 'Cannot assign badge {badge_id} of unknown type {badge_type}'
BADGE_ROOT_URL = '{root_url}/courses/{course_id}... | Add constant for badge url | Add constant for badge url
| Python | agpl-3.0 | philanthropy-u/edx-platform,philanthropy-u/edx-platform,philanthropy-u/edx-platform,philanthropy-u/edx-platform |
3b5880c375ee92ce931c29a978ff64cd8849d028 | src/simple-http-server.py | src/simple-http-server.py | #!/usr/bin/env python3
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import os, http.server
def main(args):
os.chdir(args.directory)
addr = ('' ,args.port)
httpd = http.server.HTTPServer(addr, http.server.SimpleHTTPRequestHandler)
httpd.serve_forever()
if __name__ == '__main__':
... | #!/usr/bin/env python3
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import os, http.server
def main(args):
os.chdir(args.directory)
addr = ('' ,args.port)
print('Serving', args.directory, 'on', addr)
httpd = http.server.HTTPServer(addr, http.server.SimpleHTTPRequestHandler)
ht... | Add message about where we're listening for connections | Add message about where we're listening for connections
| Python | unlicense | pastly/python-snippits |
22382935be99e027da46303107926a15cd8f3017 | tests/twisted/vcard/test-set-alias.py | tests/twisted/vcard/test-set-alias.py |
"""
Test alias setting support.
"""
from servicetest import EventPattern
from gabbletest import exec_test, acknowledge_iq
import constants as cs
def test(q, bus, conn, stream):
iq_event = q.expect('stream-iq', to=None, query_ns='vcard-temp',
query_name='vCard')
acknowledge_iq(stream, iq_event.st... |
"""
Test alias setting support.
"""
from servicetest import EventPattern, assertEquals
from gabbletest import exec_test, acknowledge_iq
import constants as cs
import ns
def validate_pep_update(pep_update, expected_nickname):
publish = pep_update.query.elements(uri=ns.PUBSUB, name='publish').next()
assertEqua... | Test setting our own alias via PEP | Test setting our own alias via PEP
Astonishingly, this was untested...
| Python | lgpl-2.1 | Ziemin/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,jku/telepathy-gabble,Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,jku/telepathy-gabble,Ziemin/telepathy-gabble |
fe9f48415017bcd873140da82a5f2e463d13b307 | tests/scoring_engine/models/test_setting.py | tests/scoring_engine/models/test_setting.py | from scoring_engine.models.setting import Setting
from tests.scoring_engine.unit_test import UnitTest
class TestSetting(UnitTest):
def test_init_setting(self):
setting = Setting(name='test_setting', value='test value example')
assert setting.id is None
assert setting.name == 'test_settin... | from scoring_engine.models.setting import Setting
from tests.scoring_engine.unit_test import UnitTest
class TestSetting(UnitTest):
def test_init_setting(self):
setting = Setting(name='test_setting', value='test value example')
assert setting.id is None
assert setting.name == 'test_settin... | Add test for setting as boolean value | Add test for setting as boolean value
| Python | mit | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine |
4456f5604c1d824f5012bcee550d274c905d74c8 | bigcrunch/shutdown.py | bigcrunch/shutdown.py | import asyncio
import botocore.exceptions
from bigcrunch import webapp
@asyncio.coroutine
def shutdown():
client = yield from webapp.redshift_client()
cluster_control = webapp.ClusterControl(client)
try:
cluster = yield from cluster_control.get()
except botocore.exceptions.ClientError as e:
... | import asyncio
import botocore.exceptions
from bigcrunch import webapp
@asyncio.coroutine
def shutdown():
client = webapp.redshift_client()
cluster_control = webapp.ClusterControl(client)
try:
cluster = yield from cluster_control.get()
except botocore.exceptions.ClientError as e:
if ... | Remove yield from on redshift_client | Remove yield from on redshift_client
| Python | agpl-3.0 | sqlalchemy-redshift/bigcrunch |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.