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
80857a9f30b3e6773a658bf8ce93809c0881f80a
plugins/liquid_tags/liquid_tags.py
plugins/liquid_tags/liquid_tags.py
from pelican import signals from .mdx_liquid_tags import LiquidTags, LT_CONFIG def addLiquidTags(gen): if not gen.settings.get('MD_EXTENSIONS'): from pelican.settings import DEFAULT_CONFIG gen.settings['MD_EXTENSIONS'] = DEFAULT_CONFIG['MD_EXTENSIONS'] if LiquidTags not in gen.settings['MD_EX...
from pelican import signals from .mdx_liquid_tags import LiquidTags, LT_CONFIG def addLiquidTags(gen): if not gen.settings.get('MARKDOWN'): from pelican.settings import DEFAULT_CONFIG gen.settings['MARKDOWN'] = DEFAULT_CONFIG['MARKDOWN'] if LiquidTags not in gen.settings['MARKDOWN']: ...
Update to new markdown settings
Update to new markdown settings
Python
apache-2.0
danielfrg/danielfrg.github.io-source,danielfrg/danielfrg.github.io-source,danielfrg/danielfrg.github.io-source
43434cc8efa52b56a64d52076b3760131456c34c
.bin/broadcast_any_song.py
.bin/broadcast_any_song.py
#!/usr/bin/env python2 ################################################################################ # broadcast_any_song.py # # Uses the Exfm REST API to broadcast a song, (basically scours Tumblr for an # audio file matching a query then sends it to PiFM.) # # Maintained By: Ryan Jacobs <ryan.mjacobs@gmail.com> # ...
#!/usr/bin/env python2 ################################################################################ # broadcast_any_song.py # # Uses the Exfm REST API to broadcast a song, (basically scours Tumblr for an # audio file matching a query then sends it to PiFM.) # # Maintained By: Ryan Jacobs <ryan.mjacobs@gmail.com> # ...
Remove CHANNEL. Why is it even there?
Remove CHANNEL. Why is it even there?
Python
mit
ryanmjacobs/ryans_dotfiles,ryanmjacobs/ryans_dotfiles
388c938c0604bbf432921ad46be8325b1e74fa4a
direct/src/showbase/TkGlobal.py
direct/src/showbase/TkGlobal.py
""" This module is now vestigial. """ import sys, Pmw # This is required by the ihooks.py module used by Squeeze (used by # pandaSqueezer.py) so that Pmw initializes properly if '_Pmw' in sys.modules: sys.modules['_Pmw'].__name__ = '_Pmw' def spawnTkLoop(): base.spawnTkLoop()
""" This module is now vestigial. """ from Tkinter import * import sys, Pmw # This is required by the ihooks.py module used by Squeeze (used by # pandaSqueezer.py) so that Pmw initializes properly if '_Pmw' in sys.modules: sys.modules['_Pmw'].__name__ = '_Pmw' def spawnTkLoop(): base.spawnTkLoop()
Add import for backward compatibility
Add import for backward compatibility
Python
bsd-3-clause
ee08b397/panda3d,hj3938/panda3d,mgracer48/panda3d,chandler14362/panda3d,grimfang/panda3d,mgracer48/panda3d,chandler14362/panda3d,brakhane/panda3d,chandler14362/panda3d,cc272309126/panda3d,grimfang/panda3d,matthiascy/panda3d,mgracer48/panda3d,chandler14362/panda3d,Wilee999/panda3d,ee08b397/panda3d,jjkoletar/panda3d,jjko...
72de9e47015e2018ca13c6d4681a79e53c2d5475
brabeion/models.py
brabeion/models.py
from datetime import datetime from django.db import models from django.contrib.auth.models import User class BadgeAward(models.Model): user = models.ForeignKey(User, related_name="badges_earned") awarded_at = models.DateTimeField(default=datetime.now) slug = models.CharField(max_length=255) level =...
from datetime import datetime from django.contrib.auth.models import User from django.db import models from django.utils import timezone class BadgeAward(models.Model): user = models.ForeignKey(User, related_name="badges_earned") awarded_at = models.DateTimeField(default=timezone.now) slug = models.Char...
Use timezone-aware dates with BadgeAward if desired
Use timezone-aware dates with BadgeAward if desired
Python
bsd-3-clause
kinsights/brabeion
6eea9e787107a83be36b03d93cddfe7fdf1e9e05
tools/skp/page_sets/skia_amazon_desktop.py
tools/skp/page_sets/skia_amazon_desktop.py
# Copyright 2014 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. # pylint: disable=W0401,W0614 from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class SkiaBuildbotDesk...
# Copyright 2014 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. # pylint: disable=W0401,W0614 from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class SkiaBuildbotDesk...
Add wait to amazon page set to avoid tab crashes
Add wait to amazon page set to avoid tab crashes BUG=skia:3049 TBR=borenet NOTRY=true Review URL: https://codereview.chromium.org/686133002
Python
bsd-3-clause
HalCanary/skia-hc,samuelig/skia,noselhq/skia,spezi77/android_external_skia,w3nd1go/android_external_skia,geekboxzone/mmallow_external_skia,YUPlayGodDev/platform_external_skia,AOSP-YU/platform_external_skia,PAC-ROM/android_external_skia,Infinitive-OS/platform_external_skia,UBERMALLOW/external_skia,scroggo/skia,AOSPB/ext...
edd4f01065b7bac6c7400d8c1496375fbe0a9aa5
app/timetables/models.py
app/timetables/models.py
from __future__ import unicode_literals from django.db import models class Weekday(models.Model): """Model representing the day of the week.""" name = models.CharField(max_length=60, unique=True) def clean(self): """ Capitalize the first letter of the first word to avoid case in...
from __future__ import unicode_literals from django.db import models class Weekday(models.Model): """Model representing the day of the week.""" name = models.CharField(max_length=60, unique=True) def clean(self): """ Capitalize the first letter of the first word to avoid case in...
Add unique constraint on Meal name field
Add unique constraint on Meal name field
Python
mit
teamtaverna/core
d2076f6fd3a0bb687224048de904207c885aba5c
utils.py
utils.py
from functools import wraps def cached_property(f): name = f.__name__ @property @wraps(f) def inner(self): if not hasattr(self, "_property_cache"): self._property_cache = {} if name not in self._property_cache: self._property_cache[name] = f(self) return...
from functools import wraps def cached_property(f): name = f.__name__ @property @wraps(f) def inner(self): if not hasattr(self, "_property_cache"): self._property_cache = {} if name not in self._property_cache: self._property_cache[name] = f(self) return...
Make it easier to define constants
Make it easier to define constants
Python
unlicense
drkitty/python3-base,drkitty/python3-base
07f2de7775cd73e220bebe3d6ea8cfe5604de174
utils.py
utils.py
import errno import os import socket from contextlib import closing import plumbum # http://stackoverflow.com/a/166589 # Create a UDP socket to the internet at large to get our routed IP def get_routed_ip(): with closing(socket.socket(socket.AF_INET, socket.SOCK_DGRAM)) as s: s.connect(("8.8.8.8", 53)) ...
import errno import os import socket from contextlib import closing import plumbum # http://stackoverflow.com/a/166589 # Create a UDP socket to the internet at large to get our routed IP def get_routed_ip(): with closing(socket.socket(socket.AF_INET, socket.SOCK_DGRAM)) as s: s.connect(("8.8.8.8", 53)) ...
Fix branch name getting on older git version.
Fix branch name getting on older git version.
Python
mit
liffiton/ATLeS,liffiton/ATLeS,liffiton/ATLeS,liffiton/ATLeS
deb5a6c45d6f52daef7ca5752f574d7c14abbc47
admin/base/urls.py
admin/base/urls.py
from django.conf.urls import include, url from django.contrib import admin from settings import ADMIN_BASE from . import views base_pattern = '^{}'.format(ADMIN_BASE) urlpatterns = [ ### ADMIN ### url( base_pattern, include([ url(r'^$', views.home, name='home'), url(r...
from django.conf.urls import include, url from django.contrib import admin from settings import ADMIN_BASE from . import views base_pattern = '^{}'.format(ADMIN_BASE) urlpatterns = [ ### ADMIN ### url( base_pattern, include([ url(r'^$', views.home, name='home'), url(r...
Add preprints to the sidebar
Add preprints to the sidebar [#OSF-7198]
Python
apache-2.0
mattclark/osf.io,caseyrollins/osf.io,aaxelb/osf.io,icereval/osf.io,felliott/osf.io,cwisecarver/osf.io,adlius/osf.io,crcresearch/osf.io,caneruguz/osf.io,cslzchen/osf.io,pattisdr/osf.io,leb2dg/osf.io,mattclark/osf.io,mfraezz/osf.io,caseyrollins/osf.io,baylee-d/osf.io,chrisseto/osf.io,saradbowman/osf.io,brianjgeiger/osf.i...
c8af52e91eb5ea40090a4b303e147c2d5d6cf28a
cloudbaseinit/shell.py
cloudbaseinit/shell.py
# Copyright 2012 Cloudbase Solutions Srl # # 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 2012 Cloudbase Solutions Srl # # 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...
Fix py3 x64 crash thread related
Fix py3 x64 crash thread related Change-Id: Iac00ea2463df4346ad60a17d0ba9a2af089c87cd
Python
apache-2.0
chialiang-8/cloudbase-init,stackforge/cloudbase-init,openstack/cloudbase-init,stefan-caraiman/cloudbase-init,cmin764/cloudbase-init,alexpilotti/cloudbase-init,ader1990/cloudbase-init
30261101fada94b4bd5df0f9c4506a4ac4dd1063
examples/sum.py
examples/sum.py
from numba import d from numba.decorators import jit as jit def sum2d(arr): M, N = arr.shape result = 0.0 for i in range(M): for j in range(N): result += arr[i,j] return result csum2d = jit(restype=d, argtypes=[d[:,:]])(sum2d) from numpy import random arr = random.randn(100,100) ...
from numba import double from numba.decorators import jit as jit def sum2d(arr): M, N = arr.shape result = 0.0 for i in range(M): for j in range(N): result += arr[i,j] return result csum2d = jit(restype=double, argtypes=[double[:,:]])(sum2d) from numpy import random arr = random.r...
Update type specification in example
Update type specification in example
Python
bsd-2-clause
stonebig/numba,seibert/numba,seibert/numba,stefanseefeld/numba,jriehl/numba,ssarangi/numba,IntelLabs/numba,GaZ3ll3/numba,pombredanne/numba,stuartarchibald/numba,gdementen/numba,numba/numba,IntelLabs/numba,stuartarchibald/numba,pitrou/numba,gdementen/numba,cpcloud/numba,stefanseefeld/numba,GaZ3ll3/numba,cpcloud/numba,ss...
bf8ddb49a1043f399a210e05e66e2db4d815cc22
tests/test_build_chess.py
tests/test_build_chess.py
# -*- coding: utf-8 -*- from app.chess.chess import Chess import unittest class TestBuildChess(unittest.TestCase): """ `TestBuildChess()` class is unit-testing the class Chess(). """ # /////////////////////////////////////////////////// def setUp(self): params = [4, 4] piece...
# -*- coding: utf-8 -*- from chess.chess import Chess import unittest class TestBuildChess(unittest.TestCase): """ `TestBuildChess()` class is unit-testing the class Chess(). """ # /////////////////////////////////////////////////// def setUp(self): params = [4, 4] ...
Add a TDD function ( queens on chess board)
Add a TDD function ( queens on chess board)
Python
mit
aymguesmi/ChessChallenge
d97d9294bf470c6e95958b0dc51391830c56a7b3
thinglang/parser/values/inline_code.py
thinglang/parser/values/inline_code.py
from thinglang.lexer.lexical_token import LexicalToken from thinglang.utils.type_descriptors import ValueType class InlineCode(LexicalToken, ValueType): """ Represents inline C++ code """ STATIC = True def __init__(self, value, source_ref): super(InlineCode, self).__init__(value, source_...
from thinglang.lexer.lexical_token import LexicalToken from thinglang.utils.type_descriptors import ValueType class InlineCode(LexicalToken, ValueType): """ Represents inline C++ code """ STATIC = True def __init__(self, value, source_ref): super(InlineCode, self).__init__(value, source_...
Allow inline code to be transpiled
Allow inline code to be transpiled
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
a775cd66de2bbc2e176f946e93fe9c0636cf7115
documents/views/utils.py
documents/views/utils.py
from django.http import HttpResponse def render_to_mimetype_response(mimetype, filename, outputFile): response = HttpResponse(mimetype=mimetype) response['Content-Disposition'] = "attachment; filename=\"%s\"" % (filename) f = open(outputFile) try: content = f.read() response.write(cont...
from django.http import HttpResponse import os def render_to_mimetype_response(mimetype, filename, outputFile): response = HttpResponse(mimetype=mimetype) response['Content-Disposition'] = "attachment; filename=\"%s\"" % (filename) f = open(outputFile) try: content = f.read() response....
Remove temporary files after delivering them
Remove temporary files after delivering them
Python
agpl-3.0
sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer
905a2b0ebc2a7e825f93fe1411dc598524dfd843
examples/hello/server.py
examples/hello/server.py
import os import avro.protocol import tornado.web import tornado.ioloop import tornavro.server import tornavro.responder class HelloResponder(tornavro.responder.Responder): def hello(self, name): return 'Hello, %s' % name proto = open(os.path.join(os.path.dirname(__file__), 'hello.avpr')).read() proto...
import os import avro.protocol import tornado.web import tornado.ioloop from tornado.options import define, options import tornavro.server import tornavro.responder define('port', default=8888, help='Listen on this port') class HelloResponder(tornavro.responder.Responder): def hello(self, name): retur...
Make the hello protocol example more user-friendly
Make the hello protocol example more user-friendly
Python
mit
richid/tornavro
33e40319b5d670c3fa1a1423bf7eed1865115d5c
sitetools/venv_hook/sitecustomize.py
sitetools/venv_hook/sitecustomize.py
""" This file serves as a hook into virtualenvs that do NOT have sitetools installed. It is added to the $PYTHONPATH by the `dev` command so that new virtualenvs can refer to the sitetools from the old virtualenv. It tries to play nice by looking for the next sitecustomize module. """ import imp import os import sy...
""" This file serves as a hook into virtualenvs that do NOT have sitetools installed. It is added to the $PYTHONPATH by the `dev` command so that new virtualenvs can refer to the sitetools from the old virtualenv. It tries to play nice by looking for the next sitecustomize module. """ import imp import os import sy...
Adjust venv_hook to work in new location
Adjust venv_hook to work in new location
Python
bsd-3-clause
westernx/sitetools,westernx/sitetools,mikeboers/sitetools
b9eb6ac32a12ef912edc237409c0433cd139aaf6
tapioca_harvest/tapioca_harvest.py
tapioca_harvest/tapioca_harvest.py
# coding: utf-8 from tapioca import ( TapiocaAdapter, generate_wrapper_from_adapter, JSONAdapterMixin) from requests.auth import HTTPBasicAuth from .resource_mapping import RESOURCE_MAPPING class HarvestClientAdapter(JSONAdapterMixin, TapiocaAdapter): resource_mapping = RESOURCE_MAPPING def get_reque...
# coding: utf-8 from tapioca import ( TapiocaAdapter, generate_wrapper_from_adapter, JSONAdapterMixin) from requests.auth import HTTPBasicAuth from .resource_mapping import RESOURCE_MAPPING class HarvestClientAdapter(JSONAdapterMixin, TapiocaAdapter): resource_mapping = RESOURCE_MAPPING api_root = 'ht...
Change auth method from password to token on adapter
Change auth method from password to token on adapter
Python
mit
vintasoftware/tapioca-harvest
1ad4dba5d2dcfdfc9062f334204bd75b789b3ba6
webapp/calendars/forms.py
webapp/calendars/forms.py
from django import forms from django.contrib.admin import widgets from datetimewidget.widgets import DateTimeWidget from .models import Event class LoginForm(forms.Form): username = forms.CharField(label='Nazwa użytkownika') password = forms.CharField(label='Hasło', widget=forms.PasswordInput()) data_time_o...
from django import forms from django.contrib.admin import widgets from datetimewidget.widgets import DateTimeWidget from .models import Event class LoginForm(forms.Form): username = forms.CharField(label='Nazwa użytkownika') password = forms.CharField(label='Hasło', widget=forms.PasswordInput()) data_time_o...
Change fields order and add field url.
Change fields order and add field url. Signed-off-by: Mariusz Fik <e22610367d206dca7aa58af34ebf008b556228c5@fidano.pl>
Python
agpl-3.0
Fisiu/calendar-oswiecim,hackerspace-silesia/calendar-oswiecim,firemark/calendar-oswiecim,Fisiu/calendar-oswiecim,Fisiu/calendar-oswiecim,hackerspace-silesia/calendar-oswiecim,firemark/calendar-oswiecim,hackerspace-silesia/calendar-oswiecim,firemark/calendar-oswiecim
67d7ce2d9e8ffe26f5f5a97aca9cfb99c8914f3e
us_ignite/common/tests/utils.py
us_ignite/common/tests/utils.py
from django.core.urlresolvers import reverse def get_login_url(url): """Returns an expected login URL.""" return ('%s?next=%s' % (reverse('auth_login'), url))
from django.core.urlresolvers import reverse from django.contrib.messages.storage.base import BaseStorage, Message def get_login_url(url): """Returns an expected login URL.""" return ('%s?next=%s' % (reverse('auth_login'), url)) class TestMessagesBackend(BaseStorage): def __init__(self, request, *args, ...
Add ``TestMessagesBackend`` for testing ``django.contrib.messages``.
Add ``TestMessagesBackend`` for testing ``django.contrib.messages``. When unit testing a django view the ``messages`` middleware will be missing. This backend will provision a simple messaging midleware. Usage:: from django.test import client from us_ignite.common.tests import utils factory = client.Req...
Python
bsd-3-clause
us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite
1104ef0db6b174c64aa9ddad4df10a790fda13cf
grammpy/StringGrammar.py
grammpy/StringGrammar.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from .RawGrammar import RawGrammar as Grammar class StringGrammar(Grammar): @staticmethod def __to_string_arr(t): if isinstance(t, str): return [t] retu...
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from .RawGrammar import RawGrammar as Grammar class StringGrammar(Grammar): @staticmethod def __to_string_arr(t): if isinstance(t, str): return [t] retu...
Fix return of Terminal instance when term method accept string
Fix return of Terminal instance when term method accept string
Python
mit
PatrikValkovic/grammpy
257315a2e0b3f23db36bb97813849d5cf425f81f
murano_tempest_tests/tests/api/service_broker/test_service_broker_negative.py
murano_tempest_tests/tests/api/service_broker/test_service_broker_negative.py
# Copyright (c) 2015 Mirantis, 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 requir...
# Copyright (c) 2015 Mirantis, 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 requir...
Adjust '410 Gone' exception in service broker negative tests
Adjust '410 Gone' exception in service broker negative tests Tempest-lib 0.12.0 contains necessary code for checking correct exception. This patch replaces 'UnexpectedResponceCode' exception to correct 'Gone' exception. Aslo, this patch add expectedFail for negative test. Change-Id: Ib460b6fc495060a1bd6dd7d0443ff983...
Python
apache-2.0
openstack/murano,satish-avninetworks/murano,olivierlemasle/murano,NeCTAR-RC/murano,satish-avninetworks/murano,olivierlemasle/murano,satish-avninetworks/murano,NeCTAR-RC/murano,NeCTAR-RC/murano,NeCTAR-RC/murano,DavidPurcell/murano_temp,DavidPurcell/murano_temp,satish-avninetworks/murano,openstack/murano,olivierlemasle/m...
99f61b183da7fb1f7e22377e0347418a852846e3
dyfunconn/fc/crosscorr.py
dyfunconn/fc/crosscorr.py
# -*- coding: utf-8 -*- """ Cross Correlation see @https://docs.scipy.org/doc/numpy/reference/generated/numpy.correlate.html """ # Author: Avraam Marimpis <avraam.marimpis@gmail.com> from .estimator import Estimator from ..analytic_signal import analytic_signal import numpy as np def crosscorr(data, fb, fs, pair...
# -*- coding: utf-8 -*- """ Cross Correlation see @https://docs.scipy.org/doc/numpy/reference/generated/numpy.correlate.html """ # Author: Avraam Marimpis <avraam.marimpis@gmail.com> from .estimator import Estimator from ..analytic_signal import analytic_signal import numpy as np def crosscorr(data, fb, fs, pair...
Fix the order of the returned values from `analytic_signal`.
Fix the order of the returned values from `analytic_signal`.
Python
bsd-3-clause
makism/dyfunconn
74dfabb565dbd6581a300091c045067d0398e899
source/jormungandr/jormungandr/interfaces/v1/Coverage.py
source/jormungandr/jormungandr/interfaces/v1/Coverage.py
# coding=utf-8 from flask.ext.restful import Resource, fields, marshal_with from jormungandr import i_manager from make_links import add_coverage_link, add_collection_links, clean_links from converters_collection_type import collections_to_resource_type from collections import OrderedDict region_fields = { "id": ...
# coding=utf-8 from flask.ext.restful import Resource, fields, marshal_with from jormungandr import i_manager from make_links import add_coverage_link, add_coverage_link, add_collection_links, clean_links from converters_collection_type import collections_to_resource_type from collections import OrderedDict from fields...
Add error field to region
Jormungandr: Add error field to region
Python
agpl-3.0
VincentCATILLON/navitia,prhod/navitia,xlqian/navitia,prhod/navitia,prhod/navitia,xlqian/navitia,ballouche/navitia,is06/navitia,pbougue/navitia,ballouche/navitia,kadhikari/navitia,CanalTP/navitia,VincentCATILLON/navitia,frodrigo/navitia,CanalTP/navitia,pbougue/navitia,francois-vincent/navitia,TeXitoi/navitia,kinnou02/na...
b700e40f65953ea0c87666d38d53e968581611e1
auditlog_tests/urls.py
auditlog_tests/urls.py
import django from django.conf.urls import include, url from django.contrib import admin if django.VERSION < (1, 9): admin_urls = include(admin.site.urls) else: admin_urls = admin.site.urls urlpatterns = [ url(r'^admin/', admin_urls), ]
from django.urls import path from django.contrib import admin urlpatterns = [ path("admin/", admin.site.urls), ]
Remove old django related codes.
Remove old django related codes.
Python
mit
jjkester/django-auditlog
bd878da54d9816779303a0e7ea042c9adaeab993
runserver.py
runserver.py
#!/usr/bin/python from optparse import OptionParser from sys import stderr import pytz from werkzeug import script from werkzeug.script import make_runserver from firmant.wsgi import Application from firmant.utils import mod_to_dict from firmant.utils import get_module parser = OptionParser() parser.add_option('-s', ...
#!/usr/bin/python from wsgiref.simple_server import make_server from optparse import OptionParser from sys import stderr import socket import pytz from firmant.wsgi import Application from firmant.utils import mod_to_dict from firmant.utils import get_module parser = OptionParser() parser.add_option('-s', '--settings...
Revert to old server script (worked better).
Revert to old server script (worked better). The old script did not auto-reload and did display requests made to the server. The werkzeug-based script's auto-reload feature would mess with the import magic that powers plugins.
Python
bsd-3-clause
rescrv/firmant
c91e494f16301789f2ebcc9c245697b379b30eca
irco/explorer/filters.py
irco/explorer/filters.py
import csv import collections from StringIO import StringIO from flask import render_template from jinja2 import Markup def init_app(app): @app.template_filter('format_record') def format_record(record): val = record.unparsed_record_value if 'csv' in record.unparsed_record_format: ...
import csv import collections from StringIO import StringIO from flask import render_template from jinja2 import Markup def init_app(app): @app.template_filter('format_record') def format_record(record): val = record.unparsed_record_value fmt_csv = 'csv' in record.unparsed_record_format ...
Add support to render tsp data in the explorer.
Add support to render tsp data in the explorer.
Python
mit
GaretJax/irco,GaretJax/irco,GaretJax/irco,GaretJax/irco
ecdda95d5d1ed9e3614639c672a860e2467ba3f1
django_project/core/settings/prod_docker.py
django_project/core/settings/prod_docker.py
# noinspection PyUnresolvedReferences from .prod import * # noqa import os print os.environ ALLOWED_HOSTS = ['*'] ADMINS = ( ('Tim Sutton', 'tim@kartoza.com'), ('Ismail Sunni', 'ismail@kartoza.com'), ('Christian Christellis', 'christian@kartoza.com'), ('Akbar Gumbira', 'akbargumbira@gmail.com'),) DA...
# noinspection PyUnresolvedReferences from .prod import * # noqa import os print os.environ ALLOWED_HOSTS = ['*'] ADMINS = ( ('Tim Sutton', 'tim@kartoza.com'), ('Ismail Sunni', 'ismail@kartoza.com'), ('Christian Christellis', 'christian@kartoza.com'), ('Akbar Gumbira', 'akbargumbira@gmail.com'),) DA...
Use InaSAFE in the email subject line rather
Use InaSAFE in the email subject line rather
Python
bsd-2-clause
AIFDR/inasafe-django,timlinux/inasafe-django,AIFDR/inasafe-django,timlinux/inasafe-django,timlinux/inasafe-django,AIFDR/inasafe-django,timlinux/inasafe-django,AIFDR/inasafe-django
2df61655cc99678e7e7db9d0cf1883c702fdc300
python/servo/devenv_commands.py
python/servo/devenv_commands.py
from __future__ import print_function, unicode_literals import json import os import os.path as path import shutil import subprocess import sys import tarfile from time import time import urllib from mach.registrar import Registrar from mach.decorators import ( CommandArgument, CommandProvider, Command, )...
from __future__ import print_function, unicode_literals import json import os import os.path as path import shutil import subprocess import sys import tarfile from time import time import urllib from mach.registrar import Registrar from mach.decorators import ( CommandArgument, CommandProvider, Command, )...
Add a `mach rustc` command
Add a `mach rustc` command
Python
mpl-2.0
youprofit/servo,indykish/servo,evilpie/servo,samfoo/servo,hyowon/servo,Shraddha512/servo,dhananjay92/servo,g-k/servo,aweinstock314/servo,steveklabnik/servo,pyfisch/servo,DominoTree/servo,nerith/servo,WriterOfAlicrow/servo,saratang/servo,CJ8664/servo,nick-thompson/servo,huonw/servo,SimonSapin/servo,tschneidereit/servo,S...
2b2a1848b398e59818ea7d3aa51bf7db6669917c
pytus2000/datadicts/__init__.py
pytus2000/datadicts/__init__.py
"""This subpackage contains all data dictionaries.""" # The Python source code gets auto-generated and this package is intentially empty. from enum import Enum class OrderedEnum(Enum): """An Enum whose members are ordered by their value.""" def __ge__(self, other): if self.__class__ is other.__class_...
"""This subpackage contains all data dictionaries.""" # The Python source code in this package other than this file has been auto-generated. from enum import Enum class OrderedEnum(Enum): """An Enum whose members are ordered by their value.""" def __ge__(self, other): if self.__class__ is other.__cla...
Update comment for auto generated files
Update comment for auto generated files
Python
mit
timtroendle/pytus2000
51d4e250ca8105430bb881338d4e6174c7e0d86b
featureExtractors/Gait.py
featureExtractors/Gait.py
import numpy as np import os from FeatureExtractorAbstract import FeatureExtractorAbstract from helpers.config import PathConfig class Gait(FeatureExtractorAbstract): def getCSVheader(self): return ["gaitPeriod"] def extract(self, experiment, type, indiv): filepath = experiment[2] + os.path....
import numpy as np import os from FeatureExtractorAbstract import FeatureExtractorAbstract from helpers.config import PathConfig class Gait(FeatureExtractorAbstract): def getCSVheader(self): return ["gaitPeriod"] # isValidLine and sameAsFloat have been copied from distanceCalc.py def isValidLin...
Fix for faulty trace files
Fix for faulty trace files
Python
apache-2.0
metamarkovic/dataCollector,metamarkovic/dataCollector,fgolemo/dataCollector,fgolemo/dataCollector
3e42d128cd3139a9e35fec45b6ed3785557784f2
dv/uvm/core_ibex/scripts/build-instr-gen.py
dv/uvm/core_ibex/scripts/build-instr-gen.py
#!/usr/bin/env python3 # Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 import argparse import shutil import sys from scripts_lib import run_one, start_riscv_dv_run_cmd def main() -> int: parser = argparse.Argumen...
#!/usr/bin/env python3 # Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 import argparse import os import shutil import sys from scripts_lib import run_one, start_riscv_dv_run_cmd def main() -> int: parser = argpar...
Write instr-gen build output to a log file, rather than stdout
Write instr-gen build output to a log file, rather than stdout
Python
apache-2.0
lowRISC/ibex,lowRISC/ibex,AmbiML/ibex,AmbiML/ibex,AmbiML/ibex,lowRISC/ibex,AmbiML/ibex,lowRISC/ibex
d5377e06ae059a9d478c3fe06652a353f1a8359c
address_book/address_book.py
address_book/address_book.py
from person import Person __all__ = ['AddressBook'] class AddressBook(object): def __init__(self): self.persons = [] self.groups = [] def add_person(self, person): self.persons.append(person) def add_group(self, group): self.groups.append(group) def __contains__(se...
from group import Group from person import Person __all__ = ['AddressBook'] class AddressBook(object): def __init__(self): self.persons = [] self.groups = [] def add_person(self, person): self.persons.append(person) def add_group(self, group): self.groups.append(group)...
Make it possible to check if some group is in the AddressBook or not
Make it possible to check if some group is in the AddressBook or not
Python
mit
dizpers/python-address-book-assignment
5e0e6d672f5066b9caa2a202fe785cb2cfb1edc7
ai_graph_color/experiment.py
ai_graph_color/experiment.py
import setup from algorithm import LimitedAlgorithm def iterative(algorithms, problem, iteration_func, local_limit, global_limit=None): algorithm_runners = map( lambda m: LimitedAlgorithm( m[0], problem, setup.Evaluation(), m[1] ), algorithms ) iteration_...
import setup from algorithm import LimitedAlgorithm def iterative(algorithms, problem, iteration_func, local_limit, global_limit=None): algorithm_runners = [ LimitedAlgorithm( algorithm, problem, setup.Evaluation(), params ) for algorithm, params in algorithms ...
Make iterative stopping stop if all algorithms complete, use comprehension over map
Make iterative stopping stop if all algorithms complete, use comprehension over map
Python
mit
sagersmith8/ai_graph_coloring,sagersmith8/ai_graph_coloring
250aab8f88cb7c6ef0c99a365a717035ce4f77d6
rsk_mind/datasource/datasource_csv.py
rsk_mind/datasource/datasource_csv.py
import csv from datasource import Datasource from ..dataset import Dataset class CSVDatasource(Datasource): def __init__(self, path, target=None): super(CSVDatasource, self).__init__(path) self.target = target def read(self): with open(self.path, 'rb') as infile: reader = ...
import csv from datasource import Datasource from ..dataset import Dataset class CSVDatasource(Datasource): def __init__(self, path, target=None): super(CSVDatasource, self).__init__(path) self.target = target def read(self): with open(self.path, 'rb') as infile: reader = ...
Add exception when class not found
Add exception when class not found
Python
mit
rsk-mind/rsk-mind-framework
c1e1c9d63d5334140aa71c025a90e9500b299307
functional_tests.py
functional_tests.py
from selenium import webdriver browser = webdriver.Firefox() browser.get('http://localhost:8000') assert 'Django' in browser.title
from selenium import webdriver import unittest class NewVisitorTest(unittest.TestCase): def setUp(self): self.browser = webdriver.Firefox() def tearDown(self): self.browser.quit() def test_can_start_a_list_and_retrieve_it_later(self): # Rey has heard about a cool new online to-do...
Update tests to be human-readable
Update tests to be human-readable
Python
apache-2.0
rocity/the-testing-goat,rocity/the-testing-goat
2bad8f41c8e64249ae3d1e0d129a41917ec73482
app/test_base.py
app/test_base.py
from flask.ext.testing import TestCase import unittest from app import create_app, db class BaseTestCase(TestCase): def create_app(self): return create_app('config.TestingConfiguration') def setUp(self): db.create_all() def tearDown(self): db.session.remove() db.drop_all()...
from flask.ext.testing import TestCase import unittest from app import create_app, db class BaseTestCase(TestCase): def create_app(self): return create_app('config.TestingConfiguration') def setUp(self): db.create_all() def tearDown(self): db.session.remove() db.drop_all(...
Add default values for login credentials in test base
Add default values for login credentials in test base
Python
mit
rtfoley/scorepy,rtfoley/scorepy,rtfoley/scorepy
0f8263fb264e880bef47ce69d8b42b2bb885a2fd
goose/host_utils.py
goose/host_utils.py
import re class HostUtils(object): @classmethod def host_selectors(self, all_selectors, host): if host is None: return None if host in all_selectors: selectors = all_selectors[host] if type(selectors) is dict: selectors = all_selectors[sele...
import re class HostUtils(object): @classmethod def host_selectors(self, all_selectors, host): if host is None: return None host = host.replace("www.", "") if host in all_selectors: selectors = all_selectors[host] if type(selectors) is dict: ...
Add a workaround for processing rules without www
Add a workaround for processing rules without www
Python
apache-2.0
cronycle/python-goose,cronycle/python-goose,cronycle/python-goose
59bd51f4c809a7f99f186be52c6c9090b613ac42
tests/unit/state_test.py
tests/unit/state_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Nicole Thomas <nicole@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import # Import Salt Testing libs from salttesting import TestCase, skipIf from salttesting.helpers import ensure_in_syspath from salttesting.mock import ( NO_MOCK, ...
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Nicole Thomas <nicole@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import # Import Salt Testing libs from salttesting import TestCase, skipIf from salttesting.helpers import ensure_in_syspath from salttesting.mock import ( NO_MOCK, ...
Update test to correct iteration
Update test to correct iteration
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
70748648bc4e7b050840ed781208ea14d21a735e
dragoman_blog/views.py
dragoman_blog/views.py
from dragoman_blog.models import EntryTranslation from django.views.generic.list import ListView class ListByTagView(ListView): """ View for listing posts by tags""" template_name = "dragoman_blog/entrytranslation_list_by_tag.html" model = EntryTranslation def get_queryset(self): try: ...
from dragoman_blog.models import EntryTranslation from django.views.generic.list import ListView from django.utils.translation import get_language class ListByTagView(ListView): """ View for listing posts by tags""" template_name = "dragoman_blog/entrytranslation_list_by_tag.html" model = EntryTranslatio...
Add filter by language for list by tag.
Add filter by language for list by tag.
Python
bsd-3-clause
fivethreeo/django-dragoman-blog
fca6602f8bb9e7c8f7c036665c035cd58461bf06
catalog/serializers.py
catalog/serializers.py
from catalog.models import Course, Category from rest_framework import serializers from documents.serializers import ShortDocumentSerializer import json class CourseSerializer(serializers.HyperlinkedModelSerializer): meta = serializers.SerializerMethodField() def get_meta(self, course): return json.l...
from catalog.models import Course, Category from rest_framework import serializers from documents.serializers import ShortDocumentSerializer import json class CourseSerializer(serializers.HyperlinkedModelSerializer): meta = serializers.SerializerMethodField() def get_meta(self, course): return json.l...
Add thread_set to course api
Add thread_set to course api
Python
agpl-3.0
UrLab/DocHub,UrLab/beta402,UrLab/beta402,UrLab/DocHub,UrLab/beta402,UrLab/DocHub,UrLab/DocHub
2ba1139fe7994da64eb1bbcf057f7205b35a0fd5
doc/pool_scripts/cats.py
doc/pool_scripts/cats.py
import os import photomosaic.flickr import photomosaic as pm if not os.path.isfile(os.path.expanduser('~/pools/cats/pool.json')): FLICKR_API_KEY = os.environ['FLICKR_API_KEY'] pm.set_options(flickr_api_key=FLICKR_API_KEY) photomosaic.flickr.from_search('cats', '~/pools/cats/') pool = pm.make_pool('~/...
import os import photomosaic.flickr import photomosaic as pm class MissingAPIKey(Exception): ... if not os.path.isfile(os.path.expanduser('~/pools/cats/pool.json')): try: FLICKR_API_KEY = os.environ['FLICKR_API_KEY'] except KeyError: raise MissingAPIKey( "This script requires...
Improve error message if FLICKR_API_KEY is missing
Improve error message if FLICKR_API_KEY is missing
Python
bsd-3-clause
danielballan/photomosaic
a1a426a49511a52f5a40ab07310c1af4197feca2
includes/helpers.py
includes/helpers.py
# Functions that multiple plugins should use def time_string(tdel): if tdel.days > 14: return "{}w ago".format(tdel.days//7) elif tdel.days > 1: return "{}d ago".format(tdel.days) elif tdel.seconds > 7200: return "{}h ago".format((tdel.days*24)+(tdel.seconds//3600)) elif tdel.s...
# Functions that multiple plugins should use def time_string(tdel): if tdel.days > 14: return "{}w ago".format(tdel.days//7) elif tdel.days > 1: return "{}d ago".format(tdel.days) elif tdel.days == 1 or tdel.seconds > 7200: return "{}h ago".format((tdel.days*24)+(tdel.seconds//3600...
Fix for 24-48 hours being incorrectly shown as 0-24 hours.
Fix for 24-48 hours being incorrectly shown as 0-24 hours.
Python
mit
Sulter/MASTERlinker
2e2a00a075c7f59375f90ee8b1416800dddd53d1
integration/main.py
integration/main.py
from spec import skip def simple_command_on_host(): """ Run command on host "localhost" """ skip() Connection('localhost').run('echo foo') # => Result def simple_command_on_multiple_hosts(): """ Run command on localhost...twice! """ skip() Batch(['localhost', 'localhost'])...
from spec import skip, Spec class Main(Spec): def simple_command_on_host(self): """ Run command on host "localhost" """ skip() Connection('localhost').run('echo foo') # => Result def simple_command_on_multiple_hosts(self): """ Run command on loc...
Move towards real spec usage
Move towards real spec usage
Python
bsd-2-clause
fabric/fabric
42f0c76664337af80d692fe7649f3643c237cc47
Tests/MathFunctionsTest.py
Tests/MathFunctionsTest.py
from Math.MathFunctions import * def pointTest(): point1 = (0, 0) point2 = (2, 4) print("Point 1: {}".format(point1)) print("Point 2: {}".format(point2)) print("Point distance: {}".format(pointDistance(point1[0],point1[1],point2[0],point2[1]))) angle = pointAngle(point1[0],point1[1],point2[0],...
from Math.MathFunctions import * import unittest class TestPointMethods(unittest.TestCase): def test_point(self): point1 = (0, 0) point2 = (2, 4) angle = pointAngle(point1[0], point1[1], point2[0], point2[1]) dist = pointDistance(point1[0], point1[1], point2[0], point2[1]) ...
Use python's unit testing framework
Use python's unit testing framework
Python
mit
turtles/PythonScripts
66bc45bb5cd8808bd65c4b796f3ca4d5564cccf8
cell/results.py
cell/results.py
"""cell.result""" from __future__ import absolute_import from __future__ import with_statement from kombu.pools import producers from .exceptions import CellError, NoReplyError __all__ = ['AsyncResult'] class AsyncResult(object): Error = CellError NoReplyError = NoReplyError def __init__(self, ticket...
"""cell.result""" from __future__ import absolute_import from __future__ import with_statement from kombu.pools import producers from .exceptions import CellError, NoReplyError __all__ = ['AsyncResult'] class AsyncResult(object): Error = CellError NoReplyError = NoReplyError def __init__(self, ticket...
Add result property to AsyncResult (it blocks if the result has not been previously retrieved, or return the result otherwise)
Add result property to AsyncResult (it blocks if the result has not been previously retrieved, or return the result otherwise)
Python
bsd-3-clause
celery/cell,celery/cell
20562a167e24911873e83659bccfde94b0a91061
do_the_tests.py
do_the_tests.py
from runtests import Tester import os.path tester = Tester(os.path.abspath(__file__), "fake_spectra") tester.main(sys.argv[1:])
from runtests import Tester import os.path import sys tester = Tester(os.path.abspath(__file__), "fake_spectra") tester.main(sys.argv[1:])
Add import back to test script
Add import back to test script
Python
mit
sbird/fake_spectra,sbird/fake_spectra,sbird/fake_spectra
122b4e6982fe7a74ee668c1b146c32a61c72ec7b
armstrong/hatband/sites.py
armstrong/hatband/sites.py
from django.contrib.admin.sites import AdminSite as DjangoAdminSite from django.contrib.admin.sites import site as django_site class HatbandAndDjangoRegistry(object): def __init__(self, site, default_site=None): if default_site is None: default_site = django_site super(HatbandAndDjango...
from django.contrib.admin.sites import AdminSite as DjangoAdminSite from django.contrib.admin.sites import site as django_site class AdminSite(DjangoAdminSite): def get_urls(self): from django.conf.urls.defaults import patterns, url return patterns('', # Custom hatband Views here ...
Simplify this code and make sure AdminSite doesn't act like a singleton
Simplify this code and make sure AdminSite doesn't act like a singleton Create a faux-singleton for `AdminSite` and make sure it has a copy of all of the previously registered models. This makes `armstrong.hatband.site` look just like `django.contrib.admin.site`.
Python
apache-2.0
texastribune/armstrong.hatband,texastribune/armstrong.hatband,texastribune/armstrong.hatband,armstrong/armstrong.hatband,armstrong/armstrong.hatband,armstrong/armstrong.hatband
ced02ae257246e700caa0da075d86becccc3b5c9
jarn/viewdoc/colors.py
jarn/viewdoc/colors.py
import os import functools import blessed def color(func): functools.wraps(func) def wrapper(string): if os.environ.get('JARN_NO_COLOR') == '1': return string return func(string) return wrapper term = blessed.Terminal() bold = color(term.bold) blue = color(term.bold_blue) gr...
import os import functools import blessed def color(func): assignments = functools.WRAPPER_ASSIGNMENTS if not hasattr(func, '__name__'): assignments = [x for x in assignments if x != '__name__'] @functools.wraps(func, assignments) def wrapper(string): if os.environ.get('JARN_NO_COLOR'...
Fix wrapping in color decorator.
Fix wrapping in color decorator.
Python
bsd-2-clause
Jarn/jarn.viewdoc
8fadb2bb766bd3a18e7920a5dbf23669796330ff
src/mcedit2/rendering/scenegraph/bind_texture.py
src/mcedit2/rendering/scenegraph/bind_texture.py
""" bind_texture """ from __future__ import absolute_import, division, print_function, unicode_literals import logging from OpenGL import GL from mcedit2.rendering.scenegraph import rendernode from mcedit2.rendering.scenegraph.rendernode import RenderstateRenderNode from mcedit2.rendering.scenegraph.scenenode impor...
""" bind_texture """ from __future__ import absolute_import, division, print_function, unicode_literals import logging from OpenGL import GL from mcedit2.rendering.scenegraph import rendernode from mcedit2.rendering.scenegraph.rendernode import RenderstateRenderNode from mcedit2.rendering.scenegraph.scenenode impor...
Change BindTextureRenderNode to make fewer GL calls when the texture scale is None.
Change BindTextureRenderNode to make fewer GL calls when the texture scale is None.
Python
bsd-3-clause
vorburger/mcedit2,vorburger/mcedit2
ec2d3feff6a1677457dfeb5b948b2013bc03df2a
classes/admin.py
classes/admin.py
from django.contrib import admin from classes.models import Attendee from classes.models import Attendance from classes.models import Session from classes.models import WalkinClass class AttendanceInline(admin.TabularInline): model = Attendance extra = 1 verbose_name = 'Attendee' verbose_name_plural ...
from django.contrib import admin from classes.models import Attendee from classes.models import Attendance from classes.models import Session from classes.models import WalkinClass class AttendanceInline(admin.TabularInline): model = Attendance extra = 1 verbose_name = 'Attendee' verbose_name_plural ...
Add sessions inline to classes
Add sessions inline to classes
Python
mit
thrive-refugee/thrive-refugee,thrive-refugee/thrive-refugee,thrive-refugee/thrive-refugee
d8e5545a2397198b0f95854f86a4c4b0e39a42be
newsApp/loggingHelper.py
newsApp/loggingHelper.py
#Initialize the logging. # InitLogging() should be called at the startup of each process in Procfile import logging def InitLogging(): """ Initizalize the logging. """ logging.basicConfig(format='%(module)s:%(levelname)s:%(message)s', level=logging.INFO) # suppress all logs except critical ones ...
#Initialize the logging. # InitLogging() should be called at the startup of each process in Procfile import logging def InitLogging(): """ Initizalize the logging. """ logging.basicConfig(format='%(module)s:%(levelname)s:%(message)s', level=logging.INFO) # suppress all logs except critical ones ...
Hide ignorable error from googleApiClient
Hide ignorable error from googleApiClient
Python
mit
adityabansal/newsAroundMe,adityabansal/newsAroundMe,adityabansal/newsAroundMe
b3c8ffd334df2c7669eb9f3a037ef6fa33fc521b
diylang/interpreter.py
diylang/interpreter.py
# -*- coding: utf-8 -*- from os.path import dirname, join from .evaluator import evaluate from .parser import parse, unparse, parse_multiple from .types import Environment def interpret(source, env=None): """ Interpret a DIY Lang program statement Accepts a program statement as a string, interprets it,...
# -*- coding: utf-8 -*- from .evaluator import evaluate from .parser import parse, unparse, parse_multiple from .types import Environment def interpret(source, env=None): """ Interpret a DIY Lang program statement Accepts a program statement as a string, interprets it, and then returns the resulting...
Remove unused imports in interpeter.
Remove unused imports in interpeter.
Python
bsd-3-clause
codecop/diy-lang,codecop/diy-lang
2d7c481c7c3d01a22759802a701e4c14789935d3
django/__init__.py
django/__init__.py
VERSION = (1, 0, 'post-release-SVN') def get_version(): "Returns the version as a human-format string." v = '.'.join([str(i) for i in VERSION[:-1]]) if VERSION[-1]: from django.utils.version import get_svn_revision v = '%s-%s-%s' % (v, VERSION[-1], get_svn_revision()) return v
VERSION = (1, 1, 0, 'alpha', 0) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: version = '%s %s' % (version, VERSION[3]) if ...
Update django.VERSION in trunk per previous discussion
Update django.VERSION in trunk per previous discussion git-svn-id: 4f9f921b081c523744c7bf24d959a0db39629563@9103 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Python
bsd-3-clause
FlaPer87/django-nonrel,aparo/django-nonrel,FlaPer87/django-nonrel,aparo/django-nonrel,aparo/django-nonrel,FlaPer87/django-nonrel
ab7c07078fb3fa2a5cbeda1ca04ddb91a7fb32a0
oauth_provider/consts.py
oauth_provider/consts.py
from django.utils.translation import ugettext_lazy as _ KEY_SIZE = 16 SECRET_SIZE = 16 VERIFIER_SIZE = 10 CONSUMER_KEY_SIZE = 256 MAX_URL_LENGTH = 2083 # http://www.boutell.com/newfaq/misc/urllength.html PENDING = 1 ACCEPTED = 2 CANCELED = 3 REJECTED = 4 CONSUMER_STATES = ( (PENDING, _('Pending')), (ACCEPTE...
from django.utils.translation import ugettext_lazy as _ from django.conf import settings KEY_SIZE = getattr(settings, 'OAUTH_PROVIDER_KEY_SIZE', 16) SECRET_SIZE = getattr(settings, 'OAUTH_PROVIDER_SECRET_SIZE', 16) VERIFIER_SIZE = getattr(settings, 'OAUTH_PROVIDER_VERIFIER_SIZE', 10) CONSUMER_KEY_SIZE = getattr(settin...
Allow settings to override default lengths.
Allow settings to override default lengths.
Python
bsd-3-clause
lukegb/django-oauth-plus,amrox/django-oauth-plus
4b018935c4729aff0dfcff709331f840dd05e8b6
kimochiconsumer/__init__.py
kimochiconsumer/__init__.py
from pyramid.config import Configurator def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ config = Configurator(settings=settings) config.include('pyramid_mako') config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('home',...
from pyramid.config import Configurator import kimochiconsumer.kimochi def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ def get_kimochi(request): return kimochi.Kimochi(settings['kimochi.url'], settings['kimochi.api_key']...
Add kimochi client to request to make it available to views
Add kimochi client to request to make it available to views
Python
mit
matslindh/kimochi-consumer
ebc5d1024c45a12595507fa1caa0bfc6353a9a32
c2cgeoportal/views/echo.py
c2cgeoportal/views/echo.py
import os.path import re from pyramid.httpexceptions import HTTPBadRequest from pyramid.response import Response from pyramid.view import view_config @view_config(route_name='echo') def echo(request): if request.method != 'POST': raise HTTPBadRequest() try: file = request.POST['file'] exc...
from base64 import b64encode import os.path import re from pyramid.httpexceptions import HTTPBadRequest from pyramid.response import Response from pyramid.view import view_config def base64_encode_chunks(file, chunk_size=57): """ Generate base64 encoded lines of up to 76 (== 57 * 8 / 6) characters, according...
Return a base64 text/html response instead of a binary response
Return a base64 text/html response instead of a binary response
Python
bsd-2-clause
tsauerwein/c2cgeoportal,tsauerwein/c2cgeoportal,tsauerwein/c2cgeoportal,tsauerwein/c2cgeoportal
089af405b331ecfa2cb0cf9a74423c392beea4e4
lazysignup/test_settings.py
lazysignup/test_settings.py
# Settings to be used when running unit tests # python manage.py test --settings=lazysignup.test_settings lazysignup DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = '' # Or path to database file if using sqlite3. DATABASE_USER = '...
# Settings to be used when running unit tests # python manage.py test --settings=lazysignup.test_settings lazysignup DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = '' # Or path to database file if using sqlite3. DATABASE_USER = '...
Remove the now-defunct middleware from the test settings
Remove the now-defunct middleware from the test settings
Python
bsd-3-clause
rwillmer/django-lazysignup,stefanklug/django-lazysignup,rwillmer/django-lazysignup,danfairs/django-lazysignup,danfairs/django-lazysignup,stefanklug/django-lazysignup
fa9fc567e9dcbfa5f301e3c998f87699f9ee11d5
magnumclient/magnum.py
magnumclient/magnum.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 # distributed under the...
# 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 # distributed under the...
Add service API methods to what should be implemented
Add service API methods to what should be implemented Add service API methods
Python
apache-2.0
openstack/python-magnumclient,ramielrowe/python-magnumclient,ramielrowe/python-magnumclient
eace27e618187860564de9501aabcb360112025a
matchmaker/skill.py
matchmaker/skill.py
import datetime from sqlalchemy.sql import func from models import MatchResult, BotSkill, BotRank class SkillUpdater(object): def run(self, db): session = db.session today = datetime.date.today() skills = session.query( MatchResult.bot, func.sum(MatchResult.delta_ch...
import datetime from sqlalchemy.sql import func from models import MatchResult, BotSkill, BotRank, BotIdentity class SkillUpdater(object): def run(self, db): session = db.session today = datetime.date.today() skills = session.query( BotIdentity.id, func.coalesce(fun...
Add bots with no games to the leaderboard
Add bots with no games to the leaderboard
Python
mit
gnmerritt/casino,gnmerritt/casino,gnmerritt/casino,gnmerritt/casino
327b3c12924c14864d0101bb80104db1e975503e
python/pyhit/__init__.py
python/pyhit/__init__.py
import os import sys import subprocess import mooseutils moose_dir = mooseutils.git_root_dir(os.path.dirname(__file__)) status = mooseutils.git_submodule_status(moose_dir) # Use framework/contrib/hit because moosetools submodule is not available if status['moosetools'] == '-': try: from . import hit e...
import os import sys import subprocess import mooseutils moose_dir = mooseutils.git_root_dir(os.path.dirname(__file__)) status = mooseutils.git_submodule_status(moose_dir) # Use framework/contrib/hit because moosetools submodule is not available if status['moosetools'] == '-': hit_dir = os.path.join(moose_dir, 'f...
Add known location for HIT when loading pyhit
Add known location for HIT when loading pyhit (refs #17108)
Python
lgpl-2.1
idaholab/moose,laagesen/moose,SudiptaBiswas/moose,SudiptaBiswas/moose,idaholab/moose,jessecarterMOOSE/moose,andrsd/moose,laagesen/moose,dschwen/moose,milljm/moose,jessecarterMOOSE/moose,sapitts/moose,andrsd/moose,sapitts/moose,SudiptaBiswas/moose,bwspenc/moose,nuclear-wizard/moose,laagesen/moose,nuclear-wizard/moose,ds...
be27ec6d2567b85b94b40c79570ca5d9c20fd0bf
modeltrans/admin.py
modeltrans/admin.py
from .conf import get_default_language from .translator import get_i18n_field from .utils import get_language class ActiveLanguageMixin(object): ''' Hide all translated fields, except: - The field for the default language (settings.LANGUAGE_CODE) - The field for the currently active language. ''...
from .conf import get_default_language from .translator import get_i18n_field from .utils import get_language class ActiveLanguageMixin(object): ''' Add this mixin to your admin class to hide the untranslated field and all translated fields, except: - The field for the default language (settings.LAN...
Improve ActiveLanguageMixin to hide original field
Improve ActiveLanguageMixin to hide original field
Python
bsd-3-clause
zostera/django-modeltrans,zostera/django-modeltrans
c32de922e3e7419d58a8cd7c1a00cf53833c49c7
mpltools/io/core.py
mpltools/io/core.py
import os import matplotlib.pyplot as plt def save_all_figs(directory='./', fmt=None, default_name='untitled%i'): """Save all open figures. Each figure is saved with the title of the plot, if possible. Parameters ------------ directory : str Path where figures are saved. fmt : str, l...
import os import matplotlib.pyplot as plt def save_all_figs(directory='./', fmt='png', default_name='untitled%i'): """Save all open figures. Each figure is saved with the title of the plot, if possible, and multiple file formats can be saved by specifying a list of extensions. Parameters -------...
Simplify handling of image format.
Simplify handling of image format.
Python
bsd-3-clause
matteoicardi/mpltools,tonysyu/mpltools
8c097f07eca52dc37e8d3d4591bb9ee1c05fa310
calexicon/calendars/tests/test_other.py
calexicon/calendars/tests/test_other.py
from datetime import date as vanilla_date from calendar_testing import CalendarTest from calexicon.calendars.other import JulianDayNumber class TestJulianDayNumber(CalendarTest): def setUp(self): self.calendar = JulianDayNumber() def test_make_date(self): vd = vanilla_date(2010, 8, 1) ...
from datetime import date as vanilla_date from calendar_testing import CalendarTest from calexicon.calendars.other import JulianDayNumber class TestJulianDayNumber(CalendarTest): def setUp(self): self.calendar = JulianDayNumber() def test_make_date(self): vd = vanilla_date(2010, 8, 1) ...
Add a new test - on date to day number conversion.
Add a new test - on date to day number conversion.
Python
apache-2.0
jwg4/qual,jwg4/calexicon
5161d6c0023151d39fb56a85f739063205e676f4
nova/api/manager.py
nova/api/manager.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
Initialize iptables rules on initialization of MetadataManager
Initialize iptables rules on initialization of MetadataManager To avoid multiple initialization of iptables rules if there are a few workers for metadata service, perform iptables configuration in __init__() of MetadataManager. Change-Id: I674c04f973318f06cbb98693f0a884c824af8748 Closes-Bug: #1097999
Python
apache-2.0
noironetworks/nova,orbitfp7/nova,eayunstack/nova,badock/nova,JioCloud/nova,CEG-FYP-OpenStack/scheduler,badock/nova,mikalstill/nova,gooddata/openstack-nova,LoHChina/nova,rahulunair/nova,jeffrey4l/nova,shahar-stratoscale/nova,vmturbo/nova,scripnichenko/nova,mandeepdhami/nova,cyx1231st/nova,felixma/nova,luogangyi/bcec-nov...
17b184e5c8d41eb083dc6400f6fca2a3eeb8f742
core/admin/mailu/internal/views.py
core/admin/mailu/internal/views.py
from mailu import db, models, app, limiter from mailu.internal import internal, nginx import flask import flask_login @internal.route("/auth/email") @limiter.limit( app.config["AUTH_RATELIMIT"], lambda: flask.request.headers["Client-Ip"] ) def nginx_authentication(): """ Main authentication endpoint for ...
from mailu import db, models, app, limiter from mailu.internal import internal, nginx import flask import flask_login import base64 import urllib @internal.route("/auth/email") @limiter.limit( app.config["AUTH_RATELIMIT"], lambda: flask.request.headers["Client-Ip"] ) def nginx_authentication(): """ Main ...
Implement a basic authentication API
Implement a basic authentication API
Python
mit
kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io
c7c1fa91a0ec213bd648f2f50f95f5652891d3ab
main/readability_graph.py
main/readability_graph.py
import graph from corpus.mysql.reddit import RedditMySQLCorpus import cred if __name__ == '__main__': corpus = RedditMySQLCorpus() corpus.setup(**(cred.kwargs)) result = corpus.run_sql('SELECT ari FROM comment_feature_read', None) print('Got results') values = [ result[i]['ari'] for i in result ]...
import graph from corpus.mysql.reddit import RedditMySQLCorpus import cred if __name__ == '__main__': corpus = RedditMySQLCorpus() corpus.setup(**(cred.kwargs)) result = corpus.run_sql('SELECT * FROM comment_feature_read LIMIT 100', None) print('Got results') values = [ result[i]['ari'] for i in...
Add other statistical measures for graphing
Add other statistical measures for graphing
Python
mit
worldwise001/stylometry
00ee7549c900d8c3bcae94141a8b8c774d943731
examples/new_member.py
examples/new_member.py
import discord class MyClient(discord.Client): async def on_ready(self): print('Logged in as') print(self.user.name) print(self.user.id) print('------') async def on_member_join(self, member): guild = member.guild await guild.default_channel.send('Welcome {0.men...
import discord class MyClient(discord.Client): async def on_ready(self): print('Logged in as') print(self.user.name) print(self.user.id) print('------') async def on_member_join(self, member): guild = member.guild if guild.system_channel is not None: ...
Update new member example to not be broken.
Update new member example to not be broken. Took forever but better late than never.
Python
mit
imayhaveborkedit/discord.py,Harmon758/discord.py,Rapptz/discord.py,Harmon758/discord.py,khazhyk/discord.py,rapptz/discord.py
3588c52060b540f6d3ca791c7309b4e9185a60aa
config.py
config.py
class Config(object): """ Base configuration class. Contains one method that defines the database URI. This class is to be subclassed and its attributes defined therein. """ def __init__(self): self.database_uri() def database_uri(self): if self.DIALECT == 'sqlite': ...
class Config(object): """ Base configuration class. Contains one property that defines the database URI. This class is to be subclassed and its attributes defined therein. """ @property def database_uri(self): return r'sqlite://{name}'.format(name=self.DBNAME) if self.DIALECT == 'sqli...
Replace database_uri method with a property
Replace database_uri method with a property
Python
mit
soccermetrics/marcotti-mls
e3f6b604c90032dc1fb9dcc9838f11aa10498dae
pi_approach/UI/main.py
pi_approach/UI/main.py
# Touchscreen Kivy Interface for Lidar Project from kivy.app import App from kivy.uix.gridlayout import GridLayout from kivy.core.window import Window #Window.clearcolor=(1,1,1,1) class Init_Screen(GridLayout): pass class Main_Screen(GridLayout): angle = 0 def change_value(self, *args): value_slider = self....
# Touchscreen Kivy Interface for Lidar Project import socket from kivy.app import App from kivy.uix.gridlayout import GridLayout from kivy.core.window import Window #Window.clearcolor=(1,1,1,1) class Init_Screen(GridLayout): pass class Main_Screen(GridLayout): angle = 0 def change_value(self, *args): value_...
Create a server class from scratch
Create a server class from scratch
Python
mit
the-raspberry-pi-guy/lidar
512ec31a3c022bc8a31d57bc51e4e6dac29dcf83
src/sentry/web/frontend/organization_api_key_settings.py
src/sentry/web/frontend/organization_api_key_settings.py
from __future__ import absolute_import from django import forms from django.utils.translation import ugettext_lazy as _ from sentry.models import ApiKey, OrganizationMemberType from sentry.web.forms.fields import OriginsField from sentry.web.frontend.base import OrganizationView class ApiKeyForm(forms.ModelForm): ...
from __future__ import absolute_import from django import forms from django.contrib import messages from django.http import HttpResponseRedirect from django.utils.translation import ugettext_lazy as _ from sentry.models import ApiKey, OrganizationMemberType from sentry.web.forms.fields import OriginsField from sentry...
Allow key settings to be saved
Allow key settings to be saved
Python
bsd-3-clause
hongliang5623/sentry,TedaLIEz/sentry,gg7/sentry,ifduyue/sentry,wujuguang/sentry,boneyao/sentry,fuziontech/sentry,fuziontech/sentry,pauloschilling/sentry,mvaled/sentry,JackDanger/sentry,imankulov/sentry,kevinlondon/sentry,kevinlondon/sentry,vperron/sentry,looker/sentry,Natim/sentry,looker/sentry,beeftornado/sentry,Kryz/...
fd4c7e3af81a4a37462dfcd7c3ac4eb43bdafcb2
crmapp/subscribers/models.py
crmapp/subscribers/models.py
from django.db import models from django.contrib.auth.models import User class Subscriber(models.Model): user_rec = models.ForeignKey(User) address_one = models.CharField(max_length=100) address_two = models.CharField(max_length=100, blank=True) city = models.CharField(max_length=50) state = models...
from django.db import models from django.contrib.auth.models import User from django.conf import settings import stripe class Subscriber(models.Model): user_rec = models.ForeignKey(User) address_one = models.CharField(max_length=100) address_two = models.CharField(max_length=100, blank=True) city = m...
Create the Subscriber Form - Part III > Create Stripe Processing Code
Create the Subscriber Form - Part III > Create Stripe Processing Code
Python
mit
deenaariff/Django,tabdon/crmeasyapp,tabdon/crmeasyapp
25a95d34fcfa9447302ec399affdee14e0362cd7
write_graphs.py
write_graphs.py
"""Save graphical representations of all the lyman workflows.""" import os import re from glob import glob from lyman import workflows as wf from nipype import config def main(): config.set('logging', 'workflow_level', 'CRITICAL') # Find the functions that create workflows wf_funcs = [k for k in dir(wf)...
"""Save graphical representations of all the lyman workflows.""" import os import re import sys from glob import glob from lyman import workflows as wf from nipype import config def main(arglist): config.set('logging', 'workflow_level', 'CRITICAL') # Find the functions that create workflows wf_funcs = [...
Allow for writing specific graph images
Allow for writing specific graph images
Python
bsd-3-clause
tuqc/lyman,mwaskom/lyman,kastman/lyman
89971ece16ee1c062a8a54fa5cd83c473628c2ba
pyanyapi/helpers.py
pyanyapi/helpers.py
# coding: utf-8 """ Functions to dynamically attach attributes to classes. Most of parsing result is cached because of immutability of input data. """ class cached_property(object): """ Copied from Django. """ def __init__(self, func): self.func = func def __get__(self, instance, type=Non...
# coding: utf-8 """ Functions to dynamically attach attributes to classes. Most of parsing result is cached because of immutability of input data. """ class cached_property(object): """ Copied from Django. """ def __init__(self, func): self.func = func def __get__(self, instance, type=Non...
Remove unused line from cached_property
Remove unused line from cached_property
Python
mit
gorlemik/pyanyapi,Stranger6667/pyanyapi
fd0c368d6527c1a20e904ff911238d4e75811e4f
pykeg/core/tests.py
pykeg/core/tests.py
"""Builds a test suite for all tests in the 'core' directory. The django-admin command `tests` looks for a tests.py file and expects a suite() routine to return a unittest.TestSuite. """ import unittest import KegbotJsonServer_unittest import kegbot_unittest import models_unittest import StateMachine_unittest import ...
# Copyright 2009 Mike Wakerly <opensource@hoho.com> # # This file is part of the Pykeg package of the Kegbot project. # For more information on Pykeg or Kegbot, see http://kegbot.org/ # # Pykeg is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by...
Update unittest suite for new modules.
Update unittest suite for new modules.
Python
mit
Kegbot/kegbot-server,Kegbot/kegbot-server,Kegbot/kegbot-server,Kegbot/kegbot-server,Kegbot/kegbot-server
3301e7101cb73674047613ef8a20c16cd2d504da
mots_vides/tests/factory.py
mots_vides/tests/factory.py
""" Tests for StopWordFactory """ import os from unittest import TestCase from mots_vides.stop_words import StopWord from mots_vides.factory import StopWordFactory class StopWordFactoryTestCase(TestCase): def setUp(self): self.data_directory = os.path.join( os.path.dirname( ...
""" Tests for StopWordFactory """ import os from unittest import TestCase from mots_vides.stop_words import StopWord from mots_vides.factory import StopWordFactory class StopWordFactoryTestCase(TestCase): def setUp(self): self.data_directory = os.path.join( os.path.dirname( ...
Complete the list of expected tests
Complete the list of expected tests
Python
bsd-3-clause
Fantomas42/mots-vides,Fantomas42/mots-vides
c0d84ec83dcd62f556cbd236abd40d54e15b1008
fabric/__init__.py
fabric/__init__.py
from context_managers import warnings_only from decorators import hosts, roles, runs_once from operations import require, prompt, put, get, run, sudo, local from state import env from utils import abort, warn
from context_managers import warnings_only from decorators import hosts, roles, runs_once from operations import require, prompt, put, get, run, sudo, local from state import env from utils import abort, warn from version import get_version
Update public API to include get_version() so setup.py doesn't die.
Update public API to include get_version() so setup.py doesn't die. Thanks to Curt Micol.
Python
bsd-2-clause
xLegoz/fabric,pashinin/fabric,tekapo/fabric,pgroudas/fabric,bitmonk/fabric,jaraco/fabric,amaniak/fabric,cmattoon/fabric,askulkarni2/fabric,StackStorm/fabric,haridsv/fabric,TarasRudnyk/fabric,ericholscher/fabric,ploxiln/fabric,kxxoling/fabric,fernandezcuesta/fabric,rbramwell/fabric,hrubi/fabric,raimon49/fabric,bspink/fa...
59c9b0a3914920c19c9ccdbf5d77e4ce990d7d58
rdmo/core/models.py
rdmo/core/models.py
from django.db import models from django.utils.timezone import now from django.utils.translation import get_language from django.utils.translation import ugettext_lazy as _ from rdmo.core.utils import get_languages class Model(models.Model): created = models.DateTimeField(editable=False, verbose_name=_('created'...
from django.db import models from django.utils.timezone import now from django.utils.translation import get_language from django.utils.translation import ugettext_lazy as _ from rdmo.core.utils import get_languages class Model(models.Model): created = models.DateTimeField(editable=False, verbose_name=_('created'...
Add value to return if nothing is found
Add value to return if nothing is found
Python
apache-2.0
rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo
91de92361ae02d796da4ef6b58ac8e63ca437614
dataviva/apps/partners/models.py
dataviva/apps/partners/models.py
from dataviva import db class Call(db.Model): __tablename__ = 'partner_call' id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(400)) link = db.Column(db.String(250))
from dataviva import db class Call(db.Model): __tablename__ = 'partner_call' id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(400)) link = db.Column(db.String(250)) active = db.Column(db.Integer)
Add colunm active in calls tables.
Add colunm active in calls tables.
Python
mit
DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site
881d41b2fc465d018a1247419b6a2487c71b88b4
pft/tests/test_basics.py
pft/tests/test_basics.py
"""Basic Unit Tests.""" import unittest from flask import current_app from .. import create_app from ..database import db class BasicsTestCase(unittest.TestCase): """Basic Test Case.""" def setUp(self): """Set up tests.""" self.app = create_app('testing') self.app_context = self.app.a...
"""Basic Unit Tests.""" import pytest from flask import current_app from .. import create_app from ..database import db @pytest.fixture(autouse=True) def initialise_testing_db(): """Create database before testing, delete after.""" app = create_app('testing') app_context = app.app_context() app_context...
Convert basic tests to pytest
Convert basic tests to pytest
Python
unknown
gregcowell/BAM,gregcowell/PFT,gregcowell/PFT,gregcowell/BAM
f2abc1d265d7eed57223a14009900db7e622d7f6
simpleflow/swf/process/worker/dispatch/dynamic_dispatcher.py
simpleflow/swf/process/worker/dispatch/dynamic_dispatcher.py
# -*- coding: utf-8 -*- import importlib from simpleflow.activity import Activity from .exceptions import DispatchError class Dispatcher(object): """ Dispatch by name, like simpleflow.swf.process.worker.dispatch.by_module.ModuleDispatcher but without a hierarchy. """ @staticmethod def dispat...
# -*- coding: utf-8 -*- import importlib from simpleflow.activity import Activity from .exceptions import DispatchError class Dispatcher(object): """ Dispatch by name, like simpleflow.swf.process.worker.dispatch.by_module.ModuleDispatcher but without a hierarchy. """ @staticmethod def dispat...
Improve error message on DispatchError's
Improve error message on DispatchError's
Python
mit
botify-labs/simpleflow,botify-labs/simpleflow
b4207380bc5b8639397e3d1d9a4b70069ef8d6e7
hydrachain/__init__.py
hydrachain/__init__.py
# -*- coding: utf-8 -*- # ############# version ################## from pkg_resources import get_distribution, DistributionNotFound import os.path import subprocess import re GIT_DESCRIBE_RE = re.compile('^(?P<version>v\d+\.\d+\.\d+)-(?P<git>\d+-g[a-fA-F0-9]+(?:-dirty)?)$') __version__ = None try: _dist = get_d...
# -*- coding: utf-8 -*- # ############# version ################## from pkg_resources import get_distribution, DistributionNotFound import os.path import subprocess import re GIT_DESCRIBE_RE = re.compile('^(?P<version>v\d+\.\d+\.\d+)-(?P<git>\d+-g[a-fA-F0-9]+(?:-dirty)?)$') __version__ = None try: _dist = get_d...
Allow version parsing code to use non-annotated tags
Allow version parsing code to use non-annotated tags
Python
mit
HydraChain/hydrachain,wangkangda/hydrachain,HydraChain/hydrachain,wangkangda/hydrachain
0483563fd08063e856915099075b203379e61e7c
bejmy/categories/admin.py
bejmy/categories/admin.py
from django.contrib import admin from bejmy.categories.models import Category @admin.register(Category) class CategoryAdmin(admin.ModelAdmin): list_display = ( 'name', 'user', 'transaction_type', ) list_filter = ( 'user', 'transaction_type', ) search_fields...
from django.contrib import admin from bejmy.categories.models import Category from mptt.admin import MPTTModelAdmin @admin.register(Category) class CategoryAdmin(MPTTModelAdmin): list_display = ( 'name', 'user', 'transaction_type', ) list_filter = ( 'user', 'trans...
Access to all accounts only for superusers
Access to all accounts only for superusers
Python
mit
bejmy/backend,bejmy/backend
c0c7222f4ab1c39dadd78c9bde40d882780ce741
benchexec/tools/legion.py
benchexec/tools/legion.py
""" BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2007-2015 Dirk Beyer 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 ...
""" BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2007-2015 Dirk Beyer 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 ...
Add some files to Legion
Add some files to Legion
Python
apache-2.0
ultimate-pa/benchexec,dbeyer/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,sosy-lab/benchexec,dbeyer/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec
4636fc514b0ebf7b16e82cc3eb7de6b69431cd43
site_analytics.py
site_analytics.py
#!/usr/local/bin/python3.6 # read nginx access log # parse and get the ip addresses and times # match ip addresses to geoip # possibly ignore bots import re def get_log_lines(path): """Return a list of regex matched log lines from the passed nginx access log path""" lines = [] with open(path) as f: r = re...
#!/usr/local/bin/python3.6 # read nginx access log # parse and get the ip addresses and times # match ip addresses to geoip # possibly ignore bots import re def get_log_lines(path): """Return a list of regex matched log lines from the passed nginx access log path""" lines = [] with open(path) as f: ...
Fix tab spacing from 2 to 4 spaces
Fix tab spacing from 2 to 4 spaces
Python
mit
mouhtasi/basic_site_analytics
2264e4195e873760b922e6d346eb56d8e1ec6e09
examples/marshmallow/main.py
examples/marshmallow/main.py
import uplink # Local imports import github BASE_URL = "https://api.github.com/" if __name__ == "__main__": # Create a client that uses the marshmallow converter gh = github.GitHub( base_url=BASE_URL, converter=uplink.MarshmallowConverter() ) # Get all public repositories repos = gh.get_...
# Standard library imports from pprint import pformat # Local imports import github BASE_URL = "https://api.github.com/" if __name__ == "__main__": # Create a GitHub API client gh = github.GitHub(base_url=BASE_URL) # Get all public repositories repos = gh.get_repos() # Shorten to first 10 res...
Remove needless creation of MarshmallowConverter
Remove needless creation of MarshmallowConverter
Python
mit
prkumar/uplink
4a7ef27e895ec0f22890062931a2ed68f17a1398
BadTranslator.py
BadTranslator.py
from translate import Translator translator= Translator(to_lang="ru") translation = translator.translate("Hello, world!") print translation
from translate import Translator import random langs = ["af", "ach", "ak", "am", "ar", "az", "be", "bem", "bg", "bh", "bn", "br", "bs", "ca", "chr", "ckb", "co", "crs", "cs", "cy", "da", "de", "ee", "el", "en", "eo", "es", "es-419", "et", "eu", "fa", "fi", "fo", "fr", "fy", "ga", "gaa", "gd", "gl", "gn", "gu", "ha", "h...
Add langs list, add random lang
Add langs list, add random lang Add langs list that includes all supported google translate languages. Add random language selector.
Python
mit
powderblock/PyBad-Translator
ed36889bbac47015722d50e0253f72a609203c5e
cellardoor/serializers/msgpack_serializer.py
cellardoor/serializers/msgpack_serializer.py
import msgpack from datetime import datetime from . import Serializer def default_handler(obj): try: iterable = iter(obj) except TypeError: pass else: return list(iterable) if isinstance(obj, datetime): return obj.isoformat() raise ValueError, "Can't pack object of type %s" % type(obj).__name__ c...
import msgpack from datetime import datetime import collections from . import Serializer def default_handler(obj): if isinstance(obj, collections.Iterable): return list(obj) if isinstance(obj, datetime): return obj.isoformat() raise ValueError, "Can't pack object of type %s" % type(obj).__name__ class ...
Use more reliable method of detecting iterables in msgpack serializer
Use more reliable method of detecting iterables in msgpack serializer
Python
mit
cooper-software/cellardoor
b4fdec74ac1af2b50ab5c79f6127d87033a9d297
wagtail/wagtailsearch/signal_handlers.py
wagtail/wagtailsearch/signal_handlers.py
from django.db.models.signals import post_save, post_delete from django.db import models from wagtail.wagtailsearch.index import Indexed from wagtail.wagtailsearch.backends import get_search_backends def post_save_signal_handler(instance, **kwargs): for backend in get_search_backends(): backend.add(insta...
from django.db.models.signals import post_save, post_delete from django.db import models from wagtail.wagtailsearch.index import Indexed from wagtail.wagtailsearch.backends import get_search_backends def post_save_signal_handler(instance, **kwargs): if instance not in type(instance).get_indexed_objects(): ...
Make search signal handlers use get_indexed_objects
Make search signal handlers use get_indexed_objects
Python
bsd-3-clause
rv816/wagtail,serzans/wagtail,serzans/wagtail,FlipperPA/wagtail,iansprice/wagtail,nrsimha/wagtail,Toshakins/wagtail,kurtrwall/wagtail,jorge-marques/wagtail,stevenewey/wagtail,darith27/wagtail,kaedroho/wagtail,iho/wagtail,WQuanfeng/wagtail,nealtodd/wagtail,quru/wagtail,mikedingjan/wagtail,timorieber/wagtail,timorieber/w...
87707340ac82f852937dae546380b5d5327f5bc7
txlege84/core/views.py
txlege84/core/views.py
from django.views.generic import ListView from bills.mixins import AllSubjectsMixin from core.mixins import ConveneTimeMixin from legislators.mixins import AllLegislatorsMixin, ChambersMixin from explainers.models import Explainer from topics.models import Topic class LandingView(AllSubjectsMixin, AllLegislatorsMix...
from django.views.generic import ListView from core.mixins import ConveneTimeMixin from explainers.models import Explainer from topics.models import Topic class LandingView(ConveneTimeMixin, ListView): model = Topic template_name = 'landing.html' def get_context_data(self, **kwargs): context = ...
Remove unneeded mixins from LandingView
Remove unneeded mixins from LandingView
Python
mit
texastribune/txlege84,texastribune/txlege84,texastribune/txlege84,texastribune/txlege84
47d507bdc4dc0ecd54e9956a40741f3b75664ab2
events/models.py
events/models.py
from django.db import models # Create your models here. class Calendar(models.Model): name = models.CharField(max_length=30, unique=True) remote_id = models.CharField(max_length=60) css_class = models.CharField(max_length=10) def __str__(self): return self.name
from django.db import models # Create your models here. class Calendar(models.Model): name = models.CharField(max_length=30, unique=True) remote_id = models.CharField(max_length=60) css_class = models.CharField(max_length=10) def __str__(self): return self.name class Meta: orderin...
Set default ordering of Calendars
Set default ordering of Calendars
Python
mit
Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters,Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano
4c69a59f99fd5f425c31e3fdcbf6e3f78d82d9e4
vex_via_wrapper.py
vex_via_wrapper.py
import requests MATCH_LIST_URL = "http://data.vexvia.dwabtech.net/mobile/events/csv" DIVISION_URL = "http://data.vexvia.dwabtech.net/mobile/{}/divisions/csv" MATCH_URL = "http://data.vexvia.dwabtech.net/mobile/{}/{}/matches/csv" def get_events(iq=False): data = requests.get(MATCH_LIST_URL).text.split("\r\n")[1:-1...
import requests MATCH_LIST_URL = "http://data.vexvia.dwabtech.net/mobile/events/csv" DIVISION_URL = "http://data.vexvia.dwabtech.net/mobile/{}/divisions/csv" MATCH_URL = "http://data.vexvia.dwabtech.net/mobile/{}/{}/matches/csv" def get_events(is_iq: bool=False) -> list: """Get a list of iq events or edr events. ...
Add comments to vex via wrapper
Add comments to vex via wrapper
Python
mit
DLProgram/Project_Snake_Sort,DLProgram/Project_Snake_Sort
f9d17e97115d914c9ed231630d01a6d724378f15
zou/app/blueprints/source/csv/persons.py
zou/app/blueprints/source/csv/persons.py
from zou.app.blueprints.source.csv.base import BaseCsvImportResource from zou.app.models.person import Person from zou.app.utils import auth, permissions from sqlalchemy.exc import IntegrityError class PersonsCsvImportResource(BaseCsvImportResource): def check_permissions(self): return permissions.chec...
from zou.app.blueprints.source.csv.base import BaseCsvImportResource from zou.app.models.person import Person from zou.app.utils import auth, permissions from sqlalchemy.exc import IntegrityError class PersonsCsvImportResource(BaseCsvImportResource): def check_permissions(self): return permissions.chec...
Allow to import roles when importing people
Allow to import roles when importing people
Python
agpl-3.0
cgwire/zou
6a71271ed00ba164cf2755f728f0dbf2ed310f6b
zsi/setup.py
zsi/setup.py
#! /usr/bin/env python # $Header$ import sys from distutils.core import setup _url = "http://www.zolera.com/resources/opensrc/zsi" import ConfigParser cf = ConfigParser.ConfigParser() cf.read('setup.cfg') _version = "%d.%d" % \ ( cf.getint('version', 'major'), cf.getint('version', 'minor') ) try: open('ZSI/v...
#! /usr/bin/env python # $Header$ import sys from distutils.core import setup _url = "http://pywebsvcs.sf.net/" import ConfigParser cf = ConfigParser.ConfigParser() cf.read('setup.cfg') _version = "%d.%d" % \ ( cf.getint('version', 'major'), cf.getint('version', 'minor') ) try: open('ZSI/version.py', 'r').cl...
Change URL from Zolera (sob, snif, sigh :) to SF
Change URL from Zolera (sob, snif, sigh :) to SF git-svn-id: c4afb4e777bcbfe9afa898413b708b5abcd43877@123 7150bf37-e60d-0410-b93f-83e91ef0e581
Python
mit
acigna/pywez,acigna/pywez,acigna/pywez
960436b17211a225a729805a528653f2aff675d7
src/sentry/utils/social_auth.py
src/sentry/utils/social_auth.py
""" sentry.utils.social_auth ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from django.conf import settings from social_auth.backends.pipeline.user import create_user from so...
""" sentry.utils.social_auth ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from django.conf import settings from social_auth.backends.pipeline.user import create_user from so...
Call to create_user fails because django-social-auth module requires 5 parameters now for create_user now.
Call to create_user fails because django-social-auth module requires 5 parameters now for create_user now. The exception is quietly suppressed in social_auth/backends/__init__.py:143 in the pipeline stage for this module since TypeErrors in general are try/except in the authenticate() stage. It can be repro'd by putt...
Python
bsd-3-clause
BuildingLink/sentry,gg7/sentry,kevinlondon/sentry,zenefits/sentry,ewdurbin/sentry,daevaorn/sentry,looker/sentry,zenefits/sentry,BuildingLink/sentry,1tush/sentry,wujuguang/sentry,ewdurbin/sentry,rdio/sentry,pauloschilling/sentry,songyi199111/sentry,argonemyth/sentry,wong2/sentry,jokey2k/sentry,zenefits/sentry,beeftornad...
b6941b35f5bb20dbc2c7e05bbf6100bf0879be3f
foyer/tests/test_plugin.py
foyer/tests/test_plugin.py
import pytest def test_basic_import(): import foyer assert 'forcefields' in dir(foyer) import foyer.forcefields.forcefields
import pytest import foyer def test_basic_import(): assert 'forcefields' in dir(foyer) @pytest.mark.parametrize('ff_name', ['OPLSAA', 'TRAPPE_UA']) def test_forcefields_exist(ff_name): ff_name in dir(foyer.forcefields) def test_load_forcefield(): OPLSAA = foyer.forcefields.get_forcefield(name='oplsaa'...
Update test to check more internals
Update test to check more internals
Python
mit
mosdef-hub/foyer,iModels/foyer,iModels/foyer,mosdef-hub/foyer
ec613fe1df31dd65d8a52351a29482b54ce007b3
skvideo/__init__.py
skvideo/__init__.py
from skvideo.stuff import * from skvideo.version import __version__ # If you want to use Numpy's testing framerwork, use the following. # Tests go under directory tests/, benchmarks under directory benchmarks/ from numpy.testing import Tester test = Tester().test bench = Tester().bench
from skvideo.version import __version__ # If you want to use Numpy's testing framerwork, use the following. # Tests go under directory tests/, benchmarks under directory benchmarks/ from numpy.testing import Tester test = Tester().test bench = Tester().bench
Remove some unused parts of skeleton
Remove some unused parts of skeleton
Python
bsd-3-clause
aizvorski/scikit-video
682010eafe28eed1eeb32ba9d34e213b4f2d7d4b
sourcer/__init__.py
sourcer/__init__.py
from .compiler import ParseResult from .expressions import ( Alt, And, Any, Backtrack, Bind, End, Expect, Fail, ForwardRef, Left, List, Literal, Not, Opt, Or, Require, Return, Right, Some, Start, Struct, Term, Transform, Wh...
from .compiler import ParseResult from .expressions import ( Alt, And, Any, AnyOf, Backtrack, Bind, End, Expect, Fail, ForwardRef, Left, List, Literal, Not, Opt, Or, Require, Return, Right, Some, Start, Struct, Term, Transf...
Add "AnyOf" to public API.
Add "AnyOf" to public API.
Python
mit
jvs/sourcer
74d668cb8291822a167d1ddd0fecf7e580375377
serv/rcompserv/serv.py
serv/rcompserv/serv.py
from aiohttp import web from . import __version__ class Server: def __init__(self, host='127.0.0.1', port=8080): self._host = host self._port = port self.app = web.Application() self.app.router.add_get('/', self.index) self.known_commands = ['version'] self.app.rou...
import uuid from datetime import datetime from aiohttp import web import redis from . import __version__ class Server: def __init__(self, host='127.0.0.1', port=8080): self._host = host self._port = port self.app = web.Application() self.app.on_startup.append(self.start_redis) ...
Add route for `trivial` (vacuous) command
Add route for `trivial` (vacuous) command
Python
bsd-3-clause
slivingston/rcomp,slivingston/rcomp,slivingston/rcomp
c8100c89298091179c9ad7f84452328e28efaa03
crawler/CrawlerExample.py
crawler/CrawlerExample.py
__author__ = 'pascal' from crawler.Crawler import Crawler from utils.path import RessourceUtil # _____ _ # | ____|_ ____ _ _ __ ___ _ __ | | ___ # | _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \ # | |___ > < (_| | | | | | | |_) | | __/ # |_____/_/\_\__,_|_| |_| |_| .__/|_|\___| # ...
__author__ = 'pascal' from crawler.Crawler import Crawler from indexer.indexer import Indexer from utils.path import RessourceUtil # _____ _ # | ____|_ ____ _ _ __ ___ _ __ | | ___ # | _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \ # | |___ > < (_| | | | | | | |_) | | __/ # |_____/_/\_\__,_|_| ...
Add an example for building and printing the index.
Add an example for building and printing the index. You can find the example inside the CrawlerExample.py.
Python
cc0-1.0
pascalweiss/SearchEngine,yveskaufmann/SearchEngine,yveskaufmann/SearchEngine
708b519e066b8d443ed4768293db4517021d68fc
thinglang/__init__.py
thinglang/__init__.py
import os from thinglang import utils from thinglang.execution.execution import ExecutionEngine from thinglang.lexer.lexer import lexer from thinglang.parser.analyzer import Analyzer from thinglang.parser.parser import parse from thinglang.parser.simplifier import Simplifier BASE_DIR = os.path.join(os.path.dirname(os...
import os from thinglang import utils from thinglang.execution.execution import ExecutionEngine from thinglang.lexer.lexer import lexer from thinglang.parser.analyzer import Analyzer from thinglang.parser.parser import parse from thinglang.parser.simplifier import Simplifier BASE_DIR = os.path.join(os.path.dirname(os...
Split compiler and execution steps
Split compiler and execution steps
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang