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
e103191a347baf446e76a12b9bc77986aa95dc2d
udata/__init__.py
udata/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' uData ''' from __future__ import unicode_literals __version__ = '1.2.11.dev' __description__ = 'Open data portal'
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' uData ''' from __future__ import unicode_literals __version__ = '1.3.0.dev' __description__ = 'Open data portal'
Set working version to 1.3.0.dev
Set working version to 1.3.0.dev
Python
agpl-3.0
opendatateam/udata,opendatateam/udata,opendatateam/udata,etalab/udata,etalab/udata,etalab/udata
--- +++ @@ -5,5 +5,5 @@ ''' from __future__ import unicode_literals -__version__ = '1.2.11.dev' +__version__ = '1.3.0.dev' __description__ = 'Open data portal'
84e80ed4d36b102761e2c9b6900d46c4e126e9e6
main.py
main.py
#!/usr/bin/python # -*- coding: utf-8 -*- from google.cloud import error_reporting from google.cloud import logging from analysis import Analysis from trading import Trading from twitter import Twitter # Analyzes Trump tweets, makes stock trades, and sends tweet alerts. def twitter_callback(text, link): companies ...
#!/usr/bin/python # -*- coding: utf-8 -*- from google.cloud import error_reporting from google.cloud import logging from analysis import Analysis from trading import Trading from twitter import Twitter # Analyzes Trump tweets, makes stock trades, and sends tweet alerts. def twitter_callback(text, link): # Initial...
Use separate instances of analysis and trading for each thread
Use separate instances of analysis and trading for each thread
Python
mit
maxbbraun/trump2cash
--- +++ @@ -10,6 +10,11 @@ # Analyzes Trump tweets, makes stock trades, and sends tweet alerts. def twitter_callback(text, link): + + # Initialize these here to create separate httplib2 instances per thread. + analysis = Analysis() + trading = Trading() + companies = analysis.find_companies(text) logger....
bd7ef1be82a6cd68060dee47046d90202b3a9e0c
tempest/api/volume/test_availability_zone.py
tempest/api/volume/test_availability_zone.py
# Copyright 2014 NEC Corporation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
# Copyright 2014 NEC Corporation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
Remove unnecessary client alias in AvailabilityZoneTestJson
Remove unnecessary client alias in AvailabilityZoneTestJson The class AvailabilityZoneTestJson is inherited from base.BaseVolumeTest, and the latter has already declared the availability_zone_client. This patch removes the unnecessary client alias for availability_zone_client. Change-Id: I287d742087a72928774325681bb7...
Python
apache-2.0
masayukig/tempest,masayukig/tempest,Juniper/tempest,Juniper/tempest,openstack/tempest,cisco-openstack/tempest,cisco-openstack/tempest,openstack/tempest
--- +++ @@ -20,14 +20,10 @@ class AvailabilityZoneTestJSON(base.BaseVolumeTest): """Tests Availability Zone API List""" - @classmethod - def setup_clients(cls): - super(AvailabilityZoneTestJSON, cls).setup_clients() - cls.client = cls.availability_zone_client - @decorators.idempotent_...
bbfb09205974efa969fc636b6e1079a84dad3619
mcstatus/application.py
mcstatus/application.py
from flask import Flask from minecraft_query import MinecraftQuery app = Flask(__name__) @app.route('/mcstatus') def returnStatus(): try: query = MinecraftQuery("mc.voltaire.sh", 25565, 10, 3) basicQuery = query.get_status() fullQuery = query.get_rules() except socket.error as e...
from flask import Flask from minecraft_query import MinecraftQuery app = Flask(__name__) @app.route('/mcstatus') def returnStatus(): query = MinecraftQuery("142.54.162.42", 25565) basic_status = query.get_status() all_status = query.get_rules() server_info = 'The server has %d / %d players.' % (basic_...
Revert "check for connection failure"
Revert "check for connection failure" This reverts commit cf4bd49e150f5542a5a7abba908ca81ebe1b9e75.
Python
bsd-3-clause
voltaire/minecraft-site-old,voltaire/minecraft-site-old
--- +++ @@ -4,24 +4,13 @@ app = Flask(__name__) @app.route('/mcstatus') - def returnStatus(): - - try: - query = MinecraftQuery("mc.voltaire.sh", 25565, 10, 3) - basicQuery = query.get_status() - fullQuery = query.get_rules() - - except socket.error as e: - if not options.qu...
906247c6431b85c90f8aec8a7f4f73f1064abeba
mezzanine/pages/urls.py
mezzanine/pages/urls.py
from django.conf.urls.defaults import patterns, url # Page patterns. urlpatterns = patterns("mezzanine.pages.views", url("^admin_page_ordering/$", "admin_page_ordering", name="admin_page_ordering"), url("^(?P<slug>.*)/$", "page", name="page"), )
from django.conf.urls.defaults import patterns, url from django.conf import settings # Page patterns. urlpatterns = patterns("mezzanine.pages.views", url("^admin_page_ordering/$", "admin_page_ordering", name="admin_page_ordering"), url("^(?P<slug>.*)" + ("/" if settings.APPEND_SLASH else "") + "$", "...
Use Page URLs without trailing slash when settings.APPEND_SLASH is False
Use Page URLs without trailing slash when settings.APPEND_SLASH is False
Python
bsd-2-clause
biomassives/mezzanine,AlexHill/mezzanine,spookylukey/mezzanine,frankchin/mezzanine,saintbird/mezzanine,adrian-the-git/mezzanine,jjz/mezzanine,agepoly/mezzanine,geodesign/mezzanine,jerivas/mezzanine,saintbird/mezzanine,wyzex/mezzanine,Skytorn86/mezzanine,industrydive/mezzanine,ryneeverett/mezzanine,eino-makitalo/mezzani...
--- +++ @@ -1,10 +1,11 @@ from django.conf.urls.defaults import patterns, url +from django.conf import settings # Page patterns. urlpatterns = patterns("mezzanine.pages.views", url("^admin_page_ordering/$", "admin_page_ordering", name="admin_page_ordering"), - url("^(?P<slug>.*)/$", "page", ...
a9a5b9007f44495806bbdb876553974cd2d44e04
src/libpepper/utils/type_is.py
src/libpepper/utils/type_is.py
# Copyright (C) 2013 Andy Balaam and The Pepper Developers # Released under the MIT License. See the file COPYING.txt for details. # I assure you before God that what I am writing to you is no lie. # Galations 1 v20 import types import abc def type_is( typ, inst ): """ Check that instance is of (exact) type...
# Copyright (C) 2013 Andy Balaam and The Pepper Developers # Released under the MIT License. See the file COPYING.txt for details. # I assure you before God that what I am writing to you is no lie. # Galations 1 v20 import types import abc def type_is( typ, inst ): """ Check that inst is of (exact) type typ...
Fix incorrect name in comment.
Fix incorrect name in comment.
Python
mit
andybalaam/pepper,andybalaam/pepper,andybalaam/pepper,andybalaam/pepper,andybalaam/pepper
--- +++ @@ -9,7 +9,7 @@ def type_is( typ, inst ): """ - Check that instance is of (exact) type typ. + Check that inst is of (exact) type typ. Throws an Assertion error if not. The arguments order is supposed to be reminiscent of C/Java style function declarations.
32d5f2bfcaad65230632f1854fabd2e9de1c151b
tests/query_test/test_chars.py
tests/query_test/test_chars.py
#!/usr/bin/env python # Copyright (c) 2012 Cloudera, Inc. All rights reserved. # import logging import pytest from copy import copy from tests.common.test_vector import * from tests.common.impala_test_suite import * class TestStringQueries(ImpalaTestSuite): @classmethod def get_workload(cls): return 'function...
#!/usr/bin/env python # Copyright (c) 2012 Cloudera, Inc. All rights reserved. # import logging import pytest from copy import copy from tests.common.test_vector import * from tests.common.impala_test_suite import * class TestStringQueries(ImpalaTestSuite): @classmethod def get_workload(cls): return 'function...
Fix char test to only run on test/none.
Fix char test to only run on test/none. Change-Id: I8f5ac5a6e7399ce2fdbe78d07ae24deaa1d7532d Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4326 Tested-by: jenkins Reviewed-by: Alex Behm <fe1626037acfc2dc542d2aa723a6d14f2464a20c@cloudera.com>
Python
apache-2.0
ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC
--- +++ @@ -36,7 +36,8 @@ cls.TestMatrix.add_dimension( create_exec_option_dimension(disable_codegen_options=[True])) cls.TestMatrix.add_constraint(lambda v:\ - v.get_value('table_format').file_format in ['text']) + v.get_value('table_format').file_format in ['text'] and + v.get_...
9909ce7e900097b74b701ad52c0aae5ba68b8823
morenines/repository.py
morenines/repository.py
import os from morenines import output from morenines import util from morenines.index import Index from morenines.ignores import Ignores NAMES = { 'repo_dir': '.morenines', 'index': 'index', 'ignore': 'ignore', } class Repository(object): def __init__(self): self.path = None self....
import os from morenines import output from morenines import util from morenines.index import Index from morenines.ignores import Ignores NAMES = { 'mn_dir': '.morenines', 'index': 'index', 'ignore': 'ignore', } class Repository(object): def __init__(self): self.path = None self.in...
Rework Repository to include paths
Rework Repository to include paths
Python
mit
mcgid/morenines,mcgid/morenines
--- +++ @@ -8,7 +8,7 @@ NAMES = { - 'repo_dir': '.morenines', + 'mn_dir': '.morenines', 'index': 'index', 'ignore': 'ignore', } @@ -18,30 +18,42 @@ def __init__(self): self.path = None self.index = None - self.ignores = None + self.ignore = None + + def in...
df95836c39f859a455afd06e32840f5e68fc2c1d
XIA2Version.py
XIA2Version.py
#!/usr/bin/env python # XIA2Version.py # Copyright (C) 2006 CCLRC, Graeme Winter # # This code is distributed under the BSD license, a copy of which is # included in the root directory of this package. # # 6th June 2006 # # A file containing the version number of the current xia2. Generally useful. # VersionNumb...
#!/usr/bin/env python # XIA2Version.py # Copyright (C) 2006 CCLRC, Graeme Winter # # This code is distributed under the BSD license, a copy of which is # included in the root directory of this package. # # 6th June 2006 # # A file containing the version number of the current xia2. Generally useful. # VersionNumb...
Update xia2 version prior to release of DIALS 1.0
Update xia2 version prior to release of DIALS 1.0
Python
bsd-3-clause
xia2/xia2,xia2/xia2
--- +++ @@ -10,7 +10,7 @@ # A file containing the version number of the current xia2. Generally useful. # -VersionNumber = "0.3.8.0" +VersionNumber = "0.4.0.0" Version = "XIA2 %s" % VersionNumber CVSTag = "xia2-%s" % VersionNumber.replace('.', '_') Directory = "xia2-%s" % VersionNumber
0fe3d41a4aa69f1ce39f61623d10985c20e012e8
network/ipv4_network.py
network/ipv4_network.py
import network import math class Ipv4Net(network.Network): def __init__(self, net_id, netmask): self.netmask = netmask self.network_id = net_id @property def network_id(self): return self._netid @network_id.setter def network_id(self, addr): sel...
import network import math class Ipv4Net(network.Network): def __init__(self, net_id, netmask): self.netmask = netmask self.network_id = net_id @property def network_id(self): return self._netid @network_id.setter def network_id(self, addr): sel...
Revert "Minor tweak to make netmask checking more flashy :V"
Revert "Minor tweak to make netmask checking more flashy :V" This reverts commit 6a1bfc3ae8dda1932555a7aada3dd5f0e792507f.
Python
mit
foxfluff/network-py
--- +++ @@ -22,12 +22,12 @@ @netmask.setter def netmask(self, addr): # TODO: Bug test - if math.log(addr + 1, 2) % 1 == 0: - self._mask = addr - else: + cidr = int(math.log(addr + 1, 2)) + if 2**cidr != addr + 1: raise ValueError("Improper value f...
dc071e4961c7db7e98e7dfdcd74cce368ce31039
dataportal/tests/test_examples.py
dataportal/tests/test_examples.py
from nose.tools import assert_true from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document def run_example(example): events = example.run() assert_true(isinstance(events, list)) assert_true(isinsta...
import subprocess from nose.tools import assert_true, assert_equal from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document examples = [temperature_ramp, multisource_event, image_and_scalar] def run_example_...
Test commandline execution of examples.
TST: Test commandline execution of examples.
Python
bsd-3-clause
tacaswell/dataportal,NSLS-II/datamuxer,tacaswell/dataportal,danielballan/datamuxer,NSLS-II/dataportal,ericdill/datamuxer,NSLS-II/dataportal,ericdill/databroker,ericdill/datamuxer,ericdill/databroker,danielballan/dataportal,danielballan/datamuxer,danielballan/dataportal
--- +++ @@ -1,13 +1,31 @@ -from nose.tools import assert_true +import subprocess +from nose.tools import assert_true, assert_equal from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document -def run_example...
cba6d3639f348d60133069fadec223837fde0005
setup.py
setup.py
""" Setup script for python packaging """ from setuptools import setup setup( name="nbwavedrom", packages=["nbwavedrom"], version="0.3.0", description="Wavedrom timing diagrams for Jupyter Notebook", author="witchard", author_email="witchard@hotmail.co.uk", url="https://github.com/witchard/...
""" Setup script for python packaging """ from setuptools import setup setup( name="nbwavedrom", packages=["nbwavedrom"], version="0.3.0", description="Wavedrom timing diagrams for Jupyter Notebook", author="witchard", author_email="witchard@hotmail.co.uk", url="https://github.com/witchard/...
Update notes on how to publish
Update notes on how to publish
Python
mit
witchard/ipython-wavedrom,witchard/ipython-wavedrom,witchard/ipython-wavedrom
--- +++ @@ -23,9 +23,9 @@ ], ) -# DONT FORGET TO CHANGE DOWNLOAD_URL WHEN DOING A RELEASE! -# Thanks to this guide: http://peterdowns.com/posts/first-time-with-pypi.html # Release with: +# Modify release URL above to new version # git tag <version> # git push --tags -# python setup.py sdist upl...
e6cbf0c51e3bd0f639584a3bbd97c394bd844c57
setup.py
setup.py
from setuptools import setup import addict SHORT='Addict is a dictionary whose items can be set using both attribute and item syntax.' LONG=('Addict is a module that exposes a dictionary subclass that allows items to be set like attributes. ' 'Values are gettable and settable using both attribute and item syntax....
from setuptools import setup import addict SHORT='Addict is a dictionary whose items can be set using both attribute and item syntax.' LONG=('Addict is a module that exposes a dictionary subclass that allows items to be set like attributes. ' 'Values are gettable and settable using both attribute and item syntax....
Include versions tested on Travis in Trove classifiers
Include versions tested on Travis in Trove classifiers
Python
mit
mewwts/addict
--- +++ @@ -15,6 +15,9 @@ author_email='mats@plysjbyen.net', classifiers=( 'Programming Language :: Python', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'License :: OSI Approved :: MIT...
1915cde046c1817c45317ad8ce882e807671fca3
oauth_api/permissions.py
oauth_api/permissions.py
from rest_framework.permissions import BasePermission SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS'] class OAuth2ScopePermission(BasePermission): """ Make sure request is authenticated and token has right scope set. """ def has_permission(self, request, view): token = request.auth read_on...
from django.core.exceptions import ImproperlyConfigured from rest_framework.permissions import BasePermission SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS'] class OAuth2ScopePermission(BasePermission): """ Make sure request is authenticated and token has right scope set. """ def has_permission(self, req...
Raise ImproperlyConfigured if resource has no scopes defined
Raise ImproperlyConfigured if resource has no scopes defined
Python
bsd-2-clause
eofs/django-oauth-api,eofs/django-oauth-api
--- +++ @@ -1,3 +1,5 @@ +from django.core.exceptions import ImproperlyConfigured + from rest_framework.permissions import BasePermission @@ -17,6 +19,7 @@ if hasattr(token, 'scope'): scopes = self.get_scopes(request, view) + if scopes['required'] is not None: ...
846a005c20ddc2e7702be48f5b2839b1c9fd1576
project/apps/api/management/commands/denormalize.py
project/apps/api/management/commands/denormalize.py
from django.core.management.base import ( BaseCommand, ) from apps.api.models import ( Convention, Contest, Contestant, Performance, ) class Command(BaseCommand): help = "Command to denormailze data." def handle(self, *args, **options): vs = Convention.objects.all() for v...
from django.core.management.base import ( BaseCommand, ) from apps.api.models import ( Convention, Contest, Contestant, Performance, ) class Command(BaseCommand): help = "Command to denormailze data." def handle(self, *args, **options): vs = Convention.objects.all() for v...
Remove ranking from denormalization command
Remove ranking from denormalization command
Python
bsd-2-clause
barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore,barberscore/barberscore-api,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore
--- +++ @@ -26,6 +26,4 @@ ps = Performance.objects.all() for p in ps: p.save() - for t in ts: - t.rank() return "Done"
5da0d563070f3a966f005a6987dd3e83d52bcaf9
tailorscad/builder/openscad.py
tailorscad/builder/openscad.py
import subprocess import os #from tailorscad.config import ScadConfig BASE_DIR = '/usr/bin/' DEFAULT = BASE_DIR + 'openscad' def build_with_openscad(state): args = build_args_from_state(state) out_call = '' for arg in args: out_call += ' ' + arg print 'args:', out_call try: ...
import subprocess import os #from tailorscad.config import ScadConfig BASE_DIR = '/usr/bin/' DEFAULT = BASE_DIR + 'openscad' def build_with_openscad(state): args = build_args_from_state(state) out_call = '' for arg in args: out_call += ' ' + arg print 'args:', out_call try: ...
Fix params not being generated for other files
Fix params not being generated for other files
Python
mit
savorywatt/tailorSCAD
--- +++ @@ -19,8 +19,8 @@ out_call += ' ' + arg print 'args:', out_call + try: - subprocess.check_call(args) return True except subprocess.CalledProcessError as (e): @@ -33,16 +33,19 @@ #executable = ScadConfig.open_scad if ScadConfig.open_scad else DEFAULT execut...
b98ab1c800a13792bdca69c5788e91bc07f1e215
rpp/encoder.py
rpp/encoder.py
from uuid import UUID from scanner import Symbol def tostr(value): if isinstance(value, Symbol): return str(value) elif isinstance(value, str): return '"%s"' % value elif isinstance(value, float): return '%.14f' % value elif isinstance(value, UUID): return '{%s}' % str(v...
from uuid import UUID from scanner import Symbol def tostr(value): if isinstance(value, Symbol): return str(value) elif isinstance(value, str): return '"%s"' % value elif isinstance(value, float): return '%.14f' % value elif isinstance(value, UUID): return '{%s}' % str(v...
Insert new line for each Symbol object
Insert new line for each Symbol object
Python
bsd-3-clause
Perlence/rpp
--- +++ @@ -27,7 +27,12 @@ if all(not isinstance(x, list) for x in item): name, values = item[0].upper(), item[1:] strvalues = map(tostr, values) - result += ' '.join([name] + strvalues) + result += name + for value, strvalue in zip(values, strvalues...
ec768a1aac8429f0c2c1f27c521c8a5f40d32411
enocean/consolelogger.py
enocean/consolelogger.py
# -*- encoding: utf-8 -*- from __future__ import print_function, unicode_literals, division import logging def init_logging(level=logging.DEBUG): formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger('enocean') logger.setLevel(logging.DEBUG) ...
# -*- encoding: utf-8 -*- from __future__ import print_function, unicode_literals, division import logging def init_logging(level=logging.DEBUG): formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger('enocean') logger.setLevel(level) ch = lo...
Use proper logging level in `init_logging`.
Use proper logging level in `init_logging`.
Python
mit
Ethal/enocean,kipe/enocean,kipe/enocean,Ethal/enocean
--- +++ @@ -7,9 +7,9 @@ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger('enocean') - logger.setLevel(logging.DEBUG) + logger.setLevel(level) ch = logging.StreamHandler() - ch.setLevel(logging.DEBUG) + ch.setLevel(level) ...
42be31155361e5b91c445844da8aefbfd0f44348
ezoutlet/__init__.py
ezoutlet/__init__.py
# Copyright (C) 2015 Schweitzer Engineering Laboratories, Inc. # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. from .ez_outlet import EzOutlet, EzOutletError, EzOutletUsageError, main __version__ = '0.0.1-dev2'
# Copyright (C) 2015 Schweitzer Engineering Laboratories, Inc. # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. from .ez_outlet import EzOutlet, EzOutletError, EzOutletUsageError, main __version__ = '0.0.1-dev3'
Increment version number for release.
Increment version number for release.
Python
mit
jtpereyda/ezoutlet
--- +++ @@ -3,4 +3,4 @@ # of the MIT license. See the LICENSE file for details. from .ez_outlet import EzOutlet, EzOutletError, EzOutletUsageError, main -__version__ = '0.0.1-dev2' +__version__ = '0.0.1-dev3'
2b70879e2d73453d81ed738f34cf20d39afdc3ad
byceps/blueprints/authorization/decorators.py
byceps/blueprints/authorization/decorators.py
# -*- coding: utf-8 -*- """ byceps.blueprints.authorization.decorators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from functools import wraps from flask import abort, g def permission_required(permission): """Ensur...
# -*- coding: utf-8 -*- """ byceps.blueprints.authorization.decorators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from functools import wraps from flask import abort, g def permission_required(permission): """Ensur...
Call `has_permission` method instead of accessing the collection directly
Call `has_permission` method instead of accessing the collection directly
Python
bsd-3-clause
homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps
--- +++ @@ -18,7 +18,7 @@ def decorator(func): @wraps(func) def wrapper(*args, **kwargs): - if permission not in g.current_user.permissions: + if not g.current_user.has_permission(permission): abort(403) return func(*args, **kwargs) r...
c7d522393930dabc1bb6997bbc2b450d043817e8
wagtail/utils/widgets.py
wagtail/utils/widgets.py
from django.forms.widgets import Widget from django.utils.safestring import mark_safe class WidgetWithScript(Widget): def render_html(self, name, value, attrs): """Render the HTML (non-JS) portion of the field markup""" return super().render(name, value, attrs) def render(self, name, value, a...
from django.forms.widgets import Widget from django.utils.safestring import mark_safe class WidgetWithScript(Widget): def render_html(self, name, value, attrs): """Render the HTML (non-JS) portion of the field markup""" return super().render(name, value, attrs) def render(self, name, value, a...
Fix WidgetWithScript to accept renderer kwarg
Fix WidgetWithScript to accept renderer kwarg
Python
bsd-3-clause
FlipperPA/wagtail,nimasmi/wagtail,timorieber/wagtail,kaedroho/wagtail,wagtail/wagtail,takeflight/wagtail,zerolab/wagtail,kaedroho/wagtail,gasman/wagtail,timorieber/wagtail,zerolab/wagtail,wagtail/wagtail,mikedingjan/wagtail,jnns/wagtail,zerolab/wagtail,mixxorz/wagtail,nimasmi/wagtail,zerolab/wagtail,mixxorz/wagtail,wag...
--- +++ @@ -7,7 +7,7 @@ """Render the HTML (non-JS) portion of the field markup""" return super().render(name, value, attrs) - def render(self, name, value, attrs=None): + def render(self, name, value, attrs=None, renderer=None): # no point trying to come up with sensible semantics ...
ea3576e16b0a8278cd9d35715c8881e9d136eec8
paystackapi/tests/test_cpanel.py
paystackapi/tests/test_cpanel.py
import httpretty from paystackapi.tests.base_test_case import BaseTestCase from paystackapi.cpanel import ControlPanel class TestPage(BaseTestCase): @httpretty.activate def test_fetch_payment_session_timeout(self): """Method defined to test fetch payment session timeout.""" httpretty.registe...
import httpretty from paystackapi.tests.base_test_case import BaseTestCase from paystackapi.cpanel import ControlPanel class TestPage(BaseTestCase): @httpretty.activate def test_fetch_payment_session_timeout(self): """Method defined to test fetch payment session timeout.""" httpretty.registe...
Add control panel test for update
Add control panel test for update
Python
mit
andela-sjames/paystack-python
--- +++ @@ -19,3 +19,17 @@ response = ControlPanel.fetch_payment_session_timeout() self.assertTrue(response['status']) + + @httpretty.activate + def test_fetch_payment_session_timeout(self): + """Method defined to test update payment session timeout.""" + httpretty.register_uri...
3d88e62cdd2521472d0475a5f4c8598d49f88571
code/python/echomesh/sound/CPlayer.py
code/python/echomesh/sound/CPlayer.py
from __future__ import absolute_import, division, print_function, unicode_literals import cechomesh from echomesh.expression.Envelope import Envelope from echomesh.sound import PlayerSetter from echomesh.util import Log from echomesh.util.thread.MasterRunnable import MasterRunnable LOGGER = Log.logger(__name__) de...
from __future__ import absolute_import, division, print_function, unicode_literals import cechomesh from echomesh.expression.Envelope import Envelope from echomesh.sound import PlayerSetter from echomesh.util import Log from echomesh.util.thread.MasterRunnable import MasterRunnable LOGGER = Log.logger(__name__) cla...
Remove tiny amounts of cruft.
Remove tiny amounts of cruft.
Python
mit
rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh
--- +++ @@ -8,10 +8,6 @@ from echomesh.util.thread.MasterRunnable import MasterRunnable LOGGER = Log.logger(__name__) - - -def test(): - print('test!') class CPlayer(MasterRunnable): def __init__(self, element, level=1, pan=0, loops=1, length=-1, **kwds): @@ -37,9 +33,6 @@ def _on_pause(self): retu...
8e0d61aa69a15a9efc967ec263bc73c3018f9b3d
process_to_only_word.py
process_to_only_word.py
# -*- coding: utf-8 -*- import re import sys ########################################################################### # This code is developing yet!! # Target file(Already morphological analysis file) to process to word only. ########################################################################### argvs = sys.a...
# -*- coding: utf-8 -*- import re import sys ########################################################################### # This code is developing yet!! # Target file(Already morphological analysis file) to process to word only. # <How to use> # python process_to_only_word.py <Target file(Already morphological analysi...
Add a "How to use(comment)"
Add a "How to use(comment)"
Python
mit
shinshin86/little-magnifying-py-glass,shinshin86/little-magnifying-py-glass
--- +++ @@ -5,6 +5,8 @@ ########################################################################### # This code is developing yet!! # Target file(Already morphological analysis file) to process to word only. +# <How to use> +# python process_to_only_word.py <Target file(Already morphological analysis file)> > resu...
c2a8e69a5deee8f72c561f50732570801d4fc9ae
tests/test_stack_operations.py
tests/test_stack_operations.py
import pytest from thinglang.execution.errors import UnknownVariable from thinglang.runner import run def test_stack_resolution_in_block(): assert run(""" thing Program does start number i = 0 Output.write("outside before, i =", i) if true Output.write("inside before, i =...
import pytest from thinglang.execution.errors import UnknownVariable from thinglang.runner import run def test_stack_resolution_in_block(): assert run(""" thing Program does start number i = 0 Output.write("outside before, i =", i) if true Output.write("inside before, i =...
Add test for variables declared inside a scope (and accessed outside)
Add test for variables declared inside a scope (and accessed outside)
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
--- +++ @@ -25,3 +25,16 @@ outside after, i = 10""".strip() +def test_stack_resolution_error_during_access_after_nested_deceleration(): + with pytest.raises(UnknownVariable): + run(""" +thing Program + does start + + if true + number i = 10 + Output.write("inside after, ...
aefa8a3d6d4c809c7e470b22a0c9fb2c0875ba8b
project/project/urls.py
project/project/urls.py
from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.conf.urls.static import static from django.contrib.auth import views urlpatterns = [ url( r'^silk/', include('silk.urls', namespace='silk', app_name='silk') ), url( ...
from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.conf.urls.static import static from django.contrib.auth import views urlpatterns = [ url( r'^silk/', include('silk.urls', namespace='silk') ), url( r'^exampl...
Remove unneeded app_name from test project to be django 2 compatible
Remove unneeded app_name from test project to be django 2 compatible
Python
mit
crunchr/silk,mtford90/silk,jazzband/silk,crunchr/silk,mtford90/silk,jazzband/silk,crunchr/silk,django-silk/silk,django-silk/silk,jazzband/silk,django-silk/silk,crunchr/silk,mtford90/silk,jazzband/silk,mtford90/silk,django-silk/silk
--- +++ @@ -9,13 +9,16 @@ urlpatterns = [ url( r'^silk/', - include('silk.urls', namespace='silk', app_name='silk') + include('silk.urls', namespace='silk') ), url( r'^example_app/', - include('example_app.urls', namespace='example_app', app_name='example_app...
aae29a385129e6a1573fac2c631eff8db8ea3079
stackdio/stackdio/__init__.py
stackdio/stackdio/__init__.py
# -*- coding: utf-8 -*- # Copyright 2014, Digital Reasoning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# -*- coding: utf-8 -*- # Copyright 2014, Digital Reasoning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Print a more useful warning message
Print a more useful warning message
Python
apache-2.0
stackdio/stackdio,clarkperkins/stackdio,stackdio/stackdio,clarkperkins/stackdio,clarkperkins/stackdio,clarkperkins/stackdio,stackdio/stackdio,stackdio/stackdio
--- +++ @@ -25,7 +25,8 @@ try: from .celery import app as celery_app except ImportError: - sys.stderr.write('Not importing celery... Ignore if this is running setup.py.\n') + sys.stderr.write("Not importing celery... " + "Ignore if this if you're currently running setup.py.\n") __c...
f457cb13325cbc4b83a3450032856e86fe1285cf
kokki/cookbooks/mongodb/libraries/server.py
kokki/cookbooks/mongodb/libraries/server.py
import os from kokki import * def setup(name, **kwargs): env = Environment.get_instance() config = env.config.mongodb.copy() config.update(kwargs) config['configpath'] = "/etc/mongodb/%s.conf" % name if 'dbpath' not in kwargs: config['dbpath'] = os.path.join(config.dbpath, name) if 'l...
import os from kokki import * def setup(name, **kwargs): env = Environment.get_instance() config = env.config.mongodb.copy() config.update(kwargs) config['configpath'] = "/etc/mongodb/%s.conf" % name if 'dbpath' not in kwargs: config['dbpath'] = os.path.join(config.dbpath, name) if 'l...
Make sure to end upstart script with .conf
Make sure to end upstart script with .conf
Python
bsd-3-clause
samuel/kokki
--- +++ @@ -26,7 +26,7 @@ Service("mongodb-%s" % name) - File("/etc/init/mongodb-%s" % name, + File("/etc/init/mongodb-%s.conf" % name, owner = "root", group = "root", mode = 0644,
067bbbc6c9edbf55606fe6f236c70affd86a1fc0
tests/convert/test_unit.py
tests/convert/test_unit.py
from unittest.mock import patch from smif.convert.unit import parse_unit def test_parse_unit_valid(): """Parse a valid unit """ meter = parse_unit('m') assert str(meter) == 'meter' @patch('smif.convert.unit.LOGGER.warning') def test_parse_unit_invalid(warning_logger): """Warn if unit not recogni...
import numpy as np from unittest.mock import patch from smif.convert.unit import parse_unit from smif.convert import UnitConvertor def test_parse_unit_valid(): """Parse a valid unit """ meter = parse_unit('m') assert str(meter) == 'meter' @patch('smif.convert.unit.LOGGER.warning') def test_parse_uni...
Add test for normal unit conversion
Add test for normal unit conversion
Python
mit
tomalrussell/smif,tomalrussell/smif,nismod/smif,nismod/smif,tomalrussell/smif,nismod/smif,nismod/smif,willu47/smif,willu47/smif,willu47/smif,willu47/smif,tomalrussell/smif
--- +++ @@ -1,5 +1,7 @@ +import numpy as np from unittest.mock import patch from smif.convert.unit import parse_unit +from smif.convert import UnitConvertor def test_parse_unit_valid(): @@ -17,3 +19,15 @@ parse_unit(unit) msg = "Unrecognised unit: %s" warning_logger.assert_called_with(msg, unit)...
c56a6c2f861d50d2bdc38ee33d30e4ef614a2de0
tests/sim/test_entities.py
tests/sim/test_entities.py
import unittest from hunting.sim.entities import * class TestFighter(unittest.TestCase): def test_minimum_speed_is_one(self): self.assertEqual(Fighter(1, 1, 1, 1, base_speed=-5).speed, 1) self.assertEqual(Fighter(1, 1, 1, 1, base_speed=0).speed, 1)
import unittest from hunting.sim.entities import * class TestPropertyEffect(unittest.TestCase): def setUp(self): self.fighter = Fighter(100, 100, 100, 0, base_speed=100) def test_add_remove_power(self): power_buff = PropertyEffect(PROPERTY_POWER, value=100) self.fighter.add_effect(po...
Add failing tests for buffs
Add failing tests for buffs
Python
mit
MoyTW/RL_Arena_Experiment
--- +++ @@ -1,5 +1,37 @@ import unittest from hunting.sim.entities import * + + +class TestPropertyEffect(unittest.TestCase): + def setUp(self): + self.fighter = Fighter(100, 100, 100, 0, base_speed=100) + + def test_add_remove_power(self): + power_buff = PropertyEffect(PROPERTY_POWER, value=100...
51660291b043b88eab599c59d8c1ef7ae9dc74d7
src/core/models.py
src/core/models.py
from django.db import models from django.contrib.auth.models import User from util.session import get_or_generate_session_name class Session(models.Model): name = models.CharField(max_length=255) user = models.ForeignKey(User, blank=True, null=True) started_at = models.DateTimeField('started at', auto_now...
from django.db import models from django.contrib.auth.models import User from util.session import get_or_generate_session_name from util.session import DEFAULT_SESSION_NAME_PREFIX class Session(models.Model): name = models.CharField(max_length=255) user = models.ForeignKey(User, blank=True, null=True) sta...
Use the existing default name.
Use the existing default name.
Python
mit
uxebu/tddbin-backend,uxebu/tddbin-backend
--- +++ @@ -2,6 +2,7 @@ from django.contrib.auth.models import User from util.session import get_or_generate_session_name +from util.session import DEFAULT_SESSION_NAME_PREFIX class Session(models.Model): name = models.CharField(max_length=255) @@ -13,7 +14,7 @@ return self.name def save(s...
9c6f3e1994f686e57092a7cd947c49b4f857743e
apps/predict/urls.py
apps/predict/urls.py
""" Predict app's urls """ # # pylint: disable=bad-whitespace # from django.conf.urls import patterns, include, url from .views import * def url_tree(regex, *urls): """Quick access to stitching url patterns""" return url(regex, include(patterns('', *urls))) urlpatterns = patterns('', url(r'^$', Datasets.as...
""" Predict app's urls """ # # pylint: disable=bad-whitespace # from django.conf.urls import patterns, include, url from .views import * def url_tree(regex, *urls): """Quick access to stitching url patterns""" return url(regex, include(patterns('', *urls))) urlpatterns = patterns('', url(r'^$', Datasets.as...
Remove callback url and bring uploads together
Remove callback url and bring uploads together
Python
agpl-3.0
IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site
--- +++ @@ -16,15 +16,10 @@ url(r'^$', Datasets.as_view(), name="view_my_datasets"), url_tree(r'^upload/', url(r'^$', UploadChoices.as_view(), name="upload"), - url(r'^manual/$', UploadManual.as_view(), name="upload_manual"), - url_tree(r'^(?P<type>[\w-]+)/', - url(r'^$', UploadView.as_view(), n...
a077a5b7731e7d609b5c3adc8f8176ad79053f17
rmake/lib/twisted_extras/tools.py
rmake/lib/twisted_extras/tools.py
# # Copyright (c) SAS Institute Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
# # Copyright (c) SAS Institute Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
Fix Serializer locking bug that caused it to skip calls it should have made
Fix Serializer locking bug that caused it to skip calls it should have made
Python
apache-2.0
sassoftware/rmake3,sassoftware/rmake3,sassoftware/rmake3
--- +++ @@ -37,7 +37,7 @@ return func(*args, **kwargs) @d.addBoth def _unlock(result): + del self._waiting[d] self._lock.release() - del self._waiting[d] return result return d
42e16bf376a64995a8b70a91829a82d7b0f3e1a1
gameanalysis/__main__.py
gameanalysis/__main__.py
"""Command line module""" import argparse import pkgutil import sys import gameanalysis from gameanalysis import script def create_parser(): """Create the default parser""" modules = [imp.find_module(name).load_module(name) for imp, name, _ in pkgutil.iter_modules(script.__path__)] parser ...
"""Command line module""" import argparse import logging import pkgutil import sys import gameanalysis from gameanalysis import script def create_parser(): """Create the default parser""" modules = [imp.find_module(name).load_module(name) for imp, name, _ in pkgutil.iter_modules(script.__path_...
Add logging verbosity to game analysis
Add logging verbosity to game analysis
Python
apache-2.0
egtaonline/GameAnalysis
--- +++ @@ -1,5 +1,6 @@ """Command line module""" import argparse +import logging import pkgutil import sys @@ -15,6 +16,10 @@ description="""Command line access to the game analysis toolkit.""") parser.add_argument('-V', '--version', action='version', version='%(prog)s {}...
ccc57956f83af2c8ef8c9e064fadfe5db2155302
avatar/conf.py
avatar/conf.py
from django.conf import settings from PIL import Image from appconf import AppConf class AvatarConf(AppConf): DEFAULT_SIZE = 80 RESIZE_METHOD = Image.ANTIALIAS STORAGE_DIR = 'avatars' STORAGE_PARAMS = {} GRAVATAR_FIELD = 'email' GRAVATAR_BASE_URL = 'http://www.gravatar.com/avatar/' GRAVAT...
from django.conf import settings from PIL import Image from appconf import AppConf class AvatarConf(AppConf): DEFAULT_SIZE = 80 RESIZE_METHOD = Image.ANTIALIAS STORAGE_DIR = 'avatars' STORAGE_PARAMS = {} GRAVATAR_FIELD = 'email' GRAVATAR_BASE_URL = 'https://www.gravatar.com/avatar/' GRAVA...
Use https url to avoid serving insecure content
Gravatar: Use https url to avoid serving insecure content
Python
bsd-3-clause
tbabej/django-avatar,tbabej/django-avatar
--- +++ @@ -10,7 +10,7 @@ STORAGE_DIR = 'avatars' STORAGE_PARAMS = {} GRAVATAR_FIELD = 'email' - GRAVATAR_BASE_URL = 'http://www.gravatar.com/avatar/' + GRAVATAR_BASE_URL = 'https://www.gravatar.com/avatar/' GRAVATAR_BACKUP = True GRAVATAR_DEFAULT = None DEFAULT_URL = 'avatar/img/d...
f5d0f8cd145c759cff6d5f6cfeb46459efaa63ca
sale_line_description/__openerp__.py
sale_line_description/__openerp__.py
# -*- coding: utf-8 -*- # # # Copyright (C) 2013-15 Agile Business Group sagl # (<http://www.agilebg.com>) # # This program 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 ...
# -*- coding: utf-8 -*- # # # Copyright (C) 2013-15 Agile Business Group sagl # (<http://www.agilebg.com>) # # This program 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 ...
Remove active key since is deprecated
Remove active key since is deprecated
Python
agpl-3.0
anas-taji/sale-workflow,brain-tec/sale-workflow,luistorresm/sale-workflow,factorlibre/sale-workflow,BT-fgarbely/sale-workflow,adhoc-dev/sale-workflow,jjscarafia/sale-workflow,richard-willowit/sale-workflow,VitalPet/sale-workflow,akretion/sale-workflow,ddico/sale-workflow,fevxie/sale-workflow,xpansa/sale-workflow,Endika...
--- +++ @@ -32,6 +32,5 @@ 'security/sale_security.xml', 'res_config_view.xml', ], - "active": False, "installable": True }
032ce88cbee5399c97486122e7bd3b8013e88dda
djangae/__init__.py
djangae/__init__.py
import os import sys extra_library_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "lib") if extra_library_path not in sys.path: sys.path.insert(1, extra_library_path) default_app_config = 'djangae.apps.DjangaeConfig' from patches import json json.patch()
import os import sys extra_library_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "lib") if extra_library_path not in sys.path: sys.path.insert(1, extra_library_path) default_app_config = 'djangae.apps.DjangaeConfig' from .patches import json json.patch()
Make import of `patches` explicitly relative.
Make import of `patches` explicitly relative. Avoids potential conflict if you add a global package called `patches`, and will avoid breakage if this moves to Python 3.
Python
bsd-3-clause
armirusco/djangae,potatolondon/djangae,armirusco/djangae,potatolondon/djangae,kirberich/djangae,grzes/djangae,kirberich/djangae,armirusco/djangae,asendecka/djangae,grzes/djangae,kirberich/djangae,asendecka/djangae,asendecka/djangae,grzes/djangae
--- +++ @@ -7,5 +7,5 @@ default_app_config = 'djangae.apps.DjangaeConfig' -from patches import json +from .patches import json json.patch()
c6926dda0a9e6e1515721e54788c29d0ef8b58a4
tests/test_sqlcompletion.py
tests/test_sqlcompletion.py
from pgcli.packages.sqlcompletion import suggest_type def test_select_suggests_cols_with_table_scope(): suggestion = suggest_type('SELECT FROM tabl', 'SELECT ') assert suggestion == ('columns-and-functions', ['tabl']) def test_lparen_suggest_cols(): suggestion = suggest_type('SELECT MAX( FROM tbl', 'SEL...
from pgcli.packages.sqlcompletion import suggest_type def test_select_suggests_cols_with_table_scope(): suggestion = suggest_type('SELECT FROM tabl', 'SELECT ') assert suggestion == ('columns-and-functions', ['tabl']) def test_where_suggests_columns_functions(): suggestion = suggest_type('SELECT * FROM ...
Add a test for where clause and rename all tests functions.
Add a test for where clause and rename all tests functions.
Python
bsd-3-clause
thedrow/pgcli,d33tah/pgcli,n-someya/pgcli,bitmonk/pgcli,joewalnes/pgcli,yx91490/pgcli,TamasNo1/pgcli,MattOates/pgcli,TamasNo1/pgcli,j-bennet/pgcli,lk1ngaa7/pgcli,zhiyuanshi/pgcli,koljonen/pgcli,dbcli/vcli,dbcli/pgcli,lk1ngaa7/pgcli,dbcli/pgcli,j-bennet/pgcli,suzukaze/pgcli,janusnic/pgcli,darikg/pgcli,johshoff/pgcli,nos...
--- +++ @@ -5,27 +5,37 @@ suggestion = suggest_type('SELECT FROM tabl', 'SELECT ') assert suggestion == ('columns-and-functions', ['tabl']) -def test_lparen_suggest_cols(): +def test_where_suggests_columns_functions(): + suggestion = suggest_type('SELECT * FROM tabl WHERE ', + 'SELECT * FRO...
52982c735f729ddf0a9c020d495906c4a4899462
txircd/modules/rfc/umode_i.py
txircd/modules/rfc/umode_i.py
from twisted.plugin import IPlugin from txircd.module_interface import IMode, IModuleData, Mode, ModuleData from txircd.utils import ModeType from zope.interface import implements class InvisibleMode(ModuleData, Mode): implements(IPlugin, IModuleData, IMode) name = "InvisibleMode" core = True affe...
from twisted.plugin import IPlugin from txircd.module_interface import IMode, IModuleData, Mode, ModuleData from txircd.utils import ModeType from zope.interface import implements class InvisibleMode(ModuleData, Mode): implements(IPlugin, IModuleData, IMode) name = "InvisibleMode" core = True affe...
Make the invisible check action not necessarily require an accompanying channel
Make the invisible check action not necessarily require an accompanying channel
Python
bsd-3-clause
Heufneutje/txircd,ElementalAlchemist/txircd
--- +++ @@ -8,24 +8,43 @@ name = "InvisibleMode" core = True - affectedActions = [ "showchanneluser" ] + affectedActions = [ "showchanneluser", "showuser" ] def actions(self): - return [ ("modeactioncheck-user-i-showchanneluser", 1, self.isInvisible) ] + return [ ("modea...
8d8eeaa9fd06cd1fc9860a4e5b215e8ed7f107af
openprocurement/tender/esco/views/award_complaint.py
openprocurement/tender/esco/views/award_complaint.py
# -*- coding: utf-8 -*- from openprocurement.tender.core.utils import optendersresource from openprocurement.tender.openeu.views.award_complaint import TenderEUAwardComplaintResource @optendersresource(name='esco.EU:TenderAward Complaints', collection_path='/tenders/{tender_id}/awards/{award_id}/co...
# -*- coding: utf-8 -*- from openprocurement.tender.core.utils import optendersresource from openprocurement.tender.openeu.views.award_complaint import TenderEUAwardComplaintResource @optendersresource(name='esco.EU:Tender Award Complaints', collection_path='/tenders/{tender_id}/awards/{award_id}/c...
Fix in award complaint view
Fix in award complaint view
Python
apache-2.0
Scandie/openprocurement.tender.esco,openprocurement/openprocurement.tender.esco
--- +++ @@ -3,7 +3,7 @@ from openprocurement.tender.openeu.views.award_complaint import TenderEUAwardComplaintResource -@optendersresource(name='esco.EU:TenderAward Complaints', +@optendersresource(name='esco.EU:Tender Award Complaints', collection_path='/tenders/{tender_id}/awards/{award_id}...
0ce8e39bc641c2b68c3c2bd460a38efc5e4eff01
automate.py
automate.py
import login import time import navigate import modal def automate(username, password, tag): driver = login.login(username, password) navigate.tag(driver, tag) modal.open(driver) while True: try: modal.follow(driver) modal.next(driver) except Exception as e: print(e.__doc__) print(e.message) nav...
import login import time import navigate import modal def automate(username, password, tag): driver = login.login(username, password) navigate.tag(driver, tag) modal.open(driver) while True: try: modal.follow(driver) modal.next(driver) except Exception as e: print(e.__doc__) print(e.message) nav...
Increase timer on automation to avoid raising suspicion
Increase timer on automation to avoid raising suspicion
Python
mit
jshaker/igbot
--- +++ @@ -16,4 +16,4 @@ print(e.message) navigate.tag(driver, tag) modal.open(driver) - time.sleep(3) + time.sleep(30)
c447ca3d85d9862be38034be85b2328e3d6b02a3
vcproj/tests/test_solution.py
vcproj/tests/test_solution.py
import vcproj.solution import tempfile, filecmp import pytest @pytest.fixture(scope="session") def test_sol(): return vcproj.solution.parse('vcproj/tests/test_solution/vc15sol/vc15sol.sln') def test_all_projects(test_sol): projects = test_sol.project_names() len(list(projects)) == 59 def test_project_n...
import vcproj.solution import tempfile, filecmp import pytest @pytest.fixture(scope="session") def test_sol(): return vcproj.solution.parse('vcproj/tests/test_solution/test.sln') def test_project_files(test_sol): assert list(test_sol.project_files()) == ['test\\test.vcxproj', 'lib1\\lib1.vcxproj', 'lib2\\lib2...
Add back in test of 2010 solution
Add back in test of 2010 solution
Python
unlicense
jhandley/pyvcproj,jhandley/pyvcproj,jhandley/pyvcproj
--- +++ @@ -4,39 +4,20 @@ @pytest.fixture(scope="session") def test_sol(): - return vcproj.solution.parse('vcproj/tests/test_solution/vc15sol/vc15sol.sln') - - -def test_all_projects(test_sol): - projects = test_sol.project_names() - len(list(projects)) == 59 - - -def test_project_names(test_sol): - p...
fb91bf1e7c1677124f4aa1ce9c534fb437145980
pygametemplate/helper.py
pygametemplate/helper.py
"""Module containing helper functions for using pygame.""" def load_class_assets(calling_object, assets_dict): """Load class assets. Only call if class_assets_loaded is False.""" calling_class = type(calling_object) for attribute_name in assets_dict: setattr(calling_class, attribute_name, assets_dic...
"""Module containing helper functions for using pygame.""" def load_class_assets(calling_object, assets_dict): """Load class assets. Only call if class_assets_loaded is False.""" calling_class = type(calling_object) for attribute_name in assets_dict: setattr(calling_class, attribute_name, assets_dic...
Replace % with f-string :)
Replace % with f-string :)
Python
mit
AndyDeany/pygame-template
--- +++ @@ -17,7 +17,7 @@ return font.size(string)[0] > max_width def raise_word_too_long_error(word): - raise ValueError("\"%s\" is too long to be wrapped." % word) + raise ValueError(f"'{word}' is too long to be wrapped.") lines = [] words = paragrap...
b57d0b0d3d65995270318d94b551d8bacda73d22
baseline.py
baseline.py
#/usr/bin/python """ Baseline example that needs to be beaten """ import numpy as np import matplotlib.pyplot as plt x, y, yerr = np.loadtxt("data/data.txt", unpack=True) A = np.vstack((np.ones_like(x), x)).T C = np.diag(yerr * yerr) cov = np.linalg.inv(np.dot(A.T, np.linalg.solve(C, A))) b_ls, m_ls = np.dot(cov, n...
#/usr/bin/python """ Baseline example that needs to be beaten """ import os import numpy as np import matplotlib.pyplot as plt x, y, yerr = np.loadtxt("data/data.txt", unpack=True) A = np.vstack((np.ones_like(x), x)).T C = np.diag(yerr * yerr) cov = np.linalg.inv(np.dot(A.T, np.linalg.solve(C, A))) b_ls, m_ls = np....
Add results to environment parameters RESULT_M, RESULT_B
Add results to environment parameters RESULT_M, RESULT_B
Python
mit
arfon/dottravis,arfon/dottravis
--- +++ @@ -2,6 +2,7 @@ """ Baseline example that needs to be beaten """ +import os import numpy as np import matplotlib.pyplot as plt @@ -20,4 +21,9 @@ ax.set_ylabel("y") fig.savefig("assets/result.png") -print m_ls, b_ls +print("Results of m, b: ({0:.4f} {1:.4f})".format(m_ls, b_ls)) + +# Let's store r...
b960962472f1c40fbaa1338d2cba316810ba119b
tt_dailyemailblast/admin.py
tt_dailyemailblast/admin.py
from django.contrib import admin from django.db import models as django_models from tinymce.widgets import TinyMCE from .models import (Recipient, RecipientList, DailyEmailBlast, DailyEmailBlastType) def send_blasts(model_admin, request, qs): for blast in qs: print blast.send() class RecipientI...
from django.contrib import admin from django.db import models as django_models from tinymce.widgets import TinyMCE from .models import (Recipient, RecipientList, DailyEmailBlast, DailyEmailBlastType) def send_blasts(model_admin, request, qs): for blast in qs: print blast.send() class RecipientI...
Include all dates in blast list display
Include all dates in blast list display
Python
apache-2.0
texastribune/tt_dailyemailblast,texastribune/tt_dailyemailblast
--- +++ @@ -31,6 +31,8 @@ class DailyEmailBlastAdmin(admin.ModelAdmin): model = DailyEmailBlast inlines = [RecipientListInline] + list_display = ('blast_type', 'created_on', 'sent_on', + 'send_completed_on',) formfield_overrides = { django_models.TextField: {'widget': Ti...
ef404dad280ec2f7317e0176d3e91b20d1bbe7c0
inbox/notify/__init__.py
inbox/notify/__init__.py
from redis import StrictRedis, BlockingConnectionPool from inbox.config import config import json REDIS_HOSTNAME = config.get('NOTIFY_QUEUE_REDIS_HOSTNAME') REDIS_DB = int(config.get('NOTIFY_QUEUE_REDIS_DB')) MAX_CONNECTIONS = 40 redis_pool = BlockingConnectionPool( max_connections=MAX_CONNECTIONS, host=REDI...
import json from redis import StrictRedis, BlockingConnectionPool from inbox.config import config from nylas.logging import get_logger log = get_logger() REDIS_HOSTNAME = config.get('NOTIFY_QUEUE_REDIS_HOSTNAME') REDIS_PORT = int(config.get('NOTIFY_QUEUE_REDIS_PORT', 6379)) REDIS_DB = int(config.get('NOTIFY_QUEUE_REDI...
Add logger an try/except logic
Add logger an try/except logic
Python
agpl-3.0
jobscore/sync-engine,jobscore/sync-engine,jobscore/sync-engine,jobscore/sync-engine
--- +++ @@ -1,15 +1,19 @@ +import json from redis import StrictRedis, BlockingConnectionPool from inbox.config import config -import json +from nylas.logging import get_logger +log = get_logger() REDIS_HOSTNAME = config.get('NOTIFY_QUEUE_REDIS_HOSTNAME') +REDIS_PORT = int(config.get('NOTIFY_QUEUE_REDIS_PORT', 63...
45261d57bdb1ee23c84ea6c5d83550b7e84c26f1
highlander/highlander.py
highlander/highlander.py
from functools import wraps from logging import getLogger from os import getcwd, unlink from os.path import join, realpath, isfile from psutil import Process logger = getLogger(__name__) def one(f): @wraps(f) def decorator(): pid_file = realpath(join(getcwd(), '.pid')) if _is_running(pid_fi...
from functools import wraps from logging import getLogger from os import getcwd, unlink from os.path import join, realpath, isfile from psutil import Process logger = getLogger(__name__) def one(f): @wraps(f) def decorator(): pid_file = realpath(join(getcwd(), '.pid')) if _is_running(pid_fi...
Check to make sure the file doesn't exist if we get to the set running state.
Check to make sure the file doesn't exist if we get to the set running state.
Python
mit
chriscannon/highlander
--- +++ @@ -38,6 +38,9 @@ def _set_running(filename): + if isfile(str(filename)): + raise Exception('PID file already exists.') + p = Process() with open(filename, 'w') as f: f.write('{},{}'.format(p.pid, p.create_time()))
3d1612e5f9e20cf74a962dd4ca1b538776d5ec7e
StationPopWithoutTrain.py
StationPopWithoutTrain.py
def before_train_station_pop(station, escalator): # calculate the number of people waiting to depart on the train by the time the train arive. station.travelers_departing = station.travelers_departing + (escalator.rate * escalators.entering * station.train_wait) # number of people who have arived and want t...
"""This module calculates the number of people in the station by the time the next train arives""" def before_train_station_pop(station, escalator): """This function calculates the total number of people as a sume of people waiting to board the next train, and the number of people waiting to leave the stat...
Simplify the function to calculate the platform population between trains
Simplify the function to calculate the platform population between trains The function to calculate the change in platform population in the time between trains was needlessly complex. It has now been simplified. ref #17
Python
mit
ForestPride/rail-problem
--- +++ @@ -1,8 +1,10 @@ +"""This module calculates the number of people in the station by the time the next train arives""" + def before_train_station_pop(station, escalator): - # calculate the number of people waiting to depart on the train by the time the train arive. - station.travelers_departing = station...
88bd31ebfcaafe7de386f8d00869eed6286066f7
cetacean/response.py
cetacean/response.py
#!/usr/bin/env python # encoding: utf-8 import re class Response(object): """Represents an HTTP response that is hopefully a HAL document.""" def __init__(self, response): """Pass it a Requests response object. :response: A response object from the Requests library. """ sel...
#!/usr/bin/env python # encoding: utf-8 import re class Response(object): """Represents an HTTP response that is hopefully a HAL document.""" def __init__(self, response): """Pass it a Requests response object. :response: A response object from the Requests library. """ sel...
Make Response.is_hal() return a literal boolean.
Make Response.is_hal() return a literal boolean.
Python
mit
nanorepublica/cetacean-python,benhamill/cetacean-python
--- +++ @@ -21,4 +21,4 @@ :returns: True or False """ - return self._hal_regex.match(self._response.headers['content-type']) + return bool(self._hal_regex.match(self._response.headers['content-type']))
b3befb47d4b48e83b42fc6b10a10269d32cafb4e
src-backend/api/urls.py
src-backend/api/urls.py
from django.conf.urls import url, include from views import ProcedureViewSet from rest_framework import routers router = routers.SimpleRouter() router.register(r'procedures', ProcedureViewSet) urlpatterns = [ url(r'^', include(router.urls)) ]
from django.conf.urls import url, include from views import ProcedureViewSet from rest_framework import routers router = routers.SimpleRouter(trailing_slash=False) router.register(r'procedures', ProcedureViewSet) urlpatterns = [ url(r'^', include(router.urls)) ]
Remove trailing slash from the router
Remove trailing slash from the router
Python
bsd-3-clause
SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder
--- +++ @@ -2,7 +2,7 @@ from views import ProcedureViewSet from rest_framework import routers -router = routers.SimpleRouter() +router = routers.SimpleRouter(trailing_slash=False) router.register(r'procedures', ProcedureViewSet)
c40fc13dca5a0596a72d5c26214777f8a2845675
tests/test_repr.py
tests/test_repr.py
""" Test __str__ methods. """ import pexpect from . import PexpectTestCase class TestCaseMisc(PexpectTestCase.PexpectTestCase): def test_str_spawnu(self): """ Exercise spawnu.__str__() """ # given, p = pexpect.spawnu('cat') # exercise, value = p.__str__() # verify ...
""" Test __str__ methods. """ import pexpect from . import PexpectTestCase class TestCaseMisc(PexpectTestCase.PexpectTestCase): def test_str_spawnu(self): """ Exercise spawnu.__str__() """ # given, p = pexpect.spawnu('cat') # exercise, value = str(p) # verify ...
Use str(p) and not p.__str__()
Use str(p) and not p.__str__()
Python
isc
bangi123/pexpect,Depado/pexpect,dongguangming/pexpect,Depado/pexpect,quatanium/pexpect,Wakeupbuddy/pexpect,Wakeupbuddy/pexpect,Depado/pexpect,crdoconnor/pexpect,crdoconnor/pexpect,quatanium/pexpect,nodish/pexpect,quatanium/pexpect,crdoconnor/pexpect,dongguangming/pexpect,Wakeupbuddy/pexpect,Wakeupbuddy/pexpect,Depado/p...
--- +++ @@ -2,6 +2,7 @@ import pexpect from . import PexpectTestCase + class TestCaseMisc(PexpectTestCase.PexpectTestCase): @@ -10,7 +11,7 @@ # given, p = pexpect.spawnu('cat') # exercise, - value = p.__str__() + value = str(p) # verify assert isinst...
6110bc1137f5e3f1f12249c366323c6c0b48dbe3
IPython/nbconvert/utils/base.py
IPython/nbconvert/utils/base.py
"""Global configuration class.""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #------------...
"""Global configuration class.""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #------------...
Revert "Moved JS in front of HTML"
Revert "Moved JS in front of HTML" This reverts commit 8b0164edde418138d4e28c20d63fa422931ae6a8.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -25,7 +25,7 @@ Useful for display data priority that might be use by many transformers """ - display_data_priority = List(['javascript', 'html', 'application/pdf', 'svg', 'latex', 'png', 'jpg', 'jpeg' , 'text'], + display_data_priority = List(['html', 'javascript', 'application/pdf', 'svg...
9a6467688f567abc405a3fca6c4bfda7b6cd0351
FileWatcher.py
FileWatcher.py
from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler import os class MyEventHandler(FileSystemEventHandler): def __init__(self, filePath, callback): super(MyEventHandler, self).__init__() self.filePath = filePath self.callback = callback def on_m...
from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler import os class MyEventHandler(FileSystemEventHandler): def __init__(self, filePath, callback): super(MyEventHandler, self).__init__() self.filePath = filePath self.callback = callback def on_m...
Handle filepaths in an OS independent manner.
Handle filepaths in an OS independent manner. --CAR
Python
apache-2.0
BBN-Q/PyQLab,calebjordan/PyQLab,Plourde-Research-Lab/PyQLab,rmcgurrin/PyQLab
--- +++ @@ -11,15 +11,15 @@ self.callback = callback def on_modified(self, event): - if event.src_path == self.filePath: + if os.path.normpath(event.src_path) == self.filePath: self.callback() class LibraryFileWatcher(object): def __init__(self, filePath, callback): ...
b50ef13cb25c795a1ad3b2bfdbbb47b709fcbd39
binding/python/__init__.py
binding/python/__init__.py
# This file is part of SpaceVecAlg. # # SpaceVecAlg is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # SpaceVecAlg is distribut...
# This file is part of RBDyn. # # RBDyn is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # RBDyn is distributed in the hope tha...
Fix bad copy/past in licence header.
Fix bad copy/past in licence header.
Python
bsd-2-clause
jrl-umi3218/RBDyn,jrl-umi3218/RBDyn,gergondet/RBDyn,jrl-umi3218/RBDyn,gergondet/RBDyn,gergondet/RBDyn,jrl-umi3218/RBDyn,gergondet/RBDyn,gergondet/RBDyn
--- +++ @@ -1,17 +1,17 @@ -# This file is part of SpaceVecAlg. +# This file is part of RBDyn. # -# SpaceVecAlg is free software: you can redistribute it and/or modify +# RBDyn is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the...
02ea7389a364fe1f7df48542d4727c32374da452
scripts/master/factory/dart/channels.py
scripts/master/factory/dart/channels.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. class Channel(object): def __init__(self, name, branch, position, category_postfix, priority): self.branch = branch self.builder_postfix = '-' + na...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. class Channel(object): def __init__(self, name, branch, position, category_postfix, priority): self.branch = branch self.builder_postfix = '-' + na...
Update stable channel builders to pull from 1.3
Update stable channel builders to pull from 1.3 Review URL: https://codereview.chromium.org/225263024 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@262391 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
--- +++ @@ -19,7 +19,7 @@ CHANNELS = [ Channel('be', 'branches/bleeding_edge', 0, '', 4), Channel('dev', 'trunk', 1, '-dev', 2), - Channel('stable', 'branches/1.2', 2, '-stable', 1), + Channel('stable', 'branches/1.3', 2, '-stable', 1), Channel('integration', 'branches/dartium_integration', 3, '-integrati...
c1e5822f07e2fe4ca47633ed3dfda7d7bee64b6c
nvchecker/source/aiohttp_httpclient.py
nvchecker/source/aiohttp_httpclient.py
# MIT licensed # Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al. import atexit import aiohttp connector = aiohttp.TCPConnector(limit=20) __all__ = ['session', 'HTTPError'] class HTTPError(Exception): def __init__(self, code, message, response): self.code = code self.message = messag...
# MIT licensed # Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al. import atexit import asyncio import aiohttp connector = aiohttp.TCPConnector(limit=20) __all__ = ['session', 'HTTPError'] class HTTPError(Exception): def __init__(self, code, message, response): self.code = code self.m...
Handle graceful exit and timeout
Handle graceful exit and timeout Timeout was refactored and the defaults work correctly here.
Python
mit
lilydjwg/nvchecker
--- +++ @@ -2,6 +2,7 @@ # Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al. import atexit +import asyncio import aiohttp connector = aiohttp.TCPConnector(limit=20) @@ -24,5 +25,9 @@ raise HTTPError(res.status, res.reason, res) return res -session = BetterClientSession(conne...
9f81cc80e1a82f4a26e400dd2ae5c290abe48382
Discord/tree.py
Discord/tree.py
from discord import app_commands import logging import sys import traceback import sentry_sdk class CommandTree(app_commands.CommandTree): async def on_error(self, interaction, command, error): sentry_sdk.capture_exception(error) print( f"Ignoring exception in slash command {comman...
from discord import app_commands import logging import sys import traceback import sentry_sdk class CommandTree(app_commands.CommandTree): async def on_error(self, interaction, error): sentry_sdk.capture_exception(error) print( f"Ignoring exception in slash command {interaction.com...
Update CommandTree.on_error to only take two parameters
[Discord] Update CommandTree.on_error to only take two parameters Remove command parameter, matching discord.py update, and use Interaction.command instead
Python
mit
Harmon758/Harmonbot,Harmon758/Harmonbot
--- +++ @@ -10,10 +10,10 @@ class CommandTree(app_commands.CommandTree): - async def on_error(self, interaction, command, error): + async def on_error(self, interaction, error): sentry_sdk.capture_exception(error) print( - f"Ignoring exception in slash command {command.name}", ...
9bab06465d2b2665efaac4edea2e3c538c600908
installer/hooks/hook-moduleManager.py
installer/hooks/hook-moduleManager.py
import os import sys if sys.platform.startswith('win'): sys.path.insert(0, 'c:/work/code/dscas3/') else: sys.path.insert(0, '/home/cpbotha/work/code/dscas3/') import modules # * we need to give the module paths relative to the directory moduleManager # is in (I think, since this is the hook for moduleManag...
import os import sys if sys.platform.startswith('win'): sys.path.insert(0, 'c:/work/code/dscas3/') else: sys.path.insert(0, '/home/cpbotha/work/code/dscas3/') import modules # * we need to give the module paths relative to the directory moduleManager # is in (I think, since this is the hook for moduleManag...
Update installer to new scheme.
Update installer to new scheme.
Python
bsd-3-clause
chrisidefix/devide,zhangfangyan/devide,nagyistoce/devide,ivoflipse/devide,fvpolpeta/devide,chrisidefix/devide,fvpolpeta/devide,ivoflipse/devide,nagyistoce/devide,zhangfangyan/devide
--- +++ @@ -13,7 +13,7 @@ # * the installer will treat these imports as if they were explicitly # imported by the moduleManager, so THEIR dependecies will automatically # be analysed. -ml2 = ["modules." + i for i in modules.module_list] +ml2 = ["modules." + i for i in modules.moduleList] hiddenimports = ml2 ...
3856b48af3e83f49a66c0c29b81e0a80ad3248d9
nubes/connectors/aws/connector.py
nubes/connectors/aws/connector.py
import boto3.session from nubes.connectors import base class AWSConnector(base.BaseConnector): def __init__(self, aws_access_key_id, aws_secret_access_key, region_name): self.connection = boto3.session.Session( aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret...
import boto3.session from nubes.connectors import base class AWSConnector(base.BaseConnector): def __init__(self, aws_access_key_id, aws_secret_access_key, region_name): self.connection = boto3.session.Session( aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret...
Move client and resource to __init__
Move client and resource to __init__ * moved the calls to create the ec2 session resource session client to the init
Python
apache-2.0
omninubes/nubes
--- +++ @@ -11,26 +11,26 @@ aws_secret_access_key=aws_secret_access_key, region_name=region_name) + self.ec2_resource = self.connection.resource("ec2") + self.ec2_client = self.connection.client("ec2") + @classmethod def name(cls): return "aws" def c...
770bbf80a78d2f418e47ca2dc641c7dccbb86cac
rollbar/test/asgi_tests/helper.py
rollbar/test/asgi_tests/helper.py
import asyncio import functools from rollbar.contrib.asgi import ASGIApp def async_test_func_wrapper(asyncfunc): @functools.wraps(asyncfunc) def wrapper(*args, **kwargs): try: loop = asyncio.get_running_loop() except RuntimeError: loop = asyncio.new_event_loop() ...
import asyncio import functools import inspect import sys from rollbar.contrib.asgi import ASGIApp def run(coro): if sys.version_info >= (3, 7): return asyncio.run(coro) assert inspect.iscoroutine(coro) loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) try: return loo...
Refactor async wrapper. Use asyncio.run() for Py3.7
Refactor async wrapper. Use asyncio.run() for Py3.7
Python
mit
rollbar/pyrollbar
--- +++ @@ -1,31 +1,38 @@ import asyncio import functools +import inspect +import sys from rollbar.contrib.asgi import ASGIApp -def async_test_func_wrapper(asyncfunc): +def run(coro): + if sys.version_info >= (3, 7): + return asyncio.run(coro) + + assert inspect.iscoroutine(coro) + + loop = a...
c32e87894d4baf404d5b300459fc68a6d9d973c8
zun/db/__init__.py
zun/db/__init__.py
# Copyright 2015 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
# Copyright 2015 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Remove the duplicated config sqlite_db
Remove the duplicated config sqlite_db The config sqlite_db has been removed from oslo.db. See here: https://review.openstack.org/#/c/449437/ Change-Id: I9197b08aeb7baabf2d3fdd4cf4bd06b57a6782ff
Python
apache-2.0
kevin-zhaoshuai/zun,kevin-zhaoshuai/zun,kevin-zhaoshuai/zun
--- +++ @@ -20,4 +20,4 @@ _DEFAULT_SQL_CONNECTION = 'sqlite:///' + paths.state_path_def('zun.sqlite') options.set_defaults(zun.conf.CONF) -options.set_defaults(zun.conf.CONF, _DEFAULT_SQL_CONNECTION, 'zun.sqlite') +options.set_defaults(zun.conf.CONF, _DEFAULT_SQL_CONNECTION)
a0b7ba97cd996209ce2e9770ba0ec25111c85dd2
rapcom/__init__.py
rapcom/__init__.py
# -*- coding: utf-8 -*- """The primary module for the program. Variables: __version_info__: A tuple containing the individual parts of the version. __version__: The version string. """ from __future__ import unicode_literals __version_info__ = (0, 1, 0) __version__ = '.'.join(map(str, __version_info__))
# -*- coding: utf-8 -*- """The primary module for the program. Variables: __version_info__: A tuple containing the individual parts of the version. __version__: The version string. """ from __future__ import unicode_literals __version_info__ = (0, 1, 1, 'dev') __version__ = '.'.join(map(str, __version_info__...
Update the version to 0.1.1.dev
Update the version to 0.1.1.dev
Python
mit
contains-io/rcli
--- +++ @@ -8,5 +8,5 @@ from __future__ import unicode_literals -__version_info__ = (0, 1, 0) +__version_info__ = (0, 1, 1, 'dev') __version__ = '.'.join(map(str, __version_info__))
b8ac8edbd12c6b021815e4fa4fd68cfee7dc18cf
frigg/builds/api.py
frigg/builds/api.py
# -*- coding: utf8 -*- import json from django.http import HttpResponse, Http404 from django.http.response import JsonResponse from django.shortcuts import get_object_or_404 from django.views.decorators.csrf import csrf_exempt from frigg.decorators import token_required from .models import Build, Project @token_req...
# -*- coding: utf8 -*- import json from django.http import HttpResponse, Http404 from django.http.response import JsonResponse from django.shortcuts import get_object_or_404 from django.views.decorators.cache import never_cache from django.views.decorators.csrf import csrf_exempt from frigg.decorators import token_re...
Add @never_cache decorator to the badge view
Add @never_cache decorator to the badge view
Python
mit
frigg/frigg-hq,frigg/frigg-hq,frigg/frigg-hq
--- +++ @@ -4,6 +4,7 @@ from django.http import HttpResponse, Http404 from django.http.response import JsonResponse from django.shortcuts import get_object_or_404 +from django.views.decorators.cache import never_cache from django.views.decorators.csrf import csrf_exempt from frigg.decorators import token_requi...
04b7e79ce3fed1afac129098badb632ca226fdee
dispatch.py
dispatch.py
#!/usr/bin/env python """ Copyright (c) 2008-2011, Anthony Garcia <lagg@lavabit.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVID...
#!/usr/bin/env python """ Copyright (c) 2008-2011, Anthony Garcia <lagg@lavabit.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVID...
Add wsgi handler by default
Add wsgi handler by default
Python
isc
Lagg/optf2,FlaminSarge/optf2,Lagg/optf2,FlaminSarge/optf2,Lagg/optf2,FlaminSarge/optf2
--- +++ @@ -23,6 +23,9 @@ openid.set_session(render.session) import web +# wsgi +application = render.application.wsgifunc() + if config.enable_fastcgi: web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
67255ac86d2ef91ce355655112c919f2e08045b4
django_uwsgi/urls.py
django_uwsgi/urls.py
from django.conf.urls import patterns, url from . import views urlpatterns = [ url(r'^$', views.UwsgiStatus.as_view(), name='uwsgi_index'), url(r'^reload/$', views.UwsgiReload.as_view(), name='uwsgi_reload'), url(r'^clear_cache/$', views.UwsgiCacheClear.as_view(), name='uwsgi_cache_clear'), ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.UwsgiStatus.as_view(), name='uwsgi_index'), url(r'^reload/$', views.UwsgiReload.as_view(), name='uwsgi_reload'), url(r'^clear_cache/$', views.UwsgiCacheClear.as_view(), name='uwsgi_cache_clear'), ]
Remove usage of patterns in import line
Remove usage of patterns in import line
Python
mit
unbit/django-uwsgi,unbit/django-uwsgi
--- +++ @@ -1,4 +1,4 @@ -from django.conf.urls import patterns, url +from django.conf.urls import url from . import views urlpatterns = [
e2ac721cb3e745a149e039aec0f71d33d1e28efc
api/base/renderers.py
api/base/renderers.py
import re from rest_framework.renderers import JSONRenderer, BrowsableAPIRenderer class JSONAPIRenderer(JSONRenderer): format = "jsonapi" media_type = 'application/vnd.api+json' def render(self, data, accepted_media_type=None, renderer_context=None): stuff = super(JSONAPIRenderer, self).render(dat...
import re from rest_framework.renderers import JSONRenderer, BrowsableAPIRenderer class JSONAPIRenderer(JSONRenderer): format = "jsonapi" media_type = 'application/vnd.api+json' def render(self, data, accepted_media_type=None, renderer_context=None): # TODO: There should be a way to do this that ...
Add TODO and clean up render function
Add TODO and clean up render function [#OSF-5081]
Python
apache-2.0
adlius/osf.io,brandonPurvis/osf.io,mattclark/osf.io,Johnetordoff/osf.io,amyshi188/osf.io,CenterForOpenScience/osf.io,SSJohns/osf.io,emetsger/osf.io,kch8qx/osf.io,samchrisinger/osf.io,samchrisinger/osf.io,kch8qx/osf.io,rdhyee/osf.io,binoculars/osf.io,aaxelb/osf.io,samchrisinger/osf.io,hmoco/osf.io,binoculars/osf.io,TomH...
--- +++ @@ -6,9 +6,11 @@ media_type = 'application/vnd.api+json' def render(self, data, accepted_media_type=None, renderer_context=None): - stuff = super(JSONAPIRenderer, self).render(data, accepted_media_type, renderer_context) - new_stuff = re.sub(r'"<esi:include src=\\"(.*?)\\"\/>"', r'<e...
b2cac05be3f6c510edfaf1ae478fabdcf06fd19a
mgsv_names.py
mgsv_names.py
import random global adjectives, animals, rares with open('adjectives.txt') as f: adjectives = f.readlines() with open('animals.txt') as f: animals = f.readlines() with open('rares.txt') as f: rares = f.readlines() uncommons = { # Adjectives: 'master': 'miller', 'raging': 'bull'...
import random, os global adjectives, animals, rares with open(os.path.join(os.path.dirname(__file__), 'adjectives.txt')) as f: adjectives = f.readlines() with open(os.path.join(os.path.dirname(__file__), 'animals.txt')) as f: animals = f.readlines() with open(os.path.join(os.path.dirname(__file__), 'rares.t...
Load text files from the same dir as the script.
Load text files from the same dir as the script. Also renamed our name generator.
Python
unlicense
rotated8/mgsv_names
--- +++ @@ -1,14 +1,14 @@ -import random +import random, os global adjectives, animals, rares -with open('adjectives.txt') as f: +with open(os.path.join(os.path.dirname(__file__), 'adjectives.txt')) as f: adjectives = f.readlines() -with open('animals.txt') as f: +with open(os.path.join(os.path.dirname(__...
40edd4a635dd8f83a21f15f22883e7dae8d8d0a8
test/test_modes/test_backspace.py
test/test_modes/test_backspace.py
from pyqode.qt import QtCore from pyqode.qt.QtTest import QTest from pyqode.core.api import TextHelper from pyqode.core import modes from test.helpers import editor_open def get_mode(editor): return editor.modes.get(modes.SmartBackSpaceMode) def test_enabled(editor): mode = get_mode(editor) assert mode....
from pyqode.qt import QtCore from pyqode.qt.QtTest import QTest from pyqode.core.api import TextHelper from pyqode.core import modes from test.helpers import editor_open def get_mode(editor): return editor.modes.get(modes.SmartBackSpaceMode) def test_enabled(editor): mode = get_mode(editor) assert mode....
Fix test backspace (this test has to be changed since the parent implementation is now called when there is no space to eat)
Fix test backspace (this test has to be changed since the parent implementation is now called when there is no space to eat)
Python
mit
pyQode/pyqode.core,zwadar/pyqode.core,pyQode/pyqode.core
--- +++ @@ -19,16 +19,22 @@ @editor_open(__file__) def test_key_pressed(editor): QTest.qWait(1000) - TextHelper(editor).goto_line(20, 4) + TextHelper(editor).goto_line(21, 4) + QTest.qWait(2000) assert editor.textCursor().positionInBlock() == 4 QTest.keyPress(editor, QtCore.Qt.Key_Backspace)...
e68836173dec1e1fe80e07cca8eb67ebe19e424e
cegui/src/ScriptingModules/PythonScriptModule/bindings/distutils/PyCEGUI/__init__.py
cegui/src/ScriptingModules/PythonScriptModule/bindings/distutils/PyCEGUI/__init__.py
import os import os.path # atrocious and unholy! def get_my_path(): import fake return os.path.dirname(str(fake).split()[3][1:]) libpath = os.path.abspath(get_my_path()) #print "libpath =", libpath os.environ['PATH'] = libpath + ";" + os.environ['PATH'] from PyCEGUI import *
import os import os.path # atrocious and unholy! def get_my_path(): import fake return os.path.dirname(os.path.abspath(fake.__file__)) libpath = get_my_path() #print "libpath =", libpath os.environ['PATH'] = libpath + ";" + os.environ['PATH'] from PyCEGUI import *
Use a less pathetic method to retrieve the PyCEGUI dirname
MOD: Use a less pathetic method to retrieve the PyCEGUI dirname
Python
mit
ruleless/CEGUI,OpenTechEngine/CEGUI,ruleless/CEGUI,ruleless/CEGUI,ruleless/CEGUI,OpenTechEngine/CEGUI,OpenTechEngine/CEGUI,OpenTechEngine/CEGUI
--- +++ @@ -4,9 +4,9 @@ # atrocious and unholy! def get_my_path(): import fake - return os.path.dirname(str(fake).split()[3][1:]) + return os.path.dirname(os.path.abspath(fake.__file__)) -libpath = os.path.abspath(get_my_path()) +libpath = get_my_path() #print "libpath =", libpath os.environ['PATH'] ...
cd30723af9f82b7a91d1ad1e2a5b86f88d8f4b17
harvester/post_processing/dedup_sourceresource.py
harvester/post_processing/dedup_sourceresource.py
# pass in a Couchdb doc, get back one with de-duplicated sourceResource values def dedup_sourceresource(doc): ''' Look for duplicate values in the doc['sourceResource'] and remove. Values must be *exactly* the same ''' for key, value in doc['sourceResource'].items(): if not isinstance(val...
# pass in a Couchdb doc, get back one with de-duplicated sourceResource values def dedup_sourceresource(doc): ''' Look for duplicate values in the doc['sourceResource'] and remove. Values must be *exactly* the same ''' for key, value in doc['sourceResource'].items(): if isinstance(value, ...
Make sure dedup item is a list.
Make sure dedup item is a list.
Python
bsd-3-clause
barbarahui/harvester,ucldc/harvester,ucldc/harvester,mredar/harvester,mredar/harvester,barbarahui/harvester
--- +++ @@ -7,7 +7,8 @@ Values must be *exactly* the same ''' for key, value in doc['sourceResource'].items(): - if not isinstance(value, basestring): + if isinstance(value, list): + # can't use set() because of dict values (non-hashable) new_list = [] ...
b98bd25a8b25ca055ca92393f24b6a04382457a8
forms.py
forms.py
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField from wtforms.validators import DataRequired, Email class Login(FlaskForm): username = StringField('Username', validators=[DataRequired()]) password = PasswordField('Password', validators=[DataRequired()])
from flask import flash from flask_wtf import FlaskForm from wtforms import StringField, PasswordField from wtforms.validators import DataRequired, Email, Length def flash_errors(form): """ Universal interface to handle form error. Handles form error with the help of flash message """ for field, error...
Add universal interface for validation error message
Add universal interface for validation error message
Python
mit
openedoo/module_employee,openedoo/module_employee,openedoo/module_employee
--- +++ @@ -1,8 +1,23 @@ +from flask import flash from flask_wtf import FlaskForm from wtforms import StringField, PasswordField -from wtforms.validators import DataRequired, Email +from wtforms.validators import DataRequired, Email, Length + + +def flash_errors(form): + """ Universal interface to handle form er...
1af120a5ce7f2fc35aeb7e77a747b0e8382bba51
api_tests/utils.py
api_tests/utils.py
from blinker import ANY from urlparse import urlparse from contextlib import contextmanager from addons.osfstorage import settings as osfstorage_settings def create_test_file(node, user, filename='test_file', create_guid=True): osfstorage = node.get_addon('osfstorage') root_node = osfstorage.get_root() te...
from blinker import ANY from urlparse import urlparse from contextlib import contextmanager from addons.osfstorage import settings as osfstorage_settings def create_test_file(target, user, filename='test_file', create_guid=True): osfstorage = target.get_addon('osfstorage') root_node = osfstorage.get_root() ...
Update api test util to create files to use target name instead
Update api test util to create files to use target name instead
Python
apache-2.0
mattclark/osf.io,cslzchen/osf.io,HalcyonChimera/osf.io,mfraezz/osf.io,mattclark/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,adlius/osf.io,pattisdr/osf.io,pattisdr/osf.io,CenterForOpenScience/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,mattclark/osf.io,mfraezz/osf.io,mfraezz/osf.io,cslzchen/osf.i...
--- +++ @@ -4,8 +4,8 @@ from addons.osfstorage import settings as osfstorage_settings -def create_test_file(node, user, filename='test_file', create_guid=True): - osfstorage = node.get_addon('osfstorage') +def create_test_file(target, user, filename='test_file', create_guid=True): + osfstorage = target.get...
21dbb8af7412c04b768a9d68e1f8566786d5100c
mdot_rest/serializers.py
mdot_rest/serializers.py
from .models import Resource, ResourceLink, IntendedAudience from rest_framework import serializers class ResourceLinkSerializer(serializers.ModelSerializer): class Meta: model = ResourceLink fields = ('link_type', 'url',) class IntendedAudienceSerializer(serializers.ModelSerializer): class ...
from .models import Resource, ResourceLink, IntendedAudience from rest_framework import serializers class ResourceLinkSerializer(serializers.ModelSerializer): class Meta: model = ResourceLink fields = ('link_type', 'url',) class IntendedAudienceSerializer(serializers.ModelSerializer): class ...
Add image field to the resource serialization.
Add image field to the resource serialization.
Python
apache-2.0
uw-it-aca/mdot-rest,uw-it-aca/mdot-rest
--- +++ @@ -24,6 +24,7 @@ 'id', 'title', 'feature_desc', + 'image', 'featured', 'accessible', 'responsive_web',
f7c9bbd5ac49254d564a56ba3713b55abcfa4079
byceps/blueprints/news/views.py
byceps/blueprints/news/views.py
# -*- coding: utf-8 -*- """ byceps.blueprints.news.views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from flask import abort, g from ...services.news import service as news_service from ...util.framework import create_blueprint from .....
# -*- coding: utf-8 -*- """ byceps.blueprints.news.views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from flask import abort, current_app, g from ...services.news import service as news_service from ...util.framework import create_blue...
Allow configuration of the number of news items per page
Allow configuration of the number of news items per page
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps
--- +++ @@ -8,7 +8,7 @@ :License: Modified BSD, see LICENSE for details. """ -from flask import abort, g +from flask import abort, current_app, g from ...services.news import service as news_service from ...util.framework import create_blueprint @@ -18,16 +18,15 @@ blueprint = create_blueprint('news', __name...
5352e164b38099cbc7fe4eba87c00bc1c1d30d44
bluezero/eddystone.py
bluezero/eddystone.py
""" Level 1 file for creating Eddystone beacons """ from bluezero import tools from bluezero import broadcaster class EddystoneURL: def __init__(self, url): service_data = tools.url_to_advert(url, 0x10, 0x00) url_beacon = broadcaster.Beacon() url_beacon.add_service_data('FEAA', service_dat...
""" Level 1 file for creating Eddystone beacons """ from bluezero import tools from bluezero import broadcaster class EddystoneURL: def __init__(self, url, tx_power=0x08): """ The Eddystone-URL frame broadcasts a URL using a compressed encoding format in order to fit more within the limite...
Test for URL length error
Test for URL length error
Python
mit
ukBaz/python-bluezero,ukBaz/python-bluezero
--- +++ @@ -6,8 +6,20 @@ class EddystoneURL: - def __init__(self, url): - service_data = tools.url_to_advert(url, 0x10, 0x00) + def __init__(self, url, tx_power=0x08): + """ + The Eddystone-URL frame broadcasts a URL using a compressed encoding + format in order to fit more with...
8d229401ea69799638d8cd005bc4dc87bb4327a4
src/mist/io/tests/MyRequestsClass.py
src/mist/io/tests/MyRequestsClass.py
import requests class MyRequests(object): """ Simple class to make requests with or withour cookies etc. This way we can have the same request methods both in io and core """ def __init__(self, uri, data=None, cookie=None, timeout=None): self.headers = {'Cookie': cookie} self.time...
import requests class MyRequests(object): """ Simple class to make requests with or withour cookies etc. This way we can have the same request methods both in io and core """ def __init__(self, uri, data=None, cookie=None, timeout=None, csrf=None): self.headers = {'Cookie': cookie, 'Csrf-...
Add csrf token in MyRequests class
Add csrf token in MyRequests class
Python
agpl-3.0
kelonye/mist.io,munkiat/mist.io,Lao-liu/mist.io,DimensionDataCBUSydney/mist.io,afivos/mist.io,DimensionDataCBUSydney/mist.io,afivos/mist.io,Lao-liu/mist.io,DimensionDataCBUSydney/mist.io,kelonye/mist.io,zBMNForks/mist.io,Lao-liu/mist.io,johnnyWalnut/mist.io,munkiat/mist.io,DimensionDataCBUSydney/mist.io,Lao-liu/mist.io...
--- +++ @@ -7,8 +7,8 @@ This way we can have the same request methods both in io and core """ - def __init__(self, uri, data=None, cookie=None, timeout=None): - self.headers = {'Cookie': cookie} + def __init__(self, uri, data=None, cookie=None, timeout=None, csrf=None): + self.headers ...
6dceb819f86fd469a4d817dec0156646a5f574cf
matchzoo/data_generator/callbacks/lambda_callback.py
matchzoo/data_generator/callbacks/lambda_callback.py
from matchzoo.data_generator.callbacks.callback import Callback class LambdaCallback(Callback): """ LambdaCallback. Just a shorthand for creating a callback class. See :class:`matchzoo.data_generator.callbacks.Callback` for more details. Example: >>> from matchzoo.data_generator.callbacks im...
from matchzoo.data_generator.callbacks.callback import Callback class LambdaCallback(Callback): """ LambdaCallback. Just a shorthand for creating a callback class. See :class:`matchzoo.data_generator.callbacks.Callback` for more details. Example: >>> import matchzoo as mz >>> from m...
Update data generator lambda callback docs.
Update data generator lambda callback docs.
Python
apache-2.0
faneshion/MatchZoo,faneshion/MatchZoo
--- +++ @@ -8,10 +8,19 @@ See :class:`matchzoo.data_generator.callbacks.Callback` for more details. Example: + + >>> import matchzoo as mz >>> from matchzoo.data_generator.callbacks import LambdaCallback - >>> callback = LambdaCallback(on_batch_unpacked=print) - >>> callback....
73e4f2c333e7b4f02dbb0ec344a3a671ba97cac3
library-examples/read-replace-export-excel.py
library-examples/read-replace-export-excel.py
""" Proto type that does the following: input:Excel file in language A output 1:Copy of input file, with original strings replaced with serial numbers output 2:Single xlsx file that contains serial numbers and original texts from input file. """ import shutil from openpyxl import load_workbook, Workbook shutil.copy...
""" Proto type that does the following: input:Excel file in language A output 1:Copy of input file, with original strings replaced with serial numbers output 2:Single xlsx file that contains serial numbers and original texts from input file. """ import shutil from openpyxl import load_workbook, Workbook #point to t...
Change so original input does not change.
Change so original input does not change.
Python
apache-2.0
iku000888/Excel_Translation_Helper
--- +++ @@ -9,11 +9,8 @@ import shutil from openpyxl import load_workbook, Workbook -shutil.copyfile('sample-input-fortest.xlsx','sample-input-fortest-out.xlsx') - #point to the file to be read. Intuitive. wb2 = load_workbook('sample-input-fortest.xlsx') - #convince your self that sheet names are retireved. s...
dfaffd1e2c189a9d85c493db76b9751b4c802bce
python/scannerpy/stdlib/tensorflow.py
python/scannerpy/stdlib/tensorflow.py
from ..kernel import Kernel from scannerpy import DeviceType class TensorFlowKernel(Kernel): def __init__(self, config): import tensorflow as tf # If this is a CPU kernel, tell TF that it should not use # any GPUs for its graph operations cpu_only = True visible_device_lis...
from ..kernel import Kernel from scannerpy import DeviceType class TensorFlowKernel(Kernel): def __init__(self, config): import tensorflow as tf # If this is a CPU kernel, tell TF that it should not use # any GPUs for its graph operations cpu_only = True visible_device_lis...
Fix TF using all the GPU memory
Fix TF using all the GPU memory
Python
apache-2.0
scanner-research/scanner,scanner-research/scanner,scanner-research/scanner,scanner-research/scanner
--- +++ @@ -14,6 +14,7 @@ for handle in config.devices: if handle.type == DeviceType.GPU.value: visible_device_list.append(str(handle.id)) + tf_config.gpu_options.allow_growth = True cpu_only = False if cpu_only: tf_config.de...
9172166ee492e73865c69f76d76690034ef5a402
adcode/context_processors.py
adcode/context_processors.py
"Context processors for adding current sections and placements in the context." import re from .conf import SECTION_CONTEXT_KEY, PLACEMENTS_CONTEXT_KEY from .models import Section, Placement def current_placements(request): "Match current section to request path and get related placements." # TODO: Add cach...
"Context processors for adding current sections and placements in the context." import re from .conf import SECTION_CONTEXT_KEY, PLACEMENTS_CONTEXT_KEY from .models import Section, Placement def current_placements(request): "Match current section to request path and get related placements." # TODO: Add cach...
Order by priority in context_processor.
Order by priority in context_processor.
Python
bsd-2-clause
mlavin/django-ad-code,mlavin/django-ad-code
--- +++ @@ -11,7 +11,7 @@ # TODO: Add caching current = None placements = Placement.objects.none() - sections = Section.objects.all() + sections = Section.objects.order_by('-priority') for section in sections: pattern = re.compile(section.pattern) if pattern.search(request....
4426fe1b6c77bb3c38a4324470a3d46461ef4661
orchestrator/__init__.py
orchestrator/__init__.py
from __future__ import absolute_import from celery.signals import setup_logging import orchestrator.logger __version__ = '0.3.8' __author__ = 'sukrit' orchestrator.logger.init_logging() setup_logging.connect(orchestrator.logger.init_celery_logging)
from __future__ import absolute_import from celery.signals import setup_logging import orchestrator.logger __version__ = '0.3.9' __author__ = 'sukrit' orchestrator.logger.init_logging() setup_logging.connect(orchestrator.logger.init_celery_logging)
Prepare for next dev version
Prepare for next dev version
Python
mit
totem/cluster-orchestrator,totem/cluster-orchestrator,totem/cluster-orchestrator
--- +++ @@ -2,7 +2,7 @@ from celery.signals import setup_logging import orchestrator.logger -__version__ = '0.3.8' +__version__ = '0.3.9' __author__ = 'sukrit' orchestrator.logger.init_logging()
f26e6fb7e7fbf9eedd181bea65d091f24262a14f
backend/util.py
backend/util.py
"""General utilities.""" import urlparse import logging def ConstantTimeIsEqual(a, b): """Securely compare two strings without leaking timing information.""" if len(a) != len(b): return False acc = 0 for x, y in zip(a, b): acc |= ord(x) ^ ord(y) return acc == 0 # TODO(hjfreyer): Pull into some kin...
"""General utilities.""" import urlparse import logging def ConstantTimeIsEqual(a, b): """Securely compare two strings without leaking timing information.""" if len(a) != len(b): return False acc = 0 for x, y in zip(a, b): acc |= ord(x) ^ ord(y) return acc == 0 # TODO(hjfreyer): Pull into some kin...
Allow test version in via CORS
Allow test version in via CORS
Python
apache-2.0
Rio517/pledgeservice,MayOneUS/pledgeservice,Rio517/pledgeservice,Rio517/pledgeservice,MayOneUS/pledgeservice
--- +++ @@ -21,7 +21,8 @@ _, netloc, _, _, _, _ = urlparse.urlparse(origin) if not (handler.app.config['env'].app_name == 'local' or netloc == 'mayone.us' or netloc.endswith('.mayone.us') or - netloc == 'mayday.us' or netloc.endswith('.mayday.us')): + netloc == 'mayday.us'...
23d4081392f84f2d5359f44ed4dde41611bb4cd2
tests/race_deleting_keys_test.py
tests/race_deleting_keys_test.py
import nose.plugins.attrib import time as _time import subprocess import sys import redisdl import unittest import json import os.path from . import util from . import big_data @nose.plugins.attrib.attr('slow') class RaceDeletingKeysTest(unittest.TestCase): def setUp(self): import redis self.r = re...
import nose.plugins.attrib import time as _time import subprocess import sys import redisdl import unittest import json import os.path from . import util from . import big_data @nose.plugins.attrib.attr('slow') class RaceDeletingKeysTest(unittest.TestCase): def setUp(self): import redis self.r = re...
Replace finish order requirement with a duration requirement
Replace finish order requirement with a duration requirement
Python
bsd-2-clause
p/redis-dump-load,hyunchel/redis-dump-load,p/redis-dump-load,hyunchel/redis-dump-load
--- +++ @@ -37,4 +37,5 @@ delete_start, delete_finish = [int(time) for time in out.split(' ')] assert delete_start < start - assert delete_finish > finish + assert finish > start + 5 + assert delete_finish > start + 5
93903d065cd1ff8f3f0c715668f05c804c5561f9
profile/linearsvc.py
profile/linearsvc.py
import cProfile from sklearn.svm import LinearSVC from sklearn.datasets import load_svmlight_file from sklearn.metrics import accuracy_score X, y = load_svmlight_file("data.txt") svc = LinearSVC() cProfile.runctx('svc.fit(X, y)', {'svc': svc, 'X': X, 'y': y}, {}) svc.fit(X, y) results = svc.predict(X) accuracy = a...
import timeit from sklearn.svm import LinearSVC from sklearn.datasets import load_svmlight_file from sklearn.metrics import accuracy_score setup = """ from sklearn.svm import LinearSVC from sklearn.datasets import load_svmlight_file X, y = load_svmlight_file("data.txt") svc = LinearSVC() """ time = timeit.timeit('s...
Use timeit instead of cProfile
Use timeit instead of cProfile
Python
mit
JuliaPackageMirrors/SoftConfidenceWeighted.jl,IshitaTakeshi/SoftConfidenceWeighted.jl
--- +++ @@ -1,15 +1,22 @@ -import cProfile +import timeit + from sklearn.svm import LinearSVC from sklearn.datasets import load_svmlight_file from sklearn.metrics import accuracy_score +setup = """ +from sklearn.svm import LinearSVC +from sklearn.datasets import load_svmlight_file X, y = load_svmlight_file("d...
7ee8bbc5cb1527c55a04aff1421f043fdfa292cf
sample-code/examples/python/android_web_view.py
sample-code/examples/python/android_web_view.py
import os import glob import unittest from time import sleep from selenium import webdriver class TestAndroidWebView(unittest.TestCase): def setUp(self): app = os.path.abspath( glob.glob(os.path.join( os.path.dirname(__file__), '../../apps/WebViewDemo/target') ...
import os import glob import unittest from time import sleep from selenium import webdriver class TestAndroidWebView(unittest.TestCase): def setUp(self): app = os.path.abspath( glob.glob(os.path.join( os.path.dirname(__file__), '../../apps/WebViewDemo/target') ...
Update android web view example.
Update android web view example.
Python
apache-2.0
appium/appium,Sw0rdstream/appium,appium/appium,appium/appium,appium/appium,appium/appium,appium/appium
--- +++ @@ -24,7 +24,7 @@ desired_caps) def test(self): - button = self.driver.find_element_by_name('buttonStartWebviewCD') + button = self.driver.find_element_by_id('buttonStartWebview') button.click() self.driver.switch_to_window('WEBV...
3ecfdf41da3eb3b881c112254b913ff907424bd7
Scripts/2-Upload.py
Scripts/2-Upload.py
import os import json # Get Steam settings steamData = open("steam.json") steamConfig = json.load(steamData) steamSDKDir = steamConfig["sdkDir"] steamBuilder = steamConfig["builder"] steamCommand = steamConfig["command"] steamAppFile = steamConfig["appFile"] steamUser = steamConfig["user"] steamPassword = steamConfig...
#!/usr/bin/env python import os import json # Get Steam settings steamData = open("steam.json") steamConfig = json.load(steamData) steamSDKDir = steamConfig["sdkDir"] steamBuilder = steamConfig["builder"] steamCommand = steamConfig["command"] steamAppFile = steamConfig["appFile"] steamUser = steamConfig["user"] steamP...
Make steam upload script works for Linux
Make steam upload script works for Linux
Python
bsd-3-clause
arbonagw/HeliumRain,arbonagw/HeliumRain,arbonagw/HeliumRain,arbonagw/HeliumRain,arbonagw/HeliumRain
--- +++ @@ -1,4 +1,4 @@ - +#!/usr/bin/env python import os import json
92b7a5463e505f84862dd96e07c9caa5a97107a9
client/test/server_tests.py
client/test/server_tests.py
from nose.tools import * from mockito import * import unittest from source.server import * from source.exception import * from source.commands.system import * class MyTestCase(unittest.TestCase): def createCommandResponse(self, command, parameters = {}, timeout = None): response = mock() response.status_c...
from mockito import * import unittest from source.server import * from source.exception import * from source.commands.system import * class ServerTestCase(unittest.TestCase): def createCommandResponse(self, command, parameters = {}, timeout = None): response = mock() response.status_code = 200 json = ...
Change function names to camelCase
Change function names to camelCase
Python
mit
CaminsTECH/owncloud-test
--- +++ @@ -1,4 +1,3 @@ -from nose.tools import * from mockito import * import unittest @@ -6,7 +5,7 @@ from source.exception import * from source.commands.system import * -class MyTestCase(unittest.TestCase): +class ServerTestCase(unittest.TestCase): def createCommandResponse(self, command, parameters =...
52584725e462ab304bc2e976fa691f0d830e7efb
Speech/processor.py
Speech/processor.py
# Retrieve file from Facebook import urllib, convert, re, os # from speech_py import speech_to_text_offline as STT_o # from speech_py import speech_to_text_google as STT from speech_py import speech_to_text_ibm_rest as STT def transcribe(audio_url): if not os.path.isdir('./audio/retrieved_audio'): os.makedirs('./a...
# Retrieve file from Facebook import urllib, convert, re, os # from speech_py import speech_to_text_google as STT from speech_py import speech_to_text_ibm_rest as STT def transcribe(audio_url): if not os.path.isdir('./audio/retrieved_audio'): os.makedirs('./audio/retrieved_audio') reg_ex = '\w+.mp4' file_name =...
Modify ffmpeg path heroku 3
Modify ffmpeg path heroku 3
Python
mit
hungtraan/FacebookBot,hungtraan/FacebookBot,hungtraan/FacebookBot
--- +++ @@ -1,7 +1,6 @@ # Retrieve file from Facebook import urllib, convert, re, os -# from speech_py import speech_to_text_offline as STT_o # from speech_py import speech_to_text_google as STT from speech_py import speech_to_text_ibm_rest as STT
14e000acafe7c374294a7de6ffe295c9d56df68f
tests/test_postgresql_specific.py
tests/test_postgresql_specific.py
import pytest from tests.utils import is_postgresql_env_with_json_field @pytest.mark.skipif(not is_postgresql_env_with_json_field(), reason="requires postgresql and Django 1.9+") @pytest.mark.django_db def test_dirty_json_field(): from tests.models import TestModelWithJSONField tm = Test...
import pytest from tests.utils import is_postgresql_env_with_json_field @pytest.mark.skipif(not is_postgresql_env_with_json_field(), reason="requires postgresql and Django 1.9+") @pytest.mark.django_db def test_dirty_json_field(): from tests.models import TestModelWithJSONField tm = Test...
Update postgresql json_field to reflect deepcopy fix
Update postgresql json_field to reflect deepcopy fix
Python
bsd-3-clause
jdotjdot/django-dirtyfields,romgar/django-dirtyfields,smn/django-dirtyfields
--- +++ @@ -9,8 +9,14 @@ def test_dirty_json_field(): from tests.models import TestModelWithJSONField - tm = TestModelWithJSONField.objects.create(json_field={'data': 'dummy_data'}) - assert tm.get_dirty_fields() == {} + tm = TestModelWithJSONField.objects.create(json_field={'data': [1, 2, 3]}) - ...
db8e02661df65e1a50c5810968afef7ecd44db42
braid/bazaar.py
braid/bazaar.py
import os from fabric.api import run from braid import package, fails def install(): package.install('bzr') def branch(branch, location): if fails('[ -d {}/.bzr ]'.format(location)): run('mkdir -p {}'.format(os.path.dirname(location))) run('bzr branch {} {}'.format(branch, location)) e...
import os from fabric.api import run from braid import package, fails def install(): package.install('bzr') def branch(branch, location): if fails('[ -d {}/.bzr ]'.format(location)): run('mkdir -p {}'.format(os.path.dirname(location))) run('bzr branch {} {}'.format(branch, location)) e...
Make bzr always pull from the specified remote.
Make bzr always pull from the specified remote. Refs: #5.
Python
mit
alex/braid,alex/braid
--- +++ @@ -14,6 +14,4 @@ run('mkdir -p {}'.format(os.path.dirname(location))) run('bzr branch {} {}'.format(branch, location)) else: - # FIXME (https://github.com/twisted-infra/braid/issues/5) - # We currently don't check that this the correct branch - run('bzr update {}'....
3d5d6d093420294ed7b5fa834285d1d55da82d5d
pyroSAR/tests/test_snap_exe.py
pyroSAR/tests/test_snap_exe.py
import pytest from contextlib import contextmanager from pyroSAR._dev_config import ExamineExe from pyroSAR.snap.auxil import ExamineSnap @contextmanager def not_raises(ExpectedException): try: yield except ExpectedException: raise AssertionError( "Did raise exception {0} when it s...
from contextlib import contextmanager import pytest from pyroSAR._dev_config import ExamineExe from pyroSAR.snap.auxil import ExamineSnap @contextmanager def not_raises(ExpectedException): try: yield except ExpectedException: raise AssertionError( "Did raise exception {0} when i...
Add unit test to determine if the classes ExamineExe and ExamineSnap will work properly.
Add unit test to determine if the classes ExamineExe and ExamineSnap will work properly. Fixed a bug `assert len(record) == 1` in 'test_not_exception' method in class `TestExamineExe`.
Python
mit
johntruckenbrodt/pyroSAR,johntruckenbrodt/pyroSAR
--- +++ @@ -1,7 +1,10 @@ +from contextlib import contextmanager + import pytest -from contextlib import contextmanager + from pyroSAR._dev_config import ExamineExe from pyroSAR.snap.auxil import ExamineSnap + @contextmanager def not_raises(ExpectedException): @@ -20,24 +23,25 @@ "An unexpected exc...
b55c4c0536ca23484375d93f2ef011de0d5ce417
app/app.py
app/app.py
from flask import Flask app = Flask(__name__) @app.route('/') def index(): return 'Hello Docker + Nginx + Gunicorn + Flask!' if __name__ == "__main__": app.run(host="0.0.0.0", debug=True)
from flask import Flask app = Flask(__name__) @app.route('/') def index(): return 'Hello Docker + Nginx + Gunicorn + Flask!'
Remove __name__ == __main__ becuase it'll never be used
Remove __name__ == __main__ becuase it'll never be used
Python
mit
everett-toews/guestbook,rackerlabs/guestbook,everett-toews/guestbook,rackerlabs/guestbook
--- +++ @@ -7,7 +7,3 @@ @app.route('/') def index(): return 'Hello Docker + Nginx + Gunicorn + Flask!' - - -if __name__ == "__main__": - app.run(host="0.0.0.0", debug=True)
ed326fba4f44552eeb206f3c5af9ad6f5e89ca44
localeurl/models.py
localeurl/models.py
from django.conf import settings from django.core import urlresolvers from django.utils import translation from localeurl import utils def reverse(*args, **kwargs): reverse_kwargs = kwargs.get('kwargs', {}) locale = utils.supported_language(reverse_kwargs.pop('locale', translation.get_language())) ...
from django.conf import settings from django.core import urlresolvers from django.utils import translation from localeurl import utils def reverse(*args, **kwargs): reverse_kwargs = kwargs.get('kwargs', {}) if reverse_kwargs!=None: locale = utils.supported_language(reverse_kwargs.pop('locale', ...
Handle situation when kwargs is None
Handle situation when kwargs is None
Python
mit
eugena/django-localeurl
--- +++ @@ -5,8 +5,11 @@ def reverse(*args, **kwargs): reverse_kwargs = kwargs.get('kwargs', {}) - locale = utils.supported_language(reverse_kwargs.pop('locale', - translation.get_language())) + if reverse_kwargs!=None: + locale = utils.supported_language(reverse_kwargs.pop('locale', +...
a247cd42a79fa96d6b61fcd131a6e0c8d8cf57fe
setup.py
setup.py
from setuptools import setup, find_packages import os import os.path import urllib.parse def readme(): with open('README.md') as f: return f.read() setup(name='herc', version='0.1', description='Herc is a webservice that dispatches jobs to Apache Aurora.', long_description=readme(), ...
from setuptools import setup, find_packages import os import os.path import urllib.parse def readme(): with open('README.md') as f: return f.read() setup(name='herc', version='0.1', description='Herc is a webservice that dispatches jobs to Apache Aurora.', long_description=readme(), ...
Fix copying of files in herc/data during installation.
Fix copying of files in herc/data during installation.
Python
bsd-3-clause
broadinstitute/herc,broadinstitute/herc,broadinstitute/herc
--- +++ @@ -14,10 +14,8 @@ url='http://github.com/broadinstitute/herc', author='The Broad Institute', packages=find_packages(exclude='tests'), - package_data={ - # Include everything in data/, both schemas and examples. - '': ['data/*'] - }, + data_files=[('data/a...
4b35247fe384d4b2b206fa7650398511a493253c
setup.py
setup.py
from distutils.core import setup import sys import os import re PACKAGENAME = 'OpSimSummary' packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'opsimsummary') versionFile = os.path.join(packageDir, 'version.py') # Obtain the package version with open(versionFile, 'r') as...
from distutils.core import setup import sys import os import re PACKAGENAME = 'OpSimSummary' packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), PACKAGENAME) versionFile = os.path.join(packageDir, 'version.py') # Obtain the package version with open(versionFile, 'r') as f:...
Revert "Revert "Changed back due to problems, will fix later""
Revert "Revert "Changed back due to problems, will fix later"" This reverts commit 5e92c0ef714dea823e1deeef21b5141d9e0111a0. modified: setup.py
Python
mit
rbiswas4/simlib
--- +++ @@ -5,7 +5,7 @@ PACKAGENAME = 'OpSimSummary' packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), - 'opsimsummary') + PACKAGENAME) versionFile = os.path.join(packageDir, 'version.py') # Obtain the package version
83c0cb83a5eeaff693765c7d297b470adfdcec9e
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup version = __import__('stale').__version__ setup( name="stale", version=version, description="Identifies (and optionally removes) stale Delicious links", author="Jon Parise", author_email="jon@indelible.org", url="http://bitbucket.org/jpar...
#!/usr/bin/env python from distutils.core import setup version = __import__('stale').__version__ setup( name="stale", version=version, description="Identifies (and optionally removes) stale Delicious links", author="Jon Parise", author_email="jon@indelible.org", url="https://github.com/jparis...
Use the GitHub URL instead of the BitBucket URL
Use the GitHub URL instead of the BitBucket URL
Python
mit
jparise/stale
--- +++ @@ -10,7 +10,7 @@ description="Identifies (and optionally removes) stale Delicious links", author="Jon Parise", author_email="jon@indelible.org", - url="http://bitbucket.org/jparise/stale/", + url="https://github.com/jparise/stale", scripts = ['stale.py'], license = "MIT License...
2aeeb23e9771b67234dd6fef338e57000412b784
setup.py
setup.py
import os import sys from setuptools import setup, Extension with open("README.rst") as fp: long_description = fp.read() extensions = [] if os.name == 'nt': ext = Extension( 'trollius._overlapped', ['overlapped.c'], libraries=['ws2_32'], ) extensions.append(ext) requirements = ['six'] if sys....
import os import sys from setuptools import setup, Extension with open("README.rst") as fp: long_description = fp.read() extensions = [] if os.name == 'nt': ext = Extension( 'trollius._overlapped', ['overlapped.c'], libraries=['ws2_32'], ) extensions.append(ext) requirements = ['six'] if sys....
Add Development Status :: 7 - Inactive classifier.
Add Development Status :: 7 - Inactive classifier.
Python
apache-2.0
haypo/trollius,haypo/trollius,haypo/trollius
--- +++ @@ -29,6 +29,7 @@ "Programming Language :: Python", "Programming Language :: Python :: 2.7", "License :: OSI Approved :: Apache Software License", + "Development Status :: 7 - Inactive", ], packages=[ "trollius",
2266ca63ec23fd768c659ee4b3988fce7cd523c6
setup.py
setup.py
#!/usr/bin/env python # Create wheel with: python setup.py bdist_wheel # Install with: pip install dist/loadconfig-*-none-any.whl from os import environ from os.path import dirname, abspath from setuptools import setup from six.moves.configparser import ConfigParser c = ConfigParser() c.read('{}/setup.cfg'.for...
#!/usr/bin/env python # Create wheel with: python setup.py bdist_wheel # Install with: pip install dist/loadconfig-*-none-any.whl from os import environ from os.path import dirname, abspath from setuptools import setup import sys if sys.version_info[0] == 3: from configparser import ConfigParser else: f...
Remove six dependency when pip installing from sources
Remove six dependency when pip installing from sources Signed-off-by: Daniel Mizyrycki <ef2aa52a54375f83972079d447cb6ee481ced226@glidelink.net>
Python
mit
mzdaniel/loadconfig,mzdaniel/loadconfig
--- +++ @@ -5,7 +5,11 @@ from os import environ from os.path import dirname, abspath from setuptools import setup -from six.moves.configparser import ConfigParser +import sys +if sys.version_info[0] == 3: + from configparser import ConfigParser +else: + from ConfigParser import ConfigParser c = ConfigPars...
11f6fd6e2401af03730afccb14f843928c27c37a
setup.py
setup.py
from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='savu', version='0.1', description='Savu Python Tomography Pipeline', long_description=readme(), classifiers=[ 'Development Status :: 1 - Planning', 'Inte...
from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='savu', version='0.1.1', description='Savu Python Tomography Pipeline', long_description=readme(), classifiers=[ 'Development Status :: 1 - Planning', 'In...
Update to version 0.1.1 for the next push
Update to version 0.1.1 for the next push
Python
apache-2.0
mjn19172/Savu,swtp1v07/Savu,mjn19172/Savu,swtp1v07/Savu,swtp1v07/Savu,swtp1v07/Savu,mjn19172/Savu,mjn19172/Savu,mjn19172/Savu
--- +++ @@ -5,7 +5,7 @@ return f.read() setup(name='savu', - version='0.1', + version='0.1.1', description='Savu Python Tomography Pipeline', long_description=readme(), classifiers=[
32240a553a456e03b18c23fc6c32dd65865aa372
setup.py
setup.py
import os from setuptools import setup, find_packages with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() import multilingual_survey # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( n...
import os from setuptools import setup, find_packages with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() import multilingual_survey # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( n...
Fix django version in requirements
Fix django version in requirements
Python
bsd-3-clause
diadzine/django-simple-multilingual-survey,diadzine/django-simple-multilingual-survey
--- +++ @@ -21,7 +21,7 @@ author='Aymeric Bringard', author_email='diadzine@gmail.com', install_requires=[ - 'Django', + 'Django>=1.7', 'django-hvad<=1.0.0', ], classifiers=[