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
1bba6908b29e6a58d7ad98af588ef116d3129b85
move code to separate method and take care with bool8 overflows
kameleon_mcmc/mcmc/samplers/DiscreteKameleon.py
kameleon_mcmc/mcmc/samplers/DiscreteKameleon.py
""" Copyright (c) 2013-2014 Heiko Strathmann All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and th...
Python
0
@@ -1563,16 +1563,134 @@ t randn%0A +from operator import xor%0A%0Afrom kameleon_mcmc.distribution.DiscreteRandomWalkProposal import DiscreteRandomWalkProposal %0Afrom ka @@ -1862,101 +1862,8 @@ ler%0A -from kameleon_mcmc.distribution.DiscreteRandomWalkProposal import DiscreteRandomWalkProposal%0A %0A%0Acl @@ -3536...
2eff2b835fe4a042c06b92844c9fa5c92cbeb3ea
change json to yaml when publishing legacy latest files (#186)
runtime_builders/publish_builders.py
runtime_builders/publish_builders.py
#!/usr/bin/python # Copyright 2017 Google Inc. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by app...
Python
0
@@ -638,20 +638,8 @@ lob%0A -import json%0A impo @@ -1632,12 +1632,12 @@ ing -JSON +yaml ! Ch @@ -1918,20 +1918,20 @@ dir, '*. -json +yaml ')):%0A @@ -1984,13 +1984,18 @@ g = -json. +yaml.safe_ load
dfbedc63d6d8bce2a90feda98989f763eee1f2f4
update example to latest changes in Bites
Samples/Python/bites_sample.py
Samples/Python/bites_sample.py
import Ogre import OgreRTShader import OgreOverlay import OgreBites class SampleApp(OgreBites.ApplicationContext, OgreBites.InputListener): def __init__(self): OgreBites.ApplicationContext.__init__(self, "PySample", False) OgreBites.InputListener.__init__(self) self.addInputListener(self) ...
Python
0
@@ -279,44 +279,8 @@ elf) -%0A self.addInputListener(self) %0A%0A @@ -1100,24 +1100,60 @@ .setup(self) +%0A self.addInputListener(self) %0A%0A ro
34d1447dd64213ec272818bd1a99a18a01babf2b
handle missing licence from epmc fulltext
octopus/modules/epmc/client.py
octopus/modules/epmc/client.py
from octopus.core import app from octopus.lib import dataobj import urllib, requests from lxml import etree class EuropePMCException(Exception): def __init__(self, httpresponse, *args, **kwargs): super(EuropePMCException, self).__init__(*args, **kwargs) self.response = httpresponse class EPMCFullT...
Python
0
@@ -3929,24 +3929,74 @@ l = l%5B0%5D%0A + else:%0A return None, None, None%0A type
20202ab774bc064cb23d2c8a7c811e08d968b8da
Add forgotten import.
fedmsg/commands/relay.py
fedmsg/commands/relay.py
# This file is part of fedmsg. # Copyright (C) 2012 Red Hat, Inc. # # fedmsg is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. #...
Python
0
@@ -824,16 +824,28 @@ %22%22%0A%22%22%22%0A%0A +import zmq%0A%0A from fed
6780b069dcbe180edb78038184f8829df843e7c2
use event injector according to advice at users@qpid.apache.org
main.py
main.py
#!/usr/bin/env python2 import threading from multiprocessing import Queue try: from Tkinter import * except ImportError: from tkinter import * import time import proton from proton.reactor import Container, AtMostOnce from proton.handlers import MessagingHandler class ChatWindow(object): def __init__(se...
Python
0
@@ -220,17 +220,50 @@ MostOnce +, EventInjector, ApplicationEvent %0A - from pro @@ -1583,16 +1583,54 @@ ddress%0A%0A + self.events = EventInjector()%0A @@ -1780,16 +1780,64 @@ start')%0A + event.container.selectable(self.events)%0A @@ -2114,36 +2114,34 @@ self. -send +on ...
b9243eacec4868464cfc6dbeb826af63b0952c18
Fix get_initial to take current value into account. Thanks @d0ugal
feedhq/profiles/views.py
feedhq/profiles/views.py
from django.contrib import messages from django.contrib.sites.models import RequestSite from django.core.urlresolvers import reverse_lazy from django.shortcuts import redirect from django.utils.translation import ugettext as _ from django.views import generic from password_reset import views from .forms import (Chang...
Python
0
@@ -1881,16 +1881,41 @@ %7B'ttl': + self.request.user.ttl or 365%7D%0Apr
27d920372b215da7cb2625ce6d7d3f3666bf16e9
Improve spelling
openfisca_country_template/variables/housing.py
openfisca_country_template/variables/housing.py
# -*- coding: utf-8 -*- # This file defines the variables of our legislation. # A variable is property of a person, or an entity (e.g. a household). # See http://openfisca.org/doc/variables.html # Import from openfisca-core the common python objects used to code the legislation in OpenFisca from openfisca_core.model_...
Python
0.998348
@@ -680,11 +680,10 @@ met -te r +e s%22%0A%0A @@ -1130,10 +1130,10 @@ e lo -g d +g er'%0A
d40b7bdb2cfa846aa170222d8e6eeb477cbf8633
update pipeline-demo
pipeline/demo/pipeline-demo.py
pipeline/demo/pipeline-demo.py
from pipeline.backend.pipeline import PipeLine from pipeline.component.dataio import DataIO from pipeline.component.input import Input from pipeline.component.intersection import Intersection from pipeline.component.hetero_lr import HeteroLR from pipeline.interface.data import Data from pipeline.backend.config import B...
Python
0
@@ -19,120 +19,121 @@ end. -pipeline import PipeLine%0Afrom pipeline.component.dataio import DataIO%0Afrom pipeline.component.input import Input +config import Backend%0Afrom pipeline.backend.config import WorkMode%0Afrom pipeline.backend.pipeline import PipeLine %0Afro @@ -157,28 +157,22 @@ ent. -intersect +data i...
2ee27b5b177bcb056889096a265b7a1ef2c21aff
Be more deterministic in the discriminator
adhocracy/lib/instance/discriminator.py
adhocracy/lib/instance/discriminator.py
import logging from adhocracy import model from pylons import config log = logging.getLogger(__name__) class InstanceDiscriminatorMiddleware(object): def __init__(self, app, domain): self.app = app self.domain = domain log.debug("Host name: %s." % domain) def __call__(self, environ...
Python
0.999985
@@ -62,16 +62,59 @@ t config +%0Afrom paste.deploy.converters import asbool %0A%0Alog = @@ -506,32 +506,115 @@ ce_key is None:%0A + if asbool(config.get('adhocracy.urls_without_hostname', 'false')):%0A path @@ -657,16 +657,20 @@ + + if path. @@ -688,16 +688,20 @@ '/i/'):%...
39e6b8e9e5d3edaf8448b7ebc4ab17989b012ba1
Add a test for setter and deleter.
server/kcsapi/model_test.py
server/kcsapi/model_test.py
#!/usr/bin/env python import pytest import model class TestJsonSerializableObject(object): def test_default_getter(self): class DefaultGetter(model.JsonSerializableObject): # Can decorate without any arguments. @model.jsonproperty def field_foo(self): ...
Python
0
@@ -3170,16 +3170,911 @@ o%22%7D%7D')%0A%0A + def test_getter_setter_deleter(self):%0A class GetterSetterDeleter(model.JsonSerializableObject):%0A def __init__(self, foo):%0A self._foo = foo%0A%0A @model.jsonproperty%0A def field_foo(self):%0A re...
1abeecd3806d4766ecd321e93574950df9da0f43
Work on build failure issue (conflicting files)
cs207rbtree/cs207rbtree/test_RedBlackTree.py
cs207rbtree/cs207rbtree/test_RedBlackTree.py
from pytest import raises import unittest import numpy as np from RedBlackTree import * import os class RedBlackTreeTest(unittest.TestCase): def test_smoke(self): "Smoke test to make sure unbalanced tree is working" db = self.get_f("/tmp/test1.dbdb") db.set("rahul", "aged") db.set(...
Python
0
@@ -1,12 +1,67 @@ +import sys%0Asys.path.insert(0, os.path.abspath('../'))%0A%0A from pytest
ce02f48ea85b64a5a4503b22d3fb324c521904d0
Enable graphiql only when DEBUG=True
saleor/urls.py
saleor/urls.py
from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static from django.contrib import admin from django.contrib.sitemaps.views import sitemap from django.contrib.staticfiles.views import serve from graphene_django.views import GraphQLView from .cart.urls impor...
Python
0.000041
@@ -1235,12 +1235,22 @@ iql= -True +settings.DEBUG )),%0A
3bac87763eb92738f8c211930d2554f624395c43
test w test params, test with ndim >1
ogusa/tests/test_parameters.py
ogusa/tests/test_parameters.py
import os import tempfile import pytest from ogusa.parameters import Specifications, revision_warnings_errors # JSON_REVISION_FILE = """{ # "revision": { # "frisch": 0.3 # } # }""" @pytest.fixture(scope='module') def revision_file(): f = tempfile.NamedTemporaryFile(mode="a", delete=False) f....
Python
0
@@ -33,16 +33,35 @@ pytest%0A +import numpy as np%0A from ogu @@ -541,16 +541,282 @@ specs%0A%0A%0A +def test_create_specs_object_test():%0A specs = Specifications(test=True)%0A assert specs%0A%0A%0Adef test_compute_default_params():%0A specs = Specifications()%0A specs.alpha_G = np.ones((10, 1))%0A ...
aedf9938a26ddd67520ed5e957e56d468affccd5
fix dict iterable
ogusa/tests/test_parameters.py
ogusa/tests/test_parameters.py
import os import sys CUR_PATH = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(CUR_PATH, "../../")) import pytest import pickle from ogusa.parameters import (get_parameters, read_tax_func_estimate, USER_MODIFIABLE_PARAMS) from ogusa import parameters def test_par...
Python
0.000024
@@ -813,36 +813,32 @@ k, v in dd_meta. -iter items():%0A @@ -822,32 +822,32 @@ d_meta.items():%0A + assert d @@ -1167,36 +1167,32 @@ k, v in dd_meta. -iter items():%0A @@ -1637,36 +1637,32 @@ k, v in dd_meta. -iter items():%0A @@ -1965,32 +1965,32 @@ metadata=True)%0A + for k...
ae5977e960b1f4d7953b1929ad1e2ab96e746fce
Add a quick test for `every` mode
tests/test_arguments.py
tests/test_arguments.py
import pytest import datetime import argparse from ding import ding # Valid arguments def test_time_a_second_in_the_past(): a_second_ago = datetime.datetime.now() - datetime.timedelta(seconds=1) time_str = str(a_second_ago.time()).split('.')[0] assert ding.get_args(['at', time_str]) def test_time_a_minu...
Python
0.000063
@@ -1144,24 +1144,150 @@ gs(%5B'at'%5D)%0A%0A +def test_insufficient_arguments_at():%0A with pytest.raises(SystemExit) as excinfo:%0A assert ding.get_args(%5B'every'%5D)%0A%0A def test_in_
10b828cd80a0ce7702a49d2e7b3cc6ce82997ab8
Fix test_basic_api.
tests/test_basic_api.py
tests/test_basic_api.py
# -*- coding: utf-8 -*- """ Pygments basic API tests ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2006-2007 by Georg Brandl. :license: BSD, see LICENSE for more details. """ import os import unittest import StringIO import random from pygments import lexers, formatters, filters, format from pygments.token im...
Python
0.000002
@@ -108,9 +108,9 @@ -200 -7 +8 by @@ -5451,29 +5451,189 @@ -inst.get_style_defs() +try:%0A inst.get_style_defs()%0A except NotImplementedError:%0A # may be raised by formatters for which it doesn't make sense%0A pass %0A
67c6506bcc454eeba3aca223fe1de415eb684e4d
Replace os.tempnam with tempfile for python3 (#537)
tests/test_binary_io.py
tests/test_binary_io.py
# Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD+Patents license found in the # LICENSE file in the root directory of this source tree. #! /usr/bin/env python2 """Binary indexes (de)serialization""" import numpy as np import unittest import faiss impo...
Python
0
@@ -318,16 +318,32 @@ mport os +%0Aimport tempfile %0A%0Adef ma @@ -978,28 +978,50 @@ mpnam = -os. temp -nam() +file.NamedTemporaryFile().name %0A @@ -1952,20 +1952,42 @@ m = -os. temp -nam() +file.NamedTemporaryFile().name %0A%0A
f347a01bce5ecbfcc14f0742917046a23935c7c5
fix tests
tests/test_callables.py
tests/test_callables.py
import contextlib from hacheck.compat import nested import mock import json import os from unittest import TestCase import hacheck.haupdown import hacheck.spool # can't use an actual mock.sentinel because it doesn't support string ops sentinel_service_name = 'testing_service_name' class TestCallable(TestCase): ...
Python
0.000001
@@ -600,39 +600,16 @@ ignored' -, sentinel_service_name %5D + list @@ -865,16 +865,31 @@ wn.main( +'status_downed' )%0A @@ -1033,32 +1033,55 @@ f.setup_wrapper( +%5Bsentinel_service_name%5D ) as (spooler, m @@ -1191,32 +1191,40 @@ k.haupdown.main( +'status' ))%0A m @@ -1412,16 +1412,24 @@ wn.m...
9a81d1070cae8adece92702b795bf44c66005562
Remove trailing whitespace
tests/test_configure.py
tests/test_configure.py
# Run these tests with 'nosetests': # install the 'python-nose' package (Fedora/CentOS or Ubuntu) # run 'nosetests' in the root of the repository import unittest from mock import patch import configure class BasicTests(unittest.TestCase): def setUp(self): # 'setUp' breaks Pylint's naming rules ...
Python
0.00121
@@ -338,17 +338,16 @@ le=C0103 - %0A @@ -619,17 +619,16 @@ les(url) - %0A @@ -747,33 +747,32 @@ os.path.exists') - %0A @patch('con @@ -1156,33 +1156,32 @@ -k%22, %22-L%22, %22-o%22, - %0A %22pl @@ -1223,33 +1223,32 @@ p-0.9.8.tar.gz%22, - %0A sel @@ -1262,24 +1262,1...
cc934035033eff97ac698d9fa9b54b38dd2fbe9d
Update main.py
main.py
main.py
# Under MIT License, see LICENSE.txt import sys import argparse from PyQt5.QtWidgets import QApplication from qtpy import QtCore from Controller.MainController import MainController __author__ = 'RoboCupULaval' def argumentParser(argument): """ Argument parser """ parser = argparse.ArgumentParser(descript...
Python
0
@@ -57,16 +57,31 @@ rgparse%0A +import warnings %0A%0A%0Afrom @@ -987,16 +987,71 @@ = 10022%0A + elif args.use_type == 'real':%0A port = 10020%0A else @@ -1054,16 +1054,22 @@ else: # + force real-li @@ -1071,16 +1071,119 @@ al-life%0A + warnings.warn(%22Unrecognized use_type argument. for...
c5c67d08470de703ebcd249439c5c189c487e505
Add a lock
main.py
main.py
from subprocess import Popen, PIPE import threading import Queue import argparse from itertools import product class Tailor(threading.Thread): def __init__(self, queue, server, file): threading.Thread.__init__(self) self.server = server self.file = file self.queue = queue self.daemon = True s...
Python
0.00001
@@ -177,18 +177,45 @@ er, file -): +, lock):%0A self.lock = lock %0A thr @@ -479,24 +479,186 @@ nect(self):%0A + #I was getting some weird results where one thread would block out another%0A #acquiring releasing the lock seems to work%0A self.lock.acquire()%0A try:%0A command @@ -743,24 +74...
473ff95fcd1ac784cc3492a4727d668a10270594
add today filter
main.py
main.py
# -*- coding: utf-8 -*- import sys import urllib import subprocess import argparse # Constants URL = "http://www.gifu-nct.ac.jp/gakka/keijiyou/keijiyou.pdf" LOCALPDF = "keijiyou.pdf" LOCALTEXT = "keijiyou.txt" def download(): urllib.urlretrieve(URL, LOCALPDF) def pre_parse(): cmd = "pdftotext -raw " + LOCAL...
Python
0
@@ -77,16 +77,33 @@ rgparse%0A +import datetime%0A%0A %0A# Const @@ -445,16 +445,128 @@ rn let%0A%0A +def get_date():%0A today = datetime.date.today()%0A return str(today.monnth+1) + %22%E6%9C%88%22 + str(today.day) + %22%E6%97%A5%22%0A%0A%0A def filt @@ -771,24 +771,112 @@ nen, map) %0A%0A +def filter_today...
34bd4dec6bc60ff676874c13cb993a8123bd0ddc
handle the exception of an invalid bitly url
main.py
main.py
#!/usr/bin/python import urllib import urllib2 import json import settings as s class ConsoleBitly: def shorten(self,req): url="http://api.bitly.com/v3/shorten?login="+s.bitly_username+"&apiKey="+s.bitly_apikey+"&longUrl="+req print "Please wait... \n" response=urllib2.urlopen(url) a = json.loads(response.rea...
Python
0.000149
@@ -407,32 +407,40 @@ pand(self,req):%0A +%09%09try:%0A%09 %09%09url=%22http://ap @@ -521,32 +521,33 @@ &shortUrl=%22+req%0A +%09 %09%09print %22Please @@ -552,32 +552,33 @@ e wait... %5Cn%22%0A%09%09 +%09 response=urllib2 @@ -583,32 +583,33 @@ b2.urlopen(url)%0A +%09 %09%09a = json.loads @@ -618,32 +618,33 @@...
b57e12c4e01559ce5bcb1588b14758429ad552df
Revert "fix: error instance to pytest"
tests/test_envconfig.py
tests/test_envconfig.py
import pytest @pytest.mark.parametrize("attribute, value", [ ('ATTRIBUTE_STR', 'default_str'), ('ATTRIBUTE_INT', 1), ('ATTRIBUTE_FLOAT', 1.5), ('ATTRIBUTE_BOOL', True), ]) def test_get_attributes(config, attribute, value): assert getattr(config, attribute) == value def test_set_existing_attribut...
Python
0
@@ -1659,10 +1659,8 @@ rror -() ):%0A
86b1574c6a3c379d104433f4b57eca8c65e454fe
fix prefix
main.py
main.py
# coding=utf-8 from base64 import b64decode, b64encode from os import environ import urllib from zlib import decompress, MAX_WBITS from bs4 import BeautifulSoup from flask import Flask, request, jsonify from google.appengine.api import urlfetch from requests import Session from re import compile as re_compile app = Fl...
Python
0.000075
@@ -909,17 +909,17 @@ ents) %3E -2 +4 :%0A @@ -1072,17 +1072,17 @@ guments%5B -6 +5 %5D if len
22675199efd1ee80304ed31a108505d84341d5ab
fix tests
tests/test_genomeops.py
tests/test_genomeops.py
import pandas as pd import bioframe import numpy as np from io import StringIO import os.path as op import pytest testdir = op.realpath(op.dirname(__file__)) ### todo: test make_chromarms(chromsizes, mids, binsize=None, suffixes=("p", "q")): def test_binnify(): chromsizes = bioframe.read_chromsizes(testdir+"/t...
Python
0.000001
@@ -335,24 +335,45 @@ chrom.sizes%22 +, filter_chroms=False )%0A assert
e392fa449150d91dcd07de00c4b9f8133d66e97f
convert a genbank file to a ppt file
genbank_to_ppt/genbank_to_ppt.py
genbank_to_ppt/genbank_to_ppt.py
""" Convert a genbank file to a .ppt file This is a simple genbank to tbl converter using BioPython """ import os import sys import binascii import gzip import re from Bio import SeqIO def is_gzip(gbkf): """ Is the file compressed? :param gbkf: :return: true if compressed else false """ with ...
Python
0.00152
@@ -1748,20 +1748,22 @@ +(len (feat. -length +seq) / 3
484b0d1d764a413f54f9e5f6f99eca84e6a947cd
Make rocket threads daemonized. Ignore tickets and sessions
main.py
main.py
# -*- coding: utf-8 -*- import sys import socket import logging import traceback from select import select from . import SERVER_NAME from .worker import get_method class Rocket: def __init__(self, app_info, method='test', bind_addr = ('127.0.0.1', 8000), ...
Python
0
@@ -500,16 +500,20 @@ worker = + W = get_met @@ -533,28 +533,17 @@ -self._worker +W .app_inf @@ -563,28 +563,17 @@ -self._worker +W .stopSer @@ -592,28 +592,17 @@ -self._worker +W .min_thr @@ -628,28 +628,17 @@ -self._worker +W .max_thr @@ -664,28 +664,17 @@ -sel...
f5ffdefed84c7ddc6dbb4ea897e9f476b5b4d245
Add squares to table.
main.py
main.py
class Square: def __init__(self, coords): pass def add_mark(self, player): pass class Line: def __init__(self, params): pass def squares(self): pass def win(self): pass def not_winnable(self): pass class TTT_Table: def __init__(self, base, power, players): self.base = base s...
Python
0.000005
@@ -331,16 +331,85 @@ = power%0A +%09%09self.squares = %7B%7D%0A%09%09self.add_squares_recursive(self.power - 1, %5B%5D)%0A %09%09self.p @@ -485,33 +485,234 @@ cursive(self -):%0A%09%09pass +, powerleft, list):%0A%09%09for i in range(0, self.power):%0A%09%09%09if powerleft == 0:%0A%09%09%09%09self.squares%5B''.join(...
f082a6839cb3d8586c7949951035003dbce1d14b
Rename some tests to be more explicit
tests/test_paragraph.py
tests/test_paragraph.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from lxml import etree from . import xhtml2odt class ParagraphElements(unittest.TestCase): def test_p1(self): html = '<html xmlns="http://www.w3.org/1999/xhtml"><p>Test</p></html>' odt = xhtml2odt(html) print odt assert...
Python
0.000528
@@ -501,22 +501,26 @@ test_p_ -inside +containing _ul(self @@ -969,22 +969,26 @@ test_p_ -inside +containing _ol(self @@ -1442,22 +1442,26 @@ test_p_ -inside +containing _blockqu @@ -1834,14 +1834,18 @@ t_p_ -inside +containing _pre
44795b29dbeac606e2110ac676c20d2eb7f3edf9
add patches
custom/icds/tests/test_aww_no_submissions.py
custom/icds/tests/test_aww_no_submissions.py
from __future__ import absolute_import from __future__ import unicode_literals from datetime import datetime, timedelta from django.test import TestCase import mock from corehq.apps.domain.shortcuts import create_domain from corehq.apps.locations.tests.util import make_loc, setup_location_types from corehq.apps.users....
Python
0.000001
@@ -2698,27 +2698,34 @@ t_today(self +, patch ):%0A - self @@ -2997,32 +2997,39 @@ en_days_ago(self +, patch ):%0A self. @@ -3319,32 +3319,39 @@ ht_days_ago(self +, patch ):%0A self. @@ -3679,32 +3679,39 @@ ty_days_ago(self +, patch ):%0A self. @@ -4058,24 +4058,31 @@ ays_ago(self...
a28eedba060934d498ac38e8704022dc38c43758
Add stringio from six
tests/test_utilities.py
tests/test_utilities.py
from subprocess import Popen, PIPE from StringIO import StringIO import sys class Capturing(list): def __enter__(self): self._stdout = sys.stdout sys.stdout = self._stringio = StringIO() return self def __exit__(self, *args): self.extend(self._stringio.getvalue().splitlines()...
Python
0.999564
@@ -33,24 +33,19 @@ PE%0Afrom -StringIO +six import
75b628453463a4199468b9f45dc80c22725c2b93
remove unised import
tests/testapp/models.py
tests/testapp/models.py
# coding=utf-8 from __future__ import absolute_import, unicode_literals from django.db import models from model_utils import FieldTracker from tests.testapp.constants import ModelState from tximmutability.models import MutableModel from tximmutability.rule import MutabilityRule class AbstractImmutableModel(MutableM...
Python
0.000006
@@ -98,45 +98,8 @@ dels -%0Afrom model_utils import FieldTracker %0A%0Afr
603d0dbb3ce2911b62f3274e68b93812da9acf2d
Remove SuperOnline and UyduNet DNS addresses
main.py
main.py
# -*- coding: utf-8 -*- """ main.py Jan 14, 2014 Copyright (C) 2014 Barış Şencan """ import os import redis from flask import Flask, render_template, url_for from flask.ext.compress import Compress app = Flask(__name__) # Enable gzip compression. Compress(app) # Static file loading helper. app.jinja_env.globals['s...
Python
0
@@ -69,12 +69,12 @@ Bar -%C4%B1%C5%9F %C5%9E +is S enca @@ -716,113 +716,12 @@ 39') -,%0A 'SuperOnline': ('213.74.0.1', '213.74.1.1'),%0A 'UyduNet': ('62.248.80.161', '62.248.80.162') %0A%7D%0A%0A -%0A @app @@ -748,33 +748,8 @@ ():%0A - status_for = dict()%0A%0A @@ -781,17 +781,57 @@ database -. ...
3788876762107acf272ae91198f7f98e85de3349
Add cache pruning function
main.py
main.py
import hashlib import models import os import os.path def init(): models.db.connect() models.db.create_tables([models.Entry]) def digest(file_path): h = hashlib.sha1() file = open(file_path, 'rb') buf = file.read(8192) while len(buf) > 0: h.update(buf) buf = file.read(8192) ...
Python
0.000001
@@ -3377,8 +3377,254 @@ files')%0A +%0Adef prune():%0A from models import Entry%0A count = 0%0A for entry in Entry.select():%0A if not os.path.exists(entry.path):%0A entry.delete_instance()%0A count += 1%0A print(count, 'non-existent file entries cleared')%0A
9c7660fd63bc1c48a0533e867c7d18faf9d90c03
Make use thru uwsgi easier
main.py
main.py
#!/usr/bin/env python from morss import main if __name__ == '__main__': main()
Python
0
@@ -37,16 +37,44 @@ ort main +, cgi_wrapper as application %0A%0Aif __n
27cbdd93f2c5c723776b932d66a56699f9267b8d
Use single quotes instead of double quotes
main.py
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import re import sys from html.parser import HTMLParser import urllib3 import taglib class MyHTMLParser(HTMLParser): ignore_tags = {"ul", "dl", "dd"} def __init__(self, target_ol_count = 1): self.target_ol_count = target_ol_count ...
Python
0
@@ -199,24 +199,24 @@ = %7B -%22ul%22, %22dl%22, %22dd%22 +'ul', 'dl', 'dd' %7D%0A%0A @@ -465,18 +465,18 @@ e_str = -%22%22 +'' %0A @@ -669,36 +669,36 @@ if tag == -%22ol%22 +'ol' :%0A se @@ -725,36 +725,36 @@ elif tag == -%22li%22 +'li' and self.in_ol @@ -937,12 +937,12 @@ ...
52306859616973bcb6a14b436551506381979f71
edit variable name
main.py
main.py
#!/usr/bin/env python # -*- coding=UTF-8 -*- from os import path from datetime import datetime import logging import sqlite3 import sys import requests from bs4 import BeautifulSoup from config import EMAIL, PASSWORD, DEVICE reload(sys) if hasattr(sys, 'setdefaultencoding'): sys.setdefaultencoding('UTF-8') db ...
Python
0.000004
@@ -39,16 +39,57 @@ -8 -*-%0A%0A +import logging%0Aimport sqlite3%0Aimport sys%0A from os @@ -133,49 +133,8 @@ time -%0Aimport logging%0Aimport sqlite3%0Aimport sys %0A%0Aim @@ -331,16 +331,26 @@ connect( +path.join( sys.path @@ -364,16 +364,17 @@ ain.db') +) %0Acursor @@ -389,22 +389,16 @@ sor()%0A%0As -ess...
b3e61d648be5c5d28cfe3a7ef69f918c2a2c33a1
optimize the logic of mail
main.py
main.py
# -*- coding: utf-8 -*- import mail import simplejson import urllib2 import time from config import * def moniter(m, send_to, high, low): req = urllib2.Request("https://data.btcchina.com/data/ticker") opener = urllib2.build_opener() last_sent = 0 while True: try: f = opener.open(...
Python
0.999999
@@ -16,16 +16,18 @@ tf-8 -*- + %0Aimport @@ -80,29 +80,8 @@ ime%0A -from config import *%0A %0A%0Ade @@ -491,68 +491,8 @@ ow:%0A - for i in range(3):%0A try:%0A @@ -536,24 +536,41 @@ 5 * 60:%0A + try:%0A @@ -614,18 +614,18 @@ arning%22, -%0A...
8e9c04dda00dc565a9a07c37fb43ccb4c5d03969
remove the useless processing for external url.
flask_navigation/item.py
flask_navigation/item.py
import collections from flask import url_for, request from .utils import freeze_dict class Item(object): """The navigation item object. :param label: the display label of this navigation item. :param endpoint: the unique name of this navigation item. If this item point to a interna...
Python
0
@@ -2064,28 +2064,27 @@ if self. -_url is None +is_internal :%0A @@ -2353,16 +2353,21 @@ return +bool( request @@ -2385,16 +2385,17 @@ _current +) %0A%0A @p @@ -2780,32 +2780,36 @@ %22%22%22%0A if +not self.is_internal @@ -2806,32 +2806,86 @@ s_internal:%0A + return False # al...
6b6bbe079a6b68ac82f4caa11473b5b005824715
Update crop_geotiff.py
geobeam/examples/crop_geotiff.py
geobeam/examples/crop_geotiff.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.000001
@@ -652,16 +652,242 @@ y.%0A%22%22%22%0A%0A +def elev_to_centimeters(element):%0A %22%22%22%0A Convert the floating-point to store%0A as INT64 in order to support clustering on this value column (croptype).%0A %22%22%22%0A%0A value, geom = element%0A%0A return (int(value), geom)%0A%0A %0Adef run @@ ...
3cff942af436f16aab2078e6aeedd3073f4a5522
Add Flask-Mail, and null user loader
flask_roots/extension.py
flask_roots/extension.py
from __future__ import absolute_import import os from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.images import Images # from flask.ext.mail import Mail from flask.ext.login import LoginManager from flask.ext.acl import AuthManager class Roots(object): def __init__(self, app): self.extensions...
Python
0.000001
@@ -124,18 +124,16 @@ Images%0A -# from fla @@ -742,16 +742,24 @@ ager'%5D = + login = LoginMa @@ -765,24 +765,72 @@ anager(app)%0A + login.user_callback = lambda uid: None%0A%0A self @@ -1136,16 +1136,61 @@ for?!%0A%0A + self.extensions%5B'mail'%5D = Mail(app)%0A%0A
18897bf535b4885b9dfbf0a014c92656e8ed74b7
Update main to return properly formatted data
main.py
main.py
import telegram import tornado.ioloop import tornado.web from tornado.options import define, options from goodreads_api import get_book_details_by_name, BookNotFound from settings import TELEGRAM_ACCESS_TOKEN, WEBHOOK_URL define("port", default=5000, help="run on the given port", type=int) bot = telegram.Bot(token=T...
Python
0
@@ -160,16 +160,58 @@ otFound%0A +from utils import get_formatted_book_data%0A from set @@ -1840,16 +1840,45 @@ gument)%0A + return 'Invalid command'%0A %0A%0Adef ge @@ -1967,16 +1967,86 @@ ook_name +=book_name)%0A return get_formatted_book_data(book_data=book_data )%0A ex
f9aa61fa326f9737e2af971a420da9c0652612ae
revise BaseDoctype to add generic generation method
tldp/doctypes/common.py
tldp/doctypes/common.py
#! /usr/bin/python from __future__ import absolute_import, division, print_function import os from ..utils import logger class SignatureChecker(object): @classmethod def signatureLocation(cls, f): f.seek(0) buf = f.read(1024).lower() for sig in cls.signatures: try: ...
Python
0
@@ -1193,32 +1193,42 @@ irname)%0A +vector = %5B self.output.clea @@ -1227,20 +1227,31 @@ put.clea -r()%0A +n(),%0A @@ -1271,25 +1271,31 @@ _check() -%0A +,%0A self.cre @@ -1278,32 +1278,37 @@ ),%0A + self.create_html @@ -1310,17 +1310,28 @@ _htmls() ...
577ebb6d4dc037bc912aa11d525ca4f2f09e7940
set default schema to defm
db/log.py
db/log.py
from sqlalchemy.orm import sessionmaker from forecast import util from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine from sqlalchemy import MetaData from pysandag.database import get_connection_string import os def n...
Python
0.000006
@@ -803,24 +803,65 @@ n(Integer)%0A%0A + #metadata = MetaData(schema=%22defm%22)%0A%0A db_dir = @@ -872,16 +872,16 @@ sults/'%0A - if n @@ -1021,25 +1021,173 @@ _database')) -%0A +.execution_options(%0A schema_translate_map=%7B%0A None: %22defm%22, # no schema name -%3E %22defm%22%0A ...
d8085d288323eb6530115ea9e56ee4795cb65877
Move spurious prints in config.py to use logging
salt/config.py
salt/config.py
''' All salt configuration loading and defaults should be in this module ''' # Import python modules import os import tempfile import socket import sys # import third party libs import yaml try: yaml.Loader = yaml.CLoader yaml.Dumper = yaml.CDumper except: pass # Import salt libs import salt.crypt impor...
Python
0
@@ -112,24 +112,19 @@ %0Aimport -tempfile +sys %0Aimport @@ -137,19 +137,39 @@ %0Aimport -sys +logging%0Aimport tempfile %0A%0A# impo @@ -361,16 +361,51 @@ .utils%0A%0A +log = logging.getLogger(__name__)%0A%0A %0Adef loa @@ -1633,21 +1633,21 @@ -print +msg = 'Error @@ -1684,16 +1684,41 @@ %7D - %...
7c5dad065fc3cb391609c9dd9a8d1b3effc197b1
fix typo
paths/recursive_total_path.py
paths/recursive_total_path.py
import cProfile def numberOfPaths(nXm_matrix): """ Returns the total number of paths from the top left to the bottom right by moving right and down in a 2D array of size n x m. Where cells can only contain `1` or `0` while real paths can only contain `1`. """ hight = len(nXm_matrix) wi...
Python
0.999991
@@ -1027,31 +1027,8 @@ e)%0A%0A - # Final Result%0A
b0d0c9b67c0faa583c216687544a544ed7fde631
Fix up syntax in the minion
salt/minion.py
salt/minion.py
''' Routines to set up a minion ''' # Import python libs import os import distutils.sysconfig # Import zeromq libs import zmq # Import salt libs import salt.crypt import salt.utils import salt.modules # To set up a minion: # 1, Read in the configuration # 2. Generate the function mapping dict # 3. Authenticate with th...
Python
0.999989
@@ -33,66 +33,8 @@ '''%0A -# Import python libs%0Aimport os%0Aimport distutils.sysconfig%0A # Im @@ -1028,26 +1028,8 @@ age%0A - mods = %7B%7D%0A @@ -1364,17 +1364,17 @@ unctions -%7B +%5B mod + '. @@ -1381,17 +1381,19 @@ ' + attr -: +%5D = getattr @@ -1406,17 +1406,16 @@ e, attr) -%7D %0A ...
a6fdca8d13ece3df9e676a3efdc38ad1c48fd390
Add shuffle template tag. Refs #10197 and #10198
ella/ellaexports/templatetags/ellaexports.py
ella/ellaexports/templatetags/ellaexports.py
# -*- coding: utf-8 -*- import hashlib from datetime import datetime from httplib import urlsplit from django.conf import settings from django import template from django.utils.feedgenerator import rfc2822_date from ella.ellaexports.conf import ellaexports_settings register = template.Library() DOUBLE_RENDER = geta...
Python
0
@@ -32,16 +32,30 @@ hashlib%0A +import random%0A from dat @@ -4998,16 +4998,124 @@ rn out%0A%0A +@register.filter%0Adef shuffle(value):%0A result = list(value)%0A random.shuffle(result)%0A return result%0A%0A register
981e458db0f0e7b331f60f1b77106a0e484b3ded
Correct the spelling on exclude of Community level
pycon/sponsorship/forms.py
pycon/sponsorship/forms.py
import re from django import forms from django.contrib.admin.widgets import AdminFileWidget from django.forms.models import inlineformset_factory, BaseInlineFormSet from django.utils.translation import ugettext_lazy as _ from multi_email_field.forms import MultiEmailField from pycon.sponsorship.models import Sponsor,...
Python
0.999999
@@ -2253,20 +2253,24 @@ Source -and +Project/ Communit
feb1857ac556cca08513bb35599191ee9b46e174
Use the new name of the library module.
pycurl/examples/sfquery.py
pycurl/examples/sfquery.py
#! /usr/bin/env python # -*- coding: iso-8859-1 -*- # vi:ts=4:et # # sfquery -- Source Forge query script using the ClientCGI high-level interface # # Retrieves a SourceForge XML export object for a given project. # Specify the *numeric* project ID. the user name, and the password, # as arguments. If you have a valid ~...
Python
0
@@ -472,18 +472,16 @@ %0Aimport -py curl%0A%0Aas @@ -573,18 +573,16 @@ Session( -py curl.Cur
03f05240145741fe1027c864a9047a2bf77c5161
Fix e-d-addresses + boto 2.0 incompatibility
euca2ools/commands/euca/describeaddresses.py
euca2ools/commands/euca/describeaddresses.py
# Software License Agreement (BSD License) # # Copyright (c) 2009-2011, Eucalyptus Systems, Inc. # All rights reserved. # # Redistribution and use of this software in source and binary forms, with or # without modification, are permitted provided that the following conditions # are met: # # Redistributions of source ...
Python
0.000442
@@ -2082,20 +2082,16 @@ ess.')%5D%0A - %0A def @@ -2186,22 +2186,46 @@ n = +getattr( address -. +, ' domain +', 'standard') or @@ -2749,10 +2749,8 @@ resses)%0A -%0A%0A
f4bedfed9a7324574695c065f8a1b7132d5f4708
update ftbfs logic
ethel/commands/build.py
ethel/commands/build.py
from ethel.runners.sbuild import sbuild from ethel.utils import upload import glob import os # target package firehose def run(dsc, package, job, firehose): suite = job['suite'] arch = job['arch'] info, out, ftbfs = sbuild(dsc, suite, arch) changes = "{source}*{arch}.changes".format( source=...
Python
0
@@ -517,61 +517,50 @@ -changes = changes%5B0%5D%0A%0A if os.path.exists(changes): +if not ftbfs:%0A changes = changes%5B0%5D %0A
6fb8d542e29b29569c0d124e533a3f9fbf4f81e9
make archive_forms task work with excel as it was
corehq/apps/data_interfaces/utils.py
corehq/apps/data_interfaces/utils.py
from django.utils.translation import ugettext as _ from couchdbkit import ResourceNotFound from corehq.apps.casegroups.models import CommCareCaseGroup from corehq.apps.hqcase.utils import get_case_by_identifier from couchforms.models import XFormInstance from dimagi.utils.couch.database import iter_docs from soil impo...
Python
0
@@ -1591,24 +1591,58 @@ aded_data):%0A + # used by excel archive forms%0A form_ids @@ -1759,16 +1759,33 @@ archive' +, from_excel=True )%0A%0A%0Adef @@ -1866,57 +1866,28 @@ None -):%0A # todo convert this to Async friendly view +, from_excel=False): %0A @@ -3532,24 +3532,68 @@ _form_id))%0A%0A + ...
026f7d8c07d5ec4e307caa692c66a04653565f52
修复 notebook js 函数未转换的 bug
pyecharts/render/engine.py
pyecharts/render/engine.py
# coding=utf-8 import re from jinja2 import Environment from pyecharts.commons.types import Any, Optional from ..commons.utils import write_utf8_html_file from ..datasets import EXTRA, FILENAMES from ..globals import CurrentConfig class RenderEngine: def __init__(self, env: Optional[Environment] = None): ...
Python
0
@@ -1715,22 +1715,22 @@ -return +html = tpl.ren @@ -1743,8 +1743,84 @@ kwargs)%0A + html = re.sub(r'%5C%5Cn%7C%5C%5Ct%7C%22?__-o-__%22?', %22%22, html)%0A return html%0A
4682a44436d3267877c50735aca3f0f9f36672cc
Add more specific error message when deleting too many items at import
events/importer/sync.py
events/importer/sync.py
import logging # Per module logger logger = logging.getLogger(__name__) class ModelSyncher(object): def __init__(self, queryset, generate_obj_id, delete_func=None, check_deleted_func=None, allow_deleting_func=None): d = {} self.generate_obj_id = generate_obj_id self.delet...
Python
0
@@ -2048,16 +2048,17 @@ ception( +f %22Attempt @@ -2075,30 +2075,65 @@ ete -more than 20%25 +%7Blen(delete_list)%7D out of +a total + of %7Blen(self.obj_dict)%7D ite
c5d224818903ccad9624ac4cb3449af82faa55f9
fix typo
floyd/main.py
floyd/main.py
import click import sys from distutils.version import LooseVersion import floyd from floyd.cli.utils import get_cli_version from floyd.cli.auth import login, logout from floyd.cli.data import data from floyd.cli.experiment import clone, delete, info, init, logs, output, status, stop from floyd.cli.run import run, rest...
Python
0.999991
@@ -1077,16 +1077,17 @@ sProcess +o r',))%0A%0A
41d3298eb716ad813a82f56fbfb2771373338c09
Make this test pass by checking for 61 which is what OS X uses as connection refused, apparently
greentest/test__socket_errors.py
greentest/test__socket_errors.py
# Copyright (c) 2008-2009 AG Projects # Author: Denis Bilenko # # 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, mo...
Python
0
@@ -1518,14 +1518,20 @@ ode -== 111 +in %5B111, 61%5D , (c
e25ff765e423511da57f04c96227d2ca69e7c149
Update focal_loss.py
focal_loss.py
focal_loss.py
from keras import backend as K ''' Compatible with tensorflow backend ''' def focal_loss(gamma=2., alpha=.25): def focal_loss_fixed(y_true, y_pred): pt_1 = tf.where(tf.equal(y_true, 1), y_pred, tf.ones_like(y_pred)) pt_0 = tf.where(tf.equal(y_true, 0), y_pred, tf.zeros_like(y_pred)) return -K.sum(a...
Python
0
@@ -308,19 +308,20 @@ turn -K. -sum +mean (alpha * @@ -363,18 +363,23 @@ _1)) --K.sum((1- + - K.mean((1 - alph @@ -389,17 +389,16 @@ * K.pow( - pt_0, ga
c626e6a39b239e78c45dadf8b8c4479b6d75da04
Use UUID values for survey multi-option fields
indico/modules/events/surveys/fields/simple.py
indico/modules/events/surveys/fields/simple.py
# This file is part of Indico. # Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN). # # Indico 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 (a...
Python
0
@@ -4113,32 +4113,49 @@ _field='option', + uuid_field='id', %0A @@ -4199,47 +4199,44 @@ ify -options available for selection by user +the answers the user can choose from '))%0A @@ -4696,35 +4696,45 @@ e'%5D%0A -options = %5B +choices = %5B(x%5B'id'%5D, x%5B'option'%5D @@ -4724,32 +4724,...
6b992aa75c0f553ca5066cda269e93d4f63ea4a5
Optimize banned host validation test
corehq/util/tests/test_validation.py
corehq/util/tests/test_validation.py
from corehq.util.validation import is_url_or_host_banned from django.test import TestCase def inclusive_range(start, stop): return range(start, stop + 1) class ValidationTestCase(TestCase): def testBannedHosts(self): self.assertTrue(is_url_or_host_banned('anything.commcarehq.org')) for i i...
Python
0
@@ -1,12 +1,39 @@ +from random import sample%0A%0A from corehq. @@ -115,21 +115,17 @@ se%0A%0A -%0A def -inclusiv +sampl e_ra @@ -150,15 +150,85 @@ -return +yield start%0A num_samples = min(8, stop - start)%0A for middle in sample(x rang @@ -238,19 +238,70 @@ tart + + 1 , stop - + 1) +), num_sample...
99c14c2156ed1d087594e2640af7ec8d888ba4ae
Update to v17.1.19
make.py
make.py
#!/usr/bin/env python import logging import os import shutil import tempfile import zipfile try: from urllib.parse import urljoin from urllib.request import urlretrieve except ImportError: from urllib import urlretrieve from urlparse import urljoin import yaml from PIL import Image logging.basicConf...
Python
0
@@ -443,22 +443,22 @@ Center/1 -6.2.22 +7.1.19 _Update/ @@ -488,14 +488,14 @@ G_v1 -6.2.22 +7.1.19 .zip
f006136d805989330ba7c496c3113b80518d7f4a
Fix a small stuff
functional_tests/test_jahia2wp.py
functional_tests/test_jahia2wp.py
"""(c) All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2017""" import os import pytest from settings import DOCKER_IP, OPENSHIFT_ENV, TEST_SITE, SRC_DIR_PATH from utils import Utils from wordpress import WPUser from wordpress.generator import MockedWPGenerator SCRIPT_FILE = os.path....
Python
0.999426
@@ -416,31 +416,8 @@ ITE) -%0AUNIT_NAME = %22idevelop%22 %0A%0A@p @@ -521,34 +521,8 @@ FIC%0A - unit_name = UNIT_NAME%0A @@ -574,17 +574,18 @@ rl, -unit_name +%22idevelop%22 )%0A
a4b7be1a8c6d44c272ce25acf9513054d6bee4ad
Fix in listports to work with windows
python_loader/listports.py
python_loader/listports.py
"""BlinkyTape Python communication library. This code assumes stock serialLoop() in the firmware. Commands are issued in 3-byte blocks, with pixel data encoded in RGB triplets in range 0-254, sent sequentially and a triplet ending with a 255 causes the accumulated pixel data to display (a show command). ...
Python
0
@@ -853,11 +853,11 @@ h = -%22*%22 +'.' %0A%0A
c1ad95ee4680836fc359ee636a2252925a41b3a9
fix raw_id_fields on admin. closes #33
knowledge/admin.py
knowledge/admin.py
from django.contrib import admin from knowledge.models import Question, Response, Category class CategoryAdmin(admin.ModelAdmin): list_display = [f.name for f in Category._meta.fields] prepopulated_fields = {'slug': ('title', )} admin.site.register(Category, CategoryAdmin) class QuestionAdmin(admin.ModelAd...
Python
0.000001
@@ -401,32 +401,61 @@ _related = True%0A + raw_id_fields = %5B'user'%5D%0A admin.site.regis @@ -614,16 +614,57 @@ = True%0A + raw_id_fields = %5B'user', 'question'%5D%0A admin.si
4c052b2429d7b48768f51cef0627e7a1772909b3
Fix import
dbaas/workflow/steps/tests/test_base_step.py
dbaas/workflow/steps/tests/test_base_step.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import logging from django.test import TestCase from ..base import BaseStep LOG = logging.getLogger(__name__) class BaseStepTestCase(TestCase): def setUp(self): self.base_step = BaseStep() def test_has_do_method(self):...
Python
0.000002
@@ -129,16 +129,21 @@ %0Afrom .. +util. base imp
b70e34d399b171b3d8e0731206dde54f8d029379
Add uuid to import
casstest/casstest.py
casstest/casstest.py
# -*- coding: utf-8 -*- import os from cassandra.io.libevreactor import LibevConnection from cassandra.cluster import Cluster seed = os.environ.get('SEED', '127.0.0.1') port = int(os.environ.get('PORT', '9042')) keyspace = os.environ.get('KEYSPACE', 'test') def test_read(session, user_id, age): read_query = 'SE...
Python
0
@@ -27,16 +27,28 @@ port os%0A +import uuid%0A from cas
050e7de57d0a7c1298c6801373fe1f58c856d1ea
fix pep8
khmer/utils.py
khmer/utils.py
from __future__ import print_function, unicode_literals # # This file is part of khmer, https://github.com/dib-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2015. It is licensed under # the three-clause BSD license; see LICENSE. # Contact: khmer-project@idyll.org # # Convenience functions for perfo...
Python
0.000001
@@ -1171,17 +1171,16 @@ tq-dump: - %0A 'Ac
eb4bd0931cee9ee1e9d3fdd3ae4d4742032fc16e
fix pplot example for uneven grids
examples/ensemble/plot_partial_dependence.py
examples/ensemble/plot_partial_dependence.py
""" ======================== Partial Dependence Plots ======================== Partial dependence plots show the dependence between the target function [2]_ and a set of 'target' features, marginalizing over the values of all other features (the complement features). Due to the limits of human perception the size of t...
Python
0.000001
@@ -3994,32 +3994,20 @@ pdp, -(x_axis, y_axis) +axes = parti @@ -4041,28 +4041,16 @@ eature,%0A - @@ -4136,22 +4136,24 @@ rid( -x_axis, y_axis +axes%5B0%5D, axes%5B1%5D )%0A @@ -4161,18 +4161,19 @@ Z = pdp -.T +%5B0%5D .reshape @@ -4177,16 +4177,32 @@ ape( -XX.shape +list(map(np.si...
e140b67659c3183ac4e1bc4c35dc7bd7ec60f3d2
remove <br>
gaeupload/handler_web.py
gaeupload/handler_web.py
# handler_web.py # # """ web request handler. """ import time import logging starttime = time.time() #logging.debug('start time: %s' % time.ctime(time.time())) ## gozerlib imports from gozerlib.utils.generic import fromenc, toenc, getversion from gozerlib.utils.xmpp import stripped from gozerlib.plugins import plu...
Python
0
@@ -1431,32 +1431,73 @@ basic page. %22%22%22%0A + logging.warn(%22web_handler - in%22)%0A global s @@ -1497,32 +1497,32 @@ lobal starttime%0A - %0A if star @@ -1852,50 +1852,8 @@ nt)%0A - #logging.warn(%22web_handler - in%22)%0A @@ -1933,48 +1933,8 @@ nse) -%0A self.resp...
85680ed5792456a109583830bcbfbc30ef3b62c4
Complete 'About Lambdas' koans
jesusmtnez/python/koans/koans/about_lambdas.py
jesusmtnez/python/koans/koans/about_lambdas.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Based slightly on the lambdas section of AboutBlocks in the Ruby Koans # from runner.koan import * class AboutLambdas(Koan): def test_lambdas_can_be_assigned_to_variables_and_called_explicitly(self): add_one = lambda n: n + 1 self.assertEqual(__, ...
Python
0.001766
@@ -309,18 +309,18 @@ rtEqual( -__ +11 , add_on @@ -653,18 +653,28 @@ rtEqual( -__ +'3 sausages' , sausag @@ -705,18 +705,24 @@ rtEqual( -__ +'2 eggs' , eggs(2 @@ -810,10 +810,21 @@ ual( -__ +'39823 spams' , se
d9719a20d4ee433aaab27a648888966d1ce0163b
Implement inversion counting with global variable
count-inversions/count_inversions.py
count-inversions/count_inversions.py
from random import randint import sys def sort_and_count(arr): n = len(arr) if n == 1: return arr else: first_half = arr[:n/2] second_half = arr[n/2:] return merge_and_count_split(sort_and_count(first_half), sort_and_count(second_half)) def merge_and_count_split(arr1, arr2): i, j = 0, 0 result = [] ...
Python
0.000059
@@ -32,16 +32,27 @@ rt sys%0A%0A +count = 0%0A%0A def sort @@ -321,16 +321,30 @@ ult = %5B%5D +%0A%09global count %0A%0A%09while @@ -477,16 +477,17 @@ rr1%5Bi%5D %3C += arr2%5Bj%5D @@ -559,16 +559,42 @@ rr2%5Bj%5D)%0A +%09%09%09count += len(arr1) - i%0A %09%09%09j += @@ -632,16 +632,17 @@ _len):%0A%09 +# te...
9b49f1f1b87394a54ddbad595a51c104254ec334
Fix the explicit check for http. Thanks to Ed Marshall for the bug report.
kong/models.py
kong/models.py
from django.db import models from django.template import Template, Context from django.db.models import permalink from django.contrib.localflavor.us import models as USmodels import datetime #(HACK) http://code.djangoproject.com/ticket/897 class ManyToManyField_NoSyncdb(models.ManyToManyField): def __init__(self, ...
Python
0
@@ -183,16 +183,32 @@ datetime +%0Aimport urlparse %0A%0A#(HACK @@ -1637,40 +1637,51 @@ if -curr_site.find('http://') == -1: +urlparse.urlsplit(curr_site).scheme == '': %0A
dc4258e13beb5fafa56ecb447af90b9dc4206f27
fix crash in debug log output
kraken/blla.py
kraken/blla.py
# -*- coding: utf-8 -*- # # Copyright 2019 Benjamin Kiessling # # 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.000001
@@ -5900,36 +5900,38 @@ g(f'Vectorizing -line +region s of type %7Bbl_ty @@ -5917,34 +5917,38 @@ egions of type %7B -bl +region _type%7D')%0A
17dceb0d66ac72547c6de6153d79d9bcd5dd9926
put _id and properties in the right places
gdcdatamodel/mappings/mappings.py
gdcdatamodel/mappings/mappings.py
from gdcdatamodel import node_avsc_json from mapped_entities import ( file_tree, file_traversal, participant_tree, participant_traversal, annotation_tree, annotation_traversal, ONE_TO_MANY, ONE_TO_ONE, annotation_tree ) def _get_es_type(_type): if 'long' in _type or 'int' in _type: return ...
Python
0.000001
@@ -1115,16 +1115,71 @@ files = + %7B%22_id%22: %7B%22path%22: %22file_id%22%7D%7D%0A files%5B%22properties%22%5D = _walk_t @@ -1224,47 +1224,8 @@ %22))%0A - files%5B%22_id%22%5D = %7B%22path%22: %22file_id%22%7D%0A @@ -1262,16 +1262,30 @@ files%5B +%22properties%22%5D%5B 'partici @@ -1342,16 +1342...
fd6cddb6ec94bc579eb1156d6d89ce95ffc62038
Create a field to store the display name for a package
crate/web/packages/search_indexes.py
crate/web/packages/search_indexes.py
from django.utils.translation import ugettext_noop as _ from haystack import indexes from crate.web.packages.models import Package from crate.web.search.indexes import PackageCelerySearchIndex LICENSES = { "GNU General Public License (GPL)": "GPL", "GNU Library or Lesser General Public License (LGPL)": "LGPL...
Python
0.000001
@@ -712,16 +712,87 @@ st=1.5)%0A + display_name = indexes.CharField(model_attr=%22name%22, indexed=False)%0A summ
36b2ca696bf6955d54ade1f917a1caea59b2d2d1
update version to 0.7.4
dlstats/version.py
dlstats/version.py
VERSION = (0, 7, 3) def version_str(): if len(VERSION) == 3: return "%s.%s.%s" % VERSION elif len(VERSION) == 4: return "%s.%s.%s-%s" % VERSION else: raise IndexError("Incorrect format for the VERSION tuple")
Python
0.000001
@@ -10,17 +10,17 @@ (0, 7, -3 +4 )%0A%0Adef v
e6f87d1b35a2a9a20d05ceecee1b1ad113e5bff2
remove everyday
server/mostlikelink/apis.py
server/mostlikelink/apis.py
# coding=utf-8 from . import app, login_manager, csrf from flask import json,jsonify,json_available, request from flask.ext.login import login_required, login_user, logout_user,current_user from mongoengine import errors import models import utils @csrf.exempt @app.route('/api/user/current_user', methods=['POST']) @...
Python
0.000007
@@ -5102,29 +5102,8 @@ p',%0A - u'everyday',%0A
cee7b86489a8737767ddcb4b4d1853ab7fb10e86
Add SettingInstance::state property
UM/Settings/SettingInstance.py
UM/Settings/SettingInstance.py
# Copyright (c) 2016 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Signal import Signal, signalemitter from UM.Logger import Logger from . import SettingRelation from . import Validator ## Encapsulates all state of a setting. # # @signalemitter class SettingInstance: ## ...
Python
0.000001
@@ -93,16 +93,29 @@ igher.%0A%0A +import enum%0A%0A from UM. @@ -235,16 +235,409 @@ idator%0A%0A +%0A## The state of the instance%0A#%0A# This enum describes which state the instance is in. The state describes%0A# how the instance got its value.%0Aclass InstanceState(enum.IntEnum):%0A Default = 1 ## Default...
bca4bb08fbfffe27214803429ad63f7800f36428
Update demo.py to show different stock codes
demo.py
demo.py
#!/usr/bin/python3 # -*- encoding: utf-8 -*- from indexes import * import global_data def main(stock='000001', date=global_data.NEWEST_TRADE_DATE, p_MA=5, p_MACD=(12,26,9), p_RSI=6, p_KDJ=(9,3), p_MTM=(12,6), p_CCI=14): """ Example stock: str, '000001', date: str, '2017-08-18', ...
Python
0
@@ -1144,10 +1144,51 @@ main( +stock='000001')%0A main(stock='HK.00700' )%0A
709b2153dfd5e6deecd1bf6c36bf74224081c880
Update demo.py to automatically download model
demo.py
demo.py
import os import cv2 import dlib import numpy as np import argparse from wide_resnet import WideResNet def get_args(): parser = argparse.ArgumentParser(description="This script detects faces from web cam input, " "and estimates age and gender for the detected faces...
Python
0
@@ -96,16 +96,195 @@ eResNet%0A +from keras.utils.data_utils import get_file%0A%0Apretrained_model = %22https://www.dropbox.com/s/rf8hgoev8uqjv3z/weights.18-4.06.hdf5?dl=1%22%0Amodhash = '89f56a39a78454e96379348bddd78c0d'%0A %0A%0Adef ge @@ -1498,24 +1498,25 @@ le:%0A +# weight_file @@ -1574,16 +1574,131 @...
f92f8c38c8b85469d58d338328659056350c7801
correct comment
crossbeam-channel/benchmarks/plot.py
crossbeam-channel/benchmarks/plot.py
#!/usr/bin/env python3 import random import sys import matplotlib.pyplot as plt def read_data(files): results = [] for f in files: with open(f) as f: for line in f.readlines(): test, lang, impl, secs, _ = line.split() splt = test.split('_') r...
Python
0.000005
@@ -3092,15 +3092,8 @@ ore -number subp
6c56f6d2f031c2cfe0dcb2fd7c875a8ee3d19625
Make IndentTag a proper tag.
scope/scope.py
scope/scope.py
# # template.py # # Copyright (c) 2013 Luis Garcia. # This source file is subject to terms of the MIT License. (See accompanying file LICENSE) # """Library for code templates serialization.""" import itertools class Scope: """Offer utilities to work with scope-based code templates.""" def serialize(self, templat...
Python
0.000077
@@ -4581,16 +4581,20 @@ ndent = +Tag( IndentTa @@ -4594,17 +4594,16 @@ ndentTag -( )%0A%0A%22%22%22Gr
d1ac527fb1d7cefba9b66577d16351950fc09647
Add note about new logging feature in example plugin.
plugins/callbacks/log_plays.py
plugins/callbacks/log_plays.py
# (C) 2012, Michael DeHaan, <michael.dehaan@gmail.com> # This file is part of Ansible # # Ansible 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 lat...
Python
0
@@ -737,16 +737,306 @@ t json%0A%0A +# NOTE: in Ansible 1.2 or later general logging is available without%0A# this plugin, just set ANSIBLE_LOG_PATH as an environment variable%0A# or log_path in the DEFAULTS section of your ansible configuration%0A# file. This callback is an example of per hosts logging for those%0A#...
e169adc40ccdc0ea3821ac9d6603591a6330fe9c
update test_jobs.py for lobster
custodian/lobster/tests/test_jobs.py
custodian/lobster/tests/test_jobs.py
import os import shutil import unittest from monty.os import cd from monty.tempfile import ScratchDir from custodian.lobster.jobs import LobsterJob MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) test_files_lobster2 = os.path.join(MODULE_DIR, "../../../test_files/lobster/lobsterins") test_files_lobs...
Python
0.000001
@@ -2776,20 +2776,16 @@ gz))%0D%0A%0D%0A -%0D%0A%0D%0A
b5c8821026e877e014bd3755af07c4e0213644dd
Add ability to open default settings for viewing
misc.py
misc.py
import sublime_plugin import sublime import webbrowser import os from . import PluginLogger from .lib.sdk import SDK _logger = PluginLogger(__name__) class OpenBrowser(sublime_plugin.WindowCommand): """Opens API reference in default browser. """ def __init__(self, *args, **kwargs): super().__i...
Python
0
@@ -733,16 +733,280 @@ s files. +%0A%0A Default settings (that is, Packages/Dart/Support/Dart.sublime-settings)%0A are displayed as a read-only view not meant for editing.%0A%0A User settings (that is, Packages/User/Dart.sublime-settings) are opened%0A as a regular view and are meant for editing. %0A %...
68e69188e412d30cb6e269b8b350cea743d9cfa7
Allow passing extra environment files when scaling nodes
tripleo_common/scale.py
tripleo_common/scale.py
# Copyright 2015 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
0.000007
@@ -1047,16 +1047,40 @@ dir=None +, environment_files=None ):%0A @@ -1216,16 +1216,67 @@ tht_dir%0A + self.environment_files = environment_files%0A @@ -4251,16 +4251,175 @@ _name))%0A + env_paths = %5Bos.path.join(self.tht_dir, env_name)%5D%0A if self.environment_files:%0...
28c40453c23b3ae64ab720a5510b377ba1dc5702
make the sum between the process and the children process.
tsuru/plugins/statsd.py
tsuru/plugins/statsd.py
# Copyright 2014 tsuru-circus authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import socket from zmq.eventloop import ioloop from circus.plugins import CircusPlugin from circus.util import human2bytes from tsuru import common clas...
Python
0
@@ -2823,82 +2823,300 @@ cpu -s.append(sub_info%5B'cpu'%5D)%0A mems.append(sub_info%5B'mem'%5D) + = %5Bsub_info%5B'cpu'%5D%5D%0A mem = %5Bsub_info%5B'mem'%5D%5D%0A%0A for p in sub_info%5B'children'%5D:%0A cpu.append(p%5B'cpu'%5D)%0A ...
6aa22782ce8a077d63be11be9a59c3fbbde0e700
Clean up command line a bit.
tuneharvest/commands.py
tuneharvest/commands.py
import argparse import sys from tuneharvest.sources.console import from_console from tuneharvest.sources.slack import from_slack from tuneharvest.sinks.console import to_console from tuneharvest.sinks.youtube import to_youtube from tuneharvest.filters import Masseuse parser = argparse.ArgumentParser( 'tuneharves...
Python
0
@@ -264,16 +264,134 @@ seuse%0A%0A%0A +import pkg_resources%0Atry:%0A VERSION = pkg_resources.require(%22tuneharvest%22)%5B0%5D.version%0Aexcept:%0A VERSION = 'DEV'%0A%0A%0A parser = @@ -420,27 +420,8 @@ er(%0A - 'tuneharvest',%0A @@ -436,20 +436,18 @@ ion= -'Can h +('H arvest +s you @@ -488,16 +4...
d99aebe4ded6f8b8663ca32a191c6c39e58b1517
bump version
kuyruk/__init__.py
kuyruk/__init__.py
from __future__ import absolute_import import logging from kuyruk.kuyruk import Kuyruk from kuyruk.worker import Worker from kuyruk.task import Task from kuyruk.config import Config __version__ = '0.14.4' try: # not available in python 2.6 from logging import NullHandler except ImportError: class NullHan...
Python
0
@@ -197,17 +197,17 @@ = '0.14. -4 +5 '%0A%0Atry:%0A
336020466c48538921497a93db2ffa2ab2909eab
Drop prefetch tags in case_list, due not used
poradnia/cases/views/cases.py
poradnia/cases/views/cases.py
from __future__ import absolute_import from django.shortcuts import get_object_or_404, redirect from django.contrib import messages from django.utils.translation import ugettext as _ from django.views.generic import UpdateView, TemplateView from django_filters.views import FilterView from braces.views import UserFormKw...
Python
0
@@ -988,33 +988,8 @@ cts. -prefetch_related('tags'). %0A
8650f7380976671553db28e11ac145ac3b4b9d20
Update production.py
poradnia/config/production.py
poradnia/config/production.py
# -*- coding: utf-8 -*- ''' Production Configurations ''' from .common import * # noqa # SECRET KEY SECRET_KEY = env.str('DJANGO_SECRET_KEY') # END SECRET KEY # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts ALLOWED_HOSTS = ...
Python
0.000001
@@ -466,17 +466,16 @@ _EMAIL', - %0A @@ -556,24 +556,28 @@ L_HOST = env +.str ('DJANGO_EMA @@ -607,24 +607,28 @@ SSWORD = env +.str ('DJANGO_EMA @@ -663,24 +663,28 @@ T_USER = env +.str ('DJANGO_EMA @@ -766,16 +766,20 @@ IX = env +.str ('DJANGO @@ -802,24 +802,16 @@ REFIX', -default= '%5Bporadn @@ ...
475df103dc2fd29fa3426893923ebe87177c07bd
Remove unnecessary ord() (str/bytes)
pox/lib/packet/packet_base.py
pox/lib/packet/packet_base.py
# Copyright 2011 James McCauley # Copyright 2008 (C) Nicira, 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 ap...
Python
0.000002
@@ -3519,18 +3519,13 @@ %22 %25 -(ord (p%5Bt%5D -) ,)%0A
25c94638d2b63e749c2deef2c64fa27b587ce5de
fix directory and job name lameness
gscripts/rnaseq/sailfish_index.py
gscripts/rnaseq/sailfish_index.py
#!/usr/bin/env python __author__ = 'olga' from gscripts.qtools import Submitter import argparse class CommandLine(object): """ Check out the argparse documentation for more awesome things you can do! https://docs.python.org/2/library/argparse.html """ def __init__(self, inOpts=None): se...
Python
0
@@ -4738,24 +4738,25 @@ try:%0A +%0A job_name @@ -4751,102 +4751,36 @@ -job_name = '_'.join(%5Bcl.args%5B'job_name'%5D, 'sailfish_index'%5D)%0A%0A out_sh = name = job_name +out_sh = cl.args%5B'job_name'%5D + ' @@ -4899,49 +4899,8 @@ it'%5D -%0A directory = cl.args%5B'directory'%5D ...
bf5c124192378358ba92e9707beae50ba39778ce
rename learn_rate -> learning_rate
examples/ensemble/plot_partial_dependence.py
examples/ensemble/plot_partial_dependence.py
""" ======================== Partial Dependence Plots ======================== Partial dependence plots show the dependence between the target function [1]_ and a set of 'target' features, marginalizing over the values of all other features (the complement features). Due to the limits of human perception the size of t...
Python
0.00004
@@ -2978,16 +2978,19 @@ learn +ing _rate=0.
a73451272d832ac22e6afcff0bf3fbe416328b65
use correct file?
cicada/publishers.py
cicada/publishers.py
import logging import os import stat import subprocess class PublishArtifact(object): """ Publish console ouput artifct is relative to workspace directory href/linktext is made for future linking """ def __init__(self, artifact, destination, href, linktext): self.artifact = artifact ...
Python
0.000001
@@ -644,24 +644,96 @@ s(destdir):%0A + logging.info(%22Making destination directory of %25s%22, destdir)%0A @@ -745,32 +745,33 @@ kedirs(destdir)%0A +%0A sourcedi @@ -1162,27 +1162,24 @@ r, self. -destination +artifact )%0A%0A @@ -1236,18 +1236,16 @@ gular))%0A -%0A%0A ...
eaba29ee7ea2a02eef180531e7efaf4c3cfebf31
Check for subscript like DD1
lcapy/latex.py
lcapy/latex.py
import re sub_super_pattern = re.compile(r"([_\^]){([\w]+)}") class Latex(object): words = ('in', 'out', 'ref', 'rms', 'load', 'source', 'avg', 'mean', 'peak', 'pp', 'min', 'max', 'src', 'cc', 'ee', 'dd', 'ss', 'ih', 'il', 'oh', 'ol') def __init__(self, string): self.str ...
Python
0.000006
@@ -51,12 +51,24 @@ )%7B(%5B -%5Cw%5D+ +a-zA-Z%5D+)(%5B0-9%5D* )%7D%22) @@ -536,27 +536,27 @@ -fre +wor d = match.gr @@ -562,16 +562,59 @@ roup(2)%0A + suffix = word + match.group(3)%0A @@ -633,19 +633,19 @@ if -fre +wor d.lower( @@ -673,28 +673,30 @@ -fred +...
9cc013cc0fbff030be386ed3af5f6a826b97ca5f
make the module hook more robust
lib/spack/spack/hooks/module_file_generation.py
lib/spack/spack/hooks/module_file_generation.py
# Copyright 2013-2020 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) import spack.modules import spack.modules.common import llnl.util.tty as tty try: enabled = spack.config.get('modules...
Python
0.000001
@@ -191,16 +191,36 @@ R MIT)%0A%0A +import spack.config%0A import s @@ -289,20 +289,107 @@ as tty%0A%0A -try: +%0Adef _for_each_enabled(spec, method_name):%0A %22%22%22Calls a method for each enabled module%22%22%22 %0A ena @@ -434,25 +434,32 @@ e')%0A -except KeyError:%0A + if not enabled:%0A @...
5b1349c5322c47b10fb74efeecaace6ac5d41346
Add logging. (#7)
lambda_function.py
lambda_function.py
import json import logging import requests import uuid PARTICLE_CLOUD_API_ENDPOINT = 'https://api.particle.io' logger = logging.getLogger() logger.setLevel(logging.DEBUG) # Main function entrypoint, handles request routing. def lambda_handler(event, context): logger.info("Recieved event: {}".format(json.dumps(e...
Python
0
@@ -2275,16 +2275,27 @@ _id)%0A + response = request @@ -2375,16 +2375,93 @@ %7D)%0A%0A + logger.info(%22Response from Particle Cloud: %7B%7D%22.format(response.json()))%0A%0A head