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 |
|---|---|---|---|---|---|---|---|---|---|---|
ca4be3892ec0c1b5bc337a9fae10503b5f7f765a | bika/lims/browser/validation.py | bika/lims/browser/validation.py | from Products.Archetypes.browser.validation import InlineValidationView as _IVV
from Acquisition import aq_inner
from Products.CMFCore.utils import getToolByName
import json
SKIP_VALIDATION_FIELDTYPES = ('image', 'file', 'datetime', 'reference')
class InlineValidationView(_IVV):
def __call__(self, uid, fname, v... | from Products.Archetypes.browser.validation import InlineValidationView as _IVV
from Acquisition import aq_inner
from Products.CMFCore.utils import getToolByName
import json
SKIP_VALIDATION_FIELDTYPES = ('image', 'file', 'datetime', 'reference')
class InlineValidationView(_IVV):
def __call__(self, uid, fname, v... | Revert "Inline Validation fails silently if request is malformed" | Revert "Inline Validation fails silently if request is malformed"
This reverts commit 723e4eb603568d3a60190d8d292cc335a74b79d5.
| Python | agpl-3.0 | labsanmartin/Bika-LIMS,veroc/Bika-LIMS,veroc/Bika-LIMS,rockfruit/bika.lims,veroc/Bika-LIMS,labsanmartin/Bika-LIMS,anneline/Bika-LIMS,DeBortoliWines/Bika-LIMS,DeBortoliWines/Bika-LIMS,anneline/Bika-LIMS,DeBortoliWines/Bika-LIMS,anneline/Bika-LIMS,rockfruit/bika.lims,labsanmartin/Bika-LIMS | ---
+++
@@ -13,9 +13,6 @@
'''
res = {'errmsg': ''}
- if value not in self.request:
- return json.dumps(res)
-
rc = getToolByName(aq_inner(self.context), 'reference_catalog')
instance = rc.lookupObject(uid)
# make sure this works for portal_factory items |
fb58117527c486401d07e046077151d3217e576f | python/copy-market-report.py | python/copy-market-report.py | import yaml
from time import gmtime, strftime
from shutil import copy
with open('../config/betfair_config.yml', 'r') as f:
doc = yaml.load(f)
data_dir = doc['default']['betfair']['data_dir']
todays_date = strftime('%Y-%-m-%d', gmtime())
src='/tmp/market-report.pdf'
dest=data_dir + '/data/' + todays_date + '/mark... | import yaml
from time import gmtime, strftime
from shutil import copy
with open('../config/betfair_config.yml', 'r') as f:
doc = yaml.load(f)
data_dir = doc['default']['betfair']['data_dir']
todays_date = strftime('%Y-%-m-%-d', gmtime())
src='/tmp/market-report.pdf'
dest=data_dir + '/data/' + todays_date + '/mar... | Fix bug reading filenames for days with 1 number | Fix bug reading filenames for days with 1 number
| Python | apache-2.0 | cranburyattic/bf-app,cranburyattic/bf-app,cranburyattic/bf-app,cranburyattic/bf-app | ---
+++
@@ -6,7 +6,7 @@
doc = yaml.load(f)
data_dir = doc['default']['betfair']['data_dir']
-todays_date = strftime('%Y-%-m-%d', gmtime())
+todays_date = strftime('%Y-%-m-%-d', gmtime())
src='/tmp/market-report.pdf'
dest=data_dir + '/data/' + todays_date + '/market-report.pdf' |
6949339cda8c60b74341f854d9a00aa8abbfe4d5 | test/level_sets_measure_test.py | test/level_sets_measure_test.py | __author__ = 'intsco'
import cPickle
from engine.pyIMS.image_measures.level_sets_measure import measure_of_chaos_dict
from unittest import TestCase
import unittest
from os.path import join, realpath, dirname
class MeasureOfChaosDictTest(TestCase):
def setUp(self):
self.rows, self.cols = 65, 65
s... | import unittest
import numpy as np
from ..image_measures.level_sets_measure import measure_of_chaos, _nan_to_zero
class MeasureOfChaosTest(unittest.TestCase):
def test__nan_to_zero_with_ge_zero(self):
ids = (
np.zeros(1),
np.ones(range(1, 10)),
np.arange(1024 * 1024)
... | Implement first tests for _nan_to_zero | Implement first tests for _nan_to_zero
- Remove outdated dict test class
- write some test methods
| Python | apache-2.0 | andy-d-palmer/pyIMS,alexandrovteam/pyImagingMSpec | ---
+++
@@ -1,36 +1,32 @@
-__author__ = 'intsco'
+import unittest
-import cPickle
-from engine.pyIMS.image_measures.level_sets_measure import measure_of_chaos_dict
-from unittest import TestCase
-import unittest
-from os.path import join, realpath, dirname
+import numpy as np
+
+from ..image_measures.level_sets_mea... |
12f4b26d98c3ba765a11efeca3b646b5e9d0a0fb | running.py | running.py | import tcxparser
from configparser import ConfigParser
from datetime import datetime
import urllib.request
import dateutil.parser
t = '1984-06-02T19:05:00.000Z'
# Darksky weather API
# Create config file manually
parser = ConfigParser()
parser.read('slowburn.config', encoding='utf-8')
darksky_key = parser.get('darksky... | import tcxparser
from configparser import ConfigParser
from datetime import datetime
import urllib.request
import dateutil.parser
t = '1984-06-02T19:05:00.000Z'
# Darksky weather API
# Create config file manually
parser = ConfigParser()
parser.read('slowburn.config', encoding='utf-8')
darksky_key = parser.get('darksky... | Use TCX coordinates to fetch local weather | Use TCX coordinates to fetch local weather
| Python | mit | briansuhr/slowburn | ---
+++
@@ -20,9 +20,8 @@
return time_in_unix
unix_run_time = convert_time_to_unix(run_time)
-darksky_request = urllib.request.urlopen("https://api.darksky.net/forecast/" + darksky_key + "/42.3601,-71.0589," + unix_run_time + "?exclude=currently,flags").read()
+darksky_request = urllib.request.urlopen("https:... |
5a7b13e26e94d03bc92600d9c24b3b2e8bc4321c | dstar_lib/aprsis.py | dstar_lib/aprsis.py | import aprslib
import logging
import nmea
class AprsIS:
logger = None
def __init__(self, callsign, password):
self.logger = logging.getLogger(__name__)
self.aprs_connection = aprslib.IS(callsign, password)
self.aprs_connection.connect()
def send_beacon(self, callsign, sfx, message, gpgga):
position = nm... | import aprslib
import logging
import nmea
class AprsIS:
logger = None
def __init__(self, callsign, password):
self.logger = logging.getLogger(__name__)
self.aprs_connection = aprslib.IS(callsign, password)
self.aprs_connection.connect()
def send_beacon(self, callsign, sfx, message, gpgga):
position = nm... | Fix an issue with the new aprslib | Fix an issue with the new aprslib
| Python | mit | elielsardanons/dstar_sniffer,elielsardanons/dstar_sniffer | ---
+++
@@ -17,6 +17,7 @@
aprs_frame = callsign+'>APK'+sfx+',DSTAR*:!'+position['lat'] + position['lat_coord'] + '\\'+position['long']+position['long_coord']+'a/A=' + position['height'] + message
self.logger.info("Sending APRS Frame: " + aprs_frame)
try:
- self.aprs_connection.sendall(aprs.Frame(aprs_frame... |
132b148ca8701ee867b7a08432a3595a213ce470 | cedexis/radar/tests/test_cli.py | cedexis/radar/tests/test_cli.py | import unittest
import types
import cedexis.radar.cli
class TestCommandLineInterface(unittest.TestCase):
def test_main(self):
self.assertTrue(isinstance(cedexis.radar.cli.main, types.FunctionType))
| import unittest
from unittest.mock import patch, MagicMock, call
import types
from pprint import pprint
import cedexis.radar.cli
class TestCommandLineInterface(unittest.TestCase):
def test_main(self):
self.assertTrue(isinstance(cedexis.radar.cli.main, types.FunctionType))
@patch('logging.getLogger')... | Add unit test for overrides | Add unit test for overrides
| Python | mit | cedexis/cedexis.radar | ---
+++
@@ -1,5 +1,7 @@
import unittest
+from unittest.mock import patch, MagicMock, call
import types
+from pprint import pprint
import cedexis.radar.cli
@@ -7,3 +9,44 @@
def test_main(self):
self.assertTrue(isinstance(cedexis.radar.cli.main, types.FunctionType))
+
+ @patch('logging.getLogg... |
70f167d3d5a7540fb3521b82ec70bf7c6db09a99 | tests/test_contrib.py | tests/test_contrib.py | from __future__ import print_function
import cooler.contrib.higlass as cch
import h5py
import os.path as op
testdir = op.realpath(op.dirname(__file__))
def test_data_retrieval():
data_file = op.join(testdir, 'data', 'dixon2012-h1hesc-hindiii-allreps-filtered.1000kb.multires.cool')
f = h5py.File(data_fil... | from __future__ import print_function
import cooler.contrib.higlass as cch
import cooler.contrib.recursive_agg_onefile as ra
import h5py
import os.path as op
testdir = op.realpath(op.dirname(__file__))
def test_data_retrieval():
data_file = op.join(testdir, 'data', 'dixon2012-h1hesc-hindiii-allreps-filtered.1000... | Add test for recursive agg | Add test for recursive agg
| Python | bsd-3-clause | mirnylab/cooler | ---
+++
@@ -1,6 +1,7 @@
from __future__ import print_function
import cooler.contrib.higlass as cch
+import cooler.contrib.recursive_agg_onefile as ra
import h5py
import os.path as op
@@ -21,3 +22,13 @@
assert(data['genome_start1'].iloc[-1] > 255000000)
assert(data['genome_start1'].iloc[-1] < 2560000... |
27a0165d45f52114ebb65d59cf8e4f84f3232881 | tests/test_lattice.py | tests/test_lattice.py | import rml.lattice
def test_create_lattice():
l = rml.lattice.Lattice()
assert(len(l)) == 0
def test_non_negative_lattice():
l = rml.lattice.Lattice()
assert(len(l)) >= 0
| import rml.lattice
import rml.element
def test_create_lattice():
l = rml.lattice.Lattice()
assert(len(l)) == 0
def test_non_negative_lattice():
l = rml.lattice.Lattice()
assert(len(l)) >= 0
def test_lattice_with_one_element():
l = rml.lattice.Lattice()
element_length = 1.5
e = rml.eleme... | Test simple lattice with one element. | Test simple lattice with one element.
| Python | apache-2.0 | willrogers/pml,willrogers/pml,razvanvasile/RML | ---
+++
@@ -1,9 +1,23 @@
import rml.lattice
+import rml.element
def test_create_lattice():
l = rml.lattice.Lattice()
assert(len(l)) == 0
+
def test_non_negative_lattice():
l = rml.lattice.Lattice()
assert(len(l)) >= 0
+
+
+def test_lattice_with_one_element():
+ l = rml.lattice.Lattice()
... |
7591189527ad05be62a561afadf70b217d725b1f | scrapi/processing/osf/__init__.py | scrapi/processing/osf/__init__.py | from scrapi.processing.osf import crud
from scrapi.processing.osf import collision
from scrapi.processing.base import BaseProcessor
class OSFProcessor(BaseProcessor):
NAME = 'osf'
def process_normalized(self, raw_doc, normalized):
if crud.is_event(normalized):
crud.create_event(normalized... | from scrapi.processing.osf import crud
from scrapi.processing.osf import collision
from scrapi.processing.base import BaseProcessor
class OSFProcessor(BaseProcessor):
NAME = 'osf'
def process_normalized(self, raw_doc, normalized):
if crud.is_event(normalized):
crud.create_event(normalized... | Make sure to keep certain report fields out of resources | Make sure to keep certain report fields out of resources
| Python | apache-2.0 | alexgarciac/scrapi,erinspace/scrapi,icereval/scrapi,mehanig/scrapi,felliott/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,mehanig/scrapi,ostwald/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,jeffreyliu3230/scrapi | ---
+++
@@ -11,18 +11,23 @@
crud.create_event(normalized)
return
- report_hash = collision.generate_report_hash_list(normalized)
- resource_hash = collision.generate_resource_hash_list(normalized)
+ normalized['collisionCategory'] = crud.get_collision_cat(normalized['s... |
3fe86c259e6015ca535510bd692cc26d5d4e64cc | bin/license_finder_pip.py | bin/license_finder_pip.py | #!/usr/bin/env python
import json
from pip.req import parse_requirements
from pip.download import PipSession
from pip._vendor import pkg_resources
from pip._vendor.six import print_
requirements = [pkg_resources.Requirement(str(req.req)) for req
in parse_requirements('requirements.txt', session=PipSes... | #!/usr/bin/env python
import json
from pip.req import parse_requirements
from pip.download import PipSession
from pip._vendor import pkg_resources
from pip._vendor.six import print_
requirements = [pkg_resources.Requirement.parse(str(req.req)) for req
in parse_requirements('requirements.txt', session=... | Use parse() method to instantiate Requirement | Use parse() method to instantiate Requirement
[Fix #224]
Signed-off-by: Tony Wong <3261da024e85c36767bb9324ced93ba4333a2c77@pivotal.io>
| Python | mit | bspeck/LicenseFinder,sschuberth/LicenseFinder,bdshroyer/LicenseFinder,bdshroyer/LicenseFinder,bspeck/LicenseFinder,bdshroyer/LicenseFinder,tinfoil/LicenseFinder,tinfoil/LicenseFinder,bspeck/LicenseFinder,pivotal/LicenseFinder,bdshroyer/LicenseFinder,bspeck/LicenseFinder,sschuberth/LicenseFinder,bspeck/LicenseFinder,piv... | ---
+++
@@ -6,7 +6,7 @@
from pip._vendor import pkg_resources
from pip._vendor.six import print_
-requirements = [pkg_resources.Requirement(str(req.req)) for req
+requirements = [pkg_resources.Requirement.parse(str(req.req)) for req
in parse_requirements('requirements.txt', session=PipSession())]... |
166e0980fc20b507763395297e8a67c7dcb3a3da | examples/neural_network_inference/onnx_converter/small_example.py | examples/neural_network_inference/onnx_converter/small_example.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from onnx_coreml import convert
# Step 0 - (a) Define ML Model
class small_model(nn.Module):
def __init__(self):
super(small_model, self).__init__()
self.fc1 = nn.Linear(768, 256)
self.fc2 = nn.Linear(256, 10)
def forwa... | import torch
import torch.nn as nn
import torch.nn.functional as F
from onnx_coreml import convert
# Step 0 - (a) Define ML Model
class small_model(nn.Module):
def __init__(self):
super(small_model, self).__init__()
self.fc1 = nn.Linear(768, 256)
self.fc2 = nn.Linear(256, 10)
def forwa... | Update the example with latest interface | Update the example with latest interface
Update the example with the latest interface of the function "convert" | Python | bsd-3-clause | apple/coremltools,apple/coremltools,apple/coremltools,apple/coremltools | ---
+++
@@ -23,6 +23,6 @@
torch.onnx.export(model, dummy_input, './small_model.onnx')
# Step 2 - ONNX to CoreML model
-mlmodel = convert(model='./small_model.onnx', target_ios='13')
+mlmodel = convert(model='./small_model.onnx', minimum_ios_deployment_target='13')
# Save converted CoreML model
mlmodel.save('sma... |
967ea6b083437cbe6c87b173567981e1ae41fefc | project/wsgi/tomodev.py | project/wsgi/tomodev.py | """
WSGI config for project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.... | """
WSGI config for project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.... | Set Python path inside WSGI application | Set Python path inside WSGI application | Python | agpl-3.0 | ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo | ---
+++
@@ -14,8 +14,13 @@
"""
import os
+import site
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings.tomodev")
+
+base_path = os.path.abspath("../..")
+site.addsitedir(base_path)
+site.addsitedir(os.path.join(base_path, 'virtualenv/lib/python2.6/site-packages'))
# This application object ... |
2198ae847cb257d210c043bb08d52206df749a24 | Jeeves/jeeves.py | Jeeves/jeeves.py | import discord
import asyncio
import random
import configparser
import json
def RunBot(config_file):
config = configparser.ConfigParser()
config.read(config_file)
client = discord.Client()
@client.event
async def on_ready():
print('------')
print('Logged in as %s (%s)' % (client.u... | import discord
import asyncio
import random
import configparser
import json
def RunBot(config_file):
config = configparser.ConfigParser()
config.read(config_file)
client = discord.Client()
@client.event
async def on_ready():
print('------')
print('Logged in as %s (%s)' % (client.u... | Change knugen command to use array in config/data.json instead of hardcoded array. | Change knugen command to use array in config/data.json instead of hardcoded array.
| Python | mit | havokoc/MyManJeeves | ---
+++
@@ -20,8 +20,9 @@
async def on_message(message):
if message.channel.id == "123410749765713920":
if message.content.startswith('-knugen'):
-
- await client.send_message(message.channel, random.choice(knugenLinks))
+ with open('config/data... |
b26200860337d4dba13aeafe7cfb9dff8bf181d0 | salt/grains/nxos.py | salt/grains/nxos.py | # -*- coding: utf-8 -*-
'''
Grains for Cisco NX OS Switches Proxy minions
.. versionadded: Carbon
For documentation on setting up the nxos proxy minion look in the documentation
for :doc:`salt.proxy.nxos</ref/proxy/all/salt.proxy.nxos>`.
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt L... | # -*- coding: utf-8 -*-
'''
Grains for Cisco NX OS Switches Proxy minions
.. versionadded: 2016.11.0
For documentation on setting up the nxos proxy minion look in the documentation
for :doc:`salt.proxy.nxos</ref/proxy/all/salt.proxy.nxos>`.
'''
# Import Python Libs
from __future__ import absolute_import
# Import Sal... | Update Carbon versionadded tags to 2016.11.0 in grains/* | Update Carbon versionadded tags to 2016.11.0 in grains/*
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -2,7 +2,7 @@
'''
Grains for Cisco NX OS Switches Proxy minions
-.. versionadded: Carbon
+.. versionadded: 2016.11.0
For documentation on setting up the nxos proxy minion look in the documentation
for :doc:`salt.proxy.nxos</ref/proxy/all/salt.proxy.nxos>`. |
74728ef66fd13bfd7ad01f930114c2375e752d13 | examples/skel.py | examples/skel.py | try:
import _path
except NameError:
pass
import pygame
import spyral
import sys
SIZE = (640, 480)
BG_COLOR = (0, 0, 0)
class Game(spyral.Scene):
"""
A Scene represents a distinct state of your game. They could be menus,
different subgames, or any other things which are mostly distinct.
A ... | try:
import _path
except NameError:
pass
import pygame
import spyral
import sys
SIZE = (640, 480)
BG_COLOR = (0, 0, 0)
class Game(spyral.Scene):
"""
A Scene represents a distinct state of your game. They could be menus,
different subgames, or any other things which are mostly distinct.
A ... | Remove some accidentally committed code. | Remove some accidentally committed code.
| Python | lgpl-2.1 | platipy/spyral | ---
+++
@@ -25,12 +25,6 @@
self.register("system.quit", sys.exit)
-print spyral.widgets
-spyral.widgets.register('Testing', 'a')
-print spyral.widgets.Testing(1,2,3)
-print spyral.widgets.TextInputWidget
-
-
if __name__ == "__main__":
spyral.director.init(SIZE) # the director is the manager... |
b881247b182a45774ed494146904dcf2b1826d5e | sla_bot.py | sla_bot.py | import discord
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
if message.content.startswith('!test'):
await client.send_message(me... | import asyncio
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!', description='test')
@bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
@bot.command()
async def test():
await bot.say('Hello W... | Switch to Bot object instead of Client | Switch to Bot object instead of Client
Better reflects examples in discord.py project
| Python | mit | EsqWiggles/SLA-bot,EsqWiggles/SLA-bot | ---
+++
@@ -1,18 +1,21 @@
-import discord
import asyncio
-client = discord.Client()
+import discord
+from discord.ext import commands
-@client.event
+
+
+bot = commands.Bot(command_prefix='!', description='test')
+
+@bot.event
async def on_ready():
print('Logged in as')
- print(client.user.name)
- ... |
0ce553f791ba0aac599cc0ae5c4784fece9cb3da | bugsnag/django/middleware.py | bugsnag/django/middleware.py | from __future__ import division, print_function, absolute_import
import bugsnag
import bugsnag.django
def is_development_server(request):
server = request.META.get('wsgi.file_wrapper', None)
if server is None:
return False
return server.__module__ == 'django.core.servers.basehttp'
class Bugsnag... | from __future__ import division, print_function, absolute_import
import bugsnag
import bugsnag.django
class BugsnagMiddleware(object):
def __init__(self):
bugsnag.django.configure()
# pylint: disable-msg=R0201
def process_request(self, request):
bugsnag.configure_request(django_request=re... | Remove obsolete check for development | Remove obsolete check for development
| Python | mit | bugsnag/bugsnag-python,bugsnag/bugsnag-python,overplumbum/bugsnag-python,overplumbum/bugsnag-python | ---
+++
@@ -2,14 +2,6 @@
import bugsnag
import bugsnag.django
-
-def is_development_server(request):
- server = request.META.get('wsgi.file_wrapper', None)
-
- if server is None:
- return False
-
- return server.__module__ == 'django.core.servers.basehttp'
class BugsnagMiddleware(object):
... |
e4d746ba6c5b842529c9dafb31a90bdd31fee687 | performanceplatform/__init__.py | performanceplatform/__init__.py | # Namespace package: https://docs.python.org/2/library/pkgutil.html
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| __import__('pkg_resources').declare_namespace(__name__)
| Fix namespacing for PyPi installs | Fix namespacing for PyPi installs
See https://github.com/alphagov/performanceplatform-client/pull/5
| Python | mit | alphagov/performanceplatform-collector,alphagov/performanceplatform-collector,alphagov/performanceplatform-collector | ---
+++
@@ -1,7 +1 @@
-# Namespace package: https://docs.python.org/2/library/pkgutil.html
-try:
- import pkg_resources
- pkg_resources.declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+__import__('pkg_resources').declare_names... |
4b340e0712956ea44eace7382dd743890958a0fd | widgets/card.py | widgets/card.py | # -*- coding: utf-8 -*-
from flask import render_template
from models.person import Person
def card(person_or_id, detailed=False, small=False):
if isinstance(person_or_id, Person):
person = person_or_id
else:
person = Person.query.filter_by(id=person_or_id).first()
return render_templa... | # -*- coding: utf-8 -*-
from flask import render_template
from models.person import Person
def card(person_or_id, **kwargs):
if isinstance(person_or_id, Person):
person = person_or_id
else:
person = Person.query.filter_by(id=person_or_id).first()
return render_template('widgets/card.ht... | Revert "Fix a bug in caching" | Revert "Fix a bug in caching"
This reverts commit 2565df456ecb290f620ce4dadca19c76b0eeb1af.
Conflicts:
widgets/card.py
| Python | apache-2.0 | teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr | ---
+++
@@ -5,12 +5,12 @@
from models.person import Person
-def card(person_or_id, detailed=False, small=False):
+def card(person_or_id, **kwargs):
if isinstance(person_or_id, Person):
person = person_or_id
else:
person = Person.query.filter_by(id=person_or_id).first()
- return... |
fa75cdb0114d86b626a77ea19897abd532fd4aeb | src/hack4lt/forms.py | src/hack4lt/forms.py | from django import forms
from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from hack4lt.models import Hacker
class RegistrationForm(forms.ModelForm):
class Meta:
model = Hacker
fields = ('username', 'first_name', 'last_name', 'email', 'reposito... | from django import forms
from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from django.forms.util import ErrorList
from hack4lt.models import Hacker
class RegistrationForm(forms.ModelForm):
password = forms.CharField(label=_('Password'), max_length=128, min_len... | Add password and password_repeat fields to registration form. | Add password and password_repeat fields to registration form.
| Python | bsd-3-clause | niekas/Hack4LT | ---
+++
@@ -1,17 +1,37 @@
from django import forms
from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
+from django.forms.util import ErrorList
from hack4lt.models import Hacker
+class RegistrationForm(forms.ModelForm):
+ password = forms.CharField(label... |
640aff6378b6f47d68645822fc5c2bb3fd737710 | salt/modules/test_virtual.py | salt/modules/test_virtual.py | # -*- coding: utf-8 -*-
'''
Module for running arbitrary tests with a __virtual__ function
'''
from __future__ import absolute_import
def __virtual__():
return False
def test():
return True
| # -*- coding: utf-8 -*-
'''
Module for running arbitrary tests with a __virtual__ function
'''
from __future__ import absolute_import
def __virtual__():
return False
def ping():
return True
| Fix mis-naming from pylint cleanup | Fix mis-naming from pylint cleanup
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -9,5 +9,5 @@
return False
-def test():
+def ping():
return True |
467e8e4d8113a8f6473d7f82d86d5401053362b8 | scripts/gen-release-notes.py | scripts/gen-release-notes.py | """
Generates the release notes for the latest release, in Markdown.
Convert CHANGELOG.rst to Markdown, and extracts just the latest release.
Writes to ``scripts/latest-release-notes.md``, which can be
used with https://github.com/softprops/action-gh-release.
"""
from pathlib import Path
import pypandoc
this_dir = ... | """
Generates the release notes for the latest release, in Markdown.
Convert CHANGELOG.rst to Markdown, and extracts just the latest release.
Writes to ``scripts/latest-release-notes.md``, which can be
used with https://github.com/softprops/action-gh-release.
"""
from pathlib import Path
import pypandoc
this_dir = ... | Remove release title from the GitHub release notes body | Remove release title from the GitHub release notes body
| Python | mit | pytest-dev/pytest-mock | ---
+++
@@ -23,7 +23,8 @@
if first_heading_found:
break
first_heading_found = True
- output_lines.append(line)
+ else:
+ output_lines.append(line)
output_fn = this_dir / "latest-release-notes.md"
output_fn.write_text("\n".join(output_lines), encoding="UTF-8") |
ac33c7fcee74053dae6edfdd4596bfe03098711d | waptpkg.py | waptpkg.py | # -*- coding: utf-8 -*-
import os
import waptpackage
from waptcrypto import SSLCABundle,SSLCertificate,SSLPrivateKey
def download(remote, path, pkg):
"""Downloads package"""
if not pkg.package:
return False
res = remote.download_packages(pkg, path)
if res['errors']:
return False
... | # -*- coding: utf-8 -*-
import os
import waptpackage
from waptcrypto import SSLCABundle,SSLCertificate,SSLPrivateKey
def download(remote, path, pkg):
"""Downloads package"""
if not pkg.package:
return False
res = remote.download_packages(pkg, path)
if res['errors']:
return False
... | Include locale in package hash | Include locale in package hash
| Python | mit | jf-guillou/wapt-scripts | ---
+++
@@ -45,4 +45,4 @@
def hash(pkg):
"""Creates a hash based on package properties"""
- return "%s:%s" % (pkg.package, pkg.architecture)
+ return "%s:%s:%s" % (pkg.package, pkg.architecture, pkg.locale) |
13ba6bf5c12c46aa43c0060d40458fe453df9c33 | ydf/yaml_ext.py | ydf/yaml_ext.py | """
ydf/yaml_ext
~~~~~~~~~~~~
Contains extensions to existing YAML functionality.
"""
import collections
from ruamel import yaml
from ruamel.yaml import resolver
class OrderedLoader(yaml.Loader):
"""
Extends the default YAML loader to use :class:`~collections.OrderedDict` for mapping
types.... | """
ydf/yaml_ext
~~~~~~~~~~~~
Contains extensions to existing YAML functionality.
"""
import collections
from ruamel import yaml
from ruamel.yaml import resolver
class OrderedRoundTripLoader(yaml.RoundTripLoader):
"""
Extends the default round trip YAML loader to use :class:`~collections.Ordere... | Switch to round trip loader to support multiple documents. | Switch to round trip loader to support multiple documents.
| Python | apache-2.0 | ahawker/ydf | ---
+++
@@ -11,14 +11,14 @@
from ruamel.yaml import resolver
-class OrderedLoader(yaml.Loader):
+class OrderedRoundTripLoader(yaml.RoundTripLoader):
"""
- Extends the default YAML loader to use :class:`~collections.OrderedDict` for mapping
+ Extends the default round trip YAML loader to use :class:`~c... |
9b586b953bfe3c94adb40d0a804de3d46fca1887 | httpie/config.py | httpie/config.py | import os
__author__ = 'jakub'
CONFIG_DIR = os.path.expanduser('~/.httpie')
| import os
from requests.compat import is_windows
__author__ = 'jakub'
CONFIG_DIR = (os.path.expanduser('~/.httpie') if not is_windows else
os.path.expandvars(r'%APPDATA%\\httpie'))
| Use %APPDATA% for data on Windows. | Use %APPDATA% for data on Windows.
| Python | bsd-3-clause | codingjoe/httpie,konopski/httpie,Bogon/httpie,fontenele/httpie,aredo/httpie,GrimDerp/httpie,vietlq/httpie,paran0ids0ul/httpie,gnagel/httpie,fontenele/httpie,lingtalfi/httpie,rschmidtz/httpie,alexeikabak/httpie,konopski/httpie,PKRoma/httpie,GrimDerp/httpie,PKRoma/httpie,bright-sparks/httpie,marklap/httpie,fritaly/httpie... | ---
+++
@@ -1,6 +1,8 @@
import os
+from requests.compat import is_windows
__author__ = 'jakub'
-CONFIG_DIR = os.path.expanduser('~/.httpie')
+CONFIG_DIR = (os.path.expanduser('~/.httpie') if not is_windows else
+ os.path.expandvars(r'%APPDATA%\\httpie')) |
085edf28b2e70552789407e16ca83faf78313672 | version.py | version.py | major = 0
minor=0
patch=0
branch="dev"
timestamp=1376579871.17 | major = 0
minor=0
patch=25
branch="master"
timestamp=1376610207.69 | Tag commit for v0.0.25-master generated by gitmake.py | Tag commit for v0.0.25-master generated by gitmake.py
| Python | mit | ryansturmer/gitmake | ---
+++
@@ -1,5 +1,5 @@
major = 0
minor=0
-patch=0
-branch="dev"
-timestamp=1376579871.17
+patch=25
+branch="master"
+timestamp=1376610207.69 |
09d85cf39fd8196b26b357ee3f0b9fbb67770014 | flask_jq.py | flask_jq.py | from flask import Flask, jsonify, render_template, request
app = Flask(__name__)
@app.route('/_add_numbers')
def add_numbers():
''' Because numbers must be added server side '''
a = request.args.get('a', 0, type=int)
b = request.args.get('b', 0, type=int)
return jsonify(result=a + b)
@app.route('/')... | from flask import Flask, jsonify, render_template, request
app = Flask(__name__)
@app.route('/_add_numbers')
def add_numbers():
''' Because numbers must be added server side '''
a = request.args.get('a', 0, type=int)
b = request.args.get('b', 0, type=int)
return jsonify(result=a + b)
@app.route('/')... | Add app run on main | Add app run on main
| Python | mit | avidas/flask-jquery,avidas/flask-jquery,avidas/flask-jquery | ---
+++
@@ -13,3 +13,6 @@
@app.route('/')
def index():
return render_template('index.html')
+
+if __name__ == '__main__':
+ app.run('0.0.0.0',port=4000) |
c5ba874987b2e788ae905a1a84e7f2575ff9f991 | conman/redirects/models.py | conman/redirects/models.py | from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _
from conman.routes.models import Route
from . import views
class RouteRedirect(Route):
"""
When `route` is browsed to, browser should be redirected to `target`.
This mo... | from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _
from conman.routes.models import Route
from . import views
class RouteRedirect(Route):
"""
When `route` is browsed to, browser should be redirected to `target`.
This mo... | Remove explicit default from BooleanField | Remove explicit default from BooleanField
| Python | bsd-2-clause | Ian-Foote/django-conman,meshy/django-conman,meshy/django-conman | ---
+++
@@ -13,7 +13,7 @@
This model holds the data required to make that connection.
"""
target = models.ForeignKey('routes.Route', related_name='+')
- permanent = models.BooleanField(default=False, blank=True)
+ permanent = models.BooleanField(default=False)
view = views.RouteRedirectVie... |
f5d56b0c54af414f02721a1a02a0eaf80dbba898 | client/python/unrealcv/util.py | client/python/unrealcv/util.py | import numpy as np
import PIL
from io import BytesIO
# StringIO module is removed in python3, use io module
def read_png(res):
import PIL.Image
img = PIL.Image.open(BytesIO(res))
return np.asarray(img)
def read_npy(res):
# res is a binary buffer
return np.load(BytesIO(res))
| import numpy as np
import PIL.Image
from io import BytesIO
# StringIO module is removed in python3, use io module
def read_png(res):
img = None
try:
PIL_img = PIL.Image.open(BytesIO(res))
img = np.asarray(PIL_img)
except:
print('Read png can not parse response %s' % str(res[:20]))
... | Handle exceptions in read_png and read_npy. | Handle exceptions in read_png and read_npy.
| Python | mit | unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv | ---
+++
@@ -1,13 +1,22 @@
import numpy as np
-import PIL
+import PIL.Image
from io import BytesIO
# StringIO module is removed in python3, use io module
def read_png(res):
- import PIL.Image
- img = PIL.Image.open(BytesIO(res))
- return np.asarray(img)
+ img = None
+ try:
+ PIL_img = PIL.I... |
95f0ae5e04df6e5ce454b15551133caacfd44536 | services/netflix.py | services/netflix.py | import foauth.providers
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = 'http://api.netflix.com/oauth/request_token'
authorize... | import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = '... | Fix token retrieval for Netflix | Fix token retrieval for Netflix
| Python | bsd-3-clause | foauth/foauth.org,foauth/oauth-proxy,foauth/foauth.org,foauth/foauth.org | ---
+++
@@ -1,4 +1,5 @@
import foauth.providers
+from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
@@ -15,3 +16,11 @@
available_permissions = [
(None, 'read and manage your queue'),
]
+
+ https = False
+ signature_type = SIGNATURE_TYPE_QUER... |
3093941ebed1f9c726a88776819ee181cdb0b869 | piper/db/core.py | piper/db/core.py | import logbook
# Let's name this DatabaseBase. 'tis a silly name.
class DatabaseBase(object):
"""
Abstract class representing a persistance layer
"""
def __init__(self):
self.log = logbook.Logger(self.__class__.__name__)
def init(self, ns, config):
raise NotImplementedError()
... | import logbook
class LazyDatabaseMixin(object):
"""
A mixin class that gives the subclass lazy access to the database layer
The lazy attribute self.db is added, and the database class is gotten from
self.config, and an instance is made and returned.
"""
_db = None
@property
def db(... | Add first iteration of LazyDatabaseMixin() | Add first iteration of LazyDatabaseMixin()
| Python | mit | thiderman/piper | ---
+++
@@ -1,4 +1,27 @@
import logbook
+
+
+class LazyDatabaseMixin(object):
+ """
+ A mixin class that gives the subclass lazy access to the database layer
+
+ The lazy attribute self.db is added, and the database class is gotten from
+ self.config, and an instance is made and returned.
+
+ """
+
+ ... |
4de82c9a0737c079634a87d0ea358fba7840a419 | sesame/test_settings.py | sesame/test_settings.py | from __future__ import unicode_literals
AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend",
"sesame.backends.ModelBackend",
]
CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}}
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}}
INSTALLED_AP... | from __future__ import unicode_literals
AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend",
"sesame.backends.ModelBackend",
]
CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}}
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}}
INSTALLED_AP... | Use a fast password hasher for tests. | Use a fast password hasher for tests.
Speed is obviously more important than security in tests.
| Python | bsd-3-clause | aaugustin/django-sesame,aaugustin/django-sesame | ---
+++
@@ -23,6 +23,8 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
]
+PASSWORD_HASHERS = ["django.contrib.auth.hashers.SHA1PasswordHasher"]
+
ROOT_URLCONF = "sesame.test_urls"
SECRET_KEY = "Anyone who finds an URL will be able to log in. Seriously." |
cdae77dee9888d6d6094566747650bf80d631f03 | station.py | station.py | """Creates the station class"""
#import ask_user from ask_user
#import int_check from int_check
#import reasonable_check from reasonable_check
class Station:
"""
Each train station is an instance of the Station class.
Methods:
__init__: creates a new stations
total_station_pop: calculates total... | """Creates the station class"""
#import request_integer_in_range from request_integer_in_range
class Station:
"""
Each train station is an instance of the Station class.
Methods:
__init__: creates a new stations
request_integer_in_range : requests an integer in a range
"""
def __... | Integrate integer test function into instantiation | Integrate integer test function into instantiation
Ref #23 | Python | mit | ForestPride/rail-problem | ---
+++
@@ -2,9 +2,8 @@
-#import ask_user from ask_user
-#import int_check from int_check
-#import reasonable_check from reasonable_check
+#import request_integer_in_range from request_integer_in_range
+
class Station:
@@ -12,14 +11,13 @@
Each train station is an instance of the Station class.
Me... |
9ea05a80114237a87af73e91cb929686235baa3e | lib/rpnpy/__init__.py | lib/rpnpy/__init__.py | import sys
import ctypes as _ct
if sys.version_info < (3,):
integer_types = (int, long,)
range = xrange
else:
integer_types = (int,)
long = int
# xrange = range
C_WCHAR2CHAR = lambda x: bytes(str(x).encode('ascii'))
C_WCHAR2CHAR.__doc__ = 'Convert str to bytes'
C_CHAR2WCHAR = lambda x: str(x.deco... | import sys
import ctypes as _ct
if sys.version_info < (3,):
integer_types = (int, long,)
range = xrange
else:
integer_types = (int,)
long = int
range = range
C_WCHAR2CHAR = lambda x: bytes(str(x).encode('ascii'))
C_WCHAR2CHAR.__doc__ = 'Convert str to bytes'
C_CHAR2WCHAR = lambda x: str(x.decode(... | Add missing rpnpy.range reference for Python 3. | Add missing rpnpy.range reference for Python 3.
Signed-off-by: Stephane_Chamberland <1054841519c328088796c1f3c72c14f95c4efe35@science.gc.ca>
| Python | lgpl-2.1 | meteokid/python-rpn,meteokid/python-rpn,meteokid/python-rpn,meteokid/python-rpn | ---
+++
@@ -7,7 +7,7 @@
else:
integer_types = (int,)
long = int
- # xrange = range
+ range = range
C_WCHAR2CHAR = lambda x: bytes(str(x).encode('ascii'))
C_WCHAR2CHAR.__doc__ = 'Convert str to bytes' |
fff0b4af89e02ff834221ef056b7dcb979dc6cd7 | webpay/webpay.py | webpay/webpay.py | from .api import Account, Charges, Customers
import requests
class WebPay:
def __init__(self, key, api_base = 'https://api.webpay.jp/v1'):
self.key = key
self.api_base = api_base
self.account = Account(self)
self.charges = Charges(self)
self.customers = Customers(self)
... | from .api import Account, Charges, Customers
import requests
import json
class WebPay:
def __init__(self, key, api_base = 'https://api.webpay.jp/v1'):
self.key = key
self.api_base = api_base
self.account = Account(self)
self.charges = Charges(self)
self.customers = Customers... | Use JSON for other than GET request | Use JSON for other than GET request
Because internal dict parameters is not handled as expected.
>>> payload = {'key1': 'value1', 'key2': 'value2', 'set': {'a': 'x', 'b': 'y'}}
>>> r = requests.post("http://httpbin.org/post", data=payload)
>>> r.json()
{...
'form': {'key2': 'value2', 'key1': '... | Python | mit | yamaneko1212/webpay-python | ---
+++
@@ -1,5 +1,6 @@
from .api import Account, Charges, Customers
import requests
+import json
class WebPay:
def __init__(self, key, api_base = 'https://api.webpay.jp/v1'):
@@ -10,7 +11,7 @@
self.customers = Customers(self)
def post(self, path, params):
- r = requests.post(self.api... |
b67617abe1e8530523da7231a9d74283935a1bb7 | htext/ja/utils.py | htext/ja/utils.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import six
BASIC_LATIN_RE = re.compile(r'[\u0021-\u007E]')
WHITESPACE_RE = re.compile("[\s]+", re.UNICODE)
def force_text(value):
if isinstance(value, six.text_type):
return value
elif isinstance(value, six.string_types):
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import six
BASIC_LATIN_RE = re.compile(r'[\u0021-\u007E]')
WHITESPACE_RE = re.compile("[\s]+", re.UNICODE)
def force_text(value):
if isinstance(value, six.text_type):
return value
elif isinstance(value, six.string_types):
... | Fix UnicodeDecodeError on the environments where the default encoding is ascii | Fix UnicodeDecodeError on the environments where the default encoding is ascii
| Python | mit | hunza/htext | ---
+++
@@ -11,10 +11,10 @@
if isinstance(value, six.text_type):
return value
elif isinstance(value, six.string_types):
- return six.b(value).decode()
+ return six.b(value).decode('utf-8')
else:
value = str(value)
- return value if isinstance(value, six.text_type)... |
0e7fdc409c17870ada40f43f72b9b20b7f490519 | d_parser/helpers/get_body.py | d_parser/helpers/get_body.py | def get_body(grab, encoding='cp1251', bom=False, skip_errors=True, fix_spec_chars=True):
return grab.doc.convert_body_to_unicode(grab.doc.body, bom, encoding, skip_errors, fix_spec_chars)
| # TODO: remove useless params
def get_body(grab, encoding='cp1251', bom=False, skip_errors=True, fix_spec_chars=True):
return grab.doc.body.decode('utf-8', 'ignore')
| Rework get body text method | Rework get body text method
| Python | mit | Holovin/D_GrabDemo | ---
+++
@@ -1,2 +1,3 @@
+# TODO: remove useless params
def get_body(grab, encoding='cp1251', bom=False, skip_errors=True, fix_spec_chars=True):
- return grab.doc.convert_body_to_unicode(grab.doc.body, bom, encoding, skip_errors, fix_spec_chars)
+ return grab.doc.body.decode('utf-8', 'ignore') |
68aefd4c1bc682dc04721f5572ab21b609e1818f | manage.py | manage.py | import os
from app import create_app, db
from app.models import User, Category
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
#pyli... | import os
from app import create_app, db
from app.models import User, Category
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
#pyli... | Add name_en field due to 'not null' constraint on the Category table | Add name_en field due to 'not null' constraint on the Category table
| Python | mit | finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is | ---
+++
@@ -27,7 +27,9 @@
category = Category.get_by_name('Almenn frétt')
if category is None:
- category = Category(name='Almenn frétt', active=True)
+ category = Category(name='Almenn frétt',
+ name_en='General News',
+ active=True)
db.session.add(cat... |
c563c0deb99d3364df3650321c914164d99d32cf | been/source/markdowndirectory.py | been/source/markdowndirectory.py | from been.core import DirectorySource, source_registry
from hashlib import sha1
import re
import unicodedata
import time
import markdown
def slugify(value):
value = unicodedata.normalize('NFKD', unicode(value)).encode('ascii', 'ignore')
value = unicode(re.sub('[^\w\s-]', '', value).strip().lower())
return ... | from been.core import DirectorySource, source_registry
from hashlib import sha1
import re
import unicodedata
import time
import markdown
# slugify from Django source (BSD license)
def slugify(value):
value = unicodedata.normalize('NFKD', unicode(value)).encode('ascii', 'ignore')
value = unicode(re.sub('[^\w\s-... | Add attribution to slugify function. | Add attribution to slugify function.
| Python | bsd-3-clause | chromakode/been | ---
+++
@@ -5,6 +5,7 @@
import time
import markdown
+# slugify from Django source (BSD license)
def slugify(value):
value = unicodedata.normalize('NFKD', unicode(value)).encode('ascii', 'ignore')
value = unicode(re.sub('[^\w\s-]', '', value).strip().lower()) |
8f41ff94ecfceedf14cea03e7f2ca08df380edb0 | weight/models.py | weight/models.py | # -*- coding: utf-8 -*-
# This file is part of Workout Manager.
#
# Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | # -*- coding: utf-8 -*-
# This file is part of Workout Manager.
#
# Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | Make the verbose name for weight entries more user friendly | Make the verbose name for weight entries more user friendly
| Python | agpl-3.0 | rolandgeider/wger,petervanderdoes/wger,DeveloperMal/wger,petervanderdoes/wger,kjagoo/wger_stark,rolandgeider/wger,wger-project/wger,petervanderdoes/wger,wger-project/wger,kjagoo/wger_stark,DeveloperMal/wger,kjagoo/wger_stark,wger-project/wger,wger-project/wger,rolandgeider/wger,DeveloperMal/wger,DeveloperMal/wger,kjago... | ---
+++
@@ -23,8 +23,8 @@
class WeightEntry(models.Model):
"""Model for a weight point
"""
- creation_date = models.DateField(_('Creation date'))
- weight = models.FloatField(_('Weight'))
+ creation_date = models.DateField(verbose_name = _('Date'))
+ weight = models.FloatField(verbose_name = _(... |
1b0a5388c246dba1707f768e9be08b3a63503a31 | samples/python/topology/tweepy/app.py | samples/python/topology/tweepy/app.py | from streamsx.topology.topology import *
import streamsx.topology.context
import sys
import tweets
#
# Continually stream tweets that contain
# the terms passed on the command line.
#
# python3 app.py Food GlutenFree
#
def main():
terms = sys.argv[1:]
topo = Topology("TweetsUsingTweepy")
# Event based source st... | from streamsx.topology.topology import *
import streamsx.topology.context
import sys
import tweets
#
# Continually stream tweets that contain
# the terms passed on the command line.
#
# python3 app.py Food GlutenFree
#
#
# Requires tweepy to be installed
#
# pip3 install tweepy
#
# http://www.tweepy.org/
#
# You must ... | Add some info about tweepy | Add some info about tweepy
| Python | apache-2.0 | IBMStreams/streamsx.topology,ddebrunner/streamsx.topology,wmarshall484/streamsx.topology,wmarshall484/streamsx.topology,ddebrunner/streamsx.topology,wmarshall484/streamsx.topology,IBMStreams/streamsx.topology,IBMStreams/streamsx.topology,ibmkendrick/streamsx.topology,ddebrunner/streamsx.topology,ibmkendrick/streamsx.to... | ---
+++
@@ -9,6 +9,18 @@
#
# python3 app.py Food GlutenFree
#
+#
+# Requires tweepy to be installed
+#
+# pip3 install tweepy
+#
+# http://www.tweepy.org/
+#
+# You must create Twitter application authentication tokens
+# and set them in the mykeys.py module.
+# Note this is only intended as a simple sample,
+#
+
... |
c8a0aee9b68b0567adb8285c3264d244e2ed71ca | bnw/handlers/command_register.py | bnw/handlers/command_register.py | # -*- coding: utf-8 -*-
# from twisted.words.xish import domish
from twisted.words.protocols.jabber.xmpp_stringprep import nodeprep
from base import *
import random
import time
import bnw.core.bnw_objects as objs
def _(s, user):
return s
from uuid import uuid4
import re
@check_arg(name=USER_RE)
@defer.inlineC... | # -*- coding: utf-8 -*-
# from twisted.words.xish import domish
from twisted.words.protocols.jabber.xmpp_stringprep import nodeprep
from base import *
import random
import time
import bnw.core.bnw_objects as objs
def _(s, user):
return s
from uuid import uuid4
import re
@check_arg(name=USER_RE)
@defer.inlineC... | Make "register" return False when username is already taken | Make "register" return False when username is already taken
| Python | bsd-2-clause | stiletto/bnw,ojab/bnw,ojab/bnw,stiletto/bnw,stiletto/bnw,un-def/bnw,un-def/bnw,stiletto/bnw,ojab/bnw,ojab/bnw,un-def/bnw,un-def/bnw | ---
+++
@@ -50,5 +50,5 @@
)
else:
defer.returnValue(
- dict(ok=True, desc='This username is already taken')
+ dict(ok=False, desc='This username is already taken')
) |
d0c3906a0af504f61f39e1bc2f0fd43a71bda747 | sharedmock/asserters.py | sharedmock/asserters.py | from pprint import pformat
def assert_calls_equal(expected, actual):
"""
Check whether the given mock object (or mock method) calls are equal and
return a nicely formatted message.
"""
if not expected == actual:
raise_calls_differ_error(expected, actual)
def raise_calls_differ_error(expe... | from pprint import pformat
def assert_calls_equal(expected, actual):
"""
Check whether the given mock object (or mock method) calls are equal and
return a nicely formatted message.
"""
if not expected == actual:
raise_calls_differ_error(expected, actual)
def raise_calls_differ_error(expe... | Remove extraneous quote in asserter dockstring | Remove extraneous quote in asserter dockstring
| Python | apache-2.0 | elritsch/python-sharedmock | ---
+++
@@ -11,7 +11,7 @@
def raise_calls_differ_error(expected, actual):
- """"
+ """
Raise an AssertionError with pretty print format for the given expected
and actual mock calls in order to ensure consistent print style for better
readability. |
b8d812039051addacda3c04d2cfe657a58bc3681 | yolk/__init__.py | yolk/__init__.py | """yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.7.1'
| """yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.7.2'
| Increment patch version to 0.7.2 | Increment patch version to 0.7.2
| Python | bsd-3-clause | myint/yolk,myint/yolk | ---
+++
@@ -6,4 +6,4 @@
"""
-__version__ = '0.7.1'
+__version__ = '0.7.2' |
14f2161efbd9c8377e6ff3675c48aba1ac0c47d5 | API/chat/forms.py | API/chat/forms.py | import time
from django import forms
from .models import Message
from .utils import timestamp_to_datetime, datetime_to_timestamp
class MessageForm(forms.Form):
text = forms.CharField(widget=forms.Textarea)
typing = forms.BooleanField(required=False)
class MessageCreationForm(MessageForm):
username = f... | import time
from django import forms
from .models import Message
from .utils import timestamp_to_datetime, datetime_to_timestamp
class MessageForm(forms.Form):
text = forms.CharField(widget=forms.Textarea)
typing = forms.BooleanField(required=False)
message_type = forms.CharField(widget=forms.Textarea)
... | Add message_type as CharField in form | Add message_type as CharField in form
| Python | mit | gtklocker/ting,gtklocker/ting,mbalamat/ting,mbalamat/ting,mbalamat/ting,gtklocker/ting,dionyziz/ting,gtklocker/ting,dionyziz/ting,dionyziz/ting,dionyziz/ting,mbalamat/ting | ---
+++
@@ -9,6 +9,7 @@
class MessageForm(forms.Form):
text = forms.CharField(widget=forms.Textarea)
typing = forms.BooleanField(required=False)
+ message_type = forms.CharField(widget=forms.Textarea)
class MessageCreationForm(MessageForm): |
5733c800c10a7546228ec4562e40b2bd06c77c7e | models.py | models.py | from django.db import models
# Create your models here.
| from django.db import models
from django.utils import timezone
import datetime
class Poll(models.Model):
question = models.CharField(max_length=255)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_recently(self):
return self.pub_date >= timezone.... | Improve database model and apperance for admin site | Improve database model and apperance for admin site
| Python | mit | egel/polls | ---
+++
@@ -1,3 +1,22 @@
from django.db import models
+from django.utils import timezone
+import datetime
-# Create your models here.
+
+class Poll(models.Model):
+ question = models.CharField(max_length=255)
+ pub_date = models.DateTimeField('date published')
+ def __unicode__(self):
+ return self.question
+ def... |
12320653c58cd9e9a73a6d8d69073a5b64545e5b | tr_init.py | tr_init.py | #!flask/bin/python
import os
import sys
if sys.platform == 'win32':
pybabel = 'flask\\Scripts\\pybabel'
else:
pybabel = 'flask/bin/pybabel'
if len(sys.argv) != 2:
print "usage: tr_init <language-code>"
sys.exit(1)
os.system(pybabel + ' extract -F babel.cfg -k lazy_gettext -o messages.pot app')
os.system... | #!flask/bin/python
import os
import sys
if sys.platform == 'win32':
pybabel = 'flask\\Scripts\\pybabel'
else:
pybabel = 'flask/bin/pybabel'
if len(sys.argv) != 2:
print("usage: tr_init <language-code>")
sys.exit(1)
os.system(pybabel + ' extract -F babel.cfg -k lazy_gettext -o messages.pot app')
os.syste... | Add parentheses to the print statement to make it Python3 compatible | fix: Add parentheses to the print statement to make it Python3 compatible
| Python | bsd-3-clause | stueken/microblog,stueken/microblog | ---
+++
@@ -6,7 +6,7 @@
else:
pybabel = 'flask/bin/pybabel'
if len(sys.argv) != 2:
- print "usage: tr_init <language-code>"
+ print("usage: tr_init <language-code>")
sys.exit(1)
os.system(pybabel + ' extract -F babel.cfg -k lazy_gettext -o messages.pot app')
os.system(pybabel + ' init -i messages.... |
c0633bc60dda6b81e623795f2c65a1eb0ba5933d | blinkytape/blinkyplayer.py | blinkytape/blinkyplayer.py | import time
class BlinkyPlayer(object):
FOREVER = -1
def __init__(self, blinkytape):
self._blinkytape = blinkytape
def play(self, animation, num_cycles = FOREVER):
finished = self._make_finished_predicate(animation, num_cycles)
animation.begin()
while not finished():
... | import time
class BlinkyPlayer(object):
FOREVER = -1
def __init__(self, blinkytape):
self._blinkytape = blinkytape
def play(self, animation, num_cycles = FOREVER):
finished = self._finished_predicate(animation, num_cycles)
animation.begin()
while not finished():
... | Clean up BlinkyPlayer a little | Clean up BlinkyPlayer a little
| Python | mit | jonspeicher/blinkyfun | ---
+++
@@ -7,7 +7,7 @@
self._blinkytape = blinkytape
def play(self, animation, num_cycles = FOREVER):
- finished = self._make_finished_predicate(animation, num_cycles)
+ finished = self._finished_predicate(animation, num_cycles)
animation.begin()
while not finished():
... |
5bc6f65828e9fbf9d2a5b1198a9625024fd72d6e | weather.py | weather.py | from pyowm.owm import OWM
from datetime import datetime, timedelta
class WeatherManager:
def __init__(self, key, lat, lon):
owm = OWM(key)
self.mgr = owm.weather_manager()
self.lat = lat
self.lon = lon
self.last_updated = None
def load_data(self):
self.data = se... | from pyowm.owm import OWM
from datetime import datetime, timedelta
class WeatherManager:
def __init__(self, key, lat, lon):
owm = OWM(key)
self.mgr = owm.weather_manager()
self.lat = lat
self.lon = lon
self.last_updated = None
def load_data(self):
self.data = se... | Make cloud check evaluate greater than or equals | Make cloud check evaluate greater than or equals
| Python | mit | Nosskirneh/SmartRemoteControl,Nosskirneh/SmartRemoteControl,Nosskirneh/SmartRemoteControl,Nosskirneh/SmartRemoteControl,Nosskirneh/SmartRemoteControl | ---
+++
@@ -17,4 +17,4 @@
# Only update every 20 minutes at most
if not self.last_updated or datetime.now() > self.last_updated + timedelta(minutes=20):
self.load_data()
- return self.data.current.clouds > threshold
+ return self.data.current.clouds >= threshold |
027e78f3e88a17e05881259d1f29d472b02d0d3a | doc/source/scripts/titles.py | doc/source/scripts/titles.py | import shutil
import os
import re
work = os.getcwd()
found = []
regex = re.compile(r'pydarkstar\.(.*)\.rst')
for root, dirs, files in os.walk(work):
for f in files:
m = regex.match(f)
if m:
found.append((root, f))
for root, f in found:
path = os.path.join(root, f)
with open(pat... | import shutil
import os
import re
work = os.getcwd()
found = []
regex = re.compile(r'pydarkstar\.(.*)\.rst')
for root, dirs, files in os.walk(work):
for f in files:
m = regex.match(f)
if m:
found.append((root, f))
for root, f in found:
path = os.path.join(root, f)
with open(pat... | Change to 3 spaces in front of toctree elements | Change to 3 spaces in front of toctree elements
| Python | mit | AdamGagorik/pydarkstar | ---
+++
@@ -38,13 +38,6 @@
line = re.sub(r'\s+package$', '', line)
if re.match(r'^\s\s\spydarkstar.*$', line):
- handle.write(' {}'.format(line.lstrip()))
+ handle.write(' {}'.format(line.lstrip()))
else:
handle.write(line)
-
- if '.. toc... |
72f28cfa2723faaa7f7ed2b165fd99b214bc67c9 | MeetingMinutes.py | MeetingMinutes.py | import sublime, sublime_plugin
import os
import re
from .mistune import markdown
class CreateMinuteCommand(sublime_plugin.TextCommand):
def run(self, edit):
region = sublime.Region(0, self.view.size())
md_source = self.view.substr(region)
md_source.encode(encoding='UTF-8',errors='strict')
html_source = '<!D... | import sublime, sublime_plugin
import os
import re
from .mistune import markdown
HTML_START = '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>'
HTML_END = '</body></html>'
class CreateMinuteCommand(sublime_plugin.TextCommand):
def run(self, edit):
region = sublime.Region(0, self.view.size())
md_s... | Create variables for HTML start and end. | Create variables for HTML start and end.
| Python | mit | Txarli/sublimetext-meeting-minutes,Txarli/sublimetext-meeting-minutes | ---
+++
@@ -4,13 +4,15 @@
from .mistune import markdown
+HTML_START = '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>'
+HTML_END = '</body></html>'
class CreateMinuteCommand(sublime_plugin.TextCommand):
def run(self, edit):
region = sublime.Region(0, self.view.size())
md_source = self.... |
5ede88c91f61b4aeb3a1e9b55e6b7836cf805255 | django_filepicker/utils.py | django_filepicker/utils.py | import re
import urllib
from os.path import basename
from django.core.files import File
class FilepickerFile(object):
filepicker_url_regex = re.compile(
r'https?:\/\/www.filepicker.io\/api\/file\/.*')
def __init__(self, url):
if not self.filepicker_url_regex.match(url):
raise... | import re
import urllib
import os
from django.core.files import File
class FilepickerFile(object):
filepicker_url_regex = re.compile(
r'https?:\/\/www.filepicker.io\/api\/file\/.*')
def __init__(self, url):
if not self.filepicker_url_regex.match(url):
raise ValueError('Not a ... | Add context manager and destructor for cleanup | Add context manager and destructor for cleanup
When exiting the context or calling cleanup() explicitly,
the temporary file created after downloading is removed and
any open files closed.
| Python | mit | FundedByMe/filepicker-django,FundedByMe/filepicker-django,filepicker/filepicker-django,filepicker/filepicker-django | ---
+++
@@ -1,6 +1,6 @@
import re
import urllib
-from os.path import basename
+import os
from django.core.files import File
@@ -19,10 +19,46 @@
Downloads the file from filepicker.io and returns a
Django File wrapper object
'''
- filename, header = urllib.urlretrieve(self.url)
... |
13d0b4b50b2eaaf5c557576b7b45a378d901c49c | src/zeit/cms/testcontenttype/interfaces.py | src/zeit/cms/testcontenttype/interfaces.py | # Copyright (c) 2007-2011 gocept gmbh & co. kg
# See also LICENSE.txt
# $Id$
"""Interface definitions for the test content type."""
import zope.interface
class ITestContentType(zope.interface.Interface):
"""A type for testing."""
ITestContentType.setTaggedValue('zeit.cms.type', 'testcontenttype')
| # Copyright (c) 2007-2011 gocept gmbh & co. kg
# See also LICENSE.txt
# $Id$
"""Interface definitions for the test content type."""
import zope.interface
class ITestContentType(zope.interface.Interface):
"""A type for testing."""
| Remove superfluous type annotation, it's done by the TypeGrokker now | Remove superfluous type annotation, it's done by the TypeGrokker now
| Python | bsd-3-clause | ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms | ---
+++
@@ -9,6 +9,3 @@
class ITestContentType(zope.interface.Interface):
"""A type for testing."""
-
-
-ITestContentType.setTaggedValue('zeit.cms.type', 'testcontenttype') |
8f993412a0110085fee10331daecfb3d36973518 | __init__.py | __init__.py | ###
# Copyright (c) 2012, spline
# All rights reserved.
#
#
###
"""
Add a description of the plugin (to be presented to the user inside the wizard)
here. This should describe *what* the plugin does.
"""
import supybot
import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CV... | ###
# Copyright (c) 2012, spline
# All rights reserved.
#
#
###
"""
Add a description of the plugin (to be presented to the user inside the wizard)
here. This should describe *what* the plugin does.
"""
import supybot
import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CV... | Add reload to init for config | Add reload to init for config
| Python | mit | reticulatingspline/Scores,cottongin/Scores | ---
+++
@@ -29,6 +29,7 @@
import config
import plugin
+reload(config)
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well! |
f447e8fa50770d133d53e69477292b3925203c64 | modular_blocks/models.py | modular_blocks/models.py | from django.db import models
from .fields import ListTextField
class TwoModularColumnsMixin(models.Model):
sidebar_left = ListTextField()
sidebar_right = ListTextField()
class Meta:
abstract = True
| from django.db import models
from .fields import ListTextField
class TwoModularColumnsMixin(models.Model):
sidebar_left = ListTextField(
blank=True,
null=True,
)
sidebar_right = ListTextField(
lank=True,
null=True,
)
class Meta:
abstract = True
| Add null and blank to sidebars | Add null and blank to sidebars
| Python | agpl-3.0 | rezometz/django-modular-blocks,rezometz/django-modular-blocks,rezometz/django-modular-blocks | ---
+++
@@ -4,8 +4,14 @@
class TwoModularColumnsMixin(models.Model):
- sidebar_left = ListTextField()
- sidebar_right = ListTextField()
+ sidebar_left = ListTextField(
+ blank=True,
+ null=True,
+ )
+ sidebar_right = ListTextField(
+ lank=True,
+ null=True,
+ )
... |
b63b22678a005baa6195854b65cc1828061febba | vx/mode.py | vx/mode.py | import vx
import os.path
def mode_from_filename(file):
root, ext = os.path.splitext(file)
ext = ext if ext else root
mode = None
if ext == '.c':
return c_mode
class mode:
def __init__(self, window):
self.breaks = ('_', ' ', '\n', '\t')
self.keywords = ()
class python_mod... | import vx
import os.path
def mode_from_filename(file):
root, ext = os.path.splitext(file)
ext = ext if ext else root
mode = None
if ext == '.c':
return c_mode
elif ext == '.py':
return python_mode
class mode:
def __init__(self, window):
self.breaks = ('_', ' ', '\n', ... | Add .py extension handling and more python keywords | Add .py extension handling and more python keywords
| Python | mit | philipdexter/vx,philipdexter/vx | ---
+++
@@ -9,6 +9,8 @@
mode = None
if ext == '.c':
return c_mode
+ elif ext == '.py':
+ return python_mode
class mode:
def __init__(self, window):
@@ -21,7 +23,7 @@
self.breaks = ('_', ' ', '\n', '\t', '(', ')', '{', '}', '.', ',', '#')
- self.keywords = ('ret... |
f62980f99654b22930cac6716410b145b590221f | Lib/lib-tk/FixTk.py | Lib/lib-tk/FixTk.py | import sys, os
v = os.path.join(sys.prefix, "tcl", "tcl8.3")
if os.path.exists(os.path.join(v, "init.tcl")):
os.environ["TCL_LIBRARY"] = v
| import sys, os, _tkinter
ver = str(_tkinter.TCL_VERSION)
v = os.path.join(sys.prefix, "tcl", "tcl"+ver)
if os.path.exists(os.path.join(v, "init.tcl")):
os.environ["TCL_LIBRARY"] = v
| Work the Tcl version number in the path we search for. | Work the Tcl version number in the path we search for.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | ---
+++
@@ -1,4 +1,5 @@
-import sys, os
-v = os.path.join(sys.prefix, "tcl", "tcl8.3")
+import sys, os, _tkinter
+ver = str(_tkinter.TCL_VERSION)
+v = os.path.join(sys.prefix, "tcl", "tcl"+ver)
if os.path.exists(os.path.join(v, "init.tcl")):
os.environ["TCL_LIBRARY"] = v |
49b24fe2c524923e200ce8495055b0b59d83eb6d | __init__.py | __init__.py | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from . import OctoPrintOutputDevicePlugin
from . import DiscoverOctoPrintAction
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
def getMetaData():
return {
"type": "extension",
"plugin": {
... | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from . import OctoPrintOutputDevicePlugin
from . import DiscoverOctoPrintAction
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
def getMetaData():
return {
"type": "extension",
"plugin": {
... | Set plugin version to "master" to show which Cura branch this plugin branch should work with | Set plugin version to "master" to show which Cura branch this plugin branch should work with
| Python | agpl-3.0 | fieldOfView/OctoPrintPlugin | ---
+++
@@ -11,7 +11,7 @@
"plugin": {
"name": "OctoPrint connection",
"author": "fieldOfView",
- "version": "2.4",
+ "version": "master",
"description": catalog.i18nc("@info:whatsthis", "Allows sending prints to OctoPrint and monitoring the progres... |
1c43affbd82f68ed8956cd407c494ff46dab9203 | examples/IPLoM_example.py | examples/IPLoM_example.py | from pygraphc.misc.IPLoM import *
from pygraphc.evaluation.ExternalEvaluation import *
# set input path
ip_address = '161.166.232.17'
standard_path = '/home/hudan/Git/labeled-authlog/dataset/Hofstede2014/dataset1/' + ip_address
standard_file = standard_path + 'auth.log.anon.labeled'
analyzed_file = 'auth.log.anon'
pre... | from pygraphc.misc.IPLoM import *
from pygraphc.evaluation.ExternalEvaluation import *
# set input path
dataset_path = '/home/hudan/Git/labeled-authlog/dataset/Hofstede2014/dataset1_perday/'
groundtruth_file = dataset_path + 'Dec 1.log.labeled'
analyzed_file = 'Dec 1.log'
OutputPath = '/home/hudan/Git/pygraphc/result/... | Edit path and external evaluation | Edit path and external evaluation
| Python | mit | studiawan/pygraphc | ---
+++
@@ -2,13 +2,12 @@
from pygraphc.evaluation.ExternalEvaluation import *
# set input path
-ip_address = '161.166.232.17'
-standard_path = '/home/hudan/Git/labeled-authlog/dataset/Hofstede2014/dataset1/' + ip_address
-standard_file = standard_path + 'auth.log.anon.labeled'
-analyzed_file = 'auth.log.anon'
-p... |
6e1126fe9a8269ff4489ee338000afc852bce922 | oidc_apis/id_token.py | oidc_apis/id_token.py | import inspect
from .scopes import get_userinfo_by_scopes
def process_id_token(payload, user, scope=None):
if scope is None:
# HACK: Steal the scope argument from the locals dictionary of
# the caller, since it was not passed to us
scope = inspect.stack()[1][0].f_locals.get('scope', [])
... | import inspect
from .scopes import get_userinfo_by_scopes
def process_id_token(payload, user, scope=None):
if scope is None:
# HACK: Steal the scope argument from the locals dictionary of
# the caller, since it was not passed to us
scope = inspect.stack()[1][0].f_locals.get('scope', [])
... | Add username to ID Token | Add username to ID Token
| Python | mit | mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo | ---
+++
@@ -10,4 +10,5 @@
scope = inspect.stack()[1][0].f_locals.get('scope', [])
payload.update(get_userinfo_by_scopes(user, scope))
+ payload['preferred_username'] = user.username
return payload |
b47e3677120b9b2d64d38b48b0382dc7986a1b82 | opps/core/__init__.py | opps/core/__init__.py | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
trans_app_label = _('Opps')
settings.INSTALLED_APPS += ('opps.article',
'opps.image',
'opps.channel',
'opps.source',
'redactor',
'tagging',)
settings.REDACTOR_OPTI... | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
trans_app_label = _('Opps')
| Remove installed app on init opps core | Remove installed app on init opps core
| Python | mit | YACOWS/opps,williamroot/opps,jeanmask/opps,williamroot/opps,williamroot/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,jeanmask/opps,opps/opps,YACOWS/opps,opps/opps,YACOWS/opps | ---
+++
@@ -1,16 +1,6 @@
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
-from django.conf import settings
trans_app_label = _('Opps')
-settings.INSTALLED_APPS += ('opps.article',
- 'opps.image',
- 'opps.channel',
- 'opps.source',
- 'redactor',
- ... |
52d15d09ed079d1b8598f314524066b56273af3d | addie/_version.py | addie/_version.py |
# This file was generated by 'versioneer.py' (0.15) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
import json
import sys
version_json = '''
{
"dirty": false,
"error": null,
"full-revisionid... |
# This file was generated by 'versioneer.py' (0.15) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
import json
version_json = '''
{
"dirty": false,
"error": null,
"full-revisionid": "aaeac97... | Remove sys import in versioneer file | Remove sys import in versioneer file
| Python | mit | neutrons/FastGR,neutrons/FastGR,neutrons/FastGR | ---
+++
@@ -5,7 +5,6 @@
# of this file.
import json
-import sys
version_json = '''
{ |
25a97de30fcc9cddd7f58cd25584fd726f0cc8e4 | guild/commands/packages_list.py | guild/commands/packages_list.py | # Copyright 2017-2020 TensorHub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | # Copyright 2017-2020 TensorHub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Clarify meaning of --all option for packages command | Clarify meaning of --all option for packages command
| Python | apache-2.0 | guildai/guild,guildai/guild,guildai/guild,guildai/guild | ---
+++
@@ -22,7 +22,7 @@
@click.command("list, ls")
@click.argument("terms", metavar="[TERM]...", nargs=-1)
-@click.option("-a", "--all", help="Show all packages.", is_flag=True)
+@click.option("-a", "--all", help="Show all installed Python packages.", is_flag=True)
@click_util.use_args
def list_packages(args)... |
ccdeb23eb54191913a97b48907e0738f6969ce58 | tests/factories/config.py | tests/factories/config.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from factory import SubFactory
from pycroft.model.config import Config
from .base impor... | # -*- coding: utf-8 -*-
# Copyright (c) 2018 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from factory import SubFactory
from pycroft.model.config import Config
from .base impor... | Add correct properties for payment_in_default test group | Add correct properties for payment_in_default test group
| Python | apache-2.0 | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | ---
+++
@@ -26,7 +26,9 @@
cache_group = SubFactory(PropertyGroupFactory)
traffic_limit_exceeded_group = SubFactory(PropertyGroupFactory)
external_group = SubFactory(PropertyGroupFactory)
- payment_in_default_group = SubFactory(PropertyGroupFactory)
+ payment_in_default_group = SubFactory(Property... |
fb9c56381d259de7d1765ca0e058f82d61e4e975 | examples/ellipses_FreeCAD.py | examples/ellipses_FreeCAD.py | from __future__ import division
import numpy as np
import FreeCAD as FC
import Part
import Draft
import os
doc = FC.newDocument("ellipses")
folder = os.path.dirname(__file__) + ".\.."
fname = folder + "/vor_ellipses.txt"
data = np.loadtxt(fname)
shapes = []
area = 0
for ellipse in data:
cx, cy, b, a, ang = ellips... | from __future__ import division
import numpy as np
import FreeCAD as FC
import Part
import Draft
import os
doc = FC.newDocument("ellipses")
folder = os.path.dirname(__file__) #+ "/.."
fname = folder + "/vor_ellipses.txt"
data = np.loadtxt(fname)
shapes = []
area = 0
radii = []
for ellipse in data:
cx, cy, b, a, a... | Add radii mean and standard deviation | Add radii mean and standard deviation
| Python | mit | nicoguaro/ellipse_packing | ---
+++
@@ -7,11 +7,12 @@
doc = FC.newDocument("ellipses")
-folder = os.path.dirname(__file__) + ".\.."
+folder = os.path.dirname(__file__) #+ "/.."
fname = folder + "/vor_ellipses.txt"
data = np.loadtxt(fname)
shapes = []
area = 0
+radii = []
for ellipse in data:
cx, cy, b, a, ang = ellipse
ang =... |
08de3f0bf326e8625462d9dbdb7297d8749bc416 | examples/joystick_example.py | examples/joystick_example.py | #!/usr/bin/env python3
"""This example shows how to use the Joystick Click wrapper of the LetMeCreate.
It continuously reads the position of the joystick, prints it in the terminal
and displays a pattern on the LED's based on the x coordinate.
The Joystick Click must be inserted in Mikrobus 1 before running this prog... | #!/usr/bin/env python3
"""This example shows how to use the Joystick Click wrapper of the LetMeCreate.
It continuously reads the position of the joystick, prints it in the terminal
and displays a pattern on the LED's based on the x coordinate.
The Joystick Click must be inserted in Mikrobus 1 before running this prog... | Replace tabs by space in example | joystick: Replace tabs by space in example
Signed-off-by: Francois Berder <59eaf4bb0211c66c3d7532da6d77ecf42a779d82@outlook.fr>
| Python | bsd-3-clause | francois-berder/PyLetMeCreate | ---
+++
@@ -15,25 +15,25 @@
MAXIMUM = OFFSET2
def get_led_mask(perc):
- div = int((1. - perc)led.LED_CNT)
- if div > led.LED_CNT:
- div = led.LED_CNT
+ div = int((1. - perc)led.LED_CNT)
+ if div > led.LED_CNT:
+ div = led.LED_CNT
- mask = 0
- for i in range(div):
- mask |= (1 << i)
+ mask = 0
... |
98a4cd76ce9ecb81675ebaa29b249a8d80347e0d | zc-list.py | zc-list.py | #!/usr/bin/env python
import client_wrap
KEY_LONG = "key1"
DATA_LONG = 1024
KEY_DOUBLE = "key2"
DATA_DOUBLE = 100.53
KEY_STRING = "key3"
DATA_STRING = "test data"
def init_data(client):
client.WriteLong(KEY_LONG, DATA_LONG)
client.WriteDouble(KEY_DOUBLE, DATA_DOUBLE)
client.WriteString(KEY_STRING, DATA... | #!/usr/bin/env python
import client_wrap
def main():
client = client_wrap.ClientWrap("get_test.log", "ipc:///var/run/zero-cache/0", 0)
key_str = client.GetKeys()
keys = key_str.split (';')
del keys[-1]
if len(keys) == 0:
return
print keys
if __name__ == "__main__":
main()
| Implement displaying of the current key list | Implement displaying of the current key list
| Python | agpl-3.0 | ellysh/zero-cache-utils,ellysh/zero-cache-utils | ---
+++
@@ -2,29 +2,17 @@
import client_wrap
-KEY_LONG = "key1"
-DATA_LONG = 1024
-
-KEY_DOUBLE = "key2"
-DATA_DOUBLE = 100.53
-
-KEY_STRING = "key3"
-DATA_STRING = "test data"
-
-def init_data(client):
- client.WriteLong(KEY_LONG, DATA_LONG)
- client.WriteDouble(KEY_DOUBLE, DATA_DOUBLE)
- client.WriteS... |
1f6c830e68aede8a2267b5749b911d87801f9e5b | setup.py | setup.py | from setuptools import setup
setup(
name='django-setmagic',
version='0.2',
author='Evandro Myller',
author_email='emyller@7ws.co',
description='Magically editable settings for winged pony lovers',
url='https://github.com/7ws/django-setmagic',
install_requires=[
'django >= 1.5',
... | from setuptools import setup
setup(
name='django-setmagic',
version='0.2.1',
author='Evandro Myller',
author_email='emyller@7ws.co',
description='Magically editable settings for winged pony lovers',
url='https://github.com/7ws/django-setmagic',
install_requires=[
'django >= 1.5',
... | Include templates and static at the installing process too | Include templates and static at the installing process too
| Python | mit | 7ws/django-setmagic | ---
+++
@@ -3,7 +3,7 @@
setup(
name='django-setmagic',
- version='0.2',
+ version='0.2.1',
author='Evandro Myller',
author_email='emyller@7ws.co',
description='Magically editable settings for winged pony lovers',
@@ -12,6 +12,7 @@
'django >= 1.5',
],
packages=['setmagic... |
2049be18b864fe2dab61ca6258b2295b3270d5c2 | setup.py | setup.py | import distutils.core
# Uploading to PyPI
# =================
# $ python setup.py register -r pypi
# $ python setup.py sdist upload -r pypi
version = '0.0'
distutils.core.setup(
name='kxg',
version=version,
author='Kale Kundert and Alex Mitchell',
url='https://github.com/kxgames/GameEn... | import distutils.core
# Uploading to PyPI
# =================
# $ python setup.py register -r pypi
# $ python setup.py sdist upload -r pypi
version = '0.0'
distutils.core.setup(
name='kxg',
version=version,
author='Kale Kundert and Alex Mitchell',
url='https://github.com/kxgames/GameEn... | Add pytest as a dependency | Add pytest as a dependency
| Python | mit | kxgames/kxg | ---
+++
@@ -23,5 +23,6 @@
'linersock',
'vecrec',
'glooey',
+ 'pytest',
],
) |
cb528fbb990e8cd3d301fcbf60069b33a68b9cac | setup.py | setup.py | #!/usr/bin/env python
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name="ShowTransmission",
version="0.1",
packages=find_packages(),
author="Chris Scutcher",
author_email="chris.scutcher@ninebysix.co.uk",
description=("Script t... | #!/usr/bin/env python
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name="ShowTransmission",
version="0.1",
packages=find_packages(),
author="Chris Scutcher",
author_email="chris.scutcher@ninebysix.co.uk",
description=("Script t... | Revert "Specify specific version of feedparser" | Revert "Specify specific version of feedparser"
This reverts commit e2a6bc54e404538f01a980f1573a507c224d1c31.
| Python | apache-2.0 | cscutcher/showtransmission | ---
+++
@@ -12,7 +12,7 @@
author_email="chris.scutcher@ninebysix.co.uk",
description=("Script that monitors a ShowRSS feed and adds new torrents to transmission via "
"RPC interface"),
- install_requires=['feedparser>=5.3.1'],
+ install_requires=['feedparser'],
entry_points = {
... |
a61386cbbcbe3e68bcdf0a98c23547117a496fec | zerver/views/webhooks/github_dispatcher.py | zerver/views/webhooks/github_dispatcher.py | from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from .github_webhook import api_github_webhook
from .github import api_github_landing
def api_github_webhook_dispatch(request):
# type: (HttpRequest) -> HttpResponse
if request.META.get('HTTP_X_GITHUB_EVENT'):
ret... | from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from .github_webhook import api_github_webhook
from .github import api_github_landing
# Since this dispatcher is an API-style endpoint, it needs to be
# explicitly marked as CSR... | Fix GitHub integration CSRF issue. | github: Fix GitHub integration CSRF issue.
The new GitHub dispatcher integration was apparently totally broken,
because we hadn't tagged the new dispatcher endpoint as exempt from
CSRF checking. I'm not sure why the test suite didn't catch this.
| Python | apache-2.0 | AZtheAsian/zulip,dhcrzf/zulip,JPJPJPOPOP/zulip,christi3k/zulip,hackerkid/zulip,verma-varsha/zulip,j831/zulip,Diptanshu8/zulip,dhcrzf/zulip,ryanbackman/zulip,shubhamdhama/zulip,Galexrt/zulip,hackerkid/zulip,andersk/zulip,amyliu345/zulip,j831/zulip,mahim97/zulip,brainwane/zulip,SmartPeople/zulip,ryanbackman/zulip,Galexrt... | ---
+++
@@ -1,9 +1,12 @@
from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
+from django.views.decorators.csrf import csrf_exempt
from .github_webhook import api_github_webhook
from .github import api_github_landing
-
+# Since this dispatcher is an API-style endpoint, it ne... |
a7c49480e1eb530aa4df494709ec1f7edd875e1a | devito/ir/clusters/analysis.py | devito/ir/clusters/analysis.py | from devito.ir.support import (SEQUENTIAL, PARALLEL, PARALLEL_IF_ATOMIC, VECTOR,
TILABLE, WRAPPABLE)
__all__ = ['analyze']
def analyze(clusters):
return clusters
| from collections import OrderedDict
from devito.ir.clusters.queue import Queue
from devito.ir.support import (SEQUENTIAL, PARALLEL, PARALLEL_IF_ATOMIC, VECTOR,
TILABLE, WRAPPABLE)
from devito.tools import timed_pass
__all__ = ['analyze']
class State(object):
def __init__(self):
... | Add machinery to detect Cluster properties | ir: Add machinery to detect Cluster properties
| Python | mit | opesci/devito,opesci/devito | ---
+++
@@ -1,8 +1,40 @@
+from collections import OrderedDict
+
+from devito.ir.clusters.queue import Queue
from devito.ir.support import (SEQUENTIAL, PARALLEL, PARALLEL_IF_ATOMIC, VECTOR,
TILABLE, WRAPPABLE)
+from devito.tools import timed_pass
__all__ = ['analyze']
+class Sta... |
b362e6060abe631f25e5227664df4e1670f4d630 | registration/admin.py | registration/admin.py | from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfile, RegistrationAdmin)
| from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
raw_id_fields = ['user']
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfil... | Use raw_id_fields for the relation from RegistrationProfile to User, for sites which have huge numbers of users. | Use raw_id_fields for the relation from RegistrationProfile to User, for sites which have huge numbers of users.
| Python | bsd-3-clause | arpitremarkable/django-registration,sergafts/django-registration,wy123123/django-registration,wda-hb/test,furious-luke/django-registration,imgmix/django-registration,matejkloska/django-registration,PetrDlouhy/django-registration,pando85/django-registration,yorkedork/django-registration,pando85/django-registration,perci... | ---
+++
@@ -5,6 +5,7 @@
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
+ raw_id_fields = ['user']
search_fields = ('user__username', 'user__first_name')
|
47f2ee4587df189864029a2260b642547ea7355f | config.py | config.py | #Package startup stuff so people can start their iPython session with
#
#run PyQLab /path/to/cfgFile and be up and running
#Package imports
import numpy as np
#Load the configuration from the json file and populate the global configuration dictionary
import json
import os.path
import sys
PyQLabCfgFile = os.path.join... | #Package startup stuff so people can start their iPython session with
#
#run PyQLab /path/to/cfgFile and be up and running
#Package imports
import numpy as np
#Load the configuration from the json file and populate the global configuration dictionary
import json
import os.path
import sys
PyQLabCfgFile = os.path.join... | Put empty string in for quickPickFile if it doesn't exist. | Put empty string in for quickPickFile if it doesn't exist.
| Python | apache-2.0 | Plourde-Research-Lab/PyQLab,BBN-Q/PyQLab,rmcgurrin/PyQLab,calebjordan/PyQLab | ---
+++
@@ -21,7 +21,7 @@
instrumentLibFile = PyQLabCfg['InstrumentLibraryFile']
sweepLibFile = PyQLabCfg['SweepLibraryFile']
measurementLibFile = PyQLabCfg['MeasurementLibraryFile']
- quickpickFile = PyQLabCfg['QuickPickFile'] if 'QuickPickFile' in PyQLabCfg else None
+ quickpickFile = PyQLabCfg['QuickPickFile... |
d60b0ee8c212728721f47cc57303ae24888cc387 | models.py | models.py | import datetime
import math
from flask import Markup
from peewee import Model, TextField, DateTimeField
from app import db
class Quote(Model):
content = TextField()
timestamp = DateTimeField(default=datetime.datetime.now)
class Meta:
database = db
def html(self):
return Markup(self... | import datetime
import math
from flask import Markup
from peewee import Model, TextField, DateTimeField
from app import db
class Quote(Model):
content = TextField()
timestamp = DateTimeField(default=datetime.datetime.now)
class Meta:
database = db
def html(self):
return Markup(self... | Add support for carriage returns | Add support for carriage returns
| Python | apache-2.0 | agateau/tmc2,agateau/tmc2 | ---
+++
@@ -15,7 +15,7 @@
database = db
def html(self):
- return Markup(self.content)
+ return Markup(self.content.replace('\n', '<br>'))
@classmethod
def paged(cls, page, page_size): |
37333506e6866e7d0859c5068f115a3e1b9dec3a | test/test_coordinate.py | test/test_coordinate.py | import unittest
from src import coordinate
class TestRules(unittest.TestCase):
""" Tests for the coordinate module """
def test_get_x_board(self):
board_location = coordinate.Coordinate(4, 6)
expected_result = 4
actual_result = board_location.get_x_board()
self.assertEqual(actu... | import unittest
from src import coordinate
class TestRules(unittest.TestCase):
""" Tests for the coordinate module """
def test_get_x_board(self):
board_location = coordinate.Coordinate(4, 6)
expected_result = 4
actual_result = board_location.get_x_board()
self.assertEqual(actu... | Add unit tests for fail fast logic in convertCharToInt() | Add unit tests for fail fast logic in convertCharToInt()
| Python | mit | blairck/jaeger | ---
+++
@@ -27,3 +27,12 @@
expected_result = 5
actual_result = board_location.get_y_array()
self.assertEqual(actual_result, expected_result)
+
+ def test_coordinate_bad_x(self):
+ self.assertRaises(TypeError, coordinate.Coordinate, "4", 6)
+
+ def test_coordinate_bad_y(self):
+... |
4622c1d2623468503b5d51683f953b82ca611b35 | vumi/demos/tests/test_static_reply.py | vumi/demos/tests/test_static_reply.py | from twisted.internet.defer import inlineCallbacks
from vumi.application.tests.utils import ApplicationTestCase
from vumi.demos.static_reply import StaticReplyApplication
class TestStaticReplyApplication(ApplicationTestCase):
application_class = StaticReplyApplication
@inlineCallbacks
def test_receive_m... | from twisted.internet.defer import inlineCallbacks
from vumi.application.tests.helpers import ApplicationHelper
from vumi.demos.static_reply import StaticReplyApplication
from vumi.tests.helpers import VumiTestCase
class TestStaticReplyApplication(VumiTestCase):
def setUp(self):
self.app_helper = Applica... | Switch static_reply tests to new helpers. | Switch static_reply tests to new helpers.
| Python | bsd-3-clause | vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi,harrissoerja/vumi | ---
+++
@@ -1,24 +1,27 @@
from twisted.internet.defer import inlineCallbacks
-from vumi.application.tests.utils import ApplicationTestCase
+from vumi.application.tests.helpers import ApplicationHelper
from vumi.demos.static_reply import StaticReplyApplication
+from vumi.tests.helpers import VumiTestCase
-clas... |
bb04512cdf264a3ef87f3d0093db9fe10723a668 | core/wsgi.py | core/wsgi.py | """
WSGI config for core project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS... | """
WSGI config for core project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os, sys, site
site.addsitedir('/usr/local/share/virtualenvs/guhema/lib/python3.4/site-package... | Add pathts for apache deployment | Add pathts for apache deployment
| Python | mit | n2o/guhema,n2o/guhema | ---
+++
@@ -7,10 +7,10 @@
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
-import os
+import os, sys, site
+site.addsitedir('/usr/local/share/virtualenvs/guhema/lib/python3.4/site-packages')
+sys.path.append('/var/www/vhosts/guhema.com/httpdocs/django')
+os.environ.setdefault("DJANGO_SETTINGS_MOD... |
1c1f2cab677ead5f3cf3aa59c5094a741378e5bc | dame/dame.py | dame/dame.py | __author__ = "Richard Lindsley"
import sys
import sip
sip.setapi('QDate', 2)
sip.setapi('QDateTime', 2)
sip.setapi('QString', 2)
sip.setapi('QTextStream', 2)
sip.setapi('QTime', 2)
sip.setapi('QUrl', 2)
sip.setapi('QVariant', 2)
from PyQt4 import Qt
def main():
qt_app = Qt.QApplication(sys.argv)
label = Qt.Q... | __author__ = "Richard Lindsley"
import sys
#import sip
#sip.setapi('QDate', 2)
#sip.setapi('QDateTime', 2)
#sip.setapi('QString', 2)
#sip.setapi('QTextStream', 2)
#sip.setapi('QTime', 2)
#sip.setapi('QUrl', 2)
#sip.setapi('QVariant', 2)
#from PyQt4 import Qt
from PySide.QtCore import *
from PySide.QtGui import *
d... | Use pyside instead of pyqt4 | Use pyside instead of pyqt4
| Python | mit | richli/dame | ---
+++
@@ -2,19 +2,23 @@
import sys
-import sip
-sip.setapi('QDate', 2)
-sip.setapi('QDateTime', 2)
-sip.setapi('QString', 2)
-sip.setapi('QTextStream', 2)
-sip.setapi('QTime', 2)
-sip.setapi('QUrl', 2)
-sip.setapi('QVariant', 2)
-from PyQt4 import Qt
+#import sip
+#sip.setapi('QDate', 2)
+#sip.setapi('QDateTim... |
08fbd4b934bc4459bb46025620b906e93f8f293e | voer/settings/dev.py | voer/settings/dev.py | '''
Created on 16 Dec 2013
@author: huyvq
'''
from base import *
# FOR DEBUG
DEBUG = True
DEVELOPMENT = True
TEMPLATE_DEBUG = DEBUG
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'voer_django',
... | '''
Created on 16 Dec 2013
@author: huyvq
'''
from base import *
# FOR DEBUG
DEBUG = True
DEVELOPMENT = True
TEMPLATE_DEBUG = DEBUG
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'voer_django',
... | Correct the VPR URL in setting | Correct the VPR URL in setting
| Python | agpl-3.0 | voer-platform/vp.web,voer-platform/vp.web,voer-platform/vp.web,voer-platform/vp.web | ---
+++
@@ -24,7 +24,7 @@
}
#VPR Address
-VPR_URL = 'http://localhost:2013/1.0/'
+VPR_URL = 'http://voer.edu.vn:2013/1.0/'
#VPT Address
VPT_URL = 'http://voer.edu.vn:6543/' |
06542afc4becb4cf3cf96dd15ab240ab4353bf2b | ca/views.py | ca/views.py | from flask import request, render_template
from ca import app, db
from ca.forms import RequestForm
from ca.models import Request
@app.route('/', methods=['GET'])
def index():
return render_template('index.html')
@app.route('/', methods=['POST'])
def post_request():
form = RequestForm(request.form)
if f... | from flask import request, render_template
from ca import app, db
from ca.forms import RequestForm
from ca.models import Request
@app.route('/', methods=['GET'])
def index():
form = RequestForm()
return render_template('index.html', form=form)
@app.route('/', methods=['POST'])
def post_request():
form ... | Create form on index view | Create form on index view
- Need to always pass a form to the view
- make sure to create on for the `GET` view
- Fixes #33
| Python | mit | freifunk-berlin/ca.berlin.freifunk.net,freifunk-berlin/ca.berlin.freifunk.net,freifunk-berlin/ca.berlin.freifunk.net | ---
+++
@@ -7,7 +7,8 @@
@app.route('/', methods=['GET'])
def index():
- return render_template('index.html')
+ form = RequestForm()
+ return render_template('index.html', form=form)
@app.route('/', methods=['POST']) |
fa0f65b6b216a869cc6f1503e7af51481b570b78 | player.py | player.py |
# This is just be a base class / interface to be filled out by
# human and AI players.
# TODO: Undo support?
# TODO: Resign?
# super requires inheriting from object, which clashes with pickle?!
#class Player(object):
class Player():
def __init__(self, p_name):
self.p_name = p_name
self.remaining... |
# This is just be a base class / interface to be filled out by
# human and AI players.
# TODO: Undo support?
# TODO: Resign?
# super requires inheriting from object, which clashes with pickle?!
#class Player(object):
class Player():
def __init__(self, p_name):
self.p_name = p_name
def __repr__(self... | Remove unused time control support (better in Game) | Remove unused time control support (better in Game)
| Python | mit | cropleyb/pentai,cropleyb/pentai,cropleyb/pentai | ---
+++
@@ -10,8 +10,6 @@
class Player():
def __init__(self, p_name):
self.p_name = p_name
- self.remaining_time = 0
- self.total_time = 0
def __repr__(self):
return self.p_name
@@ -31,16 +29,6 @@
del self.name
return name
- def get_total_time(se... |
9605b60fb537714c295dfa0f50313e38f89d2d88 | app.py | app.py | """
This is a simple cheatsheet webapp.
"""
import os
from flask import Flask, send_from_directory
from flask_sslify import SSLify
DIR = os.path.dirname(os.path.realpath(__file__))
ROOT = os.path.join(DIR, 'docs', '_build', 'html')
app = Flask(__name__)
if 'DYNO' in os.environ:
sslify = SSLify(app)
@app.rou... | """
This is a simple cheatsheet webapp.
"""
import os
from flask import Flask, send_from_directory
from flask_sslify import SSLify
DIR = os.path.dirname(os.path.realpath(__file__))
ROOT = os.path.join(DIR, 'docs', '_build', 'html')
def find_key(token):
if token == os.environ.get("ACME_TOKEN"):
return os.... | Add letsencrypt auto renew api :octocat: | Add letsencrypt auto renew api :octocat:
| Python | mit | caimaoy/pysheeet | ---
+++
@@ -9,19 +9,39 @@
DIR = os.path.dirname(os.path.realpath(__file__))
ROOT = os.path.join(DIR, 'docs', '_build', 'html')
+def find_key(token):
+ if token == os.environ.get("ACME_TOKEN"):
+ return os.environ.get("ACME_KEY")
+ for k, v in os.environ.items():
+ if v == token and k.startswit... |
a621a7803d177e4851d229973586d9b114b0f84c | __init__.py | __init__.py | # -*- coding: utf-8 -*-
from flask import Flask
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
import configparser
app = Flask(__name__)
# Security
WTF_CSRF_ENABLED = True
app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR'
# App Config
config = configparser.ConfigParser()
config.read('config/conf... | # -*- coding: utf-8 -*-
from flask import Flask, render_template
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
import configparser
app = Flask(__name__)
# Security
WTF_CSRF_ENABLED = True
app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR'
# App Config
config = configparser.ConfigParser()
config.... | Create a catch-all route and route to the homepage. | Create a catch-all route and route to the homepage.
Signed-off-by: Robert Dempsey <715b5a941e732be1613fdd9d94dfd8e50c02b187@gmail.com>
| Python | mit | rdempsey/weight-tracker,rdempsey/weight-tracker,rdempsey/weight-tracker | ---
+++
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from flask import Flask
+from flask import Flask, render_template
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
import configparser
@@ -29,6 +29,12 @@
register_blueprints(app)
+@app.route('/', defaults={'path': ''})
+@app.route('/... |
01b511b1f337f00eb72530692eec202611599c5a | tilequeue/queue/file.py | tilequeue/queue/file.py | from tilequeue.tile import serialize_coord, deserialize_coord, CoordMessage
import threading
class OutputFileQueue(object):
def __init__(self, fp):
self.fp = fp
self.lock = threading.RLock()
def enqueue(self, coord):
with self.lock:
payload = serialize_coord(coord)
... | from tilequeue.tile import serialize_coord, deserialize_coord, CoordMessage
import threading
class OutputFileQueue(object):
def __init__(self, fp):
self.fp = fp
self.lock = threading.RLock()
def enqueue(self, coord):
with self.lock:
payload = serialize_coord(coord)
... | Fix a bug in OutputFileQueue.close(). | Fix a bug in OutputFileQueue.close().
tilequeue/queue/file.py
-01a8fcb made `OutputFileQueue.read()` use `readline()` instead
of `next()`, but didn't update `OutputFileQueue.close()`, which
uses a list comprehension to grab the rest of the file. Since
`.read()` no longer uses the iteration protocol, `.close()` wil... | Python | mit | mapzen/tilequeue,tilezen/tilequeue | ---
+++
@@ -43,7 +43,6 @@
def close(self):
with self.lock:
- remaining_queue = ''.join([ln for ln in self.fp])
self.clear()
- self.fp.write(remaining_queue)
+ self.fp.write(self.fp.read())
self.fp.close() |
7e8623f750abb9d5d46be25ca184ab0036e7a572 | runapp.py | runapp.py | # Copyright 2014 Dave Kludt
#
# 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, s... | # Copyright 2014 Dave Kludt
#
# 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, s... | Set the host to use all IPs when runap is used | Set the host to use all IPs when runap is used
| Python | apache-2.0 | oldarmyc/anchor,oldarmyc/anchor,oldarmyc/anchor | ---
+++
@@ -16,4 +16,4 @@
if __name__ == '__main__':
- app.run(port=5000, debug=True)
+ app.run(host='0.0.0.0', port=5000, debug=True) |
8d02d9cf5e07951a80bf424334ba59af92cfd6cc | test/suite/out/long_lines.py | test/suite/out/long_lines.py | if True:
if True:
if True:
self.__heap.sort(
) # pylint: builtin sort probably faster than O(n)-time heapify
if True:
foo = '( ' + \
array[0] + ' '
| if True:
if True:
if True:
self.__heap.sort(
) # pylint: builtin sort probably faster than O(n)-time heapify
if True:
foo = '( ' + array[0] + ' '
| Update due to logical line changes | Update due to logical line changes
| Python | mit | vauxoo-dev/autopep8,SG345/autopep8,MeteorAdminz/autopep8,Vauxoo/autopep8,SG345/autopep8,hhatto/autopep8,Vauxoo/autopep8,MeteorAdminz/autopep8,hhatto/autopep8,vauxoo-dev/autopep8 | ---
+++
@@ -2,8 +2,7 @@
if True:
if True:
self.__heap.sort(
- ) # pylint: builtin sort probably faster than O(n)-time heapify
+ ) # pylint: builtin sort probably faster than O(n)-time heapify
if True:
- foo = '( ... |
45c7e910f13a43427359801782eef7ce537d6f5f | delayed_assert/__init__.py | delayed_assert/__init__.py | from delayed_assert.delayed_assert import expect, assert_expectations | import sys
if sys.version_info > (3, 0): # Python 3 and above
from delayed_assert.delayed_assert import expect, assert_expectations
else: # for Python 2
from delayed_assert import expect, assert_expectations
| Support for python 2 and 3 | Support for python 2 and 3 | Python | unlicense | pr4bh4sh/python-delayed-assert | ---
+++
@@ -1 +1,6 @@
-from delayed_assert.delayed_assert import expect, assert_expectations
+import sys
+
+if sys.version_info > (3, 0): # Python 3 and above
+ from delayed_assert.delayed_assert import expect, assert_expectations
+else: # for Python 2
+ from delayed_assert import expect, assert_expectations |
8154b206160cde249c474f5905a60b9a8086c910 | conftest.py | conftest.py | # Copyright (c) 2016,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Configure pytest for metpy."""
import os
import matplotlib
import matplotlib.pyplot
import numpy
import pandas
import pytest
import scipy
import xarray
import metpy.calc
... | # Copyright (c) 2016,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Configure pytest for metpy."""
import os
import matplotlib
import matplotlib.pyplot
import numpy
import pandas
import pooch
import pytest
import scipy
import traitlets
impo... | Print out all dependency versions at the start of pytest | TST: Print out all dependency versions at the start of pytest
| Python | bsd-3-clause | Unidata/MetPy,dopplershift/MetPy,Unidata/MetPy,dopplershift/MetPy | ---
+++
@@ -9,8 +9,10 @@
import matplotlib.pyplot
import numpy
import pandas
+import pooch
import pytest
import scipy
+import traitlets
import xarray
import metpy.calc
@@ -22,11 +24,11 @@
def pytest_report_header(config, startdir):
"""Add dependency information to pytest output."""
- return ('Depe... |
5f62f830d184c0f99b384f0653231dab52fbad50 | conftest.py | conftest.py | import logging
import os
import signal
import subprocess
import time
import pytest
log = logging.getLogger("test")
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s %(levelname)s [%(name)s] %(message)s')
@pytest.fixture
def basedir(tmpdir):
# 1. Create real file system with a special __rea... | import logging
import os
import signal
import subprocess
import time
import pytest
log = logging.getLogger("test")
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s %(levelname)s [%(name)s] %(message)s')
@pytest.fixture
def basedir(tmpdir):
# 1. Create real file system with a special __rea... | Fix tests, broken by making slowfs a script | Fix tests, broken by making slowfs a script
In the tests we must run the script using python so we run with the
correct python from .tox/<env>/bin/python.
| Python | bsd-2-clause | nirs/slowfs | ---
+++
@@ -25,7 +25,7 @@
# 3. Start slowfs
log.debug("Starting slowfs...")
- cmd = ["./slowfs", str(realfs), str(slowfs)]
+ cmd = ["python", "slowfs", str(realfs), str(slowfs)]
if os.environ.get("DEBUG"):
cmd.append("--debug")
p = subprocess.Popen(cmd) |
f7fa8b72b8d8d1b7bfcd6c738520fc87cd20e320 | ixdjango/tests/__init__.py | ixdjango/tests/__init__.py | """
Hook into the test runner
"""
import subprocess
from django.test.simple import DjangoTestSuiteRunner
from django.utils import unittest
from ixdjango.test_suite.utils import (CoreUtilsTests)
class TestRunner(DjangoTestSuiteRunner):
"""
Place where we hook into DjangoTestSuiteRunner
"""
def setu... | """
Hook into the test runner
"""
import subprocess
try:
from django.test.runner import DiscoverRunner as BaseTestRunner
except ImportError:
from django.test.simple import DjangoTestSuiteRunner as BaseTestRunner
from django.utils import unittest
from ixdjango.test_suite.utils import (CoreUtilsTests)
class ... | Use DiscoverRunner from Django 1.6 if available | Use DiscoverRunner from Django 1.6 if available
| Python | mit | infoxchange/ixdjango | ---
+++
@@ -4,13 +4,16 @@
import subprocess
-from django.test.simple import DjangoTestSuiteRunner
+try:
+ from django.test.runner import DiscoverRunner as BaseTestRunner
+except ImportError:
+ from django.test.simple import DjangoTestSuiteRunner as BaseTestRunner
from django.utils import unittest
from ... |
4241c6cbd9625c61a32ded5725e583da2b63a377 | homedisplay/display/views.py | homedisplay/display/views.py | from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.generic import View
from homedisplay.utils import publish_ws
class Wrapped(View):
def get(self, request, *args, **kwargs):
return ... | from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.generic import View
from homedisplay.utils import publish_ws
class Wrapped(View):
def get(self, request, *args, **kwargs):
return ... | Use correct path for frame template | Use correct path for frame template
| Python | bsd-3-clause | ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display | ---
+++
@@ -6,4 +6,4 @@
class Wrapped(View):
def get(self, request, *args, **kwargs):
- return render_to_response("frame.html", {"frame_src": "/homecontroller/display/content/%s" % kwargs.get("view") }, context_instance=RequestContext(request))
+ return render_to_response("main/frame.html", {"fr... |
ee03f3ae0d0501568cec87d8d4d7114441c19776 | conftest.py | conftest.py | collect_ignore = ["setup.py"]
| import tempfile
import shutil
import jedi
collect_ignore = ["setup.py"]
# The following hooks (pytest_configure, pytest_unconfigure) are used
# to modify `jedi.settings.cache_directory` because `clean_jedi_cache`
# has no effect during doctests. Without these hooks, doctests uses
# user's cache (e.g., ~/.cache/je... | Use pytest_(un)configure to setup cache_directory | Use pytest_(un)configure to setup cache_directory
| Python | mit | jonashaag/jedi,jonashaag/jedi,flurischt/jedi,WoLpH/jedi,tjwei/jedi,mfussenegger/jedi,mfussenegger/jedi,tjwei/jedi,dwillmer/jedi,WoLpH/jedi,flurischt/jedi,dwillmer/jedi | ---
+++
@@ -1 +1,34 @@
+import tempfile
+import shutil
+
+import jedi
+
+
collect_ignore = ["setup.py"]
+
+
+# The following hooks (pytest_configure, pytest_unconfigure) are used
+# to modify `jedi.settings.cache_directory` because `clean_jedi_cache`
+# has no effect during doctests. Without these hooks, doctests u... |
62ad2eb82c037350f25d3e575e59f16740365159 | pies/ast.py | pies/ast.py | from __future__ import absolute_import
from ast import *
from .version_info import PY2
if PY2:
Try = TryExcept
def argument_names(node):
return [isinstance(arg, Name) and arg.id or None for arg in node.args.args]
def kw_only_argument_names(node):
return []
def kw_only_default_count... | from __future__ import absolute_import
import sys
from ast import *
from .version_info import PY2
if PY2 or sys.version_info[1] <= 2:
Try = TryExcept
else:
TryFinally = ()
if PY2:
def argument_names(node):
return [isinstance(arg, Name) and arg.id or None for arg in node.args.args]
def kw_on... | Fix small incompatibility with Python 3.2 | Fix small incompatibility with Python 3.2
| Python | mit | lisongmin/pies,AbsoluteMSTR/pies,timothycrosley/pies,AbsoluteMSTR/pies,timothycrosley/pies,lisongmin/pies | ---
+++
@@ -1,12 +1,16 @@
from __future__ import absolute_import
+import sys
from ast import *
from .version_info import PY2
+if PY2 or sys.version_info[1] <= 2:
+ Try = TryExcept
+else:
+ TryFinally = ()
+
if PY2:
- Try = TryExcept
-
def argument_names(node):
return [isinstance(arg, ... |
5cbf2988e9064a49e2d745694c8233513be63a0b | openings_mover.py | openings_mover.py | import random
import pdb
from defines import *
class OpeningsMover(object):
def __init__(self, o_mgr, game):
self.o_mgr = o_mgr
self.game = game
def get_a_good_move(self):
wins = 0
losses = 0
totals = []
colour = self.game.to_move_colour()
max_rating_f... | import random
import pdb
from defines import *
class OpeningsMover(object):
def __init__(self, o_mgr, game):
self.o_mgr = o_mgr
self.game = game
def get_a_good_move(self):
wins = 0
losses = 0
totals = []
colour = self.game.to_move_colour()
max_rating_f... | Use preserved games for opening move selection | Use preserved games for opening move selection
| Python | mit | cropleyb/pentai,cropleyb/pentai,cropleyb/pentai | ---
+++
@@ -20,22 +20,21 @@
for mg in move_games:
move, games = mg
- for g in games:
- win_colour = g.get_won_by()
+ for pg in games:
+ win_colour = pg.won_by
if win_colour == colour:
wins += 1
... |
99bcbd8795f3e2b1a10ac8fa81dd69d1cad7c022 | yunity/api/serializers.py | yunity/api/serializers.py | def user(model):
if not model.is_authenticated():
return {}
return {
'id': model.id,
'display_name': model.display_name,
'first_name': model.first_name,
'last_name': model.last_name,
}
def category(model):
return {
'id': model.id,
'name': model.... | def user(model):
if not model.is_authenticated():
return {}
return {
'id': model.id,
'display_name': model.display_name,
'first_name': model.first_name,
'last_name': model.last_name,
}
def category(model):
return {
'id': model.id,
'name': model.... | Allow empty conversations to be serialized | Allow empty conversations to be serialized
A conversation may exist without any content. The serializer then
returns an empty message value.
| Python | agpl-3.0 | yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core | ---
+++
@@ -30,9 +30,12 @@
def conversation_message(model):
- return {
- 'id': model.id,
- 'sender': model.sent_by_id,
- 'created_at': model.created_at.isoformat(),
- 'content': model.content,
- }
+ if model:
+ return {
+ 'id': model.id,
+ 'sender... |
d6f2b132844d1923932447c0ce67c581f723f433 | wagtail/wagtailadmin/menu.py | wagtail/wagtailadmin/menu.py | from __future__ import unicode_literals
from six import text_type
from django.utils.text import slugify
from django.utils.html import format_html
class MenuItem(object):
def __init__(self, label, url, name=None, classnames='', order=1000):
self.label = label
self.url = url
self.classname... | from __future__ import unicode_literals
from six import text_type
try:
# renamed util -> utils in Django 1.7; try the new name first
from django.forms.utils import flatatt
except ImportError:
from django.forms.util import flatatt
from django.utils.text import slugify
from django.utils.html import format_... | Support passing html attributes into MenuItem | Support passing html attributes into MenuItem
| Python | bsd-3-clause | JoshBarr/wagtail,m-sanders/wagtail,hamsterbacke23/wagtail,benemery/wagtail,jordij/wagtail,nutztherookie/wagtail,mixxorz/wagtail,nutztherookie/wagtail,dresiu/wagtail,serzans/wagtail,mixxorz/wagtail,bjesus/wagtail,nrsimha/wagtail,nilnvoid/wagtail,inonit/wagtail,torchbox/wagtail,wagtail/wagtail,dresiu/wagtail,davecranwell... | ---
+++
@@ -1,20 +1,31 @@
from __future__ import unicode_literals
from six import text_type
+
+try:
+ # renamed util -> utils in Django 1.7; try the new name first
+ from django.forms.utils import flatatt
+except ImportError:
+ from django.forms.util import flatatt
from django.utils.text import slugif... |
a056c630a197a070e55cce9f76124d56ba781e52 | app/views/main.py | app/views/main.py | from flask import Blueprint, render_template
from flask_login import login_required
main = Blueprint("main", __name__)
@main.route("/")
@main.route("/index")
@login_required
def index():
return "Logged in"
@main.route("/login")
def login():
return render_template("login.html") | from flask import Blueprint, render_template, g, redirect, url_for
from flask_login import login_required, current_user, logout_user
main = Blueprint("main", __name__)
@main.route("/")
@main.route("/index")
@login_required
def index():
return "Logged in"
@main.route("/login")
def login():
if g.user.is_auth... | Add logout and auth checks | Add logout and auth checks
| Python | mit | Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary | ---
+++
@@ -1,5 +1,5 @@
-from flask import Blueprint, render_template
-from flask_login import login_required
+from flask import Blueprint, render_template, g, redirect, url_for
+from flask_login import login_required, current_user, logout_user
main = Blueprint("main", __name__)
@@ -13,4 +13,18 @@
@main.route... |
9c07f8fdb9c955f49cf6ff92a25b1c0629157811 | assembler6502.py | assembler6502.py | #! /usr/bin/env python
import sys
import assembler6502_tokenizer as tokenizer
import assembler6502_parser as parser
def output_byte(hexcode):
sys.stdout.write(hexcode)
#sys.stdout.write(chr(int(hexcode, 16)))
def main():
code = """
; sample code
beginning:
sty $44,X
"""
for line in code.split... | #! /usr/bin/env python
import sys
import assembler6502_tokenizer as tokenizer
import assembler6502_parser as parser
def output_byte(hexcode):
sys.stdout.write(hexcode + "\n")
#sys.stdout.write(chr(int(hexcode, 16)))
def main():
code = sys.stdin.read()
for line in code.split("\n"):
hexcodes = ... | Use stdin for assembler input | Use stdin for assembler input
| Python | mit | technetia/project-tdm,technetia/project-tdm,technetia/project-tdm | ---
+++
@@ -5,20 +5,15 @@
import assembler6502_parser as parser
def output_byte(hexcode):
- sys.stdout.write(hexcode)
+ sys.stdout.write(hexcode + "\n")
#sys.stdout.write(chr(int(hexcode, 16)))
def main():
- code = """
-; sample code
-beginning:
- sty $44,X
- """
+ code = sys.stdin.read(... |
358df6514b19424d5576d7a0a74ea15d71a3565b | canaryd/subprocess.py | canaryd/subprocess.py | import os
import shlex
import sys
from canaryd_packages import six
# Not ideal but using the vendored in (to requests) chardet package
from canaryd_packages.requests.packages import chardet
from canaryd.log import logger
if os.name == 'posix' and sys.version_info[0] < 3:
from canaryd_packages.subprocess32 impor... | import os
import shlex
import sys
from canaryd_packages import six
# Not ideal but using the vendored in (to requests) chardet package
from canaryd_packages.requests.packages import chardet
from canaryd.log import logger
if os.name == 'posix' and sys.version_info[0] < 3:
from canaryd_packages.subprocess32 impor... | Fix for python2.6: decode doesn't take keyword arguments. | Fix for python2.6: decode doesn't take keyword arguments.
| Python | mit | Oxygem/canaryd,Oxygem/canaryd | ---
+++
@@ -33,6 +33,6 @@
if isinstance(output, six.binary_type):
encoding = chardet.detect(output)['encoding']
- output = output.decode(encoding=encoding)
+ output = output.decode(encoding)
return output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.