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 |
|---|---|---|---|---|---|---|---|
7e2bd3fd525a3461ef2077ab7bc2e46a3121351f | Cut default RSS caching from 10 to 5 min | bulbs/feeds/views.py | bulbs/feeds/views.py | from django.template import RequestContext
from django.utils.timezone import now
from django.views.decorators.cache import cache_control
from bulbs.content.views import ContentListView
from bulbs.special_coverage.models import SpecialCoverage
class RSSView(ContentListView):
"""Really simply, this syndicates Cont... | Python | 0 | @@ -581,9 +581,9 @@
age=
-6
+3
00)%0A
|
2bf78c5a43b2d912701854ba8821adc6c27be103 | Version bump | bottle_utils/__init__.py | bottle_utils/__init__.py | __version__ = '0.3.6'
__author__ = 'Outernet Inc <hello@outernet.is>'
| Python | 0.000001 | @@ -16,9 +16,9 @@
0.3.
-6
+7
'%0A__
|
c9b1929f00ecd6502958b13f8cf250acdff2be1b | Change flv to mp3 | brome/webserver/utils.py | brome/webserver/utils.py | # -*- coding: utf-8 -*-
"""Helper utilities and decorators."""
from subprocess import call
import os.path
import md5
from IPython import embed
from flask import flash
def flash_errors(form, category="warning"):
"""Flash all errors for a form."""
for field, errors in form.errors.items():
for error in... | Python | 0.000025 | @@ -1334,19 +1334,19 @@
copy-%25s.
-flv
+mp4
'%25video_
@@ -1413,35 +1413,35 @@
deo_folder, '%25s.
-flv
+mp4
'%25video_hash)%0A
@@ -1530,11 +1530,11 @@
'%25s.
-flv
+mp4
'%25vi
|
6746cd659abcbbd8c4ca2de9f5a31ec42e0e8a1b | fix bug: analyzer/collocationw | analyzer/analyzer.py | analyzer/analyzer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# crawlerで入手したテキストを解析する
# 1.マルコフ連鎖テーブル
# 2.最近10min間のホットな単語リスト
# 3.ればreplyリストに入れる
import mecab
import datetime
import re
from sqlalchemy import and_
import model
import simplejson
import psyco
psyco.full()
mecabPath = "/usr/lib/libmecab.so"
g_mecabencode = "euc-jp"
g_sys... | Python | 0 | @@ -3972,26 +3972,24 @@
e(i+1,len(l)
--1
):%0A%09%09%09b = un
|
b700cf323ff21d8c943df93b277ce7b957f36452 | Refactor example script. | examples/launch_cloud_harness.py | examples/launch_cloud_harness.py | import json
import os
# from osgeo import gdal
from gbdxtools import Interface
from task_template import TaskTemplate, Task, InputPort, OutputPort
gbdx = Interface()
# data = "s3://receiving-dgcs-tdgplatform-com/054813633050_01_003" # WV02 Image over San Francisco
# aoptask = gbdx.Task("AOP_Strip_Processor", data=... | Python | 0 | @@ -15,18 +15,16 @@
port os%0A
-#
from osg
@@ -76,16 +76,21 @@
ce%0Afrom
+gbdx_
task_tem
@@ -674,16 +674,17 @@
.tif
+f
%22, %22.
-TIF
+tif
%22%5D)%0A
@@ -813,18 +813,16 @@
- #
gtif =
@@ -912,18 +912,16 @@
- #
self.ta
@@ -1000,16 +1000,40 @@
nt=2))%0A%0A
+# Create a cloud-harness
%0Ac... |
0d99a49057a58af7843f25e27dee64f581801415 | Use callback to print generated text in lstm_text_generation example (#8938) | examples/lstm_text_generation.py | examples/lstm_text_generation.py | '''Example script to generate text from Nietzsche's writings.
At least 20 epochs are required before the generated text
starts sounding coherent.
It is recommended to run this script on GPU, as recurrent
networks are quite computationally intensive.
If you try this script on new data, make sure your corpus
has at le... | Python | 0 | @@ -389,24 +389,67 @@
nt_function%0A
+from keras.callbacks import LambdaCallback%0A
from keras.m
@@ -2285,239 +2285,177 @@
s)%0A%0A
-# train the model, output generated text after each iteration%0Afor iteration in range(1, 60):%0A print()%0A print('-' * 50)%0A print('Iteration', iteration)%0A model.fit(x... |
2bcab870565c380889a6b8355a1fb0e1d48b8197 | Update api.py | build/lib/playkit/api.py | build/lib/playkit/api.py | import requests
from bs4 import BeautifulSoup
def search(keyword="",category="apps",country="us",pricing="all",rating="all",format="dict",proxies=None):
requests.packages.urllib3.disable_warnings()
priceMap = {"all":0,"free":1,"paid":2,"All":0,"Free":1,"Paid":2}
ratingsMap = {"all":0,"4+":1,"All":0}
... | Python | 0.000001 | @@ -924,16 +924,33 @@
rser')%0A%0A
+ try:%0A
@@ -1111,24 +1111,301 @@
ression%22 %7D)%0A
+ except AttributeError,e:%0A print 'only one item to be listed'%0A print e%0A contents = htmlresponse.find(%22div%22, %7B %22class%22 : %22id-card-list card-list one-c... |
599dff39a8ff9435e94a4a341b10dfa9ef7f41e3 | Switch to random.sample for lore instead of random.choice | plugins/lore.py | plugins/lore.py | # cookie.py
# Pin management
# Eryn Wells <eryn@erynwells.me>
import json
import logging
import random
import re
import requests
from service import slack
LOGGER = logging.getLogger('cookie')
MAX_PINS = 100
MAX_LORE = 30
LORE_FILE = 'lore.json'
CHANNELS = {}
ANGER_MESSAGES = [':anger:', ':angry:']
LORE_RE = re.com... | Python | 0.000002 | @@ -4359,46 +4359,36 @@
-if len(pins) %3C count:%0A return %5B
+try:%0A out_lore = set(
_ext
@@ -4401,121 +4401,70 @@
ore(
-p
+l
) for
-p
+l
in
-pins%5D%0A out_lore = set()%0A while len(out_lore) %3C
+random.sample(pins,
count
-:
+))
%0A
- random_lore = random.choice(pins)
+ex... |
10701a83c8867225e94b710324e0ed21eeb945a1 | remove debug code | plugins/pcdb.py | plugins/pcdb.py | import requests
import botologist.plugin
class PCDB:
comments = []
@classmethod
def get_random(cls):
if not cls.comments:
print('requesting')
response = requests.get('http://pcdb.lutro.me',
headers={'accept': 'application/json'})
cls.comments = [c['body'] for c in response.json()['comments']]
re... | Python | 0.02323 | @@ -128,31 +128,8 @@
ts:%0A
-%09%09%09print('requesting')%0A
%09%09%09r
|
c56fd0606516c61a935b0faff8d4511fe8b5fb70 | add missing import subprocess | plugins/vsys.py | plugins/vsys.py | """vsys configurator. Maintains ACLs and script pipes inside vservers based on slice attributes."""
import os
import logger
import tools
VSYSCONF="/etc/vsys.conf"
VSYSBKEND="/vsys"
def start():
logger.log("vsys: plugin starting up...")
def GetSlivers(data, config=None, plc=None):
"""For each sliver with t... | Python | 0.000009 | @@ -104,16 +104,34 @@
mport os
+%0Aimport subprocess
%0A%0Aimport
|
2a93a70a854880129b162a9f563eea1cbcc1151b | Implement basic plotting. | plyades/core.py | plyades/core.py | from __future__ import division, print_function
import collections
import datetime
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import constants
import const
import time
import orbit
# Too much problems with Python 2.X
# symbols = {"Sun": u"\u2609", "Mercury": u"\u263F", "... | Python | 0.000001 | @@ -223,16 +223,17 @@
orbit%0A%0A
+%0A
# Too mu
@@ -3279,16 +3279,8 @@
bit.
-orbital_
peri
@@ -3290,24 +3290,24 @@
ele%5B0%5D, mu)%0A
+
@@ -3618,16 +3618,30 @@
.figure(
+%22Plyades Plot%22
)%0A
@@ -3685,16 +3685,408 @@
n='3d')%0A
+ r = const.planets%5Bself.body.lower()%5D%5B%22req%22... |
9112126ed9273b118ad7ae5fa9cf00655d561d6f | Check correct interface | src/gateway/hal/frontpanel_controller.py | src/gateway/hal/frontpanel_controller.py | # Copyright (C) 2019 OpenMotics BV
#
# 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 distribu... | Python | 0.000001 | @@ -5730,22 +5730,51 @@
if
-'eth0'
+FrontpanelController.MAIN_INTERFACE
in line
|
1ec10ebd7b2e1bdf4a7af46c45094ed57e8e6d77 | Update __main__.py | pmi/__main__.py | pmi/__main__.py | from pmi import pmi_weekly
from pmi_odds import pmi_odds_weekly
def main():
pmi_weekly()
pmi_daily()
pmi_odds_daily()
pmi_odds_weekly()
if __name__ == "__main__":
main()
| Python | 0.000063 | @@ -9,24 +9,68 @@
import pmi_
+daily, pmi_weekly, pmi_odds_daily, pmi_odds_
weekly%0Afrom
@@ -123,20 +123,19 @@
pmi_
-week
+dai
ly()%0A
@@ -131,35 +131,36 @@
daily()%0A pmi_
-dai
+week
ly()%0A pmi_odd
|
f8f3f6427a83871e60871e8fe1d048e29c7c97fc | fix hamilton bugs | ca_on_hamilton/people.py | ca_on_hamilton/people.py | # coding: utf-8
from pupa.scrape import Scraper
from utils import lxmlize, CanadianLegislator as Legislator
import re
COUNCIL_PAGE = 'http://www.hamilton.ca/YourElectedOfficials/WardCouncillors/'
class HamiltonPersonScraper(Scraper):
def get_people(self):
page = lxmlize(COUNCIL_PAGE)
council_node = page... | Python | 0.000066 | @@ -423,17 +423,29 @@
ble%5B2%5D//
-a
+p/a%5Bnot(img)%5D
/@href')
@@ -1156,32 +1156,47 @@
', email, None)%0A
+%0A if phone:%0A
p.add_contact(
@@ -1218,32 +1218,50 @@
'legislature')%0A
+ if photo_url:%0A
p.image = phot
|
7a4a121b94d745045394e7b921471d68f59749d8 | Fix removing evidence via imports | src/ggrc/converters/handlers/document.py | src/ggrc/converters/handlers/document.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Handlers document entries."""
from flask import current_app
from ggrc import models
from ggrc.converters import errors
from ggrc.converters.handlers import handlers
from ggrc.login import get_current_us... | Python | 0.000017 | @@ -171,16 +171,36 @@
nt_app%0A%0A
+from ggrc import db%0A
from ggr
@@ -2891,55 +2891,53 @@
-self.row_converter.obj.documents.remove(old_doc
+db.session.delete(old_doc.object_documents%5B0%5D
)%0A%0A
|
f5e8bfaf5c4f7a2131fbe0ffd0f8d14a316b907e | Add exception for cli command line to run interactively. | camoco/Exceptions.py | camoco/Exceptions.py | # Exception abstract class
class CamocoError(Exception):
pass
class CamocoExistsError(CamocoError):
'''
You tried to create a camoco object which already exists
under the same name,type combination.
'''
def __init__(self,expr,message='',*args):
self.expr = expr
self.mess... | Python | 0 | @@ -1201,28 +1201,204 @@
sage.format(args)%0A )%0A
+%0Aclass CamocoInteractive(CamocoError):%0A def __init__(self,expr=None,message='',*args):%0A self.expr = expr%0A self.message = 'Camoco interactive ipython session.'%0A
|
23cb20a82cd725df104d39fa12b1a71d4b54d459 | Write audit log to stdout if LOG_FOLDER unconfigured | portal/audit.py | portal/audit.py | """AUDIT module
Maintain a log exclusively used for recording auditable events.
Any action deemed an auditable event should make a call to
auditable_event()
Audit data is also persisted in the database *audit* table.
"""
import os
import sys
import logging
from flask import current_app
from .database import db
fr... | Python | 0.000649 | @@ -1710,24 +1710,130 @@
IT', AUDIT)%0A
+%0A audit_log_handler = logging.StreamHandler(sys.stdout)%0A if app.config.get('LOG_FOLDER', None):%0A
audit_lo
@@ -1888,16 +1888,20 @@
t.log')%0A
+
audi
@@ -1959,16 +1959,17 @@
y=True)%0A
+%0A
audi
|
9ec2eb47260f463750f8c810c04b41a04aa7db4b | add forgotten log handler | pprof/driver.py | pprof/driver.py | #!/usr/bin/env python
# encoding: utf-8
from plumbum import cli
from pprof import *
import logging
class PollyProfiling(cli.Application):
""" Frontend for running/building the pprof study framework """
VERSION = "0.9.6"
@cli.switch(["-v", "--verbose"], help="Enable verbose output")
def verbose(sel... | Python | 0.000004 | @@ -78,16 +78,39 @@
mport *%0A
+from sys import stderr%0A
import l
@@ -374,16 +374,70 @@
ogger()%0A
+ LOG.addHandler(logging.StreamHandler(stderr))%0A
|
fa489011d9202d61463dbc426041c867f2670438 | Remove raw-tx byte juggling in mempool_reorg | test/functional/mempool_reorg.py | test/functional/mempool_reorg.py | #!/usr/bin/env python3
# Copyright (c) 2014-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mempool re-org scenarios.
Test re-org scenarios with a mempool that contains transactions
that sp... | Python | 0.000002 | @@ -2380,216 +2380,182 @@
ion(
-%5B%7B%22txid%22: coinbase_txids%5B0%5D, %22vout%22: 0%7D%5D, %7Bnode0_address: 49.99%7D)%0A # Set the time lock%0A timelock_tx = timelock_tx.replace(%22ffffffff%22, %2211111191%22, 1)%0A timelock_tx = timelock_tx%5B:-8%5D + hex(
+%0A inputs=%5B%7B%0A ... |
718e8c5ebf24e77bb55d34c18d676ff2fd1aedcf | Bump version to 1.0.2 | cenaming/_version.py | cenaming/_version.py | version_info = (1, 0, 1)
__version__ = '.'.join(map(str, version_info))
| Python | 0 | @@ -15,17 +15,17 @@
(1, 0,
-1
+2
)%0A%0A__ver
|
ff58d9ae580bf759fe1f2d87f304e6d178aa6f9d | Bump @graknlabs_behaviour | dependencies/graknlabs/repositories.bzl | dependencies/graknlabs/repositories.bzl | #
# Copyright (C) 2021 Grakn Labs
#
# 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 distribut... | Python | 0.000001 | @@ -2430,48 +2430,48 @@
= %22
-f7d9732cc21110cbc30d91ece2e771b9
+b5234deedf3443f316be5f23b21
54
-c
45
-fb0
+7f87b21e1
%22, #
|
ec68a7e723494fdf008f0a7b3159fe7c8eb49636 | fix pipeline name for travis | test/sphinxext/test_sphinxext.py | test/sphinxext/test_sphinxext.py | import tempfile
import os
from sequana.sphinxext import snakemakerule
from sequana.sphinxext import sequana_pipeline
from sphinx.application import Sphinx
data = """import sys, os
import sphinx
sys.path.insert(0, os.path.abspath('sphinxext'))
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
"sequ... | Python | 0.000007 | @@ -716,23 +716,23 @@
oc(%22
-variant_calling
+quality_control
%22)%0A%0A
|
ca6a9c84db1607f27a15ea98e53d00e52c75e7ce | Bump version to 0.10 | cerberus/__init__.py | cerberus/__init__.py | """
Extensible validation for Python dictionaries.
:copyright: 2012-2015 by Nicola Iarocci.
:license: ISC, see LICENSE for more details.
Full documentation is available at http://cerberus.readthedocs.org/
"""
from .cerberus import Validator, ValidationError, SchemaError
__version__ = "0.9.1"
__all... | Python | 0 | @@ -306,11 +306,10 @@
%220.
-9.
1
+0
%22%0A%0A_
|
9d362b1944f84e49792d857dcc856b2af4611844 | Add support for TIFF compression in convert_files | cellom2tif/cellom2tif.py | cellom2tif/cellom2tif.py | from __future__ import division, absolute_import, print_function
import os
import argparse
import shutil
try:
import tifffile as tif
except ImportError:
from . import tifffile as tif
import javabridge as jv
import bioformats as bf
from .filetypes import is_cellomics_image, is_cellomics_mask
VM_STARTED = F... | Python | 0 | @@ -2875,16 +2875,55 @@
, files,
+ compression_level=1,%0A
ignore_
@@ -3359,24 +3359,230 @@
.C01 files.%0A
+ compression_level : int %5B0-9%5D, optional%0A The zlib compression level for writing the TIFF files. 0 = no%0A compression, 1 = fastest, least compression, 9 = slowest, mos... |
eaba6fe82c6c6e01606ed9ce4991dfbe538ebfec | Fix generator. | test/test_jobs/test_app_stats.py | test/test_jobs/test_app_stats.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2014 SF Isle of Man Limited
#
# PyBossa 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... | Python | 0 | @@ -2812,16 +2812,26 @@
jobs
+_generator
= get_p
@@ -2843,16 +2843,98 @@
t_jobs()
+%0A jobs = %5B%5D%0A for job in jobs_generator:%0A jobs.append(job)
%0A%0A
|
89d6c56fb36469ae994b972056f960001345ddee | Add test for splitting paths starting with / | cellom2tif/cellom2tif.py | cellom2tif/cellom2tif.py | import os
import argparse
import sys
from . import tifffile as tif
import javabridge as jv
import bioformats as bf
from .filetypes import is_cellomics_image, is_cellomics_mask
VM_STARTED = False
VM_KILLED = False
def start(max_heap_size='8G'):
"""Start the Java Virtual Machine, enabling bioformats IO.
Pa... | Python | 0 | @@ -2176,24 +2176,99 @@
ome/files')%0A
+ %3E%3E%3E path = '/root/path'%0A %3E%3E%3E split_top(path)%0A ('/', 'root/path')%0A
%22%22%22%0A
|
783cbeff6ab30fa1c43457ba1dd65f47db17aa72 | Fix parsing of libtool deps | cerbero/tools/libtool.py | cerbero/tools/libtool.py | #!/usr/bin/env python
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free So... | Python | 0.000006 | @@ -4403,16 +4403,86 @@
l_deps:%0A
+ if not d.startswith('lib'):%0A d = 'lib' + d%0A
@@ -4502,19 +4502,16 @@
+= ' %25s/
-lib
%25s.la '
|
491f6db206ee12159d94e27ffc1545f5de5de12e | handle various launch points | field_mapping/mrsid.py | field_mapping/mrsid.py | import json
import os
from glob import glob
import subprocess
from subprocess import Popen, PIPE, check_call, call
from pathlib import Path
from pyproj import datadir
proj_dir = datadir.get_data_dir()
root = '/media/research/IrrigationGIS'
if not os.path.exists(root):
root = '/home/dgketchum/data/IrrigationGIS'
... | Python | 0.000001 | @@ -600,25 +600,24 @@
um/miniconda
-3
/envs/metric
@@ -3361,39 +3361,28 @@
o =
-'/media/research/IrrigationGIS/
+os.path.join(root, '
Mont
@@ -3395,16 +3395,17 @@
ip/mt_n'
+)
%0A seg
|
130c37035b6eae9cc9172faecdf828509d9fd80e | Bump version | firefed/__version__.py | firefed/__version__.py | __title__ = 'firefed'
__version__ = '0.1.13'
__description__ = 'A tool for Firefox profile analysis, data extraction, \
forensics and hardening'
__url__ = 'https://github.com/numirias/firefed'
__author__ = 'numirias'
__author_email__ = 'numirias@users.noreply.github.com'
__license__ = 'MIT'
__keywords__ = 'firefox secu... | Python | 0 | @@ -39,9 +39,9 @@
.1.1
-3
+4
'%0A__
|
390ffbea26155832ca8baae3e2a5176a43d936f3 | Update emoji set. | channels/ch_boobs/app.py | channels/ch_boobs/app.py | #encoding:utf-8
import time
from utils import get_url
subreddit = 'boobs'
t_channel = '-1001052042617'
def send_post(submission, r2t):
what, url, ext = get_url(submission)
title = submission.title
link = submission.short_link
text = '{}\n{}'.format(title, link)
if what in ('gif', 'img'):
... | Python | 0 | @@ -372,22 +372,25 @@
-return
+success =
r2t.sen
@@ -421,16 +421,285 @@
, text)%0A
+ if success is False:%0A return False%0A for i in range(4):%0A time.sleep(3.14159 / 2.718281828)%0A r2t.send_text('%F0%9F%94%9E%F0%9F%94%9E%F0%9F%94%9E%F0%9F%94%9E%F0%9F%94%9E%... |
73d12ed0e09c948e0a92cc2f4e14ff61326f38b2 | Fix MySQL tests | testing/config/settings/mysql.py | testing/config/settings/mysql.py | DEBUG = True
SECRET_KEY = 'this is a not very secret key'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'rdmo',
'USER': 'root',
'PASSWORD': ''
}
}
| Python | 0.00008 | @@ -200,16 +200,120 @@
ORD': ''
+,%0A 'TEST': %7B%0A 'CHARSET': 'utf8',%0A 'COLLATION': 'utf8_general_ci',%0A %7D
%0A %7D%0A%7D
|
c33d51a06556a0daf49cdfd25f5743bfd64fe070 | Remove unused method | flask_table/columns.py | flask_table/columns.py | from flask import Markup, url_for
from babel.dates import format_date, format_datetime
def _single_get(item, key):
# First, try to lookup the key as if the item were a dict. If
# that fails, lookup the key as an atrribute of an item.
try:
val = item[key]
except (KeyError, TypeError):
v... | Python | 0.000006 | @@ -1915,76 +1915,8 @@
1%0A%0A
- @classmethod%0A def gettype(cls):%0A return cls.__name__%0A%0A
|
96ecd1b71320b2e2da82dd06dee8f68e5101b8fc | add simple history module | django_fixmystreet/fixmystreet/admin.py | django_fixmystreet/fixmystreet/admin.py | from django.contrib import admin
from django import forms
from transmeta import canonical_fieldname
from simple_history.admin import SimpleHistoryAdmin
from django_fixmystreet.fixmystreet.models import ReportCategory, Report, ReportMainCategoryClass, FaqEntry, OrganisationEntity
class ReportCategoryClassAdmin(admin.... | Python | 0.000001 | @@ -703,35 +703,37 @@
ReportAdmin(
-admin.Model
+SimpleHistory
Admin):%0A
|
ca7489246c030cf796937679c5668868c068f683 | Update new relic extension to 6.3.0.161 | extensions/newrelic/extension.py | extensions/newrelic/extension.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | Python | 0 | @@ -1032,17 +1032,16 @@
': '
-4.23.3.11
+6.3.0.16
1',%0A
|
137c0f94f51d9f2f8cc84344b79ca8ad2c85b547 | Allow calling optimize from fontcrunch directly | fontcrunch/__init__.py | fontcrunch/__init__.py | Python | 0 | @@ -0,0 +1,33 @@
+from .fontcrunch import optimize%0A
| |
5232ba997d65cb2bdc52f36096f4be1216c48a4f | Fix UT | tests/STA/Tactic/go_kick_test.py | tests/STA/Tactic/go_kick_test.py |
import unittest
from time import sleep
from Util import Pose, Position
from ai.STA.Tactic.go_kick import GoKick, COMMAND_DELAY
from tests.STA.perfect_sim import PerfectSim
A_ROBOT_ID = 1
START_POSE = Pose.from_values(300, 0, 0)
START_BALL_POSITION = START_POSE.position + Position(100, 0)
GOAL_POSE = Pose.from_values... | Python | 0.000007 | @@ -662,37 +662,8 @@
E)%0A%0A
- sleep(COMMAND_DELAY)%0A
@@ -688,13 +688,17 @@
) #
-Charg
+initializ
e%0A%0A
@@ -812,56 +812,8 @@
():%0A
- assert self.sim.has_charge_kick%0A
|
614c10d3be26724ea041fb006c77aa6f88749c7b | Fix failing tests | chul/tests/test_views.py | chul/tests/test_views.py | from django.core.urlresolvers import reverse
from model_mommy import mommy
from common.tests import ViewTestBase
from ..models import (
CommunityHealthUnit,
CommunityHealthWorker,
CommunityHealthWorkerContact
)
from ..serializers import (
CommunityHealthUnitSerializer,
CommunityHealthWorkerSeria... | Python | 0.000069 | @@ -2454,17 +2454,17 @@
worker_
-1
+2
,%0A
@@ -2653,33 +2653,33 @@
worker_
-2
+1
,%0A
|
54a92ac62db8a6932c935a399d5a58eb06daf0b2 | Debug failing integration test | tests/basic_auth_success_test.py | tests/basic_auth_success_test.py | """Test script for successful basic authentication."""
import json
import os
import time
import sys
import unittest
import requests
ZOE_API_URI = 'http://192.168.12.2:5100/api/0.7/'
ZOE_AUTH = ('admin', 'admin')
class ZoeRestTestSuccess(unittest.TestCase):
"""Test case class."""
uri = ZOE_API_URI
auth... | Python | 0 | @@ -2445,32 +2445,136 @@
__class__.auth)%0A
+ if req.status_code != 204:%0A print('error message: %7B%7D'.format(req.json()%5B'message'%5D))%0A
self.ass
|
9bfba70cadb4008f218bad21a7ebcd802d994640 | Add error and success messages to rendering context | form_designer/views.py | form_designer/views.py | from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext as _
from django.http import HttpResponseRedirect
from django.conf import settings
from form_designer import settings as app_settings
from django.contrib import mes... | Python | 0 | @@ -3317,16 +3317,110 @@
uccess,%0A
+ 'form_success_message': success_message,%0A 'form_error_message': error_message,%0A
|
27dbfee8f78e55b412bfa84ff8c0a9d94e42bde3 | compress file | ckstyle/doCssCompress.py | ckstyle/doCssCompress.py | #/usr/bin/python
#encoding=utf-8
import sys
import os
from cssparser.CssFileParser import CssParser
from ckstyle.cmdconsole.ConsoleClass import console
from CssCheckerWrapper import CssChecker
import command.args as args
defaultConfig = args.CommandArgs()
def doCompress(fileContent, fileName = '', config = defaultCo... | Python | 0.000005 | @@ -1878,16 +1878,17 @@
key + '
+.
min.css'
|
03d1a06fd8dfdad459383584c44a4409fe46c87d | Update score_main.py | classifier/score_main.py | classifier/score_main.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Python | 0.000002 | @@ -1145,25 +1145,25 @@
ccuracy: %7B:.
-2
+4
f%7D%22.format(o
@@ -1171,32 +1171,33 @@
erall_accuracy))
+
%0A %0A correc
@@ -1194,517 +1194,1893 @@
-correct_counts_breakdown = %7B%7D%0A total_counts_breakdown = %7B%7D%0A %0A for category in np.unique(targets):%0A this_category_index = np... |
a0ca9f5394792592658686b2729d1ce6b1497e1d | Add webpack_args argument | extra/webdev_commands/webpack.py | extra/webdev_commands/webpack.py | """Run the webpack command."""
from dodo_commands.defaults.commands.standard_commands import DodoCommand
class Command(DodoCommand): # noqa
decorators = ['docker']
def handle_imp(self, **kwargs): # noqa
self.runcmd(
["webpack", "--watch-stdin"],
cwd=self.get_config("/WEBPACK... | Python | 0.000004 | @@ -24,16 +24,32 @@
and.%22%22%22%0A
+import argparse%0A
from dod
@@ -181,16 +181,249 @@
cker'%5D%0A%0A
+ def add_arguments_imp(self, parser): # noqa%0A parser.add_argument(%0A '--args',%0A dest=%22webpack_args%22,%0A required=False,%0A default=%5B%5D,%0A ... |
3a52068a3a37d62412fc871990a7afe23f1b5c14 | improve date logic | pypinfo/core.py | pypinfo/core.py | import json
import os
from google.cloud.bigquery import Client
from pypinfo.fields import Downloads
FROM = """\
FROM
TABLE_DATE_RANGE(
[the-psf:pypi.downloads],
DATE_ADD(CURRENT_TIMESTAMP(), {}, "day"),
DATE_ADD(CURRENT_TIMESTAMP(), {}, "day")
)
"""
START_DATE = '-31'
END_DATE = '-1'
DEFAULT_LIMIT = ... | Python | 0.028139 | @@ -908,16 +908,82 @@
_LIMIT%0A%0A
+ if days:%0A start_date = str(int(end_date) - int(days))%0A%0A
if i
@@ -1206,74 +1206,8 @@
')%0A%0A
- if days:%0A start_date = str(int(end_date) - int(days))%0A%0A
|
dd58b1427f203cc8be11efc5891dc1c4d1577408 | Update imports after _internal refactoring. | tests/functional/test_vcs_git.py | tests/functional/test_vcs_git.py | """
Contains functional tests of the Git class.
"""
from pip.utils.temp_dir import TempDirectory
from pip.vcs.git import Git
def get_head_sha(script, dest):
"""Return the HEAD sha."""
result = script.run('git', 'rev-parse', 'HEAD', cwd=dest)
sha = result.stdout.strip()
return sha
def do_commit(scr... | Python | 0 | @@ -55,16 +55,26 @@
rom pip.
+_internal.
utils.te
@@ -110,16 +110,26 @@
rom pip.
+_internal.
vcs.git
|
aeb68bfc58f98731556c6ca43c55e7bd4fcaf1d6 | update test docs | tests/integration/test_kuyruk.py | tests/integration/test_kuyruk.py | import os
import signal
import logging
import unittest
from mock import patch
from tests import tasks
from util import run_kuyruk, wait_until, \
not_running, get_pid, TIMEOUT, delete_queue, len_queue
logger = logging.getLogger(__name__)
class KuyrukTestCase(unittest.TestCase):
"""
Tests here are mostl... | Python | 0 | @@ -924,17 +924,15 @@
on
-different
+another
que
@@ -1503,25 +1503,19 @@
red task
-s must be
+ is
retried
@@ -1766,94 +1766,40 @@
%22%22%22
-If the worker is stuck on the task it can be stopped by%0A invoking cold shutdown
+Cold shutdown stops stuck worker
%22%22%22%0A
@@ -2289,17 +2289,11 @@
task
-s... |
2de1fd626841e70c7ce3fb01bcc86ddc0c365613 | Update python package version | python/setup.py | python/setup.py | from setuptools import setup, find_packages
import os
import os.path
import shutil
import glob
from sys import platform
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
SCANNERPY_DIR = os.path.join(SCRIPT_DIR, 'scannerpy')
SCANNER_DIR = '.'
BUILD_DIR = os.path.join(SCANNER_DIR, 'build')
PIP_DIR = os.path.join(... | Python | 0 | @@ -3729,17 +3729,17 @@
on='0.0.
-1
+2
',%0A d
|
82d2c597234b57c05d1dae26920522355101b0df | return list of shares from list_shares function | clearskies/client.py | clearskies/client.py | from clearskies.unixjsonsocket import UnixJsonSocket
import xdg.BaseDirectory
import os
class ProtocolException(Exception):
pass
class ClearSkies(object):
def __init__(self):
data_dir = xdg.BaseDirectory.save_data_path("clearskies")
control_path = os.path.join(data_dir, "control")
se... | Python | 0.000004 | @@ -1483,32 +1483,42 @@
res%22,%0A %7D)
+%5B%22shares%22%5D
%0A%0A def create
|
d1f0d9156961801abf6c7ff4aa5265ef0ecd7950 | Send client version info in User-Agent | client/bin/daemon.py | client/bin/daemon.py | #!/usr/bin/python
import time
import sched
import subprocess
from os import path, chdir, getcwd
import requests
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler, FileModifiedEvent
# 5 minutes
#resubmitTime = 60 * 5
resubmitTime = 5
lastUrl = None
lastWasPeriodic = False
def... | Python | 0 | @@ -268,16 +268,34 @@
Time = 5
+%0Aversion = '0.1.0'
%0A%0AlastUr
@@ -370,16 +370,176 @@
edit'):%0A
+ headers = requests.utils.default_headers()%0A headers.update(%7B%0A 'User-Agent': requests.utils.default_user_agent() + ' rcrealtime/' + version%0A %7D)%0A
payl
@@ -642,16 +642,33 @@
ple/aj',
+... |
964a7be5f03a201305f5ba3165a2dc1257311cf4 | exclude c-extensions on Windows. | python/setup.py | python/setup.py | from setuptools import setup, find_packages, Extension
import numpy
def new_ext(name, srcs) :
ext_includes = [numpy.get_include(), '../libsqaod/include', '../libsqaod', '../libsqaod/eigen']
ext = Extension(name, srcs,
include_dirs=ext_includes,
extra_compile_args = ['-s... | Python | 0 | @@ -436,16 +436,54 @@
es = %5B%5D%0A
+%0Aif platform.system() != 'Windows' :%0A%09
ext_modu
@@ -568,32 +568,33 @@
earcher.cpp'%5D))%0A
+%09
ext_modules.appe
@@ -665,32 +665,33 @@
nnealer.cpp'%5D))%0A
+%09
ext_modules.appe
@@ -768,32 +768,33 @@
earcher.cpp'%5D))%0A
+%09
ext_modules.appe
@@ -873,16 +873,17 @@
cp... |
daa22f92807ea593374ce07de7b57650c559cc8f | Add all requirements to setup.py | python/setup.py | python/setup.py | from setuptools import setup
from os.path import join, dirname
try:
# obtain long description from README
readme_path = join(dirname(__file__), "README.rst")
with open(readme_path, encoding="utf-8") as f:
README = f.read()
# remove raw html not supported by PyPI
README = "\n".join(R... | Python | 0 | @@ -1072,16 +1072,34 @@
quires=%5B
+'numpy', 'scipy',
'sklearn
|
f81f60257c024c8a515aeba34137801e448c42ae | Correct comment | client/glowclient.py | client/glowclient.py | #
# Filename: glowthread.py
# Author: @captainwhippet
# Created: 7 March 2014
#
# Send a command to the server running the glowserver
import pickle, socket
def send_command(host, pattern):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(host)
f = s.makefile('b')
pickle.dump(p... | Python | 0.000026 | @@ -15,14 +15,14 @@
glow
-thread
+client
.py%0A
|
5b78b8f384d46337db21ebf2cd611785867e5162 | Explicitly return None | python/vault.py | python/vault.py | import json
import gc
from mfrc522 import MFRC522
"""The number of banks available in the tag. Only one is active, and has its length stored in the lengths block"""
numBanks = 3
"""Default Mifare key which authenticates access to card sectors"""
key = b'\xff\xff\xff\xff\xff\xff'
"""Number of bytes per block"""
bytesPe... | Python | 0.999999 | @@ -2435,16 +2435,48 @@
print(e)
+%0A return None
%0A%0A de
|
632c95816ba77fcfd636d598346528b780efb4c5 | Disable output buffering. | python2.7/mt.py | python2.7/mt.py | #!/usr/bin/env python2
import argparse
import multitail
parser = argparse.ArgumentParser()
parser.add_argument('files', type=str, nargs='+')
args = parser.parse_args()
for fn, line in multitail.multitail(args.files):
print("{}: {}".format(fn,line.strip()))
| Python | 0 | @@ -49,16 +49,320 @@
ultitail
+%0Aimport sys%0A%0A# http://stackoverflow.com/questions/107705%0Aclass Unbuffered(object):%0A def __init__(self, stream): self.stream = stream%0A def write(self, data): self.stream.write(data); self.stream.flush()%0A def __getattr__(self, attr): return getattr(self.stream, attr)%0Asys... |
a705dc05c9affc91184ce7908f0c2ea9a31f32e5 | Use ganeti.serializer for loading config | qa/qa_config.py | qa/qa_config.py | #
#
# Copyright (C) 2007 Google Inc.
#
# This program 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 version.
#
# This program is distributed ... | Python | 0 | @@ -774,25 +774,62 @@
%22%0A%0A%0A
-import simplejson
+from ganeti import utils%0Afrom ganeti import serializer
%0A%0Aim
@@ -957,87 +957,54 @@
%0A%0A
-f = open(path, 'r')%0A try:%0A cfg = simplejson.load(f)%0A finally:%0A f.close(
+cfg = serializer.LoadJson(utils.ReadFile(path)
)%0A%0A
|
30367dcb2358b53ec21a0837bd7fa17145e45c2a | Fix calendar's paintCell | app/tabs/calendar.py | app/tabs/calendar.py | from PyQt4 import QtCore, QtGui
import datetime
from app.utils import ListItemDelegate, event_register
from app.forms import ActionForm
from app.dbmanager import DBManager
from app.tabs.tab import Tab
class Calendar(QtGui.QStackedWidget, Tab):
ICON = "calendar"
LABEL = "Calendar"
def _setup_content(self... | Python | 0.000001 | @@ -4700,16 +4700,76 @@
F380%22))%0A
+ white_brush = QtGui.QBrush(QtGui.QColor(%22#FFFFFF%22))%0A
@@ -5382,9 +5382,203 @@
label)%0A
+ else: %0A text_format = QtGui.QTextCharFormat(self.dateTextFormat(date))%0A text_format.setBackground(white_brush)%0A self.set... |
702351f6454f1b8588497e54214615bffb9d2f32 | Support authenticated test requests | app/utils/testing.py | app/utils/testing.py | import json
from urlparse import urlparse
from falcon.testing import TestBase
from app import api, db
from app.config import DATABASE_URL
HEADERS = {'Content-Type': 'application/json'}
class APITestCase(TestBase):
def setUp(self):
super(APITestCase, self).setUp()
self._empty_tables()
@sta... | Python | 0 | @@ -985,32 +985,33 @@
lose()%0A%0A def
+_
simulate_get(sel
@@ -1007,17 +1007,29 @@
ate_
-ge
+reques
t(self,
+ method,
pat
@@ -1027,34 +1027,110 @@
thod, path, data
-):
+, token=None):%0A if token:%0A HEADERS%5B'Authorization'%5D = token%0A
%0A self.ap
@@ -1129,32 +1129,33 @@
self.... |
404eef133bf6f8eeff1d4a40851db07fa8e15546 | Revert "Update version.py" | rasa/version.py | rasa/version.py | __version__ = "1.3.1"
| Python | 0 | @@ -12,11 +12,11 @@
= %221.3.
-1
+0
%22%0A
|
4584e2de0e6d49e4029573fa0c612bd733421bcd | Add method signatures for search endpoints | appfigures/client.py | appfigures/client.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
import os
import requests
from purl import URL
from .decorators import cached_property
from .products import Product
class Client(object):
BASE_URL = URL('https://api.appfigures.com/v2')
def __init__(self, client_key, client_s... | Python | 0.000001 | @@ -2731,64 +2731,428 @@
lf,
-store, product_id):%0A %22%22%22%0A Search%0A%0A %22%22%22
+term, filter, page, count=25):%0A raise NotImplementedError()%0A%0A def find_product_by_developer(self, developer, filter, page, count=25):%0A term = '@developer=%7B%7D'.format(developer)%0A... |
e61917e18efa3340df1c68ff057732a8a9f77d2b | Remove unused code from hyperion/__init__.py | hyperion/__init__.py | hyperion/__init__.py | from __future__ import print_function, division
import os
import glob
import hashlib
import h5py
from .version import __version__
data_dir = __path__[0] + '/data/'
datafiles = {}
for datafile in glob.glob(os.path.join(data_dir, '*.hdf5')):
f = h5py.File(datafile)
hash = f.attrs['asciimd5'].decode('utf-8')
... | Python | 0.00015 | @@ -84,21 +84,8 @@
ib%0A%0A
-import h5py%0A%0A
from
@@ -118,461 +118,8 @@
__%0A%0A
-data_dir = __path__%5B0%5D + '/data/'%0A%0Adatafiles = %7B%7D%0Afor datafile in glob.glob(os.path.join(data_dir, '*.hdf5')):%0A f = h5py.File(datafile)%0A hash = f.attrs%5B'asciimd5'%5D.decode('utf-8')%0A datafiles%5Bhash%5D... |
95d70e79fc6a55b68db824714b6fea678bd619f8 | change uuid namespace to NAMESPACE_OID | flask_website/xiaoice_storage.py | flask_website/xiaoice_storage.py | import uuid
work_xiaoice={}
free_xiaoice={}
UUID_NAMESPACE_XIAOICE = 'CHAT_XIAOICE'
class Xiaoice():
def __init__(self, weibo):
self._weibo = weibo
def get_weibo(self):
return self._weibo
def send_msg(self, msg):
self._weibo.post_msg_to_xiaoice(msg)
def get_msg(self):
... | Python | 0.000514 | @@ -18,17 +18,19 @@
_xiaoice
-=
+ =
%7B%7D%0Afree_
@@ -40,52 +40,14 @@
oice
-=%7B%7D%0A%0AUUID_NAMESPACE_XIAOICE = 'CHAT_XIAOICE'
+ = %7B%7D%0A
%0A%0Acl
@@ -809,13 +809,13 @@
id3(
-UUID_
+uuid.
NAME
@@ -824,15 +824,11 @@
ACE_
-XIAOICE
+OID
, us
@@ -938,8 +938,9 @@
_str__()
+%0A
|
2270dc5f5e59a24e566a2b71c01b30495524aa4c | fix the same damn thing again | flumotion/test/test_pygobject.py | flumotion/test/test_pygobject.py | # vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005 Fluendo, S.L. (www.fluendo.com). All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free Software Foundation.
# This file is... | Python | 0.000001 | @@ -959,17 +959,16 @@
import
-(
gsignal,
@@ -981,49 +981,47 @@
erty
-,%0A
+%0Afrom flumotion.common.pygobject import
wit
@@ -1042,18 +1042,16 @@
operties
-)%0A
%0A%0Aclass
|
75fb8be9df18850f5a0a648c7d74f8f184e3b4db | Allow cores to be found in subdirectories of other cores | fusesoc/coremanager.py | fusesoc/coremanager.py | import logging
import os
from okonomiyaki.versions import EnpkgVersion
from simplesat.constraints import PrettyPackageStringParser, Requirement
from simplesat.dependency_solver import DependencySolver
from simplesat.errors import NoPackageFound, SatisfiabilityError
from simplesat.pool import Pool
from simplesat.repos... | Python | 0.000001 | @@ -5321,40 +5321,8 @@
e)))
-%0A del dirs%5B:%5D
%0A%0A
|
8a0a366cf57f1bb70222186c79f7cc968837ffc6 | Remove unused import. | tests/markup/test_tag_context.py | tests/markup/test_tag_context.py | from tests.markup._util import alternate_expectation, desired_output
def simple_schema():
from flatland import Form, String
class SmallForm(Form):
name = "test"
valued = String
empty = String
return SmallForm({u'valued': u'val'})
### value
@desired_output('xhtml', simple_sche... | Python | 0 | @@ -27,31 +27,8 @@
port
- alternate_expectation,
des
|
ea6d3f9bfca9cc852cbd4e80709d04656fa92a58 | Fix a bug I introduced into this test. | tests/pathfinding/test_basics.py | tests/pathfinding/test_basics.py | import pytest
from src.shared.exceptions import NoPathToTargetError
from src.shared.game_state import GameState
from src.shared.geometry import chunkToUnit, unitToChunk, getChunkCenter
from src.shared.geometry import findPath
# TODO: Add the following new tests:
#
#
# ..@..
# A.@.B
# ..@..
#
#
# @@@@@@@@@@@
... | Python | 0 | @@ -1630,24 +1630,26 @@
(path, g
-ameState
+roundTypes
)%0A%0A
@@ -2286,24 +2286,26 @@
(path, g
-ameState
+roundTypes
):%0A f
|
600b3f34f514e237c2548df974d7c03c44874594 | add logging and data fetch | gargbot_3000/server.py | gargbot_3000/server.py | #! /usr/bin/env python3.6
# coding: utf-8
from gargbot_3000.logger import log
import json
from flask import Flask, request, g, Response
from gargbot_3000 import config
from gargbot_3000 import commands
from gargbot_3000 import database_manager
from gargbot_3000 import quotes
from gargbot_3000 import droppics
app = F... | Python | 0 | @@ -1803,78 +1803,224 @@
ive(
-data, trigger_id):%0A prev_request_data = get_callbacks()%5Btrigger_id%5D
+):%0A log.info(%22incoming interactive request%22)%0A data = request.form%0A trigger_id = data%5B%22trigger_id%22%5D%0A prev_request_data = get_callbacks()%5Btrigger_id%5D%0A log.info(f%22prev_re... |
3146b2a567788ea3775acc1b1b3b6810a5b247e7 | Add max_error_len to Github module. | i3pystatus/github.py | i3pystatus/github.py | from i3pystatus import IntervalModule
import requests
import json
from i3pystatus.core import ConfigError
from i3pystatus.core.util import user_open, internet, require
class Github(IntervalModule):
"""
Check Github for pending notifications.
Requires `requests`
Formatters:
* `{unread}` - ... | Python | 0 | @@ -464,16 +464,39 @@
%22%22%22%0A%0A
+ max_error_len = 50%0A
unre
@@ -1468,99 +1468,8 @@
e'%5D%0A
- if len(err_msg) %3E 10:%0A err_msg = %22%25s%25s%22 %25 (err_msg%5B:10%5D, '...')%0A
|
6ab0f3cc3e0e6f088797d8e2822fd060e8672df4 | Make this path-independent. | apps/iot/pel_read.py | apps/iot/pel_read.py | #!/usr/bin/env python3.6
#
# Copyright (c) 2015-2018 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain t... | Python | 0.000055 | @@ -1444,16 +1444,247 @@
s, sys%0A%0A
+from os.path import dirname, abspath%0Afrom inspect import getfile, currentframe%0Acurrentdir = dirname(abspath(getfile(currentframe())))%0A_parentdir = dirname(currentdir)%0Aparentdir = dirname(_parentdir)%0Asys.path.insert(0, parentdir)%0A%0A#
sys.path
|
bb23f661d259d1d272a632624ae1ee63df39983f | Update long_words.py | codeforces/long_words.py | codeforces/long_words.py | http://codeforces.com/problemset/problem/71/A
T = int(raw_input())
while(not T == 0):
word = str(raw_input())
if len(word)>10:
print word[0]+str(len(word[1:len(word)-1]))+word[len(word)-1]
else:
print word
T-=1
| Python | 0.000033 | @@ -1,8 +1,9 @@
+#
http://c
|
cf86aab987af6512bfd9f66c7a51969861f55524 | Converting the threshold input data test to naive date | apps/marks/models.py | apps/marks/models.py | #-*- coding: utf-8 -*-
import datetime
from django.utils import timezone
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext as _
from apps.authentication.models import OnlineUser as User
class ActiveMarksManager(models.Manager):
def get_query_set(self):
... | Python | 0.999999 | @@ -2233,28 +2233,82 @@
urn
-self.mark_added_date
+timezone.make_naive(self.mark_added_date, timezone.get_current_timezone())
%3E g
|
747f7799842f71954f4587158f315905f1f39bd9 | move org lookup | iatidq/test_queue.py | iatidq/test_queue.py |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | Python | 0.000001 | @@ -3232,283 +3232,8 @@
()%0A%0A
- organisations = dqpackages.get_organisations_for_testing(package_id)%0A #TODO: Implement for each organisation.%0A # This is a bit crude because it only works for%0A # iati-activities, and not organisation files.%0A # But it's sufficient for now.%0A... |
5da928fd9b08aeb0028b71535413159da18393b4 | Exclude inactive comics from sets editing, effectively throwing them out of the set when saved | comics/sets/forms.py | comics/sets/forms.py | import datetime
from django import forms
from django.template.defaultfilters import slugify
from comics.core.models import Comic
from comics.sets.models import Set
class NewSetForm(forms.ModelForm):
class Meta:
model = Set
fields = ('name',)
def save(self, commit=True):
set = super(N... | Python | 0 | @@ -657,12 +657,26 @@
cts.
-all(
+filter(active=True
),%0A
|
a5569ac905e3eb8faac59f2c6b7ec834235fb9e5 | Write file by dumping, not 'open()' | render_jinja.py | render_jinja.py |
# Copyright 2015 Malcolm Inglis <http://minglis.id.au>
#
# render-jinja 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.
#
# re... | Python | 0.000848 | @@ -830,16 +830,24 @@
%0A%0Aclass
+Template
Loader(j
@@ -2063,20 +2063,15 @@
ain(
-cwd,
argv):%0A
+
@@ -2098,50 +2098,8 @@
gv)%0A
- with open(args.output, 'w') as f:%0A
@@ -2130,16 +2130,24 @@
(loader=
+Template
Loader()
@@ -2148,20 +2148,16 @@
ader(),%0A
-
@@ -2218,18 +2218,8... |
a1a0e585f12b8058f0cf574db02a28a383513c65 | Fix exist(s) usage | genewiki/wiki/views.py | genewiki/wiki/views.py | from django.template import RequestContext
from django.shortcuts import get_object_or_404, render_to_response
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.views.decorators.http import require_http_methods
from django.http import HttpResponse
from genewiki.mapping.models import R... | Python | 0.000004 | @@ -4032,16 +4032,17 @@
d).exist
+s
():%0A
|
807feb5aa93c9f1c3088f2f3f000aeee2a567080 | remove junk | datadotworld/client.py | datadotworld/client.py | """
data.world-py
Copyright 2017 data.world, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the
License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... | Python | 0.000016 | @@ -2510,38 +2510,8 @@
n__%0A
- # TODO: set useragent%0A
@@ -2976,30 +2976,8 @@
%7D%0A
- print headers%0A
|
694b89274dd083125b9d89139ce83449da8fc02d | Format datetime values returned - datetime, and current_datetime. | repo_details.py | repo_details.py | """
Main VIP program
"""
import re
from git import Repo
def commit_contains_sub_paths(commit, sub_paths):
"""
Determine if a commit contains changes to files that contain specific sub-paths
:param commit: the commit
:param sub_paths: a list of sub-paths. 'None' for changes to any files to b... | Python | 0 | @@ -32,16 +32,64 @@
ort re%0D%0A
+from time import localtime, strptime, strftime%0D%0A
from git
@@ -825,46 +825,133 @@
path
-):%0D%0A self.repo_path = repo_path
+, datetime_format='%25Y-%25m-%25d %25H:%25M:%25S%25z'):%0D%0A self.repo_path = repo_path%0D%0A self.datetime_format = datetime_format
... |
a317656d37b0d1aa47a4133ce6ddcebec8377c75 | add fallback import for mocking library | tests/test_tornado_sqlalchemy.py | tests/test_tornado_sqlalchemy.py | from unittest import mock, TestCase
from tornado_sqlalchemy import (declarative_base, MissingFactoryError,
SessionFactory, SessionMixin)
from sqlalchemy import Column, BigInteger, String
database_url = 'postgres://postgres:@localhost/tornado_sqlalchemy'
Base = declarative_base()
c... | Python | 0 | @@ -17,14 +17,8 @@
port
- mock,
Tes
@@ -24,16 +24,103 @@
stCase%0A%0A
+try:%0A from unittest.mock import Mock%0Aexcept ImportError:%0A from mock import Mock%0A%0A
from tor
@@ -1436,13 +1436,8 @@
n =
-mock.
Mock
|
8fc35cbc732ee3f9c21e80d7290ccd905b2817cb | work around different sql math in sqlite vs. mysql | ichnaea/map_stats.py | ichnaea/map_stats.py | import csv
from cStringIO import StringIO
from ichnaea.db import Measure
def map_stats_request(request):
session = request.database.session()
query = session.query(Measure.lat / 10000, Measure.lon / 10000)
rows = StringIO()
csvwriter = csv.writer(rows)
csvwriter.writerow(('lat', 'lon'))
for l... | Python | 0.999997 | @@ -179,24 +179,16 @@
sure.lat
- / 10000
, Measur
@@ -196,16 +196,8 @@
.lon
- / 10000
)%0A
@@ -343,19 +343,30 @@
iterow((
+(
lat
+ // 10000)
/ 1000.
@@ -368,19 +368,30 @@
1000.0,
+(
lon
+ // 10000)
/ 1000.
|
0dfa968959e978ea677ae258671283680953ec29 | Add missing tests for async Market | tests/testnet/aio/test_market.py | tests/testnet/aio/test_market.py | # -*- coding: utf-8 -*-
import pytest
import logging
import asyncio
from bitshares.aio.asset import Asset
from bitshares.aio.amount import Amount
from bitshares.aio.account import Account
from bitshares.aio.price import Price, Order
from bitshares.aio.market import Market
log = logging.getLogger("grapheneapi")
log.se... | Python | 0 | @@ -3847,117 +3847,402 @@
ket(
-market):%0A pass%0A # TODO%0A%0A%0A@pytest.mark.asyncio%0Aasync def test_core_base_market(market):%0A pass%0A # TODO
+bitshares, assets, bitasset):%0A market = await Market(%0A %22%7B%7D:USD%22.format(bitasset.symbol), blockchain_instance=bitshares%0A )%0A aw... |
3de514288245ffbb2a6c2ae7f228a72424f44d4c | version bump for 1.1.1. | dataserver/__init__.py | dataserver/__init__.py |
version = '1.1'
| Python | 0 | @@ -8,11 +8,13 @@
n = '1.1
+.1
'%0A%0A
|
c79c647ffa4210331ed85fb8a08df288686a2821 | add crontab mode support | geventcron/__init__.py | geventcron/__init__.py | # coding: utf-8
import types
import logging
import time
from datetime import timedelta, datetime
import gevent
from gevent.pool import Pool
from gevent import monkey
monkey.patch_all()
def every_second(seconds):
delta = timedelta(seconds=seconds)
while 1:
yield delta
def wait_until(time_label):
i... | Python | 0 | @@ -91,16 +91,17 @@
atetime%0A
+%0A
import g
@@ -165,419 +165,422 @@
key%0A
-monkey.patch_all()%0A%0Adef every_second(seconds):%0A delta = timedelta(seconds=seconds)%0A while 1:%0A yield delta%0A%0Adef wait_until(time_label):%0A if time_label == 'next_minute':%0A gevent.sleep(60 - int(time.tim... |
ba374b4b4d5eadf8c3ba7be4e9ac7e544a06ff12 | Change the get_service to name rather then label (#251) | frontstage/cloud/cloudfoundry.py | frontstage/cloud/cloudfoundry.py | import cfenv
class ONSCloudFoundry(object):
def __init__(self):
self._cf_env = cfenv.AppEnv()
@property
def detected(self):
return self._cf_env.app
@property
def redis(self):
return self._cf_env.get_service(label='elasticache-broker')
| Python | 0 | @@ -253,32 +253,21 @@
ice(
-label='elasticache-broker
+name='rm-redis
')%0A
|
9000d6fbb5cba0ea05c0bf245b730bcd1452a0a8 | Remove unused/dead code | tests/unit/states/test_beacon.py | tests/unit/states/test_beacon.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
# Import Salt Testing Libs
from tests.support.runtests import RUNTIME_VARS
from tests.support.mixins import LoaderModul... | Python | 0.000008 | @@ -186,18 +186,8 @@
rals
-%0Aimport os
%0A%0A#
@@ -215,56 +215,8 @@
ibs%0A
-from tests.support.runtests import RUNTIME_VARS%0A
from
@@ -468,65 +468,8 @@
on%0A%0A
-SOCK_DIR = os.path.join(RUNTIME_VARS.TMP, 'test-socks')%0A%0A
%0A@sk
@@ -975,61 +975,8 @@
'%7D%0A%0A
- mock_dict = MagicMock(side_effect=%5Br... |
57cf91cd0305bae575f6bf85563962bc0e1c0fc6 | Fix for traceback in stats search (bug 780001) | apps/stats/search.py | apps/stats/search.py | import collections
import elasticutils
import pyes.exceptions as pyes
import amo
from applications.models import AppVersion
from stats.models import CollectionCount, DownloadCount, UpdateCount
def es_dict(items):
if not items:
return {}
if hasattr(items, 'items'):
items = items.items()
r... | Python | 0 | @@ -1361,14 +1361,48 @@
-if
+platform = None%0A%0A if str(
key
+)
.low
@@ -1448,11 +1448,19 @@
-os%5B
+platform =
amo.
@@ -1473,19 +1473,24 @@
RM_DICT%5B
+str(
key
+)
.lower()
@@ -1490,16 +1490,167 @@
lower()%5D
+%0A elif key in amo.PLATFORMS:%0A platform = amo.... |
756219d2efa9508122060a2e6b8ece74a8ae171e | Implement chmod | gitfs/views/current.py | gitfs/views/current.py | import re
import os
from stat import S_IXUSR, S_IXGRP, S_IXOTH
from gitfs.filesystems.passthrough import PassthroughFuse, STATS
from .view import View
from gitfs.log import log
class CurrentView(PassthroughFuse, View):
def __init__(self, *args, **kwargs):
super(CurrentView, self).__init__(*args, **kwar... | Python | 0.000002 | @@ -16,51 +16,8 @@
t os
-%0Afrom stat import S_IXUSR, S_IXGRP, S_IXOTH
%0A%0Afr
@@ -1649,17 +1649,16 @@
result%0A%0A
-%0A
def
@@ -1694,301 +1694,103 @@
-mode = int(str(oct(mode))%5B3:-1%5D, 8)%0A log.info(%22st_mode: %25s%22, mode)%0A log.info('user has exec permission: %25s' %25 bool(mode ... |
64023e69f70a71caf20f3a9952cf5007b3b14f3f | Corrige le nettoyage HTML des esperluettes. | common/utils/html.py | common/utils/html.py | # coding: utf-8
from __future__ import unicode_literals
from bleach import clean
from django.template.defaultfilters import date
from django.utils.encoding import smart_text
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext
from .text import capfirst
def date_html(d, tags=... | Python | 0 | @@ -4276,9 +4276,31 @@
')%0A )
+.replace('&', '&')
%0A
|
eca84104b741177b571b28901b03e7ef5e277b2e | Fix outputscale shaping for diag mode | gpytorch/kernels/scale_kernel.py | gpytorch/kernels/scale_kernel.py | #!/usr/bin/env python3
import torch
from .kernel import Kernel
from ..utils.deprecation import _deprecate_kwarg
from ..utils.transforms import _get_inv_param_transform
from torch.nn.functional import softplus
from ..lazy import delazify
class ScaleKernel(Kernel):
r"""
Decorates an existing kernel object with... | Python | 0.000005 | @@ -4070,80 +4070,8 @@
ms)%0A
- if diag:%0A return delazify(orig_output) * outputscales
%0A
@@ -4187,24 +4187,99 @@
im() - 1)))%0A
+%0A if diag:%0A return delazify(orig_output) * outputscales%0A%0A
retu
|
a8e6c67bda11b4eff18d68db3bd85faf4093b9a9 | make sure base and quote are in uppercase | coin/exchanges/wazirx.py | coin/exchanges/wazirx.py | # Wazirx
# https://api.wazirx.com/api/v2/tickers
# By Rishabh Rawat <rishabhrawat.rishu@gmail.com>
from exchange import Exchange, CURRENCY
class Wazirx(Exchange):
name = "Wazirx"
code = "wazirx"
ticker = "https://api.wazirx.com/api/v2/tickers"
discovery = "https://api.wazirx.com/api/v2/market-status"... | Python | 0.0008 | @@ -825,16 +825,24 @@
e': base
+.upper()
,%0A
@@ -861,24 +861,32 @@
uote': quote
+.upper()
,%0A
|
64ce65ac615ddfac7c42640619b996ffce8bb5b3 | Add facility validation for shift form | scheduler/admin.py | scheduler/admin.py | # coding: utf-8
from datetime import datetime
from django import forms
from django.contrib import admin
from django.core.exceptions import ValidationError
from django.db.models import Count
from django.utils.html import format_html, mark_safe
from django.utils.translation import ugettext_lazy as _
from organizations.... | Python | 0 | @@ -1367,16 +1367,965 @@
time')%0A%0A
+ facility = self.cleaned_data.get('facility') or self.instance.facility%0A if facility:%0A task = self.cleaned_data.get('task')%0A%0A if task and not task.facility == facility:%0A self.add_error('task', ValidationError(_(f'Facili... |
0e50da41eb93c54ad6942d6efe6e775c317b526d | Fix JSON as abstract mapping, but support list too | daybed/schemas/json.py | daybed/schemas/json.py | from __future__ import absolute_import
import re
import json
from pyramid.i18n import TranslationString as _
import six
from colander import Sequence, null, Invalid, List, Mapping
from .base import registry, TypeField
__all__ = ['JSONField']
def parse_json(node, cstruct):
if cstruct is null:
return cs... | Python | 0.000002 | @@ -640,92 +640,358 @@
def
-deserialize(self, node, cstruct=null):%0A appstruct = parse_json(node, cstruct)
+__init__(self, *args, **kwargs):%0A kwargs%5B'unknown'%5D = 'preserve'%0A super(JSONType, self).__init__(*args, **kwargs)%0A%0A def deserialize(self, node, cstruct=null):%0A apps... |
e2a1fb14cec3d7667dc3f31a9692e6a9f9ed8c83 | Add 'type' property into json documentation. | compiler/doc/json.py | compiler/doc/json.py | import os
import os.path
import compiler.lang as lang
class Component(object):
def __init__(self, package, name, component):
self.package = package
self.name = name
self.component = component
def generate_section(self, r, title, values, comma):
last = values[-1].name
r.append('\t\t"%s": {' %title)
for... | Python | 0 | @@ -249,17 +249,16 @@
comma):%0A
-%0A
%09%09last =
@@ -307,16 +307,17 @@
%25title)%0A
+%0A
%09%09for va
@@ -381,16 +381,96 @@
lse %22,%22%0A
+ typeName = value.type if hasattr(value, 'type') else %22%22%0A
%09%09%09if va
@@ -641,16 +641,30 @@
nal%22: %25s
+, %22type%22: %22%25s%22
%7D%25... |
455ecbb284884dcdd8021b84ea2f64e5f9d883b9 | Fix unit tests | thinc/tests/unit/test_vec2vec.py | thinc/tests/unit/test_vec2vec.py | import numpy
import pytest
from numpy.testing import assert_allclose
from ...ops import Ops
from ...vec2vec import Affine
from ...exceptions import ShapeError
class MockOps(Ops):
def __init__(self):
pass
def allocate(self, shape, name=None):
return numpy.zeros(shape)
def allocate_pool(s... | Python | 0.000005 | @@ -1140,16 +1140,117 @@
n data%0A%0A
+ def allocate_shape(self, shape):%0A return self.allocate(numpy.prod(shape)).reshape(shape)%0A%0A
%0A@pytest
@@ -1328,22 +1328,23 @@
s):%0A
-return
+model =
Affine(
@@ -1372,16 +1372,82 @@
r_in=6)%0A
+ model.set_weights()%0A model.set_gradient()%0A ret... |
cd16f2da7095dfd571e612f0c294c47a716e656f | Add "Skipping" output line for directories handled by svn:externals. | third_party/check_for_updates.py | third_party/check_for_updates.py | #!/usr/bin/python2.5
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the 'License')
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | Python | 0 | @@ -2592,16 +2592,152 @@
rnals()%0A
+ for skipping_dirs in sorted(subversion_externals.keys()):%0A print %22Skipping directory managed by svn:externals: %25s%22 %25 skipping_dirs%0A
check_
|
1b167035baa8f87cd76938b17ddade1c7bf3aa98 | Fix exception handling logic in resolve_name | importkit/context.py | importkit/context.py | ##
# Copyright (c) 2008-2013 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import importlib
import sys
import types
from metamagic.utils.datastructures import registry
from .exceptions import UnresolvedError
class LazyImportsModule(types.ModuleType):
def __sx_finalize_load__(self):
... | Python | 0.000036 | @@ -2344,35 +2344,41 @@
except
-Key
+Attribute
Error:%0A
|
a6f0713c39ea9c86cb1bfab3918fc5a450c35d93 | Change log level on reconcile_message() logging. | inbox/models/util.py | inbox/models/util.py | from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from inbox.models.message import Message
from inbox.models.thread import Thread
from inbox.models.folder import Folder, FolderItem
from inbox.util.file import Lock
from inbox.log import get_logger
log = get_logger()
def reconcile_message(db_sessio... | Python | 0 | @@ -1128,21 +1128,23 @@
log.
-error
+warning
('NoResu
@@ -1179,24 +1179,26 @@
en though '%0A
+
|
077fcc44f5b3f960b9ae8d246c9815180328e973 | Add response status and content to DiamondashApiErrors. | go/dashboard/client.py | go/dashboard/client.py | import json
import requests
from django.conf import settings
class DiamondashApiError(Exception):
"""
Raised when we something goes wrong while trying to interact with
diamondash api.
"""
class DiamondashApiClient(object):
def make_api_url(self, path):
return '/'.join(
p.str... | Python | 0 | @@ -200,16 +200,178 @@
%22%22%22%0A
+ def __init__(self, code, content, message):%0A super(DiamondashApiError, self).__init__(message)%0A self.code = code%0A self.content = content%0A
%0A%0Aclass
@@ -1219,16 +1219,64 @@
iError(%0A
+ resp.status_code, resp.content,%0A
... |
8f8eef878a5753fe7c6adf0871188f9adcf842a3 | Simplify DiamondashApiClient.get_api_auth() | go/dashboard/client.py | go/dashboard/client.py | import json
import requests
from django.conf import settings
class DiamondashApiError(Exception):
"""
Raised when we something goes wrong while trying to interact with
diamondash api.
"""
class DiamondashApiClient(object):
def make_api_url(self, path):
return '/'.join(
p.str... | Python | 0.0004 | @@ -431,52 +431,11 @@
e =
-None%0A password = None%0A%0A if has
+get
attr
@@ -470,18 +470,23 @@
SERNAME'
+, None
)
-:
%0A
@@ -490,169 +490,69 @@
- username = settings.DIAMONDASH_API_USERNAME%0A%0A if hasattr(settings, 'DIAMONDASH_API_PASSWORD'):%0A password = settin... |
3f34777ba55b104b5adc8fc0194e4408f2828a6a | call outmonitor in more command | gozerlib/plugs/more.py | gozerlib/plugs/more.py | # plugs/more.py
#
#
""" access the output cache. """
from gozerlib.commands import cmnds
from gozerlib.examples import examples
def handle_morestatus(bot, ievent):
ievent.reply("%s more entries available" % len(ievent.chan.data.outcache))
cmnds.add('more-status', handle_morestatus, ['USER', 'OPER', 'GUEST'])
ex... | Python | 0 | @@ -825,16 +825,73 @@
ite(txt)
+%0A bot.outmonitor(ievent.userhost, ievent.channel, txt)
%0A%0Acmnds.
|
9913e0756319d80bebfa761f8fb9f73c6cb76b5a | drop dewpoint constraint on previous commit | htdocs/plotting/auto/scripts/p93.py | htdocs/plotting/auto/scripts/p93.py | import psycopg2
from pyiem.network import Table as NetworkTable
import numpy as np
import pandas as pd
from pandas.io.sql import read_sql
import datetime
from pyiem.datatypes import temperature
import pyiem.meteorology as pymet
from pyiem.util import get_autoplot_context
from collections import OrderedDict
PDICT = {'... | Python | 0 | @@ -2360,23 +2360,8 @@
= 50
- and dwpf %3E= 30
%0A
|
5f7610e10b11e05591d6e2dc030c3ca5dc2a90b4 | Bump version number of myriad-assistant to 0.3.1. | tools/python/myriad/assistant.py | tools/python/myriad/assistant.py | '''
Copyright 2010-2013 DIMA Research Group, TU Berlin
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... | Python | 0 | @@ -1839,17 +1839,17 @@
= %220.3.
-0
+1
%22%0A %0A
|
85558a8fba824fdef70e26a8cc035f6c1351a450 | test improvements and refactoring | dwitter/tests/dweet/test_dweet_views.py | dwitter/tests/dweet/test_dweet_views.py | from django.test import TransactionTestCase, Client
from django.contrib.auth.models import User
from dwitter.models import Dweet
from django.utils import timezone
class DweetTestCase(TransactionTestCase):
def setUp(self):
self.client = Client(HTTP_HOST='dweet.example.com')
self.user = User.objects... | Python | 0.000001 | @@ -132,35 +132,484 @@
om d
-jango.utils import timezone
+witter.dweet.views import fullscreen_dweet, blank_dweet%0Afrom django.utils import timezone%0A%0A%0Adef wrap_content(content):%0A return 'function u(t) %7B%5Cn ' + content + '%5Cn %7D'%0A%0A%0Adef assertResponse(self, response, **kwargs):%0A se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.