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 |
|---|---|---|---|---|---|---|---|---|---|---|
b8139440a2509d5b197889664f9ec34be9296210 | form_designer/contrib/cms_plugins/form_designer_form/cms_plugins.py | form_designer/contrib/cms_plugins/form_designer_form/cms_plugins.py | from form_designer.contrib.cms_plugins.form_designer_form.models import CMSFormDefinition
from form_designer.views import process_form
from form_designer import settings
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
class FormDes... | from form_designer.contrib.cms_plugins.form_designer_form.models import CMSFormDefinition
from form_designer.views import process_form
from form_designer import settings
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
class FormDes... | Disable caching so CSRF tokens are not cached. | Disable caching so CSRF tokens are not cached.
| Python | bsd-3-clause | USGM/django-form-designer,USGM/django-form-designer | ---
+++
@@ -14,6 +14,7 @@
name = _('Form')
admin_preview = False
render_template = False
+ cache = False
def render(self, context, instance, placeholder):
if instance.form_definition.form_template_name: |
21f209b618850d15734c476bd3c1b359b9a7426e | infosystem/queue.py | infosystem/queue.py | import flask
from pika import BlockingConnection, PlainCredentials, ConnectionParameters
class RabbitMQ:
def __init__(self):
self.url = flask.current_app.config['ORMENU_QUEUE_URL']
self.port = flask.current_app.config['ORMENU_QUEUE_PORT']
self.virtual_host = \
flask.current_ap... | import flask
from pika import BlockingConnection, PlainCredentials, ConnectionParameters
class RabbitMQ:
def __init__(self):
self.url = flask.current_app.config['INFOSYSTEM_QUEUE_URL']
self.port = flask.current_app.config['INFOSYSTEM_QUEUE_PORT']
self.virtual_host = \
flask.cu... | Use INFOSYSTEM enviroment for Queue | Use INFOSYSTEM enviroment for Queue
| Python | apache-2.0 | samueldmq/infosystem | ---
+++
@@ -5,12 +5,12 @@
class RabbitMQ:
def __init__(self):
- self.url = flask.current_app.config['ORMENU_QUEUE_URL']
- self.port = flask.current_app.config['ORMENU_QUEUE_PORT']
+ self.url = flask.current_app.config['INFOSYSTEM_QUEUE_URL']
+ self.port = flask.current_app.config['... |
305ba7ee3fff41a7d866968c5332394301c0e83f | digi/wagtail_hooks.py | digi/wagtail_hooks.py | from wagtail.contrib.modeladmin.options import \
ModelAdmin, ModelAdminGroup, modeladmin_register
from .models import Indicator, FooterLinkSection
class IndicatorAdmin(ModelAdmin):
model = Indicator
menu_icon = 'user'
class FooterLinkSectionAdmin(ModelAdmin):
model = FooterLinkSection
menu_icon ... | from wagtail.contrib.modeladmin.options import \
ModelAdmin, ModelAdminGroup, modeladmin_register
from .models import Indicator, FooterLinkSection
from django.utils.html import format_html
from wagtail.wagtailcore import hooks
class IndicatorAdmin(ModelAdmin):
model = Indicator
menu_icon = 'user'
class ... | Enable HTML source editing in the content editor | Enable HTML source editing in the content editor
| Python | mit | terotic/digihel,City-of-Helsinki/digihel,terotic/digihel,City-of-Helsinki/digihel,City-of-Helsinki/digihel,terotic/digihel,City-of-Helsinki/digihel | ---
+++
@@ -1,6 +1,8 @@
from wagtail.contrib.modeladmin.options import \
ModelAdmin, ModelAdminGroup, modeladmin_register
from .models import Indicator, FooterLinkSection
+from django.utils.html import format_html
+from wagtail.wagtailcore import hooks
class IndicatorAdmin(ModelAdmin):
@@ -18,3 +20,15 @@
... |
c8fdc9aaea13567a293237e7a4126f83a52f0a22 | 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 |
60497ba61c80863cd0414e39a9cd12b42b519897 | chainer/training/extensions/value_observation.py | chainer/training/extensions/value_observation.py | from chainer.training import extension
import time
def observe_value(key, target_func):
"""Returns a trainer extension to continuously record a value.
Args:
key (str): Key of observation to record.
target_func (function): Function that returns the value to record.
It must take one... | import time
from chainer.training import extension
def observe_value(key, target_func):
"""Returns a trainer extension to continuously record a value.
Args:
key (str): Key of observation to record.
target_func (function): Function that returns the value to record.
It must take on... | Split system import and project import | Split system import and project import
| Python | mit | cupy/cupy,chainer/chainer,keisuke-umezawa/chainer,wkentaro/chainer,okuta/chainer,ktnyt/chainer,wkentaro/chainer,jnishi/chainer,tkerola/chainer,keisuke-umezawa/chainer,jnishi/chainer,niboshi/chainer,delta2323/chainer,keisuke-umezawa/chainer,ktnyt/chainer,chainer/chainer,ysekky/chainer,chainer/chainer,keisuke-umezawa/cha... | ---
+++
@@ -1,5 +1,6 @@
+import time
+
from chainer.training import extension
-import time
def observe_value(key, target_func): |
2b11762c418d1a985c3bd64d76abbf9b515bb8da | scanpointgenerator/compat.py | scanpointgenerator/compat.py | import os
try:
range_ = xrange
except NameError:
# For Python3
range_ = range
if os.name == 'java':
import scisoftpy as numpy
else:
import numpy
np = numpy
| import os
try:
range_ = xrange
except NameError:
# For Python3
range_ = range
if os.name == 'java':
import numjy as numpy
else:
import numpy
np = numpy
| Replace scisoftpy import with numjy | Replace scisoftpy import with numjy
| Python | apache-2.0 | dls-controls/scanpointgenerator | ---
+++
@@ -8,7 +8,7 @@
if os.name == 'java':
- import scisoftpy as numpy
+ import numjy as numpy
else:
import numpy
|
1f22226575455349b3417cdae70a7a5b7181c3b3 | tests/test_wikibugs2.py | tests/test_wikibugs2.py | import wikibugs
import configfetcher
import unittest
import os
p = os.path.split(__file__)[0]
class TestWikibugs(unittest.TestCase):
def setUp(self):
self.bugs = wikibugs.Wikibugs2(
configfetcher.ConfigFetcher()
)
def test_offline_scrape(self):
content = open(p + "/T87834... | # encoding: utf-8
import wikibugs
import configfetcher
import unittest
import os
import requests
p = os.path.split(__file__)[0]
class TestWikibugs(unittest.TestCase):
def setUp(self):
self.bugs = wikibugs.Wikibugs2(
configfetcher.ConfigFetcher()
)
def run_scrape(self, content):
... | Add online project scrape test | Add online project scrape test
Change-Id: Idc112f9397ac2f2fcfe51ca60259b257dff86e91
| Python | mit | wikimedia/labs-tools-wikibugs2,wikimedia/labs-tools-wikibugs2 | ---
+++
@@ -1,7 +1,9 @@
+# encoding: utf-8
import wikibugs
import configfetcher
import unittest
import os
+import requests
p = os.path.split(__file__)[0]
@@ -12,8 +14,7 @@
configfetcher.ConfigFetcher()
)
- def test_offline_scrape(self):
- content = open(p + "/T87834", encodi... |
a774f3750b506c77f2c37d08b3d33dc66da2a12d | jsonmapping/util.py | jsonmapping/util.py | import os
import json
from jsonschema import Draft4Validator
def validate_mapping(mapping):
""" Validate a mapping configuration file against the relevant schema. """
file_path = os.path.join(os.path.dirname(__file__),
'schemas', 'mapping.json')
with open(file_path, 'rb') as ... | import os
import json
from jsonschema import Draft4Validator
def validate_mapping(mapping):
""" Validate a mapping configuration file against the relevant schema. """
file_path = os.path.join(os.path.dirname(__file__),
'schemas', 'mapping.json')
with open(file_path, 'r') as f... | Fix python 3 compat. BREAKS python 2.x | Fix python 3 compat. BREAKS python 2.x
| Python | mit | Ramblurr/jsonmapping | ---
+++
@@ -8,7 +8,7 @@
""" Validate a mapping configuration file against the relevant schema. """
file_path = os.path.join(os.path.dirname(__file__),
'schemas', 'mapping.json')
- with open(file_path, 'rb') as fh:
+ with open(file_path, 'r') as fh:
validator = Dr... |
64d17f591bfde49d3a7b5f49f987c1138eecebf8 | tests/source/start_trace.py | tests/source/start_trace.py | """Write some logs."""
import sys
import time
from mdk import start
mdk = start()
def main():
session = mdk.session()
session.info("process1", "hello")
time.sleep(1)
sys.stdout.write(session.inject())
sys.stdout.flush()
mdk.stop()
if __name__ == '__main__':
main()
| """Write some logs."""
import sys
import time
from mdk import start
mdk = start()
def main():
session = mdk.session()
session.info("process1", "hello")
time.sleep(5)
sys.stdout.write(session.inject())
sys.stdout.flush()
mdk.stop()
if __name__ == '__main__':
main()
| Increase sleep in test to reduce timing sensitivity with prod servers. | Increase sleep in test to reduce timing sensitivity with prod servers.
| Python | apache-2.0 | datawire/mdk,datawire/mdk,datawire/mdk,datawire/mdk | ---
+++
@@ -10,7 +10,7 @@
def main():
session = mdk.session()
session.info("process1", "hello")
- time.sleep(1)
+ time.sleep(5)
sys.stdout.write(session.inject())
sys.stdout.flush()
mdk.stop() |
14ea472acfce8b5317a8c8c970db901501ea34c0 | _tests/macro_testing/runner.py | _tests/macro_testing/runner.py | # -*- coding: utf-8 -*-
import os, os.path
import sys
import unittest
from macrotest import JSONSpecMacroTestCaseFactory
def JSONTestCaseLoader(tests_path, recursive=False):
"""
Load JSON specifications for Jinja2 macro test cases from the given
path and returns the resulting test classes.
This fun... | # -*- coding: utf-8 -*-
import os, os.path
import sys
import unittest
from macrotest import JSONSpecMacroTestCaseFactory
def JSONTestCaseLoader(tests_path, recursive=False):
"""
Load JSON specifications for Jinja2 macro test cases from the given
path and returns the resulting test classes.
This fun... | Make the paths not relative, so tests can be run from anywhere. | Make the paths not relative, so tests can be run from anywhere.
| Python | cc0-1.0 | kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh | ---
+++
@@ -18,8 +18,9 @@
If `recursive` is True, it will also look in subdirectories. This is
not yet supported.
"""
+ path = os.path.abspath(os.path.join(os.path.dirname( __file__ ), tests_path))
- json_files = [f for f in os.listdir(tests_path) if f.endswith('.json')]
+ json_files = [f fo... |
90699f4fa6c1ce2b02e81a8fef9bfafd2175fa7f | kmapper/__init__.py | kmapper/__init__.py | from .kmapper import KeplerMapper
from .kmapper import cluster
from .kmapper import Cover
from .kmapper import GraphNerve
| from .kmapper import KeplerMapper
from .kmapper import cluster
from .cover import Cover
from .nerve import GraphNerve
import pkg_resources
__version__ = pkg_resources.get_distribution('kmapper').version
| Add __version__ variable to package | Add __version__ variable to package
| Python | mit | MLWave/kepler-mapper,MLWave/kepler-mapper,MLWave/kepler-mapper | ---
+++
@@ -1,4 +1,6 @@
from .kmapper import KeplerMapper
from .kmapper import cluster
-from .kmapper import Cover
-from .kmapper import GraphNerve
+from .cover import Cover
+from .nerve import GraphNerve
+import pkg_resources
+__version__ = pkg_resources.get_distribution('kmapper').version |
884852eeb2dec07dccefc26595f097ec9ae8532b | forum/forms.py | forum/forms.py | from django.forms import ModelForm,Textarea
from .models import Post
class PostForm(ModelForm):
class Meta:
model = Post
fields = ('subject','body')
widgets = {
'body': Textarea(
attrs={
'data-provide':'markdown',
... | from django.forms import ModelForm,Textarea,TextInput
from .models import Post
class PostForm(ModelForm):
class Meta:
model = Post
fields = ('subject','body')
widgets = {
'subject': TextInput(attrs={'autofocus':'autofocus'}),
'body': Textarea(
... | Add autofocus to subject field | Add autofocus to subject field
| Python | mit | Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters | ---
+++
@@ -1,4 +1,4 @@
-from django.forms import ModelForm,Textarea
+from django.forms import ModelForm,Textarea,TextInput
from .models import Post
@@ -9,6 +9,7 @@
model = Post
fields = ('subject','body')
widgets = {
+ 'subject': TextInput(attrs={'autofocus':'autofocus'... |
16553fd759e70d93824407f18cdea419703d85d4 | gcn/metrics.py | gcn/metrics.py | import tensorflow as tf
def masked_softmax_cross_entropy(preds, labels, mask):
"""Softmax cross-entropy loss with masking."""
loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, lables=labels)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(mask)
loss *= mask
return tf.r... | import tensorflow as tf
def masked_softmax_cross_entropy(preds, labels, mask):
"""Softmax cross-entropy loss with masking."""
loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(mask)
loss *= mask
return tf.r... | Fix typo for named argument | Fix typo for named argument | Python | mit | tkipf/gcn | ---
+++
@@ -3,7 +3,7 @@
def masked_softmax_cross_entropy(preds, labels, mask):
"""Softmax cross-entropy loss with masking."""
- loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, lables=labels)
+ loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels)
mask = tf.cast(ma... |
1b7634e3a98919df5f2f4d54c57bb72dfbf308df | py3-test/tests.py | py3-test/tests.py | # -*- coding: utf-8 -*-
import nose.tools as nt
from asyncio import get_event_loop
from asyncio import sleep as async_sleep
from pyee import EventEmitter
def test_async_emit():
"""Test that event_emitters can handle wrapping coroutines
"""
ee = EventEmitter()
loop = get_event_loop()
class Sense... | # -*- coding: utf-8 -*-
import nose.tools as nt
from asyncio import Future, gather, get_event_loop, sleep
from pyee import EventEmitter
def test_async_emit():
"""Test that event_emitters can handle wrapping coroutines
"""
loop = get_event_loop()
ee = EventEmitter(loop=loop)
future = Future()
... | Rewrite asyncio test to use futures | Rewrite asyncio test to use futures
| Python | mit | jfhbrook/pyee | ---
+++
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
-
import nose.tools as nt
-from asyncio import get_event_loop
-from asyncio import sleep as async_sleep
+from asyncio import Future, gather, get_event_loop, sleep
from pyee import EventEmitter
@@ -10,26 +8,25 @@
def test_async_emit():
"""Test that event_emi... |
a8bb719061a68b5d322868768203476c4ee1e9b9 | gnocchi/cli.py | gnocchi/cli.py | # Copyright (c) 2013 Mirantis 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 (c) 2013 Mirantis 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... | Connect to database before upgrading it | Connect to database before upgrading it
This change ensure we are connected to the database before
we upgrade it.
Change-Id: Ia0be33892a99897ff294d004f4d935f3753e6200
| Python | apache-2.0 | idegtiarov/gnocchi-rep,leandroreox/gnocchi,sileht/gnocchi,idegtiarov/gnocchi-rep,gnocchixyz/gnocchi,sileht/gnocchi,idegtiarov/gnocchi-rep,gnocchixyz/gnocchi,leandroreox/gnocchi | ---
+++
@@ -23,6 +23,7 @@
def storage_dbsync():
service.prepare_service()
indexer = sql_db.SQLAlchemyIndexer(cfg.CONF)
+ indexer.connect()
indexer.upgrade()
|
45fcbaa7515faaa2f812bd9ceb0800fbeb64f1e7 | pytest_pycharm.py | pytest_pycharm.py | # -*- coding: utf-8 -*-
import threading
def pytest_exception_interact(node, call, report):
"""
Drop into PyCharm debugger, if available, on uncaught exceptions.
"""
try:
import pydevd
from pydevd import pydevd_tracing
except ImportError:
pass
else:
exctype, val... | # -*- coding: utf-8 -*-
import threading
def pytest_exception_interact(node, call, report):
"""
Drop into PyCharm debugger, if available, on uncaught exceptions.
"""
try:
import pydevd
from pydevd import pydevd_tracing
except ImportError:
pass
else:
exctype, val... | Fix for pycharm 4.0.0 changes | Fix for pycharm 4.0.0 changes
| Python | bsd-3-clause | jlubcke/pytest-pycharm | ---
+++
@@ -24,7 +24,8 @@
thread.additionalInfo.pydev_force_stop_at_exception = (frame, frames_by_id)
thread.additionalInfo.message = "test fail"
debugger = pydevd.debugger
- debugger.force_post_mortem_stop += 1
+ if hasattr(debugger, "force_post_mortem_stop"):
+ de... |
68fa1fd0df0f4048ac32e80698ebd872fb1f7fba | pytest_pycharm.py | pytest_pycharm.py | # -*- coding: utf-8 -*-
import threading
def pytest_exception_interact(node, call, report):
"""
Drop into PyCharm debugger, if available, on uncaught exceptions.
"""
try:
import pydevd
from pydevd import pydevd_tracing
except ImportError:
pass
else:
exctype, val... | # -*- coding: utf-8 -*-
import threading
def pytest_exception_interact(node, call, report):
"""
Drop into PyCharm debugger, if available, on uncaught exceptions.
"""
try:
import pydevd
from pydevd import pydevd_tracing
except ImportError:
pass
else:
exctype, val... | Fix stopping on a breakpoint for PyCharm 2017.3 | Fix stopping on a breakpoint for PyCharm 2017.3
| Python | bsd-3-clause | jlubcke/pytest-pycharm | ---
+++
@@ -22,7 +22,10 @@
frame = frames[-1]
exception = (exctype, value, traceback)
thread.additional_info.pydev_message = 'test fail'
- debugger = pydevd.debugger
+ try:
+ debugger = pydevd.debugger
+ except AttributeError:
+ debugger = pydevd.g... |
82740c7956a2bae0baceedd658b9ad9352254ad0 | nlppln/wfgenerator.py | nlppln/wfgenerator.py | from scriptcwl import WorkflowGenerator as WFGenerator
from .utils import CWL_PATH
class WorkflowGenerator(WFGenerator):
def __init__(self, working_dir=None, copy_steps=True):
WFGenerator.__init__(self, steps_dir=CWL_PATH, working_dir=working_dir,
copy_steps=copy_steps)
... | from scriptcwl import WorkflowGenerator as WFGenerator
from .utils import CWL_PATH
class WorkflowGenerator(WFGenerator):
def __init__(self, working_dir=None):
WFGenerator.__init__(self, steps_dir=CWL_PATH, working_dir=working_dir)
def save(self, fname, validate=True, wd=True, inline=False, relative=... | Update to use newest (unreleased) scriptcwl options | Update to use newest (unreleased) scriptcwl options
| Python | apache-2.0 | WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln | ---
+++
@@ -4,18 +4,20 @@
class WorkflowGenerator(WFGenerator):
- def __init__(self, working_dir=None, copy_steps=True):
- WFGenerator.__init__(self, steps_dir=CWL_PATH, working_dir=working_dir,
- copy_steps=copy_steps)
+ def __init__(self, working_dir=None):
+ WFG... |
b728470c61fbd742052e5befb4c27adbacef1a7e | pinax_theme_bootstrap/templatetags/pinax_theme_bootstrap_tags.py | pinax_theme_bootstrap/templatetags/pinax_theme_bootstrap_tags.py | from django import template
from django.contrib.messages.utils import get_level_tags
LEVEL_TAGS = get_level_tags()
register = template.Library()
@register.simple_tag()
def get_message_tags(message):
"""
Returns tags for a message
"""
level_name = LEVEL_TAGS[message.level]
if level_name == u"err... | from django import template
from django.contrib.messages.utils import get_level_tags
LEVEL_TAGS = get_level_tags()
register = template.Library()
@register.simple_tag()
def get_message_tags(message):
"""
Returns the message's level_tag prefixed with Bootstrap's "alert-" prefix
along with any tags includ... | Use level_tag to be consistent with Django >= 1.7 | Use level_tag to be consistent with Django >= 1.7
| Python | mit | grahamu/pinax-theme-bootstrap,jacobwegner/pinax-theme-bootstrap,foraliving/foraliving,jacobwegner/pinax-theme-bootstrap,druss16/danslist,druss16/danslist,foraliving/foraliving,foraliving/foraliving,grahamu/pinax-theme-bootstrap,jacobwegner/pinax-theme-bootstrap,grahamu/pinax-theme-bootstrap,druss16/danslist | ---
+++
@@ -10,15 +10,18 @@
@register.simple_tag()
def get_message_tags(message):
"""
- Returns tags for a message
+ Returns the message's level_tag prefixed with Bootstrap's "alert-" prefix
+ along with any tags included in message.extra_tags
+
+ Messages in Django >= 1.7 have a message.level_tag ... |
fec7885d2632b887002f0071f4898faf52dd927c | chainerx/__init__.py | chainerx/__init__.py | import sys
if sys.version_info[0] < 3:
_available = False
else:
try:
from chainerx import _core
_available = True
except Exception:
_available = False
if _available:
from numpy import dtype, bool_, int8, int16, int32, int64, uint8, float32, float64 # NOQA
from chainerx.... | import sys
if sys.version_info[0] < 3:
_available = False
else:
try:
from chainerx import _core
_available = True
except Exception:
_available = False
if _available:
from numpy import dtype, bool_, int8, int16, int32, int64, uint8, float32, float64 # NOQA
from chainerx.... | Raise an error on dummy class init | Raise an error on dummy class init
| Python | mit | okuta/chainer,jnishi/chainer,chainer/chainer,ktnyt/chainer,ktnyt/chainer,okuta/chainer,hvy/chainer,niboshi/chainer,ktnyt/chainer,chainer/chainer,ktnyt/chainer,hvy/chainer,wkentaro/chainer,jnishi/chainer,jnishi/chainer,okuta/chainer,wkentaro/chainer,keisuke-umezawa/chainer,niboshi/chainer,chainer/chainer,keisuke-umezawa... | ---
+++
@@ -34,7 +34,11 @@
_numpy_compat_workarounds.populate()
else:
class ndarray(object):
- pass # for type testing
+
+ """Dummy class for type testing."""
+
+ def __init__(self, *args, **kwargs):
+ raise RuntimeError('chainerx is not available.')
def is_available()... |
f16c8f696a282da6c04de6b7530f1d0316eda88b | providers/edu/harvarddataverse/normalizer.py | providers/edu/harvarddataverse/normalizer.py | import arrow
import dateparser
from share.normalize import *
class Person(Parser):
given_name = ParseName(ctx).first
family_name = ParseName(ctx).last
additional_name = ParseName(ctx).middle
suffix = ParseName(ctx).suffix
class Contributor(Parser):
person = Delegate(Person, ctx)
cited_name... | import arrow
import dateparser
from share.normalize import *
class Person(Parser):
given_name = ParseName(ctx).first
family_name = ParseName(ctx).last
additional_name = ParseName(ctx).middle
suffix = ParseName(ctx).suffix
class Contributor(Parser):
person = Delegate(Person, ctx)
cited_name... | Handle missing fields in dataverse | Handle missing fields in dataverse
| Python | apache-2.0 | CenterForOpenScience/SHARE,laurenbarker/SHARE,aaxelb/SHARE,aaxelb/SHARE,laurenbarker/SHARE,zamattiac/SHARE,zamattiac/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE,CenterForOpenScience/SHARE,zamattiac/SHARE,aaxelb/SHARE | ---
+++
@@ -36,8 +36,8 @@
class CreativeWork(Parser):
title = ctx.name
- description = ctx.description
- contributors = Map(Delegate(Contributor), ctx.authors)
+ description = Try(ctx.description)
+ contributors = Map(Delegate(Contributor), Try(ctx.authors))
date_published = ParseDate(ctx.pub... |
3327c204f34a725a2d070beb24a7a5a66d414930 | migrations/versions/538eeb160af6_.py | migrations/versions/538eeb160af6_.py | """empty message
Revision ID: 538eeb160af6
Revises: 1727fb4309d8
Create Date: 2015-09-17 04:22:21.262285
"""
# revision identifiers, used by Alembic.
revision = '538eeb160af6'
down_revision = '1727fb4309d8'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | """empty message
Revision ID: 538eeb160af6
Revises: 1727fb4309d8
Create Date: 2015-09-17 04:22:21.262285
"""
# revision identifiers, used by Alembic.
revision = '538eeb160af6'
down_revision = '6b9d673d8e30'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | Update alembic order for merging | Update alembic order for merging
| Python | apache-2.0 | bunjiboys/security_monkey,stackArmor/security_monkey,markofu/security_monkey,bunjiboys/security_monkey,bunjiboys/security_monkey,markofu/security_monkey,markofu/security_monkey,Netflix/security_monkey,stackArmor/security_monkey,Netflix/security_monkey,Netflix/security_monkey,stackArmor/security_monkey,Netflix/security_... | ---
+++
@@ -8,7 +8,7 @@
# revision identifiers, used by Alembic.
revision = '538eeb160af6'
-down_revision = '1727fb4309d8'
+down_revision = '6b9d673d8e30'
from alembic import op
import sqlalchemy as sa |
aae0a19e6b03c9b42272f403cc1e5e7c943ea8ab | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from setuptools import setup, find_packages
import os
def read_file(filename):
"""Read a file into a string"""
path... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from setuptools import setup, find_packages
import os
def read_file(filename):
"""Read a file into a string"""
path... | Set long description content type to markdown | Set long description content type to markdown
| Python | mit | mback2k/python-hcalendar | ---
+++
@@ -38,4 +38,5 @@
'Operating System :: OS Independent',
],
long_description=read_file('README.md'),
+ long_description_content_type='text/markdown',
) |
fea8e206f3ef2755710a585b6aa76ce5c148a817 | setup.py | setup.py | #! /usr/bin/env python
from setuptools import setup, find_packages
setup(
name='armet',
version='0.3.0-pre',
description='Clean and modern framework for creating RESTful APIs.',
author='Concordus Applications',
author_email='support@concordusapps.com',
url='http://github.com/armet/python-armet... | #! /usr/bin/env python
from setuptools import setup, find_packages
setup(
name='armet',
version='0.3.0-pre',
description='Clean and modern framework for creating RESTful APIs.',
author='Concordus Applications',
author_email='support@concordusapps.com',
url='http://github.com/armet/python-armet... | Add httplib2 as a test dependency. | Add httplib2 as a test dependency.
| Python | mit | armet/python-armet | ---
+++
@@ -12,13 +12,14 @@
package_dir={'armet': 'src/armet'},
packages=find_packages('src'),
install_requires=(
- 'six', # Python 2 and 3 normalization layer
- 'python-mimeparse' # For parsing accept and content-type headers
+ 'six', # Python 2 and 3 normalization layer
+ ... |
20117a8c35ef47842a98bff92fc98773508ebbe0 | setup.py | setup.py | """
Usage instructions:
- If you are installing: `python setup.py install`
- If you are developing: `python setup.py sdist bdist --format=zip bdist_wheel --universal`
"""
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except ImportError:
try:
long_description = open('... | """
Usage instructions:
- If you are installing: `python setup.py install`
- If you are developing: `python setup.py sdist bdist --format=zip bdist_wheel --universal`
"""
try:
long_description = open('README.rst').read()
except ImportError:
import pypandoc
long_description = pypandoc.convert('README.md', ... | Make README publishing more conservative | Make README publishing more conservative
| Python | mit | boppreh/keyboard,glitchassassin/keyboard | ---
+++
@@ -6,17 +6,10 @@
"""
try:
+ long_description = open('README.rst').read()
+except ImportError:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
-except ImportError:
- try:
- long_description = open('README.md').read()
- except:
- try:
- lo... |
d2d822a9fb60bbc8ded7f9e3c70d91cf25f794b2 | src/volunteers/models.py | src/volunteers/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.validators import MinValueValidator
class Volunteer(models.Model):
first_name = models.CharField(_('First name'), max_length=100)
last_name = models.CharField(_('Last name'), max_length=100)
age = models.... | from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.validators import MinValueValidator
class Volunteer(models.Model):
first_name = models.CharField(_('First name'), max_length=100)
last_name = models.CharField(_('Last name'), max_length=100)
age = models.... | Add group name to volunteer string representation | Add group name to volunteer string representation
| Python | mit | mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign | ---
+++
@@ -23,7 +23,7 @@
def name(self):
template = u'{first_name} {last_name}'
if self.is_group:
- template += u' (grupp, {participant_count} osalejat)'
+ template += u' ({group_name} grupp, {participant_count} osalejat)'
return template.format(**self.__dict__)
... |
e57e13bde61a233b18504ab1617c6ecabad20fc3 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
from setuptools import find_packages
import re
def find_version():
return re.search(r"^__version__ = '(.*)'$",
open('cantools/version.py', 'r').read(),
re.MULTILINE).group(1)
setup(name='cantools',
version=find_v... | #!/usr/bin/env python
from setuptools import setup
from setuptools import find_packages
import re
def find_version():
return re.search(r"^__version__ = '(.*)'$",
open('cantools/version.py', 'r').read(),
re.MULTILINE).group(1)
setup(name='cantools',
version=find_v... | Remove per patch version classifiers | Remove per patch version classifiers | Python | mit | eerimoq/cantools,cantools/cantools | ---
+++
@@ -22,10 +22,6 @@
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
- 'Programming Language :: Python :: 3.6',
- 'Programming Language :: Python :: 3.7',
- 'Programming La... |
621968ca6bd2fb986d83ccc8d4c0d5a83ce3aadb | setup.py | setup.py | from setuptools import setup
import generate
generate.run()
setup(
name='nnpy',
version='0.1',
url='https://github.com/nanomsg/nnpy',
license='MIT',
author='Dirkjan Ochtman',
author_email='dirkjan@ochtman.nl',
description='cffi-based Python bindings for nanomsg',
long_description=open(... | from setuptools import setup
import generate
generate.run()
setup(
name='nnpy',
version='0.1',
url='https://github.com/nanomsg/nnpy',
license='MIT',
author='Dirkjan Ochtman',
author_email='dirkjan@ochtman.nl',
description='cffi-based Python bindings for nanomsg',
long_description=open(... | Add tested python version in classifiers | Add tested python version in classifiers
| Python | mit | nanomsg/nnpy | ---
+++
@@ -19,6 +19,11 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
+ ... |
80f59dd5b99605d212243641d01fcd635ddd0d93 | setup.py | setup.py | #! /usr/bin/env python
from setuptools import find_packages, setup
setup(name='oemof.db',
# Unfortunately we can't use a `__version__` attribute on `oemof.db` as
# we can't import that module here. It depends on packages which might
# not be available prior to installation.
version='0.0.6dev',... | #! /usr/bin/env python
from setuptools import find_packages, setup
setup(name='oemof.db',
# Unfortunately we can't use a `__version__` attribute on `oemof.db` as
# we can't import that module here. It depends on packages which might
# not be available prior to installation.
version='0.0.6dev',... | Drop upper version bound on pandas | Drop upper version bound on pandas
There's really no reason for having it.
| Python | mit | oemof/oemof.db | ---
+++
@@ -16,4 +16,4 @@
'shapely',
'psycopg2',
'keyrings.alt',
- 'pandas >=0.19.1, <=0.19.1'])
+ 'pandas >=0.19.1']) |
e1111ad6e8802b3c90df55e05eb695d6db9005e4 | import_script/create_users.py | import_script/create_users.py | #!/usr/bin/python
import django.contrib.auth.models as auth_models
import django.contrib.contenttypes as contenttypes
def main():
# Read only user:
# auth_models.User.objects.create_user('cube', 'toolkit_admin_readonly@localhost', '***REMOVED***')
# Read/write user:
user_rw = auth_models.User.objects... | #!/usr/bin/python
import django.contrib.auth.models as auth_models
import django.contrib.contenttypes as contenttypes
def get_password():
print "*" * 80
password = raw_input("Please enter string to use as admin password: ")
check_password = None
while check_password != password:
print
... | Remove cube credentials from import script | Remove cube credentials from import script
| Python | agpl-3.0 | BenMotz/cubetoolkit,BenMotz/cubetoolkit,BenMotz/cubetoolkit,BenMotz/cubetoolkit | ---
+++
@@ -3,12 +3,24 @@
import django.contrib.auth.models as auth_models
import django.contrib.contenttypes as contenttypes
+def get_password():
+ print "*" * 80
+ password = raw_input("Please enter string to use as admin password: ")
+ check_password = None
+
+ while check_password != password:
+ ... |
e6457c384eaa13eff82217ef4eb15f580efd8121 | setup.py | setup.py | import re
from setuptools import setup
init_py = open('wikipediabase/__init__.py').read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
metadata['doc'] = re.findall('"""(.+)"""', init_py)[0]
setup(
name='wikipediabase',
version=metadata['version'],
description=metadata['doc'],
autho... | import re
from setuptools import setup
init_py = open('wikipediabase/__init__.py').read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
metadata['doc'] = re.findall('"""(.+)"""', init_py)[0]
setup(
name='wikipediabase',
version=metadata['version'],
description=metadata['doc'],
autho... | Add unidecode as a dependency | Add unidecode as a dependency
| Python | apache-2.0 | fakedrake/WikipediaBase | ---
+++
@@ -32,6 +32,7 @@
'redis',
'redis',
'hiredis',
+ 'unidecode',
],
dependency_links=[
'git+https://github.com/fakedrake/overlay_parse#egg=overlay-parse', |
1a37d53df02942cb27794303e68fe041f73f5135 | setup.py | setup.py | import os
from setuptools import setup
from setuptools import find_packages
setup(
name='MobOff',
version='0.1',
py_modules=['moboff'],
packages=find_packages(),
description = 'Download youtube music and send to devices',
author = 'Parth Verma',
author_email = '... | import os
from setuptools import setup
from setuptools import find_packages
setup(
name='MobOff',
version='0.2',
py_modules=['moboff'],
packages=find_packages(),
description = 'Download youtube music and send to devices',
author = 'Parth Verma',
author_email = '... | Tag updated and download link added | Tag updated and download link added
| Python | mit | Parth-Vader/MobOff | ---
+++
@@ -5,13 +5,14 @@
setup(
name='MobOff',
- version='0.1',
+ version='0.2',
py_modules=['moboff'],
packages=find_packages(),
description = 'Download youtube music and send to devices',
author = 'Parth Verma',
author_email = 'vermaparth97@gma... |
c89abd6a285225313c91ba03c0fd8ab2cfed399d | setup.py | setup.py | #!/usr/bin/env python
import os
import urllib
import zipfile
script_path = os.path.dirname(os.path.realpath(__file__))
packer_archive_path = script_path + "/packer.zip"
bin_path = script_path + "/bin"
if not os.path.isfile(bin_path + "/packer"):
if not os.path.exists(bin_path):
os.makedirs(bin_path)
... | #!/usr/bin/env python
import os
import urllib
import zipfile
script_path = os.path.dirname(os.path.realpath(__file__))
packer_archive_path = script_path + "/packer.zip"
bin_path = script_path + "/bin"
if not os.path.isfile(bin_path + "/packer"):
if not os.path.exists(bin_path):
os.makedirs(bin_path)
... | Fix false positive octal syntax warning | Fix false positive octal syntax warning
| Python | unlicense | dharmab/centos-vagrant | ---
+++
@@ -20,5 +20,5 @@
for root, subdirectories, files in os.walk(bin_path):
for f in files:
- os.chmod("%s/%s" % (root, f), 0755)
+ os.chmod(root + "/" + f, 755)
|
110f62562a4802f99c93a53ea09e1e3deb2b3714 | setup.py | setup.py | from setuptools import setup, find_packages
import os
version = '0.3.10'
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'docs/HISTORY.txt')).read()
except IOError:
README = CHANGES = ''
setup(name='tgext.admin... | from setuptools import setup, find_packages
import os
version = '0.3.11'
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'docs/HISTORY.txt')).read()
except IOError:
README = CHANGES = ''
setup(name='tgext.admin... | Increase to version 0.3.11 due to TG-dev requiring it for ming support | Increase to version 0.3.11 due to TG-dev requiring it for ming support
| Python | mit | pedersen/tgtools.tgext-admin,pedersen/tgtools.tgext-admin | ---
+++
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
-version = '0.3.10'
+version = '0.3.11'
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.txt')).read() |
23f2306617a4e4bceecd20190c328b2b3418abc4 | setup.py | setup.py | #! /usr/bin/python
"""Setuptools-based setup script for datreant.
For a basic installation just type the command::
python setup.py install
"""
from setuptools import setup
setup(name='datreant',
version='0.5.1',
author='David Dotson',
author_email='dotsdl@gmail.com',
packages=['datreant'... | #! /usr/bin/python
"""Setuptools-based setup script for datreant.
For a basic installation just type the command::
python setup.py install
"""
from setuptools import setup
setup(name='datreant',
version='0.5.1',
author='David Dotson',
author_email='dotsdl@gmail.com',
packages=['datreant',... | Add PyYAML & numpy dependency | Add PyYAML & numpy dependency
I'm adding numpy too because we import it directly.
| Python | bsd-3-clause | datreant/datreant,dotsdl/datreant,datreant/datreant.core,datreant/datreant.core,datreant/datreant,datreant/datreant.data | ---
+++
@@ -11,11 +11,18 @@
setup(name='datreant',
version='0.5.1',
- author='David Dotson',
+ author='David Dotson',
author_email='dotsdl@gmail.com',
packages=['datreant', 'datreant.tests'],
scripts=[],
license='BSD',
long_description=open('README.rst').read(),... |
95e15792b50f28c5c40dcad17de2fd4535345bc8 | setup.py | setup.py | from setuptools import setup
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst')) as readme_file:
long_description = readme_file.read()
setup(
name='pyfds',
description='Modular field simulation tool using finite differences.',
long_description=long... | from setuptools import setup
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst')) as readme_file:
long_description = readme_file.read()
setup(
name='pyfds',
description='Modular field simulation tool using finite differences.',
long_description=long... | Add siprefix to runtime dependencies. | Add siprefix to runtime dependencies.
| Python | bsd-3-clause | emtpb/pyfds | ---
+++
@@ -27,7 +27,8 @@
install_requires=[
'numpy',
'scipy',
- 'matplotlib'
+ 'matplotlib',
+ 'siprefix'
],
# Setup/build dependencies; setuptools_scm required for git-based versioning |
a25f36c76301f67beab29dc2a273d819c49cd8eb | setup.py | setup.py | import os
import sys
try:
from setuptools import setup
except:
from distutils.core import setup
from distutils.command.build_py import build_py
path, script = os.path.split(sys.argv[0])
os.chdir(os.path.abspath(path))
VERSION="0.0.3"
install_requires = []
setup(name='imgix',
cmdclass={'build_py': build_py},
ver... | import os
import sys
try:
from setuptools import setup
except:
from distutils.core import setup
from distutils.command.build_py import build_py
path, script = os.path.split(sys.argv[0])
os.chdir(os.path.abspath(path))
VERSION="0.0.3"
install_requires = []
setup(name='imgix',
cmdclass={'build_py': build_py},
ver... | Change the URL of the package | Change the URL of the package
| Python | bsd-2-clause | imgix/imgix-python | ---
+++
@@ -19,7 +19,7 @@
description='Python client library for imgix.',
author='imgix',
author_email='support@imgix.com',
- url='http://www.imgix.com/',
+ url='https://github.com/imgix/imgix-python',
packages=['imgix'],
install_requires=install_requires
) |
b0e44fcca09a2d62ea0dc217d1538e03d48e2558 | setup.py | setup.py | from setuptools import setup, find_packages
from buildcmds.addon import addon
setup(
name='io_scene_previz',
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_versio... | from setuptools import setup, find_packages
from buildcmds.addon import bdist_blender_addon
setup(
name='io_scene_previz',
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single... | Rename command addon to bdist_blender_addon | Rename command addon to bdist_blender_addon
| Python | mit | Previz-app/io_scene_dnb_previz,Previz-app/io_scene_previz,Previz-app/io_scene_previz,Previz-app/io_scene_dnb_previz | ---
+++
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
-from buildcmds.addon import addon
+from buildcmds.addon import bdist_blender_addon
setup(
name='io_scene_previz',
@@ -25,12 +25,12 @@
],
keywords='previz development 3d scene exporter',
- packages=find_packages(exclude=['te... |
3a3c1491cf185899a5e5b6288ae0a3542b536dee | setup.py | setup.py | from distutils.core import setup
setup(
name="pocketlint",
description="Pocket-lint a composite linter and style checker.",
version="0.5.7",
maintainer="Curtis C. Hovey",
maintainer_email="sinzui.is@verizon.net",
url="https://launchpad.net/pocket-lint",
packages=[
'pocketlint', 'poc... | from distutils.core import setup
setup(
name="pocketlint",
description="Pocket-lint a composite linter and style checker.",
version="0.5.8",
maintainer="Curtis C. Hovey",
maintainer_email="sinzui.is@verizon.net",
url="https://launchpad.net/pocket-lint",
packages=[
'pocketlint', 'poc... | Increment version to suport Python 2.6. | Increment version to suport Python 2.6. | Python | mit | chevah/pocket-lint,chevah/pocket-lint | ---
+++
@@ -3,7 +3,7 @@
setup(
name="pocketlint",
description="Pocket-lint a composite linter and style checker.",
- version="0.5.7",
+ version="0.5.8",
maintainer="Curtis C. Hovey",
maintainer_email="sinzui.is@verizon.net",
url="https://launchpad.net/pocket-lint", |
f52c77b746ca98ed06df293ba142a5ecf2577a62 | setup.py | setup.py | import sys
from setuptools import setup
# Be verbose about Python < 3.4 being deprecated.
if sys.version_info < (3, 4):
print('\n' * 3 + '*' * 64)
print('lastcast requires Python 3.4+, and might be broken if run with\n'
'this version of Python.')
print('*' * 64 + '\n' * 3)
setup(
name='las... | import sys
from setuptools import setup
# Be verbose about Python < 3.5 being deprecated.
if sys.version_info < (3, 5):
print('\n' * 3 + '*' * 64)
print('lastcast requires Python 3.5+, and might be broken if run with\n'
'this version of Python.')
print('*' * 64 + '\n' * 3)
setup(
name='las... | Support is actually py >= 35 | Support is actually py >= 35
| Python | mit | erik/lastcast | ---
+++
@@ -2,17 +2,17 @@
from setuptools import setup
-# Be verbose about Python < 3.4 being deprecated.
-if sys.version_info < (3, 4):
+# Be verbose about Python < 3.5 being deprecated.
+if sys.version_info < (3, 5):
print('\n' * 3 + '*' * 64)
- print('lastcast requires Python 3.4+, and might be broken... |
ab55fab78743650eb9bb219957d7305114e4f8ca | setup.py | setup.py | #!/usr/bin/env python
from setuptools import find_packages, Command
setup_params = dict(
name='bugimporters',
version=0.1,
author='Various contributers to the OpenHatch project, Berry Phillips',
author_email='all@openhatch.org, berryphillips@gmail.com',
packages=find_packages(),
description='B... | #!/usr/bin/env python
from setuptools import find_packages, Command
setup_params = dict(
name='bugimporters',
version=0.1,
author='Various contributers to the OpenHatch project, Berry Phillips',
author_email='all@openhatch.org, berryphillips@gmail.com',
packages=find_packages(),
description='B... | Add a dependency on Scrapy | Add a dependency on Scrapy
| Python | agpl-3.0 | openhatch/oh-bugimporters,openhatch/oh-bugimporters,openhatch/oh-bugimporters | ---
+++
@@ -18,6 +18,7 @@
'twisted',
'python-dateutil',
'decorator',
+ 'scrapy',
],
)
|
3d888afa88326c97246947141c357509c2f72bbc | setup.py | setup.py | from distutils.core import setup
setup(
name='firebase-token-generator',
version='1.2',
author='Greg Soltis',
author_email='greg@firebase.com',
py_modules=['firebase_token_generator'],
license='LICENSE',
url='https://github.com/firebase/firebase-token-generator-python',
description='A u... | from distutils.core import setup
setup(
name='firebase-token-generator',
version='1.3',
author='Greg Soltis',
author_email='greg@firebase.com',
zip_safe=False,
py_modules=['firebase_token_generator'],
license='LICENSE',
url='https://github.com/firebase/firebase-token-generator-python',
... | Set zip_safe=False. Bump version to 1.3. | Set zip_safe=False. Bump version to 1.3.
| Python | mit | googlearchive/firebase-token-generator-python | ---
+++
@@ -2,9 +2,10 @@
setup(
name='firebase-token-generator',
- version='1.2',
+ version='1.3',
author='Greg Soltis',
author_email='greg@firebase.com',
+ zip_safe=False,
py_modules=['firebase_token_generator'],
license='LICENSE',
url='https://github.com/firebase/firebase-t... |
927e2bc4b8774cdffd753f99f63086baf437a509 | setup.py | setup.py | from pip.download import PipSession
from pip.req import parse_requirements
from setuptools import setup
setup(
name='aws-portknock',
version='0.1',
py_modules=['aws_portknock'],
description='Port knocking for AWS security groups',
author='Michel Alexandre Salim',
author_email='michel@michel-slm... | import os
from pip.download import PipSession
from pip.req import parse_requirements
from setuptools import setup
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
reqs_file = os.path.join(BASE_DIR, 'requirements.txt')
install_reqs = parse_requirements(reqs_file, session=PipSession())
setup(
name='aws-portkn... | Add path to requirements.txt so installation from pip succeeds | Add path to requirements.txt so installation from pip succeeds
cf http://lorenamesa.com/packaging-my-first-python-egg.html
| Python | mpl-2.0 | michel-slm/aws-portknock | ---
+++
@@ -1,6 +1,11 @@
+import os
from pip.download import PipSession
from pip.req import parse_requirements
from setuptools import setup
+
+BASE_DIR = os.path.dirname(os.path.realpath(__file__))
+reqs_file = os.path.join(BASE_DIR, 'requirements.txt')
+install_reqs = parse_requirements(reqs_file, session=PipSess... |
03875be96ba09a252a05ba0ea84a3558c6428011 | setup.py | setup.py | #!/usr/bin/env python
import os
from setuptools import setup, find_packages
reqs_file = os.path.join(os.path.dirname(os.path.realpath(__file__))
, "requirements.txt")
reqs = None
with open(reqs_file) as f:
reqs = f.readlines()
setup(
version='0.1.0',
name='mediachain-client',
descr... | #!/usr/bin/env python
import os, sys
from setuptools import setup, find_packages
from setuptools.command.install import install as _install
reqs_file = os.path.join(os.path.dirname(os.path.realpath(__file__))
, "requirements.txt")
reqs = None
with open(reqs_file) as f:
reqs = f.readlines()
d... | Add pre-install protobuf gen script | Add pre-install protobuf gen script
| Python | mit | mediachain/mediachain-client,mediachain/mediachain-client | ---
+++
@@ -1,6 +1,7 @@
#!/usr/bin/env python
-import os
+import os, sys
from setuptools import setup, find_packages
+from setuptools.command.install import install as _install
reqs_file = os.path.join(os.path.dirname(os.path.realpath(__file__))
, "requirements.txt")
@@ -8,6 +9,17 @@
reqs ... |
453bd468d9de609999ef814f24111923177374fe | setup.py | setup.py | from setuptools import find_packages
from setuptools import setup
from pip import req
_install_requirements = req.parse_requirements('requirements.txt')
setup(
name='jetway',
version=open('VERSION').read().strip(),
description=(
'Client library for the Jetway static site staging service.'
),
... | import uuid
from setuptools import find_packages
from setuptools import setup
from pip import req
_install_requirements = req.parse_requirements(
'requirements.txt', session=uuid.uuid1())
setup(
name='jetway',
version=open('VERSION').read().strip(),
description=(
'Client library for the Jetwa... | Fix pip parse_requirements for v0.6+. | Fix pip parse_requirements for v0.6+.
| Python | mit | grow/webreview-client | ---
+++
@@ -1,8 +1,10 @@
+import uuid
from setuptools import find_packages
from setuptools import setup
from pip import req
-_install_requirements = req.parse_requirements('requirements.txt')
+_install_requirements = req.parse_requirements(
+ 'requirements.txt', session=uuid.uuid1())
setup( |
ee2d27eca45768a07a562405cf4431cb8d2b09bf | setup.py | setup.py | from distutils.core import setup
setup(name='pyresttest',
version='0.1',
description='Python Rest Testing',
maintainer='Naveen Malik',
maintainer_email='jewzaam@gmail.com',
url='https://github.com/svanoort/pyresttest',
py_modules=['resttest','pycurl_benchmark','test_resttest'],
license='Apa... | from distutils.core import setup
setup(name='pyresttest',
version='0.1',
description='Python Rest Testing',
maintainer='Sam Van Oort',
maintainer_email='acetonespam@gmail.com',
url='https://github.com/svanoort/pyresttest',
py_modules=['resttest','test_resttest'],
license='Apache License, Ve... | Set maintainer and add dependencies to distutils config | Set maintainer and add dependencies to distutils config
| Python | apache-2.0 | sunyanhui/pyresttest,satish-suradkar/pyresttest,suvarnaraju/pyresttest,wirewit/pyresttest,netjunki/pyresttest,MorrisJobke/pyresttest,wirewit/pyresttest,suvarnaraju/pyresttest,svanoort/pyresttest,alazaro/pyresttest,sunyanhui/pyresttest,TimYi/pyresttest,MorrisJobke/pyresttest,holdenweb/pyresttest,TimYi/pyresttest,alazaro... | ---
+++
@@ -3,9 +3,10 @@
setup(name='pyresttest',
version='0.1',
description='Python Rest Testing',
- maintainer='Naveen Malik',
- maintainer_email='jewzaam@gmail.com',
+ maintainer='Sam Van Oort',
+ maintainer_email='acetonespam@gmail.com',
url='https://github.com/svanoort/pyresttest',
- ... |
b5898dc6d16868cd7908872916fa6099ad85049f | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='prompt_toolkit',
author='Jonathan Slenders',
version='0.25',
license='LICENSE.txt',
url='https://github.com/jonathanslenders/python-prompt-toolkit',
description='Library for building powerfu... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='prompt_toolkit',
author='Jonathan Slenders',
version='0.25',
license='LICENSE.txt',
url='https://github.com/jonathanslenders/python-prompt-toolkit',
description='Library for building powerfu... | Use again jedi==0.8.1. (This was pushed to pypi.) | Use again jedi==0.8.1. (This was pushed to pypi.)
| Python | bsd-3-clause | melund/python-prompt-toolkit,ALSchwalm/python-prompt-toolkit,niklasf/python-prompt-toolkit,amjith/python-prompt-toolkit,jonathanslenders/python-prompt-toolkit,jaseg/python-prompt-toolkit,ddalex/python-prompt-toolkit | ---
+++
@@ -14,7 +14,7 @@
packages=find_packages('.'),
install_requires = [
'docopt',
- 'jedi>=0.8.1-final0',
+ 'jedi>=0.8.1',
'pygments',
'six>=1.8.0',
'wcwidth', |
2ac5d587c057d877db217b0303a06e0382bd8a2d | setup.py | setup.py | #!/usr/bin/python3
# SPDX-License-Identifier: LGPL-2.1+
import sys
from setuptools import setup
if sys.version_info < (3, 6):
sys.exit("Sorry, we need at least Python 3.6.")
setup(
name="mkosi",
version="5",
description="Create legacy-free OS images",
url="https://github.com/systemd/mkosi",
... | #!/usr/bin/python3
# SPDX-License-Identifier: LGPL-2.1+
import sys
from setuptools import setup, Command
class BuildManpage(Command):
description = ('builds the manpage')
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
... | Add custom command to build the manpage | Add custom command to build the manpage
Remembering the exact pandoc incantation is annoying
| Python | lgpl-2.1 | systemd/mkosi,systemd/mkosi | ---
+++
@@ -3,7 +3,19 @@
import sys
-from setuptools import setup
+from setuptools import setup, Command
+
+class BuildManpage(Command):
+ description = ('builds the manpage')
+ user_options = []
+
+ def initialize_options(self):
+ pass
+ def finalize_options(self):
+ pass
+
+ def ru... |
8fea58292e41352b0b58947f4182dd32ff4f225d | opps/fields/models.py | opps/fields/models.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from opps.boxes.models import OPPS_APPS
FIELD_TYPE = (
('checkbox', _('CheckBox')),
('radio', _('Radio')),
('text', _('Text')),
('textarea', _('TextArea')),
)
class Fie... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from opps.boxes.models import OPPS_APPS
FIELD_TYPE = (
('checkbox', _('CheckBox')),
('radio', _('Radio')),
('text', _('Text')),
('textarea', _('TextArea')),
)
class Fie... | Add new model option to add field options if exist (radio/checkbox) | Add new model option to add field options if exist (radio/checkbox)
| Python | mit | williamroot/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,williamroot/opps,opps/opps,opps/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps,williamroot/opps,YACOWS/opps,opps/opps | ---
+++
@@ -27,3 +27,26 @@
def __unicode__(self):
return u"{} - {}".format(self.application, self.name)
+
+
+class Option(models.Model):
+ field = models.ForeignKey('fields.Field')
+ name = models.CharField(_('Name'), max_length=100)
+ slug = models.SlugField(_('Slug'), max_length=140)
+ v... |
4f730cb70fc4e65b568732fdcbb7f0209870bfca | osf_tests/settings.py | osf_tests/settings.py | # Use API defaults. This allows these settings to work with API tests
from api.base.settings.defaults import * # noqa
DEBUG_PROPAGATE_EXCEPTIONS = True
#DATABASES = {
# 'default': {
# 'CONN_MAX_AGE': 0,
# 'ENGINE': 'osf.db.backends.postgresql',
# 'HOST': '',
# 'NAME': 'osf-models-test',... | # Use API defaults. This allows these settings to work with API tests
from api.base.settings.defaults import * # noqa
DEBUG_PROPAGATE_EXCEPTIONS = True
#DATABASES = {
# 'default': {
# 'CONN_MAX_AGE': 0,
# 'ENGINE': 'osf.db.backends.postgresql',
# 'HOST': '',
# 'NAME': 'osf-models-test',... | Add in API testing version | Add in API testing version
Signed-off-by: Chris Wisecarver <5fccdd17c1f7bcc7e393d2cb5e2fad37705ca69f@cos.io>
| Python | apache-2.0 | cwisecarver/osf.io,chennan47/osf.io,mfraezz/osf.io,Johnetordoff/osf.io,cslzchen/osf.io,monikagrabowska/osf.io,baylee-d/osf.io,baylee-d/osf.io,crcresearch/osf.io,saradbowman/osf.io,monikagrabowska/osf.io,mattclark/osf.io,CenterForOpenScience/osf.io,Nesiehr/osf.io,brianjgeiger/osf.io,CenterForOpenScience/osf.io,Nesiehr/o... | ---
+++
@@ -23,6 +23,7 @@
REST_FRAMEWORK['ALLOWED_VERSIONS'] = (
'2.0',
+ '2.0.1',
'2.1',
'2.2',
'2.3', |
6f83fb7dd071786dc01a015addbdb541e7eaf7db | meinberlin/apps/documents/migrations/0002_rename_document_to_chapter.py | meinberlin/apps/documents/migrations/0002_rename_document_to_chapter.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('meinberlin_documents', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
atomic=False
dependencies = [
('meinberlin_documents', '0001_initial'),
]
operations = [
migrations.RenameModel(
... | Work around a migration issue in sqlite | apps/documents: Work around a migration issue in sqlite
| Python | agpl-3.0 | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | ---
+++
@@ -6,6 +6,7 @@
class Migration(migrations.Migration):
+ atomic=False
dependencies = [
('meinberlin_documents', '0001_initial'), |
408ec05722cacd1e8574d9af206bffcf319c23b2 | pipes/iam/__main__.py | pipes/iam/__main__.py | """Create IAM Instance Profiles, Roles, Users, and Groups."""
import argparse
import logging
from .create_iam import create_iam_resources
LOG = logging.getLogger(__name__)
def main():
"""Command to create IAM Instance Profiles, Roles, Users, and Groups."""
logging.basicConfig()
parser = argparse.Argume... | """Create IAM Instance Profiles, Roles, Users, and Groups."""
import argparse
import logging
from .create_iam import create_iam_resources
LOG = logging.getLogger(__name__)
def main():
"""Command to create IAM Instance Profiles, Roles, Users, and Groups."""
logging.basicConfig()
parser = argparse.Argume... | Add build as available environment | Add build as available environment
| Python | apache-2.0 | gogoair/foremast,gogoair/foremast | ---
+++
@@ -20,7 +20,7 @@
help='Set DEBUG output')
parser.add_argument('-e',
'--env',
- choices=('dev', 'stage', 'prod'),
+ choices=('build', 'dev', 'stage', 'prod'),
default='dev',
... |
3d2f19ff097cf144efd9135c52e4d584193f9ddb | tohu/v7/custom_generator/tohu_items_class.py | tohu/v7/custom_generator/tohu_items_class.py | import attr
__all__ = ["make_tohu_items_class"]
def make_tohu_items_class(clsname, field_names):
"""
Parameters
----------
clsname: string
Name of the class to be created.
field_names: list of strings
Names of the field attributes of the class to be created.
"""
item_cls ... | import attr
__all__ = ["make_tohu_items_class"]
def make_tohu_items_class(clsname, field_names):
"""
Parameters
----------
clsname: string
Name of the class to be created.
field_names: list of strings
Names of the field attributes of the class to be created.
"""
item_cls ... | Add attribute 'is_unset' so that the interface is consistent with MissingTohuItemsCls | Add attribute 'is_unset' so that the interface is consistent with MissingTohuItemsCls
| Python | mit | maxalbert/tohu | ---
+++
@@ -40,4 +40,5 @@
item_cls.field_names = field_names
item_cls.as_dict = lambda self: attr.asdict(self)
item_cls.as_tuple = lambda self: attr.astuple(self)
+ item_cls.is_unset = False
return item_cls |
445b80562e038bc3749930d44e00eda55edaa180 | ci_scripts/buildLinuxWheels.py | ci_scripts/buildLinuxWheels.py | from subprocess import call, check_output
import sys
import os
isPython3 = sys.version_info.major == 3
# https://stackoverflow.com/a/3357357
command = 'git log --format=%B -n 1'.split()
out = check_output(command)
if b'build wheels' not in out.lower() or not isPython3:
exit(0)
path = os.path.abspath(argv[1])
ca... | from subprocess import call, check_output
import sys
import os
isPython3 = sys.version_info.major == 3
# https://stackoverflow.com/a/3357357
command = 'git log --format=%B -n 1'.split()
out = check_output(command)
if b'build wheels' not in out.lower() or not isPython3:
exit(0)
path = os.path.abspath(sys.argv[1]... | Fix build wheels and upload 4. | Fix build wheels and upload 4.
| Python | bsd-3-clause | jr-garcia/AssimpCy,jr-garcia/AssimpCy | ---
+++
@@ -11,9 +11,9 @@
if b'build wheels' not in out.lower() or not isPython3:
exit(0)
-path = os.path.abspath(argv[1])
+path = os.path.abspath(sys.argv[1])
call('pip install cibuildwheel==0.7.0'.split())
-call('cibuildwheel --output-dir {}'.format(path).split())
+call('cibuildwheel --output-dir {}'.forma... |
bec498894ebd612058f905e1cfe4f5230df91841 | client/examples/cycle-cards.py | client/examples/cycle-cards.py | #!/bin/python
import removinator
import subprocess
# This example cycles through each card slot in the Removinator. Any
# slots that have a card present will then have the certificates on the
# card printed out using the pkcs15-tool utility, which is provided by
# the OpenSC project.
#
# Examples of parsing the Remo... | #!/bin/python
import removinator
import subprocess
# This example cycles through each card slot in the Removinator. Any
# slots that have a card present will then have the certificates on the
# card printed out using the pkcs15-tool utility, which is provided by
# the OpenSC project.
#
# Examples of parsing the Remo... | Correct PEP8 indendation issue in client example | Correct PEP8 indendation issue in client example
| Python | apache-2.0 | nkinder/smart-card-removinator | ---
+++
@@ -21,7 +21,7 @@
print('Inserted card {0}'.format(card))
print('{0}'.format(subprocess.check_output(['pkcs15-tool',
'--list-certificates'])
- .rstrip()))
+ .rstrip... |
a10407bf4d9dd404d734985717aa7bcebfa0981d | api/digital_ocean.py | api/digital_ocean.py | """
@fileoverview Digital Ocean API
@author David Parlevliet
@version 20130315
@preserve Copyright 2013 David Parlevliet.
Digital Ocean API
=================
Class to get the server details via the Digital Ocean API.
"""
import urllib2
import json
class Api():
group_name = "Digital Ocean"
client_key = None
ap... | """
@fileoverview Digital Ocean API
@author David Parlevliet
@version 20130315
@preserve Copyright 2013 David Parlevliet.
Digital Ocean API
=================
Class to get the server details via the Digital Ocean API.
"""
import urllib2
import json
class Api():
group_name = "Digital Ocean"
client_key = None
ap... | Return a helpful exception if API is uncontactable | Return a helpful exception if API is uncontactable | Python | mit | dparlevliet/elastic-firewall,dparlevliet/elastic-firewall,dparlevliet/elastic-firewall | ---
+++
@@ -27,7 +27,11 @@
self.client_key,
self.api_key)
- droplets = urllib2.urlopen(DROPLETS_URL)
+ try:
+ droplets = urllib2.urlopen(DROPLETS_URL)
+ except urllib2.URLError:
+ raise Exception("Fatal error: Unable to connect to API")
... |
7ff6c9d85eef03c225b511f39bbb07796b47659f | datapipe/history.py | datapipe/history.py |
class History:
def __init__(self):
self.conn = sqlite3.connect('.history.db')
| import sqlite3
class History:
def __init__(self, path):
self.conn = sqlite3.connect(path)
| Make database filepath configurable on History | Make database filepath configurable on History
| Python | mit | ibab/datapipe | ---
+++
@@ -1,5 +1,6 @@
+import sqlite3
class History:
- def __init__(self):
- self.conn = sqlite3.connect('.history.db')
+ def __init__(self, path):
+ self.conn = sqlite3.connect(path)
|
fd4539942dafe622d3f7a7d183db3d69f95a00c4 | shop/urls/cart.py | shop/urls/cart.py | from django.conf.urls.defaults import url, patterns
from shop.views.cart import CartDetails, CartItemDetail
urlpatterns = patterns('',
url(r'^delete/$', CartDetails.as_view(action='delete'), # DELETE
name='cart_delete'),
url('^item/$', CartDetails.as_view(action='post'), # POST
name='cart_i... | from django.conf.urls.defaults import url, patterns
from shop.views.cart import CartDetails, CartItemDetail
urlpatterns = patterns('',
url(r'^delete/$', CartDetails.as_view(action='delete'), # DELETE
name='cart_delete'),
url('^item/$', CartDetails.as_view(action='post'), # POST
name='cart_i... | Make sure that ID will not match the first CartItems rule EVERY time ("//" was in regex). | Make sure that ID will not match the first CartItems rule EVERY time ("//" was in regex). | Python | bsd-3-clause | schacki/django-shop,khchine5/django-shop,khchine5/django-shop,dwx9/test,febsn/django-shop,DavideyLee/django-shop,awesto/django-shop,jrief/django-shop,dwx9/test,thenewguy/django-shop,thenewguy/django-shop,bmihelac/django-shop,pjdelport/django-shop,creimers/django-shop,creimers/django-shop,jrief/django-shop,bmihelac/djan... | ---
+++
@@ -13,9 +13,9 @@
name='cart_update'),
# CartItems
- url('^item/(?P<id>[0-9A-Za-z-_.//]+)$', CartItemDetail.as_view(),
+ url('^item/(?P<id>[0-9]+)$', CartItemDetail.as_view(),
name='cart_item'),
- url('^item/(?P<id>[0-9A-Za-z-_.//]+)/delete$',
+ url('^item/(?P<id>[0-9]+)/d... |
10948cd88d51383e13af0a116703984752092c6a | jenkinsapi_tests/systests/test_jenkins_matrix.py | jenkinsapi_tests/systests/test_jenkins_matrix.py | '''
System tests for `jenkinsapi.jenkins` module.
'''
import re
import time
import unittest
from jenkinsapi_tests.systests.base import BaseSystemTest
from jenkinsapi_tests.systests.job_configs import MATRIX_JOB
from jenkinsapi_tests.test_utils.random_strings import random_string
class TestMatrixJob(BaseSystemTest):
... | '''
System tests for `jenkinsapi.jenkins` module.
'''
import re
import time
import unittest
from jenkinsapi_tests.systests.base import BaseSystemTest
from jenkinsapi_tests.systests.job_configs import MATRIX_JOB
from jenkinsapi_tests.test_utils.random_strings import random_string
class TestMatrixJob(BaseSystemTest):
... | Tidy up this test - still quite bad & useless. | Tidy up this test - still quite bad & useless.
| Python | mit | imsardine/jenkinsapi,salimfadhley/jenkinsapi,JohnLZeller/jenkinsapi,JohnLZeller/jenkinsapi,aerickson/jenkinsapi,domenkozar/jenkinsapi,zaro0508/jenkinsapi,imsardine/jenkinsapi,zaro0508/jenkinsapi,jduan/jenkinsapi,mistermocha/jenkinsapi,domenkozar/jenkinsapi,salimfadhley/jenkinsapi,zaro0508/jenkinsapi,mistermocha/jenkins... | ---
+++
@@ -17,24 +17,25 @@
job = self.jenkins.create_job(job_name, MATRIX_JOB)
job.invoke(block=True)
- b = job.get_last_build()
+ build = job.get_last_build()
- while b.is_running():
+ while build.is_running():
time.sleep(1)
- s = set()
- ... |
238ba8cec34ec02dc521f25ef1ada6e230194c32 | kitsune/kbadge/migrations/0002_auto_20181023_1319.py | kitsune/kbadge/migrations/0002_auto_20181023_1319.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('kbadge', '0001_initial'),
]
operations = [
migrations.RunSQL(
"UPDATE badger_badge SET image = CONCAT('uploads/', image)... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('kbadge', '0001_initial'),
]
operations = [
migrations.RunSQL(
"UPDATE badger_badge SET image = CONCAT('uploads/', image)... | Add WHERE clause to SQL data migration. | Add WHERE clause to SQL data migration.
| Python | bsd-3-clause | mozilla/kitsune,anushbmx/kitsune,anushbmx/kitsune,anushbmx/kitsune,mozilla/kitsune,mozilla/kitsune,mozilla/kitsune,anushbmx/kitsune | ---
+++
@@ -12,6 +12,6 @@
operations = [
migrations.RunSQL(
- "UPDATE badger_badge SET image = CONCAT('uploads/', image)"
+ "UPDATE badger_badge SET image = CONCAT('uploads/', image) WHERE image NOT LIKE 'uploads/%'"
)
] |
4651d3b5666fe3ddf3bd92b31ee6ffe4a72ce94e | core/api/__init__.py | core/api/__init__.py | import os
from flask import Flask, jsonify
from flask_pymongo import PyMongo, BSONObjectIdConverter
from werkzeug.exceptions import HTTPException, default_exceptions
from core.api import settings
def create_app(environment=None):
app = Flask('veritrans')
app.url_map.converters['ObjectId'] = BSONObjectIdConv... | import os
from flask import Flask, jsonify
from flask_pymongo import PyMongo, BSONObjectIdConverter
from werkzeug.exceptions import HTTPException, default_exceptions
from core.api import settings
def create_app(environment=None):
app = Flask('veritrans')
app.url_map.converters['ObjectId'] = BSONObjectIdConv... | Use Production config unless specified | Use Production config unless specified
| Python | mit | onyb/veritrans-payment-portals | ---
+++
@@ -42,6 +42,5 @@
@staticmethod
def init():
- env = os.environ.get('SITE_NAME', 'Dev')
- API.app = create_app(env)
+ API.app = create_app()
API.mongo_client = PyMongo(API.app) |
ced218643784838d68961a926cc0dd18c3a3f01f | skald/geometry.py | skald/geometry.py | # -*- coding: utf-8 -*-
from collections import namedtuple
Size = namedtuple("Size", ["width", "height"])
Rectangle = namedtuple("Rectangle", ["x0", "y0", "x1", "y1"])
class Point(namedtuple("Point", ["x", "y"])):
"""Point in a two-dimensional space.
Named tuple implementation that allows for addition and su... | # -*- coding: utf-8 -*-
from collections import namedtuple
Size = namedtuple("Size", ["width", "height"])
class Rectangle(namedtuple("Rectangle", ["x0", "y0", "x1", "y1"])):
def __contains__(self, other):
"""Check if this rectangle and `other` overlaps eachother.
Essentially this is a bit of a ha... | Add intersection test for rectangles | Add intersection test for rectangles
| Python | mit | bjornarg/skald,bjornarg/skald | ---
+++
@@ -2,7 +2,19 @@
from collections import namedtuple
Size = namedtuple("Size", ["width", "height"])
-Rectangle = namedtuple("Rectangle", ["x0", "y0", "x1", "y1"])
+
+class Rectangle(namedtuple("Rectangle", ["x0", "y0", "x1", "y1"])):
+ def __contains__(self, other):
+ """Check if this rectangle a... |
8f03f51c89aeea44943f9cb0b39330e676ae0089 | utils.py | utils.py | import vx
from contextlib import contextmanager
from functools import partial
import sys
from io import StringIO
def _expose(f=None, name=None):
if f is None:
return partial(_expose, name=name)
if name is None:
name = f.__name__.lstrip('_')
if getattr(vx, name, None) is not None:
... | import vx
from contextlib import contextmanager
from functools import partial
import sys
from io import StringIO
def _expose(f=None, name=None):
if f is None:
return partial(_expose, name=name)
if name is None:
name = f.__name__.lstrip('_')
if getattr(vx, name, None) is not None:
... | Change repeat command to return a list of the results of the repeated commands | Change repeat command to return a list of the results of the repeated commands
| Python | mit | philipdexter/vx,philipdexter/vx | ---
+++
@@ -19,8 +19,10 @@
@vx.expose
def _repeat(c, times=4):
+ res = []
for _ in range(times):
- c()
+ res.append(c())
+ return res
@vx.expose
@contextmanager |
822e6123cc598b4f6a0eafedfb2f0d0cbfba5f37 | currencies/migrations/0003_auto_20151216_1906.py | currencies/migrations/0003_auto_20151216_1906.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from extra_countries.models import ExtraCountry
def add_currencies_with_countries(apps, schema_editor):
# We can't import the model directly as it may be a newer
# version than this migration expects. We use the... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from extra_countries.models import ExtraCountry
def add_currencies_with_countries(apps, schema_editor):
# We can't import the model directly as it may be a newer
# version than this migration expects. We use the... | Fix currencies seeding, so it won't have empty currencies | Fix currencies seeding, so it won't have empty currencies
| Python | mit | openspending/cosmopolitan,kiote/cosmopolitan | ---
+++
@@ -19,8 +19,11 @@
except Currency.DoesNotExist: # no such currency yet
currency = Currency(code=extra_country.country.currency,
name=extra_country.country.currency_name)
- currency.save()
- currency.countries.add(extra_country.pk)
+ ... |
041b271baa7ae0bbd20c30ac4f70b42fda267e93 | mozillians/groups/__init__.py | mozillians/groups/__init__.py | from django.apps import AppConfig
CIS_GROUPS = [
'cis_whitelist',
'nda'
]
default_app_config = 'mozillians.groups.GroupConfig'
class GroupConfig(AppConfig):
name = 'mozillians.groups'
| from django.apps import AppConfig
CIS_GROUPS = [
'cis_whitelist',
'nda',
'open-innovation-reps-council'
]
default_app_config = 'mozillians.groups.GroupConfig'
class GroupConfig(AppConfig):
name = 'mozillians.groups'
| Add a group in the whitelist. | Add a group in the whitelist.
| Python | bsd-3-clause | mozilla/mozillians,akatsoulas/mozillians,mozilla/mozillians,johngian/mozillians,mozilla/mozillians,mozilla/mozillians,akatsoulas/mozillians,akatsoulas/mozillians,johngian/mozillians,johngian/mozillians,johngian/mozillians,akatsoulas/mozillians | ---
+++
@@ -3,7 +3,8 @@
CIS_GROUPS = [
'cis_whitelist',
- 'nda'
+ 'nda',
+ 'open-innovation-reps-council'
]
|
199c9bae8e2ad42ee1c8699c678dd56d6074b2de | main/models.py | main/models.py | from django.db import models
from django.contrib.auth.models import User
import string, random
from django import forms
# Create your models here.
def _generate_default_hashtag():
return "".join(random.choice(string.lowercase) for i in range(3))
class Wall(models.Model):
hashtag = models.CharField(max_length=20... | from django.db import models
from django.contrib.auth.models import User
import string, random
from django import forms
# Create your models here.
def _generate_default_hashtag():
return "".join(random.choice(string.lowercase) for i in range(3))
class Wall(models.Model):
hashtag = models.CharField(max_length=20... | Return sms_keyword as wall name | Return sms_keyword as wall name
| Python | mit | Aaron1011/texting_wall | ---
+++
@@ -10,10 +10,12 @@
user = models.ForeignKey(User, editable=False)
sms_keyword = models.CharField(max_length=20)
def __unicode__(self):
- return self.name
-
+ return self.sms_keyword
+
TRAFFIC_SOURCE = (
('BG', 'Blog'),
('FR', 'Friend'),
('OT', 'Other',)
... |
523ee893118413caa45e66869e9380f5e52f3402 | src/parser/python/print_libpython.py | src/parser/python/print_libpython.py | # Print embeddable python library, as well as other libs it requires.
# Will prefer static linkage unless invoked with "shared" argument.
# JGG, 8/4/04
import sys, distutils.sysconfig
static_link = 1
nargs = len(sys.argv)
if nargs == 2 and sys.argv[1] == "shared":
static_link = 0
# Note that this adds libraries w... | # Print embeddable python library, as well as other libs it requires.
# Will prefer static linkage unless invoked with "shared" argument.
# JGG, 8/4/04
import sys, distutils.sysconfig
static_link = 1
nargs = len(sys.argv)
if nargs == 2 and sys.argv[1] == "shared":
static_link = 0
# Note that this adds libraries w... | Test file existence for brain-dead Jaguar. | Test file existence for brain-dead Jaguar.
| Python | apache-2.0 | RTcmix/RTcmix,RTcmix/RTcmix,RTcmix/RTcmix,RTcmix/RTcmix,RTcmix/RTcmix,RTcmix/RTcmix | ---
+++
@@ -17,8 +17,12 @@
prefix = distutils.sysconfig.get_config_var("LIBPL")
pythonlib = distutils.sysconfig.get_config_var("BLDLIBRARY")
if len(pythonlib) > 0:
- print prefix + '/' + pythonlib, libs
- sys.exit(0)
+ import os.path
+ plib = prefix + '/' + pythonlib
+ # Must see ... |
b6ec3ba9efae7b6b291391b0333e80f2e9fc6fa0 | src/waldur_mastermind/invoices/migrations/0053_invoiceitem_uuid.py | src/waldur_mastermind/invoices/migrations/0053_invoiceitem_uuid.py | import uuid
from django.db import migrations
import waldur_core.core.fields
def gen_uuid(apps, schema_editor):
InvoiceItem = apps.get_model('invoices', 'InvoiceItem')
for row in InvoiceItem.objects.all():
row.uuid = uuid.uuid4().hex
row.save(update_fields=['uuid'])
class Migration(migratio... | import uuid
from django.db import migrations, models
import waldur_core.core.fields
def gen_uuid(apps, schema_editor):
InvoiceItem = apps.get_model('invoices', 'InvoiceItem')
for row in InvoiceItem.objects.all():
row.uuid = uuid.uuid4().hex
row.save(update_fields=['uuid'])
class Migration(... | Fix database migration script for UUID field in invoice item model. | Fix database migration script for UUID field in invoice item model.
| Python | mit | opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind | ---
+++
@@ -1,6 +1,6 @@
import uuid
-from django.db import migrations
+from django.db import migrations, models
import waldur_core.core.fields
@@ -20,9 +20,7 @@
operations = [
migrations.AddField(
- model_name='invoiceitem',
- name='uuid',
- field=waldur_core.c... |
9b19d366c7e1cf41ffc6af4eaed789995ddc5cc2 | byceps/blueprints/core_admin/views.py | byceps/blueprints/core_admin/views.py | """
byceps.blueprints.core_admin.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from ...services.brand import service as brand_service
from ...util.framework.blueprint import create_blueprint
from ..authorization.registry impor... | """
byceps.blueprints.core_admin.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from ...services.brand import service as brand_service
from ...util.framework.blueprint import create_blueprint
from ..authorization.registry impor... | Generalize name of function to inject admin template variables | Generalize name of function to inject admin template variables
| Python | bsd-3-clause | homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps | ---
+++
@@ -21,7 +21,7 @@
@blueprint.app_context_processor
-def inject_brands():
+def inject_template_variables():
brands = brand_service.get_brands()
return { |
f3bb89a58375ac91efb1fa6f3426c0a7e7dd85d5 | tests/fixtures/source.py | tests/fixtures/source.py | #!/usr/bin/env python
class Person:
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
def fullname(self):
return "%s %s" % (self.first_name, self.last_name)
def not_called(self):
print("Shouldn't be called")
person = Perso... | #!/usr/bin/env python
class Person:
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
def fullname(self):
return "%s %s" % (self.first_name, self.last_name)
def not_called(self):
print("Shouldn't be called")
person = Pers... | Add BOM signature to test fixture | Add BOM signature to test fixture
| Python | mit | codeclimate/python-test-reporter,codeclimate/python-test-reporter | ---
+++
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python
class Person: |
6ac683ca1905fbf17dd63c1264609e770439fa7f | test/integration/targets/module_utils/library/test_env_override.py | test/integration/targets/module_utils/library/test_env_override.py | #!/usr/bin/python
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.json_utils import data
from ansible.module_utils.mork import data as mork_data
results = {"json_utils": data, "mork": mork_data}
AnsibleModule(argument_spec=dict()).exit_json(**results)
| #!/usr/bin/python
# Most of these names are only available via PluginLoader so pylint doesn't
# know they exist
# pylint: disable=no-name-in-module
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.json_utils import data
from ansible.module_utils.mork import data as mork_data
results = {"j... | Disable pylint check for names existing in modules for test data | Disable pylint check for names existing in modules for test data
This test data imports from modules which are only available via
PluginLoader for this test case. So pylint doesn't know anything about
them
| Python | mit | thaim/ansible,thaim/ansible | ---
+++
@@ -1,4 +1,7 @@
#!/usr/bin/python
+# Most of these names are only available via PluginLoader so pylint doesn't
+# know they exist
+# pylint: disable=no-name-in-module
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.json_utils import data
from ansible.module_utils.mork import... |
d4acff165712281cb7205cca1c39e7eaf1fdd23b | base/broadcast.py | base/broadcast.py | from abc import ABCMeta, abstractmethod
from enum import Enum
class Broadcast(metaclass=ABCMeta):
"""
An interface for defining a broadcast protocol.
The 'propose' and 'decide' methods need to be defined
"""
class MessageType(Enum):
SEND = 1
ECHO = 2
READY = 3
def __i... | Add abstract Broadcast protocol class | Add abstract Broadcast protocol class
| Python | mit | koevskinikola/ByzantineRandomizedConsensus | ---
+++
@@ -0,0 +1,30 @@
+from abc import ABCMeta, abstractmethod
+from enum import Enum
+
+
+class Broadcast(metaclass=ABCMeta):
+ """
+ An interface for defining a broadcast protocol.
+ The 'propose' and 'decide' methods need to be defined
+ """
+
+ class MessageType(Enum):
+ SEND = 1
+ ... | |
7872abf00b24a504fccba576b13ecdd140e0135f | pybb/read_tracking.py | pybb/read_tracking.py | def update_read_tracking(topic, user):
tracking = user.readtracking
#if last_read > last_read - don't check topics
if tracking.last_read and tracking.last_read > (topic.last_post.updated or
topic.last_post.created):
return
if isinstance(track... | def update_read_tracking(topic, user):
tracking = user.readtracking
#if last_read > last_read - don't check topics
if tracking.last_read and tracking.last_read > (topic.last_post.updated or
topic.last_post.created):
return
if isinstance(track... | Fix bug in read tracking system | Fix bug in read tracking system
| Python | bsd-2-clause | ttyS15/pybbm,onecue/pybbm,katsko/pybbm,katsko/pybbm,wengole/pybbm,wengole/pybbm,webu/pybbm,acamposruiz/quecoins,springmerchant/pybbm,NEERAJIITKGP/pybbm,webu/pybbm,concentricsky/pybbm,skolsuper/pybbm,hovel/pybbm,NEERAJIITKGP/pybbm,hovel/pybbm,webu/pybbm,artfinder/pybbm,onecue/pybbm,katsko/pybbm,ttyS15/pybbm,wengole/pybb... | ---
+++
@@ -12,9 +12,9 @@
tracking.topics = None
tracking.last_read = datetime.now()
tracking.save()
- #update topics if exist new post or does't exist in dict
+ #update topics if new post exists or cache entry is empty
if topic.last_post.pk > tracking.top... |
346ffdb3e3836e2931f838a6dd929a325da0d5e6 | tests/test_arithmetic.py | tests/test_arithmetic.py | from intervals import Interval
class TestArithmeticOperators(object):
def test_add_operator(self):
assert Interval(1, 2) + Interval(1, 2) == Interval(2, 4)
def test_sub_operator(self):
assert Interval(1, 3) - Interval(1, 2) == Interval(-1, 2)
def test_isub_operator(self):
range_ ... | from pytest import mark
from intervals import Interval
class TestArithmeticOperators(object):
def test_add_operator(self):
assert Interval(1, 2) + Interval(1, 2) == Interval(2, 4)
def test_sub_operator(self):
assert Interval(1, 3) - Interval(1, 2) == Interval(-1, 2)
def test_isub_operato... | Add some tests for intersection | Add some tests for intersection
| Python | bsd-3-clause | kvesteri/intervals | ---
+++
@@ -1,3 +1,4 @@
+from pytest import mark
from intervals import Interval
@@ -17,3 +18,11 @@
range_ = Interval(1, 2)
range_ += Interval(1, 2)
assert range_ == Interval(2, 4)
+
+ @mark.parametrize(('first', 'second', 'intersection'), (
+ ('[1, 5]', '[2, 9]', '[2, 5]'),
+... |
2a0c8bdb74404556483cd60e7cb2f8e25559e500 | pylearn2/scripts/tutorials/grbm_smd/test_grbm_smd.py | pylearn2/scripts/tutorials/grbm_smd/test_grbm_smd.py | import pylearn2
from pylearn2.utils.serial import load_train_file
import os
from pylearn2.testing import no_debug_mode
from theano import config
@no_debug_mode
def test_train_example():
""" tests that the grbm_smd example script runs correctly """
assert config.mode != "DEBUG_MODE"
path = pylearn2.__p... | import pylearn2
from pylearn2.utils.serial import load_train_file
import os
from pylearn2.testing import no_debug_mode
from theano import config
@no_debug_mode
def test_train_example():
""" tests that the grbm_smd example script runs correctly """
assert config.mode != "DEBUG_MODE"
path = pylearn2.__p... | Fix failing test through loading of examples from $PWD. | Fix failing test through loading of examples from $PWD.
| Python | bsd-3-clause | aalmah/pylearn2,TNick/pylearn2,shiquanwang/pylearn2,alexjc/pylearn2,fyffyt/pylearn2,bartvm/pylearn2,pkainz/pylearn2,lancezlin/pylearn2,pkainz/pylearn2,CIFASIS/pylearn2,daemonmaker/pylearn2,woozzu/pylearn2,ddboline/pylearn2,caidongyun/pylearn2,shiquanwang/pylearn2,mclaughlin6464/pylearn2,chrish42/pylearn,theoryno3/pylea... | ---
+++
@@ -11,14 +11,19 @@
assert config.mode != "DEBUG_MODE"
path = pylearn2.__path__[0]
train_example_path = os.path.join(path, 'scripts', 'tutorials', 'grbm_smd')
- train_yaml_path = os.path.join(train_example_path, 'cifar_grbm_smd.yaml')
- train_object = load_train_file(train_yaml_path)
+ ... |
4cfd8771b91c7c2b9f28ca4b9776e9770683093b | frigg/builds/admin.py | frigg/builds/admin.py | # -*- coding: utf8 -*-
from django.contrib import admin
from .models import Build, BuildResult, Project
class BuildResultInline(admin.StackedInline):
model = BuildResult
readonly_fields = ('result_log', 'succeeded', 'return_code')
extra = 0
max_num = 0
class BuildInline(admin.TabularInline):
mo... | # -*- coding: utf8 -*-
from django.contrib import admin
from django.template.defaultfilters import pluralize
from .models import Build, BuildResult, Project
class BuildResultInline(admin.StackedInline):
model = BuildResult
readonly_fields = ('result_log', 'succeeded', 'return_code')
extra = 0
max_num... | Add restart_build action to BuildAdmin | Add restart_build action to BuildAdmin
| Python | mit | frigg/frigg-hq,frigg/frigg-hq,frigg/frigg-hq | ---
+++
@@ -1,5 +1,6 @@
# -*- coding: utf8 -*-
from django.contrib import admin
+from django.template.defaultfilters import pluralize
from .models import Build, BuildResult, Project
@@ -30,6 +31,18 @@
list_display = ('build_number', 'project', 'branch', 'pull_request_id', 'sha', 'color')
inlines = [B... |
b1b1392d2f268a5c74fd21c826a3ea6387567cab | froide/bounce/apps.py | froide/bounce/apps.py | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class BounceConfig(AppConfig):
name = 'froide.bounce'
verbose_name = _('Bounce')
def ready(self):
from froide.account import account_canceled
account_canceled.connect(cancel_user)
def cancel_user(... | import json
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class BounceConfig(AppConfig):
name = 'froide.bounce'
verbose_name = _('Bounce')
def ready(self):
from froide.account import account_canceled
from froide.account.export import registry
... | Add user data export for bounce handling | Add user data export for bounce handling | Python | mit | fin/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide | ---
+++
@@ -1,3 +1,5 @@
+import json
+
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
@@ -8,8 +10,10 @@
def ready(self):
from froide.account import account_canceled
+ from froide.account.export import registry
account_canceled.connect(ca... |
f9d7f69d7e8ae1dceaba09ac4412438076261744 | tests/test_completion.py | tests/test_completion.py | import os
import subprocess
import sys
from pathlib import Path
import typer
from typer.testing import CliRunner
from first_steps import tutorial001 as mod
runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)
def test_show_completion():
result = subprocess.run(
[
"bash",
... | import os
import subprocess
import sys
from pathlib import Path
import typer
from typer.testing import CliRunner
from first_steps import tutorial001 as mod
runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)
def test_show_completion():
result = subprocess.run(
[
"bash",
... | Update completion tests, checking for printed message | :white_check_mark: Update completion tests, checking for printed message
| Python | mit | tiangolo/typer,tiangolo/typer | ---
+++
@@ -45,5 +45,7 @@
env={**os.environ, "SHELL": "/bin/bash"},
)
new_text = bash_completion_path.read_text()
+ bash_completion_path.write_text(text)
assert "_TUTORIAL001.PY_COMPLETE=complete-bash" in new_text
- bash_completion_path.write_text(text)
+ assert "completion installed ... |
83ea38ee5616b1637cc2d983d4518d83793c7b72 | lint/events.py | lint/events.py | from collections import defaultdict
import traceback
LINT_START = 'LINT_START'
LINT_RESULT = 'LINT_RESULT'
LINT_END = 'LINT_END'
listeners = defaultdict(set)
def subscribe(topic, fn):
listeners[topic].add(fn)
def unsubscribe(topic, fn):
try:
listeners[topic].remove(fn)
except KeyError:
... | from collections import defaultdict
import traceback
LINT_START = 'LINT_START' # (buffer_id)
LINT_RESULT = 'LINT_RESULT' # (buffer_id, linter_name, errors)
LINT_END = 'LINT_END' # (buffer_id)
listeners = defaultdict(set)
def subscribe(topic, fn):
listeners[topic].add(fn)
def unsubscribe(topic, fn... | Add very brief comments about the event types | Add very brief comments about the event types
| Python | mit | SublimeLinter/SublimeLinter3,SublimeLinter/SublimeLinter3 | ---
+++
@@ -2,9 +2,9 @@
import traceback
-LINT_START = 'LINT_START'
-LINT_RESULT = 'LINT_RESULT'
-LINT_END = 'LINT_END'
+LINT_START = 'LINT_START' # (buffer_id)
+LINT_RESULT = 'LINT_RESULT' # (buffer_id, linter_name, errors)
+LINT_END = 'LINT_END' # (buffer_id)
listeners = defaultdict(set) |
d572c7228d4c4fb84530b8a33df7bd4596e01d8b | app/billing/billing_schemas.py | app/billing/billing_schemas.py | from datetime import datetime
create_or_update_free_sms_fragment_limit_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "POST annual billing schema",
"type": "object",
"title": "Create",
"properties": {
"free_sms_fragment_limit": {"type": "integer", "minimum":... | from datetime import datetime
create_or_update_free_sms_fragment_limit_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "POST annual billing schema",
"type": "object",
"title": "Create",
"properties": {
"free_sms_fragment_limit": {"type": "integer", "minimum":... | Allow the free SMS fragment limit to be 0 | Allow the free SMS fragment limit to be 0
This updates the schema so that the free allowance has a minimum value
of 0 instead of 1.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -6,7 +6,7 @@
"type": "object",
"title": "Create",
"properties": {
- "free_sms_fragment_limit": {"type": "integer", "minimum": 1},
+ "free_sms_fragment_limit": {"type": "integer", "minimum": 0},
},
"required": ["free_sms_fragment_limit"]
} |
9b93ffa1662e99888c430e6deab01bd215055253 | examples/analog_watch.py | examples/analog_watch.py | from microbit import *
hands = Image.ALL_CLOCKS
#A centre dot of brightness 2.
ticker_image = Image("2\n").crop(-2,-2,5,5)
#Adjust these to taste
MINUTE_BRIGHT = 0.1111
HOUR_BRIGHT = 0.55555
#Generate hands for 5 minute intervals
def fiveticks():
fivemins = 0
hours = 0
while True:
yield hands[f... | from microbit import *
hands = Image.ALL_CLOCKS
#A centre dot of brightness 2.
ticker_image = Image("2\n").crop(-2,-2,5,5)
#Adjust these to taste
MINUTE_BRIGHT = 0.1111
HOUR_BRIGHT = 0.55555
#Generate hands for 5 minute intervals
def fiveticks():
fivemins = 0
hours = 0
while True:
yield hands[f... | Use display.show instead of display.animate | Use display.show instead of display.animate
| Python | mit | JoeGlancy/micropython,JoeGlancy/micropython,JoeGlancy/micropython | ---
+++
@@ -30,7 +30,7 @@
on = not on
#Run a clock speeded up 60 times, so we can watch the animation.
-display.animate(ticks(), 1000)
+display.show(ticks(), 1000)
|
4286d2d6a685571c70a8f48c3cd6802d13c4acef | braid/postgres.py | braid/postgres.py | from fabric.api import sudo, quiet
from braid import package
from pipes import quote
def install():
package.install(['postgresql-9.1', 'postgresql-server-dev-9.1'])
def _runQuery(query):
with quiet():
return sudo('psql --no-align --no-readline --no-password --quiet '
'--tuples-on... | from fabric.api import sudo, hide
from braid import package
from pipes import quote
def install():
package.install(['postgresql-9.1', 'postgresql-server-dev-9.1'])
def _runQuery(query):
with hide('running', 'output'):
return sudo('psql --no-align --no-readline --no-password --quiet '
... | Make _runQuery to fail if the query fails, but still hide the execution messages | Make _runQuery to fail if the query fails, but still hide the execution messages
| Python | mit | alex/braid,alex/braid | ---
+++
@@ -1,4 +1,4 @@
-from fabric.api import sudo, quiet
+from fabric.api import sudo, hide
from braid import package
from pipes import quote
@@ -8,7 +8,7 @@
def _runQuery(query):
- with quiet():
+ with hide('running', 'output'):
return sudo('psql --no-align --no-readline --no-password --qu... |
92d253fdce108162ab2ce05dd38da971ca42293d | keystone/contrib/kds/common/service.py | keystone/contrib/kds/common/service.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Restructure KDS options to be more like Keystone's options | Restructure KDS options to be more like Keystone's options
Restructure the KDS options to be more closely aligned with the way
Keystone options work and allowing movement towards not registering
the options on import. This will also prevent KDS options from
appearing in the Keystone auto-generated sample config.
Chan... | Python | apache-2.0 | rushiagr/keystone,jumpstarter-io/keystone,reeshupatel/demo,dstanek/keystone,idjaw/keystone,jonnary/keystone,vivekdhayaal/keystone,MaheshIBM/keystone,klmitch/keystone,rajalokan/keystone,rajalokan/keystone,nuxeh/keystone,ging/keystone,rushiagr/keystone,takeshineshiro/keystone,ilay09/keystone,nuxeh/keystone,roopali8/keyst... | ---
+++
@@ -16,16 +16,22 @@
CONF = cfg.CONF
-API_SERVICE_OPTS = [
- cfg.StrOpt('bind_ip',
- default='0.0.0.0',
- help='IP for the server to bind to'),
- cfg.IntOpt('port',
- default=9109,
- help='The port for the server'),
-]
+FILE_OPTIONS = {
+ No... |
eaa13f9005a8aaf8c748a98de697b03eee9e675b | salt/client/netapi.py | salt/client/netapi.py | # encoding: utf-8
'''
The main entry point for salt-api
'''
from __future__ import absolute_import
# Import python libs
import logging
# Import salt-api libs
import salt.loader
import salt.utils.process
logger = logging.getLogger(__name__)
class NetapiClient(object):
'''
Start each netapi module that is con... | # encoding: utf-8
'''
The main entry point for salt-api
'''
from __future__ import absolute_import
# Import python libs
import logging
# Import salt-api libs
import salt.loader
import salt.utils.process
logger = logging.getLogger(__name__)
class NetapiClient(object):
'''
Start each netapi module that is con... | Add log error if we run salt-api w/ no config | Add log error if we run salt-api w/ no config
Currently, the salt-api script will exit with no error or hint of why it
failed if there is no netapi module configured. Added a short line if
we find no api modules to start, warning the user that the config may be
missing.
Fixes #28240
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -26,6 +26,9 @@
'''
Load and start all available api modules
'''
+ if not len(self.netapi):
+ logger.error("Did not find any netapi configurations, nothing to start")
+
for fun in self.netapi:
if fun.endswith('.start'):
logg... |
917c2701f25f15b0d39a4dd8f93254b75aa058dd | script/release/release/pypi.py | script/release/release/pypi.py | from __future__ import absolute_import
from __future__ import unicode_literals
from configparser import Error
from requests.exceptions import HTTPError
from twine.commands.upload import main as twine_upload
from twine.utils import get_config
from .utils import ScriptError
def pypi_upload(args):
print('Uploading... | from __future__ import absolute_import
from __future__ import unicode_literals
from configparser import Error
from requests.exceptions import HTTPError
from twine.commands.upload import main as twine_upload
from twine.utils import get_config
from .utils import ScriptError
def pypi_upload(args):
print('Uploading... | Fix script for release file already present case | Fix script for release file already present case
This avoids a:
"AttributeError: 'HTTPError' object has no attribute 'message'"
Signed-off-by: Ulysses Souza <a0ff1337c6a0e43e9559f5f67fc3acb852912071@docker.com>
| Python | apache-2.0 | thaJeztah/compose,vdemeester/compose,vdemeester/compose,thaJeztah/compose | ---
+++
@@ -18,7 +18,7 @@
'dist/docker-compose-{}*.tar.gz'.format(rel)
])
except HTTPError as e:
- if e.response.status_code == 400 and 'File already exists' in e.message:
+ if e.response.status_code == 400 and 'File already exists' in str(e):
if not args.finalize... |
0f1ed52e7525ea5f41d63642bca1eaeb9d5af8ba | emission/core/wrapper/labelprediction.py | emission/core/wrapper/labelprediction.py | # Based on modeprediction.py
import emission.core.wrapper.wrapperbase as ecwb
class Labelprediction(ecwb.WrapperBase):
props = {"trip_id": ecwb.WrapperBase.Access.WORM, # the trip that this is part of
"prediction": ecwb.WrapperBase.Access.WORM, # What we predict
"start_ts": ecwb.Wrapp... | # Based on modeprediction.py
import emission.core.wrapper.wrapperbase as ecwb
# The "prediction" data structure is a list of label possibilities, each one consisting of a set of labels and a probability:
# [
# {"labels": {"labeltype1": "labelvalue1", "labeltype2": "labelvalue2"}, "p": 0.61},
# {"labels": {"label... | Add comments explaining prediction data structure | Add comments explaining prediction data structure
| Python | bsd-3-clause | shankari/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server | ---
+++
@@ -1,9 +1,16 @@
# Based on modeprediction.py
import emission.core.wrapper.wrapperbase as ecwb
+# The "prediction" data structure is a list of label possibilities, each one consisting of a set of labels and a probability:
+# [
+# {"labels": {"labeltype1": "labelvalue1", "labeltype2": "labelvalue2"}, "p... |
3e614788b179fa3549098870c5ba9ca0ce4a35a1 | src/euth/setup.py | src/euth/setup.py | """Adhocracy frontend customization package."""
import os
import version
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = ['adhocracy_frontend',
... | """Adhocracy frontend customization package."""
import os
import version
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = ['adhocracy_frontend',
... | Remove old dependency to kit from euth frontend | Remove old dependency to kit from euth frontend
| Python | agpl-3.0 | liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator | ---
+++
@@ -9,15 +9,15 @@
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = ['adhocracy_frontend',
- 'adhocracy_kit',
+ 'adhocracy_euth',
]
test_requires = ['adhocracy_frontend[test]',
- 'adhocracy_kit[test]',
+ 'adhocracy_eut... |
841289e7092a5e4bf485ef525f358aa3a58f7fb9 | meta-iotqa/lib/oeqa/runtime/sanity/comm_btcheck.py | meta-iotqa/lib/oeqa/runtime/sanity/comm_btcheck.py | import time
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.decorators import tag
@tag(TestType="FVT", FeatureID="IOTOS-453")
class CommBluetoothTest(oeRuntimeTest):
"""
@class CommBluetoothTest
"""
log = ""
def setUp(self):
self.target.run('connmanctl enable bluetooth')
time... | import time
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.decorators import tag
@tag(TestType="FVT", FeatureID="IOTOS-453")
class CommBluetoothTest(oeRuntimeTest):
"""
@class CommBluetoothTest
"""
log = ""
def setUp(self):
self.target.run('connmanctl enable bluetooth')
time... | Remove Edison specific command from Bluetooth test | meta-iotqa: Remove Edison specific command from Bluetooth test
The platform isn't supported anymore and the command isn't needed with
current devices.
Signed-off-by: Simo Kuusela <4755938158c3c622d3884e9a75ed20dc865bc695@intel.com>
| Python | mit | YinThong/intel-iot-refkit,mythi/intel-iot-refkit,mythi/intel-iot-refkit,klihub/intel-iot-refkit,jairglez/intel-iot-refkit,klihub/intel-iot-refkit,intel/intel-iot-refkit,YinThong/intel-iot-refkit,jairglez/intel-iot-refkit,YinThong/intel-iot-refkit,YinThong/intel-iot-refkit,mythi/intel-iot-refkit,intel/intel-iot-refkit,k... | ---
+++
@@ -34,9 +34,6 @@
@param self
@return
'''
- # un-block software rfkill lock
- self.target.run('rfkill unblock all')
- # This is special for edison platform
# Collect system information as log
self.target_collect_info("ifconfig")
self.t... |
4a48be97254f4626eaadf86492d98e0dd640d43d | flower/utils/__init__.py | flower/utils/__init__.py | from __future__ import absolute_import
import uuid
import base64
import os.path
from .. import __version__
def gen_cookie_secret():
return base64.b64encode(uuid.uuid4().bytes + uuid.uuid4().bytes)
def bugreport():
try:
import celery
return 'flower -> %s' % __version__ + celery.bugreport(... | from __future__ import absolute_import
import uuid
import base64
import os.path
from .. import __version__
def gen_cookie_secret():
return base64.b64encode(uuid.uuid4().bytes + uuid.uuid4().bytes)
def bugreport():
try:
import celery
import tornado
import babel
return 'flowe... | Include tornado and babel version info in bug report | Include tornado and babel version info in bug report
| Python | bsd-3-clause | raphaelmerx/flower,ChinaQuants/flower,pj/flower,Lingling7/flower,tellapart/flower,alexmojaki/flower,ucb-bar/bar-crawl-web,Lingling7/flower,ChinaQuants/flower,jzhou77/flower,Lingling7/flower,lucius-feng/flower,lucius-feng/flower,ucb-bar/bar-crawl-web,allengaller/flower,asmodehn/flower,allengaller/flower,lucius-feng/flow... | ---
+++
@@ -14,7 +14,11 @@
def bugreport():
try:
import celery
- return 'flower -> %s' % __version__ + celery.bugreport()
+ import tornado
+ import babel
+ return 'flower -> flower:%s tornado:%s babel:%s' %\
+ (__version__, tornado.version, babel.__version... |
98e574061dc430b1cad6c9bbef5b55aa92803206 | command_line/rebin_images.py | command_line/rebin_images.py | # LIBTBX_SET_DISPATCHER_NAME dev.dials.rebin_images
from __future__ import division
def rebin_images(in_template, out_template, start, end):
from dials.util.rebin_images import main
in_images = [in_template % j for j in range(start, end + 1)]
out_images = [out_template % j for j in range(start, end + 1)]
main... | # LIBTBX_SET_DISPATCHER_NAME dev.dials.rebin_images
from __future__ import division
def rebin_images(in_template, out_template, start, end):
from dials.util.rebin_images import main
in_images = [in_template % j for j in range(start, end + 1)]
out_images = [out_template % j for j in range(start, end + 1)]
main... | Check email update on branch for YT only | Check email update on branch for YT only
| Python | bsd-3-clause | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | ---
+++
@@ -7,6 +7,7 @@
in_images = [in_template % j for j in range(start, end + 1)]
out_images = [out_template % j for j in range(start, end + 1)]
main(in_images, out_images)
+ return
if __name__ == '__main__':
import sys |
4e483d6443e809f9e7e1a59c3fe959fd5f42f938 | simple-cipher/simple_cipher.py | simple-cipher/simple_cipher.py | import math
import secrets
from string import ascii_lowercase
class Cipher(object):
def __init__(self, key=None):
if not key:
key = Cipher._random_key()
if not key.isalpha() or not key.islower():
raise ValueError("Key must consist only of lowercase letters")
self.ke... | import math
import secrets
from string import ascii_lowercase
class Cipher(object):
def __init__(self, key=None):
if not key:
key = self._random_key()
if not key.isalpha() or not key.islower():
raise ValueError("Key must consist only of lowercase letters")
self.key ... | Use super() and self within the Cipher and Caesar classes | Use super() and self within the Cipher and Caesar classes
| Python | agpl-3.0 | CubicComet/exercism-python-solutions | ---
+++
@@ -6,7 +6,7 @@
class Cipher(object):
def __init__(self, key=None):
if not key:
- key = Cipher._random_key()
+ key = self._random_key()
if not key.isalpha() or not key.islower():
raise ValueError("Key must consist only of lowercase letters")
... |
5ca96beb26dd2ab5285a57f5cade6f01160df368 | joequery/blog/posts/code/notes-on-dynamic-programming-part-1/meta.py | joequery/blog/posts/code/notes-on-dynamic-programming-part-1/meta.py | title="Notes on dynamic programming - part 1"
description="""
Part 1 of extensive notes discussing the fundamentals of dynamic programming.
Examples in these notes include the Fibonacci sequence and Warshall's
algorithm. Pseudocode and Python implementations of the algorithms are
provided.
"""
time="2012-12-10 Mon 02:... | title="Notes on dynamic programming - part 1"
description="""
Part 1 of extensive notes discussing the fundamentals of dynamic programming.
Examples in these notes include the Fibonacci sequence, the Binomial Formula,
and Warshall's algorithm. Python implementations of the algorithms are
provided.
"""
time="2012-12-10... | Update description and timestamp for dynamic programming part 1 | Update description and timestamp for dynamic programming part 1
| Python | mit | joequery/joequery.me,joequery/joequery.me,joequery/joequery.me,joequery/joequery.me | ---
+++
@@ -1,9 +1,9 @@
title="Notes on dynamic programming - part 1"
description="""
Part 1 of extensive notes discussing the fundamentals of dynamic programming.
-Examples in these notes include the Fibonacci sequence and Warshall's
-algorithm. Pseudocode and Python implementations of the algorithms are
+Exampl... |
c04b9813b5d6d3f8bc8eaa7be2d49d32f150aaf2 | tests/test_authentication.py | tests/test_authentication.py | import unittest
from flask import json
from api import db
from api.BucketListAPI import app
from instance.config import application_config
class AuthenticationTestCase(unittest.TestCase):
def setUp(self):
app.config.from_object(application_config['TestingEnv'])
self.client = app.test_client()
... | import unittest
from flask import json
from api import db
from api.BucketListAPI import app
from instance.config import application_config
class AuthenticationTestCase(unittest.TestCase):
def setUp(self):
app.config.from_object(application_config['TestingEnv'])
self.client = app.test_client()
... | Add test for user with missing credentials | Add test for user with missing credentials
| Python | mit | patlub/BucketListAPI,patlub/BucketListAPI | ---
+++
@@ -20,6 +20,17 @@
self.assertEqual(response.status_code, 201)
self.assertIn('Welcome Message', response.data.decode())
+ def test_registration_with_missing_dredentials(self):
+ """Should throw error for missing credentials"""
+ user = json.dumps({
+ 'name': '',... |
47f1b47f37da4f9a3444a2ac6cc7b7a0affafbf3 | node_bridge.py | node_bridge.py | import os
import platform
import subprocess
IS_MACOS = platform.system() == 'Darwin'
IS_WINDOWS = platform.system() == 'Windows'
def node_bridge(data, bin, args=[]):
env = None
startupinfo = None
if IS_MACOS:
# GUI apps on macOS doesn't contain .bashrc/.zshrc set paths
env = os.environ.copy()
env['PATH'] += ... | import os
import platform
import subprocess
IS_MACOS = platform.system() == 'Darwin'
IS_WINDOWS = platform.system() == 'Windows'
def node_bridge(data, bin, args=[]):
env = None
startupinfo = None
if IS_MACOS:
# GUI apps on macOS doesn't contain .bashrc/.zshrc set paths
env = os.environ.copy()
env['PATH'] += ... | Add support for `n` Node.js version manager | Add support for `n` Node.js version manager
| Python | mit | sindresorhus/sublime-autoprefixer,sindresorhus/sublime-autoprefixer,sindresorhus/sublime-autoprefixer | ---
+++
@@ -11,6 +11,7 @@
if IS_MACOS:
# GUI apps on macOS doesn't contain .bashrc/.zshrc set paths
env = os.environ.copy()
+ env['PATH'] += os.path.expanduser('~/n/bin')
env['PATH'] += ':/usr/local/bin'
if IS_WINDOWS:
startupinfo = subprocess.STARTUPINFO() |
c7660db45e0275a685a6cc450fd4341a69c52b92 | threaded_multihost/fields.py | threaded_multihost/fields.py | from django.db.models import ForeignKey
from django.contrib.auth.models import User
import threadlocals
class UserField(ForeignKey):
""" UserField
By defaults, foreign key to User; null=True, blank=True
"""
def __init__(self, **kwargs):
kwargs.setdefault('null', True)
kwargs.setdefa... | from django.db.models import ForeignKey
from django.contrib.auth.models import User
import threadlocals
class UserField(ForeignKey):
""" UserField
By defaults, foreign key to User; null=True, blank=True
"""
def __init__(self, **kwargs):
kwargs.setdefault('to', User)
kwargs.setdefaul... | Patch from chrischambers to enable south migrations. | Patch from chrischambers to enable south migrations.
| Python | bsd-3-clause | diver-in-sky/django-threaded-multihost | ---
+++
@@ -11,11 +11,12 @@
"""
def __init__(self, **kwargs):
+ kwargs.setdefault('to', User)
kwargs.setdefault('null', True)
kwargs.setdefault('blank', True)
- ForeignKey.__init__(self, User, **kwargs)
+ ForeignKey.__init__(self, **kwargs)
-
+
class Creator... |
305e88780fc2d3638fb3a9f33bfec8d6c295535e | feincms/views/base.py | feincms/views/base.py | from django.contrib.auth.decorators import permission_required
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from feincms.module.page.models import Page
def build_page_response(page, request):
response = page.setup_request(request)
if respo... | from django.contrib.auth.decorators import permission_required
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from feincms.module.page.models import Page
def _build_page_response(page, request):
response = page.setup_request(request)
if resp... | Make sure we invoke the response processors even for app content. | Make sure we invoke the response processors even for app content.
| Python | bsd-3-clause | matthiask/feincms2-content,joshuajonah/feincms,nickburlett/feincms,nickburlett/feincms,hgrimelid/feincms,feincms/feincms,mjl/feincms,mjl/feincms,joshuajonah/feincms,pjdelport/feincms,matthiask/django-content-editor,feincms/feincms,matthiask/feincms2-content,matthiask/django-content-editor,hgrimelid/feincms,pjdelport/fe... | ---
+++
@@ -5,7 +5,7 @@
from feincms.module.page.models import Page
-def build_page_response(page, request):
+def _build_page_response(page, request):
response = page.setup_request(request)
if response is None:
@@ -16,6 +16,10 @@
return response
+def build_page_response(page, request):
+... |
c7ef639ac9bab4a01e4c8cbafb71bf09d973c355 | src/adhocracy/lib/auth/shibboleth.py | src/adhocracy/lib/auth/shibboleth.py | from pylons import config
def get_userbadge_mapping(config=config):
mapping = config.get('adhocracy.shibboleth.userbadge_mapping', u'')
return (line.strip().split(u' ')
for line in mapping.strip().split(u'\n')
if line is not u'')
def _attribute_equals(request, key, value):
"""
... | from pylons import config
def get_userbadge_mapping(config=config):
mapping = config.get('adhocracy.shibboleth.userbadge_mapping', u'')
return (line.strip().split(u' ')
for line in mapping.strip().split(u'\n')
if line is not u'')
def _attribute_equals(request, key, value):
"""
... | Use ; instead of , for Shibboleth multi value fields | Use ; instead of , for Shibboleth multi value fields
This corresponds to what mod_shibboleth does.
| Python | agpl-3.0 | liqd/adhocracy,liqd/adhocracy,phihag/adhocracy,DanielNeugebauer/adhocracy,liqd/adhocracy,alkadis/vcv,phihag/adhocracy,phihag/adhocracy,phihag/adhocracy,SysTheron/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,SysTheron/adhocracy,alkadis/vcv,alkadis/vcv,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,liqd/adhocr... | ---
+++
@@ -19,7 +19,7 @@
"""
contains element
"""
- elements = (e.strip() for e in request.headers.get(key).split(','))
+ elements = (e.strip() for e in request.headers.get(key).split(';'))
return value in elements
|
1702fbc607816544c28a8f2895a82d234226e48b | euler/p007.py | euler/p007.py | """Solution to Project Euler Problem 7
https://projecteuler.net/problem=7
"""
INDEX = 10001
def compute(index=INDEX):
"""Find the `index`th prime number."""
primes = list()
test_number = 2
while len(primes) < index:
for prime in primes:
if test_number % prime == 0:
... | """Solution to Project Euler Problem 7
https://projecteuler.net/problem=7
"""
INDEX = 10001
def compute(index=INDEX):
"""Find the `index`th prime number."""
primes = [2]
test_number = 3
while len(primes) < index:
for prime in primes:
if test_number % prime == 0:
... | Check only odd numbers after 2 | P007: Check only odd numbers after 2
| Python | mit | 2Cubed/ProjectEuler | ---
+++
@@ -8,8 +8,8 @@
def compute(index=INDEX):
"""Find the `index`th prime number."""
- primes = list()
- test_number = 2
+ primes = [2]
+ test_number = 3
while len(primes) < index:
for prime in primes:
@@ -17,6 +17,6 @@
break
else:
primes.... |
fc472d043e81c2b5687a0f83dbbdd0dd02b73e35 | flowtype/commands/exec_flow.py | flowtype/commands/exec_flow.py | import os
import json
import threading
import subprocess
import sublime
class ExecFlowCommand(threading.Thread):
"""Threaded class used for running flow commands in a different thread.
The subprocess must be threaded so we don't lockup the UI.
"""
def __init__(self, cmd, content):
"""Initia... | import os
import json
import threading
import subprocess
import sublime
class ExecFlowCommand(threading.Thread):
"""Threaded class used for running flow commands in a different thread.
The subprocess must be threaded so we don't lockup the UI.
"""
def __init__(self, cmd, content):
"""Initia... | Add error output to exec error messages | Add error output to exec error messages
e.g. for an error like "env: ‘node’: No such file or directory"
the sublime console was only reporting "exited with code 127"
which wasn't very helpful in determining the cause.
| Python | mit | Pegase745/sublime-flowtype | ---
+++
@@ -46,5 +46,9 @@
os.close(read)
except subprocess.CalledProcessError as err:
- self.stderr = str(err)
+ if type(err.output) is bytes:
+ output = err.output.decode('utf-8')
+ else:
+ output = err.output
+ self.st... |
3aa13efa28b4ededa465541a7db8df5fc5878ce3 | tempora/tests/test_timing.py | tempora/tests/test_timing.py | import datetime
import time
import contextlib
import os
from unittest import mock
from tempora import timing
def test_IntervalGovernor():
"""
IntervalGovernor should prevent a function from being called more than
once per interval.
"""
func_under_test = mock.MagicMock()
# to look like a funct... | import datetime
import time
import contextlib
import os
from unittest import mock
import pytest
from tempora import timing
def test_IntervalGovernor():
"""
IntervalGovernor should prevent a function from being called more than
once per interval.
"""
func_under_test = mock.MagicMock()
# to loo... | Rewrite alt_tz as proper fixture. Skip when tzset isn't available. | Rewrite alt_tz as proper fixture. Skip when tzset isn't available.
| Python | mit | jaraco/tempora | ---
+++
@@ -4,6 +4,7 @@
import os
from unittest import mock
+import pytest
from tempora import timing
@@ -23,22 +24,28 @@
func_under_test.assert_called_once_with('a')
-@contextlib.contextmanager
-def change(alt_tz, monkeypatch):
- monkeypatch.setitem(os.environ, 'TZ', alt_tz)
- time.tzset()
- ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.