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 |
|---|---|---|---|---|---|---|---|
8171af80ab1bff2ffac4b85642217a37fb485d74 | Rewrite serializer | rest_framework_gis/serializers.py | rest_framework_gis/serializers.py | # rest_framework_gis/serializers.py
from django.contrib.gis.db import models
from rest_framework.serializers import ModelSerializer
from .fields import GeometryField
class GeoModelSerializer(ModelSerializer):
def get_field(self, model_field):
"""
Creates a default instance of a basic non-rel... | Python | 0.000104 | @@ -162,16 +162,17 @@
yField%0A%0A
+%0A
class Ge
@@ -210,1652 +210,61 @@
r):%0A
-
%0A
-def get_field(self, model_field):%0A %22%22%22%0A Creates a default instance of a basic non-relational field.%0A %22%22%22%0A kwargs = %7B%7D%0A%0A kwargs%5B'blank'%5D = model_field.blan... |
f3ed10d94b44498030757f5f2866ba3a89349192 | Version bump. | s3ftp/__init__.py | s3ftp/__init__.py | """
s3ftp
MIT License. See LICENSE for more details.
Copyright (c) 2014, Jonathan Stoppani
"""
from .protocol import S3Realm, S3FTPShell
__version__ = '0.1.0'
__url__ = 'https://github.com/GaretJax/s3ftp'
__all__ = ['S3Realm', 'S3FTPShell']
| Python | 0 | @@ -154,17 +154,17 @@
= '0.1.
-0
+1
'%0A__url_
|
70d009834123cb5a10788763fed3193017cc8162 | Add a default null logger per python recommendations. | libpebble2/__init__.py | libpebble2/__init__.py | __author__ = 'katharine'
from .exceptions import *
| Python | 0 | @@ -19,16 +19,32 @@
arine'%0A%0A
+import logging%0A%0A
from .ex
@@ -61,8 +61,75 @@
mport *%0A
+%0Alogging.getLogger('libpebble2').addHandler(logging.NullHandler())%0A
|
33a87081422a52f57785ebca683992b5bd362c7a | Use a better error message when clusters are not balanced | perfrunner/tests/__init__.py | perfrunner/tests/__init__.py | import time
from exceptions import KeyboardInterrupt
from logger import logger
from perfrunner.helpers.cbmonitor import CbAgent
from perfrunner.helpers.memcached import MemcachedHelper
from perfrunner.helpers.metrics import MetricHelper
from perfrunner.helpers.misc import log_phase, target_hash, pretty_dict
from perf... | Python | 0 | @@ -2828,22 +2828,33 @@
pt('
-Rebalance fail
+The cluster is not balanc
ed')
|
e9c42d80a4fd6616a9d55babe4aab969718fe090 | Update PkgDistributionCreator.py | MTM_Installer/PkgDistributionCreator.py | MTM_Installer/PkgDistributionCreator.py | #!/usr/bin/env python
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | Python | 0 | @@ -858,21 +858,18 @@
Tree as
-etree
+ET
%0A%0Afrom g
@@ -4554,31 +4554,25 @@
-root = etree.Element
+tree = ET.parse
('
-/
User
@@ -4666,24 +4666,28 @@
-self.output(
+root = tree.get
root
+(
)%0A
@@ -4704,22 +4704,22 @@
d =
-etree.
+ET.Sub
Element(
'%3Cti
@@ -4718,38 +4718,20 @@
ent(
-'%3Ctitl... |
69fe87e0dd8deb194159f264bc30c50391806149 | fix scheduler_error_mailer | scheduler_error_mailer/ir_cron.py | scheduler_error_mailer/ir_cron.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Scheduler Error Mailer module for OpenERP
# Copyright (C) 2012-2013 Akretion (http://www.akretion.com/)
# @author: Sébastien Beau <sebastien.beau@akretion.com>
# @author David Beal <bealdavid@gmail.c... | Python | 0.000007 | @@ -2471,16 +2471,19 @@
template
+_id
.id, my_
|
eb9d297d14741f311cb4bf27c384077ba98cc789 | Add missing slot. | web/db/mongo/__init__.py | web/db/mongo/__init__.py | # encoding: utf-8
"""MongoDB database connection extension."""
import re
from pymongo import MongoClient
from pymongo.errors import ConfigurationError
from .model import Model
from .resource import MongoDBResource
from .collection import MongoDBCollection
__all__ = ['Model', 'MongoDBResource', 'MongoDBCollection'... | Python | 0 | @@ -874,16 +874,25 @@
t', 'db'
+, 'alias'
)%0A%09%0A%09pro
|
bf24abb4ffba4f63f641cc61e22357253cdca956 | Fix migration script | src/adhocracy/migration/versions/053_add_newsservice.py | src/adhocracy/migration/versions/053_add_newsservice.py | from datetime import datetime
from sqlalchemy import MetaData, Column, ForeignKey, Table
from sqlalchemy import Boolean, DateTime, Integer, Unicode, UnicodeText
metadata = MetaData()
message_table = Table(
'message', metadata,
Column('id', Integer, primary_key=True),
Column('subject', Unicode(140), nulla... | Python | 0.000008 | @@ -2218,16 +2218,20 @@
meta
+data
.bind =
|
307d866bb6538a78effcc44e005a4dcb90a2a4b5 | Increment to 0.5.4 | sanic/__init__.py | sanic/__init__.py | from sanic.app import Sanic
from sanic.blueprints import Blueprint
__version__ = '0.5.3'
__all__ = ['Sanic', 'Blueprint']
| Python | 0.999999 | @@ -84,9 +84,9 @@
0.5.
-3
+4
'%0A%0A_
|
5fd62098bd2f2722876a0873d5856d70046d3889 | Increment to 0.5.2 | sanic/__init__.py | sanic/__init__.py | from sanic.app import Sanic
from sanic.blueprints import Blueprint
__version__ = '0.5.1'
__all__ = ['Sanic', 'Blueprint']
| Python | 0.999999 | @@ -84,9 +84,9 @@
0.5.
-1
+2
'%0A%0A_
|
035938d8c0f3cc2cda353286c0089ee02ffe3b87 | Use dj six | likert_field/models.py | likert_field/models.py | #-*- coding: utf-8 -*-
from __future__ import unicode_literals
from six import string_types
from django.db import models
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
import likert_field.forms as forms
@python_2_unicode_compatible
... | Python | 0.000001 | @@ -61,38 +61,8 @@
ls%0A%0A
-from six import string_types%0A%0A
from
@@ -160,16 +160,58 @@
patible%0A
+from django.utils.six import string_types%0A
from dja
@@ -502,32 +502,94 @@
rgs, **kwargs):%0A
+ %22%22%22LikertField stores items with no answer as NULL%22%22%22%0A
if 'null
|
2194cc4e96fb2168b55c23a1c7a71636074ae8bf | Fix a comment | scout/adapter/mongo/rank_model.py | scout/adapter/mongo/rank_model.py | # -*- coding: utf-8 -*-
import logging
from io import StringIO
import requests
from configobj import ConfigObj
LOG = logging.getLogger(__name__)
TIMEUT = 20
class RankModelHandler(object):
def fetch_rank_model(self, rank_model_url):
"""Send HTTP request to retrieve rank model config file
Args:
... | Python | 0.999759 | @@ -3114,17 +3114,92 @@
ist)
- example:
+: list of dictionaries containing %22key%22, %22description%22 and %22score_ranges%22 key/values
%0A
|
0e288d4a711f061a01a951d2e1d9892f737211e0 | Add pps extension to IGNORED_EXTENSIONS | scrapy/linkextractors/__init__.py | scrapy/linkextractors/__init__.py | """
scrapy.linkextractors
This package contains a collection of Link Extractors.
For more info see docs/topics/link-extractors.rst
"""
import re
from six.moves.urllib.parse import urlparse
from parsel.csstranslator import HTMLTranslator
from scrapy.utils.misc import arg_to_iter
from scrapy.utils.url import (
ca... | Python | 0.000001 | @@ -849,16 +849,23 @@
'pptx',
+ 'pps',
'doc',
@@ -892,16 +892,20 @@
, 'odg',
+%0A
'odp',%0A
|
e8254ced75ce9d0df1033b6e4acb8e33f9b00e93 | ''.join want strings | scheduler/send.py | scheduler/send.py | #!/usr/bin/env python
import logging
logger = logging.getLogger('')
from models import Task
def send(function, args=None):
if args is None:
args = []
Task.objects.create(function=function, args=args)
logging.info("[x] Sent %s(%s)" % (function, ", ".join(args)))
| Python | 0.999958 | @@ -273,12 +273,37 @@
oin(
+map(lambda x: %22%25s%22 %25 x,
args)))
+)
%0A
|
60156236836944205f3993badcf179aaa6e7ae54 | Add an (unexposed) ResourceHandler so inheriting objects serialise better | ehriportal/portal/api/handlers.py | ehriportal/portal/api/handlers.py | """
Piston handlers for notable resources.
"""
from piston.handler import BaseHandler
from portal import models
class RepositoryHandler(BaseHandler):
model = models.Repository
class CollectionHandler(BaseHandler):
model = models.Collection
class PlaceHandler(BaseHandler):
model = models.Place
clas... | Python | 0 | @@ -108,16 +108,80 @@
models%0A%0A
+class ResourceHandler(BaseHandler):%0A model = models.Resource%0A
%0Aclass R
|
38029cc99bfd049491e9c5fa4d3e45a64c58845f | Fix last line indent to make pyflakes happy. | schemaish/attr.py | schemaish/attr.py | """
Schema attribute types, also imported into the main package.
"""
__all__ = ["String", "Integer", "Float", "Decimal", "Date", "Time", "Boolean", "Sequence",
"Tuple", "Structure"]
import itertools
from formencode import Invalid
# Internal counter used to ensure the order of a meta structure's attributes ... | Python | 0 | @@ -7339,16 +7339,9 @@
rn data%0A
-
+%0A
|
3c3392aeedbdd69fc6f36c7da1e319add0873b2e | remove print statement | web3/apps/sites/views.py | web3/apps/sites/views.py | import os
from django.shortcuts import render, redirect, get_object_or_404, reverse
from django.core.exceptions import PermissionDenied
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from .models import Site
from .forms import SiteForm, Pr... | Python | 0.999999 | @@ -1806,36 +1806,8 @@
s):%0A
- print(user)%0A
|
488e5dd9bcdcba26de98fdbcaba1e23e8b4a8188 | use csv writer for listing scraper | scrape_listing.py | scrape_listing.py | #!/usr/bin/env python
import sys
import requests
from models.listing import Listing
def scrape_listing(url):
response = requests.get(url)
listing = Listing(response.content)
# print('Title: ' + listing.title)
# print('Price: ' + listing.price)
# print('Image URLs: ' + listing.imgs)
# print('L... | Python | 0 | @@ -16,16 +16,27 @@
python%0A%0A
+import csv%0A
import s
@@ -116,16 +116,52 @@
g(url):%0A
+ writer = csv.writer(sys.stdout)%0A
resp
@@ -872,16 +872,408 @@
.party)%0A
+ writer.writerow(%5B%0A listing.post_id,%0A listing.title,%0A listing.listed_date,%0A listing.price,%0A ... |
03ec4f818807808d6e983fe80b1adb0af27b6ea4 | Update build_aar.py after webrtc/ dir was removed. | tools_webrtc/android/build_aar.py | tools_webrtc/android/build_aar.py | #!/usr/bin/env python
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All ... | Python | 0.000031 | @@ -1152,23 +1152,16 @@
ib.java/
-webrtc/
sdk/andr
@@ -1196,23 +1196,16 @@
FILE = '
-webrtc/
sdk/andr
@@ -1240,31 +1240,24 @@
GETS = %5B%0A '
-webrtc/
sdk/android:
@@ -1271,23 +1271,16 @@
tc',%0A '
-webrtc/
sdk/andr
|
ca356ae7b85c9d88f42c5adc6227d0125ff49399 | Update settings.py | udbproject/settings.py | udbproject/settings.py | """
Django settings for udbproject project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | Python | 0 | @@ -1880,11 +1880,23 @@
= '
-PST
+America/Seattle
'%0A%0AU
|
97b67b1ab49efd4c194b3338e3055ecb7991e682 | Add ValueError when links have duplicates | ipysankeywidget/sankey_widget.py | ipysankeywidget/sankey_widget.py | import warnings
import base64
import ipywidgets as widgets
from traitlets import (
Float,
Dict,
List,
Bool,
observe,
Unicode,
)
@widgets.register
class SankeyWidget(widgets.DOMWidget):
"""Sankey widget"""
_view_name = Unicode('SankeyView').tag(sync=True)
_model_name = Unicode('San... | Python | 0 | @@ -1158,16 +1158,483 @@
tor%22%22%22%0A%0A
+ # check for duplicates in links%0A values = %5B%5D%0A for link in kwargs.get('links', %5B%5D):%0A linksource = link%5B'source'%5D%0A linktarget = link%5B'target'%5D%0A if 'type' in link:%0A linktype = lin... |
844e1917e971e834f7c95064dc7ea31fc7cc0947 | Make build_plugins.py bail on error | build/build_plugins.py | build/build_plugins.py | from __future__ import print_function
import glob, os.path, sys
from mergeex import mergeex
try:
import simplejson as json
except ImportError:
import json
plugins = []
filters = []
for fileName in sorted(glob.glob('../plugins/*.json')):
try:
with open(fileName, 'rb') as f:
content = f.read().decode('utf-8')
... | Python | 0.000001 | @@ -91,17 +91,20 @@
x%0A%0Atry:%0A
-%09
+
import s
@@ -141,17 +141,20 @@
tError:%0A
-%09
+
import j
@@ -245,16 +245,25 @@
)):%0A
-%09
+
try:%0A
-%09%09
+
with
@@ -290,19 +290,28 @@
) as f:%0A
-%09%09%09
+
content
@@ -337,19 +337,28 @@
utf-8')%0A
-%09%09%09
+
plugi... |
3b3a7d482b3091959533c6de3138af349a8af558 | Tidy and comment spreadsheet reader module | autumn_model/spreadsheet.py | autumn_model/spreadsheet.py |
from __future__ import print_function
from xlrd import open_workbook
from numpy import nan
import numpy
import os
import tool_kit
#######################################
### Individual spreadsheet readers ###
#######################################
class GlobalTbReportReader:
def __init__(self, country_to_rea... | Python | 0 | @@ -274,16 +274,142 @@
tReader:
+%0A %22%22%22%0A Reader object for the WHO's Global TB Report 2016. Illustrates general structure for spreadsheet readers.%0A %22%22%22
%0A%0A de
@@ -871,16 +871,149 @@
f, col):
+%0A %22%22%22%0A Read and interpret a column of the spreadsheet%0A%0A Ar... |
6aa7acba495648b710635b465d5b7cd955d9f476 | remove tmp line | api/__database.py | api/__database.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
import os
from core.config import _core_config
from core.config_builder import _core_default_config
from core.config_builder import _builder
from core.alert import warn
from core.alert import messages
def create_connection(language):
try:
retur... | Python | 0.000008 | @@ -1556,24 +1556,8 @@
8))%0A
- print 2%0A
|
4b75e23687c3629d197cbdf0edac23d90e9c52b7 | Add Sample and Observation models | varda/models.py | varda/models.py | """
Models backed by SQL using SQLAlchemy.
"""
from datetime import date
from sqlalchemy import Index
from varda import db
class Variant(db.Model):
"""
Genomic variant.
"""
id = db.Column(db.Integer, primary_key=True)
chromosome = db.Column(db.String(2))
begin = db.Column(db.Integer)
e... | Python | 0 | @@ -2832,8 +2832,1768 @@
upport%7D%0A
+%0A%0Aclass Sample(db.Model):%0A %22%22%22%0A Sample.%0A%0A Todo: do we still need a poolSize in Sample now that we split population%0A studies to a separate model?%0A %22%22%22%0A id = db.Column(db.Integer, primary_key=True)%0A threshold = db.Column(db.Integ... |
591b0550e0724f3e515974fee02d8d40e070e52a | Bump version | lintreview/__init__.py | lintreview/__init__.py | __version__ = '2.25.0'
| Python | 0 | @@ -17,7 +17,7 @@
.25.
-0
+1
'%0A
|
c0b3a1b40149e939e91c5483383f1a1c715a9b9c | Update ipc_lista1.7.py | lista1/ipc_lista1.7.py | lista1/ipc_lista1.7.py | #ipc_lista1.7
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça um programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o #usuário.
altura = input("Digite a altura do quadrado em metros: ")
largura = input("Digite a largura
| Python | 0 | @@ -264,9 +264,12 @@
largura
+ em
%0A
|
4f2fdfc78cf9b070b7f53fd2e7c0472f2329e77d | test changes of pextant harness to work with pextant updates 2 | apps/basaltApp/pextantHarness.py | apps/basaltApp/pextantHarness.py | #__BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance ... | Python | 0 | @@ -2498,43 +2498,8 @@
ner,
- zone=zone, zone_letter=zoneLetter,
des
|
4fb6112552ab7969bddca7193dd51910be51d8b2 | Update ipc_lista1.7.py | lista1/ipc_lista1.7.py | lista1/ipc_lista1.7.py | #ipc_lista1.7
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça um programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o #usuário.
altura = input("Digite a altura do quadrado em metros: ")
largura = input("Digite a largura do em
| Python | 0 | @@ -268,11 +268,20 @@
gura do
+quadrado
em%0A
|
f7d8d58393cf2e9fa69dfde58e5da18758408105 | move order_with_respect_to to correct location (Meta class of models) | api/api/models.py | api/api/models.py | # REST API Backend for the Radiocontrol Project
#
# Copyright (C) 2017 Stefan Derkits <stefan@derkits.at>
#
# 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... | Python | 0 | @@ -1557,47 +1557,8 @@
ADE)
-%0A order_with_respect_to = 'playlist'
%0A%0A
@@ -1576,39 +1576,51 @@
a:%0A order
-ing
+_with_respect_to
=
-(
'playlist', 'ord
@@ -1613,26 +1613,16 @@
laylist'
-, 'order')
%0A%0A%0A# dis
@@ -2736,53 +2736,8 @@
ADE)
-%0A order_with_respect_to = 'schedule_entry'
%0A%... |
360ef0dec991d4486ec51f23ffb065d0225347fa | Update ipc_lista1.8.py | lista1/ipc_lista1.8.py | lista1/ipc_lista1.8.py | #ipc_lista1.8
#Professor:
| Python | 0 | @@ -19,9 +19,16 @@
fessor:
+Jucimar
%0A
|
e43e488df34e3b0485aeb91b672695949a47533d | fix path to subscription with id | moira_client/models/subscription.py | moira_client/models/subscription.py | from ..client import InvalidJSONError
from ..client import ResponseStructureError
from .base import Base
DAYS_OF_WEEK = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
MINUTES_IN_HOUR = 60
class Subscription(Base):
def __init__(self, client, contacts=None, tags=None, enabled=None, throttling=None, sched=None,... | Python | 0 | @@ -2865,32 +2865,162 @@
lf._end_minute%0A%0A
+ if subscription_id:%0A result = self._client.put('subscription/' + subscription_id, json=data)%0A else:%0A
result =
|
93a91ac118ab4e7280562bd0cfac0ea964ae0a7e | remove auth_check import | plstackapi/core/api/sites.py | plstackapi/core/api/sites.py | from types import StringTypes
from django.contrib.auth import authenticate
from plstackapi.openstack.manager import OpenStackManager
from plstackapi.core.api.auth import auth_check
from plstackapi.core.models import Site
def _get_sites(filter):
if isinstance(filter, StringTypes) and filter.isdigit():
... | Python | 0.000002 | @@ -134,56 +134,8 @@
%0A
-from plstackapi.core.api.auth import auth_check%0A
from
|
273aeda221aa12aac7fe1eea51e0aed859cd9098 | move fixme to right pos | sim.py | sim.py | import logging
from cardroom import Game, Table, Player, Stock, Waste, Card
log = logging.getLogger(__name__)
def play_game(players=3, cardsPerPlayer=5):
game = start_new_game(players, cardsPerPlayer)
while not game.over:
game.next_turn()
play_turn(game.player, game.table)
return game
... | Python | 0 | @@ -440,19 +440,21 @@
s()%0A
-mak
+ensur
e_sure_w
@@ -1355,11 +1355,13 @@
def
-mak
+ensur
e_su
|
36ae43735ed899b0ecb7b5679e60e4b0b2496d80 | Move pdf under chromiumcontent | chromiumcontent/chromiumcontent.gyp | chromiumcontent/chromiumcontent.gyp | {
'targets': [
{
'target_name': 'chromiumcontent_all',
'type': 'none',
'dependencies': [
'chromiumcontent',
'<(DEPTH)/chrome/chrome.gyp:chromedriver',
],
'conditions': [
['OS=="linux"', {
'dependencies': [
'chromiumviews',
'<(... | Python | 0 | @@ -523,48 +523,8 @@
s',%0A
- '%3C(DEPTH)/pdf/pdf.gyp:pdf',%0A
@@ -1259,24 +1259,16 @@
shared',
-
%0A %5D
@@ -1309,32 +1309,180 @@
y.cc',%0A %5D,%0A
+ 'conditions': %5B%0A %5B'OS==%22win%22', %7B%0A 'dependencies': %5B%0A '%3C(DEPTH)/pdf/pdf.gyp:pdf... |
64c7cea7768902f98b58813fca867084acf469a6 | Rename some metrics | desktop/core/src/desktop/metrics.py | desktop/core/src/desktop/metrics.py | # Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | Python | 0.000106 | @@ -984,39 +984,32 @@
back(%0A name='
-python.
threads.total',%0A
@@ -1008,16 +1008,16 @@
total',%0A
+
call
@@ -1197,23 +1197,16 @@
name='
-python.
threads.
@@ -1522,39 +1522,32 @@
back(%0A name='
-python.
multiprocessing'
@@ -1545,16 +1545,32 @@
ocessing
+.processes.total
',%0A c
@@ -1793,23 +... |
2656e59215e0f94892a79e8f94cd90b8717fe8d6 | change list style | archivebox/cli/archivebox_add.py | archivebox/cli/archivebox_add.py | #!/usr/bin/env python3
__package__ = 'archivebox.cli'
__command__ = 'archivebox add'
import sys
import argparse
from typing import List, Optional, IO
from ..main import add
from ..util import docstring
from ..parsers import PARSERS
from ..config import OUTPUT_DIR, ONLY_NEW
from ..logging_util import SmartFormatter,... | Python | 0.000002 | @@ -2475,17 +2475,11 @@
uto%22
-%5D + list(
+, *
PARS
@@ -2488,17 +2488,18 @@
S.keys()
-)
+%5D,
%0A )%0A
|
07f9edc5764d3002fd3d4c1018a6ec43d5046dd0 | Fix unused import. | kinto2xml/tests/test_verifier.py | kinto2xml/tests/test_verifier.py | import json
import mock
import os
import sys
from six import StringIO
from kinto2xml.verifier import sort_lists_in_dict, main
def build_path(filename):
return os.path.join(os.path.dirname(__file__), 'fixtures', filename)
def test_sort_lists_in_dict_handles_recursion():
assert json.dumps(sort_lists_in_dict(... | Python | 0 | @@ -31,19 +31,8 @@
os%0A
-import sys%0A
from
|
aa7c58eb04599138bc97f93245c1acf3c5b81f85 | Revert of [devil] Use /data/local/tmp for the command line on eng + userdebug builds. (patchset #2 id:20001 of https://codereview.chromium.org/2275863002/ ) | devil/devil/android/flag_changer.py | devil/devil/android/flag_changer.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from devil.android import device_errors
class FlagChanger(object):
"""Changes the flags Chrome runs with.
Flags can be temporari... | Python | 0.000027 | @@ -810,78 +810,8 @@
stem
-,%0A # as do all devices on Nougat thanks to tighter SELinux controls
.%0A
@@ -882,10 +882,8 @@
if
-((
not
@@ -902,62 +902,8 @@
ot()
- or device.build_type in ('eng', 'userdebug'))%0A
and
@@ -933,33 +933,32 @@
in cmdline_file
-)
:%0A self._cm
|
51f4d40cf6750d35f10f37d939a2c30c5f26d300 | Update script to write results to the database. | backend/scripts/updatedf.py | backend/scripts/updatedf.py | #!/usr/bin/env python
#import hashlib
import os
def main():
for root, dirs, files in os.walk("/mcfs/data/materialscommons"):
for f in files:
print f
if __name__ == "__main__":
main()
| Python | 0 | @@ -16,17 +16,16 @@
python%0A%0A
-#
import h
@@ -45,133 +45,531 @@
os%0A
-%0Adef main():%0A for root, dirs, files in os.walk(%22/mcfs/data/materialscommons%22):%0A for f in files:%0A print f
+import rethinkdb as r%0A%0Adef main():%0A conn = r.connect('localhost', 28015, db='materialscommons'... |
45b9b2c838bcf9fd8f73d4b5f064e2d81bdf092a | Fix up the firefox aurora mobile parsing. | user_agents/parsers.py | user_agents/parsers.py | import sys
from collections import namedtuple
from ua_parser import user_agent_parser
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY3:
string_types = str
else:
string_types = basestring
MOBILE_DEVICE_FAMILIES = (
'iPhone',
'iPod',
'Generic Smartphone',
'Generic Feature... | Python | 0.000004 | @@ -3171,16 +3171,17 @@
if
+(
'Mobile
@@ -3201,32 +3201,93 @@
n self.ua_string
+ and%0A self.browser.family != %22Firefox Mobile%22)
:%0A re
@@ -6039,24 +6039,25 @@
Agent(user_agent_string)
+%0A
|
599672acbf925cab634bc15ab47055aabb131efd | Fix xkcd text regex. Closes #46 | dosagelib/plugins/x.py | dosagelib/plugins/x.py | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2013 Bastian Kleineidam
from re import compile
from ..scraper import _BasicScraper
from ..helpers import bounceStarter
from ..util import tagre
class xkcd(_BasicScraper):
url = 'http://xkcd.com/'
... | Python | 0.999991 | @@ -789,24 +789,66 @@
, r'(%5B%5E%22%5D+)'
+, before=r'http://imgs%5C.xkcd%5C.com/comics/'
))%0A adult
|
f0593b2d69730441b5a486e27ed6eb7001939bf4 | Include unlimited features for enterprise | corehq/apps/accounting/bootstrap/config/user_buckets_august_2018.py | corehq/apps/accounting/bootstrap/config/user_buckets_august_2018.py | from __future__ import absolute_import
from __future__ import unicode_literals
from decimal import Decimal
from corehq.apps.accounting.models import (
FeatureType,
SoftwarePlanEdition,
)
BOOTSTRAP_CONFIG = {
(SoftwarePlanEdition.COMMUNITY, False, False): {
'role': 'community_plan_v1',
'pro... | Python | 0 | @@ -187,16 +187,44 @@
dition,%0A
+ UNLIMITED_FEATURE_USAGE%0A
)%0A%0ABOOTS
@@ -1743,34 +1743,55 @@
t(monthly_limit=
-10
+UNLIMITED_FEATURE_USAGE
, per_excess_fee
@@ -1792,33 +1792,33 @@
ss_fee=Decimal('
-2
+0
.00')),%0A
@@ -1849,33 +1849,55 @@
t(monthly_limit=
-0
+UNLIMITED_FEATURE_USAGE
),%0A ... |
ab32f1bbe34847617a1ec5f227adaefb1497e62d | declare some constants | warped_alloy.py | warped_alloy.py | #!/usr/bin/env python
from __future__ import absolute_import, print_function
print("FIRST")
import __main__
import sys
import os
from socket import socketpair, AF_INET, AF_UNIX, SOCK_STREAM, fromfd
import attr
from twisted.python.usage import Options
from twisted.internet.task import react
from twisted.internet.... | Python | 0.000197 | @@ -671,16 +671,75 @@
t Data%0A%0A
+STDIN = 0%0ASTDOUT = 1%0ASTDERR = 2%0AMAGIC_FILE_DESCRIPTOR = 7%0A%0A
%0Adef sho
|
ceb53a36fd65eb64369ee423add73d6ced93b352 | Reset default class to original class after initializing the Astropy logger | astropy/config/logging_helper.py | astropy/config/logging_helper.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""This module defines a logging class based on the built-in logging module"""
from __future__ import print_function
import os
import sys
import inspect
import logging
import warnings
from contextlib import contextmanager
from . import ConfigurationItem... | Python | 0 | @@ -7734,16 +7734,82 @@
he class
+ and initialize logger%0A_orig_logger_cls = logging.getLoggerClass()
%0Alogging
@@ -7843,29 +7843,17 @@
er)%0A
-%0A# Initialize logger%0A
+try:%0A
log
@@ -7883,16 +7883,20 @@
tropy')%0A
+
log.set_
@@ -7902,12 +7902,91 @@
_defaults()%0A
+finally:%0A logging.setLoggerC... |
205f3fb2f36f33c6d13b4541ad49522b799d358d | simplify the call to make file list | src/actions/server.py | src/actions/server.py | import sys
from twisted.python import log
from twisted.web.server import Site
from twisted.web.static import File
from twisted.internet import task
from twisted.internet.protocol import DatagramProtocol
from . import utils
class Broadcaster(DatagramProtocol):
"""
Broadcast the ip to all of the listeners on ... | Python | 0.000129 | @@ -1274,131 +1274,18 @@
ist(
-utils.list_files(serve_dir), %0A utils.list_dirs(serve_dir),%0A serve_dir)%0A
+serve_dir)
%0A
|
923d49c753acf7d8945d6b79efbdb08363e130a2 | Bring test_frame_of_test_null_file up to date with new signature of frame_of_test(). | noseprogressive/tests/test_utils.py | noseprogressive/tests/test_utils.py | from os import chdir, getcwd
from os.path import dirname, basename
from unittest import TestCase
from nose.tools import eq_
from noseprogressive.utils import human_path, frame_of_test
class UtilsTests(TestCase):
"""Tests for independent little bits and pieces"""
def test_human_path(self):
chdir(dir... | Python | 0 | @@ -574,16 +574,86 @@
, None),
+ NotImplementedError,%0A NotImplementedError(),
%5B('file
|
0658a099a386791b3bde27f8e76c240253310890 | Update pplot.py | src/analysis/pplot.py | src/analysis/pplot.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
'''Result analysis for automatic speech recognition
@Date:2016-4-9
@Author:zhang zewang
'''
import os
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
class Analysis(object):
'''
class Analysis for ASR results
'''
def __init__(self,logFile,sa... | Python | 0.000002 | @@ -1,24 +1,5 @@
#
-!/usr/bin/python%0A#
-*-
@@ -19,100 +19,946 @@
-*-%0A
-'''Result analysis for automatic speech recognition%0A@Date:2016-4-9%0A@Author:zhang zewang
+#!/usr/bin/python%0A%0A''' This file is designed to plot the cost curve, maybe deprecated.%0Aauthor:%0A%0A iiiiiiiiiiii iiiiiiiiiii... |
ac5053ada316e46d4286b1944c2fb957c42c3975 | truncate superfluous trailing zeros | durationpy/duration.py | durationpy/duration.py | # -*- coding: UTF-8 -*-
import re
import datetime
_nanosecond_size = 1
_microsecond_size = 1000 * _nanosecond_size
_millisecond_size = 1000 * _microsecond_size
_second_size = 1000 * _millisecond_size
_minute_size = 60 * _second_size
_hour_size = 60 * _minute_size
_day_size = 24 * _hour... | Python | 0.004364 | @@ -2251,16 +2251,18 @@
tr += %22%7B
+:g
%7Dms%22.for
@@ -2437,16 +2437,18 @@
tr += %22%7B
+:g
%7Dus%22.for
@@ -2510,16 +2510,18 @@
tr += %22%7B
+:g
%7Dns%22.for
@@ -2738,16 +2738,18 @@
tr += %22%7B
+:g
%7Dh%22.form
@@ -2891,16 +2891,18 @@
tr += %22%7B
+:g
%7Dm%22.form
@@ -3055,16 +3055,18 @@
tr += %22%7B
+:... |
d9800c562b81f4e118e9db96a68e301396af46f9 | Add abstract job serializer | polyaxon/jobs/serializers.py | polyaxon/jobs/serializers.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from rest_framework import serializers
from jobs.models import JobResources
class JobResourcesSerializer(serializers.ModelSerializer):
class Meta:
model = JobResources
exclude = ('id',)
| Python | 0.003237 | @@ -121,16 +121,24 @@
ializers
+, fields
%0A%0Afrom j
@@ -301,8 +301,1678 @@
('id',)%0A
+%0A%0Aclass JobSerializer(serializers.ModelSerializer):%0A cpu = fields.DictField(allow_null=True)%0A memory = fields.DictField(allow_null=True)%0A gpu = fields.DictField(allow_null=True)%0A resources = JobResourcesS... |
77c4b5a72ddad68717b6fb1291ce643f20a63e2d | Update SeleniumBase exceptions | seleniumbase/common/exceptions.py | seleniumbase/common/exceptions.py | """ SeleniumBase Exceptions
NoSuchFileException => Used by self.assert_downloaded_file(...)
NotUsingChromeException => Used by Chrome-only methods if not using Chrome
OutOfScopeException => Used by BaseCase methods when setUp() is skipped
TimeLimitExceededException => Used by "--time-limit=SECONDS"
"""
... | Python | 0 | @@ -48,23 +48,27 @@
tion =%3E
-Used by
+Called when
self.as
@@ -92,16 +92,23 @@
ile(...)
+ fails.
%0A Not
@@ -178,16 +178,17 @@
g Chrome
+.
%0A Out
@@ -255,16 +255,91 @@
skipped
+.%0A TextNotVisibleException =%3E Called when expected text fails to appear.
%0A Tim
@@ -365,23 +365,37 @@
tion =%3E ... |
e6af9d901f26fdf779a6a13319face483fe48a3b | Disable clickjacking protection on demos to display them in iframes | dwitter/dweet/views.py | dwitter/dweet/views.py | from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from dwitter.models import Dweet
def fullscreen_dweet(request, dweet_id):
dweet = get_obje... | Python | 0 | @@ -253,16 +253,111 @@
t Dweet%0A
+from django.views.decorators.clickjacking import xframe_options_exempt%0A%0A%0A@xframe_options_exempt
%0Adef ful
|
2e72be703998b2d0d9fdc06bfffddccec8fb11e3 | use rps balancing | scripts/cycler.py | scripts/cycler.py | #!/usr/bin/python
from itertools import cycle
import subprocess
import time
targetsize = 16
def start():
# subprocess.call("sudo gcloud components update --quiet", shell=True)
# For completeness this should also create the backend, HTTP load balancer, template, and network
# Get the available zones
zones = s... | Python | 0 | @@ -1380,16 +1380,285 @@
l=True)%0A
+ # Configure load balancing policy%0A subprocess.call(%22gcloud compute backend-services update-backend %7B%7D --quiet --instance-group=%7B%7D --instance-group-zone=%7B%7D --balancing-mode=RATE --max-rate-per-instance=1%22.format(backendname, instancegroupname, zone), shell=T... |
6cf4d5b76f40d6e596d8784d35231f5086fbb78a | Change hyperparams: l1_reg & l2_reg: log[-5, -2] -> log[-5, 5] | keras_image_captioning/config.py | keras_image_captioning/config.py | import yaml
import sys
from collections import namedtuple
from datetime import timedelta
from random import choice, randint, uniform
from .common_utils import parse_timedelta
_REDUCE_LR_PATIENCE = 2
_EARLY_STOPPING_PATIENCE = 4
Config = namedtuple('Config', '''
dataset_name
epochs
time_limit
batch_... | Python | 0.000015 | @@ -2644,18 +2644,17 @@
orm(-5,
--2
+5
)%0A _L
@@ -2691,10 +2691,9 @@
-5,
--2
+5
)%0A%0A
|
4d5a15a4a087ea8bcf458243da947f5e0934013b | Fix html not loading the initial value (#569) | src/blocks/widgets.py | src/blocks/widgets.py | from django import forms
from wagtail.utils.widgets import WidgetWithScript
class CodeMirrorWidget(WidgetWithScript, forms.Textarea):
def render_js_init(self, id, name, value):
js = """
CodeMirror.fromTextArea(
document.getElementById("{id}"),
{{
lineWrapping: true,
... | Python | 0 | @@ -190,24 +190,95 @@
js = %22%22%22%0A
+ document.addEventListener('DOMContentLoaded', function()%7B%7B%0A
Code
@@ -298,32 +298,40 @@
xtArea(%0A
+
+
document.getElem
@@ -355,27 +355,38 @@
-%7B%7B%0A
+ %7B%7B%0A
lineWrap
@@ -377,16 +377,21 @@
... |
fdef6455ee7b0ab088fc54ea8a96c481ea2ea462 | add mean quality | sequana/fastqc.py | sequana/fastqc.py |
import zipfile
import re
from sequana.lazy import pylab
from sequana.lazy import pandas as pd
class FastQC():
"""A temporary class to manipulate fastqc statistics"""
def __init__(self):
self.fastqc_data = {}
def read_sample(self, filename, s_name):
"""reads the fastqc stats
:p... | Python | 0.000984 | @@ -1815,122 +1815,8 @@
se:%0A
- # Special case: Rename dedup header in old versions of%0A # FastQC (v10)%0A
@@ -2089,17 +2089,16 @@
list()%0A
-%0A
@@ -3074,16 +3074,498 @@
ics'%5D%7D%0A%0A
+ # TC: may 2020 Here we add the mean quality, which surprisi... |
84c07019572d8945bd2d4c7473c2b86c314107d0 | Attempt to return better json | zpr.py | zpr.py | #!/var/lib/zpr/api/bin/python
import json
import lib_zpr
#import logging
#from logging.handlers import RotatingFileHandler
from flask import Flask, jsonify, make_response
app = Flask(__name__)
# app.logger.setLevel(logging.INFO)
# app.logger.disabled = False
# handler = logging.handlers.RotatingFileHandler(
# '... | Python | 0.999868 | @@ -1357,90 +1357,66 @@
-for i in %5Blib_zpr.check_tsp_job_out%5B0%5D%5D:%0A json.dumps(i)%0A json.dumps(
+job_checked = %5B%0A %7B%0A 'name': backup_host,
%0A
@@ -1423,16 +1423,28 @@
+ 'response':
lib_zpr
@@ -1454,20 +1454,47 @@
eck_
-job_
+tsp_job_out%5B0%5D,%0A ... |
938d255db088ff721e69659db1afdd5cfa109c3f | Save temp as C and F | webapp/app/views/api/v1/points.py | webapp/app/views/api/v1/points.py | import time
from flask import request, abort
from app.views.api.v1 import APIView_v1
class PointsParser(object):
def __init__(self, data):
self.points = []
self.interval = None
self.state = 'root'
lines = map(lambda l: l.split(), filter(None, map(str.strip, data.split('\n'))))
... | Python | 0.000001 | @@ -2070,32 +2070,270 @@
e_args(1, args)%0A
+ if keyword == 'TEMPERATURE':%0A self.points%5B-1%5D%5B-1%5D%5B'temperature_c'%5D = self.parse_float(args%5B0%5D)%0A self.points%5B-1%5D%5B-1%5D%5B'temperature_f'%5D = (self.parse_float(args%5B0%5D) * 1.8) + 32%0A else:%0A... |
c6f0f02eeacca2b93bc8c32bc54c103336fb12b0 | add the 6th | base100/base100/base_100.py | base100/base100/base_100.py | # 练习题来自于菜鸟教程
# http://www.runoob.com/python/python-exercise-example1.html
#################################################################################
# 1. 有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?
# 思路:使用yield将函数作为生成器
d = [1,2,3,4]
def assemblyNum(num,targetD,length):
temp = num
for i in range(len(tar... | Python | 0.999999 | @@ -2146,16 +2146,17 @@
t%E7%9A%84sort%0A%0A
+#
lstr = i
@@ -2162,16 +2162,32 @@
input()%0A
+lstr = '1,3,5,2'
%0Al = lst
@@ -2218,8 +2218,181 @@
rint(l)%0A
+%0A# 6. %E9%A2%98%E7%9B%AE%EF%BC%9A%E6%96%90%E6%B3%A2%E9%82%A3%E5%A5%91%E6%95%B0%E5%88%97%0A%0Adef fib(max):%0A%0A n,a,b = 0,0,1%0A while n%3Cmax:%0A ... |
a9bf968facd2a89017ef258e5afead093d1054f7 | add method execute | CURD.py | CURD.py | # coding=utf8
# Permission to use, copy, modify,
# and distribute this software for any purpose with
# or without fee is hereby granted,
# provided that the above copyright notice
# and this permission notice appear in all copies.
#
"""
CURD.py
~~~~~~~
Tiny Python ORM for MySQL
:Author: Hit9
:Emai... | Python | 0.000005 | @@ -2435,8 +2435,265 @@
ls.conn%0A
+%0A @classmethod%0A def execute(cls, sql):%0A %22%22%22%0A Execute one sql%0A%0A parameters%0A sql%0A string, sql command to run%0A %22%22%22%0A cursor = cls.get_conn().cursor()%0A cursor.execute(sql)%0A retu... |
793ec2b19d63b70717a84293b45e583f6c0b9dd5 | Enable JIT on LAS Model | fairseq/modules/linearized_convolution.py | fairseq/modules/linearized_convolution.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.incremental_decoding_utils import with_incremental_state
... | Python | 0 | @@ -1585,16 +1585,38 @@
ight%22%5D%0A%0A
+ @torch.jit.ignore%0A
def
|
452899e183c6a8dcb2e7eb10a34a9a560e99145f | test problems | basic_cms/tests/test_api.py | basic_cms/tests/test_api.py | """Django page CMS functionnal tests suite module."""
from basic_cms.models import Page
from basic_cms.tests.testcase import TestCase
import json
from django.template.loader import render_to_string
from django.core.urlresolvers import reverse
class CMSPagesApiTests(TestCase):
fixtures = ['pages_tests.json', 'ap... | Python | 0.000011 | @@ -2709,32 +2709,44 @@
%22%22%22%0A
+%3Chtml%3E%3Cbody%3E
%3Ca href=%22http://
@@ -2964,32 +2964,46 @@
//a.com/a.jpg%22/%3E
+%3C/body%3E%3C/html%3E
%0A %22%22%22%0A
@@ -3003,72 +3003,8 @@
%22%22%22%0A
- print links_append_domain(body, 'http://a.com').strip()%0A
@@ -3018,18 +3018... |
921c02c614ca4831539088745c50cf215d268447 | Use smtp_uchicago_send.delay | uchicagohvz/users/mailing_list.py | uchicagohvz/users/mailing_list.py | # Mailing list configuration
from django.template.loader import render_to_string
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from uchicagohvz import secrets
from .tasks import smtp_uchicago_send
from .models import Profile
from rest_framework.response imp... | Python | 0.000336 | @@ -3354,16 +3354,22 @@
ago_send
+.delay
(listhos
|
05915c540aace84a6cb5cf43a9264a983862e358 | set fully reflected if the server indicates it had all of the stream | lbrynet/stream/managed_stream.py | lbrynet/stream/managed_stream.py | import os
import asyncio
import typing
import logging
from lbrynet.extras.daemon.mime_types import guess_media_type
from lbrynet.stream.downloader import StreamDownloader
from lbrynet.stream.descriptor import StreamDescriptor
from lbrynet.stream.reflector.client import StreamReflectorClient
if typing.TYPE_CHECKING:
... | Python | 0 | @@ -6990,32 +6990,176 @@
d(self.sd_hash)%0A
+ if not sent_sd and not needed:%0A if not self.fully_reflected.is_set():%0A self.fully_reflected.set()%0A
except (
|
ec5db06452e56c1f4ef62b1175f225371864ae75 | Remove left-over print statements | celery/events/state.py | celery/events/state.py | import time
import heapq
from carrot.utils import partition
from celery import states
from celery.datastructures import AttributeDict, LocalCache
from celery.utils import kwdict
HEARTBEAT_EXPIRE = 150 # 2 minutes, 30 seconds
class Element(AttributeDict):
"""Base class for types."""
visited = False
def... | Python | 0.000054 | @@ -2475,37 +2475,8 @@
s):%0A
- print(%22ON RECEIVED%22)%0A
@@ -2541,30 +2541,8 @@
ED%22%0A
- print(fields)%0A
|
783a9a138c1548e06c0386cad468bc383f9011a2 | remove debug message in inmoredetail code. whoopsie. | lfluxproject/mdx_inmoredetail.py | lfluxproject/mdx_inmoredetail.py | from markdown import Extension
from markdown.inlinepatterns import Pattern
from markdown.treeprocessors import Treeprocessor
from markdown import util
IMD_RE = r'<imd (.+)>'
class InmoredetailPattern(Pattern):
""" deprecated <imd ....> syntax """
def handleMatch(self, m):
el = util.etree.Element("span... | Python | 0 | @@ -2479,56 +2479,8 @@
+1%5D%0A
- print 'mark', x.tag, x.text, x.tail%0A
|
ec7e00eb3d03a3177800eb4ac3fb4fdc7132af0e | Add error handling to popen | kbdgen/gen/base.py | kbdgen/gen/base.py | import itertools
import logging
import os
import os.path
import random
import re
import subprocess
import sys
from functools import lru_cache
from collections import OrderedDict
from ..base import ISO_KEYS, KbdgenException
logger = logging.getLogger()
class MissingApplicationException(KbdgenException): pass
class G... | Python | 0 | @@ -5357,24 +5357,37 @@
put=False):%0A
+ try:%0A
process
@@ -5453,16 +5453,20 @@
e None,%0A
+
@@ -5538,16 +5538,20 @@
+
stdout=N
@@ -5590,16 +5590,170 @@
ss.PIPE)
+%0A except Exception as e:%0A logger.error(%22Process failed to launch with the following error messa... |
3af46d10382eb18dac4c639f6b6ca60180a7d487 | Fix properties names | server/process.py | server/process.py | import datetime
import gzip
import urllib.request
import zlib
import mercantile
import simplejson as json
from jsonslicer import JsonSlicer
from . import API, Z_TARGET, db
from .utils import get_updated_metadata
def generate_raw(bbox, start, end, *filters, **headers):
bbox = mercantile.Bbox(*bbox)
for tile ... | Python | 0.000005 | @@ -4900,18 +4900,19 @@
%22creat
-ed
+ion
%22: featu
@@ -4975,23 +4975,25 @@
%22
-ver
+revi
sion
+s
%22: featu
@@ -5016,22 +5016,16 @@
%22
-update
frequenc
|
b5378b0da9378813f9c2fa1fe9ff48671868eefd | Add provider_name to serialized account representation | website/addons/base/serializer.py | website/addons/base/serializer.py | import abc
from framework.auth.decorators import collect_auth
from website.util import api_url_for, web_url_for
class AddonSerializer(object):
__metaclass__ = abc.ABCMeta
# TODO take addon_node_settings, addon_user_settings
def __init__(self, node_settings=None, user_settings=None):
self.node_se... | Python | 0.000001 | @@ -2109,24 +2109,80 @@
rovider_id,%0A
+ 'provider_name': external_account.provider,%0A
@@ -2510,16 +2510,17 @@
%5D
+,
%0A
|
c358f467bbab9bd0366347f9a1bd10cb2e027bb8 | use moksha widget template | fedoracommunity/mokshaapps/packagemaintresource/controllers/root.py | fedoracommunity/mokshaapps/packagemaintresource/controllers/root.py | from moksha.lib.base import Controller
from moksha.lib.helpers import MokshaApp
from tg import expose, tmpl_context
from fedoracommunity.widgets import SubTabbedContainer
class TabbedNav(SubTabbedContainer):
tabs= (MokshaApp('Overview', 'fedoracommunity.packagemaint.overview'),
MokshaApp('Builds', 'fedo... | Python | 0 | @@ -702,55 +702,14 @@
ako:
-fedoracommunity.mokshaapps.packagemaintresource
+moksha
.tem
@@ -715,21 +715,22 @@
mplates.
-index
+widget
')%0A d
@@ -803,10 +803,22 @@
return %7B
+'options':%7B%7D
%7D%0A
|
367b28277b03473e6453ad9aa26c734136db4105 | use compound dimensions | ktbh/modelling.py | ktbh/modelling.py |
import json
class AutoModellingException(Exception): pass
def make_model(amount_field, date_field, fields):
currency = "GBP"
dataset_name = "new-dataset"
description = "Dataset description"
label = "Dataset label"
dataset = {
"description": description,
"temporal_granularity": "d... | Python | 0.000001 | @@ -908,16 +908,580 @@
%7D)%0A%0A
+ def compound_dimension(name, column_id):%0A return (name, %0A %7B%0A %22attributes%22: %7B%0A %22name%22: %7B%0A %22datatype%22: %22id%22,%0A %22column%22: column_id%0A ... |
5b6aa3f6cca7ea83a53178be7b9e58892597ac0b | Add some logging to Auth | opwen_email_server/services/auth.py | opwen_email_server/services/auth.py | from abc import ABCMeta
from abc import abstractmethod
from functools import lru_cache
from typing import Callable
from typing import Optional
from azure.storage.table import TableService
class Auth(metaclass=ABCMeta):
@abstractmethod
def domain_for(self, client_id: str) -> Optional[str]:
raise NotIm... | Python | 0.000001 | @@ -183,16 +183,67 @@
ervice%0A%0A
+from opwen_email_server.utils.log import LogMixin%0A%0A
%0Aclass A
@@ -421,16 +421,26 @@
uth(Auth
+, LogMixin
):%0A d
@@ -1298,16 +1298,95 @@
%7D)
+%0A self.log_debug('Registered client %25s at domain %25s', client_id, domain)
%0A%0A de
@@ -1880,21 +1880,162 ... |
ac514a320b2bca52eb580936cad928f5be69200f | print drivers labware_client | labware_client.py | labware_client.py | #!/usr/bin/env python3
import asyncio
import time
import json
import uuid
import datetime
import sys
from labware_subscriber import Subscriber
from labware_publisher import Publisher
from labware_harness import Harness
from labware_driver import LabwareDriver
from autobahn.asyncio import wamp, websocket
from autoba... | Python | 0 | @@ -4044,16 +4044,19 @@
sher.id,
+'',
None,Non
|
4b2a29c484ddd5e2dfb4ad91bb0ae5c7681553c1 | Bump version to 0.1.5 | lacrm/_version.py | lacrm/_version.py | __version_info__ = (0, 1, 4)
__version__ = '.'.join(map(str, __version_info__))
| Python | 0.000001 | @@ -23,9 +23,9 @@
1,
-4
+5
)%0A__
|
0cdac10ee51cc3e812ae9188606301e6be0644ee | Fix default url bug | web/project/main/urls.py | web/project/main/urls.py | from django.conf.urls import url, include
from rest_framework.authtoken import views as authviews
from rest_framework_jwt import views as jwt_views
from . import views
urlpatterns = [
url(r'', views.index, name='index'),
url(r'^home/', views.index, name='index'),
# Authentication APIs
url(r'^api/auth',... | Python | 0.000003 | @@ -182,49 +182,8 @@
= %5B%0A
- url(r'', views.index, name='index'),%0A
@@ -1669,10 +1669,69 @@
tion%22),%0A
+ # Default URL%0A url(r'', views.index, name='index'),%0A
%5D%0A
|
9f7837f572017a4a8176c4e74b0aaba0625905ed | Add support for custom import apps | parachute/management/commands/import_from.py | parachute/management/commands/import_from.py | import logging
from optparse import make_option
from django.db.models.loading import load_app
from django.core.management.base import LabelCommand
class Command(LabelCommand):
import_app = 'importer'
option_list = LabelCommand.option_list + (
make_option('--importer',
dest='force_update'... | Python | 0 | @@ -190,24 +190,25 @@
_app = '
-impor
+parachu
te
-r
'%0A%0A o
@@ -253,150 +253,8 @@
+ (%0A
- make_option('--importer',%0A dest='force_update',%0A help='Specify you own importer app to be used by parachute.'),%0A
@@ -1462,16 +1462,45 @@
tions):%0A
+ platform_app = None%... |
4f691840d917e7981a047d967cfcdc17c9551be9 | Update packaged_config_0_pyquickhelper.py | src/pymyinstall/packaged/packaged_config_0_pyquickhelper.py | src/pymyinstall/packaged/packaged_config_0_pyquickhelper.py | # -*- coding: utf-8 -*-
"""
@file
@brief Defines different a set of usual modules for Python.
"""
import sys
def pyquickhelper_set():
"""
list of modules needed to run unit test of module *pyquickhelper*
"""
names = [
"alabaster",
"asn1crypto",
"astroid",
"attrs",
... | Python | 0.000004 | @@ -2152,29 +2152,8 @@
t%22,%0A
- %22nbpresent%22,%0A
|
27a39812088b9312314b44a013483b49a77d8dfb | update set of modules to install for pyquickhelper | src/pymyinstall/packaged/packaged_config_0_pyquickhelper.py | src/pymyinstall/packaged/packaged_config_0_pyquickhelper.py | #-*- coding: utf-8 -*-
"""
@file
@brief Defines different a set of usual modules for Python.
"""
import sys
def pyquickhelper_set():
"""
list of modules needed to run unit test of module *pyquickhelper*
"""
names = [
"alabaster",
"autopep8",
"babel",
"certifi",
... | Python | 0 | @@ -1659,24 +1659,48 @@
pycparser%22,%0A
+ %22pycryptodome%22,%0A
%22pyf
|
ba73e1e06dae26716da29a02c1705458d402a9be | update PRISM model to take CDDs into account for electricity | eemeter/meter/prism.py | eemeter/meter/prism.py | from eemeter.meter.base import MeterBase
from eemeter.config.yaml_parser import load
class PRISMMeter(MeterBase):
"""Implementation of Princeton Scorekeeping Method.
"""
def __init__(self,**kwargs):
super(self.__class__, self).__init__(**kwargs)
self.meter = load(self._meter_yaml())
d... | Python | 0 | @@ -1166,32 +1166,35 @@
meter.models.HDD
+CDD
BalancePointMode
@@ -1250,32 +1250,38 @@
x0: %5B
-60
+1.
,1.,1.
+,60.,5
%5D,%0A
@@ -1313,37 +1313,37 @@
bounds: %5B%5B
-55,65
+0,100
%5D,%5B0,100%5D,%5B0,100
@@ -1335,32 +1335,47 @@
,%5B0,100%5D,%5B0,100%5D
+,%5B55,65%5D,%5B2,10%5D
%5D,%0A ... |
373a6f56a19c131debfb47f7d610280a586661f7 | Use importlib instead of imp. | services/utils.py | services/utils.py | from datetime import datetime, timedelta
import dictconfig
import logging
import os
# get the right settings module
import imp
settingmodule = os.environ.get('DJANGO_SETTINGS_MODULE', 'settings_local')
if settingmodule.startswith(('zamboni', # typical git clone destination
'workspace', # Jenki... | Python | 0.000001 | @@ -114,19 +114,8 @@
ule%0A
-import imp%0A
sett
@@ -444,93 +444,8 @@
1%5D%0A%0A
-res = imp.find_module(settingmodule)%0Asettings = imp.load_module(settingmodule, *res)%0A
%0Aimp
@@ -644,16 +644,102 @@
re.log%0A%0A
+from django.utils import importlib%0Asettings = importlib.import_module(settingmodule)%0A%0A
# Pyfl... |
9e0c83e751e72e3396a4729392b972834b25c8b7 | Add TODO | v2/aws_secgroup_ids_from_names.py | v2/aws_secgroup_ids_from_names.py | # (c) 2015, Jon Hadfield <jon@lessknown.co.uk>
"""
Description: This lookup takes an AWS region and a list of one or more
security Group Names and returns a list of matching security Group IDs.
Example Usage:
{{ lookup('aws_secgroup_ids_from_names', ('eu-west-1', ['nginx_group', 'mysql_group'])) }}
"""
from __future_... | Python | 0.000002 | @@ -932,16 +932,79 @@
region)%0A
+ #TODO: Use OR filter rather than making multiple calls%0A
|
0c731bf993eea346421d9dbcd5eaa61484e84018 | fix bug in site_hrn() | sfa/util/plxrn.py | sfa/util/plxrn.py | # specialized Xrn class for PlanetLab
import re
from sfa.util.xrn import Xrn
# temporary helper functions to use this module instead of namespace
def hostname_to_hrn (auth, login_base, hostname):
return PlXrn(auth=auth+'.'+login_base,hostname=hostname).get_hrn()
def hostname_to_urn(auth, login_base, hostname):
... | Python | 0 | @@ -933,16 +933,17 @@
.'.join(
+%5B
auth,log
@@ -945,24 +945,25 @@
h,login_base
+%5D
)%0A%0A def _
|
1337c5269d97dc6f1cd47aed838cf26c6b488be2 | bump version | shell/__init__.py | shell/__init__.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__title__ = 'shell'
__version__ = '0.0.6'
__author__ = 'Qingping Hou'
__license__ = 'MIT'
from .run_cmd import RunCmd
from .input_stream import InputStream
from .api import instream, cmd, pipe_all, ex, p, ex_all
| Python | 0 | @@ -82,9 +82,9 @@
0.0.
-6
+7
'%0A__
|
5873bb323d21ab8f9373518a5dd9688df4b38a9a | Break line before 80 columns. | shell/src/main.py | shell/src/main.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2014, MIT Probabilistic Computing Project
#
# 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/LICENS... | Python | 0.000001 | @@ -3051,16 +3051,17 @@
a file.
+
Abortin
@@ -3067,16 +3067,40 @@
ng.%5Cn' %25
+%0A
str(pat
|
adc5302c070cdcef1bcbf47f23348aa82c9c6670 | Make aria2 respect --test mode again. | flexget/plugins/clients/aria2.py | flexget/plugins/clients/aria2.py | from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
import os
import xmlrpc.client
from socket import error as socket_error
from flexget import plugin
from flexget.event import event
log = logging.getLogger('ari... | Python | 0 | @@ -3046,16 +3046,148 @@
cepted:%0A
+ if task.options.test:%0A log.verbose('Would add %60%25s%60 to aria2.' %25 entry%5B'title'%5D)%0A continue%0A
|
3ccd648ba58fd7e6a84b94e464094d0c5e3a8e55 | Add line to separate results | states/bootstrap/bootstrap.dir/modules/utils/salt_output.py | states/bootstrap/bootstrap.dir/modules/utils/salt_output.py | #!/usr/bin/env python
#
import sys
import yaml
import logging
###############################################################################
def load_yaml_file_data(file_path):
"""
Load YAML formated data from file_path.
"""
# Instead of using `with` keyword, perform standard `try`/`finally`
... | Python | 0 | @@ -1103,24 +1103,106 @@
lt.keys():%0A%0A
+ # Separate visually one result from another.%0A logging.info(%22---%22)%0A%0A
tota
|
b65191a52e0bea63aeda3bcc4e28cb715295efa5 | Add some additional test for value references. | tensorflow_federated/python/program/value_reference_test.py | tensorflow_federated/python/program/value_reference_test.py | # Copyright 2021, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Python | 0 | @@ -708,16 +708,28 @@
ow as tf
+%0Aimport tree
%0A%0Afrom t
@@ -3346,16 +3346,1197 @@
value)%0A%0A
+ def test_returns_value_datasets(self):%0A value = tf.data.Dataset.from_tensor_slices(%5B1, 2, 3%5D)%0A%0A actual_value = value_reference.materialize_value(value)%0A%0A expected_value = tf.data.Dataset.from_... |
21ab430368ee262377c77f1ecc24b645377dd520 | Revert "Bug Fix: sort keys when creating json data to send" | generic_request_signer/client.py | generic_request_signer/client.py | import six
from datetime import date
import json
import decimal
from apysigner import DefaultJSONEncoder
if six.PY3:
import urllib.request as urllib
else:
import urllib2 as urllib
from generic_request_signer import response, factory
def json_encoder(obj):
if isinstance(obj, date):
return str(ob... | Python | 0 | @@ -62,50 +62,8 @@
al%0A%0A
-from apysigner import DefaultJSONEncoder%0A%0A
if s
@@ -916,42 +916,20 @@
ult=
-DefaultJSONEncoder, sort_keys=True
+json_encoder
)%0A
|
67dfbfa250cd5de550a493c9951d456e05b05454 | Make ModelImporter.model static for flexibility of usage | girder/utility/model_importer.py | girder/utility/model_importer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a cop... | Python | 0 | @@ -1948,24 +1948,42 @@
ss.%0A %22%22%22%0A
+ @staticmethod%0A
def mode
@@ -1988,14 +1988,8 @@
del(
-self,
mode
|
b28ca4abf8a6986b96bfb89cf8737c8f737fee4e | update boto import to use boto3 (#1000) | global_settings/wagtail_hooks.py | global_settings/wagtail_hooks.py | import boto
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
from wagtail.admin.rich_text.converters.html_to_contentstate import InlineStyleElementHandler
from wagtail.core import hooks
from django.urls import reverse
from wagtail.admin.menu import MenuItem
from .models import CloudfrontDi... | Python | 0 | @@ -4,16 +4,17 @@
ort boto
+3
%0Aimport
|
c437074ee3ee15fc29790ca4de5413bbdd19728c | delete unused imports | autograd/convenience_wrappers.py | autograd/convenience_wrappers.py | """Convenience functions built on top of `grad`."""
from __future__ import absolute_import
import itertools as it
import autograd.numpy as np
from autograd.core import grad, getval
from builtins import map
def multigrad(fun, argnums=0):
"""Takes gradients wrt multiple arguments simultaneously."""
original_fu... | Python | 0.000001 | @@ -87,31 +87,8 @@
port
-%0Aimport itertools as it
%0A%0Aim
@@ -156,33 +156,8 @@
val%0A
-from builtins import map%0A
%0A%0Ade
|
550133348a09b197025bc1352439cb055bf50c7b | Make sure mocks in place for setUp command. | autopush/tests/test_websocket.py | autopush/tests/test_websocket.py | import json
import twisted.internet.base
from mock import Mock
from moto import mock_dynamodb2
from txstatsd.metrics.metrics import Metrics
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.trial import unittest
from autopush.settings import AutopushSettings
from autopush.w... | Python | 0 | @@ -400,16 +400,36 @@
tCase):%0A
+ @mock_dynamodb2%0A
def
|
009ab26737923cfff97ba37a035dcff7639135b1 | Replace all_pages_in_directory with concat_pdf_pages | Util.py | Util.py | """Collection of Helper Functions"""
import os
from fnmatch import fnmatch
from PyPDF2 import PdfFileReader
def pdf_file(filename):
"""Test whether or the the filename ends with '.pdf'."""
return fnmatch(filename, '*.pdf')
def all_pdf_files_in_directory(path):
"""Return a list of of PDF files in a dire... | Python | 0 | @@ -410,35 +410,30 @@
def
-all_pages_in_directory(path
+concat_pdf_pages(files
):%0A
@@ -494,23 +494,21 @@
all
-the PDF
+pages
in the
dire
@@ -503,25 +503,25 @@
in the
-directory
+PDF files
.%22%22%22%0A
@@ -529,115 +529,29 @@
for
-filename in sorted(all_pdf_files_in_directory(path)):%0A with ... |
d16373609b2f30c6ffa576c1269c529f12c9622c | Switch to fast method for personal timetable | backend/uclapi/timetable/urls.py | backend/uclapi/timetable/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^personal_fast$', views.get_personal_timetable_fast),
url(r'^personal$', views.get_personal_timetable),
url(r'^bymodule$', views.get_modules_timetable),
]
| Python | 0 | @@ -83,21 +83,16 @@
personal
-_fast
$', view
@@ -127,62 +127,8 @@
t),%0A
- url(r'%5Epersonal$', views.get_personal_timetable),%0A
|
22785c709956365ac51bc3b79135e6debc6418ae | Exclude legacy objc API tests properly. | all.gyp | all.gyp | # Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... | Python | 0.000026 | @@ -860,16 +860,17 @@
%5B'
+(
OS==%22ios
@@ -909,16 +909,17 @@
=%22ia32%22)
+)
and inc
|
127434cdc04ae3655747ff1e3530148404dbf849 | fix flush | blaz.py | blaz.py | from os import environ, chdir, getenv
from os.path import abspath, basename, dirname
from subprocess import check_call
from sys import argv
from colors import bold
from hashlib import md5
import sys
class Blaz(object):
def __init__(self, **kwargs):
self.__dict__ = kwargs
self.file = abspath(argv[0... | Python | 0.000001 | @@ -937,29 +937,16 @@
AZ_LOCK'
-.format(self)
in envi
@@ -1539,16 +1539,70 @@
ll=True)
+%0A sys.stdout.flush()%0A sys.stderr.flush()
%0A%0A de
|
7187abb00e78b9cc8cca5366a70b6f6045d94a9c | Fixed a Python 2.3 incompatibility. | django/contrib/formtools/preview.py | django/contrib/formtools/preview.py | """
Formtools Preview application.
"""
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
import cPickle as pickle
import md5
AUTO_ID = 'formtools_%s... | Python | 0.999738 | @@ -4584,17 +4584,8 @@
ta,
-protocol=
pick
|
bb679edf2b7030de07e3d3688327c5e13851232e | Troubleshoot CI | kevlar/__init__.py | kevlar/__init__.py | #!/usr/bin/env python
#
# -----------------------------------------------------------------------------
# Copyright (c) 2016 The Regents of the University of California
#
# This file is part of kevlar (http://github.com/dib-lab/kevlar) and is
# licensed under the MIT license: see LICENSE.
# ----------------------------... | Python | 0.000001 | @@ -1245,16 +1245,40 @@
sion(s)%0A
+import kevlar.alignment%0A
from kev
|
9b5d9ad8ddc2f1bf652e55102a4db67c71f8515f | Set defaults for sql options | keystone/config.py | keystone/config.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | Python | 0.000015 | @@ -4255,16 +4255,49 @@
up='sql'
+, default='sqlite:///keystone.db'
)%0Aregist
@@ -4330,16 +4330,29 @@
up='sql'
+, default=200
)%0A%0A%0Aregi
|
2bdfca93103d6d3c721e33c5907a8842e2c038b3 | Fix unicode error in admin autocomplete field | django_extensions/admin/__init__.py | django_extensions/admin/__init__.py | #
# Autocomplete feature for admin panel
#
# Most of the code has been written by Jannis Leidel and was updated a bit
# for django_extensions.
# http://jannisleidel.com/2008/11/autocomplete-form-widget-foreignkey-model-fields/
#
# to_string_function, Satchmo adaptation and some comments added by emes
# (Michal Salaban)... | Python | 0.00001 | @@ -4454,16 +4454,17 @@
%25s%7C%25s%5Cn'
+)
%25 (to_s
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.