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
556e9f5a9f04b730260268a769cbd7170868f693
opps/__init__.py
opps/__init__.py
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__)
#!/usr/bin/env python # -*- coding: utf-8 -*- import pkg_resources pkg_resources.declare_namespace(__name__)
Fix pkg resources declare namespace
Fix pkg resources declare namespace
Python
mit
opps/opps-polls,opps/opps-polls
501eb4ee71e47d90c155072b15d8ad840ff01098
voting/management/commands/send_vote_invitation_emails.py
voting/management/commands/send_vote_invitation_emails.py
import datetime from django.core.mail.message import EmailMultiAlternatives from django.core.management.base import BaseCommand from django.template import Context from django.template.loader import get_template from project import settings from voting.models import VoteToken class Command(BaseCommand): def ha...
import datetime from django.core.mail.message import EmailMultiAlternatives from django.core.management.base import BaseCommand from django.template import Context from django.template.loader import get_template from project import settings from voting.models import VoteToken class Command(BaseCommand): def ha...
Add print statement to send invite command
Add print statement to send invite command
Python
bsd-3-clause
WebCampZg/conference-web,WebCampZg/conference-web,WebCampZg/conference-web
f7a601284d1654671fb87a006cb303bd792e14b4
tracpro/polls/tests/test_utils.py
tracpro/polls/tests/test_utils.py
# coding=utf-8 from __future__ import absolute_import, unicode_literals from tracpro.test.cases import TracProTest from .. import utils class TestExtractWords(TracProTest): def test_extract_words(self): self.assertEqual( utils.extract_words("I think it's good", "eng"), ['think',...
# coding=utf-8 from __future__ import absolute_import, unicode_literals from django.test import TestCase from tracpro.test.cases import TracProTest from .. import utils class TestExtractWords(TracProTest): def test_extract_words(self): self.assertEqual( utils.extract_words("I think it's go...
Add test for sorting with category natural key
Add test for sorting with category natural key
Python
bsd-3-clause
xkmato/tracpro,rapidpro/tracpro,rapidpro/tracpro,rapidpro/tracpro,xkmato/tracpro,xkmato/tracpro,xkmato/tracpro
e91dc26cc983f98de1efb09cbf687c70ca0f557d
transitions/extensions/locking.py
transitions/extensions/locking.py
from ..core import Machine, Transition, Event from threading import RLock import inspect class LockedMethod: def __init__(self, lock, func): self.lock = lock self.func = func def __call__(self, *args, **kwargs): with self.lock: return self.func(*args, **kwargs) class L...
from ..core import Machine, Transition, Event, listify from threading import RLock import inspect try: from contextlib import nested # Python 2 except ImportError: from contextlib import ExitStack, contextmanager @contextmanager def nested(*contexts): """ Reimplementation of nested i...
Allow injecting a lock, or arbitrary context managers into LockedMachine
Allow injecting a lock, or arbitrary context managers into LockedMachine
Python
mit
pytransitions/transitions,tyarkoni/transitions,pytransitions/transitions
954fae8ece0c1f2c36a9f8eace9d060546022b2e
filters/tests/config_test.py
filters/tests/config_test.py
from __future__ import absolute_import import unittest from flask import Flask from .. import config app = Flask('__config_test') class GetFuncsTest(unittest.TestCase): """All tests for get funcs function.""" def test_get_module_funcs(self): """Test the return value.""" self.assertIsInstan...
"""Test configuration utilities.""" from __future__ import absolute_import import unittest from flask import Flask from .. import config app = Flask('__config_test') class GetFuncsTest(unittest.TestCase): """All tests for get funcs function.""" def test_get_module_funcs(self): """Test the return ...
Remove protected class access, add module docstrings.
Remove protected class access, add module docstrings.
Python
mit
christabor/flask_extras,christabor/jinja2_template_pack,christabor/jinja2_template_pack,christabor/flask_extras
edca0ed4d7a03c0cd36a0ff132d6a9b89c374203
lizard_auth_server/utils.py
lizard_auth_server/utils.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from random import SystemRandom from django.conf import settings import string # Note: the code in this module must be identical in both lizard-auth-server # and lizard-auth-client! random = SystemRandom() KEY_CHARACTERS = string.letters + string.digi...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from random import SystemRandom from django.conf import settings import string # Note: the code in this module must be identical in both lizard-auth-server # and lizard-auth-client! random = SystemRandom() KEY_CHARACTERS = string.letters + string.digit...
Add is_active to the list of keys to be dumped as json
Add is_active to the list of keys to be dumped as json
Python
mit
lizardsystem/lizard-auth-server,lizardsystem/lizard-auth-server
faae5df8648afbfa5921bd67a7f3e082ba626a95
poyo/__init__.py
poyo/__init__.py
# -*- coding: utf-8 -*- __author__ = 'Raphael Pierzina' __email__ = 'raphael@hackebrot.de' __version__ = '0.1.0' from .parser import parse_string __all__ = ['parse_string']
# -*- coding: utf-8 -*- from .parser import parse_string __author__ = 'Raphael Pierzina' __email__ = 'raphael@hackebrot.de' __version__ = '0.1.0' __all__ = ['parse_string']
Move module level import to top of file
Move module level import to top of file
Python
mit
hackebrot/poyo
4c5acfeac467d9323be47da304e6a3e51b28a78d
python/python_condaenv_preamble/time_once.py
python/python_condaenv_preamble/time_once.py
import time class TimeOnce: """Time a sequence of code, allowing access to the time difference in seconds. Example without exception: elapsed = TimeOnce() with elapsed: print('sleeping ...') time.sleep(3) print("elapsed", elapsed) Example with exception: ...
import time class TimeOnce: """Time a sequence of code, allowing access to the time difference in seconds. Example without exception: elapsed = TimeOnce() with elapsed: print('sleeping ...') time.sleep(3) print("elapsed", elapsed) Example with exception: ...
Add __float__ operator to TimeOnce
Add __float__ operator to TimeOnce
Python
mit
bgoodr/how-to,bgoodr/how-to
8d80401d19a5635053ceefcbb2bc4cfe8bb7a339
spoppy/config.py
spoppy/config.py
import getpass import os from appdirs import user_cache_dir CONFIG_FILE_NAME = os.path.join( user_cache_dir(appname='spoppy'), '.creds' ) def get_config(): if os.path.exists(CONFIG_FILE_NAME): with open(CONFIG_FILE_NAME, 'r') as f: return [ line.strip() for line in f.read...
import getpass import os from appdirs import user_cache_dir try: # python2.7 input = raw_input except NameError: pass CONFIG_FILE_NAME = os.path.join( user_cache_dir(appname='spoppy'), '.creds' ) def get_config(): if os.path.exists(CONFIG_FILE_NAME): with open(CONFIG_FILE_NAME, 'r') as ...
Fix error with saving credentials in python 2.7
Fix error with saving credentials in python 2.7 This fixes #102
Python
mit
sindrig/spoppy,sindrig/spoppy
51185cff2c75da068f2f250a61e99472880f11d6
app/duckbot.py
app/duckbot.py
import argparse import discord from discord.ext import commands import config from cmd import general, emotes _DESCRIPTION = '''quack''' def parse_arguments(): parser = argparse.ArgumentParser(description="quack") parser.add_argument('-b', '--botname', required=True, ...
import argparse import discord from discord.ext import commands import config from cmd import general, emotes _DESCRIPTION = '''quack''' def parse_arguments(): parser = argparse.ArgumentParser(description="quack") parser.add_argument('-b', '--botname', required=True, ...
Put main bot setup code inside main function
Put main bot setup code inside main function
Python
mit
andrewlin16/duckbot,andrewlin16/duckbot
5a744dc3a27564f0d8c7fe618c6900bff711420a
funnel/forms/usergroup.py
funnel/forms/usergroup.py
# -*- coding: utf-8 -*- from baseframe import __ import baseframe.forms as forms from baseframe.forms.sqlalchemy import AvailableName __all__ = ['UserGroupForm'] class UserGroupForm(forms.Form): name = forms.StringField(__("URL name"), validators=[forms.validators.DataRequired(), forms.validators.ValidName(), A...
# -*- coding: utf-8 -*- from baseframe import __ import baseframe.forms as forms from baseframe.forms.sqlalchemy import AvailableName from ..models import User from .. import lastuser __all__ = ['UserGroupForm'] class UserGroupForm(forms.Form): name = forms.StringField(__("URL name"), validators=[forms.validato...
Change to user select widget
Change to user select widget
Python
agpl-3.0
hasgeek/funnel,hasgeek/funnel,hasgeek/funnel,hasgeek/funnel,hasgeek/funnel
b75df498fe27aec68460a880b6067d970bead926
alchemist_armet/resources.py
alchemist_armet/resources.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import, division from armet.connectors.flask import resources as flask_resources from armet.connectors.sqlalchemy import resources as sqlalchemy_resources from armet import utils from alchemist import db __all__ = [ 'Resource', 'ModelRes...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import, division from armet.connectors.flask import resources as flask_resources from armet.connectors.sqlalchemy import resources as sqlalchemy_resources from armet import utils from alchemist import db __all__ = [ 'Resource', 'ModelRes...
Update for changes in alchemist.
Update for changes in alchemist.
Python
mit
concordusapps/alchemist-armet
469d73255365392a821d701b4df9098d97b7546a
judge/toyojjudge/taskrunner.py
judge/toyojjudge/taskrunner.py
import asyncio import logging logger = logging.getLogger(__name__) class TaskRunner: def __init__(self, sandbox_pool, languages, checkers): self.sandbox_pool = sandbox_pool self.languages = languages self.checkers = checkers async def run(self, task): async with self.sandbox_p...
import asyncio import logging logger = logging.getLogger(__name__) class TaskRunner: def __init__(self, sandbox_pool, languages, checkers): self.sandbox_pool = sandbox_pool self.languages = languages self.checkers = checkers async def run(self, task): async with self.sandbox_p...
Print running task, language and checker as INFO
judge: Print running task, language and checker as INFO
Python
agpl-3.0
johnchen902/toyoj,johnchen902/toyoj,johnchen902/toyoj,johnchen902/toyoj,johnchen902/toyoj,johnchen902/toyoj
d794fea9cce98c719caef69b1c50f2783da81b1d
pritunl_node/call_buffer.py
pritunl_node/call_buffer.py
from constants import * import collections import uuid class CallBuffer(): def __init__(self): self.waiters = set() self.cache = collections.deque(maxlen=CALL_CACHE_MAX) self.call_waiters = {} def wait_for_calls(self, callback, cursor=None): if cursor: calls = [] ...
from constants import * import collections import uuid class CallBuffer(): def __init__(self): self.waiters = set() self.cache = collections.deque(maxlen=CALL_CACHE_MAX) self.call_waiters = {} def wait_for_calls(self, callback, cursor=None): if cursor: calls = [] ...
Add optional callbacks for call buffer
Add optional callbacks for call buffer
Python
agpl-3.0
pritunl/pritunl-node,pritunl/pritunl-node
69722d7c2db9869074474373eefacd8b5577cbe6
project/apps/api/signals.py
project/apps/api/signals.py
from django.db.models.signals import ( post_save, ) from django.dispatch import receiver from rest_framework.authtoken.models import Token from django.conf import settings from .models import ( Contest, ) @receiver(post_save, sender=settings.AUTH_USER_MODEL) def user_post_save(sender, instance=None, creat...
from django.db.models.signals import ( post_save, ) from django.dispatch import receiver from rest_framework.authtoken.models import Token from django.conf import settings from .models import ( Contest, ) @receiver(post_save, sender=settings.AUTH_USER_MODEL) def user_post_save(sender, instance=None, creat...
Add check for fixture loading
Add check for fixture loading
Python
bsd-2-clause
dbinetti/barberscore-django,barberscore/barberscore-api,dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore,barberscore/barberscore-api
0cff7d25a9d0fc76c723e058652551bb2c43d1fc
benchmarks/test_benchmark.py
benchmarks/test_benchmark.py
import re import urllib import random import unittest from funkload.FunkLoadTestCase import FunkLoadTestCase class Benchmark(FunkLoadTestCase): """This test uses a configuration file Benchmark.conf.""" def setUp(self): self.server_url = self.conf_get('main', 'url') def test_simple(self): ...
import re import urllib.parse import random import unittest from funkload.FunkLoadTestCase import FunkLoadTestCase class Benchmark(FunkLoadTestCase): """This test uses a configuration file Benchmark.conf.""" def setUp(self): self.server_url = self.conf_get('main', 'url') def test_simple(self): ...
Update benchmarks to Pyton 3.
Update benchmarks to Pyton 3.
Python
apache-2.0
ludovicchabant/Wikked,ludovicchabant/Wikked,ludovicchabant/Wikked
215737ef0094f430ca9945841d25fbbaf0301a52
feature_extraction.py
feature_extraction.py
from PIL import Image import glob def _get_masks(): TRAIN_MASKS = './data/train/*_mask.tif' return [Image.open(file_name) for file_name in glob.glob(TRAIN_MASKS)] def _get_rectangle_masks(): rectangle_masks = [] for image in _get_masks(): rectangle_mask = ((0,0), (0,0)) mask_coord = ...
from PIL import Image import glob def _get_masks(): TRAIN_MASKS = './data/train/*_mask.tif' return [Image.open(file_name) for file_name in glob.glob(TRAIN_MASKS)] def _get_rectangle_masks(): rectangle_masks = [] for image in _get_masks(): rectangle_mask = ((0,0), (0,0)) mask_coord = ...
Add filename to square masks
Add filename to square masks
Python
mit
Brok-Bucholtz/Ultrasound-Nerve-Segmentation
4ca1aeb4b0fd3e8d3406d5b5152eb382e32abc1f
app/main/views.py
app/main/views.py
import importlib from flask import render_template from werkzeug.exceptions import NotFound from . import main DATA_QUALITY_ROUTE = '/data-quality/' @main.route('/') def index(): return render_template('index.html') @main.route('/data-quality/<path:page>') def data_quality_page(page): """Serve a data qu...
import importlib from flask import render_template from werkzeug.exceptions import NotFound from . import main DATA_QUALITY_ROUTE = '/data-quality/' @main.route('/') def index(): return render_template('index.html') @main.route('/data-quality/<path:page>') def data_quality_page(page): """Serve a data qu...
Allow trailing slash in URL
Allow trailing slash in URL
Python
mit
saltastro/salt-data-quality-site,saltastro/salt-data-quality-site,saltastro/salt-data-quality-site,saltastro/salt-data-quality-site
21efcb7c0793533ff7e4ed52f09573463f0fb1f0
scripts/configuration.py
scripts/configuration.py
import subprocess def load_configuration(environment): configuration = { "project": "nimp", "project_version": { "identifier": "0.9.6" }, "distribution": "nimp-cli", } revision = subprocess.run([ environment["git_executable"], "rev-parse", "--short=10", "HEAD" ], check = True, cap...
import subprocess def load_configuration(environment): configuration = { "project": "nimp", "project_version": { "identifier": "0.9.6" }, "distribution": "nimp-cli", } configuration["project_version"]["revision"] = subprocess.check_output([ environment["git_executable"], "rev-pars...
Change distribution script to support python 3.5
Change distribution script to support python 3.5
Python
mit
dontnod/nimp
46359266de70275a53cc9d82d3387ca6c0266f3b
jwst_lib/models/dynamicdq.py
jwst_lib/models/dynamicdq.py
import numpy as np from . import dqflags def dynamic_mask(input_model): # # Return a mask model given a mask with dynamic DQ flags # Dynamic flags define what each plane refers to using the DQ_DEF extension dq_table = input_model.dq_def # Get the DQ array and the flag definitions if dq_table i...
import numpy as np from . import dqflags def dynamic_mask(input_model): # # Return a mask model given a mask with dynamic DQ flags # Dynamic flags define what each plane refers to using the DQ_DEF extension dq_table = input_model.dq_def # Get the DQ array and the flag definitions if dq_table i...
Fix bug that appears when a reference file model is created from scratch where the dq_def member exists, but has no rows.
Fix bug that appears when a reference file model is created from scratch where the dq_def member exists, but has no rows. git-svn-id: 7ab1303e5df1b63f74144546e35d3203cc1d26c5@3127 560b4ebf-6bc0-4cc5-b8e0-b136f69d22d4
Python
bsd-3-clause
mdboom/jwst_lib.models
73399a7cf86d20a3cda4336cb37f64bcc0508274
masters/master.client.skia/master_site_config.py
masters/master.client.skia/master_site_config.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ActiveMaster definition.""" from config_bootstrap import Master class Skia(Master.Master3): project_name = 'Skia' master_port = 10115 slave_port...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ActiveMaster definition.""" from config_bootstrap import Master class Skia(Master.Master3): project_name = 'Skia' master_port = 8053 slave_port ...
Change Skia master ports again
Change Skia master ports again BUG=393690 Review URL: https://codereview.chromium.org/390903004 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@283235 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
668440b16916651b85b4a4a507214cee721906a8
scanpointgenerator/__init__.py
scanpointgenerator/__init__.py
from point import Point # noqa from generator import Generator # noqa from arraygenerator import ArrayGenerator # noqa from compoundgenerator import CompoundGenerator # noqa from linegenerator import LineGenerator # noqa from lissajousgenerator import LissajousGenerator # noqa from randomoffsetgenerator import Ra...
from scanpointgenerator.point import Point # noqa from scanpointgenerator.generator import Generator # noqa from scanpointgenerator.arraygenerator import ArrayGenerator # noqa from scanpointgenerator.compoundgenerator import CompoundGenerator # noqa from scanpointgenerator.linegenerator import LineGenerator # noqa...
Add absolute imports in init
Add absolute imports in init
Python
apache-2.0
dls-controls/scanpointgenerator
6ae95c747b7b1e96423fab3de59b52c2bbddd884
sklearn_porter/utils/Logger.py
sklearn_porter/utils/Logger.py
# -*- coding: utf-8 -*- from pathlib import Path import logging from logging.config import fileConfig class Logger: loggers = {} @staticmethod def get_logger(name: str = '') -> logging.Logger: if name not in Logger.loggers.keys(): config_path = Path(__file__).parent / 'logging.ini'...
# -*- coding: utf-8 -*- from pathlib import Path import logging from logging.config import fileConfig class Logger: loggers = {} @staticmethod def get_logger(name: str = '') -> logging.Logger: if name not in Logger.loggers.keys(): config_path = Path(__file__).parent / 'logging.ini'...
Fix and cast path to `str`
feature/oop-api-refactoring: Fix and cast path to `str`
Python
bsd-3-clause
nok/sklearn-porter
e82ed9fcaa6745f849dfb65968ed44da30f6065b
src/plugins/spikeProbability.py
src/plugins/spikeProbability.py
### Spike Probability SpikeDB.plotClear() files = SpikeDB.getFiles(True) for f in files: means = [] err = [] x = [] raw = [] for t in f['trials']: count = [] x.append(t['xvalue']) for p in t['passes']: if len(p) > 0: count.append(1) else: count.append(0) means.append(SpikeDB.mean(count)) ...
### Spike Probability SpikeDB.plotClear() files = SpikeDB.getFiles(True) for f in files: means = [] err = [] x = [] raw = [] for t in f['trials']: count = [] x.append(t['xvalue']) for p in t['passes']: if len(p) > 0: count.append(1) else: count.append(0) means.append(SpikeDB.mean(count)) ...
Add line to spike prob
Add line to spike prob
Python
bsd-3-clause
baubie/SpikeDB,baubie/SpikeDB,baubie/SpikeDB,baubie/SpikeDB
effd1010abb7dbe920e11627fe555bacecced194
rst2pdf/utils.py
rst2pdf/utils.py
#$HeadURL$ #$LastChangedDate$ #$LastChangedRevision$ import sys from reportlab.platypus import PageBreak, Spacer from flowables import * import shlex from log import log def parseRaw (data): '''Parse and process a simple DSL to handle creation of flowables. Supported (can add others on request): ...
# -*- coding: utf-8 -*- #$HeadURL$ #$LastChangedDate$ #$LastChangedRevision$ import sys from reportlab.platypus import PageBreak, Spacer from flowables import * import shlex from log import log def parseRaw (data): '''Parse and process a simple DSL to handle creation of flowables. Supported (can...
Fix encoding (thanks to Yasushi Masuda)
Fix encoding (thanks to Yasushi Masuda) git-svn-id: 305ad3fa995f01f9ce4b4f46c2a806ba00a97020@433 3777fadb-0f44-0410-9e7f-9d8fa6171d72
Python
mit
aquavitae/rst2pdf-py3-dev,tonioo/rst2pdf,sychen/rst2pdf,tonioo/rst2pdf,aquavitae/rst2pdf,sychen/rst2pdf,openpolis/rst2pdf-patched-docutils-0.8,aquavitae/rst2pdf-py3-dev,aquavitae/rst2pdf,openpolis/rst2pdf-patched-docutils-0.8
dafd7689eaca4705ace7b462a1f039982d47cd71
panoply/errors.py
panoply/errors.py
class PanoplyException(Exception): def __init__(self, args=None, retryable=True): super(PanoplyException, self).__init__(args) self.retryable = retryable
class PanoplyException(Exception): def __init__(self, args=None, retryable=True): super(PanoplyException, self).__init__(args) self.retryable = retryable class IncorrectParamError(Exception): def __init__(self, msg: str = "Incorrect input parametr"): super().__init__(msg)
Add new exception class for ssh tunnel logic
Add new exception class for ssh tunnel logic
Python
mit
panoplyio/panoply-python-sdk
d9cb41e12b3f64e71d64dc32fcdc133813897e0b
core/data/DataTransformer.py
core/data/DataTransformer.py
""" DataTransformer :Authors: Berend Klein Haneveld """ from vtk import vtkImageReslice class DataTransformer(object): """DataTransformer is a class that can transform a given dataset""" def __init__(self): super(DataTransformer, self).__init__() def TransformImageData(self, imageData, transform): """ :t...
""" DataTransformer :Authors: Berend Klein Haneveld """ from vtk import vtkImageReslice class DataTransformer(object): """DataTransformer is a class that can transform a given dataset""" def __init__(self): super(DataTransformer, self).__init__() def TransformImageData(self, imageData, transform): """ :t...
Make sure that the reslicer does not ommit any image data.
Make sure that the reslicer does not ommit any image data.
Python
mit
berendkleinhaneveld/Registrationshop,berendkleinhaneveld/Registrationshop
65d7ff9fc275bd6186484236d7a0d03c65cc62d7
peerinst/admin.py
peerinst/admin.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from . import models @admin.register(models.Question) class QuestionAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['title']}), (_('Mai...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from . import models @admin.register(models.Question) class QuestionAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['title']}), (_('Mai...
Use nifty filter widget for selecting questions for an assignment.
Use nifty filter widget for selecting questions for an assignment.
Python
agpl-3.0
open-craft/dalite-ng,open-craft/dalite-ng,open-craft/dalite-ng
83f6a1eaf41cb45f7e2d705966e269dcb514f9be
coinrpc.py
coinrpc.py
import bottle, jsonrpc, sys def with_rpc(orig_func): '''Function decorator to provide RPC service proxy''' def wrapped_func(*arg, **kwarg): app = bottle.default_app() svc = app.config['coinrpc.svc'] return orig_func(svc, *arg, **kwarg) return wrapped_func @bottle.get('/help') @...
import bottle, jsonrpc, sys def with_coinrpc(*items): '''Function decorator to provide coinrpc config items''' def wrap_func(orig_func): app = bottle.default_app() keys = tuple(['coinrpc.' + i for i in items]) def wrapped_func(*arg, **kwarg): config_items = tuple([app.config...
Make config-helper decorator more generic
Make config-helper decorator more generic Instead of only pulling 'coinrpc.svc' from app.config, pull out any number of items.
Python
mit
grantisu/Sericata
2405fd2619633e390343984d02763e037a736ef5
openstack/common/messaging/drivers/__init__.py
openstack/common/messaging/drivers/__init__.py
# Copyright 2013 Red Hat, 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 agr...
# Copyright 2013 Red Hat, 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 agr...
Use : for loading classes in entry_points
Use : for loading classes in entry_points
Python
apache-2.0
isyippee/oslo.messaging,JioCloud/oslo.messaging,isyippee/oslo.messaging,dims/oslo.messaging,dukhlov/oslo.messaging,redhat-openstack/oslo.messaging,apporc/oslo.messaging,markmc/oslo.messaging,magic0704/oslo.messaging,hkumarmk/oslo.messaging,ozamiatin/oslo.messaging,citrix-openstack-build/oslo.messaging,redhat-openstack/...
887ad6280df9c6e88a036783097f87626436ca9f
Lib/importlib/test/import_/util.py
Lib/importlib/test/import_/util.py
import functools import importlib import importlib._bootstrap import unittest using___import__ = False def import_(*args, **kwargs): """Delegate to allow for injecting different implementations of import.""" if using___import__: return __import__(*args, **kwargs) else: return importlib._...
import functools import importlib import importlib._bootstrap import unittest using___import__ = False def import_(*args, **kwargs): """Delegate to allow for injecting different implementations of import.""" if using___import__: return __import__(*args, **kwargs) else: return importlib._...
Fix the importlib_only test decorator to work again; don't capture the flag variable as it might change later.
Fix the importlib_only test decorator to work again; don't capture the flag variable as it might change later.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
802ffff14c7636b80073debfe2159a9fa71abe15
numba/tests/test_vectorization_type_inference.py
numba/tests/test_vectorization_type_inference.py
from __future__ import print_function from numba import vectorize, jit, bool_, double, int_, float_, typeof, int8 import numba.unittest_support as unittest import numpy as np def add(a, b): return a + b def func(dtypeA, dtypeB): A = np.arange(10, dtype=dtypeA) B = np.arange(10, dtype=dtypeB) return ...
from __future__ import print_function from numba import vectorize, jit, bool_, double, int_, float_, typeof, int8 import numba.unittest_support as unittest import numpy as np def add(a, b): return a + b def func(dtypeA, dtypeB): A = np.arange(10, dtype=dtypeA) B = np.arange(10, dtype=dtypeB) return ...
Mark test_type_inference test as expected failure
Mark test_type_inference test as expected failure
Python
bsd-2-clause
gdementen/numba,stefanseefeld/numba,pombredanne/numba,stuartarchibald/numba,seibert/numba,pitrou/numba,stuartarchibald/numba,stefanseefeld/numba,seibert/numba,cpcloud/numba,gmarkall/numba,sklam/numba,seibert/numba,cpcloud/numba,jriehl/numba,stonebig/numba,ssarangi/numba,jriehl/numba,gmarkall/numba,stonebig/numba,stoneb...
7019a211ae083d1b99d1c3ab580e6b8c0357b4f9
mne/commands/mne_coreg.py
mne/commands/mne_coreg.py
#!/usr/bin/env python # Authors: Christian Brodbeck <christianbrodbeck@nyu.edu> """ Open the coregistration GUI. example usage: $ mne coreg """ import os import sys import mne if __name__ == '__main__': os.environ['ETS_TOOLKIT'] = 'qt4' mne.gui.coregistration() sys.exit(0)
#!/usr/bin/env python # Authors: Christian Brodbeck <christianbrodbeck@nyu.edu> """ Open the coregistration GUI. example usage: $ mne coreg """ import os import sys import mne if __name__ == '__main__': from mne.commands.utils import get_optparser parser = get_optparser(__file__) options, args = p...
FIX coreg bin: add parser
FIX coreg bin: add parser
Python
bsd-3-clause
jaeilepp/mne-python,mne-tools/mne-python,pravsripad/mne-python,wmvanvliet/mne-python,dimkal/mne-python,trachelr/mne-python,jmontoyam/mne-python,effigies/mne-python,ARudiuk/mne-python,teonlamont/mne-python,lorenzo-desantis/mne-python,jniediek/mne-python,olafhauk/mne-python,mne-tools/mne-python,Odingod/mne-python,kingjr/...
f20e7abc1672b3814062357add9f3adc1ca300f9
editorsnotes/main/migrations/0021_populate_display_name.py
editorsnotes/main/migrations/0021_populate_display_name.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def populate_usernames(apps, schema_editor): User = apps.get_model('main', 'User') for user in User.objects.all(): user.display_name = user._get_display_name() user.save() class Migration...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def populate_usernames(apps, schema_editor): User = apps.get_model('main', 'User') for user in User.objects.all(): if user.first_name or user.last_name: display_name = user.first_name ...
Fix data migration for user display names
Fix data migration for user display names
Python
agpl-3.0
editorsnotes/editorsnotes,editorsnotes/editorsnotes
7c65017fa16632f21eb94896a3d7c8d2cce989dd
user/admin.py
user/admin.py
from django.contrib import admin from .models import User @admin.register(User) class UserAdmin(admin.ModelAdmin): # list view list_display = ( 'email', 'get_date_joined', 'is_staff', 'is_superuser') list_filter = ( 'is_staff', 'is_superuser', 'prof...
from django.contrib import admin from .models import User @admin.register(User) class UserAdmin(admin.ModelAdmin): # list view list_display = ( 'get_name', 'email', 'get_date_joined', 'is_staff', 'is_superuser') list_filter = ( 'is_staff', 'is_super...
Add Profile name to UserAdmin list.
Ch23: Add Profile name to UserAdmin list.
Python
bsd-2-clause
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8
c58e3c207ad5f534ea8a7e17cb13f6a1a1b8c714
multi_schema/admin.py
multi_schema/admin.py
from django.contrib import admin from models import Schema class SchemaAdmin(admin.ModelAdmin): pass admin.site.register(Schema, SchemaAdmin)
from django.contrib import admin, auth from models import Schema, UserSchema class SchemaAdmin(admin.ModelAdmin): def get_readonly_fields(self, request, obj=None): if obj is not None: return ('schema',) return () admin.site.register(Schema, SchemaAdmin) class SchemaInline(admin.Stacke...
Make 'schema' value readonly after creation. Inject SchemaUser into UserAdmin inlines.
Make 'schema' value readonly after creation. Inject SchemaUser into UserAdmin inlines.
Python
bsd-3-clause
schinckel/django-boardinghouse,schinckel/django-boardinghouse,schinckel/django-boardinghouse
c5eb0358e763d626f503fa45228752da10b7c70d
openfisca_core/commons.py
openfisca_core/commons.py
# -*- coding: utf-8 -*- # The following two variables and the is_unicode function are there to bridge string types across Python 2 & 3 unicode_type = u"".__class__ basestring_type = (b"".__class__, unicode_type) def to_unicode(string): """ :param string: a string that needs to be unicoded :param encoding...
# -*- coding: utf-8 -*- # The following two variables and the is_unicode function are there to bridge string types across Python 2 & 3 unicode_type = u"".__class__ basestring_type = (b"".__class__, unicode_type) def to_unicode(string): """ :param string: a string that needs to be unicoded :param encoding...
Make to_unicode work in Python 3
Make to_unicode work in Python 3
Python
agpl-3.0
openfisca/openfisca-core,openfisca/openfisca-core
7c953b71cbcb01ce1fc2d7d1a476a33dffb8999e
fabfile.py
fabfile.py
import os from fabric.api import task, run, local, sudo, cd, env env.hosts = [ os.environ['TWWEB_HOST'], ] def virtualenv(command, user=None): run('source /var/www/envs/twweb/bin/activate && ' + command) @task def deploy(): local('git push origin development') local('git checkout master') loc...
import os from fabric.api import task, run, local, sudo, cd, env env.hosts = [ os.environ['TWWEB_HOST'], ] def virtualenv(command, user=None): run('source /var/www/envs/twweb/bin/activate && ' + command) @task def deploy(): local('git push origin development') local('git checkout master') loc...
Remove log chown step from post-deployment process.
Remove log chown step from post-deployment process.
Python
agpl-3.0
coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am
e72fa5ab59a8c904d525a33652424b0acf5c9de4
cms/widgets.py
cms/widgets.py
## # Copyright (C) 2017 Jessica Tallon & Matt Molyneaux # # This file is part of Inboxen. # # Inboxen is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or #...
## # Copyright (C) 2017 Jessica Tallon & Matt Molyneaux # # This file is part of Inboxen. # # Inboxen is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or #...
Switch TextInput for Textarea for RichText widget base class
Switch TextInput for Textarea for RichText widget base class
Python
agpl-3.0
Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen
0392e4e26b5affee2de648084198fa3375a7bdd3
src/zeit/brightcove/json/tests/test_update.py
src/zeit/brightcove/json/tests/test_update.py
import mock import zeit.brightcove.convert import zeit.brightcove.testing import zeit.cms.testing import zope.testbrowser.testing class NotificationTest(zeit.cms.testing.BrowserTestCase): layer = zeit.brightcove.testing.LAYER def test_runs_import_as_system_user(self): # View is available without aut...
import mock import zeit.brightcove.convert import zeit.brightcove.testing import zeit.cms.testing class NotificationTest(zeit.cms.testing.BrowserTestCase): layer = zeit.brightcove.testing.LAYER def test_runs_import_as_system_user(self): # View is available without authentication b = zeit.cms...
Update to changed zeit.cms test browser setup API
MAINT: Update to changed zeit.cms test browser setup API
Python
bsd-3-clause
ZeitOnline/zeit.brightcove
a5ec7be50e2ce2424883b859ff99fd77ff09f997
fabfile.py
fabfile.py
# Simple Tasks def hello(): print 'Hello ThaiPy!' def hi(name='Kan'): print 'Hi ' + name # Local Commands from fabric.api import local, lcd def deploy_fizzbuzz(): with lcd('fizzbuzz'): local('python fizzbuzz_test.py') local('git add fizzbuzz.py fizzbuzz_test.py') local('git c...
# Simple Tasks def hello(): print 'Hello ThaiPy!' def hi(name='Kan'): print 'Hi ' + name # Local Commands from fabric.api import local, lcd def deploy_fizzbuzz(): with lcd('fizzbuzz'): local('python fizzbuzz_test.py') local('git add fizzbuzz.py fizzbuzz_test.py') local('git c...
Add remote commands for vagrant and ec2
Add remote commands for vagrant and ec2
Python
mit
zkan/fabric-workshop,zkan/fabric-workshop
36c6b7e70c21b261dcb39568a17fd1cd353a25db
htmlify.py
htmlify.py
def getHTML(tag, contents=None, newLine=True, **parameters): construct = "<" + tag for paramName, paramContent in parameters.items(): construct += " " + paramName + "=" + paramContent if contents is not None: construct += ">" + contents + "</" + tag + ">" else: construct += ">" + "</" + tag + ">" if newLine:...
def getHTML(tag, contents=None, newLine=True, **parameters): construct = "<" + tag for paramName, paramContent in parameters.items(): if type(paramContent) == str: construct += " " + paramName + "=\"" + paramContent + "\"" if contents is not None: construct += ">" + contents + "</" + tag + ">" else: constr...
Add quotes to values htmlified
Add quotes to values htmlified
Python
apache-2.0
ISD-Sound-and-Lights/InventoryControl
850e04a7cf045c11fcc0aef04e37268a0d8e20c6
src/container.py
src/container.py
from dock import client def fmt(container): image, name = ns(container) return '[{image}/{name}]'.format(image=image, name=name) def ns(container): image_name = container.attrs['Image'] image = client.images.get(image_name) if len(image.tags) > 0: image_name = image.tags[0]...
from dock import client def fmt(container): image, name = ns(container) return '[{image}/{name}]'.format(image=image, name=name) def ns(container): image_name = container.attrs['Image'] image = client.images.get(image_name) if len(image.tags) > 0: image_name = image.tags[0]...
Replace / with - in image domain names
Replace / with - in image domain names
Python
mit
regiontog/macvlan-ipvs-dr,regiontog/macvlan-ipvs-dr
95d86b30d8c5d922bc7ba17d50e5f83eae086e88
__init__.py
__init__.py
"""Database Toolkit This package contains a framework for creating and running scripts designed to download published ecological data, and store the data in a database. """ import os import imp VERSION = '0.4.1' REPOSITORY = 'http://www.ecologicaldata.org/dbtk/' def MODULE_LIST(): """Load scripts from scrip...
"""Database Toolkit This package contains a framework for creating and running scripts designed to download published ecological data, and store the data in a database. """ import os import imp VERSION = '0.4.1' REPOSITORY = 'http://www.ecologicaldata.org/dbtk/' def MODULE_LIST(): """Load scripts from scrip...
Check that each module is valid before trying to import.
Check that each module is valid before trying to import.
Python
mit
embaldridge/retriever,bendmorris/retriever,embaldridge/retriever,goelakash/retriever,henrykironde/deletedret,goelakash/retriever,davharris/retriever,davharris/retriever,embaldridge/retriever,henrykironde/deletedret,davharris/retriever,bendmorris/retriever,bendmorris/retriever
c4bc4b37b991f428ecfc730d7f8030d8ea52050c
src/protocol/caldav/definitions/csxml.py
src/protocol/caldav/definitions/csxml.py
## # Copyright (c) 2007-2009 Apple Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
## # Copyright (c) 2007-2009 Apple Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Define the pushkey attribute for XMPP push
Define the pushkey attribute for XMPP push git-svn-id: b8a2ed21f1aafe1ee9fc65e616c668cc51cd004a@7731 e27351fd-9f3e-4f54-a53b-843176b1656c
Python
apache-2.0
skarra/CalDAVClientLibrary,skarra/CalDAVClientLibrary
a4656e18539950c0de0aea08eadf88f841ef24ea
scripts/get_bump_version.py
scripts/get_bump_version.py
from __future__ import print_function import subprocess def get_version_from_git(): cmd = ["git", "describe", "--tags", "--always"] proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) code = proc.wait() if code != 0: print("Failed to run: %s" % " ".join(cmd)) sys.exit(1) versio...
from __future__ import print_function import subprocess import sys def get_version_from_git(): cmd = ["git", "describe", "--tags", "--always"] proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) code = proc.wait() if code != 0: print("Failed to run: %s" % " ".join(cmd)) sys.exit(1) ...
Make sure sys is available for sys.exit() call on failure
Make sure sys is available for sys.exit() call on failure
Python
bsd-3-clause
dennisobrien/bokeh,stuart-knock/bokeh,mutirri/bokeh,canavandl/bokeh,daodaoliang/bokeh,abele/bokeh,jakirkham/bokeh,stonebig/bokeh,abele/bokeh,philippjfr/bokeh,rs2/bokeh,rs2/bokeh,aavanian/bokeh,birdsarah/bokeh,srinathv/bokeh,bokeh/bokeh,PythonCharmers/bokeh,paultcochrane/bokeh,gpfreitas/bokeh,draperjames/bokeh,Karel-van...
5000ed8fa0426a7968a0db4a89d221ef800a2da7
wordsegmenterTC/__init__.py
wordsegmenterTC/__init__.py
import PyICU SEPARATER = " " class Segmenter: def isThai(self, chr): cVal = ord(chr) if (cVal >= 3584 and cVal <= 3711): return True return False def segment(self, text): bd = PyICU.BreakIterator.createWordInstance(PyICU.Locale("th")) bd.setText(text) ...
import PyICU SEPARATER = " " class Segmenter: def isThai(self, chr): cVal = ord(chr) if (cVal >= 3584 and cVal <= 3711): return True return False def segment(self, text): bd = PyICU.BreakIterator.createWordInstance(PyICU.Locale("th")) bd.setText(text) ...
Fix str index of range in some case
Fix str index of range in some case
Python
mit
tchayintr/wordsegmenterTC
12327b28697e3d27a6f92863091a84d9b56c0eec
openrcv/test/test_datagen.py
openrcv/test/test_datagen.py
from unittest import TestCase from unittest.mock import patch from openrcv.datagen import gen_random_list class ModuleTest(TestCase): def make_randint(self, values): values = iter(values) def randint(*args): try: return next(values) except StopIteration: ...
from unittest import TestCase from unittest.mock import patch from openrcv.datagen import gen_random_list class ModuleTest(TestCase): def make_randint(self, values): values = iter(values) def randint(*args): try: return next(values) except StopIteration: ...
Add more datagen test cases.
Add more datagen test cases.
Python
mit
cjerdonek/open-rcv,cjerdonek/open-rcv
cb78ebc617c5ac8370321a10bd7f6ee418a77b7e
grade-school/grade_school.py
grade-school/grade_school.py
# File: grade_school.py # Purpose: Write a small archiving program that stores students' names along with the grade that they are in. # Programmer: Amal Shehu # Course: Exercism # Date: Monday 12th September 2016, 11:00 PM class School(object): """docstring for School.""" def __init__(s...
# File: grade_school.py # Purpose: Write a small archiving program that stores students' names along with the grade that they are in. # Programmer: Amal Shehu # Course: Exercism # Date: Monday 12th September 2016, 11:00 PM class School(object): """docstring for School.""" students = {} ...
Add student name and grade
Add student name and grade
Python
mit
amalshehu/exercism-python
3389c6208a86d4ec7ba9594e6f0f57f082d81882
gitfs/views/history_index.py
gitfs/views/history_index.py
from .view import View from errno import ENOENT from stat import S_IFDIR from gitfs import FuseMethodNotImplemented, FuseOSError from log import log class HistoryIndexView(View): def getattr(self, path, fh=None): ''' Returns a dictionary with keys identical to the stat C structure of s...
from datetime import datetime from errno import ENOENT from stat import S_IFDIR from pygit2 import GIT_SORT_TIME from .view import View from gitfs import FuseMethodNotImplemented, FuseOSError from log import log class HistoryIndexView(View): def getattr(self, path, fh=None): ''' Returns a dict...
Update HistoryIndeView - listdir is working.
Update HistoryIndeView - listdir is working.
Python
apache-2.0
PressLabs/gitfs,rowhit/gitfs,bussiere/gitfs,PressLabs/gitfs,ksmaheshkumar/gitfs
5150c61929271167556e1e337de1db573a5719ea
tests/unittests/framework_file_server_tests.py
tests/unittests/framework_file_server_tests.py
from unittest import TestCase from lib import web from mock import Mock import main import framework.file_server as file_server class BaseFileServerTests (TestCase): def test_AddShouldReturnNoneIfDbInsertionFails(self): fs = file_server.FileServer() fs._addDbRecord = Mock(return_value=None) ...
from unittest import TestCase from lib import web from mock import Mock import main import framework.file_server as file_server class BaseFileServerTests (TestCase): def test_AddShouldReturnNoneIfDbInsertionFails(self): fs = file_server.FileServer() fs._addDbRecord = Mock(return_value=None) ...
Add test that db.insert is called when add is called
Add test that db.insert is called when add is called
Python
agpl-3.0
localprojects/Change-By-Us,watchcat/cbu-rotterdam,localprojects/Change-By-Us,codeforamerica/Change-By-Us,localprojects/Change-By-Us,codeforamerica/Change-By-Us,watchcat/cbu-rotterdam,codeforeurope/Change-By-Us,watchcat/cbu-rotterdam,watchcat/cbu-rotterdam,codeforeurope/Change-By-Us,codeforamerica/Change-By-Us,codeforeu...
f849961e75dc956d669813fddb5b13627b224e1e
pyang/plugins/name.py
pyang/plugins/name.py
"""Name output plugin """ import optparse from pyang import plugin def pyang_plugin_init(): plugin.register_plugin(NamePlugin()) class NamePlugin(plugin.PyangPlugin): def add_output_format(self, fmts): self.multiple_modules = True fmts['name'] = self def add_opts(self, optparser): ...
"""Name output plugin """ import optparse from pyang import plugin def pyang_plugin_init(): plugin.register_plugin(NamePlugin()) class NamePlugin(plugin.PyangPlugin): def add_output_format(self, fmts): self.multiple_modules = True fmts['name'] = self def add_opts(self, optparser): ...
Use i_latest_revision to ensure we get the latest revision.
Use i_latest_revision to ensure we get the latest revision.
Python
isc
mbj4668/pyang,mbj4668/pyang
8707b835d34380f737e7954c7bac527c916b2a7c
tests/test_special_features.py
tests/test_special_features.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import unittest import speech_recognition as sr class TestSpecialFeatures(unittest.TestCase): def setUp(self): self.AUDIO_FILE_EN = os.path.join(os.path.dirname(os.path.realpath(__file__)), "english.wav") def test_sphinx_keywords(self): ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import unittest import speech_recognition as sr class TestSpecialFeatures(unittest.TestCase): def setUp(self): self.AUDIO_FILE_EN = os.path.join(os.path.dirname(os.path.realpath(__file__)), "english.wav") self.addTypeEqualityFunc(str,self....
Test ignoring duplicates and order
Test ignoring duplicates and order
Python
bsd-3-clause
arvindch/speech_recognition,arvindch/speech_recognition,Uberi/speech_recognition,Uberi/speech_recognition
6f128279e8f4126c2d0f1a4076b93768678cdc0a
zerver/migrations/0130_text_choice_in_emojiset.py
zerver/migrations/0130_text_choice_in_emojiset.py
from django.db import migrations, models from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor from django.db.migrations.state import StateApps # change emojiset to text if emoji_alt_code is true. def change_emojiset(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: UserProfil...
from django.db import migrations, models from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor from django.db.migrations.state import StateApps # change emojiset to text if emoji_alt_code is true. def change_emojiset(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: UserProfil...
Add reverser for emoji_alt_code migration.
migrations: Add reverser for emoji_alt_code migration. This is easy to do, and prevents this feature from getting a server admin stuck in potentially a pretty uncomfortable way -- unable to roll back a deploy.
Python
apache-2.0
tommyip/zulip,eeshangarg/zulip,rht/zulip,jackrzhang/zulip,brainwane/zulip,andersk/zulip,shubhamdhama/zulip,shubhamdhama/zulip,punchagan/zulip,kou/zulip,hackerkid/zulip,timabbott/zulip,showell/zulip,hackerkid/zulip,eeshangarg/zulip,dhcrzf/zulip,andersk/zulip,shubhamdhama/zulip,punchagan/zulip,kou/zulip,synicalsyntax/zul...
d86701d87e40532197d73b826f076ffa7003003e
linspace.py
linspace.py
def linspace(start, stop, num): return [(stop*i + start*(num-i)) / num for i in range(num+1)]
#!/usr/bin/env python3 import collections import collections.abc class linspace(collections.abc.Sequence): def __init__(self, start, stop, num): self.start, self.stop, self.num = start, stop, num def __len__(self): return self.num def __getitem__(self, i): if i >= self.num: ...
Fix off-by-one error, make it lazy
Fix off-by-one error, make it lazy
Python
mit
abarnert/linspace
6f6c743a03d8162abca9e5406e5e6c2e51f77052
users/views.py
users/views.py
# -*- coding: utf-8 -*- from django.shortcuts import render_to_response from django.contrib.auth.models import User from django.views.generic.detail import DetailView from core.views import RyndaFormView, RyndaListView from users.forms import SimpleRegistrationForm class UserDetail(DetailView): model = User ...
# -*- coding: utf-8 -*- from django.shortcuts import redirect, render_to_response from django.contrib.auth.models import User from django.views.generic.detail import DetailView from core.views import RyndaFormView, RyndaListView from users.forms import SimpleRegistrationForm from users.models import Users class Use...
Fix redirect after success registration
Fix redirect after success registration
Python
mit
sarutobi/ritmserdtsa,sarutobi/flowofkindness,sarutobi/ritmserdtsa,sarutobi/Rynda,sarutobi/ritmserdtsa,sarutobi/flowofkindness,sarutobi/ritmserdtsa,sarutobi/Rynda,sarutobi/flowofkindness,sarutobi/Rynda,sarutobi/flowofkindness,sarutobi/Rynda
0e4bcae9b409d18a2b2f818833b0e03762332a80
example/example/spiders/custom_kafka_spider.py
example/example/spiders/custom_kafka_spider.py
# -*- coding: utf-8 -*- from scrapy_kafka.spiders import KafkaSpider from example.items import DmozItem class CustomKafkaSpider(KafkaSpider): name = "dmoz_kafka" allowed_domains = ["dmoz.org"] def parse(self, response): for sel in response.xpath('//ul/li'): item = DmozItem() ...
# -*- coding: utf-8 -*- from scrapy_kafka.spiders import ListeningKafkaSpider from ..items import DmozItem class CustomKafkaSpider(ListeningKafkaSpider): name = "dmoz_kafka" allowed_domains = ["dmoz.org"] def parse(self, response): for sel in response.xpath('//ul/li'): item = DmozItem...
Use the correct Spider superclass in the example
Use the correct Spider superclass in the example
Python
apache-2.0
dfdeshom/scrapy-kafka
1cf82c6efa0550c5a0ba7160f82f77db6e3358ec
panoptes/test/test_mount.py
panoptes/test/test_mount.py
from panoptes.mount.ioptron import iOptronMount class TestOptronMount: mount = None def setup(self): print ("TestMount:setup() before each test method") def teardown(self): print ("TestMount:teardown() after each test method") @classmethod def setup_class(cls): print ...
import os import importlib import warnings class TestOptronMount: mount = None def setup(self): print ("TestMount:setup() before each test method") def teardown(self): print ("TestMount:teardown() after each test method") @classmethod def setup_class(cls): mount_dir =...
Test file loops over all the mounts
Test file loops over all the mounts
Python
mit
AstroHuntsman/POCS,AstroHuntsman/POCS,panoptes/POCS,fmin2958/POCS,joshwalawender/POCS,AstroHuntsman/POCS,panoptes/POCS,fmin2958/POCS,Guokr1991/POCS,panoptes/POCS,Guokr1991/POCS,joshwalawender/POCS,Guokr1991/POCS,Guokr1991/POCS,panoptes/POCS,AstroHuntsman/POCS,joshwalawender/POCS,fmin2958/POCS
9ed49cee1ce669547f6d0278af00c3ad246fec78
migrations/versions/201608181200_11890f58b1df_add_tracks.py
migrations/versions/201608181200_11890f58b1df_add_tracks.py
"""Add tracks Revision ID: 11890f58b1df Revises: 4d4b95748173 Create Date: 2016-08-16 16:48:27.441514 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '11890f58b1df' down_revision = '4d4b95748173' def upgrade(): op.create_table( 'tracks', s...
"""Add tracks Revision ID: 11890f58b1df Revises: 4d4b95748173 Create Date: 2016-08-16 16:48:27.441514 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '11890f58b1df' down_revision = '4d4b95748173' def upgrade(): op.create_table( 'tracks', s...
Fix incorrect indexes in alembic revision
Fix incorrect indexes in alembic revision
Python
mit
ThiefMaster/indico,ThiefMaster/indico,mic4ael/indico,pferreir/indico,pferreir/indico,mvidalgarcia/indico,indico/indico,ThiefMaster/indico,mvidalgarcia/indico,indico/indico,OmeGak/indico,mic4ael/indico,OmeGak/indico,mvidalgarcia/indico,DirkHoffmann/indico,mic4ael/indico,DirkHoffmann/indico,mvidalgarcia/indico,OmeGak/ind...
9ab879af48e46fae2279402ac9cb242f173f037c
javascript_settings/views.py
javascript_settings/views.py
from django.http import HttpResponse from django.utils import simplejson from configuration_builder import DEFAULT_CONFIGURATION_BUILDER def load_configuration(request): return HttpResponse( "var configuration = %s;" % simplejson.dumps( DEFAULT_CONFIGURATION_BUILDER.get_configuration() ...
import json from django.http import HttpResponse from configuration_builder import DEFAULT_CONFIGURATION_BUILDER def load_configuration(request): return HttpResponse( "var configuration = %s;" % json.dumps( DEFAULT_CONFIGURATION_BUILDER.get_configuration() ) )
Use json instead of django.utils.simplejson.
Use json instead of django.utils.simplejson.
Python
mit
pozytywnie/django-javascript-settings
ad8b8d6db5e81884ff5e3270455c714024cccbc1
Tools/scripts/findlinksto.py
Tools/scripts/findlinksto.py
#! /usr/bin/env python # findlinksto # # find symbolic links to a path matching a regular expression import os import sys import regex import getopt def main(): try: opts, args = getopt.getopt(sys.argv[1:], '') if len(args) < 2: raise getopt.error, 'not enough arguments' except ge...
#! /usr/bin/env python # findlinksto # # find symbolic links to a path matching a regular expression import os import sys import re import getopt def main(): try: opts, args = getopt.getopt(sys.argv[1:], '') if len(args) < 2: raise getopt.GetoptError('not enough arguments', None) ...
Use new name for GetoptError, and pass it two arguments Use re module instead of regex
Use new name for GetoptError, and pass it two arguments Use re module instead of regex
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
678594fb68845d3aec80c935fc0cd0fe89ce26b5
shakedown/dcos/service.py
shakedown/dcos/service.py
from dcos import (marathon, mesos, package, util) from dcos.errors import DCOSException def get_service(service_name, inactive=False, completed=False): services = mesos.get_master().frameworks(inactive=inactive, completed=completed) for service in services: if service['name'] == service_name: ...
from dcos import mesos def get_service(service_name, inactive=False, completed=False): services = mesos.get_master().frameworks(inactive=inactive, completed=completed) for service in services: if service['name'] == service_name: return service return None def get_service_framework_...
Return None or Empty List
Return None or Empty List Return None when an object cannot be found or an empty list when a list type is expected.
Python
apache-2.0
dcos/shakedown
652853221ce9eca84ebbe568fa0c1985915dad59
scratch/asb/print_refquad_input.py
scratch/asb/print_refquad_input.py
from __future__ import division import os, sys paths = sys.argv[1:] for path in paths: for filename in os.listdir(path): if "integrated" in filename: print "input {" print " experiments =", os.path.join(path, filename.rstrip("_integrated.pickle") + "_refined_experiments.json") print " reflec...
from __future__ import division import os, sys paths = sys.argv[1:] for path in paths: for filename in os.listdir(path): if "indexed" in filename: print "input {" print " experiments =", os.path.join(path, filename.rstrip("_indexed.pickle") + "_refined_experiments.json") print " reflections ...
Use indexed instead of integrated pickle files for detector refinement.
Use indexed instead of integrated pickle files for detector refinement.
Python
bsd-3-clause
dials/dials,dials/dials,dials/dials,dials/dials,dials/dials
34aa4a19ac1fc7ff52ea0d9ac13df944f1e9754d
src/tn/plonebehavior/template/html_page_html.py
src/tn/plonebehavior/template/html_page_html.py
try: from tn.plonehtmlpage import html_page HAS_HTML_PAGE = True except ImportError: HAS_HTML_PAGE = False if HAS_HTML_PAGE: from five import grok from tn.plonebehavior.template import interfaces from tn.plonebehavior.template.html import ContextlessHTML class HTMLPageHTML(grok.Adapter): ...
try: from tn.plonehtmlpage import html_page HAS_HTML_PAGE = True except ImportError: HAS_HTML_PAGE = False if HAS_HTML_PAGE: from five import grok from tn.plonebehavior.template import _ from tn.plonebehavior.template import ITemplateConfiguration from tn.plonebehavior.template import inter...
Add a validation to ensure that CSS selector actually works
Add a validation to ensure that CSS selector actually works
Python
bsd-3-clause
tecnologiaenegocios/tn.plonebehavior.template,tecnologiaenegocios/tn.plonebehavior.template
c3c4b52991706036a27eb4cebf33ea8eaad115d2
enchanting2.py
enchanting2.py
"""enchanting2.py This is the main entry point of the system""" import sys import xml.etree.cElementTree as ElementTree import pygame import actor import media def main(argv): """This is a naive, blocking, co-operatively multitasking approach""" filename = argv[1] # xml file to open tree = ElementTree.parse(fi...
"""enchanting2.py This is the main entry point of the system""" import sys import xml.etree.cElementTree as ElementTree import actor import media def main(argv): """This is a naive, blocking, co-operatively multitasking approach""" filename = argv[1] # xml file to open tree = ElementTree.parse(filename) proje...
Fix - was flipping display twice
Fix - was flipping display twice Gah. Here is a speedup for pygame -- don't flip the display twice.
Python
agpl-3.0
clintonblackmore/enchanting2,clintonblackmore/enchanting2
d1d40da564ca82dc58a37893f86acc934bc69cd5
api/base/content_negotiation.py
api/base/content_negotiation.py
from rest_framework.negotiation import DefaultContentNegotiation class JSONAPIContentNegotiation(DefaultContentNegotiation): def select_renderer(self, request, renderers, format_suffix=None): """ If 'application/json' in acceptable media types, use the first renderer in DEFAULT_RENDERER_C...
from rest_framework.negotiation import DefaultContentNegotiation class JSONAPIContentNegotiation(DefaultContentNegotiation): def select_renderer(self, request, renderers, format_suffix=None): """ If 'application/json' in acceptable media types, use the first renderer in DEFAULT_RENDERER_C...
Use super because only one superclass
Use super because only one superclass
Python
apache-2.0
SSJohns/osf.io,HalcyonChimera/osf.io,haoyuchen1992/osf.io,chennan47/osf.io,chennan47/osf.io,KAsante95/osf.io,laurenrevere/osf.io,njantrania/osf.io,caneruguz/osf.io,adlius/osf.io,GageGaskins/osf.io,brandonPurvis/osf.io,chrisseto/osf.io,zamattiac/osf.io,erinspace/osf.io,haoyuchen1992/osf.io,Johnetordoff/osf.io,baylee-d/o...
10313adc8b5aab9bcc7e21242ef54effc2262a24
accio/__init__.py
accio/__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from datetime import timedelta from celery import Celery from accio.basetask import ManagedTask import django.conf default_app_config = 'accio.apps.Config' REDIS_DB_URL = 'redis://127.0.0.1:6379/0' celery_app = Celery(task_cls=ManagedTask) celery_app....
# -*- coding: utf-8 -*- from __future__ import unicode_literals from datetime import timedelta from celery import Celery from accio.basetask import ManagedTask import django.conf default_app_config = 'accio.apps.Config' REDIS_DB_URL = 'redis://127.0.0.1:6379/0' celery_app = Celery(task_cls=ManagedTask) celery_app....
Revert msgpack to json content message
Revert msgpack to json content message
Python
bsd-3-clause
silverfix/django-accio
d423668902a87c17e73f3521e58571709c9b9283
td_biblio/urls.py
td_biblio/urls.py
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns from .views import EntryListView urlpatterns = patterns( '', # Entry List url('^$', EntryListView.as_view(), name='entry_list'), )
# -*- coding: utf-8 -*- from django.conf.urls import url from .views import EntryListView urlpatterns = [ # Entry List url('^$', EntryListView.as_view(), name='entry_list'), ]
Switch to django new url schema
Switch to django new url schema
Python
mit
TailorDev/django-tailordev-biblio,TailorDev/django-tailordev-biblio,TailorDev/django-tailordev-biblio,TailorDev/django-tailordev-biblio
5f945f5335cd5d989401fe99b0752e98595748c0
chainer/functions/evaluation/binary_accuracy.py
chainer/functions/evaluation/binary_accuracy.py
import numpy from chainer import cuda from chainer import function from chainer.utils import type_check class BinaryAccuracy(function.Function): ignore_label = -1 def check_type_forward(self, in_types): type_check.expect(in_types.size() == 2) x_type, t_type = in_types type_check.ex...
import numpy from chainer import cuda from chainer import function from chainer.utils import type_check class BinaryAccuracy(function.Function): ignore_label = -1 def check_type_forward(self, in_types): type_check.expect(in_types.size() == 2) x_type, t_type = in_types type_check.ex...
Use maximum instead of if-statement
Use maximum instead of if-statement
Python
mit
cupy/cupy,keisuke-umezawa/chainer,benob/chainer,ktnyt/chainer,anaruse/chainer,AlpacaDB/chainer,ktnyt/chainer,rezoo/chainer,niboshi/chainer,ysekky/chainer,jnishi/chainer,keisuke-umezawa/chainer,jnishi/chainer,niboshi/chainer,hvy/chainer,chainer/chainer,okuta/chainer,okuta/chainer,wkentaro/chainer,keisuke-umezawa/chainer...
84b48b9be466ac72bddf5ee6288ff48be26eed62
tests/classifier/RandomForestClassifier/RandomForestClassifierPHPTest.py
tests/classifier/RandomForestClassifier/RandomForestClassifierPHPTest.py
# -*- coding: utf-8 -*- import unittest from unittest import TestCase from sklearn.ensemble import RandomForestClassifier from ..Classifier import Classifier from ...language.PHP import PHP class RandomForestClassifierPHPTest(PHP, Classifier, TestCase): def setUp(self): super(RandomForestClassifierPHP...
# -*- coding: utf-8 -*- import unittest from unittest import TestCase from sklearn.ensemble import RandomForestClassifier from ..Classifier import Classifier from ...language.PHP import PHP class RandomForestClassifierPHPTest(PHP, Classifier, TestCase): def setUp(self): super(RandomForestClassifierPHP...
Reduce the number of trees
Reduce the number of trees
Python
bsd-3-clause
nok/sklearn-porter
94c48d9f61b8f7e462ce5f7013b29ce2399e4190
log4django/views/__init__.py
log4django/views/__init__.py
from django.db.models import Q from ..models import LogRecord def _filter_records(request): getvars = request.GET logrecord_qs = LogRecord.objects.all().select_related('app') # Filtering by get params. if getvars.get('q'): q = getvars.get('q') logrecord_qs = logrecord_qs.filter( ...
from django.db.models import Q from ..models import LogRecord def _filter_records(request): getvars = request.GET logrecord_qs = LogRecord.objects.all().select_related('app') # Filtering by get params. if getvars.get('q'): q = getvars.get('q') logrecord_qs = logrecord_qs.filter( ...
Add search by request_id field.
Add search by request_id field.
Python
bsd-3-clause
CodeScaleInc/log4django,CodeScaleInc/log4django,CodeScaleInc/log4django
44233af1e6cdc368a866c4a96ee4b1dfa53cc870
logya/generate.py
logya/generate.py
# -*- coding: utf-8 -*- import shutil from pathlib import Path from shutil import copytree from logya.core import Logya from logya.content import write_collection, write_page def generate(options): L = Logya(options) #L.build_index() if not options.keep: print('Remove existing public directory....
# -*- coding: utf-8 -*- import shutil from shutil import copytree from logya.core import Logya from logya.content import write_collection, write_page def generate(options): L = Logya(options) L.build_index() if not options.keep: print('Remove existing public directory.') shutil.rmtree(L...
Call build_index and use joinpath.
Call build_index and use joinpath.
Python
mit
elaOnMars/logya,elaOnMars/logya,yaph/logya,elaOnMars/logya,yaph/logya
b5bf31eab3fef21872ce44ada1a14aee9c3216d7
mlab-ns-simulator/mlabsim/tests/test_update.py
mlab-ns-simulator/mlabsim/tests/test_update.py
import json import urllib from twisted.trial import unittest import mock from mlabsim import update class UpdateResourceTests (unittest.TestCase): def test_render_PUT_valid_parameters(self): # Test data: tool_extra = { 'collector_onion': 'testfakenotreal.onion', } ...
import json import urllib from twisted.trial import unittest import mock from mlabsim import update class UpdateResourceTests (unittest.TestCase): def test_render_PUT_valid_parameters(self): # Test data: fqdn = 'mlab01.ooni-tests.not-real.except-it-actually-could-be.example.com' tool_...
Update test_render_PUT_valid_parameters to be an approximate first draft.
Update test_render_PUT_valid_parameters to be an approximate first draft.
Python
apache-2.0
hellais/ooni-support,m-lab/ooni-support,m-lab/ooni-support,hellais/ooni-support
021225cbce30b70c350133f5ae3cae9409bdd6ae
dbaas/dbaas_services/analyzing/admin/analyze.py
dbaas/dbaas_services/analyzing/admin/analyze.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from dbaas_services.analyzing.service import AnalyzeRepositoryService from dbaas_services.analyzing.forms import AnalyzeRepositoryForm class AnalyzeRepositoryAdmin(admin.DjangoServicesAdmin): form = ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from dbaas_services.analyzing.service import AnalyzeRepositoryService from dbaas_services.analyzing.forms import AnalyzeRepositoryForm class AnalyzeRepositoryAdmin(admin.DjangoServicesAdmin): form = ...
Add filters to analyzing admin
Add filters to analyzing admin
Python
bsd-3-clause
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
3773132aa24f1b7f9e3eb104274b0960eee12d14
froide/foirequest/templatetags/foirequest_tags.py
froide/foirequest/templatetags/foirequest_tags.py
from django import template from django.utils.safestring import mark_safe from django.utils.html import escape register = template.Library() def highlight_request(message): content = message.get_content() description = message.request.description try: index = content.index(description) except...
from django import template from django.utils.safestring import mark_safe from django.utils.html import escape register = template.Library() def highlight_request(message): content = message.get_content() description = message.request.description description = description.replace("\r\n", "\n") try: ...
Replace uni linebreaks with simple linefeeds in order to make highlighting work
Replace uni linebreaks with simple linefeeds in order to make highlighting work
Python
mit
catcosmo/froide,LilithWittmann/froide,stefanw/froide,stefanw/froide,CodeforHawaii/froide,catcosmo/froide,LilithWittmann/froide,okfse/froide,fin/froide,CodeforHawaii/froide,catcosmo/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,okfse/froide,catcosmo/froide,fin/froide,CodeforHawaii/froide,ryankanno/froid...
4fec805a0a6c04ac16fd4439298a4fa05709c7ea
armstrong/hatband/tests/hatband_support/admin.py
armstrong/hatband/tests/hatband_support/admin.py
from armstrong import hatband from hatband_support import models from django.forms.widgets import TextInput class ArticleAdmin(hatband.ModelAdmin): class Meta: model = models.TestArticle class ArticleOverrideAdmin(hatband.ModelAdmin): formfield_overrides = { models.TextField: {'widget': Te...
from armstrong import hatband from . import models from django.db.models import TextField from django.forms.widgets import TextInput class ArticleAdmin(hatband.ModelAdmin): class Meta: model = models.TestArticle class ArticleOverrideAdmin(hatband.ModelAdmin): formfield_overrides = { TextFi...
Fix these class names and imports so it works
Fix these class names and imports so it works
Python
apache-2.0
armstrong/armstrong.hatband,texastribune/armstrong.hatband,texastribune/armstrong.hatband,armstrong/armstrong.hatband,armstrong/armstrong.hatband,texastribune/armstrong.hatband
d95f2059a753855d373332df0b748d52bba0210d
main.py
main.py
import menus import auth import click def main(): """Main function""" credentials = auth.authenticate_user() if credentials: menus.main_menu(credentials) else: click.echo("Bye!") if __name__ == '__main__': main()
import menus import auth import click def main(): """Main function""" credentials = auth.authenticate_user() if credentials: menus.main_menu(credentials) click.echo("Bye!") if __name__ == '__main__': main()
Fix to ensure program echos "bye" whenever program is quit
Fix to ensure program echos "bye" whenever program is quit
Python
mit
amrishparmar/mal_cl_interface
5863f46280697be7e14ae9a8e6bb08a42ff940ac
resource_scheduler/views.py
resource_scheduler/views.py
from django.http import HttpResponse from django.shortcuts import render_to_response from .models import Resource def index(request): return render_to_response("index.html") def allresources(request): mdict = { "resources": Resource.objects.all() } return render_to_response("resources_main.html", mdict) def...
from django.http import Http404 from django.shortcuts import render_to_response from .models import Resource def index(request): return render_to_response("index.html") def allresources(request): mdict = { "resources": Resource.objects.all() } return render_to_response("resources_main.html", mdict) def spec...
Add check to make sure resource exists
Add check to make sure resource exists
Python
mit
simon-andrews/django-resource-scheduler,simon-andrews/django-resource-scheduler
4fecbff12c4ebcd63ca2d43e608da95758909b46
app/__init__.py
app/__init__.py
from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) # load configuration file app.config.from_object('config') # database initialization db = SQLAlchemy(app)
from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) # load configuration file app.config.from_object('config') # database initialization db = SQLAlchemy(app) from app import models
Add import models to app
Add import models to app
Python
mit
mdsrosa/routes_api_python
b3adf26f8b7353d3b0581cdca533eb03ee24b207
bin/verify_cached_graphs.py
bin/verify_cached_graphs.py
#!/usr/bin/env python import sys from pprint import pprint as pp from cc.payment import flow def verify(): for ignore_balances in (True, False): graph = flow.build_graph(ignore_balances) cached = flow.get_cached_graph(ignore_balances) if not cached: flow.set_cached_graph(graph...
#!/usr/bin/env python import sys from pprint import pprint as pp from cc.payment import flow def verify(): for ignore_balances in (True, False): graph = flow.build_graph(ignore_balances) cached = flow.get_cached_graph(ignore_balances) if not cached: flow.set_cached_graph(graph...
Fix cached graph out-of-sync when checking.
Fix cached graph out-of-sync when checking.
Python
agpl-3.0
rfugger/villagescc,rfugger/villagescc,rfugger/villagescc,rfugger/villagescc
ea6a8de791bf200da2fe5e54a9f9ca68314f3489
forum/admin.py
forum/admin.py
from django.contrib import admin from forum.models import Category, Forum, Thread admin.site.register(Category) admin.site.register(Forum) admin.site.register(Thread)
from django.contrib import admin from forum.models import Category, Forum, Thread class ForumInline(admin.StackedInline): model = Forum class CategoryAdmin(admin.ModelAdmin): inlines = [ForumInline] admin.site.register(Category, CategoryAdmin) admin.site.register(Thread)
Modify forums directly in categories.
Modify forums directly in categories.
Python
mit
xfix/NextBoard
371df3363677118d59315e66523aefb081c67282
astroML/plotting/settings.py
astroML/plotting/settings.py
def setup_text_plots(fontsize=8, usetex=True): """ This function adjusts matplotlib settings so that all figures in the textbook have a uniform format and look. """ import matplotlib matplotlib.rc('legend', fontsize=fontsize, handlelength=3) matplotlib.rc('axes', titlesize=fontsize) matp...
def setup_text_plots(fontsize=8, usetex=True): """ This function adjusts matplotlib settings so that all figures in the textbook have a uniform format and look. """ import matplotlib from distutils.version import LooseVersion matplotlib.rc('legend', fontsize=fontsize, handlelength=3) mat...
Update the mpl rcparams for mpl 2.0+
Update the mpl rcparams for mpl 2.0+
Python
bsd-2-clause
astroML/astroML
261393eb46cdc082b60d9ea11ec862f508632ad2
audit_log/models/__init__.py
audit_log/models/__init__.py
from django.db.models import Model from django.utils.translation import ugettext_lazy as _ from audit_log.models.fields import CreatingUserField, CreatingSessionKeyField, LastUserField, LastSessionKeyField class AuthStampedModel(Model): """ An abstract base class model that provides auth and session information fie...
from django.db.models import Model, SET_NULL from django.utils.translation import ugettext_lazy as _ from audit_log.models.fields import CreatingUserField, CreatingSessionKeyField, LastUserField, LastSessionKeyField class AuthStampedModel(Model): """ An abstract base class model that provides auth and session inform...
Add mandatory `on_delete` and allow nulls
Add mandatory `on_delete` and allow nulls I assume it's better to allow nulls than to have auth stamped models disappear with deleted users.
Python
bsd-3-clause
Atomidata/django-audit-log,Atomidata/django-audit-log
bf70f8e3235c140589e9b0110b34da8427ab409b
child_sync_typo3/wizard/delegate_child_wizard.py
child_sync_typo3/wizard/delegate_child_wizard.py
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: David Coninckx <david@coninckx.com> # # The licence is in the file __ope...
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: David Coninckx <david@coninckx.com> # # The licence is in the file __ope...
Fix res returned on delegate
Fix res returned on delegate
Python
agpl-3.0
MickSandoz/compassion-switzerland,ndtran/compassion-switzerland,eicher31/compassion-switzerland,ecino/compassion-switzerland,Secheron/compassion-switzerland,ecino/compassion-switzerland,Secheron/compassion-switzerland,CompassionCH/compassion-switzerland,MickSandoz/compassion-switzerland,ndtran/compassion-switzerland,ec...
c845570d8ce6217f5943d538700e207f0221841e
setup.py
setup.py
# -*- coding: utf-8 -*- __copyright__ = "Copyright (c) 2012, Chris Drake" __license__ = "All rights reserved." # standard library from distutils.core import setup # pyeda from pyeda import __version__ with open("README.rst") as fin: README = fin.read() with open("LICENSE") as fin: LICENSE = fin.read() PAC...
# -*- coding: utf-8 -*- __copyright__ = "Copyright (c) 2012, Chris Drake" __license__ = "All rights reserved." # standard library from distutils.core import setup # pyeda from pyeda import __version__ with open("README.rst") as fin: README = fin.read() with open("LICENSE") as fin: LICENSE = fin.read() PAC...
Add github as project URL
Add github as project URL
Python
bsd-2-clause
karissa/pyeda,karissa/pyeda,cjdrake/pyeda,cjdrake/pyeda,pombredanne/pyeda,GtTmy/pyeda,GtTmy/pyeda,pombredanne/pyeda,cjdrake/pyeda,sschnug/pyeda,sschnug/pyeda,karissa/pyeda,sschnug/pyeda,pombredanne/pyeda,GtTmy/pyeda
b2a064000a79151c3e9bda06e970bc8208cce330
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup( name="django-auth-ldap", version="1.0b7", description="Django LDAP authentication backend", long_description="""This is a Django authentication backend that authenticates against an LDAP service. Configuration can be as simple as a single d...
#!/usr/bin/env python from distutils.core import setup setup( name="django-auth-ldap", version="1.0b7", description="Django LDAP authentication backend", long_description="""This is a Django authentication backend that authenticates against an LDAP service. Configuration can be as simple as a single d...
Fix url in distutils description.
Fix url in distutils description.
Python
bsd-2-clause
theatlantic/django-auth-ldap,DheerendraRathor/django-auth-ldap-ng
53931faf00ee64bec253e1ae9a5c6be66298d379
setup.py
setup.py
from cx_Freeze import setup, Executable build_exe_options = { "bin_includes": [ "libssl.so", "libz.so" ], "bin_path_includes": [ "/usr/lib/x86_64-linux-gnu" ], "include_files": [ ("client/dist", "client"), "LICENSE", "templates", "readme.md" ...
from cx_Freeze import setup, Executable build_exe_options = { "bin_includes": [ "libssl.so", "libz.so" ], "bin_path_includes": [ "/usr/lib/x86_64-linux-gnu" ], "include_files": [ ("client/dist", "client"), "LICENSE", "templates", "readme.md" ...
Add sentry_sdk to cxfreeze packages
Add sentry_sdk to cxfreeze packages
Python
mit
virtool/virtool,igboyes/virtool,virtool/virtool,igboyes/virtool
a51d2ec96469686e3a2767e29951b8442b17da69
test/test_util.py
test/test_util.py
from kitten.util import AutoParadigmMixin class TestAutoParadigmMixin(object): def setup_method(self, method): self.apm = AutoParadigmMixin() def test_first_load(self): ret = self.apm.paradigms assert 'node' in ret assert 'node' in self.apm._paradigms def test_second_loa...
from kitten.util import AutoParadigmMixin class TestAutoParadigmMixin(object): def setup_method(self, method): self.apm = AutoParadigmMixin() def test_first_load(self): ret = self.apm.paradigms assert 'node' in ret assert 'node' in self.apm._paradigms def test_second_loa...
Add tests for APM overrides
Add tests for APM overrides
Python
mit
thiderman/network-kitten
6cd9c7285d462311580754229d0b85af844dd387
test/integration/test_cli.py
test/integration/test_cli.py
import unittest class TestCLI(unittest.TestCase): def test_kubos_installed(self): self.assertEqual('foo'.upper(), 'FOO') self.assertTrue('FOO'.isupper()) self.assertFalse('Foo'.isupper()) s = 'hello world' self.assertEqual(s.split(), ['hello', 'world']) # check that...
import unittest import re import subprocess class TestCLI(unittest.TestCase): def test_latest_kubos_installed(self): bashCommand = "vagrant ssh -c 'kubos update'" process = subprocess.Popen(bashCommand.split()) output, error = process.communicate() regex = re.compile(r"All up to dat...
Update integration test with actual...integration test
Update integration test with actual...integration test
Python
apache-2.0
Psykar/kubos,kubostech/KubOS,Psykar/kubos,Psykar/kubos,Psykar/kubos,kubostech/KubOS,Psykar/kubos,Psykar/kubos,Psykar/kubos
ec7da0420a83223c0f636ddb9a7ebfcfa943f2da
test/mock_settings_device.py
test/mock_settings_device.py
PATH = 0 VALUE = 1 MINIMUM = 2 MAXIMUM = 3 # Simulates the SettingsSevice object without using the D-Bus (intended for unit tests). Values passed to # __setitem__ (or the [] operator) will be stored in memory for later retrieval by __getitem__. class MockSettingsDevice(object): def __init__(self, supported_settin...
PATH = 0 VALUE = 1 MINIMUM = 2 MAXIMUM = 3 # Simulates the SettingsSevice object without using the D-Bus (intended for unit tests). Values passed to # __setitem__ (or the [] operator) will be stored in memory for later retrieval by __getitem__. class MockSettingsDevice(object): def __init__(self, supported_settin...
Add addSettings call also to the testing code.
Add addSettings call also to the testing code.
Python
mit
victronenergy/velib_python
6dfc6cffb2594b420843ce7021988f78de2b4faf
estmator_project/estmator_project/test.py
estmator_project/estmator_project/test.py
from test_plus.test import TestCase as PlusTestCase class TestCase(PlusTestCase): pass
from test_plus.test import TestCase as PlusTestCase class TestCase(PlusTestCase): """Sublcassed TestCase for project.""" pass
Test commit for travis setup
Test commit for travis setup
Python
mit
Estmator/EstmatorApp,Estmator/EstmatorApp,Estmator/EstmatorApp
8c55bdc78b3ae2c52826740ab049a2bab5ca1fdd
src/nodeconductor_saltstack/exchange/extension.py
src/nodeconductor_saltstack/exchange/extension.py
from nodeconductor.core import NodeConductorExtension class ExchangeExtension(NodeConductorExtension): @staticmethod def django_app(): return 'nodeconductor_saltstack.exchange' @staticmethod def rest_urls(): from .urls import register_in return register_in
from nodeconductor.core import NodeConductorExtension class ExchangeExtension(NodeConductorExtension): @staticmethod def django_app(): return 'nodeconductor_saltstack.exchange' @staticmethod def rest_urls(): from .urls import register_in return register_in @staticmethod ...
Add sync quota task to celerybeat
Add sync quota task to celerybeat - nc-1009
Python
mit
opennode/nodeconductor-saltstack
3c01c07e13dfd79a76408926b13848417a3cfb3e
tests/test_requesthandler.py
tests/test_requesthandler.py
from ppp_datamodel import Sentence, Resource from ppp_datamodel.communication import Request, TraceItem, Response from ppp_libmodule.tests import PPPTestCase from ppp_natural_math import app class TestFollowing(PPPTestCase(app)): config_var = 'PPP_NATURALMATH' config = '' def testBasics(self): q = ...
from ppp_datamodel import Sentence, Resource from ppp_datamodel.communication import Request, TraceItem, Response from ppp_libmodule.tests import PPPTestCase from ppp_natural_math import app class TestFollowing(PPPTestCase(app)): config_var = 'PPP_NATURALMATH' config = '' def testBasics(self): q = ...
Fix requesthandler tests (new version of datamodel).
Fix requesthandler tests (new version of datamodel).
Python
mit
iScienceLuvr/PPP-NaturalMath,ProjetPP/PPP-NaturalMath,iScienceLuvr/ckse,iScienceLuvr/PPP-NaturalMath,ProjetPP/PPP-NaturalMath,iScienceLuvr/ckse
e4b1fcf017494c22744f44bd93381b8063b30e34
eadred/tests/test_generate.py
eadred/tests/test_generate.py
import unittest from eadred.management.commands import generatedata def test_generatedata(): """Basic test to make sure function gets called.""" from testproject.testapp import sampledata assert sampledata.called == False cmd = generatedata.Command() cmd.execute() assert sampledata.called ==...
from eadred.management.commands import generatedata def test_generatedata(): """Basic test to make sure function gets called.""" from testproject.testapp import sampledata assert sampledata.called == False cmd = generatedata.Command() cmd.run_from_argv(['manage.py', '']) assert sampledata.cal...
Fix test to catch options issues
Fix test to catch options issues The test should now catch the issue that was fixed in 79a453f.
Python
bsd-3-clause
willkg/django-eadred
62494cd7125d498d8de058ab3ebe556cd9686f6e
calvin/runtime/north/plugins/coders/messages/msgpack_coder.py
calvin/runtime/north/plugins/coders/messages/msgpack_coder.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # 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 ...
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # 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 ...
Use umsgpack package for msgpack coder
coder/msgpack: Use umsgpack package for msgpack coder
Python
apache-2.0
EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base
8cd859609a8a58474ff152d9adbb968ab3cdffa0
gaphor/diagram/diagramtools/tests/test_txtool.py
gaphor/diagram/diagramtools/tests/test_txtool.py
from unittest.mock import Mock from gi.repository import Gtk from gaphor.diagram.diagramtools.txtool import TxData, on_begin, transactional_tool from gaphor.transaction import TransactionBegin def xtest_start_tx_on_begin(view, event_manager): event_manager.handle = Mock() tx_data = TxData(event_manager) ...
from gi.repository import Gtk from gaphor.diagram.diagramtools.txtool import ( TxData, on_begin, on_end, transactional_tool, ) from gaphor.transaction import TransactionBegin class MockEventManager: def __init__(self): self.events = [] def handle(self, event): self.events.app...
Fix tests for tx tool
Fix tests for tx tool
Python
lgpl-2.1
amolenaar/gaphor,amolenaar/gaphor
9ef44fb81e8c9fef40f5b21e648c2500e01169f4
medical_patient_ethnicity/models/medical_patient_ethnicity.py
medical_patient_ethnicity/models/medical_patient_ethnicity.py
# -*- coding: utf-8 -*- # ############################################################################# # # Tech-Receptives Solutions Pvt. Ltd. # Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>) # Special Credit and Thanks to Thymbra Latinoamericana S.A. # # This program is free softwa...
# -*- coding: utf-8 -*- # ############################################################################# # # Tech-Receptives Solutions Pvt. Ltd. # Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>) # Special Credit and Thanks to Thymbra Latinoamericana S.A. # # This program is free softwa...
Add required to ethnicity code
Add required to ethnicity code
Python
agpl-3.0
laslabs/vertical-medical,ShaheenHossain/eagle-medical,ShaheenHossain/eagle-medical,laslabs/vertical-medical
63c300670a8406ac403841630aded1a810d929fd
lib/subprocess_tee/test/test_rich.py
lib/subprocess_tee/test/test_rich.py
"""Tests for rich module.""" import sys from subprocess_tee import run from subprocess_tee.rich import ConsoleEx def test_rich_console_ex() -> None: """Validate that ConsoleEx can capture output from print() calls.""" console = ConsoleEx(record=True, redirect=True) console.print("alpha") print("beta"...
"""Tests for rich module.""" import sys from subprocess_tee import run from subprocess_tee.rich import ConsoleEx def test_rich_console_ex() -> None: """Validate that ConsoleEx can capture output from print() calls.""" console = ConsoleEx(record=True, redirect=True) console.print("alpha") print("beta"...
Add testing of rich html_export
Add testing of rich html_export
Python
mit
pycontribs/subprocess-tee
cda5fcb56ecdfe5a2f49d0efbf76e853c8c50e6c
migration_scripts/0.3/crypto_util.py
migration_scripts/0.3/crypto_util.py
# -*- coding: utf-8 -*- # Minimal set of functions and variables from 0.2.1's crypto_util.py needed to # regenerate journalist designations from soure's filesystem id's. import random as badrandom nouns = file("nouns.txt").read().split('\n') adjectives = file("adjectives.txt").read().split('\n') def displayid(n): ...
# -*- coding: utf-8 -*- # Minimal set of functions and variables from 0.2.1's crypto_util.py needed to # regenerate journalist designations from soure's filesystem id's. import os import random as badrandom # Find the absolute path relative to this file so this script can be run anywhere SRC_DIR = os.path.dirname(os.p...
Load files from absolute paths so this can be run from anywhere
Load files from absolute paths so this can be run from anywhere
Python
agpl-3.0
mark-in/securedrop-prov-upstream,mark-in/securedrop-prov-upstream,mark-in/securedrop-prov-upstream,mark-in/securedrop-prov-upstream
fe6b7b9abb8e9730a3d028850337c047fe6607ea
tests/unit/services/user/test_models_full_name.py
tests/unit/services/user/test_models_full_name.py
""" :Copyright: 2006-2020 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ import pytest from testfixtures.user import create_user_with_detail @pytest.mark.parametrize( 'first_names, last_name, expected', [ (None, None , None ), ('Gie...
""" :Copyright: 2006-2020 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from datetime import datetime import pytest from byceps.services.user.models.user import User as DbUser from byceps.services.user.models.detail import UserDetail as DbUserDetail @pytest.mark.parametrize( '...
Create fullname user object locally in test
Create fullname user object locally in test
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps