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 |
|---|---|---|---|---|---|---|---|
cd6eaa0ee2f04c8d83a2c004f9f414288723bf20 | Disable useless-object-inheritance error | pylint.config.py | pylint.config.py | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Python | 0.000009 | @@ -920,16 +920,58 @@
eturn',%0A
+ 'useless-object-inheritance',%0A
|
336ab517038c680a19bdef697d4be77530f75432 | Update Transfer per 2020-04-30 changes | troposphere/transfer.py | troposphere/transfer.py | # Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 3.3.0
from . import AWSObject
from . import AWSProperty
from troposphere import Tags
VALID_HOMEDIRECTORY_TYPE = ... | Python | 0 | @@ -1139,32 +1139,76 @@
%0A%0A props = %7B%0A
+ 'Certificate': (basestring, False),%0A
'Endpoin
@@ -1447,32 +1447,76 @@
string, False),%0A
+ 'Protocols': (%5Bbasestring%5D, False),%0A
'Tags':
|
802cae2f8daf4ddca37d62018dfa749f52156cbe | Implement OnIdle, close #22 | ts3observer/features.py | ts3observer/features.py | '''
Created on Nov 10, 2014
@author: fechnert
'''
import copy
import re
import time
from models import ClientAction
class Feature(object):
''' Represents a abstract Feature '''
def __init__(self, config, base_rules, queue, clients, channels):
''' Initialize the Object, set rules, apply rules '''
... | Python | 0 | @@ -3664,12 +3664,113 @@
-pass
+def filter(self, clid, client):%0A if int(client.client_idle_time) %3E 1500:%0A return client
%0A%0Acl
|
92158d172f634437a91d26c9cfe2bc4986cc85cf | exclude node | pytest_filter.py | pytest_filter.py | # -*- coding: utf-8 -*-
"""
pytest-filter
*************
"""
from __future__ import print_function
import os
import sys
import time
from path import Path
import pytest
import configparser
def pytest_addoption(parser):
parser.addini('filter_file', 'Location of filter file')
@pytest.mark.trylast
def pytest_conf... | Python | 0.000183 | @@ -844,16 +844,861 @@
ister(_filter)%0A%0A
+%0Adef pytest_collection_modifyitems(session, config, items):%0A %22%22%22 return custom item/collector for a python object in a module, or None. %22%22%22%0A if 'filter_file' not in config.inicfg:%0A return%0A%0A remaining = %5B%5D%0A deselected = %5B%5... |
65de447455f48ce5f52f0c986b8ac6275d44f5b7 | Fix invalid escape sequence \d | pytest_flakes.py | pytest_flakes.py | from pyflakes.checker import Binding, Assignment, Checker
from pyflakes.api import isPythonFile
import _ast
import re
import py
import pytest
import sys
import tokenize
def assignment_monkeypatched_init(self, name, source):
Binding.__init__(self, name, source)
if name == '__tracebackhide__':
self.used... | Python | 0.00582 | @@ -3173,16 +3173,17 @@
compile(
+r
%22%5BEW%5D%5Cd%5C
|
b0ccf367238ecb182faac4a9b4928d324af8d048 | fix typos | python/search.py | python/search.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interface to ElasticSearch for serving search requests
#
# Tuan Tran (ttran@l3s.de)
#
import sys
from sys import argv
import os
from os.path import join,isfile,exists
from conn import connect,close as es_close
from elasticsearch import helpers
import pickle as pkl
i... | Python | 0.999974 | @@ -4288,16 +4288,19 @@
rs.scan(
+es,
%0A
|
afc4c7ad7f9406df3ae6ef487743b36d7f9bcbfb | Remove useless status message | qredis/window.py | qredis/window.py | import os
import re
import pprint
import logging
import collections
import redis
from .qt import Qt, QMainWindow, QApplication, QDialog, QMdiSubWindow, QLabel, \
QTreeWidgetItem, QMessageBox, QIcon, QFont, ui_loadable
_this_dir = os.path.dirname(__file__)
_res_dir = os.path.join(_this_dir, 'images')... | Python | 0.000004 | @@ -1838,16 +1838,17 @@
(True)%0A%0A
+%0A
class It
@@ -4166,296 +4166,82 @@
-msg = 'updating %25s' %25 item.text(0)%0A self.status_message('start %25s' %25 msg)%0A try:%0A item.update()%0A self.status_message('finished %25s' %25 msg, timeout=3)%0A except redis.Connecti... |
15d5c3cffff79a161a74a707a1e01eeeb8d5df71 | fix dialplan roaming check | rccn/dialplan.py | rccn/dialplan.py | ############################################################################
#
# Copyright (C) 2013 tele <tele@rhizomatica.org>
#
# Dialplan call routing
# This file is part of RCCN
#
# RCCN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Public License as published by
# t... | Python | 0 | @@ -3859,32 +3859,42 @@
if (self.
+numbering.
is_number_roamin
@@ -4260,16 +4260,26 @@
f (self.
+numbering.
is_numbe
|
9d529d98d9a97eec33fedec71688156f013c19f2 | Use object auth when fetching related Locator field values. | ui/tcmui/core/fields.py | ui/tcmui/core/fields.py | """
Field types for TCM API.
"""
from posixpath import join
import remoteobjects
class FieldMixin(object):
def install(self, attrname, cls):
super(FieldMixin, self).install(attrname, cls)
self.api_submit_name = self.api_name
if not self.api_name.startswith("ns1."):
self.ap... | Python | 0 | @@ -1571,16 +1571,31 @@
%5B%22@url%22%5D
+, auth=obj.auth
)%0A
|
e0836e052aad7f58d958459cfbcbff87826f0e45 | add xml_reflection to the install rule | urdf_parser_py/setup.py | urdf_parser_py/setup.py | #!/usr/bin/env python
from distutils.core import setup
d = {'author': u'Thomas Moulard <thomas.moulard@gmail.com>, David Lu <davidlu@wustl.edu>, Kelsey Hawkins <kphawkins@gmail.com>, Antonio El Khoury <aelkhour@laas.fr>, Eric Cousineau <eacousineau@gmail.com>',
'description': 'The urdf_parser_py package contains a P... | Python | 0 | @@ -646,16 +646,49 @@
rser_py'
+, 'urdf_parser_py.xml_reflection'
%5D,%0A 'url
|
b34991a2713ea321cbb9ab97aaa482c8002d1549 | change from string module to string methods | Lib/io/data_store.py | Lib/io/data_store.py | """ Load or save values to a file.
Shelves work well for storing data, but they are slow to access
repeatedly - especially for large data sets. This module allows
you to store data to a file and then load it back into the workspace.
When the data is stored, a python module is also created as the
... | Python | 0.000031 | @@ -608,22 +608,8 @@
lve%0A
-import string%0A
impo
@@ -795,30 +795,23 @@
e =
-string.split(filename,
+filename.split(
'.')
@@ -1845,31 +1845,24 @@
e =
-string.split(file_name,
+file_name.split(
'.')
|
080407463d28b8b77e31e3762e6a376c11fc744b | Use /surveys/SID/ instead of /surveys/SID for consistency and because it will take ages to adjust the security redirects | src/pcapi/routes.py | src/pcapi/routes.py | import bottle
from bottle import route, request, response, static_file, hook
## pcapi imports
from pcapi import logtool
from pcapi import config
from pcapi import varexport
from pcapi.rest import PCAPIRest
log = logtool.getLogger("pcapi")
################ ROUTES ####################
################################... | Python | 0 | @@ -2384,16 +2384,17 @@
%3Cuserid%3E
+/
',method
|
463694268055ae15df8262ea32f3b1c2964aa146 | Use sudo in test only if needed (#5435) | vault/tests/conftest.py | vault/tests/conftest.py | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import getpass
import os
import time
import pytest
import requests
from datadog_checks.dev import LazyFunction, TempDir, docker_run, run_command
from datadog_checks.dev.conditions import WaitFor
from dat... | Python | 0 | @@ -365,16 +365,31 @@
ate_file
+, running_on_ci
%0Afrom da
@@ -2263,16 +2263,36 @@
= 'root'
+ and running_on_ci()
:%0A
|
8a24ed7fd6549ac8d7849d1337fa203db7014cdc | Update yeti.py | misp_modules/modules/expansion/yeti.py | misp_modules/modules/expansion/yeti.py | import json
try:
import pyeti
except ImportError:
print("pyeti module not installed.")
from pymisp import MISPEvent, MISPObject
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst', 'hostname', 'domain'],
'format': 'misp_standard'
}
# possible mo... | Python | 0 | @@ -3985,32 +3985,75 @@
t(obj_relation)%0A
+ print(obj_to_add%5B'value'%5D)%0A
|
294bdee51afba5f4879c46fefd71eaa88554af30 | Update yeti.py | misp_modules/modules/expansion/yeti.py | misp_modules/modules/expansion/yeti.py | import json
try:
import pyeti
except ImportError:
print("pyeti module not installed.")
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst', 'hostname', 'domain'],
'format': 'misp_standard'
}
# possible module-types: 'expansion', 'hover' or both
m... | Python | 0 | @@ -2368,22 +2368,25 @@
st.get('
-ip-dst
+attribute
'):%0A
@@ -2389,24 +2389,24 @@
-obs_valu
+attribut
e = requ
@@ -2410,22 +2410,25 @@
equest%5B'
-ip-dst
+attribute
'%5D%0A%0A
@@ -2480,17 +2480,26 @@
rch(
-obs_
+attribute%5B'
value
+'%5D
)%0A
|
c0f7dd3445455e9cb51b84944c54ad6f4d45a5dc | Update filtereval_caner.py | mitty/benchmarking/filtereval_caner.py | mitty/benchmarking/filtereval_caner.py | """Needed a way to go through the evaluation VCF from VCF benchmarking and spit out the FP and FN
calls into separate VCFs and then extract reads from those regions into a BAM.
vcffilter can mark the FP and FNs but leaves all the other records in. Would need to chain with vcftools
and at this point things are complica... | Python | 0 | @@ -913,17 +913,85 @@
, mode)%0A
+ bam_in = pysam.AlignmentFile(fname_in%5B:-3%5D + 'bam', %22rb%22)#caner%0A
%0A
-
fp_vcf
@@ -1071,16 +1071,103 @@
header)%0A
+ fp_bam_out = pysam.AlignmentFile(prefix_out+'-fp.bam', %22wb%22, template=bam_in) #caner%0A
fp_roi
@@ -1357,161 +1357,8 @@
w')%0A
- bam_in = pys... |
ce7cc4cc930a75f9f6f567b6ed3cdce4af189b66 | Add test for issue 3180 | sympy/matrices/tests/test_immutable.py | sympy/matrices/tests/test_immutable.py | from sympy import ImmutableMatrix, Matrix, eye, zeros
from sympy.abc import x, y
from sympy.utilities.pytest import raises, XFAIL
IM = ImmutableMatrix([[1,2,3], [4,5,6], [7,8,9]])
ieye = ImmutableMatrix(eye(3))
def test_immutable_creation():
assert IM.shape == (3,3)
assert IM[1,2] == 6
assert IM[2,2] == 9... | Python | 0.000001 | @@ -2240,28 +2240,497 @@
ix(0,0)) == ImmutableMatrix%0A
+%0A# Issue 3180%0A# http://code.google.com/p/sympy/issues/detail?id=3180%0A# Test that Immutable _op_ Immutable =%3E Immutable and not MatExpr%0Adef test_immutable_evaluation():%0A X = ImmutableMatrix(eye(3))%0A A = ImmutableMatrix(3,3, range(9))%0A ass... |
e2557715e85974c5ec3a1aac4c1dccf21de24a2a | Version 1.00: delete finished packages only instead all finished links | module/plugins/hooks/DeleteFinished.py | module/plugins/hooks/DeleteFinished.py | # -*- coding: utf-8 -*-
"""
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 License,
or (at your option) any later version.
This program is distributed ... | Python | 0 | @@ -745,16 +745,50 @@
rt Hook%0A
+from module.database import style%0A
from tim
@@ -801,16 +801,16 @@
rt time%0A
-
%0A%0Aclass
@@ -886,11 +886,12 @@
= %22
-0.5
+1.00
%22%0A
@@ -1184,16 +1184,307 @@
.com%22)%0A%0A
+ @style.queue%0A def deleteFinished(self):%0A self.c.execute(%22DELETE FROM packag... |
24971e3ef673fe1f7bd47c3249db3c6415825f5f | Version up | module/plugins/hoster/FreakshareCom.py | module/plugins/hoster/FreakshareCom.py | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.Hoster import Hoster
from module.plugins.captcha.ReCaptcha import ReCaptcha
from module.plugins.internal.misc import seconds_to_midnight
class FreakshareCom(Hoster):
__name__ = "FreakshareCom"
__type__ = "hoster"
__version__ = "0.47"
... | Python | 0 | @@ -313,9 +313,9 @@
%220.4
-7
+8
%22%0A
|
af1fb4138c548f56cf27d734d106b889236c08e6 | Fix follow/unfollow signal weakref | udata/core/followers/metrics.py | udata/core/followers/metrics.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from udata.core.metrics import Metric, MetricMetaClass
from udata.i18n import lazy_gettext as _
from udata.models import Follow
from .signals import on_follow, on_unfollow
__all__ = ('FollowersMetric', )
class FollowersMetricMetaclass(MetricMetaClass)... | Python | 0.00001 | @@ -737,32 +737,44 @@
connect(callback
+, weak=False
)%0A on
@@ -799,16 +799,28 @@
callback
+, weak=False
)%0A
|
8e8f9c780834616a5cc272a7a18c6a5482ab98f8 | Logistic regression model | genderclasslogisticregression.py | genderclasslogisticregression.py | # -*- coding: utf-8 -*-
"""
Copyright (c) 2016, Cynthia S. Lo
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, copy, modify, mer... | Python | 0.999982 | @@ -2824,16 +2824,80 @@
lorbar()
+%0Atick_marks = np.arange(2)%0Aplt.yticks(tick_marks, %5B'No', 'Yes'%5D)
%0A%0Athresh
|
fcbb0a4e6e1edba568783fade40061b5682affbd | Add test permissions bypass and change structure | geotrek/common/tests/__init__.py | geotrek/common/tests/__init__.py | # -*- encoding: utf-8 -*-
from django.utils import translation
from django.utils.translation import ugettext as _
# Workaround https://code.djangoproject.com/ticket/22865
from geotrek.common.models import FileType # NOQA
from mapentity.tests import MapEntityTest
from geotrek.authent.factories import StructureFacto... | Python | 0 | @@ -20,16 +20,66 @@
-8 -*-%0A%0A
+from django.contrib.auth.models import Permission%0A
from dja
@@ -1171,16 +1171,35 @@
_changed
+_without_permission
(self):%0A
@@ -1406,176 +1406,1186 @@
-obj = self.modelfactory.create(structure=structure)%0A self.client.post(obj.get_update_url(), self.get_good_data()... |
71ca07c23d2bdfee3e5a581c587fdab83610a90f | Make config a class var like the rest of the codebase | mongodb_consistent_backup/Common/DB.py | mongodb_consistent_backup/Common/DB.py | import logging
import ssl
from bson.codec_options import CodecOptions
from inspect import currentframe, getframeinfo
from pymongo import DESCENDING, CursorType, MongoClient
from pymongo.errors import ConnectionFailure, OperationFailure, ServerSelectionTimeoutError
from time import sleep
from mongodb_consistent_backup... | Python | 0.000003 | @@ -587,124 +587,29 @@
elf.
-username = config.username%0A self.password = config.password%0A self.authdb = config.authdb
+config = config
%0A
@@ -799,16 +799,185 @@
etries%0A%0A
+ self.username = self.config.username%0A self.password = self.... |
5fef2befafa70e4a8a393f0479cbdf8648f5db78 | Convert Breadcrumbs to Titlecase, closes #48 | MusicMashupServer.py | MusicMashupServer.py | # server shizzle
import cherrypy
import os
# eigentliche arbeit macht die artist klasse
from MusicMashupArtist import MusicMashupArtist
# template gedoens
from mako.template import Template
from mako.lookup import TemplateLookup
# fuer history generation
from urllib import quote_plus
class MusicMashupServer(object)... | Python | 0.004487 | @@ -223,16 +223,48 @@
teLookup
+%0Afrom titlecase import titlecase
%0A%0A# fuer
@@ -1122,24 +1122,114 @@
ory'%5D = %5B%5D%0A%0A
+%09%09%09%09# also, if name rather than query, convert to titlecase%0A%09%09%09%09query = titlecase(query)%0A%0A
%09%09%09# append
|
d6c5b9a19921ce2c1e3f2e30d6ce0468a5305e80 | Test with Flask-Testing to test POST request | myflaskapp/tests/test_flask_testing.py | myflaskapp/tests/test_flask_testing.py | from flask import Flask
from flask_testing import LiveServerTestCase
from myflaskapp.app import create_app
from myflaskapp.settings import DevConfig, ProdConfig
import requests
class MyTest(LiveServerTestCase):
def create_app(self):
app = create_app(DevConfig)
app.config['TESTING'] = True
... | Python | 0 | @@ -170,16 +170,241 @@
equests%0A
+import datetime as dt%0Aimport pytest%0Afrom myflaskapp.user.models import Role, User%0Afrom myflaskapp.item.models import Item%0Afrom .factories import UserFactory%0Aimport requests%0Afrom bs4 import BeautifulSoup%0Aimport datetime as dt%0A
%0A%0Aclass
@@ -853,10 +853,848 @@
, 20... |
bf2b6036a93db9314a1b0facf1865d74204a7c85 | add klarinetta/chaunter/suzu to character list | necrobot/util/necrodancer/character.py | necrobot/util/necrodancer/character.py | from enum import Enum
class NDChar(Enum):
Cadence = 0
Melody = 1
Aria = 2
Dorian = 3
Eli = 4
Monk = 5
Dove = 6
Coda = 7
Bolt = 8
Bard = 9
Story = 10
All = 11
Nocturna = 12
Diamond = 13
Multichar = 14
Tempo = 15
Mary = 16
Reaper = 17
Coh = 101... | Python | 0 | @@ -201,16 +201,17 @@
ll = 11%0A
+%0A
Noct
@@ -301,16 +301,70 @@
er = 17%0A
+%0A Klarinetta = 18%0A Chaunter = 19%0A Suzu = 20%0A%0A
Coh
|
b0bbf1f940fbdf8d66f826c3935cc6b785a660da | Fix to work with new i18n-ized key names. | test/keystrokes/gtk-demo/learn_mode.py | test/keystrokes/gtk-demo/learn_mode.py | #!/usr/bin/python
"""Test of learn mode.
"""
from macaroon.playback import *
import utils
sequence = MacroSequence()
########################################################################
# We wait for the demo to come up and for focus to be on the tree table
#
sequence.append(WaitForWindowActivate("GTK+ Code Dem... | Python | 0.000008 | @@ -1579,36 +1579,33 @@
SPEECH OUTPUT: '
-KP_I
+i
nsert'%22,%0A %22S
@@ -2211,20 +2211,17 @@
UTPUT: '
-KP_I
+i
nsert'%22,
|
cd931bccbcad189b01673e4aed8b5cf26d9e5324 | Update the version number | web_frontend/version.py | web_frontend/version.py | version = '0.2.1 beta'
| Python | 0.000045 | @@ -10,11 +10,11 @@
'0.
-2.1
+3.0
bet
|
be68cdeeaa9774a52d6ddaeee4761ac39e779f12 | remove double reporting of source path per comment by Anatoly in pull feedback | src/script/scons.py | src/script/scons.py | #! /usr/bin/env python
#
# SCons - a Software Constructor
#
# __COPYRIGHT__
#
# 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... | Python | 0 | @@ -6553,24 +6553,8 @@
h in
- %5Bsource_path%5D +
lib
|
6361c5a132839bacc0177f6462084c6af68ae844 | Set login timeout 30. | tests/features/steps/image_commands.py | tests/features/steps/image_commands.py | # -*- coding: utf-8
from __future__ import unicode_literals
from behave import when, then
@when('we build {image_name} from Dockerfile')
def step_build_dockerfile(context, image_name):
"""
Send "build -t test-image ./tests/features/fixture_data/".
"""
context.cli.sendline('build -t {} {}'.format(imag... | Python | 0.000001 | @@ -1315,16 +1315,28 @@
cceeded'
+, timeout=30
)%0A%0A%0A@whe
|
dfae47b692371dca6a0ff4edde081c5bbd2ddcc7 | Update test_custom_content_injection.py | tests/test_custom_content_injection.py | tests/test_custom_content_injection.py | # coding=utf-8
from flask import Response
from .base_class import ZmirrorTestBase
from .utils import *
class TestContentInjection(ZmirrorTestBase):
"""testing using https://bugzilla.kernel.org"""
class C(ZmirrorTestBase.C):
my_host_name = 'b.test.com'
my_host_scheme = 'https://'
targ... | Python | 0 | @@ -371,16 +371,17 @@
= 'http
+s
://'%0A%0A
|
acdd9db33060b02299b436bd417f2f59d4f09d65 | Throw exception if in verbose mode | workspace_tools/make.py | workspace_tools/make.py | #! /usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable... | Python | 0.000001 | @@ -7550,16 +7550,140 @@
tion,e:%0A
+ if options.verbose:%0A import traceback%0A traceback.print_exc(file=sys.stdout)%0A else:%0A
|
8e663040a145f41677818a94da36d2ad49479469 | Document the allowed methods using the Allow response header. | wsgiservice/__init__.py | wsgiservice/__init__.py | """WsgiService module containing all the root level definitions."""
import cgi
import functools
import json
import re
class Router(object):
def __init__(self, resources):
self._routes = []
search_vars = re.compile(r'\{(\w+)\}').finditer
for res in resources:
# Compile regular ex... | Python | 0 | @@ -2491,16 +2491,30 @@
ce=None,
+ headers=None,
status=
@@ -2664,16 +2664,118 @@
t/xml'%7D%0A
+ if headers:%0A for key in headers:%0A self._headers%5Bkey%5D = headers%5Bkey%5D%0A
@@ -4739,76 +4739,297 @@
-return Response('Invalid method on resource', environ, instan... |
ea6fd81b46ca00970b675f93078c09842a68e71f | fix constructor | src/srnd/network.py | src/srnd/network.py | #
# network.py
#
from . import config
from . import nntp
from . import storage
from . import util
import asyncio
import logging
import os
import queue
import struct
import time
from hashlib import sha1
class NNTPD:
"""
nntp daemon
"""
def __init__(self, daemon_conf, feed_config, store_config):
... | Python | 0.000002 | @@ -5698,16 +5698,29 @@
.daemon,
+ self.policy,
r, w, n
|
4c292c6df0617f5f503ee816d69eba8a237dc76e | Fix typo | tools/schedprof/schedprof/scheduler.py | tools/schedprof/schedprof/scheduler.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from schedprof.coroutine import Coroutine
from schedprof.cpu import CPU, State
class Scheduler(object):
__metaclass__ = ABCMeta
def __init__(self):
self._now = 0
self.cpus = []
self.coros = []
... | Python | 0.999998 | @@ -1432,16 +1432,22 @@
(lambda
+ *args
: None)%0A
|
5c53cb0204b731dfa34ffee02f3544bbcaf79995 | Fix run_test return code. | tools/telemetry/telemetry/run_tests.py | tools/telemetry/telemetry/run_tests.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import fnmatch
import logging
import os
import traceback
import unittest
from telemetry import browser_options
from telemetry import options_for_unittest... | Python | 0.000032 | @@ -4424,10 +4424,10 @@
rn m
-ax
+in
(num
|
120ca91866879d0a374974b4ffaa4da9ccdb80b1 | Fix uri argument | ycml/utils/instances.py | ycml/utils/instances.py | __all__ = ['load_instances', 'shuffle_instances']
from argparse import ArgumentParser
from collections import Counter
import json
import logging
import numpy as np
from tabulate import tabulate
from uriutils import URIFileType
from .timer import Timer
logger = logging.getLogger(__name__)
def load_instances(inst... | Python | 0.000075 | @@ -3329,26 +3329,8 @@
='r'
-, encoding='ascii'
), n
|
efe66a933507b3a9328731346bcae609f0051bd7 | Make objc version of ui_test_case use addError/addFailure/addSuccess so special runners behave sanely. | src/ui_test_case.py | src/ui_test_case.py | # Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Python | 0 | @@ -4454,121 +4454,105 @@
t
-estResult.errors.append((self, e)) # use this directly because addError treats the passed-in value as an
+ry:%0A raise UITestException(e)%0A except:%0A testResult.addError(self, sys.
exc_info
%0A
@@ -4543,24 +4543,27 @@
sys.exc_info
+())
%0A for e i
@@ -458... |
3d805e8aac81df0c0c35cfc4ddc37489225b6464 | add conn close to example file | examples/example_single_grid_district.py | examples/example_single_grid_district.py | #!/usr/bin/env python3
"""This is a simple example file for DINGO.
__copyright__ = "Reiner Lemoine Institut, openego development group"
__license__ = "GNU GPLv3"
__author__ = "Jonathan Amme, Guido Pleßmann"
"""
# ===== IMPORTS AND CONFIGURATION =====
# import DB interface from oemof
import oemof.db as db
# import ... | Python | 0 | @@ -1193,28 +1193,41 @@
ew(conn, mv_grid_districts)%0A
+%0Aconn.close()
|
58d7d5f078aa5bbc0642d2afd2d1fe58e048e9da | Version bump | stacker/__init__.py | stacker/__init__.py | __version__='0.2.4'
from stacker.repl import repl
| Python | 0.000001 | @@ -14,9 +14,9 @@
0.2.
-4
+5
'%0Afr
|
bfe052129ede2a131557c7922667632d084f22d8 | fix for bug https://bugs.launchpad.net/storm/+bug/1170063 in Storm main project | storm/exceptions.py | storm/exceptions.py | #
# Copyright (c) 2006, 2007 Canonical
#
# Written by Gustavo Niemeyer <gustavo@niemeyer.net>
#
# This file is part of Storm Object Relational Mapper.
#
# Storm is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Found... | Python | 0 | @@ -2373,9 +2373,16 @@
f):%0A
-%09
+
retu
@@ -3001,16 +3001,521 @@
t None:%0A
+ try:%0A module_exception.__bases__ += (exception,)%0A except TypeError:%0A # Since PsycoPG %3E= 2.5 psycopg2.Error is built-in%0A tmp_exception = module_exception... |
da8618b931ef3a845b77610ab84144687f0d1076 | Update name of filepath | pelops/etl/extract_feats_from_chips.py | pelops/etl/extract_feats_from_chips.py | import numpy as np
from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.applications.resnet50 import preprocess_input
from keras.models import Model
def load_image(img_path, resizex=224, resizey=224):
data = image.load_img(img_path, target_size=(resizex, resizey))
... | Python | 0.000001 | @@ -1130,38 +1130,17 @@
chip
-base.get_chip_image_path(chip)
+.filepath
%0A
|
3e4edb97ac94b75c7e3a52a6e055b76ad1fbf894 | Make template tag tests use mock model classes | permissions/tests/test_templatetags.py | permissions/tests/test_templatetags.py | from django.test import TestCase
from django.template import Context, Template
from permissions import PermissionsRegistry
class Model:
pass
def can_do(user):
return user is not None
def can_do_with_model(user, instance):
return None not in (user, instance)
class TestTemplateTags(TestCase):
... | Python | 0.000001 | @@ -123,31 +123,37 @@
ry%0A%0A
-%0Aclass Model:%0A%0A pass
+from .base import Model, User
%0A%0A%0Ad
@@ -184,24 +184,36 @@
urn
-user is not None
+'can_do' in user.permissions
%0A%0A%0Ad
@@ -265,36 +265,47 @@
urn
-None not
+'can_do_with_model'
in
-(
user
-, instance)
+.permissions
%0A%0A%0Ac
@@ -743,32 +7... |
0c9492b7033474bb2eacade80fd396313489e156 | Revert "Minor tweak" | flexget/plugins/modify/config_secrets.py | flexget/plugins/modify/config_secrets.py | from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
import codecs
import logging
import os
from datetime import datetime
import yaml
from jinja2 import TemplateError
from sqlalchemy import ... | Python | 0.000003 | @@ -983,27 +983,93 @@
om_file(
-file_path):
+config_base, filename):%0A secret_file = os.path.join(config_base, filename)
%0A if
@@ -1087,25 +1087,27 @@
.exists(
-file_path
+secret_file
):%0A
@@ -1155,25 +1155,27 @@
ist!' %25
-file_path
+secret_file
)%0A tr
@@ -1202,25 +1202,27 @@
cs.open(
-file_... |
7fde1669da77575614f32465cdc5d8749d4bd0e4 | Move thetvdb_lookup to run after all_series and series_premiere have done their parsing. | flexget/plugins/plugin_thetvdb_lookup.py | flexget/plugins/plugin_thetvdb_lookup.py | import logging
from flexget.plugin import get_plugin_by_name, register_plugin, DependencyError, priority
try:
from flexget.plugins.api_tvdb import lookup_series, lookup_episode, get_mirror
except ImportError:
raise DependencyError(issued_by='thetvdb_lookup', missing='api_tvdb',
messag... | Python | 0.000016 | @@ -5255,9 +5255,9 @@
y(11
-5
+0
)%0A
|
9ca08ab62763d46b73999a4ed8d79dd8c9740246 | change links | plugins/analytics/public/shodan_api.py | plugins/analytics/public/shodan_api.py | import json
import logging
import shodan
from core.analytics import OneShotAnalytics
from core.entities import Company
from core.observables import Hostname, AutonomousSystem
class ShodanApi(object):
settings = {
"shodan_api_key": {
"name": "Shodan API Key",
"description": "API K... | Python | 0 | @@ -1893,20 +1893,17 @@
.update(
-o_is
+i
p.active
@@ -1907,25 +1907,28 @@
ive_link_to(
-i
+o_is
p, 'hosting'
|
cd34f60c6018241770b5d5dc1ae6833a28b0db36 | Make VersionUpgrade a class | UM/VersionUpgrade.py | UM/VersionUpgrade.py | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Logger import Logger
from UM.PluginObject import PluginObject
## A type of plug-in that upgrades the configuration from an old file format to
# a newer one.
#
# Each version upgrade plug-in can convert machine... | Python | 0 | @@ -466,19 +466,21 @@
lug-in.%0A
-def
+class
Version
|
d4e4fbe945339f650294fa986834c023265164df | add views config to default config in proto | glim/proto/project/app/config/default.py | glim/proto/project/app/config/default.py | facades = [
# bunch of services to be loaded up when web server starts
]
extensions = [
# bunch of extensions to be loaded up when web server starts
# 'gredis'
]
config = {
'extensions' : {
# 'gredis' : {
# 'default' : {
# 'host' : 'localhost',
# 'port' : '1234',
# 'db' : 0
# }
# }
},
... | Python | 0.000001 | @@ -788,16 +788,59 @@
ssions'%0A
+%09%09%7D,%0A%09%09'views' : %7B%0A%09%09%09'path' : 'app/views'%0A
%09%09%7D%0A%09%7D%0A%7D
|
94189ae76707942cb73be6517466768847e22a3c | solve string2 | google-python-exercises/basic/string2.py | google-python-exercises/basic/string2.py | #!/usr/bin/python2.4 -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic string exercises
# D. verbing
# Given a string, if its length is a... | Python | 1 | @@ -544,32 +544,119 @@
ode here+++%0A
+ if len(s) %3E= 3:%0A if s.endswith(%22ing%22):%0A s += %22ly%22%0A else:%0A s += %22ing%22%0A
return
%0A%0A%0A# E. not_
@@ -639,24 +639,26 @@
ng%22%0A return
+ s
%0A%0A%0A# E. not_
@@ -967,32 +967,151 @@
ode here+++%0A
+ start = s.find(%22not%22)%0A en... |
9ce6dc6aae6019c7084ddb49d46839d9f5ea8119 | Change import | svenv/blog/views.py | svenv/blog/views.py | from blog.forms import ContactForm
from blog.models import Category, Image, Post, Page
from django.conf import settings
from django.shortcuts import get_object_or_404
from django.utils.encoding import smart_text
from django.views import generic
from rest_framework import viewsets
from rest_framework.renderers import Br... | Python | 0.000001 | @@ -439,16 +439,23 @@
getfqdn%0A
+from .
import s
|
f28c46cdab80ff72859007939874bae90b56f03c | Remove unused | svenv/blog/views.py | svenv/blog/views.py | from django.shortcuts import render
from django.views import generic
from blog.models import Blog
class IndexView(generic.ListView):
template_name = 'blog/index.html'
context_object_name = 'blog_list'
def get_queryset(self):
return Blog.objects.order_by('date').reverse() | Python | 0.000349 | @@ -1,40 +1,4 @@
-from django.shortcuts import render%0A
from
|
edeb31d74e27e6f8d8c7d58830b7902b6b45db2d | Fix bug with aioHTTP and none authentification (#4116) | homeassistant/components/camera/mjpeg.py | homeassistant/components/camera/mjpeg.py | """
Support for IP Cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.mjpeg/
"""
import asyncio
import logging
from contextlib import closing
import aiohttp
from aiohttp import web
from aiohttp.web_exceptions import HTTPGatewayTimeout
import... | Python | 0 | @@ -2417,16 +2417,66 @@
= None%0A
+ if self._username and self._password:%0A
@@ -2533,32 +2533,36 @@
ON:%0A
+
self._auth = aio
@@ -2585,32 +2585,36 @@
+
+
self._username,
@@ -2637,16 +2637,20 @@
assword%0A
+
|
c9872515855f919ab022bd1eb2d5c474d0e4a57b | update header | homeassistant/components/sensor/zwave.py | homeassistant/components/sensor/zwave.py | """
homeassistant.components.sensor.zwave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interfaces with Z-Wave sensors.
"""
# pylint: disable=import-error
from openzwave.network import ZWaveNetwork
from pydispatch import dispatcher
import homeassistant.components.zwave as zwave
from homeassistant.helpers.entity import Entity... | Python | 0.000001 | @@ -73,17 +73,16 @@
~~~~~~~%0A
-%0A
Interfac
|
0546126cc5fb1a138c96481061084e9e5fc86e34 | Bump version | synapse/__init__.py | synapse/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2014, 2015 OpenMarket Ltd
#
# 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 applica... | Python | 0 | @@ -691,11 +691,11 @@
= %220.7.0
-b
+c
%22%0A
|
6edec8cba26259d0e05bfceb34329e28d9960b03 | bump version | taskman/__init__.py | taskman/__init__.py | __version__ = '0.0.2'
| Python | 0 | @@ -16,7 +16,7 @@
0.0.
-2
+3
'%0A
|
8a7e81bd4725282a907532dd7419a44a0614c08b | Use referrers not path's on the top referrers list | request/views.py | request/views.py | from datetime import datetime, timedelta, date
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.db.models import Count
from django.utils.translation import ugettext_lazy as _
from django.utils import simplejson, importlib
from request.models import Request
from re... | Python | 0.000001 | @@ -2050,36 +2050,39 @@
().values_list('
-path
+referer
', flat=True))%5B:
|
176352efdee01b012da27eaaa90b23ae83c78132 | Update test for rrnn -> arrnn change. | test/layers_test.py | test/layers_test.py | import numpy as np
import theanets
import theano.tensor as TT
class TestLayer:
def test_build(self):
for f in 'feedforward Feedforward classifier rnn lstm'.split():
l = theanets.layers.build(f, nin=2, nout=4)
assert isinstance(l, theanets.layers.Layer)
class Base:
def setUp(s... | Python | 0 | @@ -1878,16 +1878,17 @@
ass Test
+A
RRNN(Bas
@@ -1954,16 +1954,17 @@
.layers.
+A
RRNN(nin
|
ecb076d9b5b8ee9194ac4b1537450983e5578597 | Change "Video" to "Radio" in radioob | weboob/applications/radioob/radioob.py | weboob/applications/radioob/radioob.py | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | Python | 0.999967 | @@ -3737,12 +3737,12 @@
%25s%5Cn
-Vide
+Radi
o UR
|
0b9726a3edcabb33acee92774f466b5a35813339 | Standardize Slack backend API method | awx/main/notifications/slack_backend.py | awx/main/notifications/slack_backend.py | # Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
import time
import logging
from slackclient import SlackClient
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy as _
from awx.main.notifications.base import AWXBaseEmailBackend
logger = logging.getLogger('awx.mai... | Python | 0.000028 | @@ -56,20 +56,8 @@
d.%0A%0A
-import time%0A
impo
@@ -951,1105 +951,29 @@
lor%0A
- self.connection = None%0A%0A def open(self):%0A if self.connection is not None:%0A return False%0A self.connection = SlackClient(self.token)%0A if not self.connection.rtm_connect():%0A ... |
50f69f5998af6daa16254ca2a1ef45828eafd7fb | remove debug printing | Tank/stepper/config.py | Tank/stepper/config.py | from module_exceptions import StepperConfigurationError, AmmoFileError
import load_plan as lp
import instance_plan as ip
import missile
from mark import get_marker
from util import get_opener
import info
import logging
class ComponentFactory():
def __init__(
self,
rps_schedule=None,
http_... | Python | 0.000002 | @@ -4840,41 +4840,8 @@
e):%0A
- print ammo_tuple%0A
|
51946dd28a6720c38e6323661961ed47d141c120 | Add a "days" argument to the fake command for number of days of data to fake for each child. | babyblotter/management/commands/fake.py | babyblotter/management/commands/fake.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from random import randint, choice
from datetime import timedelta
from decimal import Decimal
from django.core.management.base import BaseCommand
from django.utils import timezone
from faker import Factory
from core.models import Child, DiaperChange, F... | Python | 0.000038 | @@ -765,32 +765,201 @@
eate.'%0A )
+%0A parser.add_argument(%0A '--days',%0A dest='days',%0A default=5,%0A help='How many days of fake entries to create.'%0A )
%0A%0A def handle
@@ -1003,16 +1003,20 @@
osity =
+int(
kwargs%5B'
@@ -1026,16 +1026,17... |
7e25fea1c00c298355fbc58528d307816d01c261 | Update example2.py | TempTables/example2.py | TempTables/example2.py | import MySQLdb as mdb
class TempTable:
customerNumber = 0
salesRep = 0
with open('input.txt', 'r') as f:
lines = f.readlines()
temptable = []
for line in lines:
words = line.split()
tt = TempTable()
tt.customerNumber = int(words[0])
tt.salesRep = int(words[1])
temptable.append... | Python | 0 | @@ -1,8 +1,99 @@
+# Why ABL Example%0A# Authors: Bill Wood, Alan Estrada%0A# File Name: BasicQuery/example2.py%0A %0A
import M
@@ -151,24 +151,21 @@
= 0%0A
-salesRep
+email
= 0%0A%0Awi
@@ -355,24 +355,21 @@
%0A tt.
-salesRep
+email
= int(w
@@ -409,21 +409,16 @@
)%0A%0Atry:%0A
- %0A
db =
@@ -491,2... |
a1ec0d3eb543ab704a4a4db237571ae849548a05 | add model: PartnerReview | backend/unpp_api/apps/partner/models.py | backend/unpp_api/apps/partner/models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from model_utils.models import TimeStampedModel
class Partner(TimeStampedModel):
"""
"""
legal_name = models.CharField(max_length=255)
# display_type = International, national
hq = models.ForeignKey('sel... | Python | 0.000001 | @@ -1671,20 +1671,974 @@
elf.title, self.id)%0A
+%0A%0Aclass PartnerReview(TimeStampedModel):%0A partner = models.ForeignKey(Partner, related_name=%22reviews%22)%0A agency = models.ForeignKey('agency.Agency', related_name=%22partner_reviews%22)%0A reviewer = models.ForeignKey('account.User', related_name=%22p... |
c0bdf3bd08ba86af9cfb967ddc3d4b6448e85d00 | Fix stack stitching to correctly find prefixes | background_hang_reporter_job/profile.py | background_hang_reporter_job/profile.py | import re
import math
tid = 1
pid = 1
fake_start = 1754660864
def to_struct_of_arrays(a):
if len(a) == 0:
raise Exception('Need at least one item in array for this to work.')
result = {k:[e[k] for e in a] for k in a[0].keys()}
result['length'] = len(a)
return result
class UniqueKeyedTable:
... | Python | 0.000003 | @@ -4495,17 +4495,17 @@
xrange(
-1
+0
,len(sta
@@ -4507,16 +4507,20 @@
n(stack)
+ - 1
):%0A
@@ -4561,17 +4561,19 @@
stack%5Bi
--
+ +
1%5D%0A%0A
|
cc6b5269a51fb6f52253fecf5c0e785c76ae420f | fix misspelled identifier | Tank/Plugins/Report.py | Tank/Plugins/Report.py | """Report plugin that plots some graphs"""
import datetime
import time
import string
import json
import os
from collections import defaultdict
from Tank.Plugins.Aggregator import AggregateResultListener, AggregatorPlugin
from Tank.Plugins.Monitoring import MonitoringPlugin
from Tank.MonCollector.collector import Moni... | Python | 0.999345 | @@ -3875,34 +3875,34 @@
def add_aggre
-a
g
+a
ted_second(data_
@@ -4795,34 +4795,34 @@
add_aggre
-a
g
+a
ted_second(data.
@@ -4920,18 +4920,18 @@
dd_aggre
-a
g
+a
ted_seco
|
57222dc6f5d1173b58187d887e38b156c871e5e4 | Make byext.py really work. | Tools/scripts/byext.py | Tools/scripts/byext.py | #! /usr/bin/env python
"""Show file statistics by extension."""
import os
import sys
class Stats:
def __init__(self):
self.stats = {}
def statargs(self, args):
for arg in args:
if os.path.isdir(arg):
self.statdir(arg)
elif os.path.isfile(arg):
... | Python | 0 | @@ -15,16 +15,19 @@
v python
+3.0
%0A%0A%22%22%22Sho
@@ -1902,16 +1902,17 @@
if
+b
'%5C0' in
@@ -1913,24 +1913,24 @@
0' in data:%0A
-
@@ -2104,28 +2104,44 @@
lines =
-data
+str(data, %22latin-1%22)
.splitlines(
@@ -2439,16 +2439,23 @@
exts =
+sorted(
self.sta
@@ -2460,34 +2460,8 @@
... |
0299ca81aa017b97301b7050fa9acf78ef1f11cb | Use refabric's format_socket, fix socket mkdir | blues/application/providers/gunicorn.py | blues/application/providers/gunicorn.py | import os
from urlparse import urlparse
from blues import python, virtualenv
from blues.application.project import sudo_project, project_home, \
virtualenv_path
from refabric.context_managers import sudo
from ... import debian
from ...app import blueprint
from .base import ManagedProvider
from refabric.utils impo... | Python | 0 | @@ -7,205 +7,184 @@
os%0A
+%0A
from
-urlparse import urlparse%0Afrom blues import python, virtualenv%0Afrom blues.application.project import sudo_project, project_home, %5C%0A virtualenv_path%0Afrom refabric.context_managers import sudo
+refabric.context_managers import sudo%0Afrom refabric.utils import info%0Af... |
b788fe333227d2b3eaf570a6a9e4bfcfe7ee5dd8 | return authored events alongisde tagged events | zql-backend/post_processing/handler.py | zql-backend/post_processing/handler.py | import abc
from flask import request, jsonify
from redis import RedisError
import pymongo
from jobs import process_event_data
class BaseHandler(object):
"""
Base class for request handlers.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractproperty
def view_name(self):
"""
Imple... | Python | 0 | @@ -2305,16 +2305,85 @@
fy(%5B%5D)%0A%0A
+ query = %7B'$or': %5B%7B'user_id': user_id%7D, %7B'author': user_id%7D%5D%7D%0A
@@ -2417,36 +2417,21 @@
ts.find(
-%7B'user_id': user_id%7D
+query
).sort('
|
451270a51f7aea1706778de3db3dffdd1227ad17 | add closelog to colagrossi test | Tests/test_dambreak_Colagrossi.py | Tests/test_dambreak_Colagrossi.py | #!/usr/bin/env python
import os
#os.chdir('/home/travis/build/erdc/proteus/air-water-vv/2d/benchmarks/dambreak_Colagrossi')
import pytest
from proteus.iproteus import *
from proteus import Comm
comm = Comm.get()
#import dambreak_Colagrossi_so
import numpy as np
import tables
import collections as cll
import csv
from pr... | Python | 0.000002 | @@ -1356,32 +1356,61 @@
d(self,method):%0A
+ Profiling.closeLog()%0A
%22%22%22 Tear
|
426b2cb5487e4dfcd3d92d4f520ac6db51e82dbf | Allow to render a snippet from a non-site scope as partial | byceps/blueprints/snippet/templating.py | byceps/blueprints/snippet/templating.py | """
byceps.blueprints.snippet.templating
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import sys
import traceback
from flask import abort, g, render_template, url_for
from jinja2 import TemplateNotFound
from ...services.snippet ... | Python | 0.000001 | @@ -1588,16 +1588,28 @@
name, *,
+ scope=None,
ignore_
@@ -1726,24 +1726,50 @@
lt.%0A %22%22%22%0A
+ if scope is None:%0A
scope =
|
e8d787fccc37d60381f24798113a203ac1cc0ea5 | declare file encoding | test/python/test.py | test/python/test.py | import unittest
from pyPLCParser import PLCParser, parseInput, evaluateInput, deformatInput
class PLCParserTestCase(unittest.TestCase):
def runTest(self):
assert parseInput("") == (True, [])
assert parseInput("and or ! anything") == (True, [])
assert parseInput("()") == (True, [[]])
assert parseInput("( '... | Python | 0.000003 | @@ -1,12 +1,55 @@
+#!/usr/bin/python3%0A# -*- coding: utf-8 -*-%0A
import unitt
|
e669ccd3e90de6a46a0bb3a915b0f42955289892 | Improve loading/import performance (10 mins down to 6 secs) with a single transaction. | cards/management/commands/jsonimport.py | cards/management/commands/jsonimport.py | from django.core.management.base import BaseCommand, CommandError
# json support, TODO consider http://pypi.python.org/pypi/omnijson
try:
# Python 2.6+
import json
except ImportError:
try:
# from http://code.google.com/p/simplejson
import simplejson as json
except ImportError:
j... | Python | 0 | @@ -59,16 +59,51 @@
ndError%0A
+from django.db import transaction%0A%0A
%0A# json
@@ -996,16 +996,46 @@
rdSet%0A%0A%0A
+@transaction.commit_on_success
%0Adef dic
@@ -2062,17 +2062,16 @@
card)%0A%0A%0A
-%0A
class Co
|
fbaf157282361d35fb14291cb09336d235f6ad5e | Add debug. | Tools/vsnipe/server.py | Tools/vsnipe/server.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import json
import os
import sys
from bottle import run, post, request, response, get, route
from base64 import b64encode
from pgoapi import PGoApi
from pgoapi.exceptions import AuthException
from pgoapi.utilities import f2i
from pgoapi import utilities as util
... | Python | 0.000001 | @@ -70,16 +70,30 @@
port os%0A
+import random%0A
import s
@@ -675,16 +675,76 @@
counts'%5D
+%0Aaccount = random.choice(accounts)%0Aprint(account)%0Asys.exit()
%0A%0Adef in
|
11f5dc566958d585d6e95e779d4ccabb5d4f9397 | Revert r3169 and r3148 changes to unicode schema reflection test, will add an explicit engine/reflection test to cover. | test/sql/unicode.py | test/sql/unicode.py | # coding: utf-8
"""verrrrry basic unicode column name testing"""
import testbase
from sqlalchemy import *
from sqlalchemy.orm import mapper, relation, create_session, eagerload
from testlib import *
from testlib.engines import utf8_engine
class UnicodeSchemaTest(PersistTest):
def setUpAll(self):
global u... | Python | 0.000002 | @@ -568,17 +568,16 @@
teger),%0A
-%0A
@@ -611,15 +611,9 @@
Unit
-e%5Cu0301
+%C3%A9
ble2
@@ -1505,22 +1505,8 @@
bind
-, reflect=True
)%0A
@@ -1521,28 +1521,43 @@
1 =
-meta.t
+T
able
-s%5B
+(
t1.name
-%5D
+, meta, autoload=True)
%0A
@@ -1571,28 +1571,43 @@
2 =
-meta.t
+T
able
-s%5B
+(
t2.name... |
74bbc1e121962e39afacd356084cc85463a7dcea | fix socialaccount.providers.base.Provider.get_app | allauth/socialaccount/providers/base.py | allauth/socialaccount/providers/base.py | from django.utils.encoding import python_2_unicode_compatible
from allauth.socialaccount import app_settings
from allauth.account.models import EmailAddress
from ..models import SocialApp, SocialAccount, SocialLogin
from ..adapter import get_adapter
class AuthProcess(object):
LOGIN = 'login'
CONNECT = 'conn... | Python | 0.000178 | @@ -950,16 +950,25 @@
(self.id
+, request
)%0A%0A d
|
661c59cf46281540c4aac9616267a350401fae81 | Use subprocess.SubprocessError | coalib/output/printers/EspeakPrinter.py | coalib/output/printers/EspeakPrinter.py | import subprocess
from pyprint.ClosableObject import ClosableObject
from pyprint.Printer import Printer
from coalib.misc import Constants
class EspeakPrinter(Printer, ClosableObject):
def __init__(self):
"""
Raises EnvironmentError if VoiceOutput is impossible.
"""
Printer.__ini... | Python | 0 | @@ -908,16 +908,43 @@
except
+ subprocess.SubprocessError
: # pra
|
9b894c2ea76c1a73eb5b313eed6b90aa192c23a1 | add explicit force endpoint for item refresh | Contents/Code/interface/refresh_item.py | Contents/Code/interface/refresh_item.py | # coding=utf-8
from subzero.constants import PREFIX
from menu_helpers import debounce, set_refresh_menu_state, route
from support.items import refresh_item
from support.helpers import timestamp
@route(PREFIX + '/item/refresh/{rating_key}')
@debounce
def RefreshItem(rating_key=None, came_from="/recent", item_title=No... | Python | 0 | @@ -190,16 +190,80 @@
stamp%0A%0A%0A
+@route(PREFIX + '/item/refresh/%7Brating_key%7D/force', force=True)%0A
@route(P
|
40e56acb10da06aa83a6f9f5eee7dcd314a2102c | update pacbio tests | test/test_pacbio.py | test/test_pacbio.py | from sequana.pacbio import BAMPacbio
from sequana import sequana_data
from easydev import TempFile
def test_pacbio():
b = BAMPacbio(sequana_data("test_pacbio_subreads.bam"))
assert len(b) == 130
b.df
assert b.nb_pass[1] == 130
with TempFile() as fh:
b.filter_length(fh.name, threshold_min=... | Python | 0 | @@ -364,17 +364,16 @@
.stats%0A%0A
-%0A
# te
@@ -822,16 +822,150 @@
eads()%0A%0A
+ with TempFile() as fh:%0A b.to_fasta(fh.name, threads=1)%0A with TempFile() as fh:%0A b.to_fastq(fh.name, threads=1)%0A%0A%0A
def test
@@ -1181,8 +1181,11 @@
m=True)%0A
+%0A%0A%0A
|
9191da87e66118b7192010567961a71bf55995db | Add some tests | test/test_rename.py | test/test_rename.py | # -*- coding: utf-8 -*-
"""Test the submodule “rename.py”."""
import unittest
import audiorename
import os
import shutil
import tempfile
import helper
class TestBasicRename(unittest.TestCase):
def setUp(self):
self.tmp_album = helper.copy_to_tmp(['files', 'album.mp3'])
with helper.Capturing():
... | Python | 0.000008 | @@ -3907,16 +3907,507 @@
ut%5B1%5D)%0A%0A
+ def test_no_color(self):%0A message = self.message(source='/tmp', color=False)%0A with helper.Capturing() as output:%0A message.process(u'lol')%0A self.assertTrue('%5D source.mp3' in output%5B0%5D)%0A%0A @unittest.skip('not working with ... |
733939a871ff8869676b38eb99bba16a81cd3e95 | Fix public key default leaking in tests. | test/test_runner.py | test/test_runner.py | import unittest
import mock
from littlechef_rackspace.api import Regions, RackspaceApi
from littlechef_rackspace.commands import RackspaceCreate, RackspaceListImages
from littlechef_rackspace.deploy import ChefDeployer
from littlechef_rackspace.runner import Runner, MissingRequiredArguments, InvalidConfiguration, Inval... | Python | 0 | @@ -2913,28 +2913,89 @@
-r.main(%5B'list-images
+# another dumb hack%0A r.main(%5B'list-images', '--public-key', 'README.md
'%5D)%0A
@@ -5513,8 +5513,9 @@
nlist%22%5D)
+%0A
|
0842789d7d0aeff396f98e83967c9aaabf2f6a4e | Fix fixture in test_margin() | test/test_window.py | test/test_window.py | import pytest
from test.conftest import BareConfig
bare_config = pytest.mark.parametrize("qtile", [BareConfig], indirect=True)
@bare_config
def test_margin(qtile):
qtile.test_window('one')
# No margin
qtile.c.window.place(10, 20, 50, 60, 0, '000000')
assert qtile.c.window.info()['x'] == 10
asse... | Python | 0 | @@ -85,21 +85,23 @@
etrize(%22
-qtile
+manager
%22, %5BBare
@@ -159,25 +159,29 @@
gin(
-qtile):%0A qtile
+manager):%0A manager
.tes
@@ -213,29 +213,31 @@
margin%0A
-qtile
+manager
.c.window.pl
@@ -272,37 +272,39 @@
00')%0A assert
-qtile
+manager
.c.window.info()
@@ -318,37 +318,39 @@
= 10%0A ... |
cea891a2de493ce211ccf13f4bf0c487f945985d | Print out the new track id. | test_audio_files.py | test_audio_files.py | import fore.apikeys
import fore.mixer
import fore.database
import pyechonest.track
for file in fore.database.get_many_mp3(status='all'):
print("Name: {} Length: {}".format(file.filename, file.track_details['length']))
track.track_from_filename('audio/'+file.filename, force_upload=True)
| Python | 0.000004 | @@ -214,16 +214,24 @@
th'%5D))%0A%09
+track =
track.tr
@@ -290,10 +290,27 @@
ad=True)
+%0A%09print(track.id)
%0A%0A
|
e01a4a7ca346401a66e802eb9b2d8190e65fd606 | Update test_get_image6d.py | test_get_image6d.py | test_get_image6d.py | # -*- coding: utf-8 -*-
"""
@author: Sebi
File: test_get_image6d.py
Date: 02.05.2017
Version. 1.7
"""
from __future__ import print_function
import numpy as np
import bftools as bf
#filename = r'testdata/Beads_63X_NA1.35_xy=0.042_z=0.1.czi'
#filename = r'testdata/T=5_Z=3_CH=2_CZT_All_CH_per_Slice.czi'
#filename = r't... | Python | 0.000001 | @@ -700,26 +700,17 @@
ge = r'b
-ioformats_
+f
package/
|
afaec2e46ed73f5b9e7886f3315a7dbf051ef748 | Make tests 2.6 compatible | tests/board_test.py | tests/board_test.py | import unittest
from go import Board
class BoardTest(unittest.TestCase):
"""
Won't test any of the array functionality. That is covered in
array_test.py.
"""
def setUp(self):
self.bo = Board(5)
def test_init(self):
e = Board.EMPTY
b = Board.BLACK
w = Board.W... | Python | 0.000001 | @@ -330,36 +330,32 @@
self.assert
-List
Equal(self.bo._a
@@ -530,34 +530,36 @@
self.assert
-Is
+True
(self.bo._turn,
@@ -548,33 +548,35 @@
ue(self.bo._turn
-,
+ is
b)%0A self
@@ -574,36 +574,32 @@
self.assert
-Dict
Equal(self.bo._s
@@ -629,36 +629,32 @@
self.assert
-List
Equal(sel... |
e375199a202af802033938dc2af076403dbacf87 | Fix unit test for Org Service | coi/test/test_org_management_service.py | coi/test/test_org_management_service.py | #!/usr/bin/env python
__author__ = 'Stephen P. Henrie'
__license__ = 'Apache 2.0'
import unittest
from mock import Mock, patch
from pyon.util.unit_test import PyonTestCase
from pyon.util.int_test import IonIntegrationTestCase
from nose.plugins.attrib import attr
from pyon.core.exception import BadRequest, Conflict, ... | Python | 0 | @@ -1684,16 +1684,160 @@
%22Foo%22%0A%0A
+ self.user_role = Mock()%0A self.user_role.name = %22Member%22%0A self.user_role2 = Mock()%0A self.user_role2.name = %22Member%22%0A
%0A @pa
@@ -1929,32 +1929,118 @@
eate_org(self):%0A
+%0A self.mock_find_objects.return_value = (%5Bself... |
d15c262942b78b340357f7317286f39ee680bc48 | Fix twtranslate tests by temporarily moving tests/i18n/test.py into scripts/i18n/ when running | tests/i18n_tests.py | tests/i18n_tests.py | # -*- coding: utf-8 -*-
#
# (C) Pywikipedia bot team, 2007
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
import unittest
from pywikibot import i18n
class TestTranslate(unittest.TestCase):
def setUp(self):
self.msg_localized = {'en': u'test-localized EN',
... | Python | 0.000013 | @@ -145,16 +145,26 @@
nittest%0A
+import os%0A
from pyw
@@ -182,16 +182,31 @@
rt i18n%0A
+import shutil%0A%0A
%0Aclass T
@@ -663,19 +663,16 @@
english
-
= %7B'ja':
@@ -2408,32 +2408,280 @@
test.TestCase):%0A
+ def setUp(self):%0A self.path = os.path.realpath(__file__)%5B:-13%5D%0A shutil.cop... |
47279e417720b94efa35601561822ecab44fb7b6 | Update to the unit-test for slicing dataframes and expressions | tests/slice_test.py | tests/slice_test.py | from common import *
def test_slice_expression(df):
assert df.x[:2].tolist() == df[:2].x.tolist()
assert df.x[2:6].tolist() == df[2:6].x.tolist()
def test_slice(ds_local):
ds = ds_local
ds_sliced = ds[:]
assert ds_sliced.length_original() == ds_sliced.length_unfiltered() >= 10
assert ds_slic... | Python | 0 | @@ -141,32 +141,426 @@
2:6%5D.x.tolist()%0A
+ assert df.x%5B-3:%5D.tolist() == df%5B-3:%5D.x.tolist()%0A assert df.x%5B::-3%5D.tolist() == df%5B::-3%5D.x.tolist()%0A%0A%0Adef test_slice_against_numpy(df):%0A assert df.x%5B:2%5D.tolist() == df.x.values%5B:2%5D.tolist()%0A assert df.x%5B2:6%5D.tolist... |
1a261b80dd42b04885b07c40e96dea045fe09e58 | Add tests for the b and c operators. | tests/test_async.py | tests/test_async.py | import wasync
from wasync import *
import datetime as dt
import time
import sys
import unittest
sys.path.append(".")
def longfunc(x):
time.sleep(x)
return x
class TestBasicFunctionality(unittest.TestCase):
def setUp(self):
self.scheduler = wasync.go()
def testDeferredAwait(self):
... | Python | 0.000001 | @@ -1479,16 +1479,283 @@
t(),2)%0A%0A
+ def testBindOperator(self):%0A f1 = determined(1)%0A f2 = f1 %7Cb%7C (lambda x: x + 1)%0A self.assertEqual(f2,2)%0A%0A def testChainOperator(self):%0A f1 = determined(1)%0A f2 = f1 %7Cc%7C (lambda x: x + 1)%0A self.assertEqual(f2.a... |
cad0e8b11f10a847a94e7cc767ea31d80183c574 | Fix up tests | tests/test_basic.py | tests/test_basic.py | import os.path
import unittest
from IPython.nbformat import current as nbformat
from nbparameterise import code
samplenb = os.path.join(os.path.dirname(__file__), 'sample.ipynb')
class BasicTestCase(unittest.TestCase):
def setUp(self):
with open(samplenb) as f:
self.nb = nbformat.read(f, 'ipy... | Python | 0.000319 | @@ -29,47 +29,14 @@
st%0A%0A
-from IPython.nbformat import current as
+import
nbf
@@ -280,15 +280,20 @@
(f,
-'ipynb'
+as_version=4
)%0A%0A
@@ -1154,16 +1154,21 @@
%0A
+ nb =
code.re
@@ -1203,16 +1203,31 @@
rom_form
+, execute=False
)%0A%0A
@@ -1254,29 +1254,10 @@
xec(
-self.nb.worksheets%5B0%5D... |
550b48c0d1b464a782d875e30da140c742cd4b3e | Replace assertGreaterEqual with assertTrue(a >= b) | tests/test_bayes.py | tests/test_bayes.py | from unittest import TestCase
from itertools import repeat, imap, izip, cycle
from spicedham.bayes import Bayes
from spicedham import Spicedham
class TestBayes(TestCase):
def test_classify(self):
sh = Spicedham()
b = Bayes(sh.config, sh.backend)
b.backend.reset()
self._traini... | Python | 0.998952 | @@ -1150,20 +1150,12 @@
sert
-GreaterEqual
+True
(res
@@ -1169,17 +1169,19 @@
mTotal'%5D
-,
+ %3E=
result%5B
|
c7002a39c232cde3088570ff82b436d4ead8130c | put coding line in test_bytes | tests/test_bytes.py | tests/test_bytes.py | from ftfy.guess_bytes import guess_bytes
from nose.tools import eq_
TEST_ENCODINGS = [
'utf-16', 'utf-8', 'sloppy-windows-1252'
]
TEST_STRINGS = [
u'Renée\nFleming', u'Noël\nCoward', u'Señor\nCardgage',
u'€ • £ • ¥', u'¿Qué?'
]
def check_bytes_decoding(string):
for encoding in TEST_ENCODINGS:
... | Python | 0.000006 | @@ -1,12 +1,28 @@
+# coding: utf-8%0A
from ftfy.gu
|
8a46ef083380f481f15f46f7b53f6af95f4a9025 | Test that date attributes are parsed, not computed | tests/test_dates.py | tests/test_dates.py | import datetime
import billboard
from nose.tools import raises
def test_date_rounding():
"""Checks that the Billboard website is rounding dates correctly: it should
round up to the nearest date on which a chart was published.
"""
chart = billboard.ChartData('hot-100', date='1000-10-10')
assert ch... | Python | 0 | @@ -468,16 +468,595 @@
8-03'%0A%0A%0A
+def test_previous_next():%0A %22%22%22Checks that the date, previousDate, and nextDate attributes are parsed%0A from the HTML, not computed. Specifically, we shouldn't assume charts are%0A always published seven days apart, since (as this example demonstrates)%0A this... |
2b0b574bc6503a7318c9ae24530f641b59aaa8e0 | Test separate user and password | tests/test_graph.py | tests/test_graph.py | """Graph (Connection Class) Tests"""
import pytest
from neoalchemy import Graph
def test_default_connection():
graph = Graph()
assert graph.driver.url == 'bolt://localhost'
assert graph.driver.host == 'localhost'
assert graph.driver.port is None
assert graph.driver.config['auth'].scheme == 'basic... | Python | 0.000001 | @@ -1633,28 +1633,447 @@
uth'%5D.credentials == 'pass'%0A
+%0A%0Adef test_separate_user_pass():%0A graph = Graph('bolt://localhost:7474', user='user', password='pass')%0A assert graph.driver.url == 'bolt://localhost:7474'%0A assert graph.driver.host == 'localhost'%0A assert graph.driver.port == 7474%0A ... |
8c6d25b9585fe234a304d92c1c8f1a42e391d7aa | Add unit test for empty char literal. | tests/test_lexer.py | tests/test_lexer.py | import re
import unittest
import sure
import error
import lexer
class TestLexer(unittest.TestCase):
def _lex_data(self, input):
mock = error.LoggerMock()
lex = lexer.Lexer(logger=mock)
lex.input(input)
token_list = list(lex)
return (token_list, mock)
def _assert_ind... | Python | 0 | @@ -3407,24 +3407,64 @@
%22, %22%5Cx1d%22)%0A%0A
+ self._assert_lex_failure(r%22''%22)%0A
self
|
d94f3ad220a52b2d0fe77891a7c8a7826d14175a | Add test for scip.Model from/to pointer | tests/test_model.py | tests/test_model.py | from pyscipopt import Model
def test_model():
# create solver instance
s = Model()
# test parameter methods
pric = s.getParam('lp/pricing')
s.setParam('lp/pricing', 'q')
assert 'q' == s.getParam('lp/pricing')
s.setParam('lp/pricing', pric)
s.setParam('visual/vbcfilename', 'vbcfile')
... | Python | 0 | @@ -2078,16 +2078,264 @@
unded'%0A%0A
+%0Adef test_model_ptr():%0A model1 = Model()%0A ptr1 = model1.to_ptr(give_ownership=True)%0A assert not model1._freescip%0A%0A model2 = Model.from_ptr(ptr1, take_ownership=True)%0A assert model2._freescip%0A assert model2.to_ptr(False) == ptr1%0A%0A%0A
if __nam... |
9534e841b2abcbf37393443f2eb0b39f4ecd475b | test namespace typo | tests/test_scene.py | tests/test_scene.py | import generic as g
from trimesh.scene.transforms import EnforcedForest
def random_chr():
return chr(ord('a') + int(round(g.np.random.random() * 25)))
class SceneTests(g.unittest.TestCase):
def test_scene(self):
for mesh in g.get_mesh('cycloidal.ply',
'sphere.ply'):
... | Python | 0.000022 | @@ -2240,16 +2240,18 @@
assert (
+g.
np.abs(s
|
a5dc4f62601a77fa802308a73a31e08977fa1ea8 | Refactor given_a_series_of_prices method. | 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.000016 | @@ -1454,169 +1454,159 @@
def
-test_increasing_trend_true_3_updates(self):%0A %22%22%22Tests if prices from last three updates return as increasing if they are ascending.%0A%0A Use 3 updates
+given_a_series_of_prices(self, prices):%0A %22%22%22Executes an update for each of three given prices.%0A... |
c3a26ff2801e6f5233432a1869d98e5369a4db11 | add tests for truncate_table | tests/test_utils.py | tests/test_utils.py | import mock
import pytest
from django.test.utils import override_settings
from dj_anonymizer.utils import import_if_exist
@pytest.mark.parametrize('path, expected', [
('hello', False),
('base', True),
])
def test_import_if_exist(mocker, path, expected):
with override_settings(
ANONYMIZER_MODEL_DE... | Python | 0.000001 | @@ -18,16 +18,100 @@
t pytest
+%0A%0Afrom django.contrib.auth.models import User%0Afrom django.db import DEFAULT_DB_ALIAS
%0Afrom dj
@@ -199,16 +199,32 @@
if_exist
+, truncate_table
%0A%0A%0A@pyte
@@ -636,8 +636,542 @@
xpected%0A
+%0A%0A@mock.patch('dj_anonymizer.utils.connections')%0Adef test_truncate_table(mock_... |
a146ccd463418c96bdd1a17947463f17409b715a | add single import function | tests/wav_import.py | tests/wav_import.py | #!/usr/bin/python
#
# Copyright (C) 2008 Parisson
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
#
# Author: Guillaume Pellerin <yomg... | Python | 0.000003 | @@ -603,16 +603,354 @@
.main()%0A
+#%0A# or :%0A#%0A# $ python manage.py shell%0A# %3E%3E%3E from wav_import import TelemetaWavImport%0A# %3E%3E%3E id_string = 'BM.2006.002.001--25__01-10'%0A# %3E%3E%3E source_dir = '/home/momo/music/wav/CNRSMH_2006_002_GUYANE'%0A# %3E%3E%3E source_file = 'CNRSMH_2006_002_001_10.wav'%... |
9de14f23fa43c402d77a57a68eb344670ce12182 | remove redundant print in crud command | tg/commands/crud.py | tg/commands/crud.py | """
TurboGears CRUD interface generator
"""
from paste.script import command
import optparse
import sys
import os
from paste.script.filemaker import FileOp
from paste.script.pluginlib import find_egg_info_dir
class CrudCommand(command.Command):
"""Generate CRUD interface based on model
Example usage::
... | Python | 0.000115 | @@ -4665,55 +4665,8 @@
ath%0A
- print os.path.join(templatepath,'ooo')%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.