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 |
|---|---|---|---|---|---|---|---|
b6d976f83afb6332faedbe36a13a3d6e83e81b3d | add visitor methods for function calls | raco/language/__init__.py | raco/language/__init__.py | from abc import ABCMeta, abstractmethod
import logging
from raco.expression.visitor import ExpressionVisitor
LOG = logging.getLogger(__name__)
class Algebra(object):
__metaclass__ = ABCMeta
@abstractmethod
def opt_rules(self, **kwargs):
raise NotImplementedError("{op}.opt_rules()".format(op=typ... | Python | 0 | @@ -5842,24 +5842,621 @@
te(attr, **self.kwargs))
+%0A%0A def visit_UnaryFunction(self, expr):%0A inputexpr = self.stack.pop()%0A self.stack.append(self.language.function_call(type(expr).__name__, inputexpr))%0A%0A def visit_BinaryFunction(self, expr):%0A left, right = self.__visit_BinaryOpe... |
e4794d6e4f0d6d72330e0e58f2dcf54970ec6476 | Comment added | fluid/neural_machine_translation/rnn_search/train.py | fluid/neural_machine_translation/rnn_search/train.py | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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 appl... | Python | 0 | @@ -2261,16 +2261,69 @@
_cost)%0A%0A
+ # Disable shuffle for Continuous Evaluation only%0A
if n
|
291a99d0ebc8fcd3584daf396a7bb90c7537bd60 | Remove deprecated has_key function | cron/backupSnapshot.py | cron/backupSnapshot.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
# Snapshot configured backups
# Meant to be run once/day... | Python | 0.000048 | @@ -2361,33 +2361,27 @@
if
-r.json().has_key('status'
+'status' in r.json(
):%0A
@@ -3460,33 +3460,27 @@
if
-r.json().has_key('status'
+'status' in r.json(
):%0A
|
c37dc239e808a3ed90b37bd06af1bf094195f142 | Fix bug with should_generate_soy_msg_defs (#154) | closure/templates/closure_js_template_library.bzl | closure/templates/closure_js_template_library.bzl | # -*- mode:python; -*-
#
# Copyright 2016 The Closure Rules Authors. 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 | @@ -2190,16 +2190,17 @@
args +=
+%5B
%22--shoul
@@ -2220,16 +2220,17 @@
MsgDefs%22
+%5D
%0A if ct
|
8b3237d8365c1c86d8430ddf6e6df50d10731b36 | change verbose default value | scripts/sct_denoising_onlm.py | scripts/sct_denoising_onlm.py | #!/usr/bin/env python
from __future__ import absolute_import, division
import sys, io, os, argparse
import numpy as np
from time import time
import nibabel as nib
import sct_utils as sct
from spinalcordtoolbox.utils import Metavar, SmartFormatter
# DEFAULT PARAMETERS
class Param:
# The constructor
def __i... | Python | 0.000004 | @@ -2649,17 +2649,17 @@
default=
-0
+1
,%0A
|
55b4efa6b352578952871990974d7557b2295c45 | Switch to create_using style in argument list. | networkx/drawing/nx_pydot.py | networkx/drawing/nx_pydot.py | """
Import and export networkx networks to dot format using pydot.
References:
- pydot Homepage: http://www.dkbza.org/pydot.html
- Graphviz: http://www.research.att.com/sw/tools/graphviz/
- DOT Language: http://www.research.att.com/~erg/graphviz/info/lang.html
"""
__author__ = """Aric Hagberg (hagberg@lanl.go... | Python | 0.000002 | @@ -61,16 +61,208 @@
pydot.%0A%0A
+Provides:%0A%0A - write_dot()%0A - read_dot()%0A - graphviz_layout()%0A%0A - pydot_from_networkx()%0A - networkx_from_pydot()%0A%0AEither this module or nx_pygraphviz can be used to interface with graphviz. %0A%0A
Referenc
@@ -911,33 +911,8 @@
sys%0A
-from string import split%0A
... |
c2dd946d9260357dac5c09d85bc7a334589a2554 | Fix docstring reference to wrong future class. (#6382) | pubsub/google/cloud/pubsub_v1/subscriber/client.py | pubsub/google/cloud/pubsub_v1/subscriber/client.py | # Copyright 2017, Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Python | 0 | @@ -6790,16 +6790,27 @@
bsub_v1.
+subscriber.
futures.
@@ -6835,23 +6835,11 @@
e: A
- Future object%0A
+%0A
@@ -6848,17 +6848,29 @@
-
+Future object
that ca
|
49f9a2e72acd604d7c0a63630ef8cd67883c7f1a | Change electee survey pestering date logic | electees/management/commands/electee_survey_pester.py | electees/management/commands/electee_survey_pester.py | from datetime import date
from optparse import make_option
from django.core.mail import send_mail
from django.core.management.base import BaseCommand
from django.core.urlresolvers import reverse
from event_cal.models import CalendarEvent
from electees.models import ElecteeInterviewSurvey
from mig_main.models import M... | Python | 0 | @@ -1024,16 +1024,18 @@
()).days
++1
%0A
|
d25c1e53408c792205f10bf8e9e6b20fbc9eb836 | Remove doubled license header from blob_storage.py | tools/perf/benchmarks/blob_storage.py | tools/perf/benchmarks/blob_storage.py | # Copyright 2015 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.
# Copyright 2015 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 fi... | Python | 0.000007 | @@ -1,166 +1,4 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A
# Co
|
04be2f88383d6cdeb59d817c331cd406c25c0c8e | Fix task URL | cumulus/task/status.py | cumulus/task/status.py | from __future__ import absolute_import
from cumulus.starcluster.logging import StarClusterLogHandler, StarClusterCallWriteHandler, logstdout, StarClusterLogFilter
import cumulus.starcluster.logging
from cumulus.starcluster.tasks.celery import app
from cumulus.starcluster.tasks.common import _check_status
import cumulus... | Python | 0.998331 | @@ -563,16 +563,17 @@
'%25s/task
+s
/%25s' %25 (
|
1a5d480a251a78048cd920b9f5b615a787a7b90c | make test easier so that we can use qpbo | pystruct/tests/test_learners/test_frankwolfe_svm.py | pystruct/tests/test_learners/test_frankwolfe_svm.py | from tempfile import mkstemp
import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import assert_less
from sklearn.datasets import load_iris
from pystruct.models import GridCRF, GraphCRF
from pystruct.datasets import generate_blocks_multinomial
from pystruct.learners import FrankWolfeSSVM
f... | Python | 0.000004 | @@ -775,33 +775,33 @@
les=10, noise=0.
-5
+3
, seed=0)%0A cr
|
e3e627b58c94f10c2afac3ed8e3dc59fe4565e35 | Read .xls file contents as string | multi_import/multi_file_importer.py | multi_import/multi_file_importer.py | import zipfile
import chardet
import tablib
import tablib.formats._csv as csv
import tablib.formats._xls as xls
import tablib.formats._xlsx as xlsx
from django.http import HttpResponse
from tablib.core import Dataset
from tablib.compat import BytesIO
from multi_import.multi_importer import (InvalidDatasetError,
... | Python | 0.000027 | @@ -2612,16 +2612,42 @@
rmat(xls
+, read_file_as_string=True
),%0A
|
d9d87d8292ed7b15f3025d060bd101e3f585ba78 | Make Host repr more friendly | testinfra/host.py | testinfra/host.py | # coding: utf-8
# 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
# dist... | Python | 0 | @@ -783,16 +783,120 @@
it__()%0A%0A
+ def __repr__(self):%0A return %22%3Ctestinfra.host.Host %7B%7D%3E%22.format(self.backend.get_pytest_id())%0A%0A
def
|
d58948788be4c2e07ae8aa5a4d563d8df877fd17 | Use all training data on each node for MNIST python test. | py/testdir_0xdata_only/test_DeepLearning_mnist.py | py/testdir_0xdata_only/test_DeepLearning_mnist.py | import unittest, time, sys, random, string
sys.path.extend(['.','..','py'])
import h2o, h2o_gbm, h2o_cmd, h2o_hosts, h2o_import as h2i, h2o_browse as h2b
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
localhost = h2o.de... | Python | 0 | @@ -2300,17 +2300,18 @@
ion' :
-0
+-1
, ## 0:
|
e8b963d042e9ddb6297b23a57efd6e02fc536a5e | Fix diff result for presubmit (#1231) | buildkite/bazel-central-registry/bcr_presubmit.py | buildkite/bazel-central-registry/bcr_presubmit.py | #!/usr/bin/env python3
#
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | Python | 0 | @@ -2571,16 +2571,23 @@
%22, %22main
+...HEAD
%22, %22--na
|
9a1f96b113c37ea7af4fdad34d72ecae4f96322e | Make evaluator_policy_network optional for DistributedAIL | acme/agents/jax/ail/agents.py | acme/agents/jax/ail/agents.py | # python3
# Copyright 2018 DeepMind Technologies Limited. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | Python | 0.000028 | @@ -1798,45 +1798,8 @@
ny,%0A
- evaluator_policy_network: Any,%0A
@@ -2016,24 +2016,78 @@
ss%5D = None,%0A
+ evaluator_policy_network: Optional%5BAny%5D = None,%0A
evalua
@@ -2726,16 +2726,189 @@
s None:%0A
+ if evaluator_policy_network is None:%0A raise ValueError('Either evaluato... |
260f5fc6afd341bd9454d6c20df58552a510ed03 | test print | modules/filters.py | modules/filters.py | import nltk
import datetime
def intersect(a, b, c):
return list(set(a) & set(b) & set(c))
class Filters:
"""This module implements a set of filters through which submissions can be ran through"""
def __init__(self, r, s):
self.r = r
self.s = s
self.already_done = []
se... | Python | 0.000004 | @@ -1539,16 +1539,60 @@
s_list))
+%0A print(str(self.current_events))
%0A%0A
@@ -1989,24 +1989,107 @@
ion.title)%0A%0A
+ print(submission.id)%0A print(str(title_words_list))%0A%0A
|
f1d3d2f5543c0e847c4b2051c04837cb3586846e | Enhance our plotter to use the new div_markers code | emission/analysis/plotting/leaflet_osm/our_plotter.py | emission/analysis/plotting/leaflet_osm/our_plotter.py | import pandas as pd
import folium
def get_map_list(df, potential_splits):
mapList = []
potential_splits_list = list(potential_splits)
for start, end in zip(potential_splits_list, potential_splits_list[1:]):
trip = df[start:end]
currMap = folium.Map([trip.mLatitude.mean(), trip.mLongitude.me... | Python | 0 | @@ -28,16 +28,335 @@
folium%0A%0A
+def df_to_string_list(df):%0A %22%22%22%0A Convert the input df into a list of strings, suitable for using as popups in a map.%0A This is a utility function.%0A %22%22%22%0A print %22Converting df with size %25s to string list%22 %25 df.shape%5B0%5D%0A array_list = ... |
8743263a281ecb0e829ae0cc3e6282e605b98bf5 | fix the problem of partly read triples (#15) | tools/pv_tree_generator/dc_request.py | tools/pv_tree_generator/dc_request.py | # Copyright 2020 Google LLC
#
# 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.000036 | @@ -715,26 +715,8 @@
ig%0A%0A
-_MAX_LIMIT = 100%0A%0A
def
@@ -1184,29 +1184,11 @@
cids
-, limit=_MAX_LIMIT
):%0A
+
@@ -1355,28 +1355,11 @@
cids
-, 'limit': limit
%7D)%0A
-%0A
@@ -1524,24 +1524,24 @@
empty list.%0A
+
resu
@@ -1550,17 +1550,16 @@
s%5Bdcid%5D%0A
-%0A
|
d57735ae0f01a4c0ae8c81dbdda62e07314face1 | Fix Traceback when running neutron-ipset-cleanup tool | neutron/cmd/ipset_cleanup.py | neutron/cmd/ipset_cleanup.py | # Copyright (c) 2015 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
#
# Unless... | Python | 0.000005 | @@ -817,16 +817,70 @@
command%0A
+from neutron.conf.agent import common as agent_config%0A
%0A%0ALOG =
@@ -1138,16 +1138,65 @@
fg.CONF%0A
+ agent_config.register_root_helper(conf=conf)%0A
comm
|
db2308b1599f28e33897ac08d38a4c7751decf64 | add autots import check (#5384) | python/chronos/src/bigdl/chronos/autots/__init__.py | python/chronos/src/bigdl/chronos/autots/__init__.py | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | Python | 0 | @@ -599,141 +599,495 @@
ngs%0A
-%0Atry:%0A from .autotsestimator import AutoTSEstimator%0Aexcept ImportError:%0A warnings.warn(%22Please install %60bigdl-nano%5Ball%5D%60 to use
+from bigdl.nano.utils.log4Error import invalidInputError%0Aimport os%0A%0A%0Aif os.getenv(%22LD_PRELOAD%22, %22null%22) != %22null%22:... |
6ba34904234a2431f158c66dd3dddf0bae3eef7a | Clean up | code/webcam-emotion-recognition/face_detection.py | code/webcam-emotion-recognition/face_detection.py | import cv2
import numpy as np
# Create window for image display
CASCADE_FN = "haarcascade_frontalface_default.xml"
# The scale used for face recognition.
# It is important as the face recognition algorithm works better on small images
# Also helps with removing faces that are too far away
RESIZE_SCALE = 3
RECTANGE_CO... | Python | 0.000002 | @@ -1151,54 +1151,8 @@
et%0A%0A
-# (294, 454, 3) this is the shape of the frame
%0Adef
@@ -1501,21 +1501,23 @@
S)%0A%0A #
- Draw
+Display
the emo
@@ -1525,24 +1525,28 @@
ion
-specifc emoticon
+on the webcam stream
.%0A
|
0a8ce480bac176a53a418f6ab4242fd2f439942e | Bump version | sqlitebiter/__version__.py | sqlitebiter/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.27.1"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| Python | 0 | @@ -205,17 +205,17 @@
= %220.27.
-1
+2
%22%0A__main
|
eee49d1b4a5f326cc7c4becf50b71ebe92580c7c | Update Graphics Python examples to use new pipeline API | Examples/Graphics/Python/SegmentAndBrokenLineSources.py | Examples/Graphics/Python/SegmentAndBrokenLineSources.py | ############################################################
from vtk import *
############################################################
# Create sources
line1 = vtkLineSource()
line1.SetPoint1( 1, 0, 0 )
line1.SetPoint2( -1, 0, 0 )
line1.SetResolution( 32 )
points = vtkPoints()
points.InsertNextPoint( 1, 0, 0 )
p... | Python | 0 | @@ -592,16 +592,26 @@
SetInput
+Connection
( line1.
@@ -619,16 +619,20 @@
etOutput
+Port
() )%0A%0Ama
|
ca2c24a0587e8921cc57c348de8025a99acb5359 | Remove this test because it is flaky. | common/test/acceptance/tests/lms/test_programs.py | common/test/acceptance/tests/lms/test_programs.py | """Acceptance tests for LMS-hosted Programs pages"""
from __future__ import absolute_import
from common.test.acceptance.fixtures.catalog import CatalogFixture, CatalogIntegrationMixin
from common.test.acceptance.fixtures.course import CourseFixture
from common.test.acceptance.fixtures.programs import ProgramsConfigMix... | Python | 0 | @@ -3206,402 +3206,8 @@
r)%0A%0A
- def test_no_enrollments(self):%0A %22%22%22Verify that no cards appear when the user has no enrollments.%22%22%22%0A self.auth(enroll=False)%0A self.stub_catalog_api(self.programs, self.pathways)%0A self.cache_programs()%0A%0A self.listing_page.v... |
b4f3f5cc91836765037a44b359f54cf2c58a2033 | Include defaults in --help output. | myprefetch/fake_updates_prefetch.py | myprefetch/fake_updates_prefetch.py | #!/usr/local/bin/python2.6 -Wignore::DeprecationWarning
import argparse
import logging
import os
from myprefetch import readahead
from myprefetch.rewriters import fake_update
from myprefetch.mysql import Config
def main():
logging.basicConfig()
parser = argparse.ArgumentParser(description="""
This prefetche... | Python | 0 | @@ -497,16 +497,109 @@
hars='@'
+,%0A formatter_class=argparse.ArgumentDefaultsHelpFormatter
)%0A pa
|
2adc65b64d0068597fb1379c6ec5f5ac21f37dd1 | add unicode detection for txt format in upload | src/cm/converters/__init__.py | src/cm/converters/__init__.py | from oo_converters import convert
from pandoc_converters import pandoc_convert
import chardet
# TODO: move that in text_base: save images
def convert_from_mimetype(file_name, mime_type, format):
input = open(file_name, 'r').read()
return _convert_from_mimetype(input, mime_type, format)
def to_unicode(input):... | Python | 0 | @@ -1392,37 +1392,49 @@
nverted_input =
+to_unicode(
input
+)
%0A %0A ##
|
72603e1cbffaecc3abe0076cb4271013b7f550d7 | Add a depreciation warning on importing nipy.neurospin.utils.mask | nipy/neurospin/utils/mask.py | nipy/neurospin/utils/mask.py | """
Compatibility module
"""
# No relative imports, as they are not permitted with 'import *'
from nipy.neurospin.mask import *
| Python | 0 | @@ -27,78 +27,193 @@
%22%22%0A%0A
-# No relative imports, as they are not permitted with '
+import warnings%0Awarnings.warn(DeprecationWarning(%0A %22This module (nipy.neurospin.utils.mask) has been moved and %22 %0A %22is depreciated. Please update your code to
import
-*'%0A
from
+%22%0A %22'
nipy
@@ -... |
e801abea02783d97589040c69621ac8d6f72a85b | Bump version | sqlalchemy_utils/__init__.py | sqlalchemy_utils/__init__.py | from .aggregates import aggregated
from .asserts import assert_nullable, assert_non_nullable, assert_max_length
from .batch import batch_fetch, with_backrefs
from .decorators import generates
from .exceptions import ImproperlyConfigured
from .expression_parser import ExpressionParser
from .functions import (
analyz... | Python | 0 | @@ -1755,9 +1755,9 @@
.27.
-6
+7
'%0A%0A%0A
|
4892c5d51a973846338f6f46f0dd33843a470ea7 | Bump version to 0.5.2 | pucas/__init__.py | pucas/__init__.py | default_app_config = 'pucas.apps.PucasConfig'
__version_info__ = (0, 5, 1, None)
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join([str(i) for i in __version_info__[:-1]])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
| Python | 0.000001 | @@ -66,17 +66,17 @@
(0, 5,
-1
+2
, None)%0A
|
2216370f0f9d04da2c2d5b4556d93e01aecd6e97 | fix testdata | python/testData/completion/predefinedMethodName.py | python/testData/completion/predefinedMethodName.py | class Foo:
def __ra<caret>
| Python | 0.000001 | @@ -14,16 +14,17 @@
def __ra
+d
%3Ccaret%3E%0A
|
b380e0de4b7c24607c16734a46b3e11d64947b01 | Remove a rogue comment. | nova/image/__init__.py | nova/image/__init__.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org... | Python | 0 | @@ -2173,55 +2173,8 @@
rt)%0A
- #glance_client = client.Client(host, port)%0A
|
5bf124cfb5140aebd17fbadfd5fa7d8483d80c62 | Update cartoframes/viz/helpers/color_continuous_layer.py | cartoframes/viz/helpers/color_continuous_layer.py | cartoframes/viz/helpers/color_continuous_layer.py | from __future__ import absolute_import
from .utils import serialize_palette
from ..layer import Layer
from .. import defaults
def color_continuous_layer(
source, value, title='', range_min=None, range_max=None,
palette=None, size=None, opacity=None, stroke_color=None,
stroke_width=None, desc... | Python | 0 | @@ -2769,37 +2769,12 @@
ty =
- '%7B0%7D'.format(opacity or
'1'
-)
%0A%0A
|
ab1e5f107f1ab4aa5b7c48255d56559e278c9ed3 | document include_global option more clearly | nipype/interfaces/nilearn.py | nipype/interfaces/nilearn.py | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
'''
Algorithms to compute statistics on :abbr:`fMRI (functional MRI)`
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirnam... | Python | 0 | @@ -2157,16 +2157,124 @@
%22global%22
+, with values calculated from the entire brain '%0A '(instead of just regions)
')%0A d
|
0086f7ae39c476e10d4d9be14711fc35859f95fa | extend concatenation testing | neurodsp/tests/sim/test_periodic.py | neurodsp/tests/sim/test_periodic.py | """Tests for neurodsp.sim.periodic."""
from neurodsp.tests.tutils import check_sim_output
from neurodsp.tests.settings import FS, N_SECONDS, FREQ1, N_SECONDS_ODD, FS_ODD
from neurodsp.sim.periodic import *
###################################################################################################
###########... | Python | 0.000001 | @@ -957,24 +957,25 @@
oncatenation
+1
():%0A%0A n_s
@@ -984,22 +984,16 @@
onds, fs
-, freq
= 0.1,
@@ -996,17 +996,99 @@
.1, 1000
-,
+%0A%0A # Test an odd frequency value, checking for a smooth concatenation%0A freq =
13%0A
@@ -1109,36 +1109,35 @@
llation(
-N_SECONDS, FS, FREQ1
+n_seconds, fs, fre... |
614df44f6bdccb3c1282c488c1adc6626ebb2f0f | Test w bins not commensurable w array dims. | rebin/tests/test_rebin.py | rebin/tests/test_rebin.py | import unittest
import numpy as np
from numpy.testing import assert_array_almost_equal_nulp
from numpy.testing import assert_array_equal
from rebin import rebin
def my_rebin(a, bins, func=np.mean):
new_shape = tuple(n // b for n, b in zip(a.shape, bins))
def compute_cell(indices):
slices = tuple(s... | Python | 0 | @@ -2794,16 +2794,398 @@
, 4))%0A%0A%0A
+class TestInexactDivision(unittest.TestCase):%0A %22%22%22Assert that remainding cells are discarded.%22%22%22%0A%0A def test1(self):%0A a = np.arange(56).reshape(7, 8)%0A actual = rebin(a, bins=(2, 3), func=np.sum)%0A expected = np.array(%5B%5B30, 48... |
93700dba921c6bffe77f2eaadc2d7ece5dde03e5 | Fix error caused by moving function setup_logging | tests/__init__.py | tests/__init__.py | from bsAbstimmungen import setup_logging
setup_logging('tests/test-logging.json')
| Python | 0.000001 | @@ -12,16 +12,22 @@
immungen
+.utils
import
|
97b1e54abbbd3dc0c9e42b78d5907abfb8cb1531 | use getattr | xskillscore/tests/test_accessor_deterministic.py | xskillscore/tests/test_accessor_deterministic.py | import pytest
import numpy as np
import pandas as pd
import xarray as xr
from xarray.tests import assert_allclose
from xskillscore.core.deterministic import (
median_absolute_error,
mae,
mape,
mse,
pearson_r,
pearson_r_p_value,
pearson_r_eff_p_value,
rmse,
smape,
... | Python | 0.000001 | @@ -2328,961 +2328,8 @@
%0D%0A%0D%0A
-def get_func(ds, metric):%0D%0A if metric == pearson_r:%0D%0A return ds.xs.pearson_r%0D%0A if metric == r2:%0D%0A return ds.xs.r2%0D%0A if metric == pearson_r_p_value:%0D%0A return ds.xs.pearson_r_p_value%0D%0A if metric == spearman_r:%0D%0A ... |
6a1c1ee9c8cf30cfe5a2233dcc24edc9d458107e | changing to string not list | dailydevo/odb_utils.py | dailydevo/odb_utils.py | # coding=utf-8
# Python modules
import urllib
from bs4 import BeautifulSoup
# Google App Engine Modules
from google.appengine.api import urlfetch, urlfetch_errors
# Local Modules
from common import debug, html_utils, text_utils
from common.telegram import telegram_utils
from bible import bible_utils
# Link to fetch... | Python | 0.99885 | @@ -1035,69 +1035,8 @@
p)%0A%0A
- debug.log(%22Finished stripping, going to select blocks%22)%0A%0A
|
3b8c4f7a2184e886128ddf5a31a773322ef4ea97 | fix bug: comment.canonical was removed long ago | adhocracy/lib/auth/comment.py | adhocracy/lib/auth/comment.py | from pylons import tmpl_context as c
from authorization import has
import poll
# helper functions
def is_own(co):
return c.user and co.creator == c.user
# authorisation checks
def index(check):
check.perm('comment.view')
def show(check, co):
check.perm('comment.view')
check.other('comment_is_de... | Python | 0 | @@ -1378,36 +1378,10 @@
able
-_and_canonical',%0A
+',
not
@@ -1406,25 +1406,8 @@
le()
- and co.canonical
)%0A%0A%0A
|
3399683da3ead42d209aa52caa1e247e20b5291b | Remove whitespace characters from blank line | cwltest/utils.py | cwltest/utils.py | import json
from typing import Any, Dict, Set
from six.moves import range
class CompareFail(Exception):
@classmethod
def format(cls, expected, actual, cause=None):
# type: (Any, Any, Any) -> CompareFail
message = u"expected: %s\ngot: %s" % (
json.dumps(expected, indent=4, sort_ke... | Python | 0.999999 | @@ -875,20 +875,16 @@
ip(%22/%22)%0A
-
%0A if
|
845029d62b222a2db84764f62ea7a55d8c51becc | fix update_question command | questions/management/commands/update_questions.py | questions/management/commands/update_questions.py | import json
from optparse import make_option
from django.core.management import BaseCommand, CommandError
from django.db.models import Q
from model.models import Skill
from questions.models import Question, Simulator
class Command(BaseCommand):
help = 'Load question from JSON'
option_list = BaseCommand.optio... | Python | 0.000531 | @@ -3834,32 +3834,81 @@
try:%0A
+ if question%5B%22id%22%5D in id_map:%0A
@@ -4024,24 +4024,131 @@
on%5B%22id%22%5D%5D))%0A
+ else:%0A db_question = Question.objects.get(Q(identifier=question%5B%22id%22%5D))%0A
@@ -6855,24... |
d16006e4274a79b577e2f3ca62c7e2b1db775d4a | fix indent for workqueue.py | MD_simulation_on_trp_cage/current_work/src/workqueue.py | MD_simulation_on_trp_cage/current_work/src/workqueue.py | """
this programs takes a file containing all Python programs to run as input, and
put these programs into a workqueue, and at every instance we make sure only
n Python programs are running
===========================
input:
- file containing Python programs to run
- number of programs allowed to run concurrently
... | Python | 0.000003 | @@ -424,17 +424,20 @@
main():%0A
-%09
+
parser =
@@ -463,17 +463,20 @@
arser()%0A
-%09
+
parser.a
@@ -555,17 +555,20 @@
o run%22)%0A
-%09
+
parser.a
@@ -665,17 +665,20 @@
ently%22)%0A
-%09
+
parser.a
@@ -791,17 +791,20 @@
rams%22)%0A%0A
-%09
+
args = p
@@ -823,17 +823,20 @@
args()%0A%0A
-... |
f6d781d21400fd97df594cebfe51bffcc708282b | remove unneeded logging | account_banking_payment_export/models/payment_mode.py | account_banking_payment_export/models/payment_mode.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
#
# All other contributions are (C) by their respective contributors
#
# All Rights ... | Python | 0.000002 | @@ -3172,145 +3172,8 @@
,))%0A
- else:%0A _logger.warning(%22manual bank transfer payment mode %22%0A %22type not found%22)%0A
|
fb3f1494bc5bff911df39223d7dd4f96c2f8c389 | remove version | tests/__init__.py | tests/__init__.py | """
* Copyright (C) Caleb Marshall and others... - All Rights Reserved
* Written by Caleb Marshall <anythingtechpro@gmail.com>, May 23rd, 2017
* Licensing information can found in 'LICENSE', which is part of this source code package.
"""
__version__ = '1.0.0'
| Python | 0.000003 | @@ -238,27 +238,4 @@
%22%22%22%0A
-%0A__version__ = '1.0.0'%0A
|
fbd4a6527a83638e8af12a50e2ff8e4ef55ed468 | Fix get_needed_hooks | cylon/command.py | cylon/command.py | import imp
import glob
import sys
import logging
from os.path import exists
from cylon.hook import Hook
from cylon.plugin import Plugin, Public, Private
class Loader:
BUILTINS = ['plug', 'help']
BUILTIN_PLUGINS = 'cylon.builtins'
@staticmethod
def get_modules(plugins_dir, plugins_to_load, alias_list):
... | Python | 0.000009 | @@ -4575,20 +4575,16 @@
ename))%0A
-
return
@@ -4580,31 +4580,18 @@
))%0A return
-%5Bplugins, aliases%5D
+hooks
%0A
|
6dec30deb4530f0ce7823f5942448309c2a59cea | FIX invoice restrict invoicing | account_partner_restrict_invoicing/account_invoice.py | account_partner_restrict_invoicing/account_invoice.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, _
from openerp.ex... | Python | 0.000001 | @@ -479,15 +479,43 @@
-if self
+for rec in self:%0A if rec
.par
@@ -574,16 +574,20 @@
+
+
raise Va
@@ -603,16 +603,20 @@
rror(_(%0A
+
@@ -682,16 +682,14 @@
%25s%22
-while '%0A
+'%0A
@@ -701,16 +701,22 @@
'
+while
the fiel
@@ -770,20 +770,23 @@
... |
4b0f54a52fc4ca7f954d8a7e9734ef772894518d | Fix search tests | tests/__init__.py | tests/__init__.py | from search import *
from tests.characters import *
from tests.chats import *
from tests.concepts import *
from tests.issues import *
from tests.locations import *
from tests.movies import *
from tests.objects import *
from tests.people import *
from tests.promos import *
from tests.powers import *
from tests.story_arc... | Python | 0.000045 | @@ -1,25 +1,4 @@
-from search import *%0A
from
@@ -264,32 +264,59 @@
powers import *%0A
+from tests.search import *%0A
from tests.story
|
801b077024f1233b1026e5d8e8884bde22afc1df | use correct attribute to find the instance of a bound method | py/test/compat.py | py/test/compat.py | import py
from py.test.collect import Function
class TestCaseUnit(Function):
""" compatibility Unit executor for TestCase methods
honouring setUp and tearDown semantics.
"""
def runtest(self, _deprecated=None):
boundmethod = self.obj
instance = boundmethod.im_self
instanc... | Python | 0.000034 | @@ -42,16 +42,105 @@
nction%0A%0A
+if py.std.sys.version_info %3E (3, 0):%0A _self = %22__self__%22%0Aelse:%0A _self = %22im_self%22%0A%0A
class Te
@@ -366,16 +366,24 @@
tance =
+getattr(
boundmet
@@ -389,17 +389,16 @@
thod
-.im
+,
_self
-
+)
%0A
|
bc0ac1637d46355caa55a372b3763e52dc453dc9 | Fix numpy dtypes | numba/numpy_support.py | numba/numpy_support.py | from __future__ import print_function, division, absolute_import
import numpy
import re
from numba import types, config
version = tuple(map(int, numpy.__version__.split('.')[:2]))
int_divbyzero_returns_zero = config.PYVERSION <= (3, 0)
FROM_DTYPE = {
numpy.dtype('bool'): types.boolean,
numpy.dtype('int8'): t... | Python | 0.000595 | @@ -3385,23 +3385,32 @@
rn %5B
-_inv_typemap%5Bx%5D
+numpy.dtype(str(x)).char
for
@@ -3511,19 +3511,34 @@
rn %5B
-_typemap%5Bx%5D
+from_dtype(numpy.dtype(x))
for
|
a00ee880167f6d03df7a77e99829b25128b527a2 | fix copy paste error | dpkt/tftp.py | dpkt/tftp.py | # $Id$
"""Trivial File Transfer Protocol."""
import struct
import dpkt
# Opcodes
OP_RRQ = 1 # read request
OP_WRQ = 2 # write request
OP_DATA = 3 # data packet
OP_ACK = 4 # acknowledgment
OP_ERR = 5 # error code
OP_OACK = 6 # option acknowledgment
# Error codes
EUNDEF = 0... | Python | 0 | @@ -1998,17 +1998,28 @@
item in
-d
+self.options
.items()
|
22431db73328cce30093bbf1280e1b0eed14d09b | Rename _make_drain_waiter to _drain_helper | aiozmq/stream.py | aiozmq/stream.py | import collections
import asyncio
from .core import create_zmq_connection
from .interface import ZmqProtocol
class ZmqStreamClosed(Exception):
"""A stream was closed"""
@asyncio.coroutine
def create_zmq_stream(zmq_type, *, bind=None, connect=None,
loop=None, zmq_sock=None,
... | Python | 0.999948 | @@ -2772,32 +2772,27 @@
def
-_make
_drain_
-wait
+help
er(self)
@@ -5103,23 +5103,18 @@
ol._
-make_
drain_
-wait
+help
er()
|
4a944bc60a21d77e9a139f8417b5db5ca9eaeb5c | correct assignment of Statement.additional when None | pybind/iscconf.py | pybind/iscconf.py | """Classes for writing ISC configuration files."""
def _write_indent(fh, indent):
"""Write whitespace to file.
Args:
fh: (file) file object
indent: (int) number of tabs ('\t') to be written
"""
for i in range(0, indent):
fh.write('\t')
class _Conf(object):
"""Base class ... | Python | 0.999997 | @@ -5110,16 +5110,38 @@
ditional
+ if additional else %5B%5D
%0A%0A de
|
5c757dda035886a47fa59ba83299508366592431 | version 20200531.2 | pydal/__init__.py | pydal/__init__.py | __version__ = "20200531.1"
from .base import DAL
from .objects import Field
from .helpers.classes import SQLCustomType
from .helpers.methods import geoPoint, geoLine, geoPolygon
| Python | 0 | @@ -17,17 +17,17 @@
0200531.
-1
+2
%22%0A%0Afrom
|
65877e88ab9819ed0a505d3cedd2b180bf6f30fa | Update playback.py | pydub/playback.py | pydub/playback.py | import subprocess
from tempfile import NamedTemporaryFile
from .utils import get_player_name, make_chunks
PLAYER = get_player_name()
def _play_with_ffplay(seg):
with NamedTemporaryFile("w+b", suffix=".wav") as f:
seg.export(f.name, "wav")
subprocess.call([PLAYER, "-nodisp", "-autoexit", f.name])
def _play_wi... | Python | 0.000001 | @@ -1,12 +1,239 @@
+%22%22%22%0ASupport for playing AudioSegments - pyaudio is a *much* nicer solution, but%0Ais tricky to install. See my notes on installing pyaudio in a virtualenv (on %0AOSX 10.10): https://gist.github.com/jiaaro/9767512210a1d80a8a0d%0A%22%22%22%0A%0A
import subpr
|
9c9f692c2da9ee989382504026bc7c95826e3842 | add parse_defaults unittest | pyhaproxy/test.py | pyhaproxy/test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import parse
class TestParse(object):
@classmethod
def setup_class(cls):
pass
@classmethod
def teardown_class(cls):
pass
def setup(self):
self.parser = parse.Parser('haproxy.cfg')
self.configration = self.parser.buil... | Python | 0.000001 | @@ -765,28 +765,225 @@
%0A print '-' * 30%0A
+%0A def test_parse_defaults_section(self):%0A for defaults in self.configration.defaults:%0A print defaults.name%0A print defaults.options%0A print defaults.configs
|
d93c0905ba7ffd1ab860ee489bd948d564ff5ea9 | implement wof core get_site_data | pyhis/wof/core.py | pyhis/wof/core.py | import cStringIO as StringIO
import suds
import pyhis.waterml.v1_0 as wml
def get_sites(wsdl_url):
suds_client = suds.client.Client(wsdl_url)
suds_client.service.GetSites('')
response_text = unicode(suds_client.last_received())
response_buffer = StringIO.StringIO()
# hacks: Hydroserver doesn't ... | Python | 0.000001 | @@ -737,16 +737,17 @@
sites%0A%0A
+%0A
def get_
@@ -756,16 +756,26 @@
te_data(
+wsdl_url,
site_cod
@@ -777,16 +777,72 @@
e_code,
+network, variable_code, variable_vocabulary):%0A #k
service=
@@ -886,16 +886,17 @@
+#
date_ran
@@ -934,11 +934,389 @@
-pass%0A
+suds_client = suds.client.Cli... |
a02a31ce0c4ecd15e85289041343489f2ddf0222 | fix bug on kepstitch | pyke/kepstitch.py | pyke/kepstitch.py | from .utils import PyKEArgumentHelpFormatter
import numpy as np
from astropy.io import fits as pyfits
from . import kepio, kepmsg, kepkey, kepstat
__all__ = ['kepstitch']
def kepstitch(infiles, outfile=None, overwrite=False, verbose=False,
logfile='kepstich.log'):
"""
kepstitch -- Append short... | Python | 0 | @@ -2319,16 +2319,20 @@
= infile
+s%5B0%5D
.split('
|
9df6ab3351ac23a7b20d2f20adba54d1c8f97d31 | fix typo kepstitch docstring | pyke/kepstitch.py | pyke/kepstitch.py | from .utils import PyKEArgumentHelpFormatter
import numpy as np
from astropy.io import fits as pyfits
from . import kepio, kepmsg, kepkey, kepstat
__all__ = ['kepstitch']
def kepstitch(infiles, outfile='kepstitch.fits', overwrite=False, verbose=False,
logfile='kepstich.log'):
"""
kepstitch -- ... | Python | 0.999966 | @@ -2222,16 +2222,17 @@
i/kepsti
+t
ch/kplr0
|
ef01cedf72df1e3de80d8b089981270b91f1d93d | make Train prevent serialization of the dataset by other objects | pylearn2/train.py | pylearn2/train.py | """
WRITEME
"""
import os
import datetime
from pylearn2.utils import serial
import warnings
from pylearn2.monitor import Monitor
class Train(object):
"""
A class representing the main loop of the training script. Trains the
specified model using the specified algorithm on the specified dataset.
After ... | Python | 0.000001 | @@ -4666,20 +4666,8 @@
of
-dataset and
trai
@@ -4889,189 +4889,608 @@
-serial.save(self.save_path, self.model)%0A save_end = datetime.datetime.now()%0A delta = (save_end - save_start)%0A print '...done. saving took', str(delta)%0A
+try:%0A # Make sure that savi... |
d1af9d4a245ae6cc60baca4080b88fd2ef8f911c | Add `pylxd.client.Client` to `pylxd.Client`. | pylxd/__init__.py | pylxd/__init__.py | # -*- coding: utf-8 -*-
# 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, softw... | Python | 0 | @@ -690,8 +690,48 @@
# NOQA%0A
+from pylxd.client import Client # NOQA%0A
|
064b8a473f00016d513c14cd78894095b4e49b37 | use meV/angstrom for force | pyqe/qe_output.py | pyqe/qe_output.py | __author__ = 'Zhi Deng'
import pandas as pd
import numpy as np
from pymatgen.util.plotting_utils import get_publication_quality_plot
class BasicAnalyzer(object):
'''
Class for further processing the output data from a csv file.
The basic function is converting the total energy from Ry to
meV, and the ... | Python | 0.000002 | @@ -944,12 +944,12 @@
':13
-.
605
+.
7/0.
|
b151d2c63ba5d224800d358e57ddb456ccbe8702 | Add run_mwcli_command_silently test function | tests/conftest.py | tests/conftest.py | import gzip
import json
import os
import shutil
import signal
import subprocess
import sys
import tempfile
from copy import deepcopy
from io import BytesIO
from typing import List, Dict
import pytest
import requests
import time
from miniworld.util import JSONConfig
devnull = open(os.devnull, "w")
@pytest.fixture(s... | Python | 0.000003 | @@ -3650,16 +3650,342 @@
kwargs)%0A
+ @staticmethod%0A def run_mwcli_command_silently(custom_args: List%5Bstr%5D, *args, **kwargs) -%3E bytes:%0A return subprocess.check_call(%5B'mwcli', '--addr', os.environ.get('MW_SERVER_ADRR', '127.0.0.1')%5D + custom_args,%0A ... |
e2402e8c1f1f058dca39531f548490cb327c4fb2 | Remove db fixture | tests/conftest.py | tests/conftest.py | import pytest
from wikilink.wiki_link import WikiLink
@pytest.fixture()
def engine():
return create_engine('postgresql://localhost/test_database')
@pytest.fixture()
def wikilin_db_connection(tmpdir):
WikiLink.setup_db()
yield
| Python | 0 | @@ -157,97 +157,4 @@
')%0D%0A
-%0D%0A%0D%0A%0D%0A@pytest.fixture()%0D%0Adef wikilin_db_connection(tmpdir):%0D%0A%09WikiLink.setup_db()%0D%0A%09yield%0D%0A%0D%0A
|
df6cb2c96f0833d96a42aea2980717d04b566a2b | Undo skipping trustme tests under linux32 | tests/conftest.py | tests/conftest.py | import hashlib
import platform
import ssl
import pytest
import trustme
pytest_plugins = ['aiohttp.pytest_plugin', 'pytester']
@pytest.fixture
def tls_certificate_authority():
if (platform.system() == 'Linux' and
platform.architecture() == ('32bit', 'ELF')):
pytest.xfail("trustme fails on 32b... | Python | 0 | @@ -12,24 +12,8 @@
lib%0A
-import platform%0A
impo
@@ -160,160 +160,8 @@
():%0A
- if (platform.system() == 'Linux' and%0A platform.architecture() == ('32bit', 'ELF')):%0A pytest.xfail(%22trustme fails on 32bit Linux%22)%0A
|
74d8e24d58d402ad60aef1fb99f6a8fee5fc81b3 | Fix regression test only: annotator use is not created | tests/conftest.py | tests/conftest.py | """Add or override py.test fixtures for all tests in this directory."""
from splinter import Browser
from pytest import fixture
from pytest import skip
def pytest_addoption(parser):
"""Add pytest option --run_embed_tests."""
parser.addoption('--run_embed_tests', action='store_true', default=False,
... | Python | 0.000184 | @@ -948,16 +948,86 @@
gurator%0A
+ from adhocracy_core.testing import includeme_root_with_test_users%0A
impo
@@ -1247,16 +1247,99 @@
ocracy)%0A
+ configurator.commit()%0A configurator.include(includeme_root_with_test_users)%0A
app
|
4227098ca1985cfcdab009af8ecf1155a943a148 | Remove self reference for cookiecutters dirs | tests/conftest.py | tests/conftest.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
conftest
--------
Contains pytest fixtures which are globally available throughout the suite.
"""
import pytest
import os
import shutil
from cookiecutter import utils
@pytest.fixture(scope="function")
def clean_system(request):
"""
Fixture that simulates a ... | Python | 0 | @@ -1455,29 +1455,24 @@
ocation%0A
-self.
cookiecutter
@@ -1522,21 +1522,16 @@
s')%0A
-self.
cookiecu
@@ -1608,37 +1608,32 @@
f os.path.isdir(
-self.
cookiecutters_di
@@ -1776,37 +1776,32 @@
f os.path.isdir(
-self.
cookiecutters_di
@@ -1828,37 +1828,32 @@
utils.rmtree(
-self.
cookiecutters_di
@@ -1... |
8684bd9c1324f1f3030a84090202f3665407854b | remove unused csrf_exempt | noter_backend/noter_backend/urls.py | noter_backend/noter_backend/urls.py | from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from main import views
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from django.views.decorators.csrf import csrf_exempt
urlpatterns = [
path('api/v0.1/images/... | Python | 0.000001 | @@ -220,61 +220,8 @@
tic%0A
-from django.views.decorators.csrf import csrf_exempt%0A
%0A%0Aur
@@ -394,20 +394,8 @@
/',
-csrf_exempt(
view
@@ -418,17 +418,16 @@
_view())
-)
,%0A pa
|
79cb523ac5c440eca078594f9841302189b7db97 | implement alternate ABC | corehq/apps/reports/v2/models.py | corehq/apps/reports/v2/models.py | from __future__ import absolute_import
from __future__ import unicode_literals
from collections import namedtuple
from corehq.apps.reports.v2.exceptions import EndpointNotFoundError
EndpointContext = namedtuple('EndpointContext', 'slug urlname')
ColumnMeta = namedtuple('ColumnMeta', 'title name width')
class Base... | Python | 0.999999 | @@ -73,16 +73,28 @@
terals%0A%0A
+import six%0A%0A
from col
@@ -119,16 +119,56 @@
medtuple
+%0Afrom abc import ABCMeta, abstractmethod
%0A%0Afrom c
@@ -3817,28 +3817,69 @@
ter(
-object):%0A%0A @class
+six.with_metaclass(ABCMeta)):%0A%0A @classmethod%0A @abstract
meth
|
6b7148bb9f9845a9897bb64776ea4025cc4d186e | Patch for issue #303 (thanks to @eltjpm) | numba/tests/issues/test_issue_56.py | numba/tests/issues/test_issue_56.py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from numba import *
from numba.testing import test_support
import numpy
import unittest
# NOTE: See also numba.tests.ops.test_binary_ops
def maxstar1d(a, b):
M = a.shape[0]
res = numpy.empty(M)
for i in range(M):
... | Python | 0 | @@ -659,16 +659,30 @@
ertTrue(
+numpy.allclose
(test_fn
@@ -701,12 +701,24 @@
t_b)
- ==%0A
+,%0A
@@ -768,16 +768,9 @@
_b))
-.all())%0A
+)
%0A%0Aif
|
465a75f0a2757b38ecb97c3ecb884c71a26c31b5 | fix indentation | corehq/apps/userreports/tasks.py | corehq/apps/userreports/tasks.py | import datetime
import logging
from celery.task import task
from couchdbkit import ResourceConflict
from sqlalchemy.exc import DataError
from casexml.apps.case.models import CommCareCase
from couchforms.models import XFormInstance
from dimagi.utils.chunked import chunked
from dimagi.utils.couch.database import iter_d... | Python | 0.000358 | @@ -1805,20 +1805,16 @@
%5D, e))%0A%0A
-
if n
@@ -1849,36 +1849,32 @@
ig_id):%0A
-
redis_client.del
@@ -1892,28 +1892,24 @@
ey)%0A
-
-
config.meta.
@@ -1934,37 +1934,29 @@
rue%0A
-
try:%0A
-
@@ -1973,28 +1973,24 @@
e()%0A
-
-
except Res... |
18a9863627f5edb2f909f3c900600d0883493ac0 | Add back fft to scipy namespace. | Lib/__init__.py | Lib/__init__.py | """\
SciPy --- A scientific computing package for Python
===================================================
You can support the development of SciPy by purchasing documentation
at
http://www.trelgol.com
It is being distributed for a fee for a limited time to try and raise
money for development.
Documentation is ... | Python | 0 | @@ -884,16 +884,48 @@
, randn%0A
+from numpy.fft import fft, ifft%0A
from num
@@ -1042,16 +1042,31 @@
, 'rand'
+, 'fft', 'ifft'
%5D%0A%0A__doc
|
79bda51a4dd10f0b24d7d5565d12d435f6d2cb2a | Set the lastverified field default value to now. | restclients/models/trumba.py | restclients/models/trumba.py | from django.db import models
from datetime import datetime
def is_bot(campus_code):
return campus_code is not None and campus_code == TrumbaCalendar.BOT_CAMPUS_CODE
def is_sea(campus_code):
return campus_code is not None and campus_code == TrumbaCalendar.SEA_CAMPUS_CODE
def is_tac(campus_code):
return ca... | Python | 0.000063 | @@ -2545,20 +2545,30 @@
default=
-None
+datetime.now()
)%0A%0A d
@@ -3505,16 +3505,92 @@
level)%0A%0A
+ def set_lastverified(self):%0A self.lastverified = datetime.now()%0A%0A
def
|
0813a926adf2cbb0b75afdcea6ffc3f4f8cc00ed | Update bwaf_server_maintenance.py | bwaf_server_maintenance/bwaf_server_maintenance.py | bwaf_server_maintenance/bwaf_server_maintenance.py | #!/usr/bin/python
import sys
import requests
import json
import base64
if len(sys.argv) < 6:
print('usage: bwaf_server_maintenance.py <waf_url (including port)> <username> <password> <server ip> <server port> <action {"In Service" | "Out of Service Maintenance"} >')
sys.exit(2)
waf_url = str(sys.argv[1]... | Python | 0.000001 | @@ -266,16 +266,170 @@
e%22%7D %3E')%0A
+ print('more usage: if you just want to see a list of services, servers, and rules, put some bogus values in for server ip, server port, and action.')%0A
sys.
|
869bc0dc815fe6fe99f9ab742baebba121f56e71 | Sort timers by earliest first | lunchbot.py | lunchbot.py | from collections import defaultdict
from datetime import (
datetime,
timedelta,
)
from util import parse_time, format_timedelta
from random import choice
import time
from ircbot import (
IRCBot,
response,
command,
)
class LunchBot(IRCBot):
def __init__(self, *args, **kwargs):
super(... | Python | 0.999034 | @@ -2046,12 +2046,20 @@
end(
+(done,
out)
+)
%0A
@@ -2069,16 +2069,79 @@
if s:%0A
+ out = %5Be%5B1%5D for e in sorted(s, key=lambda e:e%5B0%5D)%5D%0A
@@ -2200,17 +2200,19 @@
'.join(
-s
+out
),)%0A
|
9d5288317efe81e89df76839ca33938ec8d4a3c4 | Change input to UTF-8 | motobot/irc_bot.py | motobot/irc_bot.py | from .irc_message import IRCMessage
from .irc_level import IRCLevel
from .database import Database
from socket import create_connection
from importlib import import_module, reload
from pkgutil import iter_modules
from time import sleep
import re
import traceback
class IRCBot:
""" IRCBot class, plug in and go! ""... | Python | 0.999989 | @@ -5444,13 +5444,13 @@
), '
-ASCII
+UTF-8
', '
|
b40d55c7a7c2646535796f2fa897c2bfe755dd09 | fix example code for timing. | python_example.py | python_example.py | # python_example.py
# Steve Ivy <steveivy@gmail.com>
# http://monkinetic.com
# this file expects local_settings.py to be in the same dir, with statsd host and port information:
#
# statsd_host = 'localhost'
# statsd_port = 8125
# Sends statistics to the stats daemon over UDP
class Statsd(object):
@staticm... | Python | 0 | @@ -493,16 +493,12 @@
me',
-'
+
500
-%7Cms'
)%0A
|
cf2e38a9ffac6294be8fc67f5ab422e07b4deab1 | fix log message | macports.py | macports.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# macports: updates macports
# https://github.com/bnomis/macports-update
# (c) Simon Blanchard
import argparse
import datetime
import subprocess
import sys
# the port command
portcmd = '/opt/local/bin/port'
# where to write logs
logfile = '/var/root/logs/macports.log'
#... | Python | 0.00001 | @@ -1371,22 +1371,21 @@
s, '
-Starting ended
+Ending update
%25s'
|
248b1bd0278f99a50480ad6c76a80e9a76776ea0 | test ipv6 addresses as well as ipv4: | ceph_deploy/tests/unit/util/test_arg_validators.py | ceph_deploy/tests/unit/util/test_arg_validators.py | import socket
from mock import Mock
from argparse import ArgumentError
from pytest import raises
from ceph_deploy.util import arg_validators
class TestRegexMatch(object):
def test_match_raises(self):
validator = arg_validators.RegexMatch(r'\d+')
with raises(ArgumentError):
validator(... | Python | 0 | @@ -1992,16 +1992,380 @@
1.111'%0A%0A
+ def test_ipv6_is_allowed_when_paired_with_host(self):%0A self.fake_sock.gethostbyname = Mock(return_value='2001:0db8:85a3:0000:0000:8a2e:0370:7334')%0A hostname = arg_validators.Hostname(self.fake_sock)%0A result = hostname('name:2001:0db8:85a3:0000:0000:... |
880f4d02e583fb29ee295c1143bba1b31a19dffe | Update package generator | ocds/databridge/scripts/packages.py | ocds/databridge/scripts/packages.py | # -*- coding: utf-8 -*-
from ocds.storage.backends.couch import CouchStorage
import argparse
import yaml
import iso8601
import os
from ocds.export.package import Package
from ocds.export.release import get_release_from_tender
from uuid import uuid4
import time
import sys
URI = 'https://fake-url/tenders-{}'.format(uui... | Python | 0.000001 | @@ -1161,16 +1161,385 @@
d None%0A%0A
+def dump_package(releases, config):%0A info = config%5B'release'%5D%0A package = Package(%0A releases,%0A info%5B'publisher'%5D,%0A info%5B'license'%5D,%0A info%5B'publicationPolicy'%5D,%0A URI%0A )%0A path = os.path.join(config%5B'p... |
f63edccb0bec5232ef8cbe0e6dadf1411d1594c9 | Version bump. | mpdlcd/__init__.py | mpdlcd/__init__.py | VERSION = '0.1'
| Python | 0 | @@ -10,7 +10,7 @@
'0.
-1
+2
'%0A
|
9e041ef89f32f85919540c9be38f499807f7a18e | add list of lists | oertube/controllers.py | oertube/controllers.py | import os
from flask import Flask, request, Response
from flask import render_template, url_for, redirect, send_from_directory
from flask import send_file, make_response, abort
from oertube import app
# routing for API endpoints, generated from the models designated as API_MODELS
from oertube.core import api_manager... | Python | 0.000001 | @@ -1377,16 +1377,127 @@
t(404)%0A%0A
+@app.route('/lists')%0Adef lists(item_id=None):%0A return redirect(%22http://editorial.mixd.tv/puls-highlights%22)%0A%0A
%0A# speci
|
24680b61df921496a5035006628c8e9b3ef07ad9 | Implement funtion to get intraday data | alpha-vantage/alphavantage.py | alpha-vantage/alphavantage.py | try:
# Python 3 import
from urllib.request import urlopen
except ImportError:
# Python 2.* import
from urllib2 import urlopen
from simplejson import loads
class AlphaVantage:
"""
This class is in charge of creating a python interface between the Alpha
Vantage restful API and your p... | Python | 0 | @@ -338,16 +338,81 @@
%0A %22%22%22
+%0A _ALPHA_VANTAGE_API_URL = %22http://www.alphavantage.co/query?%22
%0A%0A de
@@ -489,16 +489,21 @@
est(self
+, url
):%0A
@@ -509,85 +509,1148 @@
-url = %22http://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY
+%22%22%22 Request data from the given ... |
41ff5c749019da549dd1b7f7aef67b3416cbf0aa | fix color specification | quadpy/helpers.py | quadpy/helpers.py | # -*- coding: utf-8 -*-
#
import math
import numpy
def plot_disks(plt, pts, weights, total_area):
'''Plot a circles at quadrature points according to weights.
'''
sum_weights = math.fsum(weights)
for tp, weight in zip(pts, weights):
# use matplotlib 2.0's color scheme
color = '1f77b4' ... | Python | 0 | @@ -297,32 +297,33 @@
color = '
+#
1f77b4' if weigh
@@ -327,32 +327,33 @@
ight %3E= 0 else '
+#
d62728'%0A
@@ -1188,16 +1188,17 @@
olor = '
+#
1f77b4'
@@ -1218,16 +1218,17 @@
0 else '
+#
d62728'%0A
|
e8635b02226d07581a7630eb7385d83a38b57a0e | Fix bug | cartoframes/data/dataset/registry/query_dataset.py | cartoframes/data/dataset/registry/query_dataset.py | from carto.exceptions import CartoException, CartoRateLimitException
from .base_dataset import BaseDataset
from ....utils.utils import is_sql_query
class QueryDataset(BaseDataset):
def __init__(self, data, credentials, schema=None):
super(QueryDataset, self).__init__(credentials)
self._query = d... | Python | 0.000001 | @@ -3053,16 +3053,24 @@
= self._
+context.
execute_
|
3f75c6b02c1171959727687700042512c450d59d | Use policy_file parameter in quantum.policy | quantum/policy.py | quantum/policy.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack, LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache... | Python | 0.000003 | @@ -1061,16 +1061,76 @@
HE = %7B%7D%0A
+cfg.CONF.import_opt('policy_file', 'quantum.common.config')%0A
%0A%0Adef re
|
60ff8042d9a883f27308a5f3a0e6ea8385d739e0 | Move DEV check to within project folder | museum/settings.py | museum/settings.py | import os
import sys
import mimetypes
mimetypes.add_type("application/wasm", ".wasm", True)
try:
from .private import DATABASES
except ImportError:
error = """ERROR: Database settings not found.
Make sure museum/private.py exists and contains a DATABASE variable that
matches Django's configuration format.
See... | Python | 0 | @@ -1133,28 +1133,38 @@
ile(
-%22/var/projects/
+os.path.join(BASE_DIR, %22
DEV%22)
+)
els
|
19dd810c5acb35ce5d7565ee57a55ae725194bd1 | Add finalize method to Integration. | mvp/integration.py | mvp/integration.py | # -*- coding: utf-8 -*-
class Integration(object):
name = None
description = None
icon = None
banner = None
requires_confirmation = False
enabled_by_default = False
columns = 1
def __init__(self):
self.set_enabled(self.enabled_by_default)
def fields(self):
'''Ret... | Python | 0 | @@ -1428,32 +1428,38 @@
yblast(self,
+ form,
data):%0A
retu
@@ -1438,32 +1438,73 @@
f, form, data):%0A
+ '''Runs before playblasting.'''%0A%0A
return N
@@ -1548,22 +1548,594 @@
t(self,
-data):
+form, data):%0A '''Runs after playblasting.'''%0A%0A return NotImplemented%0A%0A ... |
b83a4bf53bfb893ca953c5301d9beee1f3dee320 | change wording for podcast privacy settings | mygpo/web/forms.py | mygpo/web/forms.py | from django import forms
from django.utils.translation import ugettext as _
from mygpo.api.models import Device, DEVICE_TYPES, SyncGroup
from mygpo.log import log
import re
class UserAccountForm(forms.Form):
email = forms.EmailField(label=_('Your Email Address'))
public = forms.BooleanField(required=False, lab... | Python | 0 | @@ -776,39 +776,86 @@
=_('
-Should this be a public podcast
+May we include your subscription to this podcast in our (anonymous) statistics
?'))
|
00356535f7aa8ec97a196c3758e835fff18772bb | allow migrated users to chose usernames with uppercase letters (bug 851) | mygpo/web/users.py | mygpo/web/users.py | #
# This file is part of my.gpodder.org.
#
# my.gpodder.org is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# my.gpodder.org i... | Python | 0.000001 | @@ -3252,32 +3252,40 @@
ame) != username
+.lower()
:%0A re
|
5225857a4a3e481871e64910cae7c579974869d6 | Use argparse for the output | MultiReceive.py | MultiReceive.py | import time
import datetime
import subprocess
import multiprocessing
import TestConfig
import Configs
import ZfsApi
import Pid
import Common
import MonitorThread
import ReceiveThread
import Results
# Use TestConfig to ensure this computer is set up properly
TestConfig.check_all()
# This test case will use the test sen... | Python | 0 | @@ -62,16 +62,32 @@
cessing%0A
+import argparse%0A
import T
@@ -208,16 +208,237 @@
esults%0A%0A
+parser = argparse.ArgumentParser()%0Aparser.add_argument('-v', '--verbose', action=%22store_true%22,%0A help=%22The script will periodically print stats about TXGs and %22%0A %22 receive speed%22)%0Aargs = ... |
82a7a79264e4667124d73c8eda00a6c44d69bb8a | Update the admin table to allow the insert of course cert settings LEARNER-1787 | lms/djangoapps/certificates/admin.py | lms/djangoapps/certificates/admin.py | """
django admin pages for certificates models
"""
from config_models.admin import ConfigurationModelAdmin
from django import forms
from django.contrib import admin
from certificates.models import (
CertificateGenerationConfiguration,
CertificateGenerationCourseSetting,
CertificateHtmlViewConfiguration,
... | Python | 0 | @@ -2095,46 +2095,18 @@
ey',
-)%0A readonly_fields = ('course_key',
+ 'enabled'
)%0A
|
4b49f77261777f0f40fadb8a9f151afe4c3b321b | Append hash of extra kwargs if present | datatableview/cache.py | datatableview/cache.py | import inspect
import hashlib
from django.core.cache import caches
from django.conf import settings
class cache_types(object):
NONE = None
DEFAULT = 'default'
SIMPLE = 'simple' # Stores queryset objects directly in cache
PK_LIST = 'pk_list' # Stores queryset pks in cache for later expansion back to... | Python | 0.000001 | @@ -2216,24 +2216,465 @@
(user.pk,)%0A%0A
+ # All other kwargs are used directly to create a hashed suffix%0A # Order the kwargs by key name, then convert them to their repr() values.%0A items = sorted(kwargs.items(), key=lambda item: item%5B0%5D)%0A values = %5B%5D%0A for k, v in items:%0A value... |
2916048b8e0bb170685cbfa931cfa9120d0344de | Add project_fields option to output parameters | dcore/configuration.py | dcore/configuration.py | """
Some simple tools for making model configuration nicer.
"""
class Configuration(object):
def __init__(self, **kwargs):
for name, value in kwargs.iteritems():
self.__setattr__(name, value)
def __setattr__(self, name, value):
"""Cause setting an unknown attribute to be an erro... | Python | 0.000002 | @@ -826,16 +826,157 @@
= None%0A
+ #: Should the output fields be interpolated or projected to%0A #: a linear space? Default is interpolation.%0A project_fields = False%0A
%0A%0Aclass
|
1f63f84fde3a557077c60a6466c4399fdfc3711d | Update version to 2.0b2-dev | openslides/__init__.py | openslides/__init__.py | __author__ = 'OpenSlides Team <support@openslides.org>'
__description__ = 'Presentation and assembly system'
__version__ = '2.0b1'
| Python | 0 | @@ -125,7 +125,11 @@
2.0b
-1
+2-dev
'%0A
|
80e94bd64ca23d78e57fe0937a9924e4df08072a | Fix #445 -- UnicodeDecodeError in SQLSelectForm. | debug_toolbar/forms.py | debug_toolbar/forms.py | from __future__ import unicode_literals
import json
import hashlib
from django import forms
from django.conf import settings
from django.db import connections
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.core.exceptions import ValidationError
from debug... | Python | 0 | @@ -2239,16 +2239,17 @@
arams =
+(
force_te
@@ -2273,17 +2273,46 @@
T_KEY) +
-
+%0A force_text(
data%5B'sq
@@ -2314,19 +2314,31 @@
a%5B'sql'%5D
+)
+
+force_text(
data%5B'pa
@@ -2343,16 +2343,18 @@
params'%5D
+))
%0A
|
4dd7aa004e1921c3bdc14e007bed411ecf32fe78 | remove article box FK of opps channel | opps/channel/models.py | opps/channel/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from opps.core.models import Publishable
from opps.channel.utils import generate_long_slug
class ChannelManager(models.Manager):
def... | Python | 0 | @@ -1254,210 +1254,8 @@
e)%0A%0A
- articlebox = models.ForeignKey(%0A 'article.ArticleBox',%0A verbose_name=_(u%22Article Box%22),%0A null=True,%0A blank=True,%0A on_delete=models.SET_NULL)%0A%0A%0A
|
bb0fdba3db129d7eed38622e01c4881ec42ba6a3 | Fix indentation | core/lib/pizzas_repository.py | core/lib/pizzas_repository.py | import sys
sys.path.append('../gen-py')
from pizza_delivery import ttypes
from lib.db import db
class PizzasRepository(object):
@classmethod
def get_available_pizzas(cls):
pizzas_dict = db.get('/pizzas', None)
pizzas = {}
for pizza_id, pizza_dict in pizzas_dict.iteritems():
... | Python | 0.017244 | @@ -609,24 +609,25 @@
+
pizza_dict%5B'
@@ -638,16 +638,17 @@
eUrl'%5D,%0A
+
|
30703fed7f48204103935c31319df17a60bee8b7 | Move out module attributes to a common object | hug/decorators.py | hug/decorators.py | import sys
from collections import OrderedDict, namedtuple
from functools import partial
from falcon import HTTP_BAD_REQUEST, HTTP_METHODS
import hug.output_format
from hug.run import server
def call(urls=None, accept=HTTP_METHODS, output=hug.output_format.json, examples=(), versions=None):
urls = (urls, ) if i... | Python | 0.000001 | @@ -188,16 +188,191 @@
erver%0A%0A%0A
+class HugAPI(object):%0A __slots__ = ('versions', 'routes')%0A%0A def __init__(self, versions=()):%0A self.versions = set(versions)%0A self.routes = OrderedDict()%0A%0A%0A
def call
@@ -2508,19 +2508,23 @@
if not '
-HUG
+__hug__
' in mod
@@ -2616,19 +2616,28... |
50bfa85ddf12659994e6fdd31612c946d7bf5025 | Add support for matching against values with a ; | data/migrations/create-sql-functions.py | data/migrations/create-sql-functions.py | from collections import namedtuple
from jinja2 import Environment
from jinja2 import FileSystemLoader
from TileStache.Goodies.VecTiles.transform import _parse_kt
import os.path
import csv
Rule = namedtuple(
'Rule',
'calc equals not_equals not_exists set_memberships default_rule'
)
def format_key(key):
if... | Python | 0 | @@ -1191,32 +1191,369 @@
ontinue%0A
+# if the matcher is surrounded by quotes, we assume that%0A # should be an equals value matcher with what is inside the%0A # quotes. This allows us to handle values that have a ;%0A # character in them%0A if matcher.startswith('%22') and matcher.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.