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 |
|---|---|---|---|---|---|---|---|
9f6f8f46c1304085a1853c04ee6416caa089503a | Set DEFAULT_AUTO_FIELD to avoid warnings in test app | testing/settings.py | testing/settings.py | import os, sys
sys.path.insert(0, "..")
BASE_DIR = os.path.dirname(__file__)
DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ["*"]
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "foobar.db"
}
}
MIDDLEWARE_CLASSES = [
# "django.middleware.csrf.CsrfViewMidd... | Python | 0 | @@ -246,16 +246,66 @@
%0A %7D%0A%7D
+%0ADEFAULT_AUTO_FIELD = %22django.db.models.AutoField%22
%0A%0AMIDDLE
|
fe35867409af3bdf9898b68ce356ef00b865ff29 | Change version to 1.0.2 (stable) | __openerp__.py | __openerp__.py | # -*- coding: utf-8 -*-
{
"name": "Account Credit Transfer",
"version": "1.0.1",
"author": "XCG Consulting",
"website": "http://www.openerp-experts.com",
"category": 'Accounting',
"description": """Account Voucher Credit Transfer Payment.
You need to set up some things before using it.
... | Python | 0 | @@ -79,17 +79,17 @@
%22: %221.0.
-1
+2
%22,%0A %22
|
2ebe62217f646ede745f5e148902d8570dba09dd | add tests for games and players methods | tests/basic_test.py | tests/basic_test.py | import unittest
import sys
import pandas as pd
sys.path.append("/Users/daniel.george/Desktop/github/ESPN-fantasy-football-analytics/fantasy-football-analytics")
import espnfantasyfootball
from espnfantasyfootball.api import teams
#from api import teams
"""Tests for ESPN-fantasy-football-analytics."""
class BasicT... | Python | 0 | @@ -41,16 +41,87 @@
as pd%0A%0A
+import espnfantasyfootball%0Afrom espnfantasyfootball.api import teams%0A%0A#
sys.path
@@ -230,79 +230,8 @@
s%22)%0A
-%0Aimport espnfantasyfootball%0Afrom espnfantasyfootball.api import teams%0A%0A
#fro
@@ -461,16 +461,231 @@
aFrame)%0A
+ %0A def test_is_games_success(se... |
320acbfd3a2fb87230887edaae63be59d9b6be53 | Version 1.10.7 | __openerp__.py | __openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
##############################################################################
{
"name": "Account Streamline",
"version": "1.10.6",
"author": "XCG Consulting",
"category": 'Accounting',
"descript... | Python | 0 | @@ -238,9 +238,9 @@
.10.
-6
+7
%22,%0A
|
037419347fb2d1391fb87528b02af383852f2135 | Test new bundle API | tests/bundle_api.py | tests/bundle_api.py | #!/usr/bin/env python
# pylint: disable-msg=C0103
"""Implements an Execution Manager for the AIMES demo.
"""
__author__ = "Matteo Turilli, Andre Merzky"
__copyright__ = "Copyright 2014, RADICAL"
__license__ = "MIT"
import os
import radical.utils as ru
import aimes.bundle
# Set environment directories to test the... | Python | 0 | @@ -2729,9 +2729,8 @@
ng_jobs%0A
-%0A
|
563f2e153437e7f78e05ed9dade1bd1690bef6a5 | Add session_timeout to ReservationAdmin list_display | karspexet/ticket/admin.py | karspexet/ticket/admin.py | from django.contrib import admin
from karspexet.ticket.models import Account, Reservation, Ticket, Voucher, PricingModel
class ReservationAdmin(admin.ModelAdmin):
list_display = ('show', 'total', 'finalized', 'reservation_code', 'tickets')
list_filter = ('finalized', 'show')
class TicketAdmin(admin.ModelAd... | Python | 0 | @@ -228,16 +228,35 @@
n_code',
+ 'session_timeout',
'ticket
|
f15e2892e175baade9c081afbb1430ba4ccb90da | Add Dialect class which controls dialect-specific things. | katagawa/backends/base.py | katagawa/backends/base.py | """
The base implementation of a backend. This provides some ABC classes.
"""
import abc
import typing
from abc import abstractmethod
import collections
from dsnparse import ParseResult
from katagawa.meta import AsyncABC
class BaseResultSet(collections.AsyncIterator, AsyncABC):
"""
The base class for a resu... | Python | 0 | @@ -218,16 +218,816 @@
ncABC%0A%0A%0A
+class BaseDialect(abc.ABC):%0A %22%22%22%0A The base class for a SQL dialect describer.%0A %0A This class signifies what features the SQL dialect can use, and as such can be used to customize%0A query creation for faster results on certain servers, or new features ... |
2ebcf1bc4340a00c9dc43b8ca1405530a44d4ddf | Fix babi dataset downloading problem | keras/utils/data_utils.py | keras/utils/data_utils.py | from __future__ import absolute_import
from __future__ import print_function
import tarfile
import os
import sys
import shutil
import hashlib
from six.moves.urllib.request import urlopen
from six.moves.urllib.error import URLError, HTTPError
from ..utils.generic_utils import Progbar
# Under Python 2, 'urlretrieve' ... | Python | 0.000003 | @@ -180,16 +180,25 @@
urlopen
+, Request
%0Afrom si
@@ -993,45 +993,510 @@
unk%0A
-%0A response = urlopen(url, data
+ header = %7B'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',%0A 'Accept': 'text/html,application/xht... |
5f1715307587a3ac429bea716919ed52b8550934 | add a import line for fasta | locuspocus/__init__.py | locuspocus/__init__.py | __version__ = '0.1.0'
__all__ = ['Locus']
#import pyximport
#pyximport.install()
from .Locus import Locus
from .Loci import Loci
| Python | 0 | @@ -123,10 +123,35 @@
ort Loci
+%0Afrom .Fasta import Fasta
%0A%0A
|
e7b97d502c308982add15696529e5ff7bd3e7bac | fix admin pages for revisions | document/models.py | document/models.py | from django.db import models
from django.contrib.auth.models import User
from datetime import timedelta
from fiduswriter.settings import LOCK_TIMEOUT
MAX_SINCE_SAVE = timedelta(seconds=LOCK_TIMEOUT)
class Document(models.Model):
title = models.CharField(max_length=255, default='', blank=True)
contents = mo... | Python | 0 | @@ -4065,16 +4065,20 @@
of ' +
+str(
self.doc
@@ -4085,16 +4085,17 @@
ument.id
+)
%0A%0ATEMPLA
|
3f8c339e3bff2e0bc172b3bc99bbbe98d318f928 | Version 0.1b4. | log4django/__init__.py | log4django/__init__.py | from __future__ import unicode_literals
import datetime
import os
import subprocess
VERSION = (0, 1, 0, 'beta', 3)
########################
# Borrowed from django #
########################
def get_version(version=None):
"Returns a PEP 386-compliant version number from VERSION."
if version is None:
... | Python | 0 | @@ -108,17 +108,17 @@
'beta',
-3
+4
)%0A%0A#####
|
8d130c1f992150c65c2820166dce564745dc3716 | Fix bad kwarg argument | log_register/models.py | log_register/models.py | from datetime import datetime
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from log_register.managers import LotManager, LogManager
from log_register.settings import ERROR, DEBUG, SUCCESS, WARNING, INFO
class Lot(models.Model):... | Python | 0.998678 | @@ -4341,17 +4341,17 @@
filter(l
-o
+e
vel=leve
|
ec3d9798994453c1e15f9bab072318a518de26b7 | Fix py-llvmlite (#14083) | var/spack/repos/builtin/packages/py-llvmlite/package.py | var/spack/repos/builtin/packages/py-llvmlite/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyLlvmlite(PythonPackage):
"""A lightweight LLVM python binding for writing JIT compilers"... | Python | 0 | @@ -465,16 +465,113 @@
ar.gz%22%0A%0A
+ version('0.29.0', sha256='3adb0d4c9a17ad3dca82c7e88118babd61eeee0ee985ce31fa43ec27aa98c963')%0A
vers
@@ -1225,24 +1225,176 @@
on@:3.3.99')
+%0A%0A # llvmlite compatibility information taken from https://github.com/numba/llvmlite#compatibility%0A depends_on('llvm@7... |
23fa9f435c28c49fe5a91365baa7c9631017f340 | Fix submit_values - handle non htmlinput elements | loginform/loginform.py | loginform/loginform.py | #!/usr/bin/env python
import sys
from argparse import ArgumentParser
from collections import defaultdict
from lxml import html
__version__ = '1.0' # also update setup.py
class LoginFormFinder(object):
def __init__(self, url, body, username, password, form_extractor=None):
self.username = username
... | Python | 0 | @@ -2822,24 +2822,36 @@
ontinue%0A
+
%0A
@@ -3313,32 +3313,111 @@
in form.inputs:%0A
+ if not isinstance(x, html.InputElement):%0A continue%0A%0A
if x
@@ -3489,38 +3489,46 @@
value)%5D%0A
+
else:%0A
+
retu
|
d8dbbe04b00452274016f6938400010ea9103bcc | change the "rules" in policy to 'object' type | keystone/policy/schema.py | keystone/policy/schema.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | Python | 0.990644 | @@ -871,38 +871,38 @@
'type': '
-string
+object
'%0A %7D%0A%7D%0A%0A_poli
@@ -1097,30 +1097,30 @@
'type': '
-string
+object
'%0A %7D%0A%7D%0A%0Ap
|
f932504ad5fb4e4973e54260a8ce97ee2a3e096a | Allow runtable to print compact view | km3pipe/utils/runtable.py | km3pipe/utils/runtable.py | # Filename: runtable.py
"""
Prints the run table for a given detector ID.
Usage:
runtable [-n RUNS] [-s REGEX] DET_ID
runtable (-h | --help)
runtable --version
Options:
-h --help Show this screen.
-n RUNS Number of runs.
-s REGEX Regular expression to filter th... | Python | 0 | @@ -93,26 +93,15 @@
le %5B
--n RUNS%5D %5B-s REGEX
+options
%5D DE
@@ -207,16 +207,54 @@
screen.%0A
+ -c Compact view.%0A
-n R
@@ -748,16 +748,31 @@
id, n=5,
+ compact=False,
sep='%5Ct
@@ -1224,24 +1224,94 @@
df.tail(n)%0A%0A
+ if compact:%0A df = df%5B%5B'RUN', 'DATETIME', 'RU... |
a38efe3fe3a717d9ad91bfc6aacab90989cd04a4 | Bump develop version [ci skip] | djangocms_page_meta/__init__.py | djangocms_page_meta/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
__version__ = '0.8.5'
__author__ = 'Iacopo Spalletti <i.spalletti@nephila.it>'
default_app_config = 'djangocms_page_meta.apps.PageMetaConfig'
| Python | 0 | @@ -111,16 +111,22 @@
= '0.8.5
+.post1
'%0A__auth
|
a4c3b9df83c3d393f6018be6249f96b94316b866 | allow looping in short bursts | detect.py | detect.py | #!/usr/bin/env python
#sourced from Ian Harvey's bluepy blescan.py
#https://raw.githubusercontent.com/IanHarvey/bluepy/master/bluepy/blescan.py
from __future__ import print_function
import argparse
import binascii
import os
import sys
from bluepy import btle
if os.getenv('C', '1') == '0':
ANSI_RED = ''
ANSI_... | Python | 0.000006 | @@ -3804,16 +3804,161 @@
nuous')%0A
+ parser.add_argument('-t', '--loop', action='store', type=int, default=1,%0A help='Scan repeat times, -1 for continuous')
%0A par
@@ -4978,487 +4978,366 @@
-print (ANSI_RED + %22Scanning for devices...%22 + ANSI_OFF)%0A devices = scanner.scan(... |
117fb8ef4c72e26b702ee7c2b1f3bff22b1e6471 | Add return for certified devices to not apply availability check (#62728) | homeassistant/components/hue/v2/entity.py | homeassistant/components/hue/v2/entity.py | """Generic Hue Entity Model."""
from __future__ import annotations
from aiohue.v2.controllers.base import BaseResourcesController
from aiohue.v2.controllers.events import EventType
from aiohue.v2.models.clip import CLIPResource
from aiohue.v2.models.connectivity import ConnectivityServiceStatus
from aiohue.v2.models.r... | Python | 0 | @@ -5737,32 +5737,51 @@
ability = False%0A
+ return%0A
# some (
|
5f0cdf791aafe219624baaef6621b6ca7c31fbee | Set rabbit mq to send persistent messages and the queue to be durable | app/submitter/submitter.py | app/submitter/submitter.py | from app import settings
from app.submitter.converter import Converter
from app.submitter.encrypter import Encrypter
from app.submitter.submission_failed import SubmissionFailedException
import pika
import pika.credentials
import pika.exceptions
import logging
from abc import abstractmethod
logger = logging.getLogger(... | Python | 0 | @@ -3161,16 +3161,30 @@
ue=queue
+, durable=True
)%0A
@@ -3239,66 +3239,398 @@
='',
- routing_key=queue, body=message_as_string, mandatory=True
+%0A routing_key=queue,%0A body=message_as_string,%0A ... |
81a89f2bc2f3d5a4e140c935d3835cc2d3acb8a5 | Fix /NetworkDriver.CreateEndpoint validation | kuryr/schemata/commons.py | kuryr/schemata/commons.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Python | 0.000002 | @@ -1341,24 +1341,56 @@
'pattern': (
+u'%5E$%7C'%0A
u'%5E((?:%5B0-9a
@@ -1654,24 +1654,47 @@
'pattern': (
+u'%5E$%7C'%0A
u'%5E(('%0A
@@ -3936,16 +3936,48 @@
tern': (
+u'%5E$%7C'%0A
u'%5E((25%5B
|
ae3a768de11d9a82c680c18143ef004d88e3d6c6 | Optimize the inertia calculation | bag-of-words/bow.py | bag-of-words/bow.py | #!/usr/bin/env python
"""This module contains function and classes relevant with the computation of
a bag of words model. At start we suppose that suitable descriptors for our
dataset are already extracted. Subsequently we procceed to the second step of
quantization, in this step we use a clustering algorithm such as K... | Python | 0.000701 | @@ -4984,11 +4984,9 @@
ric=
-'sq
+%22
eucl
@@ -4990,17 +4990,62 @@
uclidean
-'
+%22,%0A metric_kwargs=%7B%22squared%22: True%7D
%0A
|
862527782e6cb772f988079d8459c9e71b4c195e | Fix netgear renamed mdi icons (#57431) | homeassistant/components/netgear/const.py | homeassistant/components/netgear/const.py | """Netgear component constants."""
from datetime import timedelta
DOMAIN = "netgear"
PLATFORMS = ["device_tracker", "sensor"]
CONF_CONSIDER_HOME = "consider_home"
DEFAULT_CONSIDER_HOME = timedelta(seconds=180)
DEFAULT_NAME = "Netgear router"
# update method V2 models
MODELS_V2 = [
"Orbi",
"RBK",
"RBR",... | Python | 0 | @@ -651,24 +651,16 @@
ellphone
--android
%22, # An
@@ -667,24 +667,24 @@
droid Phone%0A
+
4: %22mdi:
@@ -1097,37 +1097,32 @@
14: %22mdi:tablet
--ipad
%22, # iPad%0A 1
@@ -1139,13 +1139,8 @@
blet
--ipad
%22,
@@ -1165,39 +1165,32 @@
: %22mdi:cellphone
--iphone
%22, # iPhone 5/5
@@ -1220,15 +1220,8 ... |
b0fdd388b711eba1f47af1cee3296ca193a97a4b | TEST updated test2 | dipy/reconst/tests/test_csdeconv.py | dipy/reconst/tests/test_csdeconv.py | import numpy as np
from numpy.testing import (assert_equal,
assert_almost_equal,
assert_array_equal,
assert_array_almost_equal)
from dipy.core.sphere import unit_icosahedron, unit_octahedron
from dipy.reconst.shm import sf_to_sh
from dipy.data import get_sphere
from dipy.sims.voxel import (s... | Python | 0 | @@ -809,19 +809,20 @@
visu =
-Tru
+Fals
e%0A%0A f
@@ -1497,16 +1497,22 @@
del(gtab
+, None
)%0A fr
|
f5b80f85cb181a0cd279df564231d75c869e7116 | Fix output: print dict -> json.dump() | src/Virulence_Factors/virulencefactors.py | src/Virulence_Factors/virulencefactors.py | #!/usr/bin/env python
import os, sys, logging, argparse, subprocess, shutil
TEMP_SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) + "/"
sys.path.append(os.path.abspath(TEMP_SCRIPT_DIRECTORY + '../Serotyper/'))
sys.path.append(os.path.abspath(TEMP_SCRIPT_DIRECTORY + '../'))
from sharedmethods import *
fr... | Python | 0.999999 | @@ -69,16 +69,22 @@
, shutil
+, json
%0A%0ATEMP_S
@@ -6720,22 +6720,26 @@
-print
+json.dump(
resultsD
@@ -6741,16 +6741,29 @@
ultsDict
+, sys.stdout)
%0A
@@ -6835,20 +6835,21 @@
print genomesList
+%0A
|
919c9a9fe9a4bbced0a460a0cd1cfa05e427eef2 | Fix recursive init | director/general/custom_storages.py | director/general/custom_storages.py | '''
Allow for one S3 bucket with different roots for static and "media" (user uploads)
See:
http://stackoverflow.com/questions/10390244/how-to-set-up-a-django-project-with-django-storages-and-amazon-s3-but-with-diff
https://gist.github.com/defrex/82680e858281d3d3e6e4
http://www.laurii.info/2013/05/improve-s3boto-dj... | Python | 0.998714 | @@ -1243,25 +1243,16 @@
False%0A%09%09
-Snapshots
S3BotoSt
|
e9e2e2d7402415cffcd7024929acb6a7c1bb4a9a | Increase timeout for complicated builds | lambda/spawn-codebuild.py | lambda/spawn-codebuild.py | import logging
import os
import json
import uuid
import shutil
import datetime
from posixpath import basename
import boto3
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logging.getLogger('boto3').setLevel(logging.CRITICAL)
logging.getLogger('botocore').setLevel(logging.CRITICAL)
try:
region = os.env... | Python | 0.000001 | @@ -3232,17 +3232,18 @@
Minutes=
-5
+20
,%0A
|
c7355960600312c624cdfa919894684a9952753a | fix vocab2lex | 02_amtraining/base_scripts/vocab2lex.py | 02_amtraining/base_scripts/vocab2lex.py | #!/usr/bin/env python3
import sys
def main(phone_map, abbreviations):
phone_map = {v[0]: v[1].strip()
for v in (l.split(None, 1)
for l in open(phone_map, encoding='utf-8'))}
abbr_map = {v[0]: v[1].strip().split(',')
for v in (l.split(None, 1)
... | Python | 0.999906 | @@ -1010,18 +1010,18 @@
(%7B:.1f%7D)
-%5Cn
+
%22.format
@@ -1184,16 +1184,17 @@
%7B%7D-%7B%7D+%7B%7D
+
%22.format
|
bddc8bd41df12db4830bbe303db00fcc62a09b72 | Fix error loop when connection is interrupted | slackminion/bot.py | slackminion/bot.py | import logging
from datetime import datetime
from slackclient import SlackClient
from time import sleep
from dispatcher import MessageDispatcher
from slackminion.plugin.manager import PluginManager
from slack import SlackEvent, SlackChannel, SlackUser
from webserver import Webserver
class NotSetupError(Exception):
... | Python | 0.000018 | @@ -3723,32 +3723,81 @@
led exception')%0A
+ self.reconnect_needed = True%0A
|
40c8be5d7090e61016bf1feb234b9652a4e89cf2 | use six to handle Py2 long type | django_facebook/middleware.py | django_facebook/middleware.py | # -*- coding: utf-8 -*-
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
from django.contrib.auth import logout
from open_facebook.api import FacebookAuthorization, OpenFacebook
from django_facebook import settings
from django_facebook.canvas import generate_oauth_url... | Python | 0 | @@ -154,16 +154,45 @@
t logout
+%0Afrom django.utils import six
%0A%0Afrom o
@@ -2977,16 +2977,67 @@
token'%5D%0A
+ if six.PY3:%0A long = int%0A
|
eab8146b76c1626cd565621125425fccf1ef288b | use sys.stdout and sys.stderr all the time (#5991) | dvc/ui/__init__.py | dvc/ui/__init__.py | import sys
from collections import defaultdict
from typing import (
TYPE_CHECKING,
Any,
Dict,
Iterable,
Optional,
Sequence,
TextIO,
Union,
)
from dvc.progress import Tqdm
from dvc.utils import colorize
if TYPE_CHECKING:
from dvc.ui.table import Headers, Styles, TableData
class Fo... | Python | 0 | @@ -167,16 +167,51 @@
ion,%0A)%0A%0A
+from funcy import cached_property%0A%0A
from dvc
@@ -865,24 +865,16 @@
self,
-%0A
formatt
@@ -898,489 +898,143 @@
one,
-%0A output: TextIO = None,%0A error: TextIO = None,%0A enable: bool = False,%0A ) -%3E None:%0A self._output: Optio... |
16107681023677290a7b9a5f9429e2efb269afb0 | Check if an IP is already blocked before trying to block it | dynam-blacklist.py | dynam-blacklist.py | import socket
import os
import os.path
import sys
import re
import traceback
import subprocess
import json
import logging
import logging.handlers
import urllib2
import time
def load_config(config_files):
""" loads json configuration files
the latter configs overwrite the previous configs
"""
config = ... | Python | 0 | @@ -2713,32 +2713,792 @@
-subprocess.call(
+try:%0A # Check if the rule is already existing%0A subprocess.check_output( %5Bconfig%5B%22ip4tables_cmd%22%5D if %22:%22 not in addr else config%5B%22ip6tables_cmd%22%5D%5D%0A + %5B%22-C%22, config%5B%22ipta... |
6efe186e49b74895ad5ac2bdb27b369396cc9380 | Add options for profile, map and names | saltcloud/cli.py | saltcloud/cli.py | '''
Primary interfaces for the salt-cloud system
'''
# Need to get data from 4 sources!
# CLI options
# salt cloud config - /etc/salt/cloud
# salt master config (for master integration)
# salt vm config, where vms are defined - /etc/salt/cloud.vm
#
# The cli, master and cloud configs will merge for opts
# the vm data w... | Python | 0 | @@ -1227,24 +1227,636 @@
onParser()%0A%0A
+ parser.add_option('-p',%0A '--profile',%0A dest='profile',%0A default='',%0A help='Specify a profile to use for the vms')%0A%0A parser.add_option('-m',%0A '--map',%0A dest... |
fe802feb8de884b1bca6c4d15a6786b567d219d2 | add webm | bgmi/front/index.py | bgmi/front/index.py | # coding: utf-8
from __future__ import print_function, unicode_literals
import os
from bgmi.config import SAVE_PATH, FRONT_STATIC_PATH
from bgmi.front.base import BaseHandler, COVER_URL
from bgmi.models import STATUS_NORMAL, STATUS_UPDATING, STATUS_END, Followed
from bgmi.utils import normalize_path
def get_player(... | Python | 0 | @@ -985,16 +985,24 @@
, '.mkv'
+, 'webm'
%5D%5D):%0A
@@ -1936,17 +1936,16 @@
ish()%0A%0A%0A
-%0A
class Ba
|
4fe4a32442e2b54abec73b4e9913ca50b851875c | Add import exception for docker-py | src/mist/io/tests/helpers/docker_utils.py | src/mist/io/tests/helpers/docker_utils.py | import docker
from mist.io.tests.settings import docker_nodes
def select_docker():
"""
Choose the container with the minimum load
"""
nodes = []
for node in docker_nodes:
nodes.append(docker.Client(base_url=node, version='1.10'))
if len(nodes) == 1:
chosen_node = nodes[0]
... | Python | 0.000001 | @@ -1,20 +1,29 @@
+try:%0A
import docker%0A%0Afrom
@@ -16,17 +16,20 @@
docker%0A
-%0A
+
from mis
@@ -68,16 +68,45 @@
r_nodes%0A
+except ImportError:%0A pass%0A
%0A%0Adef se
|
f0adb9022408dbcfdbe7e83dc0633d560be4f533 | Use HTML5 date inputs for due_date | todo/forms.py | todo/forms.py | from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import Group
from todo.models import Item, List
from django.contrib.auth import get_user_model
class AddListForm(ModelForm):
# The picklist showing allowable groups to which a new list can be added
# determines which g... | Python | 0.000003 | @@ -1282,41 +1282,8 @@
eld(
-%0A required=False,%0A
widg
@@ -1299,12 +1299,8 @@
Date
-Time
Inpu
@@ -1313,40 +1313,23 @@
s=%7B'
-class': 'due_date_picker'%7D)%0A
+type': 'date'%7D)
)%0A%0A
@@ -1947,16 +1947,96 @@
roup%5D)%0A%0A
+ due_date = forms.DateField(widget=forms.DateInput(attrs=%7B't... |
458d7885341676bcc50934503dd3ecef54d50884 | Add domain specific api url | mailjet_rest/client.py | mailjet_rest/client.py | #!/usr/bin/env python
# coding=utf-8
import json
import logging
import requests
from requests.compat import urljoin
from .utils.version import get_version
requests.packages.urllib3.disable_warnings()
class Config(object):
API_URL = 'https://api.mailjet.com/'
API_REF = 'http://dev.mailjet.com/email-api/v3/'... | Python | 0.000001 | @@ -220,24 +220,32 @@
bject):%0A
+DEFAULT_
API_URL = 'h
@@ -255,16 +255,19 @@
s://api.
+eu.
mailjet.
@@ -430,32 +430,46 @@
lf, version=None
+, api_url=None
):%0A if ve
@@ -521,16 +521,71 @@
version
+%0A self.api_url = api_url or self.DEFAULT_API_URL
%0A%0A de
@@ -629,23 +629,23 @@
= self... |
2335cf4799b44b7fc09e1351b1c143b082b2c82a | Bump version | somerset.py | somerset.py | #!/usr/bin/env python
from __future__ import print_function
__version__ = '0.1.7'
import argparse
import errno
import os
import platform
import shutil
import stat
import subprocess
import sys
from collections import OrderedDict
from datetime import datetime
from pathlib import Path
# Populated in __main__
STAGES = ... | Python | 0 | @@ -73,17 +73,17 @@
= '0.1.
-7
+8
'%0A%0Aimpor
|
e6c42f504e11b7e80ef866aead732345fe1751b0 | kill celery using quiet mode | perfrunner/helpers/worker.py | perfrunner/helpers/worker.py | from celery import Celery
from fabric import state
from fabric.api import cd, run, settings
from kombu import Queue
from logger import logger
from spring.wgen import WorkloadGen
from perfrunner.helpers.misc import uhex
from perfrunner.settings import BROKER_URL, REPO
celery = Celery('workers', backend='amqp', broker=... | Python | 0 | @@ -1166,25 +1166,29 @@
9 celery
-; exit 0'
+', quiet=True
)%0A
@@ -3561,17 +3561,21 @@
lery
-; exit 0'
+', quiet=True
)%0A%0A
|
1b17c66771174ca35a0577350c44e1b69593282c | Replace set_failed call to failed | mamba/example_group.py | mamba/example_group.py | # -*- coding: utf-8 -*-
import copy
from datetime import datetime
from functools import partial
from mamba import runnable
from mamba.example import PendingExample
class ExampleGroup(runnable.Runnable):
def __init__(self, description, parent=None, tags=None):
super(ExampleGroup, self).__init__(parent=p... | Python | 0.000161 | @@ -1198,32 +1198,33 @@
except Exception
+
:%0A se
@@ -1230,12 +1230,8 @@
elf.
-set_
fail
|
6263c10a94347d8517cddda6381609fa6a6b8d1f | fix test_histogram_ndarray | tests/test_basic.py | tests/test_basic.py | # -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
"""Tests module."""
import json
import os
import numpy
import numpy.random as random
import pytest
import ndd
from make_test_ref import SEED, cases
def tests_dir():
"""Return None if no tests dir."""
cwd = os.getcwd()
basename = os.path.basenam... | Python | 0.999969 | @@ -1721,32 +1721,46 @@
0, 3%0A data =
+ndd.data.Data(
random_ndarray(N
@@ -1761,32 +1761,41 @@
rray(N, P, SEED)
+, axis=1)
%0A ref_result
@@ -1822,94 +1822,112 @@
-assert numpy.isclose(%0A ndd.entropy(ndd.histogram(data), k=ndd.nsb._nbins(data))
+counts, k = data.iter_counts()%0A estimate =... |
4a0b5197b24e91413f3770c91dd460db25848df2 | Add a unit test for the default command | tests/test_basic.py | tests/test_basic.py | import pytest
from todoman.cli import cli
def test_basic(tmpdir, runner):
result = runner.invoke(cli, ['list'], catch_exceptions=False)
assert not result.exception
assert result.output == ''
tmpdir.join('default/test.ics').write(
'BEGIN:VCALENDAR\n'
'BEGIN:VTODO\n'
'SUMMARY:h... | Python | 0.000002 | @@ -1434,24 +1434,527 @@
k two' in result.output%0A
+%0A%0Adef test_default_command(tmpdir, runner):%0A result = runner.invoke(cli, catch_exceptions=False)%0A assert not result.exception%0A assert result.output == ''%0A%0A tmpdir.join('default/test.ics').write(%0A 'BEGIN:VCALENDAR%5Cn'%0A 'BE... |
1009696732b81d981252774fb2a9e01e54b9ed56 | add assertion that simulation does not nan | perses/tests/test_sampler.py | perses/tests/test_sampler.py | import numpy as np
from simtk import unit, openmm
from simtk.openmm import app
import openeye.oechem as oechem
import openeye.oeomega as oeomega
import openmoltools
import logging
import copy
import perses.rjmc.topology_proposal as topology_proposal
import perses.bias.bias_engine as bias_engine
import perses.rjmc.geome... | Python | 0.004479 | @@ -4400,16 +4400,73 @@
elete')%0A
+ assert np.sum(np.isnan(ncmc_old_positions)) == 0%0A
|
fbff0de3323bf8c6f7ab209c85a26e481b8227cf | cannot create list with empty recipients. mark as expected fail | tests/test_basic.py | tests/test_basic.py | import uuid
from unittest import TestCase
from pyresponse import PureResponseClient as PureResponseClient
# Generate a random string to name things
Name = lambda: str(uuid.uuid4())
class BasicTests(TestCase):
def setUp(self):
self.client = PureResponseClient()
self.client.authenticate('tm.s... | Python | 0.999953 | @@ -5,16 +5,31 @@
rt uuid%0A
+import pytest%0A%0A
from uni
@@ -345,24 +345,182 @@
crwkbplf')%0A%0A
+ @pytest.mark.xfail # Cannot create list with empty recipients%0A def test_create_empty_list(self):%0A self.client.create_list(Name(), %5B%5D) %0A %0A
def test
@@ -984,32 +984,102 @@
ist(list... |
a1b6240793e76b451bd13e8fc37415455a8a00ad | Fix tests | tests/test_chain.py | tests/test_chain.py | import unittest
import numpy as np
import sys
# IKPy imports
from ikpy import chain
from ikpy import plot_utils
import params
from ikpy.chain import Chain
Chain()
plot = params.interactive
class TestChain(unittest.TestCase):
def setUp(self):
if plot:
self.ax = plot_utils.init_3d_figure()
... | Python | 0.000003 | @@ -154,16 +154,8 @@
in%0A%0A
-Chain()%0A
plot
|
250ca36a6f2db3d38f34015b6094fc21e358db5e | Increase max_retries for flaky test | tests/test_dates.py | tests/test_dates.py | import datetime
import unittest
import billboard
from nose.tools import raises
class DateTest(unittest.TestCase):
def testDateRounding(self):
"""Checks that the Billboard website is rounding dates correctly: it should
round up to the nearest date on which a chart was published.
"""
... | Python | 0 | @@ -370,16 +370,32 @@
8-01-01%22
+, max_retries=10
)%0A
|
a59f95877aee5c0be1d6681987410f3536e39e99 | fix debug repr test | tests/test_debug.py | tests/test_debug.py | # -*- coding: utf-8 -*-
"""
werkzeug.debug test
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD license.
"""
import re
import sys
import unittest
from aiohttp_debugtoolbar.tbtools.console import HTMLStringO
from aiohttp_debugtoolbar.tbtools.re... | Python | 0.000001 | @@ -2752,14 +2752,8 @@
le%22%3E
-tests.
test
|
130b635663f9db280ccafcfcbb09630fa46c2203 | Add unit test for unescape. | tests/test_lexer.py | tests/test_lexer.py | import re
import unittest
import sure
import lexer
class LoggerMock():
lexing_success = True
def error(self, *args):
self.lexing_success = False
def warning(self, *args):
pass
def debug(self, *args):
pass
def info(self, *args):
pass
class TestLexer(unittest.Test... | Python | 0 | @@ -2824,24 +2824,106 @@
%224.2e1.0%22)%0A%0A
+ def test_unescape(self):%0A lexer.unescape('%5C%5Cn').should.be.equal('%5Cn')%0A%0A
def test
|
54e44f45e1ae7bed79fff482cfabbbf242bd9056 | Add a test for trailing commas | tests/test_links.py | tests/test_links.py | #!/usr/bin/env python
# -*- encoding: utf-8
import pytest
import requests
@pytest.mark.parametrize('path', [
# Check pagination is working correctly
'/page/2/', '/page/3/',
])
def test_pages_appear_correctly(path):
resp = requests.get(f'http://localhost:5757/{path}')
assert resp.status_code == 200
... | Python | 0.001397 | @@ -1000,16 +1000,113 @@
de%3E'''),
+%0A%0A # We're not adding trailing commas to tags%0A ('2017/09/ode-to-docopt', 'python%3C/a%3E, %3Ca'),
%0A%5D)%0Adef
|
eae4c4a4443495d60fa57d742abb1fa926b0b69a | 修复触发了 Django bug #18776 | tests/test_music.py | tests/test_music.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import json
from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponse
import pytest
from music.decorators import json_view
from music.models import Music
from music.views... | Python | 0 | @@ -169,21 +169,16 @@
reverse
-_lazy
%0Afrom dj
@@ -2283,37 +2283,32 @@
= rf.get(reverse
-_lazy
('music:next', k
@@ -2330,24 +2330,24 @@
mber': 1%7D))%0A
+
resp
@@ -2563,37 +2563,32 @@
= rf.get(reverse
-_lazy
('music:next', k
@@ -2811,24 +2811,24 @@
f, client):%0A
+
resp
@@ -2856,13 +2856,8 @... |
24e16428f2000a1d116c05efe944afa99e43b8c4 | Add some more tests in realms for all regions... | tests/test_realm.py | tests/test_realm.py | # -*- coding: utf-8 -*-
import unittest
import battlenet
from battlenet import Realm
class RealmTest(unittest.TestCase):
def setUp(self):
self.connection = battlenet.Connection()
def test_realm_by_name(self):
name = "Kil'jaeden"
realm = self.connection.get_realm(battlenet.UNITED_STA... | Python | 0 | @@ -117,16 +117,156 @@
tCase):%0A
+ def _realm_for(self, region, name):%0A realm = self.connection.get_realm(region, name)%0A self.assertEqual(realm.name, name)%0A%0A
def
@@ -1983,64 +1983,153 @@
est_
-unicode(self):%0A realm = self.connection.get
+realm_united_state(self):%0A sel... |
716061282777809dc30942e57607aada68e6e798 | Add test for return value if crossover does not occur on given date. | tests/test_stock.py | tests/test_stock.py | import unittest
from datetime import datetime
from stock import Stock
class StockTest(unittest.TestCase):
def setUp(self):
self.stock = Stock("GOOG")
def test_new_stock_price(self):
"""A new stock should have a price that is None.
"""
self.assertIsNone(self.stock.price)
... | Python | 0 | @@ -4648,16 +4648,194 @@
fail()%0A%0A
+ def test_crossover_by_date_does_not_exists(self):%0A %22%22%22Tests if there is not a return value if crossover does not occur on given date.%0A%0A %22%22%22%0A self.fail()%0A
%0Aif __na
|
7680c0658d8d1ad5a346ea694029a9d6ed761686 | fix tests to have more style things to actually fix | tests/test_style.py | tests/test_style.py | # -*- coding: utf-8 -*-
import click
import tests.conftest
import distutils
import pytest
import zazu.cli
import zazu.style
def write_file_with_bad_style(file):
with open(file, 'w') as f:
f.write('\n \n ')
@pytest.fixture()
def repo_with_style_errors(repo_with_style):
dir = repo_with_style.working_t... | Python | 0 | @@ -125,24 +125,26 @@
%0A%0Adef write_
+c_
file_with_ba
@@ -206,19 +206,149 @@
.write('
+void main()%7B%5Cn%5Cn%7D%5Cn ')%0A%0Adef write_py_file_with_bad_style(file):%0A with open(file, 'w') as f:%0A f.write('def main():%5Ctpass%5Cn
%5Cn
-
%5Cn ')%0A%0A%0A
@@ -507,32 +507,34 @@
:%0A write_
+c_
... |
bb337869510414ddf8235a8fccefcf5fcd21db18 | Use assert_called_once method supported in Python 3.5+ | tests/test_vunit.py | tests/test_vunit.py | import pytest
import os.path
from unittest.mock import patch, MagicMock
def test_vunit_codegen():
from edalize_common import compare_files, setup_backend, tests_dir
ref_dir = os.path.join(tests_dir, __name__)
paramtypes = ['cmdlinearg']
name = 'test_vunit_0'
tool = 'vunit'
tool_op... | Python | 0.000001 | @@ -2465,32 +2465,37 @@
sert_called_once
+_with
()%0D%0A
@@ -2521,24 +2521,29 @@
_called_once
+_with
()%0D%0A%0D%0A
@@ -2631,32 +2631,37 @@
sert_called_once
+_with
()%0D%0A
@@ -3194,32 +3194,37 @@
sert_called_once
+_with
()%0D%0A
@@ -3246,32 +3246,37 @@
sert_called_onc... |
24f1f686c5cdc9a2272adbea7d1c2e1eb481dc8d | Make vertical white space after license header consistent | tests/unit/fakes.py | tests/unit/fakes.py | # Copyright 2012 Intel Inc, OpenStack Foundation.
# 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
#
# ... | Python | 0.000056 | @@ -640,16 +640,17 @@
icense.%0A
+%0A
%22%22%22%0AFake
|
c37c53b45580179440dcda701b7d94b0f8b9eb47 | add source command | tipsi_tools/unix.py | tipsi_tools/unix.py | import os
import socket
import subprocess
import time
from contextlib import closing
from collections import ChainMap
def _prepare(out):
out = out.decode('utf8').strip('\n').split('\n')
if out == ['']:
return []
return out
def run(command):
'''
Run command in shell, accepts command const... | Python | 0.000006 | @@ -47,16 +47,26 @@
rt time%0A
+import re%0A
from con
@@ -2100,8 +2100,413 @@
(**map)%0A
+%0A%0Adef source(fname):%0A '''%0A Act's similar to bash 'source' or '.' commands.%0A '''%0A rex = re.compile('(?:export %7Cdeclare -x )?(.*?)=%22(.*?)%22')%0A out = call_out('source %7B%7D && export'.format(fnam... |
10200dbe726b91725e9d59c8a62704d9118bd08c | Fix for calculation of mid_time | tkp/utility/fits.py | tkp/utility/fits.py | import os
import datetime
import math
import shutil
import pyrap
import pyrap.images
import pyrap.tables
import pyfits
MJD0 = datetime.datetime(1858, 11, 17, 0, 0, 0)
def convert(casa_image, ms, fits_filename=None):
"""Convert a CASA image to FITS, taking care of header keywords
:argument casa_image: CASA ... | Python | 0.997912 | @@ -2395,23 +2395,19 @@
-dt = en
+mi
d_time
--
+ =
sta
@@ -2417,25 +2417,23 @@
time
-%0A mi
+ + (en
d_time
-= (
+-
star
@@ -2442,84 +2442,13 @@
time
- +%0A datetime.timedelta(dt.days, dt.seconds, dt.microseconds))
+) / 2
%0A
|
42ff1757272c54c4446fc0b355f853b3fef56edf | Convert bytes to string in tar snapshot | tml/api/snapshot.py | tml/api/snapshot.py | # encoding: UTF-8
"""
# Copyright (c) 2015, Translation Exchange, Inc.
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, c... | Python | 0.99988 | @@ -4012,63 +4012,44 @@
-data = fp.read()%0A ret = loads(to_string(data
+ret = loads(fp.read().decode('utf-8'
))%0A
|
175801f42c96fbecf76a58a4e7e0def9473ad2ad | Improve the documentation of the CGPM interface. | src/cgpm.py | src/cgpm.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 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/LICENSE-2.0
# Unles... | Python | 0 | @@ -2463,15 +2463,13 @@
of %60
-targets
+query
%60 mu
@@ -2919,32 +2919,140 @@
on %60evidence%60.%0A%0A
+ The sample must be drawn from the same distribution whose density is%0A assessed by %60logpdf%60.%0A%0A
query :
@@ -3345,75 +3345,170 @@
%60).%0A
-%0A The sample must be drawn fro... |
aad92644d01994685d20121def511da2765adfad | Add neighbrhood property to row | src/data.py | src/data.py | import csv
import datetime
class Row(dict):
def __init__(self, *args, **kwargs):
super(Row, self).__init__(*args, **kwargs)
self._start_date = None
self._end_date = None
def _cast_date(self, s):
if not s:
return None
return datetime.datetime.strptime(s, '%... | Python | 0.000011 | @@ -897,16 +897,95 @@
MBER'%5D%0A%0A
+ @property%0A def neighborhood(self):%0A return self%5B'NEIGHBORHOOD'%5D%0A%0A
%0Aclass R
|
31a7e838b971fc9063c9dd7c35129f857fda6e0a | Include author name | wafer/management/commands/wafer_talk_video_reviewers.py | wafer/management/commands/wafer_talk_video_reviewers.py | import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted... | Python | 0.000015 | @@ -691,16 +691,69 @@
.title,%0A
+ talk.get_authors_display_name(),%0A
|
069259462ac622ffd4f9632323b404650a13ac30 | Add extra arguments for Chrome | src/main.py | src/main.py | import os
import psycopg2
import requests
import time
from bs4 import BeautifulSoup
from constants import LOWEST_SCORE_MESSAGE, SCOREBOARD_URL, SIGNIN_URL
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium... | Python | 0.000001 | @@ -836,16 +836,113 @@
tions()%0A
+ chrome_options.add_argument('--disable-gpu')%0A chrome_options.add_argument('--no-sandbox')%0A
chro
|
6ec7fac46c0970a91398b5f43168821fd4f3eb5c | Update main.py | src/main.py | src/main.py | #!/usr/bin/env python
"""Imports"""
import subprocess
import glob
import os
currentdir = "/usr/share/fossology/nomos/agent/jars"
pomdir = "/usr/share/fossology/nomos/agent/"
mvncommand = "mvn -q dependency:copy-dependencies -DcopyPom=true -DoutputDirectory="+currentdir
mvncommand2 = "mvn dependency:tree -Dout... | Python | 0 | @@ -14,17 +14,16 @@
v python
-%0D
%0A%22%22%22Impo
@@ -28,17 +28,16 @@
ports%22%22%22
-%0D
%0Aimport
@@ -46,17 +46,16 @@
bprocess
-%0D
%0Aimport
@@ -58,17 +58,16 @@
ort glob
-%0D
%0Aimport
@@ -72,111 +72,92 @@
t os
-%0D%0A%0D%0Acurrentdir = %22/usr/share/fossology/nomos/agent/jars%22%0D%0A
+%0Aimport re%0Ap... |
46e9d697026d9001adf16164fba9fea0d4ed0e02 | Fix issue #48 : X and Y vectors can now be passed as pcolormesh argument (as in the original function) | prettyplotlib/_pcolormesh.py | prettyplotlib/_pcolormesh.py | __author__ = 'olga'
import numpy as np
from prettyplotlib.colors import blue_red, blues_r, reds
from prettyplotlib.utils import remove_chartjunk, maybe_get_fig_ax
def pcolormesh(*args, **kwargs):
"""
Use for large datasets
Non-traditional `pcolormesh` kwargs are:
- xticklabels, which will put x tick... | Python | 0 | @@ -1376,17 +1376,319 @@
s)%0A%0A
-x
+# If x and y axis are passed in arguments, gets correct data%0A # Ticks will work with x and y data, although it would be pointless to use%0A # both x/y and custom ticks%0A if len(args) == 3 :%0A x = args%5B0%5D%0A y = args%5B1%5D%0A data = ... |
f2fff6fd8be1dcb57158d35e418923b5fef0a837 | Add `strict` option to Page.crop | pdfplumber/page.py | pdfplumber/page.py | from pdfplumber import utils
from pdfplumber import helpers
from pdfplumber.container import Container
from six import string_types
import re
lt_pat = re.compile(r"^LT")
class Page(Container):
cached_properties = Container.cached_properties + [ "_layout" ]
def __init__(self, pdf, page_obj, initial_doctop=0):... | Python | 0.000001 | @@ -5763,24 +5763,38 @@
p(self, bbox
+, strict=False
):%0A r
@@ -5821,16 +5821,31 @@
lf, bbox
+, strict=strict
)%0A%0Aclass
@@ -5904,16 +5904,30 @@
ge, bbox
+, strict=False
):%0A
@@ -5984,16 +5984,45 @@
x = bbox
+%0A self.strict = strict
%0A%0A @p
@@ -6103,32 +6103,148 @@
n self._objects%... |
b36ec36ccfe107d1906d85b934090c3b2d74beb8 | remove bad arg from classmethod | epistasis/models/base.py | epistasis/models/base.py | import numpy as np
from functools import wraps
# imports from gpmap dependency
from gpmap.gpm import GenotypePhenotypeMap
# Local imports
from epistasis.mapping import EpistasisMap
from epistasis.decomposition import generate_dv_matrix
from epistasis.stats import bootstrap
from epistasis.utils import extract_mutation... | Python | 0.000077 | @@ -3570,26 +3570,16 @@
_gpm(gpm
-, **kwargs
)%0A
|
14b5ac625bd676518997ec4d7073ac01efdcfbb8 | Update 3n+1.py | Maths/3n+1.py | Maths/3n+1.py | def main():
def n31(a):# a = initial number
c = 0
l = [a]
while a != 1:
if a % 2 == 0:#if even divide it by 2
a = a // 2
elif a % 2 == 1:#if odd 3n+1
a = 3*a +1
c += 1#counter
l += [a]
return l , c
p... | Python | 0 | @@ -403,17 +403,16 @@
(n31(13)
-)
%5B1%5D))#op
|
c7af1f2afb925fb536b8173e5b3d00ca47412774 | add link expiry message for already activated verification link | frappe/website/doctype/personal_data_deletion_request/personal_data_deletion_request.py | frappe/website/doctype/personal_data_deletion_request/personal_data_deletion_request.py | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import re
from frappe.model.document import Document
from frappe.utils.verified_command import get_signed_param... | Python | 0 | @@ -745,16 +745,17 @@
%22) +%5C%0A%09%09
+%09
%22?%22 + ge
@@ -3341,14 +3341,14 @@
urn%0A
+%0A
%09doc
-
= fr
@@ -3398,16 +3398,47 @@
, name)%0A
+%09host_name = frappe.local.site%0A
%09if doc.
@@ -3563,38 +3563,8 @@
()%0A%09
-host_name = frappe.local.site%0A
%09fra
@@ -3603,16 +3603,17 @@
rmed%22),%0A
+%09
... |
2e2c9ad188fabeafe728523bb9f467d9b6238986 | fix #12: get_leagues_transactions OK | fantasy_sport/fantasy_sport.py | fantasy_sport/fantasy_sport.py | from __future__ import absolute_import
class FantasySport(object):
"""FantasySport Class
"""
url = 'http://fantasysports.yahooapis.com/fantasy/v2/'
def __init__(self, oauth, fmt=None, use_login=False):
"""Initialize a FantasySport object
"""
self.oauth = oauth
self.fm... | Python | 0.000004 | @@ -3146,16 +3146,320 @@
sponse%0A%0A
+ def get_leagues_transactions(self, league_keys):%0A %22%22%22Return leagues settings%0A %3E%3E%3E yfs.get_leagues_transactions(%5B'238.l.627062'%5D)%0A %22%22%22%0A uri = self._build_uri('leagues;league_keys', league_keys, sub='transactions')%0A ... |
5fe4575a6618b30456ff283a75e01f0ea68d3e7f | Optimize RGen. | tools/RGen.py | tools/RGen.py | #!/usr/bin/python3
# Copyright (C) 2012 Hai Bison
#
# See the file LICENSE at the root directory of this project for copying
# permission.
'''
This tool parses `messages.properties` and generates all strings to their
respective IDs, which can be put into class R.string.
'''
import os
import os.path
import re
impo... | Python | 0 | @@ -707,16 +707,25 @@
if
+line and
not line
@@ -744,26 +744,8 @@
'#')
- and len(line) %3E 0
:%0A
|
a4a3ba801d1a399d2be26b7d0cced7c40dbd42c4 | print all scores | tools/list.py | tools/list.py | #!/usr/bin/python3
"""Produce inventory of all data."""
# import logging
from collections import defaultdict
from tabulate import tabulate
from dwi import files
from dwi.types import Path
BASE = Path('/mri')
LIST = 'misc/list/all.txt'
def read_cases():
# XXX: Not used anymore.
return sorted(int(x) for x ... | Python | 0.999988 | @@ -1991,24 +1991,117 @@
t.lesions)%0A%0A
+ def all_scores(patient):%0A return '/'.join(str(x.score) for x in patient.lesions)%0A%0A
for d in
@@ -2104,24 +2104,24 @@
d in dicts:%0A
-
s =
@@ -2197,24 +2197,26 @@
+ #
s = str(max
@@ -2226,16 +2226,50 @@
ore(p))%0A
+ ... |
86305247d60feeafa529877f9141949fce20d523 | Make plot target axis configureable | tools/plot.py | tools/plot.py | #!/usr/bin/env python
# encoding: utf-8
"""Tools making everyday plotting tasks easier."""
from __future__ import division, print_function
import numpy as np
from matplotlib import pyplot as pl
def plot(function, intervall, num=500, axis=None, **kwargs):
"""Plots the function f on the axisis axis on the interval... | Python | 0.000002 | @@ -905,32 +905,41 @@
%0Adef imshow(img,
+ ax=None,
**kwargs):%0A
@@ -1100,75 +1100,46 @@
-fig = pl.figure(0)%0A ax = fig.add_subplot(111, autoscale_on=False
+ax = ax if ax is not None else pl.gca(
)%0A
|
2e03d87e2a39d79edd406c6db4d977f315abb7ad | Remove wrong argument | sipa/mail.py | sipa/mail.py | # -*- coding: utf-8 -*-
"""
Functions concerned with mail composition and transmission
This module ultimately provides functions to be used by a blueprint in
order to compose and send a mail, for instance
:py:func:`send_contact_mail`.
On the layer below, some intermediate functions are introduced which
are needed to... | Python | 0.998368 | @@ -2599,17 +2599,16 @@
_string(
-0
))%0A
|
188de0dae55449dc1d6a15917423b2ec9d9a3fc1 | change owner to eventkit | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
if os.getenv("PRODUCTION"):
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eventkit_cloud.settings.prod")
else:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eventkit_cloud.settings.dev")
from django.core.management... | Python | 0 | @@ -35,16 +35,38 @@
port sys
+%0Aimport pwd%0Aimport grp
%0A%0Aif __n
@@ -625,16 +625,173 @@
, 0775)%0A
+ uid = pwd.getpwnam('eventkit').pw_uid%0A gid = grp.getgrnam('eventkit').gr_uid%0A os.chown('./coverage', uid, gid)%0A
|
0976ce5424e9b4699152513821ea15473f715dab | Fix manage.py (remove CR from newlines) | manage.py | manage.py | #!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("""Error: Can't find the file 'settings.py' in the directory containing %r.
It appears you've customized things.
You... | Python | 0 | @@ -14,17 +14,16 @@
v python
-%0D
%0Afrom dj
@@ -69,15 +69,13 @@
ager
-%0D
%0Atry:
-%0D
%0A
@@ -130,17 +130,16 @@
rectory.
-%0D
%0Aexcept
@@ -150,17 +150,16 @@
rtError:
-%0D
%0A imp
@@ -165,17 +165,16 @@
port sys
-%0D
%0A sys
@@ -263,17 +263,16 @@
ing %25r.
-%0D
%0AIt appe
@@ -301,17 +301,16 @@
... |
83afe8cf85be49af16c8e6da7110fb76a38b5843 | Drop unicode compatibility handling | pinax/blog/conf.py | pinax/blog/conf.py | from __future__ import unicode_literals
from django.conf import settings # noqa
from appconf import AppConf
from .utils import load_path_attr
def is_installed(package):
try:
__import__(package)
return True
except ImportError:
return False
DEFAULT_MARKUP_CHOICE_MAP = {
"markdo... | Python | 0.000055 | @@ -1,45 +1,4 @@
-from __future__ import unicode_literals%0A%0A
from
|
ade3ae6e3889e9e8c73313130896922f0d2d9af2 | improve and add feature | loctext/learning/annotators.py | loctext/learning/annotators.py | from nalaf.learning.taggers import RelationExtractor
from nalaf.structures.dataset_pipelines import PrepareDatasetPipeline
from nalaf.learning.taggers import StubSameSentenceRelationExtractor
from nalaf.learning.svmlight import SVMLightTreeKernels
from nalaf.structures.relation_pipelines import RelationExtractionPipeli... | Python | 0 | @@ -50,78 +50,8 @@
tor%0A
-from nalaf.structures.dataset_pipelines import PrepareDatasetPipeline%0A
from
@@ -107,32 +107,32 @@
lationExtractor%0A
+
from nalaf.learn
@@ -316,16 +316,84 @@
nerator%0A
+from loctext.relations.specific import LocationWordFeatureGenerator%0A
%0A%0Aclass
@@ -903,22 +903,27 @@
ors(
-cl... |
d8650237d9bf6c0ff4c45e47ea24371393b2809f | Copy record's dict so we don't affect other formatters | logstash_formatter/__init__.py | logstash_formatter/__init__.py | '''
This library is provided to allow standard python
logging to output log data as JSON formatted strings
ready to be shipped out to logstash.
'''
import logging
import socket
import datetime
import traceback as tb
import json
import sys
def _default_json_default(obj):
"""
Coerce everything to strings.
A... | Python | 0 | @@ -1777,16 +1777,23 @@
__dict__
+.copy()
%0A
|
b6581dd8b41b266fdde3cc4e3b8381304ba04f24 | fix manage | manage.py | manage.py | from flask.ext.script import Manager, Command, prompt_bool, prompt, prompt_pass, prompt_choices
from mongoengine import connect
from registry import app, registers, auth
from datetime import datetime
import os
import json
def resolve_choice(value):
return value
import_dir = '%s/import-data' % os.path.dirname(os.p... | Python | 0.000001 | @@ -644,24 +644,16 @@
-service_
organisa
@@ -1184,24 +1184,16 @@
ct_uri,
-service_
organisa
|
3b677c17c21b708de90c1e7d67d60caaf8d3eafa | add todo | manage.py | manage.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import shutil
import sys
import os
import os.path as path
import config as cfg
import download as dl
import util as u
import namemanip
# TODO:
# FIX listening. it's not being emptied when files are copied
# TEST pod downloading and processing at the same time
# c... | Python | 0.000001 | @@ -558,16 +558,47 @@
es first
+%0A # ensure all folders exist
%0A%0A# Wrap
|
b07edd6b1d29530c50855e193b45f21d40187348 | fix test tools bugs | tools/test.py | tools/test.py | import argparse
import torch
import mmcv
from mmcv.runner import load_checkpoint, parallel_test, obj_from_dict
from mmcv.parallel import scatter, MMDataParallel
from mmdet import datasets
from mmdet.core import results2json, coco_eval
from mmdet.datasets import collate, build_dataloader
from mmdet.models import build... | Python | 0.000001 | @@ -139,16 +139,25 @@
scatter,
+ collate,
MMDataP
@@ -265,25 +265,16 @@
s import
- collate,
build_d
|
bec3d37c6fc1ed61d3a528a8b54e1f9c4c98a4c9 | update doc string | manage.py | manage.py | #!/usr/bin/env python
import os
import subprocess
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.script import Manager, Shell
from redis import Redis
from rq import Connection, Queue, Worker
from app import create_app, db
from app.models import Role, User
if os.path.exists('.env'):
print('I... | Python | 0.000001 | @@ -2223,16 +2223,26 @@
he yapf
+and isort
formatte
@@ -2242,16 +2242,17 @@
ormatter
+s
over th
|
6747fc4a4e648aff5af8b4b865b52e9a5c9e8ca3 | Add manager command | manage.py | manage.py | #!/usr/bin/env python
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
import os.path as p
from subprocess import call, check_call
from flask import current_app as app
from flask.ext.script import Server, Manager
from config import Config as c
from app i... | Python | 0.000026 | @@ -579,16 +579,66 @@
.PORT))%0A
+manager.add_command('serve', Server(port=c.PORT))%0A
manager.
|
d1704364c67a9d8869d47590e6a48aeced7262ff | Refactor some common git command code. | SublimePackageSync.py | SublimePackageSync.py | import os
import subprocess
import sublime
import sublime_plugin
class SublimePackageSyncAll(sublime_plugin.ApplicationCommand):
def __init__(self):
self.settings = sublime.load_settings(
"SublimePackageSync.sublime-settings")
def run(self, autorun=False):
print("[SublimePackage... | Python | 0.000001 | @@ -2877,181 +2877,53 @@
-if not self.report_subprocess(subprocess.Popen(%5B%22git%22, %22clone%22, remote, path%5D, stdout=subprocess.PIPE, stderr=subprocess.PIPE)):%0A raise SublimePackageSyncGitError
+self.run_git_command(%5B%22clone%22, remote, path%5D)
%0A
@@ -4034,63 +4034,30 @@
-if not... |
f43b3bc50e25f77a9bfbd18a3fb551a7cf644b18 | fix map generator to exclude .exe and .out files. | mapgen.py | mapgen.py | import sys,os
root = "./codes/"
for path, subdirs, files in os.walk(root):
print "processing : "+path
print "\tfound "+str(len(files)+len(subdirs))+" files."
mapperFile=open(path+"/mapper.txt","w+")
for dir in subdirs:
print "\t\tadding directory : "+dir
mapperFile.write(dir+"\n");
for file in files:
if(fi... | Python | 0 | @@ -319,9 +319,9 @@
file
-!
+=
=%22ma
@@ -333,122 +333,175 @@
txt%22
-):%0A%09%09%09print %22%5Ct%5Ctadding file : %22+file%0A%09%09%09mapperFile.write(file+%22%5Cn%22);%0A%09%09else:%0A%09%09%09print %22%5Ct%5Ctskipping mapper file.%22
+ or file.endswith(%22.exe%22) or file.endswith(%22.out%22)):%0A%09%09%09print %... |
dff1c464b82cb870f589f5edf2e81b38fd78405f | add meta options | marshmallow_pynamodb/schema.py | marshmallow_pynamodb/schema.py | from marshmallow import Schema, SchemaOpts, post_load
from marshmallow.schema import SchemaMeta
from pynamodb.attributes import Attribute
from marshmallow_pynamodb.convert import converter
from six import with_metaclass
class ModelOpts(SchemaOpts):
def __init__(self, meta):
SchemaOpts.__init__(self, meta... | Python | 0.000001 | @@ -365,16 +365,122 @@
, None)%0A
+ self.validate = getattr(meta, 'validate', False)%0A self.sync = getattr(meta, 'sync', False)%0A
%0A%0Aclass
|
fea61da7655e5db6ddd4c2c287beb0e1b6eadf09 | Fix import | smop/main.py | smop/main.py | from __future__ import absolute_import
# SMOP compiler -- Simple Matlab/Octave to Python compiler
# Copyright 2011-2013 Victor Leikehman
import smop.version
import sys,six.moves.cPickle,glob,os
import getopt,re
from . import lexer,parse,resolve,backend,options,graphviz
import smop.node as node
import networkx as nx
fr... | Python | 0.000002 | @@ -210,17 +210,20 @@
re%0Afrom
-.
+smop
import
|
eddf5b2280300e6ddc98eb8be65a87fddb5df98e | Add comment | examples/speed_test.py | examples/speed_test.py | from recurrentshop import*
from keras.layers import*
from keras.models import*
import numpy as np
import time
import sys
# Script for comparing performance of native keras and recurrentshop stacked RNN implementations
sys.setrecursionlimit(10000000)
# Params
rnn, rnn_cell = LSTM, LSTMCell
depth = 3
input_length =... | Python | 0 | @@ -213,16 +213,53 @@
tations%0A
+# We observe 20-30%25 speed ups on GPU%0A
%0A%0Asys.se
|
8d75f6859962fc160bb5de4f6943f12e59f3dc33 | remove initial_configuration function | latools/helpers/config.py | latools/helpers/config.py | import configparser
import os
import pkg_resources as pkgrs
from shutil import copyfile
# functions used by latools to read configurations
def read_configuration(config='DEFAULT'):
"""
Read LAtools configuration file, and return parameters as dict.
"""
# read configuration file
conf = configparser... | Python | 0.000022 | @@ -4329,2284 +4329,4 @@
urn%0A
-%0A%0Adef initial_configuration():%0A %22%22%22%0A Convenience function for configuring latools.%0A%0A Run this function when you first use %60latools%60 to specify the%0A location of you SRM data file and your data format file.%0A%0A See documentation for full details.%... |
9bc54e715bcbaf9677c6d8730433cd267a626b53 | Add an error checkpoint | sodd/sodd.py | sodd/sodd.py | import os
import shutil
import subprocess
import threading
import time
import datetime
import simplejson
import yaml
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3
import vcs
def doit_unstable_integration(base_path, task_name):
"""wrap doit integration with some logic t... | Python | 0.000002 | @@ -781,16 +781,33 @@
te()%5B0%5D%0A
+ try:%0A
@@ -845,16 +845,125 @@
output)%0A
+ except ValueError, ve:%0A print %22JSON loading failed: %22 + output%0A raise%0A %0A
|
965bb244fe13334ed1473344201b71cf0043d38d | Add log entry. | sohelpers.py | sohelpers.py | """Second order helper functions by Ian Huston
$Id: sohelpers.py,v 1.3 2009/01/13 18:21:12 ith Exp $
Provides helper functions for second order data from cosmomodels.py"""
import tables
import numpy as N
import cosmomodels as c
import logging
import time
import os.path
_log = logging.getLogger(__name... | Python | 0 | @@ -66,17 +66,17 @@
.py,v 1.
-3
+4
2009/01
@@ -81,18 +81,18 @@
01/1
-3 18:21:12
+5 17:08:54
ith
@@ -907,21 +907,20 @@
_log.
-debug
+info
(%22Source
@@ -960,26 +960,37 @@
t order file
-.%22
+ %25s.%22, fofile
)%0A finall
|
dd5591978cd3505dc22880f5669dd2d28a0ae028 | Fix plans export with choices | meinberlin/apps/plans/views.py | meinberlin/apps/plans/views.py | import json
from django.conf import settings
from django.contrib import messages
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from adhocracy4.exports import mixins as export_mixins
from adhocracy4.exports imp... | Python | 0 | @@ -3219,16 +3219,188 @@
ntact)%0A%0A
+ def get_status_data(self, item):%0A return item.get_status_display()%0A%0A def get_participation_data(self, item):%0A return item.get_participation_display()%0A%0A
%0Aclass D
|
19b9b6472dc08a797fb659032f9ec11f27845db1 | clean up some comments | Halpy/Halpy.py | Halpy/Halpy.py | #!/usr/bin/env python
#this is the most simplistic irc bot, meant as a first example for simple alerting
import socket
import sys
import time
import requests
from xml.etree import ElementTree
#constants
#server = "irc.etsycorp.com"
server = "irc.freenode.org"
channel = "#Synculus"
nick = "Halpy"
alert = ":!halp"
ack ... | Python | 0 | @@ -202,37 +202,8 @@
nts%0A
-#server = %22irc.etsycorp.com%22%0A
serv
|
3ecf2c0e0ce723ed1f908bc640b86cc3309fe72b | Bump to 4.2.0 | flask_jwt_extended/__init__.py | flask_jwt_extended/__init__.py | from .jwt_manager import JWTManager
from .utils import create_access_token
from .utils import create_refresh_token
from .utils import current_user
from .utils import decode_token
from .utils import get_csrf_token
from .utils import get_current_user
from .utils import get_jti
from .utils import get_jwt
from .utils impor... | Python | 0.000095 | @@ -766,9 +766,9 @@
%224.
-1
+2
.0%22%0A
|
45fb01c1587cb9dba546d3d8001c782d59bed5a3 | Update median.py | median.py | median.py | #!/usr/bin/python
-*- coding:utf-8 -*-
from random import Random
generator = Random()
x = [generator.randint(1,1000) for i in range(1000)]
k = ((len(x)//2) + (len(x)//n +1))//2 if len(x)%2 else len(x)//2
def quickselect(array, k):
pivot = generator.choice(array)
index = array.index(pivot)
a1, a2, a3 = [], [], [... | Python | 0 | @@ -12,16 +12,994 @@
python%0A%0A
+#########################################################################################%0A# Sample program to read csv data generated from MS Excel and put it into a single table%0A# SQLite DB. Negative Number formatting is stripped and appended with a minus ('-') sign%0A#%0A# %09C... |
3451963bceaa6cb37cf511d336be0100bbcc34a7 | Remove unnecessary print | sanji/publish.py | sanji/publish.py | """
Publish message module
"""
import logging
from time import sleep
from sanji.message import Message
from sanji.session import Status
from sanji.session import TimeoutError
from sanji.session import StatusError
logger = logging.getLogger()
class Object(object):
pass
class Publish(object):
"""
Pub... | Python | 0.000148 | @@ -4510,26 +4510,8 @@
%22%22%22%0A
- print options%0A
|
6c83e8434c4f44e59eda01142e0a5e74ef100f34 | use empty string namespace | socketio/packet.py | socketio/packet.py | # -=- encoding: utf-8 -=-
import json
MSG_TYPES = {
'disconnect': 0,
'connect': 1,
'heartbeat' : 2,
'message': 3,
'json': 4,
'event': 5,
'ack': 6,
'error': 7,
'noop': 8,
}
MSG_VALUES = dict((v,k) for k, v in MSG_TYPES.iteritems())
ERROR_REASONS = {
'transport not supporte... | Python | 0.999447 | @@ -2933,20 +2933,18 @@
int'%5D =
-None
+''
%0A%0A if
|
ed0d94a1f05f93ba59cb69a181b5665793e4d8d4 | Complete backtracking sol | lc0047_permutations_ii.py | lc0047_permutations_ii.py | """Leetcode 47. Permutations II
Medium
URL: https://leetcode.com/problems/permutations-ii/
Given a collection of numbers that might contain duplicates,
return all possible unique permutations.
Example:
Input: [1,1,2]
Output:
[
[1,1,2],
[1,2,1],
[2,1,1]
]
"""
class Solution(object):
def permuteUnique(self,... | Python | 0.002364 | @@ -276,16 +276,25 @@
Solution
+Backtrack
(object)
@@ -307,156 +307,1280 @@
def
-permuteUnique(self, nums):%0A %22%22%22%0A :type nums: List%5Bint%5D%0A :rtype: List%5BList%5Bint%5D%5D%0A %22%22%22%0A pass%0A%0A%0Adef main():%0A pass
+_backtrack(self, result, temp, is_used, num... |
7535bd611b26fa81944058c49e7238bd67a5f577 | Exclude unnecessary fields for Enjaz | forms_builder/wrapper/forms.py | forms_builder/wrapper/forms.py | from django import forms
from django.forms.models import inlineformset_factory
from forms_builder.forms.models import Form, Field
class FormToBuildForm(forms.ModelForm):
"""
A form that is used to create or edit an instance of ``forms.models.Form``.
"""
class Meta:
model = Form
# A form set t... | Python | 0.000001 | @@ -297,16 +297,175 @@
l = Form
+%0A exclude = ('sites', 'redirect_url', 'login_required', 'send_email', 'email_from',%0A 'email_copies', 'email_subject', 'email_message')
%0A%0A# A fo
|
829b9ef70a0cd7a81d53bc56a648e29a526e6da3 | = Null should be is Null | software/do_TTS.py | software/do_TTS.py | #!/usr/bin/env python3
"""
sweeps SQLite for phrases that need to be converted to audio,
handles the conversion,
then inserts the BLOB into the record
runs in background. Started in fish_config.sh
"""
###
# portions related to Bing Text-to-speech are Copyright (c) Microsoft Corporation
#All rights reserved.
#MIT Lice... | Python | 1 | @@ -3692,19 +3692,24 @@
ioStream
-=''
+ is NULL
%22);%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.