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
1ce9d232e290c32f2c3e851617a89966f0e3eb87
lib/templatetags/baseurl.py
lib/templatetags/baseurl.py
import re from bs4 import BeautifulSoup from django import template register = template.Library() @register.filter(is_safe=True) def baseurl(html, base): if not base.endswith('/'): base += '/' absurl = re.compile(r'\s*[a-zA-Z][a-zA-Z0-9\+\.\-]*:') # Starts with scheme:. def isabs(url): ...
import re from bs4 import BeautifulSoup from django import template register = template.Library() @register.filter(is_safe=True) def baseurl(html, base): if not base.endswith('/'): base += '/' absurl = re.compile(r'\s*[a-zA-Z][a-zA-Z0-9\+\.\-]*:') # Starts with scheme:. def isabs(url): ...
Change bs4 html parser to html.parser
Change bs4 html parser to html.parser This is to fix wrapping with <html> tags.
Python
mit
peterkuma/tjrapid,peterkuma/tjrapid,peterkuma/tjrapid
10b58658f76c0d51c0ae091788db78de5204a284
example.py
example.py
import generation import show """ Choose the excitation signal which you want to generate and fill in the parameters xxx_sweep(fstart, fstop, sweep_time, fs), where: fstart is the start frequency fstop is the stop frequency sweep_time is the total length of sweep fs is the sampling frequency Note that the stop freq...
#!/usr/bin/env python3 import generation import show # For example """Save the return value in a new variable which is the sweep vector. """ x = generation.log_sweep(1, 1000, 2, 44100) """We created a vector which sweeps from 1 Hz to 1000 Hz in 2 seconds at a sampling frequency of 44.1 kHz. """ show.sweep(x, 2, 44...
Make executable and edit some docstrings
Make executable and edit some docstrings
Python
mit
spatialaudio/sweep,franzpl/sweep
c53cec75ef487ccd2eb9e86987f67bd8bfff87d2
tests/integration/cli/sync_test.py
tests/integration/cli/sync_test.py
from ...testcases import DustyIntegrationTestCase from ...fixtures import busybox_single_app_bundle_fixture class TestSyncCLI(DustyIntegrationTestCase): def setUp(self): super(TestSyncCLI, self).setUp() busybox_single_app_bundle_fixture() self.run_command('bundles activate busyboxa') ...
from ...testcases import DustyIntegrationTestCase from ...fixtures import busybox_single_app_bundle_fixture class TestSyncCLI(DustyIntegrationTestCase): def setUp(self): super(TestSyncCLI, self).setUp() busybox_single_app_bundle_fixture() self.run_command('bundles activate busyboxa') ...
Add test that sync is now destructive
Add test that sync is now destructive
Python
mit
gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty
5c8e83373a854242aca7a82611d47d1fdb85269e
toolbox/models.py
toolbox/models.py
from keras.layers import Conv2D from keras.models import Sequential def srcnn(input_shape, c=1, f1=9, f2=1, f3=5, n1=64, n2=32): model = Sequential() model.add(Conv2D(nb_filter=n1, nb_row=f1, nb_col=f1, activation='relu', init='he_normal', input_shape=input_shape)) ...
from keras.layers import Conv2D from keras.models import Sequential def srcnn(input_shape, c=1, f1=9, f2=1, f3=5, n1=64, n2=32): model = Sequential() model.add(Conv2D(nb_filter=n1, nb_row=f1, nb_col=f1, init='he_normal', activation='relu', input_shape=input_shape)) model.add(Conv2D(nb...
Use he_normal initialization for all layers
Use he_normal initialization for all layers
Python
mit
qobilidop/srcnn,qobilidop/srcnn
e07b2e24cddc8a2e2d1c8838e8509b2009344714
util/BaseModel.py
util/BaseModel.py
""" Contains base class for ndb models. This adds functionality that is expected (or at least useful) elsewhere in GEAStarterKit. """ from google.appengine.ext import ndb class BaseModel(ndb.Model): date_created = ndb.DateTimeProperty(auto_now_add=True, required=True) date_modified = ndb.DateTimeProperty(auto...
""" Contains base class for ndb models. This adds functionality that is expected (or at least useful) elsewhere in GEAStarterKit. """ from google.appengine.ext import ndb class BaseModel(ndb.Model): date_created = ndb.DateTimeProperty(auto_now_add=True, required=True) date_modified = ndb.DateTimeProperty(auto...
Add a utility method to get instances from urlsafe key.
Add a utility method to get instances from urlsafe key.
Python
apache-2.0
kkinder/GAEStarterKit,kkinder/GAEStarterKit,kkinder/GAEStarterKit
39769907bdcd019ec6a7d4f2ee1be82efd760611
src/rinoh/language/pl.py
src/rinoh/language/pl.py
# This file is part of rinohtype, the Python document preparation system. # # Copyright (c) Brecht Machiels. # # Use of this source code is subject to the terms of the GNU Affero General # Public License v3. See the LICENSE file or http://www.gnu.org/licenses/. from .cls import Language from ..structure import Sectio...
# This file is part of rinohtype, the Python document preparation system. # # Copyright (c) Brecht Machiels. # # Use of this source code is subject to the terms of the GNU Affero General # Public License v3. See the LICENSE file or http://www.gnu.org/licenses/. from .cls import Language from ..structure import Sectio...
Add Polish language document strings.
Add Polish language document strings.
Python
agpl-3.0
brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype
cdcb503d3dbc4679a2bda9dd204df18ab334d70c
pyclub/content/forms.py
pyclub/content/forms.py
# -*- coding: utf-8 -*- from django import forms from . import models class PostForm(forms.ModelForm): class Meta: model = models.Post fields = ( 'title', 'body', 'status', )
# -*- coding: utf-8 -*- from django import forms from . import models class PostForm(forms.ModelForm): class Meta: model = models.Post fields = ( 'title', 'body', )
Remove campo com default do form
Remove campo com default do form
Python
mit
dvl/pyclub,dvl/pyclub,dvl/pyclub
56a94b6ca5cadceb503edc7b968f813e66fafe92
src/web/__init__.py
src/web/__init__.py
# -*- coding: utf-8 -*- from random import choice from faker.providers import BaseProvider from .mimetypes import mime_types class WebProvider(BaseProvider): """ A Provider for web-related test data. >>> from faker import Faker >>> from faker_web import WebProvider >>> fake = Faker() >>> fa...
# -*- coding: utf-8 -*- from faker.providers import BaseProvider from .mimetypes import mime_types class WebProvider(BaseProvider): """ A Provider for web-related test data. >>> from faker import Faker >>> from faker_web import WebProvider >>> fake = Faker() >>> fake.add_provider(WebProvider...
Use random_element instead of random.choice
Use random_element instead of random.choice
Python
apache-2.0
thiagofigueiro/faker_web
c69e18a4dd324b8d32fb3d5c74bd011c7fa081d6
waybackpack/session.py
waybackpack/session.py
from .settings import DEFAULT_USER_AGENT import requests import time import logging logger = logging.getLogger(__name__) class Session(object): def __init__(self, follow_redirects=False, user_agent=DEFAULT_USER_AGENT): self.follow_redirects = follow_redirects self.user_agent = user_agent def g...
from .settings import DEFAULT_USER_AGENT import requests import time import logging logger = logging.getLogger(__name__) class Session(object): def __init__(self, follow_redirects=False, user_agent=DEFAULT_USER_AGENT): self.follow_redirects = follow_redirects self.user_agent = user_agent def g...
Add stream=True to requests params
Add stream=True to requests params
Python
mit
jsvine/waybackpack
6cedfb17afbb3a869336d23cefdfcae1a65754f9
tests/test_check.py
tests/test_check.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_binaryornot ------------------ Tests for `binaryornot` module. """ import unittest from binaryornot import check class TestIsBinary(unittest.TestCase): def setUp(self): pass def test_is_binary(self): pass def tearDown(self): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_binaryornot ------------------ Tests for `binaryornot` module. """ import unittest from binaryornot.check import is_binary class TestIsBinary(unittest.TestCase): def test_css(self): self.assertFalse(is_binary('tests/files/bootstrap-glyphicons.css...
Add lots of miserably failing tests.
Add lots of miserably failing tests.
Python
bsd-3-clause
pombredanne/binaryornot,0k/binaryornot,pombredanne/binaryornot,pombredanne/binaryornot,audreyr/binaryornot,audreyr/binaryornot,hackebrot/binaryornot,hackebrot/binaryornot,0k/binaryornot,audreyr/binaryornot,hackebrot/binaryornot
d59247df00a5899c0f4933df42a9d369db1931ab
tests/helpers.py
tests/helpers.py
import virtualbox def list_machines(): vbox = virtualbox.vb_get_manager() for machine in vbox.getArray(vbox, "Machines"): print "Machine '%s' logs in '%s'" % ( machine.name, machine.logFolder )
import unittest import virtualbox class VirtualboxTestCase(unittest.TestCase): def setUp(self): self.vbox = virtualbox.vb_get_manager() def assertMachineExists(self, name, msg=None): try: self.vbox.findMachine(name) except Exception as e: if msg: ...
Create a basic VirtualBoxTestCase with helper assertions
Create a basic VirtualBoxTestCase with helper assertions
Python
apache-2.0
saltstack/salt,saltstack/salt,LoveIsGrief/saltcloud-virtualbox-provider,saltstack/salt,saltstack/salt,saltstack/salt
c203f53257e4ac873f3361859158024a45b7fb56
test/test_object.py
test/test_object.py
from support import lib,ffi from qcgc_test import QCGCTest import unittest class ObjectTestCase(QCGCTest): def test_write_barrier(self): arena = lib.qcgc_arena_create() o = self.allocate(16) self.assertEqual(ffi.cast("object_t *", o).flags & lib.QCGC_GRAY_FLAG, 0) lib.qcgc_write(ffi...
from support import lib,ffi from qcgc_test import QCGCTest import unittest class ObjectTestCase(QCGCTest): def test_write_barrier(self): o = self.allocate(16) arena = lib.qcgc_arena_addr(ffi.cast("cell_t *", o)) self.assertEqual(ffi.cast("object_t *", o).flags & lib.QCGC_GRAY_FLAG, 0) ...
Add additional test for black object barrier
Add additional test for black object barrier
Python
mit
ntruessel/qcgc,ntruessel/qcgc,ntruessel/qcgc
7ef436dc909fdcb3ba917faddda585f8619bc5ed
testing/runtests.py
testing/runtests.py
# -*- coding: utf-8 -*- import os, sys os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from django.core.management import call_command if __name__ == "__main__": args = sys.argv[1:] if len(args) == 0: args.append("pg_array_fields") call_command("test", *args, verbosity=2)
# -*- coding: utf-8 -*- import os, sys os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from django.core.management import call_command if __name__ == "__main__": import django if django.VERSION[:2] >= (1, 7): django.setup() args = sys.argv[1:] if len(args) == 0: args.appen...
Fix running the tests against Django 1.7.
Fix running the tests against Django 1.7.
Python
bsd-3-clause
Natgeoed/djorm-ext-pgarray,natgeo/djorm-ext-pgarray,natgeo/djorm-ext-pgarray,niwinz/djorm-pgarray,niwinz/djorm-pgarray,Natgeoed/djorm-ext-pgarray
c6d7f2b1214e86f09431ab1d8e5c312f7a87081d
pttrack/views.py
pttrack/views.py
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect # Create your views here.from django.http import HttpResponse def index(request): return HttpResponse("Hello, world. You're at the BIG TABLE.") def clindate(request, clindate): (year, month, day) = clindate.split...
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.core.urlresolvers import reverse from . import models as mymodels # Create your views here.from django.http import HttpResponse def index(request): return HttpResponse("Hello, world. You're at the BIG TABL...
Set up redirect at db saves for new patients.
Set up redirect at db saves for new patients.
Python
mit
SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools
88d15544556cdfc9fe1f2e000f67846a8cd1bb25
stginga/__init__.py
stginga/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Ginga products specific to STScI data analysis. """ # Set up the version from pkg_resources import get_distribution, DistributionNotFound try: __version__ = get_distribution(__name__).version except DistributionNotFound: # package is not inst...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Ginga products specific to STScI data analysis. """ # Packages may add whatever they like to this file, but # should keep this content at the top. # ---------------------------------------------------------------------------- from ._astropy_init impor...
Remove duplicate version and restore test runner
BUG: Remove duplicate version and restore test runner
Python
bsd-3-clause
pllim/stginga,spacetelescope/stginga
721548eef3abaecb187b2246b58f90d74e0026ab
currencies/models.py
currencies/models.py
from django.db import models from django.utils.translation import gettext_lazy as _ class Currency(models.Model): code = models.CharField(_('code'), max_length=3) name = models.CharField(_('name'), max_length=35) symbol = models.CharField(_('symbol'), max_length=1) factor = models.DecimalField(_('fact...
from django.db import models from django.utils.translation import gettext_lazy as _ class Currency(models.Model): code = models.CharField(_('code'), max_length=3) name = models.CharField(_('name'), max_length=35) symbol = models.CharField(_('symbol'), max_length=1) factor = models.DecimalField(_('fact...
Improve the uniqueness of Currency.is_default
Improve the uniqueness of Currency.is_default
Python
bsd-3-clause
pathakamit88/django-currencies,barseghyanartur/django-currencies,racitup/django-currencies,mysociety/django-currencies,ydaniv/django-currencies,mysociety/django-currencies,jmp0xf/django-currencies,marcosalcazar/django-currencies,bashu/django-simple-currencies,ydaniv/django-currencies,racitup/django-currencies,pathakami...
2a8a13986b29bdc405fc922143e3407c81f196c0
timpani/settings.py
timpani/settings.py
from . import database def getAllSettings(): databaseConnection = database.ConnectionManager.getConnection("main") query = databaseConnection.session.query(database.tables.Setting) settings = query.all() return {setting.name: setting.value for setting in settings} def getSettingValue(name): databaseConnection = ...
from . import database def getAllSettings(): databaseConnection = database.ConnectionManager.getConnection("main") query = databaseConnection.session.query(database.tables.Setting) settings = query.all() return {setting.name: setting.value for setting in settings} def getSettingValue(name): databaseConnection = ...
Add setting validation function for title
Add setting validation function for title
Python
mit
ollien/Timpani,ollien/Timpani,ollien/Timpani
8c587107b73685a99df3358f8d219ed5c76e0a48
csunplugged/utils/check_glossary_links.py
csunplugged/utils/check_glossary_links.py
"""Module for checking glossary links found within Markdown conversions.""" from utils.errors.CouldNotFindGlossaryTerm import CouldNotFindGlossaryTerm from topics.models import GlossaryTerm def check_converter_glossary_links(glossary_links, md_file_path): """Process glossary links found by Markdown converter. ...
"""Module for checking glossary links found within Markdown conversions.""" from utils.errors.CouldNotFindGlossaryTerm import CouldNotFindGlossaryTerm from topics.models import GlossaryTerm def check_converter_glossary_links(glossary_links, md_file_path): """Process glossary links found by Markdown converter. ...
Use clearer Django method and exception for glossary term checking
Use clearer Django method and exception for glossary term checking
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
c3617c5662bb360f03db62df1e8f580502796562
spurl/tests.py
spurl/tests.py
# bootstrap django from django.conf import settings settings.configure()#INSTALLED_APPS=('spurl',)) from django.template import Template, Context, loader loader.add_to_builtins('spurl.templatetags.spurl') def render(template_string, dictionary=None): return Template(template_string).render(Context(dictionary)) ...
# bootstrap django from django.conf import settings settings.configure()#INSTALLED_APPS=('spurl',)) from django.template import Template, Context, loader loader.add_to_builtins('spurl.templatetags.spurl') def render(template_string, dictionary=None): return Template(template_string).render(Context(dictionary)) ...
Add test for url in template context
Add test for url in template context
Python
unlicense
albertkoch/django-spurl,pombredanne/django-spurl,j4mie/django-spurl
839d884d3dca3e799a235b1d2d69acf998f520f9
barsystem_base/management/commands/import_people.py
barsystem_base/management/commands/import_people.py
from django.core.management.base import BaseCommand, CommandError from barsystem_base.models import Person class Command(BaseCommand): args = '<filename>' help = 'Import list of people' csv_columns = 'id,first_name,last_name,nick_name,amount,type,token'.split(',') def handle(self, *args, **kwargs): ...
from django.core.management.base import BaseCommand, CommandError from barsystem_base.models import Person, Token class Command(BaseCommand): args = '<filename>' help = 'Import list of people' csv_columns = 'id,first_name,last_name,nick_name,amount,type,token'.split(',') def handle(self, *args, **kwa...
Add ibutton when importing old people
Add ibutton when importing old people
Python
mit
TkkrLab/barsystem,TkkrLab/barsystem,TkkrLab/barsystem
17cbd84b9b5a4bd08123ff5f429be191b1bdf063
polynomial.py
polynomial.py
class Polynomial(object): def __init__(self): pass
class Polynomial(object): def __init__(self, coeffs): """ 1 parameter: coeff (list): coeff[n] = coefficient of nth degree term """ self.coeffs = coeffs @property def coeffs(self): return self._coeffs @property def degree(self): return len(...
Add __init__, coeffs and degree attributes
Add __init__, coeffs and degree attributes
Python
mit
jackromo/mathLibPy
f41f9f9e562c6850d70ee17976c9dbb4aa3cca5f
pseudodata.py
pseudodata.py
class PseudoData(dict): def __init__(self, name_func_dict, sweep): super(PseudoData, self).__init__() self.name_func_dict = name_func_dict self.sweep = sweep def __getitem__(self, key): if key in self.keys(): return dict.__getitem__(self, key) elif key in sel...
class PseudoData(dict): def __init__(self, name_func_dict, sweep): super(PseudoData, self).__init__() self.name_func_dict = name_func_dict self.sweep = sweep def __getitem__(self, key): if key in self.keys(): return dict.__getitem__(self, key) elif key in sel...
Remove unused get_labels function and commented code
Remove unused get_labels function and commented code
Python
mit
mchels/FolderBrowser
657e98bfa2f2b55da4449c8271a108bf4f193e05
examples/recognize_faces_in_pictures.py
examples/recognize_faces_in_pictures.py
import face_recognition # Load the jpg files into numpy arrays biden_image = face_recognition.load_image_file("biden.jpg") obama_image = face_recognition.load_image_file("obama.jpg") unknown_image = face_recognition.load_image_file("obama2.jpg") # Get the face encodings for each face in each image file # Since there ...
import face_recognition # Load the jpg files into numpy arrays biden_image = face_recognition.load_image_file("biden.jpg") obama_image = face_recognition.load_image_file("obama.jpg") unknown_image = face_recognition.load_image_file("obama2.jpg") # Get the face encodings for each face in each image file # Since there ...
Handle bad image files in example
Handle bad image files in example
Python
mit
ageitgey/face_recognition
60be218bb33d1d965a363b0e187ddcc88191b2d7
Lib/cluster/__init__.py
Lib/cluster/__init__.py
# # cluster - Vector Quantization / Kmeans # from info import __doc__ __all__ = ['vq'] import vq
# # cluster - Vector Quantization / Kmeans # from info import __doc__ __all__ = ['vq'] import vq from numpy.testing import NumpyTest test = NumpyTest().test
Add missing test definition in scipy.cluster
Add missing test definition in scipy.cluster
Python
bsd-3-clause
ortylp/scipy,jjhelmus/scipy,arokem/scipy,jsilter/scipy,lukauskas/scipy,jsilter/scipy,jseabold/scipy,pnedunuri/scipy,zerothi/scipy,jamestwebber/scipy,pschella/scipy,vhaasteren/scipy,fredrikw/scipy,vanpact/scipy,minhlongdo/scipy,FRidh/scipy,aman-iitj/scipy,argriffing/scipy,vberaudi/scipy,FRidh/scipy,behzadnouri/scipy,Wil...
0b1813bef37819209ed9fb5b06eb7495d0e0e1fb
netmiko/arista/arista_ssh.py
netmiko/arista/arista_ssh.py
from netmiko.ssh_connection import SSHConnection class AristaSSH(SSHConnection): pass
import time from netmiko.ssh_connection import SSHConnection class AristaSSH(SSHConnection): def special_login_handler(self, delay_factor=1): """ Arista adds a "Last login: " message that doesn't always have sufficient time to be handled """ time.sleep(3 * delay_factor) sel...
Improve Arista reliability on slow login
Improve Arista reliability on slow login
Python
mit
fooelisa/netmiko,ktbyers/netmiko,shamanu4/netmiko,ktbyers/netmiko,shamanu4/netmiko,shsingh/netmiko,shsingh/netmiko,isidroamv/netmiko,fooelisa/netmiko,isidroamv/netmiko
c97153e9d91af27713afce506bc658daa6b1a0e2
docs/manual/docsmanage.py
docs/manual/docsmanage.py
#!/usr/bin/env python import os import sys sys.path.insert(0, os.path.join(__file__, "..", "..")) sys.path.insert(0, os.path.dirname(__file__)) from reviewboard import settings from django.core.management import execute_manager os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'reviewboard.settings') def scan_resou...
#!/usr/bin/env python import os import sys sys.path.insert(0, os.path.join(__file__, "..", "..")) sys.path.insert(0, os.path.dirname(__file__)) from reviewboard import settings from django.core.management import execute_from_command_line os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'reviewboard.settings') def ...
Fix building the manual with Django 1.6.
Fix building the manual with Django 1.6. This is a trivial change that just switches from calling execute_manager to execute_from_command_line, in order to build again on Django 1.6.
Python
mit
chipx86/reviewboard,custode/reviewboard,KnowNo/reviewboard,bkochendorfer/reviewboard,bkochendorfer/reviewboard,beol/reviewboard,sgallagher/reviewboard,bkochendorfer/reviewboard,reviewboard/reviewboard,reviewboard/reviewboard,davidt/reviewboard,brennie/reviewboard,KnowNo/reviewboard,custode/reviewboard,1tush/reviewboard...
d4f73eeccd30d884d0bd8a52ad1798b6f8a1366d
test/test-git-sap-lib.py
test/test-git-sap-lib.py
from git.repo.base import Repo def test_open_repo(): assert len(Repo().branches) > 0
from git.repo.base import Repo from unittest import TestCase class TestSequenceFunctions(TestCase): def test_open_repo(self): self.assertTrue(len(Repo().branches) > 0)
Switch over to pyunit from py.test
Switch over to pyunit from py.test
Python
apache-2.0
Yasumoto/sapling,jsirois/sapling,jsirois/sapling,Yasumoto/sapling
2124f859a74d4a3e00524af62d1122796804f048
test_utils/assertions.py
test_utils/assertions.py
""" Code originally from: http://www.aminus.org/blogs/index.php/2009/01/09/assertnodiff """ import difflib from pprint import pformat class DiffTestCaseMixin(object): def get_diff_msg(self, first, second, fromfile='First', tofile='Second'): """Return a unified diff between first and...
""" Code originally from: http://www.aminus.org/blogs/index.php/2009/01/09/assertnodiff """ import difflib from pprint import pformat class DiffTestCaseMixin(object): def get_diff_msg(self, first, second, fromfile='First', tofile='Second'): """Return a unified diff between first and...
Make failIfDiff work with dict keys and values.
Make failIfDiff work with dict keys and values.
Python
mit
frac/django-test-utils,ericholscher/django-test-utils,frac/django-test-utils,acdha/django-test-utils,acdha/django-test-utils,ericholscher/django-test-utils
6e013558940671257cd21972d755564faba38c5c
src/sentry/web/frontend/generic.py
src/sentry/web/frontend/generic.py
""" sentry.web.frontend.generic ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from django.views.generic import TemplateView as BaseTemplateView from sentry.web.helpers imp...
""" sentry.web.frontend.generic ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from django.views.generic import TemplateView as BaseTemplateView from sentry.web.helpers imp...
Cover more font extensions for CORS from static media
Cover more font extensions for CORS from static media We were missing woff2, but this should just future proof us if more are added.
Python
bsd-3-clause
mvaled/sentry,looker/sentry,ifduyue/sentry,jean/sentry,BuildingLink/sentry,mvaled/sentry,alexm92/sentry,ifduyue/sentry,fotinakis/sentry,JackDanger/sentry,gencer/sentry,jean/sentry,gencer/sentry,alexm92/sentry,zenefits/sentry,nicholasserra/sentry,jean/sentry,mvaled/sentry,fotinakis/sentry,ifduyue/sentry,jean/sentry,beef...
d3160598898702d750a3c7fa1910bb8655abcb3f
kay/management/app_template/urls.py
kay/management/app_template/urls.py
# -*- coding: utf-8 -*- # %app_name%.urls from werkzeug.routing import ( Map, Rule, Submount, EndpointPrefix, RuleTemplate, ) def make_rules(): return [ EndpointPrefix('%app_name%/', [ Rule('/', endpoint='index'), ]), ] all_views = { '%app_name%/index': '%app_name%.views.index', }
# -*- coding: utf-8 -*- # %app_name%.urls from kay.view_group import ( ViewGroup, URL ) view_groups = [ ViewGroup(URL('/', endpoint='index', view='%app_name%.views.index')) ]
Use a new interface for urlmapping in application template.
Use a new interface for urlmapping in application template.
Python
bsd-3-clause
IanLewis/kay,IanLewis/kay,IanLewis/kay,IanLewis/kay
173ee66df6a45c979df599422efc3f35bb41a243
neuroshare/EventEntity.py
neuroshare/EventEntity.py
from Entity import * class EventEntity(Entity): EVENT_TEXT = 1 EVENT_CSV = 2 EVENT_BYTE = 3 EVENT_WORD = 4 EVENT_DWORD = 5 def __init__(self, nsfile, eid, info): super(EventEntity,self).__init__(eid, nsfile, info) @property def event_type(self): return self._info...
from Entity import * class EventEntity(Entity): """Event entities represent specific timepoints with associated data, e.g. a trigger events. Data can be binary (8, 16 or 32 bit) values, text or comma separated values (cvs). """ EVENT_TEXT = 1 EVENT_CSV = 2 EVENT_BYTE = 3 EVENT_WORD...
Add simple docs to Event entities
doc: Add simple docs to Event entities
Python
lgpl-2.1
abhay447/python-neuroshare,abhay447/python-neuroshare,G-Node/python-neuroshare,G-Node/python-neuroshare
63ba7b3f21f21d77ca72eca4503ad6edf3986ed5
src/nodeconductor_openstack/tests/unittests/test_handlers.py
src/nodeconductor_openstack/tests/unittests/test_handlers.py
from django.test import TestCase from .. import factories class FloatingIpHandlersTest(TestCase): def test_floating_ip_count_quota_increases_on_floating_ip_creation(self): tenant = factories.TenantFactory() factories.FloatingIPFactory(service_project_link=tenant.service_project_link, status='UP'...
from django.test import TestCase from .. import factories class FloatingIpHandlersTest(TestCase): def test_floating_ip_count_quota_increases_on_floating_ip_creation(self): tenant = factories.TenantFactory() factories.FloatingIPFactory( service_project_link=tenant.service_project_link...
Fix floating IP unit test.
Fix floating IP unit test.
Python
mit
opennode/nodeconductor-openstack
19e0deeb65a4e66e5ab623702701d82f1994d594
world_population.py
world_population.py
import json #load data onto a list filename = 'population_data.json' with open(filename) as f: pop_data = json.load(f) #print the 2010 population for each country for pop_dict in pop_data: if pop_dict['Year'] == '2010': country_name = pop_dict['Country Name'] population = pop_dict['Value'] ...
import json #load data onto a list filename = 'population_data.json' with open(filename) as f: pop_data = json.load(f) #print the 2010 population for each country for pop_dict in pop_data: if pop_dict['Year'] == '2010': country_name = pop_dict['Country Name'] population = int(float(pop_dict['V...
Convert Strings into Numerical Values
Convert Strings into Numerical Values
Python
mit
4bic-attic/data_viz
593964161e260b5b34e557d0d90485d457595063
tests/test_utils.py
tests/test_utils.py
"""Tests for the ``utils`` module.""" from mock import patch, Mock as mock from nose.tools import * from facepy import * patch = patch('requests.session') def setup_module(): global mock_request mock_request = patch.start()().request def teardown_module(): patch.stop() def test_get_application_access...
"""Tests for the ``utils`` module.""" from mock import patch, Mock as mock from nose.tools import * from facepy import * patch = patch('requests.session') def mock(): global mock_request mock_request = patch.start()().request def unmock(): patch.stop() @with_setup(mock, unmock) def test_get_applicati...
Add test for failing get_application_access_token
Add test for failing get_application_access_token
Python
mit
merwok-forks/facepy,jwjohns/facepy,jgorset/facepy,liorshahverdi/facepy,Spockuto/facepy,buzzfeed/facepy,jwjohns/facepy
906d60089dbe6b263ae55d91ba73d6b6e41ebbb5
api/admin.py
api/admin.py
from django.contrib import admin from .models import MaintenanceRecord, UserPreferences @admin.register(UserPreferences) class UserPreferencesAdmin(admin.ModelAdmin): list_display = ["user", "show_beta_interface", "airport_ui", "created_date", "modified_date"] list_filter = [ "show_beta_interface", "...
from django.contrib import admin from .models import MaintenanceRecord, UserPreferences, HelpLink @admin.register(UserPreferences) class UserPreferencesAdmin(admin.ModelAdmin): list_display = ["user", "show_beta_interface", "airport_ui", "created_date", "modified_date"] list_filter = [ "show_beta_int...
Add entire in Admin for managing HelpLink
Add entire in Admin for managing HelpLink An admin can _only_ modify the hyperlink associated with a HelpLink. As a consequence, you cannot add new instances of the model nor delete them. Only the existing HelpLinks can be modified because their inclusion (or existence) is dependent upon the usage within the UI. If ...
Python
apache-2.0
CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend
2b3e281c228a4efa9483362f10eac74ce4da6178
parliament/legacy_urls.py
parliament/legacy_urls.py
from django.conf.urls import url from parliament.core.utils import redir_view from parliament.hansards.redirect_views import hansard_redirect urlpatterns = [ url(r'^hansards/$', redir_view('parliament.hansards.views.index')), url(r'^hansards/year/(?P<year>\d{4})/$', redir_view('parliament.hansards.views.by_ye...
from django.conf.urls import url from parliament.core.utils import redir_view from parliament.hansards.redirect_views import hansard_redirect urlpatterns = [ url(r'^hansards/$', redir_view('debates')), url(r'^hansards/year/(?P<year>\d{4})/$', redir_view('debates_by_year')), url(r'^hansards/(?P<hansard_id>...
Fix a couple of redirect URLs
Fix a couple of redirect URLs
Python
agpl-3.0
litui/openparliament,litui/openparliament,rhymeswithcycle/openparliament,rhymeswithcycle/openparliament,rhymeswithcycle/openparliament,litui/openparliament
4c4b09e1bfbd60bfe1453c5a3b3e8f13d2eaa4ce
comet/tcp/test/test_voeventsubscriber.py
comet/tcp/test/test_voeventsubscriber.py
from twisted.trial import unittest from twisted.test import proto_helpers from ...test.support import DUMMY_EVENT_IVORN as DUMMY_IVORN from ..protocol import VOEventSubscriber from ..protocol import VOEventSubscriberFactory class VOEventSubscriberFactoryTestCase(unittest.TestCase): def setUp(self): facto...
from twisted.internet import task from twisted.trial import unittest from twisted.test import proto_helpers from ...test.support import DUMMY_EVENT_IVORN as DUMMY_IVORN from ..protocol import VOEventSubscriber from ..protocol import VOEventSubscriberFactory class VOEventSubscriberFactoryTestCase(unittest.TestCase): ...
Add test for subscriber timeout
Add test for subscriber timeout
Python
bsd-2-clause
jdswinbank/Comet,jdswinbank/Comet
6c6d7e3dc2c61b13d17f30ddd7607a4dfb2ef86d
nova/policies/migrate_server.py
nova/policies/migrate_server.py
# Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
# Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
Introduce scope_types in migrate server
Introduce scope_types in migrate server oslo.policy introduced the scope_type feature which can control the access level at system-level and project-level. - https://docs.openstack.org/oslo.policy/latest/user/usage.html#setting-scope - http://specs.openstack.org/openstack/keystone-specs/specs/keystone/queens/system-...
Python
apache-2.0
klmitch/nova,openstack/nova,openstack/nova,mahak/nova,klmitch/nova,mahak/nova,klmitch/nova,openstack/nova,mahak/nova,klmitch/nova
e0510ea02ad1998973a9e0733f2342b06ddcf182
test/python_api/default-constructor/sb_breakpointlocation.py
test/python_api/default-constructor/sb_breakpointlocation.py
""" Fuzz tests an object after the default construction to make sure it does not crash lldb. """ import sys import lldb def fuzz_obj(obj): obj.GetLoadAddress() obj.SetEnabled(True) obj.IsEnabled() obj.SetCondition("i >= 10") obj.GetCondition() obj.SetThreadID(0) obj.GetThreadID() obj.S...
""" Fuzz tests an object after the default construction to make sure it does not crash lldb. """ import sys import lldb def fuzz_obj(obj): obj.GetAddress() obj.GetLoadAddress() obj.SetEnabled(True) obj.IsEnabled() obj.SetCondition("i >= 10") obj.GetCondition() obj.SetThreadID(0) obj.Ge...
Add fuzz call for SBBreakpointLocation.GetAddress().
Add fuzz call for SBBreakpointLocation.GetAddress(). git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@141443 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb
5a5e4341f60ac70c7f4182ef2f248a3c518ba0fb
timesketch/apps/sketch/migrations/0010_auto_20141110_1129.py
timesketch/apps/sketch/migrations/0010_auto_20141110_1129.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('sketch', '0009_merge'), ] operat...
# -*- coding: utf-8 -*- # Auto generated by Django migrate from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('sketch...
Add auto generated note on migration
Add auto generated note on migration
Python
apache-2.0
lockhy/timesketch,armuk/timesketch,lockhy/timesketch,google/timesketch,google/timesketch,armuk/timesketch,armuk/timesketch,google/timesketch,lockhy/timesketch,lockhy/timesketch,google/timesketch,armuk/timesketch
a6d05f3c1a33381a07d459c1fdff93bc4ba30594
pidman/pid/migrations/0002_pid_sequence_initial_value.py
pidman/pid/migrations/0002_pid_sequence_initial_value.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from pidman.pid.noid import decode_noid from pidman.pid import models as pid_models def pid_sequence_lastvalue(apps, schema_editor): # if the database has existing pids, update the sequence last value # s...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from pidman.pid.noid import decode_noid, encode_noid from pidman.pid import models as pid_models def pid_sequence_lastvalue(apps, schema_editor): # if the database has existing pids, update the sequence last ...
Fix max noid detection when setting pid sequence
Fix max noid detection when setting pid sequence
Python
apache-2.0
emory-libraries/pidman,emory-libraries/pidman
eedb22b1be419130ffc4a349c3ec4b83879b44bd
client/demo_assignments/hw1_tests.py
client/demo_assignments/hw1_tests.py
"""Tests for hw1 demo assignment.""" TEST_INFO = { 'assignment': 'hw1', 'imports': ['from hw1 import *'], } TESTS = [ # Test square { 'name': ('Q1', 'q1', '1'), 'suites': [ [ ['square(4)', '16'], ['square(-5)', '25'], ], ...
"""Tests for hw1 demo assignment.""" assignment = { 'name': 'hw1', 'imports': ['from hw1 import *'], 'version': '1.0', # Specify tests that should not be locked 'no_lock': { }, 'tests': [ # Test square { # The first name is the "official" name. 'name': ['Q1', 'q1', '1'], # No ...
Make proposed testing format with demo assignment
Make proposed testing format with demo assignment
Python
apache-2.0
jordonwii/ok,jackzhao-mj/ok,jackzhao-mj/ok,Cal-CS-61A-Staff/ok,jordonwii/ok,Cal-CS-61A-Staff/ok,jackzhao-mj/ok,Cal-CS-61A-Staff/ok,jordonwii/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,jordonwii/ok,jackzhao-mj/ok
7d6c5ead9f754606d732db8566311c4d3e6fe54f
tests.py
tests.py
"""Tests runner for modoboa_admin.""" import unittest from modoboa.lib.test_utils import TestRunnerMixin class TestRunner(TestRunnerMixin, unittest.TestCase): """The tests runner.""" extension = "modoboa_admin_limits"
"""Tests runner for modoboa_admin.""" import unittest from modoboa.lib.test_utils import TestRunnerMixin class TestRunner(TestRunnerMixin, unittest.TestCase): """The tests runner.""" extension = "modoboa_admin_limits" dependencies = [ "modoboa_admin" ]
Make sure to activate modoboa_admin.
Make sure to activate modoboa_admin.
Python
mit
disko/modoboa-admin-limits,disko/modoboa-admin-limits
f5f7eb086aff7cdc61bbfa850b638db5b7e0d211
tests/test_order.py
tests/test_order.py
# -*- coding: utf-8 -*- """Functional tests using WebTest. See: http://webtest.readthedocs.org/ TESTS MUST START WITH "test" """ from flask import url_for class TestBreakTheOrder: """ Breaking the order """ def test_order_is_not_not_found(self, testapp): """ There actually is an order.....
# -*- coding: utf-8 -*- """Functional tests using WebTest. See: http://webtest.readthedocs.org/ TESTS MUST START WITH "test" """ from flask import url_for class TestBreakTheOrder: """ Breaking the order """ def test_order_gives_401_without_login(self, testapp): """ There actually is a...
Update test order to check for 401.
Update test order to check for 401.
Python
bsd-3-clause
robin-lee/store,tankca/store,tankca/store,William93/store,boomcan90/store,tankca/store,William93/store,William93/store,robin-lee/store,boomcan90/store,robin-lee/store,boomcan90/store
7a057ba74a5914f8d7f8db3646feb5cb06a74cef
ml/pytorch/image_classification/image_classifier.py
ml/pytorch/image_classification/image_classifier.py
# %load_ext autoreload # %autoreload 2 import torch from torch import nn from torch.autograd import Variable def accuracy(preds, labels): return (preds==labels).mean() def n_correct(preds, labels): return (preds==labels).sum() class ImageClassifier(object): def __init__(self, net, n_classes): ""...
# %load_ext autoreload # %autoreload 2 import torch from torch import nn from torch.autograd import Variable def accuracy(preds, labels): return (preds==labels).mean() def n_correct(preds, labels): return (preds==labels).sum() class ImageClassifier(object): def __init__(self, net, n_classes): ""...
Add set_optimizer method to pytorch ImageClassifier class
FEAT: Add set_optimizer method to pytorch ImageClassifier class
Python
apache-2.0
ronrest/convenience_py,ronrest/convenience_py
d163644d3c2f0a9f5d08da753e0b97506f6ff6b3
rollbar/test/async_helper.py
rollbar/test/async_helper.py
import asyncio import inspect import sys from rollbar.contrib.asgi import ASGIApp def run(coro): if sys.version_info >= (3, 7): return asyncio.run(coro) assert inspect.iscoroutine(coro) loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) try: return loop.run_until_compl...
import asyncio import inspect import sys from rollbar.contrib.asgi import ASGIApp def run(coro): if sys.version_info >= (3, 7): return asyncio.run(coro) assert inspect.iscoroutine(coro) loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) try: return loop.run_until_compl...
Add wrapper for async receive event handler
Add wrapper for async receive event handler
Python
mit
rollbar/pyrollbar
4d19cc36e866c8e21a526cd228f170ffd177292b
run_ctest.py
run_ctest.py
#!/usr/bin/python # -*- coding: utf-8 -*- import platform import os import subprocess import sys if platform.system() == "Windows": import distutils.msvc9compiler as msvc if __name__ == "__main__": CITOOLS_PATH = os.path.join(os.getcwd(), "ci-tools") CMAKE_PATH = os.path.join(CITOOLS_PATH, "cmake") ...
#!/usr/bin/python # -*- coding: utf-8 -*- import platform import os import subprocess if __name__ == "__main__": CITOOLS_PATH = os.path.join(os.getcwd(), "ci-tools") CMAKE_PATH = os.path.join(CITOOLS_PATH, "cmake") if platform.system() == "Linux": os.environ["PATH"] = os.path.join(CMAKE_PATH, "bi...
Test travisci windows build workaround. (3)
Test travisci windows build workaround. (3)
Python
unlicense
h-s-c/ci-tools
ed7308df6fc324581482d7508394a34a35cbf65c
xorshift/__init__.py
xorshift/__init__.py
from operator import mul import xorshift.xorgen def _compute_n_elements(shape): if shape is None: shape = (1,) try: nelts = reduce(mul, shape) except TypeError: nelts = int(shape) shape = (shape, ) return nelts, shape class _Generator(object): def uniform(self, l...
from operator import mul import xorshift.xorgen def _compute_n_elements(shape): if shape is None: shape = (1,) try: nelts = reduce(mul, shape) except TypeError: nelts = int(shape) shape = (shape, ) return nelts, shape class _Generator(object): def uniform(self, l...
Add optional copy on return
Add optional copy on return
Python
mit
ihaque/xorshift,ihaque/xorshift
f3974375e2c71c9c9bfba6fde356014a07e0b704
ee_plugin/ee_auth.py
ee_plugin/ee_auth.py
# -*- coding: utf-8 -*- """ Init and user authentication in Earth Engine """ import webbrowser from qgis.PyQt.QtWidgets import QInputDialog import ee def init(): try: ee.Initialize() except ee.ee_exception.EEException: authenticate() ee.Initialize() # retry initialization once the us...
# -*- coding: utf-8 -*- """ Init and user authentication in Earth Engine """ import webbrowser from qgis.PyQt.QtWidgets import QInputDialog import ee import logging # fix the warnings/errors messages from 'file_cache is unavailable when using oauth2client' # https://github.com/googleapis/google-api-python-client/issu...
Fix the warnings/errors messages from 'file_cache is unavailable when using oauth2client'
Fix the warnings/errors messages from 'file_cache is unavailable when using oauth2client'
Python
mit
gena/qgis-earthengine-plugin,gena/qgis-earthengine-plugin
34641c012d740d38e7ce8ef9619722177665da3f
fireplace/cards/tgt/shaman.py
fireplace/cards/tgt/shaman.py
from ..utils import * ## # Hero Powers # Lightning Jolt class AT_050t: play = Hit(TARGET, 2) ## # Minions # Tuskarr Totemic class AT_046: play = Summon(CONTROLLER, RandomTotem()) # Draenei Totemcarver class AT_047: play = Buff(SELF, "AT_047e") * Count(FRIENDLY_MINIONS + TOTEM) # Thunder Bluff Valiant class...
from ..utils import * ## # Minions # Tuskarr Totemic class AT_046: play = Summon(CONTROLLER, RandomTotem()) # Draenei Totemcarver class AT_047: play = Buff(SELF, "AT_047e") * Count(FRIENDLY_MINIONS + TOTEM) # Thunder Bluff Valiant class AT_049: inspire = Buff(FRIENDLY_MINIONS + TOTEM, "AT_049e") # The Mistc...
Fix Charged Hammer / Lightning Jolt
Fix Charged Hammer / Lightning Jolt
Python
agpl-3.0
liujimj/fireplace,Ragowit/fireplace,jleclanche/fireplace,NightKev/fireplace,Ragowit/fireplace,Meerkov/fireplace,oftc-ftw/fireplace,Meerkov/fireplace,smallnamespace/fireplace,amw2104/fireplace,beheh/fireplace,oftc-ftw/fireplace,liujimj/fireplace,smallnamespace/fireplace,amw2104/fireplace
f915000cf88a80beadc725ab10e48d2b14d1be23
enlighten/counter.py
enlighten/counter.py
# -*- coding: utf-8 -*- # Copyright 2017 - 2019 Avram Lubkin, All Rights Reserved # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """ **Enlighten counter submodule** ...
# -*- coding: utf-8 -*- # Copyright 2017 - 2019 Avram Lubkin, All Rights Reserved # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """ **Enlighten counter submodule** ...
Use get_manager() for Counter direct
Use get_manager() for Counter direct
Python
mpl-2.0
Rockhopper-Technologies/enlighten
da40ff6b02d158612883ac7e61faf48da85c7d90
saleor/core/models.py
saleor/core/models.py
from django.db import models from django.utils.translation import pgettext_lazy from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Setting(models.Model): INTEGER = 'i' STRING = 's' BOOLEAN = 'b' VALUE_TYPE_CHOICES = ( (INTEGER, pgettext_lazy('Setti...
from django.db import models from django.utils.translation import pgettext_lazy from django.utils.encoding import python_2_unicode_compatible INTEGER = 'i' STRING = 's' BOOLEAN = 'b' @python_2_unicode_compatible class Setting(models.Model): VALUE_TYPE_CHOICES = ( (INTEGER, pgettext_lazy('Settings', 'Int...
Move choices outside of model class
Move choices outside of model class
Python
bsd-3-clause
mociepka/saleor,HyperManTT/ECommerceSaleor,tfroehlich82/saleor,itbabu/saleor,HyperManTT/ECommerceSaleor,tfroehlich82/saleor,jreigel/saleor,itbabu/saleor,itbabu/saleor,UITools/saleor,UITools/saleor,car3oon/saleor,tfroehlich82/saleor,maferelo/saleor,HyperManTT/ECommerceSaleor,UITools/saleor,car3oon/saleor,UITools/saleor,...
5cf4603efb1d0fc8bd8ec44bf3aa19a292403cdf
beaver/redis_transport.py
beaver/redis_transport.py
import datetime import redis import time import urlparse import beaver.transport class RedisTransport(beaver.transport.Transport): def __init__(self, beaver_config, file_config, logger=None): super(RedisTransport, self).__init__(beaver_config, file_config, logger=logger) redis_url = beaver_conf...
import datetime import redis import time import urlparse import beaver.transport class RedisTransport(beaver.transport.Transport): def __init__(self, beaver_config, file_config, logger=None): super(RedisTransport, self).__init__(beaver_config, file_config, logger=logger) redis_url = beaver_conf...
Use redis pipelining when sending events
Use redis pipelining when sending events
Python
mit
python-beaver/python-beaver,rajmarndi/python-beaver,jlambert121/beaver,davidmoravek/python-beaver,Appdynamics/beaver,rajmarndi/python-beaver,Appdynamics/beaver,timstoop/python-beaver,davidmoravek/python-beaver,imacube/python-beaver,PierreF/beaver,timstoop/python-beaver,zuazo-forks/beaver,doghrim/python-beaver,Open-Part...
8cf8e1b5aa824d691850e0cb431e56744f699a92
bin/task_usage_analyze.py
bin/task_usage_analyze.py
#!/usr/bin/env python3 import os, sys sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib')) import glob, json import matplotlib.pyplot as pp import support def main(index_path, min_length=0, max_length=100, report_each=1000000): support.figure() print('Loading the index from "{}"...'.format(...
#!/usr/bin/env python3 import os, sys sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib')) import glob, json import matplotlib.pyplot as pp import support def main(index_path, min_length=0, max_length=100, report_each=1000000): support.figure() print('Loading the index from "{}"...'.format(...
Adjust the number of bins
Adjust the number of bins
Python
mit
learning-on-chip/google-cluster-prediction
72ec3088f6eafd20dce15d742dc9d93b4087cc50
build/extract_from_cab.py
build/extract_from_cab.py
#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Extracts a single file from a CAB archive.""" import os import subprocess import sys def main(): if len(sys.argv) != 4: ...
#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Extracts a single file from a CAB archive.""" import os import subprocess import sys def main(): if len(sys.argv) != 4: ...
Add automatic retry of cab extraction.
Add automatic retry of cab extraction. It fails occasionally with: One or more files could not be expanded. Delta Package Expander Returned 0x80070002 Expanding File ..\third_party\directxsdk\files\redist\jun2010_d3dx9_43_x86.cab Incomplete, Error Code=0x80070002 Error Description: The system cannot find the file spec...
Python
bsd-3-clause
axinging/chromium-crosswalk,anirudhSK/chromium,hgl888/chromium-crosswalk-efl,markYoungH/chromium.src,junmin-zhu/chromium-rivertrail,dushu1203/chromium.src,axinging/chromium-crosswalk,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,mogoweb/chromium-crosswalk,Fireblend/chromium-crosswalk,dushu1203/chromium.src,fujunwei...
62b90eb97c9e32280f7f1a9c1127099f20440c11
byceps/config_defaults.py
byceps/config_defaults.py
""" byceps.config_defaults ~~~~~~~~~~~~~~~~~~~~~~ Default configuration values :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from datetime import timedelta from pytz import timezone # database connection SQLALCHEMY_ECHO = False # Disable Flask-SQLAlchemy's tracki...
""" byceps.config_defaults ~~~~~~~~~~~~~~~~~~~~~~ Default configuration values :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from datetime import timedelta from pytz import timezone # database connection SQLALCHEMY_ECHO = False # Disable Flask-SQLAlchemy's tracki...
Set required background color for RQ dashboard
Set required background color for RQ dashboard BYCEPS doesn't use ra dashboard's default settings, so they need to be set explicitly as necessary.
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps
2f1bcd83bf9069e5fc599aa20e1ed533bebd5e67
Detect_Face_Sides.py
Detect_Face_Sides.py
import numpy as np def get_leftside_average(self): """Return Array of Left Most Points.""" width = self.size[0] height = self.size[1] left_most_points = [] for row in range(height): for column in range(width): if image.getpixel(row, column) > 200: left_most_point...
import numpy as np def get_leftside_average(self): """Return the value of the Average of the left_most_points.""" width = self.size[0] height = self.size[1] left_most_points = [] for row in range(height): for column in range(width): if image.getpixel(row, column) > 200: ...
Add get_rightside_face and Fix bug
Add get_rightside_face and Fix bug
Python
mit
anassinator/codejam-2014,anassinator/codejam
66b7715ada14051f2e54b061e09c896a6e7d3844
openahjo_activity_streams/server.py
openahjo_activity_streams/server.py
# Copyright (c) 2015 ThoughtWorks # # See the file LICENSE for copying permission. import os import flask from openahjo_activity_streams import convert import requests import logging import json OPENAHJO_URL = 'http://dev.hel.fi/paatokset/v1/agenda_item/?order_by=-last_modified_time' def create_app(remote_url=OPENA...
# Copyright (c) 2015 ThoughtWorks # # See the file LICENSE for copying permission. import flask from openahjo_activity_streams import convert import requests import logging import json OPENAHJO_URL = 'http://dev.hel.fi/paatokset/v1/agenda_item/?order_by=-last_modified_time' def create_app(remote_url=OPENAHJO_URL, c...
Revert "CW + AW | 225 | add instance path when building app"
Revert "CW + AW | 225 | add instance path when building app" This reverts commit 9aa8d2ec4f49dfe8261893de70887052cf134bd5.
Python
mit
d-cent/HelsinkiActivityStream,ThoughtWorksInc/HelsinkiActivityStream,d-cent/HelsinkiActivityStream,d-cent/HelsinkiActivityStream,ThoughtWorksInc/HelsinkiActivityStream,ThoughtWorksInc/HelsinkiActivityStream
02bf1d3c37904af6b9ab41e05c23ed7e5cebc0f7
kolibri/core/auth/migrations/0016_add_adhoclearnersgroup_collection_kind.py
kolibri/core/auth/migrations/0016_add_adhoclearnersgroup_collection_kind.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.23 on 2019-12-04 04:59 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("kolibriauth", "0015_facilitydataset_registered")] operations = [ migrations.CreateModel...
# -*- coding: utf-8 -*- # Generated by Django 1.11.23 on 2019-12-04 04:59 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("kolibriauth", "0015_facilitydataset_registered")] operations = [ migrations.CreateModel...
Fix migration file for new collection kind name
Fix migration file for new collection kind name
Python
mit
indirectlylit/kolibri,mrpau/kolibri,indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,learningequality/kolibri,mrpau/kolibri,learningequality/kolibri,mrpau/kolibri,mrpau/kolibri,learningequality/kolibri
c6d68c78ac9391138d2f433248e35dc6fdd1cf98
setup_egg.py
setup_egg.py
#!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Wrapper to run setup.py using setuptools.""" if __name__ == '__main__': exec('setup.py', dict(__name__='__main__', __file__='setup.py', # needed in s...
#!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Wrapper to run setup.py using setuptools.""" if __name__ == '__main__': with open('setup.py') as f: exec(f.read(), dict(__name__='__main__', ...
Update call to `exec` to read the file in and execute the code.
Update call to `exec` to read the file in and execute the code.
Python
bsd-3-clause
FrancoisRheaultUS/dipy,FrancoisRheaultUS/dipy
c140c1a6d32c2caaf9f0e5a87efd219b9573608a
shub/tool.py
shub/tool.py
import click, importlib from shub.utils import missing_modules def missingmod_cmd(modules): modlist = ", ".join(modules) @click.command(help="*DISABLED* - requires %s" % modlist) @click.pass_context def cmd(ctx): click.echo("Error: '%s' command requires %s" % (ctx.info_name, modlist)) c...
import click, importlib from shub.utils import missing_modules def missingmod_cmd(modules): modlist = ", ".join(modules) @click.command(help="*DISABLED* - requires %s" % modlist) @click.pass_context def cmd(ctx): click.echo("Error: '%s' command requires %s" % (ctx.info_name, modlist)) c...
Use hifens instead of underscore for command names
Use hifens instead of underscore for command names
Python
bsd-3-clause
scrapinghub/shub
a54127994b110e65423b9ef956ed3b26dfc10d2d
tyr/servers/zookeeper/server.py
tyr/servers/zookeeper/server.py
from tyr.servers.server import Server class ZookeeperServer(Server): SERVER_TYPE = 'zookeeper' CHEF_RUNLIST = ['role[RoleZookeeper]'] IAM_ROLE_POLICIES = [ 'allow-describe-instances', 'allow-describe-tags', 'allow-volume-control' ] def __init__(self, group=None, server_...
from tyr.servers.server import Server class ZookeeperServer(Server): SERVER_TYPE = 'zookeeper' CHEF_RUNLIST = ['role[RoleZookeeper]'] IAM_ROLE_POLICIES = [ 'allow-describe-instances', 'allow-describe-tags', 'allow-volume-control' ] def __init__(self, group=None, server_...
Add exhibitor_s3config option to Zookeeper creation
Add exhibitor_s3config option to Zookeeper creation
Python
unlicense
hudl/Tyr
8ba05402376dc2d368bae226f929b9a0b448a3c5
localized_fields/admin.py
localized_fields/admin.py
from django.contrib.admin import ModelAdmin from . import widgets from .fields import LocalizedField, LocalizedCharField, LocalizedTextField, \ LocalizedFileField FORMFIELD_FOR_LOCALIZED_FIELDS_DEFAULTS = { LocalizedField: {'widget': widgets.AdminLocalizedFieldWidget}, LocalizedCharField: {'widget': widg...
from . import widgets from .fields import LocalizedField, LocalizedCharField, LocalizedTextField, \ LocalizedFileField FORMFIELD_FOR_LOCALIZED_FIELDS_DEFAULTS = { LocalizedField: {'widget': widgets.AdminLocalizedFieldWidget}, LocalizedCharField: {'widget': widgets.AdminLocalizedCharFieldWidget}, Local...
Fix using LocalizedFieldsAdminMixin with inlines
Fix using LocalizedFieldsAdminMixin with inlines
Python
mit
SectorLabs/django-localized-fields,SectorLabs/django-localized-fields,SectorLabs/django-localized-fields
5eced1c1cb9253d73e3246dccb4c33e5ba154fd3
rcbi/rcbi/spiders/FlyduinoSpider.py
rcbi/rcbi/spiders/FlyduinoSpider.py
import scrapy from scrapy import log from scrapy.contrib.spiders import SitemapSpider, Rule from scrapy.contrib.linkextractors import LinkExtractor from rcbi.items import Part MANUFACTURERS = ["Rctimer", "RCTimer", "BaseCam", "Elgae", "ELGAE", "ArduFlyer", "Boscam", "T-Motor", "HQProp", "Suppo", "Flyduino", "SLS", "Fr...
import scrapy from scrapy import log from scrapy.spiders import CrawlSpider, Rule from scrapy.linkextractors import LinkExtractor from rcbi.items import Part MANUFACTURERS = ["Rctimer", "RCTimer", "BaseCam", "Elgae", "ELGAE", "ArduFlyer", "Boscam", "T-Motor", "HQProp", "Suppo", "Flyduino", "SLS", "Frsky"] CORRECT = {"...
Stop using the Flyduino sitemap.
Stop using the Flyduino sitemap.
Python
apache-2.0
rcbuild-info/scrape,rcbuild-info/scrape
adf71b59168c81240258a2b344e4bea1f6377e7b
etools/apps/uptime/forms/report_forms.py
etools/apps/uptime/forms/report_forms.py
from django import forms from bootstrap3_datetime.widgets import DateTimePicker class ChooseReportForm(forms.Form): date_from = forms.DateField( widget=DateTimePicker(options={"locale": "ru", "pickTime": False}), label='От даты:', ) date = forms.Dat...
from django import forms from bootstrap3_datetime.widgets import DateTimePicker class ChooseReportForm(forms.Form): date_from = forms.DateField( widget=DateTimePicker(options={"locale": "ru", "pickTime": False, "startDate": "1/...
Fix minimum date for uptime:reports
Fix minimum date for uptime:reports
Python
bsd-3-clause
Igelinmist/etools,Igelinmist/etools
1d03917856c193e41b4a1622f8297e88fec00ab2
damn/templatetags/damn.py
damn/templatetags/damn.py
from django import template from damn.processors import find_processor from damn.utils import AssetRegistry, DepNode register = template.Library() class AssetsNode(template.Node): def __init__(self, nodelist): self.nodelist = nodelist def render(self, context): context.render_context['AM...
from django import template from ..processors import find_processor, AssetRegistry register = template.Library() class AssetsNode(template.Node): def __init__(self, nodelist): self.nodelist = nodelist def render(self, context): context.render_context['AMN'] = AssetRegistry() con...
Fix simpletag -> simple_tag Fix imports
Fix simpletag -> simple_tag Fix imports
Python
bsd-2-clause
funkybob/django-amn
fe1b9ad1f65ac27c5bc3d02acaf473f001609e73
relayer/flask/__init__.py
relayer/flask/__init__.py
from typing import Any from flask import Flask from relayer import Relayer class FlaskRelayer(object): def __init__(self, app: Flask, logging_topic: str, kafka_hosts: str = None, **kwargs: str) -> None: if app: self.init_app( app, logging_topic, ...
from typing import Any from flask import Flask from relayer import Relayer class FlaskRelayer(object): def __init__(self, app: Flask = None, logging_topic: str = None, kafka_hosts: str = None, **kwargs: str) -> None: if app: self.init_app( app, logging_topic, ...
Use default arguments removed by mypy
Use default arguments removed by mypy
Python
mit
wizeline/relayer
d6a00b0cf70d778e4671ce8aa1c9b115410fcc33
studygroups/migrations/0034_create_facilitators_group.py
studygroups/migrations/0034_create_facilitators_group.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def create_facilitators_group(apps, schema_editor): Group = apps.get_model("auth", "Group") group = Group(name="facilitators") group.save() class Migration(migrations.Migration): dependencies = ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def create_facilitators_group(apps, schema_editor): Group = apps.get_model("auth", "Group") Group.objects.get_or_create(name="facilitators") class Migration(migrations.Migration): dependencies = [ ...
Change data migration to work even if facilitator group already exists
Change data migration to work even if facilitator group already exists
Python
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
a137e8a92211d3d344a38b5c97d81073d66a1668
alembic/versions/17c1af634026_extract_publication_date.py
alembic/versions/17c1af634026_extract_publication_date.py
"""Populate the `publication_date` column. Revision ID: 17c1af634026 Revises: 3c4c29f0a791 Create Date: 2012-12-13 21:03:03.445346 """ # revision identifiers, used by Alembic. revision = '17c1af634026' down_revision = '3c4c29f0a791' import html5lib from dateutil.parser import parse as parse_date import pytips fro...
"""Populate the `publication_date` column. Revision ID: 17c1af634026 Revises: 3c4c29f0a791 Create Date: 2012-12-13 21:03:03.445346 """ # revision identifiers, used by Alembic. revision = '17c1af634026' down_revision = '3c4c29f0a791' import html5lib from dateutil.parser import parse as parse_date import pytips fro...
Use the utility module's extract_publication_date logic.
Use the utility module's extract_publication_date logic.
Python
isc
gthank/pytips,gthank/pytips,gthank/pytips,gthank/pytips
c76b6f4d5e4b6b24b12a712b062fe7ffe0aedda5
base/broadcast.py
base/broadcast.py
from abc import ABCMeta, abstractmethod import socket, json class Broadcast(metaclass=ABCMeta): """ An interface for defining a broadcast protocol. The 'propose' and 'decide' methods need to be defined """ BUFFER_SIZE = 1024 def __init__(self, peer_list): self.peers = peer_list ...
from abc import ABCMeta, abstractmethod import socket, json class Broadcast(metaclass=ABCMeta): """ An interface for defining a broadcast protocol. The 'propose' and 'decide' methods need to be defined """ BUFFER_SIZE = 1024 def __init__(self, peer_list): self.peers = peer_list ...
Extend Broadcast protocol abstraction with a Handler interface for message delivery
Extend Broadcast protocol abstraction with a Handler interface for message delivery
Python
mit
koevskinikola/ByzantineRandomizedConsensus
5f8da3c286bf734302ee493e00675b84836ba10e
src/server.py
src/server.py
#!/usr/bin/env python3 import socketserver from socketserver import BaseRequestHandler from socketserver import TCPServer HOST = '' PORT = 7777 class ConnectionHandler(BaseRequestHandler): def handle(self): self.data = self.request.recv(128).strip() print('{} wrote:\n{}'.format(self.client_addres...
#!/usr/bin/env python3 import socketserver from socketserver import BaseRequestHandler from socketserver import TCPServer from inv_kinematics import get_angles class ConnectionHandler(BaseRequestHandler): def handle(self): self.data = self.request.recv(128).strip().decode() print('Data from {}:\n...
Use other ports and show inv problem solutions
Use other ports and show inv problem solutions
Python
mit
saleone/bachelor-thesis
4e5fa71790f7a69bf6bb472ee7ce48f4a801953c
test/util.py
test/util.py
""" Utilities used throughout the tests. """ from functools import wraps from mongoalchemy.session import Session DB_NAME = 'mongoalchemy-unit-test' def known_failure(fun): """ Wraps a test known to fail without causing an actual test failure. """ @wraps(fun) def wrapper(*args, **kwds): ...
""" Utilities used throughout the tests. """ from functools import wraps from mongoalchemy.session import Session DB_NAME = 'mongoalchemy-unit-test' """ Name of the database to use for testing. """ def known_failure(fun): """ Wraps a test known to fail without causing an actual test failure. """ ...
Allow get_session to pass through arguments, like `safe`.
Allow get_session to pass through arguments, like `safe`.
Python
mit
shakefu/MongoAlchemy,shakefu/MongoAlchemy,shakefu/MongoAlchemy
573f3fd726c7bf1495bfdfeb2201317abc2949e4
src/parser/menu_item.py
src/parser/menu_item.py
"""(c) All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2017""" class MenuItem: """ To store menu item information """ def __init__(self, txt, target, hidden): """ Constructor txt - Menu link text target - Can be several things -- Referenc...
"""(c) All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2017""" class MenuItem: """ To store menu item information """ def __init__(self, txt, target, hidden): """ Constructor txt - Menu link text target - Can be several things -- Referenc...
Remove previously added method because finally not used...
Remove previously added method because finally not used...
Python
mit
epfl-idevelop/jahia2wp,epfl-idevelop/jahia2wp,epfl-idevelop/jahia2wp,epfl-idevelop/jahia2wp
6397ca218be2fe1d8095a04b2c6623f2e1d1fd7b
autograder/controller/autograder.py
autograder/controller/autograder.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This module is part of the Clemson ACM Auto Grader This module is contains the main method for the module """ import argparse from autograder.controller import setup, grade_project def main(): """ Main method for the autograder """ options = parse_a...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This module is part of the Clemson ACM Auto Grader Copyright (c) 2016, Robert Underwood All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistribut...
Clean up of main module
Clean up of main module Moved two commands to the grade_project script. Added copyright statement.
Python
bsd-2-clause
robertu94/autograder,robertu94/autograder,robertu94/autograder
5251534283d233d5f1e9cfc33f8de9cf18cd3ba1
server/lib/python/cartodb_services/cartodb_services/google/client_factory.py
server/lib/python/cartodb_services/cartodb_services/google/client_factory.py
#!/usr/local/bin/python # -*- coding: utf-8 -*- import googlemaps import base64 from exceptions import InvalidGoogleCredentials class GoogleMapsClientFactory(): clients = {} @classmethod def get(cls, client_id, client_secret, channel=None): cache_key = "{}:{}:{}".format(client_id, client_secret, ...
#!/usr/local/bin/python # -*- coding: utf-8 -*- import googlemaps import base64 from exceptions import InvalidGoogleCredentials class GoogleMapsClientFactory(): clients = {} @classmethod def get(cls, client_id, client_secret, channel=None): cache_key = "{}:{}:{}".format(client_id, client_secret,...
Allow using non-Premium keys for Google Maps client
Allow using non-Premium keys for Google Maps client
Python
bsd-3-clause
CartoDB/dataservices-api,CartoDB/geocoder-api,CartoDB/geocoder-api,CartoDB/dataservices-api,CartoDB/dataservices-api,CartoDB/dataservices-api,CartoDB/geocoder-api,CartoDB/geocoder-api
a4f99f9825fda7f40a8416c367c79dd2cfb8a35b
django_docutils/lib/settings.py
django_docutils/lib/settings.py
from django.conf import settings BASED_LIB_RST = getattr( settings, 'BASED_LIB_RST', { "font_awesome": { "url_patterns": { r'.*twitter.com.*': 'fab fa-twitter', } } }, )
from django.conf import settings BASED_LIB_RST = getattr(settings, 'BASED_LIB_RST', {}) INJECT_FONT_AWESOME = ( BASED_LIB_RST.get('font_awesome', {}).get('url_patterns') is not None )
Remove example setting from defaults, add INJECT_FONT_AWESOME
Remove example setting from defaults, add INJECT_FONT_AWESOME
Python
mit
tony/django-docutils,tony/django-docutils
f6c36bbb5b5afec1a029213557b722e50dd6aaaa
test/test_run_script.py
test/test_run_script.py
def test_dummy(): assert True
import subprocess import pytest def test_filter(tmp_path): unit_test = tmp_path.joinpath('some_unit_test.sv') unit_test.write_text(''' module some_unit_test; import svunit_pkg::*; `include "svunit_defines.svh" string name = "some_ut"; svunit_testcase svunit_ut; function void build(); svunit_...
Add test for '--filter' option
Add test for '--filter' option The goal now is to make this test pass by implementing the necessary production code.
Python
apache-2.0
svunit/svunit,svunit/svunit,svunit/svunit
f2109a486b3459a3fbf4e5e7db92780f1765a5a8
test_app/urls.py
test_app/urls.py
from django.conf.urls.defaults import patterns, url, include from django.contrib import admin from django.http import HttpResponseNotFound, HttpResponseServerError from test_app import views from waffle.views import wafflejs handler404 = lambda r: HttpResponseNotFound() handler500 = lambda r: HttpResponseServerError...
from django.conf.urls.defaults import patterns, url, include from django.contrib import admin from django.http import HttpResponseNotFound, HttpResponseServerError from test_app import views handler404 = lambda r: HttpResponseNotFound() handler500 = lambda r: HttpResponseServerError() admin.autodiscover() urlpatte...
Use new URLs module in test_app.
Use new URLs module in test_app.
Python
bsd-3-clause
mark-adams/django-waffle,festicket/django-waffle,hwkns/django-waffle,JeLoueMonCampingCar/django-waffle,crccheck/django-waffle,ilanbm/django-waffle,mwaaas/django-waffle-session,11craft/django-waffle,VladimirFilonov/django-waffle,willkg/django-waffle,rodgomes/django-waffle,festicket/django-waffle,crccheck/django-waffle,r...
3bcec41a2dd9d5a43ce4d51379783d5f398f7571
Lib/scipy_version.py
Lib/scipy_version.py
major = 0 minor = 4 micro = 3 #try: # from __svn_version__ import version as svn_revision # scipy_version = '%(major)d.%(minor)d.%(micro)d_%(svn_revision)s'\ # % (locals ()) #except ImportError,msg: # svn_revision = 0 scipy_version = '%(major)d.%(minor)d.%(micro)d' % (locals ())
major = 0 minor = 4 micro = 3 scipy_version = '%(major)d.%(minor)d.%(micro)d' % (locals ()) import os svn_version_file = os.path.join(os.path.dirname(__file__), '__svn_version__.py') if os.path.isfile(svn_version_file): import imp svn = imp.load_module('scipy.__svn_version__',...
Fix the scipy version display.
Fix the scipy version display.
Python
bsd-3-clause
fernand/scipy,jonycgn/scipy,andyfaff/scipy,mgaitan/scipy,fernand/scipy,mortada/scipy,pschella/scipy,efiring/scipy,pbrod/scipy,mgaitan/scipy,nonhermitian/scipy,Shaswat27/scipy,mtrbean/scipy,futurulus/scipy,perimosocordiae/scipy,argriffing/scipy,behzadnouri/scipy,nmayorov/scipy,richardotis/scipy,ilayn/scipy,vhaasteren/sc...
e49fb537143cd0936b62ef53e294717d6ca4dc6f
tests/test_automaton.py
tests/test_automaton.py
#!/usr/bin/env python3 """Functions for testing the Automaton abstract base class.""" import nose.tools as nose from automata.base.automaton import Automaton def test_abstract_methods_not_implemented(): """Should raise NotImplementedError when calling abstract methods.""" with nose.assert_raises(NotImplemen...
#!/usr/bin/env python3 """Functions for testing the Automaton abstract base class.""" import nose.tools as nose from automata.base.automaton import Automaton def test_abstract_methods_not_implemented(): """Should raise NotImplementedError when calling abstract methods.""" abstract_methods = { '__ini...
Refactor abstract method test to reduce duplication
Refactor abstract method test to reduce duplication
Python
mit
caleb531/automata
d7e58494e1b35c315ede2b3019a18af0dd1744b4
stuff/urls.py
stuff/urls.py
import settings from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/(.*)', admin.site.root), (r'^publication/', include('stuff.publications.urls')), (r'^file/', include('stuff.files.urls')), (r'^photo/', include('stuff.pica...
import settings from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/(.*)', admin.site.root), (r'^publication/', include('stuff.publications.urls')), (r'^file/', include('stuff.files.urls')), (r'^photo/', include('stuff.pica...
Remove extra %s from media path
Remove extra %s from media path
Python
bsd-2-clause
anjos/website,anjos/website
174d9862242cecdf89c3fd398b93e805e49dea44
tinned_django/manage.py
tinned_django/manage.py
#!/usr/bin/env python """ Default manage.py for django-configurations """ import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") os.environ.setdefault("DJANGO_CONFIGURATION", "Development") from configurations.management import ex...
#!/usr/bin/env python """ Default manage.py for django-configurations """ import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") os.environ.setdefault("DJANGO_CONFIGURATION", "Development") if len(sys.argv) > 1 and sys.argv[1] == ...
Set up test environment when launching tests.
Set up test environment when launching tests.
Python
mit
futurecolors/tinned-django,futurecolors/tinned-django
d924415639e4ac39faa68d3cfd1696dd9ca30ddc
views/base.py
views/base.py
from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from feincms.models import Page def handler(request, path=None): if path is None: path = request.path page = Page.objects.page_for_path_or_404(path) if page.re...
from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from django.utils import translation from feincms.models import Page def handler(request, path=None): if path is None: path = request.path page = Page.objects.page_...
Set the current language from the page
Set the current language from the page
Python
bsd-3-clause
nickburlett/feincms,michaelkuty/feincms,pjdelport/feincms,hgrimelid/feincms,nickburlett/feincms,joshuajonah/feincms,pjdelport/feincms,joshuajonah/feincms,matthiask/django-content-editor,matthiask/django-content-editor,hgrimelid/feincms,michaelkuty/feincms,michaelkuty/feincms,nickburlett/feincms,mjl/feincms,matthiask/dj...
fecb2f71aa6ded8fe22a926c5dfc4c46024c30b3
currencies/templatetags/currency.py
currencies/templatetags/currency.py
from django import template from django.template.defaultfilters import stringfilter from currencies.models import Currency from currencies.utils import calculate_price register = template.Library() @register.filter(name='currency') @stringfilter def set_currency(value, arg): return calculate_price(value, arg) ...
from django import template from django.template.defaultfilters import stringfilter from currencies.models import Currency from currencies.utils import calculate_price register = template.Library() @register.filter(name='currency') @stringfilter def set_currency(value, arg): return calculate_price(value, arg) ...
Use new-style exceptions in a TemplateSyntaxError
Use new-style exceptions in a TemplateSyntaxError
Python
bsd-3-clause
pathakamit88/django-currencies,mysociety/django-currencies,panosl/django-currencies,barseghyanartur/django-currencies,mysociety/django-currencies,panosl/django-currencies,racitup/django-currencies,marcosalcazar/django-currencies,marcosalcazar/django-currencies,pathakamit88/django-currencies,ydaniv/django-currencies,rac...
4ca25c413494d43b9ecebcebca0ea79b213992a3
test_suite.py
test_suite.py
import os os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' import django # noqa if django.__version__ >= (1, 7): django.setup() from django.core import management # noqa management.call_command('test', 'tests')
import os os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' import django # noqa if django.VERSION >= (1, 7): django.setup() from django.core import management # noqa management.call_command('test', 'tests')
Fix name of Django version attribute
Fix name of Django version attribute Signed-off-by: Byron Ruth <e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98@devel.io>
Python
bsd-2-clause
bruth/django-preserialize,scottp-dpaw/django-preserialize
22e1ce2348264ac2774697e5c56523dbd1b85b14
bmi_tester/tests_pytest/conftest.py
bmi_tester/tests_pytest/conftest.py
import os import pytest from scripting.contexts import cd from . import Bmi, INPUT_FILE from .utils import all_grids, all_names, out_names, strictly_input_names @pytest.fixture(scope='module') def new_bmi(infile=None): try: with open('.ROOT_DIR', 'r') as fp: root_dir = fp.read() except I...
import os import pytest from scripting.contexts import cd from . import Bmi, INPUT_FILE from .utils import all_grids, all_names, out_names, strictly_input_names @pytest.fixture def new_bmi(infile=None): try: with open('.ROOT_DIR', 'r') as fp: root_dir = fp.read() except IOError: ...
Change new_bmi fixture scope to be function level.
Change new_bmi fixture scope to be function level.
Python
mit
csdms/bmi-tester
a6cb8d3c2d79b609a6d5d0550af57aa2b9328f7f
mopidy_vkontakte/actor.py
mopidy_vkontakte/actor.py
from __future__ import unicode_literals import logging import pykka from mopidy.backends import base from .library import VKLibraryProvider from .playlists import VKPlaylistsProvider from .session import VKSession logger = logging.getLogger('mopidy.backends.vkontakte.actor') class VKBackend(pykka.ThreadingActor,...
from __future__ import unicode_literals import logging import pykka from mopidy.backends import base from .library import VKLibraryProvider from .playlists import VKPlaylistsProvider from .session import VKSession logger = logging.getLogger('mopidy.backends.vkontakte.actor') class VKBackend(pykka.ThreadingActor,...
Remove PlaybackProvider that does nothing
Remove PlaybackProvider that does nothing
Python
apache-2.0
sibuser/mopidy-vkontakte
fc762ed1183e5a6a97e0ed6d823227bf486c951e
ovp_organizations/serializers.py
ovp_organizations/serializers.py
from django.core.exceptions import ValidationError from ovp_core import validators as core_validators from ovp_core.serializers import GoogleAddressSerializer, GoogleAddressCityStateSerializer from ovp_organizations import models from rest_framework import serializers from rest_framework import permissions class Or...
from django.core.exceptions import ValidationError from ovp_core import validators as core_validators from ovp_core.serializers import GoogleAddressSerializer, GoogleAddressCityStateSerializer from ovp_organizations import models from rest_framework import serializers from rest_framework import permissions class Or...
Make address not required on OrganizationSerializer
Make address not required on OrganizationSerializer
Python
agpl-3.0
OpenVolunteeringPlatform/django-ovp-organizations,OpenVolunteeringPlatform/django-ovp-organizations
5d5098db8e5a3b60cbba77aa04035bc35e3f1726
db_logger.py
db_logger.py
import threading import time import accounts import args import config MAX_TEXT_LENGTH = 1024 enabled = bool(args.args['database']) if enabled: import MySQLdb connected = False conn = None cur = None db_lock = threading.RLock() def _connect(): global conn, cur, connected if not connected: conn ...
import threading import time import accounts import args import config import log as _log MAX_TEXT_LENGTH = 1024 enabled = bool(args.args['database']) if enabled: import MySQLdb connected = False conn = None cur = None db_lock = threading.RLock() def _connect(): global conn, cur, connected if not conne...
Write db errors to error.log
Write db errors to error.log
Python
mit
kalinochkind/vkbot,kalinochkind/vkbot,kalinochkind/vkbot
8f162be2d682ca00a5301f0ebecfbbd6038e657a
manage.py
manage.py
# -*- coding: utf-8 -*- #!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "schoolidolapi.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "schoolidolapi.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Fix shebang and coding comment lines order
Fix shebang and coding comment lines order
Python
apache-2.0
laurenor/SchoolIdolAPI,dburr/SchoolIdolAPI,dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI,rdsathene/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,laurenor/SchoolIdolAPI,dburr/SchoolIdolAPI,laurenor/SchoolIdolAPI,rdsathene/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI
a817afa1580aeb59fcbe837893c9ec8c5e7e0667
anygit/clisetup.py
anygit/clisetup.py
import logging.config import os from paste.deploy import loadapp import sys DIR = os.path.abspath(os.path.dirname(__file__)) conf = os.path.join(DIR, '../conf/anygit.ini') application = loadapp('config:%s' % conf, relative_to='/') app = loadapp('config:%s' % conf,relative_to=os.getcwd()) logging.config.fileConfig(conf...
import logging.config import os from paste.deploy import loadapp import sys DIR = os.path.abspath(os.path.dirname(__file__)) conf = os.path.join(DIR, '../conf/anygit.ini') logging.config.fileConfig(conf) application = loadapp('config:%s' % conf, relative_to='/') app = loadapp('config:%s' % conf,relative_to=os.getcwd()...
Load the logging config right away so it actually works
Load the logging config right away so it actually works
Python
mit
ebroder/anygit,ebroder/anygit
8b33cfa3e7fc39446f634d6ab45585e589a3cc85
marrow/mongo/core/document.py
marrow/mongo/core/document.py
# encoding: utf-8 from collections import OrderedDict as odict, MutableMapping from itertools import chain from marrow.schema import Container, Attribute class Document(Container): __foreign__ = 'object'
# encoding: utf-8 from collections import OrderedDict as odict, MutableMapping from itertools import chain from marrow.schema import Container, Attribute from .util import py2, SENTINEL, adjust_attribute_sequence class Document(Container): __foreign__ = 'object' # Mapping Protocol def __getitem__(self, nam...
Make compatible with direct use by pymongo.
Make compatible with direct use by pymongo. I.e. for direct passing to collection.insert()
Python
mit
marrow/mongo,djdduty/mongo,djdduty/mongo
0166d699096aa506e37b6a2df8e51f94895c0b4f
fireplace/cards/wog/neutral_rare.py
fireplace/cards/wog/neutral_rare.py
from ..utils import * ## # Minions class OG_034: "Silithid Swarmer" update = (NUM_ATTACKS_THIS_TURN(FRIENDLY_HERO) == 0) & ( Refresh(SELF, {GameTag.CANT_ATTACK: True}) ) class OG_254: "Eater of Secrets" play = ( Buff(SELF, "OG_254e") * Count(ENEMY_SECRETS), Destroy(ENEMY_SECRETS) ) OG_254e = buff(+1, ...
from ..utils import * ## # Minions class OG_034: "Silithid Swarmer" update = (NUM_ATTACKS_THIS_TURN(FRIENDLY_HERO) == 0) & ( Refresh(SELF, {GameTag.CANT_ATTACK: True}) ) class OG_147: "Corrupted Healbot" deathrattle = Heal(ENEMY_HERO, 8) class OG_161: "Corrupted Seer" play = Hit(ALL_MINIONS - MURLOC, 2)...
Implement Corrupted Healbot, Corrupted Seer, and Midnight Drake
Implement Corrupted Healbot, Corrupted Seer, and Midnight Drake
Python
agpl-3.0
NightKev/fireplace,beheh/fireplace,jleclanche/fireplace
35111353ab8d8cae320b49520fe693114fed160f
bin/parsers/DeploysServiceLookup.py
bin/parsers/DeploysServiceLookup.py
if 'r2' in alert['resource'].lower(): alert['service'] = [ 'R2' ] elif 'content-api' in alert['resource'].lower(): alert['service'] = [ 'ContentAPI' ] elif 'flexible' in alert['resource'].lower(): alert['service'] = [ 'FlexibleContent' ] elif 'frontend' in alert['resource'].lower(): alert['service'] = ...
if alert['resource'].startswith('R1'): alert['service'] = [ 'R1' ] elif alert['resource'].startswith('R2'): alert['service'] = [ 'R2' ] elif 'content-api' in alert['resource'].lower(): alert['service'] = [ 'ContentAPI' ] elif alert['resource'].startswith('frontend'): alert['service'] = [ 'Frontend' ] e...
Add more service lookups for Deploys
Add more service lookups for Deploys
Python
apache-2.0
guardian/alerta,0312birdzhang/alerta,skob/alerta,mrkeng/alerta,guardian/alerta,mrkeng/alerta,guardian/alerta,0312birdzhang/alerta,mrkeng/alerta,0312birdzhang/alerta,skob/alerta,skob/alerta,mrkeng/alerta,guardian/alerta,skob/alerta
373e4628f248b9ce2cc9e5cb271dc2640208ff05
bluebottle/notifications/signals.py
bluebottle/notifications/signals.py
from django.core.exceptions import ValidationError from django.dispatch import receiver from django.forms.models import model_to_dict from django_fsm import pre_transition, post_transition @receiver(pre_transition) def validate_transition_form(sender, instance, name, method_kwargs, **kwargs): transition = method...
from django.core.exceptions import ValidationError from django.dispatch import receiver from django.forms.models import model_to_dict from django_fsm import pre_transition, post_transition @receiver(pre_transition) def validate_transition_form(sender, instance, name=None, method_kwargs=None, **kwargs): if not me...
Fix for weird signal we send ourselves
Fix for weird signal we send ourselves
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
ef72ce81c2d51cf99e44041a871a82c512badb8c
people/serializers.py
people/serializers.py
from rest_framework import serializers from people.models import Customer from people.models import InternalUser class CustomerSerializer(serializers.ModelSerializer): class Meta: model = Customer fields = '__all__' class InternalUserSerializer(serializers.ModelSerializer): class Meta: ...
from rest_framework import serializers from people.models import Customer from people.models import InternalUser class CustomerSerializer(serializers.ModelSerializer): phone_number = serializers.IntegerField(validators=[lambda x: len(str(x)) == 10]) class Meta: model = Customer fields = '__al...
Make the phone number an int
Make the phone number an int
Python
apache-2.0
rameshgopalakrishnan/v_excel_inventory,rameshgopalakrishnan/v_excel_inventory,rameshgopalakrishnan/v_excel_inventory
9a4cf8d594708ef57e41113bad4c76f26f3adc13
apps/accounts/managers.py
apps/accounts/managers.py
""" Objects managers for the user accounts app. """ from django.db import models class UserProfileManager(models.Manager): """ Manager class for the ``UserProfile`` data model. """ def get_subscribers_for_newsletter(self): """ Return a queryset of all users accepting to receive the n...
""" Objects managers for the user accounts app. """ import datetime from django.db import models from django.utils import timezone from .settings import ONLINE_USER_TIME_WINDOW_SECONDS class UserProfileManager(models.Manager): """ Manager class for the ``UserProfile`` data model. """ def get_subsc...
Move the get_online_users and get_active_users methods to the manager class.
Move the get_online_users and get_active_users methods to the manager class.
Python
agpl-3.0
TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker
1a2cd182ec709e0f7c64626a4467abf98f2951c2
analyzer/darwin/modules/packages/bash.py
analyzer/darwin/modules/packages/bash.py
#!/usr/bin/env python # Copyright (C) 2015 Dmitry Rodionov # This file is part of my GSoC'15 project for Cuckoo Sandbox: # http://www.cuckoosandbox.org # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. from lib.core.packages import Package class Ba...
#!/usr/bin/env python # Copyright (C) 2015 Dmitry Rodionov # This file is part of my GSoC'15 project for Cuckoo Sandbox: # http://www.cuckoosandbox.org # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. from lib.core.packages import Package class Ba...
Add support for apicalls in Bash package
Add support for apicalls in Bash package
Python
mit
cuckoobox/cuckoo,rodionovd/cuckoo-osx-analyzer,cuckoobox/cuckoo,cuckoobox/cuckoo,rodionovd/cuckoo-osx-analyzer,cuckoobox/cuckoo,cuckoobox/cuckoo,rodionovd/cuckoo-osx-analyzer
58811f1f6a4204a1c59d197daa9fb5fb7f6b25de
src/dynamic_graph/sot/dynamics/solver.py
src/dynamic_graph/sot/dynamics/solver.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST # # This file is part of dynamic-graph. # dynamic-graph 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 Softwa...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST # # This file is part of dynamic-graph. # dynamic-graph 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 Softwa...
Add a proxy method push in Solver -> Solver.sot.push.
Add a proxy method push in Solver -> Solver.sot.push.
Python
bsd-2-clause
stack-of-tasks/sot-dynamic-pinocchio,stack-of-tasks/sot-dynamic-pinocchio,stack-of-tasks/sot-dynamic-pinocchio
84ee0b55021592235f590aa4cc52cc8b13800c32
drftutorial/catalog/views.py
drftutorial/catalog/views.py
from django.http import HttpResponse from rest_framework.views import APIView from rest_framework.response import Response from .models import Product from .serializers import ProductSerializer class ProductList(APIView): def get(self, request, format=None): products = Product.objects.all() serial...
from django.http import HttpResponse from rest_framework import generics from rest_framework.response import Response from .models import Product from .serializers import ProductSerializer class ProductList(generics.ListAPIView): queryset = Product.objects.all() serializer_class = ProductSerializer
Implement GET Product using ListAPIView
Implement GET Product using ListAPIView
Python
mit
andreagrandi/drf-tutorial