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 |
|---|---|---|---|---|---|---|---|
14a0293224e78875e74bfc6491017d6059aa07f5 | Enhance PEP8 | bin/tftpy_server.py | bin/tftpy_server.py | #!/usr/bin/env python
# vim: ts=4 sw=4 et ai:
# -*- coding: utf8 -*-
import logging
import sys
from optparse import OptionParser
import tftpy
log = logging.getLogger('tftpy')
log.setLevel(logging.INFO)
# console handler
handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)
default_formatter = logging.Fo... | Python | 0 | @@ -415,16 +415,17 @@
ndler)%0A%0A
+%0A
def main
@@ -437,17 +437,19 @@
usage
-=
+ =
%22%22%0A p
@@ -2167,16 +2167,17 @@
pass%0A%0A
+%0A
if __nam
|
6c8757aa3a98dcd692904ed2e9993044ff22c017 | Modify formats | test/test_subproc_runner.py | test/test_subproc_runner.py | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import errno
import os
import platform
import re
import subprocess
import sys
from subprocess import PIPE, CalledProcessError
import pytest
from typepy import is_not_null_string, is_null_string
from subprocrunner import SubprocessRunner
from su... | Python | 0.000001 | @@ -1789,18 +1789,39 @@
ected%22%5D,
+%0A %5B%0A
-%5B
%5B%22echo t
@@ -1834,16 +1834,28 @@
%22test%22%5D,
+%0A
%5B%5B%22echo
@@ -1873,17 +1873,28 @@
%22test%22%5D
-%5D
+,%0A %5D,
%0A )%0A
|
dabbf0b5796a4d16bdd588e9d8c541c1f3c8559b | Support for building multiple images at once | src/ddocker/app/build.py | src/ddocker/app/build.py | """
"""
import logging
import pesos.scheduler
import os
import threading
import time
from pesos.vendor.mesos import mesos_pb2
from ddocker.app import subcommand
from ddocker.app.scheduler import Scheduler
from Queue import Queue
logger = logging.getLogger("ddocker.build")
def args(parser):
parser.add_argument(... | Python | 0 | @@ -325,16 +325,27 @@
kerfile%22
+, nargs=%22+%22
)%0A pa
@@ -2208,16 +2208,59 @@
e queue%0A
+ for dockerfile in args.dockerfile:%0A
task
@@ -2271,21 +2271,16 @@
ue.put((
-args.
dockerfi
|
70445bd32ba08b9bd88726a7551345f71ae4e630 | Improve logging, refactoring | executor/opensubmit/executor/execution.py | executor/opensubmit/executor/execution.py | '''
Functions related to command execution on the local host.
'''
from .submission import Submission
from .result import Result, PassResult, FailResult
import logging
logger = logging.getLogger('opensubmit.executor')
import os, sys, platform, subprocess, signal
from threading import Timer
def kill_longrunning(... | Python | 0.000002 | @@ -68,43 +68,8 @@
''%0A%0A
-from .submission import Submission%0A
from
@@ -2964,16 +2964,20 @@
Executed
+ %7B0%7D
with er
@@ -2986,17 +2986,17 @@
r code %7B
-0
+1
%7D.%22.form
@@ -2998,16 +2998,25 @@
.format(
+cmdline,
proc.ret
@@ -3383,32 +3383,266 @@
put))%0A else:%0A
+ text = 'Execution of %22%... |
6a1f4be94fa595af60f483fef56c45f2c770b711 | Remove unused imports in svm's benchmarks | scikits/learn/benchmarks/bench_svm.py | scikits/learn/benchmarks/bench_svm.py | """
To run this, you'll need to have installed.
* pymvpa
* libsvm and it's python bindings
* scikit-learn (of course)
Does two benchmarks
First, we fix a training set, increase the number of
samples to classify and plot number of classified samples as a
function of time.
In the second benchmark, we increase t... | Python | 0.00006 | @@ -528,33 +528,8 @@
t gc
-%0Afrom timeit import Timer
%0A%0A#
|
f2eb527e7602472856f981726b91bb23bbf22a9e | Add URL decorator to dashboard app | stores/dashboard/app.py | stores/dashboard/app.py | from django.conf.urls.defaults import patterns, url
from django.utils.translation import ugettext_lazy as _
from oscar.core.application import Application
from oscar.apps.dashboard.nav import register, Node
from stores.dashboard import views
node = Node(_('Store Manager'))
node.add_child(Node(_('Stores'), 'stores-d... | Python | 0 | @@ -200,16 +200,73 @@
er, Node
+%0Afrom oscar.views.decorators import staff_member_required
%0A%0Afrom s
@@ -2327,16 +2327,96 @@
terns)%0A%0A
+ def get_url_decorator(self, url_name):%0A return staff_member_required%0A
%0Aapplica
|
095fd27319ab39809c2a312790f920bf3d2b041e | Add a --player option to the play command | brainfm/main/cli.py | brainfm/main/cli.py | #!/usr/bin/env python
import brainfm
import click
import jmespath
import json
import pathlib
import requests
import sys
import terminaltables
import webbrowser
CONFIG_PATH = pathlib.Path("~/.brainfm/config").expanduser()
CACHE_PATH = pathlib.Path("~/.brainfm/cache").expanduser()
CACHE_PATH.mkdir(parents=True, exist_o... | Python | 0 | @@ -103,16 +103,47 @@
equests%0A
+import shlex%0Aimport subprocess%0A
import s
@@ -3239,24 +3239,90 @@
tation_id%22)%0A
+@click.option(%22--player%22, help=%22Command used to play the stream%22)%0A
def play(sta
@@ -3320,32 +3320,45 @@
play(station_id
+, player=None
):%0A %22%22%22Play a
@@ -3808,40 +3808,13 @... |
92c5012164e2a09240328f882732fc4e86d8410d | Update tests/chainerx_tests/op_utils.py | tests/chainerx_tests/op_utils.py | tests/chainerx_tests/op_utils.py | import inspect
import sys
import numpy
import pytest
import chainer
import chainer.testing
import chainerx
class _OpTest(chainer.testing.function.FunctionTestBase):
def setup(self):
# This method can be overridden by a concrete class with arbitrary
# arguments.
pass
def teardown(se... | Python | 0 | @@ -3867,16 +3867,17 @@
fixture
+s
.%0A #%0A
|
fd2b4f1d536aec9e92a8b793eb2294c0a935bc35 | add cb and co for pusher | btspusher/pusher.py | btspusher/pusher.py | # -*- coding: utf-8 -*-
import asyncio
from autobahn.asyncio.wamp import ApplicationSession
from autobahn.wamp import auth
from btspusher.wamp import ApplicationRunner
class PusherComponent(ApplicationSession):
future = None # a future from asyncio
instance = None
login_info = None
@staticmethod
... | Python | 0 | @@ -290,16 +290,44 @@
o = None
+%0A cb = None%0A co = None
%0A%0A @s
@@ -490,16 +490,56 @@
%22join%22)%0A
+ PusherComponent.instance = self%0A
@@ -635,43 +635,102 @@
- PusherComponent.instance = self
+if self.cb:%0A self.cb(self)%0A if self.co:%0A yield... |
5c9b501c07f28d36b3cb6d35dbd2dde8074e16b7 | Fix tests | src/tests/rotation_cipher_plm_test.py | src/tests/rotation_cipher_plm_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Eduardo Lopez Biagi"
__license__ = "BSD-new"
from .. import rotation_cipher_plm as rcplm
import unittest
import functools
class TestRotationCipher(unittest.TestCase):
def setUp(self):
self.rc = rcplm.RotationCipher()
def test_alphabet(self)... | Python | 0.000003 | @@ -1584,25 +1584,25 @@
p%22:
-9.025973158782064
+8.977135925347058
e-05
@@ -1681,29 +1681,29 @@
0.00079
-7140792747538
+6433084658995
5%7D)%0A
@@ -2172,32 +2172,36 @@
0 + k) / (15 + k
+ * 3
))%0A self.
@@ -2257,16 +2257,20 @@
(15 + k
+ * 3
))%0A
@@ -2334,16 +2334,20 @@
(15 + k
+ * 3
))%0A... |
62617dcc596a79f577de187722477a1e34a68a4e | version 0.7b10 | databench/__init__.py | databench/__init__.py | """Databench module."""
# flake8: noqa
from __future__ import absolute_import
__version__ = '0.7b9'
__all__ = ['Analysis', 'AnalysisZMQ', 'App', 'Datastore', 'Meta', 'MetaZMQ',
'on', 'Readme', 'testing', 'utils']
from .analysis import Analysis, on
from .analysis_zmq import AnalysisZMQ
from .app import App... | Python | 0.000001 | @@ -96,9 +96,10 @@
0.7b
-9
+10
'%0A__
|
4fe36d96d3810b39fcd15dee87318763d0d277a9 | remove time | streamteam/io/nbody6.py | streamteam/io/nbody6.py | # coding: utf-8
""" Class for reading data from NBODY6 simulations """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
import logging
import re
# Third-party
import numpy as np
import astropy.units as u
from astropy.constants import G
... | Python | 0.99805 | @@ -1954,49 +1954,8 @@
t)%0A%0A
- time = time.decompose(units)%0A
@@ -2015,36 +2015,8 @@
data
-, meta=dict(time=time.value)
)%0A
|
1601ac43644a5e4ee84a2c2257d5a09fc7971849 | rename measurement string for q-value | consensx/views.py | consensx/views.py | from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import random # ID generation
import string # ID generation
import os # mkdir
import pickle
import json
from .models import CSX_upload, CSX_calculation
from .consensx import run_calculatio... | Python | 0.000018 | @@ -4186,16 +4186,71 @@
%22corr%22%0A%0A
+ if measure == %22q-value%22:%0A measure = %22qval%22%0A%0A
valu
|
bcd49d8688a1f40e47b4490105b58d3046bb45e3 | Fix Issue #93 - Fix Curl connect will raise auth not supported error. | microproxy/layer/proxy/socks.py | microproxy/layer/proxy/socks.py | import struct
import ipaddress
from tornado import gen
from tornado import iostream
from base import ProxyLayer
from microproxy.utils import get_logger
from microproxy.exception import ProtocolError, SrcStreamClosedError
logger = get_logger(__name__)
class SocksLayer(ProxyLayer):
SOCKS_VERSION = 0x05
SOC... | Python | 0 | @@ -1533,17 +1533,17 @@
d_bytes(
-3
+2
)%0A%0A
@@ -1666,11 +1666,8 @@
thod
-, _
= s
@@ -1682,17 +1682,16 @@
pack('BB
-B
', data)
@@ -1692,16 +1692,68 @@
data)%0A%0A
+ yield src_stream.read_bytes(socks_nmethod)%0A%0A
@@ -1884,43 +1884,8 @@
))%0A%0A
- if socks_nmethod == 1:%0A
... |
73fbfd435c849c0690121b0a3fc8545057247c8a | Fix command options issues | mistral_actions/client/shell.py | mistral_actions/client/shell.py | import sys
from mistral_actions.client import actions as actions_cli
import mistral_actions.utils as utils
def do_clear(args):
"""Unregister all actions from Mistral."""
actions_cli.unregister_all()
print("All actions are removed from Mistral successfully.")
@utils.arg(
'--override',
dest='over... | Python | 0.000017 | @@ -491,24 +491,125 @@
Mistral.%22%22%22%0A
+ override = args.override%0A try:%0A sys.argv.remove(%22--override%22)%0A except:%0A pass%0A
register
@@ -650,24 +650,24 @@
egistered()%0A
-
discover
@@ -928,21 +928,16 @@
%0A if
-args.
override
@@ -1164,51 +1164,389 @@
-actions... |
f846f58891e1389941f008e3f53c95ffd1b6558d | Update to add email functionality based on threshold checking. | dbtracker/__init__.py | dbtracker/__init__.py | import logging
from dbtracker.cli import Cli
import argparse
def main(argv=None):
parser = argparse.ArgumentParser(
description="Queries MySQL and PostgreSQL for stats")
parser.add_argument(
"-S", "--save",
action="store_true",
help="generate and save database stats")
parse... | Python | 0 | @@ -1091,32 +1091,334 @@
r.add_argument(%0A
+ %22--min%22,%0A type=int,%0A help=%22Minimum threshold of a database row change, before a notification is sent.%22)%0A parser.add_argument(%0A %22--max%22,%0A type=int,%0A help=%22Maximum threshold of a database row change, befo... |
4e93ab58167752b655f405e809fe76971af92865 | Adding epoch | LogReg/LogReg.py | LogReg/LogReg.py | import numpy as np
import math
class LogReg:
__class = 10
__basisFct = None
__weights = None
__bias = 0
__features = None
__error = 0
__cost = None
__learningRate = 0
__targets = None
def __init__(self, dataSet, learningRate=0.0001):
self.__features = self.__getFeature... | Python | 0.999407 | @@ -2223,16 +2223,55 @@
..%5Cn%5Cn%22%0A
+ for epoch in range(0, 10):%0A
@@ -2323,32 +2323,36 @@
elf.__targets):%0A
+
prob
@@ -2398,32 +2398,36 @@
re)%0A
+
self.__error +=
@@ -2465,24 +2465,105 @@
rget, prob)%0A
+ print self.__error%0A ... |
516844b2d34da22a4ad567ba25f900e1f747327c | exclude unversioned protos (#2672) | Logging/synth.py | Logging/synth.py | # Copyright 2018 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, s... | Python | 0 | @@ -1100,32 +1100,37 @@
src also%0As.move(
+%0A
library / 'proto
@@ -1160,16 +1160,76 @@
ng',
+%0A
'src/'
-)
+,%0A %5Blibrary / 'proto/src/Google/Cloud/Logging/Type'%5D)%0A
%0As.m
@@ -1288,32 +1288,37 @@
metadata%0As.move(
+%0A
library / 'proto
@@ -1350,16 +1350,20 @@
ogging',
+%0A
'metada
@... |
838d8c8952f63464dfafaaeba3b16b681317c15e | add plot | tests/test_annotate.py | tests/test_annotate.py | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure(1, figsize=(8, 5))
ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-4, 3))
t = np.arange(0.0, 5.0, 0.2)
s = np.cos(2 * np.pi * t)
ax.plot(t, s, color="blue")
ax.annotate(
"text",
x... | Python | 0.000094 | @@ -935,8 +935,63 @@
e.tex%22)%0A
+%0A%0Aif __name__ == %22__main__%22:%0A plot()%0A plt.show()%0A
|
8e10a62052f252c21c3898f70fc10d23c7261af0 | Update urls.py | submify/submify/urls.py | submify/submify/urls.py | """submify URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | Python | 0.000002 | @@ -171,16 +171,17 @@
xamples:
+:
%0AFunctio
|
6b9da294869c0c63502b59758abbe002be65944f | ensure timestamps are utc | tests/test_contents.py | tests/test_contents.py | from fixtures import *
import sys
import struct
import logging
import datetime
import binascii
#logging.basicConfig(level=logging.DEBUG)
def make_string_name_key(name):
return b'N' + name.encode('utf-8')
def make_int_name_key(name, wordsize=4):
if wordsize == 4:
return b'N' + struct.pack('<BI', 0... | Python | 0.999998 | @@ -3175,16 +3175,19 @@
atetime.
+utc
fromtime
@@ -3237,18 +3237,18 @@
7-06-20T
-18
+22
:31:34'%0A
|
cfb68d7e1146241b9783d82d09f7f813e658d4aa | fix doctests | tests/test_doctests.py | tests/test_doctests.py | # encoding: utf8
from quantiphy import Quantity
import pytest
import doctest
import glob
import sys
def test_README():
if sys.version_info < (3, 6):
# code used in doctests assumes python3.6
return
Quantity.reset_prefs()
rv = doctest.testfile('../README.rst', optionflags=doctest.ELLIPSIS)... | Python | 0.000001 | @@ -928,18 +928,18 @@
x.rst':
-29
+31
,%0A
|
72f7162b2a307297798dbeb866d54de5acfdeffb | correct input dimension comment | models/alexnet_14/alexNet_14.py | models/alexnet_14/alexNet_14.py | # The Model of DeepVO
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
from keras import backend as K #enable tensorflow functions
... | Python | 0.000004 | @@ -376,15 +376,15 @@
is
-224x224
+128x128
%0A%0Ade
@@ -2043,61 +2043,39 @@
be
-a 2d list of quaternion rotations and translations.%22%22
+%5B%5Btranslation%5D,%5Bquat rotation%5D%5D
%0A
|
70ec2171784ffb3435c108082f3b47c529741392 | The all-important comma | sydent/db/valsession.py | sydent/db/valsession.py | # -*- coding: utf-8 -*-
# Copyright 2014 matrix.org
#
# 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 o... | Python | 0.999994 | @@ -3493,16 +3493,17 @@
?%22, (sid
+,
))%0A
|
74ce3166799f9bf3f5cdce376fd1e0d7e2a894e2 | Remove some enigmatic or incorrect comments | compare.py | compare.py | import re
from copy import deepcopy
from itertools import ifilter
from parsley import makeGrammar
from sys import argv, stderr, stdout
from dhcp_objects import (Statement, RangeStmt, Pool, Subnet, Class, Subclass,
Group, Host, ConfigFile)
def first(it):
return next(it, None)
symbols =... | Python | 0.000001 | @@ -1139,33 +1139,8 @@
'%5Cn'
- # not strictly necessary
%0A
@@ -1691,19 +1691,8 @@
%5Bz%5D)
- # deep add
%0A%0A%0Ad
|
198d4944e961fd998d6e896b3e75ca2e815ffaa5 | Add log to file function for vimapt package | src/vimapt/library/vimapt/__init__.py | src/vimapt/library/vimapt/__init__.py | Python | 0 | @@ -0,0 +1,125 @@
+import logging%0A%0Alogging.basicConfig(filename='/var/log/vimapt.log', level=logging.INFO)%0Alogger = logging.getLogger(__name__)%0A
| |
a84dde598297495fe6f0f8b233b3a3761b0df7d4 | Update test to check newer logic | tests/functional/test_warning.py | tests/functional/test_warning.py |
def test_environ(script, tmpdir):
"""$PYTHONWARNINGS was added in python2.7"""
demo = tmpdir.join('warnings_demo.py')
demo.write('''
from pip._internal.utils import deprecation
deprecation.install_warning_logger()
from logging import basicConfig
basicConfig()
from warnings import warn
warn("deprecated!",... | Python | 0 | @@ -1,8 +1,25 @@
+import textwrap%0A%0A
%0Adef tes
@@ -156,12 +156,76 @@
ite(
-'''%0A
+textwrap.dedent('''%0A from logging import basicConfig%0A
from
@@ -264,16 +264,25 @@
ecation%0A
+%0A
deprecat
@@ -314,88 +314,51 @@
r()%0A
-%0Afrom logging import basicConfig%0AbasicConfig()%0A%0Afrom war... |
e67f419c9135dd6b5135379bd16a3f06d134259e | Fix metadata serialization for OPTIONS request. | src/waldur_core/structure/metadata.py | src/waldur_core/structure/metadata.py | from collections import OrderedDict
from django.utils.encoding import force_text
from django.utils.http import urlencode
from rest_framework import exceptions
from rest_framework import serializers
from rest_framework.metadata import SimpleMetadata
from rest_framework.request import clone_request
from rest_framework.r... | Python | 0 | @@ -4328,61 +4328,38 @@
if
-'post' not in getattr(callback, 'bind_to_methods', %5B%5D
+not hasattr(callback, 'detail'
):%0A
|
97af84d79eea17f22bc99e432e3ee47edd81123e | remove integration test for setup.py error as annotations are only supported on 3.7 | testing/test_integration.py | testing/test_integration.py | from __future__ import annotations
import os
import sys
import textwrap
from pathlib import Path
import pytest
from .wd_wrapper import WorkDir
from setuptools_scm import PRETEND_KEY
from setuptools_scm import PRETEND_KEY_NAMED
from setuptools_scm.integration import _warn_on_old_setuptools
from setuptools_scm.utils i... | Python | 0 | @@ -33,18 +33,8 @@
ns%0A%0A
-import os%0A
impo
@@ -4341,403 +4341,8 @@
%22%0A%0A%0A
-def test_own_setup_fails_on_old_python(monkeypatch: pytest.MonkeyPatch) -%3E None:%0A monkeypatch.setattr(%22sys.version_info%22, (3, 5))%0A monkeypatch.syspath_prepend(os.path.dirname(os.path.dirname(__file__)))%0A%0A impo... |
d49668dfb76e148fab6e878b2d1944a5e70a3c38 | fix test_cookie test on windows | tests/integration/test_cookie.py | tests/integration/test_cookie.py | # vim:ts=4:sw=4:et:
# Copyright 2018-present Facebook, Inc.
# Licensed under the Apache License, Version 2.0
# no unicode literals
from __future__ import absolute_import, division, print_function
import os
import socket
import pywatchman
import WatchmanTestCase
@WatchmanTestCase.expand_matrix
class TestCookie(Watc... | Python | 0.000001 | @@ -1172,32 +1172,103 @@
ved%22 in reason)%0A
+ or (%22The system cannot find the file specified%22 in reason)%0A
or (
|
a08c54d524e166d913c7e395e6a36cca76243df4 | add sqlite no-op tests | tests/integration/test_sqlite.py | tests/integration/test_sqlite.py | import os
import unittest
from threading import Thread
from unittest.mock import patch
from requests_cache.backends.sqlite import DbDict, DbPickleDict
from tests.integration.test_backends import BaseStorageTestCase
class SQLiteTestCase(BaseStorageTestCase):
def tearDown(self):
try:
os.unlink(... | Python | 0.000002 | @@ -2422,16 +2422,389 @@
True))%0A%0A
+ def test_noop(self):%0A def do_noop_bulk(d):%0A with d.bulk_commit():%0A pass%0A del d%0A%0A d = self.storage_class(self.NAMESPACE)%0A t = Thread(target=do_noop_bulk, args=(d,))%0A t.start()%0A t.join()%0... |
21e95ff23a4ceca06d4bfd291f0e2b29b896af2f | Add tests for timeout and listen stop | tests/test_listener.py | tests/test_listener.py | #!/usr/bin/env python
import argparse
import os
import pytest
import pg_bawler.core
import pg_bawler.listener
class NotificationListener(
pg_bawler.core.BawlerBase,
pg_bawler.core.ListenerMixin
):
pass
class NotificationSender(
pg_bawler.core.BawlerBase,
pg_bawler.core.SenderMixin
):
pass
... | Python | 0 | @@ -703,126 +703,219 @@
ler(
-None) == 0%0A assert listener.register_handler(True) == 1%0A assert listener.unregister_handler(None)%0A assert not
+'channel', 'handler') is None%0A assert listener.registered_channels%5B'channel'%5D == %5B'handler'%5D%0A%0A listener.unregister_handler('channel', 'handler'... |
9c92cf39a69bbc6a078a8ffd7fcd8ea8f95b2678 | fix tests | tests/test_payments.py | tests/test_payments.py | # Test cases can be run with either of the following:
# python -m unittest discover
# nosetests -v --rednose --nologcapture
import unittest
import db
from app import payments
from db import db, models
class TestModels(unittest.TestCase):
def setUp(self):
payments.app.debug = True
payments.app.c... | Python | 0.000001 | @@ -139,18 +139,8 @@
st%0A%0A
-import db%0A
from
@@ -175,16 +175,20 @@
import
+app_
db, mode
@@ -395,32 +395,36 @@
2/test'%0A
+app_
db.drop_all()
@@ -458,16 +458,20 @@
+app_
db.creat
@@ -818,32 +818,36 @@
e(data)%0A
+app_
db.session.add(p
@@ -854,32 +854,36 @@
ayment)%0A ... |
00f15f47f8eeabf336e0e2a71cda48aaef270f85 | Comment out apparently-unused code. | build/getversion.py | build/getversion.py | #!/usr/bin/env python
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | Python | 0 | @@ -2427,16 +2427,18 @@
actor,%0A
+ #
'SQLITE
@@ -2458,16 +2458,27 @@
tractor,
+ # not used
%0A %7D%0A%0Ade
|
5d804e3dacd498ce1a5f99db22b808406e7d480c | raise runtimeerror for non-axisymmetric potentials in actionAngleTorus | galpy/actionAngle_src/actionAngleTorus.py | galpy/actionAngle_src/actionAngleTorus.py | ###############################################################################
# class: actionAngleTorus
#
# Use McMillan, Binney, and Dehnen's Torus code to calculate (x,v)
# given actions and angles
#
#
###############################################################################
impor... | Python | 0 | @@ -376,16 +376,27 @@
otential
+, _isNonAxi
%0Afrom ga
@@ -1577,16 +1577,149 @@
%5B'pot'%5D%0A
+ if _isNonAxi(self._pot):%0A raise RuntimeError(%22actionAngleTorus for non-axisymmetric potentials is not supported%22)%0A
|
182714b6b801107d1e1baec0dd49c218c52b1416 | handle ctrl+c during parsing, etc | core/dbt/task/compile.py | core/dbt/task/compile.py | import os
import signal
import threading
from dbt.adapters.factory import get_adapter
from dbt.clients.jinja import extract_toplevel_blocks
from dbt.compilation import compile_manifest
from dbt.loader import load_all_projects
from dbt.node_runners import CompileRunner, RPCCompileRunner
from dbt.node_types import NodeT... | Python | 0.000001 | @@ -4254,24 +4254,134 @@
cros=None):%0A
+ # we could get a ctrl+c at any time, including during parsing.%0A thread = None%0A try:%0A
node
@@ -4431,16 +4431,20 @@
+
+
selected
@@ -4468,16 +4468,20 @@
que_id%5D%0A
+
@@ -4517,32 +4517,36 @@
_uids)%0A%0A ... |
5856750be58ad6a90ba884948ea5f2a9921cdc65 | Test with include_player_ids | tests/test_push_msg.py | tests/test_push_msg.py | # -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2017 SciFabric LTD.
#
# PYBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | Python | 0 | @@ -4034,16 +4034,856 @@
yload)%0A%0A
+ @patch('pbsonesignal.requests.post')%0A def test_push_msg_include_player_ids(self, mock):%0A %22%22%22Test push_msg with array include_player_ids works.%22%22%22%0A client = PybossaOneSignal(app_id=%221%22, api_key=%22key%22)%0A fakeRequest = MagicMock... |
bc11e1266a5b4cd908af484f8bddf0978d00bfd4 | Improve "nfsnapi.auth_header()". | nfsnapi.py | nfsnapi.py | """Stuff to make working with the NearlyFreeSpeech.NET API easier.
>>> import nfsnapi
>>> # Replace USERNAME, API_KEY, and so on with actual values.
>>> nfsnapi.run_request("USERNAME", "API_KEY",
... "/account/ACCOUNT_NUMBER/balance")
'10.56'
>>> nfsnapi.run_request("USERNAME", "API_KEY",
... "/dns/DOMAI... | Python | 0 | @@ -1604,70 +1604,8 @@
is%0A
- %3Chttps://api.nearlyfreespeech.net/site/example/addAlias%3E,%0A
@@ -1653,16 +1653,60 @@
dAlias%22.
+ The trailing%0A forward-slash is optional.
%0A - %22re
@@ -1943,16 +1943,87 @@
%0A %22%22%22%0A%0A
+ if (request_path%5B0%5D != %22/%22):%0A request_path = %22/%25s... |
ee0f31857028a68116f2912054877f37bd64683a | fix vdsClient connections | ovirt_hosted_engine_ha/broker/submonitor_util.py | ovirt_hosted_engine_ha/broker/submonitor_util.py | #
# ovirt-hosted-engine-ha -- ovirt hosted engine high availability
# Copyright (C) 2013 Red Hat, Inc.
#
# 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; either
# version 2.1 of the Licens... | Python | 0 | @@ -1899,49 +1899,8 @@
t)%0A%0A
- serv.do_connect(server, server_port)%0A
|
727b42a1cdec461d715b845872c321326ce18554 | Load aliases on module load | Modules/Alias.py | Modules/Alias.py | from ModuleInterface import ModuleInterface
from IRCResponse import IRCResponse, ResponseType
import GlobalVars
class Alias(ModuleInterface):
triggers = ["alias"]
help = 'alias <alias> <command> <params> - aliases <alias> to the specified command and parameters\n' \
'you can specify where parameter... | Python | 0 | @@ -544,16 +544,132 @@
used.'%0A%0A
+ def onLoad(self):%0A self.bot.moduleHandler.commandAliases = self.bot.moduleHandler.loadAliases()%0A %0A
def
|
52cf1efd8b1f721d65732d16b171040d83d02b21 | fix test_workflow | tests/test_workflow.py | tests/test_workflow.py | from unittest import TestCase
from dvc.graph.workflow import Workflow
from dvc.graph.commit import Commit
class TestWorkflow(TestCase):
def setUp(self):
self._commit4 = Commit('4', '3', 'name1', 'today', 'comment4')
self._commit3 = Commit('3', '2', 'name1', 'today', 'DVC repro-run ...')
s... | Python | 0 | @@ -997,32 +997,57 @@
mmits%5B'1'%5D.text,
+%0A
self._commit1._
@@ -1069,36 +1069,44 @@
+ self._commit1.
+_text_
hash
+()
)%0A self.a
@@ -1130,32 +1130,57 @@
mmits%5B'2'%5D.text,
+%0A
self._commit2._
@@ -1210,20 +1210,28 @@
commit2.
+_text_
hash
+()
)%0... |
ede603fd2b63f101174d4312ed77f710aaaeec3a | comment out test for `test_data_split_nlu` | tests/cli/test_rasa_data.py | tests/cli/test_rasa_data.py | import argparse
import os
from unittest.mock import Mock
import pytest
from collections import namedtuple
from typing import Callable, Text
from _pytest.monkeypatch import MonkeyPatch
from _pytest.pytester import RunResult
from rasa.cli import data
from rasa.importers.importer import TrainingDataImporter
from rasa.val... | Python | 0 | @@ -576,24 +576,140 @@
_split%22)%0A
+ # TODO: Comment back in as soon as NLU YAML writer is merged%0A # https://github.com/RasaHQ/rasa/issues/6363%0A #
assert os.p
@@ -768,24 +768,26 @@
ta.md%22))%0A
+ #
assert os.p
|
a69a346e2fd35e531c72b06a2c895d928340c110 | Fix `includes_today` trait fo `MembershipFactory` | tests/factories/property.py | tests/factories/property.py | from datetime import datetime, timedelta, timezone
from functools import partial
from itertools import chain
import factory
from pycroft.model.user import Membership, PropertyGroup
from pycroft.helpers import interval
from .base import BaseFactory
from .user import UserFactory
class MembershipFactory(BaseFactory):... | Python | 0 | @@ -693,18 +693,59 @@
-begins_at=
+active_during=interval.closedopen(%0A
date
@@ -799,16 +799,12 @@
-ends_at=
+
date
@@ -834,32 +834,47 @@
+ timedelta(1),%0A
+ ),%0A
)%0A%0A%0Adef
|
ee098fbb610cbd95f55b33ebb69961cb16f1099d | Add more tests for block_checksum and content_checksum | tests/frame/test_frame_4.py | tests/frame/test_frame_4.py | from . helpers import (
roundtrip_LZ4FrameCompressor,
roundtrip_LZ4FrameCompressor_LZ4FrameDecompressor,
)
import os
import pytest
test_data=[
(os.urandom(128 * 1024)),
(os.urandom(256 * 1024)),
(os.urandom(512 * 1024)),
(os.urandom(1024 * 1024)),
]
@pytest.fixture(
params=test_data,
i... | Python | 0 | @@ -714,32 +714,66 @@
lock_size, reset
+, block_checksum, content_checksum
):%0A roundtrip
@@ -872,32 +872,115 @@
reset=reset
+,%0A block_checksum=block_checksum,%0A content_checksum=content_checksum,
%0A )%0A%0Adef test
@@ -1070,16 +1070,50 @@
e, reset
+, block_checksum, content_checksum
... |
d3831a9ec391fb1dc7f8b7fdd2e762d0636f9aa3 | should set sentence number instead of id | jsrs/ratings/models.py | jsrs/ratings/models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from jsrs.users.models import User
from jsrs.... | Python | 0.999999 | @@ -4780,18 +4780,24 @@
entence(
-id
+sentence
=a_model
|
637ae783dabd268ab03dfdf88592e733675bebbf | Make number of seconds to sleep a command line option. | thingiverse_crawler.py | thingiverse_crawler.py | #!//usr/bin/env python
import argparse
import datetime
import os.path
import requests
import re
import time
def utc_mktime(utc_tuple):
"""Returns number of seconds elapsed since epoch
Note that no timezone are taken into consideration.
utc tuple must be: (year, month, day, hour, minute, second)
"""
... | Python | 0.000002 | @@ -1654,16 +1654,31 @@
things(N
+, sleep_seconds
):%0A b
@@ -2101,35 +2101,45 @@
time.sleep(
-0.5
+sleep_seconds
);%0A%0A return t
@@ -2181,24 +2181,39 @@
ks(thing_ids
+, sleep_seconds
):%0A base_
@@ -3084,35 +3084,45 @@
time.sleep(
-0.5
+sleep_seconds
);%0A%0A return l
@@ -3386,24 +3386,... |
acce8817eae67dc605ffe628d0d536511d3ea915 | remove dead code | corehq/apps/ota/forms.py | corehq/apps/ota/forms.py | from django import forms
from django.utils.translation import gettext
from crispy_forms import layout as crispy
# todo proper B3 Handle
from crispy_forms.bootstrap import StrictButton
from crispy_forms.helper import FormHelper
from corehq.apps.hqwebapp import crispy as hqcrispy
class PrimeRestoreCacheForm(forms.For... | Python | 0.999454 | @@ -1216,2374 +1216,4 @@
)%0A
-%0A%0Aclass AdvancedPrimeRestoreCacheForm(forms.Form):%0A check_cache_only = forms.BooleanField(%0A label='Check cache only',%0A help_text=%22Just check the cache, don't actually generate the restore response.%22,%0A required=False%0A )%0A overwrite_cache ... |
24439d318668897d8d1aff99df1606e80d45b875 | add watchdog test | tests/test_bmc.py | tests/test_bmc.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
from nose.tools import eq_, raises
from pyipmi.bmc import *
import pyipmi.msgs.bmc
from pyipmi.msgs import encode_message
from pyipmi.msgs import decode_message
def test_deviceid_object():
m = pyipmi.msgs.bmc.GetDeviceIdRsp()
decode_message(m, '\x00\x12\x84\x05\x6... | Python | 0 | @@ -202,16 +202,468 @@
essage%0A%0A
+def test_watchdog_object():%0A m = pyipmi.msgs.bmc.GetWatchdogTimerRsp()%0A decode_message(m, '%5Cx00%5Cx41%5Cx42%5Cx33%5Cx44%5Cx55%5Cx66%5Cx77%5Cx88')%0A%0A w = Watchdog(m)%0A eq_(w.timer_use, 1)%0A eq_(w.is_running, 1)%0A eq_(w.dont_log, 0)%0A eq_(w.timeout_a... |
5ae1d9ebcc34d47c858ba63e26121be92771d812 | temporary fix test_bot login | tests/test_bot.py | tests/test_bot.py | import json
import requests
from instabot import Bot
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
class TestBot:
def setup(self):
self.USER_ID = 1234567
self.USERNAME = "test_username"
self.PASSWORD = "test_password"
self.FU... | Python | 0.997568 | @@ -2012,16 +2012,33 @@
i.login(
+%0A
username
@@ -2052,16 +2052,32 @@
SERNAME,
+%0A
passwor
@@ -2091,16 +2091,63 @@
PASSWORD
+,%0A use_cookie=False%0A
)%0A%0A
|
e6519d121ab80467fafdab6a2183964d97ef60e8 | Add test for set_meta command. | tests/test_cli.py | tests/test_cli.py | # -*- coding: utf-8 -*-
import os
from click.testing import CliRunner
from sigal import init
from sigal import serve
def test_init(tmpdir):
config_file = str(tmpdir.join('sigal.conf.py'))
runner = CliRunner()
result = runner.invoke(init, [config_file])
assert result.exit_code == 0
assert result.... | Python | 0 | @@ -112,16 +112,43 @@
t serve%0A
+from sigal import set_meta%0A
%0A%0Adef te
@@ -956,28 +956,1059 @@
ssert result.exit_code == 1%0A
+%0Adef test_set_meta(tmpdir):%0A%0A testdir = tmpdir.mkdir(%22test%22)%0A%0A testfile = tmpdir.join(%22test.jpg%22)%0A testfile.write(%22%22)%0A%0A runner = CliRunner()%0A ... |
d2de2d44a46ff521ab8c1d8bbc57d4eeb8d5dc53 | Fix an error | taiga/users/services.py | taiga/users/services.py | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# 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 F... | Python | 0.998142 | @@ -2100,24 +2100,41 @@
tar url.%22%22%22%0A
+ if user:%0A
return g
@@ -2206,8 +2206,22 @@
.email)%0A
+ return %22%22%0A
|
0f5d0353f9faad9bb34432cd047540b81c6ea643 | add exception test for invalid authentication | tests/test_tpm.py | tests/test_tpm.py | import requests
import requests_mock
import unittest
import os.path
import tpm
import json
import logging
log = logging.getLogger(__name__)
api_url = 'https://tpm.example.com/index.php/api/v4/'
local_path = 'tests/resources/'
item_limit = 20
def fake_data(url, m):
"""
A stub urlopen() implementation that lo... | Python | 0.000001 | @@ -2906,24 +2906,467 @@
eptions.%22%22%22%0A
+ def test_wrong_auth_exception(self):%0A %22%22%22Exception if wrong authentication mehtod.%22%22%22%0A with self.assertRaises(tpm.TpmApi.ConfigError) as context:%0A tpm.TpmApiv4('https://tpm.example.com', username='USER', private_key='PASS')%0... |
d43d4638eefe6d08dcb9ad739753bc4c43647c2a | fix another lazy test | tests/legacy/test_xmlrpc.py | tests/legacy/test_xmlrpc.py | # Copyright 2013 Donald Stufft
#
# 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, so... | Python | 0.000034 | @@ -1646,16 +1646,36 @@
es.calls
+ == %5Bpretend.call()%5D
%0A res
|
87ff78dfe54795f9067fa45f832e8bc84b16c894 | Fix integer division | tf_rl/simulate.py | tf_rl/simulate.py | import math
import time
from IPython.display import clear_output, display, HTML
from itertools import count
from os.path import join, exists
from os import makedirs
def simulate(simulation,
controller= None,
fps=60,
visualize_every=1,
action_every=1,
si... | Python | 0.999999 | @@ -1,16 +1,49 @@
+from __future__ import division%0A%0A
import math%0Aimpo
|
31a2439c1137068d8532c5f85cc1c8fb913d7ee8 | Add reconnect to clamscan | modules/Antivirus/ClamAVScan.py | modules/Antivirus/ClamAVScan.py | # 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/.
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
try:
import pyclam... | Python | 0.000001 | @@ -623,59 +623,24 @@
def
-scan(filelist, conf=DEFAULTCONF):%0A results = %5B%5D%0A
+_connect_clam():
%0A
@@ -901,16 +901,130 @@
clamd%22)
+%0A return clamScanner%0A%0Adef scan(filelist, conf=DEFAULTCONF):%0A results = %5B%5D%0A%0A clamScanner = _connect_clam()
%0A%0A #
@@ -1419,16 +1419,16 @@
... |
821e191e05269b9c1cc5f58b3d4cecf5bd20e896 | Correct Range sample | samples/python/com.ibm.streamsx.topology.pysamples/opt/python/streams/spl_sources.py | samples/python/com.ibm.streamsx.topology.pysamples/opt/python/streams/spl_sources.py | # Licensed Materials - Property of IBM
# Copyright IBM Corp. 2015, 2016
from __future__ import absolute_import, division, print_function
# Simple inclusion of Python logic within an SPL application
# as a SPL "Function" operator. A "Function" operator has
# a single input port and single output port, a function
# is ... | Python | 0.000001 | @@ -2486,30 +2486,130 @@
-return map(tuple, iter
+# Use zip to convert the single returned value%0A # into a tuple to allow it to be returned to SPL%0A return zip
(ran
@@ -2623,10 +2623,9 @@
.count))
-)
%0A
|
b23a887edd6b55f2386c45c9b93c04431bceba5e | remove all__vary_rounds setting (deprecated in Passlib 1.7) | coremods/login.py | coremods/login.py | """
login.py - Implement core login abstraction.
"""
from pylinkirc import conf, utils, world
from pylinkirc.log import log
try:
from passlib.context import CryptContext
except ImportError:
CryptContext = None
log.warning("Hashed passwords are disabled because passlib is not installed. Please install "
... | Python | 0 | @@ -500,61 +500,8 @@
%22%5D,%0A
- all__vary_rounds=0.1,%0A
|
b79a80d894bdc39c8fa6f76fe50e222567f00df1 | Update cofnig_default: add elastic search config | config_default.py | config_default.py | # -*- coding: utf-8 -*-
"""
Created on 2015-10-23 08:06:00
@author: Tran Huu Cuong <tranhuucuong91@gmail.com>
"""
import os
# Blog configuration values.
# You may consider using a one-way hash to generate the password, and then
# use the hash again in the login view to perform the comparison. This is just
# for sim... | Python | 0 | @@ -915,8 +915,124 @@
RT=5000%0A
+%0AES_HOST = %7B%0A %22host%22: %22172.17.42.1%22,%0A %22port%22: 9200%0A%7D%0A%0AES_INDEX_NAME = 'notebooks'%0AES_TYPE_NAME = 'notebooks'%0A%0A
|
a7c084b4ff3d5529ca54209283d0e1a5984ebea2 | Fix lint error | tldextract/cli.py | tldextract/cli.py | '''tldextract CLI'''
import logging
import sys
from .tldextract import TLDExtract
from ._version import version as __version__
def main():
'''tldextract CLI main command.'''
import argparse
logging.basicConfig()
parser = argparse.ArgumentParser(
prog='tldextract',
description='Pars... | Python | 0.000035 | @@ -124,16 +124,17 @@
sion__%0A%0A
+%0A
def main
|
493fc3dcbb192ac226aa94f11602ced843f27195 | Add debug text for scrapped last race ID | granjaRaces/spiders/granjaRaces_spider.py | granjaRaces/spiders/granjaRaces_spider.py | import scrapy
import re
import os
from scrapy.loader import ItemLoader
from granjaRaces.items import GranjaRacesItem
LOGIN_URL = 'http://www.kartodromogranjaviana.com.br/resultados/resultados_cad.php'
RESULT_URL = 'http://www.kartodromogranjaviana.com.br/resultados/resultados_folha.php'
RESULT_TYPE = 1 # race
# TRIVIA... | Python | 0.000001 | @@ -1778,16 +1778,81 @@
dList))%0A
+%09%09%09self.logger.info('Using scarapped END RACE: %25i', lastRaceId)%0A%0A
%09%09if las
|
c22ffd3c2c8feb0dfba2eb6df6fb8cbb49475cee | Remove un-used `message` arg, Fixes #4824 | salt/returners/sentry_return.py | salt/returners/sentry_return.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Salt returner that report error back to sentry
Pillar need something like::
raven:
servers:
- http://192.168.1.1
- https://sentry.example.com
public_key: deadbeefdeadbeefdeadbeefdeadbeef
secret_key: beefdeadbeefdeadbeefdeadbeefde... | Python | 0 | @@ -727,17 +727,8 @@
try(
-message,
resu
|
e7c462af8382a5eb7f5fee2abfc04f002e36b193 | Add varint and varlong tests | tests/mcp/test_datautils.py | tests/mcp/test_datautils.py | Python | 0 | @@ -0,0 +1,1065 @@
+from spock.mcp import datautils%0Afrom spock.utils import BoundBuffer%0A%0A%0Adef test_unpack_varint():%0A largebuff = BoundBuffer(b'%5Cx80%5Cx94%5Cxeb%5Cxdc%5Cx03')%0A smallbuff = BoundBuffer(b'%5Cx14')%0A assert datautils.unpack_varint(smallbuff) == 20%0A assert datautils.unpack_varint... | |
ce34c78c627addb20199a79f375073102050d9a8 | fix following Barry's resolution of PETSc issue #139 | c/ch5/plotTS.py | c/ch5/plotTS.py | #!/usr/bin/env python
help =\
'''
Plot trajectory, or frames if solution has two spatial dimensions, generated by
running a PETSc TS program. Reads output from
-ts_monitor binary:TDATA -ts_monitor_solution binary:UDATA
Requires access to bin/PetscBinaryIO.py and bin/petsc_conf.py, e.g. sym-links.
'''
import Petsc... | Python | 0 | @@ -1725,119 +1725,94 @@
0)%0A%0A
-tfile = open(args.tfile,'r')%0At = np.fromfile(tfile, dtype='%3Ed')%0Atfile.close()%0A%0Aio = PetscBinaryIO.PetscBinaryIO
+io = PetscBinaryIO.PetscBinaryIO()%0At = np.array(io.readBinaryFile(args.tfile)).flatten
()%0AU
|
5e3f99093dfe7392fcbbc0b39582e4b0d3a64511 | Update DLA | models/dla.py | models/dla.py | '''DLA in PyTorch.
Reference:
Deep Layer Aggregation. https://arxiv.org/abs/1707.06484
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_planes, planes, stride=1):
super(BasicBlock, self).__init__()
sel... | Python | 0.000001 | @@ -1771,16 +1771,43 @@
= level%0A
+ if level == 1:%0A
@@ -1827,17 +1827,9 @@
oot(
-(level+1)
+2
*out
@@ -1853,39 +1853,16 @@
annels)%0A
- if level == 1:%0A
@@ -2018,16 +2018,83 @@
else:%0A
+ self.root = Root((level+2)*out_channels, out_channels)%0A
@@ -... |
71cdeb48fd0924680a74261fc59950f3b9878426 | Fix try job status PRESUBMIT check when an issue is private. | PRESUBMIT.py | PRESUBMIT.py | #!/usr/bin/python
# Copyright (c) 2009 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.
"""Top-level presubmit script for Chromium.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for details on... | Python | 0.000007 | @@ -3568,24 +3568,126 @@
ion.close()%0A
+ if not values:%0A # It returned an empty list. Probably a private review.%0A return outputs%0A
# Reform
|
4e887718e44453f0f0cd65addc0284668b31bbd2 | Disable session cache | src/clarityv2/conf/production.py | src/clarityv2/conf/production.py | from .base import *
import raven
#
# Standard Django settings.
#
DEBUG = False
ENVIRONMENT = 'production'
ADMINS = (
'Alex', 'khomenkodev17@gmail.com'
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('DB_NAME'),
'USER': os.getenv('DB_USER'),
... | Python | 0.000001 | @@ -686,16 +686,18 @@
.0.0'%5D%0A%0A
+#
# Redis
@@ -711,16 +711,18 @@
ackend%0A#
+ #
NOTE: I
@@ -788,16 +788,18 @@
end or%0A#
+ #
cached
@@ -839,16 +839,18 @@
ackend.%0A
+#
CACHES =
@@ -852,20 +852,22 @@
HES = %7B%0A
+#
+
%22default
@@ -867,24 +867,26 @@
default%22: %7B%0A
+#
%22BAC
@@... |
ca885203ab82026ca21a200c1bee5ad3c0a82cb5 | Change default interval | src/cmsplugin_carousel/models.py | src/cmsplugin_carousel/models.py | from adminsortable.models import SortableMixin
from cms.models import CMSPlugin
from cms.models.fields import PageField
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filer.fields.image import FilerImageField
class CarouselPlugin(CMSPlugin):
interval = models.PositiveInt... | Python | 0.000001 | @@ -350,9 +350,9 @@
ult=
-1
+5
)%0A
|
401b442aef25d17dafb46f6d3ecd96a7ed1b1e13 | Add back doctest, with execution suppressed | itertoolz/core.py | itertoolz/core.py | import itertools
identity = lambda x: x
def remove(predicate, coll):
""" Return those items of collection for which predicate(item) is true.
>>> from itertoolz import remove
>>> def even(x):
... return x % 2 == 0
>>> remove(even, [1, 2, 3, 4])
[1, 3]
"""
return filter(lambda x: ... | Python | 0.000001 | @@ -4108,16 +4108,131 @@
e in seq
+%0A%0A %3E%3E%3E frequencies(%5B'cat', 'cat', 'ox', 'pig', 'pig', 'cat'%5D) #doctest: +SKIP%0A %7B'cat': 3, 'ox': 1, 'pig': 2%7D
%0A %22%22%22
|
4ce4938a03bcd71c3eb545d8caa9798d50bd99e5 | fix bug when deal with 'in_app' format | itunesiap/core.py | itunesiap/core.py |
import json
import requests
import contextlib
from six import u
from . import exceptions
RECEIPT_PRODUCTION_VALIDATION_URL = "https://buy.itunes.apple.com/verifyReceipt"
RECEIPT_SANDBOX_VALIDATION_URL = "https://sandbox.itunes.apple.com/verifyReceipt"
USE_PRODUCTION = True
USE_SANDBOX = False
def config_from_mode(... | Python | 0.000001 | @@ -2931,16 +2931,27 @@
ipt_data
+%5B'receipt'%5D
.get('in
@@ -3022,16 +3022,27 @@
ipt_data
+%5B'receipt'%5D
.update(
|
25508fef8d2632835bf29e22a39ef1d70b615f62 | make PooledConnection more robust to other kinds of exceptions | connection.py | connection.py | import threading
from Queue import Queue
from thrift import Thrift
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.protocol import TBinaryProtocol
from cassandra import Cassandra
__all__ = ['connect', 'connect_thread_local', 'connect_pooled']
DEFAULT_SERVER = 'localhost:9160'... | Python | 0 | @@ -2040,18 +2040,19 @@
ret
- =
+urn
getattr
@@ -2087,95 +2087,8 @@
gs)%0A
- self.queue.put((server, client, transport))%0A return ret%0A
@@ -2239,39 +2239,35 @@
-self.queue.put((server,
+client, transport =
None, N
@@ -2269,18 +2269,16 @@
ne, None
-))
%0A ... |
d8077e7de68d2059ba338b650cfd1904686af754 | fix problem in thread-local connections where it was reconnecting every function call | connection.py | connection.py | from exceptions import Exception
import threading
from Queue import Queue
from thrift import Thrift
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.protocol import TBinaryProtocol
from cassandra import Cassandra
__all__ = ['connect', 'connect_thread_local', 'NoServerAvailable'... | Python | 0.000001 | @@ -3665,16 +3665,17 @@
tr(self.
+_
local, '
|
ade18daea0046d4366e29a8000713c16edcde2c3 | Replace generate_timeseries method by a more general generate method in ChartController | chartflo/factory.py | chartflo/factory.py | # -*- coding: utf-8 -*-
import pandas as pd
from altair import Chart, X, Y
from blessings import Terminal
from .models import Chart as ChartFlo
COLOR = Terminal()
OK = "[" + COLOR.bold_green("ok") + "] "
class ChartController():
"""
Charts builder: handles serialization into Vega Lite format
"""
d... | Python | 0.000004 | @@ -2125,32 +2125,60 @@
ype, time_unit)%0A
+ print(%22COL%22, color)%0A
if chart
@@ -3098,27 +3098,16 @@
generate
-_timeseries
(self, s
@@ -3124,30 +3124,38 @@
chart_type,
-%0A
+ query, x, y,%0A
@@ -3163,53 +3163,51 @@
- query, x, y, width, height,%0A
+width... |
a6b084f3888f26aa025634b436f4573c8ffcf177 | Change is_active to is_public, reflecting updated usage | mixmind/models.py | mixmind/models.py | # -*- coding: utf-8 -*-
from sqlalchemy.orm import relationship, backref
from sqlalchemy import Boolean, DateTime, Column, Integer, String, ForeignKey, Enum, Float, Text, Unicode
import pendulum
from flask_security import UserMixin, RoleMixin
from . import db
from .util import VALID_UNITS
class RolesUsers(db.Model)... | Python | 0 | @@ -3826,22 +3826,22 @@
%0A is_
-active
+public
= Colum
@@ -3857,30 +3857,59 @@
(), default=
-False)
+True) # visible to public customers
%0A is_defa
|
4d2c37fc9f5e73996226888e4e1ffe9b8ca1f190 | Fix wrong func call | tc-coalesce/listener.py | tc-coalesce/listener.py | import traceback
import sys
import os
import json
import socket
import logging
import redis
import signal
from urlparse import urlparse
from stats import Stats
from coalescer import CoalescingMachine
from mozillapulse.config import PulseConfiguration
from mozillapulse.consumers import GenericConsumer
class StateErr... | Python | 0.998929 | @@ -5111,25 +5111,28 @@
elf.
-_add_task_callbac
+coalescer.insert_tas
k(ta
@@ -5235,38 +5235,38 @@
self.coalescer.
-insert
+remove
_task(taskId, co
|
64e3f7c56d8c395aebf5bc15fb03264fb9b390bb | Update Admin.py | Plugins/Admin.py | Plugins/Admin.py | import discord
from discord.ext import commands
import random
import asyncio
import Dependencies
from datetime import datetime
class Admin():
def __init__(self, bot):
self.bot = bot
# strike command
@commands.has_role("Mods")
@commands.command(pass_context=True)
async ... | Python | 0.000001 | @@ -1187,25 +1187,14 @@
ike
-on the %7B0%7D server
+in %7B0%7D
. %5Cn
|
8bcd0063ce0ede395172409c5bcbe778a54cf92c | Fix bug in api related to querying mapobject types | tmaps/mapobject/api.py | tmaps/mapobject/api.py | import os.path as p
import json
from flask.ext.jwt import jwt_required
from flask.ext.jwt import current_identity
from flask.ext.jwt import jwt_required
from flask import jsonify, request
from sqlalchemy.sql import text
from tmaps.api import api
from tmaps.extensions import db
from tmaps.mapobject import MapobjectOu... | Python | 0 | @@ -2070,16 +2070,37 @@
ect_name
+, experiment_id=ex.id
).one()%0A
|
f96f3f6ac5ca5f9301c2c463b0a3f4f710187f21 | Use utf-8 | constantes.py | constantes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import requests
def get_profs():
r = requests.get("http://www.heb.be/esi/personnel_fr.htm")
soup = BeautifulSoup(r.text)
soup = soup.findAll('ul')[2]
profs = {}
for line in soup:
line = str(line)
... | Python | 0 | @@ -1860,9 +1860,8 @@
Fr%C3%A9d
-%5C
%C3%A9ric
|
ea7f7338773c5e4f2f538740d850990b1107e94e | Remove some debug code. | console.py | console.py | """
@copyright: 2013 Single D Software - All Rights Reserved
@summary: Provides a console API for Light Maestro.
"""
# Standard library imports
import collections
import json
import logging
import os
import re
import threading
import time
# Named logger for this module
_logger = logging.getLogger(__name__)
# Maxi... | Python | 0.000003 | @@ -3389,66 +3389,8 @@
els)
-%0A _logger.debug(list(self._channels.values())%5B:16%5D)
%0A%0A
|
0726bc2cabd98639214e2cd14c49d30262e75d5e | Streamline setup of deCONZ button platform (#70593) | homeassistant/components/deconz/button.py | homeassistant/components/deconz/button.py | """Support for deCONZ buttons."""
from __future__ import annotations
from dataclasses import dataclass
from pydeconz.models.scene import Scene as PydeconzScene
from homeassistant.components.button import (
DOMAIN,
ButtonEntity,
ButtonEntityDescription,
)
from homeassistant.config_entries import ConfigEn... | Python | 0 | @@ -99,16 +99,60 @@
aclass%0A%0A
+from pydeconz.models.event import EventType%0A
from pyd
@@ -420,78 +420,8 @@
ack%0A
-from homeassistant.helpers.dispatcher import async_dispatcher_connect%0A
from
@@ -1572,49 +1572,35 @@
ene(
-scenes: list%5BPydeconzScene%5D %7C None = None
+_: EventType, scene_id: str
) -%3E
@@ ... |
afdc58945c710f623714e6b07c593489c0cd42be | Implement basic list command | src/xii/builtin/commands/list/list.py | src/xii/builtin/commands/list/list.py | from xii import definition, command, error
from xii.need import NeedLibvirt, NeedSSH
class ListCommand(command.Command):
"""List all currently defined components
"""
name = ['list', 'ls']
help = "list all currently defined components"
@classmethod
def argument_parser(cls):
parser = co... | Python | 0.999947 | @@ -1,16 +1,33 @@
+import datetime%0A%0A
from xii import
@@ -1003,28 +1003,933 @@
def
-run(self):%0A pass
+_get_uptime(self, time):%0A now = datetime.datetime.now()%0A delta = now - datetime.datetime.fromtimestamp(time)%0A%0A if delta.days %3E 1:%0A return %22%7B%7D days%22.f... |
095ec4c38015f1b1b53cb88ae59fbf6a7596b492 | update VAF | mnist/training.py | mnist/training.py | # Copyright 2017 Max W. Y. Lam
#
# 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, so... | Python | 0 | @@ -888,16 +888,28 @@
ort six%0A
+import gzip%0A
from six
|
393d3d0382eb5208a039347b851597986a6469fe | Make output default | srttools/core/inspect_observations.py | srttools/core/inspect_observations.py | """From a given list of directories, read the relevant information and link observations to calibrators."""
from __future__ import (absolute_import, division,
print_function)
import os
import glob
import warnings
import numpy as np
from astropy.table import Table, Column
from .io import read_da... | Python | 0.000147 | @@ -5503,274 +5503,8 @@
%22+%22)
-%0A parser.add_argument(%22-s%22, %22--split-by-source%22, default=False,%0A action='store_true',%0A help=('Split output so that it contains a list of observations '%0A 'and calibrators for each source'))
%... |
7a8aa79f191ed633babc1134238017c164b306f3 | Add optional rtsp_port for Foscam (#22786) | homeassistant/components/foscam/camera.py | homeassistant/components/foscam/camera.py | """
This component provides basic support for Foscam IP cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.foscam/
"""
import logging
import voluptuous as vol
from homeassistant.components.camera import (
Camera, PLATFORM_SCHEMA, SUPPOR... | Python | 0 | @@ -562,16 +562,45 @@
P = 'ip'
+%0ACONF_RTSP_PORT = 'rtsp_port'
%0A%0ADEFAUL
@@ -958,16 +958,58 @@
v.port,%0A
+ vol.Optional(CONF_RTSP_PORT): cv.port%0A
%7D)%0A%0A%0Adef
@@ -1830,21 +1830,84 @@
_port =
-None%0A
+device_info.get(CONF_RTSP_PORT)%0A if not self._rtsp_port:%0A
@@ -1962,32 +196... |
43a39b03469bf6d99ea61ef505170fb9fc1437f1 | fix flakes | temba/channels/tasks.py | temba/channels/tasks.py | from __future__ import unicode_literals
import requests
import logging
import time
from datetime import timedelta
from django.conf import settings
from django.utils import timezone
from djcelery_transactions import task
from enum import Enum
from redis_cache import get_redis_connection
from temba.msgs.models import S... | Python | 0.000001 | @@ -1428,16 +1428,25 @@
d' %25 msg
+_tasks%5B0%5D
.contact
@@ -1913,9 +1913,11 @@
if i
-+
+ +
1 %3C
|
ec23d68af3cacefe39fd9e9f21f4cdfebe8f02e5 | update mime type when sending email | contact.py | contact.py | from __future__ import (
absolute_import,
print_function,
)
from collections import defaultdict
from flask import render_template
import json
import requests
from subprocess import (
Popen,
PIPE,
)
from config import (
DOMAIN_NAME,
TELSTRA_CONSUMER_KEY,
TELSTRA_CONSUMER_SECRET,
YO_API_... | Python | 0.000001 | @@ -98,16 +98,100 @@
ultdict%0A
+from email.mime.multipart import MIMEMultipart%0Afrom email.mime.text import MIMEText%0A
from fla
@@ -1318,29 +1318,59 @@
-email_body =
+msg = MIMEMultipart('alternative')%0A msg%5B
'Subject
: A
@@ -1365,18 +1365,22 @@
'Subject
-:
+'%5D = '
A spot h
@@ -1407,43 +1407,2... |
85537e3f8557a76b8b2ad89edc41848c29622c24 | Update the paint tool shape with the viewer image changes | skimage/viewer/plugins/labelplugin.py | skimage/viewer/plugins/labelplugin.py | import numpy as np
from .base import Plugin
from ..widgets import ComboBox, Slider
from ..canvastools import PaintTool
__all__ = ['LabelPainter']
rad2deg = 180 / np.pi
class LabelPainter(Plugin):
name = 'LabelPainter'
def __init__(self, max_radius=20, **kwargs):
super(LabelPainter, self).__init_... | Python | 0 | @@ -1391,16 +1391,141 @@
_tool)%0A%0A
+ def _on_new_image(self, image):%0A %22%22%22Update plugin for new images.%22%22%22%0A self.paint_tool.shape = image.shape%0A%0A
def
|
dc53a39b0ffcaf8da10b99df5161aa1d539f27c2 | Fix available property in the base supervisor entity (#69966) | homeassistant/components/hassio/entity.py | homeassistant/components/hassio/entity.py | """Base for Hass.io entities."""
from __future__ import annotations
from typing import Any
from homeassistant.const import ATTR_NAME
from homeassistant.helpers.entity import DeviceInfo, EntityDescription
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import DOMAIN, HassioDataUpdateCoor... | Python | 0 | @@ -3200,34 +3200,42 @@
and DATA_KEY_
-O
S
+UPERVISOR
in self.coordin
|
8a6b100e671b4f22dee6b0399eb8a4bc8bf1a97e | update longdesc string | mriqc/info.py | mriqc/info.py | #!/usr/bin/env python
# -*- 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:
"""
MRIQC
"""
__versionbase__ = '0.8.6'
__versionrev__ = 'a4'
__version__ = __versionbase__ + __versionrev__
__author__ = 'Oscar Esteban'
__email__ = 'code@osc... | Python | 0.000004 | @@ -649,16 +649,17 @@
__ = %22%22%22
+%5C
%0AMRIQC p
@@ -739,16 +739,18 @@
eries of
+ %5C
%0ANR (no-
@@ -828,16 +828,18 @@
sessment
+ %5C
%0Aprotoco
@@ -966,16 +966,18 @@
t of the
+ %5C
%0AMRI ima
@@ -1058,16 +1058,18 @@
derives
+ %5C
%0Afrom, a
@@ -1221,16 +1221,18 @@
is also
+ %5C
%0Aschedul
|
fb2c9469f6d026e77e0f8c20a12f4373e68f9ba2 | update dependency xgboost to v1 (#543) | training/xgboost/structured/base/setup.py | training/xgboost/structured/base/setup.py | #!/usr/bin/env python
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Python | 0 | @@ -1171,12 +1171,13 @@
st==
-0.81
+1.5.0
',%0A
|
9aff0b8d5989bf11242ac30b718c23242631668e | call enable in RataryEncoder.__init__, fixed a few typos | libraries/RotaryEncoder/rotary_encoder.py | libraries/RotaryEncoder/rotary_encoder.py |
import os
from bbio.platform import sysfs
from bbio import addToCleanup, cape_manager, OCP_PATH, delay
class RotaryEncoder(object):
_eqep_dirs = [
'%s/48300000.epwmss/48300180.eqep' % OCP_PATH,
'%s/48302000.epwmss/48302180.eqep' % OCP_PATH,
'%s/48304000.epwmss/48304180.eqep' % OCP_PATH
]
... | Python | 0.995994 | @@ -893,16 +893,35 @@
p_num%5D%0D%0A
+ self.enable()%0D%0A
addT
@@ -971,10 +971,8 @@
self
-,m
):%0D%0A
@@ -1266,39 +1266,40 @@
e%0D%0A '''%0D%0A
-set_mod
+mode_fil
e = %22%25s/mode%22 %25
@@ -1347,23 +1347,24 @@
enameIO(
-set_mod
+mode_fil
e, 0)%0D%0A
@@ -1446,15 +1446,16 @@
-set_mod
+mode... |
06a1b635b02e001e798fa57e70a56ad17f9df7d0 | fix country cleanup migrate script 5 | portality/migrate/p1p2/country_cleanup.py | portality/migrate/p1p2/country_cleanup.py | import sys
from datetime import datetime
from portality import models
from portality import xwalk
def main(argv=sys.argv):
start = datetime.now()
journal_iterator = models.Journal.all_in_doaj()
counter = 0
for j in journal_iterator:
counter += 1
oldcountry = j.bibjson().count... | Python | 0.000001 | @@ -463,18 +463,18 @@
).title.
-d
e
+n
code('ut
@@ -613,34 +613,34 @@
y:', oldcountry.
-d
e
+n
code('utf-8'), '
@@ -670,18 +670,18 @@
country.
-d
e
+n
code('ut
|
042446c8394794255471d784e041c1d9c4ef0752 | Update example config | calplus/conf/providers.py | calplus/conf/providers.py | """Provider Configuration"""
from oslo_config import cfg
# Openstack Authenticate Configuration.
openstack_group = cfg.OptGroup('openstack1',
title='OpenStack Hosts')
openstack_opts = [
cfg.StrOpt('driver_name',
default='OpenStackHUST'),
cfg.StrOpt('type_driver',
... | Python | 0.000001 | @@ -133,17 +133,16 @@
penstack
-1
',%0A
@@ -1517,17 +1517,16 @@
('amazon
-1
',%0A
@@ -1772,33 +1772,41 @@
default='
-localhost
+AWS_ACCESS_KEY_ID
'),%0A cfg.
@@ -1853,37 +1853,53 @@
default='
-admin
+AWS_SECRET_ACCESS_KEY
'),%0A cfg.StrO
@@ -1936,33 +1936,33 @@
default='
-localhost... |
ccaca70aa28bdd3e4f2a9c6e46d76e3ff8653f88 | Fix public page hashids issue | crestify/views/public.py | crestify/views/public.py | from crestify import app, hashids
from crestify.models import Bookmark
from flask import render_template
@app.route('/public/<string:bookmark_id>', methods=['GET'])
def bookmark_public(bookmark_id):
bookmark_id = hashids.decode(bookmark_id)[0]
query = Bookmark.query.get(bookmark_id)
return render_template... | Python | 0 | @@ -227,16 +227,20 @@
.decode(
+str(
bookmark
@@ -243,16 +243,17 @@
mark_id)
+)
%5B0%5D%0A
|
3b1418902183ed276400a3d52899394bde59130f | Make rfxtrx sensor not crash when unknown sensor is discovered | homeassistant/components/sensor/rfxtrx.py | homeassistant/components/sensor/rfxtrx.py | """
Support for RFXtrx sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.rfxtrx/
"""
import logging
import voluptuous as vol
import homeassistant.components.rfxtrx as rfxtrx
import homeassistant.helpers.config_validation as cv
from homeassi... | Python | 0 | @@ -1459,16 +1459,50 @@
) == 0:%0A
+ data_type = %22Unknown%22%0A
|
3bcc66a91a4c2c2dc51824ea2ba228db3c0d5c8e | Add 'info' command for actors | calvin/Tools/cscontrol.py | calvin/Tools/cscontrol.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 r... | Python | 0.000093 | @@ -2376,24 +2376,185 @@
%22/actors%22)%0A
+ if args.cmd == 'info':%0A if not args.id:%0A raise Exception(%22No actor id given%22)%0A return requests.get(args.node + %22/actor/%22 + args.id)%0A
elif arg
@@ -5173,32 +5173,40 @@
tor_commands = %5B
+'info',
'list', 'delete'
|
bfdf4bffdb30e6f9651c96afb711d2a871b9ff87 | fix output to shell | create_recipes.py | create_recipes.py | import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("package_list", help="List of packages for which" +
" recipies will be created")
args = parser.parse_args()
package_names = [package.strip() for package in
open(args.package_list, 'r').readlin... | Python | 0.000023 | @@ -540,39 +540,8 @@
ge)%0A
- recipe_log_file.write(msg)%0A
@@ -776,43 +776,180 @@
-successes.append(package)%0A else:
+msg = %22Succesfully created conda recipe for %25s%5Cn%22 %25 (package)%0A successes.append(package)%0A else:%0A msg = %22Failed to create conda recipe for %25s%5Cn... |
21000dfd4bf63ceae0e8c6ac343624fbf5c5bea2 | read tags before people | cat/test_cat.py | cat/test_cat.py | from cat.code import GenerateSite
import unittest
import json
import os
import sys
def read_json(file):
with open(file) as fh:
return json.loads(fh.read())
#return fh.read()
class TestDemo(unittest.TestCase):
def test_generate(self):
GenerateSite().generate_site()
assert True
... | Python | 0 | @@ -1631,32 +1631,55 @@
GenerateSite()%0A
+ gs.read_tags()%0A
gs.read_
|
b220af1b5219c59735bd1f35493b0a659c627738 | Fix cookie handling for tornado | social/strategies/tornado_strategy.py | social/strategies/tornado_strategy.py | import json
from tornado.template import Loader, Template
from social.utils import build_absolute_uri
from social.strategies.base import BaseStrategy, BaseTemplateStrategy
class TornadoTemplateStrategy(BaseTemplateStrategy):
def render_template(self, tpl, context):
path, tpl = tpl.rsplit('/', 1)
... | Python | 0.000001 | @@ -1320,38 +1320,39 @@
=None):%0A
-return
+value =
self.request_ha
@@ -1384,11 +1384,87 @@
ame)
- or
+%0A if value:%0A return json.loads(value.decode())%0A return
def
@@ -1566,17 +1566,33 @@
me,
-str(value
+json.dumps(value).encode(
))%0A%0A
@@ -1649,41 +1649,19 @@
elf.
-requ... |
c5db8af5faca762e574a5b3b6117a0253e59cd05 | use new urls module | couchexport/urls.py | couchexport/urls.py | from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^model/$', 'couchexport.views.export_data', name='model_download_excel'),
url(r'^async/$', 'couchexport.views.export_data_async', name='export_data_async'),
url(r'^saved/(?P<export_id>[\w-]+)/$', 'couchexport.views.download_saved_expo... | Python | 0.000001 | @@ -18,17 +18,8 @@
urls
-.defaults
imp
|
b68da6c5b64009dbd2d53206be4c8d98ed1b0a45 | Add print option to exercise_oaipmh.py | librisxl-tools/scripts/exercise_oaipmh.py | librisxl-tools/scripts/exercise_oaipmh.py | import requests
from lxml import etree
import time
PMH = "{http://www.openarchives.org/OAI/2.0/}"
def parse_oaipmh(start_url, name, passwd):
start_time = time.time()
resumption_token = None
record_count = 0
while True:
url = make_next_url(start_url, resumption_token)
res = requests.ge... | Python | 0.000005 | @@ -32,16 +32,46 @@
t etree%0A
+from StringIO import StringIO%0A
import t
@@ -164,16 +164,32 @@
, passwd
+, do_print=False
):%0A s
@@ -414,16 +414,173 @@
t=3600)%0A
+ if do_print:%0A data = res.raw.read()%0A print data%0A source = StringIO(data)%0A else:%0A ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.