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
991ed46bcc0886e310c43b33ada4aad0d95991a0
mooc.py
mooc.py
import csv import collections import argparse parser = argparse.ArgumentParser(description='Restructure MOOC CSV.') parser.add_argument('input_csv', type=open) args = parser.parse_args() data_in = {} with args.input_csv as csvin: reader = csv.reader(csvin) next(reader) # skip titles for cid, author_id, p...
import csv import collections import argparse parser = argparse.ArgumentParser(description='Restructure MOOC CSV.') parser.add_argument('input_csv', type=open) args = parser.parse_args() data_in = {} with args.input_csv as csvin: reader = csv.reader(csvin) next(reader) # skip titles for cid, author_id, p...
Add text of comments on the end of the output
Add text of comments on the end of the output
Python
mit
tlocke/mooc
0075942e2900f58f2f8bd82d0d71b49e08665123
openfisca_france_indirect_taxation/tests/base.py
openfisca_france_indirect_taxation/tests/base.py
# -*- coding: utf-8 -*- # OpenFisca -- A versatile microsimulation software # By: OpenFisca Team <contact@openfisca.fr> # # Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team # https://github.com/openfisca # # This file is part of OpenFisca. # # OpenFisca is free software; you can redistribute it and/or modify # it ...
# -*- coding: utf-8 -*- # OpenFisca -- A versatile microsimulation software # By: OpenFisca Team <contact@openfisca.fr> # # Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team # https://github.com/openfisca # # This file is part of OpenFisca. # # OpenFisca is free software; you can redistribute it and/or modify # it ...
Add prefill_cache to make test_categorie_fiscale pass
Add prefill_cache to make test_categorie_fiscale pass
Python
agpl-3.0
benjello/openfisca-france-indirect-taxation,openfisca/openfisca-france-indirect-taxation,antoinearnoud/openfisca-france-indirect-taxation,thomasdouenne/openfisca-france-indirect-taxation
aa2a2a57030dec2e8b73b017de5f157aae0fb5e5
tests/qtgui/qpixmap_test.py
tests/qtgui/qpixmap_test.py
import unittest from helper import UsesQApplication from PySide.QtGui import QPixmap from PySide.QtCore import QVariant #Only test if is possible create a QPixmap from a QVariant class QPixmapTest(UsesQApplication): def testQVariantConstructor(self): pixmap = QPixmap() v = QVariant(pixmap) ...
import unittest from helper import UsesQApplication from PySide.QtGui import QPixmap from PySide.QtCore import QVariant, QSize, QString class QPixmapTest(UsesQApplication): def testQVariantConstructor(self): pixmap = QPixmap() v = QVariant(pixmap) pixmap_copy = QPixmap(v) def testQSiz...
Improve qpixmap test to support qstring and qsize arguments.
Improve qpixmap test to support qstring and qsize arguments. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Python
lgpl-2.1
BadSingleton/pyside2,enthought/pyside,gbaty/pyside2,IronManMark20/pyside2,gbaty/pyside2,gbaty/pyside2,M4rtinK/pyside-android,PySide/PySide,pankajp/pyside,pankajp/pyside,PySide/PySide,M4rtinK/pyside-bb10,BadSingleton/pyside2,IronManMark20/pyside2,enthought/pyside,BadSingleton/pyside2,IronManMark20/pyside2,M4rtinK/pyside...
14eba692295bc5391e35a6b1f32a40ad0d6b30d9
wa/__init__.py
wa/__init__.py
from wa.framework import pluginloader, signal from wa.framework.command import Command, ComplexCommand, SubCommand from wa.framework.configuration import settings from wa.framework.configuration.core import Status from wa.framework.exception import HostError, JobError, InstrumentError, ConfigError from wa.framework.exc...
from wa.framework import pluginloader, signal from wa.framework.command import Command, ComplexCommand, SubCommand from wa.framework.configuration import settings from wa.framework.configuration.core import Status from wa.framework.exception import HostError, JobError, InstrumentError, ConfigError from wa.framework.exc...
Add ApkWorkload to default imports
wa: Add ApkWorkload to default imports
Python
apache-2.0
setrofim/workload-automation,ARM-software/workload-automation,setrofim/workload-automation,lisatn/workload-automation,ARM-software/workload-automation,setrofim/workload-automation,setrofim/workload-automation,lisatn/workload-automation,ARM-software/workload-automation,lisatn/workload-automation,lisatn/workload-automati...
a2736b4c4c4d6d004a7d055e7e9f0436a7be5b3d
gaphor/UML/__init__.py
gaphor/UML/__init__.py
from gaphor.UML.collection import collection from gaphor.UML.uml2 import * from gaphor.UML.elementfactory import ElementFactory from gaphor.UML import modelfactory as model from gaphor.UML.umlfmt import format from gaphor.UML.umllex import parse __all__ = ['collection', 'context', 'diagram', 'element', 'elementfactor...
from gaphor.UML import modelfactory as model from gaphor.UML.collection import collection from gaphor.UML.elementfactory import ElementFactory from gaphor.UML.uml2 import * from gaphor.UML.umlfmt import format from gaphor.UML.umllex import parse
Fix * imports for building UML with Python3
Fix * imports for building UML with Python3 Signed-off-by: Dan Yeaw <2591e5f46f28d303f9dc027d475a5c60d8dea17a@yeaw.me>
Python
lgpl-2.1
amolenaar/gaphor,amolenaar/gaphor
e60563e28ce08a850809aef696a348c84359ece2
gore/tests/test_api.py
gore/tests/test_api.py
import json import pytest from django.utils.encoding import force_text from gore.models import Event from gore.tests.data import exc_payload @pytest.mark.django_db def test_events_api(project, admin_client): events = [ Event.objects.create_from_raven(project_id=project.id, body=json.loads(exc_payload)) ...
import json import pytest from django.utils.encoding import force_text from gore.models import Event from gore.tests.data import exc_payload @pytest.mark.django_db def test_events_api(project, admin_client): events = [ Event.objects.create_from_raven(project_id=project.id, body=json.loads(exc_payload)) ...
Add search to events API
Add search to events API
Python
mit
akx/gentry,akx/gentry,akx/gentry,akx/gentry
61fe85842a0c932c4a8375f657eb06f406344ace
bumblebee/modules/caffeine.py
bumblebee/modules/caffeine.py
# pylint: disable=C0111,R0903 """Enable/disable automatic screen locking. Requires the following executables: * xset * notify-send """ import bumblebee.input import bumblebee.output import bumblebee.engine class Module(bumblebee.engine.Module): def __init__(self, engine, config): super(Module, s...
#pylint: disable=C0111,R0903 """Enable/disable automatic screen locking. Requires the following executables: * xdg-screensaver * notify-send """ import bumblebee.input import bumblebee.output import bumblebee.engine class Module(bumblebee.engine.Module): def __init__(self, engine, config): super...
Use xdg-screensaver instead of xset
Use xdg-screensaver instead of xset
Python
mit
tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status
ea67ec01a1f91b44dd34d8c58921f8c29a4c054a
aragog/routing/client_error.py
aragog/routing/client_error.py
""" Client Error HTTP Status Callables """ class HTTP404(object): """ HTTP 404 Response """ def __call__(self, environ, start_response): start_response('404 NOT FOUND', [('Content-Type', 'text/plain')]) return ['']
""" Client Error HTTP Status Callables """ def HTTP404(environ, start_response): """ HTTP 404 Response """ start_response('404 NOT FOUND', [('Content-Type', 'text/plain')]) return ['']
Convert HTTP404 to a function.
Convert HTTP404 to a function.
Python
apache-2.0
bramwelt/aragog
c244b84def159bc4d4e281fe39ebe06886a109d2
tests/__init__.py
tests/__init__.py
from django.conf import settings from mock import Mock, patch from unittest2 import TestCase settings.configure( DEFAULT_INDEX_TABLESPACE='', ) class TestPreference(object): def __init__(self, name, value, user=None): self.name = name self.value = value self.user = user def __eq_...
from django.conf import settings from mock import Mock, patch from unittest2 import TestCase settings.configure() class TestPreference(object): def __init__(self, name, value, user=None): self.name = name self.value = value self.user = user def __eq__(self, other): return sel...
Simplify configure of django settings
Simplify configure of django settings
Python
mit
yola/drf-madprops
0f54bb7a1a26bb3e7192b30cc426fbaeb92caaed
tests/utils/test_settings.py
tests/utils/test_settings.py
from app.models import Setting from tests.general import AppTestCase class TestAppSettings(AppTestCase): def test_setting_creation(self): self.app.config['SETTINGS']['foo'] = 'bar' setting = Setting.query.filter_by(name='foo').first() self.assertEqual(setting.value, 'bar') self.a...
from app import db, cache from app.models import Setting from tests.general import AppTestCase class TestAppSettings(AppTestCase): def test_setitem(self): self.app.config['SETTINGS']['foo'] = 'bar' setting = Setting.query.filter_by(name='foo').first() self.assertEqual(setting.value, 'bar'...
Add __getitem__ test for AppSettings
Add __getitem__ test for AppSettings
Python
mit
Encrylize/flask-blogger,Encrylize/flask-blogger,Encrylize/flask-blogger
fbbfe256cd23f87e5aad1dc4858c5e7c7753352b
cmd2/__init__.py
cmd2/__init__.py
# # -*- coding: utf-8 -*-
# # -*- coding: utf-8 -*- from .cmd2 import __version__, Cmd, AddSubmenu, CmdResult, categorize from .cmd2 import with_argument_list, with_argparser, with_argparser_and_unknown_args, with_category
Add default imports back in
Add default imports back in
Python
mit
python-cmd2/cmd2,python-cmd2/cmd2
1557de38bcc9fa4099655c210d7e2daf7c19d715
task/models.py
task/models.py
from django.db import models from django.conf import settings class Task(models.Model): title = models.CharField(max_length=50, unique=True) created_at = models.DateField() status = models.CharField(max_length=30, choices=settings.TASK_CHOICES) def __unicode__(self): # pragma: no cover retur...
import datetime from django.db import models from django.conf import settings class Task(models.Model): title = models.CharField(max_length=50, unique=True) created_at = models.DateTimeField(auto_now_add=True) status = models.CharField(max_length=30, choices=settings.TASK_CHOICES) class Meta: ...
Set order getting the list of tasks
Set order getting the list of tasks
Python
mit
rosadurante/to_do,rosadurante/to_do
172b2aaf505b1971bceb934e5e3d9e5dce1acbb1
api/views.py
api/views.py
# coding=utf-8 from rest_framework import viewsets from .models import AirCondition, AirAverage from .serializers import AirAverageSerializer, AirConditionSerializer class AirConditionViewSets(viewsets.ReadOnlyModelViewSet): queryset = AirCondition.objects.all().order_by('-time')[:24] # 24 hours serialize...
# coding=utf-8 from rest_framework import viewsets from .models import AirCondition, AirAverage from .serializers import AirAverageSerializer, AirConditionSerializer class AirConditionViewSets(viewsets.ReadOnlyModelViewSet): queryset = AirCondition.objects.all().order_by('-time')[:24] # 24 hours serialize...
Add pm2.5 avg view api
Add pm2.5 avg view api
Python
mit
banbanchs/leda,banbanchs/leda,banbanchs/leda
4de03c57bf4f4995eb8c8859e0a40b7c5fc9942b
desktop/libs/libzookeeper/src/libzookeeper/models.py
desktop/libs/libzookeeper/src/libzookeeper/models.py
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
Enable Kerberos automatically based on HDFS security
[libzookeeper] Enable Kerberos automatically based on HDFS security We don't need another property that way and Kerberos is a all or nothing setup. Even if HDFS is not used in Hue, the default hue.ini has security set to false.
Python
apache-2.0
pratikmallya/hue,jjmleiro/hue,lumig242/Hue-Integration-with-CDAP,cloudera/hue,pratikmallya/hue,xiangel/hue,Peddle/hue,x303597316/hue,cloudera/hue,rahul67/hue,kawamon/hue,yongshengwang/hue,MobinRanjbar/hue,x303597316/hue,xq262144/hue,jayceyxc/hue,mapr/hue,yongshengwang/hue,pratikmallya/hue,sanjeevtripurari/hue,lumig242/...
5bd9af7c35603cca49303f56096bc279234e547d
ci/fix_paths.py
ci/fix_paths.py
import distutils.sysconfig from glob import glob import os from os.path import join as pjoin, basename from shutil import copy from sys import platform def main(): """ Copy HDF5 DLLs into installed h5py package """ # This is the function Tox also uses to locate site-packages (Apr 2019) sitepackages...
import distutils.sysconfig from glob import glob import os from os.path import join as pjoin, basename from shutil import copy from sys import platform def main(): """ Copy HDF5 DLLs into installed h5py package """ # This is the function Tox also uses to locate site-packages (Apr 2019) sitepackages...
Use plat_specific site-packages dir in CI script
Use plat_specific site-packages dir in CI script
Python
bsd-3-clause
h5py/h5py,h5py/h5py,h5py/h5py
3a89181d0adb53a2a3d428485d5e3deaeb950a02
fixedwidthwriter/__init__.py
fixedwidthwriter/__init__.py
# coding: utf-8 from decimal import Decimal class FixedWidthWriter(): def __init__(self, fd, fields, line_ending='linux'): self.fd = fd self.fields = fields if line_ending == 'linux': self.line_ending = '\n' elif line_ending == 'windows': self.line_ending =...
# coding: utf-8 from decimal import Decimal class FixedWidthWriter(): def __init__(self, fd, fields, line_ending='linux'): self.fd = fd self.fields = fields if line_ending == 'linux': self.line_ending = '\n' elif line_ending == 'windows': self.line_ending =...
Remove leading underscores from variables.
Remove leading underscores from variables.
Python
mit
ArthurPBressan/py-fixedwidthwriter,HardDiskD/py-fixedwidthwriter
7579cc3058ad172cb058fbefd43f756a2316e256
examples/modelzoo/download_model.py
examples/modelzoo/download_model.py
#!/usr/bin/env python from __future__ import print_function import argparse import six parser = argparse.ArgumentParser( descriptor='Download a Caffe reference model') parser.add_argument('model_type', help='Model type (alexnet, caffenet, googlenet)') args = parser.parse_args() if args.model...
#!/usr/bin/env python from __future__ import print_function import argparse import six parser = argparse.ArgumentParser( description='Download a Caffe reference model') parser.add_argument('model_type', choices=('alexnet', 'caffenet', 'googlenet'), help='Model type (alexnet, caffenet, googlen...
Fix argparse of caffe model download script
Fix argparse of caffe model download script
Python
mit
bayerj/chainer,kashif/chainer,AlpacaDB/chainer,AlpacaDB/chainer,kiyukuta/chainer,okuta/chainer,umitanuki/chainer,tkerola/chainer,aonotas/chainer,cupy/cupy,ktnyt/chainer,kikusu/chainer,tscohen/chainer,wkentaro/chainer,okuta/chainer,1986ks/chainer,Kaisuke5/chainer,muupan/chainer,kikusu/chainer,okuta/chainer,ktnyt/chainer...
da2e34ca3371f0898df8b3181ba98132bd9a26e4
txircd/modbase.py
txircd/modbase.py
# The purpose of this file is to provide base classes with the needed functions # already defined; this allows us to guarantee that any exceptions raised # during function calls are a problem with the module and not just that the # particular function isn't defined. class Module(object): def hook(self, base): self....
# The purpose of this file is to provide base classes with the needed functions # already defined; this allows us to guarantee that any exceptions raised # during function calls are a problem with the module and not just that the # particular function isn't defined. class Module(object): def hook(self, base): self....
Add a function for commands to process parameters
Add a function for commands to process parameters
Python
bsd-3-clause
ElementalAlchemist/txircd,DesertBus/txircd,Heufneutje/txircd
2db334e452e2ee2d5f0cbc516dc6cb04b61e598d
yargy/labels.py
yargy/labels.py
GENDERS = ("masc", "femn", "neut", "Ms-f") def gram_label(token, value, stack): return value in token.grammemes def gram_not_label(token, value, stack): return not value in token.grammemes def gender_match_label(token, index, stack, genders=GENDERS): results = ((g in t.grammemes for g in genders) for t i...
GENDERS = ("masc", "femn", "neut", "Ms-f", "GNdr") def gram_label(token, value, stack): return value in token.grammemes def gram_not_label(token, value, stack): return not value in token.grammemes def gender_match_label(token, index, stack, genders=GENDERS): results = ((g in t.grammemes for g in genders)...
Check for `GNdr` grammeme in `gender-match` label
Check for `GNdr` grammeme in `gender-match` label
Python
mit
bureaucratic-labs/yargy
a44ec4543fc6951cd45ba3c1696e428e36a9c161
commands/say.py
commands/say.py
from CommandTemplate import CommandTemplate from IrcMessage import IrcMessage class Command(CommandTemplate): triggers = ['say', 'do', 'notice'] helptext = "Makes the bot say the provided text in the provided channel (format 'say [channel/user] text')" adminOnly = True showInCommandList = False def execute(sel...
from CommandTemplate import CommandTemplate from IrcMessage import IrcMessage class Command(CommandTemplate): triggers = ['say', 'do', 'notice'] helptext = "Makes the bot say the provided text in the provided channel (format 'say [channel/user] text')" adminOnly = True showInCommandList = False def execute(sel...
Make sure the target of Say isn't in Unicode, otherwise Twisted complains
Make sure the target of Say isn't in Unicode, otherwise Twisted complains
Python
mit
Didero/DideRobot
621337bd685a200a37bcbbd5fe3441d2090aab54
cr8/__main__.py
cr8/__main__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import argh import argparse from cr8 import __version__ from cr8.timeit import timeit from cr8.insert_json import insert_json from cr8.insert_fake_data import insert_fake_data from cr8.insert_blob import insert_blob from cr8.run_spec import run_spec from cr8.run_crate imp...
#!/usr/bin/env python # -*- coding: utf-8 -*- # PYTHON_ARGCOMPLETE_OK import argh import argparse from cr8 import __version__ from cr8.timeit import timeit from cr8.insert_json import insert_json from cr8.insert_fake_data import insert_fake_data from cr8.insert_blob import insert_blob from cr8.run_spec import run_spe...
Add PYTHON_ARGCOMPLETE_OK to enable completion for argcomplete users
Add PYTHON_ARGCOMPLETE_OK to enable completion for argcomplete users
Python
mit
mikethebeer/cr8,mfussenegger/cr8
c2bca21718295b6400471395f5da3ca9d42e8a84
modoboa_dmarc/tests/mixins.py
modoboa_dmarc/tests/mixins.py
"""Test mixins.""" import os import sys import six from django.core.management import call_command class CallCommandMixin(object): """A mixin to provide command execution shortcuts.""" def setUp(self): """Replace stdin""" super(CallCommandMixin, self).setUp() self.stdin = sys.stdin...
"""Test mixins.""" import os import sys import six from django.core.management import call_command from django.utils.six import StringIO class CallCommandMixin(object): """A mixin to provide command execution shortcuts.""" def setUp(self): """Replace stdin""" super(CallCommandMixin, self)....
Check if error available on output
Check if error available on output
Python
mit
modoboa/modoboa-dmarc,modoboa/modoboa-dmarc
98552a4cb683e25ec9af53024e58644c04b55872
molly/external_media/views.py
molly/external_media/views.py
from email.utils import formatdate from datetime import datetime, timedelta from time import mktime from django.shortcuts import get_object_or_404 from django.http import HttpResponse, Http404 from molly.utils.views import BaseView from molly.utils.breadcrumbs import NullBreadcrumb from models import ExternalImageSi...
from email.utils import formatdate from datetime import datetime, timedelta from time import mktime from django.shortcuts import get_object_or_404 from django.http import HttpResponse, Http404 from molly.utils.views import BaseView from molly.utils.breadcrumbs import NullBreadcrumb from models import ExternalImageSi...
Handle missing external files gracefully
MOX-182: Handle missing external files gracefully
Python
apache-2.0
mollyproject/mollyproject,mollyproject/mollyproject,mollyproject/mollyproject
78f96421598a561285b9cd5568fd4acabd52585f
offenerhaushalt/generators.py
offenerhaushalt/generators.py
from offenerhaushalt.core import freezer, pages, sites @freezer.register_generator def page(): for page in pages: yield {'path': page.path} @freezer.register_generator def site(): for site in sites: yield {'slug': site.slug}
from offenerhaushalt.core import freezer, pages, sites @freezer.register_generator def page(): for page in pages: yield {'path': page.path} @freezer.register_generator def site(): for site in sites: yield {'slug': site.slug} @freezer.register_generator def embed_site(): for site in sit...
Add embed site freeze generator
Add embed site freeze generator Fix tabs/spaces issue as well
Python
mit
Opendatal/offenerhaushalt.de,Opendatal/offenerhaushalt.de,Opendatal/offenerhaushalt.de
9fda25c0a28f7965c2378dcd4b2106ca034052c3
plumeria/plugins/have_i_been_pwned.py
plumeria/plugins/have_i_been_pwned.py
import plumeria.util.http as http from plumeria import config from plumeria.command import commands, CommandError from plumeria.command.parse import Text from plumeria.message.mappings import build_mapping from plumeria.util.collections import SafeStructure from plumeria.util.ratelimit import rate_limit @commands.reg...
import plumeria.util.http as http from plumeria import config from plumeria.command import commands, CommandError from plumeria.command.parse import Text from plumeria.message.mappings import build_mapping from plumeria.util.collections import SafeStructure from plumeria.util.ratelimit import rate_limit @commands.reg...
Handle missing accounts on HaveIBeenPwned properly.
Handle missing accounts on HaveIBeenPwned properly.
Python
mit
sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria
cc51137aedeee8bdcf6b47e98b195ec750183ab4
context_variables/__init__.py
context_variables/__init__.py
class context_variable(object): def __init__(self, func): self.func = func self.__doc__ = func.__doc__ def __get__(self, obj, objtype=None): # Handle case of being called from class instead of an instance if obj is None: return self # Evaluate the property ...
class context_variable(object): def __init__(self, func): self.func = func self.__doc__ = func.__doc__ def __get__(self, obj, objtype=None): # Handle case of being called from class instead of an instance if obj is None: return self # If we got a plain value...
Allow plain values, not just methods
Allow plain values, not just methods
Python
mit
carlmjohnson/django-context-variables
96db4f0f42058ba9a8917fd4e9a3d8174f91cbd3
version_st2.py
version_st2.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use t...
# Copyright 2016 - StackStorm, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Update licensing info on version file
Update licensing info on version file
Python
apache-2.0
StackStorm/mistral,StackStorm/mistral
9653f3d4d3bd859d592542fc011ad7b81a866052
IPython/html/widgets/__init__.py
IPython/html/widgets/__init__.py
from .widget import Widget, DOMWidget, CallbackDispatcher, register from .widget_bool import Checkbox, ToggleButton from .widget_button import Button from .widget_box import Box, Popup, FlexBox, HBox, VBox from .widget_float import FloatText, BoundedFloatText, FloatSlider, FloatProgress, FloatRangeSlider from .widget_...
from .widget import Widget, DOMWidget, CallbackDispatcher, register from .widget_bool import Checkbox, ToggleButton from .widget_button import Button from .widget_box import Box, Popup, FlexBox, HBox, VBox from .widget_float import FloatText, BoundedFloatText, FloatSlider, FloatProgress, FloatRangeSlider from .widget_...
Make the widget experimental error a real python warning
Make the widget experimental error a real python warning This means it can easily be turned off too.
Python
bsd-3-clause
jupyter-widgets/ipywidgets,cornhundred/ipywidgets,cornhundred/ipywidgets,SylvainCorlay/ipywidgets,cornhundred/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,cornhundred/ipywidgets,cornhundred/ipywidgets,SylvainCorlay/ipywidgets,ipython/i...
c7e55bfd8284c4bb6755abc51dd7c940bca9d81a
sensor_consumers/dust_node.py
sensor_consumers/dust_node.py
# coding=utf-8 from local_settings import * from utils import SensorConsumerBase import redis import datetime import sys class DustNode(SensorConsumerBase): def __init__(self): SensorConsumerBase.__init__(self, "indoor_air_quality") def run(self): self.subscribe("dust-node-pubsub", self.pubsu...
# coding=utf-8 from local_settings import * from utils import SensorConsumerBase import redis import datetime import sys class DustNode(SensorConsumerBase): def __init__(self): SensorConsumerBase.__init__(self, "indoor_air_quality") def run(self): self.subscribe("dust-node-pubsub", self.pubsu...
Add sound level to influx
Add sound level to influx
Python
bsd-3-clause
ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display
4369de9f0f44860f27d26f6814dc100fefe421be
test_urls.py
test_urls.py
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'temp.views.home', name='home'), # url(r'^temp/', include('temp.foo.urls')), # Uncommen...
import django if django.VERSION >= (1,10): from django.conf.urls import include, url patterns = lambda _ignore, x: list([x,]) else: from django.conf.urls import patterns, include, url urlpatterns = patterns('', url(r'^messages/', include('messages_extends.urls', namespace='messages')), )
Fix tests for Django 1.10
Fix tests for Django 1.10
Python
mit
AliLozano/django-messages-extends,AliLozano/django-messages-extends,AliLozano/django-messages-extends
b2354fdde28bf841bebfc1f5347b2bde3c3cc390
db/TableBill.py
db/TableBill.py
{ PDBConst.Name: "bill", PDBConst.Columns: [ { PDBConst.Name: "ID", PDBConst.Attributes: ["int", "not null", "auto_increment", "primary key"] }, { PDBConst.Name: "Datetime", PDBConst.Attributes: ["datetime", "not null"] }, { PDBConst.Name: "Amount", ...
{ PDBConst.Name: "bill", PDBConst.Columns: [ { PDBConst.Name: "ID", PDBConst.Attributes: ["int", "not null", "auto_increment", "primary key"] }, { PDBConst.Name: "PID", PDBConst.Attributes: ["int", "not null"] }, { PDBConst.Name: "Datetime", PD...
Fix bill table missed column
Fix bill table missed column
Python
mit
eddiedb6/ej,eddiedb6/ej,eddiedb6/ej
c1f31f69ca7ba75185100cf7a8eabf58ed41ccdf
atmo/apps.py
atmo/apps.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, you can obtain one at http://mozilla.org/MPL/2.0/. import logging import session_csrf from django.apps import AppConfig from django.db.models.signals import post_save, pre...
# 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/. import logging import session_csrf from django.apps import AppConfig from django.db.models.signals import post_save, pre...
Connect signal callback using the model class as sender.
Connect signal callback using the model class as sender.
Python
mpl-2.0
mozilla/telemetry-analysis-service,mozilla/telemetry-analysis-service,mozilla/telemetry-analysis-service,mozilla/telemetry-analysis-service
c9f990ff4095b7fb361b2d59c0c5b2c9555643ff
csunplugged/tests/BaseTest.py
csunplugged/tests/BaseTest.py
"""Base test class with methods implemented for Django testing.""" from django.test import TestCase from django.contrib.auth.models import User from django.test.client import Client from django.utils.translation import activate <<<<<<< HEAD class BaseTest(SimpleTestCase): """Base test class with methods implemen...
"""Base test class with methods implemented for Django testing.""" from django.test import TestCase from django.contrib.auth.models import User from django.test.client import Client from django.utils.translation import activate class BaseTest(SimpleTestCase): """Base test class with methods implemented for Djang...
Remove left over merge conflict text
Remove left over merge conflict text
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
0ab2da918cbf0e58cf850f6868f5b896ea5c3893
heufybot/modules/util/nickservid.py
heufybot/modules/util/nickservid.py
from twisted.plugin import IPlugin from heufybot.moduleinterface import BotModule, IBotModule from zope.interface import implements import logging class NickServIdentify(BotModule): implements(IPlugin, IBotModule) name = "NickServIdentify" def hookBot(self, bot): self.bot = bot def actions(...
from twisted.plugin import IPlugin from heufybot.moduleinterface import BotModule, IBotModule from zope.interface import implements import logging class NickServIdentify(BotModule): implements(IPlugin, IBotModule) name = "NickServIdentify" def hookBot(self, bot): self.bot = bot def actions(...
Make NickServIdentify play nice with service specific configs
Make NickServIdentify play nice with service specific configs
Python
mit
Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot
35d14348ce419421bba2b043ea2818c185526301
ratechecker/migrations/0002_remove_fee_loader.py
ratechecker/migrations/0002_remove_fee_loader.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-10-31 16:33 from __future__ import unicode_literals from django.db import migrations, OperationalError, ProgrammingError def fix_fee_product_index(apps, schema_editor): table_name = 'cfpb.ratechecker_fee' index_name = 'idx_16977_product_id' try...
# -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-10-31 16:33 from __future__ import unicode_literals from django.db import migrations, OperationalError, ProgrammingError def fix_fee_product_index(apps, schema_editor): try: schema_editor.execute( 'DROP INDEX idx_16977_product_id;' ...
Comment out fix_fee_product_index from migration
Comment out fix_fee_product_index from migration
Python
cc0-1.0
cfpb/owning-a-home-api
9dd019c12899045faebd49bc06026c8512609c9e
statictemplate/management/commands/statictemplate.py
statictemplate/management/commands/statictemplate.py
# -*- coding: utf-8 -*- from contextlib import contextmanager from django.conf import settings try: from django.conf.urls.defaults import patterns, url, include assert all((patterns, url, include)) except ImportError: from django.conf.urls import patterns, url, include # pragma: no cover from django.core.m...
# -*- coding: utf-8 -*- from contextlib import contextmanager from django.conf import settings try: from django.conf.urls.defaults import patterns, url, include except ImportError: from django.conf.urls import patterns, url, include # pragma: no cover from django.core.management.base import BaseCommand from dj...
Remove assert line from import
Remove assert line from import
Python
bsd-3-clause
yakky/django-statictemplate,bdon/django-statictemplate,ojii/django-statictemplate
8cb34f4d88184d0c42e8c1fc41f451fa3cd5a6be
plugins/keepkey/cmdline.py
plugins/keepkey/cmdline.py
from electrum.util import print_msg, raw_input from .keepkey import KeepKeyPlugin from ..hw_wallet import CmdLineHandler class Plugin(KeepKeyPlugin): handler = CmdLineHandler() @hook def init_keystore(self, keystore): if not isinstance(keystore, self.keystore_class): return keys...
from electrum.plugins import hook from electrum.util import print_msg, raw_input from .keepkey import KeepKeyPlugin from ..hw_wallet import CmdLineHandler class Plugin(KeepKeyPlugin): handler = CmdLineHandler() @hook def init_keystore(self, keystore): if not isinstance(keystore, self.keystore_class...
Fix undefined reference error in command line KeepKey plugin.
Fix undefined reference error in command line KeepKey plugin.
Python
mit
romanz/electrum,wakiyamap/electrum-mona,vialectrum/vialectrum,romanz/electrum,digitalbitbox/electrum,kyuupichan/electrum,asfin/electrum,pooler/electrum-ltc,vialectrum/vialectrum,kyuupichan/electrum,spesmilo/electrum,digitalbitbox/electrum,cryptapus/electrum,kyuupichan/electrum,digitalbitbox/electrum,wakiyamap/electrum-...
a1d71466d09e9e1ea2f75eae57e72e0000c65ffc
tests/run.py
tests/run.py
import sys import django from colour_runner.django_runner import ColourRunnerMixin from django.conf import settings settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } }, MIDDLEWARE_CLASSES=(), TEMPLATE_DIR...
import sys import django from colour_runner.django_runner import ColourRunnerMixin from django.conf import settings settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } }, MIDDLEWARE_CLASSES=(), TEMPLATES=[ ...
Add new-style TEMPLATES setting for tests
Add new-style TEMPLATES setting for tests
Python
bsd-2-clause
incuna/incuna-mail,incuna/incuna-mail
0efeaa258b19d5b1ba204cc55fbdb6969e0f3e64
flake8_respect_noqa.py
flake8_respect_noqa.py
# -*- coding: utf-8 -*- """ Always ignore lines with '# noqa' """ __version__ = 0.2 import pep8 class RespectNoqaReport(pep8.StandardReport): def error(self, line_number, offset, text, check): if len(self.lines) > line_number - 1 and pep8.noqa(self.lines[line_number - 1]): return els...
# -*- coding: utf-8 -*- """ Always ignore lines with '# noqa' """ __version__ = 0.2 try: from pep8 import StandardReport, noqa except ImportError: # Try the new (as of 2016-June) pycodestyle package. from pycodestyle import StandardReport, noqa class RespectNoqaReport(StandardReport): def error(self...
Adjust for pep8 package rename.
Adjust for pep8 package rename. Closes #1
Python
mit
spookylukey/flake8-respect-noqa
e37eba5f9430cfa3c3cf081066e7079e5c564e95
generic_scaffold/templatetags/generic_scaffold_tags.py
generic_scaffold/templatetags/generic_scaffold_tags.py
from django import template from django.conf import settings from generic_scaffold import get_url_names register = template.Library() @register.simple_tag def get_url_for_action(prefix, action): url = get_url_names(prefix)[action] return url @register.assignment_tag def set_url_for_action(prefix, action): ...
from django import template from django.conf import settings from generic_scaffold import get_url_names register = template.Library() @register.assignment_tag def set_urls_for_scaffold(app=None, model=None, prefix=None): url_name = get_url_names(app, model, prefix) return url_name
Improve templatetag to use either prefix or ...
Improve templatetag to use either prefix or ... app/model
Python
mit
spapas/django-generic-scaffold,spapas/django-generic-scaffold
f8d980de69607e73f207fea808c3b0558a4159c0
pyconcz_2016/cfp/models.py
pyconcz_2016/cfp/models.py
from django.db import models from pyconcz_2016.conferences.models import Conference class Cfp(models.Model): conference = models.ForeignKey(Conference, related_name="cfps") title = models.CharField(max_length=200) date_start = models.DateTimeField() date_end = models.DateTimeField() class Meta:...
from django.db import models from django.utils.timezone import now from pyconcz_2016.conferences.models import Conference class Cfp(models.Model): conference = models.ForeignKey(Conference, related_name="cfps") title = models.CharField(max_length=200) date_start = models.DateTimeField() date_end = m...
Add date and social media fields to proposal
Add date and social media fields to proposal
Python
mit
pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2016,benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2016
bee9373dcf852e7af9f0f1a78dcc17a0922f96fe
anchorhub/tests/test_main.py
anchorhub/tests/test_main.py
""" test_main.py - Tests for main.py main.py: http://www.github.com/samjabrahams/anchorhub/main.py """ from nose.tools import * import anchorhub.main as main def test_one(): """ main.py: Test defaults with local directory as input. """ main.main(['.'])
""" test_main.py - Tests for main.py main.py: http://www.github.com/samjabrahams/anchorhub/main.py """ from nose.tools import * import anchorhub.main as main from anchorhub.util.getanchorhubpath import get_anchorhub_path from anchorhub.compatibility import get_path_separator def test_one(): """ main.py: Tes...
Modify main.py tests to use get_anchorhub_path()
Modify main.py tests to use get_anchorhub_path()
Python
apache-2.0
samjabrahams/anchorhub
0507dfbd23db74db1c59bd1084647cc49ef19aee
addons/website_notfound_redirect/ir_http.py
addons/website_notfound_redirect/ir_http.py
# -*- coding: utf-8 -*- import logging import urllib2 from openerp.http import request from openerp.osv import orm logger = logging.getLogger(__name__) class ir_http(orm.AbstractModel): _inherit = 'ir.http' def _handle_exception(self, exception, code=500): code = getattr(exception, 'code', code) ...
# -*- coding: utf-8 -*- import logging import urllib2 from openerp.http import request from openerp.osv import orm logger = logging.getLogger(__name__) class ir_http(orm.AbstractModel): _inherit = 'ir.http' def _handle_exception(self, exception, code=500): code = getattr(exception, 'code', code) ...
Change logger messages to info
Change logger messages to info
Python
agpl-3.0
shingonoide/odoo_ezdoo,shingonoide/odoo_ezdoo
8af3aef367135dbbc55e573c6a943a86ff3ccd9d
survey/tests/locale/test_locale_normalization.py
survey/tests/locale/test_locale_normalization.py
import os import platform import subprocess import unittest class TestLocaleNormalization(unittest.TestCase): LOCALE_PATH = "survey/locale/" def test_normalization(self): """ We test if the messages were properly created with makemessages --no-obsolete --no-wrap. """ if platform.system() == ...
import os import platform import subprocess import unittest from pathlib import Path class TestLocaleNormalization(unittest.TestCase): LOCALE_PATH = Path("survey", "locale").absolute() def test_normalization(self): """ We test if the messages were properly created with makemessages --no-obsolete --n...
Use an absolute Path for localization tests
Use an absolute Path for localization tests
Python
agpl-3.0
Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey
9c9e564d51d44fb27101249d57d769828f14e97e
tests/integration/modules/test_win_dns_client.py
tests/integration/modules/test_win_dns_client.py
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.unit import skipIf from tests.support.helpers import destructiveTest # Import Salt libs import salt.utils.platform @skipIf(not salt.utils.platf...
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.unit import skipIf from tests.support.helpers import destructiveTest # Import Salt libs import salt.utils.platform @skipIf(not salt.utils.platf...
Fix the failing dns test on Windows
Fix the failing dns test on Windows
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
6f3336ef5dd43c02c851001715cf0f231c269276
pyramid_keystone/__init__.py
pyramid_keystone/__init__.py
default_settings = [ ('auth_url', str, 'http://localhost:5000/v3'), ('region', str, 'RegionOne'), ('user_domain_name', str, 'Default'), ('cacert', str, ''), ] def parse_settings(settings): parsed = {} def populate(name, convert, default): sname = '%s%s' % ('keystone.',...
default_settings = [ ('auth_url', str, 'http://localhost:5000/v3'), ('region', str, 'RegionOne'), ('user_domain_name', str, 'Default'), ('cacert', str, ''), ] def parse_settings(settings): parsed = {} def populate(name, convert, default): sname = '%s%s' % ('keystone.',...
Add keystone to the request
Add keystone to the request
Python
isc
bertjwregeer/pyramid_keystone
8a4819daa627f06e1a0eac87ab44176b7e2a0115
openerp/addons/openupgrade_records/lib/apriori.py
openerp/addons/openupgrade_records/lib/apriori.py
""" Encode any known changes to the database here to help the matching process """ renamed_modules = { 'base_calendar': 'calendar', 'mrp_jit': 'procurement_jit', 'project_mrp': 'sale_service', # OCA/account-invoicing 'invoice_validation_wkfl': 'account_invoice_validation_workflow', 'account_inv...
""" Encode any known changes to the database here to help the matching process """ renamed_modules = { 'base_calendar': 'calendar', 'mrp_jit': 'procurement_jit', 'project_mrp': 'sale_service', # OCA/account-invoicing 'invoice_validation_wkfl': 'account_invoice_validation_workflow', 'account_inv...
Correct renamed module names for bank-statement-import repository.
[FIX] Correct renamed module names for bank-statement-import repository.
Python
agpl-3.0
OpenUpgrade/OpenUpgrade,grap/OpenUpgrade,grap/OpenUpgrade,OpenUpgrade/OpenUpgrade,OpenUpgrade/OpenUpgrade,OpenUpgrade/OpenUpgrade,OpenUpgrade/OpenUpgrade,Endika/OpenUpgrade,grap/OpenUpgrade,Endika/OpenUpgrade,OpenUpgrade/OpenUpgrade,Endika/OpenUpgrade,grap/OpenUpgrade,grap/OpenUpgrade,OpenUpgrade/OpenUpgrade,Endika/Ope...
3d48066c78d693b89cb2daabfd1ebe756862edc5
mopidy_gmusic/__init__.py
mopidy_gmusic/__init__.py
from __future__ import unicode_literals import os from mopidy import config, exceptions, ext __version__ = '0.2.2' class GMusicExtension(ext.Extension): dist_name = 'Mopidy-GMusic' ext_name = 'gmusic' version = __version__ def get_default_config(self): conf_file = os.path.join(os.path.di...
from __future__ import unicode_literals import os from mopidy import config, ext __version__ = '0.2.2' class GMusicExtension(ext.Extension): dist_name = 'Mopidy-GMusic' ext_name = 'gmusic' version = __version__ def get_default_config(self): conf_file = os.path.join(os.path.dirname(__file...
Remove dependency check done by Mopidy
Remove dependency check done by Mopidy
Python
apache-2.0
hechtus/mopidy-gmusic,jaapz/mopidy-gmusic,Tilley/mopidy-gmusic,elrosti/mopidy-gmusic,jodal/mopidy-gmusic,jaibot/mopidy-gmusic,mopidy/mopidy-gmusic
e7bf5e84629daffd2a625759addf4eea8423e115
dataportal/broker/__init__.py
dataportal/broker/__init__.py
from .simple_broker import (_DataBrokerClass, EventQueue, Header, LocationError, IntegrityError) from .handler_registration import register_builtin_handlers DataBroker = _DataBrokerClass() # singleton, used by pims_readers import below from .pims_readers import Images, SubtractedImages reg...
from .simple_broker import (_DataBrokerClass, EventQueue, Header, LocationError, IntegrityError, fill_event) from .handler_registration import register_builtin_handlers DataBroker = _DataBrokerClass() # singleton, used by pims_readers import below from .pims_readers import Images, Subtracte...
Put fill_event in the public API.
API: Put fill_event in the public API.
Python
bsd-3-clause
NSLS-II/dataportal,NSLS-II/dataportal,danielballan/datamuxer,danielballan/dataportal,ericdill/datamuxer,danielballan/datamuxer,NSLS-II/datamuxer,ericdill/databroker,tacaswell/dataportal,ericdill/datamuxer,ericdill/databroker,danielballan/dataportal,tacaswell/dataportal
75726945934a049c9fc81066996f1670f29ead2c
test/long_test.py
test/long_test.py
import os, unittest """This module long_test provides a decorator, @long_test, that you can use to mark tests which take a lot of wall clock time. If the system environment variable SKIP_LONG_TESTS is set, tests decorated with @long_test will not be run. """ SKIP_LONG_TESTS = os.getenv('SKIP_LONG_TESTS', None) is no...
import os, unittest """This module long_test provides a decorator, @long_test, that you can use to mark tests which take a lot of wall clock time. If the system environment variable SKIP_LONG_TESTS is set, tests decorated with @long_test will not be run. """ SKIP_LONG_TESTS = os.getenv('SKIP_LONG_TESTS', '').lower()...
Improve handling of SKIP_LONG_TESTS build variable.
Improve handling of SKIP_LONG_TESTS build variable.
Python
mit
rec/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,ManiacalLabs/BiblioPixel,ManiacalLabs/BiblioPixel,ManiacalLabs/BiblioPixel
3c077d82881e3dd51eb0b3906e43f9e038346cb6
tensorflow_federated/python/core/test/__init__.py
tensorflow_federated/python/core/test/__init__.py
# Copyright 2018, The TensorFlow Federated 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 o...
# Copyright 2018, The TensorFlow Federated 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 o...
Remove `_allowed_symbols`, this is no longer used by the document generation.
Remove `_allowed_symbols`, this is no longer used by the document generation. PiperOrigin-RevId: 321657180
Python
apache-2.0
tensorflow/federated,tensorflow/federated,tensorflow/federated
64086acee22cfc2dde2fec9da1ea1b7745ce3d85
tests/misc/test_base_model.py
tests/misc/test_base_model.py
# -*- coding: UTF-8 -*- from tests.base import ApiDBTestCase class BaseModelTestCase(ApiDBTestCase): def test_repr(self): self.generate_fixture_project_status() self.generate_fixture_project() self.assertEqual(str(self.project), "<Project %s>" % self.project.name) def test_query(self...
# -*- coding: UTF-8 -*- from tests.base import ApiDBTestCase class BaseModelTestCase(ApiDBTestCase): def test_query(self): pass def test_get(self): pass def test_get_by(self): pass def test_get_all_by(self): pass def test_create(self): pass def tes...
Remove useless test about model representation
Remove useless test about model representation
Python
agpl-3.0
cgwire/zou
7310c2ce4b8ccd69374a85877c2df97a2b6ade70
nap/dataviews/views.py
nap/dataviews/views.py
from collections import defaultdict from inspect import classify_class_attrs from django.forms import ValidationError from django.utils.functional import cached_property from .fields import field from .utils import DictObject class DataView(object): def __init__(self, obj=None, **kwargs): if obj is No...
from collections import defaultdict from inspect import classify_class_attrs from django.forms import ValidationError from django.utils.functional import cached_property from .fields import field from .utils import DictObject class DataView(object): def __init__(self, obj=None, **kwargs): if obj is No...
Add _fields cache Change _update to _apply and add option for non-required fields
Add _fields cache Change _update to _apply and add option for non-required fields
Python
bsd-3-clause
limbera/django-nap,MarkusH/django-nap
2adbbe6c7291dd79784bd3a1e5702945435fa436
phasortoolbox/__init__.py
phasortoolbox/__init__.py
#!/usr/bin/env python3 import asyncio from .parser import Parser, PcapParser from .client import Client from .pdc import PDC import logging logging.getLogger(__name__).addHandler(logging.NullHandler())
#!/usr/bin/env python3 import asyncio from .synchrophasor import Synchrophasor from .parser import Parser, PcapParser from .client import Client from .pdc import PDC import logging logging.getLogger(__name__).addHandler(logging.NullHandler())
Put Synchrophasor in a seperate file
Put Synchrophasor in a seperate file
Python
mit
sonusz/PhasorToolBox
1bbc1fab976dd63e6a2f05aa35117dc74db40652
private_messages/forms.py
private_messages/forms.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from django.utils.translation import ugettext_lazy as _ from django_select2.fields import HeavySelect2MultipleChoiceField from pybb import util from private_messages.models import PrivateMessage class MessageForm(forms.ModelFo...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from django.contrib.auth import get_user_model from django.utils.translation import ugettext_lazy as _ from django_select2.fields import HeavyModelSelect2MultipleChoiceField from pybb import util from private_messages.models imp...
Use ModelSelectField. Javascript still broken for some reason.
Use ModelSelectField. Javascript still broken for some reason.
Python
mit
skolsuper/pybbm_private_messages,skolsuper/pybbm_private_messages,skolsuper/pybbm_private_messages
f1d3d2f5543c0e847c4b2051c04837cb3586846e
emission/analysis/plotting/leaflet_osm/our_plotter.py
emission/analysis/plotting/leaflet_osm/our_plotter.py
import pandas as pd import folium def get_map_list(df, potential_splits): mapList = [] potential_splits_list = list(potential_splits) for start, end in zip(potential_splits_list, potential_splits_list[1:]): trip = df[start:end] currMap = folium.Map([trip.mLatitude.mean(), trip.mLongitude.me...
import pandas as pd import folium def df_to_string_list(df): """ Convert the input df into a list of strings, suitable for using as popups in a map. This is a utility function. """ print "Converting df with size %s to string list" % df.shape[0] array_list = df.as_matrix().tolist() return [s...
Enhance our plotter to use the new div_markers code
Enhance our plotter to use the new div_markers code And to generate popups correctly
Python
bsd-3-clause
yw374cornell/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,joshzarrabi/e-mis...
19dd810c5acb35ce5d7565ee57a55ae725194bd1
mvp/integration.py
mvp/integration.py
# -*- coding: utf-8 -*- class Integration(object): name = None description = None icon = None banner = None requires_confirmation = False enabled_by_default = False columns = 1 def __init__(self): self.set_enabled(self.enabled_by_default) def fields(self): '''Ret...
# -*- coding: utf-8 -*- class Integration(object): name = None description = None icon = None banner = None requires_confirmation = False enabled_by_default = False columns = 1 def __init__(self): self.set_enabled(self.enabled_by_default) def fields(self): '''Ret...
Add finalize method to Integration.
Add finalize method to Integration.
Python
mit
danbradham/mvp
c970cab38d846c4774aee52e52c23ed2452af96a
openfisca_france_data/tests/base.py
openfisca_france_data/tests/base.py
# -*- coding: utf-8 -*- from openfisca_core.tools import assert_near from openfisca_france.tests.base import get_cached_composed_reform, get_cached_reform from .. import france_data_tax_benefit_system, FranceDataTaxBenefitSystem __all__ = [ 'assert_near', 'france_data_tax_benefit_system', 'FranceDataT...
# -*- coding: utf-8 -*- from openfisca_core.tools import assert_near from openfisca_france.tests.base import get_cached_composed_reform, get_cached_reform from .. import france_data_tax_benefit_system __all__ = [ 'assert_near', 'france_data_tax_benefit_system', 'get_cached_composed_reform', 'get_c...
Remove unused and buggy import
Remove unused and buggy import
Python
agpl-3.0
openfisca/openfisca-france-data,openfisca/openfisca-france-data,openfisca/openfisca-france-data
151599602b9d626ebcfe5ae6960ea216b767fec2
setuptools/distutils_patch.py
setuptools/distutils_patch.py
""" Ensure that the local copy of distutils is preferred over stdlib. See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 for more motivation. """ import sys import importlib from os.path import dirname sys.path.insert(0, dirname(dirname(__file__))) importlib.import_module('distutils') sys.path...
""" Ensure that the local copy of distutils is preferred over stdlib. See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 for more motivation. """ import sys import importlib import contextlib from os.path import dirname @contextlib.contextmanager def patch_sys_path(): orig = sys.path[:] ...
Update distutils patch to monkeypatch all paths from sys.path to ensure that distutils is never imported except from the same path as setuptools. Assert that 'distutils' is not already in sys.modules.
Update distutils patch to monkeypatch all paths from sys.path to ensure that distutils is never imported except from the same path as setuptools. Assert that 'distutils' is not already in sys.modules.
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
de23099e04d0a5823d6917f6f991d66e25b9002b
django_medusa/management/commands/staticsitegen.py
django_medusa/management/commands/staticsitegen.py
from django.core.management.base import BaseCommand from django_medusa.renderers import StaticSiteRenderer from django_medusa.utils import get_static_renderers class Command(BaseCommand): can_import_settings = True help = 'Looks for \'renderers.py\' in each INSTALLED_APP, which defines '\ 'a class...
from django.conf import settings from django.core.management.base import BaseCommand from django.core.urlresolvers import set_script_prefix from django_medusa.renderers import StaticSiteRenderer from django_medusa.utils import get_static_renderers class Command(BaseCommand): can_import_settings = True help =...
Add support for rendering with a URL prefix
Add support for rendering with a URL prefix This adds an optional MEDUSA_URL_PREFIX setting option that causes Django's URL reversing to render URLS prefixed with this string. This is necessary when hosting Django projects on a URI path other than /, as a proper WSGI environment is not present to tell Django what URL ...
Python
mit
hyperair/django-medusa
28770cf4d0995697f7b2c8edad7a56fb8aeabea5
Sendy.py
Sendy.py
# coding: utf-8 # ! /usr/bin/python __author__ = 'Shahariar Rabby' # # Sendy # ### Importing Send mail file # In[6]: from Sendmail import * # ** Take user email, text plan massage, HTML file ** # In[7]: TO_EMAIL = raw_input("Enter reciver email : ") #Taking Reciver email as input subject = raw_input("Enter Mail...
# coding: utf-8 # ! /usr/bin/python __author__ = 'Shahariar Rabby' # This will read details and send email to clint # # Sendy # ### Importing Send mail file # In[6]: from Sendmail import * # ** Take user email, text plan massage, HTML file ** # In[7]: TO_EMAIL = raw_input("Enter reciver email : ") #Taking Reciv...
Send email to client working
Send email to client working
Python
mit
shahariarrabby/Mail_Server
0cb45bbc1c7b6b5f1a2722e85159b97c8a555e0c
examples/providers/factory_deep_init_injections.py
examples/providers/factory_deep_init_injections.py
"""`Factory` providers deep init injections example.""" from dependency_injector import providers class Regularizer: def __init__(self, alpha): self.alpha = alpha class Loss: def __init__(self, regularizer): self.regularizer = regularizer class ClassificationTask: def __init__(self, l...
"""`Factory` providers - building a complex object graph with deep init injections example.""" from dependency_injector import providers class Regularizer: def __init__(self, alpha): self.alpha = alpha class Loss: def __init__(self, regularizer): self.regularizer = regularizer class Class...
Update the docblock of the example
Update the docblock of the example
Python
bsd-3-clause
ets-labs/dependency_injector,rmk135/dependency_injector,ets-labs/python-dependency-injector,rmk135/objects
e908a2c62be1d937a68b5c602b8cae02633685f7
csunplugged/general/management/commands/updatedata.py
csunplugged/general/management/commands/updatedata.py
"""Module for the custom Django updatedata command.""" from django.core import management class Command(management.base.BaseCommand): """Required command class for the custom Django updatedata command.""" help = "Update all data from content folders for all applications" def add_arguments(self, parser)...
"""Module for the custom Django updatedata command.""" from django.core import management class Command(management.base.BaseCommand): """Required command class for the custom Django updatedata command.""" help = "Update all data from content folders for all applications" def add_arguments(self, parser)...
Load at a distance content in updatadata command
Load at a distance content in updatadata command
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
047c95e255d6aac31651e3a95e2045de0b4888e2
flask_app.py
flask_app.py
import json from flask import abort from flask import Flask from flask_caching import Cache from flask_cors import CORS import main app = Flask(__name__) cache = Cache(app, config={'CACHE_TYPE': 'simple'}) cors = CORS(app, resources={r"/api/*": {"origins": "*"}}) @app.route('/') def display_available(): conten...
from flask import Flask, abort, jsonify from flask_caching import Cache from flask_cors import CORS import main app = Flask(__name__) cache = Cache(app, config={'CACHE_TYPE': 'simple'}) cors = CORS(app, resources={r"/api/*": {"origins": "*"}}) @app.route('/') def display_available(): content = ('<html>' + ...
Make a real json response.
Make a real json response.
Python
bsd-3-clause
talavis/kimenu
df2bf7cc95f38d9e6605dcc91e56b28502063b6a
apps/faqs/admin.py
apps/faqs/admin.py
from cms.admin import PageBaseAdmin, SearchMetaBaseAdmin from django.contrib import admin from .models import Category, Faq @admin.register(Faq) class FaqAdmin(SearchMetaBaseAdmin): """ Admin settings for the Faq model """ prepopulated_fields = {"url_title": ("question",)} filter_horizontal = ("categorie...
from cms.admin import PageBaseAdmin, SearchMetaBaseAdmin from django.contrib import admin from .models import Category, Faq @admin.register(Faq) class FaqAdmin(SearchMetaBaseAdmin): """ Admin settings for the Faq model """ prepopulated_fields = {"url_title": ("question",)} filter_horizontal = ("categorie...
Fix usage of `url_title` in CategoryAdmin.
Fix usage of `url_title` in CategoryAdmin.
Python
mit
onespacemedia/cms-faqs,onespacemedia/cms-faqs
6050b32ddb812e32da08fd15f210d9d9ee794a42
first-program.py
first-program.py
# Python program for Programming for Everybody (Getting Started with Python) by University of Michigan - Charles Severance # Task 1 Python code with single print statement but not print hello world print "It is a great feeling to code in Python"
# Python program for Programming for Everybody (Getting Started with Python) by University of Michigan - Charles Severance # Task 1 Python code with single print statement but not print hello world print "It is a great feeling to code in Python" print "Hello World!"
Print Hello World in Python
Print Hello World in Python
Python
mit
rahulbohra/Python-Basic
88abdf5365977a47abaa0d0a8f3275e4635c8378
singleuser/user-config.py
singleuser/user-config.py
import os mylang = 'test' family = 'wikipedia' custom_path = os.path.expanduser('~/user-config.py') if os.path.exists(custom_path): with open(custom_path, 'rb') as f: exec(compile(f.read(), custom_path, 'exec'), globals()) del f # Clean up temp variables, since pwb issues a warning otherwise # to he...
import os mylang = 'test' family = 'wikipedia' custom_path = os.path.expanduser('~/user-config.py') if os.path.exists(custom_path): with open(custom_path, 'rb') as f: exec(compile(f.read(), custom_path, 'exec'), globals()) del f # Clean up temp variables, since pwb issues a warning otherwise # to he...
Fix OAuth integration for all wiki families
Fix OAuth integration for all wiki families Earlier you needed to edit config file to set family to whatever you were working on, even if you constructed a Site object referring to other website. This would cause funky errors about 'Logged in as X, expected None' errors. Fix by listing almost all the families people ...
Python
mit
yuvipanda/paws,yuvipanda/paws
294dabd8cc6bfc7e004a1a0dde9b40e9535d4b19
organizer/views.py
organizer/views.py
from django.http.response import HttpResponse from django.template import Context, loader from .models import Tag def homepage(request): tag_list = Tag.objects.all() template = loader.get_template( 'organizer/tag_list.html') context = Context({'tag_list': tag_list}) output = template.render(c...
from django.http.response import ( Http404, HttpResponse) from django.template import Context, loader from .models import Tag def homepage(request): tag_list = Tag.objects.all() template = loader.get_template( 'organizer/tag_list.html') context = Context({'tag_list': tag_list}) output = t...
Raise 404 Error if no Tag exists.
Ch05: Raise 404 Error if no Tag exists.
Python
bsd-2-clause
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8
a95c3bff0065ed5612a0786e7d8fd3e43fe71ff7
src/som/interpreter/ast/nodes/message/super_node.py
src/som/interpreter/ast/nodes/message/super_node.py
from .abstract_node import AbstractMessageNode class SuperMessageNode(AbstractMessageNode): def __init__(self, selector, receiver, args, super_class, source_section = None): AbstractMessageNode.__init__(self, selector, None, receiver, args, source_section) self._method = None self._super_c...
from .abstract_node import AbstractMessageNode class SuperMessageNode(AbstractMessageNode): _immutable_fields_ = ['_method?', '_super_class', '_selector'] def __init__(self, selector, receiver, args, super_class, source_section = None): AbstractMessageNode.__init__(self, selector, None, receiver, ar...
Declare immutable fields in SuperMessageNode
Declare immutable fields in SuperMessageNode Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>
Python
mit
SOM-st/PySOM,SOM-st/PySOM,smarr/PySOM,smarr/PySOM
5bcc4ae60f89fbcadad234e0d6b9a755d28aab5d
pavement.py
pavement.py
import subprocess from paver.easy import * def call(*args, **kwargs): return subprocess.call(args, **kwargs) @task def build(): """Package up the app.""" call('palm-package', '.') @task def halt(): call('palm-launch', '--device=emulator', '-c', 'org.markpasc.paperplain') @task @needs('halt') def ...
import subprocess from paver.easy import * def call(*args, **kwargs): return subprocess.call(args, **kwargs) @task def build(): """Package up the app.""" call('palm-package', '.') @task def halt(): call('palm-launch', '--device=emulator', '-c', 'org.markpasc.paperplain') @task @needs('halt') def ...
Handle ctrl-C-ing out of palm-log
Handle ctrl-C-ing out of palm-log
Python
mit
markpasc/paperplain,markpasc/paperplain
14b1648b96064363a833c496da38e62ffc9dbbcb
external_tools/src/main/python/images/common.py
external_tools/src/main/python/images/common.py
#!/usr/bin/python #splitString='images/clean/impc/' splitString='images/holding_area/impc/'
#!/usr/bin/python splitString='images/clean/impc/'
Revert splitString to former value
Revert splitString to former value
Python
apache-2.0
mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData,mpi2/PhenotypeData
9da303e48820e95e1bfd206f1c0372f896dac6ec
draftjs_exporter/constants.py
draftjs_exporter/constants.py
from __future__ import absolute_import, unicode_literals # http://stackoverflow.com/a/22723724/1798491 class Enum(object): def __init__(self, tuple_list): self.tuple_list = tuple_list def __getattr__(self, name): if name not in self.tuple_list: raise AttributeError("'Enum' has no ...
from __future__ import absolute_import, unicode_literals # http://stackoverflow.com/a/22723724/1798491 class Enum(object): def __init__(self, *elements): self.elements = tuple(elements) def __getattr__(self, name): if name not in self.elements: raise AttributeError("'Enum' has no ...
Allow enum to be created more easily
Allow enum to be created more easily
Python
mit
springload/draftjs_exporter,springload/draftjs_exporter,springload/draftjs_exporter
70a251ba27641e3c0425c659bb900e17f0f423dd
scripts/create_initial_admin_user.py
scripts/create_initial_admin_user.py
#!/usr/bin/env python """Create an initial user with admin privileges to begin BYCEPS setup. :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import click from byceps.database import db from byceps.services.user import creation_service as user_creation_service from byc...
#!/usr/bin/env python """Create an initial user with admin privileges to begin BYCEPS setup. :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import click from byceps.services.user import creation_service as user_creation_service from byceps.services.user import servic...
Enable initial user via service so that an event gets written
Enable initial user via service so that an event gets written
Python
bsd-3-clause
homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps
65ae8fc33a1fa7297d3e68f7c67ca5c2678e81b7
app/__init__.py
app/__init__.py
from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate from flask_mail import Mail app = Flask(__name__) app.config.from_object('config') db = SQLAlchemy(app) migrate = Migrate(app, db) # Load Flask-Mail mail = Mail(app) from app import views, models
from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate from flask_mail import Mail from flask_user import UserManager, SQLAlchemyAdapter app = Flask(__name__) app.config.from_object('config') db = SQLAlchemy(app) migrate = Migrate(app, db) # Load Flask-Mail mail = Mail(app)...
Set up Flask-User to provide user auth
Set up Flask-User to provide user auth
Python
agpl-3.0
interactomix/iis,interactomix/iis
d2e82419a8f1b7ead32a43e6a03ebe8093374840
opps/channels/forms.py
opps/channels/forms.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import forms from django.utils.translation import ugettext_lazy as _ from .models import Channel class ChannelAdminForm(forms.ModelForm): layout = forms.ChoiceField(choices=(('default', _('Default')),)) class Meta: model = Channel
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import forms from django.utils.translation import ugettext_lazy as _ from .models import Channel class ChannelAdminForm(forms.ModelForm): layout = forms.ChoiceField(choices=(('default', _('Default')),)) def __init__(self, *args, **kwargs): su...
Set slug field readonly after channel create
Set slug field readonly after channel create
Python
mit
williamroot/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,jeanmask/opps,opps/opps,williamroot/opps,opps/opps,YACOWS/opps,opps/opps,opps/opps,YACOWS/opps
c9284827eeec90a253157286214bc1d17771db24
neutron/tests/api/test_service_type_management.py
neutron/tests/api/test_service_type_management.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Remove skip of service-type management API test
Remove skip of service-type management API test Advanced services split is complete so remove the skip for the service-type management API test. (Yes, there is only one placeholder test. More tests need to be developed.) Also remove the obsolete 'JSON' suffix from the test class. Closes-bug: 1400370 Change-Id: I5b...
Python
apache-2.0
NeCTAR-RC/neutron,apporc/neutron,takeshineshiro/neutron,mmnelemane/neutron,barnsnake351/neutron,glove747/liberty-neutron,sasukeh/neutron,SamYaple/neutron,dhanunjaya/neutron,swdream/neutron,noironetworks/neutron,bgxavier/neutron,chitr/neutron,eonpatapon/neutron,glove747/liberty-neutron,paninetworks/neutron,antonioUnina/...
a619d5b35eb88ab71126e53f195190536d71fdb4
orionsdk/swisclient.py
orionsdk/swisclient.py
import requests import json from datetime import datetime def _json_serial(obj): """JSON serializer for objects not serializable by default json code""" if isinstance(obj, datetime): serial = obj.isoformat() return serial class SwisClient: def __init__(self, hostname, username, password,...
import requests import json from datetime import datetime def _json_serial(obj): """JSON serializer for objects not serializable by default json code""" if isinstance(obj, datetime): serial = obj.isoformat() return serial class SwisClient: def __init__(self, hostname, username, password,...
Throw exceptions error responses from server
Throw exceptions error responses from server
Python
apache-2.0
solarwinds/orionsdk-python
2a2a1c9ad37932bf300caf02419dd55a463d46d1
src/tmod_tools/__main__.py
src/tmod_tools/__main__.py
""" Entrypoint module, in case you use `python -mtmod_tools`. Why does this file exist, and why __main__? For more info, read: - https://www.python.org/dev/peps/pep-0338/ - https://docs.python.org/2/using/cmdline.html#cmdoption-m - https://docs.python.org/3/using/cmdline.html#cmdoption-m """ from tmod_tools.cli impo...
""" Entrypoint module, in case you use `python -mtmod_tools`. Why does this file exist, and why __main__? For more info, read: - https://www.python.org/dev/peps/pep-0338/ - https://docs.python.org/2/using/cmdline.html#cmdoption-m - https://docs.python.org/3/using/cmdline.html#cmdoption-m """ from tmod_tools.cli impo...
Add nocov for lines that will never normally run
Add nocov for lines that will never normally run
Python
isc
mystfox/python-tmod-tools
3fd2d1cade716f264b2febc3627b1443a1d3e604
taiga/projects/migrations/0043_auto_20160530_1004.py
taiga/projects/migrations/0043_auto_20160530_1004.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-05-30 10:04 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('projects', '0042_auto_20160...
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-05-30 10:04 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('projects', '0040_remove_mem...
Fix a problem with a migration between master and stable branch
Fix a problem with a migration between master and stable branch
Python
agpl-3.0
taigaio/taiga-back,dayatz/taiga-back,xdevelsistemas/taiga-back-community,taigaio/taiga-back,taigaio/taiga-back,dayatz/taiga-back,dayatz/taiga-back,xdevelsistemas/taiga-back-community,xdevelsistemas/taiga-back-community
6916a3fb24a12ce3c0261034c1dcaae57a8cd0ee
docs/examples/kernel/task2.py
docs/examples/kernel/task2.py
#!/usr/bin/env python # encoding: utf-8 from IPython.kernel import client import time tc = client.TaskClient() mec = client.MultiEngineClient() mec.execute('import time') for i in range(24): tc.run(client.StringTask('time.sleep(1)')) for i in range(6): time.sleep(1.0) print "Queue status (vebose=False)...
#!/usr/bin/env python # encoding: utf-8 from IPython.kernel import client import time import sys flush = sys.stdout.flush tc = client.TaskClient() mec = client.MultiEngineClient() mec.execute('import time') for i in range(24): tc.run(client.StringTask('time.sleep(1)')) for i in range(6): time.sleep(1.0) ...
Add stdout flushing statements to example.
Add stdout flushing statements to example. This forces the prints to happen right away, so the example behaves a little more like you'd expect.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
306c56883939be640512f3d835b8d3f6b93b4ad7
judge/signals.py
judge/signals.py
from django.core.cache.utils import make_template_fragment_key from django.db.models.signals import post_save from django.dispatch import receiver from django.core.cache import cache from .models import Problem, Contest, Submission, Organization from .caching import update_submission @receiver(post_save, sender=Probl...
from django.core.cache.utils import make_template_fragment_key from django.db.models.signals import post_save from django.dispatch import receiver from django.core.cache import cache from .models import Problem, Contest, Submission, Organization, Profile from .caching import update_submission @receiver(post_save, sen...
Clear cache when user changes info.
Clear cache when user changes info.
Python
agpl-3.0
Minkov/site,monouno/site,DMOJ/site,DMOJ/site,Phoenix1369/site,DMOJ/site,Phoenix1369/site,monouno/site,monouno/site,Phoenix1369/site,Minkov/site,Minkov/site,Phoenix1369/site,Minkov/site,monouno/site,monouno/site,DMOJ/site
23f734419ac3814e09ef3763fb666a3620ac1c01
scripts/osfstorage/correct_moved_node_settings.py
scripts/osfstorage/correct_moved_node_settings.py
import sys import logging from scripts import utils as script_utils from framework.transactions.context import TokuTransaction from website.app import init_app from website.addons.osfstorage import model logger = logging.getLogger(__name__) def do_migration(): for node_settings in model.OsfStorageNodeSettings.f...
import sys import logging from scripts import utils as script_utils from framework.transactions.context import TokuTransaction from website.app import init_app from website.addons.osfstorage import model logger = logging.getLogger(__name__) def do_migration(): count = 0 errored = 0 for node_settings in ...
Add count and allow errors to pass for now
Add count and allow errors to pass for now [skip ci]
Python
apache-2.0
pattisdr/osf.io,abought/osf.io,DanielSBrown/osf.io,samanehsan/osf.io,billyhunt/osf.io,brandonPurvis/osf.io,samchrisinger/osf.io,brandonPurvis/osf.io,mattclark/osf.io,emetsger/osf.io,brianjgeiger/osf.io,mfraezz/osf.io,jmcarp/osf.io,acshi/osf.io,crcresearch/osf.io,sbt9uc/osf.io,mluke93/osf.io,haoyuchen1992/osf.io,acshi/o...
fab10307cac59f758a5b36cf3fe5b80874f026b2
script/dependencies.py
script/dependencies.py
#!/usr/bin/env python import os dependencies = ( ('bins/el-rando', 'https://github.com/EvanHahn/el-rando.git'), ('bins/is_github_up', 'https://github.com/EvanHahn/is-GitHub-up.git'), ('bins/iscp', 'https://github.com/EvanHahn/iscp.git'), ('bins/journ', 'https://github.com/EvanHahn/journ.git'), ('b...
#!/usr/bin/env python import os dependencies = ( ('resources/vim/bundle/neobundle.vim', 'https://github.com/Shougo/neobundle.vim'), ('resources/zsh/zsh-syntax-highlighting', 'git://github.com/zsh-users/zsh-syntax-highlighting.git'), ('bins/el-rando', 'https://github.com/EvanHahn/el-rando....
Switch to automated git clone and pull
Switch to automated git clone and pull
Python
unlicense
EvanHahn/dotfiles,EvanHahn/dotfiles,EvanHahn/dotfiles,EvanHahn/dotfiles
776150670026aae3fd53b75df6024bee32a677b5
examples/image_test.py
examples/image_test.py
import sys import os import pyglet.window from pyglet.gl import * from pyglet import clock from pyglet.ext.scene2d import Image2d from ctypes import * if len(sys.argv) != 2: print 'Usage: %s <PNG/JPEG filename>'%sys.argv[0] sys.exit() window = pyglet.window.Window(width=400, height=400) image = Image2d.loa...
import sys import os import ctypes import pyglet.window from pyglet.gl import * from pyglet import clock from pyglet import image if len(sys.argv) != 2: print 'Usage: %s <PNG/JPEG filename>'%sys.argv[0] sys.exit() window = pyglet.window.Window(width=400, height=400) image = image.load(sys.argv[1]) imx = imy ...
Use the core, make example more useful.
Use the core, make example more useful.
Python
bsd-3-clause
theblacklion/pyglet,mammadori/pyglet,mammadori/pyglet,oktayacikalin/pyglet,theblacklion/pyglet,oktayacikalin/pyglet,theblacklion/pyglet,theblacklion/pyglet,mammadori/pyglet,theblacklion/pyglet,oktayacikalin/pyglet,mammadori/pyglet,oktayacikalin/pyglet,oktayacikalin/pyglet
051aa6ca11bda22f4ea04775826f0f64152fef24
scripts/has_open_pr.py
scripts/has_open_pr.py
import argparse import os import sys from github3 import login class HasOpenPull(object): def __init__(self): self._init_github() def _init_github(self): username = os.environ.get('GITHUB_USERNAME') password = os.environ.get('GITHUB_PASSWORD') if not username or not password: ...
import argparse import os import sys from github3 import login class HasOpenPull(object): def __init__(self): self._init_github() def _init_github(self): username = os.environ.get('GITHUB_USERNAME') password = os.environ.get('GITHUB_PASSWORD') if not username or not password: ...
Add comment about new script logic [skip CumulusCI-Test]
Add comment about new script logic [skip CumulusCI-Test]
Python
bsd-3-clause
e02d96ec16/CumulusCI,e02d96ec16/CumulusCI,SalesforceFoundation/CumulusCI,SalesforceFoundation/CumulusCI
7862dbc54ecbe274f36b5142defd0547537bd7cd
tests/test_01_create_index.py
tests/test_01_create_index.py
"""Create an image index. """ import os.path import shutil import filecmp import pytest import photo.index from conftest import tmpdir, gettestdata testimgs = [ "dsc_4623.jpg", "dsc_4664.jpg", "dsc_4831.jpg", "dsc_5126.jpg", "dsc_5167.jpg" ] testimgfiles = [ gettestdata(i) for i in testimgs ] refindex = g...
"""Create an image index. """ import os.path import shutil import filecmp import pytest import photo.index from conftest import tmpdir, gettestdata testimgs = [ "dsc_4623.jpg", "dsc_4664.jpg", "dsc_4831.jpg", "dsc_5126.jpg", "dsc_5167.jpg" ] testimgfiles = [ gettestdata(i) for i in testimgs ] refindex = g...
Add another test creating the index in the current working directory.
Add another test creating the index in the current working directory.
Python
apache-2.0
RKrahl/photo-tools
cc841cc1020ca4df6f303fbb05e497a7c69c92f0
akvo/rsr/migrations/0087_auto_20161110_0920.py
akvo/rsr/migrations/0087_auto_20161110_0920.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def fix_employment_groups(apps, schema_editor): # We can't import the Employment or Group model directly as it may be a # newer version than this migration expects. We use the historical version. Group = apps...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def fix_employment_groups(apps, schema_editor): # We can't import the Employment or Group model directly as it may be a # newer version than this migration expects. We use the historical version. Group = apps...
Fix broken migration with try-except blocks
Fix broken migration with try-except blocks Duplicate key errors were being caused if an employment similar to the one being created by the migration already existed.
Python
agpl-3.0
akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr
9715c55bdc5827ee399f02559c30bd053368dc8a
billjobs/tests/tests_user_admin_api.py
billjobs/tests/tests_user_admin_api.py
from django.test import TestCase from django.contrib.auth.models import User from rest_framework import status from rest_framework.test import APIClient, APIRequestFactory, \ force_authenticate from billjobs.views import UserAdmin, UserAdminDetail class UserAdminAPI(TestCase): """ Test User Admin API REST ...
from django.test import TestCase from django.contrib.auth.models import User from rest_framework import status from rest_framework.test import APIClient, APIRequestFactory, \ force_authenticate from billjobs.views import UserAdmin, UserAdminDetail class UserAdminAPI(TestCase): """ Test User Admin API REST ...
Test anonymous user do not access user list endpoint
Test anonymous user do not access user list endpoint
Python
mit
ioO/billjobs
25ba377b7254ed770360bb1ee5a6ef6cb631f564
openedx/stanford/djangoapps/register_cme/admin.py
openedx/stanford/djangoapps/register_cme/admin.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from .models import ExtraInfo class ExtraInfoAdmin(admin.ModelAdmin): """ Admin interface for ExtraInfo model. """ readonly_fields = ( 'user', ) class Meta(object): model = Extr...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from .models import ExtraInfo class ExtraInfoAdmin(admin.ModelAdmin): """ Admin interface for ExtraInfo model. """ list_display = ( 'user', 'get_email', 'last_name', 'fir...
Make ExtraInfo list user-friendly in Django Admin
Make ExtraInfo list user-friendly in Django Admin `Register_cme/extrainfo` in Django Admin was previously displaying users as `ExtraInfo` objects which admins had to click on individually to see each user's information. Each user is now displayed with fields: username, email, last and first name. Username is clickable...
Python
agpl-3.0
Stanford-Online/edx-platform,caesar2164/edx-platform,caesar2164/edx-platform,Stanford-Online/edx-platform,Stanford-Online/edx-platform,caesar2164/edx-platform,Stanford-Online/edx-platform,caesar2164/edx-platform
627a0dddbfe4982c4079b8ba49a55d7de53eeb11
runtests.py
runtests.py
#!/usr/bin/env python import os import sys from django.conf import settings import django DEFAULT_SETTINGS = { 'INSTALLED_APPS': ( 'django.contrib.gis', 'spillway', 'tests', ), 'DATABASES': { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.spatialite', ...
#!/usr/bin/env python import os import sys import shutil import tempfile from django.conf import settings import django TMPDIR = tempfile.mkdtemp(prefix='spillway_') DEFAULT_SETTINGS = { 'INSTALLED_APPS': ( 'django.contrib.gis', 'spillway', 'tests', ), 'DATABASES': { 'defa...
Use media root temp dir for tests
Use media root temp dir for tests
Python
bsd-3-clause
barseghyanartur/django-spillway,kuzmich/django-spillway,bkg/django-spillway
98c0ccec77cc6f1657c21acb3cdc07b483a9a178
proselint/checks/writegood/lexical_illusions.py
proselint/checks/writegood/lexical_illusions.py
"""WGD200: Lexical illusions. --- layout: post error_code: WGD200 source: write-good source_url: https://github.com/btford/write-good title: Lexical illusion present date: 2014-06-10 12:31:19 categories: writing --- A lexical illusion happens when a word word is unintentiall repeated twice, and and...
"""WGD200: Lexical illusions. --- layout: post error_code: WGD200 source: write-good source_url: https://github.com/btford/write-good title: Lexical illusion present date: 2014-06-10 12:31:19 categories: writing --- A lexical illusion happens when a word word is unintentiall repeated twice, and and...
Remove "is is" from lexical illusions
Remove "is is" from lexical illusions
Python
bsd-3-clause
jstewmon/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint
4710db78a5904ed381755cdf55a48ef4b3541619
python/python2/simplerandom/iterators/__init__.py
python/python2/simplerandom/iterators/__init__.py
""" Simple Pseudo-random number generators. This module provides iterators that generate unsigned 32-bit PRNs. """ __all__ = [ "RandomCongIterator", "RandomSHR3Iterator", "RandomMWCIterator", "RandomMWC64Iterator", "RandomKISSIterator", "RandomKISS2Iterator", "RandomLFIB4Iterator", "Ra...
""" Simple Pseudo-random number generators. This module provides iterators that generate unsigned 32-bit PRNs. """ __all__ = [ "RandomCongIterator", "RandomSHR3Iterator", "RandomMWCIterator", "RandomMWC64Iterator", "RandomKISSIterator", "RandomKISS2Iterator", "RandomLFIB4Iterator", "Ra...
Add LFSR113 to init file.
Add LFSR113 to init file.
Python
mit
cmcqueen/simplerandom,cmcqueen/simplerandom,cmcqueen/simplerandom,cmcqueen/simplerandom,cmcqueen/simplerandom
84a2f2f019216ec96121159365ef4ca66f5d4e25
corehq/util/couch.py
corehq/util/couch.py
from couchdbkit import ResourceNotFound from django.http import Http404 from jsonobject.exceptions import WrappingAttributeError def get_document_or_404(cls, domain, doc_id, additional_doc_types=None): """ Gets a document and enforces its domain and doc type. Raises Http404 if the doc isn't found or domai...
from couchdbkit import ResourceNotFound from django.http import Http404 from jsonobject.exceptions import WrappingAttributeError def get_document_or_404(cls, domain, doc_id, additional_doc_types=None): """ Gets a document and enforces its domain and doc type. Raises Http404 if the doc isn't found or domai...
Handle doc without domain or domains
Handle doc without domain or domains
Python
bsd-3-clause
qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
5188561f7de7f6762e1820a6b447f144f963b1d0
common/spaces.py
common/spaces.py
"""Digital Ocean Spaces interaction""" import boto3 from django.conf import settings class SpacesBucket(): """Interact with Spaces buckets""" def __init__(self): session = boto3.session.Session() self._client = session.client('s3', region_name='nyc3', ...
"""Digital Ocean Spaces interaction""" import boto3 from django.conf import settings class SpacesBucket(): """Interact with Spaces buckets""" def __init__(self, space_name="lutris"): session = boto3.session.Session() self._client = session.client('s3', reg...
Add upload to Spaces API client
Add upload to Spaces API client
Python
agpl-3.0
lutris/website,lutris/website,lutris/website,lutris/website
48ae2127fcd2e6b1ba1b0d2649d936991a30881b
juliet.py
juliet.py
#!/usr/bin/python3 import argparse, sys from src import Configurator, Builder, Loader def main(): """ Parse command line arguments and execute passed subcommands. """ # Parse subcommand parser = argparse.ArgumentParser(description='Pythonic static sites generator') subparsers = parser.add_subparsers...
#!/usr/bin/python3 import argparse, sys from src import Configurator, Builder, Loader def main(): """ Parse command line arguments and execute passed subcommands. """ # Parse subcommand parser = argparse.ArgumentParser(description='Pythonic static sites generator') subparsers = parser.add_subparsers...
Load statics like posts and pages. Documentation.
Load statics like posts and pages. Documentation.
Python
mit
hlef/juliet,hlef/juliet,hlef/juliet
ff80cfab47b03de5d86d82907de0f28caa7829e9
test_project/dashboards.py
test_project/dashboards.py
from controlcenter import Dashboard, widgets class EmptyDashboard(Dashboard): pass class MyWidget0(widgets.Widget): pass class MyWidget1(widgets.Widget): pass class NonEmptyDashboard(Dashboard): widgets = [ MyWidget0, widgets.Group([MyWidget1]) ]
from controlcenter import Dashboard, widgets class EmptyDashboard(Dashboard): pass class MyWidget0(widgets.Widget): template_name = 'chart.html' class MyWidget1(widgets.Widget): template_name = 'chart.html' class NonEmptyDashboard(Dashboard): widgets = [ MyWidget0, widgets.Group(...
Define template_name for test widgets
Tests: Define template_name for test widgets This avoids an "AssertionError: MyWidget0.template_name is not defined." on Django 2.1, which no longer silences {% include %} exceptions. Django deprecation notes: https://docs.djangoproject.com/en/2.1/internals/deprecation/#deprecation-removed-in-2-1
Python
bsd-3-clause
byashimov/django-controlcenter,byashimov/django-controlcenter,byashimov/django-controlcenter
9d9704f631156e01d55d1d1217a41ab3704bdc03
tests/unit/test_context.py
tests/unit/test_context.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # 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/...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # 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/...
Replace direct use of testtools BaseTestCase.
Replace direct use of testtools BaseTestCase. Using the BaseTestCase across the tests in the tree lets us put in log fixtures and consistently handle mox and stubout. Part of blueprint grizzly-testtools. Change-Id: Iba7eb2c63b0c514009b2c28e5930b27726a147b0
Python
apache-2.0
dims/oslo.context,JioCloud/oslo.context,citrix-openstack-build/oslo.context,varunarya10/oslo.context,openstack/oslo.context,yanheven/oslo.middleware
f23cfabee531a6aaa050b647b9ae54ad047335ea
ixdjango/logging_.py
ixdjango/logging_.py
""" Logging Handler """ import logging import logging.handlers import os import re import socket class IXAFormatter(logging.Formatter): """ A formatter for IXA logging environment. """ HOSTNAME = re.sub( r':\d+$', '', os.environ.get('SITE_DOMAIN', socket.gethostname())) FORMAT = '%(ascti...
""" Logging Handler """ import logging import logging.handlers import os import re import socket import time class IXAFormatter(logging.Formatter): """ A formatter for IXA logging environment. """ HOSTNAME = re.sub( r':\d+$', '', os.environ.get('SITE_DOMAIN', socket.gethostname())) FORMA...
Change time format to properly formatted UTC
Change time format to properly formatted UTC [#46004]
Python
mit
infoxchange/ixdjango
640ce1a3b4f9cca4ebcc10f3d62b1d4d995dd0c5
src/foremast/pipeline/create_pipeline_manual.py
src/foremast/pipeline/create_pipeline_manual.py
# Foremast - Pipeline Tooling # # Copyright 2016 Gogo, LLC # # 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...
# Foremast - Pipeline Tooling # # Copyright 2016 Gogo, LLC # # 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...
Delete manual Pipeline before creating
fix: Delete manual Pipeline before creating See also: #72
Python
apache-2.0
gogoair/foremast,gogoair/foremast
8fb2eb1c51daa5614b1b4ab15428350d2b28c093
accounts/models.py
accounts/models.py
# coding: utf-8 from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from registration.signals import user_activated from django.dispatch import receiver class UserAccount(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL, ...
# coding: utf-8 from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from registration.signals import user_activated from django.dispatch import receiver class UserAccount(models.Model): """ A user account. Used to store any information related...
Add docstring to UserAccount model
Add docstring to UserAccount model
Python
agpl-3.0
pitpalme/volunteer_planner,pitpalme/volunteer_planner,flindenberg/volunteer_planner,klinger/volunteer_planner,flindenberg/volunteer_planner,alper/volunteer_planner,volunteer-planner/volunteer_planner,coders4help/volunteer_planner,coders4help/volunteer_planner,klinger/volunteer_planner,volunteer-planner/volunteer_planne...