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 |
|---|---|---|---|---|---|---|---|
a95d0eb181adc23f24bab6cb4848098df9e505c3 | Fix insufficent access error, closes #347 | plugins/npr/pocky.py | plugins/npr/pocky.py | import copytext
import datetime
from oauth import get_document
import os
import pytz
import re
from sets import Set
import app_config
from util.models import Story
from plugins.base import CarebotPlugin
from plugins.npr.linger import NPRLingerRate
from util.analytics import GoogleAnalytics
POCKY_TRACKER = os.environ... | Python | 0 | @@ -544,16 +544,33 @@
wargs):%0A
+ try:%0A
@@ -616,16 +616,20 @@
+
spreadsh
@@ -651,32 +651,36 @@
Copy(DATA_PATH)%0A
+
self.dat
@@ -712,16 +712,58 @@
eviews'%5D
+%0A except KeyError:%0A pass
%0A%0A
@@ -4030,16 +4030,62 @@
%22%22%22%0A%0A
+... |
7e5445e4667f858eb585db2a0b5f1bfd7fbd4cac | Make default password in kubeman pass the regex | build/tools/kubeman.py | build/tools/kubeman.py | #!/usr/bin/env python
import argparse
import os
import sys
import time
from datetime import datetime
from pymongo import MongoClient
def add_oauth_settings(arguments):
database = MongoClient(arguments.connection_url).elastickube
settings = database.Settings.find_one({"deleted": None})
settings["authentic... | Python | 0.000004 | @@ -4487,16 +4487,19 @@
stickube
+123
',%0A
|
f081cddddc4bc92775afb152aba22b2b5245a164 | fix errors reported by http://validator.w3.org/ | ht2html.py | ht2html.py | #!/usr/bin/python
import sys
if len(sys.argv) < 2:
exit
pageset = sys.argv[1].split()
source = sys.argv[2]
basename = source.split('.')[0]
fout = open(basename + '.html', 'w')
fout.write('''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
This is a generated document. Please edit "''' + ... | Python | 0 | @@ -577,17 +577,17 @@
Tools%3C/h
-1
+2
%3E%0A%3Cp%3E%0A%3Ch
|
bca7f2d3d7a4dc7602641875d66e9cbbdbb815bb | print tests | Login.py | Login.py |
import gmail
import time
import datetime
import DBAccessor
from gmail import Gmail
#Filter emails that are only payment emails
def filterPayments(emails):
i = 0
filtered = []
while i < len(emails):
emails[i].fetch()
if "paid" in emails[i].subject:
filtered.append(emails[i])
... | Python | 0.000001 | @@ -1309,16 +1309,36 @@
ewMail)%0A
+ print %22filtered%22
%0A #Ca
@@ -1821,16 +1821,43 @@
in IDs:%0A
+ print %22Test 1%22%0A
@@ -1901,16 +1901,16 @@
KE Keg %0A
-
@@ -1988,17 +1988,47 @@
ent)+1:%0A
+ print %22Test 2%22
%0A
-
@@ -2186,32 +2186,64 @@
ent... |
80b24feaf36e9116000d3030d60ce2e5bef56076 | Allow putting callables into SearchForm.default | towel/forms.py | towel/forms.py | import pickle
from django import forms
from django.db import models
from django.forms.util import flatatt
from django.utils import simplejson
from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
class BatchForm(forms.For... | Python | 0 | @@ -1971,16 +1971,95 @@
n data:%0A
+ if hasattr(v, '__call__'):%0A v = v(request)%0A%0A
|
564949be2ba3a8f28204a9645f7cdc0db947dfa3 | write error file | lib/QC/fastq_len.py | lib/QC/fastq_len.py | import argparse
import sys
import logging
import os
import gzip
from asyncore import read
parser = argparse.ArgumentParser(description="Get length distribution in FASTQ file.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
DEBUG=False
NOT_DEBUG=not DEBUG
parser... | Python | 0.000002 | @@ -1058,16 +1058,112 @@
)s')%0D%0A%0D%0A
+error_file = args.output + %22.error%22%0D%0Aif os.path.exists(error_file):%0D%0A os.remove(error_file)%0D%0A%0D%0A
fastq_fi
@@ -1389,16 +1389,30 @@
True:%0D%0A
+ try:%0D%0A
qu
@@ -1443,123 +1443,551 @@
-if not query:%0D%0A break%0D%0A if n... |
5f67a0c15f1bdc8963a46e1df0acb0e0aea6b884 | Update tproxy/util.py | tproxy/util.py | tproxy/util.py | # -*- coding: utf-8 -
#
# This file is part of tproxy released under the MIT license.
# See the NOTICE for more information.
try:
import ctypes
except MemoryError:
# selinux execmem denial
# https://bugzilla.redhat.com/show_bug.cgi?id=488396
ctypes = None
except ImportError:
# Python on Solaris c... | Python | 0 | @@ -444,16 +444,141 @@
socket%0A%0A
+# add support for gevent 1.0%0Afrom gevent import version_info%0Aif version_info%5B0%5D %3E0:%0A from gevent.os import fork%0Aelse:%0A
from gev
@@ -597,16 +597,21 @@
rt fork%0A
+ %0A
try:%0A
|
590e27f30cb58da535b8cd6bc0e9e48011409a18 | Add reference to actual bug | feature-extensions/apigee/terraformBugWorkaround.py | feature-extensions/apigee/terraformBugWorkaround.py | import json
import subprocess
terraformNewGatewayRoleOutput = "apigee-lambda-gateway-role-arn"
terraformPreviousRoleOutput = "previous-role-arn"
# Replaces function's role with one created by Terraform
def linkNewRoleToExistingFunctionWithCLI(functionName):
updateFunctionRole(functionName, getRoleArnFromTerrafo... | Python | 0.000004 | @@ -24,16 +24,155 @@
rocess%0A%0A
+# Exists because of:%0A# https://github.com/terraform-providers/terraform-provider-aws/issues/5742%0A# and can be nuked if that is ever fixed.%0A
%0Aterrafo
|
fd237a2208c419ade371640f947dcc9c70af344c | add get parameters function | Modules/FileProcess.py | Modules/FileProcess.py | import subprocess
def remove(files):
"""
this function can remove files provided
"""
if isinstance(files,str):
subprocess.call('rm {file}'.format(file=files),shell=True)
if isinstance(files,list):
cmd = ''
for f in files:
cmd = cmd + 'rm {file} & '.format(file=f)
... | Python | 0.000003 | @@ -347,9 +347,9 @@
d%5B:-
-2
+3
%5D,sh
@@ -363,16 +363,684 @@
e)%0A %0A
-
+%0Adef get_parameters(parFile):%0A %22%22%22%0A This function list all parameters for all pipelines.%0A And return a dictionary%0A %22%22%22%0A res = open(parFile)%0A dic = %7B%7D%0A for line in res:%0A ... |
31088de8075092f0214b585d28fba497c6efef0c | modify return | federatedml/protobuf/model_migrate/model_migrate.py | federatedml/protobuf/model_migrate/model_migrate.py | from typing import List
from federatedml.protobuf.model_migrate.converter_factory import converter_factory
import copy
def generate_id_mapping(old_id, new_id):
if old_id is None and new_id is None:
return {}
elif not (type(old_id) == list and type(new_id) == list):
raise ValueError('illegal i... | Python | 0.000028 | @@ -1528,26 +1528,30 @@
return
-None, None
+model_contents
%0A%0A #
|
f2cd0813a6a8d2190793cc871c4023880f81ce85 | Remove banner from gist and move to description | gistie.py | gistie.py | #!/usr/bin/python3
__description__ = """
Gistie - A tiny script to generate quick pasties from terminal stdout
and stdin output.
Requires requests module, and xclip (optional).
"""
__author__ = "Vivek Rai"
__date__ = "18th July, 2014"
import requests
import json
import getpass
import sys
import ar... | Python | 0 | @@ -387,15 +387,8 @@
= '
-%5Cn---%5Cn
Gene
@@ -406,19 +406,17 @@
stie (gh
-://
+@
vivekiit
@@ -1880,34 +1880,14 @@
n':
-read_data%5B0%5D%5B:20%5D + ' ...'
+BANNER
,%0A
@@ -1977,17 +1977,8 @@
t':
-''.join(%5B
data
@@ -1991,18 +1991,8 @@
ring
-, BANNER%5D)
%0A
|
89c3431a43d4026060711ed81e9fef1462043257 | Return payment profile | transaction.py | transaction.py | # -*- coding: utf-8 -*-
'''
Payment Gateway Transaction
:copyright: (c) 2013 by Openlabs Technologies & Consulting (P) Ltd.
:license: BSD, see LICENSE for more details
'''
from authorize import AuthorizeClient, CreditCard, Address, \
AuthorizeResponseError
from authorize.client import AuthorizeCredit... | Python | 0.000001 | @@ -8361,24 +8361,31 @@
e()%0A
+return
self.create_
@@ -8412,26 +8412,4 @@
id)%0A
-%0A return 'end'%0A
|
d7a0b9b52739b56559fbbfefae04dce1d8ecc4f4 | use context manager on urlopen | src/zugbruecke/core/wineenv.py | src/zugbruecke/core/wineenv.py | # -*- coding: utf-8 -*-
"""
ZUGBRUECKE
Calling routines in Windows DLLs from Python scripts running on unixlike systems
https://github.com/pleiszenburg/zugbruecke
src/zugbruecke/core/wineenv.py: Setting up a Python environment in Wine
Required to run on platform / side: [UNIX]
Copyright (C) 2017-2019 Sebastian ... | Python | 0.000001 | @@ -1989,20 +1989,12 @@
ry%0A%09
-getpip_req =
+with
url
@@ -2052,17 +2052,24 @@
pip.py')
-%0A
+ as u:%0A%09
%09getpip_
@@ -2078,43 +2078,14 @@
n =
-getpip_req.read()%0A%09getpip_req.close
+u.read
()%0A%0A
|
dafe36b34db635b07ac46860a8c6ae743d39caff | Fix bytes decode bug | populus/contracts.py | populus/contracts.py | from ethereum import utils as ethereum_utils
from ethereum import abi
class BoundFunction(object):
def __init__(self, function, client, address):
self.function = function
self.client = client
self.address = address
def __str__(self):
return str(self.function)
def __call__... | Python | 0.000011 | @@ -1203,21 +1203,16 @@
in bytes
- if b
)%0A el
|
f431943bf8f94f8fe5229c8c55e9d341bb417015 | fix for issue #11 | poretools/formats.py | poretools/formats.py | class Fastq(object):
def __init__(self, s):
self.s = s
self.parse()
def parse(self):
(self.name, self.seq, self.sep, self.qual) = self.s.strip().split('\n')
def __repr__(self):
return '\n'.join([self.name, self.seq, self.sep, self.qual])
class Fasta(object):
def __init__(self, s):
self.s = s
self.pa... | Python | 0 | @@ -403,32 +403,68 @@
ip().split('%5Cn')
+%0A%09%09self.name = self.name.lstrip('@')
%0A%0A%09def __repr__(
|
b375f03b6ad068d3b061ee781fe99f6174400476 | Use generated instance identifier | stacker/blueprints/postgres.py | stacker/blueprints/postgres.py | from troposphere import Ref, ec2, Output, GetAtt, Join
from troposphere.rds import DBInstance, DBSubnetGroup
from .base import Blueprint
RDS_INSTANCE_NAME = "PostgresRDS%s"
RDS_SUBNET_GROUP = "%sSubnetGroup"
RDS_SG_NAME = "RdsSG%s"
class PostgresRDS(Blueprint):
PARAMETERS = {
'VpcId': {'type': 'AWS::EC2... | Python | 0.000001 | @@ -2700,56 +2700,8 @@
'),%0A
- DBInstanceIdentifier=self.name,%0A
|
f591fa8d337db4487d4485f943aef67c97e49b30 | Fix about.py | install-prefix/lib/the-simple-noteprogram/the_simple_noteprogram/about.py | install-prefix/lib/the-simple-noteprogram/the_simple_noteprogram/about.py | """An about dialog and information about this program"""
from gettext import gettext as _
# Information about authors, add your name here if you've helped with
# making this program but your name is not here yet
AUTHORS = ["Akuli"]
TRANSLATORS = {
_("Finnish"): "Akuli",
}
# General information
SHORT_DESCRIPTION =... | Python | 0.000044 | @@ -1040,31 +1040,33 @@
-DASHES,%0A
+'the-simple-noteprogram',
48,
@@ -1151,24 +1151,16 @@
48,
-%0A
48,%0A
|
2d92120b292f23bcd3c927e50d2be4bf27616722 | fix mistake in template tag | simple_open_graph/templatetags/simple_open_graph.py | simple_open_graph/templatetags/simple_open_graph.py | from django import template
from ..utils import string_to_dict
register = template.Library()
@register.tag
def opengraph_meta(parser, token):
try:
tag_name, properties = token.split_contents()
except ValueError:
raise template.TemplateSyntaxError(
"%r tag requires two arguments"... | Python | 0.000026 | @@ -847,21 +847,19 @@
key =
-value
+key
.replace
|
f2fd7fa693b5be7ae37445fc185611e80aacddf3 | Fix bug to actually find the sdk | pebble/PblBuildCommand.py | pebble/PblBuildCommand.py | import sh, os
from PblCommand import PblCommand
class PblBuildCommand(PblCommand):
name = 'build'
help = 'Build your Pebble project'
def configure_subparser(self, parser):
parser.add_argument('--sdk', help='Path to Pebble SDK (ie: ~/pebble-dev/PebbleSDK-2.X/)')
def run(self, args):
waf_path = os.path... | Python | 0 | @@ -676,29 +676,16 @@
ile__),
-os.path.join(
'..', '.
@@ -690,14 +690,7 @@
'..'
-, '..')
))%0A
|
09450c14e4d3cdfb645e1284eaf80350204a6f9e | fix warning | arrow/config.py | arrow/config.py | from __future__ import absolute_import
import os
import yaml
DEFAULT_CONFIG = {
}
def global_config_path():
config_path = os.environ.get(
"ARROW_GLOBAL_CONFIG_PATH",
"~/.apollo-arrow.yml"
)
config_path = os.path.expanduser(config_path)
return config_path
def read_global_config():
... | Python | 0.000004 | @@ -475,28 +475,8 @@
urn
-yaml.load(f, Loader=
yaml
@@ -485,10 +485,12 @@
afe_load
+(f
)%0A
|
32d58460c1d8ecdbb0f25eac3c08ad65f8509fc9 | Update typo. | artview/view.py | artview/view.py | """
==================================
Shell Launch (:mod:`artview.view`)
==================================
Utilities easily running ARTview from shell.
.. autosummary::
:toctree: generated/
view
start
execute
addRadar
addGrid
"""
import os
import platform
import pyart
from .core import V... | Python | 0 | @@ -3118,12 +3118,13 @@
return ismac
+%0A
|
ade326e47be07abb634c61632aa913b641780a59 | fix the field names in serializers | contentcuration/contentcuration/serializers.py | contentcuration/contentcuration/serializers.py | from contentcuration.models import * # TODO: Change this later?
from rest_framework import serializers
from rest_framework_bulk import BulkListSerializer, BulkSerializerMixin
class LicenseSerializer(serializers.ModelSerializer):
class Meta:
model = License
fields = ('license_name', 'exists', 'i... | Python | 0.000208 | @@ -922,16 +922,22 @@
elds = (
+'id',
'checksu
@@ -943,21 +943,8 @@
um',
- 'extension',
'fi
@@ -974,33 +974,56 @@
', '
-id', 'available', 'format
+contentmetadata', 'file_format', 'preset', 'lang
')%0A%0A
@@ -1174,16 +1174,22 @@
= Format
+Preset
%0A
|
c961b2bde6f5ca13888d2eeae2ba0bdaf8e494f9 | Fix homepage migration | coop_cms/migrations/0004_auto_20160620_1310.py | coop_cms/migrations/0004_auto_20160620_1310.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def set_homepage(apps, schema_editor):
# We can't import the Person model directly as it may be a newer
# version than this migration expects. We use the historical version.
site_class = apps.get_mode... | Python | 0.000001 | @@ -99,16 +99,60 @@
models%0A
+from django.core.urlresolvers import reverse
%0A%0Adef se
@@ -194,144 +194,51 @@
#
-We can't import the Person model directly as it may be a newer%0A # version than this migration expects. We use the historical version.
+Move from homepage_for_site to SiteSettings
%0A
@@ -39... |
a2caffadcc20cbceaa51f58cbd81cc85830d8d6a | Use os util to fetch mnist data location from example location | examples/machine_learning/mnist_common.py | examples/machine_learning/mnist_common.py | #!/usr/bin/python
#######################################################
# Copyright (c) 2019, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
###################################... | Python | 0 | @@ -336,16 +336,26 @@
######%0A%0A
+import os%0A
import s
@@ -1101,33 +1101,93 @@
-idims, idata
+root_path = os.path.dirname(os.path.abspath(__file__))%0A file_path
= r
-ead_idx('
+oot_path + '/
../.
@@ -1215,16 +1215,59 @@
a/mnist/
+'%0A idims, idata = read_idx(file_path + '
images-s
@@ -1306,42 +13... |
e8a28f4bda8092e8b8ad3ee8ee0bfaac200e3334 | Update plot_regress_continuous.py | examples/stats/plot_regress_continuous.py | examples/stats/plot_regress_continuous.py | """
=========================================
Regression on continuous data (rER[P/F])
=========================================
This demonstrates how rERPs/regressing the continuous data is a
generalisation of traditional averaging. If all preprocessing steps
are the same and if no overlap between epochs exists and if... | Python | 0.000002 | @@ -563,16 +563,17 @@
ictors.%0A
+%0A
Referenc
|
b3f9583047c93aa0c07529a53c1bec6ec3820196 | Make image.Image class abstract | atrope/image.py | atrope/image.py | # -*- coding: utf-8 -*-
# Copyright 2014 Alvaro Lopez Garcia
#
# 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 ... | Python | 0.999983 | @@ -598,16 +598,27 @@
cense.%0A%0A
+import abc%0A
import o
@@ -702,20 +702,308 @@
t):%0A
-pass
+__metaclass__ = abc.ABCMeta%0A%0A uri = sha512 = identifier = None%0A%0A @abc.abstractmethod%0A def __init__(self, image_info):%0A pass%0A%0A @abc.abstractmethod%0A def download(self, dest):%0A ... |
e35e5d7d3fd186c1d10b3bdc3bc72a4008fc3055 | binary output case | attacks/fgsm.py | attacks/fgsm.py | import tensorflow as tf
def fgsm(model, x, eps=0.01, epochs=1, clip_min=0., clip_max=1.):
"""
Fast gradient sign method.
See https://arxiv.org/abs/1412.6572 and https://arxiv.org/abs/1607.02533 for
details. This implements the revised version, since the original FGSM has
label leaking problem (h... | Python | 0.999997 | @@ -845,16 +845,25 @@
tf.cond(
+%0A
tf.equal
@@ -881,38 +881,35 @@
- lambda:
+lambda: tf.reshape(
tf.cast(
@@ -938,31 +938,24 @@
.int64),
+ %5B-1%5D),
%0A
-
@@ -1039,41 +1039,12 @@
lue=
-clip_max,%0A
+1.0,
off
@@ -1050,24 +1050,19 @@... |
173ec0e1488cc4697ec8ca949433d7f49a216344 | fix bug | auto_upgrade.py | auto_upgrade.py | #! /usr/local/bin/python3
# can not be used on windows due to line end difference.
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip3 install --upgrade --no-cache-dir" + dist.project_name, shell=True)
| Python | 0.000001 | @@ -210,16 +210,17 @@
ache-dir
+
%22 + dist
|
c3a12c87b70c6946285004b70102770a589a52fa | fix initialization order | hwtLib/structManipulators/cLinkedListWriter_test.py | hwtLib/structManipulators/cLinkedListWriter_test.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from hwt.simulator.simTestCase import SimpleSimTestCase
from hwtLib.abstract.denseMemory import DenseMemory
from hwtLib.structManipulators.cLinkedListWriter import CLinkedListWriter
from pycocotb.constants import CLK_PERIOD
class CLinkedListWriterTC(Sim... | Python | 0.000125 | @@ -413,59 +413,8 @@
er()
-%0A cls.MAX_LEN = cls.BUFFER_CAPACITY // 2 - 1
%0A%0A
@@ -591,16 +591,67 @@
ITY = 7%0A
+ cls.MAX_LEN = cls.BUFFER_CAPACITY // 2 - 1%0A
|
12a6d654541b11dae15c02205eab6e9f284404f6 | Update forms.py | avatar/forms.py | avatar/forms.py | import os
from django import forms
from django.forms import widgets
from django.utils.safestring import mark_safe
# Issue 182: six no longer included with Django 3.0
try:
from django.utils import six
except ImportError:
import six
from django.utils.translation import ugettext_lazy as _
from django.template.de... | Python | 0.000001 | @@ -271,17 +271,16 @@
import
-u
gettext_
|
3daa5f9b5ea1fe3e1516f2840987519b37007ab8 | Fix the reset of associations on content api | content_api/publish/service.py | content_api/publish/service.py | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... | Python | 0.000001 | @@ -5558,65 +5558,8 @@
():%0A
- if not assoc_item:%0A continue%0A%0A
|
548566b566dbd2fa054ca95754e036bfac58b262 | refactor sqlcreate script | daiquiri/core/management/commands/sqlcreate.py | daiquiri/core/management/commands/sqlcreate.py | import socket
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db.utils import OperationalError, ProgrammingError
from daiquiri.metadata.models import Database
class Command(BaseCommand):
requires_system_checks = False
can_import_settings = True
def get_... | Python | 0.001668 | @@ -97,214 +97,231 @@
and%0A
-from django.db.utils import OperationalError, ProgrammingError%0A%0Afrom daiquiri.metadata.models import Database%0A%0A%0Aclass Command(BaseCommand):%0A%0A requires_system_checks = False%0A can_import_settings = True
+%0A%0Aclass Command(BaseCommand):%0A%0A requires_system_checks... |
52205158375902936a1735faffbeea7d106f2f54 | support groupby | backend/main.py | backend/main.py | import collections
import urllib
import pandas
from flask import Flask, jsonify, request
app = Flask(__name__)
import logging
# From /scripts/logger.py
logger = logging.getLogger('log')
logger.setLevel(logging.DEBUG)
log_formatter = logging.Formatter('%(asctime)s - %(module)s - %(levelname)s - %(message)s',
... | Python | 0 | @@ -40,16 +40,29 @@
pandas%0A
+import numpy%0A
from fla
@@ -1224,16 +1224,142 @@
rn res%0A%0A
+def _project_dataframe(df, projectors):%0A data = %7B%7D%0A for p in projectors:%0A data%5Bp%5D = list(df%5Bp%5D)%0A return data%0A%0A
@app.rou
@@ -2897,17 +2897,22 @@
-groupby =
+#NOTE: Can not
p... |
9d401d7f68c3b145f73bd7ec029361e1e85d6483 | Fix import order | external_file_location/models/__init__.py | external_file_location/models/__init__.py | # -*- coding: utf-8 -*-
from . import attachment
from . import location
from . import task
| Python | 0.000002 | @@ -18,16 +18,35 @@
-8 -*-%0A%0A
+from . import task%0A
from . i
@@ -85,27 +85,8 @@
ocation%0A
-from . import task%0A
|
3309450ca3cc410626c98e7c599817c54f8d30b3 | Remove unused import | py3o/template/tests/test_templates.py | py3o/template/tests/test_templates.py | __author__ = 'faide'
import unittest
from py3o.template.main import move_siblings
from py3o.template.main import Template
import lxml.etree
import pkg_resources
from pyjon.utils import get_secure_filename
import zipfile
from io import BytesIO
import os
from lxml.etree import XMLSyntaxError
class TestTemplate(unittes... | Python | 0.000001 | @@ -35,53 +35,8 @@
est%0A
-from py3o.template.main import move_siblings%0A
from
|
d133913d11e5384eddc472bda63ca781d3adc532 | Handle basic ISBN | python/isbn-verifier/isbn_verifier.py | python/isbn-verifier/isbn_verifier.py | class IsbnVerifier(object):
def __init__(self, string):
self.string = string
def is_valid(self):
return True
def verify(isbn):
return IsbnVerifier(isbn).is_valid()
| Python | 0.000011 | @@ -120,19 +120,525 @@
-return True
+sum_so_far = 0%0A for i, c in enumerate(IsbnVerifier.remove_slashes(self.string)):%0A sum_so_far += IsbnVerifier.convert_char_to_int(c) * (10 - i)%0A return sum_so_far %25 11 == 0%0A%0A @staticmethod%0A def remove_slashes(string):%0A retur... |
7a116c18ae8d63a18d646aed899b3f21893501c6 | Update Python 2 deprecation error message | python/sparknlp/annotator/__init__.py | python/sparknlp/annotator/__init__.py | # Copyright 2017-2022 John Snow Labs
#
# 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... | Python | 0 | @@ -1789,134 +1789,136 @@
NLP
-for Python 2.x is deprecated since version %3E= 4.0. %22%0A %22Please use an older versions to use it with this Python version.
+only supports Python 3.6 and above. %22%0A %22Please use Python 3.6 or above that is compatible with both Spark NLP and PySpark
%22%0A
|
6bc75a70ec9f2247f71781d6ec27c4f10a8b058c | Update forms.py | badger/forms.py | badger/forms.py | import logging
import re
from django.conf import settings
from django import forms
from django.db import models
from django.contrib.auth.models import User, AnonymousUser
from django.forms import FileField, CharField, Textarea, ValidationError
from django.core.validators import validate_email
try:
from tower imp... | Python | 0.000001 | @@ -5199,16 +5199,48 @@
iption',
+'prerrequisites', 'group_badges'
)%0A
|
1ae8bacf21b4ac99a55864690ad2e150e8ad8638 | Make the current year be expanded in the archive box on all views that don't have a time specificness. | mesoblog/views.py | mesoblog/views.py | from django.contrib import messages
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404
from django.template import RequestContext
import calendar
import pytz
from mesoblog.models import Article, C... | Python | 0.000002 | @@ -262,16 +262,32 @@
alendar%0A
+import datetime%0A
import p
@@ -1109,16 +1109,56 @@
mbs': b,
+ 'year': str(datetime.date.today().year)
%7D)%0A r
@@ -3082,32 +3082,85 @@
readcrumbs': b,%0A
+ 'year': str(datetime.date.today().year),%0A
%7D)%0A retur
|
a5753a6665bcddf71a892f47bc393da322e21cce | Remove ugettext import | baton/config.py | baton/config.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.utils.html import mark_safe
from django.utils.translation import ugettext as _
default_config = {
'SITE_TITLE': 'Baton',
'SITE_HEADER': '<img src="%sbaton/img/logo.png" />' % settings.STATIC_URL,
'INDEX_TITLE': _('Site administration'),
... | Python | 0.000001 | @@ -127,17 +127,16 @@
import
-u
gettext
|
aa315a7ba1e22998cf9344042e073f1873a8e8f0 | Move minitest_gibbs.py magic number into parameters | minitest_gibbs.py | minitest_gibbs.py | #!/usr/bin/env python
# Check SEM's ability to stay in the neighborhood of the (label) truth
# when initialized at the (label) truth.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.mlab import PCA
from Network import Network
from Models import StationaryLogistic, NonstationaryLogistic, Blockmodel... | Python | 0.000001 | @@ -418,17 +418,29 @@
ers%0AN =
-3
+20%0Atheta = 3.
0%0Aalpha_
@@ -444,17 +444,17 @@
ha_sd =
-1
+2
.0%0Afrom_
@@ -1161,19 +1161,21 @@
%5B'x'%5D =
-3.0
+theta
%0Afor nam
@@ -1177,16 +1177,22 @@
r name,
+block_
theta in
@@ -1226,16 +1226,22 @@
+
+
('rr', 3
@@ -1241,24 +1241,30 @@
'rr', 3.0),... |
4b46e5163d0b03958d38950ca720480e30277e96 | Remove PortJob() as it's functionality is now provided by stages. | libpb/job.py | libpb/job.py | """Job handling for queue managers."""
from __future__ import absolute_import
from abc import abstractmethod, ABCMeta
from .signal import Signal, SignalProperty
__all__ = ["Job", "PortJob", "StalledJob"]
class StalledJob(RuntimeError):
"""Exception indicating the job cannot run right now."""
pass
class ... | Python | 0 | @@ -983,32 +983,190 @@
other.priority%0A%0A
+ @abstractmethod%0A def work(self):%0A %22%22%22Do the hard work.%0A%0A This method should be subclassed so as to do something useful.%22%22%22%0A pass%0A%0A
def run(self
@@ -1173,24 +1173,24 @@
, manager):%0A
-
%22%22%22R
@@ -1630,... |
f5794223778d27b2845b9ad40906c9f8db4db704 | Update __init__.py | model/__init__.py | model/__init__.py | from tornado.options import define,options
import tornado.gen
import pymongo
import logging
import time
__all__=["get_list","get_one","update","insert","delete","exsit","count"]
class BaseModel():
def __init__():
self.db_client = options.db_client;
self.module = self.__module__
self.class_... | Python | 0.000072 | @@ -570,24 +570,8 @@
y =
-self.class_name+
%22_id
|
3ed13c7e3ce2b9d8e5e66776ceb6487c88303f7a | Add refresh_token keyword arg | oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py | oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py | # -*- coding: utf-8 -*-
"""
oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
import json
import logging
from .base import GrantTypeBase
from .. import errors
from ..request_validator import RequestValidator
log = logging.getLogger(_... | Python | 0.000002 | @@ -2778,16 +2778,36 @@
tor=None
+, refresh_token=True
):%0A
@@ -2873,16 +2873,59 @@
idator()
+%0A self.refresh_token = refresh_token
%0A%0A de
|
47f1c23fa1d77e086d1518fca854431080037a51 | refactor message formatting | lib/slackmanager.py | lib/slackmanager.py | import asyncio
import os
import sys
from slackclient import SlackClient
import time
class SlackManager:
# loglines = [(0, str(index)) for index, x in enumerate(range(100))]
loglines = []
channel_topic = ""
_membercache = {}
_channelcache = {}
_rtm_con = None
_connected = False
_chan... | Python | 0.001547 | @@ -403,16 +403,197 @@
_TOKEN%22%5D
+%0A self.username = os.getenv(%22SLACK_USERNAME%22, %22Anonymous%22)%0A self.channel_name = os.environ%5B%22SLACK_CHANNEL%22%5D%0A self._debug = bool(os.getenv(%22SLACK_DEBUG%22, False))
%0A%0A
@@ -1050,60 +1050,8 @@
rn%0A%0A
- channel_name = os.... |
6ccdada25f8b6c0e38955e955efb235aea9945ee | Refactor testing console exporter (#2877) | opentelemetry-sdk/tests/metrics/integration_test/test_console_exporter.py | opentelemetry-sdk/tests/metrics/integration_test/test_console_exporter.py | # Copyright The OpenTelemetry 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 or agreed to in ... | Python | 0 | @@ -587,67 +587,144 @@
rom
-unittest import TestCase%0A%0Afrom opentelemetry import metrics
+io import StringIO%0Afrom json import loads%0Afrom unittest import TestCase%0A%0Afrom opentelemetry.metrics import get_meter, set_meter_provider
%0Afro
@@ -887,46 +887,223 @@
,%0A)%0A
-%0A%0Aclass TestConsoleExporter(TestCa... |
f39006397687ba071e89c3ab6dd16cce33235ca4 | fix the css rules conversion for if-config='' | lib/xdv/cssrules.py | lib/xdv/cssrules.py | #!/usr/bin/env python
"""\
Usage: %prog RULES
RULES is a file defining a set of xdv rules in css syntax, e.g:
<rules xmlns="http://namespaces.plone.org/xdv"
xmlns:css="http://namespaces.plone.org/xdv+css">
<copy css:content="#content-wrapper" css:theme="#page-content"/>
</rules>\
"""
usage = __doc__
fr... | Python | 0.000804 | @@ -895,35 +895,8 @@
():%0A
- if value: %0A
@@ -949,32 +949,58 @@
spaces%5B'css'%5D):%0A
+ if value:%0A
@@ -1094,14 +1094,22 @@
+
else:%0A
+
|
3fb115e87b424582baa769b9a5cd6eed388a3228 | add values for some other lamps | lamper.py | lamper.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import os
import sys
global colors
# 7 er taket, enkanals
# 8-9-10 er noen på pila, trekanals
# 11-12-13-14 er den siste på pila, firekanals
colors = {
'off': {
0: 0, # alle andre blir tomme
},
'red': {
7: 20, # rød på enkanal... | Python | 0 | @@ -278,24 +278,118 @@
'red': %7B%0A
+ 1: 100,%0A 2: 255,%0A 3: 127,%0A 4: 51,%0A 5: 255,%0A 6: 0,%0A%0A
7: 2
@@ -401,32 +401,32 @@
r%C3%B8d p%C3%A5 enkanals%0A
-
%0A 8: 20,
@@ -688,24 +688,118 @@
'green': %7B%0A
+ 1: 100,%0A 2: 255,%0A ... |
e03b3d35858fc70ffbc1441321acd1166470c542 | Format code using black | src/python/tensorflow_cloud/core/tests/examples/multi_file_example/scale_model.py | src/python/tensorflow_cloud/core/tests/examples/multi_file_example/scale_model.py | # Copyright 2020 Google LLC. 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 ... | Python | 0.000002 | @@ -681,21 +681,16 @@
del.py%22,
-%0D%0A
require
@@ -718,21 +718,16 @@
ts.txt%22,
-%0D%0A
stream_
|
cd10a87793d740aff6f13afbb30461597d1aab2b | Use latest pose stamp for last post change time. | src/beeper.py | src/beeper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2015 Jean Nassar
# Released under BSD version 4
"""
Beep when pose does not change for `TIMEOUT_TIME`
"""
import os
from geometry_msgs.msg import PoseStamped
import pygame
import rospy
TIMEOUT = 0.25 # seconds
SPIRIT_ROOT = os.path.expanduser("~/catkin_ws/src/sp... | Python | 0 | @@ -1106,24 +1106,102 @@
s not None:%0A
+ # TODO (masasin): %60self._last_pose.pose != pose.pose%60 always True%0A
@@ -1988,35 +1988,24 @@
ange_time =
-self._last_
pose.header.
|
7ebee43c0461c79d97d3023c0e404298c641c896 | update notebooks | _unittests/ut_module/test_convert_notebooks.py | _unittests/ut_module/test_convert_notebooks.py | """
@brief test log(time=0s)
"""
import sys
import os
import unittest
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
... | Python | 0.000001 | @@ -916,16 +916,41 @@
notebook
+, remove_execution_number
%0A%0A%0Aclass
@@ -1468,24 +1468,100 @@
fied%22, nbf)%0A
+ # remove numbers%0A remove_execution_number(nbf, nbf)%0A%0A
fold
|
4f8cf6c7349f7596a19d35e30af3c21491b00d03 | Add docstring | web/session.py | web/session.py | #
# per-app session management
#
import flask
def session_get(key):
return flask.session.get(key)
def session_set(key, value):
flask.session.permanent = True # Safari seems to need this
flask.session[key] = value
def session_pop(key):
if key in flask.session:
flask.session.pop(key)
... | Python | 0.000005 | @@ -1,37 +1,35 @@
-#%0A# per-app session management%0A#%0A
+%22%22%22%0AFlask session utilities%0A%22%22%22
%0Aimp
|
5a21917049397e3414d55a739aa295a9d15322a7 | add comments | python/SearchAlgorithms/SequentialSearch/Sequential.py | python/SearchAlgorithms/SequentialSearch/Sequential.py | def sequential_search_unordered_list(array, element):
pos = 0
found = False
while pos < len(array) and not found:
if array[pos] == element:
found = True
else:
pos += 1
return found
unordered_list = [1, 65, 37, 49, 52]
print(sequential_search_unordered_list(un... | Python | 0 | @@ -1,28 +1,83 @@
+# method to search for an element in an unordered list%0A
def sequential_search_unorde
@@ -387,16 +387,180 @@
t, 6))%0A%0A
+# method to search for an element in an ordered list%0A# the only difference between the two is that%0A# we stop when we find an element greater than our search target%0A
def... |
eb9b540d97d1538668ccc198717c73fd1f806719 | Fix registration command to comply with virtualenvs. | drift/management/commands/register.py | drift/management/commands/register.py | """
Register or update a deploable.
"""
import subprocess
from driftconfig.config import TSTransaction
from drift.utils import pretty
from driftconfig.util import register_this_deployable
def get_options(parser):
parser.add_argument(
"--preview", help="Only preview the changes, do not commit to origin.... | Python | 0 | @@ -33,16 +33,27 @@
le.%0A%22%22%22%0A
+import sys%0A
import s
@@ -697,16 +697,80 @@
nfig()%0A%0A
+ # Make current dir importable.%0A sys.path.insert(0, '.')%0A%0A
with
|
540b1816782881a4ed028d493975f5c97a85b8f4 | put server out of debug mode | website/app.py | website/app.py | from collections import namedtuple
import datetime
import httplib
import itertools
import os
from os import path
from flask import Flask, render_template, request, send_from_directory, url_for
import blog
def create_app():
app = Flask(__name__)
app.config.from_object(__name__)
app.jinja_env.trim_blocks ... | Python | 0.000001 | @@ -4012,14 +4012,15 @@
n(debug=
-Tru
+Fals
e)%0A
|
c89a27d8b16befb3d9f0e3d42cc43f43cddebfa2 | load openings db on entering menu | pentai/gui/menu_screen.py | pentai/gui/menu_screen.py | from kivy.uix.screenmanager import Screen
from kivy.properties import StringProperty
from scrollable_label import *
import pentai.base.logger as log
from pentai.gui.fonts import *
class MenuScreen(Screen):
""" This is more of a travel agency or a directory than a menu """
version_str = StringProperty("")
... | Python | 0 | @@ -2,30 +2,25 @@
rom
-kivy.
+pentai.g
ui
-x
.screen
-manager
imp
@@ -662,9 +662,9 @@
0.9.
-6
+7
%22%0A%0A
@@ -3679,12 +3679,145 @@
Bruce%0A%22%22%22)%0A%0A
+ def on_enter(self, *args, **kwargs):%0A log.debug(%22Expanding openings book%22)%0A self.app.openings_book._get_instance()%0A
|
21c118f5f9686294b1a8fabb68942d5f2eff3a75 | Update dsamp.py | blimpy/dsamp.py | blimpy/dsamp.py | """
Downsample an input Filterbank file (.fil or .h5)
to an output .h5 Filterbank file.
"""
# External dependencies:
import sys
import pathlib
import time
from argparse import ArgumentParser
import numpy as np
# Logging set up:
import logging
LOGGER = logging.getLogger(__name__)
FMT = "%(name)-15s %(levelname)-8s %... | Python | 0 | @@ -5585,19 +5585,16 @@
(1)%0A%0A
- _,
in_ext
@@ -5636,11 +5636,8 @@
%0A
- _,
out
|
b0a4a6e4fdd46c7c11e1ad7358fb211e68563d7c | update docstring. (#33) | luma/lcd/__init__.py | luma/lcd/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013-17 Richard Hull and contributors
# See LICENSE.rst for details.
"""
LCD display driver for PCD8544 devices.
"""
| Python | 0 | @@ -129,27 +129,8 @@
iver
- for PCD8544 device
s.%0A%22
|
051422346bc0d55bb7f2261b9bd23dce5afc48ca | test for dm | ion/services/dm/utility/test/test_coverage_craft.py | ion/services/dm/utility/test/test_coverage_craft.py | #!/usr/bin/env python
'''
@author Luke Campbell <LCampbell@ASAScience.com>
@file ion/services/dm/utility/test/test_coverage_craft.py
@date Thu Jul 19 16:44:05 EDT 2012
@description Utilities for crafting granules into a coverage
'''
from pyon.util.unit_test import PyonTestCase
class CoverageCraftUnitTest(PyonTestCase... | Python | 0.000025 | @@ -272,16 +272,199 @@
estCase%0A
+from ion.services.dm.utility.granule_utils import CoverageCraft, RecordDictionaryTool, build_granule, TaxyTool %0Afrom nose.plugins.attrib import attr%0A%0Aimport numpy as np%0A%0A@attr('UNIT')
%0Aclass C
@@ -503,13 +503,751 @@
e):%0A
+%0A
-pass
+def sample_granule(self):%0A ... |
c43e46a71f99e2fa7d5836260ac05519ac0c0329 | Remove dotenv from wsgi | calltospeakers/wsgi.py | calltospeakers/wsgi.py | """
WSGI config for calltospeakers project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
import dotenv
try:
dotenv.read_dotenv(
os.path.join(os.path.dirname(o... | Python | 0.000001 | @@ -234,164 +234,8 @@
os%0A
-import dotenv%0A%0A%0Atry:%0A dotenv.read_dotenv(%0A os.path.join(os.path.dirname(os.path.dirname(__file__)), '.env'))%0Aexcept Exception as e:%0A print(e)%0A%0A
%0AENV
|
3f72b358d3c8cbf0d063f2dfc0dfd94fa4e4393c | Add support for WTF fields in r16 headers | pfile_tools/anonymizer.py | pfile_tools/anonymizer.py | # Part of the pfile-tools package
# Copyright (c) 2012, Board of Regents of the University of Wisconsin
# Written by Nathan Vack <njvack@wisc.edu>
# A library for performing anonymization of GE p-file headers.
from collections import namedtuple
import struct_utils
import logging
logger = logging.getLogger(__name__)
... | Python | 0 | @@ -566,24 +566,25 @@
t_name%22,
+
%22ANONYMIZED%22
@@ -646,24 +646,25 @@
t_id%22,
+
%22ANONYMIZED%22
@@ -691,24 +691,186 @@
tient ID%22),%0A
+ AnonEntry(%22patient_name_2%22, %22ANONYMIZED%22, %22name_2%22, %22patient name 2%22),%0A AnonEntry(%22patient_id_2%22, %22ANONYMIZED%22, %22i... |
928f79994211131421d6a359fd7a491a16c6bb7d | Fix typo | ipv6map/geodata/management/commands/sync_geodata.py | ipv6map/geodata/management/commands/sync_geodata.py | import datetime
import ipaddress
import logging
import os
import re
import pandas as pd
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from ipv6map.geodata import models
logger = logging.getLogger(__name__)
class Command(BaseCo... | Python | 0.999999 | @@ -592,12 +592,11 @@
ata
-fori
+tha
t ha
|
87172c2f23bed0b6a3566052624416a8c4a6e29b | Fix double typedef | pgi/cffilib/glib/_cdef.py | pgi/cffilib/glib/_cdef.py | # Copyright 2013 Christoph Reiter
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
GLIB_CDEF = """
typedef c... | Python | 0.999699 | @@ -827,30 +827,8 @@
er;%0A
-typedef gulong GType;%0A
type
|
cbf47d00da391f8799485b1b8c5bb449496b4604 | Use stable MADAM API. | madam_rest/api_v1.py | madam_rest/api_v1.py | from datetime import datetime
from fractions import Fraction
from flask import Blueprint, jsonify, send_file, url_for
from frozendict import frozendict
from madam_rest import asset_storage
api = Blueprint('v1', __name__, url_prefix='/v1')
def _serializable(value):
"""
Utility function to convert data stru... | Python | 0 | @@ -1154,32 +1154,38 @@
_key):%0A asset
+, tags
= asset_storage
@@ -1176,33 +1176,37 @@
= asset_storage
-%5B
+.get(
asset_key%5D%0A r
@@ -1190,33 +1190,33 @@
ge.get(asset_key
-%5D
+)
%0A return json
@@ -1264,24 +1264,26 @@
f%22: url_for(
+'.
asset_retrie
@@ -1276,32 +1276,33 @@
'.asset_retrieve
+'
... |
65f65e6df701f750a8221407f2fccc6c2d1eeac3 | Update flip-game-ii.py | Python/flip-game-ii.py | Python/flip-game-ii.py | # Time: O(n^2)
# Space: O(n)
# The best theory solution (DP, O(n^2)) could be seen here:
# https://leetcode.com/discuss/64344/theory-matters-from-backtracking-128ms-to-dp-0m
class Solution(object):
def canWin(self, s):
g, g_final = [0], 0
for p in map(len, re.split('-+', s)):
while len... | Python | 0.000001 | @@ -263,16 +263,27 @@
or p in
+itertools.i
map(len,
|
898028dea2e04d52c32854752bda34d331c7696f | Move on if email exists | ynr/apps/candidatebot/management/commands/candidatebot_import_email_from_csv.py | ynr/apps/candidatebot/management/commands/candidatebot_import_email_from_csv.py | from __future__ import unicode_literals
import csv
from django.core.management.base import BaseCommand
from candidatebot.helpers import CandidateBot
from popolo.models import Person
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'filename',
hel... | Python | 0.000011 | @@ -973,24 +973,53 @@
oclub_id'%5D)%0A
+ try:%0A
@@ -1070,24 +1070,28 @@
+
+
bot.save(sou
@@ -1119,23 +1119,102 @@
-# print(person)
+except ValueError:%0A #Email exists, move on%0A pass
%0A
|
81afbec597b60e6578d54e3b1362d01eea111e42 | Removed a wrong return statement | openquake/engine/__init__.py | openquake/engine/__init__.py | # Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distri... | Python | 0.999999 | @@ -3938,29 +3938,8 @@
1%22)%0A
- return False%0A
%0A%0Ade
|
46ef2b141c87f4b5eb18f6e9a84ff767bccafdd8 | Fix broken UI tests | opentreemap/uitests/basic.py | opentreemap/uitests/basic.py | from unittest import TestCase
from treemap.models import User
from registration.models import RegistrationProfile
import uitests
# Testing requirements:
# apt-get install firefox
# pip install -r requirements.txt
# Selenium
# PyVirtualDisplay
userUUID = 1
class LoginLogoutTest(TestCase):
def setUp(self):
... | Python | 0.000016 | @@ -106,16 +106,49 @@
nProfile
+%0Afrom django.conf import settings
%0A%0Aimport
@@ -694,21 +694,116 @@
-userUUID += 1
+email = '%25s@testing.org' %25 username%0A userUUID += 1%0A%0A User.objects.filter(email=email).delete()
%0A%0A
@@ -846,35 +846,13 @@
ail=
-'%25s@testing.org' %25 username
+e... |
23a53a677f4b9d3f428cc1519341b67e063f57b4 | Fix typo in import statement | oscar_fancypages/defaults.py | oscar_fancypages/defaults.py | from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
from fancypages.default import *
# Menu structure of the dashboard navigation
OSCAR_DASHBOARD_NAVIGATION = [
{
'label': _('Dashboard'),
'icon': 'icon-th-list',
'url_name': 'dashboard:index',
... | Python | 0.998931 | @@ -113,16 +113,17 @@
.default
+s
import
|
00a87b50596e4b81ea103c895c3b764e39b5c8ea | Stop to use the __future__ module. | oslo_serialization/base64.py | oslo_serialization/base64.py | # Copyright 2015 Red Hat
# 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 appli... | Python | 0.999908 | @@ -692,48 +692,8 @@
%22%22%0A%0A
-from __future__ import absolute_import%0A%0A
impo
|
bf73d6d050f3ebbc3f090bb7fc4925c0c8ba9d99 | Add timeout functionality to frog parsing | cptm/utils/frog.py | cptm/utils/frog.py | from pynlpl.clients.frogclient import FrogClient
import logging
import re
import sys
logger = logging.getLogger(__name__)
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO)
def get_frogclient(port=8020):
try:
frogclient = FrogClient('localhost', port)
return frogclient
... | Python | 0 | @@ -77,16 +77,30 @@
port sys
+%0Aimport signal
%0A%0Alogger
@@ -705,24 +705,177 @@
rogclient):%0A
+ # add timeout functionality (so frog won't keep parsing faulty text%0A # forever)%0A signal.signal(signal.SIGALRM, timeout)%0A signal.alarm(300)%0A%0A
regex =
@@ -897,16 +897,29 @@
.*%5C)')%0A%0A
+ ... |
b9007c5a8ead146fda9cc6324e56b3d0aa70fe82 | linear regression Problem set 3 | Problem_Set_3_Subway/C_linear_regression.py | Problem_Set_3_Subway/C_linear_regression.py | import numpy as np
import pandas as pd
from ggplot import *
"""
In this question, you need to:
1) implement the compute_cost() and gradient_descent() procedures
2) Select features (in the predictions procedure) and make predictions.
"""
def normalize_features(df):
"""
Normalize the features in the data set.
... | Python | 0.998669 | @@ -5703,16 +5703,21 @@
data
+frame
= pd.re
@@ -5796,27 +5796,259 @@
pr
-int(predictions(data))
+e = predictions(dataframe)%5B0%5D%0A data = dataframe%5B'ENTRIESn_hourly'%5D%0A r_squared = 1- np.sum(np.square(data - pre)) / np.sum(np.square(data-np.average(data)))%0A print(%22R%5E2 = %22, r_squared)%... |
42627a3279d3d67aa7ad71e7da16f8c0606ec6e6 | Build with -j4 on the buildbots (#47) | master/inventory.py | master/inventory.py | ###############################################################################
# Define our buildslave inventory, and define attributes for each slave
###############################################################################
from buildbot.buildslave import BuildSlave
ubuntu_names = []
# Removed 12.04 from this... | Python | 0 | @@ -1117,16 +1117,61 @@
BOSE=1 '
+%0A %0A # Parallel make%0A flags += '-j4 '
%0A%0A #
|
0483fb30128aae20e124c4f736e81315622c1037 | remove commented out code | mathics/viewport.py | mathics/viewport.py | import math
from PIL import ImageFont
from machines.basic import Point
class Viewport(object):
BLACK=(0, 0, 0)
GRAY=(200, 200, 200)
BEIGE=(245, 245, 220)
WHITE=(255, 255, 255)
def __init__(self, x1, y1, x2, y2, background_color=None):
self.objects = []
self.x1_internal = float(x1)... | Python | 0 | @@ -2289,126 +2289,8 @@
n)%0A%0A
-# str_function = lambda self: 'Viewport.' + self._name_%0A# setattr(cls, '__str__', str_function)%0A
|
bcd38da7663ebf8be9ada6f5cf751536a7d6645c | Version bump. | categories/__init__.py | categories/__init__.py | __version_info__ = {
'major': 0,
'minor': 7,
'micro': 2,
'releaselevel': 'final',
'serial': 1
}
def get_version(short=False):
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final')
vers = ["%(major)i.%(minor)i" % __version_info__, ]
if __version_info__['micro']:
v... | Python | 0 | @@ -47,9 +47,9 @@
r':
-7
+8
,%0A
@@ -59,17 +59,17 @@
micro':
-2
+0
,%0A 'r
|
f663c6ad7f5aa99b0486711ffe65cf450c23121b | Update maintenance/admin.py | maintenance/admin.py | maintenance/admin.py | from django.contrib import admin
from models import Maintenance, MaintenanceFilter
class MaintenanceFilterInline(admin.StackedInline):
model = MaintenanceFilter
class MaintenanceAdmin(admin.ModelAdmin):
list_display = ('start_time', 'end_time', 'enabled')
list_filter = ('start_time', 'end_time', 'enabled... | Python | 0 | @@ -118,15 +118,15 @@
min.
-Stacked
+Tabular
Inli
|
1e69bcaf3062f8c2da24aee3322aa562dabd6874 | Change classify -> run for temp back compat. | blvd_analyze.py | blvd_analyze.py | # coding=utf-8
import blvd_text
import json
from libshorttext.analyzer import *
from libshorttext.classifier import *
analyzer = Analyzer('outputs/16.2.1-2.model')
import zerorpc
import logging
logging.basicConfig()
class BlvdAnalyzer():
def __init__(self):
self.is_currently_useless = True
@sta... | Python | 0 | @@ -331,24 +331,19 @@
def
-classify
+run
(text):%0A
@@ -2046,24 +2046,19 @@
ap(self.
-classify
+run
, texts)
|
8ebd05febab8641d481d6712a4e527267fc5466c | Version bump 0.2.0 | mangrove/__init__.py | mangrove/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
version = (0, 1, 0)
__title__ = "mangrove"
__author__ = "Oleiade"
__license__ = "MIT"
__version__ = '.'.join(map(str, version))
| Python | 0.000001 | @@ -58,9 +58,9 @@
(0,
-1
+2
, 0)
|
866c390d3bd3ac3f022fe6cd770ffc4534fc692c | use string value of status when validating | api/v2/serializers/details/resource_request.py | api/v2/serializers/details/resource_request.py | from rest_framework import exceptions, serializers
from core.models import ResourceRequest, Allocation, Quota, Identity, AtmosphereUser as User, IdentityMembership
from core.models.status_type import StatusType
from api.v2.serializers.summaries import (
AllocationSummarySerializer,
IdentitySummarySerializer,
... | Python | 0.000004 | @@ -6301,21 +6301,26 @@
if
+str(
value
+)
not in
@@ -6324,27 +6324,27 @@
in %5B
-'
+%22
pending
-', '
+%22, %22
closed
-'
+%22
%5D:%0A
|
f393619eaa6ee1508ed324adb1b88f421e55f92f | Bump version number | nassl/__init__.py | nassl/__init__.py | __author__ = "Alban Diquet"
__version__ = "4.0.1b0"
| Python | 0.000002 | @@ -45,8 +45,6 @@
.0.1
-b0
%22%0A
|
9597c8bc27be7ca44d503facb6a0cf3dfe76bcc3 | Revert prior change to request timeout | nc/prime_cache.py | nc/prime_cache.py | #!/usr/bin/env python
import argparse
import logging
import requests
import urllib
from django.core.urlresolvers import reverse
logger = logging.getLogger(__name__)
ENDPOINTS = ('stops', 'stops_by_reason', 'use_of_force', 'searches', 'contraband_hit_rate')
def run(root, host=None):
headers = dict()
if host... | Python | 0 | @@ -1047,159 +1047,8 @@
ry:%0A
- # requests doc says there's no timeout by default, but the log showed%0A # timeouts every 120 seconds when accessing an expensive agency.%0A
@@ -1115,21 +1115,8 @@
load
-, timeout=300
)%0A
|
8bdb5850a5318f1f6196d4800c7c1582caa9fcf4 | Fix config | rpihelper/config.py | rpihelper/config.py | # -*- coding: utf-8 -*-
import os
import yaml
from flask import Flask as BaseFlask, Config as BaseConfig
from rpihelper.utils import make_dir, INSTANCE_FOLDER_PATH
__all__ = (
'Flask',
)
class Config(BaseConfig):
"""
Flask config enhanced with a `from_yaml` method.
"""
def __init__(self, *ar... | Python | 0.000007 | @@ -788,16 +788,24 @@
opment')
+.upper()
%0A
|
b12be854a0bb60d7554a2a5142b6dad73f2271b3 | debug output | SmartCar/SmartCarServer/motor_controller.py | SmartCar/SmartCarServer/motor_controller.py | from threading import Timer
import time
import os
def timer_func(self):
print(time.time() - self.timestamp)
if time.time() - self.timestamp < 5:
print(str(self.speed) + ' ' + str(self.balance))
self.control_impl(self.speed, self.balance)
elif self.speed > 0:
print('Timestamp too ol... | Python | 0.000011 | @@ -2537,16 +2537,103 @@
) * 100%0A
+ print('Left speed:' + str(left_speed) + ' Right speed:' + str(right_speed))
%0A
|
35c8c0e600746e092bb236dabd05491d8be1078a | increase chunk download timeout | system/hardware/tici/casync.py | system/hardware/tici/casync.py | #!/usr/bin/env python3
import io
import lzma
import os
import struct
import sys
import time
from abc import ABC, abstractmethod
from collections import defaultdict, namedtuple
from typing import Callable, Dict, List, Optional, Tuple
import requests
from Crypto.Hash import SHA512
CA_FORMAT_INDEX = 0x96824d9c7b129ff9
C... | Python | 0.000001 | @@ -579,17 +579,17 @@
MEOUT =
-1
+6
0%0ACHUNK_
|
dfced70203a11f95a74ff1ea83806e6cbd426eb2 | add test decorators to afni tests | lib/neuroimaging/data_io/formats/tests/test_afni.py | lib/neuroimaging/data_io/formats/tests/test_afni.py | import unittest, os
import numpy as N
from neuroimaging.data_io.formats import afni
from neuroimaging.utils.tests.data import repository
from neuroimaging.core.image.image import Image
class AFNITest(unittest.TestCase):
def setUp(self):
# This data set is part of the AFNI test data package
# it i... | Python | 0 | @@ -176,24 +176,83 @@
port Image%0A%0A
+from neuroimaging.utils.test_decorators import slow, data%0A%0A
class AFNITe
@@ -271,24 +271,34 @@
TestCase):%0A%0A
+ @data%0A
def setU
@@ -519,16 +519,27 @@
NITest):
+%0A%0A @data
%0A def
@@ -611,32 +611,42 @@
est(AFNITest):%0A%0A
+ @data%0A
def test_... |
ab946a092d47fb99bfd08271cfcceed6dcc84f65 | update version | ctutlz/_version.py | ctutlz/_version.py | __version__ = "0.8.2"
| Python | 0 | @@ -16,7 +16,7 @@
0.8.
-2
+3
%22%0A
|
d1aabdf44b2e0e3a4d16d97c7e90546bc2facb92 | Remove unused import | cupy/sparse/csr.py | cupy/sparse/csr.py | try:
import scipy.sparse
_scipy_available = True
except ImportError:
_scipy_available = False
import cupy
from cupy import cusparse
from cupy.sparse import compressed
from cupy.sparse import csc
class csr_matrix(compressed._compressed_sparse_matrix):
"""Compressed Sparse Row matrix.
Now it has ... | Python | 0.000001 | @@ -104,20 +104,8 @@
se%0A%0A
-import cupy%0A
from
|
31b464e41e20b77d3bce2a4688b0f4f7dff2c3af | Verifica os dados antes de gerar | customers/admin.py | customers/admin.py | # coding: utf-8
from django.contrib import admin, messages
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.template.response import TemplateResponse
from django.contrib.auth.models import User
from django.db import connection
from django.http import HttpResponseRedirect
from protocolle.core.... | Python | 0.000087 | @@ -1238,24 +1238,130 @@
'Entregue'%7D%0A
+ status_check = Status.objects.filter(nome__in=s)%0A if not status_check:%0A
@@ -1376,16 +1376,20 @@
i in s:%0A
+
@@ -1420,32 +1420,36 @@
Status(nome=i)%0A
+
@@ -1569,16 +1569,138 @@
terna... |
ea269437fef6901920e74227e0706d10fb03e85c | bump to 1.0.5 | ceph_medic/__init__.py | ceph_medic/__init__.py | from collections import namedtuple
class UnloadedConfig(object):
"""
This class is used as the default value for config.ceph so that if
a configuration file is not successfully loaded then it will give
a nice error message when values from the config are used.
"""
def __init__(self, error=None... | Python | 0 | @@ -820,7 +820,7 @@
1.0.
-4
+5
'%0A
|
2b8d2de384a9ea83ae7db6746ab5b29f55de2852 | add knowledge of changeset to post_sync hook | cynq/controller.py | cynq/controller.py | import logging_helper
from stores.facet import Facet
from stores.multi_facet import MultiFacet
from connection import Connection
from stores.local_glove import LocalGlove
from sanetime import sanetime
# lots of assumption here:
# 1) remote store returns no soft_delete items in its list-- not taking that possibility... | Python | 0 | @@ -706,16 +706,47 @@
nit__()%0A
+ self.total_changes = 0%0A
@@ -1775,16 +1775,38 @@
_finish(
+self.total_changes %3E 0
)%0A
@@ -2412,32 +2412,63 @@
_results(self):%0A
+ self.total_changes = 0%0A
for conn
@@ -4278,11 +4278,90 @@
tes'%5D))%0A
+ self.total_changes +=... |
9a68fb81e252ecc852525f08b2dc4895c4bd6439 | remove a useless double quote in the div content | pandas_highcharts/display.py | pandas_highcharts/display.py | # -*- coding: utf-8 -*-
"""Functions to quickly display charts in a Notebook.
"""
import string
import random
from IPython.core import getipython
from IPython.core.display import display, HTML
from core import serialize
HIGHCHARTS_SCRIPTS = """<script src="http://code.highcharts.com/highcharts.js"></script>
<scri... | Python | 0 | @@ -1246,17 +1246,16 @@
art_id%7D%22
-%22
%3C/div%3E%0A
|
a108934c24fe7dcd1db745025a5dc48f82d0d0ea | fix schema: remove redundant keys for REQUEST_SCHEMA | ruz/utils/schema.py | ruz/utils/schema.py | # collection of API endpoints (and their aliases)
RUZ_API_ENDPOINTS = {
'schedule': "personLessons",
'lessons': "personLessons",
'person_lessons': "personLessons",
'personLessons': "personLessons",
'groups': "groups",
'staffOfGroup': "staffOfGroup",
'staff_of_group': "staffOfGroup",
'str... | Python | 0.000002 | @@ -879,24 +879,29 @@
%7B%0A '
-schedule
+personLessons
': %7B%0A
@@ -1358,113 +1358,8 @@
%7D,%0A
- 'staff_of_group': %7B%0A 'group_id': int,%0A 'groupOid': int,%0A 'findText': str%0A %7D,%0A
@@ -1474,92 +1474,8 @@
%7D,%0A
- 'staff_of_streams': %7B%0A 'streamOid':... |
cc3c607f8649b8b9208987d4208b219d7164e957 | Work around MBS-4285 | daemon/releases.py | daemon/releases.py | # -*- coding: utf-8 -*-
#
# Copyright © 2009-2011 Alexander Kojevnikov <alexander@kojevnikov.com>
#
# muspy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | Python | 0 | @@ -5304,32 +5304,80 @@
updated = True%0A
+ # Work-around MBS-4285.%0A
@@ -5404,24 +5404,45 @@
roup.name !=
+ rg_data%5B'title'%5D and
rg_data%5B'ti
|
4616fdefc1c7df8acccdd89ea792fa24ecfa9ca6 | Check environment variables before the tests are started | perf-tests/src/perf-tests.py | perf-tests/src/perf-tests.py | def main():
pass
if __name__ == "__main__":
# execute only if run as a script
main()
| Python | 0 | @@ -1,15 +1,961 @@
-def main():
+import json%0Aimport time%0Aimport datetime%0Aimport subprocess%0Aimport os.path%0Aimport sys%0Aimport queue%0Aimport threading%0A%0Afrom coreapi import *%0Afrom jobsapi import *%0Aimport benchmarks%0Aimport graph%0A%0A%0Adef check_environment_variable(env_var_name):%0A print(%22Chec... |
0ca2ad0b56009e70b823735dd8755f839e963ad0 | Remove min_entries from BinaryFieldList. | minform/compound.py | minform/compound.py | import wtforms
from . import core
from . import basic
class BinaryFieldList(core.BinaryField):
"""
"""
def __init__(self, inner_field, label='', validators=None,
min_entries=0, max_entries=None,
length=core.EXPLICIT, order=None,
**kwargs):
cor... | Python | 0 | @@ -96,24 +96,70 @@
):%0A%0A %22%22%22%0A
+ Store a homogeneous list of information.%0A%0A
%0A %22%22%22%0A%0A
@@ -239,23 +239,8 @@
- min_entries=0,
max
@@ -253,33 +253,16 @@
es=None,
-%0A
length=
@@ -1325,144 +1325,31 @@
m
-in_entries=min_entries,%0A ... |
6d76cd9cb5e652507367c9559a9373ed7abec471 | fix all_hosts decorator | perfrunner/helpers/remote.py | perfrunner/helpers/remote.py | from uuid import uuid4
from fabric.api import execute, get, run, parallel
from fabric import state
from logger import logger
from perfrunner.helpers import Helper
def all_hosts(task):
def wrapper(self, *args, **kargs):
return execute(parallel(task), *args, hosts=self.hosts, **kargs)
return wrapper
... | Python | 0.000247 | @@ -258,16 +258,22 @@
l(task),
+ self,
*args,
|
b20c0f464c841c03e8c2870d4fbe8b1387ce2881 | Add version command-line flag. | darglint/driver.py | darglint/driver.py | """Defines the command line interface for darglint."""
import argparse
import ast
import sys
from .function_description import (
read_program,
get_function_descriptions,
)
from .integrity_checker import IntegrityChecker
from .config import ( # noqa
Configuration,
get_config,
)
from .docstring.base imp... | Python | 0 | @@ -1316,24 +1316,164 @@
d_argument(%0A
+ '--version',%0A action='store_true',%0A help=(%0A 'Return the current version number of darglint.'%0A ),%0A)%0Aparser.add_argument(%0A
'files',
@@ -4709,24 +4709,66 @@
,%0A %5D))%0A%0A%0A
+def print_version():%0A print('0.5.1')%0A%0A%0A
def main... |
ff57f0ff7c80df54b8933d18e4cd411ac6a07173 | celery app maker | niquery/celery.py | niquery/celery.py | Python | 0.999986 | @@ -0,0 +1,419 @@
+from celery import Celery%0A%0A%0Adef make_celery(app):%0A celery = Celery(app.import_name, broker=app.config%5B'CELERY_BROKER_URL'%5D)%0A celery.conf.update(app.config)%0A%0A class ContextTask(celery.Task):%0A abstract = True%0A%0A def __call__(self, *args, **kwargs):%0A ... | |
bc84fa7ee20ffc3ec40239d645a48f79863db33d | Remove access git revision | sasview/__init__.py | sasview/__init__.py | __version__ = "3.1.0"
__build__ = "1"
try:
import subprocess
d = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
__build__ = str(d).strip()
except:
import logging
import sys
logging.warning("Error while determining build number\n %s" % sys.exc_value)
| Python | 0 | @@ -35,259 +35,4 @@
%221%22%0A
-try:%0A import subprocess%0A d = subprocess.check_output(%5B'git', 'rev-parse', '--short', 'HEAD'%5D)%0A __build__ = str(d).strip()%0Aexcept:%0A import logging%0A import sys%0A logging.warning(%22Error while determining build number%5Cn %25s%22 %25 sys.exc_value)%0A
|
6582bdc62891308359718de78e05066cfc0b9131 | update nodal_stress() in its2D_3.py example | examples/linear_elasticity/its2D_3.py | examples/linear_elasticity/its2D_3.py | r"""
Diametrically point loaded 2-D disk with nodal stress calculation. See
:ref:`sec-primer`.
Find :math:`\ul{u}` such that:
.. math::
\int_{\Omega} D_{ijkl}\ e_{ij}(\ul{v}) e_{kl}(\ul{u})
= 0
\;, \quad \forall \ul{v} \;,
where
.. math::
D_{ijkl} = \mu (\delta_{ik} \delta_{jl}+\delta_{il} \delta_{j... | Python | 0 | @@ -1997,19 +1997,16 @@
var()%5B0%5D
-%5B0%5D
))%0A p
@@ -2069,11 +2069,8 @@
r()%5B
-0%5D%5B
1%5D))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.