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
2d698b1df6da2d5a0b3697891744d3c05e99cb95
sympy/core/tests/test_compatibility.py
sympy/core/tests/test_compatibility.py
from sympy.core.compatibility import default_sort_key, as_int, ordered from sympy.core.singleton import S from sympy.utilities.pytest import raises from sympy.abc import x def test_default_sort_key(): func = lambda x: x assert sorted([func, x, func], key=default_sort_key) == [func, func, x] def test_as_int...
from sympy.core.compatibility import default_sort_key, as_int, ordered, iterable from sympy.core.singleton import S from sympy.utilities.pytest import raises from sympy.abc import x def test_default_sort_key(): func = lambda x: x assert sorted([func, x, func], key=default_sort_key) == [func, func, x] def t...
Test some basic properties of iterable()
Test some basic properties of iterable()
Python
bsd-3-clause
Gadal/sympy,jerli/sympy,souravsingh/sympy,Curious72/sympy,wanglongqi/sympy,chaffra/sympy,atsao72/sympy,sahilshekhawat/sympy,moble/sympy,skidzo/sympy,madan96/sympy,atreyv/sympy,lindsayad/sympy,skidzo/sympy,asm666/sympy,beni55/sympy,asm666/sympy,oliverlee/sympy,saurabhjn76/sympy,grevutiu-gabriel/sympy,drufat/sympy,postva...
--- +++ @@ -1,4 +1,4 @@ -from sympy.core.compatibility import default_sort_key, as_int, ordered +from sympy.core.compatibility import default_sort_key, as_int, ordered, iterable from sympy.core.singleton import S from sympy.utilities.pytest import raises @@ -15,6 +15,12 @@ raises(ValueError, lambda : as_int(...
e632fa3e12d3627abaf26f41a9f0483aaea24adf
imager/ImagerProfile/tests.py
imager/ImagerProfile/tests.py
from django.test import TestCase import factory class UserFactory(factory.django.DjangoModelFactory): class Meta: model = 'imagerprofile.ImagerProfile' django_get_or_create = ('username',) username = 'John'
from django.test import TestCase import factory class UserFactory(factory.django.DjangoModelFactory): class Meta: model = 'imagerprofile.User' django_get_or_create = ('username',) username = factory.Sequence(lambda n: "Agent %03d" % n)
Change test UserFactory model to point to User
Change test UserFactory model to point to User
Python
mit
nbeck90/django-imager,nbeck90/django-imager
--- +++ @@ -4,7 +4,7 @@ class UserFactory(factory.django.DjangoModelFactory): class Meta: - model = 'imagerprofile.ImagerProfile' + model = 'imagerprofile.User' django_get_or_create = ('username',) - username = 'John' + username = factory.Sequence(lambda n: "Agent %03d" % n)
a0e8c92a9d12846c8cfe6819ea26d1e08dd4098a
example/models.py
example/models.py
import i18n from i18n.models import TranslatableModel class Document(TranslatableModel): charfield = i18n.LocalizedCharField(max_length=50) textfield = i18n.LocalizedTextField(max_length=512) filefield = i18n.LocalizedFileField(null=True, upload_to='files') imagefield = i18n.LocalizedImageField(null=...
from django.db import models import i18n from i18n.models import TranslatableModel class Document(TranslatableModel): untranslated_charfield = models.CharField(max_length=50, blank=True) charfield = i18n.LocalizedCharField(max_length=50) textfield = i18n.LocalizedTextField(max_length=500, blank=True) ...
Make fields in example app non required
Make fields in example app non required
Python
bsd-3-clause
jonasundderwolf/django-localizedfields,jonasundderwolf/django-localizedfields
--- +++ @@ -1,20 +1,22 @@ +from django.db import models import i18n from i18n.models import TranslatableModel class Document(TranslatableModel): - + untranslated_charfield = models.CharField(max_length=50, blank=True) charfield = i18n.LocalizedCharField(max_length=50) - textfield = i18n.LocalizedTex...
d93014618636ba23ebfd99c466072e8b4c265a42
wikiwhere/plot_data_generation/count_generation.py
wikiwhere/plot_data_generation/count_generation.py
''' Created on May 3, 2016 @author: Martin Koerner <info@mkoerner.de> ''' class CountGeneration(object): def generate_counts(self,collected_features_array,feature_name): feature_counts = {} for instance in collected_features_array: if feature_name in instance: feature ...
''' Created on May 3, 2016 @author: Martin Koerner <info@mkoerner.de> ''' import operator class CountGeneration(object): def generate_counts(self,collected_features_array,feature_name): feature_counts = {} for instance in collected_features_array: if feature_name in instance: ...
Add reverse sorting of count_array
Add reverse sorting of count_array
Python
mit
mkrnr/wikiwhere
--- +++ @@ -4,6 +4,7 @@ @author: Martin Koerner <info@mkoerner.de> ''' +import operator class CountGeneration(object): def generate_counts(self,collected_features_array,feature_name): @@ -20,12 +21,14 @@ def get_as_array(self,feature_counts): feature_count_array = [] - - for...
3ea1c6b718e19d99d123feb734ca5f1a44174bf9
Lib/test/test_fcntl.py
Lib/test/test_fcntl.py
#! /usr/bin/env python """Test program for the fcntl C module. Roger E. Masse """ import struct import fcntl import FCNTL import os from test_support import verbose filename = '/tmp/delete-me' # the example from the library docs f = open(filename,'w') rv = fcntl.fcntl(f.fileno(), FCNTL.O_NDELAY, 1) if verbose: ...
#! /usr/bin/env python """Test program for the fcntl C module. Roger E. Masse """ import struct import fcntl import FCNTL import os from test_support import verbose filename = '/tmp/delete-me' # the example from the library docs f = open(filename,'w') rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, FCNTL.FNDELAY) if v...
Fix the NDELAY test; avoid outputting binary garbage.
Fix the NDELAY test; avoid outputting binary garbage.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -12,17 +12,17 @@ # the example from the library docs f = open(filename,'w') -rv = fcntl.fcntl(f.fileno(), FCNTL.O_NDELAY, 1) +rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, FCNTL.FNDELAY) if verbose: print 'Status from fnctl with O_NDELAY: ', rv lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK,...
ad7d331868706c97caa0bf0abff88d6ab5537d8d
pyramid_skosprovider/__init__.py
pyramid_skosprovider/__init__.py
# -*- coding: utf8 -*- from zope.interface import Interface from skosprovider.registry import Registry class ISkosRegistry(Interface): pass def _build_skos_registry(registry): skos_registry = registry.queryUtility(ISkosRegistry) if skos_registry is not None: return skos_registry skos_regi...
# -*- coding: utf8 -*- from zope.interface import Interface from skosprovider.registry import Registry class ISkosRegistry(Interface): pass def _build_skos_registry(registry): skos_registry = registry.queryUtility(ISkosRegistry) if skos_registry is not None: return skos_registry skos_regi...
Add skos_registry to the request.
Add skos_registry to the request. Add the skos_registry to the request through the add_request_method directive.
Python
mit
koenedaele/pyramid_skosprovider
--- +++ @@ -31,6 +31,7 @@ def includeme(config): _build_skos_registry(config.registry) config.add_directive('get_skos_registry', get_skos_registry) + config.add_request_method(get_skos_registry, 'skos_registry', reify=True) config.add_route('skosprovider.conceptschemes', '/conceptschemes') con...
6b2ae24a3989728dcf5015fbb7768ba1b4eed723
messaging/message_producer.py
messaging/message_producer.py
"""Message broker that sends to Unix domain sockets.""" import os import socket import time class MessageProducer(object): """Message broker that sends to Unix domain sockets.""" def __init__(self, message_type): self._message_type = message_type socket_address = os.sep.join( ('....
"""Message broker that sends to Unix domain sockets.""" import os import socket import time class MessageProducer(object): """Message broker that sends to Unix domain sockets.""" def __init__(self, message_type): self._message_type = message_type socket_address = os.sep.join( ('....
Use sendall instead of send for socket messages
Use sendall instead of send for socket messages I kept getting Errno 111 connection refused errors; I hope this fixes it.
Python
mit
bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc
--- +++ @@ -22,11 +22,11 @@ def publish(self, message): """Publishes a message.""" - self._socket.send(message.encode('utf-8')) + self._socket.sendall(message.encode('utf-8')) def kill(self): """Kills all listening consumers.""" try: - self._socket.sen...
638ea1b12b71f74b357d60b09f1284625db73b2d
migrations/versions/0040_adjust_mmg_provider_rate.py
migrations/versions/0040_adjust_mmg_provider_rate.py
"""mmg rates now set to 1.65 pence per sms Revision ID: 0040_adjust_mmg_provider_rate Revises: 0039_fix_notifications Create Date: 2016-07-06 15:19:23.124212 """ # revision identifiers, used by Alembic. revision = '0040_adjust_mmg_provider_rate' down_revision = '0039_fix_notifications' import uuid from datetime imp...
"""mmg rates now set to 1.65 pence per sms Revision ID: 0040_adjust_mmg_provider_rate Revises: 0039_fix_notifications Create Date: 2016-07-06 15:19:23.124212 """ # revision identifiers, used by Alembic. revision = '0040_adjust_mmg_provider_rate' down_revision = '0039_fix_notifications' import uuid from datetime imp...
Set the start date for the new rate as July 1
Set the start date for the new rate as July 1
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -23,7 +23,7 @@ sa.sql.text(("INSERT INTO provider_rates (id, valid_from, rate, provider_id) " "VALUES (:id, :valid_from, :rate, (SELECT id FROM provider_details WHERE identifier = 'mmg'))")), id=uuid.uuid4(), - valid_from=datetime.utcnow(), + valid_from...
0ceedd5b22a42634889b572018db1153e1ef2855
tests/integration/services/user_avatar/test_update_avatar_image.py
tests/integration/services/user_avatar/test_update_avatar_image.py
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from pathlib import Path import pytest from byceps.services.user_avatar import service as user_avatar_service from byceps.util.image.models import ImageType @pytest.mark.parametrize( 'image_extension, imag...
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from pathlib import Path import pytest from byceps.services.user_avatar import service as user_avatar_service from byceps.util.image.models import ImageType @pytest.mark.parametrize( 'image_extension, imag...
Use `/` operator to assemble path
Use `/` operator to assemble path
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
--- +++ @@ -26,5 +26,6 @@ avatar = user_avatar_service.get_db_avatar(avatar_id) expected_filename = f'{avatar.id}.{image_extension}' + expected = data_path / 'global' / 'users' / 'avatars' / expected_filename - assert avatar.path == data_path / 'global/users/avatars' / expected_filename + asser...
1da520787717117b0413715f9a6df834f2d9e7e1
press_releases/migrations/0009_auto_20170519_1308.py
press_releases/migrations/0009_auto_20170519_1308.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('icekit_press_releases', '0008_auto_20161128_1049'), ] operations = [ migrations.AddField( model_name='pressrelea...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('icekit_press_releases', '0008_auto_20161128_1049'), ] operations = [ migrations.AddField( model_name='pressrelea...
Change help text wording to follow WorkflowStateMixin
Change help text wording to follow WorkflowStateMixin
Python
mit
ic-labs/django-icekit,ic-labs/icekit-press-releases,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-press-releases
--- +++ @@ -14,11 +14,11 @@ migrations.AddField( model_name='pressreleaselisting', name='admin_notes', - field=models.TextField(help_text=b"Administrator's notes about this item", blank=True), + field=models.TextField(help_text=b"Administrator's notes about thi...
f05cd9d2249ea5ef616accf931418f413bce00ba
appengine/swarming/swarming_bot/bot_code/common.py
appengine/swarming/swarming_bot/bot_code/common.py
# Copyright 2015 The Swarming Authors. All rights reserved. # Use of this source code is governed by the Apache v2.0 license that can be # found in the LICENSE file. """Utilities.""" import logging import os import signal import sys from utils import subprocess42 def exec_python(args): """Executes a python proce...
# Copyright 2015 The Swarming Authors. All rights reserved. # Use of this source code is governed by the Apache v2.0 license that can be # found in the LICENSE file. """Utilities.""" import logging import os import signal import sys from utils import subprocess42 def exec_python(args): """Executes a python proce...
Fix regression on 6269f48ba356c4e7f in cygwin.
Fix regression on 6269f48ba356c4e7f in cygwin. signal.SIGBREAK is not defined on cygwin, causing an exception. R=vadimsh@chromium.org BUG= Review URL: https://codereview.chromium.org/1349183005
Python
apache-2.0
luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py
--- +++ @@ -35,7 +35,8 @@ # Always send SIGTERM, which is properly translated. proc.send_signal(signal.SIGTERM) - with subprocess42.set_signal_handler([signal.SIGBREAK], handler): + sig = signal.SIGBREAK if sys.platform == 'win32' else signal.SIGTERM + with subprocess42.set_signal_handler([si...
3f2be07e5df6bcf8bcfa9fce143291d476e93d9b
lib/reinteract/doc_format.py
lib/reinteract/doc_format.py
import re import pydoc import gtk from data_format import insert_with_tag, is_data_object BOLD_RE = re.compile("(?:(.)\b(.))+") STRIP_BOLD_RE = re.compile("(.)\b(.)") def insert_docs(buf, iter, obj, bold_tag): """Insert documentation about obj into a gtk.TextBuffer buf -- the buffer to insert the documentat...
import re import pydoc import gtk from data_format import insert_with_tag, is_data_object BOLD_RE = re.compile("(?:(.)\b(.))+") STRIP_BOLD_RE = re.compile("(.)\b(.)") def insert_docs(buf, iter, obj, bold_tag): """Insert documentation about obj into a gtk.TextBuffer buf -- the buffer to insert the documentat...
Fix typo breaking doc popups
Fix typo breaking doc popups
Python
bsd-2-clause
rschroll/reinteract,johnrizzo1/reinteract,johnrizzo1/reinteract,alexey4petrov/reinteract,johnrizzo1/reinteract,alexey4petrov/reinteract,rschroll/reinteract,rschroll/reinteract,jbaayen/reinteract,jbaayen/reinteract,alexey4petrov/reinteract,jbaayen/reinteract
--- +++ @@ -18,7 +18,7 @@ """ # If the routine is an instance, we get help on the type instead - if not is_data_object(obj): + if is_data_object(obj): obj = type(obj) name = getattr(obj, '__name__', None)
199f9ace071b95822a9a0fb53c9becfb0ab4abd2
tests/pytests/unit/modules/test_win_servermanager.py
tests/pytests/unit/modules/test_win_servermanager.py
import os import pytest import salt.modules.win_servermanager as win_servermanager from tests.support.mock import MagicMock, patch @pytest.fixture def configure_loader_modules(): return {win_servermanager: {}} def test_install(): mock_out = { "FeatureResult": { } } with patch.obje...
import os import pytest import salt.modules.win_servermanager as win_servermanager from tests.support.mock import MagicMock, patch @pytest.fixture def configure_loader_modules(): return { win_servermanager: { "__grains__": {"osversion": "6.2"} } } def test_install(): mock_ou...
Add some unit tests for install
Add some unit tests for install
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -7,15 +7,87 @@ @pytest.fixture def configure_loader_modules(): - return {win_servermanager: {}} + return { + win_servermanager: { + "__grains__": {"osversion": "6.2"} + } + } def test_install(): mock_out = { - "FeatureResult": { + 'Success': Tru...
6c40079139e714ff145e0a4adff8c3a537172ef5
erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py
erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe def execute(): frappe.db.sql("""update `tabSales Order` set delivery_status = 'Not Delivered' where delivery_status = 'Delivered' ...
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe def execute(): frappe.db.sql("""update `tabSales Order` set delivery_status = 'Not Delivered' where delivery_status = 'Delivered' ...
Update delivery and billing status in SO
Update delivery and billing status in SO
Python
agpl-3.0
gangadharkadam/saloon_erp,njmube/erpnext,Tejal011089/fbd_erpnext,anandpdoshi/erpnext,SPKian/Testing,indictranstech/focal-erpnext,mbauskar/helpdesk-erpnext,4commerce-technologies-AG/erpnext,mbauskar/helpdesk-erpnext,indictranstech/vestasi-erpnext,indictranstech/internal-erpnext,indictranstech/phrerp,indictranstech/buyba...
--- +++ @@ -6,7 +6,7 @@ def execute(): frappe.db.sql("""update `tabSales Order` set delivery_status = 'Not Delivered' - where delivery_status = 'Delivered' and ifnull(per_delivered, 0) = 0""") + where delivery_status = 'Delivered' and ifnull(per_delivered, 0) = 0 and docstatus = 0""") frappe.db.sql("""upd...
b745e05cd4f2ca2a6683f2e057d52dee454d5b23
lib/authenticator.py
lib/authenticator.py
# # HamperAuthenticator is the class to handle the authentication part of the provisioning portal. # Instantiate with the email and password you want, it'll pass back the cookie jar if successful, # or an error message on failure # from helpers.driver import HamperDriver from helpers.error import HamperError from term...
# # HamperAuthenticator is the class to handle the authentication part of the provisioning portal. # Instantiate with the email and password you want, it'll pass back the cookie jar if successful, # or an error message on failure # from helpers.driver import HamperDriver from helpers.error import HamperError from term...
Throw exception if no login credentials are provided
Throw exception if no login credentials are provided
Python
mit
MobileXLabs/hamper
--- +++ @@ -14,10 +14,14 @@ super(HamperAuthenticator, self).__init__() def sign_in(self, email=None, password=None): + print colored("Authenticating user...", "blue") + + # If no login credentials were provided + if not email or not password: + raise Exception(HamperError(HamperError.HECodeLogInError, ...
a6f8e42d3e297776a19c8e76dd7f1cfded32a266
pycon/tutorials/tests/test_utils.py
pycon/tutorials/tests/test_utils.py
"""Test for the tutorials.utils package""" import datetime import unittest from mock import patch from django.template import Template from pycon.bulkemail.models import BulkEmail from ..utils import queue_email_message today = datetime.date.today() class TestSendEmailMessage(unittest.TestCase): @patch('dj...
"""Test for the tutorials.utils package""" import datetime from mock import patch from django.template import Template from django.test import TestCase from pycon.bulkemail.models import BulkEmail from ..utils import queue_email_message today = datetime.date.today() class TestSendEmailMessage(TestCase): @p...
Use django TestCase in tutorial send email test
Use django TestCase in tutorial send email test It was using regular Python unittest.TestCase for some reason, resulting in leaving old BulkEmail objects in the database that other tests weren't expecting.
Python
bsd-3-clause
PyCon/pycon,PyCon/pycon,PyCon/pycon,njl/pycon,PyCon/pycon,njl/pycon,njl/pycon,njl/pycon
--- +++ @@ -1,11 +1,11 @@ """Test for the tutorials.utils package""" import datetime -import unittest from mock import patch from django.template import Template +from django.test import TestCase from pycon.bulkemail.models import BulkEmail @@ -15,7 +15,7 @@ today = datetime.date.today() -class Te...
d62ec0008b4ca65a784a1017e2c9253f0e0ab749
taiga/projects/migrations/0006_auto_20141029_1040.py
taiga/projects/migrations/0006_auto_20141029_1040.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def update_total_milestones(apps, schema_editor): Project = apps.get_model("projects", "Project") for project in Project.objects.filter(total_milestones__isnull=True): project.total_milestones = 0 ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def update_total_milestones(apps, schema_editor): Project = apps.get_model("projects", "Project") qs = Project.objects.filter(total_milestones__isnull=True) qs.update(total_milestones=0) class Migrat...
Make 0006 migration of project more efficient.
Make 0006 migration of project more efficient.
Python
agpl-3.0
frt-arch/taiga-back,dycodedev/taiga-back,obimod/taiga-back,19kestier/taiga-back,EvgeneOskin/taiga-back,bdang2012/taiga-back-casting,gauravjns/taiga-back,xdevelsistemas/taiga-back-community,Tigerwhit4/taiga-back,Zaneh-/bearded-tribble-back,bdang2012/taiga-back-casting,CoolCloud/taiga-back,bdang2012/taiga-back-casting,ta...
--- +++ @@ -5,13 +5,11 @@ def update_total_milestones(apps, schema_editor): Project = apps.get_model("projects", "Project") - for project in Project.objects.filter(total_milestones__isnull=True): - project.total_milestones = 0 - project.save() + qs = Project.objects.filter(total_milestones...
f869cf9a94749ea210d38178317d196fbdd15fac
resolwe/flow/tests/test_backend.py
resolwe/flow/tests/test_backend.py
# pylint: disable=missing-docstring import os import shutil from django.conf import settings from django.contrib.auth import get_user_model from django.test import TestCase from resolwe.flow.engine import manager from resolwe.flow.models import Data, Tool class ManagerTest(TestCase): def setUp(self): u ...
# pylint: disable=missing-docstring import os import shutil from django.conf import settings from django.contrib.auth import get_user_model from django.test import TestCase from resolwe.flow.engine import manager from resolwe.flow.models import Data, Tool class ManagerTest(TestCase): def setUp(self): u ...
Fix error if no data path
Fix error if no data path
Python
apache-2.0
jberci/resolwe,jberci/resolwe,genialis/resolwe,genialis/resolwe
--- +++ @@ -26,8 +26,12 @@ tool=t) d.save() - shutil.rmtree(settings.FLOW['BACKEND']['DATA_PATH']) - os.makedirs(settings.FLOW['BACKEND']['DATA_PATH']) + data_path = settings.FLOW['BACKEND']['DATA_PATH'] + + if os.path.exists(data_path): + shutil.rmt...
a2920b9bf5386b3f92a8e2cd5f7c4251439b2c42
newswall/admin.py
newswall/admin.py
from django.contrib import admin from newswall.models import Source, Story admin.site.register(Source, list_display=('name', 'is_active', 'ordering'), list_filter=('is_active',), prepopulated_fields={'slug': ('name',)}, ) admin.site.register(Story, date_hierarchy='timestamp', list_display=('...
from django.contrib import admin from newswall.models import Source, Story admin.site.register(Source, list_display=('name', 'is_active', 'ordering'), list_editable=('is_active', 'ordering'), list_filter=('is_active',), prepopulated_fields={'slug': ('name',)}, ) admin.site.register(Story, da...
Make a few fields editable from the changelist
Make a few fields editable from the changelist
Python
bsd-3-clause
matthiask/django-newswall,registerguard/django-newswall,michaelkuty/django-newswall,HerraLampila/django-newswall,matthiask/django-newswall,HerraLampila/django-newswall,registerguard/django-newswall,michaelkuty/django-newswall
--- +++ @@ -5,6 +5,7 @@ admin.site.register(Source, list_display=('name', 'is_active', 'ordering'), + list_editable=('is_active', 'ordering'), list_filter=('is_active',), prepopulated_fields={'slug': ('name',)}, ) @@ -12,6 +13,7 @@ admin.site.register(Story, date_hierarchy='timestamp',...
170bfa1aea96c0d1cbe13557ce158effff91466c
pilight.py
pilight.py
#!/usr/bin/python import ctypes import errno import os import select import traceback import cepoll import ctimerfd def on_timer (): pass def main (): spec = ctimerfd.itimerspec () spec.it_interval.tv_sec = 0 spec.it_interval.tv_nsec = long (1e9/60) spec.it_value.tv_sec = 0 ...
#!/usr/bin/python import ctypes import errno import os import select import traceback import cepoll import ctimerfd def on_timer (): pass def eintr_wrap (fn, *args, **kwargs): while True: try: return fn (*args, **kwargs) except IOError, e: ...
Add wrapper functions to deal with EINTR and exceptions in dispatched-to-functions
Add wrapper functions to deal with EINTR and exceptions in dispatched-to-functions
Python
mit
yrro/pilight
--- +++ @@ -12,6 +12,21 @@ def on_timer (): pass +def eintr_wrap (fn, *args, **kwargs): + while True: + try: + return fn (*args, **kwargs) + except IOError, e: + if e.errno == errno.EINTR: + c...
d68910e98eea4836a372e6230cc11044f2e59214
packet_sniffer/pcapreader.py
packet_sniffer/pcapreader.py
from scapy.all import * import unirest import json def callbackFunction(response): pass # "http://54.68.246.202:3000/rssi" def main(): print "Reading pcap file %s"%sys.argv[1] myreader = PcapReader(sys.argv[1]) packets = [] routerId = sys.argv[2] for pkt in myreader: try: extra = pkt.not...
from scapy.all import * import unirest import json def callbackFunction(response): pass # "http://54.68.246.202:3000/rssi" def main(): print "Reading pcap file %s"%sys.argv[1] myreader = PcapReader(sys.argv[1]) packets = [] routerId = sys.argv[2] for pkt in myreader: try: extra = pkt.not...
Change script to point to AWS
Change script to point to AWS
Python
mit
cheung31/bigbrother,cheung31/bigbrother,cheung31/bigbrother,cheung31/bigbrother
--- +++ @@ -24,7 +24,7 @@ print "[%d] MAC: %s RSSi: %d"%(pkt.time, pkt.addr1, signal_strength) packets.append({'created': pkt.time * 1000, 'mac': pkt.addr1, 'rssi': signal_strength, 'router': routerId, 'processed': False}) if len(packets) > 300: - thread = unirest.post("http://127.0.0.1:3000/rssi",...
ce052f8e19d46f6db202e7eee054d5b88af01d9b
nanagogo/__init__.py
nanagogo/__init__.py
#!/usr/bin/env python3 from nanagogo.api import NanagogoRequest, NanagogoError def get(path, params={}): r = NanagogoRequest(path, method="GET", params=params) return r.wrap() def post(path, params={}, data=None): r = NanagogoRequest(path, ...
#!/usr/bin/env python3 from nanagogo.api import NanagogoRequest, NanagogoError, s def get(path, params={}): r = NanagogoRequest(path, method="GET", params=params) return r.wrap() def post(path, params={}, data=None): r = NanagogoRequest(path, ...
Convert direction to upper case
Convert direction to upper case
Python
mit
kastden/nanagogo
--- +++ @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from nanagogo.api import NanagogoRequest, NanagogoError +from nanagogo.api import NanagogoRequest, NanagogoError, s def get(path, params={}): @@ -31,7 +31,7 @@ path = ("talks", self.name, "posts") params = {'limit': count, 't...
04cca2c87cc8e56ecd84e1b3125a7a7b8c67b026
norc_utils/backup.py
norc_utils/backup.py
import os from norc.settings import (NORC_LOG_DIR, BACKUP_SYSTEM, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_BUCKET_NAME) if BACKUP_SYSTEM == 'AmazonS3': from norc.norc_utils.aws import set_s3_key def s3_backup(fp, target): NUM_TRIES = 3 for i in range(NUM_TRIES): try: set_s3...
import os from norc.settings import NORC_LOG_DIR, BACKUP_SYSTEM if BACKUP_SYSTEM == 'AmazonS3': from norc.norc_utils.aws import set_s3_key from norc.settings import (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_BUCKET_NAME) def s3_backup(fp, target): NUM_TRIES = 3 for i in range(NUM_TRIES)...
Move AWS_ setting imports under the check for AmazonS3 so Norc doesn't break without them.
Move AWS_ setting imports under the check for AmazonS3 so Norc doesn't break without them.
Python
bsd-3-clause
darrellsilver/norc,darrellsilver/norc
--- +++ @@ -1,11 +1,12 @@ import os -from norc.settings import (NORC_LOG_DIR, BACKUP_SYSTEM, - AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_BUCKET_NAME) +from norc.settings import NORC_LOG_DIR, BACKUP_SYSTEM if BACKUP_SYSTEM == 'AmazonS3': from norc.norc_utils.aws import set_s3_key + from norc.set...
428fda845c79f70c6e3d64302bbc716da5130625
src/django_richenum/forms/fields.py
src/django_richenum/forms/fields.py
from abc import ABCMeta from abc import abstractmethod from django import forms class _BaseEnumField(forms.TypedChoiceField): __metaclass__ = ABCMeta def __init__(self, enum, *args, **kwargs): self.enum = enum kwargs.setdefault('empty_value', None) if 'choices' in kwargs: ...
from abc import ABCMeta from abc import abstractmethod from django import forms class _BaseEnumField(forms.TypedChoiceField): __metaclass__ = ABCMeta def __init__(self, enum, *args, **kwargs): self.enum = enum kwargs.setdefault('empty_value', None) if 'choices' in kwargs: ...
Make run_validators method a no-op
_BaseEnumField: Make run_validators method a no-op See the comment in this commit-- I can't see value in allowing custom validators on EnumFields and the implementation in the superclass causes warnings in RichEnum.__eq__. Arguably those warnings aren't useful (warning against []/falsy compare). In that case, we can ...
Python
mit
hearsaycorp/django-richenum,adepue/django-richenum,dhui/django-richenum,asherf/django-richenum,hearsaycorp/django-richenum
--- +++ @@ -27,6 +27,15 @@ def coerce_value(self, val): pass + def run_validators(self, value): + # These have to be from a set, so it's hard for me to imagine a useful + # custom validator. + # The run_validators method in the superclass checks the value against + # Non...
0782ab8774f840c7ab2e66ddd168ac3ccfa3fc4f
openprescribing/pipeline/management/commands/clean_up_bq_test_data.py
openprescribing/pipeline/management/commands/clean_up_bq_test_data.py
import os from django.core.management import BaseCommand, CommandError from gcutils.bigquery import Client class Command(BaseCommand): help = 'Removes any datasets whose tables have all expired' def handle(self, *args, **kwargs): if os.environ['DJANGO_SETTINGS_MODULE'] != \ 'openpresc...
import os from django.core.management import BaseCommand, CommandError from gcutils.bigquery import Client class Command(BaseCommand): help = 'Removes any datasets whose tables have all expired' def handle(self, *args, **kwargs): if os.environ['DJANGO_SETTINGS_MODULE'] != \ 'openpresc...
Clean up BQ test data properly
Clean up BQ test data properly If you delete datasets while iterating over datasets, you eventually get errors. This fixes that by building a list of all datasets before we delete any.
Python
mit
ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc
--- +++ @@ -13,7 +13,9 @@ gcbq_client = Client().gcbq_client - for dataset_list_item in gcbq_client.list_datasets(): + datasets = list(gcbq_client.list_datasets()) + + for dataset_list_item in datasets: dataset_ref = dataset_list_item.reference tables = list...
90dfa38014ba91de2e8c0c75d63788aab3c95f38
Python/python2_version/klampt/__init__.py
Python/python2_version/klampt/__init__.py
from robotsim import * import atexit atexit.register(destroy) __all__ = ['WorldModel','RobotModel','RobotModelLink','RigidObjectModel','TerrainModel','Mass','ContactParameters', 'SimRobotController','SimRobotSensor','SimBody','Simulator', 'Geometry3D','Appearance','DistanceQuerySettings','Distanc...
from __future__ import print_function,division from robotsim import * import atexit atexit.register(destroy) __all__ = ['WorldModel','RobotModel','RobotModelLink','RigidObjectModel','TerrainModel','Mass','ContactParameters', 'SimRobotController','SimRobotSensor','SimBody','Simulator', 'Geometry3D...
Allow some compatibility between python2 and updated python 3 files
Allow some compatibility between python2 and updated python 3 files
Python
bsd-3-clause
krishauser/Klampt,krishauser/Klampt,krishauser/Klampt,krishauser/Klampt,krishauser/Klampt,krishauser/Klampt
--- +++ @@ -1,3 +1,4 @@ +from __future__ import print_function,division from robotsim import * import atexit atexit.register(destroy)
3a321a93f9779f9e27da8e85e3ffc7460bbbef12
src/python/yalix/test/utils_test.py
src/python/yalix/test/utils_test.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import yalix.utils as utils class UtilsTest(unittest.TestCase): def test_log_progress_reports_FAILED(self): with utils.capture() as out: with self.assertRaises(KeyError): with utils.log_progress("Testing log message...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import yalix.utils as utils class UtilsTest(unittest.TestCase): def test_log_progress_reports_FAILED(self): with utils.capture() as out: with self.assertRaises(KeyError): with utils.log_progress("Testing log message...
Comment out failing test on Python3 env
Comment out failing test on Python3 env
Python
mit
rm-hull/yalix
--- +++ @@ -21,12 +21,14 @@ self.assertTrue('Testing log message' in out[0]) self.assertTrue('DONE' in out[0]) - def test_syntax_highligher(self): - import hashlib - sample_code = "(define (identity x) x)" - output = utils.highlight_syntax(sample_code) - m = hashlib....
94790371e7ec8dc189409e39e193680b9c6b1a08
raven/contrib/django/apps.py
raven/contrib/django/apps.py
# -*- coding: utf-8 -*- from django.apps import AppConfig class RavenConfig(AppConfig): name = 'raven.contrib.django' label = 'raven.contrib.django' verbose_name = 'Raven'
# -*- coding: utf-8 -*- from __future__ import absolute_import from django.apps import AppConfig class RavenConfig(AppConfig): name = 'raven.contrib.django' label = 'raven.contrib.django' verbose_name = 'Raven'
Add missing __future__ import to pass coding guidelines.
Add missing __future__ import to pass coding guidelines.
Python
bsd-3-clause
getsentry/raven-python,lepture/raven-python,smarkets/raven-python,Photonomie/raven-python,akalipetis/raven-python,danriti/raven-python,jbarbuto/raven-python,akheron/raven-python,ronaldevers/raven-python,johansteffner/raven-python,smarkets/raven-python,jmagnusson/raven-python,akheron/raven-python,jbarbuto/raven-python,P...
--- +++ @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import absolute_import from django.apps import AppConfig + class RavenConfig(AppConfig): name = 'raven.contrib.django'
ba3c46dc19afe79647ea07d80c495fbf7ad47514
rocketleaguereplayanalysis/util/transcode.py
rocketleaguereplayanalysis/util/transcode.py
def render_video(render_type, out_frame_rate=30, overlay=None, extra_cmd=None): import os import subprocess from rocketleaguereplayanalysis.render.do_render import get_video_prefix from rocketleaguereplayanalysis.parser.frames import get_frames from rocketleaguereplayanalysis.util....
def render_video(render_type, out_frame_rate=30, overlay=None, extra_cmd=None): import os import subprocess from rocketleaguereplayanalysis.render.do_render import get_video_prefix from rocketleaguereplayanalysis.parser.frames import get_frames from rocketleaguereplayanalysis.util....
FIx render output (missing crf value)
FIx render output (missing crf value)
Python
agpl-3.0
enzanki-ars/rocket-league-minimap-generator
--- +++ @@ -16,7 +16,9 @@ cmd += extra_cmd - cmd += ['-r', str(out_frame_rate), render_type + '.mp4', '-y'] + cmd += ['-r', str(out_frame_rate), + '-crf', '18', + render_type + '.mp4', '-y'] print('FFmpeg Command:', cmd)
2158763bb6226ba5e5de83527a6ec45a4adcbfa1
shoop/front/apps/simple_order_notification/templates.py
shoop/front/apps/simple_order_notification/templates.py
# -*- coding: utf-8 -*- # This file is part of Shoop. # # Copyright (c) 2012-2015, 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. MESSAGE_SUBJECT_TEMPLATE = "{{ order.shop }} - Order {{ order.identifier }}...
# -*- coding: utf-8 -*- # This file is part of Shoop. # # Copyright (c) 2012-2015, 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. MESSAGE_SUBJECT_TEMPLATE = "{{ order.shop }} - Order {{ order.identifier }}...
Fix default template of order received notification
Fix default template of order received notification Order lines were rendered on a single line. Fix that by adding a line break after each order line.
Python
agpl-3.0
akx/shoop,hrayr-artunyan/shuup,akx/shoop,jorge-marques/shoop,shoopio/shoop,suutari/shoop,suutari-ai/shoop,taedori81/shoop,suutari/shoop,suutari-ai/shoop,shawnadelic/shuup,taedori81/shoop,jorge-marques/shoop,shawnadelic/shuup,shoopio/shoop,hrayr-artunyan/shuup,taedori81/shoop,suutari-ai/shoop,shawnadelic/shuup,hrayr-art...
--- +++ @@ -15,9 +15,9 @@ For reference, here's a list of your order's contents. {% for line in order.lines.all() %} -{%- if line.taxful_total_price -%} +{%- if line.taxful_total_price %} * {{ line.quantity }} x {{ line.text }} - {{ line.taxful_total_price|money }} -{%- endif -%} +{% endif -%} {%- endfor %} ...
b870028ce8edcb5001f1a4823517d866db0324a8
pyglab/apirequest.py
pyglab/apirequest.py
import enum import json from pyglab.exceptions import RequestError import requests @enum.unique class RequestType(enum.Enum): GET = 1 POST = 2 PUT = 3 DELETE = 4 class ApiRequest: _request_creators = { RequestType.GET: requests.get, RequestType.POST: requests.post, RequestT...
import json from pyglab.exceptions import RequestError import requests class RequestType(object): GET = 1 POST = 2 PUT = 3 DELETE = 4 class ApiRequest: _request_creators = { RequestType.GET: requests.get, RequestType.POST: requests.post, RequestType.PUT: requests.put, ...
Make RequestType a normal class, not an enum.
Make RequestType a normal class, not an enum. This removes the restriction of needing Python >= 3.4. RequestType is now a normal class with class variables (fixes #19).
Python
mit
sloede/pyglab,sloede/pyglab
--- +++ @@ -1,10 +1,8 @@ -import enum import json from pyglab.exceptions import RequestError import requests -@enum.unique -class RequestType(enum.Enum): +class RequestType(object): GET = 1 POST = 2 PUT = 3
deed4cf02bf919a06bffa0ac5b5948390740a97e
tests/test_channel_shim.py
tests/test_channel_shim.py
import gevent from gevent import queue from wal_e import channel def test_channel_shim(): v = tuple(int(x) for x in gevent.__version__.split('.')) if v >= (0, 13, 0) and v < (1, 0, 0): assert isinstance(channel.Channel(), queue.Queue) elif v >= (1, 0, 0): assert isinstance(channel.Channe...
import gevent from gevent import queue from wal_e import channel def test_channel_shim(): v = tuple(int(x) for x in gevent.__version__.split('.')) print 'Version info:', gevent.__version__, v if v >= (0, 13) and v < (1, 0): assert isinstance(channel.Channel(), queue.Queue) elif v >= (1, 0): ...
Fix channel shim test for gevent 1.0.0
Fix channel shim test for gevent 1.0.0 Gevent 1.0 specifies this as its version, not 1.0.0, breaking the comparison spuriously if one has version 1.0 installed exactly.
Python
bsd-3-clause
nagual13/wal-e,equa/wal-e,wal-e/wal-e,DataDog/wal-e,ArtemZ/wal-e,intoximeters/wal-e,heroku/wal-e,ajmarks/wal-e,fdr/wal-e,tenstartups/wal-e,RichardKnop/wal-e,x86Labs/wal-e
--- +++ @@ -6,10 +6,11 @@ def test_channel_shim(): v = tuple(int(x) for x in gevent.__version__.split('.')) + print 'Version info:', gevent.__version__, v - if v >= (0, 13, 0) and v < (1, 0, 0): + if v >= (0, 13) and v < (1, 0): assert isinstance(channel.Channel(), queue.Queue) - elif v...
8ecb32004aca75c0b6cb70bd1a00e38f3a65c8c8
sound/irc/auth/controller.py
sound/irc/auth/controller.py
# encoding: utf-8 from __future__ import unicode_literals from web.auth import authenticate, deauthenticate from web.core import config, url from web.core.http import HTTPFound from brave.api.client import API log = __import__('logging').getLogger(__name__) class AuthenticationMixIn(object): def authorize(se...
# encoding: utf-8 from __future__ import unicode_literals from web.auth import authenticate, deauthenticate from web.core import config, url, session from web.core.http import HTTPFound from brave.api.client import API log = __import__('logging').getLogger(__name__) class AuthenticationMixIn(object): def aut...
Fix a bug where user-agents could specify their own session ID.
Fix a bug where user-agents could specify their own session ID.
Python
mit
eve-val/irc,eve-val/irc,eve-val/irc
--- +++ @@ -3,7 +3,7 @@ from __future__ import unicode_literals from web.auth import authenticate, deauthenticate -from web.core import config, url +from web.core import config, url, session from web.core.http import HTTPFound from brave.api.client import API @@ -37,6 +37,10 @@ # Note that our own 's...
1a7c4a027628241f415cc5cc3f7aca09ad9a4027
scripts/lib/check-database-compatibility.py
scripts/lib/check-database-compatibility.py
#!/usr/bin/env python3 import logging import os import sys ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, ZULIP_PATH) from scripts.lib.setup_path import setup_path from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, assert_not_running_as_root, parse_versio...
#!/usr/bin/env python3 import logging import os import sys ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, ZULIP_PATH) from scripts.lib.setup_path import setup_path from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, assert_not_running_as_root, parse_versio...
Fix typo in logging statement.
scripts: Fix typo in logging statement.
Python
apache-2.0
rht/zulip,zulip/zulip,andersk/zulip,kou/zulip,zulip/zulip,andersk/zulip,andersk/zulip,rht/zulip,zulip/zulip,kou/zulip,rht/zulip,zulip/zulip,andersk/zulip,andersk/zulip,zulip/zulip,kou/zulip,rht/zulip,kou/zulip,kou/zulip,andersk/zulip,kou/zulip,kou/zulip,rht/zulip,zulip/zulip,rht/zulip,zulip/zulip,andersk/zulip,rht/zuli...
--- +++ @@ -29,7 +29,7 @@ current_version = parse_version_from(os.path.join(DEPLOYMENTS_DIR, "current")) logging.error( "This is not an upgrade -- the current deployment (version %s) " - "contains database migrations which %s (version %s) does not.", + "contains %s database migrations which %s (version %...
50aa4ddeaad1d45687b8ab7d99a26602896a276b
indico/modules/events/persons/__init__.py
indico/modules/events/persons/__init__.py
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
Add logger to events.persons module
Add logger to events.persons module
Python
mit
mic4ael/indico,OmeGak/indico,mic4ael/indico,ThiefMaster/indico,pferreir/indico,pferreir/indico,ThiefMaster/indico,OmeGak/indico,ThiefMaster/indico,DirkHoffmann/indico,indico/indico,indico/indico,mvidalgarcia/indico,DirkHoffmann/indico,pferreir/indico,mic4ael/indico,OmeGak/indico,mvidalgarcia/indico,mvidalgarcia/indico,...
--- +++ @@ -19,9 +19,13 @@ from flask import session from indico.core import signals +from indico.core.logger import Logger from indico.util.i18n import _ from indico.web.flask.util import url_for from indico.web.menu import SideMenuItem + + +logger = Logger.get('events.persons') @signals.menu.items.conne...
8befea283830f76dfa41cfd10d7eb916c68f7ef9
intern/views.py
intern/views.py
# -*- coding: utf-8 -*- from django.contrib.auth.decorators import login_required from django.shortcuts import render from filer.models import File from filer.models import Folder @login_required def documents(request): files = File.objects.all() folders = Folder.objects.all() #print(files[0]) return...
# -*- coding: utf-8 -*- from django.contrib.auth.decorators import login_required from django.shortcuts import render from filer.models import File from filer.models import Folder @login_required def documents(request): files = File.objects.all().order_by("-modified_at") folders = Folder.objects.all() #p...
Sort files by last modification
Sort files by last modification
Python
mit
n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb
--- +++ @@ -8,7 +8,7 @@ @login_required def documents(request): - files = File.objects.all() + files = File.objects.all().order_by("-modified_at") folders = Folder.objects.all() #print(files[0]) return render(request, 'intern/documents.html', {'files': files, 'folders': folders})
a3f611220afa9cc0ba1b2eb8fb8a4d4c220e99dd
kokki/cookbooks/busket/recipes/default.py
kokki/cookbooks/busket/recipes/default.py
import os from kokki import * Package("erlang") Script("install-busket", not_if = lambda:os.path.exists(env.config.busket.path), cwd = "/usr/local/src", code = ( "git clone git://github.com/samuel/busket.git busket\n" "cd busket\n" "make release\n" "mv rel/busket {install_...
import os from kokki import * Package("erlang") Package("mercurial", provider = "kokki.providers.package.easy_install.EasyInstallProvider") Script("install-busket", not_if = lambda:os.path.exists(env.config.busket.path), cwd = "/usr/local/src", code = ( "git clone git://github.com/samuel/bus...
Install mercurial to install busket
Install mercurial to install busket
Python
bsd-3-clause
samuel/kokki
--- +++ @@ -3,6 +3,9 @@ from kokki import * Package("erlang") + +Package("mercurial", + provider = "kokki.providers.package.easy_install.EasyInstallProvider") Script("install-busket", not_if = lambda:os.path.exists(env.config.busket.path),
71b7885bc1e3740adf8c07c23b41835e1e69f8a2
sqlobject/tests/test_class_hash.py
sqlobject/tests/test_class_hash.py
from sqlobject import * from sqlobject.tests.dbtest import * ######################################## # Test hashing a column instance ######################################## class ClassHashTest(SQLObject): name = StringCol(length=50, alternateID=True, dbName='name_col') def test_class_hash(): setupClass...
from sqlobject import * from sqlobject.tests.dbtest import * ######################################## # Test hashing a column instance ######################################## class ClassHashTest(SQLObject): name = StringCol(length=50, alternateID=True, dbName='name_col') def test_class_hash(): setupClass...
Fix flake8 warning in test case
Fix flake8 warning in test case
Python
lgpl-2.1
drnlm/sqlobject,sqlobject/sqlobject,drnlm/sqlobject,sqlobject/sqlobject
--- +++ @@ -15,7 +15,6 @@ setupClass(ClassHashTest) ClassHashTest(name='bob') - conn = ClassHashTest._connection b = ClassHashTest.byName('bob') hashed = hash(b) b.expire()
725605cd20b29e200f6aaa90f29053bc623b0e51
thefuck/rules/unknown_command.py
thefuck/rules/unknown_command.py
import re from thefuck.utils import replace_command def match(command): return (re.search(r"([^:]*): Unknown command.*", command.stderr) != None and re.search(r"Did you mean ([^?]*)?", command.stderr) != None) def get_new_command(command): broken_cmd = re.findall(r"([^:]*): Unknown command.*", c...
import re from thefuck.utils import replace_command def match(command): return (re.search(r"([^:]*): Unknown command.*", command.stderr) is not None and re.search(r"Did you mean ([^?]*)?", command.stderr) is not None) def get_new_command(command): broken_cmd = re.findall(r"([^:]*): Unknown comma...
Fix flake8 errors: E711 comparison to None should be 'if cond is not None:'
Fix flake8 errors: E711 comparison to None should be 'if cond is not None:'
Python
mit
mlk/thefuck,mlk/thefuck,nvbn/thefuck,Clpsplug/thefuck,SimenB/thefuck,nvbn/thefuck,scorphus/thefuck,Clpsplug/thefuck,SimenB/thefuck,scorphus/thefuck
--- +++ @@ -3,8 +3,8 @@ def match(command): - return (re.search(r"([^:]*): Unknown command.*", command.stderr) != None - and re.search(r"Did you mean ([^?]*)?", command.stderr) != None) + return (re.search(r"([^:]*): Unknown command.*", command.stderr) is not None + and re.search(r"Di...
27065fd302c20937d44b840472d943ce8aa652e7
plugins/candela/girder_plugin_candela/__init__.py
plugins/candela/girder_plugin_candela/__init__.py
############################################################################### # Copyright Kitware Inc. # # Licensed under the Apache License, Version 2.0 ( the "License" ); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
############################################################################### # Copyright Kitware Inc. # # Licensed under the Apache License, Version 2.0 ( the "License" ); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
Add a plugin displayName property
Add a plugin displayName property This allows the web client to display an arbitrary plugin title rather than to be restricted to valid python/javascript tokens.
Python
apache-2.0
Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela
--- +++ @@ -18,6 +18,7 @@ class CandelaPlugin(GirderPlugin): + DISPLAY_NAME = 'Candela Visualization' NPM_PACKAGE_NAME = '@girder/candela' def load(self, info):
65b7d1f1eafd32d3895e3ec15a559dca608b5c23
addons/sale_coupon/models/mail_compose_message.py
addons/sale_coupon/models/mail_compose_message.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models class MailComposeMessage(models.TransientModel): _inherit = 'mail.compose.message' def send_mail(self, **kwargs): for wizard in self: if self._context.get('mark_coup...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models class MailComposeMessage(models.TransientModel): _inherit = 'mail.compose.message' def send_mail(self, **kwargs): for wizard in self: if self._context.get('mark_coup...
Allow helpdesk users to send coupon by email
[IMP] sale_coupon: Allow helpdesk users to send coupon by email Purpose ======= Helpdesk users don't have the right to write on a coupon. When sending a coupon by email, the coupon is marked as 'sent'. Allow users to send coupons by executing the state change in sudo. closes odoo/odoo#45091 Taskid: 2179609 Relate...
Python
agpl-3.0
ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo
--- +++ @@ -10,5 +10,6 @@ def send_mail(self, **kwargs): for wizard in self: if self._context.get('mark_coupon_as_sent') and wizard.model == 'sale.coupon' and wizard.partner_ids: - self.env[wizard.model].browse(wizard.res_id).state = 'sent' + # Mark coupon as s...
96b554c62fb9449760d423f7420ae75d78998269
nodeconductor/quotas/handlers.py
nodeconductor/quotas/handlers.py
def add_quotas_to_scope(sender, instance, created=False, **kwargs): if created: from nodeconductor.quotas import models for quota_name in sender.QUOTAS_NAMES: models.Quota.objects.create(name=quota_name, scope=instance)
from django.db.models import signals def add_quotas_to_scope(sender, instance, created=False, **kwargs): if created: from nodeconductor.quotas import models for quota_name in sender.QUOTAS_NAMES: models.Quota.objects.create(name=quota_name, scope=instance) def quantity_quota_handler_...
Create generic quantity quota handler(saas-217)
Create generic quantity quota handler(saas-217)
Python
mit
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
--- +++ @@ -1,6 +1,52 @@ +from django.db.models import signals + def add_quotas_to_scope(sender, instance, created=False, **kwargs): if created: from nodeconductor.quotas import models for quota_name in sender.QUOTAS_NAMES: models.Quota.objects.create(name=quota_name, scope=inst...
8be551ad39f3aedff5ea0ceb536378ea0e851864
src/waldur_auth_openid/management/commands/import_openid_accounts.py
src/waldur_auth_openid/management/commands/import_openid_accounts.py
from __future__ import unicode_literals from django.conf import settings from django.contrib.auth import get_user_model from django.db import transaction from waldur_core.core.utils import DryRunCommand User = get_user_model() class Command(DryRunCommand): help_text = 'Append civil number with country code for...
from __future__ import unicode_literals from django.conf import settings from django.contrib.auth import get_user_model from django.db import transaction from waldur_core.core.utils import DryRunCommand User = get_user_model() class Command(DryRunCommand): help_text = 'Append civil number with country code for...
Print out civil_number before and after
Print out civil_number before and after [WAL-2172]
Python
mit
opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind
--- +++ @@ -23,9 +23,12 @@ .exclude(civil_number='') \ .exclude(civil_number=None) count = users.count() - if not dry_run: - for user in users: - user.civil_number = '%s%s' % (country_code, user.civil_number) + for ...
3f22453c43b6111c22796f9375622eb6d978d669
content/test/gpu/gpu_tests/trace_test_expectations.py
content/test/gpu/gpu_tests/trace_test_expectations.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from gpu_test_expectations import GpuTestExpectations # See the GpuTestExpectations class for documentation. class TraceTestExpectations(GpuTestExpectation...
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from gpu_test_expectations import GpuTestExpectations # See the GpuTestExpectations class for documentation. class TraceTestExpectations(GpuTestExpectation...
Mark TraceTest.WebGLGreenTriangle as expected failure on Windows.
Mark TraceTest.WebGLGreenTriangle as expected failure on Windows. BUG=517232 TBR=dyen@chromium.org Review URL: https://codereview.chromium.org/1276403003 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#342511}
Python
bsd-3-clause
CapOM/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM...
--- +++ @@ -14,6 +14,11 @@ self.Skip('TraceTest.Canvas2DRedBox') self.Skip('TraceTest.CSS3DBlueBox') + # Flaky, mainly on Windows. Leave this un-suppressed on other + # platforms for the moment to have at least some test coverage. + # Once test expectations are refactored (Issue 495870), this cou...
1359af2cd9c038d050cb1c4619637143ab020a70
onepercentclub/settings/salesforcesync.py
onepercentclub/settings/salesforcesync.py
try: from .secrets import * except ImportError: import sys sys.exit('secrets.py settings file not found. Please run `prepare.sh` to create one.') from .base import * # # We need this specific override because having the salesforce app and bluebottle_salesforce # enabled causes tests to fail in our other ...
try: from .secrets import * except ImportError: import sys sys.exit('secrets.py settings file not found. Please run `prepare.sh` to create one.') from .base import * # # We need this specific override because having the salesforce app and bluebottle_salesforce # enabled causes tests to fail in our other ...
Set correct email config for salesforce sync.
Set correct email config for salesforce sync. BB-1530
Python
bsd-3-clause
onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site
--- +++ @@ -31,4 +31,4 @@ ) # Send email for real -EMAIL_BACKEND = 'apps.bluebottle_utils.email_backend.DKIMBackend' +EMAIL_BACKEND = 'bluebottle.bluebottle_utils.email_backend.DKIMBackend'
53c4d10ecb7a9592f3cdf311ca2ddc5cb52c413c
gitlabform/gitlabform/test/test_project_settings.py
gitlabform/gitlabform/test/test_project_settings.py
import pytest from gitlabform.gitlabform import GitLabForm from gitlabform.gitlabform.test import create_group, create_project_in_group, get_gitlab, GROUP_NAME PROJECT_NAME = 'project_settings_project' GROUP_AND_PROJECT_NAME = GROUP_NAME + '/' + PROJECT_NAME @pytest.fixture(scope="module") def gitlab(request): ...
import pytest from gitlabform.gitlabform import GitLabForm from gitlabform.gitlabform.test import create_group, create_project_in_group, get_gitlab, GROUP_NAME PROJECT_NAME = 'project_settings_project' GROUP_AND_PROJECT_NAME = GROUP_NAME + '/' + PROJECT_NAME @pytest.fixture(scope="module") def gitlab(request): ...
Comment out what can't be checked
Comment out what can't be checked
Python
mit
egnyte/gitlabform,egnyte/gitlabform
--- +++ @@ -40,5 +40,6 @@ gf.main() settings = gitlab.get_project_settings(GROUP_AND_PROJECT_NAME) - assert settings['builds_access_level'] is 'private' assert settings['visibility'] is 'private' + # there is no such field in the "Get single project" API :/ + #assert ...
e5fb2f327b5ec51cd908e5915ef5415ff2b9dcc3
stackviz/views/dstat/api.py
stackviz/views/dstat/api.py
from django.http import HttpResponse from django.views.generic import View from stackviz import settings _cached_csv = None def _load_csv(): global _cached_csv if _cached_csv: return _cached_csv with open(settings.DSTAT_CSV, 'r') as f: _cached_csv = f.readlines() return _cached...
import os from django.http import HttpResponse, Http404 from django.views.generic import View from stackviz import settings _cached_csv = None def _load_csv(): global _cached_csv if _cached_csv: return _cached_csv try: with open(settings.DSTAT_CSV, 'r') as f: _cached_csv =...
Return a 404 error when no dstat csv can be loaded
Return a 404 error when no dstat csv can be loaded
Python
apache-2.0
openstack/stackviz,timothyb89/stackviz-ng,dklyle/stackviz-ng,timothyb89/stackviz-ng,timothyb89/stackviz-ng,timothyb89/stackviz,timothyb89/stackviz,timothyb89/stackviz,dklyle/stackviz-ng,openstack/stackviz,openstack/stackviz
--- +++ @@ -1,4 +1,6 @@ -from django.http import HttpResponse +import os + +from django.http import HttpResponse, Http404 from django.views.generic import View from stackviz import settings @@ -12,11 +14,19 @@ if _cached_csv: return _cached_csv - with open(settings.DSTAT_CSV, 'r') as f: - ...
ee9c5c8265b4971a9b593d252711a88f59fe6b75
test/suite/out/long_lines.py
test/suite/out/long_lines.py
if True: if True: if True: self.__heap.sort( ) # pylint: builtin sort probably faster than O(n)-time heapify if True: foo = '( ' + array[0] + ' '
if True: if True: if True: self.__heap.sort( ) # pylint: builtin sort probably faster than O(n)-time heapify if True: foo = '( ' + \ array[0] + ' '
Update due to correction to E501 usage
Update due to correction to E501 usage
Python
mit
Vauxoo/autopep8,hhatto/autopep8,SG345/autopep8,hhatto/autopep8,MeteorAdminz/autopep8,vauxoo-dev/autopep8,MeteorAdminz/autopep8,Vauxoo/autopep8,SG345/autopep8,vauxoo-dev/autopep8
--- +++ @@ -2,7 +2,8 @@ if True: if True: self.__heap.sort( - ) # pylint: builtin sort probably faster than O(n)-time heapify + ) # pylint: builtin sort probably faster than O(n)-time heapify if True: - foo = '( ...
fe0d86df9c4be9d33a461578b71c43865f79c715
tests/builtins/test_input.py
tests/builtins/test_input.py
from .. utils import TranspileTestCase, BuiltinFunctionTestCase class InputTests(TranspileTestCase): pass class BuiltinInputFunctionTests(BuiltinFunctionTestCase, TranspileTestCase): functions = ["input"] not_implemented = [ 'test_bool', 'test_bytearray', 'test_bytes', '...
from .. utils import TranspileTestCase, BuiltinFunctionTestCase class InputTests(TranspileTestCase): pass # class BuiltinInputFunctionTests(BuiltinFunctionTestCase, TranspileTestCase): # functions = ["input"] # not_implemented = [ # 'test_bool', # 'test_bytearray', # 'test_bytes...
Disable builtin tests for input() as it hangs
Disable builtin tests for input() as it hangs
Python
bsd-3-clause
cflee/voc,Felix5721/voc,ASP1234/voc,cflee/voc,glasnt/voc,ASP1234/voc,glasnt/voc,freakboy3742/voc,freakboy3742/voc,gEt-rIgHt-jR/voc,Felix5721/voc,gEt-rIgHt-jR/voc,pombredanne/voc,pombredanne/voc
--- +++ @@ -5,21 +5,21 @@ pass -class BuiltinInputFunctionTests(BuiltinFunctionTestCase, TranspileTestCase): - functions = ["input"] +# class BuiltinInputFunctionTests(BuiltinFunctionTestCase, TranspileTestCase): +# functions = ["input"] - not_implemented = [ - 'test_bool', - 'test_...
a6788c5fda5760c6ad81a418e91597b4170e6149
websmash/default_settings.py
websmash/default_settings.py
from os import path ############# Configuration ############# DEBUG = True SECRET_KEY = "development_key" RESULTS_PATH = path.join(path.dirname(path.dirname(__file__)), 'results') RESULTS_URL = '/upload' NCBI_URL = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi' NCBI_URL += '?db=nucleotide&email="%s"&tool="a...
from os import path ############# Configuration ############# DEBUG = True SECRET_KEY = "development_key" RESULTS_PATH = path.join(path.dirname(path.dirname(__file__)), 'results') RESULTS_URL = '/upload' NCBI_URL = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi' NCBI_URL += '?db=nucleotide&email="%s"&tool="a...
Add some error states for the NCBI download option
settings: Add some error states for the NCBI download option Signed-off-by: Kai Blin <94ddc6985b47aef772521e302594241f46a8f665@biotech.uni-tuebingen.de>
Python
agpl-3.0
antismash/ps-web,antismash/ps-web,antismash/websmash,antismash/ps-web
--- +++ @@ -21,5 +21,6 @@ # Flask-Downloader settings DEFAULT_DOWNLOAD_DIR = RESULTS_PATH +BAD_CONTENT = ('Error reading from remote server', 'Bad gateway', 'Cannot process ID list', 'server is temporarily unable to service your request') #########################################
a72468f6988ba3fc5f815b68a07c990809f80864
main.py
main.py
#ODB2 datalogger import obd connection = obd.OBD() while true: request = connection.query(obd.commands.RPM) if not r.is_null(): print(r.value)
#ODB2 datalogger import obd import signal import sys #What to do when we receive a signal def signal_handler(signal, frame): connection.close() sys.exit(0) #Register our signal handler signal.signal(signal.SIGINT, signal_handler) #Find and connect OBD adapter connection = obd.OBD() while True: request...
Handle ctrl+c with signal Fix more typos
Handle ctrl+c with signal Fix more typos
Python
mit
ProtaconSolutions/iot-hackday-2015-obd2
--- +++ @@ -1,11 +1,22 @@ #ODB2 datalogger import obd +import signal +import sys +#What to do when we receive a signal +def signal_handler(signal, frame): + connection.close() + sys.exit(0) + +#Register our signal handler +signal.signal(signal.SIGINT, signal_handler) + +#Find and connect OBD adapter con...
8d7657ed52a40070136bbbe3da7069dcbe3fc1c3
altair/vegalite/v2/examples/stem_and_leaf.py
altair/vegalite/v2/examples/stem_and_leaf.py
""" Steam and Leaf Plot ------------------- This example shows how to make a steam and leaf plot. """ import altair as alt import pandas as pd import numpy as np np.random.seed(42) # Generating Random Data original_data = pd.DataFrame({'samples':np.array(np.random.normal(50, 15, 100), dtype=np.int)}) # Splitting St...
""" Steam and Leaf Plot ------------------- This example shows how to make a steam and leaf plot. """ import altair as alt import pandas as pd import numpy as np np.random.seed(42) # Generating random data original_data = pd.DataFrame({'samples':np.array(np.random.normal(50, 15, 100), dtype=np.int)}) # Splitting st...
Modify example to calculate leaf position
Modify example to calculate leaf position
Python
bsd-3-clause
altair-viz/altair,ellisonbg/altair,jakevdp/altair
--- +++ @@ -9,22 +9,25 @@ import numpy as np np.random.seed(42) -# Generating Random Data +# Generating random data original_data = pd.DataFrame({'samples':np.array(np.random.normal(50, 15, 100), dtype=np.int)}) -# Splitting Steam and Leaf +# Splitting steam and leaf original_data['stem'] = original_data['sam...
a26fa991e7a01188f09e755da67442a71cee3deb
planet_alignment/config/bunch_parser.py
planet_alignment/config/bunch_parser.py
""" .. module:: config_parser :platform: linux :synopsis: Module to parse a YAML configuration file using the bunch module. .. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com> .. modulecreated:: 6/26/15 """ from bunch import fromYAML import sys from yaml.parser import ParserError from zope.interface import...
""" .. module:: config_parser :platform: linux :synopsis: Module to parse a YAML configuration file using the bunch module. .. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com> .. modulecreated:: 6/26/15 """ from bunch import fromYAML import sys from yaml.parser import ParserError from zope.interface import...
Fix an inconsistency is the bunch parser.
Fix an inconsistency is the bunch parser. Most of the exception handling is using the keyword 'as'. One is using the comma. Change the comma style to 'as'.
Python
mit
paulfanelli/planet_alignment
--- +++ @@ -31,7 +31,7 @@ except ParserError as pe: print("ERROR: Error parsing the configuration file '{}'!".format(path)) sys.exit("ERROR: {}".format(pe)) - except Exception, e: + except Exception as e: print("ERROR: Unknown exception '{}'".format(e)) ...
06df514496612f194a6103167b867debf6657f5e
src/engine/SCons/Platform/darwin.py
src/engine/SCons/Platform/darwin.py
"""engine.SCons.Platform.darwin Platform-specific initialization for Mac OS X systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004 Steven Knight # # Permi...
"""engine.SCons.Platform.darwin Platform-specific initialization for Mac OS X systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # __COPYRIGHT__ # # Permission is hereby granted, free of char...
Fix __COPYRIGHT__ and __REVISION__ in new Darwin module.
Fix __COPYRIGHT__ and __REVISION__ in new Darwin module. git-svn-id: 7892167f69f80ee5d3024affce49f20c74bcb41d@1037 fdb21ef1-2011-0410-befe-b5e4ea1792b1
Python
mit
datalogics/scons,azverkan/scons,datalogics/scons,datalogics-robb/scons,azverkan/scons,datalogics-robb/scons,azverkan/scons,azverkan/scons,datalogics-robb/scons,datalogics/scons,datalogics/scons,datalogics-robb/scons,azverkan/scons
--- +++ @@ -8,7 +8,7 @@ """ # -# Copyright (c) 2001, 2002, 2003, 2004 Steven Knight +# __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -30,6 +30,8 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN...
d8f32f7b6d0b1db0f467a61677586daa76bbaa4e
account_fiscal_year/__manifest__.py
account_fiscal_year/__manifest__.py
# Copyright 2016 Camptocamp SA # Copyright 2018 Lorenzo Battistini <https://github.com/eLBati> # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). { "name": "Account Fiscal Year", "summary": "Create a menu for Account Fiscal Year", "version": "13.0.1.0.0", "development_status": "Beta", ...
# Copyright 2016 Camptocamp SA # Copyright 2018 Lorenzo Battistini <https://github.com/eLBati> # License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). { "name": "Account Fiscal Year", "summary": "Create a menu for Account Fiscal Year", "version": "13.0.1.0.0", "development_status": "Beta", ...
Use AGPL license, as it depends on `date_range` that uses that
[FIX] account_fiscal_year: Use AGPL license, as it depends on `date_range` that uses that
Python
agpl-3.0
Vauxoo/account-financial-tools,Vauxoo/account-financial-tools,Vauxoo/account-financial-tools
--- +++ @@ -1,6 +1,6 @@ # Copyright 2016 Camptocamp SA # Copyright 2018 Lorenzo Battistini <https://github.com/eLBati> -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). { "name": "Account Fiscal Year", "summary": "Create a ...
7e5973b5490fd938078ce50723527d0c09f8e11e
rest_framework_friendly_errors/handlers.py
rest_framework_friendly_errors/handlers.py
from rest_framework.views import exception_handler from rest_framework_friendly_errors import settings from rest_framework_friendly_errors.utils import is_pretty def friendly_exception_handler(exc, context): response = exception_handler(exc, context) if response is not None: if is_pretty(response): ...
from rest_framework.views import exception_handler from rest_framework.exceptions import APIException from rest_framework_friendly_errors import settings from rest_framework_friendly_errors.utils import is_pretty def friendly_exception_handler(exc, context): response = exception_handler(exc, context) if not...
Build APIException all exceptions must be handled
Build APIException all exceptions must be handled
Python
mit
oasiswork/drf-friendly-errors,FutureMind/drf-friendly-errors
--- +++ @@ -1,4 +1,5 @@ from rest_framework.views import exception_handler +from rest_framework.exceptions import APIException from rest_framework_friendly_errors import settings from rest_framework_friendly_errors.utils import is_pretty @@ -6,6 +7,9 @@ def friendly_exception_handler(exc, context): respo...
4c3fee1ebce086d93424592f7145a378c40fd794
medical_prescription_disease/models/medical_prescription_order_line.py
medical_prescription_disease/models/medical_prescription_order_line.py
# -*- coding: utf-8 -*- # © 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields, api class MedicalPrescriptionOrderLine(models.Model): _inherit = 'medical.prescription.order.line' disease_id = fields.Many2one( string='Disease', ...
# -*- coding: utf-8 -*- # © 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields, api class MedicalPrescriptionOrderLine(models.Model): _inherit = 'medical.prescription.order.line' disease_id = fields.Many2one( string='Disease', ...
Remove required from disease_id in medical_prescription_disease
Remove required from disease_id in medical_prescription_disease
Python
agpl-3.0
laslabs/vertical-medical,laslabs/vertical-medical
--- +++ @@ -10,7 +10,6 @@ disease_id = fields.Many2one( string='Disease', comodel_name='medical.patient.disease', - required=True, help='Disease diagnosis related to prescription.', )
f9b2f8cd60af9b37ad80db10c42b36059ca5a10f
tests/unit/core/migrations_tests.py
tests/unit/core/migrations_tests.py
# -*- coding: utf-8 -*- import os from django.test import TestCase import oscar.apps class TestMigrations(TestCase): def check_for_auth_model(self, filepath): with open(filepath) as f: s = f.read() return 'auth.User' in s or 'auth.user' in s def test_dont_contain_hardcoded...
# -*- coding: utf-8 -*- import os import re from django.test import TestCase import oscar.apps class TestMigrations(TestCase): def setUp(self): self.root_path = os.path.dirname(oscar.apps.__file__) self.migration_filenames = [] for path, __, migrations in os.walk(self.root_path): ...
Add unit test for duplicate migration numbers
Add unit test for duplicate migration numbers Duplicate migration numbers can happen when merging changes from different branches. This test ensures that we address the issue right away.
Python
bsd-3-clause
django-oscar/django-oscar,django-oscar/django-oscar,Bogh/django-oscar,anentropic/django-oscar,pdonadeo/django-oscar,manevant/django-oscar,nickpack/django-oscar,itbabu/django-oscar,jinnykoo/wuyisj.com,faratro/django-oscar,QLGu/django-oscar,eddiep1101/django-oscar,monikasulik/django-oscar,michaelkuty/django-oscar,jmt4/dj...
--- +++ @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- - import os +import re from django.test import TestCase @@ -9,22 +9,35 @@ class TestMigrations(TestCase): - def check_for_auth_model(self, filepath): - with open(filepath) as f: - s = f.read() - return 'auth.User' in s or 'aut...
d20f147a9baf0c0eee48fe2b6242020d500018cc
packages/Python/lldbsuite/test/repl/error_return/TestREPLThrowReturn.py
packages/Python/lldbsuite/test/repl/error_return/TestREPLThrowReturn.py
# TestREPLThrowReturn.py # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See http://swift.org/LICENSE.txt for license information # See http://swift.org/CONTRI...
# TestREPLThrowReturn.py # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See http://swift.org/LICENSE.txt for license information # See http://swift.org/CONTRI...
Mark this test as xfail
Mark this test as xfail
Python
apache-2.0
apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb
--- +++ @@ -24,7 +24,7 @@ @decorators.swiftTest @decorators.skipUnlessDarwin @decorators.no_debug_info_test - @decorators.expectedFlakeyDarwin + @decorators.expectedFailureAll(oslist=["macosx"], bugnumber="rdar://27648290") def testREPL(self): REPLTest.testREPL(self)
36f4144a01ed56baea9036e4e09a5d90b1c13372
crits/core/management/commands/mapreduces.py
crits/core/management/commands/mapreduces.py
from django.core.management.base import BaseCommand import crits.stats.handlers as stats class Command(BaseCommand): """ Script Class. """ help = "Runs mapreduces for CRITs." def handle(self, *args, **options): """ Script Execution. """ stats.generate_yara_hits() ...
from django.core.management.base import BaseCommand import crits.stats.handlers as stats class Command(BaseCommand): """ Script Class. """ help = "Runs mapreduces for CRITs." def handle(self, *args, **options): """ Script Execution. """ stats.generate_yara_hits() ...
Remove duplicate call to generate_filetypes()
Remove duplicate call to generate_filetypes()
Python
mit
Magicked/crits,lakiw/cripts,Magicked/crits,lakiw/cripts,lakiw/cripts,Magicked/crits,Magicked/crits,lakiw/cripts
--- +++ @@ -16,7 +16,6 @@ stats.generate_yara_hits() stats.generate_sources() stats.generate_filetypes() - stats.generate_filetypes() stats.generate_campaign_stats() stats.generate_counts() stats.target_user_stats()
027f89292c1d8e334e9e69222d1ec8753020e8bd
candidates/management/commands/candidates_check_for_inconsistent_data.py
candidates/management/commands/candidates_check_for_inconsistent_data.py
from __future__ import print_function, unicode_literals import sys from django.core.management.base import BaseCommand from candidates.models import check_paired_models class Command(BaseCommand): def handle(self, *args, **options): errors = check_paired_models() if errors: for err...
from __future__ import print_function, unicode_literals import sys from django.core.management.base import BaseCommand from candidates.models import ( check_paired_models, check_membership_elections_consistent) class Command(BaseCommand): def handle(self, *args, **options): errors = check_paired_m...
Add check_membership_elections_consistent to the data checking command
Add check_membership_elections_consistent to the data checking command
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
--- +++ @@ -4,13 +4,14 @@ from django.core.management.base import BaseCommand -from candidates.models import check_paired_models +from candidates.models import ( + check_paired_models, check_membership_elections_consistent) class Command(BaseCommand): def handle(self, *args, **options): - e...
fa3841fd79c4cbc8545b253a2797cfed2b644284
red_green_bar2.py
red_green_bar2.py
#!/usr/bin/env python2 ''' Given: 1. status code: (0 - OK, other value - BAD) 2. terminal window width shows red/green bar to visualize return code of previous command ''' import sys if len(sys.argv) >= 2: code = sys.argv[1] value = int(code) if value: col_char = '1' else: col_char =...
#!/usr/bin/env python2 ''' Given: 1. status code: (0 - OK, other value - BAD) 2. terminal window width shows red/green bar to visualize return code of previous command ''' import sys if len(sys.argv) >= 2: code = sys.argv[1] if code == 'y': col_char = '3' else: value = int(code) ...
Allow for yellow color after specifying y
Allow for yellow color after specifying y
Python
mit
kwadrat/rgb_tdd
--- +++ @@ -12,11 +12,14 @@ if len(sys.argv) >= 2: code = sys.argv[1] - value = int(code) - if value: - col_char = '1' + if code == 'y': + col_char = '3' else: - col_char = '2' + value = int(code) + if value: + col_char = '1' + else: + ...
b0efb7db50080dd1e9e96ad8d818e3b0859bbca3
retry/__init__.py
retry/__init__.py
# -*- coding: utf-8 -*- from functools import wraps import time class RetryExceededError(Exception): pass class retry(object): '''A decorator encapsulated retry logic. Usage: @retry(errors=(TTransportException, AnyExpectedError)) ''' def __init__(self, errors=(Exception, ), tries=3, delay=...
# -*- coding: utf-8 -*- from functools import wraps import time class RetryExceededError(Exception): pass class retry(object): '''A decorator encapsulated retry logic. Usage: @retry(errors=(TTransportException, AnyExpectedError)) @retry() # detect whatsoever errors and retry 3 times ''' ...
Add a usage in retry
Add a usage in retry
Python
mit
soasme/retries
--- +++ @@ -12,6 +12,7 @@ Usage: @retry(errors=(TTransportException, AnyExpectedError)) + @retry() # detect whatsoever errors and retry 3 times ''' def __init__(self, errors=(Exception, ), tries=3, delay=0):
54b21220db28dc4ce34a360d7754add872f702c7
systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
from pprint import pprint #[{u'accountId': 2, #u'add': True, #u'broadcastUri': u'vlan://untagged', #u'firstIP': False, #u'networkRate': 200, #u'newNic': False, #u'nicDevId': 1, #u'oneToOneNat': False, #u'publicIp': u'10.0.2.102', #u'sourceNat': True, #u'trafficType': u'Public', #u'vifMacAddress': ...
from pprint import pprint #[{u'accountId': 2, #u'add': True, #u'broadcastUri': u'vlan://untagged', #u'firstIP': False, #u'networkRate': 200, #u'newNic': False, #u'nicDevId': 1, #u'oneToOneNat': False, #u'publicIp': u'10.0.2.102', #u'sourceNat': True, #u'trafficType': u'Public', #u'vifMacAddress': ...
Use json naming standards instead of camelCase
Use json naming standards instead of camelCase
Python
apache-2.0
jcshen007/cloudstack,DaanHoogland/cloudstack,jcshen007/cloudstack,DaanHoogland/cloudstack,jcshen007/cloudstack,DaanHoogland/cloudstack,resmo/cloudstack,jcshen007/cloudstack,GabrielBrascher/cloudstack,resmo/cloudstack,wido/cloudstack,GabrielBrascher/cloudstack,wido/cloudstack,resmo/cloudstack,resmo/cloudstack,DaanHoogla...
--- +++ @@ -20,8 +20,8 @@ if mac == "id": continue for address in dbag[mac]: - if address['publicIp'] == ip['publicIp']: + if address['public_ip'] == ip['public_ip']: dbag[mac].remove(address) if ip['add']: - dbag.setdefault('eth' + str(ip...
4b52f2c237ff3c73af15846e7ae23436af8ab6c7
airesources/Python/BasicBot.py
airesources/Python/BasicBot.py
from hlt import * from networking import * playerTag, gameMap = getInit() sendInit("BasicBot"+str(playerTag)) turtleFactor = random.randint(1, 20) while True: moves = [] gameMap = getFrame() for y in range(0, len(gameMap.contents)): for x in range(0, len(gameMap.contents[y])): site = gameMap.contents[y][x] ...
from hlt import * from networking import * playerTag, gameMap = getInit() sendInit("BasicBot"+str(playerTag)) while True: moves = [] gameMap = getFrame() for y in range(0, len(gameMap.contents)): for x in range(0, len(gameMap.contents[y])): site = gameMap.contents[y][x] if site.owner == playerTag: dir...
Revert basic bot random turtle factor
Revert basic bot random turtle factor Former-commit-id: 53ffe42cf718cfedaa3ec329b0688c093513683c Former-commit-id: 6a282c036f4e11a0aa9e954f72050053059ac557 Former-commit-id: c52f52d401c4a3768c7d590fb02f3d08abd38002
Python
mit
HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,lanyudhy/Halite-II,yangle/HaliteIO,yangle/HaliteIO,lanyudhy/Halite-II,yangle/HaliteIO,yangle/HaliteIO,HaliteChallenge/Halite-II,yangle/HaliteIO,yangle/HaliteIO,lanyudhy/Halite-II,HaliteChallenge/Halite-II,lanyudhy/Halite-II,HaliteChallenge/Halite,HaliteChallenge/Halit...
--- +++ @@ -3,8 +3,6 @@ playerTag, gameMap = getInit() sendInit("BasicBot"+str(playerTag)) - -turtleFactor = random.randint(1, 20) while True: moves = [] @@ -15,7 +13,7 @@ site = gameMap.contents[y][x] if site.owner == playerTag: direction = random.randint(0, 5) - if site.strength < turtleFac...
0bff34400d912806a9d831f5e0436082d359a531
tomviz/python/tomviz/state/_pipeline.py
tomviz/python/tomviz/state/_pipeline.py
from tomviz._wrapping import PipelineStateManagerBase class PipelineStateManager(PipelineStateManagerBase): _instance = None # Need to define a constructor as the implementation on the C++ side is # static. def __init__(self): pass def __call__(cls): if cls._instance is None: ...
from tomviz._wrapping import PipelineStateManagerBase class PipelineStateManager(PipelineStateManagerBase): _instance = None def __new__(cls, *args, **kwargs): if cls._instance is None: cls._instance = PipelineStateManagerBase.__new__(cls, *args, **kwargs) return cls._instance
Fix singleton to work with wrapped manager class
Fix singleton to work with wrapped manager class Signed-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com>
Python
bsd-3-clause
OpenChemistry/tomviz,OpenChemistry/tomviz,OpenChemistry/tomviz,OpenChemistry/tomviz
--- +++ @@ -3,13 +3,8 @@ class PipelineStateManager(PipelineStateManagerBase): _instance = None - # Need to define a constructor as the implementation on the C++ side is - # static. - def __init__(self): - pass + def __new__(cls, *args, **kwargs): + if cls._instance is None: + ...
5a4401df95d3b8cb72e78edb30669d6fa88e4712
transaction_downloader/transaction_downloader.py
transaction_downloader/transaction_downloader.py
"""Transaction Downloader. Usage: transaction-downloader auth --account=<account-name> transaction-downloader -h | --help transaction-downloader --version Options: -h --help Show this screen. --version Show version. --account=<account-name> Account to work with. """ import...
"""Transaction Downloader. Usage: transaction-downloader auth --account=<account-name> transaction-downloader -h | --help transaction-downloader --version Options: -h --help Show this screen. --version Show version. --account=<account-name> Account to work with. """ import...
Read credentials based on account.
Read credentials based on account.
Python
mit
ebridges/plaid2qif,ebridges/plaid2qif,ebridges/plaid2qif
--- +++ @@ -31,5 +31,7 @@ args = docopt(__doc__, version=version) print(args) + credentials = read_credentials(args['--account']) + if __name__ == '__main__': main()
cbdcdf16285823a8e13a68c8e86d6957aa7aa6d8
kivy/tools/packaging/pyinstaller_hooks/pyi_rth_kivy.py
kivy/tools/packaging/pyinstaller_hooks/pyi_rth_kivy.py
import os import sys root = os.path.join(sys._MEIPASS, 'kivy_install') os.environ['KIVY_DATA_DIR'] = os.path.join(root, 'data') os.environ['KIVY_MODULES_DIR'] = os.path.join(root, 'modules') os.environ['GST_PLUGIN_PATH'] = '{};{}'.format( sys._MEIPASS, os.path.join(sys._MEIPASS, 'gst-plugins')) os.environ['GST_RE...
import os import sys root = os.path.join(sys._MEIPASS, 'kivy_install') os.environ['KIVY_DATA_DIR'] = os.path.join(root, 'data') os.environ['KIVY_MODULES_DIR'] = os.path.join(root, 'modules') os.environ['GST_PLUGIN_PATH'] = os.path.join(sys._MEIPASS, 'gst-plugins') os.environ['GST_REGISTRY'] = os.path.join(sys._MEIPAS...
Fix GST_PLUGIN_PATH in runtime hook
Fix GST_PLUGIN_PATH in runtime hook - Only include `gst-plugins` - Also, semicolon was only correct on Windows
Python
mit
inclement/kivy,inclement/kivy,kivy/kivy,kivy/kivy,akshayaurora/kivy,akshayaurora/kivy,kivy/kivy,matham/kivy,rnixx/kivy,matham/kivy,inclement/kivy,matham/kivy,matham/kivy,rnixx/kivy,akshayaurora/kivy,rnixx/kivy
--- +++ @@ -5,8 +5,7 @@ os.environ['KIVY_DATA_DIR'] = os.path.join(root, 'data') os.environ['KIVY_MODULES_DIR'] = os.path.join(root, 'modules') -os.environ['GST_PLUGIN_PATH'] = '{};{}'.format( - sys._MEIPASS, os.path.join(sys._MEIPASS, 'gst-plugins')) +os.environ['GST_PLUGIN_PATH'] = os.path.join(sys._MEIPASS,...
2a9ac93236838b12b58f2f180265a23658e2a95b
programmingtheorems/python/theorem_of_selection.py
programmingtheorems/python/theorem_of_selection.py
#! /usr/bin/env python # Copyright Lajos Katona # # 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...
#! /usr/bin/env python # Copyright Lajos Katona # # 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...
Fix typo in selection theorem
Fix typo in selection theorem Change-Id: Ieff9fe7e5783e0d3b995fb0ddbfc11015ca9197a
Python
apache-2.0
elajkat/hugradexam,elajkat/hugradexam
--- +++ @@ -15,15 +15,15 @@ # limitations under the License. -def selection_brute(mylist, t): - for i, l in enumerate(mylist): +def selection_brute(mlist, t): + for i, l in enumerate(mlist): if t == l: return i - return 0 + return -1 -def selection_pythonic(mylist, t): -...
f22cabf494f13535cdbb489f12e98c7358a29f74
openstack/tests/functional/telemetry/v2/test_sample.py
openstack/tests/functional/telemetry/v2/test_sample.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Fix the telemetry sample test
Fix the telemetry sample test This test works fine on devstack, but on the test gate not all the meters have samples, so only iterate over them if there are samples. Partial-bug: #1665495 Change-Id: I8f327737a53194aeba08925391f1976f1b506aa0
Python
apache-2.0
dtroyer/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-openstacksdk,dtroyer/python-openstacksdk
--- +++ @@ -22,5 +22,5 @@ def test_list(self): for meter in self.conn.telemetry.meters(): - sot = next(self.conn.telemetry.samples(meter)) - assert isinstance(sot, sample.Sample) + for sot in self.conn.telemetry.samples(meter): + assert isinstance(sot, s...
618a1f520f2584ec3cf56b29cf71c9ad6b4240fd
tests/acceptance/assignments/one_second_timeout/correct_solution/sleep.py
tests/acceptance/assignments/one_second_timeout/correct_solution/sleep.py
from time import sleep sleep(1)
from time import sleep # Due to the overhead of Python, sleeping for 1 second will cause testing to # time out if the timeout is 1 second sleep(1)
Add comment to one_second_timeout assignment
Add comment to one_second_timeout assignment
Python
agpl-3.0
git-keeper/git-keeper,git-keeper/git-keeper
--- +++ @@ -1,3 +1,5 @@ from time import sleep +# Due to the overhead of Python, sleeping for 1 second will cause testing to +# time out if the timeout is 1 second sleep(1)
1f3e56b79f933a1d450074d1c4485e34c97f2806
pyqt.py
pyqt.py
#! /usr/bin/python3 import sys from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QLabel, QApplication, QPushButton) from PyQt5.QtGui import QPixmap from PyQt5.QtCore import QObject class FreakingQtImageViewer(QWidget): def __init__(self, function): super().__init__() self.function = ...
#! /usr/bin/python3 import sys import time from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QLabel, QApplication, QPushButton) from PyQt5.QtGui import QPixmap from PyQt5.QtCore import QObject class FreakingQtImageViewer(QWidget): def __init__(self, function): super().__init__() self...
Update image every 0.5s till button gets pressed again
Update image every 0.5s till button gets pressed again
Python
mit
philipptrenz/draughtsCV,philipptrenz/Physical-Image-Manipulation-Program,philipptrenz/draughtsCV
--- +++ @@ -1,6 +1,7 @@ #! /usr/bin/python3 import sys +import time from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QLabel, QApplication, QPushButton) from PyQt5.QtGui import QPixmap @@ -12,15 +13,22 @@ def __init__(self, function): super().__init__() self.function = function -...
008f0a2b0a7823e619410c5af70061d093c6f3de
timeseries.py
timeseries.py
#!/usr/bin/env python #Go through an OpenXC trace file and plot a time series graph using #matplotlib import json import sys import argparse from pylab import * def main(): #Set up the command line argument parser parser = argparse.ArgumentParser() parser.add_argument("input_file", ...
#!/usr/bin/env python #Go through an OpenXC trace file and plot a time series graph using #matplotlib import json import sys import argparse from pylab import * def main(): #Set up the command line argument parser parser = argparse.ArgumentParser() parser.add_argument("input_file", ...
Allow plotting two types against one another.
Allow plotting two types against one another.
Python
bsd-3-clause
openxc/openxc-data-tools
--- +++ @@ -16,12 +16,16 @@ help = "name of the input file") parser.add_argument("-y", help = "the key to use for the function being plotted") + parser.add_argument("-x", + help = "the key to use for the function being plotted", + ...
7d9ec40e8a48e747880a35279b63439afccc1284
urls.py
urls.py
# -*- coding: utf-8 -*- from django.conf.urls import patterns, url from django.conf import settings import os.path static_files_path = os.path.join(settings.PROJECT_DIR, "static") urlpatterns = patterns('vortaro.views', url(r'^informo$', 'about', name="about"), url(r'^informo/api$', 'about_the_api', name="abo...
# -*- coding: utf-8 -*- from django.conf.urls import patterns, url from django.conf import settings from django.views.generic import TemplateView import os.path static_files_path = os.path.join(settings.PROJECT_DIR, "static") urlpatterns = patterns('vortaro.views', url(r'^informo$', 'about', name="about"), u...
Allow viewing the 404 page during development.
Allow viewing the 404 page during development.
Python
agpl-3.0
Wilfred/simpla-vortaro,Wilfred/simpla-vortaro
--- +++ @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- from django.conf.urls import patterns, url from django.conf import settings +from django.views.generic import TemplateView + import os.path static_files_path = os.path.join(settings.PROJECT_DIR, "static") @@ -24,4 +26,6 @@ # Serve static files using Django d...
7481c6aad4cd844b0c3fab6f05e4d24aa3c17770
src/nodeconductor_assembly_waldur/invoices/log.py
src/nodeconductor_assembly_waldur/invoices/log.py
from nodeconductor.logging.loggers import EventLogger, event_logger class InvoiceLogger(EventLogger): month = int year = int customer = 'structure.Customer' class Meta: event_types = ('invoice_created', 'invoice_paid', 'invoice_canceled') event_logger.register('invoice', InvoiceLogger)
from nodeconductor.logging.loggers import EventLogger, event_logger class InvoiceLogger(EventLogger): month = int year = int customer = 'structure.Customer' class Meta: event_types = ('invoice_created', 'invoice_paid', 'invoice_canceled') event_groups = { 'customers': even...
Define groups for the invoice events.
Define groups for the invoice events. - wal-202
Python
mit
opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind
--- +++ @@ -8,5 +8,10 @@ class Meta: event_types = ('invoice_created', 'invoice_paid', 'invoice_canceled') + event_groups = { + 'customers': event_types, + 'invoices': event_types, + } + event_logger.register('invoice', InvoiceLogger)
6618b12cef2759174148d1c7f69cbb91b8ea4482
mygpo/podcasts/migrations/0015_auto_20140616_2126.py
mygpo/podcasts/migrations/0015_auto_20140616_2126.py
# encoding: utf8 from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('podcasts', '0014_auto_20140615_1032'), ] operations = [ migrations.AlterField( model_name='slug', name='sco...
# encoding: utf8 from __future__ import unicode_literals from django.db import models, migrations def set_scope(apps, schema_editor): URL = apps.get_model('podcasts', 'URL') Slug = apps.get_model('podcasts', 'Slug') URL.objects.filter(scope__isnull=True).update(scope='') Slug.objects.filter(scope__i...
Fix data migration when making scope non-null
[DB] Fix data migration when making scope non-null
Python
agpl-3.0
gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo
--- +++ @@ -2,6 +2,14 @@ from __future__ import unicode_literals from django.db import models, migrations + + +def set_scope(apps, schema_editor): + URL = apps.get_model('podcasts', 'URL') + Slug = apps.get_model('podcasts', 'Slug') + + URL.objects.filter(scope__isnull=True).update(scope='') + Slug.ob...
e5af653b2133b493c7888bb305488e932acb2274
doc/examples/special/plot_hinton.py
doc/examples/special/plot_hinton.py
""" ============== Hinton diagram ============== Hinton diagrams are useful for visualizing the values of a 2D array. Positive and negative values represented by white and black squares, respectively, and the size of each square represents the magnitude of each value. The `special.hinton` function is based off of the...
""" ============== Hinton diagram ============== Hinton diagrams are useful for visualizing the values of a 2D array: Positive and negative values are represented by white and black squares, respectively, and the size of each square represents the magnitude of each value. ``special.hinton`` is based off of the `Hinto...
Clean up hinton example text.
DOC: Clean up hinton example text.
Python
bsd-3-clause
tonysyu/mpltools,matteoicardi/mpltools
--- +++ @@ -3,20 +3,24 @@ Hinton diagram ============== -Hinton diagrams are useful for visualizing the values of a 2D array. Positive -and negative values represented by white and black squares, respectively, and -the size of each square represents the magnitude of each value. +Hinton diagrams are useful for vis...
d2a0d0d22a8369c99626ca754a337ea8076f7efa
aybu/core/models/migrations/versions/587c89cfa8ea_added_column_weight_.py
aybu/core/models/migrations/versions/587c89cfa8ea_added_column_weight_.py
"""Added column 'weight' to Banner, Logo and Background. Revision ID: 587c89cfa8ea Revises: 2c0bfc379e01 Create Date: 2012-05-11 14:36:15.518757 """ # downgrade revision identifier, used by Alembic. revision = '587c89cfa8ea' down_revision = '2c0bfc379e01' from alembic import op import sqlalchemy as sa def upgrade...
"""Added column 'weight' to Banner, Logo and Background. Revision ID: 587c89cfa8ea Revises: 2c0bfc379e01 Create Date: 2012-05-11 14:36:15.518757 """ # downgrade revision identifier, used by Alembic. revision = '587c89cfa8ea' down_revision = '2c0bfc379e01' from alembic import op import sqlalchemy as sa def upgrade...
Fix bug in migration script
Fix bug in migration script
Python
apache-2.0
asidev/aybu-core
--- +++ @@ -16,9 +16,16 @@ def upgrade(): ### commands auto generated by Alembic - please adjust! ### - op.add_column('files', sa.Column('weight', sa.Integer(), - nullable=False, default=0)) - ### end Alembic commands ### + op.add_column('files', sa.Column('weight'...
319927dd4548f8d5990bad4be271bfce7f29b10b
subscribe/management/commands/refresh_issuers.py
subscribe/management/commands/refresh_issuers.py
from django.core.management.base import BaseCommand from django.db.transaction import commit_on_success from subscribe.models import IdealIssuer from lib import mollie # command to update bank list (ideal issuers) # run as 'python manage.py refresh_issuers' class Command(BaseCommand): @commit_on_success ...
from django.core.management.base import BaseCommand from django.db import transaction from subscribe.models import IdealIssuer from lib import mollie # command to update bank list (ideal issuers) # run as 'python manage.py refresh_issuers' class Command(BaseCommand): @transaction.atomic def handle(self,...
Replace deprecated commit_on_success by atomic
Replace deprecated commit_on_success by atomic
Python
mit
jonge-democraten/dyonisos,jonge-democraten/dyonisos,jonge-democraten/dyonisos
--- +++ @@ -1,5 +1,5 @@ from django.core.management.base import BaseCommand -from django.db.transaction import commit_on_success +from django.db import transaction from subscribe.models import IdealIssuer @@ -9,7 +9,7 @@ # run as 'python manage.py refresh_issuers' class Command(BaseCommand): - @commi...
5e368e1fbf30a3e489be6c754d8b888a31bfde47
wger/manager/migrations/0011_remove_set_exercises.py
wger/manager/migrations/0011_remove_set_exercises.py
# Generated by Django 3.1.5 on 2021-02-28 14:10 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('manager', '0010_auto_20210102_1446'), ] operations = [ migrations.RemoveField( model_name='set', name='exercises', )...
# Generated by Django 3.1.5 on 2021-02-28 14:10 from django.db import migrations def increment_order(apps, schema_editor): """ Increment the oder in settings so ensure the order is preserved Otherwise, and depending on the database, when a set has supersets, the exercises could be ordered alphabetic...
Increment the oder in settings so ensure the order is preserved
Increment the oder in settings so ensure the order is preserved Otherwise, and depending on the database, when a set has supersets, the exercises could be ordered alphabetically.
Python
agpl-3.0
wger-project/wger,petervanderdoes/wger,wger-project/wger,wger-project/wger,petervanderdoes/wger,wger-project/wger,petervanderdoes/wger,petervanderdoes/wger
--- +++ @@ -1,6 +1,25 @@ # Generated by Django 3.1.5 on 2021-02-28 14:10 from django.db import migrations + + +def increment_order(apps, schema_editor): + """ + Increment the oder in settings so ensure the order is preserved + + Otherwise, and depending on the database, when a set has supersets, the + ...
29c437e15f7793886c80b71ca6764184caff2597
readthedocs/oauth/management/commands/load_project_remote_repo_relation.py
readthedocs/oauth/management/commands/load_project_remote_repo_relation.py
import json from django.core.management.base import BaseCommand from readthedocs.oauth.models import RemoteRepository class Command(BaseCommand): help = "Load Project and RemoteRepository Relationship from JSON file" def add_arguments(self, parser): # File path of the json file containing relations...
import json from django.core.management.base import BaseCommand from readthedocs.oauth.models import RemoteRepository class Command(BaseCommand): help = "Load Project and RemoteRepository Relationship from JSON file" def add_arguments(self, parser): # File path of the json file containing relations...
Check if the remote_repo was updated or not and log error
Check if the remote_repo was updated or not and log error
Python
mit
rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org
--- +++ @@ -36,9 +36,19 @@ for item in data: try: - RemoteRepository.objects.filter( + update_count = RemoteRepository.objects.filter( remote_id=item['remote_id'] ).update(project_id=item['project_id']) + + if u...
9696cbc35830b69767320166424e21d717e71d12
tests/__init__.py
tests/__init__.py
# -*- coding: utf-8 """ Python implementation of Non-Stationary Gabor Transform (NSGT) derived from MATLAB code by NUHAG, University of Vienna, Austria Thomas Grill, 2011-2015 http://grrrr.org/nsgt Austrian Research Institute for Artificial Intelligence (OFAI) AudioMiner project, supported by Vienna Science and Tech...
# -*- coding: utf-8 """ Python implementation of Non-Stationary Gabor Transform (NSGT) derived from MATLAB code by NUHAG, University of Vienna, Austria Thomas Grill, 2011-2015 http://grrrr.org/nsgt Austrian Research Institute for Artificial Intelligence (OFAI) AudioMiner project, supported by Vienna Science and Tech...
Initialize random generator seed for unit testing
Initialize random generator seed for unit testing
Python
artistic-2.0
grrrr/nsgt
--- +++ @@ -14,3 +14,11 @@ Unit test module """ + +import random +import numpy as np + +# seed random generators for unit testing +random.seed(666) +np.random.seed(666) +
dd42c1c1b1cd0cbe55c27cafe9d2db5466782bc4
server/users-microservice/src/api/users/userModel.py
server/users-microservice/src/api/users/userModel.py
from index import db class UserModel(db.Model): __tablename__ = 'User' id = db.Column(db.Integer, primary_key=True, nullable=False) name = db.Column(db.String(80), unique=True, nullable=False) fullname = db.Column(db.String(80), unique=True, nullable=False) initials = db.Column(db.String(10), uniq...
from index import db, brcypt class UserModel(db.Model): __tablename__ = 'User' id = db.Column(db.Integer, primary_key=True, nullable=False) name = db.Column(db.String(80), unique=True, nullable=False) fullname = db.Column(db.String(80), unique=True, nullable=False) initials = db.Column(db.String(1...
Encrypt password before saving user
Encrypt password before saving user
Python
mit
Madmous/Trello-Clone,Madmous/madClones,Madmous/madClones,Madmous/madClones,Madmous/madClones,Madmous/Trello-Clone,Madmous/Trello-Clone
--- +++ @@ -1,4 +1,4 @@ -from index import db +from index import db, brcypt class UserModel(db.Model): @@ -16,8 +16,15 @@ self.fullname = fullname self.initials = initials self.email = email - self.password = password self.application = application + + self.set_p...
17492956ea8b4ed8b5465f6a057b6e026c2d4a75
openquake/engine/tests/export/core_test.py
openquake/engine/tests/export/core_test.py
# Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenQuake is distr...
# Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenQuake is distr...
Fix a broken export test
Fix a broken export test Former-commit-id: 4b369edfcb5782a2461742547f5b6af3bab4f759 [formerly e37e964bf9d2819c0234303d31ed2839c317be04] Former-commit-id: 5b8a20fa99eab2f33c8f293a505a2dbadad36eee
Python
agpl-3.0
gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine
--- +++ @@ -26,7 +26,7 @@ return the number of occurrences of the element in a given XML document. """ expr = '//%s' % elem_name - return len(tree.xpath(expr, namespaces=nrml.PARSE_NS_MAP)) + return len(tree.xpath(expr, namespaces={'nrml': nrml.NRML05})) class BaseExportTestCase(unittest.Tes...
17ab8c01a88bda8dba4aaa5e57c857babfeb9444
debtcollector/fixtures/disable.py
debtcollector/fixtures/disable.py
# -*- coding: utf-8 -*- # Copyright (C) 2015 Yahoo! 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...
# -*- coding: utf-8 -*- # Copyright (C) 2015 Yahoo! 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...
Stop to use the __future__ module.
Stop to use the __future__ module. The __future__ module [1] was used in this context to ensure compatibility between python 2 and python 3. We previously dropped the support of python 2.7 [2] and now we only support python 3 so we don't need to continue to use this module and the imports listed below. Imports commo...
Python
apache-2.0
openstack/debtcollector
--- +++ @@ -13,8 +13,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -from __future__ import absolute_import import fixtures
00479e3d59e7472c77ea2357f25d5579ad5d5b25
director/director/config/local.py
director/director/config/local.py
from configurations import values from .common import Common class Local(Common): JWT_SECRET = values.Value('not-a-secret') DEBUG = values.BooleanValue(True)
from configurations import values from .common import Common class Local(Common): JWT_SECRET = values.Value('not-a-secret') DEBUG = values.BooleanValue(True) EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Use console EMAIL_BACKEND in development
Use console EMAIL_BACKEND in development
Python
apache-2.0
stencila/hub,stencila/hub,stencila/hub,stencila/hub,stencila/hub
--- +++ @@ -5,3 +5,4 @@ JWT_SECRET = values.Value('not-a-secret') DEBUG = values.BooleanValue(True) + EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
e75e35bd7ffb44b8f5c5a5d674a15c6c366f84ac
django_medusa/management/commands/staticsitegen.py
django_medusa/management/commands/staticsitegen.py
from django.conf import settings from django.core.management.base import BaseCommand from django.core.urlresolvers import set_script_prefix from django_medusa.renderers import StaticSiteRenderer from django_medusa.utils import get_static_renderers class Command(BaseCommand): can_import_settings = True help =...
from django.conf import settings from django.core.management.base import BaseCommand from django.core.urlresolvers import set_script_prefix from django_medusa.renderers import StaticSiteRenderer from django_medusa.utils import get_static_renderers class Command(BaseCommand): can_import_settings = True help =...
Handle cases when MEDUSA_URL_PREFIX isn't set
Handle cases when MEDUSA_URL_PREFIX isn't set
Python
mit
hyperair/django-medusa
--- +++ @@ -20,7 +20,7 @@ renderer.paths # Set script prefix here - url_prefix = getattr(settings, 'MEDUSA_URL_PREFIX') + url_prefix = getattr(settings, 'MEDUSA_URL_PREFIX', None) if url_prefix is not None: set_script_prefix(url_prefix)
6160507169c3cdc837b3472bdeb4c604b5c0d5fd
driver27/templatetags/driver27.py
driver27/templatetags/driver27.py
# -*- coding: utf-8 -*- from django import template from ..models import Season, Race from ..common import ordered_position register = template.Library() @register.filter def champion_filter(season_id): if season_id: season = Season.objects.get(pk=season_id) return '<span class="champion_tag">&#981...
# -*- coding: utf-8 -*- from django import template from ..models import Season, Race from ..common import ordered_position register = template.Library() @register.filter def champion_filter(season_id): if season_id: season = Season.objects.get(pk=season_id) return '<span class="champion_tag">&#981...
Fix 'print_pos' templatetag for 2.7
Fix 'print_pos' templatetag for 2.7
Python
mit
SRJ9/django-driver27,SRJ9/django-driver27,SRJ9/django-driver27
--- +++ @@ -28,7 +28,7 @@ if pos: str_pos = u'{pos}º'.format(pos=pos) if pos == 1: - str_pos = '<strong>{0}</strong>'.format(str_pos) + str_pos = u'<strong>{0}</strong>'.format(str_pos) return str_pos @register.filter
5aba92fff0303546be0850f786a25659453674a6
masters/master.chromium.webkit/master_source_cfg.py
masters/master.chromium.webkit/master_source_cfg.py
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from buildbot.changes import svnpoller from buildbot.scheduler import AnyBranchScheduler from common import chromium_utils from master import build_uti...
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from buildbot.scheduler import AnyBranchScheduler from master import gitiles_poller def Update(config, _active_master, c): # Polls config.Master.tru...
Remove blink scheduler from chromium.webkit
Remove blink scheduler from chromium.webkit For context, please see: https://groups.google.com/a/chromium.org/d/msg/blink-dev/S-P3N0kdkMM/ohfRyTNyAwAJ https://groups.google.com/a/chromium.org/d/msg/blink-dev/3APcgCM52JQ/OyqNugnFAAAJ BUG=431478 Review URL: https://codereview.chromium.org/1351623005 git-svn-id: 239...
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
--- +++ @@ -2,18 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from buildbot.changes import svnpoller from buildbot.scheduler import AnyBranchScheduler -from common import chromium_utils - -from master import build_utils from master import giti...
4c99dc23e1406b5e73c541993c4ffa4f92bc9a8a
src/_version.py
src/_version.py
__all__ = ('version', '__version__') version = (0, 14, 0) __version__ = '.'.join(str(x) for x in version)
__all__ = ('version', '__version__') version = (0, 14, 999, 1) __version__ = '.'.join(str(x) for x in version)
Bump version to 0.14.999.1 (next release on this branch will be 0.15.0)
Bump version to 0.14.999.1 (next release on this branch will be 0.15.0) 20080110143356-53eee-be816768f9cc7e023de858d0d314cbbec894ffa1.gz
Python
lgpl-2.1
PabloCastellano/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,PabloCastellano/telepathy-python,max-posedon/telepathy-python,epage/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,detrout/telepathy-python,detrout/telepathy-python,max-posedon/telepathy-python,epage/t...
--- +++ @@ -1,4 +1,4 @@ __all__ = ('version', '__version__') -version = (0, 14, 0) +version = (0, 14, 999, 1) __version__ = '.'.join(str(x) for x in version)
659614a6b845a95ce7188e86adae4bdc2c5416e7
examples/benchmark/__init__.py
examples/benchmark/__init__.py
#import benchmark_fibonacci import benchmark_twisted_names __all__ = ['benchmark_fibonacci', 'benchmark_twisted_names']
import benchmark_fibonacci import benchmark_twisted_names __all__ = ['benchmark_fibonacci', 'benchmark_twisted_names']
Add back commented out Fibonacci benchmark.
Add back commented out Fibonacci benchmark.
Python
mit
AlekSi/benchmarking-py
--- +++ @@ -1,4 +1,4 @@ -#import benchmark_fibonacci +import benchmark_fibonacci import benchmark_twisted_names __all__ = ['benchmark_fibonacci', 'benchmark_twisted_names']
aaaaa3a143c370f387edf42ebd6b22c924845afa
falcom/luhn/check_digit_number.py
falcom/luhn/check_digit_number.py
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. class CheckDigitNumber: def __init__ (self, number = None): self.__set_number(number) def get_check_digit (self): i...
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. class CheckDigitNumber: def __init__ (self, number = None): self.__set_number(number) def generate_from_int (self, n): ...
Make it clear that the user must implement generate_from_int
Make it clear that the user must implement generate_from_int
Python
bsd-3-clause
mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation
--- +++ @@ -6,6 +6,9 @@ def __init__ (self, number = None): self.__set_number(number) + + def generate_from_int (self, n): + raise NotImplementedError def get_check_digit (self): if self:
0dcecfbd1e6ce9e35febc9f4ee9bcbfac1fb8f6a
hytra/util/skimage_tifffile_hack.py
hytra/util/skimage_tifffile_hack.py
from __future__ import print_function, absolute_import, nested_scopes, generators, division, with_statement, unicode_literals from skimage.external import tifffile def hack(input_tif): """ This method allows to bypass the strange faulty behaviour of skimage.external.tifffile.imread() when it gets a list of...
from __future__ import print_function, absolute_import, nested_scopes, generators, division, with_statement, unicode_literals from skimage.external import tifffile import os.path def hack(input_tif): """ This method allows to bypass the strange faulty behaviour of skimage.external.tifffile.imread() when it...
Fix tiffile hack to use os.path
Fix tiffile hack to use os.path
Python
mit
chaubold/hytra,chaubold/hytra,chaubold/hytra
--- +++ @@ -1,18 +1,19 @@ from __future__ import print_function, absolute_import, nested_scopes, generators, division, with_statement, unicode_literals from skimage.external import tifffile +import os.path def hack(input_tif): """ This method allows to bypass the strange faulty behaviour of skimag...
f48063cfb9674c1e5f1f94e62ff43b239f687abd
examples/plot_tot_histogram.py
examples/plot_tot_histogram.py
""" ================== ToT histogram. ================== Create a simple histogram of the PMT signals (ToTs) in all events. """ # Author: Tamas Gal <tgal@km3net.de> # License: BSD-3 import pandas as pd import matplotlib.pyplot as plt import km3pipe.style km3pipe.style.use("km3pipe") filename = "data/km3net_jul13_9...
""" ================== ToT histogram. ================== Create a simple histogram of the PMT signals (ToTs) in all events. """ # Author: Tamas Gal <tgal@km3net.de> # License: BSD-3 import tables as tb import matplotlib.pyplot as plt import km3pipe.style km3pipe.style.use("km3pipe") filename = "data/km3net_jul13_9...
Fix for new km3hdf5 version 4
Fix for new km3hdf5 version 4
Python
mit
tamasgal/km3pipe,tamasgal/km3pipe
--- +++ @@ -9,7 +9,7 @@ # Author: Tamas Gal <tgal@km3net.de> # License: BSD-3 -import pandas as pd +import tables as tb import matplotlib.pyplot as plt import km3pipe.style km3pipe.style.use("km3pipe") @@ -17,7 +17,9 @@ filename = "data/km3net_jul13_90m_muatm50T655.km3_v5r1.JTE_r2356.root.0-499.h5" -hits ...
34125781c38af9aacc33d20117b6c3c6dbb89211
migrations/versions/070_fix_folder_easfoldersyncstatus_unique_constraints.py
migrations/versions/070_fix_folder_easfoldersyncstatus_unique_constraints.py
"""Fix Folder, EASFolderSyncStatus unique constraints Revision ID: 2525c5245cc2 Revises: 479b3b84a73e Create Date: 2014-07-28 18:57:24.476123 """ # revision identifiers, used by Alembic. revision = '2525c5245cc2' down_revision = '479b3b84a73e' from alembic import op import sqlalchemy as sa from inbox.ignition impo...
"""Fix Folder, EASFolderSyncStatus unique constraints Revision ID: 2525c5245cc2 Revises: 479b3b84a73e Create Date: 2014-07-28 18:57:24.476123 """ # revision identifiers, used by Alembic. revision = '2525c5245cc2' down_revision = '479b3b84a73e' from alembic import op import sqlalchemy as sa from inbox.ignition impo...
Rename FK in migration 70 - For some reason, Gunks' db has it named differently than ours.
Rename FK in migration 70 - For some reason, Gunks' db has it named differently than ours.
Python
agpl-3.0
gale320/sync-engine,EthanBlackburn/sync-engine,ErinCall/sync-engine,Eagles2F/sync-engine,jobscore/sync-engine,PriviPK/privipk-sync-engine,EthanBlackburn/sync-engine,closeio/nylas,wakermahmud/sync-engine,wakermahmud/sync-engine,EthanBlackburn/sync-engine,wakermahmud/sync-engine,nylas/sync-engine,gale320/sync-engine,Erin...
--- +++ @@ -21,10 +21,10 @@ def upgrade(): - op.drop_constraint('folder_ibfk_1', 'folder', type_='foreignkey') + op.drop_constraint('folder_fk1', 'folder', type_='foreignkey') op.drop_constraint('account_id', 'folder', type_='unique') - op.create_foreign_key('folder_ibfk_1', + op.create_foreig...
8521ff7dcac5b81067e9e601b0901a182c24d050
processors/fix_changeline_budget_titles.py
processors/fix_changeline_budget_titles.py
import json import logging if __name__ == "__main__": input = sys.argv[1] output = sys.argv[2] processor = fix_changeline_budget_titles().process(input,output,[]) class fix_changeline_budget_titles(object): def process(self,inputs,output): out = [] budgets = {} changes_json...
import json import logging if __name__ == "__main__": input = sys.argv[1] output = sys.argv[2] processor = fix_changeline_budget_titles().process(input,output,[]) class fix_changeline_budget_titles(object): def process(self,inputs,output): out = [] budgets = {} changes_json...
Fix bug in changeling title fix - it used to remove some lines on the way...
Fix bug in changeling title fix - it used to remove some lines on the way...
Python
mit
omerbartal/open-budget-data,omerbartal/open-budget-data,OpenBudget/open-budget-data,OpenBudget/open-budget-data
--- +++ @@ -26,10 +26,12 @@ line = json.loads(line.strip()) key = "%(year)s/%(budget_code)s" % line title = budgets.get(key) - if title != None and title != line['budget_title']: - line['budget_title'] = title - changed_num += 1 + ...
f0b188f398d82b000fdaa40e0aa776520a962a65
integration_tests/testpyagglom.py
integration_tests/testpyagglom.py
import sys import platform import h5py import numpy segh5 = sys.argv[1] predh5 = sys.argv[2] classifier = sys.argv[3] threshold = float(sys.argv[4]) from neuroproof import Agglomeration # open as uint32 and float respectively seg = numpy.array(h5py.File(segh5)['stack'], numpy.uint32) pred = numpy.array(h5py.File(pre...
import sys import platform import h5py import numpy segh5 = sys.argv[1] predh5 = sys.argv[2] classifier = sys.argv[3] threshold = float(sys.argv[4]) from neuroproof import Agglomeration # open as uint32 and float respectively seg = numpy.array(h5py.File(segh5)['stack'], numpy.uint32) pred = numpy.array(h5py.File(pre...
Allow multiple 'golden' results for agglomeration test on Linux
tests: Allow multiple 'golden' results for agglomeration test on Linux
Python
bsd-3-clause
janelia-flyem/NeuroProof,janelia-flyem/NeuroProof,janelia-flyem/NeuroProof,janelia-flyem/NeuroProof
--- +++ @@ -22,13 +22,14 @@ # The 'golden' results depend on std::unordered, and therefore # the expected answer is different on Mac and Linux. if platform.system() == "Darwin": - expected_unique = 239 + expected_unique = [239] else: - expected_unique = 233 + # Depending on which linux stdlib we use, ...
bb22c2f673e97ff1f11546d63e990bede4bb2526
linkfiles/.config/ipython/profile_grace/startup/30-grace.py
linkfiles/.config/ipython/profile_grace/startup/30-grace.py
# (c) Stefan Countryman 2017 # set up an interactive environment with gracedb rest api access. import ligo.gracedb.rest client = ligo.gracedb.rest.GraceDb()
# (c) Stefan Countryman 2017 # set up an interactive environment with gracedb rest api access. import ligo.gracedb.rest client = ligo.gracedb.rest.GraceDb() def gcn_notice_filenames(graceids): """Take a list of GraceIDs and check whether they have LVC GCN-notices. If so, print those notice filenames for GraceD...
Add gcn_notice_filename function to igrace
Add gcn_notice_filename function to igrace
Python
mit
stefco/dotfiles,stefco/dotfiles,stefco/dotfiles
--- +++ @@ -2,3 +2,11 @@ # set up an interactive environment with gracedb rest api access. import ligo.gracedb.rest client = ligo.gracedb.rest.GraceDb() + +def gcn_notice_filenames(graceids): + """Take a list of GraceIDs and check whether they have LVC GCN-notices. If + so, print those notice filenames for G...
c2a1ce0ad4e2f2e9ff5ec72b89eb98967e445ea5
labsys/utils/custom_fields.py
labsys/utils/custom_fields.py
from wtforms.fields import RadioField class NullBooleanField(RadioField): DEFAULT_CHOICES = ((True, 'Sim'), (False, 'Não'), (None, 'Ignorado')) def __init__(self, **kwargs): super().__init__(**kwargs) self.choices = kwargs.pop('choices', self.DEFAULT_CHOICES) def iter_choices(self): ...
from wtforms.fields import RadioField class NullBooleanField(RadioField): DEFAULT_CHOICES = ((True, 'Sim'), (False, 'Não'), (None, 'Ignorado')) TRUE_VALUES = ('True', 'true') FALSE_VALUES = ('False', 'false') NONE_VALUES = ('None', 'none', 'null', '') def __init__(self, **kwargs): super()...
Improve NullBooleanField with Truthy/Falsy values
:art: Improve NullBooleanField with Truthy/Falsy values
Python
mit
gems-uff/labsys,gems-uff/labsys,gems-uff/labsys
--- +++ @@ -1,7 +1,12 @@ from wtforms.fields import RadioField + class NullBooleanField(RadioField): DEFAULT_CHOICES = ((True, 'Sim'), (False, 'Não'), (None, 'Ignorado')) + TRUE_VALUES = ('True', 'true') + FALSE_VALUES = ('False', 'false') + NONE_VALUES = ('None', 'none', 'null', '') + def __in...
ebcb9a4449bd22aa39a5b05fff91bd46e06086b4
python/csgo-c4-hue-server.py
python/csgo-c4-hue-server.py
import json import requests from flask import Flask, session, request, current_app app = Flask(__name__) @app.route("/", methods=["POST"]) def main(): f = open('bomb_status', 'w') json_data = json.loads(request.data) round_data = json_data.get('round', {}) bomb_status = str(round_data.get('...
import json import requests from flask import Flask, session, request, current_app app = Flask(__name__) @app.route("/", methods=["POST"]) def main(): with open('bomb_status', 'w') as f: json_data = json.loads(request.data) round_data = json_data.get('round', {}) bomb_status = s...
Use `with` for writing to file
Use `with` for writing to file
Python
mit
doobix/csgo-c4-hue
--- +++ @@ -6,13 +6,12 @@ @app.route("/", methods=["POST"]) def main(): - f = open('bomb_status', 'w') - json_data = json.loads(request.data) - round_data = json_data.get('round', {}) - bomb_status = str(round_data.get('bomb', '')) - f.write(bomb_status) - f.close() - print bomb_status + w...