commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
dbe622d2297d62f61adf34e17de7c84d0cffbeaf
project/project/local_settings_example.py
project/project/local_settings_example.py
DEBUG = True ADMINS = ( ('Zaphod Beeblebrox', 'hoopyfrood@heartofgold.com'), ) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '^lkajsdlfkjaoif09ijoi23092309i02[93ip2j3[r29u3[0923jorij' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'd...
DEBUG = True ADMINS = ( ('Zaphod Beeblebrox', 'hoopyfrood@heartofgold.com'), ) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '^lkajsdlfkjaoif09ijoi23092309i02[93ip2j3[r29u3[0923jorij' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'd...
Add email settings example to localsettings
Add email settings example to localsettings
Python
mit
colbypalmer/cp-project-template,colbypalmer/cp-project-template,colbypalmer/cp-project-template
--- +++ @@ -18,4 +18,10 @@ } } +EMAIL_HOST = '' +EMAIL_HOST_USER = '' +EMAIL_HOST_PASSWORD = '' +EMAIL_PORT = 587 +DEFAULT_FROM_EMAIL = 'My Site Admin <me@myproject.com>' + GOOGLE_ACCOUNT_CODE = "UA-XXXXXXX-XX"
b6f3c619e8c3fa375ac9b66e7ce555c77f02f152
pytest_raisesregexp/plugin.py
pytest_raisesregexp/plugin.py
import re import py.code import pytest def pytest_namespace(): return {'raises_regexp': raises_regexp} class raises_regexp(object): def __init__(self, expected_exception, regexp): self.exception = expected_exception self.regexp = regexp self.excinfo = None def __enter__(self): ...
import re import py.code import pytest def pytest_namespace(): return {'raises_regexp': raises_regexp} class raises_regexp(object): def __init__(self, expected_exception, regexp): self.exception = expected_exception self.regexp = regexp self.excinfo = None def __enter__(self): ...
Add originally raised exception value to pytest error message
Add originally raised exception value to pytest error message
Python
mit
kissgyorgy/pytest-raisesregexp
--- +++ @@ -25,7 +25,7 @@ self.excinfo.__init__((exc_type, exc_val, exc_tb)) if not issubclass(exc_type, self.exception): - pytest.fail('%s RAISED instead of %s' % (exc_type, self.exception)) + pytest.fail('%s RAISED instead of %s\n%s' % (exc_type, self.exception, repr(exc_va...
69cf5602ba9dd9d7e0a89c169682ac72e2e18a67
everywhere/base.py
everywhere/base.py
#!/usr/bin/env python # -*- coding: utf-8 -*- def fib(number: int) -> int: ''' >>> fib(10) 55 ''' if number < 2: return number else: return fib(number-1) + fib(number-2) def hello() -> None: ''' >>> hello() 'Hello World' ''' return 'Hello World' def add4...
#!/usr/bin/env python # -*- coding: utf-8 -*- def fib(number: int) -> int: ''' >>> fib(10) 55 ''' if number < 2: return number else: return fib(number-1) + fib(number-2) def hello() -> str: ''' >>> hello() 'Hello World' ''' return 'Hello World' def add42...
Fix return type of hello
Fix return type of hello
Python
bsd-2-clause
wdv4758h/python-everywhere,wdv4758h/python-everywhere,wdv4758h/python-everywhere
--- +++ @@ -13,7 +13,7 @@ return fib(number-1) + fib(number-2) -def hello() -> None: +def hello() -> str: ''' >>> hello() 'Hello World'
5b8da0d318d7b37b3f1a3d868980507b15aa4213
salt/renderers/json.py
salt/renderers/json.py
from __future__ import absolute_import import json def render(json_data, env='', sls='', **kws): if not isinstance(json_data, basestring): json_data = json_data.read() if json_data.startswith('#!'): json_data = json_data[json_data.find('\n')+1:] return json.loads(json_data)
from __future__ import absolute_import import json def render(json_data, env='', sls='', **kws): if not isinstance(json_data, basestring): json_data = json_data.read() if json_data.startswith('#!'): json_data = json_data[json_data.find('\n')+1:] if not json_data.strip(): return {} ...
Add missed changes for the previous commit.
Add missed changes for the previous commit.
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -7,6 +7,7 @@ if json_data.startswith('#!'): json_data = json_data[json_data.find('\n')+1:] - + if not json_data.strip(): + return {} return json.loads(json_data)
3ad64c06f917efdaa94ad5debc23941f4d95105a
fuzzy_happiness/attributes.py
fuzzy_happiness/attributes.py
#!/usr/bin/python # # Copyright 2013 Rackspace Australia # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
#!/usr/bin/python # # Copyright 2013 Rackspace Australia # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Return table name not model object name.
Return table name not model object name.
Python
apache-2.0
rcbau/fuzzy-happiness
--- +++ @@ -36,10 +36,17 @@ if not issubclass(obj, models.NovaBase): continue - if not hasattr(obj, '__confidential__'): + attrs_missing = [] + for required_attr in ['__tablename__', '__confidential__']: + if not hasattr(obj, required_attr): + att...
dbbd6e1e87964db6b2279a661a63751da31213e5
millipede.py
millipede.py
#!/usr/bin/env python3 class millipede: def __init__(self, size, comment=None): self._millipede = "" if comment: self._millipede = comment + "\n\n" self._millipede += " β•šβŠ™ βŠ™β• \n" padding = 2 direction = -1 while (size): for i in range(0, ...
#!/usr/bin/env python3 class millipede: def __init__(self, size, comment=None, reverse=False): self._padding_offsets = [2, 1, 0, 1, 2, 3, 4, 4, 3] head = " β•”βŠ™ βŠ™β•—\n" if reverse else " β•šβŠ™ βŠ™β•\n" body = "".join([ "{}{}\n".format( " " * self._padding_offsets[...
Rewrite body generation and add reverse option
Rewrite body generation and add reverse option
Python
bsd-3-clause
evadot/millipede-python,getmillipede/millipede-python,moul/millipede-python,EasonYi/millipede-python,EasonYi/millipede-python,evadot/millipede-python,moul/millipede-python,getmillipede/millipede-python
--- +++ @@ -2,26 +2,28 @@ class millipede: - def __init__(self, size, comment=None): + + def __init__(self, size, comment=None, reverse=False): + self._padding_offsets = [2, 1, 0, 1, 2, 3, 4, 4, 3] + + head = " β•”βŠ™ βŠ™β•—\n" if reverse else " β•šβŠ™ βŠ™β•\n" + body = "".join([ + "...
8233abab6084db39df064b87d256fd0caffecb89
simpy/test/test_simulation.py
simpy/test/test_simulation.py
from simpy import Simulation, InterruptedException def test_simple_process(): def pem(ctx, result): while True: result.append(ctx.now) yield ctx.wait(1) result = [] Simulation(pem, result).simulate(until=4) assert result == [0, 1, 2, 3] def test_interrupt(): def p...
from simpy import Simulation, InterruptedException def test_simple_process(): def pem(ctx, result): while True: result.append(ctx.now) yield ctx.wait(1) result = [] Simulation(pem, result).simulate(until=4) assert result == [0, 1, 2, 3] def test_interrupt(): def r...
Define subprocesses in the context of the root process. Maybe this is more readable?
Define subprocesses in the context of the root process. Maybe this is more readable?
Python
mit
Uzere/uSim
--- +++ @@ -12,14 +12,14 @@ assert result == [0, 1, 2, 3] def test_interrupt(): - def pem(ctx): - try: - yield ctx.wait(10) - raise RuntimeError('Expected an interrupt') - except InterruptedException: - pass + def root(ctx): + def pem(ctx): + ...
a51f5e108f6fb81fce5d99b53888f2a2954fb9a6
server_app/__main__.py
server_app/__main__.py
import sys import os import logging import time if not os.path.exists(os.path.expanduser("~/.chatserver")): os.makedirs(os.path.expanduser("~/.chatserver")) logging.basicConfig(filename=os.path.expanduser("~/.chatserver/chat-"+time.strftime("%d-%m-%Y.log"), level=logging.DEBUG)) sys.stderr.close() sys.stdout.clos...
import sys import os import logging import time if not os.path.exists(os.path.expanduser("~/.chatserver")): os.makedirs(os.path.expanduser("~/.chatserver")) logging.basicConfig(filename=os.path.expanduser("~/.chatserver/chat-"+time.strftime("%d-%m-%Y.log")), level=logging.DEBUG) sys.stderr.close() sys.stdout.clos...
Make logger sort by date
Make logger sort by date
Python
bsd-3-clause
jos0003/Chat,jos0003/Chat,jos0003/Chat,jos0003/Chat,jos0003/Chat
--- +++ @@ -5,7 +5,7 @@ if not os.path.exists(os.path.expanduser("~/.chatserver")): os.makedirs(os.path.expanduser("~/.chatserver")) -logging.basicConfig(filename=os.path.expanduser("~/.chatserver/chat-"+time.strftime("%d-%m-%Y.log"), level=logging.DEBUG)) +logging.basicConfig(filename=os.path.expanduser("~/....
1b0edd2eeb722397e9c6c7da04ab6cbd3865a476
reddit_adzerk/adzerkads.py
reddit_adzerk/adzerkads.py
from urllib import quote from pylons import c, g from r2.lib.pages import Ads as BaseAds from r2.models.subreddit import DefaultSR class Ads(BaseAds): def __init__(self): BaseAds.__init__(self) url_key = "adzerk_https_url" if c.secure else "adzerk_url" site_name = getattr(c.site, "analy...
from urllib import quote from pylons import c, g from r2.lib.pages import Ads as BaseAds from r2.models.subreddit import DefaultSR FRONTPAGE_NAME = "-reddit.com" class Ads(BaseAds): def __init__(self): BaseAds.__init__(self) url_key = "adzerk_https_url" if c.secure else "adzerk_url" si...
Move special frontpage name to variable.
Move special frontpage name to variable.
Python
bsd-3-clause
madbook/reddit-plugin-adzerk,madbook/reddit-plugin-adzerk,madbook/reddit-plugin-adzerk
--- +++ @@ -5,6 +5,8 @@ from r2.lib.pages import Ads as BaseAds from r2.models.subreddit import DefaultSR + +FRONTPAGE_NAME = "-reddit.com" class Ads(BaseAds): def __init__(self): @@ -15,7 +17,7 @@ # adzerk reporting is easier when not using a space in the tag if isinstance(c.site, Def...
2cb03ff8c3d21f36b95103eaf9ae0fb3e43077bd
pinax_theme_bootstrap/templatetags/pinax_theme_bootstrap_tags.py
pinax_theme_bootstrap/templatetags/pinax_theme_bootstrap_tags.py
from django import template from django.contrib.messages.utils import get_level_tags LEVEL_TAGS = get_level_tags() register = template.Library() @register.simple_tag() def get_message_tags(message): """ Returns the message's level_tag prefixed with Bootstrap's "alert-" prefix along with any tags includ...
from django import template from django.contrib.messages.utils import get_level_tags from django.utils.encoding import force_text LEVEL_TAGS = get_level_tags() register = template.Library() @register.simple_tag() def get_message_tags(message): """ Returns the message's level_tag prefixed with Bootstrap's "...
Allow for lazy translation of message tags
Allow for lazy translation of message tags
Python
mit
foraliving/foraliving,druss16/danslist,grahamu/pinax-theme-bootstrap,foraliving/foraliving,grahamu/pinax-theme-bootstrap,druss16/danslist,jacobwegner/pinax-theme-bootstrap,jacobwegner/pinax-theme-bootstrap,druss16/danslist,grahamu/pinax-theme-bootstrap,jacobwegner/pinax-theme-bootstrap,foraliving/foraliving
--- +++ @@ -1,5 +1,6 @@ from django import template from django.contrib.messages.utils import get_level_tags +from django.utils.encoding import force_text LEVEL_TAGS = get_level_tags() @@ -15,14 +16,15 @@ Messages in Django >= 1.7 have a message.level_tag attr """ - level_tag = LEVEL_TAGS[messag...
d20f9d5e56c4f430f6ca7b4ab03a279e34bbbd45
importer/tasks.py
importer/tasks.py
from .models import FileImport from .importers import ImportFailure from django.db import transaction import celery assuming_failure_message = '{0} did not return True. Assuming failure.' processing_status = 'processing' processing_description = 'Processing the data in {filename}.' success_status = 'success' succ...
from .models import FileImport from .importers import ImportFailure from django.db import transaction import celery assuming_failure_message = '{0} did not return True. Assuming failure.' processing_status = 'processing' processing_description = 'Processing the data in {filename}.' success_status = 'success' succ...
Use shared_task instead of task.
Use shared_task instead of task.
Python
mit
monokrome/django-drift
--- +++ @@ -19,7 +19,7 @@ failure_status = 'failure' -@celery.task +@celery.shared_task @transaction.atomic def importer_asynchronous_task(import_pk, *args, **kwargs): logger = importer_asynchronous_task.get_logger()
3973e0d2591b2554e96da0a22b2d723a71d2423e
imgaug/augmenters/__init__.py
imgaug/augmenters/__init__.py
from __future__ import absolute_import from imgaug.augmenters.arithmetic import * from imgaug.augmenters.blur import * from imgaug.augmenters.color import * from imgaug.augmenters.contrast import GammaContrast, SigmoidContrast, LogContrast, LinearContrast from imgaug.augmenters.convolutional import * from imgaug.augmen...
from __future__ import absolute_import from imgaug.augmenters.arithmetic import * from imgaug.augmenters.blur import * from imgaug.augmenters.color import * from imgaug.augmenters.contrast import * from imgaug.augmenters.convolutional import * from imgaug.augmenters.flip import * from imgaug.augmenters.geometric import...
Switch import from contrast to all
Switch import from contrast to all Change import from contrast.py in augmenters/__init__.py to * instead of selective, as * should not import private methods anyways.
Python
mit
aleju/ImageAugmenter,aleju/imgaug,aleju/imgaug
--- +++ @@ -2,7 +2,7 @@ from imgaug.augmenters.arithmetic import * from imgaug.augmenters.blur import * from imgaug.augmenters.color import * -from imgaug.augmenters.contrast import GammaContrast, SigmoidContrast, LogContrast, LinearContrast +from imgaug.augmenters.contrast import * from imgaug.augmenters.convolu...
ad558a5acc93e1e5206ed27b2dc679089b277890
me_api/app.py
me_api/app.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from flask import Flask from .middleware.me import me from .middleware import github, keybase, medium from .cache import cache def create_app(config): app = Flask(__name__) app.config.from_object(config)...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from flask import Flask from .middleware.me import me from .cache import cache def _register_module(app, module): if module == 'github': from .middleware import github app.register_blueprint(...
Fix giant bug: crash when don't config all modules
Fix giant bug: crash when don't config all modules that's bacause you import all the modules > from .middleware import github, keybase, medium while each module need to get configurations from modules.json, e.g. > config = Config.modules['modules']['github'] but can't get anything at all, so it will crash. that's not...
Python
mit
lord63/me-api
--- +++ @@ -7,8 +7,19 @@ from flask import Flask from .middleware.me import me -from .middleware import github, keybase, medium from .cache import cache + + +def _register_module(app, module): + if module == 'github': + from .middleware import github + app.register_blueprint(github.github_api) +...
42b330e5629b25db45e7a0f3f08bdb21e608b106
skimage/viewer/qt.py
skimage/viewer/qt.py
has_qt = True try: from matplotlib.backends.qt_compat import QtGui, QtCore, QtWidgets except ImportError: try: from matplotlib.backends.qt4_compat import QtGui, QtCore QtWidgets = QtGui except ImportError: # Mock objects class QtGui(object): QMainWindow = object ...
has_qt = True try: from matplotlib.backends.qt_compat import QtGui, QtCore, QtWidgets except ImportError: try: from matplotlib.backends.qt4_compat import QtGui, QtCore QtWidgets = QtGui except ImportError: # Mock objects class QtGui(object): QMainWindow = object ...
Add QWidget to the mock Qt
Add QWidget to the mock Qt
Python
bsd-3-clause
ClinicalGraphics/scikit-image,bsipocz/scikit-image,rjeli/scikit-image,juliusbierk/scikit-image,vighneshbirodkar/scikit-image,pratapvardhan/scikit-image,juliusbierk/scikit-image,keflavich/scikit-image,warmspringwinds/scikit-image,Britefury/scikit-image,oew1v07/scikit-image,bennlich/scikit-image,ClinicalGraphics/scikit-i...
--- +++ @@ -23,6 +23,8 @@ def Signal(self, *args, **kwargs): pass + QWidget = object + QtCore = QtWidgets = QtCore_cls() has_qt = False
bd3d97cefe61886ab8c2fa24eecd624ca1c6f751
profile_collection/startup/90-settings.py
profile_collection/startup/90-settings.py
import logging # metadata set at startup RE.md['owner'] = 'xf11id' RE.md['beamline_id'] = 'CHX' # removing 'custom' as it is raising an exception in 0.3.2 # gs.RE.md['custom'] = {} def print_scanid(name, doc): if name == 'start': print('Scan ID:', doc['scan_id']) print('Unique ID:', doc['uid']) ...
import logging # metadata set at startup RE.md['owner'] = 'xf11id' RE.md['beamline_id'] = 'CHX' # removing 'custom' as it is raising an exception in 0.3.2 # gs.RE.md['custom'] = {} def print_md(name, doc): if name == 'start': print('Metadata:\n', repr(doc)) RE.subscribe(print_scanid) #from eiger_io.fs_h...
Remove redundant Scan ID printing (there is another one elsewhere)
Remove redundant Scan ID printing (there is another one elsewhere)
Python
bsd-2-clause
NSLS-II-CHX/ipython_ophyd,NSLS-II-CHX/ipython_ophyd
--- +++ @@ -5,13 +5,6 @@ RE.md['beamline_id'] = 'CHX' # removing 'custom' as it is raising an exception in 0.3.2 # gs.RE.md['custom'] = {} - - - -def print_scanid(name, doc): - if name == 'start': - print('Scan ID:', doc['scan_id']) - print('Unique ID:', doc['uid']) def print_md(name, doc): ...
ad60b0cd3326c0729237afbb094d22f4415fb422
laboratory/experiment.py
laboratory/experiment.py
import traceback from laboratory.observation import Observation, Test from laboratory import exceptions class Experiment(object): def __init__(self, name='Experiment', raise_on_mismatch=False): self.name = name self.raise_on_mismatch = raise_on_mismatch self._control = None self...
import traceback from laboratory.observation import Observation, Test from laboratory import exceptions class Experiment(object): def __init__(self, name='Experiment', raise_on_mismatch=False): self.name = name self.raise_on_mismatch = raise_on_mismatch self._control = None self...
Call Experiment.publish in run method
Call Experiment.publish in run method
Python
mit
joealcorn/laboratory,shaunvxc/laboratory
--- +++ @@ -30,6 +30,7 @@ ) match = self.compare(control, *self.observations) + self.publish(match) return control.value def compare(self, control, *candidates): @@ -53,5 +54,5 @@ return False - def publish(self): - raise NotImplementedError + d...
9560ccf476a887c20b2373eca52f38f186b6ed58
conanfile.py
conanfile.py
from conans import ConanFile, CMake class NostalgiaConan(ConanFile): settings = "os", "compiler", "build_type", "arch" requires = "jsoncpp/1.9.2", "sdl2/2.0.10@bincrafters/stable", "qt/5.14.1@bincrafters/stable", "sqlite3/3.31.0", "libiconv/1.16" generators = "cmake", "cmake_find_package", "cmake_paths" ...
from conans import ConanFile, CMake class NostalgiaConan(ConanFile): settings = "os", "compiler", "build_type", "arch" requires = "jsoncpp/1.9.2", "sdl2/2.0.10@bincrafters/stable" generators = "cmake", "cmake_find_package", "cmake_paths" #default_options = { # "sdl2:nas": False #}
Remove conan Qt, as it is currently being ignored
[nostalgia] Remove conan Qt, as it is currently being ignored
Python
mpl-2.0
wombatant/nostalgia,wombatant/nostalgia,wombatant/nostalgia
--- +++ @@ -2,11 +2,8 @@ class NostalgiaConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - requires = "jsoncpp/1.9.2", "sdl2/2.0.10@bincrafters/stable", "qt/5.14.1@bincrafters/stable", "sqlite3/3.31.0", "libiconv/1.16" + requires = "jsoncpp/1.9.2", "sdl2/2.0.10@bincrafters/stable" ...
a284a69432b2e0052fd2da4121cf4512fc9423da
lemon/dashboard/admin.py
lemon/dashboard/admin.py
from django.conf import settings from lemon import extradmin as admin from lemon.dashboard import views from lemon.dashboard.base import dashboard, Widget class DashboardAdmin(admin.AppAdmin): instance = dashboard @property def urls(self): return self.instance.get_urls(self), 'dashboard', 'dash...
from django.conf import settings from lemon import extradmin as admin from lemon.dashboard import views from lemon.dashboard.base import dashboard, Widget class DashboardAdmin(admin.AppAdmin): dashboard = dashboard @property def urls(self): return self.dashboard.get_urls(self), 'dashboard', 'da...
Rename instance to dashboard in DashboardAdmin
Rename instance to dashboard in DashboardAdmin
Python
bsd-3-clause
trilan/lemon,trilan/lemon,trilan/lemon
--- +++ @@ -7,11 +7,11 @@ class DashboardAdmin(admin.AppAdmin): - instance = dashboard + dashboard = dashboard @property def urls(self): - return self.instance.get_urls(self), 'dashboard', 'dashboard' + return self.dashboard.get_urls(self), 'dashboard', 'dashboard' admin.site...
8541ec09e237f1401095d31177bdde9ac1adaa39
util/linkJS.py
util/linkJS.py
#!/usr/bin/env python import os def linkJS(target_fn, file_list_fn, source_base, prologue="", module_dirs=[]): with open(target_fn, "wb") as target: target.write(prologue) # Add files listed in file_list_fn with open(file_list_fn) as file_list: for source_fn in file_list: ...
#!/usr/bin/env python import os def linkJS(target_fn, file_list_fn, source_base, prologue="", module_dirs=[]): with open(target_fn, "wb") as target: target.write(prologue) # Add files listed in file_list_fn with open(file_list_fn) as file_list: for source_fn in file_list: ...
Include full path to original files
Include full path to original files
Python
mpl-2.0
MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz
--- +++ @@ -12,17 +12,17 @@ for source_fn in file_list: source_fn = source_fn.replace("/", os.path.sep).strip() if len(source_fn) > 0 and source_fn[0] != "#": - addContents(source_base, source_fn, target) + addContents(os.path.join(s...
72dd10849190fb191fdab4962996ea537322e103
tests/TestPluginManager.py
tests/TestPluginManager.py
import socket import time from unittest import TestCase from PluginManager import PluginManager class TestPluginManager(TestCase): def test_stop(self): class Plugin: def __init__(self): sock = socket.socket() sock.bind(('', 0)) # bind to any available port ...
import socket import time from unittest import TestCase from PluginManager import PluginManager class TestPluginManager(TestCase): def test_stop(self): class Plugin: def __init__(self): sock = socket.socket() sock.bind(('', 0)) # bind to any available port ...
Reduce sleep duration in PluginManager.stop() test
Reduce sleep duration in PluginManager.stop() test
Python
mit
ckaz18/honeypot,laurenmalone/honeypot,theplue/honeypot,ckaz18/honeypot,laurenmalone/honeypot,theplue/honeypot,coyle5280/honeypot,coyle5280/honeypot,ckaz18/honeypot,theplue/honeypot,theplue/honeypot,coyle5280/honeypot,ckaz18/honeypot,laurenmalone/honeypot,laurenmalone/honeypot,coyle5280/honeypot
--- +++ @@ -15,7 +15,7 @@ return self._port plugin_manager = PluginManager(Plugin(), lambda: None) plugin_manager.start() - time.sleep(1) + time.sleep(0.01) plugin_manager.stop() plugin_manager.join() self.assertFalse(plugin_manager.is_alive(...
2117778d777120293e506eca9743f97619b5ad5c
kiwi/interface.py
kiwi/interface.py
class Menu(object): def __init__(self, dialog, items, title, caller = None): self.d = dialog self.caller = caller self.entries = [] self.dispatch_table = {} tag = 1 self.title = title for entry, func in items: self.entries.append(tuple([str(tag)...
class MenuItem(object): def __init__(self, func=None): if func: self.function = func # Wrapper for child.function() that creates a call stack def run(self, ret=None): self.function() if ret: ret() class Menu(MenuItem): def __init__(self, dialog, items, title): self.d = ...
Create object MenuItem that wraps functions to create a call stack
Create object MenuItem that wraps functions to create a call stack
Python
mit
jakogut/KiWI
--- +++ @@ -1,7 +1,15 @@ -class Menu(object): - def __init__(self, dialog, items, title, caller = None): +class MenuItem(object): + def __init__(self, func=None): + if func: self.function = func + + # Wrapper for child.function() that creates a call stack + def run(self, ret=None): + self.fu...
ccf285c30a0110f2ff59b91ec0166f9b5306239d
dukpy/evaljs.py
dukpy/evaljs.py
import json from . import _dukpy try: from collections.abc import Iterable except ImportError: from collections import Iterable try: # pragma: no cover unicode string_types = (str, unicode) except NameError: # pragma: no cover string_types = (bytes, str) class JSInterpreter(object): """Jav...
import json from . import _dukpy try: from collections.abc import Iterable except ImportError: from collections import Iterable try: # pragma: no cover unicode string_types = (str, unicode) jscode_type = str except NameError: # pragma: no cover string_types = (bytes, str) jscode_type = s...
Fix unicode source code on py3
Fix unicode source code on py3
Python
mit
amol-/dukpy,amol-/dukpy,amol-/dukpy
--- +++ @@ -9,8 +9,10 @@ try: # pragma: no cover unicode string_types = (str, unicode) + jscode_type = str except NameError: # pragma: no cover string_types = (bytes, str) + jscode_type = str class JSInterpreter(object): @@ -33,8 +35,13 @@ if not isinstance(code, string_types): ...
fdcdb5416bccf85a1745ccd07915e15629128ff9
es_config.py
es_config.py
# A list of ES hosts ES_HOSTS = ['https://c3d581bfab179c1101d5b7a9e22a5f95.us-east-1.aws.found.io:9243'] ES_HTTP_AUTH = ("elastic:u3Mk8jjADYJ4NzUmPTn15MNx")
import os import ast # A list of ES hosts # Uncomment the following for debugging # ES_HOSTS = ['https://c3d581bfab179c1101d5b7a9e22a5f95.us-east-1.aws.found.io:9243'] # ES_HTTP_AUTH = ("elastic:u3Mk8jjADYJ4NzUmPTn15MNx") # Comment the following for debugging, # or set corresponding environment variables try: ES...
Update ES server config to make use of environment variables
Update ES server config to make use of environment variables
Python
mit
justinchuby/cmu-courseapi-flask
--- +++ @@ -1,4 +1,17 @@ +import os +import ast + # A list of ES hosts -ES_HOSTS = ['https://c3d581bfab179c1101d5b7a9e22a5f95.us-east-1.aws.found.io:9243'] -ES_HTTP_AUTH = ("elastic:u3Mk8jjADYJ4NzUmPTn15MNx") +# Uncomment the following for debugging +# ES_HOSTS = ['https://c3d581bfab179c1101d5b7a9e22a5f95.us-east-...
08fe9e7beb4285feec9205012a62d464b3489bcf
natasha/grammars/person/interpretation.py
natasha/grammars/person/interpretation.py
from enum import Enum from collections import Counter from yargy.interpretation import InterpretationObject class PersonObject(InterpretationObject): class Attributes(Enum): Firstname = 0 # Π²Π»Π°Π΄ΠΈΠΌΠΈΡ€ Middlename = 1 # Π²Π»Π°Π΄ΠΈΠΌΠΈΡ€ΠΎΠ²ΠΈΡ‡ Lastname = 2 # ΠΏΡƒΡ‚ΠΈΠ½ Descriptor = 3 # ΠΏΡ€Π΅Π·ΠΈΠ΄Π΅Π½Ρ‚ ...
# coding: utf-8 from __future__ import unicode_literals from enum import Enum from collections import Counter from yargy.interpretation import InterpretationObject class PersonObject(InterpretationObject): class Attributes(Enum): Firstname = 0 # Π²Π»Π°Π΄ΠΈΠΌΠΈΡ€ Middlename = 1 # Π²Π»Π°Π΄ΠΈΠΌΠΈΡ€ΠΎΠ²ΠΈΡ‡ La...
Fix encoding for python 2.x
Fix encoding for python 2.x
Python
mit
natasha/natasha
--- +++ @@ -1,3 +1,6 @@ +# coding: utf-8 +from __future__ import unicode_literals + from enum import Enum from collections import Counter from yargy.interpretation import InterpretationObject
294c251d83bec3738ce54a67d718c2ba959a7b4b
git.py
git.py
import os import subprocess class cd: """Context manager for changing the current working directory.""" def __init__(self, new_path): self.new_path = os.path.expanduser(new_path) def __enter__(self): self.previous_path = os.getcwd() os.chdir(self.new_path) def __exit__(self,...
import os import subprocess from contextlib import ContextDecorator class cd(ContextDecorator): """Context manager/decorator for changing the current working directory.""" def __init__(self, new_path): self.new_path = os.path.expanduser(new_path) def __enter__(self): self.previous_path =...
Extend cd context manager to decorator.
Extend cd context manager to decorator.
Python
mit
0xfoo/punchcard
--- +++ @@ -1,31 +1,36 @@ import os import subprocess +from contextlib import ContextDecorator -class cd: - """Context manager for changing the current working directory.""" +class cd(ContextDecorator): + """Context manager/decorator for changing the current working directory.""" def __init__(self,...
2e6efd4ecf22a1e7c673f90f113bfae47b98d294
medical_insurance_us/models/__init__.py
medical_insurance_us/models/__init__.py
# -*- coding: utf-8 -*- ############################################################################## # # Author: Dave Lasley <dave@laslabs.com> # Copyright: 2015 LasLabs, Inc [https://laslabs.com] # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affe...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Dave Lasley <dave@laslabs.com> # Copyright: 2015 LasLabs, Inc [https://laslabs.com] # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affe...
Add template and remove company from insurance_us imports
Add template and remove company from insurance_us imports
Python
agpl-3.0
ShaheenHossain/eagle-medical,laslabs/vertical-medical,ShaheenHossain/eagle-medical,laslabs/vertical-medical
--- +++ @@ -20,4 +20,4 @@ ############################################################################## from . import medical_insurance_plan -from . import medical_insurance_company +from . import medical_insurance_template
3d3a81efc36e39888929e62287b9d895922d8615
tests/sentry/filters/test_web_crawlers.py
tests/sentry/filters/test_web_crawlers.py
from __future__ import absolute_import from sentry.filters.web_crawlers import WebCrawlersFilter from sentry.testutils import TestCase class WebCrawlersFilterTest(TestCase): filter_cls = WebCrawlersFilter def apply_filter(self, data): return self.filter_cls(self.project).test(data) def get_mock...
from __future__ import absolute_import from sentry.filters.web_crawlers import WebCrawlersFilter from sentry.testutils import TestCase class WebCrawlersFilterTest(TestCase): filter_cls = WebCrawlersFilter def apply_filter(self, data): return self.filter_cls(self.project).test(data) def get_mock...
Add unit tests for filtering Twitterbot and Slack.
Add unit tests for filtering Twitterbot and Slack.
Python
bsd-3-clause
ifduyue/sentry,mvaled/sentry,gencer/sentry,gencer/sentry,mvaled/sentry,JackDanger/sentry,beeftornado/sentry,mvaled/sentry,mvaled/sentry,jean/sentry,looker/sentry,looker/sentry,jean/sentry,looker/sentry,mvaled/sentry,looker/sentry,ifduyue/sentry,ifduyue/sentry,mvaled/sentry,JackDanger/sentry,gencer/sentry,gencer/sentry,...
--- +++ @@ -28,3 +28,17 @@ def test_does_not_filter_chrome(self): data = self.get_mock_data('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36') assert not self.apply_filter(data) + + def test_filters_twitterbot(self): + data = self.g...
6bd088acd0ec0cfa5298051e286ce76e42430067
shuup/front/themes/views/_product_preview.py
shuup/front/themes/views/_product_preview.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from shuup.front.views.product import ProductDetailView class ProductPrevi...
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from shuup.front.views.product import ProductDetailView class ProductPrevi...
Remove reference to nonexistent file
Front: Remove reference to nonexistent file
Python
agpl-3.0
shoopio/shoop,shoopio/shoop,shawnadelic/shuup,suutari-ai/shoop,shawnadelic/shuup,hrayr-artunyan/shuup,suutari/shoop,suutari/shoop,shoopio/shoop,suutari-ai/shoop,hrayr-artunyan/shuup,shawnadelic/shuup,suutari/shoop,suutari-ai/shoop,hrayr-artunyan/shuup
--- +++ @@ -18,8 +18,7 @@ # preview, we cannot redirect back to `/xtheme/product_preview`. context = super(ProductPreviewView, self).get_context_data(**kwargs) - # Add `return_url` to context to avoid usage of `request.path` in - # `classic_gray/shuup/front/product/_detail_order_sect...
5fdedac2eae25d88d2595f0fe79ca3a332f24dfe
pysuru/api.py
pysuru/api.py
# coding: utf-8 """ Public endpoint to import API classes Instead of importing each module individually (eg. ``from pysuru.apps import AppsAPI``), import from this module. """ from __future__ import absolute_imports from .apps import AppsAPI from .services import ServicesAPI
# coding: utf-8 """ Public endpoint to import API classes Instead of importing each module individually (eg. ``from pysuru.apps import AppsAPI``), import from this module. """ from __future__ import absolute_imports from .apps import AppsAPI from .services import ServiceInstanceAPI
Fix service instance API class name
Fix service instance API class name
Python
mit
rcmachado/pysuru
--- +++ @@ -8,4 +8,4 @@ from __future__ import absolute_imports from .apps import AppsAPI -from .services import ServicesAPI +from .services import ServiceInstanceAPI
a347c699be3ce5659db4b76a26ce253a209e232e
webapp_health_monitor/verificators/base.py
webapp_health_monitor/verificators/base.py
from webapp_health_monitor import errors class Verificator(object): verificator_name = None def __init__(self, **kwargs): pass def run(self): raise NotImplementedError() def __str__(self): if self.verificator_name: return self.verificator_name else: ...
from webapp_health_monitor import errors class Verificator(object): verificator_name = None def __init__(self, **kwargs): pass def run(self): raise NotImplementedError() def __str__(self): if self.verificator_name: return self.verificator_name else: ...
Delete unused value extractor attribute.
Delete unused value extractor attribute.
Python
mit
pozytywnie/webapp-health-monitor,serathius/webapp-health-monitor
--- +++ @@ -18,7 +18,6 @@ class RangeVerificator(Verificator): - value_extractor = None upper_bound = None lower_bound = None
47672fe44673fe9cae54a736bdc9eb496494ab58
UI/utilities/synchronization_core.py
UI/utilities/synchronization_core.py
# -*- coding: utf-8 -*- # Synchronization core module for Storj GUI Client # class StorjFileSynchronization(): def start_sync_thread(self): return 1 def reload_sync_configuration(self): return 1 def add_file_to_sync_queue(self): return 1
# -*- coding: utf-8 -*- # Synchronization core module for Storj GUI Client # import time from watchdog.observers import Observer from watchdog.events import PatternMatchingEventHandler import threading HANDLE_ON_MOVE_EVENT = True HANDLE_ON_DELETE_EVENT = True class StorjFileSynchronization(): def start_sync_thr...
Add synchronization directory observer and handler
Add synchronization directory observer and handler
Python
mit
lakewik/storj-gui-client
--- +++ @@ -1,13 +1,83 @@ # -*- coding: utf-8 -*- # Synchronization core module for Storj GUI Client # +import time +from watchdog.observers import Observer +from watchdog.events import PatternMatchingEventHandler +import threading + +HANDLE_ON_MOVE_EVENT = True +HANDLE_ON_DELETE_EVENT = True class StorjFileSy...
23af33b7ca48c59ff58638b733437d8f348b279b
openapi_core/__init__.py
openapi_core/__init__.py
# -*- coding: utf-8 -*- """OpenAPI core module""" from openapi_core.shortcuts import ( create_spec, validate_parameters, validate_body, validate_data, ) __author__ = 'Artur MaciΔ…g' __email__ = 'maciag.artur@gmail.com' __version__ = '0.5.0' __url__ = 'https://github.com/p1c2u/openapi-core' __license__ = 'BSD 3-Clau...
# -*- coding: utf-8 -*- """OpenAPI core module""" from openapi_core.shortcuts import ( create_spec, validate_parameters, validate_body, validate_data, ) __author__ = 'Artur Maciag' __email__ = 'maciag.artur@gmail.com' __version__ = '0.5.0' __url__ = 'https://github.com/p1c2u/openapi-core' __license__ = 'BSD 3-Clau...
Replace unicode character for RPM build.
Replace unicode character for RPM build. To make building RPMs of package easier when using ascii by default.
Python
bsd-3-clause
p1c2u/openapi-core
--- +++ @@ -4,7 +4,7 @@ create_spec, validate_parameters, validate_body, validate_data, ) -__author__ = 'Artur MaciΔ…g' +__author__ = 'Artur Maciag' __email__ = 'maciag.artur@gmail.com' __version__ = '0.5.0' __url__ = 'https://github.com/p1c2u/openapi-core'
f4c9482e41ec2ee6c894a413e8fcb0349a9edbd1
tapiriik/web/templatetags/displayutils.py
tapiriik/web/templatetags/displayutils.py
from django import template import json register = template.Library() @register.filter(name="format_meters") def meters_to_kms(value): try: return round(value / 1000) except: return "NaN" @register.filter(name='json') def jsonit(obj): return json.dumps(obj) @register.filter(name='dict_ge...
from django import template import json register = template.Library() @register.filter(name="format_meters") def meters_to_kms(value): try: return round(value / 1000) except: return "NaN" @register.filter(name='json') def jsonit(obj): return json.dumps(obj) @register.filter(name='dict_ge...
Fix broken diagnostic dashboard with new sync progress values
Fix broken diagnostic dashboard with new sync progress values
Python
apache-2.0
campbellr/tapiriik,niosus/tapiriik,gavioto/tapiriik,cheatos101/tapiriik,cheatos101/tapiriik,brunoflores/tapiriik,abhijit86k/tapiriik,mjnbike/tapiriik,dlenski/tapiriik,abhijit86k/tapiriik,cpfair/tapiriik,marxin/tapiriik,abhijit86k/tapiriik,dlenski/tapiriik,cheatos101/tapiriik,abs0/tapiriik,niosus/tapiriik,dmschreiber/ta...
--- +++ @@ -33,4 +33,7 @@ def percentage(value, *args): if not value: return "NaN" - return str(round(float(value) * 100)) + "%" + try: + return str(round(float(value) * 100)) + "%" + except ValueError: + return value
03eb0081a4037e36775271fb2373277f8e89835b
src/mcedit2/resourceloader.py
src/mcedit2/resourceloader.py
""" ${NAME} """ from __future__ import absolute_import, division, print_function, unicode_literals import logging import zipfile log = logging.getLogger(__name__) class ResourceNotFound(KeyError): pass class ResourceLoader(object): def __init__(self): super(ResourceLoader, self).__init__() ...
""" ${NAME} """ from __future__ import absolute_import, division, print_function, unicode_literals import logging import zipfile log = logging.getLogger(__name__) class ResourceNotFound(KeyError): pass class ResourceLoader(object): def __init__(self): super(ResourceLoader, self).__init__() ...
Add function to ResourceLoader for listing all block models
Add function to ResourceLoader for listing all block models xxx only lists Vanilla models. haven't looked at mods with models yet.
Python
bsd-3-clause
vorburger/mcedit2,vorburger/mcedit2,Rubisk/mcedit2,Rubisk/mcedit2
--- +++ @@ -33,3 +33,9 @@ raise ResourceNotFound("Resource %s not found in search path" % path) return stream + + def blockModelPaths(self): + for zf in self.zipFiles: + for name in zf.namelist(): + if name.startswith("assets/minecraft/models/block"): + ...
de4f43613b5f3a8b6f49ace6b8e9585a242d7cb2
src/build.py
src/build.py
# Copyright 2007 Pompeu Fabra University (Computational Imaging Laboratory), Barcelona, Spain. Web: www.cilab.upf.edu. # This software is distributed WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Script to automate CSnake calls from cruise contro...
# Copyright 2007 Pompeu Fabra University (Computational Imaging Laboratory), Barcelona, Spain. Web: www.cilab.upf.edu. # This software is distributed WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Script to automate CSnake calls from cruise contro...
Exit with the proper value.
Exit with the proper value. git-svn-id: a26c1b3dc012bc7b166f1b96505d8277332098eb@265 9ffc3505-93cb-cd4b-9e5d-8a77f6415fcf
Python
bsd-3-clause
csnake-org/CSnake,csnake-org/CSnake,msteghofer/CSnake,msteghofer/CSnake,csnake-org/CSnake,msteghofer/CSnake
--- +++ @@ -32,5 +32,7 @@ res = handler.ConfigureThirdPartyFolder(settings) else: res = handler.ConfigureProjectToBinFolder( settings, 1 ) -sys.exit(res) +# exit with error if there was a problem +if res == false: + sys.exit(1)
55464daa00ca68b07737433b0983df4667432a9c
system/plugins/info.py
system/plugins/info.py
__author__ = 'Gareth Coles' import weakref class Info(object): data = None core = None info = None def __init__(self, yaml_data, plugin_object=None): """ :param yaml_data: :type yaml_data: dict :return: """ self.data = yaml_data if plugin_...
__author__ = 'Gareth Coles' import weakref class Info(object): data = None core = None info = None def __init__(self, yaml_data, plugin_object=None): """ :param yaml_data: :type yaml_data: dict :return: """ self.data = yaml_data if plugin_...
Fix missing dependencies on core
Fix missing dependencies on core
Python
artistic-2.0
UltrosBot/Ultros,UltrosBot/Ultros
--- +++ @@ -37,6 +37,7 @@ if hasattr(self.core, "dependencies"): self.dependencies = self.core.dependencies else: + self.core.dependencies = [] self.dependencies = [] if self.info is not None:
985dd1ada1b2ad9ceaae111fa32b1d8e54b61786
mailqueue/tasks.py
mailqueue/tasks.py
from celery.task import task from .models import MailerMessage @task(name="tasks.send_mail") def send_mail(pk): message = MailerMessage.objects.get(pk=pk) message._send() @task() def clear_sent_messages(): from mailqueue.models import MailerMessage MailerMessage.objects.clear_sent_messages()
from celery.task import task from .models import MailerMessage @task(name="tasks.send_mail", default_retry_delay=5, max_retries=5) def send_mail(pk): message = MailerMessage.objects.get(pk=pk) message._send() # Retry when message is not sent if not message.sent: send_mail.retry([message.pk...
Add retry to celery task
Add retry to celery task Messages do not always get delivered. Built in a retry when message is not sent. Max retry count could also be a setting.
Python
mit
Goury/django-mail-queue,dstegelman/django-mail-queue,winfieldco/django-mail-queue,Goury/django-mail-queue,styrmis/django-mail-queue,dstegelman/django-mail-queue
--- +++ @@ -1,10 +1,14 @@ from celery.task import task from .models import MailerMessage -@task(name="tasks.send_mail") +@task(name="tasks.send_mail", default_retry_delay=5, max_retries=5) def send_mail(pk): message = MailerMessage.objects.get(pk=pk) message._send() + + # Retry when message is n...
8d8798554d996776eecc61b673adcbc2680f327a
mastermind/main.py
mastermind/main.py
from __future__ import (absolute_import, print_function, division) from itertools import repeat from mitmproxy.main import mitmdump import os from . import (cli, proxyswitch, say) def main(): parser = cli.args() args, extra_args = parser.parse_known_args() try: config = cli.config(args) excep...
from __future__ import (absolute_import, print_function, division) from itertools import repeat from mitmproxy.main import mitmdump import os from . import (cli, proxyswitch, say) def main(): parser = cli.args() args, extra_args = parser.parse_known_args() try: config = cli.config(args) excep...
Write PID to a file
Write PID to a file
Python
mit
ustwo/mastermind,ustwo/mastermind
--- +++ @@ -24,15 +24,23 @@ say.level(config["core"]["verbose"]) + host= config["core"]["host"] + port = config["core"]["port"] + pid_filename = "/var/tmp/mastermind.{}{}.pid".format(host.replace('.', ''), port) + try: if config["os"]["proxy-settings"]: if not is_sudo: ...
4ef5d9ae7a571f97242cf2cc44e539d039486549
runserver.py
runserver.py
#!/usr/bin/env python """ # # #### ##### # # ##### # # # # # # # # # ## ## # # # ## # # ### #### #### # # # # # # # # ##### # # # # # # # # ## # # # # # # ##### # # # # # # # # ...
#!/usr/bin/env python """ # # #### ##### # # ##### # # # # # # # # # ## ## # # # ## # # ### #### #### # # # # # # # # ##### # # # # # # # # ## # # # # # # ##### # # # # # # # # ...
Add proper banner to dev launch script
Add proper banner to dev launch script
Python
bsd-2-clause
glasnost/kremlin,glasnost/kremlin,glasnost/kremlin
--- +++ @@ -14,8 +14,11 @@ from kremlin import app def main(): - print "Launching kremlin in development mode." - print "--------------------------------------" + print "Kremlin Magical Everything System v 0.0.0-None" + print "Copyright (c) Glasnost 2010-2011" + print "-----------------------------...
928cbc47cb7430d8a2fef924b61179cd30f5ca34
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ethan Zimmerman # Copyright (c) 2014 Ethan Zimmerman # # License: MIT # """This module exports the RamlCop plugin class.""" from SublimeLinter.lint import NodeLinter class RamlCop(NodeLinter): """Provides an ...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ethan Zimmerman # Copyright (c) 2014 Ethan Zimmerman # # License: MIT # """This module exports the RamlCop plugin class.""" from SublimeLinter.lint import NodeLinter class RamlCop(NodeLinter): """Provides an i...
Remove empty line before class docstring
Remove empty line before class docstring
Python
mit
thebinarypenguin/SublimeLinter-contrib-raml-cop
--- +++ @@ -14,7 +14,6 @@ class RamlCop(NodeLinter): - """Provides an interface to raml-cop.""" syntax = 'raml'
9ee0f3f7be90046f796f3395b2149288a2b52a26
src/zeit/magazin/preview.py
src/zeit/magazin/preview.py
# Copyright (c) 2013 gocept gmbh & co. kg # See also LICENSE.txt import grokcore.component as grok import zeit.cms.browser.preview import zeit.magazin.interfaces @grok.adapter(zeit.magazin.interfaces.IZMOContent, basestring) @grok.implementer(zeit.cms.browser.interfaces.IPreviewURL) def preview_url(content, preview_...
# Copyright (c) 2013 gocept gmbh & co. kg # See also LICENSE.txt import grokcore.component as grok import zeit.cms.browser.preview import zeit.magazin.interfaces @grok.adapter(zeit.magazin.interfaces.IZMOContent, basestring) @grok.implementer(zeit.cms.browser.interfaces.IPreviewURL) def preview_url(content, preview_...
Remove oddity marker, it's been resolved in zeit.find now
Remove oddity marker, it's been resolved in zeit.find now
Python
bsd-3-clause
ZeitOnline/zeit.magazin
--- +++ @@ -11,8 +11,3 @@ def preview_url(content, preview_type): return zeit.cms.browser.preview.prefixed_url( 'zmo-%s-prefix' % preview_type, content.uniqueId) - - -# XXX there also is a (basestring, basestring) variant of the adapter -# which is used by zeit.find to caluclate preview-urls for search...
ee0f28abd70396bf1e094592028aa693e5d6fe6c
rechunker/executors/python.py
rechunker/executors/python.py
import itertools from functools import partial import math from typing import Any, Callable, Iterable from rechunker.types import CopySpec, StagedCopySpec, Executor Thunk = Callable[[], None] class PythonExecutor(Executor[Thunk]): """An execution engine based on Python loops. Supports copying between any...
import itertools from functools import partial import math from typing import Callable, Iterable from rechunker.types import CopySpec, StagedCopySpec, Executor # PythonExecutor represents delayed execution tasks as functions that require # no arguments. Task = Callable[[], None] class PythonExecutor(Executor[Task...
Remove 'thunk' jargon from PythonExecutor
Remove 'thunk' jargon from PythonExecutor
Python
mit
pangeo-data/rechunker
--- +++ @@ -2,15 +2,17 @@ from functools import partial import math -from typing import Any, Callable, Iterable +from typing import Callable, Iterable from rechunker.types import CopySpec, StagedCopySpec, Executor -Thunk = Callable[[], None] +# PythonExecutor represents delayed execution tasks as functions...
01dc78bc4cea6c11744879c0f2066ab627314625
django_stackoverflow_trace/__init__.py
django_stackoverflow_trace/__init__.py
from django.views import debug def _patch_django_debug_view(): new_data = """ <h3 style="margin-bottom:10px;"> <a href="http://stackoverflow.com/search?q=[python] or [django]+{{ exception_value|force_escape }}" target="_blank">View in Stackoverflow</a> </h3> """ ...
from django.views import debug from django.conf import settings def get_search_link(): default_choice = "stackoverflow" search_urls = { "stackoverflow": "http://stackoverflow.com/search?q=[python] or " "[django]+{{ exception_value|force_escape }}", "googlesearch": "ht...
Add a google search option
Add a google search option
Python
mit
emre/django-stackoverflow-trace
--- +++ @@ -1,14 +1,34 @@ from django.views import debug +from django.conf import settings + + +def get_search_link(): + default_choice = "stackoverflow" + + search_urls = { + "stackoverflow": "http://stackoverflow.com/search?q=[python] or " + "[django]+{{ exception_value|force_e...
ddc03637b19059f6fb06d72dc380afaf4fba57c2
indra/tests/test_context.py
indra/tests/test_context.py
from indra.databases import context_client def test_get_protein_expression(): res = context_client.get_protein_expression('EGFR', 'BT20_BREAST') assert(res is not None) assert(res.get('EGFR') is not None) assert(res['EGFR'].get('BT20_BREAST') is not None) assert(res['EGFR']['BT20_BREAST'] > 1000) ...
from indra.databases import context_client def test_get_protein_expression(): res = context_client.get_protein_expression('EGFR', 'BT20_BREAST') assert(res is not None) assert(res.get('EGFR') is not None) assert(res['EGFR'].get('BT20_BREAST') is not None) assert(res['EGFR']['BT20_BREAST'] > 1000) ...
Remove deprecated context client test
Remove deprecated context client test
Python
bsd-2-clause
johnbachman/belpy,sorgerlab/indra,johnbachman/belpy,sorgerlab/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,jmuhlich/indra,jmuhlich/indra,johnbachman/belpy,sorgerlab/belpy,pvtodorov/indra,pvtodorov/indra,jmuhlich/indra,bgyori/indra,johnbachman/indra,sorgerlab/belpy,johnbachman/ind...
--- +++ @@ -13,7 +13,3 @@ assert(res.get('BRAF') is not None) assert(res['BRAF'].get('A375_SKIN') is not None) assert(res['BRAF']['A375_SKIN'] == 1.0) - -def test_send_request_bad(): - res = context_client.send_request('xyz', None) - assert(res is None)
a1f5a392d5270dd6f80a40e45c5e25b6ae04b7c3
embed_video/fields.py
embed_video/fields.py
from django.db import models from django import forms from django.utils.translation import ugettext_lazy as _ from .backends import detect_backend, UnknownIdException, \ UnknownBackendException __all__ = ('EmbedVideoField', 'EmbedVideoFormField') class EmbedVideoField(models.URLField): """ Model field f...
from django.db import models from django import forms from django.utils.translation import ugettext_lazy as _ from .backends import detect_backend, UnknownIdException, \ UnknownBackendException __all__ = ('EmbedVideoField', 'EmbedVideoFormField') class EmbedVideoField(models.URLField): """ Model field f...
Simplify validate method in FormField.
Simplify validate method in FormField.
Python
mit
yetty/django-embed-video,jazzband/django-embed-video,jazzband/django-embed-video,mpachas/django-embed-video,yetty/django-embed-video,mpachas/django-embed-video
--- +++ @@ -36,15 +36,17 @@ """ def validate(self, url): + # if empty url is not allowed throws an exception super(EmbedVideoFormField, self).validate(url) + + if not url: + return - if url: - try: - detect_backend(url) - ...
7f6167ef9f62b9b79e3c30b358c796caae69a2e6
PyWXSB/exceptions_.py
PyWXSB/exceptions_.py
"""Extensions of standard exceptions for PyWXSB events. Yeah, I'd love this module to be named exceptions.py, but it can't because the standard library has one of those, and we need to reference it below. """ import exceptions class PyWXSBException (exceptions.Exception): """Base class for exceptions that indica...
"""Extensions of standard exceptions for PyWXSB events. Yeah, I'd love this module to be named exceptions.py, but it can't because the standard library has one of those, and we need to reference it below. """ import exceptions class PyWXSBException (exceptions.Exception): """Base class for exceptions that indica...
Add an exception to throw when a document does have the expected structure
Add an exception to throw when a document does have the expected structure
Python
apache-2.0
jonfoster/pyxb-upstream-mirror,jonfoster/pyxb-upstream-mirror,balanced/PyXB,jonfoster/pyxb2,pabigot/pyxb,CantemoInternal/pyxb,jonfoster/pyxb2,balanced/PyXB,CantemoInternal/pyxb,jonfoster/pyxb1,pabigot/pyxb,jonfoster/pyxb2,CantemoInternal/pyxb,jonfoster/pyxb-upstream-mirror,jonfoster/pyxb1,balanced/PyXB
--- +++ @@ -28,6 +28,10 @@ """Raised when a schema component property is accessed on a component instance that does not define that property.""" pass +class BadDocumentError (PyWXSBException): + """Raised when processing document content and an error is encountered.""" + pass + class PyWXSBError (e...
3bb0e65eac5c93fa6e331d22252fd7b17ecdf964
__main__.py
__main__.py
# Copyright 2016 The TensorFlow Authors. 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 applica...
# Copyright 2016 The TensorFlow Authors. 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 applica...
Add pylint indentation check to sanity and fix existing indentation Change: 132840696
Add pylint indentation check to sanity and fix existing indentation Change: 132840696
Python
apache-2.0
francoisluus/tensorboard-supervise,qiuminxu/tensorboard,qiuminxu/tensorboard,tensorflow/tensorboard,shakedel/tensorboard,qiuminxu/tensorboard,ioeric/tensorboard,shakedel/tensorboard,qiuminxu/tensorboard,tensorflow/tensorboard,qiuminxu/tensorboard,francoisluus/tensorboard-supervise,agrubb/tensorboard,tensorflow/tensorbo...
--- +++ @@ -22,4 +22,4 @@ from tensorflow.tensorboard.tensorboard import main if __name__ == '__main__': - sys.exit(main()) + sys.exit(main())
36298a9f9a7a373a716e44cac6226a0ec8c8c40c
__main__.py
__main__.py
from twisted.internet.endpoints import TCP4ServerEndpoint from twisted.internet import reactor import editorFactory if __name__ == "__main__": server = editorFactory.EditorFactory() TCP4ServerEndpoint(reactor, 4567).listen(server) reactor.run()
from twisted.internet.endpoints import TCP4ServerEndpoint from twisted.internet import reactor import editorFactory if __name__ == "__main__": server = editorFactory.EditorFactory() TCP4ServerEndpoint(reactor, 4567).listen(server) print('Starting up...') reactor.run()
Print something at the start
Print something at the start
Python
apache-2.0
Floobits/floobits-emacs
--- +++ @@ -6,4 +6,5 @@ if __name__ == "__main__": server = editorFactory.EditorFactory() TCP4ServerEndpoint(reactor, 4567).listen(server) + print('Starting up...') reactor.run()
602c01caa23df0c6dad5963412a340087012f692
thinc/tests/integration/test_shape_check.py
thinc/tests/integration/test_shape_check.py
import pytest import numpy from ...neural._classes.model import Model def test_mismatched_shapes_raise_ShapeError(): X = numpy.ones((3, 4)) model = Model(10, 5) with pytest.raises(ValueError): y = model.begin_training(X)
import pytest import numpy from ...neural._classes.model import Model from ...exceptions import UndefinedOperatorError, DifferentLengthError from ...exceptions import ExpectedTypeError, ShapeMismatchError def test_mismatched_shapes_raise_ShapeError(): X = numpy.ones((3, 4)) model = Model(10, 5) with pyte...
Update test and import errors
Update test and import errors
Python
mit
explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc
--- +++ @@ -2,12 +2,13 @@ import numpy from ...neural._classes.model import Model - +from ...exceptions import UndefinedOperatorError, DifferentLengthError +from ...exceptions import ExpectedTypeError, ShapeMismatchError def test_mismatched_shapes_raise_ShapeError(): X = numpy.ones((3, 4)) model = ...
3e413b9f0afea5e33f8698e13984fe5dcf4783dd
src/core/homepage_elements/about/hooks.py
src/core/homepage_elements/about/hooks.py
__copyright__ = "Copyright 2017 Birkbeck, University of London" __author__ = "Martin Paul Eve & Andy Byers" __license__ = "AGPL v3" __maintainer__ = "Birkbeck Centre for Technology and Publishing" from django.utils.translation import ugettext_lazy as _ from utils.setting_handler import get_plugin_setting from core.ho...
__copyright__ = "Copyright 2017 Birkbeck, University of London" __author__ = "Martin Paul Eve & Andy Byers" __license__ = "AGPL v3" __maintainer__ = "Birkbeck Centre for Technology and Publishing" from django.utils.translation import ugettext_lazy as _ from utils.setting_handler import get_plugin_setting from core.ho...
Swap IndexError for AttributeError as a result of the swap from HVAD to MT
Swap IndexError for AttributeError as a result of the swap from HVAD to MT
Python
agpl-3.0
BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway
--- +++ @@ -19,7 +19,7 @@ request.journal, ) title_value = title.value if title.value else '' - except IndexError: + except AttributeError: title_value = _('About this Journal') return {
838012c457d6c963707bb16259cd72d28c231672
cellcounter/accounts/decorators.py
cellcounter/accounts/decorators.py
__author__ = 'jvc26'
from functools import wraps from ratelimit.exceptions import Ratelimited from ratelimit.helpers import is_ratelimited def registration_ratelimit(ip=True, block=False, method=['POST'], field=None, rate='1/h', skip_if=None, keys=None): def decorator(fn): @wraps(fn) def _w...
Use custom decorator to allow ratelimiting only on successful POST - prevents blocking form errors
Use custom decorator to allow ratelimiting only on successful POST - prevents blocking form errors
Python
mit
haematologic/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter,haematologic/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter,haematologic/cellcounter
--- +++ @@ -1 +1,25 @@ -__author__ = 'jvc26' +from functools import wraps + +from ratelimit.exceptions import Ratelimited +from ratelimit.helpers import is_ratelimited + + +def registration_ratelimit(ip=True, block=False, method=['POST'], field=None, rate='1/h', + skip_if=None, keys=None): +...
6ec3b50a087e68373f71162b3dd2421ce7655e4f
neuroimaging/testing/__init__.py
neuroimaging/testing/__init__.py
"""The testing directory contains a small set of imaging files to be used for doctests only. More thorough tests and example data will be stored in a nipy-data-suite to be created later and downloaded separately. Examples -------- >>> from neuroimaging.testing import funcfile >>> from neuroimaging.core.image import ...
"""The testing directory contains a small set of imaging files to be used for doctests only. More thorough tests and example data will be stored in a nipy-data-suite to be created later and downloaded separately. Examples -------- >>> from neuroimaging.testing import funcfile >>> from neuroimaging.core.image import ...
Add some nose.tools to testing imports.
Add some nose.tools to testing imports.
Python
bsd-3-clause
alexis-roche/nipy,nipy/nipy-labs,bthirion/nipy,alexis-roche/niseg,arokem/nipy,alexis-roche/nipy,arokem/nipy,bthirion/nipy,nipy/nireg,nipy/nipy-labs,alexis-roche/niseg,nipy/nireg,alexis-roche/nipy,arokem/nipy,arokem/nipy,alexis-roche/register,alexis-roche/nireg,alexis-roche/register,bthirion/nipy,alexis-roche/register,a...
--- +++ @@ -31,3 +31,5 @@ from numpy.testing import * import decorators as dec +from nose.tools import assert_true, assert_false +
bda420a0f9abd31b78decdc43359d0dcff36381f
zephyr/management/commands/dump_pointers.py
zephyr/management/commands/dump_pointers.py
from optparse import make_option from django.core.management.base import BaseCommand from zephyr.models import Realm, UserProfile import simplejson def dump(): pointers = [] for u in UserProfile.objects.select_related("user__email").all(): pointers.append((u.user.email, u.pointer)) file("dumped-poi...
from optparse import make_option from django.core.management.base import BaseCommand from zephyr.models import Realm, UserProfile import simplejson def dump(): pointers = [] for u in UserProfile.objects.select_related("user__email").all(): pointers.append((u.user.email, u.pointer)) file("dumped-poi...
Fix email case issues when restoring user pointers.
Fix email case issues when restoring user pointers. (imported from commit 84d3288dffc1cb010d8cd2a749fe71aa2a4d0df3)
Python
apache-2.0
KingxBanana/zulip,zachallaun/zulip,themass/zulip,avastu/zulip,bastianh/zulip,bitemyapp/zulip,EasonYi/zulip,lfranchi/zulip,levixie/zulip,pradiptad/zulip,adnanh/zulip,hengqujushi/zulip,vaidap/zulip,ashwinirudrappa/zulip,reyha/zulip,brainwane/zulip,arpitpanwar/zulip,reyha/zulip,grave-w-grave/zulip,KJin99/zulip,Gabriel0402...
--- +++ @@ -11,7 +11,7 @@ def restore(change): for (email, pointer) in simplejson.loads(file("dumped-pointers").read()): - u = UserProfile.objects.get(user__email=email) + u = UserProfile.objects.get(user__email__iexact=email) print "%s: pointer %s => %s" % (email, u.pointer, pointer) ...
4742f587e3e66fd1916dcb7200517e2ac06ddcf4
uconnrcmpy/__init__.py
uconnrcmpy/__init__.py
from .ignitiondelayexp import ExperimentalIgnitionDelay from .compare_to_sim import CompareToSimulation from .volume_trace import VolumeTraceBuilder from .nonreactive import NonReactiveExperiments __all__ = [ 'ExperimentalIgnitionDelay', 'CompareToSimulation', 'VolumeTraceBuilder', 'NonReactiveExperime...
import sys if sys.version_info[0] < 3 and sys.version_info[1] < 4: raise Exception('Python 3.4 is required to use this package.') from .ignitiondelayexp import ExperimentalIgnitionDelay from .compare_to_sim import CompareToSimulation from .volume_trace import VolumeTraceBuilder from .nonreactive import NonReactive...
Enforce Python >= 3.4 on import of the package
Enforce Python >= 3.4 on import of the package Python 3.4 is required for the pathlib module
Python
bsd-3-clause
bryanwweber/UConnRCMPy
--- +++ @@ -1,3 +1,7 @@ +import sys +if sys.version_info[0] < 3 and sys.version_info[1] < 4: + raise Exception('Python 3.4 is required to use this package.') + from .ignitiondelayexp import ExperimentalIgnitionDelay from .compare_to_sim import CompareToSimulation from .volume_trace import VolumeTraceBuilder
77cf2fb0f63a5520de3b8b3456ce4c9181b91d16
spacy/tests/regression/test_issue595.py
spacy/tests/regression/test_issue595.py
from __future__ import unicode_literals import pytest from ...symbols import POS, VERB, VerbForm_inf from ...tokens import Doc from ...vocab import Vocab from ...lemmatizer import Lemmatizer @pytest.fixture def index(): return {'verb': {}} @pytest.fixture def exceptions(): return {'verb': {}} @pytest.fixtu...
from __future__ import unicode_literals import pytest from ...symbols import POS, VERB, VerbForm_inf from ...tokens import Doc from ...vocab import Vocab from ...lemmatizer import Lemmatizer @pytest.fixture def index(): return {'verb': {}} @pytest.fixture def exceptions(): return {'verb': {}} @pytest.fixtu...
Remove unnecessary argument in test
Remove unnecessary argument in test
Python
mit
oroszgy/spaCy.hu,honnibal/spaCy,banglakit/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,recognai/spaCy,raphael0202/spaCy,recognai/spaCy,recognai/spaCy,explosion/spaCy,banglakit/spaCy,Gregory-Howard/spaCy,recognai/spaCy,Gregory-Howard/spaCy,raphael0202/spaCy,honnibal/spaCy,Gregory-Howard/spaCy,oroszgy/spaCy.hu,s...
--- +++ @@ -34,7 +34,7 @@ return Vocab(lemmatizer=lemmatizer, tag_map=tag_map) -def test_not_lemmatize_base_forms(vocab, lemmatizer): +def test_not_lemmatize_base_forms(vocab): doc = Doc(vocab, words=["Do", "n't", "feed", "the", "dog"]) feed = doc[2] feed.tag_ = u'VB'
bca3c8f7b2c12b86e0d200009d23201bdc05d716
make_spectra.py
make_spectra.py
# -*- coding: utf-8 -*- import randspectra as rs import sys import os.path as path snapnum=sys.argv[1] sim=sys.argv[2] #base="/n/hernquistfs1/mvogelsberger/projects/GFM/Production/Cosmo/Cosmo"+str(sim)+"_V6/L25n512/output/" #savedir="/n/home11/spb/scratch/Cosmo/Cosmo"+str(sim)+"_V6_512/snapdir_"+str(snapnum).rjust(3,'...
# -*- coding: utf-8 -*- import randspectra as rs import sys import os.path as path snapnum=sys.argv[1] sim=sys.argv[2] #base="/n/hernquistfs1/mvogelsberger/projects/GFM/Production/Cosmo/Cosmo"+str(sim)+"_V6/L25n512/output/" #savedir="/n/home11/spb/scratch/Cosmo/Cosmo"+str(sim)+"_V6_512/snapdir_"+str(snapnum).rjust(3,'...
Handle the case where the savefile already exists by moving it out of the way
Handle the case where the savefile already exists by moving it out of the way
Python
mit
sbird/vw_spectra
--- +++ @@ -9,6 +9,7 @@ #savedir="/n/home11/spb/scratch/Cosmo/Cosmo"+str(sim)+"_V6_512/snapdir_"+str(snapnum).rjust(3,'0') base=path.expanduser("~/data/Cosmo/Cosmo"+str(sim)+"_V6/L25n512") halo = rs.RandSpectra(snapnum, base) +halo.save_file() halo.get_observer_tau("Si",2) halo.get_col_density("H",1) #halo.get_...
bed7f5c80f6c5b5ce9b9a17aea5c9eadd047ee47
mfr/conftest.py
mfr/conftest.py
"""Project-wide test configuration, including fixutres that can be used by any module. Example test: :: def test_my_renderer(fakefile): assert my_renderer(fakefile) == '..expected result..' """ import io import pytest @pytest.fixture def fakefile(): return io.BytesIO(b'foo')
"""Project-wide test configuration, including fixutres that can be used by any module. Example test: :: def test_my_renderer(fakefile): assert my_renderer(fakefile) == '..expected result..' """ import pytest import mock @pytest.fixture def fakefile(): """A simple file-like object.""" return mock...
Make fakefile a mock instead of an io object
Make fakefile a mock instead of an io object Makes it possible to mutate attributes, e.g. the name, for tests
Python
apache-2.0
felliott/modular-file-renderer,CenterForOpenScience/modular-file-renderer,mfraezz/modular-file-renderer,CenterForOpenScience/modular-file-renderer,Johnetordoff/modular-file-renderer,mfraezz/modular-file-renderer,icereval/modular-file-renderer,icereval/modular-file-renderer,AddisonSchiller/modular-file-renderer,chrisset...
--- +++ @@ -7,9 +7,10 @@ assert my_renderer(fakefile) == '..expected result..' """ -import io import pytest +import mock @pytest.fixture def fakefile(): - return io.BytesIO(b'foo') + """A simple file-like object.""" + return mock.Mock(spec=file)
3770095f087309efe901c2f22afd29ba6f3ddd18
comrade/core/context_processors.py
comrade/core/context_processors.py
from django.conf import settings from django.contrib.sites.models import Site from settings import DeploymentType def default(request): context = {} context['DEPLOYMENT'] = settings.DEPLOYMENT context['current_site'] = Site.objects.get_current() if settings.DEPLOYMENT != DeploymentType.PRODUCTION: ...
from django.conf import settings from django.contrib.sites.models import Site from settings import DeploymentType def default(request): context = {} context['DEPLOYMENT'] = settings.DEPLOYMENT context['current_site'] = Site.objects.get_current() if settings.DEPLOYMENT != DeploymentType.PRODUCTION: ...
Add a context processor that adds the UserProfile to each context.
Add a context processor that adds the UserProfile to each context.
Python
mit
bueda/django-comrade
--- +++ @@ -17,6 +17,12 @@ context['current_site'].domain) return context +def profile(request): + context = {} + if request.user.is_authenticated(): + context['profile'] = request.user.get_profile() + return context + def ssl_media(request): if request.is_secure(): ...
921e315e61355d80caea673ce09f8944388d86e2
tests/unit/util/test_cache.py
tests/unit/util/test_cache.py
"""Test praw.util.cache.""" from .. import UnitTest from praw.util.cache import cachedproperty class TestCachedProperty(UnitTest): class Klass: @cachedproperty def nine(self): """Return 9.""" return 9 def ten(self): return 10 ten = cachedprop...
"""Test praw.util.cache.""" from .. import UnitTest from praw.util.cache import cachedproperty class TestCachedProperty(UnitTest): class Klass: @cachedproperty def nine(self): """Return 9.""" return 9 def ten(self): return 10 ten = cachedprop...
Test for property ten as well
Test for property ten as well
Python
bsd-2-clause
praw-dev/praw,gschizas/praw,praw-dev/praw,gschizas/praw
--- +++ @@ -22,6 +22,9 @@ assert "nine" not in klass.__dict__ assert klass.nine == 9 assert "nine" in klass.__dict__ + assert "ten" not in klass.__dict__ + assert klass.ten == 10 + assert "ten" in klass.__dict__ def test_repr(self): klass = self.Klass() ...
6f29293e6f447dfd80d10c173b7c5a6cc13a4243
main/urls.py
main/urls.py
from django.conf.urls import url from django.views import generic from . import views app_name = 'main' urlpatterns = [ url(r'^$', views.AboutView.as_view(), name='about'), url(r'^chas/$', views.AboutChasView.as_view(), name='chas'), url(r'^evan/$', views.AboutEvanView.as_view(), name='evan'), ]
from django.urls import include, path from . import views app_name = 'main' urlpatterns = [ path('', views.AboutView.as_view(), name='about'), path('chas/', views.AboutChasView.as_view(), name='chas'), path('evan/', views.AboutEvanView.as_view(), name='evan'), ]
Move some urlpatterns to DJango 2.0 preferred method
Move some urlpatterns to DJango 2.0 preferred method
Python
mit
evanepio/dotmanca,evanepio/dotmanca,evanepio/dotmanca
--- +++ @@ -1,11 +1,10 @@ -from django.conf.urls import url -from django.views import generic +from django.urls import include, path from . import views app_name = 'main' urlpatterns = [ - url(r'^$', views.AboutView.as_view(), name='about'), - url(r'^chas/$', views.AboutChasView.as_view(), name='chas'), ...
3de9cd44ef803b7c7f3e05e29ecaa30113caf1ba
test/db/relations.py
test/db/relations.py
import unittest from firmant.db.relations import schema class TestSchemaLoad(unittest.TestCase): def testLoad(self): if schema('loader-works') != 'SCHEMA LOAD WORKING PROPERLY': self.fail() suite = unittest.TestLoader().loadTestsFromTestCase(TestSchemaLoad)
import unittest from firmant.db.relations import schema class TestSchemaLoad(unittest.TestCase): def testLoad(self): self.assertEqual(schema('loader-works'), 'SCHEMA LOAD WORKING PROPERLY') suite = unittest.TestLoader().loadTestsFromTestCase(TestSchemaLoad)
Update the schema load test.
Update the schema load test. It now has 100% coverage if the tests pass.
Python
bsd-3-clause
rescrv/firmant
--- +++ @@ -6,7 +6,6 @@ class TestSchemaLoad(unittest.TestCase): def testLoad(self): - if schema('loader-works') != 'SCHEMA LOAD WORKING PROPERLY': - self.fail() + self.assertEqual(schema('loader-works'), 'SCHEMA LOAD WORKING PROPERLY') suite = unittest.TestLoader().loadTestsFromTe...
ad7e1149081461d2d34578e06cf5f470d2d20e71
tomviz/python/Subtract_TiltSer_Background.py
tomviz/python/Subtract_TiltSer_Background.py
def transform_scalars(dataset): from tomviz import utils import numpy as np #----USER SPECIFIED VARIABLES-----# ###XRANGE### ###YRANGE### ###ZRANGE### #---------------------------------# data_bs = utils.get_array(dataset) #get data as numpy array if data_bs is None: #Check if ...
def transform_scalars(dataset): from tomviz import utils import numpy as np #----USER SPECIFIED VARIABLES-----# ###XRANGE### ###YRANGE### ###ZRANGE### #---------------------------------# data_bs = utils.get_array(dataset) #get data as numpy array data_bs = data_bs.astype(np.float3...
Change tilt series type to float in manual background sub.
Change tilt series type to float in manual background sub.
Python
bsd-3-clause
cjh1/tomviz,cryos/tomviz,cjh1/tomviz,mathturtle/tomviz,thewtex/tomviz,OpenChemistry/tomviz,cryos/tomviz,cryos/tomviz,OpenChemistry/tomviz,thewtex/tomviz,thewtex/tomviz,cjh1/tomviz,mathturtle/tomviz,OpenChemistry/tomviz,OpenChemistry/tomviz,mathturtle/tomviz
--- +++ @@ -9,7 +9,9 @@ #---------------------------------# data_bs = utils.get_array(dataset) #get data as numpy array - + + data_bs = data_bs.astype(np.float32) #change tilt series type to float + if data_bs is None: #Check if data exists raise RuntimeError("No data array found!") ...
850c5c6f133fdfd131605eb1bf1e971b33dd7416
website/addons/twofactor/tests/test_views.py
website/addons/twofactor/tests/test_views.py
from nose.tools import * from webtest_plus import TestApp from tests.base import OsfTestCase from tests.factories import AuthUserFactory from website.app import init_app from website.addons.twofactor.tests import _valid_code app = init_app( routes=True, set_backends=False, settings_module='website.setting...
from nose.tools import * from webtest.app import AppError from webtest_plus import TestApp from tests.base import OsfTestCase from tests.factories import AuthUserFactory from website.app import init_app from website.addons.twofactor.tests import _valid_code app = init_app( routes=True, set_backends=False, ...
Add test for failure to confirm 2FA code
Add test for failure to confirm 2FA code
Python
apache-2.0
doublebits/osf.io,brianjgeiger/osf.io,billyhunt/osf.io,cwisecarver/osf.io,CenterForOpenScience/osf.io,barbour-em/osf.io,wearpants/osf.io,MerlinZhang/osf.io,alexschiller/osf.io,brandonPurvis/osf.io,haoyuchen1992/osf.io,SSJohns/osf.io,HalcyonChimera/osf.io,dplorimer/osf,amyshi188/osf.io,SSJohns/osf.io,chrisseto/osf.io,ti...
--- +++ @@ -1,4 +1,5 @@ from nose.tools import * +from webtest.app import AppError from webtest_plus import TestApp from tests.base import OsfTestCase @@ -35,4 +36,17 @@ assert_true(self.user_settings.is_confirmed) assert_equal(res.status_code, 200) + def test_confirm_code_failure(self): +...
33550cab832da5b90cf2fb5af2f211840dfe2caa
test/mintraatests.py
test/mintraatests.py
import cherrypy import os import raatest from conary import dbstore from conary.server import schema class webPluginTest(raatest.webTest): def __init__( self, module = None, init = True, preInit = None, preConst = None): def func(rt): cherrypy.root.servicecfg.pluginDirs = [os.path.abs...
import cherrypy import os import raatest from conary import dbstore from conary.server import schema class webPluginTest(raatest.webTest): def __init__( self, module = None, init = True, preInit = None, preConst = None): def func(rt): cherrypy.root.servicecfg.pluginDirs = [os.path.abs...
Fix relative path to plugin directories (RBL-2737)
Fix relative path to plugin directories (RBL-2737)
Python
apache-2.0
sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint
--- +++ @@ -10,7 +10,7 @@ self, module = None, init = True, preInit = None, preConst = None): def func(rt): - cherrypy.root.servicecfg.pluginDirs = [os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "raaplugins"))] + cherrypy.root.servicecfg.pluginDirs = [os...
78f2ff20e86a7801c9b28cff17f3fe7db93c2788
alerts/views.py
alerts/views.py
from django.shortcuts import render from django.contrib import messages # Create your views here. def test(request): messages.debug(request, 'This is a debug alert') messages.info(request, 'This is an info alert') messages.success(request, 'This is a success alert') messages.warning(request, 'This is ...
from django.shortcuts import render from django.contrib import messages # Create your views here. def test(request): messages.set_level(request, messages.DEBUG) messages.debug(request, 'This is a debug alert') messages.info(request, 'This is an info alert') messages.success(request, 'This is a succes...
Set message level to DEBUG in test view
Set message level to DEBUG in test view
Python
mit
Kromey/akwriters,Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/fbxnano
--- +++ @@ -4,6 +4,8 @@ # Create your views here. def test(request): + messages.set_level(request, messages.DEBUG) + messages.debug(request, 'This is a debug alert') messages.info(request, 'This is an info alert') messages.success(request, 'This is a success alert')
4744f3b3e5193ad66a4bba64d8a8d8c4e328fdcc
pychat.py
pychat.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from lib.login import Login def pychat(): login = Login login() if __name__ == '__main__': pychat()
#!/usr/bin/env python # -*- coding: utf-8 -*- from lib.login import Login from lib.client import Client from Tkinter import * class PyChat(object): def __init__(self): self.root = Tk() self.root.geometry("300x275+400+100") def login(self): self.login = Login(self.root, self.create_c...
Rework to have a central root window controlled from a top class
Rework to have a central root window controlled from a top class
Python
mit
tijko/PyChat
--- +++ @@ -2,12 +2,34 @@ # -*- coding: utf-8 -*- from lib.login import Login +from lib.client import Client +from Tkinter import * -def pychat(): - login = Login - login() +class PyChat(object): + + def __init__(self): + self.root = Tk() + self.root.geometry("300x275+400+100") + + d...
f49c132f0bc90daf98b89bcf7270a2d37cd411d2
tools/hexlifyscript.py
tools/hexlifyscript.py
''' Turn a Python script into Intel HEX format to be concatenated at the end of the MicroPython firmware.hex. A simple header is added to the script. ''' import sys import struct import binascii # read script body with open(sys.argv[1], "rb") as f: data = f.read() # add header, pad to multiple of 16 bytes data ...
''' Turn a Python script into Intel HEX format to be concatenated at the end of the MicroPython firmware.hex. A simple header is added to the script. ''' import sys import struct import binascii # read script body with open(sys.argv[1], "rb") as f: data = f.read() # add header, pad to multiple of 16 bytes data ...
Fix bug in heexlifyscript.py when computing checksum.
Fix bug in heexlifyscript.py when computing checksum.
Python
mit
JoeGlancy/micropython,JoeGlancy/micropython,JoeGlancy/micropython
--- +++ @@ -22,7 +22,7 @@ for i in range(0, len(data), 16): chunk = data[i:min(i + 16, len(data))] chunk = struct.pack('>BHB', len(chunk), addr & 0xffff, 0) + chunk - checksum = (-(sum(data))) & 0xff + checksum = (-(sum(chunk))) & 0xff hexline = ':%s%02X' % (str(binascii.hexlify(chunk), 'utf8')....
e40ef4cbe59c5c3d064e60f02f60f19b0bb202a4
test_daily_parser.py
test_daily_parser.py
#!/usr/bin/env python # -*- coding: latin-1 -*- """Unit tests.""" import unittest from daily_parser import url_from_args class TestDailyParser(unittest.TestCase): """Testing methods from daily_parser.""" def test_url_from_args(self): output = url_from_args(2014, 1) expected = 'https://dons...
#!/usr/bin/env python # -*- coding: latin-1 -*- """Unit tests.""" import unittest from daily_parser import url_from_args, DonationsParser class TestDailyParser(unittest.TestCase): """Testing methods from daily_parser.""" def test_url_from_args(self): output = url_from_args(2014, 1) expecte...
Add unit test for DonationsParser.get_csv
Add unit test for DonationsParser.get_csv
Python
mit
Commonists/DonationsLogParser,Commonists/DonationsLogParser
--- +++ @@ -4,7 +4,7 @@ """Unit tests.""" import unittest -from daily_parser import url_from_args +from daily_parser import url_from_args, DonationsParser class TestDailyParser(unittest.TestCase): @@ -15,3 +15,24 @@ output = url_from_args(2014, 1) expected = 'https://dons.wikimedia.fr/journ...
2377f500d4667623da9a2921c62862b00d7f404c
school/frontend/views.py
school/frontend/views.py
from flask import Blueprint, render_template, url_for, redirect, flash from flask.ext.login import login_required, logout_user, current_user, login_user from .forms import LoginForm from school.config import FLASH_SUCCESS, FLASH_INFO, FLASH_WARNING frontend = Blueprint('frontend', __name__) @frontend.route('/login',...
from flask import Blueprint, render_template, url_for, redirect, flash from flask.ext.login import login_required, logout_user, current_user, login_user from .forms import LoginForm from school.config import FLASH_SUCCESS, FLASH_INFO, FLASH_WARNING frontend = Blueprint('frontend', __name__) @frontend.route('/login',...
Remove flash success message when logging in.
Remove flash success message when logging in.
Python
mit
leyyin/university-SE,leyyin/university-SE,leyyin/university-SE
--- +++ @@ -14,7 +14,6 @@ form = LoginForm() if form.validate_on_submit(): - flash('Successfully logged in as %s' % form.user.username, FLASH_SUCCESS) login_user(form.user) return form.redirect("user.index")
7aedc2151035174632a7f3e55be7563f71e65117
tests/audio/test_loading.py
tests/audio/test_loading.py
import pytest @pytest.mark.xfail def test_missing_file(audiomgr): sound = audiomgr.get_sound('/not/a/valid/file.ogg') assert sound is None
import pytest def test_missing_file(audiomgr): sound = audiomgr.get_sound('/not/a/valid/file.ogg') assert str(sound).startswith('NullAudioSound')
Update audio test to recognize missing sounds as NullAudioSound
tests: Update audio test to recognize missing sounds as NullAudioSound
Python
bsd-3-clause
chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d
--- +++ @@ -1,6 +1,5 @@ import pytest -@pytest.mark.xfail def test_missing_file(audiomgr): sound = audiomgr.get_sound('/not/a/valid/file.ogg') - assert sound is None + assert str(sound).startswith('NullAudioSound')
9c5349595dca8013f1353785bbd34fb3d7cd4a6a
misc/__init__.py
misc/__init__.py
# -*- coding: utf-8 -*- import logging __version__ = VERSION = '0.0.1' __project__ = PROJECT = 'django-misc' log = logging.getLogger( __name__ )
# -*- coding: utf-8 -*- import logging __version__ = VERSION = '0.0.2' __project__ = PROJECT = 'django-misc' log = logging.getLogger( __name__ )
Change version to 0.0.2 to update pypi repo
Change version to 0.0.2 to update pypi repo
Python
mit
ilblackdragon/django-misc
--- +++ @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -__version__ = VERSION = '0.0.1' +__version__ = VERSION = '0.0.2' __project__ = PROJECT = 'django-misc' log = logging.getLogger( __name__ )
66c50cdeda974f2159259b466995339244ffb694
training/level-2-command-line-interfaces/dragon-warrior/tmarsha1/primes/Tests/PrimeFinderTests.py
training/level-2-command-line-interfaces/dragon-warrior/tmarsha1/primes/Tests/PrimeFinderTests.py
""" Test the Prime Finder class Still working on getting dependency injection working. """ import unittest from primes.Primes import PrimeFinder #from primes.Primes import PrimeGenerator class PrimeFinderTests(unittest.TestCase): def test_find_prime(self): prime_finder = PrimeFinder.PrimeFinder(PrimeGene...
""" Test the Prime Finder class Still working on getting dependency injection working. Injecting the Generator into the Finder allows for many possibilities. From the testing perspective this would allow me to inject a mock object for the Generator that returns a set value speeding up the testing of the Prime Finder c...
Add additional comments regarding Dependency Injection
Add additional comments regarding Dependency Injection
Python
artistic-2.0
bigfatpanda-training/pandas-practical-python-primer,bigfatpanda-training/pandas-practical-python-primer
--- +++ @@ -2,6 +2,10 @@ Test the Prime Finder class Still working on getting dependency injection working. +Injecting the Generator into the Finder allows for many possibilities. +From the testing perspective this would allow me to inject a mock object +for the Generator that returns a set value speeding up the ...
7a7729e9af8e91411526525c19c5d434609e0f21
logger.py
logger.py
MSG_INFO = 0x01 MSG_WARNING = 0x02 MSG_ERROR = 0x04 MSG_VERBOSE = 0x08 MSG_ALL = MSG_INFO | MSG_WARNING | MSG_ERROR | MSG_VERBOSE def logi(msg): print("[INFO] " + msg) def logv(msg): print("[VERBOSE] " + msg) def logw(msg): print("[WARNING] " + msg) def loge(msg): print("[ERROR] " + msg) clas...
MSG_INFO = 0x01 MSG_WARNING = 0x02 MSG_ERROR = 0x04 MSG_VERBOSE = 0x08 MSG_ALL = MSG_INFO | MSG_WARNING | MSG_ERROR | MSG_VERBOSE def logi(msg): print("[INFO] " + msg) def logv(msg): print("[VERBOSE] " + msg) def logw(msg): print("[WARNING] " + msg) def loge(msg): print("\033[1;31m[ERROR] " + ...
Add color for error message.
Add color for error message.
Python
mit
PyOCL/oclGA,PyOCL/OpenCLGA,PyOCL/OpenCLGA,PyOCL/oclGA,PyOCL/oclGA,PyOCL/TSP,PyOCL/TSP,PyOCL/oclGA,PyOCL/OpenCLGA
--- +++ @@ -11,7 +11,7 @@ def logw(msg): print("[WARNING] " + msg) def loge(msg): - print("[ERROR] " + msg) + print("\033[1;31m[ERROR] " + msg + "\033[m") class Logger(object): def __init__(self):
d3b326e421ca482723cafcadd2442eebb8cf2ee6
bot/main.py
bot/main.py
import os import json import time import socket from subprocess import call import requests from test import test_activity from build import compile_bundle # Fixes a weird bug... it might create some though :P os.environ['http_proxy'] = '' # HOST = 'http://localhost:5001' HOST = 'http://aslo-bot-master.sugarlabs.or...
import os import json import time import socket from subprocess import call import requests from test import test_activity from build import compile_bundle # Fixes a weird bug... it might create some though :P os.environ['http_proxy'] = '' # HOST = 'http://localhost:5001' HOST = 'http://aslo-bot-master.sugarlabs.or...
Stop bots from randomly disconnecting
Stop bots from randomly disconnecting
Python
agpl-3.0
samdroid-apps/aslo,samdroid-apps/aslo,samdroid-apps/aslo
--- +++ @@ -18,7 +18,10 @@ print 'Waiting for 1st task' while True: - r = requests.get(HOST + '/task') + try: + r = requests.get(HOST + '/task') + except requests.exceptions.ConnectionError, e: + continue if r.status_code == 404: time.sleep(7) continue
fc50a002e967f8e3b7de205a866e010dda717962
logger.py
logger.py
import os import logging def logger_setup(name): loglevel = '' try: if os.environ['PB_LOGLEVEL'] == 'DEBUG': loglevel = logging.DEBUG if os.environ['PB_LOGLEVEL'] == 'INFO': loglevel = logging.INFO if os.environ['PB_LOGLEVEL'] == 'WARN': loglevel = ...
import os import logging def logger_setup(name): loglevel = '' try: if os.environ['PB_LOGLEVEL'] == 'DEBUG': loglevel = logging.DEBUG if os.environ['PB_LOGLEVEL'] == 'INFO': loglevel = logging.INFO if os.environ['PB_LOGLEVEL'] == 'WARN': loglevel = ...
Add file transport and update log msg formatting to include pid and fn name
Add file transport and update log msg formatting to include pid and fn name
Python
mit
zeusdeux/zulip-pairing-bot
--- +++ @@ -20,17 +20,25 @@ logger = logging.getLogger(name) logger.setLevel(loglevel) + # formatter + formatter = logging.Formatter('PID: %(process)d - %(asctime)s - %(name)s - %(levelname)s - %(funcName)s - %(message)s') + # console handler for logging conLog = logging.StreamHandler() ...
4f71339cad35b2444ea295fd4b518e539f1088bb
fluent_faq/urls.py
fluent_faq/urls.py
from django.conf.urls import patterns, url from .views import FaqQuestionList, FaqCategoryDetail, FaqQuestionDetail urlpatterns = patterns('', url(r'^$', FaqQuestionList.as_view(), name='faqquestion_index'), url(r'^(?P<slug>[^/]+)/$', FaqCategoryDetail.as_view(), name='faqcategory_detail'), url(r'^(?P<cat_...
from django.conf.urls import url from .views import FaqQuestionList, FaqCategoryDetail, FaqQuestionDetail urlpatterns = [ url(r'^$', FaqQuestionList.as_view(), name='faqquestion_index'), url(r'^(?P<slug>[^/]+)/$', FaqCategoryDetail.as_view(), name='faqcategory_detail'), url(r'^(?P<cat_slug>[^/]+)/(?P<slug>...
Fix Django 1.9 warnings about patterns('', ..)
Fix Django 1.9 warnings about patterns('', ..)
Python
apache-2.0
edoburu/django-fluent-faq,edoburu/django-fluent-faq
--- +++ @@ -1,8 +1,8 @@ -from django.conf.urls import patterns, url +from django.conf.urls import url from .views import FaqQuestionList, FaqCategoryDetail, FaqQuestionDetail -urlpatterns = patterns('', +urlpatterns = [ url(r'^$', FaqQuestionList.as_view(), name='faqquestion_index'), url(r'^(?P<slug>[^/]...
f113123a3f31e176ae7165f1ca11118dc00625a3
tests/test_backend_forms.py
tests/test_backend_forms.py
import floppyforms.__future__ as floppyforms from django.test import TestCase from django_backend.backend.base.forms import BaseBackendForm from .models import OneFieldModel class OneFieldForm(BaseBackendForm): class Meta: model = OneFieldModel exclude = () class BaseBackendFormTests(TestCase)...
import floppyforms.__future__ as floppyforms from django.test import TestCase from django_backend.forms import BaseBackendForm from .models import OneFieldModel class OneFieldForm(BaseBackendForm): class Meta: model = OneFieldModel exclude = () class BaseBackendFormTests(TestCase): def tes...
Fix forms import in tests
Fix forms import in tests
Python
bsd-3-clause
team23/django_backend,team23/django_backend,team23/django_backend,team23/django_backend,team23/django_backend
--- +++ @@ -1,7 +1,7 @@ import floppyforms.__future__ as floppyforms from django.test import TestCase -from django_backend.backend.base.forms import BaseBackendForm +from django_backend.forms import BaseBackendForm from .models import OneFieldModel
e291ae29926a3cd05c9268c625e14d205638dfe8
jarn/mkrelease/scp.py
jarn/mkrelease/scp.py
import tempfile import tee from process import Process from exit import err_exit class SCP(object): """Secure copy and FTP abstraction.""" def __init__(self, process=None): self.process = process or Process() def run_scp(self, distfile, location): if not self.process.quiet: ...
import tempfile import tee from os.path import split from process import Process from chdir import ChdirStack from exit import err_exit class SCP(object): """Secure copy and FTP abstraction.""" def __init__(self, process=None): self.process = process or Process() self.dirstack = ChdirStack(...
Change to dist dir before uploading to lose the absolute path.
Change to dist dir before uploading to lose the absolute path.
Python
bsd-2-clause
Jarn/jarn.mkrelease
--- +++ @@ -1,7 +1,10 @@ import tempfile import tee +from os.path import split + from process import Process +from chdir import ChdirStack from exit import err_exit @@ -10,6 +13,7 @@ def __init__(self, process=None): self.process = process or Process() + self.dirstack = ChdirStack() ...
6b9ccae880e9582f38e2a8aa3c451bc6f6a88d37
thing/tasks/tablecleaner.py
thing/tasks/tablecleaner.py
import datetime from celery import task from celery.utils.log import get_task_logger logger = get_task_logger(__name__) from django.db.models import Q from thing.models import APIKey, TaskState # --------------------------------------------------------------------------- # Periodic task to perform database table cl...
import datetime from celery import task from celery.utils.log import get_task_logger logger = get_task_logger(__name__) from django.db.models import Q from thing.models import APIKey, TaskState # --------------------------------------------------------------------------- # Periodic task to perform database table cl...
Change thing.tasks.table_cleaner to delete TaskState objects for any invalid APIKeys
Change thing.tasks.table_cleaner to delete TaskState objects for any invalid APIKeys
Python
bsd-2-clause
madcowfred/evething,madcowfred/evething,Gillingham/evething,Gillingham/evething,cmptrgeekken/evething,madcowfred/evething,Gillingham/evething,cmptrgeekken/evething,cmptrgeekken/evething,Gillingham/evething,madcowfred/evething,cmptrgeekken/evething,cmptrgeekken/evething
--- +++ @@ -20,7 +20,7 @@ taskstates = TaskState.objects.filter(state=TaskState.QUEUED_STATE, mod_time__lte=queued_timeout) for ts in taskstates: logger.warn('[table_cleaner] Stuck task: %d | %d | %s | %s', ts.id, ts.keyid, ts.parameter, ts.url) - + count = taskstates.update(mod_time=utcno...
e1c970d76dbd0eb631e726e101b09c0f5e5599ec
doc/api_changes/2015-04-27-core.py
doc/api_changes/2015-04-27-core.py
Grid-building functions ----------------------- :func:`pixels_to_radius` and :func:`pixels_to_phi` were renamed to :func:`radial_grid` and :func:`angle_grid` respectively. The name and order of their arguments was also changed: see their docstring or API docs for details.
Grid-building functions ----------------------- :func:`pixels_to_radius` and :func:`pixels_to_phi` were renamed to :func:`radial_grid` and :func:`angle_grid` respectively. The name and order of their arguments was also changed: see their docstring or API docs for details. Importantly, the orientation of the output of ...
Add change in angle_grid orientation to API changes.
DOC: Add change in angle_grid orientation to API changes.
Python
bsd-3-clause
licode/scikit-xray,Nikea/scikit-xray,hainm/scikit-xray,celiafish/scikit-xray,licode/scikit-beam,CJ-Wright/scikit-beam,CJ-Wright/scikit-beam,tacaswell/scikit-xray,giltis/scikit-xray,ericdill/scikit-xray,scikit-xray/scikit-xray,yugangzhang/scikit-beam,scikit-xray/scikit-xray,giltis/scikit-xray,danielballan/scikit-xray,ta...
--- +++ @@ -4,4 +4,5 @@ :func:`pixels_to_radius` and :func:`pixels_to_phi` were renamed to :func:`radial_grid` and :func:`angle_grid` respectively. The name and order of their arguments was also changed: see their docstring or API docs for -details. +details. Importantly, the orientation of the output of angle gri...
6974cba56413527c8b7cef9e4b6ad6ca9fe5049e
tests/test_memory.py
tests/test_memory.py
# coding: utf-8 from unittest import TestCase from chipy8 import Memory class TestMemory(TestCase): def setUp(self): self.memory = Memory() def test_write(self): 'Write a byte to memory then read it.' address = 0x200 self.memory.write_byte(0x200, 0x01) self.assertEqual...
# coding: utf-8 from unittest import TestCase from chipy8 import Memory class TestMemory(TestCase): def setUp(self): self.memory = Memory() def test_write(self): 'Write a byte to memory then read it.' address = 0x200 self.memory.write_byte(address, 0x01) self.assertEqu...
Clarify values used in tests.
Clarify values used in tests.
Python
bsd-3-clause
gutomaia/chipy8
--- +++ @@ -10,13 +10,13 @@ def test_write(self): 'Write a byte to memory then read it.' address = 0x200 - self.memory.write_byte(0x200, 0x01) - self.assertEqual(0x01, self.memory.read_byte(0x200)) + self.memory.write_byte(address, 0x01) + self.assertEqual(0x01, self...
ff489b1541f896025a0c630be6abe2d23843ec36
examples/05_alternative_language.py
examples/05_alternative_language.py
#!/usr/bin/env python from pyhmsa.datafile import DataFile from pyhmsa.type.language import langstr datafile = DataFile() author = langstr('Fyodor Dostoyevsky', {'ru': u'Π€Ρ‘Π΄ΠΎΡ€ ΠœΠΈΡ…Π°ΜΠΉΠ»ΠΎΠ²ΠΈΡ‡ ДостоС́вский'}) datafile.header.author = author print(datafile.header.author.alternatives['ru']) # Returns ...
#!/usr/bin/env python from pyhmsa.datafile import DataFile from pyhmsa.type.language import langstr datafile = DataFile() author = langstr('Wilhelm Conrad Roentgen', {'de': u'Wilhelm Conrad RΓΆntgen'}) datafile.header.author = author print(datafile.header.author.alternatives['de']) # Returns ...
Replace name in alternative language to prevent compilation problems with LaTeX
Replace name in alternative language to prevent compilation problems with LaTeX
Python
mit
pyhmsa/pyhmsa
--- +++ @@ -4,7 +4,7 @@ from pyhmsa.type.language import langstr datafile = DataFile() -author = langstr('Fyodor Dostoyevsky', {'ru': u'Π€Ρ‘Π΄ΠΎΡ€ ΠœΠΈΡ…Π°ΜΠΉΠ»ΠΎΠ²ΠΈΡ‡ ДостоС́вский'}) +author = langstr('Wilhelm Conrad Roentgen', {'de': u'Wilhelm Conrad RΓΆntgen'}) datafile.header.author = author -print(datafile.header.author...
61fecbed71129228e7020a9e95dbcd2487bbdbb3
turbustat/tests/test_scf.py
turbustat/tests/test_scf.py
# Licensed under an MIT open source license - see LICENSE ''' Test functions for SCF ''' from unittest import TestCase import numpy as np import numpy.testing as npt from ..statistics import SCF, SCF_Distance from ._testing_data import \ dataset1, dataset2, computed_data, computed_distances class testSCF(Tes...
# Licensed under an MIT open source license - see LICENSE ''' Test functions for SCF ''' from unittest import TestCase import numpy as np import numpy.testing as npt from scipy.ndimage import zoom from ..statistics import SCF, SCF_Distance from ._testing_data import \ dataset1, dataset2, computed_data, compute...
Add simple SCF test for unequal grids
Add simple SCF test for unequal grids
Python
mit
e-koch/TurbuStat,Astroua/TurbuStat
--- +++ @@ -9,6 +9,7 @@ import numpy as np import numpy.testing as npt +from scipy.ndimage import zoom from ..statistics import SCF, SCF_Distance from ._testing_data import \ @@ -16,10 +17,6 @@ class testSCF(TestCase): - - def setUp(self): - self.dataset1 = dataset1 - self.dataset2 = dat...
698677a623722b63ec4cceb7690b62fa7e4ede37
django_prices_openexchangerates/templatetags/prices_multicurrency_i18n.py
django_prices_openexchangerates/templatetags/prices_multicurrency_i18n.py
from django.template import Library from django_prices.templatetags import prices_i18n from .. import exchange_currency register = Library() @register.simple_tag # noqa def gross_in_currency(price, currency): # noqa converted_price = exchange_currency(price, currency) return prices_i18n.gross(converted_pr...
from django.template import Library from django_prices.templatetags import prices_i18n from .. import exchange_currency register = Library() @register.simple_tag # noqa def gross_in_currency(price, currency): # noqa converted_price = exchange_currency(price, currency) return prices_i18n.gross(converted_pr...
Add templatetag for converting discounts between currencies
Add templatetag for converting discounts between currencies
Python
bsd-3-clause
mirumee/django-prices-openexchangerates,artursmet/django-prices-openexchangerates
--- +++ @@ -23,3 +23,10 @@ converted_price = exchange_currency(price, currency) return prices_i18n.tax(converted_price) + +@register.simple_tag +def discount_amount_in_currency(discount, price, currency): + price = exchange_currency(price, to_currency=currency) + discount_amount = exchange_currency(...
32a54ff0588930efc5e0ee3c61f2efbf57e450e0
inviter/tests.py
inviter/tests.py
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.contrib.auth.models import User from django.core.mail import get_connection from django.test import TestCase from inviter.uti...
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.contrib.auth.models import User from django.core.mail import outbox from django.test import TestCase from inviter.utils impor...
Test fix to check django.core.mail.outbox
Test fix to check django.core.mail.outbox
Python
mit
caffeinehit/django-inviter
--- +++ @@ -5,7 +5,7 @@ Replace this with more appropriate tests for your application. """ from django.contrib.auth.models import User -from django.core.mail import get_connection +from django.core.mail import outbox from django.test import TestCase from inviter.utils import invite import shortuuid @@ -16,22 +1...
9d6c8eaa491d0988bf16633bbba9847350f57778
spacy/lang/norm_exceptions.py
spacy/lang/norm_exceptions.py
# coding: utf8 from __future__ import unicode_literals # These exceptions are used to add NORM values based on a token's ORTH value. # Individual languages can also add their own exceptions and overwrite them - # for example, British vs. American spelling in English. # Norms are only set if no alternative is provide...
# coding: utf8 from __future__ import unicode_literals # These exceptions are used to add NORM values based on a token's ORTH value. # Individual languages can also add their own exceptions and overwrite them - # for example, British vs. American spelling in English. # Norms are only set if no alternative is provide...
Update base norm exceptions with more unicode characters
Update base norm exceptions with more unicode characters e.g. unicode variations of punctuation used in Chinese
Python
mit
aikramer2/spaCy,aikramer2/spaCy,recognai/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,honnibal/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,recognai/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/s...
--- +++ @@ -31,11 +31,21 @@ "β€ž": '"', "Β»": '"', "Β«": '"', + "β€˜β€˜": '"', + "’’": '"', + "?": "?", + "!": "!", + ",": ",", + "οΌ›": ";", + ":": ":", + "。": ".", + "ΰ₯€": ".", "…": "...", "β€”": "-", "–": "-", "--": "-", "---": "-", + "β€”β€”": "-", "€": "$...
56c4de583847be5fb16818dcd1ca855fc6007b50
pylsdj/__init__.py
pylsdj/__init__.py
__title__ = 'pylsdj' __version__ = '1.1.0' __build__ = 0x010100 __author__ = 'Alex Rasmussen' __license__ = 'MIT' __copyright__ = 'Copyright 2014 Alex Rasmussen' import bread_spec import chain import clock import consts import filepack from instrument import Instrument from phrase import Phrase from project import loa...
Make imports a little more intuitive.
Make imports a little more intuitive.
Python
mit
alexras/pylsdj,alexras/pylsdj
--- +++ @@ -0,0 +1,20 @@ +__title__ = 'pylsdj' +__version__ = '1.1.0' +__build__ = 0x010100 +__author__ = 'Alex Rasmussen' +__license__ = 'MIT' +__copyright__ = 'Copyright 2014 Alex Rasmussen' + +import bread_spec +import chain +import clock +import consts +import filepack +from instrument import Instrument +from phr...
770fd77e0fc7a0700b81e4418e5f97bd88d842d0
pymoira/filesys.py
pymoira/filesys.py
# ## PyMoira client library ## ## This file contains the more abstract methods which allow user to work with ## lists and list members. # import protocol import utils import datetime from errors import * class Filesys(object): info_query_description = ( ('label', str), ('type', str), ('mac...
# ## PyMoira client library ## ## This file contains the more abstract methods which allow user to work with ## lists and list members. # import protocol import utils import datetime from errors import * class Filesys(object): info_query_description = ( ('label', str), ('type', str), ('mac...
Fix a name collision for two types of types.
Fix a name collision for two types of types.
Python
mit
vasilvv/pymoira
--- +++ @@ -22,7 +22,7 @@ ('owner_user', str), ('owner_group', str), ('create', bool), - ('type', str), + ('locker_type', str), ('lastmod_datetime', datetime.datetime), ('lastmod_by', str), ('lastmod_with', str),
7394ba6eba50282bd7252e504a80e5d595dd12bc
ci/fix_paths.py
ci/fix_paths.py
import distutils.sysconfig from glob import glob import os from os.path import join as pjoin, basename from shutil import copy from sys import platform def main(): """ Copy HDF5 DLLs into installed h5py package """ # This is the function Tox also uses to locate site-packages (Apr 2019) sitepackages...
import distutils.sysconfig from glob import glob import os from os.path import join as pjoin, basename from shutil import copy from sys import platform def main(): """ Copy HDF5 DLLs into installed h5py package """ # This is the function Tox also uses to locate site-packages (Apr 2019) sitepackages...
Copy zlib.dll into Windows h5py installed from source
Copy zlib.dll into Windows h5py installed from source
Python
bsd-3-clause
h5py/h5py,h5py/h5py,h5py/h5py
--- +++ @@ -23,6 +23,12 @@ copy(f, pjoin(sitepackagesdir, 'h5py', basename(f))) print("Copied", f) + zlib_root = os.environ.get("ZLIB_ROOT") + if zlib_root: + f = pjoin(zlib_root, 'bin_release', 'zlib.dll') + copy(f, pjoin(sitepackagesdir, 'h5py', 'zlib....
6db2bb9b1634a7b37790207e5b8d420de643a9cb
turbasen/__init__.py
turbasen/__init__.py
VERSION = '1.0.0' def configure(**settings): from .settings import Settings for key, value in settings.items(): Settings.setattr(key, value)
VERSION = '1.0.0' from .models import \ Omrade, \ Sted def configure(**settings): from .settings import Settings for key, value in settings.items(): Settings.setattr(key, value)
Add relevant models to turbasen module
Add relevant models to turbasen module
Python
mit
Turbasen/turbasen.py
--- +++ @@ -1,4 +1,8 @@ VERSION = '1.0.0' + +from .models import \ + Omrade, \ + Sted def configure(**settings): from .settings import Settings
e8b1cee54f679cbd6a2d158b3c2789f3f6a3d9c0
uppercase.py
uppercase.py
from twisted.internet import protocol, reactor factory = protocol.ServerFactory() factory.protocol = protocol.Protocol reactor.listenTCP(8000, factory) reactor.run()
from twisted.internet import endpoints, protocol, reactor class UpperProtocol(protocol.Protocol): pass factory = protocol.ServerFactory() factory.protocol = UpperProtocol endpoints.serverFromString(reactor, 'tcp:8000').listen(factory) reactor.run()
Convert to endpoints API and use custom protocol class
Convert to endpoints API and use custom protocol class
Python
mit
cataliniacob/ep2012-tutorial-twisted
--- +++ @@ -1,7 +1,10 @@ -from twisted.internet import protocol, reactor +from twisted.internet import endpoints, protocol, reactor + +class UpperProtocol(protocol.Protocol): + pass factory = protocol.ServerFactory() -factory.protocol = protocol.Protocol +factory.protocol = UpperProtocol -reactor.listenTCP(80...
6b179dc4fb95f4db380b9156381b6210adeef2e5
conftest.py
conftest.py
# Copyright 2016 Google 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 law or ...
# Copyright 2016 Google 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 law or ...
Set the Project in code
Set the Project in code
Python
apache-2.0
GoogleCloudPlatform/getting-started-python,GoogleCloudPlatform/getting-started-python,GoogleCloudPlatform/getting-started-python
--- +++ @@ -17,7 +17,7 @@ import mock import pytest -PROJECT = os.environ['GCLOUD_PROJECT'] +PROJECT = 'python-docs-samples' @pytest.fixture
378f3bf0bb2e05260b7cbeeb4a4637d7d3a7ca7c
workflows/consumers.py
workflows/consumers.py
from urllib.parse import parse_qs from channels import Group from channels.sessions import channel_session @channel_session def ws_add(message): message.reply_channel.send({"accept": True}) qs = parse_qs(message['query_string']) workflow_pk = qs['workflow_pk'][0] message.channel_session['workflow_pk']...
from urllib.parse import parse_qs from channels import Group from channels.sessions import channel_session @channel_session def ws_add(message): message.reply_channel.send({"accept": True}) qs = parse_qs(message['query_string']) workflow_pk = qs[b'workflow_pk'][0].decode('utf-8') message.channel_sessi...
Fix query string problem of comparing byte strings and unicode strings in py3
Fix query string problem of comparing byte strings and unicode strings in py3
Python
mit
xflows/clowdflows-backend,xflows/clowdflows-backend,xflows/clowdflows-backend,xflows/clowdflows-backend
--- +++ @@ -7,7 +7,7 @@ def ws_add(message): message.reply_channel.send({"accept": True}) qs = parse_qs(message['query_string']) - workflow_pk = qs['workflow_pk'][0] + workflow_pk = qs[b'workflow_pk'][0].decode('utf-8') message.channel_session['workflow_pk'] = workflow_pk Group("workflow-{}...
9a7c80744bc1e57fe0ec5fc7cf149dada2d05121
neuroimaging/utils/tests/data/__init__.py
neuroimaging/utils/tests/data/__init__.py
"""Information used for locating nipy test data. Nipy uses a set of test data that is installed separately. The test data should be located in the directory ``~/.nipy/tests/data``. Install the data in your home directory from the data repository:: $ mkdir -p .nipy/tests/data $ svn co http://neuroimaging.scipy.or...
""" Nipy uses a set of test data that is installed separately. The test data should be located in the directory ``~/.nipy/tests/data``. Install the data in your home directory from the data repository:: $ mkdir -p .nipy/tests/data $ svn co http://neuroimaging.scipy.org/svn/ni/data/trunk/fmri .nipy/tests/data """...
Extend error message regarding missing test data.
Extend error message regarding missing test data.
Python
bsd-3-clause
alexis-roche/register,bthirion/nipy,bthirion/nipy,nipy/nipy-labs,alexis-roche/nipy,bthirion/nipy,alexis-roche/register,alexis-roche/nireg,bthirion/nipy,arokem/nipy,alexis-roche/register,alexis-roche/niseg,alexis-roche/nipy,arokem/nipy,nipy/nipy-labs,alexis-roche/nipy,alexis-roche/nipy,alexis-roche/nireg,arokem/nipy,aro...
--- +++ @@ -1,5 +1,4 @@ -"""Information used for locating nipy test data. - +""" Nipy uses a set of test data that is installed separately. The test data should be located in the directory ``~/.nipy/tests/data``. @@ -8,6 +7,12 @@ $ svn co http://neuroimaging.scipy.org/svn/ni/data/trunk/fmri .nipy/tests/data ...
446400fa4e40ca7e47e48dd00209d80858094552
buffer/managers/profiles.py
buffer/managers/profiles.py
import json from buffer.models.profile import PATHS, Profile class Profiles(list): def __init__(self, api, *args, **kwargs): super(Profiles, self).__init__(*args, **kwargs) self.api = api def all(self): response = self.api.get(url=PATHS['GET_PROFILES'], parser=json.loads) for raw_profile in re...
import json from buffer.models.profile import PATHS, Profile class Profiles(list): ''' Manage profiles + all -> get all the profiles from buffer + filter -> wrapper for list filtering ''' def __init__(self, api, *args, **kwargs): super(Profiles, self).__init__(*args, **kwargs) sel...
Write documentation for profile mananger
Write documentation for profile mananger
Python
mit
bufferapp/buffer-python,vtemian/buffpy
--- +++ @@ -3,6 +3,11 @@ from buffer.models.profile import PATHS, Profile class Profiles(list): + ''' + Manage profiles + + all -> get all the profiles from buffer + + filter -> wrapper for list filtering + ''' def __init__(self, api, *args, **kwargs): super(Profiles, self).__init__(...
1c7bbeabe1c1f3eea053c8fd8b6649ba388c1d2e
waliki/slides/views.py
waliki/slides/views.py
from os import path import shutil import tempfile from sh import hovercraft from django.shortcuts import get_object_or_404 from django.http import HttpResponse from waliki.models import Page def slides(request, slug): page = get_object_or_404(Page, slug=slug) outpath = tempfile.mkdtemp() try: infi...
from os import path import shutil import tempfile from sh import hovercraft from django.shortcuts import get_object_or_404 from django.http import HttpResponse from waliki.models import Page from waliki.acl import permission_required @permission_required('view_page') def slides(request, slug): page = get_object_o...
Add permission check to slide urls.
Add permission check to slide urls.
Python
bsd-3-clause
RobertoMaurizzi/waliki,aszepieniec/waliki,aszepieniec/waliki,OlegGirko/waliki,RobertoMaurizzi/waliki,rizotas/waliki,beres/waliki,beres/waliki,santiavenda2/waliki,mgaitan/waliki,fpytloun/waliki,OlegGirko/waliki,OlegGirko/waliki,santiavenda2/waliki,santiavenda2/waliki,beres/waliki,mgaitan/waliki,RobertoMaurizzi/waliki,as...
--- +++ @@ -5,8 +5,10 @@ from django.shortcuts import get_object_or_404 from django.http import HttpResponse from waliki.models import Page +from waliki.acl import permission_required +@permission_required('view_page') def slides(request, slug): page = get_object_or_404(Page, slug=slug) outpath = te...
ceac9c401f80a279e7291e7ba2a9e06757d4dd1d
buildtools/wrapper/cmake.py
buildtools/wrapper/cmake.py
import os from buildtools.bt_logging import log from buildtools.os_utils import cmd, ENV class CMake(object): def __init__(self): self.flags = {} self.generator = None def setFlag(self, key, val): log.info('CMake: {} = {}'.format(key, val)) self.flags[key] = val ...
import os from buildtools.bt_logging import log from buildtools.os_utils import cmd, ENV class CMake(object): def __init__(self): self.flags = {} self.generator = None def setFlag(self, key, val): log.info('CMake: {} = {}'.format(key, val)) self.flags[key] = val ...
Fix mismatched args in CMake.build
Fix mismatched args in CMake.build
Python
mit
N3X15/python-build-tools,N3X15/python-build-tools,N3X15/python-build-tools
--- +++ @@ -15,8 +15,8 @@ def build(self, CMAKE, dir='.', env=None, target=None, moreflags=[]): moreflags += ['--build'] if target is not None: - moreflags += ['--target',target] - self.run(CMAKE,dir,env,moreflags) + moreflags += ['--target', target] + self.r...
f04c451de83b66b733dc28eb13bc16ade2675b3a
changes/api/stream.py
changes/api/stream.py
from __future__ import absolute_import import gevent from gevent.queue import Queue from changes.config import pubsub class EventStream(object): def __init__(self, channels, pubsub=pubsub): self.pubsub = pubsub self.pending = Queue() self.channels = channels self.active = True ...
from __future__ import absolute_import import gevent from collections import deque from changes.config import pubsub class EventStream(object): def __init__(self, channels, pubsub=pubsub): self.pubsub = pubsub self.pending = deque() self.channels = channels self.active = True ...
Revert "Switch to gevent queues for EventStream"
Revert "Switch to gevent queues for EventStream" This reverts commit 4c102945fe46bb463e6a641324d26384c77fbae8.
Python
apache-2.0
bowlofstew/changes,wfxiang08/changes,dropbox/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes
--- +++ @@ -2,7 +2,7 @@ import gevent -from gevent.queue import Queue +from collections import deque from changes.config import pubsub @@ -10,7 +10,7 @@ class EventStream(object): def __init__(self, channels, pubsub=pubsub): self.pubsub = pubsub - self.pending = Queue() + self.p...
24a90b0aa38a21c9b116d4b8b9c4878678fda9cc
suddendev/tasks.py
suddendev/tasks.py
from . import celery, celery_socketio from .game_instance import GameInstance import time @celery.task(time_limit=5, max_retries=3) def play_game(game_id, player_names, scripts, player_ids, colors, namespace, room, wave=1): cleared = True current_wave = wave - 1 while cleared: current_wave += 1 ...
from . import celery, celery_socketio from .game_instance import GameInstance import time @celery.task(time_limit=15, max_retries=3) def play_game(game_id, player_names, scripts, player_ids, colors, namespace, room, wave=1): cleared = True current_wave = wave - 1 while cleared: current_wave += 1 ...
Bump up max game time to 15.
[NG] Bump up max game time to 15.
Python
mit
SuddenDevs/SuddenDev,SuddenDevs/SuddenDev,SuddenDevs/SuddenDev,SuddenDevs/SuddenDev
--- +++ @@ -2,7 +2,7 @@ from .game_instance import GameInstance import time -@celery.task(time_limit=5, max_retries=3) +@celery.task(time_limit=15, max_retries=3) def play_game(game_id, player_names, scripts, player_ids, colors, namespace, room, wave=1): cleared = True
1b0428aaf77f1c6eadfb6b20611a2e2e6f30fbce
poller.py
poller.py
#!/usr/bin/env python import urllib2 import ssl def poll(sites, timeout): for site in sites: print 'polling ' + site try: response = urllib2.urlopen(site, timeout=timeout) response.read() except urllib2.URLError as e: print e.code except ssl.SSL...
#!/usr/bin/env python import urllib2 import ssl try: import gntp.notifier as notify except ImportError: notify = None def poll(sites, timeout, ok, error): for site in sites: ok('polling ' + site) try: response = urllib2.urlopen(site, timeout=timeout) response.read(...
Add initial support for growl
Add initial support for growl If growl lib isn't available, prints to console instead.
Python
mit
koodilehto/website-poller,koodilehto/website-poller
--- +++ @@ -2,24 +2,40 @@ import urllib2 import ssl +try: + import gntp.notifier as notify +except ImportError: + notify = None -def poll(sites, timeout): +def poll(sites, timeout, ok, error): for site in sites: - print 'polling ' + site + ok('polling ' + site) try: ...