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
ea9847a31eb4441415f1c11ddf57056f206fc375
reverse-engineering/reveng.py
reverse-engineering/reveng.py
from os.path import dirname from puresnmp.pdu import PDU from puresnmp.test import readbytes_multiple from puresnmp.x690.types import pop_tlv HERE = dirname(__file__) for row in readbytes_multiple('authpriv.hex', HERE): print(row) pdu, _ = pop_tlv(row) print(pdu.pretty())
from os.path import dirname HERE = dirname(__file__) from puresnmp.pdu import PDU from puresnmp.test import readbytes_multiple from puresnmp.x690.types import pop_tlv for row in readbytes_multiple("authpriv.hex", HERE): print(row) pdu, _ = pop_tlv(row) print(pdu.pretty())
Add some files for reverse-engineering
Add some files for reverse-engineering
Python
mit
exhuma/puresnmp,exhuma/puresnmp
e893a860f4a8ad9682f400507948ee20fce1c328
healthcheck/contrib/django/status_endpoint/views.py
healthcheck/contrib/django/status_endpoint/views.py
import json from django.conf import settings from django.views.decorators.http import require_http_methods from django.http import HttpResponse, HttpResponseServerError from healthcheck.healthcheck import ( DjangoDBsHealthCheck, FilesDontExistHealthCheck, HealthChecker) @require_http_methods(['GET']) def status...
import json from django.conf import settings from django.views.decorators.http import require_http_methods from django.http import HttpResponse from healthcheck.healthcheck import ( DjangoDBsHealthCheck, FilesDontExistHealthCheck, HealthChecker) class JsonResponse(HttpResponse): def __init__(self, data, **k...
Fix content_type for JSON responses
Fix content_type for JSON responses
Python
mit
yola/healthcheck
be2cd54386c0fb9c407ac5dc7da467547b0b426e
aldryn_apphooks_config/utils.py
aldryn_apphooks_config/utils.py
# -*- coding: utf-8 -*- from app_data import AppDataContainer, app_registry from cms.apphook_pool import apphook_pool from django.core.urlresolvers import resolve def get_app_instance(request): """ Returns a tuple containing the current namespace and the AppHookConfig instance :param request: request obj...
# -*- coding: utf-8 -*- from app_data import AppDataContainer, app_registry from cms.apphook_pool import apphook_pool from django.core.urlresolvers import resolve, Resolver404 def get_app_instance(request): """ Returns a tuple containing the current namespace and the AppHookConfig instance :param request...
Add checks to get_app_instance to avoid Resolver404 even if namespace does not exists
Add checks to get_app_instance to avoid Resolver404 even if namespace does not exists
Python
bsd-3-clause
aldryn/aldryn-apphooks-config,aldryn/aldryn-apphooks-config,aldryn/aldryn-apphooks-config
7941c60ba5a52ead654e5816ee39e48b9e927a21
setup.py
setup.py
#!/usr/bin/env python3 from distutils.core import setup setup( name='LoadStone', version='0.1', description='Interface for FFXIV Lodestone', author='Sami Elahmadie', author_email='s.elahmadie@gmail.com', url='https://github.com/Demotivated/loadstone/', packages=['api'], install_require...
#!/usr/bin/env python3 from distutils.core import setup setup( name='LoadStone', version='0.1', description='Interface for FFXIV Lodestone', author='Sami Elahmadie', author_email='s.elahmadie@gmail.com', url='https://github.com/Demotivated/loadstone/', packages=['api'], install_require...
Add sphinx & theme to requirements
Add sphinx & theme to requirements
Python
mit
Demotivated/loadstone
a7b47737be5e0ad674025348ce938a81058c85f6
viewer/viewer.py
viewer/viewer.py
# Run with `python viewer.py PATH_TO_RECORD_JSON. import json import sys from flask import Flask, jsonify from flask.templating import render_template app = Flask(__name__, template_folder='.') # app.debug = True # `main` inits these. # File containing `record` output. record_path = None # 0: source, 1: state reco...
# Run with `python viewer.py PATH_TO_RECORD_JSON. import json import sys from flask import Flask, jsonify from flask.helpers import send_from_directory app = Flask(__name__) # `main` inits these. # File containing `record` output. record_path = None # 0: source, 1: state record_data = [] @app.route("/") def hell...
Use send so no templates are evald by python.
Use send so no templates are evald by python.
Python
mit
mihneadb/python-execution-trace,mihneadb/python-execution-trace,mihneadb/python-execution-trace
7b30846c322f7f81566f0b2a454e61ad271eee65
cegui/src/ScriptingModules/PythonScriptModule/bindings/distutils/PyCEGUI/__init__.py
cegui/src/ScriptingModules/PythonScriptModule/bindings/distutils/PyCEGUI/__init__.py
import os import os.path # atrocious and unholy! def get_my_path(): import fake return os.path.dirname(str(fake).split()[3][1:]) libpath = os.path.abspath(get_my_path()) #print "libpath =", libpath os.environ['PATH'] = libpath + ";" + os.environ['PATH'] from PyCEGUI import *
import os import os.path # atrocious and unholy! def get_my_path(): import fake return os.path.dirname(os.path.abspath(fake.__file__)) libpath = get_my_path() #print "libpath =", libpath os.environ['PATH'] = libpath + ";" + os.environ['PATH'] from PyCEGUI import *
Use a less pathetic method to retrieve the PyCEGUI dirname
MOD: Use a less pathetic method to retrieve the PyCEGUI dirname
Python
mit
arkana-fts/cegui,arkana-fts/cegui,cbeck88/cegui-mirror,cbeck88/cegui-mirror,RealityFactory/CEGUI,arkana-fts/cegui,cbeck88/cegui-mirror,RealityFactory/CEGUI,arkana-fts/cegui,RealityFactory/CEGUI,cbeck88/cegui-mirror,RealityFactory/CEGUI,arkana-fts/cegui,RealityFactory/CEGUI,cbeck88/cegui-mirror
212bf2f97a82ebe28431ff3d8f64affaf45fd55e
pyforge/celeryconfig.py
pyforge/celeryconfig.py
# -*- coding: utf-8 -*- CELERY_BACKEND = "mongodb" AMQP_SERVER = "localhost" AMQP_PORT = 5672 AMQP_VHOST = "celeryvhost" AMQP_USER = "celeryuser" AMQP_PASSWORD = "celerypw" CELERYD_LOG_FILE = "celeryd.log" CELERYD_PID_FILE = "celeryd.pid" CELERYD_DAEMON_LOG_LEVEL = "INFO" CELERY_MONGODB_BACKEND_SETTINGS = { "hos...
# -*- coding: utf-8 -*- CELERY_BACKEND = "mongodb" # We shouldn't need to supply these because we're using Mongo, # but Celery gives us errors if we don't. DATABASE_ENGINE = "sqlite3" DATABASE_NAME = "celery.db" AMQP_SERVER = "localhost" AMQP_PORT = 5672 AMQP_VHOST = "celeryvhost" AMQP_USER = "celeryuser" AMQP_PASSWO...
Add unused DATABASE_ENGINE, DATABASE_NAME to pacify celeryinit
Add unused DATABASE_ENGINE, DATABASE_NAME to pacify celeryinit
Python
apache-2.0
Bitergia/allura,apache/incubator-allura,apache/allura,apache/incubator-allura,lym/allura-git,lym/allura-git,apache/incubator-allura,leotrubach/sourceforge-allura,lym/allura-git,heiths/allura,apache/allura,heiths/allura,apache/allura,heiths/allura,Bitergia/allura,apache/incubator-allura,leotrubach/sourceforge-allura,lym...
d8588d31f23377f27b81e62f5471997271ae0ca2
tasks.py
tasks.py
import os import sys from invoke import task, util in_ci = os.environ.get("CI", "false") == "true" if in_ci: pty = False else: pty = util.isatty(sys.stdout) and util.isatty(sys.stderr) @task def reformat(c): c.run("isort mopidy_webhooks tests setup.py tasks.py", pty=pty) c.run("black mopidy_webhook...
import os import sys from invoke import task, util in_ci = os.environ.get("CI", "false") == "true" if in_ci: pty = False else: pty = util.isatty(sys.stdout) and util.isatty(sys.stderr) @task def reformat(c): c.run("isort mopidy_webhooks tests setup.py tasks.py", pty=pty) c.run("black mopidy_webhook...
Remove redundant flag from flake8 task
Remove redundant flag from flake8 task The max line length is already specified in Flake8's configuration.
Python
apache-2.0
paddycarey/mopidy-webhooks
86dca4a7d3c1574af9da85e5a2f10b84d18d28c0
blueprints/aws_backup_plans/delete.py
blueprints/aws_backup_plans/delete.py
from common.methods import set_progress from azure.common.credentials import ServicePrincipalCredentials from botocore.exceptions import ClientError from resourcehandlers.aws.models import AWSHandler import boto3 def run(job, **kwargs): resource = kwargs.pop('resources').first() backup_plan_id = resource.attr...
from common.methods import set_progress from azure.common.credentials import ServicePrincipalCredentials from botocore.exceptions import ClientError from resourcehandlers.aws.models import AWSHandler import boto3 def run(job, **kwargs): resource = kwargs.pop('resources').first() backup_plan_id = resource.attr...
Revert "[Dev-20546] AwSBackPlan-Blueprint is broken-Teardown is not working"
Revert "[Dev-20546] AwSBackPlan-Blueprint is broken-Teardown is not working"
Python
apache-2.0
CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge
e6a3e0c77ada592c06394af2e235b3528a61202a
armstrong/dev/tasks/__init__.py
armstrong/dev/tasks/__init__.py
import pkg_resources pkg_resources.declare_namespace(__name__)
import pkg_resources pkg_resources.declare_namespace(__name__) from contextlib import contextmanager try: import coverage except ImportError: coverage = False import os from os.path import basename, dirname import sys from fabric.api import * from fabric.decorators import task if not "fabfile" in sys.module...
Create all of the tasks needed for developing in Armstrong
Create all of the tasks needed for developing in Armstrong
Python
apache-2.0
armstrong/armstrong.dev
a37db382c69293953c709365cd2c64c4a99f419e
rest_framework/authtoken/migrations/0001_initial.py
rest_framework/authtoken/migrations/0001_initial.py
# encoding: utf8 from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( ...
from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name...
Update authtoken latest Django 1.7 migration
Update authtoken latest Django 1.7 migration
Python
bsd-2-clause
James1345/django-rest-framework,wzbozon/django-rest-framework,rhblind/django-rest-framework,ajaali/django-rest-framework,tcroiset/django-rest-framework,hunter007/django-rest-framework,hunter007/django-rest-framework,wwj718/django-rest-framework,kennydude/django-rest-framework,jpadilla/django-rest-framework,kezabelle/dj...
04557bbff362ae3b89e7dd98a1fb11e0aaeba50e
common/djangoapps/student/migrations/0010_auto_20170207_0458.py
common/djangoapps/student/migrations/0010_auto_20170207_0458.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('student', '0009_auto_20170111_0422'), ] # This migration was to add a constraint that we lost in the Django # 1.4->1.8 upgrade. ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('student', '0009_auto_20170111_0422'), ] # This migration was to add a constraint that we lost in the Django # 1.4->1.8 upgrade. ...
Make this no-op migration be a true no-op.
Make this no-op migration be a true no-op.
Python
agpl-3.0
philanthropy-u/edx-platform,lduarte1991/edx-platform,eduNEXT/edx-platform,msegado/edx-platform,cpennington/edx-platform,hastexo/edx-platform,a-parhom/edx-platform,ESOedX/edx-platform,angelapper/edx-platform,gymnasium/edx-platform,eduNEXT/edunext-platform,pepeportela/edx-platform,ESOedX/edx-platform,pepeportela/edx-plat...
7f796b74b8996bda7d31184e6c580d2a3e4f7e18
os.py
os.py
import os def sorted_walk(rootpath): # report this dirpath, dirs, files = next(os.walk(rootpath)) yield (dirpath, dirs, files) for ndir in sorted(dirs): ndirpath = os.path.join(rootpath, ndir) for _, ndirs, nfiles in sorted_walk(ndirpath): yield (ndirpath, ndirs, nfiles)
import os def sorted_walk(rootpath): # report this dirpath, dirs, files = next(os.walk(rootpath)) yield (dirpath, dirs, files) for ndir in sorted(dirs): ndirpath = os.path.join(rootpath, ndir) for _, ndirs, nfiles in sorted_walk(ndirpath): yield (ndirpath, ndirs, nfiles) if...
Add example code for sorted_walk
Add example code for sorted_walk
Python
mit
inker610566/python-improve-libs
6f5c1aa40181d5f9cc34bf85fd03e8e5758a9183
libs/utils.py
libs/utils.py
from django.core.cache import cache #get the cache key for storage def cache_get_key(*args, **kwargs): import hashlib serialise = [] for arg in args: serialise.append(str(arg)) for key,arg in kwargs.items(): serialise.append(str(key)) serialise.append(str(arg)) key = hashlib...
from django.core.cache import cache #get the cache key for storage def cache_get_key(*args, **kwargs): import hashlib serialise = [] for arg in args: serialise.append(str(arg)) for key,arg in kwargs.items(): if key == "clear_cache": continue serialise.append(str(key)...
Exclude clear_cache from cache key
Exclude clear_cache from cache key
Python
mit
daigotanaka/kawaraban,daigotanaka/kawaraban,daigotanaka/kawaraban,daigotanaka/kawaraban
e7278521d8ee387acc5bc94c39f041c7e08c6cc6
lab_members/views.py
lab_members/views.py
from django.views.generic import DetailView, ListView from lab_members.models import Scientist class ScientistListView(ListView): model = Scientist queryset = Scientist.objects.all() class ScientistDetailView(DetailView): model = Scientist
from django.views.generic import DetailView, ListView from lab_members.models import Scientist class ScientistListView(ListView): model = Scientist def get_context_data(self, **kwargs): context = super(ScientistListView, self).get_context_data(**kwargs) context['scientist_list'] = Scientist.ob...
Return both scientist_list and alumni_list for ScientistListView
Return both scientist_list and alumni_list for ScientistListView
Python
bsd-3-clause
mfcovington/django-lab-members,mfcovington/django-lab-members,mfcovington/django-lab-members
d4171faa21324cc8d23b5e0352932e3d1769f58a
bluesky/tests/test_callbacks.py
bluesky/tests/test_callbacks.py
from nose.tools import assert_in, assert_equal from bluesky.run_engine import RunEngine from bluesky.examples import * RE = None def setup(): global RE RE = RunEngine() def test_main_thread_callback_exceptions(): def callbacker(doc): raise Exception("Hey look it's an exception that better not ...
from nose.tools import assert_in, assert_equal from bluesky.run_engine import RunEngine from bluesky.examples import * from nose.tools import raises RE = None def setup(): global RE RE = RunEngine() def exception_raiser(doc): raise Exception("Hey look it's an exception that better not kill the " ...
Add test that fails *if* 'all' is not working
ENH: Add test that fails *if* 'all' is not working
Python
bsd-3-clause
klauer/bluesky,ericdill/bluesky,sameera2004/bluesky,klauer/bluesky,dchabot/bluesky,ericdill/bluesky,dchabot/bluesky,sameera2004/bluesky
77c6fd50fdc2bd7e716ecfba30e8e18e27b3c0eb
oslo/__init__.py
oslo/__init__.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Remove extraneous vim editor configuration comments
Remove extraneous vim editor configuration comments Change-Id: I0a48345e7fd2703b6651531087097f096264dc7d Partial-Bug: #1229324
Python
apache-2.0
openstack/oslo.concurrency,varunarya10/oslo.concurrency,JioCloud/oslo.concurrency
c974c7a73e8ef48ea4fb1436b397f2973d8048c7
{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/apps/users/adapter.py
{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/apps/users/adapter.py
# -*- coding: utf-8 -*- from django.conf import settings from allauth.account.adapter import DefaultAccountAdapter from allauth.socialaccount.adapter import DefaultSocialAccountAdapter class AccountAdapter(DefaultAccountAdapter): def is_open_for_signup(self, request): return getattr(settings, 'ACCOUNT_ALL...
# -*- coding: utf-8 -*- from django.conf import settings from allauth.account.adapter import DefaultAccountAdapter from allauth.socialaccount.adapter import DefaultSocialAccountAdapter class AccountAdapter(DefaultAccountAdapter): def is_open_for_signup(self, request): return getattr(settings, 'ACCOUNT_ALL...
Modify is_open_for_signup to receive 3 arguments
Modify is_open_for_signup to receive 3 arguments SocialAccountAdapter expects a sociallogin argument.
Python
mit
LucianU/bud,LucianU/bud,LucianU/bud
4adb9f2f526970ee40ee26c5969fc58db1a6b04e
setup.py
setup.py
try: from setuptools.core import setup except ImportError: from distutils.core import setup import sys svem_flag = '--single-version-externally-managed' if svem_flag in sys.argv: # Die, setuptools, die. sys.argv.remove(svem_flag) with open('jupyter_kernel/__init__.py', 'rb') as fid: for line in ...
try: from setuptools.core import setup except ImportError: from distutils.core import setup import sys svem_flag = '--single-version-externally-managed' if svem_flag in sys.argv: # Die, setuptools, die. sys.argv.remove(svem_flag) with open('jupyter_kernel/__init__.py', 'rb') as fid: for line in ...
Use the readme as the long description
Use the readme as the long description
Python
bsd-3-clause
Calysto/metakernel
681326cb6b070c84f5d84064f3d8925dd2762065
setup.py
setup.py
from distutils.core import setup import re versionPattern = re.compile(r"""^__version__ = ['"](.*?)['"]$""", re.M) with open("axiom/_version.py", "rt") as f: version = versionPattern.search(f.read()).group(1) setup( name="Axiom", version=version, description="An in-process object-relational database",...
from distutils.core import setup import re versionPattern = re.compile(r"""^__version__ = ['"](.*?)['"]$""", re.M) with open("axiom/_version.py", "rt") as f: version = versionPattern.search(f.read()).group(1) setup( name="Axiom", version=version, description="An in-process object-relational database",...
Add trove classifiers for supported Python versions
Add trove classifiers for supported Python versions
Python
mit
twisted/axiom,hawkowl/axiom
5d9032fc79466880c28b4472f152d517c027ab40
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup import fedex LONG_DESCRIPTION = open('README.rst').read() CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Natural Language :: English', 'Op...
#!/usr/bin/env python from distutils.core import setup import fedex LONG_DESCRIPTION = open('README.rst').read() CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Natural Language :: English', 'Op...
Add tools to package data
Add tools to package data
Python
bsd-3-clause
gtaylor/python-fedex,python-fedex-devs/python-fedex,gtaylor/python-fedex,python-fedex-devs/python-fedex,python-fedex-devs/python-fedex,gtaylor/python-fedex,python-fedex-devs/python-fedex,gtaylor/python-fedex
370aa8094a9a2cc67acc414ceb7f24dd33fd7e68
setup.py
setup.py
from distutils.core import setup LONG_DESC = """ Unicode URLS in django.""" setup( name='unicode_urls', packages=['unicode_urls', 'unicode_urls.django', 'unicode_urls.cms'], version='0.0.1', long_description=LONG_DESC, description='Unicode urls.', author='Alex Gavrisco', author_email='alex...
from distutils.core import setup LONG_DESC = """ Unicode URLS in django.""" setup( name='unicode_urls', packages=['unicode_urls', 'unicode_urls.django', 'unicode_urls.cms'], version='0.2.1', long_description=LONG_DESC, description='Unicode urls.', author='Alex Gavrisco', author_email='alex...
Fix package version and remove django from list of required packages.
Fix package version and remove django from list of required packages.
Python
mit
Alexx-G/django-unicode-urls
372b39cb1e4537b2f3221e71e310a4c928a81468
tests/func/import/imported_actions/by_decorator_action_name/base_actions.py
tests/func/import/imported_actions/by_decorator_action_name/base_actions.py
from parglare.actions import get_action_decorator action = get_action_decorator() @action('number') def NUMERIC(_, value): return float(value)
from __future__ import unicode_literals from parglare.actions import get_action_decorator action = get_action_decorator() @action('number') def NUMERIC(_, value): return float(value)
Test fix for Python 2.
Test fix for Python 2.
Python
mit
igordejanovic/parglare,igordejanovic/parglare
b540d5c3943f6a21232428ecf717667c6beb48d5
dmp/__init__.py
dmp/__init__.py
""" .. Copyright 2016 EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applic...
""" .. Copyright 2016 EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applic...
Change to try and improve importability
Change to try and improve importability
Python
apache-2.0
Multiscale-Genomics/mg-dm-api,Multiscale-Genomics/mg-dm-api
6c6e8d17bce3976a2ef766139f3692a78df2d0c4
tests/unit/cloud/clouds/test_saltify.py
tests/unit/cloud/clouds/test_saltify.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Alexander Schwartz <alexander.schwartz@gmx.net>` ''' # Import Python libs from __future__ import absolute_import # Import Salt Testing Libs from tests.support.unit import TestCase from tests.support.mock import MagicMock # Import Salt Libs from salt.cloud.clouds i...
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Alexander Schwartz <alexander.schwartz@gmx.net>` ''' # Import Python libs from __future__ import absolute_import # Import Salt Testing Libs from tests.support.unit import TestCase from tests.support.mock import ( MagicMock, patch ) # Import Salt Libs from ...
Update unit test for Saltify with credential verification
Update unit test for Saltify with credential verification
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
f9fa16fb2bc04d6bdddf19a939291e39b0fa1741
ores/wsgi/routes/v3/precache.py
ores/wsgi/routes/v3/precache.py
import json import logging from urllib.parse import unquote from flask import request from . import scores from ... import preprocessors, responses, util logger = logging.getLogger(__name__) def configure(config, bp, scoring_system): precache_map = util.build_precache_map(config) @bp.route("/v3/precache/...
import logging from flask import request from . import scores from ... import preprocessors, responses, util logger = logging.getLogger(__name__) def configure(config, bp, scoring_system): precache_map = util.build_precache_map(config) @bp.route("/v3/precache/", methods=["POST"]) @preprocessors.nocac...
Use the whole body of POST request as the json event in precaching
Use the whole body of POST request as the json event in precaching
Python
mit
he7d3r/ores,wiki-ai/ores,wiki-ai/ores,wiki-ai/ores,he7d3r/ores,he7d3r/ores
7494c5506cbfed0a641003f38085bd74f35d38b4
cryptchat/test/test_networkhandler.py
cryptchat/test/test_networkhandler.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Run from Cryptchat # python3 -m unittest discover import unittest from ..network.networkhandler import NetworkHandler from ..crypto.aes import AESCipher from ..crypto.diffiehellman import DiffieHellman class testNetworkHandler(unittest.TestCase): @classmethod ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Run from Cryptchat # python3 -m unittest discover import unittest from ..network.networkhandler import NetworkHandler from ..crypto.diffiehellman import DiffieHellman class testNetworkHandler(unittest.TestCase): @classmethod def setUpClass(cls): alice ...
Update test to run on new code
Update test to run on new code
Python
mit
djohsson/Cryptchat
c717ca0f2f85923dcf6ed3fd7a347f44f48f7941
ocradmin/plugins/numpy_nodes.py
ocradmin/plugins/numpy_nodes.py
import node import manager import stages import numpy class Rotate90Node(node.Node): """ Rotate a Numpy image by num*90 degrees. """ arity = 1 stage = stages.FILTER_BINARY name = "Numpy::Rotate90" def validate(self): super(RotateNode, self).validate() if not self._params....
import node import manager import stages import numpy class Rotate90Node(node.Node): """ Rotate a Numpy image by num*90 degrees. """ arity = 1 stage = stages.FILTER_BINARY name = "Numpy::Rotate90" _parameters = [{ "name": "num", "value": 1, }] ...
Add copy/pasted get_node function (TODO: Fix that), added parameters, fixed type
Add copy/pasted get_node function (TODO: Fix that), added parameters, fixed type
Python
apache-2.0
vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium
bece8b815ea3359433df708272ec3065d2c2a231
examples/basic_siggen.py
examples/basic_siggen.py
from pymoku import Moku, ValueOutOfRangeException from pymoku.instruments import * import time, logging import matplotlib import matplotlib.pyplot as plt logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s') logging.getLogger('pymoku').setLevel(logging.DEBUG) # Use Moku.get_by_serial() or get...
from pymoku import Moku, ValueOutOfRangeException from pymoku.instruments import * import time # Use Moku.get_by_serial() or get_by_name() if you don't know the IP m = Moku.get_by_name("example") i = SignalGenerator() m.attach_instrument(i) try: i.synth_sinewave(1, 1.0, 1000000) i.synth_squarewave(2, 1.0, 2000000, ...
Simplify and clean the siggen example
PM-133: Simplify and clean the siggen example
Python
mit
liquidinstruments/pymoku
5f416dadecf21accbaccd69740c5398967ec4a7c
doubles/nose.py
doubles/nose.py
from __future__ import absolute_import import sys from nose.plugins.base import Plugin from doubles.lifecycle import setup, verify, teardown, current_space from doubles.exceptions import MockExpectationError class NoseIntegration(Plugin): name = 'doubles' def beforeTest(self, test): setup() d...
from __future__ import absolute_import import sys from nose.plugins.base import Plugin from doubles.lifecycle import setup, verify, teardown, current_space from doubles.exceptions import MockExpectationError class NoseIntegration(Plugin): name = 'doubles' def beforeTest(self, test): setup() d...
Remove verification skipping in Nose plugin for now.
Remove verification skipping in Nose plugin for now.
Python
mit
uber/doubles
852ce5cee8171fdf4a33f3267de34042cb066bf3
tests/routine/test_config.py
tests/routine/test_config.py
import unittest from performance.routine import Config from performance.web import Request class ConfigTestCase(unittest.TestCase): def setUp(self): self.host = 'http://www.google.com' def test_init(self): config = Config(host=self.host) self.assertEqual(self.host, config.host) ...
import unittest from performance.routine import Config from performance.web import Request class ConfigTestCase(unittest.TestCase): def setUp(self): self.host = 'http://www.google.com' def test_init(self): config = Config(host=self.host) self.assertEqual(self.host, config.host) ...
Update test to for Config.add_request and config-counts
Update test to for Config.add_request and config-counts
Python
mit
BakeCode/performance-testing,BakeCode/performance-testing
1f9edc409029556bb943655de311f47dfd4c2237
src/hijri_converter/__init__.py
src/hijri_converter/__init__.py
__version__ = "2.1.2"
"""Accurate Hijri-Gregorian date converter based on the Umm al-Qura calendar""" __version__ = "2.1.2"
Add summary to package init
Add summary to package init
Python
mit
dralshehri/hijri-converter
562cad4342f9daff31ae383d96b2d86cabdca8fd
setup.py
setup.py
from distutils.core import setup, Extension data_files = ["inpout32.dll"] setup(name='PortFunctions', version='1.1', description = 'A Windows port reader for Python, built in C', author = 'Bradley Poulette', author_email = 'bpoulett@ualberta.ca', data_files = data_files, ext_modules=[Ext...
from distutils.core import setup, Extension data_files = [("DLLs", ["inpout32.dll"])] setup(name='PortFunctions', version='1.1', description = 'A Windows port reader for Python, built in C', author = 'Bradley Poulette', author_email = 'bpoulett@ualberta.ca', data_files = data_files, ext_...
Revert "Moved inpout32.dll from DLLs to Python27"
Revert "Moved inpout32.dll from DLLs to Python27" This reverts commit 9274a30ba7c3ee82e4f5a94c276f26fa03d5fe89.
Python
apache-2.0
chickendiver/PortFunctions,chickendiver/PortFunctions
b635eddbe3ad344b02ecae47333a4ddf4b17cd18
bin/remotePush.py
bin/remotePush.py
import json,httplib config_file = open('conf/net/ext_service/parse.json') silent_push_msg = { "where": { "deviceType": "ios" }, "data": { # "alert": "The Mets scored! The game is now tied 1-1.", "content-available": 1, "sound": "", } } parse_headers = { "X-Parse-Application-Id": co...
import json,httplib config_data = json.load(open('conf/net/ext_service/parse.json')) silent_push_msg = { "where": { "deviceType": "ios" }, "data": { # "alert": "The Mets scored! The game is now tied 1-1.", "content-available": 1, "sound": "", } } parse_headers = { "X-Parse-Applicat...
Fix minor issue in remote push
Fix minor issue in remote push We need to open the file and then parse it as json
Python
bsd-3-clause
joshzarrabi/e-mission-server,sunil07t/e-mission-server,joshzarrabi/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,joshzarrabi/e-mission-server,shankari/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,sunil07t/e-...
f75d3c71bbcebbfa574d83ff336f55d36dce4d48
setup.py
setup.py
from distutils.core import setup files = ["*.css"] setup( name="junit2html", version="023", description="Generate HTML reports from Junit results", author="Ian Norton", author_email="inorton@gmail.com", url="https://gitlab.com/inorton/junit2html", packages=["junit2htmlreport"], packag...
from distutils.core import setup files = ["*.css"] setup( name="junit2html", version="023", description="Generate HTML reports from Junit results", author="Ian Norton", author_email="inorton@gmail.com", url="https://gitlab.com/inorton/junit2html", packages=["junit2htmlreport"], packag...
Use entry_point instead of script for Windows (from sirhcel on github)
Use entry_point instead of script for Windows (from sirhcel on github)
Python
mit
inorton/junit2html
46bf4915426b14db84c46a0109645a3a0f3fa94d
mando/__init__.py
mando/__init__.py
__version__ = '0.3.2' try: from mando.core import Program except ImportError as e: # unfortunately this is the only workaround for argparse # and Python 2.6 e.version = __version__ raise e main = Program() command = main.command arg = main.arg parse = main.parse execute = main.e...
__version__ = '0.3.2' try: from mando.core import Program except ImportError as e: # pragma: no cover # unfortunately the only workaround for Python2.6, argparse and setup.py e.version = __version__ raise e main = Program() command = main.command arg = main.arg parse = main.parse execute = main.execu...
Add a pragma comment to importerror
Add a pragma comment to importerror
Python
mit
rubik/mando,MarioSchwalbe/mando,MarioSchwalbe/mando
191ba72a2d8b2e47363fcdbd200549ff3eef18fb
plex/objects/library/section.py
plex/objects/library/section.py
from plex.core.helpers import to_iterable from plex.objects.container import Container from plex.objects.core.base import Property from plex.objects.directory import Directory class Section(Directory): uuid = Property filters = Property(type=bool) refreshing = Property(type=bool) agent = Property ...
from plex.core.helpers import to_iterable from plex.objects.container import Container from plex.objects.core.base import Property from plex.objects.directory import Directory class Section(Directory): uuid = Property filters = Property(type=bool) refreshing = Property(type=bool) agent = Property ...
Fix issue with "titles" in SectionContainer.filter()
Fix issue with "titles" in SectionContainer.filter()
Python
mit
fuzeman/plex.py
1cdd8add2807ecedb7efb23428075423dcf9bfd2
ehriportal/suggestions/forms.py
ehriportal/suggestions/forms.py
"""Form for submitting suggestions.""" from django import forms from suggestions import models class SuggestionForm(forms.ModelForm): name = forms.CharField(max_length=100, label="Name", widget=forms.TextInput(attrs={'placeholder': 'Name'})) email = forms.EmailField(label="Email", required=False,...
"""Form for submitting suggestions.""" from django import forms from django.utils.translation import ugettext as _ from suggestions import models class SuggestionForm(forms.ModelForm): name = forms.CharField(max_length=100, label=_("Name"), widget=forms.TextInput(attrs={'placeholder': _('Name')})) ...
Add some translation stuff on the suggestion form
Add some translation stuff on the suggestion form
Python
mit
mikesname/ehri-collections,mikesname/ehri-collections,mikesname/ehri-collections
ae0158c49224464084e0302897c91e9c9fa7ffbe
webview.py
webview.py
"""Main module for pyicemon webview""" import SimpleHTTPServer import SocketServer import threading import sys import os import logging from monitor import Monitor from publishers import WebsocketPublisher from connection import Connection PORT = 80 if __name__ == "__main__": logging.basicConfig(level=logging.WA...
"""Main module for pyicemon webview""" # Handle difference in module name between python2/3. try: from SimpleHTTPServer import SimpleHTTPRequestHandler except ImportError: from http.server import SimpleHTTPRequestHandler try: from SocketServer import TCPServer except ImportError: from socketserver imp...
Make it work with python3.
Make it work with python3.
Python
mit
DiscoViking/pyicemon,DiscoViking/pyicemon
580eb57f68a8501cae925f747e94a8edb2c6a028
accounts/tests.py
accounts/tests.py
"""accounts app unittests """ from django.test import TestCase from django.contrib.auth import get_user_model class WelcomePageTest(TestCase): """Tests relating to the welcome_page view. """ def test_uses_welcome_template(self): """The root url should response with the welcome page template. ...
"""accounts app unittests """ from django.test import TestCase from django.contrib.auth import get_user_model from accounts.models import LoginToken TEST_EMAIL = 'newvisitor@example.com' class WelcomePageTest(TestCase): """Tests relating to the welcome_page view. """ def test_uses_welcome_template(se...
Add unit test for LoginToken model
Add unit test for LoginToken model
Python
mit
randomic/aniauth-tdd,randomic/aniauth-tdd
48d9e6c2d36b7c1beb11f6574624731a88cdccbc
accounts/views.py
accounts/views.py
from django.views.generic import View from django.shortcuts import render class MemberProfileView(View): template_name = 'accounts/profile.html' def get(self, request): return render(request, self.template_name)
from django.views.generic import View from django.shortcuts import render from django.contrib.auth.mixins import LoginRequiredMixin class MemberProfileView(LoginRequiredMixin, View): login_url = '/accounts/login/' redirect_field_name = 'redirect_to' template_name = 'accounts/profile.html' def get(sel...
Add login required mixin to user profile
Add login required mixin to user profile
Python
mit
davidjrichardson/uwcs-zarya,davidjrichardson/uwcs-zarya
44514a724fc8eff464d4c26a7e9c213644c99e53
elasticsearch_flex/tasks.py
elasticsearch_flex/tasks.py
from celery import shared_task @shared_task def update_indexed_document(index, created, pk): indexed_doc = index.init_using_pk(pk) indexed_doc.prepare() indexed_doc.save() @shared_task def delete_indexed_document(index, pk): indexed_doc = index.get(id=pk) indexed_doc.delete() __all__ = ('updat...
from celery import shared_task @shared_task(rate_limit='50/m') def update_indexed_document(index, created, pk): indexed_doc = index.init_using_pk(pk) indexed_doc.prepare() indexed_doc.save() @shared_task def delete_indexed_document(index, pk): indexed_doc = index.get(id=pk) indexed_doc.delete() ...
Add rate-limit to update_indexed_document task
Add rate-limit to update_indexed_document task
Python
mit
prashnts/dj-elasticsearch-flex,prashnts/dj-elasticsearch-flex
063d88ed5d5f48114cdf566433ae40d40a8674f4
nbgrader/utils.py
nbgrader/utils.py
import hashlib import autopep8 def is_grade(cell): """Returns True if the cell is a grade cell.""" if 'nbgrader' not in cell.metadata: return False return cell.metadata['nbgrader'].get('grade', False) def is_solution(cell): """Returns True if the cell is a solution cell.""" if 'nbgrader' ...
import hashlib import autopep8 def is_grade(cell): """Returns True if the cell is a grade cell.""" if 'nbgrader' not in cell.metadata: return False return cell.metadata['nbgrader'].get('grade', False) def is_solution(cell): """Returns True if the cell is a solution cell.""" if 'nbgrader' ...
Make sure points in checksum are consistent
Make sure points in checksum are consistent
Python
bsd-3-clause
EdwardJKim/nbgrader,modulexcite/nbgrader,jupyter/nbgrader,jhamrick/nbgrader,jdfreder/nbgrader,dementrock/nbgrader,ellisonbg/nbgrader,ellisonbg/nbgrader,ellisonbg/nbgrader,jhamrick/nbgrader,alope107/nbgrader,dementrock/nbgrader,MatKallada/nbgrader,EdwardJKim/nbgrader,ellisonbg/nbgrader,MatKallada/nbgrader,jdfreder/nbgra...
ed8b6b615bc8d006e3e31843fa31f0bda09109ed
spec/puzzle/examples/public_domain/zebra_puzzle_spec.py
spec/puzzle/examples/public_domain/zebra_puzzle_spec.py
import astor from data import warehouse from puzzle.examples.public_domain import zebra_puzzle from puzzle.problems import logic_problem from puzzle.puzzlepedia import prod_config from spec.mamba import * with _description('zebra_puzzle'): with description('solution'): with before.all: warehouse.save() ...
import astor from data import warehouse from puzzle.examples.public_domain import zebra_puzzle from puzzle.problems import logic_problem from puzzle.puzzlepedia import prod_config from spec.mamba import * with _description('zebra_puzzle'): with description('solution'): with before.all: warehouse.save() ...
Update zebra puzzle to reflect LogicProblem changes.
Update zebra puzzle to reflect LogicProblem changes.
Python
mit
PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge
c8921cf12418762c17d0b858ea2e134f292b2838
fireplace/cards/wog/neutral_epic.py
fireplace/cards/wog/neutral_epic.py
from ..utils import * ## # Minions class OG_271: "Scaled Nightmare" events = OWN_TURN_BEGIN.on(Buff(SELF, "OG_271e")) class OG_271e: atk = lambda self, i: i * 2
from ..utils import * ## # Minions class OG_271: "Scaled Nightmare" events = OWN_TURN_BEGIN.on(Buff(SELF, "OG_271e")) class OG_271e: atk = lambda self, i: i * 2 class OG_272: "Twilight Summoner" deathrattle = Summon(CONTROLLER, "OG_272t") class OG_337: "Cyclopian Horror" play = Buff(SELF, "OG_337e") * Co...
Implement Twilight Summoner and Cyclopian Horror
Implement Twilight Summoner and Cyclopian Horror
Python
agpl-3.0
beheh/fireplace,NightKev/fireplace,jleclanche/fireplace
af3515c8354dd525c2889eda75bfbc5cb7e2ecbf
massa/errors.py
massa/errors.py
# -*- coding: utf-8 -*- from flask import jsonify def register_error_handlers(app): app.register_error_handler(EntityNotFoundError, entity_not_found_handler) app.register_error_handler(InvalidInputError, invalid_input_handler) def entity_not_found_handler(e): return jsonify({'message': e.message}), 404...
# -*- coding: utf-8 -*- from flask import jsonify def register_error_handlers(app): app.register_error_handler(EntityNotFoundError, entity_not_found_handler) app.register_error_handler(InvalidInputError, invalid_input_handler) def entity_not_found_handler(e): return jsonify(e.as_dict()), 404 def inva...
Add method to retrieve the DomainError as a dict.
Add method to retrieve the DomainError as a dict.
Python
mit
jaapverloop/massa
04e64fea6e11a188a53d0b8d69ef97686868be1c
tests/py_ext_tests/test_png.py
tests/py_ext_tests/test_png.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import faint import os import py_ext_tests class TestPng(unittest.TestCase): def test_write_png(self): out_dir = py_ext_tests.make_test_dir(self) b1 = faint.Bitmap((5,7)) b1.set_pixel((0,0),(255,0,255)) ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import faint from faint import png import os import py_ext_tests class TestPng(unittest.TestCase): def test_write_png(self): out_dir = py_ext_tests.make_test_dir(self) b1 = faint.Bitmap((5,7)) b1.set_pixel((0,0...
Use the png module in test.
Use the png module in test.
Python
apache-2.0
lukas-ke/faint-graphics-editor,lukas-ke/faint-graphics-editor,lukas-ke/faint-graphics-editor,lukas-ke/faint-graphics-editor
e95bcb1a2688a9b5a0c09728cdd0082b643de943
pcbot/config.py
pcbot/config.py
import json from os.path import exists from os import mkdir class Config: config_path = "config/" def __init__(self, filename, data=None, load=True): self.filepath = "{}{}.json".format(self.config_path, filename) if not exists(self.config_path): mkdir(self.config_path) l...
import json from os.path import exists from os import mkdir class Config: config_path = "config/" def __init__(self, filename, data=None, load=True): self.filepath = "{}{}.json".format(self.config_path, filename) if not exists(self.config_path): mkdir(self.config_path) l...
Check if data is not None instead of if data is true
Check if data is not None instead of if data is true
Python
mit
pckv/pcbot,PcBoy111/PC-BOT-V2,PcBoy111/PCBOT
0e513331fd649ac71c2d9690c1cb72bf5954973c
__init__.py
__init__.py
# The version of Review Board. # # This is in the format of: # # (Major, Minor, Micro, alpha/beta/rc/final, Release Number, Released) # VERSION = (1, 0, 0, 'final', 0, True) def get_version_string(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version += ".%s" % VERSION[2] if V...
# The version of Review Board. # # This is in the format of: # # (Major, Minor, Micro, alpha/beta/rc/final, Release Number, Released) # VERSION = (1, 1, 0, 'alpha', 1, False) def get_version_string(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version += ".%s" % VERSION[2] if ...
Bump to Review Board 1.1alpha1.dev.
Bump to Review Board 1.1alpha1.dev.
Python
mit
1tush/reviewboard,1tush/reviewboard,Khan/reviewboard,bkochendorfer/reviewboard,beol/reviewboard,davidt/reviewboard,Khan/reviewboard,custode/reviewboard,sgallagher/reviewboard,bkochendorfer/reviewboard,beol/reviewboard,chazy/reviewboard,KnowNo/reviewboard,chipx86/reviewboard,beol/reviewboard,atagar/ReviewBoard,1tush/rev...
3f62c7b413f3ef6b1072437bcd1f08b1a9c6b6ea
armstrong/core/arm_layout/utils.py
armstrong/core/arm_layout/utils.py
from django.utils.safestring import mark_safe from django.template.loader import render_to_string from armstrong.utils.backends import GenericBackend template_finder = GenericBackend('ARMSTRONG_LAYOUT_TEMPLATE_FINDER', defaults='armstrong.core.arm_layout.utils.get_layout_template_name')\ .get_backend...
from django.utils.safestring import mark_safe from django.template.loader import render_to_string from armstrong.utils.backends import GenericBackend def get_layout_template_name(model, name): ret = [] for a in model.__class__.mro(): if not hasattr(a, "_meta"): continue ret.append...
Revert backend template finder code
Revert backend template finder code
Python
apache-2.0
armstrong/armstrong.core.arm_layout,armstrong/armstrong.core.arm_layout
4503e6671828497189736c86d408f6c0a8b47058
lambda_tweet.py
lambda_tweet.py
import boto3 import tweepy import json import base64 from tweet_s3_images import TweetS3Images with open('./config.json', 'r') as file: config = json.loads(file.read()) # Decrypt API keys client = boto3.client('kms') response = client.decrypt(CiphertextBlob=base64.b64decode(config['secrets'])) sec...
import boto3 import tweepy import json import base64 from tweet_s3_images import TweetS3Images with open('./config.json', 'r') as file: config = json.loads(file.read()) # Decrypt API keys client = boto3.client('kms') response = client.decrypt(CiphertextBlob=base64.b64decode(config['secrets'])) sec...
Update key name for S3
Update key name for S3
Python
mit
onema/lambda-tweet
8f099581930d0f55454751d8fbba05a3685c6144
mbuild/tests/test_xyz.py
mbuild/tests/test_xyz.py
import numpy as np import pytest import mbuild as mb from mbuild.tests.base_test import BaseTest class TestXYZ(BaseTest): def test_save(self, ethane): ethane.save(filename='ethane.xyz')
import numpy as np import pytest import mbuild as mb from mbuild.tests.base_test import BaseTest class TestXYZ(BaseTest): def test_save(self, ethane): ethane.save(filename='ethane.xyz') ethane.save(filename='ethane.pdb') ethane_in = mb.load('ethane.xyz', top='ethane.pdb') assert ...
Add sanity checks to tests
Add sanity checks to tests This should be cleaned up with an XYZ read that does not require reading in an extra file (mdtraj requires a file with topological information, in this case PDB file).
Python
mit
iModels/mbuild,iModels/mbuild
7d20874c43637f1236442333f60a88ec653f53f2
resources/launchers/alfanousDesktop.py
resources/launchers/alfanousDesktop.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import alfanousDesktop.Gui alfanousDesktop.Gui.main()
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys # The paths should be generated by setup script sys.argv.extend( '-i', '/usr/share/alfanous-indexes/', '-l', '/usr/locale/', '-c', '/usr/share/alfanous-config/') from alfanousDesktop.Gui import * main()
Add resource paths to python launcher script (proxy)
Add resource paths to python launcher script (proxy)
Python
agpl-3.0
keelhaule/alfanous,muslih/alfanous,saifmahamood/alfanous,saifmahamood/alfanous,muslih/alfanous,muslih/alfanous,keelhaule/alfanous,saifmahamood/alfanous,saifmahamood/alfanous,keelhaule/alfanous,saifmahamood/alfanous,abougouffa/alfanous,keelhaule/alfanous,muslih/alfanous,muslih/alfanous,abougouffa/alfanous,keelhaule/alfa...
7537387aa80109877d6659cc54ec0ee7aa6496bd
robot/Cumulus/resources/locators_50.py
robot/Cumulus/resources/locators_50.py
from locators_51 import * import copy npsp_lex_locators = copy.deepcopy(npsp_lex_locators) # current version (Sravani's ) npsp_lex_locators['delete_icon']='//span[contains(text() ,"{}")]/following::span[. = "{}"]/following-sibling::a/child::span[@class = "deleteIcon"]' npsp_lex_locators['object']['field']= "//div[con...
from locators_51 import * import copy npsp_lex_locators = copy.deepcopy(npsp_lex_locators) npsp_lex_locators['delete_icon']='//span[contains(text() ,"{}")]/following::span[. = "{}"]/following-sibling::a/child::span[@class = "deleteIcon"]' npsp_lex_locators['object']['field']= "//div[contains(@class, 'uiInput')][.//lab...
Revert "changes in locator_50 file (current and old versions)"
Revert "changes in locator_50 file (current and old versions)" This reverts commit 819dfa4ed2033c1f82973edb09215b96d3c4b188.
Python
bsd-3-clause
SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus
c72b727d373ac620379fe0a2a0c1b85bb868962e
test_arrange_schedule.py
test_arrange_schedule.py
from arrange_schedule import * def test_crawler_cwb_img(system_setting): send_msg = {} send_msg['server_dir'] = system_setting['board_py_dir'] send_msg['user_id'] = 1 receive_msg = crawler_cwb_img(send_msg) assert receive_msg['result'] == 'success' if __name__ == "__main__": system_setting =...
from arrange_schedule import * def test_read_system_setting(): keys = ['board_py_dir','shutdown','max_db_log','min_db_activity'] system_setting = read_system_setting() for key in keys: assert key in system_setting return system_setting def test_crawler_cwb_img(system_setting): send_msg = ...
Add test case for read_system_setting()
Add test case for read_system_setting()
Python
apache-2.0
stvreumi/electronic-blackboard,Billy4195/electronic-blackboard,stvreumi/electronic-blackboard,Billy4195/electronic-blackboard,chenyang14/electronic-blackboard,chenyang14/electronic-blackboard,SWLBot/electronic-blackboard,SWLBot/electronic-blackboard,stvreumi/electronic-blackboard,stvreumi/electronic-blackboard,Billy419...
854ad9b06ab5da3c4ac0ae308d4d8d01a0739d42
openliveq/click_model.py
openliveq/click_model.py
from math import exp class ClickModel(object): ''' Simple Position-biased Model: P(C_r=1) = P(A_r=1|E_r=1)P(E_r=1), where C_r is click on the r-th document, A_r is being attracted by the r-th document, and E_r is examination of the r-th document. In this simple model, the e...
from math import exp class ClickModel(object): ''' Simple Position-biased Model: P(C_r=1) = P(A_r=1|E_r=1)P(E_r=1), where C_r is click on the r-th document, A_r is being attracted by the r-th document, and E_r is examination of the r-th document. In this simple model, the e...
Use topk in the click model
Use topk in the click model
Python
mit
mpkato/openliveq
343baa4b8a0ed9d4db0727c514d9ff97b937c7ee
adLDAP.py
adLDAP.py
import ldap def checkCredentials(username, password): if password == "": return 'Empty Password' controller = 'devdc' domainA = 'dev' domainB = 'devlcdi' domain = domainA + '.' + domainB ldapServer = 'ldap://' + controller + '.' + domain ldapUsername = username + '@' + domain ldapPassword = password b...
import ldap validEditAccessGroups = ['Office Assistants', 'Domain Admins'] def checkCredentials(username, password): if password == "": return 'Empty Password' controller = 'devdc' domainA = 'dev' domainB = 'devlcdi' domain = domainA + '.' + domainB ldapServer = 'ldap://' + controller + '.' + domain ldap...
Add group fetching from AD
Add group fetching from AD
Python
mit
lcdi/Inventory,lcdi/Inventory,lcdi/Inventory,lcdi/Inventory
92108cdac6e9324ba9584359b6502e87ce7dcccb
owebunit/tests/simple.py
owebunit/tests/simple.py
import BaseHTTPServer import threading import time import owebunit class Handler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): self.wfile.write("HTTP/1.0 200 OK\n") self.wfile.write("Content-Type: text/plain\n") self.wfile.write("\n") self.wfile.write("Response text") d...
import BaseHTTPServer import threading import time import owebunit import bottle app = bottle.Bottle() @app.route('/ok') def ok(): return 'ok' @app.route('/internal_server_error') def internal_error(): bottle.abort(500, 'internal server error') def run_server(): app.run(host='localhost', port=8041) cla...
Switch to using bottle in test suite
Switch to using bottle in test suite
Python
bsd-2-clause
p/webracer
6daa0f1aa06092598892cb37a7f3c5f3541fa0c2
cms/manage.py
cms/manage.py
#!/usr/bin/env python from django.core.management import execute_manager import imp try: imp.find_module('settings') # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized t...
#!/usr/bin/env python from django.core.management import execute_manager import imp try: imp.find_module('settings') # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. " "It app...
Fix string layout for readability
Fix string layout for readability
Python
agpl-3.0
prarthitm/edxplatform,nanolearningllc/edx-platform-cypress,benpatterson/edx-platform,mjirayu/sit_academy,yokose-ks/edx-platform,Edraak/edx-platform,10clouds/edx-platform,raccoongang/edx-platform,kursitet/edx-platform,jolyonb/edx-platform,cecep-edu/edx-platform,Edraak/circleci-edx-platform,nttks/edx-platform,ampax/edx-p...
7217e2dcbec3e13d730e47e001d00c5fb8534468
moa/__init__.py
moa/__init__.py
'''A framework for designing and running experiments in Python using Kivy. ''' __version__ = '0.1-dev' from kivy import kivy_home_dir from os import environ from os.path import join from moa.logger import Logger #: moa configuration filename moa_config_fn = '' if not environ.get('MOA_DOC_INCLUDE'): moa_config_...
'''A framework for designing and running experiments in Python using Kivy. ''' __version__ = '0.1-dev' from kivy import kivy_home_dir from os import environ from os.path import join if 'MOA_CLOCK' in environ: from moa.clock import set_clock set_clock(clock='moa') from moa.logger import Logger #: moa confi...
Add config option to start moa clock.
Add config option to start moa clock.
Python
mit
matham/moa
8556fc0b6fb024ab6cc68364270462681209108a
examples/match.py
examples/match.py
import cassiopeia as cass from cassiopeia.core import Summoner def print_summoner(name: str, id: int): me = Summoner(name="Kalturi", id=21359666) #matches = cass.get_matches(me) matches = me.matches match = matches[0] print(match.id) for p in match.participants: print(p.id, p.champion...
import cassiopeia as cass from cassiopeia.core import Summoner def print_newest_match(name: str, region: str): summoner = Summoner(name=name, region=region) # matches = cass.get_matches(summoner) matches = summoner.matches match = matches[0] print('Match ID:', match.id) for p in match.partici...
Add print description, use function arguments
Add print description, use function arguments - changed name and ID to being name and region - Add a string to the print calls denoting what's being printed out
Python
mit
robrua/cassiopeia,10se1ucgo/cassiopeia,meraki-analytics/cassiopeia
87d9365cd3f19a52957e2e26cefa9fa048c2acb1
TWLight/resources/filters.py
TWLight/resources/filters.py
import django_filters from .models import Language, Partner from .helpers import get_tag_choices class PartnerFilter(django_filters.FilterSet): tags = django_filters.ChoiceFilter( label="Tags", choices=get_tag_choices(), method="tags_filter" ) languages = django_filters.ModelChoiceFilter(queryset...
from django.utils.translation import gettext as _ from .models import Language, Partner from .helpers import get_tag_choices import django_filters class PartnerFilter(django_filters.FilterSet): tags = django_filters.ChoiceFilter( # Translators: On the MyLibrary page (https://wikipedialibrary.wmflabs.or...
Mark filter headers in My Library for translation
Mark filter headers in My Library for translation
Python
mit
WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight
e563e8f8f1af691c4c9aa2f6177fbf2c8e2a4855
della/user_manager/draw_service.py
della/user_manager/draw_service.py
import json from django.conf import settings def _get_default_file_content(): return {'status': False} def _write_status_file(): file_path = settings.STATUS_FILE with open(file_path, 'w') as f: json.dump({'status': True}, f) return True def _get_status_file(): file_path = settings.STA...
import json import random from collections import deque from django.conf import settings from django.contrib.auth.models import User def _get_default_file_content(): return {'status': False} def _write_status_file(): file_path = settings.STATUS_FILE with open(file_path, 'w') as f: json.dump({'s...
Add helper funtions for making pairs
Add helper funtions for making pairs
Python
mit
avinassh/della,avinassh/della,avinassh/della
21f06746eebe809f5d7017394b4c7c50ba319066
street_score/bulkadmin/forms.py
street_score/bulkadmin/forms.py
import csv from django import forms class BulkUploadForm(forms.Form): data = forms.FileField() def clean(self): cleaned_data = super(BulkUploadForm, self).clean() cleaned_data['data'] = BulkUploadForm.load_csv(cleaned_data['data']) return cleaned_data @staticmethod def load...
import csv from django import forms class BulkUploadForm(forms.Form): data = forms.FileField(help_text=""" <p>Select the CSV file to upload. The file should have a header for each column you want to populate. When you have selected your file, click the 'Upload' button below.</p> ...
Add a help_text string to the admin form
Add a help_text string to the admin form
Python
mit
openplans/streetscore,openplans/streetscore,openplans/streetscore
edadd7385ff8c839b524a6c06d0fc370c3db25bb
src/constants.py
src/constants.py
#!/usr/bin/env python TRAJECTORY_TYPE = 'circular' if TRAJECTORY_TYPE == 'linear': SIMULATION_TIME_IN_SECONDS = 40 elif TRAJECTORY_TYPE == 'circular': SIMULATION_TIME_IN_SECONDS = 120 DELTA_T = 0.1 # this is the sampling time STEPS = int(SIMULATION_TIME_IN_SECONDS / DELTA_T) K_V = 0.90 K_W = 0.90
#!/usr/bin/env python TRAJECTORY_TYPE = 'squared' if TRAJECTORY_TYPE == 'linear': SIMULATION_TIME_IN_SECONDS = 40.0 elif TRAJECTORY_TYPE == 'circular': SIMULATION_TIME_IN_SECONDS = 120.0 elif TRAJECTORY_TYPE == 'squared': SIMULATION_TIME_IN_SECONDS = 160.0 DELTA_T = 0.1 # this is the sampling time STEPS =...
Add simulation time for a squared trajectory
Add simulation time for a squared trajectory
Python
mit
bit0001/trajectory_tracking,bit0001/trajectory_tracking
d386c389b9e350b01fdf25f7cd91857d3fbb1ead
opps/contrib/multisite/admin.py
opps/contrib/multisite/admin.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib import admin from django.conf import settings from django.utils import timezone from .models import SitePermission class AdminViewPermission(admin.ModelAdmin): def queryset(self, request): queryset = super(AdminViewPermission, self).query...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib import admin from django.conf import settings from django.utils import timezone from .models import SitePermission class AdminViewPermission(admin.ModelAdmin): def queryset(self, request): queryset = super(AdminViewPermission, self).query...
Use OPPS_MULTISITE_ADMIN on queryset AdminViewPermission
Use OPPS_MULTISITE_ADMIN on queryset AdminViewPermission
Python
mit
opps/opps,YACOWS/opps,williamroot/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps
52e6dabe13abdcd81a097beaacca585800397552
examples/upperair/Wyoming_Request.py
examples/upperair/Wyoming_Request.py
# Copyright (c) 2017 Siphon Contributors. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Wyoming Upper Air Data Request ============================== This example shows how to use siphon's `simplewebswervice` support to create a query to the Wyoming upper air ar...
# Copyright (c) 2017 Siphon Contributors. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Wyoming Upper Air Data Request ============================== This example shows how to use siphon's `simplewebswervice` support to create a query to the Wyoming upper air ar...
Add attaching units to example.
Add attaching units to example.
Python
bsd-3-clause
Unidata/siphon
394ed06411d3ca3ada66aab3bee796682895acc0
cla_backend/apps/core/testing.py
cla_backend/apps/core/testing.py
from django.core.management import call_command from django.test.utils import get_runner from django.conf import settings from django.db import connections, DEFAULT_DB_ALIAS # use jenkins runner if present otherwise the default django one if 'django_jenkins' in settings.INSTALLED_APPS: base_runner = 'django_jenki...
from django.core.management import call_command from django.test.utils import get_runner from django.conf import settings from django.db import connections, DEFAULT_DB_ALIAS # use jenkins runner if present otherwise the default django one if 'django_jenkins' in settings.INSTALLED_APPS: base_runner = 'django_jenki...
Install pgcrypto PGSQL extension but only if it does not exist already (e.g. from template1)
Install pgcrypto PGSQL extension but only if it does not exist already (e.g. from template1)
Python
mit
ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend
9e2d3ed154e977d38126f610f11a0df3a0141da1
apps/local_apps/account/context_processors.py
apps/local_apps/account/context_processors.py
from account.models import Account, AnonymousAccount def openid(request): return {'openid': request.openid} def account(request): account = AnonymousAccount(request) if request.user.is_authenticated(): try: account = Account._default_manager.get(user=request.user) except (Acco...
from account.models import Account, AnonymousAccount def openid(request): return {'openid': request.openid} def account(request): if request.user.is_authenticated(): try: account = Account._default_manager.get(user=request.user) except (Account.DoesNotExist, Account.MultipleObject...
Handle the exception case in the account context_processor.
Handle the exception case in the account context_processor. git-svn-id: 51ba99f60490c2ee9ba726ccda75a38950f5105d@1119 45601e1e-1555-4799-bd40-45c8c71eef50
Python
mit
alex/pinax,amarandon/pinax,amarandon/pinax,amarandon/pinax,amarandon/pinax,alex/pinax,alex/pinax
dddb15a50d64a7b2660f2af1a407dd7fa9b3742b
samples/auth.py
samples/auth.py
"""[START auth]""" from oauth2client.client import GoogleCredentials from googleapiclient.discovery def get_service(): credentials = GoogleCredentials.get_application_default() return build('bigquery', 'v2', credentials) """[END auth]"""
"""[START auth]""" from oauth2client.client import GoogleCredentials from googleapiclient.discovery import build def get_service(): credentials = GoogleCredentials.get_application_default() return build('bigquery', 'v2', credentials) """[END auth]"""
Make sure to import build from googleapiclient.discovery.
Make sure to import build from googleapiclient.discovery.
Python
apache-2.0
googlearchive/bigquery-samples-python,googlearchive/bigquery-samples-python
0a9601c4ee085c38f660e6d40c98256098576a92
setup.py
setup.py
from distutils.core import setup from pip.req import parse_requirements install_reqs = parse_requirements("./requirements.txt") reqs = [str(ir.req) for ir in install_reqs] setup( name='url-matchers', version='0.0.1', modules=['url_matchers'], install_requires=reqs, author="Alex Good", author_e...
from distutils.core import setup from os import path from pip.req import parse_requirements requirements_location = path.join(path.dirname(__file__), "requirements.txt") install_reqs = parse_requirements(requirements_location) reqs = [str(ir.req) for ir in install_reqs] setup( name='url-matchers', version='0....
Use absolute path for requirements file
Use absolute path for requirements file
Python
mit
alexjg/url-matchers
834637f8860f6b2d99726f9f531d05884e375ea3
setup.py
setup.py
#!/usr/bin/env python import os import re from distutils.core import setup DIRNAME = os.path.abspath(os.path.dirname(__file__)) rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts)) README = open(rel('README.rst')).read() INIT_PY = open(rel('flask_redis.py')).read() VERSION = re.findall("__version__ ...
#!/usr/bin/env python import os import re import sys from distutils.core import setup DIRNAME = os.path.abspath(os.path.dirname(__file__)) rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts)) with open(rel('README.rst')) as handler: README = handler.read() with open(rel('flask_redis.py')) as han...
Fix install requirements due to Python versions.
Fix install requirements due to Python versions.
Python
bsd-3-clause
playpauseandstop/Flask-And-Redis,playpauseandstop/Flask-And-Redis
d1a784ec841f4f0fbe8945bf7a5f81e7c3952b93
plugin_handler.py
plugin_handler.py
# -*- coding: utf-8 -*- # Execute this file to see what plugins will be loaded. # Implementation leans to Lex Toumbourou's example: # https://lextoumbourou.com/blog/posts/dynamically-loading-modules-and-classes-in-python/ import os import pkgutil import sys from typing import List from venues.abstract_venue import ...
# -*- coding: utf-8 -*- # Execute this file to see what plugins will be loaded. # Implementation leans to Lex Toumbourou's example: # https://lextoumbourou.com/blog/posts/dynamically-loading-modules-and-classes-in-python/ import os import pkgutil import sys from typing import List from venues.abstract_venue import ...
Disable more plugins to make it work again.
Disable more plugins to make it work again. Will fix venues parsing later. Signed-off-by: Ville Valkonen <989b9f9979d21943697628c770235933300d59bc@gmail.com>
Python
isc
weezel/BandEventNotifier
b36f2518666572ccd3b98dd88536533e17a39e3f
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='SpaceScout-Server', version='1.0', description='REST Backend for SpaceScout', install_requires=[ 'Django>=1.7,<1.8', 'mock<=1.0.1', 'oauth2<=1.5.211', ...
#!/usr/bin/env python from distutils.core import setup setup(name='SpaceScout-Server', version='1.0', description='REST Backend for SpaceScout', install_requires=[ 'Django>=1.7,<1.8', 'mock<=1.0.1', 'oauth2<=1.5.211', ...
Remove oauth_provider as that's the eggname for django-oauth-plus.
Remove oauth_provider as that's the eggname for django-oauth-plus.
Python
apache-2.0
uw-it-aca/spotseeker_server,uw-it-aca/spotseeker_server,uw-it-aca/spotseeker_server
8d5e1aaf0a06eeeacafcf62a58f83a4c23fc59b7
comet/handler/test/test_spawn.py
comet/handler/test/test_spawn.py
import os import sys import tempfile from twisted.trial import unittest from twisted.python import util from comet.icomet import IHandler from comet.handler import SpawnCommand SHELL = '/bin/sh' class DummyEvent(object): def __init__(self, text=None): self.text = text or u"" class SpawnCommandProtocolT...
import os import sys import tempfile from twisted.trial import unittest from twisted.python import util from comet.icomet import IHandler from comet.handler import SpawnCommand SHELL = '/bin/sh' class DummyEvent(object): def __init__(self, text=None): self.text = text or u"" class SpawnCommandProtocolT...
Convert read data to unicode.
Convert read data to unicode. The NamedTemporaryFile is in binary mode by default, so the read returns raw bytes.
Python
bsd-2-clause
jdswinbank/Comet,jdswinbank/Comet
0261c895cb41f5caba42ae432b997fd3c941e96f
tests.py
tests.py
import pytest import cleaner class TestTagRemoval(): def test_span_removal(self): text = ('<span style="font-family: &quot;helvetica neue&quot; ,' '&quot;arial&quot; , &quot;helvetica&quot; , sans-serif;">This is some' ' dummy text lalalala</span> This is some more dummy text ' '<sp...
import pytest import cleaner class TestTagTools(): def test_get_pure_tag(self): tag1 = '<div>' tag2 = '</div>' tag3 = '<pre class="prettyprint">' assert cleaner.get_pure_tag(tag1) == '<div>' assert cleaner.get_pure_tag(tag2) == '</div>' assert cleaner.get_pure_tag(t...
Add test for getting pure html tag
Add test for getting pure html tag
Python
mit
jamalmoir/blogger_html_cleaner
d5de8224a0d67b74444a0ad7c755e3c7bc1c39a5
features.py
features.py
""" Define all features to be extracted from the data """ from PIL import Image from PIL.ImageStat import Stat from skimage.feature import local_binary_pattern class BaseFeatureExtractor(object): """ Basis for all feature extractors """ def extract(self, data): """ Return list of feature values ...
""" Define all features to be extracted from the data """ import numpy as np from PIL import Image from PIL.ImageStat import Stat from skimage.feature import local_binary_pattern class BaseFeatureExtractor(object): """ Basis for all feature extractors """ def extract(self, data): """ Return lis...
Use histogram of local binary patterns
Use histogram of local binary patterns
Python
mit
kpj/PyClass
a20ffb81801a5f96af47ccf4bf7fe0133e74102b
source/views.py
source/views.py
from rest_framework.views import APIView from rest_framework.response import Response class EnumView(APIView): permission_classes = [] def get(self, *args, **kwargs): enums = self.enum_class.get_as_tuple_list() context = [] for enum in enums: _id = enum[1] i18...
from rest_framework.views import APIView from rest_framework.response import Response class EnumView(APIView): permission_classes = [] fields = ('i18n', ) def get(self, *args, **kwargs): enums = self.enum_class.get_as_tuple_list() context = [] for enum in enums: _id =...
Add possibility to set fields
Add possibility to set fields
Python
mit
iktw/django-rest-enum-view
2314829d58b200570272332c89a85b4009a396bf
tests/common.py
tests/common.py
from pprint import pprint, pformat import datetime import os from sgmock import Fixture from sgmock import TestCase if 'USE_SHOTGUN' in os.environ: from shotgun_api3 import ShotgunError, Fault import shotgun_api3_registry def Shotgun(): return shotgun_api3_registry.connect('sgsession.tests', serve...
from pprint import pprint, pformat import datetime import os from sgmock import Fixture from sgmock import TestCase _shotgun_server = os.environ.get('SHOTGUN', 'mock') if _shotgun_server == 'mock': from sgmock import Shotgun, ShotgunError, Fault else: from shotgun_api3 import ShotgunError, Fault import sh...
Change detection of Shotgun server for tests
Change detection of Shotgun server for tests
Python
bsd-3-clause
westernx/sgsession
fbf6fe6d6e5e3b9e9ea192eba7ef6b76b66ebf0a
trade_client.py
trade_client.py
import json import socket from orderbook import create_confirm def send_msg(ip, port, message): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((ip, port)) try: sock.sendall(message) response = sock.recv(1024) print "Received: {}".format(response) finall...
import json import socket from orderbook import create_confirm def send_msg(ip, port, message): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((ip, port)) try: sock.sendall(message) response = sock.recv(1024) finally: sock.close() return response ...
Handle incoming messages that aren't JSON objects.
Handle incoming messages that aren't JSON objects.
Python
mit
Tribler/decentral-market
523df3d68af5c8fbd52e0f86a7201d9c39f50f54
lib/writeFiles.py
lib/writeFiles.py
import json import sys import os f = open(sys.argv[1]) out = sys.argv[2] data = json.load(f) for key in data["files"]: val = data["files"][key] try: os.makedirs(out + "/" + os.path.dirname(key)) except: print "ignoring error" if type(val) == str or type(val) == unicode: pr...
import json import sys import os f = open(sys.argv[1]) out = sys.argv[2] data = json.load(f) for key in data["files"]: val = data["files"][key] try: os.makedirs(out + "/" + os.path.dirname(key)) except: print "ignoring error" if type(val) == str or type(val) == unicode: print ...
Fix errors when contents of a file contains UTF-8 chars.
Fix errors when contents of a file contains UTF-8 chars. - Convert tabs to spaces. - Use a more pythonic way to open (and write into) the file. - Add UTF-8 encoding before writing the contents of the file.
Python
mit
sheenobu/nix-home,sheenobu/nix-home
da2376744ec5b1823ea75f3cefbb0de0ac000c1b
tests/secrets.py
tests/secrets.py
# -*- coding: utf-8 -*- import os from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) OPS_KEY = os.environ['OPS_KEY'] OPS_SECRET = os.environ['OPS_SECRET']
# -*- coding: utf-8 -*- import os from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) OPS_KEY = os.environ['OPS_KEY'] OPS_SECRET = os.environ['OPS_SECRET'] TWITTER_CONSUMER_ACCESS = os.environ['TWITTER_CONSUMER_ACCESS'] TWITTER_CONSUMER_SECRET = os.environ['TWITTER_CONSUMER_SECRET'] TWITTER_ACCESS ...
Read twitter tokens from .env
Read twitter tokens from .env
Python
mit
nestauk/inet
53be5c9c86d544567f8171baba58128b5ad0502a
tests/test_io.py
tests/test_io.py
import nonstdlib def test_capture_output(): import sys with nonstdlib.capture_output() as output: print('std', end='', file=sys.stdout) print('st', end='', file=sys.stderr) print('out', file=sys.stdout) print('derr', file=sys.stderr) assert 'stdout' in output assert 's...
#!/usr/bin/env python from __future__ import division from __future__ import print_function from __future__ import unicode_literals import nonstdlib def test_capture_output(): import sys with nonstdlib.capture_output() as output: print('std', end='', file=sys.stdout) print('st', end='', file...
Make the tests compatible with python2.
Make the tests compatible with python2.
Python
mit
kalekundert/nonstdlib,KenKundert/nonstdlib,KenKundert/nonstdlib,kalekundert/nonstdlib
ee65b4ecd9a94598e1fa9fe2a8a25697c2480477
test/conftest.py
test/conftest.py
import pytest def pytest_addoption(parser): parser.addoption("--travis", action="store_true", default=False, help="Only run tests marked for Travis") def pytest_configure(config): config.addinivalue_line("markers", "not_travis: Mark a test that should not be ...
import pytest def pytest_addoption(parser): parser.addoption("--travis", action="store_true", default=False, help="Only run tests marked for Travis") def pytest_configure(config): config.addinivalue_line("markers", "not_travis: Mark a test that should not be ...
Clear caches in test item teardown
test: Clear caches in test item teardown Rather than relying on the user manually clearing the COFS function cache and linear problem cache, clear them in the teardown step of each test.
Python
mit
tkarna/cofs
bf961cf69386404b03d46ebc3ab34b7da804f016
test/test_ttt.py
test/test_ttt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_ttt ---------------------------------- Tests for `ttt` module. """ import unittest from ttt import ttt class TestPat(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_000_something(self): pass ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_ttt ---------------------------------- Tests for `ttt` module. """ class Test: def setup(self): pass def teardown(self): pass def test_(self): pass
Use pytest instead of unittest
Use pytest instead of unittest
Python
isc
yerejm/ttt,yerejm/ttt
43dce889a79b77445eebe0d0e15532b64e7728d5
tests/test_upbeatbot.py
tests/test_upbeatbot.py
import unittest from libs.upbeatbot import UpBeatBot class TestUpbeatBot(unittest.TestCase): @classmethod def setUpClass(cls): cls.upbeat_bot = UpBeatBot() def test_chosen_animal_returned(self): tweet = 'Hey @upbeatbot send me a dog!' animal = self.upbeat_bot._get_animal_from_mes...
import unittest from libs.upbeatbot import UpBeatBot class TestUpbeatBot(unittest.TestCase): @classmethod def setUpClass(cls): cls.upbeat_bot = UpBeatBot() def test_get_animal_from_message_chosen_animal_returned(self): tweet = 'Hey @upbeatbot send me a dog!' animal = self.upbeat_...
Use more descriptive unit test names
Use more descriptive unit test names
Python
mit
nickdibari/UpBeatBot
12b313ed0be7049335046a00844c378b0bed7064
helpernmap.py
helpernmap.py
import nmap class HelperNmap: def __init__(self,args=""): self.args = args def process(self): print "Running Scan" nm = nmap.PortScanner() nm.scan(hosts='173.255.243.189', arguments='-sV -p1-5000') for host in nm.all_hosts(): print('----------------------------------------------------')...
import nmap class HelperNmap: def __init__(self,args=""): self.args = args def process(self): if self.__setParams(): print "Running Scan" nm = nmap.PortScanner() nm.scan(hosts=str(self.args), arguments='-sV -p1-5000') for host in nm.all_hosts(): print('--------------------...
Add network target as a params
Add network target as a params Signed-off-by: Jacobo Tibaquira <d8d2a0ed36dd5f2e41c721fffbe8af2e7e4fe993@gmail.com>
Python
apache-2.0
JKO/nsearch,JKO/nsearch
2dc031aca46c02449eb85ee5149b75951e26e3b9
deferrable/backend/sqs.py
deferrable/backend/sqs.py
from .base import BackendFactory, Backend from ..queue.sqs import SQSQueue class SQSBackendFactory(BackendFactory): def __init__(self, sqs_connection_thunk, visibility_timeout=30, wait_time=10): """To allow backends to be initialized lazily, this factory requires a thunk (parameter-less closure) wh...
from .base import BackendFactory, Backend from ..queue.sqs import SQSQueue class SQSBackendFactory(BackendFactory): def __init__(self, sqs_connection_thunk, visibility_timeout=30, wait_time=10, name_suffix=None): """To allow backends to be initialized lazily, this factory requires a thunk (paramete...
Add naming suffix option for SQS backends
Add naming suffix option for SQS backends
Python
mit
gamechanger/deferrable
5da99ceeeec050b2732475ffca89a64d2d10f34e
trainTweet.py
trainTweet.py
#!/usr/bin/env python import subprocess import argparse parser = argparse.ArgumentParser(description="Tweet some Train Statuses!") parser.add_argument("-s", "--station", dest="station", type=str, help="Station Short Code. Ex: 'SLM'") parser.add_argument("-t", "--train", dest="train", type=int, help="Train Number. Ex:...
#!/usr/bin/env python import subprocess import argparse import os parser = argparse.ArgumentParser(description="Tweet some Train Statuses!") parser.add_argument("-s", "--station", dest="station", type=str, help="Station Short Code. Ex: 'SLM'") parser.add_argument("-t", "--train", dest="train", type=int, help="Train N...
Use full paths & print our current command fully
Use full paths & print our current command fully
Python
mit
dmiedema/train-500-status
605340f9c18f1591846e0a9b5f9c983c940d80c9
tests/models/test_repository.py
tests/models/test_repository.py
from nose.tools import eq_ from mock import MagicMock, patch from pyolite.models.repository import Repository class TestRepositoryModel(object): def test_it_should_be_possible_to_retrieve_by_name_a_repo(self): mocked_users = MagicMock() mocked_file = MagicMock() mocked_dir = MagicMock() mocked_path...
from nose.tools import eq_ from mock import MagicMock, patch from pyolite.models.repository import Repository class TestRepositoryModel(object): def test_it_should_be_possible_to_retrieve_by_name_a_repo(self): mocked_users = MagicMock() mocked_file = MagicMock() mocked_dir = MagicMock() mocked_path...
Test if we look after a non-existing repo
Test if we look after a non-existing repo
Python
bsd-2-clause
PressLabs/pyolite,shawkinsl/pyolite
09dad7d36c6968fc50cf8f2c475608a66bd6571a
plugins/expand.py
plugins/expand.py
# -*- coding: utf-8 -*- # # This file is part of tofbot, a friendly IRC bot. # You may redistribute it under the Simplified BSD License. # If we meet some day, and you think this stuff is worth it, # you can buy us a beer in return. # # Copyright (c) 2012 Etienne Millon <etienne.millon@gmail.com> from BeautifulSoup im...
# -*- coding: utf-8 -*- # # This file is part of tofbot, a friendly IRC bot. # You may redistribute it under the Simplified BSD License. # If we meet some day, and you think this stuff is worth it, # you can buy us a beer in return. # # Copyright (c) 2012 Etienne Millon <etienne.millon@gmail.com> from BeautifulSoup im...
Add tinyurl.com as a minifier
Add tinyurl.com as a minifier
Python
bsd-2-clause
p0nce/tofbot,tofbot/tofbot,chmduquesne/tofbot,p0nce/tofbot,soulaklabs/tofbot,tofbot/tofbot,martinkirch/tofbot,martinkirch/tofbot,soulaklabs/tofbot
1c1ca68a41e56cb912a9ec9f81ab974324f9d2f4
tests/test_filter_refs_prefs.py
tests/test_filter_refs_prefs.py
# tests.test_filter_refs_prefs # coding=utf-8 from __future__ import unicode_literals import nose.tools as nose import yvs.filter_refs as yvs from tests.decorators import use_prefs @use_prefs({'language': 'en', 'version': 59}) def test_version_persistence(): """should remember version preferences""" results ...
# tests.test_filter_refs_prefs # coding=utf-8 from __future__ import unicode_literals import os.path import nose.tools as nose import yvs.filter_refs as yvs from tests.decorators import use_prefs @use_prefs({'language': 'en', 'version': 59}) def test_version_persistence(): """should remember version preferences"...
Add test for silent fail when creating Alfred data dir
Add test for silent fail when creating Alfred data dir
Python
mit
caleb531/youversion-suggest,caleb531/youversion-suggest
72bc4597e172a5c276057c543998337038ef15f5
projects/views.py
projects/views.py
# This file is part of the FragDev Website. # # the FragDev Website is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # the FragDev W...
# This file is part of the FragDev Website. # # the FragDev Website is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # the FragDev W...
Add missing include, and switch to exclude projects with HIDDEN status from public display
Add missing include, and switch to exclude projects with HIDDEN status from public display
Python
agpl-3.0
lo-windigo/fragdev,lo-windigo/fragdev
6798df4657730484549fdeaa13578c2d7e36f4eb
udiskie/automount.py
udiskie/automount.py
""" Udiskie automounter daemon. """ __all__ = ['AutoMounter'] class AutoMounter(object): """ Automatically mount newly added media. """ def __init__(self, mounter): self._mounter = mounter def device_added(self, udevice): self._mounter.add_device(udevice) def media_added(self,...
""" Udiskie automounter daemon. """ __all__ = ['AutoMounter'] class AutoMounter(object): """ Automatically mount newly added media. """ def __init__(self, mounter): self._mounter = mounter def device_added(self, udevice): self._mounter.add_device(udevice) def media_added(self,...
Add function in AutoMounter to handle mounting of LUKS-devices not opened by udiskie
Add function in AutoMounter to handle mounting of LUKS-devices not opened by udiskie
Python
mit
pstray/udiskie,coldfix/udiskie,coldfix/udiskie,mathstuf/udiskie,khardix/udiskie,pstray/udiskie
3a4b274d4a7e23911843250c73da2ab59cf6649c
tests/alerts/alert_test_case.py
tests/alerts/alert_test_case.py
import os.path import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../alerts")) from alert_test_suite import AlertTestSuite class AlertTestCase(object): def __init__(self, description, events=[], events_type='event', expected_alert=None): self.description = description # As a r...
import os.path import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../alerts")) from alert_test_suite import AlertTestSuite class AlertTestCase(object): def __init__(self, description, events=[], expected_alert=None): self.description = description # As a result of defining our...
Remove events_type from alert test case
Remove events_type from alert test case
Python
mpl-2.0
mpurzynski/MozDef,jeffbryner/MozDef,mozilla/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,jeffbryner/MozDef,mozilla/MozDef,Phrozyn/MozDef,Phrozyn/MozDef,mozilla/MozDef,mozilla/MozDef
4a75d2b12fdaea392e3cf74eb1335b93c8aacdbd
accounts/tests/test_models.py
accounts/tests/test_models.py
"""accounts app unittests for models """ from django.test import TestCase from django.contrib.auth import get_user_model TEST_EMAIL = 'newvisitor@example.com' class UserModelTest(TestCase): """Tests for passwordless user model. """ def test_user_valid_with_only_email(self): """Should not raise...
"""accounts app unittests for models """ from django.test import TestCase from django.contrib.auth import get_user_model USER = get_user_model() TEST_EMAIL = 'newvisitor@example.com' class UserModelTest(TestCase): """Tests for passwordless user model. """ def test_user_valid_with_only_email(self): ...
Tidy up UserModel unit test
Tidy up UserModel unit test
Python
mit
randomic/aniauth-tdd,randomic/aniauth-tdd
207871f4f057d88f67bad0c371f880664dcee062
pydirections/route_requester.py
pydirections/route_requester.py
""" This class holds all the necessary information required for a proposed route """ ACCEPTABLE_MODES = set(["driving", "walking", "bicycling", "transit"]) class DirectionsRequest(object): def __init__(self, mode="driving", **kwargs): self.mode = mode self.origin = kwargs['origin'] self.destination = kwarg...
""" This class holds all the necessary information required for a proposed route """ ACCEPTABLE_MODES = set(["driving", "walking", "bicycling", "transit"]) class DirectionsRequest(object): def __init__(self, **kwargs): self.mode = "driving" self.origin = kwargs['origin'] self.destination = kwargs['destinat...
Build custom route requester class
Build custom route requester class
Python
apache-2.0
apranav19/pydirections
9c12e2d6890a32d93ea6b2a9ae6f000d46182377
ga/image/store.py
ga/image/store.py
# -*- coding: utf-8 -*- import StringIO import shortuuid from boto.s3.connection import S3Connection from ga import settings conn = S3Connection(settings.AWS_KEY, settings.AWS_SECRET) bucket = conn.get_bucket(settings.AWS_BUCKET) def upload_image_from_pil_image(image): output = StringIO.StringIO() image.s...
# -*- coding: utf-8 -*- import StringIO import shortuuid from boto.s3.connection import S3Connection from ga import settings def upload_image_from_pil_image(image): output = StringIO.StringIO() image.save(output, 'JPEG') output.name = 'file' return upload_image(output) def upload_image(stream): ...
Move S3 bucket connection into `upload_image`
Move S3 bucket connection into `upload_image`
Python
mit
alexmic/great-again,alexmic/great-again
1666f883e3f6a497971b484c9ba875df2f6693a2
test/testall.py
test/testall.py
#!/usr/bin/env python # This file is part of beets. # Copyright 2013, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation th...
#!/usr/bin/env python # This file is part of beets. # Copyright 2013, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation th...
Fix python namespaces for test runs
Fix python namespaces for test runs We need to make sure we don't use namespaced versions that are already installed on the system but rather use local version from current sources
Python
mit
SusannaMaria/beets,mathstuf/beets,mathstuf/beets,YetAnotherNerd/beets,lengtche/beets,LordSputnik/beets,shamangeorge/beets,ibmibmibm/beets,m-urban/beets,krig/beets,lightwang1/beets,shamangeorge/beets,MyTunesFreeMusic/privacy-policy,jcoady9/beets,SusannaMaria/beets,beetbox/beets,Andypsamp/CODfinalJUNIT,Andypsamp/CODfinal...
aa4a0b1640dab90a4867614f0d00cca99601e342
south/models.py
south/models.py
from django.db import models class MigrationHistory(models.Model): app_name = models.CharField(max_length=255) migration = models.CharField(max_length=255) applied = models.DateTimeField(blank=True) class Meta: unique_together = (('app_name', 'migration'),) @classmethod def for_migrat...
from django.db import models class MigrationHistory(models.Model): app_name = models.CharField(max_length=255) migration = models.CharField(max_length=255) applied = models.DateTimeField(blank=True) @classmethod def for_migration(cls, migration): try: return cls.objects.get(app...
Remove unique_together on the model; the key length was too long on wide-character MySQL installs.
Remove unique_together on the model; the key length was too long on wide-character MySQL installs.
Python
apache-2.0
theatlantic/django-south,theatlantic/django-south