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 |
|---|---|---|---|---|---|---|---|
660304c75faeb12dcd2f22bc3d909fa9371416c2 | add media type for gif and bmp | wptserve/constants.py | wptserve/constants.py | import utils
content_types = utils.invert_dict({"text/html": ["htm", "html"],
"application/xhtml+xml": ["xht", "xhtm", "xhtml"],
"text/javascript": ["js"],
"text/css": ["css"],
"t... | Python | 0 | @@ -453,24 +453,81 @@
%22: %5B%22svg%22%5D,%0A
+ %22image/gif%22: %5B%22gif%22%5D,%0A
@@ -633,24 +633,81 @@
%22: %5B%22png%22%5D,%0A
+ %22image/bmp%22: %5B%22bmp%22%5D,%0A
|
3aba7e7f654e492fb689b8030615658cae93c2d1 | Fix crashing when a user attempts to set usermode +o without /oper | txircd/modules/umode_o.py | txircd/modules/umode_o.py | from txircd.modbase import Mode
class OperMode(Mode):
def checkSet(self, target, param):
return False # Should only be set by the OPER command; hence, reject any normal setting of the mode
def checkWhoFilter(self, user, targetUser, filters, fields, channel, udata):
if "o" in filters and no... | Python | 0.000007 | @@ -70,16 +70,22 @@
et(self,
+ user,
target,
@@ -93,16 +93,114 @@
param):%0A
+ user.sendMessage(irc.ERR_NOPRIVILEGES, %22:Permission denied - User mode o may not be set%22)%0A
|
552c4f70afe40af7aaf72a8c6061e09753397a2c | fix typo | wheel_upload.py | wheel_upload.py |
"""Push wheels up to S3 bucket"""
import boto
from boto.s3.key import Key
_bucket = 'workbench-wheels'
_key = 'py27/wheelhouse.tar.gz'
# Spin up the S3 connection
try:
conn = boto.connect_s3()
bucket = conn.get_bucket(_bucket)
mykey = bucket.get_key(_key)
if not mykey:
print 'Could not find k... | Python | 0.999991 | @@ -492,18 +492,16 @@
%0A%0Aexcept
- e
: # Fail
|
338dab27775371169f07f5461575d659d7ee8341 | Update phone_xgbnn.py | xiaomi/phone_xgbnn.py | xiaomi/phone_xgbnn.py | # encoding=utf-8
from typing import List
import numpy as np
import xgboost as xgb
import logging
import re
import tensorflow as tf
from newphoneCNN import build_xgb_nn_model
class XGBLeafDataSource(object):
"""
read the files and parse out the "app_rate" feature and use the xgb to get the leafs.
"""
xg... | Python | 0 | @@ -128,51 +128,1190 @@
tf%0A
-from newphoneCNN import build_xgb_nn_model%0A
+import tensorflow_addons as tfa%0A%0A%0Adef build_xgb_nn_model(tree_num=10):%0A %22%22%22%0A use xgb leaf features inside.%0A To have a different model space in moe, just use xgb leaf features here.%0A :return:%0A %22%22%22%0... |
427c654fb3afd0a9fffc8bfced577f2416edd082 | Change to new format to present stroke drawing. | xie/graphics/utils.py | xie/graphics/utils.py | class TextCodec:
def __init__(self):
pass
def encodeStartPoint(self, p):
return "0{0[0]:02X}{0[1]:02X}".format(p)
def encodeEndPoint(self, p):
return "1{0[0]:02X}{0[1]:02X}".format(p)
def encodeControlPoint(self, p):
return "2{0[0]:02X}{0[1]:02X}".format(p)
def encodeStrokeExpression(self, pointExpress... | Python | 0 | @@ -10,16 +10,365 @@
tCodec:%0A
+%09STROKE_SEPERATOR = %22/%22%0A%09POINT_SEPERATOR = %22,%22%0A%09PARAMETER_SEPERATOR = %22.%22%0A%0A%09START_POINT_PATTERN=%220%22 + PARAMETER_SEPERATOR + %22%7B0%5B0%5D%7D%22 + PARAMETER_SEPERATOR + %22%7B0%5B1%5D%7D%22%0A%09END_POINT_PATTERN=%221%22 + PARAMETER_SEPERATOR + %22%7B0%5... |
c3b0cc681b06ab5b8d64612d5c35fb27da56beeb | Fix port number detection in sabnzbd | spk/sabnzbd/src/app/sabnzbd.cgi.py | spk/sabnzbd/src/app/sabnzbd.cgi.py | #!/usr/local/sabnzbd/env/bin/python
import os
import configobj
config = configobj.ConfigObj('/usr/local/sabnzbd/var/config.ini')
protocol = 'https' if int(config['misc']['enable_https']) else 'http'
port = int(config['misc']['https_port']) if int(config['misc']['enable_https']) else int(config['misc']['port'])
print... | Python | 0 | @@ -194,16 +194,22 @@
'http'%0A
+https_
port = i
@@ -227,16 +227,47 @@
misc'%5D%5B'
+port'%5D) if len(config%5B'misc'%5D%5B'
https_po
@@ -272,18 +272,25 @@
port'%5D)
-if
+== 0 else
int(con
@@ -298,39 +298,78 @@
ig%5B'misc'%5D%5B'
-enable_https'%5D)
+https_port'%5D)%0Aport = https_port if protocol == 'https'
... |
07cee25a4977a7f11e26b663df58fa6080df6fb4 | Add time axis header keyword to HDF5 files. | zeeko/telemetry/io.py | zeeko/telemetry/io.py | # -*- coding: utf-8 -*-
"""
Functions to handle HDF5 I/O for Chunks.
Since these all happen in python with the GIL (a limitation of H5py, they are implemented once here.)
"""
import numpy as np
class AxisSlicer(object):
"""A helper to slice along a single axis."""
__slots__ = ('array', 'axis')
... | Python | 0 | @@ -3156,16 +3156,53 @@
ue=0.0)%0A
+ %0A d.attrs%5B'TAXIS'%5D = axis%0A
%0A
@@ -3367,24 +3367,54 @@
illvalue=0)%0A
+ %0A m.attrs%5B'TAXIS'%5D = 0%0A
h5group.
|
77c1bc4db502f548ffd7f8f46312a8786bf9a823 | remove unused codes | zhuaxia/downloader.py | zhuaxia/downloader.py | # -*- coding:utf-8 -*-
from os import path
import sys
import requests
import config, log, util
import datetime,time
from threadpool import ThreadPool
from Queue import Queue
from mutagen.id3 import ID3,TRCK,TIT2,TALB,TPE1,APIC,TDRC,COMM,TPOS,USLT
from threading import Thread
LOG = log.get_logger('zxLogger')
#total nu... | Python | 0.000035 | @@ -4199,146 +4199,8 @@
3()%0A
- #id3.add(TRCK(encoding=3, text=song.track if song.track else %22%22))%0A #id3.add(TDRC(encoding=3, text=song.year if song.year else %22%22))%0A
@@ -4355,189 +4355,8 @@
e))%0A
- #id3.add(TPOS(encoding=3, text=mp3_meta%5B'cd_serial'%5D))%0A #id3.add(COMM(encoding=3, de... |
9614f41b13320322c7e29c4bf8af90dc292c01a0 | Add missing import | kinesishandler/worker.py | kinesishandler/worker.py | #
# Copyright (C) 2016 Tomas Nilsson (joekickass). All rights reserved.
#
import boto3
import threading
class Worker(object):
"""
Polls queue for next batch of log data and sends it to kinesis
TODO:
Each PutRecords request can support up to 500 records. Each record in the
request can be as larg... | Python | 0.000466 | @@ -99,16 +99,29 @@
reading%0A
+import queue%0A
%0A%0Aclass
|
652515d146a440b361f468cb473e5055dc92c1e2 | fix __main__ | kivy/modules/__init__.py | kivy/modules/__init__.py | '''
Modules
=======
UI module you can plug on any running Kivy apps.
'''
__all__ = ('Modules', )
from kivy.config import Config
from kivy.logger import Logger
import kivy
import os
import sys
class ModuleContext:
'''Context of a module
You can access to the config with self.config.
'''
def __init... | Python | 0.000005 | @@ -4660,16 +4660,17 @@
t Module
+s
.list()%0A
|
c20524faa5e475a37266d9a522d61fedc2fee3c4 | Make some add_language function parameters optional | utilities/add_language.py | utilities/add_language.py | # utilities.add_language
# This language utility adds support for a language to YouVersion Suggest by
# gathering and parsing data from the YouVersion website to create all needed
# language files; this utility can also be used to update any Bible data for an
# already-supported language
from __future__ import unicod... | Python | 0 | @@ -4703,16 +4703,21 @@
_version
+=None
, max_ve
@@ -4724,16 +4724,21 @@
rsion_id
+=None
):%0A%0A
|
ce2c5f8db14ce99b8add30bf2deb741f893fc3d9 | Fix missing timeout that caused no termination threads to be joined | zoe_master/scheduler.py | zoe_master/scheduler.py | # Copyright (c) 2016, Daniele Venzano
#
# 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 w... | Python | 0.000001 | @@ -2645,16 +2645,25 @@
acquire(
+timeout=1
)%0A
@@ -3029,16 +3029,91 @@
failed%0A
+ log.debug('Thread %7B%7D join failed'.format(th.name))%0A
|
1f835d57e18968d6303b6058be2466dc7809a022 | fix formatting order | launcher/bin/paramrun.py | launcher/bin/paramrun.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
import os.path as op
import re
from .. import logging, __version__
log = logging.getLogger('launcher.cli')
DLAUNCH_SCHEDFILE = '.dask-scheduler'
WORK... | Python | 0.001518 | @@ -3757,16 +3757,22 @@
+ node,
workdir
@@ -3772,22 +3772,16 @@
workdir,
- node,
nodecmd
|
41121f29cb868b9341ec505ba43eb4784104a2e5 | Add fixed find method for RIPEDatabase | lglass/database/whois.py | lglass/database/whois.py | # coding: utf-8
import socket
import lglass.rpsl
import lglass.database.base
@lglass.database.base.register
class WhoisClientDatabase(lglass.database.base.Database):
""" Simple blocking whois client database """
def __init__(self, hostspec):
self.hostspec = hostspec
def get(self, type, primary_key):
try:
... | Python | 0 | @@ -1914,16 +1914,211 @@
ostspec)
+%0A%0A%09def find(self, primary_key, types=None, flags=None):%0A%09%09if flags is not None:%0A%09%09%09flags = %22-B %22 + flags%0A%09%09else:%0A%09%09%09flags = %22-B%22%0A%09%09return WhoisClientDatabase.find(self, primary_key, types, flags)
%0A%09%0A%09def
@@ -2297,8 +2297,63 @@... |
1e4efa9e9f73cb332dc5bc624cc6d2b10ff87864 | Replace six.iteritems() with .items() | vitrage/utils/__init__.py | vitrage/utils/__init__.py | # -*- encoding: utf-8 -*-
# Copyright 2015 - Alcatel-Lucent
# Copyright © 2014-2015 eNovance
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
#
# Licensed under the Apache License, Version 2.0 (the... | Python | 0.999132 | @@ -838,19 +838,8 @@
cfg%0A
-import six%0A
%0A%0Ade
@@ -952,23 +952,16 @@
ted(
-six.iter
+d.
items(
-d
)):%0A
|
8d34d90edf77c41cd4cb1e5139fd3db6191a47d1 | Add a function to get the rolename from a filepath | lib/ansiblelint/utils.py | lib/ansiblelint/utils.py | import os
import glob
import imp
import ansible.utils
def load_plugins(directory):
result = []
fh = None
for pluginfile in glob.glob(os.path.join(directory, '[A-Za-z]*.py')):
pluginname = os.path.basename(pluginfile.replace('.py', ''))
try:
fh, filename, desc = imp.find_modul... | Python | 0.000001 | @@ -3514,28 +3514,197 @@
: th %7D)%0A return results%0A%0A
+def rolename(filepath):%0A idx = filepath.find('roles/')%0A if idx %3C 0:%0A return ''%0A role = filepath%5Bidx+6:%5D%0A role = role%5B:role.find('/')%5D%0A return role%0A
|
72973b24d673e8fda096c34780b930d631c05749 | Test for .teardown_connectors. | vumi/tests/test_worker.py | vumi/tests/test_worker.py | from twisted.trial.unittest import TestCase
from twisted.internet.defer import inlineCallbacks, succeed
from vumi.worker import BaseConfig, BaseWorker
from vumi.connectors import ReceiveInboundConnector, ReceiveOutboundConnector
from vumi.tests.utils import VumiWorkerTestCase, LogCatcher, get_stubbed_worker
from vumi.... | Python | 0 | @@ -1678,16 +1678,37 @@
ctors)%0A%0A
+ @inlineCallbacks%0A
def
@@ -1739,36 +1739,269 @@
(self):%0A
-pass
+connector = yield self.worker.setup_ri_connector('foo')%0A yield self.worker.teardown_connectors()%0A self.assertTrue('foo' not in self.worker.connectors)%0A self.assertFalse... |
b11a7c8a4a8e80534edec320dac300066f59f08b | Remove needless line | web/docker_django/urls.py | web/docker_django/urls.py | from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('kuso_wifi_server.urls', namespace='kuso_wifi_server')),
# url(r'^', include('docker_django.apps.kuso_wifi_server')),
]
| Python | 0.801924 | @@ -213,73 +213,7 @@
r'))
-,%0A # url(r'%5E', include('docker_django.apps.kuso_wifi_server')),
%0A%5D%0A
|
48440766dfd7ea381367f8d957372d262719c8e8 | Fix exit call in `SpackError.die()` | lib/spack/spack/error.py | lib/spack/spack/error.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 | @@ -1270,18 +1270,8 @@
on%0A%0A
-import os%0A
impo
@@ -2026,21 +2026,32 @@
-print
+sys.stderr.write
(self.lo
@@ -2061,16 +2061,51 @@
message)
+%0A sys.stderr.write('%5Cn')
%0A%0A
@@ -2485,12 +2485,12 @@
-o
+sy
s.
-_
exit
|
091478221106ea0260f90fd957a4753fc9a5a714 | bump 0.1.2 | jos/__init__.py | jos/__init__.py | __version__ = '0.1.1'
__author__ = 'VeryCB <imcaibin@gmail.com>'
| Python | 0.000014 | @@ -12,17 +12,17 @@
= '0.1.
-1
+2
'%0A__auth
|
7c502dc033d729e49f7878ccf1359a6b36eba4fc | remove unused import | webapp/cbmonitor/views.py | webapp/cbmonitor/views.py | import inspect
from django.shortcuts import render_to_response
def tab(request, path=None):
tab_name = {
None: "inventory",
"charts": "charts",
"snapshots": "snapshots"
}.get(path)
template = "{0}/{0}".format(tab_name) + ".jade"
return render_to_response(template, {tab_name: T... | Python | 0 | @@ -1,20 +1,4 @@
-import inspect%0A%0A
from
|
5fb0cd7b3dee73424054e9911a49ed5874d74f6d | Remove the 'raise', since it is now unnessesary | update_state.py | update_state.py | from apscheduler.schedulers.blocking import BlockingScheduler
import praw
from bs4 import BeautifulSoup
from sqlalchemy import or_
import datetime
from app import db, Stream, YoutubeStream, TwitchStream, Streamer, Submission, app, get_or_create
from utils import youtube_video_id, twitch_channel, requests_get_with_retr... | Python | 0.003219 | @@ -3292,34 +3292,16 @@
lback()%0A
- raise%0A
%0A%0Asched
@@ -6070,26 +6070,8 @@
n(e)
-%0A raise
%0A%0A
|
295931f9f499a7740e9856df186fe72940a8e0e5 | Prepare for next release | keep/version.py | keep/version.py | # Copyright 2010-2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | Python | 0 | @@ -676,17 +676,20 @@
= '0.1.2
-1
+2dev
'%0A__vers
@@ -731,13 +731,16 @@
t('0.1.2
-1
+2dev
'))%0A
|
da6e5ad478a556c45cf3d2c1deb9b6c03bb9cd2a | Correct errors in invocation of init_backend. | keyring/core.py | keyring/core.py | """
core.py
Created by Kang Zhang on 2009-07-09
"""
import os
import sys
import logging
import operator
from .py27compat import configparser
from . import logger
from . import backend
from .util import platform_ as platform
from .util import once
from .backends import fail
log = logging.getLogger(__name__)
_keyri... | Python | 0 | @@ -1555,22 +1555,8 @@
ing(
-load_config or
%0A
@@ -1603,14 +1603,22 @@
gs,
+default=
fail.
-k
+K
eyri
|
025da98441f085c7aa8302e3bebd79ce56e747fe | Remove reference to REPO_URL | kickstart-vm.py | kickstart-vm.py | #!/usr/bin/env python3
import json
import getopt, sys, os
import subprocess
def usage():
print("""
KICKSTART-VM() KICKSTART-VM()
NAME
kickstart-vm.py - build a Virtual Machine from an ISO
DESCRIPTION
This Python scripts relies on packer.io and a type-... | Python | 0 | @@ -3759,95 +3759,8 @@
le:%0A
- newline=line.replace('%7BREPO_URL%7D', os.environ%5B'REPO_URL'%5D)%0A
@@ -4092,83 +4092,8 @@
le:%0A
- newline=line.replace('%7BREPO_URL%7D', os.environ%5B'REPO_URL'%5D)%0A
|
abfe7fe8290c0ab5c5581a03a96f1cc831b5e04c | Make {% load %} tag require quotes | knights/tags.py | knights/tags.py |
import ast
from . import astlib as _a
from .parser import wrap_name_in_context, visitor
from .library import Library
register = Library()
@register.tag
def load(parser, token):
parser.load_library(token)
@register.tag
def extends(parser, token):
from .loader import load_template
args, kwargs = parse... | Python | 0.000013 | @@ -171,24 +171,223 @@
er, token):%0A
+ args, kwargs = parser.parse_args(token)%0A assert len(args) == 1, '%22load%22 tag takes only one argument.'%0A assert isinstance(args%5B0%5D, ast.Str), 'First argument to %22load%22 tag must be a string'%0A%0A
parser.l
@@ -398,21 +398,25 @@
library(
-token
+args%5... |
63f49bebadb0796ba3a4075bf430a65a16833733 | remove my test realm | krb5/network.py | krb5/network.py | import socket
import struct
from . import types
class KDCConnection(object):
def __init__(self, addr):
self.addr = addr
@staticmethod
def recv_all(socket, count):
data = ""
while count > 0:
buf = socket.recv(count)
if buf == "":
return data
... | Python | 0.000064 | @@ -1439,66 +1439,8 @@
,),%0A
- %22TOYBOX.ORG%22 : (('69.25.196.68', 88),),%0A
|
2dbad65382d850ffc5f2f72b0ee8d751e16359f8 | remove unused imports | kuyruk/queue.py | kuyruk/queue.py | from __future__ import absolute_import
import os
import errno
import socket
import logging
import traceback
from threading import RLock
import pika
from kuyruk.message import Message
from kuyruk.helpers import synchronized
logger = logging.getLogger(__name__)
class Queue(object):
def __init__(self, name, cha... | Python | 0.000001 | @@ -36,31 +36,8 @@
ort%0A
-import os%0Aimport errno%0A
impo
@@ -65,25 +65,8 @@
ing%0A
-import traceback%0A
from
|
57db28343da71b16c9df5ebd050a9b6ff8d3bf53 | fix usage of setUp. | afs/tests/dao/BosServerDAOTest.py | afs/tests/dao/BosServerDAOTest.py | #!/usr/bin/env python
"""
unit-test module for the BosServerDAO
"""
from ConfigParser import ConfigParser
import sys
import unittest
from afs.tests.BaseTest import parse_commandline
import afs.dao.BosServerDAO
import afs.model.BosServer
import afs.model.Volume
import afs.model.BNode
class TestBosServerDAOMethods(uni... | Python | 0.000001 | @@ -414,22 +414,28 @@
ef setUp
+Class
(self)
+
:%0A
@@ -6575,24 +6575,16 @@
return%0A
-
%0A%0Aif __n
|
a4ffc363c9dd35f276cdaa765d2b48bc8a9e2634 | add flags to local config | sansview/local_config.py | sansview/local_config.py | """
Application settings
"""
import time
import os
from sans.guiframe.gui_style import GUIFRAME
# Version of the application
__appname__ = "SansView"
__version__ = '1.9_RC_3'
__download_page__ = 'http://danse.chem.utk.edu'
__update_URL__ = 'http://danse.chem.utk.edu/sansview_version.php'
# Debug mess... | Python | 0.000001 | @@ -2379,16 +2379,250 @@
sView%22%0D%0A
+DATAPANEL_WIDTH = 235%0D%0AFIXED_PANEL = True%0D%0ADATALOADER_SHOW = True%0D%0ACLEANUP_PLOT = False%0D%0AWELCOME_PANEL_SHOW = False%0D%0A#Show or hide toolbar at the start up%0D%0ATOOLBAR_SHOW = True%0D%0A# set a default perspective%0D%0ADEFAULT_PERSPECTIVE = 'None'
%0D%0A%0D%... |
99357ceafe432e9f0bcc4278ec3a90d9f923e074 | disable 'children.csv' as well (500k records, no thank you) | src/main/python/hub/tests/tests_fixtures.py | src/main/python/hub/tests/tests_fixtures.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework.test import APITestCase
from hub.management.commands.loadfixtures import Command as LoadFixtures
class FixtureTest(APITestCase):
@classmethod
def setUpClass(cls):
cls.format_list = [fmt['name'] for fmt in client.get(... | Python | 0 | @@ -480,16 +480,17 @@
mployee'
+,
# exce
@@ -545,16 +545,39 @@
terlis1%0A
+ 'children' # same%0A
%5D%0A%0A%0Adef
|
0421087e7feb3bd2c8386b41df6cdba58a3b35a1 | Update notice | shadowsocks/config_example.py | shadowsocks/config_example.py | # !!! Please rename this file as config.py BEFORE editing it !!!
import logging
# !!! Do NOT touch this line !!!
CONFIG_VERSION = '20160623-1'
# Database Config
MYSQL_HOST = 'mengsky.net'
MYSQL_PORT = 3306
MYSQL_USER = 'root'
MYSQL_PASS = 'root'
MYSQL_DB = 'shadowsocks'
MYSQL_USER_TABLE = 'user'
MYSQL_TIMEOUT = 30
#... | Python | 0 | @@ -84,34 +84,204 @@
!!!
-Do NOT touch this line !!!
+Only edit this line when you update your configuration file !!!%0A# After you update, the value of CONFIG_VERSION in config.py and%0A# config_example.py should be the same in order to start the server
%0ACON
|
925904a63a70fb7f28ab540b666b3d9e88401021 | Fix image logo | server/src/weblab/core/webclient/helpers.py | server/src/weblab/core/webclient/helpers.py | from __future__ import print_function, unicode_literals
from collections import defaultdict
from functools import wraps
import json
import os
import re
import time
import urlparse
from weblab.core.wl import weblab_api
from flask import current_app, url_for, request
class WebError(Exception):
pass
def json_exc(fu... | Python | 0.000065 | @@ -3998,16 +3998,17 @@
ture', '
+/
img/expe
|
0b7730e97a64e87a1d0d5ba27290f56fd057ce26 | use a_0_0 in lode.py | samples/lode/lode.py | samples/lode/lode.py | from railgun import SimObject, relpath
class LinearODE(SimObject):
"""
Solve D-dimensional linear ordinary differential equations
Equation::
dX/dt(t) = A X(t)
X: D-dimensional vector
A: DxD matrix
"""
_clibname_ = 'liblode.so' # name of shared library
_clibdir_ = re... | Python | 0.000068 | @@ -1036,16 +1036,22 @@
c-member
+ %22VAR%22
via lod
@@ -1092,16 +1092,17 @@
%5D%5D%0A x
+1
= lode.
@@ -1110,54 +1110,217 @@
un()
-%0A%0A import pylab%0A pylab.subplot(211)%0A
+.copy()%0A lode.setv(a_0_0=-0.5) # set lode.a%5Bi%5D%5Bj%5D=v via lode.set(a_'i'_'j'=v)%0A x2 = lode.run().copy()%0A%0A ... |
8f4d7c6f20f697e7e4302459bceea4a1c22691b7 | Remove Fee Model migration | ratechecker/migrations/0001_initial.py | ratechecker/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import localflavor.us.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Adjustment',
fields=[
... | Python | 0 | @@ -1567,916 +1567,8 @@
el(%0A
- name='Fee',%0A fields=%5B%0A ('fee_id', models.AutoField(serialize=False, primary_key=True)),%0A ('product_id', models.IntegerField()),%0A ('state_id', localflavor.us.models.USStateField(max_length=2)),%0A ... |
72c856a83d6dd538d6832027bf335f5ee3a70c30 | Print in a way that's valid constructor | scan/commands/Comment.py | scan/commands/Comment.py | '''
Created on Mar 8,2015
@author: qiuyx
'''
from scan.commands.Command import Command
import xml.etree.ElementTree as ET
class Comment(Command):
'''
Command to add comment.
SubClass of Command
'''
def __init__(self, text="This is an example comment."):
'''
@param text: Commen... | Python | 0.000001 | @@ -598,42 +598,26 @@
urn
-'Comment(Comment='+self.__text+')'
+self.toCmdString()
%0A
@@ -730,17 +730,17 @@
urn
-'
+%22
Comment(
Comm
@@ -739,18 +739,17 @@
ent(
-Comment='+
+'%25s')%22 %25
self
@@ -759,12 +759,8 @@
text
-+')'
%0A
|
e316576e519dbf1b0f96726cfa431c7e112d850a | Add docstirng for Plot | PyOpenWorm/plot.py | PyOpenWorm/plot.py | from PyOpenWorm import *
class Plot(DataObject):
"""
Object for storing plot data in PyOpenWorm.
Must be instantiated with a 2D list of coordinates.
"""
def __init__(self, data=False, *args, **kwargs):
DataObject.__init__(self, **kwargs)
Plot.DatatypeProperty('_data_string', self... | Python | 0 | @@ -109,47 +109,89 @@
-Must be instantiated with a 2D l
+Parameters%0A ----------%0A%0A data : 2D list (list of lists)%0A L
ist of
+XY
coor
@@ -197,17 +197,146 @@
rdinates
-.
+ for this Plot.%0A%0A Example usage ::%0A %3E%3E%3E pl = Plot(%5B%5B1, 2%5D, %5B3, 4%5D%5D)%0A %3E%3E%3... |
640d8fa43213b326bcef4f3e5f8cb3206f45f0f2 | improve comment | datajoint/connection.py | datajoint/connection.py | """
This module contains the Connection class that manages the connection to the database,
and the `conn` function that provides access to a persistent connection in datajoint.
"""
import warnings
from contextlib import contextmanager
import pymysql as client
import logging
from getpass import getpass
from pymysql imp... | Python | 0 | @@ -8577,17 +8577,16 @@
xample:%0A
-%0A
@@ -8703,17 +8703,16 @@
en here%0A
-%0A
|
3669a8dfd773e6b46f7853d9d74ddbbf4817a4e3 | Fixing API for muscles() | PyOpenWorm/worm.py | PyOpenWorm/worm.py | # -*- coding: utf-8 -*-
from .dataObject import DataObject
from .muscle import Muscle
from .cell import Cell
from .network import Network
class Worm(DataObject):
"""
A worm.
All worms with the same name are considered to be the same object.
Attributes
----------
neuron_network : ObjectProper... | Python | 0.99804 | @@ -1276,19 +1276,18 @@
urns: A
-li
s
+e
t of all
@@ -1320,11 +1320,10 @@
pe:
-li
s
+e
t%0A
@@ -1325,32 +1325,129 @@
et%0A %22%22%22%0A
+ return set(x.name.one() for x in self._muscles_helper())%0A%0A def _muscles_helper(self):%0A
for x in
|
10981892c236658dd3d4d9cd6caceedf300088bb | Remove unused import | scripts/rename.py | scripts/rename.py | import logging
from cqlengine import Token, BatchQuery
from scrapi import settings
from scrapi.database import _manager
from scrapi.linter import RawDocument
from scrapi.processing.elasticsearch import es
from scrapi.processing.cassandra import DocumentModel
from scrapi.tasks import normalize, process_normalized, pro... | Python | 0.000001 | @@ -40,20 +40,8 @@
oken
-, BatchQuery
%0A%0Afr
|
16fa50ae128b19479484a2f3d9c2c8b77f4c27b4 | Remove the test for abspath with an empty path - too hard to do in a cross-platform manner. | Lib/test/test_ntpath.py | Lib/test/test_ntpath.py | import ntpath
import string
import os
errors = 0
def tester(fn, wantResult):
fn = string.replace(fn, "\\", "\\\\")
gotResult = eval(fn)
if wantResult != gotResult:
print "error!"
print "evaluated: " + str(fn)
print "should be: " + str(wantResult)
print " returned: " + str(gotResult)
print ""
global err... | Python | 0 | @@ -1273,50 +1273,8 @@
%5C%22)%0A
-tester('ntpath.abspath(%22%22)', os.getcwd())%0A
%0A%0Aif
|
d59f6412c6f3103e6bd36f23ad9b0eb86b9c6069 | fix what was likely a typo, and make a default return value | scrapi/harvesters/bhl.py | scrapi/harvesters/bhl.py | """Harvests Biodiversity Heritage Library OAI Repository (BHL) metadata for ingestion into the SHARE service.
Example API call: http://www.biodiversitylibrary.org/oai?verb=ListRecords&metadataPrefix=oai_dc&from=2015-02-01
"""
import re
from scrapi.base import OAIHarvester
from scrapi.base.helpers import updated_schema,... | Python | 0.000112 | @@ -903,15 +903,15 @@
mes)
+%5D
or %5B%5D
-%5D
%0A
@@ -992,16 +992,17 @@
return
+(
default_
@@ -1052,16 +1052,35 @@
er(inst)
+) or %5B%7B'name': ''%7D%5D
%0A%0A%0Aclass
|
f39d97d20b176bd5549714288643f04ee5d441c3 | add __all__ for import * | datatank_py/__init__.py | datatank_py/__init__.py | Python | 0.000007 | @@ -1 +1,618 @@
+#!/usr/bin/env python%0A# coding: utf-8%0A%0A# from glob import glob%0A# %5Bx.strip(%22.py%22) for x in glob(%22*.py%22)%5D%0A%0A__all__ = %5B'DTBitmap2D', 'DTDataFile', 'DTError', 'DTMask', 'DTMesh2D', 'DTPath2D', 'DTPathValues2D', 'DTPlot1D', 'DTPoint2D', 'DTPointCollection2D', 'DTPointValue2D', 'DTP... | |
de5f8266a837d7145276f47e89093efad13b14e4 | Implement getPosition and getGlobalPosition in SceneNode | Cura/Scene/SceneNode.py | Cura/Scene/SceneNode.py | from Cura.Math.Matrix import Matrix
from Cura.Signal import Signal, SignalEmitter
from copy import copy, deepcopy
import math
## A scene node object.
#
# These objects can hold a mesh and multiple children. Each node has a transformation matrix
# that maps it it's parents space to the local space (it's inverse m... | Python | 0 | @@ -29,16 +29,52 @@
Matrix%0A
+from Cura.Math.Vector import Vector%0A
from Cur
@@ -5804,32 +5804,305 @@
ged.emit(self)%0A%0A
+ def getPosition(self):%0A pos = self._transformation.getData()%0A return Vector(pos%5B0,3%5D, pos%5B1,3%5D, pos%5B2,3%5D)%0A%0A def getGlobalPosition(self):%0A po... |
e0d75fae9ec08c82c70b0997a6a27fcc8febe2d3 | add a drain after a bad response from the HSM | pyhsm/cmd.py | pyhsm/cmd.py | """
module for accessing a YubiHSM
"""
# Copyright (c) 2011 Yubico AB
# See the file COPYING for licence statement.
import re
import struct
__all__ = [
# constants
# functions
'reset',
# classes
'YHSM_Cmd',
]
import pyhsm.exception
import pyhsm.defines
class YHSM_Cmd():
"""
Base class f... | Python | 0 | @@ -5656,32 +5656,54 @@
uire()%0A try:%0A
+ stick.drain()%0A
stick.fl
|
cf44a52789d316f44ada4d8ce0e8195db4c43808 | Check that revision is a safe subset of characters (e.g. no escaping to shell) | scriptorium/templates.py | scriptorium/templates.py | #!/usr/bin/env python
"""Tools for reasoning over templates."""
import subprocess
import re
import os
import os.path
import scriptorium
def all_templates(dname):
"""Builds list of installed templates."""
templates = []
for dirpath, _, filenames in os.walk(dname):
if 'setup.tex' in filenames:
... | Python | 0 | @@ -1876,14 +1876,88 @@
-if rev
+treeish_re = re.compile(r'%5BA-Za-z0-9_-.%5D+')%0A if rev and treeish_re.match(rev)
:%0A
@@ -2525,16 +2525,106 @@
strip()%0A
+ treeish_re = re.compile(r'%5BA-Za-z0-9_-.%5D+')%0A if treeish_re.match(rev):%0A
|
613491f5057753cf6508d8f90a507d2ee5055c6d | Remove the libreoffice custom formatting string for combo boxes | src/orca/scripts/apps/soffice/formatting.py | src/orca/scripts/apps/soffice/formatting.py | # Orca
#
# Copyright 2005-2009 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This... | Python | 0 | @@ -1536,203 +1536,8 @@
%7D,%0A
- pyatspi.ROLE_COMBO_BOX: %7B%0A 'focused': 'name + positionInList + availability',%0A 'unfocused': 'labelAndName + roleName + positionInList + availability'%0A %7D,%0A
|
3b9c1339dbe6e37477476a5cb198aec38a6dee99 | Return None for dates that can't be converted to a datetime.date. | dbfread/field_parser.py | dbfread/field_parser.py | """
Parser for DBF fields.
"""
import struct
import datetime
from .common import parse_string
class FieldParser:
def __init__(self, encoding):
"""Create a new field parser
encoding is the character encoding to use when parsing
strings."""
self.encoding = encoding
def str(se... | Python | 0.999751 | @@ -1525,32 +1525,67 @@
8%5D)%0A
+%0A try: %0A
return datetime.
@@ -1607,16 +1607,75 @@
h, day)%0A
+ except ValueError:%0A return None%0A
|
cd511fb5a14528214705b1a02385f307939132fa | Rewrite easycert P12 test | synapse/tests/test_tools_easycert.py | synapse/tests/test_tools_easycert.py | from synapse.tests.common import *
import synapse.tools.easycert as s_easycert
class TestEasyCert(SynTest):
def test_easycert_user_p12(self):
with self.getTestDir() as path:
outp = self.getTestOutp()
argv = ['--ca', '--certdir', path, 'testca']
self.eq(s_easycert.mai... | Python | 0.001473 | @@ -175,32 +175,33 @@
tDir() as path:%0A
+%0A
outp
@@ -214,33 +214,32 @@
f.getTestOutp()%0A
-%0A
argv
@@ -362,226 +362,602 @@
rue(
-str(outp).find('cert saved'))%0A%0A argv = %5B'--certdir', path, '--signas', 'testca', 'user@test.com'%5D%0A self.eq(s_easycert.main(argv... |
550dee3e13a0ee80d0bd9338c281e51fefdcfdc8 | Add format with slack attachments. | slack_log_handler/__init__.py | slack_log_handler/__init__.py | import traceback
from logging import Handler
from slacker import Chat
class SlackLogHandler(Handler):
def __init__(self, api_key, channel, stack_trace=False, username='Python logger', icon_url=None, icon_emoji=None):
Handler.__init__(self)
self.slack_chat = Chat(api_key)
self.channel = ch... | Python | 0 | @@ -1,12 +1,24 @@
+import json%0A
import trace
@@ -22,16 +22,16 @@
aceback%0A
-
from log
@@ -71,20 +71,23 @@
import
-Chat
+Slacker
%0A%0A%0Aclass
@@ -293,12 +293,15 @@
t =
-Chat
+Slacker
(api
@@ -880,63 +880,254 @@
-self.slack_chat.post_
+attachments = %5B%7B%0A 'fallback': self.username,%0A ... |
c88cdf8c10def4b6a2be5556a04e793fe571053c | fix transaction management for 1.6 | smartmin/csv_imports/tasks.py | smartmin/csv_imports/tasks.py | import StringIO
from smartmin import class_from_string
from django.utils import timezone
from .models import ImportTask
from time import sleep
from celery.task import task
@task(track_started=True)
def csv_import(task_id): #pragma: no cover
from django.db import transaction
# there is a possible race condit... | Python | 0 | @@ -135,16 +135,74 @@
rt sleep
+%0Afrom distutils.version import StrictVersion%0Aimport django
%0A%0Afrom c
@@ -811,16 +811,119 @@
eep(1)%0A%0A
+ log = StringIO.StringIO()%0A%0A if StrictVersion(django.get_version()) %3C StrictVersion('1.6'):%0A%0A
tran
@@ -961,24 +961,28 @@
ement()%0A
+
+
t... |
ebf88f6a656d598972e7bd286a4398709b5780ec | add srcHost to hone job criterion | Controller/hone_partition.py | Controller/hone_partition.py | # Copyright (c) 2011-2013 Peng Sun. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYRIGHT file.
# hone_partition.py
# partition the instance of honeDataFlow into honePartitionedFlow
# return to rts
from hone_lib import *
from hone_message import *
from ... | Python | 0 | @@ -761,18 +761,57 @@
= %7B'app'
-
+: %5B%5D,%0A 'srcHost'
: %5B%5D,%0A
@@ -1293,32 +1293,205 @@
ret = False%0A
+ for hostId in self.criterion%5B'srcHost'%5D:%0A if hostId == hostEntry.hostId:%0A ret = ret and True%0A else:%0A ... |
4d3ad505f93fb1cf5d5c716ce115717462fbdc0a | Add FormalIntegrator as an Interface | tardis/montecarlo/formal_integral.py | tardis/montecarlo/formal_integral.py | from astropy import units as u
from tardis.montecarlo.montecarlo import formal_integral
from tardis.montecarlo.spectrum import TARDISSpectrum
class FormalIntegrator(object):
def __init__(self, model, plasma, runner):
self.model = model
self.plasma = plasma
self.runner = runner
def c... | Python | 0 | @@ -1,12 +1,51 @@
+import numpy as np%0Aimport pandas as pd%0A
from astropy
@@ -396,16 +396,166 @@
=1000):%0A
+ # Very crude implementation%0A # The c extension needs bin centers (or something similar)%0A # while TARDISSpectrum needs bin edges%0A
@@ -619,16 +619,44 @@
nosity =
+ u.Quan... |
5223021e6611b46bce71423f070bfcddbe66f730 | Remove unnecessary imports from scuba.__main__ | scuba/__main__.py | scuba/__main__.py | #!/usr/bin/env python2
# SCUBA - Simple Container-Utilizing Build Architecture
# (C) 2015 Jonathon Reinhart
# https://github.com/JonathonReinhart/scuba
from __future__ import print_function
import os, os.path
import errno
import sys
import subprocess
import shlex
import itertools
import argparse
from tempfile import ... | Python | 0.000014 | @@ -349,33 +349,8 @@
exit
-%0Aimport pipes%0Aimport json
%0A%0Afr
|
fa5a279a4585ce1c2ae04e15191020a057c49c2d | Replace `property.SingleResource` with (newer) `reference.SingleResource`. | src/zeit/content/portraitbox/portraitbox.py | src/zeit/content/portraitbox/portraitbox.py |
from zeit.cms.i18n import MessageFactory as _
import lxml.builder
import lxml.objectify
import zeit.cms.content.property
import zeit.cms.content.xmlsupport
import zeit.cms.interfaces
import zeit.cms.type
import zeit.content.portraitbox.interfaces
import zeit.wysiwyg.html
import zope.interface
class Portraitbox(zeit.... | Python | 0 | @@ -115,16 +115,50 @@
roperty%0A
+import zeit.cms.content.reference%0A
import z
@@ -841,24 +841,25 @@
content.
-property
+reference
.SingleR
@@ -921,47 +921,8 @@
age'
-,%0A attributes=('base_id', 'src')
)%0A%0A%0A
|
2f1a05fd8013cbc0723d836a9de8982d235c7aa1 | fix OS X makefile action | scripts/gen/build/osx.py | scripts/gen/build/osx.py | from gen.build.nix import cc_cmd, ld_cmd
from gen.build.gmake import Makefile
from gen.env.nix import NixConfig, default_env
from gen.env.env import BuildEnv
from gen.path import Path, TYPE_DESCS
import re
NON_ALPHA_NUM = re.compile('[^A-Za-z0-9]+')
def make_exe_name(name):
name = NON_ALPHA_NUM.sub('', name)
i... | Python | 0.000003 | @@ -419,19 +419,19 @@
config('
-OSX
+osx
')%0A b
@@ -457,19 +457,19 @@
onfig, '
-OSX
+osx
')%0A b
@@ -488,32 +488,8 @@
nv(%0A
- config.project,%0A
@@ -513,19 +513,19 @@
onfig, '
-OSX
+osx
'),%0A
@@ -543,16 +543,81 @@
ig(base)
+,%0A bcfg.all_modules(),%0A config.project.modul... |
9a86c9bd30e06daa20e4a4872d9292d177d66c8a | Clean source directory before building tests in object directories. | scripts/gen_run_tests.py | scripts/gen_run_tests.py | #!/usr/bin/env python
from itertools import combinations
from os import uname
from multiprocessing import cpu_count
nparallel = cpu_count() * 2
uname = uname()[0]
def powerset(items):
result = []
for i in xrange(len(items) + 1):
result += combinations(items, i)
return result
possible_compilers ... | Python | 0 | @@ -641,16 +641,69 @@
set -e'%0A
+print 'if %5B -f Makefile %5D ; then make relclean ; fi'%0A
print 'a
|
50f3804301549cbba1c1ca6d2bc5fb1d2e500d12 | make sure output dir exists | scripts/processConfig.py | scripts/processConfig.py | #! /usr/bin/env python
# This is an example of using a pre-build script to process the merged config
# file, to generate a header (prebuild-demo/defs.h), which can be #included by
# other modules
import json
import os
def generateDefinitions(config):
definitions = ''
expose_definitions = '$exposeDef' in con... | Python | 0.000184 | @@ -749,16 +749,97 @@
config)%0A
+ if not os.path.exists('./expose-defs'):%0A os.makedirs('./expose-defs')%0A
with
|
ed68bd18b88f349a7348006a2e14cdddbc993da7 | Upgrade libchromiumcontent to Chrome 37. | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
NODE_VERSION = 'v0.11.13'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'afb4570ceee2ad10f3caf5a81335a2ee11ec68a5'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[... | Python | 0 | @@ -181,48 +181,48 @@
= '
-afb4570ceee2ad10f3caf5a81335a2ee11ec68a5
+ea1a7e85a3de1878e5656110c76f4d2d8af41c6e
'%0A%0AA
|
ca79a5a66638b08b551471eeca85d75ebae61218 | make it executable | scripts/bleu_sent.py | scripts/bleu_sent.py | # -*- coding: utf-8 -*-
import io
import fire
from nltk.translate.bleu_score import SmoothingFunction, sentence_bleu
def main(ref, hyp, out):
smoothing_func = SmoothingFunction()
with io.open(out, 'w', encoding='utf-8') as out_f, \
io.open(ref, 'r', encoding='utf-8') as ref_f, \
io.open(hyp,... | Python | 0.999989 | @@ -1,8 +1,31 @@
+#!/usr/bin/env python3%0A
# -*- co
|
f1e71839ea467555600a90fbd25d1fd3f5509d5b | fix grammar | scripts/gen_regex.py | scripts/gen_regex.py | import argparse
import unicodedata
import chardata
import pathlib
DATA_PATH = pathlib.Path(resource_filename('wordfreq', 'data'))
def _emoji_char_class():
"""
Build a regex for emoji substitution. First we create a regex character set
(like "[a-cv-z]") matching characters we consider emoji The final rege... | Python | 0.999999 | @@ -298,16 +298,17 @@
er emoji
+.
The fin
|
f20156beb47f860646f31b46ff69879e190d220d | Add job console output to firebase | scripts/postbuild.py | scripts/postbuild.py | #!/usr/bin/python3
import sys
import jenkins
from firebase import firebase
JENKINS_URL = '' # Enter Jenkins URL like http://localhost:8080
JENKINS_USERNAME = '' # Enter available Jenkins username
JENKINS_APITOKEN = '' # Enter Jenkins API token (or password if Jenkins < 1.5)
FIREBASE_DSN = '' # Enter your firebase ... | Python | 0.000001 | @@ -607,16 +607,93 @@
_number)
+%0A console_output = server.get_build_console_output(job_name, build_number)
%0A%0A fi
@@ -1151,8 +1151,167 @@
, data)%0A
+%0A # Post new job console output to firebase%0A data = %7B'output': console_output%7D%0A firebase.put('/job_console/' + firebase_job_name, build_n... |
0c3a2d56451e3e4a3d574b051a2333979f19c38c | change something to test | scripts/util/util.py | scripts/util/util.py | """Utilities that make life easier."""
import tensorflow as tf
def get_data(batch_size, sequence_length, dataset):
"""Gets a dict with the things needed for the data, including placeholders
Args:
batch_size (int): sequences per batch.
sequence_length (int): length of sequences concerned (for ... | Python | 0.000001 | @@ -1311,12 +1311,45 @@
or('
-...'
+not even sure this one is a good idea
)%0A
|
2d97b9217d01708788ab78ea84d9b857d593f37d | Use urllib package for urlparse. | scripts/viewFFpat.py | scripts/viewFFpat.py | #!/usr/bin/python
"""A simple viewer for legacy far-field pattern files."""
import argparse
import math
import numpy
import os.path
from urlparse import urlparse
from antpat.reps.sphgridfun import tvecfun
from antpat.radfarfield import RadFarField
from antpat.reps.vsharm.vshfield import vshField
from antpat.reps.vsharm... | Python | 0 | @@ -129,24 +129,28 @@
ath%0Afrom url
+lib.
parse import
|
5cdccbf7a6c3ff15ff66ae4634929546c3d52721 | Add Datasource parent class | DebianChangesBot/__init__.py | DebianChangesBot/__init__.py | Python | 0 | @@ -0,0 +1,201 @@
+import urllib2%0A%0Aclass Datasource(object):%0A class DataError(Exception): pass%0A%0A def update(self):%0A fileobj = urllib2.urlopen(self.URL)%0A return self.parse(fileobj)%0A%0Aimport datasources%0A
| |
80b49dfb9fd9b2b7321f40508b267bad5fde3cea | use chunked iterator | corehq/apps/data_interfaces/management/commands/get_case_rule_submissions.py | corehq/apps/data_interfaces/management/commands/get_case_rule_submissions.py | import csv
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
from corehq.apps.data_interfaces.models import CaseRuleSubmission
from corehq.util.argparse_types import date_type
from corehq.util.log import with_progress_bar
class Command(BaseCommand):
help = "Output f... | Python | 0.000001 | @@ -263,16 +263,69 @@
ess_bar%0A
+from corehq.util.queries import queryset_to_iterator%0A
%0A%0Aclass
@@ -2498,16 +2498,97 @@
ived%22%5D)%0A
+ iterator = queryset_to_iterator(qs, CaseRuleSubmission, limit=10000)%0A
@@ -2627,18 +2627,24 @@
ess_bar(
-qs
+iterator
, count)
|
6e6e5e579fdf427aea6ff77c40ef029aa30c75e6 | Print task name and rgi_id on error while multiprocessing | oggm/workflow.py | oggm/workflow.py | """Wrappers for the single tasks, multi processor handling."""
from __future__ import division
# Built ins
import logging
import os
from shutil import rmtree
import collections
# External libs
import pandas as pd
import multiprocessing as mp
# Locals
import oggm
from oggm import cfg, tasks, utils
# MPI
try:
impo... | Python | 0 | @@ -1708,16 +1708,33 @@
gdir):%0A
+ try:%0A
@@ -1772,24 +1772,28 @@
.Sequence):%0A
+
@@ -1825,24 +1825,28 @@
+
gdir_kwargs
@@ -1894,32 +1894,36 @@
gs)%0A
+
return self.call
@@ -1953,30 +1953,38 @@
gs)%0A
+
+
else:%0A
+
... |
dedcb6bcabe3d8d6758dcee607e8c33b174d782b | Bump to 2.0.0. | kivy/_version.py | kivy/_version.py | # This file is imported from __init__.py and exec'd from setup.py
MAJOR = 2
MINOR = 0
MICRO = 0
RELEASE = False
__version__ = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
if not RELEASE:
# if it's a rcx release, it's not proceeded by a period. If it is a
# devx release, it must start with a period
__version__ += '... | Python | 0 | @@ -104,12 +104,11 @@
E =
-Fals
+Tru
e%0A%0A_
|
a60e4cfded93ad22f7c59200658fbf96270e97c7 | disable ssl param ?? | src/django_fixmystreet/fixmystreet/urls.py | src/django_fixmystreet/fixmystreet/urls.py | from django.conf.urls.defaults import *
from django.conf import settings
from django.http import HttpResponseRedirect
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.views.generic.simple import direct_to_template
from django_fixmystreet.fixmystreet.feeds import L... | Python | 0 | @@ -824,17 +824,19 @@
ite.urls
-,
+),#
%7B'SSL':S
|
f8e4334514a622fa7541e0b82800fdbc717e8838 | Add notes to sketch for priorityq. refs #10 | priorityq.py | priorityq.py | from __future__ import unicode_literals
from functools import total_ordering
from binary_heap import BinaryHeap
@total_ordering # Will build out the remaining comparison methods
class QNode(object):
"""A class for a queue node."""
def __init__(self, val, priority=None):
super(QNode, self).__init__()... | Python | 0 | @@ -280,46 +280,8 @@
e):%0A
- super(QNode, self).__init__()%0A
@@ -851,77 +851,361 @@
-pass%0A%0A def insert(item):%0A %22%22%22Insert an item into the queue.
+%22%22%22We can iteratively use insert here.%22%22%22%0A pass%0A%0A def insert(item): # Wamt to extend spec to include ... |
59dc6605af2aba9c94201b5b08e614015c8824dc | Use localtime function | example/example.py | example/example.py | import netuitive
import time
import os
ApiClient = netuitive.Client(url=os.environ.get('API_URL'), api_key=os.environ.get('CUSTOM_API_KEY'))
MyElement = netuitive.Element()
MyElement.add_attribute('Language', 'Python')
MyElement.add_attribute('app_version', '7.0')
MyElement.add_relation('my_child_element')
MyEleme... | Python | 0.000011 | @@ -422,10 +422,13 @@
ime.
-gm
+local
time
|
1a0e86f11ddac5ff4842e87cfc6796670866ca0f | Update item_attribute.py | erpnext/stock/doctype/item_attribute/item_attribute.py | erpnext/stock/doctype/item_attribute/item_attribute.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class ItemAttribute(Document):
def validate(self):
self.valid... | Python | 0.000001 | @@ -1204,14 +1204,12 @@
as
-it has
+Item
Var
@@ -1213,16 +1213,42 @@
Variants
+ exist with this Attribute
.%22).form
@@ -1267,8 +1267,9 @@
f.name))
+%0A
|
4050d3f6e71b899049147c9f1c048abf7a0c17d9 | Debug linebreak consistency fixed | openclass/api.py | openclass/api.py | import json, requests, urllib
class OpenClassAPI(object):
"""
OpenClassAPI class handles all requests to and from Pearson's OpenClass.com API.
Example: get info on a course.
>>> oc_api = OpenClassAPI('sam@classowl.com', 'password', 'openclass_api_key')
>>> r = oc_api.make_request... | Python | 0 | @@ -1743,32 +1743,16 @@
f.debug:
-%0A
print '
@@ -1927,24 +1927,8 @@
bug:
-%0A
pri
@@ -1969,16 +1969,17 @@
iation'%0A
+%0A
@@ -3890,36 +3890,24 @@
self.debug:
-%0A
print 'Auth
|
daa3619c557f084daccbd4bc1468a7437164305e | fix renamed run() parameter in cube_directproj.py | examples/Mechanics/DirectProjection/cube_directproj.py | examples/Mechanics/DirectProjection/cube_directproj.py | #!/usr/bin/env python
#
# Example of one object under gravity with one contactor and a ground
#
from siconos.mechanics.collision.tools import Contactor
from siconos.io.mechanics_io import Hdf5
import siconos.numerics as Numerics
import siconos.kernel as Kernel
# Creation of the hdf5 file for input/output
with Hdf5()... | Python | 0 | @@ -2728,17 +2728,17 @@
-n
+N
ewton_up
|
50c55041b3309d8496c57832b585db9a3a1289d9 | Fix the python part | openmc/source.py | openmc/source.py | from numbers import Real
import sys
from xml.etree import ElementTree as ET
from openmc._xml import get_text
from openmc.stats.univariate import Univariate
from openmc.stats.multivariate import UnitSphere, Spatial
import openmc.checkvalue as cv
class Source(object):
"""Distribution of phase space coordinates for... | Python | 0.999857 | @@ -1913,31 +1913,24 @@
self.
-source_
library = li
@@ -4046,31 +4046,24 @@
if self.
-source_
library is n
@@ -4111,23 +4111,16 @@
%22, self.
-source_
library)
@@ -5225,23 +5225,16 @@
source.
-source_
library
|
db1e14ecabaaf39873c18ea7156eab085d89af08 | Add support for backend section in .system | orpsoc/system.py | orpsoc/system.py | import sys
if sys.version[0] == '2':
import ConfigParser as configparser
else:
import configparser
from orpsoc.core import Core
from orpsoc.config import Config
import os
DEFAULT_VALUES = {'name' : '',
'cores' : '',
'simulators' : '',
... | Python | 0.000001 | @@ -1140,24 +1140,240 @@
').split()%0A%0A
+ self.backend_name = system_config.get('main','backend')%0A if self.backend_name and system_config.has_section(self.backend_name):%0A self.backend = dict(system_config.items(self.backend_name))%0A%0A
def setu
|
ba7c59bc0ad31658ae741ba7d0ddf0e0bc1d36d4 | Update production URL to the right one (#1903) | src/shipit/api/setup.py | src/shipit/api/setup.py | # -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import setuptools
def read_requirements(file_):
lines = []
with open(file_) as f:
... | Python | 0 | @@ -1371,18 +1371,18 @@
s://
-api.
shipit
+-api
.moz
|
7760e9e811524e8fdc3599169d12d12f4ff89421 | delete data sql | delete_entry.py | delete_entry.py | import psycopg2
import sys
from connect import connect_to_db
# edit data from arguments in command line
# filename counts as first arg
args = sys.argv
date_to_delete = args[1] # second arg
# adding items to data
data = date_to_delete
# connect to database
conn = connect_to_db()
cur = conn.cursor()
# SQL for insert... | Python | 0.000042 | @@ -346,20 +346,20 @@
%22DELETE
-from
+FROM
BBT_CHA
|
35a6a8e05fe885c9d3fc95110b5cef38653919c7 | make instances.getInstanceId() more versatile by accepting VFS() and Flavor() instances | conary/repository/netrepos/instances.py | conary/repository/netrepos/instances.py | #
# Copyright (c) 2004-2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/perma... | Python | 0 | @@ -665,16 +665,74 @@
N = 2%0A%0A
+from conary import versions%0Afrom conary.deps import deps%0A%0A
class In
@@ -3395,17 +3395,17 @@
or a n,v
-
+,
f string
@@ -3446,16 +3446,259 @@
rsor()%0A%0A
+ vStr = troveVersion%0A if isinstance(troveVersion, versions.Version):%0A vStr = troveVersion... |
9c6b5bc39f272926e92c1c4a5a7aeed2436c61b5 | Update config.py | linepy/config.py | linepy/config.py | # -*- coding: utf-8 -*-
from akad.ttypes import ApplicationType
import re
class Config(object):
LINE_HOST_DOMAIN = 'https://gd2.line.naver.jp'
LINE_OBS_DOMAIN = 'https://obs-sg.line-apps.com'
LINE_TIMELINE_API = 'https://gd2.line.naver.jp/mh/api'
LINE_TIMELINE_MH ... | Python | 0 | @@ -1267,16 +1267,161 @@
(self):%0A
+ #sniff chrome headers and use those instead, because these will get you messagebanned%0A self.USER_AGENT = 'Line/%25s' %25 self.APP_VER%0A
@@ -1524,55 +1524,4 @@
ER)%0A
- self.USER_AGENT = 'Line/%25s' %25 self.APP_VER%0A
|
b62ddfdbabc985275d6c0a278d408377757a3405 | fix logic misstake | execnet/gateway.py | execnet/gateway.py | """
gateway code for initiating popen, socket and ssh connections.
(c) 2004-2013, Holger Krekel and others
"""
import sys
import os
import inspect
import types
import linecache
import textwrap
import execnet
from execnet.gateway_base import Message
from execnet import gateway_base
importdir = os.path.dirname(os.path.d... | Python | 0.000027 | @@ -6417,20 +6417,17 @@
ion.
-func
+_
_closure
%0A
@@ -6422,16 +6422,18 @@
_closure
+__
%0A
@@ -6456,17 +6456,16 @@
ion.
-func
+_
_code
+__
%0A
@@ -6494,33 +6494,36 @@
= function.
-_
+func
_closure
__%0A c
@@ -6502,34 +6502,32 @@
ion.func_closure
-__
%0A codeobj
@@ -6538,24 +653... |
e6d5b3d09b284f0c12e54bd7dc51f9175d7e189c | implement Output edit menu | settingMod/Output.py | settingMod/Output.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage rendering output path'''
import xml.etree.ElementTree as xmlMod
import os
class Output:
'''class to manage rendering output path'''
def __init__(self, xml= None):
'''initialize output path with default value or values extracted from an xml object'''... | Python | 0.000027 | @@ -1041,16 +1041,432 @@
nu'''%0A%09%09
+change = False%0A%09%09log.menuIn('Output Path')%0A%09%09%0A%09%09while True:%0A%09%09%09os.system('clear')%0A%09%09%09log.print()%0A%09%09%09%0A%09%09%09print('%5Cn')%0A%09%09%09self.print()%0A%09%09%09%0A%09%09%09print('''%5Cn%5Cn %5C033%5B4mMenu :%5C033%5B4m%0A1- Edit... |
aad7de011046ca0068f31da4cf6c8e9104ccc8f7 | add required import for connections | explorer/schema.py | explorer/schema.py | from collections import defaultdict
from django.utils.module_loading import import_string
from explorer.app_settings import (
EXPLORER_SCHEMA_INCLUDE_TABLE_PREFIXES,
EXPLORER_SCHEMA_EXCLUDE_TABLE_PREFIXES,
EXPLORER_SCHEMA_BUILDERS
)
# These wrappers make it easy to mock and test
def _get_includes():
... | Python | 0 | @@ -29,16 +29,62 @@
ultdict%0A
+from django.db import connection, connections%0A
from dja
|
22e0eb225a49a9dd0ab38df35ada35fc9b4e5560 | add applierValues function | library/pyjamas/ui/__init__.py | library/pyjamas/ui/__init__.py | # Copyright 2006 James Tauber and contributors
# Copyright 2009 Luke Kenneth Casson Leighton
#
# 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... | Python | 0.000001 | @@ -2009,12 +2009,366 @@
fn(args)%0A%0A
+ def applierValues(self, *args):%0A %22%22%22 use this function to obtain a dictionary of properties, as%0A stored in getXXX functions.%0A %22%22%22%0A%0A res = %7B%7D%0A for prop in args:%0A fn = getattr(self, %22get%25s%2... |
524292c821886f5cbe5fe3ea201c65c48119be41 | update extract_samples.py | extract_samples.py | extract_samples.py | import sys, os
import numpy as np
import pandas as pd
import datetime
if __name__ == '__main__':
infile = sys.argv[1]
csv_content = pd.read_csv(infile, [0])
date = []
| Python | 0.000001 | @@ -171,10 +171,111 @@
date = %5B
-%5D
+datetime.datetime.strptime(x, '%25Y-%25m-%25d') for x in csv_content.index%5D%0A for x in date:%0A s = 0
%0A
|
dbbdf00341f5cc8673c9cc0f3b4baf7487bf7a4b | Combine conditionals | lintreview/tools/shellcheck.py | lintreview/tools/shellcheck.py | import logging
import os
import functools
from lintreview.tools import Tool, run_command, process_checkstyle
from lintreview.utils import in_path
log = logging.getLogger(__name__)
class Shellcheck(Tool):
name = 'shellcheck'
def check_dependencies(self):
"""
See if shellcheck is on the syste... | Python | 0.000226 | @@ -612,46 +612,11 @@
ame)
-:%0A return False%0A%0A if
+ or
not
|
66a8811a5f489fc133b23996ebac145407dd512f | Update ipc_lista4.6.py | lista4-oficial/ipc_lista4.6.py | lista4-oficial/ipc_lista4.6.py | #Bruno de Oliveira Freire - 1615310030
media=[]
qtd_alunos=0
num_aluno=0
m=0
aluno=1
for qtd_alunos in range(10):
print("-------------nota do aluno %d-----------------"%aluno)
n1=float(input("insira o numero 1:"))
n2=float(input("insira o numero 2:"))
n3=float(input("insira o numero 3:"))
n4=float(... | Python | 0 | @@ -32,16 +32,46 @@
5310030%0A
+#questao 6 da lista de listas%0A
media=%5B%5D
|
23b8416025e478a1740200a9a9a4302fd09d7937 | Set the version at 1.0. | spotseeker_server/__init__.py | spotseeker_server/__init__.py | Python | 0.000004 | @@ -0,0 +1,20 @@
+__version__ = '1.0'%0A
| |
7139e52e6a8f558a521d36192ae7577d6398ca12 | Fix comment of fastdtw.dtw() | fastdtw/fastdtw.py | fastdtw/fastdtw.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
import numbers
import numpy as np
from collections import defaultdict
try:
range = xrange
except NameError:
pass
def fastdtw(x, y, radius=1, dist=None):
''' return the approximate distance between 2 time serie... | Python | 0 | @@ -2994,218 +2994,8 @@
%5Bj%5D.
- If%0A dist is an int of value p %3E 0, then the p-norm will be used. If%0A dist is a function then dist(x%5Bi%5D, y%5Bj%5D) will be used. If dist is%0A None then abs(x%5Bi%5D - y%5Bj%5D) will be used.
%0A%0A
|
e4290cd465e5c2bb1660b9b069361a878e05f9ee | Version up, thanks to @lobstr | fbchat/__init__.py | fbchat/__init__.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from .client import *
"""
fbchat
~~~~~~
Facebook Chat (Messenger) for Python
:copyright: (c) 2015 by Taehoon Kim.
:license: BSD, see LICENSE for more details.
"""
__copyright__ = 'Copyright 2015 - {}... | Python | 0 | @@ -379,11 +379,11 @@
'1.
-1.3
+2.0
'%0A__
|
a9a3dc9de9624afacc2ba73365dc48b3368d52e4 | Rename a variable to be more precisely represent the intended usage | sqlitebiter/_table_creator.py | sqlitebiter/_table_creator.py | #!/usr/bin/env python
# encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
import simplesqlite
from sqliteschema import SqliteSchemaExtractor
class TableCreator(object):
def __init__(self, logger, dst_con):
self.__logger = log... | Python | 0.000023 | @@ -515,18 +515,20 @@
-is
+need
_rename
@@ -699,18 +699,20 @@
if
-is
+need
_rename:
|
c39ef90c306680b761ff41709179a30fcce81bf8 | print a usage message when no device is specified | sgio/tools/mtx.py | sgio/tools/mtx.py | #!/usr/bin/env python
# coding: utf-8
# A reimplementation of the MTX tool in pyton
# incomplete so far but we can build on it
import sys
from sgio.pyscsi.scsi import SCSI
from sgio.pyscsi.scsi_device import SCSIDevice
from sgio.pyscsi import scsi_enum_inquiry as INQUIRY
from sgio.pyscsi import scsi_enum_modesense6 ... | Python | 0.000001 | @@ -3082,20 +3082,21 @@
def
-main
+usage
():%0A
devi
@@ -3095,30 +3095,187 @@
-device = '/dev/changer
+print 'Usage:'%0A print 'mtx.py -f %3Cdevice%3E status'%0A print 'mtx.py -f %3Cdevice%3E load %3Csrc%3E %3Cdst%3E'%0A print 'mtx.py -f %3Cdevice%3E unload %3Cdst%3E %3Csrc%3E'%0A%0A%0Adef main()... |
8700215bc3d022f84e5f69e84e81438220c37bda | Change loading options sequence | simple_stepper.py | simple_stepper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SimpleStepper backend main script.
"""
import httplib
import json
import os
import boto.ec2
import boto.exception
import tornado.httpserver
import tornado.options
import tornado.web
import tornado.ioloop
# define options
tornado.options.define(
'config_file',
... | Python | 0.000001 | @@ -6650,16 +6650,57 @@
ain__':%0A
+ tornado.options.parse_command_line()%0A
if o
|
c677b62ab6ea24c64ce0e63f0aa31b0c0b15e88e | Properly update version to 0.2.0 | slack/__init__.py | slack/__init__.py | # Copyright (c) 2014 Katsuya Noguchi
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis... | Python | 0.996344 | @@ -1112,11 +1112,11 @@
'0.
-1.3
+2.0
'%0Aap
|
724fdd6d2e4c5cf538c9235b0c0df60d7c75aa3b | make the threshold explicit not to forget it | loctext/learning/annotators.py | loctext/learning/annotators.py | from nalaf.learning.taggers import RelationExtractor
from nalaf.learning.taggers import StubSameSentenceRelationExtractor
from nalaf.learning.svmlight import SVMLightTreeKernels
from nalaf.structures.relation_pipelines import RelationExtractionPipeline
from nalaf.features.relations import NamedEntityCountFeatureGenerat... | Python | 0.000002 | @@ -2823,16 +2823,29 @@
ionsfile
+, threshold=0
)%0A%0A
|
b23fd62c15c5f2e526e470daf6a6025d6231f966 | update local server to know about loading and saving gists | pub/local.py | pub/local.py | from flask import Flask
from flask import request
from flask import render_template
import os
import json
import requests
app = Flask(__name__)
@app.route("/api/run/<user>/<repo>", methods=['POST'])
def proxy_github_run(user, repo):
data = {}
for k,v in request.form.iteritems():
data[k] = v
r = re... | Python | 0 | @@ -77,16 +77,42 @@
emplate%0A
+from flask import jsonify%0A
import o
@@ -169,171 +169,641 @@
_)%0A%0A
-@app.route(%22/api/run/%3Cuser%3E/%3Crepo%3E%22, methods=%5B'POST'%5D)%0Adef proxy_github_run(user, repo):%0A data = %7B%7D%0A for k,v in request.form.iteritems():%0A data%5Bk%5D = v
+def proxy_github... |
82638521d51cea4286f4b3e8ecd3f2ccd0441e49 | Create core Class it's called pyMonitor with some stuffs | pyMonitor.py | pyMonitor.py | Python | 0 | @@ -0,0 +1,2123 @@
+%22%22%22%0A pyMonitor first Version%0A%0A Written By :Ahmed Alkabir%0A%22%22%22%0A#!/usr/bin/python3%0A%0A# Library%0Aimport serial%0Aimport sys%0A%0Aclass pyMonitor():%0A%0A #baud rate of Serial communication%0A baud_rate = %5B4800,9600,14400,19200,28800,38400,57600,115200%5D%0A%0A ... | |
d70d78744a0f4a2c316aa69a9402687cac08648f | fix platform check in ads.py | pyads/ads.py | pyads/ads.py | """
Pythonic ADS functions.
:copyright: (c) 2016 by Stefan Lehmann
:license: MIT, see LICENSE for details
"""
import sys
from .pyads import (
adsPortOpen, adsPortClose,
adsSyncWriteReq, adsSyncReadWriteReq, adsSyncReadReq,
adsSyncReadByName, adsSyncWriteByName, adsSyncReadStateReq... | Python | 0 | @@ -729,19 +729,28 @@
form
- ==
+.startswith(
'linux'
+)
%0D%0Apo
|
7d32d175a397ca32b0efa2a5d2eb791e2fd1ab47 | fix bug with versions with more than 1 digit | pyciss/io.py | pyciss/io.py | """This module manages where downloaded data is stored via a config
file. It also has a PathManager to support finding the paths to files
of interest."""
from pathlib import Path
import pandas as pd
import configparser
from collections import OrderedDict
try:
from pysis.isis import getkey
except ImportError:
... | Python | 0 | @@ -5836,19 +5836,43 @@
on = id_
-%5B12
+.split('_')%5B1%5D.split('.')%5B0
%5D%0A
|
fab9a1b901a4cfe9d8a927eec3eed7bf987a6579 | Fix test of while statement | pyvm_test.py | pyvm_test.py | import pyvm
import unittest
class PyVMTest(unittest.TestCase):
def setUp(self):
self.vm = pyvm.PythonVM()
def tearDown(self):
self.vm._reset()
def test_load_const_num(self):
self.assertEqual(
10,
self.vm.eval('10')
)
def test_load_const_num_flo... | Python | 0.008439 | @@ -2242,16 +2242,104 @@
i - 1')
+%0A self.assertEqual(%0A 0,%0A self.vm._locals.get('i')%0A )
%0A%0A de
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.