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
27a0226ec444523034d739a00a999b089ce116ba
enthought/chaco/tools/api.py
enthought/chaco/tools/api.py
from better_zoom import BetterZoom from better_selecting_zoom import BetterSelectingZoom from broadcaster import BroadcasterTool from dataprinter import DataPrinter from data_label_tool import DataLabelTool from drag_zoom import DragZoom from enthought.enable.tools.drag_tool import DragTool from draw_points_tool import...
from better_zoom import BetterZoom from better_selecting_zoom import BetterSelectingZoom from broadcaster import BroadcasterTool from dataprinter import DataPrinter from data_label_tool import DataLabelTool from enthought.enable.tools.drag_tool import DragTool from draw_points_tool import DrawPointsTool from highlight_...
Remove deprecated DragZoom from Chaco tools API to eliminate irrelevant BaseZoomTool deprecation warning. DragZoom is still used in 4 Chaco examples
[Chaco] Remove deprecated DragZoom from Chaco tools API to eliminate irrelevant BaseZoomTool deprecation warning. DragZoom is still used in 4 Chaco examples
Python
bsd-3-clause
ContinuumIO/chaco,tommy-u/chaco,tommy-u/chaco,ContinuumIO/chaco,tommy-u/chaco,ContinuumIO/chaco,burnpanck/chaco,burnpanck/chaco,ContinuumIO/chaco,burnpanck/chaco
--- +++ @@ -3,7 +3,6 @@ from broadcaster import BroadcasterTool from dataprinter import DataPrinter from data_label_tool import DataLabelTool -from drag_zoom import DragZoom from enthought.enable.tools.drag_tool import DragTool from draw_points_tool import DrawPointsTool from highlight_tool import HighlightTool
0df76d66fb6a2425c6ccc8a3a75d41599b2545c6
auth0/v2/authentication/delegated.py
auth0/v2/authentication/delegated.py
from .base import AuthenticationBase class Delegated(AuthenticationBase): def __init__(self, domain): self.domain = domain def get_token(self, client_id, target, api_type, grant_type, id_token=None, refresh_token=None): if id_token and refresh_token: raise Valu...
from .base import AuthenticationBase class Delegated(AuthenticationBase): """Delegated authentication endpoints. Args: domain (str): Your auth0 domain (e.g: username.auth0.com) """ def __init__(self, domain): self.domain = domain def get_token(self, client_id, target, api_type,...
Add docstrings in Delegated class
Add docstrings in Delegated class
Python
mit
auth0/auth0-python,auth0/auth0-python
--- +++ @@ -2,12 +2,21 @@ class Delegated(AuthenticationBase): + + """Delegated authentication endpoints. + + Args: + domain (str): Your auth0 domain (e.g: username.auth0.com) + """ def __init__(self, domain): self.domain = domain def get_token(self, client_id, target, api_...
6735b31506a86fa440619f1f68e53158dbd79024
mint/django_rest/rbuilder/errors.py
mint/django_rest/rbuilder/errors.py
# # Copyright (c) 2011 rPath, Inc. # # All Rights Reserved # BAD_REQUEST = 400 NOT_FOUND = 404 INTERNAL_SERVER_ERROR = 500 class RbuilderError(Exception): "An unknown error has occured." status = INTERNAL_SERVER_ERROR def __init__(self, **kwargs): cls = self.__class__ self.msg = cls.__d...
# # Copyright (c) 2011 rPath, Inc. # # All Rights Reserved # BAD_REQUEST = 400 NOT_FOUND = 404 INTERNAL_SERVER_ERROR = 500 class RbuilderError(Exception): "An unknown error has occured." status = INTERNAL_SERVER_ERROR def __init__(self, **kwargs): cls = self.__class__ self.msg = cls.__d...
Fix typo in exception name
Fix typo in exception name
Python
apache-2.0
sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint
--- +++ @@ -28,7 +28,7 @@ "The requested page of the collection was not found." status = NOT_FOUND -class UknownFilterOperator(RbuilderError): +class UnknownFilterOperator(RbuilderError): "%(filter)s is an invalid filter operator." status = BAD_REQUEST
1766a5acc5c948288b4cd81c62d0c1507c55f727
cinder/brick/initiator/host_driver.py
cinder/brick/initiator/host_driver.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 OpenStack Foundation. # 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.apac...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 OpenStack Foundation. # 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.apac...
Check if dir exists before calling listdir
Check if dir exists before calling listdir Changes along the way to how we clean up and detach after copying an image to a volume exposed a problem in the cleanup of the brick/initiator routines. The clean up in the initiator detach was doing a blind listdir of /dev/disk/by-path, however due to detach and cleanup bei...
Python
apache-2.0
petrutlucian94/cinder,Paul-Ezell/cinder-1,CloudServer/cinder,Datera/cinder,nikesh-mahalka/cinder,alex8866/cinder,j-griffith/cinder,cloudbase/cinder,openstack/cinder,julianwang/cinder,redhat-openstack/cinder,tlakshman26/cinder-bug-fix-volume-conversion-full,Akrog/cinder,Hybrid-Cloud/cinder,CloudServer/cinder,tlakshman26...
--- +++ @@ -22,8 +22,10 @@ def get_all_block_devices(self): """Get the list of all block devices seen in /dev/disk/by-path/.""" + files = [] dir = "/dev/disk/by-path/" - files = os.listdir(dir) + if os.path.isdir(dir): + files = os.listdir(dir) devices...
305969cedb966d1e5cd340d531727bb984ac35a8
whitenoise/generators/sqlalchemy.py
whitenoise/generators/sqlalchemy.py
import random from whitenoise.generators import BaseGenerator class SelectGenerator(BaseGenerator): ''' Creates a value by selecting from another SQLAlchemy table Depends on SQLAlchemy, and receiving a session object from the Fixture runner the SQLAlchemy fixture runner handles this for us Receives...
import random from whitenoise.generators import BaseGenerator class SelectGenerator(BaseGenerator): ''' Creates a value by selecting from another SQLAlchemy table Depends on SQLAlchemy, and receiving a session object from the Fixture runner the SQLAlchemy fixture runner handles this for us Receives...
Add a generator for association tables
Add a generator for association tables
Python
mit
James1345/white-noise
--- +++ @@ -24,3 +24,28 @@ return random.SystemRandom().choice(_query) else: return _query[0] + +class LinkGenerator(BaseGenerator): + ''' + Creates a list for secondary relationships using link tables by selecting from another SQLAlchemy table + Depends on SQLAlchemy, and ...
486aa11293754fc56d47b2820041c35255dfcf1c
echoapp/__main__.py
echoapp/__main__.py
from __future__ import unicode_literals import os import pprint import StringIO from flask import Flask from flask import request app = Flask(__name__) @app.route("/") def echo(): stream = StringIO.StringIO() indent = int(os.environ.get('PRINT_INDENT', 1)) pprint.pprint(request.environ, indent=indent, s...
from __future__ import unicode_literals import os import pprint import StringIO from flask import Flask from flask import request app = Flask(__name__) @app.route("/") def echo(): stream = StringIO.StringIO() indent = int(os.environ.get('PRINT_INDENT', 1)) pprint.pprint(request.environ, indent=indent, s...
Read HTTP server from env variables
Read HTTP server from env variables
Python
mit
victorlin/docker-eb-demo,victorlin/docker-eb-demo
--- +++ @@ -18,7 +18,11 @@ def main(): - app.run() + app.run( + host=os.environ.get('HTTP_HOST', '0.0.0.0'), + port=int(os.environ.get('HTTP_PORT', 80)), + debug=int(os.environ.get('DEBUG', 0)), + ) if __name__ == "__main__": main()
c44db12bbf960c8883c4fc31f47e31f4409fe685
feincms/views/decorators.py
feincms/views/decorators.py
try: from functools import wraps except ImportError: from django.utils.functional import wraps from feincms.models import Page def add_page_to_extra_context(view_func): def inner(request, *args, **kwargs): kwargs.setdefault('extra_context', {}) kwargs['extra_context']['feincms_page'] = Pa...
try: from functools import wraps except ImportError: from django.utils.functional import wraps from feincms.module.page.models import Page def add_page_to_extra_context(view_func): def inner(request, *args, **kwargs): kwargs.setdefault('extra_context', {}) kwargs['extra_context']['feincms...
Fix page import path in view decorator module
Fix page import path in view decorator module
Python
bsd-3-clause
mjl/feincms,nickburlett/feincms,michaelkuty/feincms,michaelkuty/feincms,nickburlett/feincms,hgrimelid/feincms,matthiask/feincms2-content,pjdelport/feincms,matthiask/django-content-editor,joshuajonah/feincms,joshuajonah/feincms,matthiask/django-content-editor,matthiask/django-content-editor,mjl/feincms,joshuajonah/feinc...
--- +++ @@ -3,7 +3,7 @@ except ImportError: from django.utils.functional import wraps -from feincms.models import Page +from feincms.module.page.models import Page def add_page_to_extra_context(view_func):
ee5ab61090cef682f37631a8c3f5764bdda63772
xpserver_web/tests/unit/test_web.py
xpserver_web/tests/unit/test_web.py
from django.core.urlresolvers import resolve from xpserver_web.views import main def test_root_resolves_to_hello_world(): found = resolve('/') assert found.func == main
from django.core.urlresolvers import resolve from xpserver_web.views import main, register def test_root_resolves_to_main(): found = resolve('/') assert found.func == main def test_register_resolves_to_main(): found = resolve('/register/') assert found.func == register
Add unit test for register
Add unit test for register
Python
mit
xp2017-hackergarden/server,xp2017-hackergarden/server,xp2017-hackergarden/server,xp2017-hackergarden/server
--- +++ @@ -1,8 +1,12 @@ from django.core.urlresolvers import resolve -from xpserver_web.views import main +from xpserver_web.views import main, register -def test_root_resolves_to_hello_world(): +def test_root_resolves_to_main(): found = resolve('/') assert found.func == main + +def test_register_re...
4c2e76d62460828aa0f30e903f57e7f515cc43f7
alg_kruskal_minimum_spanning_tree.py
alg_kruskal_minimum_spanning_tree.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function def make_set(): pass def link(): pass def find(): pass def union(): pass def kruskal(): """Kruskal's algorithm for minimum spanning tree in weighted graph. Time complexity for graph G(V, E)...
from __future__ import absolute_import from __future__ import division from __future__ import print_function def make_set(): pass def link(): pass def find(): pass def union(): pass def kruskal(): """Kruskal's algorithm for minimum spanning tree in weighted undirected graph. Time complexity for gr...
Revise doc string by adding "undirected"
Revise doc string by adding "undirected"
Python
bsd-2-clause
bowen0701/algorithms_data_structures
--- +++ @@ -21,7 +21,7 @@ def kruskal(): """Kruskal's algorithm for minimum spanning tree - in weighted graph. + in weighted undirected graph. Time complexity for graph G(V, E): O(|E|+|V|+|E|log(|V|))
a765366f9542f48374fe240f3e9e049225f86cec
email_handle/handle_incoming_email.py
email_handle/handle_incoming_email.py
import logging import webapp2 from google.appengine.ext.webapp.mail_handlers import InboundMailHandler from google.appengine.api import mail class ReplyHandler(InboundMailHandler): def receive(self, mail_message): logging.info("Received a message from: " + mail_message.sender) logging.info("Receive...
import logging import webapp2 from google.appengine.ext.webapp.mail_handlers import InboundMailHandler from google.appengine.api import mail class ReplyHandler(InboundMailHandler): def receive(self, mail_message): logging.info("Received a message from: " + mail_message.sender) message = mail.Email...
Fix bug : error at logging
Fix bug : error at logging
Python
mit
chaiso-krit/SimpleEmailGAE
--- +++ @@ -6,10 +6,9 @@ class ReplyHandler(InboundMailHandler): def receive(self, mail_message): logging.info("Received a message from: " + mail_message.sender) - logging.info("Received a message : " + mail_message.bodies('text/plain')) message = mail.EmailMessage() - message....
e120858d5cb123e9f3422ddb15ce79bde8d05d64
statsd/__init__.py
statsd/__init__.py
import socket try: from django.conf import settings except ImportError: settings = None from client import StatsClient __all__ = ['StatsClient', 'statsd'] VERSION = (0, 4, 0) __version__ = '.'.join(map(str, VERSION)) if settings: try: host = getattr(settings, 'STATSD_HOST', 'localhost') ...
import socket import os try: from django.conf import settings except ImportError: settings = None from client import StatsClient __all__ = ['StatsClient', 'statsd'] VERSION = (0, 4, 0) __version__ = '.'.join(map(str, VERSION)) if settings: try: host = getattr(settings, 'STATSD_HOST', 'localho...
Read settings from environment, if available
Read settings from environment, if available
Python
mit
lyft/pystatsd,jsocol/pystatsd,deathowl/pystatsd,Khan/pystatsd,Khan/pystatsd,smarkets/pystatsd,wujuguang/pystatsd,lyft/pystatsd
--- +++ @@ -1,4 +1,5 @@ import socket +import os try: from django.conf import settings @@ -21,4 +22,11 @@ prefix = getattr(settings, 'STATSD_PREFIX', None) statsd = StatsClient(host, port, prefix) except (socket.error, socket.gaierror, ImportError): - statsd = None + try:...
7d3ffe4582a5b4032f9a59a3ea8edfded57a7a1f
src/nodeconductor_openstack/openstack/migrations/0031_tenant_backup_storage.py
src/nodeconductor_openstack/openstack/migrations/0031_tenant_backup_storage.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.contenttypes.models import ContentType from django.db import migrations from nodeconductor.quotas import models as quotas_models from .. import models def cleanup_tenant_quotas(apps, schema_editor): for obj in models.Tenant.obj...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from .. import models def cleanup_tenant_quotas(apps, schema_editor): quota_names = models.Tenant.get_quotas_names() for obj in models.Tenant.objects.all(): obj.quotas.exclude(name__in=quota_names).delet...
Clean up quota cleanup migration
Clean up quota cleanup migration [WAL-433]
Python
mit
opennode/nodeconductor-openstack
--- +++ @@ -1,18 +1,15 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.contrib.contenttypes.models import ContentType from django.db import migrations - -from nodeconductor.quotas import models as quotas_models from .. import models def cleanup_tenant_quotas(apps, schema_e...
12956febe15e38c8b39edb4e268aa27228a4249f
tests/test_init.py
tests/test_init.py
from pkg_resources import safe_version import stagpy import helpers def test_init_config_None(): stagpy.conf.core.path = 'some_path' helpers.reset_config() assert(stagpy.conf.core.path == './') def test_version_format(): assert(stagpy.__version__ == safe_version(stagpy.__version__))
from pkg_resources import safe_version import stagpy import helpers def test_init_config_None(): stagpy.conf.core.path = 'some_path' helpers.reset_config() assert stagpy.conf.core.path == './' def test_version_format(): assert stagpy.__version__ == safe_version(stagpy.__version__)
Remove unecessary parentheses with assert stmt
Remove unecessary parentheses with assert stmt
Python
apache-2.0
StagPython/StagPy
--- +++ @@ -5,7 +5,7 @@ def test_init_config_None(): stagpy.conf.core.path = 'some_path' helpers.reset_config() - assert(stagpy.conf.core.path == './') + assert stagpy.conf.core.path == './' def test_version_format(): - assert(stagpy.__version__ == safe_version(stagpy.__version__)) + assert ...
e45fff968f37f558a49cf82b582d1f514a97b5af
tests/test_pool.py
tests/test_pool.py
import random import unittest from aioes.pool import RandomSelector, RoundRobinSelector class TestRandomSelector(unittest.TestCase): def setUp(self): random.seed(123456) def tearDown(self): random.seed(None) def test_select(self): s = RandomSelector() r = s.select([1, 2...
import asyncio import random import unittest from aioes.pool import RandomSelector, RoundRobinSelector, ConnectionPool from aioes.transport import Endpoint from aioes.connection import Connection class TestRandomSelector(unittest.TestCase): def setUp(self): random.seed(123456) def tearDown(self): ...
Add more tests for pool
Add more tests for pool
Python
apache-2.0
aio-libs/aioes
--- +++ @@ -1,7 +1,10 @@ +import asyncio import random import unittest -from aioes.pool import RandomSelector, RoundRobinSelector +from aioes.pool import RandomSelector, RoundRobinSelector, ConnectionPool +from aioes.transport import Endpoint +from aioes.connection import Connection class TestRandomSelector(...
92c9383f84385a0ceb2029437d0d77fc041d0353
tools/debug_adapter.py
tools/debug_adapter.py
#!/usr/bin/python import sys if 'darwin' in sys.platform: sys.path.append('/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python') sys.path.append('.') import adapter adapter.main.run_tcp_server(multiple=False)
#!/usr/bin/python import sys if 'darwin' in sys.platform: sys.path.append('/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python') sys.path.append('.') import adapter adapter.main.run_tcp_server()
Update code for changed function.
Update code for changed function.
Python
mit
NeroProtagonist/vscode-lldb,NeroProtagonist/vscode-lldb,NeroProtagonist/vscode-lldb,NeroProtagonist/vscode-lldb,NeroProtagonist/vscode-lldb
--- +++ @@ -5,4 +5,4 @@ sys.path.append('.') import adapter -adapter.main.run_tcp_server(multiple=False) +adapter.main.run_tcp_server()
49cd07a337a9a4282455765ef2b5a2445a0f6840
tools/dev/wc-format.py
tools/dev/wc-format.py
#!/usr/bin/env python import os import sqlite3 import sys # helper def usage(): sys.stderr.write("USAGE: %s [PATH]\n" + \ "\n" + \ "Prints to stdout the format of the working copy at PATH.\n") # parse argv wc = (sys.argv[1:] + ['.'])[0] # main() entries = os.path.join(wc, '.s...
#!/usr/bin/env python import os import sqlite3 import sys def print_format(wc_path): entries = os.path.join(wc_path, '.svn', 'entries') wc_db = os.path.join(wc_path, '.svn', 'wc.db') if os.path.exists(entries): formatno = int(open(entries).readline()) elif os.path.exists(wc_db): conn = sqlite3.conne...
Allow script to take multiple paths, and adjust to standard __main__ idiom for cmdline scripts.
Allow script to take multiple paths, and adjust to standard __main__ idiom for cmdline scripts. * tools/dev/wc-format.py: (usage): remove. all paths are allowed. (print_format): move guts of format fetching and printing into this function. print 'not under version control' for such a path, rather than bail...
Python
apache-2.0
jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion
--- +++ @@ -4,31 +4,33 @@ import sqlite3 import sys -# helper -def usage(): - sys.stderr.write("USAGE: %s [PATH]\n" + \ - "\n" + \ - "Prints to stdout the format of the working copy at PATH.\n") -# parse argv -wc = (sys.argv[1:] + ['.'])[0] +def print_format(wc_path): + ent...
aa8820bd7b78ba5729e0a7a17e43b87bfd033980
tests/runtests.py
tests/runtests.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2008 John Paulett (john -at- paulett.org) # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. import os import sys sys.path.append(os.path.join(os.path.dirna...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2008 John Paulett (john -at- paulett.org) # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. import os import sys sys.path.append(os.path.join(os.path.dirna...
Return correct status code to shell when tests fail.
Return correct status code to shell when tests fail. When tests fail (due to e.g. missing feedparser), then the exit code of tests/runtests.py is 0, which is treated by shell as success. Patch by Arfrever Frehtes Taifersar Arahesis.
Python
bsd-3-clause
mandx/jsonpickle,dongguangming/jsonpickle,dongguangming/jsonpickle,mandx/jsonpickle,mandx/jsonpickle,dongguangming/jsonpickle,mandx/jsonpickle,dongguangming/jsonpickle
--- +++ @@ -26,7 +26,7 @@ def main(): #unittest.main(defaultTest='suite') - unittest.TextTestRunner(verbosity=2).run(suite()) + return unittest.TextTestRunner(verbosity=2).run(suite()) if __name__ == '__main__': - main() + sys.exit(not main().wasSuccessful())
4bac0cfeb2d8def6183b4249f0ea93329b282cb4
botbot/envchecks.py
botbot/envchecks.py
"""Tools for checking environment variables""" import os from configparser import NoOptionError from .config import CONFIG def path_sufficient(): """ Checks whether all of the given paths are in the PATH environment variable """ paths = CONFIG.get('important', 'pathitems').split(':') for path...
"""Tools for checking environment variables""" import os from configparser import NoOptionError from .config import CONFIG def path_sufficient(): """ Checks whether all of the given paths are in the PATH environment variable """ paths = CONFIG.get('important', 'pathitems').split(':') for path...
Add checker for LD_LIBRARY_PATH env variable
Add checker for LD_LIBRARY_PATH env variable
Python
mit
jackstanek/BotBot,jackstanek/BotBot
--- +++ @@ -14,3 +14,13 @@ for path in paths: if path not in os.environ['PATH']: return ('PROB_PATH_NOT_COMPLETE', path) + +def ld_lib_path_sufficient(): + """ + Checks whether all of the given paths are in the LD_LIBRARY_PATH + einvironment variable + """ + paths = CONFIG.ge...
7f127ae718ada85c66342a7d995aab21cb214a46
IPython/core/tests/test_prefilter.py
IPython/core/tests/test_prefilter.py
"""Tests for input manipulation machinery.""" #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- import nose.tools as nt from IPython.testing import tools as tt, decorators as dec #-------------------...
"""Tests for input manipulation machinery.""" #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- import nose.tools as nt from IPython.testing import tools as tt, decorators as dec #-------------------...
Add some extra tests for prefiltering.
Add some extra tests for prefiltering.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -10,6 +10,8 @@ #----------------------------------------------------------------------------- # Tests #----------------------------------------------------------------------------- +ip = get_ipython() + @dec.parametric def test_prefilter(): """Test user input conversions""" @@ -29,6 +31,21 @@ ...
805e67ad540e3072929dea30b8894af87fc622ef
uiharu/__init__.py
uiharu/__init__.py
import logging from flask import Flask log = logging.getLogger(__name__) def create_app(config_dict): app = Flask(__name__, static_folder=None) app.config.update(**config_dict) from uiharu.api.views import api as api_blueprint from uiharu.weather.views import weather as weather_blueprint app....
import logging log = logging.getLogger(__name__)
Remove flask usage in init
Remove flask usage in init
Python
mit
kennydo/uiharu
--- +++ @@ -1,21 +1,5 @@ import logging - -from flask import Flask log = logging.getLogger(__name__) - -def create_app(config_dict): - app = Flask(__name__, static_folder=None) - app.config.update(**config_dict) - - from uiharu.api.views import api as api_blueprint - from uiharu.weather.views impo...
f7acd07138abff6028fe6ce39f12ede04b5d7c9a
tests/test_utils.py
tests/test_utils.py
import os from unittest import TestCase import requests from furikura import utils def test_request(): requests.get('https://example.com') class TestUtils(TestCase): def test_get_file(self): self.assertEqual(utils.get_file("testfile"), "/usr/share/testfile") def test_check_connection(self): ...
import os from unittest import TestCase import requests from furikura import utils from furikura.config import Config config_cls = Config() def test_request(): requests.get('https://example.com') class TestUtils(TestCase): def test_get_file(self): self.assertEqual(utils.get_file("testfile"), "/usr/...
Add 2 tests for Utils
Add 2 tests for Utils
Python
mit
benjamindean/furi-kura,benjamindean/furi-kura
--- +++ @@ -4,7 +4,9 @@ import requests from furikura import utils +from furikura.config import Config +config_cls = Config() def test_request(): requests.get('https://example.com') @@ -25,3 +27,13 @@ utils.autostart('remove') self.assertFalse(os.path.islink(os.path.expanduser('~/.conf...
b047685088b9179e0c784114ff4a41509dbfdf7d
tests/test_utils.py
tests/test_utils.py
from django_logutils.utils import add_items_to_message def test_add_items_to_message(): msg = "log message" items = {'user': 'benny', 'email': 'benny@example.com'} msg = add_items_to_message(msg, items) assert msg == 'log message user=benny email=benny@example.com'
from django_logutils.utils import add_items_to_message def test_add_items_to_message(): msg = "log message" items = {'user': 'benny', 'email': 'benny@example.com'} msg = add_items_to_message(msg, items) assert msg.startswith('log message') assert 'user=benny' in msg assert 'email=benny@example...
Fix utils test and add an extra test.
Fix utils test and add an extra test.
Python
bsd-3-clause
jsmits/django-logutils,jsmits/django-logutils
--- +++ @@ -5,4 +5,13 @@ msg = "log message" items = {'user': 'benny', 'email': 'benny@example.com'} msg = add_items_to_message(msg, items) - assert msg == 'log message user=benny email=benny@example.com' + assert msg.startswith('log message') + assert 'user=benny' in msg + assert 'email=be...
a521a655db886bcd85f5f449c99875e90cd4fa93
monitoring/nagios/logger.py
monitoring/nagios/logger.py
#=============================================================================== # -*- coding: UTF-8 -*- # Module : log # Author : Vincent BESANCON aka 'v!nZ' <besancon.vincent@gmail.com> # Description : Base to have some logging. #------------------------------------------------------------------------...
# -*- coding: UTF-8 -*- # Copyright (C) Vincent BESANCON <besancon.vincent@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the...
Refresh monitoring.nagios.log and fix pylint+pep8.
Refresh monitoring.nagios.log and fix pylint+pep8.
Python
mit
bigbrozer/monitoring.nagios,bigbrozer/monitoring.nagios
--- +++ @@ -1,24 +1,25 @@ -#=============================================================================== # -*- coding: UTF-8 -*- -# Module : log -# Author : Vincent BESANCON aka 'v!nZ' <besancon.vincent@gmail.com> -# Description : Base to have some logging. -#--------------------------------------...
8e00f9ff03464f0cf70b022f899ec7ef1c173829
exec_thread_1.py
exec_thread_1.py
#import spam import filter_lta #VALID_FILES = filter_lta.VALID_OBS().split('\n') print filter_lta.VALID_OBS() #def extract_basename(): def main(): #Convert the LTA file to the UVFITS format #Generates UVFITS file with same basename as LTA file spam.convert_lta_to_uvfits('Name of the file') #Take g...
#import spam import filter_lta #List of all directories containing valid observations VALID_FILES = filter_lta.VALID_OBS() #List of all directories for current threads to process THREAD_FILES = VALID_FILES[0:len(VALID_FILES):5] print THREAD_FILES def main(): for i in THREAD_FILES: LTA_FILES = os.chdir(...
Add code for thread to filter valid files for processing
Add code for thread to filter valid files for processing
Python
mit
NCRA-TIFR/gadpu,NCRA-TIFR/gadpu
--- +++ @@ -1,22 +1,29 @@ #import spam import filter_lta -#VALID_FILES = filter_lta.VALID_OBS().split('\n') -print filter_lta.VALID_OBS() +#List of all directories containing valid observations +VALID_FILES = filter_lta.VALID_OBS() -#def extract_basename(): +#List of all directories for current threads to pro...
34db760c5b763ad2df02398d58ea417b47b785e7
geotrek/zoning/views.py
geotrek/zoning/views.py
from django.shortcuts import get_object_or_404 from django.views.decorators.cache import cache_page from django.conf import settings from django.utils.decorators import method_decorator from djgeojson.views import GeoJSONLayerView from .models import City, RestrictedArea, RestrictedAreaType, District class LandLayer...
from django.shortcuts import get_object_or_404 from django.views.decorators.cache import cache_page from django.conf import settings from django.utils.decorators import method_decorator from djgeojson.views import GeoJSONLayerView from .models import City, RestrictedArea, RestrictedAreaType, District class LandLayer...
Change cache land, use settings mapentity
Change cache land, use settings mapentity
Python
bsd-2-clause
GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek
--- +++ @@ -12,7 +12,8 @@ precision = settings.LAYER_PRECISION_LAND simplify = settings.LAYER_SIMPLIFY_LAND - @method_decorator(cache_page(settings.CACHE_TIMEOUT_LAND_LAYERS, cache="fat")) + @method_decorator(cache_page(settings.CACHE_TIMEOUT_LAND_LAYERS, + cache=sett...
3875b1ec7d056d337cc1c02d9567cd7ff1ae9748
utils/sub8_ros_tools/sub8_ros_tools/init_helpers.py
utils/sub8_ros_tools/sub8_ros_tools/init_helpers.py
import rospy from time import time def wait_for_param(param_name, timeout=None, poll_rate=0.1): '''Blocking wait for a parameter named $parameter_name to exist Poll at frequency $poll_rate Once the parameter exists, return get and return it. This function intentionally leaves failure logging ...
import rospy import rostest import time def wait_for_param(param_name, timeout=None, poll_rate=0.1): '''Blocking wait for a parameter named $parameter_name to exist Poll at frequency $poll_rate Once the parameter exists, return get and return it. This function intentionally leaves failure log...
Add init-helper 'wait for subscriber'
UTILS: Add init-helper 'wait for subscriber' For integration-testing purposes it is often useful to wait until a particular node subscribes to you
Python
mit
pemami4911/Sub8,pemami4911/Sub8,pemami4911/Sub8
--- +++ @@ -1,5 +1,6 @@ import rospy -from time import time +import rostest +import time def wait_for_param(param_name, timeout=None, poll_rate=0.1): @@ -9,7 +10,7 @@ This function intentionally leaves failure logging duties to the developer ''' - start_time = time() + start_time = time.time()...
7376a29d69ac78cabc5d392cb748f708ffa0e68c
tests/pretty_format_json_test.py
tests/pretty_format_json_test.py
import tempfile import pytest from pre_commit_hooks.pretty_format_json import pretty_format_json from testing.util import get_resource_path @pytest.mark.parametrize(('filename', 'expected_retval'), ( ('not_pretty_formatted_json.json', 1), ('pretty_formatted_json.json', 0), )) def test_pretty_format_json(fil...
import io import pytest from pre_commit_hooks.pretty_format_json import pretty_format_json from testing.util import get_resource_path @pytest.mark.parametrize(('filename', 'expected_retval'), ( ('not_pretty_formatted_json.json', 1), ('pretty_formatted_json.json', 0), )) def test_pretty_format_json(filename,...
Write to temp directories in such a way that files get cleaned up
Write to temp directories in such a way that files get cleaned up
Python
mit
Coverfox/pre-commit-hooks,Harwood/pre-commit-hooks,pre-commit/pre-commit-hooks
--- +++ @@ -1,4 +1,4 @@ -import tempfile +import io import pytest @@ -15,24 +15,18 @@ assert ret == expected_retval -def test_autofix_pretty_format_json(): - toformat_file = tempfile.NamedTemporaryFile(delete=False, mode='w+') - - # copy our file to format there - model_file = open(get_resource...
91709b78c27ed0e05f3c67fcc13ffa8085dac15a
heavy-ion-luminosity.py
heavy-ion-luminosity.py
__author__ = 'jacob' import ROOT import numpy as np import os from root_numpy import root2array, root2rec, tree2rec # Look at r284484 data filename = os.path.join("data", "r284484.root") # Convert a TTree in a ROOT file into a NumPy structured array arr = root2array(filename) print(arr.dtype) # The TTree name is al...
__author__ = 'jacob' import ROOT import numpy as np import os from root_numpy import root2array, root2rec, tree2rec # Look at r284484 data filename = os.path.join("data", "r284484.root") # Convert a TTree in a ROOT file into a NumPy structured array arr = root2array(filename) for element in arr.dtype.names: pri...
Print out dtypes in .root file individually
Print out dtypes in .root file individually
Python
mit
jacobbieker/ATLAS-Luminosity
--- +++ @@ -11,7 +11,9 @@ # Convert a TTree in a ROOT file into a NumPy structured array arr = root2array(filename) -print(arr.dtype) +for element in arr.dtype.names: + print(element) + print("\n") # The TTree name is always optional if there is only one TTree in the file # Convert a TTree in a ROOT fil...
bfec6f3e2db99e20baf9b87fcd85da9ff050b030
UM/OutputDevice/OutputDeviceError.py
UM/OutputDevice/OutputDeviceError.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. class ErrorCodes: UserCanceledError = 1 DeviceBusyError = 2 class WriteRequestFailedError(Exception): def __init__(self, code, message): super().__init__(message) self.code = code sel...
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. class WriteRequestFailedError(Exception): pass class UserCancelledError(WriteRequestFailedError): pass class PermissionDeniedError(WriteRequestFailedError): pass class DeviceBusyError(WriteRequestFailedErr...
Replace error codes with error subclasses
Replace error codes with error subclasses This provides the same information but is a cleaner solution for python
Python
agpl-3.0
onitake/Uranium,onitake/Uranium
--- +++ @@ -1,12 +1,14 @@ # Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. -class ErrorCodes: - UserCanceledError = 1 - DeviceBusyError = 2 +class WriteRequestFailedError(Exception): + pass -class WriteRequestFailedError(Exception): - def __init__(se...
094132685688d0e9e599da6e8c0e0554945d56a5
html5lib/trie/datrie.py
html5lib/trie/datrie.py
from __future__ import absolute_import, division, unicode_literals from itertools import chain from datrie import Trie as DATrie from ._base import Trie as ABCTrie class Trie(ABCTrie): def __init__(self, data): chars = set() for key in data.keys(): if not isinstance(key, str): ...
from __future__ import absolute_import, division, unicode_literals from itertools import chain from datrie import Trie as DATrie from six import text_type from ._base import Trie as ABCTrie class Trie(ABCTrie): def __init__(self, data): chars = set() for key in data.keys(): if not is...
Fix DATrie support under Python 2.
Fix DATrie support under Python 2. This is a simple issue of using `str` to refer to what should be `six.text_type`.
Python
mit
mindw/html5lib-python,html5lib/html5lib-python,alex/html5lib-python,gsnedders/html5lib-python,ordbogen/html5lib-python,dstufft/html5lib-python,alex/html5lib-python,mgilson/html5lib-python,alex/html5lib-python,mindw/html5lib-python,dstufft/html5lib-python,dstufft/html5lib-python,ordbogen/html5lib-python,html5lib/html5li...
--- +++ @@ -3,6 +3,7 @@ from itertools import chain from datrie import Trie as DATrie +from six import text_type from ._base import Trie as ABCTrie @@ -10,7 +11,7 @@ def __init__(self, data): chars = set() for key in data.keys(): - if not isinstance(key, str): + i...
e20dc134911ad7b99014fdbf77dacd498cecce19
eventkit/plugins/fluentevent/migrations/0002_fluentevent_layout.py
eventkit/plugins/fluentevent/migrations/0002_fluentevent_layout.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('icekit', '0002_layout'), ('eventkit_fluentevent', '0001_initial'), ] operations = [ migrations.AddField( ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('icekit', '0002_layout'), ('eventkit_fluentevent', '0001_initial'), ] operations = [ migrations.AddField( ...
Update related name for `layout` field.
Update related name for `layout` field.
Python
mit
ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-events,ic-labs/icekit-events,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-events
--- +++ @@ -15,7 +15,7 @@ migrations.AddField( model_name='fluentevent', name='layout', - field=models.ForeignKey(blank=True, to='icekit.Layout', null=True), + field=models.ForeignKey(related_name='eventkit_fluentevent_fluentevent_related', blank=True, to='icek...
73f76034b0d00c48774cafe3584bb672b8ba55bd
apps/announcements/models.py
apps/announcements/models.py
# -*- coding: utf-8 -*- from django.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic class Authors(models.Model): author = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericFor...
# -*- coding: utf-8 -*- from django.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic class Authors(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.Gene...
Rename of the author field to content_type in the model, in order to avoid confusion
Rename of the author field to content_type in the model, in order to avoid confusion
Python
agpl-3.0
LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr
--- +++ @@ -5,9 +5,9 @@ from django.contrib.contenttypes import generic class Authors(models.Model): - author = models.ForeignKey(ContentType) + content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() - content_object = generic.GenericForeignKey('author', 'object_id')...
6203fcb19fa8b8ca39d419d7f0cf482a1a718a02
indra/java_vm.py
indra/java_vm.py
"""Handles all imports from jnius to prevent conflicts resulting from attempts to set JVM options while the VM is already running.""" import jnius_config if '-Xmx4g' not in jnius_config.get_options(): if not jnius_config.vm_running: jnius_config.add_options('-Xmx4g') else: warnings.warn("Could...
"""Handles all imports from jnius to prevent conflicts resulting from attempts to set JVM options while the VM is already running.""" import os import jnius_config if '-Xmx4g' not in jnius_config.get_options(): if not jnius_config.vm_running: jnius_config.add_options('-Xmx4g') else: warnings.w...
Set jnius classpath to biopax jars automatically
Set jnius classpath to biopax jars automatically
Python
bsd-2-clause
johnbachman/indra,pvtodorov/indra,sorgerlab/indra,jmuhlich/indra,sorgerlab/belpy,johnbachman/belpy,pvtodorov/indra,pvtodorov/indra,sorgerlab/belpy,jmuhlich/indra,sorgerlab/indra,johnbachman/indra,pvtodorov/indra,bgyori/indra,bgyori/indra,bgyori/indra,johnbachman/belpy,jmuhlich/indra,johnbachman/belpy,sorgerlab/belpy,so...
--- +++ @@ -1,6 +1,7 @@ """Handles all imports from jnius to prevent conflicts resulting from attempts to set JVM options while the VM is already running.""" +import os import jnius_config if '-Xmx4g' not in jnius_config.get_options(): @@ -10,5 +11,9 @@ warnings.warn("Couldn't set memory limit for Ja...
9e4c34ee1e2de5fb8611d2c4b540e55d9872d0ae
astro.py
astro.py
import ephem from datetime import datetime def const(planet_name): # function name and parameters planet_class = getattr(ephem, planet_name) # sets ephem object class date_class = datetime.now() planet = planet_class() # sets planet variable south_bend = ephem.Observer...
import ephem from datetime import datetime def star(star_name): star = ephem.star(star_name) south_bend = ephem.Observer() date_class = datetime.now() south_bend.lat = '41.15' south_bend.lon = '-86.26' south_bend.date = date_class star.compute(south_bend) print date_class print ...
Add menu to choose star or planet, print results.
Add menu to choose star or planet, print results.
Python
mit
bennettscience/PySky
--- +++ @@ -1,5 +1,19 @@ import ephem from datetime import datetime + +def star(star_name): + star = ephem.star(star_name) + south_bend = ephem.Observer() + date_class = datetime.now() + south_bend.lat = '41.15' + south_bend.lon = '-86.26' + south_bend.date = date_class + star.compute(south...
628f9edd7aefda1f9cf29cd5a3d04342877a5c38
custom/icds/rules/custom_actions.py
custom/icds/rules/custom_actions.py
from corehq.apps.data_interfaces.models import CaseRuleActionResult, AUTO_UPDATE_XMLNS from corehq.apps.hqcase.utils import update_case def escalate_tech_issue(case, rule): if case.type != 'tech_issue' return CaseRuleActionResult() escalated_ticket_level_map = { 'supervisor': 'block', ...
import pytz from corehq.apps.data_interfaces.models import CaseRuleActionResult, AUTO_UPDATE_XMLNS from corehq.apps.hqcase.utils import update_case from corehq.util.timezones.conversions import ServerTime from datetime import datetime def escalate_tech_issue(case, rule): if case.type != 'tech_issue' retur...
Add more properties to be updated
Add more properties to be updated
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -1,5 +1,8 @@ +import pytz from corehq.apps.data_interfaces.models import CaseRuleActionResult, AUTO_UPDATE_XMLNS from corehq.apps.hqcase.utils import update_case +from corehq.util.timezones.conversions import ServerTime +from datetime import datetime def escalate_tech_issue(case, rule): @@ -12,16 +1...
d6b7cccb14cd1f82bb3a6b070999204fafacf07e
hyper/common/util.py
hyper/common/util.py
# -*- coding: utf-8 -*- """ hyper/common/util ~~~~~~~~~~~~~~~~~ General utility functions for use with hyper. """ from hyper.compat import unicode, bytes, imap def to_bytestring(element): """ Converts a single string to a bytestring, encoding via UTF-8 if needed. """ if isinstance(element, unicode): ...
# -*- coding: utf-8 -*- """ hyper/common/util ~~~~~~~~~~~~~~~~~ General utility functions for use with hyper. """ from hyper.compat import unicode, bytes, imap def to_bytestring(element): """ Converts a single string to a bytestring, encoding via UTF-8 if needed. """ if isinstance(element, unicode): ...
Fix to_host_port_tuple to resolve test case issues
Fix to_host_port_tuple to resolve test case issues
Python
mit
Lukasa/hyper,lawnmowerlatte/hyper,irvind/hyper,Lukasa/hyper,lawnmowerlatte/hyper,fredthomsen/hyper,irvind/hyper,plucury/hyper,fredthomsen/hyper,plucury/hyper
--- +++ @@ -31,8 +31,13 @@ Converts the given string containing a host and possibly a port to a tuple. """ + if ']' in host_port_str: + delim = ']:' + else: + delim = ':' + try: - host, port = host_port_str.rsplit(':', 1) + host, port = host_port_str.rspli...
67a50f33177e0fa6aec15fc7d26836c38b374c31
plugins/lastfm.py
plugins/lastfm.py
from util import hook, http api_key = "" api_url = "http://ws.audioscrobbler.com/2.0/?format=json" @hook.command def lastfm(inp, nick='', say=None): if inp: user = inp else: user = nick response = http.get_json(api_url, method="user.getrecenttracks", api_key=...
from util import hook, http api_key = "" api_url = "http://ws.audioscrobbler.com/2.0/?format=json" @hook.command def lastfm(inp, nick='', say=None): if inp: user = inp else: user = nick response = http.get_json(api_url, method="user.getrecenttracks", api_key=...
Fix last.fm bug for users not listening to something.
Fix last.fm bug for users not listening to something. The last.fm plugin previously worked only for users not listening to anything, and then it was 'fixed' for users listening to something, but broke for users not listening to something. See lastfm.py comments for changes.
Python
unlicense
parkrrr/skybot,Jeebeevee/DouweBot_JJ15,craisins/wh2kbot,callumhogsden/ausbot,df-5/skybot,ddwo/nhl-bot,Jeebeevee/DouweBot,rmmh/skybot,TeamPeggle/ppp-helpdesk,crisisking/skybot,Teino1978-Corp/Teino1978-Corp-skybot,isislab/botbot,cmarguel/skybot,jmgao/skybot,craisins/nascarbot,olslash/skybot,andyeff/skybot,SophosBlitz/gla...
--- +++ @@ -20,12 +20,29 @@ else: return "your nick is not a LastFM account. try '.lastfm username'." - track = response["recenttracks"]["track"] + tracks = response["recenttracks"]["track"] + + if len(tracks) == 0: + return "no recent tracks for user %r found" % user + + if...
c7d0f17f552e825582a616e05e5fa91690f18b29
flask/kasm-server.py
flask/kasm-server.py
import json import random import string from flask import Flask, request, jsonify, render_template from flask.ext.pymongo import PyMongo from pymongo.errors import DuplicateKeyError app = Flask(__name__) app.config['MONGO_DBNAME'] = 'kasm' mongo = PyMongo(app) @app.route('/') def hello_world(): return render_temp...
import json import random import string from flask import Flask, request, jsonify, render_template from flask.ext.pymongo import PyMongo from pymongo.errors import DuplicateKeyError app = Flask(__name__) app.config['MONGO_DBNAME'] = 'kasm' mongo = PyMongo(app) @app.route('/') def hello_world(): return render_temp...
Fix missing import, add alias/deactivate method
Fix missing import, add alias/deactivate method
Python
mit
clayadavis/OpenKasm,clayadavis/OpenKasm
--- +++ @@ -14,8 +14,8 @@ return render_template('kasm.html') -@app.route('/create', methods=['POST']) -def create(): +@app.route('/alias/create', methods=['POST']) +def create_alias(): def id_generator(size, chars=string.ascii_lowercase + string.digits): return ''.join(random.choice(chars) for...
14ac1f7f4cec2f461f9e2df136bc3cf9894a9359
website/services.py
website/services.py
# -*- coding: utf-8 -*- """ website.services ~~~~~~~~~~~~~~~~ top level services api. :copyright: (c) 2014 by xiong.xiaox(xiong.xiaox@alibaba-inc.com). """ import subprocess from threading import Timer def exec_command(cmd): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, ...
# -*- coding: utf-8 -*- """ website.services ~~~~~~~~~~~~~~~~ top level services api. :copyright: (c) 2014 by xiong.xiaox(xiong.xiaox@alibaba-inc.com). """ import subprocess from threading import Timer def exec_command(cmd): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, ...
Fix exec command timeout timer bug.
Fix exec command timeout timer bug.
Python
bsd-3-clause
alibaba/FlexGW,alibaba/FlexGW,alibaba/FlexGW,alibaba/FlexGW,sdgdsffdsfff/FlexGW,sdgdsffdsfff/FlexGW,sdgdsffdsfff/FlexGW,sdgdsffdsfff/FlexGW
--- +++ @@ -18,7 +18,7 @@ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # settings exec timeout - timer = Timer(5, proc.kill, [proc]) + timer = Timer(5, proc.kill) timer.start() stdout, stderr = proc.communicate() timer.cancel(...
1cb6aeab0d86ce79ecbb26ecc705902a0b360b93
powerline/core.py
powerline/core.py
# -*- coding: utf-8 -*- class Powerline(object): def __init__(self, segments): '''Create a new Powerline. Segments that aren't filler segments and whose contents aren't None are dropped from the segment array. ''' self.segments = [segment for segment in segments if segment['contents'] is not None or segme...
# -*- coding: utf-8 -*- class Powerline(object): def __init__(self, segments): '''Create a new Powerline. Segments that aren't filler segments and whose contents aren't None are dropped from the segment array. ''' self.renderer = None # FIXME This should be assigned here based on the current configuratio...
Create renderer property for Powerline class
Create renderer property for Powerline class
Python
mit
seanfisk/powerline,EricSB/powerline,darac/powerline,dragon788/powerline,QuLogic/powerline,keelerm84/powerline,xxxhycl2010/powerline,blindFS/powerline,junix/powerline,cyrixhero/powerline,IvanAli/powerline,keelerm84/powerline,xxxhycl2010/powerline,Luffin/powerline,s0undt3ch/powerline,DoctorJellyface/powerline,Luffin/powe...
--- +++ @@ -8,9 +8,10 @@ Segments that aren't filler segments and whose contents aren't None are dropped from the segment array. ''' + self.renderer = None # FIXME This should be assigned here based on the current configuration self.segments = [segment for segment in segments if segment['contents'] is n...
c487dfc63e71abb0e11534c42591c216def5c433
ITDB/ITDB_Main/views.py
ITDB/ITDB_Main/views.py
from django.http import Http404 from django.http import HttpResponse from django.shortcuts import render from django.template import RequestContext, loader from .models import Theater # Default first page. Should be the search page. def index(request): return HttpResponse("Hello, world. You're at the ITDB_Main in...
from django.http import Http404 from django.http import HttpResponse from django.shortcuts import get_object_or_404, render from django.template import RequestContext, loader from .models import Theater # Default first page. Should be the search page. def index(request): return HttpResponse("Hello, world. You're ...
Update theater view to use get_object_or_404 shortcut
Update theater view to use get_object_or_404 shortcut
Python
apache-2.0
Plaudenslager/ITDB,Plaudenslager/ITDB,Plaudenslager/ITDB
--- +++ @@ -1,6 +1,6 @@ from django.http import Http404 from django.http import HttpResponse -from django.shortcuts import render +from django.shortcuts import get_object_or_404, render from django.template import RequestContext, loader from .models import Theater @@ -15,10 +15,8 @@ return render(request, ...
7d59b8d25d2ff917794a181b614a284e4e75acc5
account_fiscal_position_no_source_tax/account.py
account_fiscal_position_no_source_tax/account.py
from openerp import models, api, fields class account_fiscal_position(models.Model): _inherit = 'account.fiscal.position' @api.v8 # noqa def map_tax(self, taxes): result = super(account_fiscal_position, self).map_tax(taxes) taxes_without_src_ids = [ x.tax_dest_id.id for x...
from openerp import models, api, fields class account_fiscal_position(models.Model): _inherit = 'account.fiscal.position' @api.v7 def map_tax(self, cr, uid, fposition_id, taxes, context=None): result = super(account_fiscal_position, self).map_tax( cr, uid, fposition_id, taxes, contex...
FIX fiscal position no source tax on v7 api
FIX fiscal position no source tax on v7 api
Python
agpl-3.0
csrocha/account_journal_payment_subtype,csrocha/account_voucher_payline
--- +++ @@ -4,6 +4,15 @@ class account_fiscal_position(models.Model): _inherit = 'account.fiscal.position' + + @api.v7 + def map_tax(self, cr, uid, fposition_id, taxes, context=None): + result = super(account_fiscal_position, self).map_tax( + cr, uid, fposition_id, taxes, context=conte...
18796393fa18590d9de6c67ccb9ac6fd958855fc
api/api_resource.py
api/api_resource.py
from falcon.util.uri import parse_query_string import json from api.actions import pos_tagging class ApiResource(object): def parse_request_data(self, raw_post_data): try: raw_correct_encoded = str(raw_post_data, 'utf-8') except UnicodeDecodeError: raw_correct_encoded = "" ...
from falcon.util.uri import parse_query_string import json from api.actions import pos_tagging class ApiResource(object): def parse_request_data(self, raw_post_data): encoded_raw_post_data = "" try: encoded_raw_post_data = str(raw_post_data, 'utf-8') except UnicodeDecodeError: ...
Refactor handling of pretty parameter.
Refactor handling of pretty parameter. Former-commit-id: 04093318dd591d642854485a97109855275c8596
Python
mit
EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger,EmilStenstrom/json-tagger
--- +++ @@ -4,31 +4,36 @@ class ApiResource(object): def parse_request_data(self, raw_post_data): + encoded_raw_post_data = "" try: - raw_correct_encoded = str(raw_post_data, 'utf-8') + encoded_raw_post_data = str(raw_post_data, 'utf-8') except UnicodeDecodeError...
18ed712bad3beb8c128f56638878e66f34bcf722
Lib/test/test_binhex.py
Lib/test/test_binhex.py
#! /usr/bin/env python """Test script for the binhex C module Uses the mechanism of the python binhex module Roger E. Masse """ import binhex import tempfile from test_support import verbose, TestSkipped def test(): try: fname1 = tempfile.mktemp() fname2 = tempfile.mktemp() f = open...
#! /usr/bin/env python """Test script for the binhex C module Uses the mechanism of the python binhex module Based on an original test by Roger E. Masse. """ import binhex import os import tempfile import test_support import unittest class BinHexTestCase(unittest.TestCase): def setUp(self): self.f...
Convert binhex regression test to PyUnit. We could use a better test for this.
Convert binhex regression test to PyUnit. We could use a better test for this.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -2,46 +2,44 @@ """Test script for the binhex C module Uses the mechanism of the python binhex module - Roger E. Masse + Based on an original test by Roger E. Masse. """ import binhex +import os import tempfile -from test_support import verbose, TestSkipped +import test_support +import unittes...
9fece51bc6b3496381871c0fc7db486f8fbfebd7
chef/tests/test_role.py
chef/tests/test_role.py
from chef import Role from chef.exceptions import ChefError from chef.tests import ChefTestCase class RoleTestCase(ChefTestCase): def test_get(self): r = Role('test_1') self.assertTrue(r.exists) self.assertEqual(r.description, 'Static test role 1') self.assertEqual(r.run_list, []) ...
from chef import Role from chef.exceptions import ChefError from chef.tests import ChefTestCase class RoleTestCase(ChefTestCase): def test_get(self): r = Role('test_1') self.assertTrue(r.exists) self.assertEqual(r.description, 'Static test role 1') self.assertEqual(r.run_list, []) ...
Add tests for role attributes.
Add tests for role attributes.
Python
apache-2.0
cread/pychef,jarosser06/pychef,jarosser06/pychef,coderanger/pychef,Scalr/pychef,dipakvwarade/pychef,cread/pychef,dipakvwarade/pychef,coderanger/pychef,Scalr/pychef
--- +++ @@ -8,18 +8,26 @@ self.assertTrue(r.exists) self.assertEqual(r.description, 'Static test role 1') self.assertEqual(r.run_list, []) + self.assertEqual(r.default_attributes['test_attr'], 'default') + self.assertEqual(r.default_attributes['nested']['nested_attr'], 1) + ...
2f3265e6fc64b962334b649f2c7b52f6d44b26b1
project/models.py
project/models.py
import datetime from project import db, bcrypt class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String, unique=True, nullable=False) password = db.Column(db.String, nullable=False) registered_on = db.Column(db.DateTime, nullable=Fal...
Create basic user model for auth
Create basic user model for auth
Python
mit
dylanshine/streamschool,dylanshine/streamschool
--- +++ @@ -0,0 +1,35 @@ +import datetime + +from project import db, bcrypt + + +class User(db.Model): + + __tablename__ = "users" + + id = db.Column(db.Integer, primary_key=True) + email = db.Column(db.String, unique=True, nullable=False) + password = db.Column(db.String, nullable=False) + registered_...
2efe1364a1e37f06dc26f1a3a122c544437d914e
collector/classes/service.py
collector/classes/service.py
# -*- coding: utf-8 -*- import string def sanitise_string(messy_str): """Whitelist characters in a string""" valid_chars = ' {0}{1}'.format(string.ascii_letters, string.digits) return u''.join(char for char in messy_str if char in valid_chars).strip() class Service(object): def __init__(self, numeri...
# -*- coding: utf-8 -*- import string def sanitise_string(messy_str): """Whitelist characters in a string""" valid_chars = ' {0}{1}'.format(string.ascii_letters, string.digits) return u''.join(char for char in messy_str if char in valid_chars).strip() class Service(object): def __init__(self, numeri...
Add log message if data we can't parse appears
Add log message if data we can't parse appears If the datum isn't numeric and doesn't match the 'no data' pattern, something has gone horribly wrong.
Python
mit
alphagov/backdrop-transactions-explorer-collector,alphagov/backdrop-transactions-explorer-collector
--- +++ @@ -40,6 +40,7 @@ elif not isinstance(datum, (int, long, float, complex)): # If the value we get from the spreadsheet is not numeric, send # that to Backdrop as a null data point + print "Data from the spreadsheet doesn't look numeric: <{0}> (from {1})".format(dat...
ff9945037fc27e2053712feef2c4f613d9581ccd
awx/sso/__init__.py
awx/sso/__init__.py
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved.
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python import threading # Monkeypatch xmlsec.initialize() to only run once (https://github.com/ansible/ansible-tower/issues/3241). xmlsec_init_lock = threading.Lock() xmlsec_initialized = False import dm.xmlsec.binding original_xmlsec_initialize = dm.xmlsec...
Initialize xmlsec once to prevent SAML auth from hanging.
Initialize xmlsec once to prevent SAML auth from hanging.
Python
apache-2.0
wwitzel3/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx
--- +++ @@ -1,2 +1,21 @@ # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. + +# Python +import threading + +# Monkeypatch xmlsec.initialize() to only run once (https://github.com/ansible/ansible-tower/issues/3241). +xmlsec_init_lock = threading.Lock() +xmlsec_initialized = False + +import dm.xmlsec.binding ...
9f925f0da6d3a06d085ee71b8bee0fcdecaed5a0
marrow/schema/transform/primitive.py
marrow/schema/transform/primitive.py
# encoding: utf-8 raise ImportError("For future use.") from __future__ import unicode_literals from ..compat import unicode from .base import Concern, Transform, Attribute class Primitive(Transform): pass """ Primitive VInteger (min/max) VFloat (min/max) Decimal (min/max) Complex String Binary Unicode Nu...
# encoding: utf-8 from __future__ import unicode_literals from ..compat import unicode from .base import Concern, Transform, Attribute class Primitive(Transform): pass """ Primitive VInteger (min/max) VFloat (min/max) Decimal (min/max) Complex String Binary Unicode Null Tuple List Set Mapping Sequence...
Fix for insanely silly pip.
Fix for insanely silly pip.
Python
mit
marrow/schema,marrow/schema
--- +++ @@ -1,6 +1,4 @@ # encoding: utf-8 - -raise ImportError("For future use.") from __future__ import unicode_literals
57ef9c9166d5bc573589cb58313056a2ef515ad8
tests/test_misc.py
tests/test_misc.py
import mr_streams as ms import unittest from operator import add # :::: auxilary functions :::: def add_one(x): return x + 1 def repeat_n_times(x, n = 1): return [x] * n def double(x): return [x,x] class TestMisc(unittest.TestCase): def test_001(self): _ = ms.stream([1,2,3,4,5]) _ = _....
import mr_streams as ms import unittest from operator import add # :::: auxilary functions :::: def add_one(x): return x + 1 def repeat_n_times(x, n = 1): return [x] * n def double(x): return [x,x] class TestMisc(unittest.TestCase): def test_001(self): _ = ms.stream([1,2,3,4,5]) _ = _....
Add test for nesting streamer data-structures.
Add test for nesting streamer data-structures.
Python
mit
caffeine-potent/Streamer-Datastructure
--- +++ @@ -18,3 +18,9 @@ .flatmap( double)\ .flatmap(repeat_n_times, n = 2) _.drain() + + def test_embedded(self): + stream_1 = ms.stream(range(10)) + stream_2 = ms.stream(stream_1) + stream_3 = ms.stream(stream_2) + stream_3.drain()
30f1156140a4a246a2090aa3e8d5183ceea0beed
tests/test_mmap.py
tests/test_mmap.py
from . import base import os import mmstats class TestMmap(base.MmstatsTestCase): def test_pagesize(self): """PAGESIZE > 0""" self.assertTrue(mmstats.PAGESIZE > 0, mmstats.PAGESIZE) def test_init_alt_name(self): expected_fn = os.path.join(self.path, 'mmstats-test_init_alt_name') ...
from . import base import os import mmstats class TestMmap(base.MmstatsTestCase): def test_pagesize(self): """PAGESIZE > 0""" self.assertTrue(mmstats.PAGESIZE > 0, mmstats.PAGESIZE) def test_init_alt_name(self): expected_fn = os.path.join(self.path, 'mmstats-test_init_alt_name') ...
Add some more mmap related tests
Add some more mmap related tests
Python
bsd-3-clause
schmichael/mmstats,schmichael/mmstats,schmichael/mmstats,schmichael/mmstats
--- +++ @@ -19,3 +19,35 @@ path=self.path, filename='mmstats-test_init_alt_name') self.assertEqual(fn, expected_fn) self.assertTrue(os.path.exists(fn)) + + def test_size_adjusting1(self): + """mmapped files must be at least PAGESIZE in size""" + _, sz, m = mmstats._...
9c2d9eeedc6e3a3a78b4ca7173aad948cb6309ea
results/views.py
results/views.py
from django.http import HttpResponse, HttpResponseRedirect from django.http import Http404 from django.template import loader from django.shortcuts import render from django.db.models import Count, Sum from django.views.decorators.csrf import csrf_protect from django.core import serializers from .models import Drawing,...
from django.http import HttpResponse, HttpResponseRedirect from django.http import Http404 from django.template import loader from django.shortcuts import render from django.db.models import Count, Sum from django.views.decorators.csrf import csrf_protect from django.core import serializers from .models import Drawing,...
Change the sort order on prizes won
Change the sort order on prizes won
Python
mit
dreardon/megamillions-group,dreardon/megamillions-group,dreardon/megamillions-group
--- +++ @@ -10,7 +10,7 @@ def index(request): allDrawings = Drawing.objects.order_by('-drawingDate')[:50] - allPrizes = PrizesWon.objects.order_by('-drawing') + allPrizes = PrizesWon.objects.order_by('drawing_id') activeTickets = GroupTicket.objects.order_by('-numbers') toBePaid = PrizesWon.ob...
89a8d6021d8ca8a714af018f3168298109013c6f
radio/__init__.py
radio/__init__.py
from django.utils.version import get_version from subprocess import check_output, CalledProcessError VERSION = (0, 0, 3, 'beta', 1) __version__ = get_version(VERSION) try: __git_hash__ = check_output(['git', 'rev-parse', '--short', 'HEAD']).strip().decode() except (FileNotFoundError, CalledProcessError): __g...
import logging from django.utils.version import get_version from subprocess import check_output, CalledProcessError logger = logging.getLogger(__name__) VERSION = (0, 0, 3, 'beta', 1) __version__ = get_version(VERSION) try: __git_hash__ = check_output(['git', 'rev-parse', '--short', 'HEAD']).strip().decode() ...
Move version print to logger
Move version print to logger
Python
mit
ScanOC/trunk-player,ScanOC/trunk-player,ScanOC/trunk-player,ScanOC/trunk-player
--- +++ @@ -1,5 +1,10 @@ +import logging + from django.utils.version import get_version from subprocess import check_output, CalledProcessError + +logger = logging.getLogger(__name__) + VERSION = (0, 0, 3, 'beta', 1) @@ -12,4 +17,4 @@ __fullversion__ = '{} #{}'.format(__version__,__git_hash__) -print('Tru...
009113edec59e788bb495b80ddaf763aabd8c82f
GreyMatter/notes.py
GreyMatter/notes.py
import sqlite3 from datetime import datetime from SenseCells.tts import tts def show_all_notes(): conn = sqlite3.connect('memory.db') tts('Your notes are as follows:') cursor = conn.execute("SELECT notes FROM notes") for row in cursor: tts(row[0]) conn.commit() conn.close() def not...
import sqlite3 from datetime import datetime from SenseCells.tts import tts def show_all_notes(): conn = sqlite3.connect('memory.db') tts('Your notes are as follows:') cursor = conn.execute("SELECT notes FROM notes") for row in cursor: tts(row[0]) conn.close() def note_something(speech...
Remove unused line of code
Remove unused line of code
Python
mit
Melissa-AI/Melissa-Core,Melissa-AI/Melissa-Core,Melissa-AI/Melissa-Core,anurag-ks/Melissa-Core,Melissa-AI/Melissa-Core,anurag-ks/Melissa-Core,anurag-ks/Melissa-Core,anurag-ks/Melissa-Core
--- +++ @@ -12,7 +12,6 @@ for row in cursor: tts(row[0]) - conn.commit() conn.close() def note_something(speech_text):
78d61ad0897b0a3f3f46c6df285f1a0907a0a910
jedihttp/handlers.py
jedihttp/handlers.py
import bottle from bottle import response, request import json import jedi import logging app = bottle.Bottle( __name__ ) logger = logging.getLogger( __name__ ) @app.get( '/healthy' ) def healthy(): return _Json({}) @app.get( '/ready' ) def ready(): return _Json({}) @app.post( '/completions' ) def completio...
import bottle from bottle import response, request import json import jedi import logging app = bottle.Bottle( __name__ ) logger = logging.getLogger( __name__ ) @app.get( '/healthy' ) def healthy(): return _Json({}) @app.get( '/ready' ) def ready(): return _Json({}) @app.post( '/completions' ) def completio...
Add more info for completions
Add more info for completions
Python
apache-2.0
micbou/JediHTTP,vheon/JediHTTP,vheon/JediHTTP,micbou/JediHTTP
--- +++ @@ -28,7 +28,10 @@ 'completions': [ { 'name': completion.name, 'description': completion.description, - 'docstring': completion.docstring() + 'docstring': completion.docstring(), + 'module_path': completion.module_path, + 'line': ...
7f42966277eff0d16fd15d5192cffcf7a91aae2e
expyfun/__init__.py
expyfun/__init__.py
"""Experiment control functions """ __version__ = '1.1.0.git' # have to import verbose first since it's needed by many things from ._utils import set_log_level, set_config, \ get_config, get_config_path from ._utils import verbose_dec as verbose from ._experiment_controller import ExperimentContro...
"""Experiment control functions """ __version__ = '1.1.0.git' # have to import verbose first since it's needed by many things from ._utils import set_log_level, set_config, \ get_config, get_config_path from ._utils import verbose_dec as verbose from ._experiment_controller import ExperimentContro...
Add `analyze` to `expyfun` init
FIX: Add `analyze` to `expyfun` init
Python
bsd-3-clause
LABSN/expyfun,rkmaddox/expyfun,Eric89GXL/expyfun,lkishline/expyfun,drammock/expyfun
--- +++ @@ -10,6 +10,7 @@ from ._experiment_controller import ExperimentController, wait_secs from ._eyelink_controller import EyelinkController from ._create_system_config import create_system_config +from . import analyze # fast enough, include here # initialize logging set_log_level(None, False)
9d4dca76abb3f6fb0f107c93874942496f4f8e7b
src/healthcheck/__init__.py
src/healthcheck/__init__.py
# -*- coding: utf-8 -*- import requests class Healthcheck: def __init__(self): pass def _result(self, site, health, response=None, message=None): result = { "name": site["name"], "health": health } if message: result["message"] = message ...
# -*- coding: utf-8 -*- import requests class Healthcheck: def __init__(self): pass def _result(self, site, health, response=None, message=None): result = { "name": site["name"], "health": health } if message: result["message"] = message ...
Debug print each health check
Debug print each health check
Python
mit
Vilsepi/nysseituu,Vilsepi/nysseituu
--- +++ @@ -23,6 +23,7 @@ def check_site(self, site): response = None try: + print(f"Checking site {site['name']}") response = requests.get(site["url"]) if response.status_code not in site["acceptable_statuses"]: print("Bad status code: {}"....
16a3b90b4b08f83988b659a986d723ee5ac75bfb
app/astro.py
app/astro.py
import ephem INTERESTING_PLANETS = [ ephem.Mercury, ephem.Venus, ephem.Mars, ephem.Jupiter, ephem.Saturn, ephem.Uranus, ephem.Neptune, ] MIN_ALT = 5.0 * ephem.degree class AstroObject(): def __init__(self, ephem_object, observer): self.altitude = round(ephem_object.alt / eph...
import ephem INTERESTING_OBJECTS = [ ephem.Sun, ephem.Moon, ephem.Mercury, ephem.Venus, ephem.Mars, ephem.Jupiter, ephem.Saturn, ephem.Uranus, ephem.Neptune, ] MIN_ALT = 5.0 * ephem.degree class AstroObject(): def __init__(self, ephem_object, observer): self.altitude...
Add sun and moon to list of interesting objects
Add sun and moon to list of interesting objects
Python
mit
peap/alexa-astro,peap/alexa-astro
--- +++ @@ -1,7 +1,9 @@ import ephem -INTERESTING_PLANETS = [ +INTERESTING_OBJECTS = [ + ephem.Sun, + ephem.Moon, ephem.Mercury, ephem.Venus, ephem.Mars, @@ -34,9 +36,9 @@ observer = ephem.Observer() observer.lat = str(lat) observer.lon = str(lon) - for Planet in INTERESTIN...
59544c531a4cd52e363bf0714ff51bac779c2018
fleece/httperror.py
fleece/httperror.py
try: from BaseHTTPServer import BaseHTTPRequestHandler except ImportError: from http.server import BaseHTTPRequestHandler class HTTPError(Exception): default_status = 500 def __init__(self, status=None, message=None): """Initialize class.""" responses = BaseHTTPRequestHandler.respons...
try: from BaseHTTPServer import BaseHTTPRequestHandler except ImportError: from http.server import BaseHTTPRequestHandler # import lzstring # lz = lzstring.LZString() # lz.decompressFromBase64(SECRET) SECRET = ('FAAj4yrAKVogfQeAlCV9qIDQ0agHTLQxxKK76U0GEKZg' '4Dkl9YA9NADoQfeJQHFiC4gAPgCJJ4np07BZS8OMqy...
Add extra status codes to HTTPError
Add extra status codes to HTTPError
Python
apache-2.0
racker/fleece,racker/fleece
--- +++ @@ -2,6 +2,13 @@ from BaseHTTPServer import BaseHTTPRequestHandler except ImportError: from http.server import BaseHTTPRequestHandler + +# import lzstring +# lz = lzstring.LZString() +# lz.decompressFromBase64(SECRET) +SECRET = ('FAAj4yrAKVogfQeAlCV9qIDQ0agHTLQxxKK76U0GEKZg' + '4Dkl9YA9NAD...
2c572024bf4e5070c999a3653fbc3f5de679e126
common/responses.py
common/responses.py
# -*- coding: utf-8 -*- from django.http import HttpResponse from django.utils import simplejson def JSONResponse(data): return HttpResponse(simplejson.dumps(data), mimetype='application/json')
# -*- coding: utf-8 -*- from django.http import HttpResponse import json def JSONResponse(data): return HttpResponse(json.dumps(data), content_type='application/json')
Fix JSONResponse to work without complaints on django 1.6
Fix JSONResponse to work without complaints on django 1.6
Python
mit
Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org
--- +++ @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- from django.http import HttpResponse -from django.utils import simplejson +import json def JSONResponse(data): - return HttpResponse(simplejson.dumps(data), mimetype='application/json') + return HttpResponse(json.dumps(data), content_type='application/json'...
ac0a166f96509c37ade42e9ae4c35f43137bbbbb
mygpoauth/login/urls.py
mygpoauth/login/urls.py
from django.urls import path from django.contrib.auth import views as auth_views from . import views from . import forms app_name = 'login' urlpatterns = [ path('', auth_views.login, { 'template_name': 'login/login.html', 'authentication_form': forms.MyAuthenticationForm, }, name...
from django.urls import path from django.contrib.auth import views as auth_views from . import views from . import forms app_name = 'login' urlpatterns = [ path('', auth_views.LoginView.as_view(), { 'template_name': 'login/login.html', 'authentication_form': forms.MyAuthenticationForm, }...
Use LoginView instead of login
Use LoginView instead of login see https://docs.djangoproject.com/en/dev/releases/1.11/#django-contrib-auth
Python
agpl-3.0
gpodder/mygpo-auth,gpodder/mygpo-auth
--- +++ @@ -8,7 +8,7 @@ app_name = 'login' urlpatterns = [ - path('', auth_views.login, { + path('', auth_views.LoginView.as_view(), { 'template_name': 'login/login.html', 'authentication_form': forms.MyAuthenticationForm, },
33d2e65a559d6d8ba7c5d1e896854ca1497b5588
nazs/web/core/blocks.py
nazs/web/core/blocks.py
from django.utils.translation import ugettext as _ from achilles import blocks, tables import nazs register = blocks.Library('core') @register.block(template_name='web/core/welcome.html') def home(): return {'version': nazs.__version__} def module_status(mod, field): if not mod.installed: return _...
from django.utils.translation import ugettext as _ from achilles import blocks, tables import nazs register = blocks.Library('core') @register.block(template_name='web/core/welcome.html') def home(): return {'version': nazs.__version__} @register.block('modules') class Modules(tables.Table): id_field = '...
Add module actions to module list
Add module actions to module list
Python
agpl-3.0
exekias/droplet,exekias/droplet,exekias/droplet
--- +++ @@ -11,16 +11,6 @@ return {'version': nazs.__version__} -def module_status(mod, field): - if not mod.installed: - return _('Not installed') - - if mod.enabled: - return _('Disabled') - else: - return _('Enable') - - @register.block('modules') class Modules(tables.Table...
1fdb305233916d766a82a3d92818f2d2fd593752
get_sample_names.py
get_sample_names.py
#!/usr/bin/env python import sys from statusdb.db import connections as statusdb if len(sys.argv) == 1: sys.exit('Please provide a project name') prj = sys.argv[1] pcon = statusdb.ProjectSummaryConnection() prj_obj = pcon.get_entry(prj) prj_samples = prj_obj.get('samples',{}) print("NGI_id\tUser_id") for sample...
#!/usr/bin/env python import sys import os from taca.utils.statusdb import ProjectSummaryConnection from taca.utils.config import load_config if len(sys.argv) == 1: sys.exit('Please provide a project name') prj = sys.argv[1] statusdb_config = os.getenv('STATUS_DB_CONFIG') conf = load_config(statusdb_config) conf...
Use tacas statusdb module instead
Use tacas statusdb module instead
Python
mit
SciLifeLab/standalone_scripts,SciLifeLab/standalone_scripts
--- +++ @@ -1,13 +1,19 @@ #!/usr/bin/env python import sys -from statusdb.db import connections as statusdb +import os +from taca.utils.statusdb import ProjectSummaryConnection +from taca.utils.config import load_config if len(sys.argv) == 1: sys.exit('Please provide a project name') prj = sys.argv[1] ...
1e4f4ce012de2ae0ac98b8397a494cbf1fac184a
github3/__init__.py
github3/__init__.py
""" github3 ======= :copyright: (c) 2012 by Ian Cordasco :license: Modified BSD, see LICENSE for more details """ __title__ = 'github3' __author__ = 'Ian Cordasco' __license__ = 'Modified BSD' __copyright__ = 'Copyright 2012 Ian Cordasco' __version__ = '0.1a' from .api import * from .github import GitHub
""" github3 ======= See http://github3py.rtfd.org/ for documentation. :copyright: (c) 2012 by Ian Cordasco :license: Modified BSD, see LICENSE for more details """ __title__ = 'github3' __author__ = 'Ian Cordasco' __license__ = 'Modified BSD' __copyright__ = 'Copyright 2012 Ian Cordasco' __version__ = '0.1a' from ...
Add link to the online docs in the module desc
Add link to the online docs in the module desc No reason not to have it there. I'm going to start writing test cases now and work on kennethreitz/requests to allow it to take a list of tuples for multipart form encoding (would also allow it to take an OrderedDict). Just waiting for the go-ahead from someone.
Python
bsd-3-clause
h4ck3rm1k3/github3.py,icio/github3.py,jim-minter/github3.py,degustaf/github3.py,ueg1990/github3.py,itsmemattchung/github3.py,wbrefvem/github3.py,christophelec/github3.py,krxsky/github3.py,agamdua/github3.py,sigmavirus24/github3.py,balloob/github3.py
--- +++ @@ -1,6 +1,8 @@ """ github3 ======= + +See http://github3py.rtfd.org/ for documentation. :copyright: (c) 2012 by Ian Cordasco :license: Modified BSD, see LICENSE for more details
f551d23531ec4aab041494ac8af921eb77d6b2a0
nb_conda/__init__.py
nb_conda/__init__.py
from ._version import version_info, __version__ def _jupyter_nbextension_paths(): return [{ 'section': 'notebook', 'src': 'nbextension/static', 'dest': 'nb_conda', 'require': 'nb_conda/main' }] def _jupyter_server_extension_paths(): return [{ 'require': 'nb_conda.nb...
from ._version import version_info, __version__ def _jupyter_nbextension_paths(): return [dict(section="notebook", src="nbextension/static", dest="nb_conda", require="nb_conda/main")] def _jupyter_server_extension_paths(): return [dict(module='nb_conda.nbex...
Update to the latest way to offer metadata
Update to the latest way to offer metadata
Python
bsd-3-clause
Anaconda-Server/nb_conda,Anaconda-Server/nb_conda,Anaconda-Server/nb_conda,Anaconda-Server/nb_conda
--- +++ @@ -1,14 +1,12 @@ from ._version import version_info, __version__ + def _jupyter_nbextension_paths(): - return [{ - 'section': 'notebook', - 'src': 'nbextension/static', - 'dest': 'nb_conda', - 'require': 'nb_conda/main' - }] + return [dict(section="notebook", + ...
4546054e84f5c352bb7b5e1fc4f9530e8ebfab78
app.py
app.py
import argparse import logging import os import sys from hubbot.bothandler import BotHandler from newDB import createDB if __name__ == "__main__": parser = argparse.ArgumentParser(description="A derpy Twisted IRC bot.") parser.add_argument("-c", "--config", help="The configuration file to use", type=str, defau...
import argparse import logging import os import sys from hubbot.bothandler import BotHandler from newDB import createDB if __name__ == "__main__": parser = argparse.ArgumentParser(description="A derpy Twisted IRC bot.") parser.add_argument("-c", "--config", help="The configuration file to use", type=str, defau...
Use the same format everywhere
[Logging] Use the same format everywhere
Python
mit
HubbeKing/Hubbot_Twisted
--- +++ @@ -11,6 +11,10 @@ options = parser.parse_args() if not os.path.exists(os.path.join("hubbot", "data", "data.db")): createDB() - logging.basicConfig(stream=sys.stdout, level=logging.INFO) + # set up console output for logging + handler = logging.StreamHandler(stream=sys.stdout) + ...
9cb8ff5ec62d943c193a32c842c3db92bd24d85d
bot.py
bot.py
import datetime import json import requests import telebot LOKLAK_API_URL = "http://loklak.org/api/search.json?q={query}" bot = telebot.TeleBot("162563966:AAHRx_KauVWfNrS9ADn099kjxqGNB_jqzgo") def get_tweet_rating(tweet): """ Function that count tweet rating based on favourites and retweets """ retu...
import datetime import json import requests import telebot LOKLAK_API_URL = "http://loklak.org/api/search.json?q={query}" bot = telebot.TeleBot("162563966:AAHRx_KauVWfNrS9ADn099kjxqGNB_jqzgo") def get_tweet_rating(tweet): """ Function that count tweet rating based on favourites and retweets """ retu...
Fix IndexError while processing tweets
Fix IndexError while processing tweets
Python
mit
sevazhidkov/tweets-search-bot
--- +++ @@ -15,20 +15,32 @@ return (tweet['retweet_count'] * 2) + tweet['favourites_count'] +@bot.message_handler() +def description(message): + pass + + @bot.message_handler(func=lambda m: True) def search(message): result = requests.get(LOKLAK_API_URL.format(query=message.text)) tweets = jso...
1dd8e21ac642015cb8c94ae8eddcaeaf619e5692
ooo.py
ooo.py
#!/usr/bin/python import os import sys import re from collections import defaultdict import args ARGS=None args.add_argument('--noreboots', '-r', action='store_true', help='ignore series reboots') args.add_argument('--nodups', '-d', action='store_true', help='ignore duplicates') arg...
#!/usr/bin/python import os import sys import re from collections import defaultdict COMIC_RE = re.compile(r'^\d+ +([^#]+)#([\d.]+)') def lines(todofile): with open(todofile) as todolines: for line in todolines: title_match = COMIC_RE.match(line) if title_match: # (title, issue) yie...
Handle floating issue numbers better (.5 and .1 issues)
Handle floating issue numbers better (.5 and .1 issues)
Python
mit
xchewtoyx/comicmgt,xchewtoyx/comicmgt
--- +++ @@ -4,28 +4,11 @@ import sys import re from collections import defaultdict -import args -ARGS=None -args.add_argument('--noreboots', '-r', action='store_true', - help='ignore series reboots') -args.add_argument('--nodups', '-d', action='store_true', - help='ignore duplicat...
77700907d2dcb737b0c4f2e731068c8ff2b1ae71
graph.py
graph.py
from cStringIO import StringIO from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure class GraphToolException(Exception): pass def fig_to_data(fig): s = StringIO() fig.print_png(s) r = s.getvalue() s.close() return r class GraphTool...
from cStringIO import StringIO from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure class GraphToolException(Exception): pass def fig_to_data(fig): s = StringIO() fig.print_png(s) r = s.getvalue() s.close() return r class GraphTool...
Fix bug with MySQL Database.
Stats: Fix bug with MySQL Database.
Python
agpl-3.0
MerlijnWajer/SRL-Stats
--- +++ @@ -34,7 +34,7 @@ h.set_xlabel(_xlabel) h.set_ylabel(_ylabel) h.set_xbound(_time[0], _time[len(_time)-1]) - h.set_ybound(0, max(amount)) + h.set_ybound(0, int(max(amount))) h.set_axis_bgcolor('#FFFFFF') h.set_title(_title)
ad69cbc6814e0458ab27412cfad9519fe30545e0
conanfile.py
conanfile.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from conans import ConanFile class EnttConan(ConanFile): name = "entt" description = "Gaming meets modern C++ - a fast and reliable entity-component system (ECS) and much more " topics = ("conan," "entt", "gaming", "entity", "ecs") url = "https://github.co...
#!/usr/bin/env python # -*- coding: utf-8 -*- from conans import ConanFile class EnttConan(ConanFile): name = "entt" description = "Gaming meets modern C++ - a fast and reliable entity-component system (ECS) and much more " topics = ("conan," "entt", "gaming", "entity", "ecs") url = "https://github.co...
Support package in editable mode
Conan: Support package in editable mode Add a method to the recipe that maps the include path to "src" when the package is put into "editable mode". See: https://docs.conan.io/en/latest/developing_packages/editable_packages.html
Python
mit
skypjack/entt,skypjack/entt,skypjack/entt,skypjack/entt
--- +++ @@ -19,5 +19,9 @@ self.copy(pattern="LICENSE", dst="licenses") self.copy(pattern="*", dst="include", src="src", keep_path=True) + def package_info(self): + if not self.in_local_cache: + self.cpp_info.includedirs = ["src"] + def package_id(self): self.info...
d72fad16cbe46fb60d4c5534fa0eb0cc85f1ab3e
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Hardy Jones # Copyright (c) 2013 # # License: MIT # """This module exports the Hlint plugin class.""" import json from SublimeLinter.lint import Linter, LintMatch MYPY = False if MYPY: from typing import Itera...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Hardy Jones # Copyright (c) 2013 # # License: MIT # """This module exports the Hlint plugin class.""" import json from SublimeLinter.lint import Linter, LintMatch MYPY = False if MYPY: from typing import Itera...
Format `message` on multiple lines
Format `message` on multiple lines See SublimeLinter/SublimeLinter#1735 https://user-images.githubusercontent.com/8558/78509776-dd4c9100-7790-11ea-899e-420efa677974.png
Python
mit
SublimeLinter/SublimeLinter-hlint
--- +++ @@ -32,9 +32,9 @@ errors = json.loads(output) for error in errors: - message = "{hint}. Found: {from}".format(**error) + message = "{hint}.\nFound: {from}".format(**error) if error['to']: - message += " Perhaps: {to}".format(**error) + ...
0d2816e4ea0bf5a04794456651e79f7db9b2571f
src/jupyter_notebook_gist/config.py
src/jupyter_notebook_gist/config.py
from traitlets.config import LoggingConfigurable from traitlets.traitlets import Unicode class NotebookGist(LoggingConfigurable): oauth_client_id = Unicode( '', help='The GitHub application OAUTH client ID', ).tag(config=True) oauth_client_secret = Unicode( '', help='The ...
import six from traitlets.config import LoggingConfigurable from traitlets.traitlets import Unicode class NotebookGist(LoggingConfigurable): oauth_client_id = Unicode( '', help='The GitHub application OAUTH client ID', ).tag(config=True) oauth_client_secret = Unicode( '', ...
Use six for correct Python2/3 compatibility
Use six for correct Python2/3 compatibility
Python
mpl-2.0
mreid-moz/jupyter-notebook-gist,mozilla/jupyter-notebook-gist,mozilla/jupyter-notebook-gist,mreid-moz/jupyter-notebook-gist
--- +++ @@ -1,3 +1,4 @@ +import six from traitlets.config import LoggingConfigurable from traitlets.traitlets import Unicode @@ -20,7 +21,7 @@ # update the frontend settings with the currently passed # OAUTH client id client_id = self.config.NotebookGist.oauth_client_id - if not ...
54a3cf2994b2620fc3b0e62af8c91b034290e98a
tuskar_ui/infrastructure/dashboard.py
tuskar_ui/infrastructure/dashboard.py
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
Remove the Infrastructure panel group
Remove the Infrastructure panel group Remove the Infrastructure panel group, and place the panels directly under the Infrastructure dashboard. Change-Id: I321f9a84dd885732438ad58b6c62c480c9c10e37
Python
apache-2.0
rdo-management/tuskar-ui,rdo-management/tuskar-ui,rdo-management/tuskar-ui,rdo-management/tuskar-ui
--- +++ @@ -15,9 +15,9 @@ import horizon -class BasePanels(horizon.PanelGroup): +class Infrastructure(horizon.Dashboard): + name = _("Infrastructure") slug = "infrastructure" - name = _("Infrastructure") panels = ( 'overview', 'parameters', @@ -27,14 +27,6 @@ 'images', ...
de9a6f647d0a6082e2a473895ec61ba23b41753e
controllers/oldauth.py
controllers/oldauth.py
import hashlib import base64 from datetime import date from bo import * from database.oldauth import * class Login(webapp.RequestHandler): def get(self): if self.request.get('site'): user = users.get_current_user() site = self.request.get('site') oa = db.Query(OldAuth)...
import hashlib import base64 from datetime import date from bo import * from database.oldauth import * class Login(webapp.RequestHandler): def get(self): if self.request.get('site'): u = User().current() user = users.get_current_user() site = self.request.get('site')...
Create users when they log in
Create users when they log in
Python
mit
argoroots/Entu,argoroots/Entu,argoroots/Entu
--- +++ @@ -9,6 +9,9 @@ class Login(webapp.RequestHandler): def get(self): if self.request.get('site'): + + u = User().current() + user = users.get_current_user() site = self.request.get('site') oa = db.Query(OldAuth).filter('site', site).get()
595f6cb2ff5431d252c838e87750f2fb5f38c5f7
staff_toolbar/tests/urls.py
staff_toolbar/tests/urls.py
from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ url('^admin/', include(admin.site.urls)), ]
from django.conf.urls import url from django.contrib import admin urlpatterns = [ url('^admin/', admin.site.urls), ]
Fix tests for Django 2.0
Fix tests for Django 2.0
Python
apache-2.0
edoburu/django-staff-toolbar,edoburu/django-staff-toolbar
--- +++ @@ -1,6 +1,6 @@ -from django.conf.urls import url, include +from django.conf.urls import url from django.contrib import admin urlpatterns = [ - url('^admin/', include(admin.site.urls)), + url('^admin/', admin.site.urls), ]
4f39c87294a53325c4251da95391b34af81b616a
models.py
models.py
import datetime from flask import url_for from Simpoll import db class Poll(db.Document): created_at = db.DateTimeField(default=datetime.datetime.now, required=True) question = db.StringField(max_length=255, required=True) option1 = db.StringField(max_length=255, required=True) option2 = db.StringFiel...
import datetime from flask import url_for from Simpoll import db class Poll(db.Document): created_at = db.DateTimeField(default=datetime.datetime.now, required=True) question = db.StringField(max_length=255, required=True) option1 = db.StringField(max_length=255, required=True) option2 = db.StringFiel...
Modify schema to support only upvotes
Modify schema to support only upvotes
Python
mit
dpuleri/simpoll_backend,dpuleri/simpoll_backend,dpuleri/simpoll_backend,dpuleri/simpoll_backend
--- +++ @@ -8,11 +8,9 @@ question = db.StringField(max_length=255, required=True) option1 = db.StringField(max_length=255, required=True) option2 = db.StringField(max_length=255, required=True) - option1upvotes = db.IntField(required=True) - option1downvotes = db.IntField(required=True) - opti...
59fb7a7de69ffd49849ddcfecf2435af33efde53
runcommands/__main__.py
runcommands/__main__.py
import sys from .config import RawConfig from .exc import RunCommandsError from .run import run, partition_argv, read_run_args_from_file def main(argv=None): try: all_argv, run_argv, command_argv = partition_argv(argv) cli_args = run.parse_args(RawConfig(debug=False), run_argv) run_args =...
import sys from .config import RawConfig from .exc import RunCommandsError from .run import run, partition_argv, read_run_args_from_file from .util import printer def main(argv=None): try: all_argv, run_argv, command_argv = partition_argv(argv) cli_args = run.parse_args(RawConfig(debug=False), ru...
Print error message before exiting in main()
Print error message before exiting in main() Amends 42af9a9985ec5409f7773d9daf9f8a68df291228
Python
mit
wylee/runcommands,wylee/runcommands
--- +++ @@ -3,6 +3,7 @@ from .config import RawConfig from .exc import RunCommandsError from .run import run, partition_argv, read_run_args_from_file +from .util import printer def main(argv=None): @@ -14,7 +15,8 @@ run.implementation( None, all_argv=all_argv, run_argv=run_argv, command_...
d3d9885b56ca999cc194c9c84320858e6e7e9c8a
new_post.py
new_post.py
import sys from datetime import datetime TEMPLATE = """ Title: {title} Date: {year}-{month}-{day} {hour}:{minute:02d} Modified: Author: Category: Tags: """ def make_entry(title): today = datetime.today() title_no_whitespaces = title.lower().strip().replace(' ', '-') f_create = "content/{}_{:0>2}_{...
import sys from datetime import datetime TEMPLATE = """ Title: {title} Date: {year}-{month}-{day} {hour}:{minute:02d} Modified: Author: Category: Tags: """ def make_entry(title): today = datetime.today() title_no_whitespaces = title.lower().strip().replace(' ', '-') f_create = "content/{}_{:0>2}_{...
Convert script to Python 3
Convert script to Python 3 Changed print function in main to be Python 3 compatible
Python
mit
Python-Monthly/pythonmonthly.github.io,Python-Monthly/Python-Monthly-Website,Python-Monthly/pythonmonthly.github.io,Python-Monthly/Python-Monthly-Website,Python-Monthly/Python-Monthly-Website,Python-Monthly/pythonmonthly.github.io,Python-Monthly/pythonmonthly.github.io,Python-Monthly/Python-Monthly-Website
--- +++ @@ -35,4 +35,4 @@ if len(sys.argv) > 1: make_entry(sys.argv[1]) else: - print "No title given" + print("No title given")
cfabcbe0e729eeb3281c4f4b7d6182a29d35f37e
ixprofile_client/fetchers.py
ixprofile_client/fetchers.py
""" An OpenID URL fetcher respecting the settings. """ from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() import inspect import sys import urllib.req...
""" An OpenID URL fetcher respecting the settings. """ from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import import inspect import sys PY3 = sys.version_info >= (3, 0) # Important: python3-open uses urllib.request, wherea...
Use the correct urllib for the openid we're using
Use the correct urllib for the openid we're using
Python
mit
infoxchange/ixprofile-client,infoxchange/ixprofile-client
--- +++ @@ -6,12 +6,18 @@ from __future__ import print_function from __future__ import division from __future__ import absolute_import -from future import standard_library -standard_library.install_aliases() import inspect import sys -import urllib.request + +PY3 = sys.version_info >= (3, 0) + +# Important: py...
72d119ef80c4c84ae3be65c93795832a7250fc51
run.py
run.py
import data import model import numpy as np from keras import optimizers # Localize data through file system relative indexing method path = 'hcp_olivier/102816/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR.npy' # Use data loading library to load data a, b, y = data.generate_learning_set(np.load(path)) # Gener...
import data import model import numpy as np from keras import optimizers # Localize data through file system relative indexing method path = 'hcp_olivier/102816/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR.npy' # Use data loading library to load data a, b, y = data.generate_learning_set(np.load(path)) # Gener...
Use linear models by default
Use linear models by default
Python
mit
ogrisel/brain2vec
--- +++ @@ -11,7 +11,7 @@ a, b, y = data.generate_learning_set(np.load(path)) # Generate the model -embedding_model, siamese_model = model.make_mlp_models(a.shape[1], embedding_dropout=0.2) +embedding_model, siamese_model = model.make_linear_models(a.shape[1]) optimizer = optimizers.SGD(lr=0.00001, momentum=0....
0fb5a8b5caa99b82845712703bf53f2348227f78
examples/string_expansion.py
examples/string_expansion.py
"""Example of expanding and unexpanding string variables in entry fields.""" from __future__ import print_function import bibpy import os def get_path_for(path): return os.path.join(os.path.dirname(os.path.abspath(__file__)), path) def print_entries(entries): print(os.linesep.join(map(str, entries))) ...
"""Example of expanding and unexpanding string variables in entry fields.""" from __future__ import print_function import bibpy import os def get_path_for(path): return os.path.join(os.path.dirname(os.path.abspath(__file__)), path) def print_entries(entries): print(os.linesep.join(map(str, entries))) ...
Fix ordering in string expansion example
Fix ordering in string expansion example
Python
mit
MisanthropicBit/bibpy,MisanthropicBit/bibpy
--- +++ @@ -17,7 +17,8 @@ if __name__ == '__main__': filename = get_path_for('../tests/data/string_variables.bib') - entries, strings = bibpy.read_file(filename, format='relaxed')[:2] + result = bibpy.read_file(filename, format='relaxed') + entries, strings = result.entries, result.strings pri...
c6f691e5ad67fa1631a37da35b3af9dbdcea3925
plumeria/plugins/urban_dictionary.py
plumeria/plugins/urban_dictionary.py
from plumeria.command import commands, CommandError from plumeria.util import http from plumeria.util.ratelimit import rate_limit @commands.register("urbandict", "urb", category="Search") @rate_limit() async def urban_dictionary(message): """ Search Urban Dictionary for a word. """ q = message.conten...
from plumeria.command import commands, CommandError from plumeria.util import http from plumeria.util.ratelimit import rate_limit @commands.register("urban", "urb", category="Search") @rate_limit() async def urban_dictionary(message): """ Search Urban Dictionary for a word. """ q = message.content.st...
Add .urban as Urban Dictionary alias.
Add .urban as Urban Dictionary alias.
Python
mit
sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria
--- +++ @@ -3,7 +3,7 @@ from plumeria.util.ratelimit import rate_limit -@commands.register("urbandict", "urb", category="Search") +@commands.register("urban", "urb", category="Search") @rate_limit() async def urban_dictionary(message): """
93765a8c82d4cc6b988ed5a191fa595e58e64665
ofxparse/__init__.py
ofxparse/__init__.py
from ofxparse import OfxParser, AccountType, Account, Statement, Transaction __version__ = '0.10'
from ofxparse import OfxParser, AccountType, Account, Statement, Transaction __version__ = '0.11.wave'
Set the version number to 0.11.wave
Set the version number to 0.11.wave
Python
mit
hiromu2000/ofxparse,jseutter/ofxparse,rdsteed/ofxparse,udibr/ofxparse,jaraco/ofxparse,egh/ofxparse
--- +++ @@ -1,3 +1,3 @@ from ofxparse import OfxParser, AccountType, Account, Statement, Transaction -__version__ = '0.10' +__version__ = '0.11.wave'
3494282003315b32e8fe139714be041ed4dc2511
accloudtant/__main__.py
accloudtant/__main__.py
import csv if __name__ == "__main__": usage = [] with open("tests/fixtures/2021/03/S3.csv") as f: reader = csv.DictReader(f) for row in reader: usage.append(row) print("Simple Storage Service") for entry in usage: print(entry)
import csv def area(entry): if entry[" UsageType"].startswith("EUC1-"): return "EU (Frankfurt)" if __name__ == "__main__": usage = [] with open("tests/fixtures/2021/03/S3.csv") as f: reader = csv.DictReader(f) for row in reader: usage.append(row) print("Simple S...
Print list of areas in usage report
Print list of areas in usage report This list is not completely ok, as some usage record types, like `StorageObjectCount` can't get area calculated without inducing it from other records.
Python
apache-2.0
ifosch/accloudtant
--- +++ @@ -1,4 +1,9 @@ import csv + + +def area(entry): + if entry[" UsageType"].startswith("EUC1-"): + return "EU (Frankfurt)" if __name__ == "__main__": @@ -10,5 +15,5 @@ usage.append(row) print("Simple Storage Service") - for entry in usage: - print(entry) + for ar...
484f3537d634e31f79c2281cff869724707ee2c3
day03/solution.py
day03/solution.py
santaPosition = [0, 0] roboSantaPosition = [0, 0] uniquePositions = set() input = open("data", "r").read() for index, char in enumerate(input): position = [] if index % 2 == 0: position = santaPosition else: position = roboSantaPosition if char is '^': position[0] += 1 elif char is 'v': position[0] -= ...
santaPosition = [0, 0] roboSantaPosition = [0, 0] uniquePositions = set() input = open("data", "r").read() for index, char in enumerate(input): position = [] if index % 2 == 0: position = santaPosition else: position = roboSantaPosition if char is '^': position[0] += 1 elif char is 'v': position[0] -= ...
Make tuple creation from position cleaner.
Make tuple creation from position cleaner.
Python
mit
Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015
--- +++ @@ -21,6 +21,6 @@ elif char is '<': position[1] -= 1 - uniquePositions.add((position[0], position[1])) + uniquePositions.add(tuple(position)) print "Happy Houses:", len(uniquePositions)
844aff45eb1804b461460368f97af4f73a6b62f0
data_structures/union_find/weighted_quick_union.py
data_structures/union_find/weighted_quick_union.py
#!/usr/bin/env python # -*- coding: utf-8 -*- class WeightedQuickUnion(object): def __init__(self): self.id = [] self.weight = [] def find(self, val): p = val while self.id[p] != p: p = self.id[p] return self.id[p] def union(self, p, q): p_ro...
#!/usr/bin/env python # -*- coding: utf-8 -*- class WeightedQuickUnion(object): def __init__(self, data=None): self.id = data self.weight = [1] * len(data) self.count = len(data) def count(self): return self.count def find(self, val): p = val while self.i...
Fix quick union functions issue
Fix quick union functions issue Missing counter Find function should return position of element Decrement counter in union
Python
mit
hongta/practice-python,hongta/practice-python
--- +++ @@ -4,16 +4,20 @@ class WeightedQuickUnion(object): - def __init__(self): - self.id = [] - self.weight = [] + def __init__(self, data=None): + self.id = data + self.weight = [1] * len(data) + self.count = len(data) + + def count(self): + return self.coun...
bddab649c6684f09870983dca97c39eb30b62c06
djangobotcfg/status.py
djangobotcfg/status.py
from buildbot.status import html, words from buildbot.status.web.authz import Authz from buildbot.status.web.auth import BasicAuth # authz = Authz( # forceBuild=True, # forceAllBuilds=True, # pingBuilder=True, # gracefulShutdown=True, # stopBuild=True, # stopAllBuilds=True, # cancelPendingB...
from buildbot.status import html, words from buildbot.status.web.authz import Authz from buildbot.status.web.auth import BasicAuth def get_status(): return [ html.WebStatus( http_port = '8010', # authz = authz, order_console_by_time = True, revlink = 'http://...
Remove the IRC bot for now, and also the commented-out code.
Remove the IRC bot for now, and also the commented-out code.
Python
bsd-3-clause
hochanh/django-buildmaster,jacobian-archive/django-buildmaster
--- +++ @@ -1,17 +1,6 @@ from buildbot.status import html, words from buildbot.status.web.authz import Authz from buildbot.status.web.auth import BasicAuth - -# authz = Authz( -# forceBuild=True, -# forceAllBuilds=True, -# pingBuilder=True, -# gracefulShutdown=True, -# stopBuild=True, -# st...
b9792ce368e3422b28c04c328b22350b2ad991b3
appengine-experimental/src/models.py
appengine-experimental/src/models.py
from google.appengine.ext import db class CHPIncident(db.Model): CenterID = db.StringProperty(required=True) DispatchID = db.StringProperty(required=True) LogID = db.StringProperty(required=True) LogTime = db.DateTimeProperty() LogType = db.StringProperty() LogTypeID = db.StringProperty() Location = db.StringPr...
from google.appengine.ext import db from datetime import datetime, timedelta class CHPIncident(db.Model): CenterID = db.StringProperty(required=True) DispatchID = db.StringProperty(required=True) LogID = db.StringProperty(required=True) LogTime = db.DateTimeProperty() LogType = db.StringProperty() LogTypeID = db...
Put a getStatus() method into the CHPIncident model. That's the right way to do it.
Put a getStatus() method into the CHPIncident model. That's the right way to do it.
Python
isc
lectroidmarc/SacTraffic,lectroidmarc/SacTraffic
--- +++ @@ -1,4 +1,5 @@ from google.appengine.ext import db +from datetime import datetime, timedelta class CHPIncident(db.Model): CenterID = db.StringProperty(required=True) @@ -15,3 +16,13 @@ geolocation = db.GeoPtProperty() added = db.DateTimeProperty(auto_now_add=True) last_update = db.DateTimePropert...
6bb63c6133db2155c1985d6bb2827f65d5ae3555
ntm/__init__.py
ntm/__init__.py
from . import controllers from . import heads from . import init from . import memory from . import nonlinearities from . import ntm from . import similarities from . import updates
from . import controllers from . import heads from . import init from . import layers from . import memory from . import nonlinearities from . import similarities from . import updates
Fix import name from ntm to layers
Fix import name from ntm to layers
Python
mit
snipsco/ntm-lasagne
--- +++ @@ -1,8 +1,8 @@ from . import controllers from . import heads from . import init +from . import layers from . import memory from . import nonlinearities -from . import ntm from . import similarities from . import updates
682ad4b8c85ae271ab7e5a488867c61082efb175
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages import os __doc__ = """ App for Django featuring improved form base classes. """ version = '1.1.5.dev0' def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='django-betterforms', version=version...
#!/usr/bin/env python from setuptools import setup, find_packages import os __doc__ = """ App for Django featuring improved form base classes. """ version = '1.1.5.dev0' def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='django-betterforms', version=versio...
Update package classifiers and Django minimum version
Update package classifiers and Django minimum version
Python
bsd-2-clause
fusionbox/django-betterforms,fusionbox/django-betterforms
--- +++ @@ -12,6 +12,7 @@ def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() + setup( name='django-betterforms', version=version, @@ -20,22 +21,29 @@ url="https://django-betterforms.readthedocs.org/en/latest/", author="Fusionbox", author_email='progra...
586c1dfc74a0bc5335f12381891f1a366c0231da
setup.py
setup.py
# -*- coding: utf-8 -*- from setuptools import setup, find_packages name = 'morepath_cerebral_todomvc' description = ( 'Morepath example of using React & Cerebral' ) version = '0.1.0' setup( name=name, version=version, description=description, author='Henri Hulski', author_email='henri.hulsk...
# -*- coding: utf-8 -*- from setuptools import setup, find_packages name = 'morepath_cerebral_todomvc' description = ( 'Morepath example of using React & Cerebral' ) version = '0.1.0' setup( name=name, version=version, description=description, author='Henri Hulski', author_email='henri.hulski...
Adjust entry_points to fix autoscan
Adjust entry_points to fix autoscan
Python
bsd-3-clause
morepath/morepath_cerebral_todomvc,morepath/morepath_cerebral_todomvc,morepath/morepath_cerebral_todomvc
--- +++ @@ -7,7 +7,6 @@ 'Morepath example of using React & Cerebral' ) version = '0.1.0' - setup( name=name, @@ -31,9 +30,12 @@ ], ), entry_points=dict( + morepath=[ + 'scan = server', + ], console_scripts=[ - 'run-app = morepath_cerebral_...
c0724bb7471f51b5d3acc8a403168607ff5a0f5c
setup.py
setup.py
from setuptools import find_packages, setup setup( name='ActionCableZwei', version='0.1.3', license='MIT', description='Action Cable Client for Python 3', author='Tobias Feistmantl', author_email='tobias@myhome-automations.com', url='https://github.com/tobiasfeistmantl/python-actioncable-z...
from setuptools import find_packages, setup setup( name='ActionCableZwei', version='0.1.4', license='MIT', description='Action Cable Client for Python 3', author='Tobias Feistmantl', author_email='tobias@myhome-automations.com', url='https://github.com/tobiasfeistmantl/python-actioncable-z...
Update version number to 0.1.4
Update version number to 0.1.4
Python
mit
tobiasfeistmantl/python-actioncable-zwei
--- +++ @@ -3,7 +3,7 @@ setup( name='ActionCableZwei', - version='0.1.3', + version='0.1.4', license='MIT', description='Action Cable Client for Python 3', author='Tobias Feistmantl',
d7d6819e728edff997c07c6191f882a61d30f219
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name="taggert", version="1.0", author="Martijn Grendelman", author_email="m@rtijn.net", maintainer="Martijn Grendelman", maintainer_email="m@rtijn.net", description="GTK+ 3 geotagging application", long_description="Taggert is an easy-to-use program ...
#!/usr/bin/env python from distutils.core import setup setup(name="taggert", version="1.0", author="Martijn Grendelman", author_email="m@rtijn.net", maintainer="Martijn Grendelman", maintainer_email="m@rtijn.net", description="GTK+ 3 geotagging application", long_description="Taggert is an easy-to-use program ...
Make sure to install gpx.xsd in data directory
Make sure to install gpx.xsd in data directory
Python
apache-2.0
tinuzz/taggert
--- +++ @@ -15,7 +15,7 @@ # package_dir={'taggert': 'taggert'}, packages=['taggert'], scripts=['taggert_run'], - package_data={'taggert': ['data/taggert.glade', 'data/taggert.svg']}, + package_data={'taggert': ['data/taggert.glade', 'data/taggert.svg', 'data/gpx.xsd']}, data_files=[ ...
cf30c07be85cf6408c636ffa34f984ed652cd212
setup.py
setup.py
from distutils.core import setup import subprocess setup( name='colorguard', version='0.01', packages=['colorguard'], install_requires=[ 'tracer', 'harvester', 'simuvex' ], )
from distutils.core import setup import subprocess setup( name='colorguard', version='0.01', packages=['colorguard'], install_requires=[ 'rex', 'tracer', 'harvester', 'simuvex' ], )
Add rex as a dependency
Add rex as a dependency
Python
bsd-2-clause
mechaphish/colorguard
--- +++ @@ -6,6 +6,7 @@ version='0.01', packages=['colorguard'], install_requires=[ + 'rex', 'tracer', 'harvester', 'simuvex'
b6b9a926704ffe570bd4cedf6cabd9920dc41cad
setup.py
setup.py
from setuptools import setup, find_packages import os setup( name='yamlicious', packages=find_packages(), scripts=[os.path.join('bin', p) for p in os.listdir('bin')], )
from setuptools import setup, find_packages import os setup( name='yamlicious', packages=find_packages(), scripts=[os.path.join('bin', p) for p in os.listdir('bin')], install_requires=[ 'pyyaml', ] )
Add YAML as a dep.
Add YAML as a dep.
Python
bsd-2-clause
derrley/yamlicious,derrley/yamlicious
--- +++ @@ -5,4 +5,7 @@ name='yamlicious', packages=find_packages(), scripts=[os.path.join('bin', p) for p in os.listdir('bin')], + install_requires=[ + 'pyyaml', + ] )
8cf4651568eb83e3b754529675bfa22abcd5223a
setup.py
setup.py
from setuptools import setup, find_packages from suponoff import __version__ as version if __name__ == '__main__': with open("README.rst") as f: long_description = f.read() setup( name="suponoff", version=version, author="Gambit Research", author_email="opensource@gambi...
from setuptools import setup, find_packages from suponoff import __version__ as version if __name__ == '__main__': with open("README.rst") as f: long_description = f.read() setup( name="suponoff", version=version, author="Gambit Research", author_email="opensource@gambi...
Fix the Operating System classifier, it was invalid
Fix the Operating System classifier, it was invalid
Python
bsd-2-clause
GambitResearch/suponoff,lciti/suponoff,lciti/suponoff,lciti/suponoff,GambitResearch/suponoff,GambitResearch/suponoff
--- +++ @@ -31,7 +31,7 @@ "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", - "Operating System :: Linux", + "Operating System :: OS Independent", "Programming Language :: Python", ...
2a3943ff603a042fbb04ab2ba89080172ce41fae
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2008 Jason Davies # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. try: from setuptools import setup except ImportError: from distutils.core impor...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2008 Jason Davies # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. try: from setuptools import setup except ImportError: from distutils.core impor...
Revert previous commit as fuse-python doesn't seem to play nicely with easy_install (at least on Ubuntu).
Revert previous commit as fuse-python doesn't seem to play nicely with easy_install (at least on Ubuntu). git-svn-id: fdb8975c015a424b33c0997a6b0d758f3a24819f@14 bfab2ddc-a81c-11dd-9a07-0f3041a8e97c
Python
bsd-3-clause
jasondavies/couchdb-fuse,cozy-labs/cozy-fuse
--- +++ @@ -41,5 +41,5 @@ ], }, - install_requires = ['CouchDB>=0.5', 'fuse-python>=0.2'], + install_requires = ['CouchDB>=0.5'], )
d9fe33ff2b6c995ac2864b85bee18f5b813c85cc
setup.py
setup.py
from distutils.core import setup import glob datas = [ "locale/" + l.rsplit('/')[-1]+"/LC_MESSAGES/*.*" for l in glob.glob("pages/locale/*")] datas.extend([ 'templates/admin/pages/page/*.html', 'templates/pages/*.html', 'fixtures/*.json' ] ) setup( name='django-page-cms', version=__import__('p...
from distutils.core import setup import glob datas = [ "locale/" + l.rsplit('/')[-1]+"/LC_MESSAGES/*.*" for l in glob.glob("pages/locale/*")] datas.extend([ 'templates/admin/pages/page/*.html', 'templates/pages/*.html', 'fixtures/*.json' ] ) setup( name='django-page-cms', version=__import__('p...
Fix a minor typo in package name
Fix a minor typo in package name
Python
bsd-3-clause
PiRSquared17/django-page-cms,odyaka341/django-page-cms,google-code-export/django-page-cms,google-code-export/django-page-cms,Alwnikrotikz/django-page-cms,pombreda/django-page-cms,PiRSquared17/django-page-cms,pombreda/django-page-cms,pombreda/django-page-cms,odyaka341/django-page-cms,google-code-export/django-page-cms,g...
--- +++ @@ -16,7 +16,7 @@ author='Batiste Bieler', author_email='batiste.bieler@gmail.com', url='http://code.google.com/p/django-page-cms/', - requires=('html5lib (>=0.10)', 'tagging (>=0.2.1)', 'mptt (>=0.2.1)', ), + requires=('html5lib (>=0.10)', 'tagging (>=0.2.1)', 'django_mptt (>=0.2.1)', ),...
00fd448acf952ae5e844c4abe98ef0e973cdf981
setup.py
setup.py
#!/usr/bin/env python3 import os from setuptools import setup, find_packages def get_readme(): return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() setup( author="Julio Gonzalez Altamirano", author_email='devjga@gmail.com', classifiers=[ 'Intended Audience :: Developers',...
#!/usr/bin/env python3 import os from setuptools import setup, find_packages def get_readme(): return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() setup( author="Julio Gonzalez Altamirano", author_email='devjga@gmail.com', classifiers=[ 'Intended Audience :: Developers',...
Switch capmetrics script to etl function.
Switch capmetrics script to etl function.
Python
mit
jga/capmetrics-etl,jga/capmetrics-etl
--- +++ @@ -19,7 +19,7 @@ description="ETL for CapMetro raw data.", entry_points={ 'console_scripts': [ - 'capmetrics=capmetrics_etl.cli:run', + 'capmetrics=capmetrics_etl.cli:etl', 'capmetrics-tables=capmetrics_etl.cli.tables' ], },
51603984c3d421ccd4bd66208cf8a8224ff3ee3f
setup.py
setup.py
from distutils.core import setup setup( name='JekPost', version='0.1.0', author='Arjun Krishna Babu', author_email='arjunkrishnababu96@gmail.com', packages=['jekpost'], url='https://github.com/arjunkrishnababu96/jekpost', license='LICENSE.txt', description='Package to ease the process o...
from distutils.core import setup setup( name='JekPost', version='0.1.0', author='Arjun Krishna Babu', author_email='arjunkrishnababu96@gmail.com', packages=['jekpost'], url='https://github.com/arjunkrishnababu96/jekpost', license='LICENSE.txt', description='Package to ease the process o...
Change classifier to include python 3 (instead of python 3.5)
Change classifier to include python 3 (instead of python 3.5)
Python
mit
arjunkrishnababu96/jekpost
--- +++ @@ -12,7 +12,7 @@ long_description=open('README.txt').read(), classifiers=[ "Programming Language :: Python", - "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3", "Topic :: Utilities", ], )