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 |
|---|---|---|---|---|---|---|---|
b45e9be5338baa652055f52c494a4febefe75c2d | Fix dealing with numpy arrays. | pydevd_plugins/extensions/types/pydevd_plugin_numpy_types.py | pydevd_plugins/extensions/types/pydevd_plugin_numpy_types.py | from _pydevd_bundle.pydevd_extension_api import TypeResolveProvider
from _pydevd_bundle.pydevd_resolver import defaultResolver, MAX_ITEMS_TO_HANDLE, TOO_LARGE_ATTR, TOO_LARGE_MSG
from .pydevd_helpers import find_mod_attr
# ===============================================================================================... | Python | 0 | @@ -1189,32 +1189,49 @@
.is_numeric(obj)
+ and obj.size %3E 0
:%0A
@@ -1353,32 +1353,49 @@
.is_numeric(obj)
+ and obj.size %3E 0
:%0A
@@ -2435,32 +2435,144 @@
down debugging'%0A
+ elif obj.size == 0:%0A ret%5B'min'%5D = 'array is empty'%0A ret%5B'max'%5D = '... |
d90d7c35df1f815f31de2cad9fe2dde43f9f561a | Print generation date. | git_changelog.py | git_changelog.py | from __future__ import print_function
from collections import defaultdict
import glob
import json
import os
import re
import subprocess
from urllib2 import urlopen
DEBUG = False
GIT_EXEC = "/usr/bin/git"
REPOSITORIES = glob.glob("/ssd/swinbank/src/*") # Everything in w_2017_8
JIRA_API_URL = "https://jira.lsstcorp.org... | Python | 0.000001 | @@ -67,16 +67,32 @@
ultdict%0A
+import datetime%0A
import g
@@ -2488,16 +2488,143 @@
%5Btag%5D)%0A%0A
+ gen_date = datetime.datetime.utcnow().strftime(%22%25Y-%25m-%25d %25H:%25M +00:00%22)%0A print(%22%3Cp%3EGenerated %7B%7D.%3C/p%3E%22.format(gen_date))%0A
prin
|
3d0392a835f1b02ae01035d3cdb18d0d7e32f4a0 | Version 0.4.0 release | capture/setup.py | capture/setup.py | #!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
setup(
name = "noworkflow",
version = "0.4.0-dev",
packages = ['noworkflow'],
package_data = {'noworkflow': ['resources/*']},
entry_points = {'console_scripts': ['now = noworkflow.now:main']},
... | Python | 0 | @@ -154,12 +154,8 @@
.4.0
--dev
%22,%0A
|
d7e9264418cbe5574d7475094e2c06a878897c34 | fix ALDC scraper | every_election/apps/election_snooper/snoopers/aldc.py | every_election/apps/election_snooper/snoopers/aldc.py | from datetime import datetime
from .base import BaseSnooper
from election_snooper.models import SnoopedElection
class ALDCScraper(BaseSnooper):
snooper_name = "ALDC"
base_url = "https://www.aldc.org/"
def get_all(self):
url = "{}category/forthcoming-by-elections/".format(self.base_url)
p... | Python | 0 | @@ -361,75 +361,8 @@
rl)%0A
- wrapper = soup.find('section', %7B'class': 'mod-tile-wrap'%7D)%0A
@@ -381,15 +381,12 @@
in
-wrapper
+soup
.fin
@@ -396,31 +396,16 @@
ll('
-div', %7B'class': '
+ar
ti
+c
le'
-%7D
):%0A%0A
@@ -438,175 +438,129 @@
ind(
-%0A 'div', %7B'class': 'election-he... |
021ca057be4333d209454b043c79f9d6d327c3e0 | Return the response for the main page without jinja rendering as AngularJS is doing the rendering | webapp/keepupwithscience/frontend/main.py | webapp/keepupwithscience/frontend/main.py | from flask import Blueprint, render_template
bp = Blueprint('main', __name__)
@bp.route('/')
def index():
"""Returns the main interface."""
return render_template('main.html') | Python | 0.000021 | @@ -37,16 +37,31 @@
template
+, make_response
%0A%0Abp = B
@@ -154,16 +154,105 @@
ace.%22%22%22%0A
+ return make_response(open('keepupwithscience/frontend/templates/main.html').read())%0A#
retu
|
392e34a70bd2bccba268ec9de1752afc50cd1b35 | Add the httlib dir to the build | packaging/datadog-agent-lib/setup.py | packaging/datadog-agent-lib/setup.py | #!/usr/bin/env python
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
import os, sys
from distutils.command.install import INSTALL_SCHEMES
def getVersion():
try:
from con... | Python | 0 | @@ -1403,16 +1403,40 @@
, 'yaml'
+, 'checks/libs/httplib2'
%5D,%0A
@@ -1477,27 +1477,8 @@
s/*'
-, 'libs/httplib2/*'
%5D, '
|
a9ff99f94938c5e50038b9d98200c5247e651c35 | Fix AttributeError: module 'config' has no attribute 'expires' | utils/ignores.py | utils/ignores.py | import random
import time
import config
import log as logging
def check_ignored(host, channel):
ignores = config.expires['global']
if channel in config.expires['channel'].keys():
ignores.extend(config.expires['channel'][channel])
for i in ignores:
for (uhost, expires) in i:
#... | Python | 0.014043 | @@ -152,28 +152,28 @@
l in config.
-expi
+igno
res%5B'channel
|
7de5d99866164c0f17aa85f8cdd910132ac35667 | use re.split instead of string.split | topiary/rna/common.py | topiary/rna/common.py | # Copyright (c) 2015. Mount Sinai School of Medicine
#
# 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 o... | Python | 0.000032 | @@ -593,16 +593,27 @@
cense.%0A%0A
+import re%0A%0A
%0Adef inf
@@ -1282,133 +1282,8 @@
me)%0A
- # the split function defaults to splitting on multiple spaces,%0A # which here corresponds to a candidate value of None%0A
@@ -1317,20 +1317,21 @@
%22, %22,%22,
-None
+%22%5Cs+%22
%5D%0A fo
@@ -1399,19 +... |
9c90c539f83551de2645522c22ccbd0c75d34be3 | Fix Mapbox routing fixture shape | server/lib/python/cartodb_services/test/test_mapboxrouting.py | server/lib/python/cartodb_services/test/test_mapboxrouting.py | import unittest
from mock import Mock
from cartodb_services.mapbox import MapboxRouting
from cartodb_services.mapbox.routing import DEFAULT_PROFILE
from cartodb_services.tools.exceptions import ServiceException
from cartodb_services.tools import Coordinate
from credentials import mapbox_api_key
INVALID_TOKEN = 'invali... | Python | 0 | @@ -1314,23 +1314,66 @@
.732
-93, -74.00007),
+25, -73.99868), (40.73293, -74.00007),%0A
(40
|
30edb922d26357f509cd31f55648a1c5f072ccf5 | Convert message to str for debugging | tornadose/handlers.py | tornadose/handlers.py | """Custom request handlers for pushing data to connected clients."""
import logging
from tornado import gen
from tornado.web import RequestHandler
from tornado.websocket import WebSocketHandler, WebSocketClosedError
from tornado.queues import Queue
from tornado.iostream import StreamClosedError
from tornado.lo... | Python | 0.999993 | @@ -3099,24 +3099,28 @@
ge: ' +
+str(
message)
%0D%0A
@@ -3111,16 +3111,17 @@
message)
+)
%0D%0A
|
134406e139d5ca55fbd631eee79d73bf0f2a3e37 | Fix boot view. | app/dashboard/views/boot.py | app/dashboard/views/boot.py | # Copyright (C) 2014 Linaro Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | Python | 0.000188 | @@ -2221,16 +2221,18 @@
name)s)'
+ %25
%0A
@@ -2235,18 +2235,16 @@
- %25
kwargs%0A
@@ -2333,18 +2333,16 @@
s '
- +
%0A
@@ -2354,16 +2354,17 @@
'%3Csmall%3E
+(
%25(lab_na
|
ab505466859a5d2e5b397d1fb1fc3271977a2024 | modify register validation | app/user/forms.py | app/user/forms.py | from flask_wtf import Form
from wtforms import StringField, PasswordField, TextAreaField, SelectField, validators
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from .models import User
from app.post.models import Post_type
from flask.ext.bcrypt import check_password_hash
class LoginForm(Form):
userna... | Python | 0.000001 | @@ -1939,16 +1939,17 @@
ry.filte
+r
_by(emai
|
e2fac2a79b38c5429a9990221ddc47aacadaab01 | Add a mention of default values to agg docstring (#65) | featuretools/primitives/aggregation_primitive_base.py | featuretools/primitives/aggregation_primitive_base.py | import copy
import functools
from .primitive_base import PrimitiveBase
from .utils import inspect_function_args
class AggregationPrimitive(PrimitiveBase):
"""Feature for a parent entity that summarizes
related instances in a child entity"""
stack_on = None # whitelist of primitives that can be in in... | Python | 0 | @@ -3365,24 +3365,91 @@
mitive class
+. The primitive infers default%0A values by passing in empty data.
%0A%0A Args:%0A
|
7f600ca71b6461fa558ca48b7e7e5f059a9e5ff1 | remove unused import | frappe/website/doctype/website_theme/website_theme.py | frappe/website/doctype/website_theme/website_theme.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_path
from os.path import join as join_path, exists as... | Python | 0.000013 | @@ -348,53 +348,8 @@
text
-%0Afrom frappe.utils import update_progress_bar
%0A%0Acl
|
8bc108c5a8b4ce3fa5192363576eef7f67f4d82e | Update tracking params | app/utils/meta.py | app/utils/meta.py | from urllib.parse import unquote, urlparse
import aiohttp
from sanic.log import logger
from .. import settings
def get_watermark(request, watermark: str) -> tuple[str, bool]:
api_key = _get_api_key(request)
if api_key:
api_mask = api_key[:2] + "***" + api_key[-2:]
logger.info(f"Authenticated... | Python | 0.000001 | @@ -1366,144 +1366,8 @@
)%0A
- referer = _get_referer(request)%0A if referer:%0A source = urlparse(referer).netloc%0A else:%0A source = %22memegen.link%22%0A
@@ -1507,40 +1507,129 @@
ict(
-text=text, source=source, contex
+%0A text=text,%0A client=_get_refe... |
29e56ec30c13c5fbb562e77cdb2c660d5fc52842 | remove debugging print | freppledb/common/management/commands/generatetoken.py | freppledb/common/management/commands/generatetoken.py | #
# Copyright (C) 2021 by frePPLe bv
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This library is distri... | Python | 0.000081 | @@ -1671,19 +1671,8 @@
ret=
-%22perepe%22, #
None
|
01fad6e4c6faa2cd8ad443d39b0b1da8f503d532 | Fix registration bug | imagekit/registry.py | imagekit/registry.py | from .exceptions import AlreadyRegistered, NotRegistered
from .signals import before_access, source_created, source_changed, source_deleted
from .utils import call_strategy_method
class GeneratorRegistry(object):
"""
An object for registering generators. This registry provides
a convenient way for a distr... | Python | 0 | @@ -1624,32 +1624,99 @@
= file.generator
+%0A%0A # FIXME: I guess this means you can't register functions?
%0A if gene
@@ -1720,16 +1720,26 @@
enerator
+.__class__
in self
|
9235d1aa35e6a597be3c497577de528425d6e046 | comment cleanup | training/parse_osm.py | training/parse_osm.py | from lxml import etree
import ast
import re
# parse xml data, return a list of dicts representing addresses
def xmlToAddrList(xml_file):
tree = etree.parse(xml_file)
root = tree.getroot()
addr_list=[]
for element in root:
if element.tag == 'node' or element.tag =='way':
address={}
for x in element.iter('ta... | Python | 0 | @@ -571,16 +571,96 @@
dex = 0%0A
+%09# only the osm tags below will end up in training data; others will be ignored%0A
%09osm_tag
@@ -1018,35 +1018,8 @@
s():
- #iterate through dict ****
%0A%09%09%09
@@ -1061,51 +1061,8 @@
s():
- #if the key is one of the defined osm tags
%0A%09%09%09
@@ -1120,31 +1120,8 @@
y%5D... |
d7bea2995fc54c15404b4b47cefae5fc7b0201de | FIX partner internal code compatibility with sign up | partner_internal_code/res_partner.py | partner_internal_code/res_partner.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import fields, models, api
class pa... | Python | 0 | @@ -433,16 +433,42 @@
al Code'
+,%0A copy=False,%0A
)%0A%0A #
|
f4dd6ce804c3bac3b0f343004cde6b26aa49c674 | Add G4 and G5 validation errors | app/validation.py | app/validation.py | import json
import re
import os
from flask import abort
from jsonschema import ValidationError, FormatChecker
from jsonschema.validators import validator_for
MINIMUM_SERVICE_ID_LENGTH = 10
MAXIMUM_SERVICE_ID_LENGTH = 20
JSON_SCHEMAS_PATH = './json_schemas'
SCHEMA_NAMES = [
'services-g4',
'services-g5',
'... | Python | 0.000001 | @@ -3207,16 +3207,330 @@
se = %5B%5D%0A
+ try:%0A get_validator('services-g4').validate(submitted_json)%0A except ValidationError as e1:%0A response.append('Not G4: %25s' %25 e1.message)%0A%0A try:%0A get_validator('services-g5').validate(submitted_json)%0A except ValidationError as e1... |
26808790680c96b7a6aff48982a15b28730d7e41 | Print stdout when running a hook (#4167, #4487) (#4702) | certbot/hooks.py | certbot/hooks.py | """Facilities for implementing hooks that call shell commands."""
from __future__ import print_function
import logging
import os
from subprocess import Popen, PIPE
from certbot import errors
from certbot import util
from certbot.plugins import util as plug_util
logger = logging.getLogger(__name__)
def validate_h... | Python | 0.001709 | @@ -3747,24 +3747,155 @@
mmunicate()%0A
+ base_cmd = os.path.basename(shell_cmd.split(None, 1)%5B0%5D)%0A if out:%0A logger.info('Output from %25s:%5Cn%25s', base_cmd, out)%0A
if cmd.r
@@ -4039,73 +4039,8 @@
rr:%0A
- base_cmd = os.path.basename(shell_cmd.split(None, 1)%5B0%5D)%0A
|
657f30275246390c2c8b93732dc8f65b83d37a06 | add helper method to fixup return_to protocol. used in a few places in a couple of providers. | velruse/utils.py | velruse/utils.py | """Utilities for the auth functionality"""
import sys
import uuid
try:
import simplejson as json
except ImportError:
import json
import webob.exc as exc
from routes import URLGenerator
from openid.oidutil import autoSubmitHTML
from webob import Response
from velruse.baseconvert import base_encode
from velrus... | Python | 0 | @@ -3987,24 +3987,576 @@
_html))%0A
-
+%0A def _get_return_to(self, req):%0A return_to = req.link('process', qualified=True)%0A # post-process the return_to protocol.%0A if self.protocol:%0A if return_to.startswith('https://') and self.protocol == 'http':%0A re... |
7428f7d87d33ab1531f94753516ad4a56780a612 | Add helper to predefine remove recursive flag. Add copy_to and copy_from helpers which aid the copying of single files | virtualbox/library_ext/guest_session.py | virtualbox/library_ext/guest_session.py | import time
from virtualbox import library
"""
Add helper code to the default IGuestSession class.
"""
# Add context management to IGuestSession
class IGuestSession(library.IGuestSession):
__doc__ = library.IGuestSession.__doc__
def __enter__(self):
return self
def __exit__(self, exception_type... | Python | 0 | @@ -3143,8 +3143,1299 @@
ents%5D)%0A%0A
+ # Simplify calling directory_remove_recursive. Set default flags to%0A # content_and_dir if they have not yet been set.%0A def directory_remove_recursive(self, path, flags=None):%0A if flags is None:%0A flags = %5Blibrary.DirectoryRemoveRecFlag.cont... |
23b12f5eb7f89aa2efe05b30c40d359d2a8034e9 | Fix bug in lan endpoint which let a user unattend after paying | apps/lan/views.py | apps/lan/views.py | # -*- coding: utf-8 -*-
from datetime import datetime
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.translation import ugettext a... | Python | 0.000001 | @@ -2862,24 +2862,420 @@
icode(lan))%0A
+ return redirect(lan)%0A%0A ticket_types = lan.tickettype_set.all().order_by('-priority', '-price')%0A user_tickets = Ticket.objects.filter(user=request.user.id, ticket_type__in=ticket_types)%0A%0A if request.user in lan.paid_attendees or user_tickets:%0A ... |
4bc55c14ab2303c4f89c0b33a6c48dd2e2efe4f2 | fix cmd | genomel/docker/variant_calling/gatk3_genotypegvcfs.py | genomel/docker/variant_calling/gatk3_genotypegvcfs.py | #!/usr/bin/env python
'''Internal multithreading for GATK3 GenotypeGVCFs'''
import sys
import argparse
import subprocess
import string
from functools import partial
from multiprocessing.dummy import Pool, Lock
def is_nat(pos):
'''Checks that a value is a natural number.'''
if int(pos) > 0:
return int(... | Python | 0.000021 | @@ -1974,17 +1974,17 @@
tend(%5B'-
-I
+V
', gvcf%5D
|
0a12594920720bd29321665f3ae7d86843de5d42 | Update sht25.py | apps/sdb/sht25.py | apps/sdb/sht25.py | #!/usr/bin/python
# code from http://www.emsystech.de/raspi-sht21
# http://github.com/jeonghoonkang
import fcntl
import time
import unittest
class SHT25:
# control constants on I2C bus
_SOFTRESET = 0xFE
_I2C_ADDRESS = 0x40
_TRIGGER_TEMPERATURE_NO_HOLD = 0xF3
_TRIGGER_HUMIDITY_NO_HOLD = 0xF5
_... | Python | 0 | @@ -184,16 +184,26 @@
I2C bus
+ for SHT25
%0A _SO
|
da05fe2d41a077276946c5d6c86995c60315e093 | Make sure we load pyvisa-py when enumerating instruments. | src/auspex/instruments/__init__.py | src/auspex/instruments/__init__.py | import pkgutil
import importlib
import pyvisa
instrument_map = {}
for loader, name, is_pkg in pkgutil.iter_modules(__path__):
module = importlib.import_module('auspex.instruments.' + name)
if hasattr(module, "__all__"):
globals().update((name, getattr(module, name)) for name in module.__all__)
for name in module... | Python | 0 | @@ -441,16 +441,21 @@
Manager(
+%22@py%22
)%0A%09print
@@ -534,16 +534,21 @@
Manager(
+%22@py%22
)%0A%09for i
|
145c8e456b90ff4e243656c923ddc82a690f4447 | Debug logging. | google-daemon/usr/share/google/google_daemon/utils.py | google-daemon/usr/share/google/google_daemon/utils.py | #!/usr/bin/python
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Python | 0 | @@ -1511,24 +1511,55 @@
handler.%22%22%22%0A
+ # TODO Change back to INFO%0A
handler.
@@ -1567,36 +1567,37 @@
etLevel(logging.
-INFO
+DEBUG
)%0A logger.set
@@ -1610,20 +1610,21 @@
logging.
-INFO
+DEBUG
)%0A lo
|
23d4e48155e8906510d09a5eaf9fafafa7280d63 | Fix a few typos in the test. | test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py | test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py | """
Test lldb data formatter subsystem.
"""
import os, time
import unittest2
import lldb
from lldbtest import *
import lldbutil
class LibcxxUnorderedDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
@dsym_test
def test_with_dsym_and_run_command(self):
... | Python | 0.999998 | @@ -811,17 +811,24 @@
substrs
-
+=substrs
)%0A
@@ -2077,18 +2077,19 @@
size=5 %7B
-,
'
+,
'hello',
|
a56e72a4a5d5f3ecd68c7520885cc7808af4f17f | fix tests | plenum/test/node_request/test_pre_prepare/test_pp_obsolescence.py | plenum/test/node_request/test_pre_prepare/test_pp_obsolescence.py | import pytest
from plenum.common.util import SortedDict
from plenum.common.messages.node_messages import PrePrepare
from plenum.test.helper import create_prepare_params, create_pre_prepare_no_bls, generate_state_root
from plenum.test.replica.conftest import *
from plenum.test.replica.conftest import primary_replica a... | Python | 0 | @@ -8,16 +8,66 @@
pytest%0A%0A
+from plenum.common.stashing_router import PROCESS%0A
from ple
@@ -4658,22 +4658,33 @@
*x, **y:
+ (PROCESS,
None)
+)
%0A pri
|
3f039537700448dfd2bc9b0ace9bac9925e062c2 | fix standalone values | splash/kernel/lua_parser.py | splash/kernel/lua_parser.py | # -*- coding: utf-8 -*-
"""
Parser for a subset of Lua, useful for autocompletion.
It takes ``Tok(name, value)`` namedtuples as an input.
"""
from __future__ import absolute_import
import string
from operator import attrgetter
from collections import namedtuple
from funcparserlib import parser as p
Token = namedtupl... | Python | 0.000106 | @@ -862,36 +862,89 @@
ne(_Match):%0A
-pass
+@property%0A def prefix(self):%0A return self.value
%0A%0Aclass SplashAt
|
abc74f521f1b52fe2b17046cc81705a691314832 | Give an error only if the report object is not None | ReadConfig.py | ReadConfig.py | #
# ReadConfig
#
# Ron Lockwood
# University of Washington, SIL International
# 12/4/14
#
# Functions for reading a configuration file
import re
CONFIG_FILE = 'FlexTrans.config'
def readConfig(report):
try:
f_handle = open(CONFIG_FILE)
except:
report.Error('Error reading the file: "'... | Python | 0.999999 | @@ -91,16 +91,116 @@
/4/14%0A#%0A
+# Version 1.1 - 3/7/18 - Ron Lockwood%0A# Give an error only if the report object is not None %0A#%0A
# Func
@@ -365,16 +365,51 @@
except:%0A
+ if report is not None:%0A
@@ -606,16 +606,55 @@
e) %3C 2:%0A
+ if report is not None:%0A
... |
4eb4a2eaa42cd71bf4427bdaaa1e853975432691 | Allow keyword arguments in GeneralStoreManager.create_item method | graphene/storage/intermediate/general_store_manager.py | graphene/storage/intermediate/general_store_manager.py | from graphene.storage.id_store import *
class GeneralStoreManager:
"""
Handles the creation/deletion of nodes to the NodeStore with ID recycling
"""
def __init__(self, store):
"""
Creates an instance of the GeneralStoreManager
:param store: Store to manage
:return: Ge... | Python | 0.000001 | @@ -515,16 +515,26 @@
tem(self
+, **kwargs
):%0A
@@ -1039,16 +1039,26 @@
lable_id
+, **kwargs
)%0A%0A d
|
ad47fb85e5c2deb47cbe3fc3478e1ae2da93adfe | Update h-index.py | Python/h-index.py | Python/h-index.py | # Time: O(nlogn)
# Space: O(1)
# Given an array of citations (each citation is a non-negative integer)
# of a researcher, write a function to compute the researcher's h-index.
#
# According to the definition of h-index on Wikipedia:
# "A scientist has index h if h of his/her N papers have
# at least h citations each... | Python | 0.000002 | @@ -1,32 +1,28 @@
# Time: O(n
-logn
)%0A# Space: O(1)%0A
@@ -18,17 +18,17 @@
pace: O(
-1
+n
)%0A%0A# Giv
@@ -924,32 +924,540 @@
int%0A %22%22%22%0A
+ n = len(citations);%0A count = %5B0%5D * (n + 1)%0A for x in citations:%0A if x %3E= n:%0A count%5Bn%5D += 1%0... |
4903401a6365c24675b80003ed89e792eba2e2b5 | Add support for redact EML from letter | feder/letters/forms.py | feder/letters/forms.py | from textwrap import wrap
from atom.ext.crispy_forms.forms import HelperMixin, SingleButtonMixin
from braces.forms import UserKwargModelFormMixin
from crispy_forms.layout import Submit
from dal import autocomplete
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.conf import ... | Python | 0 | @@ -1260,16 +1260,23 @@
, %22note%22
+, %22eml%22
%5D%0A%0A d
|
086de25019cc6745ceb7e8505945a102a0e8c63a | fix image rotation when generating dataset | Python/dataset.py | Python/dataset.py | import argparse
import cv2
import gzip
import numpy as np
import pathlib
import requests
import shutil
import struct
import tempfile
import zipfile
from os import path as osp
from progress.bar import IncrementalBar
from typing import Dict
class DatasetGenerator:
"""
Class to download and create dataset for t... | Python | 0.000013 | @@ -6313,16 +6313,18 @@
', image
+.T
)%0A%0A
|
56adaeecb5ed868ca057a4985a9305770d551b61 | Add version | sqlalchemy_seed/__init__.py | sqlalchemy_seed/__init__.py | # -*- coding: utf-8 -*-
"""
sqlalchemy_seed
~~~~~~~~~~~~~~~
Seed
:copyright: (c) 2017 Shinya Ohyanagi, All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import os
import importlib
import json
import yaml
def create_table(base, session=None):
"""Create table.
:param ... | Python | 0 | @@ -70,13 +70,105 @@
-Seed%0A
+%60sqlalchemy_seed%60 is a seed library which provides initial data to%0A database using SQLAlchemy.
%0A%0A
@@ -333,16 +333,39 @@
t yaml%0A%0A
+__version__ = '0.1.0'%0A%0A
%0Adef cre
|
4fd6d20be257cca38f98d20df78b35d7c7bc3911 | Fix factory_jst | feder/teryt/factory.py | feder/teryt/factory.py | from autofixture import AutoFixture
from .models import JednostkaAdministracyjna
def factory_jst():
jst = AutoFixture(JednostkaAdministracyjna,
field_values={'updated_on': '2015-02-12'},
generate_fk=True).create_one(commit=False)
jst.rght = 0
jst.save()
ret... | Python | 0.000002 | @@ -2,39 +2,29 @@
rom
-autofixture import AutoFixture%0A
+random import randint
%0Afro
@@ -68,11 +68,47 @@
yjna
-%0A
+ as JST%0Afrom .models import Category
%0A%0A
+%0A
def
@@ -130,50 +130,170 @@
-jst = AutoFixture(JednostkaAdministracyjna
+category = Category.objects.create(name=%22X%22, level=1)%0A re... |
2eefaca1d7d27ebe2e9a489ab2c1dc2927e49b55 | Bump version | sqliteschema/__version__.py | sqliteschema/__version__.py | __author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016, {}".format(__author__)
__license__ = "MIT License"
__version__ = "1.0.1"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| Python | 0 | @@ -129,17 +129,17 @@
= %221.0.
-1
+2
%22%0A__main
|
bc904f3ab7cc9d697dc56058ac9cb578055c401f | raise exception rather than logging and returning | checks.d/hdfs.py | checks.d/hdfs.py | from checks import AgentCheck
class HDFSCheck(AgentCheck):
"""Report on free space and space used in HDFS.
"""
def check(self, instance):
try:
import snakebite.client
except ImportError:
raise ImportError('HDFSCheck requires the snakebite module')
if 'name... | Python | 0 | @@ -352,21 +352,24 @@
-self.log.info
+raise ValueError
('Mi
@@ -416,27 +416,8 @@
ig')
-%0A return
%0A%0A
|
082562d4fc3567f956e95d71807c65281a69b3ff | change get_many to expect ids | feedly/storage/base.py | feedly/storage/base.py | from feedly.serializers.base import BaseSerializer
class BaseActivityStorage(object):
'''
The storage class for activities data
'''
serializer = BaseSerializer
def __init__(self, **options):
self.options = options
self.serializer = self.serializer()
def add_to_storage(self,... | Python | 0 | @@ -752,34 +752,36 @@
lf, key, activit
-ie
+y_id
s, *args, **kwar
@@ -789,76 +789,8 @@
s):%0A
- activity_ids = self.serialize_activities(activities).keys()%0A
|
6a8c8bc0e407327e5c0e4cae3d4d6ace179a6940 | Add team eligibility to API | webserver/codemanagement/serializers.py | webserver/codemanagement/serializers.py | from rest_framework import serializers
from greta.models import Repository
from competition.models import Team
from .models import TeamClient, TeamSubmission
class TeamSerializer(serializers.ModelSerializer):
class Meta:
model = Team
fields = ('id', 'name', 'slug')
class RepoSerializer(seriali... | Python | 0 | @@ -281,16 +281,35 @@
, 'slug'
+, 'eligible_to_win'
)%0A%0A%0Aclas
|
cc5ac430cdc94211472cdb2f4541c834faa83105 | Fix some bugs | Server/app.py | Server/app.py | # -*- coding: utf-8 -*-
"""
BUFSM
~~~~~~~~
A simple web api for stream map cordinates with Flask and sqlite3.
"""
from sqlite3 import dbapi2 as sqlite3
import click, json
from flask import Flask, request, redirect, json, jsonify, _app_ctx_stack, render_template
# configuration
DATABASE = '/home/bufsm.db... | Python | 0.000056 | @@ -3391,16 +3391,19 @@
route('/
+map
')%0Adef h
|
d50daddde2186d54659a4f8dbf63622311ed6d22 | remove service class | glim/services.py | glim/services.py | # metaclass for Service class
class DeflectToInstance(type):
def __getattr__(selfcls, a): # selfcls in order to make clear it is a class object (as we are a metaclass)
try:
# first, inquiry the class itself
return super(DeflectToInstance, selfcls).__getattr__(a)
except Attrib... | Python | 0.000003 | @@ -1,685 +1,33 @@
-# metaclass for Service class%0Aclass DeflectToInstance(type):%0A def __getattr__(selfcls, a): # selfcls in order to make clear it is a class object (as we are a metaclass)%0A try:%0A # first, inquiry the class itself%0A return super(DeflectToInstance, selfcls).__geta... |
ba605e0ac7df38e5a7ef62cc80e5b7b7b35f8849 | Move astropy import to add_table | ipyaladin/aladin_widget.py | ipyaladin/aladin_widget.py | from ipywidgets import (widgets)
from traitlets import (Float, Unicode, Bool, List, Dict, default)
# theses library must be installed, and are used in votable operations
# http://www.astropy.org/
import astropy
""" Definition of the AladinLite widget in the python kernel """
class Aladin(widgets.DOMWidget):
_view... | Python | 0 | @@ -97,119 +97,8 @@
t)%0A%0A
-# theses library must be installed, and are used in votable operations%0A# http://www.astropy.org/%0Aimport astropy
%0A%0A%22%22
@@ -4645,32 +4645,178 @@
otable object%22%22%22
+%0A%0A # theses library must be installed, and are used in votable operations%0A # http://www.a... |
72902ebcada7bdc7a889f8766b63afff82110182 | Comment about recursion limit in categories. | webshop/extensions/category/__init__.py | webshop/extensions/category/__init__.py | # Copyright (C) 2010-2011 Mathijs de Bruin <mathijs@mathijsfietst.nl>
#
# This file is part of django-webshop.
#
# django-webshop 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 2, or (at... | Python | 0 | @@ -1232,11 +1232,161 @@
ducts.%0A%0A
+TODO: We want a setting allowing us to limit the nestedness of categories.%0AFor 'navigational' reasons, a number of 3 should be a reasonable default.%0A%0A
%22%22%22
|
f5fad49e0b20e54e01fe4d9ae69be0694d7878f9 | add docstring to test setup, and move to the top | sale_exception_nostock/tests/test_dropshipping_skip_check.py | sale_exception_nostock/tests/test_dropshipping_skip_check.py | # Author: Leonardo Pistone
# Copyright 2014 Camptocamp SA
#
# 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 la... | Python | 0 | @@ -857,152 +857,42 @@
def
-test_dropshipping_sale_can_always_be_delivered(self):%0A self.assertIs(True, self.order_line.can_command_at_delivery_date())%0A%0A def test_
+setUp(self):%0A %22%22%22Set up an
drop
@@ -903,147 +903,111 @@
ping
-_
+
sale
-_does_not_affect_future_orders(self):%0A ... |
8fb97bc0b3a22b912958974636051447170a0b02 | Add user_account to the user profile admin as a read-only field. | go/base/admin.py | go/base/admin.py | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from go.base.models import GoUser, UserProfile, UserOrganisation
from go.base.forms import GoUserCreationForm, GoUserChangeForm
class UserProfileInline(admin.StackedInline):
mo... | Python | 0 | @@ -371,16 +371,72 @@
s_admin'
+, 'user_account')%0A readonly_fields = ('user_account',
)%0A ca
|
56d3db6aae71c88ff8b55bb1d173abc025be7e8c | Add test of a write command | jacquard/tests/test_cli.py | jacquard/tests/test_cli.py | import io
import unittest.mock
import contextlib
import textwrap
from jacquard.cli import main
from jacquard.storage.dummy import DummyStore
def test_smoke_cli_help():
try:
output = io.StringIO()
with contextlib.redirect_stdout(output):
main(['--help'])
except SystemExit:
p... | Python | 0.000268 | @@ -1002,8 +1002,355 @@
strip()%0A
+%0A%0Adef test_run_write_command():%0A config = unittest.mock.Mock()%0A config.storage = DummyStore('', data=%7B%7D)%0A%0A output = io.StringIO()%0A with contextlib.redirect_stdout(output):%0A main(%5B'set-default', 'foo', '%22bar%22'%5D, config=config)%0A%0A a... |
ae7f8c0deaaec2cbc830113ea19f06ca6aa169c7 | Use `persist.errors` for the goto commands again | goto_commands.py | goto_commands.py | import sublime
import sublime_plugin
from itertools import dropwhile, takewhile
"""
Implement typical Goto Next Previous Error Commands.
"""
class SublimeLinterGotoError(sublime_plugin.WindowCommand):
def run(self, direction='next', count=1, wrap=False):
goto(self.window.active_view(), direction, count... | Python | 0 | @@ -75,16 +75,43 @@
ewhile%0A%0A
+from .lint import persist%0A%0A
%0A%22%22%22%0AImp
@@ -354,372 +354,8 @@
)%0A%0A%0A
-STORAGE_KEY = 'SL.%7Bvid%7D.region_keys'%0A%0A%0Adef get_region_keys(view):%0A setting_key = STORAGE_KEY.format(vid=view.id())%0A return set(view.settings().get(setting_key) or %5B%5D)%0A%0A%0... |
abc5ad8f3741335e0ee1072867dc45514efed512 | fix W293 (blank line with whitespace) | src/main/python/pybuilder/plugins/python/coverage_plugin.py | src/main/python/pybuilder/plugins/python/coverage_plugin.py | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2014 PyBuilder Team
#
# 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/l... | Python | 0.000003 | @@ -3226,24 +3226,16 @@
eptions%0A
-
%0A
|
84047b6dff25b78d51830159f67360b93c391680 | use integral for slice | src/main/python/pybuilder/plugins/python/unittest_plugin.py | src/main/python/pybuilder/plugins/python/unittest_plugin.py | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2014 PyBuilder Team
#
# 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/l... | Python | 0.000001 | @@ -3519,20 +3519,17 @@
= slice(
-None
+0
, -3)%0A
|
0cec69e607e65e75695202d755a40386c2357132 | Version 0.1 | tumblelog/__init__.py | tumblelog/__init__.py | __version__ = '0.9'
| Python | 0.000001 | @@ -14,7 +14,7 @@
'0.
-9
+1
'%0A
|
5e507e05958e32cbf4c6b09093bbf38f00cfee24 | ask which class the user is in | arithmeticQuiz.py | arithmeticQuiz.py | import random #imports the default Python random module, which allows for random number generation
import time #imports the default Python time module, which allows for pauses in the program
counter = 1 #defines the counter, which counts up to 10 each time a question is asked
score = 0 #defines the... | Python | 0.999622 | @@ -901,16 +901,104 @@
program.
+%0AwhichClass = input(%22And which class are you in, Class One, Class Two or Class Three? %22)
%0A%0Awhile
|
1d31282a9781e8eef4aafc0549c01056d4fc03d0 | Bump version. | armet/_version.py | armet/_version.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 4, 21)
__version__ = '.'.join(map(str, __version_info__))
| Python | 0 | @@ -116,9 +116,9 @@
4, 2
-1
+2
)%0A__
|
cec594e525fb889029b85b1f92f89170ca330332 | Remove unnecessary "is not supported" verbiage. | zerver/webhooks/trello/view/__init__.py | zerver/webhooks/trello/view/__init__.py | # Webhooks for external integrations.
from typing import Any, Mapping, Optional, Tuple
import orjson
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view, return_success_on_head_request
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.respon... | Python | 0 | @@ -1681,11 +1681,8 @@
o%22,
-f'%7B
acti
@@ -1692,25 +1692,6 @@
type
-%7D is not supported'
)%0A
|
04605ee82108695989e8f10b2287d43f6df448f8 | Update noisy_linear.py | chainerrl/links/noisy_linear.py | chainerrl/links/noisy_linear.py | import chainer
import chainer.functions as F
from chainer.initializers import Constant
import chainer.links as L
import numpy
from chainerrl.initializers import VarianceScalingConstant
class FactorizedNoisyLinear(chainer.Chain):
"""Linear layer in Factorized Noisy Network
Args:
mu_link (L.Linear): L... | Python | 0 | @@ -904,16 +904,302 @@
mu_link%0A
+ self.mu.W.initializer = Uniform(1 / numpy.sqrt(in_size)) %0A if not self.nobias:%0A self.mu.b.initializer = Uniform(1 / numpy.sqrt(in_size))%0A%0A self.mu.W.initialize((self.out_size, in_size))%0A self.mu.b.initialize((self... |
a6ee84d105943628a66685fb5425cb00a45ca2e1 | Update feed2zinnia.py | zinnia/management/commands/feed2zinnia.py | zinnia/management/commands/feed2zinnia.py | """Feed to Zinnia command module"""
import os
import sys
from urllib2 import urlopen
from datetime import datetime
from optparse import make_option
from django.conf import settings
from django.utils import timezone
from django.core.files import File
from django.utils.text import Truncator
from django.utils.html import... | Python | 0.000006 | @@ -3727,16 +3727,17 @@
('publis
+h
ed_parse
|
65099acbb8799e3d3beeb8aee11f46053945219b | handle freestyle-type projects | jenkins_job_wrecker/cli.py | jenkins_job_wrecker/cli.py | import argparse
from argparse import ArgumentDefaultsHelpFormatter
import errno
import logging
import jenkins
import os
import sys
import textwrap
import jenkins_job_wrecker.job_handlers as job_handlers
import xml.etree.ElementTree as ET
from yaml import dump
logging.basicConfig(level=logging.INFO)
log = logging.getLo... | Python | 0 | @@ -1251,16 +1251,48 @@
pes = %7B%0A
+ 'project': 'freestyle',%0A
|
67c40fff7813b91b874c5fada042bfc0c6990d52 | Bump version | typepy/__version__.py | typepy/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2017-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.3.1"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| Python | 0 | @@ -204,17 +204,17 @@
= %220.3.
-1
+2
%22%0A__main
|
a9baa24fda1ee3689acfa757d7e3b9ef1cc17968 | Improve naming and attrs of hostnameless Huawei LTE device tracker entities (#29281) | homeassistant/components/huawei_lte/device_tracker.py | homeassistant/components/huawei_lte/device_tracker.py | """Support for device tracking of Huawei LTE routers."""
import logging
import re
from typing import Any, Dict, Set
import attr
from stringcase import snakecase
from homeassistant.components.device_tracker import (
DOMAIN as DEVICE_TRACKER_DOMAIN,
SOURCE_TYPE_ROUTER,
)
from homeassistant.components.device_tr... | Python | 0 | @@ -5057,24 +5057,87 @@
_connected:%0A
+ # HostName may be present with explicit None value%0A
@@ -5168,17 +5168,20 @@
ostName%22
-,
+) or
self.ma
@@ -5181,17 +5181,16 @@
self.mac
-)
%0A
@@ -5267,32 +5267,16 @@
se(k): v
-%0A
for k,
@@ -5296,51 +5296,16 @@
ms()
-... |
fa9e5956adadd20d546129b07bf4b71772cd5b05 | make small optimization to vector multiply/divide | pyschool/static/external/brython/Lib/site-packages/glow/vector.py | pyschool/static/external/brython/Lib/site-packages/glow/vector.py | from javascript import JSConstructor, console
class vec:
def __init__(self, x=0, y=0, z=0):
self._vec=JSConstructor(glowscript.vec)(x,y,z)
self.add=self.__add__
self.sub=self.__sub__
self.multiply=self.__mul__
self.divide=self.__truediv__=self.__div__
#vec should be a glowscript vec... | Python | 0.000001 | @@ -1277,40 +1277,20 @@
er,
+(
int
-) or isinstance(other
, float)
:%0A
@@ -1277,32 +1277,33 @@
er, (int, float)
+)
:%0A _v=ve
@@ -1536,40 +1536,20 @@
er,
+(
int
-) or isinstance(other
, float)
:%0A
@@ -1544,16 +1544,17 @@
, float)
+)
:%0A
|
e6f2493e2a4c00307854fb52809123b0ba1a8bce | fix error message formatting | invenio_stats/cli.py | invenio_stats/cli.py | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2018 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | Python | 0.000001 | @@ -1766,32 +1766,42 @@
+', '.join(
invalid_values,
@@ -1790,37 +1790,60 @@
n(invalid_values
-, set
+),%0A ', '.join
(current_stats.e
@@ -2246,24 +2246,34 @@
+', '.join(
invalid_valu
@@ -2278,13 +2278,36 @@
lues
-, set
+),%0A ', '.join
(cur
|
835da41ffd1433c36bdc585a3154434c60bdbb8f | Fix lint | biggraphite/drivers/_utils.py | biggraphite/drivers/_utils.py | #!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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 agree... | Python | 0.000032 | @@ -3212,24 +3212,70 @@
func(func):%0A
+ %22%22%22Decorator for tracing of functions.%22%22%22%0A
if not e
@@ -3312,16 +3312,17 @@
rn func%0A
+%0A
def
@@ -3591,16 +3591,8 @@
e__)
- as span
:%0A
|
4b14f12fa8bb6dca7ad91f187e7765bef27c0d65 | Add some options | classes/admin.py | classes/admin.py | from django.contrib import admin
from classes.models import Attendee
from classes.models import Attendance
from classes.models import Session
from classes.models import WalkinClass
class AttendanceInline(admin.TabularInline):
model = Attendance
extra = 1
verbose_name = 'Attendee'
verbose_name_plural ... | Python | 0.000535 | @@ -399,16 +399,52 @@
notes')%0A
+ search_fields = 'name', 'phone'%0A
%0A%0Aclass
@@ -848,16 +848,157 @@
_time',)
+%0A date_hierarchy = 'start_date_time'%0A list_filter = %5B'walk_in_class', 'start_date_time', 'teacher'%5D%0A ordering = %5B'-start_date_time'%5D
%0A%0Aclass
|
54d1366167cd21604222efaeab193d0ffc71680e | remove TODO | source/jormungandr/jormungandr/street_network/ridesharing.py | source/jormungandr/jormungandr/street_network/ridesharing.py | # Copyright (c) 2001-2016, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public t... | Python | 0.000001 | @@ -1457,35 +1457,8 @@
e):%0A
- %22%22%22%0A TODO:%0A %22%22%22%0A%0A
|
7bdf0a3121d539e0a98ffa68a964bfd022fe43a5 | Make the stitcher executable | atram_stitcher.py | atram_stitcher.py | #!/usr/bin/env python3
"""
Start the atram exon stitcher.
This wrapper module parses the input arguments and passes them to the module
that does the actual stitching (core_stitcher.py).
"""
from os.path import join
from datetime import date
import argparse
import textwrap
import lib.db as db
import lib.log as log
imp... | Python | 0.998561 | |
aa681b4a36ce36c53933f3834eec9c721d6029cf | Update docker images utils | polyaxon/docker_images/image_info.py | polyaxon/docker_images/image_info.py | import logging
from typing import Any, Tuple
import conf
from constants.images_tags import LATEST_IMAGE_TAG
_logger = logging.getLogger('polyaxon.dockerizer.images')
def get_experiment_image_info(experiment: 'Experiment') -> Tuple[str, str]:
"""Return the image name and image tag for an experiment"""
proj... | Python | 0.000001 | @@ -584,16 +584,17 @@
ob: Any)
+
-%3E Tuple
@@ -1226,24 +1226,32 @@
G%0A%0A%0Adef get_
+project_
image_name(b
@@ -1249,37 +1249,50 @@
ge_name(
-build_job: 'BuildJob'
+project_name: str, project_id: int
) -%3E str
@@ -1382,38 +1382,752 @@
-build_job.
+project_name.lower(),%0A pro... |
d69bd1c72c1e01ba392eda54820ca5db4774b744 | Use 'open' with 'with' | polycircles/test/test_earthquakes.py | polycircles/test/test_earthquakes.py | import os, csv
from nose.tools import assert_equal
from polycircles import polycircles
import simplekml
import unittest
class TestLastPointInPolygonEqualsTheFirstOne(unittest.TestCase):
"""
Courtesy Carlos H. Grohmann (https://github.com/CarlosGrohmann) who
reported Issue #1 (https://github.com/adamatan/p... | Python | 0.998616 | @@ -895,16 +895,53 @@
ut_dir)%0A
+ with open(csvfile) as f:%0A
@@ -966,27 +966,9 @@
der(
-open(csvfile, 'rU')
+f
, de
@@ -976,24 +976,28 @@
imiter=',')%0A
+
quak
|
7f0d7cc205f6ff740cf376932c592db39769b783 | Update analyzefiles.py | bin/interpret/analyzefiles.py | bin/interpret/analyzefiles.py | #!/usr/bin/python
import os,sys,inspect
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
import config as cfg
import co... | Python | 0.000001 | @@ -2936,16 +2936,8 @@
'CN'
-, 'type'
), '
@@ -2977,15 +2977,8 @@
int'
-, 'S10'
)%7D%0A%09
|
bd4a6e4444b73eacc75657985ffbfd90538a08f0 | fix code style | flexget/ui/__init__.py | flexget/ui/__init__.py | from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
import os
import fnmatch
from flask import send_from_directory, Flask
from flexget.webserver import register_app, register_home
from flask_compress import Compr... | Python | 0.000022 | @@ -1217,25 +1217,24 @@
app.html')%0A%0A
-%0A
def _find(pa
@@ -1270,16 +1270,20 @@
for root
+_dir
, dir_na
@@ -1415,16 +1415,20 @@
oin(root
+_dir
, filena
|
7307a4b19b09f4408f569c580955f5c7d2af5f73 | Update version number | auth0/__init__.py | auth0/__init__.py | __version__ = '2.0.0b3'
| Python | 0.000002 | @@ -18,7 +18,7 @@
0.0b
-3
+4
'%0A
|
6a1c3e8c7adecc98af10161d41d95034919eeacd | Allow user specified tsconfig.json | sphinx_js/generators.py | sphinx_js/generators.py | from codecs import getwriter
from errno import ENOENT
import subprocess
import os
from os.path import abspath
from tempfile import TemporaryFile, NamedTemporaryFile
from json import load
from sphinx.errors import SphinxError
from sphinx.util.logging import getLogger
from six import string_types
from .typedoc import par... | Python | 0 | @@ -2627,57 +2627,8 @@
hs)%0A
-%3C%3C%3C%3C%3C%3C%3C eeacb9237af86b8b6e6dfd960f4696ab43e91aec%0A
@@ -2760,42 +2760,8 @@
th)%0A
-=======%0A%3E%3E%3E%3E%3E%3E%3E Refactor jsdoc.py%0A
|
f1a54346ac0a0241ee5d8011ba443fc7ef5a74f1 | discard happens after interrupt | pyardrone/utils/object_executor.py | pyardrone/utils/object_executor.py | import threading
import queue
import time
class Interrupt:
def __init__(self, obj_exe, wait, discard):
self.obj_exe = obj_exe
self.wait = wait
self.discard = discard
def __enter__(self):
self.obj_exe.pause(wait=self.wait)
if self.discard:
q = self.obj_exe.... | Python | 0.000112 | @@ -259,16 +259,103 @@
f.wait)%0A
+%0A def __exit__(self, exc_type, exc_value, exc_tb):%0A if exc_type is None:%0A
@@ -371,16 +371,20 @@
iscard:%0A
+
@@ -415,32 +415,36 @@
eue%0A
+
with self.obj_ex
@@ -470,24 +470,28 @@
+
+
with q.mutex
@@ -49... |
443d56fdd2e588c11c2a1e3a685912b712e37d44 | Make sure all fields are grabbed. | split/casanfar_split.py | split/casanfar_split.py | import os
import numpy as np
import sys
SDM_name = str(sys.argv[4])
print "Inputted MS: "+SDM_name
# SDM_name = '14B-088.sb30023144.eb30070731.57002.919034293984'
# Set up some useful variables (these will be altered later on)
msfile = SDM_name + '.ms'
hisplitms = SDM_name + '.hi.ms'
splitms = SDM_name + '.hi.src.sp... | Python | 0 | @@ -424,16 +424,17 @@
e = 'M33
+*
'%0A%0A# VOS
|
eeee8fb498eb3a52baff7b9b2684c8a713e20216 | remove non-essential calls from inner-loop methods | pydoop/mapreduce/binary_streams.py | pydoop/mapreduce/binary_streams.py | # BEGIN_COPYRIGHT
#
# Copyright 2009-2017 CRS4.
#
# 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 agree... | Python | 0.000009 | @@ -1310,72 +1310,8 @@
s):%0A
- self.logger.debug('request to write %25r, %25r', cmd, args)%0A
@@ -1502,65 +1502,8 @@
s,)%0A
- self.logger.debug('writing (%25r, %25r)', cmd, args)%0A
@@ -1585,51 +1585,8 @@
s):%0A
- assert len(args) == len(typecodes)%0A
|
ed320c5fac9bdd53b568946847981d38b0e0037b | Handle requests exceptions in actual healthcheck | src/django_healthchecks/checker.py | src/django_healthchecks/checker.py | import base64
import functools
import inspect
from importlib import import_module
from django.conf import settings
from django.utils.encoding import force_text
import requests
try:
from django.utils.module_loading import import_string
except ImportError:
def import_string(value):
module_name, func_na... | Python | 0 | @@ -76,16 +76,32 @@
module%0A%0A
+import requests%0A
from dja
@@ -171,32 +171,16 @@
e_text%0A%0A
-import requests%0A
%0Atry:%0A
@@ -755,25 +755,8 @@
t):%0A
- try:%0A
@@ -793,54 +793,11 @@
nc()
-%0A except:%0A report%5Bservice%5D =
+ or
Fal
@@ -1095,21 +1095,8 @@
%5B1%5D%0A
... |
b445042c56e5d3e23d05e47d9617efba4e55c284 | Update player.py | axelrod/player.py | axelrod/player.py | import inspect
import random
import copy
from axelrod import Actions,
from .game import DefaultGame
C, D = Actions.C, Actions.D
# Strategy classifiers
def is_basic(s):
"""
Defines criteria for a strategy to be considered 'basic'
"""
stochastic = s.classifier['stochastic']
depth = s.classifier... | Python | 0.000001 | @@ -64,16 +64,27 @@
ctions,
+flip_action
%0Afrom .g
|
4e0d90fc157760606ae8503762f10bdef30bff8c | Remove trailing slashes | bluebottle/impact/urls/api.py | bluebottle/impact/urls/api.py | from django.conf.urls import url
from bluebottle.impact.views import (
ImpactTypeList,
ImpactGoalList,
ImpactGoalDetail
)
urlpatterns = [
url(r'^types/$', ImpactTypeList.as_view(), name='impact-type-list'),
url(r'^goals/$', ImpactGoalList.as_view(), name='impact-goal-list'),
url(
r'^go... | Python | 0.000346 | @@ -161,17 +161,16 @@
r'%5Etypes
-/
$', Impa
@@ -233,17 +233,16 @@
r'%5Egoals
-/
$', Impa
@@ -326,17 +326,16 @@
%3Cpk%3E%5Cd+)
-/
$',%0A
|
dc5ec290095e570ee1f96ffe110aee98009119bf | fix call | gunicorn/sock.py | gunicorn/sock.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import errno
import os
import socket
import sys
import time
from gunicorn import util
from gunicorn.six import string_types
class BaseSocket(object):
def __init__(self, address, conf, l... | Python | 0.000001 | @@ -2067,16 +2067,22 @@
address,
+ conf,
log, fd
@@ -2259,16 +2259,22 @@
__(addr,
+ conf,
log, fd
|
c89a42d4acf1e343616f537b827d471007cfc627 | fix doc typo | client/python/thegame/entity.py | client/python/thegame/entity.py | import collections
from thegame.abilities import Ability
Vector = collections.namedtuple('Vector', ('x', 'y'))
Vector.__doc__ = '''
A 2D vector.
Used to represent a point and velocity in thegame
'''
class _EntityAttribute:
def __init__(self, doc=None):
self.__doc__ = doc
def __set_name__(self, kla... | Python | 0.000004 | @@ -5840,16 +5840,23 @@
l the a
+bullet
is ready
|
0dd21b0f13aa7bf4cc3061dca216c65cf73975e5 | Make registration reports filterable and harmonize URL | kcdc3/apps/classes/urls.py | kcdc3/apps/classes/urls.py | from django.conf.urls import patterns, include, url
from models import Event, Registration
from views import EventListView, EventDetailView, ResponseTemplateView, EventArchiveView, SessionView, RegistrationListView, TeacherAdminListView, FilteredTeacherAdminListView
urlpatterns = patterns('kcdc3.apps.classes.views',
... | Python | 0 | @@ -462,24 +462,25 @@
Za-z0-9_-%5D+)
+/
$', Filtered
@@ -524,17 +524,13 @@
(r'%5E
-dashboard
+staff
/reg
@@ -540,16 +540,24 @@
rations/
+session/
(?P%3Cslug
@@ -568,24 +568,25 @@
Za-z0-9_-%5D+)
+/
$', Registra
|
80afbf3b5be1716553b93ee6ba57404d40e43a94 | Remove multiple workers | gunicorn_conf.py | gunicorn_conf.py | accesslog = '-'
access_log_format = '%({Host}i)s %(h)s %(l)s "%({X-Remote-User-Id}o)s: %({X-Remote-User-Name}o)s" %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s'
workers = 3
| Python | 0.003335 | @@ -153,16 +153,4 @@
)s'%0A
-workers = 3%0A
|
67346a13eb40d605da498b0bdba25ca661f08dd1 | Remove unused imports | geotrek/feedback/templatetags/feedback_tags.py | geotrek/feedback/templatetags/feedback_tags.py | import json
from geotrek.feedback.models import PredefinedEmail, ReportStatus
from mapentity.models import LogEntry
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def suricate_management_enabled():
return settings.SURICATE_MANAGEMENT_ENABLED
@re... | Python | 0.000001 | @@ -75,46 +75,8 @@
tus%0A
-from mapentity.models import LogEntry%0A
from
|
f4b7426103d2b484501a3bfdff3ebe976216b882 | Make a nice description of the module. (../port-add-product_multi_company_7.0-bis-jge/ rev 213.5.7) | product_price_history/__openerp__.py | product_price_history/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright 2013 Camptocamp SA
# Author: Joel Grand-Guillaume
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | Python | 0.000001 | @@ -1190,25 +1190,16 @@
n%22: %22%22%22%0A
-%0A
Product
@@ -1212,25 +1212,39 @@
History%0A
-%0A
+=====================%0A%0A
This mod
@@ -1267,20 +1267,11 @@
:%0A%0A
-
*
-r
+R
ecor
@@ -1354,26 +1354,16 @@
company
-%0A
can have
@@ -1419,21 +1419,11 @@
e. %0A
-%0A
... |
2a0e114569a9828347593e8943ff061c1172f0d5 | make encode and decode configurable | pyramid_redis_sessions/__init__.py | pyramid_redis_sessions/__init__.py | import os
import cPickle
import binascii
from redis import Redis
from functools import partial
from pyramid.compat import text_
from zope.interface import implementer
from .session import RedisSession
from .connection import get_default_connection
from .util import (
get_unique_session_id,
refresh,
)
fr... | Python | 0.000001 | @@ -774,24 +774,25 @@
ry.settings%0A
+%0A
# specia
@@ -806,80 +806,129 @@
for
-a custom_connect function (a dotted python path)%0A if 'custom_connect'
+dotted python paths to configurable callables%0A for option in ('custom_connect', 'encode', 'decode'):%0A if option
in
@@ -945,30 +945,36 @@
... |
ee2b2cdfe973ccc56a908047bde16c9fa82a5a5f | Improve efficiency of show repo sync date | kitchen/dashboard/views.py | kitchen/dashboard/views.py | """Dashboard app views"""
import os
import time
from datetime import datetime
from django.contrib.messages import add_message, ERROR, INFO, WARNING
from django.shortcuts import render_to_response
from django.template import RequestContext
from logbook import Logger
from kitchen.dashboard.chef import (get_nodes_extend... | Python | 0.000001 | @@ -1511,20 +1511,41 @@
-date_file =
+try:%0A sync_date = os.stat(
os.p
@@ -1581,90 +1581,18 @@
te')
-%0A if os.path.exists(date_file):%0A sync_date = os.path.getmtime(date_file)
+).st_mtime
%0A
@@ -1975,27 +1975,37 @@
c_str)%0A e
-lse
+xcept OSError
:%0A ad
|
eb712d30a6231b416e33d02a125daddf5322d51e | Add API docs for the Exscript.util.syslog module. | src/Exscript/util/syslog.py | src/Exscript/util/syslog.py | import imp, socket
# This way of loading a module prevents Python from looking in the
# current directory. (We need to avoid it due to the syslog module
# name collision.)
syslog = imp.load_module('syslog', *imp.find_module('syslog'))
def netlog(message,
source = None,
host = 'localhost',
... | Python | 0 | @@ -1,15 +1,742 @@
+# Copyright (C) 2007-2010 Samuel Abels.%0A#%0A# This program is free software; you can redistribute it and/or modify%0A# it under the terms of the GNU General Public License version 2, as%0A# published by the Free Software Foundation.%0A#%0A# This program is distributed in the hope that it will be u... |
e05243983cb9167303a19e85a3c88f74da8e2612 | Convert ipLocation function name to all lowercase | bot/slack/commands/ip_info.py | bot/slack/commands/ip_info.py | import netaddr
import os
from mozdef_util.geo_ip import GeoIP
def is_ip(ip):
try:
netaddr.IPNetwork(ip)
return True
except Exception:
return False
def ipLocation(ip):
location = ""
try:
geoip_data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../... | Python | 1 | @@ -183,17 +183,18 @@
%0A%0Adef ip
-L
+_l
ocation(
@@ -1306,17 +1306,18 @@
oken, ip
-L
+_l
ocation(
|
7f72d1d8f8472daf03afb9a942d22eaae98d98a8 | add unit test | bottleneck/tests/move_test.py | bottleneck/tests/move_test.py | "Test moving window functions."
import warnings
from nose.tools import assert_true
import numpy as np
from numpy.testing import (assert_equal, assert_array_equal,
assert_array_almost_equal)
nan = np.nan
import bottleneck as bn
DTYPES = [np.float64, np.float32, np.int64, np.int32, np.float1... | Python | 0.000001 | @@ -1132,16 +1132,91 @@
ield -a%0A
+ # check that move_std is robust%0A yield np.array(%5B1., 2., 3.%5D) + 1e9%0A
%0A%0Adef un
@@ -4032,16 +4032,17 @@
max, 5%0A%0A
+%0A
def test
|
859d5cd5ac60785f64a87353ae8f9170f5e29100 | Make uri absolute, add get_release_data api | folivora/utils/pypi.py | folivora/utils/pypi.py | #-*- coding: utf-8 -*-
"""
folivora.utils.pypi
~~~~~~~~~~~~~~~~~~~
Utilities to access pypi compatible servers.
"""
import time
import xmlrpclib
def get_seconds(hours):
"""Get number of seconds since epoch from now minus `hours`"""
return int(time.time() - (60 * 60) * hours)
XML_RPC_SERVER = 'h... | Python | 0 | @@ -294,23 +294,23 @@
ours)%0A%0A%0A
-XML_RPC
+DEFAULT
_SERVER
@@ -339,16 +339,17 @@
org/pypi
+/
'%0A%0A%0Aclas
@@ -405,15 +405,15 @@
ver=
-XML_RPC
+DEFAULT
_SER
@@ -1726,8 +1726,453 @@
ersion)%0A
+%0A def get_release_data(self, package_name, version=None):%0A %22%22%22Query for specific release data.... |
38a974f39fdc976a9567da8582d77fa9aa00df82 | Use correct bounds | foolbox/attacks/ddn.py | foolbox/attacks/ddn.py | from typing import Union, Tuple, Optional, Any
import math
import eagerpy as ep
from ..models import Model
from ..criteria import Misclassification, TargetedMisclassification
from ..distances import l2
from ..devutils import atleast_kd, flatten
from .base import MinimizationAttack
from .base import get_criterion
f... | Python | 0.000093 | @@ -2729,16 +2729,50 @@
ze = 1.0
+%0A min_, max_ = model.bounds
%0A%0A
@@ -3274,19 +3274,29 @@
aximum(x
-, 1
+ - min_, max_
- x)),
|
30b991e78158f8dee25a34565493b1ca582d51c5 | Simplify attribute check (menu items) | cmsplugin_zinnia/cms_toolbar.py | cmsplugin_zinnia/cms_toolbar.py | """Toolbar extensions for CMS"""
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from cms.toolbar_base import CMSToolbar
from cms.toolbar_pool import toolbar_pool
class ZinniaToolbar(CMSToolbar):
def populate(self):
user = self.request.user
zi... | Python | 0 | @@ -1531,19 +1531,23 @@
if
-has
+not get
attr(ite
@@ -1563,31 +1563,15 @@
led'
-) and not item.disabled
+, True)
:%0A
|
b3f926e013e81bb88e6634d453b31c5c30aac997 | Add constant to distance scoring functions | cocoscore/ml/distance_scores.py | cocoscore/ml/distance_scores.py | from math import exp
def _distance_scorer(data_df, score_function):
distance_column = 'distance'
if distance_column not in data_df.columns:
raise ValueError(f'The given data_df does not have a {distance_column} column.')
distances = data_df.loc[:, distance_column]
return distances.apply(score_... | Python | 0.000348 | @@ -819,16 +819,19 @@
ta_df, 1
+, 0
)%0A%0A%0Adef
@@ -1237,32 +1237,35 @@
tance(data_df, k
+, c
):%0A %22%22%22%0A C
@@ -1419,16 +1419,20 @@
xp(-k*x)
+ + c
where%0A
@@ -1704,32 +1704,73 @@
sitive constant%0A
+ :param c: float, a positive constant%0A
:returns a p
@@ -1867,16 +1867,20 @@
(-k * x)... |
a23a9c4e5cd06ff6239a24e55ca7c4c598d02b27 | Fix broken Glance cleanup context | rally/benchmark/context/cleaner.py | rally/benchmark/context/cleaner.py | # Copyright 2014: 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.000064 | @@ -2034,16 +2034,26 @@
ystone()
+.tenant_id
),%0A
|
e9b0bc34d27bfcf1175ad686450fc8a1af43e8f2 | Remove now unneeded imports. Reformat. | abusehelper/core/runtime.py | abusehelper/core/runtime.py | import os
import idiokit
from idiokit import timer
from idiokit.xmpp import jid
from abusehelper.core import serialize, config
def iter_runtimes(obj):
for obj in config.flatten(obj):
runtime = getattr(obj, "__runtime__", None)
if callable(runtime):
yield runtime()
continue
... | Python | 0 | @@ -1,14 +1,4 @@
-import os%0A
impo
@@ -12,34 +12,8 @@
kit%0A
-from idiokit import timer%0A
from
@@ -83,16 +83,37 @@
, config
+, bot, services, log%0A
%0A%0Adef it
@@ -529,16 +529,17 @@
ntinue%0A%0A
+%0A
class Pi
@@ -764,16 +764,17 @@
other)%0A%0A
+%0A
class Pi
@@ -799,24 +799,25 @@
:%0A pass%0A%0A
+%0A
c... |
4b8e76747ee164ebce0cd92b0d3752e848ce0734 | Fix bug with filter_target (#35141) | lib/ansible/modules/network/aci/aci_config_snapshot.py | lib/ansible/modules/network/aci/aci_config_snapshot.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | Python | 0 | @@ -6354,32 +6354,34 @@
filter_target='
+eq
(configSnapshot.
|
a668300c2e038b40b2ea6bbc51cb47598f4a5688 | Use AwesomeVersion for account link service check (#55449) | homeassistant/components/cloud/account_link.py | homeassistant/components/cloud/account_link.py | """Account linking via the cloud."""
import asyncio
import logging
from typing import Any
import aiohttp
from hass_nabucasa import account_link
from homeassistant.const import MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_en... | Python | 0 | @@ -99,16 +99,58 @@
aiohttp%0A
+from awesomeversion import AwesomeVersion%0A
from has
@@ -217,43 +217,25 @@
ort
-MAJOR_VERSION, MINOR_VERSION, PATCH
+__version__ as HA
_VER
@@ -494,16 +494,62 @@
ame__)%0A%0A
+CURRENT_VERSION = AwesomeVersion(HA_VERSION)%0A%0A
%0A@callba
@@ -988,26 +988,35 @@
ain and
-_is_older... |
33dd1a78a5bfdf0eca593816b15b34b86860c36f | install pip to bypass rally installation problem | lab/runners/RunnerRally.py | lab/runners/RunnerRally.py | from lab.runners import Runner
class RunnerRally(Runner):
def sample_config(self):
return {'cloud': 'cloud name', 'task-yaml': 'path to the valid task yaml file'}
def __init__(self, config):
from lab.WithConfig import read_config_from_file
super(RunnerRally, self).__init__(config=co... | Python | 0 | @@ -1236,16 +1236,68 @@
alenv')%0A
+ server.run(command='sudo easy_install pip')%0A
|
2c5d3387f23eaff6a689aad46b7b117f3a54bed1 | Fix wake_on_lan ping for Linux. (#6480) | homeassistant/components/switch/wake_on_lan.py | homeassistant/components/switch/wake_on_lan.py | """
Support for wake on lan.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.wake_on_lan/
"""
import logging
import platform
import subprocess as sp
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHE... | Python | 0 | @@ -2494,37 +2494,39 @@
d =
+%5B
'ping
- -n 1 -w %7B%7D %7B%7D'.format(%0A
+', '-n', '1', '-w',%0A
@@ -2529,32 +2529,39 @@
+ str(
DEFAULT_PING_TIM
@@ -2571,16 +2571,17 @@
T * 1000
+)
, self._
@@ -2584,17 +2584,17 @@
lf._host
-)
+%5D
%0A
@@ -2627,37 +2627,39 @@
d =
+%5B
'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.