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 |
|---|---|---|---|---|---|---|---|
c25c9de19369467116714eadff86984f716d9b90 | Change fields order | reports/admin.py | reports/admin.py | # coding: utf-8
from django.contrib import admin
from .models import Report
class ReportAdmin(admin.ModelAdmin):
#Определя кои полета да се показват в заявката за извлизачне на анкети
list_display = ('addressed_to', 'reported_from', 'content', 'created_at', 'signed_from', 'get_copies')
#Добавя поле за филт... | Python | 0.000001 | @@ -111,83 +111,8 @@
n):%0A
- #%D0%9E%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D1%8F %D0%BA%D0%BE%D0%B8 %D0%BF%D0%BE%D0%BB%D0%B5%D1%82%D0%B0 %D0%B4%D0%B0 %D1%81%D0%B5 %D0%BF%D0%BE%D0%BA%D0%B0%D0%B7%D0%B2%D0%B0%D1%82 %D0%B2 %D0%B7%D0%B0%D1%8F%D0%B2%D0%BA%D0%B0%D1%82%D0%B0 %D0%B7%D0%B0 %D0%B8%D0%B7%D0%B2%D0%BB%D0%B8%D0%B7... |
418af7f4c1cfae730d96ad26e0d22860a9c4df1e | Update ReConnect.py | plugins/ReConnect.py | plugins/ReConnect.py | import threading
from spock.mcp.mcpacket import Packet
from spock.net.cflags import cflags
from spock.net.timer import EventTimer
#Will relentlessly try to reconnect to a server
class ReConnectPlugin:
def __init__(self, client, settings):
self.client = client
self.lock = False
self.kill = False
self.delay = 0... | Python | 0 | @@ -1,12 +1,190 @@
+%22%22%22%0AHilariously out of date, I'll update this when it's not 3:30 in the morning%0AIn the meantime, go look at plugins in spock.net.plugins for more up-to-date plugin examples%0A%22%22%22%0A%0A
import threa
|
1aab33c5460f92c93fa4886ca34dd873e4592cc2 | Changed main command from 'ud' to 'urbandict' | plugins/UrbanDict.py | plugins/UrbanDict.py | #!/usr/bin/env python
###
# Copyright (c) 2004, Kevin Murphy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# t... | Python | 0.998505 | @@ -2764,17 +2764,24 @@
def u
-d
+rbandict
(self, i
|
1806316e91eb98232424936f6bba16772861872b | Fix W605 warning | plugins/pitchfork.py | plugins/pitchfork.py | import re
import string
import textwrap
from errbot import BotPlugin, botcmd
class Pitchfork(BotPlugin):
"""
To pitchfork users down to ...
"""
@botcmd
def pitchfork(self, msg, arg):
"""
To pitchfork user down to ...
"""
match = re.match(r'@?([\w-]+)(?:\s+(?:down\... | Python | 0.000011 | @@ -552,16 +552,17 @@
emplate(
+r
%22%22%22%0A
@@ -780,16 +780,17 @@
+%5C
%5C('%0A
@@ -925,16 +925,17 @@
+/
/(,%0A
|
1a39df91aac55a6fcb845674544afd13fadd5d22 | Add function on project class to return the owners | server/models/__init__.py | server/models/__init__.py | from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import UserMixin
db = SQLAlchemy()
class Keyword(db.Model):
__tablename__ = 'keywords'
id = db.Column(db.Integer, primary_key=True)
keyword = db.Column(db.String(128))
class Language(db.Model):
__tablename__ = 'languages'
id = db.... | Python | 0.000001 | @@ -3,21 +3,17 @@
om flask
-.ext.
+_
sqlalche
@@ -47,13 +47,9 @@
lask
-.ext.
+_
logi
@@ -1501,24 +1501,54 @@
y_key=True)%0A
+ name = db.Column(db.Text)%0A
descript
@@ -1867,16 +1867,206 @@
uages)%0A%0A
+ def get_owners(self):%0A %22%22%22%0A%0A :return: a list of usernames of project owne... |
26e52cef04757cea52faec81af4ffdcc9e6cf0be | Allow string temperature values for Johnson Nyquist formulae | UliEngineering/JohnsonNyquistNoise.py | UliEngineering/JohnsonNyquistNoise.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Johnson Nyquist noise utilities for both voltage and current noise
"""
import scipy.constants
from .Resistors import *
from .EngineerIO import *
import math
class ConversionException(Exception):
pass
def celsius_to_kelvin(c):
return c + 273.15
def fahrenheit... | Python | 0.003611 | @@ -1658,32 +1658,100 @@
rInput(delta_f)%0A
+ if isinstance(T, str):%0A T, _ = normalizeEngineerInput(T)%0A
t_kelvin = n
@@ -2248,24 +2248,92 @@
ut(delta_f)%0A
+ if isinstance(T, str):%0A T, _ = normalizeEngineerInput(T)%0A
t_kelvin
|
53cb8ae795e0643a1fd2fa7c0879b925cb4cee20 | Update Tensorflow.py | Variational-Autoencoder/Tensorflow.py | Variational-Autoencoder/Tensorflow.py | import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import time
# https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py
def plot_results(models, data, session):
"""Plots labels and MNIST digits as a function of the 2D latent vector
# Arguments
... | Python | 0.000001 | @@ -4300,16 +4300,29 @@
ms=True)
+ * latent_dim
%0D%0A%0D%0A# co
|
fcf1371162753b30597850487339b74e77f43b62 | set epsilon to 1 | DGEclust/viz/plotRA.py | DGEclust/viz/plotRA.py | ## Copyright (C) 2012-2013 Dimitrios V. Vavoulis
## Computational Genomics Group (http://bioinformatics.bris.ac.uk/)
## Department of Computer Science
## University of Bristol
################################################################################
import pylab as pl
import numpy as np
######################... | Python | 0.999998 | @@ -426,19 +426,18 @@
silon =
-0.5
+1.
, *args,
|
ad6222161cc4f918522223919d5e8f02536dc2a3 | Normalize matrix tan command docstring quotation mark type | Discord/cogs/matrix.py | Discord/cogs/matrix.py |
from discord.ext import commands
import ast
import numpy
import scipy
from utilities import checks
async def setup(bot):
await bot.add_cog(Matrix())
class Matrix(commands.Cog):
# TODO: move to converters file
class Matrix(commands.Converter):
async def convert(self, ctx, argument):
try:
return ast.li... | Python | 0.000001 | @@ -4741,19 +4741,19 @@
rix):%0A%09%09
-'''
+%22%22%22
Tangent
@@ -4755,35 +4755,35 @@
gent of a matrix
-'''
+%22%22%22
%0A%09%09await ctx.emb
|
e8bb813ae85648bcbfbc1ec85bcc8c7709831137 | Drop hidden files from filebrowser filetree. | sandstone/apps/filebrowser/posixfs.py | sandstone/apps/filebrowser/posixfs.py | import os
import sys
import stat
import pwd
import shutil
import logging
from sandstone import settings
import grp
import subprocess
class PosixFS():
@staticmethod
def file_exists(filepath):
filepath = os.path.abspath(filepath)
exists = os.path.exists(filepath)
return exists
@sta... | Python | 0 | @@ -4555,32 +4555,111 @@
stdir(dirpath):%0A
+ # drop hidden%0A if i%5B0%5D == '.':%0A continue%0A
file
|
34a2fac19b9711ce341fec31c1e09370bfb34bec | convert string to bytes before writing to file | shell/util.py | shell/util.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import tempfile
def str_to_pipe(s):
input_pipe = tempfile.SpooledTemporaryFile()
input_pipe.write(s)
input_pipe.seek(0)
return input_pipe
| Python | 0.000001 | @@ -56,16 +56,17 @@
mpfile%0A%0A
+%0A
def str_
@@ -126,16 +126,73 @@
yFile()%0A
+ if isinstance(s, str):%0A s = s.encode('utf-8')%0A
inpu
@@ -230,16 +230,16 @@
seek(0)%0A
+
retu
@@ -252,9 +252,8 @@
ut_pipe%0A
-%0A
|
08791bc6723d129fda9032996e71522ae902f70a | Update base.py | project_name/settings/base.py | project_name/settings/base.py | from __future__ import unicode_literals
"""
Django settings for {{ project_name }} project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside th... | Python | 0.000001 | @@ -1,301 +1,4 @@
-from __future__ import unicode_literals%0A%22%22%22%0ADjango settings for %7B%7B project_name %7D%7D project.%0A%0AFor more information on this file, see%0Ahttps://docs.djangoproject.com/en/1.6/topics/settings/%0A%0AFor the full list of settings and their values, see%0Ahttps://docs.djangoproject.com/... |
a8eea42f1462ac1c83eb0d16195b7c546a907e7b | revert wikipedia namespace | plugins/wikipedia.py | plugins/wikipedia.py | '''Searches wikipedia and returns first sentence of article
Scaevolus 2009'''
import re
from util import hook, http
api_prefix = "http://en.wikipedia.org/w/api.php"
search_url = api_prefix + "?action=opensearch&format=xml"
paren_re = re.compile('\s*\(.*\)$')
@hook.command('w')
@hook.command
def wiki(inp):
''... | Python | 0.00001 | @@ -473,34 +473,37 @@
p://
-www.mediawiki.org/xml/api/
+opensearch.org/searchsuggest2
%7D'%0A
|
7c4124b3e21702a730b8bc454bad2a62c7a797c5 | Add lighting schedule for lighting model. | pnnl/models/light.py | pnnl/models/light.py | import logging
import importlib
import pandas as pd
from volttron.platform.agent import utils
from datetime import timedelta as td
from volttron.pnnl.models.utils import clamp
_log = logging.getLogger(__name__)
utils.setup_logging()
class Light(object):
DOL = "dol"
OCC = "occ"
def __init__(self, config... | Python | 0 | @@ -920,40 +920,341 @@
-if %22rated_power%22 in config: %0A
+self.rated_power = config%5B%22rated_power%22%5D%0A%0A def update_data(self):%0A pass%0A%0A def predict(self, _set, sched_index, market_index, occupied):%0A return _set*self.rated_power%0A%0A%0Aclass simple_profile(object):%0A ... |
85c28997513484136e9860e9f5b83eada65860f3 | remove logging level | scrapi/consumers/figshare/consumer.py | scrapi/consumers/figshare/consumer.py | """
Figshare harvester of public projects for the SHARE Notification Service
Note: At the moment, this harvester only harvests basic data on each article, and does
not make a seperate request for additional metadata for each record.
Example API query: http://api.figshare.com/v1/articles/search?search_for=*&from_date=2... | Python | 0.000001 | @@ -650,49 +650,8 @@
nt%0A%0A
-logging.basicConfig(level=logging.INFO)%0A%0A
logg
|
c737cf939ef9e028ada0ae3087d45b7a0dc8710c | Tweak script that gets test list in xdist builds | scripts/xdist/get_worker_test_list.py | scripts/xdist/get_worker_test_list.py | """
This script strips the console log of a pytest-xdist Jenkins run into the test
lists of each pytest worker.
Assumes the following format:
[test-suite] [worker] RESULT test
"""
import click
import io
import re
import os
import shutil
@click.command()
@click.option(
'--log-file',
help="File name of console ... | Python | 0 | @@ -613,27 +613,76 @@
ran.
- Example: lms-unit%22
+%22,%0A type=click.Choice(%5B'lms-unit', 'cms-unit', 'commonlib-unit'%5D)
,%0A
@@ -896,16 +896,17 @@
w(%5Cd+)%5D
+(
PASSED%7CF
@@ -924,16 +924,17 @@
ED%7CERROR
+)
'.format
@@ -1163,16 +1163,213 @@
g%5D = %5B%5D%0A
+ test = line.split()%5B3%5... |
3a3d2ff00fd0f7c7661519f95ac1aed0d4cef475 | Add the Welsh mutation mixin to Council | polling_stations/apps/councils/models.py | polling_stations/apps/councils/models.py | import re
from django.contrib.gis.db import models
from django.contrib.postgres.fields import ArrayField, JSONField
from django.utils.translation import get_language
class Council(models.Model):
council_id = models.CharField(primary_key=True, max_length=100)
name = models.CharField(blank=True, max_length=255... | Python | 0.999921 | @@ -165,23 +165,108 @@
ge%0A%0A
-%0Aclass Council(
+from polling_stations.i18n.cy import WelshNameMutationMixin%0A%0A%0Aclass Council(WelshNameMutationMixin,
mode
|
3452d229404cbb56de181ca7a2d9f31e92ddae05 | fixing function def | selection/randomized/randomization.py | selection/randomized/randomization.py | """
Different randomization options for selective sampler.
Main method used in selective sampler is the gradient method which
should be a gradient of the negative of the log-density. For a
Gaussian density, this will be a convex function, not a concave function.
"""
import numpy as np
import regreg.api as rr
from sc... | Python | 0.999026 | @@ -419,59 +419,149 @@
lf,
-shape, density, grad_negative_log_density, sampler,
+%0A shape, %0A density, %0A grad_negative_log_density, %0A sampler, %0A
lip
@@ -571,16 +571,17 @@
itz=1):%0A
+%0A
|
72e0b78ea1578df68f95f97f6080f5c011371753 | Return None if there are no results for a resource | ckanext/deadoralive/logic/action/get.py | ckanext/deadoralive/logic/action/get.py | import datetime
import ckanext.deadoralive.model.results as results
import ckanext.deadoralive.config as config
def get_resources_to_check(context, data_dict):
"""Return a list of up to ``n`` resource IDs to be checked.
Returns up to ``n`` resource IDs to be checked for broken links.
Resources that hav... | Python | 0.000001 | @@ -1860,16 +1860,73 @@
resource
+, or None if there are%0A no results for this resource
%0A :rt
@@ -1934,16 +1934,24 @@
pe: dict
+ or None
%0A%0A %22%22
@@ -2046,16 +2046,30 @@
ce_id%22%5D%0A
+%0A try:%0A
resu
@@ -2097,16 +2097,81 @@
urce_id)
+%0A except results.NoResultForResourceError... |
09cc528f78801bf77c7b1090a862d86bbaa7bcdd | Drop support for 2.5 | ckanext/showcase/logic/action/create.py | ckanext/showcase/logic/action/create.py | import logging
import ckan.lib.uploader as uploader
import ckan.lib.helpers as h
import ckan.plugins.toolkit as toolkit
from ckan.logic.converters import convert_user_name_or_id_to_id
from ckan.lib.navl.dictization_functions import validate
import ckanext.showcase.logic.converters as showcase_converters
import ckanex... | Python | 0 | @@ -946,293 +946,38 @@
-# If get_uploader is available (introduced for IUploader in CKAN 2.5), use%0A # it, otherwise use the default uploader.%0A # https://github.com/ckan/ckan/pull/2510%0A try:%0A upload = uploader.get_uploader('showcase')%0A except AttributeError:%0A upload = uploader... |
18e4c20424c445922d8775aaf9d698c83b0019b5 | fix python test on about page | cla_public/tests/test_multipage_form.py | cla_public/tests/test_multipage_form.py | from __future__ import unicode_literals
import unittest
from flask import url_for, session
from cla_public import app
def make_key(form, field):
return '{form}_{field}'.format(form=form, field=field)
class TestMultiPageForm(unittest.TestCase):
def setUp(self):
self.app = app.create_app('config/tes... | Python | 0.000001 | @@ -2931,16 +2931,109 @@
'
+partner_is_employed': '0',%0A 'is_self_employed': '0',%0A 'partner_
is_self_
|
e9be63254261a6ab1c44f5af69e4f9452dd7f2d4 | Change search wait locator for integration tests. (#9696) | tests/frontend/ui/pages/desktop/base.py | tests/frontend/ui/pages/desktop/base.py | from pypom import Page, Region
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class Bas... | Python | 0 | @@ -4898,32 +4898,45 @@
hSuggestion-name
+ .LoadingText
')%0A%0A def
@@ -5434,17 +5434,17 @@
lenium,
-1
+3
0).until
@@ -5468,16 +5468,20 @@
EC.
-presence
+invisibility
_of_
|
bf0986f2b404b97d30b047a55b4914a8c71975a7 | set sort on list view | benefit/urls.py | benefit/urls.py | from django.conf.urls import patterns, url
from django.views.generic import DetailView, ListView, TemplateView
from .models import Artwork
urlpatterns = patterns('',
url(r'^$', 'benefit.views.index', name='index'),
url(r'^artworks$', ListView.as_view(
model=Artwork, paginate_by=24),
name='artwo... | Python | 0.000001 | @@ -291,16 +291,109 @@
te_by=24
+,%0A queryset=Artwork.objects.order_by('artist_last_name', 'artist_first_name', 'title')
),%0A
|
858d0ba40131787940a71204a12b509e873c4fba | Normalize version number | project_stage_state_issue/__openerp__.py | project_stage_state_issue/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Daniel Reis, 2014
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, eith... | Python | 0.053331 | @@ -946,17 +946,23 @@
sion': '
-1
+8.0.1.0
.0',%0A
|
f96d1daac6053067555c674c1a8bd15ffe4bedcb | Support `FormSet`s in `FormGroup`s | shoop/utils/form_group.py | shoop/utils/form_group.py | # -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from collections import OrderedDict
import six
class FormDef(object):
... | Python | 0 | @@ -237,16 +237,53 @@
e tree.%0A
+from django.forms import BaseFormSet%0A
from col
@@ -310,16 +310,16 @@
redDict%0A
-
import s
@@ -646,38 +646,171 @@
= %7B
-%0A %22prefix%22: prefix,
+%22prefix%22: prefix%7D%0A if not isinstance(self.form_class, BaseFormSet):%0A # FormSets don't suppo... |
26da8d4ee15ccdb3338c0ad0ca8096d8da455050 | add `adapt2cuds` in the simphony plugin | simphony_mayavi/plugin.py | simphony_mayavi/plugin.py | from simphony_mayavi._version import full_version as __version__
from simphony_mayavi.show import show
from simphony_mayavi.snapshot import snapshot
from simphony_mayavi.cuds.api import VTKParticles, VTKLattice, VTKMesh
__all__ = [
'show', 'snapshot', '__version__', 'VTKParticles', 'VTKLattice', 'VTKMesh']
| Python | 0 | @@ -79,20 +79,19 @@
_mayavi.
-show
+api
import
@@ -98,54 +98,30 @@
show
-%0Afrom simphony_mayavi.snapshot import snapshot
+, snapshot, adapt2cuds
%0Afro
@@ -224,16 +224,34 @@
apshot',
+ 'adapt2cuds',%0A
'__vers
@@ -257,16 +257,20 @@
sion__',
+%0A
'VTKPar
|
fab28d49551012e2db97a109ae78f87c6d9d9a68 | Fix bug. Cannot do sudo. | .ebextensions/01rewrite_nginx_config.py | .ebextensions/01rewrite_nginx_config.py | #! /usr/bin/python
"""Modifies nginx configuration file on AWS Elastic Beanstalk to support
WebSocket connections."""
__author__ = "Sven Kreiss <me@svenkreiss.com>"
__version__ = "0.0.2"
import os
NGINX_CONF_FILE = '/etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker.conf'
NGINX_CONFIG = """
location /socket... | Python | 0 | @@ -1475,13 +1475,8 @@
em(%22
-sudo
serv
|
e02abe17b521508a6fb90a628c5c6dd59f7d3186 | Allow customizations of user-config.py | singleuser/user-config.py | singleuser/user-config.py | import os
mylang = 'test'
family = 'wikipedia'
usernames['wikipedia']['test'] = os.environ['JPY_USER']
| Python | 0 | @@ -46,36 +46,261 @@
a'%0A%0A
-usernames%5B'wikipedia'%5D%5B'test
+%0Acustom_path = os.path.expanduser('~/user-config.py')%0Aif os.path.exists(custom_path):%0A with open(custom_path, 'r') as f:%0A exec(compile(f.read(), custom_path, 'exec'), globals())%0A%0A# Things that should be non-easily-overridable%0Aus... |
f3056f04b22c3c112da2f60ffe706116aec09b75 | Fix script for multiline strings | tests/system/tools/findUnusedObjects.py | tests/system/tools/findUnusedObjects.py | #!/usr/bin/env python
import os
import sys
import tokenize
from optparse import OptionParser
from toolfunctions import checkDirectory
from toolfunctions import getFileContent
objMap = None
def parseCommandLine():
global directory, onlyRemovable, fileType
scriptChoice = ('Python', 'JavaScript', 'Perl', 'Tcl',... | Python | 0 | @@ -179,24 +179,100 @@
bjMap = None
+%0AlastToken = %5BNone, None%5D%0AstopTokens = ('OP', 'NAME', 'NUMBER', 'ENDMARKER')
%0A%0Adef parseC
@@ -1678,16 +1678,239 @@
None)%0A%0A
+def handleStringsWithTrailingBackSlash(origStr):%0A try:%0A while True:%0A index = origStr.index(%22%5C%5C%5Cn%22)%0A ... |
fdab958fe17747e5a0a869dd367b2c9c277b4462 | Bump slybot version | slybot/slybot/__init__.py | slybot/slybot/__init__.py | __version__ = '0.11'
| Python | 0 | @@ -12,10 +12,12 @@
= '0.11
+.1
'%0A
|
7ec71de8958ec764967ccf435922b3885c12b1ef | Refactor names for client_states | blitz/io/tcp.py | blitz/io/tcp.py | __author__ = 'Will Hart'
import socket
import threading
import SocketServer
from blitz.io.client_states import *
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
"""
A class for handling TCP requests
"""
def handle(self):
"""
Handle the request - in this case just e... | Python | 0 | @@ -1467,32 +1467,38 @@
ter_state(self,
+Client
InitState)%0A%0A
@@ -3569,16 +3569,22 @@
e(self,
+Client
InitStat
|
bba5011432e484a906f0008c46f4d049492b2643 | change location of computenode.txt | proj/pro_settings.py | proj/pro_settings.py | """
Django settings for proj project in production
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_... | Python | 0.000001 | @@ -813,14 +813,14 @@
red/
-static
+config
/com
|
c08230bb60fdaadfba801ab3a603fe433c1042bd | clean up plotting routine | sofia/plot.py | sofia/plot.py | """Plotting functions
- makeMTX: Generate 3D-matrix-data
- visualize3D: Plot 3D data
"""
import numpy as _np
from vispy import scene, color
from .process import pdc
from .sph import sph2cart
def makeMTX(Pnm, dn, Nviz=3, krIndex=1, oversize=1):
"""mtxData = makeMTX(Nviz=3, Pnm, dn, krIndex)
--------------------... | Python | 0.000002 | @@ -2573,20 +2573,22 @@
le == 's
-hape
+catter
' or sty
@@ -2588,36 +2588,38 @@
or style == 'cs
-hape
+catter
':%0A sphCo
@@ -2772,22 +2772,26 @@
t, s
-hape or cshape
+catter or cscatter
.')%0A
@@ -2861,71 +2861,282 @@
e sc
-atter object from mtxData%0A scatt
+ene%0A canvas = scene.SceneCanvas(keys... |
bf01271ed56961f19739afe062ca313f080eecb4 | Use webp in path only when webp is supported | thumbor/result_storages/file_storage.py | thumbor/result_storages/file_storage.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from datetime import datetime
from uuid import uuid4
from shutil imp... | Python | 0 | @@ -2055,16 +2055,20 @@
if
+not
self.is_
|
d9471f684fbfb4776bfaf2a4e2265c19dd758db2 | fix typo | spacy/util.py | spacy/util.py | import os
import io
import json
import re
import os.path
import sputnik
from sputnik.dir_package import DirPackage
from sputnik.package_stub import PackageStub
from sputnik.package_list import PackageNotFoundException, CompatiblePackageNotFoundException
from . import about
from .attrs import TAG, HEAD, DEP, ENT_IOB, ... | Python | 0.999991 | @@ -1251,16 +1251,17 @@
download
+'
%22%0A
|
71ea6816eea95e8bf750563718b0dd39114a3c49 | Add a cookie based authentication source | pyramid_authsanity/sources.py | pyramid_authsanity/sources.py | from zope.interface import implementer
from .interfaces (
IAuthSourceService,
)
@implementer(IAuthSourceService)
class SessionAuthSource(object):
""" An authentication source that uses the current session """
vary = ()
value_key = 'sanity.value'
def __init__(self, context, request):
... | Python | 0.000001 | @@ -1,12 +1,99 @@
+from webob.cookies (%0A SignedCookieProfile,%0A SignedSerializer,%0A )%0A%0A
from zope.in
@@ -783,24 +783,1570 @@
_key%5D%0A return %5B%5D%0A
+%0A%0Adef CookieAuthSourceFactory(%0A secret,%0A cookie_name='auth',%0A secure=False,%0A max_age... |
4a4a09fb64ae004abeb3df328a767729123a448d | print ful stacktrace on exceptions | book_tracker.py | book_tracker.py | from datetime import datetime, timedelta
import time
from db import get_session
from scrape_page import scrape_page
import models as m
HOUR = timedelta(hours=1)
def update_rank(session, book, category_name, rank, timestamp):
q = session.query
category = q(m.Category).filter_by(name=category_name).scalar()
... | Python | 0.000001 | @@ -1,12 +1,42 @@
+import traceback%0A%0Aimport sys%0A%0A
from datetim
@@ -2158,15 +2158,28 @@
-print(e
+traceback.print_exc(
)%0A
|
494f14a69d08e9bfd556fccc6b4e2319db129a38 | Add created and modified fields to Receipt | books/models.py | books/models.py | from django.contrib.auth.models import User
from django.db import models
from django.db.models import fields
class Receipt(models.Model):
title = fields.CharField(max_length=255)
price = fields.DecimalField(max_digits=10, decimal_places=2)
user = models.ForeignKey(User)
def __str__(self):
ret... | Python | 0 | @@ -102,16 +102,50 @@
fields%0A
+from django.utils import timezone%0A
%0A%0Aclass
@@ -277,16 +277,126 @@
aces=2)%0A
+ created = fields.DateTimeField(auto_now=True)%0A modified = fields.DateTimeField(default=timezone.now())%0A
user
|
b2c185ee6f02584b8a3e3c512cf62c5943cbbde5 | work this time | spellcheck.py | spellcheck.py | import re, collections
import enchant
import sys
#sys.path.append('pyenchant-1.6.6/enchant')
from enchant.checker import SpellChecker
def words(text):
return re.findall('[a-z]+', text.lower())
def train(features):
model = collections.defaultdict(lambda: 1)
for f in features:
model[f] += 1
retu... | Python | 0.000001 | @@ -16,16 +16,17 @@
ections%0A
+#
import e
@@ -43,17 +43,16 @@
ort sys%0A
-#
sys.path
@@ -86,16 +86,68 @@
chant')%0A
+sys.path.append('pyenchant-1.6.6/enchant/checker/')%0A
from enc
|
b1547647deec6c1edf54c497fa4ed20235ea6902 | Add missing egun.bias in init | pymodels/middlelayer/devices/__init__.py | pymodels/middlelayer/devices/__init__.py | from .dcct import DCCT
from .li_llrf import LiLLRF
from .rf import RF
from .sofb import SOFB
from .kicker import Kicker
from .septum import Septum
from .screen import Screen
from .bpm import BPM
from .ict import ICT
from .ict import TranspEff
from .egun import HVPS
from .egun import Filament
| Python | 0.000043 | @@ -258,12 +258,12 @@
ort
-HVPS
+Bias
%0Afro
@@ -286,8 +286,31 @@
ilament%0A
+from .egun import HVPS%0A
|
84a28073a3894e420c6a71503abd951af4d4ba95 | Handle older versions of path.py. Error log subprocess output on workspace.run when it fails | pytest-shutil/pytest_shutil/workspace.py | pytest-shutil/pytest_shutil/workspace.py | """ Temporary directory fixtures
"""
import os
import tempfile
import shutil
import logging
import subprocess
from path import Path
import pytest
from six import string_types
from . import cmdline
log = logging.getLogger(__name__)
@pytest.yield_fixture()
def workspace():
""" Function-scoped temporary workspace... | Python | 0.000001 | @@ -104,16 +104,25 @@
rocess%0A%0A
+try:%0A
from pat
@@ -135,16 +135,71 @@
rt Path%0A
+except ImportError:%0A from path import path as Path%0A%0A
import p
@@ -4087,37 +4087,37 @@
log.
-debug
+error
(%22Stdout/stderr:
@@ -4139,29 +4139,29 @@
log.
-debug
+error
(out)%0A
|
47ca97c5693239ad1fdef5d1a09f15f1ae25ae77 | Update nanochan.py | bot/nanochan.py | bot/nanochan.py | """
Discord bot that spaces out spoiler comments
"""
import gila
import os
import discord
from discord.ext.commands import Bot
from time import time
import datetime
from logging import Formatter, INFO, StreamHandler, getLogger
from cogs.utils.db_utils import PostgresController
class Nanochan(Bot):
"""
actual ... | Python | 0.000001 | @@ -2057,35 +2057,33 @@
config.read_
+in_
config
-_file
()%0A c
|
64020a1b63dc8a8f2a46e20b5176f5a51c545158 | fix TICK_SIZE calculation | python/ccxt/base/decimal_to_precision.py | python/ccxt/base/decimal_to_precision.py | import decimal
import numbers
import itertools
import re
__all__ = [
'TRUNCATE',
'ROUND',
'ROUND_UP',
'ROUND_DOWN',
'DECIMAL_PLACES',
'SIGNIFICANT_DIGITS',
'TICK_SIZE',
'NO_PADDING',
'PAD_WITH_ZERO',
'decimal_to_precision',
]
# rounding mode
TRUNCATE = 0
ROUND = 1
ROUND_UP = 2... | Python | 0.001267 | @@ -2142,32 +2142,126 @@
e == TICK_SIZE:%0A
+ # python modulo with negative numbers behaves different than js/php, so use abs first%0A
missing
@@ -2262,19 +2262,24 @@
ssing =
+abs(
dec
+)
%25 preci
@@ -2659,33 +2659,33 @@
dec = dec
--
++
missing
%0A
@@ -2664,32 +2664,48 @@
= d... |
36805b7d90a2bbeec87b16b25cb75af26775e685 | change some weights. | src/convNetPrime.py | src/convNetPrime.py | '''
Created on Dec 26, 2012
@author: dstrauss
creating some routines to make a convolutional net. especially one that works in parallel
and this one is going to work over multiple channels
'''
import scipy.io as spio
import numpy as np
from dataModel import dtm
from lassoUpdate import lasso
import weightsUpdate
fro... | Python | 0.000001 | @@ -936,17 +936,17 @@
lmb =
-1
+4
e-6%0A
|
83799d81fe734938024aa1f5d4a438fba3cc1807 | Add uploading to AWS machinery | ysniff.py | ysniff.py | #!/usr/bin/env python
import boto.rds
import fileinput
import sys
mac_index = 12
time_index = 1
start_t_us = 0
start_u_us = 0
MAC_LEN = 17
SAMPLE_PERIOD = 30 # Seconds.
PUSH_TO_AWS_PERIOD = 3600 # Seconds. One hour.
maclist = set()
buffer = {}
conn = boto.rds.connect_to_region("us-west-2",aws_access_key_id=sys.argv[... | Python | 0 | @@ -59,16 +59,26 @@
port sys
+%0Aimport os
%0A%0Amac_in
@@ -258,28 +258,22 @@
conn
- =
+=
boto.
-rds.
connect_
to_r
@@ -272,134 +272,48 @@
ect_
-to_region(%22us-west-2%22,aws_access_key_id=sys.argv%5B1%5D,aws_secret_key_id=sys.argv%5B2%5D)%0A aws_secret_access_key='%3Caws secret key%3E
+sdb()%0Adomain=conn.g... |
65e63204322406f139e12130cbd4d32774481a0f | Switch to using urllib instead of mechanize | yucata.py | yucata.py | #!/usr/bin/python
# -*- encoding: utf8 -*-
# © 2014 Joachim Breitner
# License: MIT (see LICENSE)
import mechanize
import cookielib
import xdg.BaseDirectory
import os.path
import ConfigParser
import getpass
import json
import webbrowser
# setup
cookiefile = os.path.join(xdg.BaseDirectory.save_data_path("yucata-tools... | Python | 0 | @@ -100,25 +100,37 @@
%0Aimport
-mechanize
+urllib%0Aimport urllib2
%0Aimport
@@ -243,16 +243,26 @@
bbrowser
+%0Aimport re
%0A%0A# setu
@@ -457,26 +457,67 @@
r =
-mechanize.Browser(
+urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar)
)%0Abr
@@ -609,36 +609,8 @@
')%5D%0A
-br.set_cookiejar(cookiejar)%0... |
93c7d78aec8bdf14a04e038298bcdfa5b89be1c7 | fix function name | py/desiutil/setup.py | py/desiutil/setup.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
==============
desiutil.setup
==============
This package contains code that might be useful in DESI setup.py files.
"""
from __future__ import absolute_import, division, print_function
# Note: distutils can be sensitive to uni... | Python | 0.999926 | @@ -5753,16 +5753,8 @@
path
-.abspath
('ht
|
46556d19b41f99030d69bdcb069531195cca556b | Fix indexing of the result of API 1 calls. | pycpanel/__init__.py | pycpanel/__init__.py | __title__ = 'pycpanel'
__version__ = '0.1.3'
__date__ = '2013-12-08'
__licence__ = 'Apache License Version 2.0'
__author__ = 'oznu'
import requests, json
def unauthorised():
raise Exception('Access denied: please check the username and hash/password.')
class conn(object):
def __init__(self, hostname, userna... | Python | 0 | @@ -1939,16 +1939,129 @@
cpanel':
+%0A if version == 1:%0A return json.loads(r.text)%5B'data'%5D%0A else:%0A
return
|
9502b16486b0631b979886a27ea942c0f79fa8e3 | Update rasa_nlu/featurizers/regex_featurizer.py | rasa_nlu/featurizers/regex_featurizer.py | rasa_nlu/featurizers/regex_featurizer.py |
import logging
import os
import re
import warnings
import io
import sys
import typing
from typing import Any, Dict, List, Optional, Text
from rasa_nlu import utils
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.featurizers import Featurizer
from rasa_nlu.training_data import Message
from rasa_nlu.train... | Python | 0 | @@ -1,13 +1,12 @@
-%0A
import loggi
|
051119b195b55ee7a67489b7d5fcd3841c835feb | fix bug in inference.py | python/paddle/v2/inference.py | python/paddle/v2/inference.py | import numpy
import py_paddle.swig_paddle as api
import collections
import topology
import minibatch
from data_feeder import DataFeeder
__all__ = ['infer']
class Inference(object):
def __init__(self, output_layer, parameters):
topo = topology.Topology(output_layer)
gm = api.GradientMachine.create... | Python | 0.000001 | @@ -1780,12 +1780,25 @@
%5B%5B%5D
-%5D *
+ for i in xrange(
len(
@@ -1804,16 +1804,18 @@
(result)
+)%5D
%0A
|
6df951062e73559f0d3cca50370969617c415d6e | make imports local | python_wrap_cases/__init__.py | python_wrap_cases/__init__.py | # -*- coding: utf-8 -*-
__author__ = 'Kirill Ermolov'
__email__ = 'erm0l0v@ya.ru'
__version__ = '0.1.2'
from python_wrap_cases import generators as g
from python_wrap_cases.wrap_cases import * | Python | 0.000001 | @@ -103,54 +103,8 @@
2'%0A%0A
-from python_wrap_cases import generators as g%0A
from
|
4b3475eec6cb174c78fe6c8ec7d8495500e7bef3 | Remove reference to OHSU. | qipipe/staging/collections.py | qipipe/staging/collections.py | from .staging_error import StagingError
extent = {}
"""The {name: collection} dictionary."""
def add(*collections):
"""
Adds the given :class:`qipipe.staging.collection.Collection`s to the
list of known collections.
:param collections: the collection objects to add
"""
for coll in collect... | Python | 0 | @@ -659,13 +659,8 @@
The
-AIRC
coll
|
3a9959ed796a274893cec3b565c7557fec55046e | Fix typo [ci skip] | quantecon/random/utilities.py | quantecon/random/utilities.py | """
Utilities to Support Random Operations and Generating Vectors and Matrices
"""
import numpy as np
from numba import jit, guvectorize, generated_jit, types
from ..util import check_random_state, searchsorted
# Generating Arrays and Vectors #
def probvec(m, k, random_state=None, parallel=True):
"""
Retur... | Python | 0.000002 | @@ -4752,11 +4752,9 @@
n no
-npt
+p
ytho
|
3902e2799e94f9e413912c692819a4b8bc4b69e2 | Update states.py | quantum/atom_cavity/states.py | quantum/atom_cavity/states.py | # -*- coding: utf-8 -*-
# This file is part of Quantum.
#
# Copyright (c) 2017, Diego Nicolás Bernal-García
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribution... | Python | 0.000001 | @@ -2019,16 +2019,18 @@
range(n
++1
):%0A
|
cff0599bbc891ec690f818cb85bffce3e78212df | Fix pep8 | pylxd/deprecation.py | pylxd/deprecation.py | import warnings
warnings.simplefilter('once', DeprecationWarning)
class deprecated():
"""A decorator for warning about deprecation warnings.
The decorator takes an optional message argument. This message can
be used to direct the user to a new API or specify when it will
be removed.
"""
def... | Python | 0.000001 | @@ -306,16 +306,84 @@
%22%22%22%0A%0A
+ DEFAULT_MESSAGE = '%7B%7D is deprecated and will be removed soon.'%0A%0A
def
@@ -581,52 +581,28 @@
e =
-'%7B%7D is deprecated and will be removed soon.'
+self.DEFAULT_MESSAGE
.for
|
7fecb0a120d14bf5b1ad30b8f221f826be3aca56 | Fix missing newline. | pymatgen/__init__.py | pymatgen/__init__.py | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Pymatgen (Python Materials Genomics) is a robust, open-source Python library
for materials analysis. This is the root package.
"""
import os
import warnings
from fnmatch import fnmatch
import ruamel.yaml ... | Python | 0.000275 | @@ -3588,12 +3588,14 @@
s.%22 %25 fname)
+%0A%0A
|
9435e211e3e54184946a66c5f59edfc20ff17c9f | Change default TB version | pymodels/__init__.py | pymodels/__init__.py | """PyModels package."""
import os as _os
from . import LI_V01_01
from . import TB_V02_01
from . import BO_V05_04
from . import TS_V03_03
from . import SI_V24_04
from . import coordinate_system
with open(_os.path.join(__path__[0], 'VERSION'), 'r') as _f:
__version__ = _f.read().strip()
__all__ = ('LI_V01_01', 'T... | Python | 0 | @@ -78,20 +78,20 @@
rt TB_V0
-2_01
+3_02
%0Afrom .
@@ -317,20 +317,20 @@
, 'TB_V0
-2_01
+3_02
', 'BO_V
@@ -394,12 +394,12 @@
B_V0
-2_01
+3_02
%0Abo
|
58b88ac1b6612f4bb3b78c09de0616fcc71fa0b9 | add remove blank lines | pymonet/test_lazy.py | pymonet/test_lazy.py | from pymonet.lazy import Lazy
from random import random
class LazySpy:
def mapper(self, input):
return input + 1
def fn(self):
return 42
def fold_function(self, value):
return value + 1
def fn():
return 42
def fn1():
return 43
def test_applicative_should_call_stor... | Python | 0.465448 | @@ -1870,18 +1870,16 @@
lazy1 != lazy2%0A
-%0A%0A
|
6d0e8768f4e5843fc5dbf726bb7cbdc7bea9a5ad | Add name into dummy engine schema and make it required | rally/deploy/engines/dummy.py | rally/deploy/engines/dummy.py | # Copyright 2013: Mirantis 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 b... | Python | 0.000019 | @@ -1243,32 +1243,72 @@
'properties': %7B%0A
+ 'name': %7B'type': 'string'%7D,%0A
'end
@@ -1770,16 +1770,24 @@
ired': %5B
+'name',
'endpoin
|
b3bd432876e8a5cf7d1d62a1c8266dfd6384a067 | add compatibility for Python 3 | squeezenet.py | squeezenet.py | from keras.layers import Input, merge
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.layers.core import Dropout, Activation
from keras.layers.pooling import GlobalAveragePooling2D
from keras.models import Model
sq1x1 = "squeeze1x1"
exp1x1 = "expand1x1"
exp3x3 = "expand3x3"
relu = "relu_"... | Python | 0.000002 | @@ -1,24 +1,62 @@
+from __future__ import print_function%0A
from keras.layers import
@@ -2987,33 +2987,33 @@
start%0A print
-
+(
%22%7B%7D s to make mo
@@ -3025,32 +3025,33 @@
format(duration)
+)
%0A%0A start = ti
@@ -3113,33 +3113,33 @@
start%0A print
-
+(
%22%7B%7D s to get out
@@ -3155,24 +3155,2... |
371aed8cc93d1903f7d20b114054aade9bdc72cd | update version | qdict/__version__.py | qdict/__version__.py | __version__ = '1.0.0'
| Python | 0 | @@ -10,13 +10,13 @@
__ = '1.
-0
+1
.0'%0A
|
d78b3476a3244ba62df4df2e4c6b6840fbb34c67 | Update version to 0.13.2 | qsimcirq/_version.py | qsimcirq/_version.py | """The version number defined here is read automatically in setup.py."""
__version__ = "0.13.1"
| Python | 0 | @@ -87,11 +87,11 @@
= %220.13.
-1
+2
%22%0A
|
70ae79d1704279a92af9406e2717b8847c22024d | Use raw_id_field for users in admin. | readthedocs/projects/admin.py | readthedocs/projects/admin.py | """Django administration interface for `~projects.models.Project`
and related models.
"""
from builds.models import Version
from django.contrib import admin
from projects.models import Project, File, ImportedFile
class VersionInline(admin.TabularInline):
model = Version
class ProjectAdmin(admin.ModelAdmin):
... | Python | 0 | @@ -573,16 +573,47 @@
Inline%5D%0A
+ raw_id_fields = ('users',)%0A
%0A%0Aclass
|
c228448150cf3bfb055b4eac5e000accbe4d2732 | Fix black issues (make linters tests green) | recipe_scrapers/_schemaorg.py | recipe_scrapers/_schemaorg.py | # IF things in this file continue get messy (I'd say 300+ lines) it may be time to
# find a package that parses https://schema.org/Recipe properly (or create one ourselves).
import extruct
from ._exceptions import SchemaOrgException
from ._utils import get_minutes, get_yields, normalize_string
SCHEMA_ORG_HOST = "sc... | Python | 0 | @@ -843,16 +843,17 @@
%22@type%22,
+
%22%22)%0A
|
5856e4daaf141e5bf9cdef438378a3757297f9c0 | Add wrapper methods for clarity. | recipe_scrapers/wholefoods.py | recipe_scrapers/wholefoods.py | from ._abstract import AbstractScraper
class WholeFoods(AbstractScraper):
@classmethod
def host(self, domain="com"):
return f"www.wholefoodsmarket.{domain}"
| Python | 0 | @@ -168,8 +168,449 @@
omain%7D%22%0A
+%0A def title(self):%0A return self.schema.title()%0A%0A def total_time(self):%0A return self.schema.total_time()%0A%0A def yields(self):%0A return self.schema.yields()%0A%0A def image(self):%0A return self.schema.image()%0A%0A def ingred... |
873d42ddccc5f1fe2c8234ff6da3e00cf4beb8aa | Update setup.py | recipes/python-omero/setup.py | recipes/python-omero/setup.py | #!/usr/bin/python
# -*- coding: latin-1 -*-
from distutils.core import setup
import os
setup(name='Omero Python',
version=os.environ['OMERO_VERSION'],
description='OME (Open Microscopy Environment) develops open-source software and data format standards for the storage and manipulation of biological light microscop... | Python | 0.000001 | @@ -29,15 +29,19 @@
ng:
-latin
+iso-8859
-1
+5
-*-
|
35346bc78d18009cddf19e39c8ea7e70c6647f7b | Use assertRaises in test_wipe_no_params (#2309) | readthedocs/rtd_tests/tests/test_urls.py | readthedocs/rtd_tests/tests/test_urls.py | from django.core.urlresolvers import reverse
from django.core.urlresolvers import NoReverseMatch
from django.test import TestCase
class WipeUrlTests(TestCase):
def test_wipe_no_params(self):
try:
reverse('wipe_version')
self.fail('reverse with no parameters should fail')
e... | Python | 0 | @@ -203,128 +203,31 @@
-try:%0A reverse('wipe_version')%0A self.fail('reverse with no parameters should fail')%0A except
+with self.assertRaises(
NoRe
@@ -228,32 +228,33 @@
s(NoReverseMatch
+)
:%0A pa
@@ -251,20 +251,39 @@
-pass
+reverse('wipe_version')
%0A%0... |
9747712b02c6d676a21ad06d6115873d9c4cec48 | Fix logout URL | recipe-server/normandy/base/api/views.py | recipe-server/normandy/base/api/views.py | from urllib.parse import urljoin
from django.conf import settings
from django.core.exceptions import ValidationError as DjangoValidationError
from rest_framework import status
from rest_framework.compat import NoReverseMatch, set_rollback
from rest_framework.response import Response
from rest_framework.reverse import... | Python | 0.000035 | @@ -2113,16 +2113,24 @@
everse('
+control:
logout')
|
3acee896fccfc2a99c8d38d432635b09a7d56d7d | remove unused future import in file script | recipe_modules/file/resources/symlink.py | recipe_modules/file/resources/symlink.py | #!/usr/bin/env python
# Copyright 2018 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Simple script for creating symbolic links for an arbitrary number of path pairs."""
import argparse
import errno
import ... | Python | 0.000018 | @@ -344,44 +344,8 @@
ys%0A%0A
-from future.utils import iteritems%0A%0A
%0Adef
|
25e2a5ffd7e807ff32503783067225402d79b901 | Change cirq.optimizers.foo imports to cirq.foo (#268) | recirq/quantum_chess/controlled_iswap.py | recirq/quantum_chess/controlled_iswap.py | # Copyright 2020 Google
#
# 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, soft... | Python | 0 | @@ -626,36 +626,8 @@
irq%0A
-from cirq import optimizers%0A
impo
@@ -3801,26 +3801,20 @@
())%0A
-optimizers
+cirq
.MergeSi
@@ -3866,26 +3866,20 @@
ps)%0A
-optimizers
+cirq
.DropNeg
|
19e6858988f5411346b3081fff182669a75112e1 | Update rasa/cli/scaffold.py | rasa/cli/scaffold.py | rasa/cli/scaffold.py | import os
import argparse
from typing import List, Text
import questionary
from rasa.cli import train
from rasa.cli.shell import shell
from rasa.cli.utils import create_output_path
from rasa_core.utils import print_success
def add_subparser(subparsers: argparse._SubParsersAction,
parents: List[argp... | Python | 0 | @@ -1031,17 +1031,20 @@
h, %22data
-/
+%22, %22
nlu%22)%0A
|
cfb7a556698bf3b65f93c51063247098a8ad1a13 | Could determine between binary and text PHSF | read_and_bin_PhSF.py | read_and_bin_PhSF.py | #!/usr/bin/env python3
import sys
import matplotlib.pyplot as plt
import beam_loader
import text_loader
from H1Dn import H1Dn
def make_scale(nof_bins_hi2me):
"""
FFiven number of bins, make energy scale
"""
lo = 0.01
me = 1.170001
hi = 1.330001
# bins in hi-to-me region
step = (hi ... | Python | 0.999999 | @@ -1178,24 +1178,167 @@
int(scale)%0A%0A
+ if %22egsphsp1%22 in pshf_name:%0A (events, nof_photons, nof_electrons, nof_positrons) = beam_loader.load_events(pshf_name)%0A else:%0A
(events,
@@ -2635,17 +2635,16 @@
%22:%0A%0A
-#
fname =
@@ -2662,16 +2662,19 @@
user/C25
+GP3
.egsphsp
@@ -26... |
f49fbef1b760ffd89d9e0bc12010e11706922730 | add tests | corehq/apps/hqadmin/tests/test_views.py | corehq/apps/hqadmin/tests/test_views.py | from django.http import HttpResponse
from django.test import SimpleTestCase
from mock import patch, Mock
from corehq.apps.hqadmin.views import AdminRestoreView
class AdminRestoreViewTests(SimpleTestCase):
def test_get_context_data(self):
user = Mock()
user.domain = None
app_id = None
... | Python | 0 | @@ -1,108 +1,405 @@
-from django.http import HttpResponse%0Afrom django.test import SimpleTestCase%0Afrom mock import patch, Mock
+import base64%0Aimport hashlib%0Aimport hmac%0Aimport json%0A%0Afrom django.conf import settings%0Afrom django.http import HttpResponse%0Afrom django.test import SimpleTestCase%0Afrom djang... |
b4e8dd76e3095941c9837151b263365f08426ea1 | Fix privileges of package frontend. | WEIPDCRM/styles/DefaultStyle/views/chart.py | WEIPDCRM/styles/DefaultStyle/views/chart.py | # coding=utf-8
"""
DCRM - Darwin Cydia Repository Manager
Copyright (C) 2017 WU Zheng <i.82@me.com> & 0xJacky <jacky-943572677@qq.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either ... | Python | 0 | @@ -1133,21 +1133,21 @@
ownload_
-times
+count
'%0A te
|
56dde1833dd61f6210a37d819a3df4d6a5e2db51 | Update download Sector help description | PyRoute/downloadsec.py | PyRoute/downloadsec.py | '''
Created on Jun 3, 2014
@author: tjoneslo
'''
import urllib2
import urllib
import codecs
import string
import time
import os
import argparse
def get_url (url, sector, suffix):
f = urllib2.urlopen(url)
encoding=f.headers['content-type'].split('charset=')[-1]
content = f.read()
if encoding == 't... | Python | 0 | @@ -799,36 +799,50 @@
on='
-route remap for trade routes
+Download sector/metadata from TravellerMap
')%0A
|
93b4357e4438d9c63e6f09ba4c3e534e0a03386e | add ComputeMolShape and ComputeMolVolume convenience functions | Python/Chem/AllChem.py | Python/Chem/AllChem.py | # $Id$
#
# Copyright (C) 2006 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
#
""" Import all RDKit chemistry modules
"""
import rdBase
import RDConfig
import Numeric
import DataStructs
from Geometry import rdGeometry
from Chem import *
from rdPartialCharges import *
from r... | Python | 0 | @@ -1166,24 +1166,964 @@
newConf)%0D%0A%0D%0A
+def ComputeMolShape(mol,confId=-1,boxDim=(20,20,20),spacing=0.5,**kwargs):%0D%0A res = rdGeometry.UniformGrid3D(boxDim%5B0%5D,boxDim%5B1%5D,boxDim%5B2%5D,spacing=spacing)%0D%0A apply(EncodeShape,(mol,res,confId),kwargs)%0D%0A return res%0D%0A %0D%0Adef ComputeMolVolum... |
842755e493eaf7df3f5d928cc106155ddec97d75 | add flushdb method | redis_shard/shard.py | redis_shard/shard.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import redis
from hashring import HashRing
import functools
_findhash = re.compile('.*\{(.*)\}.*', re.I)
class RedisShardAPI(object):
def __init__(self,servers):
VERSION = tuple(map(int, redis.__version__.split('.')))
self.nodes = []
... | Python | 0.000001 | @@ -5251,12 +5251,137 @@
r.keys(key)%0A
+%0A def flushdb():%0A for node in self.nodes:%0A server = self.connections%5Bnode%5D%0A server.flushdb()%0A
|
61cad8665fe84c74ade0c30f7935f064dafea0d2 | add imports section | redisext/__init__.py | redisext/__init__.py | '''
Introduction
------------
Redisext is a tool for data modeling. Its primary goal is to provide light
interface to well-known data models based on Redis such as queues, hashmaps,
counters, pools and stacks. Redisext could be treated as a ORM for Redis.
Tutorial
--------
Counter Model allows you to build counters ... | Python | 0 | @@ -1180,16 +1180,30 @@
.stack%0A%0A
+.. note::%0A%0A
Imports
@@ -1252,16 +1252,45 @@
er order
+ it is listed below.%0A%0AImports
::%0A%0A i
|
6b1787a4d848a31ab69c76c23516cde94af8be14 | Extend dicts.merge to be (optionally) recursive | app/soc/logic/dicts.py | app/soc/logic/dicts.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Python | 0 | @@ -1237,19 +1237,53 @@
updates
+, sub_merge=False, recursive=False
):%0A
-
%22%22%22Lik
@@ -1492,16 +1492,148 @@
nal dict
+%0A sub_merge: Merge a dict or list present in both target and update%0A recursive: Determines whether merge_subdicts is recursive
%0A%0A Retu
@@ -1820,24 +1820,24 @@
in target:%0... |
5026b687f74f351c17fbaa1d219d4cad34b77eb6 | Add missing space | chatbot/main.py | chatbot/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import logging
import argparse
import chatbot.bot
def main():
parser = argparse.ArgumentParser(
description="Run the bot using a given profile and/or a given API.",
epilog="At least one of -p/--profile or -a/--api has to be specified."
)... | Python | 0.999999 | @@ -1164,16 +1164,17 @@
lname)s:
+
%25(messag
|
99414313325d74f278d871203cbee99a2d5fbe13 | update __repr__() | alphatwirl/loop/EventDatasetReader.py | alphatwirl/loop/EventDatasetReader.py | # Tai Sakuma <tai.sakuma@gmail.com>
import copy
import itertools
from operator import itemgetter
from collections import OrderedDict
from .EventLoop import EventLoop
##__________________________________________________________________||
class EventDatasetReader(object):
"""This class manages objects involved in r... | Python | 0.000002 | @@ -1267,32 +1267,8 @@
()%0A%0A
- def __repr__(self):%0A
@@ -1323,24 +1323,16 @@
Runner',
-
self.ev
@@ -1369,33 +1369,16 @@
reader',
-
self.re
@@ -1409,30 +1409,16 @@
lector',
-
self.co
@@ -1516,22 +1516,28 @@
-return
+self._repr =
'%7B%7D(%7B%7D)
@@... |
20328fd50002af69eb441e68b89a85dbda4ab43a | fix django 1.11.1 | cked/widgets.py | cked/widgets.py | from django import forms
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.encoding import force_unicode
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from django.core.urlre... | Python | 0.000009 | @@ -1858,16 +1858,28 @@
d_attrs(
+self.attrs,
attrs, n
@@ -2239,9 +2239,369 @@
)%0A%0A
+ def build_attrs(self, base_attrs, extra_attrs=None, **kwargs):%0A %22%22%22%0A Helper function for building an attribute dictionary.%0A This is combination of the same method from Django%3C=1.10 and... |
2f67d775600bce74e1f4cc59b63d63f4f0dc5dc7 | Update pion.py | classes/pion.py | classes/pion.py | from piece import piece
from tkinter import *
class pion(piece):
def move(self, pos_x, pos_y, tableau, possible):
if (self.getColor() == piece._players['NOIR']):
if tableau.getPion(pos_x, pos_y + 1) == None:
tableau.setPossible(pos_x, pos_y + 1, piece._players['NOIR'], possible... | Python | 0.000001 | @@ -20,30 +20,8 @@
iece
-%0Afrom tkinter import *
%0A%0Acl
@@ -1627,195 +1627,4 @@
%22P%22%0A
-%0A def getImage(self):%0A if self.getColor() == piece._players%5B'NOIR'%5D:%0A return PhotoImage(file=%22pion_n.png%22)%0A else:%0A return PhotoImage(file=%22pion_b.png%22)%0A
|
c680852e6c2c378bf00bd6ff12d72bd6ecd3376d | Save email | spiff/membership/views.py | spiff/membership/views.py | from django.template import RequestContext
from django.core.exceptions import PermissionDenied
from django.contrib import messages
from django.contrib.auth.models import User
from django.shortcuts import render_to_response
import models
import forms
def index(request):
users = User.objects.filter(is_active=True)
r... | Python | 0 | @@ -1410,32 +1410,80 @@
ata%5B'lastName'%5D%0A
+ user.email = userForm.cleaned_data%5B'email'%5D%0A
user.save()%0A
|
54e0d90fd1682d3aa7e87d83c9a19495190b718b | read sequence from ctm and audacity | spych/scoring/sequence.py | spych/scoring/sequence.py | class SequenceItem(object):
"""
Represents an item in a sequence. An item at least consists of a label. It may has start time and duration in seconds.
"""
def __init__(self, label, start=-1.0, duration=-1.0):
"""
Create instance.
:param label: Label
:param start: Start t... | Python | 0.000011 | @@ -1,20 +1,85 @@
+from spych.assets import ctm%0Afrom spych.assets import audacity%0A%0A%0A
class SequenceItem(o
@@ -221,24 +221,25 @@
ds.%0A %22%22%22%0A
+%0A
def __in
@@ -1351,195 +1351,1281 @@
-@classmethod%0A def from_tuples(cls, tuples):%0A items = %5B%5D%0A%0A for value in tuples... |
e9bd104dfdbaae815d1dc96907b51cac0a6baefa | Update test_cryptorandom.py to match changes | cryptorandom/tests/test_cryptorandom.py | cryptorandom/tests/test_cryptorandom.py | from __future__ import (absolute_import, division,
print_function, unicode_literals)
import numpy as np
from nose.tools import assert_raises, raises
from ..cryptorandom import BaseRandom, SHA256
def test_SHA256():
r = SHA256(5)
assert(repr(r) == 'SHA256 PRNG with seed 5')
assert(str... | Python | 0 | @@ -292,24 +292,38 @@
with seed 5
+ and counter 0
')%0A asser
@@ -358,16 +358,30 @@
h seed 5
+ and counter 0
')%0A %0A
@@ -1256,17 +1256,17 @@
t(1, 100
-0
+1
, 5)%0A
@@ -1331,8 +1331,9 @@
.all() )
+%0A
|
2dfbe90d3282f033d4ee24d1955aa1fd9838a6b7 | fix python syntax error | savanna/tests/integration/tests/spark.py | savanna/tests/integration/tests/spark.py | '''
Created on Jan 1, 2014
@author: DO Huy-Hoang
'''
from savanna.openstack.common import excutils
from savanna.tests.integration.tests import base
class SparkTest(base.ITestCase):
def __run_RL_job(self, hostname, port):
self.execute_command(
'./spark/run-example org.apache.spark.exampl... | Python | 0.00034 | @@ -205,26 +205,42 @@
b(self,
-hostname,
+masternode_ip, masternode_
port):%0A%0A
@@ -377,24 +377,40 @@
%25
-%7Bhostname,
+(masternode_ip, masternode_
port
-%7D
+)
)%0A%0A
@@ -749,17 +749,17 @@
%25
-%7B
+(
master_i
@@ -806,25 +806,25 @@
rt, filename
-%7D
+)
)%0A%0A def _
|
5f42f76ffd11e82d51a334b91d64723388ca4a0d | Add RSS Feed Provider docs | newswall/providers/feed.py | newswall/providers/feed.py | from datetime import datetime
import feedparser
import time
from newswall.providers.base import ProviderBase
class Provider(ProviderBase):
def update(self):
feed = feedparser.parse(self.config['source'])
for entry in feed['entries']:
self.create_story(entry.link,
titl... | Python | 0 | @@ -1,12 +1,214 @@
+%22%22%22%0ARSS Feed Provider%0A=================%0A%0ARequired configuration keys::%0A%0A %7B%0A %22provider%22: %22newswall.providers.feed%22,%0A %22source%22: %22http://twitter.com/statuses/user_timeline/feinheit.rss%22%0A %7D%0A%22%22%22%0A
from datetim
|
2e998665771d0e692b376694c8f38972dc2d9722 | Add comments and clarify subparser name | clowder/main.py | clowder/main.py | #! /usr/bin/env python3
if __name__ == '__main__':
import clowder
raise SystemExit(main.main())
import argcomplete, argparse
import os, sys
import clowder.breed
import clowder.fix
import clowder.groom
import clowder.herd
import clowder.knead
import clowder.litter
import clowder.manifest
import clowder.meow
i... | Python | 0 | @@ -747,24 +747,42 @@
Directory)%0A%0A
+ # clowder%0A
pars
@@ -903,30 +903,23 @@
s(dest='
-subparser_name
+command
', help=
@@ -931,32 +931,56 @@
command help')%0A%0A
+ # clowder breed%0A
parser_b
@@ -1242,32 +1242,55 @@
t.getGroups())%0A%0A
+ # clowder herd%0A
parse... |
09a2b7c403d698f296866e1d108723f106195747 | Make sure all headers are strings | datapackage_pipelines/lib/downloader.py | datapackage_pipelines/lib/downloader.py | import os
import csv
import logging
import itertools
import requests
import tabulator
from jsontableschema import Schema
from datapackage_pipelines.wrapper import ingest, spew
def _reader(opener, _url):
yield None
filename = os.path.basename(_url)
_schema, _headers, _reader = opener()
num_headers =... | Python | 0.001038 | @@ -879,16 +879,54 @@
rs = %5B%5D%0A
+ headers = list(map(str, headers))%0A
for
|
bd5b7001e38fbabf5bfee18747c0d192289e2284 | Bump to 3.2.2 proper | cms/__init__.py | cms/__init__.py | # -*- coding: utf-8 -*-
__version__ = '3.2.2.dev1'
default_app_config = 'cms.apps.CMSConfig'
| Python | 0.000033 | @@ -42,13 +42,8 @@
.2.2
-.dev1
'%0A%0Ad
|
02f82308f83ab9803bc80e195a257075837ea096 | Update @graknlabs_build_tools dependency to latest 'master' branch | dependencies/graknlabs/dependencies.bzl | dependencies/graknlabs/dependencies.bzl | #
# GRAKN.AI - THE KNOWLEDGE GRAPH
# Copyright (C) 2018 Grakn Labs Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later v... | Python | 0 | @@ -1498,48 +1498,48 @@
= %22
-32edb9d829fb24340a2c4678a5dd0b94b1217405
+02a56228e27397ad9173b7f07897101c4c357e04
%22, #
|
d4195ff992bb4776e5c0927b6e2eac254b214968 | Add missing return True to proposal conversion | app/soc/mapreduce/convert_proposal.py | app/soc/mapreduce/convert_proposal.py | #!/usr/bin/python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Python | 0.998712 | @@ -1236,16 +1236,32 @@
al.put()
+%0A return True
%0A%0A if d
|
4b8d07e584587906bf237936c4ebda16584489f2 | Update app.py | channels/r_cats/app.py | channels/r_cats/app.py | #encoding:utf-8
import os
import random
from urllib.parse import urlparse
from utils import (get_url, download_file, telegram_autoplay_limit,
just_send_an_album)
def weighted_random(d):
r = random.uniform(0, sum(val for val in d.values()))
s = 0.0
for k, w in d.items():
s += w... | Python | 0.000001 | @@ -768,32 +768,24 @@
zyCats': 1,%0A
-
'cat
@@ -806,24 +806,16 @@
-
-
'CatHigh
@@ -820,32 +820,24 @@
ghFive': 1,%0A
-
'cat
@@ -841,32 +841,24 @@
cathug': 1,%0A
-
'Wig
@@ -874,32 +874,24 @@
1,%0A
-
-
'catfreakout
@@ -897,24 +897,... |
ddb2c24e60d38fee171d2566c9a5dd0f6405410e | Use parentheses to wrap the line | armstrong/core/arm_sections/models.py | armstrong/core/arm_sections/models.py | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from mptt.models import MPTTModel
from mptt.fields import TreeForeignKey
from armstrong.utils.backends import GenericBackend
from .utils import get_section_many_to_many_relations
SECTION_ITEM_BACKEND ... | Python | 0.023933 | @@ -315,16 +315,17 @@
CKEND =
+(
GenericB
@@ -436,15 +436,14 @@
er%22)
-%5C
+.
%0A
-.
get_
@@ -451,16 +451,17 @@
ackend()
+)
%0A%0A%0Aclass
|
f08b0e68a4fc05e7efb91b1eaa53823612d52536 | set learning rate of mknn | src/agents/mk_nn_train.py | src/agents/mk_nn_train.py | """ This module contains code for maintaining the basic Mario Kart AI agent's state-decision map. """
import logging
import os
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from torch.autograd import Variable
from src import helper, keylog
from src.agents.train_valid_data import get_mario_train_v... | Python | 0.000004 | @@ -543,17 +543,17 @@
te = 1e-
-4
+5
%0A%0A%0Aclass
|
46a98330d2e3915630df3850fd8f7c89ef7793e6 | terminate process when queue is empty | asyncexec/workers/generator_worker.py | asyncexec/workers/generator_worker.py | import asyncio
import aioprocessing
from uuid import uuid4
import traceback
import logging
logger = logging.getLogger(__name__)
TERMINATOR = 'TERM:' + str(uuid4())
class GeneratorWorker(object):
@staticmethod
def func_run(loop, queue, lock, event, func):
with lock:
for data in func():
... | Python | 0.000007 | @@ -1484,16 +1484,17 @@
_set()):
+i
%0A
@@ -1498,37 +1498,103 @@
-break
+logger.info(%22Queue is empty, terminating.%22)%0A exit(0)
%0A
|
c6362677dd8703cf9934ada5cfdcebf5a7dd7d94 | Add comment for new `testsetup` directive [skip ci] | astropy_helpers/sphinx/ext/doctest.py | astropy_helpers/sphinx/ext/doctest.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is a set of three directives that allow us to insert metadata
about doctests into the .rst files so the testing framework knows
which tests to skip.
This is quite different from the doctest extension in Sphinx itself,
which actually does somethin... | Python | 0 | @@ -1530,32 +1530,301 @@
tSkipDirective)%0A
+ # Code blocks that use this directive will not appear in the generated%0A # documentation. This is intended to hide boilerplate code that is only%0A # useful for testing documentation using doctest, but does not actually%0A # belong in the documentation itself.... |
9d4dd6d8ec6dd1058046eddbbadb408d73151e76 | Fix utils import bug | src/cclib/parser/utils.py | src/cclib/parser/utils.py | # This file is part of cclib (http://cclib.sf.net), a library for parsing
# and interpreting the results of computational chemistry packages.
#
# Copyright (C) 2006, the cclib development team
#
# The library is free software, distributed under the terms of
# the GNU Lesser General Public version 2.1 or later. You shou... | Python | 0.000001 | @@ -490,23 +490,16 @@
sion$%22%0A%0A
-import
from ase
|
3e0e99404f20e7b6847ca069e0844ba8c090415f | Fix work with django 1.6 | social/apps/django_app/default/fields.py | social/apps/django_app/default/fields.py | import json
import six
from django.core.exceptions import ValidationError
from django.db import models
try:
from django.utils.encoding import smart_unicode as smart_text
smart_text # placate pyflakes
except ImportError:
from django.utils.encoding import smart_text
class JSONField(six.with_metaclass(mod... | Python | 0.000003 | @@ -1036,32 +1036,192 @@
try:%0A
+ # with django 1.6 i have '%22%7B%7D%22' as default value here%0A if value%5B0%5D == value%5B-1%5D == '%22':%0A value = value%5B1:-1%5D%0A%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.