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
689d8aa78d353a1e209aa45da3d46099d49e1a1e
make other test use tmpdir
tests/unit/test_backends.py
tests/unit/test_backends.py
# -*- coding: utf-8 -*- from __future__ import division, print_function import os from itertools import product import numpy as np import pytest from emcee import backends, EnsembleSampler import h5py __all__ = ["test_backend", "test_reload"] all_backends = backends.get_test_backends() other_backends = all_back...
Python
0
@@ -1239,16 +1239,22 @@ _uninit( +tmpdir ):%0A f @@ -1257,16 +1257,32 @@ fn = +str(tmpdir.join( %22EMCEE_T @@ -1304,16 +1304,18 @@ _USE.h5%22 +)) %0A if
9df3cc260788faf2fdede01085c8b73535c52698
add url tests
tests/urls_functionality.py
tests/urls_functionality.py
import json import logging import os from webtest import TestApp import sys sys.path.append('../') if os.path.isfile('pool.db'): os.remove('pool.db') import pool_server __author__ = 'sammoth' log = logging.Logger('ALP_Test') stream = logging.StreamHandler() formatter = logging.Formatter(fmt='%(message)s') stream....
Python
0.000001
@@ -2796,33 +2796,33 @@ 1TNMwnTYUopQVxBr -a +A PmmJjJjhd95'%0Ares @@ -2962,17 +2962,17 @@ UopQVxBr -a +A PmmJjJjh
243cae812c1b5c41de8064e6fc46d0e018da2586
Upgrade database version 20 should succeed even for environment not using the versioncontrol subsystem. Closes #5015.
trac/upgrades/db20.py
trac/upgrades/db20.py
from trac.db import Table, Column, Index, DatabaseManager from trac.versioncontrol.cache import CACHE_YOUNGEST_REV def do_upgrade(env, ver, cursor): """Modify the repository cache scheme. Now we use the 'youngest_rev' entry in the system table to explicitly store the youngest rev in the cache. ...
Python
0
@@ -52,16 +52,49 @@ anager%0D%0A +from trac.core import TracError%0D%0A from tra @@ -221,17 +221,28 @@ e scheme -. + (if needed) %0D%0A%0D%0A @@ -390,16 +390,30 @@ _cnx()%0D%0A + try:%0D%0A repo @@ -454,16 +454,20 @@ False)%0D%0A + youn @@ -520,16 +520,20 @@ ''%0D%0A + + # delet...
8e9e9a46c92198cb42f7e498da7dd94f3d23e7b8
fix config file name
dwarf/common/config.py
dwarf/common/config.py
#!/usr/bin/python from __future__ import print_function import logging import os import yaml LOG = logging.getLogger(__name__) class Config(object): def __init__(self): # Get the config data from file cfile = '/etc/default/dwarf' if not os.path.exists(cfile): cfile = os.pat...
Python
0.000004
@@ -239,19 +239,16 @@ tc/d -efault/dwar +warf.con f'%0A
05c398dce5efe564ac37c81399d978e0cd15ca82
Add module_list arg to celery delay method
utils/celery_worker.py
utils/celery_worker.py
''' This is the multiscanner celery worker. To initialize a worker node run: $ celery -A celery_worker worker from the utils/ directory. ''' import os import sys import codecs import configparser from datetime import datetime from socket import gethostname MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file...
Python
0.000001
@@ -3507,16 +3507,34 @@ r.CONFIG +, module_list=None ):%0A ' @@ -4384,16 +4384,24 @@ (files), +%0A configf @@ -4406,24 +4406,62 @@ gfile=config +,%0A module_list=module_list%0A )%0A result
12f738cde06e192e110ec53ac6bfe5350a5e305b
Remove flawed file comparison test
csdms/dakota/tests/test_plugin_hydrotrend_run.py
csdms/dakota/tests/test_plugin_hydrotrend_run.py
#!/usr/bin/env python # # Test running the dakota.plugin.hydrotrend module. # # Call with: # $ nosetests -sv # # Mark Piper (mark.piper@colorado.edu) import os import shutil import filecmp import glob from nose.tools import with_setup, assert_true from csdms.dakota.dakota import Dakota from csdms.dakota.plugins.hydr...
Python
0.000002
@@ -170,16 +170,18 @@ shutil%0A +# import f @@ -663,24 +663,26 @@ nfig.yaml')%0A +# known_dat_fi @@ -2633,32 +2633,34 @@ t_file))%0A + # assert_true(fil @@ -3271,32 +3271,34 @@ t_file))%0A + # assert_true(fil
5f387a750baa30e4ebad034ec344f2caf24b0c25
Update definition of to_iterable()
dakotathon/utils.py
dakotathon/utils.py
#! /usr/bin/env python """Helper functions for processing Dakota parameter and results files.""" import os import subprocess import re import yaml import numpy as np def is_dakota_installed(): """Check whether Dakota is installed and in the execution path. Returns ------- bool True if Dakota i...
Python
0
@@ -160,16 +160,35 @@ y as np%0A +import collections%0A %0A%0Adef is @@ -4507,28 +4507,16 @@ t='%25s')%0A - %0A%0Adef to @@ -4525,21 +4525,17 @@ terable( -value +x ):%0A %22 @@ -4540,172 +4540,414 @@ %22%22%22 -Convert a scalar value to a tuple.%22%22%22%0A iterable_value = value%0A if not ...
434b9beb73ecdd257c692ade18e083ba1294b9bd
change content
polls/views.py
polls/views.py
from django.shortcuts import render from django.http import HttpResponse def index(request): return HttpResponse("Hello, world. You're at the polls index.") def detail(request, question_id): return HttpResponse("You're looking at question %s." % question_id) def results(request, question_id): response =...
Python
0.000001
@@ -70,96 +70,236 @@ nse%0A -%0A%0Adef index(request):%0A return HttpResponse(%22Hello, world. You're at the polls index.%22 +from polls.models import Question%0A%0A%0Adef index(request):%0A latest_question_list = Question.objects.order_by('-pub_date')%5B:5%5D%0A output = ', '.join(%5Bp.question_text for p in...
20259943c022b2046ac667d78dd5ddc8e0177932
Deal with unique users, unique queries
event_detection_web.py
event_detection_web.py
from flask import Flask, render_template, request, redirect import psycopg2 from psycopg2.extras import RealDictCursor import sys app = Flask(__name__) def connect_database(): # Establish connction with database try: conn = psycopg2.connect(user="root", database="event_detection") cursor = con...
Python
0
@@ -510,16 +510,8 @@ ds=%5B -%22POST%22, %22GET @@ -1498,24 +1498,209 @@ to database%0A + cursor.execute(%22SELECT id from users where email = %25s and phone = %25s%22, (email, phone))%0A user_id = cursor.fetchone()%0A if user_id:%0A user_id = user_id%5B%22id%22%5D%0A else:%0A cursor.e @...
9e8126170ff0b0e0b3c01b3c75e129bacd0087ac
remove g/G error
cupy/_sorting/sort.py
cupy/_sorting/sort.py
import cupy import numpy if cupy.cuda.thrust_enabled: from cupy.cuda import thrust def sort(a, axis=-1): """Returns a sorted copy of an array with a stable sorting algorithm. Args: a (cupy.ndarray): Array to be sorted. axis (int or None): Axis along which to sort. Default is -1, which ...
Python
0.000125
@@ -3823,145 +3823,8 @@ %22%22%22%0A - if a.dtype.char in 'gG':%0A raise NotImplementedError(%0A 'float128 and complex256 types are not currently supported')%0A
fb3455a7cd367ddec320e5904a6b4b0a9ecd2e03
Rename CUB_DISABLED to CUPY_CUB_ENABLED
cupy/cuda/__init__.py
cupy/cuda/__init__.py
import contextlib import os from cupy._environment import get_cuda_path, get_nvcc_path # NOQA from cupy.cuda import compiler # NOQA from cupy.cuda import device # NOQA from cupy.cuda import driver # NOQA from cupy.cuda import function # NOQA from cupy.cuda import memory # NOQA from cupy.cuda import memory_hook ...
Python
0.999999
@@ -1066,13 +1066,17 @@ ('CU -B_DIS +PY_CUB_EN ABLE @@ -1086,17 +1086,17 @@ 0)) == -0 +1 :%0A tr
fbe1d8063774dc35765596c88d5cc7b197a8ec6d
fix for our browseable api renderer
tndata_backend/utils/api.py
tndata_backend/utils/api.py
from rest_framework import exceptions from rest_framework.renderers import BrowsableAPIRenderer from rest_framework.throttling import BaseThrottle from rest_framework.versioning import QueryParameterVersioning class DefaultQueryParamVersioning(QueryParameterVersioning): """This class includes the default version ...
Python
0
@@ -1143,16 +1143,530 @@ rn ctx%0A%0A + def show_form_for_method(self, view, method, request, obj):%0A return False%0A%0A def get_rendered_html_form(self, data, view, method, request):%0A %22%22%22%0A Return a string representing a rendered HTML form, possibly bound to%0A either the i...
661d1968cbe8684f5f6da0ce97a99cfd6d3522fd
Remove unnecessary method in CNN tagger
examples/cnn_tagger.py
examples/cnn_tagger.py
from thinc.neural.id2vec import Embed from thinc.neural.vec2vec import Model, ReLu, Softmax from thinc.neural.vecs2vecs import ExtractWindow from thinc.neural.util import score_model from thinc.neural.optimizers import linear_decay from thinc.neural.ops import NumpyOps from thinc.loss import categorical_crossentropy ...
Python
0.000025
@@ -1430,79 +1430,8 @@ ))%0A%0A - def check_input(self, X, expect_batch=False):%0A return True%0A%0A %0Adef
56e9e62c962b899f464ec27ee4f306c28caa048a
Fixed the problem where defense_checkbox was None
soccer/gameplay/ui/main.py
soccer/gameplay/ui/main.py
import logging from PyQt5 import QtCore, QtWidgets import main import sys def getMainWindow(): win = None for widget in QtWidgets.QApplication.topLevelWidgets(): if isinstance(widget, QtWidgets.QMainWindow): win = widget break return win # sets up the PlayConfigTab in the...
Python
0.999998
@@ -402,30 +402,26 @@ bled():%0A -global +if _defense_ch @@ -426,17 +426,60 @@ checkbox -%0A + is None:%0A return True%0A else:%0A retu
18bbe81b6fadf4d5af7a12a18a557bb4733d8c34
add support to patch long_click
uiautomator2/ext/htmlreport/__init__.py
uiautomator2/ext/htmlreport/__init__.py
# coding: utf-8 # from __future__ import print_function import functools import inspect import json import os import shutil import sys import time import types import uiautomator2 from PIL import ImageDraw def mark_point(im, x, y): """ Mark position to show which point clicked Args: im: pillow....
Python
0
@@ -2272,31 +2272,276 @@ e = -os.path.relpath(stk%5B1%5D) +stk%5B1%5D%0A try:%0A filename = os.path.relpath(filename)%0A except ValueError: # Windows: maybe on other driver, eg: C:/ F:/%0A continue%0A if filename.find(%22/site-packages/%22) != -1: # Lin...
566879a0b097787d9f98eb224d416042c3c24a22
Fix so that redis is not called when REDIS is disabled.
pybossa/cache/__init__.py
pybossa/cache/__init__.py
# -*- coding: utf8 -*- # This file is part of PYBOSSA. # # Copyright (C) 2015 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
@@ -2835,78 +2835,8 @@ gs)%0A - sentinel.master.setex(key, timeout, pickle.dumps(output))%0A @@ -3786,78 +3786,8 @@ gs)%0A - sentinel.master.setex(key, timeout, pickle.dumps(output))%0A
fa2f28dceba5a5b7cfe8d300f2666d8125bb94d4
Fix typo
v7/import_goodreads/import_goodreads.py
v7/import_goodreads/import_goodreads.py
# -*- coding: utf-8 -*- # Copyright © 2012-2014 Juanjo Conti. # 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, ...
Python
0.999999
@@ -3695,17 +3695,16 @@ %22) + %22Ra -i ting: %25s
7d0fc8cf7043bfa9e7202932fccff9b629e8148a
Return by default error status code 500
pybossa/error/__init__.py
pybossa/error/__init__.py
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # 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...
Python
0.000002
@@ -1893,17 +1893,17 @@ tatus = -2 +5 00%0A
27d6832c6cb7aef33ff5946f018c79c243119ca9
Fix typo in credits
pydux/thunk_middleware.py
pydux/thunk_middleware.py
""" thunks for pydux original from https://github.com/aearon/redux-thunk """ def thunk_middleware(store): dispatch, get_state = store['dispatch'], store['get_state'] def wrapper(next_): def thunk_dispatch(action): if hasattr(action, '__call__'): return action(dispatch, get...
Python
0.00164
@@ -47,16 +47,17 @@ hub.com/ +g aearon/r
685f41bde2b2dd59d1c9a3f0d5666f98f277b175
Make task table name plural for consistency
pyfarm/models/core/cfg.py
pyfarm/models/core/cfg.py
# No shebang line, this module is meant to be imported # # Copyright 2013 Oliver Palmer # # 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 # # U...
Python
0.00002
@@ -3167,16 +3167,17 @@ %22%25stask +s %22 %25 TABL
056135e2214047e2f429c6106b957e987a587ca2
add exception type to try block
pylinac/core/utilities.py
pylinac/core/utilities.py
"""Utility functions for pylinac.""" import decimal from collections import Iterable import numpy as np def is_close(val, target, delta=1): """Return whether the value is near the target value(s). Parameters ---------- val : number The value being compared against. target : number, itera...
Python
0.000001
@@ -620,16 +620,17 @@ except +( Attribut @@ -631,24 +631,36 @@ tributeError +, TypeError) :%0A ta
cff9d1f299bad28adcab1e4f279d045a28e319d2
Update pylsy_test.py
pylsy/tests/pylsy_test.py
pylsy/tests/pylsy_test.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import os import unittest from pylsy import pylsytable TEST_DIR = os.path.dirname(__file__) class PylsyTableTests(unittest.TestCase): def setUp(self): attributes = ["name", "age"] self.table = pylsytable(attributes) def tearD...
Python
0
@@ -474,17 +474,17 @@ pend_dat -e +a (%22name%22,
44a4de1e1839c4222067e65e17ae36e332481be5
Address PR comment 1
version_metadata/validate_experiment.py
version_metadata/validate_experiment.py
from .sraparse import SRAParseObjSet, SRAParseObj, XMLValidator from .utils import cmn, json2, logger, sanity_check_fail from .validate_json import JsonSchema from .ihec_validator_base import IHECJsonValidator from . import exp_semantic_rules from . import validate_main class ExperimentValidator(IHECJsonValidator):...
Python
0
@@ -99,27 +99,8 @@ gger -, sanity_check_fail %0Afro @@ -247,16 +247,36 @@ te_main%0A +from . import utils%0A %0A%0Aclass @@ -2010,24 +2010,30 @@ objset:%0A%09%09%09 +utils. sanity_check @@ -2149,16 +2149,22 @@ y%22):%0A%09%09%09 +utils. sanity_c @@ -2725,12 +2725,8 @@ idator)%0A -%0A%0A%0A%0A
02e4e1d37499fe895f8ab69be687802c49aec10c
Fix scheduler initialization log (#12105)
src/python/pants/pantsd/pants_daemon_core.py
src/python/pants/pantsd/pants_daemon_core.py
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import logging import threading from contextlib import contextmanager from typing import Iterator from typing_extensions import Protocol from pants.bu...
Python
0
@@ -5330,16 +5330,93 @@ hanged = + (%0A self._prior_dynamic_remote_options is not None%0A and dynamic @@ -5461,32 +5461,42 @@ _remote_options%0A + )%0A if remot @@ -6138,16 +6138,64 @@ hanged = + (%0A self._fingerprint is not None and options @@ -6220,32 +6220,42 ...
9a178fd9e92d89deb636455383dfed9584eb3d29
add return code
python/GetHash/getHash.py
python/GetHash/getHash.py
import hashlib import argparse import os.path from colorama import init, Fore # init colorama init() supported_hashes = ['md5', 'sha1', 'sha256', 'sha512', 'sha3-256', 'sha3-512'] def calculate_hash(input, hash_types=supported_hashes, compare_hash=None): hash_types = supported_hashes if hash_types is None else [...
Python
0.001506
@@ -39,16 +39,27 @@ os.path%0A +import sys%0A from col @@ -1167,73 +1167,233 @@ -else:%0A print(Fore.LIGHTRED_EX + 'XX ' + result_str + if len(hash_types) == 1:%0A return sys.exit(0)%0A else:%0A print(Fore.LIGHTRED_EX + 'XX ' + result_str)%0A ...
88633d0f7cbe8c41e17470ea2366acad6fbf91b5
Add beeping
python/games/countdown.py
python/games/countdown.py
import graphics import time import datetime import game class Countdown(game.Game): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.timer = graphics.Rectangle(112, 7, x=0, y=8) self.text = graphics.TextSprite("1:00:00.000 REMAIN", x=0, y=0, width=5, height=7) ...
Python
0.999
@@ -689,16 +689,17 @@ if +( not self @@ -704,16 +704,17 @@ lf.light +) and tdi @@ -731,10 +731,9 @@ %3C= -90 +6 0:%0A @@ -954,38 +954,38 @@ self. -sprites.add(self.timer +trigger(%22beeper%22, %22on%22 )%0A @@ -1110,69 +1110,66 @@ elf. -sprites.remove(self.timer)%0A self.blink...
e3a5dc68f62074f04981baedfc249789433cd0bd
Make the logic of _calculate_votes clearer
pythoncz/models/github.py
pythoncz/models/github.py
import os import itertools import warnings from datetime import datetime import requests from werkzeug.contrib.cache import FileSystemCache from pythoncz import app __all__ = ('get_issues',) get_issues_graphql_filename = ( os.path.join(os.path.dirname(__file__), 'github_get_issues.graphql') ) with open(get_is...
Python
0.023087
@@ -3718,223 +3718,202 @@ # F -rom the query we get the total number of reactions (including +irst, count *all* reactions as %22+1%22%0A score = issue%5B'reactions'%5D%5B'totalCount'%5D%0A %0A # -the %22downvotes%22), and the number of THUMBS_DOWN, and the number%0A # of CONFUSED.%0A%0A return (%0A ...
41c40bc7b76a4ae8333164742733cf448979f658
add debug logging when starting session
pythonx/vdebug/session.py
pythonx/vdebug/session.py
from __future__ import print_function import socket import vim from . import dbgp from . import error from . import event from . import listener from . import log from . import opts from . import util class SessionHandler: def __init__(self, ui, breakpoints): self.__ui = ui self.__breakpoints ...
Python
0
@@ -3049,32 +3049,84 @@ _session(self):%0A + log.Log(%22create session%22, log.Logger.DEBUG)%0A self.__s @@ -3221,24 +3221,75 @@ ymapper())%0A%0A + log.Log(%22start session%22, log.Logger.DEBUG)%0A stat @@ -3345,24 +3345,75 @@ nnection())%0A + log.Log(%22refresh event%22, log.L...
c95b5df7e1214f297c7d90bb65dac47765695a62
Add documentation on `distributed` optional argument
qnd/train_and_evaluate.py
qnd/train_and_evaluate.py
import tensorflow.contrib.learn.python.learn.learn_runner as learn_runner from .experiment import def_def_experiment_fn from .flag import FLAGS, add_output_dir_flag def def_train_and_evaluate(batch_inputs=True, prepare_filename_queues=True, distributed=False): ...
Python
0.000001
@@ -747,24 +747,139 @@ arguments. +%0A - %60distributed%60: If %60True%60, set up flags to train and evaluate models%0A on a distributed system. %0A%0A - Retu
c54a1b05f3d443efb1bc1267b772262c087c6bfa
remove debug
quizfactory/views/game.py
quizfactory/views/game.py
from quizfactory import app from quizfactory.models import Game from flask import session, jsonify, request games = {} def get_game_from_session(quiz_id): global games return games[session[quiz_id]] @app.fine_route() def get_game(quiz_id): try: game = get_game_from_session(quiz_id) except K...
Python
0.000002
@@ -909,23 +909,8 @@ son%0A - print(data) %0A
b6b279b0d8139d9f8ba2a3368a996c9ee312e503
Fix 500 happening if no quote is found
quotes_page/core/views.py
quotes_page/core/views.py
import random import time from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import RequestContext from django.core.cache import cache from django.utils import simplejson from django.views.decorators.cache import cache_page import _qi as qi from core.models impor...
Python
0.000002
@@ -1964,16 +1964,36 @@ orfeit%22) + if quote else False %0A %7D%0A%0A
6e39106d6963f3a28b4705363cf5650eb75de605
Test submit_pin method defined for a charge
paystackapi/charge.py
paystackapi/charge.py
"""Script used to define the paystack Charge class.""" from paystackapi.base import PayStackBase class Charge(PayStackBase): """docstring for Charge.""" @classmethod def charge(cls, **kwargs): """ Start a charge. Args: email: Customer's email address amou...
Python
0
@@ -695,366 +695,8 @@ in%0A%0A - Returns:%0A Json data from paystack API.%0A %22%22%22%0A return cls().requests.post('charge', data=kwargs,)%0A%0A @classmethod%0A def submit_pin(cls, **kwargs):%0A %22%22%22%0A Submit PIN to continue a charge.%0A%0A Args:%0A ...
a65eee6a954b1e7509e3809db120b2c58847697a
Add hostname to page ID.
perfbucket/storage.py
perfbucket/storage.py
import pycassa import time import datetime import json import uuid KEYSPACE = "perfbucket" cassandra_pool = None def _get_cassandra_connection(): global cassandra_pool if cassandra_pool is None: cassandra_pool = pycassa.pool.ConnectionPool(KEYSPACE) return cassandra_pool def _jsonify(fields): ...
Python
0
@@ -2039,12 +2039,16 @@ %22%7B0%7D -? +/ %7B1%7D +?%7B2%7D %22.fo @@ -2052,16 +2052,64 @@ .format( +metadata%5B%22SERVER%22%5D.get(%22HTTP_HOST%22, %22unknown%22), metadata
995e7a9deb3d544e3f8759490ead42d1b6e72963
Disable escape-enter keybinding in vi mode
pgcli/key_bindings.py
pgcli/key_bindings.py
from __future__ import unicode_literals import logging from prompt_toolkit.enums import EditingMode from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.filters import ( completion_is_selected, is_searching, has_completions, has_selection, ) from .pgbuffer import buffer_should_be_han...
Python
0
@@ -268,16 +268,29 @@ ection,%0A + vi_mode,%0A )%0A%0Afrom @@ -3435,16 +3435,33 @@ %22enter%22 +, filter=~vi_mode )%0A de
afeba0c4c3ab49af092c7c85e026d5ee98ab5706
work on progress
phedorabot/webhook.py
phedorabot/webhook.py
#!/usr/bin/env python # # Copyright 2017 Phedorabot # # 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.000016
@@ -674,16 +674,18 @@ tement%0A%0A +# from phe @@ -723,16 +723,18 @@ IClient%0A +# from phe @@ -813,16 +813,1599 @@ ashlib%0A%0A +def flatten_payload(attrs, parent_key=None):%0A blobs = %7B%7D%0A if attrs is None or not type(attrs) in %5Btypes.DictType, types.ListType%5D:%0A return blobs%0A%0A de...
2b7223196b59dc82649fb8a4218fb0772e39aef4
add NullHandler in the case there is no top one specified
utils.py
utils.py
import csv import re import logging logger = logging.getLogger("optimize") def load_mass_windows(filename): with open(filename, 'r') as f: return {l[0]: tuple(l[1:4]) for l in csv.reader(f, delimiter='\t')} #@echo(write=logger.debug) did_regex = re.compile('\.?(?:00)?(\d{6,8})\.?') def get_did(filename): glo...
Python
0.000001
@@ -68,16 +68,57 @@ timize%22) +%0Alogger.addHandler(logging.NullHandler()) %0A%0Adef lo
3906979a2aaf775da5b989fb33a4f4cee5f2c1db
Avoid meaningless comparison that leads to a TypeError
utils.py
utils.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # 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
@@ -3522,20 +3522,19 @@ _code', -None +200 )%0A
c6dc9affeddef46d1ad6f3719df655d92bdca8e3
change default SSL mode to prefer.
redash/query_runner/pg.py
redash/query_runner/pg.py
import os import json import logging import select import psycopg2 from redash.query_runner import * from redash.utils import JSONEncoder logger = logging.getLogger(__name__) types_map = { 20: TYPE_INTEGER, 21: TYPE_INTEGER, 23: TYPE_INTEGER, 700: TYPE_FLOAT, 1700: TYPE_FLOAT, 701: TYPE_FLOA...
Python
0
@@ -6156,23 +6156,22 @@ slmode=' +p re -quire +fer ',%0A
7242d88984713c2b164b639ba0b99f7d1e3cc87f
Include percentages for report 4
reports/report_builder.py
reports/report_builder.py
# Python import StringIO from collections import OrderedDict # 3rd Party import xlsxwriter from django_countries import countries from django.db.models import Count # Project from forms.models import ( InternetNewsSheet, TwitterSheet, NewspaperSheet, TelevisionSheet, RadioSheet) from forms.modelu...
Python
0.000002
@@ -535,16 +535,177 @@ t)%5D%0A)%0A%0A%0A +def p(n, d):%0A %22%22%22 Helper to calculate the percentage of n / d,%0A returning 0 if d == 0.%0A %22%22%22%0A if d == 0:%0A return 0.0%0A return float(n) / d%0A%0A%0A class XL @@ -1050,16 +1050,127 @@ utput)%0A%0A + # setup formats%0A ...
48b5cc56ce5ac5cdd9c144c6b285ff90832116b7
use pystatsd pipeline to send batches
src/diamond/handler/stats_d.py
src/diamond/handler/stats_d.py
# coding=utf-8 """ Implements the abstract Handler class, sending data to statsd. This is a UDP service, sending datagrams. They may be lost. It's OK. #### Dependencies * [python-statsd](http://pypi.python.org/pypi/python-statsd/) * [statsd](https://github.com/etsy/statsd) v0.1.1 or newer. #### Configuration En...
Python
0
@@ -3851,32 +3851,110 @@ name, value)%0A%0A + if hasattr(statsd, 'StatsClient'):%0A self.connection.send()%0A self.met @@ -4341,16 +4341,27 @@ ) +.pipeline() %0A
a15e43fbe07f09b90f6d102969176622ae5650e6
Remove unneeded code
src/wirecloud/platform/preferences/models.py
src/wirecloud/platform/preferences/models.py
# -*- coding: utf-8 -*- # Copyright 2008-2015 Universidad Politécnica de Madrid # This file is part of Wirecloud. # Wirecloud 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 L...
Python
0.000018
@@ -2403,31 +2403,8 @@ one%0A - pref_exists = True%0A @@ -2677,46 +2677,8 @@ alue -%0A else:%0A pref_exists = False %0A%0A @@ -2763,127 +2763,8 @@ UAGE -%0A if not pref_exists:%0A PlatformPreference.objects.create(user=user, name=%22language%22, value=lang_code) %0A%0A
dc4d3348a8295852261ce497e454ba06de50482b
Update deploy settings
src/encoded/commands/deploy.py
src/encoded/commands/deploy.py
from boto.ec2.blockdevicemapping import ( BlockDeviceMapping, BlockDeviceType, ) import boto.ec2 import boto.exception import getpass import re import subprocess import sys import time def nameify(s): name = ''.join(c if c.isalnum() else '-' for c in s.lower()).strip('-') return re.subn(r'\-+', '-', n...
Python
0.000001
@@ -3975,16 +3975,16 @@ ami- -5189a661 +1c1eff2f ',%0A @@ -4059,11 +4059,11 @@ 2015 -032 +101 5%22)%0A @@ -4130,14 +4130,13 @@ 't2. -medium +large ',%0A @@ -4160,17 +4160,17 @@ ify 'c4. -2 +4 xlarge'
bff5e72da9f3df488c7d99149497ea41b6366944
Fix typo.
tensorflow/contrib/rnn/python/ops/gru_ops.py
tensorflow/contrib/rnn/python/ops/gru_ops.py
# Copyright 2016 The TensorFlow 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 applica...
Python
0.999999
@@ -3293,12 +3293,11 @@ the -LSTM +GRU cel
63d2fdf99b421122562809d2764bc134f0768069
remove youku logo from video title
youku.py
youku.py
#!/usr/bin/env python import urllib2 import json from random import randint from time import time import re import os.path import shutil def youku_url(url): if re.match(r'http://v.youku.com/v_show/id_(\w+).html', url): return url m = re.match(r'http://player.youku.com/player.php/sid/(\w+)/v.swf', url) if m: re...
Python
0
@@ -734,16 +734,117 @@ utf-8')%0A +%09title = title.replace(u' - %5Cu89c6%5Cu9891 - %5Cu4f18%5Cu9177%5Cu89c6%5Cu9891 - %5Cu5728%5Cu7ebf%5Cu89c2%5Cu770b', '')%0A %09subtitl
9361dae8e567fbdca12e79cb10817114e238d14a
Return self from setup()
test/functional/test_framework/test_shell.py
test/functional/test_framework/test_shell.py
#!/usr/bin/env python3 # Copyright (c) 2019 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import BitcoinTestFramework class TestShell: """Wrapper Class for Bitc...
Python
0.000001
@@ -1439,16 +1439,40 @@ g = True +%0A return self %0A%0A
a4197ae909579fdb74e812521c6af1aa567d4afa
comment how to run zoner.py
zoner.py
zoner.py
# NOT SUPPORTED: BOTH "quotes" and (parens) on same line. # We handle quotes first, then get continuation lines. # So if quotes are on a continuation line, we will not see it. # This simplfies the case of parens and semicolons in the quotes, # which we do handle. # Demo: # cat ~/yak/bind/yak/[a-z]*.*[a-z] | p rye run ...
Python
0
@@ -352,16 +352,101 @@ ilt %7C m%0A +#%0A# p rye run zoner.py -- -port=9991 yak/zhuk.com %7C p ../rye/errfilt/errfilt %7C m%0A%0A %0Afrom go
a7e757bc1aadcd09ea080b719bfd40edf13c05dd
Replace new-bootstrap with bootstrap
utils/swift_build_support/swift_build_support/products/swiftpm.py
utils/swift_build_support/swift_build_support/products/swiftpm.py
# swift_build_support/products/swiftpm.py -----------------------*- python -*- # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.tx...
Python
0.000026
@@ -971,12 +971,8 @@ ', ' -new- boot
3fc05761dde38927924ec0bbee637d3fa917538b
add method _to_str(value) --> string
HpSpec.py
HpSpec.py
from abc import ABCMeta, abstractmethod import unittest class HpSpec(object): 'specification of a model name and its associated hyperparamters' __metaclass__ = ABCMeta @abstractmethod def __str__(self): 'return parsable string representation' pass @staticmethod @abstractmetho...
Python
0.000036
@@ -740,16 +740,483 @@ pass%0A%0A + def _to_str(self, value):%0A def remove_trailing_zeroes(s):%0A return (%0A s if s%5B-1%5D != '0' else%0A remove_trailing_zeroes(s%5B:-1%5D)%0A )%0A if value is None:%0A return ''%0A elif isinsta...
e14e6fbbd2bc5c262f6f7df0df5732edff8d7de6
add new version (#22836)
var/spack/repos/builtin/packages/py-importlib-metadata/package.py
var/spack/repos/builtin/packages/py-importlib-metadata/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyImportlibMetadata(PythonPackage): """Read metadata from Python packages.""" homepag...
Python
0
@@ -427,16 +427,113 @@ ar.gz%22%0A%0A + version('3.10.0', sha256='c9db46394197244adf2f0b08ec5bc3cf16757e9590b02af1fca085c16c0d600a')%0A vers @@ -616,24 +616,24 @@ e8d0e95da')%0A - version( @@ -1005,16 +1005,81 @@ 12db')%0A%0A + depends_on('python@3.6:', type=('build', 'run'), when='@3:')%0A depe...
1ba0a361ac17321939a7124ba0bcf85f7a4bf13e
FIX sorting
tools/getSparqlStatistic.py
tools/getSparqlStatistic.py
import argparse import os import sys from collections import defaultdict from postprocess import processdata from utility import utility import config from pprint import pprint parser = argparse.ArgumentParser(description="Prints out the SPARQL statistic") parser.add_argument("--monthsFolder", "-m", default=config.mon...
Python
0.000001
@@ -1136,589 +1136,8 @@ er:%0A - notStatisticNames = %5B'#Valid', '#ToolName', '#ToolVersion',%0A '#StringLengthWithComments', '#QuerySize',%0A '#VariableCountHead', '#VariableCountPattern',%0A '#TripleCountWithService', '#TripleCountNoService'...
d02ed340c275ccd008645b280716aa0d33067022
Add cleanup for measurements that use tracing
telemetry/telemetry/page/page_measurement_unittest_base.py
telemetry/telemetry/page/page_measurement_unittest_base.py
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest from telemetry.core import util from telemetry.page import page_runner from telemetry.page import page as page_module from telemetry.pag...
Python
0.000001
@@ -2081,16 +2081,1209 @@ tions, options)%0A +%0A def TestTracingCleanedUp(self, measurement_class, options=None):%0A ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html')%0A start_tracing_called = %5BFalse%5D%0A stop_tracing_called = %5BFalse%5D%0A%0A class BuggyMeasurement(measurement_class):%0...
6631134c9f66bc31c0ac4e95f21a4c54cc7fb028
Update tmfapi639 datasource
vitrage/datasources/tmfapi639/driver.py
vitrage/datasources/tmfapi639/driver.py
# Copyright 2020 # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
Python
0.000083
@@ -582,16 +582,32 @@ port log +%0Aimport requests %0A%0Afrom v @@ -659,72 +659,8 @@ ase%0A -from vitrage.datasources.tmfapi639 import TMFAPI639_DATASOURCE%0A%0A from @@ -724,37 +724,70 @@ fig%0A -%0Aimport json%0Aimport requests%0A +from vitrage.datasources.tmfapi639 import TMFAPI639_DATASOURCE %0A%0ALO @@ -2186...
3eecab585a96844a3c8dfcce105c2a6ab9c3d3d0
implement minor bug fixes for get_pbs
source_synphot/passband.py
source_synphot/passband.py
# -*- coding: UTF-8 -*- """ Instrumental throughput models and calibration and synthetic photometry routines """ from __future__ import absolute_import from __future__ import unicode_literals from . import io import numpy as np import pysynphot as S from collections import OrderedDict def synflux(spec, pb): """ ...
Python
0
@@ -4368,18 +4368,16 @@ or i, pb -, mag in e @@ -4412,16 +4412,40 @@ mags)):%0A + pb, mag = pbmag%0A @@ -4495,25 +4495,16 @@ spbzp = -passband. get_pb_z @@ -4506,22 +4506,20 @@ _pb_zpt( -source +this pb, mode
33389268a49821eef85cf651bdc7c52d5399fd12
Add test for app forking with absolute target path, refs PR #2995.
tests/integration/core/test_customisation.py
tests/integration/core/test_customisation.py
from os.path import exists, join import sys import tempfile import pytest from django.conf import settings from django.test import TestCase, override_settings from oscar.core import customisation VALID_FOLDER_PATH = 'tests/_site/apps' class TestUtilities(TestCase): def test_subfolder_extraction(self): ...
Python
0
@@ -2972,18 +2972,15 @@ Test -ThirdParty +ForkApp (Tes @@ -3175,16 +3175,28 @@ est_fork +_third_party (self):%0A @@ -3963,8 +3963,411 @@ 'myapp'%0A +%0A def test_absolute_target_path(self):%0A tmpdir = tempfile.mkdtemp()%0A customisation.fork_app('order', tmpdir, 'order')%0A sys.path.append...
32a2a256eb792b3e7e5501e0f41e117cff8c1fdb
Fix ranks in CTFTime scoreboard feed
web/ctf_gameserver/web/scoring/views.py
web/ctf_gameserver/web/scoring/views.py
from django.http import JsonResponse from django.shortcuts import render from . import models, calculations from .decorators import competition_started_required @competition_started_required def scoreboard(request): game_control = models.GameControl.objects.get() if game_control.competition_over(): ...
Python
0
@@ -1242,16 +1242,25 @@ .items() +, start=1 ):%0A
c0f2a1592c389eabc15c8bbacdc9259453411d70
fix warnings in graphql tests
web/impact/impact/tests/test_graphql.py
web/impact/impact/tests/test_graphql.py
# MIT License # Copyright (c) 2017 MassChallenge, Inc. import json from django.urls import reverse from impact.graphql.middleware import NOT_LOGGED_IN_MSG from impact.tests.api_test_case import APITestCase from impact.tests.factories import ( EntrepreneurFactory, ExpertFactory, StartupMentorRelationshipFac...
Python
0
@@ -52,20 +52,8 @@ nc.%0A -import json%0A from @@ -4918,32 +4918,33 @@ mat(id=user.id)%0A +%0A resp @@ -4943,159 +4943,235 @@ -response = self.client.post(self.url, data=%7B'query': query%7D)%0A response_payload = json.loads(response.content)%0A self.assertEqual(%0A +with cap...
0fb7e31ea11a2d52616e75b022358a67473b3a91
Remove exact from validation plot.
src/validate.py
src/validate.py
""" A script to draw the validation plots. """ import pandas as pd import axelrod as axl import matplotlib.pyplot as plt import generate_cache import theoretic import functools import multiprocessing import itertools def simulated_fixation(strategy_pair, N, i=1, repetitions=10, cachefile=None...
Python
0.000001
@@ -1033,605 +1033,8 @@ ns%0A%0A -def exact_fixation(strategy_pair, N, i=1, repetitions=10,%0A turns=200):%0A %22%22%22Run an exact Moran process and obtain the fixation probabilities%22%22%22%0A%0A players = %5B%5D%0A for _ in range(i):%0A players.append(strategy_pair%5B0%5D)%0A f...
627f446473f0000ee91ecf081ecff9ea46c01adf
check corrent CRC for measurements block
rstt_cli/udp_client.py
rstt_cli/udp_client.py
#!/bin/sh/python3 import socket from frame import Frame from calibration import Calibration from sys import argv class UdpClient: """UDP client for reversing data from meteosonde.""" def __init__(self, addr='127.0.0.1', port=5003, data_log=None, calib_log=None): self.sock = socket.socket(socket.AF_IN...
Python
0
@@ -1,13 +1,14 @@ #!/ +usr/ bin -/sh /pyt @@ -1474,32 +1474,33 @@ return%0A +# self._dump_frame @@ -1511,33 +1511,32 @@ (frame)%0A -# self._dump_frame @@ -1621,17 +1621,17 @@ ame._crc -1 +2 _ok:%0A
3516641320813b9cd1dcfaedf8b24716159236b2
Update Zenedeley node_settings serialization
website/addons/base/serializer.py
website/addons/base/serializer.py
import abc from framework.auth.decorators import collect_auth from website.util import api_url_for, web_url_for class AddonSerializer(object): __metaclass__ = abc.ABCMeta # TODO take addon_node_settings, addon_user_settings def __init__(self, node_settings=None, user_settings=None): self.node_se...
Python
0
@@ -666,24 +666,233 @@ pass%0A%0A + @property%0A def can_share(self):%0A '''%0A Does the third party service expose a way to share content?%0A%0A defaults to False unless overidden in subclass%0A '''%0A return False%0A%0A @propert @@ -1093,24 +1093,64 @@ lized_urls,...
8450580b6d79979b015f8fd61cef71d909bc3db0
correct url
testserver/test/acceptance/pages/__init__.py
testserver/test/acceptance/pages/__init__.py
base_url = 'http://71c52982.ngrok.com' user_name = 'testuser3' user_email = 'testuser1@edx.org' password = 'ARbi12.,'
Python
0.987814
@@ -16,26 +16,23 @@ p:// -71c52982.ngrok.com +127.0.0.1:8000/ '%0Aus @@ -54,9 +54,9 @@ user -3 +1 '%0Aus
61dce6375e39c20f571049161da2a341f2592393
Fix basic tagger test
thinc/tests/integration/test_basic_tagger.py
thinc/tests/integration/test_basic_tagger.py
from __future__ import print_function import pytest from ...neural.vec2vec import Model, ReLu, Softmax from ...neural._classes.feed_forward import FeedForward from ...neural._classes.batchnorm import BatchNorm from ...neural._classes.embed import Embed from ...neural._classes.convolution import ExtractWindow from ...n...
Python
0.000071
@@ -2049,36 +2049,8 @@ %5B%5D%0A - print(type(train_X%5B0%5D))%0A @@ -2327,14 +2327,94 @@ loss + = %5B%5D%0A loss = %5B%5D%0A for i in range(len(yh)):%0A dl , l -oss = c @@ -2437,16 +2437,28 @@ entropy( +yh%5Bi%5D, y%5Bi%5D) %0A @@ -2470,51 +2470,55 @@ ...
774fbb172e0e0e1d0d0c390a19d36c400c8e8352
Add docstrings
corehq/apps/locations/dbaccessors.py
corehq/apps/locations/dbaccessors.py
from itertools import imap, chain from dimagi.utils.chunked import chunked from dimagi.utils.couch.database import iter_docs from corehq.apps.es import UserES from corehq.apps.locations.models import SQLLocation def _cc_users_by_location(domain, location_id, include_docs=True, wrap=True, user_class=None): from c...
Python
0.000005
@@ -4512,24 +4512,205 @@ ation_ids):%0A + %22%22%22%0A Creates a generator for iterating through the user ids of the all the users in the%0A given domain whose primary location is given in the list of location_ids.%0A %22%22%22%0A for loca @@ -4945,24 +4945,208 @@ type_code):%0A + %22%22%22%0A ...
266aecd7e1cbca4a9add43fbaa53e0af5c6ab400
Reformat score table
scrabble-score/scrabble_score.py
scrabble-score/scrabble_score.py
# File: sscrabble_score.py # Purpose: Write a program that, given a word, computes the scrabble score for that word. # Programmer: Amal Shehu # Course: Exercism # Date: Tuesday 27 September 2016, 01:27 PM score_table = { 1: "A, E, I, O, U, L, N, R, S, T", 2: "D, G",...
Python
0.000001
@@ -8,17 +8,16 @@ : -s scrabble @@ -247,213 +247,235 @@ - 1: %22A, E, I, O, U, L, N, R, S, T%22,%0A 2: %22D, G%22,%0A 3: %22B, C, M, P%22,%0A 4: %22F, H, V, W, Y%22,%0A 5: %22K%22,%0A 8: %22J, X%22,%0A 10: %22Q, Z%22 +...
bb87c5c3339b5b7ce926829047582889ac1eb87c
Add missing URLs to staging report
scripts/GenerateStagingReport.py
scripts/GenerateStagingReport.py
#coding=UTF-8 from BuildArchetypes import archetypes, getDeploymentContext from BuildDemos import demos import argparse, cgi parser = argparse.ArgumentParser(description="Build report generator") parser.add_argument("version", type=str, help="Vaadin version that was just built") parser.add_argument("deployUrl", type=...
Python
0.000002
@@ -529,16 +529,98 @@ sitory%22) +%0Aparser.add_argument(%22tbapiUrl%22, type=str, help=%22URL for the TestBench API build%22) %0A%0Aargs = @@ -1563,16 +1563,22 @@ rsion%7D%22%3E +Close Trac Mil @@ -1590,32 +1590,287 @@ e%3C/a%3E%3C/td%3E%3C/tr%3E%0A +%3Ctr%3E%3Ctd%3E%3Ca href=%22https://dev.vaadin.com/query?stat...
b2ea004e4dd28768ad4889023af847b1ca8fb64d
Bump internal SDK version
scripts/build/sdk_build_utils.py
scripts/build/sdk_build_utils.py
import os import re import sys import subprocess import argparse import shutil import json SDK_VERSION = '4.2.0' def makedirs(dir): try: if not os.path.exists(dir): os.makedirs(dir) except: e = sys.exc_info()[1] print("Exception %s while creating directory %s" % (str(e), dir)) return False ...
Python
0
@@ -106,9 +106,9 @@ '4. -2 +3 .0'%0A
fc8853523b78c812c2184f425a17c382dc4f588e
Fix memory leak. Handle errors gracefully.
scripts/create-allura-sitemap.py
scripts/create-allura-sitemap.py
""" Generate Allura sitemap xml files. """ import os, sys from datetime import datetime from jinja2 import Template from pylons import c from allura import model as M from ming.orm import session, ThreadLocalORMSession PROJECTS_PER_FILE = 1000 BASE_URL = 'http://sourceforge.net' INDEX_TEMPLATE = """\ <?xml version=...
Python
0
@@ -162,16 +162,48 @@ el as M%0A +from allura.lib import security%0A from min @@ -1942,16 +1942,55 @@ MPLATE)%0A + creds = security.Credentials.get()%0A for @@ -2008,16 +2008,16 @@ ffsets:%0A - @@ -2131,16 +2131,37 @@ ect = p%0A + try:%0A @@ -2212,16 +2212,185 @@ emap()...
99e187d27ecdd97c029763dcb0bf3997f7e138e2
add new line
sources/opsagent/daemon.py
sources/opsagent/daemon.py
''' Madeira OpsAgent Daemoniser class @author: Thibault BRONCHAIN ''' # System imports import sys import os import time import atexit from signal import SIGTERM,SIGINT,SIGKILL # Daemon class class Daemon(): def __init__(self, config, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): self.conf...
Python
0.002414
@@ -4170,16 +4170,18 @@ running +%5Cn %22)%0A @@ -4235,16 +4235,18 @@ running +%5Cn %22)%0A%0A
cfb7fdbe9f7dd2bdd9b577dae3a1581065d5589c
Change url handling in quotes
gargbot_3000/quotes.py
gargbot_3000/quotes.py
#! /usr/bin/env python3.6 # coding: utf-8 from gargbot_3000.logger import log # Core import re import html import random from operator import itemgetter import time # Internal from gargbot_3000 import config # Dependencies import bbcode from htmlslacker import HTMLSlacker # Typing from typing import List, Optional ...
Python
0.000002
@@ -1665,32 +1665,80 @@ False%0A )%0A + inp = inp.replace('rel=%22nofollow%22', %22%22)%0A inp = HT
87e146bf45bcb71619f6d70fc0a291c8daf8ee00
Fix bug
prompty/svn.py
prompty/svn.py
#!/usr/bin/env python # vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: import vcs import re import xml.dom.minidom SVN_COMMAND="svn" class Subversion(vcs.VCSBase): def __init__(self, status, cmd=SVN_COMMAND): super(Subversion, self).__init__(status, cmd) def _runStatus(self): try:...
Python
0.000001
@@ -2728,16 +2728,17 @@ .search( +r '%5B%5C%5E%5D?/(
eea9a6016dcbdbd69ab547841fb863a1466c8882
Allow jinja replacement in notifymyandroid 'application' option. fix #1759
flexget/plugins/output/notifymyandroid.py
flexget/plugins/output/notifymyandroid.py
import logging from flexget.plugin import register_plugin from flexget.utils.template import RenderError log = logging.getLogger('notifymyandroid') __version__ = 0.1 headers = {'User-Agent': "FlexGet NMA plugin/%s" % str(__version__)} url = 'https://nma.usk.bz/publicapi/notify' class OutputNotifyMyAndroid(object): ...
Python
0.000012
@@ -1713,24 +1713,89 @@ %5B'apikey'%5D)%0A + priority = entry.get('priority', config%5B'priority'%5D)%0A @@ -1872,59 +1872,169 @@ -priority = entry.get('priority', config%5B'priority'%5D +try:%0A application = entry.render(application)%0A except RenderError, e:%...
76445f34c1745e40e30fbda6958511ebe6e2ce7e
Have found that there is little variation in the different category variables. I don't think this will work as is for a decent set of predictions.[[(3, 3086), (1, 121), (2, 10)], [(3, 2732), (1, 452), (2, 33)], [(3, 2215), (1, 958), (2, 44)], [(3, 2124), (1, 1026), (2, 67)], [(3, 2002), (1, 1164), (2, 51)], [(3, 2016),...
kaggle/cross-device-conns/analyse_home_rolled.py
kaggle/cross-device-conns/analyse_home_rolled.py
import pandas as pd from collections import Counter class Homogeneity(object): SAME = 1 # eg "b b b b" MIX = 2 # eg "a b a a" DIFF = 3 # eg "a b c d" @staticmethod def categorise(ul): if len(ul) == len(set(ul)): return DIFF if len(set(ul)) == 1: ...
Python
0.99995
@@ -87,17 +87,19 @@ SAME = -1 +'s' # eg @@ -120,17 +120,19 @@ MIX = -2 +'m' # eg @@ -157,9 +157,11 @@ F = -3 +'d' @@ -1648,65 +1648,274 @@ h)%0A%0A - # if len(category_similarities) %3E 10:%0A # break%0A%0A%0A +# Order categories by influence%0Adistributions = %5BCounter(category_sim...
39b51c39d09bb06809f1c4945bd863cb2dc62300
Fix compatibility with Django 1.9
ixwsauth_server/middleware/__init__.py
ixwsauth_server/middleware/__init__.py
""" Classes and functions to manage Web services authentication """ import base64 from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.cache import cache from django.http import HttpResponseForbidden from django.utils.crypto import constant_time_compare from django...
Python
0.000001
@@ -302,16 +302,86 @@ compare%0A +%0Atry:%0A from importlib import import_module%0Aexcept ImportError:%0A from dja
8a75cc4626bd38faeec102aea894d4e7ac08646c
Update description of collection viewer example
viewer_examples/viewers/collection_viewer.py
viewer_examples/viewers/collection_viewer.py
""" ===================== CollectionViewer demo ===================== Demo of CollectionViewer for viewing collections of images. This demo uses successively darker versions of the same image to fake an image collection. You can scroll through images with the slider, or you can interact with the viewer using your key...
Python
0
@@ -143,65 +143,55 @@ ses%0A -successively darker versions of the same image to fake an +the different layers of the gaussian pyramid as ima
023e60ccca10fd7149a5af20aa14623dc0855fe2
Remove comma
vision/snippets/face_detection/faces_test.py
vision/snippets/face_detection/faces_test.py
# Copyright 2016, 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, sof...
Python
0.99998
@@ -9,17 +9,16 @@ ght 2016 -, Google
90cd321ec90fd44ed305b630f5687c1607c65cd4
Fix _page_urls_for_sites() to combine page_path and route_path values to create 'old_path' values for redirects
wagtail/contrib/redirects/signal_handlers.py
wagtail/contrib/redirects/signal_handlers.py
import logging from typing import Iterable, Set, Tuple from django.conf import settings from django.db.models import Q from wagtail.core.models import Page, Site from wagtail.core.utils import BatchCreator, get_dummy_request from .models import Redirect logger = logging.getLogger(__name__) class BatchRedirectCr...
Python
0.000001
@@ -3235,59 +3235,105 @@ -urls.add((site, Redirect.normalise_path(page +normalized_route_path = Redirect.normalise_page_route_path(route_path)%0A old _path -), + = Red @@ -3346,38 +3346,136 @@ normalise_pa -ge_route_path( +th(page_path.rstrip(%22/%22) + (normalized_route_path or %22/%22))%0A ...
b5f37477b374132d8ad5507fb526c4078da4ef04
Convert remaining "yield from"s to "await"s in filesystem provider
waterbutler/providers/filesystem/provider.py
waterbutler/providers/filesystem/provider.py
import os import shutil import asyncio import datetime import mimetypes from waterbutler.core import streams from waterbutler.core import provider from waterbutler.core import exceptions from waterbutler.core.path import WaterButlerPath from waterbutler.providers.filesystem import settings from waterbutler.providers....
Python
0.003168
@@ -21,23 +21,8 @@ til%0A -import asyncio%0A impo @@ -709,38 +709,21 @@ e)%0A%0A -@ async -io.coroutine%0A def val @@ -1135,38 +1135,21 @@ r)%0A%0A -@ async -io.coroutine%0A def val @@ -1302,38 +1302,21 @@ se%0A%0A -@ async -io.coroutine%0A def int @@ -1379,34 +1379,29 @@ exists =...
f93fcd5cee878c201dd1be2102a2a9433a63c4b5
Make streamable artist updates as they happen, rather than commiting at the end of all artists
scripts/set-artist-streamable.py
scripts/set-artist-streamable.py
#!/usr/bin/env python import psycopg2 as ordbms import urllib, urllib2 import xml.etree.cElementTree as ElementTree class SetArtistStreamable: def __init__(self): self.conn = ordbms.connect ("dbname='librefm'") self.cursor = self.conn.cursor() def updateAll(self): """Sets artists streamable ...
Python
0
@@ -713,39 +713,8 @@ ))%0A%09 -%09print %22Applying changes... %22,%0A %09%09se @@ -733,24 +733,8 @@ it() -%0A%09%09print %22done.%22 %0A%0Aif
564d2eedf6e2b62152869c60bf1f3ba18287d8c0
Add extra tag which displays the occurrence duration in a smart way
fullcalendar/templatetags/fullcalendar.py
fullcalendar/templatetags/fullcalendar.py
from django import template from fullcalendar.models import Occurrence register = template.Library() @register.inclusion_tag('events/agenda_tag.html') def show_agenda(*args, **kwargs): qs = Occurrence.objects.upcoming() if 'limit' in kwargs: qs = qs[:int(kwargs['limit'])] return { 'occu...
Python
0
@@ -20,16 +20,50 @@ template +%0Afrom django.utils import timezone %0A%0Afrom f @@ -998,28 +998,470 @@ %5B'limit'%5D)%5D%0A%0A return qs%0A%0A +@register.simple_tag%0Adef occurrence_duration(occurrence):%0A start = timezone.localtime(occurrence.start_time)%0A end = timezone.localtime(occurrence.end_time)%0A...
c0af8c4e598b4ae3a8c260048c8468186af42009
switch back to lab.kmol.info
publishconf.py
publishconf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals # This file is only used if you use `make publish` or # explicitly specify it as your config file. import os import sys sys.path.append(os.curdir) from pelicanconf import * # 因為 publishconf.py 在 pelicanconf.py 之後, 因此若兩處有相同變數的設定, ...
Python
0
@@ -421,36 +421,39 @@ %0ASITEURL = 'http -s :// +lab. kmol.info/lab/do @@ -442,38 +442,24 @@ b.kmol.info/ -lab/doc/trunk/ blog'%0A# for
ff54a1b1f9fc727a246eb8c300472c1049ba7276
fix panel test
wheelcms_axle/tests/test_panel.py
wheelcms_axle/tests/test_panel.py
""" The panel method in the Main handler is responsible for filling the link/image selection/upload browser. It does a lot of stuff and needs some tests. """ from ..models import Node from .models import Type1 from wheelcms_axle.tests.models import TestImage from wheelcms_axle.tests.models import TestFile ...
Python
0
@@ -1404,16 +1404,17 @@ h'%5D == ' +/ '%0A%0A @@ -4379,16 +4379,17 @@ h'%5D == ' +/ '%0A
5af8b02d8603500481af03483a2a3debeb01e586
Update models.py
workbench-backend/index/models.py
workbench-backend/index/models.py
from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User from enum import Enum class DataType(Enum): """ Enumeration of valid file types """ pass # Leaving this blank until enum values are determined. #NC=1 #DAT=2 #JSON=3 class ...
Python
0
@@ -1069,14 +1069,12 @@ Key( -' User -' )%0A @@ -1166,8 +1166,9 @@ ataType) +%0A
52375daaced4df191b6c253458d47e13f76c00a4
update comment in TableFileNameComposer
AlphaTwirl/Configure/TableFileNameComposer.py
AlphaTwirl/Configure/TableFileNameComposer.py
# Tai Sakuma <tai.sakuma@cern.ch> ##__________________________________________________________________|| class TableFileNameComposer(object): """Compose a name of a file to store the table from the column names and indices. For example, if column names are 'var1', 'var2', and 'var3' and indices are 1, No...
Python
0
@@ -1109,32 +1109,34 @@ fix # e.g. %22tbl_ +n_ component_var1_1 @@ -1209,24 +1209,26 @@ # e.g. %22tbl_ +n_ component.tx
fa428d3e35d2b6aeb6c176f5d97d449d3b310114
Update to v0.7.6
pykeg/setup.py
pykeg/setup.py
#!/usr/bin/env python from distribute_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages VERSION = "0.7.5" SHORT_DESCRIPTION = "Kegbot kegerator controller software" LONG_DESCRIPTION = """This package contains Kegbot core controller and Django frontend package. Kegbot is a hard...
Python
0
@@ -138,17 +138,17 @@ = %220.7. -5 +6 %22%0ASHORT_
c59ea54efef2fcd1763988a535f3a265935b3afe
Mask in float format.
python/mask.py
python/mask.py
import sys import os import xml.dom.minidom import numpy as np # # Makes a ton of assumptions about the XML data. # Totally customize for MRCAP data. Needs to be checked with # anything that's not the original 109 data files on braingraph1 # class MaskXML: """"Class to read the *.xml file and pull out import...
Python
0
@@ -1077,17 +1077,17 @@ dtype=' -b +f ', count
4ab814734454361c42560bae5d3331a26dcaad01
Use correct matrix method
python/test.py
python/test.py
#!/usr/bin/env python from rgbmatrix import RGBMatrix from random import randint import time rows = 16 chains = 1 parallel = 1 ledMatrix = RGBMatrix(rows, chains, parallel) height = ledMatrix.height width = ledMatrix.width for i in range(100): ledMatrix.setPixel(randint(0, width), randint(0, height), randint(0, 255),...
Python
0.000272
@@ -249,17 +249,17 @@ dMatrix. -s +S etPixel(
071efd48020467792a6b147b283edc9235f9b4d5
indent error
python/vise.py
python/vise.py
import Draft,Part import FreeCAD, FreeCADGui import FreeCADGui as Gui from FreeCAD import Base from PySide import QtGui, QtCore from math import fabs import utils class Vise: ''' how to use: obj =FreeCAD.ActiveDocument.addObject("Part::FeaturePython",'Vise') Vise(obj) ViewProviderVise(obj.ViewObje...
Python
0.000005
@@ -174,319 +174,8 @@ se:%0A - '''%0A how to use:%0A obj =FreeCAD.ActiveDocument.addObject(%22Part::FeaturePython%22,'Vise')%0A Vise(obj)%0A ViewProviderVise(obj.ViewObject)%0A FreeCAD.ActiveDocument.recompute()%0A Once you have a vise in the view-%0A change how much the jaw opening is in the D...
8d391d0820e8e78cba504cfc447fbc2b1c48ecf4
use a different shuffle algo
pywal/image.py
pywal/image.py
""" Get the image file. """ import os import random import sys from .settings import CACHE_DIR from . import util from . import wallpaper def get_random_image(img_dir): """Pick a random image file from a directory.""" current_wall = wallpaper.get() current_wall = os.path.basename(current_wall) file_...
Python
0.001474
@@ -658,24 +658,52 @@ ys.exit(1)%0A%0A + random.shuffle(images)%0A%0A return o @@ -727,29 +727,17 @@ ir, -random.choice( images -) +%5B0%5D .nam
eaef8a05c238a91a97f1c0b1aa6628c0d949df85
Copy qa_utils.AssertIn from 1.2 branch
qa/qa_utils.py
qa/qa_utils.py
# # # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed ...
Python
0
@@ -1561,24 +1561,201 @@ Colours()%0A%0A%0A +def AssertIn(item, sequence):%0A %22%22%22Raises an error when item is not in sequence.%0A%0A %22%22%22%0A if item not in sequence:%0A raise qa_error.Error('%25r not in %25r' %25 (item, sequence))%0A%0A%0A def AssertEq
473ea77a54e0b85403ceb00cfd78bb540cd8e2e3
Remove pyqtVariants
qtpy/QtCore.py
qtpy/QtCore.py
# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtCore classes and functions. """ from qtpy import PYQT5, PYQT4, PYSIDE, PythonQtError if PYQT5: from PyQ...
Python
0.000003
@@ -532,32 +532,133 @@ R as __version__ +%0A%0A # Those are imported from %60import *%60%0A del pyqtSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR %0Aelif PYQT4:%0A @@ -1110,16 +1110,117 @@ ersion__ +%0A%0A # Those are imported from %60import *%60%0A del pyqtSignal, pyqtSlot, pyqtProperty, QT_VERSION_...
74577faa2468a0b944cef3c88c9b8a82a4881ff1
Change results page title to include query (or "Error" on error).
query/views.py
query/views.py
""" Views for the rdap_explorer project, query app. """ import ipwhois from django.http import HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from django.views.decorators.cache import cache_page from json import dumps from .forms import QueryForm def index(request): if...
Python
0
@@ -741,16 +741,38 @@ query):%0A + title = 'Results'%0A erro @@ -780,16 +780,16 @@ = None%0A - resu @@ -959,16 +959,47 @@ w=True)%0A + title = ip.address_str%0A exce @@ -1073,16 +1073,40 @@ ror = e%0A + title = 'Error'%0A retu @@ -1163,25 +1163,21 @@ title': -'Results' +title...
831fe557a7396a8c7b49fc8074701d848e86a39f
first_octave could be < 0
cyvlfeat/sift/sift.py
cyvlfeat/sift/sift.py
import numpy as np from .cysift import cy_sift def sift(image, n_octaves=None, n_levels=3, first_octave=0, peak_thresh=0, edge_thresh=10, norm_thresh=None, magnification=3, window_size=2, frames=None, force_orientations=False, float_descriptors=False, compute_descriptor=False, verbose=Fa...
Python
0.99991
@@ -4897,87 +4897,8 @@ 0')%0A - if first_octave %3C 0:%0A raise ValueError('first_octave must be %3E= 0')%0A
4df95a308df693e45c5c0378c38f1bbe989bde94
Fix conv2d tests to check non-cuDNN path even if cuDNN is available
tests/chainer_tests/functions_tests/test_convolution_2d.py
tests/chainer_tests/functions_tests/test_convolution_2d.py
import unittest import numpy import six.moves.cPickle as pickle import chainer from chainer import cuda from chainer import functions from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.testing import condition from chainer.utils import conv class TestConvolu...
Python
0
@@ -363,24 +363,8 @@ self -, use_cudnn=True ):%0A @@ -406,29 +406,16 @@ ution2D( -%0A 3, 2, 3, @@ -434,29 +434,8 @@ ad=1 -, use_cudnn=use_cudnn )%0A @@ -1280,24 +1280,16 @@ cpu(col, - 2, 2, 1 @@ -1438,56 +1438,17 @@ -@attr.cudnn%0A @condition.retry(3)%0A def test +def check ...
27f47ef27654dfa9c68bb90d3b8fae2e3a281396
Move out app setup to setup file to finish cleaning up the init file
pitchfork/__init__.py
pitchfork/__init__.py
# Copyright 2014 Dave Kludt # # 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
@@ -572,941 +572,72 @@ e.%0A%0A -from flask import Flask, g%0Afrom happymongo import HapPyMongo%0Afrom config import config%0Afrom adminbp import bp as admin_bp%0Afrom manage_globals import bp as manage_bp%0Afrom engine import bp as engine_bp%0Afrom inspect import getmembers, isfunction%0A%0A%0Aimport context_function...
5fbb9819e3e42f3d29abec5426e5a29c3f785600
Add repeat record ID
custom/enikshay/reports/repeaters.py
custom/enikshay/reports/repeaters.py
from django.utils.html import escape from django.utils.translation import ugettext as _ from django.urls import reverse from corehq.apps.repeaters.dbaccessors import iter_repeat_records_by_domain from corehq.apps.domain.views import DomainForwardingRepeatRecords from corehq.apps.repeaters.dbaccessors import get_repeate...
Python
0.000007
@@ -1874,24 +1874,70 @@ columns = %5B%0A + DataTablesColumn(_('Record ID')),%0A @@ -2466,24 +2466,48 @@ row = %5B%0A + record._id,%0A
9a98c6256a8e7c16f6b4194f5fa34447605022cd
Make `3_2_make_json_` really fast by using subprocess and `grep -v`
data/3_2_make_json_for_each_pheno.py
data/3_2_make_json_for_each_pheno.py
#!/usr/bin/env python2 from __future__ import print_function, division, absolute_import import gzip import glob import heapq import re import os.path import json def parse_marker_id(marker_id): chr1, pos1, ref, alt, chr2, pos2 = re.match(r'([^:]+):([0-9]+)_([-ATCG]+)/([-ATCG]+)_([^:]+):([0-9]+)', marker_id).grou...
Python
0
@@ -87,20 +87,8 @@ rt%0A%0A -import gzip%0A impo @@ -95,16 +95,16 @@ rt glob%0A + import h @@ -133,16 +133,26 @@ os.path%0A +import os%0A import j @@ -154,16 +154,34 @@ ort json +%0Aimport subprocess %0A%0Adef pa @@ -420,16 +420,59 @@ f, alt%0A%0A +tmp_file = '/var/pheweb_data/tmp_3_2.vcf'%0A%0A files_to @@ -...
c1086230073f69a2e8b17d082e2cc2967488103e
Change thumbnail name format
src/competition/models/competition_model.py
src/competition/models/competition_model.py
from django.db import models from django.conf import settings from django.dispatch import receiver from django.db.models.signals import pre_save, post_save, post_syncdb from django.template.defaultfilters import slugify from django.core.exceptions import ValidationError from django.core.validators import validate_slug ...
Python
0.000002
@@ -3971,16 +3971,22 @@ name +, _ext = os.pa @@ -4038,12 +4038,12 @@ rn %22 -t_ %7B%7D +_t .png
42a76adff446b79fec589394e2e6dc289f048151
Update __version__.py
irc_bot/__version__.py
irc_bot/__version__.py
__version__ = '1.0.34'
Python
0.000079
@@ -17,7 +17,7 @@ .0.3 -4 +5 '%0A
d3a94689d55571932777a453c6910058f14d7ef6
Move import
ramses/auth.py
ramses/auth.py
""" Auth module that contains all code needed for authentication/authorization policies setup. In particular: :includeme: Function that actually creates routes listed above and connects view to them :create_system_user: Function that creates system/admin user :_setup_ticket_policy: Setup Pyramid Au...
Python
0.000001
@@ -635,16 +635,68 @@ onPolicy +%0Afrom pyramid.security import Allow, ALL_PERMISSIONS %0A%0Afrom n @@ -7029,72 +7029,8 @@ ls:%0A - from pyramid.security import Allow, ALL_PERMISSIONS%0A
13a8a702722047d0db727b5fdb57a5506bf33179
Update random_walk.py
random_walk.py
random_walk.py
#Author: Samuel DeLaughter #12/6/14 #This program graphs the probability of landing on each integer in a given interval for a 1D random-walk simulation #If called with a -i flag, it will prompt for user input on the following variables: #Boundary numbers, starting position, number of steps per simulation, number of s...
Python
0
@@ -1,9 +1,11 @@ -# +%22%22%22 Author: @@ -22,17 +22,16 @@ aughter%0A -# 12/6/14%0A @@ -31,17 +31,16 @@ 2/6/14%0A%0A -# This pro @@ -146,17 +146,16 @@ ulation%0A -# If calle @@ -231,17 +231,16 @@ ables:%0A%09 -# Boundary @@ -321,16 +321,20 @@ ulations +%0A%22%22%22 %0A%0Aimport
63cb8dc1449f6cab87bd7910276d0e06dfd0b228
Set up basic webhook for Messenger
rasdoor/app.py
rasdoor/app.py
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World' if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')
Python
0.000003
@@ -16,16 +16,32 @@ rt Flask +, abort, request %0Aapp = F @@ -56,16 +56,68 @@ ame__)%0A%0A +VERIFY_TOKEN = 'temp_token_to_replace_with_secret'%0A%0A @app.rou @@ -169,16 +169,619 @@ World'%0A%0A +@app.route('/webhook/facebook_messenger', methods=%5B'GET', 'POST'%5D)%0Adef facebook_webhook():%0A if request.method...