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 |
|---|---|---|---|---|---|---|---|
e8b757973c342e5afde3cc178bc812db2fd411e2 | fix 修复自动上报信息清空设备类型和状态信息 | cmdb/api.py | cmdb/api.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# 2017.3 update by guohongze@126.com
from django.http import HttpResponse
from models import Host, HostGroup, ASSET_TYPE, ASSET_STATUS
from django.core.paginator import Paginator, EmptyPage, InvalidPage
from django.views.decorators.csrf import csrf_exempt
from lib.common i... | Python | 0 | @@ -2594,16 +2594,18 @@
%0A
+ #
asset_t
@@ -2620,16 +2620,18 @@
%0A
+ #
status
@@ -3677,24 +3677,26 @@
= ip%0A
+ #
host.asset_
@@ -3716,24 +3716,26 @@
type%0A
+ #
host.status
|
59223d2e694530f6f779054e68bf5cf02a4c210e | fix pep8, localflavor/br/forms.py:41:83: W291 trailing whitespace | localflavor/br/forms.py | localflavor/br/forms.py | # -*- coding: utf-8 -*-
"""
BR-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, CharField, Select
from django.utils.translation impor... | Python | 0.000001 | @@ -1183,20 +1183,19 @@
must
+%0A
be in
-%0A
eith
|
91178909bab31e9db42d86d5783152890f65795d | update cms | cms/urls.py | cms/urls.py | from django.conf.urls import url
from cms import views
from django.contrib.auth import views as auth_views
urlpatterns = [
# 一覧
url(r'^dailyreport/$', views.daily_list, name='daily_list'),
# 日報操作
url(r'^dailyreport/add/$', views.daily_edit, name='daily_add'), # 登録
url(r'^dailyreport/mod/(?P<daily_... | Python | 0 | @@ -638,18 +638,15 @@
(?P%3C
-impression
+comment
_id%3E
@@ -740,32 +740,26 @@
/detail/(?P%3C
-daily_id
+pk
%3E%5Cd+)/$', vi
@@ -782,16 +782,18 @@
.as_view
+()
, name='
|
1e6697fbeb6cf404d9a542287184c981c3c9e6aa | Add gzip flag to count | codonpdx.py | codonpdx.py | #!/usr/bin/env python
import argparse
import codonpdx.calc
import codonpdx.count
import codonpdx.insert
import codonpdx.mirror
import codonpdx.queueJobs
import sys
# create the top-level parser
parser = argparse.ArgumentParser(prog='codonpdx',
description='Codonpdx command line utilit... | Python | 0 | @@ -844,32 +844,174 @@
t.add_argument(%0A
+ '-g',%0A '--gzipped',%0A action='store_true',%0A default=False,%0A help='Indicates the input is gzipped.'%0A)%0AparserCount.add_argument(%0A
'-j',%0A '-
|
b7d29e2a67c314b5d1aff343eef1a9ca2c3b0cbe | add dbl integration | cogs/dbl.py | cogs/dbl.py | import dbl
from cogs.cog import Cog
import logging
import asyncio
from threading import Thread
logger = logging.getLogger('debug')
class DBApi(Cog):
def __init__(self, bot):
super().__init__(bot)
self._token = self.bot.config.dbl_token
self.dbl = dbl.Client(self.bot, self._token)
... | Python | 0 | @@ -613,19 +613,102 @@
Thread(
-)%0A%0A
+target=self.run_webhook_server, args=(self.bot.loop,))%0A self.server.start()
%0A%0A as
|
da9f66dc6887895851132190cc82d51b42d57b6f | Add normalize_space option to StringField | grab/item/field.py | grab/item/field.py | from abc import ABCMeta, abstractmethod
from datetime import datetime
from ..tools.lxml_tools import clean_html
from ..tools.text import find_number
from .decorator import default, empty, cached, bind_item
from .const import NULL
class Field(object):
"""
All custom fields should extend this class, and overrid... | Python | 0.000004 | @@ -2251,32 +2251,200 @@
ngField(Field):%0A
+ def __init__(self, *args, **kwargs):%0A self.normalize_space = kwargs.pop('normalize_space', True)%0A super(StringField, self).__init__(*args, **kwargs)%0A%0A
@cached%0A
@@ -2562,38 +2562,96 @@
(self.xpath_exp)
-.text(
+%5C%0A ... |
0b16c74ec614bbd027020b8917d224bb7f97b5a1 | make accessor be called | grappa/resolver.py | grappa/resolver.py | # -*- coding: utf-8 -*-
import functools
from .empty import empty
from .assertion import AssertionProxy
from .operator import OperatorTypes
class OperatorResolver(object):
"""
Resolves and triggers an operator based on its name identifier.
This class is highly-coupled to `grappa.Test` and consumes `grapp... | Python | 0 | @@ -703,28 +703,32 @@
-self
+operator
.ctx.subject
@@ -818,32 +818,38 @@
on%0A self.
+test._
engine.add_asser
@@ -942,16 +942,49 @@
.chained
+ or self.ctx.subject is not empty
:%0A
|
1212966326eb096e10b52277b0c6b53126262e3b | Improve messages in example | examples/basic_usage.py | examples/basic_usage.py | import os
from twilio.twiml import Response
from twilio.rest import Client
ACCOUNT_SID = os.environ.get('TWILIO_ACCOUNT_SID')
AUTH_TOKEN = os.environ.get('TWILIO_AUTH_TOKEN')
def example():
"""
Some example usage of different twilio resources.
"""
client = Client(ACCOUNT_SID, AUTH_TOKEN)
print... | Python | 0.000028 | @@ -312,23 +312,18 @@
-print('
+#
Get all
the
@@ -322,20 +322,16 @@
all
-the
messages
...'
@@ -322,29 +322,24 @@
all messages
-...')
%0A all_mes
@@ -448,31 +448,26 @@
ges)))%0A%0A
-print('
+#
Get only las
@@ -478,26 +478,24 @@
messages...
-')
%0A some_me
@@ -530,25 +530,24 @@
t(limit=... |
9b5dc2f9998d374263b2e1d35d6b5cfc7a831b1e | undo setuid on return | univention-openvpn/openvpn-master2.py | univention-openvpn/openvpn-master2.py | #
# Univention OpenVPN integration -- openvpn-master2.py
#
__package__ = '' # workaround for PEP 366
import listener
from univention import debug as ud
import univention.uldap as ul
from datetime import date
from M2Crypto import RSA, BIO
from base64 import b64decode
name = 'openvpn-master2'
descript... | Python | 0.000002 | @@ -2430,16 +2430,44 @@
%3E maxu:%0A
+ listener.unsetuid()%0A
|
3c5b44608529b70267b79266945020bc4c45ccb2 | fix lack of dest folder | spidergram.py | spidergram.py | from bs4 import BeautifulSoup
import requests
import re
import os
import codecs
import unidecode
import arrow
# disable warning about HTTPS
try:
requests.packages.urllib3.disable_warnings()
except:
pass
class instaLogger:
def __init__(self, logfile):
self.logfile = logfile
def logEntry(self,... | Python | 0.000007 | @@ -102,16 +102,33 @@
rt arrow
+%0Aimport traceback
%0A%0A# disa
@@ -1424,24 +1424,93 @@
t, imgname)%0A
+ if not os.path.exists(rdest):%0A os.makedirs(rdest)%0A
try:
@@ -2057,24 +2057,87 @@
except:%0A
+ exc = traceback.format_exc()%0A print exc%0A
@... |
5ab3f3d06216381b697781d80069354745110de1 | make yaml put out unicode | plexlibrary/utils.py | plexlibrary/utils.py | # -*- coding: utf-8 -*-
import yaml
class Colors(object):
RED = "\033[1;31m"
BLUE = "\033[1;34m"
CYAN = "\033[1;36m"
GREEN = "\033[0;32m"
RESET = "\033[0;0m"
BOLD = "\033[;1m"
REVERSE = "\033[;7m"
class YAMLBase(object):
def __init__(self, filename):
with open(filename, 'r')... | Python | 0.000063 | @@ -29,16 +29,52 @@
rt yaml%0A
+from yaml import Loader, SafeLoader%0A
%0A%0Aclass
@@ -317,16 +317,316 @@
ename):%0A
+ # Make sure pyyaml always returns unicode%0A def construct_yaml_str(self, node):%0A return self.construct_scalar(node)%0A Loader.add_constructor(u'tag:yaml.org,2002:... |
819f1957f2575f24d9d9a99cb5999415f7e1247e | Add get_results_path() and get_child_experiments() to the experiments module. | experiments/__init__.py | experiments/__init__.py | import os
import retrying
import sys
import time
from .. import BaseAction, ActionStatus
from ..helpers import get_attribute, get_multiprint, save_pickle_gz
class BaseExperiment(BaseAction):
pass
class MetaExperiment(BaseExperiment):
pass
class Experiment(BaseExperiment):
DEFAULT_RESULTS_ROOT = os.path.... | Python | 0 | @@ -71,22 +71,8 @@
tion
-, ActionStatus
%0Afro
@@ -137,16 +137,680 @@
kle_gz%0A%0A
+def get_results_path(config, model_experiment_name, filename=''):%0A config.define('path.result.main.base', 'path.result.base', default=Experiment.DEFAULT_RESULTS_ROOT)%0A path = os.path.join(config('path.result.main.base'), mo... |
16bec17e7337fd1cbaef12934cfeae05a563719f | fix var scoping bug | inbox/util/url.py | inbox/util/url.py | from dns.resolver import Resolver
from dns.resolver import NoNameservers, NXDOMAIN, Timeout, NoAnswer
from urllib import urlencode
from inbox.log import get_logger
import re
log = get_logger('inbox.util.url')
from inbox.providers import providers
# http://www.regular-expressions.info/email.html
EMAIL_REGEX = re.compi... | Python | 0 | @@ -765,25 +765,24 @@
%5B1%5D.lower()%0A
-%0A
mx_recor
@@ -1857,32 +1857,35 @@
ds:%0A
+mx_
domain = str(rda
@@ -2112,24 +2112,27 @@
if
+mx_
domain%5B-1%5D =
@@ -2150,24 +2150,27 @@
+mx_
domain = dom
@@ -2166,16 +2166,19 @@
omain =
+mx_
domain%5B:
@@ -2193,24 +2193,27 @@... |
201a9d75e9c4a2c84372fe58a674977f2435130f | update fastapi example. | examples/fastapi/app.py | examples/fastapi/app.py | from fastapi import FastAPI, HTTPException, APIRouter
from honeybadger import honeybadger, contrib
from honeybadger.contrib import asgi
from honeybadger.contrib import fastapi
import pydantic
honeybadger.configure(api_key='c10787cf')
app = FastAPI()
# contrib.FastAPIHoneybadger(app)
app.add_middleware(asgi.ASGIHoneyb... | Python | 0 | @@ -96,85 +96,8 @@
rib%0A
-from honeybadger.contrib import asgi%0Afrom honeybadger.contrib import fastapi%0A
impo
@@ -170,42 +170,38 @@
API(
-)%0A# contrib.FastAPIHoneybadger(app
+title=%22Honeybadger - FastAPI.%22
)%0Aap
@@ -221,12 +221,15 @@
are(
-asgi
+contrib
.ASG
@@ -262,53 +262,8 @@
rs=%5B
-%22user-agent%2... |
ba084db6c16e5dee9e9ff06a3bee02f4dbfb5c82 | Add environment variable to control use of UNIX socket proxying | powerstrip.tac | powerstrip.tac | import os
from twisted.application import service, internet
#from twisted.protocols.policies import TrafficLoggingFactory
from urlparse import urlparse
from powerstrip.powerstrip import ServerProtocolFactory
application = service.Application("Powerstrip")
DOCKER_HOST = os.environ.get('DOCKER_HOST')
if DOCKER_HOST is... | Python | 0 | @@ -296,16 +296,83 @@
_HOST')%0A
+ENABLE_UNIX_SOCKET = os.environ.get('POWERSTRIP_UNIX_SOCKET', %22%22)%0A%0A
if DOCKE
@@ -493,16 +493,124 @@
ing in.%0A
+ if %22YES%22 in ENABLE_UNIX_SOCKET:%0A DOCKER_HOST = %22unix:///host-var-run/docker.real.sock%22%0A else:%0A
DOCK
@@ -644,29 +644,24 @@
-run/do... |
33e693337ab646eaccb724b9c4b3eb3352c6e412 | fix pagination | mapentity/pagination.py | mapentity/pagination.py | from rest_framework_datatables.pagination import DatatablesPageNumberPagination
class MapentityDatatablePagination(DatatablesPageNumberPagination):
""" Custom datatable pagination for Mapentity list views. """
def get_count_and_total_count(self, queryset, view):
""" Handle count for all filters """
... | Python | 0.998471 | @@ -209,20 +209,30 @@
ws. %22%22%22%0A
+ pass
%0A
+ #
def get
@@ -276,24 +276,26 @@
, view):%0A
+ #
%22%22%22 Han
@@ -323,24 +323,26 @@
ters %22%22%22%0A
+ #
count,
@@ -404,24 +404,26 @@
t, view)%0A
+ #
count =
@@ -506,16 +506,18 @@
ount%0A
+ #
ret
|
15104ee34d78002231d51a465d02f8807da3cfc0 | remove unused import | examples/quiver_demo.py | examples/quiver_demo.py | from matplotlib.toolkits.basemap import Basemap, interp
from pylab import show, title, arange, meshgrid, cm, figure, sqrt, \
colorbar, axes, gca, reshape, array, Float32, quiverkey
# read in data.
file = open('fcover.dat','r')
ul=[];vl=[];pl=[]
nlons=73; nlats=73
dellat = 2.5; dellon = 5.
for line in... | Python | 0.000003 | @@ -44,16 +44,8 @@
emap
-, interp
%0Afro
|
c7679393ae11766cc9da4474f4db1d0dbe50ac91 | Bump to 0.11.0 | watchman/__init__.py | watchman/__init__.py | __version__ = '0.10.1'
| Python | 0.000042 | @@ -11,13 +11,13 @@
_ = '0.1
-0.1
+1.0
'%0A
|
815fecf36f9c0114a9aa8594b58226ead223b313 | fix type bug | app/app.py | app/app.py | """Do work"""
import argparse
import logging
import os
import sys
from cameracontroller.cameracontroller import CameraController
from storage.cloudstorage import CloudStorage
logger = logging.getLogger('pypic')
log_dir = os.path.expanduser('~/log')
if not os.path.exists(log_dir):
os.makedirs(log_dir)
logging.bas... | Python | 0.000001 | @@ -889,16 +889,36 @@
ult=10,%0A
+ type=float,%0A
|
9b9631aade65c9be7fa632d5ae00060b2609224f | Load result JSON. | inthe_am/taskmanager/features/environment.py | inthe_am/taskmanager/features/environment.py | from collections import Counter
import json
import os
import string
from urlparse import urljoin
from django.conf import settings
from django.contrib.auth.models import User
from splinter.browser import Browser
TEST_COUNTERS = {
'following': Counter(),
'before': Counter(),
'demand': Counter()
}
ABSOLUTE... | Python | 0 | @@ -1589,32 +1589,64 @@
'result':
+ json.loads(%0A
context.browser
@@ -1675,32 +1675,36 @@
+
%22JSON.stringify(
@@ -1712,24 +1712,46 @@
S_ERRORS);%22%0A
+ )%0A
@@ -1930,16 +1930,48 @@
result':
+ json.loads(%0A
co... |
b0dd7879fbf2000c86a2f77995495d480c890713 | Add search by location | usecases/events/search_by_location.py | usecases/events/search_by_location.py | from predicthq import Client
# Please copy paste your access token here
# or read our Quickstart documentation if you don't have a token yet
# https://developer.predicthq.com/guides/quickstart/
ACCESS_TOKEN = 'abc123'
phq = Client(access_token=ACCESS_TOKEN)
| Python | 0 | @@ -255,8 +255,1929 @@
OKEN)%0A%0A%0A
+# The events endpoint supports three types of search by location:%0A# - by area%0A# - by fuzzy location search around%0A# - by geoname place ID (see places endpoint for more details)%0A%0A%0A# The within parameter allows you to search for events within%0A# a specified area. It ex... |
997cd53d1d045840118876227b9c5588e153195b | fix not equal override. thanks @hodgestar | cms/models.py | cms/models.py | import re
import unicodedata
RE_NUMERICAL_SUFFIX = re.compile(r'^[\w-]*-(\d+)+$')
from gitmodel import fields, models
class FilterMixin(object):
@classmethod
def filter(cls, **fields):
items = list(cls.all())
for field, value in fields.items():
if hasattr(cls, field):
... | Python | 0.000002 | @@ -1481,33 +1481,33 @@
eturn self.slug
-=
+!
= other.slug%0A%0A%0Ac
|
dbfb095f6b90c2517416652d53b6db6b5ee919a4 | Bump version | fabdeploy/__init__.py | fabdeploy/__init__.py | VERSION = (0, 3, 3, 'final', 0)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
if VERSION[3] != 'final':
version = '%s ... | Python | 0 | @@ -10,17 +10,17 @@
(0, 3,
-3
+4
, 'final
|
dc49ce292d4e0669598abb7f45ba389efde0dabc | Fix testTeleopPanel | src/python/tests/testTeleopPanel.py | src/python/tests/testTeleopPanel.py | from director import robotsystem
from director.consoleapp import ConsoleApp
from director import transformUtils
from director import visualization as vis
from director import objectmodel as om
from director import teleoppanel
from director import playbackpanel
from PythonQt import QtCore, QtGui
import numpy as np
d... | Python | 0.000001 | @@ -253,16 +253,51 @@
ackpanel
+%0Afrom director import planningutils
%0A%0Afrom P
@@ -1888,16 +1888,104 @@
anner)%0A%0A
+planningUtils = planningutils.PlanningUtils(robotStateModel, robotStateJointController)%0A
teleopPa
@@ -2205,16 +2205,31 @@
hidePlan
+, planningUtils
)%0A%0Amanip
|
e5f422315fbc3eb28f99d2be5f50232f4b081f85 | make ERT materiality list_editable | valuenetwork/valueaccounting/admin.py | valuenetwork/valueaccounting/admin.py | from django.contrib import admin
from valuenetwork.valueaccounting.models import *
from valuenetwork.valueaccounting.actions import export_as_csv
admin.site.add_action(export_as_csv, 'export_selected objects')
admin.site.register(Unit)
admin.site.register(AgentType)
class CategoryAdmin(admin.ModelAdmin):
list_d... | Python | 0.001909 | @@ -1185,16 +1185,31 @@
tegory',
+ 'materiality',
%5D%0A %0Aa
|
0d056e041f141391b115aef1f1cc5aa684876535 | save signature saliency | view_saliency.py | view_saliency.py | #!/usr/bin/env python
import cv2
import numpy
import sys
import salienpy.frequency_tuned
import salienpy.signature
def main(img):
cv2.imshow('Original Image', img)
ftuned = salienpy.frequency_tuned.frequency_tuned_saliency(img)
cv2.imshow('Frequency Tuned', ftuned)
signa = salienpy.signature.signature_... | Python | 0 | @@ -371,16 +371,56 @@
signa)%0A
+ cv2.imwrite('signature.png', signa)%0A
cv2.
|
28968ca117fc18dfe513c06ce4ead2295830fd94 | remove redundant parenthesis | plugins/BasePlugin.py | plugins/BasePlugin.py | __author__ = 'marcusmorgenstern'
__mail__ = ''
from abc import ABCMeta, abstractmethod
class BasePlugin():
"""
Metaclass for guarantee of interface. Each plugin must provide initialisation taking optional configuration
and invoke method taking data
"""
__metaclass__ = ABCMeta
def __init__(s... | Python | 0.999999 | @@ -103,10 +103,8 @@
ugin
-()
:%0A
|
b754ee143ed0a022706bfeed287e392e11dd0e28 | Update to work with python3 | external/stacktracer.py | external/stacktracer.py | """Stack tracer for multi-threaded applications.
Usage:
import stacktracer
stacktracer.start_trace("trace.html",interval=5,auto=True) # Set auto flag to always update file!
....
stacktracer.stop_trace()
"""
# Source: http://code.activestate.com/recipes/577334-how-to-debug-deadlocked-multi-threaded-programs/
impor... | Python | 0 | @@ -2282,20 +2282,20 @@
fout =
-file
+open
(self.fp
@@ -2341,16 +2341,22 @@
t.write(
+bytes(
stacktra
@@ -2360,16 +2360,26 @@
traces()
+, %22UTF-8%22)
)%0A
|
aba9a4dce1c10b975fcd5d33acc9d4636310ef4a | move translation fields to bottom of admin detail page | src/pressroom/models.py | src/pressroom/models.py | # python imports
from datetime import datetime
from django_extensions.db.fields import AutoSlugField
import os
# django imports
from django.conf import settings
from django.contrib.comments.moderation import CommentModerator, moderator
from django.core.urlresolvers import reverse
from django.db import models
... | Python | 0 | @@ -955,190 +955,8 @@
%0D%0A%0D%0A
- language = models.CharField(max_length=10, default=settings.LANGUAGE_CODE, choices=settings.LANGUAGES)%0D%0A translation_of = models.ForeignKey('Article', null=True, blank=True)%0D%0A
@@ -1988,24 +1988,208 @@
nk=True)%0D%0A%0D%0A
+ language = models.CharField(max_le... |
0d5f8ab05b9f971edb1591e3d80d6972732430fe | Remove side-effect of renaming test. | plugins/Owner/test.py | plugins/Owner/test.py | ###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James McCoy
# 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 copyr... | Python | 0 | @@ -3831,16 +3831,120 @@
ommand')
+%0A self.assertNotError('unrename Admin')%0A self.assertNotRegexp('list Admin', 'testcommand')
%0A%0A @s
|
a500a9917787dec5c54c8d15949454ffb4a775ff | Remove unneeded RESPONSE definitions | examples/tcamapp/app.py | examples/tcamapp/app.py | import gi
gi.require_version ("Gtk", "3.0")
gi.require_version ("Gst", "1.0")
gi.require_version ("Tcam", "0.1")
from gi.repository import GdkX11, Gtk, Tcam, GstVideo, Gst, GdkPixbuf
import sys
class DeviceDialog (Gtk.Dialog):
RESPONSE_OK = 1
RESPONSE_CANCEL = 2
def __init__(self, parent=None):
... | Python | 0.000003 | @@ -230,52 +230,8 @@
g):%0A
- RESPONSE_OK = 1%0A RESPONSE_CANCEL = 2%0A
|
79e2044380d2d5a9568b76777bc7b1950dcaaeb8 | Bump version to 14.1.0 | recipe_scrapers/__version__.py | recipe_scrapers/__version__.py | __version__ = "14.0.0"
| Python | 0 | @@ -11,13 +11,13 @@
_ = %2214.
-0
+1
.0%22%0A
|
352b628955809e19a7ba6f78631d79afcc85d94a | Fix code coverage in mpi4py.typing | src/mpi4py/typing.py | src/mpi4py/typing.py | # Author: Lisandro Dalcin
# Contact: dalcinl@gmail.com
"""Typing support."""
# pylint: disable=unnecessary-ellipsis
# pylint: disable=too-few-public-methods
import sys
from typing import (
Any,
Union,
Optional,
Sequence,
List,
Dict,
Tuple,
)
from numbers import (
Integral,
)
from .MPI ... | Python | 0.000006 | @@ -401,17 +401,38 @@
(3, 8):
+ # pragma: no branch
%0A
-
from
@@ -460,16 +460,36 @@
ol%0Aelse:
+ # pragma: no cover
%0A try
@@ -1179,32 +1179,52 @@
.%22%22%22%0A ...
+ # pragma: no cover
%0A%0A%0Aclass Support
@@ -1492,16 +1492,36 @@
...
+ # pragma: no cover
%0A%0A de
@@ -1653,16 +1... |
725785c59ca6aca23338b0f727dd2c492cb166df | fix a silly bug | process/LDA.py | process/LDA.py | # -*- coding: utf-8 -*-
import jieba
import time
import json
import pickle
import os
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
from util import RAW_DATA_DIR
from util import STOP_WORDS
from util import LDA_MODEL_PATH
from util import DOC_PAT... | Python | 0.000753 | @@ -2595,27 +2595,19 @@
le.dump(
-pickle.dump
+lda
, open(L
|
7009e1f0b316da5f17247786810676f70d282f93 | Add assertion.__all__ | extenteten/assertion.py | extenteten/assertion.py | import collections
import numpy
import tensorflow as tf
from .util import func_scope
def is_int(num):
return (isinstance(num, int)
or isinstance(num, numpy.integer)
or (isinstance(num, numpy.ndarray)
and num.ndim == 0
and issubclass(num.dtype.type, numpy.in... | Python | 0.002638 | @@ -81,16 +81,139 @@
scope%0A%0A%0A
+__all__ = %5B%0A 'is_int',%0A 'is_natural_num',%0A 'is_natural_num_sequence',%0A 'is_sequence',%0A 'assert_no_nan',%0A%5D%0A%0A%0A
def is_i
|
0a79307cc5a0ece09a72faf2a530c768fe72311a | Fix scope of keymap | confluent_server/confluent/selfservice.py | confluent_server/confluent/selfservice.py | import confluent.config.configmanager as configmanager
import confluent.collective.manager as collective
import confluent.netutil as netutil
import confluent.sshutil as sshutil
import confluent.util as util
import eventlet.green.subprocess as subprocess
import crypt
import json
import time
import yaml
currtz = None
ke... | Python | 0.000001 | @@ -512,24 +512,42 @@
obal currtz%0A
+ global keymap%0A
global c
|
3876130a94f3a43a6b34dd3be22ef963238bda3b | fix migration | mygpo/usersettings/migrations/0002_move_existing.py | mygpo/usersettings/migrations/0002_move_existing.py | import json
from django.db import migrations
from django.contrib.contenttypes.models import ContentType
def move_podcastsettings(apps, schema_editor):
PodcastConfig = apps.get_model("subscriptions", "PodcastConfig")
UserSettings = apps.get_model("usersettings", "UserSettings")
for cfg in PodcastConfig.... | Python | 0 | @@ -43,67 +43,8 @@
ons%0A
-from django.contrib.contenttypes.models import ContentType%0A
%0A%0Ade
@@ -215,32 +215,96 @@
%22UserSettings%22)
+%0A ContentType = apps.get_model('contenttypes', 'ContentType')
%0A%0A for cfg in
@@ -645,14 +645,11 @@
cts.
-filter
+get
(app
@@ -667,19 +667,16 @@
casts',%0A
-
... |
5c50d3fcda08da468b2f6b5e61fa1777cc08b17b | FIx test. | kolibri/content/test/test_downloadcontent.py | kolibri/content/test/test_downloadcontent.py | import os
import tempfile
import hashlib
import mimetypes
from django.test import TestCase, Client
from django.test.utils import override_settings
from kolibri.auth.models import DeviceOwner
from kolibri.content.models import File, ContentNode
from kolibri.content.utils.paths import get_content_storage_file_path
from l... | Python | 0 | @@ -892,13 +892,8 @@
n =
-dict(
file
@@ -905,27 +905,11 @@
ats.
-choices).get(%22pdf%22)
+PDF
%0A
|
b410cbc1d58c5dce85b1bdff85fa881de58bf299 | fix BadArgument | cogs/error.py | cogs/error.py | #!/bin/env python
from discord.ext.commands import errors
import sys
import traceback
class ErrorHandler:
def __init__(self, bot):
self.bot = bot
async def on_command_error(self, ctx, error):
""" Handle command errors more gracefully """
if isinstance(error, errors.CommandNotFound):... | Python | 0.998609 | @@ -1238,26 +1238,27 @@
end(
-f'%7B
error.
-message%7D'
+__traceback__
)%0A%0A
|
08cb7b6d6ff7131fd378ff75a2de624d349dfd30 | Change version to 2.9 | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
#
# Jansson documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 5 21:47:20 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | Python | 0.000001 | @@ -1664,12 +1664,8 @@
'2.9
--dev
'%0A#
|
d45f8c91a11c31c3a9a600d181836950259b8668 | remove error prints | repository/netrepos/netauth.py | repository/netrepos/netauth.py | #
# Copyright (c) 2004 Specifix, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/li... | Python | 0.000001 | @@ -597,28 +597,8 @@
ite3
-%0Afrom lib import log
%0A%0Acl
@@ -753,58 +753,8 @@
me:%0A
- log.error(%22repository name mismatch%22)%0A
@@ -833,32 +833,32 @@
return True%0A%0A
+
if not a
@@ -874,55 +874,8 @@
0%5D:%0A
- log.error(%22no authtoken received%22)%0A
@@ -2073,7... |
164f8e665dd2a292dbfe44ba98989725c209990d | Update radio.py | cogs/radio.py | cogs/radio.py | from .utils import config, checks, formats
import discord
from discord.ext import commands
import discord.utils
from .utils.api.pycopy import Copy
import random, json, asyncio
class Radio:
"""The radio-bot related commands."""
def __init__(self, bot):
self.bot = bot
self.player = N... | Python | 0.000001 | @@ -784,16 +784,20 @@
y_creds(
+self
):%0D%0A
|
76f699b91aacfce180268be32fe0689ae7b4bd47 | Fix up doc-strings and line-lengths | requests_ntlm/requests_ntlm.py | requests_ntlm/requests_ntlm.py | from requests.auth import AuthBase
from requests.adapters import HTTPAdapter
from requests.models import PreparedRequest
from ntlm import ntlm
import weakref
class HttpNtlmAuth(AuthBase):
"""HTTP NTLM Authentication Handler for Requests. Supports pass-the-hash."""
def __init__(self, username, password, sessi... | Python | 0.004543 | @@ -183,23 +183,29 @@
hBase):%0A
+%0A
%22%22%22
+%0A
HTTP NTL
@@ -242,16 +242,21 @@
equests.
+%0A%0A
Support
@@ -271,16 +271,21 @@
he-hash.
+%0A
%22%22%22%0A%0A
@@ -351,33 +351,93 @@
+r
%22%22%22
-%0A :
+Create an authentication handler for NTLM over HTTP.%0A%0A :param... |
1a83696454d5be09b07d1e1e6a23ea76c77012a9 | Fix global imports | src/rnaseq_lib/__init__.py | src/rnaseq_lib/__init__.py | import rnaseq_lib.R
import rnaseq_lib.civic
import rnaseq_lib.data
import rnaseq_lib.de
import rnaseq_lib.dim_red
import rnaseq_lib.docker
import rnaseq_lib.drugs
import rnaseq_lib.graphs
import rnaseq_lib.gtf
import rnaseq_lib.images
import rnaseq_lib.plotting
import rnaseq_lib.tissues
import rnaseq_lib.utils
import ... | Python | 0.005989 | @@ -1,24 +1,4 @@
-import rnaseq_lib.R%0A
impo
@@ -59,17 +59,23 @@
eq_lib.d
-e
+iff_exp
%0Aimport
@@ -214,16 +214,17 @@
.images%0A
+%0A
import r
@@ -241,12 +241,89 @@
plot
-ting
+%0Aimport rnaseq_lib.plot.dr%0Aimport rnaseq_lib.plot.hview%0Aimport rnaseq_lib.tissues
%0Aimp
@@ -336,32 +336,39 @@
aseq_lib.tissues... |
1a6516765f7d95d8a3d89449dc181a9de27cb868 | Shove the input into the main method | files/create_project.py | files/create_project.py | #
# This script checks to see if a project exists for the given
# app_env/team.
#
import os
import sys
from optparse import OptionParser
from urllib import quote
from sentry.utils.runner import configure
configure()
from django.conf import settings
# Add in the sentry object models
from sentry.models import Organiza... | Python | 0.999874 | @@ -160,204 +160,8 @@
te%0A%0A
-from sentry.utils.runner import configure%0Aconfigure()%0A%0Afrom django.conf import settings%0A%0A# Add in the sentry object models%0Afrom sentry.models import Organization, Project, ProjectKey, Team, User%0A%0A
%0Adef
@@ -825,34 +825,28 @@
oject%22,
-action=%22store_true
+type=%22s... |
918a168b53e9f026393aaa17347fc855f7e4a70a | add background task, remove extra roles code, use .format | files/devops/fabfile.py | files/devops/fabfile.py | # Fabfile from Quickstart
# qkst.io/devops/fabfile
from fabric.api import (
task, parallel, roles,
run, local, sudo, put,
env, settings
)
from fabric.contrib.project import rsync_project
from fabric.context_managers import cd, prefix
from fabric.tasks import execute
env.user = 'root'
env.roledefs = {
... | Python | 0.000001 | @@ -283,283 +283,353 @@
env.
-user
+hosts
=
+%5B
'root
-'%0A%0Aenv.roledefs = %7B%0A 'local': %5B'localhost:22'%5D%0A%7D%0A%0Aenv.roledefs%5B'all'%5D = %5Bhost for role in env.roledefs.values() for host in role%5D%0A%0A%0A@task%0A@roles('local')%0Adef setup():%0A sudo('apt-get update')%0A sudo('apt-get in... |
a4f69decb2b22822660033265a6517510c8a2eb5 | clean up some convert some strings to fstrings use fewer imports | cogs/utils.py | cogs/utils.py | # -*- coding: utf-8 -*-
from discord.ext import commands
from datetime import datetime
from cogs.cog import Cog
import discord
class Utils(Cog):
"""The description for Utils goes here."""
@commands.command(name='reload', hidden=True)
@commands.is_owner()
async def cog_reload(self, ctx, *, cog: str):... | Python | 0.000523 | @@ -789,17 +789,16 @@
1000:.2f
-)
%7D ms%22)%0A%0A
|
8c0f1741f015c8ffd475a2639a113abcec8e6bba | Update copyright year. | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
#
# Moulder documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 14 11:15:19 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't picklea... | Python | 0 | @@ -1468,17 +1468,17 @@
2009-201
-4
+5
, Sali L
|
ca26358be15da6fdb90113de98493b54965b82ef | Rename kwargs | flask_email/__init__.py | flask_email/__init__.py | # -*- coding: utf-8 -*-
"""
flask.ext.email
~~~~~~~~~~~~~
Flask extension for sending email.
"""
__version__ = '1.4.3'
"""
Tools for sending email.
"""
from flask import current_app as app
from .utils import import_module
# Imported for backwards compatibility, and for the sake
# of a cleaner namespace... | Python | 0.001059 | @@ -754,17 +754,19 @@
se, **kw
-d
+arg
s):%0A
@@ -1597,17 +1597,19 @@
ly, **kw
-d
+arg
s)%0A%0A%0Adef
|
74ecefd4e67112c2a1e7f1a7e5c1ed3b9f441d52 | Remove old call to connect() | flask_simon/__init__.py | flask_simon/__init__.py | __version__ = '0.2.0'
from bson.errors import InvalidId
from bson.objectid import ObjectId
from flask import abort
from pymongo import uri_parser
from simon import Model, connection, geo, query
from werkzeug.routing import BaseConverter, ValidationError
__all__ = ('Simon', 'get_or_404', 'Model', 'connection', 'geo', ... | Python | 0 | @@ -2598,206 +2598,8 @@
_set
-%0A%0A connection.connect(host_or_uri=host, name=name, alias=alias,%0A username=username, password=password,%0A replicaSet=replica_set)
%0A
|
fd5cb81b39fd5d9f812dc3f01614f357034a5878 | update docs copyright notice | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
import os.path
import sys
from sphinx import version_info as sphinx_version_info
# Ensure we can import "mongoc" and "taglist" extension modules.
sys.path.append(os.path.dirname(__file__))
extensions = [
'mongoc',
'taglist',
'sphinx.ext.intersphinx',
'sphinx.ext.extlinks',
]
... | Python | 0 | @@ -400,16 +400,24 @@
= '2017
+-present
, MongoD
|
923889f40e6706aa6d9f72d32eed94fb74e0e152 | Remove non-existent directories from html_static_path | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
#
# pylearn2 documentation build configuration file
# It is based on Theano documentation build
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module impo... | Python | 0.000056 | @@ -3996,16 +3996,20 @@
path = %5B
+%5D #
'.static
|
84a652025bbb0abffd4b0c7b464f267723084cff | Update TL.py | collect/TL.py | collect/TL.py | # printで表示する状態情報は半角6文字以内にすること
import os
import time
import datetime
import hashlib
import urllib
import sqlite3
import tweepy as tp
import detector
import oauth
class StreamListener(tp.StreamListener):
def __init__(self, api):
"""コンストラクタ"""
self.api = api
# 保存先
self.old_date = date... | Python | 0.000001 | @@ -5671,16 +5671,17 @@
se
+l
f.fileno
|
ba81222c33b4b80c5148c21bb30c60412c85847b | Fix search query | files/kernel-cleanup.py | files/kernel-cleanup.py | #!/usr/bin/env python2.7
"""
kernel-cleanup.py
Find all installed kernel-related packages and mark them as automatically
installed. Then, purge those of these packages that APT now considers
auto-removable.
Ubuntu APT has logic that prevents us from removing all kernels this way.
As an additional safeguard, we always... | Python | 0.999382 | @@ -901,19 +901,20 @@
ion
-==
+in (
%22kernel%22
and
@@ -909,16 +909,26 @@
%22kernel%22
+, %22utils%22)
and pkg
|
1c17b4b10374129d9e26f7023a93ea587dfe7fc7 | update version number to 1.0.10-pre as prep for staging/release | findingaids/__init__.py | findingaids/__init__.py | __version_info__ = (1, 0, 9, None)
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join(str(i) for i in __version_info__[:-1])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
#THIS IS DUPLICATE CODE FROM DWRANGLER AND SHOULD EVENTUALLY B... | Python | 0 | @@ -23,15 +23,17 @@
0,
-9, None
+10, 'pre'
)%0A%0A#
@@ -798,16 +798,95 @@
verall.%0A
+# TODO: update to use new render shortcut provided in newer versions of django%0A
def rend
|
d0ee1301ff85c9975946203bd2b52ba03ddae2d0 | Fix deferred initialization of app object. | flask_dynamo/manager.py | flask_dynamo/manager.py | """Main Flask integration."""
from os import environ
from boto.dynamodb2 import connect_to_region
from boto.dynamodb2.table import Table
from flask import (
_app_ctx_stack as stack,
)
from .errors import ConfigurationError
class Dynamo(object):
"""DynamoDB wrapper for Flask."""
DEFAULT_REGION = 'us-e... | Python | 0 | @@ -684,32 +684,55 @@
on.%0A %22%22%22%0A
+ self.app = app%0A
self.ini
|
d516e43e04d51852de6fe4aaeaa00ea75211bda7 | add - api methods to pass along endorse/exclude counts | flickipedia/web/rest.py | flickipedia/web/rest.py | """
Defines restful interface to backend
"""
from flickipedia.mysqlio import DataIOMySQL
from flickipedia.config import schema
from flickipedia.config import log
from flickipedia.model.articles import ArticleModel
from flickipedia.model.photos import PhotoModel
from flickipedia.model.likes import LikeModel
from flic... | Python | 0 | @@ -3759,28 +3759,612 @@
clude else 0%0A return res%0A
+%0A%0Adef api_method_endorse_count(article_id, photo_id):%0A %22%22%22model logic for producing photo endorse count%0A%0A :param article_id: article local id%0A :param photo_id: photo local id%0A %22%22%22%0A lm = LikeModel()%0A return lm... |
8700bcaabc2470849a47383c991c37a886da1b4a | add profiler | corehq/apps/data_interfaces/dispatcher.py | corehq/apps/data_interfaces/dispatcher.py | from django.utils.decorators import method_decorator
from corehq import privileges
from corehq.apps.accounting.decorators import requires_privilege_with_fallback
from corehq.apps.reports.dispatcher import ReportDispatcher, ProjectReportDispatcher, datespan_default
from corehq.apps.users.decorators import require_permis... | Python | 0.000002 | @@ -481,16 +481,63 @@
vilege%0A%0A
+from dimagi.utils.decorators.profile import *%0A%0A
require_
@@ -712,24 +712,87 @@
NTERFACES'%0A%0A
+ @profile(%22/home/sravfeyn/src/hotshot-logfiles/users.prof%22)%0A
def disp
|
61e67ed5740148f74e67aef09afc65ef1c3fd6a8 | Handle commands in a very trivial way | hackday_bot/bot.py | hackday_bot/bot.py | """hackday_bot.bot module."""
import logging
import time
from prawcore.exceptions import PrawcoreException
logger = logging.getLogger(__package__)
class Bot(object):
"""Bot manages comments made to the specified subreddit."""
def __init__(self, subreddit):
"""Initialize an instance of Bot.
... | Python | 0.00022 | @@ -38,16 +38,26 @@
logging%0A
+import re%0A
import t
@@ -112,16 +112,208 @@
eption%0A%0A
+AVAILABLE_COMMANDS = ('help', 'interested', 'join', 'leave', 'uninterested')%0ACOMMAND_RE = re.compile(r'(?:%5CA%7C%5Cs)!(%7B%7D)(?=%5Cs%7C%5CZ)'%0A .format('%7C'.join(AVAILABLE_COMMANDS)))%0A%0A
%0Alog... |
8c519c3d91e7bb9acf7f2bfedbf97c7b2a911a14 | add host and port params to Emulator | anom/testing/emulator.py | anom/testing/emulator.py | import logging
import os
import re
import signal
import shlex
import subprocess
from queue import Empty, Queue
from threading import Thread
#: The command to run in order to start the emulator.
_emulator_command = "gcloud beta emulators datastore start --consistency={consistency:0.2f} --no-store-on-disk"
#: The reg... | Python | 0 | @@ -281,16 +281,42 @@
cy:0.2f%7D
+ --host-port=%7Bhost%7D:%7Bport%7D
--no-st
@@ -327,16 +327,24 @@
on-disk%22
+ # noqa
%0A%0A#: The
@@ -701,24 +701,150 @@
Parameters:%0A
+ host(str): The host name the emulator should bind to.%0A port(int): The port on which the emulator should listen on.%0A
cons... |
c18e43769b50dff68defb6a8d55dec89824d3d55 | Use PyQt5 instead of PySide | src/qt_display_video.py | src/qt_display_video.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2016 Jean Nassar
# Released under BSD version 4
"""
A Qt display window.
Displays a video feed, and can also show the drone state and connection problems
in the status bar.
"""
import sys
from threading import Lock
from PySide import QtCore, QtGui
import rospy
fr... | Python | 0 | @@ -275,12 +275,11 @@
m Py
-Side
+Qt5
imp
@@ -295,16 +295,27 @@
e, QtGui
+, QtWidgets
%0A%0Aimport
@@ -527,19 +527,23 @@
splay(Qt
-Gui
+Widgets
.QMainWi
@@ -1429,19 +1429,23 @@
box = Qt
-Gui
+Widgets
.QLabel(
@@ -4117,19 +4117,23 @@
app = Qt
-Gui
+Widgets
.QApplic
|
61cf4e2feb3d8920179e28719822c7fb34ea6550 | Add defaults to the ibm RNG | 3/ibm_rng.py | 3/ibm_rng.py | def ibm_rng(x1, a, c, m):
x = x1
while True:
x = (a * x + c) % m
yield x / (m-1)
def main():
rng = ibm_rng(1, 65539, 0, 2**31)
while True:
x = next(rng)
print(x)
if __name__ == '__main__':
main()
| Python | 0.000002 | @@ -14,14 +14,28 @@
1, a
+=65539
, c
+=0
, m
+=2**31
):%0A
|
776c2992b64911f86740cdf0af4f05c7587430c7 | Bump version | hbmqtt/__init__.py | hbmqtt/__init__.py | # Copyright (c) 2015 Nicolas JOUANIN
#
# See the file license.txt for copying permission.
VERSION = (0, 9, 4, 'final', 0)
| Python | 0 | @@ -105,17 +105,17 @@
9,
-4, 'final
+5, 'alpha
', 0
|
6cd42058f3a2054e10b58a1a27a45481e608a23b | Refactor require.deb.key() to avoid code duplication [#141] | fabtools/require/deb.py | fabtools/require/deb.py | """
Debian packages
===============
This module provides high-level tools for managing Debian/Ubuntu packages
and repositories.
"""
from __future__ import with_statement
from fabric.api import hide, run, settings
from fabric.utils import puts
from fabtools.deb import (
add_apt_key,
apt_key_exists,
insta... | Python | 0 | @@ -170,51 +170,8 @@
nt%0A%0A
-from fabric.api import hide, run, settings%0A
from
@@ -1057,328 +1057,41 @@
%22%22%0A%0A
- # Command extracted from apt-key source%0A gpg_cmd = 'gpg --ignore-time-conflict --no-options --no-default-keyring --keyring /etc/apt/trusted.gpg'%0A%0A with settings(hide('everything'),... |
a7bc77727f972b69052079f613a781c76de8bd29 | fix pep8 | frigg/helpers/github.py | frigg/helpers/github.py | # -*- coding: utf8 -*-
import json
import requests
from django.conf import settings
def get_pull_request_url(build):
if build.pull_request_id > 0:
return 'https://github.com/%s/%s/pull/%s' % (build.project.owner, build.project.name,
build.pull_request_... | Python | 0.000001 | @@ -3750,16 +3750,33 @@
.format(
+%0A
build.de
@@ -3804,16 +3804,29 @@
nt_url()
+%0A
)%0A
|
0202eeed429149cbfafd53d9ba6281a0926ea9df | Add labels to account forms and add a NewUserWithPasswordForm that adds password inputs to the new user form. | froide/account/forms.py | froide/account/forms.py | from django import forms
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from helper.widgets import EmailInput
class NewUserForm(forms.Form):
first_name = forms.CharField(max_l... | Python | 0 | @@ -314,32 +314,79 @@
d(max_length=30,
+%0A label=_('First name'),%0A
widget=forms.Te
@@ -423,32 +423,48 @@
_('First Name'),
+%0A
'class': 'inlin
@@ -515,16 +515,62 @@
ngth=30,
+%0A label=_('Last name'),%0A
widget=
@@ -581,33 +581,24 @@
s.TextInput(
-... |
2db84e6c94fdc8de821a98442ce928db9dd73441 | Sponsored event should dump title | src/remotedb/dumpers.py | src/remotedb/dumpers.py | import collections
import functools
import urllib.parse
from django.core.serializers.json import DjangoJSONEncoder
SITE_PREFIX = 'https://tw.pycon.org/2016/media/'
USER_DUMP_KEYS = [
'bio', 'email', 'speaker_name',
'facebook_profile_url', 'github_id', 'twitter_id',
]
PROPOSAL_DUMP_KEYS = SPONSORED_EVENT_DU... | Python | 0.999635 | @@ -1834,24 +1834,54 @@
ored_talk',%0A
+ 'title': event.title,%0A
'spe
|
487e1f1d07eb7f2bf16315432e48a3c70681da32 | Fix warning | froide/helper/spam.py | froide/helper/spam.py | import logging
from datetime import timedelta, datetime
from django.core.cache import cache
from django import forms
from django.conf import settings
from django.contrib.gis.geoip2 import GeoIP2
from django.utils.translation import gettext_lazy as _
from froide.helper.utils import get_client_ip
logger = logging.get... | Python | 0.000008 | @@ -800,17 +800,15 @@
ger.
-exception
+warning
(e)%0A
|
846adf9c0b96ab18367258a19fd2c15a9cef7473 | Add fallback | src/sentry_slack/plugin.py | src/sentry_slack/plugin.py | """
sentry_slack.plugin
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2015 by Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import operator
import sentry_slack
from django import forms
from django.db.models import Q
from sentry import http
from sentry.models import TagKey, TagValu... | Python | 0.000004 | @@ -999,16 +999,17 @@
%0A )%0A%0A
+%0A
class Sl
@@ -4418,16 +4418,51 @@
ts': %5B%7B%0A
+ 'fallback': title,%0A
|
7618839b4fb3d52f1ac083f2ead48eb5f2f4a00c | Fix accidental tab | mk2/plugins/shutdown.py | mk2/plugins/shutdown.py | from mk2.plugins import Plugin
from mk2.events import Hook, ServerStop, StatPlayers, StatPlayerCount
class Shutdown(Plugin):
restart_warn_message = Plugin.Property(default="WARNING: planned restart in {delay}.")
stop_warn_message = Plugin.Property(default="WARNING: server going down for planned maintai... | Python | 0.000035 | @@ -902,9 +902,12 @@
.%22)%0A
-%09
+
aler
|
468ca16319977628bdae2be527514a30b35dd6fa | Fixed a misplaced parenthesis. | django/core/management/commands/syncdb.py | django/core/management/commands/syncdb.py | from django.core.management.base import NoArgsCommand
from django.core.management.color import no_style
from django.utils.importlib import import_module
from optparse import make_option
import sys
try:
set
except NameError:
from sets import Set as set # Python 2.3 fallback
class Command(NoArgsCommand):
... | Python | 0.999999 | @@ -3199,16 +3199,17 @@
db_table
+)
in tabl
@@ -3212,17 +3212,16 @@
tables))
-)
:%0A
|
3c4e65f123dc56255262e38a934b9cacd03c0bfe | remove debug prints | django_babel/management/commands/babel.py | django_babel/management/commands/babel.py | #-*- coding: utf-8 -*-
import os
from distutils.dist import Distribution
from optparse import make_option
from subprocess import call
from django.core.management.base import LabelCommand, CommandError
from django.conf import settings
class Command(LabelCommand):
args = '[makemessages] [compilemessages]'
op... | Python | 0.000001 | @@ -2404,38 +2404,16 @@
path))%0A%0A
- print cmd%0A
@@ -2661,34 +2661,8 @@
le%5D%0A
- print cmd%0A
|
294254aad0d798ffcfca6e34b48b4ed704bb5cd0 | Simplify CachingManager logic | django_prices_openexchangerates/models.py | django_prices_openexchangerates/models.py | from __future__ import unicode_literals
from decimal import Decimal
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.cache import cache
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_un... | Python | 0.000007 | @@ -599,96 +599,27 @@
)%0A%0A%0A
-class CachingManager(models.Manager):%0A%0A def get_rate(self, to_currency): # noqa%0A
+def get_rates(qs):%0A
@@ -662,41 +662,8 @@
EY)%0A
- update_cache = False%0A
@@ -687,36 +687,32 @@
_rates:%0A
-
conversion_rates
@@ -719,210 +719,261 @@... |
c2fedd9a34f01c5268e13caf48aa57cd80fca423 | correct error message | pyanno/util.py | pyanno/util.py | # Copyright (c) 2011, Enthought, Ltd.
# Authors: Pietro Berkes <pberkes@enthought.com>, Andrey Rzhetsky,
# Bob Carpenter
# License: Modified BSD license (2-clause)
import numpy as np
from numpy import log
from numpy.core import getlimits
from scipy.special import gammaln
import time
import logging... | Python | 0.000009 | @@ -4127,38 +4127,37 @@
Error('No valid
-observ
+annot
ations')%0D%0A%0D%0A
@@ -4538,30 +4538,29 @@
r('No valid
-observ
+annot
ations')%0D%0A%0D%0A
|
a21b9588002013c5efff895e63f29fe362110656 | Spell checker: identify multiple positions of mispelled word - precision : 0.05457300369812355 - recall : 0.6653793967226803 | src/righter/__init__.py | src/righter/__init__.py | """
Identifies common English writing mistakes
"""
import re
import unicodedata
from righter import dictionary
from righter import utils
def check_spelling(text):
"""
Check if a text has spelling errors.
Return a list with objects:
{
"selection": <wrong-spelled-word>,
"star... | Python | 0.999581 | @@ -132,16 +132,319 @@
utils%0A%0A%0A
+def findall(sub, string):%0A %22%22%22%0A %3E%3E%3E text = %22Allowed Hello Hollow%22%0A %3E%3E%3E tuple(findall('ll', text))%0A (1, 10, 16)%0A %22%22%22%0A index = 0 - len(sub)%0A try:%0A while True:%0A index = string.index(sub, index + len... |
0cb57a8cd6aa00ee2692e019f78fc6301231d99d | fix bug? | pyautodroid.py | pyautodroid.py | # -*- coding: utf-8 -*-
'''Android UI Testing Module for Nox App Player'''
import os
from subprocess import Popen, PIPE, call
import cv2
ADB_PATH = 'C:/Program Files (x86)/Nox/bin/nox_adb.exe'
SHARED_DIR = os.getenv('HOMEPATH')+'/Nox_share'
LATEST_MATCH_LOC = [0, 0]
def find_img(device, temp, threshold=0.... | Python | 0 | @@ -3226,18 +3226,23 @@
53
-4291588597
+'+str(loc%5B0%5D)+'
;'%0D%0A
@@ -3305,18 +3305,23 @@
54
-4294258463
+'+str(loc%5B1%5D)+'
;'%0D%0A
|
2a5fbcd2e3da01150c2690c145100270d3f0ec81 | fix clipnorm | model/lang_model_sgd.py | model/lang_model_sgd.py | import copy
import numpy as np
import tensorflow as tf
from keras import backend as K
from keras.optimizers import Optimizer
from keras.callbacks import LearningRateScheduler
from model.setting import Setting
class LangModelSGD(Optimizer):
def __init__(self, setting, verbose=True):
super(LangModelSGD, se... | Python | 0.000001 | @@ -326,18 +326,48 @@
_init__(
+clipnorm=setting.norm_clipping
)%0A
-
@@ -588,55 +588,8 @@
ay)%0A
- self._clipnorm = setting.norm_clipping%0A
@@ -666,24 +666,24 @@
nts, loss):%0A
+
grad
@@ -723,141 +723,8 @@
ms)%0A
- norm = K.sqrt(sum(%5BK.sum(K.square(g)) for g in grads%5D))... |
db3cee63baf64d00b2d2ac4fcf726f287b6d7af2 | Update call to proxy fix to use new method signature | app/proxy_fix.py | app/proxy_fix.py | from werkzeug.middleware.proxy_fix import ProxyFix
class CustomProxyFix(object):
def __init__(self, app, forwarded_proto):
self.app = ProxyFix(app)
self.forwarded_proto = forwarded_proto
def __call__(self, environ, start_response):
environ.update({
"HTTP_X_FORWARDED_PROTO"... | Python | 0 | @@ -153,16 +153,68 @@
yFix(app
+, x_for=1, x_proto=1, x_host=1, x_port=0, x_prefix=0
)%0A
|
47a11510b7a6897c59e470677ad05c9ebcaab0a7 | Make window invisible in info.py | pyglet/info.py | pyglet/info.py | #!/usr/bin/env python
'''Get environment information useful for debugging.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
_first_heading = True
def _heading(heading):
global _first_heading
if not _first_heading:
print
else:
_first_heading = False
print heading
print... | Python | 0.000041 | @@ -1385,16 +1385,29 @@
.Window(
+visible=False
)%0A fo
|
fee4ec26f52c584faa0aa5e35de955972b7c56bd | return a sorted list so tests can be deterministic | lms/djangoapps/bulk_user_retirement/views.py | lms/djangoapps/bulk_user_retirement/views.py | """
An API for retiring user accounts.
"""
import logging
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from django.contrib.auth import get_user_model
from django.db import transaction
from rest_framework import permissions, status
from rest_framework.response import Response
from... | Python | 0.99995 | @@ -2376,12 +2376,14 @@
s =
-list
+sorted
(set
|
d56cfbf87c01ac496200341a723ddcee88798a01 | Add setup of default translator object so doctests can run when using _. Fixes #509. | pylons/test.py | pylons/test.py | """Test related functionality
Adds a Pylons plugin to `nose <http://www.somethingaboutorange.com/mrl/projects/nose/>`_
that loads the Pylons app *before* scanning for doc tests.
This can be configured in the projects :file:`setup.cfg` under a
``[nosetests]`` block:
.. code-block:: ini
[nosetests]
with-p... | Python | 0 | @@ -2172,12 +2172,184 @@
ve_to=path)%0A
+ %0A # For tests that utilize the i18n _ object, initialize a NullTranslator%0A pylons.translator._push_object(_get_translator(pylons.config.get('lang')))%0A
|
4db28d9f8ae0c3ad22121226c1ec0b59f4258759 | Update pylsy.py | pylsy/pylsy.py | pylsy/pylsy.py | # -*- coding: utf-8 -*-
from __future__ import print_function
class PylsyTable(object):
def __init__(self, attributes):
self.Attributes = attributes
self.Table = []
self.AttributesLength = []
self.cols_num = len(self.Attributes)
self.lines_num = 0
... | Python | 0 | @@ -85,25 +85,27 @@
ct):%0A
-%0A
+
%0A
|
ad78e28d4537054a0d19643bb7efb1572dd4702c | Encode topic heading as UTF8 | app/utils/pdf.py | app/utils/pdf.py | import pdftotext
from PIL import Image
from wand.image import Image
import os
import io
TOPICS = [
'Philosophy',
'Society',
'Esoterica',
'Art',
'Culture',
'Science & Nature',
'Gods & Heroes',
'Myths Of The World'
]
def extract_first_page(blob):
pdf = Image(blob=blob, resolution=20... | Python | 0.999996 | @@ -1395,16 +1395,31 @@
_heading
+.encode(%22utf8%22)
%5B:-1%5D)%0A%0A
|
747d2563fd566a70420a04d3db209fffc813f147 | fix docs/hash-tree.py for python 3 | docs/hash-tree.py | docs/hash-tree.py | #!/usr/bin/env python
# Write a directory to the Git index.
# Prints the directory's SHA-1 to stdout.
#
# Copyright 2013 Lars Buitinck / University of Amsterdam.
# License: MIT (http://opensource.org/licenses/MIT)
# https://github.com/larsmans/seqlearn/blob/d7a3d82c/doc/hash-tree.py
import os
from os.path import spl... | Python | 0.00011 | @@ -209,16 +209,28 @@
s/MIT)%0A%0A
+# Based on:%0A
# https:
@@ -291,16 +291,16 @@
tree.py%0A
-
%0Aimport
@@ -576,16 +576,25 @@
path%5D).
+decode().
strip()%0A
@@ -921,31 +921,14 @@
-return mkt.communicate(
+inp =
%22%22.j
@@ -952,16 +952,63 @@
, dirs))
+.encode('ascii')%0A return mkt.communicate(inp... |
34c0c6c73a65da3120aa52600254afc909e9a3bc | Remove unused main and unused imports | pytach/wsgi.py | pytach/wsgi.py | import bottle
from bottle import route, run
from web import web
import config
app = application = bottle.Bottle()
app.merge(web.app)
config.arguments['--verbose'] = True
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8082, debug=True)
| Python | 0 | @@ -11,37 +11,22 @@
tle%0A
-from bottle import route, run
+%0Aimport config
%0Afro
@@ -41,30 +41,16 @@
port web
-%0Aimport config
%0A%0Aapp =
@@ -140,80 +140,4 @@
rue%0A
-%0Aif __name__ == '__main__':%0A%09app.run(host='0.0.0.0', port=8082, debug=True)%0A
|
bea0ead3dfcc055d219966c64437652c0eb2cf84 | Update demo.py | python/demo.py | python/demo.py | #! /usr/bin/env python
import serial
import time
import sys
# Serial port
N = "/dev/ttyUSB0"
def ints2str(lst):
'''
Taking a list of notes/lengths, convert it to a string
'''
s = ""
for i in lst:
if i < 0 or i > 255:
raise Exception
s = s + str(chr(i))
return s
# d... | Python | 0.000001 | @@ -46,18 +46,8 @@
ime%0A
-import sys
%0A%0A#
@@ -622,14 +622,10 @@
))%0A%0A
-sys.ex
+qu
it()
|
1ca6ccb50992836720e86a7c3c766a5497cf7588 | Remove unused import | mint/django_rest/rbuilder/querysets/views.py | mint/django_rest/rbuilder/querysets/views.py | #!/usr/bin/python
#
# Copyright (c) 2011 rPath, Inc.
#
# All rights reserved.
#
from mint.django_rest.deco import return_xml, requires
from mint.django_rest.rbuilder import service
from mint.django_rest.rbuilder.querysets import manager
class BaseQuerySetService(service.BaseService):
pass
class QuerySetService(B... | Python | 0.000001 | @@ -178,64 +178,8 @@
vice
-%0Afrom mint.django_rest.rbuilder.querysets import manager
%0A%0Acl
|
96874725b98ad0f2944cbb81f154e4f46819bd61 | fix non-integer preset id | qmsk/e2/web.py | qmsk/e2/web.py | import asyncio
import aiohttp.wsgi
import logging; log = logging.getLogger('qmsk.e2.web')
import qmsk.e2.client
import qmsk.e2.server
import qmsk.web.async
import qmsk.web.html
import qmsk.web.json
import qmsk.web.rewrite
import qmsk.web.urls
import werkzeug
import werkzeug.exceptions
html = qmsk.web.html.html5
WEB_P... | Python | 0.00082 | @@ -2983,23 +2983,13 @@
eset
-: int -
+
pre
@@ -4420,12 +4420,8 @@
et/%3C
-int:
pres
@@ -4425,16 +4425,20 @@
reset%3E':
+
APIPre
|
aa6a72c419846bc9d1ae5d8f114d214cbc2be60c | Fix randomize without cache | fake_useragent/utils.py | fake_useragent/utils.py | import re
import os
try:
from urllib import urlopen, quote_plus
except ImportError: # Python 3
from urllib.request import urlopen
from urllib.parse import quote_plus
try:
import json
except ImportError:
import simplejson as json
from fake_useragent import settings
def get(url, annex=None):
if... | Python | 0.000005 | @@ -2243,16 +2243,20 @@
ze_dict%5B
+str(
len(rand
@@ -2266,16 +2266,17 @@
ze_dict)
+)
%5D = clea
|
aa8e51fc8ad969cd04098a5714ff78092b35f58f | Remove unused import | polyaxon/libs/http.py | polyaxon/libs/http.py | import os
import requests
import shutil
import tarfile
from urllib.parse import parse_qs, urlencode, urljoin, urlparse, urlunparse
from hestia.auth import AuthenticationTypes
from hestia.fs import move_recursively
from django.conf import settings
from libs.api import get_http_api_url
def absolute_uri(url):
if... | Python | 0.000001 | @@ -23,22 +23,8 @@
sts%0A
-import shutil%0A
impo
|
1b4776ddb6ca0f30e4b61393ac37a8f44cfb2af4 | fix auto-discovering db config | feedservice/settings.py | feedservice/settings.py | # -*- coding: utf-8 -*-
import os, os.path
def bool_env(val, default):
"""Replaces string based environment values with Python booleans"""
if not val in os.environ:
return default
return True if os.environ.get(val) == 'True' else False
DEBUG = bool_env('MYGPOFS_DEBUG', True)
TEMPLATE_DEBUG = D... | Python | 0.000002 | @@ -18,16 +18,17 @@
-8 -*-%0A%0A
+%0A
import o
@@ -2375,16 +2375,28 @@
ABASES =
+ %7B'default':
dj_data
@@ -2412,16 +2412,17 @@
config()
+%7D
%0A%0ASOUNDC
|
d86bdec5d7d57fe74cb463e391798bd1e5be87ff | Update Ghana code to match current Pombola | pombola/ghana/urls.py | pombola/ghana/urls.py | from django.conf.urls import patterns, include, url, handler404
from django.views.generic import TemplateView
import django.contrib.auth.views
from .views import data_upload, info_page_upload
urlpatterns = patterns('',
url(r'^intro$', TemplateView.as_view(template_name='intro.html')),
url(r'^data/upload/mps/... | Python | 0 | @@ -36,32 +36,20 @@
ns,
+url,
include
-, url, handler404
%0Afro
@@ -95,42 +95,8 @@
iew%0A
-import django.contrib.auth.views%0A%0A
%0Afro
@@ -394,267 +394,52 @@
-%0A #auth views%0A url(r'%5Eaccounts/login$', django.contrib.auth.views.login, name='login'),%0A url(r'%5Eaccounts/logut$', django.contri... |
9b75fd09220e61fd511c99e63f8d2b30e6a0f868 | stop using deprecated assertEquals() | test_csv2es.py | test_csv2es.py | ## Copyright 2015 Ray Holder
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writi... | Python | 0 | @@ -702,17 +702,16 @@
ertEqual
-s
(None, c
@@ -765,33 +765,32 @@
self.assertEqual
-s
(str('%5Ct'), csv2
@@ -840,33 +840,32 @@
self.assertEqual
-s
(str('%7C'), csv2e
@@ -918,25 +918,24 @@
.assertEqual
-s
(str('%7C'), c
@@ -989,33 +989,32 @@
self.assertEqual
-s
(str('%5Ct'), csv2
@@ -1071,17 +1071,16 @@
ertEqu... |
a309a935b41ed249985882f64f9bc277b8576bd9 | Update analyze_nir_intensity.py | plantcv/plantcv/analyze_nir_intensity.py | plantcv/plantcv/analyze_nir_intensity.py | # Analyze signal data in NIR image
import os
import cv2
import numpy as np
import pandas as pd
from plotnine import ggplot, aes, geom_line, scale_x_continuous
from plantcv.plantcv import print_image
from plantcv.plantcv import plot_image
from plantcv.plantcv.threshold import binary as binary_threshold
from plantcv.pla... | Python | 0.000002 | @@ -436,16 +436,28 @@
ot=False
+, label=None
):%0A %22
@@ -925,16 +925,113 @@
y values
+%0A label = optional label parameter, modifies the variable name of observations recorded
%0A%0A Re
@@ -1189,16 +1189,38 @@
t: bool%0A
+ :param label: str%0A
:ret
@@ -3424,16 +3424,98 @@
_hist)%0A%0A
+ ... |
6edbaa5fb7648aea2de4517c660754c78e7a2baf | Make inference parallelism a parameter. | models/run_inference.py | models/run_inference.py | import argparse
import datetime
import layers
import logging
import tensorflow.contrib.slim as slim
import tensorflow as tf
import utility
class ModelInference(utility.ModelConfiguration):
def __init__(self, model_checkpoint_path, unclassified_feature_path):
utility.ModelConfiguration.__init__(self)
self.mo... | Python | 0.000004 | @@ -424,43 +424,8 @@
ath%0A
- self.num_parallel_readers = 16%0A
@@ -517,16 +517,39 @@
ce(self,
+ inference_parallelism,
inferen
@@ -855,24 +855,25 @@
n range(
-self.num
+inference
_paralle
@@ -877,16 +877,11 @@
llel
-_readers
+ism
):%0A
@@ -1750,30 +1750,8 @@
pi?%0A
- parallelism = 16 %0A
@@... |
7a7e66a5be144854099d5ff463fb13944110e752 | Revert "configure Flask-Login to remember logged in users across subdomains" | portality/settings.py | portality/settings.py | # ========================
# MAIN SETTINGS
# make this something secret in your overriding app.cfg
SECRET_KEY = "default-key"
# contact info
ADMIN_NAME = "DOAJ"
ADMIN_EMAIL = "sysadmin@cottagelabs.com"
ADMINS = ["emanuil@cottagelabs.com", "mark@cottagelabs.com"]
SUPPRESS_ERROR_EMAILS = False # should be set to False... | Python | 0 | @@ -1190,190 +1190,8 @@
n%22%0A%0A
-# remember people are logged in across subdomains%0A# without this, people who log into doaj.org will be asked to login%0A# again on www.doaj.org%0AREMEMBER_COOKIE_DOMAIN = '.' + DOMAIN%0A%0A%0A
# FI
|
bce19fd89fc82f2d18bd1cc210d94255800a2d5c | Use relative import for Python 3 support | molo/commenting/admin_views.py | molo/commenting/admin_views.py | from django.contrib import messages
from django.shortcuts import redirect
from django.views.generic import FormView
from django_comments.views.comments import post_comment
from molo.commenting.forms import AdminMoloCommentReplyForm
from tasks import send_export_email
from wagtail.contrib.modeladmin.views import IndexVi... | Python | 0 | @@ -1,20 +1,58 @@
+from .tasks import send_export_email%0A%0A
from django.contrib
@@ -267,44 +267,8 @@
orm%0A
-from tasks import send_export_email%0A
from
|
96f9e225a8b490bd93e016ed42dfb133290a47f5 | add test | molo/core/tests/test_search.py | molo/core/tests/test_search.py | from django.test import TestCase
from django.core.urlresolvers import reverse
from django.test.client import Client
from wagtail.wagtailsearch.backends import get_search_backend
from molo.core.models import SiteLanguageRelation, \
Main, Languages
from molo.core.tests.base import MoloTestCaseMixin
class TestSear... | Python | 0.000002 | @@ -245,16 +245,28 @@
anguages
+, FooterPage
%0Afrom mo
@@ -1730,24 +1730,631 @@
section2')%0A%0A
+ def test_search_only_includes_articles(self):%0A self.backend = get_search_backend('default')%0A self.backend.reset_index()%0A self.mk_articles(self.english_section, count=2)%0A footer =... |
95e32115ec157d9764dd96b693bfe730929b76f2 | Add shortcut imports | flask_email/__init__.py | flask_email/__init__.py | # -*- coding: utf-8 -*-
"""
flask.ext.email
~~~~~~~~~~~~~
Flask extension for sending email.
"""
__version__ = '1.4.3'
"""
Tools for sending email.
"""
from flask import current_app as app
from .utils import import_module
# Imported for backwards compatibility, and for the sake
# of a cleaner namespace... | Python | 0.000002 | @@ -694,16 +694,302 @@
eaders)%0A
+from .backends.console import Mail as ConsoleMail%0Afrom .backends.dummy import Mail as DummyMail%0Afrom .backends.filebased import Mail as FilebasedMail%0Afrom .backends.locmem import Mail as LocmemMail%0Afrom .backends.smtp import Mail as SMTPMail%0Afrom .backends.rest import Mail ... |
97a8a349d26b364e57aaac6f8d920770810aa8d8 | Correct localized strings | src/sentry/constants.py | src/sentry/constants.py | """
sentry.constants
~~~~~~~~~~~~~~~~
These settings act as the default (base) settings for the Sentry-provided web-server
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.utils.datastructures import SortedDict
from django.utils.... | Python | 0.999887 | @@ -1992,17 +1992,17 @@
VED, _('
-u
+U
nresolve
@@ -2032,17 +2032,17 @@
VED, _('
-r
+R
esolved'
@@ -2067,17 +2067,17 @@
TED, _('
-m
+M
uted')),
@@ -2173,17 +2173,17 @@
NER, _('
-a
+A
dmin')),
@@ -2204,17 +2204,17 @@
SER, _('
-u
+U
ser')),%0A
@@ -2240,16 +2240,16 @@
_('
-s
+S
ystem
-a
+A
gent
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.