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
859a9aa684b793a31dbf0b1f8e559d5cd40a152e
tests/props_test.py
tests/props_test.py
from fixture import GeneratorTest from google.appengine.ext import testbed, ndb class PropsTest(GeneratorTest): def testLotsaModelsGenerated(self): for klass in self.klasses: k = klass._get_kind() assert ndb.Model._lookup_model(k) == klass, klass
from fixture import GeneratorTest from google.appengine.ext import testbed, ndb import gaend.generator as generator import re class PropsTest(GeneratorTest): def testEntityToPropsAndBack(self): for klass in self.klasses: # Create entity1 of this klass kind = klass._get_kind() ...
Enumerate through choices of property values
Enumerate through choices of property values
Python
mit
samedhi/gaend,talkiq/gaend,talkiq/gaend,samedhi/gaend
bd23a87d28a1d0a1f82b0fd17abfababafba0dc7
viaduct/api/page.py
viaduct/api/page.py
from flask.ext.login import current_user from viaduct.models.page import Page, PagePermission, PageRevision from viaduct import db from flask import request, url_for, render_template from viaduct.models.group import Group class PageAPI: @staticmethod def remove_page(path): page = Page.query.filter...
from flask.ext.login import current_user from viaduct.models.page import Page, PageRevision from viaduct import db from flask import render_template class PageAPI: @staticmethod def remove_page(path): page = Page.query.filter(Page.path == path).first() if not page: return False ...
Remove footer print and make file PEP8 compliant
Remove footer print and make file PEP8 compliant
Python
mit
viaict/viaduct,viaict/viaduct,viaict/viaduct,viaict/viaduct,viaict/viaduct
4b6756bd8305190a5d1dc1d2e8e9a0b94d5baa40
tests/test_grid.py
tests/test_grid.py
import pytest from aimaPy.grid import * compare = lambda x, y: all([elm_x == y[i] for i, elm_x in enumerate(x)]) def test_distance(): assert distance((1, 2), (5, 5)) == 5.0 def test_distance_squared(): assert distance_squared((1, 2), (5, 5)) == 25.0 def test_clip(): list_ = [clip(x, 0, 1) for x in [-...
import pytest from aimaPy.grid import * compare_list = lambda x, y: all([elm_x == y[i] for i, elm_x in enumerate(x)]) def test_distance(): assert distance((1, 2), (5, 5)) == 5.0 def test_distance_squared(): assert distance_squared((1, 2), (5, 5)) == 25.0 def test_clip(): list_ = [clip(x, 0, 1) for x ...
Change name of compare function in test grid
Change name of compare function in test grid
Python
mit
phaller0513/aima-python,AWPorter/aima-python,grantvk/aima-python,SeanCameronConklin/aima-python,SeanCameronConklin/aima-python,SnShine/aima-python,AWPorter/aima-python,chandlercr/aima-python,NolanBecker/aima-python,jottenlips/aima-python,WmHHooper/aima-python,grantvk/aima-python,AmberJBlue/aima-python,jottenlips/aima-p...
8c972ebd2a93a9516230185118941995a921b1c6
server/app/handlers.py
server/app/handlers.py
import os import aiohttp import json from aiohttp import web from .consts import KUDAGO_API_BASE_URL, CLIENT_DIR async def serve_api(request): url = '{}/{}/?{}'.format( KUDAGO_API_BASE_URL, request.match_info['path'], request.query_string, ) response = await aiohttp.get(url) b...
import os import aiohttp import json from aiohttp import web from .consts import KUDAGO_API_BASE_URL, CLIENT_DIR async def serve_api(request): url = '{}/{}/?{}'.format( KUDAGO_API_BASE_URL, request.match_info['path'], request.query_string, ) response = await aiohttp.get(url) b...
Add content type to API responses
Add content type to API responses It doesn’t make much of a difference, but it’s the nice thing to do
Python
mit
despawnerer/theatrics,despawnerer/theatrics,despawnerer/theatrics
48c227c263abc046f1b293ebc5864c229154cde4
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python import platform import sys NODE_VERSION = 'v0.11.13' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '197fe67fee1e4d867c76264065b2eb80b9dbd3a0' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[...
#!/usr/bin/env python import platform import sys NODE_VERSION = 'v0.11.13' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = 'bb664e4665851fe923ce904e620ba43d8d010ba5' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[...
Upgrade libchromium for the accelerator fix.
Upgrade libchromium for the accelerator fix.
Python
mit
trigrass2/electron,Rokt33r/electron,sky7sea/electron,Faiz7412/electron,pandoraui/electron,Ivshti/electron,vHanda/electron,bright-sparks/electron,baiwyc119/electron,fireball-x/atom-shell,mattotodd/electron,tincan24/electron,dkfiresky/electron,voidbridge/electron,bright-sparks/electron,brenca/electron,ianscrivener/electr...
0f0c3bb7b54c69bf121c11ea0d8e5a0b259bfb15
test/trainer_test.py
test/trainer_test.py
import theanets import util class TestTrainer(util.MNIST): def setUp(self): super(TestTrainer, self).setUp() self.exp = theanets.Experiment( theanets.Autoencoder, layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE)) def assert_progress(self, algo, **kwargs): trainer...
import theanets import util class TestTrainer(util.MNIST): def setUp(self): super(TestTrainer, self).setUp() self.exp = theanets.Experiment( theanets.Autoencoder, layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE)) def assert_progress(self, algo, **kwargs): trainer...
Exclude hf from tested trainers. :-/
Exclude hf from tested trainers. :-/
Python
mit
lmjohns3/theanets,chrinide/theanets,devdoer/theanets
d57bf8b0995496d8cabc81410154ab64a0673e01
databroker/sources/dummy_sources/_metadataStore/api/analysis.py
databroker/sources/dummy_sources/_metadataStore/api/analysis.py
headers = [] beamline_configs = [] event_descriptors = [] events = [] def find2(header_id=None, scan_id=None, owner=None, start_time=None, beamline_id=None, end_time=None): return {'headers': headers, 'beamline_configs': beamline_configs, 'event_descriptors': event_descriptors, 'events': eve...
from datetime import datetime as dt class DummyEventDescriptor(object): def __init__(self): self.keys = {'temp': {'source': 'PV:blah'}, 'picture': {'source': 'CCD:blah', 'external': 'FILESTORE!!!!'}} class DummyEvent(object): def __init__(self): ...
Update dummy MDS to use find and return a list of events.
Update dummy MDS to use find and return a list of events.
Python
bsd-3-clause
ericdill/databroker,NSLS-II/datamuxer,ericdill/datamuxer,NSLS-II/dataportal,NSLS-II/dataportal,ericdill/databroker,danielballan/datamuxer,danielballan/dataportal,danielballan/dataportal,tacaswell/dataportal,ericdill/datamuxer,tacaswell/dataportal,danielballan/datamuxer
32a592c82ab0b727c56084063d49039bb693a2b0
corehq/apps/reports/commtrack/util.py
corehq/apps/reports/commtrack/util.py
from corehq.apps.locations.models import all_locations from corehq.apps.commtrack.models import SupplyPointCase from corehq.apps.products.models import Product def supply_point_ids(locations): keys = [[loc.domain, loc._id] for loc in locations] rows = SupplyPointCase.get_db().view( 'commtrack/supply_p...
from corehq.apps.locations.models import SQLLocation from corehq.apps.commtrack.models import SupplyPointCase from corehq.apps.products.models import Product def supply_point_ids(locations): keys = [[loc.domain, loc._id] for loc in locations] rows = SupplyPointCase.get_db().view( 'commtrack/supply_poi...
Switch supply point id list lookup to SQL
Switch supply point id list lookup to SQL Locally with 1000 users this took the product_data method from 1.7 seconds to .2 seconds.
Python
bsd-3-clause
puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq
348b7a2df539779e95cb72d00e7577db6740424f
corker/tests/test_main.py
corker/tests/test_main.py
""" Inspired by: http://blog.ianbicking.org/2010/03/12/a-webob-app-example/ """ from __future__ import absolute_import from webob import Request, Response, exc from routes import Mapper from corker.controller import BaseController, route from corker.app import Application class Index(BaseController): @route('') ...
""" Inspired by: http://blog.ianbicking.org/2010/03/12/a-webob-app-example/ """ from __future__ import absolute_import from webob import Request, Response, exc from routes import Mapper from corker.controller import BaseController, route from corker.app import Application class Index(BaseController): @route('') ...
Add a test to demo config passing.
Add a test to demo config passing.
Python
bsd-2-clause
jd-boyd/corker,vs-networks/corker
f2193d7b9b88e85d8e6385d9e6778f1e70a03c3f
peas-demo/plugins/pythonhello/pythonhello.py
peas-demo/plugins/pythonhello/pythonhello.py
# -*- coding: utf-8 -*- # ex:set ts=4 et sw=4 ai: import gobject from gi.repository import Peas from gi.repository import Gtk LABEL_STRING="Python Says Hello!" class PythonHelloPlugin(gobject.GObject, Peas.Activatable): __gtype_name__ = 'PythonHelloPlugin' def do_activate(self, window): print "Pytho...
# -*- coding: utf-8 -*- # ex:set ts=4 et sw=4 ai: import gobject from gi.repository import Peas from gi.repository import Gtk LABEL_STRING="Python Says Hello!" class PythonHelloPlugin(gobject.GObject, Peas.Activatable): __gtype_name__ = 'PythonHelloPlugin' def do_activate(self, window): print "Pytho...
Fix the sample python plugin.
[Python] Fix the sample python plugin. PyGI doesn't handle default values for introspected methods, so we need to specify all the arguments for pack_start()
Python
lgpl-2.1
gregier/libpeas,gregier/libpeas,Distrotech/libpeas,Distrotech/libpeas,gregier/libpeas,GNOME/libpeas,chergert/libpeas,chergert/libpeas,GNOME/libpeas,Distrotech/libpeas,gregier/libpeas,chergert/libpeas
ccda4d9c3e737161e0477c569e074ffb884a541c
src/sentry/api/authentication.py
src/sentry/api/authentication.py
from __future__ import absolute_import from django.contrib.auth.models import AnonymousUser from django.utils.crypto import constant_time_compare from rest_framework.authentication import BasicAuthentication from rest_framework.exceptions import AuthenticationFailed from sentry.app import raven from sentry.models imp...
from __future__ import absolute_import from django.contrib.auth.models import AnonymousUser from django.utils.crypto import constant_time_compare from rest_framework.authentication import BasicAuthentication from rest_framework.exceptions import AuthenticationFailed from sentry.app import raven from sentry.models imp...
Raise hard error when API key is invalid
Raise hard error when API key is invalid
Python
bsd-3-clause
fotinakis/sentry,ifduyue/sentry,JamesMura/sentry,daevaorn/sentry,looker/sentry,gencer/sentry,JamesMura/sentry,fotinakis/sentry,fotinakis/sentry,gencer/sentry,zenefits/sentry,looker/sentry,jean/sentry,BuildingLink/sentry,mvaled/sentry,mvaled/sentry,mvaled/sentry,ifduyue/sentry,jean/sentry,nicholasserra/sentry,gencer/sen...
a7449b94b4171e86cd0b5260464949bc4ece7883
src/sentry/api/serializers/models/project.py
src/sentry/api/serializers/models/project.py
from __future__ import absolute_import from sentry.api.serializers import Serializer, register from sentry.models import OrganizationMemberType, Project, Team @register(Project) class ProjectSerializer(Serializer): def get_attrs(self, item_list, user): organization = item_list[0].team.organization ...
from __future__ import absolute_import from sentry.api.serializers import Serializer, register from sentry.models import OrganizationMemberType, Project, Team @register(Project) class ProjectSerializer(Serializer): def get_attrs(self, item_list, user): organization = item_list[0].team.organization ...
Add Project.first_event to API serializer
Add Project.first_event to API serializer
Python
bsd-3-clause
mvaled/sentry,fotinakis/sentry,JamesMura/sentry,mvaled/sentry,BuildingLink/sentry,imankulov/sentry,JackDanger/sentry,looker/sentry,zenefits/sentry,daevaorn/sentry,nicholasserra/sentry,looker/sentry,JamesMura/sentry,mitsuhiko/sentry,looker/sentry,nicholasserra/sentry,nicholasserra/sentry,BuildingLink/sentry,JackDanger/s...
d6f6d41665f58e68833b57d8b0d04d113f2c86a9
ideascube/conf/idb_jor_zaatari.py
ideascube/conf/idb_jor_zaatari.py
"""Ideaxbox for Zaatari, Jordan""" from .idb import * # noqa from django.utils.translation import ugettext_lazy as _ IDEASCUBE_PLACE_NAME = _("city") COUNTRIES_FIRST = ['SY', 'JO'] TIME_ZONE = 'Asia/Amman' LANGUAGE_CODE = 'ar' LOAN_DURATION = 14 MONITORING_ENTRY_EXPORT_FIELDS = ['serial', 'user_id', 'birth_year', 'ge...
"""Ideaxbox for Zaatari, Jordan""" from .idb_jor_azraq import * # noqa ENTRY_ACTIVITY_CHOICES = []
Make zaatari import from azraq
Make zaatari import from azraq
Python
agpl-3.0
ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube
60e7beefe0c20e2da232d83efac853ec6a9f40d9
l10n_it_pec/partner.py
l10n_it_pec/partner.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
Fix CamelCase on PEC module
[Fix] Fix CamelCase on PEC module
Python
agpl-3.0
luca-vercelli/l10n-italy,alessandrocamilli/l10n-italy,scigghia/l10n-italy,OpenCode/l10n-italy,odoo-isa/l10n-italy,hurrinico/l10n-italy,abstract-open-solutions/l10n-italy,maxhome1/l10n-italy,linkitspa/l10n-italy,linkitspa/l10n-italy,ApuliaSoftware/l10n-italy,andrea4ever/l10n-italy,linkitspa/l10n-italy,yvaucher/l10n-ital...
c5e370e2c226897c3a9863749f259a3735d2989a
apps/users/admin.py
apps/users/admin.py
from django.contrib import admin from users.models import UserBan class UserBanAdmin(admin.ModelAdmin): fields = ('user', 'by', 'reason', 'is_active') list_display = ('user', 'by', 'reason') list_filter = ('is_active',) raw_id_fields = ('user',) search_fields = ('user__username', 'reason') admi...
from django.contrib import admin from users.models import UserBan class UserBanAdmin(admin.ModelAdmin): fields = ('user', 'by', 'reason', 'is_active') list_display = ('user', 'by', 'reason') list_filter = ('is_active', 'by') raw_id_fields = ('user', 'by') search_fields = ('user__username', 'reaso...
Add some more use of raw_id_fields for user bans, and more filter options.
Add some more use of raw_id_fields for user bans, and more filter options.
Python
mpl-2.0
surajssd/kuma,davidyezsetz/kuma,anaran/kuma,FrankBian/kuma,surajssd/kuma,a2sheppy/kuma,whip112/Whip112,darkwing/kuma,robhudson/kuma,bluemini/kuma,FrankBian/kuma,FrankBian/kuma,jgmize/kuma,chirilo/kuma,surajssd/kuma,darkwing/kuma,chirilo/kuma,yfdyh000/kuma,hoosteeno/kuma,openjck/kuma,utkbansal/kuma,varunkamra/kuma,anara...
79fc87489595eebbc6c9f40d9d79a74af4e7494d
scripts/testdynamic.py
scripts/testdynamic.py
#!/usr/bin/env python # -*- coding: utf-8 import Ice, IcePy, sys, tempfile ice = Ice.initialize(sys.argv) proxy = ice.stringToProxy('Meta:tcp -h 127.0.0.1 -p 6502') slice = IcePy.Operation('getSlice', Ice.OperationMode.Idempotent, Ice.OperationMode.Idempotent, True, (), (), (), IcePy._t_string, ()).invoke(proxy, (()...
#!/usr/bin/env python # -*- coding: utf-8 import Ice, IcePy, sys, tempfile ice = Ice.initialize(sys.argv) proxy = ice.stringToProxy('Meta:tcp -h 127.0.0.1 -p 6502') try: slice = IcePy.Operation('getSlice', Ice.OperationMode.Idempotent, Ice.OperationMode.Idempotent, True, (), (), (), IcePy._t_string, ()).invoke(pr...
Expand dynamic slice-fetch example to show fallback
Expand dynamic slice-fetch example to show fallback
Python
bsd-3-clause
mkrautz/mumble-sbcelt,austinliou/mumble,unascribed/mumble,LuAPi/mumble,Githlar/mumble,chiefdome/mumble-code,panaschieren/mumble-test,ccpgames/mumble,unascribed/mumble,Zopieux/mumble,SuperNascher/mumble,Zopieux/mumble,Lartza/mumble,feld/mumble,feld/mumble,arrai/mumble-record,Lartza/mumble,unascribed/mumble,ccpgames/mumb...
9c7ec15d6347d915cd0285927ed651d4ae6508c1
amen/time.py
amen/time.py
#!/usr/bin/env python import six import numpy as np import pandas as pd class TimeSlice(object): """ A slice of time: has a start time, a duration, and a reference to an Audio object. """ def __init__(self, time, duration, audio, unit='s'): self.time = pd.to_timedelta(time, unit=unit) ...
#!/usr/bin/env python import six import numpy as np import pandas as pd class TimeSlice(object): """ A slice of time: has a start time, a duration, and a reference to an Audio object. """ def __init__(self, time, duration, audio, unit='s'): self.time = pd.to_timedelta(time, unit=unit) ...
Fix formatting bug in repr
Fix formatting bug in repr
Python
bsd-2-clause
algorithmic-music-exploration/amen,algorithmic-music-exploration/amen
7700aad28e7bd0053e3e8dba823b446822e2be73
conftest.py
conftest.py
from django.conf import settings import base64 import os import os.path def pytest_configure(config): if not settings.configured: os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server' test_db = os.environ.get('DB', 'sqlite') if test_db == 'mysql': settings.DATABASES['default'].updat...
from django.conf import settings import base64 import os import os.path def pytest_configure(config): if not settings.configured: os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server' test_db = os.environ.get('DB', 'sqlite') if test_db == 'mysql': settings.DATABASES['default'].updat...
Disable compressor in test suite (compressor makes the test suite run 50% slower)
Disable compressor in test suite (compressor makes the test suite run 50% slower)
Python
bsd-3-clause
mitsuhiko/sentry,JamesMura/sentry,JTCunning/sentry,imankulov/sentry,gencer/sentry,fotinakis/sentry,ewdurbin/sentry,JamesMura/sentry,Natim/sentry,beni55/sentry,jean/sentry,hongliang5623/sentry,kevinlondon/sentry,nicholasserra/sentry,zenefits/sentry,BuildingLink/sentry,argonemyth/sentry,drcapulet/sentry,boneyao/sentry,Si...
00ae10769d95445b80be0e8d129fbc76b63aca5a
flexget/utils/soup.py
flexget/utils/soup.py
import html5lib from html5lib import treebuilders from cStringIO import StringIO def get_soup(obj): if isinstance(obj, basestring): obj = StringIO(obj) parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder('beautifulsoup')) return parser.parse(obj)
import html5lib from html5lib import treebuilders from cStringIO import StringIO # Hack, hide DataLossWarnings # Based on html5lib code namespaceHTMLElements=False should do it, but nope ... import warnings from html5lib.constants import DataLossWarning warnings.simplefilter('ignore', DataLossWarning) def get_soup(o...
Hide DataLossWarnings that appeared with html5lib 0.90 or so.
Hide DataLossWarnings that appeared with html5lib 0.90 or so. git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1124 3942dd89-8c5d-46d7-aeed-044bccf3e60c
Python
mit
qk4l/Flexget,sean797/Flexget,ZefQ/Flexget,qk4l/Flexget,tobinjt/Flexget,grrr2/Flexget,jacobmetrick/Flexget,oxc/Flexget,camon/Flexget,crawln45/Flexget,xfouloux/Flexget,thalamus/Flexget,JorisDeRieck/Flexget,vfrc2/Flexget,patsissons/Flexget,cvium/Flexget,ianstalk/Flexget,tvcsantos/Flexget,jawilson/Flexget,OmgOhnoes/Flexget...
106fc0f8bae7c776a8f6c7dcec2947420492d118
homographynet/callbacks.py
homographynet/callbacks.py
#!/usr/bin/env python from keras.callbacks import Callback import keras.backend as K class LearningRateScheduler(Callback): """Learning rate scheduler. See Caffe SGD docs """ def __init__(self, base_lr, gamma, step_size): super().__init__() self._lr = base_lr self._gamma = g...
#!/usr/bin/env python from keras.callbacks import Callback import keras.backend as K class LearningRateScheduler(Callback): """Learning rate scheduler. See Caffe SGD docs """ def __init__(self, base_lr, gamma, step_size): super().__init__() self._base_lr = base_lr self._gamm...
Fix calculation of current steps when starting with epoch != 0
Fix calculation of current steps when starting with epoch != 0
Python
apache-2.0
baudm/HomographyNet
431f14a19549d9d22fe35e87403695d68eb7f906
distarray/__init__.py
distarray/__init__.py
# encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc. # Distributed under the terms of the BSD License. See COPYING.rst. # --------------------------------------------------------------------------- fro...
# encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc. # Distributed under the terms of the BSD License. See COPYING.rst. # --------------------------------------------------------------------------- """...
Add a package-level DistArray docstring.
Add a package-level DistArray docstring.
Python
bsd-3-clause
enthought/distarray,RaoUmer/distarray,RaoUmer/distarray,enthought/distarray
bff010be0ee1a8e512486777c47228449a766cd3
webhooks/admin.py
webhooks/admin.py
from django.contrib import admin from .models import Webhook admin.site.register(Webhook)
from django.contrib import admin from .models import Webhook class WebhookAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'event', 'url') list_editable = ('event', 'url') list_filter = ('event',) admin.site.register(Webhook, WebhookAdmin)
Add custom ModelAdmin for easier editing from list view
Add custom ModelAdmin for easier editing from list view
Python
bsd-2-clause
chop-dbhi/django-webhooks,pombredanne/django-webhooks,chop-dbhi/django-webhooks,pombredanne/django-webhooks
ebb5a2f56c691456b5b65b9448d11b113c4efa46
fedmsg/meta/announce.py
fedmsg/meta/announce.py
# This file is part of fedmsg. # Copyright (C) 2012 Red Hat, Inc. # # fedmsg is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. #...
# This file is part of fedmsg. # Copyright (C) 2012 Red Hat, Inc. # # fedmsg is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. #...
Handle the situation where in old message the 'username' key does not exists
Handle the situation where in old message the 'username' key does not exists With this commit processing an old message with fedmsg_meta will not break if that old message does not have the 'username' key.
Python
lgpl-2.1
chaiku/fedmsg,vivekanand1101/fedmsg,vivekanand1101/fedmsg,cicku/fedmsg,mathstuf/fedmsg,mathstuf/fedmsg,maxamillion/fedmsg,mathstuf/fedmsg,chaiku/fedmsg,fedora-infra/fedmsg,fedora-infra/fedmsg,pombredanne/fedmsg,pombredanne/fedmsg,cicku/fedmsg,maxamillion/fedmsg,chaiku/fedmsg,vivekanand1101/fedmsg,pombredanne/fedmsg,cic...
99be8919a0bc274dc311ebe3201dfc490a1d0d07
setup.py
setup.py
import os from distutils.core import setup, find_packages # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(os.p...
import os from distutils.core import setup # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(os.path.join(os.pat...
Remove find_packages import, it's not in distutils
Remove find_packages import, it's not in distutils
Python
bsd-2-clause
blaze/datashape,cowlicks/datashape,ContinuumIO/datashape,cpcloud/datashape,aterrel/datashape,quantopian/datashape,FrancescAlted/datashape,quantopian/datashape,aterrel/datashape,cowlicks/datashape,markflorisson/datashape,ContinuumIO/datashape,cpcloud/datashape,blaze/datashape,llllllllll/datashape,markflorisson/datashape...
aa985e9a686c4f333f64f6f39759f1cd0cc0f8c2
oscar/apps/offer/managers.py
oscar/apps/offer/managers.py
from django.utils.timezone import now from django.db import models class ActiveOfferManager(models.Manager): """ For searching/creating offers within their date range """ def get_query_set(self): cutoff = now() return super(ActiveOfferManager, self).get_query_set().filter( ...
from django.utils.timezone import now from django.db import models class ActiveOfferManager(models.Manager): """ For searching/creating offers within their date range """ def get_query_set(self): cutoff = now() return super(ActiveOfferManager, self).get_query_set().filter( ...
Fix bug with date filtering of offers
Fix bug with date filtering of offers Offers with no end date were not being picked up.
Python
bsd-3-clause
kapt/django-oscar,itbabu/django-oscar,eddiep1101/django-oscar,dongguangming/django-oscar,manevant/django-oscar,ahmetdaglarbas/e-commerce,DrOctogon/unwash_ecom,anentropic/django-oscar,mexeniz/django-oscar,binarydud/django-oscar,taedori81/django-oscar,jinnykoo/wuyisj,WillisXChen/django-oscar,QLGu/django-oscar,itbabu/djan...
3f7b1ceb95b0f918f03d08e9b796c88d85764280
logicaldelete/managers.py
logicaldelete/managers.py
from django.db import models from logicaldelete.query import LogicalDeleteQuerySet class LogicalDeletedManager(models.Manager): """ A manager that serves as the default manager for `logicaldelete.models.Model` providing the filtering out of logically deleted objects. In addition, it provides named q...
from django.db import models from logicaldelete.query import LogicalDeleteQuerySet class LogicalDeletedManager(models.Manager): """ A manager that serves as the default manager for `logicaldelete.models.Model` providing the filtering out of logically deleted objects. In addition, it provides named q...
Use get_queryset instead of get_query_set
Use get_queryset instead of get_query_set Starting in Django 1.8, get_query_set will now be get_queryset. This change was announced as part of the Django 1.6 release and now in Django 1.7 throws a RemovedInDjango18Warning. See: https://docs.djangoproject.com/en/1.7/releases/1.6/#get-query-set-and-similar-methods-rena...
Python
mit
pinax/pinax-models,naringas/pinax-models,Ubiwhere/pinax-models
05648421c1fa77f6f339f68be2c43bb7952e918a
pymatgen/__init__.py
pymatgen/__init__.py
__author__ = ", ".join(["Shyue Ping Ong", "Anubhav Jain", "Geoffroy Hautier", "William Davidson Richard", "Stephen Dacek", "Sai Jayaraman", "Michael Kocher", "Dan Gunter", "Shreyas Cholia", "Vincent L Chevrier", "Rickard Arm...
__author__ = ", ".join(["Shyue Ping Ong", "Anubhav Jain", "Geoffroy Hautier", "William Davidson Richard", "Stephen Dacek", "Sai Jayaraman", "Michael Kocher", "Dan Gunter", "Shreyas Cholia", "Vincent L Chevrier", "Rickard Arm...
Remove zopen in pymatgen root.
Remove zopen in pymatgen root.
Python
mit
sonium0/pymatgen,rousseab/pymatgen,rousseab/pymatgen,yanikou19/pymatgen,Bismarrck/pymatgen,ctoher/pymatgen,yanikou19/pymatgen,yanikou19/pymatgen,Bismarrck/pymatgen,Bismarrck/pymatgen,migueldiascosta/pymatgen,sonium0/pymatgen,ctoher/pymatgen,Dioptas/pymatgen,sonium0/pymatgen,migueldiascosta/pymatgen,Bismarrck/pymatgen,B...
72f484c35a79d7be6dc04e7ac108b05652bc1f36
readthedocs/core/tasks.py
readthedocs/core/tasks.py
"""Basic tasks""" import logging from celery import task from django.conf import settings from django.core.mail import EmailMultiAlternatives from django.template.loader import get_template log = logging.getLogger(__name__) @task(queue='web') def send_email_task(recipient, subject, template, template_html, contex...
"""Basic tasks""" import logging from celery import task from django.conf import settings from django.core.mail import EmailMultiAlternatives from django.template.loader import get_template log = logging.getLogger(__name__) EMAIL_TIME_LIMIT = 30 @task(queue='web', time_limit=EMAIL_TIME_LIMIT) def send_email_task...
Add timeout to email task
Add timeout to email task Email task needs a timeout, as there were some cases where celery caused the task to hang.
Python
mit
safwanrahman/readthedocs.org,pombredanne/readthedocs.org,rtfd/readthedocs.org,pombredanne/readthedocs.org,tddv/readthedocs.org,safwanrahman/readthedocs.org,tddv/readthedocs.org,davidfischer/readthedocs.org,davidfischer/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,pombredanne/readthedocs.org,davidfischer/re...
8eeaa69574ee723a4e3d435140814c5776e97055
trunk/metpy/bl/sim/mos.py
trunk/metpy/bl/sim/mos.py
#!/usr/bin/python import numpy as N def u_star(u,v,w): ''' Compute the friction velocity, u_star, from the timeseries of the velocity \ components u, v, and w (an nD array) ''' from metpy.bl.turb.fluxes import rs as R rs = R(u,v,w) uw = rs[3] vw = rs[4] us = N.power(N.power(uw,2)+N.power(v...
#!/usr/bin/python import numpy as N def u_star(u,v,w): ''' Compute the friction velocity, u_star, from the timeseries of the velocity \ components u, v, and w (an nD array) ''' from metpy.bl.turb.fluxes import rs as R rs = R(u,v,w) uw = rs[3] vw = rs[4] us = N.power(N.power(uw,2)+N.power(v...
Change to import gravity constant from constants file.
Change to import gravity constant from constants file. git-svn-id: acf0ef94bfce630b1a882387fc03ab8593ec6522@23 150532fb-1d5b-0410-a8ab-efec50f980d4
Python
bsd-3-clause
Unidata/MetPy,dopplershift/MetPy,jrleeman/MetPy,ahaberlie/MetPy,ShawnMurd/MetPy,Unidata/MetPy,ahaberlie/MetPy,deeplycloudy/MetPy,jrleeman/MetPy,ahill818/MetPy,dopplershift/MetPy
41b27191becb90d452bbf210821f7f94eb8870f2
taskwiki/cache.py
taskwiki/cache.py
import copy import vim from taskwiki.task import VimwikiTask class TaskCache(object): """ A cache that holds all the tasks in the given file and prevents multiple redundant taskwarrior calls. """ def __init__(self, tw): self.uuid_cache = dict() self.cache = dict() self.tw...
import copy import vim from taskwiki.task import VimwikiTask class TaskCache(object): """ A cache that holds all the tasks in the given file and prevents multiple redundant taskwarrior calls. """ def __init__(self, tw): self.uuid_cache = dict() self.cache = dict() self.tw...
Add initial implementation of the bulk updates
Cache: Add initial implementation of the bulk updates
Python
mit
Spirotot/taskwiki,phha/taskwiki
6ee8ee2467d9c61b03a268a6b8d8ea9bc3cfe9e0
Lib/defcon/tools/fuzzyNumber.py
Lib/defcon/tools/fuzzyNumber.py
class FuzzyNumber(object): def __init__(self, value, threshold): self.value = value self.threshold = threshold def __repr__(self): return '[%d %d]' % (self.value, self.threshold) def __cmp__(self, other): if abs(self.value - other.value) < self.threshold: retur...
class FuzzyNumber(object): def __init__(self, value, threshold): self.value = value self.threshold = threshold def __repr__(self): return "[%f %f]" % (self.value, self.threshold) def __cmp__(self, other): if hasattr(other, "value"): if abs(self.value - other.va...
Allow for comparing to objects other than FuzzyNumber objects.
Allow for comparing to objects other than FuzzyNumber objects.
Python
mit
anthrotype/defcon,moyogo/defcon,typemytype/defcon,typesupply/defcon,adrientetar/defcon
f12bf6096e607e090da7c4e80be2bed3afb5ff5a
crmapp/contacts/urls.py
crmapp/contacts/urls.py
from django.conf.urls import patterns, url contact_urls = patterns('', url(r'^$', 'crmapp.contacts.views.contact_detail', name="contact_detail"), )
from django.conf.urls import patterns, url contact_urls = patterns('', url(r'^$', 'crmapp.contacts.views.contact_detail', name="contact_detail"), url(r'^edit/$', 'crmapp.contacts.views.contact_cru', name='contact_update' ), )
Create the Contacts App - Part II > Edit Contact - Create URL
Create the Contacts App - Part II > Edit Contact - Create URL
Python
mit
tabdon/crmeasyapp,tabdon/crmeasyapp,deenaariff/Django
4f754ad3177eb0fcdc10ccf7804349a9453e9ff0
asyncio/__init__.py
asyncio/__init__.py
"""The asyncio package, tracking PEP 3156.""" import sys # The selectors module is in the stdlib in Python 3.4 but not in 3.3. # Do this first, so the other submodules can use "from . import selectors". # Prefer asyncio/selectors.py over the stdlib one, as ours may be newer. try: from . import selectors except Im...
"""The asyncio package, tracking PEP 3156.""" import sys # The selectors module is in the stdlib in Python 3.4 but not in 3.3. # Do this first, so the other submodules can use "from . import selectors". # Prefer asyncio/selectors.py over the stdlib one, as ours may be newer. try: from . import selectors except Im...
Fix asyncio.__all__: export also unix_events and windows_events symbols
Fix asyncio.__all__: export also unix_events and windows_events symbols For example, on Windows, it was not possible to get ProactorEventLoop or DefaultEventLoopPolicy using "from asyncio import *".
Python
apache-2.0
vxgmichel/asyncio,gvanrossum/asyncio,manipopopo/asyncio,jashandeep-sohi/asyncio,Martiusweb/asyncio,ajdavis/asyncio,Martiusweb/asyncio,jashandeep-sohi/asyncio,1st1/asyncio,haypo/trollius,fallen/asyncio,vxgmichel/asyncio,gvanrossum/asyncio,Martiusweb/asyncio,jashandeep-sohi/asyncio,fallen/asyncio,haypo/trollius,haypo/tro...
dd6287903ccddf24edf600e3d30fba61efd9478f
distarray/core/tests/test_distributed_array_protocol.py
distarray/core/tests/test_distributed_array_protocol.py
import unittest import distarray as da from distarray.mpi.mpibase import create_comm_of_size, InvalidCommSizeError class TestDistributedArrayProtocol(unittest.TestCase): def setUp(self): try: comm = create_comm_of_size(4) except InvalidCommSizeError: raise unittest.SkipTes...
import unittest import distarray as da from distarray.mpi.mpibase import create_comm_of_size, InvalidCommSizeError class TestDistributedArrayProtocol(unittest.TestCase): def setUp(self): try: comm = create_comm_of_size(4) except InvalidCommSizeError: raise unittest.SkipTes...
Modify round-trip test to use new function name.
Modify round-trip test to use new function name. We've temporarily settled on `fromdap()` for importing from `__distarray__` interfaces.
Python
bsd-3-clause
RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray
da59e27fe4176e23ec305f9a7143b288521db6ef
src/ggrc/converters/handlers/request.py
src/ggrc/converters/handlers/request.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """Handlers for request specific columns.""" from ggrc.converters.handlers impo...
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """Handlers for request specific columns.""" from ggrc.converters.handlers impo...
Update Request object import to use statusable attributes
Update Request object import to use statusable attributes
Python
apache-2.0
kr41/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc...
609e0b76680156584bb1e06aa10a5425c55f8c01
wagtail/utils/widgets.py
wagtail/utils/widgets.py
from django.forms.widgets import Widget from django.utils.safestring import mark_safe class WidgetWithScript(Widget): def render(self, name, value, attrs=None): widget = super(WidgetWithScript, self).render(name, value, attrs) final_attrs = self.build_attrs(attrs, name=name) id_ = final_a...
from __future__ import absolute_import, unicode_literals from django.forms.widgets import Widget from django.utils.safestring import mark_safe class WidgetWithScript(Widget): def render(self, name, value, attrs=None): widget = super(WidgetWithScript, self).render(name, value, attrs) final_attrs ...
Fix unicode error caused by ascii format string
Fix unicode error caused by ascii format string
Python
bsd-3-clause
JoshBarr/wagtail,zerolab/wagtail,benjaoming/wagtail,takeshineshiro/wagtail,jordij/wagtail,iho/wagtail,chrxr/wagtail,iansprice/wagtail,mayapurmedia/wagtail,janusnic/wagtail,jordij/wagtail,kurtw/wagtail,jordij/wagtail,Klaudit/wagtail,jnns/wagtail,bjesus/wagtail,JoshBarr/wagtail,mikedingjan/wagtail,darith27/wagtail,takefl...
85f179a4d515801c4cfcb35e198efe268959d0ba
test/trainer_test.py
test/trainer_test.py
import theanets import util class TestTrainer(util.MNIST): def setUp(self): super(TestTrainer, self).setUp() self.exp = theanets.Experiment( theanets.Autoencoder, layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE)) def assert_progress(self, algo, **kwargs): trainer...
import theanets import util class TestTrainer(util.MNIST): def setUp(self): super(TestTrainer, self).setUp() self.exp = theanets.Experiment( theanets.Autoencoder, layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE)) def assert_progress(self, algo, **kwargs): trainer...
Test 1st training loss improves over 0th validation.
Test 1st training loss improves over 0th validation.
Python
mit
devdoer/theanets,chrinide/theanets,lmjohns3/theanets
451a0773da3aafc525e60e2a222fd4d1613589f6
tests/test_splits.py
tests/test_splits.py
from tests.base import IntegrationTest class TestBurndown(IntegrationTest): def execute(self): self.command("TaskWikiBurndownDaily") assert self.command(":py print vim.current.buffer", silent=False).startswith("<buffer burndown.daily") assert "Daily Burndown" in self.read_buffer()[0]
import re from tests.base import IntegrationTest from tasklib.task import local_zone from datetime import datetime class TestBurndownDailySimple(IntegrationTest): def execute(self): self.command("TaskWikiBurndownDaily") assert self.command(":py print vim.current.buffer", silent=False).startswith...
Add simple tests for burndown, calendar and ghistory commands
tests: Add simple tests for burndown, calendar and ghistory commands
Python
mit
Spirotot/taskwiki,phha/taskwiki
035fa5877a05bb70b8207693c547c97cfd104db3
libqtile/widget/textbox.py
libqtile/widget/textbox.py
from .. import bar, manager import base class TextBox(base._TextBox): """ A flexible textbox that can be updated from bound keys, scripts and qsh. """ defaults = manager.Defaults( ("font", "Arial", "Text font"), ("fontsize", None, "Font pixel size. Calculated if None."), ...
from .. import bar, manager import base class TextBox(base._TextBox): """ A flexible textbox that can be updated from bound keys, scripts and qsh. """ defaults = manager.Defaults( ("font", "Arial", "Text font"), ("fontsize", None, "Font pixel size. Calculated if None."), ...
Remove positional argument "name" from Textbox
Remove positional argument "name" from Textbox Users should just use the kwarg name; no sense in having both. Closes #239
Python
mit
andrewyoung1991/qtile,StephenBarnes/qtile,de-vri-es/qtile,tych0/qtile,apinsard/qtile,nxnfufunezn/qtile,soulchainer/qtile,encukou/qtile,ramnes/qtile,jdowner/qtile,jdowner/qtile,soulchainer/qtile,de-vri-es/qtile,kopchik/qtile,tych0/qtile,qtile/qtile,kiniou/qtile,kynikos/qtile,kiniou/qtile,EndPointCorp/qtile,himaaaatti/qt...
5ac8e4619473275f2f0b26b8a9b64049d793a4ed
rmqid/__init__.py
rmqid/__init__.py
__version__ = '0.3.0' from rmqid.connection import Connection from rmqid.exchange import Exchange from rmqid.message import Message from rmqid.queue import Queue from rmqid.tx import Tx from rmqid.simple import consumer from rmqid.simple import get from rmqid.simple import publish
__version__ = '0.3.0' from rmqid.connection import Connection from rmqid.exchange import Exchange from rmqid.message import Message from rmqid.queue import Queue from rmqid.tx import Tx from rmqid.simple import consumer from rmqid.simple import get from rmqid.simple import publish import logging try: from loggi...
Add a NullHandler so logging warnings are not emitted if no logger is setup
Add a NullHandler so logging warnings are not emitted if no logger is setup
Python
bsd-3-clause
jonahbull/rabbitpy,gmr/rabbitpy,gmr/rabbitpy
3a06f01a9440b05b87bebc33d1342cd71fbeefbb
samples/admin.py
samples/admin.py
from django.contrib import admin from .models import Patient, PatientRegister, FluVaccine, Sample, CollectionType class FluVaccineInline(admin.StackedInline): model = FluVaccine extra = 1 class SampleInline(admin.StackedInline): model = Sample extra = 1 class PatientRegisterAdmin(admin.ModelAdmin)...
from django.contrib import admin from .models import ( Patient, PatientRegister, FluVaccine, Sample, CollectionType, Symptom, ObservedSymptom ) class FluVaccineInline(admin.StackedInline): model = FluVaccine extra = 1 class SampleInline(admin.StackedInline): model = Sample extra = 1 ...
Add Symptoms and ObservedSymptoms to Admin
:rocket: Add Symptoms and ObservedSymptoms to Admin
Python
mit
gems-uff/labsys,gems-uff/labsys,gcrsaldanha/fiocruz,gcrsaldanha/fiocruz,gems-uff/labsys
740ea36f7a06989f872150afa91472e3e2c34a03
CTFd/utils/security/auth.py
CTFd/utils/security/auth.py
import datetime import os from flask import session from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException from CTFd.models import UserTokens, db from CTFd.utils.encoding import hexencode from CTFd.utils.security.csrf import generate_nonce def login_user(user): session["id"] = user.id ...
import datetime import os from flask import session from CTFd.exceptions import UserNotFoundException, UserTokenExpiredException from CTFd.models import UserTokens, db from CTFd.utils.encoding import hexencode from CTFd.utils.security.csrf import generate_nonce def login_user(user): session["id"] = user.id ...
Fix tokens using too-random of a value
Fix tokens using too-random of a value
Python
apache-2.0
isislab/CTFd,CTFd/CTFd,isislab/CTFd,CTFd/CTFd,ajvpot/CTFd,isislab/CTFd,LosFuzzys/CTFd,ajvpot/CTFd,LosFuzzys/CTFd,CTFd/CTFd,ajvpot/CTFd,LosFuzzys/CTFd,isislab/CTFd,ajvpot/CTFd,LosFuzzys/CTFd,CTFd/CTFd
c2dd4d666e5d68a387ea48cabb99006d778b6d56
rng.py
rng.py
def get_random_number(start=1, end=10): """https://xkcd.com/221/""" return 4
from random import randint def get_random_number(start=1, end=10): """Generates and returns random number between :start: and :end:""" return randint(start, end)
Fix python random number generator.
Fix python random number generator.
Python
mit
1yvT0s/illacceptanything,illacceptanything/illacceptanything,paladique/illacceptanything,ultranaut/illacceptanything,tjhorner/illacceptanything,1yvT0s/illacceptanything,dushmis/illacceptanything,tjhorner/illacceptanything,caioproiete/illacceptanything,triggerNZ/illacceptanything,illacceptanything/illacceptanything,caio...
74ac965c451f29faa344be0161ebb419395faa6e
entities/context_processors.py
entities/context_processors.py
from . import models from django.conf import settings def groups(request): return { 'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(), 'all_sidebar_groups': models.Group.objects.scored().order_by('-score'), } def statistics(request): return { ...
from . import models from django.conf import settings from django.contrib.auth import hashers def groups(request): return { 'about_group': models.Group.objects.filter(id=settings.ABOUT_GROUP_ID).first(), 'all_sidebar_groups': models.Group.objects.scored().order_by('-score'), } ...
Exclude unusable users from stats
Exclude unusable users from stats
Python
agpl-3.0
stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten
0f20599968b2ab848f8e3fde912f8d0ecdfba509
asyncio_irc/connection.py
asyncio_irc/connection.py
import asyncio from .message import Message class Connection: """ Communicates with an IRC network. Incoming data is transformed into Message objects, and sent to `listeners`. """ def __init__(self, *, listeners, host, port, ssl=True): self.listeners = listeners self.host = host...
import asyncio from .message import Message class Connection: """ Communicates with an IRC network. Incoming data is transformed into Message objects, and sent to `listeners`. """ def __init__(self, *, listeners, host, port, ssl=True): self.listeners = listeners self.host = host...
Allow Connection.send to take unicode message
Allow Connection.send to take unicode message
Python
bsd-2-clause
meshy/framewirc
adb6ce275e1cbc2d000286e169a4a96b25b32dbb
test_doc.py
test_doc.py
#!/usr/bin/env python import doctest import sys if hasattr(doctest, "testfile"): print("=== Test file: README ===") failure, tests = doctest.testfile('README', optionflags=doctest.ELLIPSIS) if failure: sys.exit(1) print("=== Test file: test.rst ===") failure, tests = doctest.testfile('test/...
#!/usr/bin/env python import doctest import sys if hasattr(doctest, "testfile"): total_failures, total_tests = (0, 0) print("=== Test file: README ===") failure, tests = doctest.testfile('README', optionflags=doctest.ELLIPSIS) total_failures += failure total_tests += tests print("=== Test file...
Allow doctest runner to keep going after failures
Allow doctest runner to keep going after failures It will still return an error code, but there is little need to halt the running of the three different doctest modules if an early one fails, which may in fact mask the real reason for failure in an IPy internal method. Signed-off-by: Dan McGee <a6e5737275ff1276377ee...
Python
bsd-3-clause
dstam/python-ipy,sigma-random/python-ipy
5d705221e6e6e1d32c90bd8a6e7ee940008d91e9
examples/chatserver/views.py
examples/chatserver/views.py
# -*- coding: utf-8 -*- from django.contrib.auth.models import User from django.http import HttpResponse from django.views.generic.base import TemplateView from django.views.decorators.csrf import csrf_exempt import redis from ws4redis import settings as redis_settings class BaseTemplateView(TemplateView): def __...
# -*- coding: utf-8 -*- from django.contrib.auth.models import User from django.http import HttpResponse from django.views.generic.base import TemplateView from django.views.decorators.csrf import csrf_exempt import redis from ws4redis import settings as redis_settings class BaseTemplateView(TemplateView): def __...
Use META.SERVER_NAME in template view. …
Use META.SERVER_NAME in template view. …
Python
mit
yacneyac/django-websocket-redis,0nkery/django-websocket-redis3,yacneyac/django-websocket-redis,jgroszko/django-websocket-redis,0nkery/django-websocket-redis3,jgroszko/django-websocket-redis,malefice/django-websocket-redis,Frky/django-websocket-redis,Frky/django-websocket-redis,jrief/django-websocket-redis,malefice/djan...
4a4cb336839d42cee872e52399e17249b948492a
rackattack/common/globallock.py
rackattack/common/globallock.py
import threading import contextlib import time import traceback import logging _lock = threading.Lock() @contextlib.contextmanager def lock(): before = time.time() with _lock: acquired = time.time() took = acquired - before if took > 0.1: logging.error( "A...
import threading import contextlib import time import traceback import logging _lock = threading.Lock() def prettyStack(): return "\n".join([line.strip() for line in traceback.format_stack()]) @contextlib.contextmanager def lock(): before = time.time() with _lock: acquired = time.time() ...
Print the stack info more clearly, when holding the global lock for too long
Print the stack info more clearly, when holding the global lock for too long
Python
apache-2.0
Stratoscale/rackattack-virtual,eliran-stratoscale/rackattack-virtual,Stratoscale/rackattack-virtual,eliran-stratoscale/rackattack-virtual
77e489734f0206ba454c7b855615451b7cf021e1
djangae/blobstore_service.py
djangae/blobstore_service.py
import os import threading import logging blobstore_service = None server = None def start_blobstore_service(): """ When the blobstore files API was deprecated, the blobstore storage was switched to use a POST request to the upload handler when storing files uploaded via Django. Unfortu...
import os import threading import logging blobstore_service = None server = None def start_blobstore_service(): """ When the blobstore files API was deprecated, the blobstore storage was switched to use a POST request to the upload handler when storing files uploaded via Django. Unfortu...
Make the blobstore service wsgi handler only serve our upload handler view
Make the blobstore service wsgi handler only serve our upload handler view
Python
bsd-3-clause
potatolondon/djangae,leekchan/djangae,armirusco/djangae,armirusco/djangae,chargrizzle/djangae,chargrizzle/djangae,asendecka/djangae,jscissr/djangae,grzes/djangae,jscissr/djangae,kirberich/djangae,trik/djangae,chargrizzle/djangae,wangjun/djangae,wangjun/djangae,asendecka/djangae,asendecka/djangae,kirberich/djangae,SiPig...
533b4c090547389054934ea88388512399b568c9
filter_plugins/custom_plugins.py
filter_plugins/custom_plugins.py
# # Usage: {{ foo | vault }} # def vault(encrypted, env): method = """ from keyczar import keyczar import os.path import sys keydir = '.vault' if not os.path.isdir(keydir): keydir = os.path.expanduser('~/.decrypted_openconext_keystore_{env}') crypter = keyczar.Crypter.Read(keydir) sys.stdout.write(crypter.Decrypt(...
# # Usage: {{ foo | vault }} # def vault(encrypted, env): method = """ from keyczar import keyczar import os.path import sys keydir = '.vault' if not os.path.isdir(keydir): keydir = os.path.expanduser('~/.decrypted_openconext_keystore_{env}') crypter = keyczar.Crypter.Read(keydir) sys.stdout.write(crypter.Decrypt(...
Use simpler invocation that actually fails. Leave it to @thijskh to use Popen-type of invocation
Use simpler invocation that actually fails. Leave it to @thijskh to use Popen-type of invocation
Python
apache-2.0
baszoetekouw/OpenConext-deploy,remold/OpenConext-deploy,OpenConext/OpenConext-deploy,baszoetekouw/OpenConext-deploy,baszoetekouw/OpenConext-deploy,OpenConext/OpenConext-deploy,OpenConext/OpenConext-deploy,remold/OpenConext-deploy,remold/OpenConext-deploy,baszoetekouw/OpenConext-deploy,OpenConext/OpenConext-deploy,baszo...
25494622a88f172fb14abf10eb5936246d475066
other/wrapping-cpp/swig/cpointerproblem/test_examples.py
other/wrapping-cpp/swig/cpointerproblem/test_examples.py
""" The code this example is all based on is from http://tinyurl.com/pmmnbxv Some notes on this in the oommf-devnotes repo """ import os import pytest #print("pwd:") #os.system('pwd') #import subprocess #subprocess.check_output('pwd') os.system('make all') import example1 def test_f(): assert example1.f(1) -...
""" The code this example is all based on is from http://tinyurl.com/pmmnbxv Some notes on this in the oommf-devnotes repo """ import os import pytest # Need to call Makefile in directory where this test file is def call_make(target): # where is this file this_file = os.path.realpath(__file__) this_dir ...
Modify testing code to work if executed from above its own directory
Modify testing code to work if executed from above its own directory
Python
bsd-2-clause
ryanpepper/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,fangohr/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python
9548c4411938397b4f2d8a7b49b46cdc6aca0a3b
powerline/segments/i3wm.py
powerline/segments/i3wm.py
# vim:fileencoding=utf-8:noet from powerline.theme import requires_segment_info import i3 def calcgrp( w ): group = ["workspace"] if w['urgent']: group.append( 'w_urgent' ) if w['visible']: group.append( 'w_visible' ) if w['focused']: return "w_focused" return group def workspaces( pl ): '''Return workspace li...
# vim:fileencoding=utf-8:noet from powerline.theme import requires_segment_info import i3 def calcgrp( w ): group = [] if w['focused']: group.append( 'w_focused' ) if w['urgent']: group.append( 'w_urgent' ) if w['visible']: group.append( 'w_visible' ) group.append( 'workspace' ) return group def workspaces( pl...
Fix highlighting groups for workspaces segment
Fix highlighting groups for workspaces segment
Python
mit
Luffin/powerline,Luffin/powerline,areteix/powerline,cyrixhero/powerline,darac/powerline,russellb/powerline,bezhermoso/powerline,QuLogic/powerline,xfumihiro/powerline,prvnkumar/powerline,lukw00/powerline,bartvm/powerline,wfscheper/powerline,xxxhycl2010/powerline,s0undt3ch/powerline,blindFS/powerline,areteix/powerline,ke...
40711777de24d30cfe771f172b221cfdf460d8eb
rng.py
rng.py
from random import randint def get_random_number(start=1, end=10): """Generates and returns random number between :start: and :end:""" return randint(start, end)
def get_random_number(start=1, end=10): """https://xkcd.com/221/""" return 4
Revert "Fix python random number generator."
Revert "Fix python random number generator."
Python
mit
1yvT0s/illacceptanything,dushmis/illacceptanything,dushmis/illacceptanything,ultranaut/illacceptanything,caioproiete/illacceptanything,triggerNZ/illacceptanything,dushmis/illacceptanything,oneminot/illacceptanything,TheWhiteLlama/illacceptanything,ds84182/illacceptanything,caioproiete/illacceptanything,paladique/illacc...
130df743b14cf329c09f0c514ec0d6991b21dd45
examples/mnist-deepautoencoder.py
examples/mnist-deepautoencoder.py
#!/usr/bin/env python import matplotlib.pyplot as plt import theanets from utils import load_mnist, plot_layers, plot_images train, valid, _ = load_mnist() e = theanets.Experiment( theanets.Autoencoder, layers=(784, 256, 64, 36, 64, 256, 784), train_batches=100, tied_weights=True, ) e.train(train, ...
#!/usr/bin/env python import matplotlib.pyplot as plt import theanets from utils import load_mnist, plot_layers, plot_images train, valid, _ = load_mnist() e = theanets.Experiment( theanets.Autoencoder, layers=(784, 256, 64, 36, 64, 256, 784), train_batches=100, tied_weights=True, ) e.train(train, ...
Decrease patience for each layerwise trainer.
Decrease patience for each layerwise trainer.
Python
mit
chrinide/theanets,lmjohns3/theanets,devdoer/theanets
16b3dc1f8c762a751e1476d679391f3bbc82cd5d
python-prefix.py
python-prefix.py
#!/usr/bin/env python import sys import os.path import site def main(): '''\ Check if the given prefix is included in sys.path for the given python version; if not find an alternate valid prefix. Print the result to standard out. ''' if len(sys.argv) != 3: msg = 'usage: %s <prefix> <p...
#!/usr/bin/env python import sys import os.path import site def main(): '''\ Check if the given prefix is included in sys.path for the given python version; if not find an alternate valid prefix. Print the result to standard out. ''' if len(sys.argv) != 3: msg = 'usage: %s <prefix> <p...
Fix typo in previous commit.
Fix typo in previous commit.
Python
bsd-2-clause
marek-sezemsky/coreemu,tectronics/coreemu,marek-sezemsky/coreemu,guidotack/coreemu,guidotack/coreemu,tectronics/coreemu,tectronics/coreemu,gregtampa/coreemu,guidotack/coreemu,gregtampa/coreemu,marek-sezemsky/coreemu,gregtampa/coreemu
d87b22ee69d47d0edf33be36a217ed5d5a6a599b
flocker/__init__.py
flocker/__init__.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details. # -*- test-case-name: flocker.test -*- """ Flocker is a hypervisor that provides ZFS-based replication and fail-over functionality to a Linux-based user-space operating system. """ from ._version import get_versions __version__ = get_versions()['version'] d...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ Flocker is a hypervisor that provides ZFS-based replication and fail-over functionality to a Linux-based user-space operating system. """ from ._version import get_versions __version__ = get_versions()['version'] del get_versions
Remove reference to old tests.
Remove reference to old tests.
Python
apache-2.0
hackday-profilers/flocker,jml/flocker,wallnerryan/flocker-profiles,LaynePeng/flocker,runcom/flocker,mbrukman/flocker,beni55/flocker,adamtheturtle/flocker,w4ngyi/flocker,LaynePeng/flocker,achanda/flocker,mbrukman/flocker,achanda/flocker,moypray/flocker,lukemarsden/flocker,achanda/flocker,1d4Nf6/flocker,jml/flocker,lukem...
3896cd4e3ea0aee0025dafef13d2f29fe168cf10
students/psbriant/final_project/test_clean_data.py
students/psbriant/final_project/test_clean_data.py
""" Name: Paul Briant Date: 12/11/16 Class: Introduction to Python Assignment: Final Project Description: Tests for Final Project """ import clean_data as cd import pandas def get_data(): """ Retrieve data from csv file to test. """ data = pandas.read_csv("data/Residential_Water_Usage_Zip_Code_on_To...
""" Name: Paul Briant Date: 12/11/16 Class: Introduction to Python Assignment: Final Project Description: Tests for Final Project """ import clean_data as cd import matplotlib.pyplot as plt import pandas import pytest def get_data(): """ Retrieve data from csv file to test. """ data = pandas.read_cs...
Create test for plot_zipcode to compare generated graphs.
Create test for plot_zipcode to compare generated graphs.
Python
unlicense
UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016,UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016,UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016
c74e5bc942ae2486199070ec213fa6d692a2a605
docs/source/examples/test_modify_array_argument_reals.py
docs/source/examples/test_modify_array_argument_reals.py
#!/usr/bin/env python import numpy as np from pych.extern import Chapel @Chapel() def printArray(arr=np.ndarray): """ arr += 1; writeln(arr); """ return None if __name__ == "__main__": arr = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]) print arr printArray(arr); p...
#!/usr/bin/env python import numpy as np from pych.extern import Chapel @Chapel() def printArray(arr=np.ndarray): """ arr += 1; writeln(arr); """ return None if __name__ == "__main__": arr = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]) print arr printArray(arr); p...
Fix trivial unit test error that started when numpy version changed
Fix trivial unit test error that started when numpy version changed The version of numpy brought in by pip changed, which changed some test outputs in meaningless ways (ie, spaces), and those meaningless changes broke a unit test with assertEquals( "string literal", test(something) ) This change fixes the unit te...
Python
apache-2.0
russel/pychapel,russel/pychapel,chapel-lang/pychapel,chapel-lang/pychapel,russel/pychapel,chapel-lang/pychapel
1abeec5c22f22065e377a1567d3677e56fbc1b2c
tests/version_test.py
tests/version_test.py
import collections import numbers import os from sqlalchemy import __version__ from sqlalchemy_imageattach.version import VERSION, VERSION_INFO def test_version_info(): assert isinstance(VERSION_INFO, collections.Sequence) assert len(VERSION_INFO) == 3 assert isinstance(VERSION_INFO[0], numbers.Integral)...
import collections import numbers import os from sqlalchemy import __version__ from sqlalchemy_imageattach.version import VERSION, VERSION_INFO def test_version_info(): assert isinstance(VERSION_INFO, collections.Sequence) assert len(VERSION_INFO) == 3 assert isinstance(VERSION_INFO[0], numbers.Integral)...
Support any later versions of SQLAlchemy
Support any later versions of SQLAlchemy
Python
mit
youknowone/sqlalchemy-imageattach,dahlia/sqlalchemy-imageattach
c90d7ae2a407f626342786101eed4159dfbfe730
infra/bots/assets/go_deps/create.py
infra/bots/assets/go_deps/create.py
#!/usr/bin/env python # # Copyright 2017 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Create the asset.""" import argparse import os import subprocess def create_asset(target_dir): """Create the asset.""" env = {} env.update(os.enviro...
#!/usr/bin/env python # # Copyright 2017 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Create the asset.""" import argparse import os import subprocess def create_asset(target_dir): """Create the asset.""" env = {} env.update(os.enviro...
Add missing symlink target in go_deps asset
[infra] Add missing symlink target in go_deps asset Bug: skia: Change-Id: Ic806bddcdc1130e9b96158c19dbff9e16900020c Reviewed-on: https://skia-review.googlesource.com/157565 Reviewed-by: Ravi Mistry <9fa2e7438b8cb730f96b74865492597170561628@google.com> Commit-Queue: Eric Boren <0e499112533c8544f0505ea0d08394fb5ad7d8fa@...
Python
bsd-3-clause
HalCanary/skia-hc,aosp-mirror/platform_external_skia,rubenvb/skia,HalCanary/skia-hc,google/skia,rubenvb/skia,aosp-mirror/platform_external_skia,Hikari-no-Tenshi/android_external_skia,rubenvb/skia,google/skia,rubenvb/skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,google/skia,HalCanary/skia-hc,google/skia,aosp...
51943abe4c5dc072d5e4e4f938f0d66aade93d57
pombola/settings/nigeria_base.py
pombola/settings/nigeria_base.py
COUNTRY_APP = 'nigeria' OPTIONAL_APPS = [] TWITTER_USERNAME = 'NGShineyoureye' TWITTER_WIDGET_ID = '354909651910918144' BLOG_RSS_FEED = 'http://eienigeria.org/rss.xml' MAP_BOUNDING_BOX_NORTH = 14.1 MAP_BOUNDING_BOX_EAST = 14.7 MAP_BOUNDING_BOX_SOUTH = 4 MAP_BOUNDING_BOX_WEST = 2.5 MAPIT_COUNTRY = 'NG'
COUNTRY_APP = 'nigeria' OPTIONAL_APPS = ['pombola.spinner'] TWITTER_USERNAME = 'NGShineyoureye' TWITTER_WIDGET_ID = '354909651910918144' BLOG_RSS_FEED = 'http://eienigeria.org/rss.xml' MAP_BOUNDING_BOX_NORTH = 14.1 MAP_BOUNDING_BOX_EAST = 14.7 MAP_BOUNDING_BOX_SOUTH = 4 MAP_BOUNDING_BOX_WEST = 2.5 MAPIT_COUNTRY = ...
Add pombola.spinner to OPTIONAL_APPS in the new settings modules
Add pombola.spinner to OPTIONAL_APPS in the new settings modules
Python
agpl-3.0
geoffkilpin/pombola,patricmutwiri/pombola,ken-muturi/pombola,mysociety/pombola,ken-muturi/pombola,patricmutwiri/pombola,hzj123/56th,mysociety/pombola,mysociety/pombola,patricmutwiri/pombola,mysociety/pombola,hzj123/56th,ken-muturi/pombola,ken-muturi/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/...
6acb354fff4aafcdc006a13d947721d7dcfff5c5
sample/src/app/app.py
sample/src/app/app.py
#!/usr/bin/env python import os import json from flask import jsonify from flask import Flask app = Flask(__name__) @app.route("/env") def environment(): properties = [] for k,v in sorted(os.environ.iteritems()): properties.append(k + "=" + v) return json.dumps(properties, indent=4) if __name__ == "__main__": ...
#!/usr/bin/env python import os import json from flask import jsonify from flask import Flask app = Flask(__name__) @app.route("/env") def environment(): return json.dumps(dict(os.environ), indent=4) if __name__ == "__main__": app.run(host='0.0.0.0', port=int(os.getenv('PORT', '8080')))
Return env as dict rather than array of properties
Return env as dict rather than array of properties
Python
apache-2.0
cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,alex-slynko/tile-generator,alex-slynko/tile-generator,alex-slynko/tile-generator,alex-slynko/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator
8ccdd028347a73fc4706b0d34c4ee90eb9777336
run.py
run.py
# -*- coding: utf-8 -*- """ Eve Demo ~~~~~~~~ A demostration of a simple API powered by Eve REST API. The live demo is available at eve-demo.herokuapp.com. Please keep in mind that the it is running on Heroku's free tier using a free MongoHQ sandbox, which means that the first request to the ...
# -*- coding: utf-8 -*- """ Eve Demo ~~~~~~~~ A demostration of a simple API powered by Eve REST API. The live demo is available at eve-demo.herokuapp.com. Please keep in mind that the it is running on Heroku's free tier using a free MongoHQ sandbox, which means that the first request to the ...
Use '0.0.0.0' to ensure your API is reachable outside localhost.
Use '0.0.0.0' to ensure your API is reachable outside localhost.
Python
bsd-3-clause
nicolaiarocci/eve-demo,kidaa/eve-demo
06ba899aaaf5b8ff47c8ed6f317076c43d3351a0
chainer/__init__.py
chainer/__init__.py
from chainer import function from chainer import function_set from chainer.functions import basic_math from chainer import optimizer from chainer import variable Variable = variable.Variable Function = function.Function FunctionSet = function_set.FunctionSet Optimizer = optimizer.Optimizer basic_math.install_variable...
import pkg_resources from chainer import function from chainer import function_set from chainer.functions import basic_math from chainer import optimizer from chainer import variable __version__ = pkg_resources.get_distribution('chainer').version Variable = variable.Variable Function = function.Function FunctionSet...
Add version number to chainer module
Add version number to chainer module
Python
mit
t-abe/chainer,umitanuki/chainer,masia02/chainer,1986ks/chainer,benob/chainer,jnishi/chainer,ktnyt/chainer,AlpacaDB/chainer,sou81821/chainer,tscohen/chainer,okuta/chainer,Kaisuke5/chainer,keisuke-umezawa/chainer,pfnet/chainer,benob/chainer,hvy/chainer,kiyukuta/chainer,chainer/chainer,chainer/chainer,elviswf/chainer,kuwa...
ab76f87e013e330ad50f4a81ee0c72c36cb29681
thefuck/rules/sudo.py
thefuck/rules/sudo.py
patterns = ['permission denied', 'EACCES', 'pkg: Insufficient privileges', 'you cannot perform this operation unless you are root', 'non-root users cannot', 'Operation not permitted', 'root privilege', 'This command has to be run under ...
patterns = ['permission denied', 'EACCES', 'pkg: Insufficient privileges', 'you cannot perform this operation unless you are root', 'non-root users cannot', 'Operation not permitted', 'root privilege', 'This command has to be run under ...
Add one more 'need root' phrase
Add one more 'need root' phrase
Python
mit
thinkerchan/thefuck,artiya4u/thefuck,subajat1/thefuck,scorphus/thefuck,princeofdarkness76/thefuck,mcarton/thefuck,BertieJim/thefuck,manashmndl/thefuck,ostree/thefuck,MJerty/thefuck,thinkerchan/thefuck,scorphus/thefuck,gogobebe2/thefuck,AntonChankin/thefuck,beni55/thefuck,Clpsplug/thefuck,ostree/thefuck,bigplus/thefuck,...
bde734dc751cbfd59b40c1c2f0d60229795fae4a
tests/app/main/test_request_header.py
tests/app/main/test_request_header.py
import pytest from tests.conftest import set_config_values @pytest.mark.parametrize('check_proxy_header,header_value,expected_code', [ (True, 'key_1', 200), (True, 'wrong_key', 403), (False, 'wrong_key', 200), (False, 'key_1', 200), ]) def test_route_correct_secret_key(app_, check_proxy_header, heade...
import pytest from tests.conftest import set_config_values @pytest.mark.parametrize('check_proxy_header,header_value,expected_code', [ (True, 'key_1', 200), (True, 'wrong_key', 403), (False, 'wrong_key', 200), (False, 'key_1', 200), ]) def test_route_correct_secret_key(app_, check_proxy_header, heade...
Use test_client() as context manager
Use test_client() as context manager
Python
mit
gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin
25f424a8d8328b7e869b06a9bfa4a891580a8960
lib/history_widget.py
lib/history_widget.py
from PyQt4.QtGui import * from i18n import _ class HistoryWidget(QTreeWidget): def __init__(self, parent=None): QTreeWidget.__init__(self, parent) self.setColumnCount(2) self.setHeaderLabels([_("Amount"), _("To / From"), _("When")]) self.setIndentation(0) def empty(self): ...
from PyQt4.QtGui import * from i18n import _ class HistoryWidget(QTreeWidget): def __init__(self, parent=None): QTreeWidget.__init__(self, parent) self.setColumnCount(2) self.setHeaderLabels([_("Amount"), _("To / From"), _("When")]) self.setIndentation(0) def empty(self): ...
Fix for slush's problem, perhaps
Fix for slush's problem, perhaps
Python
mit
dabura667/electrum,spesmilo/electrum,dabura667/electrum,kyuupichan/electrum,cryptapus/electrum,wakiyamap/electrum-mona,fireduck64/electrum,digitalbitbox/electrum,fujicoin/electrum-fjc,neocogent/electrum,argentumproject/electrum-arg,dabura667/electrum,pooler/electrum-ltc,fyookball/electrum,fireduck64/electrum,FairCoinTe...
0b8a2a3a0f010538dd30ce04ca1ce943347a04a8
django_fixmystreet/fmsproxy/models.py
django_fixmystreet/fmsproxy/models.py
from django.db import models import logging logger = logging.getLogger(__name__) class FMSProxy(models.Model): name = models.CharField(max_length=20, unique=True) def __unicode__(self): return self.name def get_assign_payload(report): creator = report.get_creator() payload = { "appl...
from django.db import models import logging logger = logging.getLogger(__name__) class FMSProxy(models.Model): name = models.CharField(max_length=20, unique=True) def __unicode__(self): return self.name def get_assign_payload(report): creator = report.get_creator() payload = { "appl...
Use `active_attachments_pro` instead of `active_comments`.
Fix: Use `active_attachments_pro` instead of `active_comments`.
Python
agpl-3.0
IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet
829ccc3384126a48b8d54ac651a93e169e417176
dbaas/maintenance/admin/maintenance.py
dbaas/maintenance/admin/maintenance.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from ..models import Maintenance from ..service.maintenance import MaintenanceService from ..forms import MaintenanceForm class MaintenanceAdmin(admin.DjangoServicesAdmin): service_class = Maintenanc...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from ..service.maintenance import MaintenanceService from ..forms import MaintenanceForm class MaintenanceAdmin(admin.DjangoServicesAdmin): service_class = MaintenanceService search_fields = ("sc...
Add get_read_only and remove old change_view customization
Add get_read_only and remove old change_view customization
Python
bsd-3-clause
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
d5538e7daf5b3dbefa1ff0e76ced46eb194c836c
dodger/tests/test_osx_dodger_class.py
dodger/tests/test_osx_dodger_class.py
from unittest import TestCase from ..dock_dodger import OSXDodger class OSXDockDodgerTests(TestCase): def test_applications_folder_is_correct(self): """ Test that the applications folder is indeed `/Applications/` """ expected = "/Applications/" result = OSXDodger()...
from unittest import TestCase from ..dock_dodger import OSXDodger class OSXDockDodgerTests(TestCase): def test_applications_folder_is_correct(self): """ Test that the applications folder is indeed `/Applications/` """ expected = "/Applications/" result = OSXDodger()...
Test that the anly allowed system to execute this script is OS X
Test that the anly allowed system to execute this script is OS X
Python
mit
yoda-yoda/osx-dock-dodger,denisKaranja/osx-dock-dodger
c583f139b5092c132cb738f8bcbb5f305a0204a9
evaluation/packages/relationGraph.py
evaluation/packages/relationGraph.py
"""@package Primitive This module provides an abstraction of the relationGraph using networkX """ import networkx as nx import packages.primitive as primitive class RelationGraph(object): def __init__(self,primArray, assignArray): self.G=nx.Graph() # First create the nodes for p ...
"""@package Primitive This module provides an abstraction of the relationGraph using networkX """ import networkx as nx import packages.primitive as primitive class RelationGraph(object): def __init__(self,primArray, assignArray): self.G=nx.Graph() self.indexedPrimArray = {} # Fi...
Add add function taking a functor as input to process connected primitives
Add add function taking a functor as input to process connected primitives
Python
apache-2.0
amonszpart/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt
12e924cd617811cb763857a9abf14e8b3487f5a1
ckanext/nhm/routes/bbcm.py
ckanext/nhm/routes/bbcm.py
# !/usr/bin/env python # encoding: utf-8 # # This file is part of ckanext-nhm # Created by the Natural History Museum in London, UK from flask import Blueprint from ckan.plugins import toolkit # bbcm = big butterfly count map :) # create a flask blueprint with a prefix blueprint = Blueprint(name=u'big-butterfly-coun...
# !/usr/bin/env python # encoding: utf-8 # # This file is part of ckanext-nhm # Created by the Natural History Museum in London, UK from flask import Blueprint from ckan.plugins import toolkit # bbcm = big butterfly count map :) # create a flask blueprint blueprint = Blueprint(name=u'big-butterfly-count-map', import...
Allow the url to be accessed with or without a / on the end
Allow the url to be accessed with or without a / on the end
Python
mit
NaturalHistoryMuseum/ckanext-nhm,NaturalHistoryMuseum/ckanext-nhm,NaturalHistoryMuseum/ckanext-nhm
7c034802338c78ccb895b7a362e0d4ed11b6b4da
.offlineimap.py
.offlineimap.py
#!/usr/bin/python import re, os def get_password_emacs(machine, login, port): s = "machine %s login %s port %s password ([^ ]*)\n" % (machine, login, port) p = re.compile(s) authinfo = os.popen("gpg -q -d ~/.authinfo.gpg").read() return p.search(authinfo).group(1)
#!/usr/bin/python import re, os def get_password_emacs(machine, login, port): """Return password for the given machine/login/port. Your .authinfo.gpg file had better follow the following order, or you will not get a result. """ s = "machine %s login %s port %s password ([^ ]*)\n" % (machine, logi...
Add a comment for the get_password_emacs function
Add a comment for the get_password_emacs function Comment necessary because the format of authinfo needs to match the semi-brittle regex (ah, regexes...) This also moves the file to a proper dotfile, similar to commit 42f2b513a7949edf901b18233c1229bfcc24b706
Python
mit
olive42/dotfiles,olive42/dotfiles
e79010f0aedf6f832ef14a72f435ddba33068e35
kindergarten-garden/kindergarten_garden.py
kindergarten-garden/kindergarten_garden.py
CHILDREN = ["Alice", "Bob", "Charlie", "David", "Eve", "Fred", "Ginny", "Harriet", "Ileana", "Joseph", "Kincaid", "Larry"] PLANTS = {"C": "Clover", "G": "Grass", "R": "Radishes", "V": "Violets"} class Garden(object): def __init__(self, garden, students=CHILDREN): self.students = sorted(student...
CHILDREN = ["Alice", "Bob", "Charlie", "David", "Eve", "Fred", "Ginny", "Harriet", "Ileana", "Joseph", "Kincaid", "Larry"] PLANTS = {"C": "Clover", "G": "Grass", "R": "Radishes", "V": "Violets"} class Garden(object): def __init__(self, garden, students=CHILDREN): self.students = sorted(student...
Use unpacking for simpler code
Use unpacking for simpler code
Python
agpl-3.0
CubicComet/exercism-python-solutions
e01d45e3ee39023814bca75b1344477e42865b0b
ds_max_priority_queue.py
ds_max_priority_queue.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function class MaxPriorityQueue(object): """Max Priority Queue.""" def __init__(self): pass def main(): pass if __name__ == '__main__': main()
from __future__ import absolute_import from __future__ import division from __future__ import print_function def parent(i): return i // 2 def left(i): return 2 * i def right(i): return 2 * i + 1 class MaxPriorityQueue(object): """Max Priority Queue.""" def __init__(self): pass def main(): pass ...
Add parent(), left() & right()
Add parent(), left() & right()
Python
bsd-2-clause
bowen0701/algorithms_data_structures
73d59df8b94f72e83b978c00518afa01967faac9
mle/test_package.py
mle/test_package.py
def test_distribution(): from mle import Normal, var, par import theano.tensor as T x = var('x') mu = par('mu') sigma = par('sigma') dist = Normal(x, mu, sigma) assert(len(dist.get_vars()) == 1) assert(len(dist.get_params()) == 2) assert(len(dist.get_dists()) == 0)
def test_formula_transform(): """ Check if variables can be added/multiplied/transformed. The result should be a formula that can be plugged into a model. """ from mle import var, par x = var('x') a = par('a') b = par('b') formula = a * x**2 + b def test_simple_fit(): """ ...
Add some tests that don't pass yet
Add some tests that don't pass yet
Python
mit
ibab/python-mle
e3c6b5ce00502077f56ea7033132356ff88a1a55
app/soc/mapreduce/gci_insert_dummy_data.py
app/soc/mapreduce/gci_insert_dummy_data.py
# Copyright 2013 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
# Copyright 2013 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
Replace "lambda blob: blob" with "bool".
Replace "lambda blob: blob" with "bool". This is legitimate (and even an improvement) since the function is passed to filter, which will use its return value in a boolean context anyway. This also cleans up a lint warning.
Python
apache-2.0
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
593fb7d6db4a5fe35a80fcad300eb43bb93ba3bb
social_core/tests/backends/test_udata.py
social_core/tests/backends/test_udata.py
import json from six.moves.urllib_parse import urlencode from .oauth import OAuth2Test class DatagouvfrOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.udata.DatagouvfrOAuth2' user_data_url = 'https://www.data.gouv.fr/api/1/me/' expected_username = 'foobar' access_token_body = json.dumps...
import json from six.moves.urllib_parse import urlencode from .oauth import OAuth2Test class DatagouvfrOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.udata.DatagouvfrOAuth2' user_data_url = 'https://www.data.gouv.fr/api/1/me/' expected_username = 'foobar' access_token_body = json.dumps...
Fix tests for udata/datagouvfr backend
Fix tests for udata/datagouvfr backend
Python
bsd-3-clause
python-social-auth/social-core,python-social-auth/social-core
55cd1bc079017945c2b8f48542c491d6a7d5153f
tests/test_cl_json.py
tests/test_cl_json.py
from kqml import cl_json, KQMLList def test_parse(): json_dict = {'a': 1, 'b': 2, 'c': ['foo', {'bar': None, 'done': False}], 'this_is_json': True} res = cl_json._cl_from_json(json_dict) assert isinstance(res, KQMLList) assert len(res) == 2*len(json_dict.keys()) b...
from kqml import cl_json, KQMLList def _equal(json_val, back_json_val): if json_val is False and back_json_val is None: return True if type(json_val) != type(back_json_val): return False if isinstance(json_val, dict): ret = True for key, value in json_val.items(): ...
Write deeper test of equality for recovered dict.
Write deeper test of equality for recovered dict.
Python
bsd-2-clause
bgyori/pykqml
6dd546d97710c99201af17c19e0f48a8c4702f72
tests/test_patspec.py
tests/test_patspec.py
import pymorph import numpy as np def test_patspec(): 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) assert pymorph.patspec(f).sum() == (f > 0).sum()
import pymorph import numpy as np def test_patspec(): 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) assert pymorph.patspec(f).sum() == (f > 0).sum() def test_linear_h(): f = np.arange(9).reshape((...
Test case for newly reported bug
TST: Test case for newly reported bug This was reported by Alexandre Harano.
Python
bsd-3-clause
luispedro/pymorph
d971fbb4dc3b69e012b212cd54b6e8511571e1f5
graphene/core/classtypes/uniontype.py
graphene/core/classtypes/uniontype.py
import six from graphql.core.type import GraphQLUnionType from .base import FieldsClassType, FieldsClassTypeMeta, FieldsOptions class UnionTypeOptions(FieldsOptions): def __init__(self, *args, **kwargs): super(UnionTypeOptions, self).__init__(*args, **kwargs) self.types = [] class UnionTypeMet...
from functools import partial import six from graphql.core.type import GraphQLUnionType from .base import FieldsClassType, FieldsClassTypeMeta, FieldsOptions class UnionTypeOptions(FieldsOptions): def __init__(self, *args, **kwargs): super(UnionTypeOptions, self).__init__(*args, **kwargs) self....
Update to use partial instead of lambda function
Update to use partial instead of lambda function
Python
mit
sjhewitt/graphene,graphql-python/graphene,sjhewitt/graphene,Globegitter/graphene,graphql-python/graphene,Globegitter/graphene
068d44af407da3835bc96717700bd174480060ec
apps/maps/json_view.py
apps/maps/json_view.py
from django.core.serializers.json import DjangoJSONEncoder from django.views.decorators.cache import cache_page from django.views.generic import View from django.http import JsonResponse, HttpResponse from django.conf import settings class DjangoJSONEncoder2(DjangoJSONEncoder): """A json encoder to deal with th...
from datetime import timedelta from django.core.serializers.json import DjangoJSONEncoder from django.db.models.query import ValuesQuerySet from django.views.decorators.cache import cache_page from django.views.generic import View from django.http import JsonResponse, HttpResponse from django.conf import settings c...
Allow querysets to be jsonified
Allow querysets to be jsonified
Python
agpl-3.0
IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site
134fb48961a03bc17b34154b54875b543f1f27b8
legcoscraper/scripts/report-summary.py
legcoscraper/scripts/report-summary.py
#!/usr/bin/env python # # Give a quick summary of data which has been retrieved # import argparse import json from collections import Counter from pprint import pprint parser = argparse.ArgumentParser() parser.add_argument("json_file", type=str, help="JSON data file from scraper") args = parser.parse_args() type_cou...
#!/usr/bin/env python # # Give a quick summary of data which has been retrieved # import argparse import json from collections import Counter from pprint import pprint import re parser = argparse.ArgumentParser() parser.add_argument("json_file", type=str, help="JSON data file from scraper") args = parser.parse_args()...
Print count summaries for Hansard by year
Print count summaries for Hansard by year
Python
mit
comsaint/legco-watch,legco-watch/legco-watch,comsaint/legco-watch,legco-watch/legco-watch,legco-watch/legco-watch,comsaint/legco-watch,comsaint/legco-watch,legco-watch/legco-watch
87cbd9f4a69cb4895dc7baec84e9c1044d4b6ad4
bridge/mavlink-zmq-bridge.py
bridge/mavlink-zmq-bridge.py
import zmq from argparse import ArgumentParser from pymavlink import mavutil def main(): parser = ArgumentParser() parser.add_argument("--device", help="MAVLink device to add to zmq", required=True) parser.add_argument("--zmq", help="zmq url", required=True) args = parser.parse_args() try: ...
import zmq from argparse import ArgumentParser from pymavlink import mavutil def main(): parser = ArgumentParser() parser.add_argument("--device", help="MAVLink device to add to zmq", required=True) parser.add_argument("--zmq", help="zmq url", required=True) args = parser.parse_args() try: ...
Remove printing of topics in bridge
Remove printing of topics in bridge
Python
bsd-2-clause
btashton/mavlink-zmq,btashton/mavlink-zmq
cb099abc5a59d3824e767e5dd094cfea6f066a0a
libqtile/command.py
libqtile/command.py
# Copyright (c) 2008, Aldo Cortesi. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
# Copyright (c) 2008, Aldo Cortesi. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
Fix up deprecated lazy import
Fix up deprecated lazy import
Python
mit
ramnes/qtile,qtile/qtile,ramnes/qtile,tych0/qtile,qtile/qtile,tych0/qtile
c2bb7f0461599cc7624b8d844be93b6912fc0b1d
examples/test_filter_strings.py
examples/test_filter_strings.py
def test_filter_strings(wish): accept_names = wish names = ['has MARK', 'does not have'] accept_pattern = '.*MARK.*'
def test_filter_strings_basic(wish): filter_strings = wish input = ['has MARK', 'does not have'] expected_ouput = ['has MARK'] accept_pattern = '.*MARK.*' assert list(filter_strings(input, accept_pattern)) == expected_ouput
Complete unfinished code committed by mistake.
Complete unfinished code committed by mistake.
Python
mit
nodev-io/pytest-nodev,alexamici/pytest-wish,alexamici/pytest-nodev
dcecdbae798e0a83afb17911ec459224790e51cd
launch_control/dashboard_app/tests.py
launch_control/dashboard_app/tests.py
""" Unit tests of the Dashboard application """ from django.test import TestCase from django.db import IntegrityError from launch_control.dashboard_app.models import ( SoftwarePackage, ) class SoftwarePackageTestCase(TestCase): def test_creation_1(self): sw_package = SoftwarePackage.obj...
""" Unit tests of the Dashboard application """ from django.test import TestCase from django.db import IntegrityError from launch_control.utils.call_helper import ObjectFactoryMixIn from launch_control.dashboard_app.models import ( SoftwarePackage, ) class SoftwarePackageTestCase(TestCase, ObjectFac...
Update SoftwarePackageTestCase to use ObjectFactoryMixIn
Update SoftwarePackageTestCase to use ObjectFactoryMixIn
Python
agpl-3.0
OSSystems/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server
210a1a2387a048f8ff6ac650ce66543923ece860
pythonforandroid/recipes/pymunk/__init__.py
pythonforandroid/recipes/pymunk/__init__.py
from pythonforandroid.recipe import CompiledComponentsPythonRecipe class PymunkRecipe(CompiledComponentsPythonRecipe): name = "pymunk" version = "6.0.0" url = "https://pypi.python.org/packages/source/p/pymunk/pymunk-{version}.zip" depends = ["cffi", "setuptools"] call_hostpython_via_targetpython =...
from pythonforandroid.recipe import CompiledComponentsPythonRecipe class PymunkRecipe(CompiledComponentsPythonRecipe): name = "pymunk" version = "6.0.0" url = "https://pypi.python.org/packages/source/p/pymunk/pymunk-{version}.zip" depends = ["cffi", "setuptools"] call_hostpython_via_targetpython =...
Fix Pymunk crash on older versions of Android
Fix Pymunk crash on older versions of Android Seems to be required to link -lm on at least 5.1, but not on 8.0
Python
mit
kronenpj/python-for-android,PKRoma/python-for-android,kivy/python-for-android,kronenpj/python-for-android,kronenpj/python-for-android,kivy/python-for-android,PKRoma/python-for-android,PKRoma/python-for-android,PKRoma/python-for-android,kivy/python-for-android,kronenpj/python-for-android,PKRoma/python-for-android,kivy/p...
0e754fe4ea8ddee4bb952b483c4da2d8bf5970ed
core/context_processors.py
core/context_processors.py
from django.conf import settings as django_settings from django.utils.translation import ugettext_lazy as _ def settings(request): if not getattr(django_settings, "SOCIAL", None): return {} return { "SOCIAL_FACEBOOK": django_settings.SOCIAL.get("FACEBOOK", ""), "SOCIAL_TWITTER": django_...
from django.conf import settings as django_settings from django.utils.translation import ugettext_lazy as _ def settings(request): if not getattr(django_settings, "SOCIAL", None): return {} return { "SOCIAL_FACEBOOK": django_settings.SOCIAL.get("FACEBOOK", ""), "SOCIAL_TWITTER": django_...
Remove the hardcode from the settings.
Remove the hardcode from the settings.
Python
bsd-3-clause
PARINetwork/pari,PARINetwork/pari,PARINetwork/pari,PARINetwork/pari
970d296cd4344fbbde28552dbf2aa5fbbb329c9d
gh_user_download.py
gh_user_download.py
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHET...
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHET...
Add option to download via SSH
Add option to download via SSH
Python
mit
JackMc/git_tools
6039fd841bdddaa8fc35dcf11c2e1c71d95da66d
evaluation/packages/io.py
evaluation/packages/io.py
"""@package IO Generic input/output functions """ import numpy as np def readPointCloudFromPly(path): f = open(path, 'r') points = [] headerSkipped = False for line in f: if headerSkipped: points.append(np.float32(np.array(line.split(' ')[0:3]))) else: ...
"""@package IO Generic input/output functions """ import numpy as np def readPointCloudFromPly(path): f = open(path, 'r') points = [] headerSkipped = False for line in f: if headerSkipped: points.append(np.float32(np.array(line.split(' ')[0:3]))) else: ...
Add new method to read correspondances files
Add new method to read correspondances files
Python
apache-2.0
amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt
cbc681933fd6e2899f38dd9759bb9a188b66bbd4
tests/run.py
tests/run.py
import sys from colour_runner.django_runner import ColourRunnerMixin from django.conf import settings settings.configure( INSTALLED_APPS=( # Put contenttypes before auth to work around test issue. # See: https://code.djangoproject.com/ticket/10827#comment:12 'django.contrib.contenttypes',...
import sys from colour_runner.django_runner import ColourRunnerMixin from django.conf import settings settings.configure( # Core environmental settings INSTALLED_APPS=( # Put contenttypes before auth to work around test issue. # See: https://code.djangoproject.com/ticket/10827#comment:12 ...
Add environmental settings for basic authentication.
Add environmental settings for basic authentication.
Python
bsd-2-clause
ghickman/incuna-auth,incuna/incuna-auth,incuna/incuna-auth,ghickman/incuna-auth
bb11252c277d40c8ec8c579100c04a6a676accfe
tests/run.py
tests/run.py
#! /usr/bin/env python3 from os import path import sys from colour_runner.django_runner import ColourRunnerMixin from django.conf import settings from django.test.runner import DiscoverRunner settings.configure( INSTALLED_APPS=( # Put contenttypes before auth to work around test issue. # See: htt...
#! /usr/bin/env python3 from os import path import sys from colour_runner.django_runner import ColourRunnerMixin from django.conf import settings settings.configure( INSTALLED_APPS=( # Put contenttypes before auth to work around test issue. # See: https://code.djangoproject.com/ticket/10827#comme...
Reorder imports to dodge a settings problem.
Reorder imports to dodge a settings problem.
Python
bsd-2-clause
incuna/incuna-auth,ghickman/incuna-auth,incuna/incuna-auth,ghickman/incuna-auth
7821681829008dfe1c933551656c1604a24b491b
cla_frontend/apps/status/views.py
cla_frontend/apps/status/views.py
import datetime from django.http import JsonResponse from django.shortcuts import render from django.views.generic import View from cla_common.smoketest import smoketest from .smoketests import smoketests def status(request): results = list(smoketests.execute()) passed = reduce(lambda acc, curr: acc and cur...
import datetime from django.http import JsonResponse from django.shortcuts import render from django.views.generic import View from cla_common.smoketest import smoketest from .smoketests import smoketests def status(request): results = list(smoketests.execute()) passed = reduce(lambda acc, curr: acc and cur...
Clarify docstring from previous PR suggestion
Clarify docstring from previous PR suggestion
Python
mit
ministryofjustice/cla_frontend,ministryofjustice/cla_frontend,ministryofjustice/cla_frontend,ministryofjustice/cla_frontend
b47821b4fce6ab969fab3c7c5a1ef1a8fb58764c
jacquard/storage/tests/test_dummy.py
jacquard/storage/tests/test_dummy.py
import unittest from jacquard.storage.dummy import DummyStore from jacquard.storage.testing_utils import StorageGauntlet class DummyGauntletTest(StorageGauntlet, unittest.TestCase): def open_storage(self): return DummyStore('')
import pytest import unittest from jacquard.storage.dummy import DummyStore from jacquard.storage.testing_utils import StorageGauntlet class DummyGauntletTest(StorageGauntlet, unittest.TestCase): def open_storage(self): return DummyStore('') def test_transaction_raises_error_for_bad_commit(self): ...
Cover this exception with a test
Cover this exception with a test
Python
mit
prophile/jacquard,prophile/jacquard
3cee41ff8a7af405fe3a6bfda214e4fe1a6d3c0f
oneflow/settings/snippets/db_production.py
oneflow/settings/snippets/db_production.py
DATABASES['default'] = dj_database_url.config( default='postgres://oneflow:8jxcWaAfPJT3mV@{0}' '/oneflow'.format(MAIN_SERVER)) mongoengine.connect('oneflow', host=MAIN_SERVER) REDIS_DB = 0 CONSTANCE_REDIS_CONNECTION = 'redis://{0}:6379/{1}'.format( MAIN_SERVER, REDIS_DB) SESSION_REDIS_HOST = MAIN_SERVE...
DATABASES['default'] = dj_database_url.config( default='postgres://oneflow:8jxcWaAfPJT3mV@{0}' '/oneflow'.format(MAIN_SERVER)) mongoengine.connect('oneflow', host=MAIN_SERVER) REDIS_DB = 0 REDIS_TEST_DB = 9 CONSTANCE_REDIS_CONNECTION = 'redis://{0}:6379/{1}'.format( MAIN_SERVER, REDIS_DB) SESSION_REDIS...
Add the test REDIS database.
Add the test REDIS database.
Python
agpl-3.0
1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow
3ede283ed3f656dc8f73c962eb452ce4b849dfd9
guardhouse/main/forms.py
guardhouse/main/forms.py
from django.forms import ModelForm from .models import Account, Site class SiteForm(ModelForm): class Meta(object): model = Site exclude = ('verified',) class AccountForm(ModelForm): class Meta(object): model = Account exclude = ('owner', 'delegates')
from django.forms import ModelForm from .models import Account, Site class SiteForm(ModelForm): class Meta(object): model = Site exclude = ('belongs_to', 'verification_state',) class AccountForm(ModelForm): class Meta(object): model = Account exclude = ('owner', 'delegates')
Remove internal fields form from
Remove internal fields form from
Python
bsd-3-clause
ulope/guardhouse,ulope/guardhouse
2784738167145ef0226679df21b205d033737b29
optimization/simple.py
optimization/simple.py
#!/usr/bin/python3 """ Maximize 1 x1 + 2 x2 Subject To C1: x1 + x2 <= 40 Nickel: 2 x1 + 1 x2 <= 60 Bounds x1 >= 0 x2 >= 0 End """ from gurobipy import * m = Model("simple") x1 = m.addVar(name="x1") x2 = m.addVar(name="x2") m.update() print("x1:%s x2:%s" % (x1,x2)) #m.setObjective(x1 + 2*x2, GRB.MAXIMIZE...
#!/usr/bin/python3 """ Maximize 1 x1 + 2 x2 Subject To C1: x1 + x2 <= 40 Nickel: 2 x1 + 1 x2 <= 60 Bounds x1 >= 0 x2 >= 0 End """ from gurobipy import * m = Model("simple") x1 = m.addVar(name="x1") x2 = m.addVar(name="x2") m.update() print("x1:%s x2:%s" % (x1,x2)) #m.setObjective(x1 + 2*x2, GRB.MAXIMIZE...
Use classes to create constraints.
Use classes to create constraints.
Python
apache-2.0
MiddelkoopT/CompOpt-2014-Fall,MiddelkoopT/CompOpt-2014-Fall
8869eba1f74e677d1802aad0cc2592344ab81000
podium/talks/models.py
podium/talks/models.py
from django.db import models from django.urls import reverse TALK_STATUS_CHOICES = ( ('S', 'Submitted'), ('A', 'Approved'), ('R', 'Rejected'), ('C', 'Confirmed'), ) class Talk(models.Model): speaker_name = models.CharField(max_length=1000) speaker_email = models.CharField(max_length=1000) ...
from django.db import models from django.urls import reverse TALK_STATUS_CHOICES = ( ('S', 'Submitted'), ('A', 'Approved'), ('R', 'Rejected'), ('C', 'Confirmed'), ) class Talk(models.Model): speaker_name = models.CharField(max_length=1000) speaker_email = models.CharField(max_length=1000) ...
Use a filter field lookup
Use a filter field lookup Looks like I forgot to do this when JR suggested it.
Python
mit
pyatl/podium-django,pyatl/podium-django,pyatl/podium-django
9c34c9cfca30104d5bd17b38df5fa50cb24ee9ae
tests/write_abort_test.py
tests/write_abort_test.py
#! /usr/bin/env python # -*- coding: iso-8859-1 -*- # vi:ts=4:et import os.path import pycurl import sys import unittest class WriteAbortTest(unittest.TestCase): def setUp(self): self.curl = pycurl.Curl() def tearDown(self): self.curl.close() def test_write_abort(self): def write...
#! /usr/bin/env python # -*- coding: iso-8859-1 -*- # vi:ts=4:et import os.path import pycurl import sys import unittest class WriteAbortTest(unittest.TestCase): def setUp(self): self.curl = pycurl.Curl() def tearDown(self): self.curl.close() def test_write_abort(self): def write...
Handle the possibility of other tests failing in Python code called from C
Handle the possibility of other tests failing in Python code called from C
Python
lgpl-2.1
pycurl/pycurl,pycurl/pycurl,pycurl/pycurl