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 |
|---|---|---|---|---|---|---|---|
382a3f673c4d74f6ba2b8c4ccff9332445b76093 | Fix resource category help text. | chmvh_website/resources/models.py | chmvh_website/resources/models.py | from django.db import models
class Category(models.Model):
"""A category of resources."""
important = models.BooleanField(
default=False,
help_text=('categories marked important will be shown at the top of ',
'the resource list'),
verbose_name='important')
title ... | Python | 0.002175 | @@ -169,17 +169,17 @@
_text=('
-c
+C
ategorie
@@ -226,17 +226,16 @@
top of '
-,
%0A
|
e757c0bc72bd508a2a8fddda1900e71b15383cdf | Fix for failing query. | georegistry/api.py | georegistry/api.py | # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
import urllib
import json
from mangrove.utils.types import is_string, is_number
GEOREGISTRY_API_BASE_URL = 'http://ni-api.georegistry.org/api/1.0'
GEOREGISTRY_API_DEFAULT_LIMIT = 50
GEOREGISTRY_NUM_HTTP_ATTEMPS = 5
def get_locations_tree(country_code, limit=GEOREGISTRY_API... | Python | 0.000005 | @@ -533,30 +533,31 @@
ing(id)%0A
-return
+query =
_query('/fe
@@ -580,23 +580,88 @@
id)
-%5B'features'%5D%5B0%5D
+%0A if query:%0A return query%5B'features'%5D%5B0%5D%0A else:%0A return None
%0A%0A%0Ad
@@ -923,47 +923,8 @@
ry)%0A
- print '%5B%25s%5D ...' %25 (t + 1)%0A
@@... |
91b6025b2706d9ca993627d20a9d4f769a4f3276 | fix scale | munin/i2pmon.py | munin/i2pmon.py | #!/usr/bin/env python
#
# i2pcontrol munin plugin
#
import sys
if len(sys.argv) > 1 and sys.argv[1] == 'config':
print ('graph_title I2P Bandwidth')
print ('graph_order down up')
print ('graph_category network')
print ('graph_args --base 1000')
print ('graph_vlabel bits in (-) / out (+) per ${graph_... | Python | 0.000002 | @@ -221,45 +221,8 @@
k')%0A
- print ('graph_args --base 1000')%0A
|
5b0848076eada22d1c9ca90e9761be1a29b1e151 | Update bot.py | intelmq/lib/bot.py | intelmq/lib/bot.py | import sys
import re
import time
import ConfigParser
from intelmq.lib.event import Event
from intelmq.lib.pipeline import Pipeline
from intelmq.lib.utils import decode, log
SYSTEM_CONF_FILE = "/etc/intelmq/system.conf"
PIPELINE_CONF_FILE = "/etc/intelmq/pipeline.conf"
BOTS_CONF_FILE = "/etc/intelmq/bots.... | Python | 0.000001 | @@ -5496,32 +5496,65 @@
ode(raw_message)
+ # its not necessary...i think...
%0D%0A me
|
0390d9c4ab77d111dfa030e8a70122ed5e69698a | version bump 0.5 | mws/__init__.py | mws/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.4'
from mws import * | Python | 0.000001 | @@ -38,9 +38,9 @@
'0.
-4
+5
'%0A%0Af
|
ad725fd106c68ce728c62db9a0d09e03fa917daf | remove main from cgroups | isolate/cgroups.py | isolate/cgroups.py | #!/usr/bin/env python
# coding: utf-8
import os
from datetime import timedelta
from signal import SIGKILL
from cgroupspy.trees import GroupedTree
from cgroupspy.nodes import Node
from datetime import datetime
class Cgroup(object):
BYTES = 1
KILOBYTES = 1024
MEGABYTES = 1024**2
GIGABYTES = 1024**3
... | Python | 0.000003 | @@ -4359,227 +4359,4 @@
ms)%0A
-%0Aif __name__ == '__main__':%0A c = Cgroup('/group2', %5B'memory', 'cpu', 'cpuset'%5D)%0A d = c.create_child('group3')%0A d.execute_command('subl')%0A raw_input()%0A d.delete(kill_tasks=True)%0A c.delete(kill_tasks=True)%0A%0A
|
68eeae8d008a2ae6db3923a1f6d19a5f9cb54e04 | Update hiptnt.py | benchexec/tools/hiptnt.py | benchexec/tools/hiptnt.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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
... | Python | 0 | @@ -876,22 +876,22 @@
utable('
-HipTNT
+hiptnt
.sh')%0A%0A%0A
|
94f0b65504424786bab736c87fbff57e61bb39d4 | Replace the last occurrence of .s with .h | build/generate_asm_header.py | build/generate_asm_header.py | #!/usr/bin/env python
#
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All... | Python | 0.999999 | @@ -1000,16 +1000,20 @@
put_file
+name
'%0A pars
@@ -1515,77 +1515,99 @@
file
-_
name =
-os.path.basename(
args%5B0%5D
-)
%0A
-file_base_name = os.path.splitext
+output_root = (options.dir + '/' +%0A os.path.splitext(os.path.basename
(inp
@@ -1617,17 +1617,18 @@
file
-_
name)
+)
%5B0%5D
+)
%0A i
@@... |
164e7c73727cd804cc42282aff3b4309967d85df | Put sleep time into variable | fetcher.py | fetcher.py | #!/usr/bin/python3
'''
Description: Fetches a list of all the Steam ID's and checks the
current pricing of each game
'''
import time
import requests
import json
import datetime
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy import Column, Date, DateTime, Integer, String
from sqlalchemy.ext.declarativ... | Python | 0.00477 | @@ -638,16 +638,29 @@
IT = 200
+%0ASLEEPER = 10
%0A%0A#DB Ta
@@ -4036,195 +4036,8 @@
ta:%0A
- #if int(game) in blacklist: #this check should be done prior to the web request.%0A # print(%22Skipping %7B%7D due to blacklist%22.format(game))%0A # continue%0A
@@ -5498,10 +549... |
37f25dfcc013b78efe4c3b0bc9326dd0cbfd60d7 | Handle no visable chars and http errors | fetcher.py | fetcher.py | #Copyright 2013 Mitchell Jon Stanton-Cook Licensed under the
#Educational Community 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.osedu.org/licenses/ECL-2.0
#
##Unless required by applicable law or agreed t... | Python | 0 | @@ -727,17 +727,87 @@
il.com%22%0A
+delchars = ''.join(c for c in map(chr, range(256)) if not c.isalnum())
%0A
-
%0Adef fet
@@ -1013,24 +1013,131 @@
-if acc != '%5Cn':%0A
+acc = acc.translate(None, delchars)%0A if acc != '':%0A print id, len(acc)%0A try:%0A
@... |
d5d37914fc613c17804418fbdeedde562bad1908 | use empty ip to specify all interfaces | janelia_jupyterhub/jupyterhub_config.py | janelia_jupyterhub/jupyterhub_config.py | # Configuration file for jupyterhub.
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
# Connect containers to this Docker network
network_name = 'jhub'
c.DockerSpawner.use_internal_ip = True
c.DockerSpawner.network_name = network_name
# Pass the network name as argument to spawned containers
... | Python | 0 | @@ -549,17 +549,16 @@
b_ip = '
-*
'%0Ac.Jupy
@@ -748,9 +748,8 @@
= '
-*
'%0A%0A#
|
26e9800e3c31892a1ddc584903bf5ef646b1a633 | Add seen command | robinette/irc.py | robinette/irc.py | import logging
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
import bson
from nltk.chat.eliza import eliza_chatbot as chatbot
import pymongo
from xmlrpc.server import BaseHandler
from xmlrpc.util import signature
class IRC(BaseHandler):
def __init__(self, chatbot):
self._mo... | Python | 0.000147 | @@ -1,12 +1,36 @@
+from dateutil import tz%0A
import loggi
@@ -889,16 +889,726 @@
d(msg)%0A%0A
+ @signature(args=%5B'string'%5D, returns='string')%0A def seen(self, nick):%0A %22%22%22%0A Return the last time a user was seen.%0A%0A %22%22%22%0A db = self._mongo_conn.event_db%0A ... |
4505e766fc0c5612eb9afe7f93390f32dbce2e78 | Fix unicode problems | robinette/irc.py | robinette/irc.py | import datetime
import json
import logging
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger('robinette.irc')
import re
import urllib
import urllib2
from BeautifulSoup import BeautifulSoup
import bson
from dateutil import tz
from nltk.chat.eliza import eliza_chatbot as chatbot
import pymongo
from xmlrp... | Python | 0.999994 | @@ -515,19 +515,23 @@
PrivMsg(
-str
+unicode
):%0A p
|
636f29374561148f167ff76f4a6dc23ee2e57d95 | remove ipdb | twitter/streaming_api.py | twitter/streaming_api.py | import logging
import time
import tweepy
from twitter import settings
class Streaming:
def __init__(self,
pipeline,
batch_size=1000,
consumer_key=settings.CONSUMER_TOKEN,
consumer_secret=settings.CONSUMER_SECRET,
acces_token=s... | Python | 0.000016 | @@ -922,54 +922,8 @@
e:%0A
- import ipdb; ipdb.set_trace()%0A
|
d39975abe8f8e0208219da1b39f8889f5a91176e | make some long polling functions private | parallel/long_polling.py | parallel/long_polling.py | from __future__ import unicode_literals
import ujson as json
import logging
import threading
import redis
from compatibility import urlopen
from config import POLLING_WAIT, REDIS_DB, REDIS_CHARSET, REDIS_PREFIX, REDIS_PORT, REDIS_HOST
from api.vkapi import method
from parallel import realtime, updates
from events.tog... | Python | 0.000001 | @@ -1425,16 +1425,17 @@
)%0A%0A%0Adef
+_
handle_u
@@ -3083,16 +3083,17 @@
(target=
+_
handle_u
|
75ca3a769a2b59c013f625016d9c4b559909a8bb | add __repr__ | alfred/feedback.py | alfred/feedback.py | # -*- coding: utf-8 -*-
from xml.etree import ElementTree
import xml.sax.saxutils as saxutils
import os, copy, random
import core, util
class Item(object):
def __init__(self, **kwargs):
self.content = {
'title' : kwargs.get('title', ''),
'subtitle' : kwargs.get('subtitle', '')... | Python | 0.000917 | @@ -1797,32 +1797,83 @@
elf.items = %5B%5D%0A%0A
+ def __repr__(self):%0A return self.get()%0A%0A
def addItem(
|
84b22370caeb6fd493d9238922cc39c6c12f24d2 | Fix redirect admin | readthedocs/redirects/admin.py | readthedocs/redirects/admin.py | from __future__ import absolute_import
from django.contrib import admin
from .models import Redirect
class RedirectAdmin(admin.ModelAdmin):
list_display = ['project', 'redirect_type', 'from_url', 'to_url']
admin.site.register(Redirect, RedirectAdmin)
| Python | 0 | @@ -205,16 +205,49 @@
to_url'%5D
+%0A raw_id_fields = ('project',)
%0A%0Aadmin.
|
f4822a15ba2360d90da29f27e5ca0802a8feaf4b | Bump version to 12.1.5 | recipe_scrapers/__version__.py | recipe_scrapers/__version__.py | __version__ = "12.0.5"
| Python | 0 | @@ -15,9 +15,9 @@
%2212.
-0
+1
.5%22%0A
|
697f55cf757edd6587e00bbc98533133c00b6d10 | Update __version__ as it seems like I have forgotten how publishing works | recipe_scrapers/__version__.py | recipe_scrapers/__version__.py | __version__ = "13.5.0"
| Python | 0.000019 | @@ -15,9 +15,9 @@
%2213.
-5
+6
.0%22%0A
|
564940c0a588bb34455af499754b1be46d690c7b | Bump version to 12.0.5 | recipe_scrapers/__version__.py | recipe_scrapers/__version__.py | __version__ = "12.0.4"
| Python | 0 | @@ -17,7 +17,7 @@
2.0.
-4
+5
%22%0A
|
96f697fbfa00d3bff1f737d3a40c88b8b0f98546 | Return empty dict as config if config file doesn't exist | froggle.py | froggle.py | import argparse
from collections import defaultdict
import datetime
import json
import os
from freckle_client.client import FreckleClientV2
from api_client import TogglClientApi
FRECKLE_PROJECTS = None
def get_freckle_projects():
global FRECKLE_PROJECTS
if FRECKLE_PROJECTS is None:
FRECKLE_PROJECTS ... | Python | 0.000005 | @@ -3496,16 +3496,30 @@
load(f)%0A
+ return %7B%7D%0A
%0A%0Adef sa
|
0d23b9fa316da005db4d5591bfa616a014ae1a16 | Disable test on Mac OS X due to llvm.org/pr16769 | test/functionalities/longjmp/TestLongjmp.py | test/functionalities/longjmp/TestLongjmp.py | """
Test the use of setjmp/longjmp for non-local goto operations in a single-threaded inferior.
"""
import os
import unittest2
import lldb
import lldbutil
from lldbtest import *
class LongjmpTestCase(TestBase):
mydir = os.path.join("functionalities", "longjmp")
def setUp(self):
TestBase.setUp(self)
... | Python | 0 | @@ -314,16 +314,138 @@
(self)%0A%0A
+ @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp%0A
def
@@ -457,32 +457,32 @@
step_out(self):%0A
-
%22%22%22Test
@@ -610,32 +610,154 @@
elf.step_out()%0A%0A
+ @skipIfDarwin # llvm.org/pr16... |
cf18fe197f312135965af812eb4865f0ec836d16 | Rename default config to match invoke's | fabric/connection.py | fabric/connection.py | from invoke.config import Config, merge_dicts
from .utils import get_local_user
# NOTE: docs for this member are kept in sites/docs/api/connection.rst for
# tighter control over value display (avoids baking docs-building user's
# username into the docs).
default_config = {
'port': 22,
'user': get_local_user(... | Python | 0 | @@ -251,30 +251,31 @@
docs).%0A
-default_config
+global_defaults
= %7B%0A
@@ -1296,30 +1296,31 @@
py of %60.
-default_config
+global_defaults
%60.%0A%0A
@@ -1921,22 +1921,23 @@
lts=
-default_config
+global_defaults
, ov
|
b54a109386aeb22b8a7daa496795f85d16cec724 | Put try/catch around JS code | require-links/require-links.py | require-links/require-links.py | import re
import sublime
import sublime_plugin
import threading
import subprocess
import os
def open_require(view, requirePath):
js = "process.stdout.write(require.resolve('" + requirePath + "'))"
yargs = ['/usr/local/bin/node', '-e', js]
working_dir = os.path.dirname(os.path.realpath(view.file_name()))
... | Python | 0 | @@ -137,70 +137,166 @@
s =
-%22process.stdout.write(require.resolve('%22 + requirePath + %22'))%22
+(%0A %22try %7B%22%0A %22 var resolved = require.resolve('%22 + requirePath + %22');%22%0A %22 process.stdout.write(resolved);%22%0A %22%7D catch () %7B%7D%22%0A )
%0A
|
b9c54a3a7169bdaa04539f61f97489e2d7fc70ea | Remove test error trigger | cla_frontend/apps/status/views.py | cla_frontend/apps/status/views.py | import datetime
from django.http import JsonResponse
from django.shortcuts import render
from django.views.generic import View
from cla_common.smoketest import smoketest
from .smoketests import smoketests
def status(request):
if "error" in request.GET.keys():
raise Exception("ISSUE: %s" % datetime.datet... | Python | 0.000001 | @@ -227,109 +227,8 @@
t):%0A
- if %22error%22 in request.GET.keys():%0A raise Exception(%22ISSUE: %25s%22 %25 datetime.datetime.now())%0A
@@ -925,117 +925,8 @@
t):%0A
- if %22error%22 in request.GET.keys():%0A raise Exception(%22ISSUE: %25s%22 %25 datetime.datetime.now())%0A
|
9f29f28378e1cec515be66420db0a3e10c1dcae2 | increase coverage | test/responsetest.py | test/responsetest.py | #!/usr/bin/python2.4
#
# Copyright (c) 2004-2006 rPath, Inc.
#
# All rights reserved
#
import testsuite
testsuite.setup()
import simplejson
from mcp import client
from mcp import mcp_error
import mcp_helper
class ResponseTest(mcp_helper.MCPTest):
def getSlaveResponse(self):
if self.slaveResponse.respons... | Python | 0 | @@ -183,16 +183,41 @@
cp_error
+%0Afrom mcp import response
%0A%0Aimport
@@ -3327,16 +3327,874 @@
n', 3)%0A%0A
+ def testPostJobOutput(self):%0A self.slaveResponse.postJobOutput('dummy-build-5', 'dummy-dest',%0A %5B'http://foo/UUID', 'Dummy Build'%5D)%0A%0A re... |
57d42405e928230c4f9deb60773bf0fb6151386d | Update test name | test/src/unittests/tonal/test_pitchcrepe.py | test/src/unittests/tonal/test_pitchcrepe.py | #!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | Python | 0.000002 | @@ -2893,14 +2893,8 @@
mpty
-Signal
(sel
|
b6fb267ae6d9cb209ed7a84f3fef500b5b43f894 | Remove spurious assignment | breakseq2/breakseq_top.py | breakseq2/breakseq_top.py | #!/usr/bin/env python
import logging
import os
import subprocess
import pysam
import preprocess_and_align
import breakseq_core
import breakseq_post
import compute_zygosity
import gen_vcf
import breakseq_index
from _version import __version__
def add_options(main_parser):
preprocess_and_align.add_options(main_par... | Python | 0.000006 | @@ -1866,25 +1866,8 @@
nce%0A
- contigs = %5B%5D%0A
|
969b2d322174392a85f6fa6fc92160cb18144594 | Allow for empty tags and authors on `ContentSerializer` | bulbs/content/serializers.py | bulbs/content/serializers.py | from django import forms
from django.contrib.auth.models import User
from rest_framework import serializers
from .models import Content, Tag
class TagSerializer(serializers.ModelSerializer):
class Meta:
model = Tag
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
... | Python | 0 | @@ -665,16 +665,165 @@
k'%0A )
+%0A tags = serializers.PrimaryKeyRelatedField(many=True, required=False)%0A authors = serializers.PrimaryKeyRelatedField(many=True, required=False)
%0A%0A cl
|
5a9876c2975ee04ede5028bae498b7d0823e3053 | Translate app name | froide_campaign/apps.py | froide_campaign/apps.py | # -*- encoding: utf-8 -*-
from django.apps import AppConfig
class FroideCampaignConfig(AppConfig):
name = 'froide_campaign'
verbose_name = "Froide Campaign App"
def ready(self):
from .listeners import connect_info_object
from froide.foirequest.models import FoiRequest
FoiRequest.... | Python | 0.999985 | @@ -53,16 +53,72 @@
pConfig%0A
+from django.utils.translation import ugettext_lazy as _%0A
%0A%0Aclass
@@ -198,16 +198,18 @@
_name =
+_(
%22Froide
@@ -221,16 +221,17 @@
ign App%22
+)
%0A%0A de
|
c4b780d842c1ff3db00aa01a0bcfe9768250f8d7 | Update test_integrations_locally.py | tests/test_integrations_locally.py | tests/test_integrations_locally.py | import unittest
import numpy as np
import pickle
from syft.nn.linear import LinearClassifier
from syft.he.paillier import KeyPair, PaillierTensor
from capsule.django_client import LocalDjangoCapsuleClient
from syft.mpc.spdz import MPCRepo
from syft.mpc.spdz.tensor import SPDZMPCTensor
class PySyftNotebooks(unittest... | Python | 0.000001 | @@ -1052,16 +1052,17 @@
lf.asser
+t
Equal(ou
|
43c2a57040f58136e1a5e7ee3e84dcd4332ee6c7 | Allow verbose logging | untz_manager/__main__.py | untz_manager/__main__.py | """Main entry point for untz."""
import argparse
import logging
import multiprocessing
import os
from .encoder import encode_file
from .utils import preflight_checks, recursive_file_search
LOGGER = logging.getLogger(__name__)
def get_args():
"""Parse and return arguments."""
parser = argparse.ArgumentParser... | Python | 0.000009 | @@ -1851,24 +1851,205 @@
to spawn.')%0A
+ parser.add_argument('-v', '--verbose',%0A action='store_true',%0A dest='verbose',%0A help='Set verbose logging.')%0A
parser.a
@@ -2740,16 +2740,78 @@
_args()%0A
+%0A if args.verbose:%0A LOG... |
85d49bb1bb681a93452a911fe56f3e6516b45184 | is_success property | pyavatax/soap.py | pyavatax/soap.py | import suds
import socket
from pyavatax.base import AvalaraBase, AvalaraException, AvalaraBaseException
class AvaTaxSoapAPI(object):
live_wsdl = 'https://avatax.avalara.net/Tax/taxsvc.wsdl'
dev_wsdl = 'https://development.avalara.net/Tax/taxsvc.wsdl'
dev_url = 'https://development.avalara.net'
live_ur... | Python | 0.998965 | @@ -5935,24 +5935,137 @@
p_response%0A%0A
+ @property%0A def is_success(self):%0A return True if self.response.ResultCode == 'Success' else False%0A%0A
@propert
|
fabbc25e32203ec0fa854c85b77834534ec099f7 | Fix merge conflict | uoftscrapers/__init__.py | uoftscrapers/__init__.py | import logging
import os
import sys
from .scrapers.buildings import Buildings
from .scrapers.calendar.utsg import UTSGCalendar
from .scrapers.coursefinder import CourseFinder
from .scrapers.exams.utm import UTMExams
from .scrapers.exams.utsc import UTSCExams
from .scrapers.exams.utsg import UTSGExams
from .scrapers.fo... | Python | 0.000013 | @@ -616,56 +616,8 @@
ing%0A
-from .scrapers.utmathletics import UTMAthletics%0A
%0A%0Acl
|
048f8d8050c37f412460d1ee69686c9bdc857ea1 | Fix bug for loading images due to tuple unpacking | pybug/io/base.py | pybug/io/base.py | import abc
import os
import glob
import sys
def auto_import(pattern, meshes=True, images=True,
include_texture_images=False):
""" Smart data importer. Will match all files found on the glob pattern
passed in, build the relevant importers, and then call build() on them to
return a list of u... | Python | 0 | @@ -4343,24 +4343,29 @@
(f)%5B0%5D for f
+, ext
in image_pa
|
0ed3ed8b0ef9742df09945483c5886722a75499b | Add a test for user deadlines | test/scheduler/test_scheduler.py | test/scheduler/test_scheduler.py | """
Copyright (c) 2017 Genome Research Ltd.
Authors:
* Christopher Harrison <ch12@sanger.ac.uk>
* Simon Beal <sb48@sanger.ac.uk>
This program 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... | Python | 0.000001 | @@ -936,16 +936,32 @@
EADLINES
+, USER_DEADLINES
%0A%0A%0A_MOCK
@@ -1969,16 +1969,458 @@
imes))%0A%0A
+ def test_schedule_user_deadline(self, mock_scheduler):%0A s = Scheduler(*_MOCK_SCHEDULER_ARGS)%0A self.assertRaises(AssertionError, s.schedule_user_deadline, date.today(), %22foobar%22, None)%0A%0... |
37c4486e3944ee24e123d4dc4b8a7bc940a6d671 | Add poetry support. | src/setup.py | src/setup.py | # Copyright 2015 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.000005 | @@ -3727,52 +3727,42 @@
.8.4
-'%0A if sys.version_info.major %3C 3 else
+; python_version %3C %223.0%22',%0A
'go
@@ -3783,16 +3783,40 @@
n-client
+; python_version %3E %223.0%22
',%0A
@@ -3841,72 +3841,86 @@
.8.2
-'%0A if sys.version_info.major %3C 3 else 'google-auth%3E=1.0.0
+; python_... |
d1ca9686463a03d76dd604ed8e44fde2599c820d | Include command stderr in exception | pylib/command.py | pylib/command.py | import os
import psutil
import re
import resolve
import shlex
import subprocess
import threading
class Command(object):
PROJECT_COMMANDS = ['dotnet', 'cf']
BATCH_COMMANDS = ['gradlew', 'mvn', 'uaac']
COUNT = 0
COUNT_LOCK = threading.Lock()
def __init__(self, context, command, windowed=False, logf... | Python | 0.000006 | @@ -3183,16 +3183,29 @@
n code:
+%7B%7D, stderr:%5Cn
%7B%7D'.form
@@ -3214,16 +3214,29 @@
(self.rc
+, self.stderr
))%0A%0A
|
400078311bae2055a4d4ab6f5933439d6111e3cb | Fix typos in ReturnDict and ReturnList docstrings | rest_framework/utils/serializer_helpers.py | rest_framework/utils/serializer_helpers.py | from __future__ import unicode_literals
import collections
from collections import OrderedDict
from django.utils.encoding import force_text
from rest_framework.compat import unicode_to_repr
class ReturnDict(OrderedDict):
"""
Return object from `serialier.data` for the `Serializer` class.
Includes a bac... | Python | 0.000624 | @@ -250,32 +250,33 @@
ct from %60seriali
+z
er.data%60 for the
@@ -946,16 +946,17 @@
%60seriali
+z
er.data%60
|
98c079e60c5f40190986cf3711755f3e76642393 | test for determinism | tests_tf/test_mnist_tutorial_tf.py | tests_tf/test_mnist_tutorial_tf.py | import unittest
import numpy as np
from cleverhans.devtools.checks import CleverHansTest
class TestMNISTTutorialTF(CleverHansTest):
def test_mnist_tutorial_tf(self):
np.random.seed(42)
import tensorflow as tf
tf.set_random_seed(42)
from cleverhans_tutorials import mnist_tutorial... | Python | 0.000019 | @@ -1091,16 +1091,580 @@
, 0.4)%0A%0A
+ report_2 = mnist_tutorial_tf.mnist_tutorial(**test_dataset_indices)%0A self.assertClose(report.train_clean_train_clean_eval,%0A report_2.train_clean_train_clean_eval)%0A self.assertClose(report.train_clean_train_adv_eval,%0A ... |
8a473206bee03d985d557ea926a4df27bbba7889 | using the function is_auth | pymal/Account.py | pymal/Account.py | from xml.etree import ElementTree
from pymal.global_functions import _connect, connect
from pymal.decorators import load
from pymal.AccountAnimes import AccountAnimes
from pymal.AccountMangas import AccountMangas
from requests.auth import HTTPBasicAuth
class Account(object):
AUTH_CHECKER_URL = r'http://myanimelis... | Python | 0.999999 | @@ -2162,33 +2162,15 @@
elf.
-_
+is
_auth
-_object is not None
, %22N
|
4b96d814a77a3bf003c41459553c8c19a1bf5f80 | Add more tests for classify() method | test/test_emo_cls.py | test/test_emo_cls.py | #!/usr/bin/env python
# -*- encoding: utf-8
import unittest
from src.emo_cls import EmoClassifier
from src.ec_settings import POS, NEG, NO_CLASS
ec = EmoClassifier(terms_fn=None,
bigrams_fn=None,
trigrams_fn=None,
terms_by_root_form_fn=None,
... | Python | 0.000002 | @@ -54,16 +54,56 @@
nittest%0A
+%0Afrom nltk import NaiveBayesClassifier%0A%0A
from src
@@ -522,10 +522,17 @@
ify_
-v1
+emoticons
(sel
@@ -615,10 +615,16 @@
ify_
-v2
+nonwords
(sel
@@ -690,16 +690,2203 @@
1.0))%0A%0A
+ def test_classify_terms(self):%0A %22%22%22Test terms%22%22%22%0A ec._terms_by_ro... |
8dbb26e16549915dcb9b6773ead6c30d567b81e5 | Bump version | pynu/__init__.py | pynu/__init__.py | # -*- coding: utf-8 -*-
"""
Node utilities for Python.
"""
"""
Pynu - Python Node Utilities
Copyright (C) 2010 Juho Vepsäläinen
This program 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... | Python | 0 | @@ -102,17 +102,17 @@
(C) 201
-0
+3
Juho Ve
@@ -841,11 +841,11 @@
= '0.1.
-1
+2
'%0A
|
a413108444521751205a827d327843ed347d4022 | Fix ip behind lighttpd proxy | pystil/routes.py | pystil/routes.py | # -*- coding: utf-8 -*-
# Copyright (C) 2011-2013 by Florian Mounier, Kozea
# This file is part of pystil, licensed under a 3-clause BSD license.
from pystil.db import Visit
from pystil.tracking import Message
from pystil.aggregates import get_attribute_and_count
from pystil.context import Hdr, url, MESSAGE_QUEUE
from... | Python | 0.000001 | @@ -1498,32 +1498,93 @@
t'%5D,%0A
+ self.request.headers.get(%0A 'X-FORWARDED-FOR',
self.request.re
@@ -1583,32 +1583,33 @@
quest.remote_ip)
+)
%0A self.lo
|
14a80cbb72d370f74c8e32d0319350da08ee6348 | Implement CardXML.cardClass | fireplace/cardxml.py | fireplace/cardxml.py | import os
from xml.etree import ElementTree
from fireplace.enums import CardType, GameTag, PlayReq, Race, Rarity, Zone
class CardXML(object):
def __init__(self, xml):
self.xml = xml
def __str__(self):
return self.name
def __repr__(self):
return "<%s: %r>" % (self.id, self.name)
def _getRequirements(self,... | Python | 0.000001 | @@ -632,16 +632,86 @@
or %22%22%0A%0A
+%09@property%0A%09def cardClass(self):%0A%09%09return self.getTag(GameTag.CLASS)%0A%0A
%09@proper
|
03dc74261338ac6905526bac77b2c9374f317f7b | Support pep257 0.3.0 | flake8_docstrings.py | flake8_docstrings.py | # -*- coding: utf-8 -*-
"""pep257 docstrings convention needs error code and class parser for be
included as module into flakes8
"""
import pep257
__version__ = '0.1.4'
class pep257Checker(object):
"""flake8 needs a class to check python file."""
name = 'pep257'
version = __version__
def __init__(... | Python | 0 | @@ -164,9 +164,9 @@
0.1.
-4
+5
'%0A%0A%0A
@@ -503,28 +503,21 @@
-self.message
+error
s = list
@@ -560,18 +560,22 @@
'r') as
-fd
+handle
:%0A
@@ -585,19 +585,20 @@
for e
-lem
+rror
in pep2
@@ -604,260 +604,204 @@
257.
-check_source(fd.read(), self.filename):%0A self.messages.a... |
d06e472cb0a33d6aa927972a3d5e89e7ee392b2f | resolve deprecation warning | qsstats/utils.py | qsstats/utils.py | import datetime
import re
from dateutil.relativedelta import relativedelta, MO
from qsstats.exceptions import InvalidInterval
from qsstats import compat
def _remove_time(dt):
tzinfo = getattr(dt, 'tzinfo', compat.now().tzinfo)
return datetime.datetime(dt.year, dt.month, dt.day, tzinfo=tzinfo)
def _to_datetime... | Python | 0.00037 | @@ -472,16 +472,17 @@
e.match(
+r
'(%5Cd+)(%5B
|
226abc572d32c134783e6b149961c6fb2e7921c6 | Create .pc dir and dir for patches | quilt/cli/new.py | quilt/cli/new.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | Python | 0 | @@ -1690,16 +1690,198 @@
(%22.pc%22)%0A
+ if not db.exists():%0A db.create()%0A%0A pc_dir = Directory(os.path.join(%22.pc%22, newpatch))%0A # be sure that the directory is clear%0A pc_dir.delete()%0A pc_dir.create()%0A%0A
top
|
a4ec20a6a9d116eb1f82fd146e4bb7a2fad5a516 | Fix url check | quotes/models.py | quotes/models.py | # coding: utf-8
from datetime import datetime
from django.db import models
from django.core.urlresolvers import reverse
from sorl.thumbnail import ImageField, get_thumbnail
from sorl.thumbnail.helpers import ThumbnailError
class Author(models.Model):
name = models.CharField(max_length=200)
short_bio = model... | Python | 0.000008 | @@ -861,22 +861,27 @@
-return
+thumbnail =
get_thu
@@ -1031,16 +1031,75 @@
lity=70)
+%0A if thumbnail:%0A return thumbnail
.url%0A
|
d95f448cbf8072205a104a7ef5e2e4db40d68756 | Add popagate_network_log option to grab.tools.logs.default_logging | grab/tools/logs.py | grab/tools/logs.py | import logging
def default_logging(grab_log='/tmp/grab.log', level=logging.DEBUG, mode='a',
network_log='/tmp/grab.network.log'):
"""
Customize logging output to display all log messages
except grab network logs.
Redirect grab network logs into file.
"""
logging.basicConfi... | Python | 0.000001 | @@ -86,16 +86,68 @@
de='a',%0A
+ propagate_network_logger=False,%0A
@@ -467,21 +467,40 @@
agate =
-False
+propagate_network_logger
%0A if
|
c9ee650e72b0fefc7fdf3606cfc0f93dde54d01b | Fix format for deleted branches | foomodules/GitLog.py | foomodules/GitLog.py | import logging
import foomodules.Base as Base
logger = logging.getLogger(__name__)
xmlns = "http://hub.sotecware.net/xmpp/git-post-update"
class GitLog(Base.XMPPObject):
REPOSITORY_NODE = "{{{0}}}repository".format(xmlns)
REF_NODE = "{{{0}}}ref".format(xmlns)
def __init__(self, pubsub_node, pubsub_host=... | Python | 0.000001 | @@ -2723,17 +2723,17 @@
%22%7Brepo%7D
-/
+:
%7Bbranch%7D
|
ac72fa6b58da7b8866f37e489702c359729f8d53 | Remove invalid test | tests/sentry/web/frontend/projects/tests.py | tests/sentry/web/frontend/projects/tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import logging
from django.core.urlresolvers import reverse
from exam import fixture
from sentry.models import ProjectKey, ProjectKeyStatus, ProjectOption, TagKey
from sentry.testutils import TestCase
logger = logging.getLogger(__name__... | Python | 0.000009 | @@ -220,23 +220,8 @@
tus,
- ProjectOption,
Tag
@@ -5033,475 +5033,4 @@
ist%0A
-%0A resp = self.client.post(self.path, %7B%0A 'filters': %5B'site', 'url'%5D,%0A 'annotations': %5B'os'%5D,%0A %7D)%0A assert resp.status_code == 302%0A enabled_filters = ProjectOption.ob... |
8d6d6d5d23649a10cab17f04b8fa102809ce3f11 | Fix typo in docstrings (#8764) | frappe/core/utils.py | frappe/core/utils.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
def get_parent_doc(doc):
"""Returns document of `reference_doctype`, `reference_doctype`"""
if not hasattr(doc, "parent_doc"):
if doc.reference_doctype and doc... | Python | 0 | @@ -1170,24 +1170,25 @@
of_dict, lam
+b
da d: d%5B'nam
@@ -1640,16 +1640,17 @@
pes, lam
+b
da d: d%5B
@@ -1773,12 +1773,13 @@
return found
+%0A
|
24da786d24f4a0677f18b7ef877377d933f0fec4 | Make sure all tests are run even if one fails | frigg/worker/jobs.py | frigg/worker/jobs.py | # -*- coding: utf8 -*-
import json
import os
import yaml
import logging
from fabric.context_managers import lcd
from frigg import api
from frigg.helpers import local_run, detect_test_runners, cached_property
from .config import config, sentry
logger = logging.getLogger(__name__)
class Result(object):
log = ''
... | Python | 0.000002 | @@ -2298,149 +2298,8 @@
ask)
-%0A if self.succeeded is False:%0A # if one task fails, we do not care about the rest%0A break
%0A%0A
|
7183f6c0c4487aa65a12100e2b92cb7fe95b118b | Add regression tests for ReportViewSet.listify | api/test/test_reports.py | api/test/test_reports.py | import datetime
import json
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from api.views import (
ReportsViewSet,
)
from api.serializers import InstructorNumTaughtSerializer
from workshops.models import (
Badge,
Award,
Person... | Python | 0 | @@ -20,16 +20,52 @@
ort json
+%0Afrom unittest.mock import MagicMock
%0A%0Afrom d
@@ -103,16 +103,50 @@
reverse%0A
+from django.http import QueryDict%0A
from res
@@ -2655,8 +2655,2036 @@
ecting)%0A
+%0A%0Aclass TestCSVYAMLListSerialization(BaseReportingTest):%0A def setUp(self):%0A self.iterable = zip(%5... |
8eaa3e2c19f5d907eacf1e308ad410769ccc4101 | Update externsExtractor.py | tools/externs-extractor/externsExtractor.py | tools/externs-extractor/externsExtractor.py | #!/usr/bin/python2
import os
from optparse import OptionParser
from extractors.elementsExtractor import extractElements
def getPaths(path):
paths = list()
pathsListFile = open(path, 'r')
pathsList = pathsListFile.read().splitlines()
for path in pathsList:
if path:
paths.append('./... | Python | 0 | @@ -14,9 +14,8 @@
thon
-2
%0A%0Aim
|
2fb66af07b38b4744fab53f86c2ac6048e47e9bc | Make geocode CLI PEP-8 compliant | geocode.py | geocode.py | import click
import geocoder
import unicodecsv
import sys
@click.command()
@click.argument('location', required=False)
@click.option('--provider', default='bing')
@click.option('--input', type=click.File('r'))
@click.option('--output', type=click.File('w'), default='-')
@click.option('--fieldnames')
def cli(location... | Python | 0.00024 | @@ -4,21 +4,20 @@
ort
-click
+sys%0A
%0Aimport
geoc
@@ -12,24 +12,21 @@
%0Aimport
-geocoder
+click
%0Aimport
@@ -36,27 +36,32 @@
codecsv%0A
+%0A
import
-sys%0A
+geocoder
%0A%0A@click
@@ -758,28 +758,16 @@
ovider)%0A
-
%0A
@@ -1110,24 +1110,16 @@
g.json)%0A
-
%0A
@@ -11... |
556dec981b7a7f204b01a7e83d1af80b18228da8 | Fix Bugs | get-dns.py | get-dns.py | __author__ = 'Taio'
import os.path
import dns.querry
import dns.zone
import logging
from utils.noflib import Noflib
run = Noflib()
logger = logging.getLogger('get-dns')
logging.basicConfig(filename='get-dns.log', level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
dcAdd = '172.20.10... | Python | 0.000003 | @@ -45,17 +45,16 @@
dns.quer
-r
y%0Aimport
@@ -373,17 +373,16 @@
dns.quer
-r
y.xfr(dc
@@ -384,17 +384,16 @@
fr(dcAdd
-)
, domain
@@ -397,16 +397,17 @@
ainName)
+)
%0Anames =
@@ -515,32 +515,63 @@
for i in names:%0A
+ if i.find('IN A'):%0A
print z%5B
@@ -950,16 +950,44 @@
')%0A%0A
+prin... |
70434e9a752b88aae2a741bafb1427e69da8654c | Update metadata api | app/apis/metadata_api.py | app/apis/metadata_api.py | from flask import Blueprint, jsonify, request
from inflection import singularize
from app import redis
from os import path
import pickle
blueprint = Blueprint('metadata_api', __name__, url_prefix='/metadata')
@blueprint.route('/<string:data>/<string:id>')
@blueprint.route('/<string:data>')
def api(data, id=... | Python | 0.000001 | @@ -447,16 +447,34 @@
oletres'
+,%0D%0A 'cnes',
%0D%0A %5D%0D
|
dda91ae23ece88abebc3ff9dbbaf163d05ceaf39 | Simplify namespace | gutter/__init__.py | gutter/__init__.py | from .client import RainwaveClient
| Python | 0.999074 | @@ -28,8 +28,183 @@
eClient%0A
+from .channel import RainwaveChannel%0Afrom .album import RainwaveAlbum%0Afrom .artist import RainwaveArtist%0Afrom .cooldown import RainwaveCooldown%0Afrom .song import RainwaveSong%0A
|
a56c744af8c1a96631d990c2a398aedcd24a78de | Set the response's mimetype. Motion cannot process HTTP responses without an image mimetype. | rtsp2snapshot.py | rtsp2snapshot.py | #!/usr/bin/env python
import io
import platform
import shlex
import subprocess
from flask import Flask, request, send_file, send_from_directory
app = Flask(__name__)
tmp_dir = '/tmp/'
tmp_filename = 'snapshot.jpg'
@app.route('/<path:url>')
def snapshot(url):
freebsd_platform = platform.system() == 'FreeBSD'
... | Python | 0.000022 | @@ -825,29 +825,122 @@
tmp_dir,
- tmp_filename
+%0A tmp_filename,%0A mimetype='image/jpeg'
)%0A re
|
37aa3ae42dafe58ca29152f75a36ea77b792393e | rename 'project.home.user' to 'project.dash' | example/urls.py | example/urls.py | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.core.urlreso... | Python | 0.00688 | @@ -892,17 +892,12 @@
ect.
-home.user
+dash
'%0A
@@ -1199,9 +1199,8 @@
terns()%0A
-%0A
|
66f273cb3ba7a6a81ff7185405aa9f06c4fb1179 | fix plugin module loading | PluginRegistry/__init__.py | PluginRegistry/__init__.py | import os
import logging
import traceback
from copy import copy
import sys
class PluginRegistry(object):
def __init__(self, registry_version="0.1"):
self.__plugins = {}
self.__enabled = {}
self.__disabled = []
self.__registry_version = registry_version
def __getitem__(self, pl... | Python | 0 | @@ -731,16 +731,29 @@
mport__(
+%22Plugins.%22 +
plugin,
@@ -780,16 +780,61 @@
%5B%5D, 0)%0A
+ module = getattr(module, plugin)%0A
@@ -2120,16 +2120,22 @@
= plugin
+_class
%0A
|
c6923d72f3ce68e8d5bb3e2354f86e6d6c5dbf27 | update begin/end time of children only if parent unmodified | ebu_tt_live/node/delay.py | ebu_tt_live/node/delay.py |
from .base import Node
from datetime import timedelta
from ebu_tt_live.bindings._ebuttdt import LimitedClockTimingType, FullClockTimingType
import time
import random
class FixedDelayNode(Node):
_reference_clock = None
_sequence = None
def __init__(self, node_id, carriage_impl, reference_clock):
... | Python | 0 | @@ -2639,16 +2639,187 @@
smpte%0A%0A
+ if not (hasattr(child.value, 'begin') and child.value.begin != None) and %5C%0A not (hasattr(child.value, 'end') and child.value.end != None):%0A%0A
|
813802b70368c7df5747d797628221286988285b | Simplify the XSS test slightly | tests/app/main/views/test_xss.py | tests/app/main/views/test_xss.py | # coding=utf-8
from __future__ import unicode_literals
import mock
from ...helpers import LoggedInApplicationTest
from dmapiclient import HTTPError
import urllib
class TestXSS(LoggedInApplicationTest):
@mock.patch('app.main.views.services.data_api_client')
def test_service_not_found_flash_message_injection(s... | Python | 0 | @@ -932,127 +932,57 @@
tIn(
-%0A b'Error trying to retrieve service with ID: ' + evil_service_id.encode('utf8'),%0A response2.data
+evil_service_id, response2.get_data(as_text=True)
)%0A%0A
@@ -1568,115 +1568,52 @@
tIn(
-%0A b'There are no opportunities with ID ' + evil_brief_id.enc... |
e73a877b14c908cab8ebdbcb621d468bdcdeed9f | Fix style | tests/cases/api_describe_test.py | tests/cases/api_describe_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... | Python | 0.000001 | @@ -2503,17 +2503,16 @@
ody')%0A%0A%0A
-%0A
def setU
|
b37dbe0893c9810185a31d1b6ce61628e034b602 | Read in a fiona.Env() block to make sure GDAL_DATA is set (#916) | geopandas/io/file.py | geopandas/io/file.py | import os
from distutils.version import LooseVersion
import fiona
import numpy as np
import six
try:
from fiona import Env as fiona_env
except ImportError:
from fiona import drivers as fiona_env
from geopandas import GeoDataFrame, GeoSeries
_FIONA18 = LooseVersion(fiona.__version__) >= LooseVersion('1.8')... | Python | 0 | @@ -1978,16 +1978,42 @@
a.open%0A%0A
+ with fiona_env():%0A
with
@@ -2066,16 +2066,20 @@
+
crs = fe
@@ -2097,16 +2097,20 @@
+
+
if bbox
@@ -2118,24 +2118,28 @@
s not None:%0A
+
@@ -2200,24 +2200,28 @@
GeoSeries):%0A
+
@@ -2280,16 +2280,20... |
c6d241575f1eeb6a05b5ddd97920ad10d7519651 | Remove realm field in hostgroup resource. | alignak_backend/models/hostgroup.py | alignak_backend/models/hostgroup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Resource information of hostgroup
"""
def get_name():
"""
Get name of this resource
:return: name of this resource
:rtype: str
"""
return 'hostgroup'
def get_schema():
"""
Schema structure of this resource
:return: schema dictio... | Python | 0 | @@ -2551,394 +2551,8 @@
%7D,%0A
- # Still of interest? Each host got from Alignak configuration has its own realm ...%0A # ... so this value is not useful because host realm takes precedence.%0A 'realm': %7B%0A 'type': 'objectid',%0A 'data_relation': %7B%... |
b3c1868c778705f4f65f156e0f91de2e4e1702d2 | Fix tests | tests/examples/shipment/tests.py | tests/examples/shipment/tests.py | import os
import tempfile
from django.test import TestCase
from viewflow.graphviz import diagram
from viewflow.models import Task
from viewflow.test import FlowTest
from examples.shipment.flows import ShipmentFlow
from examples.shipment.models import Carrier
class ShipmentFlowDiagrammTests(TestCase):
... | Python | 0.000003 | @@ -643,24 +643,387 @@
a.json'%5D%0D%0A%0D%0A
+ sample_shipment = %7B%0D%0A 'shipment_no': '#TST-20140101-1',%0D%0A 'first_name': 'John',%0D%0A 'last_name': 'Doe',%0D%0A 'email': 'john@doe.com',%0D%0A 'phone': '+1-555000111',%0D%0A 'address': 'Nowhere St, 21',%0D%0A ... |
40dfb4a8bf50a6698e1be2ac574557d22da3fed0 | fix links patch basic operation | resource/HypermediaResource.py | resource/HypermediaResource.py |
import json
import terms as v
from Links import Links
class HypermediaResource(object) :
def __init__(self):
self._contentFormats = {}
LinkFormatHandler(self)
LinkFormatPatchHandler(self)
PlainTextHandler(self)
SenmlValueHandler(self)
self._value = {v... | Python | 0 | @@ -1842,27 +1842,16 @@
tMerge(
-json.loads(
request%5B
@@ -1861,17 +1861,16 @@
riQuery%5D
-)
, json.l
|
f4d508e0330c25925331246ac4c4c8f346ca4aa2 | Use owner since speaker may be null. | funnel/views/session.py | funnel/views/session.py | # -*- coding: utf-8 -*-
from pytz import timezone as pytz_timezone
from baseframe import _
from flask import request, render_template, jsonify
from coaster.views import load_models
from .helpers import localize_date
from .. import app, lastuser
from ..models import db, Proposal, ProposalSpace, Session
from ..forms im... | Python | 0 | @@ -1000,21 +1000,19 @@
roposal.
-speak
+own
er.fulln
|
6c87c5c160228503f848e3039d1e33362d69f411 | Test helper fill_form: support for skipping fields and relation fields | tests/helpers/webtest_helpers.py | tests/helpers/webtest_helpers.py | from enum import Enum
def python_to_deform_value(py_value):
if py_value is True:
return 'true'
elif py_value is False:
return None
elif py_value is None:
return ''
elif isinstance(py_value, Enum):
return py_value.name
else:
return str(py_value)
def assert_... | Python | 0 | @@ -1329,16 +1329,38 @@
ld_names
+, relation_field_names
):%0A i
@@ -1439,48 +1439,245 @@
-else:%0A value = data%5Bfield_name%5D%0A%0A
+ form.set(field_name, value)%0A elif field_name in relation_field_names:%0A value = data%5Bfield_name%5D.id%0A print(field_name, value)%0A ... |
a8bdbe6dee60df1f19e59e15063db6a89abf5a91 | Drop Py2 and six on salt/auth/pki.py | salt/auth/pki.py | salt/auth/pki.py | # -*- coding: utf-8 -*-
# Majority of code shamelessly stolen from
# http://www.v13.gr/blog/?p=303
"""
Authenticate via a PKI certificate.
.. note::
This module is Experimental and should be used with caution
Provides an authenticate function that will allow the caller to authenticate
a user via their public cer... | Python | 0 | @@ -1,28 +1,4 @@
-# -*- coding: utf-8 -*-%0A
# Ma
@@ -457,188 +457,48 @@
%22%22%22%0A
-# Import python libs%0Afrom __future__ import absolute_import, print_function, unicode_literals%0A%0Aimport logging%0A%0A# Import salt libs%0Aimport salt.utils.files%0A%0A# Import third party libs
+import logging%0A%0Aimport salt.u... |
3f7cc64a10435db0d48d52590a7802a2930ff83d | add copyright header | src/bat/jffs2.py | src/bat/jffs2.py | import os, sys, subprocess, re, zlib, tempfile
def readJFFS2Inodes(path):
p = subprocess.Popen(['jffs2dump', '-cv', path], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
(stanout, stanerr) = p.communicate()
if p.returncode != 0:
return ([], [])
st = stanout.split("\n")
#... | Python | 0 | @@ -41,16 +41,173 @@
mpfile%0A%0A
+## Binary Analysis Tool%0A## Copyright 2011 Armijn Hemel for Tjaldur Software Governance Solutions%0A## Licensed under Apache 2.0, see LICENSE file for details%0A%0A
def read
|
d08b537384abf477112188a73122b4d06ba812ee | test send_mail | src/bccf/cron.py | src/bccf/cron.py | from django_cron import CronJobBase, Schedule
from django.db.models import Q
from django.utils.timezone import now
from dateutil.relativedelta import relativedelta
from django.contrib.auth.models import User
from bccf.models import Event, EventRegistration
from bccf.util import emailutil as email
class EventPaymentR... | Python | 0.000001 | @@ -1049,16 +1049,21 @@
eminder(
+self.
email_ti
|
a19893350918eff93a9d4b3fbbe0980baa3cb0e6 | Enhance lock management | src/sakia/main.py | src/sakia/main.py | import asyncio
import logging
import signal
import sys
import traceback
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QMessageBox
from duniterpy.api.errors import DuniterError
from sakia.helpers import single_instance_lock, cleanup_lock
from quamash import QSelectorEventLoop
from sakia.errors ... | Python | 0 | @@ -2740,16 +2740,79 @@
t lock:%0A
+ lock = single_instance_lock()%0A if not lock:%0A
@@ -2848,29 +2848,39 @@
akia
- is already running%22,
+%22,%0A
%22Sa
@@ -2901,24 +2901,29 @@
running.%22)%0A
+%0A
sys.
|
9fac37588c4f15446397638c72efc79bfcf0d636 | Allow textual responses when using test_client and aiohttp 2 | sanic/testing.py | sanic/testing.py | import traceback
from json import JSONDecodeError
from sanic.log import log
HOST = '127.0.0.1'
PORT = 42101
class SanicTestClient:
def __init__(self, app):
self.app = app
async def _local_request(self, method, uri, cookies=None, *args, **kwargs):
import aiohttp
if uri.startswith(('h... | Python | 0 | @@ -1092,16 +1092,45 @@
odeError
+, aiohttp.ClientResponseError
):%0A
|
badbf0ee8634101d6dcdca288670ca4fcb2b871e | Update __init__.py | hvac/api/secrets_engines/__init__.py | hvac/api/secrets_engines/__init__.py | """Vault secrets engines endpoints"""
from hvac.api.secrets_engines.aws import Aws
from hvac.api.secrets_engines.azure import Azure
from hvac.api.secrets_engines.gcp import Gcp
from hvac.api.secrets_engines.identity import Identity
from hvac.api.secrets_engines.kv import Kv
from hvac.api.secrets_engines.pki import Pki
... | Python | 0.000072 | @@ -170,16 +170,72 @@
ort Gcp%0A
+from hvac.api.secrets_engines.ad import ActiveDirectory%0A
from hva
@@ -281,16 +281,16 @@
dentity%0A
-
from hva
@@ -729,16 +729,39 @@
'Gcp',%0A
+ 'ActiveDirectory',%0A
'Ide
@@ -1006,16 +1006,41 @@
Gcp,%0A
+ ActiveDirectory,%0A
@@ -1131,16 +1131,16 @@
... |
48cb6d920aa1ab030465882e978c8b9006e38b72 | Bump app version to 2020.6.0 | app/handlers/__init__.py | app/handlers/__init__.py | __version__ = "2020.5.0"
__versionfull__ = __version__
| Python | 0 | @@ -17,9 +17,9 @@
020.
-5
+6
.0%22%0A
|
62c7b723638bf76463209834e1c50d0728951929 | add repr for shell outputs | scaler/models.py | scaler/models.py | from uuid import uuid4
from dynoup import db
from sqlalchemy.dialects.postgresql import UUID, JSON
class User(db.Model):
id = db.Column(UUID(as_uuid=True), primary_key=True)
email = db.Column(db.String(120), nullable=False)
htoken = db.Column(db.String(512), nullable=False)
# track many-to-many relati... | Python | 0.000001 | @@ -285,16 +285,100 @@
False)%0A%0A
+ def __repr__(self):%0A return '%3CUser %7B%7D (%7B%7D)%3E'.format(self.email, self.id)%0A
%0A# track
@@ -918,16 +918,99 @@
amic')%0A%0A
+ def __repr__(self):%0A return '%3CApp %7B%7D (%7B%7D)%3E'.format(self.name, self.id)%0A%0A
%0Aclass C
@@ -1241,16 +1241,... |
b67baab2bd60d597275ce39c6e91bdab4a55d464 | Fix doubles teardown (#135) | doubles/pytest_plugin.py | doubles/pytest_plugin.py | import pytest
from doubles.lifecycle import teardown, verify
@pytest.hookimpl(hookwrapper=True)
def pytest_pyfunc_call(pyfuncitem):
outcome = yield
try:
outcome.get_result()
verify()
finally:
teardown()
| Python | 0 | @@ -107,26 +107,21 @@
est_
-pyfunc_call(pyfunc
+runtest_call(
item
|
e0ddd80ea2d23f9b5fc32dd8a5ea13f9cb30da49 | Add api for package search based on name and keywords | app/packages/__init__.py | app/packages/__init__.py | from flask import Blueprint
packages = Blueprint('packages', __name__)
from . import views, models
from utils import github_data
def post_get_single(result=None, **kw):
result.update(result.pop("get_json"))
result.update(github_data(result['name'], result['author'], result['url']))
# runs for search requ... | Python | 0 | @@ -462,334 +462,1457 @@
def
-api_creator(apimanager):%0A apimanager.create_api(models.Package, primary_key='name', methods=%5B'GET'%5D,%0A include_methods=%5B'get_json'%5D,%0A include_columns=%5B%5D,%0A postprocessors=%7B%0A 'GET_SI... |
8b7498e71bf9d258b4aebebb0e2e33f9506c780c | Update scrap.py | scripts/scrap.py | scripts/scrap.py | from bs4 import BeautifulSoup
from zipfile import ZipFile
import requests
import os
import re
ACTUAL_TERM = 10
MEDIA_ROOT = '/home/pmartin/tmp/playingwithapis/scraper'
# url = raw_input("Enter an url: ")
# r = requests.get("http://" +url)
# data = r.text
# soup = BeautifulSoup(data)
# for link in soup.find_all('a'):... | Python | 0 | @@ -124,48 +124,41 @@
= '/
-home/pmartin/tmp/playingwithapis/scraper
+PATH/TO/YOUR/SCRAPPER/TEMP/FOLDER
'%0A%0A#
|
b6562fad5f8cfb3dec578f7c3613d75282ad4f45 | Bump version | rest_witchcraft/__version__.py | rest_witchcraft/__version__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
__author__ = 'Serkan Hosca'
__author_email__ = 'serkan@hosca.com'
__version__ = '0.0.4'
__description__ = 'SQLAlchemy specific things for django-rest-framework'
| Python | 0 | @@ -180,9 +180,9 @@
0.0.
-4
+5
'%0A__
|
b26b3c3a2d6c0d0ca6167cd787d61c3349199ac9 | Fix bug | imgfilter/analyzers/reduce_colors.py | imgfilter/analyzers/reduce_colors.py | """
Analyzer for reducing the number of colors in an image to a
certain amount. Uses the k-nearest neighbors method.
"""
from analyzer import Analyzer
import cv2
import numpy
def reduce_colors(image, colors):
"""Reduces the number of colors in a given image to certain
amount. The algorithm uses the k-neares... | Python | 0.000001 | @@ -949,11 +949,18 @@
ans(
+data=
Z,
+K=
colo
@@ -971,20 +971,25 @@
criteria
-, 10
+=criteria
,%0A
@@ -1018,16 +1018,35 @@
+attempts=10, flags=
cv2.KMEA
@@ -1052,22 +1052,18 @@
ANS_
-RANDOM
+PP
_CENTERS
)%0A%0A
@@ -1058,16 +1058,69 @@
_CENTERS
+,%0A bestLab... |
648c77bd2303a2562743f541d00f6168a0a5e227 | make imports bulletproof for python2&3 | geosquizzy/structure.py | geosquizzy/structure.py | from copy import deepcopy
import geosquizzy.utils as utils
import geosquizzy.tokenizer as tokenizer
import geosquizzy.fsm as fsm
class Tree:
def __init__(self, *args, **kwargs):
self.leaf = dict({'id': None, 'name': None, 'children': [], 'level': 0,
'parent': None, 'completed': F... | Python | 0.000013 | @@ -3125,16 +3125,18 @@
%0A
+ #
super(F
@@ -3180,16 +3180,61 @@
kwargs)%0A
+ Tree.__init__(self, *args, **kwargs)%0A
%0A%0Aclass
|
ee3baee31dd91acd1f94795ecc46683dba69f8a3 | fix subdirs again | exportImages.py | exportImages.py | """
Copyright 2014-2015 darkf
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
dis... | Python | 0.000001 | @@ -1247,12 +1247,9 @@
rs%22,
-) #(
+
%22ski
|
8db2aefd1d4c7714975916c6650f68a599d52f48 | fix wrong identation in kcli dynamic inventory | extras/klist.py | extras/klist.py | #!/usr/local/bin/python
from kvirt.config import Kconfig
import json
import os
import argparse
def empty():
return {'_meta': {'hostvars': {}}}
class KcliInventory(object):
def __init__(self):
self.inventory = {}
self.read_cli_args()
config = Kconfig(quiet=True)
self.host = ... | Python | 0.000001 | @@ -2164,27 +2164,14 @@
%5D =
-%22-o ProxyCommand=%22%0A
+%5C%0A
@@ -2183,16 +2183,32 @@
%22
+-o ProxyCommand=
'ssh -p
|
f25843bfe8bbe581c575630c41f8c4e686f808a6 | Use print_function | fabfile/help.py | fabfile/help.py | # Module: help
# Date: 28th November 2013
# Author: James Mills, j dot mills at griffith dot edu dot au
"""Help Tasks"""
from fabric import state
from fabric.api import task
from fabric.tasks import Task
from fabric.task_utils import crawl
@task(default=True)
def help(name=None):
"""Display help for a ... | Python | 0.001533 | @@ -125,16 +125,56 @@
ks%22%22%22%0A%0A%0A
+from __future__ import print_function%0A%0A%0A
from fab
|
0b91f045260396308a2cda207765cef7e0a62f7c | work on the grapher | grapher/npbackend.py | grapher/npbackend.py | from graph import *
import numpy as np
class Npbackend(Graph):
def render(self, data, order=None, baseline=None, highest=None):
#Lets generate the vcache=10 graphs and with matmul
for s in set([script for script, bridge, vem, ve, r in data]):
res = {}
for script, bridge,... | Python | 0.000001 | @@ -702,37 +702,18 @@
es%5B'
-npbacked-pygpu (vcache=10)N/A
+BohriumCPU
'%5D,%0A
@@ -743,18 +743,37 @@
es%5B'
-BohriumGPU
+npbacked-pygpu (vcache=10)N/A
'%5D,%0A
@@ -802,25 +802,25 @@
res%5B'Bohrium
-C
+G
PU'%5D%5D:%0A
@@ -935,16 +935,31 @@
umexpr',
+ 'Bohrium-CPU',
'libgpu
@@ -979,31 +979,16 @@
ium-GPU'... |
8b143188b79c9a8b89ad44d2921d4f4eb2ad8cf4 | Simplify definition and add typing | growler/responder.py | growler/responder.py | #
# growler/responder.py
#
"""
Event loop independent class for managing clients' requests and
server responses.
"""
import abc
class GrowlerResponder(abc.ABC):
"""
Abstract base class for 'responder' objects that handle the
stream of client data.
Responders are designed to be event-loop independent... | Python | 0 | @@ -115,18 +115,142 @@
%22%22%0A%0A
-import abc
+from typing import Optional%0Afrom asyncio import BaseTransport%0Afrom socket import socket as Socket%0A%0Afrom abc import ABC, abstractmethod
%0A%0A%0Ac
@@ -271,20 +271,16 @@
sponder(
-abc.
ABC):%0A
@@ -696,34 +696,29 @@
an.%0A %22%22%22%0A
-%0A
@
-abc.
... |
437bf55d423b08f68881d4f70acd91f7028d6fe6 | Reset the timezone offset for every new file | gpxfile.py | gpxfile.py | #!/usr/bin/python
# gpximport.py - Used to import GPX XML files into applications
# This file was taken from GPX Viewer and modified for Taggert
# GPX Viewer homepage: http://andrewgee.org/blog/projects/gpxviewer/
#
# Original code copyright (C) 2009 Andrew Gee
# Modifications copyright (C) 2012 Martijn Grendelman
#f... | Python | 0.000002 | @@ -753,16 +753,42 @@
one(tz)%0A
+ self.delta = None%0A
|
482d69add9d41aff8b849dfc91e92116f0d339ff | Fix specifically allowed users being bounced from servers | dog/ext/gatekeeper/cog.py | dog/ext/gatekeeper/cog.py | import datetime
import io
import logging
from typing import Optional
import discord
from discord.ext import commands
from lifesaver.bot import Cog, Context, group
from lifesaver.utils import human_delta
from ruamel.yaml import YAML
from dog.ext.gatekeeper import checks
from dog.ext.gatekeeper.core import Block, Repor... | Python | 0.000001 | @@ -5548,32 +5548,95 @@
return%0A%0A
+ keeper = Keeper(member.guild, settings, bot=self.bot)%0A%0A
overridd
@@ -5764,62 +5764,34 @@
-keeper = Keeper(member.guild, settings, bot=self.bot)%0A
+if not is_overridden:%0A
@@ -5846,32 +5846,14 @@
-if not is_overridden and
+ if... |
c005060ef11d8e0dd1f96bd3bea8ba409896067f | Correct typo in script logging | dogen/plugins/dist_git.py | dogen/plugins/dist_git.py | import os
import shutil
import subprocess
from dogen.tools import Tools, Chdir
from dogen.plugin import Plugin
class DistGitPlugin(Plugin):
@staticmethod
def info():
return "dist-git", "Support for dist-git repositories"
@staticmethod
def inject_args(parser):
parser.add_argument('--di... | Python | 0.000011 | @@ -1801,24 +1801,25 @@
code, commit
+t
ing skipped%22
@@ -3675,16 +3675,17 @@
p commit
+t
ing%0A
|
ff14be8c93455634a62176cd35e86f59d77bcd4a | Add unit test that lstm embeddings freeze | tests/metal/modules/test_lstm.py | tests/metal/modules/test_lstm.py | import unittest
import numpy as np
import torch
from metal.end_model import EndModel
from metal.modules import LSTMModule
n = 1000
SEQ_LEN = 5
MAX_INT = 8
class LSTMTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
# Set seed
torch.manual_seed(1)
np.random.seed(1)
def ... | Python | 0 | @@ -2582,16 +2582,1688 @@
0.95)%0A%0A
+ def test_lstm_embeddings_freeze(self):%0A %22%22%22Confirm that if embeddings are frozen, they do not change during training%22%22%22%0A X = torch.randint(1, MAX_INT + 1, (n, SEQ_LEN)).long()%0A Y = torch.zeros(n).long()%0A needles = np.random.ran... |
13c89609020de8b5f2318211f6ab1a382872b6b7 | clean stuffs up | feather/http.py | feather/http.py | import BaseHTTPServer
import httplib
import itertools
import socket
import traceback
import urlparse
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from feather import connections, requests
__all__ = ["InputFile", "HTTPError", "HTTPRequest", "HTTPRequestHandler",
... | Python | 0.000002 | @@ -97,102 +97,8 @@
arse
-%0Atry:%0A from cStringIO import StringIO%0Aexcept ImportError:%0A from StringIO import StringIO
%0A%0Afr
@@ -2904,16 +2904,17 @@
Allowed%0A
+%0A
@@ -3438,16 +3438,69 @@
rror()%0A%0A
+ do_POST = do_PUT = do_HEAD = do_DELETE = do_GET%0A%0A
%0Aclass H
|
30507f4edbcf627e4fa0fe9f31ca5ff0cda54d22 | Fix issue when address cache doesn't return data | src/oscarapicheckout/cache.py | src/oscarapicheckout/cache.py | from django.core.cache import cache
from django.utils.module_loading import import_string
from rest_framework import serializers
from oscar.core.loading import get_model
from . import settings as pkgsettings
Country = get_model('address', 'Country')
class EmailAddressSerializer(serializers.Serializer):
email = s... | Python | 0.000001 | @@ -2136,16 +2136,25 @@
if
+data and
'country
@@ -2380,24 +2380,67 @@
if data
+ and 'country' in data and not hasattr(data
%5B'country'%5D:
@@ -2438,16 +2438,23 @@
ountry'%5D
+, 'pk')
:%0A
|
1247b16a371f0134e0bb86421bea77dd725b503d | Add method to __all__ | helpers.py | helpers.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of PyBOSSA.
#
# PyBOSSA 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 late... | Python | 0.999007 | @@ -1373,16 +1373,42 @@
e_tasks'
+, 'enable_auto_throttling'
%5D%0A%0Adef _
|
195f2b54a96c5aa8631c5597d079252c9ff092cf | Move _compute_periods into a global function, not a method. | src/predictors/keplers_law.py | src/predictors/keplers_law.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2014, MIT Probabilistic Computing Project
#
# 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/LICENS... | Python | 0.000001 | @@ -3275,34 +3275,30 @@
l_period = s
-elf._compu
+atelli
te_period(X%5B
@@ -3710,358 +3710,8 @@
i%5D%0A%0A
- def _compute_period(self, apogee_km, perigee_km):%0A %22%22%22Computes the period of the satellite in seconds given the apogee_km%0A and perigee_km of the satellite.%0A %22%22%22%0A ... |
31fba09bad87cecc3429a450adf49a1d04c5c6d4 | move header output to run | i3pybar.py | i3pybar.py | import configparser
import importlib
import inspect
import sys
import time
from datetime import datetime
from threading import Thread, Event
from plugins.base import ModBase
class I3Bar(Thread):
daemon = True
_stop = Event()
def __init__(self):
self.text = '[{ "full_text" : "XXX " , "color" : ... | Python | 0.000002 | @@ -332,79 +332,8 @@
%5D,'%0A
- print('%7B%22version%22:1%7D')%0A print('%5B')%0A print('%5B%5D,')%0A
@@ -1589,24 +1589,96 @@
run(self):%0A%0A
+ print('%7B%22version%22:1%7D')%0A print('%5B')%0A print('%5B%5D,')%0A%0A
whil
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.