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 |
|---|---|---|---|---|---|---|---|
f834e728e2635c91f95bd234c9dd2ffca7699ee0 | fix flake8 | dvc/progress.py | dvc/progress.py | """Manages progress bars for dvc repo."""
from __future__ import print_function
import logging
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor
class TqdmThreadPoolExecutor(ThreadPoolExecutor):
"""
Ensure worker progressbars are cleared away properly.
"""
def __enter__(self):
... | Python | 0 | @@ -401,19 +401,16 @@
e forced
- to
%0A
@@ -410,16 +410,19 @@
+to
create %22
|
426972e55f155d817e1db975afa2f25dbf860445 | disable super progress bar for single-files | dvc/repo/add.py | dvc/repo/add.py | import logging
import os
import colorama
from . import locked
from dvc.exceptions import RecursiveAddingWhileUsingFilename
from dvc.progress import Tqdm
from dvc.repo.scm_context import scm_context
from dvc.stage import Stage
from dvc.utils import LARGE_DIR_SIZE
logger = logging.getLogger(__name__)
@locked
@scm_co... | Python | 0 | @@ -551,16 +551,47 @@
st = %5B%5D%0A
+ num_targets = len(targets)%0A
with
@@ -600,27 +600,43 @@
qdm(
+%0A
total=
-len(
+num_
targets
-)
,
+%0A
des
@@ -643,16 +643,24 @@
c=%22Add%22,
+%0A
unit=%22f
@@ -664,16 +664,24 @@
=%22file%22,
+%0A
leave=T
@@ -683,16 +683,73 @@
av... |
357516f14b2d04b23fe54d30fb00b09acfe25458 | Add test case: symlink source exists but is regular file. | scripts/test_dotfiles.py | scripts/test_dotfiles.py | #!/usr/bin/python
import unittest
import mock
import dotfiles
import platform
import sys
import os
import io
import time
class MockFile(io.StringIO):
name = None
def __init__(self, name, buffer_ = None):
super(MockFile, self).__init__(buffer_)
self.name = name
class DotfilesTest(unittest.TestCase):
de... | Python | 0 | @@ -432,16 +432,64 @@
= 'bar'%0A
+ self.regularFile = dotfiles.homeDir + 'foo'%0A
self
@@ -1029,24 +1029,192 @@
tedSymlink)%0A
+ if os.path.isfile(self.regularFile):%0A os.remove(self.regularFile)%0A if os.path.isfile(self.regularFile + '.bak'):%0A os.remove(self.regularFile + '.bak')%0A
... |
7921c5ceb9cd9fe698254288d5d1a49480917956 | Use numpy arrays for list return values | engine/run_c.py | engine/run_c.py | import os
import ctypes
import pickle
import subprocess
from numpy import ndarray, zeros
from numpy.ctypeslib import ndpointer
def infer_simple_ctype(var):
if isinstance(var, int):
return ctypes.c_int
elif isinstance(var, float):
return ctypes.c_double
elif isinstance(var, bool):
... | Python | 0.000004 | @@ -67,16 +67,23 @@
y import
+ array,
ndarray
@@ -2617,32 +2617,59 @@
s: var=%7Bvar%7D%22)%0A%0A
+ arr = array(rvar)%0A%0A
arr_ctyp
@@ -2676,46 +2676,55 @@
e =
+ndpo
in
-fer_simple_ctype(rvar%5B0%5D) * len(rvar
+ter(dtype=arr.dtype, flags=%22C_CONTIGUOUS%22
)%0A
@@ -2763,34 +2763,8 @@
e)%0A%0... |
48f5d906bb72543a844d9ccf33e5c1488ba3e154 | make newebe install line cleaner | deploy/fabfile.py | deploy/fabfile.py | from fabric.api import sudo, cd, task, prompt, run
from fabric.contrib import files
from fabtools import require, python, supervisor
# Variables
newebe_dir = "/home/newebe/newebe"
newebe_process = newebe_user = "newebe"
newebe_user_dir = "/home/newebe/"
python_exe = newebe_dir + "/virtualenv/bin/python"
newebe_exe = "... | Python | 0 | @@ -42,13 +42,8 @@
ompt
-, run
%0Afro
@@ -3871,26 +3871,24 @@
-sudo(%22pip
+python.
install
-
+(%22
git+
|
0aae504d88bc0948dcf8eb4256c39e38301b089d | Version bump to 0.4.1 | overextends/__init__.py | overextends/__init__.py |
__version__ = "0.4.0"
| Python | 0 | @@ -13,11 +13,11 @@
= %220.4.
-0
+1
%22%0A
|
e6c072aedfebfeacfe98ccf03385b90335e74f00 | improve tests | testing/testSamplingAndPlotting.py | testing/testSamplingAndPlotting.py | import pandas as pd
import numpy as np
import pickle
from matplotlib import pyplot as plt
import GPflow
from BranchedGP import VBHelperFunctions as bplot
from BranchedGP import BranchingTree as bt
from BranchedGP import branch_kernParamGPflow as bk
import unittest
from BranchedGP import FitBranchingModel
class TestSam... | Python | 0.000016 | @@ -700,9 +700,9 @@
1,
-4
+6
0)%0A
@@ -2705,18 +2705,18 @@
0.80, M=
-15
+20
, fixInd
|
cf92a9fc30220a8b877b8d333dbbf81ef93fdb9d | Add new keys. | app/models/__init__.py | app/models/__init__.py | # Copyright (C) 2014 Linaro Ltd.
#
# 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 version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | Python | 0.000038 | @@ -1305,16 +1305,44 @@
errors'%0A
+BUILD_LOG_KEY = 'build_log'%0A
BUILD_PL
@@ -2523,16 +2523,48 @@
tadata'%0A
+MODULES_DIR_KEY = 'modules_dir'%0A
MODULES_
|
5f3e659d2346e10138fb75b01239396b04ceec3f | Allow runserver to be executed from anywhere | contentdensity/contentdensity/settings.py | contentdensity/contentdensity/settings.py | """
Django settings for contentdensity project.
Generated by 'django-admin startproject' using Django 1.11.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
im... | Python | 0 | @@ -1703,11 +1703,32 @@
': %5B
-'./
+os.path.join(BASE_DIR, '
temp
@@ -1733,16 +1733,17 @@
mplates'
+)
,%5D,%0A
|
50b327fe1ab9ae4476d1fc203739cc38d5f578a3 | fix unittest unneeded sleeps | tests/PyroTests/test_threadpool.py | tests/PyroTests/test_threadpool.py | """
Tests for the thread pool.
Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net).
"""
from __future__ import print_function
import time
import random
import unittest
from Pyro4.socketserver.threadpool import Pool, PoolError, NoFreeWorkersError
from Pyro4.socketserver.threadpoo... | Python | 0.000002 | @@ -4190,39 +4190,8 @@
k)%0D%0A
- time.sleep(0.1) # XXX%0D%0A
@@ -4258,39 +4258,8 @@
k)%0D%0A
- time.sleep(0.1) # XXX%0D%0A
|
5389bd7b53e1ca2186c7bde06ffdf1c84ef6fd54 | Add put_device method | devicehive/api.py | devicehive/api.py | from devicehive.api_unit import Info
from devicehive.api_unit import Token
from devicehive.api_unit import Device
class Api(object):
"""Api class."""
def __init__(self, transport, authentication):
self._transport = transport
self._token = Token(transport, authentication)
def authenticate... | Python | 0.000006 | @@ -2532,16 +2532,18 @@
evice.id
+()
:%0A
@@ -2558,12 +2558,345 @@
turn device%0A
+%0A def put_device(self, device_id, name=None, data=None, network_id=None,%0A is_blocked=False):%0A if not name:%0A name = device_id%0A device = Device(self._transport, self._token, ... |
18e3187c2f65486fcb5456504cbfe48242c72b20 | Replace == None with is None | send2trash/plat_other.py | send2trash/plat_other.py | # Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
# This is a reimplementation of plat_ot... | Python | 1 | @@ -1591,26 +1591,26 @@
if topdir
-==
+is
None or not
@@ -3953,18 +3953,18 @@
ash_dir
-==
+is
None:%0A
|
0bc2a8ddae824a74ce443ffc120e3152641842d6 | Added a filter method to dicts | app/soc/logic/dicts.py | app/soc/logic/dicts.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Python | 0.999999 | @@ -2901,28 +2901,1324 @@
y%5D = value%0A%0A return result%0A
+%0A%0Adef split(target):%0A %22%22%22Takes a dictionary and splits it into single-valued dicts%0A%0A If there are any values in target that are a list it is split up%0A into a new dictionary instead.%0A%0A %3E%3E%3E split(%7B%7D)%0A %5B%7B%7D%5D%0A ... |
6d7dcf2d44c1de9c51f94c96305afbb2bde2bce2 | Revert "Patch eventlet in the runner to try and avoid blocking scenarios" | sentry/scripts/runner.py | sentry/scripts/runner.py | #!/usr/bin/env python
"""
sentry.scripts.runner
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from eventlet import patcher
patcher.monkey_patch()
import base64
import datetime
import errno
import imp
import os
import os.... | Python | 0 | @@ -188,63 +188,8 @@
%22%22%22%0A
-from eventlet import patcher%0A%0Apatcher.monkey_patch()%0A%0A%0A
impo
|
5906946b0287536976f816884169e3a3c91df043 | Add a verbose_name and help_text to the User.id Property. | app/soc/models/user.py | app/soc/models/user.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | Python | 0.001817 | @@ -2046,16 +2046,155 @@
red=True
+,%0A verbose_name=ugettext_lazy('User account'))%0A id.help_text = ugettext_lazy(%0A 'Email address of a valid user (Google Account).'
)%0A%0A #:
|
2bd4a4509a1a89ef1c2648a27c0aa74017aeca41 | Read data from stdin if no path or query given | wikigenre.py | wikigenre.py | import codecs
import logging
import re
from glob import iglob
from os.path import join, dirname, normpath
from gevent import monkey
from gevent import spawn, joinall
from gevent.event import AsyncResult
monkey.patch_socket()
monkey.patch_ssl()
import requests
from lxml import html
from mutagen import easyid3, flac, e... | Python | 0.000065 | @@ -1,17 +1,42 @@
-import codecs
+from __future__ import print_function%0A
%0Aimp
@@ -57,16 +57,27 @@
port re%0A
+import sys%0A
from glo
@@ -4362,17 +4362,16 @@
print
-
(artista
@@ -4384,17 +4384,16 @@
': ' +%0A
-
@@ -4791,45 +4791,662 @@
-print 'either query or path required'
+# Read data f... |
6910bfbebcc3cde2d67b4ed131118f77776ff967 | move callbacks above disconnection | nyuki/nyuki.py | nyuki/nyuki.py | import asyncio
from jsonschema import validate, ValidationError
import logging
import logging.config
import signal
from nyuki.bus import Bus
from nyuki.capabilities import Exposer, Response, resource
from nyuki.commands import get_command_kwargs
from nyuki.config import (
get_full_config, write_conf_json, merge_co... | Python | 0 | @@ -3615,17 +3615,17 @@
f, wait=
-0
+2
):%0A
@@ -3799,48 +3799,8 @@
n()%0A
- self._bus.disconnect(wait=wait)%0A
@@ -3872,16 +3872,56 @@
op.stop)
+%0A self._bus.disconnect(wait=wait)
%0A%0A de
@@ -5274,43 +5274,8 @@
es:%0A
- self._bus.disconnect()%0A
@@ -5341,16 +5341,5... |
b717696b5cff69e3586e06c399be7d06c057e503 | Make spawn_n() stub properly ignore errors in the child thread work | nova/tests/fake_utils.py | nova/tests/fake_utils.py | # Copyright (c) 2013 Rackspace Hosting
#
# 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.000006 | @@ -888,24 +888,41 @@
**kwargs):%0A
+ try:%0A
retu
@@ -945,16 +945,352 @@
*kwargs)
+%0A except Exception:%0A # NOTE(danms): This is supposed to simulate spawning%0A # of a thread, which would run separate from the parent,%0A # and die silently on error. If ... |
1f65be1f67867fc445b692df0f9390d6aa576e02 | Fix import in common/utils | manyfaced/common/utils.py | manyfaced/common/utils.py | import time
import pickle
from socket import error as socket_error
from manyfaced.common.status import CLIENT_TIMEOUT
def dump_file(data):
try:
with file('temp.db') as f:
string_file = f.read()
db = pickle.loads(string_file)
except:
db = list()
db.append(data)
with... | Python | 0.000022 | @@ -70,25 +70,8 @@
rom
-manyfaced.common.
stat
|
7ea980cf44a572d85f31b6cd63d2ba8f893592cc | Update main.py | scripts/eurotram/main.py | scripts/eurotram/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Project: Update and crop osm dump file for Europe
# Author: Artem Svetlov <artem.svetlov@nextgis.com>
import os
import config
import argparse
def argparser_prepare():
class PrettyFormatter(argparse.ArgumentDefaultsHelpFormatter,
argparse.RawDescriptionHel... | Python | 0.000001 | @@ -2253,16 +2253,21 @@
'routes
+_temp
.osm.pbf
@@ -2899,16 +2899,47 @@
em(cmd)%0A
+ os.remove(file_temp_1)%0A
%0A%0Adef im
|
8355340347f57db0796385c0700a91d61cb9b82a | Fix typos | scripts/guides_master.py | scripts/guides_master.py | KT_GUIDES_MASTER = {
'path': 'keras_tuner/',
'title': 'Hyperparameter Tuning',
'toc': True,
'children': [
{
'path': 'getting_started',
'title': 'Getting started with KerasTuner',
},
{
'path': 'distributed_tuning',
'title': 'Distribu... | Python | 0.999999 | @@ -1185,17 +1185,17 @@
new
-L
+l
ayers &
Mode
@@ -1190,17 +1190,17 @@
ayers &
-M
+m
odels vi
@@ -1866,17 +1866,17 @@
our own
-C
+c
allbacks
@@ -2242,17 +2242,17 @@
cessing
-L
+l
ayers',%0A
|
03f99a79941ade157689534e7ed0d0d196dd4d56 | fix grep command | scripts/logfetch/grep.py | scripts/logfetch/grep.py | import os
import sys
from termcolor import colored
GREP_COMMAND_FORMAT = 'xargs -n {0} {1} < {2}'
DEFAULT_GREP_COMMAND = 'grep --color=always \'{1}\''
def grep_files(args, all_logs):
if args.grep:
greplist_filename = '{0}/.greplist'.format(args.dest)
create_greplist(args, all_logs, greplist_filename)
co... | Python | 0.000609 | @@ -139,17 +139,17 @@
ways %5C'%7B
-1
+0
%7D%5C''%0A%0Ade
|
c4bbe848f2e8f972423e766a42d1959df782f623 | fix publisher for sending messages | oct/core/hq.py | oct/core/hq.py | from __future__ import print_function
import zmq
import time
import json
class HightQuarter(object):
"""The main hight quarter that will receive informations from the turrets
and send the start message
:param publish_port int: the port for publishing information to turrets
:param rc_port int: the res... | Python | 0.000001 | @@ -1053,50 +1053,16 @@
elf.
+_
publish
-er.send_multipart(%5B'hq', json.dumps
(%7B'c
@@ -1101,18 +1101,16 @@
: None%7D)
-%5D)
%0A%0A de
@@ -1482,16 +1482,169 @@
break%0A%0A
+ def _publish(self, message):%0A data = json.dumps(message)%0A self.publisher.send_multipart(%5Bbytes('hq', 'UTF-8'), ... |
3eea445a445a9154758cd82c11c52751f2804eca | add axis to 3d example | examples/tomo/xray_trafo_parallel_3d.py | examples/tomo/xray_trafo_parallel_3d.py | # Copyright 2014, 2015 The ODL development group
#
# This file is part of ODL.
#
# ODL is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | Python | 0.00002 | @@ -1841,14 +1841,8 @@
el3d
-Single
Axis
@@ -1866,16 +1866,36 @@
rtition,
+ detector_partition,
%0A
@@ -1934,32 +1934,22 @@
- detector_partition
+axis=%5B0, 1, 0%5D
)%0A%0A#
@@ -2846,9 +2846,8 @@
slice')%0A
-%0A
|
5a2b175be78e5e97fd381a84d08cdeb5796513c2 | Fix detecting cudatoolkit on win32 | numba/cuda/cuda_paths.py | numba/cuda/cuda_paths.py | import sys
import re
import os
from collections import defaultdict, namedtuple
from numba.config import IS_WIN32
from numba.findlib import find_lib, find_file
from numba.cuda.envvars import get_numbapro_envvar
_env_path_tuple = namedtuple('_env_path_tuple', ['by', 'info'])
def _find_valid_path(options):
"""Fin... | Python | 0.000001 | @@ -3423,45 +3423,86 @@
-return os.path.join(sys.prefix, 'lib'
+# Use the directory name of the max path%0A return os.path.dirname(max(paths)
)%0A%0A%0A
|
e76777897bed5b9396d126e384555ea230b35784 | Use StaticFileStorage to determine source directories | sass_processor/apps.py | sass_processor/apps.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.apps import apps, AppConfig
APPS_INCLUDE_DIRS = []
class SassProcessorConfig(AppConfig):
name = 'sass_processor'
verbose_name = "Sass Processor"
_static_dir = 'static'
_sass_exts = ('.scss', '.sass')
def ready... | Python | 0.000001 | @@ -108,16 +108,105 @@
pConfig%0A
+from django.conf import settings%0Afrom django.core.files.storage import get_storage_class%0A
%0A%0AAPPS_I
@@ -329,35 +329,8 @@
or%22%0A
- _static_dir = 'static'%0A
@@ -360,16 +360,93 @@
'.sass')
+%0A _storage = get_storage_class(import_path=settings.STATICFILES_STORAG... |
25f12dacbd2d447ee2340aa0e18da4569bcc319e | disable libunwind on windows | scripts/pipeline_main.py | scripts/pipeline_main.py | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law ... | Python | 0 | @@ -2098,34 +2098,24 @@
bcxxabi;lld;
-libunwind;
mlir;polly;f
|
49b102159e47f0865f5a8790d341987b664cadf0 | Add CLI test | numba/tests/test_help.py | numba/tests/test_help.py | from __future__ import print_function
import types as pytypes
import numpy as np
from numba.six.moves import builtins
from numba import types
from .support import TestCase
from numba.help.inspector import inspect_function, inspect_module
class TestInspector(TestCase):
def check_function_descriptor(self, info, ... | Python | 0 | @@ -32,16 +32,45 @@
nction%0A%0A
+import sys%0Aimport subprocess%0A
import t
@@ -84,16 +84,31 @@
pytypes
+%0Aimport os.path
%0A%0Aimport
@@ -211,16 +211,32 @@
TestCase
+, temp_directory
%0Afrom nu
@@ -2101,12 +2101,1084 @@
eater(c, 0)%0A
+%0A def test_inspect_cli(self):%0A # Try CLI on math module%0A ... |
81622074d2d7544b897cec196257b130904f06b7 | Comment about JSON | firefox/src/py/extensionconnection.py | firefox/src/py/extensionconnection.py | # Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | Python | 0.000001 | @@ -800,28 +800,80 @@
%0A%0A#
-FIXME: What is this?
+Some old JSON libraries don't have %22dumps%22, make sure we have a good one
%0Aif
|
b667bb6b463c8049fcc67d54d02ffbba2094823f | Fix test | numba/tests/test_help.py | numba/tests/test_help.py | from __future__ import print_function
import sys
import subprocess
import types as pytypes
import os.path
import numpy as np
from numba.six.moves import builtins
from numba import types, utils
from .support import TestCase, temp_directory
from numba.help.inspector import inspect_function, inspect_module
class Test... | Python | 0.000004 | @@ -3619,19 +3619,23 @@
sertIn(%22
+%5C'
foo
+%5C'
is not
@@ -3649,13 +3649,35 @@
ed%22,
- str(
+%0A
rais
@@ -3695,11 +3695,26 @@
n.stdout
+.decode('ascii'
))%0A
|
b6b514d385e8e18d03b939cf5fae9873c9f02a21 | add constraint for price_list_ite | netforce_product/netforce_product/models/price_list_item.py | netforce_product/netforce_product/models/price_list_item.py | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | Python | 0.000005 | @@ -2190,16 +2190,158 @@
%0A %7D%0A%0A
+ _sql_constraints = %5B%0A (%22key_uniq%22, %22unique (list_id,product_id,price)%22, %22The price list, product and type must be unique!%22)%0A %5D%0A%0A
PriceLis
|
699524032f9bbcae410637f66b762fb21b92d796 | Use Crypto's pad function | CanvasSync/settings/cryptography.py | CanvasSync/settings/cryptography.py | """
CanvasSync by Mathias Perslev
February 2017
--------------------------------------------
cryptography.py, module
Functions used to encrypt and decrypt the settings stored in the .CanvasSync.settings file. When the user has specified
settings the string of information is encrypted using the AES 256 module of the ... | Python | 0.000015 | @@ -941,16 +941,52 @@
SHA256%0A
+from Crypto.Util.Padding import pad%0A
%0A%0Adef ge
@@ -1844,118 +1844,8 @@
V)%0A%0A
- # Padding to 16 bytes%0A if len(message) %25 16 != 0:%0A message += %22 %22 * (16 - (len(message) %25 16))%0A%0A
@@ -1954,24 +1954,28 @@
ter.encrypt(
+pad(
message.enco
@@ -19... |
47a83c283147a43b6b543e2305d31fae5fd15ac3 | Add docker environment variable consumption | docker/settings_import.py | docker/settings_import.py | #!/usr/bin/python
from os import getenv
import locale
from system_settings import *
# Read the DEBUG setting from env var
try:
if getenv('DOCKER_SAL_DEBUG').lower() == 'true':
DEBUG = True
else:
DEBUG = False
except:
DEBUG = False
# Read the Brute force protection setting from env var
try:... | Python | 0.000001 | @@ -3365,8 +3365,223 @@
COOLOFF%0A
+%0A%0A# Read the SSH_ACCOUNT setting from env var%0Atry:%0A if getenv('DOCKER_SAL_SSH_ACCOUNT'):%0A SSH_ACCOUNT = getenv('DOCKER_SAL_SSH_ACCOUNT')%0A else:%0A SSH_ACCOUNT = None%0Aexcept:%0A SSH_ACCOUNT = None%0A
|
577c0bff1e7333fe0f0fd5e45ce7c7cf19710605 | Fix migration [WAL-904] | nodeconductor/structure/migrations/0052_customer_subnets.py | nodeconductor/structure/migrations/0052_customer_subnets.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-07 08:52
from __future__ import unicode_literals
from django.db import migrations, models
import nodeconductor.core.validators
class Migration(migrations.Migration):
dependencies = [
('structure', '0051_add_customer_email_phone_agreement_nu... | Python | 0 | @@ -624,22 +624,29 @@
or IPv6
-subnet
+CIDR addresse
s from w
|
324c8572ae0207774a2e959b435525979ead2ebe | allow partial-dollar donations | batch.py | batch.py | from datetime import datetime, timedelta
import json
import redis
import celery
from emails import send_email
from pytz import timezone
import requests
import stripe
from salesforce import SalesforceConnection
from config import STRIPE_KEYS
from config import ACCOUNTING_MAIL_RECIPIENT
from config import TIMEZONE
from... | Python | 0.000001 | @@ -1319,18 +1319,20 @@
mount =
-in
+floa
t(entry%5B
|
f9a02492ca8f902ca349e60ce42dee4cadbd35c0 | Make run under Python 2.4. | include/HFacer.py | include/HFacer.py | # HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface
# definition file.
# The header files are copied to a temporary file apart from the section between a //++Autogenerated
# comment and a //--Autogenerated comment which is generated by the printHFile and printLexHFile
# func... | Python | 0.000001 | @@ -2249,16 +2249,17 @@
s%22, max(
+%5B
x for x
@@ -2286,16 +2286,17 @@
) %3C 3000
+%5D
)%0Aexcept
|
dea7ffe79e674315ff9b1f69f44b3c8b725697a0 | use str instead of basestring | corehq/apps/hqadmin/management/commands/make_supervisor_conf.py | corehq/apps/hqadmin/management/commands/make_supervisor_conf.py | import json
import os
import sys
from django.core.management.base import BaseCommand
from django.conf import settings
from django.template import Context, Template
def parse_params(option, opt, value, parser):
try:
args_dict = json.loads(value)
except ValueError:
print "argument error, %s sho... | Python | 0.000035 | @@ -864,18 +864,11 @@
ype=
-basestring
+str
,%0A
|
4eb7bce888aef1a7eb5501c03f63e0818c0a79ee | Disable trailing slash | kytos/core/api_server.py | kytos/core/api_server.py | """Module used to handle a API Server."""
import logging
import os
import sys
import warnings
from urllib.error import URLError
from urllib.request import urlopen
from flask import Flask, request, send_from_directory
from flask_socketio import SocketIO, join_room, leave_room
class APIServer:
"""Api server used t... | Python | 0 | @@ -1233,24 +1233,106 @@
et_rooms()%0A%0A
+ # Disable trailing slash%0A self.app.url_map.strict_slashes = False%0A%0A
def _ena
|
4ed76f0edd63c539d19a193ff42c40bb0df521ad | delete debug log with collect data in validation_strategy | federatedml/util/validation_strategy.py | federatedml/util/validation_strategy.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apac... | Python | 0 | @@ -5618,32 +5618,34 @@
se:%0D%0A
+ #
LOGGER.debug(%22t
@@ -5792,32 +5792,34 @@
%0A
+ #
LOGGER.debug(%22v
@@ -5962,24 +5962,26 @@
%0A
+ #
LOGGER.debu
|
de06d0530023b25eeeadba3fbbc7d2264dfc0f2c | clarify error message for kik creation | microbot/views/api/bot.py | microbot/views/api/bot.py | from microbot.serializers import BotSerializer, BotUpdateSerializer, TelegramBotSerializer, TelegramBotUpdateSerializer, \
KikBotSerializer, KikBotUpdateSerializer
from microbot.views.api.base import MicrobotAPIView
from microbot.models import Bot, TelegramBot, KikBot
from rest_framework.response import Response
f... | Python | 0.000001 | @@ -4491,13 +4491,28 @@
eck
-Token
+Kik username/api_key
or
|
bcee5519b650ffb8ecb8494a38f0a54bdeba3e5c | Update rules_swift to 0.8.0 | apple/repositories.bzl | apple/repositories.bzl | # Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Python | 0.000003 | @@ -676,78 +676,8 @@
%22%22%0A%0A
-load(%22@bazel_tools//tools/build_defs/repo:git.bzl%22, %22git_repository%22)%0A
load
@@ -1461,29 +1461,20 @@
%60
-native.git_repository
+http_archive
%60.)%0A
@@ -4704,22 +4704,20 @@
-git_repository
+http_archive
,%0A
@@ -4768,16 +4768,28 @@
-remote =
+urls = %5... |
cbe38648644c63dc01a02f3ba6cbcac8eec45274 | fix celerybeat | scrapy_joy/__init__.py | scrapy_joy/__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os, sys, django
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "scrapy_joy.settings")
django.setup()
##################################################
# add django-dy... | Python | 0.000128 | @@ -234,23 +234,8 @@
s%22)%0A
-django.setup()%0A
%0A%0A##
@@ -2912,12 +2912,27 @@
s celery_app
+%0Adjango.setup()
|
9c6ae84ed18cf0f289519342a26543017f4e0160 | W293 blank line contains whitespace | mido/messages/messages.py | mido/messages/messages.py | import re
from .specs import make_msgdict, SPEC_BY_TYPE, REALTIME_TYPES
from .checks import check_msgdict, check_value, check_data
from .decode import decode_message
from .encode import encode_message
from .strings import msg2str, str2msg
from ..py2 import convert_py2_bytes
class BaseMessage(object):
"""Abstract ... | Python | 0.998957 | @@ -1838,24 +1838,16 @@
name)))%0A
-
%0A
|
41b4cb48de1e6db7b2cb95e893ea5ed981d49425 | handle date object passed as argument | custom/icds_reports/management/commands/run_custom_data_pull.py | custom/icds_reports/management/commands/run_custom_data_pull.py | import os
import zipfile
from django.conf import settings
from django.core.management.base import (
BaseCommand,
CommandError,
)
from django.db import connections
from custom.icds_reports.const import CUSTOM_DATA_PULLS
class Command(BaseCommand):
help = "Dump data from a pre-defined query for ICDS data ... | Python | 0.000007 | @@ -853,16 +853,121 @@
month')%0A
+ if month:%0A # convert to string if date object received%0A month = str(month)%0A
|
b958af7f43a6aed903600336908f0898c00ab594 | fix directionality to fit with wsdl protocol | opennsa/nsa.py | opennsa/nsa.py | """
Core abstractions used in OpenNSA.
Author: Henrik Thostrup Jensen <htj@nordu.net>
Copyright: NORDUnet (2011)
"""
import urlparse
from opennsa import error
STP_PREFIX = 'urn:ogf:network:stp:'
NSA_PREFIX = 'urn:ogf:network:nsa:'
class STP: # Service Termination Point
def __init__(self, network, endpoint... | Python | 0 | @@ -3624,10 +3624,9 @@
ty='
-un
+B
idir
@@ -3925,16 +3925,85 @@
= stps%0A
+ assert directionality in ('Unidirectional', 'Bidirectional')%0A
|
eece11275f3251d1db3eb7f05eb72935a1ecb073 | add util import. (required for send_message to work) | FlotypeBridge/flotype/connection.py | FlotypeBridge/flotype/connection.py | import sys
import struct
import socket
import logging
from collections import deque
from datetime import timedelta
from tornado import ioloop, iostream
from tornado.escape import json_encode, json_decode, utf8, to_unicode
from tornado.httpclient import HTTPClient, HTTPError
class Connection(object):
def __init__... | Python | 0 | @@ -270,16 +270,42 @@
PError%0A%0A
+from flotype import util%0A%0A
%0Aclass C
|
cd02c0a262d79cfc60e15f3e8ac71121a3201aa1 | Fix permissions on bde_make_vscode.py | bin/bde_make_vscode.py | bin/bde_make_vscode.py | #!/usr/bin/env python
import os
import subprocess
import sys
# If BDE_TOOLS_DIR is not specified, try finding it via 'which' and default
# to '/bb/bde/bbshr/bde-tools'
bdeToolsDir = os.getenv("BDE_TOOLS_DIR")
if not bdeToolsDir:
try:
whichBuildEnv = subprocess.run(
["which", "bde_build_env.p... | Python | 0.000001 | |
4918392cbdee161f2263900c28fd374bc1556f2b | Fix functions in oldnumeric.mlab | numpy/oldnumeric/mlab.py | numpy/oldnumeric/mlab.py | # This module is for compatibility only. All functions are defined elsewhere.
__all__ = ['rand', 'tril', 'trapz', 'hanning', 'rot90', 'triu', 'diff', 'angle', 'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort', 'LinearAlgebra', 'RandomArray', 'prod', 'std', 'hamming', 'flipud', 'max', 'blackman', 'corrcoef... | Python | 0.999997 | @@ -887,16 +887,35 @@
, randn%0A
+import numpy as nn%0A
%0Afr
|
850c9b65b1f1d21da9ae680a94f70433f1225e55 | Fix extract method | mimesis/providers/base.py | mimesis/providers/base.py | """Base data provider."""
import contextlib
import functools
import json
import operator
import typing as t
from functools import reduce
from pathlib import Path
from mimesis.exceptions import NonEnumerableError
from mimesis.locales import Locale, validate_locale
from mimesis.random import Random, get_random_item
fro... | Python | 0.000021 | @@ -3275,17 +3275,21 @@
eError(%22
-L
+The l
ist of k
@@ -3311,17 +3311,16 @@
mpty.%22)%0A
-%0A
@@ -3328,82 +3328,8 @@
ry:%0A
- if len(keys) == 1:%0A return self._data%5Bkeys%5B0%5D%5D%0A
|
ba86e7c9025bbf601db88a23d208b8bfaade34d6 | Version bump to beta 1 | parler_rest/__init__.py | parler_rest/__init__.py | # -*- coding: utf-8 -*-
"""
This package provides support for integrating translatable fields into *django-rest-framework*.
"""
# following PEP 440
__version__ = "1.3a1"
| Python | 0 | @@ -160,12 +160,12 @@
_ = %221.3
-a
+b
1%22%0A
|
f399f8e4ae3fde706a404a7e18d182cd605ea97a | revert the 2 hdmi inputs (only hdmi_in1 working???) | opsis_video.py | opsis_video.py | #!/usr/bin/env python3
from opsis_base import *
from litevideo.output import VideoOut
base_cls = MiniSoC
class VideoMixerSoC(base_cls):
csr_peripherals = (
"hdmi_out0",
"hdmi_out1"
)
csr_map_update(base_cls.csr_map, csr_peripherals)
def __init__(self, platform, **kwargs):
ba... | Python | 0 | @@ -42,16 +42,51 @@
port *%0A%0A
+from litevideo.input import HDMIIn%0A
from lit
@@ -236,67 +236,290 @@
ut1%22
-%0A )%0A csr_map_update(base_cls.csr_map, csr_peripherals
+,%0A %22hdmi_in0%22,%0A %22hdmi_in0_edid_mem%22,%0A %22hdmi_in1%22,%0A %22hdmi_in1_edid_mem%22,%0A )%0A cs... |
5b270e2f541c763012e0acd4fa5e23933029b9db | Fix compatibility layer definition of std | numpy/oldnumeric/mlab.py | numpy/oldnumeric/mlab.py | # This module is for compatibility only. All functions are defined elsewhere.
__all__ = ['rand', 'tril', 'trapz', 'hanning', 'rot90', 'triu', 'diff', 'angle', 'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort', 'LinearAlgebra', 'RandomArray', 'prod', 'std', 'hamming', 'flipud', 'max', 'blackman', 'corrcoef... | Python | 0.000011 | @@ -2048,32 +2048,63 @@
std(x, axis=0):%0A
+ N = asarray(x).shape%5Baxis%5D%0A
return _Nstd
@@ -2108,24 +2108,39 @@
std(x, axis)
+*sqrt(N/(N-1.))
%0A%0Adef mean(x
|
8683400f5c76a5afd71655c67eef89e98b39c19c | make test runnable standalone | tests/test_issues/test_issue_26.py | tests/test_issues/test_issue_26.py | from radical.entk import Pipeline, Stage, Task, AppManager
from radical.entk import states
from radical.entk.exceptions import *
import pytest
import os
hostname = os.environ.get('RMQ_HOSTNAME','localhost')
port = int(os.environ.get('RMQ_PORT',5672))
# MLAB = 'mongodb://entk:entk123@ds143511.mlab.com:43511/entk_0_7_4_... | Python | 0.000002 | @@ -1,28 +1,51 @@
+#!/usr/bin/env python%0A%0A
from radical.entk import Pip
@@ -395,29 +395,200 @@
')%0A%0A
-def test_issue_26():%0A
+%0A# ------------------------------------------------------------------------------%0A#%0Adef test_issue_26():%0A%0A # --------------------------------------------------------------... |
b7fc3d9bd6b59b1278fb09f4b1e61ef67937a494 | fix the old hdf5 fils | scripts/FIX_OLD_RUN.py | scripts/FIX_OLD_RUN.py | """ Turn a catalog of photometry from PS1 into an HDF5 file """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
# Third-party
import astropy.coordinates as coord
from astropy import log as logger
import astropy.units as u
import numpy as np
... | Python | 0.003354 | @@ -1617,16 +1617,19 @@
lihood'%5D
+%5B:%5D
%0A%0A wi
@@ -1751,16 +1751,46 @@
%5B'all'%5D%0A
+ if 'ra' not in g:%0A
@@ -1848,32 +1848,63 @@
data=ps1%5B'ra'%5D)%0A
+ if 'dec' not in g:%0A
g.create
@@ -1961,24 +1961,74 @@
ps1%5B'dec'%5D)%0A
+ if 'cluster_log_likelih... |
e5d13f315624be780fd60a04ff255f6682bdd84b | Update set_student_guardian.py | erpnext/patches/v7_1/set_student_guardian.py | erpnext/patches/v7_1/set_student_guardian.py | import frappe
def execute():
if frappe.db.exists("DocType", "Guardian"):
frappe.reload_doc("schools", "doctype", "student")
frappe.reload_doc("schools", "doctype", "student_guardian")
frappe.reload_doc("schools", "doctype", "student_sibling")
guardian = frappe.get_all("Guardian", fields=["name", "student"])
... | Python | 0.000003 | @@ -244,16 +244,89 @@
bling%22)%0A
+%09%09if %22student%22 not in frappe.db.get_table_columns(%22Guardian%22):%0A%09%09%09return%0A
%09%09guardi
@@ -564,8 +564,9 @@
t.save()
+%0A
|
1b13a1da1b483d8f31fb1f694a7c0236ce01befa | update stats widget | lase/gui/stats_widget.py | lase/gui/stats_widget.py | # -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
class StatsWidget(QtGui.QWidget):
def __init__(self, driver):
super(StatsWidget, self).__init__()
self.driver = driver
self.layout = QtGui.QHBoxLayout()
self.mean_labels = []
self.ampl_lab... | Python | 0.000001 | @@ -1945,33 +1945,33 @@
mean_text = '%25.
-2
+4
e'%25(np.mean(self
@@ -2289,17 +2289,17 @@
xt = '%25.
-2
+4
e'%25(np.m
|
28f5ae9d527dc043290cbd03fd68a2c2ee6ff519 | use -j 6 with mingw too | bin/scripts/updateoffi.py | bin/scripts/updateoffi.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Romain Boman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | Python | 0 | @@ -4974,34 +4974,49 @@
if
-pu.isUnix(
+os.path.isfile('Makefile'
):%0A
|
9986da1599e5beaaad49d389b2a2ee3d4f308991 | fix https://github.com/BackofenLab/AlgoDat/issues/61 | Lecture-4/Code/AssociativeArray.py | Lecture-4/Code/AssociativeArray.py | # creates a new map (called dictionary)
countries = {"DE" : "Deutschland", \
"EN" : "England"}
# check if element exists
if "EN" in countries:
print("Found %s!" % countries["EN"])
# map key "DE" to value 0
countries["DE"] = "Germany"
# delete key "DE"
del countries["DE"]
| Python | 0 | @@ -213,9 +213,17 @@
lue
-0
+%22Germany%22
%0D%0Aco
|
f98ef68949b8875daeb5b8346a65a842a682a5df | replace linebreaks in version strings | nvchecker/get_version.py | nvchecker/get_version.py | # MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
import logging
from importlib import import_module
logger = logging.getLogger(__name__)
handler_precedence = (
'github', 'aur', 'pypi', 'archpkg', 'debianpkg', 'ubuntupkg',
'gems', 'pacman',
'cmd', 'bitbucket', 'regex', 'manual', 'vc... | Python | 0.000002 | @@ -563,14 +563,17 @@
-return
+version =
awa
@@ -592,16 +592,56 @@
, conf)%0A
+ return version.replace('%5Cn', ' ')%0A
else:%0A
|
11c81ff161cad04a24a8746b93d3afb64e6a5b49 | fix typo | python/example_code/ec2/describe_subnets.py | python/example_code/ec2/describe_subnets.py | # Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This file is d... | Python | 0.999991 | @@ -782,25 +782,16 @@
escribe
-describe
one or m
|
50a0d32b880061fd6f85ec3f3ffe540bcead19e9 | rename test pillow member | corehq/form_processor/tests/test_kafka.py | corehq/form_processor/tests/test_kafka.py | import uuid
from django.test import TestCase, override_settings
from corehq.apps.change_feed import topics
from corehq.apps.change_feed.consumer.feed import change_meta_from_kafka_message, KafkaChangeFeed
from corehq.apps.change_feed.tests.utils import get_test_kafka_consumer
from corehq.apps.commtrack.helpers import m... | Python | 0.000001 | @@ -1506,24 +1506,29 @@
self.
+form_
pillow = Con
@@ -1871,32 +1871,37 @@
ka_changes(self.
+form_
pillow):%0A
@@ -2672,16 +2672,21 @@
es(self.
+form_
pillow):
|
178de6396dade359a3f8e137d4a3449155b88b89 | Add schema for workflow input with default value support | mistral/workbook/types.py | mistral/workbook/types.py | # Copyright 2015 - StackStorm, 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 ... | Python | 0.999965 | @@ -1696,16 +1696,169 @@
%7D%0A%7D%0A%0A
+ONE_KEY_DICT = %7B%0A %22type%22: %22object%22,%0A %22minProperties%22: 1,%0A %22maxProperties%22: 1,%0A %22patternProperties%22: %7B%0A %22%5E%5Cw+$%22: ANY_NULLABLE%0A %7D%0A%7D%0A%0A
STRING_O
@@ -2258,12 +2258,252 @@
%22direct%22%5D%0A%7D%0A
+%0AS... |
c9d86a07ca35f259d819b6d0940294c66b00fa4c | increase cache size | originality.py | originality.py | # System
"""Originality Checking."""
import logging
import functools
from threading import Lock
# Third Party
from scipy.stats import ks_2samp
from scipy.stats.stats import pearsonr
import numpy as np
import pandas as pd
from bson.objectid import ObjectId
lock = Lock()
@functools.lru_cache(maxsize=512)
def get_submi... | Python | 0.000001 | @@ -299,11 +299,12 @@
ize=
-512
+2048
)%0Ade
|
0b93f9e8557409ff8c3abadcaad674e6eac48e95 | test uses unicode rather than ascii for py3 | blaze/tests/test_bcolz.py | blaze/tests/test_bcolz.py | from __future__ import absolute_import, division, print_function
import pytest
bcolz = pytest.importorskip('bcolz')
import numpy as np
from pandas import DataFrame
from toolz import count
import os
from datashape import discover, dshape
from collections import Iterator
from blaze.bcolz import into, chunks, resource
... | Python | 0.000315 | @@ -1209,13 +1209,11 @@
7, %22
-ascii
+U32
%22%5D%7D'
|
27748acb4eb9b3b9c4e996693f81ba7c5d16be12 | add works | tests/trashtest/trashtest_utils.py | tests/trashtest/trashtest_utils.py | '''
Scratchpad for test-based development.
LICENSING
-------------------------------------------------
hypergolix: A python Golix client.
Copyright (C) 2016 Muterra, Inc.
Contributors
------------
Nick Badger
badg@muterra.io | badg@nickbadger.com | nickbadger.com
This library is free... | Python | 0 | @@ -4243,16 +4243,1065 @@
west1)%0A
+ %0A def test_add(self):%0A objs = %5BRefferee() for __ in range(10)%5D%0A other = Refferee()%0A west1 = _WeakSet(objs)%0A %0A self.assertNotIn(other, west1)%0A %0A # Make sure we don't add extra references to the same thing%0... |
4c4e997767681e91f5d115e998cda22433eae7f6 | allow to set a mode (list|map) | apps/mapideas/views.py | apps/mapideas/views.py | import django_filters
from django.contrib import messages
from django.utils.translation import ugettext as _
from adhocracy4.maps import mixins as map_mixins
from adhocracy4.modules import views as module_views
from apps.contrib import filters
from . import forms
from . import models
def get_ordering_choices(reque... | Python | 0 | @@ -1193,16 +1193,163 @@
terSet%0A%0A
+ def dispatch(self, request, **kwargs):%0A self.mode = request.GET.get('mode', 'list')%0A return super().dispatch(request, **kwargs)%0A%0A
%0Aclass M
|
dac0afb3db74b1e8cd144993e662dc8ac0622cb9 | Add missing import to FTP module | osbrain/ftp.py | osbrain/ftp.py | """
Implementation of FTP-related features.
"""
from .core import BaseAgent
from .common import address_to_host_port
class FTPAgent(BaseAgent):
"""
An agent that provides basic FTP functionality.
"""
def ftp_configure(self, addr, user, passwd, path, perm='elr'):
from pyftpdlib.authorizers impo... | Python | 0.000001 | @@ -41,16 +41,29 @@
es.%0A%22%22%22%0A
+import Pyro4%0A
from .co
|
d4965867cae83de876910c16ce587c076ba3ab37 | fix long tweet continuation to show on profile | everyailment.py | everyailment.py | """Tweet every ICD-10-CM code."""
# test index 4744
import json
import os
import textwrap
import click
import twython
DEFAULT_CODES_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'data/ailments.json')
def make_tweets(index, codes):
"""Generate tweets from th... | Python | 0.000245 | @@ -84,16 +84,28 @@
textwrap
+%0Aimport time
%0A%0Aimport
@@ -603,22 +603,8 @@
'
-@everyailment
%E2%80%A6%7B%7D
@@ -3692,21 +3692,8 @@
%5D)%0A%0A
- twitter%0A%0A
@@ -4128,16 +4128,37 @@
(tweet)%0A
+ time.sleep(2)
%0A if
|
43d12bfcae483c3632f3e55db1b4c58d38131dab | Update about_multiple_inheritance.py | python2/koans/about_multiple_inheritance.py | python2/koans/about_multiple_inheritance.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Slightly based on AboutModules in the Ruby Koans
#
from runner.koan import *
class AboutMultipleInheritance(Koan):
class Nameable(object):
def __init__(self):
self._name = None
def set_name(self, new_name):
self._name = n... | Python | 0 | @@ -2121,18 +2121,54 @@
rtMatch(
-__
+%22This looks like a job for Spiderpig!%22
, jeff.s
|
c450ee554daf1b5c4143e33d5688df2fed776f99 | fix bug: 隐藏管理后台侧边栏配置owner字段,修复不填写作者无法保存侧边栏内容问题 | blogsys/blogsys/adminx.py | blogsys/blogsys/adminx.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:zq time:2018/3/15
from __future__ import unicode_literals
import xadmin
from xadmin.views import CommAdminView
class BaseOwnerAdmin(object):
'''
1.用来处理文章、分类、标签、侧边栏、友链这些model的owner子段自动补充
2.用来针对queryset过滤当前用户的数据
'''
exclude = ('owner')
def ... | Python | 0 | @@ -303,16 +303,17 @@
('owner'
+,
)%0A de
|
b5e542ad361d39e9f670198fabbfe30a48faef6e | make sure airtime-liquidsoap DNE before attempting to create | python_apps/pypo/install/pypo-initialize.py | python_apps/pypo/install/pypo-initialize.py | import platform
import shutil
from subprocess import Popen, PIPE
import subprocess
import sys
import os
sys.path.append('/usr/lib/airtime/')
from api_clients import api_client
from configobj import ConfigObj
import logging
if os.geteuid() != 0:
print "Please run this as root."
sys.exit(1)
"""
This functi... | Python | 0 | @@ -2761,24 +2761,174 @@
ncode == 0:%0A
+ try:%0A os.unlink(liq_path)%0A except Exception:%0A #liq_path DNE, which is OK.%0A pass%0A %0A %0A
os.s
|
0627033d55ffc21e820f03ab2609462a19ea32dd | Use content_type instead of mime type | bluebottle/utils/admin.py | bluebottle/utils/admin.py | from django.contrib import admin
from django.utils.translation import ugettext as _
from django.contrib.admin.views.main import ChangeList
from django.db.models.aggregates import Sum
from .models import Language
import csv
from django.db.models.fields.files import FieldFile
from django.db.models.query import QuerySet
f... | Python | 0.000006 | @@ -2518,12 +2518,16 @@
nse(
-mime
+content_
type
|
fa6927ec47253b8b7f642c67e1470680b0f8253f | fix logging | crate_project/settings/production/base.py | crate_project/settings/production/base.py | from ..base import *
LOGGING = {
"version": 1,
"disable_existing_loggers": True,
"filters": {
"require_debug_false": {
"()": "django.utils.log.RequireDebugFalse",
},
},
"formatters": {
"simple": {
"format": "%(levelname)s %(message)s"
},
}... | Python | 0.000002 | @@ -793,38 +793,17 @@
%22
-loggers%22: %7B%0A %22%22: %7B%0A
+root%22: %7B%0A
@@ -845,43 +845,8 @@
%22%5D,%0A
- %22propagate%22: True,%0A
@@ -863,26 +863,38 @@
%22: %22
-DEBUG
+INFO
%22,%0A
+%7D,%0A
-%7D,
+%22loggers%22: %7B
%0A
|
06f2438bd3baad9d234f394697f8ebaa69002230 | clear code | apps/pages/managers.py | apps/pages/managers.py | from django.db import models
from django.core.cache import cache
from mysmile.settings.main import LANGUAGES
from apps.pages.models import Page, Page_translation
from apps.settings.managers import SettingsManager
class PagesManager(models.Manager):
def get_content(self, request, lang=None, slug=None):
c... | Python | 0.000081 | @@ -232,15 +232,16 @@
ger(
-models.
+Settings
Mana
@@ -246,16 +246,28 @@
nager):%0A
+
%0A def
@@ -471,39 +471,8 @@
''%0A
- sm = SettingsManager()%0A
|
651fd4ca1376064b3444cf7dbfe873ca149defdb | version bump | dlcli/_version.py | dlcli/_version.py | __version__ = '0.0.23'
| Python | 0.000001 | @@ -17,7 +17,7 @@
.0.2
-3
+4
'%0A
|
fe983892386c7ca8a96817ce26158e667d920b97 | Add links from programs to pipelines | apps/pipeline/admin.py | apps/pipeline/admin.py | #
# Copyright (C) 2017 Maha Farhat
#
# 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 version 3 of the License, or
# (at your option) any later version.
#
# This program is distribu... | Python | 0 | @@ -713,16 +713,62 @@
rt admin
+%0Afrom django.utils.safestring import mark_safe
%0A%0Atry:%0A
@@ -1770,16 +1770,28 @@
iption',
+ 'pipeline',
'keep',
@@ -1841,16 +1841,371 @@
iles')%0A%0A
+ @staticmethod%0A def pipeline(obj):%0A urk = 'admin:pipeline_pipeline_change'%0A res = %5B%5D%0A ... |
5488a3d7247633995e19dcbaa16ad554104f221f | Update cumulusci/tasks/metadata_etl/help_text.py | cumulusci/tasks/metadata_etl/help_text.py | cumulusci/tasks/metadata_etl/help_text.py | from collections import defaultdict
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.tasks.metadata_etl import MetadataSingleEntityTransformTask
from cumulusci.utils.xml.metadata_tree import MetadataElement
from cumulusci.core.utils import process_list_arg, process_bool_arg
class SetFieldHelpText... | Python | 0 | @@ -1156,11 +1156,21 @@
if
-typ
+not isinstanc
e(se
@@ -1179,25 +1179,29 @@
.options
-%5B
+.get(
%22fields%22
%5D) != li
@@ -1196,18 +1196,16 @@
lds%22
-%5D) !=
+),
list
+)
or
|
b37057c35452f26d567677eaf15216fcf0282b1c | fix max_history in aug memo, it was my mistake there shouldn't be -1 | rasa_core/policies/augmented_memoization.py | rasa_core/policies/augmented_memoization.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import typing
from typing import Dict, List, Text, Optional
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.events import Act... | Python | 0.000135 | @@ -2588,14 +2588,10 @@
tory
- - 1
:%0A
+
@@ -2676,108 +2676,109 @@
#
-one less than max_history, in order%0A # to not recall again with the same features
+max_history, because due to forgetting%0A # of slots the features might be different
%0A
|
23eabb23ce0423a3b11ea56fff4ff06f91ddef95 | Create DebtLoan population method | finance/management/commands/populate.py | finance/management/commands/populate.py | from datetime import datetime
from datetime import timedelta
import random
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.utils import timezone
import factory
import pytz
from accounts.factories import UserFactory
from books.factories import TransactionFa... | Python | 0.000001 | @@ -300,34 +300,112 @@
import
-TransactionFactory
+DebtLoanFactory%0Afrom books.factories import TransactionFactory%0Afrom books.models import DebtLoan
%0Afrom bo
@@ -795,16 +795,49 @@
ctions()
+%0A self.create_debt_loans()
%0A%0A de
@@ -3557,8 +3557,1422 @@
eated%22)%0A
+%0A def create_debt_loans(s... |
9d334caa16f2bd3385288a8cf263c71f8a6fb827 | Fix to previous csvbills commit | membership/management/commands/csvbills.py | membership/management/commands/csvbills.py | # encoding: UTF-8
from __future__ import with_statement
from django.db.models import Q, Sum
from django.core.management.base import BaseCommand
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext_lazy as _
import codecs
import csv
import os
from datetime import dateti... | Python | 0.000007 | @@ -5697,24 +5697,32 @@
ment%7D%22,
+unicode(
payment)
.replace
@@ -5713,16 +5713,17 @@
payment)
+)
.replace
@@ -5738,15 +5738,24 @@
%7D%22,
+unicode(
cycle))
+)
%0A
|
0846347ab7931993e602463d81dc493457c2cf5f | Support Git URI | pipes/app/create_app.py | pipes/app/create_app.py | #!/usr/bin/env python
# A script for creating an application in spinnaker.
# Simply looks to see if the application already exists, if not, creates
import argparse
import configparser
import json
import logging
import os
import sys
from jinja2 import Environment, FileSystemLoader
import requests
class SpinnakerApp... | Python | 0 | @@ -226,16 +226,33 @@
port sys
+%0Aimport gogoutils
%0A%0Afrom j
@@ -2247,24 +2247,16 @@
header)%0A
-
%0A
@@ -3051,24 +3051,87 @@
ult=%22None%22)%0A
+ parser.add_argument(%22--git%22, help=%22Git URI%22, default=None)%0A
args = p
@@ -3229,16 +3229,247 @@
.INFO)%0A%0A
+ if args.git:%0A ... |
a6128825eb7b4267a2a5a3116ec2625fdd8d3552 | Add outsuffix to prottable-qvality driver | app/drivers/prottable/qvality.py | app/drivers/prottable/qvality.py | from app.drivers.pycolator.qvality import QvalityDriver
from app.actions.prottable import qvality as preparation
from app.readers import tsv
class ProttableQvalityDriver(QvalityDriver):
def __init__(self, **kwargs):
super(ProttableQvalityDriver).__init__(**kwargs)
self.score_get_fun = preparation.... | Python | 0 | @@ -181,16 +181,97 @@
river):%0A
+ %22%22%22Runs qvality on two protein tables%22%22%22%0A outsuffix = '_protqvality.txt'%0A%0A
def
|
ca30a98655d289d2367f24503d947536e6f3a5eb | Sort the order. | scripts/slave/recipes/infra/infra_continuous.py | scripts/slave/recipes/infra/infra_continuous.py | # Copyright 2014 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.
DEPS = [
'bot_update',
'file',
'gclient',
'json',
'path',
'platform',
'properties',
'python',
'step',
]
# Path to a service account crede... | Python | 0.999994 | @@ -1644,16 +1644,23 @@
files =
+sorted(
api.file
@@ -1693,16 +1693,17 @@
go_bin)
+)
%0A absfi
|
45fac42c7a790c5ff6cf656ee8e5984869cddbf3 | Clean up JWT args before creation | dockci/api/jwt.py | dockci/api/jwt.py | """ API relating to JWT authentication """
from datetime import datetime
import jwt
from flask import url_for
from flask_restful import Resource
from flask_security import current_user, login_required
from .base import BaseRequestParser
from .exceptions import OnlyMeError, WrappedTokenError, WrongAuthMethodError
fro... | Python | 0.000004 | @@ -361,16 +361,29 @@
l import
+ clean_attrs,
DT_FORM
@@ -1536,32 +1536,44 @@
%0A args =
+clean_attrs(
%7B%0A 'n
@@ -1625,32 +1625,33 @@
exp'%5D,%0A %7D
+)
%0A return
@@ -1982,16 +1982,28 @@
args =
+clean_attrs(
%7B%0A
@@ -2107,16 +2107,17 @@
%7D
+)
%0A ... |
3199b523a67f9c241950992a07fe38d2bbee07dc | Update migration file for namechange | seedlibrary/migrations/0003_extendedview_fix.py | seedlibrary/migrations/0003_extendedview_fix.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2017-02-21 02:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('seedlibrary', '0002_auto_20170219_2058'),
]
operations = [
migrations.Rename... | Python | 0 | @@ -245,25 +245,23 @@
02_a
-uto_20170219_2058
+dd_extendedview
'),%0A
|
d4675f644278167842eb2419bd0e00f94ece6b92 | Add self | serenata_toolbox/chamber_of_deputies/dataset.py | serenata_toolbox/chamber_of_deputies/dataset.py | import os.path
import csv
from datetime import date
from urllib.request import urlretrieve
from zipfile import ZipFile
import numpy as np
import pandas as pd
from .reimbursements import Reimbursements
class Dataset:
YEARS = [n for n in range(2009, date.today().year+1)]
def __init__(self, path):
self.... | Python | 0.000359 | @@ -5408,24 +5408,30 @@
parse_float(
+self,
string):%0A
|
17b0f5d7b718bc12755f7ddefdd76ee9312adf5f | Add content type text/html to response | books.py | books.py | import falcon
import template
def get_paragraphs(pathname: str) -> list:
result = []
with open(pathname) as f:
for line in f.readlines():
if line != '\n':
result.append(line[:-1])
return result
class BooksResource:
def on_get(self, req, resp):
resp.status ... | Python | 0.000001 | @@ -331,16 +331,56 @@
TTP_200%0A
+ resp.content_type = 'text/html'%0A
|
c024c69c9719693f3a8a47bc70f3649e8abff17a | Use cache db backend for session in the default state. | leonardo/conf/default.py | leonardo/conf/default.py |
from leonardo.base import default
EMAIL = {
'HOST': 'mail.domain.com',
'PORT': '25',
'USER': 'username',
'PASSWORD': 'pwd',
'SECURITY': True,
}
RAVEN_CONFIG = {}
ALLOWED_HOSTS = ['*']
USE_TZ = True
DEBUG = True
ADMINS = (
('admin', 'mail@leonardo.cz'),
)
# month
LEONARDO_CACHE_TIMEOUT = ... | Python | 0 | @@ -1295,16 +1295,79 @@
S = %7B%7D%0A%0A
+SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'%0A%0A
# enable
|
02f241a646ba991046208949156d00fd2d163c26 | Remove unneeded override of field | partner_communication_switzerland/models/account_invoice.py | partner_communication_switzerland/models/account_invoice.py | ##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | Python | 0.000001 | @@ -677,155 +677,8 @@
e'%0A%0A
- communication_id = fields.Many2one(%0A 'partner.communication.job', 'Thank you letter', ondelete='set null',%0A readonly=True%0A )%0A%0A
|
4f10a72f6d7f351ee45c53f757b2889a372ba3e6 | Handle also osv, orm exception in wizard execution | bin/wizard/__init__.py | bin/wizard/__init__.py | ##############################################################################
#
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences r... | Python | 0 | @@ -1458,16 +1458,79 @@
pooler%0A%0A
+from osv.osv import except_osv%0Afrom osv.orm import except_orm%0A%0A
class ex
@@ -5253,26 +5253,129 @@
ept
-except_wizard, e
+Exception, e:%0A%09%09%09if isinstance(e, except_wizard) %5C%0A%09%09%09%09or isinstance(e, except_osv) %5C%0A%09%09%09%09or isinstance(e, except_orm)
... |
ced7ff090c44f706fa161b5e5bed8f36fb6570c9 | Set default pool to 1 worker. | blackgate/component.py | blackgate/component.py | # -*- coding: utf-8 -*-
from functools import partial
from blackgate.executor_pools import ExecutorPools
from blackgate.circuit_beaker import NoCircuitBeaker, InProcessCircuitBeaker, get_circuit_beaker
class Component(object):
def __init__(self):
self.pools = ExecutorPools()
self.circuit_beaker... | Python | 0 | @@ -503,14 +503,8 @@
-table=
self
@@ -1059,32 +1059,80 @@
tor_pool(self):%0A
+ self.pools.register_pool('default', 1)%0A%0A
if 'exec
|
500baa732d08712eef802f57f4c3473f667802d8 | make xlim and ylim start at 0 (less confusing to user) | bonvoyage/visualize.py | bonvoyage/visualize.py | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from modish import MODALITY_TO_COLOR, MODALITY_TO_CMAP
def switchy_score(array):
"""Transform a 1D array of data scores to a vector of "switchy scores"
Calculates std deviation and mean of sine- and cosine-transformed
versions of th... | Python | 0 | @@ -4554,13 +4554,9 @@
m =
--0.05
+0
, 1.
|
89237e9af27fa46c08ec90cab4029f41b335708f | fix pep8 violations | examples/plugin/simphony_example/__init__.py | examples/plugin/simphony_example/__init__.py | # Functions, classes and constants exported here will be available
# when the `example` module is imported.
__all__ = ['A', 'B']
from .code import A, B
| Python | 0 | @@ -101,17 +101,16 @@
ported.%0A
-%0A
__all__
|
4a498d83c15f89e00c095659df1fc38377acc0a3 | fix permissions for rewards | bluebottle/rewards/models.py | bluebottle/rewards/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.fields import (CreationDateTimeField,
ModificationDateTimeField)
from bluebottle.utils.fields import MoneyField
from bluebottle.utils.utils import StatusDefinition
... | Python | 0 | @@ -433,16 +433,230 @@
)%0A
+ %7D,%0A 'Anonymous': %7B%0A 'perms': ('api_read_reward',)%0A %7D,%0A 'Authenticated': %7B%0A 'perms': (%0A 'api_read_reward', 'api_add_reward', 'api_change_reward', 'api_delete_reward',%0A )%0A
%7D%0A%7D%0A
|
7851e867aec82f771683cc267ecb5989d2005aa1 | add same features as program in 03-janus | experiments/01-single-dimer/plot_velocity.py | experiments/01-single-dimer/plot_velocity.py | #!/usr/bin/env python3
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('file', type=str, help='H5MD datafile')
parser.add_argument('--directed', action='store_true')
args = parser.parse_args()
import numpy as np
import h5py
import matplotlib.pyplot as plt
with h5py.File(args.file, 'r') as f:
... | Python | 0 | @@ -184,16 +184,72 @@
_true')%0A
+parser.add_argument('--histogram', action='store_true')%0A
args = p
@@ -1026,57 +1026,343 @@
-plt.plot(time, vz)%0Aelse:%0A plt.plot(time, v_com
+if args.histogram:%0A plt.hist(vz, bins=20)%0A else:%0A plt.plot(time, vz)%0Aelse:%0A for i in range(3):%0A ... |
aabe64773baf0516ecce2e96793221d5bfa91040 | change to use environment variables | scripts/sillyserver.py | scripts/sillyserver.py | # Example of using the MQTT client class to subscribe to a feed and print out
# any changes made to the feed. Edit the variables below to configure the key,
# username, and feed to subscribe to for changes.
# Import standard python modules.
import sys
import serial
# Import Adafruit IO MQTT client.
from Adafruit_IO ... | Python | 0.000002 | @@ -246,23 +246,21 @@
port sys
-%0Aimport
+, os,
serial%0A
@@ -401,56 +401,227 @@
Y =
-%22yourkey%22%0AADAFRUIT_IO_USERNAME = %22yourusername%22%0A
+os.getenv('AIOKEY','nokey')%0AADAFRUIT_IO_USERNAME = os.getenv('AIOUSER','nouser')%0A%0Aif (ADAFRUIT_IO_KEY == 'nokey' or ADAFRUIT_IO_USERNAME == 'nouser'):%0A pri... |
d4879a7640869b16e1ea50cdbff84f173a81b521 | simplify variable | examples/apt.py | examples/apt.py | from pyinfra import host
from pyinfra.modules import apt
SUDO = True
# Note: Using linux_distribution fact so running from docker
# will show valid name since the lsb-release tool is not installed,
# otherwise could just use host.fact.linux_name
linux_name = host.fact.linux_distribution.get('name', '')
code_name = ho... | Python | 0.999861 | @@ -68,243 +68,8 @@
ue%0A%0A
-# Note: Using linux_distribution fact so running from docker%0A# will show valid name since the lsb-release tool is not installed,%0A# otherwise could just use host.fact.linux_name%0Alinux_name = host.fact.linux_distribution.get('name', '')%0A
code
@@ -151,16 +151,26 @@
)%0Aprint(
+host... |
4c81f9375529604999c35e36c4586856f9c4d458 | Handle bad error codes. | bot/app/sync/closure_sync.py | bot/app/sync/closure_sync.py | import logging
import urllib
import pytz
from datetime import datetime, timedelta
from api.models import RoadClosure, RoadClosureStatus
from bs4 import BeautifulSoup
from dateutil import tz
logger = logging.getLogger('bot.digest')
def get_road_closure():
tzTex = pytz.timezone('US/Central')
url = "http://ww... | Python | 0.000002 | @@ -684,16 +684,130 @@
return%0A
+ if response.code != 200:%0A logger.error(%22Received bad response code %25s%22 %25 response.code)%0A return%0A
html
|
630e362e727d4c7274b987008488d203e21f8ec6 | Use default quality | electionleaflets/apps/api/serializers.py | electionleaflets/apps/api/serializers.py | from rest_framework import serializers
from sorl.thumbnail import get_thumbnail
from leaflets.models import Leaflet, LeafletImage
from constituencies.models import Constituency
from uk_political_parties.models import Party
from people.models import Person
class ConstituencySerializer(serializers.ModelSerializer):
... | Python | 0.000001 | @@ -1681,20 +1681,8 @@
350'
-, quality=80
).ur
|
4626a20b2d46a3a8ea17d265dff220c5a02700d8 | Fix bug in clang-format's vim integration cause by r186789. | tools/clang-format/clang-format.py | tools/clang-format/clang-format.py | # This file is a minimal clang-format vim-integration. To install:
# - Change 'binary' if clang-format is not on the path (see below).
# - Add to your .vimrc:
#
# map <C-I> :pyf <path-to-this-file>/clang-format.py<CR>
# imap <C-I> <ESC>:pyf <path-to-this-file>/clang-format.py<CR>i
#
# The first line enables clang-f... | Python | 0.000141 | @@ -2546,16 +2546,25 @@
r op in
+reversed(
sequence
@@ -2577,16 +2577,17 @@
pcodes()
+)
:%0A if
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.