commit stringlengths 40 40 | subject stringlengths 1 3.25k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | old_contents stringlengths 0 26.3k | lang stringclasses 3
values | proba float64 0 1 | diff stringlengths 0 7.82k |
|---|---|---|---|---|---|---|---|
6abe163fcb37191d0547b5d947cd9543a4f50325 | Fix non-executable-script on packaging process | roles/sensu/client/files/sensu-haproxy-check.py | roles/sensu/client/files/sensu-haproxy-check.py | #!/usr/bin/python
import argparse
import json
import requests
import sys
from requests.auth import HTTPBasicAuth
def status2text(status):
'''Returns correct return code for haproxy stats record.'''
rc = 1
if status in ('UP', 'OPEN'):
rc = 0
if status == 'DOWN' or status == 'DOWN 1/2':
... | Python | 0.999817 | |
1b4ba2b5dbfa6889d063d73c48d325f670623846 | Set broker URL | ukrdc_importer/radar_ukrdc_importer/app.py | ukrdc_importer/radar_ukrdc_importer/app.py | from flask import Flask
from sqlalchemy import event
from radar.database import db
from radar_ukrdc_importer.utils import get_import_user
def create_app():
app = Flask(__name__)
app.config.from_envvar('RADAR_SETTINGS')
# noinspection PyUnresolvedReferences
from radar import models # noqa
db.in... | Python | 0.000001 | @@ -783,24 +783,157 @@
eate_app()%0A%0A
+ broker_url = app.config.get('CELERY_BROKER_URL')%0A%0A if broker_url is not None:%0A celery.conf%5B'BROKER_URL'%5D = broker_url%0A%0A
celery.c
|
b3c442e7d34a64b409b85fb1529ddd5472d5dc63 | Fix for notification sound on Linux | rummage/lib/gui/notify/notify_linux.py | rummage/lib/gui/notify/notify_linux.py | """
Notify Linux.
Copyright (c) 2013 - 2016 Isaac Muse <isaacmuse@gmail.com>
License: MIT
"""
import subprocess
import os
from . import util
__all__ = ("get_notify", "alert", "setup", "destroy")
PLAYERS = ('paplay', 'aplay', 'play')
class Options:
"""Notification options."""
icon = None
notify = None
... | Python | 0 | @@ -2616,20 +2616,16 @@
player
-not
in PLAYE
|
5d2573af858e685e1a12fe3de0d54fc199c76dff | Remove as_grey from qt imread | scikits/image/io/_plugins/qt_plugin.py | scikits/image/io/_plugins/qt_plugin.py | from util import prepare_for_display, window_manager, GuiLockError
import numpy as np
import sys
# We try to aquire the gui lock first or else the gui import might
# trample another GUI's PyOS_InputHook.
window_manager.acquire('qt')
try:
from PyQt4.QtGui import (QApplication, QMainWindow, QImage, QPixmap,
... | Python | 0.000006 | @@ -2432,23 +2432,8 @@
name
-, as_grey=False
):%0A
@@ -3562,16 +3562,27 @@
# Strip
+qt's false
alpha ch
@@ -3597,16 +3597,16 @@
needed%0A
-
if b
@@ -3652,24 +3652,24 @@
aChannel():%0A
+
img
@@ -3689,360 +3689,8 @@
:3%5D%0A
- if as_grey and bytesPerPixel %3E 1:%0A # Stolen from fits_p... |
380a65e72104bff579038aecc4fc9caaaa419d50 | fix for the replays and cache timeout | scrapy/trunk/scrapy/replay/__init__.py | scrapy/trunk/scrapy/replay/__init__.py | from __future__ import with_statement
import os
import cPickle as pickle
import shutil
import tempfile
import tarfile
from pydispatch import dispatcher
from scrapy.core import signals, log
from scrapy.core.manager import scrapymanager
from scrapy.core.exceptions import NotConfigured
from scrapy.conf import settings
... | Python | 0.000001 | @@ -1433,24 +1433,82 @@
f.cache2dir%0A
+ settings.overrides%5B'CACHE2_EXPIRATION_SECS'%5D = -1%0A
sett
|
bb35a480bd2533ed3c5a8c95af43f48c33252bbe | Properly fix line numbers | resumable.py | resumable.py | import ast
import inspect
import warnings
import linecache
from uuid import uuid4
from collections import OrderedDict
from astmonkey.transformers import ParentNodeTransformer
from astmonkey.visitors import SourceGeneratorNodeVisitor
def split(func, name=None):
return func, name
def get_sub(lst, pred):
for s... | Python | 0.999362 | @@ -2951,16 +2951,59 @@
(value))
+%0A body%5B-1%5D.lineno = value.lineno
%0A%0A
@@ -4604,93 +4604,110 @@
on)%0A
+%0A
-root, = ast.parse('%5Cn'.join(lines)).body%0A%0A ast.increment_lineno(root, lineno)%0A
+lines = ''.join(lines)%0A lines = '%5Cn' * (lineno - 1) + lines%0A%0A root, = a... |
221d0d39edfbf693a509d942e77143520afd314a | Add permissions to groups | data/management/commands/load_groups.py | data/management/commands/load_groups.py | from django.core.management import BaseCommand
from django.contrib.auth.models import Group
from users.models import MflUser
class Command(BaseCommand):
def handle(self, *args, **options):
chrio, created = Group.objects.get_or_create(
name="County Health Records Information Officer")
... | Python | 0.000001 | @@ -84,17 +84,29 @@
rt Group
+, Permission
%0A
-
from use
@@ -309,32 +309,33 @@
ation Officer%22)%0A
+%0A
schrio,
@@ -488,32 +488,32 @@
.get_or_create(%0A
-
name
@@ -530,16 +530,108 @@
Users%22)
+%0A for perm in Permission.objects.all():%0A national.permissions.add(perm.i... |
b29cceec982ef3d2e4dcb77dd612aa3af0f8c379 | add seek position in movie playback | StimControl/Experiments/demo/ffmpeg-timing.py | StimControl/Experiments/demo/ffmpeg-timing.py | #!/usr/bin/python
# Display movie on left and right viewport with arbitary inter-viewport delay with pyffmpeg.
#
# Copyright (C) 2010-2013 Huang Xin
#
# See LICENSE.TXT that came with this file.
from __future__ import division
import sys
import random
import pygame
import numpy as np
import threading
from threading i... | Python | 0.000001 | @@ -221,16 +221,26 @@
ivision%0A
+import os%0A
import s
@@ -294,170 +294,8 @@
np%0A%0A
-import threading%0Afrom threading import Thread %0Afrom multiprocessing import Process%0A%0Aimport time%0Aimport alsaaudio%0Afrom pyffmpeg import FFMpegReader, PixelFormats%0A%0A
from
@@ -667,16 +667,29 @@
SetMovie
+, MoviePlay... |
2a742af0fd1b9f33b2b78901a1a4b9a5db4df4c8 | change TableTop.board to be a flat list | source/game_table.py | source/game_table.py | class TableTop(object):
def __init__(self):
self.board = [[0,0,0],[0,0,0],[0,0,0]]
| Python | 0.000008 | @@ -71,30 +71,24 @@
d =
-%5B
%5B0,0,0
-%5D,%5B
+,
0,0,0
-%5D,%5B
+,
0,0,0%5D
-%5D
%0A
|
00b10f5bf340901a043f83c55d4a93da88f94ca6 | version bump | moya/_version.py | moya/_version.py | from __future__ import unicode_literals
VERSION = "0.6.10a0"
| Python | 0.000001 | @@ -54,9 +54,9 @@
.6.1
-0a0
+1a1
%22%0A
|
38c7bbb31a6d18c710016ea61df157426ddbcd89 | use OS specific path separator | mp3Downloader.py | mp3Downloader.py | import os
import tempfile
import subprocess
import shutil
import urllib2
from transcriber import Transcriber
"""
http://feeds.gimletmedia.com/~r/hearstartup/~5/sqn8_rZ3xTM/GLT6849433183.mp3
"""
TEMP_DIR = './tmp'
OUTPUT_DIR = './output'
def check_env_vars():
"""
Checks if all necessary ENV variables are s... | Python | 0 | @@ -206,39 +206,158 @@
R =
-'./tmp'%0AOUTPUT_DIR = './
+os.path.join(os.path.dirname(os.path.realpath(__file__)), 'tmp')%0AOUTPUT_DIR = os.path.join(%0A os.path.dirname(os.path.realpath(__file__)), '
output'
+)
%0A%0A%0Ad
@@ -1349,24 +1349,112 @@
y_folder():%0A
+ %22%22%22%0A Creates a temporary directory... |
e8df5f1648a59d2c180c67bfa25821626e39c3a6 | Allow using "global" as the stack id for SettingPropertyProvider | UM/Settings/Models/SettingPropertyProvider.py | UM/Settings/Models/SettingPropertyProvider.py | # Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from PyQt5.QtCore import QObject, QVariant, pyqtProperty, pyqtSlot, pyqtSignal
from UM.Logger import Logger
import UM.Settings
## This class provides the value and change notifications for the properties of a single ... | Python | 0 | @@ -1336,32 +1336,223 @@
self._stack_id:%0A
+ stack = None%0A if self._stack_id == %22global%22:%0A self._stack = UM.Application.getInstance().getGlobalContainerStack()%0A else:%0A
@@ -1661,22 +1661,22 @@
+
-if not
+ if
... |
db38b013f9c3596f41ee569b9fa7574bd4b5c8c4 | update test | molo/core/tests/test_models.py | molo/core/tests/test_models.py | import pytest
from datetime import datetime, timedelta
from django.test import TestCase
from molo.core.models import ArticlePage, SectionPage, LanguagePage, Page
@pytest.mark.django_db
class TestModels(TestCase):
fixtures = ['molo/core/tests/fixtures/test.json']
def test_article_order(self):
now = d... | Python | 0.000001 | @@ -756,17 +756,17 @@
article
-2
+1
.title)%0A
|
129e7f300a9356be59860ea93534a57220563a4b | test relies on syminfo.py, which needs CLIBD | Handlers/test_CommandLine.py | Handlers/test_CommandLine.py | from __future__ import absolute_import, division, print_function
import pytest
from xia2.Handlers.CommandLine import validate_project_crystal_name
from dials.util import Sorry
def test_validate_project_crystal_name():
for value in ("foo_001", "_foo_001", "foo", "_foo_", "_1foo"):
assert validate_project... | Python | 0 | @@ -212,16 +212,20 @@
al_name(
+ccp4
):%0A f
|
52e14523866f2990c1266edb0137b23df7d2586a | update bugsUrl to issues.rpath.com | mint/releasetemplates.py | mint/releasetemplates.py | # Copyright (c) 2004-2006 rPath, Inc.
#
# All Rights Reserved
#
import sys
from mint.data import RDT_STRING, RDT_BOOL, RDT_INT, RDT_ENUM
from mint import releasetypes
class ReleaseOption(tuple):
def __new__(self):
return tuple.__new__(tuple, (self.type, self.default, self.prompt))
class StringOption(Rele... | Python | 0 | @@ -1081,19 +1081,21 @@
'http://
-bug
+issue
s.rpath.
|
1aa89b96d342e52b8f888ff796bc3e9c8b61e68e | update column names, state timestep if no time in days available | plotartisnlte.py | plotartisnlte.py | #!/usr/bin/env python3
import argparse
import matplotlib.pyplot as plt
import readartisfiles as af
def main():
parser = argparse.ArgumentParser(
description='Plot ARTIS non-LTE corrections.')
parser.add_argument('-in', action='store', dest='nltefile',
default='nlte_0000.out',
... | Python | 0 | @@ -2293,20 +2293,21 @@
'nnlevel
-nlte
+_NLTE
') + 1%5D)
@@ -2360,19 +2360,20 @@
'nnlevel
-lte
+_LTE
') + 1%5D)
@@ -2365,32 +2365,79 @@
vel_LTE') + 1%5D)%0A
+ if ion %3C len(list_ltepop):%0A
@@ -2460,32 +2460,36 @@
.append(ltepop)%0A
+
@@ -2514,32 +2514,3... |
6f94e8538f76523a864dbd54f667b0f709945b64 | add message to mitmdump | mitmproxy/tools/_main.py | mitmproxy/tools/_main.py | """
This file contains python3.6+ syntax!
Feel free to import and use whatever new package you deem necessary.
"""
import os
import sys
import asyncio
import argparse
import signal
import typing
from mitmproxy.tools import cmdline
from mitmproxy import exceptions, master
from mitmproxy import options
from mitmproxy i... | Python | 0 | @@ -4723,24 +4723,85 @@
ilter_args)%0A
+ print(f%22Only processing flows that match %7Bv!r%7D%22)%0A
|
6b7260e717129c08a1e44a42a9468d2003a1b7e3 | Structure update | frame_generator.py | frame_generator.py | __author__ = 'Vale Tolpegin'
import sys, os, re
class frame_generator:
def init( self, *args, **kwargs ):
pass
if __name__ == '__main__':
pass
| Python | 0 | @@ -23,16 +23,45 @@
pegin'%0A%0A
+# Importing relevant classes%0A
import s
@@ -95,16 +95,46 @@
erator:%0A
+ # Initialization method%0A
def in
@@ -170,44 +170,2367 @@
-pass%0A%0Aif __name__ == '__main__':%0A pass%0A
+ pass%0A %0A # Function that delegates frame file generation for every langua... |
ab952b47561edc901efeafd63838c589ee2da2b8 | Fix #578 -- Sputnik had been purging all files on --force, not just the relevant one. | spacy/download.py | spacy/download.py | from __future__ import print_function
import sys
import sputnik
from sputnik.package_list import (PackageNotFoundException,
CompatiblePackageNotFoundException)
from . import about
from . import util
def download(lang, force=False, fail_on_exist=True):
if force:
sputnik... | Python | 0 | @@ -292,16 +292,11 @@
-if force
+try
:%0A
@@ -305,75 +305,13 @@
-sputnik.purge(about.__title__, about.__version__)%0A%0A try:%0A
+pkg =
spu
@@ -428,16 +428,72 @@
if
+force:%0A shutil.rmtree(pkg.path)%0A elif
fail_on_
|
9cae7682a8a74f52de1ab44d30f604334416ddb8 | implement eightball (#122) | plugins/games.py | plugins/games.py | """
games.py: Create a bot that provides game functionality (dice, 8ball, etc).
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import random
import utils
from log import log
import world
gameclient = utils.registerService("Games", manipulatable=True)
reply = gam... | Python | 0.000002 | @@ -1294,16 +1294,965 @@
(dice)%0A%0A
+eightball_responses = %5B%22It is certain.%22,%0A %22It is decidedly so.%22,%0A %22Without a doubt.%22,%0A %22Yes, definitely.%22,%0A %22You may rely on it.%22,%0A %22As I see it, yes.%22,%0A %22Most likely.%... |
52a107a76e921d91f3365cbd66e02beb2c5f389a | fix the url it checks for | Commands/DominosPizza.py | Commands/DominosPizza.py | # -*- coding: utf-8 -*-
import re
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from CommandInterface import CommandInterface
from Utils import WebUtils
from bs4 import BeautifulSoup
from twisted.internet import task, threads
class DominosPizza(CommandInterface):
help = "Aut... | Python | 0.000009 | @@ -624,36 +624,21 @@
ie)/
-checkout/p
+P
izza
-t
+T
racker%5C
-.aspx%5C
?id=
|
7966ead721c2612e032a0a23e8f38c0e2f52a089 | declare SMALL as np.finfo(float).eps | spaghetti/util.py | spaghetti/util.py | from collections import OrderedDict
import operator
from libpysal import cg
import numpy as np
def compute_length(v0, v1):
"""
Compute the euclidean distance between two points.
Parameters
----------
v0: sequence in the form x, y
vq: sequence in the form x, y
Returns
... | Python | 0.999806 | @@ -5541,12 +5541,27 @@
L =
-0.01
+np.finfo(float).eps
%0A
|
00dbe80be6ec7214f54ae8d90fbf5c4c0fc95828 | Improve ImgurPlugin URI parsing | plugins/imgur.py | plugins/imgur.py | import re
import urlparse
from imgurpython import ImgurClient
from imgurpython.helpers.error import ImgurClientError
from Plugin import Plugin
# Go to https://api.imgur.com/oauth2/addclient
# Log in with an imgur account, and register the application with the
# "Anonymous usage without user authorization" authorizati... | Python | 0.000001 | @@ -1341,20 +1341,22 @@
albumid%3E
-.
+%5B%5E/%5D
+)
-$
', res.p
@@ -1649,12 +1649,14 @@
yid%3E
-.
+%5B%5E/%5D
+)
-$
', r
|
98685f5e0cd3783287cd52eeacbefcfa4433c8aa | Version 0.2.0 | pypet/_version.py | pypet/_version.py | __version__ = '0.2b2dev'
| Python | 0.000001 | @@ -15,11 +15,8 @@
'0.2
-b2dev
+.0
'%0A
|
1f8014a68ac8d0b10c990405370edeaf369cb674 | Update the description | 32_filtering_the_number.py | 32_filtering_the_number.py | data = [12,4,21,56,01,42,76,93]
print data
print '\nScript starts\n'
for number in data:
if number > 50:
print 'Number greater then 50 is ', number
print '\nScript Ends'
| Python | 0.999999 | @@ -1,12 +1,59 @@
+# Looking for a needle in hackstack, in a loop%0A
data = %5B12,4
|
73553a2c6817addccff5a0e90cd32993ee1ea69b | Update ngrokwebhook.py | examples/ngrokwebhook.py | examples/ngrokwebhook.py | #sample script that reads ngrok info from localhost:4040 and create Cisco Spark Webhook
#typicall ngrok is called "ngrok http 8080" to redirect localhost:8080 to Internet
#accesible ngrok url
#
#To use script simply launch ngrok, then launch this script. After ngrok is killed, run this
#script a second time to re... | Python | 0.000001 | @@ -1835,22 +1835,16 @@
%0Aprint (
-target
Url)%0D%0A%0D%0A
|
45ea80d300e45a97bb9ac0448f5e0ba077971a7a | Update modified timestamp in set_to_public | rna/admin.py | rna/admin.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from datetime import datetime
from django import forms
from django.contrib import admin
from pagedown.widgets import Ad... | Python | 0 | @@ -3958,16 +3958,41 @@
lic=True
+, modified=datetime.now()
)%0A%0Aadmin
|
1cbbd3fe890afdeb3f0df7104ba151d7c5f33ef9 | bump version number | mocodo/version_number.py | mocodo/version_number.py | version = u"2.0.18" | Python | 0.000004 | @@ -14,6 +14,6 @@
.0.1
-8
+9
%22
|
eccf8d2d9784554b85b5d446fe8737eb29600efb | Switch test_example_hdf_io to pytest | databroker/tests/test_example_hdf_io.py | databroker/tests/test_example_hdf_io.py | from ..examples.hdf_io import hdf_data_io
from metadatastore.test.utils import mds_setup, mds_teardown
from filestore.test.utils import fs_setup, fs_teardown
from databroker import DataBroker as db, get_events
from numpy.testing.utils import assert_array_equal
def setup_module():
fs_setup()
mds_setup()
def ... | Python | 0.000004 | @@ -269,27 +269,33 @@
etup_module(
+module
):%0A
-
fs_setup
@@ -335,16 +335,22 @@
_module(
+module
):%0A f
@@ -387,21 +387,16 @@
)%0A%0A%0Adef
-_test
_retriev
@@ -405,20 +405,21 @@
data
+_helper
(event
-, rows
, co
@@ -755,13 +755,8 @@
-_test
_ret
@@ -769,16 +769,17 @@
data
-(e, rows
+_helper(... |
d297cb7435f94ab6e086f83c09faeafb6f8cf86e | allow hyphens and underscores in form urls | couchforms/urls.py | couchforms/urls.py | from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^post/?$', 'couchforms.views.post', name='xform_post'),
url(r'^download/(?P<instance_id>\w+)/(?P<attachment>[\w.-_]+)?$',
'couchforms.views.download_attachment', name='xform_attachment'),
)
| Python | 0.000002 | @@ -163,18 +163,22 @@
ance_id%3E
+%5B
%5Cw
+_-%5D
+)/(?P%3Ca
@@ -200,17 +200,16 @@
_%5D+)?$',
-
%0A
|
fc4fee94a27503ac0c499c22dbf03a310458280a | Update project_movie_trailer_website.py | favourite/project_movie_trailer_website.py | favourite/project_movie_trailer_website.py | import media
import fresh_tomatoes
# Set Movie class instances with my favourite movies.
# Arugments for class
# (movie title, movie storyline, poster image url, trailer youtube url)
hellboy2 = media.Movie("Hellboy II",
"A resuced baby demon is raise to save the world",
... | Python | 0.000002 | @@ -3013,29 +3013,8 @@
es%0D%0A
-def run_page():%0D%0A
fres
|
300d20bae6d5cfb3637b08fb5bd54e291a8402f4 | Fix bool handling in filters | myob/managers.py | myob/managers.py | import re
import requests
from datetime import date
from .constants import DEFAULT_PAGE_SIZE, MYOB_BASE_URL
from .endpoints import CRUD, METHOD_MAPPING, METHOD_ORDER
from .exceptions import (
MyobBadRequest,
MyobExceptionUnknown,
MyobForbidden,
MyobNotFound,
MyobUnauthorized
)
class Manager:
... | Python | 0.000005 | @@ -5573,16 +5573,98 @@
%25 value%0A
+ if isinstance(value, bool):%0A return str(value.lower())%0A
|
27e6b067aea3cc969911d5c0071e4accfd77b7a1 | Update main.py | device/src/main.py | device/src/main.py | #This is the file executing while STM32 MCU bootup, and in this file,
#it will call other functions to fullfill the project.
#Communication module: LoRa.
#Communication method with gateway via LoRa.
#Uart port drive LoRa module.
#Parse JSON between device and gateway via LoRa channel.
#LoRa module: E32-TTL-100
#Pin s... | Python | 0.000001 | @@ -833,16 +833,28 @@
ort time
+%0Aimport json
%0A%0Amicrop
|
4e98dd5f1fa5bf9373800afd496da902f3acdf44 | move suggestions to "Podcasts" section | mygpo/web/templatetags/menu.py | mygpo/web/templatetags/menu.py | from django import template
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext
register = template.Library()
HIDDEN_URIS = (
'/login/',
'/register/',
'/podcast/',
'/device/',
'/user/subscriptions/',
'/publisher/podcast/',
)
_ =... | Python | 0 | @@ -865,32 +865,81 @@
bscriptions')),%0A
+ ('/suggestions/', _('Suggestions')),%0A
('',
@@ -1359,57 +1359,8 @@
)),%0A
- ('/suggestions/', _('Suggestions')),%0A
|
62084a3141b780a4c3dced16ccf0c2c8eb2312f7 | Add support for Django 1.8. | model_settings/models.py | model_settings/models.py | """
Provides abstract polymorphic ``Setting`` models that can be used to store
arbitrary settings of different types.
"""
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models.fields.files import FieldFile, ImageFieldFile
from django.db.models.query import QueryS... | Python | 0 | @@ -2338,16 +2338,57 @@
model =
+ getattr(related_object, 'related_model',
related
@@ -2396,24 +2396,25 @@
object.model
+)
%0A
|
d0ea310b7ae7de3013e7ae55d73228da56591368 | resolve error with django-jiinja templates, fix #867 | debug_toolbar/panels/templates/panel.py | debug_toolbar/panels/templates/panel.py | from __future__ import absolute_import, unicode_literals
from collections import OrderedDict
from contextlib import contextmanager
from os.path import normpath
from pprint import pformat
from django import http
from django.conf.urls import url
from django.db.models.query import QuerySet, RawQuerySet
from django.templ... | Python | 0 | @@ -7070,21 +7070,16 @@
template
-_dirs
= self.
@@ -7102,23 +7102,154 @@
mplate'%5D
-.engine
+%0A engine_backend = getattr(template, 'engine', None) or getattr(template, 'backend')%0A template_dirs = engine_backend
.dirs%0A
|
be5263d7aef7651bfe0b0992998bdb67655b051f | Remove an unused helper | fireplace/cards/utils.py | fireplace/cards/utils.py | import random
import fireplace.cards
from ..actions import *
from ..enums import CardClass, CardType, GameTag, Race, Rarity, Zone
from ..events import *
from ..targeting import *
def hand(func):
"""
@hand helper decorator
The decorated event listener will only listen while in the HAND Zone
"""
func.zone = Zone.H... | Python | 0.000004 | @@ -335,63 +335,8 @@
nc%0A%0A
-drawCard = lambda self, *args: self.controller.draw()%0A%0A
%0ARan
|
24a9779fa1df3277a7b094177421cbc91f3137b3 | Prepend to topic | plugins/topic.py | plugins/topic.py | from ircbot.persist import Persistent
from time import time
from datetime import datetime
from logging import getLogger
from .helpers import private_api
logger = getLogger()
def load(bot):
def make_topic(msg, new_topic=None, new_music=None):
template = {'last_changed': None, 'text': "", 'changed_by': Non... | Python | 0 | @@ -1877,16 +1877,338 @@
ur !%22)%0A%0A
+ @bot.command(r'%5C!topic prepend +(%5B%5E %5D.+)')%0A def prepend_topic(msg):%0A with Persistent('topic.json') as current_topic:%0A topic = current_topic.get('topic', %7B%7D).get('text', '')%0A make_topic(msg, new_topic=msg.args%5B0%5D + ' :: ' +... |
f080b9b05dc36fd1ef30c32f870f6233db728d84 | Add assets file. | mysite/assets.py | mysite/assets.py | import django_assets
# Django Assets <http://github.com/miracle2k/django-assets>
# helps us bundle our assets, i.e., JavaScript and CSS,
# so they load faster.
# So django_assets doesn't feel bad creating files
ASSETS_AUTO_CREATE=True
# See documentation at <http://elsdoerfer.name/docs/django-assets/settings.html#a... | Python | 0 | @@ -356,16 +356,26 @@
me'%0A%0A# B
+elow, we b
undle al
@@ -507,16 +507,233 @@
ast/%3E.)%0A
+%0A# NB: %22Note that...all filenames and paths are considered to be%0A# relative to Django%E2%80%99s MEDIA_ROOT settings, and generated urls will be based on MEDIA_URL.%22%0A# %3Chttp://elsdoerfer.name/docs/django-assets/bu... |
f96949ee8058b46461ac58b593c029d8b07541da | Revert "urls: disable certificates" | devincachu/urls.py | devincachu/urls.py | # Copyright 2014 Dev in Cachu authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.views.decorators import csrf
from django.views.generic impor... | Python | 0 | @@ -1317,32 +1317,481 @@
%22notificacao%22),%0A
+ url(r%22%5Ecertificado/validar/$%22,%0A iviews.ValidacaoCertificado.as_view(),%0A name=%22validacao_certificado%22),%0A url(r%22%5Ecertificado/$%22,%0A iviews.BuscarCertificado.as_vi... |
a8795d77d3f1a3586de83b92541848d2f12e161f | Clean example script. | examples/neurospin/onesample_group.py | examples/neurospin/onesample_group.py | import numpy as np
import nipy.neurospin.statistical_mapping as sm
from nipy.io.imageformats import Nifti1Image as Image
def remake_images():
# Get group data
f = np.load('data/offset_002.npz')
data, vardata, xyz = f['mat'], f['var'], f['xyz']
dX = xyz[0,:].max() + 1
dY = xyz[1,:].max() + 1
... | Python | 0 | @@ -545,36 +545,16 @@
.append(
-brifti.nifti1.Nifti1
Image(au
@@ -643,36 +643,16 @@
.append(
-brifti.nifti1.Nifti1
Image(au
@@ -731,28 +731,8 @@
end(
-brifti.nifti1.Nifti1
Imag
|
7ad22a8f79954978d89e63cc6e6ed6ad7732d323 | Fix a bug during generate clean up steps | depend_test_framework/case_generator.py | depend_test_framework/case_generator.py | """
Helper classes to help generate case
"""
import itertools
import random
from progressbar import ProgressBar, SimpleProgress, Counter, Timer
from .log import get_logger
from .env import Env
from .utils import pretty
from .case import Case
from .algorithms import route_permutations
LOGGER = get_logger(__name__)
... | Python | 0.000008 | @@ -2827,32 +2827,98 @@
f need_cleanup:%0A
+ new_tgt_env = tgt_env.gen_transfer_env(test_func)%0A
@@ -2965,24 +2965,28 @@
ns(src_env,
+new_
tgt_env, Tru
|
69c5e493b20c8a9126f22c028391ab7f5c881e75 | update features_to_hdf5 | seya/preprocessing/features_to_hdf5.py | seya/preprocessing/features_to_hdf5.py | import os
import numpy as np
import h5py
import random
from PIL import Image
from glob import glob
from sklearn_theano.feature_extraction import OverfeatTransformer as fext
from keras.utils.generic_utils import Progbar
def features_to_hdf5(input_path, output_path='features.hdf5',
feature_extrac... | Python | 0.000001 | @@ -1947,15 +1947,30 @@
nt(%22
-Reading
+Extracting features of
a t
@@ -2995,17 +2995,16 @@
nt(%22Clea
-r
ning up.
|
9da42e47effc1d61a36c7936ea9fe31adb1c1033 | raise version to dev | qopen/__init__.py | qopen/__init__.py | from qopen.core import run, __doc__
__version__ = '1.3'
| Python | 0 | @@ -51,7 +51,11 @@
'1.
-3
+4-dev
'%0A
|
eea11b5a0e88c772c02ba3ed6bd3bc68ddb5d5d7 | debug tags retrieval | plugins/users.py | plugins/users.py | import docker, os.path, settings, json, subprocess, requests, time
import random
def create_random_id():
number = random.randint(2**63, 2**64)
alphabet = '0123456789abcdefghijklmnopqrstuvwxyz'
base36 = ''
while number:
number, i = divmod(number, 36)
base36 = alphabet[i] + base36
... | Python | 0.000001 | @@ -2285,24 +2285,30 @@
on%0A%0A
+%0A
+s
in
-box_tag_id
+gle_tasks_list
= %5B
@@ -2368,16 +2368,53 @@
%22inbox%22%5D
+%0A inbox_tag_id = single_tasks_list
%5B0%5D%5B%22tid
|
1622010c87f2d53915e73d7341da12f4572800cf | discard text frames | src/streamlink/plugins/twitcasting.py | src/streamlink/plugins/twitcasting.py | """
$description Global live broadcasting and live broadcast archiving social platform.
$url twitcasting.tv
$type live
"""
import hashlib
import logging
import re
from streamlink.buffers import RingBuffer
from streamlink.plugin import Plugin, PluginArgument, PluginArguments, PluginError, pluginmatcher
from streamlink... | Python | 0 | @@ -3501,35 +3501,14 @@
-data = bytes(data, %22utf-8%22)
+return
%0A%0A
|
47b0ffec70383c77bb925938e03b8fd6a3bc6bd4 | Remove deprecated calldata padding param | mythril/laser/ethereum/call.py | mythril/laser/ethereum/call.py | import logging
from typing import Union
from z3 import simplify, ExprRef, Extract
import mythril.laser.ethereum.util as util
from mythril.laser.ethereum.state import Account, CalldataType, GlobalState, Calldata
from mythril.support.loader import DynLoader
import re
"""
This module contains the business logic used by I... | Python | 0.000001 | @@ -1344,15 +1344,8 @@
size
-, False
%0A
@@ -1421,134 +1421,8 @@
0:%0A
- call_data, call_data_type = get_call_data(%0A global_state, memory_input_offset, memory_input_size%0A )%0A
@@ -4718,22 +4718,8 @@
f%5D,%0A
- pad=True,%0A
):%0A
@@ -4878,65 +4878,8 @@
ize%0A
- :param ... |
0b534c54e4fa5b7d0d558159b63a7cc0bf7f5393 | Bump @graknlabs | dependencies/graknlabs/dependencies.bzl | dependencies/graknlabs/dependencies.bzl | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Python | 0 | @@ -1614,48 +1614,48 @@
= %22
-82e14c0b439006c7c62b5b2a440396c10a82d44f
+1e81b2b397cd0ac020f1d69708eef1d4cc2d736b
%22%0A
|
5e18bf6faf5be2467af475bbb3d1fb9898c13339 | Set an unusable password on user creation, to prevent errors when trying to edit that user later | django_facebook/auth.py | django_facebook/auth.py | from django.conf import settings
from django.contrib import auth as django_auth
from django.contrib.auth.models import User
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.signals import user_logged_in
from django.contrib.auth import SESSION_KEY, BACKEND_SESSION_KEY
import logging
log = ... | Python | 0 | @@ -7154,25 +7154,95 @@
name=user_id
-)
+, %0A defaults=%7B'password': '!'%7D) # also set unusable password
%0A if
|
f8940a8b344faed68ad2a4e82fededc6fb926843 | add custom auth model support. | django_oneall/models.py | django_oneall/models.py | # -*- coding: utf-8 -*-
from logging import getLogger
from random import Random
from re import match, sub
from uuid import uuid4
from django.contrib.auth.models import User
from django.db import models
from django.db.transaction import atomic
from django.utils.timezone import now
from pyoneall.base import OADict
from... | Python | 0 | @@ -127,52 +127,8 @@
d4%0A%0A
-from django.contrib.auth.models import User%0A
from
@@ -231,16 +231,115 @@
ort now%0A
+from django.conf import settings as django_settings%0Afrom django.contrib.auth import get_user_model%0A
from pyo
@@ -422,72 +422,8 @@
_)%0A%0A
-USERNAME_MAXLEN = User._meta.get_field('username').ma... |
c214415a298d6166921482a3201c3b43a7268efa | Set zapped_by to a current user | djangobb_forum/admin.py | djangobb_forum/admin.py | # coding: utf-8
from django.contrib import admin
from django.contrib.auth import admin as auth_admin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from djangobb_forum.models import Category, Forum, Topic, Post, Profile, Reputation, \
Report, Ban, Attachment, Poll, PollCho... | Python | 0 | @@ -2409,16 +2409,169 @@
= True%0A%0A
+ def save_model(self, request, obj, form, change):%0A if change and obj.zapped:%0A obj.zapped_by = request.user%0A obj.save()%0A%0A
class Ba
|
741db37630b4856fbd8ad4b1a3b3c62fee1b1ea8 | Update user within atomic transaction block | src/dashboard/src/components/accounts/signals.py | src/dashboard/src/components/accounts/signals.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
from django.dispatch import receiver
from django_auth_ldap.backend import populate_user
from django_cas_ng.signals import cas_user_authenticated
from component... | Python | 0 | @@ -153,16 +153,50 @@
r_model%0A
+from django.db import transaction%0A
from dja
@@ -2710,16 +2710,114 @@
model()%0A
+ is_administrator = _cas_user_is_administrator(attributes)%0A%0A with transaction.atomic():%0A
user
@@ -2883,66 +2883,8 @@
-is_administrator = _cas_user_is_administrator(attribute... |
5dc49ce02873dc610b9161b2c408b64b34dd3538 | Allow empty dict in dict_from_string | sfepy/base/parse_conf.py | sfepy/base/parse_conf.py | """
Create pyparsing grammar for problem configuration and options.
"""
from pyparsing import (Word, Group, Suppress, Combine, Optional,
Forward, Empty, quotedString, oneOf, removeQuotes,
delimitedList, nums, alphas, alphanums,
Keyword, CaselessLitera... | Python | 0.000661 | @@ -2045,16 +2045,25 @@
inner %7C
+Optional(
defs%5B'tu
@@ -2073,16 +2073,17 @@
'%5D.inner
+)
%0A els
@@ -2092,32 +2092,41 @@
%0A return
+Optional(
defs%5B'dict'%5D.inn
@@ -2127,16 +2127,17 @@
'%5D.inner
+)
%0A%0Adef li
|
8deccaa046832afbe8c43ea38d179dd8706754ef | use 'b' prefix, six.b not required | spec/trap.py | spec/trap.py | """
Test decorator for capturing stdout/stderr/both.
Based on original code from Fabric 1.x, specifically:
* fabric/tests/utils.py
* as of Git SHA 62abc4e17aab0124bf41f9c5f9c4bc86cc7d9412
Though modifications have been made since.
"""
import sys
from functools import wraps
import six
from six import BytesIO as IO
... | Python | 0.999995 | @@ -567,17 +567,11 @@
fer=
-six.b(
+b
''
-)
, cc
|
20a55bbf24f78085f3100b3577040268deb42044 | remove un-needed code | nbgrader/plugins/zipcollect.py | nbgrader/plugins/zipcollect.py | import os
import re
import shutil
from textwrap import dedent
from traitlets import Bool, List, Unicode
from .base import BasePlugin
from ..utils import unzip
class ExtractorPlugin(BasePlugin):
"""Submission archive files extractor plugin for the
:class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`.
Extr... | Python | 0.998117 | @@ -3016,396 +3016,8 @@
rn%0A%0A
- # Sanity check%0A extracted = 0%0A for _, _, extracted_files in os.walk(extracted_path):%0A extracted += len(extracted_files)%0A%0A if nfiles != extracted:%0A self.log.warn(%0A %22File count mismatch. Processed or extra... |
131d496b98b386d0203a914bcc1f3dd40bfd6754 | Use proper symbolizer based on geometry type | spillway/carto.py | spillway/carto.py | from django.core.files.storage import default_storage
from django.db import connection
from greenwich import srs
from spillway.compat import mapnik
from spillway import colors, query
def add_colorizer_stops(style, bins, mcolors):
rule = style.rules[0]
symbolizer = rule.symbols[0]
for value, color in zip(b... | Python | 0.000029 | @@ -4116,38 +4116,307 @@
-return mapnik.PolygonSymbolizer
+symbolizers = %7B%0A mapnik.DataGeometryType.Point: mapnik.PointSymbolizer,%0A mapnik.DataGeometryType.LineString: mapnik.LineSymbolizer,%0A mapnik.DataGeometryType.Polygon: mapnik.PolygonSymbolizer%0A %7D%0A ... |
cc5e4bd4e2d7e8cec7a5cec779b3faf7d16e3088 | Fix crash when running newly introduced fixture | testapp/testapp/testmain/fixtures.py | testapp/testapp/testmain/fixtures.py | import os
from datetime import date, datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.utils.timezone import make_aware
from factory import LazyFunction, PostGenerationMethodCall, SubFactory
from factory.django import DjangoModelFactory, FileField, ImageField
from djang... | Python | 0 | @@ -2245,16 +2245,64 @@
pair.%22%22%22
+%0A class Meta:%0A model = models.TaxPayer
%0A%0A na
|
64d1436431fbf61e21bd4cc40ad015e32dbac560 | Support identical ingress and egress ports in port pairs | src/emuvim/api/openstack/resources/port_chain.py | src/emuvim/api/openstack/resources/port_chain.py | # Copyright (c) 2015 SONATA-NFV and Paderborn University
# ALL RIGHTS RESERVED.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | Python | 0 | @@ -2986,18 +2986,16 @@
-el
if port_
|
1e69feeec2ee84d8ffeea3b7c480c43131bd87d3 | Remove nose dependencies from nailgun | nailgun/setup.py | nailgun/setup.py | # Copyright 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 ... | Python | 0 | @@ -935,47 +935,8 @@
0',%0A
- 'nose2==0.4.1',%0A 'nose==1.1.2',%0A
|
624e0fe50f3c3b78b0d8c2c26569bcafb921d036 | replace tab*2 to tab*4 | nata/usecases.py | nata/usecases.py | from .mappers import AppMapper, ServiceMapper, LbMapper
from .domains import Spec, Service, App, Lb
from .resources import LbResource, AppResource
from .drivers import *
import sys
import csv
def app_factory(new_app_name, spec, service):
new_app = App(new_app_name, spec, service)
new_app_resource = AppResour... | Python | 0.001153 | @@ -2047,32 +2047,36 @@
print(%22%5Ct%5Ct
+%5Ct%5Ct
%22.join(%5B'name',
@@ -2236,32 +2236,36 @@
print(%22%5Ct%5Ct
+%5Ct%5Ct
%22.join(%5Bservice.
@@ -3832,32 +3832,36 @@
print(%22%5Ct%5Ct
+%5Ct%5Ct
%22.join(%5B'name',
@@ -3988,24 +3988,28 @@
print(%22%5Ct%5Ct
+%5Ct%5Ct
%22.join(%5Bapp.
|
b0dda7f8ab22466b0fd9b6acc828a2f1b9826106 | Version bump (as in pypi, it is impossible to reupload a removed file). | neon/__init__.py | neon/__init__.py | # -*- coding: utf-8 -*-
__author__ = 'Pavel Dedik'
__version__ = '0.1.0'
from .decoder import parse
from .encoder import to_string
__all__ = ('decode', 'encode')
def decode(config):
try:
string = config.read()
except AttributeError:
string = config
return parse(string)
def encode(t... | Python | 0 | @@ -65,17 +65,17 @@
= '0.1.
-0
+1
'%0A%0A%0Afrom
|
d0fc327eb7b3ed798b02a654bb527d299b0245c9 | add unicode type | run_freestore.py | run_freestore.py | import bottle
from bottle import HTTPError
from bottle.ext import sqlalchemy
from sqlalchemy import create_engine, Column, Integer, Sequence, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
#engine = create_engine('postgresql://postgres:passw0rd@localhost:5432/freestore', echo=... | Python | 0.999927 | @@ -141,16 +141,25 @@
, String
+, Unicode
%0Afrom sq
|
1595b20d09576e2b686b376884e45b82c2018006 | Update test cases (#463) | exercises/allergies/allergies_test.py | exercises/allergies/allergies_test.py | import unittest
from allergies import Allergies
class AllergiesTests(unittest.TestCase):
def test_no_allergies_means_not_allergic(self):
allergies = Allergies(0)
self.assertFalse(allergies.is_allergic_to('peanuts'))
self.assertFalse(allergies.is_allergic_to('cats'))
self.assertFal... | Python | 0 | @@ -43,16 +43,251 @@
ergies%0A%0A
+# Python 2/3 compatibility%0Aif not hasattr(unittest.TestCase, 'assertCountEqual'):%0A unittest.TestCase.assertCountEqual = unittest.TestCase.assertItemsEqual%0A%0A%0A# test cases adapted from %60x-common//canonical-data.json%60 @ version: 1.0.0%0A
%0Aclass A
@@ -300,33 +300,16 @... |
c0d71164e1a659008426d53dae384e83bbcdabb6 | Use instance.summary in description | open_graph.py | open_graph.py | # -*- coding: utf-8 -*- #
"""
Open Graph
==========
This plugin adds Open Graph Protocol tags to articles.
Use like this in your template:
.. code-block:: jinja2
{% for tag in article.ogtags %}
<meta property="{{tag[0]}}" content="{{tag[1]|striptags|e}}" />
{% endfor %}
"""
from __future__ import u... | Python | 0 | @@ -1098,18 +1098,32 @@
-''
+instance.summary
))))%0A%0A
|
d9db4c32d5eee29b519917fdfc977a0cc6029e98 | Remove useless filter | openmesher.py | openmesher.py | #!/usr/bin/env python
import datetime, glob, os, shutil, subprocess, tempfile, logging, sys, argparse, random
import ipaddr, probstat, IPy, paramiko, yapsy
from distutils.sysconfig import get_python_lib
from OpenMesher.interfaces import *
from OpenMesher.lib import *
from OpenMesher.linkmesh import create_link_mesh
... | Python | 0.000002 | @@ -465,60 +465,8 @@
ger(
-categories_filter=%7B'Default': yapsy.IPlugin.IPlugin%7D
)%0A
|
311396b42700fdfc2836d8a4420a5172bd3dc5db | Implement more portable open display finding | run-tests.py | run-tests.py | #!/usr/bin/env python
import subprocess
from subprocess import Popen
import os
from os import listdir, path
from os.path import isfile, join
import sys
import re
import time
try:
from shutil import which
except ImportError:
def which(cmd):
path = os.getenv('PATH')
for p in path.split(os.path.p... | Python | 0.000003 | @@ -1153,20 +1153,22 @@
= 'i3'%0A
-L
+S
OCK
+ET
DIR = '/
@@ -1170,16 +1170,26 @@
= '/tmp
+/.X11-unix
'%0A%0A%0Adef
@@ -1739,22 +1739,106 @@
():%0A
-# TODO
+if not os.path.isdir(SOCKETDIR):%0A sys.stderr.write(%0A 'warning: could not
find th
@@ -1843,20 +1843,18 @@
the
-general l
+X11 ... |
fbf84e6da6fe718fb7695ee1813f3ea4328c8da4 | Fix split and replace bug in name of behav file | NSPN_rois_behavmerge.py | NSPN_rois_behavmerge.py | #!/usr/bin/env python
'''
NSPN_rois_behavmerge.py
Created on 22nd July 2014
by Kirstie Whitaker
kw401@cam.ac.uk
This code merges the output of freesurfer_combine_CT_stats.sh
with a csv file containing nspn_id and occ to create a
"behav_merge" file which is saved in a folder called FS_BEHAV
which is created in the sam... | Python | 0 | @@ -2032,20 +2032,20 @@
e).s
-trip
+plit
('.csv')
%0Apri
@@ -2040,16 +2040,19 @@
('.csv')
+%5B0%5D
%0Aprint (
@@ -3870,28 +3870,31 @@
= f_out.
+r
split('
-.
csv'
+, 1
)%5B0%5D + '
|
c2184bb263df97d980135cc119242b66ba097fe7 | Remove blank lines | exp/util/test/LinOperatorUtilsTest.py | exp/util/test/LinOperatorUtilsTest.py |
import unittest
import numpy
import numpy.testing as nptst
import sys
import logging
import scipy.sparse
from exp.util.LinOperatorUtils import LinOperatorUtils
from exp.util.SparseUtils import SparseUtils
class LinOperatorUtilsTest(unittest.TestCase):
def setUp(self):
numpy.set_printoptions(suppress... | Python | 0.999999 | @@ -1,11 +1,8 @@
-%0A%0A%0A
%0Aimport
|
9401c04526d6a5b54f372dd46b6e389abc1c348c | Remove print line | social/tests/backends/username_test.py | social/tests/backends/username_test.py | import requests
from sure import expect
from httpretty import HTTPretty
from social.utils import module_member
from social.backends.utils import load_backends
from social.tests.base import BaseBackendTest
from social.tests.strategy import TestStrategy
from social.tests.models import TestStorage, User, TestUserSocialA... | Python | 0.000549 | @@ -1885,52 +1885,8 @@
me')
-%0A print %22COMPLETE_URL:%22, complete_url
%0A%0A
|
e8e2d509be98e1147bb193c0be72fbb762210967 | Add command docstrings | portingdb/cli.py | portingdb/cli.py | import logging
import os
import urllib.parse
import click
from sqlalchemy import create_engine, func
from sqlalchemy.orm import eagerload, subqueryload
from portingdb import tables
from portingdb.load import get_db, load_from_directory
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
def main():
ret... | Python | 0.00006 | @@ -1592,24 +1592,75 @@
tatus(ctx):%0A
+ %22%22%22Print database info and high-level stats%22%22%22%0A
print_st
@@ -3434,24 +3434,72 @@
load(ctx):%0A
+ %22%22%22Load the database from JSON/YAML data%22%22%22%0A
if ctx.o
@@ -3881,24 +3881,69 @@
eport(ctx):%0A
+ %22%22%22Print out a report of all p... |
79500a7cefbbb25454284586a20ab0e7bb61d195 | Update sphinx Directive reference | doc/sphinx/button.py | doc/sphinx/button.py | from __future__ import absolute_import, division
from docutils import nodes
import jinja2
from sphinx.util.compat import Directive
from docutils.parsers.rst.directives import unchanged
BUTTON_TEMPLATE = jinja2.Template(u"""
<a href="{{ link }}">
<span class="button">{{ text }}</span>
... | Python | 0 | @@ -92,25 +92,27 @@
rom
-sphinx.util.compa
+docutils.parsers.rs
t im
|
cc75e158174488a34d331cf0a43e446e1de74d95 | Fix equality testing. | enthought/enstaller/proxy_support.py | enthought/enstaller/proxy_support.py | #------------------------------------------------------------------------------
# Copyright (c) 2007, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license
# available at http://www.enthought.com/licenses/BSD.txt and may be
# redistributed only under th... | Python | 0.999999 | @@ -1307,16 +1307,17 @@
oxystr =
+=
'':%0A
|
054f057bfe08505096f8735d462a9ba23e2d889c | increase verbosity | run_tests.py | run_tests.py | import os
import sys
import unittest
sys.path.append(os.path.realpath(__file__) + "/app")
suite = unittest.TestLoader().discover("tests")
results = unittest.TextTestRunner(verbosity=2).run(suite)
if len(results.errors) > 0 or len(results.failures) > 0:
sys.exit(1)
sys.exit()
| Python | 0.000011 | @@ -182,9 +182,9 @@
ity=
-2
+3
).ru
|
2a808cfa653403f00675b591f99c4d5a695a8cc2 | fix py3 tests | sacrud/action.py | sacrud/action.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 uralbash <root@uralbash.ru>
#
# Distributed under terms of the MIT license.
"""
CREATE, READ, DELETE, UPDATE actions for SQLAlchemy models
"""
import inspect
import itertools
import transaction
from sacrud.common import (get_attrnam... | Python | 0.000002 | @@ -3569,24 +3569,29 @@
for key in
+list(
self.request
@@ -3597,16 +3597,17 @@
t.keys()
+)
:%0A
|
c52e55dfc739fe78b9fe36d257fcb154528de27c | Fix space. | safety/mixins.py | safety/mixins.py |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.utils.timezone import now
from .models import Session
class SessionMixin(object):
def get_queryset(self):
qs = Session.objects.filter(expire_date__gt=now(), ... | Python | 0.000563 | @@ -1,9 +1,8 @@
-%0A
# -*- co
|
5eff3ccd212449bea1a540784d70d22c0002768c | fix typo | run_utils.py | run_utils.py | import sys
import time
sys.stdout=sys.stderr
import numpy as np
import tensorflow as tf
from tensorflow.python.client import timeline
from language_model import LM
from common import CheckpointLoader
def run_train(dataset, hps, logdir, ps_device, task=0, master=""):
with tf.variable_scope("model"):
model... | Python | 0.999991 | @@ -1324,16 +1324,20 @@
%0A
+
tf.summa
|
56a8e624c605d22255cb6fe2de7aba9b3b5b6185 | fix bad dest in cli parser | saltcloud/cli.py | saltcloud/cli.py | '''
Primary interfaces for the salt-cloud system
'''
# Need to get data from 4 sources!
# CLI options
# salt cloud config - /etc/salt/cloud
# salt master config (for master integration)
# salt vm config, where vms are defined - /etc/salt/cloud.vm
#
# The cli, master and cloud configs will merge for opts
# the vm data w... | Python | 0.000001 | @@ -1524,34 +1524,38 @@
dest='
-v
m
+aster
_config',%0A
|
f2a39efad90286dba98ce6bc0e03f7e236ed72a4 | use queeu url instead of name | src/main/python/gaius/service.py | src/main/python/gaius/service.py | # -*- coding: utf-8 -*-
"""
Interface to the Crassus Lambda function. This module notifies Crassus
about updates to a CFN stack so Crassus will trigger the update process.
"""
import json
import logging
from datetime import datetime
from dateutil import tz, parser as date_parser
from time import sleep
import boto3
l... | Python | 0.000002 | @@ -813,16 +813,17 @@
list%5D)%0A%0A
+%0A
def gene
@@ -1128,16 +1128,17 @@
essage%0A%0A
+%0A
def noti
@@ -1496,16 +1496,17 @@
nswer)%0A%0A
+%0A
def is_r
@@ -1776,16 +1776,17 @@
False%0A%0A
+%0A
def clea
@@ -1802,20 +1802,19 @@
channel_
-name
+url
, timeou
@@ -1988,35 +1988,17 @@
rce.
-get_queue_by_name(Queu... |
7931299cf441165e7d6fcb3ef8e8b001c31ad66b | fix monkeypatch | utils/cli.py | utils/cli.py | import logging
import os
import subprocess
from datetime import datetime
from io import BytesIO
from string import Template
from lektor.cli import Context
from lektor.devserver import run_server
from lektor.utils import slugify
# I don't use the editor - get rid of the button during development
run_server.rewrite_htm... | Python | 0.000001 | @@ -118,16 +118,55 @@
mplate%0A%0A
+from lektor.admin.modules import serve%0A
from lek
@@ -330,26 +330,21 @@
lopment%0A
-run_
serve
-r
.rewrite
|
0b0bbb1be93665bff9de67aaa2ae5d3d5316555e | change efield unit | order/util.py | order/util.py | ###############################################################################
# -*- coding: utf-8 -*-
# Order: A tool to characterize the local structure of liquid water
# by geometric order parameters
#
# Authors: Pu Du
#
# Released under the MIT License
####################################################... | Python | 0 | @@ -2596,22 +2596,16 @@
%0A
-delta_
t = inpu
@@ -2630,67 +2630,112 @@
-%0A for t in d
+print(' D
elta
-_t:%0A t_unit = delta_t%5Bt%5D%0A
+ t:%5Ct%7B%7D%5Ct Unit:%5Ct%7B%7D'.format(t, 'ps'))%0A%0A E = input_info%5B'efield'%5D%0A
-
prin
@@ -2746,38 +2746,38 @@
... |
ed58091b7adb2a1d75c34ae961f75ef70c62d1d9 | Update testHardware.py close #51 | hardware/testHardware.py | hardware/testHardware.py | # Libraries
import RPi.GPIO as GPIO
import requests
import picamera
from time import gmtime, strftime
#Constants
PIR_SENSOR = 13
LATITUDE = 50.8503 # Change this to real location
LONGITUDE = 4.3517
def getTime():
return strftime('%Y-%m-%d %H:%M:%S', gmtime())
# Triggered when interrupt detected from the PIR sensor
... | Python | 0 | @@ -94,17 +94,24 @@
strftime
+, sleep
%0A
-
%0A#Consta
@@ -130,16 +130,34 @@
OR = 13%0A
+BOUNCE_TIME = 100%0A
LATITUDE
@@ -216,16 +216,95 @@
= 4.3517
+%0AAPI_URL = %22develop.birds.today/api/observations%22%0A%0Acamera = picamera.PiCamera()
%0A%0Adef ge
@@ -429,17 +429,43 @@
pir(
-channel):
+PIR_SENSOR):%0A%09p... |
12efd6bc3ac22d1c72a9469e793fdb877834a5b0 | fix strange issue with plotting small range of data | htdocs/agclimate/smts.py | htdocs/agclimate/smts.py | #!/usr/bin/env python
""" Soil Moisture Timeseries """
import sys
sys.path.insert(0, '/mesonet/www/apps/iemwebsite/scripts/lib')
import os
os.environ[ 'HOME' ] = '/tmp/'
os.environ[ 'USER' ] = 'nobody'
import datetime
import numpy
import mesonet
import iemtz
import cgitb
cgitb.enable()
import network
nt = network.Tabl... | Python | 0.000004 | @@ -252,16 +252,17 @@
t iemtz%0A
+#
import c
@@ -266,16 +266,17 @@
t cgitb%0A
+#
cgitb.en
@@ -2936,47 +2936,8 @@
5)%0A
-ax%5B0%5D.set_xlim( min(valid), max(valid))
%0Aday
@@ -3221,16 +3221,17 @@
atter('%25
+-
d %25b%5Cn%25Y
@@ -4097,16 +4097,103 @@
r='g')%0A%0A
+# Wow, strange bugs if I did not put this last%... |
aa2e72e5a6d9f9626cc9876c3b5b15adae293569 | add plot points | rw_visual.py | rw_visual.py | import matplotlib.pyplot as plt
from random_walk import RandomWalk
#keep making random walks as long as the program is active
while True:
#make arandom walk and plt the points
rw = RandomWalk()
rw.fill_walk()
point_numbers = list(range(rw.num_points))
plt.scatter(rw.x_values, rw.y_values, c=point... | Python | 0.000281 | @@ -195,16 +195,21 @@
domWalk(
+50000
)%0A rw
@@ -218,24 +218,59 @@
ill_walk()%0A%0A
+ #Plot points and show the plot%0A
point_nu
@@ -411,17 +411,16 @@
ne', s=1
-5
)%0A%0A #
@@ -719,20 +719,16 @@
(False)%0A
-
%0A plt
|
b822c91fa9c3228e9f6b3bff2a122bfc07fc89cb | improve spectrogram test | timeside/tests/api/test_pipe_spectrogram.py | timeside/tests/api/test_pipe_spectrogram.py | # -*- coding: utf-8 -*-
import os
from timeside.core import *
from timeside.api import *
from timeside.decoder import *
from timeside.grapher import *
image_file = '../results/img/spectrogram.png'
source = os.path.join(os.path.dirname(__file__), "../samples/sweep.wav")
decoder = FileDecoder(source)
spectrogram = Sp... | Python | 0.000003 | @@ -150,60 +150,351 @@
*%0A%0A
-image_file = '../results/img/spectrogram.png'%0Asource
+sample_dir = '../samples'%0Aimg_dir = '../results/img'%0Aif not os.path.exists(img_dir):%0A os.mkdir(img_dir)%0A%0Atest_dict = %7B'sweep.wav': 'spec_wav.png',%0A 'sweep.flac': 'spec_flac.png',%0A 'sweep.og... |
632ef6f1f1a8382e757459ed98fc8beb0a2e9eb9 | use python3 from virtualenv | twmail.py | twmail.py | #!/usr/bin/env python3
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello_world():
return 'Hi there'
if __name__ == '__main__':
app.run()
| Python | 0.000004 | @@ -1,19 +1,6 @@
#!
-/usr/bin/env
pyth
|
e0f442e34ecd7e006679d2520f426e88ccc3b626 | add factories for meal application | django/santropolFeast/meal/factories.py | django/santropolFeast/meal/factories.py | # coding=utf-8
import factory
from meal.model import Meal, Ingredient, Allergy
class MealFactory(factory.DjangoModelFactory):
class Meta:
model = Meal
nom = "Tomato Soupe"
description = "A Simple Tomato Soupe"
Ingredients = "Tomato"
class IngredientFactory(factory.DjangoModelFactory):
... | Python | 0 | @@ -161,26 +161,27 @@
Meal%0A%0A n
-om
+ame
= %22Tomato S
@@ -236,135 +236,416 @@
-Ingredients = %22Tomato%22%0A%0A%0Aclass IngredientFactory(factory.DjangoModelFactory):%0A class Meta:%0A model = Ingredient%0A%0A I
+size = %22R%22%0A%0A @classmethod%0A def __init__(self, **kwargs):%0A ... |
2f04118f890a9b43fd887ab1cfcaa3c1eded77bd | Remove unreachable code | django/website/logframe/period_utils.py | django/website/logframe/period_utils.py | from datetime import date, timedelta
def get_month_shift(month, num_periods, period_offset=1):
""" Given a start month return the calendar month of the period with
offset by period_offset.
If the month is in the next calendar year add_year is 1, so it can be
taken into account by the caller.
"""
... | Python | 0.002326 | @@ -2770,137 +2770,4 @@
s)%0A
-%0A return (x %3E= s and x %3C= e) or (x %3C= s and y %3E= s) or %5C%0A (x %3C= e and not y) or (y %3E= s and not x) or (not x and not y)%0A
|
89d927aedab37320c19ab6af950a611657b8cc5a | Use custom @login_required decorator | skylines/views/upload.py | skylines/views/upload.py | from datetime import datetime
from tempfile import TemporaryFile
from zipfile import ZipFile
from flask import Blueprint, render_template, request, flash, redirect
from flask.ext.babel import _
from flask.ext.login import login_required
from werkzeug.datastructures import CombinedMultiDict
from skylines.forms import ... | Python | 0 | @@ -191,51 +191,28 @@
rt _
-%0Afrom flask.ext.login import login_required
+, lazy_gettext as l_
%0Afro
@@ -344,16 +344,67 @@
t files%0A
+from skylines.lib.decorators import login_required%0A
from sky
@@ -1826,32 +1826,76 @@
%0A@login_required
+(l_(%22You have to login to upload flights.%22))
%0Adef index():%0A
... |
b11ebd999d1f61ab5b28dca19badcc30ee2c2805 | Allow use of custom emoji from any server bot is in | smartreact/smartreact.py | smartreact/smartreact.py | import os
import discord
import copy
from discord.ext import commands
from .utils.dataIO import dataIO
class SmartReact:
"""Create automatic reactions when trigger words are typed in chat"""
def __init__(self, bot):
self.bot = bot
self.settings_path = "data/smartreact/settings.json"
... | Python | 0 | @@ -1531,24 +1531,16 @@
ji(self,
- server,
emoji):
@@ -1617,16 +1617,47 @@
%5Br for
+server in self.bot.servers for
r in ser
@@ -4545,32 +4545,24 @@
ustom_emoji(
-server,
emoji))%0A%0A%0Ade
|
55772514499ad10077a54efd6dbaec68fc9915b0 | fix lint | fsspec/registry.py | fsspec/registry.py | import importlib
from distutils.version import LooseVersion
__all__ = ["registry", "get_filesystem_class", "default"]
# mapping protocol: implementation class object
registry = {}
default = "file"
# protocols mapped to the class which implements them. This dict can
# be dynamically updated.
known_implementations = {... | Python | 0.000013 | @@ -549,16 +549,30 @@
%22err%22:
+ (%0A
'Dropbo
@@ -609,17 +609,31 @@
rivefs%22,
-
+'%0A '
%22request
@@ -657,32 +657,42 @@
to be installed'
+%0A )
,%0A %7D,%0A %22ht
|
84c47634c9ef7d5021d549da7704863e69615c60 | Add put() method in BinarySearchTree class | ds_binary_search_tree.py | ds_binary_search_tree.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class TreeNode(object):
"""Tree node class collects helper functions for BinarySearchTree."""
def __init__(self, key, value,
left=None, right=None, parent=None):
self.key = ke... | Python | 0.000001 | @@ -1636,16 +1636,75 @@
er__()%0A%0A
+ def _put():%0A pass%0A%0A def put():%0A pass%0A%0A
%0Adef mai
|
3b037732b380adf1442046995dcb9c24d2cacf8a | Add a base model StripeDecimalField | djstripe/fields.py | djstripe/fields.py | """
.. module:: djstripe.fields.
:synopsis: dj-stripe Custom Field Definitions
.. moduleauthor:: Bill Huneke (@wahuneke)
"""
import decimal
from django.core.exceptions import FieldError
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from .settings import USE_... | Python | 0.000001 | @@ -3197,15 +3197,15 @@
ripe
-Percent
+Decimal
Fiel
@@ -3238,32 +3238,89 @@
.DecimalField):%0A
+ pass%0A%0A%0Aclass StripePercentField(StripeDecimalField):%0A
%22%22%22A field u
@@ -3748,35 +3748,16 @@
d(Stripe
-FieldMixin, models.
DecimalF
|
356ed840925cb2bf63bc03092e4989b97dd61bdb | Remove superfluous `print` | djzendesk/views.py | djzendesk/views.py | import base64
import logging
from django.conf import settings
from django.http import HttpResponse, HttpResponseNotAllowed, HttpResponseBadRequest, HttpResponseForbidden
from django.views.decorators.csrf import csrf_exempt
from djzendesk.signals import target_callback_received
def is_authenticated(request, username... | Python | 0.001908 | @@ -467,57 +467,8 @@
TA:%0A
- print request.META%5B'HTTP_AUTHORIZATION'%5D%0A
|
3193bc7d1853c42dc8a9a4949c9c58a38832a84e | Add separate threshold for FDR and initial alpha during propagation | go-enrichment-tool/go_enrichment_script.py | go-enrichment-tool/go_enrichment_script.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
@author: Pieter Moris
'''
import argparse
import enrichment_stats
import gaf_parser
import genelist_importer
import obo_tools
# Run as stand alone script
# https://stackoverflow.com/questions/419163/what-does-if-name-main-do
if __name__ == '__main__':
# Check ... | Python | 0 | @@ -1741,24 +1741,226 @@
category')%0A
+ parser.add_argument('-T', '--testing-thresh', type=float, default='0.05', dest='testing_threshold',%0A help='P-value cut-off to use to stop GO tree propogation during testing')%0A
parser.a
@@ -3965,310 +3965,169 @@
set,
-%0A ... |
49a4b43f45a2adc13c59457c36d9bb0744f26d9f | Update conf.py (#2020) | {{cookiecutter.project_name}}/docs/conf.py | {{cookiecutter.project_name}}/docs/conf.py | # wemake-django-template documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 30 12:42:34 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configur... | Python | 0 | @@ -1845,11 +1845,11 @@
= '
-3.3
+5.0
'%0A%0A#
@@ -2886,12 +2886,12 @@
e =
-None
+'en'
%0A%0A#
|
751ab889bd889443d828ca85e872801949669033 | Update LightconversationsCues2.0.py | LightconversationsCues2.0.py | LightconversationsCues2.0.py | """
This file converts a Comma separated value spreadsheet of CUES into a text
file that can then be imported to a lighting desk. The original code was created by David Orlando.
Tlaloc Lopez-Watermann added file name choice, export file name choice and cue list select.
"""
name = raw_input("What's the csv filename ... | Python | 0 | @@ -4464,12 +4464,19 @@
lose()%0A
+%0A %0A
|
46cd2ce3285f9cf580bdcc1a278b05d5df96755e | Update Source.py | LogisticRegression/Source.py | LogisticRegression/Source.py | from numpy import loadtxt, where, zeros, e, array, log, ones, mean, where
from pylab import scatter, show, legend, xlabel, ylabel, plot
from scipy.optimize import fmin_bfgs
class MLHelper:
def __init__(self):
pass
@staticmethod
def sigmoid(X):
return 1.0 / (1.0 + e ** (-1.0 * X))
class Admiss... | Python | 0.000001 | @@ -189,47 +189,8 @@
:%0A%0A%0A
- def __init__(self):%0A pass%0A%0A%0A
@@ -262,16 +262,17 @@
* X))%0A%0A
+%0A
class Ad
@@ -875,24 +875,33 @@
Admitted'%5D)%0A
+%09#show()%0A
self
|
47ba50d73dbaae2818fb177d9c2417e182d2b53d | Fix mistake in implementation of Board squares | PebbleGame/src/Board.py | PebbleGame/src/Board.py | '''
The Board class represents a board game containing n columns,
p pebbles per square, and one row per player. It provides functions
necessary for moving pebbles and copying the current game state.
'''
__author__ = "Carlos Lemus, David Shuckerow"
__license__ = "MIT"
class Board(object):
"""
:param n: number ... | Python | 0.000376 | @@ -427,17 +427,21 @@
-_
+self.
squares
|
1932ddd472d83ba464dd358a0211ba3a2895ec76 | improve thumbnail size (and set AR to 4/3) | DataTag/views/media.py | DataTag/views/media.py | # -*- coding: utf-8 -*-
# vim: set ts=4
from __future__ import unicode_literals
from django.core.servers.basehttp import FileWrapper
from django.conf import settings
from django.http import Http404, HttpResponseForbidden, StreamingHttpResponse
from django.shortcuts import get_object_or_404
from DataTag.models import... | Python | 0 | @@ -1679,14 +1679,14 @@
l((2
-0
+8
0, 2
-0
+1
0),
@@ -1758,17 +1758,17 @@
l((800,
-8
+6
00), Ima
|
e7eab95e6739b25e5b2fe3d2358ae1aaaa543854 | save "CRUDDII/CRUDDII_ALL_n100_p91_th.txt" to sparseData | DeepPep/mySprsInput.py | DeepPep/mySprsInput.py | #!/usr/bin/env python3.5
# run parameters: CRUDDII/CRUDDII_ALL_n100_p91_th.txt CRUDDII/CRUDDII_ALL_n100_p91.1n.txt
import os
import sys
import numpy as np
import csv
#X=np.zeros((400,50104), dtype=np.int_)
def sparseWriteLineToFiles(strLine, bfList, lineId):
currProtId=0
currProtStart=0
isCurrProtEmpty=Tr... | Python | 0 | @@ -402,16 +402,49 @@
== 'B':%0A
+ isCurrProtEmpty=True%0A
@@ -956,16 +956,43 @@
oFiles%0A%0A
+strDirname='./sparseData/'%0A
nProtein
@@ -1021,16 +1021,18 @@
fo=%5B%5D%0A%0A#
+a)
Create
@@ -1092,27 +1092,16 @@
lename='
-sparseData/
p%7B:d%7D.sp
@@ -1165,16 +1165,29 @@
rr=open(
+strDirname... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.