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 |
|---|---|---|---|---|---|---|---|
ec0b86fc5cbbe96c35483cd484ee652d4e9500f9 | clean up sql statements in DBObject | rsqueakvm/model/DBObject.py | rsqueakvm/model/DBObject.py | from rsqueakvm import constants, error
from rsqueakvm.model.pointers import W_PointersObject
from rpython.rlib import objectmodel, jit
from rsqueakvm.plugins.database import SQLConnection
from sqpyte import interpreter
import pdb
class W_DBObject(W_PointersObject):
db_connection = None
id_counter = 0
@j... | Python | 0.002229 | @@ -904,21 +904,28 @@
-print
+create_sql =
%22CREATE
@@ -948,42 +948,44 @@
ISTS
-%22, self.class_name, %22(id integer)%22
+ %25s (id INTEGER);%22 %25 self.class_name
%0A
@@ -981,32 +981,38 @@
ss_name%0A
+print
create_sql = %22CR
@@ -1009,77 +1009,8 @@
_sql
- = %22CREATE TABLE IF NOT EXISTS ... |
f57f8013d7d6f18bb1bbe8c04116062ae33608f7 | Add a message at the end of concatenating | 17B-162/HI/imaging/concat_channels.py | 17B-162/HI/imaging/concat_channels.py |
'''
Combine individually-imaged channels into a cube.
Run in CASA.
'''
import sys
from glob import glob
from taskinit import iatool
ia = iatool()
path_to_data = sys.argv[-4]
filename = sys.argv[-3]
# Check for the expected number of images
num_imgs = int(sys.argv[-2])
suffix = sys.argv[-1]
suffixes = ['mask',... | Python | 0.002242 | @@ -1312,8 +1312,64 @@
close()%0A
+%0Acasalog.post(%22Look! I made a %7B%7D cube!%22.format(suffix))%0A
|
249c3a0c9368faaf63efe02df43838f4e775c411 | Change conanfile.py to install with CMake | conanfile.py | conanfile.py | from conans import ConanFile
class CppSortConan(ConanFile):
name = "cpp-sort"
version = "1.4.0"
settings = "compiler"
license = "https://github.com/Morwenn/cpp-sort/blob/master/license.txt"
url = "https://github.com/Morwenn/cpp-sort"
author = "Morwenn <morwenn29@hotmail.fr>"
description = ... | Python | 0 | @@ -11,16 +11,23 @@
s import
+ CMake,
ConanFi
@@ -110,34 +110,8 @@
.0%22%0A
- settings = %22compiler%22%0A
@@ -364,16 +364,17 @@
urces =
+(
%22include
@@ -376,16 +376,46 @@
clude/*%22
+, %22CMakeLists.txt%22, %22cmake/*%22)
%0A exp
@@ -474,16 +474,14 @@
def
-configur
+packag
e(se
@@ -497,140 +49... |
026565a0fcee402f35a35d5aeeff6d8aea79ac4f | Make the PASS command a required step on connect when there is a server password | txircd/modules/cmd_pass.py | txircd/modules/cmd_pass.py | from twisted.words.protocols import irc
from txircd.modbase import Command, Module
class PassCommand(Command, Module):
def onUse(self, user, data):
user.password = data["password"]
def processParams(self, user, params):
if user.registered == 0:
user.sendMessage(irc.ERR_ALREADYREGISTRED, ":Unauthorized comma... | Python | 0.000063 | @@ -149,40 +149,164 @@
:%0A%09%09
-user.password = data%5B%22password%22%5D
+if self.ircd.server_password and not user.password:%0A%09%09%09user.registered -= 1%0A%09%09user.password = data%5B%22password%22%5D%0A%09%09if user.registered == 0:%0A%09%09%09user.register()
%0A%09%0A%09
@@ -639,24 +639,158 @@
ms%5B0%5D%0... |
8f18c6c55c366fddab45379a87839d92e6cd74cb | fix formatting bug | src/encoded/commands/deploy.py | src/encoded/commands/deploy.py | import boto3
import getpass
import re
import subprocess
import sys
BDM = [
{
'DeviceName': '/dev/sda1',
'Ebs': {
'VolumeSize': 120,
'VolumeType': 'gp2',
'DeleteOnTermination': True
}
},
{
'DeviceName': '/dev/sdb',
'NoDevice': "",
... | Python | 0.000001 | @@ -3091,39 +3091,29 @@
-user_data = user_data %25
+data_insert =
%7B%0A
@@ -3260,50 +3260,20 @@
-user_data = user_data %25 %7B%0A
+data_insert%5B
'CLU
@@ -3274,33 +3274,35 @@
t%5B'CLUSTER_NAME'
-:
+%5D =
cluster_name,%0A
@@ -3290,33 +3290,32 @@
%5D = cluster_name
-,
%0A ... |
2468e034db6cedee663a6c8a1ce66580dbcdd67c | Make ``Hub`` not required for events. | us_ignite/events/models.py | us_ignite/events/models.py | import watson
from django.db import models
from django.core.urlresolvers import reverse
from django_extensions.db.fields import (
AutoSlugField, CreationDateTimeField, ModificationDateTimeField)
from geoposition.fields import GeopositionField
from taggit.managers import TaggableManager
from us_ignite.common.fiel... | Python | 0.000006 | @@ -2306,16 +2306,25 @@
nyField(
+%0A
'hubs.Hu
@@ -2354,16 +2354,28 @@
unities'
+, blank=True
)%0A po
|
803421f8576a30275494588c759bfcc9e418738a | Add an easy way to check in request if management | usingnamespace/__init__.py | usingnamespace/__init__.py | import logging
log = logging.getLogger(__name__)
from pyramid.config import (
Configurator,
not_,
)
from pyramid.session import UnencryptedCookieSessionFactoryConfig
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from sql... | Python | 0 | @@ -2517,67 +2517,288 @@
-config.add_request_method(callable=cur_domain, name='domain
+def is_management(request):%0A if request.matched_route.name == 'management':%0A return True%0A return False%0A%0A config.add_request_method(callable=cur_domain, name='domain', reify=True)%0A conf... |
d8bf5efa26b1d3e85bff777f54c7e2f5846271b3 | Improve comment in datamodel_v1.py | calico/datamodel_v1.py | calico/datamodel_v1.py | # -*- coding: utf-8 -*-
# Copyright 2015 Metaswitch Networks
#
# 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 applicab... | Python | 0.000005 | @@ -2363,16 +2363,79 @@
int_id%22.
+ Works for%0A# endpoint configuration and endpoint status paths.
%0AENDPOIN
|
ffbad33922559308fc30364ad90f038825f531c3 | Enable requesting environment variables on the remote | carnifex/sshprocess.py | carnifex/sshprocess.py | import os
import pwd
import struct
from twisted.python import failure
from twisted.python.win32 import quoteArguments
from twisted.internet import defer
from twisted.internet.error import ProcessDone, ProcessTerminated
from twisted.internet.protocol import ClientFactory
from twisted.internet.endpoints import TCP4Client... | Python | 0 | @@ -1870,32 +1870,284 @@
(specificData):%0A
+ # Send requests to set the environment variables%0A for variable, value in env.iteritems():%0A data = common.NS(variable) + common.NS(value)%0A connection.sendRequest(session, 'env', data)%0A
... |
83e66618269fed2e41353da6e6260a4557622d98 | Fix typing error | wizard-py/cli.py | wizard-py/cli.py | import argparse
import analyze
import os
import sys
import yaml_utils
import xml.etree.ElementTree as etree
# Lists region tags in a file or directory.
def list_region_tags(root_dir,
show_detected,
show_undetected,
show_test_counts,
s... | Python | 0.000149 | @@ -3370,33 +3370,32 @@
-xunit_region_tags
+existing_tag_str
= x.att
@@ -3397,17 +3397,21 @@
x.attrib
-%5B
+.get(
'customP
@@ -3422,19 +3422,10 @@
rty'
-%5D + ',' %5C%0A
+)%0A
@@ -3440,66 +3440,84 @@
- if 'customProperty' in x.attrib
+existing_tag_list = existing_tag_str.sp... |
34df7cb27b9a77a1c13e3e8bc925c99dd766598c | fix a FIXME in cluster provider docstring (#2187) | parsl/providers/cluster_provider.py | parsl/providers/cluster_provider.py | import logging
from abc import abstractmethod
from string import Template
from parsl.providers.error import SchedulerMissingArgs, ScriptPathError
from parsl.launchers.error import BadLauncher
from parsl.providers.provider_base import ExecutionProvider
logger = logging.getLogger(__name__)
class ClusterProvider(Execu... | Python | 0 | @@ -859,18 +859,23 @@
ncher :
-st
+Launche
r%0A
@@ -880,13 +880,35 @@
-FIXME
+Launcher for this provider.
%0A
|
82aba46a74721aafa637889af98d62885ada711d | add timeout to http example | example/http.py | example/http.py | import csp
from twisted.web.client import getPage
def excerpt(text, cutoff=100):
l = len(text)
if l > cutoff:
return text[0:cutoff] + "..."
else:
return text
def request(url):
return csp.channelify(getPage(url))
def main():
c = request("http://google.com")
result, error = ... | Python | 0 | @@ -54,213 +54,258 @@
def
-excerpt(text, cutoff=100):%0A l = len(text)%0A if l %3E cutoff:%0A return text%5B0:cutoff%5D + %22...%22%0A else:%0A return text%0A%0A%0Adef request(url):%0A return csp.channelify(getPage(url))%0A%0A%0Adef main():
+request(url):%0A return csp.channelify(getPage(... |
0f5ff1db51916642f5ab58008430737fb7af48aa | add mathjax, try again | conf/h1ds.py | conf/h1ds.py | # -*- coding: iso-8859-1 -*-
"""
MoinMoin - modern theme
Modified by Dave Pretty for PRL
@copyright: 2003-2005 Nir Soffer, Thomas Waldmann
@license: GNU GPL, see COPYING for details.
"""
def login_logout(d):
if d["user_name"] == "":
return u'<p><a href="/openid/login/">Log in</a></p>'... | Python | 0 | @@ -653,30 +653,36 @@
d):%0A
-return
+extra_line =
u'%3Cscript t
@@ -797,16 +797,80 @@
script%3E'
+%0A return ThemeBase.html_head(self, d) + '%5Cn' + extra_line
%0A%0A de
|
85903eff6a23592e2ad10f3d226b7712eaebc64d | define scikits.umfpack.__version__ | scikits/umfpack/__init__.py | scikits/umfpack/__init__.py | """
===============
scikits.umfpack
===============
Interface to UMFPACK linear solver.
"""
from __future__ import division, print_function, absolute_import
from .umfpack import *
from .interface import *
if __doc__ is not None:
from .umfpack import __doc__ as _umfpack_doc
from .interface import __doc__ as... | Python | 0 | @@ -203,16 +203,61 @@
port *%0A%0A
+from .version import version as __version__%0A%0A
if __doc
|
ab9a2fa1de529477a3c68d89d3f8cee56488aab8 | improve readability of args in wptools.fetch | wptools/fetch.py | wptools/fetch.py | # -*- coding:utf-8 -*-
"""
WPTools Fetch module.
"""
from __future__ import print_function
import pycurl
import sys
import time
from . import __title__, __contact__, __version__
from io import BytesIO
from string import Template
class WPToolsFetch:
ENDPOINT = "http://en.wikipedia.org"
QUERY = {"html": Te... | Python | 0.000003 | @@ -2327,10 +2327,9 @@
T =
-30
+5
%0A%0A
@@ -2741,24 +2741,259 @@
%22%22%22speed%22%22%22%0A
+%0A # consistently faster than requests by 3x%0A #%0A # r = requests.get(url,%0A # timeout=self.TIMEOUT,%0A # headers=%7B'User-Agent': self.user_agent%... |
7cf85ab0b28fb448730b80dceedf5cea2abab551 | fix ceph_is_installed by returning opposite boolean returncode | ceph_deploy/install.py | ceph_deploy/install.py | import argparse
import logging
from distutils.util import strtobool
from . import hosts
from .cliutil import priority
from .lib.remoto import process
LOG = logging.getLogger(__name__)
def ceph_is_installed(conn):
"""
Check if the ceph packages are installed by looking for the
presence of the ceph comma... | Python | 0 | @@ -432,16 +432,20 @@
return
+not
return_c
|
34cdda1740c5b1578f5b3d68c851100894501768 | Remove HEAD-added lines 3 | repos/settings.py | repos/settings.py | import os
import dj_database_url
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
#<<<<<<< HEAD
#=======
#>>>>>>> 815575b6c1388f29002bf7d4543e01ae37e1bff9
# Quick-st... | Python | 0.005118 | @@ -4409,16 +4409,17 @@
om_env)%0A
+#
%3E%3E%3E%3E%3E%3E%3E
@@ -4438,29 +4438,28 @@
8f29002bf7d4543e01ae37e1bff9
-%0A
|
ad625d580590d33b00dd3c7a89916fd40752110d | remove imgmath, it doesnt work on ReadTheDoc | doc/source/conf.py | doc/source/conf.py | # -*- coding: utf-8 -*-
#
# Kagura documentation build configuration file, created by
# sphinx-quickstart on Thu Dec 22 16:08:41 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | Python | 0 | @@ -1137,34 +1137,8 @@
e',%0A
- 'sphinx.ext.imgmath',%0A
|
23ec0ddcb4b0a36226d064738781a2514d477eb2 | Rename LogProcessStop => LogProcessEnd | pkg/build/builder/ansible/logger.py | pkg/build/builder/ansible/logger.py | from ctypes import *
lib = cdll.LoadLibrary("./pylogger.so")
class Error(Exception): pass
lib.Init.argtypes = []
lib.Init.restype = c_char_p
def Init():
res = lib.Init()
if res != None:
raise Error(res)
lib.DisablePrettyLog.argtypes = []
lib.DisablePrettyLog.restype = None
def DisablePrettyLog()... | Python | 0 | @@ -2827,20 +2827,19 @@
gProcess
-Stop
+End
():%0A
@@ -2859,12 +2859,11 @@
cess
-Stop
+End
%22%0A%0Ad
|
2bd82af97b763333f357580ae6bcd92fff672fdb | Fix mistakes and laziness in last commit | wsgi/ircagent.py | wsgi/ircagent.py | #! /usr/bin/env python
#
# An IRC agent designed for a web api that allows minecraft computers to talk
# over IRC. It has an interface to let the user get a slice of the last 500
# messages sent over IRC as well as the users, ops and voiced members.
#
# Trevor Merrifield <trevorm42@gmail.com>
import irc.bot
import i... | Python | 0.000294 | @@ -1569,16 +1569,21 @@
with
+self.
lock:%0A
@@ -1700,16 +1700,116 @@
text))%0A
+ if len(self.messages) %3E self.messagelimit:%0A self.messages.pop(0)%0A
|
ab24db61340ccfd1160e6d39066f9541a411a179 | Remove unused imports | doc/source/conf.py | doc/source/conf.py | # -*- coding: utf-8 -*-
#
import sys
import os
project = 'python-neutronclient'
# -- General configuration ---------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sp... | Python | 0.000001 | @@ -24,30 +24,8 @@
%0A#%0A%0A
-import sys%0Aimport os%0A%0A
proj
|
2af6a10ad2087b98807909544832067fe2cc811a | Fix handling of implicit version | gaeenv/sdk.py | gaeenv/sdk.py | import os
import sys
import shutil
import requests
import re
import xml.etree.ElementTree as ET
from tempfile import gettempdir
from utils import logger, writefile
from zipfile import ZipFile
def install(env_dir, version=None):
"""
Install App Engine SDK
"""
# download SDK
zip_file = download(version)
lib_dir... | Python | 0.000001 | @@ -1305,16 +1305,80 @@
ersion()
+%0A%09if type(version) is str:%0A%09%09version = tuple(version.split('.'))
%0A%0A%09respo
|
77209cb11f5a8e5cefa8886576c3a41e6a15001b | Fix bug in plotAdaptive | AdaptivePELE/analysis/plotAdaptive.py | AdaptivePELE/analysis/plotAdaptive.py | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import argparse
import glob
import types
def parseArguments():
"""
Parse command line arguments
:returns: int, int, int, str, bool, bool -- Number of steps per epoch,
column to plot in the X a... | Python | 0 | @@ -2843,37 +2843,27 @@
ce(column1,
-types.IntType
+int
):%0A i
|
88bf2579d2fc1f266d03dc67945852b0bb0c6aa9 | Set up base interface for http style salt:// arg passing | salt/fileserver/__init__.py | salt/fileserver/__init__.py | '''
File server pluggable modules and generic backend functions
'''
# Import python libs
import re
import fnmatch
import logging
# Import salt libs
import salt.loader
log = logging.getLogger(__name__)
def is_file_ignored(opts, fname):
'''
If file_ignore_regex or file_ignore_glob were given in config,
... | Python | 0 | @@ -2889,16 +2889,21 @@
ath, env
+=None
, back=N
@@ -2900,32 +2900,32 @@
ne, back=None):%0A
-
'''%0A
@@ -3074,32 +3074,52 @@
_gen_back(back)%0A
+ kwargs = %7B%7D%0A
fnd = %7B'
@@ -3151,24 +3151,660 @@
'rel': ''%7D%0A
+ if os.path.isabs(path):%0A return fnd%0A ... |
e94f2cb6dd144cec7b10aecb29669e7ba2ef98b1 | Update release version to 0.6.1 | chatterbot/__init__.py | chatterbot/__init__.py | """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.6.0'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
__all__ = (
'ChatBot',
)
| Python | 0 | @@ -117,17 +117,17 @@
= '0.6.
-0
+1
'%0A__auth
|
5d0f0e4c2167d775834b3df7b0e95dc4fe62e7b7 | Extend timeout and retryCount of Nagios plugin | check_snmp_services.py | check_snmp_services.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright © 2011-2012 Binet Réseau
"""Nagios plugin to check services through SNMP
"""
from optparse import OptionParser
from pysnmp.entity.rfc3413.oneliner import cmdgen
import sys
# This is SNMPv2-SMI::enterprises.BinetRéseau.3 OID
OID_SERVICES_PREFIX = (1, 3, 6, 1,... | Python | 0 | @@ -2385,16 +2385,77 @@
ns.port)
+,%0A timeout=5, retries=2
)%0A if
|
666d9c999ebf0cc388d8f045a04756424c2d9b62 | Make it work for Python 2 | gdemo/util.py | gdemo/util.py | """Share utility functions."""
from urllib import parse
def get_route_value(environ, name):
value = environ['wsgiorg.routing_args'][1][name]
value = parse.unquote(value)
return value.replace('%2F', '/')
| Python | 0.000003 | @@ -25,16 +25,25 @@
ns.%22%22%22%0A%0A
+try:%0A
from url
@@ -59,16 +59,64 @@
t parse%0A
+except ImportError:%0A import urllib as parse%0A%0A
%0A%0Adef ge
|
bdd09866b1a79c8972890c5dddd3b03f4715f659 | update flake8 test error | gem/models.py | gem/models.py | from django.contrib.auth.hashers import make_password, check_password
from django.contrib.auth.models import User
from django.utils.html import format_html
from django.contrib.staticfiles.templatetags.staticfiles import static
from wagtail.wagtailcore import hooks
from django.db import models
from django.db.models.sign... | Python | 0 | @@ -2429,16 +2429,25 @@
at_html(
+%0A
'%3Clink r
@@ -2475,20 +2475,16 @@
%22%7B%7D%22%3E',%0A
-
|
ad7eeea732a6550c1f1a5724a587b58f86d97732 | fixed find string return values for None case | converter.py | converter.py | """
converter.py
Convert those silly plain text readmes to markdown easily!
"""
import subprocess
import requests
import json
import argparse
# Project information
__author__ = "Stephen Greene, and Matt Dzwonczyk"
__copyright__ = "Copyright 2017, The Cogent Project"
__credits__ = ["Stephen Greene", "Matt Dzwonczyk"... | Python | 0.998294 | @@ -1949,20 +1949,18 @@
is not
-None
+-1
:%0A
@@ -6531,16 +6531,45 @@
NE) + 1%0A
+ else:%0A return -1;%0A
%0A%0Aif __n
|
d9459b7398a6cbf287127c802d760b8350bca0d2 | Add EC2 instance type to config options | fabfile/configure.py | fabfile/configure.py | import os
import yaml
from fabric.tasks import Task
from fabric.colors import green
from fabric.api import task, env
def require_input(prompt):
"""
Demand input from the user.
"""
i = None
while not i:
i = raw_input(prompt.strip()+' ')
if not i:
print ' I need this, pl... | Python | 0 | @@ -1,12 +1,58 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A
import os%0Aim
@@ -1110,16 +1110,21 @@
y group
+name
%5BDefault
@@ -1261,16 +1261,139 @@
:%22%0A )
+%0A config%5B'EC2_INSTANCE_TYPE'%5D = raw_input(%0A %22Target EC2 instance size %5BDefault: m3.medium%5D:%22%0A ) or 'm3.medium'... |
5d9bb47f0d0015533cbf547d613600f8b4b7d2d7 | Store the inner exception when creating an OSCException | shade/exc.py | shade/exc.py | # Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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 applica... | Python | 0.000002 | @@ -602,16 +602,28 @@
cense.%0A%0A
+import sys%0A%0A
%0Aclass O
@@ -888,16 +888,62 @@
tra_data
+%0A self.inner_exception = sys.exc_info()
%0A%0A de
|
fa1ba4eec03fb17432aec9a76e5ed06bec1a164e | Handle version-like suffixes | ciscripts/ruby_util.py | ciscripts/ruby_util.py | # /ciscripts/ruby_util.py
#
# Ruby related utility functions.
#
# See /LICENCE.md for Copyright information
"""Ruby related utility functions."""
import fnmatch
import os
import re
import subprocess
_KNOWN_RUBY_INSTALLATIONS = dict()
# suppress(invalid-name)
def get_ruby_version_from_specified(ruby_executable, ... | Python | 0.000006 | @@ -1352,16 +1352,93 @@
ruby%22))%0A
+ candidates %7C= set(fnmatch.filter(dir_contents, %22ruby*%5B0123456789%5D%22))%0A
|
4477ef7b7fd9d9e3f7518486cfce4f049009b092 | make reprocess.py a bit smarter, add command line args for sourcedir, builddir and buildarch | tools/harness/reprocess.py | tools/harness/reprocess.py | #!/usr/bin/env python
##########################################################################
# Copyright (c) 2009, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Ha... | Python | 0 | @@ -711,38 +711,589 @@
-options, dirs = p.parse_args()
+p.add_option('-e', '--existingbuild', dest='existingbuild', metavar='DIR',%0A help='existing build directory (may not be used with -b)')%0A p.add_option('-S', '--sourcedir', dest='sourcedir', metavar='DIR',%0A help='source ... |
8228df027d3ca5ad2eb5a084e1ae642fa9b01597 | Add youtube-urls with query strings in archive videos. | Instanssi/admin_arkisto/forms.py | Instanssi/admin_arkisto/forms.py | # -*- coding: utf-8 -*-
from django import forms
from uni_form.helper import FormHelper
from uni_form.layout import Submit, Layout, Fieldset, ButtonHolder
from Instanssi.arkisto.models import OtherVideo, OtherVideoCategory
class VideoForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
# Initialize... | Python | 0 | @@ -216,16 +216,32 @@
Category
+%0Aimport urlparse
%0A%0Aclass
@@ -1066,32 +1066,605 @@
)%0A )%0A
+ %0A def clean_youtube_url(self):%0A url = self.cleaned_data%5B'youtube_url'%5D%0A if url.find('http://www.youtube.com/v/') == 0:%0A return url%0A%0A # Parse querys... |
9b40f88726363a8e281b9eecd6b032a903404550 | Add _ for self and a 'safer' get | shop/shop.py | shop/shop.py | import logging
class SymbolMeta(type):
def __getattr__(cls, name):
if name.startswith("__"):
super(SymbolMeta, type).__getattr__(name)
return cls(name=name)
class DictCombiner(object):
def __repr__(self):
return "(%s + %s)" % (self.left, self.right)
def __init__(self, left, ... | Python | 0.998682 | @@ -182,24 +182,54 @@
ame=name)%0A%0A%0A
+class KResult(dict):%0A pass%0A%0A%0A
class DictCo
@@ -244,16 +244,16 @@
bject):%0A
-
def __
@@ -524,19 +524,22 @@
result,
-dic
+KResul
t):%0A
@@ -708,10 +708,17 @@
t =
-%7B%7D
+KResult()
%0A
@@ -1441,24 +1441,82 @@
s not None:%0A
+ if self.name ... |
94f52a54c7c64ffd3529b4787e5baecc8aa90540 | comment clustering code | src/launch_terms_clustering.py | src/launch_terms_clustering.py | #! usr/bin/python
import sys
import time
import glob
import tensorflow as tf
import numpy as np
help_s = '''
A script to
Inputs:
[1] sample data path (one term and its frequency per line and separated by comma)
put 0 if using the default test data: "../input_terms_for_clustering/terms_wines_frequences.csv"
[2... | Python | 0 | @@ -116,16 +116,34 @@
ript to
+cluster the terms.
%0AInputs:
@@ -991,13 +991,69 @@
ds (
-could
+Potential problem here about chosing the initial centroids!!!
)%0A%09c
|
b24c3e88a9105cfc7e7e36af3b6e00885045553e | Fix for template types in parser | sinc/sinc.py | sinc/sinc.py | #!/usr/bin/python
################################################################################
# sinc
# reads a data XML file and generates code in various languages
################################################################################
import sys
from lxml import etree
from sinc_ast import Package, E... | Python | 0 | @@ -1255,13 +1255,19 @@
me.a
-ppend
+dd_template
(rea
|
be3cfd7033097bbc073e05c232f702bbcbfbd4db | Fix the imports for Python 3 | xgcm/__init__.py | xgcm/__init__.py | from mdsxray import open_mdsdataset
from gridops import GCMDataset
from regridding import regrid_vertical
| Python | 0.999989 | @@ -1,13 +1,14 @@
from
+.
mdsxray
@@ -35,16 +35,17 @@
et%0Afrom
+.
gridops
@@ -67,16 +67,17 @@
et%0Afrom
+.
regriddi
|
39b0621fc1d7e240ed141e55cb81c7f249d92a7c | fix p4a revamp | plyer/platforms/android/__init__.py | plyer/platforms/android/__init__.py | from os import environ
from jnius import autoclass
ANDROID_VERSION = autoclass('android.os.Build$VERSION')
SDK_INT = ANDROID_VERSION.SDK_INT
if 'PYTHON_SERVICE_ARGUMENT' in environ:
PythonService = autoclass('org.renpy.android.PythonService')
activity = PythonService.mService
else:
PythonActivity = autocl... | Python | 0 | @@ -177,16 +177,119 @@
nviron:%0A
+ try:%0A PythonService = autoclass('org.kivy.android.PythonService')%0A except Exception:%0A
Pyth
@@ -389,16 +389,121 @@
e%0Aelse:%0A
+ try:%0A PythonActivity = autoclass('org.kivy.android.PythonActivity')%0A except Exception:%0A
Pyth
|
05d88f9fb35767b617c92f695c4d6e2aedff1f9c | use sys.stdout as stdout insead of opening /dev/stdout. | zkfarmer/conf.py | zkfarmer/conf.py |
# This file is part of the zkfarmer package.
# (c) Olivier Poitrey <rs@dailymotion.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
import os
import os.path
import shutil
import json
import yaml
# Prevent unstandard !!python/unicode p... | Python | 0 | @@ -235,16 +235,27 @@
os.path%0A
+import sys%0A
import s
@@ -1677,31 +1677,18 @@
urn
-open('/dev/stdin', 'w')
+sys.stdout
%0A
|
f8e9452cb8a3cec5d7c88bfa5d4022097c2e138a | Use has_identity instead | coaster/annotations.py | coaster/annotations.py | # -*- coding: utf-8 -*-
"""
SQLAlchemy column annotations
=============================
"""
from __future__ import absolute_import
import collections
from copy import deepcopy
from blinker import Namespace
from sqlalchemy import event, inspect
from sqlalchemy.orm import mapper
from sqlalchemy.orm.attributes import Qu... | Python | 0.000001 | @@ -5349,16 +5349,20 @@
+has_
identity
@@ -5380,16 +5380,20 @@
target).
+has_
identity
@@ -5562,32 +5562,36 @@
'NO_VALUE') and
+has_
identity is None
@@ -5586,19 +5586,20 @@
tity is
-Non
+Fals
e%0A
@@ -5759,16 +5759,20 @@
E') and
+has_
identity
@@ -5775,19 +5775,20 @@
tity is
-Non
+Fals
e... |
021ccdd7abd3133ddde3893dd5719ba6a7303327 | Change variable name | code/hash_me_poorly.py | code/hash_me_poorly.py | #!/usr/bin/env python3
from collections import namedtuple
PoorItem = namedtuple('Item', 'key value')
class PoorHash:
"""Poor man's hash.
Hash is compartmentalized into slots and in these slots items are kept.
No room left for probing, number of slots fixed at initialisation time,
hence name of the c... | Python | 0.000001 | @@ -360,33 +360,33 @@
, key):%0A
-b
+s
i, ii = self.__s
@@ -445,25 +445,25 @@
self.items%5B
-b
+s
i%5D%5Bii%5D%0A%0A
@@ -498,17 +498,17 @@
-b
+s
i, ii =
@@ -582,17 +582,17 @@
f.items%5B
-b
+s
i%5D%5Bii%5D.v
|
92bb2000d12920b92ddd9a5a43ae5d9632d22b90 | Reverse the order of these | jacquard/tests/test_integration.py | jacquard/tests/test_integration.py | import io
import os
import shlex
import pathlib
import datetime
import textwrap
import contextlib
import unittest.mock
import yaml
import pytest
import dateutil.tz
import werkzeug.test
from jacquard.cli import main
from jacquard.config import load_config
from jacquard.service import get_wsgi_app
from jacquard.directo... | Python | 1 | @@ -2644,32 +2644,30 @@
assert
-expected
+actual
_output == a
@@ -2657,38 +2657,40 @@
ctual_output ==
-actual
+expected
_output%0A%0A
@@ -2837,24 +2837,22 @@
assert
-expected
+actual
_output
@@ -2854,22 +2854,24 @@
tput ==
-actual
+expected
_output%0A
|
9d6265efb57c350d866c926d18263a64535b238c | fix concept tagger | concept_tag_alchemy.py | concept_tag_alchemy.py | from alchemyapi.alchemyapi import AlchemyAPI
import json
import unicodecsv
alchemyapi = AlchemyAPI()
results = []
with open('MOMA3k.csv', 'rb') as in_csv:
for i, m in enumerate(unicodecsv.DictReader(in_csv, encoding='utf-8')):
print i
fieldnames = m.keys()
fieldnames.extend(['AlchemyKeywords', 'Alchemy... | Python | 0.000001 | @@ -151,16 +151,31 @@
in_csv:%0A
+ stop = False%0A
for i,
@@ -351,16 +351,30 @@
if not
+stop and not
'Alchemy
@@ -1005,12 +1005,8 @@
atus
-Info
'%5D)%0A
@@ -1017,16 +1017,20 @@
-break%0A
+stop = True%0A
@@ -1321,17 +1321,16 @@
f i %25 10
-0
== 0:%0A
|
7e754f348327a8fa07adb0850f22b4d2628cecd9 | Use env-python | wdom/tests/test_imports.py | wdom/tests/test_imports.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os import path
import subprocess
from nose_parameterized import parameterized
from wdom.testing import TestCase
root = path.dirname(path.dirname(path.dirname(path.abspath(__file__))))
cases = [
('wdom', 'css'),
('wdom', 'document'),
('wdom', 'element'... | Python | 0.000129 | @@ -41,16 +41,27 @@
-8 -*-%0A%0A
+import sys%0A
from os
@@ -1233,32 +1233,38 @@
%5B
-'python'
+sys.executable
, '-c', cmd.
@@ -1667,16 +1667,22 @@
%5B
-'python'
+sys.executable
, '-
|
a5ffb19c06fe0eedeca483666d4585e922b68d96 | Remove print | fcm_django/models.py | fcm_django/models.py | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from .settings import FCM_DJANGO_SETTINGS as SETTINGS
@python_2_unicode_compatible
class Device(models.Model):
name = models.... | Python | 0.000016 | @@ -6962,31 +6962,8 @@
)%0A%0A
- print (result)%0A
|
95944aec6533c9ccb2a7b95c2d7c1c1e179634ef | Modify reporter for failure cases | zopkio/reporters/junit_reporter.py | zopkio/reporters/junit_reporter.py | # Copyright 2014 LinkedIn Corp.
#
# 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.... | Python | 0.000001 | @@ -4471,24 +4471,37 @@
ailure_info(
+test.result,
test.message
@@ -4573,24 +4573,37 @@
kipped_info(
+test.result,
test.message
|
5a1f3a37120b9dbcfc3fbd144c4c21772df089e7 | Make explicit some db features | firebird/features.py | firebird/features.py | from django.utils.functional import cached_property
from django.db.backends.base.features import BaseDatabaseFeatures
class DatabaseFeatures(BaseDatabaseFeatures):
allows_group_by_pk = False # if the backend can group by just by PK
supports_forward_references = False
has_bulk_insert = False
can_retur... | Python | 0.007514 | @@ -800,24 +800,186 @@
ke = False%0A%0A
+ # Is there a true datatype for uuid?%0A has_native_uuid_field = False%0A%0A # Is there a true datatype for timedeltas?%0A has_native_duration_field = False%0A%0A
# In fir
|
984d74f196c2081dc1862d1be6657ec23fe110c8 | move range start offset into range call | osmaxx/geodesy/coordinate_reference_system.py | osmaxx/geodesy/coordinate_reference_system.py | from django.contrib.gis.geos.collections import MultiPolygon
from django.contrib.gis.geos.polygon import Polygon
from osmaxx.conversion_api.coordinate_reference_systems import WGS_84
class UniversalTransverseMercatorZone:
HEMISPHERE_PREFIXES = dict(
north=326,
south=327,
)
NUMBER_OF_ZONES... | Python | 0.000016 | @@ -588,12 +588,8 @@
ber
-- 1
in r
@@ -593,18 +593,25 @@
n range(
-60
+1, 60 + 1
)%0A
|
0a0c90326b263b367577748c7f0451068093c2ad | update implement | zaifbot/modules/api/wrapper.py | zaifbot/modules/api/wrapper.py | import traceback
import time
import random
from zaifbot.bot_common.logger import logger
from zaifapi.impl import ZaifTradeApi, ZaifPublicApi
from zaifapi.api_error import ZaifApiNonceError, ZaifApiError
from zaifbot.bot_common import get_keys
_RETRY_COUNT = 5
_WAIT_SECOND = 5
def _with_retry(func):
def _wrapper(... | Python | 0 | @@ -2030,1009 +2030,62 @@
-# TODO: %E3%83%AA%E3%83%95%E3%82%A1%E3%82%AF%E3%82%BF%E3%83%AA%E3%83%B3%E3%82%B0%E3%81%97%E3%81%9F%E3%81%84%0A def _log_message(id, currency_pair, action, price, amount, limit, received, remains):%0A msg = 'order succeed %7B%7Bid: %7B%7D, currency_pair: %7B%7D, action:... |
b3a1a3d1e3617b526659c820c116395b31339d40 | Access route | webhooks.py | webhooks.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Carlos Jenkins <carlos@jenkins.co.cr>
#
# 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
#
# Unles... | Python | 0.000001 | @@ -1597,19 +1597,23 @@
est.
-remote_addr
+access_route%5B0%5D
) #
|
e67fe60a42d7f7acc7dcc8af0e363682c21863d8 | Update quora_question_pairs.py | fluid/PaddleNLP/text_matching_on_quora/quora_question_pairs.py | fluid/PaddleNLP/text_matching_on_quora/quora_question_pairs.py | # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Python | 0.000047 | @@ -2284,17 +2284,115 @@
or(msg)%0A
-%0A
+ if sys.version_info %3C= (3, 0): # for python2%0A return open(file_name, 'r')%0A else:%0A
retu
|
68ca3aea627dfaeaabfde56a5508f64f051216af | Remove deleted col from model | api/model.py | api/model.py | #!/usr/bin/env python3
"""
Mietspiegel Persistence Model
"""
import json
from main import db, create_app, logger
from flask_sqlalchemy import SQLAlchemy
import pickle
class Street(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(120))
number_range = db.Column(db.Text)
... | Python | 0 | @@ -483,46 +483,8 @@
32))
-%0A rent = db.Column(db.PickleType())
%0A%0A
|
f60363b3d24d2f4af5ddb894cc1f6494b371b18e | FIX opt_out prevention for mailchimp export | mass_mailing_switzerland/wizards/mailchimp_export_update_wizard.py | mass_mailing_switzerland/wizards/mailchimp_export_update_wizard.py | ##############################################################################
#
# Copyright (C) 2020 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | Python | 0 | @@ -700,97 +700,23 @@
eate
-:%0A partner = self.env%5B%22res.partner%22%5D.browse(partner_id)%0A if partner
+ and partner_id
.opt
@@ -721,20 +721,16 @@
pt_out:%0A
-
|
dd6c758f364e84ab9fb5fbc04021c1df460b7622 | Fix get_bump_version output. | scripts/get_bump_version.py | scripts/get_bump_version.py | from __future__ import print_function
import subprocess
def get_version_from_git():
cmd = ["git", "describe", "--tags", "--long", "--always"]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
code = proc.wait()
if code != 0:
print("Failed to run: %s" % " ".join(cmd))
sys.exit(1)
... | Python | 0 | @@ -658,16 +658,20 @@
.X-devel
+%5Brc%5D
tag.%22)%0A
|
8f63f6dcc623404b61256605d0084f7a74b5f265 | Use a method to invoke pip that works on Windows | scripts/min_requirements.py | scripts/min_requirements.py | #!/usr/bin/env python3
"""Install all the required Python packages, with the minimum Python version.
"""
# Copyright The Mbed TLS Contributors
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# Y... | Python | 0 | @@ -762,18 +762,52 @@
import s
-ys
+ubprocess%0Aimport sys%0Aimport tempfile
%0Aimport
@@ -2647,168 +2647,525 @@
-if not self.requirements:%0A return%0A ret = os.spawnl(os.P_WAIT, sys.executable, 'python', '-m', 'pip',%0A 'install', *self.
+with tempfile.TemporaryDirect... |
c16cf1d321115f303615087bc3fcb5ab287b6102 | Support building LS8 netcdf VRTs, and do it faster | scripts/netcdf_overviews.py | scripts/netcdf_overviews.py | #!/usr/bin/env python3
"""
Generate gdal VRTs of netcdfs that can be viewed as RGB/etc in QGIS.
"""
import sys
from glob import glob
import subprocess
from tqdm import tqdm
from pathlib import Path
import concurrent.futures
COLOURS = 'blue green red nir swir1 swir2'.split()
MAX_WORKERS = 8
def build_netcdf_vrts(pa... | Python | 0 | @@ -191,16 +191,36 @@
ort Path
+%0Aimport xarray as xr
%0A%0Aimport
@@ -295,169 +295,705 @@
t()%0A
-MAX_WORKERS = 8%0A%0A%0Adef build_netcdf_vrts(pattern):%0A print(%22Building viewable VRTs%22)%0A vrts = %5B%5D%0A for filename in tqdm(glob(pattern, recursive=Tru
+LS8_COLOURS = %5B'coastal_aerosol'%5D + COL... |
a4e72dc07f029798cbe765c75736412a5a52a2ff | Rollback testing change in euler31 | graal/edu.uci.python.benchmark/src/benchmarks/euler31-timed.py | graal/edu.uci.python.benchmark/src/benchmarks/euler31-timed.py | #runas solve()
#unittest.skip recursive generator
#pythran export solve()
# 01/08/14 modified for benchmarking by Wei Zhang
import sys, time
COINS = [1, 2, 5, 10, 20, 50, 100, 200]
# test
def _sum(iterable):
sum = None
for i in iterable:
sum += i
return sum
def balance(pattern):
return _sum... | Python | 0 | @@ -305,25 +305,24 @@
%0A return
-_
sum(COINS%5Bx%5D
@@ -1132,17 +1132,16 @@
return
-_
sum(1 fo
|
1dc47560dc64325a919b22b0a0a52557a4dc02af | Modify script to use lookup instead of show; #1989 | scripts/update_user_info.py | scripts/update_user_info.py | #!/usr/bin/env python
"""This is a one-off script to update user_info for #1936.
This could be generalized for #900.
"""
import os
import time
import requests
from gittip import wireup
from requests_oauthlib import OAuth1
db = wireup.db()
oauth = OAuth1( os.environ['TWITTER_CONSUMER_KEY']
, os.enviro... | Python | 0 | @@ -126,16 +126,27 @@
port os%0A
+import sys%0A
import t
@@ -565,16 +565,26 @@
ER BY id
+ LIMIT 120
;%22)%0Aurl
@@ -624,31 +624,137 @@
ers/
-show.json?user_id=%25s%22%0A%0A
+lookup.json%22%0A%0Awhile elsewhere:%0A batch = elsewhere%5B:100%5D%0A elsewhere = elsewhere%5B100:%5D%0A user_ids = ','.join(%5Bst... |
47f0953e4e9e8741b69c7cdbde5164f60a29aa55 | Version 2.4.11 | seleniumbase/__version__.py | seleniumbase/__version__.py | # seleniumbase package
__version__ = "2.4.10"
| Python | 0 | @@ -40,7 +40,7 @@
.4.1
-0
+1
%22%0A
|
2125114712d6f7c103845719fbbbadc3acfdefc8 | Version 1.55.5 | seleniumbase/__version__.py | seleniumbase/__version__.py | # seleniumbase package
__version__ = "1.55.4"
| Python | 0 | @@ -40,7 +40,7 @@
.55.
-4
+5
%22%0A
|
f186c56975974304cec46d90c7638234fa0a6323 | Version 2.3.10 | seleniumbase/__version__.py | seleniumbase/__version__.py | # seleniumbase package
__version__ = "2.3.9"
| Python | 0 | @@ -39,7 +39,8 @@
2.3.
-9
+10
%22%0A
|
7d29b0e193377d71f0ce2a541e10139f58fa4561 | fix missing do in the pseudo config file for kraken | sequana/scripts/taxonomy.py | sequana/scripts/taxonomy.py | # -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
#
# Distributed un... | Python | 0 | @@ -3248,16 +3248,27 @@
to use
+(default 4)
%22%22%22, def
@@ -6166,16 +6166,28 @@
database
+, %22do%22: True
%7D%0A%0A f
|
7c4978aac9cf74be13025f5757a693193cde1c0d | correct the way the HDF5 particles container is created | simphony/bench/cuds_file_bench.py | simphony/bench/cuds_file_bench.py | import os
import shutil
import tempfile
import uuid
from simphony.bench.util import bench
from simphony.io.h5_cuds import H5CUDS
from simphony.cuds.particles import Particle
particles = [
Particle(coordinates=(0.0, 1.1, 2.2)) for i in range(10000)]
id_particles = [
Particle(
uid=uuid.uuid4(),
... | Python | 0.000002 | @@ -167,16 +167,27 @@
Particle
+, Particles
%0A%0Apartic
@@ -1541,12 +1541,14 @@
-pc =
+return
sel
@@ -1573,33 +1573,26 @@
les(
+Particles(
%22test%22)
-%0A return pc
+)
%0A%0A
|
b8166742ec60b5a79cde2d9d708cf54bc5736f1e | modify stdout_encoding to return str instead of bytes object for Python3 | wikipedia/util.py | wikipedia/util.py | import sys
import functools
def debug(fn):
def wrapper(*args, **kwargs):
res = fn(*args, **kwargs)
return res
return wrapper
class cache(object):
def __init__(self, fn):
self.fn = fn
self._cache = {}
functools.update_wrapper(self, fn)
def __call__(self, *args... | Python | 0.000023 | @@ -743,18 +743,26 @@
'):%0A
-if
+encoding =
sys.std
@@ -773,16 +773,60 @@
encoding
+ or default%0A if sys.version_info %3E (3, 0)
:%0A
@@ -843,27 +843,33 @@
.encode(
-sys.stdout.
+encoding).decode(
encoding
@@ -894,12 +894,14 @@
ode(
-default)
+encoding)%0A
|
bf24a7aacf0e25151307cfb2d8ed6bc8f743f70d | Comment out log modifying code in CGC receive so it doesn't crash concrete tracing | simuvex/procedures/cgc/receive.py | simuvex/procedures/cgc/receive.py | import simuvex
from itertools import count
fastpath_data_counter = count()
class receive(simuvex.SimProcedure):
#pylint:disable=arguments-differ
def run(self, fd, buf, count, rx_bytes):
if self.state.mode == 'fastpath':
# Special case for CFG generation
if not self.state.se.s... | Python | 0 | @@ -1535,32 +1535,73 @@
uf)%0A
+# XXX: this breaks wanderer%0A #
list(self.state.
@@ -1652,16 +1652,17 @@
+#
list(sel
|
844ae9f0603a662bf54ac3266357ca06642bdd73 | Add __unicode__ method to some models. | src/niwi/models.py | src/niwi/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.template.defaultfilters import slugify
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from niwi.utils import get_url_data
from niwi.forms import LEXER_CHOICES
f... | Python | 0.000001 | @@ -1774,16 +1774,86 @@
wargs)%0A%0A
+ def __unicode__(self):%0A return u%22Page: %25s%22 %25 (self.title)%0A%0A
%0Aclass P
@@ -2437,24 +2437,95 @@
= 'posts'%0A%0A
+ def __unicode__(self):%0A return u%22Post: %25s%22 %25 (self.title) %0A%0A
def save
@@ -3372,32 +3372,106 @@
(default=True)%... |
cae1b8461d4ccafe098d01a5d4c9aca51e675e97 | bump version number | xdist/__init__.py | xdist/__init__.py | #
__version__ = "1.2"
| Python | 0.000004 | @@ -16,8 +16,8 @@
%221.
-2
+3
%22%0A%0A
|
cf1e02242844c7f059e4c6f2cb606ee6093e4705 | Move preferences header creation to function | src/preferences.py | src/preferences.py | #
# Copyright 2013 TeamSWAP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | Python | 0 | @@ -1248,152 +1248,77 @@
%0A%0A%09%09
-header = wx.StaticText(self.overlayPanel, -1, %22All Overlays%22)%0A%09%09header.SetFont(self.headerFont)%0A%09%09self.overlaySizer.Add(header, 0, wx.ALL, 10
+self.addHeader(%22All Overlays%22, self.overlayPanel, self.overlaySizer
)%0A
-%0A
%09%09se
@@ -1727,150 +1727,75 @@
%0... |
7e610622a3ed9bffff155234c7b71c9aacf89e31 | add exit() | autobuild.py | autobuild.py | #!/usr/bin/env python
import logging
import commands
import os
import time
def git_pull():
print (os.chdir("/opt/push/jpush-docs/jpush-docs/"))
logging.info(commands.getstatusoutput("git pull origin master"))
print ("git pull origin master")
def build():
print (os.chdir("/opt/push/jpush-docs/jpush-do... | Python | 0.000001 | @@ -1596,56 +1596,14 @@
d()%0A
-print time.asctime(time.localtime(time.time()))%0A
+exit()
%0A%0A%0A%0A
|
3ef1531f6934055a416cdddc694f6ca75694d649 | Make use of expanduser() more sane | voltron/common.py | voltron/common.py | import logging
import logging.config
LOG_CONFIG = {
'version': 1,
'formatters': {
'standard': {'format': 'voltron: [%(levelname)s] %(message)s'}
},
'handlers': {
'default': {
'class': 'logging.StreamHandler',
'formatter': 'standard'
}
},
'loggers'... | Python | 0.000143 | @@ -468,16 +468,35 @@
N_DIR =
+os.path.expanduser(
'~/.volt
@@ -500,16 +500,17 @@
oltron/'
+)
%0AVOLTRON
|
bf78c387338e2a2bbc556fb0a1c2ed1a693557de | Add port to available arguments. | vprof/__main__.py | vprof/__main__.py | """Main module for visual profiler."""
import argparse
import os
import sys
from vprof import profile_wrappers
from vprof import stats_server
_MODULE_DESC = 'Python visual profiler.'
_HOST = 'localhost'
_PORT = 8000
_PROFILE_MAP = {
'c': profile_wrappers.RuntimeProfile,
'm': profile_wrappers.MemoryProfile,
... | Python | 0 | @@ -202,21 +202,8 @@
ost'
-%0A_PORT = 8000
%0A%0A_P
@@ -641,24 +641,152 @@
profile.')%0A
+ parser.add_argument('--port', dest='port', default=8000, type=int,%0A help='Internal webserver port.')%0A
args = p
@@ -1510,13 +1510,17 @@
ST,
-_PORT
+args.port
, pr
|
96b40e51d898b7ea7984d333041bdefd916ecfc3 | Add SSM GetParameter | awacs/ssm.py | awacs/ssm.py | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from aws import Action as BaseAction
from aws import BaseARN
service_name = 'Amazon Simple Systems Manager'
prefix = 'ssm'
class Action(BaseAction):
def __init__(self, action=None):
sup = s... | Python | 0 | @@ -3903,16 +3903,54 @@
nTask')%0A
+GetParameter = Action('GetParameter')%0A
GetParam
|
e0ea31a926dc9b8de668ef0321106eb3a84ef0ff | Allow custom, non-Model objects to define their serialization via a 'to_wapiti' method | wapiti/parsers.py | wapiti/parsers.py | # Copyright (c) Ecometrica. All rights reserved.
# Distributed under the BSD license. See LICENSE for details.
import datetime as dt
from decimal import Decimal
import json
import re
from django.db import models
from django.db.models.query import QuerySet
from wapiti import helpers
# ISO 8601
DATE_RE = re.compile('(... | Python | 0 | @@ -2773,24 +2773,118 @@
float(value)
+%0A elif hasattr(value, 'to_wapiti'):%0A value = self.convert(value.to_wapiti())
%0A%0A re
|
f421ce5618b1325e71185b02a40162e0a28625e6 | Fix bug occurring in Python2 | scopus/utils/get_content.py | scopus/utils/get_content.py | import os
import requests
from configparser import NoOptionError
from scopus import exception
from scopus.utils import DEFAULT_PATHS, config
errors = {400: exception.Scopus400Error, 401: exception.Scopus401Error,
404: exception.Scopus404Error, 429: exception.Scopus429Error,
500: exception.Scopus50... | Python | 0.000015 | @@ -962,30 +962,161 @@
-if not sid.isnumeric()
+try:%0A isnumeric = sid.isnumeric()%0A except AttributeError: # Python2%0A isnumeric = unicode(sid, 'utf-8').isnumeric()%0A if not isnumeric
:%0A
@@ -1304,20 +1304,16 @@
elif
-sid.
isnumeri
@@ -1313,18 +1313,16 @@
snumeric
-()
:%0A ... |
eb9e14c2219869eab35a25417ac19ccc2b1bd748 | Remove old comment | scrapers_ca_app/settings.py | scrapers_ca_app/settings.py | """
Django settings for scrapers_ca_app project.
Generated by 'django-admin startproject' using Django.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
import os
... | Python | 0 | @@ -1297,111 +1297,8 @@
= (%0A
- # @see https://docs.djangoproject.com/en/1.7/ref/middleware/#django.middleware.gzip.GZipMiddleware%0A
|
2f825384320575cd81eb00f6f8c4d92e4941d619 | add support for markdown tables | site/conf.py | site/conf.py | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | Python | 0 | @@ -1254,16 +1254,46 @@
nmark',%0A
+ 'sphinx_markdown_tables',%0A
%5D%0A%0A# Add
|
1a6706db4660738f1c60093512036919469817dd | Fix dict size changing on iteration | cogs/last_seen.py | cogs/last_seen.py | from cogs.cog import Cog
from datetime import datetime
import asyncio
from concurrent.futures import ThreadPoolExecutor
from bot.bot import command
from sqlalchemy.exc import SQLAlchemyError
from utils.utilities import check_user_mention
class UserSeen:
def __init__(self, user, server_id=None):
self.user_... | Python | 0.000001 | @@ -985,62 +985,8 @@
p())
-%0A self._lock = asyncio.Lock(loop=self.bot.loop)
%0A%0A
@@ -1061,16 +1061,75 @@
return%0A%0A
+ updates = self._updates%0A self._updates = %7B%7D%0A
@@ -1230,22 +1230,16 @@
date in
-self._
updates.
@@ -1473,38 +1473,8 @@
'))%0A
- self._updates.cl... |
54a94e2a9ec47382f520a851241b3aec88c607cf | use ctx manager for thread pool | scripts/RT/proctor_sweep.py | scripts/RT/proctor_sweep.py | """Proctor script for running the SWEEP model.
See dailyerosion/dep#36 for generally more details.
"""
import argparse
import sys
import datetime
import shutil
import subprocess
from multiprocessing import Pool
from pyiem.util import get_dbconn, logger
import pandas as pd
import requests
from tqdm import tqdm
from pa... | Python | 0 | @@ -4128,22 +4128,33 @@
-pool = Pool()%0A
+with Pool() as pool:%0A
@@ -4178,16 +4178,20 @@
+
+
pool.ima
@@ -4219,16 +4219,20 @@
jobs),%0A
+
@@ -4260,16 +4260,20 @@
+
disable=
@@ -4297,26 +4297,34 @@
atty(),%0A
+
-)%0A
+ )%0A
for idx,
@@ -434... |
f945c054023220f865032817d04309005e50015e | update __init__.py for SRAMs | pclib/rtl/__init__.py | pclib/rtl/__init__.py |
from regs import Reg, RegEn, RegRst, RegEnRst
from arith import Adder, Subtractor, Incrementer
from arith import ZeroExtender, SignExtender
from arith import ZeroComparator, EqComparator, LtComparator, GtComparator
from arith import SignUnit, UnsignUnit
from arith import Lef... | Python | 0.000001 | @@ -582,16 +582,85 @@
rbiterEn
+%0Afrom SRAMs import SRAMBitsComb_rst_1rw, SRAMBytesComb_rst_1rw
%0A%0Afrom q
|
8e3993a644ff65f12495ac39198288dcb7b95e51 | Remove print statements | peakachulib/deseq2.py | peakachulib/deseq2.py | import numpy as np
import pandas as pd
from rpy2 import robjects
from rpy2.robjects import r, Formula, pandas2ri
pandas2ri.activate()
class RunDESeq2(object):
def __init__(self, count_df, exp_lib_list, ctr_lib_list, size_factors,
pairwise_replicates):
r("suppressMessages(library(DESeq2))... | Python | 0.001543 | @@ -839,29 +839,8 @@
st)%0A
- print(conds)%0A
@@ -1006,35 +1006,8 @@
1))%0A
- print(samples)%0A
|
f6e46f0bd749726cf5d970de560d408c9b8b21e4 | debug for blob centers | unify_label_func.py | unify_label_func.py | import os
import pdb
import glob as glob
import cPickle as pickle
import numpy as np
from scipy.io import loadmat,savemat
def unify_label(matfiles,savename):
atmp = []
flab = [] #final labels
ftrjID = [] #final trjID
for matidx in range(len(matfiles)-1):
if matidx == 0:
... | Python | 0 | @@ -782,16 +782,40 @@
labels%0A%0A
+ pdb.set_trace()%0A
@@ -893,16 +893,16 @@
cations%0A
-
@@ -1091,24 +1091,26 @@
+ #
label1 =
@@ -1189,24 +1189,26 @@
+ #
label2 =
@@ -1241,16 +1241,93 @@
%5B0%5D%5B0%5D%5D%0A
+ label1 = L1%5BM1==i%5D%5B... |
b5c8fbc44cf35ee1a26278c7b5e11270b149dc6c | remove known_failure for CASSANDRA-10887 | pending_range_test.py | pending_range_test.py | from cassandra.query import SimpleStatement
from dtest import TRACE, Tester, debug
from tools import known_failure, no_vnodes
@no_vnodes()
class TestPendingRangeMovements(Tester):
@known_failure(failure_source='cassandra',
jira_url='https://issues.apache.org/jira/browse/CASSANDRA-10887')
d... | Python | 0.000116 | @@ -97,23 +97,8 @@
port
- known_failure,
no_
@@ -165,140 +165,8 @@
):%0A%0A
- @known_failure(failure_source='cassandra',%0A jira_url='https://issues.apache.org/jira/browse/CASSANDRA-10887')%0A
|
22207247c286ad3c656c3f6b550d869cf92f6e92 | Add fs Opener based on the builtin FTPFS opener | fs/sshfs/__init__.py | fs/sshfs/__init__.py | from __future__ import absolute_import
from __future__ import unicode_literals
from .sshfs import SSHFS
| Python | 0.000001 | @@ -98,8 +98,637 @@
t SSHFS%0A
+%0Afrom ..opener import Opener, registry%0A%0A%0A@registry.install%0Aclass SSHOpener(Opener):%0A protocols = %5B'ssh'%5D%0A%0A def open_fs(self, fs_url, parse_result, writeable, create, cwd):%0A #from .sshfs import SSHFS%0A ssh_host, _, dir_path = parse_result.resour... |
061defa1243775f6504df268ef4114edd952a2d5 | remove unused variable | updatebot/update.py | updatebot/update.py | #
# Copyright (c) 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/permanent/... | Python | 0 | @@ -4722,87 +4722,8 @@
lse%0A
- newLocations = %5B x.location for x in self._rpmSource.srcPkgMap%5Bsrpm%5D %5D%0A
|
13e603129b976702fb6367b0eec72b597df7334a | comment typo | greins/app.py | greins/app.py | import glob
import inspect
import os.path
import sys
import textwrap
import traceback
from gunicorn.app.wsgiapp import WSGIApplication
from gunicorn.config import make_settings
from greins.reloader import Reloader
from greins.router import Router
class GreinsApplication(WSGIApplication):
def init(self, parser, ... | Python | 0.000001 | @@ -2676,17 +2676,16 @@
Read an
-n
app con
|
714b517c18c1bdedafd6cd5451df2f64ce9c6ef9 | add GetSliceTicket | PLC/Methods/__init__.py | PLC/Methods/__init__.py | methods = 'AddAddressType AddAddressTypeToAddress AddBootState AddConfFile AddConfFileToNodeGroup AddConfFileToNode AddKeyType AddMessage AddNetworkMethod AddNetworkType AddNodeGroup AddNodeNetwork AddNode AddNodeToNodeGroup AddNodeToPCU AddPCU AddPeer AddPersonKey AddPerson AddPersonToSite AddPersonToSlice AddRole Add... | Python | 0 | @@ -2592,16 +2592,31 @@
tSlices
+GetSliceTicket
GetSlive
|
987516c5ea2c9533de3186653988461ad4f897da | Switch custom redirect state to off in mendeley OAuth2. Closes #234 | social/backends/mendeley.py | social/backends/mendeley.py | """
Mendeley OAuth1 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/mendeley.html
"""
from social.backends.oauth import BaseOAuth1, BaseOAuth2
class MendeleyMixin(object):
SCOPE_SEPARATOR = '+'
EXTRA_DATA = [('profile_id', 'profile_id'),
('name', 'name'),
(... | Python | 0 | @@ -1816,16 +1816,43 @@
%5B'all'%5D%0A
+ REDIRECT_STATE = False%0A
EXTR
|
2d57a959fa18335554ca2133fb71e081c8281c00 | check for empty string instead of falsy in SkipNullMixin | OIPA/api/generics/serializers.py | OIPA/api/generics/serializers.py | from rest_framework import serializers
from rest_framework.pagination import PageNumberPagination
from rest_framework.fields import SkipField
from collections import OrderedDict
class XMLMetaMixin(object):
def to_representation(self, *args, **kwargs):
representation = super(XMLMetaMixin, self).to_represen... | Python | 0.000004 | @@ -905,31 +905,20 @@
te i
-s
+n %5B
None
- or not attribute
+, ''%5D
:%0A
|
3c1583f2090cdedc6cd5ffef41cb620f92ef613d | Fix skip message for php tests (it incorrectly mentioned looking for the php-cgi binary) | trac/mimeview/tests/php.py | trac/mimeview/tests/php.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2006 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... | Python | 0.000016 | @@ -5882,11 +5882,11 @@
(php
--cg
+ cl
i bi
|
b54f2549fd6d9a97492a652aae29a4e47f46920d | add todo for trash factory | trashtalk/trash_factory.py | trashtalk/trash_factory.py | from __future__ import print_function, absolute_import
from pwd import getpwnam
from os import getlogin
from pathlib import Path
from trashtalk.trash import Trash
import sys
class TrashFactory():
"""
"""
def create_trash(self, users=[], medias=[], home=True, all_media=False, error=True):
trashs =... | Python | 0 | @@ -168,16 +168,251 @@
rt sys%0A%0A
+%22%22%22%0AModule who generate trash%0A%0A:Todo%0Arename file: generate_trash.py%0Aremove class and make function%0Achange this in core.py and autocomplete_bash.py%0Aadd better way of searching media or trash%0A%22%22%22%0A%0AMEDIA_DIR = %5B'/media'%5D%0ATRASHS_PATH = %5B%5D%0A
%... |
06ce47919af54266d5dee131a922d915504a44d5 | Add new properties to ElastiCache::ReplicationGroup | troposphere/elasticache.py | troposphere/elasticache.py | # Copyright (c) 2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
from .validators import boolean, integer, network_port
class CacheCluster(AWSObject):
resource_type = "AWS::ElastiCache::CacheCluster"
props = {
'A... | Python | 0 | @@ -3258,32 +3258,127 @@
%0A%0A props = %7B%0A
+ 'AtRestEncryptionEnabled': (boolean, False),%0A 'AuthToken': (basestring, False),%0A
'AutoMin
@@ -4640,32 +4640,86 @@
(Tags, False),%0A
+ 'TransitEncryptionEnabled': (boolean, False),%0A
%7D%0A%0A def v
|
39cfac639bff32660ad7f1ec9748dd82f141b978 | add comment reply test | tuneme/tests/test_views.py | tuneme/tests/test_views.py | from datetime import datetime
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.test.client import Client
from molo.core.models import ArticlePage
from molo.commenting.models import MoloComment
from molo.commenting.forms import MoloCo... | Python | 0 | @@ -23,16 +23,45 @@
atetime%0A
+from bs4 import BeautifulSoup
%0Afrom dj
@@ -660,16 +660,429 @@
ster')%0A%0A
+ def create_comment(self, article, comment, parent=None):%0A return MoloComment.objects.create(%0A content_type=ContentType.objects.get_for_model(article),%0A object_pk=articl... |
46c861ff0df64a3ce7bffd205ffcd2da0ae07791 | password can't be empty | wsgiwars/views.py | wsgiwars/views.py | import datetime
from pyramid.view import view_config
from pyramid.threadlocal import get_current_registry
from pyramid.httpexceptions import HTTPFound
from pyramid.httpexceptions import HTTPNotFound
from pyramid.security import remember
from pyramid.security import forget
from pyramid_mailer.mailer import Mailer
from... | Python | 0.999324 | @@ -2427,16 +2427,185 @@
nup'))%0A%0A
+ if not request.POST%5B'password'%5D.strip():%0A request.session.flash(u%22You realy need a password%22)%0A return HTTPFound(location=request.route_path('signup'))%0A
%0A if
|
bc3a795902a84ae49fc12753c3f391b98b9a924d | Add the "user is away" line to WHOIS output | txircd/modules/cmd_away.py | txircd/modules/cmd_away.py | from twisted.words.protocols import irc
from txircd.modbase import Command
class AwayCommand(Command):
def onUse(self, user, data):
if "reason" in data:
user.metadata["away"] = data["reason"]
user.sendMessage(irc.RPL_NOWAWAY, ":You have been marked as being away")
else:
if "away" in user.metadata:
de... | Python | 0.00327 | @@ -905,16 +905,264 @@
away%22%5D))
+%0A%09%0A%09def whoisLine(self, command, data):%0A%09%09if command != %22WHOIS%22:%0A%09%09%09return%0A%09%09user = data%5B%22user%22%5D%0A%09%09target = data%5B%22targetuser%22%5D%0A%09%09if %22away%22 in target.metadata:%0A%09%09%09user.sendMessage(irc.RPL_AWAY, target.username, ... |
c2400d5c5349e70bf375d4fe3cab9a4e9f851d31 | improve test to use Twisted listener, not nc | txtorcon/test/test_util.py | txtorcon/test/test_util.py | from twisted.trial import unittest
from twisted.test import proto_helpers
from txtorcon.util import process_from_address, delete_file_or_tree
import os
import tempfile
import subprocess
class FakeState:
tor_pid = -1
class TestProcessFromUtil(unittest.TestCase):
def setUp(self):
self.fakestate = Fak... | Python | 0.000001 | @@ -71,156 +71,608 @@
ers%0A
-%0Afrom txtorcon.util import process_from_address, delete_file_or_tree%0A%0Aimport os%0Aimport tempfile%0Aimport subprocess%0A%0Aclass FakeState:%0A tor_pid = -1
+from twisted.internet import defer%0Afrom twisted.internet.endpoints import TCP4ServerEndpoint%0Afrom twisted.internet.inte... |
3c776b0dd950a7444dfc58f2bf8d1f15ab3e6a21 | make a dependency-error'd version of nwis.hdf5 | ulmo/usgs/nwis/__init__.py | ulmo/usgs/nwis/__init__.py | """
`USGS National Water Information System`_ web services
.. _USGS National Water Information System: http://waterdata.usgs.gov/nwis
"""
from __future__ import absolute_import
from . import core
from .core import (get_sites, get_site_data)
from ulmo import util
try:
from . import hdf5
pytables = ... | Python | 0.000001 | @@ -298,20 +298,215 @@
rt hdf5%0A
-
+%0Aexcept ImportError:%0A hdf5 = util.module_with_dependency_errors(%5B%0A 'get_site',%0A 'get_sites',%0A 'get_site_data',%0A 'update_site_list',%0A 'update_site_data',%0A %5D)%0A%0A
pytables
@@ -548,36 +548,32 @@
nings(%5B%0A
... |
e016e370ed6755a972361714c08a555bee27a0ba | fix flake8 validation | uplink/clients/aiohttp_.py | uplink/clients/aiohttp_.py | """
This module defines an :py:class:`aiohttp.ClientSession` adapter
that returns awaitable responses.
"""
# Standard library imports
import asyncio
import collections
import threading
from concurrent import futures
from functools import partial
# Third party imports
try:
import aiohttp
except ImportError: # prag... | Python | 0 | @@ -212,38 +212,8 @@
ures
-%0Afrom functools import partial
%0A%0A#
|
934bd6c894dc461282d5ff2f450672eb76476698 | Fix typo. | upload/backend/importer.py | upload/backend/importer.py | from pupa.scrape import (Jurisdiction, Person, Organization, Membership, Post)
from pupa.importers import (OrganizationImporter, PersonImporter, PostImporter,
MembershipImporter)
from django.db import transaction
def do_import(stream, transaction):
stream = list(stream)
jurisdictio... | Python | 0.001604 | @@ -258,16 +258,17 @@
stream,
+s
transact
@@ -321,16 +321,17 @@
on_id =
+s
transact
@@ -692,125 +692,8 @@
= %7B%7D
-%0A # This basically relates to Pupa's pupa.clu.commands.update:113%0A # (From there - wrap this in a transaction.)
%0A%0A
|
9266523f2b5c1e7bf3aa807875d5b6887a675fdc | Fix typo in test class name | users/tests/test_models.py | users/tests/test_models.py | from unittest import TestCase
from unittest.mock import patch
from django.test import TestCase as DjangoTestCase
from rest_framework.authtoken.models import Token
import pytest
from .. import models
class UserModelTet(TestCase):
"""Tests for User model."""
def test_save_with_name(self):
name = "My... | Python | 0.013612 | @@ -213,16 +213,17 @@
rModelTe
+s
t(TestCa
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.