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
060c5f13886191777e2709c9119d480fe0983ced
TorGTK/pref_handle.py
TorGTK/pref_handle.py
import ConfigParser from gi.repository import Gtk from pref_mapping import * from var import * def read_config_if_exists(filename): if os.path.isfile(filename): # Init config parser and read config Config = ConfigParser.SafeConfigParser() Config.read(filename) section = "TorGTKprefs" # Loop through options...
import ConfigParser from gi.repository import Gtk from pref_mapping import * from var import * def read_config_if_exists(filename): if os.path.isfile(filename): # Init config parser and read config Config = ConfigParser.SafeConfigParser() Config.read(filename) section = "TorGTKprefs" # Loop through options...
Remove line for debugging which lists object type from elements of listbox
Remove line for debugging which lists object type from elements of listbox
Python
bsd-2-clause
neelchauhan/TorGTK,neelchauhan/TorNova
5e1fc4fbb2f363fd2116d153e735ff3322001b3a
tests/trac/test-trac-0132.py
tests/trac/test-trac-0132.py
# -*- coding: utf-8 -*- import pyxb import unittest class TestTrac0132 (unittest.TestCase): message = u'bad character \u2620' def testDecode (self): e = pyxb.PyXBException(self.message) self.assertEqual(self.message, e.message) if __name__ == '__main__': unittest.main()
# -*- coding: utf-8 -*- import sys import pyxb import unittest class TestTrac0132 (unittest.TestCase): message = u'bad character \u2620' def testDecode (self): e = pyxb.PyXBException(self.message) if sys.version[:2] > (2, 4): self.assertEqual(self.message, e.message) if __name__ =...
Revise test to support Python 2.4.
Revise test to support Python 2.4. In this version, base Exception didn't have a .message field. No wonder I had added it back in 2009, resulting in trac/132 which removed it.
Python
apache-2.0
balanced/PyXB,jonfoster/pyxb2,CantemoInternal/pyxb,jonfoster/pyxb1,pabigot/pyxb,jonfoster/pyxb2,balanced/PyXB,jonfoster/pyxb2,pabigot/pyxb,jonfoster/pyxb-upstream-mirror,CantemoInternal/pyxb,jonfoster/pyxb-upstream-mirror,jonfoster/pyxb1,balanced/PyXB,jonfoster/pyxb-upstream-mirror,CantemoInternal/pyxb
8bd47ec3983981d0a2ac8d9f9c17f4c1c9c8fbd3
apps/profiles/tests.py
apps/profiles/tests.py
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.core.urlresolvers import reverse from django.test import TestCase from django_dynamic_fixture import G from rest_framework im...
from django.core.urlresolvers import reverse from django.test import TestCase from django_dynamic_fixture import G from rest_framework import status from apps.authentication.models import OnlineUser as User from apps.profiles.forms import ProfileForm class ProfilesURLTestCase(TestCase): def test_user_search(self...
Test that saving ProfileForm works
Test that saving ProfileForm works
Python
mit
dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4
308cbf1f62e254643a0ad47db8ad55eb63e1c888
argonauts/testutils.py
argonauts/testutils.py
import json import functools from django.conf import settings from django.test import Client, TestCase __all__ = ['JsonTestClient', 'JsonTestCase'] class JsonTestClient(Client): def _json_request(self, method, url, data=None, *args, **kwargs): method_func = getattr(super(JsonTestClient, self), method) ...
import json import functools from django.conf import settings from django.test import Client, TestCase __all__ = ['JsonTestClient', 'JsonTestMixin', 'JsonTestCase'] class JsonTestClient(Client): def _json_request(self, method, url, data=None, *args, **kwargs): method_func = getattr(super(JsonTestClient,...
Make the TestCase a mixin
Make the TestCase a mixin
Python
bsd-2-clause
fusionbox/django-argonauts
456e5a63333e683b7167bf151b97a49a5cf5c5fe
app/models/job.py
app/models/job.py
# Copyright (C) 2014 Linaro Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
# Copyright (C) 2014 Linaro Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
Rework the jod document model.
Rework the jod document model. * Add the created field that will store a datetime object. * Add reference to the kernel and the job inside the document, without relying on the Jod document name itself. Since we use the dash as a separator, and other job names can have dash in them, we cannot separate j...
Python
agpl-3.0
joyxu/kernelci-backend,joyxu/kernelci-backend,kernelci/kernelci-backend,kernelci/kernelci-backend,joyxu/kernelci-backend
4b7713a1891aa86c0f16fafdea8770495070bfcb
html_snapshots/utils.py
html_snapshots/utils.py
import os import rmc.shared.constants as c import rmc.models as m FILE_DIR = os.path.dirname(os.path.realpath(__file__)) HTML_DIR = os.path.join(c.SHARED_DATA_DIR, 'html_snapshots') def write(file_path, content): ensure_dir(file_path) with open(file_path, 'w') as f: f.write(content) def ensure_dir...
import os import mongoengine as me import rmc.shared.constants as c import rmc.models as m FILE_DIR = os.path.dirname(os.path.realpath(__file__)) HTML_DIR = os.path.join(c.SHARED_DATA_DIR, 'html_snapshots') me.connect(c.MONGO_DB_RMC, host=c.MONGO_HOST, port=c.MONGO_PORT) def write(file_path, content): ensure_...
Create mongoengine connection when taking phantom snapshots
Create mongoengine connection when taking phantom snapshots
Python
mit
ccqi/rmc,JGulbronson/rmc,JGulbronson/rmc,UWFlow/rmc,shakilkanji/rmc,ccqi/rmc,UWFlow/rmc,sachdevs/rmc,sachdevs/rmc,MichalKononenko/rmc,UWFlow/rmc,MichalKononenko/rmc,sachdevs/rmc,duaayousif/rmc,MichalKononenko/rmc,MichalKononenko/rmc,JGulbronson/rmc,ccqi/rmc,JGulbronson/rmc,sachdevs/rmc,UWFlow/rmc,UWFlow/rmc,duaayousif/...
e3dcbe5fb142b7ce564a90cf127de418d0a62db3
src/sentry/runner/hacks.py
src/sentry/runner/hacks.py
""" sentry.runner.hacks ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function from sentry.http import get_server_hostname class AllowedHosts(object): # HACK: This is a fak...
""" sentry.runner.hacks ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function from sentry.http import get_server_hostname class AllowedHosts(object): # HACK: This is a fak...
Add a nice repr for AllowedHosts object so the admin makes sense
Add a nice repr for AllowedHosts object so the admin makes sense
Python
bsd-3-clause
fotinakis/sentry,daevaorn/sentry,beeftornado/sentry,daevaorn/sentry,ifduyue/sentry,alexm92/sentry,ifduyue/sentry,JamesMura/sentry,JamesMura/sentry,alexm92/sentry,jean/sentry,BuildingLink/sentry,JackDanger/sentry,gencer/sentry,nicholasserra/sentry,jean/sentry,ifduyue/sentry,mvaled/sentry,ifduyue/sentry,zenefits/sentry,z...
1ef9c5c76e1c1110803d83833fc69ba201d33582
pavement.py
pavement.py
# -*- coding: utf-8 -*- from paver.easy import task, sh, needs, path from paver.setuputils import setup setup(name='ldapom', version='0.9.4', description='A simple ldap object mapper for python', author='Florian Richter', author_email='mail@f1ori.de', url='https://github.com/HaDiNet/ldap...
# -*- coding: utf-8 -*- from paver.easy import * @task def test(options): info("Running tests for Python 2") sh('python2 tests.py') info("Running tests for Python 3") sh('python3 tests.py') @task def coverage(options): info("Running coverage for Python 2") sh('coverage2 run --source ldapom.py...
Update paver to test and report coverage for both Python 2 and 3
Update paver to test and report coverage for both Python 2 and 3
Python
mit
HaDiNet/ldapom
abe744c5a099fd988ff3fe5eb1d50cca7a633d74
var/spack/repos/builtin/packages/parallel-netcdf/package.py
var/spack/repos/builtin/packages/parallel-netcdf/package.py
from spack import * class ParallelNetcdf(Package): """Parallel netCDF (PnetCDF) is a library providing high-performance parallel I/O while still maintaining file-format compatibility with Unidata's NetCDF.""" homepage = "https://trac.mcs.anl.gov/projects/parallel-netcdf" url = "http://cucis.e...
from spack import * class ParallelNetcdf(Package): """Parallel netCDF (PnetCDF) is a library providing high-performance parallel I/O while still maintaining file-format compatibility with Unidata's NetCDF.""" homepage = "https://trac.mcs.anl.gov/projects/parallel-netcdf" url = "http://cucis.e...
Add latest version of PnetCDF
Add latest version of PnetCDF
Python
lgpl-2.1
mfherbst/spack,EmreAtes/spack,lgarren/spack,tmerrick1/spack,matthiasdiener/spack,skosukhin/spack,tmerrick1/spack,iulian787/spack,skosukhin/spack,LLNL/spack,matthiasdiener/spack,iulian787/spack,krafczyk/spack,TheTimmy/spack,mfherbst/spack,LLNL/spack,mfherbst/spack,EmreAtes/spack,tmerrick1/spack,mfherbst/spack,TheTimmy/s...
cdc5627cfad3b4fb413bed86d76dbe083e6727a7
hnotebook/notebooks/admin.py
hnotebook/notebooks/admin.py
from django.contrib import admin # Register your models here.
from django.contrib import admin from .models import Notebook class NotebookAdmin(admin.ModelAdmin): model = Notebook admin.site.register(Notebook, NotebookAdmin)
Add Admin for Notebook model
Add Admin for Notebook model
Python
mit
marcwebbie/hnotebook
75a59409410a8f264e7d56ddd853002ffbb28600
corehq/tests/noseplugins/patches.py
corehq/tests/noseplugins/patches.py
from nose.plugins import Plugin from corehq.form_processor.tests.utils import patch_testcase_databases from corehq.util.es.testing import patch_es_user_signals from corehq.util.test_utils import patch_foreign_value_caches class PatchesPlugin(Plugin): """Patches various things before tests are run""" name = "...
from nose.plugins import Plugin from corehq.form_processor.tests.utils import patch_testcase_databases from corehq.util.es.testing import patch_es_user_signals from corehq.util.test_utils import patch_foreign_value_caches class PatchesPlugin(Plugin): """Patches various things before tests are run""" name = "...
Update freezegun ignore list patch
Update freezegun ignore list patch As of v1.1.0, freezegun supports configuring the ignore list.
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
29f8aacde96007976b0aa0cde6d6d37b37e517a9
app/status/views.py
app/status/views.py
from flask import jsonify, current_app from . import status from . import utils from ..main.helpers.service import ServiceLoader from ..main import main @status.route('/_status') def status(): # ServiceLoader is the only thing that actually connects to the API service_loader = ServiceLoader( main.co...
from flask import jsonify, current_app from . import status from . import utils from ..main.helpers.service import ServiceLoader from ..main import main @status.route('/_status') def status(): # ServiceLoader is the only thing that actually connects to the API service_loader = ServiceLoader( main.co...
Change variable name & int comparison.
Change variable name & int comparison.
Python
mit
mtekel/digitalmarketplace-admin-frontend,mtekel/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,mtekel/digitalmarketplace-admin-frontend,mtekel/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace...
637f6c09bf3ac558e6e30d748dfb0838e4a3720f
classes/person.py
classes/person.py
class Person(object): def __init__(self, iden, person_type, person_name, person_surname="", wants_accommodation="N"): self.person_name = person_name self.person_surname = person_surname self.person_type = person_type self.wants_accommodation = wants_accommodation self.iden = ...
class Person(object): def __init__(self, iden, person_type, person_name, person_surname="", wants_accommodation="N"): self.person_name = person_name self.person_surname = person_surname self.person_type = person_type self.wants_accommodation = wants_accommodation self.iden = ...
Remove redundant full name method
Remove redundant full name method
Python
mit
peterpaints/room-allocator
aa360309f387f19f6566d08325cd1aa1131768da
bulbs/utils/filters.py
bulbs/utils/filters.py
from rest_framework import filters class CaseInsensitiveBooleanFilter(filters.BaseFilterBackend): """Set a boolean_fields tuple on the viewset and set this class as a filter_backend to filter listed fields through a case-insensitive transformation to be used for filtering. i.e. query params such as 'true'...
from rest_framework import filters class CaseInsensitiveBooleanFilter(filters.BaseFilterBackend): """Set a boolean_fields tuple on the viewset and set this class as a filter_backend to filter listed fields through a case-insensitive transformation to be used for filtering. i.e. query params such as 'true'...
Cover every case for CaseInsensitiveBooleanFilter
Cover every case for CaseInsensitiveBooleanFilter
Python
mit
pombredanne/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,pombredanne/django-bulbs
72bbd1a5e356b57842b07aa3a58d1e314228091d
tests/pytests/unit/pillar/test_pillar.py
tests/pytests/unit/pillar/test_pillar.py
import pytest import salt.loader import salt.pillar from salt.utils.odict import OrderedDict @pytest.mark.parametrize( "envs", ( ["a", "b", "c"], ["c", "b", "a"], ["b", "a", "c"], ), ) def test_pillar_envs_order(envs, temp_salt_minion, tmp_path): opts = temp_salt_minion.config....
import pytest import salt.loader import salt.pillar from salt.utils.odict import OrderedDict @pytest.mark.parametrize( "envs", ( ["a", "b", "c"], ["c", "b", "a"], ["b", "a", "c"], ), ) def test_pillar_envs_order(envs, temp_salt_minion, tmp_path): opts = temp_salt_minion.config....
Add testcase written by @waynew
Add testcase written by @waynew
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
1f0195c1d1695119287e3693360ec44564ed0a09
app/main/views/sub_navigation_dictionaries.py
app/main/views/sub_navigation_dictionaries.py
def features_nav(): return [ { "name": "Features", "link": "main.features", "sub_navigation_items": [ { "name": "Emails", "link": "main.features_email", }, { "name"...
def features_nav(): return [ { "name": "Features", "link": "main.features", "sub_navigation_items": [ { "name": "Emails", "link": "main.features_email", }, { "name"...
Remove ‘using notify’ from nav (it’s a redirect now)
Remove ‘using notify’ from nav (it’s a redirect now)
Python
mit
alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin
d06d65cea4ae9efa547af43a551e24a459e0627e
tbmodels/_legacy_decode.py
tbmodels/_legacy_decode.py
from ._tb_model import Model def _decode(hf): if 'tb_model' in hf or 'hop' in hf: return _decode_model(hf) elif 'val' in hf: return _decode_val(hf) elif '0' in hf: return _decode_iterable(hf) else: raise ValueError('File structure not understood.') def _decode_iterabl...
""" Defines decoding for the legacy (pre fsc.hdf5-io) HDF5 format. """ from ._tb_model import Model def _decode(hdf5_handle): """ Decode the object at the given HDF5 node. """ if 'tb_model' in hdf5_handle or 'hop' in hdf5_handle: return _decode_model(hdf5_handle) elif 'val' in hdf5_handle...
Fix pylint issues in legacy_decode.
Fix pylint issues in legacy_decode.
Python
apache-2.0
Z2PackDev/TBmodels,Z2PackDev/TBmodels
3a312dc4134d28d8c8fb0020444a1bbf1277a4cb
lib/automatic_timestamps/models.py
lib/automatic_timestamps/models.py
from django.db import models import datetime class TimestampModel(models.Model): """ Extend the default Django model to add timestamps to all objects. """ class Meta: abstract = True # Timestamps! created_at = models.DateTimeField() updated_at = models.DateTimeField() ...
from django.db import models import datetime class TimestampModel(models.Model): """ Extend the default Django model to add timestamps to all objects. """ class Meta: abstract = True # Timestamps! created_at = models.DateTimeField() updated_at = models.DateTimeField() ...
Add *args/**kwargs to save() as per the Django docs
Add *args/**kwargs to save() as per the Django docs
Python
mit
tofumatt/quotes,tofumatt/quotes
4db2d879cb8ee7d8ddd1543e6aed50f40e44ca66
src/pi/scanning_proxy.py
src/pi/scanning_proxy.py
"""Philips hue proxy code.""" import abc import logging import sys import threading from pi import proxy class ScanningProxy(proxy.Proxy): """A proxy object with a background scan thread.""" __metaclass__ = abc.ABCMeta def __init__(self, refresh_period): self._refresh_period = refresh_period self._...
"""Philips hue proxy code.""" import abc import logging import sys import threading from pi import proxy class ScanningProxy(proxy.Proxy): """A proxy object with a background scan thread.""" __metaclass__ = abc.ABCMeta def __init__(self, refresh_period): self._refresh_period = refresh_period self._...
Fix race on exit in scanning proxy.
Fix race on exit in scanning proxy.
Python
mit
tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation,tomwilkie/awesomation
058a3e918cccde7dcace79df2b257bd29277bcd0
tests/builtins/test_abs.py
tests/builtins/test_abs.py
from .. utils import TranspileTestCase, BuiltinFunctionTestCase class AbsTests(TranspileTestCase): pass class BuiltinAbsFunctionTests(BuiltinFunctionTestCase, TranspileTestCase): functions = ["abs"] not_implemented = [ 'test_bool', 'test_bytearray', 'test_bytes', 'test_c...
from unittest import expectedFailure from .. utils import TranspileTestCase, BuiltinFunctionTestCase class AbsTests(TranspileTestCase): @expectedFailure def test_abs_not_implemented(self): self.assertCodeExecution(""" class NotAbsLike: pass x = NotAbsLike() ...
Add failing test for builtin abs() on objects without __abs__()
Add failing test for builtin abs() on objects without __abs__()
Python
bsd-3-clause
pombredanne/voc,ASP1234/voc,freakboy3742/voc,gEt-rIgHt-jR/voc,cflee/voc,cflee/voc,Felix5721/voc,glasnt/voc,glasnt/voc,pombredanne/voc,freakboy3742/voc,gEt-rIgHt-jR/voc,ASP1234/voc,Felix5721/voc
bc4fb65f76aa011e44bbe01b7965bc99eff5d85e
tests/test_recalcitrant.py
tests/test_recalcitrant.py
"Test for recalcitrant and obtuse graphs to describe" from wordgraph.points import Point import wordgraph import random from utilities import EPOCH_START, time_values def test_time_goes_backwards(): "A valid time series where time changes linearly backwards" values = [1.0] * 10 times = (EPOCH_START-i for...
"Test for recalcitrant and obtuse graphs to describe" from wordgraph.points import Point import wordgraph import random import pytest from utilities import EPOCH_START, time_values def test_time_goes_backwards(): "A valid time series where time changes linearly backwards" values = [1.0] * 10 times = (EPO...
Test expected failures of the anlayzer
Test expected failures of the anlayzer The analyzer is not expected to cope with too few data points for time series with greatly varying time ranges. It should raise an exception in these cases.
Python
apache-2.0
tleeuwenburg/wordgraph,tleeuwenburg/wordgraph
48da1258ddaa7b8c740eba67fc82edb11b163b64
server_env_ebill_paynet/__manifest__.py
server_env_ebill_paynet/__manifest__.py
# Copyright 2020 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) { "name": "Server environment for Ebill Paynet", "version": "13.0.1.0.0", "author": "Camptocamp,Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Tools", "depends": ["server_env...
# Copyright 2020 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) { "name": "Server environment for Ebill Paynet", "version": "13.0.1.0.0", "author": "Camptocamp,Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Tools", "depends": ["server_env...
Fix linting and add info in roadmap
Fix linting and add info in roadmap
Python
agpl-3.0
OCA/l10n-switzerland,OCA/l10n-switzerland
c70a409c7717fa62517b69f8a5f20f10d5325751
test/common/memcached_workload_common.py
test/common/memcached_workload_common.py
# This is a (hopefully temporary) shim that uses the rdb protocol to # implement part of the memcache API import contextlib import rdb_workload_common @contextlib.contextmanager def make_memcache_connection(opts): with rdb_workload_common.make_table_and_connection(opts) as (table, conn): yield MemcacheRdb...
# This is a (hopefully temporary) shim that uses the rdb protocol to # implement part of the memcache API import contextlib import rdb_workload_common @contextlib.contextmanager def make_memcache_connection(opts): with rdb_workload_common.make_table_and_connection(opts) as (table, conn): yield MemcacheRdb...
Replace upsert=True with conflict='replace' in tests
Replace upsert=True with conflict='replace' in tests Review 1804 by @gchpaco Related to #2733
Python
apache-2.0
jesseditson/rethinkdb,lenstr/rethinkdb,gdi2290/rethinkdb,grandquista/rethinkdb,catroot/rethinkdb,bpradipt/rethinkdb,gavioto/rethinkdb,jesseditson/rethinkdb,sbusso/rethinkdb,sontek/rethinkdb,bchavez/rethinkdb,wujf/rethinkdb,greyhwndz/rethinkdb,Qinusty/rethinkdb,gdi2290/rethinkdb,urandu/rethinkdb,jmptrader/rethinkdb,bcha...
5b600e32a05d041facd64db79ea91e928d37f300
tests/test_postgres_processor.py
tests/test_postgres_processor.py
import pytest # from sqlalchemy import create_engine # from sqlalchemy.orm import sessionmaker from scrapi.linter.document import NormalizedDocument, RawDocument from scrapi.processing.postgres import PostgresProcessor, Document from . import utils test_db = PostgresProcessor() NORMALIZED = NormalizedDocument(uti...
import pytest import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings") from . import utils from scrapi.linter.document import NormalizedDocument, RawDocument from scrapi.processing.postgres import PostgresProcessor, Document test_db = PostgresProcessor() NORMALIZED = NormalizedDocument(utils.RE...
Use newly configured conftest in postgres processor test
Use newly configured conftest in postgres processor test
Python
apache-2.0
fabianvf/scrapi,felliott/scrapi,mehanig/scrapi,erinspace/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,fabianvf/scrapi,felliott/scrapi
70df4ca8235b3ae29ef2843169f9119d29bda44a
tracker/models/__init__.py
tracker/models/__init__.py
from BasicInfo import BasicInfo from BloodExam import BloodExam from BloodExam import BloodParasite from Child import Child from ChildForm import ChildForm from DentalExam import DentalExam from DentalExam import DentalExamDiagnosis from MedicalExamPart1Info import MedicalExamPart1Info from MedicalExamPart2Info import ...
from BasicInfo import BasicInfo from BloodExam import BloodExam from BloodExam import BloodParasite from Child import Child from ChildForm import ChildForm from DentalExam import DentalExam from DentalExam import DentalExamDiagnosis from MedicalExamPart1Info import MedicalExamPart1Info from MedicalExamPart2Info import ...
Include history in the models.
Include history in the models.
Python
mit
sscalpone/HBI,sscalpone/HBI,sscalpone/HBI,sscalpone/HBI
5368e0ad7be4cdf7df2da392fdaabb89c3a4ad55
test_settings.py
test_settings.py
SECRET_KEY = "lorem ipsum" INSTALLED_APPS = ( 'tango_shared', )
SECRET_KEY = "lorem ipsum" INSTALLED_APPS = ( 'tango_shared', ) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } SITE_ID = 1
Add missing test settings (in-memory sqlite3 db + SITE_ID)
Add missing test settings (in-memory sqlite3 db + SITE_ID)
Python
mit
tBaxter/tango-shared-core,tBaxter/tango-shared-core,tBaxter/tango-shared-core
46956660b1c4533e7a69fe2aa0dc17b73ce490ac
transporter/transporter.py
transporter/transporter.py
from urlparse import urlparse import os import adapters try: import paramiko except ImportError: pass """The following protocals are supported ftp, ftps, http and https. sftp and ssh require paramiko to be installed """ class Transporter(object): availible_adapters = { "ftp": adapters.FtpAdapte...
from urlparse import urlparse import os import adapters try: import paramiko except ImportError: pass """The following protocals are supported ftp, ftps, http and https. sftp and ssh require paramiko to be installed """ class Transporter(object): availible_adapters = { "ftp": adapters.FtpAdapte...
Use LocalFileAdapter when no scheme is given
Use LocalFileAdapter when no scheme is given >>> t1 = Transporter('/file/path') >>> t2 = Transporter('file:/file/path') >>> type(t1.adapter) == type(t2.adapter) True >>> t1.pwd() == t2.pwd() True
Python
bsd-2-clause
joshmaker/transporter
a62343a536bf6a8b655ace66e09a17ea483e6fbe
txircd/modules/cmd_user.py
txircd/modules/cmd_user.py
from twisted.words.protocols import irc from txircd.modbase import Command import string class UserCommand(Command): def onUse(self, user, data): if not user.username: user.registered -= 1 user.username = data["ident"] user.realname = data["gecos"] if user.registered == 0: user.register() def process...
from twisted.words.protocols import irc from txircd.modbase import Command import string class UserCommand(Command): def onUse(self, user, data): if not user.username: user.registered -= 1 user.username = data["ident"] user.realname = data["gecos"] if user.registered == 0: user.register() def process...
Fix message with 462 numeric
Fix message with 462 numeric
Python
bsd-3-clause
ElementalAlchemist/txircd,DesertBus/txircd,Heufneutje/txircd
dfdd9b2a8bad5d61f5bf166d9c72b19f4c639383
mock/buildbot_secret.py
mock/buildbot_secret.py
GITHUB_WEBHOOK_SECRET="nothing to see here" GITHUB_OAUTH_CLIENT_ID="nothing to see here" GITHUB_OAUTH_CLIENT_SECRET="nothing to see here" GITHUB_STATUS_OAUTH_TOKEN="nothing to see here" COVERALLS_REPO_TOKEN="nothing to see here" CODECOV_REPO_TOKEN="nothing to see here" FREEBSDCI_OAUTH_TOKEN="nothing to see here" FQDN="...
GITHUB_WEBHOOK_SECRET="nothing to see here" GITHUB_OAUTH_CLIENT_ID="nothing to see here" GITHUB_OAUTH_CLIENT_SECRET="nothing to see here" GITHUB_STATUS_OAUTH_TOKEN="nothing to see here" COVERALLS_REPO_TOKEN="nothing to see here" CODECOV_REPO_TOKEN="nothing to see here" FREEBSDCI_OAUTH_TOKEN="nothing to see here" FQDN="...
Add mock value for `MACOS_CODESIGN_IDENTITY`
Add mock value for `MACOS_CODESIGN_IDENTITY`
Python
mit
staticfloat/julia-buildbot,staticfloat/julia-buildbot
886c2b92d8dcc40577341245f7973d4a2d31aa90
tests/core/test_mixer.py
tests/core/test_mixer.py
from __future__ import absolute_import, unicode_literals import unittest from mopidy import core class CoreMixerTest(unittest.TestCase): def setUp(self): # noqa: N802 self.core = core.Core(mixer=None, backends=[]) def test_volume(self): self.assertEqual(self.core.mixer.get_volume(), None) ...
from __future__ import absolute_import, unicode_literals import unittest import mock from mopidy import core, mixer class CoreMixerTest(unittest.TestCase): def setUp(self): # noqa: N802 self.mixer = mock.Mock(spec=mixer.Mixer) self.core = core.Core(mixer=self.mixer, backends=[]) def test_...
Use a mixer mock in tests
core: Use a mixer mock in tests
Python
apache-2.0
ali/mopidy,tkem/mopidy,dbrgn/mopidy,ali/mopidy,bacontext/mopidy,SuperStarPL/mopidy,mokieyue/mopidy,SuperStarPL/mopidy,swak/mopidy,mopidy/mopidy,jodal/mopidy,ali/mopidy,swak/mopidy,dbrgn/mopidy,dbrgn/mopidy,ZenithDK/mopidy,rawdlite/mopidy,hkariti/mopidy,quartz55/mopidy,jodal/mopidy,jodal/mopidy,kingosticks/mopidy,vrs01/...
c45e00924fbe90fb6ff9465202a77d390c685dc4
tests/test_cli_update.py
tests/test_cli_update.py
# -*- coding: utf-8 -*- import pathlib import json def test_store_template_data_to_json(cli_runner, tmp_rc, tmp_templates_file): result = cli_runner([ '-c', tmp_rc, 'update' ]) assert result.exit_code == 0 templates = pathlib.Path(tmp_templates_file) assert templates.exists() with ...
# -*- coding: utf-8 -*- import pathlib import json from configparser import RawConfigParser import pytest def test_store_template_data_to_json(cli_runner, tmp_rc, tmp_templates_file): result = cli_runner([ '-c', tmp_rc, 'update' ]) assert result.exit_code == 0 templates = pathlib.Path(tmp_...
Implement a test for missing username in update cmd
Implement a test for missing username in update cmd
Python
bsd-3-clause
hackebrot/cibopath
a4104dea137b8fa2aedc38ac3bda53c559c1f45a
tests/test_opentransf.py
tests/test_opentransf.py
import pymorph import numpy as np def test_opentransf(): f = np.array([ [0,0,0,0,0,0,0,0], [0,0,1,1,1,1,0,0], [0,1,0,1,1,1,0,0], [0,0,1,1,1,1,0,0], [1,1,0,0,0,0,0,0]], bool) ot = pymorph.opentransf( f, 'city-block') for y in xrange(ot.shape[0]): ...
import pymorph import numpy as np def test_opentransf(): f = np.array([ [0,0,0,0,0,0,0,0], [0,0,1,1,1,1,0,0], [0,1,0,1,1,1,0,0], [0,0,1,1,1,1,0,0], [1,1,0,0,0,0,0,0]], bool) ot = pymorph.opentransf( f, 'city-block') for y in xrange(ot.shape[0]): ...
Test all cases of type for opentransf
TST: Test all cases of type for opentransf
Python
bsd-3-clause
luispedro/pymorph
95e1d4c2ec42f09fddf48c5a32f0fe409132380b
lab/monitors/nova_service_list.py
lab/monitors/nova_service_list.py
def start(lab, log, args): import time from fabric.context_managers import shell_env grep_host = args.get('grep_host', 'overcloud-') duration = args['duration'] period = args['period'] statuses = {'up': 1, 'down': 0} server = lab.director() start_time = time.time() while start_tim...
def start(lab, log, args): from fabric.context_managers import shell_env grep_host = args.get('grep_host', 'overcloud-') statuses = {'up': 1, 'down': 0} server = lab.director() with shell_env(OS_AUTH_URL=lab.cloud.end_point, OS_USERNAME=lab.cloud.user, OS_PASSWORD=lab.cloud.password, OS_TENANT_N...
Verify services status if FI is rebooted
Verify services status if FI is rebooted Change-Id: Ia02ef16d53fbb7b55a8de884ff16a4bef345a1f2
Python
apache-2.0
CiscoSystems/os-sqe,CiscoSystems/os-sqe,CiscoSystems/os-sqe
26bae1f6094550939b1ed2ded3885e5d7befc39d
rply/token.py
rply/token.py
class BaseBox(object): pass class Token(BaseBox): def __init__(self, name, value, source_pos=None): BaseBox.__init__(self) self.name = name self.value = value self.source_pos = source_pos def __eq__(self, other): return self.name == other.name and self.value == oth...
class BaseBox(object): pass class Token(BaseBox): def __init__(self, name, value, source_pos=None): self.name = name self.value = value self.source_pos = source_pos def __eq__(self, other): return self.name == other.name and self.value == other.value def gettokentype(...
Drop the __init__ call to object.__init__, RPython doesn't like it and it doesn't doa nything
Drop the __init__ call to object.__init__, RPython doesn't like it and it doesn't doa nything
Python
bsd-3-clause
agamdua/rply,agamdua/rply
be53f1234bec0bca4c35f020905e24d0637b91e3
tests/run/coroutines.py
tests/run/coroutines.py
# cython: language_level=3 # mode: run # tag: pep492, pure3.5 async def test_coroutine_frame(awaitable): """ >>> class Awaitable(object): ... def __await__(self): ... return iter([2]) >>> coro = test_coroutine_frame(Awaitable()) >>> import types >>> isinstance(coro.cr_frame, t...
# cython: language_level=3 # mode: run # tag: pep492, pure3.5, gh1462, async, await async def test_coroutine_frame(awaitable): """ >>> class Awaitable(object): ... def __await__(self): ... return iter([2]) >>> coro = test_coroutine_frame(Awaitable()) >>> import types >>> isins...
Add an explicit test for async-def functions with decorators. Closes GH-1462.
Add an explicit test for async-def functions with decorators. Closes GH-1462.
Python
apache-2.0
scoder/cython,da-woods/cython,scoder/cython,scoder/cython,cython/cython,da-woods/cython,cython/cython,cython/cython,da-woods/cython,scoder/cython,cython/cython,da-woods/cython
fa78cd1b3aa29cfe2846f4a999b4bb7436b339ea
tests/test_responses.py
tests/test_responses.py
from jsonrpcclient.responses import Ok, parse, parse_json def test_parse(): assert parse({"jsonrpc": "2.0", "result": "pong", "id": 1}) == Ok("pong", 1) def test_parse_json(): assert parse_json('{"jsonrpc": "2.0", "result": "pong", "id": 1}') == Ok("pong", 1)
from jsonrpcclient.responses import Error, Ok, parse, parse_json def test_Ok(): assert repr(Ok("foo", 1)) == "Ok(result='foo', id=1)" def test_Error(): assert ( repr(Error(1, "foo", "bar", 2)) == "Error(code=1, message='foo', data='bar', id=2)" ) def test_parse(): assert parse({"js...
Bring code coverage to 100%
Bring code coverage to 100%
Python
mit
bcb/jsonrpcclient
9dfe31f52d1cf4dfb11a1ffd8c14274e4b9ec135
tests/test_tokenizer.py
tests/test_tokenizer.py
import unittest from halng.tokenizer import MegaHALTokenizer class testMegaHALTokenizer(unittest.TestCase): def setUp(self): self.tokenizer = MegaHALTokenizer() def testSplitEmpty(self): self.assertEquals(len(self.tokenizer.split("")), 0) def testSplitSentence(self): words = self...
import unittest from halng.tokenizer import MegaHALTokenizer class testMegaHALTokenizer(unittest.TestCase): def setUp(self): self.tokenizer = MegaHALTokenizer() def testSplitEmpty(self): self.assertEquals(len(self.tokenizer.split("")), 0) def testSplitSentence(self): words = self...
Add a test that ensures commas are part of non-word runs.
Add a test that ensures commas are part of non-word runs.
Python
mit
meska/cobe,wodim/cobe-ng,meska/cobe,tiagochiavericosta/cobe,DarkMio/cobe,LeMagnesium/cobe,tiagochiavericosta/cobe,pteichman/cobe,pteichman/cobe,LeMagnesium/cobe,DarkMio/cobe,wodim/cobe-ng
9ffcae90963ed97136142bdd1443f633f11a5837
settings.py
settings.py
from fabric.api import env env.hosts = ['zygal@kontar.kattare.com'] env.local_dir = 'public' env.remote_dir = 'temp'
from fabric.api import env env.hosts = ['myuser@mysite.com'] env.local_dir = 'public' env.remote_dir = 'temp'
Set some default hosts environment
Set some default hosts environment
Python
mit
nfletton/froid,nfletton/froid
03c7f149ac0162a78892593d33b5866a1a9b72df
tests/test_settings.py
tests/test_settings.py
from __future__ import unicode_literals from django.test import TestCase from rest_framework.settings import APISettings class TestSettings(TestCase): def test_import_error_message_maintained(self): """ Make sure import errors are captured and raised sensibly. """ settings = APIS...
from __future__ import unicode_literals from django.test import TestCase from rest_framework.settings import APISettings class TestSettings(TestCase): def test_import_error_message_maintained(self): """ Make sure import errors are captured and raised sensibly. """ settings = APIS...
Test case for settings check
Test case for settings check
Python
bsd-2-clause
davesque/django-rest-framework,dmwyatt/django-rest-framework,jpadilla/django-rest-framework,kgeorgy/django-rest-framework,atombrella/django-rest-framework,davesque/django-rest-framework,pombredanne/django-rest-framework,cyberj/django-rest-framework,ossanna16/django-rest-framework,dmwyatt/django-rest-framework,edx/djang...
033a9c6e8b704eb92a7b1a9a82235fee7374f6be
logger/utilities.py
logger/utilities.py
#!/usr/bin/env python3 """Small utility functions for use in various places.""" __all__ = ["pick", "is_dunder", "convert_to_od", "counter_to_iterable"] import collections import itertools def pick(arg, default): """Handler for default versus given argument.""" return default if arg is None else arg def is_...
#!/usr/bin/env python3 """Small utility functions for use in various places.""" __all__ = ["pick", "is_dunder", "convert_to_od", "counter_to_iterable", "count"] import collections import itertools def pick(arg, default): """Handler for default versus given argument.""" return default if arg is No...
Add a new 'count' utility function
Add a new 'count' utility function
Python
bsd-2-clause
Vgr255/logging
e75e741770d1735c52770900b1cf59f207f2264e
asp/__init__.py
asp/__init__.py
# From http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package # Author: James Antill (http://stackoverflow.com/users/10314/james-antill) __version__ = '0.1' __version_info__ = tuple([ int(num) for num in __version__.split('.')])
# From http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package # Author: James Antill (http://stackoverflow.com/users/10314/james-antill) __version__ = '0.1' __version_info__ = tuple([ int(num) for num in __version__.split('.')]) class SpecializationError(Exception): """ Ex...
Add asp.SpecializationError class for specialization-related exceptions.
Add asp.SpecializationError class for specialization-related exceptions.
Python
bsd-3-clause
shoaibkamil/asp,mbdriscoll/asp-old,mbdriscoll/asp-old,shoaibkamil/asp,richardxia/asp-multilevel-debug,richardxia/asp-multilevel-debug,pbirsinger/aspNew,pbirsinger/aspNew,mbdriscoll/asp-old,mbdriscoll/asp-old,shoaibkamil/asp,richardxia/asp-multilevel-debug,pbirsinger/aspNew
64fdf3a83b7b8649de6216cd67fb1a8ae0d3f1a0
bin/receive.py
bin/receive.py
#!/usr/bin/env python import pika import subprocess import json import os from pymongo import MongoClient dbcon = MongoClient() NETSNIFF_UTIL = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'tools', 'netsniff.js') queuecon = pika.BlockingConnection(pika.ConnectionParameters( 'localhost'))...
#!/usr/bin/env python import pika import subprocess import json import os from pymongo import MongoClient dbcon = MongoClient() NETSNIFF_UTIL = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'tools', 'netsniff.js') queuecon = pika.BlockingConnection(pika.ConnectionParameters( 'localhost'))...
Handle errors in queue processing
Handle errors in queue processing
Python
mit
leibowitz/perfmonitor,leibowitz/perfmonitor,leibowitz/perfmonitor
6711d68999e5a9b0ea72a9a4f33cfc86b4230012
pattern_matcher/pattern_matcher.py
pattern_matcher/pattern_matcher.py
from .regex import RegexFactory from .patterns import Patterns class Matcher(object): NO_MATCH = 'NO MATCH' def __init__(self, raw_patterns, path, re_factory=RegexFactory): self.raw_patterns = raw_patterns self.path = path self.re = re_factory().create(self.path) self.patterns...
from .regex import RegexFactory from .patterns import Patterns class Matcher(object): NO_MATCH = 'NO MATCH' def __init__(self, raw_patterns, path, re_factory=RegexFactory): self.raw_patterns = raw_patterns self.path = path self.re = re_factory().create(self.path) self.patterns...
Change the way the Matcher is initialized and how matches are retrieved.
Change the way the Matcher is initialized and how matches are retrieved.
Python
mit
damonkelley/pattern-matcher
34b736645e45126c6cabb6d3f5427a697ebe74ff
tutorial/polls/views.py
tutorial/polls/views.py
from django.shortcuts import render # Create your views here.
from django.shortcuts import render from django.http import HttpResponse # Create your views here. def index(request): return HttpResponse("Hello world you are at the index")
Create a simple Index view
Create a simple Index view
Python
mit
ikosenn/django_reignited,ikosenn/django_reignited
1bc95e2e2a2d4d0daf6cfcdbf7e4803b13262a49
etcd3/__init__.py
etcd3/__init__.py
from __future__ import absolute_import __author__ = 'Louis Taylor' __email__ = 'louis@kragniz.eu' __version__ = '0.1.0' import grpc from etcdrpc import rpc_pb2 as etcdrpc channel = grpc.insecure_channel('localhost:2379') stub = etcdrpc.KVStub(channel) put_request = etcdrpc.PutRequest() put_request.key = 'doot'.enc...
from __future__ import absolute_import __author__ = 'Louis Taylor' __email__ = 'louis@kragniz.eu' __version__ = '0.1.0' import grpc from etcdrpc import rpc_pb2 as etcdrpc class Etcd3Client(object): def __init__(self): self.channel = grpc.insecure_channel('localhost:2379') self.kvstub = etcdrpc....
Move put code into method
Move put code into method
Python
apache-2.0
kragniz/python-etcd3
536211012be24a20c34ef0af1fcc555672129354
byceps/util/system.py
byceps/util/system.py
# -*- coding: utf-8 -*- """ byceps.util.system ~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import os CONFIG_ENV_VAR_NAME = 'BYCEPS_CONFIG' def get_config_env_name_from_env(*, default=None): """Return the configuration environment name set...
# -*- coding: utf-8 -*- """ byceps.util.system ~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import os CONFIG_ENV_VAR_NAME = 'BYCEPS_CONFIG' def get_config_env_name_from_env(): """Return the configuration environment name set via environmen...
Remove default argument from function that reads the configuration name from the environment
Remove default argument from function that reads the configuration name from the environment
Python
bsd-3-clause
homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps
87153cb1a9727d17d31f3aabb28affddca3191bf
sqltocpp.py
sqltocpp.py
import click from sqltocpp import convert @click.command() @click.option('--sql', help='schema file name') @click.option('--target', default='schema.hpp', help='hpp file name') def execute(sql, target): convert.schema_to_struct(sql, target) if __name__ == '__main__': try: execute() except: ...
import click from sqltocpp import convert @click.command() @click.argument('sql_schema_file') @click.option('--target', default='schema.hpp', help='hpp file name') def execute(sql_schema_file, target): convert.schema_to_struct(sql_schema_file, target) if __name__ == '__main__': execute()
Add click based commandline interface script
Add click based commandline interface script sqltocpp is intended to be a CLI command. This enables it to be so
Python
mit
banjocat/SqlToCpp,banjocat/SqlToCpp
fe2300d809d863b63f3100ff72757f48cb11789b
nn_patterns/explainer/__init__.py
nn_patterns/explainer/__init__.py
from .base import * from .gradient_based import * from .misc import * from .pattern_based import * from .relevance_based import * def create_explainer(name, output_layer, patterns=None, to_layer=None, **kwargs): return { # Utility. "input": InputExplainer, "random": ...
from .base import * from .gradient_based import * from .misc import * from .pattern_based import * from .relevance_based import * def create_explainer(name, output_layer, patterns=None, **kwargs): return { # Utility. "input": InputExplainer, "random": RandomExplainer...
Fix interface. to_layer parameter is obsolete.
Fix interface. to_layer parameter is obsolete.
Python
mit
pikinder/nn-patterns
267c17ce984952d16623b0305975626397529ca8
tests/config_test.py
tests/config_test.py
import pytest from timewreport.config import TimeWarriorConfig def test_get_value_should_return_value_if_key_available(): config = TimeWarriorConfig({'FOO': 'foo'}) assert config.get_value('FOO', 'bar') == 'foo' def test_get_value_should_return_default_if_key_not_available(): config = TimeWarriorConfi...
import pytest from timewreport.config import TimeWarriorConfig def test_get_value_should_return_value_if_key_available(): config = TimeWarriorConfig({'FOO': 'foo'}) assert config.get_value('FOO', 'bar') == 'foo' def test_get_value_should_return_default_if_key_not_available(): config = TimeWarriorConfi...
Add tests for falseish config values
Add tests for falseish config values
Python
mit
lauft/timew-report
6c157525bc32f1e6005be69bd6fde61d0d002ad3
wizard/post_function.py
wizard/post_function.py
from openerp import pooler def call_post_function(cr, uid, context): """This functionality allows users of module account.move.reversal to call a function of the desired openerp model, after the reversal of the move. The call automatically sends at least the database cursor (cr) and the use...
from openerp import pooler def call_post_function(cr, uid, context): """This functionality allows users of module account.move.reversal to call a function of the desired openerp model, after the reversal of the move. The call automatically sends at least the database cursor (cr) and the use...
Remove some required arguments in post function context
Remove some required arguments in post function context
Python
agpl-3.0
xcgd/account_move_reversal
3271722d3905a7727c20989fa98d804cb4df1b82
mysite/urls.py
mysite/urls.py
"""vote URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based...
"""vote URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based...
Add redirect from / to /polls
Add redirect from / to /polls
Python
apache-2.0
gerard-/votingapp,gerard-/votingapp
f405ee262ab6f87df8e83e024d3c615842fa37ce
fandjango/urls.py
fandjango/urls.py
from django.conf.urls.defaults import * from views import * urlpatterns = patterns('', url(r'^authorize_application.html$', authorize_application, name='authorize_application'), url(r'^deauthorize_application.html$', deauthorize_application) )
from django.conf.urls.defaults import * from views import * urlpatterns = patterns('', url(r'^authorize_application.html$', authorize_application, name='authorize_application'), url(r'^deauthorize_application.html$', deauthorize_application, name='deauthorize_application') )
Add a name to the URL configuration for 'deauthorize_application'
Add a name to the URL configuration for 'deauthorize_application'
Python
mit
jgorset/fandjango,jgorset/fandjango
a2ea31300e614c27c3f99e079293728bee9fbcf4
paws_config.py
paws_config.py
import tornado from tornado import gen import json import os BASE_PATH = '.' base_url = '/paws/public/' @gen.coroutine def uid_for_user(user): url = 'https://meta.wikimedia.org/w/api.php?' + \ 'action=query&meta=globaluserinfo' + \ '&format=json&formatversion=2' + \ '&guiuser={}'....
import tornado from tornado import gen import json import os BASE_PATH = '.' base_url = '/paws/public/' @gen.coroutine def uid_for_user(user): url = 'https://meta.wikimedia.org/w/api.php?' + \ 'action=query&meta=globaluserinfo' + \ '&format=json&formatversion=2' + \ '&guiuser={}'....
Add clarifying(?) comment about uid caching
Add clarifying(?) comment about uid caching
Python
bsd-3-clause
yuvipanda/nbserve
bd20dbda918cdec93ab6d1fe5bba0ce064a60103
fairseq/scoring/wer.py
fairseq/scoring/wer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import editdistance from fairseq.scoring import register_scoring @register_scoring("wer") class WerScorer(object): def __init__(self, *...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import editdistance from fairseq.scoring import register_scoring @register_scoring("wer") class WerScorer(object): def __init__(self, *...
Fix typos in WER scorer
Fix typos in WER scorer Summary: Fix typos in WER scorer - The typos lead to using prediction length as the denominator in the formula, which is wrong. Reviewed By: alexeib Differential Revision: D23139261 fbshipit-source-id: d1bba0044365813603ce358388e880c1b3f9ec6b
Python
mit
pytorch/fairseq,pytorch/fairseq,pytorch/fairseq
7a7b42495fda7e7fabbf982e1194ea2fff6fdf15
code/DataSet.py
code/DataSet.py
# Neurotopics/code/DataSet.py import neurosynth.analysis.reduce as nsar class DataSet: """ A DataSet takes a NeuroSynth dataset and extracts the DOI's, and word subset of interest. It uses reduce.average_within_regions to get the average activation in the regions of interest (ROIs) of the img. ...
# Neurotopics/code/DataSet.py import neurosynth.analysis.reduce as nsar class DataSet: """ A DataSet takes a NeuroSynth dataset and extracts the DOI's, and word subset of interest. It uses reduce.average_within_regions to get the average activation in the regions of interest (ROIs) of the img. ...
Make more explicit variable name.
Make more explicit variable name.
Python
agpl-3.0
ambimorph/neurotopics-obs
c47468128ab831133a12f942d32dd73b4198458e
scent.py
scent.py
# -*- coding: utf-8 -*- import os import time import subprocess from sniffer.api import select_runnable, file_validator, runnable try: from pync import Notifier except ImportError: notify = None else: notify = Notifier.notify watch_paths = ['demo/', 'tests/'] @select_runnable('python_tests') @file_val...
# -*- coding: utf-8 -*- import os import time import subprocess from sniffer.api import select_runnable, file_validator, runnable try: from pync import Notifier except ImportError: notify = None else: notify = Notifier.notify watch_paths = ['demo/', 'tests/'] @select_runnable('python_tests') @file_val...
Deploy Travis CI build 478 to GitHub
Deploy Travis CI build 478 to GitHub
Python
mit
jacebrowning/template-python-demo
cc80f90a4f003c0967c31d5177971061350ee683
pycall/call.py
pycall/call.py
"""A simple wrapper for Asterisk calls.""" class Call(object): """Stores and manipulates Asterisk calls.""" def __init__(self, channel, callerid=None, account=None, wait_time=None, max_retries=None): """Create a new `Call` object. :param str channel: The Asterisk channel to call. Should be in standard A...
"""A simple wrapper for Asterisk calls.""" class Call(object): """Stores and manipulates Asterisk calls.""" def __init__(self, channel, callerid=None, account=None, wait_time=None, max_retries=None): """Create a new `Call` object. :param str channel: The Asterisk channel to call. Should be in standard A...
Revert "Forcing type coersion for int params."
Revert "Forcing type coersion for int params." This is a pointless bit of code. Since we lazy-evaluate them anyhow, it's a duplicate effort. This reverts commit 1ca6b96d492f8f33ac3b3a520937378effb66744.
Python
unlicense
rdegges/pycall
b1bfb600240a006eed0cfce19d3fc87b3c72669f
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup( name = 'jargparse', packages = ['jargparse'], # this must be the same as the name above version = '0.0.3', description = 'A tiny super-dumb python module just because I like to see the usage info on stdout on an error', author = 'Justin Clark-Case...
#!/usr/bin/env python from distutils.core import setup setup( name = 'jargparse', packages = ['jargparse'], # this must be the same as the name above version = '0.0.4', description = 'A tiny super-dumb module just because I like to see the usage info on stdout on an error. jargparse.ArgParser just wraps argpa...
Add a bit more to description
Add a bit more to description
Python
apache-2.0
justinccdev/jargparse
1fe7b9c3c9a3764a1e209b2699ef51b84c87e897
setup.py
setup.py
from distutils.core import setup import os setup( name='python-jambel', version='0.1', py_module=['jambel'], url='http://github.com/jambit/python-jambel', license='UNKNOWN', author='Sebastian Rahlf', author_email='sebastian.rahlf@jambit.com', description="Interface to jambit's project t...
from distutils.core import setup import os setup( name='python-jambel', version='0.1', py_module=['jambel'], url='http://github.com/jambit/python-jambel', license='UNKNOWN', author='Sebastian Rahlf', author_email='sebastian.rahlf@jambit.com', description="Interface to jambit's project t...
Add console script and test requirements.
Add console script and test requirements.
Python
mit
redtoad/python-jambel,jambit/python-jambel
c65d11f82b6d33d4940cdfd7b4d6b81e083c6e34
setup.py
setup.py
from distutils.core import setup setup( name='django_autologin', version='0.1', packages=['django_autologin', 'django_autologin.templatetags'], install_requires=['django>=1.0'], description='Token generator and processor to provide automatic login links for users' )
from distutils.core import setup setup( name='django_autologin', version='0.1', packages=['django_autologin', 'django_autologin.templatetags'], install_requires=['django>=1.0'], description='Token generator and processor to provide automatic login links for users' )
Use 4 spaces for indentation.
Use 4 spaces for indentation.
Python
bsd-3-clause
playfire/django-autologin
b825ee12fd6abc91b80b8a62886b9c53b82cdeeb
test/task_test.py
test/task_test.py
import doctest import unittest import luigi.task class TaskTest(unittest.TestCase): def test_tasks_doctest(self): doctest.testmod(luigi.task)
import doctest import unittest import luigi.task import luigi from datetime import datetime, timedelta class DummyTask(luigi.Task): param = luigi.Parameter() bool_param = luigi.BooleanParameter() int_param = luigi.IntParameter() float_param = luigi.FloatParameter() date_param = luigi.DateParamet...
Add test for task to str params conversion
Add test for task to str params conversion
Python
apache-2.0
soxofaan/luigi,adaitche/luigi,alkemics/luigi,dlstadther/luigi,fw1121/luigi,lungetech/luigi,linsomniac/luigi,moandcompany/luigi,mbruggmann/luigi,vine/luigi,aeron15/luigi,leafjungle/luigi,Houzz/luigi,springcoil/luigi,ViaSat/luigi,Tarrasch/luigi,oldpa/luigi,linsomniac/luigi,dstandish/luigi,kalaidin/luigi,jw0201/luigi,h3bi...
b0202e8882f792feb041070baff7370cacf73751
tests/test_api.py
tests/test_api.py
# -*- coding: utf-8 -*- import subprocess import time from unittest import TestCase from nose.tools import assert_equal class TestOldApi(TestCase): def setUp(self): self.process = subprocess.Popen("openfisca-serve") def tearDown(self): self.process.terminate() def test_response(self): ...
# -*- coding: utf-8 -*- import subprocess import time from unittest import TestCase from nose.tools import assert_equal class TestOldApi(TestCase): def setUp(self): self.process = subprocess.Popen("openfisca-serve") def tearDown(self): self.process.terminate() def test_response(self): ...
Test france compatibility with the new API
Test france compatibility with the new API
Python
agpl-3.0
antoinearnoud/openfisca-france,sgmap/openfisca-france,sgmap/openfisca-france,antoinearnoud/openfisca-france
53f2e3e5b58b001743bdedb479697150a9205b3f
buffpy/tests/test_profiles_manager.py
buffpy/tests/test_profiles_manager.py
from nose.tools import eq_ from mock import MagicMock, patch from buffpy.managers.profiles import Profiles from buffpy.models.profile import Profile, PATHS mocked_response = { 'name': 'me', 'service': 'twiter', 'id': 1 } def test_profiles_manager_all_method(): ''' Test basic profiles retrieving ''' ...
from unittest.mock import MagicMock, patch from buffpy.managers.profiles import Profiles from buffpy.models.profile import Profile, PATHS MOCKED_RESPONSE = { "name": "me", "service": "twiter", "id": 1 } def test_profiles_manager_all_method(): """ Should retrieve profile info. """ mocked_api = ...
Migrate profiles manager tests to pytest
Migrate profiles manager tests to pytest
Python
mit
vtemian/buffpy
1ab04355c0172682e9948847a01b073239d0ae64
words.py
words.py
"""Function to fetch words.""" import random WORDLIST = 'wordlist.txt' def get_random_word(): """Get a random word from the wordlist.""" words = [] with open(WORDLIST, 'r') as f: for word in f: words.append(word) return random.choice(words) def get_random_word_scalable(): "...
"""Function to fetch words.""" import random WORDLIST = 'wordlist.txt' def get_random_word(min_word_length): """Get a random word from the wordlist using no extra memory.""" num_words_processed = 0 curr_word = None with open(WORDLIST, 'r') as f: for word in f: if len(word) < min_...
Use scalable get_word by default
Use scalable get_word by default
Python
mit
andrewyang96/HangmanGame
e051ae3bdada17f31eb1c4ed68bcd41e6e20deab
cea/interfaces/dashboard/api/dashboard.py
cea/interfaces/dashboard/api/dashboard.py
from flask_restplus import Namespace, Resource, fields, abort import cea.config import cea.plots.cache api = Namespace('Dashboard', description='Dashboard plots') LAYOUTS = ['row', 'grid', 'map'] CATEGORIES = {c.name: {'label': c.label, 'plots': [{'id': p.id(), 'name': p.name} for p in c.plots]} for c...
from flask_restplus import Namespace, Resource, fields, abort import cea.config import cea.plots.cache api = Namespace('Dashboard', description='Dashboard plots') LAYOUTS = ['row', 'grid', 'map'] CATEGORIES = {c.name: {'label': c.label, 'plots': [{'id': p.id(), 'name': p.name} for p in c.plots]} for c...
Include plot title to plots
Include plot title to plots
Python
mit
architecture-building-systems/CEAforArcGIS,architecture-building-systems/CEAforArcGIS
7e9f8ca01b9cb1a70ee09dac9e0eecb8d370ad1f
acq4/devices/FalconTurret/falconturret.py
acq4/devices/FalconTurret/falconturret.py
import falconoptics from ..FilterWheel import FilterWheel, FilterWheelFuture class FalconTurret(FilterWheel): def __init__(self, dm, config, name): self.dev = falconoptics.Falcon(config_file=None, update_nonvolitile=True) self.dev.home(block=False) FilterWheel.__init__(self, dm, config, n...
from acq4.pyqtgraph.Qt import QtGui import falconoptics from ..FilterWheel import FilterWheel, FilterWheelFuture class FalconTurret(FilterWheel): def __init__(self, dm, config, name): self.dev = falconoptics.Falcon(config_file=None, update_nonvolitile=True) self.dev.home(block=False) Filt...
Add home button to falcon turret dev gui
Add home button to falcon turret dev gui
Python
mit
campagnola/acq4,acq4/acq4,pbmanis/acq4,pbmanis/acq4,meganbkratz/acq4,acq4/acq4,pbmanis/acq4,campagnola/acq4,campagnola/acq4,meganbkratz/acq4,pbmanis/acq4,meganbkratz/acq4,campagnola/acq4,acq4/acq4,acq4/acq4,meganbkratz/acq4
3e617e3ade1fa55562868c2e2bf8bc07f9b09a79
skflow/tests/test_io.py
skflow/tests/test_io.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Print when pandas not installed and removed unnecessary imports
Print when pandas not installed and removed unnecessary imports
Python
apache-2.0
anand-c-goog/tensorflow,alheinecke/tensorflow-xsmm,sandeepdsouza93/TensorFlow-15712,alisidd/tensorflow,paolodedios/tensorflow,kevin-coder/tensorflow-fork,sjperkins/tensorflow,yanchen036/tensorflow,with-git/tensorflow,benoitsteiner/tensorflow,kobejean/tensorflow,wangyum/tensorflow,Moriadry/tensorflow,rdipietro/tensorflo...
a5a90924822754b483041ba29cefeba949e72f38
securesystemslib/gpg/exceptions.py
securesystemslib/gpg/exceptions.py
""" <Program Name> exceptions.py <Author> Santiago Torres-Arias <santiago@nyu.edu> Lukas Puehringer <lukas.puehringer@nyu.edu> <Started> Dec 8, 2017 <Copyright> See LICENSE for licensing information. <Purpose> Define Exceptions used in the gpg package. Following the practice from securesystemslib the ...
""" <Program Name> exceptions.py <Author> Santiago Torres-Arias <santiago@nyu.edu> Lukas Puehringer <lukas.puehringer@nyu.edu> <Started> Dec 8, 2017 <Copyright> See LICENSE for licensing information. <Purpose> Define Exceptions used in the gpg package. Following the practice from securesystemslib the ...
Add custom KeyNotFoundError error to gpg module
Add custom KeyNotFoundError error to gpg module
Python
mit
secure-systems-lab/securesystemslib,secure-systems-lab/securesystemslib
dcbcd7434b8b4199242a479d187d2b833ca6ffcc
polling_stations/settings/constants/councils.py
polling_stations/settings/constants/councils.py
# settings for councils scraper YVM_LA_URL = "https://www.yourvotematters.co.uk/_design/nested-content/results-page2/search-voting-locations-by-districtcode?queries_distcode_query=" # noqa BOUNDARIES_URL = "https://ons-cache.s3.amazonaws.com/Local_Authority_Districts_April_2019_Boundaries_UK_BFE.geojson" EC_COUNCIL_C...
# settings for councils scraper YVM_LA_URL = "https://www.yourvotematters.co.uk/_design/nested-content/results-page2/search-voting-locations-by-districtcode?queries_distcode_query=" # noqa BOUNDARIES_URL = "https://ons-cache.s3.amazonaws.com/Local_Authority_Districts_April_2019_Boundaries_UK_BFE.geojson" EC_COUNCIL_C...
Set the EC API URL
Set the EC API URL
Python
bsd-3-clause
DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
4e31e5c776c40997cccd76d4ce592d7f3d5de752
example/runner.py
example/runner.py
#!/usr/bin/python import argparse import sys def args(): parser = argparse.ArgumentParser(description='Run the Furious Examples.') parser.add_argument('--gae-sdk-path', metavar='S', dest="gae_lib_path", default="/usr/local/google_appengine", help='path to the ...
#!/usr/bin/python import argparse import sys def args(): parser = argparse.ArgumentParser(description='Run the Furious Examples.') parser.add_argument('--gae-sdk-path', metavar='S', dest="gae_lib_path", default="/usr/local/google_appengine", help='path to the ...
Update the way the url is handled.
Update the way the url is handled.
Python
apache-2.0
andreleblanc-wf/furious,Workiva/furious,rosshendrickson-wf/furious,beaulyddon-wf/furious,mattsanders-wf/furious,rosshendrickson-wf/furious,mattsanders-wf/furious,beaulyddon-wf/furious,andreleblanc-wf/furious,Workiva/furious
24cbbd24e6398aa11956ac48282bd907806284c3
genderbot.py
genderbot.py
import re from twitterbot import TwitterBot import wikipedia class Genderbot(TwitterBot): boring_article_regex = (r"municipality|village|town|football|genus|family|" "administrative|district|community|region|hamlet|" "school|actor|mountain|basketball|city|specie...
import re from twitterbot import TwitterBot import wikipedia class Genderbot(TwitterBot): boring_regex = (r"municipality|village|town|football|genus|family|" "administrative|district|community|region|hamlet|" "school|actor|mountain|basketball|city|species|film|" ...
Tweak boring regex to exclude more terms
Tweak boring regex to exclude more terms
Python
mit
DanielleSucher/genderbot
f68a3874eb9b80898a6c1acfc74e493aad5817d8
source/services/rotten_tomatoes_service.py
source/services/rotten_tomatoes_service.py
import requests from bs4 import BeautifulSoup from source.models.rt_rating import RTRating class RottenTomatoesService: __URL = 'http://www.rottentomatoes.com/m/' __SEPERATOR = '_' def __init__(self, title): self.title = title def get_rt_rating(self): search_url = self.__URL + self...
import requests from bs4 import BeautifulSoup from source.models.rt_rating import RTRating class RottenTomatoesService: __URL = 'http://www.rottentomatoes.com/m/' __SEPERATOR = '_' def __init__(self, title): self.title = title def get_rt_rating(self): search_url = self.__URL + self...
Remove "A" from start of title for RT search
Remove "A" from start of title for RT search
Python
mit
jeremyrea/caterblu,jeremyrea/caterblu,jeremyrea/caterblu,jeremyrea/caterblu
033b17a8be5be32188ca9b5f286fe023fc07d34a
frappe/utils/pdf.py
frappe/utils/pdf.py
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import pdfkit, os, frappe from frappe.utils import scrub_urls def get_pdf(html, options=None): if not options: options = {} options.update({ "print-media-type": None, ...
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import pdfkit, os, frappe from frappe.utils import scrub_urls def get_pdf(html, options=None): if not options: options = {} options.update({ "print-media-type": None, ...
Remove margin constrains from PDF printing
Remove margin constrains from PDF printing
Python
mit
BhupeshGupta/frappe,BhupeshGupta/frappe,BhupeshGupta/frappe,BhupeshGupta/frappe
2f2cef54a98e2328a638d9bbdfd2e0312606d906
plugins/GCodeWriter/__init__.py
plugins/GCodeWriter/__init__.py
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from . import GCodeWriter from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") def getMetaData(): return { "type": "mesh_writer", "plugin": { "name": "GCode Writer", "a...
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from . import GCodeWriter from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") def getMetaData(): return { "type": "mesh_writer", "plugin": { "name": "GCode Writer", "a...
Add mime types to GCodeWriter plugin
Add mime types to GCodeWriter plugin
Python
agpl-3.0
Curahelper/Cura,senttech/Cura,fieldOfView/Cura,hmflash/Cura,lo0ol/Ultimaker-Cura,Curahelper/Cura,markwal/Cura,ad1217/Cura,senttech/Cura,ad1217/Cura,lo0ol/Ultimaker-Cura,totalretribution/Cura,hmflash/Cura,bq/Ultimaker-Cura,ynotstartups/Wanhao,fieldOfView/Cura,totalretribution/Cura,fxtentacle/Cura,fxtentacle/Cura,ynotsta...
87a72b219c2699e6bbb4354ae4b4f4ee356fd2c5
plumeria/plugins/bing_images.py
plumeria/plugins/bing_images.py
from aiohttp import BasicAuth from plumeria import config from plumeria.command import commands, CommandError from plumeria.message import Response from plumeria.util import http from plumeria.util.ratelimit import rate_limit SEARCH_URL = "https://api.datamarket.azure.com/Bing/Search/v1/Image" api_key = config.create...
from aiohttp import BasicAuth from plumeria import config from plumeria.command import commands, CommandError from plumeria.message import Response from plumeria.util import http from plumeria.util.ratelimit import rate_limit SEARCH_URL = "https://api.datamarket.azure.com/Bing/Search/v1/Image" api_key = config.create...
Add !images as Bing !image alias.
Add !images as Bing !image alias.
Python
mit
sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria
e8c6be3565bd8b33dfb7a01dfb77938534ce9d09
pysswords/crypt.py
pysswords/crypt.py
import os import gnupg import logging from .utils import which def create_key_input(gpg, passphrase, testing=False): key_input = gpg.gen_key_input( name_real='Pysswords', name_email='pysswords@pysswords', name_comment='Autogenerated by Pysswords', passphrase=passphrase, te...
import os import gnupg import logging from .utils import which def create_key_input(gpg, passphrase, testing=False): key_input = gpg.gen_key_input( name_real='Pysswords', name_email='pysswords@pysswords', name_comment='Autogenerated by Pysswords', passphrase=passphrase, te...
Add load gpg to get an instance of gpg
Add load gpg to get an instance of gpg
Python
mit
scorphus/passpie,scorphus/passpie,marcwebbie/passpie,eiginn/passpie,marcwebbie/pysswords,marcwebbie/passpie,eiginn/passpie
04bbe400396a5ef5b930b9db9d8d8e30ff6bf678
medical_patient_ethnicity/models/medical_patient_ethnicity.py
medical_patient_ethnicity/models/medical_patient_ethnicity.py
# -*- coding: utf-8 -*- # ############################################################################# # # Tech-Receptives Solutions Pvt. Ltd. # Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>) # Special Credit and Thanks to Thymbra Latinoamericana S.A. # # This program is free softwa...
# -*- coding: utf-8 -*- # ############################################################################# # # Tech-Receptives Solutions Pvt. Ltd. # Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>) # Special Credit and Thanks to Thymbra Latinoamericana S.A. # # This program is free softwa...
Add description to ethnicity model
Add description to ethnicity model
Python
agpl-3.0
ShaheenHossain/eagle-medical,laslabs/vertical-medical,laslabs/vertical-medical,ShaheenHossain/eagle-medical
10ddda3e230aa72889c81cd69792122b265010fe
rental/views/rental_state_view.py
rental/views/rental_state_view.py
from django.http import HttpResponseForbidden from django.shortcuts import redirect, get_object_or_404 from django.views import View from rental.state_transitions import allowed_transitions from rental.models import Rental class RentalStateView(View): """ Change the state of a given rental If given an in...
from django.http import HttpResponseForbidden from django.shortcuts import redirect, get_object_or_404 from django.views import View from rental.availability import Availability from rental.state_transitions import allowed_transitions from rental.models import Rental class RentalStateView(View): """ Change th...
Check availability when approving rental request
Check availability when approving rental request
Python
agpl-3.0
verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool
dc5235afec231454594201a54039869da26db576
enactiveagents/model/perceptionhandler.py
enactiveagents/model/perceptionhandler.py
""" Module that holds classes that represent an agent's perception handler. """ import abc import world import structure class PerceptionHandler(object): @abc.abstractmethod def perceive(self, agent, world): """ Generates a percept given an agent and a world. :param agent: The agent ...
""" Module that holds classes that represent an agent's perception handler. """ import abc import world import structure class PerceptionHandler(object): @abc.abstractmethod def perceive(self, agent, world): """ Generates a percept given an agent and a world. :param agent: The agent ...
Add block structure to perception handler. Slightly change perception handler logic.
Add block structure to perception handler. Slightly change perception handler logic.
Python
mit
Beskhue/enactive-agents,Beskhue/enactive-agents,Beskhue/enactive-agents
b5a21c39c37c02ea7077ce92596d68e496473af0
grako/rendering.py
grako/rendering.py
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals import itertools from .util import trim def render(item, **fields): """ Render the given item """ if item is None: return '' elif isinstance(item, Renderer): return item.render(**f...
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals import itertools from .util import trim def render(item, **fields): """ Render the given item """ if item is None: return '' elif isinstance(item, Renderer): return item.render(**f...
Allow override of template through return value of render_fields.
Allow override of template through return value of render_fields.
Python
bsd-2-clause
frnknglrt/grako,vmuriart/grako
17a42110978d2fc38daaf0e09e25da760ccdc339
adhocracy4/emails/mixins.py
adhocracy4/emails/mixins.py
from email.mime.image import MIMEImage from django.contrib.staticfiles import finders from .base import EmailBase class PlatformEmailMixin: """ Attaches the static file images/logo.png so it can be used in an html email. """ def get_attachments(self): attachments = super().get_attachments...
from email.mime.image import MIMEImage from django.contrib.staticfiles import finders from .base import EmailBase class PlatformEmailMixin: """ Attaches the static file images/logo.png so it can be used in an html email. """ def get_attachments(self): attachments = super().get_attachments...
Allow svg as email logo attachment
Allow svg as email logo attachment
Python
agpl-3.0
liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4
9ce7ee71b5eddc0ceff578b45c1324f8eb09ffe1
artbot_scraper/pipelines.py
artbot_scraper/pipelines.py
# -*- coding: utf-8 -*- from django.db import IntegrityError from scrapy.exceptions import DropItem from titlecase import titlecase from dateutil import parser, relativedelta class EventPipeline(object): def process_item(self, item, spider): item['titleRaw'] = item['title'] ...
# -*- coding: utf-8 -*- from django.db import IntegrityError from scrapy.exceptions import DropItem from titlecase import titlecase from dateutil import parser, relativedelta class EventPipeline(object): def process_item(self, item, spider): item['titleRaw'] = item['title'] ...
Verify that event end and start keys exist before accessing.
Verify that event end and start keys exist before accessing.
Python
mit
coreymcdermott/artbot,coreymcdermott/artbot
e2a4262035e0d99c83a1bef8fdd594745a66b011
tests/app/views/test_application.py
tests/app/views/test_application.py
from nose.tools import assert_equal, assert_true from ...helpers import BaseApplicationTest class TestApplication(BaseApplicationTest): def setup(self): super(TestApplication, self).setup() def test_analytics_code_should_be_in_javascript(self): res = self.client.get('/static/javascripts/appli...
from nose.tools import assert_equal, assert_true from ...helpers import BaseApplicationTest class TestApplication(BaseApplicationTest): def setup(self): super(TestApplication, self).setup() def test_analytics_code_should_be_in_javascript(self): res = self.client.get('/static/javascripts/appli...
Test for presence of analytics in minified JS
Test for presence of analytics in minified JS Minifying the JS shortens variable names wherever their scope makes it possible. This means that `GOVUK.analytics.trackPageView` gets shortened to something like `e.t.trackPageView`, and not in a predicatable way. Because the `trackPageView` method could be used by indeter...
Python
mit
AusDTO/dto-digitalmarketplace-buyer-frontend,mtekel/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,mtekel/digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,mtekel/digitalmarke...
50f2acfcfe482c5452a80243b186ec411f672afc
boundaryservice/urls.py
boundaryservice/urls.py
from django.conf.urls.defaults import patterns, include, url from boundaryservice.views import * urlpatterns = patterns('', url(r'^boundary-set/$', BoundarySetListView.as_view(), name='boundaryservice_set_list'), url(r'^boundary-set/(?P<slug>[\w_-]+)/$', BoundarySetDetailView.as_view(), name='boundaryservice_...
from django.conf.urls.defaults import patterns, include, url from boundaryservice.views import * urlpatterns = patterns('', url(r'^boundary-sets/$', BoundarySetListView.as_view(), name='boundaryservice_set_list'), url(r'^boundary-sets/(?P<slug>[\w_-]+)/$', BoundarySetDetailView.as_view(), name='boundaryservic...
Use plural names for resource types in URLs
Use plural names for resource types in URLs
Python
mit
datamade/represent-boundaries,opencorato/represent-boundaries,opencorato/represent-boundaries,datamade/represent-boundaries,datamade/represent-boundaries,opencorato/represent-boundaries
1631eb5d1e009c236bdc3db1d2d44da9e9e9102a
kokki/cookbooks/busket/recipes/default.py
kokki/cookbooks/busket/recipes/default.py
import os from kokki import * Package("erlang") Package("mercurial", provider = "kokki.providers.package.easy_install.EasyInstallProvider") Script("install-busket", not_if = lambda:os.path.exists(env.config.busket.path), cwd = "/usr/local/src", code = ( "git clone git://github.com/samuel/bus...
import os from kokki import * Package("erlang") # ubuntu's erlang is a bit messed up.. remove the man link File("/usr/lib/erlang/man", action = "delete") Package("mercurial", provider = "kokki.providers.package.easy_install.EasyInstallProvider") Script("install-busket", not_if = lambda:os.path.exists(en...
Remove man link for erlang in ubuntu
Remove man link for erlang in ubuntu
Python
bsd-3-clause
samuel/kokki
963f9ed01b400cd95e14aecdee7c265fe48a4d41
mopidy_nad/__init__.py
mopidy_nad/__init__.py
import os import pkg_resources from mopidy import config, ext __version__ = pkg_resources.get_distribution("Mopidy-NAD").version class Extension(ext.Extension): dist_name = "Mopidy-NAD" ext_name = "nad" version = __version__ def get_default_config(self): conf_file = os.path.join(os.path.di...
import pathlib import pkg_resources from mopidy import config, ext __version__ = pkg_resources.get_distribution("Mopidy-NAD").version class Extension(ext.Extension): dist_name = "Mopidy-NAD" ext_name = "nad" version = __version__ def get_default_config(self): return config.read(pathlib.Pat...
Use pathlib to read ext.conf
Use pathlib to read ext.conf
Python
apache-2.0
mopidy/mopidy-nad
33f7e94385a8d4fbba797fc81b2565906604c9a4
src/zeit/content/cp/browser/area.py
src/zeit/content/cp/browser/area.py
# Copyright (c) 2009-2010 gocept gmbh & co. kg # See also LICENSE.txt import zeit.content.cp.browser.blocks.teaser import zeit.content.cp.interfaces import zeit.edit.browser.block import zeit.edit.browser.view import zope.formlib.form class ViewletManager(zeit.edit.browser.block.BlockViewletManager): @property ...
# Copyright (c) 2009-2010 gocept gmbh & co. kg # See also LICENSE.txt import zeit.content.cp.browser.blocks.teaser import zeit.content.cp.interfaces import zeit.edit.browser.block import zeit.edit.browser.view import zope.formlib.form class ViewletManager(zeit.edit.browser.block.BlockViewletManager): @property ...
Remove field that has now the same default implementation on it's super class.
Remove field that has now the same default implementation on it's super class.
Python
bsd-3-clause
ZeitOnline/zeit.content.cp,ZeitOnline/zeit.content.cp
a802501943757dd85ce66a11fcd7ae40c0239462
datastructures.py
datastructures.py
#!/usr/bin/env python3 class Triangle: """A class structure for storing and minipulating a triangle. The trianlge is represented as a 3-tuple of points. Each point is represented as a 2-tuple of floats, the first element being the x-coordinate and the second element being the y-coordinate. Severa...
#!/usr/bin/env python3 import math class Triangle: """A class structure for storing and minipulating a triangle. The trianlge is represented as a 3-tuple of points. Each point is represented as a 2-tuple of floats, the first element being the x-coordinate and the second element being the y-coordinate...
Add method to rotate triangle
Add method to rotate triangle
Python
mit
moyamo/polygon2square
dfcb61ef1187f9d3cf80ffc55ad8aceafb0b29b3
djoauth2/helpers.py
djoauth2/helpers.py
# coding: utf-8 import random import urlparse from string import ascii_letters, digits from urllib import urlencode # From http://tools.ietf.org/html/rfc6750#section-2.1 BEARER_TOKEN_CHARSET = ascii_letters + digits + '-._~+/' def random_hash(length): return ''.join(random.sample(BEARER_TOKEN_CHARSET, length)) d...
# coding: utf-8 import random import urlparse from string import ascii_letters, digits from urllib import urlencode # From http://tools.ietf.org/html/rfc6750#section-2.1 BEARER_TOKEN_CHARSET = ascii_letters + digits + '-._~+/' def random_hash(length): return ''.join(random.sample(BEARER_TOKEN_CHARSET, length)) d...
Fix query string update helper.
Fix query string update helper.
Python
mit
seler/djoauth2,vden/djoauth2-ng,Locu/djoauth2,Locu/djoauth2,seler/djoauth2,vden/djoauth2-ng
986901c9e91d44758200fb8d3264b88c0977be37
lvsr/configs/timit_bothgru_hybrid2.py
lvsr/configs/timit_bothgru_hybrid2.py
Config( net=Config(attention_type='hybrid2', shift_predictor_dims=[100], max_left=10, max_right=100), initialization=[ ("/recognizer", "rec_weights_init", "IsotropicGaussian(0.1)"), ("/recognizer/generator/att_trans/hybrid_att/loc_att", "weig...
Config( net=Config(dec_transition='GatedRecurrent', enc_transition='GatedRecurrent', attention_type='hybrid2', shift_predictor_dims=[100], max_left=10, max_right=100), initialization=[ ("/recognizer", "rec_weights_init", "Isotrop...
Fix hybrid2, but it is still no use
Fix hybrid2, but it is still no use
Python
mit
nke001/attention-lvcsr,rizar/attention-lvcsr,rizar/attention-lvcsr,nke001/attention-lvcsr,nke001/attention-lvcsr,rizar/attention-lvcsr,nke001/attention-lvcsr,rizar/attention-lvcsr,rizar/attention-lvcsr,nke001/attention-lvcsr
d48946c89b4436fad97fdee65e34d7ca77f58d95
modules/base.py
modules/base.py
#-*- coding: utf-8 -*- import pandas as pd import pandas_datareader.data as web import datetime import config import os import re import pickle def get_file_path(code): return os.path.join(config.DATA_PATH, 'data', code + '.pkl') def download(code, year1, month1, day1, year2, month2, day2): start = datetime.datet...
#-*- coding: utf-8 -*- import pandas as pd import pandas_datareader.data as web import datetime import config import os import re import pickle def get_file_path(code): if not os.path.exists(config.DATA_PATH): try: os.makedirs(config.DATA_PATH) except: pass return os.path.join(config.DATA_PATH...
Fix the FileNotFoundError when data director is not exist
Fix the FileNotFoundError when data director is not exist
Python
mit
jongha/stock-ai,jongha/stock-ai,jongha/stock-ai,jongha/stock-ai
c1bafcaa2c826ab450bd7a5e77a48fd742098e19
trex/serializers.py
trex/serializers.py
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from rest_framework.serializers import ( HyperlinkedModelSerializer, HyperlinkedIdentityField, ) from trex.models.project import Project, Entry class ProjectSerializer(Hype...
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from rest_framework.serializers import ( HyperlinkedModelSerializer, HyperlinkedIdentityField, ) from trex.models.project import Project, Entry, Tag class ProjectSerializer...
Add EntryTagsSerializer for returning tags of an Entry
Add EntryTagsSerializer for returning tags of an Entry
Python
mit
bjoernricks/trex,bjoernricks/trex
332ed6c26830bf2ac8e154948c4c58b745d5b5ae
cosmo_tester/test_suites/snapshots/conftest.py
cosmo_tester/test_suites/snapshots/conftest.py
import pytest from cosmo_tester.framework.test_hosts import Hosts, get_image from cosmo_tester.test_suites.snapshots import get_multi_tenant_versions_list @pytest.fixture(scope='function', params=get_multi_tenant_versions_list()) def hosts(request, ssh_key, module_tmpdir, test_config, logger): hosts = Hosts( ...
import pytest from cosmo_tester.framework.test_hosts import Hosts, get_image from cosmo_tester.test_suites.snapshots import get_multi_tenant_versions_list @pytest.fixture(scope='function', params=get_multi_tenant_versions_list()) def hosts(request, ssh_key, module_tmpdir, test_config, logger): hosts = Hosts( ...
Use correct rabbit certs on old IP setter
Use correct rabbit certs on old IP setter
Python
apache-2.0
cloudify-cosmo/cloudify-system-tests,cloudify-cosmo/cloudify-system-tests
0fd7b771823b97cb5fb7789c981d4ab3befcd28e
bluebottle/homepage/models.py
bluebottle/homepage/models.py
from bluebottle.quotes.models import Quote from bluebottle.slides.models import Slide from bluebottle.statistics.models import Statistic from bluebottle.projects.models import Project class HomePage(object): """ Instead of serving all the objects separately we combine Slide, Quote and Stats into a dummy o...
from bluebottle.quotes.models import Quote from bluebottle.slides.models import Slide from bluebottle.statistics.models import Statistic from bluebottle.projects.models import Project class HomePage(object): """ Instead of serving all the objects separately we combine Slide, Quote and Stats into a dummy o...
Send an empty list instead of None if no projects
Send an empty list instead of None if no projects selected for homepage.
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
b46dc26e5e1b4c0388c330017dc52393417c3323
tests/test_init.py
tests/test_init.py
from disco.test import TestCase, TestJob class InitJob(TestJob): sort = False @staticmethod def map_reader(stream, size, url, params): params.x = 10 return (stream, size, url) @staticmethod def map_init(iter, params): assert hasattr(params, 'x') iter.next() ...
from disco.test import TestCase, TestJob class InitJob(TestJob): params = {'x': 10} sort = False @staticmethod def map_init(iter, params): iter.next() params['x'] += 100 @staticmethod def map(e, params): yield e, int(e) + params['x'] @staticmethod def reduce_i...
Revert "added a test for the map_reader before map_init -case which fails currently" (deprecate init functions instead)
Revert "added a test for the map_reader before map_init -case which fails currently" (deprecate init functions instead) This reverts commit 88551bf444b7b358fea8e7eb4475df2c5d87ceeb.
Python
bsd-3-clause
ErikDubbelboer/disco,pombredanne/disco,mwilliams3/disco,simudream/disco,pombredanne/disco,simudream/disco,mozilla/disco,beni55/disco,ErikDubbelboer/disco,pavlobaron/disco_playground,pooya/disco,ktkt2009/disco,scrapinghub/disco,seabirdzh/disco,pombredanne/disco,pooya/disco,pombredanne/disco,mwilliams3/disco,ktkt2009/dis...
fefa46e21724fcd87cda0fa58101e1a74a31adec
molly/apps/places/importers/naptan.py
molly/apps/places/importers/naptan.py
from datetime import timedelta import httplib from tempfile import TemporaryFile from zipfile import ZipFile from celery.schedules import schedule from molly.apps.places.parsers.naptan import NaptanParser class NaptanImporter(object): IMPORTER_NAME = 'naptan' IMPORT_SCHEDULE = schedule(run_every=timedelta(w...
from datetime import timedelta import httplib from tempfile import TemporaryFile from zipfile import ZipFile from celery.schedules import schedule from molly.apps.places.parsers.naptan import NaptanParser class NaptanImporter(object): IMPORTER_NAME = 'naptan' IMPORT_SCHEDULE = schedule(run_every=timedelta(w...
Update the importer to use the places service
Update the importer to use the places service
Python
apache-2.0
ManchesterIO/mollyproject-next,ManchesterIO/mollyproject-next,ManchesterIO/mollyproject-next
ff0da634e1fa0f8b190a3ba2cac3a03f7df75f91
memegen/test/test_routes__common.py
memegen/test/test_routes__common.py
# pylint: disable=unused-variable from unittest.mock import patch, Mock from memegen.app import create_app from memegen.settings import get_config from memegen.routes._common import display def describe_display(): app = create_app(get_config('test')) app.config['GOOGLE_ANALYTICS_TID'] = 'my_tid' reque...
# pylint: disable=unused-variable,expression-not-assigned from unittest.mock import patch, call, Mock import pytest from expecter import expect from memegen.app import create_app from memegen.settings import get_config from memegen.routes._common import display def describe_display(): @pytest.fixture def ...
Test that a request defaults to sending an image
Test that a request defaults to sending an image
Python
mit
joshfriend/memegen,joshfriend/memegen,DanLindeman/memegen,DanLindeman/memegen,DanLindeman/memegen,DanLindeman/memegen,joshfriend/memegen,joshfriend/memegen
ccf60e9e79b8b2db8cbf7918caf23314e8790134
lib/reporter.py
lib/reporter.py
#!/usr/bin/python import sys import os name = sys.argv[1] status = sys.stdin.readline() status = status.rstrip(os.linesep) print("<%s>" % name) print("\t<status=\"%s\" />" % status) if status != "SKIP": print("\t<outcome>") for line in sys.stdin: # Escaping, ... ! print(line.rstrip(os.linesep)) p...
#!/usr/bin/python import sys import os name = sys.argv[1] status = sys.stdin.readline() status = status.rstrip(os.linesep) print("<%s status=\"%s\">" % (name, status)) print("\t<outcome>") for line in sys.stdin: # Escaping, ... ! print(line.rstrip(os.linesep)) print("\t</outcome>") print("</%s>" % name)
Fix the XML format produced
Fix the XML format produced
Python
apache-2.0
CESNET/secant,CESNET/secant
83ed5ca9bc388dbe9b2d82510842a99b3a2e5ce7
src/personalisation/middleware.py
src/personalisation/middleware.py
from personalisation.models import AbstractBaseRule, Segment class SegmentMiddleware(object): """Middleware for testing and putting a user in a segment""" def __init__(self, get_response=None): self.get_response = get_response def __call__(self, request): segments = Segment.objects.all()...
from personalisation.models import AbstractBaseRule, Segment class SegmentMiddleware(object): """Middleware for testing and putting a user in a segment""" def __init__(self, get_response=None): self.get_response = get_response def __call__(self, request): segments = Segment.objects.all()...
Create empty 'segments' object in session if none exists
Create empty 'segments' object in session if none exists
Python
mit
LabD/wagtail-personalisation,LabD/wagtail-personalisation,LabD/wagtail-personalisation
c0e98c14813c966ecd9e6b47395cb336a244f090
discussion/forms.py
discussion/forms.py
from django import forms from discussion.models import Comment, Post, Discussion from notification.models import NoticeSetting class CommentForm(forms.ModelForm): class Meta: exclude = ('user', 'post') model = Comment widgets = { 'body': forms.Textarea(attrs={'placeholder': 'R...
from django import forms from django.utils.translation import ugettext_lazy as _ from discussion.models import Comment, Post, Discussion from notification.models import NoticeSetting class CommentForm(forms.ModelForm): class Meta: exclude = ('user', 'post') model = Comment widgets = { ...
Make the odd string translatable.
Make the odd string translatable.
Python
bsd-2-clause
incuna/django-discussion,lehins/lehins-discussion,lehins/lehins-discussion,incuna/django-discussion,lehins/lehins-discussion