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 |
|---|---|---|---|---|---|---|---|
40080380c194c8d8a46250f5e75fa210600f8005 | update crawler | scripts/hackernews_services.py | scripts/hackernews_services.py | from unipath import Path
import sys
import os
PROJECT_DIR = Path(os.path.abspath(__file__)).parent.parent
sys.path.append(PROJECT_DIR)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'woid.settings')
import django
django.setup()
import time
import threading
from django.utils import timezone
from woid.crawler.craw... | Python | 0.000001 | @@ -1881,12 +1881,13 @@
_id=
-2928
+10194
9, o
@@ -1939,12 +1939,13 @@
_id=
-2929
+10195
0, o
|
1fcaf92540c229c41d46fba7b03377a3c298df3d | Update forms.py | orcidhub-core/forms.py | orcidhub-core/forms.py | # -*- coding: utf-8 -*-
"""Application forms."""
from flask_wtf import FlaskForm
from wtforms import StringField, SelectField, SelectMultipleField, validators, Field
from wtforms.widgets import HTMLString, html_params
from pycountry import countries
from datetime import date
from models import PartialDate as PD
# Or... | Python | 0.000001 | @@ -4866,16 +4866,47 @@
e/title%22
+, filters=%5Blambda x: x or None%5D
)%0A st
|
3abd52c70a1a026a5f188d1fe195aef6c41b928f | change some key names in the extra metadata for clarity. | arke/agent.py | arke/agent.py |
from Queue import Empty
from time import time
import logging
import shelve
import simpledaemon
from eventlet import Queue, GreenPool, sleep
import config
import persist
from plugin import get_plugin_manager
class NoPlugins(Exception): pass
class agent_daemon(simpledaemon.Daemon):
default_conf = '/etc/arke/ar... | Python | 0 | @@ -3047,13 +3047,8 @@
#
-XXX:
key
@@ -3559,16 +3559,8 @@
ra%5B'
-_id'%5D =
time
@@ -3564,16 +3564,31 @@
imestamp
+_as_id'%5D = True
%0A%0A
@@ -3639,16 +3639,23 @@
%5B'custom
+_schema
'%5D = Tru
|
ab17649005ce87277a8af11994d3f1fc7de2d120 | Update file_system_storage.py | image_diet/file_system_storage.py | image_diet/file_system_storage.py | import os
from image_diet import settings
from django.conf import settings as main_settings
from django.contrib.staticfiles.storage import StaticFilesStorage
class ImageDietFileSystemStorage(StaticFilesStorage):
def post_process(self, files, *args, **kwargs):
results = []
print 'test'
pri... | Python | 0.000002 | @@ -344,33 +344,32 @@
SS_STATIC_IMAGES
-:
%0A die%0A
|
48431e74cf6a7794f12c29f582170ff45666862a | rename page_image key in page_image_free | scripts/illustrate_wikidata.py | scripts/illustrate_wikidata.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Bot to add images to Wikidata items.
The image is extracted from the page_props. For this to be available the
PageImages extension (https://www.mediawiki.org/wiki/Extension:PageImages)
needs to be installed
Usage:
python pwb.py illustrate_wikidata <some generator>
&... | Python | 0.001596 | @@ -1642,16 +1642,21 @@
ge_image
+_free
')%0A%0A
@@ -2383,22 +2383,17 @@
put(
-'%5B%5B%25s%5D%5D
+%22%25s
doesn
-%5C
't e
@@ -2409,9 +2409,8 @@
can
-%5C
't l
@@ -2418,17 +2418,17 @@
nk to it
-'
+%22
%0A
@@ -2451,17 +2451,16 @@
%25
-(
image.ti
@@ -2463,18 +2463,27 @@
e.title(
-),
+asLink=... |
bca06e7888af9d47e93eff6500c71343525c3f24 | Make sure instance_class is present. Default num cache nodes to 1 | touchdown/aws/elasticache/cache.py | touchdown/aws/elasticache/cache.py | # Copyright 2014 Isotoma Limited
#
# 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... | Python | 0.000001 | @@ -652,16 +652,25 @@
ort Plan
+, Present
%0Afrom to
@@ -1492,16 +1492,34 @@
Integer(
+default=1, min=1,
field='N
@@ -2605,16 +2605,101 @@
lable%22%0A%0A
+ signature = (%0A Present(%22name%22),%0A Present(%22instance_class%22),%0A )%0A%0A
%0Aclass D
|
ea9b40f4b69ebdce7ac060a467151c8e80c5513e | Fix up whoisaccount with new metadata key | txircd/modules/core/whoisaccount.py | txircd/modules/core/whoisaccount.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
irc.RPL_WHOISACCOUNT = "330"
class WhoisAccount(ModuleData):
implements(IPlugin, IModuleData)
name = "WhoisAccount"
core = True
def actions... | Python | 0.000059 | @@ -465,20 +465,16 @@
%22account
-name
%22):%0A%09%09%09u
@@ -561,20 +561,16 @@
%22account
-name
%22), %22is
|
55afcc1d332427d84dbd2a2f8b1d5d23df8da02f | use pre-mismatch-correction contigs as backup in SPAdes plugin | lib/assembly/plugins/spades.py | lib/assembly/plugins/spades.py | import glob
import logging
import os
from plugins import BaseAssembler
from yapsy.IPlugin import IPlugin
logger = logging.getLogger(__name__)
class SpadesAssembler(BaseAssembler, IPlugin):
new_version = True
def run(self):
"""
Build the command and run.
Return list of contig file(s)
... | Python | 0 | @@ -547,16 +547,11 @@
pts
-only one
+%3C=5
pai
@@ -671,17 +671,25 @@
is
-un
+also
limited
+ to 5
.%0A
@@ -857,21 +857,23 @@
logger.
-error
+warning
('%3E 5 pa
@@ -1624,32 +1624,52 @@
lib_num += 1%0A%0A
+ lib_num = 1%0A
for read
@@ -1713,16 +1713,197 @@
+ if lib_num %3E 5:%0A ... |
fc7b133fa520ac96758c99f6dfe9e098c5175f40 | test sample | astroabc_mpi/tests.py | astroabc_mpi/tests.py | import numpy as np
from .abc_class import *
def dist(d,x):
'''Distance metric: rho'''
return np.sum(np.abs(np.mean(x,axis=0) - np.mean(d,axis=0)))
class test_abc:
def setUp(self):
self.nparam =2
self.npart = 100
self.nsamples =1000
self.niter =15
self.tlevels =... | Python | 0.000001 | @@ -287,17 +287,16 @@
.niter =
-1
5%0A
@@ -323,11 +323,9 @@
7,0.
-005
+1
%5D%0A
@@ -866,16 +866,23 @@
def test
+_sample
(self):%0A
@@ -980,24 +980,103 @@
*self.prop)%0A
+%09%09model_sim = Model(model_type,nsamples).make_mock%0A%09%09sampler.sample(model_sim)%0A
%09%09for i in r
@@ -2131,24 +2131,30 @@
... |
c59f91b4610fc9b1abf27758f07880048c569ab8 | add image and album redirect to library, per spec | imagersite/imager_images/views.py | imagersite/imager_images/views.py | """Views for our imager_images app."""
from django.views.generic import TemplateView, CreateView
from imager_images.models import Image, Album
from django.utils import timezone
from imager_images.forms import PhotoForm, AlbumForm
from django.shortcuts import redirect
class LibraryView(TemplateView):
"""A class ba... | Python | 0 | @@ -3045,24 +3045,15 @@
ct('
-individual_photo
+library
', p
@@ -3514,24 +3514,15 @@
ct('
-individual_album
+library
', p
|
2eae1c9d8b0701feb3ba08be25e3fd0d6b4d490b | Add paths to ignore in integrity plugin and ignore `/etc/adjtime`. | canaryd/plugins/integrity.py | canaryd/plugins/integrity.py | from glob import glob
from hashlib import sha1
from os import path, stat
from canaryd_packages import six
from canaryd.plugin import Plugin
# Attempt to import pwd/grp - only supported on *nix
try:
import pwd
import grp
except ImportError:
pwd = None
grp = None
BUFFER_SIZE = 65536
MAX_SIZE = 1024 *... | Python | 0 | @@ -540,16 +540,58 @@
n/*',%0A)%0A
+PATHS_TO_IGNORE = (%0A '/etc/adjtime',%0A)%0A
%0A%0Adef ge
@@ -1409,24 +1409,97 @@
if
+(%0A filename in PATHS_TO_IGNORE%0A or
not path.isf
@@ -1507,24 +1507,42 @@
le(filename)
+%0A )
:%0A
|
b226a96229a75a0cdcfc3acca3ec84beba2c1613 | refresh camera after changing it does not work FIX | src/astroprint/api/camera.py | src/astroprint/api/camera.py | # coding=utf-8
__author__ = "Daniel Arroyo <daniel@astroprint.com>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import octoprint.util as util
from flask import jsonify, request, abort
from octoprint.server import restricted_access, SUCCESS
from octoprint.server.api import a... | Python | 0.000001 | @@ -315,16 +315,56 @@
port api
+%0Afrom octoprint.settings import settings
%0A%0Afrom a
@@ -577,35 +577,138 @@
)%0A%0A%09
-opened = cm.open_c
+if settings().get(%5B'camera', 'manager'%5D) == 'gstreamer':%0A%09%0A%09%09return jsonify(%7B%22isCameraPlugged%22: cm.init_gstre
amer
-a
()
+%7D)
%0A%0A
+%09else:%0A%09%0... |
004a804e1d4bbf2caf588bb98127f6bbb8357a72 | Update projectfiles_unchanged.py version 4 | projectfiles_unchanged.py | projectfiles_unchanged.py | #!/usr/bin/env python3
#
# This script is used on Linux, OS X and Windows.
# Python 3 required.
# Returns 0 if project files are unchanged and 1 else.
#
# Script version: 3
import os
import glob
import hashlib
import sys
matches = []
tmp_file = "projectfiles.md5.tmp"
exlude_dirs = set(['.git', 'docs'])
def get_subdi... | Python | 0 | @@ -164,17 +164,17 @@
ersion:
-3
+4
%0Aimport
@@ -515,16 +515,54 @@
*.pro%22)%0A
+ out += glob.glob(path + %22/*.pri%22)%0A
out
|
3fab74f6de013ded103cdd953cbf61e298b733a3 | fix name conflict between argument and stdlib function | app/songbook/latex.py | app/songbook/latex.py | # -*- coding: utf-8 -*-
from re import sub
from .templatetags.latex_escape import latex_escape
LATEX = {
'verse_token': '\zwrotka',
'chorus_token': '\\refren',
'verse_end_token': '\koniec',
'chorus_end_token': '\koniec',
'chords_token': '\chwyty',
}
class SongState:
Nothing, Verse, Chorus = l... | Python | 0.000025 | @@ -345,19 +345,20 @@
dentals(
-str
+text
):%0A r
@@ -487,19 +487,20 @@
str(
-str
+text
)%0A
|
1bfebf1d3851721f813dcb898203822c92beea31 | add assertion to check vector length | sprocket/util/twf.py | sprocket/util/twf.py | # -*- coding: utf-8 -*-
import numpy as np
from dtw import dtw
from fastdtw import fastdtw
from dtw_c import dtw_c
from sprocket.util import melcd
def estimate_twf(orgdata, tardata, distance='melcd', fast=True, otflag=None):
"""time warping function estimator
Parameters
---------
orgdata : array, s... | Python | 0 | @@ -1876,16 +1876,32 @@
et index
+ by frame number
%0A
@@ -1984,16 +1984,134 @@
wap cols
+%0A assert twf.shape%5B1%5D == orgdata.shape%5B0%5D%0A else:%0A assert twf.shape%5B1%5D == tardata.shape%5B0%5D
%0A%0A re
|
867c051c603ef622ad3568f77290e525f3e5ceab | Make ProductQuestion support lazy-loading | holviapi/products.py | holviapi/products.py | # -*- coding: utf-8 -*-
from __future__ import print_function
from future.utils import python_2_unicode_compatible, raise_from
from .categories import IncomeCategory, CategoriesAPI
from .utils import HolviObject, JSONObject
@python_2_unicode_compatible
class Product(HolviObject):
"""This represents a product in t... | Python | 0.999335 | @@ -55,16 +55,17 @@
unction%0A
+%0A
from fut
@@ -121,16 +121,17 @@
se_from%0A
+%0A
from .ca
@@ -150,37 +150,37 @@
ort
-Income
Categor
-y,
+iesAPI, Income
Categor
-iesAPI
+y
%0Afro
@@ -1558,16 +1558,282 @@
ltered%0A%0A
+ def get_question(self, code):%0A if self._lazy:%0A # Trigger full fe... |
7abc409e0ac87076d21da720ef4100883c8be8a8 | update SPAdes to 3.5.0 add options for --careful and longer reads with max k=155 | lib/assembly/plugins/spades.py | lib/assembly/plugins/spades.py | import glob
import logging
import os
from plugins import BaseAssembler
from yapsy.IPlugin import IPlugin
class SpadesAssembler(BaseAssembler, IPlugin):
new_version = True
def run(self):
"""
Build the command and run.
Return list of contig file(s)
SPAdes takes as input forward... | Python | 0 | @@ -200,17 +200,16 @@
%22%22%22
-
%0A
@@ -657,24 +657,16 @@
%22%22%22%0A
-
%0A
@@ -2216,16 +2216,143 @@
,127'%5D%0A%0A
+ if self.read_length == 'longer' or self.read_length %3E= '300':%0A cmd_args += %5B'-k', '21,33,55,77,99,127,155'%5D%0A
%0A
@@ -2567,16 +... |
c3258629f8ee888e6196a4e1271be1390c17c927 | fix bug | scripts/lib/fetch_term_data.py | scripts/lib/fetch_term_data.py | from argparse import ArgumentParser
import functools
import xmltodict
import requests
import json
from .load_data_from_file import load_data_from_file
from .save_data_as_csv import save_data_as_csv
from .fix_invalid_xml import fix_invalid_xml
from .paths import make_xml_term_path
from .delete_file import delete_file
f... | Python | 0.000001 | @@ -3292,18 +3292,18 @@
_term(da
-a
t
+a
)%0A re
|
60d65c103fb0b2a63000834ace9287ef94a910f7 | use state machine | zq_gen/str.py | zq_gen/str.py | '''
Helper functions for string related operation
'''
import unittest
def cmd_str2dic(cmd_str):
words = cmd_str.split()
rst = {}
if len(words) >= 1:
begin = 0;
if words[0][0:1] != '-': # the first one could be the the name of the command
rst['cmd_name'] = words[0]
be... | Python | 0.000003 | @@ -206,16 +206,31 @@
!= '-':
+
# the f
@@ -361,16 +361,38 @@
= '...'
+
# defau
@@ -396,32 +396,55 @@
fault parameter%0A
+ quoted = False%0A
for word
@@ -481,62 +481,92 @@
if
-word.startswith('%22'):%0A word = word%5B1:%5D%0A
+quoted: ... |
b6129b1458b8d79a9233f9d5c1ccdfcc5e768127 | Make contain_imagecache_size cron run every hour | astrobin/apps.py | astrobin/apps.py | # Django
from django.apps import AppConfig
from django.db.utils import IntegrityError, ProgrammingError, OperationalError
class AstroBinAppConfig(AppConfig):
name = 'astrobin'
verbose_name = 'AstroBin'
def registerActStreamModels(self):
from actstream import registry
registry.register('au... | Python | 0.000002 | @@ -3944,9 +3944,9 @@
te='
-2
+3
0',%0A
@@ -3959,33 +3959,33 @@
hour='
-4
+*
',%0A
|
ad06f149015fc78365df3a20f7b66d6b00de3da7 | Rename related state to joined to match interface update | reactive/flume_hdfs.py | reactive/flume_hdfs.py | from charms.reactive import when, when_not
from charms.reactive import set_state, remove_state, is_state
from charmhelpers.core import hookenv
from charms.layer.apache_flume_base import Flume
from charms.reactive.helpers import any_file_changed
@when_not('hadoop.related')
def report_unconnected():
hookenv.status_... | Python | 0 | @@ -254,29 +254,28 @@
not('hadoop.
-relat
+join
ed')%0Adef rep
@@ -384,21 +384,20 @@
'hadoop.
-relat
+join
ed')%0A@wh
|
76ba80f72f80eabd696cefdf720d71cc0ff08de2 | make haystack search work again. | astrobin/urls.py | astrobin/urls.py | from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
from djangoratings.views import AddRatingFromModel
admin.autodiscover()
from astrobin import views
from astrobin import lookups
from astrobin.models import Image
from astrobin.search import ImageSearchView
urlp... | Python | 0 | @@ -1128,28 +1128,32 @@
ge_delete),%0A
+%0A
+url
(r'%5Esearch/'
@@ -1171,16 +1171,40 @@
chView()
+, name='haystack_search'
),%0A%0A
|
657a22dc282452b9ffeb408721623c3029cf5ad2 | save allvisit filename on paths object | scripts/make-troup-allVisit.py | scripts/make-troup-allVisit.py | """
Create a subset of APOGEE's allVisit file that contains only the stars in Troup's sample.
"""
# Standard library
import os
# Third-party
from astropy.io import fits
import h5py
import numpy as np
# Project
from thejoker import Paths
paths = Paths(__file__)
def main():
allVisit_path = os.path.join(paths.ro... | Python | 0 | @@ -426,80 +426,8 @@
sv%22)
-%0A output_path = os.path.join(paths.root, %22data%22, %22troup-allVisit.h5%22)
%0A%0A
@@ -973,19 +973,28 @@
ile(
-output_path
+paths.troup_allVisit
, 'w
|
3af6ea398990ec49da35dd0aa171269b47ed5eea | Update the `tensorflow-addons` package to version `0.10.0`. | tensorflow_federated/tools/development/setup.py | tensorflow_federated/tools/development/setup.py | # Copyright 2018, The TensorFlow Federated Authors.
#
# 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 o... | Python | 0 | @@ -2769,11 +2769,12 @@
~=0.
-9.1
+10.0
',%0A
|
f77888d2f01ce1c1e22bbf43ee7531feb3c4c591 | missing coma | oscar_stripe/facade.py | oscar_stripe/facade.py | from django.conf import settings
from oscar.apps.payment.exceptions import UnableToTakePayment, InvalidGatewayRequestError
from django.utils import timezone
import stripe
from django.db.models import get_model
Source = get_model('payment', 'Source')
Order = get_model('order', 'Order')
class Facade(object):
def _... | Python | 0.998939 | @@ -1352,16 +1352,17 @@
together
+,
%0A
|
075bb05e57e63bb3e4f6cf70ce2c7db883d920e2 | correct curve radius formula | lane_line.py | lane_line.py | import numpy as np
from collections import deque
class LaneLine():
def __init__(self):
# was the line detected in the last iteration?
self.detected = False
# x values of the last n fits of the line
self.recent_xfitted = deque([])
self.recent_yfitted = None
... | Python | 0.000025 | @@ -1559,16 +1559,17 @@
ad = ((1
+
+ (2 * c
@@ -1582,16 +1582,20 @@
t%5B0%5D
-*
+ *
y_eval
-*
+ *
ym_p
@@ -1618,13 +1618,25 @@
%5B1%5D)
+
**
+
2)
-/
+ ** 1.5) /
np.a
@@ -1647,10 +1647,26 @@
ute(
-2*
+%0D%0A 2 *
curv
@@ -1673,17 +1673,16 @@
_fit%5B0%5D)
-)
%0D%0A
|
16973666e40071c4fc938fa14f70a991bf5e11fb | Generalize a retriable error for EL7 | osgtest/library/yum.py | osgtest/library/yum.py | """Functions for performing common yum tasks.
The most important of these being the retry_command() function. This is
necessary to overcome transient network issues, especially when running
the tests in VM universe at the CHTC.
"""
import re
import time
import osgtest.library.core as core
def clean_yum():
dead... | Python | 0.999985 | @@ -2576,39 +2576,32 @@
r'
-Error:
Cannot retrieve
|
de3aeb774088c391ab4e93e4526f178c4dc04a3e | Remove unsupported prompt | asyncstdio.py | asyncstdio.py | import threading
import os
import sys
import termios
import signal
REAL_SIGINT = signal.getsignal(signal.SIGINT)
class AsyncIO:
def __init__(self):
self.input_buffer = []
self.lock = threading.Lock()
self.output_access = False
self.fd = sys.stdin.fileno()
self.orgingal_confi... | Python | 0.000004 | @@ -1175,19 +1175,8 @@
self
-, prompt=%22%22
):%0A
|
0c47016840b9b9b0feaeab6076a48da0b41d3520 | Edit notifier.notify() | osprofiler/notifier.py | osprofiler/notifier.py | # Copyright 2014 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Python | 0.000006 | @@ -805,34 +805,134 @@
o):%0A
-global __notifier%0A
+%22%22%22Passes the profiling info to the notifier callable.%0A%0A :param info: dictionary with profiling information%0A %22%22%22
%0A __n
|
0aa22c1a24fb649a9186d36e44a5a7f1a53e66df | Add items() method to odict() as suggested by @streeto. Closes #49. | atpy/odict.py | atpy/odict.py | from __future__ import print_function, division
import numpy as np
class odict(object):
def __init__(self):
self.keys = []
self.values = []
def __setitem__(self, key, value):
if type(key) == int:
if key > len(self.keys) - 1:
raise Exception("Element %i doe... | Python | 0 | @@ -1852,20 +1852,85 @@
urn iter(self.keys)%0A
+%0A def items(self):%0A return zip(self.keys, self.values)%0A
|
a480182f51870c61be56942a7b5bb1ba3432ad84 | Rework lwr.managers.util.cli.job.torque to use lwr.managers.util.job_script. | lwr/managers/util/cli/job/torque.py | lwr/managers/util/cli/job/torque.py |
from string import Template
from ..job import BaseJobExec
try:
import xml.etree.cElementTree as et
except:
import xml.etree.ElementTree as et
__all__ = ('Torque',)
from logging import getLogger
log = getLogger(__name__)
PBS_JOB_TEMPLATE = """#!/bin/sh
$pbs_header
cd $working_directory
$command_line
echo $? ... | Python | 0 | @@ -1,63 +1,4 @@
-%0Afrom string import Template%0Afrom ..job import BaseJobExec%0A
try:
@@ -86,16 +86,84 @@
as et%0A%0A
+from ..job import BaseJobExec%0Afrom ...job_script import job_script%0A%0A
__all__
@@ -238,121 +238,8 @@
_)%0A%0A
-PBS_JOB_TEMPLATE = %22%22%22#!/bin/sh%0A$pbs_header%0Acd $working_directory%0... |
c955af075444f964c9711cd5c96816bb1d2fa0ec | Rollback the existing session on IntegrityError | autocloud/consumer.py | autocloud/consumer.py | # -*- coding: utf-8 -*-
from datetime import datetime
import koji
import requests
import fedmsg.consumers
import fedfind.release
import autocloud
from autocloud.models import init_model, ComposeDetails
from autocloud.producer import publish_to_fedmsg
from autocloud.utils import is_valid_image, produce_jobs, get_imag... | Python | 0 | @@ -124,16 +124,44 @@
elease%0A%0A
+from sqlalchemy import exc%0A%0A
import a
@@ -4025,17 +4025,75 @@
except
-:
+ exc.IntegrityError:%0A session.rollback()
%0A
@@ -4372,32 +4372,33 @@
)
+)
%0A%0A nu
|
0e989e282c0bd791629982502f4607cee618a7a5 | Use native Windows types | locket/__init__.py | locket/__init__.py | import time
import errno
import threading
import weakref
__all__ = ["lock_file"]
try:
import fcntl
except ImportError:
try:
import ctypes
import msvcrt
except ImportError:
raise ImportError("Platform not supported (failed to import fcntl, ctypes, msvcrt)")
else:
_WinAP... | Python | 0.000001 | @@ -150,16 +150,47 @@
ctypes%0A
+ import ctypes.wintypes%0A
@@ -423,39 +423,45 @@
estype = ctypes.
-c_int32
+wintypes.BOOL
%0A _WinAPI
@@ -485,36 +485,70 @@
s = %5Bctypes.
-c_int32
+wintypes.HANDLE%5D + %5Bctypes.wintypes.DWORD
%5D *
-5
+4
%0A%0A _W
@@ -644,23 +644,29 @@
ctypes.... |
7bfa9d24f7af811746bbb0336b5e75a592cff186 | Fix KeyError: 'version' due to 403 Forbidden error | aws_eis/lib/checks.py | aws_eis/lib/checks.py | import json
import sys
import requests
def py_version():
if sys.version_info < (3, 0, 0):
print(sys.version)
print('You must use Python 3.x to run this application.')
sys.exit(1)
def get_version(endpoint):
r = requests.get('https://{}'.format(endpoint))
es_version = json.loads(r.... | Python | 0.000116 | @@ -433,32 +433,46 @@
rmat(endpoint))%0A
+%0A try:%0A
es_version =
@@ -498,36 +498,27 @@
nt)%0A
-%0A
-if r.status_code == 200
+except KeyError
:%0A
@@ -534,17 +534,14 @@
nt('
-ESVersion
+Status
: %7B%7D
@@ -553,53 +553,91 @@
mat(
-es_version))%0A print('Connection: OK')%0A
+r.status_cod... |
5e71f486a06165d499334e9616e5f29ec411940f | make all arguments optional for get_demos_path (#138) | babyai/utils/demos.py | babyai/utils/demos.py | import os
import pickle
from .. import utils
def get_demos_path(demos, env, origin, valid):
valid_suff = '_valid' if valid else ''
demos_path = (demos + valid_suff
if demos
else env + "_" + origin + valid_suff) + '.pkl'
return os.path.join(utils.storage_dir(), 'demos', ... | Python | 0 | @@ -68,21 +68,31 @@
emos
-, env
+=None, env=None
, origin
, va
@@ -91,15 +91,26 @@
igin
+=None
, valid
+=False
):%0A
|
eee38bcc10159d9cde7c20749756ccf31e3ccc6b | print url for chart with methylated sites. | scripts/methylation_summary.py | scripts/methylation_summary.py | import sys
import os.path as op
sys.path.insert(0, op.join(op.dirname(__file__), "../code"))
from methyl import MethylGroup
mg = MethylGroup(sys.argv[1])
contexts = ('CG', 'CHG', 'CHH')
print "#", mg.prefix, mg.dir, mg.pattern
total_cs = dict((ctx, 0) for ctx in contexts)
total_ts = dict((ctx, 0) for ctx in contex... | Python | 0 | @@ -1857,17 +1857,20 @@
.5)%0A
-print
+chart =
%22%22%22
+%5C
%0Acht
@@ -2435,8 +2435,112 @@
HHPCT)%0A%0A
+chart = 'http://chart.apis.google.com/chart?' + chart.replace(%22%5Cn%7C%22, %22%22).replace(%22%5Cn%22, %22&%22)%0Aprint chart%0A
|
cd006f8d3885005e867255e63819fc8a5c7430bf | Add getter for text widget | redactor/TextEditor.py | redactor/TextEditor.py | from tkinter import *
class TextEditor():
def __init__(self):
self.root = Tk()
self.root.wm_title("BrickText")
self.text_panel = Text(self.root)
self.text_panel.pack(fill=BOTH, expand=YES)
def start(self):
self.root.mainloop()
def get_root(self):
return se... | Python | 0.000001 | @@ -320,16 +320,79 @@
elf.root
+%0A %0A def get_text_widget(self):%0A return self.editor
%0A%0A de
|
61108f794b53048aae3fc9840abf34a4150bb83a | Combine tests into one | leap/leap.py | leap/leap.py | def is_leap_year(y):
if y % 400 == 0:
return True
elif y % 100 == 0:
return False
elif y % 4 == 0:
return True
else:
return False
| Python | 0.999526 | @@ -22,62 +22,41 @@
-if
+return (
y %25 4
-00
== 0
-:%0A return True%0A elif
+) and (
y %25 100
== 0
@@ -55,103 +55,26 @@
100
-== 0:%0A return False%0A elif
+!= 0 or
y %25 4
+00
== 0
-:%0A return True%0A else:%0A return False
+)
%0A
|
7c02a79a5eb2dd6b9b49b2eefbdde1064a73de17 | Fix exception handling in TagField | redpanal/core/forms.py | redpanal/core/forms.py | from django import forms
from django.utils.translation import ugettext as _
from taggit.utils import parse_tags, edit_string_for_tags
class TagParseError(Exception):
pass
def tags_to_editable_string(tags):
return u' '.join([u"#%s" % t for t in tags])
def parse_tags(string):
tags = string.split()
for... | Python | 0.000001 | @@ -1095,12 +1095,13 @@
ror(
-e.msg
+str(e)
)%0A%0A
|
c37931e36280c814eb94500a56f964b63a498512 | Reformat a few lines to fit with PEP0008's width | interfaces.py | interfaces.py | #!/usr/bin/python3
# Copyright (c) 2016, Troy Telford
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list ... | Python | 0 | @@ -4255,16 +4255,85 @@
eption:%0A
+ # Interface doesn't have an address we could report.%0A
@@ -4393,32 +4393,64 @@
m interface %25s.%22
+%0A
%25 (addr_type, i
@@ -4615,16 +4615,158 @@
index:%0A
+ # Most likely, there is no IP address for the... |
f2c0c1ab83dbc2344612e4cbf66d39acefa2fd4f | define encoding | translate/tests/test_translator.py | translate/tests/test_translator.py | try:
import unittest2 as unittest
except ImportError:
import unittest
from nose.tools import *
from translate import translator
class TestTranslator(unittest.TestCase):
def typeassert(self):
instance = translator('en', 'en', str())
self.assertIsInstance(instance, dict)
self.asser... | Python | 0.00079 | @@ -1,8 +1,32 @@
+# -*- coding: utf-8 -*-%0A
try:%0A
@@ -649,24 +649,8 @@
ns'%5D
-.decode('utf-8')
, '%E6%88%91
|
ced3ca5621626ece03ee766159ad9a4b50121535 | Revert regex change | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2013 Aparajita Fishman
#
# License: MIT
#
"""This module exports the JSHint plugin linter class."""
import re
from SublimeLinter.lint import Linter
class JSHint(Linter):
"""P... | Python | 0.000001 | @@ -496,18 +496,16 @@
e = r'%5Cb
-.+
v(?P%3Cver
|
ad09fec9c91481cd7aaeda0ffd4c23d1c7b860f3 | Extract line-offset computation | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2015-2016 The SublimeLinter Community
# Copyright (c) 2013-2014 Aparajita Fishman
#
# License: MIT
#
"""This module exports the Annotations plugin class."""
import re
from SublimeL... | Python | 0.998569 | @@ -289,16 +289,71 @@
ss.%22%22%22%0A%0A
+from itertools import accumulate as accumulate_, chain%0A
import r
@@ -451,20 +451,24 @@
import
-List
+Iterable
, Iterat
@@ -470,16 +470,22 @@
terator,
+ List,
Union%0A
@@ -2325,36 +2325,120 @@
-offset_until_line =
+lines = region_text.splitlines(keepends=True)... |
ae11251f7669e4ddde6f0491ff1fe0afdfd54a7a | Change 'language' to 'syntax', that is more precise terminology. | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2013 Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter-contrib-jsl
# License: MIT
#
"""This module exports the JSL plugin linter class."""
from SublimeLi... | Python | 0.002004 | @@ -423,16 +423,14 @@
-language
+syntax
= (
|
645811b5aa28c460f0a986dadf96ddefffbe241d | fix documentation | linval.py | linval.py | '''program to estimate the generalization error from a variety of AVMs
Determine accuracy on validation set YYYYMM of various hyperparameter setting
for elastic net.
INVOCATION
python val.py YYYYMM [-test]
INPUT FILE:
WORKING/samples-train-validate.csv
OUTPUT FILE:
WORKING/linval/YYYYMM.pickle
'''
from __fut... | Python | 0 | @@ -181,16 +181,19 @@
python
+lin
val.py Y
|
ce5d02adc02b421ee2a16e988fa9fa122fc872a8 | Update run_init_temp.py | scripts/tests/run_init_temp.py | scripts/tests/run_init_temp.py | import os
import sys
pwd =os.getcwd()
tpath = vtr_flow_holder
design = diffeq1
wrksp = workspace_holder
proc_num = 1
datpath = sys.path[0]
srcFile = datpath+"/run_DATuner.py"
rep_cmd = "sed -e \"s:TOOL_PATH:"+tpath+":g\" -e \"s:DESIGN_NAME:"+design+":g\" -e \"s:WORKSPACE:"+wrksp+":g\" -e \"s:DATuner_PATH:"+datpath+"... | Python | 0.000003 | @@ -40,16 +40,17 @@
tpath =
+%22
vtr_flow
@@ -56,16 +56,17 @@
w_holder
+%22
%0Adesign
@@ -71,15 +71,17 @@
n =
+%22
diffeq1
+%22
%0Awrk
@@ -85,16 +85,17 @@
wrksp =
+%22
workspac
@@ -102,16 +102,17 @@
e_holder
+%22
%0Aproc_nu
|
9caad093da21d18e2bb72726d98fbd53ee0a9ac5 | Add namespace support to depmap2md.py | aux/depmap2md.py | aux/depmap2md.py | #!/usr/bin/env python
# Copyright (c) 2016 Red Hat, 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 l... | Python | 0 | @@ -920,16 +920,33 @@
= False%0A
+namespace = None%0A
for i in
@@ -1056,16 +1056,129 @@
.argv%5Bi%5D
+%0A elif sys.argv%5Bi%5D == '--scl':%0A del sys.argv%5Bi%5D%0A namespace = sys.argv%5Bi%5D%0A del sys.argv%5Bi%5D
%0A%0Aprefix
@@ -4025,24 +4025,102 @@
%25 value%5B0%5D%0A
+ if namespac... |
4a298d076546df563239861689dba46606d4f6f0 | bump version: 0.2.8 | guacamol/__init__.py | guacamol/__init__.py | __version__ = "0.2.7"
| Python | 0.000002 | @@ -16,7 +16,7 @@
0.2.
-7
+8
%22%0A
|
be5772a6d64a0ceeb1c5748364ca10f376d2fe51 | Add customizable SHOP_CHARGE_CURRENCY setting | cartridge_stripe/__init__.py | cartridge_stripe/__init__.py | import logging
import cartridge
import stripe
from django.utils.translation import ugettext as _
logger = logging.getLogger(__name__)
class CheckoutError(Exception):
"""
Should be raised in billing/shipping and payment handlers for
cases such as an invalid shipping address or an unsuccessful
payment... | Python | 0.000004 | @@ -90,16 +90,49 @@
ext as _
+%0Afrom django.conf import settings
%0A%0Alogger
@@ -163,16 +163,77 @@
ame__)%0A%0A
+CURRENCY = getattr(settings, 'SHOP_CHARGE_CURRENCY', 'usd')%0A%0A
%0Aclass C
@@ -941,13 +941,16 @@
ncy=
-%22usd%22
+CURRENCY
,%0A
|
7a9524a7d4841708e3af561119da7b58d05029a6 | add imagesh function | matplotlib_wrap.py | matplotlib_wrap.py | #!/usr/bin/env python2
import matplotlib.pyplot as plt
import netCDF4
import numpy as np
from matplotlib.widgets import Slider, Button, RadioButtons
def intimage(img, **kwargs):
"""Interactive imshow with widgets.
"""
fig, ax = plt.subplots()
plt.subplots_adjust(left=0, bottom=0.20)
im = ax.imshow... | Python | 0.000002 | @@ -3676,16 +3676,207 @@
urn ax%0A%0A
+%0A_SHAREDFIG = None%0A%0Adef imagesh(img, **kwargs):%0A global _SHAREDFIG%0A%0A if _SHAREDFIG is None:%0A _SHAREDFIG = Fig(img, **kwargs)%0A else:%0A _SHAREDFIG.imshow(img, **kwargs)%0A%0A%0A
def load
|
1d87bb43c7439ea9f91d652f417e17457d0311df | Update updater.py | bin/updater.py | bin/updater.py | #!/usr/bin/env python
"""
ownCloud - News
@author Bernhard Posselt
@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
License as published by the Free Software Foundation; either
versi... | Python | 0.000001 | @@ -4135,16 +4135,47 @@
ly once,
+ DO NOT use this in a cron job,
only re
|
8b889c10abf043f6612409973458e8a0f0ed952e | Initialize the log counter to 0xFF | bonus_level.py | bonus_level.py | #!/usr/bin/env python
from time import sleep
# Usage: ./bonus_level.py, then input your plaintext enclosed by quotes
# Note: I haven't made a ciphertext for this because the attack on it depends
# a lot on the machine it was implemented on
secret = input("Please enter your plaintext: ")
for char in secret:
for i... | Python | 0.000245 | @@ -306,16 +306,37 @@
secret:%0A
+ log_counter = 0xFF%0A
for i
|
64c8fd3fa18dd6644a67cbd9e9aa5f20eb5e85a7 | Add krelloptions variant that is used to turn on a configuration option to build the thread safe lightweight libraries. | var/spack/packages/mrnet/package.py | var/spack/packages/mrnet/package.py | from spack import *
class Mrnet(Package):
"""The MRNet Multi-Cast Reduction Network."""
homepage = "http://paradyn.org/mrnet"
url = "ftp://ftp.cs.wisc.edu/paradyn/mrnet/mrnet_4.0.0.tar.gz"
version('4.0.0', 'd00301c078cba57ef68613be32ceea2f')
version('4.1.0', '5a248298b395b329e2371bf25366115c'... | Python | 0 | @@ -324,88 +324,427 @@
-parallel = False%0A%0A depends_on(%22boost%22)%0A%0A def install(self, spec, prefix):%0A
+variant('krelloptions', default=False, description=%22Also build the MRNet LW threadsafe libraries%22)%0A parallel = False%0A%0A depends_on(%22boost%22)%0A%0A def install(self, spec, pr... |
059a97d8a7bb2aee5105056bd4bcc60b7a745b71 | Fix AttributeError when Model inherit a manager | djmoney/models/fields.py | djmoney/models/fields.py | from django.db import models
from django.utils.encoding import smart_unicode
from exceptions import Exception
from moneyed import Money, Currency, DEFAULT_CURRENCY
from djmoney import forms
from decimal import Decimal
__all__ = ('MoneyField', 'currency_field_name', 'NotSupportedLookup')
currency_field_name... | Python | 0.999995 | @@ -3798,11 +3798,11 @@
if
-has
+get
attr
@@ -3825,16 +3825,22 @@
manager'
+, None
):%0D%0A
|
f11411d223a3b160e5f9f25e0b2521d5235137ae | Correct origin finder code for build details | changes/api/build_details.py | changes/api/build_details.py | from __future__ import absolute_import
from collections import defaultdict
from flask import Response
from sqlalchemy.orm import joinedload
from changes.api.base import APIView
from changes.api.serializer.models.testgroup import TestGroupWithOriginSerializer
from changes.constants import Result, Status, NUM_PREVIOUS_... | Python | 0 | @@ -1709,24 +1709,28 @@
for job,
+job_
failures in
@@ -1831,16 +1831,20 @@
job,
+job_
failures
@@ -1869,36 +1869,35 @@
test_failure in
-test
+job
_failures:%0A
|
1842cac64940a43a43399e6e942c59265b03c1a7 | Add `viewable` field to Concept preserialize template | serrano/resources/templates.py | serrano/resources/templates.py | Category = {
'fields': [':pk', 'name', 'order', 'parent_id'],
'allow_missing': True,
}
BriefField = {
'fields': [':pk', 'name', 'description'],
'allow_missing': True,
}
Field = {
'fields': [
':pk', 'name', 'plural_name', 'description', 'keywords',
'app_name', 'model_name', 'field_n... | Python | 0 | @@ -925,24 +925,36 @@
, 'sortable'
+, 'viewable'
%0A %5D,%0A
|
bbd0c68669ffa0fd2d01ac8f86302673ed7b710e | Add default configuration for mongo | dlstats/configuration.py | dlstats/configuration.py | import configobj
import validate
import os
def _get_filename():
"""Return the configuration file path."""
appname = 'dlstats'
if os.name == 'posix':
if "HOME" in os.environ:
if os.path.isfile(os.environ["HOME"]+'/.'+appname+'/main.conf'):
return os.environ["HOME"]+'/.'+a... | Python | 0.000001 | @@ -1881,16 +1881,81 @@
s.xml'%7D%7D
+%0A configuration%5B'MongoDB'%5D = %7B'host':'127.0.0.1', 'port':9200%7D
%0A%0Aconfig
|
ae2a3716556b6c689d46e52544f7c98f2dfa0a69 | Remove language property from Context resource template | serrano/resources/templates.py | serrano/resources/templates.py | Category = {
'fields': [':pk', 'name', 'order', 'parent_id'],
'allow_missing': True,
}
BriefField = {
'fields': [':pk', 'name', 'description'],
'allow_missing': True,
}
Field = {
'fields': [
':pk', 'name', 'plural_name', 'description', 'keywords',
'app_name', 'model_name', 'field_n... | Python | 0 | @@ -1266,53 +1266,8 @@
= %7B%0A
- 'fields': %5B':pk', ':local', 'language'%5D,%0A
|
587fb49b985093a331ad9751e9960b38d659074f | Add field status | src/cid/core/tasks/models.py | src/cid/core/tasks/models.py | # -*- encoding: utf-8 -*-
"""
@authors: Andrés Felipe Calderón andres.calderon@correlibre.org
Sebastián Ortiz V. neoecos@gmail.com
@license: GNU AFFERO GENERAL PUBLIC LICENSE
SIIM Models are the data definition of SIIM2 Framework
Copyright (C) 2013 Infometrika Ltda.
This program is free software: you ... | Python | 0.000001 | @@ -1767,16 +1767,46 @@
operty()
+%0A status = StringProperty()
%0A%0A de
|
e3ce2a4ea02a309693f32c4692577bc5b6df5026 | Use inplace add | blaze/utils.py | blaze/utils.py | from __future__ import absolute_import, division, print_function
import os
import datetime
from functools import wraps
try:
from cytoolz import nth
except ImportError:
from toolz import nth
from itertools import islice
from collections import Iterator
from multiprocessing.pool import ThreadPool
# these are ... | Python | 0 | @@ -3824,13 +3824,10 @@
s
-= s
+
+=
'Z'
|
b641664e850085130bb39ed37908360ba60b685d | Fix unknownCommand args. | memcache/binary.py | memcache/binary.py | """Memcached binary protocol implementation."""
import sys
import struct
from collections import deque
from twisted.internet import defer
from twisted.protocols import stateful
from twisted.python import log
from constants import *
__all__ = ['BinaryServerProtocol',
'MemcachedUnknownCommand',
... | Python | 0.000001 | @@ -3342,14 +3342,8 @@
data
-, prot
):%0A
|
e35058670e1a16b5faa889e114bae7c2a6c8c003 | Remove pdb | child_sync_gp/model/child.py | child_sync_gp/model/child.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file _... | Python | 0.000004 | @@ -661,20 +661,8 @@
64%0D%0A
-import pdb%0D%0A
%0D%0A%0D%0A
@@ -790,33 +790,8 @@
):%0D%0A
- pdb.set_trace()%0D%0A
@@ -1162,33 +1162,8 @@
%22%22%0D%0A
- pdb.set_trace()%0D%0A
|
ca994899c91d5f0066c02d40ba220e9bfad75593 | Fix typo in kyrgyz translation | config/i18n.py | config/i18n.py | locales = {
'-': {
'message_choose_language': 'Тилди таңдаңыз. Выберите язык\n\n'
' 1️⃣ Кыргызча\n'
' 2️⃣ Русский'
},
'ky': {
'stop': 'стоп',
'help': 'жардам',
'start': 'старт',
'search': ['издөө',... | Python | 0.999881 | @@ -60,17 +60,17 @@
%D0%A2%D0%B8%D0%BB%D0%B4%D0%B8 %D1%82%D0%B0
-%D2%A3
+%D0%BD
%D0%B4%D0%B0%D2%A3%D1%8B%D0%B7. %D0%92
|
74efc1097e9143eed5035bc9d3d8bfd2a48c04fe | create also intermeditate dirs when creating tempdir | atest/run_atests.py | atest/run_atests.py | #!/usr/bin/env python
"""A script for running Robot Framework's acceptance tests.
Usage: run_atests.py interpreter [options] datasource(s)
Data sources are paths to directories or files under `robot` folder.
Available options are the same that can be used with Robot Framework.
See its help (e.g. `pybot --help`) fo... | Python | 0 | @@ -3228,12 +3228,15 @@
os.m
-k
+ake
dir
+s
(tem
|
d13353eac11e03aa3d3d83d49058b05ceb64e626 | Update version.py | mirdata/version.py | mirdata/version.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Version info"""
# version = '0.1.0'
` | Python | 0.000001 | @@ -82,5 +82,4 @@
.0'%0A
-%60
|
42b6e51df4377e933e6ee24b12a5d83d42a655da | Add missing packages to backend | backend/setup.py | backend/setup.py | from setuptools import setup, find_packages
setup(
name="maguire",
version="0.1",
url='https://github.com/picsadotcom/maguire',
license='BSD',
author='Picsa',
author_email='admin@picsa.com',
packages=find_packages(),
include_package_data=True,
install_requires=[
'Django',
... | Python | 0.000001 | @@ -883,24 +883,75 @@
'opbeat',%0A
+ 'postmarker',%0A 'django-extensions',%0A
%5D,%0A c
|
a034cb1d8031cd1b4c037c28db208210b8af49b1 | Set wtimeout | avery/controller.py | avery/controller.py | import sys
from datetime import datetime, timedelta
from uuid import uuid4
import pymongo
from .api import (
Job, IJobController, IWorkerController,
RetriableError, ConcurrencyError
)
__all__ = ['Controller']
class Controller(IJobController, IWorkerController):
HEARTBEAT_TIMEOUT = timedelta(minutes=1... | Python | 0.000001 | @@ -726,24 +726,61 @@
'majority',%0A
+ 'wtimeout': 20000,%0A
|
43b0bd441f4b91357cb4895eb59a394eaf2feef0 | Add __version__ | bart/__init__.py | bart/__init__.py | # Copyright 2015-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | Python | 0.000018 | @@ -667,8 +667,171 @@
thermal%0A
+import pkg_resources%0A%0Atry:%0A __version__ = pkg_resources.get_distribution(%22trappy%22).version%0Aexcept pkg_resources.DistributionNotFound:%0A __version__ = %22local%22%0A
|
da963d591bf62c8939659f9033554e1f09a4549a | Return response to 'playlist' command | src/smsBroker.py | src/smsBroker.py | __author__ = 'georgevanburgh'
from databaseAccess import *
import redisBroker
import spotipy
from redisBroker import RedisBroker
from twilioBroker import TwilioBroker
class SmsBroker():
def __init__(self):
self.mySpotipy = spotipy.Spotify()
self.twilioBroker = TwilioBroker()
self.redisBro... | Python | 0.019875 | @@ -1833,13 +1833,14 @@
-print
+return
toT
|
50fb76ea5fe481abce5d7e9d1923cb7b08280df6 | Move to base.HTTPStatsPlugin | newrelic_plugin_agent/plugins/nginx.py | newrelic_plugin_agent/plugins/nginx.py | """
Nginx Support
"""
import logging
import re
import requests
import time
from newrelic_plugin_agent.plugins import base
LOGGER = logging.getLogger(__name__)
PATTERN = re.compile(r'^Active connections\:\s(?P<connections>\d+)\s+\n'
r'server accepts handled requests\n\s+(?P<accepts>\d+)'
... | Python | 0 | @@ -44,36 +44,8 @@
t re
-%0Aimport requests%0Aimport time
%0A%0Afr
@@ -511,17 +511,65 @@
ase.
-Plugin):%0A
+HTTPStatsPlugin):%0A%0A DEFAULT_PATH = 'nginx_stub_status'
%0A
@@ -1328,32 +1328,73 @@
nt%0A%0A %22%22%22%0A
+ if not stats:%0A return%0A
matches
@@ -1831,1677 +1831,... |
829ab04958bbc7e2ee9ebac60e056a97b9319542 | add equals to LazyContract | lazycontract/contract.py | lazycontract/contract.py | from __future__ import absolute_import
import re
import six
IDENTIFIER_RE = re.compile(r'[A-Za-z_][A-Za-z0-9_]*\Z')
class LazyContractError(Exception):
''' Catch-all exception type '''
pass
class LazyContractDeserializationError(LazyContractError):
''' Exception deserializing a message into a LazyCo... | Python | 0.000194 | @@ -6280,24 +6280,389 @@
elf, name)%0A%0A
+ def __eq__(self, other):%0A if isinstance(other, self.__class__):%0A property_pairs = zip(self.__iter_properties(), other.__iter_properties())%0A checks = map(lambda x: x%5B0%5D == x%5B1%5D, property_pairs)%0A return all(checks)%0A ... |
98f7b5df3286503ab082f85b242f8282f9783b66 | Add refresh token for Strava | social_core/backends/strava.py | social_core/backends/strava.py | """
Strava OAuth2 backend, docs at:
https://python-social-auth.readthedocs.io/en/latest/backends/strava.html
"""
from .oauth import BaseOAuth2
class StravaOAuth(BaseOAuth2):
name = 'strava'
AUTHORIZATION_URL = 'https://www.strava.com/oauth/authorize'
ACCESS_TOKEN_URL = 'https://www.strava.com/oauth/to... | Python | 0 | @@ -721,16 +721,103 @@
OR = ','
+%0A EXTRA_DATA = %5B%0A ('refresh_token'),%0A ('expires_in', 'expires'),%0A %5D
%0A%0A de
|
43092d9e1ef0da59304785fcd8de995cfe2b28f1 | Fix warning about memebership check (#503) | leapp/models/__init__.py | leapp/models/__init__.py | """ Leapp Models
These packages provide an interface describing a message payload data structure in the form of Models.
Together with the :py:mod:`leapp.models.fields`, package models are defined.
Example::
class Boom(Model):
topic = SomeTopic
reason = fields.String()
class Foobar(Model):
... | Python | 0 | @@ -3068,16 +3068,22 @@
).fields
+ or %7B%7D
%0A
|
3d1552677cbe0b3c91f71240b9685c55e04e72fa | Remove commented debugger | app/weather_parser.py | app/weather_parser.py | import forecastio
from config import FORECAST_API_KEY
class WeatherForecast:
def generate_forecast(self, latitude, longitude, frequency):
forecast = self.get_forecast_request(latitude, longitude)
# import pdb; pdb.set_trace();
if frequency == 'hourly':
return forecast.hourly()... | Python | 0 | @@ -208,47 +208,8 @@
de)%0A
- # import pdb; pdb.set_trace();%0A
|
54d02bb40dc84150c2e848eed4c32d4fd8cf0d91 | Set ssl verify flag for all operations | indico/modules/cephalopod/util.py | indico/modules/cephalopod/util.py | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | Python | 0 | @@ -975,16 +975,8 @@
port
- logger,
cep
@@ -991,16 +991,24 @@
settings
+, logger
%0Afrom in
@@ -2954,32 +2954,108 @@
timeout=TIMEOUT
+,%0A verify=(not Config.getInstance().getDebug())
)%0A try:%0A
@@ -4495,16 +4495,92 @@
=TIMEOUT
+,%0A verify=(n... |
1dc5c6f28551e517c935802d30736c8179c2a1b0 | Update unit tests. | applications/tests.py | applications/tests.py | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
from django.test import Client, TestCase
from mixer.backend.django import mixer
from unittest import skip
from accounts.utils import random_dp... | Python | 0 | @@ -1785,25 +1785,16 @@
view_get
-_redirect
(self):%0A
@@ -1843,31 +1843,10 @@
w re
+n
d
-irects unauthorised us
ers%0A
@@ -1869,622 +1869,41 @@
-self.client.logout()%0A self.client.login(email=self.customer.email, password='pass')%0A url = reverse('application_create')%0A resp = self.cl... |
bfdb12db55ef84a2640dea0790e91ae64c5c1a74 | Fix update multiple tables in sqlalchemy 1.2 | sqlalchemy_monetdb/compiler.py | sqlalchemy_monetdb/compiler.py | from sqlalchemy import types as sqltypes, schema, util
from sqlalchemy.sql import compiler
class MonetDDLCompiler(compiler.DDLCompiler):
def visit_create_sequence(self, create):
text = "CREATE SEQUENCE %s AS INTEGER" % \
self.preparer.format_sequence(create.element)
if create.elemen... | Python | 0.000004 | @@ -4128,8 +4128,316 @@
'%5C%5C%5C%5C')%0A
+%0A def update_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw):%0A return %22FROM %22 + ', '.join(t._compiler_dispatch(self, asfrom=True,%0A fromhints=from_hints, **kw)%0A ... |
7461b3eaaa357930cf2b5868e997419208b5a04c | Remove obsolete TODO comment | indico/modules/users/blueprint.py | indico/modules/users/blueprint.py | # This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | Python | 0 | @@ -1330,34 +1330,8 @@
nt%0A%0A
-# TODO: remove -new later%0A
user
|
28641af99437ba9f027bc8297b383068c71aa549 | add support to Django 1.6 | memcache_toolbar/panels/__init__.py | memcache_toolbar/panels/__init__.py | # work around modules with the same name
from __future__ import absolute_import
from datetime import datetime
from debug_toolbar.panels import Panel
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from os.path import dirname, ... | Python | 0 | @@ -2756,32 +2756,46 @@
stance.reset()%0A%0A
+ @property%0A
def nav_titl
@@ -2829,24 +2829,38 @@
Memcache')%0A%0A
+ @property%0A
def nav_
@@ -3139,16 +3139,30 @@
calls%22%0A%0A
+ @property%0A
def
@@ -3206,24 +3206,38 @@
he Calls')%0A%0A
+ @property%0A
def url(
@@ -3262,16 +3262,124 ... |
dbe7aea203d35fbc60b916ae5ec9e8394936dc17 | Simplify conditional statement | haproxytool/utils.py | haproxytool/utils.py | # -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Created by: Pavlos Parissis <pavlos.parissis@gmail.com>
#
from six.moves import input
def get_arg_option(args):
for key, value in args.items():
if (key != '--force' and key.startswith('--') and
isinstance(value, bool) and value):
ret... | Python | 0.999978 | @@ -590,18 +590,22 @@
g))%0A
-if
+return
user_in
@@ -618,60 +618,8 @@
'y'
-:%0A return True%0A else:%0A return False
%0A%0A%0Ad
|
45f7cf2fde0f3f43890cbaf7d8affb1b6a652676 | Mark as xfail ASDF skycoord tests with velocities | astropy/io/misc/asdf/tags/coordinates/tests/test_skycoord.py | astropy/io/misc/asdf/tags/coordinates/tests/test_skycoord.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import SkyCoord, ICRS, Galactic, FK4, FK5, Longitude
asdf = pytest.importorskip('asdf')
from asdf.tests.helpers import assert_roundtrip_tre... | Python | 0.000002 | @@ -2413,32 +2413,104 @@
tree, tmpdir)%0A%0A%0A
+@pytest.mark.xfail(reason='Velocities are not properly serialized yet')%0A
def test_skycoor
@@ -2667,32 +2667,104 @@
tree, tmpdir)%0A%0A%0A
+@pytest.mark.xfail(reason='Velocities are not properly serialized yet')%0A
def test_skycoor
|
3be0bc09f0ea1f5f86fadd17b8c3460849418c66 | Fix incorrect import in hardware | hardware/hardware.py | hardware/hardware.py | import RPi.GPIO as GPIO
from .ihardware import IHardware
from color import Color
'''
The Hardware class is set up to be used in a with statement
'''
class Hardware(IHardware):
def __init__(
self,
red_pin: int = 14,
green_pin: int = 15,
blue_pin: int = 18,
motor_pin: int = 2
... | Python | 0.020518 | @@ -55,16 +55,23 @@
re%0Afrom
+colors.
color im
|
0591ae3b2afa8d4886d5d14bc6b4a0111f6bcf2a | Fix a potential race when update an existing key in etcd | dragonflow/db/drivers/etcd_db_driver.py | dragonflow/db/drivers/etcd_db_driver.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
# d... | Python | 0.000012 | @@ -1404,32 +1404,49 @@
e, key, value):%0A
+ try:%0A
# Verify
@@ -1474,90 +1474,265 @@
-self.get_key(table, key)%0A%0A self.client.write('/' + table + '/' + key, value
+ result = self.client.read('/' + table + '/' + key)%0A # Atomically update the key%0A result... |
defe3a3241bfcd702d9c2905884dda674064724a | Fix system property environment dict in setup_handler. | lwr/lwr_client/setup_handler.py | lwr/lwr_client/setup_handler.py | import os
from .util import filter_destination_params
REMOTE_SYSTEM_PROPERTY_PREFIX = "remote_property_"
def build(client, destination_args):
""" Build a SetupHandler object for client from destination parameters.
"""
# Have defined a remote job directory, lets do the setup locally.
if client.job_dir... | Python | 0 | @@ -1244,16 +1244,22 @@
ies%5B%22sep
+arator
%22%5D = cli
|
5e9096272265809c994ea136e2ba58bde87ad5b3 | use version_int for the proper version behavior (bug 689848) | apps/addons/search.py | apps/addons/search.py | import logging
from operator import attrgetter
from django.conf import settings
import elasticutils
import pyes.exceptions as pyes
import amo
from .models import Addon
from bandwagon.models import Collection
from compat.models import AppCompat
from users.models import UserProfile
log = logging.getLogger('z.es')
... | Python | 0 | @@ -277,16 +277,56 @@
Profile%0A
+from versions.models import version_int%0A
%0A%0Alog =
@@ -1697,12 +1697,27 @@
0,
+version_int('
9999
+')
%0A
|
5906bc6051532cf3d7d397655b097391f9d43d96 | Add get_ports_for_mac_addreses to FakeRPC | test/functional/neutronless/testlib/fake_rpc.py | test/functional/neutronless/testlib/fake_rpc.py | # coding=utf-8
# Copyright 2016 F5 Networks 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 ag... | Python | 0.000001 | @@ -3090,16 +3090,104 @@
ice_id%0A%0A
+ def get_ports_for_mac_addresses(self, mac_addresses=list()):%0A return list()%0A%0A
@tra
|
6bf7a242078e03486abde2e8b1acdd4e4596bcb6 | Fix in readarrcfg() for case when the cfg file only has one row and np.loadtxt returns a 0-d (scalar) array. This func should always return a 1-d array for each field. | dreambeam/telescopes/geometry_ingest.py | dreambeam/telescopes/geometry_ingest.py | """This package retrieves the metadata for a telescope, such as position,
alignment and bands.
The metadata for a telescope should be in the folder '<telescope>/share/'.
Subfolders should be 'simmos' (for array configurations of stations) and
'alignment' for station rotation.
"""
import os
import numpy as np
CASA_CFG... | Python | 0 | @@ -980,16 +980,182 @@
k=True)%0A
+ if name.ndim == 0:%0A x, y, z, diam, name = (np.array(%5Bx%5D), np.array(%5By%5D), np.array(%5Bz%5D),%0A np.array(%5Bdiam%5D), np.array(%5Bname%5D))%0A
retu
|
04a6a59530034904baf33752e204912e59d64ed4 | Increase log level of workers | dallinger/heroku/worker.py | dallinger/heroku/worker.py | """Heroku web worker."""
import os
import redis
listen = ['high', 'default', 'low']
redis_url = os.getenv('REDIS_URL', 'redis://localhost:6379')
conn = redis.from_url(redis_url)
if __name__ == '__main__': # pragma: nocover
# Make sure gevent patches are applied early.
import gevent.monkey
gevent.monke... | Python | 0.000002 | @@ -966,12 +966,13 @@
ing.
-INFO
+DEBUG
)%0A%0A
|
b7240a08e1b3f8a058a6ed34b2e6ba3ea5cfe6af | Fix error message for prefix validation, allow tuple values | hc2002/validation.py | hc2002/validation.py | class Context:
def __init__(self):
self.scope = []
self.errors = []
def current_scope(self):
return ''.join(self.scope)
def push_scope(self, scope):
self.scope.append(scope)
def pop_scope(self):
self.scope.pop()
def error(self, message, value):
self.... | Python | 0.000002 | @@ -3663,25 +3663,16 @@
.error('
-Expected
prefix %25
@@ -3676,22 +3676,27 @@
x %25s' %25
+str(
prefix
+)
, data)%0A
|
f6620e768e2325edd657369c6cf575a496753fa4 | Fix some deprecation warning in losses.py. | losses.py | losses.py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python | 0.000014 | @@ -1833,24 +1833,29 @@
labels * tf.
+math.
log(predicti
@@ -1902,24 +1902,29 @@
abels) * tf.
+math.
log(1 - pred
|
9f3236eadc4960fbea43fcf5a657a3233d299bac | fix 938670 - boost documents zones in the search results. | apps/search/models.py | apps/search/models.py | # -*- coding: utf-8 -*-
import operator
from django.conf import settings
from django.db import models
from django.utils.html import strip_tags
from elasticutils.contrib.django import Indexable
from taggit.managers import (TaggableManager, _TaggableManager,
GenericTaggedItemBase)
from sumo... | Python | 0 | @@ -6525,39 +6525,112 @@
-# let's boost the main sections
+if obj.zones.exists():%0A # boost all documents that are a zone%0A doc%5B'_boost'%5D = 8.0
%0A
@@ -6630,24 +6630,26 @@
8.0%0A
+el
if obj.slug.
@@ -6665,16 +6665,78 @@
) == 1:%0A
+ # a little boost if no zone... |
4215a155a6f0be6273a47b1208960a34d801cec6 | fix quote_plus import | ckanext/officedocs/plugin.py | ckanext/officedocs/plugin.py | from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import ckan.lib.helpers as h
import ckan.plugins as p
import ckan.plugins.toolkit as toolkit
from urllib import quote_plus
class OfficeDocsPlugin(p.SingletonPlugin):
p.implements(p.IConfigurer)
p.i... | Python | 0 | @@ -208,14 +208,30 @@
rom
-urllib
+six.moves.urllib.parse
imp
|
dde1a9f835e29b7bd1d551f113e376af1f69e496 | Fix prompt import handling in reindex library. | cms/djangoapps/contentstore/management/commands/reindex_library.py | cms/djangoapps/contentstore/management/commands/reindex_library.py | """ Management command to update libraries' search index """
from django.core.management import BaseCommand, CommandError
from optparse import make_option
from textwrap import dedent
from contentstore.courseware_index import LibrarySearchIndexer
from opaque_keys.edx.keys import CourseKey
from opaque_keys import Inval... | Python | 0 | @@ -443,16 +443,20 @@
r%0A%0Afrom
+util
.prompt
|
e174ff670bcfd8b186d0f63b426f201d6c7d3bd7 | Make links to issues and pull request absolute instead of relative | loghub.py | loghub.py | # -*- coding: utf-8 -*-
#
# Copyright (c) The Spyder Development Team
# Licensed under the terms of the MIT License
"""
Build a list of issues and pull requests per Github milestone
NOTE: This script works with githupy, not with PyGithub!
"""
# Std imports
import argparse
import sys
# Local imports
import github
... | Python | 0 | @@ -2758,21 +2758,37 @@
sue %25d%5D(
-../..
+https://github.com/%25s
/issues/
@@ -2794,32 +2794,198 @@
/%25d)%22 %25 (number,
+%0A options.repo,%0A
number)%0A ... |
ca8f5d2e7e0e08ab3788d84907ae9470b3ceb22a | Add a QUEST_REWARDS map | hearthstone/utils.py | hearthstone/utils.py | try:
from lxml import etree as ElementTree # noqa
except ImportError:
from xml.etree import ElementTree # noqa
from .enums import CardClass, Rarity
CARDCLASS_HERO_MAP = {
CardClass.DRUID: "HERO_06",
CardClass.HUNTER: "HERO_05",
CardClass.MAGE: "HERO_08",
CardClass.PALADIN: "HERO_04",
CardClass.PRIEST: "HERO_... | Python | 0 | @@ -705,12 +705,277 @@
0, 1600),%0A%7D%0A
+%0A%0A# QuestController.cs%0AQUEST_REWARDS = %7B%0A%09%22UNG_940%22: %22UNG_940t8%22,%0A%09%22UNG_954%22: %22UNG_954t1%22,%0A%09%22UNG_934%22: %22UNG_934t1%22,%0A%09%22UNG_829%22: %22UNG_829t1%22,%0A%09%22UNG_028%22: %22UNG_028t%22,%0A%09%22UNG_067%22: %22UNG_067t1%22,%0A%09%... |
a49cc3f1bd7d0d4196db8378ab1a1a24a919c0dd | exclude unrelated completions see https://github.com/Microsoft/vscode/blob/master/extensions/typescript/src/features/completionItemProvider.ts#L217-L219 | typescript/listeners/completion.py | typescript/listeners/completion.py | import sublime
from ..libs.view_helpers import *
from ..libs.text_helpers import *
from .event_hub import EventHub
class CompletionEventListener:
def __init__(self):
self.completions_ready = False
self.completions_loc = None
# Used to check if the completion is out of date
self.c... | Python | 0.000005 | @@ -6417,32 +6417,169 @@
aw_completions:%0A
+ # strip unrelated items%0A if raw_completion%5B%22kind%22%5D == %22warning%22:%0A continue%0A
@@ -7793,28 +7793,29 @@
post_text_command_with_info)
+%0A
|
1aee5fee2a60f69603840546531ac0d9bbaa26b7 | Fix the purchase order line 'name' null issue | metro_purchase/wizard/pur_req_po.py | metro_purchase/wizard/pur_req_po.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Python | 0.999854 | @@ -5741,16 +5741,17 @@
'name':
+(
line.req
@@ -5757,16 +5757,23 @@
q_reason
+ or '')
%7D%0A
|
2bf6d37599ce59e04916cc9c0d1fff348c33ac8e | Add time display to note mod | modules/notemod.py | modules/notemod.py | """Handles user notes
@package ppbot
@syntax tell <user> <note>
@syntax showtells
"""
from datetime import datetime
from modules import *
class Notemod(Module):
def __init__(self, *args, **kwargs):
"""Constructor"""
Module.__init__(self, kwargs=kwargs)
def _register_events(self):
s... | Python | 0 | @@ -109,16 +109,65 @@
datetime
+%0Afrom dateutil.relativedelta import relativedelta
%0A%0Afrom m
@@ -1171,16 +1171,81 @@
notes:%0A
+ rd = relativedelta(datetime.now(), note%5B'time'%5D)%0A
@@ -1287,34 +1287,32 @@
'%25s
-told you some time
+said to you %25s
ago:
+%22
%25s
+%22
' %25
... |
7b2b1f6efa5775483bc32edd6bf0fd6281ef0974 | Update mecanumjoystick.py | mecanumbot/mecanumjoystick.py | mecanumbot/mecanumjoystick.py | from gpiozero import Motor
import time
import math
# Motors P+ N-
# FL 4 17
# FR 27 22
# BL 23 24
# BR 26 19
motorFL = Motor( 4, 17, pwm=True)
motorFR = Motor(27, 22, pwm=True)
motorBL = Motor(23, 24, pwm=True)
motorBR = Motor(26, 19, pwm=True)
while True:
spd = math.sin(time.time())
motorFL.value = spd
motor... | Python | 0 | @@ -1,8 +1,33 @@
+import time%0Aimport math%0A%0A
from gpi
@@ -48,32 +48,8 @@
otor
-%0Aimport time%0Aimport math
%0A%0A#%09
@@ -83,20 +83,20 @@
R%09%092
-7%0922
+3%0924
%0A#%09BL%09%092
3%0924
@@ -91,20 +91,20 @@
%0A#%09BL%09%092
-3%0924
+7%0922
%0A#%09BR%09%092
@@ -164,13 +164,13 @@
or(2
-7, 22
+3, 24
, pw
@... |
a9495f72257a3d371dfe00721e49ba39a4d8f8a5 | update plot when battery monitor window is visible | biapplet/indicator.py | biapplet/indicator.py | #!/usr/bin/python
import os # temp
import ui
import log
import osdata
import resource
from gi.repository import Gtk as gtk
from gi.repository import GObject as gobject
from gi.repository import AppIndicator3 as appindicator
APPINDICATOR_ID = 'batteryindicator'
CATEGORY = appindicator.IndicatorCategory.SYSTEM_SERVIC... | Python | 0 | @@ -1300,16 +1300,43 @@
_menu())
+%0A self.window = None
%0A%0A
@@ -3169,24 +3169,176 @@
set_label()%0A
+ if self.window and self.window.props.visible:%0A filepath = os.path.abspath('test.svg')%0A self.image.set_from_file(filepath)%0A
retu
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.