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 |
|---|---|---|---|---|---|---|---|
67c4149588412d3ae9c7ad9abd430454e4580248 | Update TypeScriptTest.py to work better cross platform (#7436) | tests/TypeScriptTest.py | tests/TypeScriptTest.py | #!/usr/bin/env python3
#
# Copyright 2022 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Python | 0 | @@ -619,51 +619,8 @@
e.%0A%0A
-import argparse%0Aimport filecmp%0Aimport glob%0A
impo
@@ -663,16 +663,27 @@
process%0A
+import sys%0A
from pat
@@ -988,24 +988,124 @@
absolute()%0A%0A
+# Windows works with subprocess.run a bit differently.%0Ais_windows = platform.system() == %22Windows%22%0A%0A
# Get the lo
@@ -11... |
20595878e127db9ca10d124d412dd29242b51c4e | add mock | tests/sample_test.py | tests/sample_test.py | from nose.tools import *
from nose.plugins.attrib import attr
from mysamplecode.samplecode import SampleCode
import mock
from mock import patch
import logging
import unittest
class Test(unittest.TestCase):
def setUp(self):
self.counter = 0
def tearDown(self):
pass
@attr('count')
... | Python | 0.000002 | @@ -172,16 +172,1120 @@
ittest%0A%0A
+class MockLdapConn(object):%0A%0A ldap_user = 'sampleuser'%0A ldap_user_email = 'ldap@no-reply.org'%0A%0A STRATEGY_SYNC = 0%0A AUTH_SIMPLE = 0%0A STRATEGY_SYNC = 0%0A STRATEGY_ASYNC_THREADED = 0%0A SEARCH_SCOPE_WHOLE_SUBTREE = 0%0A GET_ALL_INFO = 0%0A%0A @staticmethod%0A ... |
8583e5d4cd0e19c5177547833e590a6253a4cbc9 | Fix import name | examples/Calibration/SCF_distributions.py | examples/Calibration/SCF_distributions.py | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 18 13:57:50 2021
@author: Mateo
"""
from HARK.datasets.SCF.WealthIncomeDist.parser import income_wealth_dists_from_scf
import seaborn as sns
from itertools import product, starmap
import pandas as pd
# List the education levels and years
educ_lvls = ["NoHS", "HS", "Coll... | Python | 0.000088 | @@ -122,14 +122,20 @@
ist.
-parser
+SCFDistTools
imp
|
71a7d3197719ee64bd488704a0ba990a140a2971 | fix event filter in sms | tcamp/sms/views.py | tcamp/sms/views.py | from django_twilio.views import sms
from django_twilio.decorators import twilio_view
from django.utils import timezone
from dateutil.parser import parse as dateparse
from sked.models import Event, Session
@twilio_view
def coming_up(request, message, to=None, sender=None, action=None, method=None,
statu... | Python | 0.000003 | @@ -391,11 +391,8 @@
vent
-_id
=Eve
|
0d0ac33dcb17692555a673883d42505f4716fcbd | Fix whitespace | kremlin/config_defaults.py | kremlin/config_defaults.py | """
# # #### ##### # # ##### # # # #
# # # # # ## ## # # # ## # #
### #### #### # # # # # # # # #####
# # # # # # # # ## # # #
# # # ##### # # # # # # # #
Kremlin Mag... | Python | 0.999999 | @@ -844,17 +844,19 @@
GES_DEST
-=
+ =
%22%22%0A%0A#UPL
|
7c9c254f84e153a5599ce2304e0a7bde1c41ec00 | Complete find_min() | ds_binary_heap.py | ds_binary_heap.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class BinaryMinHeap(object):
"""Binary Min Heap class."""
def __init__(self):
# Put single zero as the 1st element, so that
# integer division can be used in later methods.
self... | Python | 0.00001 | @@ -1458,28 +1458,46 @@
f):%0A
-pass
+return self.heap_ls%5B1%5D
%0A %0A de
@@ -2754,24 +2754,73 @@
.heap_ls))%0A%0A
+ print('Find min: %7B%7D'.format(bh.find_min()))%0A%0A
print(bh
|
4828499b6914cc8770615b8edd6fbea2f16dcd5f | Test correct operation of one_way flag | tests/test_client.py | tests/test_client.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import _compat
from six.moves.mock import Mock
from tinyrpc.exc import RPCError
from tinyrpc.client import RPCClient, RPCProxy
from tinyrpc.protocols import RPCProtocol, RPCResponse, RPCErrorResponse
from tinyrpc.transports import ClientTransport
@pytest.fi... | Python | 0.00001 | @@ -2912,24 +2912,116 @@
ay_setting)%0A
+ if one_way_setting:%0A mock_protocol.parse_reply.assert_not_called()%0A else:%0A
mock_pro
@@ -3410,16 +3410,48 @@
ponse)%0A%0A
+ if not one_way_setting:%0A
with
@@ -3476,16 +3476,20 @@
Error):%0A
+
|
813d96381d79f068c4e451033c0d8c056278cab7 | Fix for #28 with updated doctest. | babel/messages/mofile.py | babel/messages/mofile.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Edgewall Software
# 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://babel.edgewall.org/wiki/License.
#
# This software consists of v... | Python | 0.000001 | @@ -1213,16 +1213,48 @@
uzzy'%5D)%0A
+ %3E%3E%3E catalog.add('Fizz', '')%0A
%3E%3E%3E
@@ -1589,16 +1589,66 @@
u'fuz'%0A
+ %3E%3E%3E translations.ugettext('Fizz')%0A u'Fizz'%0A
%0A
@@ -2570,32 +2570,149 @@
atalog.charset)%0A
+ if not message.string:%0A msgstr = messag... |
ddd45afa0708682bb11d606e03e38aed111d7b9c | Implement Big Banana, Deviate Banana, Rotten Banana | fireplace/cards/game/all.py | fireplace/cards/game/all.py | """
GAME set and other special cards
"""
from ..utils import *
# The Coin
class GAME_005:
play = ManaThisTurn(CONTROLLER, 1)
| Python | 0.999653 | @@ -121,8 +121,189 @@
LER, 1)%0A
+%0A%0A# Big Banana%0Aclass TB_006:%0A%09play = Buff(TARGET, %22TB_006e%22)%0A%0A%0A# Deviate Banana%0Aclass TB_007:%0A%09play = Buff(TARGET, %22TB_007e%22)%0A%0A%0A# Rotten Banana%0Aclass TB_008:%0A%09play = Hit(TARGET, 1)%0A
|
d91a9ab0264ca3fa35a65a593fdc2da5b595e7c1 | Fix events tests on 3.6+ | tests/test_events.py | tests/test_events.py | #!/usr/bin/env python
import unittest
import mlbgame
class TestEvents(unittest.TestCase):
def test_game_events(self):
events = mlbgame.game_events('2016_08_02_nyamlb_nynmlb_1')
for inning in events:
self.assertIsInstance(inning.num, int)
if inning.num == 1:
... | Python | 0.000002 | @@ -2520,27 +2520,34 @@
itch.sv_id,
+(
str
+, int)
)%0A
@@ -4102,63 +4102,8 @@
.2)%0A
- self.assertEqual(pitch.sv_id, '160802_191259')%0A
|
cef855415f447f802c3777468f34e19e85ca7238 | undo doc test change for linux/mac | tests/docs/test_docs.py | tests/docs/test_docs.py | import subprocess
import unittest
import os
import platform
class Doc_Test(unittest.TestCase):
@property
def path_to_docs(self):
dirname, file_name = os.path.split(os.path.abspath(__file__))
return dirname.split(os.path.sep)[:-2] + ["docs"]
def test_html(self):
wd = os.getcwd()
... | Python | 0 | @@ -461,23 +461,16 @@
%22, %22html
--noplot
%22%5D)%0A
@@ -882,15 +882,8 @@
heck
--noplot
%22%5D)%0A
|
d373facb5c282092776f4bcef09ec925d3a651e3 | Use index_select instead of slicing for active_dims to handle batch mode. | gpytorch/kernels/kernel.py | gpytorch/kernels/kernel.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
from ..module import Module
from ..lazy import LazyEvaluatedKernelVariable, ZeroLazyVariable
import gpytorch
class Kernel(Module):
def __init__(
... | Python | 0 | @@ -458,32 +458,175 @@
elf).__init__()%0A
+ if active_dims is not None and not torch.is_tensor(active_dims):%0A active_dims = torch.tensor(active_dims, dtype=torch.long)%0A
self.act
@@ -1394,18 +1394,32 @@
x1 = x1_
-%5B:
+.index_select(-1
, self.a
@@ -1420,33 +1420,33 @@
self.active_dims
... |
7619cb1eb67c733fcb95a3e03ac01589b5da2584 | Fix py3k issue in grab.spider.save_result | grab/spider/save_result.py | grab/spider/save_result.py | from datetime import datetime
from traceback import format_exc
import os
import time
def save_result(func):
def decorated(spider_name, *args, **kwargs):
if not kwargs.get('save_result', False):
return func(spider_name, *args, **kwargs)
else:
from grab.djangoui.grabstat.model... | Python | 0.000002 | @@ -1346,17 +1346,19 @@
xception
-,
+ as
ex:%0A
|
04c18618266d1e29addbece0cbd736f0a7f24eed | Add some more paths alternatives to the search path for the swiftc binary | packages/Python/lldbsuite/test/plugins/swift.py | packages/Python/lldbsuite/test/plugins/swift.py | #!/usr/bin/env python
# swift.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift... | Python | 0 | @@ -1633,35 +1633,359 @@
%22llvm-build/
-DebugAssert
+Release+Asserts/swift-macosx-x86_64/bin/swiftc%22))%0A candidates.append(%0A os.path.join(%0A lldb_root_path,%0A %22llvm-build/DebugAssert/swift-macosx-x86_64/bin/swiftc%22))%0A candidates.append(%0A ... |
ee7f9316246246a02e1cf91ac1f41b431a592a38 | Solve for ini3 | ini3/ini3.py | ini3/ini3.py | #!/usr/bin/python
| Python | 0.999999 | @@ -11,8 +11,454 @@
/python%0A
+%0Aimport argparse%0A%0Aparser = argparse.ArgumentParser(description=%22Slices a given string between given indices%22)%0Aparser.add_argument(%22input_string%22, type=str, nargs=1, help=%22String to slice%22)%0Aparser.add_argument(%22slice_ranges%22, type=int, nargs=4, help=%22Indices t... |
e9a7081a6ced7c9df1650c2648623c0acbadbed0 | fix typo | ltrdssm.py | ltrdssm.py | import random
import numpy as np
import sys
import tensorflow as tf
class LTRDSSM(object):
"""MTNet model
"""
def __init__(self, vocab_size, emb_dim=256, repr_dim=256,
seq_len=50, combiner='sum', lr=1e-3, eps=1.0,
init_emb=None):
"""Construct MTNet.
"""
... | Python | 0.999991 | @@ -93,21 +93,24 @@
%0A %22%22%22
-MTNet
+LTR-DSSM
model%0A
@@ -299,13 +299,15 @@
uct
-MTNet
+network
.%0A
|
4198429c7049b156561a6cb5fe0e7dbc27fb8648 | add tests for some properties with predefined interger types | tests/test_nvlist.py | tests/test_nvlist.py | import json
from libzfs_core.nvlist import *
from libzfs_core.nvlist import _lib
props_in = {
"key1": "str",
"key2": 10,
"key3": {
"skey1": True,
"skey2": None,
"skey3": [
True,
False,
True
]
},
"key4": [
"ab",
"bc"
],
"key5": [
2 ** 64 - 1,
1,
2,
3
],
"key6": [
uint32_t(10),
... | Python | 0 | @@ -478,16 +478,67 @@
%0A%09%09%7D%0A%0A%09%5D
+,%0A%09%22type%22: 2 ** 32 - 1,%0A%09%22pool_context%22: -(2 ** 31)
%0A%7D%0A%0Aprop
|
04664a035c2d67236ae9befe83110190d17b194c | Add a couple of TODOs | updates.py | updates.py | #!/usr/bin/python3
# requires system Python and the python3-apt package
from collections import OrderedDict # Starting with Python 3.7, we could just use vanilla dicts
import apt # ImportError? apt install python3-apt
def describe(pkg):
# Python 3.7 equivalent:
# return {"Name": pkg.name, "Installed": pkg.installed.... | Python | 0 | @@ -1644,16 +1644,281 @@
se %22 %22)%0A
+%09%09if key == %22I%22 or key == %22i%22:%0A%09%09%09# TODO: Show a new window with package info%0A%09%09%09# Show the from and to versions, optionally the changelog,%0A%09%09%09# and ideally, the list of other packages that would be%0A%09%09%09# upgraded along with this one (... |
a9fadcaabf9ec6777ab5267c7ecd5091197a136f | Add API to give direct links to Finna photos | schools/api.py | schools/api.py | from rest_framework import routers, serializers, viewsets
from .models import *
class SchoolNameSerializer(serializers.ModelSerializer):
official_name = serializers.CharField(allow_null=True, source='get_official_name')
other_names = serializers.ListField(
source='get_other_names',
child=seria... | Python | 0 | @@ -2009,32 +2009,707 @@
lude = ('id',)%0A%0A
+class SchoolBuildingPhotoSerializer(serializers.ModelSerializer):%0A%0A def to_representation(self, instance):%0A # we have to reformat the URL representation so that our API serves the corresponding photo URL%0A # this method will have to be updated when... |
e825483d49bda41f13420311cbc9ffd59f7cee3d | Add MetadataRequest_v2 and MetadataResponse_v2 structures for KIP-78 (#974) | kafka/protocol/metadata.py | kafka/protocol/metadata.py | from __future__ import absolute_import
from .struct import Struct
from .types import Array, Boolean, Int16, Int32, Schema, String
class MetadataResponse_v0(Struct):
API_KEY = 3
API_VERSION = 0
SCHEMA = Schema(
('brokers', Array(
('node_id', Int32),
('host', String('utf-8')... | Python | 0 | @@ -1353,32 +1353,782 @@
2))))))%0A )%0A%0A%0A
+class MetadataResponse_v2(Struct):%0A API_KEY = 3%0A API_VERSION = 2%0A SCHEMA = Schema(%0A ('brokers', Array(%0A ('node_id', Int32),%0A ('host', String('utf-8')),%0A ('port', Int32),%0A ('rack', String('utf-... |
1e7f9d13d0e118d0d75225f69628680c8af3a8ae | fix name | tests/test_pyside.py | tests/test_pyside.py | from ref import backend_ref
from size import backend_size
def test_size_pyqt():
backend_size('pyside')
def test_ref_pyqt():
backend_ref('pyside')
| Python | 0.999913 | @@ -69,18 +69,20 @@
_size_py
-qt
+side
():%0A
@@ -125,10 +125,12 @@
f_py
-qt
+side
():%0A
|
7e24a1be37871d58d5d39fcb6736716f99821dda | Improve help text | base/client/constants.py | base/client/constants.py | '''
@ Harris Christiansen (Harris@HarrisChristiansen.com)
Generals.io Automated Client - https://github.com/harrischristiansen/generals-bot
Constants: Constants used throughout the code
'''
SHOULD_DIRTY_MAP_ON_MOVE = True
ENDPOINT_BOT = "ws://botws.generals.io/socket.io/?EIO=3&transport=websocket"
ENDPOINT_PUBLIC ... | Python | 0.999302 | @@ -1705,33 +1705,32 @@
ELLO_TEXT = %5B%0A%09%22
-%7C
Hi, I am Myssix
@@ -1758,18 +1758,37 @@
,%0A%09%22
-%7C
Say
+'go' to start, or '
help
+'
for
@@ -1799,24 +1799,25 @@
ist of a
-vailable
+dditional
command
@@ -1818,25 +1818,24 @@
ommands%22,%0A%09%22
-%7C
Code availa
|
db9c6cf681c60e1c08c5aff0ea5e615c32742720 | Set node category to keep 500's happening when users try to render a collection as a node (which is frowned upon but not otherwise prevented) | api/collections/serializers.py | api/collections/serializers.py | from rest_framework import serializers as ser
from rest_framework import exceptions
from modularodm.exceptions import ValidationValueError
from framework.exceptions import PermissionsError
from website.models import Node
from api.base.serializers import LinksField, JSONAPIHyperlinkedIdentityField, DevOnly
from api.bas... | Python | 0 | @@ -1829,16 +1829,43 @@
= True%0A
+ node.category = ''%0A
|
1f9fa8db0811a8853e072492b14fef4c107411b7 | Fix server sys.path to find the pyqode package | test/server.py | test/server.py | """
Server used for tests
"""
from pyqode.core import code_completion
from pyqode.core import server
from pyqode.core import workers
if __name__ == '__main__':
workers.CodeCompletion.providers.append(
code_completion.DocumentWordsProvider())
server.run()
| Python | 0.000001 | @@ -23,16 +23,116 @@
sts%0A%22%22%22%0A
+import sys%0Aimport os%0A# ensure sys knows about pyqode.core%0Asys.path.insert(0, os.path.abspath('..'))%0A
from pyq
|
a38cdcf08751fc1efe9ab14350c5007911c50f77 | Fix filename in ifmain | yay0/yay0.py | yay0/yay0.py | # This module is for handling yay0 compressed data, usually images.
# Based on:
# https://github.com/pho/WindViewer/wiki/Yaz0-and-Yay0
# http://hitmen.c02.at/files/yagcd/yagcd/chap16.html#sec16.1
# (Yaz0 doc) http://wiki.tockdom.com/wiki/YAZ0_(File_Format)
import struct
# Yay0 decoder
# A basic yay0 decompressor
de... | Python | 0.99882 | @@ -2833,16 +2833,17 @@
6x32.ci8
+y
%22%0A%09outfi
|
4b754736907bd9834429717a96c44decf063c32f | change 'list(value_conversions.keys())' to 'value_conversions') | keras/legacy/interfaces.py | keras/legacy/interfaces.py | """Interface converters for Keras 1 support in Keras 2.
"""
import six
import warnings
def generate_legacy_interface(allowed_positional_args=None,
conversions=None,
value_conversions=None):
allowed_positional_args = allowed_positional_args or []
conv... | Python | 0.000217 | @@ -1129,13 +1129,8 @@
in
-list(
valu
@@ -1146,16 +1146,8 @@
ions
-.keys())
:%0A
|
427cde2aca8e94a7c5aecef2f68ca3878e517ce8 | Add an exact match test case | tests/test_replay.py | tests/test_replay.py | import pytest
import testUtil as ipwbTest
from ipwb import replay
from time import sleep
import requests
import urllib2
# Successful retrieval
# Accurate retrieval
# Comprehensive retrieval of sub-resources
@pytest.mark.parametrize("warc,lookup,status,location", [
('salam-home.warc', 'memento/*/cs.odu.edu/~sa... | Python | 0.001267 | @@ -2259,16 +2259,129 @@
= dest%0A%0A
+ resp = requests.get(url.format('20160305192247'), allow_redirects=False)%0A assert resp.status_code == 200%0A%0A
ipwb
|
0f72371fae4f614932adc45a3461c1bcff5f569a | Test for File.write_line() | tests/test_result.py | tests/test_result.py | import unittest
from performance_testing.result import Result, File
import os
import shutil
class ResultTestCase(unittest.TestCase):
def setUp(self):
self.current_directory = os.path.dirname(os.path.abspath(__file__))
self.result_directory = os.path.join(self.current_directory, 'assets/test_result... | Python | 0 | @@ -315,16 +315,143 @@
result')
+%0A self.test_file_name = 'foo_bar'%0A self.test_file_path = os.path.join(self.result_directory, self.test_file_name)
%0A%0A de
@@ -870,38 +870,8 @@
r()%0A
- file_name = 'foo_bar'%0A
@@ -988,16 +988,26 @@
y, name=
+self.test_
file_nam
@@ -1115,72 +1115... |
4fcf26275eb5dbe630aafac88c699271d1fcbe9d | Fix typo | bashplotlib/histogram.py | bashplotlib/histogram.py | #!/usr/bin/python
import math
import optparse
import sys
from utils.helpers import *
from utils.commandhelp import hist
def calc_bins(n, min_val, max_val, h=None):
"calculate number of bins for the histogram"
if not h:
h = max(10, math.log(n + 1, 2))
bin_width = (max_val - min_val) / h
for b i... | Python | 0.000001 | @@ -2640,17 +2640,16 @@
(len(bin
-g
s)):%0A
|
e8aa977963a06c6dd97ca140b453ffc54d4096a1 | modify x-label printouts | bashplotlib/histogram.py | bashplotlib/histogram.py | #!/usr/bin/python
import math
import optparse
import sys
from utils.helpers import *
from utils.commandhelp import hist
def calc_bins(n, min_val, max_val, h=None, binwidth=None):
"calculate number of bins for the histogram"
if not h:
h = max(10, math.log(n + 1, 2))
if binwidth == 0:
binwidt... | Python | 0.000018 | @@ -458,24 +458,94 @@
stop=True):%0A
+ if b.is_integer():%0A yield int(b)%0A else:%0A
yiel
|
ee06edd57dfef223b80d7b01feff4da723660de0 | Disable temporary tests on dates | tests/test_search.py | tests/test_search.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from haystack.constants import DEFAULT_ALIAS
from haystack.query import SearchQuerySet
from djangocms_blog.models import Post
from .base import BaseTest
class BlogIndexingTests(BaseTest):
def setUp(self):
... | Python | 0.000001 | @@ -1061,32 +1061,33 @@
'url'%5D)%0A
+#
self.assertEqual
@@ -1873,32 +1873,33 @@
'url'%5D)%0A
+#
self.assertEqual
|
793ab0ee9cd1c8b4fbec071758c27275d76f55b5 | Removed an extraneous 'pass' | threeML/data_list.py | threeML/data_list.py | # Author: G.Vianello (giacomov@stanford.edu)
import collections
class DataList(object):
"""
A container for data sets. Can be accessed as a dictionary,
with the [key] operator.
"""
def __init__(self, *data_sets):
"""
Container for data sets (i.e., plugin instances)
:para... | Python | 0.998876 | @@ -1226,10 +1226,4 @@
()%0A%0A
-%0Apass%0A
|
bcecf5626768c8399e9293fe12a25511eeb6c52d | Bump version to 3.1-beta | version.py | version.py | short_name = "godot"
name = "Godot Engine"
major = 3
minor = 1
status = "alpha"
module_config = ""
| Python | 0 | @@ -70,12 +70,11 @@
= %22
-alph
+bet
a%22%0Am
|
c623641264c3efeab1464dedc978b90817c41629 | add print | vk_data.py | vk_data.py | import json
import time
from datetime import datetime
from itertools import groupby
import requests
import config
def get_group_info(url, extra_params=None):
params = {
'count': 1000,
'user_id': config.USER_ID,
'v': config.V_API,
'access_token': config.ACCESS_TOKEN,
'extended': 1,
'filter': 'admin',
}
if ex... | Python | 0.000085 | @@ -527,16 +527,33 @@
_data):%0A
+%09print(raw_data)%0A
%09new_raw
|
ca9f91aaf5fd15ab58875363858fd5f73305a410 | comment complex_test_header and pointcloud | laserchicken/test_utils.py | laserchicken/test_utils.py | from laserchicken.keys import *
import numpy as np
import datetime as dt
def generate_simple_test_point_cloud():
# This simple_test_point cloud and the simple_test_header should be in sync. Some tests depend on it.
pc = {point: {'x': {'type': 'float', 'data': np.array([1, 2, 3])},
'y': {'typ... | Python | 0 | @@ -489,24 +489,132 @@
nt_cloud():%0A
+ # This complex_test_point cloud and the complex_test_header should be in sync. Some tests depend on it.%0A
dto= dt.
@@ -1428,24 +1428,132 @@
t_header():%0A
+ # This complex_test_header cloud and the complex_test_point should be in sync. Some tests depend on it.%0A
... |
7ba6c2ad942cebb951120195ec40b50f7feb3939 | Cache the results of is_ev2_instance | klue_microservice/utils.py | klue_microservice/utils.py | import os
import sys
import logging
import datetime
from dateutil import parser
import socket
import logging
import pytz
log = logging.getLogger(__name__)
def is_ec2_instance():
"""Try fetching instance metadata at 'curl http://169.254.169.254/latest/meta-data/'
to see if host is on an ec2 instance"""
... | Python | 0.999999 | @@ -148,24 +148,46 @@
__name__)%0A%0A%0A
+IS_EC2_INSTANCE = -1%0A%0A
def is_ec2_i
@@ -475,16 +475,200 @@
-08-25%0A%0A
+ global IS_EC2_INSTANCE%0A%0A if IS_EC2_INSTANCE != -1:%0A # Returned the cached value%0A log.debug(%22IS_EC2_INSTANCE=%25s%22 %25 IS_EC2_INSTANCE)%0A return IS_EC2_INSTAN... |
cff197eeb5c907b6488a989c08c1bf1a3046ad45 | Fix name typo in location loop | weather.py | weather.py | #!/usr/local/bin/python3
import requests
from datetime import date, timedelta
from multiprocessing.dummy import Pool
with open('metoffice_api_key') as keyfile:
api_key = keyfile.read()
weather_types = {'NA': 'Not available',
0: 'Clear night',
1: 'Sunny day',
2: ... | Python | 0.000015 | @@ -5418,21 +5418,16 @@
loc
-ation
%5Btomorro
|
3826a0081a651d312b4c9201e8f1a25e43c7c781 | Fix wind directions (north winds blow south) | weather.py | weather.py | # -*- coding: utf-8 -*-
import json, urllib2
#Update schema
__url__ = "https://raw.githubusercontent.com/KittyHawkIrc/modules/production/" + __name__ + ".py"
__version__ = 2.0
units = ['ca', 'uk2', 'us', 'si']
def declare():
return {"w": "privmsg", "setlocation": "privmsg", "setunit": "privmsg"}
def callback(s... | Python | 0.999998 | @@ -4800,44 +4800,44 @@
%5Bu'
-%E2%86%91
+%E2%86%93
',u'
-%E2%86%97
+%E2%86%99
',u'
-%E2%86%92
+%E2%86%90
',u'
-%E2%86%98
+%E2%86%96
',u'
-%E2%86%93
+%E2%86%91
',u'
-%E2%86%99
+%E2%86%97
',u'
-%E2%86%90
+%E2%86%92
',u'
-%E2%86%96
+%E2%86%98
'%5D%0A%0A
@@ -5079,11 +5079,11 @@
eturn u'
-%E2%86%91
+%E2%86%93
'... |
1b4fc9471297dbc704cf0efaac54fce5891014d7 | make the proxy command (relay/server) required | bin/ssh-forward-proxy.py | bin/ssh-forward-proxy.py | import logging
import argparse
logging.basicConfig(level=logging.INFO)
import ssh_forward_proxy as ssh
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Forward all SSH requests to remote but authenticating as the proxy')
parser.add_argument('-i', dest='identity_file', help='Path to id... | Python | 0.000001 | @@ -398,16 +398,47 @@
ommand')
+%0A subparsers.required = True
%0A%0A su
|
c354f387023a6d7b7aebbd2b61fb7336fe72f346 | Bump to next v.0.13.0a0 (#217) | aiodocker/__init__.py | aiodocker/__init__.py | from .docker import Docker
__version__ = '0.12.0'
__all__ = ("Docker", )
| Python | 0 | @@ -44,10 +44,12 @@
'0.1
-2.
+3.0a
0'%0A%0A
|
98a37cf7801d32fe2b8f7514d3c96b29a22ef6ce | Deduplicate code | albertyw.com/tests.py | albertyw.com/tests.py | from __future__ import absolute_import
import unittest
import serve
class PageCase(unittest.TestCase):
def setUp(self):
serve.app.config['TESTING'] = True
self.app = serve.app.test_client()
def test_index_load(self):
response = self.app.get('/')
self.assertEqual(response.sta... | Python | 0.998175 | @@ -251,727 +251,398 @@
-response = self.app.get('/')%0A self.assertEqual(response.status_code, 200)%0A self.assertIn(b'Albert Wang', response.get_data())%0A%0A def test_resume_load(self):%0A response = self.app.get('/resume')%0A self.assertEqual(response.status_code, 200)%0A ... |
ffd587d6b6ccfa494971d38f6fd36a248d9c9819 | print group sizes, plus refactoring | tools/correlation.py | tools/correlation.py | #!/usr/bin/env python2
"""Calculate correlation for parametric maps vs. Gleason scores."""
import argparse
import math
import numpy as np
import scipy.stats
import dwi.patient
import dwi.util
def parse_args():
"""Parse command-line arguments."""
p = argparse.ArgumentParser(description=__doc__)
p.add_arg... | Python | 0 | @@ -1521,16 +1521,484 @@
upper)%0A%0A
+def grouping(data):%0A %22%22%22Return different scores, grouped scores, and their sample sizes.%22%22%22%0A scores = %5Bd%5B'score'%5D for d in data%5D%0A labels = %5Bd%5B'label'%5D for d in data%5D%0A n_labels = max(labels) + 1%0A groups = %5B%5B%5D for _ in rang... |
b0bde22e3ff0d2df2773f41aeaf8eb0ba6d0fa3f | Allow a default value to be specified when fetching a field value | tools/getapifield.py | tools/getapifield.py | # Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Python | 0.000001 | @@ -870,16 +870,105 @@
utput')%0A
+parser.add_argument('--default', help='Default value to output if field is not present')%0A
args = p
@@ -1244,16 +1244,74 @@
ions)%22)%0A
+elif not query%5B0%5D and args.default:%0A print(args.default)%0A
elif not
|
6d7f7ebb913bf99d36c551ef3105c98c7150c68b | Update version_info.py - 20 | ich_bau/templatetags/version_info.py | ich_bau/templatetags/version_info.py | from django import template
register = template.Library()
@register.simple_tag(name='site_version_info')
def site_version_info():
return 'v0.0019 at 05.02.2020'
| Python | 0 | @@ -147,19 +147,19 @@
0.00
-19
+20
at
+2
0
-5
.0
-2
+3
.202
|
f51915a6c373de39785d8273b2a9f6e11ff67b9e | Test for no pairs from one particle | test_dimuon.py | test_dimuon.py | from dimuon import find_pairs
def test_find_pairs():
particles = None
pairs = find_pairs(particles)
def test_no_particles():
particles = []
pairs = find_pairs(particles)
assert len(pairs) == 0
| Python | 0.000002 | @@ -208,12 +208,118 @@
s) == 0%0A
-
+%0Adef test_one_particle():%0A particles = %5BNone%5D%0A pairs = find_pairs(particles)%0A assert len(pairs) == 0%0A
|
00219d7b8c90c35fa4b2a2743f132b1e83056dbd | Test for while. | test_record.py | test_record.py | import unittest
import mock
from record import record, RECORD_FN_NAME, find_indent_level, strip_indent
class TestRecord(unittest.TestCase):
# Patch path refers to current module because the decorator injects the
# record fn in here.
record_state_fn_path = 'test_record.%s' % RECORD_FN_NAME
def test_... | Python | 0 | @@ -1312,32 +1312,350 @@
call_count, 4)%0A%0A
+ def test_while(self):%0A %22%22%22Fn with a while.%22%22%22%0A%0A @record%0A def foo():%0A x = 3%0A y = 6%0A%0A while x %3C y:%0A x += 1%0A%0A with mock.patch(self.record_state_fn_path) as rec... |
1543f55e517e464e54faa28557d0281b4731da8f | fix tests | kuyruk/test/test_kuyruk.py | kuyruk/test/test_kuyruk.py | import signal
import logging
import unittest
import threading
from time import sleep
from Queue import deque
from kuyruk import Kuyruk, Task, Reject, Queue
from kuyruk.connection import LazyConnection
from kuyruk.task import TaskResult
from util import run_kuyruk, kill_kuyruk, clear, delete_queue, get_pids
logger = l... | Python | 0.000001 | @@ -2589,13 +2589,15 @@
s=(1
+.5
, ))%0A
-
@@ -2639,32 +2639,34 @@
kuyruk(seconds=2
+.5
)%0A self.a
@@ -2659,33 +2659,24 @@
-self.assertEqual(
+count =
result.s
@@ -2705,20 +2705,42 @@
queue')
-,
+%0A assert count ==
2
-)
%0A%0A de
@@ -3134,16 +3134,18 @@
sleep(1
+.5
)%0A ... |
a84e6e2a31408bcefbb6ecb5ba354e70bb870f56 | use slightly smaller textarea | minicms/admin.py | minicms/admin.py | from .models import Block, Page
from django.contrib import admin
from django.contrib.admin.widgets import AdminTextareaWidget
from django.db import models
# The default TextField doesn't have enough rows
class UsableTextarea(AdminTextareaWidget):
def __init__(self, attrs=None):
default_attrs = {'rows': '40... | Python | 0.000006 | @@ -315,10 +315,10 @@
': '
-40
+32
'%7D%0A
|
3700fce859dc83e93a0d369de69a8a4e0d5ab0fa | Allow flexible relayer url (#9939) | homeassistant/components/cloud/iot.py | homeassistant/components/cloud/iot.py | """Module to handle messages from Home Assistant cloud."""
import asyncio
import logging
from aiohttp import hdrs, client_exceptions, WSMsgType
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.components.alexa import smart_home
from homeassistant.util.decorator import Registry
from homeassi... | Python | 0 | @@ -1902,71 +1902,27 @@
-'ws://%7B%7D/websocket'.format(self.cloud.relayer),%0A
+self.cloud.relayer,
hea
|
d0bf29a68f7b3e2aafbcfa075ef3ba392cd5ddc2 | Remove recursive send | mobile/models.py | mobile/models.py | # encoding: utf-8
from django.db import models
from backends import backend
from settings import DEFAULT_INTERNATIONAL_PREFIX, SHORT_CODE
class OutgoingSMS(models.Model):
recipient = models.CharField('mottaker', max_length=255)
sender = models.CharField('avsender', max_length=255, default=SHORT_CODE)
mes... | Python | 0.000001 | @@ -1541,32 +1541,114 @@
-if created:%0A
+# Do not call send here, it will become a loop.%0A if created:%0A self.clean()%0A #
self
|
6385b19090df0f36cbd16c96ee6ab763441ae460 | add test for passing parameters | mockstar_test.py | mockstar_test.py | # -*- coding: utf-8 -*-
import unittest
from unittest import TestCase
from mock import Mock
from mockstar import p
from mockstar import DotDict
def side_effect_one():
pass
def side_effect_two():
pass
def side_effect_three():
val = side_effect_four()
return val * 2
def side_effect_four():
r... | Python | 0 | @@ -85,16 +85,39 @@
ort Mock
+%0Afrom mock import patch
%0A%0Afrom m
@@ -346,16 +346,56 @@
urn 4%0A%0A%0A
+def side_effect_five(n):%0A return n%0A%0A%0A
class Te
@@ -1077,16 +1077,273 @@
lt, 2)%0A%0A
+ @p(__name__ + '.side_effect_five', autospec=True)%0A @patch('mockstar.patch')%0A def test_should_pass... |
5185fa75d3afaeb15b88edc62755bee8e6ddfdb3 | Fix service registration typo in Nuki integration (#52631) | homeassistant/components/nuki/lock.py | homeassistant/components/nuki/lock.py | """Nuki.io lock platform."""
from abc import ABC, abstractmethod
import logging
from pynuki import MODE_OPENER_CONTINUOUS
import voluptuous as vol
from homeassistant.components.lock import PLATFORM_SCHEMA, SUPPORT_OPEN, LockEntity
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_TOKEN
from homeassistant.hel... | Python | 0 | @@ -1767,32 +1767,83 @@
%22lock_n_go%22,%0A
+ )%0A%0A platform.async_register_entity_service(%0A
%22set_con
|
8dc2d9a826b91951815cbfe83dc5bfa05b22b434 | Remove extra space | troposphere/s3.py | troposphere/s3.py | # Copyright (c) 2013, Bob Van Zant <bob@veznat.com>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
from .validators import positive_integer, s3_bucket_name
try:
from awacs.aws import Policy
policytypes = (dict, Policy)
except ImportError:
policytype... | Python | 0.000663 | @@ -2484,17 +2484,16 @@
InDays':
-
(positi
|
e7544073a4496d4ba9514f85e8957c54d32cc201 | Fix Typo | models/google.py | models/google.py | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import logging
import re
import requests
import urllib.parse
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def google(bot, update):
search = update.message.text
s... | Python | 0.000009 | @@ -1993,17 +1993,16 @@
%E6%80%9D%E4%B9%9F%E8%A8%B1%E6%98%AF%5Cn'+
-+
result.t
|
a800edd62b53b7546f98e56dcc9775933799befd | bump to 0.3.5. | tsuru/__init__.py | tsuru/__init__.py | # Copyright 2013 tsuru-circus authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
__version__ = "0.3.4"
| Python | 0.000001 | @@ -179,7 +179,7 @@
0.3.
-4
+5
%22%0A
|
25aba1a9cd0aa57b35c6bc9e5083a601585a214e | bump to 0.4.2. | tsuru/__init__.py | tsuru/__init__.py | # Copyright 2013 tsuru-circus authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
__version__ = "0.4.1"
| Python | 0 | @@ -175,11 +175,11 @@
= %220.4.
-1
+2
%22%0A
|
7d02dee02002c0cccb4c7c9e2a205f6c9af1deae | Validate markets | turtle-trading.py | turtle-trading.py | # https://www.quantopian.com/help#ide-module-import
from talib import ATR
def initialize(context):
"""
Set up algorithm.
"""
set_markets(context)
context.is_price_stale = True
def before_trading_start(context, data):
"""
Process data before market open.
"""
context.is_price_stale =... | Python | 0.000007 | @@ -152,24 +152,64 @@
ts(context)%0A
+ %0A context.is_market_stale = True%0A
context.
@@ -317,32 +317,67 @@
t open.%0A %22%22%22%0A
+ context.is_market_stale = True%0A
context.is_p
@@ -470,24 +470,148 @@
te.%0A %22%22%22%0A
+ if context.is_market_stale:%0A validate_markets(context)... |
240ebf998ebd633d6c5d8f90f46892071522759e | Fix #1. Supporting python3 | twd97/__init__.py | twd97/__init__.py | from converter import fromwgs84, towgs84
| Python | 0.000052 | @@ -1,13 +1,19 @@
from
+twd97.
converte
|
c20d1a8074d9a308f282a1be0e328ecc437f2bab | Remove all keep-alive delimiters to allow the hangup patch to function. | twitter/stream.py | twitter/stream.py | try:
import urllib.request as urllib_request
import urllib.error as urllib_error
import io
except ImportError:
import urllib2 as urllib_request
import urllib2 as urllib_error
import json
from ssl import SSLError
import socket
import sys, select, time
from .api import TwitterCall, wrap_response, Twi... | Python | 0 | @@ -2248,32 +2248,122 @@
try:%0A
+ buf = buf.lstrip() # Remove any keep-alive delimiters to detect hangups.%0A
|
82bd501f89d3a228c3de9a2f355266b374c35a54 | Add current project path to the first position of sys.modules | twork/assembly.py | twork/assembly.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Zhang ZY<http://idupx.blogspot.com/>
#
# 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/L... | Python | 0.000001 | @@ -864,15 +864,18 @@
ath.
-append(
+insert(0,
PROJ
|
00f341f7c24bba2d4f859a54510b563e360b5cb3 | remove unused imports | twosheds/shell.py | twosheds/shell.py | """
twosheds.shell
~~~~~~~~~~~~~~
This module implements the central user interface for access to an
operating system's kernel services.
"""
import atexit
import code
import os
import readline
from subprocess import call, check_output
import sys
import traceback
class Shell(object):
"""The shel... | Python | 0.000001 | @@ -164,94 +164,28 @@
ort
-atexit%0Aimport code%0Aimport os%0Aimport readline%0Afrom subprocess import call, check_output
+os%0Aimport subprocess
%0Aimp
@@ -1992,16 +1992,27 @@
+subprocess.
call(lin
|
1b05a5359781bf972243697dcf7187de3eb5503c | Fix test cases | twphotos/tests.py | twphotos/tests.py | import os
import shutil
from unittest import TestCase
from .settings import PROJECT_PATH
from .photos import TwitterPhotos
TEST_OUTPUT = 'test-output'
TEST_USER = 'WIRED'
class TestPhotos(TestCase):
"""Test TwitterPhotos class programmatically"""
def setUp(self):
d = os.path.join(PROJECT_PATH, TEST_... | Python | 0.000241 | @@ -3,16 +3,57 @@
port os%0A
+os.environ%5B'TWPHOTOS_TEST_CONFIG'%5D = '0'%0A
import s
@@ -736,36 +736,32 @@
ount=20)%0A
- p =
twphotos.downlo
|
31d54dde10bddeb0eefa6c7979020124016da149 | Update configs.py | hypernerf/configs.py | hypernerf/configs.py | # Copyright 2021 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.000001 | @@ -684,22 +684,18 @@
t linen
-import
+as
nn%0Aimpo
|
8067a67998273996d086f715748b2d7f09790bb0 | Use direct jpg data instead of jpg file | image_recognition.py | image_recognition.py | import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge, CvBridgeError
import cv2
import numpy as np
import tensorflow as tf
from tensorflow.models.image.imagenet import classify_image
class RosTensorFlow():
def __init__(self):
classify_image.maybe_down... | Python | 0 | @@ -106,23 +106,8 @@
idge
-, CvBridgeError
%0Aimp
@@ -218,16 +218,17 @@
_image%0A%0A
+%0A
class Ro
@@ -318,16 +318,129 @@
tract()%0A
+ self._session = tf.Session()%0A classify_image.create_graph()%0A self._cv_bridge = CvBridge()%0A%0A
@@ -585,93 +585,173 @@
=1)%0A
-%0A def callba... |
7fc258bf92db13b3e7b1bbac33276d99ca9ebb8b | fix __getitem__ for words_per_item>1 | hwtLib/mem/sim/segmentedArrayProxy.py | hwtLib/mem/sim/segmentedArrayProxy.py | from typing import List
from hwt.code import Concat
from hwtLib.tools.debug_bus_monitor_ctl import select_bit_range
from hwtSimApi.basic_hdl_simulator.proxy import BasicRtlSimProxy
from pyMathBitPrecise.bit_utils import int_to_int_list
class SegmentedArrayProxy():
"""
A simulation proxy whic can read a and w... | Python | 0.000161 | @@ -1365,79 +1365,284 @@
-mem.val = mem.def_val = mem._dtype.from_py(%5B0 for _ in range(mem._dtype
+# may not neccessary have to be two different instances%0A # as the value is copied into simulator, (copy just to make sure)%0A t = mem._dtype%0A mem.val = t.from_py(%5B0 for _ in ... |
ebc9c4cf9fdc1ea79f1da4a8f608a2472eb48467 | remove multiple images at a time | modules/image.py | modules/image.py | import docker
import docker.errors
import sys
from pprint import pprint
from tabulate import tabulate
import json
from datetime import datetime
import pretty
import re
import yaml
def command() -> list:
return ['image', 'i']
def help_summary(name: str) -> str:
if name == 'i':
return 'Alias for "ima... | Python | 0.000004 | @@ -1845,32 +1845,43 @@
rgument('image',
+ nargs=%22+%22,
help=%22The name
@@ -4897,32 +4897,33 @@
args):%0A image
+s
= args.image%0A
@@ -4920,16 +4920,46 @@
s.image%0A
+%0A for image in images:%0A
if %22
@@ -4967,32 +4967,36 @@
%22 not in image:%0A
+
image =
@@ -5018,24 +5018,28... |
fb53986a1e20859e421f4c86c664fd862e3b882e | fix mongodb | mongodb_query.py | mongodb_query.py | db.schedule.find("bookings" : {"$elemMatch" : { "date" : new ISODate("2016-08-09T10:00:00.000Z")}})
>> { "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
"date": ISODate("2016-08-09T10:00:00.000Z")
}
]
}
db.schedule.insert(
{ "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
... | Python | 0.001889 | @@ -1158,612 +1158,5 @@
%0A)%0A%0A
-db.restaurants.insert(%0A %7B%0A %22address%22 : %7B%0A %22street%22 : %222 Avenue%22,%0A %22zipcode%22 : %2210075%22,%0A %22building%22 : %221480%22,%0A %22coord%22 : %5B -73.9557413, 40.7720266 %5D%0A %7D,%0A %22borough%22 : %22Manh... |
be80c525fbb1dfb9cc1ea6a713fc2b152dfd5440 | fix mongodb | mongodb_query.py | mongodb_query.py | db.schedule.find("bookings" : {"$elemMatch" : { "date" : new ISODate("2016-08-09T10:00:00.000Z")}})
>> { "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
"date": ISODate("2016-08-09T10:00:00.000Z")
}
]
}
db.schedule.insert(
{ "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
... | Python | 0.001889 | @@ -546,8 +546,615 @@
%7D %5D %7D%0A%0A
+db.restaurants.insert(%0A %7B%0A %22address%22 : %7B%0A %22street%22 : %222 Avenue%22,%0A %22zipcode%22 : %2210075%22,%0A %22building%22 : %221480%22,%0A %22coord%22 : %5B -73.9557413, 40.7720266 %5D%0A %7D,%0A %22borough%22 : %... |
651e26f46691ba0499db76ec26e69e52c2dd62d8 | fix complex number | mordred/_bcut.py | mordred/_bcut.py | import numpy as np
from . import _atomic_property
from ._base import Descriptor
class BCUTBase(Descriptor):
explicit_hydrogens = False
require_connected = True
class Burden(BCUTBase):
__slots__ = ()
def calculate(self, mol):
N = mol.GetNumAtoms()
mat = 0.001 * np.ones((N, N))
... | Python | 0.004221 | @@ -1308,16 +1308,75 @@
mat)%5B0%5D%0A
+%0A if np.iscomplexobj(ev):%0A ev = ev.real%0A%0A
|
f27d51beecd423335835b005d2938224102a7460 | remove unused import | integration-tests/test_s3_readline.py | integration-tests/test_s3_readline.py | import sys
from smart_open import open
def read_lines(url, limit):
lines = []
with open(url, 'r', errors='ignore') as fin:
for i, l in enumerate(fin):
if i == limit:
break
lines.append(l)
return lines
def test(benchmark):
#
# This file is around 8... | Python | 0.000001 | @@ -1,15 +1,4 @@
-import sys%0A
from
|
ed9815277332106aa7221b8cda30089a247d3ad7 | clean up print statements | morsesmale.py | morsesmale.py | import networkx as nx
import numpy as np
import scipy
import graph
import itertools
from collections import defaultdict
def calculate_persistence(crystal, other, minimum_value, G, function_vals):
minimums = []
min_vertices = []
for vertex in crystal:
neighbors = G.neighbors(vertex)
value = ... | Python | 0.896538 | @@ -968,32 +968,33 @@
find_filtration
+s
(G, function_val
@@ -1415,63 +1415,8 @@
ls:%0A
- print(crystal)%0A print(crystals)%0A
@@ -3949,24 +3949,20 @@
tions =
-generate
+find
_filtrat
@@ -3970,13 +3970,8 @@
ons(
-msc,
G, f
@@ -3978,24 +3978,29 @@
unction_vals
+, msc
)%0A %0A ... |
37e68fd76c620e899e9d6bffa3bb66613ea45080 | __count to __total | munchee/views.py | munchee/views.py | ## This is really the Controller part of MVC. Yes this is weird. Very weird.
from django.shortcuts import render
from django.utils import timezone
from django.http import HttpResponseRedirect, HttpResponse
from .forms import *
from .models import *
from linkedin.linkedin import (LinkedInAuthentication, LinkedInApplicat... | Python | 0.999999 | @@ -2484,13 +2484,13 @@
%5D%5B'_
-count
+total
'%5D =
@@ -2828,24 +2828,43 @@
HttpResponse
+RedirectttpResponse
(debug)%0A%0A%0A
|
c6462ce671eb9ab3217f7142e02624a3ed39fabd | Remove print statement in pair.py | msibi/pair.py | msibi/pair.py | import logging
import os
import mdtraj as md
import networkx as nx
from networkx import NetworkXNoPath
import numpy as np
from six import string_types
from msibi.utils.exceptions import UnsupportedEngine
from msibi.utils.error_calculation import calc_similarity
from msibi.potentials import tail_correction, head_corr... | Python | 0.00019 | @@ -3499,33 +3499,8 @@
= 0%0A
- print len(pairs)%0A
|
cd3ce3babc823d155f36a46e8ebcf54c674d6a4a | Update views.py | news/views.py | news/views.py | from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from django.shortcuts import render
from .models import News
import requests
from bs4 import BeautifulSoup
from newspaper import Article
from newspaper.article import ArticleException
#User_Agent = "Mozilla/5... | Python | 0 | @@ -914,16 +914,17 @@
+#
url = %22h
@@ -1011,16 +1011,192 @@
index)%0A
+ https://www.google.com/search?q=%25s&tbs=qdr:d,sbd:1&tbm=nws&source=lnt&sa=X&ved=0ahUKEwiejO2quaPXAhWFJMAKHfbnDCMQpwUIHQ&biw=1400&bih=800&dpr=1&start=%25s %25 (query, index)%0A
|
b56c98c75b1951e629ffd37ee2ea4c3c0810a418 | Fix broken unit tests | nova/utils.py | nova/utils.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | Python | 0.000008 | @@ -4077,126 +4077,452 @@
- return '%25s-%25s' %25 (topic, ''.join(%5Brandom.choice('01234567890abcdefghijklmnopqrstuvwxyz') for x in xrange(size)%5D
+if topic == %22i%22:%0A # Instances have integer internal ids.%0A #TODO(gundlach): We should make this more than 32 bits, but we need to%0A #f... |
c703c8836030167c4896ba157909f2b67a862076 | Fix unittest. | ipa/test/__init__.py | ipa/test/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from os import remove as rm
from tempfile import mkstemp
from zipfile import ZipFile, ZIP_DEFLATED
import random
import string
import unittest
from biplist import writePlistToString
import six
from ipa import BadIPAError, IPAFile
class TestIPAFile(unitt... | Python | 0.000001 | @@ -268,18 +268,22 @@
import
-Ba
+Invali
dIPAErro
@@ -2643,18 +2643,22 @@
-Ba
+Invali
dIPAErro
|
b906920675c4d4aaf31f03543b48f8fb4534e81c | Add unicode handling test and __str__() test | ipa/test/__init__.py | ipa/test/__init__.py | from os import remove as rm
from tempfile import mkstemp
from zipfile import ZipFile, ZIP_DEFLATED
import random
import string
import unittest
from biplist import writePlistToString
from ipa import BadIPAError, IPAFile
class TestIPAFile(unittest.TestCase):
_temp_files = []
def _random_string(self, length=10... | Python | 0.998634 | @@ -1,12 +1,52 @@
+from __future__ import unicode_literals%0A
from os impo
@@ -61,16 +61,16 @@
e as rm%0A
-
from tem
@@ -215,16 +215,27 @@
ToString
+%0Aimport six
%0A%0Afrom i
@@ -588,16 +588,31 @@
al=False
+, app_name=None
):%0A
@@ -762,16 +762,46 @@
ring(),)
+ if not app_name else app_name
%0A%0A
... |
3602f0f640510b2ded83b370afac85afe4c1eaed | add patient search functionality for episodes | opal/admin.py | opal/admin.py | """
Combined admin for OPAL models
"""
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
import reversion
from opal import models
from opal.models import Synonym
from opal.mode... | Python | 0 | @@ -1894,32 +1894,33 @@
hospital_number'
+,
%0A %5D%0A%0A%0Aclass E
@@ -1969,20 +1969,203 @@
n):%0A
-pass
+search_fields = %5B%0A 'episode__patient__demographics__first_name',%0A 'episode__patient__demographics__surname',%0A 'episode__patient__demographics__hospital_number',%0A %5D
%0... |
28f29fe2ba9266db0695fc2c078bdb8bb3b34cf4 | Version 2.0.1 | relayer/__init__.py | relayer/__init__.py | from kafka import KafkaProducer
from .event_emitter import EventEmitter
from .exceptions import ConfigurationError
from .logging import logger as log
__version__ = '2.0.0'
class Relayer(object):
"""
Arguments:
logging_topic: desired kafka topic to send logs, this will get modified if a prefix o suff... | Python | 0.000001 | @@ -164,17 +164,17 @@
= '2.0.
-0
+1
'%0A%0A%0Aclas
|
2e05b5161b299873e7b319963fa45ddae8118511 | Simplify gene_events | orgviz/cal.py | orgviz/cal.py | import time
import datetime
import orgparse.date
from .event import nodes_to_events
def summary_from_node(node):
heading = node.heading
tags = node.tags
if tags:
summary = "%s [%s]" % (heading, "|".join(tags))
return summary
else:
return heading
def totimestamp(dt):
"""... | Python | 0.998478 | @@ -2220,84 +2220,20 @@
if
-isinstance(event.date, orgparse.date.OrgDateClock) and %5C%0A not
+not getattr(
even
@@ -2242,17 +2242,19 @@
date
-.
+, '
duration
:%0A
@@ -2249,16 +2249,24 @@
duration
+', True)
:%0A
|
5c5290582aa5a259d7fbe2b3a189a915da0b4c76 | fix data_holder | jinja/data_holder.py | jinja/data_holder.py | from collections import namedtuple
class Holder(object):
def __init__(self):
self.list=[]
def add_to_list(self,element_name,element_value=0):
pass
def get_list(self):
return self.list
class IncludeHolder(Holder):
def __init__(self):
self.list=[]
def add_to_list(s... | Python | 0.000009 | @@ -2216,60 +2216,8 @@
t):%0A
- msgs_list=%5B%5D%0A enum_dict=%7B%7D%0A struct_list=%5B%5D
%0A%0A
@@ -2322,12 +2322,184 @@
er()
- ):
+, msgs_list =%0A %5B%5D, enum_dict = %7B%7D, struct_list = %5B%5D ): %0A self.msgs_list = msgs_list%0A self.enum_dict = enum_dict%0A self.... |
afa9ba7c07902cef662bd59540bed4698851ad8f | Version 0.18.3 | repokid/__init__.py | repokid/__init__.py | # Copyright 2020 Netflix, 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... | Python | 0 | @@ -944,17 +944,17 @@
= %220.18.
-2
+3
%22%0A%0A%0Adef
|
f832e2318ed4c086c4fd77ab4fb1b2b6dea6a3ed | Make sure to only return a FreeBSD object when it is a value we know. | oz/FreeBSD.py | oz/FreeBSD.py | # Copyright (C) 2013 harmw <harm@weites.com>
# Copyright (C) 2013-2017 Chris Lalancette <clalancette@gmail.com>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation;
# version 2.1 of the Lic... | Python | 0 | @@ -3721,24 +3721,28 @@
= 'virtio'%0A
+
return F
@@ -3789,32 +3789,36 @@
etdev, diskbus,%0A
+
|
6acdeab4e0b6811ba4d7b03e2a00860a5783e20f | add shortcode to admin | vas2nets/admin.py | vas2nets/admin.py | from django.contrib import admin
from .models import VoiceCall
class VoiceCallAdmin(admin.ModelAdmin):
list_display = ['id', 'created_at', 'msisdn', 'duration', 'reason']
admin.site.register(VoiceCall, VoiceCallAdmin)
| Python | 0.000001 | @@ -124,16 +124,29 @@
= %5B'id',
+ 'shortcode',
'create
@@ -173,16 +173,36 @@
ration',
+%0A
'reason
|
99a2a7535478e77154670cc3a11832d7a5ac7d78 | Update version | vault/__init__.py | vault/__init__.py | # -*- coding: utf-8 -*-
default_app_config = 'vault.apps.VaultConfig'
__version__ = '1.1.0'
| Python | 0 | @@ -88,7 +88,7 @@
1.1.
-0
+1
'%0A
|
5fdec0d98647d59d1cd38b6995dd17152ebbf675 | Use __file__ to determine REPO_PATH in vb_suite/suite.py | vb_suite/suite.py | vb_suite/suite.py | from vbench.api import Benchmark, GitRepo
from datetime import datetime
import os
modules = ['attrs_caching',
'binary_ops',
'ctors',
'frame_ctor',
'frame_methods',
'groupby',
'index_object',
'indexing',
'io_bench',
'joi... | Python | 0.000026 | @@ -1345,32 +1345,61 @@
ath.
-join(HOME, 'code/pandas'
+abspath(os.path.join(os.path.dirname(__file__),%22../%22)
)%0A
@@ -1477,27 +1477,20 @@
oin(
-HOME, 'code/pandas/
+REPO_PATH, '
vb_s
|
352b3b47c67ea61068f007b00c7268a77e2aae93 | write to SQL rather than pkl | learning/pytorch/data/augmentation.py | learning/pytorch/data/augmentation.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import os
sys.path.append(os.path.join(os.environ['ITHEMAL_HOME'], 'learning', 'pytorch'))
# this script doesn't need matplotlib; this line fixes interactive use of this script.
import matplotlib
matplotlib.use('Agg')
import argparse
import comm... | Python | 0.000029 | @@ -4981,26 +4981,26 @@
, 'table_%7B%7D.
-pk
+sq
l'.format(ti
|
9ccae8267d1884e25bf5268fe59b16e99475397f | Change hidden function | learning_objective/hidden_function.py | learning_objective/hidden_function.py | """
@Author: Rui Shu
@Date: 4/11/15
Provides a proxy hidden function for running of optimizer and mpi_optimizer
"""
import numpy as np
import time
noiseless_g = lambda x: 10*np.sin(x) - x
g = lambda x: noiseless_g(x) + np.random.randn()/10 # Define the hidden function
def evaluate(query, lim_domain):
... | Python | 0.000001 | @@ -867,24 +867,24 @@
t_2d(g(X
-)
%5B0, 0%5D)
+)
# Compu
@@ -1307,21 +1307,16 @@
%22%22%22%0A
- %0A
var
@@ -1622,16 +1622,16 @@
_g(X
-)
%5B0, 0%5D)
+)
# C
|
ed09a238f8ff2925305e82ff310127fc3ba632e0 | make cache update nullable | leonardo/module/web/widgets/mixins.py | leonardo/module/web/widgets/mixins.py |
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .const import PAGINATION_CHOICES
class ListWidgetMixin(models.Model):
"""Common fields for object lists
"""
objects_per_page = models.PositiveIntegerField(
verbos... | Python | 0 | @@ -1227,16 +1227,39 @@
le=False
+, null=True, blank=True
)%0A%0A c
|
21e2c814a115d3fc319a5e1314836f9278b05896 | Fix unit tests to test the webapi tests by default. | reviewboard/test.py | reviewboard/test.py | #
# test.py -- Nose based tester
#
# Copyright (c) 2007 David Trowbridge
#
# 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 u... | Python | 0 | @@ -4557,24 +4557,64 @@
sion=.txt',%0A
+ '--where=reviewboard',%0A
@@ -4770,53 +4770,8 @@
ard'
-,%0A '--where=reviewboard'
%5D%0A
|
4a013152616ebb795e4fabfb621212c027c670eb | set gateway prefix | rootio/demo_data.py | rootio/demo_data.py | from pathlib import Path
from datetime import datetime, timedelta
import json
import flask
import pytz
from .user.models import User
from .radio.models import Station, Program, ScheduledProgram
from .telephony.models import PhoneNumber, Gateway
from .telephony.constants import MOBILE
app = flask.current_app
MEDIA_PREF... | Python | 0.000004 | @@ -1271,24 +1271,55 @@
ottom=4000,%0A
+ gateway_prefix='',%0A
|
2e27306c09038dda3dd722282c9cf2645d13c113 | Fix fpm on Python2.5 | lib/fpm/package/pyfpm/get_metadata.py | lib/fpm/package/pyfpm/get_metadata.py | from distutils.core import Command
import json
import re
import time
import pkg_resources
# Note, the last time I coded python daily was at Google, so it's entirely
# possible some of my techniques below are outdated or bad.
# If you have fixes, let me know.
class get_metadata(Command):
description = "get package ... | Python | 0.000002 | @@ -32,20 +32,8 @@
and%0A
-import json%0A
impo
@@ -70,16 +70,87 @@
esources
+%0Atry:%0A import json%0Aexcept ImportError:%0A import simplejson as json
%0A%0A# Note
@@ -2060,21 +2060,45 @@
=2)%0A
-try:%0A
+if hasattr(json, 'dumps'):%0A
pr
@@ -2138,35 +2138,15 @@
e
-xcept AttributeError as
+l... |
a79f6d6b07a77a11314d5c763905a048db2783a6 | remove obsolete state return feature | nomcc/message.py | nomcc/message.py | # Copyright (C) 2011-2014,2016 Nominum, 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 ag... | Python | 0.000001 | @@ -1029,143 +1029,8 @@
= s%0A
- #%0A # State return%0A #%0A _state = request%5B'_ctrl'%5D.get('_state')%0A if _state is not None:%0A _ctrl%5B'_state'%5D = _state%0A
|
277b617c512eb33018140adc7574cb8dd9b592d6 | Order pages by numero and not id (in notifications) | notify/models.py | notify/models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Copyright 2014, Cercle Informatique ASBL. All rights reserved.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either ... | Python | 0 | @@ -1804,32 +1804,51 @@
= doc.page_set.
+order_by('numero').
first().bitmap_6
|
8639129bab87ed5ffe36111fd97e522a22dddcda | test coverage increased | payu/tests.py | payu/tests.py | from django.test import TestCase
from django.conf import settings
from payu.models import *
from payu.gateway import (
get_hash,
check_hash,
get_webservice_hash,
payu_url,
post,
verify_payment,
check_payment,
capture_transaction,
refund_transaction,
cancel_transaction,
check_... | Python | 0.000001 | @@ -328,16 +328,47 @@
status,%0A
+ cancel_refund_transaction,%0A
)%0A%0A%0Aseta
@@ -3229,32 +3229,117 @@
)%0A%0A def test_
+check_action_status(self):%0A r = check_action_status(123)%0A%0A def test_cancel_
refund_transacti
@@ -3365,28 +3365,38 @@
= c
-heck_action_status
+ancel_refund_transaction
... |
762a4351c2d1552cd99a2ce90c8641d781eec259 | change for windows... | pdfcropall.py | pdfcropall.py | #!/usr/bin/env python3
import sys
import os
def for_os(filesname):
osname = sys.platform
if osname == "linux":
filesname = filesname.replace(' ','\ ')
filesname = filesname.replace('(','\(')
filesname = filesname.replace(')','\)')
#if osname == "win32":
return filesname
if __name__ == "__main__":
prin... | Python | 0.000017 | @@ -235,17 +235,16 @@
'%5C)')%0A%0A%09
-#
if osnam
@@ -259,16 +259,45 @@
n32%22:%0A%09%09
+filesname = '%22'+filesname+'%22'
%0A%0A%09retur
|
b77b030908a6c589411224912f9a5e5e0e090829 | Make printf %-safe | wistfulc.py | wistfulc.py | sample_code = """\
if only <stdlib.h> were included...
if only <stdio.h> were included...
if only <math.h> were included...
if only int x were 3...
if x were 3...
wish "Hello World" upon a star
*sigh*
if wishes were horses..."""
import re
from functools import reduce
import subprocess
import os
import sys
def add_to_... | Python | 0.998768 | @@ -535,21 +535,27 @@
%22, r
-%22
+'
printf(
+%22%25s%22,
%5C1);
-%22
+'
),%0A
|
847a66ed8eb19206ecc77904dd5db547284b905f | Make sure exit code is used in -E situation | pip/runner.py | pip/runner.py | import sys
import os
def run():
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
## FIXME: this is kind of crude; if we could create a fake pip
## module, then exec into it and update pip.__path__ properly, we
## wouldn't have to update sys.path:
sys.path.insert(0, base)
impor... | Python | 0.000002 | @@ -373,14 +373,57 @@
_':%0A
-run(
+exit = run()%0A if exit:%0A sys.exit(exit
)%0A
|
175093dbdf890b9d82d782df9062e6dbce6e9108 | update for module split | jumpbox/formatter.py | jumpbox/formatter.py | # Copyright (C) 2017 Bradley Sakdol <bsakdol@turnitin.com>
#
# This file is part of Jumpbox
#
# Jumpbox 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) an... | Python | 0 | @@ -783,15 +783,14 @@
om d
-atabase
+bquery
imp
|
d854e19f4a1c6e5b2ae4007152bbd962fb851642 | Update version number for trunk to 1.4.0. | numpy/version.py | numpy/version.py | version='1.3.0'
release=False
if not release:
version += '.dev'
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_ve... | Python | 0 | @@ -8,9 +8,9 @@
='1.
-3
+4
.0'%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.